function __construct() { // Backend Widget Realtime action add_action('wp_ajax_gadashadmin_get_realtime', array($this, 'ajax_adminwidget_realtime')); // Admin Widget get Reports action add_action('wp_ajax_gadashadmin_get_widgetreports', array($this, 'ajax_adminwidget_reports')); }
/** * Create Options page * * @uses add_theme_page() * @uses add_action() * * @since 1.0.0 */ function optionsframework_add_admin() { $of_page = add_object_page('North', 'North', 'manage_options', 'optionsframework', 'optionsframework_options_page'); // Add framework functionaily to the head individually add_action("admin_enqueue_scripts", 'of_load_only'); add_action("admin_enqueue_scripts", 'of_style_only'); }
function __construct() { add_action('in_widget_form', array(&$this, 'extend_recent_posts_form'), 10, 3); add_filter('widget_update_callback', array(&$this, 'extend_recent_posts_update'), 10, 4); add_filter('widget_title', array(&$this, 'extend_recent_posts_init_query_filter'), 10, 3); add_filter('widget_posts_args', array(&$this, 'extend_recent_posts_query')); }
/** * Constructor for the session class. */ public function __construct() { global $wpdb; $this->_cookie = 'wp_woocommerce_session_' . COOKIEHASH; $this->_table = $wpdb->prefix . 'woocommerce_sessions'; if ($cookie = $this->get_session_cookie()) { $this->_customer_id = $cookie[0]; $this->_session_expiration = $cookie[1]; $this->_session_expiring = $cookie[2]; $this->_has_cookie = true; // Update session if its close to expiring if (time() > $this->_session_expiring) { $this->set_session_expiration(); $this->update_session_timestamp($this->_customer_id, $this->_session_expiration); } } else { $this->set_session_expiration(); $this->_customer_id = $this->generate_customer_id(); } $this->_data = $this->get_session_data(); // Actions add_action('woocommerce_set_cart_cookies', array($this, 'set_customer_session_cookie'), 10); add_action('woocommerce_cleanup_sessions', array($this, 'cleanup_sessions'), 10); add_action('shutdown', array($this, 'save_data'), 20); add_action('wp_logout', array($this, 'destroy_session')); if (!is_user_logged_in()) { add_filter('nonce_user_logged_out', array($this, 'nonce_user_logged_out')); } }
/** * Check if installation environment meets minimum PB requirements. * Can be shared by other plugins that depend on Pressbooks. Example usage: * * if ( ! @include_once( WP_PLUGIN_DIR . '/pressbooks/compatibility.php' ) ) { * add_action( 'admin_notices', function () { * echo '<div id="message" class="error fade"><p>' . __( 'Cannot find Pressbooks install.', 'pressbooks' ) . '</p></div>'; * } ); * return; * } * elseif ( ! pb_meets_minimum_requirements() ) { * return; * } * * * @return bool */ function pb_meets_minimum_requirements() { $is_compatible = true; // --------------------------------------------------------------------------------------------------------------- // PHP Version // --------------------------------------------------------------------------------------------------------------- // Override PHP version at your own risk! global $pb_minimum_php; if (empty($pb_minimum_php)) { $pb_minimum_php = '5.6.0'; } if (!version_compare(PHP_VERSION, $pb_minimum_php, '>=')) { add_action('admin_notices', '_pb_minimum_php'); $is_compatible = false; } // --------------------------------------------------------------------------------------------------------------- // WordPress Version // --------------------------------------------------------------------------------------------------------------- // Override WP version at your own risk! global $pb_minimum_wp; if (empty($pb_minimum_wp)) { $pb_minimum_wp = '4.4'; } if (!is_multisite() || !version_compare(get_bloginfo('version'), $pb_minimum_wp, '>=')) { add_action('admin_notices', '_pb_minimum_wp'); $is_compatible = false; } return $is_compatible; }
/** * Class contructor * * @since 0.2 **/ public function __construct() { // activation ## register_activation_hook(__FILE__, array($this, 'register_activation_hook')); // deactivation ## register_deactivation_hook(__FILE__, array($this, 'register_deactivation_hook')); // uninstall ## // TODO ## // load in mobile detect class ## if (!class_exists('Mobile_Detect')) { include Q_BROWSERS_PATH . '/library/mobile_detect.php'; } // instatiate class ## $this->detect = new Mobile_Detect(); $this->detect->setDetectionType('extended'); // extended search ## // grab user agent ## $this->useragent = $_SERVER['HTTP_USER_AGENT'] ? $_SERVER['HTTP_USER_AGENT'] : false; if (is_admin()) { // text-domain ## add_action('plugins_loaded', array($this, 'load_plugin_textdomain'), 1); // plugin URL ## $this->plugin_URL = WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)); $this->plugin_dir_path = plugin_dir_url(__FILE__); } else { // conditional stylesheets for browser tweaks ## add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_conditional'), 10000000); // load them late ## // browser body_class ## add_filter('body_class', array($this, 'body_classes'), 1); // comments ## add_action('wp_footer', array($this, 'comments'), 1000); } }
/** * Initialize Module * * @param none * @return void */ public function init() { // Save custom post data add_action('save_post', array(&$this, 'post_save')); // Add Force SSL checkbox to edit post screen add_action('add_meta_boxes', array(&$this, 'add_meta_box_post')); }
/** * Hook in methods. */ public static function init() { add_action('template_redirect', array(__CLASS__, 'geolocation_ajax_redirect')); add_action('before_woocommerce_init', array(__CLASS__, 'prevent_caching')); add_action('admin_notices', array(__CLASS__, 'notices')); add_action('delete_version_transients', array(__CLASS__, 'delete_version_transients')); }
private function _add_hooks() { add_action('eab-settings-after_api_settings', array($this, 'show_settings')); add_filter('eab-settings-before_save', array($this, 'save_settings')); add_filter('eab-event_meta-event_meta_box-after', array($this, 'add_capacity_meta_box')); add_action('eab-event_meta-save_meta', array($this, 'save_capacity_meta')); add_action('eab-events-recurrent_event_child-save_meta', array($this, 'save_capacity_meta')); add_action('admin_print_scripts-post.php', array($this, 'enqueue_admin_dependencies')); add_action('admin_print_scripts-post-new.php', array($this, 'enqueue_admin_dependencies')); add_action('eab-javascript-enqueue_scripts', array($this, 'enqueue_public_dependencies')); add_filter('eab-rsvps-rsvp_form', array($this, 'handle_rsvp_form'), 10, 2); add_filter('eab-event-payment_forms', array($this, 'show_remaining_tickets'), 10, 2); add_filter('eab-payment-paypal_tickets-extra_attributes', array($this, 'handle_paypal_tickets'), 10, 3); // Front page editor integration add_filter('eab-events-fpe-add_meta', array($this, 'add_fpe_meta_box'), 10, 2); add_action('eab-events-fpe-enqueue_dependencies', array($this, 'enqueue_fpe_dependencies'), 10, 2); add_action('eab-events-fpe-save_meta', array($this, 'save_fpe_meta'), 10, 2); // Attendance data juggling add_filter('_eab-capacity-internal-attendance', array($this, 'get_remaining_capacity'), 10, 2); // MarketPress integration add_action('eab-mp-variation-meta', array($this, 'add_mp_inventory'), 10, 5); add_action('eab-mp-variation-thrash', array($this, 'thrash_mp_inventory'), 10, 2); //Prevent the attendion in the hook rather than just use the form add_action('incsub_event_booking', array($this, 'validate_attending_submission'), 10, 3); }
public function __construct() { $this->registered_settings = array(); $this->legacy_valid_control_types = array('checkbox', 'color', 'dropdown-pages', 'file', 'image', 'radio', 'select', 'text'); add_action('customize_register', array($this, 'register_settings')); add_action('customize_register', array($this, 'enqueue_sanitization')); }
/** * Setup post options * * @since 1.0 */ function dslc_setup_post_options() { /* Add meta boxes on the 'add_meta_boxes' hook. */ add_action('add_meta_boxes', 'dslc_add_post_options'); /* Save post meta on the 'save_post' hook. */ add_action('save_post', 'dslc_save_post_options', 10, 2); }
public function __construct() { $this->in_jetpack = defined('IS_WPCOM') && IS_WPCOM ? false : true; if ($this->in_jetpack) { $active = Jetpack::get_active_modules(); if (!in_array('sharedaddy', $active) && !in_array('publicize', $active) && !in_array('likes', $active)) { add_action('admin_menu', array($this, 'sharing_menu')); // we don't have a sharing page yet } add_action('jetpack_activate_module_likes', array($this, 'module_toggle')); add_action('jetpack_deactivate_module_likes', array($this, 'module_toggle')); Jetpack::enable_module_configurable(__FILE__); Jetpack::module_configuration_load(__FILE__, array($this, 'configuration_redirect')); } // The visible UI elements for the user add_action('load-settings_page_sharing', array($this, 'load_management_script_assets')); add_action('pre_admin_screen_sharing', array($this, 'connection_screen'), 15); add_action('admin_init', array($this, 'add_meta_box')); add_action('do_meta_boxes', array($this, 'should_we_show_the_meta_box')); add_action('sharing_global_options', array($this, 'admin_settings_init'), 20); add_action('sharing_admin_update', array($this, 'admin_settings_callback'), 20); if ($this->in_jetpack) { add_action('pre_admin_screen_sharing', array($this, 'jetpack_disconnect'), 10); } }
/** * */ private function __construct() { register_activation_hook(__FILE__, array($this, 'activate')); $this->includes(); if (is_admin()) { $this->admin_includes(); } add_filter('woocommerce_shipping_methods', array($this, 'add_method')); add_filter('woocommerce_checkout_fields', array($this, 'add_delivery_points_field'), 99); add_filter('woocommerce_default_address_fields', array($this, 'default_address_fields'), 99); add_filter('woocommerce_country_locale_field_selectors', array($this, 'add_city_id_field_selector')); add_filter('woocommerce_form_field_hidden', array($this, 'form_field_hidden'), 10, 4); add_action('woocommerce_after_checkout_billing_form', array($this, 'delivery_points_map')); add_action('woocommerce_checkout_process', array($this, 'delivery_point_field_process')); add_action('woocommerce_checkout_update_order_review', array($this, 'update_order_review')); add_action('woocommerce_checkout_update_order_meta', array($this, 'checkout_field_update_order_meta')); add_action('woocommerce_email_order_meta', array($this, 'email_order_meta'), 99); add_filter('default_checkout_state', array($this, 'default_checkout_state')); add_filter('pre_update_option_woocommerce_' . self::$method_id . '_settings', array($this, 'check_shop_contract'), 10, 2); add_filter('woocommerce_cart_shipping_packages', array($this, 'shipping_packages'), 10); //Ajax add_filter('woocommerce_update_order_review_fragments', array($this, 'ajax_update_delivery_points')); add_filter('woocommerce_params', array($this, 'is_door_params')); add_action('wp_enqueue_scripts', array($this, 'load_script')); add_action('admin_enqueue_scripts', array($this, 'admin_load_script')); }
/** * Register the Groups component admin screen. * * @since 1.7.0 */ function bp_groups_add_admin_menu() { // Add our screen $hook = add_menu_page(_x('Groups', 'Admin Groups page title', 'buddypress'), _x('Groups', 'Admin Groups menu', 'buddypress'), 'bp_moderate', 'bp-groups', 'bp_groups_admin', 'div'); // Hook into early actions to load custom CSS and our init handler. add_action("load-{$hook}", 'bp_groups_admin_load'); }
function __construct() { self::$inst =& $this; self::$instance =& $this; //get all options add_filter('__options', array($this, 'tc_get_theme_options'), 10, 1); //get single option add_filter('__get_option', array($this, 'tc_opt'), 10, 2); //deprecated //some useful filters add_filter('__ID', array($this, 'tc_id')); //deprecated add_filter('__screen_layout', array($this, 'tc_get_layout'), 10, 2); //deprecated add_filter('__is_home', array($this, 'tc_is_home')); add_filter('__is_home_empty', array($this, 'tc_is_home_empty')); add_filter('__post_type', array($this, 'tc_get_post_type')); add_filter('__is_no_results', array($this, 'tc_is_no_results')); add_filter('__article_selectors', array($this, 'tc_article_selectors')); //social networks add_filter('__get_socials', array($this, 'tc_get_social_networks')); //WP filters add_action('after_setup_theme', array($this, 'tc_wp_filters')); //init properties add_action('after_setup_theme', array($this, 'tc_init_properties')); }
/** * [__construct description] */ function __construct() { if (!defined("WOABSPATH")) { define("WOABSPATH", dirname(__FILE__)); } if (!defined("WOURI")) { define("WOURI", plugins_url("/", __FILE__)); } if (function_exists("__autoload")) { spl_autoload_register("__autoload"); } spl_autoload_register(array($this, 'autoload')); /** * Custom auth hook * This MUST run before anything just to be safe. 20 seems to be the highest so we will stay close with * priority set to 21 * * @since 3.1.3 */ add_filter('determine_current_user', array($this, '_wo_authenicate_bypass'), 10); /** * load all dependents * * @since 1.0.0 */ add_action("init", array(__CLASS__, "includes")); }
public function __construct() { $this->load_gapi_data(); // hook into post updater add_action('social_metrics_data_sync', array($this, 'sync_data'), 10, 2); // Display notices on plugin page add_action('admin_notices', array($this, 'notices')); if ($_POST && $_GET['section'] == 'gapi') { // Multisite mode if (isset($_POST['multisite_mode'])) { $this->set_multisite_mode($_POST['multisite_mode']); } // GAPI Credentials if (isset($_POST['gapi_client_id'])) { $this->data['gapi_client_id'] = $_POST['gapi_client_id']; } if (isset($_POST['gapi_client_secret'])) { $this->data['gapi_client_secret'] = $_POST['gapi_client_secret']; } if (isset($_POST['gapi_developer_key'])) { $this->data['gapi_developer_key'] = $_POST['gapi_developer_key']; } // Profile selection if (isset($_POST['gapi_profile_id'])) { $elems = explode(',', $_POST['gapi_profile_id'], 2); $this->data['gapi_profile_id'] = $elems[0]; $this->data['gapi_profile_name'] = $elems[1]; } // Save to DB $this->update_gapi_data(); } }
/** * Constructor method for the UI_Stepper class. * * @since 4.0.0 */ function __construct($args = array()) { $this->defaults_settings['id'] = 'cherry-ui-stepper-' . uniqid(); $this->settings = wp_parse_args($args, $this->defaults_settings); add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue_assets')); self::enqueue_assets(); }
/** * Hook in tabs. */ public function __construct() { if (apply_filters('woocommerce_enable_setup_wizard', true) && current_user_can('manage_woocommerce')) { add_action('admin_menu', array($this, 'admin_menus')); add_action('admin_init', array($this, 'setup_wizard')); } }
/** * Hook in tabs. */ public function __construct() { add_action('show_user_profile', array($this, 'add_customer_meta_fields')); add_action('edit_user_profile', array($this, 'add_customer_meta_fields')); add_action('personal_options_update', array($this, 'save_customer_meta_fields')); add_action('edit_user_profile_update', array($this, 'save_customer_meta_fields')); }
function gsalborz_ahoy() { //Allow editor style. //add_editor_style( get_stylesheet_directory_uri() . '/library/css/editor-style.css' ); // let's get language support going, if you need it load_theme_textdomain('gsalborz', get_template_directory() . '/languages'); // USE THIS TEMPLATE TO CREATE CUSTOM POST TYPES EASILY require_once 'library/custom-post-type.php'; // launching operation cleanup add_action('init', 'gsalborz_head_cleanup'); // A better title add_filter('wp_title', 'rw_title', 10, 3); // remove WP version from RSS add_filter('the_generator', 'gsalborz_rss_version'); // remove pesky injected css for recent comments widget add_filter('wp_head', 'gsalborz_remove_wp_widget_recent_comments_style', 1); // clean up comment styles in the head add_action('wp_head', 'gsalborz_remove_recent_comments_style', 1); // clean up gallery output in wp add_filter('gallery_style', 'gsalborz_gallery_style'); // enqueue base scripts and styles add_action('wp_enqueue_scripts', 'gsalborz_scripts_and_styles', 999); // ie conditional wrapper // launching this stuff after theme setup gsalborz_theme_support(); // adding sidebars to Wordpress (these are created in functions.php) add_action('widgets_init', 'gsalborz_register_sidebars'); // cleaning up random code around images add_filter('the_content', 'gsalborz_filter_ptags_on_images'); // cleaning up excerpt add_filter('excerpt_more', 'gsalborz_excerpt_more'); }
public function __construct() { // FIXME maybe not available on every installations but widely used by WP plugins spl_autoload_register(array(&$this, 'autoload')); // autoload classes $install = new PLL_Install(POLYLANG_BASENAME); // stopping here if we are going to deactivate the plugin (avoids breaking rewrite rules) if ($install->is_deactivation()) { return; } // plugin initialization // take no action before all plugins are loaded add_action('plugins_loaded', array(&$this, 'init'), 1); // override load text domain waiting for the language to be defined // here for plugins which load text domain as soon as loaded :( if (!defined('PLL_OLT') || PLL_OLT) { PLL_OLT_Manager::instance(); } // loads the API require_once PLL_INC . '/api.php'; // WPML API if (!defined('PLL_WPML_COMPAT') || PLL_WPML_COMPAT) { PLL_WPML_Compat::instance(); } // extra code for compatibility with some plugins if (!defined('PLL_PLUGINS_COMPAT') || PLL_PLUGINS_COMPAT) { PLL_Plugins_Compat::instance(); } }
/** * Register your own sitemap. Call this during 'init'. * * @param string $name The name of the sitemap * @param callback $function Function to build your sitemap * @param string $rewrite Optional. Regular expression to match your sitemap with */ function register_sitemap($name, $function, $rewrite = '') { add_action('wpseo_do_sitemap_' . $name, $function); if (!empty($rewrite)) { add_rewrite_rule($rewrite, 'index.php?sitemap=' . $name, 'top'); } }
function __construct() { add_action('init', array($this, 'init_team')); add_shortcode('ult_team', array($this, 'ult_team_shortcode')); //add_action('admin_enqueue_scripts',array($this,'admin_scripts')); add_action("wp_enqueue_scripts", array($this, "register_team_assets"), 1); }
function CoolVideoGallery() { $this->plugin_url = trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__))); $this->video_player_url = trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__)) . '/cvg-player'); $this->video_player_path = trailingslashit(WP_CONTENT_DIR . '/plugins/' . dirname(plugin_basename(__FILE__)) . '/cvg-player/'); $this->table_gallery = ''; $this->table_videos = ''; $this->video_id = ''; if (function_exists('is_multisite') && is_multisite()) { $this->default_gallery_path = get_option('upload_path') . '/video-gallery/'; } else { $this->default_gallery_path = 'wp-content/uploads/video-gallery/'; } $this->winabspath = str_replace("\\", "/", ABSPATH); $this->load_video_files(); //adds scripts and css stylesheets add_action('wp_print_scripts', array(&$this, 'gallery_script')); //adds admin menu options to manage add_action('admin_menu', array(&$this, 'admin_menu')); //adds contextual help for all menus of plugin add_action('admin_init', array(&$this, 'add_gallery_contextual_help')); //adds player options to head add_action('wp_head', array(&$this, 'addPlayerHeader')); add_action('admin_head', array(&$this, 'addPlayerHeader')); //adds filter for post/page content add_filter('the_content', array(&$this, 'CVGVideo_Parse')); add_filter('the_content', array(&$this, 'CVGGallery_Parse')); add_action('wp_dashboard_setup', array(&$this, 'cvg_custom_dashboard_widgets')); }
function mm_cs_notice_launch() { if (isset($_GET['mm_cs_launch'])) { update_option('mm_coming_soon', 'false'); add_action('admin_notices', 'mm_cs_notice_launch_message'); } }
/** * Add admin menus/screens * * @access public * @return void */ public function admin_menus() { $welcome_page_name = __('Install WPLMS', 'vibe'); $welcome_page_title = __('Welcome to WPLMS', 'vibe'); if (!$this->check_installed()) { $page = add_dashboard_page($welcome_page_title, $welcome_page_name, 'manage_options', 'wplms-install', array($this, 'install_screen')); add_action('admin_print_styles-' . $page, array($this, 'admin_css')); } if (empty($_GET['page'])) { return; } $welcome_page_name = __('About WPLMS', 'vibe'); $welcome_page_title = __('Welcome to WPLMS', 'vibe'); switch ($_GET['page']) { case 'wplms-about': $page = add_dashboard_page($welcome_page_title, $welcome_page_name, 'manage_options', 'wplms-about', array($this, 'about_screen')); add_action('admin_print_styles-' . $page, array($this, 'admin_css')); break; case 'wplms-system': $page = add_dashboard_page($welcome_page_title, $welcome_page_name, 'manage_options', 'wplms-system', array($this, 'system_screen')); add_action('admin_print_styles-' . $page, array($this, 'admin_css')); break; case 'wplms-changelog': $page = add_dashboard_page($welcome_page_title, $welcome_page_name, 'manage_options', 'wplms-changelog', array($this, 'changelog_screen')); add_action('admin_print_styles-' . $page, array($this, 'admin_css')); break; } }
function add_hooks() { add_action('network_admin_notices', array($this, 'dismiss_notice'), 50); add_action('admin_notices', array($this, 'dismiss_notice'), 50); add_action('admin_notices', array($this, 'admin_notice'), 100); add_action('network_admin_notices', array($this, 'admin_notice'), 100); }
public function __construct() { $this->section = 'as-seen-on'; parent::__construct(); add_action('customize_register', array($this, 'add_controls'), 30); add_action('customize_register', array($this, 'set_controls'), 35); }
function __construct() { global $shortcode_tags; $needs_scripts = false; // Only if the slideshow shortcode has not already been defined. if (!array_key_exists('slideshow', $shortcode_tags)) { add_shortcode('slideshow', array($this, 'shortcode_callback')); $needs_scripts = true; } // Only if the gallery shortcode has not been redefined. if (isset($shortcode_tags['gallery']) && $shortcode_tags['gallery'] == 'gallery_shortcode') { add_filter('post_gallery', array($this, 'post_gallery'), 1002, 2); add_filter('jetpack_gallery_types', array($this, 'add_gallery_type'), 10); $needs_scripts = true; } if ($needs_scripts) { add_action('wp_enqueue_scripts', array($this, 'maybe_enqueue_scripts'), 1); } /** * For the moment, comment out the setting for v2.8. * The remainder should work as it always has. * See: https://github.com/Automattic/jetpack/pull/85/files */ // add_action( 'admin_init', array( $this, 'register_settings' ), 5 ); }