function widget($args, $instance)
 {
     get_currentuserinfo();
     global $current_user;
     extract($args);
     $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
     $text = trim(apply_filters('widget_text', $instance['text'], $instance));
     $pack_id = $instance['pack_id'];
     $hide_pack_string = $instance['hide_pack_string'];
     if ($current_user->ID) {
         echo $before_widget;
         if (!empty($title)) {
             echo $before_title . $title . $after_title;
         }
         if ($text) {
             echo '<div class="ym_upgrade_widget_intro">' . $text . '</div>';
         }
         echo '<div class="ym_upgrade_widget">';
         ym_upgrade_links('sidebar', $pack_id, $hide_pack_string);
         echo '</div>';
         echo $after_widget;
     }
 }
Ejemplo n.º 2
0
function ym_shortcode_parse($args, $content, $tag)
{
    global $ym_sys;
    get_currentuserinfo();
    global $current_user;
    $arg_zero = isset($args[0]) ? $args[0] : false;
    if ($tag == 'private') {
        if (!$ym_sys->protect_mode || ym_post_is_purchasable()) {
            $return = ym_replace_tag($tag, $content, $args);
        } else {
            //just removes the private tags as the query joins hide the posts
            $return = $content;
            $return = '';
        }
    } else {
        if ($tag == 'ym_login') {
            $return = ym_replace_tag($tag, $content, $args);
        } else {
            if ($tag == 'ym_register') {
                $return = ym_replace_tag($tag, $content, $args);
            } else {
                if ($tag == 'private_or') {
                    $account = str_replace('#', '', $arg_zero);
                    $return = ym_replace_tag($tag, $content, $account);
                } else {
                    if ($tag == 'private_and') {
                        $account = str_replace('#', '', $arg_zero);
                        $return = ym_replace_tag($tag, $content, $account);
                    } else {
                        if ($tag == 'ym_packs') {
                            $return = ym_upgrade_links('page', $args['id'], $args['hide_pack_string'], true);
                        } else {
                            if ($tag == 'ym_upgrade') {
                                if (is_user_logged_in()) {
                                    $args['id'] = isset($args['id']) ? $args['id'] : '';
                                    if ($args['id'] == 'get') {
                                        $args['id'] = ym_request('id', FALSE);
                                    }
                                    if ($args['id']) {
                                        $return = ym_upgrade_buttons(true, $args['id']);
                                    } else {
                                        $return = ym_available_modules($current_user->user_login, true, 1);
                                        //pass a 1 for coupon type 1 upgrade
                                    }
                                } else {
                                    $return = '';
                                }
                            } else {
                                if ($tag == 'ym_drip_date') {
                                    $return = ym_drip_date($tag, $content, $args);
                                } else {
                                    $args = str_replace('#', '', $arg_zero);
                                    $return = ym_replace_tag($tag, $content, $args);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return do_shortcode(stripslashes($return));
}