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; }
function createEditor($name, $data) { ob_start(); echo media_buttons($name); $output = ob_get_contents(); ob_end_clean(); $data['ui']['element']['attribute']['class'] = ' pb-editor'; return $output . $this->createFieldTypeTextarea($name, $data); }
/** * Add the media buttons to the text editor. * * This is a copy and modification of the core "media_buttons" function. In order to make the media editor work * better for smaller width screens, we need to wrap the button text in a span tag. By doing so, we can hide the * text in some situations. * * @since 1.0.0. * @deprecated 1.4.0. * * @param string $editor_id The value of the current editor ID. * @return void */ public function media_buttons($editor_id = 'content') { _deprecated_function(__FUNCTION__, '1.4.0', 'media_buttons'); media_buttons($editor_id); }
public static function MultilineTextboxInterface($customField, $inputName, $groupCounter, $fieldCounter) { $customFieldId = ''; $mf_post_id = apply_filters('mf_source_post_data', @$_REQUEST['post']); $idField = RCCWP_WritePostPage::changeNameInput($inputName); if (isset($mf_post_id)) { $customFieldId = $customField->id; $value = RCCWP_CustomField::GetCustomFieldValues(true, $mf_post_id, $customField->name, $groupCounter, $fieldCounter); if (isset($customField->properties['hide-visual-editor']) && !(int) $customField->properties['hide-visual-editor']) { if (!RCCWP_Options::Get('dont-remove-tmce')) { $value = apply_filters('the_editor_content', $value); } } } else { $value = ""; } $value = apply_filters('mf_multiline_value', $value, $groupCounter, $fieldCounter); $inputHeight = (int) $customField->properties['height']; $inputWidth = (int) $customField->properties['width']; $hideEditor = @(int) $customField->properties['hide-visual-editor']; if (isset($customField->properties['strict-max-length']) && $customField->properties['strict-max-length'] == 1) { $maxlength = ' maxlength="' . $customField->properties['height'] * $customField->properties['width'] . '"'; } else { $maxlength = ''; } $requiredClass = ""; if ($customField->required_field) { $requiredClass = "field_required"; } $pre_text = ''; $hide_visual_editor = RCCWP_Options::Get('hide-visual-editor'); if ($hide_visual_editor == '' || $hide_visual_editor == 0) { if (!$hideEditor) { $pre_text = "pre_editor"; ?> <div class="mf_custom_field"> <div class="tab_multi_mf"> <a onclick="del_editor('<?php echo $idField; ?> ');" class="edButtonHTML_mf">HTML</a> <a onclick="add_editor('<?php echo $idField; ?> ');" class="edButtonHTML_mf" >Visual</a> </div> <?php } } $classEditor = 'mf_editor'; if ($hideEditor) { $classEditor = ''; $pre_text = ''; } ?> <div class="mul_mf"> <?php if ($hide_visual_editor == '' || $hide_visual_editor == 0) { ?> <?php if (!$hideEditor) { ?> <div id="wp-<?php echo $idField; ?> -media-buttons" class="mf_media_button_div"> <?php // WP 3.3 changed here, so you need the media buttons on the editor for the tinyMCE plugin to work require_once ABSPATH . 'wp-admin/includes/media.php'; ?> <?php media_buttons($idField); ?> </div> <?php } ?> <?php } ?> <textarea <?php if ($customField->required_field) { echo 'validate="required:true"'; } ?> class="<?php echo $requiredClass; ?> <?php echo $classEditor; ?> <?php echo $pre_text; ?> " tabindex="3" id="<?php echo $idField; ?> " name="<?php echo $inputName; ?> " rows="<?php echo $inputHeight; ?> " cols="<?php echo $inputWidth; ?> "<?php echo $maxlength; ?> ><?php echo $value; ?> </textarea> <?php if (isset($customField->properties['strict-max-length']) && $customField->properties['strict-max-length'] == 1) { ?> <script language="javascript"> jQuery(document).ready(function(){ var maximal = parseInt(jQuery('#<?php echo $idField; ?> ').attr('maxlength')); var actual = parseInt(jQuery('#<?php echo $idField; ?> ').val().length); jQuery('#<?php echo $idField; ?> ').parents(".mf-field").find('.charsRemaining').html(maximal - actual); }); </script> <?php } ?> </div><?php if (!$hideEditor) { ?> </div><?php } ?> <?php if ($customField->required_field) { ?> <div class="mf_message_error"><label for="<?php echo $idField; ?> " class="error_magicfields error"><?php _e("This field is required", $mf_domain); ?> </label></div> <?php } ?> <?php }