/**
  * Save form data
  * @param  array $data
  * @return void
  */
 public function savePlugins($data)
 {
     // Frontend
     $externalPlugins = op_get_var($data, 'external_plugins');
     if (isset($externalPlugins['css'])) {
         op_update_option('op_external_plugins_css', $externalPlugins['css']);
     } else {
         op_delete_option('op_external_plugins_css');
     }
     if (isset($externalPlugins['js'])) {
         op_update_option('op_external_plugins_js', $externalPlugins['js']);
     } else {
         op_delete_option('op_external_plugins_js');
     }
     // Backend
     $externalPlugins = op_get_var($data, 'le_external_plugins');
     if (isset($externalPlugins['css'])) {
         op_update_option('op_le_external_plugins_css', $externalPlugins['css']);
     } else {
         op_delete_option('op_le_external_plugins_css');
     }
     if (isset($externalPlugins['js'])) {
         op_update_option('op_le_external_plugins_js', $externalPlugins['js']);
     } else {
         op_delete_option('op_le_external_plugins_js');
     }
 }
Exemplo n.º 2
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;
         }
     }
 }
Exemplo n.º 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('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);
             }
         }
     }
 }
 function save_convertkit($op)
 {
     if ($apiKey = op_get_var($op['email_marketing_services'], 'convertkit_api_key')) {
         $this->op_update_trim_option('convertkit_api_key', $apiKey);
     } else {
         op_delete_option('convertkit_api_key');
     }
 }
Exemplo n.º 5
0
 function save_flowplayer_license($op)
 {
     if (empty($op['flowplayer_license']['custom_logo']) && empty($op['flowplayer_license']['license_key']) && empty($op['flowplayer_license']['js_file']) && empty($op['flowplayer_license']['swf_file'])) {
         /*
          * If every param is empty, we aren't trying to license flowplayer
          */
         op_delete_option('flowplayer_license');
         return;
     } else {
         if (empty($op['flowplayer_license']['license_key']) || empty($op['flowplayer_license']['js_file']) || empty($op['flowplayer_license']['swf_file'])) {
             op_group_error('global_settings');
             op_section_error('global_settings_flowplayer_license');
             op_tpl_error('op_sections_flowplayer_license', __('To remove Flowplayer watermark and/or to use custom logo, license key, HTML5 and Flash commercial version files needs to be present.', OP_SN));
         }
     }
     op_update_option('flowplayer_license', $op['flowplayer_license']);
 }
Exemplo n.º 6
0
function theme1_reinit_theme()
{
    op_delete_option('header_prefs');
    op_delete_option('footer_prefs', 'widths');
}
Exemplo n.º 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;
         }
     }
 }
 function save_ontraport($op)
 {
     $appId = op_get_var($op['email_marketing_services'], 'ontraport_app_id');
     $apiKey = op_get_var($op['email_marketing_services'], 'ontraport_api_key');
     if ($appId) {
         op_update_option('ontraport_app_id', $appId);
     } else {
         op_delete_option('ontraport_app_id');
     }
     if ($apiKey) {
         op_update_option('ontraport_api_key', $apiKey);
     } else {
         op_delete_option('ontraport_api_key');
     }
 }