Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tinymce fixes + patch from latest 1.x

  • Loading branch information...
commit 20115f7073cf7e81f8d4433c3787c2c4948c1d0e 1 parent 7525803
@sc0ttkclark sc0ttkclark authored
Showing with 33 additions and 14 deletions.
  1. +18 −4 classes/PodsForm.php
  2. +15 −10 deprecated/wp-editor/wp-editor.php
View
22 classes/PodsForm.php
@@ -137,15 +137,29 @@ protected function field_tinymce ($name, $value = null, $options = null) {
$attributes = self::merge_attributes($attributes, $options);
if (isset($options['default']) && strlen($value) < 1)
$value = $options['default'];
+
$value = apply_filters('pods_form_ui_field_' . $type . '_value', $value, $name, $attributes, $options);
$settings = null;
if (isset($options['settings']))
$settings = $options['settings'];
- global $wp_editor;
- if ( !class_exists('WP_Editor') && !function_exists('wp_editor') )
- require_once PODS_DIR . "/ui/wp-editor/wp-editor.php";
- $wp_editor->editor($value, $attributes['id'], $settings);
+ $media_bar = false;
+ if (!(defined('PODS_DISABLE_FILE_UPLOAD') && true === PODS_DISABLE_FILE_UPLOAD)
+ && !(defined('PODS_UPLOAD_REQUIRE_LOGIN') && is_bool(PODS_UPLOAD_REQUIRE_LOGIN) && true === PODS_UPLOAD_REQUIRE_LOGIN && !is_user_logged_in())
+ && !(defined('PODS_UPLOAD_REQUIRE_LOGIN') && !is_bool(PODS_UPLOAD_REQUIRE_LOGIN) && (!is_user_logged_in() || !current_user_can(PODS_UPLOAD_REQUIRE_LOGIN)))) {
+ $media_bar = true;
+ }
+
+ if (function_exists('wp_editor')) {
+ if (!isset($settings['media_button']))
+ $settings['media_button'] = $media_bar;
+ wp_editor($value, $attributes['id'], $settings);
+ }
+ else {
+ global $wp_editor;
+ require_once PODS_DIR . "/deprecated/wp-editor/wp-editor.php";
+ echo $wp_editor->editor($value, $attributes['id'], $settings, $media_bar);
+ }
}
/**
View
25 deprecated/wp-editor/wp-editor.php
@@ -5,29 +5,34 @@
// Usage:
// global $wp_editor;
// $wp_editor->editor($content, $editor_id, $settings, $media_buttons);
-if ( !class_exists('WP_Editor') && !function_exists('wp_editor') ) :
-class WP_Editor {
+if ( !class_exists('WP_Pre_33_Editor') ) :
+class WP_Pre_33_Editor {
var $editor_ids = array();
var $settings = array();
var $editor_loaded;
var $media_buttons;
- function __construct () {
+ function __construct() {
add_filter( 'tiny_mce_before_init', array($this, 'loaded_test') );
}
- function wp_default_editor () {
+ function wp_default_editor() {
return wp_default_editor();
}
- function editor ( $content, $editor_id, $settings = array(), $media_buttons = true ) {
+ function editor( $content, $editor_id, $settings = array(), $media_buttons = true ) {
+ if (function_exists('wp_editor')) {
+ $settings['media_buttons'] = $media_buttons;
+ wp_editor($content, $editor_id, $settings);
+ return;
+ }
$this->editor_ids[] = $editor_id;
$set = wp_parse_args( $settings, array(
'wpautop' => true, // use wpautop?
- 'wp_buttons_css' => PODS_URL . '/ui/wp-editor/editor-buttons.css', // styles for both visual and HTML editors buttons
+ 'wp_buttons_css' => PODS_URL . '/deprecated/wp-editor/editor-buttons.css', // styles for both visual and HTML editors buttons
'editor_class' => 'wp-editor-area',
'upload_link_title' => 'Upload and insert images or other media',
'media_buttons_context' => '',
@@ -101,12 +106,12 @@ function editor ( $content, $editor_id, $settings = array(), $media_buttons = tr
$this->settings[$editor_id] = $set;
}
- function loaded_test ($r) {
+ function loaded_test($r) {
$this->editor_loaded = true;
return $r;
}
- function disable_fullscreen ($init) {
+ function disable_fullscreen($init) {
$plugins = preg_split('/[ ,]+/', $init['plugins']);
$plugins = array_diff( $plugins, array('wpfullscreen') );
$plugins[] = 'fullscreen';
@@ -118,7 +123,7 @@ function disable_fullscreen ($init) {
return $init;
}
- function editor_js () {
+ function editor_js() {
global $wp_db_version;
$short_load = false;
@@ -276,5 +281,5 @@ function editor_js () {
}
}
global $wp_editor;
-$wp_editor = new WP_Editor;
+$wp_editor = new WP_Pre_33_Editor;
endif; // WP_Editor
Please sign in to comment.
Something went wrong with that request. Please try again.