本文整理汇总了PHP中FLBuilderModel类的典型用法代码示例。如果您正苦于以下问题:PHP FLBuilderModel类的具体用法?PHP FLBuilderModel怎么用?PHP FLBuilderModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FLBuilderModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert_layout
/**
* Renders a layout with the provided post ID and enqueues the
* necessary styles and scripts.
*
* @since 1.7
* @param array $attrs The shortcode attributes.
* @return string
*/
public static function insert_layout($attrs)
{
$builder_active = in_the_loop() && FLBuilderModel::is_builder_active();
$post_type = isset($attrs['type']) ? $attrs['type'] : get_post_types();
$args = array('post_type' => $post_type, 'posts_per_page' => -1);
// Build the args array.
if (isset($attrs['id'])) {
$args['orderby'] = 'post__in';
if (is_numeric($attrs['id'])) {
$args['post__in'] = array($attrs['id']);
} else {
$args['post__in'] = explode(',', $attrs['id']);
}
} else {
if (isset($attrs['slug'])) {
$args['orderby'] = 'name';
$args['name'] = $attrs['slug'];
} else {
return;
}
}
// Render and return the layout.
ob_start();
if ($builder_active) {
echo '<div class="fl-builder-shortcode-mask-wrap"><div class="fl-builder-shortcode-mask"></div>';
}
FLBuilder::render_query($args);
if ($builder_active) {
echo '</div>';
}
return ob_get_clean();
}
示例2: submit
/**
* Called via AJAX to submit the subscribe form.
*
* @since 1.5.2
* @return string The JSON encoded response.
*/
public function submit()
{
$name = isset($_POST['name']) ? sanitize_text_field($_POST['name']) : false;
$email = isset($_POST['email']) ? sanitize_email($_POST['email']) : false;
$node_id = isset($_POST['node_id']) ? sanitize_text_field($_POST['node_id']) : false;
$result = array('action' => false, 'error' => false, 'message' => false, 'url' => false);
if ($email && $node_id) {
$module = FLBuilderModel::get_module($node_id);
$settings = $module->settings;
// Subscribe.
$instance = FLBuilderServices::get_service_instance($settings->service);
$response = $instance->subscribe($settings, $email, $name);
// Check for an error from the service.
if ($response['error']) {
$result['error'] = $response['error'];
} else {
$result['action'] = $settings->success_action;
if ('message' == $settings->success_action) {
$result['message'] = $settings->success_message;
} else {
$result['url'] = $settings->success_url;
}
}
} else {
$result['error'] = __('There was an error subscribing. Please try again.', 'fl-builder');
}
echo json_encode($result);
die;
}
示例3: brj_enqueue_minimap
function brj_enqueue_minimap()
{
if (is_user_logged_in() && class_exists('FLBuilderModel') && FLBuilderModel::is_builder_active()) {
wp_enqueue_script('bb-minimap', plugins_url('bb-minimap.js', __FILE__), array('jquery', 'wp-util'));
wp_enqueue_style('bb-minimap', plugins_url('css/bb-minimap.css', __FILE__));
}
}
示例4: receptar_bb_assets
function receptar_bb_assets()
{
//Styles
if (class_exists('FLBuilderModel') && FLBuilderModel::is_builder_active()) {
wp_enqueue_style('receptar-bb-addon', receptar_get_stylesheet_directory_uri('css/beaver-builder-editor.css'), false, esc_attr(trim(wp_get_theme()->get('Version'))), 'screen');
}
}
示例5: get_items
function get_items($request)
{
$templates = array();
$user_templates = get_posts(array('post_type' => 'fl-builder-template', 'orderby' => 'menu_order title', 'order' => 'ASC', 'posts_per_page' => -1, 'fl-builder-template-type' => 'layout'));
//$user_templates = FLBuilderModel::get_user_templates();
if (!empty($user_templates)) {
foreach ($user_templates as $post) {
$layout = get_post_meta($post->ID, '_fl_builder_data', true);
if ($layout) {
$categories = get_post_meta($post->ID, 'template_categories', true);
if (empty($categories)) {
$categories = array('saved');
}
$templates[] = array('handle' => $post->ID, 'label' => $post->post_title, 'description' => $post->post_excerpt, 'author' => $post->post_author, 'modified' => $post->post_modified, 'edit_link' => FLBuilderModel::get_edit_url($post->ID), 'categories' => $categories, 'type' => 'user', 'is_global' => get_post_meta($post->ID, '_fl_builder_template_global', true), 'is_editable' => true);
}
}
}
$template_data = FLBuilderModel::get_templates();
if (!empty($template_data)) {
foreach ($template_data as $data) {
$templates[] = array('handle' => $data->index, 'label' => $data->name, 'screenshot' => array('thumbnail' => FL_BUILDER_URL . 'img/templates/' . $data->image), 'author' => array('name' => 'Beaver Builder Team'), 'categories' => array($data->category), 'is_premium' => $data->premium, 'is_builtin' => true, 'type' => 'core');
}
}
$response = rest_ensure_response($templates);
return $response;
}
示例6: print_custom_css
function print_custom_css()
{
$fields = self::get_color_fields();
$settings = FLBuilderModel::get_global_settings();
print "<style id='bb-ui-theme-custom'>\n";
foreach ($fields as $name => $field) {
$color = '#' . $settings->{$name};
$properties = $field['properties'];
$selectors = $field['selectors'];
foreach ($selectors as $selector) {
print $selector . "{\n";
foreach ($properties as $property) {
print $property . " : " . $color;
}
print "}\n";
}
}
?>
body .fl-builder-blocks-section .fl-builder-blocks-section-title:hover,
body .fl-builder-blocks-section .fl-builder-blocks-section-title:hover i {
background:transparent;
}
<?php
print "</style>\n";
}
示例7: zestsms_pdf_field_assets
function zestsms_pdf_field_assets()
{
if (class_exists('FLBuilderModel') && FLBuilderModel::is_builder_active()) {
wp_enqueue_style('zestsms-pdf', FIELDS_URL . 'pdf/css/zestsms-pdf.css', array(), '');
wp_enqueue_script('zestsms-pdf', FIELDS_URL . 'pdf/js/zestsms-pdf.js', array(), '', true);
}
}
示例8: tesseract_add_button_to_page_builder
/**
* Adds HTML to the bottom of the Beaver Builder Page Builder interface, which is used in a
* modal to allow content blocks to be added to the page.
*/
function tesseract_add_button_to_page_builder()
{
if (!defined('DOING_AJAX')) {
if (!FLBuilderModel::is_builder_active()) {
return;
}
}
$templates_query = new WP_Query(array('post_type' => 'fl-builder-template', 'meta_key' => Tesseract_Importer_Constants::$CONTENT_BLOCK_META_KEY, 'meta_value' => 1, 'posts_per_page' => 999));
?>
<div id="tesseract-content-blocks-wrapper">
<div class="cancel-wrapper">
<span class="fl-builder-blocks-update fl-builder-button fl-builder-button-primary fl-builder-button-large pull-left"><i class="fa fa-refresh"></i></span>
<span class="fl-builder-blocks-update-message pull-left"></span>
<span class="fl-builder-cancel-button fl-builder-button fl-builder-button-primary fl-builder-button-large">Cancel</span>
</div>
<?php
while ($templates_query->have_posts()) {
$templates_query->the_post();
?>
<?php
$template_id = get_the_ID();
?>
<?php
global $post;
$slug = $post->post_name;
?>
<div class="content-block slug-<?php
echo esc_attr($slug);
?>
"
style="background-image: url('<?php
echo esc_attr(get_stylesheet_directory_uri());
?>
/images/content-blocks/<?php
echo esc_attr($slug);
?>
.jpg')">
<a href="#" class="append-content-button" data-template-id="<?php
echo esc_attr($template_id);
?>
">
<?php
the_title();
?>
</a>
</div>
<?php
}
?>
<div class="cancel-wrapper">
<span class="fl-builder-blocks-update fl-builder-button fl-builder-button-primary fl-builder-button-large pull-left"><i class="fa fa-refresh"></i></span>
<span class="fl-builder-blocks-update-message pull-left"></span>
<span class="fl-builder-cancel-button fl-builder-button fl-builder-button-primary fl-builder-button-large">Cancel</span>
</div>
</div>
<?php
if (defined('DOING_AJAX') && DOING_AJAX) {
die;
}
}
示例9: tesseract_enqueue_beaver_builder_scripts
function tesseract_enqueue_beaver_builder_scripts()
{
if (FLBuilderModel::is_builder_active()) {
wp_enqueue_script('tesseract-bb-extensions', get_template_directory_uri() . '/importer/js/beaver-builder.js', array('jquery'));
wp_enqueue_style('tesseract-bb-extensions', get_template_directory_uri() . '/importer/css/beaver-builder.css');
}
}
示例10: enqueue_scripts
public function enqueue_scripts()
{
if ($this->settings->marker == 'icon' || FLBuilderModel::is_builder_active()) {
$this->add_js('geocomplete', '//cdnjs.cloudflare.com/ajax/libs/geocomplete/1.6.5/jquery.geocomplete.min.js', array('jquery'), '1.6.5', true);
$this->add_js('marker-with-label', $this->url . 'js/markerwithlabel.js', array('googlemaps-api'), NULL, true);
}
}
示例11: menu
/**
* Renders the network admin menu for multisite installs.
*
* @since 1.0
* @return void
*/
public static function menu()
{
$title = FLBuilderModel::get_branding();
$cap = 'manage_network_plugins';
$slug = 'fl-builder-multisite-settings';
$func = 'FLBuilderAdminSettings::render';
add_submenu_page('settings.php', $title, $title, $cap, $slug, $func);
}
示例12: zestsms_timepicker_field_assets
function zestsms_timepicker_field_assets()
{
if (class_exists('FLBuilderModel') && FLBuilderModel::is_builder_active()) {
wp_enqueue_script('jquery-timepicker', ZESTSMS_FIELDS_URL . 'zestsms-timepicker/js/lib/jquery.timepicker.min.js', array('jquery'), '1.8.0', true);
wp_enqueue_script('zestsms-timepicker', ZESTSMS_FIELDS_URL . 'zestsms-timepicker/js/zestsms-timepicker.js', array('jquery-timepicker'), '1.0', true);
wp_enqueue_style('jquery-timepicker', ZESTSMS_FIELDS_URL . 'zestsms-timepicker/css/lib/jquery.timepicker.css', false, null);
}
}
示例13: get_account_data
/**
* Get the saved data for a specific account.
*
* @since 1.5.4
* @param string $account The account name.
* @return array|bool The account data or false if it doesn't exist.
*/
public function get_account_data($account)
{
$saved_services = FLBuilderModel::get_services();
if (isset($saved_services[$this->id]) && isset($saved_services[$this->id][$account])) {
return $saved_services[$this->id][$account];
}
return false;
}
示例14: zestsms_geocomplete_field_assets
function zestsms_geocomplete_field_assets()
{
if (class_exists('FLBuilderModel') && FLBuilderModel::is_builder_active()) {
wp_enqueue_script('googlemaps-api', '//maps.googleapis.com/maps/api/js?v=3&sensor=false&libraries=places', array(), NULL, true);
wp_enqueue_script('geocomplete', ZESTSMS_FIELDS_URL . 'zestsms-geocomplete/js/lib/jquery.geocomplete.min.js', array('jquery'), '1.6.5', true);
wp_enqueue_script('zestsms-geocomplete', ZESTSMS_FIELDS_URL . 'zestsms-geocomplete/js/zestsms-geocomplete.js', array('jquery', 'geocomplete'), '1.0', true);
wp_enqueue_style('zestsms-geocomplete', ZESTSMS_FIELDS_URL . 'zestsms-geocomplete/css/zestsms-geocomplete.css');
}
}
示例15: install_for_new_blog
/**
* Runs the install for a newly created site.
*
* @since 1.0
* @param int $blog_id
* @param int $user_id
* @param string $domain
* @param string $path
* @param int $site_id
* @param array $meta
* @return void
*/
public static function install_for_new_blog($blog_id, $user_id, $domain, $path, $site_id, $meta)
{
global $wpdb;
if (is_plugin_active_for_network(FLBuilderModel::plugin_basename())) {
switch_to_blog($blog_id);
FLBuilderAdmin::install();
restore_current_blog();
}
}