/**
  * s2Member's PayPal Auto-Return/PDT handler (inner processing routine).
  *
  * @package s2Member\PayPal
  * @since 110720
  *
  * @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
  * @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
  */
 public static function cp($vars = array())
 {
     extract($vars);
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_during_paypal_return_before_no_return_data", get_defined_vars());
     unset($__refs, $__v);
     $paypal["s2member_log"][] = "No Return-Data. Customer MUST wait for Email Confirmation.";
     $paypal["s2member_log"][] = "Note. This can sometimes happen when/if you are offering an Initial/Trial Period. There are times when a Payment Gateway will NOT supply s2Member with any data immediately after checkout. When/if this happens, s2Member must process the transaction via IPN only (i.e. behind-the-scene), and the Customer must wait for Email Confirmation in these cases.";
     $paypal["s2member_log"][] = var_export($_REQUEST, true);
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_during_paypal_return_during_no_return_data", get_defined_vars());
     unset($__refs, $__v);
     if ($custom_success_redirection) {
         $paypal["s2member_log"][] = "Redirecting Customer to a custom URL: " . $custom_success_redirection . ".";
         wp_redirect($custom_success_redirection);
     } else {
         $paypal["s2member_log"][] = "Redirecting Customer to the Home Page (after asking Customer to check their email).";
         echo c_ws_plugin__s2member_return_templates::return_template($paypal["subscr_gateway"], _x('<strong>Thank you! (you MUST check your email before proceeding).</strong><br /><br />* Note: It can take <em>(up to 15 minutes)</em> for Email Confirmation with important details. If you don\'t receive email confirmation in the next 15 minutes, please contact Support.', "s2member-front", "s2member") . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] || c_ws_plugin__s2member_utils_conds::pro_is_installed() && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_" . $paypal["subscr_gateway"] . "_sandbox"]) ? '<br /><br />' . _x('<strong>** Sandbox Mode **</strong> You may NOT receive this Email in Sandbox Mode. Sandbox addresses are usually bogus (for testing).', "s2member-front", "s2member") : ''), _x("Back To Home Page", "s2member-front", "s2member"), home_url("/"));
     }
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_during_paypal_return_after_no_return_data", get_defined_vars());
     unset($__refs, $__v);
     return apply_filters("c_ws_plugin__s2member_paypal_return_in_no_tx_data", $paypal, get_defined_vars());
 }
Пример #2
0
 function respond($result, $status = 'ok')
 {
     global $gb_json_api;
     $json = $this->get_json($result, $status);
     $status_redirect = "redirect_{$status}";
     if ($gb_json_api->query->dev || !empty($_REQUEST['dev'])) {
         // Output the result in a human-redable format
         if (!headers_sent()) {
             header('HTTP/1.1 200 OK');
             header('Content-Type: text/plain; charset: UTF-8', true);
         } else {
             echo '<pre>';
         }
         echo $this->prettify($json);
     } else {
         if (!empty($_REQUEST[$status_redirect])) {
             wp_redirect($_REQUEST[$status_redirect]);
         } else {
             if ($gb_json_api->query->redirect) {
                 $url = $this->add_status_query_var($gb_json_api->query->redirect, $status);
                 wp_redirect($url);
             } else {
                 if ($gb_json_api->query->callback) {
                     // Run a JSONP-style callback with the result
                     $this->callback($gb_json_api->query->callback, $json);
                 } else {
                     // Output the result
                     $this->output($json);
                 }
             }
         }
     }
     exit;
 }
Пример #3
0
/**
 * Processes gateway select on checkout. Only for users without ajax / javascript
 *
 * @since 1.7
 *
 * @param $data
 */
