clearAllCache(); } } register_deactivation_hook( __FILE__, 'APTFFbyTAP_remove' ); /** * Register Widget * * @since 1.0.0 * */ function APTFFbyTAP_widget_register() {register_widget( 'Alpine_PhotoTile_for_Flickr' );} add_action('widgets_init','APTFFbyTAP_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 * */ function APTFFbyTAP_admin_widget_script($hook){ $bot = new PhotoTileForFlickrBot(); 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); wp_register_script($bot->wjs,$bot->url.'/js/'.$bot->wjs.'.js','',$bot->ver); wp_register_style($bot->wcss,$bot->url.'/css/'.$bot->wcss.'.css','',$bot->ver); wp_register_script( 'fancybox', $bot->url.'/js/fancybox/jquery.fancybox-1.3.4.pack.js', '', '1.0', true ); wp_register_style( 'fancybox-stylesheet', $bot->url . '/js/fancybox/jquery.fancybox-1.3.4.css', false, '1.0', 'screen' ); 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', 'APTFFbyTAP_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', 'APTFFbyTAP_admin_widget_script'); /** * Load JS to activate menu toggles * * @since 1.0.0 * */ function APTFFbyTAP_menu_toggles(){ $bot = new PhotoTileForFlickrBot(); ?> wjs,$bot->url.'/js/'.$bot->wjs.'.js','',$bot->ver); wp_register_style($bot->wcss,$bot->url.'/css/'.$bot->wcss.'.css','',$bot->ver); wp_register_script( 'fancybox', $bot->url.'/js/fancybox/jquery.fancybox-1.3.4.pack.js', '', '1.0', true ); wp_register_style( 'fancybox-stylesheet', $bot->url . '/js/fancybox/jquery.fancybox-1.3.4.css', false, '1.0', 'screen' ); } add_action('wp_enqueue_scripts', 'APTFFbyTAP_enqueue_display_scripts'); /** * Setup the Theme Admin Settings Page * * @ Since 1.0.1 */ function APTFFbyTAP_admin_options() { $bot = new PhotoTileForFlickrBot(); $page = add_options_page(__($bot->page), __($bot->page), 'manage_options', $bot->settings , 'APTFFbyTAP_admin_options_page'); /* Using registered $page handle to hook script load */ add_action('admin_print_scripts-' . $page, 'APTFFbyTAP_enqueue_admin_scripts'); } // Load the Admin Options page add_action('admin_menu', 'APTFFbyTAP_admin_options'); /** * Enqueue admin scripts (and related stylesheets) * * @ Since 1.0.0 */ function APTFFbyTAP_enqueue_admin_scripts() { $bot = new PhotoTileForFlickrBot(); 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', 'APTFFbyTAP_menu_toggles'); add_action('admin_print_footer_scripts', 'APTFFbyTAP_shortcode_select'); } /** * Settings Page Markup * * @ Since 1.0.2 */ function APTFFbyTAP_admin_options_page() { if (!current_user_can('manage_options')) { wp_die( __('You do not have sufficient permissions to access this page.') ); } $bot = new PhotoTileForFlickrBot(); $bot->build_settings_page(); } ?>