| 1 |
<?php |
| 2 |
/** |
| 3 |
* MainWP Extension Page |
| 4 |
* |
| 5 |
* @package MainWP/Dashboard |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace MainWP\Dashboard; |
| 9 |
|
| 10 |
/** |
| 11 |
* Class MainWP_Extensions |
| 12 |
*/ |
| 13 |
class MainWP_Extensions { |
| 14 |
|
| 15 |
/** |
| 16 |
* Method get_class_name() |
| 17 |
* |
| 18 |
* Get Class Name. |
| 19 |
* |
| 20 |
* @return object Class name. |
| 21 |
*/ |
| 22 |
public static function get_class_name() { |
| 23 |
return __CLASS__; |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Instantiate action hooks. |
| 28 |
* |
| 29 |
* @uses \MainWP\Dashboard\MainWP_Extensions_Handler::get_class_name() |
| 30 |
*/ |
| 31 |
public static function init() { |
| 32 |
/** |
| 33 |
* This hook allows you to render the Extensions page header via the 'mainwp-pageheader-extensions' action. |
| 34 |
* |
| 35 |
* @link http://codex.mainwp.com/#mainwp-pageheader-extensions |
| 36 |
* |
| 37 |
* @see \MainWP_Extensions::render_header |
| 38 |
*/ |
| 39 |
add_action( 'mainwp-pageheader-extensions', array( self::get_class_name(), 'render_header' ) ); // @deprecated Use 'mainwp_pageheader_extensions' instead. |
| 40 |
add_action( 'mainwp_pageheader_extensions', array( self::get_class_name(), 'render_header' ) ); |
| 41 |
|
| 42 |
/** |
| 43 |
* This hook allows you to render the Extensions page footer via the 'mainwp-pagefooter-extensions' action. |
| 44 |
* |
| 45 |
* @link http://codex.mainwp.com/#mainwp-pagefooter-extensions |
| 46 |
* |
| 47 |
* @see \MainWP_Extensions::render_footer |
| 48 |
*/ |
| 49 |
add_action( 'mainwp-pagefooter-extensions', array( self::get_class_name(), 'render_footer' ) ); // @deprecated Use 'mainwp_pagefooter_extensions' instead. |
| 50 |
add_action( 'mainwp_pagefooter_extensions', array( self::get_class_name(), 'render_footer' ) ); |
| 51 |
|
| 52 |
add_action( 'mainwp_help_sidebar_content', array( self::get_class_name(), 'mainwp_help_content' ) ); |
| 53 |
|
| 54 |
add_filter( 'mainwp-extensions-apigeneratepassword', array( MainWP_Extensions_Handler::get_class_name(), 'gen_api_password' ), 10, 3 ); |
| 55 |
add_filter( 'mainwp_extensions_apigeneratepassword', array( MainWP_Extensions_Handler::get_class_name(), 'gen_api_password' ), 10, 3 ); |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* Method init_menu() |
| 60 |
* |
| 61 |
* Instantiate Extensions Menu. |
| 62 |
* |
| 63 |
* @uses \MainWP\Dashboard\MainWP_Api_Manager::get_activation_info() |
| 64 |
* @uses \MainWP\Dashboard\MainWP_Extensions_View::init_menu() |
| 65 |
* @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item() |
| 66 |
* @uses \MainWP\Dashboard\MainWP_Extensions_Handler::polish_ext_name() |
| 67 |
* @uses \MainWP\Dashboard\MainWP_Extensions_Handler::added_on_menu() |
| 68 |
* @uses \MainWP\Dashboard\MainWP_Extensions_Handler::get_extensions() |
| 69 |
* @uses \MainWP\Dashboard\MainWP_Utility::update_option() |
| 70 |
*/ |
| 71 |
public static function init_menu() { // phpcs:ignore -- complex function. Current complexity is the only way to achieve desired results, pull request solutions appreciated. |
| 72 |
if ( ! MainWP_Menu::is_disable_menu_item( 2, 'Extensions' ) ) { |
| 73 |
MainWP_Extensions_View::init_menu(); |
| 74 |
} |
| 75 |
|
| 76 |
$save_extensions = array(); |
| 77 |
|
| 78 |
/** |
| 79 |
* Get extensions |
| 80 |
* |
| 81 |
* Adds extension to MainWP system. |
| 82 |
* |
| 83 |
* @since 4.1 |
| 84 |
*/ |
| 85 |
$init_extensions = array(); |
| 86 |
$init_extensions = apply_filters_deprecated( 'mainwp-getextensions', array( $init_extensions ), '4.0.7.2', 'mainwp_getextensions' ); |
| 87 |
$init_extensions = apply_filters( 'mainwp_getextensions', $init_extensions ); |
| 88 |
|
| 89 |
$all_available_extensions = MainWP_Extensions_View::get_available_extensions( 'all' ); |
| 90 |
|
| 91 |
$activations_cached = get_option( 'mainwp_extensions_all_activation_cached', array() ); |
| 92 |
|
| 93 |
if ( ! is_array( $activations_cached ) ) { |
| 94 |
$activations_cached = array(); |
| 95 |
} |
| 96 |
|
| 97 |
$is_cached = ! empty( $activations_cached ) ? true : false; |
| 98 |
|
| 99 |
$extraHeaders = array( |
| 100 |
'IconURI' => 'Icon URI', |
| 101 |
'SupportForumURI' => 'Support Forum URI', |
| 102 |
'DocumentationURI' => 'Documentation URI', |
| 103 |
); |
| 104 |
|
| 105 |
$extsPages = array(); |
| 106 |
|
| 107 |
$compatible_v4_checks = array( |
| 108 |
'advanced-uptime-monitor-extension/advanced-uptime-monitor-extension.php', |
| 109 |
'mainwp-article-uploader-extension/mainwp-article-uploader-extension.php', |
| 110 |
'mainwp-backwpup-extension/mainwp-backwpup-extension.php', |
| 111 |
'boilerplate-extension/boilerplate-extension.php', |
| 112 |
'mainwp-branding-extension/mainwp-branding-extension.php', |
| 113 |
'mainwp-bulk-settings-manager/mainwp-bulk-settings-manager.php', |
| 114 |
'mainwp-clean-and-lock-extension/mainwp-clean-and-lock-extension.php', |
| 115 |
'mainwp-client-reports-extension/mainwp-client-reports-extension.php', |
| 116 |
'mainwp-clone-extension/mainwp-clone-extension.php', |
| 117 |
'mainwp-code-snippets-extension/mainwp-code-snippets-extension.php', |
| 118 |
'mainwp-comments-extension/mainwp-comments-extension.php', |
| 119 |
'mainwp-favorites-extension/mainwp-favorites-extension.php', |
| 120 |
'mainwp-file-uploader-extension/mainwp-file-uploader-extension.php', |
| 121 |
'mainwp-google-analytics-extension/mainwp-google-analytics-extension.php', |
| 122 |
'mainwp-maintenance-extension/mainwp-maintenance-extension.php', |
| 123 |
'mainwp-piwik-extension/mainwp-piwik-extension.php', |
| 124 |
'mainwp-post-dripper-extension/mainwp-post-dripper-extension.php', |
| 125 |
'mainwp-rocket-extension/mainwp-rocket-extension.php', |
| 126 |
'mainwp-sucuri-extension/mainwp-sucuri-extension.php', |
| 127 |
'mainwp-team-control/mainwp-team-control.php', |
| 128 |
'mainwp-updraftplus-extension/mainwp-updraftplus-extension.php', |
| 129 |
'mainwp-url-extractor-extension/mainwp-url-extractor-extension.php', |
| 130 |
'mainwp-woocommerce-shortcuts-extension/mainwp-woocommerce-shortcuts-extension.php', |
| 131 |
'mainwp-woocommerce-status-extension/mainwp-woocommerce-status-extension.php', |
| 132 |
'mainwp-wordfence-extension/mainwp-wordfence-extension.php', |
| 133 |
'wordpress-seo-extension/wordpress-seo-extension.php', |
| 134 |
'mainwp-page-speed-extension/mainwp-page-speed-extension.php', |
| 135 |
'mainwp-ithemes-security-extension/mainwp-ithemes-security-extension.php', |
| 136 |
'mainwp-post-plus-extension/mainwp-post-plus-extension.php', |
| 137 |
'mainwp-staging-extension/mainwp-staging-extension.php', |
| 138 |
'mainwp-custom-post-types/mainwp-custom-post-types.php', |
| 139 |
'mainwp-buddy-extension/mainwp-buddy-extension.php', |
| 140 |
'mainwp-vulnerability-checker-extension/mainwp-vulnerability-checker-extension.php', |
| 141 |
'mainwp-timecapsule-extension/mainwp-timecapsule-extension.php', |
| 142 |
'activity-log-mainwp/activity-log-mainwp.php', |
| 143 |
); |
| 144 |
include_once ABSPATH . '/wp-admin/includes/plugin.php'; |
| 145 |
|
| 146 |
$deactivated_imcompatible = array(); |
| 147 |
foreach ( $init_extensions as $extension ) { |
| 148 |
$slug = plugin_basename( $extension['plugin'] ); |
| 149 |
$plugin_data = get_plugin_data( $extension['plugin'], true, false ); |
| 150 |
$file_data = get_file_data( $extension['plugin'], $extraHeaders ); |
| 151 |
|
| 152 |
if ( ! isset( $plugin_data['Name'] ) || ( '' === $plugin_data['Name'] ) ) { |
| 153 |
continue; |
| 154 |
} |
| 155 |
|
| 156 |
if ( in_array( $slug, $compatible_v4_checks ) ) { |
| 157 |
$check_minver = '3.99999'; |
| 158 |
if ( 'advanced-uptime-monitor-extension/advanced-uptime-monitor-extension.php' === $slug ) { |
| 159 |
$check_minver = '4.6.2'; |
| 160 |
} elseif ( 'activity-log-mainwp/activity-log-mainwp.php' === $slug ) { |
| 161 |
$check_minver = '1.0.5'; |
| 162 |
} |
| 163 |
|
| 164 |
if ( isset( $plugin_data['Version'] ) && version_compare( $plugin_data['Version'], $check_minver, '<' ) ) { |
| 165 |
$deactivated_imcompatible[] = $plugin_data['Name']; |
| 166 |
deactivate_plugins( $slug, true ); |
| 167 |
continue; |
| 168 |
} |
| 169 |
} |
| 170 |
|
| 171 |
$extension['slug'] = $slug; |
| 172 |
|
| 173 |
if ( ! isset( $extension['name'] ) ) { |
| 174 |
$extension['name'] = $plugin_data['Name']; |
| 175 |
} |
| 176 |
$extension['version'] = $plugin_data['Version']; |
| 177 |
$extension['description'] = $plugin_data['Description']; |
| 178 |
$extension['author'] = $plugin_data['Author']; |
| 179 |
$extension['icon'] = isset( $extension['icon'] ) ? trim( $extension['icon'] ) : ''; |
| 180 |
$extension['iconURI'] = $file_data['IconURI']; |
| 181 |
$extension['SupportForumURI'] = $file_data['SupportForumURI']; |
| 182 |
$extension['DocumentationURI'] = $file_data['DocumentationURI']; |
| 183 |
$extension['page'] = 'Extensions-' . str_replace( ' ', '-', ucwords( str_replace( '-', ' ', dirname( $slug ) ) ) ); |
| 184 |
|
| 185 |
if ( isset( $extension['apiManager'] ) && $extension['apiManager'] ) { |
| 186 |
|
| 187 |
$api_slug = dirname( $slug ); |
| 188 |
|
| 189 |
if ( $is_cached ) { |
| 190 |
$options = isset( $activations_cached[ $api_slug ] ) ? $activations_cached[ $api_slug ] : array(); |
| 191 |
} else { |
| 192 |
$options = MainWP_Api_Manager::instance()->get_activation_info( $api_slug ); |
| 193 |
$activations_cached[ $api_slug ] = $options; |
| 194 |
} |
| 195 |
|
| 196 |
if ( ! is_array( $options ) ) { |
| 197 |
$options = array(); |
| 198 |
} |
| 199 |
|
| 200 |
$extension['api_key'] = isset( $options['api_key'] ) ? $options['api_key'] : ''; |
| 201 |
$extension['activated_key'] = isset( $options['activated_key'] ) ? $options['activated_key'] : 'Deactivated'; |
| 202 |
$extension['deactivate_checkbox'] = isset( $options['deactivate_checkbox'] ) ? $options['deactivate_checkbox'] : 'off'; |
| 203 |
$extension['product_id'] = isset( $options['product_id'] ) ? $options['product_id'] : ''; |
| 204 |
$extension['instance_id'] = isset( $options['instance_id'] ) ? $options['instance_id'] : ''; |
| 205 |
$extension['software_version'] = isset( $options['software_version'] ) ? $options['software_version'] : ''; |
| 206 |
$extension['mainwp_version'] = isset( $options['mainwp_version'] ) ? $options['mainwp_version'] : ''; |
| 207 |
|
| 208 |
if ( isset( $options['product_item_id'] ) ) { |
| 209 |
$extension['product_item_id'] = $options['product_item_id']; |
| 210 |
} |
| 211 |
} |
| 212 |
|
| 213 |
$ext_slug = dirname( $slug ); |
| 214 |
if ( isset( $all_available_extensions[ $ext_slug ] ) ) { |
| 215 |
$extension['type'] = $all_available_extensions[ $ext_slug ]['type']; // to fix. |
| 216 |
} |
| 217 |
|
| 218 |
$save_extensions[] = $extension; |
| 219 |
if ( mainwp_current_user_have_right( 'extension', dirname( $slug ) ) ) { |
| 220 |
$callback = isset( $extension['callback'] ) ? $extension['callback'] : ''; |
| 221 |
$menu_name = MainWP_Extensions_Handler::polish_ext_name( $extension ); |
| 222 |
if ( MainWP_Extensions_Handler::added_on_menu( $slug ) ) { |
| 223 |
$_page = add_submenu_page( 'mainwp_tab', $extension['name'], $menu_name, 'read', $extension['page'], $callback ); |
| 224 |
} else { |
| 225 |
$_page = add_submenu_page( 'mainwp_tab', $extension['name'], '<div class="mainwp-hidden">' . $extension['name'] . '</div>', 'read', $extension['page'], $callback ); |
| 226 |
} |
| 227 |
|
| 228 |
if ( isset( $extension['on_load_callback'] ) && ! empty( $extension['on_load_callback'] ) ) { |
| 229 |
add_action( 'load-' . $_page, $extension['on_load_callback'] ); |
| 230 |
} |
| 231 |
|
| 232 |
$_item = array( |
| 233 |
'title' => $menu_name, |
| 234 |
'slug' => $extension['page'], |
| 235 |
'href' => isset( $extension['href'] ) ? $extension['href'] : '', |
| 236 |
); |
| 237 |
|
| 238 |
$extsPages[] = $_item; |
| 239 |
} |
| 240 |
} |
| 241 |
|
| 242 |
if ( ! empty( $deactivated_imcompatible ) ) { |
| 243 |
set_transient( 'mainwp_transient_deactivated_incomtible_exts', $deactivated_imcompatible ); |
| 244 |
} |
| 245 |
|
| 246 |
MainWP_Utility::update_option( 'mainwp_extensions', $save_extensions ); |
| 247 |
MainWP_Extensions_Handler::get_extensions( true ); // forced reload. |
| 248 |
|
| 249 |
if ( ! $is_cached ) { |
| 250 |
update_option( 'mainwp_extensions_all_activation_cached', $activations_cached ); |
| 251 |
} |
| 252 |
self::init_left_menu( $extsPages ); |
| 253 |
} |
| 254 |
|
| 255 |
/** |
| 256 |
* Method init_left_menu() |
| 257 |
* |
| 258 |
* Initiate top level Extensions Menues. |
| 259 |
* |
| 260 |
* @param array $extPages List of extension pages. |
| 261 |
* @uses \MainWP\Dashboard\MainWP_Menu::is_disable_menu_item() |
| 262 |
* @uses \MainWP\Dashboard\MainWP_Menu::add_left_menu() |
| 263 |
* @uses \MainWP\Dashboard\MainWP_Menu::init_subpages_left_menu() |
| 264 |
*/ |
| 265 |
public static function init_left_menu( $extPages ) { |
| 266 |
$subPages = array(); |
| 267 |
if ( ! MainWP_Menu::is_disable_menu_item( 2, 'Extensions' ) ) { |
| 268 |
MainWP_Menu::add_left_menu( |
| 269 |
array( |
| 270 |
'title' => esc_html__( 'Extensions', 'mainwp' ), |
| 271 |
'parent_key' => 'mainwp_tab', |
| 272 |
'slug' => 'Extensions', |
| 273 |
'href' => 'admin.php?page=Extensions', |
| 274 |
'icon' => '<i class="puzzle piece icon"></i>', |
| 275 |
'id' => 'menu-item-extensions', |
| 276 |
), |
| 277 |
0 |
| 278 |
); |
| 279 |
|
| 280 |
$init_sub_subleftmenu = array( |
| 281 |
array( |
| 282 |
'title' => esc_html__( 'Manage Extensions', 'mainwp' ), |
| 283 |
'parent_key' => 'Extensions', |
| 284 |
'href' => 'admin.php?page=Extensions', |
| 285 |
'slug' => 'Extensions', |
| 286 |
'right' => '', |
| 287 |
), |
| 288 |
); |
| 289 |
|
| 290 |
MainWP_Menu::init_subpages_left_menu( $subPages, $init_sub_subleftmenu, 'Extensions', 'Extensions' ); |
| 291 |
|
| 292 |
foreach ( $init_sub_subleftmenu as $item ) { |
| 293 |
if ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) { |
| 294 |
continue; |
| 295 |
} |
| 296 |
MainWP_Menu::add_left_menu( $item, 2 ); |
| 297 |
} |
| 298 |
|
| 299 |
if ( 0 < count( $extPages ) ) { |
| 300 |
|
| 301 |
$init_sub_subleftmenu = array(); |
| 302 |
$slug = ''; |
| 303 |
MainWP_Menu::init_subpages_left_menu( $extPages, $init_sub_subleftmenu, 'Extensions', $slug ); |
| 304 |
|
| 305 |
foreach ( $init_sub_subleftmenu as $item ) { |
| 306 |
if ( MainWP_Menu::is_disable_menu_item( 3, $item['slug'] ) ) { |
| 307 |
continue; |
| 308 |
} |
| 309 |
MainWP_Menu::add_left_menu( $item, 2 ); |
| 310 |
} |
| 311 |
} |
| 312 |
} |
| 313 |
} |
| 314 |
|
| 315 |
/** |
| 316 |
* Method init_subpages_menu() |
| 317 |
* |
| 318 |
* Initiate Extensions Subpage Menu. |
| 319 |
* |
| 320 |
* @uses \MainWP\Dashboard\MainWP_Extensions_Handler::get_extensions() |
| 321 |
* @uses \MainWP\Dashboard\MainWP_Extensions_Handler::added_on_menu() |
| 322 |
* @uses \MainWP\Dashboard\MainWP_Extensions_Handler::polish_ext_name() |
| 323 |
*/ |
| 324 |
public static function init_subpages_menu() { |
| 325 |
$exts = MainWP_Extensions_Handler::get_extensions(); |
| 326 |
if ( empty( $exts ) ) { |
| 327 |
return; |
| 328 |
} |
| 329 |
$html = ''; |
| 330 |
foreach ( $exts as $extension ) { |
| 331 |
if ( defined( 'MWP_TEAMCONTROL_PLUGIN_SLUG' ) && ( MWP_TEAMCONTROL_PLUGIN_SLUG === $extension['slug'] ) && ! mainwp_current_user_have_right( 'extension', dirname( MWP_TEAMCONTROL_PLUGIN_SLUG ) ) ) { |
| 332 |
continue; |
| 333 |
} |
| 334 |
if ( MainWP_Extensions_Handler::added_on_menu( $extension['slug'] ) ) { |
| 335 |
continue; |
| 336 |
} |
| 337 |
$menu_name = MainWP_Extensions_Handler::polish_ext_name( $extension ); |
| 338 |
|
| 339 |
if ( isset( $extension['direct_page'] ) ) { |
| 340 |
$html .= '<a href="' . esc_url( admin_url( 'admin.php?page=' . $extension['direct_page'] ) ) . '" class="mainwp-submenu">' . $menu_name . '</a>'; |
| 341 |
} else { |
| 342 |
$html .= '<a href="' . esc_url( admin_url( 'admin.php?page=' . $extension['page'] ) ) . '" class="mainwp-submenu">' . $menu_name . '</a>'; |
| 343 |
} |
| 344 |
} |
| 345 |
if ( empty( $html ) ) { |
| 346 |
return; |
| 347 |
} |
| 348 |
?> |
| 349 |
<div id="menu-mainwp-Extensions" class="mainwp-submenu-wrapper" xmlns="http://www.w3.org/1999/html"> |
| 350 |
<div class="wp-submenu sub-open" style=""> |
| 351 |
<div class="mainwp_boxout mainwp-submenu-wide"> |
| 352 |
<div class="mainwp_boxoutin"></div> |
| 353 |
<?php echo $html; // phpcs:ignore WordPress.Security.EscapeOutput ?> |
| 354 |
</div> |
| 355 |
</div> |
| 356 |
</div> |
| 357 |
<?php |
| 358 |
} |
| 359 |
|
| 360 |
|
| 361 |
/** |
| 362 |
* Method ajax_get_purchased_extensions() |
| 363 |
* |
| 364 |
* Get purchased MainWP Extensions. |
| 365 |
* |
| 366 |
* @uses \MainWP\Dashboard\MainWP_Api_Manager::get_purchased_extension() |
| 367 |
* @uses \MainWP\Dashboard\MainWP_Api_Manager::check_response_for_intall_errors() |
| 368 |
* @uses \MainWP\Dashboard\MainWP_Extensions_View::get_available_extensions() |
| 369 |
* @uses \MainWP\Dashboard\MainWP_Extensions_View::get_extension_groups() |
| 370 |
* @uses \MainWP\Dashboard\MainWP_Post_Handler::secure_request() |
| 371 |
* @uses \MainWP\Dashboard\MainWP_Extensions_Handler::get_extensions() |
| 372 |
* @uses \MainWP\Dashboard\MainWP_Utility::update_option() |
| 373 |
*/ |
| 374 |
public static function ajax_get_purchased_extensions() { // phpcs:ignore -- complex function. Current complexity is the only way to achieve desired results, pull request solutions appreciated. |
| 375 |
|
| 376 |
MainWP_Post_Handler::instance()->secure_request( 'mainwp_extension_getpurchased' ); |
| 377 |
|
| 378 |
$api_key = isset( $_POST['api_key'] ) ? trim( wp_unslash( $_POST['api_key'] ) ) : false; // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 379 |
|
| 380 |
$all_available_extensions_compatible_api_response = array(); |
| 381 |
$all_free_pro_exts = array(); |
| 382 |
$all_org_exts = array(); |
| 383 |
$map_extensions_group = array(); |
| 384 |
$purchased_data = array(); |
| 385 |
|
| 386 |
$all_groups = MainWP_Extensions_View::get_extension_groups(); |
| 387 |
|
| 388 |
$grouped_exts = array( |
| 389 |
'others' => '', |
| 390 |
'all' => '', |
| 391 |
); |
| 392 |
|
| 393 |
foreach ( MainWP_Extensions_View::get_available_extensions( 'all' ) as $ext ) { |
| 394 |
$all_available_extensions_compatible_api_response[ $ext['product_id'] ] = $ext; |
| 395 |
$map_extensions_group[ $ext['product_id'] ] = current( $ext['group'] ); |
| 396 |
if ( 'free' === $ext['type'] || 'pro' === $ext['type'] ) { |
| 397 |
$all_free_pro_exts[ $ext['product_id'] ] = $ext['product_id']; |
| 398 |
} elseif ( 'org' === $ext['type'] ) { |
| 399 |
$all_org_exts[ $ext['product_id'] ] = $ext['product_id']; |
| 400 |
} |
| 401 |
} |
| 402 |
|
| 403 |
$extensions = MainWP_Extensions_Handler::get_extensions(); |
| 404 |
$installed_softwares = array(); |
| 405 |
|
| 406 |
foreach ( $extensions as $extension ) { |
| 407 |
if ( isset( $extension['type'] ) ) { |
| 408 |
if ( 'free' === $extension['type'] || 'pro' === $extension['type'] ) { |
| 409 |
if ( isset( $extension['product_id'] ) && ! empty( $extension['product_id'] ) ) { |
| 410 |
$installed_softwares[ $extension['product_id'] ] = $extension['product_id']; |
| 411 |
} |
| 412 |
} elseif ( 'org' === $extension['type'] ) { |
| 413 |
$ext_slug = dirname( $extension['slug'] ); |
| 414 |
$installed_softwares[ $ext_slug ] = $ext_slug; |
| 415 |
} |
| 416 |
} |
| 417 |
} |
| 418 |
|
| 419 |
$all_disabled_extensions = MainWP_Extensions_Handler::get_extensions_disabled( true ); |
| 420 |
|
| 421 |
foreach ( $all_disabled_extensions as $ext ) { |
| 422 |
$installed_softwares[ $ext['product_id'] ] = $ext['product_id']; |
| 423 |
} |
| 424 |
|
| 425 |
$not_purchased_exts = $all_free_pro_exts; |
| 426 |
$not_installed_org_exts = array_diff_key( $all_org_exts, $installed_softwares ); |
| 427 |
$installing_exts = $not_installed_org_exts; |
| 428 |
|
| 429 |
if ( ! empty( $api_key ) ) { |
| 430 |
|
| 431 |
$data = MainWP_Api_Manager::instance()->get_purchased_extension( $api_key ); |
| 432 |
|
| 433 |
$result = json_decode( $data, true ); |
| 434 |
$return = array(); |
| 435 |
|
| 436 |
if ( is_array( $result ) ) { |
| 437 |
if ( isset( $result['success'] ) && $result['success'] ) { |
| 438 |
$purchased_data = ( isset( $result['purchased_data'] ) && is_array( $result['purchased_data'] ) ) ? $result['purchased_data'] : array(); |
| 439 |
$not_purchased_exts = array_diff_key( $all_free_pro_exts, $purchased_data ); |
| 440 |
$installing_exts = array_diff_key( $purchased_data, $installed_softwares ); |
| 441 |
$installing_exts = array_merge( $installing_exts, $not_installed_org_exts ); |
| 442 |
} elseif ( isset( $result['error'] ) ) { |
| 443 |
$return = array( 'error' => $result['error'] ); |
| 444 |
} |
| 445 |
} else { |
| 446 |
$apisslverify = get_option( 'mainwp_api_sslVerifyCertificate' ); |
| 447 |
if ( 1 === $apisslverify ) { |
| 448 |
MainWP_Utility::update_option( 'mainwp_api_sslVerifyCertificate', 0 ); |
| 449 |
$return['retry_action'] = 1; |
| 450 |
} |
| 451 |
} |
| 452 |
|
| 453 |
if ( ! empty( $return ) ) { |
| 454 |
wp_send_json( $return ); |
| 455 |
} |
| 456 |
} |
| 457 |
|
| 458 |
foreach ( $all_available_extensions_compatible_api_response as $product_id => $ext ) { |
| 459 |
|
| 460 |
$item_html = ''; |
| 461 |
$error = ''; |
| 462 |
$ext_source_label = ''; |
| 463 |
$type = ''; |
| 464 |
$notice = ''; |
| 465 |
$integration_type = ''; |
| 466 |
$pri = (int) $ext['privacy']; |
| 467 |
|
| 468 |
if ( 0 === $pri ) { |
| 469 |
$integration_type = 'standalone-extension'; |
| 470 |
} elseif ( 1 === $pri ) { |
| 471 |
$integration_type = 'api-extension'; |
| 472 |
} elseif ( 2 === $pri ) { |
| 473 |
$integration_type = 'plugin-extension'; |
| 474 |
} |
| 475 |
|
| 476 |
$item_slug = MainWP_Utility::get_dir_slug( $ext['slug'] ); |
| 477 |
|
| 478 |
$privacy = '<a href="#" class="extension-privacy-info-link" base-slug="' . esc_attr( $item_slug ) . '" style="text-decoration:none"> <i class="shield alternate small icon"></i></a>'; |
| 479 |
|
| 480 |
$new = ''; |
| 481 |
|
| 482 |
$software_title = MainWP_Extensions_Handler::polish_string_name( $ext['title'] ); |
| 483 |
|
| 484 |
if ( ! empty( $ext['type'] ) ) { |
| 485 |
$type = $ext['type']; |
| 486 |
if ( 'free' === $type ) { |
| 487 |
$ext_source_label = '<span class="ui mini green label">FREE</span>'; |
| 488 |
} elseif ( 'pro' === $type ) { |
| 489 |
$ext_source_label = '<span class="ui mini blue label">PRO</span>'; |
| 490 |
} elseif ( 'org' === $type ) { |
| 491 |
$ext_source_label = '<span class="ui mini grey label">.ORG</span>'; |
| 492 |
} |
| 493 |
} |
| 494 |
|
| 495 |
if ( isset( $ext['release_date'] ) && ( time() - $ext['release_date'] < MONTH_IN_SECONDS ) ) { |
| 496 |
$new = '<span class="ui mini green label">NEW!</span>'; |
| 497 |
} |
| 498 |
|
| 499 |
if ( 'MainWP WordPress SEO Extension' === $product_id || 'seopress-for-mainwp' === $product_id ) { |
| 500 |
$notice = ' <i class="info circle small icon"></i>'; |
| 501 |
} |
| 502 |
|
| 503 |
$ext_source_label .= ' '; |
| 504 |
|
| 505 |
if ( isset( $installing_exts[ $product_id ] ) ) { |
| 506 |
|
| 507 |
$product_info = isset( $installing_exts[ $product_id ] ) ? $installing_exts[ $product_id ] : array(); |
| 508 |
if ( ! is_array( $product_info ) ) { |
| 509 |
$product_info = array(); |
| 510 |
} |
| 511 |
|
| 512 |
if ( 'free' === $type || 'pro' === $type ) { |
| 513 |
|
| 514 |
if ( $product_info && isset( $product_info['package'] ) && ! empty( $product_info['package'] ) ) { |
| 515 |
|
| 516 |
/** |
| 517 |
* API Manager Upgrade URL |
| 518 |
* |
| 519 |
* Filters the Upgrade URL for extensions. |
| 520 |
* |
| 521 |
* @since Unknown |
| 522 |
* @ignore |
| 523 |
*/ |
| 524 |
$package_url = apply_filters( 'mainwp_api_manager_upgrade_package_url', $product_info['package'], $product_info ); |
| 525 |
|
| 526 |
$item_html = ' |
| 527 |
<div class="item extension extension-to-install ' . esc_attr( $integration_type ) . '" download-link="' . esc_url( $package_url ) . '" plugin-slug="" product-id="' . esc_attr( $product_id ) . '" slug="' . esc_attr( $ext['slug'] ) . '"> |
| 528 |
<div class="ui stackable grid"> |
| 529 |
<div class="two column row"> |
| 530 |
<div class="column"><span class="ui checkbox"><input type="checkbox" status="queue"><label>' . $ext_source_label . '<strong><a href="' . esc_url( $ext['link'] ) . '" target="_blank">' . esc_html( $software_title ) . '</a>' . $privacy . ' ' . $notice . ' ' . $new . '</strong></label></span></div> |
| 531 |
<div class="right aligned column"><span class="installing-extension" status="queue"></span></div> |
| 532 |
</div> |
| 533 |
</div> |
| 534 |
</div>'; |
| 535 |
|
| 536 |
} elseif ( isset( $product_info['error'] ) && ! empty( $product_info['error'] ) ) { |
| 537 |
$error = MainWP_Api_Manager::instance()->check_response_for_intall_errors( $product_info, $software_title ); |
| 538 |
} else { |
| 539 |
$error = esc_html__( 'Undefined error occurred. Please try again.', 'mainwp' ); |
| 540 |
} |
| 541 |
|
| 542 |
if ( ! empty( $error ) ) { |
| 543 |
$item_html = ' |
| 544 |
<div class="item extension ' . esc_attr( $integration_type ) . '" product-id="' . esc_attr( $product_id ) . '"> |
| 545 |
<div class="ui stackable grid"> |
| 546 |
<div class="two column row"> |
| 547 |
<div class="column"><span class="ui checkbox"><input type="checkbox" disabled="disabled"><label>' . $ext_source_label . ' <a href="' . esc_url( $ext['link'] ) . '" target="_blank">' . esc_html( $software_title ) . '</a>' . $privacy . ' ' . $notice . ' ' . $new . '</label></span></div> |
| 548 |
<div class="right aligned column"><span data-tooltip="' . $error . '" data-inverted="" data-position="left center"><i class="times red icon"></i></span></div> |
| 549 |
</div> |
| 550 |
</div> |
| 551 |
</div>'; |
| 552 |
} |
| 553 |
} elseif ( 'org' === $type ) { |
| 554 |
$item_html = ' |
| 555 |
<div class="item extension extension-to-install ' . esc_attr( $integration_type ) . '" download-link="" plugin-slug="' . esc_attr( $ext['slug'] ) . '" product-id="' . esc_attr( $product_id ) . '" slug="' . esc_attr( $ext['slug'] ) . '"> |
| 556 |
<div class="ui stackable grid"> |
| 557 |
<div class="two column row"> |
| 558 |
<div class="column"><span class="ui checkbox"><input type="checkbox" status="queue"><label>' . $ext_source_label . '<strong><a href="' . esc_url( $ext['link'] ) . '" target="_blank">' . esc_html( $software_title ) . '</a>' . $privacy . ' ' . $notice . ' ' . $new . '</strong></label></span></div> |
| 559 |
<div class="right aligned column"><span class="installing-extension" status="queue"></span></div> |
| 560 |
</div> |
| 561 |
</div> |
| 562 |
</div>'; |
| 563 |
} |
| 564 |
} elseif ( isset( $not_purchased_exts[ $product_id ] ) ) { |
| 565 |
if ( 'free' === $type || 'pro' === $type ) { |
| 566 |
$item_html = ' |
| 567 |
<div class="item extension ' . esc_attr( $integration_type ) . '" product-id="' . esc_attr( $product_id ) . '" slug="' . esc_attr( $ext['slug'] ) . '"> |
| 568 |
<div class="ui stackable grid"> |
| 569 |
<div class="two column row"> |
| 570 |
<div class="column"><span class="ui checkbox"><input type="checkbox" disabled="disabled"><label>' . $ext_source_label . ' <a href="' . esc_url( $ext['link'] ) . '" target="_blank">' . esc_html( $software_title ) . '</a>' . $privacy . ' ' . $notice . ' ' . $new . '</label></span></div> |
| 571 |
<div class="right aligned column"><a href="' . $ext['link'] . '" target="_blank" data-tooltip="' . esc_html__( 'Extension not purchased. Click to find out more.', 'mainwp' ) . '" data-position="left center" data-inverted=""><i class="info blue icon"></i></a></div> |
| 572 |
</div> |
| 573 |
</div> |
| 574 |
</div>'; |
| 575 |
} elseif ( 'org' === $type ) { |
| 576 |
$item_html = ' |
| 577 |
<div class="item extension ' . esc_attr( $integration_type ) . '" product-id="' . esc_attr( $product_id ) . '" slug="' . esc_attr( $ext['slug'] ) . '"> |
| 578 |
<div class="ui stackable grid"> |
| 579 |
<div class="two column row"> |
| 580 |
<div class="column"><span class="ui checkbox"><input type="checkbox" disabled="disabled"><label>' . $ext_source_label . ' <a href="' . esc_url( $ext['link'] ) . '" target="_blank">' . esc_html( $software_title ) . '</a>' . $privacy . ' ' . $notice . ' ' . $new . '</label></span></div> |
| 581 |
<div class="right aligned column"><a href="' . $ext['url'] . '" target="_blank" data-tooltip="' . esc_html__( 'Extension not installed. Click to find out more.', 'mainwp' ) . '" data-position="left center" data-inverted=""><i class="info blue icon"></i></a></div> |
| 582 |
</div> |
| 583 |
</div> |
| 584 |
</div>'; |
| 585 |
} |
| 586 |
} elseif ( isset( $installed_softwares[ $product_id ] ) ) { |
| 587 |
$item_html = ' |
| 588 |
<div class="item extension ' . esc_attr( $integration_type ) . '" product-id="' . esc_attr( $product_id ) . '" slug="' . esc_attr( $ext['slug'] ) . '"> |
| 589 |
<div class="ui stackable grid"> |
| 590 |
<div class="two column row"> |
| 591 |
<div class="column"><span class="ui checkbox"><input type="checkbox" disabled="disabled"><label>' . $ext_source_label . ' <a href="' . esc_url( $ext['link'] ) . '" target="_blank">' . esc_html( $software_title ) . '</a> ' . $notice . '</label></span>' . $privacy . ' ' . $new . '</div> |
| 592 |
<div class="right aligned column">Installed</div> |
| 593 |
</div> |
| 594 |
</div> |
| 595 |
</div>'; |
| 596 |
} |
| 597 |
|
| 598 |
$group_id = isset( $map_extensions_group[ $product_id ] ) ? $map_extensions_group[ $product_id ] : false; |
| 599 |
if ( ! empty( $group_id ) && isset( $all_groups[ $group_id ] ) ) { |
| 600 |
if ( isset( $grouped_exts[ $group_id ] ) ) { |
| 601 |
$grouped_exts[ $group_id ] .= $item_html; |
| 602 |
} else { |
| 603 |
$grouped_exts[ $group_id ] = $item_html; |
| 604 |
} |
| 605 |
} else { |
| 606 |
$grouped_exts['others'] .= $item_html; |
| 607 |
} |
| 608 |
$grouped_exts['all'] .= $item_html; |
| 609 |
} |
| 610 |
|
| 611 |
$html = '<div class="mainwp-installing-extensions">'; |
| 612 |
|
| 613 |
if ( empty( $installing_exts ) && count( $purchased_data ) === count( $all_free_pro_exts ) ) { |
| 614 |
$html .= '<div class="ui message yellow">' . esc_html__( 'All purchased extensions already installed.', 'mainwp' ) . '</div>'; |
| 615 |
} else { |
| 616 |
if ( isset( $not_purchased_exts ) && ! empty( $not_purchased_exts ) ) { |
| 617 |
$html .= '<div class="ui message info">' . esc_html__( 'You have access to all our Free and third-party Extensions on WP.org and any that you have registered for, but you DO NOT need to install them. ', 'mainwp' ); |
| 618 |
$html .= '<br /><br />'; |
| 619 |
$html .= esc_html__( 'To avoid information overload, we highly recommend adding Extensions one at a time and as you need them. Skip any Extension you do not want to install at this time.', 'mainwp' ); |
| 620 |
$html .= '<br /><br />'; |
| 621 |
$html .= sprintf( esc_html__( 'After installing all your selected Extensions, close the modal by clicking the Close button and %1$sactivate Extensions API license%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/activate-extensions-api/" target="_blank">', '</a> <i class="external alternate icon"></i>' ) . '</div>'; |
| 622 |
} else { |
| 623 |
$html .= '<div class="ui message info">' . esc_html__( 'You have access to the MainWP Pro plan, which gives you access to all MainWP-created Extensions, but you DO NOT need to install all of them.', 'mainwp' ); |
| 624 |
$html .= '<br /><br />'; |
| 625 |
$html .= esc_html__( 'To avoid information overload, we highly recommend adding Extensions one at a time and as you need them. Skip any Extension you do not want to install at this time.', 'mainwp' ); |
| 626 |
$html .= '<br /><br />'; |
| 627 |
$html .= sprintf( esc_html__( 'After installing all your selected Extensions, close the modal by clicking the Close button and %1$sactivate Extensions API license%2$s.', 'mainwp' ), '<a href="https://kb.mainwp.com/docs/activate-extensions-api/" target="_blank">', '</a> <i class="external alternate icon"></i>' ) . '</div>'; |
| 628 |
} |
| 629 |
|
| 630 |
$html .= '<div id="mainwp-bulk-activating-extensions-status" class="ui message" style="display:none;"></div>'; |
| 631 |
|
| 632 |
$html .= '<div class="ui secondary green pointing tabular stackable menu" id="mainwp-install-extensions-menu">'; |
| 633 |
foreach ( $all_groups as $gr_id => $gr_name ) { |
| 634 |
if ( isset( $grouped_exts[ $gr_id ] ) ) { |
| 635 |
$html .= '<a class="item" data-tab="' . $gr_id . '">' . $gr_name . '</a>'; |
| 636 |
} |
| 637 |
} |
| 638 |
|
| 639 |
if ( isset( $grouped_exts['others'] ) && ! empty( $grouped_exts['others'] ) ) { |
| 640 |
$html .= '<a class="item" data-tab="other">' . esc_html__( 'Other', 'mainwp' ) . '</a>'; |
| 641 |
} |
| 642 |
|
| 643 |
$html .= '<a class="item" data-tab="search"><i class="search icon"></i></a>'; |
| 644 |
|
| 645 |
$html .= '</div>'; |
| 646 |
|
| 647 |
foreach ( $all_groups as $gr_id => $gr_name ) { |
| 648 |
if ( isset( $grouped_exts[ $gr_id ] ) && 'all' !== $gr_id ) { |
| 649 |
$html .= '<div class="ui tab" data-tab="' . $gr_id . '">'; |
| 650 |
$html .= '<div class="ui hidden divider"></div>'; |
| 651 |
$html .= '<h3>' . $gr_name . '</h3>'; |
| 652 |
$html .= '<div class="ui hidden divider"></div>'; |
| 653 |
$html .= '<div class="ui relaxed divided list">'; |
| 654 |
$html .= $grouped_exts[ $gr_id ]; |
| 655 |
$html .= '</div>'; |
| 656 |
$html .= '</div>'; |
| 657 |
} |
| 658 |
} |
| 659 |
|
| 660 |
if ( isset( $grouped_exts['others'] ) && ! empty( $grouped_exts['others'] ) ) { |
| 661 |
$html .= '<div class="ui tab" data-tab="other">'; |
| 662 |
$html .= '<h3>Other</h3>'; |
| 663 |
$html .= '<div class="ui relaxed divided list">'; |
| 664 |
$html .= $grouped_exts['others']; |
| 665 |
$html .= '</div>'; |
| 666 |
$html .= '</div>'; |
| 667 |
} |
| 668 |
|
| 669 |
$html .= '<div class="ui tab" data-tab="search">'; |
| 670 |
$html .= '<h3>Search Extensions</h3>'; |
| 671 |
$html .= '<div id="mainwp-search-extensions-install" class="ui fluid search"> |
| 672 |
<div class="ui icon fluid input"> |
| 673 |
<input class="prompt" id="mainwp-search-extensions-install-input" type="text" placeholder="Find extension..."> |
| 674 |
<i class="search icon"></i> |
| 675 |
</div> |
| 676 |
</div>'; |
| 677 |
$html .= '<div class="ui relaxed divided list" id="mainwp-extensions-to-install-list">'; |
| 678 |
$html .= $grouped_exts['all']; |
| 679 |
$html .= '</div>'; |
| 680 |
$html .= '</div>'; |
| 681 |
|
| 682 |
} |
| 683 |
$html .= '<div class="ui hidden divider"></div>'; |
| 684 |
$html .= '<div class="ui secondary segment">'; |
| 685 |
$html .= '<div class="ui checkbox"><input type="checkbox" checked="" id="mainwp-standalone-extensions-filer" name="mainwp-standalone-extensions-filer"><label>' . esc_html__( 'Show standalone extensions', 'mainwp' ) . '</label></div><br/>'; |
| 686 |
$html .= '<div class="ui checkbox"><input type="checkbox" checked="" id="mainwp-api-extensions-filer" name="mainwp-api-extensions-filer"><label>' . esc_html__( 'Show extensions that integrate with 3rd party API', 'mainwp' ) . '</label></div><br/>'; |
| 687 |
$html .= '<div class="ui checkbox"><input type="checkbox" checked="" id="mainwp-plugin-extensions-filer" name="mainwp-plugin-extensions-filer"><label>' . esc_html__( 'Show extensions that integrate with 3rd party plugin', 'mainwp' ) . '</label></div>'; |
| 688 |
$html .= '</div>'; |
| 689 |
$html .= '<div class="ui hidden divider"></div>'; |
| 690 |
$html .= '<div class="ui secondary segment">'; |
| 691 |
$html .= '<span class="ui mini green label">FREE</span> - ' . esc_html__( 'Free extension developed by MainWP', 'mainwp' ) . '<br/>'; |
| 692 |
$html .= '<span class="ui mini blue label">PRO</span> - ' . esc_html__( 'Premium extension developed by MainWP', 'mainwp' ) . '<br/>'; |
| 693 |
$html .= '<span class="ui mini grey label">.ORG</span> - ' . esc_html__( 'Free extension developed by 3rd party author, available on WordPress.org', 'mainwp' ); |
| 694 |
$html .= '<div class="ui hidden fitted divider"></div>'; |
| 695 |
$html .= '<i class="info circle icon"></i> ' . esc_html__( 'Extension requires the corresponding plugin on your MainWP Dashboard site too.', 'mainwp' ) . '<br/>'; |
| 696 |
$html .= '<i class="shield alternate icon"></i> ' . esc_html__( 'Shows the extension privacy info.', 'mainwp' ) . '<br/>'; |
| 697 |
$html .= '</div>'; |
| 698 |
|
| 699 |
$html .= '<script>jQuery( "#mainwp-install-extensions-menu .item" ).tab();</script>'; |
| 700 |
$html .= '<script type="text/javascript"> |
| 701 |
jQuery( document ).ready( function () { |
| 702 |
jQuery( "#mainwp-search-extensions-install-input" ).on( "keyup", function () { |
| 703 |
var searchQuery = jQuery( this ).val().toLowerCase(); |
| 704 |
var extensions = jQuery( "#mainwp-extensions-to-install-list" ).find( ".item.extension" ); |
| 705 |
for ( var i = 0; i < extensions.length; i++ ) { |
| 706 |
var currentExtension = jQuery( extensions[i] ); |
| 707 |
var extensionTitle = jQuery( currentExtension ).attr( "product-id" ).toLowerCase(); |
| 708 |
if ( extensionTitle.indexOf( searchQuery ) > -1 ) { |
| 709 |
currentExtension.show(); |
| 710 |
} else { |
| 711 |
currentExtension.hide(); |
| 712 |
} |
| 713 |
} |
| 714 |
} ); |
| 715 |
jQuery( "#mainwp-standalone-extensions-filer" ).on( "change", function () { |
| 716 |
jQuery( "#mainwp-get-purchased-extensions-modal .ui.relaxed.divided.list .item.extension.standalone-extension" ).toggle( 200 ); |
| 717 |
} ); |
| 718 |
jQuery( "#mainwp-api-extensions-filer" ).on( "change", function () { |
| 719 |
jQuery( "#mainwp-get-purchased-extensions-modal .ui.relaxed.divided.list .item.extension.api-extension" ).toggle( 200 ); |
| 720 |
} ); |
| 721 |
jQuery( "#mainwp-plugin-extensions-filer" ).on( "change", function () { |
| 722 |
jQuery( "#mainwp-get-purchased-extensions-modal .ui.relaxed.divided.list .item.extension.plugin-extension" ).toggle( 200 ); |
| 723 |
} ); |
| 724 |
} ); |
| 725 |
</script>'; |
| 726 |
|
| 727 |
if ( ! empty( $installing_exts ) ) { |
| 728 |
$html .= '<p> |
| 729 |
<span class="extension_api_loading"> |
| 730 |
<i class="ui active inline loader tiny" style="display: none;"></i><span class="status hidden"></span> |
| 731 |
</span> |
| 732 |
</p> '; |
| 733 |
} |
| 734 |
|
| 735 |
$html .= '</div>'; |
| 736 |
$return = array( |
| 737 |
'result' => 'SUCCESS', |
| 738 |
'data' => $html, |
| 739 |
); |
| 740 |
|
| 741 |
wp_send_json( $return ); |
| 742 |
} |
| 743 |
|
| 744 |
/** |
| 745 |
* Method render_header() |
| 746 |
* |
| 747 |
* Render page header. |
| 748 |
* |
| 749 |
* @param string $shownPage The page slug shown at this moment. |
| 750 |
* |
| 751 |
* @uses \MainWP\Dashboard\MainWP_Deprecated_Hooks::maybe_handle_deprecated_hook() |
| 752 |
* @uses \MainWP\Dashboard\MainWP_Extensions_View::render_header() |
| 753 |
*/ |
| 754 |
public static function render_header( $shownPage = '' ) { |
| 755 |
MainWP_Deprecated_Hooks::maybe_handle_deprecated_hook(); |
| 756 |
MainWP_Extensions_View::render_header( $shownPage ); |
| 757 |
} |
| 758 |
|
| 759 |
/** |
| 760 |
* Method render_footer() |
| 761 |
* |
| 762 |
* Render page footer. |
| 763 |
* |
| 764 |
* @param string $shownPage The page slug shown at this moment. |
| 765 |
* |
| 766 |
* @uses \MainWP\Dashboard\MainWP_Deprecated_Hooks::maybe_handle_deprecated_hook() |
| 767 |
* @uses \MainWP\Dashboard\MainWP_Extensions_View::render_footer() |
| 768 |
*/ |
| 769 |
public static function render_footer( $shownPage ) { |
| 770 |
MainWP_Deprecated_Hooks::maybe_handle_deprecated_hook(); |
| 771 |
MainWP_Extensions_View::render_footer( $shownPage ); |
| 772 |
} |
| 773 |
|
| 774 |
/** |
| 775 |
* Method render() |
| 776 |
* |
| 777 |
* Render page content. |
| 778 |
* |
| 779 |
* @uses \MainWP\Dashboard\MainWP_Extensions_View::render() |
| 780 |
* @uses \MainWP\Dashboard\MainWP_UI::render_top_header() |
| 781 |
*/ |
| 782 |
public static function render() { |
| 783 |
|
| 784 |
$params = array( |
| 785 |
'title' => esc_html__( 'Extensions', 'mainwp' ), |
| 786 |
); |
| 787 |
MainWP_UI::render_top_header( $params ); |
| 788 |
|
| 789 |
MainWP_Extensions_View::render(); |
| 790 |
echo '</div>'; |
| 791 |
} |
| 792 |
|
| 793 |
/** |
| 794 |
* Method mainwp_help_content() |
| 795 |
* |
| 796 |
* Create the MainWP Help Document List for the help component in the sidebar. |
| 797 |
*/ |
| 798 |
public static function mainwp_help_content() { |
| 799 |
if ( isset( $_GET['page'] ) && 'Extensions' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 800 |
?> |
| 801 |
<p><?php esc_html_e( 'If you need help with your MainWP Extensions, please review following help documents', 'mainwp' ); ?></p> |
| 802 |
<div class="ui relaxed bulleted list"> |
| 803 |
<div class="item"><a href="https://kb.mainwp.com/docs/what-are-mainwp-extensions/" target="_blank"><i class="fa fa-book"></i> What are the MainWP Extensions</a> <i class="external alternate icon"></i></div> |
| 804 |
<div class="item"><a href="https://kb.mainwp.com/docs/order-extensions/" target="_blank"><i class="fa fa-book"></i> Order Extension(s)</a> <i class="external alternate icon"></i></div> |
| 805 |
<div class="item"><a href="https://kb.mainwp.com/docs/my-downloads-and-api-keys/" target="_blank"><i class="fa fa-book"></i> My Downloads and API Keys</a> <i class="external alternate icon"></i></div> |
| 806 |
<div class="item"><a href="https://kb.mainwp.com/docs/install-extensions/" target="_blank"><i class="fa fa-book"></i> Install Extension(s)</a> <i class="external alternate icon"></i></div> |
| 807 |
<div class="item"><a href="https://kb.mainwp.com/docs/activate-extensions-api/" target="_blank"><i class="fa fa-book"></i> Activate Extension(s) API</a> <i class="external alternate icon"></i></div> |
| 808 |
<div class="item"><a href="https://kb.mainwp.com/docs/updating-extensions/" target="_blank"><i class="fa fa-book"></i> Updating Extension(s)</a> <i class="external alternate icon"></i></div> |
| 809 |
<div class="item"><a href="https://kb.mainwp.com/docs/remove-extensions/" target="_blank"><i class="fa fa-book"></i> Remove Extension(s)</a> <i class="external alternate icon"></i></div> |
| 810 |
</div> |
| 811 |
<?php |
| 812 |
} |
| 813 |
} |
| 814 |
} |
| 815 |
|