/**
  * Returns and/or create the single instance of this class.
  *
  * @return  Charitable_Licenses
  * @access  public
  * @since   1.2.0
  */
 public static function get_instance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new Charitable_Licenses();
     }
     return self::$instance;
 }
 /**
  * Show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
  *
  * @param string  $file
  * @param array   $plugin
  */
 public function show_update_notification($file, $plugin)
 {
     if (!current_user_can('update_plugins')) {
         return;
     }
     if (!is_multisite()) {
         return;
     }
     if ($this->name != $file) {
         return;
     }
     // Remove our filter on the site transient
     remove_filter('pre_set_site_transient_update_plugins', array(Charitable_Licenses::get_instance(), 'check_for_updates'));
     $update_cache = get_site_transient('update_plugins');
     if (!is_object($update_cache) || empty($update_cache->response) || empty($update_cache->response[$this->name])) {
         $cache_key = md5('edd_plugin_' . sanitize_key($this->name) . '_version_info');
         $version_info = get_transient($cache_key);
         if (false === $version_info) {
             $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
             set_transient($cache_key, $version_info, 3600);
         }
         if (!is_object($version_info)) {
             return;
         }
         if (version_compare($this->version, $version_info->new_version, '<')) {
             $update_cache->response[$this->name] = $version_info;
         }
         $update_cache->last_checked = time();
         $update_cache->checked[$this->name] = $this->version;
         set_site_transient('update_plugins', $update_cache);
     } else {
         $version_info = $update_cache->response[$this->name];
     }
     // Restore our filter
     add_filter('pre_set_site_transient_update_plugins', array(Charitable_Licenses::get_instance(), 'check_for_updates'));
     if (!empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
         // build a plugin list row, with update notification
         $wp_list_table = _get_list_table('WP_Plugins_List_Table');
         echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
         $changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911');
         if (empty($version_info->download_link)) {
             printf(__('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'charitable'), esc_html($version_info->name), esc_url($changelog_link), esc_html($version_info->new_version));
         } else {
             printf(__('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'charitable'), esc_html($version_info->name), esc_url($changelog_link), esc_html($version_info->new_version), esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=') . $this->name, 'upgrade-plugin_' . $this->name)));
         }
         echo '</div></td></tr>';
     }
 }
