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


PHP current_action函数代码示例

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


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

示例1: testGetCorrectAction

 /**
  * @param Request $request
  * @param         $result
  *
  * @dataProvider provideGetActionTestData
  */
 public function testGetCorrectAction(Request $request, $result)
 {
     app(HttpKernelContract::class)->handle($request);
     $this->assertSame($result, \Active::getAction());
     $this->assertSame($result, app('active')->getAction());
     $this->assertSame($result, current_action());
 }
开发者ID:hilltool,项目名称:active,代码行数:13,代码来源:ActiveTest.php

示例2: build_page

        public static function build_page()
        {
            $page_hook = current_action();
            $page_attr = array_key_exists($page_hook, self::$pages['parent']) ? self::$pages['parent'][$page_hook] : self::$pages['child'][$page_hook];
            $page_content = is_array($page_attr['function']) ? $page_attr['function'][0] . '::' . $page_attr['function'][1] : $page_attr['function'];
            ?>
			<div id = "<?php 
            echo $page_attr['menu_slug'];
            ?>
" class="cherry-page-wrapper">
		<?php 
            if ($page_attr['page_title']) {
                ?>
				<div class="cherry-page-title">
					<span><?php 
                echo $page_attr['page_title'];
                ?>
</span>
				</div>
		<?php 
            }
            echo $page_attr['before_content'];
            ?>
				<div class="cherry-page-content cherry-ui-core">
					<?php 
            call_user_func($page_content);
            ?>
				</div>
			</div>
			<?php 
            echo $page_attr['after_content'];
        }
开发者ID:roberto-alarcon,项目名称:Neuroglobal,代码行数:32,代码来源:class-cherry-page-builder.php

示例3: popmake_render_popup_theme_styles

function popmake_render_popup_theme_styles()
{
    if (current_action() == 'wp_head' && popmake_get_option('disable_popup_theme_styles', false) || current_action() == 'admin_head' && !popmake_is_admin_popup_page()) {
        return;
    }
    $styles = get_transient('popmake_theme_styles');
    if (!$styles) {
        $styles = '';
        $google_fonts = array();
        foreach (popmake_get_all_popup_themes() as $theme) {
            $theme_styles = popmake_render_theme_styles($theme->ID);
            $google_fonts = array_merge($google_fonts, popmake_get_popup_theme_google_fonts($theme->ID));
            if ($theme_styles != '') {
                $styles .= "/* Popup Theme " . $theme->ID . ": " . $theme->post_title . " */\r\n";
                $styles .= $theme_styles;
            }
        }
        if (!empty($google_fonts)) {
            $link = "//fonts.googleapis.com/css?family=";
            foreach ($google_fonts as $font_family => $variants) {
                if ($link != "//fonts.googleapis.com/css?family=") {
                    $link .= "|";
                }
                $link .= $font_family;
                if (!empty($variants)) {
                    $link .= ":";
                    $link .= implode(',', $variants);
                }
            }
            $styles = "/* Popup Google Fonts */\r\n@import url('{$link}');\r\n\r\n" . $styles;
        }
        set_transient('popmake_theme_styles', $styles, 7 * DAY_IN_SECONDS);
    }
    echo '<style id="popup-maker-themes"  type="text/css">' . $styles . '</style>';
}
开发者ID:jin-2,项目名称:wp-content,代码行数:35,代码来源:scripts.php

示例4: popmake_gforms_force_ajax

function popmake_gforms_force_ajax()
{
    if (current_action() == 'popmake_popup_before_inner') {
        add_filter('shortcode_atts_gravityforms', 'popmake_force_gforms_ajax');
    }
    if (current_action() == 'popmake_popup_after_inner') {
        remove_filter('shortcode_atts_gravityforms', 'popmake_force_gforms_ajax');
    }
}
开发者ID:raminabsari,项目名称:phonicsschool,代码行数:9,代码来源:gravityforms.php

示例5: action_noop

 /**
  * Proxy "noop" for the WordPress Action API.
  *
  * @param mixed This function may be called on an action.
  *
  * @return void|mixed
  */
 public function action_noop()
 {
     $action = current_action();
     $args = func_get_args();
     $this->noop('action', $action);
     if (count($args)) {
         return reset($args);
     }
 }
开发者ID:locomotivemtl,项目名称:wordpress-boilerplate,代码行数:16,代码来源:page.php

示例6: __construct

 public function __construct()
 {
     parent::__construct();
     view()->share('current_action', 'forum-forum-covers-' . current_action());
     $this->middleware('auth', ['only' => ['destroy', 'store', 'update']]);
     if (Auth::check() === true && Auth::user()->isAdmin() !== true) {
         abort(403);
     }
 }
开发者ID:nanaya,项目名称:osu-web,代码行数:9,代码来源:ForumCoversController.php

