michaeluno / admin-page-framework

Facilitates WordPress plugin and theme development.
http://admin-page-framework.michaeluno.jp/
Other
337 stars 71 forks source link

Booleans are not printable #240

Closed szepeviktor closed 8 years ago

szepeviktor commented 8 years ago

Please fix boolean printing.

$_sRpeatable = getAOrB( $bRpeatable, 'true', 'false' );
$_sExternalSource = getAOrB( $bExternalSource, 'true', 'false' );

https://github.com/michaeluno/admin-page-framework/blob/master/library/apf/factory/_common/form/field_type/AdminPageFramework_FieldType_media.php#L442

szepeviktor commented 8 years ago

Also here https://github.com/michaeluno/admin-page-framework/blob/master/library/apf/factory/_common/form/field_type/AdminPageFramework_FieldType_media.php#L769

michaeluno commented 8 years ago

I'm trying to understand what the problem is but haven't gotten it yet. Can you add some more information for me so that I'll understand?

szepeviktor commented 8 years ago

The plugin tries to echo booleans into JavaScript which does not result in the string true or false.

jQuery( document ).ready( function(){
    setusunlocked_AdminPageFrameworkImageUploader( '{$sInputID}', '{$bRpeatable}', '{$bExternalSource}' );
});
szepeviktor commented 8 years ago

PHP Notice: Array to string conversion in /inc/apf/factory/_common/form/field_type/AdminPageFramework_FieldType_media.php on line 442

michaeluno commented 8 years ago

The plugin tries to echo booleans into JavaScript which does not result in the string true or false

The value types in that functions you linked are loosely handled. However, I don't see any issue in the resulting behavior in the program.

Just for intelligibility of the code, I've changed the variable types passed to the setAdminPageFrameworkImageUploader() and setAdminPageFrameworkMediaUploader() functions.

PHP Notice: Array to string conversion in /inc/apf/factory/_common/form/field_type/AdminPageFramework_FieldType_media.php on line 442

Can you provide the steps to reproduce it?

szepeviktor commented 8 years ago

Rpeatable could be an array:

                'repeatable'    => array(
                    'max' => 4,
                ),
michaeluno commented 8 years ago

I see. I could confirm that PHP notice. Thanks for the report.

szepeviktor commented 8 years ago

Thanks.

michaeluno commented 8 years ago

You are welcome!