예제 #1
0
 /**
  * @param $args
  * @param $instance
  *
  * @return string
  */
 public function getContent($args, $instance)
 {
     $output = '';
     $title = apply_filters('widget_title', $instance['title']);
     // Get the data from the argument.
     require_once GIGYA__PLUGIN_DIR . 'features/follow/GigyaFollowSet.php';
     $follow = new GigyaFollowSet();
     $data = $follow->getParams();
     if (!empty($data['on'])) {
         // Override params or take the defaults.
         if (!empty($instance['override'])) {
             foreach ($instance as $key => $value) {
                 if (!empty($value)) {
                     if ($key == 'buttons') {
                         $data[$key] = $value;
                     } else {
                         $data[$key] = esc_attr($value);
                     }
                 }
             }
         }
         // Set the output.
         $output .= $args['before_widget'];
         if (!empty($title)) {
             $output .= $args['before_title'] . $title . $args['after_title'];
         }
         $output .= '<div class="gigya-follow-widget"></div>';
         $output .= '<script class="data-follow" type="application/json">' . json_encode($data) . '</script>';
         $output .= $args['after_widget'];
         return $output;
     }
 }
 public function gigyaFollowBarScode($attrs)
 {
     require_once GIGYA__PLUGIN_DIR . 'features/follow/GigyaFollowSet.php';
     $follow = new GigyaFollowSet();
     $defaults = $follow->getParams();
     if (empty($attrs)) {
         $attrs = $defaults;
         if (isset($attrs['advanced'])) {
             $advanced = gigyaCms::jsonToArray($attrs['advanced']);
             if (is_array($advanced)) {
                 $attrs = array_merge($attrs, $advanced);
             } else {
                 if (is_string($advanced)) {
                     _gigya_error_log("Error in " . __FUNCTION__ . " shortcode advanced parameters message: " . $advanced);
                 }
             }
         }
     } else {
         $attrs = array_merge($defaults, $attrs);
     }
     $attrs = $this->attrs_to_gigya($attrs);
     $output = '<div class="gigya-follow-widget"></div>';
     $output .= '<script class="data-follow" type="application/json">' . json_encode($attrs) . '</script>';
     return $output;
 }