Ideas for upgrade
-
I worked on your plugin for a client. I’ve to fix 2 problems, all in your
/inc/display.phpfile- Your
json_encodefunction miss a parameter to be encode correctly if there is quotes or double-quotes in the claim title. Here is my update version :json_encode($jsonarray, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) - You’re checking the existence of your meta with
get_post_meta($claimtoreviewid, '_fullfact_all_claims', true);but by default you create an array with multiple keys but no value. So yourif ($allclaims)is always true, because your array is not really empty because of the keys. I’ve create a function to check recursively the emptiness of you array. Here is the recursive function :
/** * Recursively check all line of an array to see if it's empty. * @param array $array_var * @return boolean */ function is_array_empty($array_var = array()) { $output = true; if (is_array($array_var) && count($array_var) > 0) { foreach ($array_var as $value) { $output = $output && is_array_empty($value); } } else { $output = empty($array_var); } return $output; }And I update the condition like this :
if ($allclaims && !is_array_empty($allclaims))
Please include this changes on your next update. These are not breaking changes. - Your
The topic ‘Ideas for upgrade’ is closed to new replies.