Ejemplo n.º 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/reactions/GigyaReactionsSet.php';
     $reactions = new GigyaReactionsSet();
     $data = $reactions->getParams();
     // Override params or take the defaults.
     if (!empty($instance['override'])) {
         foreach ($instance as $key => $value) {
             if (!empty($value)) {
                 $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-reactions-widget"></div>';
     $output .= '<script class="data-reactions" type="application/json">' . json_encode($data) . '</script>';
     $output .= $args['after_widget'];
     return $output;
 }
 public function gigyaReactionsScode($attrs)
 {
     require_once GIGYA__PLUGIN_DIR . 'features/reactions/GigyaReactionsSet.php';
     $recations = new GigyaReactionsSet();
     $defaults = $recations->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 = $this->attrs_to_gigya($attrs);
         $attrs = array_merge($defaults, $attrs);
     }
     $output = '<div class="gigya-reactions-widget"></div>';
     $output .= '<script class="data-reactions" type="application/json">' . json_encode($attrs) . '</script>';
     return $output;
 }
Ejemplo n.º 3
0
 /**
  * Hook content alter.
  */
 public function theContent($content)
 {
     // Share plugin.
     $share_options = get_option(GIGYA__SETTINGS_SHARE);
     $share_on = _gigParamDefaultOn($share_options, 'on');
     if (!empty($share_on)) {
         require_once GIGYA__PLUGIN_DIR . 'features/share/GigyaShareSet.php';
         $share = new GigyaShareSet();
         $content = $share->setDefaultPosition($content);
     }
     // Reactions plugin.
     $reactions_options = get_option(GIGYA__SETTINGS_REACTIONS);
     $reactions_on = _gigParamDefaultOn($reactions_options, 'on');
     if (!empty($reactions_on)) {
         require_once GIGYA__PLUGIN_DIR . 'features/reactions/GigyaReactionsSet.php';
         $reactions = new GigyaReactionsSet();
         $content = $reactions->setDefaultPosition($content);
     }
     return $content;
 }