Version Description
Download this release
Release Info
Developer | Hiroaki Miyashita |
Plugin | Custom Field Template |
Version | 2.3.9 |
Comparing to | |
See all releases |
Code changes from version 2.3.8 to 2.3.9
- custom-field-template.php +17 -18
- readme.txt +6 -2
custom-field-template.php
CHANGED
@@ -5,7 +5,7 @@ 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 |
Author URI: http://wpgogo.com/
|
8 |
-
Version: 2.3.
|
9 |
Text Domain: custom-field-template
|
10 |
Domain Path: /
|
11 |
*/
|
@@ -62,8 +62,7 @@ class custom_field_template {
|
|
62 |
add_filter( 'edit_form_after_title', array(&$this, 'custom_field_template_edit_form_after_title') );
|
63 |
|
64 |
if ( isset($_REQUEST['cftsearch_submit']) ) :
|
65 |
-
|
66 |
-
add_action( 'post_limits', array(&$this, 'custom_field_template_post_limits'), 100);
|
67 |
add_filter( 'posts_join', array(&$this, 'custom_field_template_posts_join'), 100 );
|
68 |
add_filter( 'posts_where', array(&$this, 'custom_field_template_posts_where'), 100 );
|
69 |
add_filter( 'posts_orderby', array(&$this, 'custom_field_template_posts_orderby'), 100 );
|
@@ -3631,9 +3630,9 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3631 |
$values = explode( '#', $rval['value'] );
|
3632 |
else
|
3633 |
$values = explode( '#', $rval['originalValue'] );
|
3634 |
-
$valueLabel = explode( '#', $rval['valueLabel'] );
|
3635 |
$default = explode( '#', $rval['default'] );
|
3636 |
-
if ( is_numeric($rval['searchCode']) ) :
|
3637 |
eval(stripcslashes($options['php'][$rval['searchCode']]));
|
3638 |
endif;
|
3639 |
if ( count($values) > 1 ) :
|
@@ -3642,7 +3641,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3642 |
foreach( $values as $metavalue ) :
|
3643 |
$checked = '';
|
3644 |
$metavalue = trim($metavalue);
|
3645 |
-
if ( is_array($_REQUEST['cftsearch'][rawurlencode($key)][$rkey]) ) :
|
3646 |
if ( in_array($metavalue, $_REQUEST['cftsearch'][rawurlencode($key)][$rkey]) )
|
3647 |
$checked = ' checked="checked"';
|
3648 |
else
|
@@ -3652,7 +3651,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3652 |
$checked = ' checked="checked"';
|
3653 |
|
3654 |
$replace_val[$rkey] .= '<li><label><input type="checkbox" name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]" value="' . esc_attr($metavalue) . '"' . $class . $checked . ' /> ';
|
3655 |
-
if ( $valueLabel[$j] ) $replace_val[$rkey] .= stripcslashes($valueLabel[$j]);
|
3656 |
else $replace_val[$rkey] .= stripcslashes($metavalue);
|
3657 |
$replace_val[$rkey] .= '</label></li>';
|
3658 |
$j++;
|
@@ -3670,9 +3669,9 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3670 |
case 'radio':
|
3671 |
if ( !empty($rval['class']) ) $class = ' class="' . $rval['class'] . '"';
|
3672 |
$values = explode( '#', $rval['value'] );
|
3673 |
-
$valueLabel = explode( '#', $rval['valueLabel'] );
|
3674 |
$default = explode( '#', $rval['default'] );
|
3675 |
-
if ( is_numeric($rval['searchCode']) ) :
|
3676 |
eval(stripcslashes($options['php'][$rval['searchCode']]));
|
3677 |
endif;
|
3678 |
if ( count($values) > 1 ) :
|
@@ -3681,16 +3680,16 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3681 |
foreach ( $values as $metavalue ) :
|
3682 |
$checked = '';
|
3683 |
$metavalue = trim($metavalue);
|
3684 |
-
if ( is_array($_REQUEST['cftsearch'][rawurlencode($key)][$rkey]) ) :
|
3685 |
if ( in_array($metavalue, $_REQUEST['cftsearch'][rawurlencode($key)][$rkey]) )
|
3686 |
$checked = ' checked="checked"';
|
3687 |
else
|
3688 |
$checked = '';
|
3689 |
endif;
|
3690 |
-
if ( in_array($metavalue, $default) && !$_REQUEST['cftsearch'][rawurlencode($key)][$rkey] )
|
3691 |
$checked = ' checked="checked"';
|
3692 |
$replace_val[$rkey] .= '<li><label><input type="radio" name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]" value="' . esc_attr($metavalue) . '"' . $class . $checked . ' /> ';
|
3693 |
-
if ( $valueLabel[$j] ) $replace_val[$rkey] .= stripcslashes(trim($valueLabel[$j]));
|
3694 |
else $replace_val[$rkey] .= stripcslashes($metavalue);
|
3695 |
$replace_val[$rkey] .= '</label></li>';
|
3696 |
$j++;
|
@@ -3723,10 +3722,10 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3723 |
if ( in_array($metavalue, $default) && !$_REQUEST['cftsearch'][rawurlencode($key)][$rkey] )
|
3724 |
$checked = ' checked="checked"';
|
3725 |
|
3726 |
-
if ( $_REQUEST['cftsearch'][rawurlencode($key)][$rkey][0] == $metaval ) $selected = ' selected="selected"';
|
3727 |
else $selected = "";
|
3728 |
$replace_val[$rkey] .= '<option value="' . esc_attr($metaval) . '"' . $selected . '>';
|
3729 |
-
if ( $valueLabel[$j] )
|
3730 |
$replace_val[$rkey] .= stripcslashes(trim($valueLabel[$j]));
|
3731 |
else
|
3732 |
$replace_val[$rkey] .= stripcslashes($metaval);
|
@@ -3742,7 +3741,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
3742 |
$output = $this->EvalBuffer($output);
|
3743 |
$key = preg_quote($key, '/');
|
3744 |
$output = preg_replace('/\['.$key.'\](?!\[[0-9]+\])/', $replace_val[0], $output);
|
3745 |
-
$output =
|
3746 |
endforeach;
|
3747 |
endforeach;
|
3748 |
endfor;
|
@@ -4018,10 +4017,10 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
|
|
4018 |
|
4019 |
if ( !$sql_limit ) return;
|
4020 |
list($offset, $old_limit) = explode(',', $sql_limit);
|
4021 |
-
$limit = (int)$_REQUEST['limit'];
|
4022 |
-
|
4023 |
-
$limit = trim($old_limit);
|
4024 |
$wp_query->query_vars['posts_per_page'] = $limit;
|
|
|
4025 |
$offset = ($wp_query->query_vars['paged'] - 1) * $limit;
|
4026 |
if ( $offset < 0 ) $offset = 0;
|
4027 |
|
5 |
Description: This plugin adds the default custom fields on the Write Post/Page.
|
6 |
Author: Hiroaki Miyashita
|
7 |
Author URI: http://wpgogo.com/
|
8 |
+
Version: 2.3.9
|
9 |
Text Domain: custom-field-template
|
10 |
Domain Path: /
|
11 |
*/
|
62 |
add_filter( 'edit_form_after_title', array(&$this, 'custom_field_template_edit_form_after_title') );
|
63 |
|
64 |
if ( isset($_REQUEST['cftsearch_submit']) ) :
|
65 |
+
add_action( 'post_limits', array(&$this, 'custom_field_template_post_limits'), 100);
|
|
|
66 |
add_filter( 'posts_join', array(&$this, 'custom_field_template_posts_join'), 100 );
|
67 |
add_filter( 'posts_where', array(&$this, 'custom_field_template_posts_where'), 100 );
|
68 |
add_filter( 'posts_orderby', array(&$this, 'custom_field_template_posts_orderby'), 100 );
|
3630 |
$values = explode( '#', $rval['value'] );
|
3631 |
else
|
3632 |
$values = explode( '#', $rval['originalValue'] );
|
3633 |
+
$valueLabel = isset($rval['valueLabel']) ? explode( '#', $rval['valueLabel'] ) : array();
|
3634 |
$default = explode( '#', $rval['default'] );
|
3635 |
+
if ( isset($rval['searchCode']) && is_numeric($rval['searchCode']) ) :
|
3636 |
eval(stripcslashes($options['php'][$rval['searchCode']]));
|
3637 |
endif;
|
3638 |
if ( count($values) > 1 ) :
|
3641 |
foreach( $values as $metavalue ) :
|
3642 |
$checked = '';
|
3643 |
$metavalue = trim($metavalue);
|
3644 |
+
if ( isset($_REQUEST['cftsearch']) && is_array($_REQUEST['cftsearch'][rawurlencode($key)][$rkey]) ) :
|
3645 |
if ( in_array($metavalue, $_REQUEST['cftsearch'][rawurlencode($key)][$rkey]) )
|
3646 |
$checked = ' checked="checked"';
|
3647 |
else
|
3651 |
$checked = ' checked="checked"';
|
3652 |
|
3653 |
$replace_val[$rkey] .= '<li><label><input type="checkbox" name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]" value="' . esc_attr($metavalue) . '"' . $class . $checked . ' /> ';
|
3654 |
+
if ( isset($valueLabel[$j]) ) $replace_val[$rkey] .= stripcslashes($valueLabel[$j]);
|
3655 |
else $replace_val[$rkey] .= stripcslashes($metavalue);
|
3656 |
$replace_val[$rkey] .= '</label></li>';
|
3657 |
$j++;
|
3669 |
case 'radio':
|
3670 |
if ( !empty($rval['class']) ) $class = ' class="' . $rval['class'] . '"';
|
3671 |
$values = explode( '#', $rval['value'] );
|
3672 |
+
$valueLabel = isset($rval['valueLabel']) ? explode( '#', $rval['valueLabel'] ) : array();
|
3673 |
$default = explode( '#', $rval['default'] );
|
3674 |
+
if ( isset($rval['searchCode']) && is_numeric($rval['searchCode']) ) :
|
3675 |
eval(stripcslashes($options['php'][$rval['searchCode']]));
|
3676 |
endif;
|
3677 |
if ( count($values) > 1 ) :
|
3680 |
foreach ( $values as $metavalue ) :
|
3681 |
$checked = '';
|
3682 |
$metavalue = trim($metavalue);
|
3683 |
+
if ( isset($_REQUEST['cftsearch']) && is_array($_REQUEST['cftsearch'][rawurlencode($key)][$rkey]) ) :
|
3684 |
if ( in_array($metavalue, $_REQUEST['cftsearch'][rawurlencode($key)][$rkey]) )
|
3685 |
$checked = ' checked="checked"';
|
3686 |
else
|
3687 |
$checked = '';
|
3688 |
endif;
|
3689 |
+
if ( in_array($metavalue, $default) && (isset($_REQUEST['cftsearch']) && !$_REQUEST['cftsearch'][rawurlencode($key)][$rkey]) )
|
3690 |
$checked = ' checked="checked"';
|
3691 |
$replace_val[$rkey] .= '<li><label><input type="radio" name="cftsearch[' . rawurlencode($key) . '][' . $rkey . '][]" value="' . esc_attr($metavalue) . '"' . $class . $checked . ' /> ';
|
3692 |
+
if ( isset($valueLabel[$j]) ) $replace_val[$rkey] .= stripcslashes(trim($valueLabel[$j]));
|
3693 |
else $replace_val[$rkey] .= stripcslashes($metavalue);
|
3694 |
$replace_val[$rkey] .= '</label></li>';
|
3695 |
$j++;
|
3722 |
if ( in_array($metavalue, $default) && !$_REQUEST['cftsearch'][rawurlencode($key)][$rkey] )
|
3723 |
$checked = ' checked="checked"';
|
3724 |
|
3725 |
+
if ( isset($_REQUEST['cftsearch']) && $_REQUEST['cftsearch'][rawurlencode($key)][$rkey][0] == $metaval ) $selected = ' selected="selected"';
|
3726 |
else $selected = "";
|
3727 |
$replace_val[$rkey] .= '<option value="' . esc_attr($metaval) . '"' . $selected . '>';
|
3728 |
+
if ( isset($valueLabel[$j]) )
|
3729 |
$replace_val[$rkey] .= stripcslashes(trim($valueLabel[$j]));
|
3730 |
else
|
3731 |
$replace_val[$rkey] .= stripcslashes($metaval);
|
3741 |
$output = $this->EvalBuffer($output);
|
3742 |
$key = preg_quote($key, '/');
|
3743 |
$output = preg_replace('/\['.$key.'\](?!\[[0-9]+\])/', $replace_val[0], $output);
|
3744 |
+
$output = preg_replace_callback('/\['.$key.'\]\[([0-9]+)\](?!\[\])/', function ($m) { return $replace_val[$m[1]]; }, $output);
|
3745 |
endforeach;
|
3746 |
endforeach;
|
3747 |
endfor;
|
4017 |
|
4018 |
if ( !$sql_limit ) return;
|
4019 |
list($offset, $old_limit) = explode(',', $sql_limit);
|
4020 |
+
$limit = isset($_REQUEST['limit']) ? (int)$_REQUEST['limit'] : trim($old_limit);
|
4021 |
+
|
|
|
4022 |
$wp_query->query_vars['posts_per_page'] = $limit;
|
4023 |
+
$wp_query->query_vars['paged'] = isset($wp_query->query['paged']) ? $wp_query->query['paged'] : 1;
|
4024 |
$offset = ($wp_query->query_vars['paged'] - 1) * $limit;
|
4025 |
if ( $offset < 0 ) $offset = 0;
|
4026 |
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: Hiroaki Miyashita
|
|
3 |
Donate link: http://wpgogo.com/development/custom-field-template.html
|
4 |
Tags: custom field, custom fields, custom, fields, field, template, meta, custom field template, custom post type
|
5 |
Requires at least: 2.1
|
6 |
-
Tested up to: 4.9.
|
7 |
-
Stable tag: 2.3.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
The Custom Field Template plugin extends the functionality of custom fields.
|
@@ -114,6 +114,10 @@ See the default template and modify it.
|
|
114 |
|
115 |
== Changelog ==
|
116 |
|
|
|
|
|
|
|
|
|
117 |
= 2.3.8 =
|
118 |
* Code cleaning.
|
119 |
|
3 |
Donate link: http://wpgogo.com/development/custom-field-template.html
|
4 |
Tags: custom field, custom fields, custom, fields, field, template, meta, custom field template, custom post type
|
5 |
Requires at least: 2.1
|
6 |
+
Tested up to: 4.9.6
|
7 |
+
Stable tag: 2.3.9
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
The Custom Field Template plugin extends the functionality of custom fields.
|
114 |
|
115 |
== Changelog ==
|
116 |
|
117 |
+
= 2.3.8 =
|
118 |
+
* Code cleaning.
|
119 |
+
* Bugfix: cftsearch.
|
120 |
+
|
121 |
= 2.3.8 =
|
122 |
* Code cleaning.
|
123 |
|