Custom Field Template - Version 2.0.3

Version Description

  • Bugfix: mediaPicker attribute with a break type.
  • Bugfix: disappearance of the main editor.
Download this release

Release Info

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

Code changes from version 2.0.2 to 2.0.3

Files changed (2) hide show
  1. custom-field-template.php +18 -14
  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: 2.0.2
8
  Author URI: http://wpgogo.com/
9
  */
10
 
@@ -34,7 +34,7 @@ class custom_field_template {
34
  var $is_excerpt;
35
 
36
  function custom_field_template() {
37
- add_action( 'init', array(&$this, 'custom_field_template_init') );
38
  add_action( 'admin_menu', array(&$this, 'custom_field_template_admin_menu') );
39
  add_action( 'admin_print_scripts', array(&$this, 'custom_field_template_admin_scripts') );
40
  add_action( 'admin_head', array(&$this, 'custom_field_template_admin_head'), 100 );
@@ -734,21 +734,22 @@ class custom_field_template {
734
 
735
  wp_enqueue_script( 'jquery' );
736
  wp_enqueue_script( 'jquery-form' );
737
- wp_enqueue_script( 'date', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/date.js', array('jquery') );
738
  wp_enqueue_script( 'bgiframe', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.bgiframe.js', array('jquery') ) ;
739
- wp_enqueue_script( 'datePicker', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.datePicker.js', array('jquery') );
740
  wp_enqueue_script( 'textarearesizer', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.textarearesizer.js', array('jquery') );
741
- if( strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page.php') || (is_object($post) && $post->post_type=='page') ) :
 
 
742
  wp_enqueue_script('editor');
743
  wp_enqueue_script('quicktags');
744
- endif;
745
 
746
- if ( !empty($options['custom_field_template_use_validation']) ) :
747
- wp_enqueue_script( 'jquery-validate', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.validate.js', array('jquery') );
748
- wp_enqueue_script( 'additional-methods', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/additional-methods.js', array('jquery') );
749
- if ( file_exists(ABSPATH . PLUGINDIR . '/' . $plugin_dir . '/js/messages_' . WPLANG . '.js') )
750
- wp_enqueue_script( 'messages_' . WPLANG, '/' . PLUGINDIR . '/' . $plugin_dir . '/js/messages_' . WPLANG .'.js', array('jquery') );
 
751
  endif;
 
752
  }
753
 
754
  function install_custom_field_template_data() {
@@ -815,7 +816,8 @@ type = file';
815
 
816
  function install_custom_field_template_css() {
817
  $options = get_option('custom_field_template_data');
818
- $options['css'] = '.cft:after { content:" "; clear:both; height:0; display:block; visibility:hidden; }
 
819
  .cft dl { margin:10px 0; }
820
  .cft dl:after { content:" "; clear:both; height:0; display:block; visibility:hidden; }
821
  .cft dt { width:20%; clear:both; float:left; display:inline; font-weight:bold; text-align:center; }
@@ -2286,7 +2288,7 @@ jQuery(this).addClass("closed");
2286
 
2287
  if ( $mediaPicker == true ) :
2288
  $picker = __(' OR ', 'custom-field-template');
2289
- $picker .= '<a href="'.$image_upload_iframe_src.'&post_id='.$_REQUEST[ 'post' ].'&TB_iframe=1&tab='.$tab.'" class="thickbox" onclick="jQuery('."'#cft_current_template'".').val(jQuery(this).parent().parent().parent().attr(\'id\').replace(\'cft_\',\'\'));jQuery('."'#cft_clicked_id'".').val(jQuery(this).parent().find(\'input\').attr(\'id\'));">'.__('Select by Media Picker', 'custom-field-template').'</a>';
2290
  endif;
2291
 
2292
  $out .=
@@ -2296,7 +2298,7 @@ jQuery(this).addClass("closed");
2296
 
2297
  if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
2298
  $out .= '<p class="label">' . stripcslashes($label) . '</p>';
2299
- $out .= trim($before).'<input id="' . $name . $sid . '_' . $cftnum . '" name="' . $name . '['.$sid.'][]" type="file" size="' . $size . '"' . $class . $style . ' onchange="if (jQuery(this).val()) { jQuery(\'#cft_save_button\'+jQuery(this).parent().parent().parent().attr(\'id\').replace(\'cft_\',\'\')).attr(\'disabled\', true); jQuery(\'#post-preview\').hide(); } else { jQuery(\'#cft_save_button\').attr(\'disabled\', false); jQuery(\'#post-preview\').show(); }" />'.trim($after).$picker;
2300
 
2301
  if ( isset($value) && ( $value = intval($value) ) && $thumb_url = wp_get_attachment_image_src( $value, 'thumbnail', true ) ) :
2302
  $thumb_url = $thumb_url[0];
@@ -2444,6 +2446,7 @@ jQuery(this).addClass("closed");
2444
  endif;
2445
 
2446
  $out .= '<div id="cft_'.$id.'">';
 
2447
  $out .= '<input type="hidden" name="custom-field-template-id[]" id="custom-field-template-id" value="' . $id . '" />';
2448
  foreach( $fields as $field_key => $field_val ) :
2449
  foreach( $field_val as $title => $data ) {
@@ -2527,6 +2530,7 @@ jQuery(this).addClass("closed");
2527
  $out .= '// ]]>' . "\n" .
2528
  '</script>';
2529
  $out .= '</div>';
 
2530
 
2531
  return array($out, $id);
2532
  }
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: 2.0.3
8
  Author URI: http://wpgogo.com/
9
  */
10
 
34
  var $is_excerpt;
35
 
36
  function custom_field_template() {
37
+ add_action( 'init', array(&$this, 'custom_field_template_init'), 100 );
38
  add_action( 'admin_menu', array(&$this, 'custom_field_template_admin_menu') );
39
  add_action( 'admin_print_scripts', array(&$this, 'custom_field_template_admin_scripts') );
40
  add_action( 'admin_head', array(&$this, 'custom_field_template_admin_head'), 100 );
734
 
735
  wp_enqueue_script( 'jquery' );
736
  wp_enqueue_script( 'jquery-form' );
 
737
  wp_enqueue_script( 'bgiframe', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.bgiframe.js', array('jquery') ) ;
 
738
  wp_enqueue_script( 'textarearesizer', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.textarearesizer.js', array('jquery') );
739
+ if( strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/page.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/edit.php') || (is_object($post) && $post->post_type=='page') ) :
740
+ wp_enqueue_script('date', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/date.js', array('jquery') );
741
+ wp_enqueue_script('datePicker', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.datePicker.js', array('jquery') );
742
  wp_enqueue_script('editor');
743
  wp_enqueue_script('quicktags');
 
744
 
745
+ if ( !empty($options['custom_field_template_use_validation']) ) :
746
+ wp_enqueue_script( 'jquery-validate', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/jquery.validate.js', array('jquery') );
747
+ wp_enqueue_script( 'additional-methods', '/' . PLUGINDIR . '/' . $plugin_dir . '/js/additional-methods.js', array('jquery') );
748
+ if ( file_exists(ABSPATH . PLUGINDIR . '/' . $plugin_dir . '/js/messages_' . WPLANG . '.js') )
749
+ wp_enqueue_script( 'messages_' . WPLANG, '/' . PLUGINDIR . '/' . $plugin_dir . '/js/messages_' . WPLANG .'.js', array('jquery') );
750
+ endif;
751
  endif;
752
+
753
  }
754
 
755
  function install_custom_field_template_data() {
816
 
817
  function install_custom_field_template_css() {
818
  $options = get_option('custom_field_template_data');
819
+ $options['css'] = '.cft { overflow:hidden; }
820
+ .cft:after { content:" "; clear:both; height:0; display:block; visibility:hidden; }
821
  .cft dl { margin:10px 0; }
822
  .cft dl:after { content:" "; clear:both; height:0; display:block; visibility:hidden; }
823
  .cft dt { width:20%; clear:both; float:left; display:inline; font-weight:bold; text-align:center; }
2288
 
2289
  if ( $mediaPicker == true ) :
2290
  $picker = __(' OR ', 'custom-field-template');
2291
+ $picker .= '<a href="'.$image_upload_iframe_src.'&post_id='.$_REQUEST[ 'post' ].'&TB_iframe=1&tab='.$tab.'" class="thickbox" onclick="jQuery('."'#cft_current_template'".').val(jQuery(this).parent().parent().parent().parent().attr(\'id\').replace(\'cft_\',\'\'));jQuery('."'#cft_clicked_id'".').val(jQuery(this).parent().find(\'input\').attr(\'id\'));">'.__('Select by Media Picker', 'custom-field-template').'</a>';
2292
  endif;
2293
 
2294
  $out .=
2298
 
2299
  if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
2300
  $out .= '<p class="label">' . stripcslashes($label) . '</p>';
2301
+ $out .= trim($before).'<input id="' . $name . $sid . '_' . $cftnum . '" name="' . $name . '['.$sid.'][]" type="file" size="' . $size . '"' . $class . $style . ' onchange="if (jQuery(this).val()) { jQuery(\'#cft_save_button\'+jQuery(this).parent().parent().parent().parent().attr(\'id\').replace(\'cft_\',\'\')).attr(\'disabled\', true); jQuery(\'#post-preview\').hide(); } else { jQuery(\'#cft_save_button\').attr(\'disabled\', false); jQuery(\'#post-preview\').show(); }" />'.trim($after).$picker;
2302
 
2303
  if ( isset($value) && ( $value = intval($value) ) && $thumb_url = wp_get_attachment_image_src( $value, 'thumbnail', true ) ) :
2304
  $thumb_url = $thumb_url[0];
2446
  endif;
2447
 
2448
  $out .= '<div id="cft_'.$id.'">';
2449
+ $out .= '<div>';
2450
  $out .= '<input type="hidden" name="custom-field-template-id[]" id="custom-field-template-id" value="' . $id . '" />';
2451
  foreach( $fields as $field_key => $field_val ) :
2452
  foreach( $field_val as $title => $data ) {
2530
  $out .= '// ]]>' . "\n" .
2531
  '</script>';
2532
  $out .= '</div>';
2533
+ $out .= '</div>';
2534
 
2535
  return array($out, $id);
2536
  }
readme.txt CHANGED
@@ -4,9 +4,9 @@ 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.4
7
- Stable tag: 2.0.2
8
 
9
- This plugin adds the default custom fields on the Write Post/Page.
10
 
11
  == Description ==
12
 
@@ -108,6 +108,10 @@ See the default template and modify it.
108
 
109
  == Changelog ==
110
 
 
 
 
 
111
  = 2.0.2 =
112
  * Bugfix: checkbox output with the label attribute.
113
  * Bugfix: mediaButton attribute.
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.4
7
+ Stable tag: 2.0.3
8
 
9
+ This plugin extends the functionality of custom fields.
10
 
11
  == Description ==
12
 
108
 
109
  == Changelog ==
110
 
111
+ = 2.0.3 =
112
+ * Bugfix: mediaPicker attribute with a break type.
113
+ * Bugfix: disappearance of the main editor.
114
+
115
  = 2.0.2 =
116
  * Bugfix: checkbox output with the label attribute.
117
  * Bugfix: mediaButton attribute.