/** * @author Vova Feldman (@svovaf) * @since 1.1.3 * * @param string $id */ private function __construct($id) { $this->_logger = FS_Logger::get_logger(WP_FS__SLUG . '_cach_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK); $this->_logger->entrance(); $this->_logger->log('id = ' . $id); $this->_options = FS_Option_Manager::get_manager($id, true); }
private static function _init() { if (!class_exists('RatingWidget')) { require_once WP_RW__PLUGIN_LIB_DIR . 'sdk/ratingwidget.php'; } self::$_options = FS_Option_Manager::get_manager(WP_RW__OPTIONS, true); self::$_cache = FS_Option_Manager::get_manager('rw_api_cache', true); self::$_clock_diff = self::$_options->get_option('api_clock_diff', 0); RatingWidget::SetClockDiff(self::$_clock_diff); if (self::$_options->get_option('api_force_http', false)) { RatingWidget::SetHttp(); } }
private static function _init() { if (isset(self::$_options)) { return; } if (!class_exists('Freemius_Api')) { require_once WP_FS__DIR_SDK . '/Freemius.php'; } self::$_options = FS_Option_Manager::get_manager(WP_FS__OPTIONS_OPTION_NAME, true); self::$_cache = FS_Cache_Manager::get_manager(WP_FS__API_CACHE_OPTION_NAME); self::$_clock_diff = self::$_options->get_option('api_clock_diff', 0); Freemius_Api::SetClockDiff(self::$_clock_diff); if (self::$_options->get_option('api_force_http', false)) { Freemius_Api::SetHttp(); } }
/** * @param $id * @param bool $load_options * @param bool $prefix_slug * * @return FS_Option_Manager */ function get_options_manager($id, $load_options = false, $prefix_slug = true) { return FS_Option_Manager::get_manager(($prefix_slug ? $this->_slug : '') . (!$prefix_slug || empty($id) ? '' : '_') . $id, $load_options); }
protected function get_option_manager() { return FS_Option_Manager::get_manager(WP_FS__ACCOUNTS_OPTION_NAME, true); }
<?php /** * @package Freemius * @copyright Copyright (c) 2015, Freemius, Inc. * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License * @since 1.1.7.3 */ if (!defined('ABSPATH')) { exit; } $fs_options = FS_Option_Manager::get_manager(WP_FS__ACCOUNTS_OPTION_NAME, true); $plugins = $fs_options->get_option('plugins'); $scheduled_crons = array(); if (is_array($plugins) && 0 < count($plugins)) { foreach ($plugins as $slug => $data) { $fs = freemius($slug); $next_execution = $fs->next_sync_cron(); $last_execution = $fs->last_sync_cron(); if (false !== $next_execution) { $scheduled_crons[$slug][] = array('name' => $fs->get_plugin_name(), 'slug' => $slug, 'type' => 'sync_cron', 'last' => $last_execution, 'next' => $next_execution); } $next_install_execution = $fs->next_install_sync(); $last_install_execution = $fs->last_install_sync(); if (false !== $next_install_execution || false !== $last_install_execution) { $scheduled_crons[$slug][] = array('name' => $fs->get_plugin_name(), 'slug' => $slug, 'type' => 'install_sync', 'last' => $last_install_execution, 'next' => $next_install_execution); } } } ?> <h1><?php
/** * Clear API cache. * * @author Vova Feldman (@svovaf) * @since 1.0.9 */ static function clear_cache() { self::$_cache = FS_Option_Manager::get_manager(WP_FS__API_CACHE_OPTION_NAME, true); self::$_cache->clear(true); }
/** * Load account information from RatingWidget to Freemius. * It's a migration method that should be only executed once. * @return array */ function rw_fs_load_external_account() { $options = FS_Option_Manager::get_manager(WP_RW__OPTIONS, true); $site_public_key = $options->get_option(WP_RW__DB_OPTION_SITE_PUBLIC_KEY, false); $site_id = $options->get_option(WP_RW__DB_OPTION_SITE_ID, false); $owner_id = $options->get_option(WP_RW__DB_OPTION_OWNER_ID, false); $owner_email = $options->get_option(WP_RW__DB_OPTION_OWNER_EMAIL, false); $update = false; if (!defined('WP_RW__SITE_PUBLIC_KEY')) { define('WP_RW__SITE_PUBLIC_KEY', $site_public_key); define('WP_RW__SITE_ID', $site_id); define('WP_RW__OWNER_ID', $owner_id); define('WP_RW__OWNER_EMAIL', $owner_email); } else { if (is_string(WP_RW__SITE_PUBLIC_KEY) && WP_RW__SITE_PUBLIC_KEY !== $site_public_key) { // Override user key. $options->set_option(WP_RW__DB_OPTION_SITE_PUBLIC_KEY, WP_RW__SITE_PUBLIC_KEY); $options->set_option(WP_RW__DB_OPTION_SITE_ID, WP_RW__SITE_ID); if (defined('WP_RW__OWNER_ID')) { $options->set_option(WP_RW__DB_OPTION_OWNER_ID, WP_RW__OWNER_ID); } if (defined('WP_RW__OWNER_EMAIL')) { $options->set_option(WP_RW__DB_OPTION_OWNER_EMAIL, WP_RW__OWNER_EMAIL); } $update = true; } } $secret_key = $options->get_option(WP_RW__DB_OPTION_SITE_SECRET_KEY, false); if (!defined('WP_RW__SITE_SECRET_KEY')) { define('WP_RW__SITE_SECRET_KEY', $secret_key); } else { if (is_string(WP_RW__SITE_SECRET_KEY) && WP_RW__SITE_SECRET_KEY !== $secret_key) { // Override user key. $options->set_option(WP_RW__DB_OPTION_SITE_SECRET_KEY, WP_RW__SITE_SECRET_KEY); $update = true; } } if ($update) { $options->store(); } $site = false; $user = false; if (false !== WP_RW__SITE_PUBLIC_KEY) { $site = new FS_Site(); $site->id = $options->get_option(WP_RW__DB_OPTION_SITE_ID); $site->public_key = $options->get_option(WP_RW__DB_OPTION_SITE_PUBLIC_KEY); $site->secret_key = $options->get_option(WP_RW__DB_OPTION_SITE_SECRET_KEY); $user = new FS_User(); $user->id = $options->get_option(WP_RW__DB_OPTION_OWNER_ID); $user->email = $options->get_option(WP_RW__DB_OPTION_OWNER_EMAIL); } return array('user' => $user, 'site' => $site); }