function edd_process_gateway_select($data)
{
    if (isset($_POST['gateway_submit'])) {
        wp_redirect(add_query_arg('payment-mode', $_POST['payment-mode']));
        exit;
    }
}
Пример #4
0
  public function manage() { 

    global $meow_provider, $wf;
    
    $this->setup_view( array(
        "title_args" => array( "text" => __("Site Content", MASTERPRESS_DOMAIN) )
      )
    );

    
    $site = $wf->site();
    
    MasterPress::$view->sets = self::assigned_field_sets();
    
    MPC::incl("meta");
    MPV::incl("meta");
    
    if (MPC::is_postback()) {
      // save the meta - this code should be moved into the controller at some stage
      MPC_Meta::save_site_meta($site->id());
      // redirect back to here
      wp_redirect( MasterPress::admin_url( "site-content", "manage", array("updated" => "true"), false ) );
      exit();
    }
    
  } 
 function so_profile_redirect()
 {
     $result = stripos($_SERVER['REQUEST_URI'], 'profile.php');
     if ($result !== false) {
         wp_redirect(get_option('siteurl') . '/wp-admin/index.php');
     }
 }
Пример #6
0
function optimizer_assign_widgets()
{
    $optimizer = get_option('optimizer');
    $active_widgets = get_option('sidebars_widgets');
    if (isset($_POST['assign_widgets']) && check_admin_referer('optimizer_assign_widgets', 'optimizer_assign_widgets')) {
        if (empty($active_widgets['front_sidebar']) && empty($optimizer)) {
            //ABOUT SECTION--------------------------------------------
            $active_widgets['front_sidebar'][] = 'optimizer_front_about-1';
            $about_content[1] = array('title' => __('THE OPTIMIZER', 'optimizer'), 'subtitle' => __('a little about..', 'optimizer'), 'content' => __('Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without revolutionary ROI.', 'optimizer'), 'divider' => 'fa-stop', 'title_color' => '#222222', 'content_color' => '#a8b4bf', 'content_bg' => '#ffffff');
            update_option('widget_optimizer_front_about', $about_content);
            //BLOCKS SECTION--------------------------------------------
            $active_widgets['front_sidebar'][] = 'optimizer_front_blocks-1';
            $blocks_content[1] = array('block1title' => __('Lorem Ipsum', 'optimizer'), 'block1img' => '', 'block1content' => __('Lorem ipsum dolor sit amet, consectetur dol adipiscing elit. Nam nec rhoncus risus. In ultrices lacinia ipsum, posuere faucibus velit bibe.', 'optimizer'), 'block2title' => __('Lorem Ipsum', 'optimizer'), 'block2img' => '', 'block2content' => __('Lorem ipsum dolor sit amet, consectetur dol adipiscing elit. Nam nec rhoncus risus. In ultrices lacinia ipsum, posuere faucibus velit bibe.', 'optimizer'), 'block3title' => __('Lorem Ipsum', 'optimizer'), 'block3img' => '', 'block3content' => __('Lorem ipsum dolor sit amet, consectetur dol adipiscing elit. Nam nec rhoncus risus. In ultrices lacinia ipsum, posuere faucibus velit bibe.', 'optimizer'), 'block4title' => '', 'block4img' => '', 'block4content' => '', 'block5title' => '', 'block5img' => '', 'block5content' => '', 'block6title' => '', 'block6img' => '', 'block6content' => '', 'blockstitlecolor' => '#555555', 'blockstxtcolor' => '#999999', 'blocksbgcolor' => '#f5f5f5');
            update_option('widget_optimizer_front_blocks', $blocks_content);
            //WELCOME TEXT SECTION--------------------------------------------
            $active_widgets['front_sidebar'][] = 'optimizer_front_text-1';
            $text_content[1] = array('title' => __('This Title wont be shown', 'optimizer'), 'content' => __('Collaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without revolutionary ROI.', 'optimizer'), 'padtopbottom' => '2', 'paddingside' => '2', 'parallax' => '', 'content_color' => '#ffffff;', 'content_bg' => '#333333;', 'content_bgimg' => '');
            update_option('widget_optimizer_front_text', $text_content);
            //POSTS SECTION--------------------------------------------
            $active_widgets['front_sidebar'][] = 'optimizer_front_posts-1';
            $posts_content[1] = array('title' => __('Our Work', 'optimizer'), 'subtitle' => __('Checkout Our Work', 'optimizer'), 'layout' => '1', 'type' => 'post', 'pages' => '', 'count' => '6', 'category' => '', 'divider' => 'fa-stop', 'navigation' => 'numbered', 'postbgcolor' => '', 'titlecolor' => '#333333', 'secbgcolor' => '#ffffff');
            update_option('widget_optimizer_front_posts', $posts_content);
            //Update the empty frontpage sidebar with widgets
            update_option('sidebars_widgets', $active_widgets);
            $redirect = admin_url('/customize.php');
            wp_redirect($redirect);
        }
    }
}
Пример #7
0
 /**
  *
  */
 public function check_access()
 {
     if (is_page(WC_Vendors::$pv_options->get_option('orders_page')) && !is_user_logged_in()) {
         wp_redirect(get_permalink(woocommerce_get_page_id('myaccount')));
         exit;
     }
 }
