Custom Field Template - Version 2.0.1

Version Description

  • Bugix: multibyte string key names with the html editor.
Download this release

Release Info

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

Code changes from version 2.0 to 2.0.1

Files changed (2) hide show
  1. custom-field-template.php +19 -20
  2. readme.txt +4 -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: 2.0
8
  Author URI: http://wpgogo.com/
9
  */
10
 
@@ -461,10 +461,13 @@ class custom_field_template {
461
  }
462
 
463
  function custom_field_template_dbx_post_sidebar() {
 
464
  $options = $this->get_custom_field_template_data();
465
 
466
  if ( !empty($options['custom_field_template_deploy_box']) ) :
467
- $siffix = '"+win.jQuery("#cft_current_template").val()+"';
 
 
468
  endif;
469
 
470
  $out = '';
@@ -538,14 +541,10 @@ class custom_field_template {
538
  }
539
 
540
  if ( substr($wp_version, 0, 3) < '3.3' ) :
541
- $qt_position = 'prev()';
542
- else :
543
- $qt_position = 'children(\':first\')';
544
- endif;
545
-
546
- if ( substr($wp_version, 0, 3) < '3.3' ) :
547
  $load_tinyMCE = 'tinyMCE.execCommand(' . "'mceAddControl'" . ',false, id);';
548
  else :
 
549
  $load_tinyMCE = 'var ed = new tinyMCE.Editor(id, tinyMCEPreInit.mceInit[\'content\']); ed.render();';
550
  endif;
551
 
@@ -580,10 +579,10 @@ class custom_field_template {
580
  ' var ed = tinyMCE.get(id);' . "\n" .
581
  ' if ( ! ed || ed.isHidden() ) {' . "\n" .
582
  ' document.getElementById(id).value = switchEditors.wpautop(document.getElementById(id).value);' . "\n" .
583
- ' if ( ed ) { jQuery(\'#editorcontainer_\'+id).'.$qt_position.'.hide(); ed.show(); }' . "\n" .
584
  ' else {'.$load_tinyMCE.'}' . "\n" .
585
  ' } else {' . "\n" .
586
- ' ed.hide(); jQuery(\'#editorcontainer_\'+id).'.$qt_position.'.show(); document.getElementById(id).style.color="#000000";' . "\n" .
587
  ' }' . "\n" .
588
  '}' . "\n";
589
 
@@ -1592,7 +1591,7 @@ hideKey = true<br />
1592
  <th>endNum</th><td>endNum = 10</td><td></td><td>endNum = 10</td><td>endNum = 10</td><td>endNum = 10</td><td>endNum = 10</td>
1593
  </tr>
1594
  <tr>
1595
- <th>multipleButton</th><td>multipleButton = true</td><td></td><td>multipleButton = true</td><td>multipleButton = true</td><td></td><td>multipleButton = true</td>
1596
  </tr>
1597
  <tr>
1598
  <th>blank</th><td>blank = true</td><td>blank = true</td><td>blank = true</td><td>blank = true</td><td>blank = true</td><td>blank = true</td>
@@ -2105,16 +2104,16 @@ jQuery(this).addClass("closed");
2105
  'jQuery(document).ready(function() {if ( typeof tinyMCE != "undefined" ) {' . "\n";
2106
 
2107
  if ( substr($wp_version, 0, 3) < '3.3' ) :
2108
- $load_tinyMCE = 'tinyMCE.execCommand("mceAddControl", false, "'. $name . $rand . '");';
2109
  $editorcontainer_class = ' class="editorcontainer"';
2110
  else :
2111
- $load_tinyMCE = 'var ed = new tinyMCE.Editor("'. $name . $rand . '", tinyMCEPreInit.mceInit["content"]); ed.render();';
2112
  $editorcontainer_class = ' class="wp-editor-container"';
2113
  endif;
2114
  if ( !empty($options['custom_field_template_use_wpautop']) ) :
2115
- $out .= 'document.getElementById("'. $name . $rand . '").value = document.getElementById("'. $name . $rand . '").value; '.$load_tinyMCE.' tinyMCEID.push("'. $name . $rand . '");' . "\n";
2116
  else:
2117
- $out .= 'document.getElementById("'. $name . $rand . '").value = switchEditors.wpautop(document.getElementById("'. $name . $rand . '").value); '.$load_tinyMCE.' tinyMCEID.push("'. $name . $rand . '");' . "\n";
2118
  endif;
2119
  $out .= '}});' . "\n";
2120
  $out .= '// ]]>' . "\n" . '</script>';
@@ -2226,20 +2225,20 @@ jQuery(this).addClass("closed");
2226
 
2227
  if ( $htmlEditor == true ) :
2228
  if ( substr($wp_version, 0, 3) < '3.3' ) :
2229
- if( $tinyMCE == true ) $quicktags_hide = ' jQuery(\'#qt_' . $name . $rand . '_qtags\').hide();';
2230
  $out .= '<script type="text/javascript">' . "\n" . '// <![CDATA[' . '
2231
- jQuery(document).ready(function() { qt_' . $name . $rand . ' = new QTags(\'qt_' . $name . $rand . '\', \'' . $name . $rand . '\', \'editorcontainer_' . $name . $rand . '\', \'more\'); ' . $quicktags_hide . ' });' . "\n" . '// ]]>' . "\n" . '</script>';
2232
  $editorcontainer_class = ' class="editorcontainer"';
2233
  else :
2234
- if( $tinyMCE == true ) $quicktags_hide = ' jQuery(\'#qt_' . $name . $rand . '_toolbar\').hide();';
2235
  $out .= '<script type="text/javascript">' . "\n" . '// <![CDATA[' . '
2236
- jQuery(document).ready(function() { new QTags(\'' . $name . $rand . '\'); QTags._buttonsInit(); ' . $quicktags_hide . ' }); ' . "\n";
2237
  $out .= '// ]]>' . "\n" . '</script>';
2238
  $editorcontainer_class = ' class="wp-editor-container"';
2239
  endif;
2240
  endif;
2241
 
2242
- $out .= '<div' . $editorcontainer_class . ' id="editorcontainer_' . $name . $rand . '"><textarea id="' . $name . $rand . '" name="' . $name . '[' . $sid . '][]" rows="' .$rows. '" cols="' . $cols . '"' . $content_class . $style . $event_output . '>' . esc_attr(trim($value)) . '</textarea><input type="hidden" name="'.$name.'_rand['.$sid.']" value="'.$rand.'" /></div>';
2243
  if ( ($htmlEditor == true || $tinyMCE == true) && substr($wp_version, 0, 3) < '3.3' ) $out .= '</div>';
2244
  $out .= trim($after).'</dd></dl>'."\n";
2245
 
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.1
8
  Author URI: http://wpgogo.com/
9
  */
10
 
461
  }
462
 
463
  function custom_field_template_dbx_post_sidebar() {
464
+ global $wp_version;
465
  $options = $this->get_custom_field_template_data();
466
 
467
  if ( !empty($options['custom_field_template_deploy_box']) ) :
468
+ $suffix = '"+win.jQuery("#cft_current_template").val()+"';
469
+ else :
470
+ $suffix = '';
471
  endif;
472
 
473
  $out = '';
541
  }
542
 
543
  if ( substr($wp_version, 0, 3) < '3.3' ) :
544
+ $qt_position = 'jQuery(\'#editorcontainer_\'+id).prev()';
 
 
 
 
 
545
  $load_tinyMCE = 'tinyMCE.execCommand(' . "'mceAddControl'" . ',false, id);';
546
  else :
547
+ $qt_position = 'jQuery(\'#qt_\'+id+\'_toolbar\')';
548
  $load_tinyMCE = 'var ed = new tinyMCE.Editor(id, tinyMCEPreInit.mceInit[\'content\']); ed.render();';
549
  endif;
550
 
579
  ' var ed = tinyMCE.get(id);' . "\n" .
580
  ' if ( ! ed || ed.isHidden() ) {' . "\n" .
581
  ' document.getElementById(id).value = switchEditors.wpautop(document.getElementById(id).value);' . "\n" .
582
+ ' if ( ed ) { '.$qt_position.'.hide(); ed.show(); }' . "\n" .
583
  ' else {'.$load_tinyMCE.'}' . "\n" .
584
  ' } else {' . "\n" .
585
+ ' ed.hide(); '.$qt_position.'.show(); document.getElementById(id).style.color="#000000";' . "\n" .
586
  ' }' . "\n" .
587
  '}' . "\n";
588
 
1591
  <th>endNum</th><td>endNum = 10</td><td></td><td>endNum = 10</td><td>endNum = 10</td><td>endNum = 10</td><td>endNum = 10</td>
1592
  </tr>
1593
  <tr>
1594
+ <th>multipleButton</th><td>multipleButton = true</td><td></td><td>multipleButton = true</td><td>multipleButton = true</td><td>multipleButton = true</td><td>multipleButton = true</td>
1595
  </tr>
1596
  <tr>
1597
  <th>blank</th><td>blank = true</td><td>blank = true</td><td>blank = true</td><td>blank = true</td><td>blank = true</td><td>blank = true</td>
2104
  'jQuery(document).ready(function() {if ( typeof tinyMCE != "undefined" ) {' . "\n";
2105
 
2106
  if ( substr($wp_version, 0, 3) < '3.3' ) :
2107
+ $load_tinyMCE = 'tinyMCE.execCommand("mceAddControl", false, "'. sha1($name . $rand) . '");';
2108
  $editorcontainer_class = ' class="editorcontainer"';
2109
  else :
2110
+ $load_tinyMCE = 'var ed = new tinyMCE.Editor("'. sha1($name . $rand) . '", tinyMCEPreInit.mceInit["content"]); ed.render();';
2111
  $editorcontainer_class = ' class="wp-editor-container"';
2112
  endif;
2113
  if ( !empty($options['custom_field_template_use_wpautop']) ) :
2114
+ $out .= 'document.getElementById("'. sha1($name . $rand) . '").value = document.getElementById("'. sha1($name . $rand) . '").value; '.$load_tinyMCE.' tinyMCEID.push("'. sha1($name . $rand) . '");' . "\n";
2115
  else:
2116
+ $out .= 'document.getElementById("'. sha1($name . $rand) . '").value = switchEditors.wpautop(document.getElementById("'. sha1($name . $rand) . '").value); '.$load_tinyMCE.' tinyMCEID.push("'. sha1($name . $rand) . '");' . "\n";
2117
  endif;
2118
  $out .= '}});' . "\n";
2119
  $out .= '// ]]>' . "\n" . '</script>';
2225
 
2226
  if ( $htmlEditor == true ) :
2227
  if ( substr($wp_version, 0, 3) < '3.3' ) :
2228
+ if( $tinyMCE == true ) $quicktags_hide = ' jQuery(\'#qt_' . sha1($name . $rand) . '_qtags\').hide();';
2229
  $out .= '<script type="text/javascript">' . "\n" . '// <![CDATA[' . '
2230
+ jQuery(document).ready(function() { qt_' . sha1($name . $rand) . ' = new QTags(\'qt_' . sha1($name . $rand) . '\', \'' . sha1($name . $rand) . '\', \'editorcontainer_' . sha1($name . $rand) . '\', \'more\'); ' . $quicktags_hide . ' });' . "\n" . '// ]]>' . "\n" . '</script>';
2231
  $editorcontainer_class = ' class="editorcontainer"';
2232
  else :
2233
+ if( $tinyMCE == true ) $quicktags_hide = ' jQuery(\'#qt_' . sha1($name . $rand) . '_toolbar\').hide();';
2234
  $out .= '<script type="text/javascript">' . "\n" . '// <![CDATA[' . '
2235
+ jQuery(document).ready(function() { new QTags(\'' . sha1($name . $rand) . '\'); QTags._buttonsInit(); ' . $quicktags_hide . ' }); ' . "\n";
2236
  $out .= '// ]]>' . "\n" . '</script>';
2237
  $editorcontainer_class = ' class="wp-editor-container"';
2238
  endif;
2239
  endif;
2240
 
2241
+ $out .= '<div' . $editorcontainer_class . ' id="editorcontainer_' . sha1($name . $rand) . '"><textarea id="' . sha1($name . $rand) . '" name="' . $name . '[' . $sid . '][]" rows="' .$rows. '" cols="' . $cols . '"' . $content_class . $style . $event_output . '>' . esc_attr(trim($value)) . '</textarea><input type="hidden" name="'.$name.'_rand['.$sid.']" value="'.$rand.'" /></div>';
2242
  if ( ($htmlEditor == true || $tinyMCE == true) && substr($wp_version, 0, 3) < '3.3' ) $out .= '</div>';
2243
  $out .= trim($after).'</dd></dl>'."\n";
2244
 
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.4
7
- Stable tag: 2.0
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
@@ -107,6 +107,9 @@ See the default template and modify it.
107
 
108
  == Changelog ==
109
 
 
 
 
110
  = 2.0 =
111
  * Option to deploy the box in each template. Category ID and page template file name refinement have not been supported yet.
112
  * Swedish (sv_SE) - Pontus Carlsson
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.1
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
107
 
108
  == Changelog ==
109
 
110
+ = 2.0.1 =
111
+ * Bugix: multibyte string key names with the html editor.
112
+
113
  = 2.0 =
114
  * Option to deploy the box in each template. Category ID and page template file name refinement have not been supported yet.
115
  * Swedish (sv_SE) - Pontus Carlsson