Plugin Directory

Changeset 1520411


Ignore:
Timestamp:
10/23/2016 03:22:14 PM (9 years ago)
Author:
funkjedi
Message:

Syncing with Github

Location:
acf-qtranslate/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • acf-qtranslate/trunk/acf-qtranslate.php

    r1519271 r1520411  
    44Plugin URI: http://github.com/funkjedi/acf-qtranslate
    55Description: Provides multilingual versions of the text, text area, and wysiwyg fields.
    6 Version: 1.7.10
     6Version: 1.7.11
    77Author: funkjedi
    88Author URI: http://funkjedi.com
  • acf-qtranslate/trunk/assets/acf_5/qtranslatex.js

    r1154984 r1520411  
    6060
    6161                if (jQuery(field).hasClass('wp-editor-area')) {
    62                     qTranslateConfig.qtx.addContentHooksTinyMCE();
     62                    //qTranslateConfig.qtx.addContentHooksTinyMCE();
    6363
    6464                    // We must manually trigger load event so that the
     
    7575        });
    7676
    77         qTranslateConfig.qtx.addContentHooksTinyMCE();
     77        //qTranslateConfig.qtx.addContentHooksTinyMCE();
    7878
    7979        // Watch and remove content hooks when fields are removed
     
    8181        // we must hook into handler and perform updates there
    8282        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
    8585            row.find(_.toArray(field_types).join(',')).filter('.qtranxs-translatable').each(function() {
    8686                qTranslateConfig.qtx.removeContentHook(this);
    8787            });
    8888            // call the original handler
    89             _hooked_repeater_remove.call(this, event);
     89            _hooked_repeater_remove.call(this, $el);
    9090        };
    9191
  • acf-qtranslate/trunk/assets/common.css

    r1519271 r1520411  
    2929}
    3030
    31 .multi-language-field .wp-switch-editor {
     31.multi-language-field > .wp-switch-editor {
    3232    float: right;
    3333    position: relative;
  • acf-qtranslate/trunk/assets/common.js

    r1519271 r1520411  
    4545            if (id) { // WP 4.3
    4646                window.switchEditors.go(id, editor);
    47             } else { // WP < 4.3       
    48                 switchEditors.switchto(this);       
     47            } else { // WP < 4.3
     48                switchEditors.switchto(this);
    4949            }
    5050        });
  • acf-qtranslate/trunk/readme.txt

    r1519271 r1520411  
    5959
    6060== 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
    6166
    6267= 1.7.10 =
  • acf-qtranslate/trunk/src/acf_5/fields/wysiwyg.php

    r1519271 r1520411  
    3535        );
    3636
    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();
    5139
    5240        // actions
     
    6957    function render_field($field) {
    7058
     59        // global
     60        global $wp_version;
     61
     62
    7163        // enqueue
    7264        acf_enqueue_uploader();
    7365
     66
    7467        // vars
    7568        $id = uniqid('acf-editor-');
    76         //$id = $field['id'] . '-' . uniqid();
    77         $mode = 'html';
     69        $default_editor = 'html';
    7870        $show_tabs = true;
     71        $button = '';
     72
    7973
    8074        // get height
     
    8276        $height = max( $height, 300 ); // minimum height is 300
    8377
     78
    8479        // detect mode
    85         // case: visual tab only
    86         if ($field['tabs'] == 'visual') {
    87             $mode = 'tmce';
     80        if( !user_can_richedit() ) {
     81
    8882            $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';
    9288            $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
    98110
    99111        // mode
    100         $switch_class = ($mode === 'html') ? 'html-active' : 'tmce-active';
     112        $switch_class = ($default_editor === 'html') ? 'html-active' : 'tmce-active';
     113
    101114
    102115        // 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
    107121        // WP 4.3
    108122        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
    110128        // WP < 4.3
    111129        } 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
    116142        $languages = qtrans_getSortedLanguages(true);
    117143        $values = qtrans_split($field['value'], $quicktags = true);
     
    127153        $uid = uniqid('acf-editor-');
    128154        foreach ($languages as $language):
    129        
     155
    130156            $id = $uid . "-$language";
    131157            $name = $field['name'] . "[$language]";
     
    134160                $class .= ' current-language';
    135161            }
     162
    136163            // WP 4.3
    137164            if( version_compare($wp_version, '4.3', '>=' ) ) {
    138                 $button = 'data-wp-editor-id="' . $id . '"';               
     165                $button = 'data-wp-editor-id="' . $id . '"';
    139166            // WP < 4.3
    140             } else {   
    141                 $button = 'onclick="switchEditors.switchto(this);"';   
     167            } else {
     168                $button = 'onclick="switchEditors.switchto(this);"';
    142169            }
    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
    146173            ?>
    147174            <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  
    1515     */
    1616    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);
    1818        add_action('acf/input/admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
    1919        add_action('admin_menu',                      array($this, 'admin_menu'));
     
    2727     * @return void
    2828     */
    29     public function plugins_loaded() {
     29    public function after_setup_theme() {
    3030        if ($this->acf_enabled() && $this->qtranslate_variant_enabled()) {
    3131
Note: See TracChangeset for help on using the changeset viewer.