Version Description
= Social Media Floating Icons - 4.2 = * Fix - Perfomance Improvements * Fix - Update Bug Fixes * New Feature - Easy Option to Install Addons
= Social Media Floating Icons - 4.1.4 = * Fix - Perfomance Improvements
= Social Media Floating Icons - 4.1.3 = * Fix - Perfomance Improvements * 6 New Icon Styles * Instagram Support Added * Code Improvements * Fixes for wordpress deprecated functions
= Social Media Floating Icons - 4.1.2 = * Fix - Perfomance Improvements * Stable Release
= Social Media Floating Icons - 4.1.1 = * Fix - Perfomance Improvements * Stable Release
= Social Media Floating Icons - 4.1 = * New - Added Translation Support * Fix - Perfomance Improvements * New - Addon Support * Stable Release
= Floating Social Media Icon - 4.0 = * Total Programming Logic Changes * Perfomance Improvements * Addon Support * Optimized Speed * Improved and Solid Structure * Stable Release
= Floating Social Media Icon - 3.0 = * Big Improvements on User Interface * Perfomance Improvements * Updated Twitter Icons * Updated Google Plus Icons * Icon Links No Follow Support * Stable Release
= Floating Social Media Icon - 2.3 = * Aug 25, 2015 | NOTE: Updating Plugin Will Not Change Your Settings/Configuration.. Update With Confidence :) * Code Optimization * Stable Release
= Floating Social Media Icon - 2.2 = * Aug 19, 2015 | NOTE: Updating Plugin Will Not Change Your Settings/Configuration.. Update With Confidence :) * Security Fix * Stable Release
= Floating Social Media Icon - 2.1 = * May 30, 2015 | NOTE: Updating Plugin Will Not Change Your Settings/Configuration.. Update With Confidence :) * Optimized Codes * Performance Improvements * Stable Release
= Floating Social Media Icon - 2.0 = * April 18, 2015 | NOTE: Updating Plugin Will Not Change Your Settings/Configuration.. Update With Confidence :) * Optimized Codes * Fixed Bugs With Facebook * Stable Release
= Floating Social Media Icon - 1.3.9 = * Feb 20, 2015 | NOTE: Updating Plugin Will Not Change Your Settings/Configuration.. Update With Confidence :) * Optimized Codes * Stable Release
= Floating Social Media Icon - 1.3.8 = * Dec 25, 2014 | NOTE: Updating Plugin Wwill Not Change Your Settings/Configuration.. Update With Confidence :) * UI Design Improvements * Improved Floating Icon Display Logic * Improved Programming * Fixed Icon Display CSS Bugs * Added Width and Height Attributes to Icons SRC * Completely Removed Green Menu Highlighting * Now you can align php/shortcode icons to left, right or centre * Stable Release
= Floating Social Media Icon - 1.3.7 = * Nov 02, 2014 | NOTE: UPGRADING PLUGIN WILL NOT CHANGE YOUR SETTINGS/CONFIGURATION.. UPGRADE WITH CONFIDENCE :) * Minor Bug Fixes * Stable Release
= Floating Social Media Icon - 1.3.6 = * Sep 22, 2014 | NOTE: UPGRADING PLUGIN WILL NOT CHANGE YOUR SETTINGS/CONFIGURATION.. UPGRADE WITH CONFIDENCE :) * Minor Bug Fixes * Stable Release
= Floating Social Media Icon - 1.3.5 = * June 04, 2014 | NOTE: Upgrading Will Not Make Any Changes to Settings/Configurations. Upgrade With Confidence :) * Added Option to Disable Floating Icons on Mobile Devices * Theme Warning Ignore Option * Added Troubleshooting Options * Improved User Interface * Stable Release
= Floating Social Media Icon - 1.3.4 = * March 07, 2014 | NOTE: UPGRADING PLUGIN WILL NOT CHANGE YOUR SETTINGS/CONFIGURATION.. UPGRADE WITH CONFIDENCE :) * Added Theme Warning Ignore Option * Optimized Codes * Updated Option Description
= Floating Social Media Icon - 1.3.3 = * January 05, 2014 | NOTE: UPGRADING PLUGIN WILL NOT CHANGE YOUR SETTINGS/CONFIGURATION.. UPGRADE WITH CONFIDENCE :) * Minor Bug Fixes * Optimized Codes * Spelling Corrections
= Floating Social Media Icon - 1.3.2 = * October 10, 2013 | NOTE: UPGRADING PLUGIN WILL NOT CHANGE YOUR SETTINGS/CONFIGURATION.. UPGRADE WITH CONFIDENCE :) * Stable Release * Minor Bug Fixes * Optimized Codes
= Floating Social Media Icon - 1.3.1 = * August 28, 2013 | NOTE: UPGRADING PLUGIN WILL NOT CHANGE YOUR SETTINGS/CONFIGURATION.. UPGRADE WITH CONFIDENCE :) * Stable Release * Security Improvements * Bug Fixes
= Floating Social Media Icon - 1.3 = * June 26, 2013 | NOTE: UPGRADING PLUGIN WILL NOT CHANGE YOUR SETTINGS/CONFIGURATION.. UPGRADE WITH CONFIDENCE :) * Stable Release * Improved UI * Improved Programming Structure
= Floating Social Media Icon - 1.2 = * February 20, 2013 | NOTE: UPGRADING PLUGIN WILL NOT CHANGE YOUR SETTINGS/CONFIGURATION.. UPGRADE WITH CONFIDENCE :) * Added Option to disable highlighting menu on admin area * Added Option to disable highlighting plugin on plugin list * Improved CSS Styling * Improved Programming Structure * Stable Release
= Floating Social Media Icon - 1.1.5 = * November 29, 2012 | NOTE: UPGRADING PLUGIN WILL NOT CHANGE YOUR SETTINGS/CONFIGURATION.. UPGRADE WITH CONFIDENCE :) * Added Misc settings. * Now in Misc settings - You have option to fix icons displaying in vertical issue. * Added alt tags to icons. * Fixed Missing Argument Issue. * Added title tags to icon links. * Graphics Improvements
= Floating Social Media Icon - 1.1.4 = * July 14, 2012 | NOTE: UPGRADING PLUGIN WILL NOT CHANGE YOUR SETTINGS/CONFIGURATION.. UPGRADE WITH CONFIDENCE :).. * Added Align Option In Widget Settings * Fixed Conflict With Other Plugins Settings Menu so Acx Social Icon Menu will not Disappear
= Floating Social Media Icon - 1.1.3 = * June 01, 2012 | NOTE: UPGRADING PLUGIN WILL NOT CHANGE YOUR SETTINGS/CONFIGURATION.. UPGRADE WITH CONFIDENCE :).. * Optimized Images * Stable Release
= Floating Social Media Icon - 1.1.2 = * May 08, 2012 | NOTE: UPGRADING PLUGIN WILL NOT CHANGE YOUR SETTINGS/CONFIGURATION.. UPGRADE WITH CONFIDENCE :).. * Added Rss Feed Support * Better Icon Quality
= Floating Social Media Icon - 1.1.1 = * April 20, 2012 | NOTE: UPGRADING PLUGIN WILL NOT CHANGE YOUR SETTINGS/CONFIGURATION.. UPGRADE WITH CONFIDENCE :).. * Fixed Minor Styling Problem * Fixed Icon Size Problem on Manual Icon Display via Php
= Floating Social Media Icon - 1.1 = * April 06, 2012 * Added Code Security * Now You can have as many widgets where you can define icon size and icon design for each widget. * Now You can have Shortcode customization where you can define icon size and icon design for each shortcodes (Check Faq for more info).
= Floating Social Media Icon - 1.0.9 = * March 21, 2012 * Added Pinterest * Added drag and drop reorder option * AFTER UPDATE YOU NEED TO VISIT THE PLUGIN SETTINGS PAGE TO START SHOWING THE ICONS (Upgrade Will Not Alter Your Settings).
= Floating Social Media Icon - 1.0.8 = * March 14, 2012 * Added More Icon Designs * Fixed Minor Layout Issues
= Floating Social Media Icon - 1.0.7 = * March 12, 2012 * More Icon Theme/Style * Updated User Interface * Updated Faq * Added Google Plus Support
= Floating Social Media Icon - 1.0.6 = * March 11, 2012 * Fixed Alignment Problem When Displaying All Icons With Bigger Size
= Floating Social Media Icon - 1.0.5 = * March 10, 2012 * Major Fix For More Theme Compatibility
= Floating Social Media Icon - 1.0.4 = * March 09, 2012 * Fixed Some Reported Bugs
= Floating Social Media Icon - 1.0.3 = * Major Fix to Support Older Versions of Wordpress
= Floating Social Media Icon - 1.0.2 = * Fixed Design Icon Clarity
Release Info
Developer | Acurax |
Plugin | Social Media Flying Icons | Floating Social Media Icon |
Version | 4.2 |
Comparing to | |
See all releases |
Code changes from version 4.1.4 to 4.2
- acurax-social-icon.php +11 -4
- css/fsmi_addons.css +183 -0
- function.php +8 -8
- images/delete.png +0 -0
- images/fsmi_sic_addon.jpg +0 -0
- images/loading.gif +0 -0
- images/power_addon.jpg +0 -0
- images/refresh.png +0 -0
- includes/acx-fsmi-licence-activation.php +4473 -0
- includes/acx_fsmi_addons.php +4 -0
- includes/hook_functions.php +24 -0
- includes/hooks.php +22 -0
- includes/option_fields.php +31 -0
- readme.txt +10 -0
@@ -4,7 +4,7 @@ Plugin Name: Social Media Flying Icons | Floating Social Media Icon
|
|
4 |
Plugin URI: http://www.acurax.com/products/floating-social-media-icon-plugin-wordpress/
|
5 |
Description: Floating Social Media Icon / Social Media Floating Icons is a complete solution that help you to have Interactive Social Media Icons on your website which links to your social media profiles. The icons will catch your visitors attention by flying from top left to bottom right of your website.Its highly customizable with Drag and Drop Icon Reorder, Icon Size, Multiple Icon Styles etc.
|
6 |
Author: Acurax
|
7 |
-
Version: 4.
|
8 |
Author URI: http://www.acurax.com/home.php
|
9 |
License: GPLv2 or later
|
10 |
Text Domain: floating-social-media-icon
|
@@ -31,11 +31,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
31 |
define("ACX_FSMI_BASE_LOCATION",plugin_dir_url( __FILE__ ));
|
32 |
define("ACX_FSMI_WP_SLUG","floating-social-media-icon");
|
33 |
define('ACX_FSMI_TOTAL_STATIC_SERVICES', 8);
|
34 |
-
define('ACX_FSMI_C_VERSION', '4.
|
35 |
include_once(plugin_dir_path( __FILE__ ).'/function.php');
|
36 |
include_once(plugin_dir_path( __FILE__ ).'/includes/hooks.php');
|
37 |
include_once(plugin_dir_path( __FILE__ ).'/includes/hook_functions.php');
|
38 |
include_once(plugin_dir_path( __FILE__ ).'/includes/option_fields.php');
|
|
|
39 |
//*********** Include Additional Menu ********************
|
40 |
function AcuraxLinks($links, $file) {
|
41 |
$plugin = plugin_basename(__FILE__);
|
@@ -68,12 +69,14 @@ function acx_fsmi_social_icon_help()
|
|
68 |
{
|
69 |
include(plugin_dir_path( __FILE__ ).'/includes/acx_fsmi_social_help.php');
|
70 |
}
|
71 |
-
|
|
|
|
|
|
|
72 |
function acx_fsmi_social_icon_premium()
|
73 |
{
|
74 |
include(plugin_dir_path( __FILE__ ).'/includes/acx_fsmi_premium.php');
|
75 |
}
|
76 |
-
|
77 |
function acx_fsmi_social_icon_misc()
|
78 |
{
|
79 |
include(plugin_dir_path( __FILE__ ).'/includes/acx_fsmi_misc.php');
|
@@ -87,9 +90,13 @@ function acx_fsmi_admin_actions()
|
|
87 |
|
88 |
add_submenu_page( 'Acurax-Social-Icons-Settings', __( 'Acurax Social Icon Misc Settings', 'floating-social-media-icon' ), __( 'Misc', 'floating-social-media-icon' ), 'manage_options', 'Acurax-Social-Icons-Misc' ,'acx_fsmi_social_icon_misc');
|
89 |
|
|
|
|
|
90 |
add_submenu_page( 'Acurax-Social-Icons-Settings', __( 'Acurax Troubleshooter', 'floating-social-media-icon' ), __( 'Troubleshoot', 'floating-social-media-icon' ), 'manage_options', 'Acurax-Social-Icons-Troubleshooter' ,'acx_fsmi_expert_support');
|
91 |
if($acx_si_fsmi_hide_expert_support_menu == "no") {
|
|
|
92 |
add_submenu_page( 'Acurax-Social-Icons-Settings', __( 'Expert Wordpress Support From Acurax', 'floating-social-media-icon' ), __( 'Expert Support', 'floating-social-media-icon' ), 'manage_options', 'Acurax-Social-Icons-Expert-Support' ,'acx_fsmi_expert_support');
|
|
|
93 |
}
|
94 |
add_submenu_page( 'Acurax-Social-Icons-Settings', __( 'Acurax Social Icon Help and Support', 'floating-social-media-icon' ), __( 'Help', 'floating-social-media-icon' ), 'manage_options', 'Acurax-Social-Icons-Help' ,'acx_fsmi_social_icon_help');
|
95 |
}
|
4 |
Plugin URI: http://www.acurax.com/products/floating-social-media-icon-plugin-wordpress/
|
5 |
Description: Floating Social Media Icon / Social Media Floating Icons is a complete solution that help you to have Interactive Social Media Icons on your website which links to your social media profiles. The icons will catch your visitors attention by flying from top left to bottom right of your website.Its highly customizable with Drag and Drop Icon Reorder, Icon Size, Multiple Icon Styles etc.
|
6 |
Author: Acurax
|
7 |
+
Version: 4.2
|
8 |
Author URI: http://www.acurax.com/home.php
|
9 |
License: GPLv2 or later
|
10 |
Text Domain: floating-social-media-icon
|
31 |
define("ACX_FSMI_BASE_LOCATION",plugin_dir_url( __FILE__ ));
|
32 |
define("ACX_FSMI_WP_SLUG","floating-social-media-icon");
|
33 |
define('ACX_FSMI_TOTAL_STATIC_SERVICES', 8);
|
34 |
+
define('ACX_FSMI_C_VERSION', '4.2');
|
35 |
include_once(plugin_dir_path( __FILE__ ).'/function.php');
|
36 |
include_once(plugin_dir_path( __FILE__ ).'/includes/hooks.php');
|
37 |
include_once(plugin_dir_path( __FILE__ ).'/includes/hook_functions.php');
|
38 |
include_once(plugin_dir_path( __FILE__ ).'/includes/option_fields.php');
|
39 |
+
include_once(plugin_dir_path( __FILE__ ).'includes/acx-fsmi-licence-activation.php');
|
40 |
//*********** Include Additional Menu ********************
|
41 |
function AcuraxLinks($links, $file) {
|
42 |
$plugin = plugin_basename(__FILE__);
|
69 |
{
|
70 |
include(plugin_dir_path( __FILE__ ).'/includes/acx_fsmi_social_help.php');
|
71 |
}
|
72 |
+
function acx_fsmi_addons_page()
|
73 |
+
{
|
74 |
+
include(plugin_dir_path( __FILE__ ).'includes/acx_fsmi_addons.php');
|
75 |
+
}
|
76 |
function acx_fsmi_social_icon_premium()
|
77 |
{
|
78 |
include(plugin_dir_path( __FILE__ ).'/includes/acx_fsmi_premium.php');
|
79 |
}
|
|
|
80 |
function acx_fsmi_social_icon_misc()
|
81 |
{
|
82 |
include(plugin_dir_path( __FILE__ ).'/includes/acx_fsmi_misc.php');
|
90 |
|
91 |
add_submenu_page( 'Acurax-Social-Icons-Settings', __( 'Acurax Social Icon Misc Settings', 'floating-social-media-icon' ), __( 'Misc', 'floating-social-media-icon' ), 'manage_options', 'Acurax-Social-Icons-Misc' ,'acx_fsmi_social_icon_misc');
|
92 |
|
93 |
+
add_submenu_page('Acurax-Social-Icons-Settings', __('Acurax Social Icon Available Add-ons','floating-social-media-icon'), __('Add-ons','floating-social-media-icon'), 'manage_options', 'Acurax-Social-Icons-Add-ons' ,'acx_fsmi_addons_page');
|
94 |
+
|
95 |
add_submenu_page( 'Acurax-Social-Icons-Settings', __( 'Acurax Troubleshooter', 'floating-social-media-icon' ), __( 'Troubleshoot', 'floating-social-media-icon' ), 'manage_options', 'Acurax-Social-Icons-Troubleshooter' ,'acx_fsmi_expert_support');
|
96 |
if($acx_si_fsmi_hide_expert_support_menu == "no") {
|
97 |
+
|
98 |
add_submenu_page( 'Acurax-Social-Icons-Settings', __( 'Expert Wordpress Support From Acurax', 'floating-social-media-icon' ), __( 'Expert Support', 'floating-social-media-icon' ), 'manage_options', 'Acurax-Social-Icons-Expert-Support' ,'acx_fsmi_expert_support');
|
99 |
+
|
100 |
}
|
101 |
add_submenu_page( 'Acurax-Social-Icons-Settings', __( 'Acurax Social Icon Help and Support', 'floating-social-media-icon' ), __( 'Help', 'floating-social-media-icon' ), 'manage_options', 'Acurax-Social-Icons-Help' ,'acx_fsmi_social_icon_help');
|
102 |
}
|
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#fsmi_addons_intro_holder
|
2 |
+
{
|
3 |
+
display: block;
|
4 |
+
width: 98%;
|
5 |
+
}
|
6 |
+
.fsmi_addons_intro
|
7 |
+
{
|
8 |
+
background: white none repeat scroll 0 0;
|
9 |
+
border: 1px solid #7cbac3;
|
10 |
+
border-radius: 2px;
|
11 |
+
box-sizing: border-box;
|
12 |
+
cursor: pointer;
|
13 |
+
display: block;
|
14 |
+
float: left;
|
15 |
+
font-family: arial;
|
16 |
+
font-size: 12px;
|
17 |
+
height: 460px;
|
18 |
+
margin-bottom: 2%;
|
19 |
+
margin-right: 2%;
|
20 |
+
max-height: 487px;
|
21 |
+
max-width: 100%;
|
22 |
+
padding: 10px;
|
23 |
+
text-align: center;
|
24 |
+
width: 22%;
|
25 |
+
}
|
26 |
+
.fsmi_addons_intro > img {
|
27 |
+
border: 1px dotted lightgray;
|
28 |
+
width: 100%;
|
29 |
+
}
|
30 |
+
.fsmi_addons_intro h3 {
|
31 |
+
color: #3c87b3;
|
32 |
+
font-family: arial;
|
33 |
+
font-size: 15px;
|
34 |
+
text-decoration: none;
|
35 |
+
text-transform: capitalize;
|
36 |
+
}
|
37 |
+
.fsmi_addons_intro > p {
|
38 |
+
font-family: Helvetica;
|
39 |
+
font-size: 12px;
|
40 |
+
height: 165px;
|
41 |
+
line-height: 18px;
|
42 |
+
text-align: justify;
|
43 |
+
}
|
44 |
+
.fsmi_addons_intro .fsmi_addon_button {
|
45 |
+
border: 1px solid black;
|
46 |
+
box-sizing: border-box;
|
47 |
+
color: black;
|
48 |
+
display: block;
|
49 |
+
margin-left: auto;
|
50 |
+
margin-right: auto;
|
51 |
+
padding: 6px;
|
52 |
+
text-decoration: none;
|
53 |
+
border-radius: 2px;
|
54 |
+
width: 85%;
|
55 |
+
}
|
56 |
+
.fsmi_addons_intro .fsmi_addon_button:hover {
|
57 |
+
background:#f8f8f8;
|
58 |
+
}
|
59 |
+
/* Addon Page*/
|
60 |
+
.acx_fsmi_add_p_licen > a {
|
61 |
+
background-color: #0052db;
|
62 |
+
color: #e3e3e3;
|
63 |
+
padding: 10px;
|
64 |
+
cursor: pointer;
|
65 |
+
}
|
66 |
+
.acx_fsmi_add_p_licence_light_cvr {
|
67 |
+
background-color: rgba(0, 0, 0, 0.9);
|
68 |
+
height: 100%;
|
69 |
+
left: 0;
|
70 |
+
position: fixed;
|
71 |
+
top: 0;
|
72 |
+
width: 100%;
|
73 |
+
z-index: 9999;
|
74 |
+
display:none;
|
75 |
+
}
|
76 |
+
.acx_fsmi_add_p_licence_light_cls
|
77 |
+
{
|
78 |
+
background:url(../images/close.png) no-repeat center center;
|
79 |
+
width:40px;
|
80 |
+
height:40px;
|
81 |
+
position:absolute;
|
82 |
+
right: 0;
|
83 |
+
top: 0;
|
84 |
+
cursor:pointer;
|
85 |
+
}
|
86 |
+
.acx_fsmi_add_p_licence_li_cn {
|
87 |
+
background-color: #fff;
|
88 |
+
border-radius: 5px;
|
89 |
+
left: 50%;
|
90 |
+
position: absolute;
|
91 |
+
top: 50%;
|
92 |
+
-webkit-transform: translate(-50%, -50%);
|
93 |
+
-moz-transform: translate(-50%, -50%);
|
94 |
+
-ms-transform: translate(-50%, -50%);
|
95 |
+
-o-transform: translate(-50%, -50%);
|
96 |
+
transform: translate(-50%, -50%);
|
97 |
+
width: 370px;
|
98 |
+
padding:40px 25px;
|
99 |
+
}
|
100 |
+
.acx_fsmi_p_li_span {
|
101 |
+
display: block;
|
102 |
+
float: left;
|
103 |
+
width: 100%;
|
104 |
+
}
|
105 |
+
.acx_fsmi_p_li_span input {
|
106 |
+
padding: 8px;
|
107 |
+
width: 100%;
|
108 |
+
}
|
109 |
+
.acx_fsmi_add_p_li_cls {
|
110 |
+
clear: both;
|
111 |
+
color: #fff;
|
112 |
+
cursor: pointer;
|
113 |
+
float: right;
|
114 |
+
margin-left: auto !important;
|
115 |
+
margin-right: auto !important;
|
116 |
+
text-align: center;
|
117 |
+
width: 25%;
|
118 |
+
}
|
119 |
+
.acx_fsmi_pu_li_error {
|
120 |
+
color: red;
|
121 |
+
display: block;
|
122 |
+
margin-top: 10px;
|
123 |
+
}
|
124 |
+
.acx_fsmi_install_ignore {
|
125 |
+
float: right;
|
126 |
+
cursor:pointer;
|
127 |
+
}
|
128 |
+
.acx_fsmi_purchased_li_cvr {
|
129 |
+
display: block;
|
130 |
+
float: left;
|
131 |
+
width: 100%;
|
132 |
+
}
|
133 |
+
#acx_fsmip_loading_1
|
134 |
+
{
|
135 |
+
background: rgba(1, 1, 1, 0.5);
|
136 |
+
height: 100%;
|
137 |
+
left: 0;
|
138 |
+
position: fixed;
|
139 |
+
top: 0;
|
140 |
+
width: 100%;
|
141 |
+
z-index: 1000;
|
142 |
+
}
|
143 |
+
#acx_fsmip_loading_1 .load_1
|
144 |
+
{
|
145 |
+
background: url("../images/loading.gif") no-repeat scroll 50% 50% transparent;
|
146 |
+
border-radius: 20px 20px 20px 20px;
|
147 |
+
height: 100px;
|
148 |
+
margin-left: -40px;
|
149 |
+
margin-top : -40px;
|
150 |
+
top:40%;
|
151 |
+
left:50%;
|
152 |
+
position: absolute;
|
153 |
+
opacity: 0.6;
|
154 |
+
width: 100px;
|
155 |
+
}
|
156 |
+
.acx_fsmi_option_page_hold_cvr {
|
157 |
+
padding-bottom: 70px !important;
|
158 |
+
}
|
159 |
+
.acx_fsmi_lic_del
|
160 |
+
{
|
161 |
+
background: url("../images/delete.png") no-repeat center center;
|
162 |
+
}
|
163 |
+
.acx_fsmi_lic_refresh
|
164 |
+
{
|
165 |
+
background: url("../images/refresh.png") no-repeat center center;
|
166 |
+
}
|
167 |
+
.ax_fsmi_action_icon {
|
168 |
+
background-size: 21px auto;
|
169 |
+
display: inline-block;
|
170 |
+
height: 21px;
|
171 |
+
margin: 0 5px;
|
172 |
+
vertical-align: middle;
|
173 |
+
width: 21px;
|
174 |
+
cursor: pointer;
|
175 |
+
}
|
176 |
+
.acx_hide_refresh
|
177 |
+
{
|
178 |
+
display:none;
|
179 |
+
}
|
180 |
+
.acx_show_refresh
|
181 |
+
{
|
182 |
+
display:inline-block;
|
183 |
+
}
|
@@ -27,7 +27,10 @@ function acx_fsmi_styles()
|
|
27 |
{
|
28 |
wp_register_style('acx_fsmi_admin_style', plugins_url('css/style_admin.css?v='.ACX_FSMI_C_VERSION, __FILE__));
|
29 |
wp_enqueue_style('acx_fsmi_admin_style');
|
30 |
-
|
|
|
|
|
|
|
31 |
wp_register_style('acx_fsmi_box_style', plugins_url('css/layout.css?v='.ACX_FSMI_C_VERSION, __FILE__));
|
32 |
wp_enqueue_style('acx_fsmi_box_style');
|
33 |
}
|
@@ -336,7 +339,7 @@ function acx_fsmi_orderarray_refresh()
|
|
336 |
$acx_temp_array = $social_icon_array_order;
|
337 |
foreach ($social_icon_array_order as $key => $value)
|
338 |
{
|
339 |
-
if($social_icon_array_order[$key]>=$total_arrays)
|
340 |
{
|
341 |
unset($acx_temp_array[$key]);
|
342 |
}
|
@@ -1176,7 +1179,7 @@ $ad_1 = '
|
|
1176 |
<h3>'. __("Compare and Decide","floating-social-media-icon").'</h3>
|
1177 |
</div><!-- middle_h2_1 -->
|
1178 |
|
1179 |
-
<div id="ss_features_table">
|
1180 |
|
1181 |
<div id="ss_table_header">
|
1182 |
<div class="tb_h1"> <h3>'. __("Feature Group","floating-social-media-icon").'</h3> </div><!-- tb_h1 -->
|
@@ -1508,9 +1511,6 @@ $ad_1 = '
|
|
1508 |
</div><!-- ss_y_n_holder -->
|
1509 |
|
1510 |
</div><!-- column_holder -->
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
</div><!-- ss_features_table -->
|
1515 |
|
1516 |
<div id="ad_fsmi_2_button_order" style="float: left; width: 100%;">
|
@@ -1527,8 +1527,8 @@ function acx_fsmi_saveorder_callback()
|
|
1527 |
if(!isset($_POST['acx_fsmi_saveorder_es'])) die("<br><br>".__('Unknown Error Occurred, Try Again... ','floating-social-media-icon')."<a href=''>".__('Click Here','floating-social-media-icon')."</a>");
|
1528 |
if(!wp_verify_nonce($_POST['acx_fsmi_saveorder_es'],'acx_fsmi_saveorder_es')) die("<br><br>".__('Sorry, You have no permission to do this action...','floating-social-media-icon')."<a href=''>".__('Click Here','floating-social-media-icon')."</a>");
|
1529 |
global $wpdb;
|
1530 |
-
$social_icon_array_order = $_POST['recordsArray'];
|
1531 |
-
if (current_user_can('manage_options')) {
|
1532 |
if(!is_serialized($social_icon_array_order))
|
1533 |
{
|
1534 |
$social_icon_array_order = serialize($social_icon_array_order);
|
27 |
{
|
28 |
wp_register_style('acx_fsmi_admin_style', plugins_url('css/style_admin.css?v='.ACX_FSMI_C_VERSION, __FILE__));
|
29 |
wp_enqueue_style('acx_fsmi_admin_style');
|
30 |
+
|
31 |
+
wp_register_style('acx_fsmiaddons_style', plugins_url('css/fsmi_addons.css?v='.ACX_FSMI_C_VERSION, __FILE__));
|
32 |
+
wp_enqueue_style('acx_fsmiaddons_style');
|
33 |
+
|
34 |
wp_register_style('acx_fsmi_box_style', plugins_url('css/layout.css?v='.ACX_FSMI_C_VERSION, __FILE__));
|
35 |
wp_enqueue_style('acx_fsmi_box_style');
|
36 |
}
|
339 |
$acx_temp_array = $social_icon_array_order;
|
340 |
foreach ($social_icon_array_order as $key => $value)
|
341 |
{
|
342 |
+
if($social_icon_array_order[$key]>=$total_arrays || !is_numeric($value))
|
343 |
{
|
344 |
unset($acx_temp_array[$key]);
|
345 |
}
|
1179 |
<h3>'. __("Compare and Decide","floating-social-media-icon").'</h3>
|
1180 |
</div><!-- middle_h2_1 -->
|
1181 |
|
1182 |
+
<div id="ss_features_table">
|
1183 |
|
1184 |
<div id="ss_table_header">
|
1185 |
<div class="tb_h1"> <h3>'. __("Feature Group","floating-social-media-icon").'</h3> </div><!-- tb_h1 -->
|
1511 |
</div><!-- ss_y_n_holder -->
|
1512 |
|
1513 |
</div><!-- column_holder -->
|
|
|
|
|
|
|
1514 |
</div><!-- ss_features_table -->
|
1515 |
|
1516 |
<div id="ad_fsmi_2_button_order" style="float: left; width: 100%;">
|
1527 |
if(!isset($_POST['acx_fsmi_saveorder_es'])) die("<br><br>".__('Unknown Error Occurred, Try Again... ','floating-social-media-icon')."<a href=''>".__('Click Here','floating-social-media-icon')."</a>");
|
1528 |
if(!wp_verify_nonce($_POST['acx_fsmi_saveorder_es'],'acx_fsmi_saveorder_es')) die("<br><br>".__('Sorry, You have no permission to do this action...','floating-social-media-icon')."<a href=''>".__('Click Here','floating-social-media-icon')."</a>");
|
1529 |
global $wpdb;
|
1530 |
+
$social_icon_array_order = $_POST['recordsArray'];
|
1531 |
+
if (current_user_can('manage_options')) {
|
1532 |
if(!is_serialized($social_icon_array_order))
|
1533 |
{
|
1534 |
$social_icon_array_order = serialize($social_icon_array_order);
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,4473 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$acx_fsmi_purchased_li_array = get_option('acx_fsmi_purchased_li_array');
|
3 |
+
if(is_serialized($acx_fsmi_purchased_li_array))
|
4 |
+
{
|
5 |
+
$acx_fsmi_purchased_li_array = unserialize($acx_fsmi_purchased_li_array);
|
6 |
+
}
|
7 |
+
if($acx_fsmi_purchased_li_array == "" || !is_array($acx_fsmi_purchased_li_array))
|
8 |
+
{
|
9 |
+
$acx_fsmi_purchased_li_array = array();
|
10 |
+
}
|
11 |
+
if(!empty($acx_fsmi_purchased_li_array))
|
12 |
+
{
|
13 |
+
if ( ! class_exists( 'ACX_FSMI_LICENCE_TGM_Plugin_Activation' ) ) {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Automatic plugin installation and activation library.
|
17 |
+
*
|
18 |
+
* Creates a way to automatically install and activate plugins from within themes.
|
19 |
+
* The plugins can be either bundled, downloaded from the WordPress
|
20 |
+
* Plugin Repository or downloaded from another external source.
|
21 |
+
*
|
22 |
+
* @since 1.0.0
|
23 |
+
*
|
24 |
+
* @package ACX_FSMI_LICENCE_TGM-Plugin-Activation
|
25 |
+
* @author Thomas Griffin
|
26 |
+
* @author Gary Jones
|
27 |
+
*/
|
28 |
+
class ACX_FSMI_LICENCE_TGM_Plugin_Activation {
|
29 |
+
/**
|
30 |
+
* ACX_FSMI_LICENCE_TGMPA version number.
|
31 |
+
*
|
32 |
+
* @since 2.5.0
|
33 |
+
*
|
34 |
+
* @const string Version number.
|
35 |
+
*/
|
36 |
+
const ACX_FSMI_LICENCE_TGMPA_VERSION = '2.6.1';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Regular expression to test if a URL is a WP plugin repo URL.
|
40 |
+
*
|
41 |
+
* @const string Regex.
|
42 |
+
*
|
43 |
+
* @since 2.5.0
|
44 |
+
*/
|
45 |
+
const WP_REPO_REGEX = '|^http[s]?://wordpress\.org/(?:extend/)?plugins/|';
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Arbitrary regular expression to test if a string starts with a URL.
|
49 |
+
*
|
50 |
+
* @const string Regex.
|
51 |
+
*
|
52 |
+
* @since 2.5.0
|
53 |
+
*/
|
54 |
+
const IS_URL_REGEX = '|^http[s]?://|';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Holds a copy of itself, so it can be referenced by the class name.
|
58 |
+
*
|
59 |
+
* @since 1.0.0
|
60 |
+
*
|
61 |
+
* @var ACX_FSMI_LICENCE_TGM_Plugin_Activation
|
62 |
+
*/
|
63 |
+
public static $instance;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Holds arrays of plugin details.
|
67 |
+
*
|
68 |
+
* @since 1.0.0
|
69 |
+
* @since 2.5.0 the array has the plugin slug as an associative key.
|
70 |
+
*
|
71 |
+
* @var array
|
72 |
+
*/
|
73 |
+
public $plugins = array();
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Holds arrays of plugin names to use to sort the plugins array.
|
77 |
+
*
|
78 |
+
* @since 2.5.0
|
79 |
+
*
|
80 |
+
* @var array
|
81 |
+
*/
|
82 |
+
protected $sort_order = array();
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Whether any plugins have the 'force_activation' setting set to true.
|
86 |
+
*
|
87 |
+
* @since 2.5.0
|
88 |
+
*
|
89 |
+
* @var bool
|
90 |
+
*/
|
91 |
+
protected $has_forced_activation = false;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Whether any plugins have the 'force_deactivation' setting set to true.
|
95 |
+
*
|
96 |
+
* @since 2.5.0
|
97 |
+
*
|
98 |
+
* @var bool
|
99 |
+
*/
|
100 |
+
protected $has_forced_deactivation = false;
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Name of the unique ID to hash notices.
|
104 |
+
*
|
105 |
+
* @since 2.4.0
|
106 |
+
*
|
107 |
+
* @var string
|
108 |
+
*/
|
109 |
+
public $id = 'acx_fsmi_licence_tgmpa';
|
110 |
+
|
111 |
+
/**
|
112 |
+
* Name of the query-string argument for the admin page.
|
113 |
+
*
|
114 |
+
* @since 1.0.0
|
115 |
+
*
|
116 |
+
* @var string
|
117 |
+
*/
|
118 |
+
protected $menu = 'acx_fsmi_licence_tgmpa-install-plugins';
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Parent menu file slug.
|
122 |
+
*
|
123 |
+
* @since 2.5.0
|
124 |
+
*
|
125 |
+
* @var string
|
126 |
+
*/
|
127 |
+
public $parent_slug = 'themes.php';
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Capability needed to view the plugin installation menu item.
|
131 |
+
*
|
132 |
+
* @since 2.5.0
|
133 |
+
*
|
134 |
+
* @var string
|
135 |
+
*/
|
136 |
+
public $capability = 'edit_theme_options';
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Default absolute path to folder containing bundled plugin zip files.
|
140 |
+
*
|
141 |
+
* @since 2.0.0
|
142 |
+
*
|
143 |
+
* @var string Absolute path prefix to zip file location for bundled plugins. Default is empty string.
|
144 |
+
*/
|
145 |
+
public $default_path = '';
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Flag to show admin notices or not.
|
149 |
+
*
|
150 |
+
* @since 2.1.0
|
151 |
+
*
|
152 |
+
* @var boolean
|
153 |
+
*/
|
154 |
+
public $has_notices = true;
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Flag to determine if the user can dismiss the notice nag.
|
158 |
+
*
|
159 |
+
* @since 2.4.0
|
160 |
+
*
|
161 |
+
* @var boolean
|
162 |
+
*/
|
163 |
+
public $dismissable = true;
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Message to be output above nag notice if dismissable is false.
|
167 |
+
*
|
168 |
+
* @since 2.4.0
|
169 |
+
*
|
170 |
+
* @var string
|
171 |
+
*/
|
172 |
+
public $dismiss_msg = '';
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Flag to set automatic activation of plugins. Off by default.
|
176 |
+
*
|
177 |
+
* @since 2.2.0
|
178 |
+
*
|
179 |
+
* @var boolean
|
180 |
+
*/
|
181 |
+
public $is_automatic = false;
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Optional message to display before the plugins table.
|
185 |
+
*
|
186 |
+
* @since 2.2.0
|
187 |
+
*
|
188 |
+
* @var string Message filtered by wp_kses_post(). Default is empty string.
|
189 |
+
*/
|
190 |
+
public $message = '';
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Holds configurable array of strings.
|
194 |
+
*
|
195 |
+
* Default values are added in the constructor.
|
196 |
+
*
|
197 |
+
* @since 2.0.0
|
198 |
+
*
|
199 |
+
* @var array
|
200 |
+
*/
|
201 |
+
public $strings = array();
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Holds the version of WordPress.
|
205 |
+
*
|
206 |
+
* @since 2.4.0
|
207 |
+
*
|
208 |
+
* @var int
|
209 |
+
*/
|
210 |
+
public $wp_version;
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Holds the hook name for the admin page.
|
214 |
+
*
|
215 |
+
* @since 2.5.0
|
216 |
+
*
|
217 |
+
* @var string
|
218 |
+
*/
|
219 |
+
public $page_hook;
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Adds a reference of this object to $instance, populates default strings,
|
223 |
+
* does the acx_fsmi_licence_tgmpa_init action hook, and hooks in the interactions to init.
|
224 |
+
*
|
225 |
+
* {@internal This method should be `protected`, but as too many ACX_FSMI_LICENCE_TGMPA implementations
|
226 |
+
* haven't upgraded beyond v2.3.6 yet, this gives backward compatibility issues.
|
227 |
+
* Reverted back to public for the time being.}}
|
228 |
+
*
|
229 |
+
* @since 1.0.0
|
230 |
+
*
|
231 |
+
* @see ACX_FSMI_LICENCE_TGM_Plugin_Activation::init()
|
232 |
+
*/
|
233 |
+
public function __construct() {
|
234 |
+
// Set the current WordPress version.
|
235 |
+
$this->wp_version = $GLOBALS['wp_version'];
|
236 |
+
|
237 |
+
// Announce that the class is ready, and pass the object (for advanced use).
|
238 |
+
do_action_ref_array( 'acx_fsmi_licence_tgmpa_init', array( $this ) );
|
239 |
+
|
240 |
+
/*
|
241 |
+
* Load our text domain and allow for overloading the fall-back file.
|
242 |
+
*
|
243 |
+
* {@internal IMPORTANT! If this code changes, review the regex in the custom ACX_FSMI_LICENCE_TGMPA
|
244 |
+
* generator on the website.}}
|
245 |
+
*/
|
246 |
+
add_action( 'init', array( $this, 'load_textdomain' ), 5 );
|
247 |
+
add_filter( 'load_textdomain_mofile', array( $this, 'overload_textdomain_mofile' ), 10, 2 );
|
248 |
+
|
249 |
+
// When the rest of WP has loaded, kick-start the rest of the class.
|
250 |
+
add_action( 'init', array( $this, 'init' ) );
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Magic method to (not) set protected properties from outside of this class.
|
255 |
+
*
|
256 |
+
* {@internal hackedihack... There is a serious bug in v2.3.2 - 2.3.6 where the `menu` property
|
257 |
+
* is being assigned rather than tested in a conditional, effectively rendering it useless.
|
258 |
+
* This 'hack' prevents this from happening.}}
|
259 |
+
*
|
260 |
+
* @see https://github.com/ACX_FSMI_LICENCE_TGMPA/ACX_FSMI_LICENCE_TGM-Plugin-Activation/blob/2.3.6/acx_fsmi_licence_tgm-plugin-activation/class-acx_fsmi_licence_tgm-plugin-activation.php#L1593
|
261 |
+
*
|
262 |
+
* @since 2.5.2
|
263 |
+
*
|
264 |
+
* @param string $name Name of an inaccessible property.
|
265 |
+
* @param mixed $value Value to assign to the property.
|
266 |
+
* @return void Silently fail to set the property when this is tried from outside of this class context.
|
267 |
+
* (Inside this class context, the __set() method if not used as there is direct access.)
|
268 |
+
*/
|
269 |
+
public function __set( $name, $value ) {
|
270 |
+
return;
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* Magic method to get the value of a protected property outside of this class context.
|
275 |
+
*
|
276 |
+
* @since 2.5.2
|
277 |
+
*
|
278 |
+
* @param string $name Name of an inaccessible property.
|
279 |
+
* @return mixed The property value.
|
280 |
+
*/
|
281 |
+
public function __get( $name ) {
|
282 |
+
return $this->{$name};
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Initialise the interactions between this class and WordPress.
|
287 |
+
*
|
288 |
+
* Hooks in three new methods for the class: admin_menu, notices and styles.
|
289 |
+
*
|
290 |
+
* @since 2.0.0
|
291 |
+
*
|
292 |
+
* @see ACX_FSMI_LICENCE_TGM_Plugin_Activation::admin_menu()
|
293 |
+
* @see ACX_FSMI_LICENCE_TGM_Plugin_Activation::notices()
|
294 |
+
* @see ACX_FSMI_LICENCE_TGM_Plugin_Activation::styles()
|
295 |
+
*/
|
296 |
+
public function init() {
|
297 |
+
/**
|
298 |
+
* By default ACX_FSMI_LICENCE_TGMPA only loads on the WP back-end and not in an Ajax call. Using this filter
|
299 |
+
* you can overrule that behaviour.
|
300 |
+
*
|
301 |
+
* @since 2.5.0
|
302 |
+
*
|
303 |
+
* @param bool $load Whether or not ACX_FSMI_LICENCE_TGMPA should load.
|
304 |
+
* Defaults to the return of `is_admin() && ! defined( 'DOING_AJAX' )`.
|
305 |
+
*/
|
306 |
+
if ( true !== apply_filters( 'acx_fsmi_licence_tgmpa_load', ( is_admin() && ! defined( 'DOING_AJAX' ) ) ) ) {
|
307 |
+
return;
|
308 |
+
}
|
309 |
+
|
310 |
+
// Load class strings.
|
311 |
+
$this->strings = array(
|
312 |
+
'page_title' => __( 'Install Required Plugins', 'acx_fsmi_licence_tgmpa' ),
|
313 |
+
'menu_title' => __( 'Install Plugins', 'acx_fsmi_licence_tgmpa' ),
|
314 |
+
'installing' => __( 'Installing Plugin: %s', 'acx_fsmi_licence_tgmpa' ),
|
315 |
+
'updating' => __( 'Updating Plugin: %s', 'acx_fsmi_licence_tgmpa' ),
|
316 |
+
'oops' => __( 'Something went wrong with the plugin API.', 'acx_fsmi_licence_tgmpa' ),
|
317 |
+
'notice_can_install_required' => _n_noop(
|
318 |
+
'This theme requires the following plugin: %1$s.',
|
319 |
+
'This theme requires the following plugins: %1$s.',
|
320 |
+
'acx_fsmi_licence_tgmpa'
|
321 |
+
),
|
322 |
+
'notice_can_install_recommended' => _n_noop(
|
323 |
+
'This theme recommends the following plugin: %1$s.',
|
324 |
+
'This theme recommends the following plugins: %1$s.',
|
325 |
+
'acx_fsmi_licence_tgmpa'
|
326 |
+
),
|
327 |
+
'notice_ask_to_update' => _n_noop(
|
328 |
+
'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.',
|
329 |
+
'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.',
|
330 |
+
'acx_fsmi_licence_tgmpa'
|
331 |
+
),
|
332 |
+
'notice_ask_to_update_maybe' => _n_noop(
|
333 |
+
'There is an update available for: %1$s.',
|
334 |
+
'There are updates available for the following plugins: %1$s.',
|
335 |
+
'acx_fsmi_licence_tgmpa'
|
336 |
+
),
|
337 |
+
'notice_can_activate_required' => _n_noop(
|
338 |
+
'The following required plugin is currently inactive: %1$s.',
|
339 |
+
'The following required plugins are currently inactive: %1$s.',
|
340 |
+
'acx_fsmi_licence_tgmpa'
|
341 |
+
),
|
342 |
+
'notice_can_activate_recommended' => _n_noop(
|
343 |
+
'The following recommended plugin is currently inactive: %1$s.',
|
344 |
+
'The following recommended plugins are currently inactive: %1$s.',
|
345 |
+
'acx_fsmi_licence_tgmpa'
|
346 |
+
),
|
347 |
+
'install_link' => _n_noop(
|
348 |
+
'Begin installing plugin',
|
349 |
+
'Begin installing plugins',
|
350 |
+
'acx_fsmi_licence_tgmpa'
|
351 |
+
),
|
352 |
+
'update_link' => _n_noop(
|
353 |
+
'Begin updating plugin',
|
354 |
+
'Begin updating plugins',
|
355 |
+
'acx_fsmi_licence_tgmpa'
|
356 |
+
),
|
357 |
+
'activate_link' => _n_noop(
|
358 |
+
'Begin activating plugin',
|
359 |
+
'Begin activating plugins',
|
360 |
+
'acx_fsmi_licence_tgmpa'
|
361 |
+
),
|
362 |
+
'return' => __( 'Return to Required Plugins Installer', 'acx_fsmi_licence_tgmpa' ),
|
363 |
+
'dashboard' => __( 'Return to the Dashboard', 'acx_fsmi_licence_tgmpa' ),
|
364 |
+
'plugin_activated' => __( 'Plugin activated successfully.', 'acx_fsmi_licence_tgmpa' ),
|
365 |
+
'activated_successfully' => __( 'The following plugin was activated successfully:', 'acx_fsmi_licence_tgmpa' ),
|
366 |
+
'plugin_already_active' => __( 'No action taken. Plugin %1$s was already active.', 'acx_fsmi_licence_tgmpa' ),
|
367 |
+
'plugin_needs_higher_version' => __( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'acx_fsmi_licence_tgmpa' ),
|
368 |
+
'complete' => __( 'All plugins installed and activated successfully. %1$s', 'acx_fsmi_licence_tgmpa' ),
|
369 |
+
'dismiss' => __( 'Dismiss this notice', 'acx_fsmi_licence_tgmpa' ),
|
370 |
+
'notice_cannot_install_activate' => __( 'There are one or more required or recommended plugins to install, update or activate.', 'acx_fsmi_licence_tgmpa' ),
|
371 |
+
'contact_admin' => __( 'Please contact the administrator of this site for help.', 'acx_fsmi_licence_tgmpa' ),
|
372 |
+
);
|
373 |
+
|
374 |
+
do_action( 'acx_fsmi_licence_tgmpa_register' );
|
375 |
+
|
376 |
+
/* After this point, the plugins should be registered and the configuration set. */
|
377 |
+
|
378 |
+
// Proceed only if we have plugins to handle.
|
379 |
+
if ( empty( $this->plugins ) || ! is_array( $this->plugins ) ) {
|
380 |
+
return;
|
381 |
+
}
|
382 |
+
|
383 |
+
// Set up the menu and notices if we still have outstanding actions.
|
384 |
+
if ( true !== $this->is_acx_fsmi_licence_tgmpa_complete() ) {
|
385 |
+
// Sort the plugins.
|
386 |
+
array_multisort( $this->sort_order, SORT_ASC, $this->plugins );
|
387 |
+
|
388 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
389 |
+
add_action( 'admin_head', array( $this, 'dismiss' ) );
|
390 |
+
|
391 |
+
// Prevent the normal links from showing underneath a single install/update page.
|
392 |
+
add_filter( 'install_plugin_complete_actions', array( $this, 'actions' ) );
|
393 |
+
add_filter( 'update_plugin_complete_actions', array( $this, 'actions' ) );
|
394 |
+
|
395 |
+
if ( $this->has_notices ) {
|
396 |
+
add_action( 'admin_notices', array( $this, 'notices' ) );
|
397 |
+
add_action( 'admin_init', array( $this, 'admin_init' ), 1 );
|
398 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'thickbox' ) );
|
399 |
+
}
|
400 |
+
}
|
401 |
+
|
402 |
+
// If needed, filter plugin action links.
|
403 |
+
add_action( 'load-plugins.php', array( $this, 'add_plugin_action_link_filters' ), 1 );
|
404 |
+
|
405 |
+
// Make sure things get reset on switch theme.
|
406 |
+
add_action( 'switch_theme', array( $this, 'flush_plugins_cache' ) );
|
407 |
+
|
408 |
+
if ( $this->has_notices ) {
|
409 |
+
add_action( 'switch_theme', array( $this, 'update_dismiss' ) );
|
410 |
+
}
|
411 |
+
|
412 |
+
// Setup the force activation hook.
|
413 |
+
if ( true === $this->has_forced_activation ) {
|
414 |
+
add_action( 'admin_init', array( $this, 'force_activation' ) );
|
415 |
+
}
|
416 |
+
|
417 |
+
// Setup the force deactivation hook.
|
418 |
+
if ( true === $this->has_forced_deactivation ) {
|
419 |
+
add_action( 'switch_theme', array( $this, 'force_deactivation' ) );
|
420 |
+
}
|
421 |
+
}
|
422 |
+
|
423 |
+
/**
|
424 |
+
* Load translations.
|
425 |
+
*
|
426 |
+
* @since 2.6.0
|
427 |
+
*
|
428 |
+
* (@internal Uses `load_theme_textdomain()` rather than `load_plugin_textdomain()` to
|
429 |
+
* get round the different ways of handling the path and deprecated notices being thrown
|
430 |
+
* and such. For plugins, the actual file name will be corrected by a filter.}}
|
431 |
+
*
|
432 |
+
* {@internal IMPORTANT! If this function changes, review the regex in the custom acx_fsmi_licence_tgmpa
|
433 |
+
* generator on the website.}}
|
434 |
+
*/
|
435 |
+
public function load_textdomain() {
|
436 |
+
if ( is_textdomain_loaded( 'acx_fsmi_licence_tgmpa' ) ) {
|
437 |
+
return;
|
438 |
+
}
|
439 |
+
|
440 |
+
if ( false !== strpos( __FILE__, WP_PLUGIN_DIR ) || false !== strpos( __FILE__, WPMU_PLUGIN_DIR ) ) {
|
441 |
+
// Plugin, we'll need to adjust the file name.
|
442 |
+
add_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10, 2 );
|
443 |
+
load_theme_textdomain( 'acx_fsmi_licence_tgmpa', dirname( __FILE__ ) . '/languages' );
|
444 |
+
remove_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10 );
|
445 |
+
} else {
|
446 |
+
load_theme_textdomain( 'acx_fsmi_licence_tgmpa', dirname( __FILE__ ) . '/languages' );
|
447 |
+
}
|
448 |
+
}
|
449 |
+
|
450 |
+
/**
|
451 |
+
* Correct the .mo file name for (must-use) plugins.
|
452 |
+
*
|
453 |
+
* Themese use `/path/{locale}.mo` while plugins use `/path/{text-domain}-{locale}.mo`.
|
454 |
+
*
|
455 |
+
* {@internal IMPORTANT! If this function changes, review the regex in the custom ACX_FSMI_LICENCE_TGMPA
|
456 |
+
* generator on the website.}}
|
457 |
+
*
|
458 |
+
* @since 2.6.0
|
459 |
+
*
|
460 |
+
* @param string $mofile Full path to the target mofile.
|
461 |
+
* @param string $domain The domain for which a language file is being loaded.
|
462 |
+
* @return string $mofile
|
463 |
+
*/
|
464 |
+
public function correct_plugin_mofile( $mofile, $domain ) {
|
465 |
+
// Exit early if not our domain (just in case).
|
466 |
+
if ( 'acx_fsmi_licence_tgmpa' !== $domain ) {
|
467 |
+
return $mofile;
|
468 |
+
}
|
469 |
+
return preg_replace( '`/([a-z]{2}_[A-Z]{2}.mo)$`', '/acx_fsmi_licence_tgmpa-$1', $mofile );
|
470 |
+
}
|
471 |
+
|
472 |
+
/**
|
473 |
+
* Potentially overload the fall-back translation file for the current language.
|
474 |
+
*
|
475 |
+
* WP, by default since WP 3.7, will load a local translation first and if none
|
476 |
+
* can be found, will try and find a translation in the /wp-content/languages/ directory.
|
477 |
+
* As this library is theme/plugin agnostic, translation files for ACX_FSMI_LICENCE_TGMPA can exist both
|
478 |
+
* in the WP_LANG_DIR /plugins/ subdirectory as well as in the /themes/ subdirectory.
|
479 |
+
*
|
480 |
+
* This method makes sure both directories are checked.
|
481 |
+
*
|
482 |
+
* {@internal IMPORTANT! If this function changes, review the regex in the custom ACX_FSMI_LICENCE_TGMPA
|
483 |
+
* generator on the website.}}
|
484 |
+
*
|
485 |
+
* @since 2.6.0
|
486 |
+
*
|
487 |
+
* @param string $mofile Full path to the target mofile.
|
488 |
+
* @param string $domain The domain for which a language file is being loaded.
|
489 |
+
* @return string $mofile
|
490 |
+
*/
|
491 |
+
public function overload_textdomain_mofile( $mofile, $domain ) {
|
492 |
+
// Exit early if not our domain, not a WP_LANG_DIR load or if the file exists and is readable.
|
493 |
+
if ( 'acx_fsmi_licence_tgmpa' !== $domain || false === strpos( $mofile, WP_LANG_DIR ) || @is_readable( $mofile ) ) {
|
494 |
+
return $mofile;
|
495 |
+
}
|
496 |
+
|
497 |
+
// Current fallback file is not valid, let's try the alternative option.
|
498 |
+
if ( false !== strpos( $mofile, '/themes/' ) ) {
|
499 |
+
return str_replace( '/themes/', '/plugins/', $mofile );
|
500 |
+
} elseif ( false !== strpos( $mofile, '/plugins/' ) ) {
|
501 |
+
return str_replace( '/plugins/', '/themes/', $mofile );
|
502 |
+
} else {
|
503 |
+
return $mofile;
|
504 |
+
}
|
505 |
+
}
|
506 |
+
|
507 |
+
/**
|
508 |
+
* Hook in plugin action link filters for the WP native plugins page.
|
509 |
+
*
|
510 |
+
* - Prevent activation of plugins which don't meet the minimum version requirements.
|
511 |
+
* - Prevent deactivation of force-activated plugins.
|
512 |
+
* - Add update notice if update available.
|
513 |
+
*
|
514 |
+
* @since 2.5.0
|
515 |
+
*/
|
516 |
+
public function add_plugin_action_link_filters() {
|
517 |
+
foreach ( $this->plugins as $slug => $plugin ) {
|
518 |
+
if ( false === $this->can_plugin_activate( $slug ) ) {
|
519 |
+
add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 );
|
520 |
+
}
|
521 |
+
|
522 |
+
if ( true === $plugin['force_activation'] ) {
|
523 |
+
add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 );
|
524 |
+
}
|
525 |
+
|
526 |
+
if ( false !== $this->does_plugin_require_update( $slug ) ) {
|
527 |
+
add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 );
|
528 |
+
}
|
529 |
+
}
|
530 |
+
}
|
531 |
+
|
532 |
+
/**
|
533 |
+
* Remove the 'Activate' link on the WP native plugins page if the plugin does not meet the
|
534 |
+
* minimum version requirements.
|
535 |
+
*
|
536 |
+
* @since 2.5.0
|
537 |
+
*
|
538 |
+
* @param array $actions Action links.
|
539 |
+
* @return array
|
540 |
+
*/
|
541 |
+
public function filter_plugin_action_links_activate( $actions ) {
|
542 |
+
unset( $actions['activate'] );
|
543 |
+
|
544 |
+
return $actions;
|
545 |
+
}
|
546 |
+
|
547 |
+
/**
|
548 |
+
* Remove the 'Deactivate' link on the WP native plugins page if the plugin has been set to force activate.
|
549 |
+
*
|
550 |
+
* @since 2.5.0
|
551 |
+
*
|
552 |
+
* @param array $actions Action links.
|
553 |
+
* @return array
|
554 |
+
*/
|
555 |
+
public function filter_plugin_action_links_deactivate( $actions ) {
|
556 |
+
unset( $actions['deactivate'] );
|
557 |
+
|
558 |
+
return $actions;
|
559 |
+
}
|
560 |
+
|
561 |
+
/**
|
562 |
+
* Add a 'Requires update' link on the WP native plugins page if the plugin does not meet the
|
563 |
+
* minimum version requirements.
|
564 |
+
*
|
565 |
+
* @since 2.5.0
|
566 |
+
*
|
567 |
+
* @param array $actions Action links.
|
568 |
+
* @return array
|
569 |
+
*/
|
570 |
+
public function filter_plugin_action_links_update( $actions ) {
|
571 |
+
$actions['update'] = sprintf(
|
572 |
+
'<a href="%1$s" title="%2$s" class="edit">%3$s</a>',
|
573 |
+
esc_url( $this->get_acx_fsmi_licence_tgmpa_status_url( 'update' ) ),
|
574 |
+
esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'acx_fsmi_licence_tgmpa' ),
|
575 |
+
esc_html__( 'Update Required', 'acx_fsmi_licence_tgmpa' )
|
576 |
+
);
|
577 |
+
|
578 |
+
return $actions;
|
579 |
+
}
|
580 |
+
|
581 |
+
/**
|
582 |
+
* Handles calls to show plugin information via links in the notices.
|
583 |
+
*
|
584 |
+
* We get the links in the admin notices to point to the ACX_FSMI_LICENCE_TGMPA page, rather
|
585 |
+
* than the typical plugin-install.php file, so we can prepare everything
|
586 |
+
* beforehand.
|
587 |
+
*
|
588 |
+
* WP does not make it easy to show the plugin information in the thickbox -
|
589 |
+
* here we have to require a file that includes a function that does the
|
590 |
+
* main work of displaying it, enqueue some styles, set up some globals and
|
591 |
+
* finally call that function before exiting.
|
592 |
+
*
|
593 |
+
* Down right easy once you know how...
|
594 |
+
*
|
595 |
+
* Returns early if not the ACX_FSMI_LICENCE_TGMPA page.
|
596 |
+
*
|
597 |
+
* @since 2.1.0
|
598 |
+
*
|
599 |
+
* @global string $tab Used as iframe div class names, helps with styling
|
600 |
+
* @global string $body_id Used as the iframe body ID, helps with styling
|
601 |
+
*
|
602 |
+
* @return null Returns early if not the ACX_FSMI_LICENCE_TGMPA page.
|
603 |
+
*/
|
604 |
+
public function admin_init() {
|
605 |
+
if ( ! $this->is_acx_fsmi_licence_tgmpa_page() ) {
|
606 |
+
return;
|
607 |
+
}
|
608 |
+
|
609 |
+
if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) {
|
610 |
+
// Needed for install_plugin_information().
|
611 |
+
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
612 |
+
|
613 |
+
wp_enqueue_style( 'plugin-install' );
|
614 |
+
|
615 |
+
global $tab, $body_id;
|
616 |
+
$body_id = 'plugin-information';
|
617 |
+
// @codingStandardsIgnoreStart
|
618 |
+
$tab = 'plugin-information';
|
619 |
+
// @codingStandardsIgnoreEnd
|
620 |
+
|
621 |
+
install_plugin_information();
|
622 |
+
|
623 |
+
exit;
|
624 |
+
}
|
625 |
+
}
|
626 |
+
|
627 |
+
/**
|
628 |
+
* Enqueue thickbox scripts/styles for plugin info.
|
629 |
+
*
|
630 |
+
* Thickbox is not automatically included on all admin pages, so we must
|
631 |
+
* manually enqueue it for those pages.
|
632 |
+
*
|
633 |
+
* Thickbox is only loaded if the user has not dismissed the admin
|
634 |
+
* notice or if there are any plugins left to install and activate.
|
635 |
+
*
|
636 |
+
* @since 2.1.0
|
637 |
+
*/
|
638 |
+
public function thickbox() {
|
639 |
+
if ( ! get_user_meta( get_current_user_id(), 'acx_fsmi_licence_tgmpa_dismissed_notice_' . $this->id, true ) ) {
|
640 |
+
add_thickbox();
|
641 |
+
}
|
642 |
+
}
|
643 |
+
|
644 |
+
/**
|
645 |
+
* Adds submenu page if there are plugin actions to take.
|
646 |
+
*
|
647 |
+
* This method adds the submenu page letting users know that a required
|
648 |
+
* plugin needs to be installed.
|
649 |
+
*
|
650 |
+
* This page disappears once the plugin has been installed and activated.
|
651 |
+
*
|
652 |
+
* @since 1.0.0
|
653 |
+
*
|
654 |
+
* @see ACX_FSMI_LICENCE_TGM_Plugin_Activation::init()
|
655 |
+
* @see ACX_FSMI_LICENCE_TGM_Plugin_Activation::install_plugins_page()
|
656 |
+
*
|
657 |
+
* @return null Return early if user lacks capability to install a plugin.
|
658 |
+
*/
|
659 |
+
public function admin_menu() {
|
660 |
+
// Make sure privileges are correct to see the page.
|
661 |
+
if ( ! current_user_can( 'install_plugins' ) ) {
|
662 |
+
return;
|
663 |
+
}
|
664 |
+
|
665 |
+
$args = apply_filters(
|
666 |
+
'acx_fsmi_licence_tgmpa_admin_menu_args',
|
667 |
+
array(
|
668 |
+
'parent_slug' => $this->parent_slug, // Parent Menu slug.
|
669 |
+
'page_title' => $this->strings['page_title'], // Page title.
|
670 |
+
'menu_title' => $this->strings['menu_title'], // Menu title.
|
671 |
+
'capability' => $this->capability, // Capability.
|
672 |
+
'menu_slug' => $this->menu, // Menu slug.
|
673 |
+
'function' => array( $this, 'install_plugins_page' ), // Callback.
|
674 |
+
)
|
675 |
+
);
|
676 |
+
|
677 |
+
$this->add_admin_menu( $args );
|
678 |
+
}
|
679 |
+
|
680 |
+
/**
|
681 |
+
* Add the menu item.
|
682 |
+
*
|
683 |
+
* {@internal IMPORTANT! If this function changes, review the regex in the custom ACX_FSMI_LICENCE_TGMPA
|
684 |
+
* generator on the website.}}
|
685 |
+
*
|
686 |
+
* @since 2.5.0
|
687 |
+
*
|
688 |
+
* @param array $args Menu item configuration.
|
689 |
+
*/
|
690 |
+
protected function add_admin_menu( array $args ) {
|
691 |
+
if ( has_filter( 'acx_fsmi_licence_tgmpa_admin_menu_use_add_theme_page' ) ) {
|
692 |
+
_deprecated_function( 'The "acx_fsmi_licence_tgmpa_admin_menu_use_add_theme_page" filter', '2.5.0', esc_html__( 'Set the parent_slug config variable instead.', 'acx_fsmi_licence_tgmpa' ) );
|
693 |
+
}
|
694 |
+
|
695 |
+
if ( 'themes.php' === $this->parent_slug ) {
|
696 |
+
$this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] );
|
697 |
+
} else {
|
698 |
+
$this->page_hook = call_user_func( 'add_submenu_page', $args['parent_slug'], $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] );
|
699 |
+
}
|
700 |
+
}
|
701 |
+
|
702 |
+
/**
|
703 |
+
* Echoes plugin installation form.
|
704 |
+
*
|
705 |
+
* This method is the callback for the admin_menu method function.
|
706 |
+
* This displays the admin page and form area where the user can select to install and activate the plugin.
|
707 |
+
* Aborts early if we're processing a plugin installation action.
|
708 |
+
*
|
709 |
+
* @since 1.0.0
|
710 |
+
*
|
711 |
+
* @return null Aborts early if we're processing a plugin installation action.
|
712 |
+
*/
|
713 |
+
public function install_plugins_page() {
|
714 |
+
// Store new instance of plugin table in object.
|
715 |
+
$plugin_table = new ACX_FSMI_LICENCE_TGMPA_List_Table;
|
716 |
+
|
717 |
+
// Return early if processing a plugin installation action.
|
718 |
+
if ( ( ( 'acx_fsmi_licence_tgmpa-bulk-install' === $plugin_table->current_action() || 'acx_fsmi_licence_tgmpa-bulk-update' === $plugin_table->current_action() ) && $plugin_table->process_bulk_actions() ) || $this->do_plugin_install() ) {
|
719 |
+
return;
|
720 |
+
}
|
721 |
+
|
722 |
+
// Force refresh of available plugin information so we'll know about manual updates/deletes.
|
723 |
+
wp_clean_plugins_cache( false );
|
724 |
+
|
725 |
+
?>
|
726 |
+
<div class="acx_fsmi_licence_tgmpa wrap">
|
727 |
+
<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
|
728 |
+
<?php $plugin_table->prepare_items(); ?>
|
729 |
+
|
730 |
+
<?php
|
731 |
+
if ( ! empty( $this->message ) && is_string( $this->message ) ) {
|
732 |
+
echo wp_kses_post( $this->message );
|
733 |
+
}
|
734 |
+
?>
|
735 |
+
<?php $plugin_table->views(); ?>
|
736 |
+
|
737 |
+
<form id="acx_fsmi_licence_tgmpa-plugins" action="" method="post">
|
738 |
+
<input type="hidden" name="acx_fsmi_licence_tgmpa-page" value="<?php echo esc_attr( $this->menu ); ?>" />
|
739 |
+
<input type="hidden" name="plugin_status" value="<?php echo esc_attr( $plugin_table->view_context ); ?>" />
|
740 |
+
<?php $plugin_table->display(); ?>
|
741 |
+
</form>
|
742 |
+
</div>
|
743 |
+
<?php
|
744 |
+
}
|
745 |
+
|
746 |
+
/**
|
747 |
+
* Installs, updates or activates a plugin depending on the action link clicked by the user.
|
748 |
+
*
|
749 |
+
* Checks the $_GET variable to see which actions have been
|
750 |
+
* passed and responds with the appropriate method.
|
751 |
+
*
|
752 |
+
* Uses WP_Filesystem to process and handle the plugin installation
|
753 |
+
* method.
|
754 |
+
*
|
755 |
+
* @since 1.0.0
|
756 |
+
*
|
757 |
+
* @uses WP_Filesystem
|
758 |
+
* @uses WP_Error
|
759 |
+
* @uses WP_Upgrader
|
760 |
+
* @uses Plugin_Upgrader
|
761 |
+
* @uses Plugin_Installer_Skin
|
762 |
+
* @uses Plugin_Upgrader_Skin
|
763 |
+
*
|
764 |
+
* @return boolean True on success, false on failure.
|
765 |
+
*/
|
766 |
+
protected function do_plugin_install() {
|
767 |
+
if ( empty( $_GET['plugin'] ) ) {
|
768 |
+
return false;
|
769 |
+
}
|
770 |
+
|
771 |
+
// All plugin information will be stored in an array for processing.
|
772 |
+
$slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) );
|
773 |
+
|
774 |
+
if ( ! isset( $this->plugins[ $slug ] ) ) {
|
775 |
+
return false;
|
776 |
+
}
|
777 |
+
|
778 |
+
// Was an install or upgrade action link clicked?
|
779 |
+
if ( ( isset( $_GET['acx_fsmi_licence_tgmpa-install'] ) && 'install-plugin' === $_GET['acx_fsmi_licence_tgmpa-install'] ) || ( isset( $_GET['acx_fsmi_licence_tgmpa-update'] ) && 'update-plugin' === $_GET['acx_fsmi_licence_tgmpa-update'] ) ) {
|
780 |
+
|
781 |
+
$install_type = 'install';
|
782 |
+
if ( isset( $_GET['acx_fsmi_licence_tgmpa-update'] ) && 'update-plugin' === $_GET['acx_fsmi_licence_tgmpa-update'] ) {
|
783 |
+
$install_type = 'update';
|
784 |
+
}
|
785 |
+
|
786 |
+
check_admin_referer( 'acx_fsmi_licence_tgmpa-' . $install_type, 'acx_fsmi_licence_tgmpa-nonce' );
|
787 |
+
|
788 |
+
// Pass necessary information via URL if WP_Filesystem is needed.
|
789 |
+
$url = wp_nonce_url(
|
790 |
+
add_query_arg(
|
791 |
+
array(
|
792 |
+
'plugin' => urlencode( $slug ),
|
793 |
+
'acx_fsmi_licence_tgmpa-' . $install_type => $install_type . '-plugin',
|
794 |
+
),
|
795 |
+
$this->get_acx_fsmi_licence_tgmpa_url()
|
796 |
+
),
|
797 |
+
'acx_fsmi_licence_tgmpa-' . $install_type,
|
798 |
+
'acx_fsmi_licence_tgmpa-nonce'
|
799 |
+
);
|
800 |
+
|
801 |
+
$method = ''; // Leave blank so WP_Filesystem can populate it as necessary.
|
802 |
+
|
803 |
+
if ( false === ( $creds = request_filesystem_credentials( esc_url_raw( $url ), $method, false, false, array() ) ) ) {
|
804 |
+
return true;
|
805 |
+
}
|
806 |
+
|
807 |
+
if ( ! WP_Filesystem( $creds ) ) {
|
808 |
+
request_filesystem_credentials( esc_url_raw( $url ), $method, true, false, array() ); // Setup WP_Filesystem.
|
809 |
+
return true;
|
810 |
+
}
|
811 |
+
|
812 |
+
/* If we arrive here, we have the filesystem. */
|
813 |
+
|
814 |
+
// Prep variables for Plugin_Installer_Skin class.
|
815 |
+
$extra = array();
|
816 |
+
$extra['slug'] = $slug; // Needed for potentially renaming of directory name.
|
817 |
+
$source = $this->get_download_url( $slug );
|
818 |
+
$api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null;
|
819 |
+
$api = ( false !== $api ) ? $api : null;
|
820 |
+
|
821 |
+
$url = add_query_arg(
|
822 |
+
array(
|
823 |
+
'action' => $install_type . '-plugin',
|
824 |
+
'plugin' => urlencode( $slug ),
|
825 |
+
),
|
826 |
+
'update.php'
|
827 |
+
);
|
828 |
+
|
829 |
+
if ( ! class_exists( 'Plugin_Upgrader', false ) ) {
|
830 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
831 |
+
}
|
832 |
+
|
833 |
+
$title = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing'];
|
834 |
+
$skin_args = array(
|
835 |
+
'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload',
|
836 |
+
'title' => sprintf( $title, $this->plugins[ $slug ]['name'] ),
|
837 |
+
'url' => esc_url_raw( $url ),
|
838 |
+
'nonce' => $install_type . '-plugin_' . $slug,
|
839 |
+
'plugin' => '',
|
840 |
+
'api' => $api,
|
841 |
+
'extra' => $extra,
|
842 |
+
);
|
843 |
+
unset( $title );
|
844 |
+
|
845 |
+
if ( 'update' === $install_type ) {
|
846 |
+
$skin_args['plugin'] = $this->plugins[ $slug ]['file_path'];
|
847 |
+
$skin = new Plugin_Upgrader_Skin( $skin_args );
|
848 |
+
} else {
|
849 |
+
$skin = new Plugin_Installer_Skin( $skin_args );
|
850 |
+
}
|
851 |
+
|
852 |
+
// Create a new instance of Plugin_Upgrader.
|
853 |
+
$upgrader = new Plugin_Upgrader( $skin );
|
854 |
+
|
855 |
+
// Perform the action and install the plugin from the $source urldecode().
|
856 |
+
add_filter( 'upgrader_source_selection', array( $this, 'maybe_adjust_source_dir' ), 1, 3 );
|
857 |
+
|
858 |
+
if ( 'update' === $install_type ) {
|
859 |
+
// Inject our info into the update transient.
|
860 |
+
$to_inject = array( $slug => $this->plugins[ $slug ] );
|
861 |
+
$to_inject[ $slug ]['source'] = $source;
|
862 |
+
$this->inject_update_info( $to_inject );
|
863 |
+
|
864 |
+
$upgrader->upgrade( $this->plugins[ $slug ]['file_path'] );
|
865 |
+
} else {
|
866 |
+
$upgrader->install( $source );
|
867 |
+
}
|
868 |
+
|
869 |
+
remove_filter( 'upgrader_source_selection', array( $this, 'maybe_adjust_source_dir' ), 1 );
|
870 |
+
|
871 |
+
// Make sure we have the correct file path now the plugin is installed/updated.
|
872 |
+
$this->populate_file_path( $slug );
|
873 |
+
|
874 |
+
// Only activate plugins if the config option is set to true and the plugin isn't
|
875 |
+
// already active (upgrade).
|
876 |
+
if ( $this->is_automatic && ! $this->is_plugin_active( $slug ) ) {
|
877 |
+
$plugin_activate = $upgrader->plugin_info(); // Grab the plugin info from the Plugin_Upgrader method.
|
878 |
+
if ( false === $this->activate_single_plugin( $plugin_activate, $slug, true ) ) {
|
879 |
+
return true; // Finish execution of the function early as we encountered an error.
|
880 |
+
}
|
881 |
+
}
|
882 |
+
|
883 |
+
$this->show_acx_fsmi_licence_tgmpa_version();
|
884 |
+
|
885 |
+
// Display message based on if all plugins are now active or not.
|
886 |
+
if ( $this->is_acx_fsmi_licence_tgmpa_complete() ) {
|
887 |
+
echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'acx_fsmi_licence_tgmpa' ) . '</a>' ), '</p>';
|
888 |
+
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
|
889 |
+
} else {
|
890 |
+
echo '<p><a href="', esc_url( $this->get_acx_fsmi_licence_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>';
|
891 |
+
}
|
892 |
+
|
893 |
+
return true;
|
894 |
+
} elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['acx_fsmi_licence_tgmpa-activate'] ) && 'activate-plugin' === $_GET['acx_fsmi_licence_tgmpa-activate'] ) {
|
895 |
+
// Activate action link was clicked.
|
896 |
+
check_admin_referer( 'acx_fsmi_licence_tgmpa-activate', 'acx_fsmi_licence_tgmpa-nonce' );
|
897 |
+
|
898 |
+
if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) {
|
899 |
+
return true; // Finish execution of the function early as we encountered an error.
|
900 |
+
}
|
901 |
+
}
|
902 |
+
|
903 |
+
return false;
|
904 |
+
}
|
905 |
+
|
906 |
+
/**
|
907 |
+
* Inject information into the 'update_plugins' site transient as WP checks that before running an update.
|
908 |
+
*
|
909 |
+
* @since 2.5.0
|
910 |
+
*
|
911 |
+
* @param array $plugins The plugin information for the plugins which are to be updated.
|
912 |
+
*/
|
913 |
+
public function inject_update_info( $plugins ) {
|
914 |
+
$repo_updates = get_site_transient( 'update_plugins' );
|
915 |
+
|
916 |
+
if ( ! is_object( $repo_updates ) ) {
|
917 |
+
$repo_updates = new stdClass;
|
918 |
+
}
|
919 |
+
|
920 |
+
foreach ( $plugins as $slug => $plugin ) {
|
921 |
+
$file_path = $plugin['file_path'];
|
922 |
+
|
923 |
+
if ( empty( $repo_updates->response[ $file_path ] ) ) {
|
924 |
+
$repo_updates->response[ $file_path ] = new stdClass;
|
925 |
+
}
|
926 |
+
|
927 |
+
// We only really need to set package, but let's do all we can in case WP changes something.
|
928 |
+
$repo_updates->response[ $file_path ]->slug = $slug;
|
929 |
+
$repo_updates->response[ $file_path ]->plugin = $file_path;
|
930 |
+
$repo_updates->response[ $file_path ]->new_version = $plugin['version'];
|
931 |
+
$repo_updates->response[ $file_path ]->package = $plugin['source'];
|
932 |
+
if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) {
|
933 |
+
$repo_updates->response[ $file_path ]->url = $plugin['external_url'];
|
934 |
+
}
|
935 |
+
}
|
936 |
+
|
937 |
+
set_site_transient( 'update_plugins', $repo_updates );
|
938 |
+
}
|
939 |
+
|
940 |
+
/**
|
941 |
+
* Adjust the plugin directory name if necessary.
|
942 |
+
*
|
943 |
+
* The final destination directory of a plugin is based on the subdirectory name found in the
|
944 |
+
* (un)zipped source. In some cases - most notably GitHub repository plugin downloads -, this
|
945 |
+
* subdirectory name is not the same as the expected slug and the plugin will not be recognized
|
946 |
+
* as installed. This is fixed by adjusting the temporary unzipped source subdirectory name to
|
947 |
+
* the expected plugin slug.
|
948 |
+
*
|
949 |
+
* @since 2.5.0
|
950 |
+
*
|
951 |
+
* @param string $source Path to upgrade/zip-file-name.tmp/subdirectory/.
|
952 |
+
* @param string $remote_source Path to upgrade/zip-file-name.tmp.
|
953 |
+
* @param \WP_Upgrader $upgrader Instance of the upgrader which installs the plugin.
|
954 |
+
* @return string $source
|
955 |
+
*/
|
956 |
+
public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) {
|
957 |
+
if ( ! $this->is_acx_fsmi_licence_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) {
|
958 |
+
return $source;
|
959 |
+
}
|
960 |
+
|
961 |
+
// Check for single file plugins.
|
962 |
+
$source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) );
|
963 |
+
if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) {
|
964 |
+
return $source;
|
965 |
+
}
|
966 |
+
|
967 |
+
// Multi-file plugin, let's see if the directory is correctly named.
|
968 |
+
$desired_slug = '';
|
969 |
+
|
970 |
+
// Figure out what the slug is supposed to be.
|
971 |
+
if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) {
|
972 |
+
$desired_slug = $upgrader->skin->options['extra']['slug'];
|
973 |
+
} else {
|
974 |
+
// Bulk installer contains less info, so fall back on the info registered here.
|
975 |
+
foreach ( $this->plugins as $slug => $plugin ) {
|
976 |
+
if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) {
|
977 |
+
$desired_slug = $slug;
|
978 |
+
break;
|
979 |
+
}
|
980 |
+
}
|
981 |
+
unset( $slug, $plugin );
|
982 |
+
}
|
983 |
+
|
984 |
+
if ( ! empty( $desired_slug ) ) {
|
985 |
+
$subdir_name = untrailingslashit( str_replace( trailingslashit( $remote_source ), '', $source ) );
|
986 |
+
|
987 |
+
if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) {
|
988 |
+
$from_path = untrailingslashit( $source );
|
989 |
+
$to_path = trailingslashit( $remote_source ) . $desired_slug;
|
990 |
+
|
991 |
+
if ( true === $GLOBALS['wp_filesystem']->move( $from_path, $to_path ) ) {
|
992 |
+
return trailingslashit( $to_path );
|
993 |
+
} else {
|
994 |
+
return new WP_Error( 'rename_failed', esc_html__( 'The remote plugin package does not contain a folder with the desired slug and renaming did not work.', 'acx_fsmi_licence_tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'acx_fsmi_licence_tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) );
|
995 |
+
}
|
996 |
+
} elseif ( empty( $subdir_name ) ) {
|
997 |
+
return new WP_Error( 'packaged_wrong', esc_html__( 'The remote plugin package consists of more than one file, but the files are not packaged in a folder.', 'acx_fsmi_licence_tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'acx_fsmi_licence_tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) );
|
998 |
+
}
|
999 |
+
}
|
1000 |
+
|
1001 |
+
return $source;
|
1002 |
+
}
|
1003 |
+
|
1004 |
+
/**
|
1005 |
+
* Activate a single plugin and send feedback about the result to the screen.
|
1006 |
+
*
|
1007 |
+
* @since 2.5.0
|
1008 |
+
*
|
1009 |
+
* @param string $file_path Path within wp-plugins/ to main plugin file.
|
1010 |
+
* @param string $slug Plugin slug.
|
1011 |
+
* @param bool $automatic Whether this is an automatic activation after an install. Defaults to false.
|
1012 |
+
* This determines the styling of the output messages.
|
1013 |
+
* @return bool False if an error was encountered, true otherwise.
|
1014 |
+
*/
|
1015 |
+
protected function activate_single_plugin( $file_path, $slug, $automatic = false ) {
|
1016 |
+
if ( $this->can_plugin_activate( $slug ) ) {
|
1017 |
+
$activate = activate_plugin( $file_path );
|
1018 |
+
|
1019 |
+
if ( is_wp_error( $activate ) ) {
|
1020 |
+
echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>',
|
1021 |
+
'<p><a href="', esc_url( $this->get_acx_fsmi_licence_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>';
|
1022 |
+
|
1023 |
+
return false; // End it here if there is an error with activation.
|
1024 |
+
} else {
|
1025 |
+
if ( ! $automatic ) {
|
1026 |
+
// Make sure message doesn't display again if bulk activation is performed
|
1027 |
+
// immediately after a single activation.
|
1028 |
+
if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK.
|
1029 |
+
echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>';
|
1030 |
+
}
|
1031 |
+
} else {
|
1032 |
+
// Simpler message layout for use on the plugin install page.
|
1033 |
+
echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>';
|
1034 |
+
}
|
1035 |
+
}
|
1036 |
+
} elseif ( $this->is_plugin_active( $slug ) ) {
|
1037 |
+
// No simpler message format provided as this message should never be encountered
|
1038 |
+
// on the plugin install page.
|
1039 |
+
echo '<div id="message" class="error"><p>',
|
1040 |
+
sprintf(
|
1041 |
+
esc_html( $this->strings['plugin_already_active'] ),
|
1042 |
+
'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
|
1043 |
+
),
|
1044 |
+
'</p></div>';
|
1045 |
+
} elseif ( $this->does_plugin_require_update( $slug ) ) {
|
1046 |
+
if ( ! $automatic ) {
|
1047 |
+
// Make sure message doesn't display again if bulk activation is performed
|
1048 |
+
// immediately after a single activation.
|
1049 |
+
if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK.
|
1050 |
+
echo '<div id="message" class="error"><p>',
|
1051 |
+
sprintf(
|
1052 |
+
esc_html( $this->strings['plugin_needs_higher_version'] ),
|
1053 |
+
'<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>'
|
1054 |
+
),
|
1055 |
+
'</p></div>';
|
1056 |
+
}
|
1057 |
+
} else {
|
1058 |
+
// Simpler message layout for use on the plugin install page.
|
1059 |
+
echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>';
|
1060 |
+
}
|
1061 |
+
}
|
1062 |
+
|
1063 |
+
return true;
|
1064 |
+
}
|
1065 |
+
|
1066 |
+
/**
|
1067 |
+
* Echoes required plugin notice.
|
1068 |
+
*
|
1069 |
+
* Outputs a message telling users that a specific plugin is required for
|
1070 |
+
* their theme. If appropriate, it includes a link to the form page where
|
1071 |
+
* users can install and activate the plugin.
|
1072 |
+
*
|
1073 |
+
* Returns early if we're on the Install page.
|
1074 |
+
*
|
1075 |
+
* @since 1.0.0
|
1076 |
+
*
|
1077 |
+
* @global object $current_screen
|
1078 |
+
*
|
1079 |
+
* @return null Returns early if we're on the Install page.
|
1080 |
+
*/
|
1081 |
+
public function notices() {
|
1082 |
+
// Remove nag on the install page / Return early if the nag message has been dismissed or user < author.
|
1083 |
+
if ( ( $this->is_acx_fsmi_licence_tgmpa_page() || $this->is_core_update_page() ) || get_user_meta( get_current_user_id(), 'ACX_FSMI_LICENCE_TGMPA_dismissed_notice_' . $this->id, true ) || ! current_user_can( apply_filters( 'ACX_FSMI_LICENCE_TGMPA_show_admin_notice_capability', 'publish_posts' ) ) ) {
|
1084 |
+
return;
|
1085 |
+
}
|
1086 |
+
|
1087 |
+
// Store for the plugin slugs by message type.
|
1088 |
+
$message = array();
|
1089 |
+
|
1090 |
+
// Initialize counters used to determine plurality of action link texts.
|
1091 |
+
$install_link_count = 0;
|
1092 |
+
$update_link_count = 0;
|
1093 |
+
$activate_link_count = 0;
|
1094 |
+
$total_required_action_count = 0;
|
1095 |
+
|
1096 |
+
foreach ( $this->plugins as $slug => $plugin ) {
|
1097 |
+
if ( $this->is_plugin_active( $slug ) && false === $this->does_plugin_have_update( $slug ) ) {
|
1098 |
+
continue;
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
if ( ! $this->is_plugin_installed( $slug ) ) {
|
1102 |
+
if ( current_user_can( 'install_plugins' ) ) {
|
1103 |
+
$install_link_count++;
|
1104 |
+
|
1105 |
+
if ( true === $plugin['required'] ) {
|
1106 |
+
$message['notice_can_install_required'][] = $slug;
|
1107 |
+
} else {
|
1108 |
+
$message['notice_can_install_recommended'][] = $slug;
|
1109 |
+
}
|
1110 |
+
}
|
1111 |
+
if ( true === $plugin['required'] ) {
|
1112 |
+
$total_required_action_count++;
|
1113 |
+
}
|
1114 |
+
} else {
|
1115 |
+
if ( ! $this->is_plugin_active( $slug ) && $this->can_plugin_activate( $slug ) ) {
|
1116 |
+
if ( current_user_can( 'activate_plugins' ) ) {
|
1117 |
+
$activate_link_count++;
|
1118 |
+
|
1119 |
+
if ( true === $plugin['required'] ) {
|
1120 |
+
$message['notice_can_activate_required'][] = $slug;
|
1121 |
+
} else {
|
1122 |
+
$message['notice_can_activate_recommended'][] = $slug;
|
1123 |
+
}
|
1124 |
+
}
|
1125 |
+
if ( true === $plugin['required'] ) {
|
1126 |
+
$total_required_action_count++;
|
1127 |
+
}
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
if ( $this->does_plugin_require_update( $slug ) || false !== $this->does_plugin_have_update( $slug ) ) {
|
1131 |
+
|
1132 |
+
if ( current_user_can( 'update_plugins' ) ) {
|
1133 |
+
$update_link_count++;
|
1134 |
+
|
1135 |
+
if ( $this->does_plugin_require_update( $slug ) ) {
|
1136 |
+
$message['notice_ask_to_update'][] = $slug;
|
1137 |
+
} elseif ( false !== $this->does_plugin_have_update( $slug ) ) {
|
1138 |
+
$message['notice_ask_to_update_maybe'][] = $slug;
|
1139 |
+
}
|
1140 |
+
}
|
1141 |
+
if ( true === $plugin['required'] ) {
|
1142 |
+
$total_required_action_count++;
|
1143 |
+
}
|
1144 |
+
}
|
1145 |
+
}
|
1146 |
+
}
|
1147 |
+
unset( $slug, $plugin );
|
1148 |
+
|
1149 |
+
// If we have notices to display, we move forward.
|
1150 |
+
if ( ! empty( $message ) || $total_required_action_count > 0 ) {
|
1151 |
+
krsort( $message ); // Sort messages.
|
1152 |
+
$rendered = '';
|
1153 |
+
|
1154 |
+
// As add_settings_error() wraps the final message in a <p> and as the final message can't be
|
1155 |
+
// filtered, using <p>'s in our html would render invalid html output.
|
1156 |
+
$line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n";
|
1157 |
+
|
1158 |
+
if ( ! current_user_can( 'activate_plugins' ) && ! current_user_can( 'install_plugins' ) && ! current_user_can( 'update_plugins' ) ) {
|
1159 |
+
$rendered = esc_html( $this->strings['notice_cannot_install_activate'] ) . ' ' . esc_html( $this->strings['contact_admin'] );
|
1160 |
+
$rendered .= $this->create_user_action_links_for_notice( 0, 0, 0, $line_template );
|
1161 |
+
} else {
|
1162 |
+
|
1163 |
+
// If dismissable is false and a message is set, output it now.
|
1164 |
+
if ( ! $this->dismissable && ! empty( $this->dismiss_msg ) ) {
|
1165 |
+
$rendered .= sprintf( $line_template, wp_kses_post( $this->dismiss_msg ) );
|
1166 |
+
}
|
1167 |
+
|
1168 |
+
// Render the individual message lines for the notice.
|
1169 |
+
foreach ( $message as $type => $plugin_group ) {
|
1170 |
+
$linked_plugins = array();
|
1171 |
+
|
1172 |
+
// Get the external info link for a plugin if one is available.
|
1173 |
+
foreach ( $plugin_group as $plugin_slug ) {
|
1174 |
+
$linked_plugins[] = $this->get_info_link( $plugin_slug );
|
1175 |
+
}
|
1176 |
+
unset( $plugin_slug );
|
1177 |
+
|
1178 |
+
$count = count( $plugin_group );
|
1179 |
+
$linked_plugins = array_map( array( 'ACX_FSMI_LICENCE_TGMPA_Utils', 'wrap_in_em' ), $linked_plugins );
|
1180 |
+
$last_plugin = array_pop( $linked_plugins ); // Pop off last name to prep for readability.
|
1181 |
+
$imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'acx_fsmi_licence_tgmpa' ) . ' ' . $last_plugin );
|
1182 |
+
|
1183 |
+
$rendered .= sprintf(
|
1184 |
+
$line_template,
|
1185 |
+
sprintf(
|
1186 |
+
translate_nooped_plural( $this->strings[ $type ], $count, 'acx_fsmi_licence_tgmpa' ),
|
1187 |
+
$imploded,
|
1188 |
+
$count
|
1189 |
+
)
|
1190 |
+
);
|
1191 |
+
|
1192 |
+
}
|
1193 |
+
unset( $type, $plugin_group, $linked_plugins, $count, $last_plugin, $imploded );
|
1194 |
+
|
1195 |
+
$rendered .= $this->create_user_action_links_for_notice( $install_link_count, $update_link_count, $activate_link_count, $line_template );
|
1196 |
+
}
|
1197 |
+
|
1198 |
+
// Register the nag messages and prepare them to be processed.
|
1199 |
+
add_settings_error( 'acx_fsmi_licence_tgmpa', 'acx_fsmi_licence_tgmpa', $rendered, $this->get_admin_notice_class() );
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
// Admin options pages already output settings_errors, so this is to avoid duplication.
|
1203 |
+
if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) {
|
1204 |
+
$this->display_settings_errors();
|
1205 |
+
}
|
1206 |
+
}
|
1207 |
+
|
1208 |
+
/**
|
1209 |
+
* Generate the user action links for the admin notice.
|
1210 |
+
*
|
1211 |
+
* @since 2.6.0
|
1212 |
+
*
|
1213 |
+
* @param int $install_count Number of plugins to install.
|
1214 |
+
* @param int $update_count Number of plugins to update.
|
1215 |
+
* @param int $activate_count Number of plugins to activate.
|
1216 |
+
* @param int $line_template Template for the HTML tag to output a line.
|
1217 |
+
* @return string Action links.
|
1218 |
+
*/
|
1219 |
+
protected function create_user_action_links_for_notice( $install_count, $update_count, $activate_count, $line_template ) {
|
1220 |
+
// Setup action links.
|
1221 |
+
$action_links = array(
|
1222 |
+
'install' => '',
|
1223 |
+
'update' => '',
|
1224 |
+
'activate' => '',
|
1225 |
+
'dismiss' => $this->dismissable ? '<a href="' . esc_url( wp_nonce_url( add_query_arg( 'acx_fsmi_licence_tgmpa-dismiss', 'dismiss_admin_notices' ), 'acx_fsmi_licence_tgmpa-dismiss-' . get_current_user_id() ) ) . '" class="dismiss-notice" target="_parent">' . esc_html( $this->strings['dismiss'] ) . '</a>' : '',
|
1226 |
+
);
|
1227 |
+
$link_template = '<a href="%2$s">%1$s</a><a class="acx_fsmi_install_ignore">Never show this again</a>';
|
1228 |
+
|
1229 |
+
if ( current_user_can( 'install_plugins' ) ) {
|
1230 |
+
if ( $install_count > 0 ) {
|
1231 |
+
$action_links['install'] = sprintf(
|
1232 |
+
$link_template,
|
1233 |
+
translate_nooped_plural( $this->strings['install_link'], $install_count, 'acx_fsmi_licence_tgmpa' ),
|
1234 |
+
esc_url( $this->get_acx_fsmi_licence_tgmpa_status_url( 'install' ) )
|
1235 |
+
);
|
1236 |
+
}
|
1237 |
+
if ( $update_count > 0 ) {
|
1238 |
+
$action_links['update'] = sprintf(
|
1239 |
+
$link_template,
|
1240 |
+
translate_nooped_plural( $this->strings['update_link'], $update_count, 'acx_fsmi_licence_tgmpa' ),
|
1241 |
+
esc_url( $this->get_acx_fsmi_licence_tgmpa_status_url( 'update' ) )
|
1242 |
+
);
|
1243 |
+
}
|
1244 |
+
}
|
1245 |
+
|
1246 |
+
if ( current_user_can( 'activate_plugins' ) && $activate_count > 0 ) {
|
1247 |
+
$action_links['activate'] = sprintf(
|
1248 |
+
$link_template,
|
1249 |
+
translate_nooped_plural( $this->strings['activate_link'], $activate_count, 'acx_fsmi_licence_tgmpa' ),
|
1250 |
+
esc_url( $this->get_acx_fsmi_licence_tgmpa_status_url( 'activate' ) )
|
1251 |
+
);
|
1252 |
+
}
|
1253 |
+
|
1254 |
+
$action_links = apply_filters( 'acx_fsmi_licence_tgmpa_notice_action_links', $action_links );
|
1255 |
+
|
1256 |
+
$action_links = array_filter( (array) $action_links ); // Remove any empty array items.
|
1257 |
+
|
1258 |
+
if ( ! empty( $action_links ) ) {
|
1259 |
+
$action_links = sprintf( $line_template, implode( ' | ', $action_links ) );
|
1260 |
+
return apply_filters( 'acx_fsmi_licence_tgmpa_notice_rendered_action_links', $action_links );
|
1261 |
+
} else {
|
1262 |
+
return '';
|
1263 |
+
}
|
1264 |
+
}
|
1265 |
+
|
1266 |
+
/**
|
1267 |
+
* Get admin notice class.
|
1268 |
+
*
|
1269 |
+
* Work around all the changes to the various admin notice classes between WP 4.4 and 3.7
|
1270 |
+
* (lowest supported version by ACX_FSMI_LICENCE_TGMPA).
|
1271 |
+
*
|
1272 |
+
* @since 2.6.0
|
1273 |
+
*
|
1274 |
+
* @return string
|
1275 |
+
*/
|
1276 |
+
protected function get_admin_notice_class() {
|
1277 |
+
if ( ! empty( $this->strings['nag_type'] ) ) {
|
1278 |
+
return sanitize_html_class( strtolower( $this->strings['nag_type'] ) );
|
1279 |
+
} else {
|
1280 |
+
if ( version_compare( $this->wp_version, '4.2', '>=' ) ) {
|
1281 |
+
return 'notice-warning';
|
1282 |
+
} elseif ( version_compare( $this->wp_version, '4.1', '>=' ) ) {
|
1283 |
+
return 'notice';
|
1284 |
+
} else {
|
1285 |
+
return 'updated';
|
1286 |
+
}
|
1287 |
+
}
|
1288 |
+
}
|
1289 |
+
|
1290 |
+
/**
|
1291 |
+
* Display settings errors and remove those which have been displayed to avoid duplicate messages showing
|
1292 |
+
*
|
1293 |
+
* @since 2.5.0
|
1294 |
+
*/
|
1295 |
+
protected function display_settings_errors() {
|
1296 |
+
global $wp_settings_errors;
|
1297 |
+
|
1298 |
+
settings_errors( 'acx_fsmi_licence_tgmpa' );
|
1299 |
+
|
1300 |
+
foreach ( (array) $wp_settings_errors as $key => $details ) {
|
1301 |
+
if ( 'acx_fsmi_licence_tgmpa' === $details['setting'] ) {
|
1302 |
+
unset( $wp_settings_errors[ $key ] );
|
1303 |
+
break;
|
1304 |
+
}
|
1305 |
+
}
|
1306 |
+
}
|
1307 |
+
|
1308 |
+
/**
|
1309 |
+
* Register dismissal of admin notices.
|
1310 |
+
*
|
1311 |
+
* Acts on the dismiss link in the admin nag messages.
|
1312 |
+
* If clicked, the admin notice disappears and will no longer be visible to this user.
|
1313 |
+
*
|
1314 |
+
* @since 2.1.0
|
1315 |
+
*/
|
1316 |
+
public function dismiss() {
|
1317 |
+
if ( isset( $_GET['acx_fsmi_licence_tgmpa-dismiss'] ) && check_admin_referer( 'acx_fsmi_licence_tgmpa-dismiss-' . get_current_user_id() ) ) {
|
1318 |
+
update_user_meta( get_current_user_id(), 'acx_fsmi_licence_tgmpa_dismissed_notice_' . $this->id, 1 );
|
1319 |
+
}
|
1320 |
+
}
|
1321 |
+
|
1322 |
+
/**
|
1323 |
+
* Add individual plugin to our collection of plugins.
|
1324 |
+
*
|
1325 |
+
* If the required keys are not set or the plugin has already
|
1326 |
+
* been registered, the plugin is not added.
|
1327 |
+
*
|
1328 |
+
* @since 2.0.0
|
1329 |
+
*
|
1330 |
+
* @param array|null $plugin Array of plugin arguments or null if invalid argument.
|
1331 |
+
* @return null Return early if incorrect argument.
|
1332 |
+
*/
|
1333 |
+
public function register( $plugin ) {
|
1334 |
+
if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) {
|
1335 |
+
return;
|
1336 |
+
}
|
1337 |
+
|
1338 |
+
if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) {
|
1339 |
+
return;
|
1340 |
+
}
|
1341 |
+
|
1342 |
+
$defaults = array(
|
1343 |
+
'name' => '', // String
|
1344 |
+
'slug' => '', // String
|
1345 |
+
'source' => 'repo', // String
|
1346 |
+
'required' => false, // Boolean
|
1347 |
+
'version' => '', // String
|
1348 |
+
'force_activation' => false, // Boolean
|
1349 |
+
'force_deactivation' => false, // Boolean
|
1350 |
+
'external_url' => '', // String
|
1351 |
+
'is_callable' => '', // String|Array.
|
1352 |
+
);
|
1353 |
+
|
1354 |
+
// Prepare the received data.
|
1355 |
+
$plugin = wp_parse_args( $plugin, $defaults );
|
1356 |
+
|
1357 |
+
// Standardize the received slug.
|
1358 |
+
$plugin['slug'] = $this->sanitize_key( $plugin['slug'] );
|
1359 |
+
|
1360 |
+
// Forgive users for using string versions of booleans or floats for version number.
|
1361 |
+
$plugin['version'] = (string) $plugin['version'];
|
1362 |
+
$plugin['source'] = empty( $plugin['source'] ) ? 'repo' : $plugin['source'];
|
1363 |
+
$plugin['required'] = ACX_FSMI_LICENCE_TGMPA_Utils::validate_bool( $plugin['required'] );
|
1364 |
+
$plugin['force_activation'] = ACX_FSMI_LICENCE_TGMPA_Utils::validate_bool( $plugin['force_activation'] );
|
1365 |
+
$plugin['force_deactivation'] = ACX_FSMI_LICENCE_TGMPA_Utils::validate_bool( $plugin['force_deactivation'] );
|
1366 |
+
|
1367 |
+
// Enrich the received data.
|
1368 |
+
$plugin['file_path'] = $this->_get_plugin_basename_from_slug( $plugin['slug'] );
|
1369 |
+
$plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] );
|
1370 |
+
|
1371 |
+
// Set the class properties.
|
1372 |
+
$this->plugins[ $plugin['slug'] ] = $plugin;
|
1373 |
+
$this->sort_order[ $plugin['slug'] ] = $plugin['name'];
|
1374 |
+
|
1375 |
+
// Should we add the force activation hook ?
|
1376 |
+
if ( true === $plugin['force_activation'] ) {
|
1377 |
+
$this->has_forced_activation = true;
|
1378 |
+
}
|
1379 |
+
|
1380 |
+
// Should we add the force deactivation hook ?
|
1381 |
+
if ( true === $plugin['force_deactivation'] ) {
|
1382 |
+
$this->has_forced_deactivation = true;
|
1383 |
+
}
|
1384 |
+
}
|
1385 |
+
|
1386 |
+
/**
|
1387 |
+
* Determine what type of source the plugin comes from.
|
1388 |
+
*
|
1389 |
+
* @since 2.5.0
|
1390 |
+
*
|
1391 |
+
* @param string $source The source of the plugin as provided, either empty (= WP repo), a file path
|
1392 |
+
* (= bundled) or an external URL.
|
1393 |
+
* @return string 'repo', 'external', or 'bundled'
|
1394 |
+
*/
|
1395 |
+
protected function get_plugin_source_type( $source ) {
|
1396 |
+
if ( 'repo' === $source || preg_match( self::WP_REPO_REGEX, $source ) ) {
|
1397 |
+
return 'repo';
|
1398 |
+
} elseif ( preg_match( self::IS_URL_REGEX, $source ) ) {
|
1399 |
+
return 'external';
|
1400 |
+
} else {
|
1401 |
+
return 'bundled';
|
1402 |
+
}
|
1403 |
+
}
|
1404 |
+
|
1405 |
+
/**
|
1406 |
+
* Sanitizes a string key.
|
1407 |
+
*
|
1408 |
+
* Near duplicate of WP Core `sanitize_key()`. The difference is that uppercase characters *are*
|
1409 |
+
* allowed, so as not to break upgrade paths from non-standard bundled plugins using uppercase
|
1410 |
+
* characters in the plugin directory path/slug. Silly them.
|
1411 |
+
*
|
1412 |
+
* @see https://developer.wordpress.org/reference/hooks/sanitize_key/
|
1413 |
+
*
|
1414 |
+
* @since 2.5.0
|
1415 |
+
*
|
1416 |
+
* @param string $key String key.
|
1417 |
+
* @return string Sanitized key
|
1418 |
+
*/
|
1419 |
+
public function sanitize_key( $key ) {
|
1420 |
+
$raw_key = $key;
|
1421 |
+
$key = preg_replace( '`[^A-Za-z0-9_-]`', '', $key );
|
1422 |
+
|
1423 |
+
/**
|
1424 |
+
* Filter a sanitized key string.
|
1425 |
+
*
|
1426 |
+
* @since 2.5.0
|
1427 |
+
*
|
1428 |
+
* @param string $key Sanitized key.
|
1429 |
+
* @param string $raw_key The key prior to sanitization.
|
1430 |
+
*/
|
1431 |
+
return apply_filters( 'acx_fsmi_licence_tgmpa_sanitize_key', $key, $raw_key );
|
1432 |
+
}
|
1433 |
+
|
1434 |
+
/**
|
1435 |
+
* Amend default configuration settings.
|
1436 |
+
*
|
1437 |
+
* @since 2.0.0
|
1438 |
+
*
|
1439 |
+
* @param array $config Array of config options to pass as class properties.
|
1440 |
+
*/
|
1441 |
+
public function config( $config ) {
|
1442 |
+
$keys = array(
|
1443 |
+
'id',
|
1444 |
+
'default_path',
|
1445 |
+
'has_notices',
|
1446 |
+
'dismissable',
|
1447 |
+
'dismiss_msg',
|
1448 |
+
'menu',
|
1449 |
+
'parent_slug',
|
1450 |
+
'capability',
|
1451 |
+
'is_automatic',
|
1452 |
+
'message',
|
1453 |
+
'strings',
|
1454 |
+
);
|
1455 |
+
|
1456 |
+
foreach ( $keys as $key ) {
|
1457 |
+
if ( isset( $config[ $key ] ) ) {
|
1458 |
+
if ( is_array( $config[ $key ] ) ) {
|
1459 |
+
$this->$key = array_merge( $this->$key, $config[ $key ] );
|
1460 |
+
} else {
|
1461 |
+
$this->$key = $config[ $key ];
|
1462 |
+
}
|
1463 |
+
}
|
1464 |
+
}
|
1465 |
+
}
|
1466 |
+
|
1467 |
+
/**
|
1468 |
+
* Amend action link after plugin installation.
|
1469 |
+
*
|
1470 |
+
* @since 2.0.0
|
1471 |
+
*
|
1472 |
+
* @param array $install_actions Existing array of actions.
|
1473 |
+
* @return false|array Amended array of actions.
|
1474 |
+
*/
|
1475 |
+
public function actions( $install_actions ) {
|
1476 |
+
// Remove action links on the ACX_FSMI_LICENCE_TGMPA install page.
|
1477 |
+
if ( $this->is_acx_fsmi_licence_tgmpa_page() ) {
|
1478 |
+
return false;
|
1479 |
+
}
|
1480 |
+
|
1481 |
+
return $install_actions;
|
1482 |
+
}
|
1483 |
+
|
1484 |
+
/**
|
1485 |
+
* Flushes the plugins cache on theme switch to prevent stale entries
|
1486 |
+
* from remaining in the plugin table.
|
1487 |
+
*
|
1488 |
+
* @since 2.4.0
|
1489 |
+
*
|
1490 |
+
* @param bool $clear_update_cache Optional. Whether to clear the Plugin updates cache.
|
1491 |
+
* Parameter added in v2.5.0.
|
1492 |
+
*/
|
1493 |
+
public function flush_plugins_cache( $clear_update_cache = true ) {
|
1494 |
+
wp_clean_plugins_cache( $clear_update_cache );
|
1495 |
+
}
|
1496 |
+
|
1497 |
+
/**
|
1498 |
+
* Set file_path key for each installed plugin.
|
1499 |
+
*
|
1500 |
+
* @since 2.1.0
|
1501 |
+
*
|
1502 |
+
* @param string $plugin_slug Optional. If set, only (re-)populates the file path for that specific plugin.
|
1503 |
+
* Parameter added in v2.5.0.
|
1504 |
+
*/
|
1505 |
+
public function populate_file_path( $plugin_slug = '' ) {
|
1506 |
+
if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) {
|
1507 |
+
$this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug );
|
1508 |
+
} else {
|
1509 |
+
// Add file_path key for all plugins.
|
1510 |
+
foreach ( $this->plugins as $slug => $values ) {
|
1511 |
+
$this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug );
|
1512 |
+
}
|
1513 |
+
}
|
1514 |
+
}
|
1515 |
+
|
1516 |
+
/**
|
1517 |
+
* Helper function to extract the file path of the plugin file from the
|
1518 |
+
* plugin slug, if the plugin is installed.
|
1519 |
+
*
|
1520 |
+
* @since 2.0.0
|
1521 |
+
*
|
1522 |
+
* @param string $slug Plugin slug (typically folder name) as provided by the developer.
|
1523 |
+
* @return string Either file path for plugin if installed, or just the plugin slug.
|
1524 |
+
*/
|
1525 |
+
protected function _get_plugin_basename_from_slug( $slug ) {
|
1526 |
+
$keys = array_keys( $this->get_plugins() );
|
1527 |
+
|
1528 |
+
foreach ( $keys as $key ) {
|
1529 |
+
if ( preg_match( '|^' . $slug . '/|', $key ) ) {
|
1530 |
+
return $key;
|
1531 |
+
}
|
1532 |
+
}
|
1533 |
+
|
1534 |
+
return $slug;
|
1535 |
+
}
|
1536 |
+
|
1537 |
+
/**
|
1538 |
+
* Retrieve plugin data, given the plugin name.
|
1539 |
+
*
|
1540 |
+
* Loops through the registered plugins looking for $name. If it finds it,
|
1541 |
+
* it returns the $data from that plugin. Otherwise, returns false.
|
1542 |
+
*
|
1543 |
+
* @since 2.1.0
|
1544 |
+
*
|
1545 |
+
* @param string $name Name of the plugin, as it was registered.
|
1546 |
+
* @param string $data Optional. Array key of plugin data to return. Default is slug.
|
1547 |
+
* @return string|boolean Plugin slug if found, false otherwise.
|
1548 |
+
*/
|
1549 |
+
public function _get_plugin_data_from_name( $name, $data = 'slug' ) {
|
1550 |
+
foreach ( $this->plugins as $values ) {
|
1551 |
+
if ( $name === $values['name'] && isset( $values[ $data ] ) ) {
|
1552 |
+
return $values[ $data ];
|
1553 |
+
}
|
1554 |
+
}
|
1555 |
+
|
1556 |
+
return false;
|
1557 |
+
}
|
1558 |
+
|
1559 |
+
/**
|
1560 |
+
* Retrieve the download URL for a package.
|
1561 |
+
*
|
1562 |
+
* @since 2.5.0
|
1563 |
+
*
|
1564 |
+
* @param string $slug Plugin slug.
|
1565 |
+
* @return string Plugin download URL or path to local file or empty string if undetermined.
|
1566 |
+
*/
|
1567 |
+
public function get_download_url( $slug ) {
|
1568 |
+
$dl_source = '';
|
1569 |
+
|
1570 |
+
switch ( $this->plugins[ $slug ]['source_type'] ) {
|
1571 |
+
case 'repo':
|
1572 |
+
return $this->get_wp_repo_download_url( $slug );
|
1573 |
+
case 'external':
|
1574 |
+
return $this->plugins[ $slug ]['source'];
|
1575 |
+
case 'bundled':
|
1576 |
+
return $this->default_path . $this->plugins[ $slug ]['source'];
|
1577 |
+
}
|
1578 |
+
|
1579 |
+
return $dl_source; // Should never happen.
|
1580 |
+
}
|
1581 |
+
|
1582 |
+
/**
|
1583 |
+
* Retrieve the download URL for a WP repo package.
|
1584 |
+
*
|
1585 |
+
* @since 2.5.0
|
1586 |
+
*
|
1587 |
+
* @param string $slug Plugin slug.
|
1588 |
+
* @return string Plugin download URL.
|
1589 |
+
*/
|
1590 |
+
protected function get_wp_repo_download_url( $slug ) {
|
1591 |
+
$source = '';
|
1592 |
+
$api = $this->get_plugins_api( $slug );
|
1593 |
+
|
1594 |
+
if ( false !== $api && isset( $api->download_link ) ) {
|
1595 |
+
$source = $api->download_link;
|
1596 |
+
}
|
1597 |
+
|
1598 |
+
return $source;
|
1599 |
+
}
|
1600 |
+
|
1601 |
+
/**
|
1602 |
+
* Try to grab information from WordPress API.
|
1603 |
+
*
|
1604 |
+
* @since 2.5.0
|
1605 |
+
*
|
1606 |
+
* @param string $slug Plugin slug.
|
1607 |
+
* @return object Plugins_api response object on success, WP_Error on failure.
|
1608 |
+
*/
|
1609 |
+
protected function get_plugins_api( $slug ) {
|
1610 |
+
static $api = array(); // Cache received responses.
|
1611 |
+
|
1612 |
+
if ( ! isset( $api[ $slug ] ) ) {
|
1613 |
+
if ( ! function_exists( 'plugins_api' ) ) {
|
1614 |
+
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
1615 |
+
}
|
1616 |
+
|
1617 |
+
$response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) );
|
1618 |
+
|
1619 |
+
$api[ $slug ] = false;
|
1620 |
+
|
1621 |
+
if ( is_wp_error( $response ) ) {
|
1622 |
+
wp_die( esc_html( $this->strings['oops'] ) );
|
1623 |
+
} else {
|
1624 |
+
$api[ $slug ] = $response;
|
1625 |
+
}
|
1626 |
+
}
|
1627 |
+
|
1628 |
+
return $api[ $slug ];
|
1629 |
+
}
|
1630 |
+
|
1631 |
+
/**
|
1632 |
+
* Retrieve a link to a plugin information page.
|
1633 |
+
*
|
1634 |
+
* @since 2.5.0
|
1635 |
+
*
|
1636 |
+
* @param string $slug Plugin slug.
|
1637 |
+
* @return string Fully formed html link to a plugin information page if available
|
1638 |
+
* or the plugin name if not.
|
1639 |
+
*/
|
1640 |
+
public function get_info_link( $slug ) {
|
1641 |
+
if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) {
|
1642 |
+
$link = sprintf(
|
1643 |
+
'<a href="%1$s" target="_blank">%2$s</a>',
|
1644 |
+
esc_url( $this->plugins[ $slug ]['external_url'] ),
|
1645 |
+
esc_html( $this->plugins[ $slug ]['name'] )
|
1646 |
+
);
|
1647 |
+
} elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) {
|
1648 |
+
$url = add_query_arg(
|
1649 |
+
array(
|
1650 |
+
'tab' => 'plugin-information',
|
1651 |
+
'plugin' => urlencode( $slug ),
|
1652 |
+
'TB_iframe' => 'true',
|
1653 |
+
'width' => '640',
|
1654 |
+
'height' => '500',
|
1655 |
+
),
|
1656 |
+
self_admin_url( 'plugin-install.php' )
|
1657 |
+
);
|
1658 |
+
|
1659 |
+
$link = sprintf(
|
1660 |
+
'<a href="%1$s" class="thickbox">%2$s</a>',
|
1661 |
+
esc_url( $url ),
|
1662 |
+
esc_html( $this->plugins[ $slug ]['name'] )
|
1663 |
+
);
|
1664 |
+
} else {
|
1665 |
+
$link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink.
|
1666 |
+
}
|
1667 |
+
|
1668 |
+
return $link;
|
1669 |
+
}
|
1670 |
+
|
1671 |
+
/**
|
1672 |
+
* Determine if we're on the ACX_FSMI_LICENCE_TGMPA Install page.
|
1673 |
+
*
|
1674 |
+
* @since 2.1.0
|
1675 |
+
*
|
1676 |
+
* @return boolean True when on the ACX_FSMI_LICENCE_TGMPA page, false otherwise.
|
1677 |
+
*/
|
1678 |
+
protected function is_acx_fsmi_licence_tgmpa_page() {
|
1679 |
+
return isset( $_GET['page'] ) && $this->menu === $_GET['page'];
|
1680 |
+
}
|
1681 |
+
|
1682 |
+
/**
|
1683 |
+
* Determine if we're on a WP Core installation/upgrade page.
|
1684 |
+
*
|
1685 |
+
* @since 2.6.0
|
1686 |
+
*
|
1687 |
+
* @return boolean True when on a WP Core installation/upgrade page, false otherwise.
|
1688 |
+
*/
|
1689 |
+
protected function is_core_update_page() {
|
1690 |
+
// Current screen is not always available, most notably on the customizer screen.
|
1691 |
+
if ( ! function_exists( 'get_current_screen' ) ) {
|
1692 |
+
return false;
|
1693 |
+
}
|
1694 |
+
|
1695 |
+
$screen = get_current_screen();
|
1696 |
+
|
1697 |
+
if ( 'update-core' === $screen->base ) {
|
1698 |
+
// Core update screen.
|
1699 |
+
return true;
|
1700 |
+
} elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok.
|
1701 |
+
// Plugins bulk update screen.
|
1702 |
+
return true;
|
1703 |
+
} elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok.
|
1704 |
+
// Individual updates (ajax call).
|
1705 |
+
return true;
|
1706 |
+
}
|
1707 |
+
|
1708 |
+
return false;
|
1709 |
+
}
|
1710 |
+
|
1711 |
+
/**
|
1712 |
+
* Retrieve the URL to the ACX_FSMI_LICENCE_TGMPA Install page.
|
1713 |
+
*
|
1714 |
+
* I.e. depending on the config settings passed something along the lines of:
|
1715 |
+
* http://example.com/wp-admin/themes.php?page=acx_fsmi_licence_tgmpa-install-plugins
|
1716 |
+
*
|
1717 |
+
* @since 2.5.0
|
1718 |
+
*
|
1719 |
+
* @return string Properly encoded URL (not escaped).
|
1720 |
+
*/
|
1721 |
+
public function get_acx_fsmi_licence_tgmpa_url() {
|
1722 |
+
static $url;
|
1723 |
+
|
1724 |
+
if ( ! isset( $url ) ) {
|
1725 |
+
$parent = $this->parent_slug;
|
1726 |
+
if ( false === strpos( $parent, '.php' ) ) {
|
1727 |
+
$parent = 'admin.php';
|
1728 |
+
}
|
1729 |
+
$url = add_query_arg(
|
1730 |
+
array(
|
1731 |
+
'page' => urlencode( $this->menu ),
|
1732 |
+
),
|
1733 |
+
self_admin_url( $parent )
|
1734 |
+
);
|
1735 |
+
}
|
1736 |
+
|
1737 |
+
return $url;
|
1738 |
+
}
|
1739 |
+
|
1740 |
+
/**
|
1741 |
+
* Retrieve the URL to the ACX_FSMI_LICENCE_TGMPA Install page for a specific plugin status (view).
|
1742 |
+
*
|
1743 |
+
* I.e. depending on the config settings passed something along the lines of:
|
1744 |
+
* http://example.com/wp-admin/themes.php?page=acx_fsmi_licence_tgmpa-install-plugins&plugin_status=install
|
1745 |
+
*
|
1746 |
+
* @since 2.5.0
|
1747 |
+
*
|
1748 |
+
* @param string $status Plugin status - either 'install', 'update' or 'activate'.
|
1749 |
+
* @return string Properly encoded URL (not escaped).
|
1750 |
+
*/
|
1751 |
+
public function get_acx_fsmi_licence_tgmpa_status_url( $status ) {
|
1752 |
+
return add_query_arg(
|
1753 |
+
array(
|
1754 |
+
'plugin_status' => urlencode( $status ),
|
1755 |
+
),
|
1756 |
+
$this->get_acx_fsmi_licence_tgmpa_url()
|
1757 |
+
);
|
1758 |
+
}
|
1759 |
+
|
1760 |
+
/**
|
1761 |
+
* Determine whether there are open actions for plugins registered with ACX_FSMI_LICENCE_TGMPA.
|
1762 |
+
*
|
1763 |
+
* @since 2.5.0
|
1764 |
+
*
|
1765 |
+
* @return bool True if complete, i.e. no outstanding actions. False otherwise.
|
1766 |
+
*/
|
1767 |
+
public function is_acx_fsmi_licence_tgmpa_complete() {
|
1768 |
+
$complete = true;
|
1769 |
+
foreach ( $this->plugins as $slug => $plugin ) {
|
1770 |
+
if ( ! $this->is_plugin_active( $slug ) || false !== $this->does_plugin_have_update( $slug ) ) {
|
1771 |
+
$complete = false;
|
1772 |
+
break;
|
1773 |
+
}
|
1774 |
+
}
|
1775 |
+
|
1776 |
+
return $complete;
|
1777 |
+
}
|
1778 |
+
|
1779 |
+
/**
|
1780 |
+
* Check if a plugin is installed. Does not take must-use plugins into account.
|
1781 |
+
*
|
1782 |
+
* @since 2.5.0
|
1783 |
+
*
|
1784 |
+
* @param string $slug Plugin slug.
|
1785 |
+
* @return bool True if installed, false otherwise.
|
1786 |
+
*/
|
1787 |
+
public function is_plugin_installed( $slug ) {
|
1788 |
+
$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
|
1789 |
+
|
1790 |
+
return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) );
|
1791 |
+
}
|
1792 |
+
|
1793 |
+
/**
|
1794 |
+
* Check if a plugin is active.
|
1795 |
+
*
|
1796 |
+
* @since 2.5.0
|
1797 |
+
*
|
1798 |
+
* @param string $slug Plugin slug.
|
1799 |
+
* @return bool True if active, false otherwise.
|
1800 |
+
*/
|
1801 |
+
public function is_plugin_active( $slug ) {
|
1802 |
+
return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) );
|
1803 |
+
}
|
1804 |
+
|
1805 |
+
/**
|
1806 |
+
* Check if a plugin can be updated, i.e. if we have information on the minimum WP version required
|
1807 |
+
* available, check whether the current install meets them.
|
1808 |
+
*
|
1809 |
+
* @since 2.5.0
|
1810 |
+
*
|
1811 |
+
* @param string $slug Plugin slug.
|
1812 |
+
* @return bool True if OK to update, false otherwise.
|
1813 |
+
*/
|
1814 |
+
public function can_plugin_update( $slug ) {
|
1815 |
+
// We currently can't get reliable info on non-WP-repo plugins - issue #380.
|
1816 |
+
if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
|
1817 |
+
return true;
|
1818 |
+
}
|
1819 |
+
|
1820 |
+
$api = $this->get_plugins_api( $slug );
|
1821 |
+
|
1822 |
+
if ( false !== $api && isset( $api->requires ) ) {
|
1823 |
+
return version_compare( $this->wp_version, $api->requires, '>=' );
|
1824 |
+
}
|
1825 |
+
|
1826 |
+
// No usable info received from the plugins API, presume we can update.
|
1827 |
+
return true;
|
1828 |
+
}
|
1829 |
+
|
1830 |
+
/**
|
1831 |
+
* Check to see if the plugin is 'updatetable', i.e. installed, with an update available
|
1832 |
+
* and no WP version requirements blocking it.
|
1833 |
+
*
|
1834 |
+
* @since 2.6.0
|
1835 |
+
*
|
1836 |
+
* @param string $slug Plugin slug.
|
1837 |
+
* @return bool True if OK to proceed with update, false otherwise.
|
1838 |
+
*/
|
1839 |
+
public function is_plugin_updatetable( $slug ) {
|
1840 |
+
if ( ! $this->is_plugin_installed( $slug ) ) {
|
1841 |
+
return false;
|
1842 |
+
} else {
|
1843 |
+
return ( false !== $this->does_plugin_have_update( $slug ) && $this->can_plugin_update( $slug ) );
|
1844 |
+
}
|
1845 |
+
}
|
1846 |
+
|
1847 |
+
/**
|
1848 |
+
* Check if a plugin can be activated, i.e. is not currently active and meets the minimum
|
1849 |
+
* plugin version requirements set in ACX_FSMI_LICENCE_TGMPA (if any).
|
1850 |
+
*
|
1851 |
+
* @since 2.5.0
|
1852 |
+
*
|
1853 |
+
* @param string $slug Plugin slug.
|
1854 |
+
* @return bool True if OK to activate, false otherwise.
|
1855 |
+
*/
|
1856 |
+
public function can_plugin_activate( $slug ) {
|
1857 |
+
return ( ! $this->is_plugin_active( $slug ) && ! $this->does_plugin_require_update( $slug ) );
|
1858 |
+
}
|
1859 |
+
|
1860 |
+
/**
|
1861 |
+
* Retrieve the version number of an installed plugin.
|
1862 |
+
*
|
1863 |
+
* @since 2.5.0
|
1864 |
+
*
|
1865 |
+
* @param string $slug Plugin slug.
|
1866 |
+
* @return string Version number as string or an empty string if the plugin is not installed
|
1867 |
+
* or version unknown (plugins which don't comply with the plugin header standard).
|
1868 |
+
*/
|
1869 |
+
public function get_installed_version( $slug ) {
|
1870 |
+
$installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached).
|
1871 |
+
|
1872 |
+
if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) {
|
1873 |
+
return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'];
|
1874 |
+
}
|
1875 |
+
|
1876 |
+
return '';
|
1877 |
+
}
|
1878 |
+
|
1879 |
+
/**
|
1880 |
+
* Check whether a plugin complies with the minimum version requirements.
|
1881 |
+
*
|
1882 |
+
* @since 2.5.0
|
1883 |
+
*
|
1884 |
+
* @param string $slug Plugin slug.
|
1885 |
+
* @return bool True when a plugin needs to be updated, otherwise false.
|
1886 |
+
*/
|
1887 |
+
public function does_plugin_require_update( $slug ) {
|
1888 |
+
$installed_version = $this->get_installed_version( $slug );
|
1889 |
+
$minimum_version = $this->plugins[ $slug ]['version'];
|
1890 |
+
|
1891 |
+
return version_compare( $minimum_version, $installed_version, '>' );
|
1892 |
+
}
|
1893 |
+
|
1894 |
+
/**
|
1895 |
+
* Check whether there is an update available for a plugin.
|
1896 |
+
*
|
1897 |
+
* @since 2.5.0
|
1898 |
+
*
|
1899 |
+
* @param string $slug Plugin slug.
|
1900 |
+
* @return false|string Version number string of the available update or false if no update available.
|
1901 |
+
*/
|
1902 |
+
public function does_plugin_have_update( $slug ) {
|
1903 |
+
// Presume bundled and external plugins will point to a package which meets the minimum required version.
|
1904 |
+
if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
|
1905 |
+
if ( $this->does_plugin_require_update( $slug ) ) {
|
1906 |
+
return $this->plugins[ $slug ]['version'];
|
1907 |
+
}
|
1908 |
+
|
1909 |
+
return false;
|
1910 |
+
}
|
1911 |
+
|
1912 |
+
$repo_updates = get_site_transient( 'update_plugins' );
|
1913 |
+
|
1914 |
+
if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) {
|
1915 |
+
return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version;
|
1916 |
+
}
|
1917 |
+
|
1918 |
+
return false;
|
1919 |
+
}
|
1920 |
+
|
1921 |
+
/**
|
1922 |
+
* Retrieve potential upgrade notice for a plugin.
|
1923 |
+
*
|
1924 |
+
* @since 2.5.0
|
1925 |
+
*
|
1926 |
+
* @param string $slug Plugin slug.
|
1927 |
+
* @return string The upgrade notice or an empty string if no message was available or provided.
|
1928 |
+
*/
|
1929 |
+
public function get_upgrade_notice( $slug ) {
|
1930 |
+
// We currently can't get reliable info on non-WP-repo plugins - issue #380.
|
1931 |
+
if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) {
|
1932 |
+
return '';
|
1933 |
+
}
|
1934 |
+
|
1935 |
+
$repo_updates = get_site_transient( 'update_plugins' );
|
1936 |
+
|
1937 |
+
if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) {
|
1938 |
+
return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice;
|
1939 |
+
}
|
1940 |
+
|
1941 |
+
return '';
|
1942 |
+
}
|
1943 |
+
|
1944 |
+
/**
|
1945 |
+
* Wrapper around the core WP get_plugins function, making sure it's actually available.
|
1946 |
+
*
|
1947 |
+
* @since 2.5.0
|
1948 |
+
*
|
1949 |
+
* @param string $plugin_folder Optional. Relative path to single plugin folder.
|
1950 |
+
* @return array Array of installed plugins with plugin information.
|
1951 |
+
*/
|
1952 |
+
public function get_plugins( $plugin_folder = '' ) {
|
1953 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
1954 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
1955 |
+
}
|
1956 |
+
|
1957 |
+
return get_plugins( $plugin_folder );
|
1958 |
+
}
|
1959 |
+
|
1960 |
+
/**
|
1961 |
+
* Delete dismissable nag option when theme is switched.
|
1962 |
+
*
|
1963 |
+
* This ensures that the user(s) is/are again reminded via nag of required
|
1964 |
+
* and/or recommended plugins if they re-activate the theme.
|
1965 |
+
*
|
1966 |
+
* @since 2.1.1
|
1967 |
+
*/
|
1968 |
+
public function update_dismiss() {
|
1969 |
+
delete_metadata( 'user', null, 'acx_fsmi_licence_tgmpa_dismissed_notice_' . $this->id, null, true );
|
1970 |
+
}
|
1971 |
+
|
1972 |
+
/**
|
1973 |
+
* Forces plugin activation if the parameter 'force_activation' is
|
1974 |
+
* set to true.
|
1975 |
+
*
|
1976 |
+
* This allows theme authors to specify certain plugins that must be
|
1977 |
+
* active at all times while using the current theme.
|
1978 |
+
*
|
1979 |
+
* Please take special care when using this parameter as it has the
|
1980 |
+
* potential to be harmful if not used correctly. Setting this parameter
|
1981 |
+
* to true will not allow the specified plugin to be deactivated unless
|
1982 |
+
* the user switches themes.
|
1983 |
+
*
|
1984 |
+
* @since 2.2.0
|
1985 |
+
*/
|
1986 |
+
public function force_activation() {
|
1987 |
+
foreach ( $this->plugins as $slug => $plugin ) {
|
1988 |
+
if ( true === $plugin['force_activation'] ) {
|
1989 |
+
if ( ! $this->is_plugin_installed( $slug ) ) {
|
1990 |
+
// Oops, plugin isn't there so iterate to next condition.
|
1991 |
+
continue;
|
1992 |
+
} elseif ( $this->can_plugin_activate( $slug ) ) {
|
1993 |
+
// There we go, activate the plugin.
|
1994 |
+
activate_plugin( $plugin['file_path'] );
|
1995 |
+
}
|
1996 |
+
}
|
1997 |
+
}
|
1998 |
+
}
|
1999 |
+
|
2000 |
+
/**
|
2001 |
+
* Forces plugin deactivation if the parameter 'force_deactivation'
|
2002 |
+
* is set to true and adds the plugin to the 'recently active' plugins list.
|
2003 |
+
*
|
2004 |
+
* This allows theme authors to specify certain plugins that must be
|
2005 |
+
* deactivated upon switching from the current theme to another.
|
2006 |
+
*
|
2007 |
+
* Please take special care when using this parameter as it has the
|
2008 |
+
* potential to be harmful if not used correctly.
|
2009 |
+
*
|
2010 |
+
* @since 2.2.0
|
2011 |
+
*/
|
2012 |
+
public function force_deactivation() {
|
2013 |
+
$deactivated = array();
|
2014 |
+
|
2015 |
+
foreach ( $this->plugins as $slug => $plugin ) {
|
2016 |
+
/*
|
2017 |
+
* Only proceed forward if the parameter is set to true and plugin is active
|
2018 |
+
* as a 'normal' (not must-use) plugin.
|
2019 |
+
*/
|
2020 |
+
if ( true === $plugin['force_deactivation'] && is_plugin_active( $plugin['file_path'] ) ) {
|
2021 |
+
deactivate_plugins( $plugin['file_path'] );
|
2022 |
+
$deactivated[ $plugin['file_path'] ] = time();
|
2023 |
+
}
|
2024 |
+
}
|
2025 |
+
|
2026 |
+
if ( ! empty( $deactivated ) ) {
|
2027 |
+
update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) );
|
2028 |
+
}
|
2029 |
+
}
|
2030 |
+
|
2031 |
+
/**
|
2032 |
+
* Echo the current ACX_FSMI_LICENCE_TGMPA version number to the page.
|
2033 |
+
*
|
2034 |
+
* @since 2.5.0
|
2035 |
+
*/
|
2036 |
+
public function show_acx_fsmi_licence_tgmpa_version() {
|
2037 |
+
echo '<p style="float: right; padding: 0em 1.5em 0.5em 0;"><strong><small>',
|
2038 |
+
esc_html(
|
2039 |
+
sprintf(
|
2040 |
+
__( 'ACX_FSMI_LICENCE_TGMPA v%s', 'acx_fsmi_licence_tgmpa' ),
|
2041 |
+
self::ACX_FSMI_LICENCE_TGMPA_VERSION
|
2042 |
+
)
|
2043 |
+
),
|
2044 |
+
'</small></strong></p>';
|
2045 |
+
}
|
2046 |
+
|
2047 |
+
/**
|
2048 |
+
* Returns the singleton instance of the class.
|
2049 |
+
*
|
2050 |
+
* @since 2.4.0
|
2051 |
+
*
|
2052 |
+
* @return \ACX_FSMI_LICENCE_TGM_Plugin_Activation The ACX_FSMI_LICENCE_TGM_Plugin_Activation object.
|
2053 |
+
*/
|
2054 |
+
public static function get_instance() {
|
2055 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) {
|
2056 |
+
self::$instance = new self();
|
2057 |
+
}
|
2058 |
+
|
2059 |
+
return self::$instance;
|
2060 |
+
}
|
2061 |
+
}
|
2062 |
+
|
2063 |
+
if ( ! function_exists( 'load_acx_fsmi_licence_tgm_plugin_activation' ) ) {
|
2064 |
+
/**
|
2065 |
+
* Ensure only one instance of the class is ever invoked.
|
2066 |
+
*
|
2067 |
+
* @since 2.5.0
|
2068 |
+
*/
|
2069 |
+
function load_acx_fsmi_licence_tgm_plugin_activation() {
|
2070 |
+
$GLOBALS['acx_fsmi_licence_tgmpa'] = ACX_FSMI_LICENCE_TGM_Plugin_Activation::get_instance();
|
2071 |
+
}
|
2072 |
+
}
|
2073 |
+
|
2074 |
+
if ( did_action( 'plugins_loaded' ) ) {
|
2075 |
+
load_acx_fsmi_licence_tgm_plugin_activation();
|
2076 |
+
} else {
|
2077 |
+
add_action( 'plugins_loaded', 'load_acx_fsmi_licence_tgm_plugin_activation' );
|
2078 |
+
}
|
2079 |
+
}
|
2080 |
+
|
2081 |
+
if ( ! function_exists( 'acx_fsmi_licence_tgmpa' ) ) {
|
2082 |
+
/**
|
2083 |
+
* Helper function to register a collection of required plugins.
|
2084 |
+
*
|
2085 |
+
* @since 2.0.0
|
2086 |
+
* @api
|
2087 |
+
*
|
2088 |
+
* @param array $plugins An array of plugin arrays.
|
2089 |
+
* @param array $config Optional. An array of configuration values.
|
2090 |
+
*/
|
2091 |
+
function acx_fsmi_licence_tgmpa( $plugins, $config = array() ) {
|
2092 |
+
$instance = call_user_func( array( get_class( $GLOBALS['acx_fsmi_licence_tgmpa'] ), 'get_instance' ) );
|
2093 |
+
|
2094 |
+
foreach ( $plugins as $plugin ) {
|
2095 |
+
call_user_func( array( $instance, 'register' ), $plugin );
|
2096 |
+
}
|
2097 |
+
|
2098 |
+
if ( ! empty( $config ) && is_array( $config ) ) {
|
2099 |
+
// Send out notices for deprecated arguments passed.
|
2100 |
+
if ( isset( $config['notices'] ) ) {
|
2101 |
+
_deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in ACX_FSMI_LICENCE_TGMPA 2.2.0. Please adjust your configuration.' );
|
2102 |
+
if ( ! isset( $config['has_notices'] ) ) {
|
2103 |
+
$config['has_notices'] = $config['notices'];
|
2104 |
+
}
|
2105 |
+
}
|
2106 |
+
|
2107 |
+
if ( isset( $config['parent_menu_slug'] ) ) {
|
2108 |
+
_deprecated_argument( __FUNCTION__, '2.4.0', 'The `parent_menu_slug` config parameter was removed in ACX_FSMI_LICENCE_TGMPA 2.4.0. In ACX_FSMI_LICENCE_TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.' );
|
2109 |
+
}
|
2110 |
+
if ( isset( $config['parent_url_slug'] ) ) {
|
2111 |
+
_deprecated_argument( __FUNCTION__, '2.4.0', 'The `parent_url_slug` config parameter was removed in ACX_FSMI_LICENCE_TGMPA 2.4.0. In ACX_FSMI_LICENCE_TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.' );
|
2112 |
+
}
|
2113 |
+
|
2114 |
+
call_user_func( array( $instance, 'config' ), $config );
|
2115 |
+
}
|
2116 |
+
}
|
2117 |
+
}
|
2118 |
+
|
2119 |
+
/**
|
2120 |
+
* WP_List_Table isn't always available. If it isn't available,
|
2121 |
+
* we load it here.
|
2122 |
+
*
|
2123 |
+
* @since 2.2.0
|
2124 |
+
*/
|
2125 |
+
if ( ! class_exists( 'WP_List_Table' ) ) {
|
2126 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
|
2127 |
+
}
|
2128 |
+
|
2129 |
+
if ( ! class_exists( 'ACX_FSMI_LICENCE_TGMPA_List_Table' ) ) {
|
2130 |
+
|
2131 |
+
/**
|
2132 |
+
* List table class for handling plugins.
|
2133 |
+
*
|
2134 |
+
* Extends the WP_List_Table class to provide a future-compatible
|
2135 |
+
* way of listing out all required/recommended plugins.
|
2136 |
+
*
|
2137 |
+
* Gives users an interface similar to the Plugin Administration
|
2138 |
+
* area with similar (albeit stripped down) capabilities.
|
2139 |
+
*
|
2140 |
+
* This class also allows for the bulk install of plugins.
|
2141 |
+
*
|
2142 |
+
* @since 2.2.0
|
2143 |
+
*
|
2144 |
+
* @package ACX_FSMI_LICENCE_TGM-Plugin-Activation
|
2145 |
+
* @author Thomas Griffin
|
2146 |
+
* @author Gary Jones
|
2147 |
+
*/
|
2148 |
+
class ACX_FSMI_LICENCE_TGMPA_List_Table extends WP_List_Table {
|
2149 |
+
/**
|
2150 |
+
* ACX_FSMI_LICENCE_TGMPA instance.
|
2151 |
+
*
|
2152 |
+
* @since 2.5.0
|
2153 |
+
*
|
2154 |
+
* @var object
|
2155 |
+
*/
|
2156 |
+
protected $acx_fsmi_licence_tgmpa;
|
2157 |
+
|
2158 |
+
/**
|
2159 |
+
* The currently chosen view.
|
2160 |
+
*
|
2161 |
+
* @since 2.5.0
|
2162 |
+
*
|
2163 |
+
* @var string One of: 'all', 'install', 'update', 'activate'
|
2164 |
+
*/
|
2165 |
+
public $view_context = 'all';
|
2166 |
+
|
2167 |
+
/**
|
2168 |
+
* The plugin counts for the various views.
|
2169 |
+
*
|
2170 |
+
* @since 2.5.0
|
2171 |
+
*
|
2172 |
+
* @var array
|
2173 |
+
*/
|
2174 |
+
protected $view_totals = array(
|
2175 |
+
'all' => 0,
|
2176 |
+
'install' => 0,
|
2177 |
+
'update' => 0,
|
2178 |
+
'activate' => 0,
|
2179 |
+
);
|
2180 |
+
|
2181 |
+
/**
|
2182 |
+
* References parent constructor and sets defaults for class.
|
2183 |
+
*
|
2184 |
+
* @since 2.2.0
|
2185 |
+
*/
|
2186 |
+
public function __construct() {
|
2187 |
+
$this->acx_fsmi_licence_tgmpa = call_user_func( array( get_class( $GLOBALS['acx_fsmi_licence_tgmpa'] ), 'get_instance' ) );
|
2188 |
+
|
2189 |
+
parent::__construct(
|
2190 |
+
array(
|
2191 |
+
'singular' => 'plugin',
|
2192 |
+
'plural' => 'plugins',
|
2193 |
+
'ajax' => false,
|
2194 |
+
)
|
2195 |
+
);
|
2196 |
+
|
2197 |
+
if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) {
|
2198 |
+
$this->view_context = sanitize_key( $_REQUEST['plugin_status'] );
|
2199 |
+
}
|
2200 |
+
|
2201 |
+
add_filter( 'acx_fsmi_licence_tgmpa_table_data_items', array( $this, 'sort_table_items' ) );
|
2202 |
+
}
|
2203 |
+
|
2204 |
+
/**
|
2205 |
+
* Get a list of CSS classes for the <table> tag.
|
2206 |
+
*
|
2207 |
+
* Overruled to prevent the 'plural' argument from being added.
|
2208 |
+
*
|
2209 |
+
* @since 2.5.0
|
2210 |
+
*
|
2211 |
+
* @return array CSS classnames.
|
2212 |
+
*/
|
2213 |
+
public function get_table_classes() {
|
2214 |
+
return array( 'widefat', 'fixed' );
|
2215 |
+
}
|
2216 |
+
|
2217 |
+
/**
|
2218 |
+
* Gathers and renames all of our plugin information to be used by WP_List_Table to create our table.
|
2219 |
+
*
|
2220 |
+
* @since 2.2.0
|
2221 |
+
*
|
2222 |
+
* @return array $table_data Information for use in table.
|
2223 |
+
*/
|
2224 |
+
protected function _gather_plugin_data() {
|
2225 |
+
// Load thickbox for plugin links.
|
2226 |
+
$this->acx_fsmi_licence_tgmpa->admin_init();
|
2227 |
+
$this->acx_fsmi_licence_tgmpa->thickbox();
|
2228 |
+
|
2229 |
+
// Categorize the plugins which have open actions.
|
2230 |
+
$plugins = $this->categorize_plugins_to_views();
|
2231 |
+
|
2232 |
+
// Set the counts for the view links.
|
2233 |
+
$this->set_view_totals( $plugins );
|
2234 |
+
|
2235 |
+
// Prep variables for use and grab list of all installed plugins.
|
2236 |
+
$table_data = array();
|
2237 |
+
$i = 0;
|
2238 |
+
|
2239 |
+
// Redirect to the 'all' view if no plugins were found for the selected view context.
|
2240 |
+
if ( empty( $plugins[ $this->view_context ] ) ) {
|
2241 |
+
$this->view_context = 'all';
|
2242 |
+
}
|
2243 |
+
|
2244 |
+
foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) {
|
2245 |
+
$table_data[ $i ]['sanitized_plugin'] = $plugin['name'];
|
2246 |
+
$table_data[ $i ]['slug'] = $slug;
|
2247 |
+
$table_data[ $i ]['plugin'] = '<strong>' . $this->acx_fsmi_licence_tgmpa->get_info_link( $slug ) . '</strong>';
|
2248 |
+
$table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] );
|
2249 |
+
$table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] );
|
2250 |
+
$table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug );
|
2251 |
+
$table_data[ $i ]['installed_version'] = $this->acx_fsmi_licence_tgmpa->get_installed_version( $slug );
|
2252 |
+
$table_data[ $i ]['minimum_version'] = $plugin['version'];
|
2253 |
+
$table_data[ $i ]['available_version'] = $this->acx_fsmi_licence_tgmpa->does_plugin_have_update( $slug );
|
2254 |
+
|
2255 |
+
// Prep the upgrade notice info.
|
2256 |
+
$upgrade_notice = $this->acx_fsmi_licence_tgmpa->get_upgrade_notice( $slug );
|
2257 |
+
if ( ! empty( $upgrade_notice ) ) {
|
2258 |
+
$table_data[ $i ]['upgrade_notice'] = $upgrade_notice;
|
2259 |
+
|
2260 |
+
add_action( "acx_fsmi_licence_tgmpa_after_plugin_row_{$slug}", array( $this, 'wp_plugin_update_row' ), 10, 2 );
|
2261 |
+
}
|
2262 |
+
|
2263 |
+
$table_data[ $i ] = apply_filters( 'acx_fsmi_licence_tgmpa_table_data_item', $table_data[ $i ], $plugin );
|
2264 |
+
|
2265 |
+
$i++;
|
2266 |
+
}
|
2267 |
+
|
2268 |
+
return $table_data;
|
2269 |
+
}
|
2270 |
+
|
2271 |
+
/**
|
2272 |
+
* Categorize the plugins which have open actions into views for the ACX_FSMI_LICENCE_TGMPA page.
|
2273 |
+
*
|
2274 |
+
* @since 2.5.0
|
2275 |
+
*/
|
2276 |
+
protected function categorize_plugins_to_views() {
|
2277 |
+
$plugins = array(
|
2278 |
+
'all' => array(), // Meaning: all plugins which still have open actions.
|
2279 |
+
'install' => array(),
|
2280 |
+
'update' => array(),
|
2281 |
+
'activate' => array(),
|
2282 |
+
);
|
2283 |
+
|
2284 |
+
foreach ( $this->acx_fsmi_licence_tgmpa->plugins as $slug => $plugin ) {
|
2285 |
+
if ( $this->acx_fsmi_licence_tgmpa->is_plugin_active( $slug ) && false === $this->acx_fsmi_licence_tgmpa->does_plugin_have_update( $slug ) ) {
|
2286 |
+
// No need to display plugins if they are installed, up-to-date and active.
|
2287 |
+
continue;
|
2288 |
+
} else {
|
2289 |
+
$plugins['all'][ $slug ] = $plugin;
|
2290 |
+
|
2291 |
+
if ( ! $this->acx_fsmi_licence_tgmpa->is_plugin_installed( $slug ) ) {
|
2292 |
+
$plugins['install'][ $slug ] = $plugin;
|
2293 |
+
} else {
|
2294 |
+
if ( false !== $this->acx_fsmi_licence_tgmpa->does_plugin_have_update( $slug ) ) {
|
2295 |
+
$plugins['update'][ $slug ] = $plugin;
|
2296 |
+
}
|
2297 |
+
|
2298 |
+
if ( $this->acx_fsmi_licence_tgmpa->can_plugin_activate( $slug ) ) {
|
2299 |
+
$plugins['activate'][ $slug ] = $plugin;
|
2300 |
+
}
|
2301 |
+
}
|
2302 |
+
}
|
2303 |
+
}
|
2304 |
+
|
2305 |
+
return $plugins;
|
2306 |
+
}
|
2307 |
+
|
2308 |
+
/**
|
2309 |
+
* Set the counts for the view links.
|
2310 |
+
*
|
2311 |
+
* @since 2.5.0
|
2312 |
+
*
|
2313 |
+
* @param array $plugins Plugins order by view.
|
2314 |
+
*/
|
2315 |
+
protected function set_view_totals( $plugins ) {
|
2316 |
+
foreach ( $plugins as $type => $list ) {
|
2317 |
+
$this->view_totals[ $type ] = count( $list );
|
2318 |
+
}
|
2319 |
+
}
|
2320 |
+
|
2321 |
+
/**
|
2322 |
+
* Get the plugin required/recommended text string.
|
2323 |
+
*
|
2324 |
+
* @since 2.5.0
|
2325 |
+
*
|
2326 |
+
* @param string $required Plugin required setting.
|
2327 |
+
* @return string
|
2328 |
+
*/
|
2329 |
+
protected function get_plugin_advise_type_text( $required ) {
|
2330 |
+
if ( true === $required ) {
|
2331 |
+
return __( 'Required', 'acx_fsmi_licence_tgmpa' );
|
2332 |
+
}
|
2333 |
+
|
2334 |
+
return __( 'Recommended', 'acx_fsmi_licence_tgmpa' );
|
2335 |
+
}
|
2336 |
+
|
2337 |
+
/**
|
2338 |
+
* Get the plugin source type text string.
|
2339 |
+
*
|
2340 |
+
* @since 2.5.0
|
2341 |
+
*
|
2342 |
+
* @param string $type Plugin type.
|
2343 |
+
* @return string
|
2344 |
+
*/
|
2345 |
+
protected function get_plugin_source_type_text( $type ) {
|
2346 |
+
$string = '';
|
2347 |
+
|
2348 |
+
switch ( $type ) {
|
2349 |
+
case 'repo':
|
2350 |
+
$string = __( 'WordPress Repository', 'acx_fsmi_licence_tgmpa' );
|
2351 |
+
break;
|
2352 |
+
case 'external':
|
2353 |
+
$string = __( 'External Source', 'acx_fsmi_licence_tgmpa' );
|
2354 |
+
break;
|
2355 |
+
case 'bundled':
|
2356 |
+
$string = __( 'Pre-Packaged', 'acx_fsmi_licence_tgmpa' );
|
2357 |
+
break;
|
2358 |
+
}
|
2359 |
+
|
2360 |
+
return $string;
|
2361 |
+
}
|
2362 |
+
|
2363 |
+
/**
|
2364 |
+
* Determine the plugin status message.
|
2365 |
+
*
|
2366 |
+
* @since 2.5.0
|
2367 |
+
*
|
2368 |
+
* @param string $slug Plugin slug.
|
2369 |
+
* @return string
|
2370 |
+
*/
|
2371 |
+
protected function get_plugin_status_text( $slug ) {
|
2372 |
+
if ( ! $this->acx_fsmi_licence_tgmpa->is_plugin_installed( $slug ) ) {
|
2373 |
+
return __( 'Not Installed', 'acx_fsmi_licence_tgmpa' );
|
2374 |
+
}
|
2375 |
+
|
2376 |
+
if ( ! $this->acx_fsmi_licence_tgmpa->is_plugin_active( $slug ) ) {
|
2377 |
+
$install_status = __( 'Installed But Not Activated', 'acx_fsmi_licence_tgmpa' );
|
2378 |
+
} else {
|
2379 |
+
$install_status = __( 'Active', 'acx_fsmi_licence_tgmpa' );
|
2380 |
+
}
|
2381 |
+
|
2382 |
+
$update_status = '';
|
2383 |
+
|
2384 |
+
if ( $this->acx_fsmi_licence_tgmpa->does_plugin_require_update( $slug ) && false === $this->acx_fsmi_licence_tgmpa->does_plugin_have_update( $slug ) ) {
|
2385 |
+
$update_status = __( 'Required Update not Available', 'acx_fsmi_licence_tgmpa' );
|
2386 |
+
|
2387 |
+
} elseif ( $this->acx_fsmi_licence_tgmpa->does_plugin_require_update( $slug ) ) {
|
2388 |
+
$update_status = __( 'Requires Update', 'acx_fsmi_licence_tgmpa' );
|
2389 |
+
|
2390 |
+
} elseif ( false !== $this->acx_fsmi_licence_tgmpa->does_plugin_have_update( $slug ) ) {
|
2391 |
+
$update_status = __( 'Update recommended', 'acx_fsmi_licence_tgmpa' );
|
2392 |
+
}
|
2393 |
+
|
2394 |
+
if ( '' === $update_status ) {
|
2395 |
+
return $install_status;
|
2396 |
+
}
|
2397 |
+
|
2398 |
+
return sprintf(
|
2399 |
+
_x( '%1$s, %2$s', 'Install/Update Status', 'acx_fsmi_licence_tgmpa' ),
|
2400 |
+
$install_status,
|
2401 |
+
$update_status
|
2402 |
+
);
|
2403 |
+
}
|
2404 |
+
|
2405 |
+
/**
|
2406 |
+
* Sort plugins by Required/Recommended type and by alphabetical plugin name within each type.
|
2407 |
+
*
|
2408 |
+
* @since 2.5.0
|
2409 |
+
*
|
2410 |
+
* @param array $items Prepared table items.
|
2411 |
+
* @return array Sorted table items.
|
2412 |
+
*/
|
2413 |
+
public function sort_table_items( $items ) {
|
2414 |
+
$type = array();
|
2415 |
+
$name = array();
|
2416 |
+
|
2417 |
+
foreach ( $items as $i => $plugin ) {
|
2418 |
+
$type[ $i ] = $plugin['type']; // Required / recommended.
|
2419 |
+
$name[ $i ] = $plugin['sanitized_plugin'];
|
2420 |
+
}
|
2421 |
+
|
2422 |
+
array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items );
|
2423 |
+
|
2424 |
+
return $items;
|
2425 |
+
}
|
2426 |
+
|
2427 |
+
/**
|
2428 |
+
* Get an associative array ( id => link ) of the views available on this table.
|
2429 |
+
*
|
2430 |
+
* @since 2.5.0
|
2431 |
+
*
|
2432 |
+
* @return array
|
2433 |
+
*/
|
2434 |
+
public function get_views() {
|
2435 |
+
$status_links = array();
|
2436 |
+
|
2437 |
+
foreach ( $this->view_totals as $type => $count ) {
|
2438 |
+
if ( $count < 1 ) {
|
2439 |
+
continue;
|
2440 |
+
}
|
2441 |
+
|
2442 |
+
switch ( $type ) {
|
2443 |
+
case 'all':
|
2444 |
+
$text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins', 'acx_fsmi_licence_tgmpa' );
|
2445 |
+
break;
|
2446 |
+
case 'install':
|
2447 |
+
$text = _n( 'To Install <span class="count">(%s)</span>', 'To Install <span class="count">(%s)</span>', $count, 'acx_fsmi_licence_tgmpa' );
|
2448 |
+
break;
|
2449 |
+
case 'update':
|
2450 |
+
$text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count, 'acx_fsmi_licence_tgmpa' );
|
2451 |
+
break;
|
2452 |
+
case 'activate':
|
2453 |
+
$text = _n( 'To Activate <span class="count">(%s)</span>', 'To Activate <span class="count">(%s)</span>', $count, 'acx_fsmi_licence_tgmpa' );
|
2454 |
+
break;
|
2455 |
+
default:
|
2456 |
+
$text = '';
|
2457 |
+
break;
|
2458 |
+
}
|
2459 |
+
|
2460 |
+
if ( ! empty( $text ) ) {
|
2461 |
+
|
2462 |
+
$status_links[ $type ] = sprintf(
|
2463 |
+
'<a href="%s"%s>%s</a>',
|
2464 |
+
esc_url( $this->acx_fsmi_licence_tgmpa->get_acx_fsmi_licence_tgmpa_status_url( $type ) ),
|
2465 |
+
( $type === $this->view_context ) ? ' class="current"' : '',
|
2466 |
+
sprintf( $text, number_format_i18n( $count ) )
|
2467 |
+
);
|
2468 |
+
}
|
2469 |
+
}
|
2470 |
+
|
2471 |
+
return $status_links;
|
2472 |
+
}
|
2473 |
+
|
2474 |
+
/**
|
2475 |
+
* Create default columns to display important plugin information
|
2476 |
+
* like type, action and status.
|
2477 |
+
*
|
2478 |
+
* @since 2.2.0
|
2479 |
+
*
|
2480 |
+
* @param array $item Array of item data.
|
2481 |
+
* @param string $column_name The name of the column.
|
2482 |
+
* @return string
|
2483 |
+
*/
|
2484 |
+
public function column_default( $item, $column_name ) {
|
2485 |
+
return $item[ $column_name ];
|
2486 |
+
}
|
2487 |
+
|
2488 |
+
/**
|
2489 |
+
* Required for bulk installing.
|
2490 |
+
*
|
2491 |
+
* Adds a checkbox for each plugin.
|
2492 |
+
*
|
2493 |
+
* @since 2.2.0
|
2494 |
+
*
|
2495 |
+
* @param array $item Array of item data.
|
2496 |
+
* @return string The input checkbox with all necessary info.
|
2497 |
+
*/
|
2498 |
+
public function column_cb( $item ) {
|
2499 |
+
return sprintf(
|
2500 |
+
'<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />',
|
2501 |
+
esc_attr( $this->_args['singular'] ),
|
2502 |
+
esc_attr( $item['slug'] ),
|
2503 |
+
esc_attr( $item['sanitized_plugin'] )
|
2504 |
+
);
|
2505 |
+
}
|
2506 |
+
|
2507 |
+
/**
|
2508 |
+
* Create default title column along with the action links.
|
2509 |
+
*
|
2510 |
+
* @since 2.2.0
|
2511 |
+
*
|
2512 |
+
* @param array $item Array of item data.
|
2513 |
+
* @return string The plugin name and action links.
|
2514 |
+
*/
|
2515 |
+
public function column_plugin( $item ) {
|
2516 |
+
return sprintf(
|
2517 |
+
'%1$s %2$s',
|
2518 |
+
$item['plugin'],
|
2519 |
+
$this->row_actions( $this->get_row_actions( $item ), true )
|
2520 |
+
);
|
2521 |
+
}
|
2522 |
+
|
2523 |
+
/**
|
2524 |
+
* Create version information column.
|
2525 |
+
*
|
2526 |
+
* @since 2.5.0
|
2527 |
+
*
|
2528 |
+
* @param array $item Array of item data.
|
2529 |
+
* @return string HTML-formatted version information.
|
2530 |
+
*/
|
2531 |
+
public function column_version( $item ) {
|
2532 |
+
$output = array();
|
2533 |
+
|
2534 |
+
if ( $this->acx_fsmi_licence_tgmpa->is_plugin_installed( $item['slug'] ) ) {
|
2535 |
+
$installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'acx_fsmi_licence_tgmpa' );
|
2536 |
+
|
2537 |
+
$color = '';
|
2538 |
+
if ( ! empty( $item['minimum_version'] ) && $this->acx_fsmi_licence_tgmpa->does_plugin_require_update( $item['slug'] ) ) {
|
2539 |
+
$color = ' color: #ff0000; font-weight: bold;';
|
2540 |
+
}
|
2541 |
+
|
2542 |
+
$output[] = sprintf(
|
2543 |
+
'<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'acx_fsmi_licence_tgmpa' ) . '</p>',
|
2544 |
+
$color,
|
2545 |
+
$installed
|
2546 |
+
);
|
2547 |
+
}
|
2548 |
+
|
2549 |
+
if ( ! empty( $item['minimum_version'] ) ) {
|
2550 |
+
$output[] = sprintf(
|
2551 |
+
'<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'acx_fsmi_licence_tgmpa' ) . '</p>',
|
2552 |
+
$item['minimum_version']
|
2553 |
+
);
|
2554 |
+
}
|
2555 |
+
|
2556 |
+
if ( ! empty( $item['available_version'] ) ) {
|
2557 |
+
$color = '';
|
2558 |
+
if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) {
|
2559 |
+
$color = ' color: #71C671; font-weight: bold;';
|
2560 |
+
}
|
2561 |
+
|
2562 |
+
$output[] = sprintf(
|
2563 |
+
'<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'acx_fsmi_licence_tgmpa' ) . '</p>',
|
2564 |
+
$color,
|
2565 |
+
$item['available_version']
|
2566 |
+
);
|
2567 |
+
}
|
2568 |
+
|
2569 |
+
if ( empty( $output ) ) {
|
2570 |
+
return ' '; // Let's not break the table layout.
|
2571 |
+
} else {
|
2572 |
+
return implode( "\n", $output );
|
2573 |
+
}
|
2574 |
+
}
|
2575 |
+
|
2576 |
+
/**
|
2577 |
+
* Sets default message within the plugins table if no plugins
|
2578 |
+
* are left for interaction.
|
2579 |
+
*
|
2580 |
+
* Hides the menu item to prevent the user from clicking and
|
2581 |
+
* getting a permissions error.
|
2582 |
+
*
|
2583 |
+
* @since 2.2.0
|
2584 |
+
*/
|
2585 |
+
public function no_items() {
|
2586 |
+
echo esc_html__( 'No plugins to install, update or activate.', 'acx_fsmi_licence_tgmpa' ) . ' <a href="' . esc_url( self_admin_url() ) . '"> ' . esc_html__( 'Return to the Dashboard', 'acx_fsmi_licence_tgmpa' ) . '</a>';
|
2587 |
+
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
|
2588 |
+
}
|
2589 |
+
|
2590 |
+
/**
|
2591 |
+
* Output all the column information within the table.
|
2592 |
+
*
|
2593 |
+
* @since 2.2.0
|
2594 |
+
*
|
2595 |
+
* @return array $columns The column names.
|
2596 |
+
*/
|
2597 |
+
public function get_columns() {
|
2598 |
+
$columns = array(
|
2599 |
+
'cb' => '<input type="checkbox" />',
|
2600 |
+
'plugin' => __( 'Plugin', 'acx_fsmi_licence_tgmpa' ),
|
2601 |
+
'source' => __( 'Source', 'acx_fsmi_licence_tgmpa' ),
|
2602 |
+
'type' => __( 'Type', 'acx_fsmi_licence_tgmpa' ),
|
2603 |
+
);
|
2604 |
+
|
2605 |
+
if ( 'all' === $this->view_context || 'update' === $this->view_context ) {
|
2606 |
+
$columns['version'] = __( 'Version', 'acx_fsmi_licence_tgmpa' );
|
2607 |
+
$columns['status'] = __( 'Status', 'acx_fsmi_licence_tgmpa' );
|
2608 |
+
}
|
2609 |
+
|
2610 |
+
return apply_filters( 'acx_fsmi_licence_tgmpa_table_columns', $columns );
|
2611 |
+
}
|
2612 |
+
|
2613 |
+
/**
|
2614 |
+
* Get name of default primary column
|
2615 |
+
*
|
2616 |
+
* @since 2.5.0 / WP 4.3+ compatibility
|
2617 |
+
* @access protected
|
2618 |
+
*
|
2619 |
+
* @return string
|
2620 |
+
*/
|
2621 |
+
protected function get_default_primary_column_name() {
|
2622 |
+
return 'plugin';
|
2623 |
+
}
|
2624 |
+
|
2625 |
+
/**
|
2626 |
+
* Get the name of the primary column.
|
2627 |
+
*
|
2628 |
+
* @since 2.5.0 / WP 4.3+ compatibility
|
2629 |
+
* @access protected
|
2630 |
+
*
|
2631 |
+
* @return string The name of the primary column.
|
2632 |
+
*/
|
2633 |
+
protected function get_primary_column_name() {
|
2634 |
+
if ( method_exists( 'WP_List_Table', 'get_primary_column_name' ) ) {
|
2635 |
+
return parent::get_primary_column_name();
|
2636 |
+
} else {
|
2637 |
+
return $this->get_default_primary_column_name();
|
2638 |
+
}
|
2639 |
+
}
|
2640 |
+
|
2641 |
+
/**
|
2642 |
+
* Get the actions which are relevant for a specific plugin row.
|
2643 |
+
*
|
2644 |
+
* @since 2.5.0
|
2645 |
+
*
|
2646 |
+
* @param array $item Array of item data.
|
2647 |
+
* @return array Array with relevant action links.
|
2648 |
+
*/
|
2649 |
+
protected function get_row_actions( $item ) {
|
2650 |
+
$actions = array();
|
2651 |
+
$action_links = array();
|
2652 |
+
|
2653 |
+
// Display the 'Install' action link if the plugin is not yet available.
|
2654 |
+
if ( ! $this->acx_fsmi_licence_tgmpa->is_plugin_installed( $item['slug'] ) ) {
|
2655 |
+
$actions['install'] = __( 'Install %2$s', 'acx_fsmi_licence_tgmpa' );
|
2656 |
+
} else {
|
2657 |
+
// Display the 'Update' action link if an update is available and WP complies with plugin minimum.
|
2658 |
+
if ( false !== $this->acx_fsmi_licence_tgmpa->does_plugin_have_update( $item['slug'] ) && $this->acx_fsmi_licence_tgmpa->can_plugin_update( $item['slug'] ) ) {
|
2659 |
+
$actions['update'] = __( 'Update %2$s', 'acx_fsmi_licence_tgmpa' );
|
2660 |
+
}
|
2661 |
+
|
2662 |
+
// Display the 'Activate' action link, but only if the plugin meets the minimum version.
|
2663 |
+
if ( $this->acx_fsmi_licence_tgmpa->can_plugin_activate( $item['slug'] ) ) {
|
2664 |
+
$actions['activate'] = __( 'Activate %2$s', 'acx_fsmi_licence_tgmpa' );
|
2665 |
+
}
|
2666 |
+
}
|
2667 |
+
|
2668 |
+
// Create the actual links.
|
2669 |
+
foreach ( $actions as $action => $text ) {
|
2670 |
+
$nonce_url = wp_nonce_url(
|
2671 |
+
add_query_arg(
|
2672 |
+
array(
|
2673 |
+
'plugin' => urlencode( $item['slug'] ),
|
2674 |
+
'acx_fsmi_licence_tgmpa-' . $action => $action . '-plugin',
|
2675 |
+
),
|
2676 |
+
$this->acx_fsmi_licence_tgmpa->get_acx_fsmi_licence_tgmpa_url()
|
2677 |
+
),
|
2678 |
+
'acx_fsmi_licence_tgmpa-' . $action,
|
2679 |
+
'acx_fsmi_licence_tgmpa-nonce'
|
2680 |
+
);
|
2681 |
+
|
2682 |
+
$action_links[ $action ] = sprintf(
|
2683 |
+
'<a href="%1$s">' . esc_html( $text ) . '</a>', // $text contains the second placeholder.
|
2684 |
+
esc_url( $nonce_url ),
|
2685 |
+
'<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>'
|
2686 |
+
);
|
2687 |
+
}
|
2688 |
+
|
2689 |
+
$prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : '';
|
2690 |
+
return apply_filters( "acx_fsmi_licence_tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context );
|
2691 |
+
}
|
2692 |
+
|
2693 |
+
/**
|
2694 |
+
* Generates content for a single row of the table.
|
2695 |
+
*
|
2696 |
+
* @since 2.5.0
|
2697 |
+
*
|
2698 |
+
* @param object $item The current item.
|
2699 |
+
*/
|
2700 |
+
public function single_row( $item ) {
|
2701 |
+
parent::single_row( $item );
|
2702 |
+
|
2703 |
+
/**
|
2704 |
+
* Fires after each specific row in the ACX_FSMI_LICENCE_TGMPA Plugins list table.
|
2705 |
+
*
|
2706 |
+
* The dynamic portion of the hook name, `$item['slug']`, refers to the slug
|
2707 |
+
* for the plugin.
|
2708 |
+
*
|
2709 |
+
* @since 2.5.0
|
2710 |
+
*/
|
2711 |
+
do_action( "acx_fsmi_licence_tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context );
|
2712 |
+
}
|
2713 |
+
|
2714 |
+
/**
|
2715 |
+
* Show the upgrade notice below a plugin row if there is one.
|
2716 |
+
*
|
2717 |
+
* @since 2.5.0
|
2718 |
+
*
|
2719 |
+
* @see /wp-admin/includes/update.php
|
2720 |
+
*
|
2721 |
+
* @param string $slug Plugin slug.
|
2722 |
+
* @param array $item The information available in this table row.
|
2723 |
+
* @return null Return early if upgrade notice is empty.
|
2724 |
+
*/
|
2725 |
+
public function wp_plugin_update_row( $slug, $item ) {
|
2726 |
+
if ( empty( $item['upgrade_notice'] ) ) {
|
2727 |
+
return;
|
2728 |
+
}
|
2729 |
+
|
2730 |
+
echo '
|
2731 |
+
<tr class="plugin-update-tr">
|
2732 |
+
<td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange">
|
2733 |
+
<div class="update-message">',
|
2734 |
+
esc_html__( 'Upgrade message from the plugin author:', 'acx_fsmi_licence_tgmpa' ),
|
2735 |
+
' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong>
|
2736 |
+
</div>
|
2737 |
+
</td>
|
2738 |
+
</tr>';
|
2739 |
+
}
|
2740 |
+
|
2741 |
+
/**
|
2742 |
+
* Extra controls to be displayed between bulk actions and pagination.
|
2743 |
+
*
|
2744 |
+
* @since 2.5.0
|
2745 |
+
*
|
2746 |
+
* @param string $which 'top' or 'bottom' table navigation.
|
2747 |
+
*/
|
2748 |
+
public function extra_tablenav( $which ) {
|
2749 |
+
if ( 'bottom' === $which ) {
|
2750 |
+
$this->acx_fsmi_licence_tgmpa->show_acx_fsmi_licence_tgmpa_version();
|
2751 |
+
}
|
2752 |
+
}
|
2753 |
+
|
2754 |
+
/**
|
2755 |
+
* Defines the bulk actions for handling registered plugins.
|
2756 |
+
*
|
2757 |
+
* @since 2.2.0
|
2758 |
+
*
|
2759 |
+
* @return array $actions The bulk actions for the plugin install table.
|
2760 |
+
*/
|
2761 |
+
public function get_bulk_actions() {
|
2762 |
+
|
2763 |
+
$actions = array();
|
2764 |
+
|
2765 |
+
if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) {
|
2766 |
+
if ( current_user_can( 'install_plugins' ) ) {
|
2767 |
+
$actions['acx_fsmi_licence_tgmpa-bulk-install'] = __( 'Install', 'acx_fsmi_licence_tgmpa' );
|
2768 |
+
}
|
2769 |
+
}
|
2770 |
+
|
2771 |
+
if ( 'install' !== $this->view_context ) {
|
2772 |
+
if ( current_user_can( 'update_plugins' ) ) {
|
2773 |
+
$actions['acx_fsmi_licence_tgmpa-bulk-update'] = __( 'Update', 'acx_fsmi_licence_tgmpa' );
|
2774 |
+
}
|
2775 |
+
if ( current_user_can( 'activate_plugins' ) ) {
|
2776 |
+
$actions['acx_fsmi_licence_tgmpa-bulk-activate'] = __( 'Activate', 'acx_fsmi_licence_tgmpa' );
|
2777 |
+
}
|
2778 |
+
}
|
2779 |
+
|
2780 |
+
return $actions;
|
2781 |
+
}
|
2782 |
+
|
2783 |
+
/**
|
2784 |
+
* Processes bulk installation and activation actions.
|
2785 |
+
*
|
2786 |
+
* The bulk installation process looks for the $_POST information and passes that
|
2787 |
+
* through if a user has to use WP_Filesystem to enter their credentials.
|
2788 |
+
*
|
2789 |
+
* @since 2.2.0
|
2790 |
+
*/
|
2791 |
+
public function process_bulk_actions() {
|
2792 |
+
// Bulk installation process.
|
2793 |
+
if ( 'acx_fsmi_licence_tgmpa-bulk-install' === $this->current_action() || 'acx_fsmi_licence_tgmpa-bulk-update' === $this->current_action() ) {
|
2794 |
+
|
2795 |
+
check_admin_referer( 'bulk-' . $this->_args['plural'] );
|
2796 |
+
|
2797 |
+
$install_type = 'install';
|
2798 |
+
if ( 'acx_fsmi_licence_tgmpa-bulk-update' === $this->current_action() ) {
|
2799 |
+
$install_type = 'update';
|
2800 |
+
}
|
2801 |
+
|
2802 |
+
$plugins_to_install = array();
|
2803 |
+
|
2804 |
+
// Did user actually select any plugins to install/update ?
|
2805 |
+
if ( empty( $_POST['plugin'] ) ) {
|
2806 |
+
if ( 'install' === $install_type ) {
|
2807 |
+
$message = __( 'No plugins were selected to be installed. No action taken.', 'acx_fsmi_licence_tgmpa' );
|
2808 |
+
} else {
|
2809 |
+
$message = __( 'No plugins were selected to be updated. No action taken.', 'acx_fsmi_licence_tgmpa' );
|
2810 |
+
}
|
2811 |
+
|
2812 |
+
echo '<div id="message" class="error"><p>', esc_html( $message ), '</p></div>';
|
2813 |
+
|
2814 |
+
return false;
|
2815 |
+
}
|
2816 |
+
|
2817 |
+
if ( is_array( $_POST['plugin'] ) ) {
|
2818 |
+
$plugins_to_install = (array) $_POST['plugin'];
|
2819 |
+
} elseif ( is_string( $_POST['plugin'] ) ) {
|
2820 |
+
// Received via Filesystem page - un-flatten array (WP bug #19643).
|
2821 |
+
$plugins_to_install = explode( ',', $_POST['plugin'] );
|
2822 |
+
}
|
2823 |
+
|
2824 |
+
// Sanitize the received input.
|
2825 |
+
$plugins_to_install = array_map( 'urldecode', $plugins_to_install );
|
2826 |
+
$plugins_to_install = array_map( array( $this->acx_fsmi_licence_tgmpa, 'sanitize_key' ), $plugins_to_install );
|
2827 |
+
|
2828 |
+
// Validate the received input.
|
2829 |
+
foreach ( $plugins_to_install as $key => $slug ) {
|
2830 |
+
// Check if the plugin was registered with ACX_FSMI_LICENCE_TGMPA and remove if not.
|
2831 |
+
if ( ! isset( $this->acx_fsmi_licence_tgmpa->plugins[ $slug ] ) ) {
|
2832 |
+
unset( $plugins_to_install[ $key ] );
|
2833 |
+
continue;
|
2834 |
+
}
|
2835 |
+
|
2836 |
+
// For install: make sure this is a plugin we *can* install and not one already installed.
|
2837 |
+
if ( 'install' === $install_type && true === $this->acx_fsmi_licence_tgmpa->is_plugin_installed( $slug ) ) {
|
2838 |
+
unset( $plugins_to_install[ $key ] );
|
2839 |
+
}
|
2840 |
+
|
2841 |
+
// For updates: make sure this is a plugin we *can* update (update available and WP version ok).
|
2842 |
+
if ( 'update' === $install_type && false === $this->acx_fsmi_licence_tgmpa->is_plugin_updatetable( $slug ) ) {
|
2843 |
+
unset( $plugins_to_install[ $key ] );
|
2844 |
+
}
|
2845 |
+
}
|
2846 |
+
|
2847 |
+
// No need to proceed further if we have no plugins to handle.
|
2848 |
+
if ( empty( $plugins_to_install ) ) {
|
2849 |
+
if ( 'install' === $install_type ) {
|
2850 |
+
$message = __( 'No plugins are available to be installed at this time.', 'acx_fsmi_licence_tgmpa' );
|
2851 |
+
} else {
|
2852 |
+
$message = __( 'No plugins are available to be updated at this time.', 'acx_fsmi_licence_tgmpa' );
|
2853 |
+
}
|
2854 |
+
|
2855 |
+
echo '<div id="message" class="error"><p>', esc_html( $message ), '</p></div>';
|
2856 |
+
|
2857 |
+
return false;
|
2858 |
+
}
|
2859 |
+
|
2860 |
+
// Pass all necessary information if WP_Filesystem is needed.
|
2861 |
+
$url = wp_nonce_url(
|
2862 |
+
$this->acx_fsmi_licence_tgmpa->get_acx_fsmi_licence_tgmpa_url(),
|
2863 |
+
'bulk-' . $this->_args['plural']
|
2864 |
+
);
|
2865 |
+
|
2866 |
+
// Give validated data back to $_POST which is the only place the filesystem looks for extra fields.
|
2867 |
+
$_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643.
|
2868 |
+
|
2869 |
+
$method = ''; // Leave blank so WP_Filesystem can populate it as necessary.
|
2870 |
+
$fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem.
|
2871 |
+
|
2872 |
+
if ( false === ( $creds = request_filesystem_credentials( esc_url_raw( $url ), $method, false, false, $fields ) ) ) {
|
2873 |
+
return true; // Stop the normal page form from displaying, credential request form will be shown.
|
2874 |
+
}
|
2875 |
+
|
2876 |
+
// Now we have some credentials, setup WP_Filesystem.
|
2877 |
+
if ( ! WP_Filesystem( $creds ) ) {
|
2878 |
+
// Our credentials were no good, ask the user for them again.
|
2879 |
+
request_filesystem_credentials( esc_url_raw( $url ), $method, true, false, $fields );
|
2880 |
+
|
2881 |
+
return true;
|
2882 |
+
}
|
2883 |
+
|
2884 |
+
/* If we arrive here, we have the filesystem */
|
2885 |
+
|
2886 |
+
// Store all information in arrays since we are processing a bulk installation.
|
2887 |
+
$names = array();
|
2888 |
+
$sources = array(); // Needed for installs.
|
2889 |
+
$file_paths = array(); // Needed for upgrades.
|
2890 |
+
$to_inject = array(); // Information to inject into the update_plugins transient.
|
2891 |
+
|
2892 |
+
// Prepare the data for validated plugins for the install/upgrade.
|
2893 |
+
foreach ( $plugins_to_install as $slug ) {
|
2894 |
+
$name = $this->acx_fsmi_licence_tgmpa->plugins[ $slug ]['name'];
|
2895 |
+
$source = $this->acx_fsmi_licence_tgmpa->get_download_url( $slug );
|
2896 |
+
|
2897 |
+
if ( ! empty( $name ) && ! empty( $source ) ) {
|
2898 |
+
$names[] = $name;
|
2899 |
+
|
2900 |
+
switch ( $install_type ) {
|
2901 |
+
|
2902 |
+
case 'install':
|
2903 |
+
$sources[] = $source;
|
2904 |
+
break;
|
2905 |
+
|
2906 |
+
case 'update':
|
2907 |
+
$file_paths[] = $this->acx_fsmi_licence_tgmpa->plugins[ $slug ]['file_path'];
|
2908 |
+
$to_inject[ $slug ] = $this->acx_fsmi_licence_tgmpa->plugins[ $slug ];
|
2909 |
+
$to_inject[ $slug ]['source'] = $source;
|
2910 |
+
break;
|
2911 |
+
}
|
2912 |
+
}
|
2913 |
+
}
|
2914 |
+
unset( $slug, $name, $source );
|
2915 |
+
|
2916 |
+
// Create a new instance of ACX_FSMI_LICENCE_TGMPA_Bulk_Installer.
|
2917 |
+
$installer = new ACX_FSMI_LICENCE_TGMPA_Bulk_Installer(
|
2918 |
+
new ACX_FSMI_LICENCE_TGMPA_Bulk_Installer_Skin(
|
2919 |
+
array(
|
2920 |
+
'url' => esc_url_raw( $this->acx_fsmi_licence_tgmpa->get_acx_fsmi_licence_tgmpa_url() ),
|
2921 |
+
'nonce' => 'bulk-' . $this->_args['plural'],
|
2922 |
+
'names' => $names,
|
2923 |
+
'install_type' => $install_type,
|
2924 |
+
)
|
2925 |
+
)
|
2926 |
+
);
|
2927 |
+
|
2928 |
+
// Wrap the install process with the appropriate HTML.
|
2929 |
+
echo '<div class="acx_fsmi_licence_tgmpa">',
|
2930 |
+
'<h2 style="font-size: 23px; font-weight: 400; line-height: 29px; margin: 0; padding: 9px 15px 4px 0;">', esc_html( get_admin_page_title() ), '</h2>
|
2931 |
+
<div class="update-php" style="width: 100%; height: 98%; min-height: 850px; padding-top: 1px;">';
|
2932 |
+
|
2933 |
+
// Process the bulk installation submissions.
|
2934 |
+
add_filter( 'upgrader_source_selection', array( $this->acx_fsmi_licence_tgmpa, 'maybe_adjust_source_dir' ), 1, 3 );
|
2935 |
+
|
2936 |
+
if ( 'acx_fsmi_licence_tgmpa-bulk-update' === $this->current_action() ) {
|
2937 |
+
// Inject our info into the update transient.
|
2938 |
+
$this->acx_fsmi_licence_tgmpa->inject_update_info( $to_inject );
|
2939 |
+
|
2940 |
+
$installer->bulk_upgrade( $file_paths );
|
2941 |
+
} else {
|
2942 |
+
$installer->bulk_install( $sources );
|
2943 |
+
}
|
2944 |
+
|
2945 |
+
remove_filter( 'upgrader_source_selection', array( $this->acx_fsmi_licence_tgmpa, 'maybe_adjust_source_dir' ), 1 );
|
2946 |
+
|
2947 |
+
echo '</div></div>';
|
2948 |
+
|
2949 |
+
return true;
|
2950 |
+
}
|
2951 |
+
|
2952 |
+
// Bulk activation process.
|
2953 |
+
if ( 'acx_fsmi_licence_tgmpa-bulk-activate' === $this->current_action() ) {
|
2954 |
+
check_admin_referer( 'bulk-' . $this->_args['plural'] );
|
2955 |
+
|
2956 |
+
// Did user actually select any plugins to activate ?
|
2957 |
+
if ( empty( $_POST['plugin'] ) ) {
|
2958 |
+
echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'acx_fsmi_licence_tgmpa' ), '</p></div>';
|
2959 |
+
|
2960 |
+
return false;
|
2961 |
+
}
|
2962 |
+
|
2963 |
+
// Grab plugin data from $_POST.
|
2964 |
+
$plugins = array();
|
2965 |
+
if ( isset( $_POST['plugin'] ) ) {
|
2966 |
+
$plugins = array_map( 'urldecode', (array) $_POST['plugin'] );
|
2967 |
+
$plugins = array_map( array( $this->acx_fsmi_licence_tgmpa, 'sanitize_key' ), $plugins );
|
2968 |
+
}
|
2969 |
+
|
2970 |
+
$plugins_to_activate = array();
|
2971 |
+
$plugin_names = array();
|
2972 |
+
|
2973 |
+
// Grab the file paths for the selected & inactive plugins from the registration array.
|
2974 |
+
foreach ( $plugins as $slug ) {
|
2975 |
+
if ( $this->acx_fsmi_licence_tgmpa->can_plugin_activate( $slug ) ) {
|
2976 |
+
$plugins_to_activate[] = $this->acx_fsmi_licence_tgmpa->plugins[ $slug ]['file_path'];
|
2977 |
+
$plugin_names[] = $this->acx_fsmi_licence_tgmpa->plugins[ $slug ]['name'];
|
2978 |
+
}
|
2979 |
+
}
|
2980 |
+
unset( $slug );
|
2981 |
+
|
2982 |
+
// Return early if there are no plugins to activate.
|
2983 |
+
if ( empty( $plugins_to_activate ) ) {
|
2984 |
+
echo '<div id="message" class="error"><p>', esc_html__( 'No plugins are available to be activated at this time.', 'acx_fsmi_licence_tgmpa' ), '</p></div>';
|
2985 |
+
|
2986 |
+
return false;
|
2987 |
+
}
|
2988 |
+
|
2989 |
+
// Now we are good to go - let's start activating plugins.
|
2990 |
+
$activate = activate_plugins( $plugins_to_activate );
|
2991 |
+
|
2992 |
+
if ( is_wp_error( $activate ) ) {
|
2993 |
+
echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>';
|
2994 |
+
} else {
|
2995 |
+
$count = count( $plugin_names ); // Count so we can use _n function.
|
2996 |
+
$plugin_names = array_map( array( 'ACX_FSMI_LICENCE_TGMPA_Utils', 'wrap_in_strong' ), $plugin_names );
|
2997 |
+
$last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability.
|
2998 |
+
$imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'acx_fsmi_licence_tgmpa' ) . ' ' . $last_plugin );
|
2999 |
+
|
3000 |
+
printf( // WPCS: xss ok.
|
3001 |
+
'<div id="message" class="updated"><p>%1$s %2$s.</p></div>',
|
3002 |
+
esc_html( _n( 'The following plugin was activated successfully:', 'The following plugins were activated successfully:', $count, 'acx_fsmi_licence_tgmpa' ) ),
|
3003 |
+
$imploded
|
3004 |
+
);
|
3005 |
+
|
3006 |
+
// Update recently activated plugins option.
|
3007 |
+
$recent = (array) get_option( 'recently_activated' );
|
3008 |
+
foreach ( $plugins_to_activate as $plugin => $time ) {
|
3009 |
+
if ( isset( $recent[ $plugin ] ) ) {
|
3010 |
+
unset( $recent[ $plugin ] );
|
3011 |
+
}
|
3012 |
+
}
|
3013 |
+
update_option( 'recently_activated', $recent );
|
3014 |
+
}
|
3015 |
+
|
3016 |
+
unset( $_POST ); // Reset the $_POST variable in case user wants to perform one action after another.
|
3017 |
+
|
3018 |
+
return true;
|
3019 |
+
}
|
3020 |
+
|
3021 |
+
return false;
|
3022 |
+
}
|
3023 |
+
|
3024 |
+
/**
|
3025 |
+
* Prepares all of our information to be outputted into a usable table.
|
3026 |
+
*
|
3027 |
+
* @since 2.2.0
|
3028 |
+
*/
|
3029 |
+
public function prepare_items() {
|
3030 |
+
$columns = $this->get_columns(); // Get all necessary column information.
|
3031 |
+
$hidden = array(); // No columns to hide, but we must set as an array.
|
3032 |
+
$sortable = array(); // No reason to make sortable columns.
|
3033 |
+
$primary = $this->get_primary_column_name(); // Column which has the row actions.
|
3034 |
+
$this->_column_headers = array( $columns, $hidden, $sortable, $primary ); // Get all necessary column headers.
|
3035 |
+
|
3036 |
+
// Process our bulk activations here.
|
3037 |
+
if ( 'acx_fsmi_licence_tgmpa-bulk-activate' === $this->current_action() ) {
|
3038 |
+
$this->process_bulk_actions();
|
3039 |
+
}
|
3040 |
+
|
3041 |
+
// Store all of our plugin data into $items array so WP_List_Table can use it.
|
3042 |
+
$this->items = apply_filters( 'acx_fsmi_licence_tgmpa_table_data_items', $this->_gather_plugin_data() );
|
3043 |
+
}
|
3044 |
+
|
3045 |
+
/* *********** DEPRECATED METHODS *********** */
|
3046 |
+
|
3047 |
+
/**
|
3048 |
+
* Retrieve plugin data, given the plugin name.
|
3049 |
+
*
|
3050 |
+
* @since 2.2.0
|
3051 |
+
* @deprecated 2.5.0 use {@see ACX_FSMI_LICENCE_TGM_Plugin_Activation::_get_plugin_data_from_name()} instead.
|
3052 |
+
* @see ACX_FSMI_LICENCE_TGM_Plugin_Activation::_get_plugin_data_from_name()
|
3053 |
+
*
|
3054 |
+
* @param string $name Name of the plugin, as it was registered.
|
3055 |
+
* @param string $data Optional. Array key of plugin data to return. Default is slug.
|
3056 |
+
* @return string|boolean Plugin slug if found, false otherwise.
|
3057 |
+
*/
|
3058 |
+
protected function _get_plugin_data_from_name( $name, $data = 'slug' ) {
|
3059 |
+
_deprecated_function( __FUNCTION__, 'ACX_FSMI_LICENCE_TGMPA 2.5.0', 'ACX_FSMI_LICENCE_TGM_Plugin_Activation::_get_plugin_data_from_name()' );
|
3060 |
+
|
3061 |
+
return $this->acx_fsmi_licence_tgmpa->_get_plugin_data_from_name( $name, $data );
|
3062 |
+
}
|
3063 |
+
}
|
3064 |
+
}
|
3065 |
+
|
3066 |
+
|
3067 |
+
if ( ! class_exists( 'ACX_FSMI_LICENCE_TGM_Bulk_Installer' ) ) {
|
3068 |
+
|
3069 |
+
/**
|
3070 |
+
* Hack: Prevent ACX_FSMI_LICENCE_TGMPA v2.4.1- bulk installer class from being loaded if 2.4.1- is loaded after 2.5+.
|
3071 |
+
*
|
3072 |
+
* @since 2.5.2
|
3073 |
+
*
|
3074 |
+
* {@internal The ACX_FSMI_LICENCE_TGMPA_Bulk_Installer class was originally called ACX_FSMI_LICENCE_TGM_Bulk_Installer.
|
3075 |
+
* For more information, see that class.}}
|
3076 |
+
*/
|
3077 |
+
class ACX_FSMI_LICENCE_TGM_Bulk_Installer {
|
3078 |
+
}
|
3079 |
+
}
|
3080 |
+
if ( ! class_exists( 'ACX_FSMI_LICENCE_TGM_Bulk_Installer_Skin' ) ) {
|
3081 |
+
|
3082 |
+
/**
|
3083 |
+
* Hack: Prevent ACX_FSMI_LICENCE_TGMPA v2.4.1- bulk installer skin class from being loaded if 2.4.1- is loaded after 2.5+.
|
3084 |
+
*
|
3085 |
+
* @since 2.5.2
|
3086 |
+
*
|
3087 |
+
* {@internal The ACX_FSMI_LICENCE_TGMPA_Bulk_Installer_Skin class was originally called ACX_FSMI_LICENCE_TGM_Bulk_Installer_Skin.
|
3088 |
+
* For more information, see that class.}}
|
3089 |
+
*/
|
3090 |
+
class ACX_FSMI_LICENCE_TGM_Bulk_Installer_Skin {
|
3091 |
+
}
|
3092 |
+
}
|
3093 |
+
|
3094 |
+
/**
|
3095 |
+
* The WP_Upgrader file isn't always available. If it isn't available,
|
3096 |
+
* we load it here.
|
3097 |
+
*
|
3098 |
+
* We check to make sure no action or activation keys are set so that WordPress
|
3099 |
+
* does not try to re-include the class when processing upgrades or installs outside
|
3100 |
+
* of the class.
|
3101 |
+
*
|
3102 |
+
* @since 2.2.0
|
3103 |
+
*/
|
3104 |
+
add_action( 'admin_init', 'acx_fsmi_licence_tgmpa_load_bulk_installer' );
|
3105 |
+
if ( ! function_exists( 'acx_fsmi_licence_tgmpa_load_bulk_installer' ) ) {
|
3106 |
+
/**
|
3107 |
+
* Load bulk installer
|
3108 |
+
*/
|
3109 |
+
function acx_fsmi_licence_tgmpa_load_bulk_installer() {
|
3110 |
+
// Silently fail if 2.5+ is loaded *after* an older version.
|
3111 |
+
if ( ! isset( $GLOBALS['acx_fsmi_licence_tgmpa'] ) ) {
|
3112 |
+
return;
|
3113 |
+
}
|
3114 |
+
|
3115 |
+
// Get ACX_FSMI_LICENCE_TGMPA class instance.
|
3116 |
+
$acx_fsmi_licence_tgmpa_instance = call_user_func( array( get_class( $GLOBALS['acx_fsmi_licence_tgmpa'] ), 'get_instance' ) );
|
3117 |
+
|
3118 |
+
if ( isset( $_GET['page'] ) && $acx_fsmi_licence_tgmpa_instance ->menu === $_GET['page'] ) {
|
3119 |
+
if ( ! class_exists( 'Plugin_Upgrader', false ) ) {
|
3120 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
3121 |
+
}
|
3122 |
+
|
3123 |
+
if ( ! class_exists( 'ACX_FSMI_LICENCE_TGMPA_Bulk_Installer' ) ) {
|
3124 |
+
|
3125 |
+
/**
|
3126 |
+
* Installer class to handle bulk plugin installations.
|
3127 |
+
*
|
3128 |
+
* Extends WP_Upgrader and customizes to suit the installation of multiple
|
3129 |
+
* plugins.
|
3130 |
+
*
|
3131 |
+
* @since 2.2.0
|
3132 |
+
*
|
3133 |
+
* {@internal Since 2.5.0 the class is an extension of Plugin_Upgrader rather than WP_Upgrader.}}
|
3134 |
+
* {@internal Since 2.5.2 the class has been renamed from ACX_FSMI_LICENCE_TGM_Bulk_Installer to ACX_FSMI_LICENCE_TGMPA_Bulk_Installer.
|
3135 |
+
* This was done to prevent backward compatibility issues with v2.3.6.}}
|
3136 |
+
*
|
3137 |
+
* @package ACX_FSMI_LICENCE_TGM-Plugin-Activation
|
3138 |
+
* @author Thomas Griffin
|
3139 |
+
* @author Gary Jones
|
3140 |
+
*/
|
3141 |
+
class ACX_FSMI_LICENCE_TGMPA_Bulk_Installer extends Plugin_Upgrader {
|
3142 |
+
/**
|
3143 |
+
* Holds result of bulk plugin installation.
|
3144 |
+
*
|
3145 |
+
* @since 2.2.0
|
3146 |
+
*
|
3147 |
+
* @var string
|
3148 |
+
*/
|
3149 |
+
public $result;
|
3150 |
+
|
3151 |
+
/**
|
3152 |
+
* Flag to check if bulk installation is occurring or not.
|
3153 |
+
*
|
3154 |
+
* @since 2.2.0
|
3155 |
+
*
|
3156 |
+
* @var boolean
|
3157 |
+
*/
|
3158 |
+
public $bulk = false;
|
3159 |
+
|
3160 |
+
/**
|
3161 |
+
* ACX_FSMI_LICENCE_TGMPA instance
|
3162 |
+
*
|
3163 |
+
* @since 2.5.0
|
3164 |
+
*
|
3165 |
+
* @var object
|
3166 |
+
*/
|
3167 |
+
protected $acx_fsmi_licence_tgmpa;
|
3168 |
+
|
3169 |
+
/**
|
3170 |
+
* Whether or not the destination directory needs to be cleared ( = on update).
|
3171 |
+
*
|
3172 |
+
* @since 2.5.0
|
3173 |
+
*
|
3174 |
+
* @var bool
|
3175 |
+
*/
|
3176 |
+
protected $clear_destination = false;
|
3177 |
+
|
3178 |
+
/**
|
3179 |
+
* References parent constructor and sets defaults for class.
|
3180 |
+
*
|
3181 |
+
* @since 2.2.0
|
3182 |
+
*
|
3183 |
+
* @param \Bulk_Upgrader_Skin|null $skin Installer skin.
|
3184 |
+
*/
|
3185 |
+
public function __construct( $skin = null ) {
|
3186 |
+
// Get ACX_FSMI_LICENCE_TGMPA class instance.
|
3187 |
+
$this->acx_fsmi_licence_tgmpa = call_user_func( array( get_class( $GLOBALS['acx_fsmi_licence_tgmpa'] ), 'get_instance' ) );
|
3188 |
+
|
3189 |
+
parent::__construct( $skin );
|
3190 |
+
|
3191 |
+
if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) {
|
3192 |
+
$this->clear_destination = true;
|
3193 |
+
}
|
3194 |
+
|
3195 |
+
if ( $this->acx_fsmi_licence_tgmpa->is_automatic ) {
|
3196 |
+
$this->activate_strings();
|
3197 |
+
}
|
3198 |
+
|
3199 |
+
add_action( 'upgrader_process_complete', array( $this->acx_fsmi_licence_tgmpa, 'populate_file_path' ) );
|
3200 |
+
}
|
3201 |
+
|
3202 |
+
/**
|
3203 |
+
* Sets the correct activation strings for the installer skin to use.
|
3204 |
+
*
|
3205 |
+
* @since 2.2.0
|
3206 |
+
*/
|
3207 |
+
public function activate_strings() {
|
3208 |
+
$this->strings['activation_failed'] = __( 'Plugin activation failed.', 'acx_fsmi_licence_tgmpa' );
|
3209 |
+
$this->strings['activation_success'] = __( 'Plugin activated successfully.', 'acx_fsmi_licence_tgmpa' );
|
3210 |
+
}
|
3211 |
+
|
3212 |
+
/**
|
3213 |
+
* Performs the actual installation of each plugin.
|
3214 |
+
*
|
3215 |
+
* @since 2.2.0
|
3216 |
+
*
|
3217 |
+
* @see WP_Upgrader::run()
|
3218 |
+
*
|
3219 |
+
* @param array $options The installation config options.
|
3220 |
+
* @return null|array Return early if error, array of installation data on success.
|
3221 |
+
*/
|
3222 |
+
public function run( $options ) {
|
3223 |
+
$result = parent::run( $options );
|
3224 |
+
|
3225 |
+
// Reset the strings in case we changed one during automatic activation.
|
3226 |
+
if ( $this->acx_fsmi_licence_tgmpa->is_automatic ) {
|
3227 |
+
if ( 'update' === $this->skin->options['install_type'] ) {
|
3228 |
+
$this->upgrade_strings();
|
3229 |
+
} else {
|
3230 |
+
$this->install_strings();
|
3231 |
+
}
|
3232 |
+
}
|
3233 |
+
|
3234 |
+
return $result;
|
3235 |
+
}
|
3236 |
+
|
3237 |
+
/**
|
3238 |
+
* Processes the bulk installation of plugins.
|
3239 |
+
*
|
3240 |
+
* @since 2.2.0
|
3241 |
+
*
|
3242 |
+
* {@internal This is basically a near identical copy of the WP Core
|
3243 |
+
* Plugin_Upgrader::bulk_upgrade() method, with minor adjustments to deal with
|
3244 |
+
* new installs instead of upgrades.
|
3245 |
+
* For ease of future synchronizations, the adjustments are clearly commented, but no other
|
3246 |
+
* comments are added. Code style has been made to comply.}}
|
3247 |
+
*
|
3248 |
+
* @see Plugin_Upgrader::bulk_upgrade()
|
3249 |
+
* @see https://core.trac.wordpress.org/browser/tags/4.2.1/src/wp-admin/includes/class-wp-upgrader.php#L838
|
3250 |
+
* (@internal Last synced: Dec 31st 2015 against https://core.trac.wordpress.org/browser/trunk?rev=36134}}
|
3251 |
+
*
|
3252 |
+
* @param array $plugins The plugin sources needed for installation.
|
3253 |
+
* @param array $args Arbitrary passed extra arguments.
|
3254 |
+
* @return array|false Install confirmation messages on success, false on failure.
|
3255 |
+
*/
|
3256 |
+
public function bulk_install( $plugins, $args = array() ) {
|
3257 |
+
// [ACX_FSMI_LICENCE_TGMPA + ] Hook auto-activation in.
|
3258 |
+
add_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 );
|
3259 |
+
|
3260 |
+
$defaults = array(
|
3261 |
+
'clear_update_cache' => true,
|
3262 |
+
);
|
3263 |
+
$parsed_args = wp_parse_args( $args, $defaults );
|
3264 |
+
|
3265 |
+
$this->init();
|
3266 |
+
$this->bulk = true;
|
3267 |
+
|
3268 |
+
$this->install_strings(); // [ACX_FSMI_LICENCE_TGMPA + ] adjusted.
|
3269 |
+
|
3270 |
+
/* [ACX_FSMI_LICENCE_TGMPA - ] $current = get_site_transient( 'update_plugins' ); */
|
3271 |
+
|
3272 |
+
/* [ACX_FSMI_LICENCE_TGMPA - ] add_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'), 10, 4); */
|
3273 |
+
|
3274 |
+
$this->skin->header();
|
3275 |
+
|
3276 |
+
// Connect to the Filesystem first.
|
3277 |
+
$res = $this->fs_connect( array( WP_CONTENT_DIR, WP_PLUGIN_DIR ) );
|
3278 |
+
if ( ! $res ) {
|
3279 |
+
$this->skin->footer();
|
3280 |
+
return false;
|
3281 |
+
}
|
3282 |
+
|
3283 |
+
$this->skin->bulk_header();
|
3284 |
+
|
3285 |
+
/*
|
3286 |
+
* Only start maintenance mode if:
|
3287 |
+
* - running Multisite and there are one or more plugins specified, OR
|
3288 |
+
* - a plugin with an update available is currently active.
|
3289 |
+
* @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible.
|
3290 |
+
*/
|
3291 |
+
$maintenance = ( is_multisite() && ! empty( $plugins ) );
|
3292 |
+
|
3293 |
+
/*
|
3294 |
+
[ACX_FSMI_LICENCE_TGMPA - ]
|
3295 |
+
foreach ( $plugins as $plugin )
|
3296 |
+
$maintenance = $maintenance || ( is_plugin_active( $plugin ) && isset( $current->response[ $plugin] ) );
|
3297 |
+
*/
|
3298 |
+
if ( $maintenance ) {
|
3299 |
+
$this->maintenance_mode( true );
|
3300 |
+
}
|
3301 |
+
|
3302 |
+
$results = array();
|
3303 |
+
|
3304 |
+
$this->update_count = count( $plugins );
|
3305 |
+
$this->update_current = 0;
|
3306 |
+
foreach ( $plugins as $plugin ) {
|
3307 |
+
$this->update_current++;
|
3308 |
+
|
3309 |
+
/*
|
3310 |
+
[ACX_FSMI_LICENCE_TGMPA - ]
|
3311 |
+
$this->skin->plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin, false, true);
|
3312 |
+
|
3313 |
+
if ( !isset( $current->response[ $plugin ] ) ) {
|
3314 |
+
$this->skin->set_result('up_to_date');
|
3315 |
+
$this->skin->before();
|
3316 |
+
$this->skin->feedback('up_to_date');
|
3317 |
+
$this->skin->after();
|
3318 |
+
$results[$plugin] = true;
|
3319 |
+
continue;
|
3320 |
+
}
|
3321 |
+
|
3322 |
+
// Get the URL to the zip file.
|
3323 |
+
$r = $current->response[ $plugin ];
|
3324 |
+
|
3325 |
+
$this->skin->plugin_active = is_plugin_active($plugin);
|
3326 |
+
*/
|
3327 |
+
|
3328 |
+
$result = $this->run(
|
3329 |
+
array(
|
3330 |
+
'package' => $plugin, // [ACX_FSMI_LICENCE_TGMPA + ] adjusted.
|
3331 |
+
'destination' => WP_PLUGIN_DIR,
|
3332 |
+
'clear_destination' => false, // [ACX_FSMI_LICENCE_TGMPA + ] adjusted.
|
3333 |
+
'clear_working' => true,
|
3334 |
+
'is_multi' => true,
|
3335 |
+
'hook_extra' => array(
|
3336 |
+
'plugin' => $plugin,
|
3337 |
+
),
|
3338 |
+
)
|
3339 |
+
);
|
3340 |
+
|
3341 |
+
$results[ $plugin ] = $this->result;
|
3342 |
+
|
3343 |
+
// Prevent credentials auth screen from displaying multiple times.
|
3344 |
+
if ( false === $result ) {
|
3345 |
+
break;
|
3346 |
+
}
|
3347 |
+
} //end foreach $plugins
|
3348 |
+
|
3349 |
+
$this->maintenance_mode( false );
|
3350 |
+
|
3351 |
+
/**
|
3352 |
+
* Fires when the bulk upgrader process is complete.
|
3353 |
+
*
|
3354 |
+
* @since WP 3.6.0 / ACX_FSMI_LICENCE_TGMPA 2.5.0
|
3355 |
+
*
|
3356 |
+
* @param Plugin_Upgrader $this Plugin_Upgrader instance. In other contexts, $this, might
|
3357 |
+
* be a Theme_Upgrader or Core_Upgrade instance.
|
3358 |
+
* @param array $data {
|
3359 |
+
* Array of bulk item update data.
|
3360 |
+
*
|
3361 |
+
* @type string $action Type of action. Default 'update'.
|
3362 |
+
* @type string $type Type of update process. Accepts 'plugin', 'theme', or 'core'.
|
3363 |
+
* @type bool $bulk Whether the update process is a bulk update. Default true.
|
3364 |
+
* @type array $packages Array of plugin, theme, or core packages to update.
|
3365 |
+
* }
|
3366 |
+
*/
|
3367 |
+
do_action( 'upgrader_process_complete', $this, array(
|
3368 |
+
'action' => 'install', // [ACX_FSMI_LICENCE_TGMPA + ] adjusted.
|
3369 |
+
'type' => 'plugin',
|
3370 |
+
'bulk' => true,
|
3371 |
+
'plugins' => $plugins,
|
3372 |
+
) );
|
3373 |
+
|
3374 |
+
$this->skin->bulk_footer();
|
3375 |
+
|
3376 |
+
$this->skin->footer();
|
3377 |
+
|
3378 |
+
// Cleanup our hooks, in case something else does a upgrade on this connection.
|
3379 |
+
/* [ACX_FSMI_LICENCE_TGMPA - ] remove_filter('upgrader_clear_destination', array($this, 'delete_old_plugin')); */
|
3380 |
+
|
3381 |
+
// [ACX_FSMI_LICENCE_TGMPA + ] Remove our auto-activation hook.
|
3382 |
+
remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 );
|
3383 |
+
|
3384 |
+
// Force refresh of plugin update information.
|
3385 |
+
wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
|
3386 |
+
|
3387 |
+
return $results;
|
3388 |
+
}
|
3389 |
+
|
3390 |
+
/**
|
3391 |
+
* Handle a bulk upgrade request.
|
3392 |
+
*
|
3393 |
+
* @since 2.5.0
|
3394 |
+
*
|
3395 |
+
* @see Plugin_Upgrader::bulk_upgrade()
|
3396 |
+
*
|
3397 |
+
* @param array $plugins The local WP file_path's of the plugins which should be upgraded.
|
3398 |
+
* @param array $args Arbitrary passed extra arguments.
|
3399 |
+
* @return string|bool Install confirmation messages on success, false on failure.
|
3400 |
+
*/
|
3401 |
+
public function bulk_upgrade( $plugins, $args = array() ) {
|
3402 |
+
|
3403 |
+
add_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 );
|
3404 |
+
|
3405 |
+
$result = parent::bulk_upgrade( $plugins, $args );
|
3406 |
+
|
3407 |
+
remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 );
|
3408 |
+
|
3409 |
+
return $result;
|
3410 |
+
}
|
3411 |
+
|
3412 |
+
/**
|
3413 |
+
* Abuse a filter to auto-activate plugins after installation.
|
3414 |
+
*
|
3415 |
+
* Hooked into the 'upgrader_post_install' filter hook.
|
3416 |
+
*
|
3417 |
+
* @since 2.5.0
|
3418 |
+
*
|
3419 |
+
* @param bool $bool The value we need to give back (true).
|
3420 |
+
* @return bool
|
3421 |
+
*/
|
3422 |
+
public function auto_activate( $bool ) {
|
3423 |
+
// Only process the activation of installed plugins if the automatic flag is set to true.
|
3424 |
+
if ( $this->acx_fsmi_licence_tgmpa->is_automatic ) {
|
3425 |
+
// Flush plugins cache so the headers of the newly installed plugins will be read correctly.
|
3426 |
+
wp_clean_plugins_cache();
|
3427 |
+
|
3428 |
+
// Get the installed plugin file.
|
3429 |
+
$plugin_info = $this->plugin_info();
|
3430 |
+
|
3431 |
+
// Don't try to activate on upgrade of active plugin as WP will do this already.
|
3432 |
+
if ( ! is_plugin_active( $plugin_info ) ) {
|
3433 |
+
$activate = activate_plugin( $plugin_info );
|
3434 |
+
|
3435 |
+
// Adjust the success string based on the activation result.
|
3436 |
+
$this->strings['process_success'] = $this->strings['process_success'] . "<br />\n";
|
3437 |
+
|
3438 |
+
if ( is_wp_error( $activate ) ) {
|
3439 |
+
$this->skin->error( $activate );
|
3440 |
+
$this->strings['process_success'] .= $this->strings['activation_failed'];
|
3441 |
+
} else {
|
3442 |
+
$this->strings['process_success'] .= $this->strings['activation_success'];
|
3443 |
+
}
|
3444 |
+
}
|
3445 |
+
}
|
3446 |
+
|
3447 |
+
return $bool;
|
3448 |
+
}
|
3449 |
+
}
|
3450 |
+
}
|
3451 |
+
|
3452 |
+
if ( ! class_exists( 'ACX_FSMI_LICENCE_TGMPA_Bulk_Installer_Skin' ) ) {
|
3453 |
+
|
3454 |
+
/**
|
3455 |
+
* Installer skin to set strings for the bulk plugin installations..
|
3456 |
+
*
|
3457 |
+
* Extends Bulk_Upgrader_Skin and customizes to suit the installation of multiple
|
3458 |
+
* plugins.
|
3459 |
+
*
|
3460 |
+
* @since 2.2.0
|
3461 |
+
*
|
3462 |
+
* {@internal Since 2.5.2 the class has been renamed from ACX_FSMI_LICENCE_TGM_Bulk_Installer_Skin to
|
3463 |
+
* ACX_FSMI_LICENCE_TGMPA_Bulk_Installer_Skin.
|
3464 |
+
* This was done to prevent backward compatibility issues with v2.3.6.}}
|
3465 |
+
*
|
3466 |
+
* @see https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/class-wp-upgrader-skins.php
|
3467 |
+
*
|
3468 |
+
* @package ACX_FSMI_LICENCE_TGM-Plugin-Activation
|
3469 |
+
* @author Thomas Griffin
|
3470 |
+
* @author Gary Jones
|
3471 |
+
*/
|
3472 |
+
class ACX_FSMI_LICENCE_TGMPA_Bulk_Installer_Skin extends Bulk_Upgrader_Skin {
|
3473 |
+
/**
|
3474 |
+
* Holds plugin info for each individual plugin installation.
|
3475 |
+
*
|
3476 |
+
* @since 2.2.0
|
3477 |
+
*
|
3478 |
+
* @var array
|
3479 |
+
*/
|
3480 |
+
public $plugin_info = array();
|
3481 |
+
|
3482 |
+
/**
|
3483 |
+
* Holds names of plugins that are undergoing bulk installations.
|
3484 |
+
*
|
3485 |
+
* @since 2.2.0
|
3486 |
+
*
|
3487 |
+
* @var array
|
3488 |
+
*/
|
3489 |
+
public $plugin_names = array();
|
3490 |
+
|
3491 |
+
/**
|
3492 |
+
* Integer to use for iteration through each plugin installation.
|
3493 |
+
*
|
3494 |
+
* @since 2.2.0
|
3495 |
+
*
|
3496 |
+
* @var integer
|
3497 |
+
*/
|
3498 |
+
public $i = 0;
|
3499 |
+
|
3500 |
+
/**
|
3501 |
+
* ACX_FSMI_LICENCE_TGMPA instance
|
3502 |
+
*
|
3503 |
+
* @since 2.5.0
|
3504 |
+
*
|
3505 |
+
* @var object
|
3506 |
+
*/
|
3507 |
+
protected $acx_fsmi_licence_tgmpa;
|
3508 |
+
|
3509 |
+
/**
|
3510 |
+
* Constructor. Parses default args with new ones and extracts them for use.
|
3511 |
+
*
|
3512 |
+
* @since 2.2.0
|
3513 |
+
*
|
3514 |
+
* @param array $args Arguments to pass for use within the class.
|
3515 |
+
*/
|
3516 |
+
public function __construct( $args = array() ) {
|
3517 |
+
// Get ACX_FSMI_LICENCE_TGMPA class instance.
|
3518 |
+
$this->acx_fsmi_licence_tgmpa = call_user_func( array( get_class( $GLOBALS['acx_fsmi_licence_tgmpa'] ), 'get_instance' ) );
|
3519 |
+
|
3520 |
+
// Parse default and new args.
|
3521 |
+
$defaults = array(
|
3522 |
+
'url' => '',
|
3523 |
+
'nonce' => '',
|
3524 |
+
'names' => array(),
|
3525 |
+
'install_type' => 'install',
|
3526 |
+
);
|
3527 |
+
$args = wp_parse_args( $args, $defaults );
|
3528 |
+
|
3529 |
+
// Set plugin names to $this->plugin_names property.
|
3530 |
+
$this->plugin_names = $args['names'];
|
3531 |
+
|
3532 |
+
// Extract the new args.
|
3533 |
+
parent::__construct( $args );
|
3534 |
+
}
|
3535 |
+
|
3536 |
+
/**
|
3537 |
+
* Sets install skin strings for each individual plugin.
|
3538 |
+
*
|
3539 |
+
* Checks to see if the automatic activation flag is set and uses the
|
3540 |
+
* the proper strings accordingly.
|
3541 |
+
*
|
3542 |
+
* @since 2.2.0
|
3543 |
+
*/
|
3544 |
+
public function add_strings() {
|
3545 |
+
if ( 'update' === $this->options['install_type'] ) {
|
3546 |
+
parent::add_strings();
|
3547 |
+
$this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'acx_fsmi_licence_tgmpa' );
|
3548 |
+
} else {
|
3549 |
+
$this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'acx_fsmi_licence_tgmpa' );
|
3550 |
+
$this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'acx_fsmi_licence_tgmpa' );
|
3551 |
+
|
3552 |
+
if ( $this->acx_fsmi_licence_tgmpa->is_automatic ) {
|
3553 |
+
// Automatic activation strings.
|
3554 |
+
$this->upgrader->strings['skin_upgrade_start'] = __( 'The installation and activation process is starting. This process may take a while on some hosts, so please be patient.', 'acx_fsmi_licence_tgmpa' );
|
3555 |
+
$this->upgrader->strings['skin_update_successful'] = __( '%1$s installed and activated successfully.', 'acx_fsmi_licence_tgmpa' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'acx_fsmi_licence_tgmpa' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'acx_fsmi_licence_tgmpa' ) . '</span>.</a>';
|
3556 |
+
$this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'acx_fsmi_licence_tgmpa' );
|
3557 |
+
$this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'acx_fsmi_licence_tgmpa' );
|
3558 |
+
} else {
|
3559 |
+
// Default installation strings.
|
3560 |
+
$this->upgrader->strings['skin_upgrade_start'] = __( 'The installation process is starting. This process may take a while on some hosts, so please be patient.', 'acx_fsmi_licence_tgmpa' );
|
3561 |
+
$this->upgrader->strings['skin_update_successful'] = esc_html__( '%1$s installed successfully.', 'acx_fsmi_licence_tgmpa' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'acx_fsmi_licence_tgmpa' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'acx_fsmi_licence_tgmpa' ) . '</span>.</a>';
|
3562 |
+
$this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'acx_fsmi_licence_tgmpa' );
|
3563 |
+
$this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'acx_fsmi_licence_tgmpa' );
|
3564 |
+
}
|
3565 |
+
}
|
3566 |
+
}
|
3567 |
+
|
3568 |
+
/**
|
3569 |
+
* Outputs the header strings and necessary JS before each plugin installation.
|
3570 |
+
*
|
3571 |
+
* @since 2.2.0
|
3572 |
+
*
|
3573 |
+
* @param string $title Unused in this implementation.
|
3574 |
+
*/
|
3575 |
+
public function before( $title = '' ) {
|
3576 |
+
if ( empty( $title ) ) {
|
3577 |
+
$title = esc_html( $this->plugin_names[ $this->i ] );
|
3578 |
+
}
|
3579 |
+
parent::before( $title );
|
3580 |
+
}
|
3581 |
+
|
3582 |
+
/**
|
3583 |
+
* Outputs the footer strings and necessary JS after each plugin installation.
|
3584 |
+
*
|
3585 |
+
* Checks for any errors and outputs them if they exist, else output
|
3586 |
+
* success strings.
|
3587 |
+
*
|
3588 |
+
* @since 2.2.0
|
3589 |
+
*
|
3590 |
+
* @param string $title Unused in this implementation.
|
3591 |
+
*/
|
3592 |
+
public function after( $title = '' ) {
|
3593 |
+
if ( empty( $title ) ) {
|
3594 |
+
$title = esc_html( $this->plugin_names[ $this->i ] );
|
3595 |
+
}
|
3596 |
+
parent::after( $title );
|
3597 |
+
|
3598 |
+
$this->i++;
|
3599 |
+
}
|
3600 |
+
|
3601 |
+
/**
|
3602 |
+
* Outputs links after bulk plugin installation is complete.
|
3603 |
+
*
|
3604 |
+
* @since 2.2.0
|
3605 |
+
*/
|
3606 |
+
public function bulk_footer() {
|
3607 |
+
// Serve up the string to say installations (and possibly activations) are complete.
|
3608 |
+
parent::bulk_footer();
|
3609 |
+
|
3610 |
+
// Flush plugins cache so we can make sure that the installed plugins list is always up to date.
|
3611 |
+
wp_clean_plugins_cache();
|
3612 |
+
|
3613 |
+
$this->acx_fsmi_licence_tgmpa->show_acx_fsmi_licence_tgmpa_version();
|
3614 |
+
|
3615 |
+
// Display message based on if all plugins are now active or not.
|
3616 |
+
$update_actions = array();
|
3617 |
+
|
3618 |
+
if ( $this->acx_fsmi_licence_tgmpa->is_acx_fsmi_licence_tgmpa_complete() ) {
|
3619 |
+
// All plugins are active, so we display the complete string and hide the menu to protect users.
|
3620 |
+
echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
|
3621 |
+
$update_actions['dashboard'] = sprintf(
|
3622 |
+
esc_html( $this->acx_fsmi_licence_tgmpa->strings['complete'] ),
|
3623 |
+
'<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'acx_fsmi_licence_tgmpa' ) . '</a>'
|
3624 |
+
);
|
3625 |
+
} else {
|
3626 |
+
$update_actions['acx_fsmi_licence_tgmpa_page'] = '<a href="' . esc_url( $this->acx_fsmi_licence_tgmpa->get_acx_fsmi_licence_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->acx_fsmi_licence_tgmpa->strings['return'] ) . '</a>';
|
3627 |
+
}
|
3628 |
+
|
3629 |
+
/**
|
3630 |
+
* Filter the list of action links available following bulk plugin installs/updates.
|
3631 |
+
*
|
3632 |
+
* @since 2.5.0
|
3633 |
+
*
|
3634 |
+
* @param array $update_actions Array of plugin action links.
|
3635 |
+
* @param array $plugin_info Array of information for the last-handled plugin.
|
3636 |
+
*/
|
3637 |
+
$update_actions = apply_filters( 'acx_fsmi_licence_tgmpa_update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info );
|
3638 |
+
|
3639 |
+
if ( ! empty( $update_actions ) ) {
|
3640 |
+
$this->feedback( implode( ' | ', (array) $update_actions ) );
|
3641 |
+
}
|
3642 |
+
}
|
3643 |
+
|
3644 |
+
/* *********** DEPRECATED METHODS *********** */
|
3645 |
+
|
3646 |
+
/**
|
3647 |
+
* Flush header output buffer.
|
3648 |
+
*
|
3649 |
+
* @since 2.2.0
|
3650 |
+
* @deprecated 2.5.0 use {@see Bulk_Upgrader_Skin::flush_output()} instead
|
3651 |
+
* @see Bulk_Upgrader_Skin::flush_output()
|
3652 |
+
*/
|
3653 |
+
public function before_flush_output() {
|
3654 |
+
_deprecated_function( __FUNCTION__, 'ACX_FSMI_LICENCE_TGMPA 2.5.0', 'Bulk_Upgrader_Skin::flush_output()' );
|
3655 |
+
$this->flush_output();
|
3656 |
+
}
|
3657 |
+
|
3658 |
+
/**
|
3659 |
+
* Flush footer output buffer and iterate $this->i to make sure the
|
3660 |
+
* installation strings reference the correct plugin.
|
3661 |
+
*
|
3662 |
+
* @since 2.2.0
|
3663 |
+
* @deprecated 2.5.0 use {@see Bulk_Upgrader_Skin::flush_output()} instead
|
3664 |
+
* @see Bulk_Upgrader_Skin::flush_output()
|
3665 |
+
*/
|
3666 |
+
public function after_flush_output() {
|
3667 |
+
_deprecated_function( __FUNCTION__, 'ACX_FSMI_LICENCE_TGMPA 2.5.0', 'Bulk_Upgrader_Skin::flush_output()' );
|
3668 |
+
$this->flush_output();
|
3669 |
+
$this->i++;
|
3670 |
+
}
|
3671 |
+
}
|
3672 |
+
}
|
3673 |
+
}
|
3674 |
+
}
|
3675 |
+
}
|
3676 |
+
|
3677 |
+
if ( ! class_exists( 'ACX_FSMI_LICENCE_TGMPA_Utils' ) ) {
|
3678 |
+
|
3679 |
+
/**
|
3680 |
+
* Generic utilities for ACX_FSMI_LICENCE_TGMPA.
|
3681 |
+
*
|
3682 |
+
* All methods are static, poor-dev name-spacing class wrapper.
|
3683 |
+
*
|
3684 |
+
* Class was called ACX_FSMI_LICENCE_TGM_Utils in 2.5.0 but renamed ACX_FSMI_LICENCE_TGMPA_Utils in 2.5.1 as this was conflicting with Soliloquy.
|
3685 |
+
*
|
3686 |
+
* @since 2.5.0
|
3687 |
+
*
|
3688 |
+
* @package ACX_FSMI_LICENCE_TGM-Plugin-Activation
|
3689 |
+
* @author Juliette Reinders Folmer
|
3690 |
+
*/
|
3691 |
+
class ACX_FSMI_LICENCE_TGMPA_Utils {
|
3692 |
+
/**
|
3693 |
+
* Whether the PHP filter extension is enabled.
|
3694 |
+
*
|
3695 |
+
* @see http://php.net/book.filter
|
3696 |
+
*
|
3697 |
+
* @since 2.5.0
|
3698 |
+
*
|
3699 |
+
* @static
|
3700 |
+
*
|
3701 |
+
* @var bool $has_filters True is the extension is enabled.
|
3702 |
+
*/
|
3703 |
+
public static $has_filters;
|
3704 |
+
|
3705 |
+
/**
|
3706 |
+
* Wrap an arbitrary string in <em> tags. Meant to be used in combination with array_map().
|
3707 |
+
*
|
3708 |
+
* @since 2.5.0
|
3709 |
+
*
|
3710 |
+
* @static
|
3711 |
+
*
|
3712 |
+
* @param string $string Text to be wrapped.
|
3713 |
+
* @return string
|
3714 |
+
*/
|
3715 |
+
public static function wrap_in_em( $string ) {
|
3716 |
+
return '<em>' . wp_kses_post( $string ) . '</em>';
|
3717 |
+
}
|
3718 |
+
|
3719 |
+
/**
|
3720 |
+
* Wrap an arbitrary string in <strong> tags. Meant to be used in combination with array_map().
|
3721 |
+
*
|
3722 |
+
* @since 2.5.0
|
3723 |
+
*
|
3724 |
+
* @static
|
3725 |
+
*
|
3726 |
+
* @param string $string Text to be wrapped.
|
3727 |
+
* @return string
|
3728 |
+
*/
|
3729 |
+
public static function wrap_in_strong( $string ) {
|
3730 |
+
return '<strong>' . wp_kses_post( $string ) . '</strong>';
|
3731 |
+
}
|
3732 |
+
|
3733 |
+
/**
|
3734 |
+
* Helper function: Validate a value as boolean
|
3735 |
+
*
|
3736 |
+
* @since 2.5.0
|
3737 |
+
*
|
3738 |
+
* @static
|
3739 |
+
*
|
3740 |
+
* @param mixed $value Arbitrary value.
|
3741 |
+
* @return bool
|
3742 |
+
*/
|
3743 |
+
public static function validate_bool( $value ) {
|
3744 |
+
if ( ! isset( self::$has_filters ) ) {
|
3745 |
+
self::$has_filters = extension_loaded( 'filter' );
|
3746 |
+
}
|
3747 |
+
|
3748 |
+
if ( self::$has_filters ) {
|
3749 |
+
return filter_var( $value, FILTER_VALIDATE_BOOLEAN );
|
3750 |
+
} else {
|
3751 |
+
return self::emulate_filter_bool( $value );
|
3752 |
+
}
|
3753 |
+
}
|
3754 |
+
|
3755 |
+
/**
|
3756 |
+
* Helper function: Cast a value to bool
|
3757 |
+
*
|
3758 |
+
* @since 2.5.0
|
3759 |
+
*
|
3760 |
+
* @static
|
3761 |
+
*
|
3762 |
+
* @param mixed $value Value to cast.
|
3763 |
+
* @return bool
|
3764 |
+
*/
|
3765 |
+
protected static function emulate_filter_bool( $value ) {
|
3766 |
+
// @codingStandardsIgnoreStart
|
3767 |
+
static $true = array(
|
3768 |
+
'1',
|
3769 |
+
'true', 'True', 'TRUE',
|
3770 |
+
'y', 'Y',
|
3771 |
+
'yes', 'Yes', 'YES',
|
3772 |
+
'on', 'On', 'ON',
|
3773 |
+
);
|
3774 |
+
static $false = array(
|
3775 |
+
'0',
|
3776 |
+
'false', 'False', 'FALSE',
|
3777 |
+
'n', 'N',
|
3778 |
+
'no', 'No', 'NO',
|
3779 |
+
'off', 'Off', 'OFF',
|
3780 |
+
);
|
3781 |
+
// @codingStandardsIgnoreEnd
|
3782 |
+
|
3783 |
+
if ( is_bool( $value ) ) {
|
3784 |
+
return $value;
|
3785 |
+
} elseif ( is_int( $value ) && ( 0 === $value || 1 === $value ) ) {
|
3786 |
+
return (bool) $value;
|
3787 |
+
} elseif ( ( is_float( $value ) && ! is_nan( $value ) ) && ( (float) 0 === $value || (float) 1 === $value ) ) {
|
3788 |
+
return (bool) $value;
|
3789 |
+
} elseif ( is_string( $value ) ) {
|
3790 |
+
$value = trim( $value );
|
3791 |
+
if ( in_array( $value, $true, true ) ) {
|
3792 |
+
return true;
|
3793 |
+
} elseif ( in_array( $value, $false, true ) ) {
|
3794 |
+
return false;
|
3795 |
+
} else {
|
3796 |
+
return false;
|
3797 |
+
}
|
3798 |
+
}
|
3799 |
+
|
3800 |
+
return false;
|
3801 |
+
}
|
3802 |
+
} // End of class ACX_FSMI_LICENCE_TGMPA_Utils
|
3803 |
+
} // End of class_exists wrapper
|
3804 |
+
|
3805 |
+
function acx_fsmi_purachase_licence_form()
|
3806 |
+
{
|
3807 |
+
$acx_fsmip_licence_array = get_option('acx_fsmip_licence_array');
|
3808 |
+
if(is_serialized($acx_fsmip_licence_array))
|
3809 |
+
{
|
3810 |
+
$acx_fsmip_licence_array = unserialize($acx_fsmip_licence_array);
|
3811 |
+
}
|
3812 |
+
if($acx_fsmip_licence_array == "" || !is_array($acx_fsmip_licence_array))
|
3813 |
+
{
|
3814 |
+
$acx_fsmip_licence_array = array();
|
3815 |
+
}
|
3816 |
+
?>
|
3817 |
+
<div class="acx_fsmi_purchased_li_cvr">
|
3818 |
+
<div id="acx_fsmi_license_table_list" style="width:98%;float:left;">
|
3819 |
+
<h4><?php _e("Purchased Addons List","floating-social-media-icon"); ?></h4>
|
3820 |
+
<table class="wp-list-table widefat fixed striped">
|
3821 |
+
<tr>
|
3822 |
+
<th class="manage-column"><?php _e('Plugin Name','floating-social-media-icon');?></th>
|
3823 |
+
<th class="manage-column"><?php _e('Licence Code','floating-social-media-icon');?></th>
|
3824 |
+
<th class="manage-column"><?php _e('Version','floating-social-media-icon');?></th>
|
3825 |
+
<th class="manage-column"><?php _e('Licence Status','floating-social-media-icon');?></th>
|
3826 |
+
<th class="manage-column"><?php _e('Plugin Status','floating-social-media-icon');?></th>
|
3827 |
+
<th class="manage-column"><?php _e('Action','floating-social-media-icon');?></th>
|
3828 |
+
</tr>
|
3829 |
+
|
3830 |
+
<?php
|
3831 |
+
if(empty($acx_fsmip_licence_array))
|
3832 |
+
{
|
3833 |
+
?>
|
3834 |
+
<tr><td colspan="5"><?php _e('No Licence found','floating-social-media-icon');?></td></tr>
|
3835 |
+
<?php
|
3836 |
+
}
|
3837 |
+
$acx_fsmi_plugin_stat = "";
|
3838 |
+
$acx_refresh_stat = 'acx_hide_refresh';
|
3839 |
+
foreach($acx_fsmip_licence_array as $key => $value)
|
3840 |
+
{
|
3841 |
+
$acx_plugin_array = acx_fsmi_get_purchased_plugin_details($value['licence_code']);
|
3842 |
+
$acx_active_plugin_stat = acx_fsmi_get_active_plugin_status($acx_plugin_array['slug']);
|
3843 |
+
if($acx_active_plugin_stat == true)
|
3844 |
+
{
|
3845 |
+
$acx_fsmi_plugin_stat = __('Active','floating-social-media-icon');
|
3846 |
+
}
|
3847 |
+
else
|
3848 |
+
{
|
3849 |
+
$acx_fsmi_plugin_stat = __('Not Active <a href="'.wp_nonce_url(admin_url("admin.php?page=acx_fsmi_licence_tgmpa-install-plugins")).'">[Install Now]</a>','floating-social-media-icon');
|
3850 |
+
}
|
3851 |
+
if(function_exists('check_acx_pfsmi_license') && !function_exists('acx_check_fsmip_offline_license'))
|
3852 |
+
{
|
3853 |
+
$acx_refresh_stat = 'acx_show_refresh';
|
3854 |
+
}
|
3855 |
+
|
3856 |
+
?>
|
3857 |
+
<tr><td><?php echo $value['addon_name']; ?></td>
|
3858 |
+
<td><?php echo $value['licence_code']; ?></td>
|
3859 |
+
<td><?php echo $value['version']; ?></td>
|
3860 |
+
<td><?php echo $acx_plugin_array['status']; ?></td>
|
3861 |
+
<td><?php echo $acx_fsmi_plugin_stat; ?></td>
|
3862 |
+
<td data-licence="<?php echo $value['licence_code']; ?>" data-key="<?php echo $key;?>"><span class="ax_fsmi_action_icon acx_fsmi_lic_refresh <?php echo $acx_refresh_stat; ?>" title="<?php _e("Refresh","floating-social-media-icon");?>"></span><span class="ax_fsmi_action_icon acx_fsmi_lic_del" title="<?php _e("Delete","floating-social-media-icon");?>"></span></td>
|
3863 |
+
</tr>
|
3864 |
+
<?php
|
3865 |
+
}
|
3866 |
+
?>
|
3867 |
+
</table>
|
3868 |
+
</div><!-- acx_fsmi_license_table_list -->
|
3869 |
+
</div><!-- acx_fsmi_purchased_li_cvr -->
|
3870 |
+
<?php
|
3871 |
+
}
|
3872 |
+
add_action("acx_fsmi_addon_hook_option_field_content","acx_fsmi_purachase_licence_form",20);
|
3873 |
+
} // End of !empty($acx_fsmi_purchased_li_array)
|
3874 |
+
if(!function_exists('acx_fsmi_get_purchased_plugin_details'))
|
3875 |
+
{
|
3876 |
+
function acx_fsmi_get_purchased_plugin_details($licence)
|
3877 |
+
{
|
3878 |
+
$licence = trim($licence);
|
3879 |
+
$response_array = array(
|
3880 |
+
"download_url" => "",
|
3881 |
+
"slug" => plugin_basename( __FILE__ ),
|
3882 |
+
"ignore_stat" => "no",
|
3883 |
+
"status" => ""
|
3884 |
+
);
|
3885 |
+
if($licence != "")
|
3886 |
+
{
|
3887 |
+
$acx_fsmi_purchased_li_array = get_option('acx_fsmi_purchased_li_array');
|
3888 |
+
if(is_serialized($acx_fsmi_purchased_li_array))
|
3889 |
+
{
|
3890 |
+
$acx_fsmi_purchased_li_array = unserialize($acx_fsmi_purchased_li_array);
|
3891 |
+
}
|
3892 |
+
if($acx_fsmi_purchased_li_array == "" || !is_array($acx_fsmi_purchased_li_array))
|
3893 |
+
{
|
3894 |
+
$acx_fsmi_purchased_li_array = array();
|
3895 |
+
}
|
3896 |
+
foreach($acx_fsmi_purchased_li_array as $key => $value)
|
3897 |
+
{
|
3898 |
+
if($licence == $key)
|
3899 |
+
{
|
3900 |
+
$response_array = array(
|
3901 |
+
"download_dynamic_url" => $value['download_dynamic_url'],
|
3902 |
+
"slug" => $value['slug'],
|
3903 |
+
"ignore_stat" => $value['ignore_stat'],
|
3904 |
+
"status" => $value['status']
|
3905 |
+
);
|
3906 |
+
}
|
3907 |
+
}
|
3908 |
+
}
|
3909 |
+
return $response_array;
|
3910 |
+
}
|
3911 |
+
|
3912 |
+
}
|
3913 |
+
function acx_fsmi_license_notice_install_pending() {
|
3914 |
+
?>
|
3915 |
+
<div class="notice notice-info is-dismissible">
|
3916 |
+
<p><?php _e( 'You have saved license code for one or more addons of Floating Social Media Icon, Please <a href="'.wp_nonce_url(admin_url("admin.php?page=acx_fsmi_licence_tgmpa-install-plugins")).'">click here</a> to visit the premium addon installation screen - <a href="'.wp_nonce_url(admin_url("admin.php?page=acx_fsmi_licence_tgmpa-install-plugins")).'">[Install Addons]</a>', 'floating-social-media-icon' ); ?></p>
|
3917 |
+
</div>
|
3918 |
+
<?php
|
3919 |
+
}
|
3920 |
+
|
3921 |
+
// hook to show installation using tgmpa
|
3922 |
+
//-------------------------------------------------------------------------------------
|
3923 |
+
function acx_fsmi_licnece_install_required_plugins() {
|
3924 |
+
|
3925 |
+
$acx_fsmip_licence_array = get_option('acx_fsmip_licence_array');
|
3926 |
+
if(is_serialized($acx_fsmip_licence_array))
|
3927 |
+
{
|
3928 |
+
$acx_fsmip_licence_array = unserialize($acx_fsmip_licence_array);
|
3929 |
+
}
|
3930 |
+
if($acx_fsmip_licence_array == "" || !is_array($acx_fsmip_licence_array))
|
3931 |
+
{
|
3932 |
+
$acx_fsmip_licence_array = array();
|
3933 |
+
}
|
3934 |
+
$display_notice = false;
|
3935 |
+
foreach($acx_fsmip_licence_array as $key => $value)
|
3936 |
+
{
|
3937 |
+
$acx_plugin_array = acx_fsmi_get_purchased_plugin_details($value['licence_code']);
|
3938 |
+
$acx_active_plugin_stat = acx_fsmi_get_active_plugin_status($acx_plugin_array['slug']);
|
3939 |
+
$plugins = array(
|
3940 |
+
array(
|
3941 |
+
'name' => $value['addon_name'], // The plugin name.
|
3942 |
+
'slug' => $acx_plugin_array['slug'], // The plugin slug (typically the folder name).
|
3943 |
+
'source' => $acx_plugin_array['download_dynamic_url'], // The plugin source.
|
3944 |
+
'required' => true, // If false, the plugin is only 'recommended' instead of required.
|
3945 |
+
),
|
3946 |
+
);
|
3947 |
+
$config = array(
|
3948 |
+
'id' => $acx_plugin_array['slug'],
|
3949 |
+
'default_path' => '',
|
3950 |
+
'menu' => 'acx_fsmi_licence_tgmpa-install-plugins',
|
3951 |
+
'parent_slug' => 'Acurax-Social-Icons-Settings',
|
3952 |
+
'capability' => 'manage_options',
|
3953 |
+
'has_notices' => false,
|
3954 |
+
'dismissable' => false,
|
3955 |
+
'dismiss_msg' => '',
|
3956 |
+
'is_automatic' => true,
|
3957 |
+
'message' => '<h4>'.__('Install ','floating-social-media-icon').$value['addon_name'].'</h4>',
|
3958 |
+
'strings' => array(
|
3959 |
+
'notice_can_install_required' => _n_noop(
|
3960 |
+
'You have entered the license for the following plugin: %1$s.',
|
3961 |
+
'You have entered the license for the following plugin: %1$s.',
|
3962 |
+
'floating-social-media-icon'
|
3963 |
+
),
|
3964 |
+
'install_link' => _n_noop(
|
3965 |
+
'Click Here To Install',
|
3966 |
+
'Click Here To Install',
|
3967 |
+
'acx_fsmi_licence_tgmpa'
|
3968 |
+
),
|
3969 |
+
),
|
3970 |
+
);
|
3971 |
+
$acx_active_plugin_stat = acx_fsmi_get_active_plugin_status($acx_plugin_array['slug']);
|
3972 |
+
|
3973 |
+
if($acx_active_plugin_stat == false)
|
3974 |
+
{
|
3975 |
+
if($acx_plugin_array['ignore_stat'] == 'no' )
|
3976 |
+
{
|
3977 |
+
acx_fsmi_licence_tgmpa( $plugins, $config );
|
3978 |
+
$display_notice = true;
|
3979 |
+
}
|
3980 |
+
}
|
3981 |
+
}
|
3982 |
+
if($display_notice == true)
|
3983 |
+
{
|
3984 |
+
add_action( 'admin_notices', 'acx_fsmi_license_notice_install_pending' );
|
3985 |
+
}
|
3986 |
+
}
|
3987 |
+
add_action( 'acx_fsmi_licence_tgmpa_register', 'acx_fsmi_licnece_install_required_plugins' );
|
3988 |
+
// get plugin activation status
|
3989 |
+
function acx_fsmi_get_active_plugin_status($acx_slug)
|
3990 |
+
{
|
3991 |
+
$acx_return = false;
|
3992 |
+
$acx_fsmi_active_plugin_arr = get_option('active_plugins');
|
3993 |
+
foreach($acx_fsmi_active_plugin_arr as $key => $value)
|
3994 |
+
{
|
3995 |
+
if(strpos($value,$acx_slug) !== false)
|
3996 |
+
{
|
3997 |
+
$acx_return = true;
|
3998 |
+
}
|
3999 |
+
}
|
4000 |
+
return $acx_return;
|
4001 |
+
}
|
4002 |
+
|
4003 |
+
function acx_fsmi_licence_btn_fn()
|
4004 |
+
{
|
4005 |
+
?>
|
4006 |
+
<div class="acx_fsmi_add_p_licen_cvr" style="width:100%;float:left;margin-top:50px;">
|
4007 |
+
<span class="acx_fsmi_add_p_licen"><a class="acx_fsmi_purchas_lic_add button button-primary"><?php _e('CLICK HERE TO ADD LICENCE','floating-social-media-icon');?></a></span><!-- acx_fsmi_add_p_licen -->
|
4008 |
+
</div><!-- acx_fsmi_add_p_licen_cvr -->
|
4009 |
+
|
4010 |
+
<div class="acx_fsmi_add_p_licence_light_cvr">
|
4011 |
+
|
4012 |
+
<div class="acx_fsmi_add_p_licence_li_cn">
|
4013 |
+
<div class="acx_fsmi_add_p_licence_light_cls"></div><!-- acx_fsmi_add_p_licence_light_cls -->
|
4014 |
+
<div class="acx_fsmi_add_p_licence_light_content">
|
4015 |
+
<span class="acx_fsmi_p_li_span">
|
4016 |
+
<input type="text" id="acx_fsmi_purchased_licence" placeholder="<?php _e('Enter Your Licence Code','floating-social-media-icon');?>" value=""/>
|
4017 |
+
<span class="acx_fsmi_pu_li_error"></span>
|
4018 |
+
<a class="acx_fsmi_add_p_li_cls button button-primary"><?php _e('SUBMIT','floating-social-media-icon');?></a>
|
4019 |
+
</span><!-- acx_fsmi_p_li_span -->
|
4020 |
+
</div><!-- acx_fsmi_add_p_licence_light_content -->
|
4021 |
+
</div><!-- acx_fsmi_add_p_licence_li_cn -->
|
4022 |
+
|
4023 |
+
</div><!-- acx_fsmi_add_p_licence_light_cvr -->
|
4024 |
+
<script>
|
4025 |
+
jQuery(".acx_fsmi_purchas_lic_add").click(function()
|
4026 |
+
{
|
4027 |
+
jQuery(".acx_fsmi_add_p_licence_light_cvr").fadeIn();
|
4028 |
+
});
|
4029 |
+
jQuery(".acx_fsmi_add_p_licence_light_cls").click(function()
|
4030 |
+
{
|
4031 |
+
jQuery("#acx_fsmi_purchased_licence").val('');
|
4032 |
+
jQuery(".acx_fsmi_pu_li_error").html('');
|
4033 |
+
jQuery(".acx_fsmi_add_p_licence_light_cvr").fadeOut();
|
4034 |
+
});
|
4035 |
+
jQuery(".acx_fsmi_add_p_li_cls").click(function()
|
4036 |
+
{
|
4037 |
+
var acx_fsmi_purchased_licence = jQuery("#acx_fsmi_purchased_licence").val();
|
4038 |
+
if(acx_fsmi_purchased_licence == "")
|
4039 |
+
{
|
4040 |
+
jQuery(".acx_fsmi_pu_li_error").html('<?php _e('Invalid Licence Code','floating-social-media-icon');?>');
|
4041 |
+
return false;
|
4042 |
+
}
|
4043 |
+
|
4044 |
+
jQuery(".acx_fsmi_pu_li_error").html('');
|
4045 |
+
var acx_load = '<div id="acx_fsmip_loading_1"><div class="load_1"></div></div>';
|
4046 |
+
jQuery('.acx_fsmi_add_p_licence_light_cvr').append(acx_load);
|
4047 |
+
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
|
4048 |
+
var acx_fsmip_order = '&acx_fsmi_purchased_licence='+acx_fsmi_purchased_licence+'&action=acx_fsmi_purchased_licence_add'+'&acx_fsmi_purchased_licence_w_c_n=<?php echo wp_create_nonce('acx_fsmi_purchased_licence_w_c_n'); ?>';
|
4049 |
+
jQuery.post(ajaxurl, acx_fsmip_order, function(theResponse)
|
4050 |
+
{
|
4051 |
+
jQuery("#acx_fsmip_loading_1").remove();
|
4052 |
+
if(theResponse == "success")
|
4053 |
+
{
|
4054 |
+
alert('<?php _e('Successfully Added !!','floating-social-media-icon');?>');
|
4055 |
+
var link = window.location.href;
|
4056 |
+
if(link !== '')
|
4057 |
+
{
|
4058 |
+
window.location=link;
|
4059 |
+
}
|
4060 |
+
}
|
4061 |
+
|
4062 |
+
else
|
4063 |
+
{
|
4064 |
+
alert(theResponse);
|
4065 |
+
jQuery("#acx_fsmi_purchased_licence").val('');
|
4066 |
+
jQuery(".acx_fsmi_add_p_licence_light_cvr").fadeOut();
|
4067 |
+
}
|
4068 |
+
});
|
4069 |
+
|
4070 |
+
|
4071 |
+
});
|
4072 |
+
</script>
|
4073 |
+
<?php
|
4074 |
+
|
4075 |
+
}
|
4076 |
+
add_action("acx_fsmi_addon_hook_option_field_content","acx_fsmi_licence_btn_fn",30);
|
4077 |
+
function acx_fsmi_li_add_script()
|
4078 |
+
{?>
|
4079 |
+
<script>
|
4080 |
+
jQuery(".acx_fsmi_install_ignore").click(function()
|
4081 |
+
{
|
4082 |
+
var acx_to_ignore = jQuery(this).parent().parent().parent().find("em").html();
|
4083 |
+
var acx_load = '<div id="acx_fsmip_loading_1"><div class="load_1"></div></div>';
|
4084 |
+
jQuery('body').append(acx_load);
|
4085 |
+
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
|
4086 |
+
var acx_fsmip_order = '&acx_to_ignore='+acx_to_ignore+'&action=acx_fsmi_ignore_activation_message'+'&acx_fsmi_ignore_activation_message_w_c_n=<?php echo wp_create_nonce('acx_fsmi_ignore_activation_message_w_c_n'); ?>';
|
4087 |
+
jQuery.post(ajaxurl, acx_fsmip_order, function(theResponse)
|
4088 |
+
{
|
4089 |
+
jQuery("#acx_fsmip_loading_1").remove();
|
4090 |
+
if(theResponse == "success")
|
4091 |
+
{
|
4092 |
+
alert('<?php _e('Successfully Ignored the message box !!','floating-social-media-icon');?>');
|
4093 |
+
var link = window.location.href;
|
4094 |
+
if(link !== '')
|
4095 |
+
{
|
4096 |
+
window.location=link;
|
4097 |
+
}
|
4098 |
+
}
|
4099 |
+
else
|
4100 |
+
{
|
4101 |
+
alert('<?php _e('Something went wrong.. Try again !!','floating-social-media-icon');?>');
|
4102 |
+
}
|
4103 |
+
});
|
4104 |
+
|
4105 |
+
});
|
4106 |
+
jQuery(".acx_fsmi_lic_del").click(function()
|
4107 |
+
{
|
4108 |
+
var acx_confirm = confirm("<?php _e('Are you sure to delete this license?','floating-social-media-icon')?>");
|
4109 |
+
if(acx_confirm == true)
|
4110 |
+
{
|
4111 |
+
var key_to_del = jQuery(this).parent().attr("data-key");
|
4112 |
+
var li_to_del = jQuery(this).parent().attr("data-licence");
|
4113 |
+
var acx_load = '<div id="acx_fsmip_loading_1"><div class="load_1"></div></div>';
|
4114 |
+
jQuery('body').append(acx_load);
|
4115 |
+
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
|
4116 |
+
var acx_fsmip_del_order = '&key_to_del='+key_to_del+'&li_to_del='+li_to_del+'&action=acx_fsmi_install_licence_del'+'&acx_fsmi_install_licence_del_w_c_n=<?php echo wp_create_nonce('acx_fsmi_install_licence_del_w_c_n'); ?>';
|
4117 |
+
jQuery.post(ajaxurl, acx_fsmip_del_order, function(theResponse)
|
4118 |
+
{
|
4119 |
+
jQuery("#acx_fsmip_loading_1").remove();
|
4120 |
+
if(theResponse == "success")
|
4121 |
+
{
|
4122 |
+
alert('<?php _e('Successfully deleted the licence !!','floating-social-media-icon');?>');
|
4123 |
+
var link = window.location.href;
|
4124 |
+
if(link !== '')
|
4125 |
+
{
|
4126 |
+
window.location=link;
|
4127 |
+
}
|
4128 |
+
}
|
4129 |
+
});
|
4130 |
+
}
|
4131 |
+
});
|
4132 |
+
// refresh
|
4133 |
+
jQuery(".acx_fsmi_lic_refresh").click(function()
|
4134 |
+
{
|
4135 |
+
var acx_confirm = confirm("<?php _e('Are you sure to refresh this license?','floating-social-media-icon')?>");
|
4136 |
+
if(acx_confirm == true)
|
4137 |
+
{
|
4138 |
+
var key = jQuery(this).parent().attr("data-key");
|
4139 |
+
var licence = jQuery(this).parent().attr("data-licence");
|
4140 |
+
var acx_load = '<div id="acx_fsmip_loading_1"><div class="load_1"></div></div>';
|
4141 |
+
jQuery('body').append(acx_load);
|
4142 |
+
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
|
4143 |
+
var acx_fsmip_refresh_order = '&key='+key+'&licence='+licence+'&action=acx_fsmi_install_licence_refresh'+'&acx_fsmi_install_licence_refresh_w_c_n=<?php echo wp_create_nonce('acx_fsmi_install_licence_refresh_w_c_n'); ?>';
|
4144 |
+
jQuery.post(ajaxurl, acx_fsmip_refresh_order, function(theResponse)
|
4145 |
+
{
|
4146 |
+
jQuery("#acx_fsmip_loading_1").remove();
|
4147 |
+
if(theResponse == "success")
|
4148 |
+
{
|
4149 |
+
alert('<?php _e('Successfully reissued the licence !!','floating-social-media-icon');?>');
|
4150 |
+
var link = window.location.href;
|
4151 |
+
if(link !== '')
|
4152 |
+
{
|
4153 |
+
window.location=link;
|
4154 |
+
}
|
4155 |
+
}
|
4156 |
+
});
|
4157 |
+
}
|
4158 |
+
});
|
4159 |
+
</script>
|
4160 |
+
<?php
|
4161 |
+
}
|
4162 |
+
add_action("acx_fsmi_addon_hook_option_footer","acx_fsmi_li_add_script");
|
4163 |
+
// delete installed licence
|
4164 |
+
function acx_fsmi_install_licence_del_callback()
|
4165 |
+
{
|
4166 |
+
if (!isset($_POST['acx_fsmi_install_licence_del_w_c_n'])) die("<br><br>".__('Unknown Error Occurred, Try Again... ','floating-social-media-icon')."<a href=''>".__('Click Here','floating-social-media-icon')."</a>");
|
4167 |
+
if (!wp_verify_nonce($_POST['acx_fsmi_install_licence_del_w_c_n'],'acx_fsmi_install_licence_del_w_c_n')) die("<br><br>".__('Unknown Error Occurred, Try Again... ','floating-social-media-icon')."<a href=''>".__('Click Here','floating-social-media-icon')."</a>");
|
4168 |
+
$key_to_del = $li_to_del = $id_to_del = "";
|
4169 |
+
$response_stat = "failed";
|
4170 |
+
if(ISSET($_POST['key_to_del']))
|
4171 |
+
{
|
4172 |
+
$key_to_del = $_POST['key_to_del'];
|
4173 |
+
}
|
4174 |
+
if(ISSET($_POST['li_to_del']))
|
4175 |
+
{
|
4176 |
+
$li_to_del = $_POST['li_to_del'];
|
4177 |
+
}
|
4178 |
+
|
4179 |
+
$acx_fsmip_licence_array = get_option('acx_fsmip_licence_array');
|
4180 |
+
if(is_serialized($acx_fsmip_licence_array))
|
4181 |
+
{
|
4182 |
+
$acx_fsmip_licence_array = unserialize($acx_fsmip_licence_array);
|
4183 |
+
}
|
4184 |
+
if($acx_fsmip_licence_array == "")
|
4185 |
+
{
|
4186 |
+
$acx_fsmip_licence_array = array();
|
4187 |
+
}
|
4188 |
+
if(!is_array($acx_fsmip_licence_array))
|
4189 |
+
{
|
4190 |
+
$acx_fsmip_licence_array = array();
|
4191 |
+
}
|
4192 |
+
$del_stat = false;
|
4193 |
+
foreach($acx_fsmip_licence_array as $key => $value)
|
4194 |
+
{
|
4195 |
+
if($key == $key_to_del && $value['licence_code'] == $li_to_del )
|
4196 |
+
{
|
4197 |
+
unset($acx_fsmip_licence_array[$key]);
|
4198 |
+
acx_fsmi_delete_purchased_li($value['licence_code']);
|
4199 |
+
$response_stat = "success";
|
4200 |
+
}
|
4201 |
+
}
|
4202 |
+
|
4203 |
+
if(!is_serialized($acx_fsmip_licence_array))
|
4204 |
+
{
|
4205 |
+
$acx_fsmip_licence_array = serialize($acx_fsmip_licence_array);
|
4206 |
+
}
|
4207 |
+
update_option('acx_fsmip_licence_array',$acx_fsmip_licence_array);
|
4208 |
+
|
4209 |
+
|
4210 |
+
echo $response_stat;
|
4211 |
+
|
4212 |
+
die();
|
4213 |
+
}
|
4214 |
+
add_action("wp_ajax_acx_fsmi_install_licence_del","acx_fsmi_install_licence_del_callback");
|
4215 |
+
function acx_fsmi_delete_purchased_li($licence_code)
|
4216 |
+
{
|
4217 |
+
$acx_fsmi_purchased_li_array = get_option('acx_fsmi_purchased_li_array');
|
4218 |
+
if(is_serialized($acx_fsmi_purchased_li_array))
|
4219 |
+
{
|
4220 |
+
$acx_fsmi_purchased_li_array = unserialize($acx_fsmi_purchased_li_array);
|
4221 |
+
}
|
4222 |
+
if($acx_fsmi_purchased_li_array == "" || !is_array($acx_fsmi_purchased_li_array))
|
4223 |
+
{
|
4224 |
+
$acx_fsmi_purchased_li_array = array();
|
4225 |
+
}
|
4226 |
+
if($licence_code != "")
|
4227 |
+
{
|
4228 |
+
foreach($acx_fsmi_purchased_li_array as $pkey => $pvalue)
|
4229 |
+
{
|
4230 |
+
if($pkey == $licence_code)
|
4231 |
+
{
|
4232 |
+
unset($acx_fsmi_purchased_li_array[$pkey]);
|
4233 |
+
}
|
4234 |
+
}
|
4235 |
+
if(!is_serialized($acx_fsmi_purchased_li_array))
|
4236 |
+
{
|
4237 |
+
$acx_fsmi_purchased_li_array = serialize($acx_fsmi_purchased_li_array);
|
4238 |
+
}
|
4239 |
+
update_option('acx_fsmi_purchased_li_array',$acx_fsmi_purchased_li_array);
|
4240 |
+
|
4241 |
+
|
4242 |
+
}
|
4243 |
+
}
|
4244 |
+
// refresh
|
4245 |
+
function acx_fsmi_install_licence_refresh_callback()
|
4246 |
+
{
|
4247 |
+
$key = $licence = $id = "";
|
4248 |
+
$response_stat = "failed";
|
4249 |
+
if(ISSET($_POST['key']))
|
4250 |
+
{
|
4251 |
+
$key = $_POST['key'];
|
4252 |
+
}
|
4253 |
+
if(ISSET($_POST['licence']))
|
4254 |
+
{
|
4255 |
+
$licence = $_POST['licence'];
|
4256 |
+
}
|
4257 |
+
$result = check_acx_pfsmi_license($licence,'',true,$id);
|
4258 |
+
if(ISSET($result["localkey"]))
|
4259 |
+
{
|
4260 |
+
$local_key = $result["localkey"];
|
4261 |
+
}
|
4262 |
+
else{
|
4263 |
+
$local_key = "";
|
4264 |
+
}
|
4265 |
+
$acx_fsmip_licence_array = get_option('acx_fsmip_licence_array');
|
4266 |
+
if(is_serialized($acx_fsmip_licence_array))
|
4267 |
+
{
|
4268 |
+
$acx_fsmip_licence_array = unserialize($acx_fsmip_licence_array);
|
4269 |
+
}
|
4270 |
+
if($acx_fsmip_licence_array == "" || !is_array($acx_fsmip_licence_array))
|
4271 |
+
{
|
4272 |
+
$acx_fsmip_licence_array = array();
|
4273 |
+
}
|
4274 |
+
$acx_fsmi_purchased_li_array = get_option('acx_fsmi_purchased_li_array');
|
4275 |
+
if(is_serialized($acx_fsmi_purchased_li_array))
|
4276 |
+
{
|
4277 |
+
$acx_fsmi_purchased_li_array = unserialize($acx_fsmi_purchased_li_array);
|
4278 |
+
}
|
4279 |
+
if($acx_fsmi_purchased_li_array == "" || !is_array($acx_fsmi_purchased_li_array))
|
4280 |
+
{
|
4281 |
+
$acx_fsmi_purchased_li_array = array();
|
4282 |
+
}
|
4283 |
+
if(ISSET($result["status"]))
|
4284 |
+
{
|
4285 |
+
if($result["status"] == 'Active')
|
4286 |
+
{
|
4287 |
+
if(ISSET($acx_fsmip_licence_array[$key]))
|
4288 |
+
{
|
4289 |
+
if(array_key_exists('local_key',$acx_fsmip_licence_array[$key]))
|
4290 |
+
{
|
4291 |
+
$acx_fsmip_licence_array[$key]['local_key'] = $local_key;
|
4292 |
+
|
4293 |
+
if(!is_serialized($acx_fsmip_licence_array))
|
4294 |
+
{
|
4295 |
+
$acx_fsmip_licence_array = serialize($acx_fsmip_licence_array);
|
4296 |
+
}
|
4297 |
+
update_option('acx_fsmip_licence_array',$acx_fsmip_licence_array);
|
4298 |
+
|
4299 |
+
}
|
4300 |
+
}
|
4301 |
+
|
4302 |
+
}
|
4303 |
+
$acx_fsmi_purchased_li_array[$licence]['status'] = $result['status'];
|
4304 |
+
if(!is_serialized($acx_fsmi_purchased_li_array))
|
4305 |
+
{
|
4306 |
+
$acx_fsmi_purchased_li_array = serialize($acx_fsmi_purchased_li_array);
|
4307 |
+
}
|
4308 |
+
update_option('acx_fsmi_purchased_li_array',$acx_fsmi_purchased_li_array);
|
4309 |
+
$response_stat = "success";
|
4310 |
+
}
|
4311 |
+
echo $response_stat;
|
4312 |
+
die();
|
4313 |
+
}
|
4314 |
+
add_action("wp_ajax_acx_fsmi_install_licence_refresh","acx_fsmi_install_licence_refresh_callback");
|
4315 |
+
if(!function_exists('check_acx_pfsmi_license'))
|
4316 |
+
{
|
4317 |
+
|
4318 |
+
|
4319 |
+
}
|
4320 |
+
// ignore plugin activation callback
|
4321 |
+
function acx_fsmi_ignore_activation_message_callback()
|
4322 |
+
{
|
4323 |
+
if (!isset($_POST['acx_fsmi_ignore_activation_message_w_c_n'])) die("<br><br>".__('Unknown Error Occurred, Try Again... ','floating-social-media-icon')."<a href=''>".__('Click Here','floating-social-media-icon')."</a>");
|
4324 |
+
if (!wp_verify_nonce($_POST['acx_fsmi_ignore_activation_message_w_c_n'],'acx_fsmi_ignore_activation_message_w_c_n')) die("<br><br>".__('Unknown Error Occurred, Try Again... ','floating-social-media-icon')."<a href=''>".__('Click Here','floating-social-media-icon')."</a>");
|
4325 |
+
$acx_to_ignore = "";
|
4326 |
+
$response_stat = "failed";
|
4327 |
+
if(ISSET($_POST['acx_to_ignore']))
|
4328 |
+
{
|
4329 |
+
$acx_to_ignore = $_POST['acx_to_ignore'];
|
4330 |
+
}
|
4331 |
+
$acx_fsmi_purchased_li_array = get_option('acx_fsmi_purchased_li_array');
|
4332 |
+
if(is_serialized($acx_fsmi_purchased_li_array))
|
4333 |
+
{
|
4334 |
+
$acx_fsmi_purchased_li_array = unserialize($acx_fsmi_purchased_li_array);
|
4335 |
+
}
|
4336 |
+
if($acx_fsmi_purchased_li_array == "" || !is_array($acx_fsmi_purchased_li_array))
|
4337 |
+
{
|
4338 |
+
$acx_fsmi_purchased_li_array = array();
|
4339 |
+
}
|
4340 |
+
foreach($acx_fsmi_purchased_li_array as $key => $value)
|
4341 |
+
{
|
4342 |
+
if($value['name'] == $acx_to_ignore)
|
4343 |
+
{
|
4344 |
+
$acx_fsmi_purchased_li_array[$key]['ignore_stat'] = "yes";
|
4345 |
+
$response_stat = "success";
|
4346 |
+
}
|
4347 |
+
}
|
4348 |
+
if(!is_serialized($acx_fsmi_purchased_li_array))
|
4349 |
+
{
|
4350 |
+
$acx_fsmi_purchased_li_array = serialize($acx_fsmi_purchased_li_array);
|
4351 |
+
}
|
4352 |
+
update_option('acx_fsmi_purchased_li_array',$acx_fsmi_purchased_li_array);
|
4353 |
+
echo $response_stat;
|
4354 |
+
|
4355 |
+
die();
|
4356 |
+
}
|
4357 |
+
add_action("wp_ajax_acx_fsmi_ignore_activation_message","acx_fsmi_ignore_activation_message_callback");
|
4358 |
+
|
4359 |
+
// add purchased licence callback
|
4360 |
+
function acx_fsmi_purchased_licence_add_callback()
|
4361 |
+
{
|
4362 |
+
if (!isset($_POST['acx_fsmi_purchased_licence_w_c_n'])) die("<br><br>".__('Unknown Error Occurred, Try Again... ','floating-social-media-icon')."<a href=''>".__('Click Here','floating-social-media-icon')."</a>");
|
4363 |
+
if (!wp_verify_nonce($_POST['acx_fsmi_purchased_licence_w_c_n'],'acx_fsmi_purchased_licence_w_c_n')) die("<br><br>".__('Unknown Error Occurred, Try Again... ','floating-social-media-icon')."<a href=''>".__('Click Here','floating-social-media-icon')."</a>");
|
4364 |
+
$acx_fsmi_purchased_licence = "";
|
4365 |
+
if(ISSET($_POST['acx_fsmi_purchased_licence']))
|
4366 |
+
{
|
4367 |
+
$acx_fsmi_purchased_licence = trim($_POST['acx_fsmi_purchased_licence']);
|
4368 |
+
}
|
4369 |
+
$acx_fsmip_licence_array = get_option('acx_fsmip_licence_array');
|
4370 |
+
if(is_serialized($acx_fsmip_licence_array))
|
4371 |
+
{
|
4372 |
+
$acx_fsmip_licence_array = unserialize($acx_fsmip_licence_array);
|
4373 |
+
}
|
4374 |
+
if($acx_fsmi_purchased_licence != "")
|
4375 |
+
{
|
4376 |
+
if (strpos($acx_fsmi_purchased_licence, 'ACX-FSMI') !== false || strpos($acx_fsmi_purchased_licence, 'FSMI-PA') !== false)
|
4377 |
+
{
|
4378 |
+
$licence_code_arr = explode('-',$acx_fsmi_purchased_licence);
|
4379 |
+
if(is_array($licence_code_arr))
|
4380 |
+
{
|
4381 |
+
if(ISSET($licence_code_arr[0]) && ISSET($licence_code_arr[1]))
|
4382 |
+
{
|
4383 |
+
$acx_fsmip_index = $licence_code_arr[0].'_'.$licence_code_arr[1];
|
4384 |
+
}
|
4385 |
+
else{
|
4386 |
+
$acx_fsmip_index = '';
|
4387 |
+
}
|
4388 |
+
}
|
4389 |
+
else{
|
4390 |
+
$acx_fsmip_index = '';
|
4391 |
+
}
|
4392 |
+
|
4393 |
+
|
4394 |
+
$acx_fsmi_ip = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
|
4395 |
+
$acx_fsmi_domain = $_SERVER['SERVER_NAME'];
|
4396 |
+
$acx_fsmi_directory = dirname(__FILE__);
|
4397 |
+
$acx_fsmi_args = array(
|
4398 |
+
'action' => 'acx-li-check-latest-version',
|
4399 |
+
'method' => 'addon_activation',
|
4400 |
+
'directory' => $acx_fsmi_directory,
|
4401 |
+
'unique_id' => $acx_fsmip_index,
|
4402 |
+
'domain' => $acx_fsmi_domain,
|
4403 |
+
'ip' => $acx_fsmi_ip,
|
4404 |
+
'licence' => $acx_fsmi_purchased_licence
|
4405 |
+
);
|
4406 |
+
$acx_fsmi_unique_id = "";
|
4407 |
+
// Send request checking for an update
|
4408 |
+
$response = acx_fsmi_licence_activation_api_request( $acx_fsmi_args );
|
4409 |
+
$response = json_decode($response, true);
|
4410 |
+
if($response['response_status'] == "success" && $response['status'] == "Active")
|
4411 |
+
{
|
4412 |
+
$acx_fsmi_purchased_li_array = get_option('acx_fsmi_purchased_li_array');
|
4413 |
+
if(is_serialized($acx_fsmi_purchased_li_array))
|
4414 |
+
{
|
4415 |
+
$acx_fsmi_purchased_li_array = unserialize($acx_fsmi_purchased_li_array);
|
4416 |
+
}
|
4417 |
+
if($acx_fsmi_purchased_li_array == "" || !is_array($acx_fsmi_purchased_li_array))
|
4418 |
+
{
|
4419 |
+
$acx_fsmi_purchased_li_array = array();
|
4420 |
+
}
|
4421 |
+
$acx_fsmi_unique_id = trim($response['unique_id']);
|
4422 |
+
$acx_fsmi_purchased_li_array[$acx_fsmi_purchased_licence] = array(
|
4423 |
+
'slug' => $response['slug'],
|
4424 |
+
'status' => $response['status'],
|
4425 |
+
'download_dynamic_url' => $response['download_dynamic_url'],
|
4426 |
+
'ignore_stat' => $response['ignore_stat']
|
4427 |
+
);
|
4428 |
+
// update licence array
|
4429 |
+
|
4430 |
+
$acx_fsmip_licence_array[$acx_fsmi_unique_id]['addon_name'] = $response['name'];
|
4431 |
+
$acx_fsmip_licence_array[$acx_fsmi_unique_id]['version'] = $response['new_version'];
|
4432 |
+
$acx_fsmip_licence_array[$acx_fsmi_unique_id]['licence_code'] = $acx_fsmi_purchased_licence;
|
4433 |
+
$acx_fsmip_licence_array[$acx_fsmi_unique_id]['local_key'] = $response['localkey'];
|
4434 |
+
if(!is_serialized($acx_fsmip_licence_array))
|
4435 |
+
{
|
4436 |
+
$acx_fsmip_licence_array = serialize($acx_fsmip_licence_array);
|
4437 |
+
}
|
4438 |
+
update_option('acx_fsmip_licence_array',$acx_fsmip_licence_array);
|
4439 |
+
if(!is_serialized($acx_fsmi_purchased_li_array))
|
4440 |
+
{
|
4441 |
+
$acx_fsmi_purchased_li_array = serialize($acx_fsmi_purchased_li_array);
|
4442 |
+
}
|
4443 |
+
update_option('acx_fsmi_purchased_li_array',$acx_fsmi_purchased_li_array);
|
4444 |
+
echo "success";
|
4445 |
+
}
|
4446 |
+
else
|
4447 |
+
{
|
4448 |
+
echo __("Your Licence is ","floating-social-media-icon").$response['status'].__(" Please contact your admin","floating-social-media-icon");
|
4449 |
+
}
|
4450 |
+
}
|
4451 |
+
else
|
4452 |
+
{
|
4453 |
+
echo __("Sorry, Your license code is invalid, Please contact support","floating-social-media-icon");
|
4454 |
+
}
|
4455 |
+
}
|
4456 |
+
else
|
4457 |
+
{
|
4458 |
+
echo __("Invalid Licence Code","floating-social-media-icon");
|
4459 |
+
}
|
4460 |
+
die();
|
4461 |
+
}
|
4462 |
+
add_action("wp_ajax_acx_fsmi_purchased_licence_add","acx_fsmi_purchased_licence_add_callback");
|
4463 |
+
|
4464 |
+
function acx_fsmi_licence_activation_api_request($args)
|
4465 |
+
{
|
4466 |
+
// Send request
|
4467 |
+
$request = wp_remote_post( 'http://updates.acurax.com/licence_activation.php',array( 'body' => $args ) );
|
4468 |
+
if ( is_wp_error( $request ) || 200 != wp_remote_retrieve_response_code( $request ) )
|
4469 |
+
return false;
|
4470 |
+
$response = wp_remote_retrieve_body( $request ) ;
|
4471 |
+
return $response;
|
4472 |
+
}
|
4473 |
+
?>
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
acx_fsmi_hook_function('acx_fsmi_addon_hook_option_page_head');
|
3 |
+
acx_fsmi_hook_function('acx_fsmi_addon_hook_option_page');
|
4 |
+
?>
|
@@ -234,4 +234,28 @@ acx_fsmi_hook_function('acx_fsmi_exprt_hook_option_above_page_left');
|
|
234 |
echo "</div> <!-- acx_fsmi_option_page_holder --> \n";
|
235 |
}
|
236 |
add_action('acx_fsmi_exprt_hook_option_sidebar','acx_fsmi_exprt_option_sidebar_end',500);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
?>
|
234 |
echo "</div> <!-- acx_fsmi_option_page_holder --> \n";
|
235 |
}
|
236 |
add_action('acx_fsmi_exprt_hook_option_sidebar','acx_fsmi_exprt_option_sidebar_end',500);
|
237 |
+
|
238 |
+
/*********************************************** Addons Page *************************************************/
|
239 |
+
function acx_fsmi_addon_option_div_start()
|
240 |
+
{
|
241 |
+
echo "<div id=\"acx_fsmi_option_page_holder\" class=\"acx_fsmi_option_page_hold_cvr\"> \n";
|
242 |
+
acx_fsmi_hook_function('acx_fsmi_addon_hook_option_above_page_cvr');
|
243 |
+
echo "<div class=\"acx_fsmi_addon_option_page_cvr\"> \n";
|
244 |
+
} add_action('acx_fsmi_addon_hook_option_page_head','acx_fsmi_addon_option_div_start',30);
|
245 |
+
function acx_fsmi_addon_hook_heading()
|
246 |
+
{
|
247 |
+
$acx_string = __("Acurax Social Icons - Available Addons","floating-social-media-icon");
|
248 |
+
echo print_acx_fsmi_option_heading($acx_string);
|
249 |
+
}
|
250 |
+
add_action("acx_fsmi_addon_hook_option_above_page_cvr","acx_fsmi_addon_hook_heading");
|
251 |
+
function acx_fsmi_addon_option_sidebar_start()
|
252 |
+
{
|
253 |
+
acx_fsmi_hook_function('acx_fsmi_addon_hook_option_field_content');
|
254 |
+
echo "</div> <!-- acx_fsmi_addon_option_page_cvr --> \n";
|
255 |
+
} add_action('acx_fsmi_addon_hook_option_page','acx_fsmi_addon_option_sidebar_start',10);
|
256 |
+
function acx_fsmi_addon_option_sidebar_end()
|
257 |
+
{
|
258 |
+
acx_fsmi_hook_function('acx_fsmi_addon_hook_option_footer');
|
259 |
+
echo "</div> <!-- acx_fsmi_option_page_holder --> \n";
|
260 |
+
} add_action('acx_fsmi_addon_hook_option_page','acx_fsmi_addon_option_sidebar_end',500);
|
261 |
?>
|
@@ -136,4 +136,26 @@ function acx_fsmi_exprt_hook_option_form_head()
|
|
136 |
{
|
137 |
do_action('acx_fsmi_exprt_hook_option_form_head');
|
138 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
?>
|
136 |
{
|
137 |
do_action('acx_fsmi_exprt_hook_option_form_head');
|
138 |
}
|
139 |
+
/* Addon Page */
|
140 |
+
|
141 |
+
function acx_fsmi_addon_hook_option_page_head()
|
142 |
+
{
|
143 |
+
do_action('acx_fsmi_addon_hook_option_page_head');
|
144 |
+
}
|
145 |
+
function acx_fsmi_addon_hook_option_above_page_cvr()
|
146 |
+
{
|
147 |
+
do_action('acx_fsmi_addon_hook_option_above_page_cvr');
|
148 |
+
}
|
149 |
+
function acx_fsmi_addon_hook_option_page()
|
150 |
+
{
|
151 |
+
do_action('acx_fsmi_addon_hook_option_page');
|
152 |
+
}
|
153 |
+
function acx_fsmi_addon_hook_option_footer()
|
154 |
+
{
|
155 |
+
do_action('acx_fsmi_addon_hook_option_footer');
|
156 |
+
}
|
157 |
+
function acx_fsmi_addon_hook_option_field_content()
|
158 |
+
{
|
159 |
+
do_action('acx_fsmi_addon_hook_option_field_content');
|
160 |
+
}
|
161 |
?>
|
@@ -1138,4 +1138,35 @@ function acx_fsmi_expert_down_note_html()
|
|
1138 |
}
|
1139 |
add_action('acx_fsmi_exprt_hook_option_above_page_left','acx_fsmi_expert_down_note_html',400);
|
1140 |
/* Troubleshooter page options Ends Here*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1141 |
?>
|
1138 |
}
|
1139 |
add_action('acx_fsmi_exprt_hook_option_above_page_left','acx_fsmi_expert_down_note_html',400);
|
1140 |
/* Troubleshooter page options Ends Here*/
|
1141 |
+
/* Addon Page */
|
1142 |
+
function acx_fsmi_addon_list_section()
|
1143 |
+
{
|
1144 |
+
$fsmi_addons_intro = array();
|
1145 |
+
$fsmi_addons_intro[] = array(
|
1146 |
+
'name' => __('Social Media Icon - Power Addon','floating-social-media-icon'),
|
1147 |
+
'img' => plugins_url('/images/power_addon.jpg',dirname(__FILE__)),
|
1148 |
+
'desc' => __('This addon is packed with more sharp quality icons and can upload any number of icons.Social Media Function Option allows you to set the icon as share icons or profile linking icons,it also adds option in page and posts, while editing to define Social Media Meta Tags. Share icons can also be integrated automatically to page/post.','floating-social-media-icon'),
|
1149 |
+
'url' => 'http://www.acurax.com/products/floating-social-media-icon-wordpress-plugin/?feature=fsmi_power&utm_source=fsmi&utm_medium=addon-page',
|
1150 |
+
'button' => __('View Details','floating-social-media-icon')
|
1151 |
+
);
|
1152 |
+
?>
|
1153 |
+
<div id="fsmi_addons_intro_holder">
|
1154 |
+
<?php
|
1155 |
+
foreach($fsmi_addons_intro as $key => $value)
|
1156 |
+
{
|
1157 |
+
?>
|
1158 |
+
<div class="fsmi_addons_intro" onclick="window.open('<?php echo $value['url']; ?>'); return false;">
|
1159 |
+
<img src="<?php echo $value['img']; ?>">
|
1160 |
+
<h3><?php echo $value['name']; ?></h3>
|
1161 |
+
<p>
|
1162 |
+
<?php echo $value['desc']; ?>
|
1163 |
+
</p>
|
1164 |
+
<a class="fsmi_addon_button" href="<?php echo $value['url']; ?>" target="_blank"><?php echo $value['button']; ?></a>
|
1165 |
+
</div> <!-- fsmi_addons_intro -->
|
1166 |
+
<?php } ?>
|
1167 |
+
</div> <!-- fsmi_addons_intro_holder -->
|
1168 |
+
<?php
|
1169 |
+
}
|
1170 |
+
add_action("acx_fsmi_addon_hook_option_field_content","acx_fsmi_addon_list_section",10);
|
1171 |
+
/* Addon Page */
|
1172 |
?>
|
@@ -212,6 +212,11 @@ Have more questions ? [Drop a mail](http://www.acurax.com/contact.php/ "Drop an
|
|
212 |
|
213 |
== Upgrade Notice ==
|
214 |
|
|
|
|
|
|
|
|
|
|
|
215 |
= Social Media Floating Icons - 4.1.4 =
|
216 |
* Fix - Perfomance Improvements
|
217 |
|
@@ -420,6 +425,11 @@ Have more questions ? [Drop a mail](http://www.acurax.com/contact.php/ "Drop an
|
|
420 |
|
421 |
== Changelog ==
|
422 |
|
|
|
|
|
|
|
|
|
|
|
423 |
= Social Media Floating Icons - 4.1.4 =
|
424 |
* Fix - Perfomance Improvements
|
425 |
|
212 |
|
213 |
== Upgrade Notice ==
|
214 |
|
215 |
+
= Social Media Floating Icons - 4.2 =
|
216 |
+
* Fix - Perfomance Improvements
|
217 |
+
* Fix - Update Bug Fixes
|
218 |
+
* New Feature - Easy Option to Install Addons
|
219 |
+
|
220 |
= Social Media Floating Icons - 4.1.4 =
|
221 |
* Fix - Perfomance Improvements
|
222 |
|
425 |
|
426 |
== Changelog ==
|
427 |
|
428 |
+
= Social Media Floating Icons - 4.2 =
|
429 |
+
* Fix - Perfomance Improvements
|
430 |
+
* Fix - Update Bug Fixes
|
431 |
+
* New Feature - Easy Option to Install Addons
|
432 |
+
|
433 |
= Social Media Floating Icons - 4.1.4 =
|
434 |
* Fix - Perfomance Improvements
|
435 |
|