@@ -472,7 +472,8 @@ discard block |
||
472 | 472 | add_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10, 2 ); |
473 | 473 | load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' ); |
474 | 474 | remove_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10 ); |
475 | - } else { |
|
475 | + } |
|
476 | + else { |
|
476 | 477 | load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' ); |
477 | 478 | } |
478 | 479 | } |
@@ -527,9 +528,11 @@ discard block |
||
527 | 528 | // Current fallback file is not valid, let's try the alternative option. |
528 | 529 | if ( false !== strpos( $mofile, '/themes/' ) ) { |
529 | 530 | return str_replace( '/themes/', '/plugins/', $mofile ); |
530 | - } elseif ( false !== strpos( $mofile, '/plugins/' ) ) { |
|
531 | + } |
|
532 | + elseif ( false !== strpos( $mofile, '/plugins/' ) ) { |
|
531 | 533 | return str_replace( '/plugins/', '/themes/', $mofile ); |
532 | - } else { |
|
534 | + } |
|
535 | + else { |
|
533 | 536 | return $mofile; |
534 | 537 | } |
535 | 538 | } |
@@ -724,7 +727,8 @@ discard block |
||
724 | 727 | |
725 | 728 | if ( 'themes.php' === $this->parent_slug ) { |
726 | 729 | $this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
727 | - } else { |
|
730 | + } |
|
731 | + else { |
|
728 | 732 | $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'] ); |
729 | 733 | } |
730 | 734 | } |
@@ -875,7 +879,8 @@ discard block |
||
875 | 879 | if ( 'update' === $install_type ) { |
876 | 880 | $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
877 | 881 | $skin = new Plugin_Upgrader_Skin( $skin_args ); |
878 | - } else { |
|
882 | + } |
|
883 | + else { |
|
879 | 884 | $skin = new Plugin_Installer_Skin( $skin_args ); |
880 | 885 | } |
881 | 886 | |
@@ -892,7 +897,8 @@ discard block |
||
892 | 897 | $this->inject_update_info( $to_inject ); |
893 | 898 | |
894 | 899 | $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
895 | - } else { |
|
900 | + } |
|
901 | + else { |
|
896 | 902 | $upgrader->install( $source ); |
897 | 903 | } |
898 | 904 | |
@@ -916,12 +922,14 @@ discard block |
||
916 | 922 | if ( $this->is_tgmpa_complete() ) { |
917 | 923 | echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ), '</p>'; |
918 | 924 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
919 | - } else { |
|
925 | + } |
|
926 | + else { |
|
920 | 927 | echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
921 | 928 | } |
922 | 929 | |
923 | 930 | return true; |
924 | - } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
931 | + } |
|
932 | + elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
925 | 933 | // Activate action link was clicked. |
926 | 934 | check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
927 | 935 | |
@@ -1000,7 +1008,8 @@ discard block |
||
1000 | 1008 | // Figure out what the slug is supposed to be. |
1001 | 1009 | if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) { |
1002 | 1010 | $desired_slug = $upgrader->skin->options['extra']['slug']; |
1003 | - } else { |
|
1011 | + } |
|
1012 | + else { |
|
1004 | 1013 | // Bulk installer contains less info, so fall back on the info registered here. |
1005 | 1014 | foreach ( $this->plugins as $slug => $plugin ) { |
1006 | 1015 | if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
@@ -1020,10 +1029,12 @@ discard block |
||
1020 | 1029 | |
1021 | 1030 | if ( true === $GLOBALS['wp_filesystem']->move( $from, $to ) ) { |
1022 | 1031 | return trailingslashit( $to ); |
1023 | - } else { |
|
1032 | + } |
|
1033 | + else { |
|
1024 | 1034 | 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.', 'tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) ); |
1025 | 1035 | } |
1026 | - } elseif ( empty( $subdir_name ) ) { |
|
1036 | + } |
|
1037 | + elseif ( empty( $subdir_name ) ) { |
|
1027 | 1038 | 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.', 'tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) ); |
1028 | 1039 | } |
1029 | 1040 | } |
@@ -1051,19 +1062,23 @@ discard block |
||
1051 | 1062 | '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
1052 | 1063 | |
1053 | 1064 | return false; // End it here if there is an error with activation. |
1054 | - } else { |
|
1065 | + } |
|
1066 | + else { |
|
1055 | 1067 | if ( ! $automatic ) { |
1056 | 1068 | // Make sure message doesn't display again if bulk activation is performed |
1057 | 1069 | // immediately after a single activation. |
1058 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
1070 | + if ( ! isset( $_POST['action'] ) ) { |
|
1071 | +// WPCS: CSRF OK. |
|
1059 | 1072 | echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
1060 | 1073 | } |
1061 | - } else { |
|
1074 | + } |
|
1075 | + else { |
|
1062 | 1076 | // Simpler message layout for use on the plugin install page. |
1063 | 1077 | echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>'; |
1064 | 1078 | } |
1065 | 1079 | } |
1066 | - } elseif ( $this->is_plugin_active( $slug ) ) { |
|
1080 | + } |
|
1081 | + elseif ( $this->is_plugin_active( $slug ) ) { |
|
1067 | 1082 | // No simpler message format provided as this message should never be encountered |
1068 | 1083 | // on the plugin install page. |
1069 | 1084 | echo '<div id="message" class="error"><p>', |
@@ -1072,11 +1087,13 @@ discard block |
||
1072 | 1087 | '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
1073 | 1088 | ), |
1074 | 1089 | '</p></div>'; |
1075 | - } elseif ( $this->does_plugin_require_update( $slug ) ) { |
|
1090 | + } |
|
1091 | + elseif ( $this->does_plugin_require_update( $slug ) ) { |
|
1076 | 1092 | if ( ! $automatic ) { |
1077 | 1093 | // Make sure message doesn't display again if bulk activation is performed |
1078 | 1094 | // immediately after a single activation. |
1079 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
1095 | + if ( ! isset( $_POST['action'] ) ) { |
|
1096 | +// WPCS: CSRF OK. |
|
1080 | 1097 | echo '<div id="message" class="error"><p>', |
1081 | 1098 | sprintf( |
1082 | 1099 | esc_html( $this->strings['plugin_needs_higher_version'] ), |
@@ -1084,7 +1101,8 @@ discard block |
||
1084 | 1101 | ), |
1085 | 1102 | '</p></div>'; |
1086 | 1103 | } |
1087 | - } else { |
|
1104 | + } |
|
1105 | + else { |
|
1088 | 1106 | // Simpler message layout for use on the plugin install page. |
1089 | 1107 | echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
1090 | 1108 | } |
@@ -1134,21 +1152,24 @@ discard block |
||
1134 | 1152 | |
1135 | 1153 | if ( true === $plugin['required'] ) { |
1136 | 1154 | $message['notice_can_install_required'][] = $slug; |
1137 | - } else { |
|
1155 | + } |
|
1156 | + else { |
|
1138 | 1157 | $message['notice_can_install_recommended'][] = $slug; |
1139 | 1158 | } |
1140 | 1159 | } |
1141 | 1160 | if ( true === $plugin['required'] ) { |
1142 | 1161 | $total_required_action_count++; |
1143 | 1162 | } |
1144 | - } else { |
|
1163 | + } |
|
1164 | + else { |
|
1145 | 1165 | if ( ! $this->is_plugin_active( $slug ) && $this->can_plugin_activate( $slug ) ) { |
1146 | 1166 | if ( current_user_can( 'activate_plugins' ) ) { |
1147 | 1167 | $activate_link_count++; |
1148 | 1168 | |
1149 | 1169 | if ( true === $plugin['required'] ) { |
1150 | 1170 | $message['notice_can_activate_required'][] = $slug; |
1151 | - } else { |
|
1171 | + } |
|
1172 | + else { |
|
1152 | 1173 | $message['notice_can_activate_recommended'][] = $slug; |
1153 | 1174 | } |
1154 | 1175 | } |
@@ -1164,7 +1185,8 @@ discard block |
||
1164 | 1185 | |
1165 | 1186 | if ( $this->does_plugin_require_update( $slug ) ) { |
1166 | 1187 | $message['notice_ask_to_update'][] = $slug; |
1167 | - } elseif ( false !== $this->does_plugin_have_update( $slug ) ) { |
|
1188 | + } |
|
1189 | + elseif ( false !== $this->does_plugin_have_update( $slug ) ) { |
|
1168 | 1190 | $message['notice_ask_to_update_maybe'][] = $slug; |
1169 | 1191 | } |
1170 | 1192 | } |
@@ -1188,7 +1210,8 @@ discard block |
||
1188 | 1210 | if ( ! current_user_can( 'activate_plugins' ) && ! current_user_can( 'install_plugins' ) && ! current_user_can( 'update_plugins' ) ) { |
1189 | 1211 | $rendered = esc_html__( $this->strings['notice_cannot_install_activate'] ) . ' ' . esc_html__( $this->strings['contact_admin'] ); |
1190 | 1212 | $rendered .= $this->create_user_action_links_for_notice( 0, 0, 0, $line_template ); |
1191 | - } else { |
|
1213 | + } |
|
1214 | + else { |
|
1192 | 1215 | |
1193 | 1216 | // If dismissable is false and a message is set, output it now. |
1194 | 1217 | if ( ! $this->dismissable && ! empty( $this->dismiss_msg ) ) { |
@@ -1289,7 +1312,8 @@ discard block |
||
1289 | 1312 | if ( ! empty( $action_links ) ) { |
1290 | 1313 | $action_links = sprintf( $line_template, implode( ' | ', $action_links ) ); |
1291 | 1314 | return apply_filters( 'tgmpa_notice_rendered_action_links', $action_links ); |
1292 | - } else { |
|
1315 | + } |
|
1316 | + else { |
|
1293 | 1317 | return ''; |
1294 | 1318 | } |
1295 | 1319 | } |
@@ -1307,12 +1331,15 @@ discard block |
||
1307 | 1331 | protected function get_admin_notice_class() { |
1308 | 1332 | if ( ! empty( $this->strings['nag_type'] ) ) { |
1309 | 1333 | return sanitize_html_class( strtolower( $this->strings['nag_type'] ) ); |
1310 | - } else { |
|
1334 | + } |
|
1335 | + else { |
|
1311 | 1336 | if ( version_compare( $this->wp_version, '4.2', '>=' ) ) { |
1312 | 1337 | return 'notice-warning'; |
1313 | - } elseif ( version_compare( $this->wp_version, '4.1', '>=' ) ) { |
|
1338 | + } |
|
1339 | + elseif ( version_compare( $this->wp_version, '4.1', '>=' ) ) { |
|
1314 | 1340 | return 'notice'; |
1315 | - } else { |
|
1341 | + } |
|
1342 | + else { |
|
1316 | 1343 | return 'updated'; |
1317 | 1344 | } |
1318 | 1345 | } |
@@ -1426,9 +1453,11 @@ discard block |
||
1426 | 1453 | protected function get_plugin_source_type( $source ) { |
1427 | 1454 | if ( 'repo' === $source || preg_match( self::WP_REPO_REGEX, $source ) ) { |
1428 | 1455 | return 'repo'; |
1429 | - } elseif ( preg_match( self::IS_URL_REGEX, $source ) ) { |
|
1456 | + } |
|
1457 | + elseif ( preg_match( self::IS_URL_REGEX, $source ) ) { |
|
1430 | 1458 | return 'external'; |
1431 | - } else { |
|
1459 | + } |
|
1460 | + else { |
|
1432 | 1461 | return 'bundled'; |
1433 | 1462 | } |
1434 | 1463 | } |
@@ -1488,7 +1517,8 @@ discard block |
||
1488 | 1517 | if ( isset( $config[ $key ] ) ) { |
1489 | 1518 | if ( is_array( $config[ $key ] ) ) { |
1490 | 1519 | $this->$key = array_merge( $this->$key, $config[ $key ] ); |
1491 | - } else { |
|
1520 | + } |
|
1521 | + else { |
|
1492 | 1522 | $this->$key = $config[ $key ]; |
1493 | 1523 | } |
1494 | 1524 | } |
@@ -1536,7 +1566,8 @@ discard block |
||
1536 | 1566 | public function populate_file_path( $plugin_slug = '' ) { |
1537 | 1567 | if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
1538 | 1568 | $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
1539 | - } else { |
|
1569 | + } |
|
1570 | + else { |
|
1540 | 1571 | // Add file_path key for all plugins. |
1541 | 1572 | foreach ( $this->plugins as $slug => $values ) { |
1542 | 1573 | $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
@@ -1651,7 +1682,8 @@ discard block |
||
1651 | 1682 | |
1652 | 1683 | if ( is_wp_error( $response ) ) { |
1653 | 1684 | wp_die( esc_html( $this->strings['oops'] ) ); |
1654 | - } else { |
|
1685 | + } |
|
1686 | + else { |
|
1655 | 1687 | $api[ $slug ] = $response; |
1656 | 1688 | } |
1657 | 1689 | } |
@@ -1675,7 +1707,8 @@ discard block |
||
1675 | 1707 | esc_url( $this->plugins[ $slug ]['external_url'] ), |
1676 | 1708 | esc_html( $this->plugins[ $slug ]['name'] ) |
1677 | 1709 | ); |
1678 | - } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
1710 | + } |
|
1711 | + elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
1679 | 1712 | $url = add_query_arg( |
1680 | 1713 | array( |
1681 | 1714 | 'tab' => 'plugin-information', |
@@ -1692,7 +1725,8 @@ discard block |
||
1692 | 1725 | esc_url( $url ), |
1693 | 1726 | esc_html( $this->plugins[ $slug ]['name'] ) |
1694 | 1727 | ); |
1695 | - } else { |
|
1728 | + } |
|
1729 | + else { |
|
1696 | 1730 | $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
1697 | 1731 | } |
1698 | 1732 | |
@@ -1728,10 +1762,14 @@ discard block |
||
1728 | 1762 | if ( 'update-core' === $screen->base ) { |
1729 | 1763 | // Core update screen. |
1730 | 1764 | return true; |
1731 | - } elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
1765 | + } |
|
1766 | + elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { |
|
1767 | +// WPCS: CSRF ok. |
|
1732 | 1768 | // Plugins bulk update screen. |
1733 | 1769 | return true; |
1734 | - } elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
1770 | + } |
|
1771 | + elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { |
|
1772 | +// WPCS: CSRF ok. |
|
1735 | 1773 | // Individual updates (ajax call). |
1736 | 1774 | return true; |
1737 | 1775 | } |
@@ -1870,7 +1908,8 @@ discard block |
||
1870 | 1908 | public function is_plugin_updatetable( $slug ) { |
1871 | 1909 | if ( ! $this->is_plugin_installed( $slug ) ) { |
1872 | 1910 | return false; |
1873 | - } else { |
|
1911 | + } |
|
1912 | + else { |
|
1874 | 1913 | return ( $this->does_plugin_have_update( $slug ) && $this->can_plugin_update( $slug ) ); |
1875 | 1914 | } |
1876 | 1915 | } |
@@ -2020,7 +2059,8 @@ discard block |
||
2020 | 2059 | if ( ! $this->is_plugin_installed( $slug ) ) { |
2021 | 2060 | // Oops, plugin isn't there so iterate to next condition. |
2022 | 2061 | continue; |
2023 | - } elseif ( $this->can_plugin_activate( $slug ) ) { |
|
2062 | + } |
|
2063 | + elseif ( $this->can_plugin_activate( $slug ) ) { |
|
2024 | 2064 | // There we go, activate the plugin. |
2025 | 2065 | activate_plugin( $plugin['file_path'] ); |
2026 | 2066 | } |
@@ -2091,7 +2131,8 @@ discard block |
||
2091 | 2131 | |
2092 | 2132 | if ( did_action( 'plugins_loaded' ) ) { |
2093 | 2133 | load_tgm_plugin_activation(); |
2094 | - } else { |
|
2134 | + } |
|
2135 | + else { |
|
2095 | 2136 | add_action( 'plugins_loaded', 'load_tgm_plugin_activation' ); |
2096 | 2137 | } |
2097 | 2138 | } |
@@ -2303,12 +2344,14 @@ discard block |
||
2303 | 2344 | if ( $this->tgmpa->is_plugin_active( $slug ) && false === $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2304 | 2345 | // No need to display plugins if they are installed, up-to-date and active. |
2305 | 2346 | continue; |
2306 | - } else { |
|
2347 | + } |
|
2348 | + else { |
|
2307 | 2349 | $plugins['all'][ $slug ] = $plugin; |
2308 | 2350 | |
2309 | 2351 | if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
2310 | 2352 | $plugins['install'][ $slug ] = $plugin; |
2311 | - } else { |
|
2353 | + } |
|
2354 | + else { |
|
2312 | 2355 | if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2313 | 2356 | $plugins['update'][ $slug ] = $plugin; |
2314 | 2357 | } |
@@ -2393,7 +2436,8 @@ discard block |
||
2393 | 2436 | |
2394 | 2437 | if ( ! $this->tgmpa->is_plugin_active( $slug ) ) { |
2395 | 2438 | $install_status = __( 'Installed But Not Activated', 'tgmpa' ); |
2396 | - } else { |
|
2439 | + } |
|
2440 | + else { |
|
2397 | 2441 | $install_status = __( 'Active', 'tgmpa' ); |
2398 | 2442 | } |
2399 | 2443 | |
@@ -2402,10 +2446,12 @@ discard block |
||
2402 | 2446 | if ( $this->tgmpa->does_plugin_require_update( $slug ) && false === $this->tgmpa->does_plugin_have_update( $slug ) ) { |
2403 | 2447 | $update_status = __( 'Required Update not Available', 'tgmpa' ); |
2404 | 2448 | |
2405 | - } elseif ( $this->tgmpa->does_plugin_require_update( $slug ) ) { |
|
2449 | + } |
|
2450 | + elseif ( $this->tgmpa->does_plugin_require_update( $slug ) ) { |
|
2406 | 2451 | $update_status = __( 'Requires Update', 'tgmpa' ); |
2407 | 2452 | |
2408 | - } elseif ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
|
2453 | + } |
|
2454 | + elseif ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
|
2409 | 2455 | $update_status = __( 'Update recommended', 'tgmpa' ); |
2410 | 2456 | } |
2411 | 2457 | |
@@ -2591,7 +2637,8 @@ discard block |
||
2591 | 2637 | |
2592 | 2638 | if ( empty( $output ) ) { |
2593 | 2639 | return ' '; // Let's not break the table layout. |
2594 | - } else { |
|
2640 | + } |
|
2641 | + else { |
|
2595 | 2642 | return implode( "\n", $output ); |
2596 | 2643 | } |
2597 | 2644 | } |
@@ -2656,7 +2703,8 @@ discard block |
||
2656 | 2703 | protected function get_primary_column_name() { |
2657 | 2704 | if ( method_exists( 'WP_List_Table', 'get_primary_column_name' ) ) { |
2658 | 2705 | return parent::get_primary_column_name(); |
2659 | - } else { |
|
2706 | + } |
|
2707 | + else { |
|
2660 | 2708 | return $this->get_default_primary_column_name(); |
2661 | 2709 | } |
2662 | 2710 | } |
@@ -2677,7 +2725,8 @@ discard block |
||
2677 | 2725 | if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
2678 | 2726 | /* translators: %s: plugin name in screen reader markup */ |
2679 | 2727 | $actions['install'] = __( 'Install %s', 'tgmpa' ); |
2680 | - } else { |
|
2728 | + } |
|
2729 | + else { |
|
2681 | 2730 | // Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
2682 | 2731 | if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
2683 | 2732 | /* translators: %s: plugin name in screen reader markup */ |
@@ -2831,7 +2880,8 @@ discard block |
||
2831 | 2880 | if ( empty( $_POST['plugin'] ) ) { |
2832 | 2881 | if ( 'install' === $install_type ) { |
2833 | 2882 | $message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
2834 | - } else { |
|
2883 | + } |
|
2884 | + else { |
|
2835 | 2885 | $message = __( 'No plugins were selected to be updated. No action taken.', 'tgmpa' ); |
2836 | 2886 | } |
2837 | 2887 | |
@@ -2842,7 +2892,8 @@ discard block |
||
2842 | 2892 | |
2843 | 2893 | if ( is_array( $_POST['plugin'] ) ) { |
2844 | 2894 | $plugins_to_install = (array) $_POST['plugin']; |
2845 | - } elseif ( is_string( $_POST['plugin'] ) ) { |
|
2895 | + } |
|
2896 | + elseif ( is_string( $_POST['plugin'] ) ) { |
|
2846 | 2897 | // Received via Filesystem page - un-flatten array (WP bug #19643). |
2847 | 2898 | $plugins_to_install = explode( ',', $_POST['plugin'] ); |
2848 | 2899 | } |
@@ -2874,7 +2925,8 @@ discard block |
||
2874 | 2925 | if ( empty( $plugins_to_install ) ) { |
2875 | 2926 | if ( 'install' === $install_type ) { |
2876 | 2927 | $message = __( 'No plugins are available to be installed at this time.', 'tgmpa' ); |
2877 | - } else { |
|
2928 | + } |
|
2929 | + else { |
|
2878 | 2930 | $message = __( 'No plugins are available to be updated at this time.', 'tgmpa' ); |
2879 | 2931 | } |
2880 | 2932 | |
@@ -2964,7 +3016,8 @@ discard block |
||
2964 | 3016 | $this->tgmpa->inject_update_info( $to_inject ); |
2965 | 3017 | |
2966 | 3018 | $installer->bulk_upgrade( $file_paths ); |
2967 | - } else { |
|
3019 | + } |
|
3020 | + else { |
|
2968 | 3021 | $installer->bulk_install( $sources ); |
2969 | 3022 | } |
2970 | 3023 | |
@@ -3017,7 +3070,8 @@ discard block |
||
3017 | 3070 | |
3018 | 3071 | if ( is_wp_error( $activate ) ) { |
3019 | 3072 | echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>'; |
3020 | - } else { |
|
3073 | + } |
|
3074 | + else { |
|
3021 | 3075 | $count = count( $plugin_names ); // Count so we can use _n function. |
3022 | 3076 | $plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
3023 | 3077 | $last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
@@ -3242,7 +3296,8 @@ discard block |
||
3242 | 3296 | if ( $this->tgmpa->is_automatic ) { |
3243 | 3297 | if ( 'update' === $this->skin->options['install_type'] ) { |
3244 | 3298 | $this->upgrade_strings(); |
3245 | - } else { |
|
3299 | + } |
|
3300 | + else { |
|
3246 | 3301 | $this->install_strings(); |
3247 | 3302 | } |
3248 | 3303 | } |
@@ -3454,7 +3509,8 @@ discard block |
||
3454 | 3509 | if ( is_wp_error( $activate ) ) { |
3455 | 3510 | $this->skin->error( $activate ); |
3456 | 3511 | $this->strings['process_success'] .= $this->strings['activation_failed']; |
3457 | - } else { |
|
3512 | + } |
|
3513 | + else { |
|
3458 | 3514 | $this->strings['process_success'] .= $this->strings['activation_success']; |
3459 | 3515 | } |
3460 | 3516 | } |
@@ -3562,7 +3618,8 @@ discard block |
||
3562 | 3618 | parent::add_strings(); |
3563 | 3619 | /* translators: 1: plugin name, 2: action number 3: total number of actions. */ |
3564 | 3620 | $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
3565 | - } else { |
|
3621 | + } |
|
3622 | + else { |
|
3566 | 3623 | /* translators: 1: plugin name, 2: error message. */ |
3567 | 3624 | $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
3568 | 3625 | /* translators: 1: plugin name. */ |
@@ -3576,7 +3633,8 @@ discard block |
||
3576 | 3633 | $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
3577 | 3634 | /* translators: 1: plugin name, 2: action number 3: total number of actions. */ |
3578 | 3635 | $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
3579 | - } else { |
|
3636 | + } |
|
3637 | + else { |
|
3580 | 3638 | // Default installation strings. |
3581 | 3639 | $this->upgrader->strings['skin_upgrade_start'] = __( 'The installation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' ); |
3582 | 3640 | /* translators: 1: plugin name. */ |
@@ -3645,7 +3703,8 @@ discard block |
||
3645 | 3703 | esc_html( $this->tgmpa->strings['complete'] ), |
3646 | 3704 | '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
3647 | 3705 | ); |
3648 | - } else { |
|
3706 | + } |
|
3707 | + else { |
|
3649 | 3708 | $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
3650 | 3709 | } |
3651 | 3710 | |
@@ -3770,7 +3829,8 @@ discard block |
||
3770 | 3829 | |
3771 | 3830 | if ( self::$has_filters ) { |
3772 | 3831 | return filter_var( $value, FILTER_VALIDATE_BOOLEAN ); |
3773 | - } else { |
|
3832 | + } |
|
3833 | + else { |
|
3774 | 3834 | return self::emulate_filter_bool( $value ); |
3775 | 3835 | } |
3776 | 3836 | } |
@@ -3805,17 +3865,22 @@ discard block |
||
3805 | 3865 | |
3806 | 3866 | if ( is_bool( $value ) ) { |
3807 | 3867 | return $value; |
3808 | - } else if ( is_int( $value ) && ( 0 === $value || 1 === $value ) ) { |
|
3868 | + } |
|
3869 | + else if ( is_int( $value ) && ( 0 === $value || 1 === $value ) ) { |
|
3809 | 3870 | return (bool) $value; |
3810 | - } else if ( ( is_float( $value ) && ! is_nan( $value ) ) && ( (float) 0 === $value || (float) 1 === $value ) ) { |
|
3871 | + } |
|
3872 | + else if ( ( is_float( $value ) && ! is_nan( $value ) ) && ( (float) 0 === $value || (float) 1 === $value ) ) { |
|
3811 | 3873 | return (bool) $value; |
3812 | - } else if ( is_string( $value ) ) { |
|
3874 | + } |
|
3875 | + else if ( is_string( $value ) ) { |
|
3813 | 3876 | $value = trim( $value ); |
3814 | 3877 | if ( in_array( $value, $true, true ) ) { |
3815 | 3878 | return true; |
3816 | - } else if ( in_array( $value, $false, true ) ) { |
|
3879 | + } |
|
3880 | + else if ( in_array( $value, $false, true ) ) { |
|
3817 | 3881 | return false; |
3818 | - } else { |
|
3882 | + } |
|
3883 | + else { |
|
3819 | 3884 | return false; |
3820 | 3885 | } |
3821 | 3886 | } |