Esempio n. 1
0
 /**
  * Facebook Like Button after header
  *
  * @since 1.1
  */
 public static function after_header()
 {
     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('http://developers.facebook.com/wordpress/');
     $like_button->setLayout('button_count');
     $like_button->includeSendButton();
     $like_button->setFont('arial');
     $like_button->setReference('wp-admin');
     echo $like_button->asHTML();
     do_action('facebook_notify_plugin_conflicts');
 }
 /**
  * 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['send']) && ($values['send'] === true || $values['send'] === 'true' || $values['send'] == 1)) {
         $like_button->includeSendButton();
     }
     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']);
     }
     return $like_button;
 }