Esempio n. 1
0
 public function get_hashtags($post_id, $add_hashtags = true)
 {
     if (empty($add_hashtags)) {
         // check for false or 0
         return;
     } elseif (is_numeric($add_hashtags)) {
         $max_hashtags = $add_hashtags;
     } elseif (!empty($this->p->options['og_desc_hashtags'])) {
         $max_hashtags = $this->p->options['og_desc_hashtags'];
     } else {
         return;
     }
     $hashtags = apply_filters($this->p->cf['lca'] . '_hashtags_seed', '', $post_id, $add_hashtags);
     if (!empty($hashtags)) {
         if ($this->p->debug->enabled) {
             $this->p->debug->log('hashtags seed = "' . $hashtags . '"');
         }
     } else {
         $tags = array_slice($this->get_tags($post_id), 0, $max_hashtags);
         if (!empty($tags)) {
             // remove special character incompatible with Twitter
             $hashtags = SucomUtil::array_to_hashtags($tags);
             if ($this->p->debug->enabled) {
                 $this->p->debug->log('hashtags (max ' . $max_hashtags . ') = "' . $hashtags . '"');
             }
         }
     }
     return apply_filters($this->p->cf['lca'] . '_hashtags', $hashtags, $post_id, $add_hashtags);
 }