Пример #8
0
function custom_remove_no_admin_access()
{
    if (!defined('DOING_AJAX') && !current_user_can('manage_options')) {
        wp_redirect(home_url());
        die;
    }
}
Пример #9
0
 /**
  * will redirect old links to new link structures.
  */
 public static function redirection()
 {
     global $wpdb, $wp_query;
     if (is_object($wp_query) && $wp_query->get('em_redirect')) {
         //is this a querystring url?
         if ($wp_query->get('event_slug')) {
             $event = $wpdb->get_row('SELECT event_id, post_id FROM ' . EM_EVENTS_TABLE . " WHERE event_slug='" . $wp_query->get('event_slug') . "' AND (blog_id=" . get_current_blog_id() . " OR blog_id IS NULL OR blog_id=0)", ARRAY_A);
             if (!empty($event)) {
                 $EM_Event = em_get_event($event['event_id']);
                 $url = get_permalink($EM_Event->post_id);
             }
         } elseif ($wp_query->get('location_slug')) {
             $location = $wpdb->get_row('SELECT location_id, post_id FROM ' . EM_LOCATIONS_TABLE . " WHERE location_slug='" . $wp_query->get('location_slug') . "' AND (blog_id=" . get_current_blog_id() . " OR blog_id IS NULL OR blog_id=0)", ARRAY_A);
             if (!empty($location)) {
                 $EM_Location = em_get_location($location['location_id']);
                 $url = get_permalink($EM_Location->post_id);
             }
         } elseif ($wp_query->get('category_slug')) {
             $url = get_term_link($wp_query->get('category_slug'), EM_TAXONOMY_CATEGORY);
         }
         if (!empty($url)) {
             wp_redirect($url, 301);
             exit;
         }
     }
 }
 /**
  * Do the PHP redirect
  */
 public function do_redirects()
 {
     // Check if PHP redirects are enabled.
     if (false == $this->is_php_redirects_enabled()) {
         return;
     }
     // Load redirects.
     $redirects = $this->get_redirects();
     // Do the actual redirect.
     if (!empty($redirects)) {
         // Decode the URL.
         $url = htmlspecialchars_decode(urldecode($_SERVER['REQUEST_URI']));
         foreach ($redirects as $regex => $redirect) {
             // Check if the URL matches the $regex.
             if (1 === @preg_match("`{$regex}`", $url, $this->url_matches)) {
                 // Replace the $regex vars with URL matches.
                 $redirect_url = preg_replace_callback('/[\\$0-9]+/', array($this, 'format_redirect_url'), $redirect['url']);
                 if ('/' === substr($redirect_url, 0, 1)) {
                     $redirect_url = home_url($redirect_url);
                 }
                 // Do the redirect.
                 wp_redirect($redirect_url, $redirect['type']);
                 exit;
             }
             // Reset url_matches.
             $this->url_matches = array();
         }
     }
 }
