Custom Field Template - Version 1.9.3

Version Description

  • Bugfix: level attribute.
  • Bugfix: image insert in IE.
Download this release

Release Info

Developer Hiroaki Miyashita
Plugin Icon 128x128 Custom Field Template
Version 1.9.3
Comparing to
See all releases

Code changes from version 1.9.2 to 1.9.3

Files changed (2) hide show
  1. custom-field-template.php +25 -13
  2. readme.txt +6 -2
custom-field-template.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Custom Field Template
4
  Plugin URI: http://wpgogo.com/development/custom-field-template.html
5
  Description: This plugin adds the default custom fields on the Write Post/Page.
6
  Author: Hiroaki Miyashita
7
- Version: 1.9.2
8
  Author URI: http://wpgogo.com/
9
  */
10
 
@@ -2267,10 +2267,18 @@ tmp.find('."'input[type=text],input[type=hidden],input[type=file]'".').val('."''
2267
  ' else { ed = tinyMCE.get("content"); if(ed) {if(!ed.isHidden()) isTinyMCE = true;}}' . "\n" .
2268
  ' if ( typeof tinyMCE != "undefined" && isTinyMCE && !ed.isHidden() ) {' . "\n" .
2269
  ' ed.focus();' . "\n" .
2270
- ' //if (tinymce.isIE)' . "\n" .
2271
- ' //ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);' . "\n" .
2272
- ' if ( h.indexOf("[caption") != -1 )' . "\n" .
2273
- ' h = ed.plugins.wpeditimage._do_shcode(h);' . "\n" .
 
 
 
 
 
 
 
 
2274
  ' ed.execCommand("mceInsertContent", false, h);' . "\n" .
2275
  ' } else {' . "\n" .
2276
  ' if ( tmpFocus ) edInsertContent(tmpFocus, h);' . "\n" .
@@ -2626,7 +2634,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
2626
  }
2627
 
