Changeset 1520411
- Timestamp:
- 10/23/2016 03:22:14 PM (9 years ago)
- Location:
- acf-qtranslate/trunk
- Files:
-
- 7 edited
-
acf-qtranslate.php (modified) (1 diff)
-
assets/acf_5/qtranslatex.js (modified) (3 diffs)
-
assets/common.css (modified) (1 diff)
-
assets/common.js (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
src/acf_5/fields/wysiwyg.php (modified) (5 diffs)
-
src/plugin.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
acf-qtranslate/trunk/acf-qtranslate.php
r1519271 r1520411 4 4 Plugin URI: http://github.com/funkjedi/acf-qtranslate 5 5 Description: Provides multilingual versions of the text, text area, and wysiwyg fields. 6 Version: 1.7.1 06 Version: 1.7.11 7 7 Author: funkjedi 8 8 Author URI: http://funkjedi.com -
acf-qtranslate/trunk/assets/acf_5/qtranslatex.js
r1154984 r1520411 60 60 61 61 if (jQuery(field).hasClass('wp-editor-area')) { 62 qTranslateConfig.qtx.addContentHooksTinyMCE();62 //qTranslateConfig.qtx.addContentHooksTinyMCE(); 63 63 64 64 // We must manually trigger load event so that the … … 75 75 }); 76 76 77 qTranslateConfig.qtx.addContentHooksTinyMCE();77 //qTranslateConfig.qtx.addContentHooksTinyMCE(); 78 78 79 79 // Watch and remove content hooks when fields are removed … … 81 81 // we must hook into handler and perform updates there 82 82 var _hooked_repeater_remove = acf.fields.repeater.remove; 83 acf.fields.repeater.remove = function( event) {84 var row = event.$el.closest('.acf-row');83 acf.fields.repeater.remove = function($el) { 84 var row = ($el.$el || $el).closest('.acf-row'); // support old versions of ACF5PRO as well 85 85 row.find(_.toArray(field_types).join(',')).filter('.qtranxs-translatable').each(function() { 86 86 qTranslateConfig.qtx.removeContentHook(this); 87 87 }); 88 88 // call the original handler 89 _hooked_repeater_remove.call(this, event);89 _hooked_repeater_remove.call(this, $el); 90 90 }; 91 91 -
acf-qtranslate/trunk/assets/common.css
r1519271 r1520411 29 29 } 30 30 31 .multi-language-field .wp-switch-editor {31 .multi-language-field > .wp-switch-editor { 32 32 float: right; 33 33 position: relative; -
acf-qtranslate/trunk/assets/common.js
r1519271 r1520411 45 45 if (id) { // WP 4.3 46 46 window.switchEditors.go(id, editor); 47 } else { // WP < 4.3 48 switchEditors.switchto(this); 47 } else { // WP < 4.3 48 switchEditors.switchto(this); 49 49 } 50 50 }); -
acf-qtranslate/trunk/readme.txt
r1519271 r1520411 59 59 60 60 == Changelog == 61 62 = 1.7.11 = 63 * Core: Enable support for ACF included within theme 64 * Bug Fix: Fixed do_action support when removing repeater rows 65 * Bug Fix: Removing qTranslateConfig.qtx.addContentHooksTinyMCE calls 61 66 62 67 = 1.7.10 = -
acf-qtranslate/trunk/src/acf_5/fields/wysiwyg.php
r1519271 r1520411 35 35 ); 36 36 37 // Create an acf version of the_content filter (acf_the_content) 38 if( !empty($GLOBALS['wp_embed']) ) { 39 add_filter( 'acf_the_content', array( $GLOBALS['wp_embed'], 'run_shortcode' ), 8 ); 40 add_filter( 'acf_the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 ); 41 } 42 43 add_filter( 'acf_the_content', 'capital_P_dangit', 11 ); 44 add_filter( 'acf_the_content', 'wptexturize' ); 45 add_filter( 'acf_the_content', 'convert_smilies' ); 46 add_filter( 'acf_the_content', 'convert_chars' ); 47 add_filter( 'acf_the_content', 'wpautop' ); 48 add_filter( 'acf_the_content', 'shortcode_unautop' ); 49 add_filter( 'acf_the_content', 'prepend_attachment' ); 50 add_filter( 'acf_the_content', 'do_shortcode', 11); 37 // add acf_the_content filters 38 $this->add_filters(); 51 39 52 40 // actions … … 69 57 function render_field($field) { 70 58 59 // global 60 global $wp_version; 61 62 71 63 // enqueue 72 64 acf_enqueue_uploader(); 73 65 66 74 67 // vars 75 68 $id = uniqid('acf-editor-'); 76 //$id = $field['id'] . '-' . uniqid(); 77 $mode = 'html'; 69 $default_editor = 'html'; 78 70 $show_tabs = true; 71 $button = ''; 72 79 73 80 74 // get height … … 82 76 $height = max( $height, 300 ); // minimum height is 300 83 77 78 84 79 // detect mode 85 // case: visual tab only 86 if ($field['tabs'] == 'visual') { 87 $mode = 'tmce'; 80 if( !user_can_richedit() ) { 81 88 82 $show_tabs = false; 89 } 90 // case: text tab only 91 elseif ($field['tabs'] == 'text') { 83 84 } elseif( $field['tabs'] == 'visual' ) { 85 86 // case: visual tab only 87 $default_editor = 'tinymce'; 92 88 $show_tabs = false; 93 } 94 // case: both tabs 95 elseif (wp_default_editor() == 'tinymce') { 96 $mode = 'tmce'; 97 } 89 90 } elseif( $field['tabs'] == 'text' ) { 91 92 // case: text tab only 93 $show_tabs = false; 94 95 } elseif( wp_default_editor() == 'tinymce' ) { 96 97 // case: both tabs 98 $default_editor = 'tinymce'; 99 100 } 101 102 103 // must be logged in tp upload 104 if( !current_user_can('upload_files') ) { 105 106 $field['media_upload'] = 0; 107 108 } 109 98 110 99 111 // mode 100 $switch_class = ($mode === 'html') ? 'html-active' : 'tmce-active'; 112 $switch_class = ($default_editor === 'html') ? 'html-active' : 'tmce-active'; 113 101 114 102 115 // filter value for editor 103 remove_all_filters('acf_the_editor_content'); 104 105 global $q_config, $wp_version; 106 116 remove_filter( 'acf_the_editor_content', 'format_for_editor', 10, 2 ); 117 remove_filter( 'acf_the_editor_content', 'wp_htmledit_pre', 10, 1 ); 118 remove_filter( 'acf_the_editor_content', 'wp_richedit_pre', 10, 1 ); 119 120 107 121 // WP 4.3 108 122 if( version_compare($wp_version, '4.3', '>=' ) ) { 109 add_filter( 'acf_the_editor_content', 'format_for_editor', 10, 2 ); 123 124 add_filter( 'acf_the_editor_content', 'format_for_editor', 10, 2 ); 125 126 $button = 'data-wp-editor-id="' . $id . '"'; 127 110 128 // WP < 4.3 111 129 } else { 112 $function = ($mode === 'html') ? 'wp_htmledit_pre' : 'wp_richedit_pre'; 113 add_filter('acf_the_editor_content', $function, 10, 1); 114 } 115 130 131 $function = ($default_editor === 'html') ? 'wp_htmledit_pre' : 'wp_richedit_pre'; 132 133 add_filter('acf_the_editor_content', $function, 10, 1); 134 135 $button = 'onclick="switchEditors.switchto(this);"'; 136 137 } 138 139 140 global $q_config; 141 116 142 $languages = qtrans_getSortedLanguages(true); 117 143 $values = qtrans_split($field['value'], $quicktags = true); … … 127 153 $uid = uniqid('acf-editor-'); 128 154 foreach ($languages as $language): 129 155 130 156 $id = $uid . "-$language"; 131 157 $name = $field['name'] . "[$language]"; … … 134 160 $class .= ' current-language'; 135 161 } 162 136 163 // WP 4.3 137 164 if( version_compare($wp_version, '4.3', '>=' ) ) { 138 $button = 'data-wp-editor-id="' . $id . '"'; 165 $button = 'data-wp-editor-id="' . $id . '"'; 139 166 // WP < 4.3 140 } else { 141 $button = 'onclick="switchEditors.switchto(this);"'; 167 } else { 168 $button = 'onclick="switchEditors.switchto(this);"'; 142 169 } 143 144 $value = apply_filters('acf_the_editor_content', $values[$language], $ mode);145 170 171 $value = apply_filters('acf_the_editor_content', $values[$language], $default_editor); 172 146 173 ?> 147 174 <div id="wp-<?php echo $id; ?>-wrap" class="acf-editor-wrap wp-core-ui wp-editor-wrap <?php echo $class; ?>" data-toolbar="<?php echo $field['toolbar']; ?>" data-upload="<?php echo $field['media_upload']; ?>" data-language="<?php echo $language; ?>"> -
acf-qtranslate/trunk/src/plugin.php
r1155412 r1520411 15 15 */ 16 16 public function __construct() { 17 add_action(' plugins_loaded', array($this, 'plugins_loaded'), 3);17 add_action('after_setup_theme', array($this, 'after_setup_theme'), 3); 18 18 add_action('acf/input/admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); 19 19 add_action('admin_menu', array($this, 'admin_menu')); … … 27 27 * @return void 28 28 */ 29 public function plugins_loaded() {29 public function after_setup_theme() { 30 30 if ($this->acf_enabled() && $this->qtranslate_variant_enabled()) { 31 31
Note: See TracChangeset
for help on using the changeset viewer.