function testWL_Metabox_constructor()
 {
     $metabox = new WL_Metabox();
     // Verify the object has hooked correctly (default priority for hooks is 10)
     $this->assertEquals(10, has_action('add_meta_boxes', array($metabox, 'add_main_metabox')));
     $this->assertEquals(10, has_action('wl_linked_data_save_post', array($metabox, 'save_form_data')));
 }
Example #2
0
 /**
  * Constructor
  * 
  * @access public
  * @since 1.0.0
  */
 public function __construct($version)
 {
     $this->options = $this->_initOptions();
     $this->version = $version;
     //Actions
     add_action('init', array($this, 'init'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_scripts'));
     add_filter('plugin_action_links_' . plugin_basename(dirname(__FILE__) . '/init.php'), array($this, 'action_links'));
     add_action('woocommerce_settings_tabs_yith_wcas', array($this, 'print_plugin_options'));
     add_action('woocommerce_update_options_yith_wcas', array($this, 'update_options'));
     add_action('woocommerce_admin_field_banner', array($this, 'admin_fields_banner'));
     if (!has_action('woocommerce_admin_field_slider')) {
         add_action('woocommerce_admin_field_slider', array($this, 'admin_fields_slider'));
     }
     if (!has_action('woocommerce_admin_field_picker')) {
         add_action('woocommerce_admin_field_picker', array($this, 'admin_fields_picker'));
     }
     add_action('woocommerce_update_option_slider', array($this, 'admin_update_option'));
     add_action('woocommerce_update_option_picker', array($this, 'admin_update_option'));
     //Filters
     add_filter('woocommerce_settings_tabs_array', array($this, 'add_tab_woocommerce'), 30);
     //add_filter( 'woocommerce_catalog_settings', array( $this, 'add_catalog_image_size' ) );
     //Apply filters
     $this->banner_url = apply_filters('yith_wcas_banner_url', $this->banner_url);
     // YITH WCAS Loaded
     do_action('yith_wcas_loaded');
 }
 /**
  * Sets option defaults
  *
  * @since 1.7.0
  */
 function set_theme_option()
 {
     // Load settings
     $optionsframework_settings = get_option('optionsframework');
     // Updates the unique option id in the database if it has changed
     if (function_exists('optionsframework_option_name')) {
         optionsframework_option_name();
     } elseif (has_action('optionsframework_option_name')) {
         do_action('optionsframework_option_name');
     } else {
         $default_themename = get_option('stylesheet');
         $default_themename = preg_replace("/\\W/", "_", strtolower($default_themename));
         $default_themename = 'optionsframework_' . $default_themename;
         if (isset($optionsframework_settings['id'])) {
             if ($optionsframework_settings['id'] == $default_themename) {
                 // All good, using default theme id
             } else {
                 $optionsframework_settings['id'] = $default_themename;
                 update_option('optionsframework', $optionsframework_settings);
             }
         } else {
             $optionsframework_settings['id'] = $default_themename;
             update_option('optionsframework', $optionsframework_settings);
         }
     }
 }
Example #4
0
 /**
  * Build The Layout
  */
 function __construct($args = array(), PL_Platform $platform)
 {
     $this->platform = $platform;
     $defaults = array('title' => '', 'callback' => false, 'page_slug' => '', 'config' => array(), 'render' => 'settings');
     $this->set = wp_parse_args($args, $defaults);
     /** Gets the control array */
     $this->config = isset($this->set['callback']) && $this->set['callback'] ? call_user_func($this->set['callback']) : $this->set['config'];
     $this->current_tab_slug = isset($_GET['sel_tab']) ? $_GET['sel_tab'] : 'default';
     $this->settings_tab_slug = isset($_GET['settings_tab']) ? $_GET['settings_tab'] : 'default';
     $tab_default = array('title' => '', 'groups' => false, 'mode' => 'banner');
     $current_tab_info = isset($this->config[$this->current_tab_slug]) ? $this->config[$this->current_tab_slug] : current($this->config);
     $this->current_tab_config = wp_parse_args($current_tab_info, $tab_default);
     $this->current_page = $this->platform->tab();
     // Draw the thing
     $this->build_header();
     // if not logged in and user is a super admin.. show banner to connect account
     if ('account' == $this->current_page && !$this->platform->oauth->is_connected() && is_super_admin()) {
         $this->platform_banner();
     } elseif (has_action('pl_ui_build_body')) {
         do_action('pl_ui_build_body', $this);
     } else {
         $this->build_body();
     }
     $this->build_footer();
 }
Example #5
0
 public function render_admin_page_contents()
 {
     $tab = $this->get_active_tab();
     switch ($tab) {
         case 'general':
             $this->render_general_tab();
             break;
         case 'csv-importer':
             $this->render_csv_tab();
             break;
         default:
             include Tribe__Events__Importer__Plugin::path('src/io/csv/admin-views/header.php');
             if (has_action('tribe-import-render-tab-' . $tab)) {
                 /**
                  * Remove this Action on 4.3
                  * @deprecated
                  */
                 _doing_it_wrong('tribe-import-render-tab-' . $tab, sprintf(esc_html__('This Action has been deprecated, to comply with WordPress Standards we are now using Underscores (_) instead of Dashes (-). From: "%s" To: "%s"', 'the-events-calendar'), 'tribe-import-render-tab-' . $tab, 'tribe_import_render_tab_' . $tab), '4.0');
                 do_action('tribe-import-render-tab-' . $tab);
             }
             do_action('tribe_import_render_tab_' . $tab);
             include Tribe__Events__Importer__Plugin::path('src/io/csv/admin-views/footer.php');
             break;
     }
 }
 /**
  * Constructor.
  *
  * Supplied $args override class property defaults.
  *
  * If $args['fields'] is not defined, use the $id as the field ID.
  *
  * @since 3.4.0
  *
  * @param WP_Customize_Manager $manager
  * @param string $id
  * @param array $args
  */
 public function __construct($manager, $id, $args = array())
 {
     $this->manager = $manager;
     $this->object_name = $this->manager->get_customizer_object_name();
     // Backwards compatibility for old property names
     foreach ($this->property_map as $backcompat_arg => $actual_arg) {
         if (isset($args[$backcompat_arg])) {
             $args[$actual_arg] = $args[$backcompat_arg];
             unset($args[$backcompat_arg]);
         }
     }
     parent::__construct($this->object_type, $id, $args);
     if (empty($this->active_callback)) {
         $this->active_callback = array($this, 'active_callback');
     }
     if (!has_action('fields_render_control_' . $this->object_type, array('WP_Customize_Control', 'customize_render_control'))) {
         add_action('fields_render_control_' . $this->object_type, array('WP_Customize_Control', 'customize_render_control'));
     }
     if (!has_filter('fields_control_active_' . $this->object_type, array('WP_Customize_Control', 'customize_control_active'))) {
         add_filter('fields_control_active_' . $this->object_type, array('WP_Customize_Control', 'customize_control_active'), 10, 2);
     }
     if ('' !== $this->id) {
         add_action('fields_render_control_' . $this->object_type . '_' . $this->object_name . '_' . $this->id, array('WP_Customize_Control', 'customize_render_control_id'));
     }
 }
 public static function handle_deprecation($data)
 {
     // determine the current filter
     $current_filter = current_filter();
     // figure out if the current filter is actually in our map list
     if (isset(self::$map[$current_filter])) {
         // get a list of this function call's args, for use when calling deprecated filters
         $args = func_get_args();
         array_unshift($args, null);
         // get the list of all the potential old filters
         $old_filters = (array) self::$map[$current_filter];
         // for each matching old filter we have..
         foreach ($old_filters as $old_filter_info) {
             list($old_filter, $deprecation_version) = $old_filter_info;
             // if there is a register function on that old filter
             if (has_action($old_filter)) {
                 // then call those register functions
                 $args[0] = $old_filter;
                 $data = call_user_func_array('apply_filters', $args);
                 // pop the deprecation message
                 _deprecated_function(sprintf(__('The "%s" filter', 'opentickets-community-edition'), $old_filter), $deprecation_version, sprintf(__('The "%s" filter', 'opentickets-community-edition'), $current_filter));
             }
         }
     }
     return $data;
 }
 /**
  * Save schemes to option allow front-end query
  */
 function save_schemes_into_option()
 {
     global $_wp_admin_css_colors;
     if (count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker')) {
         update_option('wp_admin_color_schemes', $_wp_admin_css_colors);
     }
 }
Example #9
0
 public function __construct()
 {
     //load conf data into stack
     $this->_get_conf();
     if (is_admin()) {
         //  update notices
         $this->readme_URL = 'http://plugins.trac.wordpress.org/browser/fv-wordpress-flowplayer/trunk/readme.txt?format=txt';
         if (!has_action('in_plugin_update_message-fv-wordpress-flowplayer/flowplayer.php')) {
             add_action('in_plugin_update_message-fv-wordpress-flowplayer/flowplayer.php', array(&$this, 'plugin_update_message'));
         }
         //  pointer boxes
         parent::__construct();
     }
     // define needed constants
     if (!defined('FV_FP_RELATIVE_PATH')) {
         define('FV_FP_RELATIVE_PATH', flowplayer::get_plugin_url());
         $vid = 'http://' . $_SERVER['SERVER_NAME'];
         if (dirname($_SERVER['PHP_SELF']) != '/') {
             $vid .= dirname($_SERVER['PHP_SELF']);
         }
         define('VIDEO_DIR', '/videos/');
         define('VIDEO_PATH', $vid . VIDEO_DIR);
     }
     add_filter('fv_flowplayer_caption', array($this, 'get_duration_playlist'), 10, 3);
     add_filter('fv_flowplayer_inner_html', array($this, 'get_duration_video'), 10, 2);
     add_filter('fv_flowplayer_video_src', array($this, 'get_amazon_secure'), 10, 2);
     add_filter('fv_flowplayer_css_writeout', array($this, 'css_writeout_option'));
     add_action('wp_enqueue_scripts', array($this, 'css_enqueue'));
     add_action('admin_enqueue_scripts', array($this, 'css_enqueue'));
     add_filter('post_rewrite_rules', array($this, 'rewrite_embed'));
     add_filter('page_rewrite_rules', array($this, 'rewrite_embed'));
     add_filter('query_vars', array($this, 'rewrite_vars'));
     add_filter('init', array($this, 'rewrite_check'));
     add_action('template_redirect', array($this, 'template_embed'));
 }
Example #10
0
 function __invoke()
 {
     $args = func_get_args();
     $message_name = $this->get_message_name();
     $event_before = $message_name . '_before';
     if (has_action($event_before)) {
         do_action_ref_array($event_before, $args);
     }
     $event_pre = $message_name . '_args';
     if (has_filter($event_pre)) {
         $args = apply_filters_ref_array($event_pre, $args);
     }
     $result = null;
     $fn = $this->find_real_function($args);
     if (is_callable($fn)) {
         $result = call_user_func_array($fn, $args);
     }
     if (has_filter($message_name)) {
         $new_args = array_merge(array($result), $args);
         $result = apply_filters_ref_array($message_name, $new_args);
     }
     $event_after = $message_name . '_after';
     if (has_action($event_after)) {
         do_action_ref_array($event_after, array_merge($args, array($result)));
     }
     return $result;
 }
 /**
  * Bootstraps the class and hooks required actions & filters.
  *
  * @since 2.0
  */
 public static function init()
 {
     self::$paypal_settings = self::get_options();
     // wc-api handler for express checkout transactions
     if (!has_action('woocommerce_api_wcs_paypal')) {
         add_action('woocommerce_api_wcs_paypal', __CLASS__ . '::handle_wc_api');
     }
     // When necessary, set the PayPal args to be for a subscription instead of shopping cart
     add_action('woocommerce_update_options_payment_gateways_paypal', __CLASS__ . '::reload_options', 100);
     // When necessary, set the PayPal args to be for a subscription instead of shopping cart
     add_action('woocommerce_update_options_payment_gateways_paypal', __CLASS__ . '::are_reference_transactions_enabled', 100);
     // When necessary, set the PayPal args to be for a subscription instead of shopping cart
     add_filter('woocommerce_paypal_args', __CLASS__ . '::get_paypal_args', 10, 2);
     // Check a valid PayPal IPN request to see if it's a subscription *before* WCS_Gateway_Paypal::successful_request()
     add_action('valid-paypal-standard-ipn-request', __CLASS__ . '::process_ipn_request', 0);
     add_action('woocommerce_scheduled_subscription_payment_paypal', __CLASS__ . '::process_subscription_payment', 10, 2);
     // Don't copy over PayPal details to Resubscribe Orders
     add_filter('wcs_resubscribe_order_created', __CLASS__ . '::remove_resubscribe_order_meta', 10, 2);
     // Triggered by WCS_SV_API_Base::broadcast_request() whenever an API request is made
     add_action('wc_paypal_api_request_performed', __CLASS__ . '::log_api_requests', 10, 2);
     add_filter('woocommerce_subscriptions_admin_meta_boxes_script_parameters', __CLASS__ . '::maybe_add_change_payment_method_warning');
     WCS_PayPal_Supports::init();
     WCS_PayPal_Status_Manager::init();
     WCS_PayPal_Standard_Switcher::init();
     if (is_admin()) {
         WCS_PayPal_Admin::init();
         WCS_PayPal_Change_Payment_Method_Admin::init();
     }
 }
Example #12
0
 function __construct($theme)
 {
     $this->theme = $theme;
     // Don't bother doing this stuff if the current user lacks permissions
     if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) {
         return;
     }
     // Add only in Rich Editor mode
     if (get_user_option('rich_editing') == 'true') {
         add_filter('mce_external_plugins', array($this, 'oxy_add_mce_shortcode_plugin'));
         add_filter('mce_buttons', array(&$this, 'oxy_add_mce_shortcode_button'));
     }
     // enqueue scripts & styles
     add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
     // add tinyMCE shortcode plugin
     add_action('admin_init', array(&$this, 'oxy_add_mce_shortcode'));
     // add action for loading shortcode page
     add_action('wp_ajax_oxy_shortcodes', array(&$this, 'oxy_load_mce_shortcode_page'));
     // add action for loading shortcode page
     add_action('wp_ajax_oxy_shortcode_preview', array(&$this, 'oxy_load_mce_shortcode_preview'));
     // add action for loading menu data
     add_action('wp_ajax_oxy_shortcodes_menu', array(&$this, 'oxy_load_mce_shortcode_menu'));
     // remove wordpress 3.6 action that is undocumented and throws notices.
     if (has_action('admin_enqueue_scripts', 'wp_auth_check_load')) {
         remove_action('admin_enqueue_scripts', 'wp_auth_check_load');
     }
 }
/**
 * Runs a deprecated action with notice only if used.
 *
 * @since  2.7.0
 * @param  string $action
 * @param  array $args
 * @param  string $deprecated_in
 * @param  string $replacement
 */
function wc_do_deprecated_action($action, $args, $deprecated_in, $replacement)
{
    if (has_action($action)) {
        wc_deprecated_function('Action: ' . $action, $deprecated_in, $replacement);
        do_action_ref_array($action, $args);
    }
}
 /**
  * Display an assortment of notices to administrators to encourage them to get PayPal setup right.
  *
  * @since 2.0
  */
 public static function maybe_show_admin_notices()
 {
     self::maybe_disable_invalid_profile_notice();
     self::maybe_update_credentials_error_flag();
     if (!in_array(get_woocommerce_currency(), apply_filters('woocommerce_paypal_supported_currencies', array('AUD', 'BRL', 'CAD', 'MXN', 'NZD', 'HKD', 'SGD', 'USD', 'EUR', 'JPY', 'TRY', 'NOK', 'CZK', 'DKK', 'HUF', 'ILS', 'MYR', 'PHP', 'PLN', 'SEK', 'CHF', 'TWD', 'THB', 'GBP', 'RMB')))) {
         $valid_for_use = false;
     } else {
         $valid_for_use = true;
     }
     $payment_gateway_tab_url = admin_url('admin.php?page=wc-settings&tab=checkout&section=wc_gateway_paypal');
     $notices = array();
     if ($valid_for_use && 'yes' == WCS_PayPal::get_option('enabled') && !has_action('admin_notices', 'WC_Subscriptions_Admin::admin_installed_notice') && current_user_can('manage_options')) {
         if (!WCS_PayPal::are_credentials_set()) {
             $notices[] = array('type' => 'warning', 'text' => sprintf(esc_html__('PayPal is inactive for subscription transactions. Please %1$sset up the PayPal IPN%2$s and %3$senter your API credentials%4$s to enable PayPal for Subscriptions.', 'woocommerce-subscriptions'), '<a href="http://docs.woothemes.com/document/subscriptions/store-manager-guide/#section-4" target="_blank">', '</a>', '<a href="' . esc_url($payment_gateway_tab_url) . '">', '</a>'));
         } elseif ('woocommerce_page_wc-settings' === get_current_screen()->base && isset($_GET['tab']) && in_array($_GET['tab'], array('subscriptions', 'checkout')) && !WCS_PayPal::are_reference_transactions_enabled()) {
             $notices[] = array('type' => 'warning', 'text' => sprintf(esc_html__('%1$sPayPal Reference Transactions are not enabled on your account%2$s, some subscription management features are not enabled. Please contact PayPal and request they %3$senable PayPal Reference Transactions%4$s on your account. %5$sCheck PayPal Account%6$s  %7$sLearn more %8$s', 'woocommerce-subscriptions'), '<strong>', '</strong>', '<a href="http://docs.woothemes.com/document/subscriptions/store-manager-guide/#section-4" target="_blank">', '</a>', '</p><p><a class="button" href="' . esc_url(wp_nonce_url(add_query_arg('wcs_paypal', 'check_reference_transaction_support'), __CLASS__)) . '">', '</a>', '<a class="button button-primary" href="http://docs.woothemes.com/document/subscriptions/store-manager-guide/#section-4" target="_blank">', '&raquo;</a>'));
         }
         if (isset($_GET['wcs_paypal']) && 'rt_enabled' === $_GET['wcs_paypal']) {
             $notices[] = array('type' => 'confirmation', 'text' => sprintf(esc_html__('%1$sPayPal Reference Transactions are enabled on your account%2$s. All subscription management features are now enabled. Happy selling!', 'woocommerce-subscriptions'), '<strong>', '</strong>'));
         }
         if (false !== get_option('wcs_paypal_credentials_error')) {
             $notices[] = array('type' => 'error', 'text' => sprintf(esc_html__('There is a problem with PayPal. Your API credentials may be incorrect. Please update your %1$sAPI credentials%2$s. %3$sLearn more%4$s.', 'woocommerce-subscriptions'), '<a href="' . esc_url($payment_gateway_tab_url) . '">', '</a>', '<a href="https://support.woothemes.com/hc/en-us/articles/202882473#paypal-credentials" target="_blank">', '</a>'));
         }
         if ('yes' == get_option('wcs_paypal_invalid_profile_id')) {
             $notices[] = array('type' => 'error', 'text' => sprintf(esc_html__('There is a problem with PayPal. Your PayPal account is issuing out-of-date subscription IDs. %1$sLearn more%2$s. %3$sDismiss%4$s.', 'woocommerce-subscriptions'), '<a href="https://support.woothemes.com/hc/en-us/articles/202882473#old-paypal-account" target="_blank">', '</a>', '<a href="' . esc_url(add_query_arg('wcs_disable_paypal_invalid_profile_id_notice', 'true')) . '">', '</a>'));
         }
     }
     if (!empty($notices)) {
         include_once dirname(__FILE__) . '/../templates/admin-notices.php';
     }
 }
Example #15
0
 /**
  * Test if all the file hooks are working.
  *
  * @since 1.0
  */
 public function test_file_hooks()
 {
     $this->assertNotFalse(has_action('wp_enqueue_scripts', 'give_load_scripts'));
     $this->assertNotFalse(has_action('wp_enqueue_scripts', 'give_register_styles'));
     $this->assertNotFalse(has_action('admin_enqueue_scripts', 'give_load_admin_scripts'));
     $this->assertNotFalse(has_action('admin_head', 'give_admin_icon'));
 }
 protected static function format_module($module_slug)
 {
     $module_data = Jetpack::get_module($module_slug);
     $module = array();
     $module['id'] = $module_slug;
     $module['active'] = Jetpack::is_module_active($module_slug);
     $module['name'] = $module_data['name'];
     $module['short_description'] = $module_data['description'];
     $module['sort'] = $module_data['sort'];
     $module['introduced'] = $module_data['introduced'];
     $module['changed'] = $module_data['changed'];
     $module['free'] = $module_data['free'];
     $module['module_tags'] = $module_data['module_tags'];
     // Fetch the HTML formatted long description
     ob_start();
     if (Jetpack::is_active() && has_action('jetpack_module_more_info_connected_' . $module_slug)) {
         /** This action is documented in class.jetpack-modules-list-table.php */
         do_action('jetpack_module_more_info_connected_' . $module_slug);
     } else {
         /** This action is documented in class.jetpack-modules-list-table.php */
         do_action('jetpack_module_more_info_' . $module_slug);
     }
     $module['description'] = ob_get_clean();
     return $module;
 }
 public function test_sync_initalize_Jetpack_Sync_Action_on_init()
 {
     // prioroty should be set so that plugins can set their own filers initialize the whitelist_filter before.
     // Priority is set earlier now plugins_loaded but we plugins should still be able to set whitelist_filters by
     // using the plugins_loaded action.
     $this->assertEquals(90, has_action('plugins_loaded', array('Jetpack_Sync_Actions', 'init')));
 }
/**
 * Checks whether the post meta div needs to be displayed or not
 *
 * @uses $rtp_post_comments Post Comments DB array
 * @uses $post Post Data
 * @param string $position Specify the position of the post meta (u/l)
 *
 * @since rtPanel 2.1
 */
function rtp_has_postmeta($position = 'u')
{
    global $post, $rtp_post_comments;
    $can_edit = get_edit_post_link() ? 1 : 0;
    $flag = 0;
    // Show Author?
    if ($rtp_post_comments['post_author_' . $position]) {
        $flag++;
    } elseif ($rtp_post_comments['post_date_' . $position]) {
        $flag++;
    } elseif (get_the_category_list() && $rtp_post_comments['post_category_' . $position]) {
        $flag++;
    } elseif (get_the_tag_list() && $rtp_post_comments['post_tags_' . $position]) {
        $flag++;
    } else {
        if ($can_edit && $position == 'u') {
            $flag++;
        } elseif ((has_action('rtp_hook_begin_post_meta_top') || has_action('rtp_hook_end_post_meta_top') && $can_edit) && $position == 'u') {
            $flag++;
        } elseif ((has_action('rtp_hook_begin_post_meta_bottom') || has_action('rtp_hook_end_post_meta_bottom')) && $position == 'l') {
            $flag++;
        } else {
            // Show Custom Taxonomies?
            $args = array('_builtin' => false);
            $taxonomies = get_taxonomies($args, 'names');
            foreach ($taxonomies as $taxonomy) {
                if (get_the_terms($post->ID, $taxonomy) && isset($rtp_post_comments['post_' . $taxonomy . '_' . $position]) && $rtp_post_comments['post_' . $taxonomy . '_' . $position]) {
                    $flag++;
                }
            }
        }
    }
    return $flag;
}
Example #19
0
 function __construct($args = array())
 {
     //Load defaults
     $defaults = array('pagehooks' => array(), 'pass1' => 'pass1', 'pass2' => 'pass2', 'button_id' => 'pb_generate_password', 'password_length' => 12, 'special_chars' => true, 'extra_special_chars' => false);
     $args = wp_parse_args($args, $defaults);
     extract($args);
     $this->pass1 = $pass1;
     $this->pass2 = $pass2;
     $this->button_id = $button_id;
     $this->password_length = $password_length;
     $this->special_chars = $special_chars;
     $this->extra_special_chars = $extra_special_chars;
     $this->plugin_url = rtrim(plugin_dir_url(__FILE__), '/');
     //Add actions based on page detection
     if (is_string($pagehooks)) {
         add_action('admin_print_scripts-' . $pagehooks, array(&$this, 'load_scripts'));
         add_action('admin_print_styles-' . $pagehooks, array(&$this, 'load_scripts'));
     } elseif (is_array($pagehooks)) {
         foreach ($pagehooks as $hook) {
             add_action('admin_print_scripts-' . $hook, array(&$this, 'load_scripts'));
             add_action('admin_print_styles-' . $hook, array(&$this, 'load_scripts'));
         }
         //end foreach
     }
     //end $pagehooks
     if (!has_action('wp_ajax_pb_generate_password', array(&$this, 'ajax_generate_password'))) {
         add_action('wp_ajax_pb_generate_password', array(&$this, 'ajax_generate_password'));
     }
 }
 /**
  * @covers Two_Factor_Core::add_hooks
  */
 public function test_add_hooks()
 {
     Two_Factor_Core::add_hooks();
     $this->assertGreaterThan(0, has_action('init', array('Two_Factor_Core', 'get_providers')));
     $this->assertGreaterThan(0, has_action('login_form_validate_2fa', array('Two_Factor_Core', 'login_form_validate_2fa')));
     $this->assertGreaterThan(0, has_action('login_form_backup_2fa', array('Two_Factor_Core', 'backup_2fa')));
 }
 /**
  * Enqueue styles
  */
 public function admin_styles()
 {
     global $wp_scripts;
     // Sitewide menu CSS
     wp_enqueue_style('woocommerce_admin_menu_styles', WC()->plugin_url() . '/assets/css/menu.css', array(), WC_VERSION);
     $screen = get_current_screen();
     if (in_array($screen->id, wc_get_screen_ids())) {
         $jquery_version = isset($wp_scripts->registered['jquery-ui-core']->ver) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
         // Admin styles for WC pages only
         wp_enqueue_style('woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), WC_VERSION);
         wp_enqueue_style('jquery-ui-style', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version);
         wp_enqueue_style('wp-color-picker');
     }
     if (in_array($screen->id, array('dashboard'))) {
         wp_enqueue_style('woocommerce_admin_dashboard_styles', WC()->plugin_url() . '/assets/css/dashboard.css', array(), WC_VERSION);
     }
     if (in_array($screen->id, array('woocommerce_page_wc-reports', 'toplevel_page_wc-reports'))) {
         wp_enqueue_style('woocommerce_admin_print_reports_styles', WC()->plugin_url() . '/assets/css/reports-print.css', array(), WC_VERSION, 'print');
     }
     /**
      * @deprecated 2.3
      */
     if (has_action('woocommerce_admin_css')) {
         do_action('woocommerce_admin_css');
         _deprecated_function('The woocommerce_admin_css action', '2.3', 'admin_enqueue_scripts');
     }
 }
    function ss_updater_settings_page()
    {
        echo '<div class="wrap">';
        echo '<h2>' . __('Shoestrap Licensing') . '</h2><hr><br>';
        // If there are no products that need licensing, display a message
        if (!has_action('shoestrap_updater_form_content')) {
            _e('No products require a license key.');
        }
        ?>
			<style>tr td.plugin-title { border-left: 3px solid #faebcc; } tr.valid td.plugin-title { border-left: 3px solid #3c763d; } tr.invalid. td.plugin-title { border-left: 3px solid #a94442; } input.button-activate { border: none; background: none; color: #31708f; padding: 0; } input.button-deactivate { border: none; background: none; color: #a94442; padding: 0; } tr td { border-bottom: 1px solid rgb(229, 229, 229); } tr.valid { background: #dff0d8; } tr.invalid { background: #f2dede; }</style>

			<table class="wp-list-table widefat plugins">
				<thead>
					<tr>
						<th scope="col" id="name" class="manage-column column-name" style="">Product name</th>
						<th scope="col" id="license" class="manage-column column-license" style="">License</th>
						<th scope="col" id="save" class="manage-column column-save" style=""></th>
					</tr>
				</thead>
				<tbody id="the-list">
					<?php 
        // Include our custom licensing fields for all our plugins & themes.
        do_action('shoestrap_updater_form_content');
        ?>
				</tbody>
			</table>

			<?php 
        // Display the addons section.
        do_action('shoestrap_installer_form_content');
        echo '</div>';
    }
 private function _doActions_submit($_aInput, $_aOptions, $_sPageSlug, $_sTabSlug, $_sSubmitSectionID, $_sPressedFieldID, $_sPressedInputID)
 {
     if (has_action("submit_{$this->oProp->sClassName}_{$_sPressedInputID}")) {
         trigger_error('Admin Page Framework: ' . ' : ' . sprintf(__('The hook <code>%1$s</code>is deprecated. Use <code>%2$s</code> instead.', $this->oProp->sTextDomain), "submit_{instantiated class name}_{pressed input id}", "submit_{instantiated class name}_{pressed field id}"), E_USER_WARNING);
     }
     $this->oUtil->addAndDoActions($this, array("submit_{$this->oProp->sClassName}_{$_sPressedInputID}", $_sSubmitSectionID ? "submit_{$this->oProp->sClassName}_{$_sSubmitSectionID}_{$_sPressedFieldID}" : "submit_{$this->oProp->sClassName}_{$_sPressedFieldID}", $_sSubmitSectionID ? "submit_{$this->oProp->sClassName}_{$_sSubmitSectionID}" : null, isset($_POST['tab_slug']) ? "submit_{$this->oProp->sClassName}_{$_sPageSlug}_{$_sTabSlug}" : null, "submit_{$this->oProp->sClassName}_{$_sPageSlug}", "submit_{$this->oProp->sClassName}"), $_aInput, $_aOptions, $this);
 }
Example #24
0
 /**
  * Handle Papi ajax.
  */
 public function handle_papi_ajax()
 {
     global $wp_query;
     if (!is_object($wp_query)) {
         return;
     }
     if (defined('DOING_AJAX') && DOING_AJAX) {
         return;
     }
     if (!papi_is_empty(papi_get_qs('action'))) {
         $wp_query->set('papi_ajax_action', papi_get_qs('action'));
     }
     $ajax_action = $wp_query->get('papi_ajax_action');
     if (is_user_logged_in() && has_action($this->action_prefix . $ajax_action) !== false) {
         if (!defined('DOING_AJAX')) {
             define('DOING_AJAX', true);
         }
         if (!defined('DOING_PAPI_AJAX')) {
             define('DOING_PAPI_AJAX', true);
         }
         status_header(200);
         do_action($this->action_prefix . $ajax_action);
         wp_die();
     }
 }
Example #25
0
/**
 * Override default map with advanced map
 * @since	2.0.0
**/
function epl_override_default_map()
{
    global $epl_settings;
    if (is_epl_post()) {
        if (has_action('epl_property_map')) {
            // remove default map of epl core
            remove_action('epl_property_map', 'epl_property_map_default_callback');
            $enabled_default_map = isset($epl_settings['epl_am_map_enable']) ? $epl_settings['epl_am_map_enable'] : 1;
            $map_position = isset($epl_settings['epl_am_single_tab_position']) ? $epl_settings['epl_am_single_tab_position'] : 1;
            // show default tabbed map ?
            if ($enabled_default_map) {
                // map tabs position
                if ($map_position == '1') {
                    add_action('epl_property_map', 'epl_am_tabbed_map_top', 10, 5);
                } else {
                    add_action('epl_property_map', 'epl_am_tabbed_map_bottom', 1, 5);
                }
            } else {
                // make tab positioning work with custom action too
                $map_position = $map_position == 1 ? 'top' : 'bottom';
                // custom actions to render tabbed map
                add_action('epl_property_map_show', 'epl_am_tabbed_map_' . $map_position, 1, 5);
            }
        }
    }
}
function wcml_check_wpml_functions()
{
    if (defined('ICL_SITEPRESS_VERSION') && version_compare(preg_replace('#-(.+)$#', '', ICL_SITEPRESS_VERSION), '3.1.5', '<')) {
        function wpml_is_ajax()
        {
            if (defined('DOING_AJAX')) {
                return true;
            }
            return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' ? true : false;
        }
    }
    if (!has_filter('translate_object_id')) {
        add_filter('translate_object_id', 'icl_object_id', 10, 4);
    }
    if (!has_action('wpml_register_single_string')) {
        if (function_exists('wpml_register_single_string_action')) {
            add_action('wpml_register_single_string', 'wpml_register_single_string_action', 10, 4);
        } elseif (function_exists('icl_register_string')) {
            add_action('wpml_register_single_string', 'icl_register_string', 10, 4);
        }
    }
    if (!has_filter('wpml_translate_single_string')) {
        add_filter('wpml_translate_single_string', 'wcml_translate_single_string_filter', 10, 6);
    }
}
Example #27
0
 public function __construct()
 {
     $this->generateOptions();
     add_action('admin_menu', array($this, 'wps_sub_menus'));
     add_action('admin_init', array($this, 'initialize_defaults'), 19);
     add_action('admin_init', array($this, 'customize_admin_menu'), 29);
     add_action('admin_head', array($this, 'maincssStyles'), 999);
     add_action('login_head', array($this, 'logincssStyles'));
     add_filter('custom_menu_order', array($this, 'wpsCustommenusort'));
     add_filter('menu_order', array($this, 'wpsCustommenusort'));
     add_filter('admin_title', array($this, 'custom_admin_title'), 999, 2);
     add_action('init', array($this, 'initFunctionss'));
     add_action('admin_bar_menu', array($this, 'add_wpshapere_menus'), 1);
     add_action('admin_bar_menu', array($this, 'add_wpshapere_nav_menus'), 99);
     add_action('wp_dashboard_setup', array($this, 'widget_functions'));
     if (!has_action('login_enqueue_scripts', array($this, 'wpshapereloginAssets'))) {
         add_action('login_enqueue_scripts', array($this, 'wpshapereloginAssets'), 10);
     }
     add_action('admin_enqueue_scripts', array($this, 'wpshapereAssets'), 99999);
     add_action('wp_before_admin_bar_render', array($this, 'wps_remove_bar_links'), 0);
     add_filter('login_headerurl', array($this, 'wpshapere_login_url'));
     add_filter('login_headertitle', array($this, 'wpshapere_login_title'));
     add_action('admin_head', array($this, 'generalFns'), 99);
     add_action('admin_bar_menu', array($this, 'update_avatar_size'), 999);
     add_action('plugins_loaded', array($this, 'download_settings'));
     add_action('login_footer', array($this, 'login_footer_content'), 1);
     add_action('wp_head', array($this, 'frontendActions'), 99999);
     add_action('tf_wat_options_saved_wat', array($this, 'importWattheme'));
 }
Example #28
0
function alm_get_current_repeater($repeater, $type)
{
    $template = $repeater;
    $include = '';
    // If is Custom Repeaters (Custom Repeaters v1)
    if ($type == 'repeater' && has_action('alm_repeater_installed')) {
        $include = ALM_REPEATER_PATH . 'repeaters/' . $template . '.php';
        if (!file_exists($include)) {
            //confirm file exists
            alm_get_default_repeater();
        }
    } elseif ($type == 'template_' && has_action('alm_unlimited_installed')) {
        global $wpdb;
        $blog_id = $wpdb->blogid;
        if ($blog_id > 1) {
            $include = ALM_UNLIMITED_PATH . 'repeaters/' . $blog_id . '/' . $template . '.php';
        } else {
            $include = ALM_UNLIMITED_PATH . 'repeaters/' . $template . '.php';
        }
        if (!file_exists($include)) {
            //confirm file exists
            $include = alm_get_default_repeater();
        }
    } else {
        $include = alm_get_default_repeater();
    }
    return $include;
}
Example #29
0
 /**
  * API request - Trigger any API requests.
  *
  * @since   2.0
  * @version 2.4
  */
 public function handle_api_requests()
 {
     global $wp;
     if (!empty($_GET['wc-api'])) {
         $wp->query_vars['wc-api'] = $_GET['wc-api'];
     }
     // wc-api endpoint requests.
     if (!empty($wp->query_vars['wc-api'])) {
         // Buffer, we won't want any output here.
         ob_start();
         // No cache headers.
         nocache_headers();
         // Clean the API request.
         $api_request = strtolower(wc_clean($wp->query_vars['wc-api']));
         // Trigger generic action before request hook.
         do_action('woocommerce_api_request', $api_request);
         // Is there actually something hooked into this API request? If not trigger 400 - Bad request.
         status_header(has_action('woocommerce_api_' . $api_request) ? 200 : 400);
         // Trigger an action which plugins can hook into to fulfill the request.
         do_action('woocommerce_api_' . $api_request);
         // Done, clear buffer and exit.
         ob_end_clean();
         die('-1');
     }
 }
Example #30
0
 function display($args = array())
 {
     /* Use the generic_content action if it's set.  See http://core.trac.wordpress.org/ticket/20509 */
     if ($this->get_setting('mode', 'default') == 'default' && has_action('generic_content') && !did_action('generic_content')) {
         return do_action('generic_content');
     }
     /* Since it's impossible to get the $wp_query in its correct form when loading the content from admin-ajax.php, we will display this notice. */
     if (headway_get('ve-live-content-query', $this->block, false) && $this->get_setting('mode', 'default') == 'default') {
         echo '<div class="alert alert-yellow" style="margin: 5px;"><p><strong>Please note:</strong> What\'s being displayed here in the Content Block may not be correct.  When viewing the site outside of the Visual Editor, you will see the correct content.</p></div>';
     }
     /* If LoopBuddy is activated, we'll strictly rely on it for the query setup and how the content is displayed. */
     if (class_exists('pluginbuddy_loopbuddy')) {
         global $pluginbuddy_loopbuddy;
         $loopbuddy_query = $this->get_setting('loopbuddy-query', -1);
         $loopbuddy_layout = $this->get_setting('loopbuddy-layout', -1);
         if (isset($pluginbuddy_loopbuddy) && $loopbuddy_query !== -1) {
             echo $pluginbuddy_loopbuddy->render_loop($loopbuddy_query, $loopbuddy_layout);
             $this->remove_hooks();
             return;
         }
     }
     /* Display the 404 text if it's a 404 (has to be default behavior) */
     if (is_404() && $this->get_setting('mode', 'default') == 'default' && !headway_get('ve-live-content-query', $this->block, false)) {
         $this->remove_hooks();
         return $this->display_404();
     }
     /* Display loop like normal if nothing else fires first */
     $this->loop($args);
     $this->remove_hooks();
     wp_reset_query();
 }