Plugin Directory

Changeset 906974


Ignore:
Timestamp:
05/02/2014 04:49:47 PM (12 years ago)
Author:
hunk
Message:

update for wp 3.9

Location:
magic-fields/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • magic-fields/trunk/MF_Constant.php

    r763762 r906974  
    315315    return FALSE;
    316316}
     317
     318function is_wp39(){
     319    global $wp_version;
     320   
     321    if(substr($wp_version, 0, 3) >= 3.9)
     322        return TRUE;
     323     
     324    return FALSE;
     325}
  • magic-fields/trunk/Main.php

    r763762 r906974  
    55Description: Create custom write panels and easily retrieve their values in your templates.
    66Author: Hunk and Gnuget
    7 Version: 1.6.1.1
     7Version: 1.6.2
    88Author URI: http://magicfields.org
    99*/
  • magic-fields/trunk/RCCWP_WritePostPage.php

    r498304 r906974  
    115115    <script type="text/javascript">
    116116        var mf_path = "<?php echo MF_URI ?>" ;
    117                 var nonce_ajax_upload = "<?php echo wp_create_nonce('once_ajax_uplooad') ?>";
     117        var nonce_ajax_upload = "<?php echo wp_create_nonce('once_ajax_uplooad') ?>";
     118        <?php $mceString = 'Control'; if(is_wp39()){ $mceString = 'Editor'; } ?>
     119        var mceString = "<?php echo $mceString ?>";
    118120    </script>
    119121    <?php
     
    10851087        <div class="mul_mf">
    10861088       
    1087         <div style="display: none" id="wp-<?php echo $idField ?>-media-buttons">
    1088             <?php
    1089             // WP 3.3 changed here, so you need the media buttons on the editor for the tinyMCE plugin to work
    1090             require_once( ABSPATH . 'wp-admin/includes/media.php' ) ?>
    1091             <?php media_buttons( $idField ) ?>
    1092         </div>
     1089        <?php if ($hide_visual_editor == '' || $hide_visual_editor == 0 ){ ?>
     1090            <?php if(!$hideEditor){ ?>
     1091                <div id="wp-<?php echo $idField ?>-media-buttons" class="mf_media_button_div">
     1092                    <?php
     1093                    // WP 3.3 changed here, so you need the media buttons on the editor for the tinyMCE plugin to work
     1094                    require_once( ABSPATH . 'wp-admin/includes/media.php' ) ?>
     1095                    <?php media_buttons( $idField ) ?>
     1096                </div>
     1097            <?php } ?>
     1098        <?php } ?>
    10931099       
    10941100        <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>
  • magic-fields/trunk/js/custom_fields/editor_validate.js

    r394087 r906974  
    8080  new_valor = switchEditors.wpautop(new_valor);
    8181  jQuery('#'+id).val(new_valor);
    82   tinyMCE.execCommand('mceAddControl', false, id);
     82  tinyMCE.execCommand('mceAdd'+mceString, false, id);
    8383}
     84
    8485// Remove the editor (button)
    8586function del_editor(id){
    86   tinyMCE.execCommand('mceRemoveControl', false, id);
     87  tinyMCE.execCommand('mceRemove'+mceString, false, id);
    8788}
  • magic-fields/trunk/js/custom_fields/media_image.js

    r763762 r906974  
    2525          wpActiveEditor = a.id.replace('_add_media', '');
    2626        }, 500 );
     27    });
     28
     29    //focus for visual editor wp 3.8
     30    jQuery(document).on('click',".mf_media_button_div > .add_media",function(){
     31    var idElem = jQuery(this).parent('div.mf_media_button_div').attr('id');
     32    console.log(idElem);
     33    idElem = idElem.replace(/wp-/, "");
     34    idElem = idElem.replace(/-media-buttons/, "");
     35    tinyMCE.get(idElem).focus();
    2736    });
    2837   
  • magic-fields/trunk/js/groups.js

    r763762 r906974  
    852852        // function fix the problem of block of the editor visual textareas
    853853        start: function() {
     854
    854855            id =  jQuery(this).attr("id");
    855             jQuery("#"+id+" :input[type='textarea'].mf_editor").each( function(inputField){
     856            jQuery("#"+id+" textarea.mf_editor").each( function(inputField){         
    856857                var editor_text = jQuery(this).attr('id');
    857858                if(tinyMCE.get(editor_text)){
    858                     tinyMCE.execCommand('mceRemoveControl', false, editor_text);
     859                    tinyMCE.execCommand('mceRemove'+mceString, false, editor_text);
    859860                    jQuery('#'+editor_text).addClass('temp_remove_editor');
    860861                }
    861862            });
    862863        },
    863           stop : function(){
    864               id =  jQuery(this).attr("id").split("_")[3];
    865               kids =  jQuery("#write_panel_wrap_"+id).children().filter(".magicfield_group");
    866               for(i=0;i < kids.length; i++){
    867                   groupCounter =  kids[i].id.split("_")[2];
    868                   ids = kids[i].id.split("_")[3];
    869                   jQuery("#order_"+groupCounter+"_"+ids).val(i+1);
    870                   jQuery("#counter_"+groupCounter+"_"+ids).text((i+1));
    871               }
     864      stop : function(){
     865        id =  jQuery(this).attr("id").split("_")[3];
     866        kids =  jQuery("#write_panel_wrap_"+id).children().filter(".magicfield_group");
     867        for(i=0;i < kids.length; i++){
     868            groupCounter =  kids[i].id.split("_")[2];
     869            ids = kids[i].id.split("_")[3];
     870            jQuery("#order_"+groupCounter+"_"+ids).val(i+1);
     871            jQuery("#counter_"+groupCounter+"_"+ids).text((i+1));
     872        }
    872873            //add the editor visual in textareas
    873             jQuery("#"+jQuery(this).attr("id")+" :input[type='textarea'].temp_remove_editor").each( function(inputField){
     874            jQuery("#"+jQuery(this).attr("id")+" textarea.temp_remove_editor").each( function(inputField){
    874875                var editor_text = jQuery(this).attr('id');
    875                 tinyMCE.execCommand('mceAddControl', false, editor_text);
     876                tinyMCE.execCommand('mceAdd'+mceString, false, editor_text);
    876877                jQuery('#'+editor_text).removeClass('temp_remove_editor');
    877878            });
     
    12061207    jQuery(".pre_editor", context).each( function(inputField){
    12071208      var editor_text = jQuery(this).attr('id');
    1208         tinyMCE.execCommand('mceAddControl', true, editor_text);
     1209        tinyMCE.execCommand('mceAdd'+mceString, true, editor_text);
    12091210        jQuery('#'+editor_text, context).removeClass('pre_editor');
    12101211    });
  • magic-fields/trunk/readme.txt

    r763762 r906974  
    22Contributors: hunk, Gnuget
    33Tags: custom write panel, custom, write panel, cms, magic fields
    4 Tested up to: Wordpress 3.6
     4Tested up to: Wordpress 3.9
    55Requires at least: 2.9
    66Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=edgar%40programador%2ecom&lc=GB&item_name=Donation%20Magic%20Fields&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
    7 Stable tag: 1.6.1.1
     7Stable tag: 1.6.2
    88Description: Magic Fields  is a feature rich WordPress CMS plugin.
    99
     
    2828
    2929== Changelog ==
     30
     31= 1.6.2 =
     32    * fix issue visual editor (WP 3.9)
     33    * fix issue drag and drop multiline
    3034
    3135= 1.6.1.1 =
Note: See TracChangeset for help on using the changeset viewer.