コード例 #1
0
 /**
  * @author Vova Feldman (@svovaf)
  * @since  1.1.6
  *
  * @param string $key
  * @param mixed  $value
  * @param int    $expiration
  */
 function set($key, $value, $expiration = WP_FS__TIME_24_HOURS_IN_SEC)
 {
     $this->_logger->entrance('key = ' . $key);
     $cache_entry = new stdClass();
     $cache_entry->result = $value;
     $cache_entry->timestamp = WP_FS__SCRIPT_START_TIME + $expiration;
     $this->_options->set_option($key, $cache_entry, true);
 }
コード例 #2
0
 private function RestoreDefaultSettings()
 {
     RWLogger::LogEnterence('RestoreDefaultSettings');
     // Restore to defaults - clear all settings.
     $this->_options->clear();
     // Restore account details.
     $this->_options->set_option(WP_RW__DB_OPTION_SITE_PUBLIC_KEY, $this->account->site_public_key);
     $this->_options->set_option(WP_RW__DB_OPTION_SITE_ID, $this->account->site_id);
     $this->_options->set_option(WP_RW__DB_OPTION_SITE_SECRET_KEY, $this->account->site_secret_key);
     $this->_options->set_option(WP_RW__DB_OPTION_OWNER_ID, $this->account->user_id);
     $this->_options->set_option(WP_RW__DB_OPTION_OWNER_EMAIL, $this->account->user_email);
     $this->_options->store();
     RWLogger::LogDeparture('RestoreDefaultSettings');
 }
コード例 #3
0
 /**
  * Update account add-ons list.
  *
  * @author   Vova Feldman (@svovaf)
  * @since    1.0.6
  *
  * @param FS_Plugin[] $addons
  * @param bool        $store Flush to Database if true.
  */
 private function _store_account_addons($addons, $store = true)
 {
     $this->_logger->entrance();
     $all_addons = self::get_all_account_addons();
     $all_addons[$this->_plugin->id] = $addons;
     self::$_accounts->set_option('account_addons', $all_addons, $store);
 }
コード例 #4
0
 private function _store_user($store = true)
 {
     $users = self::$_accounts->get_option('users');
     $users[$this->_user->id] = $this->_user;
     self::$_accounts->set_option('users', $users, $store);
 }
コード例 #5
0
 /**
  * Migration from account options stored in FS accounts object back to RW options object.
  *
  * @author Vova Feldman (@svovaf)
  * @since  2.6.3
  *
  * @param FS_Option_Manager $fs_options
  * @param string            $basename
  */
 private function migrate_from_fs_options($fs_options, $basename)
 {
     // Load site information.
     $sites = $fs_options->get_option('sites');
     $site = $sites[$basename];
     // Load user information.
     $users = $fs_options->get_option('users');
     $user = $users[$site->user_id];
     // Update account information.
     $this->set($site->id, $site->public_key, $site->secret_key, $user->id, $user->email);
     // Remove RW account from FS object.
     unset($sites[$basename]);
     unset($users[$site->user_id]);
     $fs_options->set_option('sites', $sites);
     $fs_options->set_option('users', $users);
     $fs_options->store();
 }
コード例 #6
0
 function set_option($option, $value, $flush = false)
 {
     $this->_options->set_option($option, $value, $flush);
 }