当前位置: 首页>>代码示例>>PHP>>正文


PHP current_filter函数代码示例

本文整理汇总了PHP中current_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP current_filter函数的具体用法?PHP current_filter怎么用?PHP current_filter使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了current_filter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: log

 /**
  * Logs the given value to a file.
  * @since   2.0.6
  */
 public static function log($v, $sFilePath = null)
 {
     if (!defined('WP_DEBUG') || !WP_DEBUG) {
         return;
     }
     static $_iPageLoadID;
     // identifies the page load.
     static $_nGMTOffset;
     static $_fPreviousTimeStamp = 0;
     $_iPageLoadID = $_iPageLoadID ? $_iPageLoadID : uniqid();
     $_oCallerInfo = debug_backtrace();
     $_sCallerFunction = isset($_oCallerInfo[1]['function']) ? $_oCallerInfo[1]['function'] : '';
     $_sCallerClasss = isset($_oCallerInfo[1]['class']) ? $_oCallerInfo[1]['class'] : '';
     $sFilePath = !$sFilePath ? WP_CONTENT_DIR . DIRECTORY_SEPARATOR . get_class() . '_' . $_sCallerClasss . '_' . date("Ymd") . '.log' : (true === $sFilePath ? WP_CONTENT_DIR . DIRECTORY_SEPARATOR . get_class() . '_' . date("Ymd") . '.log' : $sFilePath);
     $_nGMTOffset = isset($_nGMTOffset) ? $_nGMTOffset : get_option('gmt_offset');
     $_fCurrentTimeStamp = microtime(true);
     $_nNow = $_fCurrentTimeStamp + $_nGMTOffset * 60 * 60;
     $_nMicroseconds = round(($_nNow - floor($_nNow)) * 10000);
     $_nMicroseconds = str_pad($_nMicroseconds, 4, '0');
     // $_nMicroseconds        = strlen( $_nMicroseconds ) === 4 ? $_nMicroseconds : str_pad( $_nMicroseconds, 4, '0' );
     $_nElapsed = round($_fCurrentTimeStamp - $_fPreviousTimeStamp, 3);
     $_aElapsedParts = explode(".", (string) $_nElapsed);
     $_sElapsedFloat = str_pad(isset($_aElapsedParts[1]) ? $_aElapsedParts[1] : 0, 3, '0');
     $_sElapsed = isset($_aElapsedParts[0]) ? $_aElapsedParts[0] : 0;
     $_sElapsed = strlen($_sElapsed) > 1 ? '+' . substr($_sElapsed, -1, 2) : ' ' . $_sElapsed;
     $_sHeading = date("Y/m/d H:i:s", $_nNow) . '.' . $_nMicroseconds . ' ' . $_sElapsed . '.' . $_sElapsedFloat . ' ' . "{$_iPageLoadID} {$_sCallerClasss}::{$_sCallerFunction} " . current_filter() . ' ' . self::getCurrentURL();
     file_put_contents($sFilePath, $_sHeading . PHP_EOL . print_r($v, true) . PHP_EOL . PHP_EOL, FILE_APPEND);
     $_fPreviousTimeStamp = $_fCurrentTimeStamp;
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:33,代码来源:AmazonAutoLinks_Debug.php

示例2: change_term_relationships

 /**
  * Handle term changes.
  *
  * @wp-hook create_term
  * @wp-hook delete_term
  * @wp-hook edit_term
  *
  * @param int    $term_id          Term ID. Not used.
  * @param int    $term_taxonomy_id Term taxonomy ID.
  * @param string $taxonomy         Taxonomy slug.
  *
  * @return bool
  */
 public function change_term_relationships($term_id, $term_taxonomy_id, $taxonomy)
 {
     if (!$this->is_valid_request($taxonomy)) {
         return FALSE;
     }
     /**
      * This is a core bug!
      *
      * @see https://core.trac.wordpress.org/ticket/32876
      */
     $term_taxonomy_id = (int) $term_taxonomy_id;
     $success = FALSE;
     $current_filter = current_filter();
     if (is_callable(array($this, $current_filter))) {
         /**
          * Runs before the terms are changed.
          *
          * @param int    $term_taxonomy_id Term taxonomy ID.
          * @param string $taxonomy         Taxonomy name.
          * @param string $current_filter   Current filter.
          */
         do_action('mlp_before_term_synchronization', $term_taxonomy_id, $taxonomy, $current_filter);
         $success = call_user_func(array($this, $current_filter), $term_taxonomy_id);
         /**
          * Runs after the terms have been changed.
          *
          * @param int    $term_taxonomy_id Term taxonomy ID.
          * @param string $taxonomy         Taxonomy name.
          * @param string $current_filter   Current filter.
          * @param bool   $success          Denotes whether or not the database was changed.
          */
         do_action('mlp_after_term_synchronization', $term_taxonomy_id, $taxonomy, $current_filter, $success);
     }
     return $success;
 }
开发者ID:kraftner,项目名称:multilingual-press,代码行数:48,代码来源:Mlp_Term_Connector.php

示例3: handle_deprecation

 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;
 }