示例7: enqueueScripts

 /**
  * Enqueue assets.
  */
 public function enqueueScripts()
 {
     if (current_action() === 'login_enqueue_scripts') {
         $root = $this->container->getRoot();
         $root->get('services.js_manager')->load();
         $root->get('controller.front')->enqueueScripts();
         $root->get('services.css_manager')->load();
         $root->get('controller.front')->enqueueStyles();
     }
     wp_enqueue_script($this->container->getSlug() . '_loginButton');
 }
开发者ID:facebook-awd,项目名称:connect,代码行数:14,代码来源:LoginButtonController.php

示例8: __construct

 public function __construct()
 {
     parent::__construct();
     view()->share('current_action', 'forum-forum-covers-' . current_action());
     $this->middleware('auth', ['only' => ['destroy', 'store', 'update']]);
     $this->middleware(function ($request, $next) {
         if (Auth::check() && !Auth::user()->isAdmin()) {
             abort(403);
         }
         return $next($request);
     });
 }
开发者ID:ppy,项目名称:osu-web,代码行数:12,代码来源:ForumCoversController.php

示例9: update_tax_children_option

 public function update_tax_children_option($taxonomy_input = false)
 {
     global $wpml_language_resolution, $wp_taxonomies;
     $language_codes = $wpml_language_resolution->get_active_language_codes();
     $language_codes[] = 'all';
     $taxonomy = str_replace(array('create_', 'edit_'), '', current_action());
     $taxonomy = isset($wp_taxonomies[$taxonomy]) ? $taxonomy : $taxonomy_input;
     foreach ($language_codes as $lang) {
         $tax_children = $this->get_tax_hier_array($taxonomy, $lang);
         $option_key = "{$taxonomy}_children_{$lang}";
         update_option($option_key, $tax_children);
     }
 }
开发者ID:edgarter,项目名称:wecare,代码行数:13,代码来源:wpml-term-filters.class.php

示例10: add_tab_to_screen

 /**
  * Adds tabs to screen on 'load-' . $tab['page']
  *
  * Loops through all tabs and adds them on the appropriate screen
  */
 static function add_tab_to_screen()
 {
     $id = substr(current_action(), 5);
     $tabs = self::$tabs_by_page[$id];
     foreach ((array) $tabs as $tab) {
         // if post type arg is set, check the post type - if not same return
         if (isset($tab['args']['post_type'])) {
             if (!self::is_current_post_type($tab)) {
                 continue;
             }
         }
         $callback = !empty($tab['args']['callback']) ? $tab['args']['callback'] : array(__CLASS__, 'echo_tab_html');
         get_current_screen()->add_help_tab(array('id' => $tab['id'], 'title' => $tab['title'], 'callback' => $callback));
     }
 }
开发者ID:voceconnect,项目名称:wp-contextual-help,代码行数:20,代码来源:wp-contextual-help.php

示例11: purge_browser_cookie

 /**
  * Clear the authentication cookies.
  *
  * @param array|string $cookie The current authentication cookie.
  */
 public static function purge_browser_cookie($cookie)
 {
     // Remove the action to prevent recursion with some plugins (notably s2member)
     remove_action(current_action(), array(__CLASS__, __FUNCTION__));
     /*
      * Sometimes the cookie is empty because WordPress uses multiple types of auth cookies.
      * When one of the cookies is empty, we don't want to purge the cookies because other
      * cookies may have us legitimately logged in *and* empty cookies (e.g., unset) aren't
      * doing the cache-busting that prompts us to want to purge.
      */
     if (empty($cookie)) {
         return;
     }
     wp_clear_auth_cookie();
 }
开发者ID:TRPmarketingsite,项目名称:marketingsite,代码行数:20,代码来源:class.cookies.php

示例12: request

 public function request()
 {
     $data = $_POST;
     if (!isset($data['nonce'])) {
         wp_send_json_error(__('Missing nonce.', 'customizer-definitely'));
     }
     if (!check_ajax_referer('wpcd-customize-preprocess', 'nonce', false)) {
         wp_send_json_error(__('Invalid nonce.', 'customizer-definitely'));
     }
     $method_name = str_replace('-', '_', str_replace('wp_ajax_wpcd-', '', current_action()));
     if (!method_exists($this, $method_name)) {
         wp_send_json_error(__('Invalid action.', 'customizer-definitely'));
     }
     $response = $this->{$method_name}($data);
     if (is_wp_error($response)) {
         wp_send_json_error($response->get_error_message());
     }
     wp_send_json_success($response);
 }
开发者ID:felixarntz,项目名称:customizer-definitely,代码行数:19,代码来源:AJAX.php

示例13: popmake_render_popup_theme_styles

function popmake_render_popup_theme_styles()
{
    if (current_action() == 'wp_head' && popmake_get_option('disable_popup_theme_styles', false) || current_action() == 'admin_head' && !popmake_is_admin_popup_page()) {
        return;
    }
    $styles = get_transient('popmake_theme_styles');
    if (!$styles) {
        $styles = '';
        foreach (popmake_get_all_popup_themes() as $theme) {
            $theme_styles = popmake_render_theme_styles($theme->ID);
            if ($theme_styles != '') {
                $styles .= "/* Popup Theme " . $theme->ID . ": " . $theme->post_title . " */\r\n";
                $styles .= $theme_styles;
            }
        }
        set_transient('popmake_theme_styles', $styles, 7 * DAY_IN_SECONDS);
    }
    //	echo '<style id="popup-maker-themes"  type="text/css">' . $styles . '</style>';
}
开发者ID:raminabsari,项目名称:phonicsschool,代码行数:19,代码来源:scripts.php

