Esempio n. 1
0
 /**
  * Facebook Like Button after header.
  *
  * @since 1.1
  *
  * @return void
  */
 public static function after_header()
 {
     // Facebook Like Button social plugin markup builder
     if (!class_exists('Facebook_Like_Button')) {
         require_once dirname(dirname(__FILE__)) . '/social-plugins/class-facebook-like-button.php';
     }
     // promote Facebook for WordPress page on Facebook Developers site
     $like_button = new Facebook_Like_Button(false);
     $like_button->setURL('https://developers.facebook.com/docs/wordpress/');
     $like_button->setLayout('button_count');
     $like_button->includeShareButton();
     $like_button->setFont('arial');
     $like_button->setReference('wp-admin');
     echo $like_button->asHTML();
 }
 /**
  * convert an options array into an object.
  *
  * @since 1.1
  *
  * @param array $values associative array
  * @return Facebook_Like_Button like object
  */
 public static function fromArray($values)
 {
     if (!is_array($values) || empty($values)) {
         return;
     }
     $like_button = new Facebook_Like_Button();
     if (isset($values['href']) && is_string($values['href'])) {
         $like_button->setURL($values['href']);
     }
     if (isset($values['layout']) && is_string($values['layout'])) {
         $like_button->setLayout($values['layout']);
     }
     if (isset($values['show_faces']) && ($values['show_faces'] === true || $values['show_faces'] === 'true' || $values['show_faces'] == 1)) {
         $like_button->showFaces();
     }
     if (isset($values['share']) && ($values['share'] === true || $values['share'] === 'true' || $values['share'] == 1)) {
         $like_button->includeShareButton();
     }
     if (isset($values['width'])) {
         $like_button->setWidth(absint($values['width']));
     }
     if (isset($values['action'])) {
         $like_button->setAction($values['action']);
     }
     if (isset($values['font'])) {
         $like_button->setFont($values['font']);
     }
     if (isset($values['colorscheme'])) {
         $like_button->setColorScheme($values['colorscheme']);
     }
     if (isset($values['ref'])) {
         $like_button->setReference($values['ref']);
     }
     if (isset($values['kid_directed_site']) && ($values['kid_directed_site'] === true || $values['kid_directed_site'] === 'true' || $values['kid_directed_site'] == 1)) {
         $like_button->isKidDirectedSite();
     }
     return $like_button;
 }