/** * Render the admin bar to the page based on the $wp_admin_bar->menu member var. * This is called very late on the footer actions so that it will render after anything else being * added to the footer. * * It includes the action "admin_bar_menu" which should be used to hook in and * add new menus to the admin bar. That way you can be sure that you are adding at most optimal point, * right before the admin bar is rendered. This also gives you access to the $post global, among others. * * @since 3.1.0 */ function wp_admin_bar_render() { global $wp_admin_bar; if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) { return false; } /** * Load all necessary admin bar items. * * This is the hook used to add, remove, or manipulate admin bar items. * * @since 3.1.0 * * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference */ do_action_ref_array('admin_bar_menu', array(&$wp_admin_bar)); /** * Fires before the admin bar is rendered. * * @since 3.1.0 */ do_action('wp_before_admin_bar_render'); $wp_admin_bar->render(); /** * Fires after the admin bar is rendered. * * @since 3.1.0 */ do_action('wp_after_admin_bar_render'); }
/** * s2Member's PayPal Auto-Return/PDT handler (inner processing routine). * * @package s2Member\PayPal * @since 110720 * * @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}. * @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply. */ public static function cp($vars = array()) { extract($vars); foreach (array_keys(get_defined_vars()) as $__v) { $__refs[$__v] =& ${$__v}; } do_action("ws_plugin__s2member_during_paypal_return_before_no_return_data", get_defined_vars()); unset($__refs, $__v); $paypal["s2member_log"][] = "No Return-Data. Customer MUST wait for Email Confirmation."; $paypal["s2member_log"][] = "Note. This can sometimes happen when/if you are offering an Initial/Trial Period. There are times when a Payment Gateway will NOT supply s2Member with any data immediately after checkout. When/if this happens, s2Member must process the transaction via IPN only (i.e. behind-the-scene), and the Customer must wait for Email Confirmation in these cases."; $paypal["s2member_log"][] = var_export($_REQUEST, true); foreach (array_keys(get_defined_vars()) as $__v) { $__refs[$__v] =& ${$__v}; } do_action("ws_plugin__s2member_during_paypal_return_during_no_return_data", get_defined_vars()); unset($__refs, $__v); if ($custom_success_redirection) { $paypal["s2member_log"][] = "Redirecting Customer to a custom URL: " . $custom_success_redirection . "."; wp_redirect($custom_success_redirection); } else { $paypal["s2member_log"][] = "Redirecting Customer to the Home Page (after asking Customer to check their email)."; echo c_ws_plugin__s2member_return_templates::return_template($paypal["subscr_gateway"], _x('<strong>Thank you! (you MUST check your email before proceeding).</strong><br /><br />* Note: It can take <em>(up to 15 minutes)</em> for Email Confirmation with important details. If you don\'t receive email confirmation in the next 15 minutes, please contact Support.', "s2member-front", "s2member") . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] || c_ws_plugin__s2member_utils_conds::pro_is_installed() && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_" . $paypal["subscr_gateway"] . "_sandbox"]) ? '<br /><br />' . _x('<strong>** Sandbox Mode **</strong> You may NOT receive this Email in Sandbox Mode. Sandbox addresses are usually bogus (for testing).', "s2member-front", "s2member") : ''), _x("Back To Home Page", "s2member-front", "s2member"), home_url("/")); } foreach (array_keys(get_defined_vars()) as $__v) { $__refs[$__v] =& ${$__v}; } do_action("ws_plugin__s2member_during_paypal_return_after_no_return_data", get_defined_vars()); unset($__refs, $__v); return apply_filters("c_ws_plugin__s2member_paypal_return_in_no_tx_data", $paypal, get_defined_vars()); }
function polldaddy_embed_to_shortcode($content) { if (false === strpos($content, 'polldaddy.com/p/')) { return $content; } $regexes = array(); $regexes[] = '#<script[^>]+?src="https?://(secure|static)\\.polldaddy\\.com/p/([0-9]+)\\.js"[^>]*+>\\s*?</script>\\r?\\n?(<noscript>.*?</noscript>)?#i'; $regexes[] = '#<script(?:[^&]|&(?!gt;))+?src="https?://(secure|static)\\.polldaddy\\.com/p/([0-9]+)\\.js"(?:[^&]|&(?!gt;))*+>\\s*?</script>\\r?\\n?(<noscript>.*?</noscript>)?#i'; foreach ($regexes as $regex) { if (!preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) { continue; } foreach ($matches as $match) { if (!isset($match[2])) { continue; } $id = (int) $match[2]; if ($id > 0) { $content = str_replace($match[0], " [polldaddy poll={$id}]", $content); /** This action is documented in modules/shortcodes/youtube.php */ do_action('jetpack_embed_to_shortcode', 'polldaddy', $id); } } } return $content; }
function jigoshop_product_tag($attributes) { global $paged; $jigoshop_options = Jigoshop_Base::get_options(); $attributes = shortcode_atts(array('tag' => '', 'per_page' => $jigoshop_options->get('jigoshop_catalog_per_page'), 'columns' => $jigoshop_options->get('jigoshop_catalog_columns'), 'orderby' => $jigoshop_options->get('jigoshop_catalog_sort_orderby'), 'order' => $jigoshop_options->get('jigoshop_catalog_sort_direction'), 'pagination' => false, 'tax_operator' => 'IN'), $attributes); if (isset($_REQUEST['tag'])) { $attributes['tag'] = $_REQUEST['tag']; } /** Operator validation. */ if (!in_array($attributes['tax_operator'], array('IN', 'NOT IN', 'AND'))) { $tax_operator = 'IN'; } /** Multiple category values. */ if (!empty($slug)) { $slug = explode(',', esc_attr($slug)); $slug = array_map('trim', $slug); } $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $attributes['per_page'], 'orderby' => $attributes['orderby'], 'order' => $attributes['order'], 'paged' => $paged, 'meta_query' => array(array('key' => 'visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'tax_query' => array(array('taxonomy' => 'product_tag', 'field' => 'slug', 'terms' => $attributes['tag'], 'operator' => $attributes['tax_operator']))); query_posts($args); ob_start(); jigoshop_get_template_part('loop', 'shop'); if ($attributes['pagination']) { do_action('jigoshop_pagination'); } wp_reset_query(); return ob_get_clean(); }
function ninja_forms_import_form($data) { global $wpdb; $form = unserialize($data); // change the update date to today $form['date_updated'] = date('Y-m-d H:i:s'); // get the form fields $form_fields = $form['field']; unset($form['field']); $form = apply_filters('ninja_forms_before_import_form', $form); $form['data'] = serialize($form['data']); $wpdb->insert(NINJA_FORMS_TABLE_NAME, $form); $form_id = $wpdb->insert_id; $form['id'] = $form_id; if (is_array($form_fields)) { for ($x = 0; $x < count($form_fields); $x++) { $form_fields[$x]['form_id'] = $form_id; $form_fields[$x]['data'] = serialize($form_fields[$x]['data']); $old_field_id = $form_fields[$x]['id']; $form_fields[$x]['id'] = NULL; $wpdb->insert(NINJA_FORMS_FIELDS_TABLE_NAME, $form_fields[$x]); $form_fields[$x]['id'] = $wpdb->insert_id; $form_fields[$x]['old_id'] = $old_field_id; $form_fields[$x]['data'] = unserialize($form_fields[$x]['data']); } } $form['data'] = unserialize($form['data']); $form['field'] = $form_fields; do_action('ninja_forms_after_import_form', $form); return $form['id']; }
function aiowps_daily_cron_event_handler() { //Do stuff that needs checking daily global $aio_wp_security; $aio_wp_security->debug_logger->log_debug_cron("Cronjob_Handler - Daily cron handler got fired."); do_action('aiowps_perform_db_cleanup_tasks'); }
/** * Loading classes */ public function after_setup_theme() { do_action(SCF_Config::PREFIX . 'load'); require_once plugin_dir_path(__FILE__) . 'classes/models/class.meta.php'; require_once plugin_dir_path(__FILE__) . 'classes/models/class.setting.php'; require_once plugin_dir_path(__FILE__) . 'classes/models/class.group.php'; require_once plugin_dir_path(__FILE__) . 'classes/models/class.abstract-field-base.php'; require_once plugin_dir_path(__FILE__) . 'classes/models/class.revisions.php'; require_once plugin_dir_path(__FILE__) . 'classes/models/class.ajax.php'; require_once plugin_dir_path(__FILE__) . 'classes/class.scf.php'; new Smart_Custom_Fields_Revisions(); foreach (glob(plugin_dir_path(__FILE__) . 'classes/fields/*.php') as $form_item) { include_once $form_item; $basename = basename($form_item, '.php'); $classname = preg_replace('/^class\\.field\\-(.+)$/', 'Smart_Custom_Fields_Field_$1', $basename); if (class_exists($classname)) { new $classname(); } } do_action(SCF_Config::PREFIX . 'fields-loaded'); add_action('init', array($this, 'register_post_type')); add_action('init', array($this, 'ajax_request')); add_action('admin_menu', array($this, 'admin_menu')); add_action('current_screen', array($this, 'current_screen')); }
function grid_archive_theme($post) { ?> <div class="archive-listing classic-grid"> <a href="<?php the_permalink(); ?> "> <div style="background-image:url('<?php if (wp_get_attachment_url(get_post_thumbnail_id($post->ID))) { $url = wp_get_attachment_url(get_post_thumbnail_id($post->ID)); } else { $url = default_product_thumbnail_url(); } echo $url; ?> ');" class="classic-grid-element"></div> <div class="product-name"><?php the_title(); ?> </div> <?php do_action('archive_price', $post); ?> </a> </div> <?php }
public function plugins_loaded_action() { $this->check_required_plugins(); if (!$this->missing_one) { do_action('wpml_gfml_has_requirements'); } }
function comber_login_guest() { if (isset($_POST['comber_user_login']) && wp_verify_nonce($_POST['comber_login_nonce'], 'comber-login-nonce')) { // this returns the user ID and other info from the user name $user = get_userdatabylogin($_POST['comber_user_login']); if (!$user) { // if the user name doesn't exist comber_errors()->add('empty_username', __('Invalid username')); } if (!isset($_POST['comber_user_pass']) || $_POST['comber_user_pass'] == '') { // if no password was entered comber_errors()->add('empty_password', __('Please enter a password')); } // check the user's login with their password if (!wp_check_password($_POST['comber_user_pass'], $user->user_pass, $user->ID)) { // if the password is incorrect for the specified user comber_errors()->add('empty_password', __('Incorrect password')); } // retrieve all error messages $errors = comber_errors()->get_error_messages(); // only log the user in if there are no errors if (empty($errors)) { wp_setcookie($_POST['comber_user_login'], $_POST['comber_user_pass'], true); wp_set_current_user($user->ID, $_POST['comber_user_login']); do_action('wp_login', $_POST['comber_user_login']); wp_redirect(home_url($_POST['current_page'])); exit; } else { wp_redirect(home_url($_POST['current_page'] . '/?login=true&fail=true')); exit; } } }
function init() { if (get_option('woocommerce_calc_shipping') != 'no') { $this->enabled = true; } do_action('woocommerce_shipping_init'); $load_methods = apply_filters('woocommerce_shipping_methods', array()); // Get order option $ordering = (array) get_option('woocommerce_shipping_method_order'); $order_end = 999; // Load gateways in order foreach ($load_methods as $method) { $load_method = new $method(); if (isset($ordering[$load_method->id]) && is_numeric($ordering[$load_method->id])) { // Add in position $this->shipping_methods[$ordering[$load_method->id]] = $load_method; } else { // Add to end of the array $this->shipping_methods[$order_end] = $load_method; $order_end++; } } ksort($this->shipping_methods); add_action('woocommerce_update_options_shipping', array(&$this, 'process_admin_options')); }
/** * 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); } } }
function wsl_component_loginwidget_setup() { // HOOKABLE: do_action("wsl_component_loginwidget_setup_start"); $sections = array('basic_settings' => 'wsl_component_loginwidget_setup_basic_settings', 'advanced_settings' => 'wsl_component_loginwidget_setup_advanced_settings', 'custom_css' => 'wsl_component_loginwidget_setup_custom_css'); $sections = apply_filters('wsl_component_loginwidget_setup_alter_sections', $sections); foreach ($sections as $section => $action) { add_action('wsl_component_loginwidget_setup_sections', $action); } ?> <div> <?php // HOOKABLE: do_action('wsl_component_loginwidget_setup_sections'); ?> <br /> <div style="margin-left:5px;margin-top:-20px;"> <input type="submit" class="button-primary" value="<?php _wsl_e("Save Settings", 'wordpress-social-login'); ?> " /> </div> </div> <?php }
/** * Get Meta Data * * Get meta data using custom syntax with brackets. * * @param string $name * @param string $fallBack * @param bool $groups * @param null $id * * @return mixed|null|string */ static function meta($name = '', $fallBack = '', $groups = true, $id = null) { if (!acpt_validate::bracket($name)) { die("ACPT Error: You need to use brackets [{$name}]"); } /* * Action start_acpt_meta * * Do anything you want with input data before it is gotten. */ do_action('start_acpt_meta', $name, $fallBack, $groups, $id); global $post; empty($id) ? $id = $post->ID : true; if ($groups === true) { $data = self::get_groups($name, $id); } else { $data = self::get_single($name, $id); } /* * Action end_acpt_meta * * Do anything you like with resolved data before it is returned. */ do_action('end_acpt_meta', $data); empty($data) ? $data = $fallBack : true; return $data; }
public function settings_screen() { global $NF_Pushover; $tabs = $this->get_settings_tabs(); $current_tab = $this->get_current_tab(); ?> <div id="<?php echo $NF_Pushover->token; ?> " class="wrap"> <?php screen_icon($this->args['screen_icon']); ?> <h2 class="nav-tab-wrapper"> <?php echo $this->get_settings_tabs_html($tabs, $current_tab); do_action($NF_Pushover->token . '_after_settings_tabs'); ?> </h2> <form action="options.php" method="post"> <?php if (is_object($NF_Pushover->settings_objs[$current_tab])) { $NF_Pushover->settings_objs[$current_tab]->settings_screen(); } else { _e('Invalid Settings Class', 'nf-pushover'); } ?> </form> </div><!--/.wrap--> <?php }
function dln_form_profile_fields($profile_fields) { do_action('submit_profile_form_profile_fields_start'); foreach ($profile_fields as $key => $field) { ?> <div class="form-group fieldset-<?php esc_attr_e($key); ?> "> <?php if ($field['label']) { ?> <label class="col-sm-3 control-label" for="<?php esc_attr_e($key); ?> "><?php echo $field['label'] . ($field['required'] ? '' : ' <small>' . __('(optional)', 'dln-skill') . '</small>'); ?> </label> <?php } ?> <div class="col-sm-9"> <?php dln_form_get_template('form-fields/' . $field['type'] . '-field.php', array('key' => $key, 'field' => $field)); ?> </div> </div> <?php } do_action('submit_profile_form_profile_fields_end'); }
/** * Loads slideshow scripts * * @since 2.0 */ public static function enqueue_scripts() { /** Load scripts */ wp_enqueue_script('jquery'); wp_enqueue_script('esl-slideshow'); do_action('easingsliderlite_enqueue_slideshow_scripts'); }
/** * Defines [show_categories] shortcode * * @global type $cat_shortcode_query * @param type $atts * @return string */ function product_cat_shortcode($atts) { global $cat_shortcode_query, $product_sort, $archive_template; $cat_shortcode_query = array(); $cat_shortcode_query['current'] = 0; $args = shortcode_atts(array('exclude' => array(), 'include' => array(), 'archive_template' => get_option('archive_template', 'default'), 'parent' => '', 'sort' => 0, 'shortcode_query' => 'yes'), $atts); $div = '<div class="product-subcategories ' . $args['archive_template'] . ' ' . product_list_class('category-list') . '">'; $cats = get_terms('al_product-cat', $args); $cat_shortcode_query['count'] = count($cats); $cat_shortcode_query['enable'] = $args['shortcode_query']; $product_sort = intval($args['sort']); $inside = ''; if ($args['parent'] == '' && empty($args['include'])) { $old_args = $args; $args['parent'] = 0; $cats = get_terms('al_product-cat', $args); foreach ($cats as $cat) { $inside .= get_product_category_template($args['archive_template'], $cat); $cat_shortcode_query['current']++; $inside .= get_sub_product_subcategories($args, $cat); } } else { foreach ($cats as $cat) { $inside .= get_product_category_template($args['archive_template'], $cat); $cat_shortcode_query['current']++; } } if (!empty($inside)) { do_action('before_category_list', $archive_template); $inside = $div . $inside; $inside .= '</div>'; } reset_row_class(); return $inside; }
/** * Help Text for the free version. * * @return void */ function wp_email_capture_free_help() { ?> <div class="wrap"> <div style="width:70%;float:left;clear:both;" class="postbox-container"> <div class="metabox-holder"> <div class="meta-box-sortables"> <h2><?php echo __('WP Email Capture - Help', 'wp-email-capture'); ?> </h2> <?php /** * Action to control the display of the help boxes on the help page. * * Hook into this to add/remove help boxes should there be a change between free & premium. */ do_action('wp_email_capture_help_boxes'); ?> </div> </div> </div> <?php wp_email_capture_admin_sidebar("getwpemailcapturepremiumdescription,affiliates,news,supportus"); ?> </div> <?php }
/** * @ticket 35115 */ public function testPublicQueryVarsAreAsExpected() { global $wp; // Re-initialise any dynamically-added public query vars: do_action('init'); $this->assertEquals(array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type', 'embed', 'post_format', 'rest_route'), $wp->public_query_vars, 'Care should be taken when introducing new public query vars. See https://core.trac.wordpress.org/ticket/35115'); }
/** * The default template for displaying single post content * * @package Customizr * @since Customizr 3.0 */ function tc_post_content() { //check conditional tags : we want to show single post or single custom post types global $post; $tc_show_single_post_content = isset($post) && 'page' != $post->post_type && 'attachment' != $post->post_type && is_singular() && !tc__f('__is_home_empty'); if (!apply_filters('tc_show_single_post_content', $tc_show_single_post_content)) { return; } //display an icon for div if there is no title $icon_class = in_array(get_post_format(), array('quote', 'aside', 'status', 'link')) ? apply_filters('tc_post_format_icon', 'format-icon') : ''; ob_start(); do_action('__before_content'); ?> <section class="entry-content <?php echo $icon_class; ?> "> <?php the_content(__('Continue reading <span class="meta-nav">→</span>', 'customizr')); ?> <?php wp_link_pages(array('before' => '<div class="pagination pagination-centered">' . __('Pages:', 'customizr'), 'after' => '</div>')); ?> </section><!-- .entry-content --> <?php do_action('__after_content'); $html = ob_get_contents(); if ($html) { ob_end_clean(); } echo apply_filters('tc_post_content', $html); }
/** * Output the shortcode. * * @param array $atts */ public static function output($atts) { // Check cart class is loaded or abort if (is_null(WC()->cart)) { return; } extract(shortcode_atts(array(), $atts)); global $post; if (!empty($_REQUEST['orderid']) && isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'woocommerce-order_tracking')) { $order_id = empty($_REQUEST['orderid']) ? 0 : esc_attr($_REQUEST['orderid']); $order_email = empty($_REQUEST['order_email']) ? '' : esc_attr($_REQUEST['order_email']); if (!$order_id) { echo '<p class="woocommerce-error">' . __('Please enter a valid order ID', 'woocommerce') . '</p>'; } elseif (!$order_email) { echo '<p class="woocommerce-error">' . __('Please enter a valid order email', 'woocommerce') . '</p>'; } else { $order = wc_get_order(apply_filters('woocommerce_shortcode_order_tracking_order_id', $order_id)); if ($order && $order->get_id() && $order_email) { if (strtolower($order->get_billing_email()) == strtolower($order_email)) { do_action('woocommerce_track_order', $order->get_id()); wc_get_template('order/tracking.php', array('order' => $order)); return; } } else { echo '<p class="woocommerce-error">' . sprintf(__('Sorry, we could not find that order ID in our database.', 'woocommerce'), get_permalink($post->ID)) . '</p>'; } } } wc_get_template('order/form-tracking.php'); }
static function InitClass() { wp_enqueue_style(WPFB . '-admin', WPFB_PLUGIN_URI . 'css/admin.css', array(), WPFB_VERSION, 'all'); wp_register_script('jquery-deserialize', WPFB_PLUGIN_URI . 'bower_components/jquery-deserialize/dist/jquery.deserialize.min.js', array('jquery'), WPFB_VERSION); if (isset($_GET['page'])) { $page = $_GET['page']; if ($page == 'wpfilebase_files') { wp_enqueue_script('postbox'); wp_enqueue_style('dashboard'); } elseif ($page == 'wpfilebase' && isset($_GET['action']) && $_GET['action'] == 'sync') { do_action('wpfilebase_sync'); wp_die("Filebase synced."); } } add_action('wp_dashboard_setup', array(__CLASS__, 'AdminDashboardSetup')); //wp_register_widget_control(WPFB_PLUGIN_NAME, "[DEPRECATED]".WPFB_PLUGIN_NAME .' '. __('File list','wp-filebase'), array(__CLASS__, 'WidgetFileListControl'), array('description' => __('DEPRECATED','wp-filebase'))); add_action('admin_print_scripts', array('WPFB_AdminLite', 'AdminPrintScripts')); self::CheckChangedVer(); if (basename($_SERVER['PHP_SELF']) === "plugins.php") { if (isset($_GET['wpfb-uninstall']) && current_user_can('edit_files')) { update_option('wpfb_uninstall', !empty($_GET['wpfb-uninstall']) && $_GET['wpfb-uninstall'] != "0"); } if (get_option('wpfb_uninstall')) { function wpfb_uninstall_warning() { echo "\n\t\t\t\t<div id='wpfb-warning' class='updated fade'><p><strong>" . __('WP-Filebase will be uninstalled completely when deactivating the Plugin! All settings and File/Category Info will be deleted. Actual files in the upload directory will not be removed.', 'wp-filebase') . ' <a href="' . add_query_arg('wpfb-uninstall', '0') . '">' . __('Cancel') . "</a></strong></p></div>\n\t\t\t\t"; } add_action('admin_notices', 'wpfb_uninstall_warning'); } } }
/** * 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'); } }
function widget($args, $instance) { $title = apply_filters('widget_title', $instance['title']); if (empty($instance['user_id']) || 'invalid' === $instance['user_id']) { if (current_user_can('edit_theme_options')) { echo $args['before_widget']; echo '<p>' . sprintf(__('You need to enter your numeric user ID for the <a href="%1$s">Goodreads Widget</a> to work correctly. <a href="%2$s">Full instructions</a>.', 'jetpack'), esc_url(admin_url('widgets.php')), 'http://support.wordpress.com/widgets/goodreads-widget/#goodreads-user-id') . '</p>'; echo $args['after_widget']; } return; } if (!array_key_exists($instance['shelf'], $this->shelves)) { return; } $instance['user_id'] = absint($instance['user_id']); // Set widget ID based on shelf. $this->goodreads_widget_id = $instance['user_id'] . '_' . $instance['shelf']; if (empty($title)) { $title = esc_html__('Goodreads', 'jetpack'); } echo $args['before_widget']; echo $args['before_title'] . $title . $args['after_title']; $goodreads_url = 'https://www.goodreads.com/review/custom_widget/' . urlencode($instance['user_id']) . '.' . urlencode($instance['title']) . ':%20' . urlencode($instance['shelf']) . '?cover_position=&cover_size=small&num_books=5&order=d&shelf=' . urlencode($instance['shelf']) . '&sort=date_added&widget_bg_transparent=&widget_id=' . esc_attr($this->goodreads_widget_id); echo '<div class="gr_custom_widget" id="gr_custom_widget_' . esc_attr($this->goodreads_widget_id) . '"></div>' . "\n"; echo '<script src="' . esc_url($goodreads_url) . '"></script>' . "\n"; echo $args['after_widget']; do_action('jetpack_stats_extra', 'widget', 'goodreads'); }
/** * woothemes_metabox_create function. * * @access public * @param object $post * @param array $callback * @return void */ function woothemes_metabox_create($post, $callback) { global $post; // Allow child themes/plugins to act here. do_action('woothemes_metabox_create', $post, $callback); $seo_post_types = array('post', 'page'); if (defined('SEOPOSTTYPES')) { $seo_post_types_update = unserialize(constant('SEOPOSTTYPES')); } if (!empty($seo_post_types_update)) { $seo_post_types = $seo_post_types_update; } $template_to_show = $callback['args']; $woo_metaboxes = get_option('woo_custom_template', array()); $seo_metaboxes = get_option('woo_custom_seo_template', array()); if (empty($seo_metaboxes) && $template_to_show == 'seo') { return; } // Array sanity check. if (!is_array($woo_metaboxes)) { $woo_metaboxes = array(); } // Determine whether or not to display general fields. $display_general_fields = true; if (count($woo_metaboxes) <= 0) { $display_general_fields = false; } // Determine whether or not to display SEO fields. $display_seo_fields = true; if (get_option('seo_woo_hide_fields') == 'true' || get_option('seo_woo_use_third_party_data') == 'true') { $display_seo_fields = false; } $output = ''; // Add nonce for custom fields. $output .= wp_nonce_field('wooframework-custom-fields', 'wooframework-custom-fields-nonce', true, false); if ($callback['id'] == 'woothemes-settings') { // Add tabs. $output .= '<div class="wooframework-tabs">' . "\n"; $output .= '<ul class="tabber hide-if-no-js">' . "\n"; if ($display_general_fields) { $output .= '<li class="wf-tab-general"><a href="#wf-tab-general">' . __('General Settings', 'woothemes') . '</a></li>' . "\n"; } if ($display_seo_fields) { $output .= '<li class="wf-tab-seo"><a href="#wf-tab-seo">' . __('SEO', 'woothemes') . '</a></li>' . "\n"; } // Allow themes/plugins to add tabs to WooFramework custom fields. $output .= apply_filters('wooframework_custom_field_tab_headings', ''); $output .= '</ul>' . "\n"; } if ($display_general_fields) { $output .= woothemes_metabox_create_fields($woo_metaboxes, $callback, 'general'); } if ($display_seo_fields && array_search(get_post_type(), $seo_post_types) !== false) { $output .= woothemes_metabox_create_fields($seo_metaboxes, $callback, 'seo'); } // Allow themes/plugins to add tabs to WooFramework custom fields. $output = apply_filters('wooframework_custom_field_tab_content', $output); $output .= '</div>' . "\n"; echo $output; }
public function init() { $this->min = Redux_Functions::isMin(); $this->timestamp = ReduxFramework::$_version; if ($this->parent->args['dev_mode']) { $this->timestamp .= '.' . time(); } $this->register_styles(); $this->register_scripts(); add_thickbox(); $this->enqueue_fields(); $this->set_localized_data(); /** * action 'redux-enqueue-{opt_name}' * * @deprecated * * @param object $this ReduxFramework */ do_action("redux-enqueue-{$this->parent->args['opt_name']}", $this->parent); // REMOVE /** * action 'redux/page/{opt_name}/enqueue' */ do_action("redux/page/{$this->parent->args['opt_name']}/enqueue"); }
/** * Constructor * * @since 2.4 */ function __construct() { // Settings add_action('init', array(&$this, 'load_settings')); add_action('init', array(&$this, 'start_session'), 1); add_action('wp_logout', array(&$this, '')); add_action('wp_login', array(&$this, '')); add_action('admin_init', array(&$this, 'register_general_settings')); add_action('admin_init', array(&$this, 'register_schedule_settings')); add_action('admin_init', array(&$this, 'register_heat_map_settings')); add_action('admin_init', array(&$this, 'register_url_filters_settings')); add_action('admin_init', array(&$this, 'register_database_settings')); $this->settings_tabs[HA_Common::GENERAL_SETTINGS_TAB] = 'General'; $this->settings_tabs[HA_Common::SCHEDULE_SETTINGS_TAB] = 'Schedule'; $this->settings_tabs[HA_Common::HEAT_MAP_SETTINGS_TAB] = 'Heatmap'; $this->settings_tabs[HA_Common::URL_FILTERS_SETTINGS_TAB] = 'URL Filters'; $this->settings_tabs[HA_Common::DATABASE_SETTINGS_TAB] = 'Database'; $this->settings_tabs[HA_Common::CUSTOM_EVENTS_SETTINGS_TAB] = 'Custom Events'; $this->settings_tabs[HA_Common::REMOTE_SETTINGS_TAB] = 'Remote Client'; $this->users_tabs[HA_Common::USERS_TAB] = 'Users'; $this->users_tabs[HA_Common::USER_ACTIVITY_TAB] = 'User Activity'; $this->reports_tabs[HA_Common::EVENT_COMPARISON_LINE_GRAPH_REPORT_TAB] = 'Event Comparison Line Graph'; $this->reports_tabs[HA_Common::EVENT_LINE_GRAPH_REPORT_TAB] = 'Event Line Graph'; $this->reports_tabs[HA_Common::EVENT_STATISTICS_TABLE_REPORT_TAB] = 'Event Statistics Table'; $this->reports_tabs[HA_Common::EVENT_TOTALS_BAR_GRAPH_REPORT_TAB] = 'Event Totals Bar Graph'; // Create settings page, add JavaScript and CSS if (is_admin()) { add_action('admin_menu', array($this, 'add_admin_menus')); add_action('admin_enqueue_scripts', array($this, 'assets')); } // Setup AJAX calls $this->add_ajax_actions(); $this->data_services = new HA_Local_Data_Services(); do_action('ha_admin_controller_assets', $this); }
public function scan($no_echo) { $this->current_type = 'theme'; $string_settings = apply_filters('wpml_get_setting', false, 'st'); if (isset($_POST['auto_text_domain']) && $_POST['auto_text_domain']) { $string_settings['use_header_text_domains_when_missing'] = 1; } else { $string_settings['use_header_text_domains_when_missing'] = 0; } do_action('wpml_set_setting', 'st', $string_settings, true); $this->scan_starting('theme '); $this->current_path = TEMPLATEPATH; $theme_info = wp_get_theme(); $text_domain = $theme_info->get('TextDomain'); $this->init_text_domain($text_domain); $this->scan_theme_files(); $theme_localization_domains = array(); if (isset($string_settings['theme_localization_domains'])) { $theme_localization_domains = $string_settings['theme_localization_domains']; } if (isset($_POST['icl_load_mo']) && $_POST['icl_load_mo']) { $this->add_translations($theme_localization_domains, ''); } $this->copy_old_translations($theme_localization_domains, 'theme'); $this->cleanup_wrong_contexts(); if (!$no_echo) { $this->scan_response(); } }
function afterInsert($resultSaveID) { if (!isset($this->nohook)) { add_action('wysija_subscribed_to', array($this, 'hook_subscriber_to_list'), 1); } do_action('wysija_subscribed_to', $this->values); }