Version Description
- Bugfix: custom field ids.
Download this release
Release Info
Developer | Hiroaki Miyashita |
Plugin | Custom Field Template |
Version | 1.5.4 |
Comparing to | |
See all releases |
Code changes from version 1.5.3 to 1.5.4
- custom-field-template.php +24 -15
- readme.txt +5 -2
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.5.
|
8 |
Author URI: http://wpgogo.com/
|
9 |
*/
|
10 |
|
@@ -791,12 +791,14 @@ type = file';
|
|
791 |
</td></tr>
|
792 |
<?php
|
793 |
}
|
794 |
-
|
795 |
<tr><td>
|
796 |
<p><label for="custom_field_template_use_multiple_insert"><?php _e('In case that you would like to insert multiple images at once in use of the custom field media buttons', 'custom-field-template'); ?></label>:<br />
|
797 |
<input type="checkbox" name="custom_field_template_use_multiple_insert" id="custom_field_template_use_multiple_insert" value="1" <?php if ($options['custom_field_template_use_multiple_insert']) { echo 'checked="checked"'; } ?> /> <?php _e('Use multiple image inset', 'custom-field-template'); ?><br /><span style="color:#FF0000; font-weight:bold;"><?php _e('Caution:', 'custom-field-teplate'); ?> <?php _e('You need to edit `wp-admin/includes/media.php`. Delete or comment out the code in the function media_send_to_editor.', 'custom-field-template'); ?></span></p>
|
798 |
</td>
|
799 |
</tr>
|
|
|
|
|
800 |
<tr><td>
|
801 |
<p><label for="custom_field_template_replace_keys_by_labels"><?php _e('In case that you would like to replace custom keys by labels if `label` is set', 'custom-field-template'); ?></label>:<br />
|
802 |
<input type="checkbox" name="custom_field_template_replace_keys_by_labels" id="custom_field_template_replace_keys_by_labels" value="1" <?php if ($options['custom_field_template_replace_keys_by_labels']) { echo 'checked="checked"'; } ?> /> <?php _e('Use labels in place of custom keys', 'custom-field-template'); ?></p>
|
@@ -1348,13 +1350,13 @@ jQuery(this).addClass("closed");
|
|
1348 |
endif;
|
1349 |
|
1350 |
$out .=
|
1351 |
-
'<dl id="dl_' . $name . $sid . '">' .
|
1352 |
-
'<dt><span' . $hide . '><label for="' . $name . $sid . $cftnum . '">' . $title . '</label></span>'.$addfield.'</dt>' .
|
1353 |
'<dd>';
|
1354 |
|
1355 |
if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
|
1356 |
$out .= '<p class="label">' . stripcslashes($label) . '</p>';
|
1357 |
-
$out .= trim($before).'<input id="' . $name . $sid . $cftnum . '" name="' . $name . '['. $sid . '][]" value="' . attribute_escape(trim($value)) . '" type="text" size="' . $size . '"' . $class . $style . $maxlength . $event_output . $readOnly . ' />'.trim($after);
|
1358 |
|
1359 |
if ( $date == true ) :
|
1360 |
$out .= '<script type="text/javascript">' . "\n" .
|
@@ -1487,7 +1489,7 @@ jQuery(this).addClass("closed");
|
|
1487 |
$i = 0;
|
1488 |
if ( is_array($values) ) :
|
1489 |
foreach( $values as $val ) {
|
1490 |
-
$id = $name . $sid . '_' . $this->sanitize_name( $val );
|
1491 |
|
1492 |
$checked = ( stripcslashes(trim( $val )) == trim( $selected ) ) ? 'checked="checked"' : '';
|
1493 |
|
@@ -1550,12 +1552,12 @@ jQuery(this).addClass("closed");
|
|
1550 |
|
1551 |
$out .=
|
1552 |
'<dl id="dl_' . $name . $sid . '_' . $cftnum . '">' .
|
1553 |
-
'<dt><span' . $hide . '><label for="' . $name . $sid . $cftnum . '">' . $title . '</label></span>'.$addfield.'</dt>' .
|
1554 |
'<dd>';
|
1555 |
|
1556 |
if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
|
1557 |
$out .= '<p class="label">' . stripcslashes($label) . '</p>';
|
1558 |
-
$out .= trim($before).'<select id="' . $name . $sid . $cftnum . '" name="' . $name . '[' . $sid . '][]"' . $class . $style . $event_output . '>';
|
1559 |
|
1560 |
if ( $selectLabel )
|
1561 |
$out .= '<option value="">' . stripcslashes(trim($selectLabel)) . '</option>';
|
@@ -1672,7 +1674,7 @@ jQuery(this).addClass("closed");
|
|
1672 |
|
1673 |
$out .=
|
1674 |
'<dl id="dl_' . $name . $sid . '_' . $cftnum . '">' .
|
1675 |
-
'<dt><span' . $hide . '><label for="' . $name . $sid . $cftnum . '">' . $title . '</label></span><br />' . $media . $switch . '</dt>' .
|
1676 |
'<dd>';
|
1677 |
|
1678 |
if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
|
@@ -1724,12 +1726,12 @@ jQuery(this).addClass("closed");
|
|
1724 |
|
1725 |
$out .=
|
1726 |
'<dl id="dl_' . $name . $sid . '_' . $cftnum . '">' .
|
1727 |
-
'<dt><span' . $hide . '><label for="' . $name . $sid . $cftnum . '">' . $title . '</label></span>'.$addfield.'</dt>' .
|
1728 |
'<dd>';
|
1729 |
|
1730 |
if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
|
1731 |
$out .= '<p class="label">' . stripcslashes($label) . '</p>';
|
1732 |
-
$out .= trim($before).'<input id="' . $name . $sid . '" name="' . $name . '['.$sid.'][]" type="file" size="' . $size . '"' . $class . $style . ' onchange="if (jQuery(this).val()) { jQuery(\'#cft_save_button\').attr(\'disabled\', true); } else { jQuery(\'#cft_save_button\').attr(\'disabled\', false); }" />'.trim($after);
|
1733 |
|
1734 |
if ( ( $value = intval($value) ) && $thumb_url = get_attachment_icon_src( $value ) ) :
|
1735 |
$thumb_url = $thumb_url[0];
|
@@ -3032,8 +3034,11 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3032 |
if ( is_array($val2) ) :
|
3033 |
foreach( $val2 as $val3 ) :
|
3034 |
if ( $val3 ) :
|
3035 |
-
if ( $ch == 0 ) $where .= ' AND (';
|
3036 |
-
else
|
|
|
|
|
|
|
3037 |
switch( $replace[$key][$key2]['operator'] ) :
|
3038 |
case '<=' :
|
3039 |
case '>=' :
|
@@ -3042,7 +3047,11 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3042 |
case '=' :
|
3043 |
case '<>' :
|
3044 |
case '<=>':
|
3045 |
-
|
|
|
|
|
|
|
|
|
3046 |
break;
|
3047 |
default :
|
3048 |
$where .= " ROW(ID,1) IN (SELECT post_id,count(post_id) FROM " . $wpdb->postmeta . " WHERE (" . $wpdb->postmeta . ".meta_key = '" . $key . "' AND `" . $wpdb->postmeta . "`.meta_value LIKE '%" . trim($val3) . "%') GROUP BY post_id) ";
|
@@ -3069,6 +3078,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3069 |
$where .= " AND ROW(ID,1) IN (SELECT post_id,count(post_id) FROM `" . $wpdb->postmeta . "` WHERE (`" . $wpdb->postmeta . "`.meta_value LIKE '%" . trim($v) . "%') GROUP BY post_id) ";
|
3070 |
endif;
|
3071 |
endforeach;
|
|
|
3072 |
endif;
|
3073 |
|
3074 |
if ( is_array($_REQUEST['cftcategory_in']) ) :
|
@@ -3092,7 +3102,6 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3092 |
else :
|
3093 |
$where .= " AND `".$wpdb->posts."`.post_status = 'publish' GROUP BY `".$wpdb->posts."`.ID";
|
3094 |
endif;
|
3095 |
-
//if ( $_REQUEST['s'] ) $where .= $original_where;
|
3096 |
|
3097 |
return $where;
|
3098 |
}
|
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.5.4
|
8 |
Author URI: http://wpgogo.com/
|
9 |
*/
|
10 |
|
791 |
</td></tr>
|
792 |
<?php
|
793 |
}
|
794 |
+
/*
|
795 |
<tr><td>
|
796 |
<p><label for="custom_field_template_use_multiple_insert"><?php _e('In case that you would like to insert multiple images at once in use of the custom field media buttons', 'custom-field-template'); ?></label>:<br />
|
797 |
<input type="checkbox" name="custom_field_template_use_multiple_insert" id="custom_field_template_use_multiple_insert" value="1" <?php if ($options['custom_field_template_use_multiple_insert']) { echo 'checked="checked"'; } ?> /> <?php _e('Use multiple image inset', 'custom-field-template'); ?><br /><span style="color:#FF0000; font-weight:bold;"><?php _e('Caution:', 'custom-field-teplate'); ?> <?php _e('You need to edit `wp-admin/includes/media.php`. Delete or comment out the code in the function media_send_to_editor.', 'custom-field-template'); ?></span></p>
|
798 |
</td>
|
799 |
</tr>
|
800 |
+
*/
|
801 |
+
?>
|
802 |
<tr><td>
|
803 |
<p><label for="custom_field_template_replace_keys_by_labels"><?php _e('In case that you would like to replace custom keys by labels if `label` is set', 'custom-field-template'); ?></label>:<br />
|
804 |
<input type="checkbox" name="custom_field_template_replace_keys_by_labels" id="custom_field_template_replace_keys_by_labels" value="1" <?php if ($options['custom_field_template_replace_keys_by_labels']) { echo 'checked="checked"'; } ?> /> <?php _e('Use labels in place of custom keys', 'custom-field-template'); ?></p>
|
1350 |
endif;
|
1351 |
|
1352 |
$out .=
|
1353 |
+
'<dl id="dl_' . $name . $sid . '_' . $cftnum . '">' .
|
1354 |
+
'<dt><span' . $hide . '><label for="' . $name . $sid . '_' . $cftnum . '">' . $title . '</label></span>'.$addfield.'</dt>' .
|
1355 |
'<dd>';
|
1356 |
|
1357 |
if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
|
1358 |
$out .= '<p class="label">' . stripcslashes($label) . '</p>';
|
1359 |
+
$out .= trim($before).'<input id="' . $name . $sid . '_' . $cftnum . '" name="' . $name . '['. $sid . '][]" value="' . attribute_escape(trim($value)) . '" type="text" size="' . $size . '"' . $class . $style . $maxlength . $event_output . $readOnly . ' />'.trim($after);
|
1360 |
|
1361 |
if ( $date == true ) :
|
1362 |
$out .= '<script type="text/javascript">' . "\n" .
|
1489 |
$i = 0;
|
1490 |
if ( is_array($values) ) :
|
1491 |
foreach( $values as $val ) {
|
1492 |
+
$id = $name . $sid . '_' . $cftnum . '_' . $this->sanitize_name( $val );
|
1493 |
|
1494 |
$checked = ( stripcslashes(trim( $val )) == trim( $selected ) ) ? 'checked="checked"' : '';
|
1495 |
|
1552 |
|
1553 |
$out .=
|
1554 |
'<dl id="dl_' . $name . $sid . '_' . $cftnum . '">' .
|
1555 |
+
'<dt><span' . $hide . '><label for="' . $name . $sid . '_' . $cftnum . '">' . $title . '</label></span>'.$addfield.'</dt>' .
|
1556 |
'<dd>';
|
1557 |
|
1558 |
if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
|
1559 |
$out .= '<p class="label">' . stripcslashes($label) . '</p>';
|
1560 |
+
$out .= trim($before).'<select id="' . $name . $sid . '_' . $cftnum . '" name="' . $name . '[' . $sid . '][]"' . $class . $style . $event_output . '>';
|
1561 |
|
1562 |
if ( $selectLabel )
|
1563 |
$out .= '<option value="">' . stripcslashes(trim($selectLabel)) . '</option>';
|
1674 |
|
1675 |
$out .=
|
1676 |
'<dl id="dl_' . $name . $sid . '_' . $cftnum . '">' .
|
1677 |
+
'<dt><span' . $hide . '><label for="' . $name . $sid . '_' . $cftnum . '">' . $title . '</label></span><br />' . $media . $switch . '</dt>' .
|
1678 |
'<dd>';
|
1679 |
|
1680 |
if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
|
1726 |
|
1727 |
$out .=
|
1728 |
'<dl id="dl_' . $name . $sid . '_' . $cftnum . '">' .
|
1729 |
+
'<dt><span' . $hide . '><label for="' . $name . $sid . '_' . $cftnum . '">' . $title . '</label></span>'.$addfield.'</dt>' .
|
1730 |
'<dd>';
|
1731 |
|
1732 |
if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
|
1733 |
$out .= '<p class="label">' . stripcslashes($label) . '</p>';
|
1734 |
+
$out .= trim($before).'<input id="' . $name . $sid . '_' . $cftnum . '" name="' . $name . '['.$sid.'][]" type="file" size="' . $size . '"' . $class . $style . ' onchange="if (jQuery(this).val()) { jQuery(\'#cft_save_button\').attr(\'disabled\', true); } else { jQuery(\'#cft_save_button\').attr(\'disabled\', false); }" />'.trim($after);
|
1735 |
|
1736 |
if ( ( $value = intval($value) ) && $thumb_url = get_attachment_icon_src( $value ) ) :
|
1737 |
$thumb_url = $thumb_url[0];
|
3034 |
if ( is_array($val2) ) :
|
3035 |
foreach( $val2 as $val3 ) :
|
3036 |
if ( $val3 ) :
|
3037 |
+
if ( $ch == 0 ) : $where .= ' AND (';
|
3038 |
+
else :
|
3039 |
+
if ( $replace[$key][$key2]['type'] == 'checkbox' || !$replace[$key][$key2]['type'] ) $where .= ' OR ';
|
3040 |
+
else $where .= ' AND ';
|
3041 |
+
endif;
|
3042 |
switch( $replace[$key][$key2]['operator'] ) :
|
3043 |
case '<=' :
|
3044 |
case '>=' :
|
3047 |
case '=' :
|
3048 |
case '<>' :
|
3049 |
case '<=>':
|
3050 |
+
if ( is_numeric($val3) ) :
|
3051 |
+
$where .= " ROW(ID,1) IN (SELECT post_id,count(post_id) FROM " . $wpdb->postmeta . " WHERE (" . $wpdb->postmeta . ".meta_key = '" . $key . "' AND `" . $wpdb->postmeta . "`.meta_value " . $replace[$key][$key2]['operator'] . " " . trim($val3) . ") GROUP BY post_id) ";
|
3052 |
+
else :
|
3053 |
+
$where .= " ROW(ID,1) IN (SELECT post_id,count(post_id) FROM " . $wpdb->postmeta . " WHERE (" . $wpdb->postmeta . ".meta_key = '" . $key . "' AND `" . $wpdb->postmeta . "`.meta_value " . $replace[$key][$key2]['operator'] . " '" . trim($val3) . "') GROUP BY post_id) ";
|
3054 |
+
endif;
|
3055 |
break;
|
3056 |
default :
|
3057 |
$where .= " ROW(ID,1) IN (SELECT post_id,count(post_id) FROM " . $wpdb->postmeta . " WHERE (" . $wpdb->postmeta . ".meta_key = '" . $key . "' AND `" . $wpdb->postmeta . "`.meta_value LIKE '%" . trim($val3) . "%') GROUP BY post_id) ";
|
3078 |
$where .= " AND ROW(ID,1) IN (SELECT post_id,count(post_id) FROM `" . $wpdb->postmeta . "` WHERE (`" . $wpdb->postmeta . "`.meta_value LIKE '%" . trim($v) . "%') GROUP BY post_id) ";
|
3079 |
endif;
|
3080 |
endforeach;
|
3081 |
+
$where .= " OR ((`" . $wpdb->post . "`.post_title LIKE '%" . trim($_REQUEST['s']) . "%') OR (`" . $wpdb->post . "`.post_content LIKE '%" . trim($_REQUEST['s']) . "%'))";
|
3082 |
endif;
|
3083 |
|
3084 |
if ( is_array($_REQUEST['cftcategory_in']) ) :
|
3102 |
else :
|
3103 |
$where .= " AND `".$wpdb->posts."`.post_status = 'publish' GROUP BY `".$wpdb->posts."`.ID";
|
3104 |
endif;
|
|
|
3105 |
|
3106 |
return $where;
|
3107 |
}
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: Hiroaki Miyashita
|
|
3 |
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: 2.9
|
7 |
-
Stable tag: 1.5.
|
8 |
|
9 |
This plugin adds the default custom fields on the Write Post/Page.
|
10 |
|
@@ -98,6 +98,9 @@ See the default template and modify it.
|
|
98 |
|
99 |
== Changelog ==
|
100 |
|
|
|
|
|
|
|
101 |
= 1.5.3 =
|
102 |
* Bugfix: backslashes and cftsearch.
|
103 |
|
3 |
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: 2.9.1
|
7 |
+
Stable tag: 1.5.4
|
8 |
|
9 |
This plugin adds the default custom fields on the Write Post/Page.
|
10 |
|
98 |
|
99 |
== Changelog ==
|
100 |
|
101 |
+
= 1.5.4 =
|
102 |
+
* Bugfix: custom field ids.
|
103 |
+
|
104 |
= 1.5.3 =
|
105 |
* Bugfix: backslashes and cftsearch.
|
106 |
|