Changeset 906980
- Timestamp:
- 05/02/2014 04:57:38 PM (12 years ago)
- Location:
- magic-fields-2/trunk
- Files:
-
- 8 edited
-
admin/mf_post.php (modified) (4 diffs)
-
css/mf_field_base.css (modified) (1 diff)
-
field_types/multiline_field/multiline_field.js (modified) (5 diffs)
-
field_types/multiline_field/multiline_field.php (modified) (2 diffs)
-
js/mf_admin.js (modified) (2 diffs)
-
main.php (modified) (2 diffs)
-
mf_extra.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
magic-fields-2/trunk/admin/mf_post.php
r761841 r906980 395 395 wp_enqueue_script( 'mf_sortable_groups', MF_BASENAME.'js/mf_sortable_groups.js', array( 'jquery-ui-sortable' ) ); 396 396 397 $mceAddString = "mceAddControl"; 398 $mceRemoveString = "mceRemoveControl"; 399 if(is_wp39()){ 400 $mceAddString = "mceAddEditor"; 401 $mceRemoveString = "mceRemoveEditor"; 402 } 403 397 404 //global mf js 398 405 $js_vars = array( … … 400 407 'mf_player_url' => MF_BASENAME . 'js/singlemp3player.swf', 401 408 'mf_validation_error_msg' => __('Sorry, some required fields are missing. Please provide values for any highlighted fields and try again.',$mf_domain), 402 'mf_image_media_set' => __('Insert into field',$mf_domain) 409 'mf_image_media_set' => __('Insert into field',$mf_domain), 410 'mf_mceAddString' => $mceAddString, 411 'mf_mceRemoveString' => $mceRemoveString 403 412 ); 404 413 wp_localize_script( 'mf_field_base', 'mf_js', $js_vars ); … … 421 430 /* only add of editor support no exits for the post type*/ 422 431 if( (in_array('multiline',$fields) || in_array('image_media',$fields) ) && !post_type_supports($post_type,'editor' ) ){ 423 add_thickbox();432 /*add_thickbox(); 424 433 wp_enqueue_script('media-upload'); 425 434 wp_enqueue_script('editor'); // load admin/mf_editor.js (switchEditor) 426 435 mf_autoload('mf_tiny_mce'); // load admin/mf_tiny_mce.php (tinyMCE) 427 436 add_action( 'admin_print_footer_scripts', 'mf_tiny_mce', 25 ); // embed tinyMCE 428 add_action( 'admin_print_footer_scripts', array($this, 'media_buttons_add_mf'), 51 ); 437 add_action( 'admin_print_footer_scripts', array($this, 'media_buttons_add_mf'), 51 );*/ 429 438 } 430 439 … … 478 487 } 479 488 } 480 489 490 public function check_exist_visual_editor(){ 491 492 if( !empty( $_GET['post']) && is_numeric( $_GET['post'] ) ) {//when the post already exists 493 $post_type = get_post_type($_GET['post']); 494 }else{ //Creating a new post 495 $post_type = (!empty($_GET['post_type'])) ? $_GET['post_type'] : 'post'; 496 } 497 498 $fields = $this->get_unique_custom_fields_by_post_type($post_type); 499 500 /* add tiny_mce script */ 501 /* only add of editor support no exits for the post type*/ 502 if( (in_array('multiline',$fields) || in_array('image_media',$fields) ) && !post_type_supports($post_type,'editor' ) ){ 503 echo "<div style='display:none'>"; 504 echo wp_editor('','you_know_nothing'); 505 echo "</div>"; 506 } 507 508 509 510 } 481 511 public function media_buttons_add_mf(){ 482 512 -
magic-fields-2/trunk/css/mf_field_base.css
r640332 r906980 172 172 .multiline_custom_field iframe{ Background: white !important; } 173 173 textarea.mf_editor { width: 99%; padding: 8px;} 174 .mf-field-ui .tab_multi_mf { float: left;}174 .mf-field-ui .tab_multi_mf { float: right;} 175 175 .mf-field-ui .tab_multi_mf a { 176 176 float: right; -
magic-fields-2/trunk/field_types/multiline_field/multiline_field.js
r454843 r906980 3 3 jQuery(".multiline_custom_field .add_editor_mf").each( function(index,value){ 4 4 var editor_text = jQuery(this).attr('id'); 5 tinyMCE.execCommand( 'mceAddControl', true, editor_text);5 tinyMCE.execCommand(mf_js.mf_mceAddString, true, editor_text); 6 6 jQuery(this).removeClass('add_editor_mf'); 7 7 }); … … 13 13 var editor_text = jQuery(this).attr('id'); 14 14 if(tinyMCE.get(editor_text)){ 15 tinyMCE.execCommand( 'mceRemoveControl', false, editor_text);15 tinyMCE.execCommand(mf_js.mf_mceRemoveString, false, editor_text); 16 16 jQuery('#'+editor_text).addClass('temp_remove_editor'); 17 17 } … … 23 23 jQuery("#"+sort_group_id+" .multiline_custom_field .temp_remove_editor").each( function(){ 24 24 var editor_text = jQuery(this).attr('id'); 25 tinyMCE.execCommand( 'mceAddControl', false, editor_text);25 tinyMCE.execCommand(mf_js.mf_mceAddString, false, editor_text); 26 26 jQuery('#'+editor_text).removeClass('temp_remove_editor'); 27 27 }); … … 44 44 new_valor = switchEditors.wpautop(new_valor); 45 45 jQuery('#'+id).val(new_valor); 46 tinyMCE.execCommand( 'mceAddControl', false, id);46 tinyMCE.execCommand(mf_js.mf_mceAddString, false, id); 47 47 } 48 48 } … … 50 50 function del_editor(id){ 51 51 if('undefined' != typeof tinyMCEPreInit){ 52 tinyMCE.execCommand( 'mceRemoveControl', false, id);52 tinyMCE.execCommand(mf_js.mf_mceRemoveString, false, id); 53 53 } 54 54 } -
magic-fields-2/trunk/field_types/multiline_field/multiline_field.php
r498300 r906980 95 95 $output .= sprintf('<a onclick="del_editor(\'%s\');" class="edButtonHTML_mf">HTML</a>',$field['input_id']); 96 96 $output .= sprintf('<a onclick="add_editor(\'%s\');" class="edButtonHTML_mf current" >Visual</a>',$field['input_id']); 97 $output .= sprintf('</div> ');97 $output .= sprintf('</div><br /><br />'); 98 98 $class = 'pre_editor add_editor_mf'; 99 99 … … 102 102 } 103 103 } 104 printf('<div style="display: none" id="wp-%s-media-buttons">',$field['input_id']); 105 require_once( ABSPATH . 'wp-admin/includes/media.php' ); 106 media_buttons( $field['input_id'] ); 107 printf('</div>'); 104 105 if($field['options']['hide_visual'] == 0 && user_can_richedit() ){ 106 printf('<div style="display: none1" id="wp-%s-media-buttons" class="wp-media-buttons mf_media_button_div" >',$field['input_id']); 107 require_once( ABSPATH . 'wp-admin/includes/media.php' ); 108 media_buttons( $field['input_id'] ); 109 printf('</div>'); 110 } 108 111 109 112 $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); -
magic-fields-2/trunk/js/mf_admin.js
r761841 r906980 244 244 245 245 $(document).on('click',".mce_add_image , .mce_add_video , .mce_add_audio , .mce_add_media",function(){ 246 console.log('qwerty'); 247 248 246 249 window.mf_field_id = ''; 247 var a = this; 250 var a = this; 251 252 248 253 // When a mce button is clicked, we have to hotswap the activeEditor instance, else the image will be inserted into the wrong tinyMCE box (current editor) 249 254 setTimeout( function() { … … 252 257 }, 500 ); 253 258 259 }); 260 261 //focus for visual editor wp 3.8 262 $(document).on('click',".mf_media_button_div > .add_media",function(){ 263 var idElem = $(this).parent('div.mf_media_button_div').attr('id'); 264 idElem = idElem.replace(/wp-/, ""); 265 idElem = idElem.replace(/-media-buttons/, ""); 266 tinyMCE.get(idElem).focus(); 254 267 }); 255 268 }); -
magic-fields-2/trunk/main.php
r864350 r906980 4 4 Plugin URI: http://magicfields.org 5 5 Description: Create custom fields for your post types 6 Version: 2.2. 16 Version: 2.2.2 7 7 Author: Hunk and Gnuget 8 8 Author URI: http://magicfields.org … … 238 238 /* Load JS and CSS for post page */ 239 239 $css_js = new mf_post(); 240 $css_js->check_exist_visual_editor(); 240 241 $css_js->load_js_css_base(); 241 242 $css_js->load_js_css_fields(); -
magic-fields-2/trunk/mf_extra.php
r761841 r906980 67 67 68 68 } 69 70 if( !function_exists('is_wp39') ){ 71 72 function is_wp39(){ 73 $wp_version = floatval(get_bloginfo('version')); 74 75 if( $wp_version >= 3.9 ) return TRUE; 76 77 return FALSE; 78 } 79 80 } -
magic-fields-2/trunk/readme.txt
r864350 r906980 2 2 Contributors: hunk, Gnuget 3 3 Tags: cms, post types, fields, taxonomies 4 Tested up to: Wordpress 3. 8.14 Tested up to: Wordpress 3.9 5 5 Requires at least: 3.1 6 6 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=edgar%40programador%2ecom&lc=GB&item_name=Donation%20Magic%20Fields¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest 7 Stable tag: 2.2. 17 Stable tag: 2.2.2 8 8 Description: Magic Fields 2 is a feature rich Wordpress CMS plugin 9 9 … … 26 26 27 27 == Changelog == 28 29 = 2.2.2 = 30 * fix for visual editor in WP 3.9 28 31 29 32 = 2.2.1 =
Note: See TracChangeset
for help on using the changeset viewer.