Version Description
Download this release
Release Info
Developer | Hiroaki Miyashita |
Plugin | Custom Field Template |
Version | 0.3.2 |
Comparing to | |
See all releases |
Code changes from version 0.3.1 to 0.3.2
- custom-field-template.php +20 -5
- readme.txt +1 -1
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.3.
|
8 |
Author URI: http://wordpressgogo.com/
|
9 |
*/
|
10 |
|
@@ -338,7 +338,7 @@ tinyMCE = true';
|
|
338 |
$out = '<script type="text/javascript">' . "\n" .
|
339 |
'// <![CDATA[' . "\n" .
|
340 |
'if ( typeof tinyMCE != "undefined" )' . "\n" .
|
341 |
-
'jQuery(document).ready(function() {tinyMCE.execCommand("mceAddControl", false, "'. $name . $rand . '");});' . "\n" .
|
342 |
'// ]]>' . "\n" .
|
343 |
'</script>';
|
344 |
}
|
@@ -361,7 +361,7 @@ tinyMCE = true';
|
|
361 |
EOF;
|
362 |
|
363 |
$switch = '<div>';
|
364 |
-
if( $tinyMCE == true ) {
|
365 |
$switch .= '<a href="#toggle" onclick="switchMode(\''.$name.$rand.'\'); return false;">' . __('Toggle', 'custom-field-template') . '</a>';
|
366 |
}
|
367 |
$swicth .= '</div>';
|
@@ -502,12 +502,27 @@ EOF;
|
|
502 |
' } else {' . "\n" .
|
503 |
' ed.hide();document.getElementById(id).style.color="#000000";' . "\n" .
|
504 |
' }' . "\n" .
|
505 |
-
'}' . "\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
506 |
'// ]]>' . "\n" .
|
507 |
'</script>';
|
508 |
|
509 |
$body = $this->load_custom_field();
|
510 |
-
$out .= '<select id="custom_field_template_select" onchange="jQuery.ajax({type: \'GET\', url: \'?page=custom-field-template/custom-field-template.php&id=\'+jQuery(this).val()+\'&post=\'+jQuery(\'#post_ID\').val(), success: function(html) {jQuery(\'#custom-field-template-box\').html(html);}});">';
|
511 |
for ( $i=0; $i < count($options['custom_fields']); $i++ ) {
|
512 |
if ( $i == $options['posts'][$_REQUEST['post']] ) {
|
513 |
$out .= '<option value="' . $i . '" selected="selected">' . stripcslashes($options['custom_fields'][$i]['title']) . '</option>';
|
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.3.2
|
8 |
Author URI: http://wordpressgogo.com/
|
9 |
*/
|
10 |
|
338 |
$out = '<script type="text/javascript">' . "\n" .
|
339 |
'// <![CDATA[' . "\n" .
|
340 |
'if ( typeof tinyMCE != "undefined" )' . "\n" .
|
341 |
+
'jQuery(document).ready(function() {tinyMCE.execCommand("mceAddControl", false, "'. $name . $rand . '"); tinyMCEID.push("'. $name . $rand . '");});' . "\n" .
|
342 |
'// ]]>' . "\n" .
|
343 |
'</script>';
|
344 |
}
|
361 |
EOF;
|
362 |
|
363 |
$switch = '<div>';
|
364 |
+
if( $tinyMCE == true && user_can_richedit() ) {
|
365 |
$switch .= '<a href="#toggle" onclick="switchMode(\''.$name.$rand.'\'); return false;">' . __('Toggle', 'custom-field-template') . '</a>';
|
366 |
}
|
367 |
$swicth .= '</div>';
|
502 |
' } else {' . "\n" .
|
503 |
' ed.hide();document.getElementById(id).style.color="#000000";' . "\n" .
|
504 |
' }' . "\n" .
|
505 |
+
'}' . "\n";
|
506 |
+
|
507 |
+
if(count($options['custom_fields'])>$options['posts'][$_REQUEST['post']] && $options['posts'][$_REQUEST['post']]) $init_id = $options['posts'][$_REQUEST['post']];
|
508 |
+
else $init_id = 0;
|
509 |
+
|
510 |
+
$fields = $this->get_custom_fields( $init_id );
|
511 |
+
foreach( $fields as $title => $data ) {
|
512 |
+
if( $data[ 'type' ] == 'textarea' && $data[ 'tinyMCE' ] ) {
|
513 |
+
$out .= 'jQuery(document).ready(function() {' . "\n" .
|
514 |
+
' if(wpTinyMCEConfig) if(wpTinyMCEConfig.defaultEditor == "html") { jQuery("#edButtonPreview").trigger("click"); }' . "\n" .
|
515 |
+
'});' . "\n";
|
516 |
+
break;
|
517 |
+
}
|
518 |
+
}
|
519 |
+
|
520 |
+
$out .= 'var tinyMCEID = new Array();' . "\n" .
|
521 |
'// ]]>' . "\n" .
|
522 |
'</script>';
|
523 |
|
524 |
$body = $this->load_custom_field();
|
525 |
+
$out .= '<select id="custom_field_template_select" onchange="if(tinyMCEID.length) { for(i=0;i<tinyMCEID.length;i++) {tinyMCE.execCommand(\'mceRemoveControl\', false, tinyMCEID[i]);} tinyMCEID = new Array();};jQuery.ajax({type: \'GET\', url: \'?page=custom-field-template/custom-field-template.php&id=\'+jQuery(this).val()+\'&post=\'+jQuery(\'#post_ID\').val(), success: function(html) {jQuery(\'#custom-field-template-box\').html(html);}});">';
|
526 |
for ( $i=0; $i < count($options['custom_fields']); $i++ ) {
|
527 |
if ( $i == $options['posts'][$_REQUEST['post']] ) {
|
528 |
$out .= '<option value="' . $i . '" selected="selected">' . stripcslashes($options['custom_fields'][$i]['title']) . '</option>';
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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.2
|
7 |
-
Stable tag: 0.3.
|
8 |
|
9 |
This plugin adds the default custom fields on the Write Post/Page.
|
10 |
|
4 |
Tags: custom, fields, field, template
|
5 |
Requires at least: 2.1
|
6 |
Tested up to: 2.6.2
|
7 |
+
Stable tag: 0.3.2
|
8 |
|
9 |
This plugin adds the default custom fields on the Write Post/Page.
|
10 |
|