Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Guillermo Devi

    (@guillermo-devi)

    I have made some changes to your plugin to remove those notices. These are patches, so you should look into your code as to why you are using undefined constants.

    You can add these lines to your plugin in index.php after your constant definitions I have defined the missing ones:

    define( 'WP_CATALOGUE', plugin_dir_url( __FILE__ ) );
    define( 'WP_CATALOGUE_PRODUCTS', WP_CATALOGUE.'products'  );
    define( 'WP_CATALOGUE_INCLUDES', WP_CATALOGUE.'includes'  );
    define( 'WP_CATALOGUE_CSS', WP_CATALOGUE_INCLUDES.'/css'  );
    define( 'WP_CATALOGUE_JS', WP_CATALOGUE_INCLUDES.'/js'  );
    //these were used but missing, please try to replace these with useful ones
    define( 'WPC_SCRIPT', 'WPC_SCRIPT');
    define( 'WPC_STYLE', 'WPC_STYLE');
    define( 'WPCACHEHOME', WP_CATALOGUE);

    Also there is an undefined index in
    /wp-catalogue/products/wpc-product.php on line 78

    to avoid this I have added an isset() check like this:

    // verify this came from the our screen and with proper authorization,
        // because save_post can be triggered at other times
        if ( isset($_POST['itemmeta_noncename'])
            && false == wp_verify_nonce( $_POST['itemmeta_noncename'], plugin_basename(__FILE__) )) {
        return $post->ID;
        }

    Also you are using $_POST contents even when they are not set, so you should better guard your code like this:

    // OK, we're authenticated: we need to find and save the data
        // We'll put it into an array to make it easier to loop though.
        $item_meta = array_intersect_key($_POST, array_flip(array('product_img1',
                                                                  'product_img2',
                                                                  'product_img3',
                                                                  'product_price')));

    instead of this in /wp-catalogue/products/wpc-product.php on line 84

    // OK, we're authenticated: we need to find and save the data
        // We'll put it into an array to make it easier to loop though.
    	$item_meta['product_img1'] 		= $_POST['product_img1'];
    	$item_meta['product_img2'] 		= $_POST['product_img2'];
    	$item_meta['product_img3'] 		= $_POST['product_img3'];
    	$item_meta['product_price'] 	= $_POST['product_price'];

    this way when there is no post content you avoid the notices.

    Thread Starter Guillermo Devi

    (@guillermo-devi)

    Ok so after looking a bit into the code, your constants are not defined (as the notices say). Those notices cause php to trigger the warning because headers are sent for the notice…

    What are those constants? Can’t you just remove those?

    You are totally right, sorry for my comment then. I will have a look at the code to see if the modification for the “Page analysis” can be deployed easily.

    It would be nice to inform from within the plugin that the diacritics word is not equivalent to the un-diacriticized one (Google thinks of them as different words). Although it is good thing to have the two versions because people may search both: with and without diacritics.

    I have made a modification to the last version of the plugin for those who don’t want to edit code.

    claudemlandry your modification uses JavaScript and PHP for something that can be achieved solely modifying the javascript code. It might work but it isn’t very clean.

    For the french speaking users here is an explanation on how you should update the plugin.

    I have submitted a comment to worpdress seo plugin forums, and a patch to Yoast. I don’t know when he is going to integrate it.

    I hope you find it useful.

Viewing 4 replies - 1 through 4 (of 4 total)