Beispiel #1
0
 /**
  * This function will be used to insert content where shortcode is used.
  * Shortcode [LoginRadius_Share]
  * 
  * @global type $post
  * @global type $loginradius_share_settings
  * @param type $params
  * @return type
  */
 public static function sharing_shortcode($params)
 {
     global $post, $loginradius_share_settings;
     if (is_object($post)) {
         $lrMeta = get_post_meta($post->ID, '_login_radius_meta', true);
         // if sharing disabled on this page/post, return content unaltered.
         if (isset($lrMeta['sharing']) && $lrMeta['sharing'] == 1 && !is_front_page()) {
             return;
         }
     }
     // Default parameters for shortcode.
     $default = array('style' => '', 'type' => 'horizontal');
     // Extracting parameters.
     extract(shortcode_atts($default, $params));
     if ($style != '') {
         $style = 'style="' . $style . '"';
     }
     if ($type == 'vertical' && $loginradius_share_settings['vertical_enable'] == '1') {
         LR_Common_Sharing::vertical_sharing();
         $unique_id = uniqid();
         LR_Vertical_Sharing::$position['class'][] = $unique_id;
         $share = LR_Vertical_Sharing::get_vertical_sharing('lr_ver_share_shortcode ' . $unique_id, $style);
     }
     if ($type == 'horizontal' && $loginradius_share_settings['horizontal_enable'] == '1') {
         LR_Common_Sharing::horizontal_sharing();
         $share = '<div class="lr_horizontal_share" ' . $style . ' data-share-url="' . get_permalink($post->ID) . '" data-counter-url="' . get_permalink($post->ID) . '"></div>';
     }
     return isset($share) ? $share : '';
 }
 /**
  * Outputs the content of the widget
  *
  * @param array $args
  * @param array $instance
  */
 function widget($args, $instance)
 {
     global $post;
     if (is_object($post)) {
         $lrMeta = get_post_meta($post->ID, '_login_radius_meta', true);
         // If sharing disabled on this page/post, return content unaltered.
         if (isset($lrMeta['sharing']) && $lrMeta['sharing'] == 1 && !is_front_page()) {
             return;
         }
     }
     extract($args);
     if ($instance['hide_for_logged_in'] == 1 && is_user_logged_in()) {
         return;
     }
     $unique_id = uniqid();
     LR_Vertical_Sharing::$position['class'][] = $unique_id;
     LR_Common_Sharing::vertical_sharing();
     echo LR_Vertical_Sharing::get_vertical_sharing('lr_ver_share_widget ' . $unique_id, '');
 }
 /**
  * Output Sharing for the content.
  * 
  * @global type $post
  * @param type $content
  * @return type
  */
 function vertical_page_content($content)
 {
     global $post;
     if (is_object($post)) {
         $lrMeta = get_post_meta($post->ID, '_login_radius_meta', true);
         // if sharing disabled on this page/post, return content unaltered.
         if (isset($lrMeta['sharing']) && $lrMeta['sharing'] == 1 && !is_front_page()) {
             return $content;
         }
     }
     LR_Common_Sharing::vertical_sharing();
     $position = self::get_vertical_position();
     if ($position['top_left']) {
         $class = uniqid('lr_');
         self::$params['top_left']['class'] = $class;
         $content .= self::get_vertical_sharing($class);
     }
     if ($position['top_right']) {
         $class = uniqid('lr_');
         self::$params['top_right']['class'] = $class;
         $content .= self::get_vertical_sharing($class);
     }
     if ($position['bottom_left']) {
         $class = uniqid('lr_');
         self::$params['bottom_left']['class'] = $class;
         $content .= self::get_vertical_sharing($class);
     }
     if ($position['bottom_right']) {
         $class = uniqid('lr_');
         self::$params['bottom_right']['class'] = $class;
         $content .= self::get_vertical_sharing($class);
     }
     echo $content;
 }