/** * Initialize all of our methods and such. Only runs if the module is active * * @uses add_action() */ function init() { // .ics calendar subscriptions add_action('wp_ajax_ef_calendar_ics_subscription', array($this, 'handle_ics_subscription')); add_action('wp_ajax_nopriv_ef_calendar_ics_subscription', array($this, 'handle_ics_subscription')); // Check whether the user should have the ability to view the calendar $view_calendar_cap = 'ef_view_calendar'; $view_calendar_cap = apply_filters('ef_view_calendar_cap', $view_calendar_cap); if (!current_user_can($view_calendar_cap)) { return false; } // Define the create-post capability $this->create_post_cap = apply_filters('ef_calendar_create_post_cap', 'edit_posts'); require_once EDIT_FLOW_ROOT . '/common/php/' . 'screen-options.php'; add_screen_options_panel(self::usermeta_key_prefix . 'screen_options', __('Calendar Options', 'edit-flow'), array($this, 'generate_screen_options'), self::screen_id, false, true); add_action('admin_init', array($this, 'handle_save_screen_options')); add_action('admin_init', array($this, 'register_settings')); add_action('admin_menu', array($this, 'action_admin_menu')); add_action('admin_print_styles', array($this, 'add_admin_styles')); add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts')); // Ajax manipulation for the calendar add_action('wp_ajax_ef_calendar_drag_and_drop', array($this, 'handle_ajax_drag_and_drop')); // Ajax insert post placeholder for a specific date add_action('wp_ajax_ef_insert_post', array($this, 'handle_ajax_insert_post')); //Update metadata add_action('wp_ajax_ef_calendar_update_metadata', array($this, 'handle_ajax_update_metadata')); // Clear li cache for a post when post cache is cleared add_action('clean_post_cache', array($this, 'action_clean_li_html_cache')); // Action to regenerate the calendar feed sekret add_action('admin_init', array($this, 'handle_regenerate_calendar_feed_secret')); // Hacks to fix deficiencies in core add_action('pre_post_update', array($this, 'fix_post_date_on_update_part_one'), 10, 2); add_action('post_updated', array($this, 'fix_post_date_on_update_part_two'), 10, 3); }
public function onWpInit() { // parent::onWpInit(); // custom (raw) screen options for tools page add_screen_options_panel('wpla_setting_options', '', array(&$this, 'renderSettingsOptions'), 'wp-lister_page_wpla-tools'); // load styles and scripts for this page only // add_action( 'admin_print_styles', array( &$this, 'onWpPrintStyles' ) ); add_action('admin_enqueue_scripts', array(&$this, 'onWpEnqueueScripts')); add_thickbox(); }
public function onWpInit() { // parent::onWpInit(); // custom (raw) screen options for settings page add_screen_options_panel('wpla_setting_options', '', array(&$this, 'renderSettingsOptions'), 'wp-lister_page_wpla-settings'); // Add custom screen options $load_action = "load-" . $this->main_admin_menu_slug . "_page_wpla-" . self::slug; add_action($load_action, array(&$this, 'addScreenOptions')); // network admin page add_action('network_admin_menu', array(&$this, 'onWpAdminMenu')); }
public function onWpInit() { // parent::onWpInit(); // custom (raw) screen options for settings page add_screen_options_panel('wplister_setting_options', '', array(&$this, 'renderSettingsOptions'), $this->main_admin_menu_slug . '_page_wplister-settings'); // Add custom screen options $load_action = "load-" . $this->main_admin_menu_slug . "_page_wplister-" . self::slug; add_action($load_action, array(&$this, 'addScreenOptions')); // add screen option on categories page if enabled if (get_option('wplister_enable_categories_page')) { add_action($load_action . '-categories', array(&$this, 'addScreenOptions')); } // network admin page add_action('network_admin_menu', array(&$this, 'onWpAdminMenu')); }
/** * Initialize all of our methods and such. Only runs if the module is active * * @uses add_action() */ function init() { // Check whether the user should have the ability to view the calendar $view_calendar_cap = 'ef_view_calendar'; $view_calendar_cap = apply_filters('ef_view_calendar_cap', $view_calendar_cap); if (!current_user_can($view_calendar_cap)) { return false; } require_once EDIT_FLOW_ROOT . '/common/php/' . 'screen-options.php'; add_screen_options_panel(self::usermeta_key_prefix . 'screen_options', __('Calendar Options', 'edit-flow'), array($this, 'generate_screen_options'), self::screen_id, false, true); add_action('admin_init', array($this, 'handle_save_screen_options')); add_action('admin_init', array($this, 'register_settings')); add_action('admin_menu', array($this, 'action_admin_menu')); add_action('admin_print_styles', array($this, 'add_admin_styles')); add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts')); // Ajax manipulation for the calendar add_action('wp_ajax_ef_calendar_drag_and_drop', array($this, 'handle_ajax_drag_and_drop')); }
/** * wsBrokenLinkChecker::wsBrokenLinkChecker() * Class constructor * * @param string $loader The fully qualified filename of the loader script that WP identifies as the "main" plugin file. * @param blcConfigurationManager $conf An instance of the configuration manager * @return void */ function wsBrokenLinkChecker($loader, $conf) { $this->db_version = BLC_DATABASE_VERSION; $this->conf = $conf; $this->loader = $loader; $this->my_basename = plugin_basename($this->loader); $this->load_language(); //Unlike the activation hook, the deactivation callback *can* be registered in this file //because deactivation happens after this class has already been instantiated (durinng the //'init' action). register_deactivation_hook($loader, array($this, 'deactivation')); add_action('admin_menu', array($this, 'admin_menu')); //Load jQuery on Dashboard pages (probably redundant as WP already does that) add_action('admin_print_scripts', array($this, 'admin_print_scripts')); //The dashboard widget add_action('wp_dashboard_setup', array($this, 'hook_wp_dashboard_setup')); //AJAXy hooks add_action('wp_ajax_blc_full_status', array($this, 'ajax_full_status')); add_action('wp_ajax_blc_dashboard_status', array($this, 'ajax_dashboard_status')); add_action('wp_ajax_blc_work', array($this, 'ajax_work')); add_action('wp_ajax_blc_discard', array($this, 'ajax_discard')); add_action('wp_ajax_blc_edit', array($this, 'ajax_edit')); add_action('wp_ajax_blc_link_details', array($this, 'ajax_link_details')); add_action('wp_ajax_blc_unlink', array($this, 'ajax_unlink')); add_action('wp_ajax_blc_recheck', array($this, 'ajax_recheck')); add_action('wp_ajax_blc_deredirect', array($this, 'ajax_deredirect')); add_action('wp_ajax_blc_current_load', array($this, 'ajax_current_load')); add_action('wp_ajax_blc_dismiss', array($this, 'ajax_dismiss')); add_action('wp_ajax_blc_undismiss', array($this, 'ajax_undismiss')); //Add/remove Cron events $this->setup_cron_events(); //Set hooks that listen for our Cron actions add_action('blc_cron_email_notifications', array($this, 'maybe_send_email_notifications')); add_action('blc_cron_check_links', array($this, 'cron_check_links')); add_action('blc_cron_database_maintenance', array($this, 'database_maintenance')); add_action('blc_cron_check_news', array($this, 'check_news')); //Set the footer hook that will call the worker function via AJAX. add_action('admin_footer', array($this, 'admin_footer')); //Add a "Screen Options" panel to the "Broken Links" page add_screen_options_panel('blc-screen-options', '', array($this, 'screen_options_html'), 'tools_page_view-broken-links', array($this, 'ajax_save_screen_options'), true); //Display an explanatory note on the "Tools -> Broken Links -> Warnings" page. add_action('admin_notices', array($this, 'show_warnings_section_notice')); }
function addScreenOptions() { if (isset($_GET['tab']) && $_GET['tab'] != 'repricing') { return; } if (isset($_GET['action']) && $_GET['action'] == 'edit') { // on edit page render developers options add_screen_options_panel('wpla_developer_options', '', array(&$this, 'renderDeveloperOptions'), 'toplevel_page_wpla'); } else { // render table options $option = 'per_page'; $args = array('label' => 'Listings', 'default' => 20, 'option' => 'listings_per_page'); add_screen_option($option, $args); $this->repricingTable = new WPLA_RepricingTable(); } // add_thickbox(); // wp_enqueue_script( 'thickbox' ); // wp_enqueue_style( 'thickbox' ); }
function addScreenOptions() { if (isset($_GET['action']) && $_GET['action'] == 'edit') { // on edit page render developers options add_screen_options_panel('wpla_developer_options', '', array(&$this, 'renderDeveloperOptions'), 'toplevel_page_wpla'); } else { // render table options $option = 'per_page'; $args = array('label' => 'Listings', 'default' => 20, 'option' => 'listings_per_page'); add_screen_option($option, $args); $this->listingsTable = new WPLA_ListingsTable(); } // add_thickbox(); wp_enqueue_script('thickbox'); wp_enqueue_style('thickbox'); // enqueue ProfileSelector wp_register_script('wpla_profile_selector', self::$PLUGIN_URL . '/js/classes/ProfileSelector.js?ver=' . time(), array('jquery')); wp_enqueue_script('wpla_profile_selector'); }
/** * Initialize the rest of the stuff in the class if the module is active */ function init() { $view_story_budget_cap = apply_filters('ef_view_story_budget_cap', 'ef_view_story_budget'); if (!current_user_can($view_story_budget_cap)) { return; } $this->num_columns = $this->get_num_columns(); $this->max_num_columns = apply_filters('ef_story_budget_max_num_columns', 3); // Filter to allow users to pick a taxonomy other than 'category' for sorting their posts $this->taxonomy_used = apply_filters('ef_story_budget_taxonomy_used', $this->taxonomy_used); add_action('admin_init', array($this, 'handle_form_date_range_change')); include_once EDIT_FLOW_ROOT . '/common/php/' . 'screen-options.php'; if (function_exists('add_screen_options_panel')) { add_screen_options_panel(self::usermeta_key_prefix . 'screen_columns', __('Screen Layout', 'edit-flow'), array($this, 'print_column_prefs'), self::screen_id, array($this, 'save_column_prefs'), true); } // Register the columns of data appearing on every term. This is hooked into admin_init // so other Edit Flow modules can register their filters if needed add_action('admin_init', array($this, 'register_term_columns')); add_action('admin_menu', array($this, 'action_admin_menu')); // Load necessary scripts and stylesheets add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts')); add_action('admin_enqueue_scripts', array($this, 'action_enqueue_admin_styles')); }
} // OK, we're authenticated: we need to find and save the data $fields = rawhtml_get_settings_fields(); $new_settings = array(); foreach ($fields as $field) { if (!empty($_POST['rawhtml_' . $field])) { $new_settings[$field] = true; } else { $new_settings[$field] = false; } } rawhtml_save_post_settings($post_id, $new_settings); return true; } //Add our panel to the "Screen Options" box add_screen_options_panel('rawhtml-default-settings', 'Raw HTML defaults', 'rawhtml_default_settings_panel', array('post', 'page'), 'rawhtml_save_new_defaults', true); /** * Retrieve the "disable_*" flags associated with a post. * If no flags have been set, this function will return the default settings. * * Note: Will transparently upgrade the old one-meta-key-per-flag storage system * to the new one-key-per-post one. * * @param int $post_id * @return array Flag values as an associative array. */ function rawhtml_get_post_settings($post_id) { $defaults = rawhtml_get_default_settings(); $fields = rawhtml_get_settings_fields(); //Per-post settings should be stored as a comma-separated list of 1/0 flags.
/** * Adds the "Show on screen" option to limit number of entries per page on the Connections : Manage admin page. * * @access private * @since 0.8.14 * @static * @uses get_object_vars() * @uses current_user_can() * @uses add_screen_options_panel() * @param object $screen An instance of the WordPress screen object. * @return void */ public static function screenOptionsPanel($screen) { // Grab an instance of the Connections object. $instance = Connections_Directory(); /* * In instances such as WP AJAX requests the add_menu() and add_sub_menu() functions are * not run in the admin_menu action, so the properties would not exist and will throw * PHP notices when attempting to access them. If the menus have been added then the * properties will exist so it will be safe to add the actions using the properties. */ if (get_object_vars($instance->pageHook) && current_user_can('connections_view_menu')) { /* * The Screen Layout options in the Screen Option tab only needs to be added on the manage page when NOT performing an action to an entry. * This is to prevent the Screen Layout options in the Screen Option tab on the Manage * admin page when performing an action on an entry. */ if ($screen->id == $instance->pageHook->manage && !isset($_GET['cn-action'])) { /* * Include the Screen Options class by Janis Elsts * http://w-shadow.com/blog/2010/06/29/adding-stuff-to-wordpress-screen-options/ */ include_once CN_PATH . 'vendor/screen-options/screen-options.php'; /* * Add the panel to the "Screen Options" box to the manage page. * NOTE: This relies on the the Screen Options class by Janis Elsts */ add_screen_options_panel('cn-manage-page-limit', 'Show on screen', array(__CLASS__, 'managePageLimit'), $instance->pageHook->manage); } } }