Пример #1
0
 function initalize_theme()
 {
     $pages = array(OP_SN, OP_SN . '-setup-wizard');
     $reinit_theme = $reinit_page_theme = false;
     $disable_theme = false;
     if (isset($_GET['page'])) {
         if ($_GET['page'] == OP_SN || $_GET['page'] == OP_SN . '-setup-wizard') {
             $cur = op_get_option('theme', 'dir');
             if (isset($_GET['theme_switch']) && $_GET['theme_switch'] != $cur && ($conf = op_load_theme_config($_GET['theme_switch'])) !== false) {
                 $theme = array('name' => $conf['name'], 'screenshot' => $conf['screenshot'], 'screenshot_thumbnail' => $conf['screenshot_thumbnail'], 'description' => $conf['description'], 'dir' => $_GET['theme_switch']);
                 op_update_option('theme', $theme);
                 $reinit_theme = true;
             }
         } elseif ($_GET['page'] == OP_SN . '-page-builder') {
             $disable_theme = true;
         }
     } elseif (defined('DOING_AJAX')) {
         $action = '';
         if (!($action = op_get('action'))) {
             $action = op_post('action');
         }
         $chk = OP_SN . '-live-editor';
         if (is_string($action) && substr($action, 0, strlen($chk)) == $chk) {
             $disable_theme = true;
         }
     }
     if ($disable_theme === false) {
         op_init_theme();
         define('OP_REINIT_THEME', $reinit_theme);
         if ($reinit_theme) {
             define('OP_SHOW_THEME_MSG', $cur !== false);
             do_action(OP_SN . '-reinit_theme');
         }
     }
 }
Пример #2
0
function op_check_exit_redirect()
{
    $chk = op_get('op_exit_redirect');
    if ($chk && $chk == 'true') {
        $url = op_current_url();
        $url = str_replace('op_exit_redirect=true', '', $url);
        $url = rtrim($url, '?');
        echo '
			<script type="text/javascript">
			top.location.href = \'' . $url . '\';
			</script>
		';
    }
}
Пример #3
0
 /**
  * Authorizes user on GoToWebinar using OAuth
  *
  * User will be redirected to GoToWebinar website for authorization
  *
  * @return void
  */
 public function authorize()
 {
     /*
      * If 'callback' is defined we are returned from GoToWebinar with auth details
      */
     if (false === op_get('disconnect')) {
         op_update_option(self::OPTION_NAME_ENABLED, true);
         header("HTTP/1.1 200 OK");
         header('Location: ' . admin_url() . 'admin.php?page=optimizepress#email_marketing_services--oneshoppingcart');
         exit;
     } else {
         if ('1' == op_get('disconnect')) {
             op_delete_option(self::OPTION_NAME_ENABLED);
             header("HTTP/1.1 200 OK");
             header('Location: ' . admin_url() . 'admin.php?page=optimizepress#email_marketing_services--oneshoppingcart');
             exit;
         }
     }
 }
Пример #4
0
 function video_ads_get_all_option()
 {
     $ads_options = array();
     //config ads and brand
     $enable_ads = op_get('ads_config', 'enable-ads');
     if ($enable_ads != '' && $enable_ads == 'yes') {
         $show_close_button = op_get('ads_config', 'show-close-button');
         $close_button_position = op_get('ads_config', 'close-button-position');
         $auto_turn_on_advs = op_get('ads_config', 'auto-turn-on-advs');
     } else {
         $show_close_button = '';
         $close_button_position = '';
         $auto_turn_on_advs = '';
     }
     $enable_brand = op_get('ads_config', 'enable-brand');
     if ($enable_brand != '' && $enable_brand == 'yes') {
         $brand_logo = op_get('ads_config', 'ads-logo');
         $brand_text = op_get('ads_config', 'ads-text');
         $brand_position = op_get('ads_config', 'ads-position');
         $brand_opacity = op_get('ads_config', 'ads-opacity');
         $brand_color = op_get('ads_config', 'ads-text-color');
     } else {
         $brand_logo = '';
         $brand_text = '';
         $brand_position = '';
         $brand_opacity = '';
         $brand_color = '';
     }
     $ads_options['enable_ads'] = $enable_ads;
     $ads_options['show_close_button'] = $show_close_button;
     $ads_options['close_button_position'] = $close_button_position;
     $ads_options['auto_turn_on_advs'] = $auto_turn_on_advs;
     $ads_options['enable_brand'] = $enable_brand;
     $ads_options['brand_logo'] = $brand_logo;
     $ads_options['brand_text'] = $brand_text;
     $ads_options['brand_position'] = $brand_position;
     $ads_options['brand_opacity'] = $brand_opacity;
     $ads_options['brand_color'] = $brand_color;
     return $ads_options;
 }
