Version Description
- Release date: 2015-07-09
- Change Installer version to 1.6.1
Download this release
Release Info
Developer | iworks |
Plugin | Toolset Types – Custom Post Types, Custom Fields and Taxonomies |
Version | 1.7.4 |
Comparing to | |
See all releases |
Code changes from version 1.7.3 to 1.7.4
- embedded/bootstrap.php +1 -1
- embedded/plugin.php +1 -1
- plus/installer/changelog.txt +75 -69
- plus/installer/includes/class-installer-theme.php +954 -0
- plus/installer/includes/installer-api.php +24 -24
- plus/installer/includes/installer-upgrader-skins.php +36 -36
- plus/installer/includes/installer.class.php +2358 -2244
- plus/installer/installer.php +21 -21
- plus/installer/loader.php +123 -99
- plus/installer/locale/orig/installer.po +230 -230
- plus/installer/repositories.xml +13 -13
- plus/installer/res/css/admin.css +166 -152
- plus/installer/res/img/spinner.gif +0 -0
- plus/installer/res/js/admin.js +390 -366
- plus/installer/res/js/iframeResizer.min.js +10 -10
- plus/installer/res/js/installer_theme_install.js +94 -0
- plus/installer/templates/downloads-list-compact.php +77 -75
- plus/installer/templates/downloads-list.php +84 -81
- plus/installer/templates/products-compact.php +128 -128
- plus/installer/templates/repository-listing.php +166 -166
- readme.txt +6 -1
- wpcf.php +2 -2
embedded/bootstrap.php
CHANGED
@@ -133,7 +133,7 @@ function wpcf_embedded_init() {
|
|
133 |
// Define necessary constants if plugin is not present
|
134 |
// This ones are skipped if used as embedded code!
|
135 |
if ( !defined( 'WPCF_VERSION' ) ) {
|
136 |
-
define( 'WPCF_VERSION', '1.7.
|
137 |
define( 'WPCF_META_PREFIX', 'wpcf-' );
|
138 |
}
|
139 |
|
133 |
// Define necessary constants if plugin is not present
|
134 |
// This ones are skipped if used as embedded code!
|
135 |
if ( !defined( 'WPCF_VERSION' ) ) {
|
136 |
+
define( 'WPCF_VERSION', '1.7.4' );
|
137 |
define( 'WPCF_META_PREFIX', 'wpcf-' );
|
138 |
}
|
139 |
|
embedded/plugin.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
Description: Define custom post types, custom taxonomies and custom fields.
|
6 |
Author: OnTheGoSystems
|
7 |
Author URI: http://www.onthegosystems.com
|
8 |
-
Version: 1.7.
|
9 |
*/
|
10 |
/**
|
11 |
*
|
5 |
Description: Define custom post types, custom taxonomies and custom fields.
|
6 |
Author: OnTheGoSystems
|
7 |
Author URI: http://www.onthegosystems.com
|
8 |
+
Version: 1.7.4
|
9 |
*/
|
10 |
/**
|
11 |
*
|
plus/installer/changelog.txt
CHANGED
@@ -1,69 +1,75 @@
|
|
1 |
-
= 1.
|
2 |
-
*
|
3 |
-
*
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
*
|
9 |
-
*
|
10 |
-
|
11 |
-
= 1.5.
|
12 |
-
*
|
13 |
-
*
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
*
|
20 |
-
|
21 |
-
|
22 |
-
*
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
*
|
28 |
-
*
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
*
|
34 |
-
*
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
*
|
40 |
-
*
|
41 |
-
*
|
42 |
-
*
|
43 |
-
|
44 |
-
|
45 |
-
*
|
46 |
-
*
|
47 |
-
*
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
*
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
*
|
58 |
-
|
59 |
-
|
60 |
-
*
|
61 |
-
*
|
62 |
-
*
|
63 |
-
|
64 |
-
|
65 |
-
*
|
66 |
-
*
|
67 |
-
*
|
68 |
-
*
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
= 1.6 =
|
2 |
+
* Improved the way plugins are matched: not just by the folder name (slug) but also by name
|
3 |
+
* Added support for installing and upgrading themes from repositories (currently: Toolset themes)
|
4 |
+
* Added support for 'alias' plugins on the toolset and wpml repositories (currently: Types)
|
5 |
+
* Enhanced the progress animation during plugins downloading
|
6 |
+
|
7 |
+
= 1.5.6 =
|
8 |
+
* Updated the translations
|
9 |
+
* Fix for WPML 3.2 conditional upgrade logic
|
10 |
+
|
11 |
+
= 1.5.5 =
|
12 |
+
* Fixed the logic for the high_priority parameter
|
13 |
+
* Fixed js bug causing a conflict with NextGen
|
14 |
+
* Fixed bug preventing users to install and upgrade Types when they didn't have a Toolset subscription
|
15 |
+
* Fixed bug preventing users to upgrade from the embedded Types to the full version
|
16 |
+
|
17 |
+
= 1.5.4 =
|
18 |
+
* Option to disable auto-updates
|
19 |
+
* Escaped urls generated with add_query_arg
|
20 |
+
|
21 |
+
= 1.5.3 =
|
22 |
+
* Fixed bug in WP_Installer::custom_plugins_api_call (filter for plugins_api) causing conflicts with other filters for plugins_api
|
23 |
+
|
24 |
+
= 1.5.2 =
|
25 |
+
* More meaningful errors when plugin downloads fail
|
26 |
+
* WordPress 4.2 compatibility
|
27 |
+
* Performance improvements (will not load in places where it's not needed and not make unnecessary requests to the CDN)
|
28 |
+
* Support putting deps.xml config file in the theme folder (root)
|
29 |
+
* Included code for importing data for toolset plugins
|
30 |
+
* Use CloudFront urls for products list files
|
31 |
+
|
32 |
+
= 1.5.1 =
|
33 |
+
* Fix for allowing embedded plugins to be updated
|
34 |
+
* Logic for the migration from embedded plugins to full plugins
|
35 |
+
|
36 |
+
= 1.5 =
|
37 |
+
* Support for embedded plugins
|
38 |
+
* Bug fix: When user registers site key with trailing slash, downloads might not work
|
39 |
+
* Tweak: Set a higher timeout limit for the http requests to CDN and API
|
40 |
+
* API function: link to specific repository
|
41 |
+
* API function: get product price
|
42 |
+
* New method for defining affiliate info (with backwards compatibility)
|
43 |
+
|
44 |
+
= 1.4 =
|
45 |
+
* Show explicit error in case of connectivity issues while validating a key.
|
46 |
+
* Bug fix: Downloading plugins in bulk was broken by plugin that had a redirect after activation
|
47 |
+
* Display friendly error message when WordPress does not have permissions to write to the plugins folder
|
48 |
+
* Added support for configuration files to auto-download required plugins and theme keys
|
49 |
+
* Changed the "Update this info" button to "Check for updates" (it refreshes the subscription info and checks for updates)
|
50 |
+
* Support for high_priority parameter that allows setting priority for an Installer instance when more with the same version number exist.
|
51 |
+
* Config files from different instances are combined (define repositories in different instances)
|
52 |
+
* Updated support for conditional updates display for ICL users
|
53 |
+
* More friendly error reporting and handling when using an invalid site key or the plugins archives are not valid.
|
54 |
+
|
55 |
+
|
56 |
+
= 1.3.1 =
|
57 |
+
* Support for conditional release notification (ICanLocalize)
|
58 |
+
|
59 |
+
= 1.3 =
|
60 |
+
* Added a new repository: Toolset
|
61 |
+
* The product packages can be displayed hierarchically and ordered
|
62 |
+
* The link to automatically create site keys will follow through login on the account site (e.g. wpml.org, wp-types.com)
|
63 |
+
* Fixed animation issues (not showing in most browsers) when downloading plugins.
|
64 |
+
* Created an admin screen on the repository end (icl-mpp) to sho registration stats (site keys, site keys usage, components usage etc..).
|
65 |
+
* Bug fix: Renew and Upgrade buttons were not entirely clickable
|
66 |
+
* Bug fix: Action buttons (buy, renew, upgrade) were not displayed correctly when WPML was not active (Installer embedded in theme)
|
67 |
+
* Support for site-wide registration. Products can be registered on the network instead of on each site separately.
|
68 |
+
* Users are able to add either http or https version for any site urls. There will be one site key that will work with both http and https versions.
|
69 |
+
|
70 |
+
= 1.2 =
|
71 |
+
* Added pagination for site keys list of Account -> My Sites
|
72 |
+
* Reversed the order in which the site keys are displayed.
|
73 |
+
* Fixed problem with WPML registration information (site key) not being saved when the option_value field in the wp_options table used a different charset than the default WordPress charset defined in wp-config.php
|
74 |
+
* Allow registering new sites by clicking a link in the WordPress admin instead of copying and pasting the site url in the Account -> My Sites section
|
75 |
+
* Display more detailed debug information related to connectivity issues with the WPML repository
|
plus/installer/includes/class-installer-theme.php
ADDED
@@ -0,0 +1,954 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Installer Class for Theme Support
|
4 |
+
*
|
5 |
+
* Supports automatic updates and installation of Toolset/WPML Themes
|
6 |
+
*
|
7 |
+
* @class Installer_Theme_Class
|
8 |
+
* @version 1.6
|
9 |
+
* @category Class
|
10 |
+
* @author OnTheGoSystems
|
11 |
+
*/
|
12 |
+
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Installer_Theme_Class
|
19 |
+
*/
|
20 |
+
|
21 |
+
class Installer_Theme_Class {
|
22 |
+
|
23 |
+
/** Theme Repository */
|
24 |
+
private $theme_repo;
|
25 |
+
|
26 |
+
/** Repository API */
|
27 |
+
private $repository_api;
|
28 |
+
|
29 |
+
/** Repository Theme Products */
|
30 |
+
private $repository_theme_products;
|
31 |
+
|
32 |
+
/** Site URL */
|
33 |
+
private $installer_site_url;
|
34 |
+
|
35 |
+
/** Site Key */
|
36 |
+
private $installer_site_key;
|
37 |
+
|
38 |
+
/** The Themes Option */
|
39 |
+
protected $installer_themes_option;
|
40 |
+
|
41 |
+
/** Update settings */
|
42 |
+
protected $installer_themes_available_updates;
|
43 |
+
|
44 |
+
/** The Themes */
|
45 |
+
protected $installer_themes;
|
46 |
+
|
47 |
+
/** Repository with themes */
|
48 |
+
protected $installer_repo_with_themes;
|
49 |
+
|
50 |
+
/** Active tab */
|
51 |
+
protected $installer_theme_active_tab;
|
52 |
+
|
53 |
+
/** Theme user registration */
|
54 |
+
protected $theme_user_registration;
|
55 |
+
|
56 |
+
/** Client active subscription */
|
57 |
+
protected $installer_theme_subscription_type;
|
58 |
+
|
59 |
+
public function __construct() {
|
60 |
+
|
61 |
+
/** Properties */
|
62 |
+
|
63 |
+
//Get installer repositories
|
64 |
+
$installer_repositories=WP_Installer()->get_repositories();
|
65 |
+
|
66 |
+
//Get repos with themes
|
67 |
+
$repos_with_themes= $this->installer_theme_reposities_that_has_themes($installer_repositories);
|
68 |
+
|
69 |
+
if (is_array($repos_with_themes)) {
|
70 |
+
//Assign to property
|
71 |
+
$this->installer_repo_with_themes=$repos_with_themes;
|
72 |
+
|
73 |
+
//Let's looped through repos with themes
|
74 |
+
foreach ($repos_with_themes as $k=>$repo) {
|
75 |
+
|
76 |
+
//$repo could be 'toolset' or 'wpml'
|
77 |
+
//Assign each repo with theme to property
|
78 |
+
$this->theme_repo[] = $repo;
|
79 |
+
|
80 |
+
if ((isset($installer_repositories[$repo]['api-url'])) && (isset($installer_repositories[$repo]['products']))) {
|
81 |
+
|
82 |
+
//Define the rest of the properties based on the given repo
|
83 |
+
$this->repository_api[$repo] = $installer_repositories[$repo]['api-url'];
|
84 |
+
$this->repository_theme_products[$repo] =$installer_repositories[$repo]['products'];
|
85 |
+
$this->installer_site_url[$repo] = WP_Installer()->get_installer_site_url($repo);
|
86 |
+
$this->installer_site_key[$repo] = WP_Installer()->get_site_key($repo);
|
87 |
+
$this->theme_user_registration[$repo] = false;
|
88 |
+
|
89 |
+
if ((!(empty($this->installer_site_url[$repo]))) && (!(empty($this->installer_site_key[$repo]))) &&
|
90 |
+
(!(empty($this->repository_api[$repo]))) && (!(empty($this->repository_theme_products[$repo])))) {
|
91 |
+
|
92 |
+
//Let's validate user subscription
|
93 |
+
$validate_subscription = WP_Installer()->fetch_subscription_data($repo, $this->installer_site_key[$repo]);
|
94 |
+
if ((!(is_wp_error($validate_subscription))) && (is_object($validate_subscription))) {
|
95 |
+
//Here we have a validated subscription...
|
96 |
+
$this->installer_theme_subscription_type=$validate_subscription->subscription_type;
|
97 |
+
$this->installer_themes_option[$repo]='wp_installer_'.$repo.'_themes';
|
98 |
+
$this->installer_themes_available_updates[$repo]='wp_installer_'.$repo.'_updated_themes';
|
99 |
+
$this->installer_theme_active_tab='';
|
100 |
+
|
101 |
+
//We only set themes available to this validated subscription
|
102 |
+
$this->installer_theme_available($repo,$this->installer_theme_subscription_type);
|
103 |
+
|
104 |
+
add_action( 'installer_themes_support_set_up',array( $this,'installer_theme_sets_active_tab_on_init'),10);
|
105 |
+
$this->theme_user_registration[$repo] = true;
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
/** We are ready.. let's initialize .... */
|
110 |
+
$this->init();
|
111 |
+
}
|
112 |
+
}
|
113 |
+
add_action( 'installer_themes_support_set_up',array( $this,'installer_theme_loaded_hooks'));
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
/** Init */
|
118 |
+
public function init() {
|
119 |
+
add_action( 'admin_enqueue_scripts', array($this,'installer_theme_enqueue_scripts'));
|
120 |
+
add_filter( 'themes_api', array($this,'installer_theme_api_override'),10,3);
|
121 |
+
add_filter( 'themes_api_result', array($this,'installer_theme_api_override_response'), 10,3);
|
122 |
+
add_filter( 'site_transient_update_themes',array($this,'installer_theme_upgrade_check'), 10,1);
|
123 |
+
add_action( 'http_api_debug', array($this,'installer_theme_sync_native_wp_api'), 10,5 );
|
124 |
+
add_filter( 'installer_theme_hook_response_theme', array($this,'installer_theme_add_num_ratings'), 10,1);
|
125 |
+
add_filter( 'themes_update_check_locales', array($this,'installer_theme_sync_call_wp_theme_api'), 10,1);
|
126 |
+
add_filter( 'admin_url', array($this,'installer_theme_add_query_arg_tab'), 10,3);
|
127 |
+
add_filter( 'network_admin_url', array($this,'installer_theme_add_query_arg_tab'), 10,2);
|
128 |
+
add_action( 'wp_ajax_installer_theme_frontend_selected_tab', array($this,'installer_theme_frontend_selected_tab'),0);
|
129 |
+
add_action( 'wp_loaded', array($this,'installer_themes_support_set_up_func'));
|
130 |
+
}
|
131 |
+
|
132 |
+
/** Enqueue scripts */
|
133 |
+
public function installer_theme_enqueue_scripts() {
|
134 |
+
$current_screen= $this->installer_theme_current_screen();
|
135 |
+
$commercial_plugin_screen = $this->installer_theme_is_commercial_plugin_screen($current_screen);
|
136 |
+
if (('theme-install' == $current_screen) || ($commercial_plugin_screen) || ('theme-install-network' == $current_screen)) {
|
137 |
+
$repo_with_themes= $this->installer_repo_with_themes;
|
138 |
+
$js_array=array();
|
139 |
+
if (is_array($repo_with_themes)) {
|
140 |
+
foreach ($repo_with_themes as $k=>$v) {
|
141 |
+
|
142 |
+
//Hyperlink text
|
143 |
+
$theme_repo_name=$this->installer_theme_get_repo_product_name($v);
|
144 |
+
$the_hyperlink_text= esc_js($theme_repo_name);
|
145 |
+
|
146 |
+
if (is_multisite()) {
|
147 |
+
$admin_url_passed=network_admin_url();
|
148 |
+
} else {
|
149 |
+
$admin_url_passed=admin_url();
|
150 |
+
}
|
151 |
+
|
152 |
+
//Define
|
153 |
+
$js_array[$v] = array(
|
154 |
+
'the_hyperlink_text' => $the_hyperlink_text,
|
155 |
+
'registration_status'=> $this->theme_user_registration[$v],
|
156 |
+
'is_commercial_plugin_tab' =>$commercial_plugin_screen,
|
157 |
+
'registration_url' => $admin_url_passed.'plugin-install.php?tab=commercial#installer_repo_'.$v
|
158 |
+
);
|
159 |
+
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
if (!(empty($js_array))) {
|
164 |
+
wp_enqueue_script('installer-theme-install', WP_Installer()->res_url() . '/res/js/installer_theme_install.js', array('jquery','installer-admin'), WP_Installer()->version());
|
165 |
+
$installer_ajax_url=admin_url( 'admin-ajax.php');
|
166 |
+
|
167 |
+
if (is_ssl()) {
|
168 |
+
$installer_ajax_url=str_replace('http://', 'https://', $installer_ajax_url);
|
169 |
+
} else {
|
170 |
+
$installer_ajax_url=str_replace('https://', 'http://', $installer_ajax_url);
|
171 |
+
}
|
172 |
+
|
173 |
+
//Case where user is subscribed to a subscription that does not have themes
|
174 |
+
$subscription_js_check=$this->installer_theme_subscription_does_not_have_theme($js_array);
|
175 |
+
|
176 |
+
wp_localize_script('installer-theme-install', 'installer_theme_install_localize',
|
177 |
+
array(
|
178 |
+
'js_array_installer' => $js_array,
|
179 |
+
'ajaxurl' => $installer_ajax_url,
|
180 |
+
'no_associated_themes' => $subscription_js_check,
|
181 |
+
'installer_theme_frontend_selected_tab_nonce'=> wp_create_nonce('installer_theme_frontend_selected_tab')
|
182 |
+
)
|
183 |
+
);
|
184 |
+
}
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
/** Case where user is subscribed to a subscription that does not have themes */
|
189 |
+
protected function installer_theme_subscription_does_not_have_theme($js_array) {
|
190 |
+
|
191 |
+
$any_subscription_has_theme=array();
|
192 |
+
$number_of_registrations=array();
|
193 |
+
|
194 |
+
//Step1, we looped through JS array
|
195 |
+
foreach ($js_array as $repo_slug => $js_details) {
|
196 |
+
|
197 |
+
//Step2, checked if user is registered
|
198 |
+
if (isset($this->theme_user_registration[$repo_slug])) {
|
199 |
+
$registration_status=$this->theme_user_registration[$repo_slug];
|
200 |
+
if ($registration_status) {
|
201 |
+
|
202 |
+
//Registered
|
203 |
+
$number_of_registrations[]=$repo_slug;
|
204 |
+
|
205 |
+
//Step3, we checked if the $repo_slug has available theme
|
206 |
+
$themes_available=false;
|
207 |
+
if (isset($this->installer_themes[$repo_slug])) {
|
208 |
+
$themes_available = $this->installer_themes[$repo_slug];
|
209 |
+
if (!(empty($themes_available))) {
|
210 |
+
//This subscription has theme
|
211 |
+
$themes_available= true;
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
if ($themes_available) {
|
216 |
+
$any_subscription_has_theme[]=$repo_slug;
|
217 |
+
}
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
}
|
222 |
+
|
223 |
+
//Step4, we are done looping, check if there are any repos that have themes
|
224 |
+
if (empty($registration_status)) {
|
225 |
+
|
226 |
+
//No registration on any repos
|
227 |
+
return FALSE;
|
228 |
+
|
229 |
+
} elseif (!(empty($registration_status))) {
|
230 |
+
|
231 |
+
//Has some registration on some repos
|
232 |
+
//We then checked if this user has any active subscriptions
|
233 |
+
if (empty($any_subscription_has_theme)) {
|
234 |
+
//No subscription
|
235 |
+
return TRUE;
|
236 |
+
} else {
|
237 |
+
//Has subscription found
|
238 |
+
return FALSE;
|
239 |
+
}
|
240 |
+
}
|
241 |
+
}
|
242 |
+
|
243 |
+
/** Check if its the commercial plugin screen */
|
244 |
+
private function installer_theme_is_commercial_plugin_screen($current_screen) {
|
245 |
+
$commercial=false;
|
246 |
+
if (('plugin-install' == $current_screen) || ('plugin-install-network' == $current_screen)) {
|
247 |
+
if (isset($_GET['tab'])) {
|
248 |
+
$tab=$_GET['tab'];
|
249 |
+
if ('commercial' == $tab) {
|
250 |
+
$commercial= true;
|
251 |
+
}
|
252 |
+
}
|
253 |
+
}
|
254 |
+
return $commercial;
|
255 |
+
}
|
256 |
+
|
257 |
+
/** Current screen */
|
258 |
+
private function installer_theme_current_screen() {
|
259 |
+
|
260 |
+
$current_screen_loaded=false;
|
261 |
+
|
262 |
+
if (function_exists('get_current_screen')) {
|
263 |
+
|
264 |
+
$screen_output= get_current_screen();
|
265 |
+
$current_screen_loaded=$screen_output->id;
|
266 |
+
|
267 |
+
}
|
268 |
+
|
269 |
+
return $current_screen_loaded;
|
270 |
+
|
271 |
+
}
|
272 |
+
|
273 |
+
/** Override WordPress Themes API */
|
274 |
+
public function installer_theme_api_override($api_boolean, $action, $args) {
|
275 |
+
|
276 |
+
//Let's checked if user is browsing our themes
|
277 |
+
if (isset($args->browse)) {
|
278 |
+
$browse=$args->browse;
|
279 |
+
if (in_array($browse,$this->theme_repo)) {
|
280 |
+
//Uniquely validated for our Themes
|
281 |
+
if ('query_themes' == $action) {
|
282 |
+
//User is querying or asking information about our themes, let's override
|
283 |
+
$api_boolean=true;
|
284 |
+
}
|
285 |
+
}
|
286 |
+
} elseif (isset($args->slug)) {
|
287 |
+
//We are installing our themes
|
288 |
+
$theme_to_install = $args->slug;
|
289 |
+
|
290 |
+
//Lets uniquely validate if this belongs to us
|
291 |
+
//Check if this is OTGS theme
|
292 |
+
$validate_check=$this->installer_themes_belong_to_us($theme_to_install);
|
293 |
+
if ($validate_check) {
|
294 |
+
//Belongs to us
|
295 |
+
if (!(empty($theme_to_install))) {
|
296 |
+
$api_boolean=true;
|
297 |
+
}
|
298 |
+
}
|
299 |
+
}
|
300 |
+
|
301 |
+
return $api_boolean;
|
302 |
+
}
|
303 |
+
|
304 |
+
/** Override WordPress Themes API response with our own themes API*/
|
305 |
+
public function installer_theme_api_override_response($res, $action, $args) {
|
306 |
+
|
307 |
+
if (true === $res) {
|
308 |
+
if (isset($args->browse)) {
|
309 |
+
$browse=$args->browse;
|
310 |
+
if (in_array($browse,$this->theme_repo)) {
|
311 |
+
//Uniquely validated for our themes
|
312 |
+
if ('query_themes' == $action) {
|
313 |
+
//Client querying OTGS themes
|
314 |
+
//Check for registration status
|
315 |
+
if (isset($this->theme_user_registration[$browse])) {
|
316 |
+
//Set
|
317 |
+
if (!($this->theme_user_registration[$browse])) {
|
318 |
+
//Not registered yet
|
319 |
+
$res= new stdClass();
|
320 |
+
$res->info=array();
|
321 |
+
$res->themes=array();
|
322 |
+
return $res;
|
323 |
+
} else {
|
324 |
+
//Registered
|
325 |
+
$themes=$this->installer_theme_get_themes();
|
326 |
+
$res =$this->installer_theme_format_response($themes,$action);
|
327 |
+
}
|
328 |
+
}
|
329 |
+
}
|
330 |
+
}
|
331 |
+
} elseif (isset($args->slug)) {
|
332 |
+
//We are installing theme
|
333 |
+
//Lets uniquely validate if this belongs to our theme
|
334 |
+
$theme_to_install=$args->slug;
|
335 |
+
|
336 |
+
//Lets uniquely validate if this belongs to us
|
337 |
+
//Check if this is OTGS theme
|
338 |
+
$validate_check=$this->installer_themes_belong_to_us($theme_to_install);
|
339 |
+
if ($validate_check) {
|
340 |
+
//Belongs to us
|
341 |
+
if (($res) && ('theme_information' == $action)) {
|
342 |
+
$themes=$this->installer_theme_get_themes();
|
343 |
+
$res =$this->installer_theme_format_response($themes,$action,$args->slug);
|
344 |
+
}
|
345 |
+
}
|
346 |
+
}
|
347 |
+
return $res;
|
348 |
+
} else {
|
349 |
+
//Default WP Themes here
|
350 |
+
$client_side_active_tab=get_option('wp_installer_clientside_active_tab');
|
351 |
+
if ($client_side_active_tab) {
|
352 |
+
if (!(in_array($client_side_active_tab,$this->theme_repo))) {
|
353 |
+
//Not OTGS tab
|
354 |
+
return $res;
|
355 |
+
}
|
356 |
+
}
|
357 |
+
|
358 |
+
}
|
359 |
+
}
|
360 |
+
/** Get Themes */
|
361 |
+
private function installer_theme_get_themes($product_url='') {
|
362 |
+
|
363 |
+
//Query API
|
364 |
+
if (empty($product_url)) {
|
365 |
+
//Not set
|
366 |
+
if (isset($this->repository_theme_products[$this->installer_theme_active_tab])) {
|
367 |
+
$query_remote_url=$this->repository_theme_products[$this->installer_theme_active_tab];
|
368 |
+
}
|
369 |
+
|
370 |
+
} else {
|
371 |
+
$query_remote_url=$product_url;
|
372 |
+
}
|
373 |
+
|
374 |
+
$response = wp_remote_get($query_remote_url);
|
375 |
+
|
376 |
+
//Set $themes to FALSE by default
|
377 |
+
|
378 |
+
$themes=false;
|
379 |
+
|
380 |
+
if (is_wp_error($response)){
|
381 |
+
//Error detected: http fallback
|
382 |
+
$query_remote_url = preg_replace("@^https://@", 'http://', $query_remote_url);
|
383 |
+
$response = wp_remote_get($query_remote_url);
|
384 |
+
}
|
385 |
+
|
386 |
+
if (!(is_wp_error($response))) {
|
387 |
+
//Not WP error
|
388 |
+
//Evaluate response
|
389 |
+
if($response && isset($response['response']['code']) && $response['response']['code'] == 200){
|
390 |
+
//In this case, response is set and defined, proceed...
|
391 |
+
$body = wp_remote_retrieve_body($response);
|
392 |
+
if($body){
|
393 |
+
$products = json_decode($body, true);
|
394 |
+
if (isset($products['downloads']['themes'])) {
|
395 |
+
$themes=$products['downloads']['themes'];
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
}
|
400 |
+
}
|
401 |
+
|
402 |
+
//Return themes, can be filtered by user subscription type
|
403 |
+
return apply_filters('installer_theme_get_themes',$themes,$this->installer_theme_active_tab);
|
404 |
+
}
|
405 |
+
|
406 |
+
/** Format response in compatibility with WordPress Theme API response */
|
407 |
+
private function installer_theme_format_response($themes,$action,$slug='') {
|
408 |
+
|
409 |
+
//Let's append download link only when retrieving theme information for installation
|
410 |
+
if (('theme_information' == $action) && (!(empty($slug)))) {
|
411 |
+
|
412 |
+
//Only return one result -> the theme to be installed
|
413 |
+
foreach ($themes as $k=>$theme) {
|
414 |
+
if ($slug == $theme['basename']) {
|
415 |
+
$theme['download_link'] = WP_Installer()->append_site_key_to_download_url($theme['url'],$this->installer_site_key[$this->installer_theme_active_tab],$this->installer_theme_active_tab);
|
416 |
+
$theme = json_decode(json_encode($theme), FALSE);
|
417 |
+
return $theme;
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
} else {
|
422 |
+
|
423 |
+
$res= new stdClass();
|
424 |
+
$res->info=array();
|
425 |
+
$res->themes=array();
|
426 |
+
|
427 |
+
//Define info
|
428 |
+
$res->info['page'] =1;
|
429 |
+
$res->info['pages'] =10;
|
430 |
+
|
431 |
+
//Let's count available themes ;
|
432 |
+
$res->info['results'] =count($themes);
|
433 |
+
|
434 |
+
//Let's saved themes for easy access later on
|
435 |
+
$this->installer_theme_savethemes_by_slug($themes);
|
436 |
+
|
437 |
+
//Let's defined available themes
|
438 |
+
if (isset($this->installer_theme_subscription_type)) {
|
439 |
+
//Has subscription type defined, let's saved what is associated with this subscription
|
440 |
+
$this->installer_theme_available($this->installer_theme_active_tab,$this->installer_theme_subscription_type);
|
441 |
+
} else {
|
442 |
+
$this->installer_theme_available($this->installer_theme_active_tab);
|
443 |
+
}
|
444 |
+
|
445 |
+
//Let's add themes to the overriden WordPress API Theme response
|
446 |
+
$res->themes = json_decode(json_encode($themes), FALSE);
|
447 |
+
$res->themes = apply_filters('installer_theme_hook_response_theme',$res->themes);
|
448 |
+
return $res;
|
449 |
+
}
|
450 |
+
}
|
451 |
+
|
452 |
+
/** Let's save all available themes by its slug after any latest API query */
|
453 |
+
private function installer_theme_savethemes_by_slug($themes,$doing_query=false) {
|
454 |
+
|
455 |
+
if (!($doing_query)) {
|
456 |
+
$this->installer_themes[$this->installer_theme_active_tab]=array();
|
457 |
+
}
|
458 |
+
|
459 |
+
if (!(empty($themes))) {
|
460 |
+
$themes_for_saving=array();
|
461 |
+
foreach ($themes as $k=>$theme) {
|
462 |
+
if (!($doing_query)) {
|
463 |
+
if (isset($theme['slug'])) {
|
464 |
+
$theme_slug=$theme['slug'];
|
465 |
+
if (!(empty($theme_slug))) {
|
466 |
+
$themes_for_saving[]=$theme_slug;
|
467 |
+
}
|
468 |
+
}
|
469 |
+
} else {
|
470 |
+
|
471 |
+
if (((isset($theme['slug'])) && (isset($theme['version'])) &&
|
472 |
+
(isset($theme['theme_page_url']))) && (isset($theme['url']))) {
|
473 |
+
$theme_slug=$theme['slug'];
|
474 |
+
$theme_version=$theme['version'];
|
475 |
+
$theme_page_url=$theme['theme_page_url'];
|
476 |
+
$theme_url=$theme['url'];
|
477 |
+
if ((!(empty($theme_slug))) && (!(empty($theme_version))) &&
|
478 |
+
(!(empty($theme_page_url))) && (!(empty($theme_url)))) {
|
479 |
+
//$theme_slug is unique for every theme
|
480 |
+
$themes_for_saving[$theme_slug]=array(
|
481 |
+
'version'=>$theme_version,
|
482 |
+
'theme_page_url'=>$theme_page_url,
|
483 |
+
'url' =>$theme_url
|
484 |
+
);
|
485 |
+
|
486 |
+
}
|
487 |
+
}
|
488 |
+
}
|
489 |
+
|
490 |
+
}
|
491 |
+
|
492 |
+
if (!(empty($themes_for_saving))) {
|
493 |
+
//Has themes for saving
|
494 |
+
if (!($doing_query)) {
|
495 |
+
//Not doing query
|
496 |
+
$existing_themes= get_option($this->installer_themes_option[$this->installer_theme_active_tab]);
|
497 |
+
if (!($existing_themes)) {
|
498 |
+
//Does not yet exists
|
499 |
+
delete_option($this->installer_themes_option[$this->installer_theme_active_tab]);
|
500 |
+
update_option($this->installer_themes_option[$this->installer_theme_active_tab],$themes_for_saving);
|
501 |
+
} else {
|
502 |
+
//exists, check if we need to update
|
503 |
+
if ($existing_themes == $themes_for_saving) {
|
504 |
+
//Equal, no need to update here
|
505 |
+
} else {
|
506 |
+
//Update
|
507 |
+
delete_option($this->installer_themes_option[$this->installer_theme_active_tab]);
|
508 |
+
update_option($this->installer_themes_option[$this->installer_theme_active_tab],$themes_for_saving);
|
509 |
+
}
|
510 |
+
}
|
511 |
+
} else {
|
512 |
+
//Used for query purposes only, don't save anything
|
513 |
+
return $themes_for_saving;
|
514 |
+
}
|
515 |
+
}
|
516 |
+
}
|
517 |
+
}
|
518 |
+
/** Available themes */
|
519 |
+
private function installer_theme_available($repo,$subscription_type='') {
|
520 |
+
|
521 |
+
$subscription_type=intval($subscription_type);
|
522 |
+
if ($subscription_type > 0) {
|
523 |
+
|
524 |
+
//Here we have a case of validated subscription
|
525 |
+
//We need to set themes that is available to this subscription
|
526 |
+
$themes_associated_with_subscription= $this->installer_themes[$repo]= $this->installer_theme_get_themes_by_subscription($subscription_type,$repo);
|
527 |
+
if (!(empty($themes_associated_with_subscription))) {
|
528 |
+
//Has themes
|
529 |
+
$this->installer_themes[$repo]=$themes_associated_with_subscription;
|
530 |
+
}
|
531 |
+
} else {
|
532 |
+
|
533 |
+
//Get themes
|
534 |
+
$this->installer_themes[$repo]=get_option($this->installer_themes_option[$repo]);
|
535 |
+
}
|
536 |
+
}
|
537 |
+
|
538 |
+
/** Theme upgrade check */
|
539 |
+
public function installer_theme_upgrade_check($the_value) {
|
540 |
+
|
541 |
+
//Step1: Let's looped through repos with themes and check if we have updates available for them.
|
542 |
+
if ((is_array($this->installer_repo_with_themes)) && (!(empty($this->installer_repo_with_themes)))) {
|
543 |
+
foreach ( $this->installer_repo_with_themes as $k => $repo_slug ) {
|
544 |
+
//Step2: Let's checked if we have update for this theme
|
545 |
+
$update_available=get_option($this->installer_themes_available_updates[$repo_slug]);
|
546 |
+
if ($update_available) {
|
547 |
+
if ((is_array($update_available)) && (!(empty($update_available)))) {
|
548 |
+
//Has updates available coming from this specific theme repo
|
549 |
+
//Let's loop through the themes that needs update
|
550 |
+
foreach ($update_available as $theme_slug => $v) {
|
551 |
+
//Add to response API
|
552 |
+
$the_value->response [$theme_slug] = array (
|
553 |
+
'theme' => $theme_slug,
|
554 |
+
'new_version' => $v['new_version'],
|
555 |
+
'url' => $v['url'],
|
556 |
+
'package' => $v['package']
|
557 |
+
);
|
558 |
+
}
|
559 |
+
}
|
560 |
+
}
|
561 |
+
}
|
562 |
+
}
|
563 |
+
//Return
|
564 |
+
return $the_value;
|
565 |
+
}
|
566 |
+
/** Return repositories that has themes */
|
567 |
+
private function installer_theme_reposities_that_has_themes($repositories,$ret_value=true,$doing_api_query=false) {
|
568 |
+
|
569 |
+
$repositories_with_themes=array();
|
570 |
+
|
571 |
+
if ((is_array($repositories)) && (!(empty($repositories)))) {
|
572 |
+
|
573 |
+
//Let's checked if we have something before
|
574 |
+
$themes= get_option('installer_repositories_with_theme');
|
575 |
+
|
576 |
+
if ((!($themes)) || ($doing_api_query)) {
|
577 |
+
//Not yet defined
|
578 |
+
//Loop through each repositories and check whether they have themes
|
579 |
+
foreach ($repositories as $k=>$v) {
|
580 |
+
if (isset($v['products'])) {
|
581 |
+
$products_url=$v['products'];
|
582 |
+
$themes= $this->installer_theme_get_themes($products_url);
|
583 |
+
if ((is_array($themes)) && (!(empty($themes)))) {
|
584 |
+
//Repo has themes
|
585 |
+
$repositories_with_themes[]=$k;
|
586 |
+
}
|
587 |
+
}
|
588 |
+
}
|
589 |
+
} else {
|
590 |
+
//Already set
|
591 |
+
$repositories_with_themes= $themes;
|
592 |
+
}
|
593 |
+
|
594 |
+
if ((((is_array($repositories_with_themes)) && (!(empty($repositories_with_themes)))) && (!($themes))) || ($doing_api_query)) {
|
595 |
+
//Save to db
|
596 |
+
update_option('installer_repositories_with_theme',$repositories_with_themes);
|
597 |
+
}
|
598 |
+
}
|
599 |
+
|
600 |
+
if ($ret_value) {
|
601 |
+
return $repositories_with_themes;
|
602 |
+
}
|
603 |
+
|
604 |
+
}
|
605 |
+
|
606 |
+
/** When WordPress queries its own Themes API, we sync with our own */
|
607 |
+
public function installer_theme_sync_native_wp_api($response, $responsetext, $class, $args, $url) {
|
608 |
+
|
609 |
+
$api_native_string='api.wordpress.org/themes/';
|
610 |
+
if ((strpos($url, $api_native_string) !== false)) {
|
611 |
+
//WordPress is querying its own themes API
|
612 |
+
$installer_repositories=WP_Installer()->get_repositories();
|
613 |
+
|
614 |
+
//Query our own API and update repository values too
|
615 |
+
$this->installer_theme_reposities_that_has_themes($installer_repositories,false,true);
|
616 |
+
}
|
617 |
+
}
|
618 |
+
|
619 |
+
/** Returns product name by theme repo slug */
|
620 |
+
private function installer_theme_get_repo_product_name($theme_repo) {
|
621 |
+
|
622 |
+
$theme_repo_name=false;
|
623 |
+
|
624 |
+
if (isset(WP_Installer()->settings['repositories'][$theme_repo]['data']['product-name'])) {
|
625 |
+
//Set
|
626 |
+
$prod_name=WP_Installer()->settings['repositories'][$theme_repo]['data']['product-name'];
|
627 |
+
if (!(empty($prod_name))) {
|
628 |
+
$theme_repo_name=$prod_name;
|
629 |
+
}
|
630 |
+
} else {
|
631 |
+
//Not yet
|
632 |
+
if ($theme_repo == $this->theme_repo) {
|
633 |
+
$result= $this->installer_theme_general_api_query();
|
634 |
+
if (isset($result['product-name'])) {
|
635 |
+
$product_name=$result['product-name'];
|
636 |
+
if (!(empty($product_name))) {
|
637 |
+
$theme_repo_name= $product_name;
|
638 |
+
}
|
639 |
+
}
|
640 |
+
}
|
641 |
+
}
|
642 |
+
|
643 |
+
return $theme_repo_name;
|
644 |
+
}
|
645 |
+
|
646 |
+
/** General query API method, returns $products */
|
647 |
+
private function installer_theme_general_api_query() {
|
648 |
+
$products= false;
|
649 |
+
$response = wp_remote_get($this->repository_theme_products);
|
650 |
+
if (!(is_wp_error($response))) {
|
651 |
+
//Not WP error
|
652 |
+
//Evaluate response
|
653 |
+
if($response && isset($response['response']['code']) && $response['response']['code'] == 200){
|
654 |
+
//In this case, response is set and defined, proceed...
|
655 |
+
$body = wp_remote_retrieve_body($response);
|
656 |
+
if($body){
|
657 |
+
$result = json_decode($body, true);
|
658 |
+
if ((is_array($result)) && (!(empty($result)))) {
|
659 |
+
$products=$result;
|
660 |
+
}
|
661 |
+
}
|
662 |
+
|
663 |
+
}
|
664 |
+
}
|
665 |
+
|
666 |
+
return $products;
|
667 |
+
}
|
668 |
+
|
669 |
+
/** General method to check if themes are OTGS themes based on its slug*/
|
670 |
+
private function installer_themes_belong_to_us($theme_slug) {
|
671 |
+
|
672 |
+
$found=false;
|
673 |
+
$theme_slug=trim($theme_slug);
|
674 |
+
|
675 |
+
foreach ($this->installer_themes as $repo_with_theme => $themes) {
|
676 |
+
foreach ($themes as $k=>$otgs_theme_slug) {
|
677 |
+
if ($theme_slug == $otgs_theme_slug) {
|
678 |
+
//match found! Theme belongs to otgs
|
679 |
+
return true;
|
680 |
+
}
|
681 |
+
}
|
682 |
+
}
|
683 |
+
return $found;
|
684 |
+
|
685 |
+
}
|
686 |
+
|
687 |
+
/** Sets active tab on init */
|
688 |
+
public function installer_theme_sets_active_tab_on_init() {
|
689 |
+
|
690 |
+
if (isset ( $_SERVER ['REQUEST_URI'] )) {
|
691 |
+
$request_uri = $_SERVER ['REQUEST_URI'];
|
692 |
+
if (isset ( $_GET ['browse'] )) {
|
693 |
+
$active_tab = trim ( $_GET ['browse'] );
|
694 |
+
$this->installer_theme_active_tab = $active_tab;
|
695 |
+
} elseif (isset ( $_POST ['request'] ['browse'] )) {
|
696 |
+
$active_tab = trim ( $_POST ['request'] ['browse'] );
|
697 |
+
$this->installer_theme_active_tab = $active_tab;
|
698 |
+
} elseif ((isset ( $_GET ['theme_repo'] )) && (isset ( $_GET ['action'] ))) {
|
699 |
+
$theme_repo=trim($_GET ['theme_repo']);
|
700 |
+
$the_action=trim($_GET ['action']);
|
701 |
+
if (('install-theme' == $the_action) && (!(empty($theme_repo)))) {
|
702 |
+
$this->installer_theme_active_tab=$theme_repo;
|
703 |
+
}
|
704 |
+
} elseif (wp_get_referer ()) {
|
705 |
+
$referer = wp_get_referer ();
|
706 |
+
$parts= parse_url($referer);
|
707 |
+
if (isset($parts['query'])) {
|
708 |
+
parse_str($parts['query'], $query);
|
709 |
+
if (isset($query['browse'])) {
|
710 |
+
$this->installer_theme_active_tab=$query['browse'];
|
711 |
+
}
|
712 |
+
}
|
713 |
+
}
|
714 |
+
}
|
715 |
+
}
|
716 |
+
|
717 |
+
/** WP Theme API compatibility- added num ratings */
|
718 |
+
public function installer_theme_add_num_ratings($themes) {
|
719 |
+
|
720 |
+
if ((is_array($themes)) && (!(empty($themes)))) {
|
721 |
+
foreach ($themes as $k=>$v) {
|
722 |
+
if (!(isset($v->num_ratings))) {
|
723 |
+
$themes[$k]->num_ratings=0;
|
724 |
+
}
|
725 |
+
}
|
726 |
+
}
|
727 |
+
|
728 |
+
return $themes;
|
729 |
+
}
|
730 |
+
|
731 |
+
/** When WordPress.org makes a call to its repository, let's run our own upgrade checks too */
|
732 |
+
public function installer_theme_sync_call_wp_theme_api($locales) {
|
733 |
+
|
734 |
+
$this->installer_theme_upgrade_theme_check();
|
735 |
+
|
736 |
+
return $locales;
|
737 |
+
}
|
738 |
+
|
739 |
+
/** Upgrade theme check */
|
740 |
+
private function installer_theme_upgrade_theme_check() {
|
741 |
+
|
742 |
+
// Step1-> we get all installed themes in clients local themes directory
|
743 |
+
$installed_themes = wp_get_themes ();
|
744 |
+
|
745 |
+
// Step2: We need to loop through each repository with themes
|
746 |
+
foreach ( $this->installer_repo_with_themes as $k => $repo_slug ) {
|
747 |
+
|
748 |
+
// We then need to retrieved the products URL for each of this repo
|
749 |
+
$products_url = $this->repository_theme_products [$repo_slug];
|
750 |
+
|
751 |
+
// Step3-> we get all available themes in our repository via API based on this URL
|
752 |
+
$available_themes = $this->installer_theme_get_themes ( $products_url );
|
753 |
+
|
754 |
+
if (! ($available_themes)) {
|
755 |
+
|
756 |
+
// API is not available as of the moment, return..
|
757 |
+
return;
|
758 |
+
} else {
|
759 |
+
|
760 |
+
// We have available themes here...
|
761 |
+
// Step4->let's simplify available themes data by slugs
|
762 |
+
$simplified_available_themes = $this->installer_theme_savethemes_by_slug ( $available_themes, true );
|
763 |
+
|
764 |
+
// Step5->Let's loop through installed themes
|
765 |
+
if ((is_array ( $installed_themes )) && (! (empty ( $installed_themes )))) {
|
766 |
+
$otgs_theme_updates_available=array();
|
767 |
+
foreach ( $installed_themes as $theme_slug => $theme_object ) {
|
768 |
+
if (array_key_exists ( $theme_slug, $simplified_available_themes )) {
|
769 |
+
|
770 |
+
// This is our theme
|
771 |
+
// Step6->Let's get version of the local theme installed
|
772 |
+
$local_version = $theme_object->get ( 'Version' );
|
773 |
+
|
774 |
+
// Step7->Let's get the latest version of this theme, page URL and download URL from our repository
|
775 |
+
$repository_version = $simplified_available_themes [$theme_slug] ['version'];
|
776 |
+
$theme_page_url = $simplified_available_themes [$theme_slug] ['theme_page_url'];
|
777 |
+
$theme_download_url = $simplified_available_themes [$theme_slug] ['url'];
|
778 |
+
|
779 |
+
// Step8->Let's compare the version
|
780 |
+
if (version_compare ( $repository_version, $local_version, '>' )) {
|
781 |
+
|
782 |
+
// Update available for this theme
|
783 |
+
// Step9-> Define download URL with site key
|
784 |
+
$package_url = WP_Installer ()->append_site_key_to_download_url ( $theme_download_url, $this->installer_site_key [$repo_slug], $repo_slug );
|
785 |
+
|
786 |
+
//Step10-> Assign to updates array for later accessing.
|
787 |
+
$otgs_theme_updates_available[$theme_slug] = array (
|
788 |
+
'theme' => $theme_slug,
|
789 |
+
'new_version' => $repository_version,
|
790 |
+
'url' => $theme_page_url,
|
791 |
+
'package' => $package_url
|
792 |
+
);
|
793 |
+
}
|
794 |
+
}
|
795 |
+
}
|
796 |
+
//Exited the upgrade loop for this specific theme repository
|
797 |
+
if (!(empty($otgs_theme_updates_available))) {
|
798 |
+
//Has updates
|
799 |
+
update_option($this->installer_themes_available_updates[$repo_slug],$otgs_theme_updates_available);
|
800 |
+
} else {
|
801 |
+
//No updates
|
802 |
+
delete_option($this->installer_themes_available_updates[$repo_slug]);
|
803 |
+
}
|
804 |
+
|
805 |
+
}
|
806 |
+
}
|
807 |
+
}
|
808 |
+
}
|
809 |
+
|
810 |
+
/** When the user is on Themes install page OTG themes repository, let's the currently selected tab */
|
811 |
+
public function installer_theme_add_query_arg_tab($url, $path, $blog_id=null) {
|
812 |
+
|
813 |
+
$wp_install_string='update.php?action=install-theme';
|
814 |
+
if ($path == $wp_install_string) {
|
815 |
+
if (isset($this->installer_theme_active_tab)) {
|
816 |
+
if (!(empty($this->installer_theme_active_tab))) {
|
817 |
+
$url = add_query_arg( array(
|
818 |
+
'theme_repo' => $this->installer_theme_active_tab
|
819 |
+
), $url );
|
820 |
+
}
|
821 |
+
}
|
822 |
+
}
|
823 |
+
return $url;
|
824 |
+
}
|
825 |
+
|
826 |
+
/** Save frontend theme tab selected */
|
827 |
+
public function installer_theme_frontend_selected_tab() {
|
828 |
+
if ( isset( $_POST["frontend_tab_selected"] ) ) {
|
829 |
+
check_ajax_referer('installer_theme_frontend_selected_tab', 'installer_theme_frontend_selected_tab_nonce');
|
830 |
+
|
831 |
+
//Client_side_active_tab
|
832 |
+
$frontend_tab_selected=$_POST["frontend_tab_selected"];
|
833 |
+
if (!(empty($frontend_tab_selected))) {
|
834 |
+
//Front end tab selected
|
835 |
+
update_option('wp_installer_clientside_active_tab',$frontend_tab_selected,false);
|
836 |
+
|
837 |
+
//Check for registration status
|
838 |
+
if (isset($this->theme_user_registration[$frontend_tab_selected])) {
|
839 |
+
//Set
|
840 |
+
if (!($this->theme_user_registration[$frontend_tab_selected])) {
|
841 |
+
//Not registered yet
|
842 |
+
|
843 |
+
if (is_multisite()) {
|
844 |
+
$admin_url_passed=network_admin_url();
|
845 |
+
} else {
|
846 |
+
$admin_url_passed=admin_url();
|
847 |
+
}
|
848 |
+
|
849 |
+
$registration_url= $admin_url_passed.'plugin-install.php?tab=commercial#installer_repo_'.$frontend_tab_selected;
|
850 |
+
|
851 |
+
//Message and link
|
852 |
+
$theme_repo_name=$this->installer_theme_get_repo_product_name($frontend_tab_selected); ;
|
853 |
+
$response['unregistered_messages']= __('To install and update','installer').' '.$theme_repo_name.' '.__('themes','installer').','.' '.
|
854 |
+
__('please','installer').' '.'<a href="'.$registration_url.'">'.__('register','installer').' '.$theme_repo_name.'</a>'.' '.__('for this site.','installer');
|
855 |
+
|
856 |
+
}
|
857 |
+
}
|
858 |
+
|
859 |
+
$response['output']=$frontend_tab_selected;
|
860 |
+
echo json_encode($response);
|
861 |
+
}
|
862 |
+
die();
|
863 |
+
}
|
864 |
+
die();
|
865 |
+
}
|
866 |
+
|
867 |
+
/** Installer loaded aux hooks */
|
868 |
+
public function installer_theme_loaded_hooks() {
|
869 |
+
|
870 |
+
if (isset($this->installer_theme_subscription_type)) {
|
871 |
+
$subscription_type=intval($this->installer_theme_subscription_type);
|
872 |
+
if ($subscription_type > 0) {
|
873 |
+
//Client is subscribed
|
874 |
+
add_filter('installer_theme_get_themes',array($this,'installer_theme_filter_themes_by_subscription'),10,2);
|
875 |
+
}
|
876 |
+
}
|
877 |
+
|
878 |
+
}
|
879 |
+
|
880 |
+
/** Get themes by subscription type */
|
881 |
+
protected function installer_theme_get_themes_by_subscription($subscription_type,$repo) {
|
882 |
+
|
883 |
+
$themes_associated_with_subscription=array();
|
884 |
+
if (isset(WP_Installer()->settings['repositories'][$repo]['data']['packages'])) {
|
885 |
+
//Set
|
886 |
+
$packages=WP_Installer()->settings['repositories'][$repo]['data']['packages'];
|
887 |
+
$available_themes_subscription=array();
|
888 |
+
foreach ($packages as $package_id=>$package_details) {
|
889 |
+
if (isset($package_details['products'])) {
|
890 |
+
$the_products=$package_details['products'];
|
891 |
+
foreach ($the_products as $product_slug=>$product_details) {
|
892 |
+
if (isset($product_details['subscription_type'])) {
|
893 |
+
$subscription_type_from_settings=intval($product_details['subscription_type']);
|
894 |
+
if ($subscription_type_from_settings == $subscription_type) {
|
895 |
+
//We found the subscription
|
896 |
+
if (isset($product_details['themes'])) {
|
897 |
+
$themes_associated_with_subscription=$product_details['themes'];
|
898 |
+
return $themes_associated_with_subscription;
|
899 |
+
}
|
900 |
+
}
|
901 |
+
}
|
902 |
+
|
903 |
+
}
|
904 |
+
}
|
905 |
+
}
|
906 |
+
}
|
907 |
+
return $themes_associated_with_subscription;
|
908 |
+
}
|
909 |
+
|
910 |
+
/** Filter API theme response according to user subscription */
|
911 |
+
public function installer_theme_filter_themes_by_subscription($themes,$active_tab) {
|
912 |
+
|
913 |
+
//Step1, we only filter OTGS themes
|
914 |
+
$orig=count($themes);
|
915 |
+
if (in_array($active_tab,$this->theme_repo)) {
|
916 |
+
//OTGS Theme
|
917 |
+
//Step2, we retrieved the available themes based on client subscription
|
918 |
+
if (isset($this->installer_themes[$active_tab])) {
|
919 |
+
$available_themes= $this->installer_themes[$active_tab];
|
920 |
+
//Step3, we filter $themes based on this info
|
921 |
+
if ((is_array($themes)) && (!(empty($themes)))) {
|
922 |
+
foreach ($themes as $k=>$theme) {
|
923 |
+
//Step4, get theme slug
|
924 |
+
if (isset($theme['slug'])) {
|
925 |
+
$theme_slug = $theme['slug'];
|
926 |
+
if (!(empty($theme_slug))) {
|
927 |
+
if (!(in_array($theme_slug, $available_themes))) {
|
928 |
+
//This theme is not in available themes
|
929 |
+
unset($themes[$k]);
|
930 |
+
}
|
931 |
+
}
|
932 |
+
}
|
933 |
+
}
|
934 |
+
}
|
935 |
+
}
|
936 |
+
}
|
937 |
+
$new=count($themes);
|
938 |
+
if ($orig != $new) {
|
939 |
+
//It is filtered
|
940 |
+
$themes= array_values($themes);
|
941 |
+
}
|
942 |
+
|
943 |
+
return $themes;
|
944 |
+
}
|
945 |
+
|
946 |
+
/** Hook to wp_loaded, fires when all Installer theme class is ready */
|
947 |
+
public function installer_themes_support_set_up_func() {
|
948 |
+
do_action( 'installer_themes_support_set_up');
|
949 |
+
}
|
950 |
+
|
951 |
+
}
|
952 |
+
|
953 |
+
/** Instantiate Installer Theme Class */
|
954 |
+
new Installer_Theme_Class;
|
plus/installer/includes/installer-api.php
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class WP_Installer_API{
|
4 |
-
|
5 |
-
public static function get_product_installer_link($repository_id, $package_id = false){
|
6 |
-
|
7 |
-
$menu_url = WP_Installer()->menu_url();
|
8 |
-
|
9 |
-
$url = $menu_url . '#' . $repository_id;
|
10 |
-
if($package_id){
|
11 |
-
$url .= '/' . $package_id;
|
12 |
-
}
|
13 |
-
|
14 |
-
return $url;
|
15 |
-
|
16 |
-
}
|
17 |
-
|
18 |
-
public static function get_product_price($repository_id, $package_id, $product_id, $incl_discount = false){
|
19 |
-
|
20 |
-
$price = WP_Installer()->get_product_price($repository_id, $package_id, $product_id, $incl_discount);
|
21 |
-
|
22 |
-
return $price;
|
23 |
-
}
|
24 |
-
|
25 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class WP_Installer_API{
|
4 |
+
|
5 |
+
public static function get_product_installer_link($repository_id, $package_id = false){
|
6 |
+
|
7 |
+
$menu_url = WP_Installer()->menu_url();
|
8 |
+
|
9 |
+
$url = $menu_url . '#' . $repository_id;
|
10 |
+
if($package_id){
|
11 |
+
$url .= '/' . $package_id;
|
12 |
+
}
|
13 |
+
|
14 |
+
return $url;
|
15 |
+
|
16 |
+
}
|
17 |
+
|
18 |
+
public static function get_product_price($repository_id, $package_id, $product_id, $incl_discount = false){
|
19 |
+
|
20 |
+
$price = WP_Installer()->get_product_price($repository_id, $package_id, $product_id, $incl_discount);
|
21 |
+
|
22 |
+
return $price;
|
23 |
+
}
|
24 |
+
|
25 |
}
|
plus/installer/includes/installer-upgrader-skins.php
CHANGED
@@ -1,37 +1,37 @@
|
|
1 |
-
<?php
|
2 |
-
class Installer_Upgrader_Skins extends WP_Upgrader_Skin{
|
3 |
-
|
4 |
-
function __construct($args = array()){
|
5 |
-
$defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false );
|
6 |
-
$this->options = wp_parse_args($args, $defaults);
|
7 |
-
}
|
8 |
-
|
9 |
-
function header(){
|
10 |
-
|
11 |
-
}
|
12 |
-
|
13 |
-
function footer(){
|
14 |
-
|
15 |
-
}
|
16 |
-
|
17 |
-
function error($error){
|
18 |
-
$this->installer_error = $error;
|
19 |
-
}
|
20 |
-
|
21 |
-
function add_strings(){
|
22 |
-
|
23 |
-
}
|
24 |
-
|
25 |
-
function feedback($string){
|
26 |
-
|
27 |
-
}
|
28 |
-
|
29 |
-
function before(){
|
30 |
-
|
31 |
-
}
|
32 |
-
|
33 |
-
function after(){
|
34 |
-
|
35 |
-
}
|
36 |
-
|
37 |
}
|
1 |
+
<?php
|
2 |
+
class Installer_Upgrader_Skins extends WP_Upgrader_Skin{
|
3 |
+
|
4 |
+
function __construct($args = array()){
|
5 |
+
$defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false );
|
6 |
+
$this->options = wp_parse_args($args, $defaults);
|
7 |
+
}
|
8 |
+
|
9 |
+
function header(){
|
10 |
+
|
11 |
+
}
|
12 |
+
|
13 |
+
function footer(){
|
14 |
+
|
15 |
+
}
|
16 |
+
|
17 |
+
function error($error){
|
18 |
+
$this->installer_error = $error;
|
19 |
+
}
|
20 |
+
|
21 |
+
function add_strings(){
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
function feedback($string){
|
26 |
+
|
27 |
+
}
|
28 |
+
|
29 |
+
function before(){
|
30 |
+
|
31 |
+
}
|
32 |
+
|
33 |
+
function after(){
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
}
|
plus/installer/includes/installer.class.php
CHANGED
@@ -1,2244 +1,2358 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
final class WP_Installer{
|
4 |
-
protected static $_instance = null;
|
5 |
-
|
6 |
-
private $repositories = array();
|
7 |
-
|
8 |
-
protected $api_debug = '';
|
9 |
-
|
10 |
-
private $config = array();
|
11 |
-
|
12 |
-
protected $_plugins_renew_warnings = array();
|
13 |
-
|
14 |
-
protected $_gz_on = false;
|
15 |
-
|
16 |
-
private $admin_messages = array();
|
17 |
-
|
18 |
-
private $_using_icl = false;
|
19 |
-
private $_wpml_version = false;
|
20 |
-
|
21 |
-
public static function instance() {
|
22 |
-
|
23 |
-
if ( is_null( self::$_instance ) ) {
|
24 |
-
self::$_instance = new self();
|
25 |
-
}
|
26 |
-
|
27 |
-
return self::$_instance;
|
28 |
-
}
|
29 |
-
|
30 |
-
public function __construct(){
|
31 |
-
|
32 |
-
if(!is_admin() || !is_user_logged_in()) return; //Only for admin
|
33 |
-
|
34 |
-
$this->_gz_on = function_exists('gzuncompress') && function_exists('gzcompress');
|
35 |
-
$this->settings = $this->get_settings();
|
36 |
-
|
37 |
-
add_action('admin_notices', array($this, 'show_site_key_nags'));
|
38 |
-
|
39 |
-
add_action('admin_notices', array($this, 'show_admin_messages'));
|
40 |
-
|
41 |
-
add_action('admin_init', array($this, 'load_embedded_plugins'), 0);
|
42 |
-
|
43 |
-
add_action('admin_menu', array($this, 'menu_setup'));
|
44 |
-
add_action('network_admin_menu', array($this, 'menu_setup'));
|
45 |
-
|
46 |
-
if(defined('DOING_AJAX') && isset($_POST['action']) && $_POST['action'] == 'installer_download_plugin'){
|
47 |
-
add_filter( 'site_transient_update_plugins', array( $this, 'plugins_upgrade_check') );
|
48 |
-
}
|
49 |
-
add_filter('plugins_api', array( $this, 'custom_plugins_api_call'), 10, 3);
|
50 |
-
add_filter('pre_set_site_transient_update_plugins', array( $this, 'plugins_upgrade_check'));
|
51 |
-
|
52 |
-
// register repositories
|
53 |
-
$this->load_repositories_list();
|
54 |
-
|
55 |
-
if(empty($this->settings['last_repositories_update']) || time() - $this->settings['last_repositories_update'] > 86400){
|
56 |
-
$this->refresh_repositories_data();
|
57 |
-
}
|
58 |
-
|
59 |
-
// Hook to wp_update_plugins before the WP API request
|
60 |
-
// Using this in place of a missing hook in wp_update_plugins
|
61 |
-
// This is being triggered every time WP checks for plugin updates
|
62 |
-
add_filter('plugins_update_check_locales', array($this, 'update_plugins_information'));
|
63 |
-
|
64 |
-
// default config
|
65 |
-
$this->config['plugins_install_tab'] = false;
|
66 |
-
|
67 |
-
add_action('init', array($this, 'init'));
|
68 |
-
|
69 |
-
//add_filter('wp_installer_buy_url', array($this, 'append_parameters_to_buy_url'));
|
70 |
-
|
71 |
-
add_action('init', array($this,'load_locale'));
|
72 |
-
|
73 |
-
}
|
74 |
-
|
75 |
-
public function
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
}
|
80 |
-
|
81 |
-
public function
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
$
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
add_action('
|
110 |
-
add_action('
|
111 |
-
|
112 |
-
|
113 |
-
add_action('
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
if(
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
}
|
153 |
-
|
154 |
-
public function
|
155 |
-
$
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
if(is_multisite()){
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
$_settings =
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
$
|
358 |
-
|
359 |
-
|
360 |
-
}
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
$
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
$
|
459 |
-
$
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
$
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
}
|
607 |
-
|
608 |
-
}
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
$
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
$
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
}
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
$row
|
707 |
-
$
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
}
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
}
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
}
|
823 |
-
|
824 |
-
public function
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
}
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
$
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
$
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
return $
|
1043 |
-
|
1044 |
-
}
|
1045 |
-
|
1046 |
-
public function
|
1047 |
-
|
1048 |
-
$
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
if(
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
}
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
}
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
}
|
1370 |
-
|
1371 |
-
return $
|
1372 |
-
}
|
1373 |
-
|
1374 |
-
public function
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
}
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
$
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
$
|
1722 |
-
|
1723 |
-
foreach($
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
foreach($
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
}
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
}
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
//
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
}
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
$
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
|
1951 |
-
|
1952 |
-
|
1953 |
-
|
1954 |
-
|
1955 |
-
|
1956 |
-
|
1957 |
-
|
1958 |
-
|
1959 |
-
|
1960 |
-
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
-
|
1978 |
-
|
1979 |
-
|
1980 |
-
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
|
2041 |
-
|
2042 |
-
|
2043 |
-
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
-
|
2048 |
-
|
2049 |
-
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
2053 |
-
|
2054 |
-
|
2055 |
-
|
2056 |
-
|
2057 |
-
|
2058 |
-
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
-
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
}
|
2067 |
-
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
-
|
2081 |
-
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
2091 |
-
|
2092 |
-
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
2096 |
-
|
2097 |
-
|
2098 |
-
|
2099 |
-
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
2110 |
-
|
2111 |
-
|
2112 |
-
|
2113 |
-
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
2117 |
-
|
2118 |
-
|
2119 |
-
|
2120 |
-
|
2121 |
-
|
2122 |
-
|
2123 |
-
|
2124 |
-
|
2125 |
-
|
2126 |
-
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
2130 |
-
|
2131 |
-
|
2132 |
-
|
2133 |
-
|
2134 |
-
|
2135 |
-
|
2136 |
-
|
2137 |
-
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
-
|
2147 |
-
|
2148 |
-
|
2149 |
-
|
2150 |
-
|
2151 |
-
|
2152 |
-
|
2153 |
-
|
2154 |
-
|
2155 |
-
|
2156 |
-
|
2157 |
-
|
2158 |
-
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
2162 |
-
|
2163 |
-
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
2169 |
-
|
2170 |
-
|
2171 |
-
|
2172 |
-
|
2173 |
-
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
|
2180 |
-
|
2181 |
-
|
2182 |
-
|
2183 |
-
|
2184 |
-
|
2185 |
-
|
2186 |
-
|
2187 |
-
|
2188 |
-
|
2189 |
-
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
|
2196 |
-
|
2197 |
-
|
2198 |
-
|
2199 |
-
|
2200 |
-
|
2201 |
-
|
2202 |
-
|
2203 |
-
|
2204 |
-
|
2205 |
-
|
2206 |
-
|
2207 |
-
|
2208 |
-
|
2209 |
-
|
2210 |
-
|
2211 |
-
|
2212 |
-
|
2213 |
-
|
2214 |
-
|
2215 |
-
|
2216 |
-
|
2217 |
-
|
2218 |
-
|
2219 |
-
|
2220 |
-
|
2221 |
-
|
2222 |
-
|
2223 |
-
|
2224 |
-
|
2225 |
-
|
2226 |
-
|
2227 |
-
|
2228 |
-
|
2229 |
-
|
2230 |
-
|
2231 |
-
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
|
2236 |
-
|
2237 |
-
|
2238 |
-
|
2239 |
-
|
2240 |
-
|
2241 |
-
|
2242 |
-
|
2243 |
-
|
2244 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
final class WP_Installer{
|
4 |
+
protected static $_instance = null;
|
5 |
+
|
6 |
+
private $repositories = array();
|
7 |
+
|
8 |
+
protected $api_debug = '';
|
9 |
+
|
10 |
+
private $config = array();
|
11 |
+
|
12 |
+
protected $_plugins_renew_warnings = array();
|
13 |
+
|
14 |
+
protected $_gz_on = false;
|
15 |
+
|
16 |
+
private $admin_messages = array();
|
17 |
+
|
18 |
+
private $_using_icl = false;
|
19 |
+
private $_wpml_version = false;
|
20 |
+
|
21 |
+
public static function instance() {
|
22 |
+
|
23 |
+
if ( is_null( self::$_instance ) ) {
|
24 |
+
self::$_instance = new self();
|
25 |
+
}
|
26 |
+
|
27 |
+
return self::$_instance;
|
28 |
+
}
|
29 |
+
|
30 |
+
public function __construct(){
|
31 |
+
|
32 |
+
if(!is_admin() || !is_user_logged_in()) return; //Only for admin
|
33 |
+
|
34 |
+
$this->_gz_on = function_exists('gzuncompress') && function_exists('gzcompress');
|
35 |
+
$this->settings = $this->get_settings();
|
36 |
+
|
37 |
+
add_action('admin_notices', array($this, 'show_site_key_nags'));
|
38 |
+
|
39 |
+
add_action('admin_notices', array($this, 'show_admin_messages'));
|
40 |
+
|
41 |
+
add_action('admin_init', array($this, 'load_embedded_plugins'), 0);
|
42 |
+
|
43 |
+
add_action('admin_menu', array($this, 'menu_setup'));
|
44 |
+
add_action('network_admin_menu', array($this, 'menu_setup'));
|
45 |
+
|
46 |
+
if(defined('DOING_AJAX') && isset($_POST['action']) && $_POST['action'] == 'installer_download_plugin'){
|
47 |
+
add_filter( 'site_transient_update_plugins', array( $this, 'plugins_upgrade_check') );
|
48 |
+
}
|
49 |
+
add_filter('plugins_api', array( $this, 'custom_plugins_api_call'), 10, 3);
|
50 |
+
add_filter('pre_set_site_transient_update_plugins', array( $this, 'plugins_upgrade_check'));
|
51 |
+
|
52 |
+
// register repositories
|
53 |
+
$this->load_repositories_list();
|
54 |
+
|
55 |
+
if(empty($this->settings['last_repositories_update']) || time() - $this->settings['last_repositories_update'] > 86400){
|
56 |
+
$this->refresh_repositories_data();
|
57 |
+
}
|
58 |
+
|
59 |
+
// Hook to wp_update_plugins before the WP API request
|
60 |
+
// Using this in place of a missing hook in wp_update_plugins
|
61 |
+
// This is being triggered every time WP checks for plugin updates
|
62 |
+
add_filter('plugins_update_check_locales', array($this, 'update_plugins_information'));
|
63 |
+
|
64 |
+
// default config
|
65 |
+
$this->config['plugins_install_tab'] = false;
|
66 |
+
|
67 |
+
add_action('init', array($this, 'init'));
|
68 |
+
|
69 |
+
//add_filter('wp_installer_buy_url', array($this, 'append_parameters_to_buy_url'));
|
70 |
+
|
71 |
+
add_action('init', array($this,'load_locale'));
|
72 |
+
|
73 |
+
}
|
74 |
+
|
75 |
+
public function get_repositories() {
|
76 |
+
|
77 |
+
return $this->repositories;
|
78 |
+
|
79 |
+
}
|
80 |
+
|
81 |
+
public function set_config($key, $value){
|
82 |
+
|
83 |
+
$this->config[$key] = $value;
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
public function init(){
|
88 |
+
global $pagenow;
|
89 |
+
|
90 |
+
if(empty($this->settings['_pre_1_0_clean_up'])) {
|
91 |
+
$this->_pre_1_0_clean_up();
|
92 |
+
}
|
93 |
+
|
94 |
+
$this->_using_icl = function_exists('wpml_site_uses_icl') && wpml_site_uses_icl();
|
95 |
+
$this->_wpml_version = defined('ICL_SITEPRESS_VERSION') ? ICL_SITEPRESS_VERSION : '';
|
96 |
+
|
97 |
+
wp_enqueue_script('installer-admin', $this->res_url() . '/res/js/admin.js', array('jquery'), $this->version());
|
98 |
+
wp_enqueue_style('installer-admin', $this->res_url() . '/res/css/admin.css', array(), $this->version());
|
99 |
+
|
100 |
+
$translation_array = array(
|
101 |
+
'installing' => __( 'Installing %s', 'installer' ),
|
102 |
+
'updating' => __( 'Updating %s', 'installer' ),
|
103 |
+
'activating' => __( 'Activating %s', 'installer' )
|
104 |
+
);
|
105 |
+
|
106 |
+
wp_localize_script( 'installer-admin', 'installer_strings', $translation_array );
|
107 |
+
|
108 |
+
if($pagenow == 'plugins.php'){
|
109 |
+
add_action('admin_notices', array($this, 'setup_plugins_page_notices'));
|
110 |
+
add_action('admin_notices', array($this, 'setup_plugins_renew_warnings'), 10);
|
111 |
+
add_action('admin_notices', array($this, 'queue_plugins_renew_warnings'), 20);
|
112 |
+
|
113 |
+
add_action('admin_init', array($this, 'setup_plugins_action_links'));
|
114 |
+
|
115 |
+
}
|
116 |
+
|
117 |
+
if($this->is_repositories_page()){
|
118 |
+
add_action('admin_init', array($this, 'validate_repository_subscription'));
|
119 |
+
}
|
120 |
+
|
121 |
+
if(defined('DOING_AJAX')){
|
122 |
+
add_action('wp_ajax_save_site_key', array($this, 'save_site_key'));
|
123 |
+
add_action('wp_ajax_remove_site_key', array($this, 'remove_site_key'));
|
124 |
+
add_action('wp_ajax_update_site_key', array($this, 'update_site_key'));
|
125 |
+
|
126 |
+
add_action('wp_ajax_installer_download_plugin', array($this, 'download_plugin_ajax_handler'));
|
127 |
+
add_action('wp_ajax_installer_activate_plugin', array($this, 'activate_plugin'));
|
128 |
+
|
129 |
+
add_action('wp_ajax_installer_dismiss_nag', array($this, 'dismiss_nag'));
|
130 |
+
}
|
131 |
+
|
132 |
+
if($pagenow == 'update.php'){
|
133 |
+
if(isset($_GET['action']) && $_GET['action'] == 'update-selected'){
|
134 |
+
add_action('admin_head', array($this, 'plugin_upgrade_custom_errors')); //iframe/bulk
|
135 |
+
}else{
|
136 |
+
add_action('all_admin_notices', array($this, 'plugin_upgrade_custom_errors')); //regular/singular
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
// WP 4.2
|
141 |
+
if(defined('DOING_AJAX')){
|
142 |
+
add_action('wp_ajax_update-plugin', array($this, 'plugin_upgrade_custom_errors'), 0); // high priority, before WP
|
143 |
+
}
|
144 |
+
|
145 |
+
//Include theme support
|
146 |
+
include_once $this->plugin_path() . '/includes/class-installer-theme.php';
|
147 |
+
|
148 |
+
}
|
149 |
+
|
150 |
+
public function register_admin_message($text, $type = 'updated'){
|
151 |
+
$this->admin_messages[] = array('text' => $text, 'type' => $type);
|
152 |
+
}
|
153 |
+
|
154 |
+
public function show_admin_messages(){
|
155 |
+
if(!empty($this->admin_messages)){
|
156 |
+
foreach($this->admin_messages as $message){
|
157 |
+
?>
|
158 |
+
<div class="<?php echo esc_attr($message['type']) ?>">
|
159 |
+
<p>
|
160 |
+
<?php echo $message['text'] ?>
|
161 |
+
</p>
|
162 |
+
</div>
|
163 |
+
<?php
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
public function load_locale(){
|
169 |
+
$locale = get_locale();
|
170 |
+
$locale = apply_filters( 'plugin_locale', $locale, 'installer' );
|
171 |
+
$mo_file = $this->plugin_path() . '/locale/installer-' . $locale . '.mo';
|
172 |
+
if(file_exists($mo_file)){
|
173 |
+
load_textdomain( 'installer', $mo_file );
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
public function load_embedded_plugins(){
|
178 |
+
if(file_exists($this->plugin_path() . '/embedded-plugins' )) {
|
179 |
+
include_once $this->plugin_path() . '/embedded-plugins/embedded-plugins.class.php';
|
180 |
+
$this->installer_embedded_plugins = new Installer_Embedded_Plugins();
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
public function menu_setup(){
|
185 |
+
global $pagenow;
|
186 |
+
|
187 |
+
if(is_multisite() && !is_network_admin()){
|
188 |
+
$this->menu_multisite_redirect();
|
189 |
+
add_options_page(__('Installer', 'installer'), __('Installer', 'installer'), 'manage_options', 'installer', array($this, 'show_products')) ;
|
190 |
+
}else{
|
191 |
+
if($this->config['plugins_install_tab'] && is_admin() && $pagenow == 'plugin-install.php'){
|
192 |
+
// Default GUI, under Plugins -> Install
|
193 |
+
add_filter('install_plugins_tabs', array($this, 'add_install_plugins_tab'));
|
194 |
+
add_action('install_plugins_commercial', array($this, 'show_products'));
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
}
|
199 |
+
|
200 |
+
public function menu_url(){
|
201 |
+
if(is_multisite()){
|
202 |
+
if(is_network_admin()){
|
203 |
+
$url = network_admin_url('plugin-install.php?tab=commercial');
|
204 |
+
}else{
|
205 |
+
$url = admin_url('options-general.php?page=installer');
|
206 |
+
}
|
207 |
+
}else{
|
208 |
+
$url = admin_url('plugin-install.php?tab=commercial');
|
209 |
+
}
|
210 |
+
return $url;
|
211 |
+
}
|
212 |
+
|
213 |
+
private function menu_multisite_redirect(){
|
214 |
+
global $pagenow;
|
215 |
+
|
216 |
+
if($pagenow == 'plugin-install.php' && isset($_GET['tab']) && $_GET['tab'] == 'commercial'){
|
217 |
+
wp_redirect($this->menu_url());
|
218 |
+
exit;
|
219 |
+
}
|
220 |
+
|
221 |
+
}
|
222 |
+
|
223 |
+
private function _pre_1_0_clean_up(){
|
224 |
+
global $wpdb;
|
225 |
+
|
226 |
+
if(!defined('WPRC_VERSION')){
|
227 |
+
$old_tables = array(
|
228 |
+
$wpdb->prefix . 'wprc_cached_requests',
|
229 |
+
$wpdb->prefix . 'wprc_extension_types',
|
230 |
+
$wpdb->prefix . 'wprc_extensions',
|
231 |
+
$wpdb->prefix . 'wprc_repositories',
|
232 |
+
$wpdb->prefix . 'wprc_repositories_relationships',
|
233 |
+
);
|
234 |
+
|
235 |
+
foreach($old_tables as $table){
|
236 |
+
$wpdb->query(sprintf("DROP TABLE IF EXISTS %s", $table));
|
237 |
+
}
|
238 |
+
|
239 |
+
}
|
240 |
+
|
241 |
+
$this->settings['_pre_1_0_clean_up'] = true;
|
242 |
+
$this->save_settings();
|
243 |
+
}
|
244 |
+
|
245 |
+
public function setup_plugins_action_links(){
|
246 |
+
|
247 |
+
$plugins = get_plugins();
|
248 |
+
|
249 |
+
foreach($this->settings['repositories'] as $repository_id => $repository){
|
250 |
+
|
251 |
+
foreach($repository['data']['packages'] as $package){
|
252 |
+
|
253 |
+
foreach($package['products'] as $product){
|
254 |
+
|
255 |
+
foreach($product['downloads'] as $download){
|
256 |
+
|
257 |
+
if(!isset($rep_plugins[$download['slug']])){
|
258 |
+
$r_plugins[$download['slug']] = $download['slug'];
|
259 |
+
}
|
260 |
+
|
261 |
+
}
|
262 |
+
|
263 |
+
}
|
264 |
+
|
265 |
+
}
|
266 |
+
|
267 |
+
$site_key = $this->get_site_key($repository_id);
|
268 |
+
$repositories_plugins[$repository_id] = array( 'plugins' => $r_plugins, 'registered' => !empty($site_key));
|
269 |
+
|
270 |
+
foreach($plugins as $plugin_id => $plugin){
|
271 |
+
|
272 |
+
$wp_plugin_slug = dirname($plugin_id);
|
273 |
+
if(empty($wp_plugin_slug)){
|
274 |
+
$wp_plugin_slug = basename($plugin_id, '.php');
|
275 |
+
}
|
276 |
+
|
277 |
+
foreach($repositories_plugins as $repository_id => $r_plugins){
|
278 |
+
|
279 |
+
foreach($r_plugins['plugins'] as $slug => $name){
|
280 |
+
|
281 |
+
if($wp_plugin_slug == $slug || $name == $plugin['Name'] || $name == $plugin['Title']){ //match order: slug, name, title
|
282 |
+
|
283 |
+
if($r_plugins['registered']){
|
284 |
+
add_filter( 'plugin_action_links_' . $plugin_id, array($this, 'plugins_action_links_registered'));
|
285 |
+
}else{
|
286 |
+
add_filter( 'plugin_action_links_' . $plugin_id, array($this, 'plugins_action_links_not_registered'));
|
287 |
+
}
|
288 |
+
|
289 |
+
}
|
290 |
+
|
291 |
+
}
|
292 |
+
|
293 |
+
}
|
294 |
+
|
295 |
+
}
|
296 |
+
|
297 |
+
}
|
298 |
+
|
299 |
+
}
|
300 |
+
|
301 |
+
public function plugins_action_links_registered($links){
|
302 |
+
$links[] = '<a href="' . $this->menu_url() . '">' . __('Registered', 'installer') . '</a>';
|
303 |
+
return $links;
|
304 |
+
}
|
305 |
+
|
306 |
+
public function plugins_action_links_not_registered($links){
|
307 |
+
$links[] = '<a href="' . $this->menu_url() . '">' . __('Register', 'installer') . '</a>';
|
308 |
+
return $links;
|
309 |
+
}
|
310 |
+
|
311 |
+
public function version(){
|
312 |
+
return WP_INSTALLER_VERSION;
|
313 |
+
}
|
314 |
+
|
315 |
+
public function plugin_path() {
|
316 |
+
return untrailingslashit( plugin_dir_path( dirname(__FILE__) ) );
|
317 |
+
}
|
318 |
+
|
319 |
+
public function plugin_url() {
|
320 |
+
if(isset($this->config['in_theme_folder']) && !empty($this->config['in_theme_folder'])){
|
321 |
+
$url = untrailingslashit(get_template_directory_uri() . '/' . $this->config['in_theme_folder']);
|
322 |
+
}else{
|
323 |
+
$url = untrailingslashit( plugins_url( '/', dirname(__FILE__) ) );
|
324 |
+
}
|
325 |
+
|
326 |
+
return $url;
|
327 |
+
}
|
328 |
+
|
329 |
+
public function is_repositories_page(){
|
330 |
+
global $pagenow;
|
331 |
+
|
332 |
+
return $pagenow == 'plugin-install.php' && isset($_GET['tab']) && $_GET['tab'] == 'commercial';
|
333 |
+
}
|
334 |
+
|
335 |
+
public function res_url(){
|
336 |
+
if(isset($this->config['in_theme_folder']) && !empty($this->config['in_theme_folder'])){
|
337 |
+
$url = untrailingslashit(get_template_directory_uri() . '/' . $this->config['in_theme_folder']);
|
338 |
+
}else{
|
339 |
+
$url = $this->plugin_url();
|
340 |
+
}
|
341 |
+
return $url;
|
342 |
+
}
|
343 |
+
|
344 |
+
public function save_settings(){
|
345 |
+
|
346 |
+
$_settings = serialize($this->settings);
|
347 |
+
if($this->_gz_on){
|
348 |
+
$_settings = gzcompress($_settings);
|
349 |
+
}
|
350 |
+
$_settings = base64_encode($_settings);
|
351 |
+
|
352 |
+
update_option( 'wp_installer_settings', $_settings );
|
353 |
+
|
354 |
+
if( is_multisite() && is_main_site() && isset($this->settings['repositories']) ){
|
355 |
+
$network_settings = array();
|
356 |
+
|
357 |
+
foreach( $this->settings['repositories'] as $rep_id => $repository ){
|
358 |
+
if( isset($repository['subscription']) )
|
359 |
+
$network_settings[$rep_id] = $repository['subscription'];
|
360 |
+
}
|
361 |
+
|
362 |
+
update_site_option( 'wp_installer_network', $network_settings );
|
363 |
+
|
364 |
+
|
365 |
+
}
|
366 |
+
|
367 |
+
}
|
368 |
+
|
369 |
+
public function get_settings(){
|
370 |
+
$_settings = get_option('wp_installer_settings');
|
371 |
+
|
372 |
+
|
373 |
+
if (is_array($_settings) || empty($_settings)) { //backward compatibility 1.1
|
374 |
+
$settings = $_settings;
|
375 |
+
return $settings;
|
376 |
+
} else {
|
377 |
+
$_settings = base64_decode($_settings);
|
378 |
+
if ($this->_gz_on) {
|
379 |
+
$_settings = gzuncompress($_settings);
|
380 |
+
}
|
381 |
+
$settings = unserialize($_settings);
|
382 |
+
}
|
383 |
+
|
384 |
+
if (is_multisite() && isset($settings['repositories'])) {
|
385 |
+
$network_settings = maybe_unserialize(get_site_option('wp_installer_network'));
|
386 |
+
if ($network_settings) {
|
387 |
+
foreach ($settings['repositories'] as $rep_id => $repository) {
|
388 |
+
if (isset($network_settings[$rep_id])) {
|
389 |
+
$settings['repositories'][$rep_id]['subscription'] = $network_settings[$rep_id];
|
390 |
+
}
|
391 |
+
}
|
392 |
+
}
|
393 |
+
}
|
394 |
+
|
395 |
+
|
396 |
+
$settings = $this->_pre_1_6_backwards_compatibility($settings);
|
397 |
+
|
398 |
+
|
399 |
+
return $settings;
|
400 |
+
}
|
401 |
+
|
402 |
+
//backward compatibility, will remove 'basename' in version 1.8
|
403 |
+
private function _pre_1_6_backwards_compatibility($settings){
|
404 |
+
|
405 |
+
if( version_compare($this->version(), '1.8', '<') && !empty($settings['repositories']) ){
|
406 |
+
|
407 |
+
foreach ($settings['repositories'] as $repository_id => $repository) {
|
408 |
+
|
409 |
+
foreach ($repository['data']['packages'] as $package_id => $package) {
|
410 |
+
|
411 |
+
foreach ($package['products'] as $product_id => $product) {
|
412 |
+
|
413 |
+
foreach ($product['downloads'] as $download_id => $download) {
|
414 |
+
|
415 |
+
if (!isset($download['slug'])) {
|
416 |
+
$settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['downloads'][$download_id]['slug'] = $download['basename'];
|
417 |
+
|
418 |
+
}
|
419 |
+
|
420 |
+
}
|
421 |
+
}
|
422 |
+
|
423 |
+
}
|
424 |
+
}
|
425 |
+
|
426 |
+
}
|
427 |
+
|
428 |
+
return $settings;
|
429 |
+
|
430 |
+
}
|
431 |
+
|
432 |
+
public function get_installer_site_url( $repository_id = false ){
|
433 |
+
$site_url = get_site_url();
|
434 |
+
|
435 |
+
if( $repository_id && is_multisite() && isset( $this->settings['repositories'] ) ){
|
436 |
+
$network_settings = maybe_unserialize( get_site_option('wp_installer_network') );
|
437 |
+
|
438 |
+
if ( isset( $network_settings[$repository_id] ) ) {
|
439 |
+
$site_url = network_site_url();
|
440 |
+
}
|
441 |
+
}
|
442 |
+
|
443 |
+
return $site_url;
|
444 |
+
}
|
445 |
+
|
446 |
+
public function show_site_key_nags(){
|
447 |
+
$screen = get_current_screen();
|
448 |
+
|
449 |
+
if($screen->base == 'settings_page_installer' || ($screen->base == 'plugin-install' && isset($_GET['tab']) && $_GET['tab'] == 'commercial')){
|
450 |
+
return;
|
451 |
+
}
|
452 |
+
|
453 |
+
if(!empty($this->config['site_key_nags'])){
|
454 |
+
|
455 |
+
foreach($this->config['site_key_nags'] as $nag){
|
456 |
+
|
457 |
+
if(!$this->repository_has_subscription($nag['repository_id'] )){
|
458 |
+
$show = true;
|
459 |
+
if(!empty($nag['condition_cb'])){
|
460 |
+
$show = call_user_func($nag['condition_cb']);
|
461 |
+
}
|
462 |
+
|
463 |
+
if(empty($this->settings['dismissed_nags'][$nag['repository_id']]) && $show){
|
464 |
+
echo '<div class="updated error"><p>';
|
465 |
+
printf(__("To get automatic updates, you need to register %s for this site. %sRegister %s%s", 'sitepress'),
|
466 |
+
$nag['product_name'], '<a class="button-primary" href="' . $this->menu_url() . '">', $nag['product_name'], '</a>');
|
467 |
+
|
468 |
+
echo '<br /><a class="alignright installer-dismiss-nag" href="#" data-repository="' . $nag['repository_id'] . '">' . __('Dismiss', 'sitepress') . '</a><br clear="all" />';
|
469 |
+
echo '</p></div>';
|
470 |
+
}
|
471 |
+
}
|
472 |
+
|
473 |
+
}
|
474 |
+
|
475 |
+
}
|
476 |
+
|
477 |
+
}
|
478 |
+
|
479 |
+
public function dismiss_nag(){
|
480 |
+
$this->settings['dismissed_nags'][$_POST['repository']] = 1;
|
481 |
+
|
482 |
+
$this->save_settings();
|
483 |
+
|
484 |
+
echo json_encode(array());
|
485 |
+
exit;
|
486 |
+
}
|
487 |
+
|
488 |
+
public function add_install_plugins_tab($tabs){
|
489 |
+
|
490 |
+
$tabs['commercial'] = __('Commercial', 'installer');
|
491 |
+
|
492 |
+
return $tabs;
|
493 |
+
}
|
494 |
+
|
495 |
+
public function load_repositories_list(){
|
496 |
+
global $wp_installer_instances;
|
497 |
+
|
498 |
+
foreach ($wp_installer_instances as $instance) {
|
499 |
+
|
500 |
+
if (file_exists(dirname($instance['bootfile']) . '/repositories.xml')) {
|
501 |
+
$config_file = dirname($instance['bootfile']) . '/repositories.xml';
|
502 |
+
|
503 |
+
if (file_exists(dirname($instance['bootfile']) . '/repositories.sandbox.xml')) {
|
504 |
+
$config_file = dirname($instance['bootfile']) . '/repositories.sandbox.xml';
|
505 |
+
add_filter('https_ssl_verify', '__return_false');
|
506 |
+
}
|
507 |
+
|
508 |
+
$repos = simplexml_load_file($config_file);
|
509 |
+
|
510 |
+
if($repos) {
|
511 |
+
foreach ($repos as $repo) {
|
512 |
+
$id = strval($repo->id);
|
513 |
+
|
514 |
+
$data['api-url'] = strval($repo->apiurl);
|
515 |
+
$data['products'] = strval($repo->products);
|
516 |
+
|
517 |
+
// excludes rule;
|
518 |
+
if (isset($this->config['repositories_exclude']) && in_array($id, $this->config['repositories_exclude'])) {
|
519 |
+
continue;
|
520 |
+
}
|
521 |
+
|
522 |
+
// includes rule;
|
523 |
+
if (isset($this->config['repositories_include']) && !in_array($id, $this->config['repositories_include'])) {
|
524 |
+
continue;
|
525 |
+
}
|
526 |
+
|
527 |
+
$this->repositories[$id] = $data;
|
528 |
+
|
529 |
+
}
|
530 |
+
}
|
531 |
+
|
532 |
+
}
|
533 |
+
}
|
534 |
+
|
535 |
+
}
|
536 |
+
|
537 |
+
public function filter_repositories_list(){
|
538 |
+
|
539 |
+
foreach($this->settings['repositories'] as $id => $repo_data){
|
540 |
+
|
541 |
+
// excludes rule;
|
542 |
+
if(isset($this->config['repositories_exclude']) && in_array($id, $this->config['repositories_exclude'])){
|
543 |
+
unset($this->settings['repositories'][$id]);
|
544 |
+
}
|
545 |
+
|
546 |
+
// includes rule;
|
547 |
+
if(isset($this->config['repositories_include']) && !in_array($id, $this->config['repositories_include'])){
|
548 |
+
unset($this->settings['repositories'][$id]);
|
549 |
+
}
|
550 |
+
|
551 |
+
|
552 |
+
}
|
553 |
+
|
554 |
+
|
555 |
+
}
|
556 |
+
|
557 |
+
// Using this in place of a missing hook in wp_update_plugins
|
558 |
+
// This is being triggered every time WP checks for plugin updates
|
559 |
+
public function update_plugins_information($locale_data){
|
560 |
+
|
561 |
+
$this->refresh_repositories_data();
|
562 |
+
|
563 |
+
return $locale_data;
|
564 |
+
}
|
565 |
+
|
566 |
+
public function refresh_repositories_data(){
|
567 |
+
static $checked = false;
|
568 |
+
|
569 |
+
if(defined('OTGS_DISABLE_AUTO_UPDATES') && OTGS_DISABLE_AUTO_UPDATES && empty($_GET['force-check']) || $checked){
|
570 |
+
return;
|
571 |
+
}
|
572 |
+
|
573 |
+
$checked = true;
|
574 |
+
|
575 |
+
foreach($this->repositories as $id => $data){
|
576 |
+
|
577 |
+
$response = wp_remote_get($data['products']);
|
578 |
+
|
579 |
+
if(is_wp_error($response)){
|
580 |
+
// http fallback
|
581 |
+
$data['products'] = preg_replace("@^https://@", 'http://', $data['products']);
|
582 |
+
$response = wp_remote_get($data['products']);
|
583 |
+
}
|
584 |
+
|
585 |
+
if(is_wp_error($response)){
|
586 |
+
|
587 |
+
$error = sprintf(__("Installer cannot contact our updates server to get information about the available products and check for new versions. If you are seeing this message for the first time, you can ignore it, as it may be a temporary communication problem. If the problem persists and your WordPress admin is slowing down, you can disable automated version checks. Add the following line to your wp-config.php file:", 'installer'), strtoupper($id));
|
588 |
+
$error .= '<br /><br /><code>define("OTGS_DISABLE_AUTO_UPDATES", true);</code>';
|
589 |
+
|
590 |
+
$this->register_admin_message($error, 'error');
|
591 |
+
|
592 |
+
continue;
|
593 |
+
}
|
594 |
+
|
595 |
+
if($response && isset($response['response']['code']) && $response['response']['code'] == 200){
|
596 |
+
$body = wp_remote_retrieve_body($response);
|
597 |
+
if($body){
|
598 |
+
$products = json_decode($body, true);
|
599 |
+
|
600 |
+
if(is_array($products)){
|
601 |
+
$this->settings['repositories'][$id]['data'] = $products;
|
602 |
+
$this->settings = $this->_pre_1_6_backwards_compatibility($this->settings);
|
603 |
+
}
|
604 |
+
}
|
605 |
+
|
606 |
+
}
|
607 |
+
|
608 |
+
}
|
609 |
+
|
610 |
+
// cleanup
|
611 |
+
if(empty($this->settings['repositories'])){
|
612 |
+
$this->settings['repositories'] = array();
|
613 |
+
}
|
614 |
+
foreach($this->settings['repositories'] as $id => $data){
|
615 |
+
if(!in_array($id, array_keys($this->repositories))){
|
616 |
+
unset($this->settings['repositories'][$id]);
|
617 |
+
}
|
618 |
+
}
|
619 |
+
|
620 |
+
$this->settings['last_repositories_update']= time();
|
621 |
+
|
622 |
+
$this->save_settings();
|
623 |
+
|
624 |
+
}
|
625 |
+
|
626 |
+
public function show_products($args = array()){
|
627 |
+
|
628 |
+
$screen = get_current_screen();
|
629 |
+
|
630 |
+
if($screen->base == 'settings_page_installer'){ // settings page
|
631 |
+
echo '<div class="wrap">';
|
632 |
+
echo '<h2>' . __('Installer', 'installer') . '</h2>';
|
633 |
+
echo '<br />';
|
634 |
+
}
|
635 |
+
|
636 |
+
if(!is_array($args)) $args = array();
|
637 |
+
if(empty($args['template'])) $args['template'] = 'default';
|
638 |
+
|
639 |
+
$this->filter_repositories_list();
|
640 |
+
|
641 |
+
if(!empty($this->settings['repositories'])){
|
642 |
+
|
643 |
+
$this->localize_strings();
|
644 |
+
$this->set_filtered_prices($args);
|
645 |
+
$this->filter_downloads_by_icl(); //downloads for ICL users
|
646 |
+
$this->set_hierarchy_and_order();
|
647 |
+
|
648 |
+
foreach($this->settings['repositories'] as $repository_id => $repository){
|
649 |
+
|
650 |
+
if($args['template'] == 'compact'){
|
651 |
+
|
652 |
+
if(isset($args['repository']) && $args['repository'] == $repository_id){
|
653 |
+
include $this->plugin_path() . '/templates/products-compact.php';
|
654 |
+
}
|
655 |
+
|
656 |
+
}else{
|
657 |
+
|
658 |
+
include $this->plugin_path() . '/templates/repository-listing.php';
|
659 |
+
|
660 |
+
}
|
661 |
+
|
662 |
+
unset($site_key, $subscription_type, $expired, $upgrade_options, $products_avaliable);
|
663 |
+
|
664 |
+
}
|
665 |
+
|
666 |
+
}else{
|
667 |
+
|
668 |
+
echo '<center>' . __('No repositories defined.', 'installer') . '</center>';
|
669 |
+
|
670 |
+
}
|
671 |
+
|
672 |
+
if($screen->base == 'settings_page_installer'){ // settings page
|
673 |
+
echo '</div>';
|
674 |
+
}
|
675 |
+
|
676 |
+
|
677 |
+
}
|
678 |
+
|
679 |
+
public function get_product_price($repository_id, $package_id, $product_id, $incl_discount = false){
|
680 |
+
|
681 |
+
$price = false;
|
682 |
+
|
683 |
+
foreach($this->settings['repositories'][$repository_id]['data']['packages'] as $package ){
|
684 |
+
|
685 |
+
if($package['id'] == $package_id){
|
686 |
+
if(isset($package['products'][$product_id])){
|
687 |
+
if($incl_discount && isset($package['products'][$product_id]['price_disc'])){
|
688 |
+
$price = $package['products'][$product_id]['price_disc'];
|
689 |
+
}elseif(isset($package['products'][$product_id]['price'])){
|
690 |
+
$price = $package['products'][$product_id]['price'];
|
691 |
+
}
|
692 |
+
}
|
693 |
+
break;
|
694 |
+
}
|
695 |
+
}
|
696 |
+
|
697 |
+
return $price;
|
698 |
+
}
|
699 |
+
|
700 |
+
private function _render_product_packages($packages, $subscription_type, $expired, $upgrade_options, $repository_id){
|
701 |
+
|
702 |
+
$data = array();
|
703 |
+
|
704 |
+
foreach($packages as $package_id => $package){
|
705 |
+
|
706 |
+
$row = array('products' => array(), 'downloads' => array());
|
707 |
+
foreach($package['products'] as $product){
|
708 |
+
|
709 |
+
// buy base
|
710 |
+
if(empty($subscription_type) || $expired) {
|
711 |
+
|
712 |
+
$p['url'] = $this->append_parameters_to_buy_url($product['url'], $repository_id);
|
713 |
+
if (!empty($product['price_disc'])) {
|
714 |
+
$p['label'] = $product['call2action'] . ' - ' . sprintf('$%s %s$%d%s (USD)', $product['price_disc'], ' <del>', $product['price'], '</del>');
|
715 |
+
} else {
|
716 |
+
$p['label'] = $product['call2action'] . ' - ' . sprintf('$%d (USD)', $product['price']);
|
717 |
+
}
|
718 |
+
$row['products'][] = $p;
|
719 |
+
|
720 |
+
// renew
|
721 |
+
} elseif(isset($subscription_type) && $product['subscription_type'] == $subscription_type){
|
722 |
+
|
723 |
+
if($product['renewals']) {
|
724 |
+
foreach ($product['renewals'] as $renewal) {
|
725 |
+
$p['url'] = $this->append_parameters_to_buy_url($renewal['url'], $repository_id);
|
726 |
+
$p['label'] = $renewal['call2action'] . ' - ' . sprintf('$%d (USD)', $renewal['price']);
|
727 |
+
}
|
728 |
+
|
729 |
+
$row['products'][] = $p;
|
730 |
+
}
|
731 |
+
|
732 |
+
}
|
733 |
+
|
734 |
+
// upgrades
|
735 |
+
if(!empty($upgrade_options[$product['subscription_type']])){
|
736 |
+
|
737 |
+
foreach($upgrade_options[$product['subscription_type']] as $stype => $upgrade){
|
738 |
+
if($stype != $subscription_type) continue;
|
739 |
+
|
740 |
+
$p['url'] = $this->append_parameters_to_buy_url($upgrade['url'], $repository_id);
|
741 |
+
if (!empty($upgrade['price_disc'])) {
|
742 |
+
$p['label'] = $upgrade['call2action'] . ' - ' . sprintf('$%s %s$%d%s (USD)', $upgrade['price_disc'], ' <del>', $upgrade['price'], '</del>');
|
743 |
+
} else {
|
744 |
+
$p['label'] = $upgrade['call2action'] . ' - ' . sprintf('$%d (USD)', $upgrade['price']);
|
745 |
+
}
|
746 |
+
$row['products'][] = $p;
|
747 |
+
|
748 |
+
}
|
749 |
+
|
750 |
+
}
|
751 |
+
|
752 |
+
// downloads
|
753 |
+
if(isset($subscription_type) && !$expired && $product['subscription_type'] == $subscription_type){
|
754 |
+
$row['downloads'] = $product['downloads'];
|
755 |
+
}
|
756 |
+
|
757 |
+
//subpackages
|
758 |
+
if(!empty($package['sub-packages'])){
|
759 |
+
$row['sub-packages'] = $package['sub-packages'];
|
760 |
+
}
|
761 |
+
|
762 |
+
}
|
763 |
+
|
764 |
+
$row['id'] = $package['id'];
|
765 |
+
$row['image_url'] = $package['image_url'];
|
766 |
+
$row['name'] = $package['name'];
|
767 |
+
$row['description'] = $package['description'];
|
768 |
+
|
769 |
+
if(!empty($row['products']) || !empty($row['downloads']) || !empty($row['sub-packages'])){
|
770 |
+
$data[] = $row;
|
771 |
+
}
|
772 |
+
|
773 |
+
|
774 |
+
}
|
775 |
+
|
776 |
+
return $data;
|
777 |
+
|
778 |
+
}
|
779 |
+
|
780 |
+
public function append_parameters_to_buy_url($url, $repository_id, $args = array()){
|
781 |
+
|
782 |
+
$url = add_query_arg( array('icl_site_url' => $this->get_installer_site_url() ), $url );
|
783 |
+
|
784 |
+
$affiliate_id = false;
|
785 |
+
$affiliate_key = false;
|
786 |
+
|
787 |
+
if(isset($this->config['affiliate_id:' . $repository_id]) && isset($this->config['affiliate_key:' . $repository_id])){
|
788 |
+
|
789 |
+
$affiliate_id = $this->config['affiliate_id:' . $repository_id];
|
790 |
+
$affiliate_key = $this->config['affiliate_key:' . $repository_id];
|
791 |
+
|
792 |
+
}elseif(isset($args['affiliate_id:' . $repository_id]) && isset($args['affiliate_key:' . $repository_id])){
|
793 |
+
|
794 |
+
$affiliate_id = $args['affiliate_id:' . $repository_id];
|
795 |
+
$affiliate_key = $args['affiliate_key:' . $repository_id];
|
796 |
+
|
797 |
+
}elseif(defined('ICL_AFFILIATE_ID') && defined('ICL_AFFILIATE_KEY')){ //support for 1 repo
|
798 |
+
|
799 |
+
$affiliate_id = ICL_AFFILIATE_ID;
|
800 |
+
$affiliate_key = ICL_AFFILIATE_KEY;
|
801 |
+
|
802 |
+
}elseif(isset($this->config['affiliate_id']) && isset($this->config['affiliate_key'])) {
|
803 |
+
// BACKWARDS COMPATIBILITY
|
804 |
+
$affiliate_id = $this->config['affiliate_id'];
|
805 |
+
$affiliate_key = $this->config['affiliate_key'];
|
806 |
+
}
|
807 |
+
|
808 |
+
if($affiliate_id && $affiliate_key){
|
809 |
+
$url = add_query_arg(array('aid' => $affiliate_id, 'affiliate_key' => $affiliate_key), $url);
|
810 |
+
}
|
811 |
+
|
812 |
+
if($repository_id == 'wpml'){
|
813 |
+
$url = add_query_arg(array('using_icl' => $this->_using_icl, 'wpml_version' => $this->_wpml_version), $url);
|
814 |
+
}
|
815 |
+
|
816 |
+
$url = apply_filters('wp_installer_buy_url', $url);
|
817 |
+
|
818 |
+
$url = esc_url($url);
|
819 |
+
|
820 |
+
return $url;
|
821 |
+
|
822 |
+
}
|
823 |
+
|
824 |
+
public function save_site_key($args = array()){
|
825 |
+
|
826 |
+
$error = '';
|
827 |
+
|
828 |
+
$repository_id = isset($args['repository_id']) ? $args['repository_id'] : (isset($_POST['repository_id']) ? $_POST['repository_id'] : false);
|
829 |
+
$nonce = isset($args['nonce']) ? $args['nonce'] : (isset($_POST['nonce']) ? $_POST['nonce'] : '');
|
830 |
+
$site_key = isset($args['site_key']) ? $args['site_key'] : $_POST['site_key_' . $repository_id];
|
831 |
+
|
832 |
+
$site_key = preg_replace("/[^A-Za-z0-9]/", '', $site_key);
|
833 |
+
|
834 |
+
if($repository_id && $nonce && wp_create_nonce('save_site_key_' . $repository_id) == $nonce){
|
835 |
+
|
836 |
+
$subscription_data = $this->fetch_subscription_data($repository_id, $site_key);
|
837 |
+
|
838 |
+
if(is_wp_error($subscription_data)){
|
839 |
+
$error = $subscription_data->get_error_message();
|
840 |
+
if(preg_match('#Could not resolve host: (.*)#', $error, $matches)){
|
841 |
+
$error = sprintf(__("%s cannot access %s to register. Try again to see if it's a temporary problem. If the problem continues, make sure that this site has access to the Internet. You can still use the plugin without registration, but you will not receive automated updates.", 'installer'),
|
842 |
+
'<strong><i>' . $this->get_generic_product_name($repository_id) . '</i></strong>',
|
843 |
+
'<strong><i>' . $matches[1]. '</i></strong>'
|
844 |
+
) ;
|
845 |
+
}
|
846 |
+
|
847 |
+
}elseif($subscription_data){
|
848 |
+
$this->settings['repositories'][$repository_id]['subscription'] = array('key' => $site_key, 'data' => $subscription_data);
|
849 |
+
$this->save_settings();
|
850 |
+
}else{
|
851 |
+
$error = __('Invalid site key for the current site.', 'installer');
|
852 |
+
}
|
853 |
+
|
854 |
+
}
|
855 |
+
|
856 |
+
$return = array('error' => $error);
|
857 |
+
|
858 |
+
if($this->api_debug){
|
859 |
+
$return['debug'] = $this->api_debug;
|
860 |
+
}
|
861 |
+
|
862 |
+
if(!empty($args['return'])){
|
863 |
+
return $return;
|
864 |
+
}else{
|
865 |
+
echo json_encode($return);
|
866 |
+
exit;
|
867 |
+
}
|
868 |
+
|
869 |
+
}
|
870 |
+
|
871 |
+
public function get_site_key($repository_id){
|
872 |
+
|
873 |
+
if(isset($this->settings['repositories'][$repository_id]['subscription'])){
|
874 |
+
$site_key = $this->settings['repositories'][$repository_id]['subscription']['key'];
|
875 |
+
}else{
|
876 |
+
$site_key = false;
|
877 |
+
}
|
878 |
+
|
879 |
+
return $site_key;
|
880 |
+
}
|
881 |
+
|
882 |
+
public function remove_site_key(){
|
883 |
+
if($_POST['nonce'] == wp_create_nonce('remove_site_key_' . $_POST['repository_id'])){
|
884 |
+
unset($this->settings['repositories'][$_POST['repository_id']]['subscription']);
|
885 |
+
$this->save_settings();
|
886 |
+
|
887 |
+
$this->refresh_repositories_data();
|
888 |
+
}
|
889 |
+
exit;
|
890 |
+
}
|
891 |
+
|
892 |
+
public function validate_repository_subscription(){
|
893 |
+
$repository_id = isset($_GET['validate_repository']) ? $_GET['validate_repository'] : false;
|
894 |
+
if($repository_id){
|
895 |
+
|
896 |
+
$site_key = $this->get_site_key($repository_id);
|
897 |
+
if($site_key) {
|
898 |
+
$subscription_data = $this->fetch_subscription_data($repository_id, $site_key);
|
899 |
+
if(empty($subscription_data)){
|
900 |
+
unset($this->settings['repositories'][$repository_id]['subscription']);
|
901 |
+
delete_site_transient('update_plugins');
|
902 |
+
$this->save_settings();
|
903 |
+
}
|
904 |
+
}
|
905 |
+
|
906 |
+
wp_redirect($this->menu_url() . '#repository-' . $repository_id);
|
907 |
+
exit;
|
908 |
+
|
909 |
+
}
|
910 |
+
|
911 |
+
}
|
912 |
+
|
913 |
+
public function update_site_key(){
|
914 |
+
|
915 |
+
$error = '';
|
916 |
+
|
917 |
+
if($_POST['nonce'] == wp_create_nonce('update_site_key_' . $_POST['repository_id'])){
|
918 |
+
|
919 |
+
$repository_id = $_POST['repository_id'];
|
920 |
+
$site_key = $this->get_site_key($_POST['repository_id']);
|
921 |
+
|
922 |
+
if($site_key){
|
923 |
+
$subscription_data = $this->fetch_subscription_data($repository_id, $site_key);
|
924 |
+
|
925 |
+
if($subscription_data){
|
926 |
+
$this->settings['repositories'][$repository_id]['subscription'] = array('key' => $site_key, 'data' => $subscription_data);
|
927 |
+
|
928 |
+
//also refresh products information
|
929 |
+
$this->refresh_repositories_data();
|
930 |
+
|
931 |
+
}else{
|
932 |
+
unset($this->settings['repositories'][$repository_id]['subscription']);
|
933 |
+
$error = __('Invalid site key for the current site.', 'installer');
|
934 |
+
}
|
935 |
+
|
936 |
+
$this->save_settings();
|
937 |
+
|
938 |
+
}
|
939 |
+
|
940 |
+
}
|
941 |
+
|
942 |
+
echo json_encode(array('error' => $error));
|
943 |
+
|
944 |
+
exit;
|
945 |
+
}
|
946 |
+
|
947 |
+
public function api_debug_log($text){
|
948 |
+
|
949 |
+
if(defined('WPML_DEBUG_INSTALLER') && WPML_DEBUG_INSTALLER){
|
950 |
+
|
951 |
+
if(!is_scalar($text)){
|
952 |
+
$text = print_r($text, 1);
|
953 |
+
}
|
954 |
+
|
955 |
+
$this->api_debug .= $text . "\n";
|
956 |
+
|
957 |
+
}
|
958 |
+
|
959 |
+
}
|
960 |
+
|
961 |
+
public function fetch_subscription_data($repository_id, $site_key){
|
962 |
+
|
963 |
+
$subscription_data = false;
|
964 |
+
|
965 |
+
$args['body'] = array(
|
966 |
+
'action' => 'site_key_validation',
|
967 |
+
'site_key' => $site_key,
|
968 |
+
'site_url' => $this->get_installer_site_url($repository_id)
|
969 |
+
);
|
970 |
+
|
971 |
+
if($repository_id == 'wpml'){
|
972 |
+
$args['body']['using_icl'] = $this->_using_icl;
|
973 |
+
$args['body']['wpml_version'] = $this->_wpml_version;
|
974 |
+
}
|
975 |
+
|
976 |
+
$args['timeout'] = 45;
|
977 |
+
|
978 |
+
$response = wp_remote_post($this->repositories[$repository_id]['api-url'], $args);
|
979 |
+
|
980 |
+
$this->api_debug_log("POST {$this->repositories[$repository_id]['api-url']}");
|
981 |
+
$this->api_debug_log($args);
|
982 |
+
|
983 |
+
if(!is_wp_error($response)){
|
984 |
+
$datas = wp_remote_retrieve_body($response);
|
985 |
+
|
986 |
+
if(is_serialized($datas)){
|
987 |
+
$data = unserialize($datas);
|
988 |
+
$this->api_debug_log($data);
|
989 |
+
}else{
|
990 |
+
$this->api_debug_log($datas);
|
991 |
+
}
|
992 |
+
|
993 |
+
if(!empty($data->subscription_data)){
|
994 |
+
$subscription_data = $data->subscription_data;
|
995 |
+
}
|
996 |
+
}else{
|
997 |
+
|
998 |
+
$this->api_debug_log($response);
|
999 |
+
$subscription_data = $response;
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
return $subscription_data;
|
1003 |
+
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
public function get_repository_site_key($repository_id){
|
1007 |
+
$site_key = false;
|
1008 |
+
|
1009 |
+
if(!empty($this->settings['repositories'][$repository_id]['subscription']['key'])){
|
1010 |
+
$site_key = $this->settings['repositories'][$repository_id]['subscription']['key'];
|
1011 |
+
}
|
1012 |
+
|
1013 |
+
return $site_key;
|
1014 |
+
}
|
1015 |
+
|
1016 |
+
public function repository_has_valid_subscription($repository_id){
|
1017 |
+
|
1018 |
+
$valid = false;
|
1019 |
+
|
1020 |
+
if(!empty($this->settings['repositories'][$repository_id]['subscription'])){
|
1021 |
+
|
1022 |
+
$subscription = $this->settings['repositories'][$repository_id]['subscription']['data'];
|
1023 |
+
$valid = ( $subscription->status == 1 && (strtotime($subscription->expires) > time() || empty($subscription->expires)) ) || $subscription->status == 4;
|
1024 |
+
|
1025 |
+
}
|
1026 |
+
return $valid;
|
1027 |
+
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
public function repository_has_subscription($repository_id){
|
1031 |
+
$key = false;
|
1032 |
+
if(!empty($this->settings['repositories'][$repository_id]['subscription']['key'])){
|
1033 |
+
$key = $this->settings['repositories'][$repository_id]['subscription']['key'];
|
1034 |
+
}
|
1035 |
+
|
1036 |
+
return $key;
|
1037 |
+
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
public function repository_has_expired_subscription($repository_id){
|
1041 |
+
|
1042 |
+
return $this->repository_has_subscription($repository_id) && !$this->repository_has_valid_subscription($repository_id);
|
1043 |
+
|
1044 |
+
}
|
1045 |
+
|
1046 |
+
public function get_generic_product_name($repository_id){
|
1047 |
+
|
1048 |
+
return $this->settings['repositories'][$repository_id]['data']['product-name'];
|
1049 |
+
|
1050 |
+
}
|
1051 |
+
|
1052 |
+
public function show_subscription_renew_warning($repository_id, $subscription_id){
|
1053 |
+
|
1054 |
+
$show = false;
|
1055 |
+
|
1056 |
+
$data = $this->settings['repositories'][$repository_id]['data'];
|
1057 |
+
if(!empty($data['subscriptions_meta'])){
|
1058 |
+
if(isset($data['subscriptions_meta']['expiration'])){
|
1059 |
+
|
1060 |
+
if(!empty($data['subscriptions_meta']['expiration'][$subscription_id])){
|
1061 |
+
|
1062 |
+
$days = $data['subscriptions_meta']['expiration'][$subscription_id]['days_warning'];
|
1063 |
+
$message = $data['subscriptions_meta']['expiration'][$subscription_id]['warning_message'];
|
1064 |
+
|
1065 |
+
}else{
|
1066 |
+
|
1067 |
+
//defaults
|
1068 |
+
$days = 30;
|
1069 |
+
$message = __('You will have to renew your subscription in order to continue getting the updates and support.', 'installer');
|
1070 |
+
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
if(!empty($this->settings['repositories'][$repository_id]['subscription'])){
|
1074 |
+
$subscription = $this->settings['repositories'][$repository_id]['subscription'];
|
1075 |
+
|
1076 |
+
if($subscription['data']->subscription_type == $subscription_id && !empty($subscription['data']->expires)){
|
1077 |
+
|
1078 |
+
if(strtotime($subscription['data']->expires) < strtotime(sprintf("+%d day", $days))){
|
1079 |
+
|
1080 |
+
$days_to_expiration = ceil((strtotime($subscription['data']->expires) - time()) / 86400);
|
1081 |
+
|
1082 |
+
echo '<div><p class="installer-warn-box">' .
|
1083 |
+
sprintf(_n('Your subscription expires in %d day.', 'Your subscription expires in %d days.', $days_to_expiration, 'installer'), $days_to_expiration) .
|
1084 |
+
'<br />' . $message .
|
1085 |
+
'</p></div>';
|
1086 |
+
|
1087 |
+
$show = true;
|
1088 |
+
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
}
|
1092 |
+
|
1093 |
+
}
|
1094 |
+
|
1095 |
+
|
1096 |
+
}
|
1097 |
+
}
|
1098 |
+
|
1099 |
+
|
1100 |
+
return $show;
|
1101 |
+
|
1102 |
+
}
|
1103 |
+
|
1104 |
+
public function setup_plugins_renew_warnings(){
|
1105 |
+
|
1106 |
+
$plugins = get_plugins();
|
1107 |
+
|
1108 |
+
$subscriptions_with_warnings = array();
|
1109 |
+
foreach($this->settings['repositories'] as $repository_id => $repository){
|
1110 |
+
|
1111 |
+
if($this->repository_has_valid_subscription($repository_id)){
|
1112 |
+
$subscription_type = $this->settings['repositories'][$repository_id]['subscription']['data']->subscription_type;
|
1113 |
+
$expires = $this->settings['repositories'][$repository_id]['subscription']['data']->expires;
|
1114 |
+
|
1115 |
+
$never_expires = isset($this->settings['repositories'][$repository_id]['subscription'])
|
1116 |
+
&& empty($this->settings['repositories'][$repository_id]['subscription']['data']->expires)
|
1117 |
+
&& (
|
1118 |
+
$this->settings['repositories'][$repository_id]['subscription']['data']->status == 4 ||
|
1119 |
+
$this->settings['repositories'][$repository_id]['subscription']['data']->status == 1
|
1120 |
+
);
|
1121 |
+
|
1122 |
+
if(!$never_expires){
|
1123 |
+
if(isset($this->settings['repositories'][$repository_id]['data']['subscriptions_meta']['expiration'][$subscription_type])){
|
1124 |
+
|
1125 |
+
$days_warning = $this->settings['repositories'][$repository_id]['data']['subscriptions_meta']['expiration'][$subscription_type]['days_warning'];
|
1126 |
+
$custom_message = $this->settings['repositories'][$repository_id]['data']['subscriptions_meta']['expiration'][$subscription_type]['warning_message'];
|
1127 |
+
|
1128 |
+
}else{
|
1129 |
+
//defaults
|
1130 |
+
$days_warning = 30;
|
1131 |
+
$custom_message = __('You will have to renew your subscription in order to continue getting the updates and support.', 'installer');
|
1132 |
+
}
|
1133 |
+
|
1134 |
+
if(strtotime($expires) < strtotime(sprintf('+%d day', $days_warning)) ){
|
1135 |
+
|
1136 |
+
$days_to_expiration = ceil((strtotime($expires) - time()) / 86400);
|
1137 |
+
|
1138 |
+
$message = sprintf(_n('Your subscription expires in %d day.', 'Your subscription expires in %d days.', $days_to_expiration, 'installer'), $days_to_expiration);
|
1139 |
+
$subscriptions_with_warnings[$subscription_type] = $message . ' ' . $custom_message;
|
1140 |
+
|
1141 |
+
}
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
}
|
1145 |
+
|
1146 |
+
}
|
1147 |
+
|
1148 |
+
|
1149 |
+
|
1150 |
+
foreach($plugins as $plugin_id => $plugin){
|
1151 |
+
|
1152 |
+
$slug = dirname($plugin_id);
|
1153 |
+
if(empty($slug)) continue;
|
1154 |
+
|
1155 |
+
foreach($this->settings['repositories'] as $repository_id => $repository){
|
1156 |
+
|
1157 |
+
if($this->repository_has_valid_subscription($repository_id)){
|
1158 |
+
|
1159 |
+
foreach($repository['data']['packages'] as $package){
|
1160 |
+
|
1161 |
+
foreach($package['products'] as $product){
|
1162 |
+
|
1163 |
+
foreach($product['downloads'] as $download){
|
1164 |
+
|
1165 |
+
if($download['slug'] == $slug || $download['name'] == $plugin['Name'] || $download['name'] == $plugin['Title']){ //match order: slug, name, title
|
1166 |
+
|
1167 |
+
if(isset($subscriptions_with_warnings[$product['subscription_type']])){
|
1168 |
+
|
1169 |
+
$this->_plugins_renew_warnings[$plugin_id] = $subscriptions_with_warnings[$product['subscription_type']];
|
1170 |
+
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
}
|
1174 |
+
|
1175 |
+
}
|
1176 |
+
|
1177 |
+
}
|
1178 |
+
|
1179 |
+
}
|
1180 |
+
|
1181 |
+
}
|
1182 |
+
|
1183 |
+
}
|
1184 |
+
|
1185 |
+
}
|
1186 |
+
|
1187 |
+
}
|
1188 |
+
|
1189 |
+
public function queue_plugins_renew_warnings() {
|
1190 |
+
|
1191 |
+
if(!empty($this->_plugins_renew_warnings)){
|
1192 |
+
|
1193 |
+
foreach($this->_plugins_renew_warnings as $plugin_id => $message){
|
1194 |
+
|
1195 |
+
add_action( "after_plugin_row_" . $plugin_id, array($this, 'plugins_renew_warning'), 10, 3 );
|
1196 |
+
}
|
1197 |
+
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
public function plugins_renew_warning($plugin_file, $plugin_data, $status){
|
1203 |
+
|
1204 |
+
if(empty($this->_plugins_renew_warnings[$plugin_file])) return;
|
1205 |
+
|
1206 |
+
$wp_list_table = _get_list_table('WP_Plugins_List_Table');
|
1207 |
+
?>
|
1208 |
+
|
1209 |
+
<tr class="plugin-update-tr"><td colspan="<?php echo $wp_list_table->get_column_count(); ?>" class="plugin-update colspanchange">
|
1210 |
+
<div class="update-message">
|
1211 |
+
<?php
|
1212 |
+
echo $this->_plugins_renew_warnings[$plugin_file]. ' ';
|
1213 |
+
printf(__('%sRenew here%s.', 'installer'),
|
1214 |
+
'<a href="' . $this->menu_url() . '">', '</a>');
|
1215 |
+
?>
|
1216 |
+
</div>
|
1217 |
+
</tr>
|
1218 |
+
|
1219 |
+
<?php
|
1220 |
+
|
1221 |
+
}
|
1222 |
+
|
1223 |
+
public function get_subscription_type_for_repository($repository_id){
|
1224 |
+
|
1225 |
+
$subscription_type = false;
|
1226 |
+
|
1227 |
+
if(!empty($this->settings['repositories'][$repository_id]['subscription'])){
|
1228 |
+
$subscription_type = $this->settings['repositories'][$repository_id]['subscription']['data']->subscription_type;
|
1229 |
+
}
|
1230 |
+
|
1231 |
+
return $subscription_type;
|
1232 |
+
|
1233 |
+
}
|
1234 |
+
|
1235 |
+
public function have_superior_subscription($subscription_type, $product){
|
1236 |
+
|
1237 |
+
$have = false;
|
1238 |
+
|
1239 |
+
if(is_array($product['upgrades'])){
|
1240 |
+
foreach($product['upgrades'] as $u){
|
1241 |
+
if($u['subscription_type'] == $subscription_type){
|
1242 |
+
$have = true;
|
1243 |
+
break;
|
1244 |
+
}
|
1245 |
+
}
|
1246 |
+
}
|
1247 |
+
|
1248 |
+
return $have;
|
1249 |
+
}
|
1250 |
+
|
1251 |
+
public function is_product_available_for_download($product_name, $repository_id){
|
1252 |
+
|
1253 |
+
$available = false;
|
1254 |
+
|
1255 |
+
$subscription_type = $this->get_subscription_type_for_repository($repository_id);
|
1256 |
+
$expired = $this->repository_has_expired_subscription($repository_id);
|
1257 |
+
|
1258 |
+
if($this->repository_has_subscription($repository_id) && !$expired){
|
1259 |
+
|
1260 |
+
$this->set_hierarchy_and_order();
|
1261 |
+
|
1262 |
+
foreach($this->settings['repositories'][$repository_id]['data']['packages'] as $package_id => $package){
|
1263 |
+
|
1264 |
+
$has_top_package = false;
|
1265 |
+
|
1266 |
+
foreach($package['products'] as $product){
|
1267 |
+
|
1268 |
+
if($subscription_type == $product['subscription_type']){
|
1269 |
+
$has_top_package = true;
|
1270 |
+
if($product['name'] == $product_name){
|
1271 |
+
return $available = true;
|
1272 |
+
}
|
1273 |
+
}
|
1274 |
+
|
1275 |
+
}
|
1276 |
+
|
1277 |
+
if(!empty($package['sub-packages'])){
|
1278 |
+
foreach($package['sub-packages'] as $sub_package){
|
1279 |
+
foreach($sub_package['products'] as $product){
|
1280 |
+
if($product['name'] == $product_name && ($subscription_type == $product['subscription_type'] || $has_top_package)){
|
1281 |
+
return $available = true;
|
1282 |
+
}
|
1283 |
+
}
|
1284 |
+
}
|
1285 |
+
}
|
1286 |
+
|
1287 |
+
}
|
1288 |
+
}
|
1289 |
+
|
1290 |
+
return $available;
|
1291 |
+
|
1292 |
+
}
|
1293 |
+
|
1294 |
+
public function get_upgrade_options($repository_id){
|
1295 |
+
$all_upgrades = array();
|
1296 |
+
|
1297 |
+
//get all products: packages and subpackages
|
1298 |
+
$all_products = array();
|
1299 |
+
foreach($this->settings['repositories'][$repository_id]['data']['packages'] as $package){
|
1300 |
+
foreach($package['products'] as $product) {
|
1301 |
+
$all_products[] = $product;
|
1302 |
+
}
|
1303 |
+
if(!empty($package['sub-packages'])){
|
1304 |
+
foreach($package['sub-packages'] as $subpackage){
|
1305 |
+
foreach($subpackage['products'] as $product) {
|
1306 |
+
$all_products[] = $product;
|
1307 |
+
}
|
1308 |
+
|
1309 |
+
}
|
1310 |
+
|
1311 |
+
}
|
1312 |
+
|
1313 |
+
}
|
1314 |
+
|
1315 |
+
foreach($all_products as $product) {
|
1316 |
+
if ($product['upgrades']) {
|
1317 |
+
foreach ($product['upgrades'] as $upgrade) {
|
1318 |
+
if ($this->repository_has_valid_subscription($repository_id) || ($this->repository_has_subscription($repository_id) && $upgrade['including_expired'])) {
|
1319 |
+
$all_upgrades[$upgrade['subscription_type']][$product['subscription_type']] = $upgrade;
|
1320 |
+
}
|
1321 |
+
}
|
1322 |
+
}
|
1323 |
+
}
|
1324 |
+
|
1325 |
+
return $all_upgrades;
|
1326 |
+
|
1327 |
+
}
|
1328 |
+
|
1329 |
+
public function append_site_key_to_download_url($url, $key, $repository_id){
|
1330 |
+
|
1331 |
+
$url = add_query_arg(array('site_key' => $key, 'site_url' => $this->get_installer_site_url($repository_id) ), $url);
|
1332 |
+
|
1333 |
+
if($repository_id == 'wpml'){
|
1334 |
+
$url = add_query_arg(array('using_icl' => $this->_using_icl, 'wpml_version' => $this->_wpml_version), $url);
|
1335 |
+
}
|
1336 |
+
|
1337 |
+
return $url;
|
1338 |
+
|
1339 |
+
}
|
1340 |
+
|
1341 |
+
public function plugin_is_installed($name, $slug, $version = null){
|
1342 |
+
|
1343 |
+
$is = false;
|
1344 |
+
|
1345 |
+
$plugins = get_plugins();
|
1346 |
+
|
1347 |
+
foreach($plugins as $plugin_id => $plugin){
|
1348 |
+
|
1349 |
+
$wp_plugin_slug = dirname($plugin_id);
|
1350 |
+
|
1351 |
+
// Exception: embedded plugins
|
1352 |
+
if( $wp_plugin_slug == $slug || $plugin['Name'] == $name || $plugin['Title'] == $name || ( $wp_plugin_slug == $slug . '-embedded' || $plugin['Name'] == $name . ' Embedded' ) ){
|
1353 |
+
if($version){
|
1354 |
+
if(version_compare($plugin['Version'], $version, '>=')){
|
1355 |
+
$is = $plugin['Version'];
|
1356 |
+
}
|
1357 |
+
}else{
|
1358 |
+
$is = $plugin['Version'];
|
1359 |
+
}
|
1360 |
+
|
1361 |
+
break;
|
1362 |
+
}
|
1363 |
+
|
1364 |
+
}
|
1365 |
+
|
1366 |
+
//exception: Types name difference
|
1367 |
+
if(!$is && $name == 'Types'){
|
1368 |
+
return $this->plugin_is_installed('Types - Complete Solution for Custom Fields and Types', $slug, $version);
|
1369 |
+
}
|
1370 |
+
|
1371 |
+
return $is;
|
1372 |
+
}
|
1373 |
+
|
1374 |
+
public function plugin_is_embedded_version($name, $slug){
|
1375 |
+
$is = false;
|
1376 |
+
|
1377 |
+
$plugins = get_plugins();
|
1378 |
+
|
1379 |
+
//false if teh full version is also installed
|
1380 |
+
$is_full_installed = false;
|
1381 |
+
foreach($plugins as $plugin_id => $plugin){
|
1382 |
+
|
1383 |
+
if(($plugin['Name'] == $name && !preg_match("#-embedded$#", $slug)) ){
|
1384 |
+
$is_full_installed = true;
|
1385 |
+
break;
|
1386 |
+
}
|
1387 |
+
|
1388 |
+
}
|
1389 |
+
|
1390 |
+
if($is_full_installed){
|
1391 |
+
return false;
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
foreach($plugins as $plugin_id => $plugin){
|
1395 |
+
|
1396 |
+
// TBD
|
1397 |
+
$wp_plugin_slug = dirname($plugin_id);
|
1398 |
+
if( $wp_plugin_slug == $slug . '-embedded' && $plugin['Name'] == $name . ' Embedded'){
|
1399 |
+
$is = true;
|
1400 |
+
break;
|
1401 |
+
}
|
1402 |
+
|
1403 |
+
}
|
1404 |
+
|
1405 |
+
return $is;
|
1406 |
+
|
1407 |
+
}
|
1408 |
+
|
1409 |
+
//Alias for plugin_is_installed
|
1410 |
+
public function get_plugin_installed_version($name, $slug){
|
1411 |
+
|
1412 |
+
return $this->plugin_is_installed($name, $slug);
|
1413 |
+
|
1414 |
+
}
|
1415 |
+
|
1416 |
+
public function get_plugin_repository_version($repository_id, $slug){
|
1417 |
+
$version = false;
|
1418 |
+
|
1419 |
+
if(!empty($this->settings['repositories'][$repository_id]['data']['packages'])){
|
1420 |
+
foreach($this->settings['repositories'][$repository_id]['data']['packages'] as $package){
|
1421 |
+
foreach($package['products'] as $product) {
|
1422 |
+
|
1423 |
+
foreach($product['downloads'] as $download){
|
1424 |
+
|
1425 |
+
if($download['slug'] == $slug){
|
1426 |
+
$version = $download['version'];
|
1427 |
+
break (3);
|
1428 |
+
}
|
1429 |
+
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
}
|
1433 |
+
}
|
1434 |
+
}
|
1435 |
+
|
1436 |
+
return $version;
|
1437 |
+
}
|
1438 |
+
|
1439 |
+
public function is_uploading_allowed(){
|
1440 |
+
|
1441 |
+
if(!isset($this->uploading_allowed)){
|
1442 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
1443 |
+
require_once WP_Installer()->plugin_path() . '/includes/installer-upgrader-skins.php';
|
1444 |
+
|
1445 |
+
$upgrader_skins = new Installer_Upgrader_Skins(); //use our custom (mute) Skin
|
1446 |
+
$upgrader = new Plugin_Upgrader($upgrader_skins);
|
1447 |
+
|
1448 |
+
ob_start();
|
1449 |
+
$res = $upgrader->fs_connect( array(WP_CONTENT_DIR, WP_PLUGIN_DIR) );
|
1450 |
+
ob_end_clean();
|
1451 |
+
|
1452 |
+
if ( ! $res || is_wp_error( $res ) ) {
|
1453 |
+
$this->uploading_allowed = false;
|
1454 |
+
}else{
|
1455 |
+
$this->uploading_allowed = true;
|
1456 |
+
}
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
|
1460 |
+
return $this->uploading_allowed;
|
1461 |
+
|
1462 |
+
}
|
1463 |
+
|
1464 |
+
public function download_plugin_ajax_handler(){
|
1465 |
+
|
1466 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
1467 |
+
require_once $this->plugin_path() . '/includes/installer-upgrader-skins.php';
|
1468 |
+
|
1469 |
+
if(isset($_POST['data'])){
|
1470 |
+
|
1471 |
+
$data = json_decode( base64_decode( $_POST['data'] ), true );
|
1472 |
+
|
1473 |
+
}
|
1474 |
+
|
1475 |
+
$ret = false;
|
1476 |
+
$plugin_id = false;
|
1477 |
+
$message = '';
|
1478 |
+
|
1479 |
+
//validate subscription
|
1480 |
+
$site_key = $this->get_repository_site_key($data['repository_id']);
|
1481 |
+
$subscription_data = $this->fetch_subscription_data($data['repository_id'], $site_key);
|
1482 |
+
|
1483 |
+
if($subscription_data && !is_wp_error($subscription_data) && $this->repository_has_valid_subscription($data['repository_id'])){
|
1484 |
+
|
1485 |
+
if($data['nonce'] == wp_create_nonce('install_plugin_' . $data['url'])){
|
1486 |
+
|
1487 |
+
$upgrader_skins = new Installer_Upgrader_Skins(); //use our custom (mute) Skin
|
1488 |
+
$upgrader = new Plugin_Upgrader($upgrader_skins);
|
1489 |
+
|
1490 |
+
remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
|
1491 |
+
|
1492 |
+
$plugins = get_plugins();
|
1493 |
+
|
1494 |
+
//upgrade or install?
|
1495 |
+
foreach($plugins as $id => $plugin){
|
1496 |
+
$wp_plugin_slug = dirname($id);
|
1497 |
+
$is_embedded = $this->plugin_is_embedded_version(preg_replace('/ Embedded$/', '', $plugin['Name']), preg_replace('/-embedded$/', '', $wp_plugin_slug));
|
1498 |
+
|
1499 |
+
if($wp_plugin_slug == $data['slug'] || $is_embedded && preg_replace('/-embedded$/', '', $wp_plugin_slug) == $data['slug']){
|
1500 |
+
$plugin_id = $id;
|
1501 |
+
break;
|
1502 |
+
}
|
1503 |
+
}
|
1504 |
+
|
1505 |
+
if($plugin_id && empty($is_embedded)){ //upgrade
|
1506 |
+
$response['upgrade'] = 1;
|
1507 |
+
|
1508 |
+
$plugin_is_active = is_plugin_active($plugin_id);
|
1509 |
+
|
1510 |
+
$ret = $upgrader->upgrade($plugin_id);
|
1511 |
+
|
1512 |
+
if(!$ret && !empty($upgrader->skin->installer_error)){
|
1513 |
+
if(is_wp_error($upgrader->skin->installer_error)){
|
1514 |
+
$message = $upgrader->skin->installer_error->get_error_message() .
|
1515 |
+
' (' . $upgrader->skin->installer_error->get_error_data() . ')';
|
1516 |
+
}
|
1517 |
+
}
|
1518 |
+
|
1519 |
+
if($plugin_is_active){
|
1520 |
+
//prevent redirects
|
1521 |
+
add_filter('wp_redirect', '__return_false');
|
1522 |
+
activate_plugin($plugin_id);
|
1523 |
+
}
|
1524 |
+
|
1525 |
+
}else{ //install
|
1526 |
+
|
1527 |
+
if($is_embedded){
|
1528 |
+
delete_plugins(array($plugin_id));
|
1529 |
+
}
|
1530 |
+
|
1531 |
+
$response['install'] = 1;
|
1532 |
+
$ret = $upgrader->install($data['url']);
|
1533 |
+
if(!$ret && !empty($upgrader->skin->installer_error)){
|
1534 |
+
if(is_wp_error($upgrader->skin->installer_error)){
|
1535 |
+
$message = $upgrader->skin->installer_error->get_error_message() .
|
1536 |
+
' (' . $upgrader->skin->installer_error->get_error_data() . ')';
|
1537 |
+
}
|
1538 |
+
}
|
1539 |
+
}
|
1540 |
+
|
1541 |
+
$plugins = get_plugins(); //read again
|
1542 |
+
|
1543 |
+
if($ret && !empty($_POST['activate'])){
|
1544 |
+
foreach($plugins as $id => $plugin){
|
1545 |
+
$wp_plugin_slug = dirname($id);
|
1546 |
+
if($wp_plugin_slug == $data['slug']){
|
1547 |
+
$plugin_version = $plugin['Version'];
|
1548 |
+
$plugin_id = $id;
|
1549 |
+
break;
|
1550 |
+
}
|
1551 |
+
}
|
1552 |
+
|
1553 |
+
}
|
1554 |
+
|
1555 |
+
}
|
1556 |
+
|
1557 |
+
} else { //subscription not valid
|
1558 |
+
|
1559 |
+
$ret = false;
|
1560 |
+
$message = __('Your subscription appears to no longer be valid. Please try to register again using a valid site key.', 'installer');
|
1561 |
+
}
|
1562 |
+
|
1563 |
+
$response['version'] = isset($plugin_version) ? $plugin_version : 0;
|
1564 |
+
$response['plugin_id'] = $plugin_id;
|
1565 |
+
$response['nonce'] = wp_create_nonce('activate_' . $plugin_id);
|
1566 |
+
$response['success'] = $ret;
|
1567 |
+
$response['message'] = $message;
|
1568 |
+
|
1569 |
+
echo json_encode( $response );
|
1570 |
+
exit;
|
1571 |
+
|
1572 |
+
}
|
1573 |
+
|
1574 |
+
public function download_plugin($slug, $url){
|
1575 |
+
|
1576 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
1577 |
+
require_once $this->plugin_path() . '/includes/installer-upgrader-skins.php';
|
1578 |
+
|
1579 |
+
$upgrader_skins = new Installer_Upgrader_Skins(); //use our custom (mute) Skin
|
1580 |
+
$upgrader = new Plugin_Upgrader($upgrader_skins);
|
1581 |
+
|
1582 |
+
remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
|
1583 |
+
|
1584 |
+
$plugins = get_plugins();
|
1585 |
+
|
1586 |
+
$plugin_id = false;
|
1587 |
+
|
1588 |
+
//upgrade or install?
|
1589 |
+
foreach($plugins as $id => $plugin){
|
1590 |
+
$wp_plugin_slug = dirname($id);
|
1591 |
+
if($wp_plugin_slug == $slug){
|
1592 |
+
$plugin_id = $id;
|
1593 |
+
break;
|
1594 |
+
}
|
1595 |
+
}
|
1596 |
+
|
1597 |
+
if($plugin_id){ //upgrade
|
1598 |
+
|
1599 |
+
$plugin_is_active = is_plugin_active($plugin_id);
|
1600 |
+
|
1601 |
+
$ret = $upgrader->upgrade($plugin_id);
|
1602 |
+
|
1603 |
+
if($plugin_is_active){
|
1604 |
+
activate_plugin($plugin_id);
|
1605 |
+
}
|
1606 |
+
|
1607 |
+
}else{ //install
|
1608 |
+
$ret = $upgrader->install($url);
|
1609 |
+
}
|
1610 |
+
|
1611 |
+
return $ret;
|
1612 |
+
|
1613 |
+
}
|
1614 |
+
|
1615 |
+
public function activate_plugin(){
|
1616 |
+
|
1617 |
+
$error = '';
|
1618 |
+
|
1619 |
+
if(isset($_POST['nonce']) && isset($_POST['plugin_id']) && $_POST['nonce'] == wp_create_nonce('activate_' . $_POST['plugin_id'])){
|
1620 |
+
|
1621 |
+
$plugin_id = $_POST['plugin_id'];
|
1622 |
+
|
1623 |
+
// Deactivate any embedded version
|
1624 |
+
$plugin_slug = dirname($plugin_id);
|
1625 |
+
$active_plugins = get_option('active_plugins');
|
1626 |
+
foreach($active_plugins as $plugin){
|
1627 |
+
$wp_plugin_slug = dirname($plugin);
|
1628 |
+
if($wp_plugin_slug == $plugin_slug . '-embedded'){
|
1629 |
+
deactivate_plugins(array($plugin));
|
1630 |
+
break;
|
1631 |
+
}
|
1632 |
+
}
|
1633 |
+
|
1634 |
+
//prevent redirects
|
1635 |
+
add_filter('wp_redirect', '__return_false', 10000);
|
1636 |
+
|
1637 |
+
$return = activate_plugin($plugin_id);
|
1638 |
+
|
1639 |
+
if(is_wp_error($return)){
|
1640 |
+
$error = $return->get_error_message();
|
1641 |
+
}
|
1642 |
+
|
1643 |
+
}else{
|
1644 |
+
$error = 'error';
|
1645 |
+
}
|
1646 |
+
|
1647 |
+
$ret = array('error' => $error);
|
1648 |
+
|
1649 |
+
echo json_encode($ret);
|
1650 |
+
exit;
|
1651 |
+
|
1652 |
+
}
|
1653 |
+
|
1654 |
+
public function custom_plugins_api_call($false, $action, $args){
|
1655 |
+
|
1656 |
+
if($action == 'plugin_information'){
|
1657 |
+
|
1658 |
+
$slug = $args->slug;
|
1659 |
+
|
1660 |
+
foreach($this->settings['repositories'] as $repository_id => $repository){
|
1661 |
+
|
1662 |
+
if(!$this->repository_has_valid_subscription($repository_id)){
|
1663 |
+
$site_key = false;
|
1664 |
+
}else{
|
1665 |
+
$site_key = $repository['subscription']['key'];
|
1666 |
+
}
|
1667 |
+
|
1668 |
+
foreach($repository['data']['packages'] as $package){
|
1669 |
+
|
1670 |
+
foreach($package['products'] as $product){
|
1671 |
+
|
1672 |
+
foreach($product['downloads'] as $download){
|
1673 |
+
|
1674 |
+
if($download['slug'] == $slug){
|
1675 |
+
|
1676 |
+
$res = new stdClass();
|
1677 |
+
$res->external = true;
|
1678 |
+
|
1679 |
+
$res->name = $download['name'];
|
1680 |
+
$res->slug = $slug;
|
1681 |
+
$res->version = $download['version'];
|
1682 |
+
$res->author = '';
|
1683 |
+
$res->author_profile = '';
|
1684 |
+
$res->last_updated = $download['date'];
|
1685 |
+
//$res->homepage = $download['url'];
|
1686 |
+
|
1687 |
+
if($site_key){
|
1688 |
+
$res->download_link = $this->append_site_key_to_download_url($download['url'], $site_key, $repository_id);
|
1689 |
+
}else{
|
1690 |
+
// if(!empty($download['free-on-wporg'])
|
1691 |
+
return false; //try somewhere else. e.g. wordpress.org
|
1692 |
+
}
|
1693 |
+
|
1694 |
+
$res->homepage = $repository['data']['url'];
|
1695 |
+
$res->sections = array('Description' => $download['description'], 'Changelog' => $download['changelog']);
|
1696 |
+
|
1697 |
+
return $res;
|
1698 |
+
|
1699 |
+
}
|
1700 |
+
|
1701 |
+
}
|
1702 |
+
|
1703 |
+
}
|
1704 |
+
|
1705 |
+
}
|
1706 |
+
|
1707 |
+
}
|
1708 |
+
|
1709 |
+
}
|
1710 |
+
|
1711 |
+
return $false;
|
1712 |
+
|
1713 |
+
}
|
1714 |
+
|
1715 |
+
public function plugins_upgrade_check($update_plugins){
|
1716 |
+
|
1717 |
+
if(!empty($this->settings['repositories'])){
|
1718 |
+
|
1719 |
+
$this->filter_downloads_by_icl(); //downloads for ICL users
|
1720 |
+
|
1721 |
+
$plugins = get_plugins();
|
1722 |
+
|
1723 |
+
foreach($plugins as $plugin_id => $plugin){
|
1724 |
+
|
1725 |
+
$slug = dirname($plugin_id);
|
1726 |
+
if(empty($slug)) continue;
|
1727 |
+
|
1728 |
+
$version = $plugin['Version'];
|
1729 |
+
$name = $plugin['Name'];
|
1730 |
+
|
1731 |
+
foreach($this->settings['repositories'] as $repository_id => $repository){
|
1732 |
+
|
1733 |
+
|
1734 |
+
if(!$this->repository_has_valid_subscription($repository_id)){
|
1735 |
+
$site_key = false;
|
1736 |
+
}else{
|
1737 |
+
$site_key = $repository['subscription']['key'];
|
1738 |
+
//$subscription_type = $this->get_subscription_type_for_repository($repository_id);
|
1739 |
+
}
|
1740 |
+
|
1741 |
+
foreach($repository['data']['packages'] as $package){
|
1742 |
+
|
1743 |
+
foreach($package['products'] as $product){
|
1744 |
+
|
1745 |
+
foreach($product['downloads'] as $download){
|
1746 |
+
|
1747 |
+
if(!empty($download['free-on-wporg'])) {
|
1748 |
+
continue;
|
1749 |
+
}
|
1750 |
+
|
1751 |
+
if(empty($update_plugins->response[$plugin_id]) && ($download['slug'] == $slug || $download['name'] == $name ) && version_compare($download['version'], $version, '>')){
|
1752 |
+
|
1753 |
+
$response = new stdClass();
|
1754 |
+
$response->id = 0;
|
1755 |
+
$response->slug = $slug;
|
1756 |
+
$response->plugin = $plugin_id;
|
1757 |
+
$response->new_version = $download['version'];
|
1758 |
+
$response->upgrade_notice = '';
|
1759 |
+
$response->url = $download['url'];
|
1760 |
+
if($site_key){
|
1761 |
+
$response->package = $this->append_site_key_to_download_url($download['url'], $site_key, $repository_id);
|
1762 |
+
}
|
1763 |
+
$update_plugins->checked[$plugin_id] = $version;
|
1764 |
+
$update_plugins->response[$plugin_id] = $response;
|
1765 |
+
|
1766 |
+
}
|
1767 |
+
|
1768 |
+
}
|
1769 |
+
|
1770 |
+
}
|
1771 |
+
|
1772 |
+
}
|
1773 |
+
|
1774 |
+
}
|
1775 |
+
|
1776 |
+
}
|
1777 |
+
|
1778 |
+
}
|
1779 |
+
|
1780 |
+
return $update_plugins;
|
1781 |
+
|
1782 |
+
}
|
1783 |
+
|
1784 |
+
public function setup_plugins_page_notices(){
|
1785 |
+
|
1786 |
+
$plugins = get_plugins();
|
1787 |
+
|
1788 |
+
foreach($plugins as $plugin_id => $plugin){
|
1789 |
+
|
1790 |
+
$slug = dirname($plugin_id);
|
1791 |
+
if(empty($slug)) continue;
|
1792 |
+
|
1793 |
+
$name = $plugin['Name'];
|
1794 |
+
|
1795 |
+
foreach($this->settings['repositories'] as $repository_id => $repository){
|
1796 |
+
|
1797 |
+
if(!$this->repository_has_valid_subscription($repository_id)){
|
1798 |
+
$site_key = false;
|
1799 |
+
}else{
|
1800 |
+
$site_key = $repository['subscription']['key'];
|
1801 |
+
}
|
1802 |
+
|
1803 |
+
foreach($repository['data']['packages'] as $package){
|
1804 |
+
|
1805 |
+
foreach($package['products'] as $product){
|
1806 |
+
|
1807 |
+
foreach($product['downloads'] as $download){
|
1808 |
+
|
1809 |
+
if(!empty($download['free-on-wporg'])) {
|
1810 |
+
continue;
|
1811 |
+
}
|
1812 |
+
|
1813 |
+
if( $download['slug'] == $slug || $download['name'] == $name ){
|
1814 |
+
|
1815 |
+
if(!$site_key){
|
1816 |
+
add_action( "after_plugin_row_" . $plugin_id, array($this, 'show_purchase_notice_under_plugin'), 10, 3 );
|
1817 |
+
}
|
1818 |
+
|
1819 |
+
}
|
1820 |
+
|
1821 |
+
}
|
1822 |
+
|
1823 |
+
}
|
1824 |
+
|
1825 |
+
}
|
1826 |
+
|
1827 |
+
}
|
1828 |
+
|
1829 |
+
}
|
1830 |
+
|
1831 |
+
}
|
1832 |
+
|
1833 |
+
public function show_purchase_notice_under_plugin($plugin_file, $plugin_data, $status){
|
1834 |
+
|
1835 |
+
$wp_list_table = _get_list_table('WP_Plugins_List_Table');
|
1836 |
+
?>
|
1837 |
+
|
1838 |
+
<tr class="plugin-update-tr"><td colspan="<?php echo $wp_list_table->get_column_count(); ?>" class="plugin-update colspanchange">
|
1839 |
+
<div class="update-message installer-q-icon">
|
1840 |
+
<?php
|
1841 |
+
printf(__('You need to have a valid subscription in order to get upgrades or support for this plugin. %sPurchase a subscription or enter an existing site key%s.', 'installer'),
|
1842 |
+
'<a href="' . $this->menu_url() . '">', '</a>');
|
1843 |
+
?>
|
1844 |
+
</div>
|
1845 |
+
</tr>
|
1846 |
+
|
1847 |
+
<?php
|
1848 |
+
|
1849 |
+
}
|
1850 |
+
|
1851 |
+
public function localize_strings(){
|
1852 |
+
|
1853 |
+
if(!empty($this->settings['repositories'])){
|
1854 |
+
foreach($this->settings['repositories'] as $repository_id => $repository){
|
1855 |
+
//set name as call2action when don't have any
|
1856 |
+
//products
|
1857 |
+
foreach($repository['data']['packages'] as $package_id => $package){
|
1858 |
+
foreach($package['products'] as $product_id => $product){
|
1859 |
+
if(empty($product['call2action'])){
|
1860 |
+
$this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['call2action'] = $product['name'];
|
1861 |
+
}
|
1862 |
+
|
1863 |
+
foreach($product['upgrades'] as $idx => $upg){
|
1864 |
+
if(empty($upg['call2action'])){
|
1865 |
+
$this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['upgrades'][$idx]['call2action'] = $upg['name'];
|
1866 |
+
}
|
1867 |
+
}
|
1868 |
+
|
1869 |
+
foreach($product['renewals'] as $idx => $rnw){
|
1870 |
+
if(empty($rnw['call2action'])){
|
1871 |
+
$this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['renewals'][$idx]['call2action'] = $rnw['name'];
|
1872 |
+
}
|
1873 |
+
|
1874 |
+
}
|
1875 |
+
|
1876 |
+
}
|
1877 |
+
}
|
1878 |
+
}
|
1879 |
+
}
|
1880 |
+
|
1881 |
+
global $sitepress;
|
1882 |
+
if(is_null($sitepress)){
|
1883 |
+
return;
|
1884 |
+
}
|
1885 |
+
|
1886 |
+
// default strings are always in English
|
1887 |
+
$user_admin_language = $sitepress->get_admin_language();
|
1888 |
+
|
1889 |
+
if($user_admin_language != 'en'){
|
1890 |
+
foreach($this->settings['repositories'] as $repository_id => $repository){
|
1891 |
+
|
1892 |
+
$localization = $repository['data']['localization'];
|
1893 |
+
|
1894 |
+
//packages
|
1895 |
+
foreach($repository['data']['packages'] as $package_id => $package){
|
1896 |
+
|
1897 |
+
if( isset($localization['packages'][$package_id]['name'][$user_admin_language]) ){
|
1898 |
+
$this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['name'] = $localization['packages'][$package_id]['name'][$user_admin_language];
|
1899 |
+
}
|
1900 |
+
if( isset($localization['packages'][$package_id]['description'][$user_admin_language]) ){
|
1901 |
+
$this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['description'] = $localization['packages'][$package_id]['description'][$user_admin_language];
|
1902 |
+
}
|
1903 |
+
|
1904 |
+
}
|
1905 |
+
|
1906 |
+
//products
|
1907 |
+
foreach($repository['data']['packages'] as $package_id => $package){
|
1908 |
+
foreach($package['products'] as $product_id => $product){
|
1909 |
+
|
1910 |
+
if( isset($localization['products'][$product_id]['name'][$user_admin_language]) ){
|
1911 |
+
$this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['name']
|
1912 |
+
= $localization['products'][$product_id]['name'][$user_admin_language];
|
1913 |
+
}
|
1914 |
+
if( isset($localization['products'][$product_id]['description'][$user_admin_language]) ){
|
1915 |
+
$this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['description']
|
1916 |
+
= $localization['products'][$product_id]['description'][$user_admin_language];
|
1917 |
+
}
|
1918 |
+
if( isset($localization['products'][$product_id]['call2action'][$user_admin_language]) ){
|
1919 |
+
$this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['name']
|
1920 |
+
= $localization['products'][$product_id]['call2action'][$user_admin_language];
|
1921 |
+
}
|
1922 |
+
|
1923 |
+
|
1924 |
+
}
|
1925 |
+
}
|
1926 |
+
|
1927 |
+
//subscription info
|
1928 |
+
if(isset($repository['data']['subscriptions_meta']['expiration'])){
|
1929 |
+
foreach($repository['data']['subscriptions_meta']['expiration'] as $subscription_id => $note){
|
1930 |
+
if(isset($localization['subscriptions-notes'][$subscription_id]['expiration-warning'][$user_admin_language])){
|
1931 |
+
$this->settings['repositories'][$repository_id]['data']['subscriptions_meta']['expiration'][$subscription_id]['warning_message']
|
1932 |
+
= $localization['subscriptions-notes'][$subscription_id]['expiration-warning'][$user_admin_language];
|
1933 |
+
}
|
1934 |
+
}
|
1935 |
+
}
|
1936 |
+
|
1937 |
+
}
|
1938 |
+
}
|
1939 |
+
|
1940 |
+
}
|
1941 |
+
|
1942 |
+
public function get_matching_cp($repository, $args = array()){
|
1943 |
+
$match = false;
|
1944 |
+
|
1945 |
+
|
1946 |
+
$cp_name = $cp_author = false;
|
1947 |
+
|
1948 |
+
if(isset($this->config['src_name']) && isset($this->config['src_author'])){
|
1949 |
+
|
1950 |
+
$cp_name = $this->config['src_name'];
|
1951 |
+
$cp_author = $this->config['src_author'];
|
1952 |
+
|
1953 |
+
}elseif(isset($args['src_name']) && isset($args['src_author'])){
|
1954 |
+
|
1955 |
+
$cp_name = $args['src_name'];
|
1956 |
+
$cp_author = $args['src_author'];
|
1957 |
+
|
1958 |
+
}
|
1959 |
+
|
1960 |
+
if(isset($repository['data']['marketing_cp'])){
|
1961 |
+
|
1962 |
+
foreach($repository['data']['marketing_cp'] as $cp){
|
1963 |
+
|
1964 |
+
if(!empty($cp['exp']) && time() > $cp['exp']){
|
1965 |
+
continue;
|
1966 |
+
}
|
1967 |
+
|
1968 |
+
//Use theme_name for plugins too
|
1969 |
+
if(!empty($cp['theme_name'])){
|
1970 |
+
if($cp['author_name'] == $cp_author && $cp['theme_name'] == $cp_name){
|
1971 |
+
$match = $cp;
|
1972 |
+
continue;
|
1973 |
+
}
|
1974 |
+
}else{
|
1975 |
+
if($cp['author_name'] == $cp_author){
|
1976 |
+
$match = $cp;
|
1977 |
+
continue;
|
1978 |
+
}
|
1979 |
+
}
|
1980 |
+
|
1981 |
+
}
|
1982 |
+
|
1983 |
+
}
|
1984 |
+
|
1985 |
+
return $match;
|
1986 |
+
}
|
1987 |
+
|
1988 |
+
public function set_filtered_prices($args = array()){
|
1989 |
+
|
1990 |
+
foreach($this->settings['repositories'] as $repository_id => $repository){
|
1991 |
+
|
1992 |
+
$match = $this->get_matching_cp($repository, $args);
|
1993 |
+
|
1994 |
+
if(empty($match)) continue;
|
1995 |
+
|
1996 |
+
foreach($repository['data']['packages'] as $package_id => $package){
|
1997 |
+
|
1998 |
+
foreach($package['products'] as $product_id => $product){
|
1999 |
+
|
2000 |
+
if($match['dtp'] == '%'){
|
2001 |
+
$fprice = round( $product['price'] * (1 - $match['amt']/100), 2 );
|
2002 |
+
$fprice = $fprice != round($fprice) ? sprintf('%.2f', $fprice) : round($fprice, 0);
|
2003 |
+
}elseif($match['dtp'] == '-'){
|
2004 |
+
$fprice = $product['price'] - $match['amt'];
|
2005 |
+
}else{
|
2006 |
+
$fprice = $product['price'];
|
2007 |
+
}
|
2008 |
+
|
2009 |
+
if($fprice){
|
2010 |
+
$this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['price_disc'] = $fprice;
|
2011 |
+
|
2012 |
+
$url_glue = false !== strpos($this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['url'], '?') ? '&' : '?';
|
2013 |
+
$cpndata = base64_encode(json_encode(array('theme_author' => $match['author_name'], 'theme_name' => $match['theme_name'], 'vlc' => $match['vlc'])));
|
2014 |
+
$this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['url'] .= $url_glue . 'cpn=' . $cpndata;
|
2015 |
+
|
2016 |
+
foreach($product['upgrades'] as $upgrade_id => $upgrade){
|
2017 |
+
|
2018 |
+
$fprice = false;
|
2019 |
+
if($match['dtp'] == '%'){
|
2020 |
+
$fprice = round( $upgrade['price'] * (1 - $match['amt']/100), 2 );
|
2021 |
+
$fprice = $fprice != round($fprice) ? sprintf('%.2f', $fprice) : round($fprice, 0);
|
2022 |
+
}elseif($match['dtp'] == '-'){
|
2023 |
+
$fprice = $upgrade['price'] - $match['amt'];
|
2024 |
+
}
|
2025 |
+
if($fprice){
|
2026 |
+
$this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['upgrades'][$upgrade_id]['price_disc'] = $fprice;
|
2027 |
+
$this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['upgrades'][$upgrade_id]['url'] .= $url_glue . 'cpn=' . $cpndata;
|
2028 |
+
}
|
2029 |
+
|
2030 |
+
|
2031 |
+
}
|
2032 |
+
|
2033 |
+
}
|
2034 |
+
|
2035 |
+
}
|
2036 |
+
|
2037 |
+
}
|
2038 |
+
|
2039 |
+
}
|
2040 |
+
|
2041 |
+
}
|
2042 |
+
|
2043 |
+
public function set_hierarchy_and_order(){
|
2044 |
+
|
2045 |
+
//2 levels
|
2046 |
+
if(!empty($this->settings['repositories'])) {
|
2047 |
+
foreach ($this->settings['repositories'] as $repository_id => $repository) {
|
2048 |
+
|
2049 |
+
if( empty( $repository['data']['packages'] ) ) continue;
|
2050 |
+
|
2051 |
+
$all_packages = $repository['data']['packages'];
|
2052 |
+
$ordered_packages = array();
|
2053 |
+
|
2054 |
+
//backward compatibility - 'order'
|
2055 |
+
foreach($all_packages as $k => $v){
|
2056 |
+
if(!isset($v['order'])){
|
2057 |
+
$all_packages[$k]['order'] = 0;
|
2058 |
+
}
|
2059 |
+
}
|
2060 |
+
|
2061 |
+
//select parents
|
2062 |
+
foreach ($all_packages as $package_id => $package) {
|
2063 |
+
if(empty($package['parent'])){
|
2064 |
+
$ordered_packages[$package_id] = $package;
|
2065 |
+
}
|
2066 |
+
}
|
2067 |
+
|
2068 |
+
//add sub-packages
|
2069 |
+
foreach($all_packages as $package_id => $package){
|
2070 |
+
if(!empty($package['parent'])) {
|
2071 |
+
if(isset($ordered_packages[$package['parent']])){
|
2072 |
+
$ordered_packages[$package['parent']]['sub-packages'][$package_id] = $package;
|
2073 |
+
}
|
2074 |
+
}
|
2075 |
+
}
|
2076 |
+
|
2077 |
+
// order parents
|
2078 |
+
usort($ordered_packages, array($this, '_order_packages_callback'));
|
2079 |
+
//order sub-packages
|
2080 |
+
foreach($ordered_packages as $package_id => $package){
|
2081 |
+
if(!empty($package['sub-packages'])) {
|
2082 |
+
usort($ordered_packages[$package_id]['sub-packages'], create_function('$a, $b', 'return $a[\'order\'] > $b[\'order\'];'));
|
2083 |
+
}
|
2084 |
+
}
|
2085 |
+
|
2086 |
+
$this->settings['repositories'][$repository_id]['data']['packages'] = $ordered_packages;
|
2087 |
+
|
2088 |
+
|
2089 |
+
}
|
2090 |
+
}
|
2091 |
+
|
2092 |
+
|
2093 |
+
}
|
2094 |
+
|
2095 |
+
public function _order_packages_callback($a, $b){
|
2096 |
+
return $a['order'] > $b['order'];
|
2097 |
+
}
|
2098 |
+
|
2099 |
+
public function filter_downloads_by_icl(){
|
2100 |
+
if(function_exists('wpml_site_uses_icl') && wpml_site_uses_icl()){
|
2101 |
+
|
2102 |
+
if(!empty($this->settings['repositories'])) {
|
2103 |
+
foreach ($this->settings['repositories'] as $repository_id => $repository) {
|
2104 |
+
|
2105 |
+
if (empty($repository['data']['packages'])) continue;
|
2106 |
+
|
2107 |
+
foreach ($repository['data']['packages'] as $package_id => $package) {
|
2108 |
+
foreach($package['products'] as $product_id => $product){
|
2109 |
+
|
2110 |
+
foreach($product['downloads'] as $download_id => $download){
|
2111 |
+
|
2112 |
+
if(isset($download['version-for-icl']) && isset($download['url-for-icl'])){
|
2113 |
+
$download['version'] = $download['version-for-icl'];
|
2114 |
+
$download['url'] = $download['url-for-icl'];
|
2115 |
+
unset($download['version-for-icl']);
|
2116 |
+
unset($download['url-for-icl']);
|
2117 |
+
$this->settings['repositories'][$repository_id]['data']['packages'][$package_id]['products'][$product_id]['downloads'][$download_id] = $download;
|
2118 |
+
|
2119 |
+
}
|
2120 |
+
|
2121 |
+
}
|
2122 |
+
}
|
2123 |
+
|
2124 |
+
}
|
2125 |
+
|
2126 |
+
}
|
2127 |
+
}
|
2128 |
+
|
2129 |
+
}
|
2130 |
+
|
2131 |
+
// Exception: WPML before 3.2 should not be able to upgrade to 3.2+ automatically
|
2132 |
+
// Only when the exact folder name is used: sitepress-multilignaul-cms
|
2133 |
+
$plugins = get_plugins();
|
2134 |
+
foreach($plugins as $id => $plugin){
|
2135 |
+
if( dirname($id) == 'sitepress-multilingual-cms' ){
|
2136 |
+
$wpml_version = $plugin['Version'];
|
2137 |
+
|
2138 |
+
}
|
2139 |
+
}
|
2140 |
+
|
2141 |
+
if(!empty($wpml_version) && version_compare( $wpml_version, '3.2', '<' )){
|
2142 |
+
if(!empty($this->settings['repositories']['wpml'])) {
|
2143 |
+
|
2144 |
+
foreach ($this->settings['repositories']['wpml']['data']['packages'] as $package_id => $package) {
|
2145 |
+
foreach($package['products'] as $product_id => $product){
|
2146 |
+
|
2147 |
+
foreach($product['downloads'] as $download_id => $download){
|
2148 |
+
|
2149 |
+
$this->settings['repositories']['wpml']['data']['packages'][$package_id]['products'][$product_id]['downloads'][$download_id]['changelog'] = '';
|
2150 |
+
$this->settings['repositories']['wpml']['data']['packages'][$package_id]['products'][$product_id]['downloads'][$download_id]['description'] = '';
|
2151 |
+
|
2152 |
+
if(isset($download['version-for-icl']) && isset($download['url-for-icl'])){
|
2153 |
+
$download['version'] = $download['version-for-icl'];
|
2154 |
+
$download['url'] = $download['url-for-icl'];
|
2155 |
+
unset($download['version-for-icl']);
|
2156 |
+
unset($download['url-for-icl']);
|
2157 |
+
$this->settings['repositories']['wpml']['data']['packages'][$package_id]['products'][$product_id]['downloads'][$download_id] = $download;
|
2158 |
+
|
2159 |
+
}
|
2160 |
+
|
2161 |
+
}
|
2162 |
+
}
|
2163 |
+
|
2164 |
+
}
|
2165 |
+
}
|
2166 |
+
}
|
2167 |
+
// Exception pre-WPML 3.2 - END
|
2168 |
+
|
2169 |
+
}
|
2170 |
+
|
2171 |
+
public function get_support_tag_by_name( $name, $repository ){
|
2172 |
+
|
2173 |
+
if( is_array($this->settings['repositories'][$repository]['data']['support_tags'] )){
|
2174 |
+
foreach( $this->settings['repositories'][$repository]['data']['support_tags'] as $support_tag){
|
2175 |
+
if( $support_tag['name'] == $name ){
|
2176 |
+
return $support_tag['url'];
|
2177 |
+
}
|
2178 |
+
}
|
2179 |
+
}
|
2180 |
+
|
2181 |
+
return false;
|
2182 |
+
}
|
2183 |
+
|
2184 |
+
public function plugin_upgrade_custom_errors(){
|
2185 |
+
|
2186 |
+
if ( isset($_REQUEST['action']) ) {
|
2187 |
+
|
2188 |
+
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
|
2189 |
+
|
2190 |
+
//bulk mode
|
2191 |
+
if('update-selected' == $action) {
|
2192 |
+
|
2193 |
+
global $plugins;
|
2194 |
+
|
2195 |
+
if(isset($plugins) && is_array($plugins)) {
|
2196 |
+
|
2197 |
+
foreach ($plugins as $k => $plugin) {
|
2198 |
+
$plugin_repository = false;
|
2199 |
+
|
2200 |
+
$wp_plugin_slug = dirname($plugin);
|
2201 |
+
|
2202 |
+
foreach ($this->settings['repositories'] as $repository_id => $repository) {
|
2203 |
+
|
2204 |
+
foreach ($repository['data']['packages'] as $package) {
|
2205 |
+
|
2206 |
+
foreach ($package['products'] as $product) {
|
2207 |
+
|
2208 |
+
foreach ($product['downloads'] as $download) {
|
2209 |
+
|
2210 |
+
if ($download['slug'] == $wp_plugin_slug) {
|
2211 |
+
$plugin_repository = $repository_id;
|
2212 |
+
$product_name = $repository['data']['product-name'];
|
2213 |
+
$plugin_name = $download['name'];
|
2214 |
+
$free_on_wporg = !empty($download['free-on-wporg']);
|
2215 |
+
break;
|
2216 |
+
}
|
2217 |
+
|
2218 |
+
}
|
2219 |
+
|
2220 |
+
}
|
2221 |
+
|
2222 |
+
}
|
2223 |
+
|
2224 |
+
}
|
2225 |
+
|
2226 |
+
if ($plugin_repository) {
|
2227 |
+
|
2228 |
+
//validate subscription
|
2229 |
+
static $sub_cache = array();
|
2230 |
+
|
2231 |
+
if(empty($sub_cache[$plugin_repository])){
|
2232 |
+
$site_key = $this->get_repository_site_key($plugin_repository);
|
2233 |
+
if ($site_key) {
|
2234 |
+
$subscription_data = $this->fetch_subscription_data($plugin_repository, $site_key);
|
2235 |
+
}
|
2236 |
+
|
2237 |
+
$sub_cache[$plugin_repository]['site_key'] = $site_key;
|
2238 |
+
$sub_cache[$plugin_repository]['subscription_data'] = isset($subscription_data) ? $subscription_data : false;
|
2239 |
+
}else{
|
2240 |
+
|
2241 |
+
$site_key = $sub_cache[$plugin_repository]['site_key'];
|
2242 |
+
$subscription_data = $sub_cache[$plugin_repository]['subscription_data'];
|
2243 |
+
|
2244 |
+
}
|
2245 |
+
|
2246 |
+
if(!$site_key && !empty($free_on_wporg)){ // allow the download from wp.org
|
2247 |
+
continue;
|
2248 |
+
}
|
2249 |
+
|
2250 |
+
if (empty($site_key) || empty($subscription_data)) {
|
2251 |
+
|
2252 |
+
|
2253 |
+
$error_message = sprintf(__("%s cannot update because your site's registration is not valid. Please %sregister %s%s again for this site first.", 'installer'),
|
2254 |
+
'<strong>' . $plugin_name . '</strong>', '<a target="_top" href="' . $this->menu_url() . '&validate_repository=' . $plugin_repository .
|
2255 |
+
'#repository-' . $plugin_repository . '">', $product_name, '</a>');
|
2256 |
+
|
2257 |
+
echo '<div class="updated error"><p>' . $error_message . '</p></div>';
|
2258 |
+
|
2259 |
+
unset($plugins[$k]);
|
2260 |
+
|
2261 |
+
|
2262 |
+
}
|
2263 |
+
|
2264 |
+
}
|
2265 |
+
|
2266 |
+
}
|
2267 |
+
|
2268 |
+
}
|
2269 |
+
|
2270 |
+
}
|
2271 |
+
|
2272 |
+
|
2273 |
+
if( 'upgrade-plugin' == $action || 'update-plugin' == $action ) {
|
2274 |
+
|
2275 |
+
$plugin = isset($_REQUEST['plugin']) ? trim($_REQUEST['plugin']) : '';
|
2276 |
+
|
2277 |
+
$wp_plugin_slug = dirname($plugin);
|
2278 |
+
|
2279 |
+
$plugin_repository = false;
|
2280 |
+
|
2281 |
+
foreach($this->settings['repositories'] as $repository_id => $repository){
|
2282 |
+
|
2283 |
+
foreach($repository['data']['packages'] as $package){
|
2284 |
+
|
2285 |
+
foreach($package['products'] as $product){
|
2286 |
+
|
2287 |
+
foreach($product['downloads'] as $download){
|
2288 |
+
|
2289 |
+
//match by folder, will change to match by name and folder
|
2290 |
+
if($download['slug'] == $wp_plugin_slug) {
|
2291 |
+
$plugin_repository = $repository_id;
|
2292 |
+
$product_name = $repository['data']['product-name'];
|
2293 |
+
$plugin_name = $download['name'];
|
2294 |
+
$free_on_wporg = !empty($download['free-on-wporg']);
|
2295 |
+
break;
|
2296 |
+
}
|
2297 |
+
|
2298 |
+
}
|
2299 |
+
|
2300 |
+
}
|
2301 |
+
|
2302 |
+
}
|
2303 |
+
|
2304 |
+
}
|
2305 |
+
|
2306 |
+
if($plugin_repository) {
|
2307 |
+
|
2308 |
+
//validate subscription
|
2309 |
+
$site_key = $this->get_repository_site_key($plugin_repository);
|
2310 |
+
if ($site_key) {
|
2311 |
+
$subscription_data = $this->fetch_subscription_data($plugin_repository, $site_key);
|
2312 |
+
}
|
2313 |
+
|
2314 |
+
if ( (empty($site_key) || empty($subscription_data)) && empty($free_on_wporg)) {
|
2315 |
+
|
2316 |
+
$error_message = sprintf(__("%s cannot update because your site's registration is not valid. Please %sregister %s%s again for this site first.", 'installer'),
|
2317 |
+
'<strong>'.$plugin_name . '</strong>', '<a href="' . $this->menu_url() . '&validate_repository=' . $plugin_repository .
|
2318 |
+
'#repository-' . $plugin_repository . '">', $product_name, '</a>');
|
2319 |
+
|
2320 |
+
if(defined('DOING_AJAX')){ //WP 4.2
|
2321 |
+
|
2322 |
+
$status = array(
|
2323 |
+
'update' => 'plugin',
|
2324 |
+
'plugin' => $plugin,
|
2325 |
+
'slug' => sanitize_key( $_POST['slug'] ),
|
2326 |
+
'oldVersion' => '',
|
2327 |
+
'newVersion' => '',
|
2328 |
+
);
|
2329 |
+
|
2330 |
+
$status['errorCode'] = 'wp_installer_invalid_subscription';
|
2331 |
+
$status['error'] = $error_message;
|
2332 |
+
|
2333 |
+
wp_send_json_error( $status );
|
2334 |
+
|
2335 |
+
} else { // WP 4.1.1
|
2336 |
+
echo '<div class="updated error"><p>' . $error_message . '</p></div>';
|
2337 |
+
|
2338 |
+
|
2339 |
+
echo '<div class="wrap">';
|
2340 |
+
echo '<h2>' . __('Update Plugin') . '</h2>';
|
2341 |
+
echo '<a href="' . admin_url('plugins.php') . '">' . __('Return to the plugins page') . '</a>';
|
2342 |
+
echo '</div>';
|
2343 |
+
require_once(ABSPATH . 'wp-admin/admin-footer.php');
|
2344 |
+
exit;
|
2345 |
+
|
2346 |
+
}
|
2347 |
+
|
2348 |
+
}
|
2349 |
+
|
2350 |
+
|
2351 |
+
}
|
2352 |
+
|
2353 |
+
}
|
2354 |
+
}
|
2355 |
+
|
2356 |
+
}
|
2357 |
+
|
2358 |
+
}
|
plus/installer/installer.php
CHANGED
@@ -1,22 +1,22 @@
|
|
1 |
-
<?php
|
2 |
-
define('WP_INSTALLER_VERSION', '1.
|
3 |
-
|
4 |
-
include_once dirname(__FILE__) . '/includes/installer.class.php';
|
5 |
-
|
6 |
-
function WP_Installer() {
|
7 |
-
return WP_Installer::instance();
|
8 |
-
}
|
9 |
-
|
10 |
-
|
11 |
-
WP_Installer();
|
12 |
-
|
13 |
-
include_once dirname(__FILE__) . '/includes/installer-api.php';
|
14 |
-
|
15 |
-
// Ext function
|
16 |
-
function WP_Installer_Show_Products($args = array()){
|
17 |
-
|
18 |
-
WP_Installer()->show_products($args);
|
19 |
-
|
20 |
-
}
|
21 |
-
|
22 |
|
1 |
+
<?php
|
2 |
+
define('WP_INSTALLER_VERSION', '1.6');
|
3 |
+
|
4 |
+
include_once dirname(__FILE__) . '/includes/installer.class.php';
|
5 |
+
|
6 |
+
function WP_Installer() {
|
7 |
+
return WP_Installer::instance();
|
8 |
+
}
|
9 |
+
|
10 |
+
|
11 |
+
WP_Installer();
|
12 |
+
|
13 |
+
include_once dirname(__FILE__) . '/includes/installer-api.php';
|
14 |
+
|
15 |
+
// Ext function
|
16 |
+
function WP_Installer_Show_Products($args = array()){
|
17 |
+
|
18 |
+
WP_Installer()->show_products($args);
|
19 |
+
|
20 |
+
}
|
21 |
+
|
22 |
|
plus/installer/loader.php
CHANGED
@@ -1,99 +1,123 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Installer
|
4 |
-
Plugin URI: http://wp-compatibility.com/installer-plugin/
|
5 |
-
Description: Need help buying, installing and upgrading commercial themes and plugins? **Installer** handles all this for you, right from the WordPress admin. Installer lets you find themes and plugins from different sources, then, buy them from within the WordPress admin. Instead of manually uploading and unpacking, you'll see those themes and plugins available, just like any other plugin you're getting from WordPress.org.
|
6 |
-
Version: 1.
|
7 |
-
Author: OnTheGoSystems Inc.
|
8 |
-
Author URI: http://www.onthegosystems.com/
|
9 |
-
*/
|
10 |
-
|
11 |
-
|
12 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
13 |
-
exit; // Exit if accessed directly
|
14 |
-
}
|
15 |
-
|
16 |
-
//It should only be loaded on the admin side
|
17 |
-
if( !is_admin() ){
|
18 |
-
if(!function_exists('WP_Installer_Setup')){ function WP_Installer_Setup(){} }
|
19 |
-
$wp_installer_instance = null;
|
20 |
-
return;
|
21 |
-
}
|
22 |
-
|
23 |
-
|
24 |
-
$wp_installer_instance = dirname(__FILE__) . '/installer.php';
|
25 |
-
|
26 |
-
|
27 |
-
// Global stack of instances
|
28 |
-
global $wp_installer_instances;
|
29 |
-
$wp_installer_instances[$wp_installer_instance] = array(
|
30 |
-
'bootfile' => $wp_installer_instance,
|
31 |
-
'version' => '1.
|
32 |
-
);
|
33 |
-
|
34 |
-
//
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
$
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
$
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Installer
|
4 |
+
Plugin URI: http://wp-compatibility.com/installer-plugin/
|
5 |
+
Description: Need help buying, installing and upgrading commercial themes and plugins? **Installer** handles all this for you, right from the WordPress admin. Installer lets you find themes and plugins from different sources, then, buy them from within the WordPress admin. Instead of manually uploading and unpacking, you'll see those themes and plugins available, just like any other plugin you're getting from WordPress.org.
|
6 |
+
Version: 1.6
|
7 |
+
Author: OnTheGoSystems Inc.
|
8 |
+
Author URI: http://www.onthegosystems.com/
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
13 |
+
exit; // Exit if accessed directly
|
14 |
+
}
|
15 |
+
|
16 |
+
//It should only be loaded on the admin side
|
17 |
+
if( !is_admin() ){
|
18 |
+
if(!function_exists('WP_Installer_Setup')){ function WP_Installer_Setup(){} }
|
19 |
+
$wp_installer_instance = null;
|
20 |
+
return;
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
$wp_installer_instance = dirname(__FILE__) . '/installer.php';
|
25 |
+
|
26 |
+
|
27 |
+
// Global stack of instances
|
28 |
+
global $wp_installer_instances;
|
29 |
+
$wp_installer_instances[$wp_installer_instance] = array(
|
30 |
+
'bootfile' => $wp_installer_instance,
|
31 |
+
'version' => '1.6'
|
32 |
+
);
|
33 |
+
|
34 |
+
// Exception: When WPML prior 3.2 is used, that instance must be used regardless of another newer instance
|
35 |
+
// Case 1: WPML loaded before Types - eliminate other instances
|
36 |
+
if( defined('ICL_SITEPRESS_VERSION') && version_compare(ICL_SITEPRESS_VERSION, '3.2', '<') ) {
|
37 |
+
foreach($wp_installer_instances as $key => $instance) {
|
38 |
+
if(isset($instance['args']['site_key_nags'])){
|
39 |
+
$wp_installer_instances[$key]['version'] = '9.9';
|
40 |
+
}else{
|
41 |
+
unset($wp_installer_instances[$key]);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
// Only one of these in the end
|
47 |
+
remove_action('after_setup_theme', 'wpml_installer_instance_delegator', 1);
|
48 |
+
add_action('after_setup_theme', 'wpml_installer_instance_delegator', 1);
|
49 |
+
|
50 |
+
// When all plugins load pick the newest version
|
51 |
+
if(!function_exists('wpml_installer_instance_delegator')){
|
52 |
+
function wpml_installer_instance_delegator(){
|
53 |
+
global $wp_installer_instances;
|
54 |
+
|
55 |
+
// version based election
|
56 |
+
foreach($wp_installer_instances as $instance){
|
57 |
+
|
58 |
+
if(!isset($delegate)){
|
59 |
+
$delegate = $instance;
|
60 |
+
continue;
|
61 |
+
}
|
62 |
+
|
63 |
+
if(version_compare($instance['version'], $delegate['version'], '>')){
|
64 |
+
$delegate = $instance;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
// priority based election
|
69 |
+
$highest_priority = null;
|
70 |
+
foreach($wp_installer_instances as $instance) {
|
71 |
+
if(isset($instance['args']['high_priority'])){
|
72 |
+
if(is_null($highest_priority) || $instance['args']['high_priority'] <= $highest_priority){
|
73 |
+
$highest_priority = $instance['args']['high_priority'];
|
74 |
+
$delegate = $instance;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
// Exception: When WPML prior 3.2 is used, that instance must be used regardless of another newer instance
|
80 |
+
// Case 2: WPML loaded after Types
|
81 |
+
if( defined('ICL_SITEPRESS_VERSION') && version_compare(ICL_SITEPRESS_VERSION, '3.2', '<') ) {
|
82 |
+
foreach($wp_installer_instances as $key => $instance) {
|
83 |
+
if(isset($instance['args']['site_key_nags'])){
|
84 |
+
$delegate = $instance;
|
85 |
+
$wp_installer_instances = array($key => $delegate); //Eliminate other instances
|
86 |
+
break;
|
87 |
+
}
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
include_once $delegate['bootfile'];
|
92 |
+
|
93 |
+
// set configuration
|
94 |
+
if(strpos(realpath($delegate['bootfile']), realpath(TEMPLATEPATH)) === 0){
|
95 |
+
$delegate['args']['in_theme_folder'] = dirname(ltrim(str_replace(realpath(TEMPLATEPATH), '', realpath($delegate['bootfile'])), '\\/'));
|
96 |
+
}
|
97 |
+
if(isset($delegate['args']) && is_array($delegate['args'])){
|
98 |
+
foreach($delegate['args'] as $key => $value){
|
99 |
+
WP_Installer()->set_config($key, $value);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
if(!function_exists('WP_Installer_Setup')){
|
107 |
+
|
108 |
+
// $args:
|
109 |
+
// plugins_install_tab = true|false (default: true)
|
110 |
+
// repositories_include = array() (default: all)
|
111 |
+
// repositories_exclude = array() (default: none)
|
112 |
+
// template = name (default: default)
|
113 |
+
//
|
114 |
+
// Ext function
|
115 |
+
function WP_Installer_Setup($wp_installer_instance, $args = array()){
|
116 |
+
global $wp_installer_instances;
|
117 |
+
|
118 |
+
$wp_installer_instances[$wp_installer_instance]['args'] = $args;
|
119 |
+
|
120 |
+
}
|
121 |
+
|
122 |
+
}
|
123 |
+
|
plus/installer/locale/orig/installer.po
CHANGED
@@ -1,230 +1,230 @@
|
|
1 |
-
# This file was generated by WPML
|
2 |
-
# WPML is a WordPress plugin that can turn any WordPress site into a full featured multilingual content management system.
|
3 |
-
# https://wpml.org
|
4 |
-
msgid ""
|
5 |
-
msgstr ""
|
6 |
-
"Content-Type: text/plain; charset=utf-8\n"
|
7 |
-
"Content-Transfer-Encoding: 8bit\n"
|
8 |
-
"Project-Id-Version:WPML_EXPORT\n"
|
9 |
-
"POT-Creation-Date: \n"
|
10 |
-
"PO-Revision-Date: \n"
|
11 |
-
"Last-Translator: \n"
|
12 |
-
"Language-Team: \n"
|
13 |
-
"Language:en\n"
|
14 |
-
"MIME-Version: 1.0\n"
|
15 |
-
|
16 |
-
msgid "Installer"
|
17 |
-
msgstr ""
|
18 |
-
|
19 |
-
msgid "Registered"
|
20 |
-
msgstr ""
|
21 |
-
|
22 |
-
msgid "Register"
|
23 |
-
msgstr ""
|
24 |
-
|
25 |
-
msgid "To get automatic updates, you need to register %s for this site. %sRegister %s%s"
|
26 |
-
msgstr ""
|
27 |
-
|
28 |
-
msgid "Dismiss"
|
29 |
-
msgstr ""
|
30 |
-
|
31 |
-
msgid "Commercial"
|
32 |
-
msgstr ""
|
33 |
-
|
34 |
-
msgid "Installer cannot contact our updates server to get information about the available products and check for new versions. If you are seeing this message for the first time, you can ignore it, as it may be a temporary communication problem. If the problem persists and your WordPress admin is slowing down, you can disable automated version checks. Add the following line to your wp-config.php file:"
|
35 |
-
msgstr ""
|
36 |
-
|
37 |
-
msgid "No repositories defined."
|
38 |
-
msgstr ""
|
39 |
-
|
40 |
-
msgid "%s cannot access %s to register. Try again to see if it's a temporary problem. If the problem continues, make sure that this site has access to the Internet. You can still use the plugin without registration, but you will not receive automated updates."
|
41 |
-
msgstr ""
|
42 |
-
|
43 |
-
msgid "Invalid site key for the current site."
|
44 |
-
msgstr ""
|
45 |
-
|
46 |
-
msgid "You will have to renew your subscription in order to continue getting the updates and support."
|
47 |
-
msgstr ""
|
48 |
-
|
49 |
-
msgid "%sRenew here%s."
|
50 |
-
msgstr ""
|
51 |
-
|
52 |
-
msgid "Your subscription appears to no longer be valid. Please try to register again using a valid site key."
|
53 |
-
msgstr ""
|
54 |
-
|
55 |
-
msgid "You need to have a valid subscription in order to get upgrades or support for this plugin. %sPurchase a subscription or enter an existing site key%s."
|
56 |
-
msgstr ""
|
57 |
-
|
58 |
-
msgid "%s cannot update because your site's registration is not valid. Please %sregister %s%s again for this site first."
|
59 |
-
msgstr ""
|
60 |
-
|
61 |
-
msgid "Update Plugin"
|
62 |
-
msgstr ""
|
63 |
-
|
64 |
-
msgid "Return to the plugins page"
|
65 |
-
msgstr ""
|
66 |
-
|
67 |
-
msgid "Your subscription expires in %d day."
|
68 |
-
msgstr ""
|
69 |
-
|
70 |
-
msgid "Your subscription expires in %d days."
|
71 |
-
msgstr ""
|
72 |
-
|
73 |
-
msgid "Downloading is not possible because WordPress cannot write into the plugins folder. %sHow to fix%s."
|
74 |
-
msgstr ""
|
75 |
-
|
76 |
-
msgid "Plugin"
|
77 |
-
msgstr ""
|
78 |
-
|
79 |
-
msgid "downloading..."
|
80 |
-
msgstr ""
|
81 |
-
|
82 |
-
msgid "failed!"
|
83 |
-
msgstr ""
|
84 |
-
|
85 |
-
msgid "downloaded"
|
86 |
-
msgstr ""
|
87 |
-
|
88 |
-
msgid "activating"
|
89 |
-
msgstr ""
|
90 |
-
|
91 |
-
msgid "activated"
|
92 |
-
msgstr ""
|
93 |
-
|
94 |
-
msgid "Activate after download"
|
95 |
-
msgstr ""
|
96 |
-
|
97 |
-
msgid "Operation complete!"
|
98 |
-
msgstr ""
|
99 |
-
|
100 |
-
msgid "Download failed!\n\nClick OK to revalidate your subscription or CANCEL to try again."
|
101 |
-
msgstr ""
|
102 |
-
|
103 |
-
msgid "Available"
|
104 |
-
msgstr ""
|
105 |
-
|
106 |
-
msgid "Installed"
|
107 |
-
msgstr ""
|
108 |
-
|
109 |
-
msgid "Downloading"
|
110 |
-
msgstr ""
|
111 |
-
|
112 |
-
msgid "Activate"
|
113 |
-
msgstr ""
|
114 |
-
|
115 |
-
msgid "Download"
|
116 |
-
msgstr ""
|
117 |
-
|
118 |
-
msgid "Downloads:"
|
119 |
-
msgstr ""
|
120 |
-
|
121 |
-
msgid "Current version"
|
122 |
-
msgstr ""
|
123 |
-
|
124 |
-
msgid "Released"
|
125 |
-
msgstr ""
|
126 |
-
|
127 |
-
msgid "Installed version"
|
128 |
-
msgstr ""
|
129 |
-
|
130 |
-
msgid "(embedded)"
|
131 |
-
msgstr ""
|
132 |
-
|
133 |
-
msgid "installing..."
|
134 |
-
msgstr ""
|
135 |
-
|
136 |
-
msgid "updating..."
|
137 |
-
msgstr ""
|
138 |
-
|
139 |
-
msgid "installed"
|
140 |
-
msgstr ""
|
141 |
-
|
142 |
-
msgid "updated"
|
143 |
-
msgstr ""
|
144 |
-
|
145 |
-
msgid "Download failed!\n\nPlease refresh the page and try again."
|
146 |
-
msgstr ""
|
147 |
-
|
148 |
-
msgid "Incorrect setup"
|
149 |
-
msgstr ""
|
150 |
-
|
151 |
-
msgid "Invalid product"
|
152 |
-
msgstr ""
|
153 |
-
|
154 |
-
msgid "Unknown repository"
|
155 |
-
msgstr ""
|
156 |
-
|
157 |
-
msgid " Your current site key (%s) does not match the selected product (%s)."
|
158 |
-
msgstr ""
|
159 |
-
|
160 |
-
msgid "Buy %s"
|
161 |
-
msgstr ""
|
162 |
-
|
163 |
-
msgid "Already bought %s?"
|
164 |
-
msgstr ""
|
165 |
-
|
166 |
-
msgid "Renew %s"
|
167 |
-
msgstr ""
|
168 |
-
|
169 |
-
msgid "Remove current site key (%s)"
|
170 |
-
msgstr ""
|
171 |
-
|
172 |
-
msgid "%s support on wpml.org"
|
173 |
-
msgstr ""
|
174 |
-
|
175 |
-
msgid "Enter site key"
|
176 |
-
msgstr ""
|
177 |
-
|
178 |
-
msgid "Subscription is expired."
|
179 |
-
msgstr ""
|
180 |
-
|
181 |
-
msgid "Add"
|
182 |
-
msgstr ""
|
183 |
-
|
184 |
-
msgid "Are you sure you want to remove this site key?"
|
185 |
-
msgstr ""
|
186 |
-
|
187 |
-
msgid "Register %s"
|
188 |
-
msgstr ""
|
189 |
-
|
190 |
-
msgid "1. Go to your %s%s account%s and add this site URL: %s"
|
191 |
-
msgstr ""
|
192 |
-
|
193 |
-
msgid "Unregister %s from this site"
|
194 |
-
msgstr ""
|
195 |
-
|
196 |
-
msgid "%s is registered on this site. You will receive automatic updates until %s"
|
197 |
-
msgstr ""
|
198 |
-
|
199 |
-
msgid "%s is registered on this site. Your Lifetime account gives you updates for life."
|
200 |
-
msgstr ""
|
201 |
-
|
202 |
-
msgid "This page lets you install plugins and update existing plugins. To remove any of these plugins, go to the %splugins%s page and if you have the permission to remove plugins you should be able to do this."
|
203 |
-
msgstr ""
|
204 |
-
|
205 |
-
msgid "Already bought?"
|
206 |
-
msgstr ""
|
207 |
-
|
208 |
-
msgid "2. Enter your site key"
|
209 |
-
msgstr ""
|
210 |
-
|
211 |
-
msgid "Subscription is expired. You need to either purchase a new subscription or upgrade if available."
|
212 |
-
msgstr ""
|
213 |
-
|
214 |
-
msgid "Check for updates"
|
215 |
-
msgstr ""
|
216 |
-
|
217 |
-
msgid "Individual components"
|
218 |
-
msgstr ""
|
219 |
-
|
220 |
-
msgid "OK"
|
221 |
-
msgstr ""
|
222 |
-
|
223 |
-
msgid "Cancel"
|
224 |
-
msgstr ""
|
225 |
-
|
226 |
-
msgid "Are you sure you want to unregister?"
|
227 |
-
msgstr ""
|
228 |
-
|
229 |
-
msgid "Click to see individual components options."
|
230 |
-
msgstr ""
|
1 |
+
# This file was generated by WPML
|
2 |
+
# WPML is a WordPress plugin that can turn any WordPress site into a full featured multilingual content management system.
|
3 |
+
# https://wpml.org
|
4 |
+
msgid ""
|
5 |
+
msgstr ""
|
6 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
7 |
+
"Content-Transfer-Encoding: 8bit\n"
|
8 |
+
"Project-Id-Version:WPML_EXPORT\n"
|
9 |
+
"POT-Creation-Date: \n"
|
10 |
+
"PO-Revision-Date: \n"
|
11 |
+
"Last-Translator: \n"
|
12 |
+
"Language-Team: \n"
|
13 |
+
"Language:en\n"
|
14 |
+
"MIME-Version: 1.0\n"
|
15 |
+
|
16 |
+
msgid "Installer"
|
17 |
+
msgstr ""
|
18 |
+
|
19 |
+
msgid "Registered"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
msgid "Register"
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
msgid "To get automatic updates, you need to register %s for this site. %sRegister %s%s"
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
msgid "Dismiss"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
msgid "Commercial"
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
msgid "Installer cannot contact our updates server to get information about the available products and check for new versions. If you are seeing this message for the first time, you can ignore it, as it may be a temporary communication problem. If the problem persists and your WordPress admin is slowing down, you can disable automated version checks. Add the following line to your wp-config.php file:"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
msgid "No repositories defined."
|
38 |
+
msgstr ""
|
39 |
+
|
40 |
+
msgid "%s cannot access %s to register. Try again to see if it's a temporary problem. If the problem continues, make sure that this site has access to the Internet. You can still use the plugin without registration, but you will not receive automated updates."
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
msgid "Invalid site key for the current site."
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
msgid "You will have to renew your subscription in order to continue getting the updates and support."
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
msgid "%sRenew here%s."
|
50 |
+
msgstr ""
|
51 |
+
|
52 |
+
msgid "Your subscription appears to no longer be valid. Please try to register again using a valid site key."
|
53 |
+
msgstr ""
|
54 |
+
|
55 |
+
msgid "You need to have a valid subscription in order to get upgrades or support for this plugin. %sPurchase a subscription or enter an existing site key%s."
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
msgid "%s cannot update because your site's registration is not valid. Please %sregister %s%s again for this site first."
|
59 |
+
msgstr ""
|
60 |
+
|
61 |
+
msgid "Update Plugin"
|
62 |
+
msgstr ""
|
63 |
+
|
64 |
+
msgid "Return to the plugins page"
|
65 |
+
msgstr ""
|
66 |
+
|
67 |
+
msgid "Your subscription expires in %d day."
|
68 |
+
msgstr ""
|
69 |
+
|
70 |
+
msgid "Your subscription expires in %d days."
|
71 |
+
msgstr ""
|
72 |
+
|
73 |
+
msgid "Downloading is not possible because WordPress cannot write into the plugins folder. %sHow to fix%s."
|
74 |
+
msgstr ""
|
75 |
+
|
76 |
+
msgid "Plugin"
|
77 |
+
msgstr ""
|
78 |
+
|
79 |
+
msgid "downloading..."
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
msgid "failed!"
|
83 |
+
msgstr ""
|
84 |
+
|
85 |
+
msgid "downloaded"
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
msgid "activating"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
msgid "activated"
|
92 |
+
msgstr ""
|
93 |
+
|
94 |
+
msgid "Activate after download"
|
95 |
+
msgstr ""
|
96 |
+
|
97 |
+
msgid "Operation complete!"
|
98 |
+
msgstr ""
|
99 |
+
|
100 |
+
msgid "Download failed!\n\nClick OK to revalidate your subscription or CANCEL to try again."
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
msgid "Available"
|
104 |
+
msgstr ""
|
105 |
+
|
106 |
+
msgid "Installed"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
msgid "Downloading"
|
110 |
+
msgstr ""
|
111 |
+
|
112 |
+
msgid "Activate"
|
113 |
+
msgstr ""
|
114 |
+
|
115 |
+
msgid "Download"
|
116 |
+
msgstr ""
|
117 |
+
|
118 |
+
msgid "Downloads:"
|
119 |
+
msgstr ""
|
120 |
+
|
121 |
+
msgid "Current version"
|
122 |
+
msgstr ""
|
123 |
+
|
124 |
+
msgid "Released"
|
125 |
+
msgstr ""
|
126 |
+
|
127 |
+
msgid "Installed version"
|
128 |
+
msgstr ""
|
129 |
+
|
130 |
+
msgid "(embedded)"
|
131 |
+
msgstr ""
|
132 |
+
|
133 |
+
msgid "installing..."
|
134 |
+
msgstr ""
|
135 |
+
|
136 |
+
msgid "updating..."
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
msgid "installed"
|
140 |
+
msgstr ""
|
141 |
+
|
142 |
+
msgid "updated"
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
msgid "Download failed!\n\nPlease refresh the page and try again."
|
146 |
+
msgstr ""
|
147 |
+
|
148 |
+
msgid "Incorrect setup"
|
149 |
+
msgstr ""
|
150 |
+
|
151 |
+
msgid "Invalid product"
|
152 |
+
msgstr ""
|
153 |
+
|
154 |
+
msgid "Unknown repository"
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
msgid " Your current site key (%s) does not match the selected product (%s)."
|
158 |
+
msgstr ""
|
159 |
+
|
160 |
+
msgid "Buy %s"
|
161 |
+
msgstr ""
|
162 |
+
|
163 |
+
msgid "Already bought %s?"
|
164 |
+
msgstr ""
|
165 |
+
|
166 |
+
msgid "Renew %s"
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
msgid "Remove current site key (%s)"
|
170 |
+
msgstr ""
|
171 |
+
|
172 |
+
msgid "%s support on wpml.org"
|
173 |
+
msgstr ""
|
174 |
+
|
175 |
+
msgid "Enter site key"
|
176 |
+
msgstr ""
|
177 |
+
|
178 |
+
msgid "Subscription is expired."
|
179 |
+
msgstr ""
|
180 |
+
|
181 |
+
msgid "Add"
|
182 |
+
msgstr ""
|
183 |
+
|
184 |
+
msgid "Are you sure you want to remove this site key?"
|
185 |
+
msgstr ""
|
186 |
+
|
187 |
+
msgid "Register %s"
|
188 |
+
msgstr ""
|
189 |
+
|
190 |
+
msgid "1. Go to your %s%s account%s and add this site URL: %s"
|
191 |
+
msgstr ""
|
192 |
+
|
193 |
+
msgid "Unregister %s from this site"
|
194 |
+
msgstr ""
|
195 |
+
|
196 |
+
msgid "%s is registered on this site. You will receive automatic updates until %s"
|
197 |
+
msgstr ""
|
198 |
+
|
199 |
+
msgid "%s is registered on this site. Your Lifetime account gives you updates for life."
|
200 |
+
msgstr ""
|
201 |
+
|
202 |
+
msgid "This page lets you install plugins and update existing plugins. To remove any of these plugins, go to the %splugins%s page and if you have the permission to remove plugins you should be able to do this."
|
203 |
+
msgstr ""
|
204 |
+
|
205 |
+
msgid "Already bought?"
|
206 |
+
msgstr ""
|
207 |
+
|
208 |
+
msgid "2. Enter your site key"
|
209 |
+
msgstr ""
|
210 |
+
|
211 |
+
msgid "Subscription is expired. You need to either purchase a new subscription or upgrade if available."
|
212 |
+
msgstr ""
|
213 |
+
|
214 |
+
msgid "Check for updates"
|
215 |
+
msgstr ""
|
216 |
+
|
217 |
+
msgid "Individual components"
|
218 |
+
msgstr ""
|
219 |
+
|
220 |
+
msgid "OK"
|
221 |
+
msgstr ""
|
222 |
+
|
223 |
+
msgid "Cancel"
|
224 |
+
msgstr ""
|
225 |
+
|
226 |
+
msgid "Are you sure you want to unregister?"
|
227 |
+
msgstr ""
|
228 |
+
|
229 |
+
msgid "Click to see individual components options."
|
230 |
+
msgstr ""
|
plus/installer/repositories.xml
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
-
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<repositories>
|
3 |
-
<repository>
|
4 |
-
<id>wpml</id>
|
5 |
-
<apiurl>http://api.wpml.org/</apiurl>
|
6 |
-
<products>http://d2salfytceyqoe.cloudfront.net/wpml32-products.json</products>
|
7 |
-
</repository>
|
8 |
-
<repository>
|
9 |
-
<id>toolset</id>
|
10 |
-
<apiurl>http://api.wp-types.com/</apiurl>
|
11 |
-
<products>http://d7j863fr5jhrr.cloudfront.net/toolset-products.json</products>
|
12 |
-
</repository>
|
13 |
-
</repositories>
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<repositories>
|
3 |
+
<repository>
|
4 |
+
<id>wpml</id>
|
5 |
+
<apiurl>http://api.wpml.org/</apiurl>
|
6 |
+
<products>http://d2salfytceyqoe.cloudfront.net/wpml32-products.json</products>
|
7 |
+
</repository>
|
8 |
+
<repository>
|
9 |
+
<id>toolset</id>
|
10 |
+
<apiurl>http://api.wp-types.com/</apiurl>
|
11 |
+
<products>http://d7j863fr5jhrr.cloudfront.net/toolset-products.json</products>
|
12 |
+
</repository>
|
13 |
+
</repositories>
|
plus/installer/res/css/admin.css
CHANGED
@@ -1,153 +1,167 @@
|
|
1 |
-
.otgsi_site_key_form{
|
2 |
-
display:none;
|
3 |
-
/*display:inline;*/
|
4 |
-
}
|
5 |
-
|
6 |
-
.installer-status-installing, .installer-status-installed, .installer-status-updating, .installer-status-updated, .installer-status-activating, .installer-status-activated, .installer-status-success{
|
7 |
-
display: none;
|
8 |
-
}
|
9 |
-
.installer-status-installing{color: #FF9900; }
|
10 |
-
.installer-status-installed{color: #003300; font-weight: bold; }
|
11 |
-
.installer-status-updating{color: #FF9900; }
|
12 |
-
.installer-status-updated{color: #003300; font-weight: bold; }
|
13 |
-
|
14 |
-
.installer-status-activating{color: #996666 }
|
15 |
-
.installer-status-activated{color: #333366; font-weight: bold; }
|
16 |
-
|
17 |
-
.js-status-success p{
|
18 |
-
color: #FF9900;
|
19 |
-
padding: 4px;
|
20 |
-
}
|
21 |
-
|
22 |
-
.installer-green-text{
|
23 |
-
color:#006600;
|
24 |
-
font-weight:bold;
|
25 |
-
}
|
26 |
-
|
27 |
-
.installer-red-text{
|
28 |
-
color:#b22121;
|
29 |
-
font-weight:bold;
|
30 |
-
}
|
31 |
-
|
32 |
-
.installer-products-list li{
|
33 |
-
display: inline;
|
34 |
-
margin-right: 20px;
|
35 |
-
}
|
36 |
-
|
37 |
-
.otgs_wp_installer_table a.disabled{
|
38 |
-
color:#888;
|
39 |
-
}
|
40 |
-
|
41 |
-
.otgs_wp_installer_subtable{
|
42 |
-
clear: both;
|
43 |
-
margin-left:-20px;
|
44 |
-
}
|
45 |
-
.otgs_wp_installer_subtable td p{
|
46 |
-
font-size: 92%;
|
47 |
-
}
|
48 |
-
|
49 |
-
.installer-status-error{
|
50 |
-
color: #f00;
|
51 |
-
}
|
52 |
-
|
53 |
-
.installer-status-note{
|
54 |
-
color: #6F6E6D;
|
55 |
-
font-style: italic;
|
56 |
-
}
|
57 |
-
|
58 |
-
.installer-warn-box{
|
59 |
-
-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;border:1px solid #962722;background-color:#F5C8C6;
|
60 |
-
color: #333;
|
61 |
-
padding: 5px;
|
62 |
-
}
|
63 |
-
|
64 |
-
.installer-error-box p{
|
65 |
-
margin: 10px 0 10px 0;
|
66 |
-
-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;border:1px solid #962722;background-color:#F5C8C6;
|
67 |
-
color: #333;
|
68 |
-
padding: 5px;
|
69 |
-
text-align: center;
|
70 |
-
}
|
71 |
-
|
72 |
-
|
73 |
-
.spinner-inline{
|
74 |
-
float: none;
|
75 |
-
display: inline-block;
|
76 |
-
}
|
77 |
-
|
78 |
-
.installer-q-icon:before{
|
79 |
-
content: '\f223' !important;
|
80 |
-
}
|
81 |
-
|
82 |
-
.otgsi_yellow_bg{
|
83 |
-
background-color: #f2f46b;
|
84 |
-
}
|
85 |
-
|
86 |
-
.otgs_wp_installer_table_compact{
|
87 |
-
width:480px;
|
88 |
-
border: solid 1px #999;
|
89 |
-
padding:10px;
|
90 |
-
border-radius: 5px;
|
91 |
-
}
|
92 |
-
|
93 |
-
.installer-plugins-list-compact{
|
94 |
-
background-color: #fff;
|
95 |
-
border-collapse: collapse;
|
96 |
-
border:solid 1px #C1DAD7;
|
97 |
-
width:100%;
|
98 |
-
}
|
99 |
-
|
100 |
-
.installer-plugins-list-compact tr th{
|
101 |
-
padding-top:3px;
|
102 |
-
background-color: #ccc;
|
103 |
-
}
|
104 |
-
|
105 |
-
.installer-plugins-list-compact tr{
|
106 |
-
background-color: #ddd;
|
107 |
-
}
|
108 |
-
|
109 |
-
.installer-plugins-list-compact tr.even{
|
110 |
-
background-color: #eee;
|
111 |
-
}
|
112 |
-
|
113 |
-
.installer-plugins-list-compact td{
|
114 |
-
padding:2px 5px 2px 5px;
|
115 |
-
border-right: 1px solid #C1DAD7;
|
116 |
-
border-bottom: 1px solid #C1DAD7;
|
117 |
-
}
|
118 |
-
|
119 |
-
.installer-plugins-list-compact td.twelve{
|
120 |
-
width:16px;
|
121 |
-
}
|
122 |
-
|
123 |
-
.otgs_wp_installer_table_compact .installer-status-downloading,
|
124 |
-
.otgs_wp_installer_table_compact .installer-status-downloaded,
|
125 |
-
.otgs_wp_installer_table_compact .installer-status-activating,
|
126 |
-
.otgs_wp_installer_table_compact .installer-status-activated{
|
127 |
-
display: none;
|
128 |
-
color:transparent; width: 12px; padding:2px;
|
129 |
-
}
|
130 |
-
|
131 |
-
.otgs_wp_installer_table_compact .installer-status-success,
|
132 |
-
.otgs_wp_installer_table_compact .installer-status-fail{
|
133 |
-
display: none;
|
134 |
-
}
|
135 |
-
|
136 |
-
.
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
.
|
143 |
-
|
144 |
-
}
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
color: #
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
}
|
1 |
+
.otgsi_site_key_form{
|
2 |
+
display:none;
|
3 |
+
/*display:inline;*/
|
4 |
+
}
|
5 |
+
|
6 |
+
.installer-status-installing, .installer-status-installed, .installer-status-updating, .installer-status-updated, .installer-status-activating, .installer-status-activated, .installer-status-success{
|
7 |
+
display: none;
|
8 |
+
}
|
9 |
+
.installer-status-installing{color: #FF9900; }
|
10 |
+
.installer-status-installed{color: #003300; font-weight: bold; }
|
11 |
+
.installer-status-updating{color: #FF9900; }
|
12 |
+
.installer-status-updated{color: #003300; font-weight: bold; }
|
13 |
+
|
14 |
+
.installer-status-activating{color: #996666 }
|
15 |
+
.installer-status-activated{color: #333366; font-weight: bold; }
|
16 |
+
|
17 |
+
.js-status-success p{
|
18 |
+
color: #FF9900;
|
19 |
+
padding: 4px;
|
20 |
+
}
|
21 |
+
|
22 |
+
.installer-green-text{
|
23 |
+
color:#006600;
|
24 |
+
font-weight:bold;
|
25 |
+
}
|
26 |
+
|
27 |
+
.installer-red-text{
|
28 |
+
color:#b22121;
|
29 |
+
font-weight:bold;
|
30 |
+
}
|
31 |
+
|
32 |
+
.installer-products-list li{
|
33 |
+
display: inline;
|
34 |
+
margin-right: 20px;
|
35 |
+
}
|
36 |
+
|
37 |
+
.otgs_wp_installer_table a.disabled{
|
38 |
+
color:#888;
|
39 |
+
}
|
40 |
+
|
41 |
+
.otgs_wp_installer_subtable{
|
42 |
+
clear: both;
|
43 |
+
margin-left:-20px;
|
44 |
+
}
|
45 |
+
.otgs_wp_installer_subtable td p{
|
46 |
+
font-size: 92%;
|
47 |
+
}
|
48 |
+
|
49 |
+
.installer-status-error{
|
50 |
+
color: #f00;
|
51 |
+
}
|
52 |
+
|
53 |
+
.installer-status-note{
|
54 |
+
color: #6F6E6D;
|
55 |
+
font-style: italic;
|
56 |
+
}
|
57 |
+
|
58 |
+
.installer-warn-box{
|
59 |
+
-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;border:1px solid #962722;background-color:#F5C8C6;
|
60 |
+
color: #333;
|
61 |
+
padding: 5px;
|
62 |
+
}
|
63 |
+
|
64 |
+
.installer-error-box p{
|
65 |
+
margin: 10px 0 10px 0;
|
66 |
+
-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;border:1px solid #962722;background-color:#F5C8C6;
|
67 |
+
color: #333;
|
68 |
+
padding: 5px;
|
69 |
+
text-align: center;
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
.spinner-inline{
|
74 |
+
float: none;
|
75 |
+
display: inline-block;
|
76 |
+
}
|
77 |
+
|
78 |
+
.installer-q-icon:before{
|
79 |
+
content: '\f223' !important;
|
80 |
+
}
|
81 |
+
|
82 |
+
.otgsi_yellow_bg{
|
83 |
+
background-color: #f2f46b;
|
84 |
+
}
|
85 |
+
|
86 |
+
.otgs_wp_installer_table_compact{
|
87 |
+
width:480px;
|
88 |
+
border: solid 1px #999;
|
89 |
+
padding:10px;
|
90 |
+
border-radius: 5px;
|
91 |
+
}
|
92 |
+
|
93 |
+
.installer-plugins-list-compact{
|
94 |
+
background-color: #fff;
|
95 |
+
border-collapse: collapse;
|
96 |
+
border:solid 1px #C1DAD7;
|
97 |
+
width:100%;
|
98 |
+
}
|
99 |
+
|
100 |
+
.installer-plugins-list-compact tr th{
|
101 |
+
padding-top:3px;
|
102 |
+
background-color: #ccc;
|
103 |
+
}
|
104 |
+
|
105 |
+
.installer-plugins-list-compact tr{
|
106 |
+
background-color: #ddd;
|
107 |
+
}
|
108 |
+
|
109 |
+
.installer-plugins-list-compact tr.even{
|
110 |
+
background-color: #eee;
|
111 |
+
}
|
112 |
+
|
113 |
+
.installer-plugins-list-compact td{
|
114 |
+
padding:2px 5px 2px 5px;
|
115 |
+
border-right: 1px solid #C1DAD7;
|
116 |
+
border-bottom: 1px solid #C1DAD7;
|
117 |
+
}
|
118 |
+
|
119 |
+
.installer-plugins-list-compact td.twelve{
|
120 |
+
width:16px;
|
121 |
+
}
|
122 |
+
|
123 |
+
.otgs_wp_installer_table_compact .installer-status-downloading,
|
124 |
+
.otgs_wp_installer_table_compact .installer-status-downloaded,
|
125 |
+
.otgs_wp_installer_table_compact .installer-status-activating,
|
126 |
+
.otgs_wp_installer_table_compact .installer-status-activated{
|
127 |
+
display: none;
|
128 |
+
color:transparent; width: 12px; padding:2px;
|
129 |
+
}
|
130 |
+
|
131 |
+
.otgs_wp_installer_table_compact .installer-status-success,
|
132 |
+
.otgs_wp_installer_table_compact .installer-status-fail{
|
133 |
+
display: none;
|
134 |
+
}
|
135 |
+
|
136 |
+
.installer-status-success{
|
137 |
+
float: right;
|
138 |
+
color: #006600;
|
139 |
+
}
|
140 |
+
|
141 |
+
.otgs_wp_installer_table_compact .installer-status-downloading{background: url(../img/dn.gif) no-repeat center; }
|
142 |
+
.otgs_wp_installer_table_compact .installer-status-downloaded{background: url(../img/complete.png) no-repeat center;}
|
143 |
+
.otgs_wp_installer_table_compact .installer-status-activating{background: url(../img/dn.gif) no-repeat center; }
|
144 |
+
.otgs_wp_installer_table_compact .installer-status-activated{background: url(../img/complete.png) no-repeat center; }
|
145 |
+
.otgs_wp_installer_table_compact .installer-status-error{background: url(../img/icon_error.gif) no-repeat center; }
|
146 |
+
|
147 |
+
.installer_highlight{
|
148 |
+
color:#c5510b;
|
149 |
+
}
|
150 |
+
|
151 |
+
.installer_highlight_package{
|
152 |
+
background-color: #fff9c0;
|
153 |
+
}
|
154 |
+
|
155 |
+
.plugin_progress{
|
156 |
+
font-style: italic;
|
157 |
+
color: #777
|
158 |
+
}
|
159 |
+
|
160 |
+
.installer-download-progress-status{
|
161 |
+
display: none;
|
162 |
+
float:right;
|
163 |
+
color: #006600;
|
164 |
+
font-style: italic;
|
165 |
+
background: url('../img/spinner.gif') no-repeat;
|
166 |
+
padding-left:24px;
|
167 |
}
|
plus/installer/res/img/spinner.gif
ADDED
Binary file
|
plus/installer/res/js/admin.js
CHANGED
@@ -1,367 +1,391 @@
|
|
1 |
-
var otgs_wp_installer = {
|
2 |
-
|
3 |
-
init: function(){
|
4 |
-
|
5 |
-
jQuery('.otgs_wp_installer_table').on('click', '.enter_site_key_js', otgs_wp_installer.show_site_key_form);
|
6 |
-
jQuery('.otgs_wp_installer_table').on('click', '.cancel_site_key_js', otgs_wp_installer.hide_site_key_form);
|
7 |
-
|
8 |
-
jQuery('.otgs_wp_installer_table').on('click', '.remove_site_key_js', otgs_wp_installer.remove_site_key);
|
9 |
-
jQuery('.otgs_wp_installer_table').on('click', '.update_site_key_js', otgs_wp_installer.update_site_key);
|
10 |
-
|
11 |
-
jQuery('.otgs_wp_installer_table').on('submit', '.otgsi_site_key_form', otgs_wp_installer.save_site_key);
|
12 |
-
jQuery('.otgs_wp_installer_table').on('submit', '.otgsi_downloads_form', otgs_wp_installer.download_downloads);
|
13 |
-
jQuery('.otgs_wp_installer_table').on('change', '.otgsi_downloads_form :checkbox[name="downloads[]"]', otgs_wp_installer.update_downloads_form);
|
14 |
-
|
15 |
-
jQuery('.installer-dismiss-nag').click(otgs_wp_installer.dismiss_nag);
|
16 |
-
|
17 |
-
jQuery('.otgs_wp_installer_table').on('click', '.installer_expand_button', otgs_wp_installer.toggle_subpackages);
|
18 |
-
|
19 |
-
otgs_wp_installer.scroll_to_repository();
|
20 |
-
|
21 |
-
if( typeof pagenow != 'undefined' && pagenow == 'plugins'){
|
22 |
-
|
23 |
-
jQuery(document).ajaxSuccess(function(event, xhr, settings) {
|
24 |
-
var data = otgs_wp_installer.getQueryParameters(settings.data);
|
25 |
-
if(typeof data.action != 'undefined' && data.action == 'update-plugin'){
|
26 |
-
response = xhr.responseJSON.data;
|
27 |
-
console.log(typeof response.error);
|
28 |
-
if(typeof response.error != 'undefined'){
|
29 |
-
var default_error = jQuery('#' + response.slug + '-update .update-message').html();
|
30 |
-
jQuery('#' + response.slug + '-update .update-message').html(default_error + ' »<span class="installer-red-text"> ' + response.error + '</span>');
|
31 |
-
}
|
32 |
-
}
|
33 |
-
return false;
|
34 |
-
});
|
35 |
-
|
36 |
-
}
|
37 |
-
|
38 |
-
},
|
39 |
-
|
40 |
-
getQueryParameters : function(str) {
|
41 |
-
return (str || document.location.search).replace(/(^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0];
|
42 |
-
},
|
43 |
-
|
44 |
-
reset_errors: function(){
|
45 |
-
jQuery('.installer-error-box').html('').hide();
|
46 |
-
},
|
47 |
-
|
48 |
-
show_error: function(repo, text){
|
49 |
-
jQuery('#installer_repo_' + repo).find('.installer-error-box').html(text).show();
|
50 |
-
},
|
51 |
-
|
52 |
-
show_site_key_form: function(){
|
53 |
-
otgs_wp_installer.reset_errors();
|
54 |
-
|
55 |
-
var form = jQuery(this).parent().find('form.otgsi_site_key_form');
|
56 |
-
jQuery(this).prev().hide();
|
57 |
-
jQuery(this).hide();
|
58 |
-
form.css('display', 'inline');
|
59 |
-
form.find('input[name^=site_key_]').focus().val('');
|
60 |
-
form.find('input').removeAttr('disabled');
|
61 |
-
|
62 |
-
form.closest('.otgsi_register_product_wrap').addClass('otgsi_yellow_bg');
|
63 |
-
|
64 |
-
return false;
|
65 |
-
},
|
66 |
-
|
67 |
-
hide_site_key_form: function(){
|
68 |
-
var form = jQuery(this).closest('form');
|
69 |
-
form.hide();
|
70 |
-
form.parent().find('.enter_site_key_js').show();
|
71 |
-
form.parent().find('.enter_site_key_js').prev().show();
|
72 |
-
|
73 |
-
form.closest('.otgsi_register_product_wrap').removeClass('otgsi_yellow_bg');
|
74 |
-
return false;
|
75 |
-
},
|
76 |
-
|
77 |
-
save_site_key: function(){
|
78 |
-
|
79 |
-
var thisf = jQuery(this);
|
80 |
-
var data = jQuery(this).serialize();
|
81 |
-
jQuery(this).find('input').attr('disabled', 'disabled');
|
82 |
-
|
83 |
-
var spinner = jQuery('<span class="spinner"></span>');
|
84 |
-
spinner.css({display: 'inline-block', float: 'none'}).prependTo(jQuery(this));
|
85 |
-
|
86 |
-
otgs_wp_installer.reset_errors();
|
87 |
-
|
88 |
-
jQuery.ajax({url: ajaxurl, type: 'POST', dataType:'json', data: data, success:
|
89 |
-
function(ret){
|
90 |
-
if(!ret.error){
|
91 |
-
otgs_wp_installer.saved_site_key();
|
92 |
-
}else{
|
93 |
-
otgs_wp_installer.show_error(thisf.find('[name=repository_id]').val(), ret.error);
|
94 |
-
thisf.find('input').removeAttr('disabled');
|
95 |
-
}
|
96 |
-
|
97 |
-
if(typeof ret.debug != 'undefined'){
|
98 |
-
thisf.append('<textarea style="width:100%" rows="20">' + ret.debug + '</textarea>');
|
99 |
-
}
|
100 |
-
|
101 |
-
spinner.remove();
|
102 |
-
}
|
103 |
-
});
|
104 |
-
|
105 |
-
return false;
|
106 |
-
|
107 |
-
},
|
108 |
-
|
109 |
-
saved_site_key: function(){
|
110 |
-
location.reload();
|
111 |
-
},
|
112 |
-
|
113 |
-
remove_site_key: function(){
|
114 |
-
|
115 |
-
if(confirm(jQuery(this).data('confirmation'))){
|
116 |
-
|
117 |
-
jQuery('<span class="spinner"></span>').css({display: 'inline-block', float: 'none'}).prependTo(jQuery(this).parent());
|
118 |
-
data = {action: 'remove_site_key', repository_id: jQuery(this).data('repository'), nonce: jQuery(this).data('nonce')}
|
119 |
-
jQuery.ajax({url: ajaxurl, type: 'POST', data: data, success: otgs_wp_installer.removed_site_key});
|
120 |
-
}
|
121 |
-
|
122 |
-
return false;
|
123 |
-
},
|
124 |
-
|
125 |
-
removed_site_key: function(){
|
126 |
-
location.reload();
|
127 |
-
},
|
128 |
-
|
129 |
-
update_site_key: function(){
|
130 |
-
|
131 |
-
var spinner = jQuery('<span class="spinner"></span>');
|
132 |
-
spinner.css({display: 'inline-block', float: 'none'}).prependTo(jQuery(this).parent());
|
133 |
-
data = {action: 'update_site_key', repository_id: jQuery(this).data('repository'), nonce: jQuery(this).data('nonce')}
|
134 |
-
jQuery.ajax({
|
135 |
-
url: ajaxurl,
|
136 |
-
type: 'POST',
|
137 |
-
data: data,
|
138 |
-
dataType: 'json',
|
139 |
-
success: function(ret){
|
140 |
-
if(ret.error){
|
141 |
-
alert(ret.error);
|
142 |
-
spinner.remove();
|
143 |
-
}
|
144 |
-
otgs_wp_installer.updated_site_key(ret);
|
145 |
-
}
|
146 |
-
});
|
147 |
-
|
148 |
-
return false;
|
149 |
-
|
150 |
-
},
|
151 |
-
|
152 |
-
updated_site_key: function(ret){
|
153 |
-
location.reload();
|
154 |
-
},
|
155 |
-
|
156 |
-
update_downloads_form: function(){
|
157 |
-
|
158 |
-
var checked = jQuery('.otgsi_downloads_form :checkbox:checked[name="downloads[]"]').length;
|
159 |
-
|
160 |
-
if(checked){
|
161 |
-
jQuery(this).closest('form').find(':submit, :checkbox[name=activate]').removeAttr('disabled');
|
162 |
-
}else{
|
163 |
-
jQuery(this).closest('form').find(':submit, :checkbox[name=activate]').attr('disabled', 'disabled');
|
164 |
-
}
|
165 |
-
|
166 |
-
|
167 |
-
},
|
168 |
-
|
169 |
-
download_downloads: function(){
|
170 |
-
|
171 |
-
var activate = jQuery(this).find(":checkbox:checked[name=activate]").val(),
|
172 |
-
action_button = jQuery(this).find('input[type="submit"]');
|
173 |
-
downloads_form = jQuery(this),
|
174 |
-
idx = 0,
|
175 |
-
checkboxes = [];
|
176 |
-
|
177 |
-
jQuery(this).find(':checkbox:checked[name="downloads[]"]').each(function(){
|
178 |
-
if(jQuery(this).attr('disabled')) return;
|
179 |
-
checkboxes[idx] = jQuery(this);
|
180 |
-
idx++;
|
181 |
-
jQuery(this).attr('disabled', 'disabled');
|
182 |
-
});
|
183 |
-
|
184 |
-
idx = 0;
|
185 |
-
|
186 |
-
if( typeof checkboxes[idx] != 'undefined' ){
|
187 |
-
download_and_activate( checkboxes[idx] );
|
188 |
-
action_button.attr('disabled', 'disabled');
|
189 |
-
}
|
190 |
-
|
191 |
-
function download_and_activate( elem ){
|
192 |
-
|
193 |
-
var this_tr = elem.closest('tr');
|
194 |
-
var is_update = this_tr.find('.installer-red-text').length;
|
195 |
-
if(is_update){
|
196 |
-
var installing = this_tr.find('.installer-status-updating');
|
197 |
-
var installed = this_tr.find('.installer-status-updated');
|
198 |
-
}else{
|
199 |
-
var installing = this_tr.find('.installer-status-installing');
|
200 |
-
var installed = this_tr.find('.installer-status-installed');
|
201 |
-
|
202 |
-
}
|
203 |
-
if(activate){
|
204 |
-
var activating = this_tr.find('.installer-status-activating');
|
205 |
-
var activated = this_tr.find('.installer-status-activated');
|
206 |
-
}
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
}
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
this_tr.find('.
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
jQuery(document).ready(otgs_wp_installer.init);
|
1 |
+
var otgs_wp_installer = {
|
2 |
+
|
3 |
+
init: function(){
|
4 |
+
|
5 |
+
jQuery('.otgs_wp_installer_table').on('click', '.enter_site_key_js', otgs_wp_installer.show_site_key_form);
|
6 |
+
jQuery('.otgs_wp_installer_table').on('click', '.cancel_site_key_js', otgs_wp_installer.hide_site_key_form);
|
7 |
+
|
8 |
+
jQuery('.otgs_wp_installer_table').on('click', '.remove_site_key_js', otgs_wp_installer.remove_site_key);
|
9 |
+
jQuery('.otgs_wp_installer_table').on('click', '.update_site_key_js', otgs_wp_installer.update_site_key);
|
10 |
+
|
11 |
+
jQuery('.otgs_wp_installer_table').on('submit', '.otgsi_site_key_form', otgs_wp_installer.save_site_key);
|
12 |
+
jQuery('.otgs_wp_installer_table').on('submit', '.otgsi_downloads_form', otgs_wp_installer.download_downloads);
|
13 |
+
jQuery('.otgs_wp_installer_table').on('change', '.otgsi_downloads_form :checkbox[name="downloads[]"]', otgs_wp_installer.update_downloads_form);
|
14 |
+
|
15 |
+
jQuery('.installer-dismiss-nag').click(otgs_wp_installer.dismiss_nag);
|
16 |
+
|
17 |
+
jQuery('.otgs_wp_installer_table').on('click', '.installer_expand_button', otgs_wp_installer.toggle_subpackages);
|
18 |
+
|
19 |
+
otgs_wp_installer.scroll_to_repository();
|
20 |
+
|
21 |
+
if( typeof pagenow != 'undefined' && pagenow == 'plugins'){
|
22 |
+
|
23 |
+
jQuery(document).ajaxSuccess(function(event, xhr, settings) {
|
24 |
+
var data = otgs_wp_installer.getQueryParameters(settings.data);
|
25 |
+
if(typeof data.action != 'undefined' && data.action == 'update-plugin'){
|
26 |
+
response = xhr.responseJSON.data;
|
27 |
+
console.log(typeof response.error);
|
28 |
+
if(typeof response.error != 'undefined'){
|
29 |
+
var default_error = jQuery('#' + response.slug + '-update .update-message').html();
|
30 |
+
jQuery('#' + response.slug + '-update .update-message').html(default_error + ' »<span class="installer-red-text"> ' + response.error + '</span>');
|
31 |
+
}
|
32 |
+
}
|
33 |
+
return false;
|
34 |
+
});
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
},
|
39 |
+
|
40 |
+
getQueryParameters : function(str) {
|
41 |
+
return (str || document.location.search).replace(/(^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0];
|
42 |
+
},
|
43 |
+
|
44 |
+
reset_errors: function(){
|
45 |
+
jQuery('.installer-error-box').html('').hide();
|
46 |
+
},
|
47 |
+
|
48 |
+
show_error: function(repo, text){
|
49 |
+
jQuery('#installer_repo_' + repo).find('.installer-error-box').html(text).show();
|
50 |
+
},
|
51 |
+
|
52 |
+
show_site_key_form: function(){
|
53 |
+
otgs_wp_installer.reset_errors();
|
54 |
+
|
55 |
+
var form = jQuery(this).parent().find('form.otgsi_site_key_form');
|
56 |
+
jQuery(this).prev().hide();
|
57 |
+
jQuery(this).hide();
|
58 |
+
form.css('display', 'inline');
|
59 |
+
form.find('input[name^=site_key_]').focus().val('');
|
60 |
+
form.find('input').removeAttr('disabled');
|
61 |
+
|
62 |
+
form.closest('.otgsi_register_product_wrap').addClass('otgsi_yellow_bg');
|
63 |
+
|
64 |
+
return false;
|
65 |
+
},
|
66 |
+
|
67 |
+
hide_site_key_form: function(){
|
68 |
+
var form = jQuery(this).closest('form');
|
69 |
+
form.hide();
|
70 |
+
form.parent().find('.enter_site_key_js').show();
|
71 |
+
form.parent().find('.enter_site_key_js').prev().show();
|
72 |
+
|
73 |
+
form.closest('.otgsi_register_product_wrap').removeClass('otgsi_yellow_bg');
|
74 |
+
return false;
|
75 |
+
},
|
76 |
+
|
77 |
+
save_site_key: function(){
|
78 |
+
|
79 |
+
var thisf = jQuery(this);
|
80 |
+
var data = jQuery(this).serialize();
|
81 |
+
jQuery(this).find('input').attr('disabled', 'disabled');
|
82 |
+
|
83 |
+
var spinner = jQuery('<span class="spinner"></span>');
|
84 |
+
spinner.css({display: 'inline-block', float: 'none'}).prependTo(jQuery(this));
|
85 |
+
|
86 |
+
otgs_wp_installer.reset_errors();
|
87 |
+
|
88 |
+
jQuery.ajax({url: ajaxurl, type: 'POST', dataType:'json', data: data, success:
|
89 |
+
function(ret){
|
90 |
+
if(!ret.error){
|
91 |
+
otgs_wp_installer.saved_site_key();
|
92 |
+
}else{
|
93 |
+
otgs_wp_installer.show_error(thisf.find('[name=repository_id]').val(), ret.error);
|
94 |
+
thisf.find('input').removeAttr('disabled');
|
95 |
+
}
|
96 |
+
|
97 |
+
if(typeof ret.debug != 'undefined'){
|
98 |
+
thisf.append('<textarea style="width:100%" rows="20">' + ret.debug + '</textarea>');
|
99 |
+
}
|
100 |
+
|
101 |
+
spinner.remove();
|
102 |
+
}
|
103 |
+
});
|
104 |
+
|
105 |
+
return false;
|
106 |
+
|
107 |
+
},
|
108 |
+
|
109 |
+
saved_site_key: function(){
|
110 |
+
location.reload();
|
111 |
+
},
|
112 |
+
|
113 |
+
remove_site_key: function(){
|
114 |
+
|
115 |
+
if(confirm(jQuery(this).data('confirmation'))){
|
116 |
+
|
117 |
+
jQuery('<span class="spinner"></span>').css({display: 'inline-block', float: 'none'}).prependTo(jQuery(this).parent());
|
118 |
+
data = {action: 'remove_site_key', repository_id: jQuery(this).data('repository'), nonce: jQuery(this).data('nonce')}
|
119 |
+
jQuery.ajax({url: ajaxurl, type: 'POST', data: data, success: otgs_wp_installer.removed_site_key});
|
120 |
+
}
|
121 |
+
|
122 |
+
return false;
|
123 |
+
},
|
124 |
+
|
125 |
+
removed_site_key: function(){
|
126 |
+
location.reload();
|
127 |
+
},
|
128 |
+
|
129 |
+
update_site_key: function(){
|
130 |
+
|
131 |
+
var spinner = jQuery('<span class="spinner"></span>');
|
132 |
+
spinner.css({display: 'inline-block', float: 'none'}).prependTo(jQuery(this).parent());
|
133 |
+
data = {action: 'update_site_key', repository_id: jQuery(this).data('repository'), nonce: jQuery(this).data('nonce')}
|
134 |
+
jQuery.ajax({
|
135 |
+
url: ajaxurl,
|
136 |
+
type: 'POST',
|
137 |
+
data: data,
|
138 |
+
dataType: 'json',
|
139 |
+
success: function(ret){
|
140 |
+
if(ret.error){
|
141 |
+
alert(ret.error);
|
142 |
+
spinner.remove();
|
143 |
+
}
|
144 |
+
otgs_wp_installer.updated_site_key(ret);
|
145 |
+
}
|
146 |
+
});
|
147 |
+
|
148 |
+
return false;
|
149 |
+
|
150 |
+
},
|
151 |
+
|
152 |
+
updated_site_key: function(ret){
|
153 |
+
location.reload();
|
154 |
+
},
|
155 |
+
|
156 |
+
update_downloads_form: function(){
|
157 |
+
|
158 |
+
var checked = jQuery('.otgsi_downloads_form :checkbox:checked[name="downloads[]"]').length;
|
159 |
+
|
160 |
+
if(checked){
|
161 |
+
jQuery(this).closest('form').find(':submit, :checkbox[name=activate]').removeAttr('disabled');
|
162 |
+
}else{
|
163 |
+
jQuery(this).closest('form').find(':submit, :checkbox[name=activate]').attr('disabled', 'disabled');
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
},
|
168 |
+
|
169 |
+
download_downloads: function(){
|
170 |
+
|
171 |
+
var activate = jQuery(this).find(":checkbox:checked[name=activate]").val(),
|
172 |
+
action_button = jQuery(this).find('input[type="submit"]');
|
173 |
+
downloads_form = jQuery(this),
|
174 |
+
idx = 0,
|
175 |
+
checkboxes = [];
|
176 |
+
|
177 |
+
jQuery(this).find(':checkbox:checked[name="downloads[]"]').each(function(){
|
178 |
+
if(jQuery(this).attr('disabled')) return;
|
179 |
+
checkboxes[idx] = jQuery(this);
|
180 |
+
idx++;
|
181 |
+
jQuery(this).attr('disabled', 'disabled');
|
182 |
+
});
|
183 |
+
|
184 |
+
idx = 0;
|
185 |
+
|
186 |
+
if( typeof checkboxes[idx] != 'undefined' ){
|
187 |
+
download_and_activate( checkboxes[idx] );
|
188 |
+
action_button.attr('disabled', 'disabled');
|
189 |
+
}
|
190 |
+
|
191 |
+
function download_and_activate( elem ){
|
192 |
+
|
193 |
+
var this_tr = elem.closest('tr');
|
194 |
+
var is_update = this_tr.find('.installer-red-text').length;
|
195 |
+
if(is_update){
|
196 |
+
var installing = this_tr.find('.installer-status-updating');
|
197 |
+
var installed = this_tr.find('.installer-status-updated');
|
198 |
+
}else{
|
199 |
+
var installing = this_tr.find('.installer-status-installing');
|
200 |
+
var installed = this_tr.find('.installer-status-installed');
|
201 |
+
|
202 |
+
}
|
203 |
+
if(activate){
|
204 |
+
var activating = this_tr.find('.installer-status-activating');
|
205 |
+
var activated = this_tr.find('.installer-status-activated');
|
206 |
+
}
|
207 |
+
|
208 |
+
if( this_tr.find('.for_spinner_js .spinner').length > 0 ){
|
209 |
+
var spinner = this_tr.find('.for_spinner_js .spinner');
|
210 |
+
}else{
|
211 |
+
var spinner = this_tr.find('.installer-status-downloading');
|
212 |
+
}
|
213 |
+
|
214 |
+
otgs_wp_installer.reset_errors();
|
215 |
+
downloads_form.find('div.installer-status-success').hide();
|
216 |
+
spinner.css('visibility', 'visible');
|
217 |
+
installing.show();
|
218 |
+
|
219 |
+
var plugin_name = this_tr.find('.installer_plugin_name').html();
|
220 |
+
if(is_update){
|
221 |
+
otgs_wp_installer.show_download_progress_status(downloads_form, installer_strings.updating.replace('%s', plugin_name));
|
222 |
+
}else{
|
223 |
+
otgs_wp_installer.show_download_progress_status(downloads_form, installer_strings.installing.replace('%s', plugin_name));
|
224 |
+
}
|
225 |
+
|
226 |
+
|
227 |
+
data = {action: 'installer_download_plugin', data: elem.val(), activate: activate}
|
228 |
+
|
229 |
+
jQuery.ajax({
|
230 |
+
url: ajaxurl,
|
231 |
+
type: 'POST',
|
232 |
+
dataType: 'json',
|
233 |
+
data: data,
|
234 |
+
success: function(ret){
|
235 |
+
installing.hide();
|
236 |
+
|
237 |
+
if(!ret.success){
|
238 |
+
installed.addClass('installer-status-error');
|
239 |
+
installed.html(installed.data('fail'));
|
240 |
+
|
241 |
+
if(ret.message){
|
242 |
+
installed.closest('.otgs_wp_installer_table').find('.installer-error-box').html('<p>' + ret.message + '</p>').show();
|
243 |
+
}else{
|
244 |
+
installed.closest('.otgs_wp_installer_table').find('.installer-error-box').html('<p>' + downloads_form.find('.installer-revalidate-message').html() + '</p>').show();
|
245 |
+
}
|
246 |
+
|
247 |
+
|
248 |
+
}
|
249 |
+
|
250 |
+
installed.show();
|
251 |
+
spinner.fadeOut();
|
252 |
+
|
253 |
+
if(ret.version){
|
254 |
+
this_tr.find('.installer_version_installed').html('<span class="installer-green-text">' + ret.version + '</span>');
|
255 |
+
}
|
256 |
+
|
257 |
+
if(ret.success && activate){
|
258 |
+
|
259 |
+
otgs_wp_installer.show_download_progress_status(downloads_form, installer_strings.activating.replace('%s', plugin_name));
|
260 |
+
activating.show();
|
261 |
+
spinner.show();
|
262 |
+
this_tr.find('.installer-red-text').removeClass('installer-red-text').addClass('installer-green-text').html(ret.version);
|
263 |
+
|
264 |
+
jQuery.ajax({
|
265 |
+
url: ajaxurl,
|
266 |
+
type: 'POST',
|
267 |
+
dataType: 'json',
|
268 |
+
data: {action: 'installer_activate_plugin', plugin_id: ret.plugin_id, nonce: ret.nonce},
|
269 |
+
success: function(ret){
|
270 |
+
activating.hide();
|
271 |
+
if(!ret.error ){
|
272 |
+
activated.show();
|
273 |
+
}
|
274 |
+
|
275 |
+
spinner.fadeOut();
|
276 |
+
|
277 |
+
idx++;
|
278 |
+
if( typeof checkboxes[idx] != 'undefined' ){
|
279 |
+
download_and_activate( checkboxes[idx] );
|
280 |
+
}else{
|
281 |
+
otgs_wp_installer.hide_download_progress_status(downloads_form);
|
282 |
+
downloads_form.find('div.installer-status-success').show();
|
283 |
+
action_button.removeAttr('disabled');
|
284 |
+
}
|
285 |
+
}
|
286 |
+
});
|
287 |
+
}else{
|
288 |
+
idx++;
|
289 |
+
if( typeof checkboxes[idx] != 'undefined' ){
|
290 |
+
download_and_activate( checkboxes[idx] );
|
291 |
+
}else{
|
292 |
+
otgs_wp_installer.hide_download_progress_status(downloads_form);
|
293 |
+
downloads_form.find('div.installer-status-success').show();
|
294 |
+
action_button.removeAttr('disabled');
|
295 |
+
}
|
296 |
+
}
|
297 |
+
}
|
298 |
+
|
299 |
+
});
|
300 |
+
|
301 |
+
};
|
302 |
+
|
303 |
+
return false;
|
304 |
+
},
|
305 |
+
|
306 |
+
|
307 |
+
show_download_progress_status: function(downloads_form, text){
|
308 |
+
|
309 |
+
downloads_form.find('.installer-download-progress-status').html(text).fadeIn();
|
310 |
+
|
311 |
+
},
|
312 |
+
|
313 |
+
hide_download_progress_status: function(downloads_form){
|
314 |
+
|
315 |
+
downloads_form.find('.installer-download-progress-status').html('').fadeOut();
|
316 |
+
|
317 |
+
},
|
318 |
+
|
319 |
+
dismiss_nag: function(){
|
320 |
+
|
321 |
+
var thisa = jQuery(this);
|
322 |
+
|
323 |
+
jQuery('<span class="spinner"></span>').css({display: 'inline-block', float: 'left'}).appendTo(thisa);
|
324 |
+
|
325 |
+
data = {action: 'installer_dismiss_nag', repository: jQuery(this).data('repository')}
|
326 |
+
|
327 |
+
jQuery.ajax({url: ajaxurl, type: 'POST', dataType:'json', data: data, success:
|
328 |
+
function(ret){
|
329 |
+
thisa.parent().parent().remove();
|
330 |
+
}
|
331 |
+
});
|
332 |
+
|
333 |
+
return false;
|
334 |
+
|
335 |
+
|
336 |
+
},
|
337 |
+
|
338 |
+
toggle_subpackages: function(){
|
339 |
+
var list = jQuery(this).closest('td').find('.otgs_wp_installer_subtable');
|
340 |
+
|
341 |
+
if(list.is(':visible')){
|
342 |
+
list.slideUp('fast');
|
343 |
+
}else{
|
344 |
+
list.slideDown('fast');
|
345 |
+
}
|
346 |
+
|
347 |
+
|
348 |
+
return false;
|
349 |
+
|
350 |
+
},
|
351 |
+
|
352 |
+
scroll_to_repository: function(){
|
353 |
+
|
354 |
+
var ref = window.location.hash.replace('#', '');
|
355 |
+
|
356 |
+
if(ref) {
|
357 |
+
var split = ref.split('/');
|
358 |
+
var repo = split[0];
|
359 |
+
|
360 |
+
if(typeof split[1] != 'undefiend'){
|
361 |
+
var package = split[1];
|
362 |
+
var repo_element = jQuery('#repository-' + repo);
|
363 |
+
|
364 |
+
|
365 |
+
|
366 |
+
if(repo_element.length){
|
367 |
+
|
368 |
+
jQuery('html, body').animate({
|
369 |
+
scrollTop: repo_element.offset().top
|
370 |
+
}, 1000);
|
371 |
+
|
372 |
+
var package_element = jQuery('#repository-' + repo +'_' + package);
|
373 |
+
|
374 |
+
if(package_element.length && !package_element.is(':visible')){
|
375 |
+
package_element.parents('.otgs_wp_installer_subtable').slideDown();
|
376 |
+
package_element.addClass('installer_highlight_package');
|
377 |
+
}
|
378 |
+
|
379 |
+
package_element.find('.button-secondary').removeClass('button-secondary').addClass('button-primary');
|
380 |
+
}
|
381 |
+
}
|
382 |
+
|
383 |
+
}
|
384 |
+
|
385 |
+
}
|
386 |
+
|
387 |
+
|
388 |
+
}
|
389 |
+
|
390 |
+
|
391 |
jQuery(document).ready(otgs_wp_installer.init);
|
plus/installer/res/js/iframeResizer.min.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
/*! iFrame Resizer (iframeSizer.min.js ) - v2.6.1 - 2014-09-03
|
2 |
-
* Desc: Force cross domain iframes to size to content.
|
3 |
-
* Requires: iframeResizer.contentWindow.min.js to be loaded into the target frame.
|
4 |
-
* Copyright: (c) 2014 David J. Bradshaw - dave@bradshaw.net
|
5 |
-
* License: MIT
|
6 |
-
*/
|
7 |
-
|
8 |
-
!function(){"use strict";function a(a,b,c){"addEventListener"in window?a.addEventListener(b,c,!1):"attachEvent"in window&&a.attachEvent("on"+b,c)}function b(){var a,b=["moz","webkit","o","ms"];for(a=0;a<b.length&&!w;a+=1)w=window[b[a]+"RequestAnimationFrame"];w||c(" RequestAnimationFrame not supported")}function c(a){y.log&&"object"==typeof console&&console.log(s+"[Host page"+u+"]"+a)}function d(a){function b(){function a(){h(z),f(),y.resizedCallback(z)}i(a,z,"resetPage")}function d(a){var b=a.id;c(" Removing iFrame: "+b),a.parentNode.removeChild(a),y.closedCallback(b),c(" --")}function e(){var a=x.substr(t).split(":");return{iframe:document.getElementById(a[0]),id:a[0],height:a[1],width:a[2],type:a[3]}}function j(a){var b=Number(y["max"+a]),d=Number(y["min"+a]),e=a.toLowerCase(),f=Number(z[e]);if(d>b)throw new Error("Value for min"+a+" can not be greater than max"+a);c(" Checking "+e+" is in range "+d+"-"+b),d>f&&(f=d,c(" Set "+e+" to min value")),f>b&&(f=b,c(" Set "+e+" to max value")),z[e]=""+f}function k(){var b=a.origin,d=z.iframe.src.split("/").slice(0,3).join("/");if(y.checkOrigin&&(c(" Checking connection is from: "+d),""+b!="null"&&b!==d))throw new Error("Unexpected message received from: "+b+" for "+z.iframe.id+". Message was: "+a.data+". This error can be disabled by adding the checkOrigin: false option.");return!0}function l(){return s===(""+x).substr(0,t)}function m(){var a=z.type in{"true":1,"false":1};return a&&c(" Ignoring init message from meta parent page"),a}function n(){var a=x.substr(x.indexOf(":")+r+6);c(" MessageCallback passed: {iframe: "+z.iframe.id+", message: "+a+"}"),y.messageCallback({iframe:z.iframe,message:a}),c(" --")}function o(){if(null===z.iframe)throw new Error("iFrame ("+z.id+") does not exist on "+u);return!0}function q(){c(" Reposition requested from iFrame"),v={x:z.width,y:z.height},f()}function w(){switch(z.type){case"close":d(z.iframe),y.resizedCallback(z);break;case"message":n();break;case"scrollTo":q();break;case"reset":g(z);break;case"init":b(),y.initCallback(z.iframe);break;default:b()}}var x=a.data,z={};l()&&(c(" Received: "+x),z=e(),j("Height"),j("Width"),!m()&&o()&&k()&&(w(),p=!1))}function e(){null===v&&(v={x:void 0!==window.pageXOffset?window.pageXOffset:document.documentElement.scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:document.documentElement.scrollTop},c(" Get position: "+v.x+","+v.y))}function f(){null!==v&&(window.scrollTo(v.x,v.y),c(" Set position: "+v.x+","+v.y),v=null)}function g(a){function b(){h(a),j("reset","reset",a.iframe)}c(" Size reset requested by "+("init"===a.type?"host page":"iFrame")),e(),i(b,a,"init")}function h(a){function b(b){a.iframe.style[b]=a[b]+"px",c(" IFrame ("+a.iframe.id+") "+b+" set to "+a[b]+"px")}y.sizeHeight&&b("height"),y.sizeWidth&&b("width")}function i(a,b,d){d!==b.type&&w?(c(" Requesting animation frame"),w(a)):a()}function j(a,b,d){c("["+a+"] Sending msg to iframe ("+b+")"),d.contentWindow.postMessage(s+b,"*")}function k(){function b(){function a(a){1/0!==y[a]&&0!==y[a]&&(k.style[a]=y[a]+"px",c(" Set "+a+" = "+y[a]+"px"))}a("maxHeight"),a("minHeight"),a("maxWidth"),a("minWidth")}function d(a){return""===a&&(k.id=a="iFrameResizer"+o++,c(" Added missing iframe ID: "+a+" ("+k.src+")")),a}function e(){c(" IFrame scrolling "+(y.scrolling?"enabled":"disabled")+" for "+l),k.style.overflow=!1===y.scrolling?"hidden":"auto",k.scrolling=!1===y.scrolling?"no":"yes"}function f(){("number"==typeof y.bodyMargin||"0"===y.bodyMargin)&&(y.bodyMarginV1=y.bodyMargin,y.bodyMargin=""+y.bodyMargin+"px")}function h(){return l+":"+y.bodyMarginV1+":"+y.sizeWidth+":"+y.log+":"+y.interval+":"+y.enablePublicMethods+":"+y.autoResize+":"+y.bodyMargin+":"+y.heightCalculationMethod+":"+y.bodyBackground+":"+y.bodyPadding+":"+y.tolerance}function i(b){a(k,"load",function(){var a=p;j("iFrame.onload",b,k),!a&&y.heightCalculationMethod in x&&g({iframe:k,height:0,width:0,type:"init"})}),j("init",b,k)}var k=this,l=d(k.id);e(),b(),f(),i(h())}function l(a){if("object"!=typeof a)throw new TypeError("Options is not an object.")}function m(){function a(a){if("IFRAME"!==a.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+a.tagName+">.");k.call(a)}function b(a){a=a||{},l(a);for(var b in z)z.hasOwnProperty(b)&&(y[b]=a.hasOwnProperty(b)?a[b]:z[b])}return function(c,d){b(c),Array.prototype.forEach.call(document.querySelectorAll(d||"iframe"),a)}}function n(a){a.fn.iFrameResize=function(b){return b=b||{},l(b),y=a.extend({},z,b),this.filter("iframe").each(k).end()}}var o=0,p=!0,q="message",r=q.length,s="[iFrameSizer]",t=s.length,u="",v=null,w=window.requestAnimationFrame,x={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},y={},z={autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,enablePublicMethods:!1,heightCalculationMethod:"offset",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,scrolling:!1,sizeHeight:!0,sizeWidth:!1,tolerance:0,closedCallback:function(){},initCallback:function(){},messageCallback:function(){},resizedCallback:function(){}};b(),a(window,"message",d),"jQuery"in window&&n(jQuery),"function"==typeof define&&define.amd?define(function(){return m()}):window.iFrameResize=m()}();
|
9 |
-
//# sourceMappingURL=../src/iframeResizer.map
|
10 |
-
|
1 |
+
/*! iFrame Resizer (iframeSizer.min.js ) - v2.6.1 - 2014-09-03
|
2 |
+
* Desc: Force cross domain iframes to size to content.
|
3 |
+
* Requires: iframeResizer.contentWindow.min.js to be loaded into the target frame.
|
4 |
+
* Copyright: (c) 2014 David J. Bradshaw - dave@bradshaw.net
|
5 |
+
* License: MIT
|
6 |
+
*/
|
7 |
+
|
8 |
+
!function(){"use strict";function a(a,b,c){"addEventListener"in window?a.addEventListener(b,c,!1):"attachEvent"in window&&a.attachEvent("on"+b,c)}function b(){var a,b=["moz","webkit","o","ms"];for(a=0;a<b.length&&!w;a+=1)w=window[b[a]+"RequestAnimationFrame"];w||c(" RequestAnimationFrame not supported")}function c(a){y.log&&"object"==typeof console&&console.log(s+"[Host page"+u+"]"+a)}function d(a){function b(){function a(){h(z),f(),y.resizedCallback(z)}i(a,z,"resetPage")}function d(a){var b=a.id;c(" Removing iFrame: "+b),a.parentNode.removeChild(a),y.closedCallback(b),c(" --")}function e(){var a=x.substr(t).split(":");return{iframe:document.getElementById(a[0]),id:a[0],height:a[1],width:a[2],type:a[3]}}function j(a){var b=Number(y["max"+a]),d=Number(y["min"+a]),e=a.toLowerCase(),f=Number(z[e]);if(d>b)throw new Error("Value for min"+a+" can not be greater than max"+a);c(" Checking "+e+" is in range "+d+"-"+b),d>f&&(f=d,c(" Set "+e+" to min value")),f>b&&(f=b,c(" Set "+e+" to max value")),z[e]=""+f}function k(){var b=a.origin,d=z.iframe.src.split("/").slice(0,3).join("/");if(y.checkOrigin&&(c(" Checking connection is from: "+d),""+b!="null"&&b!==d))throw new Error("Unexpected message received from: "+b+" for "+z.iframe.id+". Message was: "+a.data+". This error can be disabled by adding the checkOrigin: false option.");return!0}function l(){return s===(""+x).substr(0,t)}function m(){var a=z.type in{"true":1,"false":1};return a&&c(" Ignoring init message from meta parent page"),a}function n(){var a=x.substr(x.indexOf(":")+r+6);c(" MessageCallback passed: {iframe: "+z.iframe.id+", message: "+a+"}"),y.messageCallback({iframe:z.iframe,message:a}),c(" --")}function o(){if(null===z.iframe)throw new Error("iFrame ("+z.id+") does not exist on "+u);return!0}function q(){c(" Reposition requested from iFrame"),v={x:z.width,y:z.height},f()}function w(){switch(z.type){case"close":d(z.iframe),y.resizedCallback(z);break;case"message":n();break;case"scrollTo":q();break;case"reset":g(z);break;case"init":b(),y.initCallback(z.iframe);break;default:b()}}var x=a.data,z={};l()&&(c(" Received: "+x),z=e(),j("Height"),j("Width"),!m()&&o()&&k()&&(w(),p=!1))}function e(){null===v&&(v={x:void 0!==window.pageXOffset?window.pageXOffset:document.documentElement.scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:document.documentElement.scrollTop},c(" Get position: "+v.x+","+v.y))}function f(){null!==v&&(window.scrollTo(v.x,v.y),c(" Set position: "+v.x+","+v.y),v=null)}function g(a){function b(){h(a),j("reset","reset",a.iframe)}c(" Size reset requested by "+("init"===a.type?"host page":"iFrame")),e(),i(b,a,"init")}function h(a){function b(b){a.iframe.style[b]=a[b]+"px",c(" IFrame ("+a.iframe.id+") "+b+" set to "+a[b]+"px")}y.sizeHeight&&b("height"),y.sizeWidth&&b("width")}function i(a,b,d){d!==b.type&&w?(c(" Requesting animation frame"),w(a)):a()}function j(a,b,d){c("["+a+"] Sending msg to iframe ("+b+")"),d.contentWindow.postMessage(s+b,"*")}function k(){function b(){function a(a){1/0!==y[a]&&0!==y[a]&&(k.style[a]=y[a]+"px",c(" Set "+a+" = "+y[a]+"px"))}a("maxHeight"),a("minHeight"),a("maxWidth"),a("minWidth")}function d(a){return""===a&&(k.id=a="iFrameResizer"+o++,c(" Added missing iframe ID: "+a+" ("+k.src+")")),a}function e(){c(" IFrame scrolling "+(y.scrolling?"enabled":"disabled")+" for "+l),k.style.overflow=!1===y.scrolling?"hidden":"auto",k.scrolling=!1===y.scrolling?"no":"yes"}function f(){("number"==typeof y.bodyMargin||"0"===y.bodyMargin)&&(y.bodyMarginV1=y.bodyMargin,y.bodyMargin=""+y.bodyMargin+"px")}function h(){return l+":"+y.bodyMarginV1+":"+y.sizeWidth+":"+y.log+":"+y.interval+":"+y.enablePublicMethods+":"+y.autoResize+":"+y.bodyMargin+":"+y.heightCalculationMethod+":"+y.bodyBackground+":"+y.bodyPadding+":"+y.tolerance}function i(b){a(k,"load",function(){var a=p;j("iFrame.onload",b,k),!a&&y.heightCalculationMethod in x&&g({iframe:k,height:0,width:0,type:"init"})}),j("init",b,k)}var k=this,l=d(k.id);e(),b(),f(),i(h())}function l(a){if("object"!=typeof a)throw new TypeError("Options is not an object.")}function m(){function a(a){if("IFRAME"!==a.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+a.tagName+">.");k.call(a)}function b(a){a=a||{},l(a);for(var b in z)z.hasOwnProperty(b)&&(y[b]=a.hasOwnProperty(b)?a[b]:z[b])}return function(c,d){b(c),Array.prototype.forEach.call(document.querySelectorAll(d||"iframe"),a)}}function n(a){a.fn.iFrameResize=function(b){return b=b||{},l(b),y=a.extend({},z,b),this.filter("iframe").each(k).end()}}var o=0,p=!0,q="message",r=q.length,s="[iFrameSizer]",t=s.length,u="",v=null,w=window.requestAnimationFrame,x={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},y={},z={autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,enablePublicMethods:!1,heightCalculationMethod:"offset",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,scrolling:!1,sizeHeight:!0,sizeWidth:!1,tolerance:0,closedCallback:function(){},initCallback:function(){},messageCallback:function(){},resizedCallback:function(){}};b(),a(window,"message",d),"jQuery"in window&&n(jQuery),"function"==typeof define&&define.amd?define(function(){return m()}):window.iFrameResize=m()}();
|
9 |
+
//# sourceMappingURL=../src/iframeResizer.map
|
10 |
+
|
plus/installer/res/js/installer_theme_install.js
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery( document ).ready( function( $ ) {
|
2 |
+
|
3 |
+
/** Append OTGS Theme tab */
|
4 |
+
var js_array= installer_theme_install_localize.js_array_installer;
|
5 |
+
|
6 |
+
if (!($.isEmptyObject(js_array))) {
|
7 |
+
//Unempty
|
8 |
+
for(var key in js_array) {
|
9 |
+
//Dont append if we are on commercial plugins tab page and if there are no themes
|
10 |
+
if ((!(js_array[key]['is_commercial_plugin_tab'])) && (!(installer_theme_install_localize.no_associated_themes))) {
|
11 |
+
$('div.wp-filter ul.filter-links').append('<li><a data-sort="'+key+'" href="#">'+ js_array[key]['the_hyperlink_text'] +'</a></li>');
|
12 |
+
}
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
/** Page load event tab selected identifier */
|
17 |
+
var loaded_browsing_tab=installer_theme_extended_object.getParameterByName('browse');
|
18 |
+
if (loaded_browsing_tab.length > 0) {
|
19 |
+
|
20 |
+
var frontend_tab_selected_tab = loaded_browsing_tab;
|
21 |
+
|
22 |
+
} else if (0 == loaded_browsing_tab.length){
|
23 |
+
|
24 |
+
//WordPress defaults to 'Featured' when theme install is loaded without the browse parameter
|
25 |
+
var frontend_tab_selected_tab = 'featured';
|
26 |
+
}
|
27 |
+
|
28 |
+
/** Prepare data on page load event for AJAX */
|
29 |
+
var data = {
|
30 |
+
action: 'installer_theme_frontend_selected_tab',
|
31 |
+
installer_theme_frontend_selected_tab_nonce: installer_theme_install_localize.installer_theme_frontend_selected_tab_nonce,
|
32 |
+
frontend_tab_selected :frontend_tab_selected_tab
|
33 |
+
};
|
34 |
+
|
35 |
+
//Call AJAX
|
36 |
+
installer_theme_extended_object.doAJAX(data,frontend_tab_selected_tab,js_array);
|
37 |
+
|
38 |
+
/** When user clicks on any tab */
|
39 |
+
$(document).on('click','.filter-links li > a',function () {
|
40 |
+
|
41 |
+
//Get data_sort
|
42 |
+
var data_sort =$(this).attr('data-sort');
|
43 |
+
|
44 |
+
if (data_sort) {
|
45 |
+
//data_sort is set, prepare data
|
46 |
+
var data = {
|
47 |
+
action: 'installer_theme_frontend_selected_tab',
|
48 |
+
installer_theme_frontend_selected_tab_nonce: installer_theme_install_localize.installer_theme_frontend_selected_tab_nonce,
|
49 |
+
frontend_tab_selected : data_sort
|
50 |
+
};
|
51 |
+
|
52 |
+
//Call AJAX
|
53 |
+
installer_theme_extended_object.doAJAX(data,data_sort,js_array);
|
54 |
+
|
55 |
+
}
|
56 |
+
});
|
57 |
+
|
58 |
+
var fullhash = window.location.hash;
|
59 |
+
if (fullhash.length > 0) {
|
60 |
+
var product_selector=fullhash+' '+'.enter_site_key_js';
|
61 |
+
if ($(product_selector).length ) {
|
62 |
+
$(product_selector).click();
|
63 |
+
}
|
64 |
+
}
|
65 |
+
});
|
66 |
+
|
67 |
+
//Installer theme extended JS object for methods
|
68 |
+
var installer_theme_extended_object = {
|
69 |
+
|
70 |
+
getParameterByName: function(name) {
|
71 |
+
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
72 |
+
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
73 |
+
results = regex.exec(location.search);
|
74 |
+
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
75 |
+
},
|
76 |
+
|
77 |
+
doAJAX: function(data,data_sort,js_array) {
|
78 |
+
|
79 |
+
//We only want to post to AJAX if its an OTGS tab
|
80 |
+
jQuery.post(installer_theme_install_localize.ajaxurl, data, function(response) {
|
81 |
+
//AJAX response
|
82 |
+
var myObject = jQuery.parseJSON(response);
|
83 |
+
var tab_selected= myObject.output;
|
84 |
+
if (data_sort in js_array) {
|
85 |
+
if (!(installer_theme_install_localize.js_array_installer[tab_selected]['registration_status'])) {
|
86 |
+
//Not registered, no theme response
|
87 |
+
var unregistered_message= myObject.unregistered_messages;
|
88 |
+
jQuery('.no-themes').html(unregistered_message);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
});
|
93 |
+
}
|
94 |
+
};
|
plus/installer/templates/downloads-list-compact.php
CHANGED
@@ -1,75 +1,77 @@
|
|
1 |
-
|
2 |
-
<form method="post" class="otgsi_downloads_form">
|
3 |
-
|
4 |
-
<table class="installer-plugins-list-compact">
|
5 |
-
<thead>
|
6 |
-
<tr>
|
7 |
-
<th> </th>
|
8 |
-
<th><?php _e('Plugin', 'installer') ?></th>
|
9 |
-
<th><img src="<?php echo $this->plugin_url() ?>/res/img/globe.png" alt="<?php esc_attr_e('Available', 'installer') ?>" width="16" height="16"></th>
|
10 |
-
<th><img src="<?php echo $this->plugin_url() ?>/res/img/computer.png" alt="<?php esc_attr_e('Installed', 'installer') ?>" width="16" height="16"></th>
|
11 |
-
<th><img src="<?php echo $this->plugin_url() ?>/res/img/dn2.gif" alt="<?php esc_attr_e('Downloading', 'installer') ?>" width="16" height="16"></th>
|
12 |
-
<th><img src="<?php echo $this->plugin_url() ?>/res/img/on.png" alt="<?php esc_attr_e('Activate', 'installer') ?>" width="16" height="16"></th>
|
13 |
-
</tr>
|
14 |
-
</thead>
|
15 |
-
<tbody>
|
16 |
-
<?php foreach($product['downloads'] as $download): ?>
|
17 |
-
<?php if(empty($tr_oddeven) || $tr_oddeven == 'even') $tr_oddeven = 'odd'; else $tr_oddeven = 'even'; ?>
|
18 |
-
<tr class="<?php echo $tr_oddeven ?>">
|
19 |
-
<td>
|
20 |
-
<label>
|
21 |
-
<?php
|
22 |
-
$url = $this->append_site_key_to_download_url($download['url'], $site_key, $repository_id );
|
23 |
-
|
24 |
-
|
25 |
-
'
|
26 |
-
'
|
27 |
-
'
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
<td><?php echo $download['
|
45 |
-
<td>
|
46 |
-
|
47 |
-
|
48 |
-
<?php
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
<div class="installer-status-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
<div class="installer-status-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
<
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
<
|
75 |
-
|
|
|
|
1 |
+
|
2 |
+
<form method="post" class="otgsi_downloads_form">
|
3 |
+
|
4 |
+
<table class="installer-plugins-list-compact">
|
5 |
+
<thead>
|
6 |
+
<tr>
|
7 |
+
<th> </th>
|
8 |
+
<th><?php _e('Plugin', 'installer') ?></th>
|
9 |
+
<th><img src="<?php echo $this->plugin_url() ?>/res/img/globe.png" alt="<?php esc_attr_e('Available', 'installer') ?>" width="16" height="16"></th>
|
10 |
+
<th><img src="<?php echo $this->plugin_url() ?>/res/img/computer.png" alt="<?php esc_attr_e('Installed', 'installer') ?>" width="16" height="16"></th>
|
11 |
+
<th><img src="<?php echo $this->plugin_url() ?>/res/img/dn2.gif" alt="<?php esc_attr_e('Downloading', 'installer') ?>" width="16" height="16"></th>
|
12 |
+
<th><img src="<?php echo $this->plugin_url() ?>/res/img/on.png" alt="<?php esc_attr_e('Activate', 'installer') ?>" width="16" height="16"></th>
|
13 |
+
</tr>
|
14 |
+
</thead>
|
15 |
+
<tbody>
|
16 |
+
<?php foreach($product['downloads'] as $download): ?>
|
17 |
+
<?php if(empty($tr_oddeven) || $tr_oddeven == 'even') $tr_oddeven = 'odd'; else $tr_oddeven = 'even'; ?>
|
18 |
+
<tr class="<?php echo $tr_oddeven ?>">
|
19 |
+
<td>
|
20 |
+
<label>
|
21 |
+
<?php
|
22 |
+
$url = $this->append_site_key_to_download_url($download['url'], $site_key, $repository_id );
|
23 |
+
|
24 |
+
$download_data = array(
|
25 |
+
'url' => $url,
|
26 |
+
'slug' => $download['slug'],
|
27 |
+
'nonce' => wp_create_nonce('install_plugin_' . $url),
|
28 |
+
'repository_id' => $repository_id
|
29 |
+
);
|
30 |
+
|
31 |
+
$disabled = $expired ||
|
32 |
+
(
|
33 |
+
$this->plugin_is_installed($download['name'], $download['slug'], $download['version']) &&
|
34 |
+
!$this->plugin_is_embedded_version($download['name'], $download['slug'])
|
35 |
+
)||
|
36 |
+
!WP_Installer()->is_uploading_allowed();
|
37 |
+
|
38 |
+
?>
|
39 |
+
<input type="checkbox" name="downloads[]" value="<?php echo base64_encode(json_encode($download_data)); ?>" <?php
|
40 |
+
if($disabled): ?>disabled="disabled"<?php endif; ?> />
|
41 |
+
|
42 |
+
</label>
|
43 |
+
</td>
|
44 |
+
<td class="installer_plugin_name"><?php echo $download['name'] ?></td>
|
45 |
+
<td><?php echo $download['version'] ?></td>
|
46 |
+
<td class="installer_version_installed">
|
47 |
+
<?php if($v = $this->plugin_is_installed($download['name'], $download['slug'])): $class = version_compare($v, $download['version'], '>=') ? 'installer-green-text' : 'installer-red-text'; ?>
|
48 |
+
<span class="<?php echo $class ?>"><?php echo $v; ?></span>
|
49 |
+
<?php endif; ?>
|
50 |
+
</td>
|
51 |
+
<td class="twelve">
|
52 |
+
<div class="installer-status-downloading"><?php _e('downloading...', 'installer') ?></div>
|
53 |
+
<div class="installer-status-downloaded" data-fail="<?php _e('failed!', 'installer') ?>"><?php _e('downloaded', 'installer') ?></div>
|
54 |
+
</td>
|
55 |
+
<td class="twelve">
|
56 |
+
<div class="installer-status-activating"><?php _e('activating', 'installer') ?></div>
|
57 |
+
<div class="installer-status-activated"><?php _e('activated', 'installer') ?></div>
|
58 |
+
</td>
|
59 |
+
</tr>
|
60 |
+
<?php endforeach; ?>
|
61 |
+
</tbody>
|
62 |
+
</table>
|
63 |
+
|
64 |
+
<?php if(!WP_Installer()->is_uploading_allowed()): ?>
|
65 |
+
<p class="installer-error-box"><?php printf(__('Downloading is not possible because WordPress cannot write into the plugins folder. %sHow to fix%s.', 'installer'), '<a href="http://codex.wordpress.org/Changing_File_Permissions">', '</a>') ?></p>
|
66 |
+
<?php endif;?>
|
67 |
+
|
68 |
+
<br />
|
69 |
+
<input type="submit" class="button-secondary" value="<?php esc_attr_e('Download', 'installer') ?>" disabled="disabled" />
|
70 |
+
|
71 |
+
<label><input name="activate" type="checkbox" value="1" disabled="disabled" /> <?php _e('Activate after download', 'installer') ?></label>
|
72 |
+
|
73 |
+
<div class="installer-download-progress-status"></div>
|
74 |
+
<div class="installer-status-success"><?php _e('Operation complete!', 'installer') ?></div>
|
75 |
+
|
76 |
+
<span class="installer-revalidate-message hidden"><?php _e("Download failed!\n\nClick OK to revalidate your subscription or CANCEL to try again.", 'installer') ?></span>
|
77 |
+
</form>
|
plus/installer/templates/downloads-list.php
CHANGED
@@ -1,81 +1,84 @@
|
|
1 |
-
<br clear="all" /><br />
|
2 |
-
<strong><?php _e('Downloads:', 'installer') ?></strong>
|
3 |
-
|
4 |
-
<form method="post" class="otgsi_downloads_form">
|
5 |
-
|
6 |
-
<table class="widefat">
|
7 |
-
<thead>
|
8 |
-
<tr>
|
9 |
-
<th> </th>
|
10 |
-
<th><?php _e('Plugin', 'installer') ?></th>
|
11 |
-
<th><?php _e('Current version', 'installer') ?></th>
|
12 |
-
<th><?php _e('Released', 'installer') ?></th>
|
13 |
-
<th><?php _e('Installed version', 'installer') ?></th>
|
14 |
-
<th> </th>
|
15 |
-
<th> </th>
|
16 |
-
<th> </th>
|
17 |
-
</tr>
|
18 |
-
</thead>
|
19 |
-
<tbody>
|
20 |
-
<?php
|
21 |
-
foreach($package['downloads'] as $download): ?>
|
22 |
-
<tr>
|
23 |
-
<td>
|
24 |
-
<label>
|
25 |
-
<?php
|
26 |
-
$url = $this->append_site_key_to_download_url($download['url'], $site_key, $repository_id);
|
27 |
-
|
28 |
-
|
29 |
-
'
|
30 |
-
'
|
31 |
-
'
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
<td><?php echo $download['
|
41 |
-
<td><?php echo
|
42 |
-
<td>
|
43 |
-
|
44 |
-
|
45 |
-
<?php
|
46 |
-
<?php endif; ?>
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
<span class="installer-status-
|
51 |
-
<span class="installer-status-
|
52 |
-
<span class="installer-status-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
<span class="installer-status-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
</
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
|
1 |
+
<br clear="all" /><br />
|
2 |
+
<strong><?php _e('Downloads:', 'installer') ?></strong>
|
3 |
+
|
4 |
+
<form method="post" class="otgsi_downloads_form">
|
5 |
+
|
6 |
+
<table class="widefat">
|
7 |
+
<thead>
|
8 |
+
<tr>
|
9 |
+
<th> </th>
|
10 |
+
<th><?php _e('Plugin', 'installer') ?></th>
|
11 |
+
<th><?php _e('Current version', 'installer') ?></th>
|
12 |
+
<th><?php _e('Released', 'installer') ?></th>
|
13 |
+
<th><?php _e('Installed version', 'installer') ?></th>
|
14 |
+
<th> </th>
|
15 |
+
<th> </th>
|
16 |
+
<th> </th>
|
17 |
+
</tr>
|
18 |
+
</thead>
|
19 |
+
<tbody>
|
20 |
+
<?php
|
21 |
+
foreach($package['downloads'] as $download): ?>
|
22 |
+
<tr>
|
23 |
+
<td>
|
24 |
+
<label>
|
25 |
+
<?php
|
26 |
+
$url = $this->append_site_key_to_download_url($download['url'], $site_key, $repository_id);
|
27 |
+
|
28 |
+
$download_data = array(
|
29 |
+
'url' => $url,
|
30 |
+
'slug' => $download['slug'],
|
31 |
+
'nonce' => wp_create_nonce('install_plugin_' . $url),
|
32 |
+
'repository_id' => $repository_id
|
33 |
+
);
|
34 |
+
?>
|
35 |
+
<input type="checkbox" name="downloads[]" value="<?php echo base64_encode(json_encode($download_data)); ?>" <?php
|
36 |
+
if($this->plugin_is_installed($download['name'], $download['slug'], $download['version']) && !$this->plugin_is_embedded_version($download['name'], $download['slug']) || !WP_Installer()->is_uploading_allowed()): ?>disabled="disabled"<?php endif; ?> />
|
37 |
+
|
38 |
+
</label>
|
39 |
+
</td>
|
40 |
+
<td class="installer_plugin_name"><?php echo $download['name'] ?></td>
|
41 |
+
<td><?php echo $download['version'] ?></td>
|
42 |
+
<td><?php echo date_i18n('F j, Y', strtotime($download['date'])) ?></td>
|
43 |
+
<td class="installer_version_installed">
|
44 |
+
<?php if($v = $this->plugin_is_installed($download['name'], $download['slug'])): $class = version_compare($v, $download['version'], '>=') ? 'installer-green-text' : 'installer-red-text'; ?>
|
45 |
+
<span class="<?php echo $class ?>"><?php echo $v; ?></span>
|
46 |
+
<?php if($this->plugin_is_embedded_version($download['name'], $download['slug'])): ?> <?php _e('(embedded)', 'installer'); ?><?php endif; ?>
|
47 |
+
<?php endif; ?>
|
48 |
+
</td>
|
49 |
+
<td>
|
50 |
+
<span class="installer-status-installing"><?php _e('installing...', 'installer') ?></span>
|
51 |
+
<span class="installer-status-updating"><?php _e('updating...', 'installer') ?></span>
|
52 |
+
<span class="installer-status-installed" data-fail="<?php _e('failed!', 'installer') ?>"><?php _e('installed', 'installer') ?></span>
|
53 |
+
<span class="installer-status-updated" data-fail="<?php _e('failed!', 'installer') ?>"><?php _e('updated', 'installer') ?></span>
|
54 |
+
</td>
|
55 |
+
<td>
|
56 |
+
<span class="installer-status-activating"><?php _e('activating', 'installer') ?></span>
|
57 |
+
<span class="installer-status-activated"><?php _e('activated', 'installer') ?></span>
|
58 |
+
</td>
|
59 |
+
<td class="for_spinner_js"><span class="spinner"></span></td>
|
60 |
+
</tr>
|
61 |
+
<?php endforeach; ?>
|
62 |
+
</tbody>
|
63 |
+
</table>
|
64 |
+
|
65 |
+
<br />
|
66 |
+
|
67 |
+
<div class="installer-error-box">
|
68 |
+
<?php if(!WP_Installer()->is_uploading_allowed()): ?>
|
69 |
+
<p>
|
70 |
+
<?php printf(__('Downloading is not possible because WordPress cannot write into the plugins folder. %sHow to fix%s.', 'installer'), '<a href="http://codex.wordpress.org/Changing_File_Permissions">', '</a>') ?>
|
71 |
+
</p>
|
72 |
+
<?php endif;?>
|
73 |
+
</div>
|
74 |
+
|
75 |
+
<input type="submit" class="button-secondary" value="<?php esc_attr_e('Download', 'installer') ?>" disabled="disabled" />
|
76 |
+
|
77 |
+
<label><input name="activate" type="checkbox" value="1" disabled="disabled" /> <?php _e('Activate after download', 'installer') ?></label>
|
78 |
+
|
79 |
+
<div class="installer-download-progress-status"></div>
|
80 |
+
|
81 |
+
<div class="installer-status-success"><?php _e('Operation complete!', 'installer') ?></div>
|
82 |
+
|
83 |
+
<span class="installer-revalidate-message hidden"><?php _e("Download failed!\n\nPlease refresh the page and try again.", 'installer') ?></span>
|
84 |
+
</form>
|
plus/installer/templates/products-compact.php
CHANGED
@@ -1,129 +1,129 @@
|
|
1 |
-
<h3><?php echo $args['box_title'] ?></h3>
|
2 |
-
|
3 |
-
<?php
|
4 |
-
if(empty($args['repository']) || empty($args['package']) || empty($args['product'])){
|
5 |
-
echo __('Incorrect setup', 'installer');
|
6 |
-
return;
|
7 |
-
}
|
8 |
-
|
9 |
-
$product = false;
|
10 |
-
foreach($this->settings['repositories'][$repository_id]['data']['packages'] as $package_idx => $package){
|
11 |
-
|
12 |
-
//pre 1.3 backwardds compatibility
|
13 |
-
if(!isset($package['id'])){
|
14 |
-
$package['id'] = sanitize_title_with_dashes($package['name']);
|
15 |
-
}
|
16 |
-
|
17 |
-
if($package['id'] == $args['package']){
|
18 |
-
$product = $this->settings['repositories'][$repository_id]['data']['packages'][$package_idx]['products'][$args['product']];
|
19 |
-
break;
|
20 |
-
}
|
21 |
-
}
|
22 |
-
|
23 |
-
|
24 |
-
if(!$product){
|
25 |
-
echo __('Invalid product', 'installer');
|
26 |
-
return;
|
27 |
-
}
|
28 |
-
|
29 |
-
if(isset($this->settings['repositories'][$repository_id])){
|
30 |
-
if(isset($this->settings['repositories'][$repository_id]['subscription']['key'])){
|
31 |
-
$site_key = $this->settings['repositories'][$repository_id]['subscription']['key'];
|
32 |
-
}else{
|
33 |
-
$site_key = false;
|
34 |
-
}
|
35 |
-
}else{
|
36 |
-
echo __('Unknown repository', 'installer');
|
37 |
-
return;
|
38 |
-
}
|
39 |
-
|
40 |
-
$subscription_type = $this->get_subscription_type_for_repository($repository_id);
|
41 |
-
$expired = false;
|
42 |
-
|
43 |
-
if($subscription_type != $product['subscription_type'] && !$this->have_superior_subscription($subscription_type, $product) && $site_key){
|
44 |
-
$subscription_no_match = sprintf(__(' Your current site key (%s) does not match the selected product (%s).', 'installer'), $site_key, $product['name']);
|
45 |
-
}
|
46 |
-
|
47 |
-
if(!isset($args['product_name'])) $args['product_name'] = $product['name'];
|
48 |
-
|
49 |
-
?>
|
50 |
-
|
51 |
-
<div class="otgs_wp_installer_table otgs_wp_installer_table_compact">
|
52 |
-
|
53 |
-
<p><?php echo $args['box_description'] ?></p>
|
54 |
-
|
55 |
-
|
56 |
-
<?php if(!$this->repository_has_subscription($repository_id) || !empty($subscription_no_match)): ?>
|
57 |
-
|
58 |
-
<?php if(!empty($subscription_no_match)): ?>
|
59 |
-
<div class="installer-warn-box">
|
60 |
-
<?php echo $subscription_no_match; ?>
|
61 |
-
</div>
|
62 |
-
<br />
|
63 |
-
<?php endif; ?>
|
64 |
-
|
65 |
-
<a class="button-primary" href="<?php echo $this->append_parameters_to_buy_url($product['url'], $repository_id, $args) ?>"><?php printf(__('Buy %s', 'installer'), $args['product_name']) ?></a>
|
66 |
-
|
67 |
-
<div>
|
68 |
-
<br />
|
69 |
-
<?php printf(__('Already bought %s?', 'installer'), $args['product_name']) ?>
|
70 |
-
<a class="enter_site_key_js" href="#"><?php _e('Enter site key', 'installer') ?></a>
|
71 |
-
|
72 |
-
<form class="otgsi_site_key_form" method="post">
|
73 |
-
<input type="hidden" name="action" value="save_site_key" />
|
74 |
-
<input type="hidden" name="nonce" value="<?php echo wp_create_nonce('save_site_key_' . $repository_id) ?>" />
|
75 |
-
<input type="hidden" name="repository_id" value="<?php echo $repository_id ?>">
|
76 |
-
<input type="text" size="10" name="site_key_<?php echo $repository_id ?>" />
|
77 |
-
<input class="button-secondary" type="submit" value="<?php esc_attr_e('Add', 'installer') ?>" />
|
78 |
-
</form>
|
79 |
-
<div class="installer-error-box hidden" style="margin-top:10px;"></div>
|
80 |
-
</div>
|
81 |
-
|
82 |
-
<?php else: ?>
|
83 |
-
|
84 |
-
<?php if($this->repository_has_expired_subscription($repository_id)): $expired = true; ?>
|
85 |
-
|
86 |
-
<div><p class="installer-warn-box"><?php _e('Subscription is expired.', 'installer') ?></p></div>
|
87 |
-
|
88 |
-
<?php else: ?>
|
89 |
-
|
90 |
-
<?php if($this->show_subscription_renew_warning($repository_id, $subscription_type)): ?>
|
91 |
-
|
92 |
-
<ul class="installer-products-list">
|
93 |
-
<?php foreach($product['renewals'] as $renewal): ?>
|
94 |
-
<li>
|
95 |
-
<a href="<?php echo $this->append_parameters_to_buy_url($renewal['url'], $repository_id, $args) ?>"><?php printf(__('Renew %s', 'installer'), $args['product_name']) ?></a>
|
96 |
-
</li>
|
97 |
-
<?php endforeach; ?>
|
98 |
-
</ul>
|
99 |
-
|
100 |
-
<?php endif; ?>
|
101 |
-
|
102 |
-
<?php endif; ?>
|
103 |
-
|
104 |
-
<center>
|
105 |
-
<a class="remove_site_key_js" href="#" data-repository=<?php echo $repository_id ?> data-confirmation="<?php esc_attr_e('Are you sure you want to remove this site key?', 'installer') ?>" data-nonce="<?php echo wp_create_nonce('remove_site_key_' . $repository_id) ?>"><?php printf(__("Remove current site key (%s)", 'installer'), $site_key) ?></a>
|
106 |
-
</center>
|
107 |
-
<br />
|
108 |
-
|
109 |
-
<?php include $this->plugin_path() . '/templates/downloads-list-compact.php'; ?>
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
<?php endif; ?>
|
114 |
-
|
115 |
-
<?php
|
116 |
-
if( isset( $args[ 'name' ] ) ):
|
117 |
-
$support_link = $this->get_support_tag_by_name($args['name'], $args['repository']); ?>
|
118 |
-
|
119 |
-
<?php if($support_link): ?>
|
120 |
-
<p><a href="<?php echo $support_link ?>" target="_blank"><?php printf(__('%s support on wpml.org', 'installer'), $args['name'] ) ?></a></p>
|
121 |
-
|
122 |
-
<?php endif; ?>
|
123 |
-
<?php
|
124 |
-
// compatibility for installer 1.1
|
125 |
-
elseif( isset( $args[ 'support_link' ] ) ): ?>
|
126 |
-
<p><?php echo $args[ 'support_link' ]; ?></p>
|
127 |
-
<?php endif; ?>
|
128 |
-
|
129 |
</div>
|
1 |
+
<h3><?php echo $args['box_title'] ?></h3>
|
2 |
+
|
3 |
+
<?php
|
4 |
+
if(empty($args['repository']) || empty($args['package']) || empty($args['product'])){
|
5 |
+
echo __('Incorrect setup', 'installer');
|
6 |
+
return;
|
7 |
+
}
|
8 |
+
|
9 |
+
$product = false;
|
10 |
+
foreach($this->settings['repositories'][$repository_id]['data']['packages'] as $package_idx => $package){
|
11 |
+
|
12 |
+
//pre 1.3 backwardds compatibility
|
13 |
+
if(!isset($package['id'])){
|
14 |
+
$package['id'] = sanitize_title_with_dashes($package['name']);
|
15 |
+
}
|
16 |
+
|
17 |
+
if($package['id'] == $args['package']){
|
18 |
+
$product = $this->settings['repositories'][$repository_id]['data']['packages'][$package_idx]['products'][$args['product']];
|
19 |
+
break;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
|
24 |
+
if(!$product){
|
25 |
+
echo __('Invalid product', 'installer');
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
|
29 |
+
if(isset($this->settings['repositories'][$repository_id])){
|
30 |
+
if(isset($this->settings['repositories'][$repository_id]['subscription']['key'])){
|
31 |
+
$site_key = $this->settings['repositories'][$repository_id]['subscription']['key'];
|
32 |
+
}else{
|
33 |
+
$site_key = false;
|
34 |
+
}
|
35 |
+
}else{
|
36 |
+
echo __('Unknown repository', 'installer');
|
37 |
+
return;
|
38 |
+
}
|
39 |
+
|
40 |
+
$subscription_type = $this->get_subscription_type_for_repository($repository_id);
|
41 |
+
$expired = false;
|
42 |
+
|
43 |
+
if($subscription_type != $product['subscription_type'] && !$this->have_superior_subscription($subscription_type, $product) && $site_key){
|
44 |
+
$subscription_no_match = sprintf(__(' Your current site key (%s) does not match the selected product (%s).', 'installer'), $site_key, $product['name']);
|
45 |
+
}
|
46 |
+
|
47 |
+
if(!isset($args['product_name'])) $args['product_name'] = $product['name'];
|
48 |
+
|
49 |
+
?>
|
50 |
+
|
51 |
+
<div class="otgs_wp_installer_table otgs_wp_installer_table_compact">
|
52 |
+
|
53 |
+
<p><?php echo $args['box_description'] ?></p>
|
54 |
+
|
55 |
+
|
56 |
+
<?php if(!$this->repository_has_subscription($repository_id) || !empty($subscription_no_match)): ?>
|
57 |
+
|
58 |
+
<?php if(!empty($subscription_no_match)): ?>
|
59 |
+
<div class="installer-warn-box">
|
60 |
+
<?php echo $subscription_no_match; ?>
|
61 |
+
</div>
|
62 |
+
<br />
|
63 |
+
<?php endif; ?>
|
64 |
+
|
65 |
+
<a class="button-primary" href="<?php echo $this->append_parameters_to_buy_url($product['url'], $repository_id, $args) ?>"><?php printf(__('Buy %s', 'installer'), $args['product_name']) ?></a>
|
66 |
+
|
67 |
+
<div>
|
68 |
+
<br />
|
69 |
+
<?php printf(__('Already bought %s?', 'installer'), $args['product_name']) ?>
|
70 |
+
<a class="enter_site_key_js" href="#"><?php _e('Enter site key', 'installer') ?></a>
|
71 |
+
|
72 |
+
<form class="otgsi_site_key_form" method="post">
|
73 |
+
<input type="hidden" name="action" value="save_site_key" />
|
74 |
+
<input type="hidden" name="nonce" value="<?php echo wp_create_nonce('save_site_key_' . $repository_id) ?>" />
|
75 |
+
<input type="hidden" name="repository_id" value="<?php echo $repository_id ?>">
|
76 |
+
<input type="text" size="10" name="site_key_<?php echo $repository_id ?>" />
|
77 |
+
<input class="button-secondary" type="submit" value="<?php esc_attr_e('Add', 'installer') ?>" />
|
78 |
+
</form>
|
79 |
+
<div class="installer-error-box hidden" style="margin-top:10px;"></div>
|
80 |
+
</div>
|
81 |
+
|
82 |
+
<?php else: ?>
|
83 |
+
|
84 |
+
<?php if($this->repository_has_expired_subscription($repository_id)): $expired = true; ?>
|
85 |
+
|
86 |
+
<div><p class="installer-warn-box"><?php _e('Subscription is expired.', 'installer') ?></p></div>
|
87 |
+
|
88 |
+
<?php else: ?>
|
89 |
+
|
90 |
+
<?php if($this->show_subscription_renew_warning($repository_id, $subscription_type)): ?>
|
91 |
+
|
92 |
+
<ul class="installer-products-list">
|
93 |
+
<?php foreach($product['renewals'] as $renewal): ?>
|
94 |
+
<li>
|
95 |
+
<a href="<?php echo $this->append_parameters_to_buy_url($renewal['url'], $repository_id, $args) ?>"><?php printf(__('Renew %s', 'installer'), $args['product_name']) ?></a>
|
96 |
+
</li>
|
97 |
+
<?php endforeach; ?>
|
98 |
+
</ul>
|
99 |
+
|
100 |
+
<?php endif; ?>
|
101 |
+
|
102 |
+
<?php endif; ?>
|
103 |
+
|
104 |
+
<center>
|
105 |
+
<a class="remove_site_key_js" href="#" data-repository=<?php echo $repository_id ?> data-confirmation="<?php esc_attr_e('Are you sure you want to remove this site key?', 'installer') ?>" data-nonce="<?php echo wp_create_nonce('remove_site_key_' . $repository_id) ?>"><?php printf(__("Remove current site key (%s)", 'installer'), $site_key) ?></a>
|
106 |
+
</center>
|
107 |
+
<br />
|
108 |
+
|
109 |
+
<?php include $this->plugin_path() . '/templates/downloads-list-compact.php'; ?>
|
110 |
+
|
111 |
+
|
112 |
+
|
113 |
+
<?php endif; ?>
|
114 |
+
|
115 |
+
<?php
|
116 |
+
if( isset( $args[ 'name' ] ) ):
|
117 |
+
$support_link = $this->get_support_tag_by_name($args['name'], $args['repository']); ?>
|
118 |
+
|
119 |
+
<?php if($support_link): ?>
|
120 |
+
<p><a href="<?php echo $support_link ?>" target="_blank"><?php printf(__('%s support on wpml.org', 'installer'), $args['name'] ) ?></a></p>
|
121 |
+
|
122 |
+
<?php endif; ?>
|
123 |
+
<?php
|
124 |
+
// compatibility for installer 1.1
|
125 |
+
elseif( isset( $args[ 'support_link' ] ) ): ?>
|
126 |
+
<p><?php echo $args[ 'support_link' ]; ?></p>
|
127 |
+
<?php endif; ?>
|
128 |
+
|
129 |
</div>
|
plus/installer/templates/repository-listing.php
CHANGED
@@ -1,167 +1,167 @@
|
|
1 |
-
<?php if(($match = $this->get_matching_cp($repository)) && $match['exp']): ?>
|
2 |
-
<p class="alignright installer_highlight"><strong><?php printf('Price offers available until %s', date_i18n(get_option( 'date_format' ), $match['exp'])) ?></strong></p>
|
3 |
-
<?php endif; ?>
|
4 |
-
|
5 |
-
<h3 id="repository-<?php echo $repository_id ?>"><?php echo $repository['data']['name'] ?></h3>
|
6 |
-
<?php
|
7 |
-
$generic_product_name = $this->settings['repositories'][$repository_id]['data']['product-name'];
|
8 |
-
?>
|
9 |
-
<table class="widefat otgs_wp_installer_table" id="installer_repo_<?php echo $repository_id ?>">
|
10 |
-
|
11 |
-
<tr>
|
12 |
-
<td> </td>
|
13 |
-
<td class="otgsi_register_product_wrap" align="center" valign="top">
|
14 |
-
<?php // IF NO SUBSCRIPTION ?>
|
15 |
-
<?php if(!$this->repository_has_subscription($repository_id)): ?>
|
16 |
-
|
17 |
-
<div style="text-align: right;">
|
18 |
-
<span><?php _e('Already bought?', 'installer'); ?> </span>
|
19 |
-
<a class="enter_site_key_js button-primary" href="#"><?php printf(__('Register %s', 'installer'), $generic_product_name); ?></a>
|
20 |
-
<form class="otgsi_site_key_form" method="post">
|
21 |
-
<input type="hidden" name="action" value="save_site_key" />
|
22 |
-
<input type="hidden" name="nonce" value="<?php echo wp_create_nonce('save_site_key_' . $repository_id) ?>" />
|
23 |
-
<input type="hidden" name="repository_id" value="<?php echo $repository_id ?>">
|
24 |
-
<?php _e('2. Enter your site key', 'installer'); ?>
|
25 |
-
<input type="text" size="10" name="site_key_<?php echo $repository_id ?>" placeholder="<?php echo esc_attr('site key') ?>" />
|
26 |
-
<input class="button-primary" type="submit" value="<?php esc_attr_e('OK', 'installer') ?>" />
|
27 |
-
<input class="button-secondary cancel_site_key_js" type="button" value="<?php esc_attr_e('Cancel', 'installer') ?>" />
|
28 |
-
|
29 |
-
<div class="alignleft" style="margin-top:6px;"><?php printf(__('1. Go to your %s%s account%s and add this site URL: %s', 'installer'),
|
30 |
-
'<a href="' . $this->settings['repositories'][$repository_id]['data']['site_keys_management_url'] . '?add='.urlencode($this->get_installer_site_url()).'">',
|
31 |
-
$generic_product_name, '</a>', $this->get_installer_site_url()); ?></div>
|
32 |
-
|
33 |
-
<div class="installer-error-box hidden" style="margin-top:10px;"></div>
|
34 |
-
|
35 |
-
</form>
|
36 |
-
|
37 |
-
|
38 |
-
</div>
|
39 |
-
|
40 |
-
<?php
|
41 |
-
$site_key = false;
|
42 |
-
|
43 |
-
// IF SUBSCRIPTION
|
44 |
-
else:
|
45 |
-
|
46 |
-
$site_key = $this->settings['repositories'][$repository_id]['subscription']['key'];
|
47 |
-
$subscription_type = $this->get_subscription_type_for_repository($repository_id);
|
48 |
-
|
49 |
-
$upgrade_options = $this->get_upgrade_options($repository_id);
|
50 |
-
$expired = false;
|
51 |
-
|
52 |
-
?>
|
53 |
-
|
54 |
-
<?php if($this->repository_has_expired_subscription($repository_id)): $expired = true; ?>
|
55 |
-
<div><p class="installer-warn-box"><?php _e('Subscription is expired. You need to either purchase a new subscription or upgrade if available.', 'installer') ?></p></div>
|
56 |
-
<?php else: ?>
|
57 |
-
<?php $this->show_subscription_renew_warning($repository_id, $subscription_type); ?>
|
58 |
-
<?php endif; ?>
|
59 |
-
|
60 |
-
<div class="alignright">
|
61 |
-
<a class="remove_site_key_js button-secondary" href="#" data-repository=<?php echo $repository_id ?> data-confirmation="<?php esc_attr_e('Are you sure you want to unregister?', 'installer') ?>" data-nonce="<?php echo wp_create_nonce('remove_site_key_' . $repository_id) ?>"><?php printf(__("Unregister %s from this site", 'installer'), $generic_product_name) ?></a>
|
62 |
-
<a class="update_site_key_js button-secondary" href="#" data-repository=<?php echo $repository_id ?> data-nonce="<?php echo wp_create_nonce('update_site_key_' . $repository_id) ?>"><?php _e('Check for updates', 'installer') ?></a>
|
63 |
-
</div>
|
64 |
-
|
65 |
-
<?php if(empty($expired)): ?>
|
66 |
-
<div class="alignleft">
|
67 |
-
<?php if($expires = $this->settings['repositories'][$repository_id]['subscription']['data']->expires): ?>
|
68 |
-
<?php printf(__('%s is registered on this site. You will receive automatic updates until %s', 'installer'), $generic_product_name, date_i18n('F j, Y', strtotime($expires))); ?>
|
69 |
-
<?php else: ?>
|
70 |
-
<?php printf(__('%s is registered on this site. Your Lifetime account gives you updates for life.', 'installer'), $generic_product_name); ?>
|
71 |
-
<?php endif; ?>
|
72 |
-
</div>
|
73 |
-
<?php endif; //if(empty($expired)) ?>
|
74 |
-
|
75 |
-
<?php endif; // if(!repository_has_subscription) ?>
|
76 |
-
|
77 |
-
</td>
|
78 |
-
</tr>
|
79 |
-
|
80 |
-
<?php
|
81 |
-
|
82 |
-
$subscription_type = isset($subscription_type) ? $subscription_type : null;
|
83 |
-
$expired = isset($expired) ? $expired : null;
|
84 |
-
$upgrade_options = isset($upgrade_options) ? $upgrade_options : null;
|
85 |
-
$packages = $this->_render_product_packages($repository['data']['packages'], $subscription_type, $expired, $upgrade_options, $repository_id);
|
86 |
-
if(empty($subscription_type) || $expired){
|
87 |
-
$subpackages_expandable = true;
|
88 |
-
}else{
|
89 |
-
$subpackages_expandable = false;
|
90 |
-
}
|
91 |
-
|
92 |
-
?>
|
93 |
-
|
94 |
-
<?php foreach($packages as $package): ?>
|
95 |
-
<tr id="repository-<?php echo $repository_id ?>_<?php echo $package['id'] ?>">
|
96 |
-
<td><img width="140" height="140" src="<?php echo $package['image_url'] ?>" /></td>
|
97 |
-
<td>
|
98 |
-
<p><strong><?php echo $package['name'] ?></strong></p>
|
99 |
-
<p><?php echo $package['description'] ?></p>
|
100 |
-
|
101 |
-
<?php if($package['products']): ?>
|
102 |
-
<?php foreach($package['products'] as $product): ?>
|
103 |
-
<ul class="installer-products-list" style="display:inline">
|
104 |
-
<li>
|
105 |
-
<a class="button-secondary" href="<?php echo $product['url'] ?>"><?php echo $product['label'] ?></a>
|
106 |
-
</li>
|
107 |
-
</ul>
|
108 |
-
<?php endforeach; ?>
|
109 |
-
<?php endif; ?>
|
110 |
-
|
111 |
-
<?php if($package['downloads']): ?>
|
112 |
-
<?php include $this->plugin_path() . '/templates/downloads-list.php'; ?>
|
113 |
-
<?php endif; ?>
|
114 |
-
|
115 |
-
<?php if(!empty($package['sub-packages'])): ?>
|
116 |
-
|
117 |
-
<?php $subpackages = $this->_render_product_packages($package['sub-packages'], $subscription_type, $expired, $upgrade_options, $repository_id); ?>
|
118 |
-
|
119 |
-
<?php if($subpackages): ?>
|
120 |
-
|
121 |
-
<?php if($subpackages_expandable): ?>
|
122 |
-
<h5><a class="installer_expand_button" href="#" title="<?php esc_attr_e('Click to see individual components options.', 'installer') ?>"><?php _e('Individual components', 'installer') ?></a></h5>
|
123 |
-
<?php endif; ?>
|
124 |
-
|
125 |
-
<table class="otgs_wp_installer_subtable" style="<?php if($subpackages_expandable) echo 'display:none' ?>">
|
126 |
-
<?php foreach($subpackages as $package): ?>
|
127 |
-
<tr id="repository-<?php echo $repository_id ?>_<?php echo $package['id'] ?>">
|
128 |
-
<td><img width="70" height="70" src="<?php echo $package['image_url'] ?>" /></td>
|
129 |
-
<td>
|
130 |
-
<p><strong><?php echo $package['name'] ?></strong></p>
|
131 |
-
<p><?php echo $package['description'] ?></p>
|
132 |
-
|
133 |
-
<?php if($package['products']): ?>
|
134 |
-
<?php foreach($package['products'] as $product): ?>
|
135 |
-
<ul class="installer-products-list" style="display:inline">
|
136 |
-
<li>
|
137 |
-
<a class="button-secondary" href="<?php echo $product['url'] ?>"><?php echo $product['label'] ?></a>
|
138 |
-
</li>
|
139 |
-
</ul>
|
140 |
-
<?php endforeach; ?>
|
141 |
-
<?php endif; ?>
|
142 |
-
|
143 |
-
<?php if($package['downloads']): ?>
|
144 |
-
<?php include $this->plugin_path() . '/templates/downloads-list.php'; ?>
|
145 |
-
<?php endif; ?>
|
146 |
-
</td>
|
147 |
-
</tr>
|
148 |
-
<?php endforeach; ?>
|
149 |
-
</table>
|
150 |
-
<?php endif; ?>
|
151 |
-
|
152 |
-
<?php endif; ?>
|
153 |
-
|
154 |
-
|
155 |
-
</td>
|
156 |
-
</tr>
|
157 |
-
|
158 |
-
<?php endforeach; ?>
|
159 |
-
|
160 |
-
</table>
|
161 |
-
|
162 |
-
|
163 |
-
<p><i><?php printf(__('This page lets you install plugins and update existing plugins. To remove any of these plugins, go to the %splugins%s page and if you have the permission to remove plugins you should be able to do this.', 'installer'), '<a href="' . admin_url('plugins.php') . '">' , '</a>'); ?></i></p>
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
<br />
|
1 |
+
<?php if((!$this->repository_has_subscription($repository_id) && $match = $this->get_matching_cp($repository)) && $match['exp']): ?>
|
2 |
+
<p class="alignright installer_highlight"><strong><?php printf('Price offers available until %s', date_i18n(get_option( 'date_format' ), $match['exp'])) ?></strong></p>
|
3 |
+
<?php endif; ?>
|
4 |
+
|
5 |
+
<h3 id="repository-<?php echo $repository_id ?>"><?php echo $repository['data']['name'] ?></h3>
|
6 |
+
<?php
|
7 |
+
$generic_product_name = $this->settings['repositories'][$repository_id]['data']['product-name'];
|
8 |
+
?>
|
9 |
+
<table class="widefat otgs_wp_installer_table" id="installer_repo_<?php echo $repository_id ?>">
|
10 |
+
|
11 |
+
<tr>
|
12 |
+
<td> </td>
|
13 |
+
<td class="otgsi_register_product_wrap" align="center" valign="top">
|
14 |
+
<?php // IF NO SUBSCRIPTION ?>
|
15 |
+
<?php if(!$this->repository_has_subscription($repository_id)): ?>
|
16 |
+
|
17 |
+
<div style="text-align: right;">
|
18 |
+
<span><?php _e('Already bought?', 'installer'); ?> </span>
|
19 |
+
<a class="enter_site_key_js button-primary" href="#"><?php printf(__('Register %s', 'installer'), $generic_product_name); ?></a>
|
20 |
+
<form class="otgsi_site_key_form" method="post">
|
21 |
+
<input type="hidden" name="action" value="save_site_key" />
|
22 |
+
<input type="hidden" name="nonce" value="<?php echo wp_create_nonce('save_site_key_' . $repository_id) ?>" />
|
23 |
+
<input type="hidden" name="repository_id" value="<?php echo $repository_id ?>">
|
24 |
+
<?php _e('2. Enter your site key', 'installer'); ?>
|
25 |
+
<input type="text" size="10" name="site_key_<?php echo $repository_id ?>" placeholder="<?php echo esc_attr('site key') ?>" />
|
26 |
+
<input class="button-primary" type="submit" value="<?php esc_attr_e('OK', 'installer') ?>" />
|
27 |
+
<input class="button-secondary cancel_site_key_js" type="button" value="<?php esc_attr_e('Cancel', 'installer') ?>" />
|
28 |
+
|
29 |
+
<div class="alignleft" style="margin-top:6px;"><?php printf(__('1. Go to your %s%s account%s and add this site URL: %s', 'installer'),
|
30 |
+
'<a href="' . $this->settings['repositories'][$repository_id]['data']['site_keys_management_url'] . '?add='.urlencode($this->get_installer_site_url()).'">',
|
31 |
+
$generic_product_name, '</a>', $this->get_installer_site_url()); ?></div>
|
32 |
+
|
33 |
+
<div class="installer-error-box hidden" style="margin-top:10px;"></div>
|
34 |
+
|
35 |
+
</form>
|
36 |
+
|
37 |
+
|
38 |
+
</div>
|
39 |
+
|
40 |
+
<?php
|
41 |
+
$site_key = false;
|
42 |
+
|
43 |
+
// IF SUBSCRIPTION
|
44 |
+
else:
|
45 |
+
|
46 |
+
$site_key = $this->settings['repositories'][$repository_id]['subscription']['key'];
|
47 |
+
$subscription_type = $this->get_subscription_type_for_repository($repository_id);
|
48 |
+
|
49 |
+
$upgrade_options = $this->get_upgrade_options($repository_id);
|
50 |
+
$expired = false;
|
51 |
+
|
52 |
+
?>
|
53 |
+
|
54 |
+
<?php if($this->repository_has_expired_subscription($repository_id)): $expired = true; ?>
|
55 |
+
<div><p class="installer-warn-box"><?php _e('Subscription is expired. You need to either purchase a new subscription or upgrade if available.', 'installer') ?></p></div>
|
56 |
+
<?php else: ?>
|
57 |
+
<?php $this->show_subscription_renew_warning($repository_id, $subscription_type); ?>
|
58 |
+
<?php endif; ?>
|
59 |
+
|
60 |
+
<div class="alignright">
|
61 |
+
<a class="remove_site_key_js button-secondary" href="#" data-repository=<?php echo $repository_id ?> data-confirmation="<?php esc_attr_e('Are you sure you want to unregister?', 'installer') ?>" data-nonce="<?php echo wp_create_nonce('remove_site_key_' . $repository_id) ?>"><?php printf(__("Unregister %s from this site", 'installer'), $generic_product_name) ?></a>
|
62 |
+
<a class="update_site_key_js button-secondary" href="#" data-repository=<?php echo $repository_id ?> data-nonce="<?php echo wp_create_nonce('update_site_key_' . $repository_id) ?>"><?php _e('Check for updates', 'installer') ?></a>
|
63 |
+
</div>
|
64 |
+
|
65 |
+
<?php if(empty($expired)): ?>
|
66 |
+
<div class="alignleft">
|
67 |
+
<?php if($expires = $this->settings['repositories'][$repository_id]['subscription']['data']->expires): ?>
|
68 |
+
<?php printf(__('%s is registered on this site. You will receive automatic updates until %s', 'installer'), $generic_product_name, date_i18n('F j, Y', strtotime($expires))); ?>
|
69 |
+
<?php else: ?>
|
70 |
+
<?php printf(__('%s is registered on this site. Your Lifetime account gives you updates for life.', 'installer'), $generic_product_name); ?>
|
71 |
+
<?php endif; ?>
|
72 |
+
</div>
|
73 |
+
<?php endif; //if(empty($expired)) ?>
|
74 |
+
|
75 |
+
<?php endif; // if(!repository_has_subscription) ?>
|
76 |
+
|
77 |
+
</td>
|
78 |
+
</tr>
|
79 |
+
|
80 |
+
<?php
|
81 |
+
|
82 |
+
$subscription_type = isset($subscription_type) ? $subscription_type : null;
|
83 |
+
$expired = isset($expired) ? $expired : null;
|
84 |
+
$upgrade_options = isset($upgrade_options) ? $upgrade_options : null;
|
85 |
+
$packages = $this->_render_product_packages($repository['data']['packages'], $subscription_type, $expired, $upgrade_options, $repository_id);
|
86 |
+
if(empty($subscription_type) || $expired){
|
87 |
+
$subpackages_expandable = true;
|
88 |
+
}else{
|
89 |
+
$subpackages_expandable = false;
|
90 |
+
}
|
91 |
+
|
92 |
+
?>
|
93 |
+
|
94 |
+
<?php foreach($packages as $package): ?>
|
95 |
+
<tr id="repository-<?php echo $repository_id ?>_<?php echo $package['id'] ?>">
|
96 |
+
<td><img width="140" height="140" src="<?php echo $package['image_url'] ?>" /></td>
|
97 |
+
<td>
|
98 |
+
<p><strong><?php echo $package['name'] ?></strong></p>
|
99 |
+
<p><?php echo $package['description'] ?></p>
|
100 |
+
|
101 |
+
<?php if($package['products']): ?>
|
102 |
+
<?php foreach($package['products'] as $product): ?>
|
103 |
+
<ul class="installer-products-list" style="display:inline">
|
104 |
+
<li>
|
105 |
+
<a class="button-secondary" href="<?php echo $product['url'] ?>"><?php echo $product['label'] ?></a>
|
106 |
+
</li>
|
107 |
+
</ul>
|
108 |
+
<?php endforeach; ?>
|
109 |
+
<?php endif; ?>
|
110 |
+
|
111 |
+
<?php if($package['downloads']): ?>
|
112 |
+
<?php include $this->plugin_path() . '/templates/downloads-list.php'; ?>
|
113 |
+
<?php endif; ?>
|
114 |
+
|
115 |
+
<?php if(!empty($package['sub-packages'])): ?>
|
116 |
+
|
117 |
+
<?php $subpackages = $this->_render_product_packages($package['sub-packages'], $subscription_type, $expired, $upgrade_options, $repository_id); ?>
|
118 |
+
|
119 |
+
<?php if($subpackages): ?>
|
120 |
+
|
121 |
+
<?php if($subpackages_expandable): ?>
|
122 |
+
<h5><a class="installer_expand_button" href="#" title="<?php esc_attr_e('Click to see individual components options.', 'installer') ?>"><?php _e('Individual components', 'installer') ?></a></h5>
|
123 |
+
<?php endif; ?>
|
124 |
+
|
125 |
+
<table class="otgs_wp_installer_subtable" style="<?php if($subpackages_expandable) echo 'display:none' ?>">
|
126 |
+
<?php foreach($subpackages as $package): ?>
|
127 |
+
<tr id="repository-<?php echo $repository_id ?>_<?php echo $package['id'] ?>">
|
128 |
+
<td><img width="70" height="70" src="<?php echo $package['image_url'] ?>" /></td>
|
129 |
+
<td>
|
130 |
+
<p><strong><?php echo $package['name'] ?></strong></p>
|
131 |
+
<p><?php echo $package['description'] ?></p>
|
132 |
+
|
133 |
+
<?php if($package['products']): ?>
|
134 |
+
<?php foreach($package['products'] as $product): ?>
|
135 |
+
<ul class="installer-products-list" style="display:inline">
|
136 |
+
<li>
|
137 |
+
<a class="button-secondary" href="<?php echo $product['url'] ?>"><?php echo $product['label'] ?></a>
|
138 |
+
</li>
|
139 |
+
</ul>
|
140 |
+
<?php endforeach; ?>
|
141 |
+
<?php endif; ?>
|
142 |
+
|
143 |
+
<?php if($package['downloads']): ?>
|
144 |
+
<?php include $this->plugin_path() . '/templates/downloads-list.php'; ?>
|
145 |
+
<?php endif; ?>
|
146 |
+
</td>
|
147 |
+
</tr>
|
148 |
+
<?php endforeach; ?>
|
149 |
+
</table>
|
150 |
+
<?php endif; ?>
|
151 |
+
|
152 |
+
<?php endif; ?>
|
153 |
+
|
154 |
+
|
155 |
+
</td>
|
156 |
+
</tr>
|
157 |
+
|
158 |
+
<?php endforeach; ?>
|
159 |
+
|
160 |
+
</table>
|
161 |
+
|
162 |
+
|
163 |
+
<p><i><?php printf(__('This page lets you install plugins and update existing plugins. To remove any of these plugins, go to the %splugins%s page and if you have the permission to remove plugins you should be able to do this.', 'installer'), '<a href="' . admin_url('plugins.php') . '">' , '</a>'); ?></i></p>
|
164 |
+
|
165 |
+
|
166 |
+
|
167 |
<br />
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: CMS, custom field, custom fields, custom post type, custom post types, fie
|
|
5 |
License: GPLv2
|
6 |
Requires at least: 3.4
|
7 |
Tested up to: 4.2.2
|
8 |
-
Stable tag: 1.7.
|
9 |
|
10 |
The complete and reliable plugin for managing custom post types, custom taxonomies and custom fields.
|
11 |
|
@@ -156,6 +156,11 @@ Additionally, Types is the only plugin that lets you define parent/child relatio
|
|
156 |
== Changelog ==
|
157 |
|
158 |
|
|
|
|
|
|
|
|
|
|
|
159 |
= 1.7.3 =
|
160 |
|
161 |
* Release date: 2015-06-25
|
5 |
License: GPLv2
|
6 |
Requires at least: 3.4
|
7 |
Tested up to: 4.2.2
|
8 |
+
Stable tag: 1.7.4
|
9 |
|
10 |
The complete and reliable plugin for managing custom post types, custom taxonomies and custom fields.
|
11 |
|
156 |
== Changelog ==
|
157 |
|
158 |
|
159 |
+
= 1.7.4 =
|
160 |
+
|
161 |
+
* Release date: 2015-07-09
|
162 |
+
* Change Installer version to 1.6.1
|
163 |
+
|
164 |
= 1.7.3 =
|
165 |
|
166 |
* Release date: 2015-06-25
|
wpcf.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
Description: Define custom post types, custom taxonomies and custom fields.
|
6 |
Author: OnTheGoSystems
|
7 |
Author URI: http://www.onthegosystems.com
|
8 |
-
Version: 1.7.
|
9 |
*/
|
10 |
/**
|
11 |
*
|
@@ -16,7 +16,7 @@ if ( !defined( 'WPCF_VERSION' ) ) {
|
|
16 |
/**
|
17 |
* make sure that WPCF_VERSION in embedded/bootstrap.php is the same!
|
18 |
*/
|
19 |
-
define( 'WPCF_VERSION', '1.7.
|
20 |
}
|
21 |
|
22 |
define( 'WPCF_REPOSITORY', 'http://api.wp-types.com/' );
|
5 |
Description: Define custom post types, custom taxonomies and custom fields.
|
6 |
Author: OnTheGoSystems
|
7 |
Author URI: http://www.onthegosystems.com
|
8 |
+
Version: 1.7.4
|
9 |
*/
|
10 |
/**
|
11 |
*
|
16 |
/**
|
17 |
* make sure that WPCF_VERSION in embedded/bootstrap.php is the same!
|
18 |
*/
|
19 |
+
define( 'WPCF_VERSION', '1.7.4' );
|
20 |
}
|
21 |
|
22 |
define( 'WPCF_REPOSITORY', 'http://api.wp-types.com/' );
|