Custom Field Template - Version 0.2

Version Description

Download this release

Release Info

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

Code changes from version 0.1.1 to 0.2

Files changed (2) hide show
  1. custom-field-template.php +24 -7
  2. readme.txt +5 -4
custom-field-template.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Custom Field Template
4
  Plugin URI: http://wordpressgogo.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: 0.1.1
8
  Author URI: http://wordpressgogo.com/
9
  */
10
 
@@ -75,8 +75,14 @@ default = Low
75
  [Hidden Thought]
76
  type = textarea
77
  rows = 4
78
- cols = 40
79
- ';
 
 
 
 
 
 
80
  update_option('custom_field_template_data', $options);
81
  }
82
 
@@ -288,7 +294,7 @@ cols = 40
288
  return $out;
289
  }
290
 
291
- function make_textarea( $name, $rows, $cols ) {
292
  $title = $name;
293
  $name = $this->sanitize_name( $name );
294
 
@@ -297,10 +303,21 @@ cols = 40
297
  $value = $value[ 0 ];
298
  }
299
 
300
- $out =
 
 
 
 
 
 
 
 
 
 
 
301
  '<tr>' .
302
  '<th scope="row" valign="top">' . $title . ' </th>' .
303
- '<td> <textarea id="' . $name . '" name="' . $name . '" type="textfield" rows="' .$rows. '" cols="' .$cols. '">' .attribute_escape($value). '</textarea></td>' .
304
  '</tr>';
305
  return $out;
306
  }
@@ -334,7 +351,7 @@ cols = 40
334
  }
335
  else if( $data[ 'type' ] == 'textarea' ) {
336
  $out .=
337
- $this->make_textarea( $title, $data[ 'rows' ], $data[ 'cols' ] );
338
  }
339
  }
340
 
4
  Plugin URI: http://wordpressgogo.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: 0.2
8
  Author URI: http://wordpressgogo.com/
9
  */
10
 
75
  [Hidden Thought]
76
  type = textarea
77
  rows = 4
78
+ cols = 40
79
+ tinyMCE = true
80
+
81
+ [Hidden Thought]
82
+ type = textarea
83
+ rows = 4
84
+ cols = 40
85
+ tinyMCE = true';
86
  update_option('custom_field_template_data', $options);
87
  }
88
 
294
  return $out;
295
  }
296
 
297
+ function make_textarea( $name, $rows, $cols, $tinyMCE ) {
298
  $title = $name;
299
  $name = $this->sanitize_name( $name );
300
 
303
  $value = $value[ 0 ];
304
  }
305
 
306
+ $rand = rand();
307
+
308
+ if( $tinyMCE == true ) {
309
+ $out = '<script type="text/javascript">' . "\n" .
310
+ '// <![CDATA[' . "\n" .
311
+ 'if ( typeof tinyMCE != "undefined" )' . "\n" .
312
+ 'jQuery(document).ready(function() {tinyMCE.execCommand("mceAddControl", false, "'. $name . $rand . '");});' . "\n" .
313
+ '// ]]>' . "\n" .
314
+ '</script>';
315
+ }
316
+
317
+ $out .=
318
  '<tr>' .
319
  '<th scope="row" valign="top">' . $title . ' </th>' .
320
+ '<td><textarea id="' . $name . $rand . '" name="' . $name . '" type="textfield" rows="' .$rows. '" cols="' . $cols . '">' . attribute_escape($value) . '</textarea></td>' .
321
  '</tr>';
322
  return $out;
323
  }
351
  }
352
  else if( $data[ 'type' ] == 'textarea' ) {
353
  $out .=
354
+ $this->make_textarea( $title, $data[ 'rows' ], $data[ 'cols' ], $data[ 'tinyMCE' ] );
355
  }
356
  }
357
 
readme.txt CHANGED
@@ -2,18 +2,19 @@
2
  Contributors: Hiroaki Miyashita
3
  Donate link: http://wordpressgogo.com/development/custom-field-template.html
4
  Tags: custom, fields, field, template
5
- Requires at least: 1.5
6
  Tested up to: 2.6.1
7
- Stable tag: 0.1.1
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
11
  == Description ==
12
 
13
- The Custom Field Template plugin adds the default custom fields on the Write Post/Page. The template format is almost same as the one of the rc:custom_field_gui plugin. The difference is following:
14
 
15
  * You can set any number of the custom field templates and switch the templates when you write/edit the post/page.
16
  * This plugin does not use the ini file for the template but set it in the option page of the plugin.
 
17
 
18
  == Installation ==
19
 
@@ -29,7 +30,7 @@ The Custom Field Template plugin adds the default custom fields on the Write Pos
29
  = How can I use this plugin? =
30
 
31
  The template format is basically same as the one of the rc:custom_field_gui plugin.
32
- See the default template of the plugin settings and modify it.
33
 
34
  == Screenshots ==
35
 
2
  Contributors: Hiroaki Miyashita
3
  Donate link: http://wordpressgogo.com/development/custom-field-template.html
4
  Tags: custom, fields, field, template
5
+ Requires at least: 2.1
6
  Tested up to: 2.6.1
7
+ Stable tag: 0.2
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
11
  == Description ==
12
 
13
+ The Custom Field Template plugin adds the default custom fields on the Write Post/Page. The template format is almost same as the one of the rc:custom_field_gui plugin. The difference is following.
14
 
15
  * You can set any number of the custom field templates and switch the templates when you write/edit the post/page.
16
  * This plugin does not use the ini file for the template but set it in the option page of the plugin.
17
+ * Support for TinyMCE in the textarea.
18
 
19
  == Installation ==
20
 
30
  = How can I use this plugin? =
31
 
32
  The template format is basically same as the one of the rc:custom_field_gui plugin.
33
+ See the default template and modify it.
34
 
35
  == Screenshots ==
36