Пример #11
0
 /**
  * Authenticate login
  *
  * @param string $username
  * @param string $password
  * @param bool $remember_login
  * @param string $login_form_id
  * @param string $redirect
  *
  * @return string/void
  */
 static function login_auth($username, $password, $remember_login = true, $login_form_id = '', $redirect)
 {
     do_action('pp_before_login_validation', $username, $password, $login_form_id);
     /* start filter Hook */
     $login_errors = new WP_Error();
     // call validate reg from function
     $login_form_errors = apply_filters('pp_login_validation', $login_errors, $login_form_id);
     if (is_wp_error($login_form_errors) && $login_form_errors->get_error_code() != '') {
         return $login_form_errors;
     }
     /* End Filter Hook */
     $creds = array();
     $creds['user_login'] = $username;
     $creds['user_password'] = $password;
     if ($remember_login == 'true') {
         $creds['remember'] = true;
     }
     $user = wp_signon($creds);
     if (is_wp_error($user) && $user->get_error_code()) {
         return $user;
     } elseif (!is_wp_error($user)) {
         do_action('pp_before_login_redirect', $username, $password, $login_form_id);
         $login_redirect = !empty($redirect) ? $redirect : pp_login_redirect();
         /** Setup a custom location of the builder */
         $login_redirection = apply_filters('pp_login_redirect', $login_redirect, $login_form_id);
         wp_redirect($login_redirection);
         exit;
     }
 }
Пример #12
0
/**
 * Get uploads from the production site and store them
 * in the local filesystem if they don't already exist.
 *
 * @return  void
 */
function uploads_proxy()
{
    global $wp_filesystem;
    WP_Filesystem();
    // The relative request path
    $requestPath = $_SERVER['REQUEST_URI'];
    // The relative uploads path
    $uploadsPath = str_replace(get_bloginfo('url'), '', wp_upload_dir()['baseurl']);
    // Check if a upload was requested
    if (strpos($requestPath, $uploadsPath) === 0) {
        // The absolute remote path to the upload
        $remotePath = UP_SITEURL . $requestPath;
        // Get the remote upload file
        $response = wp_remote_get($remotePath);
        // Check the response code
        if ($response['response']['code'] === 200) {
            // The file path relative to the uploads path to store the upload file to
            $relativeUploadFile = str_replace($uploadsPath, '', $_SERVER['REQUEST_URI']);
            // The absolute file path to store the upload file to
            $absoluteUploadFile = wp_upload_dir()['basedir'] . $relativeUploadFile;
            // Make sure the upload directory exists
            wp_mkdir_p(pathinfo($absoluteUploadFile)['dirname']);
            if ($wp_filesystem->put_contents(urldecode($absoluteUploadFile), $response['body'], FS_CHMOD_FILE)) {
                // Redirect to the stored upload
                wp_redirect($requestPath);
            }
        }
    }
}
 function _instagram_auth()
 {
     $id = $_REQUEST['gallery'];
     session_start();
     $source = $_SESSION['asg_instagram_client_data'];
     $auth_params = array('body' => array('client_id' => $source['client_id'], 'client_secret' => $source['client_secret'], 'grant_type' => 'authorization_code', 'redirect_uri' => $this->get_redirect_url($id), 'code' => $_REQUEST['code']));
     $response = asg_remote_post('https://api.instagram.com/oauth/access_token', $auth_params);
     if (is_wp_error($response)) {
         wp_redirect(admin_url('admin.php?page=asg-instagram-auth-failure&message=' . urlencode($response->get_error_message())));
         exit;
     }
     if ($response['body']) {
         $body = json_decode($response['body']);
         if ($body->access_token) {
             wp_redirect(admin_url('admin.php?page=asg-instagram-auth-success&insta_token=' . $body->access_token));
             exit;
         }
     }
     if ($response['response']) {
         wp_redirect(admin_url('admin.php?page=asg-instagram-auth-failure&message=' . $response['response']['message']));
         exit;
     }
     wp_redirect(admin_url('admin.php?page=asg-instagram-auth-failure&message=' . urlencode('Unknown error')));
     exit;
 }
 function redirect_to_settings()
 {
     //First preserve all errors that have been generated
     set_transient('settings_errors', get_settings_errors(), 30);
     //Call settings url
     wp_redirect($this->get_redirect_url() . '&settings-updated=true');
 }
