are_themes_available() ) { return FALSE; } if ( get_option( 'ai1ec_themes_version', 1 ) >= AI1EC_THEMES_VERSION ) { return FALSE; } return TRUE; } /** * copy_directory function * * @return void **/ private function copy_directory( $source, $destination ) { if( is_dir( $source ) ) { @mkdir( $destination ); $directory = dir( $source ); while( FALSE !== ( $readdirectory = $directory->read() ) ) { if( $readdirectory == '.' || $readdirectory == '..' ) { continue; } $PathDir = $source . '/' . $readdirectory; if( is_dir( $PathDir ) ) { $this->copy_directory( $PathDir, $destination . '/' . $readdirectory ); continue; } copy( $PathDir, $destination . '/' . $readdirectory ); } $directory->close(); } else { copy( $source, $destination ); } } /** * install_themes function * * @return void **/ function install_themes() { ?>

wp_content_dir() . AI1EC_THEMES_FOLDER; $result = $wp_filesystem->mkdir( $themes_root ); if( $result === false ) { ?>

wp_plugins_dir() . AI1EC_PLUGIN_NAME . DIRECTORY_SEPARATOR . AI1EC_THEMES_FOLDER; $result = copy_dir( $plugin_themes_dir, $themes_root ); if( is_wp_error( $result ) ) { ?>

.

get_error_message() ), AI1EC_PLUGIN_NAME ) ?>

.

There was an error updating one of the files. Please FTP to your web server and manually copy

%s
to
%s

', AI1EC_PLUGIN_NAME ), $src_dir . $file, $dest_dir . $file ); } } update_option( 'ai1ec_themes_version', AI1EC_THEMES_VERSION ); if ( $errors ) { $msg = __( '

Errors occurred while we tried to update your core calendar files.

Please follow any instructions listed below or your calendar may malfunction:

', AI1EC_PLUGIN_NAME ); } else { $msg = __( '

Your core calendar files were updated successfully.

', AI1EC_PLUGIN_NAME ); } $args = array( 'msg' => $msg, 'errors' => $errors, ); $ai1ec_view_helper->display_admin( 'themes-updated.php', $args ); } /** * Called immediately after WP theme's functions.php is loaded. Load our own * theme's functions.php at this time, and the default theme's functions.php. */ function setup_theme() { $functions_files = array( $this->active_template_path() . '/functions.php', AI1EC_DEFAULT_THEME_PATH . '/functions.php', ); $functions_files = array_unique( $functions_files ); foreach( $functions_files as $file ) { if ( file_exists( $file ) ) { include( $file ); } } } } // END class