Пример #5
0
 /**
  * Checks GET vars for 'op_' prefixed parameters to fill the value or call 'op_optin_field_value' filter
  * @author Luka Peharda <*****@*****.**>
  * @param  string $name
  * @return string
  */
 function getOptinUrlValue($name)
 {
     $value = op_get('op_' . strtolower($name));
     if (false !== $value) {
         $value = op_attr($value);
     } else {
         if ('FNAME' == $name) {
             $value = getOptinUrlValue('name');
         } else {
             $value = apply_filters('op_optin_field_value', $value, $name);
         }
     }
     return $value;
 }
Пример #6
0
 /**
  * Authorizes user on GoToWebinar using OAuth
  *
  * User will be redirected to GoToWebinar website for authorization
  *
  * @return void
  */
 public function authorize()
 {
     /*
      * If 'callback' is defined we are returned from GoToWebinar with auth details
      */
     if (false === op_get('authorize') && false === op_get('disconnect') && false === op_get('clean')) {
         /*
          * Defining callback URL where GoToWebinar will return with auth information
          */
         $callbackUrl = admin_url('admin.php?action=' . OP_GOTOWEBINAR_AUTH_URL);
         $response = $this->getClient()->getOAuthToken($this->apiKey, $callbackUrl);
         if (is_string($response)) {
             $data = json_decode($response);
             /*
              * Saving access token
              */
             op_update_option(self::OPTION_NAME_OAUTH_ACCESS_TOKEN, $data->access_token);
             op_update_option(self::OPTION_NAME_OAUTH_ORGANIZER_KEY, $data->organizer_key);
             op_update_option(self::OPTION_NAME_OAUTH_EXPIRES_IN, time() + (int) $data->expires_in);
         }
         /*
          * Redirecting to GoToWebinar login/authorization dialog
          */
         header("HTTP/1.1 200 OK");
         header('Location: ' . admin_url() . 'admin.php?page=optimizepress#email_marketing_services--gotowebinar');
         exit;
     } else {
         if ('1' == op_get('disconnect')) {
             /*
              * Saving access data
              */
             op_delete_option(self::OPTION_NAME_OAUTH_ACCESS_TOKEN);
             op_delete_option(self::OPTION_NAME_OAUTH_ORGANIZER_KEY);
             op_delete_option(self::OPTION_NAME_OAUTH_EXPIRES_IN);
             op_delete_option(self::OPTION_NAME_OAUTH_API_KEY);
             /*
              * Redirecting user to dashboard page
              */
             header("HTTP/1.1 200 OK");
             header('Location: ' . admin_url() . 'admin.php?page=optimizepress#email_marketing_services--gotowebinar');
             exit;
         } else {
             if ('1' == op_get('clean')) {
                 op_delete_option(self::OPTION_NAME_OAUTH_API_KEY);
                 /*
                  * Redirecting user to dashboard page
                  */
                 header("HTTP/1.1 200 OK");
                 header('Location: ' . admin_url() . 'admin.php?page=optimizepress#email_marketing_services--gotowebinar');
                 exit;
             } else {
                 $callbackUrl = admin_url('admin.php?action=' . OP_GOTOWEBINAR_AUTH_URL);
                 $this->getClient()->getOAuthToken($this->apiKey, $callbackUrl);
             }
         }
     }
 }
