Exemple #1
0
 /**
  * Smiley short notation as defined in database
  */
 static function short($markup, $matches)
 {
     $smileys = Smiley::getShort();
     $name    = $smileys[$matches[2]];
     return isset($name)
         ? $matches[1] . Smiley::img($name) . $matches[3]
         : $matches[0];
 }
Exemple #2
0
 /**
  * Back end for the smiley picker javascript module.
  * Renders a list of smileys very similar to the index action but
  * unfortunately still to different to be combined.
  *
  * @param mixed $view Subset to display, defaults to favorites if enabled
  * @param int   $page Section of subset to display
  */
 function picker_action($view = null, $page = 0)
 {
     $per_page = self::GRID_WIDTH * self::GRID_HEIGHT;
     $this->view = $view ?: ($this->default === 'favorites' ? 'favorites' : 'all');
     $smileys = $this->view == 'favorites' ? Smiley::getByIds($this->favorites->get()) : Smiley::getGrouped($this->view);
     $this->page = $page;
     $this->pages = floor(count($smileys) / $per_page);
     array_walk($smileys, function ($smiley) {
         $smiley->link = Smiley::getURL($smiley->name);
         $smiley->html = Smiley::img($smiley->name);
     });
     $this->smileys = array_slice($smileys, $page * $per_page, $per_page);
     $this->characters = Smiley::getUsedCharacters();
 }