/**
  * @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);
 }
 /**
  * @author Vova Feldman (@svovaf)
  * @since  1.0.3
  *
  * @param string $id
  * @param bool   $load
  */
 private function __construct($id, $load = false)
 {
     $this->_logger = FS_Logger::get_logger(WP_FS__SLUG . '_opt_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK);
     $this->_logger->entrance();
     $this->_logger->log('id = ' . $id);
     $this->_id = $id;
     if ($load) {
         $this->load();
     }
 }
 /**
  * Check for Updates at the defined API endpoint and modify the update array.
  *
  * This function dives into the update api just when WordPress creates its update array,
  * then adds a custom API call and injects the custom plugin data retrieved from the API.
  * It is reassembled from parts of the native WordPress plugin update code.
  * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
  *
  * @author Vova Feldman (@svovaf)
  * @since  1.0.4
  *
  * @uses   FS_Api
  *
  * @param stdClass $transient_data Update array build by WordPress.
  *
  * @return array Modified update array with custom plugin data.
  */
 function pre_set_site_transient_update_plugins_filter($transient_data)
 {
     $this->_logger->entrance();
     if (empty($transient_data) || defined('WP_FS__UNINSTALL_MODE')) {
         return $transient_data;
     }
     if (!isset($this->_update_details)) {
         // Get plugin's newest update.
         $new_version = $this->_fs->get_update(false, false);
         $this->_update_details = false;
         if (is_object($new_version)) {
             $this->_logger->log('Found newer plugin version ' . $new_version->version);
             $plugin_details = new stdClass();
             $plugin_details->slug = $this->_fs->get_slug();
             $plugin_details->new_version = $new_version->version;
             $plugin_details->url = WP_FS__ADDRESS;
             $plugin_details->package = $new_version->url;
             $plugin_details->plugin = $this->_fs->get_plugin_basename();
             /**
              * Cache plugin details locally since set_site_transient( 'update_plugins' )
              * called multiple times and the non wp.org plugins are filtered after the
              * call to .org.
              *
              * @since 1.1.8.1
              */
             $this->_update_details = $plugin_details;
         }
     }
     if (is_object($this->_update_details)) {
         // Add plugin to transient data.
         $transient_data->response[$this->_fs->get_plugin_basename()] = $this->_update_details;
     }
     return $transient_data;
 }
Exemplo n.º 4
0
 /**
  * Hook to plugin action links filter.
  *
  * @author Vova Feldman (@svovaf)
  * @since  1.0.0
  */
 private function hook_plugin_action_links()
 {
     $this->_logger->entrance();
     $this->_action_links_hooked = true;
     $this->_logger->log('Adding action links hooks.');
     // Add action link to settings page.
     add_filter('plugin_action_links_' . $this->_plugin_basename, array(&$this, '_modify_plugin_action_links_hook'), 10, 2);
     add_filter('network_admin_plugin_action_links_' . $this->_plugin_basename, array(&$this, '_modify_plugin_action_links_hook'), 10, 2);
 }
 /**
  * Check for Updates at the defined API endpoint and modify the update array.
  *
  * This function dives into the update api just when WordPress creates its update array,
  * then adds a custom API call and injects the custom plugin data retrieved from the API.
  * It is reassembled from parts of the native WordPress plugin update code.
  * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
  *
  * @author Vova Feldman (@svovaf)
  * @since  1.0.4
  *
  * @uses   FS_Api
  *
  * @param stdClass $transient_data Update array build by WordPress.
  *
  * @return array Modified update array with custom plugin data.
  */
 function pre_set_site_transient_update_plugins_filter($transient_data)
 {
     $this->_logger->entrance();
     if (empty($transient_data) || defined('WP_FS__UNINSTALL_MODE')) {
         return $transient_data;
     }
     // Get plugin's newest update.
     $new_version = $this->_fs->get_update();
     if (is_object($new_version)) {
         $this->_logger->log('Found newer plugin version ' . $new_version->version);
         $plugin_details = new stdClass();
         $plugin_details->slug = $this->_fs->get_slug();
         $plugin_details->new_version = $new_version->version;
         $plugin_details->url = WP_FS__ADDRESS;
         $plugin_details->package = $new_version->url;
         $plugin_details->plugin = $this->_fs->get_plugin_basename();
         // Add plugin to transient data.
         $transient_data->response[$this->_fs->get_plugin_basename()] = $plugin_details;
     }
     return $transient_data;
 }