コード例 #1
0
function js_wp_editor($settings = array())
{
    if (!class_exists('_WP_Editors')) {
        require ABSPATH . WPINC . '/class-wp-editor.php';
    }
    $set = _WP_Editors::parse_settings('apid', $settings);
    if (!current_user_can('upload_files')) {
        $set['media_buttons'] = false;
    }
    if ($set['media_buttons']) {
        wp_enqueue_script('thickbox');
        wp_enqueue_style('thickbox');
        wp_enqueue_script('media-upload');
        $post = get_post();
        if (!$post && !empty($GLOBALS['post_ID'])) {
            $post = $GLOBALS['post_ID'];
        }
        wp_enqueue_media(array('post' => $post));
    }
    _WP_Editors::editor_settings('apid', $set);
    $ap_vars = array('url' => get_home_url(), 'includes_url' => includes_url());
    wp_register_script('ap_wpeditor_init', get_template_directory_uri() . '/functions/js-wp-editor.js', array('jquery'), '1.1', true);
    wp_localize_script('ap_wpeditor_init', 'ap_vars', $ap_vars);
    wp_enqueue_script('ap_wpeditor_init');
}
コード例 #2
0
 public function get_set()
 {
     $set = _WP_Editors::parse_settings($this->editor_id, $this->get_settings());
     if (!current_user_can('upload_files')) {
         $set['media_buttons'] = false;
     }
     return $set;
 }
コード例 #3
0
ファイル: RichtextEditor.php プロジェクト: neochic/woodlets
 protected function __loadTinyMce()
 {
     if (!class_exists('_WP_Editors', false)) {
         require_once ABSPATH . WPINC . '/class-wp-editor.php';
     }
     /*
      * _WP_Editors shouldn't be used directly, but in this case
      * it's the best way to load WordPress RTE stuff and handle
      * RTE editors in Javascript
      */
     $set = \_WP_Editors::parse_settings(null, array('tinymce' => true, 'quicktags' => false));
     \_WP_Editors::editor_settings('woodlets_tiny_mce', $set);
 }
コード例 #4
0
function js_wp_editor($settings = array())
{
    if (!class_exists('_WP_Editors')) {
        require ABSPATH . WPINC . '/class-wp-editor.php';
    }
    $set = _WP_Editors::parse_settings('apid', $settings);
    if (!current_user_can('upload_files')) {
        $set['media_buttons'] = false;
    }
    if ($set['media_buttons']) {
        wp_enqueue_script('thickbox');
        wp_enqueue_style('thickbox');
        wp_enqueue_script('media-upload');
        $post = get_post();
        if (!$post && !empty($GLOBALS['post_ID'])) {
            $post = $GLOBALS['post_ID'];
        }
        wp_enqueue_media(array('post' => $post));
    }
    _WP_Editors::editor_settings('apid', $set);
}
コード例 #5
0
 function js_wp_editor($settings = array())
 {
     if (!class_exists('_WP_Editors')) {
         require ABSPATH . WPINC . '/class-wp-editor.php';
     }
     $set = _WP_Editors::parse_settings('apid', $settings);
     // if ( !current_user_can( 'upload_files' ) )
     // $set['media_buttons'] = false;
     // if ( $set['media_buttons'] ) {
     // 	wp_enqueue_script( 'thickbox' );
     // 	wp_enqueue_style( 'thickbox' );
     // 	wp_enqueue_script('media-upload');
     // 	$post = get_post();
     // 	if ( ! $post && ! empty( $GLOBALS['post_ID'] ) )
     // 		$post = $GLOBALS['post_ID'];
     // 	wp_enqueue_media( array(
     // 		'post' => $post
     // 	) );
     // }
     _WP_Editors::editor_settings('apid', $set);
     $ap_vars = array('url' => get_home_url(), 'includes_url' => includes_url(), 'upload_files' => current_user_can('upload_files'));
     wp_localize_script('jquery', 'ap_vars', $ap_vars);
 }
コード例 #6
0
/**
 * @since 2.7.0
 * @deprecated 3.3.0
 * @deprecated Use wp_editor()
 * @see wp_editor()
 */
