/** * 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'); }
/** * Create cURL handle for a HTTP request. * * @access public * @since 2.7.0 * * @param string $url The request URL. * @param string|array $args Optional. Override the defaults. * @return cURL handle */ public function createHandle($url, $args = array()) { $defaults = array('timeout' => 5, 'headers' => array(), 'body' => null); $r = wp_parse_args($args, $defaults); $handle = curl_init(); // cURL offers really easy proxy support. $proxy = new WP_HTTP_Proxy(); if ($proxy->is_enabled() && $proxy->send_through_proxy($url)) { curl_setopt($handle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); curl_setopt($handle, CURLOPT_PROXY, $proxy->host()); curl_setopt($handle, CURLOPT_PROXYPORT, $proxy->port()); if ($proxy->use_authentication()) { curl_setopt($handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY); curl_setopt($handle, CURLOPT_PROXYUSERPWD, $proxy->authentication()); } } /* * CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT expect integers. Have to use ceil since. * a value of 0 will allow an unlimited timeout. */ $timeout = (int) ceil($r['timeout']); curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($handle, CURLOPT_TIMEOUT, $timeout); curl_setopt($handle, CURLOPT_URL, $url); curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, true); /* * The option doesn't work with safe mode or when open_basedir is set, and there's * a bug #17490 with redirected POST requests, so handle redirections outside Curl. */ curl_setopt($handle, CURLOPT_FOLLOWLOCATION, false); if (defined('CURLOPT_PROTOCOLS')) { // PHP 5.2.10 / cURL 7.19.4 curl_setopt($handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); } curl_setopt($handle, CURLOPT_POST, true); curl_setopt($handle, CURLOPT_POSTFIELDS, $r['body']); curl_setopt($handle, CURLOPT_HEADER, false); // cURL expects full header strings in each element. $headers = array(); foreach ($r['headers'] as $name => $value) { $headers[] = "{$name}: {$value}"; } curl_setopt($handle, CURLOPT_HTTPHEADER, $headers); /** * Fires before the cURL request is executed. * * Cookies are not currently handled by the HTTP API. This action allows * plugins to handle cookies themselves. * * @since 2.8.0 * * @param resource &$handle The cURL handle returned by curl_init(). * @param array $r The HTTP request arguments. * @param string $url The request URL. */ do_action_ref_array('http_api_curl', array(&$handle, $r, $url)); return $handle; }
/** * Constructor * * @global WP_Embed $wp_embed */ public function __construct() { global $wp_embed; // Make sure we populate the WP_Embed handlers array. // These are providers that use a regex callback on the URL in question. // Do not confuse with oEmbed providers, which require an external ping. // Used in WP_Embed::shortcode(). $this->handlers = $wp_embed->handlers; if (bp_use_embed_in_activity()) { add_filter('bp_get_activity_content_body', array(&$this, 'autoembed'), 8); add_filter('bp_get_activity_content_body', array(&$this, 'run_shortcode'), 7); } if (bp_use_embed_in_activity_replies()) { add_filter('bp_get_activity_content', array(&$this, 'autoembed'), 8); add_filter('bp_get_activity_content', array(&$this, 'run_shortcode'), 7); } if (bp_use_embed_in_forum_posts()) { add_filter('bp_get_the_topic_post_content', array(&$this, 'autoembed'), 8); add_filter('bp_get_the_topic_post_content', array(&$this, 'run_shortcode'), 7); } if (bp_use_embed_in_private_messages()) { add_filter('bp_get_the_thread_message_content', array(&$this, 'autoembed'), 8); add_filter('bp_get_the_thread_message_content', array(&$this, 'run_shortcode'), 7); } /** * Filters the BuddyPress Core oEmbed setup. * * @since 1.5.0 * * @param BP_Embed $this Current instance of the BP_Embed. Passed by reference. */ do_action_ref_array('bp_core_setup_oembed', array(&$this)); }
function bb_syntax_highlight($match) { global $bb_syntax_matches; $i = intval($match[1]); $match = $bb_syntax_matches[$i]; $language = strtolower(trim($match[1])); $line = trim($match[2]); $escaped = trim($match[3]); $code = bb_syntax_code_trim($match[4]); //if ($escaped == "true") $code = htmlspecialchars_decode($code); $code = htmlspecialchars_decode($code); //$code = str_replace("<", "<", $code); //$code = str_replace(">", ">", $code); $geshi = new GeSHi($code, $language); $geshi->enable_keyword_links(false); do_action_ref_array('bb_syntax_init_geshi', array(&$geshi)); $output = "\n<div class=\"bb_syntax\">"; if ($line) { $output .= "<table><tr><td class=\"line_numbers\">"; $output .= bb_syntax_line_numbers($code, $line); $output .= "</td><td class=\"code\">"; $output .= $geshi->parse_code(); $output .= "</td></tr></table>"; } else { $output .= "<div class=\"code\">"; $output .= $geshi->parse_code(); $output .= "</div>"; } $output .= "</div>\n"; return $output; }
/** * Registers route * * @param string $method HTTP method * @param string $pattern The path pattern to match * @param callback $callback Callback function for route * @return \Slim\Route */ public function registerRoute($method, $pattern, $callback) { $method = strtolower($method); $valid_methods = array('get', 'post', 'delete', 'put', 'head', 'options'); if (!in_array($method, $valid_methods)) { return false; } $match = get_api_base() . trailingslashit('v' . $this->version) . $pattern; $app = $this->app; return $this->app->{$method}($match, function () use($app, $callback) { $args = func_get_args(); array_unshift($args, $app); $res = $app->response(); $res->header('Access-Control-Allow-Origin', '*'); if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) { $res->header('Access-Control-Allow-Headers', $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']); } if (($json_p = $app->request()->get('callback')) && \Voce\JSONP::is_valid_callback($json_p)) { $app->contentType('application/javascript; charset=utf-8;'); $res->write($json_p . '('); } else { $app->contentType('application/json; charset=utf-8;'); $json_p = false; } $data = call_user_func_array($callback, $args); if (!is_null($data)) { $json = json_encode($data); $res->write($json); } if ($json_p) { $res->write(')'); } do_action_ref_array('thermal_response', array(&$res, &$app, &$data)); }); }
public function import($forceResync) { if (get_option('goodreads_user_id')) { if (!class_exists('SimplePie')) { require_once ABSPATH . WPINC . '/class-feed.php'; } $rss_source = sprintf(self::$apiurl, get_option('goodreads_user_id')); /* Create the SimplePie object */ $feed = new SimplePie(); /* Set the URL of the feed you're retrieving */ $feed->set_feed_url($rss_source); /* Tell SimplePie to cache the feed using WordPress' cache class */ $feed->set_cache_class('WP_Feed_Cache'); /* Tell SimplePie to use the WordPress class for retrieving feed files */ $feed->set_file_class('WP_SimplePie_File'); /* Tell SimplePie how long to cache the feed data in the WordPress database */ $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', get_option('reclaim_update_interval'), $rss_source)); /* Run any other functions or filters that WordPress normally runs on feeds */ do_action_ref_array('wp_feed_options', array(&$feed, $rss_source)); /* Initiate the SimplePie instance */ $feed->init(); /* Tell SimplePie to send the feed MIME headers */ $feed->handle_content_type(); if ($feed->error()) { parent::log(sprintf(__('no %s data', 'reclaim'), $this->shortname)); parent::log($feed->error()); } else { $data = self::map_data($feed); parent::insert_posts($data); update_option('reclaim_' . $this->shortname . '_last_update', current_time('timestamp')); } } else { parent::log(sprintf(__('%s user data missing. No import was done', 'reclaim'), $this->shortname)); } }
function ru_restore_scripts_l10n() { global $wp_scripts; if (is_a($wp_scripts, 'WP_Scripts')) { do_action_ref_array('wp_default_scripts', array(&$wp_scripts)); } }
/** * Main constructor for Jetpack Comments * * @since JetpackComments (1.4) */ public function __construct() { parent::__construct(); // Jetpack Comments is loaded do_action_ref_array('jetpack_comments_loaded', array($this)); add_action('after_setup_theme', array($this, 'set_default_color_theme_based_on_theme_settings'), 100); }
public static function init() { // Setup headers header('Content-Type: application/json'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // Setup handler $handler = new AjaxHandler(); $handler->registerMethod('items.get', array('LilinaAPI', 'items_get')); $handler->registerMethod('items.getList', array('LilinaAPI', 'items_getList')); $handler->registerMethod('feeds.get', array('LilinaAPI', 'feeds_get')); $handler->registerMethod('feeds.getList', array('LilinaAPI', 'feeds_getList')); $handler->registerMethod('update.single', array('LilinaAPI', 'update_single')); do_action_ref_array('LilinaAPI-register', array(&$handler)); // Dispatch $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; try { $output = $handler->handle($action, $_REQUEST); echo json_encode($output); } catch (Exception $e) { header('HTTP/1.1 500 Internal Server Error'); echo json_encode(array('error' => 1, 'msg' => $e->getMessage(), 'code' => $e->getCode())); } }
function cf_fields_init() { if (!is_blog_installed()) { return; } $this->cf_field_manager->register_field('CF_Field_Input'); $this->cf_field_manager->register_field('CF_Field_Textarea'); $this->cf_field_manager->register_field('CF_Field_EditorLight'); $this->cf_field_manager->register_field('CF_Field_Select'); $this->cf_field_manager->register_field('CF_Field_SelectMultiple'); $this->cf_field_manager->register_field('CF_Field_Checkbox'); $this->cf_field_manager->register_field('CF_Field_Radio'); $this->cf_field_manager->register_field('CF_Field_DatePicker'); $this->cf_field_manager->register_field('CF_Field_Dropdown_Users'); $this->cf_field_manager->register_field('CF_Field_Media'); $this->cf_field_manager->register_field('CF_Field_Dropdown_Pages'); if (function_exists('rpt_set_object_relation')) { $this->cf_field_manager->register_field('CF_Field_RelationPostType'); } do_action_ref_array('fields_init-' . $this->post_type, array(&$this)); do_action_ref_array('fields-init', array(&$this->cf_field_manager)); $this->get_var('sidebars'); if (isset($this->sidebars) && is_array($this->sidebars)) { foreach ($this->sidebars as $sidebar) { $sidebar['before_widget'] = '<div class="form-field">'; $sidebar['after_widget'] = '</div>'; $sidebar['before_title'] = '<label class="title-field">'; $sidebar['after_title'] = ' :</label>'; $this->cf_sidebar->cf_register_sidebar($sidebar); } } }
/** * Add a menu to the Shopp menu area * * @api * @since 1.3 * * @param string $label The translated label to use for the menu * @param string $page The Shopp-internal menu page name (plugin prefix will be automatically added) * @param integer $position The index position of where to add the menu * @param mixed $handler The callback handler to use to handle the page * @param string $access The access capability required to see the menu * @param string $icon The URL for the icon to use for the menu * @return integer The position the menu was added **/ function shopp_admin_add_menu($label, $page, $position = null, $handler = false, $access = null, $icon = null) { global $menu; $AdminPages = ShoppAdminPages(); if (is_null($position)) { $position = 35; } if (is_null($access)) { $access = 'manage_options'; } // Restrictive access by default (for admins only) if (false === $handler) { $handler = array(Shopp::object()->Flow, 'parse'); } if (!is_callable($handler)) { shopp_debug(__FUNCTION__ . " failed: The specified callback handler is not valid."); return false; } while (isset($menu[$position])) { $position++; } $menupage = add_menu_page($label, $label, $access, ShoppAdmin::pagename($page), $handler, $icon, $position); $AdminPages->menu($page, $menupage); do_action_ref_array("shopp_add_topmenu_{$page}", array($menupage)); // @deprecated do_action_ref_array("shopp_add_menu_{$page}", array($menupage)); return $position; }
public static function receive_callback() { self::validate_or_die(); $metadata = self::get_callback_metadata_or_die(); do_action_ref_array($metadata[0], $metadata[1]); self::set_return_code_and_die(200); }
function motopressCEGetLibrary() { require_once dirname(__FILE__) . '/../verifyNonce.php'; require_once dirname(__FILE__) . '/../settings.php'; require_once dirname(__FILE__) . '/../access.php'; require_once dirname(__FILE__) . '/../functions.php'; require_once dirname(__FILE__) . '/Library.php'; global $motopressCELang; global $motopressCESettings; $errors = array(); $motopressCELibrary = new MPCELibrary(); do_action_ref_array('mp_library', array(&$motopressCELibrary)); $json = $motopressCELibrary->toJson(); if ($json) { echo $json; } else { $errors[] = $motopressCELang->CELibraryError; } if (!empty($errors)) { if ($motopressCESettings['debug']) { print_r($errors); } else { motopressCESetError($motopressCELang->CELibraryError); } } exit; }
function fetch_feed2($url) { require_once ABSPATH . WPINC . '/class-feed.php'; $feed = new SimplePie(); $feed->set_sanitize_class('WP_SimplePie_Sanitize_KSES'); // We must manually overwrite $feed->sanitize because SimplePie's // constructor sets it before we have a chance to set the sanitization class $feed->sanitize = new WP_SimplePie_Sanitize_KSES(); $feed->set_cache_class('WP_Feed_Cache'); $feed->set_file_class('WP_SimplePie_File'); $feed->set_feed_url($url); $feed->force_feed(true); /** This filter is documented in wp-includes/class-feed.php */ $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url)); /** * Fires just before processing the SimplePie feed object. * * @since 3.0.0 * * @param object &$feed SimplePie feed object, passed by reference. * @param mixed $url URL of feed to retrieve. If an array of URLs, the feeds are merged. */ do_action_ref_array('wp_feed_options', array(&$feed, $url)); $feed->init(); $feed->handle_content_type(); if ($feed->error()) { return new WP_Error('simplepie-error', $feed->error()); } return $feed; }
public function invoke() { $this->executing = true; do_action_ref_array($this->name, $this->arguments); $this->executing = false; $this->complete = true; }
function motopressCEAddTools() { require_once 'includes/ce/Access.php'; $ceAccess = new MPCEAccess(); $motopressCELibrary = new MPCELibrary(); do_action_ref_array('mp_library', array(&$motopressCELibrary)); $postType = get_post_type(); $postTypes = get_option('motopress-ce-options'); if (!$postTypes) { $postTypes = array(); } if (in_array($postType, $postTypes) && post_type_supports($postType, 'editor') && $ceAccess->hasAccess()) { global $motopressCESettings; wp_localize_script('jquery', 'motopress', $motopressCESettings['motopress_localize']); wp_localize_script('jquery', 'motopressCE', array('postID' => get_the_ID(), 'nonces' => array('motopress_ce_get_wp_settings' => wp_create_nonce('wp_ajax_motopress_ce_get_wp_settings'), 'motopress_ce_render_content' => wp_create_nonce('wp_ajax_motopress_ce_render_content'), 'motopress_ce_remove_temporary_post' => wp_create_nonce('wp_ajax_motopress_ce_remove_temporary_post'), 'motopress_ce_get_library' => wp_create_nonce('wp_ajax_motopress_ce_get_library'), 'motopress_ce_render_shortcode' => wp_create_nonce('wp_ajax_motopress_ce_render_shortcode'), 'motopress_ce_get_attachment_thumbnail' => wp_create_nonce('wp_ajax_motopress_ce_get_attachment_thumbnail'), 'motopress_ce_colorpicker_update_palettes' => wp_create_nonce('wp_ajax_motopress_ce_colorpicker_update_palettes'), 'motopress_ce_render_youtube_bg' => wp_create_nonce('wp_ajax_motopress_ce_render_youtube_bg'), 'motopress_ce_render_video_bg' => wp_create_nonce('wp_ajax_motopress_ce_render_video_bg')))); add_action('admin_head', 'motopressCEAddCEBtn'); add_action('admin_footer', 'motopressCEHTML'); //admin_head motopressCECheckDomainMapping(); wp_register_style('mpce-style', plugin_dir_url(__FILE__) . 'includes/css/style.css', null, $motopressCESettings['plugin_version']); wp_enqueue_style('mpce-style'); wp_register_style('mpce', plugin_dir_url(__FILE__) . 'mp/ce/css/ce.css', null, $motopressCESettings['plugin_version']); wp_enqueue_style('mpce'); wp_register_script('mpce-knob', plugin_dir_url(__FILE__) . 'knob/jquery.knob.min.js', array(), $motopressCESettings['plugin_version']); wp_enqueue_script('mpce-knob'); if (get_user_meta(get_current_user_id(), 'rich_editing', true) === 'false' && !wp_script_is('editor')) { wp_enqueue_script('editor'); } wp_enqueue_script('wp-link'); } }
function wp_syntax_highlight($match) { global $wp_syntax_matches; $i = intval($match[1]); $match = $wp_syntax_matches[$i]; $language = strtolower(trim($match[1])); $line = trim($match[2]); $code = wp_syntax_code_trim($match[3]); $geshi = new GeSHi($code, $language); $geshi->enable_keyword_links(false); do_action_ref_array('wp_syntax_init_geshi', array(&$geshi)); $output = "\n<div class=\"wp_syntax\">"; if ($line) { $output .= "<table><tr><td class=\"line_numbers\">"; $output .= wp_syntax_line_numbers($code, $line); $output .= "</td><td class=\"code\">"; $output .= $geshi->parse_code(); $output .= "</td></tr></table>"; } else { $output .= "<div class=\"code\">"; $output .= $geshi->parse_code(); $output .= "</div>"; } return $output .= "</div>\n"; return $output; }
/** * Setup the theme hooks * * @since bbPress (r3732) * @access private * * @uses add_filter() To add various filters * @uses add_action() To add various actions */ private function setup_actions() { /** Scripts ***********************************************************/ add_action('bbp_enqueue_scripts', array($this, 'enqueue_styles')); // Enqueue theme CSS add_action('bbp_enqueue_scripts', array($this, 'enqueue_scripts')); // Enqueue theme JS add_filter('bbp_enqueue_scripts', array($this, 'localize_topic_script')); // Enqueue theme script localization add_action('bbp_ajax_favorite', array($this, 'ajax_favorite')); // Handles the topic ajax favorite/unfavorite add_action('bbp_ajax_subscription', array($this, 'ajax_subscription')); // Handles the topic ajax subscribe/unsubscribe add_action('bbp_ajax_forum_subscription', array($this, 'ajax_forum_subscription')); // Handles the forum ajax subscribe/unsubscribe /** Template Wrappers *************************************************/ add_action('bbp_before_main_content', array($this, 'before_main_content')); // Top wrapper HTML add_action('bbp_after_main_content', array($this, 'after_main_content')); // Bottom wrapper HTML /** Override **********************************************************/ do_action_ref_array('bbp_theme_compat_actions', array(&$this)); /** Orit Gigo: getting button state ***********************************/ add_action('bbp_ajax_getfavoritestate', array($this, 'ajax_get_favorite')); // Gets the topic ajax favorite/unfavorite add_action('bbp_ajax_getsubscriptionstate', array($this, 'ajax_get_subscription')); // Gets the topic ajax subscribe/unsubscribe add_action('bbp_ajax_forum_getsubscriptionstate', array($this, 'ajax_get_forum_subscription')); // Handles the forum ajax subscribe/unsubscribe }
/** * Save the BP blog data to the database. * * @return bool True on success, false on failure. */ public function save() { global $wpdb, $bp; $this->user_id = apply_filters('bp_blogs_blog_user_id_before_save', $this->user_id, $this->id); $this->blog_id = apply_filters('bp_blogs_blog_id_before_save', $this->blog_id, $this->id); do_action_ref_array('bp_blogs_blog_before_save', array(&$this)); // Don't try and save if there is no user ID or blog ID set. if (!$this->user_id || !$this->blog_id) { return false; } // Don't save if this blog has already been recorded for the user. if (!$this->id && $this->exists()) { return false; } if ($this->id) { // Update $sql = $wpdb->prepare("UPDATE {$bp->blogs->table_name} SET user_id = %d, blog_id = %d WHERE id = %d", $this->user_id, $this->blog_id, $this->id); } else { // Save $sql = $wpdb->prepare("INSERT INTO {$bp->blogs->table_name} ( user_id, blog_id ) VALUES ( %d, %d )", $this->user_id, $this->blog_id); } if (!$wpdb->query($sql)) { return false; } do_action_ref_array('bp_blogs_blog_after_save', array(&$this)); if ($this->id) { return $this->id; } else { return $wpdb->insert_id; } }
function motopressCERenderShortcode() { require_once dirname(__FILE__) . '/../verifyNonce.php'; require_once dirname(__FILE__) . '/../settings.php'; require_once dirname(__FILE__) . '/../access.php'; require_once dirname(__FILE__) . '/../functions.php'; require_once dirname(__FILE__) . '/../getLanguageDict.php'; require_once dirname(__FILE__) . '/Shortcode.php'; global $motopressCELang; $errorMessage = strtr($motopressCELang->CERenderError, array('%name%' => $motopressCELang->CEShortcode)); if (isset($_POST['closeType']) && !empty($_POST['closeType']) && isset($_POST['shortcode']) && !empty($_POST['shortcode'])) { global $motopressCESettings; $errors = array(); $closeType = $_POST['closeType']; $shortcode = $_POST['shortcode']; $parameters = null; if (isset($_POST['parameters']) && !empty($_POST['parameters'])) { $parameters = json_decode(stripslashes($_POST['parameters'])); if (!$parameters) { $errors[] = $errorMessage; } } $styles = null; if (isset($_POST['styles']) && !empty($_POST['styles'])) { $styles = json_decode(stripslashes($_POST['styles'])); if (!$styles) { $errors[] = $errorMessage; } } if (empty($errors)) { global $motopressCELibrary; $motopressCELibrary = new MPCELibrary(); do_action_ref_array('mp_library', array(&$motopressCELibrary)); do_action('motopress_render_shortcode', $shortcode); //for motopress-cherryframework plugin $s = new MPCEShortcode(); $content = null; if (isset($_POST['content']) && !empty($_POST['content'])) { $content = stripslashes($_POST['content']); if (isset($_POST['wrapRender']) && $_POST['wrapRender'] === 'true') { $content = motopressCECleanupShortcode($content); $content = motopressCEParseObjectsRecursive($content); } } $str = $s->toShortcode($closeType, $shortcode, $parameters, $styles, $content); echo apply_filters('the_content', '<div class="motopress-ce-shortcode-wrapper">' . $str . '</div>'); // echo do_shortcode($str); } if (!empty($errors)) { if ($motopressCESettings['debug']) { print_r($errors); } else { motopressCESetError($errorMessage); } } } else { motopressCESetError($errorMessage); } exit; }
function do_cron() { # Lifted from wp-cron.php because it can't handle multiple blogs if (false === ($crons = _get_cron_array())) { print "no crons.\n"; return; } $keys = array_keys($crons); $local_time = time(); if (isset($keys[0]) && $keys[0] > $local_time) { print "not yet time.\n"; return; } foreach ($crons as $timestamp => $cronhooks) { if ($timestamp > $local_time) { break; } foreach ($cronhooks as $hook => $keys) { foreach ($keys as $k => $v) { $schedule = $v['schedule']; if ($schedule != false) { $new_args = array($timestamp, $schedule, $hook, $v['args']); call_user_func_array('wp_reschedule_event', $new_args); } wp_unschedule_event($timestamp, $hook, $v['args']); print $hook . "... "; do_action_ref_array($hook, $v['args']); } } } # /end lifted from wp-cron.php }
/** * Short-circuit the WP_Widget_Text form so we can inject our editor * * @see WP_Widget::form_callback * * @param $instance * @param $widget * * @return mixed */ function widget_form_callback($instance, $widget) { if (is_a($widget, 'WP_Widget_Text') && false !== $instance) { add_filter('wp_default_editor', function () { return 'tinymce'; }); // we need $return for the in_widget_form action $return = null; ob_start(); $return = $widget->form($instance); $form = ob_get_clean(); $top = explode('<textarea', $form); $bottom = explode('/textarea>', $top[1]); $top = $top[0]; $bottom = $bottom[1]; ob_start(); ?> <input type="hidden" name="<?php echo $widget->get_field_name('text'); ?> " value=""><?php wp_editor(stripslashes($instance['text']), $this->make_editor_id($widget), array('editor_class' => 'sweet-widgets-text-editor', 'editor_height' => '320px')); $editor = ob_get_clean(); echo $top . $editor . $bottom; do_action_ref_array('in_widget_form', array(&$widget, &$return, $instance)); $instance = false; } return $instance; }
/** * Portfolio shortcode handler. * do nothing and leave rendering of the portfolio completely to the theme */ function youxi_portfolio_shortcode_cb($atts, $content, $tag) { ob_start(); $args = func_get_args(); do_action_ref_array('youxi_portfolio_shortcode_output', $args); return ob_get_clean(); }
/** * Set up global post data. * * @since 1.5.0 * * @param object $post Post data. * @uses do_action_ref_array() Calls 'the_post' * @return bool True when finished. */ function setup_postdata_custom($post) { global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages; $id = (int) $post->ID; $authordata = get_userdata($post->post_author); $currentday = mysql2date('d.m.y', $post->post_date, false); $currentmonth = mysql2date('m', $post->post_date, false); $numpages = 1; $multipage = 0; $page = get_query_var('page'); if (!$page) { $page = 1; } if (is_single() || is_page() || is_feed()) { $more = 1; } $content = $post->post_content; $pages = array($post->post_content); /** * Fires once the post data has been setup. * * @since 2.8.0 * * @param WP_Post &$post The Post object (passed by reference). */ do_action_ref_array('the_post', array(&$post)); return true; }
function keygen () { $message = $this->name.$this->purchase.$this->product.$this->price.$this->download; $key = sha1($message); if (empty($key)) $key = md5($message); $this->dkey = $key; do_action_ref_array('ecart_download_keygen',array(&$this)); }
/** * 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); } }
/** * Dispatches the current URL and executes an assigned callback */ public function dispatch() { $method = 'default'; if (isset($_REQUEST['method'])) { $method = preg_replace('/[^-_.0-9a-zA-Z]/', '', $_REQUEST['method']); } $method = apply_filters('controller-method', $method); define('LILINA_PAGE', $method); try { if (!$method || empty($this->methods[$method])) { // Dynamically load method if possible if (file_exists(LILINA_INCPATH . '/core/method-' . $method . '.php')) { require_once LILINA_INCPATH . '/core/method-' . $method . '.php'; } } do_action_ref_array('controller-lateregister', array(&$this)); // Check again, in case we loaded it last time if (!$method || empty($this->methods[$method])) { // No or invalid method throw new Exception(sprintf(_r('Unknown method: %s'), $method)); } $callback = $this->methods[$method]; call_user_func($callback); } catch (Exception $e) { lilina_nice_die('<p>' . sprintf(_r('An error occured dispatching a method: %s'), $e->getMessage()) . '</p>'); } }
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; }
/** * Construct */ function __construct($type = 'mycred_default') { // Prep $this->is_multisite = is_multisite(); $this->use_master_template = mycred_override_settings(); $this->use_central_logging = mycred_centralize_log(); if ($type == '' || $type === NULL) { $type = 'mycred_default'; } // Load Settings $option_id = 'mycred_pref_core'; if ($type != 'mycred_default' && $type != '') { $option_id .= '_' . $type; } $this->core = mycred_get_option($option_id, $this->defaults()); if ($this->core !== false) { foreach ((array) $this->core as $key => $value) { $this->{$key} = $value; } } if ($type != '') { $this->cred_id = $type; } if (defined('MYCRED_LOG_TABLE')) { $this->log_table = MYCRED_LOG_TABLE; } else { global $wpdb; if ($this->is_multisite && $this->use_central_logging) { $this->log_table = $wpdb->base_prefix . 'myCRED_log'; } else { $this->log_table = $wpdb->prefix . 'myCRED_log'; } } do_action_ref_array('mycred_settings', array(&$this)); }
function cf_fields_init() { if (!is_blog_installed()) { return; } $this->cf_field_manager->register_field('CF_Field_Input'); $this->cf_field_manager->register_field('CF_Field_Textarea'); $this->cf_field_manager->register_field('CF_Field_EditorLight'); $this->cf_field_manager->register_field('CF_Field_Select'); $this->cf_field_manager->register_field('CF_Field_SelectMultiple'); $this->cf_field_manager->register_field('CF_Field_Checkbox'); $this->cf_field_manager->register_field('CF_Field_DatePicker'); $this->cf_field_manager->register_field('CF_Field_Dropdown_Users'); $this->cf_field_manager->register_field('CF_Field_Media'); $this->cf_field_manager->register_field('CF_Field_Separator'); do_action_ref_array('fields_init-' . $this->post_type, array(&$this)); $this->get_var('sidebars'); if (isset($this->sidebars) && is_array($this->sidebars)) { foreach ($this->sidebars as $sidebar) { $sidebar['before_widget'] = '<tr class="form-field">'; $sidebar['after_widget'] = '</td></tr>'; $sidebar['before_title'] = '<th valign="top" scope="row"><label>'; $sidebar['after_title'] = '</label></th><td>'; $this->cf_sidebar->cf_register_sidebar($sidebar); } } }