editor-buttons.php -> check if is array

Homepage Forums Pro Support Forum BoldR Pro BoldR Pro Bug Reports editor-buttons.php -> check if is array

editor-buttons.php -> check if is array

This topic contains 2 replies, has 2 voices, and was last updated by  Erich 5 months, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #21014
    editor-buttons.php -> check if is array

    Erich
    Participant

    Hi,
    i’m using siteorigins pagebuilder with boldr pro, works well, found just one little “bug”

    in /themes/boldr-pro/functions/icefit-mce4.0/editor-buttons.php:

    // Register TinyMCE buttons
    function icefit_register_button($buttons) {
    	if (is_array($buttons))
    	{
    		$icefit_tinymce_plugins = icefit_tinymce_plugins_settings();
    		foreach($icefit_tinymce_plugins as $plugin):
    			array_push($buttons, "", $plugin['name']);
    		endforeach;
    	}
    	return $buttons;
    }

    if pagebuilder is active for a post or page the buttons array is empty so php throws an error on editing a page or post. i think, in general, testing for an empty array here would be useful…

    greets
    Erich

    #21015
    Reply to: editor-buttons.php -> check if is array

    iceable
    Keymaster
    Support
    Happy with my help?
    Buy me a beer!

    Hi Erich,

    I just reviewed this and it seems totally right: the $buttons variable is indeed initialised as an empty array for both “visual” and “text” tab in /wp-includes/class-wp-editor.php but it is not initialised at all when using another (third party plugin powered) tab – hence causing a php warning when used as an argument of array_push().

    And in any case, making sure that an expected array actually is an array never hurts and probably should have been done before anyway.

    Thanks for pointing this out, I’ll patch this and push an update today! 🙂

    #21028
    Reply to: editor-buttons.php -> check if is array

    Erich
    Participant

    Thanks for the fast fix!
    Erich

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.


PayPal Verified
Secured by PayPal
Secure Credit Card payments powered by Stripe
SiteLock