function wp_tiny_mce($teeny = false, $settings = false)
{
    _deprecated_function(__FUNCTION__, '3.3', 'wp_editor()');
    static $num = 1;
    if (!class_exists('_WP_Editors')) {
        require_once ABSPATH . WPINC . '/class-wp-editor.php';
    }
    $editor_id = 'content' . $num++;
    $set = array('teeny' => $teeny, 'tinymce' => $settings ? $settings : true, 'quicktags' => false);
    $set = _WP_Editors::parse_settings($editor_id, $set);
    _WP_Editors::editor_settings($editor_id, $set);
}
コード例 #7
0
ファイル: class-pagebuilder.php プロジェクト: jolay/maga2.0
 public function enqueue_wp_editor_scripts()
 {
     $screen = get_current_screen();
     $allowed_screens = $this->allowed_post_types;
     if (in_array($screen->id, $allowed_screens)) {
         if (!class_exists('_WP_Editors')) {
             require ABSPATH . WPINC . '/class-wp-editor.php';
         }
         $set = _WP_Editors::parse_settings('fusionb_id', array());
         if (!current_user_can('upload_files')) {
             $set['media_buttons'] = false;
         }
         if ($set['media_buttons']) {
             wp_enqueue_script('thickbox');
             wp_enqueue_style('thickbox');
             wp_enqueue_script('media-upload');
             $post = get_post();
             if (!$post && !empty($GLOBALS['post_ID'])) {
                 $post = $GLOBALS['post_ID'];
             }
             wp_enqueue_media(array('post' => $post));
         }
         _WP_Editors::editor_settings('fusionb_id', $set);
     }
 }
コード例 #8
0
	function loadTinyMceSettings() {
		if ( ! class_exists( '_WP_Editors' ) )
			require( ABSPATH . WPINC . '/class-wp-editor.php' );
		$set = _WP_Editors::parse_settings( self::$content_editor_id, self::$content_editor_settings );
		_WP_Editors::editor_settings( self::$content_editor_id, $set );
	}
コード例 #9
0
function js_wp_editor($settings = array())
{
    if (!class_exists('_WP_Editors')) {
        require ABSPATH . WPINC . '/class-wp-editor.php';
    }
    $set = _WP_Editors::parse_settings('apid', $settings);
    _WP_Editors::editor_settings('apid', $set);
}
コード例 #10
0
 /**
  * @internal
  **/
 public function _action_print_wp_editor()
 {
     if (!class_exists('_WP_Editors')) {
         require ABSPATH . WPINC . '/class-wp-editor.php';
         $id = 'fw-wp-editor-option-type';
         $set = _WP_Editors::parse_settings($id, array('teeny' => true, 'media_buttons' => true, 'tinymce' => true, 'editor_css' => true, 'quicktags' => true));
         _WP_Editors::editor_settings($id, $set);
         _WP_Editors::enqueue_scripts();
         _WP_Editors::editor_js();
     }
 }
コード例 #11
0
ファイル: class-richtext.php プロジェクト: yemingyuen/mingsg
 /**
  * Setup an extra TinyMCE setting for use in AJAX editors
  */
 public function add_editor_settings()
 {
     $ajax_settings = _WP_Editors::parse_settings($this->get_the_ID(), $this->get_tinymce_settings());
     _WP_Editors::editor_settings($this->get_the_ID(), $ajax_settings);
 }