开发者ID:Jayriq,项目名称:opentickets-community,代码行数:26,代码来源:deprecated.php

示例4: tc_fp_block_display

    /**
     * The template displaying the front page featured page block.
     *
     *
     * @package Customizr
     * @since Customizr 3.0
     */
    function tc_fp_block_display()
    {
        //gets display options
        $tc_show_featured_pages = esc_attr(tc__f('__get_option', 'tc_show_featured_pages'));
        $tc_show_featured_pages_img = esc_attr(tc__f('__get_option', 'tc_show_featured_pages_img'));
        if (!apply_filters('tc_show_fp', 0 != $tc_show_featured_pages && tc__f('__is_home'))) {
            return;
        }
        //gets the featured pages array and sets the fp layout
        $fp_ids = apply_filters('tc_featured_pages_ids', TC_init::$instance->fp_ids);
        $fp_nb = count($fp_ids);
        $fp_per_row = apply_filters('tc_fp_per_line', 3);
        //defines the span class
        $span_array = array(1 => 12, 2 => 6, 3 => 4, 4 => 3, 5 => 2, 6 => 2, 7 => 2);
        $span_value = 4;
        $span_value = $fp_per_row > 7 ? 1 : $span_value;
        $span_value = isset($span_array[$fp_per_row]) ? $span_array[$fp_per_row] : $span_value;
        //save $args for filter
        $args = array($fp_ids, $fp_nb, $fp_per_row, $span_value);
        ?>

        <?php 
        ob_start();
        ?>



  			<div class="container marketing">


            <center><h1>
              Mavericks Classes<br>
            </h1></center>


          <?php 
        do_action('__before_fp');
        $j = 1;
        for ($i = 1; $i <= $fp_nb; $i++) {
            printf('%1$s<div class="span%2$s fp-%3$s">%4$s</div>%5$s', 1 == $j ? '<div class="row widget-area" role="complementary">' : '', $span_value, $fp_ids[$i - 1], $this->tc_fp_single_display($fp_ids[$i - 1], $tc_show_featured_pages_img), $j == $fp_per_row || $i == $fp_nb ? '</div>' : '');
            //set $j back to start value if reach $fp_per_row
            $j++;
            $j = $j == $fp_per_row + 1 ? 1 : $j;
        }
        do_action('__after_fp');
        ?>

  			</div><!-- .container -->

        <?php 
        echo !tc__f('__is_home_empty') ? apply_filters('tc_after_fp_separator', '<hr class="featurette-divider ' . current_filter() . '">') : '';
        ?>

       <?php 
        $html = ob_get_contents();
        if ($html) {
            ob_end_clean();
        }
        echo apply_filters('tc_fp_block_display', $html, $args);
    }
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:67,代码来源:class-content-featured_pages.php

示例5: check_is_spam

 public static function check_is_spam($lead_data)
 {
     $api_key = Inbound_Akismet::get_api_key();
     /* return true if akismet is not setup */
     if (!$api_key) {
         return false;
     }
     $params = Inbound_Akismet::prepare_params($lead_data);
     $is_spam = Inbound_Akismet::api_check($params);
     /* if not spam return false */
     if (!$is_spam) {
         return false;
     }
     /* Discover which filter is calling the spam check and react to spam accordingly */
     switch (current_filter()) {
         /* Kill ajax script if inbound_store_lead_pre hook */
         case 'inbound_store_lead_pre':
             exit;
             break;
             /* Return true to prevent email actions if form_actions_spam_check hook */
         /* Return true to prevent email actions if form_actions_spam_check hook */
         case 'form_actions_spam_check':
             return true;
             break;
     }
 }
开发者ID:devilcranx,项目名称:landing-pages,代码行数:26,代码来源:class.inbound-forms.akismet.php

