public function gigyaCommentsScode($attrs)
 {
     require_once GIGYA__PLUGIN_DIR . 'features/comments/GigyaCommentsSet.php';
     $comments = new GigyaCommentsSet();
     $defaults = $comments->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);
     }
     return _gigya_render_tpl('admin/tpl/comments.tpl.php', array('data' => $attrs));
 }
 /**
  * @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/comments/GigyaCommentsSet.php';
     $comments = new GigyaCommentsSet();
     $data = $comments->getParams();
     // Override params or take the defaults.
     if (!empty($instance['override'])) {
         foreach ($instance as $key => $value) {
             if (!empty($value)) {
                 $data[$key] = esc_attr($value);
             }
         }
     }
     $output .= $args['before_widget'];
     if (!empty($title)) {
         $output .= $args['before_title'] . $title . $args['after_title'];
     }
     $output .= _gigya_render_tpl('admin/tpl/comments.tpl.php', array('data' => $data));
     $output .= $args['after_widget'];
     return $output;
 }
Beispiel #3
0
<?php

/**
 * Gigya comments anchor.
 */
if (empty($data)) {
    $comments_options = get_option(GIGYA__SETTINGS_COMMENTS);
    // Get the data from the argument.
    require_once GIGYA__PLUGIN_DIR . 'features/comments/GigyaCommentsSet.php';
    $comments = new GigyaCommentsSet();
    $data = $comments->getParams();
} else {
    if (isset($data['rating'])) {
        $comments_options['rating'] = $data['rating'];
    }
    // Just so we would render the comments plugins
    $comments_options['position'] = "here";
}
if ($comments_options['position'] !== 'none') {
    ?>
	<?php 
    if (!empty($comments_options['rating'])) {
        ?>
		<div class="gigya-rating-widget"></div>
	<?php 
    }
    ?>
	<div class="gigya-comments-widget"></div>
	<script class="data-comments" type="application/json"><?php 
    echo json_encode($data);
    ?>