コード例 #12
0
 /**
  * Add JS to header edit/Add new post
  */
 function js()
 {
     wp_enqueue_script('jquery');
     wp_enqueue_script('jquery-core');
     // http://code.jquery.com/ui/1.10.3/jquery-ui.js
     //  wp_enqueue_script('jquery-ui', 'http://code.jquery.com/ui/1.10.3/jquery-ui.js', array('jquery'));
     if (function_exists('wp_enqueue_media')) {
         wp_enqueue_media();
     }
     wp_enqueue_script('jquery-ui-dialog');
     wp_enqueue_script('jquery-ui-draggable');
     wp_enqueue_script('jquery-ui-droppable');
     wp_enqueue_script('jquery-ui-sortable');
     wp_enqueue_script('jquery-ui-position');
     wp_enqueue_script('iris');
     wp_enqueue_script('wp-color-picker');
     wp_enqueue_script('quicktag');
     wp_enqueue_script('jquery.poshytip.js', $this->settings['url'] . 'assets/js/jquery.poshytip.js', array('jquery'));
     wp_enqueue_script('st-cookies', $this->settings['url'] . 'assets/js/cookies.js', array('jquery'));
     wp_enqueue_script('st-tabs-builder', $this->settings['url'] . 'assets/js/tabs-builder.js', array('jquery'));
     wp_enqueue_script('st-table-builder', $this->settings['url'] . 'assets/js/table-builder.js', array('jquery'));
     wp_enqueue_script('st-input-items', $this->settings['url'] . 'assets/js/input-items.js', array('jquery'));
     wp_enqueue_script('st-pagebuilder', $this->settings['url'] . 'assets/js/pagebuilder.js', array('jquery'));
     $l10n = array();
     $l10n[$this->nonceName] = $this->nonceValue;
     $l10n['input_name'] = ST_Page_Builder::BUILDER_SETTINGS_NAME;
     $l10n['item_sizes'] = $this->item_sizes;
     $l10n['config']['confirm_remove_row'] = __('Are you sure want to remove this row ?', 'smooththemes');
     $l10n['config']['confirm_remove_col'] = __('Are you sure want to remove this column ?', 'smooththemes');
     $l10n['config']['row_settings_title'] = __('Section settings', 'smooththemes');
     $l10n['config']['col_settings_title'] = __('Layout settings', 'smooththemes');
     $l10n['config']['loading'] = __('Loading...', 'smooththemes');
     $l10n['config']['tinymce_base'] = get_bloginfo('home') . '/wp-includes/js/tinymce';
     if (function_exists('st_get_font_icons')) {
         $l10n['font_icons'] = st_get_font_icons();
     }
     wp_localize_script('jquery-core', 'STBP', $l10n);
     if (!class_exists('_WP_Editors')) {
         require ABSPATH . WPINC . '/class-wp-editor.php';
     }
     $set = _WP_Editors::parse_settings('ap[id]', $settings);
     if (!current_user_can('upload_files')) {
         $set['media_buttons'] = false;
     }
     if ($set['media_buttons']) {
         wp_enqueue_script('thickbox');
         wp_enqueue_style('thickbox');
         wp_enqueue_script('media-upload');
         $post = get_post();
         if (!$post && !empty($GLOBALS['post_ID'])) {
             $post = $GLOBALS['post_ID'];
         }
         wp_enqueue_media(array('post' => $post));
     }
     _WP_Editors::editor_settings('ap[id]', $set);
 }
コード例 #13
0
 public function enqueue_wp_editor_scripts()
 {
     //initialize scripts for ajax text-editors
     if (!class_exists('_WP_Editors')) {
         require_once ABSPATH . WPINC . '/class-wp-editor.php';
     }
     $editor_id = 'content1';
     $set = array('teeny' => false, 'tinymce' => true, 'quicktags' => false);
     $set = _WP_Editors::parse_settings($editor_id, $set);
     _WP_Editors::editor_settings($editor_id, $set);
 }
コード例 #14
0
ファイル: deprecated.php プロジェクト: inpsyde/wordpress-dev
/**
 * Outputs the TinyMCE editor.
 *
 * @since 2.7.0
 * @deprecated 3.3.0 Use wp_editor()
 * @see wp_editor()
 *
 * @staticvar int $num
 */
function wp_tiny_mce($teeny = false, $settings = false)
{
    _deprecated_function(__FUNCTION__, '3.3.0', 'wp_editor()');
    static $num = 1;
    $editor_id = 'content' . $num++;
    $set = array('teeny' => $teeny, 'tinymce' => $settings ? $settings : true, 'quicktags' => false);
    $set = _WP_Editors::parse_settings($editor_id, $set);
    _WP_Editors::editor_settings($editor_id, $set);
}