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


PHP FLBuilderModel::get_layout_data方法代码示例

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


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

示例1: 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;
     $template_id = isset($_POST['template_id']) ? sanitize_text_field($_POST['template_id']) : false;
     $template_node_id = isset($_POST['template_node_id']) ? sanitize_text_field($_POST['template_node_id']) : false;
     $result = array('action' => false, 'error' => false, 'message' => false, 'url' => false);
     if ($email && $node_id) {
         // Get the module settings.
         if ($template_id) {
             $post_id = FLBuilderModel::get_node_template_post_id($template_id);
             $data = FLBuilderModel::get_layout_data('published', $post_id);
             $settings = $data[$template_node_id]->settings;
         } else {
             $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;
 }
开发者ID:onedaylabs,项目名称:onedaylabs.com,代码行数:44,代码来源:subscribe-form.php

示例2: render_global_nodes_custom_code

 /**
  * Renders the custom CSS or JS for all global nodes in a layout. 
  *
  * @since 1.7
  */
 public static function render_global_nodes_custom_code($type = 'css')
 {
     $code = '';
     $rendered = array();
     if (!FLBuilderModel::is_post_node_template()) {
         $nodes = FLBuilderModel::get_layout_data();
         $node_status = FLBuilderModel::get_node_status();
         foreach ($nodes as $node_id => $node) {
             $template_post_id = FLBuilderModel::is_node_global($node);
             if ($template_post_id && !in_array($template_post_id, $rendered)) {
                 $rendered[] = $template_post_id;
                 $code .= FLBuilderModel::get_layout_settings($node_status, $template_post_id)->{$type};
             }
         }
     }
     return $code;
 }
开发者ID:Nirajjcu,项目名称:minime3d,代码行数:22,代码来源:class-fl-builder.php

示例3: apply_node

 /**
  * Applies a node template that is defined as network-wide.
  *
  * @since 1.6.3
  * @param int $template_id The node template post ID.
  * @param string $parent_id The new parent node ID for the template.
  * @param int $position The position of the template within the layout.
  * @return void
  */
 public static function apply_node($template_id = null, $parent_id = null, $position = 0)
 {
     $site_id = self::get_source_site_id();
     $template = new StdClass();
     if ($site_id) {
         if (is_multisite()) {
             switch_to_blog($site_id);
         }
         $template->data = FLBuilderModel::get_layout_data('published', $template_id);
         $template->settings = FLBuilderModel::get_layout_settings('published', $template_id);
         $template->type = FLBuilderModel::get_user_template_type($template_id);
         $template->global = false;
         if (is_multisite()) {
             restore_current_blog();
         }
         return FLBuilderModel::apply_node_template($template_id, $parent_id, $position, $template);
     }
     return false;
 }
开发者ID:onedaylabs,项目名称:onedaylabs.com,代码行数:28,代码来源:class-fl-builder-templates-override.php


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