clearAllCache(); } } register_deactivation_hook( __FILE__, 'APTFSMUGbyTAP_remove' ); /** * Register Widget * * @since 1.0.0 * */ function APTFSMUGbyTAP_widget_register() {register_widget( 'Alpine_PhotoTile_for_SmugMug' );} add_action('widgets_init','APTFSMUGbyTAP_widget_register'); include_once( WP_PLUGIN_DIR.'/'.basename(dirname(__FILE__)).'/gears/alpinebot-primary.php' ); include_once( WP_PLUGIN_DIR.'/'.basename(dirname(__FILE__)).'/gears/alpinebot-secondary.php' ); include_once( WP_PLUGIN_DIR.'/'.basename(dirname(__FILE__)).'/gears/alpinebot-tertiary.php' ); include_once( WP_PLUGIN_DIR.'/'.basename(dirname(__FILE__)).'/gears/plugin-widget.php' ); include_once( WP_PLUGIN_DIR.'/'.basename(dirname(__FILE__)).'/gears/plugin-shortcode.php' ); /** * Load Admin JS and CSS * * @ Since 1.0.0 * @ Updated 1.2.3 */ function APTFSMUGbyTAP_admin_widget_script($hook){ $bot = new PhotoTileForSmugMugBot(); wp_register_script($bot->wmenujs,$bot->url.'/js/'.$bot->wmenujs.'.js','',$bot->ver); wp_register_style($bot->acss,$bot->url.'/css/'.$bot->acss.'.css','',$bot->ver); $bot->register_style_and_script(); // Register widget styles and scripts if( 'widgets.php' != $hook ){ return; } wp_enqueue_script( 'jquery'); wp_enqueue_script($bot->wmenujs); wp_enqueue_style($bot->acss); add_action('admin_print_footer_scripts', 'APTFSMUGbyTAP_menu_toggles'); // Only admin can trigger two week cache cleaning by visiting widgets.php $disablecache = $bot->get_option( 'cache_disable' ); if ( !$disablecache ) { $bot->cleanCache(); } } add_action('admin_enqueue_scripts', 'APTFSMUGbyTAP_admin_widget_script'); /** * Load JS to activate menu toggles * * @since 1.0.0 * */ function APTFSMUGbyTAP_menu_toggles(){ $bot = new PhotoTileForSmugMugBot(); ?> register_style_and_script(); // Register widget styles and scripts } add_action('wp_enqueue_scripts', 'APTFSMUGbyTAP_enqueue_display_scripts'); /** * Setup the Theme Admin Settings Page * * @ Since 1.0.1 */ function APTFSMUGbyTAP_admin_options() { $bot = new PhotoTileForSmugMugBot(); $page = add_options_page(__($bot->page), __($bot->page), 'manage_options', $bot->settings , 'APTFSMUGbyTAP_admin_options_page'); /* Using registered $page handle to hook script load */ add_action('admin_print_scripts-' . $page, 'APTFSMUGbyTAP_enqueue_admin_scripts'); } // Load the Admin Options page add_action('admin_menu', 'APTFSMUGbyTAP_admin_options'); /** * Enqueue admin scripts (and related stylesheets) * * @ Since 1.0.0 */ function APTFSMUGbyTAP_enqueue_admin_scripts() { $bot = new PhotoTileForSmugMugBot(); wp_enqueue_script( 'jquery' ); wp_enqueue_style( 'farbtastic' ); wp_enqueue_script( 'farbtastic' ); wp_enqueue_script($bot->wmenujs); wp_enqueue_style($bot->acss); add_action('admin_print_footer_scripts', 'APTFSMUGbyTAP_menu_toggles'); add_action('admin_print_footer_scripts', 'APTFSMUGbyTAP_shortcode_select'); } /** * Settings Page Markup * * @ Since 1.0.2 */ function APTFSMUGbyTAP_admin_options_page() { if (!current_user_can('manage_options')) { wp_die( __('You do not have sufficient permissions to access this page.') ); } $bot = new PhotoTileForSmugMugBot(); $bot->build_settings_page(); } ?>