本文整理汇总了PHP中FLBuilder::render_js方法的典型用法代码示例。如果您正苦于以下问题:PHP FLBuilder::render_js方法的具体用法?PHP FLBuilder::render_js怎么用?PHP FLBuilder::render_js使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLBuilder
的用法示例。
在下文中一共展示了FLBuilder::render_js方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'])) {
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'])) {
FLBuilder::render_js();
}
wp_enqueue_script('fl-builder-layout-' . $post_id, $asset_info['js_url'], array('jquery'), $asset_ver, true);
}
}
示例2: save_settings
/**
* Save the settings for a node.
*
* @since 1.0
* @param string $node_id The node ID.
* @param object $settings The settings to save.
* @return void
*/
public static function save_settings($node_id = null, $settings = null)
{
$post_data = self::get_post_data();
$node_id = isset($post_data['node_id']) ? $post_data['node_id'] : $node_id;
$settings = isset($post_data['settings']) ? $post_data['settings'] : $settings;
$node = self::get_node($node_id);
$new_settings = (object) array_merge((array) $node->settings, (array) $settings);
// Process the settings.
$new_settings = self::process_node_settings($node, $new_settings);
// Save the settings to the node.
$data = self::get_layout_data();
$data[$node_id]->settings = $new_settings;
// Update the layout data.
self::update_layout_data($data);
// Return the new layout.
if (defined('DOING_AJAX')) {
FLBuilder::render_css();
FLBuilder::render_js();
FLBuilder::render_layout();
}
}