static function scripts() { $wrapped = array_keys(FEE_Field_Base::get_wrapped()); if (empty($wrapped)) { return; } // Prepare data $data = array('edit_text' => __('Edit', 'front-end-editor'), 'save_text' => __('Save', 'front-end-editor'), 'cancel_text' => __('Cancel', 'front-end-editor'), 'ajax_url' => admin_url('admin-ajax.php'), 'spinner' => admin_url('images/loading.gif'), 'nonce' => wp_create_nonce(self::$nonce)); $url = plugins_url('js/', FRONT_END_EDITOR_MAIN_FILE); $dev = defined('SCRIPT_DEBUG') ? '.dev' : ''; $css_dependencies = array(); // Autosuggest if (in_array('terminput', $wrapped)) { $data['suggest'] = array('src' => self::get_src('suggest')); } // Thickbox if (count(array_intersect(array('image', 'thumbnail', 'rich'), $wrapped))) { $data['image'] = array('url' => admin_url('media-upload.php?post_id=0&type=image&editable_image=1&TB_iframe=true&width=640'), 'change' => __('Change Image', 'front-end-editor'), 'insert' => __('Insert Image', 'front-end-editor'), 'revert' => '(' . __('Clear', 'front-end-editor') . ')', 'tb_close' => get_bloginfo('wpurl') . '/wp-includes/js/thickbox/tb-close.png'); $css_dependencies[] = 'thickbox'; $js_dependencies[] = 'thickbox'; } // Core script if (defined('SCRIPT_DEBUG')) { wp_register_script('fee-class', $url . "class.js", array(), '1.0', true); $js_dependencies[] = 'fee-class'; wp_register_script('fee-core', $url . "core.dev.js", $js_dependencies, FRONT_END_EDITOR_VERSION, true); $js_dependencies[] = 'fee-core'; foreach (glob(dirname(FRONT_END_EDITOR_MAIN_FILE) . '/js/fields/*.js') as $file) { $file = basename($file); wp_register_script("fee-fields-{$file}", $url . "fields/{$file}", array('fee-core'), FRONT_END_EDITOR_VERSION, true); $js_dependencies[] = "fee-fields-{$file}"; } } else { wp_register_script('fee-editor', $url . "editor.js", $js_dependencies, FRONT_END_EDITOR_VERSION, true); $js_dependencies[] = 'fee-editor'; } wp_register_style('fee-editor', plugins_url("css/editor{$dev}.css", FRONT_END_EDITOR_MAIN_FILE), $css_dependencies, FRONT_END_EDITOR_VERSION); ?> <script type='text/javascript'> var FrontEndEditor = {}; FrontEndEditor.data = <?php echo json_encode($data); ?> ; </script> <?php scbUtil::do_scripts($js_dependencies); scbUtil::do_styles('fee-editor'); do_action('front_end_editor_loaded', $wrapped); }
static function scripts() { $wrapped = array_keys(FEE_Field_Base::get_wrapped()); // No point loading all that JavaScript if there aren't any editable elements if (empty($wrapped)) { return; } // Prepare data $data = array('edit_text' => __('Edit', 'front-end-editor'), 'save_text' => __('Save', 'front-end-editor'), 'cancel_text' => __('Cancel', 'front-end-editor'), 'spinner' => admin_url('images/loading.gif'), 'ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce(self::NONCE)); $css_dependencies = array(); // Autosuggest if (in_array('terminput', $wrapped)) { self::$js_dependencies[] = 'suggest'; } if (in_array('rich', $wrapped)) { wp_register_style('aloha-editor', plugins_url('lib/aloha-editor/css/aloha.css', FEE_MAIN_FILE), array(), ALOHA_VERSION); $css_dependencies[] = 'aloha-editor'; } // Thickbox if (count(array_intersect(array('image', 'thumbnail', 'rich'), $wrapped))) { $data['image'] = array('url' => admin_url('media-upload.php?post_id=0&editable_image=1&TB_iframe=true&width=640'), 'change' => __('Change Image', 'front-end-editor'), 'insert' => __('Insert Image', 'front-end-editor'), 'revert' => '(' . __('Clear', 'front-end-editor') . ')', 'tb_close' => get_bloginfo('wpurl') . '/wp-includes/js/thickbox/tb-close.png'); $css_dependencies[] = 'thickbox'; self::$js_dependencies[] = 'thickbox'; } // Core script if (defined('FEE_DEBUG')) { foreach (array('core', 'hover', 'init') as $handle) { self::register_script("fee-{$handle}", "js/{$handle}.js"); } foreach (glob(dirname(FEE_MAIN_FILE) . '/js/fields/*.js') as $file) { $file = basename($file); self::register_script("fee-fields-{$file}", "js/fields/{$file}", array('fee-core')); } } else { $min = defined('SCRIPT_DEBUG') ? '' : '.min'; self::register_script('fee-editor', "build/editor{$min}.js"); } // Core style wp_register_style('fee-editor', plugins_url('css/core.css', FEE_MAIN_FILE), $css_dependencies, FEE_VERSION); scbUtil::do_styles('fee-editor'); ?> <script type='text/javascript'> var FrontEndEditor = {}; FrontEndEditor.data = <?php echo json_encode($data); ?> ; </script> <?php if (in_array('rich', $wrapped)) { ?> <script type='text/javascript'> var Aloha = {}; Aloha.settings = { logLevels: { 'error': true, 'warn': true, 'info': true, 'debug': false, 'deprecated': true }, bundles: { fee: '../../../aloha-plugins' }, floatingmenu: { width: 410 }, sidebar: { disabled: true }, plugins: { format: { config: ['b', 'i', 'del', 'sub', 'sup', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre', 'removeFormat'], } } }; </script> <?php $plugins = array('common/format', 'common/align', 'common/list', 'common/link', 'common/table', 'common/undo', 'common/paste', 'common/block', 'extra/cite', 'fee/wpImage'); echo html('script', array('src' => plugins_url('lib/aloha-editor/lib/aloha.js', FEE_MAIN_FILE), 'data-aloha-plugins' => implode(',', $plugins))) . "\n"; } scbUtil::do_scripts(self::$js_dependencies); do_action('front_end_editor_loaded', $wrapped); }
static function add_scripts() { $add_css = apply_filters('smart_archives_load_default_styles', self::$css); if (!self::$fancy && !$add_css) { return; } $plugin_url = plugin_dir_url(__FILE__) . 'inc/'; if (self::$fancy) { wp_register_script('tools-tabs', $plugin_url . 'tools.tabs.min.js', array('jquery'), '1.1.2', true); scbUtil::do_scripts('tools-tabs'); } if ($add_css) { $css_dev = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : ''; wp_register_style('smart-archives', $plugin_url . "styles{$css_dev}.css", array(), SAR_VERSION); scbUtil::do_styles('smart-archives'); } if (self::$fancy) { ?> <script type="text/javascript"> jQuery( document ).ready( function( $ ) { $( '.tabs' ).tabs( '> .pane' ); $( '#smart-archives-fancy .year-list' ) .find( 'a' ).click( function( ev ) { $( '.pane .tabs:visible a:last' ).click(); } ).end() .find( 'a:last' ).click(); } ); </script> <?php } }