Пример #15
0
 /**
  * Install actions such as installing pages when a button is clicked.
  */
 public function install_actions()
 {
     // Install - Add pages button
     if (!empty($_GET['install_woocommerce_pages'])) {
         self::create_pages();
         // We no longer need to install pages
         delete_option('_wc_needs_pages');
         delete_transient('_wc_activation_redirect');
         // What's new redirect
         wp_redirect(admin_url('index.php?page=wc-about&wc-installed=true'));
         exit;
         // Skip button
     } elseif (!empty($_GET['skip_install_woocommerce_pages'])) {
         // We no longer need to install pages
         delete_option('_wc_needs_pages');
         delete_transient('_wc_activation_redirect');
         // What's new redirect
         wp_redirect(admin_url('index.php?page=wc-about'));
         exit;
         // Update button
     } elseif (!empty($_GET['do_update_woocommerce'])) {
         $this->update();
         // Update complete
         delete_option('_wc_needs_pages');
         delete_option('_wc_needs_update');
         delete_transient('_wc_activation_redirect');
         // What's new redirect
         wp_redirect(admin_url('index.php?page=wc-about&wc-updated=true'));
         exit;
     }
 }
Пример #16
0
 function check_page()
 {
     if (get_option('zn_theme_needs_update') && (!isset($_GET['page']) || isset($_GET['page']) && $_GET['page'] != 'zn-update') && !ZN()->is_request('ajax')) {
         wp_redirect(admin_url('index.php?page=zn-update'));
         exit;
     }
 }
Пример #17
0
 public function pipes_plugin_redirect()
 {
     if (get_option('pipes_plugin_do_activation_redirect', false)) {
         delete_option('pipes_plugin_do_activation_redirect');
         wp_redirect("admin.php?page=pipes.pipes");
     }
 }
 /**
  * Activated the given EDD license.
  *
  * @return	void
  * @since	1.7.1
  */
 public function activateLicense($option)
 {
     if ($this->settings['id'] != $option->settings['id']) {
         return;
     }
     /* Get the license */
     $license = esc_attr($this->getValue());
     /* License ID */
     $key = substr(md5($license), 0, 10);
     /* If the license is set we can handle activation. */
     if (strlen($license) > 0) {
         /* First of all we check if the user requested a manual activation */
         if (isset($_GET['eddactivate']) && '1' == $_GET['eddactivate']) {
             global $pagenow;
             if (isset($_GET)) {
                 $get = (array) $_GET;
             }
             if (isset($get['eddactivate'])) {
                 unset($get['eddactivate']);
             }
             $this->check($license, 'activate_license');
             /* Redirect to the settings page without the eddactivate parameter (otherwise it's used in all tabs links) */
             wp_redirect(wp_sanitize_redirect(add_query_arg($get, admin_url($pagenow))));
         }
         /* First activation of the license. */
         if (false == get_transient("tf_edd_license_try_{$key}")) {
             $this->check($license, 'activate_license');
         }
     }
 }
