本文整理汇总了PHP中user_can_richedit函数的典型用法代码示例。如果您正苦于以下问题:PHP user_can_richedit函数的具体用法?PHP user_can_richedit怎么用?PHP user_can_richedit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_can_richedit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sb_admin_load
function sb_admin_load()
{
global $sb_admin;
// Load the scripts for handling metaboxes
wp_enqueue_script('common');
wp_enqueue_script('wp-lists');
wp_enqueue_script('postbox');
// Load StartBox-specific scripts and styles
wp_enqueue_script('colorbox');
wp_enqueue_script('jquery-ajaxuploader', SCRIPTS_URL . '/jquery.ajaxupload.js');
wp_enqueue_script('jquery-colorpicker', SCRIPTS_URL . '/colorpicker/js/colorpicker.js');
wp_enqueue_script('sb-admin', SCRIPTS_URL . '/admin.js', array('jquery-colorpicker'));
wp_enqueue_style('colorpicker', SCRIPTS_URL . '/colorpicker/css/colorpicker.css');
wp_enqueue_style('sb-admin', STYLES_URL . '/admin.css');
wp_enqueue_style('colorbox');
// Load scripts for TinyMCE (Credit: Lee Doel)
if (user_can_richedit()) {
wp_enqueue_script('editor');
wp_enqueue_script('media-upload');
wp_enqueue_style('thickbox');
add_action('admin_head', 'wp_tiny_mce');
}
if (sb_get_option('reset')) {
sb_set_default_options();
wp_redirect(admin_url('admin.php?page=sb_admin&reset=true'));
}
}
示例2: parse_settings
public static function parse_settings($editor_id, $settings)
{
$set = wp_parse_args($settings, array('wpautop' => true, 'media_buttons' => true, 'textarea_name' => $editor_id, 'textarea_rows' => 20, 'tabindex' => '', 'tabfocus_elements' => ':prev,:next', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => true));
self::$this_tinymce = $set['tinymce'] && user_can_richedit();
self::$this_quicktags = (bool) $set['quicktags'];
if (self::$this_tinymce) {
self::$has_tinymce = true;
}
if (self::$this_quicktags) {
self::$has_quicktags = true;
}
if (empty($set['editor_height'])) {
return $set;
}
if ('content' === $editor_id) {
// A cookie (set when a user resizes the editor) overrides the height.
$cookie = (int) get_user_setting('ed_size');
// Upgrade an old TinyMCE cookie if it is still around, and the new one isn't.
if (!$cookie && isset($_COOKIE['TinyMCE_content_size'])) {
parse_str($_COOKIE['TinyMCE_content_size'], $cookie);
$cookie = $cookie['ch'];
}
if ($cookie) {
$set['editor_height'] = $cookie;
}
}
if ($set['editor_height'] < 50) {
$set['editor_height'] = 50;
} elseif ($set['editor_height'] > 5000) {
$set['editor_height'] = 5000;
}
return $set;
}
示例3: parse_settings
/**
* Parse default arguments for the editor instance.
*
* @param string $editor_id ID for the current editor instance.
* @param array $settings {
* Array of editor arguments.
*
* @type bool $wpautop Whether to use wpautop(). Default true.
* @type bool $media_buttons Whether to show the Add Media/other media buttons.
* @type string $default_editor When both TinyMCE and Quicktags are used, set which
* editor is shown on page load. Default empty.
* @type bool $drag_drop_upload Whether to enable drag & drop on the editor uploading. Default false.
* Requires the media modal.
* @type string $textarea_name Give the textarea a unique name here. Square brackets
* can be used here. Default $editor_id.
* @type int $textarea_rows Number rows in the editor textarea. Default 20.
* @type string|int $tabindex Tabindex value to use. Default empty.
* @type string $tabfocus_elements The previous and next element ID to move the focus to
* when pressing the Tab key in TinyMCE. Defualt ':prev,:next'.
* @type string $editor_css Intended for extra styles for both Visual and Text editors.
* Should include <style> tags, and can use "scoped". Default empty.
* @type string $editor_class Extra classes to add to the editor textarea elemen. Default empty.
* @type bool $teeny Whether to output the minimal editor config. Examples include
* Press This and the Comment editor. Default false.
* @type bool $dfw Whether to replace the default fullscreen with "Distraction Free
* Writing". DFW requires specific DOM elements and css). Default false.
* @type bool|array $tinymce Whether to load TinyMCE. Can be used to pass settings directly to
* TinyMCE using an array. Default true.
* @type bool|array $quicktags Whether to load Quicktags. Can be used to pass settings directly to
* Quicktags using an array. Default true.
* }
* @return array Parsed arguments array.
*/
public static function parse_settings($editor_id, $settings)
{
$set = wp_parse_args($settings, array('wpautop' => true, 'media_buttons' => true, 'default_editor' => '', 'drag_drop_upload' => false, 'textarea_name' => $editor_id, 'textarea_rows' => 20, 'tabindex' => '', 'tabfocus_elements' => ':prev,:next', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => true));
self::$this_tinymce = $set['tinymce'] && user_can_richedit();
if (self::$this_tinymce) {
if (false !== strpos($editor_id, '[')) {
self::$this_tinymce = false;
_deprecated_argument('wp_editor()', '3.9', 'TinyMCE editor IDs cannot have brackets.');
}
}
self::$this_quicktags = (bool) $set['quicktags'];
if (self::$this_tinymce) {
self::$has_tinymce = true;
}
if (self::$this_quicktags) {
self::$has_quicktags = true;
}
if (empty($set['editor_height'])) {
return $set;
}
if ('content' === $editor_id) {
// A cookie (set when a user resizes the editor) overrides the height.
$cookie = (int) get_user_setting('ed_size');
if ($cookie) {
$set['editor_height'] = $cookie;
}
}
if ($set['editor_height'] < 50) {
$set['editor_height'] = 50;
} elseif ($set['editor_height'] > 5000) {
$set['editor_height'] = 5000;
}
return $set;
}
示例4: __construct
/**
* Categorize constructor
*
* @return void
**/
function __construct () {
parent::__construct();
if (!empty($_GET['id']) && !isset($_GET['a'])) {
wp_enqueue_script('postbox');
if ( user_can_richedit() ) {
wp_enqueue_script('editor');
wp_enqueue_script('quicktags');
add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 20 );
}
ecart_enqueue_script('colorbox');
ecart_enqueue_script('editors');
ecart_enqueue_script('category-editor');
ecart_enqueue_script('priceline');
ecart_enqueue_script('ocupload');
ecart_enqueue_script('swfupload');
ecart_enqueue_script('ecart-swfupload-queue');
do_action('ecart_category_editor_scripts');
add_action('admin_head',array(&$this,'layout'));
} elseif (!empty($_GET['a']) && $_GET['a'] == 'arrange') {
ecart_enqueue_script('category-arrange');
do_action('ecart_category_arrange_scripts');
add_action('admin_print_scripts',array(&$this,'arrange_cols'));
} elseif (!empty($_GET['a']) && $_GET['a'] == 'products') {
ecart_enqueue_script('products-arrange');
do_action('ecart_category_products_arrange_scripts');
add_action('admin_print_scripts',array(&$this,'products_cols'));
} else add_action('admin_print_scripts',array(&$this,'columns'));
do_action('ecart_category_admin_scripts');
add_action('load-ecart_page_ecart-categories',array(&$this,'workflow'));
}
示例5: display_field
public function display_field($field, $group_index = 1, $field_index = 1)
{
global $mf_domain;
$class = '';
$max = '';
if (isset($field['options']['max_length'])) {
$max = sprintf('maxlength="%d"', $field['options']['height'] * $field['options']['width']);
}
$value = $field['input_value'];
$output = '';
$output .= '<div class="multiline_custom_field">';
if (mf_settings::get('hide_visual_editor') == '1') {
$field['options']['hide_visual'] = 1;
}
if ($field['options']['hide_visual'] == 0 && user_can_richedit()) {
$output .= sprintf('<div class="tab_multi_mf">');
$output .= sprintf('<a onclick="del_editor(\'%s\');" class="edButtonHTML_mf">HTML</a>', $field['input_id']);
$output .= sprintf('<a onclick="add_editor(\'%s\');" class="edButtonHTML_mf current" >Visual</a>', $field['input_id']);
$output .= sprintf('</div><br /><br />');
$class = 'pre_editor add_editor_mf';
if (mf_settings::get('dont_remove_tags') != '1') {
$value = apply_filters('the_editor_content', $value);
}
}
if ($field['options']['hide_visual'] == 0 && user_can_richedit()) {
printf('<div style="display: none1" id="wp-%s-media-buttons" class="wp-media-buttons mf_media_button_div" >', $field['input_id']);
require_once ABSPATH . 'wp-admin/includes/media.php';
media_buttons($field['input_id']);
printf('</div>');
}
$output .= sprintf('<textarea %s class="mf_editor %s" id="%s" name="%s" rows="%s" cols="%s" %s >%s</textarea>', $field['input_validate'], $class, $field['input_id'], $field['input_name'], $field['options']['height'], $field['options']['width'], $max, $value);
$output .= '</div>';
return $output;
}
示例6: parse_settings
public static function parse_settings($editor_id, $settings) {
$set = wp_parse_args( $settings, array(
'wpautop' => true, // use wpautop?
'media_buttons' => true, // show insert/upload button(s)
'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
'textarea_rows' => get_option('default_post_edit_rows', 10), // rows="..."
'tabindex' => '',
'editor_css' => '', // intended for extra styles for both visual and HTML editors buttons, needs to include the <style> tags, can use "scoped".
'editor_class' => '', // add extra class(es) to the editor textarea
'teeny' => false, // output the minimal editor config used in Press This
'dfw' => false, // replace the default fullscreen with DFW (needs specific DOM elements and css)
'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array()
) );
self::$this_tinymce = ( $set['tinymce'] && user_can_richedit() );
self::$this_quicktags = (bool) $set['quicktags'];
if ( self::$this_tinymce )
self::$has_tinymce = true;
if ( self::$this_quicktags )
self::$has_quicktags = true;
return $set;
}
示例7: __construct
/**
* Store constructor
*
* @return void
**/
function __construct () {
parent::__construct();
if (!empty($_GET['id'])) {
wp_enqueue_script('jquery-ui-draggable');
wp_enqueue_script('suggest');
wp_enqueue_script('postbox');
if ( user_can_richedit() ) {
wp_enqueue_script('editor');
wp_enqueue_script('quicktags');
add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 20 );
}
ecart_enqueue_script('colorbox');
ecart_enqueue_script('editors');
ecart_enqueue_script('scalecrop');
ecart_enqueue_script('calendar');
ecart_enqueue_script('product-editor');
ecart_enqueue_script('priceline');
ecart_enqueue_script('ocupload');
ecart_enqueue_script('swfupload');
ecart_enqueue_script('ecart-swfupload-queue');
do_action('ecart_product_editor_scripts');
add_action('admin_head',array(&$this,'layout'));
} elseif (!empty($_GET['f']) && $_GET['f'] == 'i') {
do_action('ecart_inventory_manager_scripts');
add_action('admin_print_scripts',array(&$this,'inventory_cols'));
} else add_action('admin_print_scripts',array(&$this,'columns'));
add_action('load-ecart_page_ecart-products',array(&$this,'workflow'));
do_action('ecart_product_admin_scripts');
// Load the search model for indexing
require_once(ECART_MODEL_PATH."/Search.php");
new ContentParser();
add_action('ecart_product_saved',array(&$this,'index'),99,1);
}
示例8: load_admin_scripts
public function load_admin_scripts($hook)
{
global $sc_settings_page;
if ($hook != $sc_settings_page) {
return;
}
wp_enqueue_script('word-count');
wp_enqueue_script('post');
if (user_can_richedit()) {
wp_enqueue_script('editor');
}
add_thickbox();
wp_enqueue_script('media-upload');
wp_enqueue_media();
wp_enqueue_style('wp-color-picker');
wp_enqueue_script('wp-color-picker');
wp_enqueue_script('jquery-ui-slider');
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-effects-core');
wp_enqueue_script('jquery-effects-slide');
wp_enqueue_style('jquery-ui-style', '//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css');
// Codemirror
// wp_enqueue_script( 'codemirror-js', plugins_url( '/assets/codemirror-compressed.js', SC_ADS_DIR ), false, false, true );
// wp_enqueue_script( 'codemirror-closebrackets-js', plugins_url( '/assets/codemirror-closebrackets.js', SC_ADS_DIR ), false, false, true );
// wp_enqueue_style( 'codemirror-css', plugins_url( '/assets/codemirror.css', SC_ADS_DIR ) );
// Admin Assets
wp_enqueue_script('sc-ads-admin-js', plugins_url('/assets/admin-scripts.js', SC_ADS_DIR), array('jquery', 'wp-color-picker'), false, true);
wp_enqueue_style('sc-ads-admin-css', plugins_url('/assets/admin-style.css', SC_ADS_DIR));
}
示例9: admin_scripts
function admin_scripts()
{
add_action('admin_print_footer_scripts', 'wp_tiny_mce', 25);
if (user_can_richedit()) {
wp_enqueue_script('editor');
}
}
示例10: render_set_correct_default_editor
/**
* @test
*/
public function render_set_correct_default_editor()
{
$field_options = array('type' => 'tinymce', 'label' => 'A TinyMCE input', 'default_editor' => 'tmce');
/* @var $base_field SiteOrigin_Widget_Field_Textarea */
$field = new SiteOrigin_Widget_Field_TinyMCE('tinymce_input', 'tinymce_input_id', 'tinymce_input_name', $field_options);
$field_output = get_field_render_output($field);
$this->assertTrue(user_can_richedit());
$this->assertContains('tmce-active', $field_output);
}
示例11: display
/**
* Displays the input control for the field.
*
* @since 0.5.0
* @param string $val the current value of the field
* @param bool $echo whether to echo the output (default is true)
* @return string the HTML output of the field control
*/
public function display($val, $echo = true)
{
$wp_editor_settings = array('textarea_name' => $this->args['name'], 'textarea_rows' => $this->args['rows'], 'editor_class' => $this->args['class'], 'default_editor' => user_can_richedit() ? 'tinymce' : 'html', 'wpautop' => true, 'media_buttons' => true, 'quicktags' => array('buttons' => 'strong,em,u,link,block,del,ins,img,ul,ol,li,code,close'), 'tinymce' => array('toolbar1' => 'bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,link,unlink,spellchecker,wp_adv'));
ob_start();
wp_editor($val, $this->args['id'], $wp_editor_settings);
$output = ob_get_clean();
if ($echo) {
echo $output;
}
return $output;
}
示例12: parse_settings
public static function parse_settings($editor_id, $settings)
{
$set = nxt_parse_args($settings, array('nxtautop' => true, 'media_buttons' => true, 'textarea_name' => $editor_id, 'textarea_rows' => get_option('default_post_edit_rows', 10), 'tabindex' => '', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, 'dfw' => false, 'tinymce' => true, 'quicktags' => true));
self::$this_tinymce = $set['tinymce'] && user_can_richedit();
self::$this_quicktags = (bool) $set['quicktags'];
if (self::$this_tinymce) {
self::$has_tinymce = true;
}
if (self::$this_quicktags) {
self::$has_quicktags = true;
}
return $set;
}
示例13: init
/**
* Kick things off for the shortcode generator
*
* @since 1.3.0.2
*/
public function init()
{
if ($this->shortcode_tag) {
$this->self = get_class($this);
$this->errors = array();
$this->required = array();
// Generate the fields, errors, and requirements
$fields = $this->get_fields();
$defaults = array('btn_close' => esc_html__('Close', 'give'), 'btn_okay' => esc_html__('Insert Shortcode', 'give'), 'errors' => $this->errors, 'fields' => $fields, 'label' => '[' . $this->shortcode_tag . ']', 'required' => $this->required, 'title' => esc_html__('Insert Shortcode', 'give'));
if (user_can_richedit()) {
Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults);
}
}
}
示例14: parse_settings
/**
* Parse default arguments for the editor instance.
*
* @param string $editor_id ID for the current editor instance.
* @param array $settings {
* Array of editor arguments.
*
* @type bool $wpautop Whether to use wpautop(). Default true.
* @type bool $media_buttons Whether to show the Add Media/other media buttons.
* @type string $default_editor When both TinyMCE and Quicktags are used, set which
* editor is shown on page load. Default empty.
* @type bool $drag_drop_upload Whether to enable drag & drop on the editor uploading. Default false.
* Requires the media modal.
* @type string $textarea_name Give the textarea a unique name here. Square brackets
* can be used here. Default $editor_id.
* @type int $textarea_rows Number rows in the editor textarea. Default 20.
* @type string|int $tabindex Tabindex value to use. Default empty.
* @type string $tabfocus_elements The previous and next element ID to move the focus to
* when pressing the Tab key in TinyMCE. Defualt ':prev,:next'.
* @type string $editor_css Intended for extra styles for both Visual and Text editors.
* Should include `<style>` tags, and can use "scoped". Default empty.
* @type string $editor_class Extra classes to add to the editor textarea elemen. Default empty.
* @type bool $teeny Whether to output the minimal editor config. Examples include
* Press This and the Comment editor. Default false.
* @type bool $dfw Whether to replace the default fullscreen with "Distraction Free
* Writing". DFW requires specific DOM elements and css). Default false.
* @type bool|array $tinymce Whether to load TinyMCE. Can be used to pass settings directly to
* TinyMCE using an array. Default true.
* @type bool|array $quicktags Whether to load Quicktags. Can be used to pass settings directly to
* Quicktags using an array. Default true.
* }
* @return array Parsed arguments array.
*/
public static function parse_settings($editor_id, $settings)
{
/**
* Filter the wp_editor() settings.
*
* @since 4.0.0
*
* @see _WP_Editors()::parse_settings()
*
* @param array $settings Array of editor arguments.
* @param string $editor_id ID for the current editor instance.
*/
$settings = apply_filters('wp_editor_settings', $settings, $editor_id);
$set = wp_parse_args($settings, array('wpautop' => true, 'media_buttons' => true, 'default_editor' => '', 'drag_drop_upload' => false, 'textarea_name' => $editor_id, 'textarea_rows' => 20, 'tabindex' => '', 'tabfocus_elements' => ':prev,:next', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, 'dfw' => false, '_content_editor_dfw' => false, 'tinymce' => true, 'quicktags' => true));
self::$this_tinymce = $set['tinymce'] && user_can_richedit();
if (self::$this_tinymce) {
if (false !== strpos($editor_id, '[')) {
self::$this_tinymce = false;
_deprecated_argument('wp_editor()', '3.9', 'TinyMCE editor IDs cannot have brackets.');
}
}
self::$this_quicktags = (bool) $set['quicktags'];
if (self::$this_tinymce) {
self::$has_tinymce = true;
}
if (self::$this_quicktags) {
self::$has_quicktags = true;
}
if (empty($set['editor_height'])) {
return $set;
}
if ('content' === $editor_id && empty($set['tinymce']['wp_autoresize_on'])) {
// A cookie (set when a user resizes the editor) overrides the height.
$cookie = (int) get_user_setting('ed_size');
// Upgrade an old TinyMCE cookie if it is still around, and the new one isn't.
if (!$cookie && isset($_COOKIE['TinyMCE_content_size'])) {
parse_str($_COOKIE['TinyMCE_content_size'], $cookie);
$cookie = $cookie['ch'];
}
if ($cookie) {
$set['editor_height'] = $cookie;
}
}
if ($set['editor_height'] < 50) {
$set['editor_height'] = 50;
} elseif ($set['editor_height'] > 5000) {
$set['editor_height'] = 5000;
}
return $set;
}
示例15: parse_settings
public static function parse_settings($editor_id, $settings) {
$set = wp_parse_args( $settings, array(
'wpautop' => true, // use wpautop?
'media_buttons' => true, // show insert/upload button(s)
'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
'textarea_rows' => 20,
'tabindex' => '',
'tabfocus_elements' => ':prev,:next', // the previous and next element ID to move the focus to when pressing the Tab key in TinyMCE
'editor_css' => '', // intended for extra styles for both visual and Text editors buttons, needs to include the <style> tags, can use "scoped".
'editor_class' => '', // add extra class(es) to the editor textarea
'teeny' => false, // output the minimal editor config used in Press This
'dfw' => false, // replace the default fullscreen with DFW (needs specific DOM elements and css)
'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array()
) );
self::$this_tinymce = ( $set['tinymce'] && user_can_richedit() );
self::$this_quicktags = (bool) $set['quicktags'];
if ( self::$this_tinymce )
self::$has_tinymce = true;
if ( self::$this_quicktags )
self::$has_quicktags = true;
if ( empty( $set['editor_height'] ) )
return $set;
if ( 'content' === $editor_id ) {
// A cookie (set when a user resizes the editor) overrides the height.
$cookie = (int) get_user_setting( 'ed_size' );
// Upgrade an old TinyMCE cookie if it is still around, and the new one isn't.
if ( ! $cookie && isset( $_COOKIE['TinyMCE_content_size'] ) ) {
parse_str( $_COOKIE['TinyMCE_content_size'], $cookie );
$cookie = $cookie['ch'];
}
if ( $cookie )
$set['editor_height'] = $cookie;
}
if ( $set['editor_height'] < 50 )
$set['editor_height'] = 50;
elseif ( $set['editor_height'] > 5000 )
$set['editor_height'] = 5000;
return $set;
}