Version Description
Download this release
Release Info
Developer | Hiroaki Miyashita |
Plugin | Custom Field Template |
Version | 0.4.4 |
Comparing to | |
See all releases |
Code changes from version 0.4.3 to 0.4.4
- custom-field-template.php +44 -17
- 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.4.
|
8 |
Author URI: http://wordpressgogo.com/
|
9 |
*/
|
10 |
|
@@ -84,6 +84,11 @@ type = textfield
|
|
84 |
size = 35
|
85 |
hideKey = true
|
86 |
|
|
|
|
|
|
|
|
|
|
|
87 |
[Favorite Animal]
|
88 |
type = checkbox
|
89 |
value = dog
|
@@ -258,7 +263,7 @@ mediaButton = true';
|
|
258 |
if( isset( $_REQUEST[ 'post' ] ) && $_REQUEST[ 'post' ] > 0 ) {
|
259 |
$selected = get_post_meta( $_REQUEST[ 'post' ], $title );
|
260 |
if ( $selected ) {
|
261 |
-
if ( in_array($value, $selected) ) $checked = 'checked="checked"';
|
262 |
}
|
263 |
}
|
264 |
else {
|
@@ -656,24 +661,46 @@ EOF;
|
|
656 |
$Sections[] = $Section;
|
657 |
if($Data[$Section])
|
658 |
break;
|
659 |
-
|
660 |
-
|
661 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
662 |
break;
|
663 |
-
}
|
664 |
-
$Value = array();
|
665 |
-
$Value["NAME"] = trim(substr($Temp,0,$Pos));
|
666 |
-
$Value["VALUE"] = trim(substr($Temp,$Pos+1),' "');
|
667 |
-
|
668 |
-
if ($ProcessSections) {
|
669 |
-
$Data[$Section][$id][$Value["NAME"]] = $Value["VALUE"];
|
670 |
-
}
|
671 |
-
else {
|
672 |
-
$Data[$Value["NAME"]] = $Value["VALUE"];
|
673 |
-
}
|
674 |
-
break;
|
675 |
}
|
676 |
} while ($Temp = strtok("\r\n"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
}
|
678 |
return $Data;
|
679 |
}
|
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.4.4
|
8 |
Author URI: http://wordpressgogo.com/
|
9 |
*/
|
10 |
|
84 |
size = 35
|
85 |
hideKey = true
|
86 |
|
87 |
+
[Favorite Fruits]
|
88 |
+
type = checkbox
|
89 |
+
value = apple # orange # banana # grape
|
90 |
+
default = orange # grape
|
91 |
+
|
92 |
[Favorite Animal]
|
93 |
type = checkbox
|
94 |
value = dog
|
263 |
if( isset( $_REQUEST[ 'post' ] ) && $_REQUEST[ 'post' ] > 0 ) {
|
264 |
$selected = get_post_meta( $_REQUEST[ 'post' ], $title );
|
265 |
if ( $selected ) {
|
266 |
+
if ( in_array(stripcslashes($value), $selected) ) $checked = 'checked="checked"';
|
267 |
}
|
268 |
}
|
269 |
else {
|
661 |
$Sections[] = $Section;
|
662 |
if($Data[$Section])
|
663 |
break;
|
664 |
+
default:
|
665 |
+
$Pos = strpos($Temp,'=');
|
666 |
+
if ($Pos === FALSE) {
|
667 |
+
break;
|
668 |
+
}
|
669 |
+
$Value = array();
|
670 |
+
$Value["NAME"] = trim(substr($Temp,0,$Pos));
|
671 |
+
$Value["VALUE"] = trim(substr($Temp,$Pos+1),' "');
|
672 |
+
|
673 |
+
if ($ProcessSections) {
|
674 |
+
$Data[$Section][$id][$Value["NAME"]] = $Value["VALUE"];
|
675 |
+
}
|
676 |
+
else {
|
677 |
+
$Data[$Value["NAME"]] = $Value["VALUE"];
|
678 |
+
}
|
679 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
680 |
}
|
681 |
} while ($Temp = strtok("\r\n"));
|
682 |
+
|
683 |
+
foreach($Data as $title => $data) {
|
684 |
+
foreach($data as $key => $val) {
|
685 |
+
if($val["type"] == "checkbox") {
|
686 |
+
$values = explode( '#', $val["value"] );
|
687 |
+
$defaults = explode( '#', $val["default"] );
|
688 |
+
foreach($defaults as $dkey => $dval) {
|
689 |
+
$defaults[$dkey] = trim($dval);
|
690 |
+
}
|
691 |
+
$tmp = $key;
|
692 |
+
foreach($values as $value) {
|
693 |
+
$Data[$title][$key]["type"] = "checkbox";
|
694 |
+
$Data[$title][$key]["value"] = trim($value);
|
695 |
+
if($tmp!=$key)
|
696 |
+
$Data[$title][$key]["hideKey"] = true;
|
697 |
+
if(in_array(trim($value), $defaults))
|
698 |
+
$Data[$title][$key]["checked"] = true;
|
699 |
+
$key++;
|
700 |
+
}
|
701 |
+
}
|
702 |
+
}
|
703 |
+
}
|
704 |
}
|
705 |
return $Data;
|
706 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wordpressgogo.com/development/custom-field-template.html
|
|
4 |
Tags: custom, fields, field, template, meta
|
5 |
Requires at least: 2.1
|
6 |
Tested up to: 2.6.2
|
7 |
-
Stable tag: 0.4.
|
8 |
|
9 |
This plugin adds the default custom fields on the Write Post/Page.
|
10 |
|
4 |
Tags: custom, fields, field, template, meta
|
5 |
Requires at least: 2.1
|
6 |
Tested up to: 2.6.2
|
7 |
+
Stable tag: 0.4.4
|
8 |
|
9 |
This plugin adds the default custom fields on the Write Post/Page.
|
10 |
|