| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Installer List Table class. |
| 4 |
* |
| 5 |
* @package WordPress |
| 6 |
* @subpackage List_Table |
| 7 |
* @since 3.1.0 |
| 8 |
* @access private |
| 9 |
*/ |
| 10 |
die(); |
| 11 |
class LP_Plugin_Install_List_Table extends WP_List_Table { |
| 12 |
|
| 13 |
public $order = 'ASC'; |
| 14 |
public $orderby = null; |
| 15 |
public $groups = array(); |
| 16 |
|
| 17 |
private $error; |
| 18 |
private $test_mode = false; |
| 19 |
private $repo_url = 'http://thimpress.com/lprepo/'; |
| 20 |
private $upgrader = false; |
| 21 |
public $items; |
| 22 |
|
| 23 |
public function ajax_user_can() { |
| 24 |
return current_user_can( 'install_plugins' ); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Return a list of slugs of installed plugins, if known. |
| 29 |
* |
| 30 |
* Uses the transient data from the updates API to determine the slugs of |
| 31 |
* known installed plugins. This might be better elsewhere, perhaps even |
| 32 |
* within get_plugins(). |
| 33 |
* |
| 34 |
* @since 4.0.0 |
| 35 |
* @access protected |
| 36 |
*/ |
| 37 |
protected function get_installed_plugin_slugs() { |
| 38 |
$slugs = array(); |
| 39 |
|
| 40 |
$plugin_info = get_site_transient( 'update_plugins' ); |
| 41 |
if ( isset( $plugin_info->no_update ) ) { |
| 42 |
foreach ( $plugin_info->no_update as $plugin ) { |
| 43 |
$slugs[] = $plugin->slug; |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
if ( isset( $plugin_info->response ) ) { |
| 48 |
foreach ( $plugin_info->response as $plugin ) { |
| 49 |
$slugs[] = $plugin->slug; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
return $slugs; |
| 54 |
} |
| 55 |
|
| 56 |
private function _get_items_from_wp( $args = array() ) { |
| 57 |
$tab = LP_Helper::sanitize_params_submitted( $_REQUEST['tab'] ?? '' ); |
| 58 |
|
| 59 |
if ( empty( $tab ) ) { |
| 60 |
return; |
| 61 |
} |
| 62 |
|
| 63 |
global $learn_press_add_ons; |
| 64 |
|
| 65 |
$plugins = learn_press_get_add_ons_from_wp( $args ); |
| 66 |
|
| 67 |
if ( ( $tab == 'bundle_activate' ) && sizeof( $plugins ) ) { |
| 68 |
$_plugins = array_values( $plugins ); |
| 69 |
$plugins = array(); |
| 70 |
$bundle_activate = $learn_press_add_ons['bundle_activate']; |
| 71 |
|
| 72 |
for ( $n = sizeof( $_plugins ), $i = $n - 1; $i >= 0; $i-- ) { |
| 73 |
foreach ( $bundle_activate as $slug ) { |
| 74 |
if ( ( false !== strpos( $slug, $_plugins[ $i ]->slug ) ) || ( false !== strpos( $_plugins[ $i ]->slug, $slug ) ) ) { |
| 75 |
$plugins[] = $_plugins[ $i ]; |
| 76 |
} |
| 77 |
} |
| 78 |
} |
| 79 |
} |
| 80 |
$this->items = $plugins; |
| 81 |
} |
| 82 |
|
| 83 |
private function _get_items_from_thimpress( $add_ons ) { |
| 84 |
$cache = WP_CONTENT_DIR . '/upgrade/' . md5( serialize( $add_ons ) ) . '.cache'; |
| 85 |
$timeover = HOUR_IN_SECONDS * 24; |
| 86 |
|
| 87 |
if ( file_exists( $cache ) && ( time() - filemtime( $cache ) ) < $timeover ) { |
| 88 |
$items = LP_Helper::maybe_unserialize( file_get_contents( $cache ) ); |
| 89 |
} else { |
| 90 |
$repo_url = 'http://thimpress.com/lprepo/'; |
| 91 |
|
| 92 |
foreach ( $add_ons as $slug ) { |
| 93 |
if ( false !== strpos( $slug, '.php' ) ) { |
| 94 |
$filename = basename( $slug ); |
| 95 |
$slug = dirname( $slug ); |
| 96 |
} else { |
| 97 |
$filename = "{$slug}.php"; |
| 98 |
} |
| 99 |
$item = array( |
| 100 |
'name' => '', |
| 101 |
'slug' => '', |
| 102 |
'version' => '0.0', |
| 103 |
'author' => '<a href="http://profiles.wordpress.org/thimpress">thimpress</a>', |
| 104 |
'author_profile' => 'http://profiles.wordpress.org/thimpress', |
| 105 |
'contributors' => array(), |
| 106 |
'requires' => '4.0', |
| 107 |
'tested' => '4.2.2', |
| 108 |
'rating' => 0, |
| 109 |
'num_ratings' => 0, |
| 110 |
'ratings' => array( |
| 111 |
'5' => 0, |
| 112 |
'4' => 0, |
| 113 |
'3' => 0, |
| 114 |
'2' => 0, |
| 115 |
'1' => 0, |
| 116 |
), |
| 117 |
'active_installs' => 0, |
| 118 |
'last_updated' => gmdate( 'Y-m-d h:iA', strtotime( 'last Friday', time() ) ) . ' GMT', |
| 119 |
'homepage' => 'http://thimpress.com/learnpress', |
| 120 |
'short_description' => '', |
| 121 |
'icons' => array( |
| 122 |
'2x' => LP_PLUGIN_URL . '/assets/images/icon-128x128.png', |
| 123 |
'1x' => LP_PLUGIN_URL . '/assets/images/icon-128x128.png', |
| 124 |
), |
| 125 |
); |
| 126 |
|
| 127 |
$readme = $this->upgrader->get_plugin_info( $repo_url . "/{$slug}.zip", $filename ); |
| 128 |
$item['name'] = $readme['name']; |
| 129 |
$item['slug'] = $slug; |
| 130 |
|
| 131 |
if ( preg_match( '!<h4>(.*)<\/h4>!', $readme['sections']['changelog'], $matches ) ) { |
| 132 |
$item['version'] = $matches[1]; |
| 133 |
} |
| 134 |
|
| 135 |
$item['requires'] = $readme['requires_at_least']; |
| 136 |
$item['tested'] = $readme['tested_up_to']; |
| 137 |
|
| 138 |
$items[ "{$slug}/{$filename}" ] = (object) $item; |
| 139 |
} |
| 140 |
|
| 141 |
LP_WP_Filesystem::instance()->put_contents( $cache, serialize( $items ) ); |
| 142 |
} |
| 143 |
|
| 144 |
$this->items = $items; |
| 145 |
} |
| 146 |
|
| 147 |
/** |
| 148 |
* Get list of add ons |
| 149 |
* |
| 150 |
* @param array |
| 151 |
*/ |
| 152 |
public function prepare_items( $args = array() ) { |
| 153 |
global $learn_press_add_ons; |
| 154 |
$this->upgrader = new LP_Upgrader(); |
| 155 |
|
| 156 |
$page = LP_Helper::sanitize_params_submitted( $_REQUEST['page'] ?? '' ); |
| 157 |
$tab = LP_Helper::sanitize_params_submitted( $_REQUEST['tab'] ?? '' ); |
| 158 |
|
| 159 |
if ( 'learn-press-addons' != $page ) { |
| 160 |
return; |
| 161 |
} |
| 162 |
|
| 163 |
if ( 'more' == $tab ) { |
| 164 |
$add_ons = $learn_press_add_ons['more']; |
| 165 |
} elseif ( 'bundle_activate' == $tab ) { |
| 166 |
$add_ons = $learn_press_add_ons['bundle_activate']; |
| 167 |
} |
| 168 |
if ( ! $this->test_mode ) { |
| 169 |
$this->_get_items_from_wp( $args ); |
| 170 |
} else { |
| 171 |
$this->_get_items_from_thimpress( $add_ons ); |
| 172 |
} |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
public function no_items() { |
| 177 |
$message = __( 'No plugin found.', 'learnpress' ); |
| 178 |
|
| 179 |
echo '<div class="no-plugin-results">' . $message . '</div>'; |
| 180 |
} |
| 181 |
|
| 182 |
protected function get_views() { |
| 183 |
global $tabs, $tab; |
| 184 |
|
| 185 |
$display_tabs = array(); |
| 186 |
foreach ( (array) $tabs as $action => $text ) { |
| 187 |
$class = ( $action == $tab ) ? ' current' : ''; |
| 188 |
$href = self_admin_url( 'plugin-install.php?tab=' . $action ); |
| 189 |
$display_tabs[ 'plugin-install-' . $action ] = "<a href='$href' class='$class'>$text</a>"; |
| 190 |
} |
| 191 |
// No longer a real tab. |
| 192 |
unset( $display_tabs['plugin-install-upload'] ); |
| 193 |
|
| 194 |
return $display_tabs; |
| 195 |
} |
| 196 |
|
| 197 |
/** |
| 198 |
* Override parent views so we can use the filter bar display. |
| 199 |
*/ |
| 200 |
public function views() { |
| 201 |
$views = $this->get_views(); |
| 202 |
|
| 203 |
/** This filter is documented in wp-admin/inclues/class-wp-list-table.php */ |
| 204 |
$views = apply_filters( "views_{$this->screen->id}", $views ); |
| 205 |
?> |
| 206 |
|
| 207 |
<div class="wp-filter"> |
| 208 |
<ul class="filter-links"> |
| 209 |
<?php |
| 210 |
if ( ! empty( $views ) ) { |
| 211 |
foreach ( $views as $class => $view ) { |
| 212 |
$views[ $class ] = "\t<li class='$class'>$view"; |
| 213 |
} |
| 214 |
echo implode( " </li>\n", $views ) . "</li>\n"; |
| 215 |
} |
| 216 |
?> |
| 217 |
</ul> |
| 218 |
|
| 219 |
<?php install_search_form( isset( $views['plugin-install-search'] ) ); ?> |
| 220 |
</div> |
| 221 |
<?php |
| 222 |
} |
| 223 |
|
| 224 |
/** |
| 225 |
* Override the parent display() so we can provide a different container. |
| 226 |
*/ |
| 227 |
public function display() { |
| 228 |
$data_attr = ''; |
| 229 |
?> |
| 230 |
<div class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>"> |
| 231 |
|
| 232 |
<div id="the-list"<?php echo esc_attr( $data_attr ); ?>> |
| 233 |
<?php $this->display_rows_or_placeholder(); ?> |
| 234 |
</div> |
| 235 |
</div> |
| 236 |
<?php |
| 237 |
$this->display_tablenav( 'bottom' ); |
| 238 |
} |
| 239 |
|
| 240 |
/** |
| 241 |
* @param string $which |
| 242 |
*/ |
| 243 |
protected function display_tablenav( $which ) { |
| 244 |
if ( 'top' == $which ) { |
| 245 |
wp_referer_field(); |
| 246 |
?> |
| 247 |
<div class="tablenav top"> |
| 248 |
<div class="alignleft actions"> |
| 249 |
<?php |
| 250 |
/** |
| 251 |
* Fires before the Plugin Install table header pagination is displayed. |
| 252 |
* |
| 253 |
* @since 2.7.0 |
| 254 |
*/ |
| 255 |
do_action( 'install_plugins_table_header' ); |
| 256 |
?> |
| 257 |
</div> |
| 258 |
<?php $this->pagination( $which ); ?> |
| 259 |
<br class="clear" /> |
| 260 |
</div> |
| 261 |
<?php } else { ?> |
| 262 |
<div class="tablenav bottom"> |
| 263 |
<?php $this->pagination( $which ); ?> |
| 264 |
<br class="clear" /> |
| 265 |
</div> |
| 266 |
<?php |
| 267 |
} |
| 268 |
} |
| 269 |
|
| 270 |
protected function get_table_classes() { |
| 271 |
return array( 'widefat', $this->_args['plural'] ); |
| 272 |
} |
| 273 |
|
| 274 |
public function get_columns() { |
| 275 |
return array(); |
| 276 |
} |
| 277 |
|
| 278 |
/** |
| 279 |
* @param object $plugin_a |
| 280 |
* @param object $plugin_b |
| 281 |
* @return int |
| 282 |
*/ |
| 283 |
private function order_callback( $plugin_a, $plugin_b ) { |
| 284 |
$orderby = $this->orderby; |
| 285 |
if ( ! isset( $plugin_a->$orderby, $plugin_b->$orderby ) ) { |
| 286 |
return 0; |
| 287 |
} |
| 288 |
|
| 289 |
$a = $plugin_a->$orderby; |
| 290 |
$b = $plugin_b->$orderby; |
| 291 |
|
| 292 |
if ( $a == $b ) { |
| 293 |
return 0; |
| 294 |
} |
| 295 |
|
| 296 |
if ( 'DESC' == $this->order ) { |
| 297 |
return ( $a < $b ) ? 1 : -1; |
| 298 |
} else { |
| 299 |
return ( $a < $b ) ? -1 : 1; |
| 300 |
} |
| 301 |
} |
| 302 |
|
| 303 |
public function display_rows() { |
| 304 |
$plugins_allowedtags = array( |
| 305 |
'a' => array( |
| 306 |
'href' => array(), |
| 307 |
'title' => array(), |
| 308 |
'target' => array(), |
| 309 |
), |
| 310 |
'abbr' => array( 'title' => array() ), |
| 311 |
'acronym' => array( 'title' => array() ), |
| 312 |
'code' => array(), |
| 313 |
'pre' => array(), |
| 314 |
'em' => array(), |
| 315 |
'strong' => array(), |
| 316 |
'ul' => array(), |
| 317 |
'ol' => array(), |
| 318 |
'li' => array(), |
| 319 |
'p' => array(), |
| 320 |
'br' => array(), |
| 321 |
); |
| 322 |
|
| 323 |
$plugins_group_titles = array( |
| 324 |
'Performance' => _x( 'Performance', 'Plugin installer group title' ), |
| 325 |
'Social' => _x( 'Social', 'Plugin installer group title' ), |
| 326 |
'Tools' => _x( 'Tools', 'Plugin installer group title' ), |
| 327 |
); |
| 328 |
|
| 329 |
$tab = LP_Helper::sanitize_params_submitted( $_REQUEST['tab'] ?? '' ); |
| 330 |
$group = null; |
| 331 |
|
| 332 |
foreach ( (array) $this->items as $kk => $plugin ) { |
| 333 |
if ( is_object( $plugin ) ) { |
| 334 |
$plugin = (array) $plugin; |
| 335 |
} |
| 336 |
|
| 337 |
// Display the group heading if there is one |
| 338 |
if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) { |
| 339 |
if ( isset( $this->groups[ $plugin['group'] ] ) ) { |
| 340 |
$group_name = $this->groups[ $plugin['group'] ]; |
| 341 |
if ( isset( $plugins_group_titles[ $group_name ] ) ) { |
| 342 |
$group_name = $plugins_group_titles[ $group_name ]; |
| 343 |
} |
| 344 |
} else { |
| 345 |
$group_name = $plugin['group']; |
| 346 |
} |
| 347 |
|
| 348 |
// Starting a new group, close off the divs of the last one |
| 349 |
if ( ! empty( $group ) ) { |
| 350 |
echo '</div></div>'; |
| 351 |
} |
| 352 |
|
| 353 |
echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>'; |
| 354 |
// needs an extra wrapping div for nth-child selectors to work |
| 355 |
echo '<div class="plugin-items">'; |
| 356 |
|
| 357 |
$group = $plugin['group']; |
| 358 |
} |
| 359 |
$title = wp_kses( $plugin['name'], $plugins_allowedtags ); |
| 360 |
|
| 361 |
// Remove any HTML from the description. |
| 362 |
$description = strip_tags( $plugin['short_description'] ); |
| 363 |
$version = wp_kses( $plugin['version'], $plugins_allowedtags ); |
| 364 |
|
| 365 |
$name = strip_tags( $title . ' ' . $version ); |
| 366 |
|
| 367 |
$author = wp_kses( $plugin['author'], $plugins_allowedtags ); |
| 368 |
if ( ! empty( $author ) ) { |
| 369 |
$author = ' <cite>' . sprintf( __( 'By %s', 'learnpress' ), $author ) . '</cite>'; |
| 370 |
} |
| 371 |
|
| 372 |
$action_links = array(); |
| 373 |
$plugin_file = learn_press_plugin_basename_from_slug( $plugin['slug'] ); |
| 374 |
|
| 375 |
if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) { |
| 376 |
|
| 377 |
if ( $this->test_mode ) { |
| 378 |
$status = array( |
| 379 |
'status' => file_exists( WP_PLUGIN_DIR . '/' . $plugin['slug'] ) ? 'newer_installed' : 'install', |
| 380 |
'url' => admin_url( 'admin-ajax.php?action=learnpress_plugin_install&plugin=' . $plugin['slug'] ), |
| 381 |
); |
| 382 |
} else { |
| 383 |
$status = install_plugin_install_status( $plugin ); |
| 384 |
} |
| 385 |
|
| 386 |
switch ( $status['status'] ) { |
| 387 |
case 'install': |
| 388 |
if ( $status['url'] ) { |
| 389 |
/* translators: 1: Plugin name and version. */ |
| 390 |
$action_links[] = '<a class="install-now button thimpress" data-action="install-now" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url_raw( $status['url'] ) . '&learnpress=active" aria-label="' . esc_attr( sprintf( __( 'Install %s now', 'learnpress' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Install and Active', 'learnpress' ) . '</a>'; |
| 391 |
} |
| 392 |
|
| 393 |
break; |
| 394 |
case 'update_available': |
| 395 |
if ( $status['url'] ) { |
| 396 |
/* translators: 1: Plugin name and version */ |
| 397 |
$action_links[] = '<a class="update-now button thimpress" data-action="update-now" data-plugin="' . esc_attr( $status['file'] ) . '" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url_raw( $status['url'] ) . '&learnpress=active" aria-label="' . esc_attr( sprintf( __( 'Update %s now', 'learnpress' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Update Now', 'learnpress' ) . '</a>'; |
| 398 |
} |
| 399 |
|
| 400 |
break; |
| 401 |
case 'latest_installed': |
| 402 |
case 'newer_installed': |
| 403 |
if ( is_plugin_active( $plugin_file ) ) { |
| 404 |
$action_links[] = '<span class="button button-disabled" title="">' . _x( 'Enabled', 'plugin' ) . '</span>'; |
| 405 |
} else { |
| 406 |
$action_links[] = '<a class="active-now button thimpress" data-action="active-now" href="' . wp_nonce_url( 'plugins.php?action=activate&learnpress=active&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file ) . '" >' . _x( 'Enable', 'plugin' ) . '</a>'; |
| 407 |
} |
| 408 |
break; |
| 409 |
} |
| 410 |
} |
| 411 |
|
| 412 |
if ( ! empty( $plugin['icons']['svg'] ) ) { |
| 413 |
$plugin_icon_url = $plugin['icons']['svg']; |
| 414 |
} elseif ( ! empty( $plugin['icons']['2x'] ) ) { |
| 415 |
$plugin_icon_url = $plugin['icons']['2x']; |
| 416 |
} elseif ( ! empty( $plugin['icons']['1x'] ) ) { |
| 417 |
$plugin_icon_url = $plugin['icons']['1x']; |
| 418 |
} else { |
| 419 |
$plugin_icon_url = $plugin['icons']['default']; |
| 420 |
} |
| 421 |
|
| 422 |
/** |
| 423 |
* Filter the install action links for a plugin. |
| 424 |
* |
| 425 |
* @since 2.7.0 |
| 426 |
* |
| 427 |
* @param array $action_links An array of plugin action hyperlinks. Defaults are links to Details and Install Now. |
| 428 |
* @param array $plugin The plugin currently being listed. |
| 429 |
*/ |
| 430 |
$action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin ); |
| 431 |
|
| 432 |
$date_format = 'M j, Y @ H:i'; |
| 433 |
$last_updated_timestamp = strtotime( $plugin['last_updated'] ); |
| 434 |
$details_link = ''; |
| 435 |
$message = null; |
| 436 |
|
| 437 |
if ( 'bundle_activate' == $tab ) { |
| 438 |
if ( learn_press_is_plugin_install( $plugin_file ) ) { |
| 439 |
if ( is_plugin_active( $plugin_file ) ) { |
| 440 |
$message = sprintf( '<span class="addon-status enabled">%s</span>', __( 'Enabled', 'learnpress' ) ); |
| 441 |
} else { |
| 442 |
$message = sprintf( '<span class="addon-status disabled">%s</span>', __( 'Disabled', 'learnpress' ) ); |
| 443 |
} |
| 444 |
} else { |
| 445 |
$message = sprintf( '<span class="addon-status not_install">%s</span>', __( 'Not Install', 'learnpress' ) ); |
| 446 |
} |
| 447 |
} |
| 448 |
?> |
| 449 |
<div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>"> |
| 450 |
<div class="plugin-card-top"> |
| 451 |
<a href="<?php echo esc_url_raw( $details_link ); ?>" class="thickbox plugin-icon"><img src="<?php echo esc_attr( $plugin_icon_url ); ?>" /></a> |
| 452 |
<div class="name column-name"> |
| 453 |
<h3><a href="<?php echo esc_url_raw( $details_link ); ?>" class="thickbox"><?php echo wp_kses_post( $title ); ?></a></h3> |
| 454 |
</div> |
| 455 |
<div class="action-links"> |
| 456 |
<?php |
| 457 |
if ( $action_links ) { |
| 458 |
echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li></ul>'; |
| 459 |
} |
| 460 |
// echo $message; |
| 461 |
?> |
| 462 |
</div> |
| 463 |
<div class="desc column-description"> |
| 464 |
<p><?php echo wp_kses_post( $description ); ?></p> |
| 465 |
<p class="authors"><?php echo wp_kses_post( $author ); ?></p> |
| 466 |
</div> |
| 467 |
</div> |
| 468 |
<div class="plugin-card-bottom"> |
| 469 |
<div class="vers column-rating"> |
| 470 |
<?php |
| 471 |
wp_star_rating( |
| 472 |
array( |
| 473 |
'rating' => $plugin['rating'], |
| 474 |
'type' => 'percent', |
| 475 |
'number' => $plugin['num_ratings'], |
| 476 |
) |
| 477 |
); |
| 478 |
?> |
| 479 |
<span class="num-ratings">(<?php echo number_format_i18n( $plugin['num_ratings'] ); ?>)</span> |
| 480 |
</div> |
| 481 |
<div class="column-updated"> |
| 482 |
<strong><?php _e( 'Last Updated:', 'learnpress' ); ?></strong> <span title="<?php echo esc_attr( date_i18n( $date_format, $last_updated_timestamp ) ); ?>"> |
| 483 |
<?php printf( __( '%s ago', 'learnpress' ), human_time_diff( $last_updated_timestamp ) ); ?> |
| 484 |
</span> |
| 485 |
</div> |
| 486 |
<div class="column-downloaded"> |
| 487 |
<?php |
| 488 |
if ( $plugin['active_installs'] >= 1000000 ) { |
| 489 |
$active_installs_text = _x( '1+ Million', 'Active plugin installs' ); |
| 490 |
} else { |
| 491 |
$active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+'; |
| 492 |
} |
| 493 |
printf( __( '%s Active Installs', 'learnpress' ), $active_installs_text ); |
| 494 |
?> |
| 495 |
</div> |
| 496 |
<div class="column-compatibility"> |
| 497 |
<?php |
| 498 |
if ( ! empty( $plugin['tested'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '>' ) ) { |
| 499 |
echo '<span class="compatibility-untested">' . __( 'Untested with your version of WordPress', 'learnpress' ) . '</span>'; |
| 500 |
} elseif ( ! empty( $plugin['requires'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '<' ) ) { |
| 501 |
echo '<span class="compatibility-incompatible">' . __( '<strong>Incompatible</strong> with your version of WordPress', 'learnpress' ) . '</span>'; |
| 502 |
} else { |
| 503 |
echo '<span class="compatibility-compatible">' . __( '<strong>Compatible</strong> with your version of WordPress', 'learnpress' ) . '</span>'; |
| 504 |
} |
| 505 |
?> |
| 506 |
</div> |
| 507 |
</div> |
| 508 |
</div> |
| 509 |
<?php |
| 510 |
} |
| 511 |
|
| 512 |
// Close off the group divs of the last one |
| 513 |
if ( ! empty( $group ) ) { |
| 514 |
echo '</div></div>'; |
| 515 |
} |
| 516 |
} |
| 517 |
} |
| 518 |
|