示例6: tc_single_post_thumbnail_view

        /**
         * Single post thumbnail view
         *
         * @package Customizr
         * @since Customizr 3.2.0
         */
        function tc_single_post_thumbnail_view()
        {
            $_exploded_location = explode('|', esc_attr(tc__f('__get_option', 'tc_single_post_thumb_location')));
            $_hook = isset($_exploded_location[0]) ? $_exploded_location[0] : '__before_content';
            $_size_to_request = '__before_main_wrapper' == $_hook ? 'slider-full' : 'slider';
            //get the thumbnail data (src, width, height) if any
            $thumb_data = TC_post_thumbnails::$instance->tc_get_thumbnail_data($_size_to_request);
            $_single_thumbnail_wrap_class = implode(" ", apply_filters('tc_single_post_thumb_class', array('row-fluid', 'tc-single-post-thumbnail-wrapper', current_filter())));
            ob_start();
            ?>
            <div class="<?php 
            echo $_single_thumbnail_wrap_class;
            ?>
">
              <?php 
            TC_post_thumbnails::$instance->tc_display_post_thumbnail($thumb_data, 'span12');
            ?>
            </div>
          <?php 
            $html = ob_get_contents();
            if ($html) {
                ob_end_clean();
            }
            echo apply_filters('tc_single_post_thumbnail_view', $html);
        }
开发者ID:Natedaug,项目名称:WordPressSites,代码行数:31,代码来源:class-content-post.php

示例7: badgeos_learndash_trigger_event

/**
 * Handle each of our LearnDash triggers
 *
 * @since 1.0.0
 */
function badgeos_learndash_trigger_event()
{
    // Setup all our important variables
    global $blog_id, $wpdb;
    // Setup args
    $args = func_get_args();
    $userID = get_current_user_id();
    if (is_array($args) && isset($args['user'])) {
        if (is_object($args['user'])) {
            $userID = (int) $args['user']->ID;
        } else {
            $userID = (int) $args['user'];
        }
    }
    if (empty($userID)) {
        return;
    }
    $user_data = get_user_by('id', $userID);
    if (empty($user_data)) {
        return;
    }
    // Grab the current trigger
    $this_trigger = current_filter();
    // Update hook count for this user
    $new_count = badgeos_update_user_trigger_count($userID, $this_trigger, $blog_id);
    // Mark the count in the log entry
    badgeos_post_log_entry(null, $userID, null, sprintf(__('%1$s triggered %2$s (%3$dx)', 'badgeos'), $user_data->user_login, $this_trigger, $new_count));
    // Now determine if any badges are earned based on this trigger event
    $triggered_achievements = $wpdb->get_results($wpdb->prepare("\n\t\tSELECT post_id\n\t\tFROM   {$wpdb->postmeta}\n\t\tWHERE  meta_key = '_badgeos_learndash_trigger'\n\t\t\t\tAND meta_value = %s\n\t\t", $this_trigger));
    foreach ($triggered_achievements as $achievement) {
        badgeos_maybe_award_achievement_to_user($achievement->post_id, $userID, $this_trigger, $blog_id, $args);
    }
}
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:38,代码来源:rules-engine.php

示例8: handle_comment_log

 public function handle_comment_log($comment_ID, $comment = null)
 {
     if (is_null($comment)) {
         $comment = get_comment($comment_ID);
     }
     $action = 'created';
     switch (current_filter()) {
         case 'wp_insert_comment':
             $action = 1 === (int) $comment->comment_approved ? 'approved' : 'pending';
             break;
         case 'edit_comment':
             $action = 'updated';
             break;
         case 'delete_comment':
             $action = 'deleted';
             break;
         case 'trash_comment':
             $action = 'trashed';
             break;
         case 'untrash_comment':
             $action = 'untrashed';
             break;
         case 'spam_comment':
             $action = 'spammed';
             break;
         case 'unspam_comment':
             $action = 'unspammed';
             break;
     }
     $this->_add_comment_log($comment_ID, $action, $comment);
 }
开发者ID:leogopal,项目名称:wordpress-aryo-activity-log,代码行数:31,代码来源:class-aal-hook-comments.php

示例9: do_hook

 static function do_hook()
 {
     global $wp_filter;
     $current_hook = current_filter();
     if (!isset(self::$hooks[$current_hook])) {
         return;
     }
     $hook = self::$hooks[$current_hook];
     $hook_args = func_get_args();
     if ('filter' == $hook['hook_type']) {
         $value = $hook_args[0];
     }
     if (has_filter($hook['old_hook'])) {
         self::_deprecated_hook($current_hook);
         if ('filter' == $hook['hook_type']) {
             $type = 'apply_filters';
         } else {
             $type = 'do_action';
         }
         $value = call_user_func_array($type, array_merge(array($hook['old_hook']), array_slice($hook_args, 0, $hook['args'])));
     }
     if ('filter' == $hook['hook_type']) {
         return $value;
     }
 }
开发者ID:kalushta,项目名称:darom,代码行数:25,代码来源:hook-deprecator.php

