Custom Field Template - Version 1.7.6

Version Description

  • Bugfix: Box title.
  • Bugfix: posts_per_page.
Download this release

Release Info

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

Code changes from version 1.7.5 to 1.7.6

Files changed (2) hide show
  1. custom-field-template.php +12 -9
  2. readme.txt +5 -1
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.7.5
8
  Author URI: http://wpgogo.com/
9
  */
10
 
@@ -98,7 +98,8 @@ class custom_field_template {
98
  $id = $options['posts'][$_REQUEST['post']];
99
  else
100
  $id = 0;
101
- echo $this->load_custom_field( $id );
 
102
  exit();
103
  }
104
 
@@ -735,8 +736,8 @@ type = file';
735
  $j = 0;
736
  for($i=0;$i<count($_POST["custom_field_template_content"]);$i++) {
737
  if( $_POST["custom_field_template_content"][$i] ) {
738
- if ( preg_match('/\[content\]|\[post_title\]|\[excerpt\]/', $_POST["custom_field_template_content"][$i]) ) :
739
- $errormessage = __('You can not use the following words as the field key: `content`, `post_title`, and `excerpt`.', 'custom-field-template');
740
  endif;
741
  $options['custom_fields'][$j]['title'] = $_POST["custom_field_template_title"][$i];
742
  $options['custom_fields'][$j]['content'] = $_POST["custom_field_template_content"][$i];
@@ -2146,7 +2147,7 @@ jQuery(this).addClass("closed");
2146
  $out .= '</div>';
2147
  $out .= '<br style="clear:both; font-size:1px;" />';
2148
 
2149
- return $out;
2150
  }
2151
 
2152
  function insert_custom_field() {
@@ -2252,7 +2253,7 @@ jQuery(this).addClass("closed");
2252
 
2253
  if(count($options['custom_fields'])>$options['posts'][$_REQUEST['post']] && $options['posts'][$_REQUEST['post']]) $init_id = $options['posts'][$_REQUEST['post']];
2254
  else $init_id = 0;
2255
-
2256
  $out .= 'jQuery(document).ready(function() {' . "\n";
2257
 
2258
  $fields = $this->get_custom_fields( $init_id );
@@ -2312,7 +2313,9 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
2312
  endif;
2313
 
2314
  if ( 0 != count( get_page_templates() ) ):
2315
- $out .= 'jQuery(\'#page_template\').change(function(){ if(tinyMCEID.length) { for(i=0;i<tinyMCEID.length;i++) {tinyMCE.execCommand(\'mceRemoveControl\', false, tinyMCEID[i]);} tinyMCEID.length=0;}; jQuery.get(\'?post_type='.$_REQUEST['post_type'].'&page=custom-field-template/custom-field-template.php&cft_mode=selectbox&post=\'+jQuery(\'#post_ID\').val()+\'&page_template=\'+jQuery(\'#page_template\').val(), function(html) { jQuery(\'#cft_selectbox\').html(html); jQuery.ajax({type: \'GET\', url: \'?post_type='.$_REQUEST['post_type'].'&page=custom-field-template/custom-field-template.php&cft_mode=ajaxload&page_template=\'+jQuery(\'#page_template\').val()+\'&post=\'+jQuery(\'#post_ID\').val(), success: function(html) { jQuery(\'#cft\').html(html);}});});';
 
 
2316
  $out .= '});' . "\n";
2317
  endif;
2318
 
@@ -2336,7 +2339,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
2336
  .quicktags div div input { margin: 3px 1px 4px; line-height: 18px; display: inline-block; border-width: 1px; border-style: solid; min-width: 26px; padding: 2px 4px; font-size: 12px; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; background:#FFFFFF url(images/fade-butt.png) repeat-x scroll 0 -2px; overflow: visible; }' . "\n";
2337
  $out .= '-->' . "\n" .
2338
  '</style>';
2339
- $body = $this->load_custom_field($init_id);
2340
 
2341
  $out .= '<div id="cft_selectbox" style="height:25px;">';
2342
  $out .= $this->custom_field_template_selectbox();
@@ -3454,7 +3457,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
3454
  $limit = (int)$_REQUEST['limit'];
3455
  if ( !$limit )
3456
  $limit = trim($old_limit);
3457
- $wp_query->query_vars0['posts_per_page'] = $limit;
3458
  $offset = ($wp_query->query_vars['paged'] - 1) * $limit;
3459
  if ( $offset < 0 ) $offset = 0;
3460
 
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.7.6
8
  Author URI: http://wpgogo.com/
9
  */
10
 
98
  $id = $options['posts'][$_REQUEST['post']];
99
  else
100
  $id = 0;
101
+ list($body, $init_id) = $this->load_custom_field( $id );
102
+ echo $body;
103
  exit();
104
  }
105
 
736
  $j = 0;
737
  for($i=0;$i<count($_POST["custom_field_template_content"]);$i++) {
738
  if( $_POST["custom_field_template_content"][$i] ) {
739
+ if ( preg_match('/\[content\]|\[post_title\]|\[excerpt\]|\[action\]/i', $_POST["custom_field_template_content"][$i]) ) :
740
+ $errormessage = __('You can not use the following words as the field key: `content`, `post_title`, and `excerpt`, and `action`.', 'custom-field-template');
741
  endif;
742
  $options['custom_fields'][$j]['title'] = $_POST["custom_field_template_title"][$i];
743
  $options['custom_fields'][$j]['content'] = $_POST["custom_field_template_content"][$i];
2147
  $out .= '</div>';
2148
  $out .= '<br style="clear:both; font-size:1px;" />';
2149
 
2150
+ return array($out, $id);
2151
  }
2152
 
2153
  function insert_custom_field() {
2253
 
2254
  if(count($options['custom_fields'])>$options['posts'][$_REQUEST['post']] && $options['posts'][$_REQUEST['post']]) $init_id = $options['posts'][$_REQUEST['post']];
2255
  else $init_id = 0;
2256
+
2257
  $out .= 'jQuery(document).ready(function() {' . "\n";
2258
 
2259
  $fields = $this->get_custom_fields( $init_id );
2313
  endif;
2314
 
2315
  if ( 0 != count( get_page_templates() ) ):
2316
+ $out .= 'jQuery(\'#page_template\').change(function(){ if(tinyMCEID.length) { for(i=0;i<tinyMCEID.length;i++) {tinyMCE.execCommand(\'mceRemoveControl\', false, tinyMCEID[i]);} tinyMCEID.length=0;}; jQuery.get(\'?post_type='.$_REQUEST['post_type'].'&page=custom-field-template/custom-field-template.php&cft_mode=selectbox&post=\'+jQuery(\'#post_ID\').val()+\'&page_template=\'+jQuery(\'#page_template\').val(), function(html) { jQuery(\'#cft_selectbox\').html(html); jQuery.ajax({type: \'GET\', url: \'?post_type='.$_REQUEST['post_type'].'&page=custom-field-template/custom-field-template.php&cft_mode=ajaxload&page_template=\'+jQuery(\'#page_template\').val()+\'&post=\'+jQuery(\'#post_ID\').val(), success: function(html) { jQuery(\'#cft\').html(html);';
2317
+ $out .= 'jQuery(\'#cftdiv h3 span\').text(jQuery(\'#custom_field_template_select :selected\').text());';
2318
+ $out .= '}});});';
2319
  $out .= '});' . "\n";
2320
  endif;
2321
 
2339
  .quicktags div div input { margin: 3px 1px 4px; line-height: 18px; display: inline-block; border-width: 1px; border-style: solid; min-width: 26px; padding: 2px 4px; font-size: 12px; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; background:#FFFFFF url(images/fade-butt.png) repeat-x scroll 0 -2px; overflow: visible; }' . "\n";
2340
  $out .= '-->' . "\n" .
2341
  '</style>';
2342
+ list($body, $init_id) = $this->load_custom_field($init_id);
2343
 
2344
  $out .= '<div id="cft_selectbox" style="height:25px;">';
2345
  $out .= $this->custom_field_template_selectbox();
3457
  $limit = (int)$_REQUEST['limit'];
3458
  if ( !$limit )
3459
  $limit = trim($old_limit);
3460
+ $wp_query->query_vars['posts_per_page'] = $limit;
3461
  $offset = ($wp_query->query_vars['paged'] - 1) * $limit;
3462
  if ( $offset < 0 ) $offset = 0;
3463
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.0.1
7
- Stable tag: 1.7.5
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
@@ -102,6 +102,10 @@ See the default template and modify it.
102
 
103
  == Changelog ==
104
 
 
 
 
 
105
  = 1.7.5 =
106
  * Bugfix: search.
107
 
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.0.1
7
+ Stable tag: 1.7.6
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
102
 
103
  == Changelog ==
104
 
105
+ = 1.7.6 =
106
+ * Bugfix: Box title.
107
+ * Bugfix: posts_per_page.
108
+
109
  = 1.7.5 =
110
  * Bugfix: search.
111