Пример #7
0
 /**
  * Authorizes user on AWeber using OAuth
  *
  * User will be redirected to AWeber website for authorization
  *
  * @return void
  */
 public function authorize()
 {
     /*
      * If 'callback' is defined we are returned from AWeber with auth details
      */
     if (false === op_get('callback') && false === op_get('disconnect')) {
         /*
          * Defining callback URL where AWeber will return with auth information
          */
         $callbackUrl = site_url('/' . OP_AWEBER_AUTH_URL . '?callback=1');
         /*
          * Fetching request token from AWeber
          */
         list($requestToken, $requestTokenSecret) = $this->getClient()->getRequestToken($callbackUrl);
         /*
          * Saving temp request token secret
          */
         op_update_option(self::OPTION_NAME_OAUTH_ACCESS_SECRET, $requestTokenSecret);
         /*
          * Redirecting to AWeber login/authorization dialog
          */
         header("HTTP/1.1 200 OK");
         header('Location: ' . $this->getClient()->getAuthorizeUrl());
         exit;
     } else {
         if ('1' == op_get('disconnect')) {
             /*
              * Saving access data
              */
             op_delete_option(self::OPTION_NAME_OAUTH_ACCESS_TOKEN);
             op_delete_option(self::OPTION_NAME_OAUTH_ACCESS_SECRET);
             /*
              * Redirecting user to dashboard page
              */
             header("HTTP/1.1 200 OK");
             header('Location: ' . admin_url() . 'admin.php?page=optimizepress#email_marketing_services--aweber');
             exit;
         } else {
             /*
              * Filling AWeber user with needed information (from GET and from data received in earlier step)
              */
             $this->getClient()->user->tokenSecret = op_get_option(self::OPTION_NAME_OAUTH_ACCESS_SECRET);
             $this->getClient()->user->requestToken = op_get('oauth_token');
             $this->getClient()->user->verifier = op_get('oauth_verifier');
             /*
              * Fetching access token
              */
             list($accessToken, $accessTokenSecret) = $this->getClient()->getAccessToken();
             /*
              * Saving access data
              */
             op_update_option(self::OPTION_NAME_OAUTH_ACCESS_TOKEN, $accessToken);
             op_update_option(self::OPTION_NAME_OAUTH_ACCESS_SECRET, $accessTokenSecret);
             /*
              * Redirecting user to dashboard page
              */
             header("HTTP/1.1 200 OK");
             header('Location: ' . admin_url() . 'admin.php?page=optimizepress#email_marketing_services--aweber');
             exit;
         }
     }
 }
