示例#1
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));
}
示例#2
0
            $html .= ym_upgrade_buttons(true, $pack_id, $user_id);
            $html .= $footer;
        } else {
            if (ym_request('username')) {
                $errors = false;
                $html = $header;
                if ($page > 1) {
                    $wp_error = new WP_Error();
                    ym_register_post(ym_request('username'), '', $wp_error, $page);
                    //error checking
                    if ($wp_error->get_error_code()) {
                        $errors = true;
                        $additional_page_needed = $page + 1;
                        $html .= ym_get_additional_registration_form_page($additional_page_needed, $page);
                    }
                }
                if (!$errors) {
                    $html .= ym_available_modules(ym_request('username'), true);
                }
                $html .= $footer;
            } else {
                if ($user_status == YM_STATUS_PENDING) {
                    $html = $header . '<p>' . __('Error - Your subscription status is pending. Please contact an administrator for more information.', 'ym') . '</p>' . $footer;
                } else {
                    $html = $header . '<p>' . __('You are already subscribed or an error occurred. Please contact an administrator for more information.', 'ym') . '</p>' . $footer;
                }
            }
        }
    }
}
echo $html;