Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4979

    shariq222
    Participant
    Points: 7

    I got following error when I tried to activate the plugin;
    Fatal error: Cannot redeclare hex2rgb() (previously declared in /home4/test/public_html/mydomain.com/wp-content/themes/goodnews5/framework/functions/momizat_functions.php:505) in /home4/test/public_html/mydomain.com/wp-content/plugins/dynamic-menu-manager/duogeek/helper.php on line 105

    Please provide a fix for it.

    #4980

    Damien
    Staff
    Points: 8

    Hello Shariq,
    Hope you are fine and thanks for using our plugin.

    From your error report we found that function hex2rgb already declared in your theme’s function file, so that its conflicting with our helper function. Currently I am giving you a quick fix. Open helper.php file from duogeek folder of our plugin and on line 105 find this code

    function hex2rgb($hex) {
    	$hex = str_replace("#", "", $hex);
    
    	if(strlen($hex) == 3) {
    	    $r = hexdec(substr($hex,0,1).substr($hex,0,1));
    	    $g = hexdec(substr($hex,1,1).substr($hex,1,1));
    	    $b = hexdec(substr($hex,2,1).substr($hex,2,1));
    	} else {
    	    $r = hexdec(substr($hex,0,2));
    	    $g = hexdec(substr($hex,2,2));
    	    $b = hexdec(substr($hex,4,2));
    	}
    	$rgb = array($r, $g, $b);
    	return implode(",", $rgb); // returns the rgb values separated by commas
    	//return $rgb; // returns an array with the rgb values
    	}

    Replace with following code

    if( ! function_exists( 'hex2rgb' ) ) {
    	function hex2rgb($hex) {
    	    $hex = str_replace("#", "", $hex);
    
    	    if(strlen($hex) == 3) {
    	        $r = hexdec(substr($hex,0,1).substr($hex,0,1));
    	        $g = hexdec(substr($hex,1,1).substr($hex,1,1));
    	        $b = hexdec(substr($hex,2,1).substr($hex,2,1));
    	    } else {
    	        $r = hexdec(substr($hex,0,2));
    	        $g = hexdec(substr($hex,2,2));
    	        $b = hexdec(substr($hex,4,2));
    	    }
    	    $rgb = array($r, $g, $b);
    	    return implode(",", $rgb); // returns the rgb values separated by commas
    	    //return $rgb; // returns an array with the rgb values
    	}
    }

    This will fix your issue.
    Sorry for the inconvenience. We will fix this in our next update. Let us know if you face any other issue.

    Regards
    Damien

    #4982

    shariq222
    Participant
    Points: 7

    This fix did not work. However, I removed this code segment and problem got fixed. Did I do something wrong?

    Thanks and regards

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

You must be logged in to reply to this topic.