示例10: __construct

 /**
  * Primary class constructor.
  *
  * @since 2.0.0
  */
 public function __construct()
 {
     // Load the base class object.
     $this->base = Optin_Monster::get_instance();
     // Possibly prepare the preview customizer frame.
     add_action(current_filter(), array($this, 'maybe_prepare_preview'));
 }
开发者ID:venturepact,项目名称:blog,代码行数:12,代码来源:preview.php

示例11: mce_buttons

 /**
  * Filter TinyMCE buttons (Visual tab).
  *
  * @param  array $buttons
  *
  * @return array
  */
 public function mce_buttons(array $buttons = [])
 {
     if ($new = papi_to_array($this->get_setting(current_filter(), []))) {
         return $new;
     }
     return $buttons;
 }
开发者ID:wp-papi,项目名称:papi,代码行数:14,代码来源:class-papi-property-editor.php

示例12: show_selected_terminal

 /**
  * Outputs user selected Smartpost terminal in different locations (admin screen, email, orders)
  *
  * @param  mixed $order Order (ID or WC_Order)
  * @return void
  */
 function show_selected_terminal($order)
 {
     if ($order->has_shipping_method($this->id)) {
         // Fetch selected terminal ID
         $window_value = $this->get_order_terminal($order->id);
         $time_windows = $this->get_courier_time_windows();
         $window_name = isset($time_windows[$window_value]) ? $time_windows[$window_value] : reset($time_windows);
         // Output selected terminal to user customer details
         if (current_filter() == 'woocommerce_order_details_after_customer_details') {
             if (version_compare(WC_VERSION, '2.3.0', '<')) {
                 $terminal = '<dt>' . $this->i18n_selected_terminal . ':</dt>';
                 $terminal .= '<dd>' . $window_name . '</dd>';
             } else {
                 $terminal = '<tr>';
                 $terminal .= '<th>' . $this->i18n_selected_terminal . ':</th>';
                 $terminal .= '<td data-title="' . $this->i18n_selected_terminal . '">' . $window_name . '</td>';
                 $terminal .= '</tr>';
             }
         } elseif (current_filter() == 'woocommerce_email_customer_details') {
             $terminal = '<h2>' . $this->i18n_selected_terminal . '</h2>';
             $terminal .= '<p>' . $terminal_name . '</p>';
         } else {
             $terminal = '<div class="selected_terminal">';
             $terminal .= '<div><strong>' . $this->i18n_selected_terminal . '</strong></div>';
             $terminal .= $window_name;
             $terminal .= '</div>';
         }
         // Allow manipulating output
         echo apply_filters('wc_shipping_' . $this->id . '_selected_terminal', $terminal, $window_value, $window_name, current_filter());
     }
 }
开发者ID:KonektOU,项目名称:estonian-shipping-methods-for-woocommerce,代码行数:37,代码来源:class-wc-estonian-shipping-method-smartpost-courier.php

示例13: shortcode_route

 function shortcode_route()
 {
     if (!EPL_IS_ADMIN && 'the_content' == current_filter()) {
         $resource = 'epl_front';
         return $this->_route($resource);
     }
 }
开发者ID:Kemitestech,项目名称:WordPress-Skeleton,代码行数:7,代码来源:epl-router.php

示例14: register_buttons

 public static function register_buttons($buttons)
 {
     switch (current_filter()) {
         case 'mce_buttons':
             $cur_lvl = 1;
             break;
         case 'mce_buttons_2':
             $cur_lvl = 2;
             break;
         case 'mce_buttons_4':
             $cur_lvl = 4;
             break;
         default:
             $cur_lvl = 3;
     }
     // if there is no buttons for current level - return
     if (isset(self::$buttons[$cur_lvl])) {
         $cur_lvl_btns = self::$buttons[$cur_lvl];
     } else {
         return $buttons;
     }
     // add buttons
     foreach ($cur_lvl_btns as $plugin_name => $plugin_buttons) {
         $buttons = array_merge($buttons, $plugin_buttons);
     }
     return $buttons;
 }
开发者ID:scottnkerr,项目名称:eeco,代码行数:27,代码来源:class-register-button.php

示例15: bootswatch_hook_callback

/**
 * [bootswatch_hook_callback description]
 */
function bootswatch_hook_callback()
{
    $hook = preg_replace('/^bootswatch_/', '', current_filter());
    $content = TitanFramework::getInstance('bootswatch')->getOption($hook);
    printf('<div class="%s">%s</div>', 'bootswatch_' . $hook, do_shortcode($content));
    // WPCS: XSS OK.
}
开发者ID:kadimi,项目名称:bootswatch,代码行数:10,代码来源:hooks.php


注:本文中的current_filter函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。