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;
 }
 /**
  * Render the Gigya admin pages wrapper (Tabs, Form, etc.).
  */
 public static function adminPage()
 {
     $page = $_GET['page'];
     $render = '';
     echo _gigya_render_tpl('admin/tpl/adminPage-wrapper.tpl.php', array('page' => $page));
     settings_errors();
     echo '<form class="gigya-settings" action="options.php" method="post">';
     echo '<input type="hidden" name="action" value="gigya_settings_submit">';
     wp_nonce_field('update-options');
     settings_fields($page . '-group');
     do_settings_sections($page);
     submit_button();
     echo '</form>';
     return $render;
 }
示例#4
0
/**
 * Render a form.
 *
 * @param        $form
 *
 * @param string $name_prefix
 *
 * @return string
 */
function _gigya_form_render($form, $name_prefix = '')
{
    $render = '';
    foreach ($form as $id => $el) {
        if (empty($el['type']) || $el['type'] == 'markup') {
            $render .= $el['markup'];
        } else {
            if (empty($el['name'])) {
                if (!empty($name_prefix)) {
                    // In cases like on admin multipage the element
                    // name is build from the section and the ID.
                    // This tells WP under which option to save this field value.
                    $el['name'] = $name_prefix . '[' . $id . ']';
                } else {
                    // Usually the element name is just the ID.
                    $el['name'] = $id;
                }
            }
            // Add the ID value to the array.
            $el['id'] = $id;
            // Render each element.
            $render .= _gigya_render_tpl('admin/tpl/formEl-' . $el['type'] . '.tpl.php', $el);
        }
    }
    return $render;
}