コード例 #1
0
 public function register_scripts()
 {
     Cornerstone_Huebert::init();
     $orchestrator = $this->plugin->component('Element_Orchestrator');
     // Register
     wp_register_script('cs-core', $this->plugin->js('admin/core'), array('backbone'), $this->plugin->version(), true);
     $definitions = cs_memoize('_cornerstone_element_definitions', array($orchestrator, 'getModels'), 15);
     $icon_maps = wp_parse_args(array('elements' => add_query_arg(array('v' => $this->plugin->version()), $this->plugin->url('assets/svg/dist/elements.svg')), 'interface' => add_query_arg(array('v' => $this->plugin->version()), $this->plugin->url('assets/svg/dist/interface.svg'))), apply_filters('cornerstone_icon_map', array()));
     wp_localize_script('cs-core', 'csCoreData', cs_booleanize(array('ajaxUrl' => $this->plugin->component('Router')->get_ajax_url(), 'fallbackAjaxUrl' => $this->plugin->component('Router')->get_fallback_ajax_url(), 'useLegacyAjax' => $this->plugin->component('Router')->use_legacy_ajax(), 'debug' => $this->plugin->common()->isDebug(), 'elementDefinitions' => $definitions, 'isRTL' => is_rtl(), 'strings' => array('test' => 'test'), 'unfilteredHTML' => current_user_can('unfiltered_html'), 'iconMaps' => $icon_maps)));
 }
コード例 #2
0
 /**
  * Populate csConfig for javascript
  * Filter cornerstone_data allows additional data to be sent,
  * but prevents some original data to be modified
  */
 public function get_config_data()
 {
     $settings = $this->plugin->settings();
     return cs_booleanize(wp_parse_args(array('strings' => $this->plugin->config('builder/strings-builder'), 'isPreview' => $this->isPreview(), 'post' => $this->get_post_data(), 'dashboardEditUrl' => get_edit_post_link(), 'frontEndUrl' => get_the_permalink(), 'fontAwesome' => $this->plugin->common()->getFontIcons(), 'editorMarkup' => $this->getWPeditor(), 'remoteRenderDelay' => apply_filters('cornerstone_render_debounce', 200), 'loginURL' => wp_login_url(get_permalink()), 'scrollTopSelector' => apply_filters('cornerstone_scrolltop_selector', null), 'savedLast' => get_the_modified_time('U'), 'visualEnhancements' => (bool) $settings['visual_enhancements'], 'keybindings' => $this->plugin->config('builder/keybindings')), apply_filters('cornerstone_config_data', array())));
 }