芝麻web文件管理V1.00
编辑当前文件:/www/wwwroot/shphe-en.com/wp-content/plugins/wp-optimize/wp-optimize.php
add_node(array( 'id' => 'wp-optimize', 'title' => 'WP-Optimize', 'href' => admin_url( 'admin.php?page=WP-Optimize', 'http' ) )); } // Add settings link on plugin page function wpo_plugin_settings_link($links) { //$optimize_link = '
Optimizer
'; $settings_link = '
' . __( 'Settings', 'wp-optimize' ) . '
'; $optimize_link = '
' . __( 'Optimizer', 'wp-optimize' ) . '
'; array_unshift($links, $settings_link); array_unshift($links, $optimize_link); return $links; } $plugin = plugin_basename(__FILE__); add_filter("plugin_action_links_$plugin", 'wpo_plugin_settings_link' ); // plugin activation actions function wpo_admin_actions() { if ( current_user_can('manage_options') ) { if (function_exists('add_meta_box')) { add_menu_page("WP-Optimize", "WP-Optimize", "manage_options", "WP-Optimize", "wp_optimize_menu", plugin_dir_url( __FILE__ ).'wpo.png'); } else { add_submenu_page("index.php", "WP-Optimize", "WP-Optimize", "manage_options", "WP-Optimize", "wp_optimize_menu", plugin_dir_url( __FILE__ ).'wpo.png'); } // end if addmeta box if (get_option( OPTION_NAME_ENABLE_ADMIN_MENU, 'false' ) == 'true' ){ add_action( 'wp_before_admin_bar_render', 'wpo_admin_bar' ); } //wpo_detectDBType(); wpo_PluginOptionsSetDefaults(); wpo_cron_activate(); } } // TODO: Need to find out why the schedule time is not refreshing function wpo_cron_activate() { //wpo_debugLog('running wpo_cron_activate()'); $gmtoffset = (int) (3600 * ((double) get_option('gmt_offset'))); if ( get_option( OPTION_NAME_SCHEDULE ) !== false ) { if ( get_option(OPTION_NAME_SCHEDULE) == 'true') { if (!wp_next_scheduled('wpo_cron_event2')) { $schedule_type = get_option(OPTION_NAME_SCHEDULE_TYPE, 'wpo_weekly'); switch ($schedule_type) { case "wpo_weekly": // $this_time = 60*60*24*7; break; case "wpo_otherweekly": // $this_time = 60*60*24*14; break; case "wpo_monthly": // $this_time = 60*60*24*31; break; default: $this_time = 60*60*24*7; break; } //$this_time = time() + $gmtoffset; add_action('wpo_cron_event2', 'wpo_cron_action'); //wp_schedule_event(current_time( "timestamp", 0 ) + $this_time + $gmtoffset, $schedule_type, 'wpo_cron_event2'); wp_schedule_event(current_time( "timestamp", 0 ) + $this_time , $schedule_type, 'wpo_cron_event2'); wpo_debugLog('running wp_schedule_event()'); //add_filter('cron_schedules', 'wpo_cron_update_sched'); } } } else wpo_PluginOptionsSetDefaults(); } function wpo_cron_deactivate() { //wp_clear_scheduled_hook('wpo_cron_event'); wpo_debugLog('running wpo_cron_deactivate()'); wp_clear_scheduled_hook('wpo_cron_event2'); } add_action('wpo_cron_event2', 'wpo_cron_action'); add_filter('cron_schedules', 'wpo_cron_update_sched'); // scheduler functions to update schedulers // possible problem found at support request // http://wordpress.org/support/topic/bug-found-in-scheduler-code function wpo_cron_update_sched( $schedules ) { $schedules['wpo_weekly'] = array('interval' => 60*60*24*7, 'display' => 'Once Weekly'); $schedules['wpo_otherweekly'] = array('interval' => 60*60*24*14, 'display' => 'Once Every Other Week'); $schedules['wpo_monthly'] = array('interval' => 60*60*24*31, 'display' => 'Once Every Month'); return $schedules; } // plugin deactivation actions function wpo_admin_actions_remove() { wpo_cron_deactivate(); wpo_removeOptions(); } add_action('admin_menu', 'wpo_admin_actions'); /* function wpo_admin_styles() { wp_register_style( 'wpo_admin_stylesheet', plugins_url( '/css/wpo_admin.css', __FILE__ ) ); wp_enqueue_style( 'wpo_admin_stylesheet' ); } add_action( 'admin_enqueue_scripts', 'wpo_admin_styles' ); */ function wpo_admin_register_head() { $style_url = plugins_url( '/css/wpo_admin.css', __FILE__ ) ; echo "
\n"; } add_action('admin_head', 'wpo_admin_register_head'); ?>