/** * Set page meta box values with vc_adv_pager shortcodes data * @since 4.4 * @deprecated 4.4.3 * * @param array $settings * @param $post_id * @param $post * * @return array - shortcode settings to save. */ public function gridSavePostSettings(array $settings, $post_id, $post) { _deprecated_function('Vc_Hooks_Vc_Grid: gridSavePostSettings method', '4.4.3', 'gridSavePostSettingsId'); $pattern = $this->getShortcodeRegexForHash(); preg_match_all("/{$pattern}/", $post->post_content, $found); // fetch only needed shortcodes $settings['vc_grid'] = array(); if (is_array($found) && !empty($found[0])) { $to_save = array(); if (isset($found[3]) && is_array($found[3])) { foreach ($found[3] as $key => $shortcode_atts) { if (false !== strpos($shortcode_atts, 'vc_gid:')) { continue; } $atts = shortcode_parse_atts($shortcode_atts); $data = array('tag' => $found[2][$key], 'atts' => $atts, 'content' => $found[5][$key]); $hash = sha1(serialize($data)); $to_save[$hash] = $data; } } if (!empty($to_save)) { $settings['vc_grid'] = array('shortcodes' => $to_save); } } return $settings; }
/** * Get the DB schema to use for BuddyPress components. * * @since 1.1.0 * @deprecated 2.7.0 * * @return string The default database character-set, if set. */ function bp_core_set_charset() { global $wpdb; _deprecated_function(__FUNCTION__, '2.7', 'wpdb::get_charset_collate()'); require_once ABSPATH . 'wp-admin/includes/upgrade.php'; return !empty($wpdb->charset) ? "DEFAULT CHARACTER SET {$wpdb->charset}" : ''; }
/** * Retrieve sitewide activity * * You should use bp_activity_get() instead * * @since 1.0.0 * @deprecated 1.2.0 * * @param array $args * * @uses BP_Activity_Activity::get() {@link BP_Activity_Activity} * * @return object $activity The activity/activities object */ function bp_activity_get_sitewide($args = '') { _deprecated_function(__FUNCTION__, '1.2', 'bp_activity_get()'); $defaults = array('max' => false, 'page' => 1, 'per_page' => false, 'sort' => 'DESC', 'display_comments' => false, 'search_terms' => false, 'show_hidden' => false, 'filter' => array()); $args = wp_parse_args($args, $defaults); return apply_filters('bp_activity_get_sitewide', BP_Activity_Activity::get($args), $r); }
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; }
/** * Return the referrer URL without the http(s):// * * @deprecated 2.3.0 * * @return string The referrer URL. */ function bp_core_referrer() { _deprecated_function(__FUNCTION__, '2.3.0', 'bp_get_referer_path()'); $referer = explode('/', wp_get_referer()); unset($referer[0], $referer[1], $referer[2]); return implode('/', $referer); }
/** * Returns the document title. * * The order (site name first or last) can be set on the Tarski Options page. * While the function ultimately returns a string, please note that filters * are applied to an array! This allows plugins to easily alter any aspect * of the title. For example, one might write a plugin to change the separator. * * @since 1.5 * @deprecated 3.2.0 * * @param string $sep * @return string * * @hook filter tarski_doctitle * Filter document titles. */ function tarski_doctitle($sep = '·') { _deprecated_function('wp_title', '3.2.0'); $site_name = get_bloginfo('name'); $content = trim(wp_title('', false)); if (is_404()) { $content = sprintf(__('Error %s', 'tarski'), '404'); } elseif (get_option('show_on_front') == 'posts' && is_home()) { $content = get_bloginfo('description', 'display'); } elseif (is_search()) { $content = sprintf(__('Search results for %s', 'tarski'), esc_html(get_search_query())); } elseif (is_month()) { $content = single_month_title(' ', false); } elseif (is_tag()) { $content = multiple_tag_titles(); } $elements = strlen($content) > 0 ? array('site_name' => $site_name, 'separator' => $sep, 'content' => $content) : array('site_name' => $site_name); if (get_tarski_option('swap_title_order')) { $elements = array_reverse($elements, true); } // Filters should return an array $elements = apply_filters('tarski_doctitle', $elements); // But if they don't, it won't try to implode if (is_array($elements)) { $doctitle = implode(' ', $elements); } echo $doctitle; }
/** * 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'); } }
/** * Gets the MailChimp for WP API class and injects it with the API key * * @deprecated 4.0 * @use mc4wp_get_api_v3 * * @since 1.0 * @access public * * @return MC4WP_API */ function mc4wp_get_api() { _deprecated_function(__FUNCTION__, '4.0', 'mc4wp_get_api_v3'); $opts = mc4wp_get_options(); $instance = new MC4WP_API($opts['api_key']); return $instance; }
/** * Writes logging info to a file. * * @since 2.2.0 * @deprecated 3.4.0 * @deprecated Use error_log() * @link http://www.php.net/manual/en/function.error-log.php * * @param string $label Type of logging * @param string $msg Information describing logging reason. */ function log_app($label, $msg) { _deprecated_function(__FUNCTION__, '3.4', 'error_log()'); if (!empty($GLOBALS['app_logging'])) { error_log($label . ' - ' . $msg); } }
/** * Apply wp_kses to widget text * * @uses wp_kses_post() * * @param string $text * @return string * @since 2.0.0 * @deprecated 2.0.3 */ public function wp_kses_post($text, $instance = null, $widget = null) { _deprecated_function(__METHOD__, '2.0.3'); if (bstw()->check_widget($widget) && !empty($instance)) { $text = wp_kses_post($text); } return $text; }
/** * Adds grid item post type into the list of excluded post types for VC editors. * * @param array $list * * @since 4.4 * @deprecated 4.10 * @return array */ function vc_grid_item_vc_settings_exclude(array $list) { _deprecated_function('vc_grid_item_vc_settings_exclude function', '4.4 (will be removed in 4.10)'); require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/editor/class-vc-grid-item-editor.php'); $vc_grid_item_editor = new Vc_Grid_Item_Editor(); $list[] = $vc_grid_item_editor->postType(); return $list; }
function get_useronline_count($display = false) { _deprecated_function(__FUNCTION__, '2.70', 'users_online_count()'); if (!$display) { return get_users_online_count(); } users_online_count(); }
/** * Get all options for the Events Calendar * * @return array of options */ public static function get_options() { $options = get_option(Tribe__Main::OPTIONNAME, array()); if (has_filter('tribe_get_options')) { _deprecated_function('tribe_get_options', '3.10', 'option_' . Tribe__Main::OPTIONNAME); $options = apply_filters('tribe_get_options', $options); } return $options; }
function lp_deprecated_filter_mapping($data, $arg_1 = '', $arg_2 = '', $arg_3 = '') { global $lp_map_deprecated_filters, $wp_filter; $filter = current_filter(); if (!empty($wp_filter[$filter]) && count($wp_filter[$filter]) > 1) { _deprecated_function('The ' . $filter . ' hook', '1.0', $lp_map_deprecated_filters[$filter]); } return $data; }
private function maybe_fire_array_access_deprecation_notice($offset) { if (self::SUPPRESS_DEPRECATION_NOTICE) { return; } if (!self::$deprecation_notice_fired) { _deprecated_function('Array access to the field object is now deprecated. Further notices will be suppressed. Offset: ' . $offset, '1.9', 'the object operator e.g. $field->' . $offset); self::$deprecation_notice_fired = true; } }
/** * @deprecated 4.4 */ public function load() { _deprecated_function('Vc_Vendors_Manager::load', '4.4', 'autoload logic'); foreach ($this->vendors as $vendor) { /** * @var $vendor Vc_Vendor_Interface */ $vendor->load(); } }
/** * Get the title for day view * @param $title * @param null $sep * * @return string */ protected function get_title($original_title, $sep = null) { $new_title = parent::get_title($original_title, $sep); if (has_filter('tribe_events_day_view_title')) { _deprecated_function("The 'tribe_events_day_view_title' filter", '3.8', " the 'tribe_get_events_title' filter"); $title_date = date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))); $new_title = apply_filters('tribe_events_day_view_title', $new_title, $sep, $title_date); } return $new_title; }
/** * Maintain backwards compatibility for camelCase methods * * Originally this plugin used camelCase method names, but switched to underscore_case * in 2.0 to align with WordPress coding standards. This magic method allows other plugins * to continue calling the old method names until there has been sufficient time for * developers to switch to using the new ones. * * @param string $method * @param array $parameters * @return mixed */ public function __call($method, $parameters) { $underscore_name = strtolower(preg_replace('/(?!^)[[:upper:]][[:lower:]]/', '_$0', $method)); $results = null; if (method_exists($this, $underscore_name)) { _deprecated_function(__CLASS__ . '->' . $method, '2.0', __CLASS__ . '->' . $underscore_name); $results = call_user_func_array(array($this, $underscore_name), $parameters); } return $results; }
/** * Wrapper for deprecated functions so we can apply some extra logic. * * @since 2.7.0 * @param string $function * @param string $version * @param string $replacement */ function wc_deprecated_function($function, $version, $replacement = null) { if (is_ajax()) { $log_string = "The {$function} function is deprecated since version {$version}."; $log_string .= $replacement ? "Replace with {$replacement}." : ''; error_log($log_string); } else { _deprecated_function($function, $version, $replacement); } }
/** * Output the shortcode. * * @param array $atts */ public static function output($atts) { global $wp; // Check cart class is loaded or abort if (is_null(WC()->cart)) { return; } if (!is_user_logged_in()) { $message = apply_filters('woocommerce_my_account_message', ''); if (!empty($message)) { wc_add_notice($message); } // After password reset, add confirmation message. if (!empty($_GET['password-reset'])) { wc_add_notice(__('Your password has been reset successfully.', 'woocommerce')); } if (isset($wp->query_vars['lost-password'])) { self::lost_password(); } else { wc_get_template('myaccount/form-login.php'); } } else { // Start output buffer since the html may need discarding for BW compatibility ob_start(); // Collect notices before output $notices = wc_get_notices(); // Output the new account page self::my_account($atts); /** * Deprecated my-account.php template handling. This code should be * removed in a future release. * * If woocommerce_account_content did not run, this is an old template * so we need to render the endpoint content again. */ if (!did_action('woocommerce_account_content')) { foreach ($wp->query_vars as $key => $value) { if ('pagename' === $key) { continue; } if (has_action('woocommerce_account_' . $key . '_endpoint')) { ob_clean(); // Clear previous buffer wc_set_notices($notices); wc_print_notices(); do_action('woocommerce_account_' . $key . '_endpoint', $value); break; } } _deprecated_function('Your theme version of my-account.php template', '2.6', 'the latest version, which supports multiple account pages and navigation, from WC 2.6.0'); } // Send output buffer ob_end_flush(); } }
/** * Build edit form fields * * @deprecated 4.4 * @use Vc_Shortcode_Edit_Form::renderFields */ public function build() { _deprecated_function('Vc_Shortcode_Edit_Form::build', '4.4', 'Vc_Shortcode_Edit_Form::renderFields'); $tag = vc_post_param('element'); vc_user_access()->checkAdminNonce()->validateDie(__('Access denied', 'js_composer'))->wpAny('edit_posts', 'edit_pages')->validateDie(__('Access denied', 'js_composer'))->check('vc_user_access_check_shortcode_edit', $tag)->validateDie(__('Access denied', 'js_composer')); $shortcode = stripslashes(vc_post_param('shortcode')); require_once vc_path_dir('EDITORS_DIR', 'class-vc-edit-form-fields.php'); $fields = new Vc_Edit_Form_Fields($tag, shortcode_parse_atts($shortcode)); $fields->render(); die; }
/** * Display author box and its contents. * @deprecated 2.0.2 Use get_template_part( 'author-bio' ) instead. */ function calibrefx_author_box($context = '') { _deprecated_function(__FUNCTION__, '2.0.2', 'get_template_part( \'author-bio\' )'); global $authordata; // $authordata = is_object( $authordata ) ? $authordata : get_userdata( get_query_var( 'author' ) ); $gravatar_size = apply_filters('calibrefx_author_box_gravatar_size', 70, $context); $gravatar = get_avatar(get_the_author_meta('email'), $gravatar_size); $title = apply_filters('calibrefx_author_box_title', sprintf('<strong>%s %s</strong>', __('About', 'calibrefx'), get_the_author()), $context); $description = wpautop(get_the_author_meta('description')); $pattern = $context == 'single' ? '<div class="author-box well"><div>%s %s<br />%s</div></div><!-- end .authorbox-->' : '<div class="author-box well">%s<h1>%s</h1><div>%s</div></div><!-- end .authorbox-->'; echo apply_filters('calibrefx_author_box', sprintf($pattern, $gravatar, $title, $description), $context, $pattern, $gravatar, $title, $description); }
/** * dlm_create_log function. * * @access public * * @deprecated 1.6.0 * * @param string $type (default: '') * @param string $status (default: '') * @param string $message (default: '') * @param mixed $download * @param mixed $version * * @return void */ function dlm_create_log($type = '', $status = '', $message = '', $download, $version) { // Deprecated notice _deprecated_function(__FUNCTION__, '1.6.0', 'DLM_Logging->create_log()'); // Logging object $logging = new DLM_Logging(); // Check if logging is enabled if ($logging->is_logging_enabled()) { // Create log $logging->create_log($type, $status, $message, $download, $version); } }
/** * Get the title for list view * @param $title * @param null $sep * * @return string */ protected function get_title($original_title, $sep = null) { $new_title = parent::get_title($original_title, $sep); if (tribe_is_upcoming() && has_filter('tribe_upcoming_events_title')) { _deprecated_function("The 'tribe_upcoming_events_title' filter", '3.8', " the 'tribe_get_events_title' filter"); $new_title = apply_filters('tribe_upcoming_events_title', $new_title, $sep); } elseif (has_filter('tribe_past_events_title')) { _deprecated_function("The 'tribe_past_events_title' filter", '3.8', " the 'tribe_get_events_title' filter"); $new_title = apply_filters('tribe_past_events_title', $new_title, $sep); } return $new_title; }
/** * @since 0.1.0 * @deprecated 0.2.0 */ function members_get_avatar_shortcode($attr) { _deprecated_function(__FUNCTION__, '0.2.0', ''); /* Set up our default attributes. */ $defaults = array('id' => '', 'email' => '', 'size' => 96, 'default' => '', 'alt' => ''); /* Merge the input attributes and the defaults. */ extract(shortcode_atts($defaults, $attr)); /* If an email was input, use it. Else, use the ID. */ $id_or_email = !empty($email) ? $email : $id; /* Return the avatar. */ return get_avatar($id_or_email, $size, $default, $alt); }
function weixin_robot_get_weixin_query_id() { _deprecated_function(__FUNCTION__, '3.9', 'weixin_robot_get_user_query_id'); $query_key = weixin_robot_get_user_query_key(); if (isset($_GET[$query_key])) { return $_GET[$query_key]; } elseif (isset($_COOKIE[$query_key])) { return $_COOKIE[$query_key]; } else { return ''; } }
/** * Fetch related posts. * * @since 1.8.6 * * @deprecated v2.0.0 * @see get_crp_posts_id * * @param int $postid (default: FALSE) The post ID for which you want the posts for * @param int $limit (default: FALSE) Maximum posts to retreive * @param boolean $strict_limit (default: TRUE) Setting to true will fetch exactly as per limit above * @return object Object with Post IDs */ function get_crp_posts($postid = FALSE, $limit = FALSE, $strict_limit = TRUE) { _deprecated_function('get_crp_posts', '2.0.0', 'get_crp_posts_id'); $results = get_crp_posts_id(array('postid' => $postid, 'limit' => $limit, 'strict_limit' => $strict_limit)); /** * Filter object containing the post IDs. * * @since 1.9 * * @param object $results Object containing the related post IDs */ return apply_filters('get_crp_posts', $results); }
/** * The constructor. */ private function __construct() { $this->constants(); $this->init(); // Fires the loaded action. // Deprecated action. `papi/loaded` should be used instead. if (has_action('papi/include')) { did_action('papi/include') || do_action('papi/include'); _deprecated_function('The papi/include action', '3.0.0', 'papi/loaded'); } // Fires the loaded action. did_action('papi/loaded') || do_action('papi/loaded'); }
/** * Fires the deprecation notice only once per page. Not fired during AJAX requests. * * @param string $offset The array key being accessed. */ private function maybe_fire_array_access_deprecation_notice($offset) { if (self::SUPPRESS_DEPRECATION_NOTICE) { return; } if (defined('DOING_AJAX') && DOING_AJAX) { return; } if (!self::$deprecation_notice_fired) { _deprecated_function("Array access to the field object is now deprecated. Further notices will be suppressed. \$field['" . $offset . "']", '2.0', 'the object operator e.g. $field->' . $offset); self::$deprecation_notice_fired = true; } }
public function __construct() { _deprecated_function('GP_CLI::__construct', '', 'WP_CLI_Command'); global $argv; if (gp_array_get($_SERVER, 'HTTP_HOST')) { die('CLI only!'); } if (!defined('STDERR')) { define('STDERR', fopen('php://stderr', 'w')); } $this->program_name = array_shift($argv); $this->options = getopt($this->short_options, $this->long_options); $this->args = $argv; }