/** * Request server with token if defined * * @param string $url URL for request data * @param boolean $token use token from settings * @return string received data */ function get_feed($url) { //first check if we're caching requests $caching_needed = $this->is_cache_activated(); $hash_key = ''; $result = ''; if ($caching_needed) { //Check for a cache hit $hash_key = $this->get_transient_key($url); $result = get_transient($hash_key); } if (empty($result) || !$result) { $result = $this->feed_fetcher->get_feed($url); if ($caching_needed && !is_wp_error($result)) { set_transient($hash_key, $result, $this->configuration->get_option('peg_cache_expiration_time')); //Add the $hash_key to the set of keys that are cached so that cached data can be cleared if (!isset($this->cache_keys)) { $this->cache_keys = get_option('peg_cache_keys', array()); } $this->cache_keys[$hash_key] = true; update_option('peg_cache_keys', $this->cache_keys); } } return $result; }
<?php namespace photo_express; // Make sure that we are uninstalling if (!defined('WP_UNINSTALL_PLUGIN')) { exit; } require_once plugin_dir_path(__FILE__) . 'class-google-photo-access.php'; require_once plugin_dir_path(__FILE__) . 'class-simple-cache.php'; require_once plugin_dir_path(__FILE__) . 'class-settings-storage.php'; //uninstalls the plugin and delete all options / revoking oauth access $configuration = new Settings_Storage(); $photo_access = new Google_Photo_Access($configuration); $photo_access->uninstall(); $cache = new Simple_Cache($configuration, $photo_access); $cache->clear_cache(); if (is_multisite()) { $configuration->delete_site_options(); } else { $configuration->delete_options(); }