Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions admin/mf_ajax_call.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public function resolve($data){
public function mf_sort_field($data){
if ( !empty( $data['order'] ) && !empty( $data['group_id'] ) ) {
$order = $data['order'];
$order = split(',',$order);
array_walk( $order, create_function( '&$v,$k', '$v = str_replace("order_","",$v);' ));
$order = explode(',',$order);
array_walk( $order, function( &$v,$k ) { $v = str_replace("order_","",$v); });

if( $thing = mf_custom_fields::save_order_field( $data['group_id'], $order ) ) {
$resp = array('success' => true);
Expand Down
6 changes: 3 additions & 3 deletions admin/mf_custom_fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function get_properties() {
}


public function get_options($options = NULL,$name){
public function get_options($name, $options = NULL){
global $mf_domain;

print '<div class="desc_field">';
Expand Down Expand Up @@ -454,7 +454,7 @@ function form_custom_field( $data ) {

<div class="alignleft fixed" style="width: 40%;" id="mf_add_custom_field">
<?php foreach( $data['core'] as $core ): ?>
<?php $core['value'] = htmlentities($core['value']); ?>
<?php $core['value'] = htmlentities($core['value'] ?? ''); ?>
<?php if( $core['type'] == 'hidden' ): ?>
<?php mf_form_hidden($core); ?>
<?php elseif( $core['type'] == 'text' ):?>
Expand Down Expand Up @@ -494,7 +494,7 @@ function form_custom_field( $data ) {
if( $data['core']['id']['value'] ){
$name = sprintf('%s_field',$data['core']['type']['value']);
$mf_field = new $name();
$mf_field->get_options($data['option'],$name);
$mf_field->get_options($name, $data['option']);
} ?>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions admin/mf_posttype.php
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ public function set_categories(){
'order' => 'ASC'
);
$termsOfCategory = get_terms($name,$term_args);
$this->PrintNestedCats( $termsOfCategory, 0, 0, $customCategoryIds );
$this->PrintNestedCats( $termsOfCategory, $customCategoryIds, 0, 0 );
echo "</div>";
}

Expand All @@ -623,7 +623,7 @@ public function set_categories(){
}


private function PrintNestedCats( $cats, $parent = 0, $depth = 0, $customCategoryIds ) {
private function PrintNestedCats( $cats, $customCategoryIds, $parent = 0, $depth = 0 ) {
foreach ($cats as $cat) :
if( $cat->parent == $parent ) {
$checked = "";
Expand All @@ -635,7 +635,7 @@ private function PrintNestedCats( $cats, $parent = 0, $depth = 0, $customCategor
echo str_repeat('&nbsp;', $depth * 4);
?> <input type="checkbox" name="custom-write-panel-categories[]" class="dos" value="<?php echo $cat->taxonomy . "-" .$cat->term_id?>" <?php echo $checked?> /> <?php echo $cat->name ?> <br/>
<?php
$this->PrintNestedCats( $cats, $cat->term_id, $depth+1, $customCategoryIds );
$this->PrintNestedCats( $cats, $customCategoryIds, $cat->term_id, $depth+1 );
}
endforeach;
}
Expand Down Expand Up @@ -663,7 +663,7 @@ public function save_post_type () {
//reload form and show warning
}
}
$name = trim($mf['option']['capability_type']);
$name = trim($mf['option']['capability_type'] ?? '');
if( !in_array($name,array('post','page')) && !empty($name) ){
//register capabilities for admin
$this->_add_cap($name);
Expand Down
2 changes: 1 addition & 1 deletion admin/mf_tiny_mce.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ function mf_tiny_mce( $teeny = false, $settings = false ) {
$val = $v ? 'true' : 'false';
$mce_options .= $k . ':' . $val . ', ';
continue;
} elseif ( !empty($v) && is_string($v) && ( ('{' == $v{0} && '}' == $v{strlen($v) - 1}) || ('[' == $v{0} && ']' == $v{strlen($v) - 1}) || preg_match('/^\(?function ?\(/', $v) ) ) {
} elseif ( !empty($v) && is_string($v) && ( ('{' == $v[0] && '}' == $v[strlen($v) - 1]) || ('[' == $v[0] && ']' == $v[strlen($v) - 1]) || preg_match('/^\(?function ?\(/', $v) ) ) {
$mce_options .= $k . ':' . $v . ', ';
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion main.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Magic Fields
* Plugin URI: http://magicfields.org
* Description: Create custom fields for your post types
* Version: 2.3.3.2
* Version: 2.3.7
* Author: Hunk
* Author URI: http://magicfields.org
* License: GPL2
Expand Down
6 changes: 3 additions & 3 deletions mf_front_end.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function get ($field_name, $group_index=1, $field_index=1 ,$post_id=NULL) {

if(!$post_id){ $post_id = $post->ID; }

$field = get_data($field_name,$group_index,$field_index,$post_id);
$field = get_data($field_name,$post_id,$group_index,$field_index);
if(!$field) return FALSE;

$type = $field['type'];
Expand Down Expand Up @@ -227,7 +227,7 @@ function get_label($field_name,$post_id=NULL){

if(!$post_id){ $post_id = $post->ID; }

$field = get_data($field_name,1,1,$post_id);
$field = get_data($field_name,$post_id,1,1);
if(!$field) return FALSE;

return $field['label'];
Expand Down Expand Up @@ -549,7 +549,7 @@ function _processed_value($value, $type, $options = array(), $image_array = 0 ){
}


function get_data( $field_name, $group_index=1, $field_index=1, $post_id ){
function get_data( $field_name, $post_id, $group_index=1, $field_index=1 ){
global $wpdb;

$field_name = str_replace(" ","_",$field_name);
Expand Down
25 changes: 24 additions & 1 deletion readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* Authors: [Edgar Garcia](http://hunk.com.mx "Hunk")
* Tested up to: Wordpress 4.2.2
* Requires at least: 3.1
* Stable tag: 2.3.3.2
* Requires PHP: 8.2
* Stable tag: 2.3.7
* Description: Magic Fields 2 is a feature rich Wordpress CMS plugin
* License: GPLv2

Expand Down Expand Up @@ -42,6 +43,28 @@ Follow these steps to install MF2:

## Changelog ##

###2.3.7###
* PHP 8.2 compatibility improvements
* Updated minimum PHP requirement to 8.2
* Enhanced compatibility with PHP 8.2 dynamic properties and type system
* Fixed potential issues with PHP 8.2 deprecation warnings

###2.3.6###
* PHP 8.1 compatibility improvements
* Updated minimum PHP requirement to 8.1
* Fixed null value handling for string functions (trim, htmlentities)
* Enhanced compatibility with PHP 8.1 deprecation warnings

###2.3.5###
* PHP 8.0 compatibility improvements
* Updated minimum PHP requirement to 8.0
* Enhanced error handling for PHP 8.0+ compatibility

###2.3.4###
* PHP 7.4 and PHP 8.x compatibility fix
* Replace deprecated create_function with anonymous function
* Replace deprecated split function with explode

###2.3.3.2###
* fix problem with _processed_value and images

Expand Down
25 changes: 24 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ Contributors: hunk
Tags: cms, post types, fields, taxonomies, custom fields, admin, advanced, edit, magic fields, more fields, Post, repeater, simple fields, text, textarea, type, advanced custom fields, cck,
Tested up to: Wordpress 4.2.2
Requires at least: 3.1
Requires PHP: 8.2
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=edgar%40programador%2ecom&lc=GB&item_name=Donation%20Magic%20Fields&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
Stable tag: 2.3.3.2
Stable tag: 2.3.7
Description: Magic Fields 2 is a feature rich Wordpress CMS plugin

== Description ==
Expand All @@ -28,6 +29,28 @@ Follow this steps to install MF2

== Changelog ==

= 2.3.7 =
* PHP 8.2 compatibility improvements
* Updated minimum PHP requirement to 8.2
* Enhanced compatibility with PHP 8.2 dynamic properties and type system
* Fixed potential issues with PHP 8.2 deprecation warnings

= 2.3.6 =
* PHP 8.1 compatibility improvements
* Updated minimum PHP requirement to 8.1
* Fixed null value handling for string functions (trim, htmlentities)
* Enhanced compatibility with PHP 8.1 deprecation warnings

= 2.3.5 =
* PHP 8.0 compatibility improvements
* Updated minimum PHP requirement to 8.0
* Enhanced error handling for PHP 8.0+ compatibility

= 2.3.4 =
* PHP 7.4 and PHP 8.x compatibility fix
* Replace deprecated create_function with anonymous function
* Replace deprecated split function with explode

= 2.3.3.1 =
* fix problem with _processed_value and images

Expand Down