function get_section_data($uids)
 {
     $start_time = microtime(TRUE);
     $imploded_uids = join("','", $uids);
     $query = sprintf("SELECT uid, draft, live from {$this->table_name} Where uid IN ( '%s' )", $imploded_uids);
     $rows = $this->wpdb->get_results($query);
     $config = $this->configure_section_data($uids, $rows);
     if (is_pl_debug()) {
         pl_add_perform_data(round(microtime(TRUE) - $start_time, 3), __('Section Data Query', 'pagelines'), __('Seconds', 'pagelines'), __('Time for section data DB query and configuration.', 'pagelines'));
     }
     return $config;
 }
Ejemplo n.º 2
0
    function json_blob()
    {
        ob_start();
        ?>
<script>
			!function ($) {
				
				
				$.pl = {
					data: {
						list: <?php 
        echo json_encode(pl_arrays_to_objects($this->sections_data));
        ?>
							
						,	local:  <?php 
        echo json_encode(pl_arrays_to_objects($this->current_page_data('local')));
        ?>
						
						,  type:  <?php 
        echo json_encode(pl_arrays_to_objects($this->current_page_data('type')));
        ?>
						
						,  global:  <?php 
        echo json_encode(pl_arrays_to_objects($this->current_page_data('global')));
        ?>
					}
					
					, flags: {
							refreshOnSave: false
						,	savingDialog: 'Saving'
						,	refreshingDialog: 'Success! Reloading page'
						,	layoutMode: '<?php 
        echo $this->layout->get_layout_mode();
        ?>
'
						,	saving: false
					}
					, lang: function( args ){
						var gt = new Gettext()
						return gt.gettext( args )
					}
					, config: {
						userID: '<?php 
        echo $this->get_user_id();
        ?>
'
						, currentURL: '<?php 
        echo $this->current_url();
        ?>
'
						, siteURL: '<?php 
        echo site_url();
        ?>
'
						, nonce: '<?php 
        echo wp_create_nonce("tgmpa-install");
        ?>
'
						, pageTemplate: '<?php 
        echo $this->page->template;
        ?>
'
						, templateMode: '<?php 
        echo $this->page->template_mode();
        ?>
'
						, pageID: '<?php 
        echo $this->page->id;
        ?>
'
						, typeID: '<?php 
        echo $this->page->typeid;
        ?>
'
						, pageTypeID: '<?php 
        echo $this->page->type;
        ?>
'
						, pageTypeName: '<?php 
        echo $this->page->type_name;
        ?>
'
						, devMode: <?php 
        echo $this->get_dev_mode();
        ?>
						, CacheKey: '<?php 
        echo pl_get_cache_key();
        ?>
'
						, isSpecial: '<?php 
        echo $this->page->is_special();
        ?>
'
						, isPro: <?php 
        echo pl_is_wporg() ? "false\n" : "true\n";
        ?>
						, opts: <?php 
        echo json_encode(pl_arrays_to_objects($this->get_options_config()));
        ?>
						, settings: <?php 
        echo json_encode(pl_arrays_to_objects($this->siteset->get_set('site')));
        ?>
						, panels: <?php 
        echo json_encode(pl_arrays_to_objects($this->get_panels_settings()));
        ?>
						, fonts: <?php 
        echo json_encode(pl_arrays_to_objects($this->foundry->get_foundry()));
        ?>
						, menus: <?php 
        echo json_encode(pl_arrays_to_objects($this->get_wp_menus()));
        ?>
						, extensions: <?php 
        echo json_encode(pl_arrays_to_objects($this->extensions->get_list()));
        ?>
						, icons: <?php 
        echo json_encode(pl_arrays_to_objects(pl_icon_array()));
        ?>
						, btns: <?php 
        echo json_encode(pl_arrays_to_objects(pl_button_classes()));
        ?>
						, themes: <?php 
        echo json_encode(pl_arrays_to_objects(pl_theme_classes()));
        ?>
						, imgSizes: <?php 
        echo json_encode(pl_arrays_to_objects(pl_get_image_sizes()));
        ?>
						, animations: <?php 
        echo json_encode(pl_arrays_to_objects(pl_animation_array()));
        ?>
						, taxes: <?php 
        echo json_encode(pl_arrays_to_objects(pl_get_all_taxonomies()));
        ?>
						, urls: {
							adminURL: '<?php 
        echo admin_url();
        ?>
'
							, editPost: '<?php 
        echo $this->edit_post_link();
        ?>
'
							, menus: '<?php 
        echo admin_url("nav-menus.php");
        ?>
'
							, widgets: '<?php 
        echo $this->edit_post_link();
        ?>
'							
							, CoreURL: '<?php 
        echo pl_get_template_directory_uri();
        ?>
'
							, ParentStyleSheetURL: '<?php 
        echo get_template_directory_uri();
        ?>
'
							, ChildStyleSheetURL: '<?php 
        echo get_stylesheet_directory_uri();
        ?>
'
							, siteURL: '<?php 
        echo home_url();
        ?>
'
							, mediaLibrary: '<?php 
        echo pl_media_library_link();
        ?>
'
							, mediaLibrary: '<?php 
        echo pl_media_library_link();
        ?>
'
							, mediaLibraryVideo: '<?php 
        echo pl_media_library_link("video");
        ?>
'
							, addMedia: '<?php 
        echo admin_url("media-new.php");
        ?>
'
						}
						<?php 
        echo $this->json_blob_objects();
        ?>
					}

				
				}

					
			}(window.jQuery);
		</script>
		<?php 
        if (defined('PL_DEV') && PL_DEV) {
            pl_add_perform_data(ob_get_length(), __('Data Length', 'pagelines'), __('Characters', 'pagelines'), __('The total number of characters in the data blob. Watching size can be good to detect data leaks or other strange behavior.', 'pagelines'));
        }
        echo apply_filters('pl_data_blob', ob_get_clean());
    }