2628
  function edit_meta_value( $id, $post ) {
2629
- global $wpdb, $wp_version;
2630
  $options = $this->get_custom_field_template_data();
2631
 
2632
  if( !isset( $id ) || isset($_REQUEST['post_ID']) )
@@ -2691,6 +2699,11 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
2691
  //if ( is_numeric($data['parentSN']) ) $field_key = $data['parentSN'];
2692
  $name = $this->sanitize_name( $title );
2693
  $title = $wpdb->escape(stripcslashes(trim($title)));
 
 
 
 
 
2694
 
2695
  unset($field_key);
2696
  if ( isset($_REQUEST[$name]) && is_array($_REQUEST[$name]) ) :
@@ -2725,10 +2738,9 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
2725
  if ( isset($data['valueCount']) && $data['valueCount'] == true ) :
2726
  $options['value_count'][$title][$value] = $this->set_value_count($title, $value, $id)+1;
2727
  endif;
2728
-
2729
- if ( $data['type'] == 'textarea' && isset($_REQUEST['TinyMCE_' . $name . trim($_REQUEST[ $name."_rand" ][$i]) . '_size']) ) {
2730
- preg_match('/cw=[0-9]+&ch=([0-9]+)/', $_REQUEST['TinyMCE_' . $name . trim($_REQUEST[ $name."_rand" ][$i]) . '_size'], $matched);
2731
- $options['tinyMCE'][$id][$name][$i] = (int)($matched[1]/20);
2732
  }
2733
  $save_value[$title][] = $value;
2734
  elseif ( isset($data['blank']) && $data['blank'] == true ) :
@@ -2751,7 +2763,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
2751
  endif;
2752
  if( isset($tmpfiles[$name][$field_key][$data['cftnum']]) ) :
2753
  $_FILES[$title] = $tmpfiles[$name][$field_key][$data['cftnum']];
2754
- if ( $value ) :
2755
  if ( empty($data['mediaRemove']) ) wp_delete_attachment($value);
2756
  endif;
2757
 
@@ -2812,7 +2824,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
2812
  endforeach;
2813
 
2814
  if ( !empty($tags_input) && is_array($tags_input) ) :
2815
- foreach ( $tags_input as $tags_key => $tags_value ) :
2816
  if ( class_exists('SimpleTags') && $tags_key == 'post_tag' ) :
2817
  wp_cache_flush();
2818
  $taxonomy = wp_get_object_terms($id, 'post_tag', array());
@@ -3648,7 +3660,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
3648
  function custom_field_template_delete_post($post_id) {
3649
  global $wpdb;
3650
  $options = $this->get_custom_field_template_data();
3651
- $id = $options['posts'][$post_id];
3652
 
3653
  if ( is_numeric($id) ) :
3654
  $fields = $this->get_custom_fields($id);
4
  Plugin URI: http://wpgogo.com/development/custom-field-template.html
5
  Description: This plugin adds the default custom fields on the Write Post/Page.
6
  Author: Hiroaki Miyashita
7
+ Version: 1.9.3
8
  Author URI: http://wpgogo.com/
9
  */
10
 
2267
  ' else { ed = tinyMCE.get("content"); if(ed) {if(!ed.isHidden()) isTinyMCE = true;}}' . "\n" .
2268
  ' if ( typeof tinyMCE != "undefined" && isTinyMCE && !ed.isHidden() ) {' . "\n" .
2269
  ' ed.focus();' . "\n" .
2270
+ ' if ( tinymce.isIE && ed.windowManager.insertimagebookmark )' . "\n" .
2271
+ ' ed.selection.moveToBookmark(ed.windowManager.insertimagebookmark);' . "\n" .
2272
+ ' if ( h.indexOf("[caption") === 0 ) {' . "\n" .
2273
+ ' if ( ed.plugins.wpeditimage )' . "\n" .
2274
+ ' h = ed.plugins.wpeditimage._do_shcode(h);' . "\n" .
2275
+ ' } else if ( h.indexOf("[gallery") === 0 ) {' . "\n" .
2276
+ ' if ( ed.plugins.wpgallery )' . "\n" .
2277
+ ' h = ed.plugins.wpgallery._do_gallery(h);' . "\n" .
2278
+ ' } else if ( h.indexOf("[embed") === 0 ) {' . "\n" .
2279
+ ' if ( ed.plugins.wordpress )' . "\n" .
2280
+ ' h = ed.plugins.wordpress._setEmbed(h);' . "\n" .
2281
+ ' }' . "\n" .
2282
  ' ed.execCommand("mceInsertContent", false, h);' . "\n" .
2283
  ' } else {' . "\n" .
2284
  ' if ( tmpFocus ) edInsertContent(tmpFocus, h);' . "\n" .
2634
  }
2635
 
2636
  function edit_meta_value( $id, $post ) {
2637
+ global $wpdb, $wp_version, $current_user;
2638
  $options = $this->get_custom_field_template_data();
2639
 
2640
  if( !isset( $id ) || isset($_REQUEST['post_ID']) )
2699
  //if ( is_numeric($data['parentSN']) ) $field_key = $data['parentSN'];
2700
  $name = $this->sanitize_name( $title );
2701
  $title = $wpdb->escape(stripcslashes(trim($title)));
2702
+
2703
+ if ( isset($data['level']) && is_numeric($data['level']) && $current_user->user_level < $data['level'] ) :
2704
+ $save_value[$title] = $this->get_post_meta($id, $title, false);
2705
+ continue;
2706
+ endif;
2707
 
2708
  unset($field_key);
2709
  if ( isset($_REQUEST[$name]) && is_array($_REQUEST[$name]) ) :
2738
  if ( isset($data['valueCount']) && $data['valueCount'] == true ) :
2739
  $options['value_count'][$title][$value] = $this->set_value_count($title, $value, $id)+1;
2740
  endif;
2741
+ if ( $data['type'] == 'textarea' && isset($_REQUEST['TinyMCE_' . $name . trim($_REQUEST[ $name."_rand" ][$field_key]) . '_size']) ) {
2742
+ preg_match('/cw=[0-9]+&ch=([0-9]+)/', $_REQUEST['TinyMCE_' . $name . trim($_REQUEST[ $name."_rand" ][$field_key]) . '_size'], $matched);
2743
+ $options['tinyMCE'][$id][$name][$field_key] = (int)($matched[1]/20);
 
2744
  }
2745
  $save_value[$title][] = $value;
2746
  elseif ( isset($data['blank']) && $data['blank'] == true ) :
2763
  endif;
2764
  if( isset($tmpfiles[$name][$field_key][$data['cftnum']]) ) :
2765
  $_FILES[$title] = $tmpfiles[$name][$field_key][$data['cftnum']];
2766
+ if ( isset($value) ) :
2767
  if ( empty($data['mediaRemove']) ) wp_delete_attachment($value);
2768
  endif;
2769
 
2824
  endforeach;
2825
 
2826
  if ( !empty($tags_input) && is_array($tags_input) ) :
2827
+ foreach ( $tags_input as $tags_key => $tags_value ) :
2828
  if ( class_exists('SimpleTags') && $tags_key == 'post_tag' ) :
2829
  wp_cache_flush();
2830
  $taxonomy = wp_get_object_terms($id, 'post_tag', array());
3660
  function custom_field_template_delete_post($post_id) {
3661
  global $wpdb;
3662
  $options = $this->get_custom_field_template_data();
3663
+ $id = !empty($options['posts'][$post_id]) ? $options['posts'][$post_id] : '';
3664
 
3665
  if ( is_numeric($id) ) :
3666
  $fields = $this->get_custom_fields($id);
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Hiroaki Miyashita
3
  Donate link: http://wpgogo.com/development/custom-field-template.html
4
  Tags: custom, fields, field, template, meta, custom field, custom fields, custom field template
5
  Requires at least: 2.1
6
- Tested up to: 3.1.2
7
- Stable tag: 1.9.2
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
@@ -105,6 +105,10 @@ See the default template and modify it.
105
 
106
  == Changelog ==
107
 
 
 
 
 
108
  = 1.9.2 =
109
  * Bugfix: js filename typo.
110
 
3
  Donate link: http://wpgogo.com/development/custom-field-template.html
4
  Tags: custom, fields, field, template, meta, custom field, custom fields, custom field template
5
  Requires at least: 2.1
6
+ Tested up to: 3.2.1
7
+ Stable tag: 1.9.3
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
105
 
106
  == Changelog ==
107
 
108
+ = 1.9.3 =
109
+ * Bugfix: `level` attribute.
110
+ * Bugfix: image insert in IE.
111
+
112
  = 1.9.2 =
113
  * Bugfix: js filename typo.
114