Пример #1
0
    function inject_upfront_dependencies()
    {
        if (!Upfront_Permissions::current(Upfront_Permissions::BOOT)) {
            return false;
        }
        // Do not inject for users that can't use this
        $url = self::get_root_url();
        //Boot Edit Mode if the querystring contains the editmode param
        if (isset($_GET['editmode'])) {
            echo upfront_boot_editor_trigger();
        }
        $storage_key = apply_filters('upfront-data-storage-key', Upfront_Layout::STORAGE_KEY);
        $save_storage_key = $storage_key;
        $is_ssl = is_ssl() ? '&ssl=1' : '';
        if (isset($_GET['dev']) && current_user_can('switch_themes') && apply_filters('upfront-enable-dev-saving', true)) {
            $save_storage_key .= '_dev';
        }
        $script_urls = array("{$url}/scripts/require.js", admin_url('admin-ajax.php?action=upfront_load_main' . $is_ssl), "{$url}/scripts/main.js");
        $deps = Upfront_CoreDependencies_Registry::get_instance();
        foreach ($script_urls as $url) {
            $deps->add_script($url);
        }
        echo '<script type="text/javascript">
			var _upfront_post_data=' . json_encode(array('layout' => Upfront_EntityResolver::get_entity_ids(), 'post_id' => is_singular() ? apply_filters('upfront-data-post_id', get_the_ID()) : false)) . ';
			var _upfront_storage_key = "' . $storage_key . '";
			var _upfront_save_storage_key = "' . $save_storage_key . '";
			var _upfront_stylesheet = "' . get_stylesheet() . '";
			var _upfront_debug_mode = ' . (int) isset($_GET['debug']) . ';
			var _upfront_please_hold_on = ' . json_encode(__('Please, hold on for just a little bit more', 'upfront')) . ';
		</script>';
        echo <<<EOAdditivemarkup
\t<div id="sidebar-ui" class="upfront-ui"></div>
\t<div id="settings" style="display:none"></div>
\t<div id="contextmenu" style="display:none"></div>
EOAdditivemarkup;
        do_action('upfront-core-inject_dependencies');
    }
Пример #2
0
 public function start_editor()
 {
     echo upfront_boot_editor_trigger('theme');
 }