Пример #8
0
 function save_launch_suite()
 {
     global $wpdb;
     add_filter(OP_SN . '-script-localize', array($this, 'localize'));
     $funnel_dropdown = '';
     $current = intval(op_get('funnel_id'));
     $found = false;
     $funnels = $wpdb->get_results("SELECT id,title FROM `{$wpdb->prefix}optimizepress_launchfunnels` ORDER BY title ASC");
     $funnel_count = 0;
     if ($funnels) {
         $funnel_count = count($funnels);
         foreach ($funnels as $funnel) {
             if ($current < 1) {
                 $current = $funnel->id;
                 $found = true;
             } elseif ($current == $funnel->id) {
                 $found = true;
             }
             $funnel_dropdown .= '<option value="' . $funnel->id . '"' . ($current == $funnel->id ? ' selected="selected"' : '') . '>' . op_attr($funnel->title) . '</option>';
         }
     }
     $this->funnel_count = $funnel_count;
     $this->funnel_dropdown = $funnel_dropdown;
     if ($found) {
         define('OP_LAUNCH_FUNNEL', $current);
     }
     $this->data['settings_sections'] = array('gateway_key' => __('Funnel Gateway Key', OP_SN), 'perpetual_launch' => __('Perpetual/Evergreen Launch Mode', OP_SN), 'redirect_all' => __('Redirect All Launch Pages', OP_SN), 'hide_coming_soon' => __('Hide Coming Soon Placeholders', OP_SN));
     $this->data['settings_sections'] = apply_filters('op_launch_suite_settings_sections', $this->data['settings_sections']);
     if ($found && isset($_POST[OP_SN . '_launch_suite'])) {
         if (isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'op_launch_suite')) {
             $op = op_post('op');
             foreach ($this->data['settings_sections'] as $name => $section) {
                 if (is_array($section)) {
                     if (isset($section['save_action'])) {
                         call_user_func($section['save_action'], op_get_var($op, $name));
                     }
                 } else {
                     call_user_func(array($this, '_save_' . $name), op_get_var($op, $name));
                 }
             }
             $funnel_pages = array('sales' => array(), 'stages' => array());
             $used_ids = array();
             $page_ids = array('sales' => 0, 'stages' => array());
             if (isset($op['funnel_pages'])) {
                 if (isset($op['funnel_pages']['sales'])) {
                     $options = array('page_setup' => array('open_sales_cart', 'sales_page', 'hide_cart'), 'page_thumbnails' => array('active_thumbnail', 'inactive_thumbnail'), 'navigation' => array('active_link_text', 'inactive_link_text'));
                     if (isset($op['funnel_pages']['sales']['page_setup']) && ($page_id = op_get_var($op['funnel_pages']['sales']['page_setup'], 'sales_page', 0)) > 0) {
                         foreach ($options as $section => $fields) {
                             $conf = op_get_var($op['funnel_pages']['sales'], $section);
                             if ($section == 'page_setup') {
                                 $page_ids['sales'] = op_get_var($conf, 'sales_page', 0);
                                 if ($page_ids['sales'] > 0) {
                                     $used_ids[$page_ids['sales']] = true;
                                     $funnel_pages['sales']['sales_page'] = $page_ids['sales'];
                                     op_update_page_id_option($page_ids['sales'], array('launch_suite_info', array('funnel_id' => OP_LAUNCH_FUNNEL, 'funnel_page' => 'sales')));
                                 }
                             }
                             $tmp = array();
                             foreach ($fields as $field) {
                                 $tmp[$field] = op_get_var($conf, $field);
                             }
                             $funnel_pages['sales'][$section] = $tmp;
                         }
                     }
                 }
                 if (empty($funnel_pages['sales'])) {
                     $funnel_pages['sales'] = $op['funnel_pages']['sales'];
                 }
                 if (isset($op['funnel_pages']['stage'])) {
                     $options = array('page_setup' => array('value_page'), 'page_thumbnails' => array('active_thumbnail', 'inactive_thumbnail'), 'navigation' => array('active_link_text', 'inactive_link_text'), 'publish_stage' => array('publish'));
                     if ($this->is_key_on) {
                         array_unshift($options['page_setup'], 'landing_page');
                     }
                     if (isset($op['funnel_pages']['stage']) && is_array($op['funnel_pages']['stage'])) {
                         $count = count(op_get_var($op['funnel_pages']['stage']['page_setup'], 'landing_page', array()));
                         $configs = array('page_setup' => op_get_var($op['funnel_pages']['stage'], 'page_setup', array()), 'page_thumbnails' => op_get_var($op['funnel_pages']['stage'], 'page_thumbnails', array()), 'navigation' => op_get_var($op['funnel_pages']['stage'], 'navigation', array()), 'publish_stage' => op_get_var($op['funnel_pages']['stage'], 'publish_stage', array()));
                         for ($i = 0; $i < $count; $i++) {
                             $stage = array();
                             $pg_ids = array();
                             foreach ($options as $section => $fields) {
                                 $stage[$section] = array();
                                 foreach ($fields as $field) {
                                     $stage[$section][$field] = op_get_var(op_get_var($configs[$section], $field, array()), $i);
                                     if ($field == 'active_link_text' && empty($stage[$section]['active_link_text'])) {
                                         $stage[$section]['active_link_text'] = get_the_title(op_get_var($stage, 'value_page'));
                                     } elseif ($field == 'inactive_link_text' && empty($stage[$section]['inactive_link_text'])) {
                                         $stage[$section]['inactive_link_text'] = 'Coming Soon';
                                     }
                                     if ($field == 'landing_page' || $field == 'value_page') {
                                         $pg_ids[$field] = $stage[$section][$field];
                                         $stage[$field] = $pg_ids[$field];
                                         if ($pg_ids[$field] > 0) {
                                             $used_ids[$pg_ids[$field]] = true;
                                             op_update_page_id_option($pg_ids[$field], array('launch_suite_info', array('funnel_id' => OP_LAUNCH_FUNNEL, 'funnel_page' => 'stage', 'stage_idx' => $i, 'type' => $field)));
                                         }
                                     }
                                 }
                             }
                             $funnel_pages['stages'][] = $stage;
                             $page_ids['stages'][] = $pg_ids;
                         }
                     }
                 }
             }
             op_launch_update_option('funnel_pages', $funnel_pages);
             op_launch_update_option('page_ids', $page_ids);
             $funnel_pages = $wpdb->get_results($wpdb->prepare("SELECT page_id FROM `{$wpdb->prefix}optimizepress_launchfunnels_pages` WHERE funnel_id=%s", OP_LAUNCH_FUNNEL));
             if ($funnel_pages) {
                 $pages = array();
                 foreach ($funnel_pages as $page) {
                     if (!isset($used_ids[$page->page_id])) {
                         op_update_page_id_option($page->page_id, array('launch_suite_info', array('funnel_id' => OP_LAUNCH_FUNNEL, 'funnel_page' => 'stage', 'stage_idx' => -1, 'type' => '')));
                     }
                 }
             }
             if (op_has_error()) {
                 $this->error = __('There was a problem processing the form, please review the errors below', OP_SN);
             } else {
                 $this->notification = __('Your launch suite settings have been updated.', OP_SN);
             }
         } else {
             $this->error = __('Verification failed, please refresh the page and try again.', OP_SN);
         }
     }
 }
Пример #9
0
 /**
  * Checks GET vars for 'op_' prefixed parameters to fill the value
  * @author Luka Peharda <*****@*****.**>
  * @param  string $name
  * @return string
  */
 function getOptinUrlValue($name)
 {
     $value = op_get('op_' . strtolower($name));
     if (false !== $value) {
         $value = op_attr($value);
     } else {
         if ('FNAME' == $name) {
             $value = getOptinUrlValue('name');
         }
     }
     return $value;
 }