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


PHP FLBuilderModel::get_asset_version方法代码示例

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


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

示例1: render_layout

 /**
  * Renders the layout to be passed back to
  * the builder via AJAX for an update.
  *
  * @since 1.0
  * @param bool $return Whether to return the layout or output it.
  * @return array|void The layout data or nothing.
  */
 public static function render_layout($return = false)
 {
     global $wp_scripts;
     global $wp_styles;
     // Render the assets.
     self::render_css();
     self::render_js();
     // Do the wp_enqueue_scripts action here to register any scripts or
     // styles that might need to be registered for shortcodes or widgets.
     ob_start();
     try {
         do_action('wp_enqueue_scripts');
     } catch (Exception $e) {
     }
     ob_end_clean();
     // Dequeue scripts and styles so we can capture only those
     // enqueued by shortcodes or widgets.
     if (isset($wp_scripts)) {
         $wp_scripts->queue = array();
     }
     if (isset($wp_styles)) {
         $wp_styles->queue = array();
     }
     // Render the layout.
     ob_start();
     self::render_nodes();
     $html = ob_get_clean();
     // Process shortcodes.
     ob_start();
     echo do_shortcode($html);
     $html = ob_get_clean();
     // Print scripts and styles enqueued by shortcodes or widgets.
     ob_start();
     if (isset($wp_scripts)) {
         $wp_scripts->done[] = 'jquery';
         wp_print_scripts($wp_scripts->queue);
     }
     if (isset($wp_styles)) {
         wp_print_styles($wp_styles->queue);
     }
     $html = ob_get_clean() . $html;
     // Get the asset info.
     $asset_info = FLBuilderModel::get_asset_info();
     $asset_ver = FLBuilderModel::get_asset_version();
     // Build the response.
     $response = array('html' => $html, 'css' => $asset_info['css_url'] . '?ver=' . $asset_ver, 'js' => $asset_info['js_url'] . '?ver=' . $asset_ver);
     // Return or echo the response.
     if ($return) {
         return $response;
     } else {
         echo json_encode($response);
         die;
     }
 }
开发者ID:komcdo,项目名称:iSSNA-WordPress,代码行数:62,代码来源:class-fl-builder.php

示例2: render_assets

 /**
  * Renders the assets for the layout or a node.
  *
  * @since 1.7
  * @access private
  * @return array
  */
 private static function render_assets()
 {
     $partial_refresh_data = self::get_partial_refresh_data();
     $asset_info = FLBuilderModel::get_asset_info();
     $asset_ver = FLBuilderModel::get_asset_version();
     $assets = array('js' => '', 'css' => '');
     // Render the JS.
     if ($partial_refresh_data['is_partial_refresh']) {
         if (!class_exists('FLJSMin')) {
             include FL_BUILDER_DIR . 'classes/class-fl-jsmin.php';
         }
         switch ($partial_refresh_data['node']->type) {
             case 'row':
                 $assets['js'] = FLBuilder::render_row_js($partial_refresh_data['node']);
                 $assets['js'] .= FLBuilder::render_row_modules_js($partial_refresh_data['node']);
                 break;
             case 'column':
                 $assets['js'] = FLBuilder::render_column_modules_js($partial_refresh_data['node']);
                 break;
             case 'module':
                 $assets['js'] = FLBuilder::render_module_js($partial_refresh_data['node']);
                 break;
         }
         $assets['js'] .= 'FLBuilder._renderLayoutComplete();';
         $assets['js'] = FLJSMin::minify($assets['js']);
     } else {
         $assets['js'] = $asset_info['js_url'] . '?ver=' . $asset_ver;
     }
     // Render the CSS.
     $assets['css'] = $asset_info['css_url'] . '?ver=' . $asset_ver;
     // Return the assets.
     return $assets;
 }
开发者ID:onedaylabs,项目名称:onedaylabs.com,代码行数:40,代码来源:class-fl-builder-ajax-layout.php

示例3: enqueue_layout_styles_scripts

 /**
  * Enqueue the styles and scripts for a single layout.
  *
  * @since 1.0
  * @param int $post_id The post ID for this layout.
  * @return void
  */
 public static function enqueue_layout_styles_scripts($post_id)
 {
     if (FLBuilderModel::is_builder_enabled()) {
         $nodes = FLBuilderModel::get_categorized_nodes();
         $asset_info = FLBuilderModel::get_asset_info();
         $asset_ver = FLBuilderModel::get_asset_version();
         // Enqueue required row CSS and JS
         foreach ($nodes['rows'] as $row) {
             if ($row->settings->bg_type == 'slideshow') {
                 wp_enqueue_script('yui3');
                 wp_enqueue_script('fl-slideshow');
                 wp_enqueue_style('fl-slideshow');
             } else {
                 if ($row->settings->bg_type == 'video') {
                     wp_enqueue_script('jquery-imagesloaded');
                 }
             }
         }
         // Enqueue required module CSS and JS
         foreach ($nodes['modules'] as $module) {
             $module->enqueue_icon_styles();
             $module->enqueue_font_styles();
             $module->enqueue_scripts();
             foreach ($module->css as $handle => $props) {
                 wp_enqueue_style($handle, $props[0], $props[1], $props[2], $props[3]);
             }
             foreach ($module->js as $handle => $props) {
                 wp_enqueue_script($handle, $props[0], $props[1], $props[2], $props[3]);
             }
             if (!empty($module->settings->animation)) {
                 wp_enqueue_script('jquery-waypoints');
             }
         }
         // Enqueue main CSS
         if (!file_exists($asset_info['css']) || defined('WP_DEBUG') && WP_DEBUG) {
             FLBuilder::render_css();
         }
         $deps = apply_filters('fl_builder_layout_style_dependencies', array());
         $media = apply_filters('fl_builder_layout_style_media', 'all');
         wp_enqueue_style('fl-builder-layout-' . $post_id, $asset_info['css_url'], $deps, $asset_ver, $media);
         // Enqueue Google Fonts
         FLBuilderFonts::enqueue_styles();
         // Enqueue main JS
         if (!file_exists($asset_info['js']) || defined('WP_DEBUG') && WP_DEBUG) {
             FLBuilder::render_js();
         }
         wp_enqueue_script('fl-builder-layout-' . $post_id, $asset_info['js_url'], array('jquery'), $asset_ver, true);
     }
 }
开发者ID:Nirajjcu,项目名称:minime3d,代码行数:56,代码来源:class-fl-builder.php


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