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


PHP FLBuilder::enqueue_layout_styles_scripts方法代码示例

本文整理汇总了PHP中FLBuilder::enqueue_layout_styles_scripts方法的典型用法代码示例。如果您正苦于以下问题:PHP FLBuilder::enqueue_layout_styles_scripts方法的具体用法?PHP FLBuilder::enqueue_layout_styles_scripts怎么用?PHP FLBuilder::enqueue_layout_styles_scripts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FLBuilder的用法示例。


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

示例1: insertPages_handleShortcode_insert

        function insertPages_handleShortcode_insert($atts, $content = null)
        {
            global $wp_query, $post, $wp_current_filter;
            extract(shortcode_atts(array('page' => '0', 'display' => 'all', 'class' => '', 'inline' => false), $atts));
            // Get options set in WordPress dashboard (Settings > Insert Pages).
            $options = get_option('wpip_settings');
            if ($options === FALSE) {
                $options = wpip_set_defaults();
            }
            // Validation checks.
            if ($page === '0') {
                return $content;
            }
            // Trying to embed same page in itself.
            if ($page == $post->ID || $page == $post->post_name) {
                return $content;
            }
            $should_apply_nesting_check = true;
            /**
             * Filter the flag indicating whether to apply deep nesting check
             * that can prevent circular loops. Note that some use cases rely
             * on inserting pages that themselves have inserted pages, so this
             * check should be disabled for those individuals.
             *
             * @param bool $apply_the_content_filter Indicates whether to apply the_content filter.
             */
            $should_apply_nesting_check = apply_filters('insert_pages_apply_nesting_check', $should_apply_nesting_check);
            // Don't allow inserted pages to be added to the_content more than once (prevent infinite loops).
            if ($should_apply_nesting_check) {
                $done = false;
                foreach ($wp_current_filter as $filter) {
                    if ('the_content' == $filter) {
                        if ($done) {
                            return $content;
                        } else {
                            $done = true;
                        }
                    }
                }
            }
            // Convert slugs to page IDs to standardize query_posts() lookup below.
            if (!is_numeric($page)) {
                $page_object = get_page_by_path($page, OBJECT, get_post_types());
                $page = $page_object ? $page_object->ID : $page;
            }
            if (is_numeric($page)) {
                $args = array('p' => intval($page), 'post_type' => get_post_types());
            } else {
                $args = array('name' => esc_attr($page), 'post_type' => get_post_types());
            }
            query_posts($args);
            $should_apply_the_content_filter = true;
            /**
             * Filter the flag indicating whether to apply the_content filter to post
             * contents and excerpts that are being inserted.
             *
             * @param bool $apply_the_content_filter Indicates whether to apply the_content filter.
             */
            $should_apply_the_content_filter = apply_filters('insert_pages_apply_the_content_filter', $should_apply_the_content_filter);
            $should_use_inline_wrapper = $inline !== false && $inline !== 'false' || array_search('inline', $atts) === 0 || array_key_exists('wpip_wrapper', $options) && $options['wpip_wrapper'] === 'inline';
            /**
             * Filter the flag indicating whether to wrap the inserted content in inline tags (span).
             *
             * @param bool $use_inline_wrapper Indicates whether to wrap the content in span tags.
             */
            $should_use_inline_wrapper = apply_filters('insert_pages_use_inline_wrapper', $should_use_inline_wrapper);
            // Disable the_content filter if using inline tags, since wpautop
            // inserts p tags and we can't have any inside inline elements.
            if ($should_use_inline_wrapper) {
                $should_apply_the_content_filter = false;
            }
            // Start our new Loop (only iterate once).
            if (have_posts()) {
                ob_start();
                // Start output buffering so we can save the output to string
                // If Beaver Builder plugin is enabled, load any cached styles associated with the inserted page.
                // Note: Temporarily set the global $post->ID to the inserted page ID,
                // since Beaver Builder relies on it to load the appropraite styles.
                if (class_exists('FLBuilder')) {
                    $old_post_id = $post->ID;
                    $post->ID = $page;
                    FLBuilder::enqueue_layout_styles_scripts($page);
                    $post->ID = $old_post_id;
                }
                // Show either the title, link, content, everything, or everything via a custom template
                // Note: if the sharing_display filter exists, it means Jetpack is installed and Sharing is enabled;
                // This plugin conflicts with Sharing, because Sharing assumes the_content and the_excerpt filters
                // are only getting called once. The fix here is to disable processing of filters on the_content in
                // the inserted page. @see https://codex.wordpress.org/Function_Reference/the_content#Alternative_Usage
                switch ($display) {
                    case "title":
                        the_post();
                        $title_tag = $should_use_inline_wrapper ? 'span' : 'h1';
                        echo "<{$title_tag} class='insert-page-title'>";
                        the_title();
                        echo "</{$title_tag}>";
                        break;
                    case "link":
                        the_post();
                        ?>
//.........这里部分代码省略.........
开发者ID:heiglandreas,项目名称:insert-pages,代码行数:101,代码来源:insert-pages.php

示例2: insertPages_handleShortcode_insert


//.........这里部分代码省略.........
            } else {
                $inserted_page = get_post(intval($attributes['page']));
            }
            // Use "Normal" insert method (get_post()).
            if ($options['wpip_insert_method'] !== 'legacy') {
                // If we couldn't retrieve the page, fire the filter hook showing a not-found message.
                if ($inserted_page === null) {
                    /**
                     * Filter the html that should be displayed if an inserted page was not found.
                     *
                     * @param string $content html to be displayed. Defaults to an empty string.
                     */
                    $content = apply_filters('insert_pages_not_found_message', $content);
                    // Short-circuit since we didn't find the page.
                    return $content;
                }
                // Start output buffering so we can save the output to a string.
                ob_start();
                // If Beaver Builder plugin is enabled, load any cached styles associated with the inserted page.
                // Note: Temporarily set the global $post->ID to the inserted page ID,
                // since Beaver Builder relies on it to load the appropriate styles.
                if (class_exists('FLBuilder')) {
                    // If we're not in The Loop (i.e., global $post isn't assigned),
                    // temporarily populate it with the post to be inserted so we can
                    // retrieve Beaver Builder styles for that post. Reset $post to null
                    // after we're done.
                    if (is_null($post)) {
                        $old_post_id = null;
                        $post = $inserted_page;
                    } else {
                        $old_post_id = $post->ID;
                        $post->ID = $inserted_page->ID;
                    }
                    FLBuilder::enqueue_layout_styles_scripts($inserted_page->ID);
                    if (is_null($old_post_id)) {
                        $post = null;
                    } else {
                        $post->ID = $old_post_id;
                    }
                }
                // Show either the title, link, content, everything, or everything via a custom template
                // Note: if the sharing_display filter exists, it means Jetpack is installed and Sharing is enabled;
                // This plugin conflicts with Sharing, because Sharing assumes the_content and the_excerpt filters
                // are only getting called once. The fix here is to disable processing of filters on the_content in
                // the inserted page. @see https://codex.wordpress.org/Function_Reference/the_content#Alternative_Usage
                switch ($attributes['display']) {
                    case "title":
                        $title_tag = $attributes['inline'] ? 'span' : 'h1';
                        echo "<{$title_tag} class='insert-page-title'>";
                        echo get_the_title($inserted_page->ID);
                        echo "</{$title_tag}>";
                        break;
                    case "link":
                        ?>
<a href="<?php 
                        echo esc_url(get_permalink($inserted_page->ID));
                        ?>
"><?php 
                        echo get_the_title($inserted_page->ID);
                        ?>
</a><?php 
                        break;
                    case "excerpt":
                        ?>
<h1><a href="<?php 
                        echo esc_url(get_permalink($inserted_page->ID));
开发者ID:StudentLifeMarketingAndDesign,项目名称:krui-wp,代码行数:67,代码来源:insert-pages.php

示例3: filterContentTemplateOutput

 public function filterContentTemplateOutput($content, $template_selected, $id, $kind)
 {
     if ($template_selected && $template_selected > 0) {
         // There is a CT applied, either on single/archive pages or on a wpv-post-body shortcode
         // Render the BB content of the CT, if any, and prevent Beaver from overwriting it
         $editor_choice = get_post_meta($template_selected, $this->medium->getOptionNameEditorChoice(), true);
         if ($editor_choice && $editor_choice == $this->editor->getId()) {
             FLBuilderModel::update_post_data('post_id', $template_selected);
             $this->beaver_post_id_stack[] = $template_selected;
             $content = FLBuilder::render_content($content);
             if (!in_array($template_selected, $this->beaver_post_id_assets_rendered)) {
                 FLBuilder::enqueue_layout_styles_scripts();
                 $this->beaver_post_id_assets_rendered[] = $template_selected;
             }
             array_pop($this->beaver_post_id_stack);
             if (count($this->beaver_post_id_stack) > 0) {
                 $aux_array = array_slice($this->beaver_post_id_stack, -1);
                 $bb_post_id = array_pop($aux_array);
                 FLBuilderModel::update_post_data('post_id', $bb_post_id);
             } else {
                 FLBuilderModel::update_post_data('post_id', get_the_ID());
             }
         }
         remove_filter('the_content', 'FLBuilder::render_content');
         $this->beaver_filter_enabled = false;
     } else {
         global $post;
         if (isset($post->view_template_override)) {
             $this_id = get_the_ID();
             // This is coming from a wpv-post-body shortcode with view_template="None" so we do need to apply BB here
             FLBuilderModel::update_post_data('post_id', $this_id);
             $this->beaver_post_id_stack[] = $this_id;
             $content = FLBuilder::render_content($content);
             if (!in_array($template_selected, $this->beaver_post_id_assets_rendered)) {
                 //FLBuilder::enqueue_layout_styles_scripts();
                 $this->beaver_post_id_assets_rendered[] = $this_id;
             }
             array_pop($this->beaver_post_id_stack);
             if (count($this->beaver_post_id_stack) > 0) {
                 $aux_array = array_slice($this->beaver_post_id_stack, -1);
                 $bb_post_id = array_pop($aux_array);
                 FLBuilderModel::update_post_data('post_id', $bb_post_id);
             }
         }
     }
     return $content;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:47,代码来源:frontend.php


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