wpsc_move_theme

Located in: theming.class.php, presentation.php

Functions that call this hook: move_theme(), theme_metabox()
Arguments Accepted: none
Version Introduced: 3.8

Description: Triggered once the theme has been copied into its new location (Normally the currently active WordPress theme folder). The move_theme function is triggered from the “move theme files” button in the theme metabox on the presentation settings page.

Code in context:
theming.class.php
[php firstline=”143″ highlight=”177″]
/* Moves, renames, and appends header and footer functions to theme if they do not currently have it.
* @access public
*
* @since 3.8
* @param old – Current location of theme
* @param new -New location for theme
* @return None
*/
function move_theme( $old, $new ) {

if ( $old != WPSC_THEMES_PATH )
$theme_file_prefix = $this->theme_file_prefix;
else
$theme_file_prefix = ”;

$this->recursive_copy( $old, $new );
$path = $new;
$dh = opendir( $old );

while ( false !== ( $file = readdir( $dh ) ) ) {
if ( $file != "." && $file != ".." && !strstr( $file, ".svn" ) && !strstr( $file, "images" ) && ( strstr( $file, ‘wpsc-‘ ) || strstr($file, ‘.css’) ) ) {
if(‘wpsc-default.css’ == $file)
wpsc_move_theme_images();
if ( in_array( $file, $this->templates_to_move ) ) {
if ( !strstr( $file, "functions" ) && !strstr( $file, "widget" ) ) {
$file_data = file_get_contents( $old . "/" . $file );
$_SESSION[‘wpsc_themes_copied_results’][] = @file_put_contents( $path . "/" . $file, $file_data );
rename( $path . "/" . $file, $path . "/" . $theme_file_prefix . $file );
}
}
}
}
closedir( $dh );

do_action( ‘wpsc_move_theme’ );
}
}

if ( isset( $_REQUEST[‘wpsc_move_themes’] ) && !empty($_REQUEST[‘wpsc_move_themes’]) )
add_action( ‘admin_init’, create_function( ”, ‘global $wpsc_theming; $wpsc_theming = new wpsc_theming();’ ) ); [/php]

Code in context:
presentation.php
[php firstline=”55″ highlight=”80″][/php]
private function theme_metabox(){

$wpsc_templates = wpsc_list_product_templates();
$themes_location = wpsc_check_theme_location();
$themes_copied = false; //Check to see whether themes have been copied to selected Theme Folder
$themes_backedup = false; //Check to see whether themes have recently been backedup
$themes_in_uploads = false; //Check to see whether themes live in the uploads directory

if ( isset( $_SESSION[‘wpsc_themes_copied’] ) && ( true == $_SESSION[‘wpsc_themes_copied’] ) )
$themes_copied = true;

if ( isset( $_SESSION[‘wpsc_themes_backup’] ) && ( true == $_SESSION[‘wpsc_themes_backup’] ) )
$themes_backedup = true;

if ( wpsc_count_themes_in_uploads_directory() > 0 ) {
$themes_in_uploads = true;

foreach( (array)$themes_location as $location )
$new_location[] = str_ireplace( ‘wpsc-‘,”, $location );

$themes_location = $new_location;
}

// Used to flush transients – @since 3.8-development
if ( true === $themes_copied )
do_action( ‘wpsc_move_theme’ );

?>

[/div]