Utils/WikiTagUtils.php
changeset 8 7d2fb5d7c9ff
parent 2 13f43f53d0ba
child 9 cc32af725176
equal deleted inserted replaced
7:7a877de630fd 8:7d2fb5d7c9ff
    45             $tag->setNormalizedLabel($tag_label_normalized);
    45             $tag->setNormalizedLabel($tag_label_normalized);
    46             $created = true;
    46             $created = true;
    47         }
    47         }
    48         else{
    48         else{
    49             $created = false;
    49             $created = false;
    50             //$created = true;
       
    51         }
    50         }
    52         
    51         
    53         // We request Wikipedia if the tag is created
    52         // We request Wikipedia if the tag is created
    54         if($created==true){
    53         if($created==true){
    55             $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized);
    54             $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized);
    82             $wikipedia_revision_id = $wp_response['revision_id'];
    81             $wikipedia_revision_id = $wp_response['revision_id'];
    83         }
    82         }
    84         else{
    83         else{
    85             $wikipedia_revision_id = null;
    84             $wikipedia_revision_id = null;
    86         }
    85         }
       
    86         //return "coucou4";
    87         
    87         
    88         return array($tag, $wikipedia_revision_id, $created);//, $wpReponse);
    88         return array($tag, $wikipedia_revision_id, $created);//, $wpReponse);
    89     }
    89     }
    90     
    90     
    91     /**
    91     /**
    92      * Cleans the tag label
    92      * Cleans the tag label
    93      */
    93      */
    94     private static function normalizeTag($tag_label)
    94     public static function normalizeTag($tag_label)
    95     {
    95     {
    96         if(strlen($tag_label)==0){
    96         if(strlen($tag_label)==0){
    97             return $tag_label;
    97             return $tag_label;
    98         }
    98         }
    99         $tag_label = trim($tag_label);//tag.strip()
    99         $tag_label = trim($tag_label);//tag.strip()