示例14: trash_related_posts

 /**
  * Trashes all related posts.
  *
  * @since   3.0.0
  * @wp-hook wp_trash_post
  *
  * @param int $post_id Post ID.
  *
  * @return int The number of related posts trashed.
  */
 public function trash_related_posts($post_id)
 {
     if (!$this->setting_repository->get($post_id)) {
         return 0;
     }
     $current_site_id = get_current_blog_id();
     $related_posts = $this->content_relations->get_relations($current_site_id, $post_id, 'post');
     unset($related_posts[$current_site_id]);
     if (!$related_posts) {
         return 0;
     }
     $trashed_post = 0;
     // Temporarily remove the function to avoid recursion.
     $action = current_action();
     remove_action($action, [$this, __FUNCTION__]);
     array_walk($related_posts, function ($post_id, $site_id) use(&$trashed_post) {
         switch_to_blog($site_id);
         $trashed_post += (bool) wp_trash_post($post_id);
         restore_current_blog();
     });
     // Add the function back again.
     add_action($action, [$this, __FUNCTION__]);
     return $trashed_post;
 }
开发者ID:inpsyde,项目名称:multilingual-press,代码行数:34,代码来源:Trasher.php

示例15: switch_theme

/**
 * Switches the theme.
 *
 * Accepts one argument: $stylesheet of the theme. It also accepts an additional function signature
 * of two arguments: $template then $stylesheet. This is for backwards compatibility.
 *
 * @since 2.5.0
 *
 * @global array                $wp_theme_directories
 * @global WP_Customize_Manager $wp_customize
 * @global array                $sidebars_widgets
 *
 * @param string $stylesheet Stylesheet name
 */
function switch_theme($stylesheet)
{
    global $wp_theme_directories, $wp_customize, $sidebars_widgets;
    $_sidebars_widgets = null;
    if ('wp_ajax_customize_save' === current_action()) {
        $_sidebars_widgets = $wp_customize->post_value($wp_customize->get_setting('old_sidebars_widgets_data'));
    } elseif (is_array($sidebars_widgets)) {
        $_sidebars_widgets = $sidebars_widgets;
    }
    if (is_array($_sidebars_widgets)) {
        set_theme_mod('sidebars_widgets', array('time' => time(), 'data' => $_sidebars_widgets));
    }
    $nav_menu_locations = get_theme_mod('nav_menu_locations');
    if (func_num_args() > 1) {
        $stylesheet = func_get_arg(1);
    }
    $old_theme = wp_get_theme();
    $new_theme = wp_get_theme($stylesheet);
    $template = $new_theme->get_template();
    update_option('template', $template);
    update_option('stylesheet', $stylesheet);
    if (count($wp_theme_directories) > 1) {
        update_option('template_root', get_raw_theme_root($template, true));
        update_option('stylesheet_root', get_raw_theme_root($stylesheet, true));
    } else {
        delete_option('template_root');
        delete_option('stylesheet_root');
    }
    $new_name = $new_theme->get('Name');
    update_option('current_theme', $new_name);
    // Migrate from the old mods_{name} option to theme_mods_{slug}.
    if (is_admin() && false === get_option('theme_mods_' . $stylesheet)) {
        $default_theme_mods = (array) get_option('mods_' . $new_name);
        if (!empty($nav_menu_locations) && empty($default_theme_mods['nav_menu_locations'])) {
            $default_theme_mods['nav_menu_locations'] = $nav_menu_locations;
        }
        add_option("theme_mods_{$stylesheet}", $default_theme_mods);
    } else {
        /*
         * Since retrieve_widgets() is called when initializing a theme in the Customizer,
         * we need to to remove the theme mods to avoid overwriting changes made via
         * the Customizer when accessing wp-admin/widgets.php.
         */
        if ('wp_ajax_customize_save' === current_action()) {
            remove_theme_mod('sidebars_widgets');
        }
        if (!empty($nav_menu_locations)) {
            $nav_mods = get_theme_mod('nav_menu_locations');
            if (empty($nav_mods)) {
                set_theme_mod('nav_menu_locations', $nav_menu_locations);
            }
        }
    }
    update_option('theme_switched', $old_theme->get_stylesheet());
    /**
     * Fires after the theme is switched.
     *
     * @since 1.5.0
     *
     * @param string   $new_name  Name of the new theme.
     * @param WP_Theme $new_theme WP_Theme instance of the new theme.
     */
    do_action('switch_theme', $new_name, $new_theme);
}
开发者ID:renanmpimentel,项目名称:WordPress,代码行数:78,代码来源:theme.php


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