示例#3
0
 /**
  * Include necessary files.
  *
  * @return  void
  * @access  private
  * @since   1.0.0
  */
 private function load_dependencies()
 {
     $includes_path = $this->get_path('includes');
     /* Abstracts */
     require_once $includes_path . 'abstracts/class-charitable-form.php';
     require_once $includes_path . 'abstracts/class-charitable-query.php';
     require_once $includes_path . 'abstracts/class-charitable-start-object.php';
     /* Functions & Core Classes */
     require_once $includes_path . 'charitable-core-functions.php';
     require_once $includes_path . 'charitable-utility-functions.php';
     require_once $includes_path . 'class-charitable-locations.php';
     require_once $includes_path . 'class-charitable-notices.php';
     require_once $includes_path . 'class-charitable-post-types.php';
     require_once $includes_path . 'class-charitable-request.php';
     require_once $includes_path . 'class-charitable-cron.php';
     require_once $includes_path . 'class-charitable-i18n.php';
     /* Addons */
     require_once $includes_path . 'addons/class-charitable-addons.php';
     /* Campaigns */
     require_once $includes_path . 'campaigns/charitable-campaign-functions.php';
     require_once $includes_path . 'campaigns/class-charitable-campaign.php';
     require_once $includes_path . 'campaigns/class-charitable-campaigns.php';
     require_once $includes_path . 'campaigns/charitable-campaign-hooks.php';
     /* Currency */
     require_once $includes_path . 'currency/charitable-currency-functions.php';
     require_once $includes_path . 'currency/class-charitable-currency.php';
     /* Donations */
     require_once $includes_path . 'donations/abstract-charitable-donation.php';
     require_once $includes_path . 'donations/interface-charitable-donation-form.php';
     require_once $includes_path . 'donations/class-charitable-donation-processor.php';
     require_once $includes_path . 'donations/class-charitable-donation.php';
     require_once $includes_path . 'donations/class-charitable-donation-factory.php';
     require_once $includes_path . 'donations/class-charitable-donations.php';
     require_once $includes_path . 'donations/class-charitable-donations-query.php';
     require_once $includes_path . 'donations/class-charitable-donation-form.php';
     require_once $includes_path . 'donations/class-charitable-donation-amount-form.php';
     require_once $includes_path . 'donations/charitable-donation-hooks.php';
     require_once $includes_path . 'donations/charitable-donation-functions.php';
     /* Users */
     require_once $includes_path . 'users/charitable-user-functions.php';
     require_once $includes_path . 'users/class-charitable-user.php';
     require_once $includes_path . 'users/class-charitable-roles.php';
     require_once $includes_path . 'users/class-charitable-donor.php';
     require_once $includes_path . 'users/class-charitable-donor-query.php';
     /* Gateways */
     require_once $includes_path . 'gateways/interface-charitable-gateway.php';
     require_once $includes_path . 'gateways/class-charitable-gateways.php';
     require_once $includes_path . 'gateways/abstract-class-charitable-gateway.php';
     require_once $includes_path . 'gateways/class-charitable-gateway-offline.php';
     require_once $includes_path . 'gateways/class-charitable-gateway-paypal.php';
     /* Emails */
     require_once $includes_path . 'emails/interface-charitable-email.php';
     require_once $includes_path . 'emails/class-charitable-emails.php';
     require_once $includes_path . 'emails/abstract-class-charitable-email.php';
     require_once $includes_path . 'emails/class-charitable-email-new-donation.php';
     require_once $includes_path . 'emails/class-charitable-email-donation-receipt.php';
     require_once $includes_path . 'emails/class-charitable-email-campaign-end.php';
     require_once $includes_path . 'emails/class-charitable-email-password-reset.php';
     require_once $includes_path . 'emails/charitable-email-hooks.php';
     /* Database */
     require_once $includes_path . 'db/abstract-class-charitable-db.php';
     require_once $includes_path . 'db/class-charitable-campaign-donations-db.php';
     require_once $includes_path . 'db/class-charitable-donors-db.php';
     /* Licensing */
     require_once $includes_path . 'licensing/class-charitable-licenses.php';
     require_once $includes_path . 'licensing/class-charitable-plugin-updater.php';
     /* Public */
     require_once $includes_path . 'public/charitable-page-functions.php';
     require_once $includes_path . 'public/charitable-template-helpers.php';
     require_once $includes_path . 'public/class-charitable-session.php';
     require_once $includes_path . 'public/class-charitable-template.php';
     require_once $includes_path . 'public/class-charitable-template-part.php';
     require_once $includes_path . 'public/class-charitable-templates.php';
     require_once $includes_path . 'public/class-charitable-ghost-page.php';
     require_once $includes_path . 'public/class-charitable-user-dashboard.php';
     /* Shortcodes */
     require_once $includes_path . 'shortcodes/class-charitable-campaigns-shortcode.php';
     require_once $includes_path . 'shortcodes/class-charitable-my-donations-shortcode.php';
     require_once $includes_path . 'shortcodes/class-charitable-donation-receipt-shortcode.php';
     require_once $includes_path . 'shortcodes/class-charitable-login-shortcode.php';
     require_once $includes_path . 'shortcodes/class-charitable-registration-shortcode.php';
     require_once $includes_path . 'shortcodes/class-charitable-profile-shortcode.php';
     require_once $includes_path . 'shortcodes/charitable-shortcodes-hooks.php';
     /* Widgets */
     require_once $includes_path . 'widgets/class-charitable-widgets.php';
     require_once $includes_path . 'widgets/class-charitable-campaign-terms-widget.php';
     require_once $includes_path . 'widgets/class-charitable-campaigns-widget.php';
     require_once $includes_path . 'widgets/class-charitable-donors-widget.php';
     require_once $includes_path . 'widgets/class-charitable-donate-widget.php';
     require_once $includes_path . 'widgets/class-charitable-donation-stats-widget.php';
     /* User Management */
     require_once $includes_path . 'user-management/class-charitable-registration-form.php';
     require_once $includes_path . 'user-management/class-charitable-profile-form.php';
     require_once $includes_path . 'user-management/class-charitable-forgot-password-form.php';
     require_once $includes_path . 'user-management/class-charitable-reset-password-form.php';
     require_once $includes_path . 'user-management/class-charitable-user-management.php';
     require_once $includes_path . 'user-management/charitable-user-management-hooks.php';
     /* Customizer */
     require_once $includes_path . 'admin/customizer/class-charitable-customizer.php';
     /* Deprecated */
     require_once $includes_path . 'deprecated/charitable-deprecated-functions.php';
     /**
      * We are registering this object only for backwards compatibility. It
      * will be removed in or after Charitable 1.3.
      *
      * @deprecated
      */
     $this->register_object(Charitable_Emails::get_instance());
     $this->register_object(Charitable_Request::get_instance());
     $this->register_object(Charitable_Gateways::get_instance());
     $this->register_object(Charitable_i18n::get_instance());
     $this->register_object(Charitable_Post_Types::get_instance());
     $this->register_object(Charitable_Cron::get_instance());
     $this->register_object(Charitable_Widgets::get_instance());
     $this->register_object(Charitable_Licenses::get_instance());
     $this->register_object(Charitable_User_Dashboard::get_instance());
 }