Пример #19
0
 protected function prepare()
 {
     include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
     try {
         $this->api = $api = Sputnik::get_plugin($this->id);
     } catch (Exception $e) {
         status_header(500);
         $this->header();
         echo '<p>' . $e->getMessage() . '</p>';
         $this->footer();
         return;
     }
     if (!Sputnik::is_purchased($this->api->slug)) {
         wp_redirect(Sputnik_Admin::build_url(array('buy' => $this->id)));
         die;
     }
     if (!current_user_can('install_plugins')) {
         wp_die(__('You do not have sufficient permissions to install plugins for this site.', 'sputnik'));
     }
     check_admin_referer($this->nonce_prefix . $this->api->slug);
     include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
     $title = sprintf($this->title_format, $this->api->name . ' ' . $this->api->version);
     $nonce = $this->nonce_prefix . $this->id;
     $url = 'update.php?action=install-plugin&plugin=' . $this->id;
     if (isset($_GET['from'])) {
         $url .= '&from=' . urlencode(stripslashes($_GET['from']));
     }
     $type = 'web';
     //Install plugin type, From Web or an Upload.
     if ($this->api->is_theme) {
         $this->upgrader = new Sputnik_ThemeUpgrader(new Sputnik_View_Install_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
     } else {
         $this->upgrader = new Sputnik_Upgrader(new Sputnik_View_Install_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
     }
 }
Пример #20
0
function wplms_dashboard_template()
{
    if (!is_user_logged_in()) {
        wp_redirect(site_url());
    }
    $template = 'templates/dashboard';
    global $bp;
    if ($bp->current_component == 'dashboard') {
        wp_enqueue_style('wplms-dashboard-css', WPLMS_DASHBOARD_URL . '/css/wplms-dashboard.css', array(), '1.0');
        wp_enqueue_script('wplms-dashboard-js', WPLMS_DASHBOARD_URL . '/js/wplms-dashboard.js', array('jquery', 'jquery-ui-sortable'), '1.0');
        if (is_active_widget(false, false, 'wplms_instructor_dash_stats', true) || is_active_widget(false, false, 'wplms_dash_stats', true)) {
            wp_enqueue_script('wplms-sparkline', WPLMS_DASHBOARD_URL . '/js/jquery.sparkline.min.js', array('jquery'), true);
        }
        if (is_active_widget(false, false, 'wplms_instructor_stats', true) || is_active_widget(false, false, 'wplms_instructor_commission_stats', true) || is_active_widget(false, false, 'wplms_student_stats', true)) {
            wp_enqueue_script('wplms-raphael', WPLMS_DASHBOARD_URL . '/js/raphael-min.js', array('jquery'), true);
            wp_enqueue_script('wplms-morris', WPLMS_DASHBOARD_URL . '/js/morris.min.js', array('jquery'), true);
        }
        $translation_array = array('earnings' => __('Earnings', 'wplms-dashboard'), 'payout' => __('Payout', 'wplms-dashboard'), 'students' => __('# Students', 'wplms-dashboard'), 'saved' => __('SAVED', 'wplms-dashboard'), 'saving' => __('SAVING ...', 'wplms-dashboard'), 'stats_calculated' => __('Stats Calculated, reloading page ...', 'wplms-dashboard'));
        wp_localize_script('wplms-dashboard-js', 'wplms_dashboard_strings', $translation_array);
    }
    $located_template = apply_filters('bp_located_template', locate_template($template, false), $template);
    if ($located_template && $located_template != '') {
        bp_get_template_part(apply_filters('bp_load_template', $located_template));
    } else {
        bp_core_load_template(apply_filters('bp_core_template_plugin', 'members/single/dashboard'));
    }
}
 public function import()
 {
     // It might not look like it, but it is actually compatible to
     // uncompressed files.
     $gzFileHandler = gzopen($this->file, 'r');
     Model\DownloadIntent::delete_all();
     Model\DownloadIntentClean::delete_all();
     $batchSize = 1000;
     $batch = array();
     while (!gzeof($gzFileHandler)) {
         $line = gzgets($gzFileHandler);
         list($id, $user_agent_id, $media_file_id, $request_id, $accessed_at, $source, $context, $geo_area_id, $lat, $lng) = explode(",", $line);
         $batch[] = array($user_agent_id, $media_file_id, $request_id, $accessed_at, $source, $context, $geo_area_id, $lat, $lng);
         if (count($batch) >= $batchSize) {
             self::save_batch_to_db($batch);
             $batch = [];
         }
     }
     gzclose($gzFileHandler);
     // save last batch to db
     self::save_batch_to_db($batch);
     \Podlove\Analytics\DownloadIntentCleanup::cleanup_download_intents();
     \Podlove\Cache\TemplateCache::get_instance()->setup_purge();
     wp_redirect(admin_url('admin.php?page=podlove_imexport_migration_handle&status=success'));
     exit;
 }
/**
 * Handle redirects before content is output - hooked into template_redirect so is_page works.
 *
 * @return void
 */
function wc_template_redirect()
{
    global $wp_query, $wp;
    // When default permalinks are enabled, redirect shop page to post type archive url
    if (!empty($_GET['page_id']) && get_option('permalink_structure') == "" && $_GET['page_id'] == wc_get_page_id('shop')) {
        wp_safe_redirect(get_post_type_archive_link('product'));
        exit;
    } elseif (is_page(wc_get_page_id('checkout')) && sizeof(WC()->cart->get_cart()) == 0 && empty($wp->query_vars['order-pay']) && !isset($wp->query_vars['order-received'])) {
        wp_redirect(get_permalink(wc_get_page_id('cart')));
        exit;
    } elseif (isset($wp->query_vars['customer-logout'])) {
        wp_redirect(str_replace('&amp;', '&', wp_logout_url(get_permalink(wc_get_page_id('myaccount')))));
        exit;
    } elseif (is_search() && is_post_type_archive('product') && apply_filters('woocommerce_redirect_single_search_result', true) && $wp_query->found_posts == 1) {
        $product = wc_get_product($wp_query->post);
        if ($product->is_visible()) {
            wp_safe_redirect(get_permalink($product->id), 302);
            exit;
        }
    } elseif (is_add_payment_method_page()) {
        WC()->payment_gateways();
    } elseif (is_checkout()) {
        // Buffer the checkout page
        ob_start();
        // Ensure gateways and shipping methods are loaded early
        WC()->payment_gateways();
        WC()->shipping();
    }
}
Пример #23
0
function ultimatemember_activation_hook($plugin)
{
    if ($plugin == um_plugin && get_option('um_version') != ultimatemember_version) {
        update_option('um_version', ultimatemember_version);
        exit(wp_redirect(admin_url('admin.php?page=ultimatemember-about')));
    }
}
Пример #24
0
function soloUsuarioRegistrado()
{
    if (!is_user_logged_in()) {
        wp_redirect(home_url(), 302);
        exit;
    }
}
Пример #25
0
function roots_nice_search_redirect()
{
    if (is_search() && strpos($_SERVER['REQUEST_URI'], '/wp-admin/') === false && strpos($_SERVER['REQUEST_URI'], '/search/') === false) {
        wp_redirect(home_url('/search/' . str_replace(array(' ', '%20'), array('+', '+'), get_query_var('s'))));
        exit;
    }
}
Пример #26
0
 function process_submission()
 {
     if (!current_user_can('pp_manage_settings')) {
         wp_die(__ppw('Cheatin&#8217; uh?'));
     }
     if (!empty($_REQUEST['pp_refresh_updates'])) {
         delete_site_transient('update_plugins');
         pp_get_version_info(true, false, true);
         wp_update_plugins();
         wp_redirect(admin_url('admin.php?page=pp-settings&pp_refresh_done=1'));
         exit;
     }
     if (!empty($_REQUEST['pp_renewal'])) {
         $opt_val = get_option('pp_support_key');
         $renewal_token = !is_array($opt_val) || count($opt_val) < 2 ? '' : substr($opt_val[1], 0, 16);
         $url = site_url('');
         $arr_url = parse_url($url);
         $site = urlencode(str_replace($arr_url['scheme'] . '://', '', $url));
         wp_redirect('http://presspermit.com/renewal/?pkg=press-permit-pro&site=' . $site . '&rt=' . $renewal_token);
         exit;
     }
     if (!empty($_REQUEST['pp_upload_config']) || !empty($_REQUEST['pp_support_forum'])) {
         require_once dirname(__FILE__) . '/admin/support_pp.php';
         $args = array();
         if (isset($_REQUEST['post_id'])) {
             $args['post_id'] = (int) $_REQUEST['post_id'];
         }
         if (isset($_REQUEST['term_taxonomy_id'])) {
             $args['term_taxonomy_id'] = (int) $_REQUEST['term_taxonomy_id'];
         }
         if (!empty($_REQUEST['pp_support_forum'])) {
             //$forum = ( ! empty( $_REQUEST['pp_forum'] ) ) ? sanitize_url($_REQUEST['pp_forum']) : 'pp2-technical-issues';
             $url = "http://presspermit.com/forums/";
             if (!empty($_REQUEST['pp_topic'])) {
                 $url = add_query_arg('pp_topic', $_REQUEST['pp_topic'], $url);
             }
             wp_redirect($url);
         }
         $success = _pp_support_upload($args);
         if (empty($_REQUEST['pp_support_forum'])) {
             if (-1 === $success) {
                 $flag = 'pp_config_no_change';
             } elseif ($success) {
                 $flag = 'pp_config_uploaded';
             } else {
                 $flag = 'pp_config_failed';
             }
             wp_redirect(admin_url("admin.php?page=pp-settings&{$flag}=1"));
         }
         exit;
     }
     if (isset($_POST['pp_submit'])) {
         $this->handle_submission('update');
     } elseif (isset($_POST['pp_defaults'])) {
         $this->handle_submission('default');
     } elseif (isset($_POST['pp_role_usage_defaults'])) {
         delete_option('pp_role_usage');
         pp_refresh_options();
     }
 }
Пример #27
0
	function force_ssl() {
		if ( $_SERVER["HTTPS"] != "on" ) {
			$newurl = "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
			wp_redirect( $newurl );
			exit();
		}
	}
function comber_login_guest()
{
    if (isset($_POST['comber_user_login']) && wp_verify_nonce($_POST['comber_login_nonce'], 'comber-login-nonce')) {
        // this returns the user ID and other info from the user name
        $user = get_userdatabylogin($_POST['comber_user_login']);
        if (!$user) {
            // if the user name doesn't exist
            comber_errors()->add('empty_username', __('Invalid username'));
        }
        if (!isset($_POST['comber_user_pass']) || $_POST['comber_user_pass'] == '') {
            // if no password was entered
            comber_errors()->add('empty_password', __('Please enter a password'));
        }
        // check the user's login with their password
        if (!wp_check_password($_POST['comber_user_pass'], $user->user_pass, $user->ID)) {
            // if the password is incorrect for the specified user
            comber_errors()->add('empty_password', __('Incorrect password'));
        }
        // retrieve all error messages
        $errors = comber_errors()->get_error_messages();
        // only log the user in if there are no errors
        if (empty($errors)) {
            wp_setcookie($_POST['comber_user_login'], $_POST['comber_user_pass'], true);
            wp_set_current_user($user->ID, $_POST['comber_user_login']);
            do_action('wp_login', $_POST['comber_user_login']);
            wp_redirect(home_url($_POST['current_page']));
            exit;
        } else {
            wp_redirect(home_url($_POST['current_page'] . '/?login=true&fail=true'));
            exit;
        }
    }
}
Пример #29
0
function redirect_to_registration()
{
    if (isset($_GET['action']) && $_GET['action'] == 'validatepage1') {
        wp_redirect(site_url('/registration-complete/'));
        exit;
    }
}
Пример #30
-1
function sfc_register_redirect($fb)
{
    if (SFC_REGISTER_TRANSPARENT) {
        $fbuid = $fb->get_loggedin_user();
        // this is a facebook user, get the info
        if ($fbuid) {
            $user_details = $fb->api_client->users_getInfo($fbuid, 'name, proxied_email');
            if (is_array($user_details)) {
                $fbname = $user_details[0]['name'];
            }
            $query = "SELECT email FROM user WHERE uid=\"{$fbuid}\"";
            $fbemail = $fb->api_client->fql_query($query);
            if (is_array($fbemail)) {
                $fbemail = $fbemail[0]['email'];
            }
        }
        // force create the user instantly
        require_once ABSPATH . WPINC . '/registration.php';
        $errors = register_new_user($fbname, $fbemail);
        if (!is_wp_error($errors)) {
            wp_redirect('wp-login.php?checkemail=registered');
            exit;
        }
    }
    wp_redirect('wp-login.php?action=register');
    exit;
}