| @@ -1,277 +1,280 @@ | ||
| 1 | -<?php | |
| 2 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 3 | -require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; | |
| 4 | -remove_all_filters('plugins_api'); | |
| 5 | -$qcld_chatplugintags = array( | |
| 6 | - 'a' => array( | |
| 7 | - 'href' => array(), | |
| 8 | - 'title' => array(), | |
| 9 | - 'target' => array(), | |
| 10 | - ), | |
| 11 | -); | |
| 12 | - | |
| 13 | -$qcld_plugininstal = array(); | |
| 14 | - | |
| 15 | -/* Conversational Forms Plugins */ | |
| 16 | - $argus = [ | |
| 17 | - 'slug' => 'conversational-forms', | |
| 18 | - 'fields' => [ | |
| 19 | - 'short_description' => true, | |
| 20 | - 'icons' => true, | |
| 21 | - 'reviews' => false, // excludes all reviews | |
| 22 | - ], | |
| 23 | - ]; | |
| 24 | - | |
| 25 | - $data = plugins_api( 'plugin_information', $argus ); | |
| 26 | - if ( $data && ! is_wp_error( $data ) ) { | |
| 27 | - $qcld_plugininstal['convers-form'] = $data; | |
| 28 | - $qcld_plugininstal['convers-form']->name = 'Conversational Forms for ChatBot'; | |
| 29 | - } | |
| 30 | -?> | |
| 31 | - | |
| 32 | -<div class="wrap recommended-plugins"> | |
| 33 | - <div class="wp-list-table widefat plugin-install"> | |
| 34 | - <div class="the-list"> | |
| 35 | - <?php | |
| 36 | - foreach ( (array) $qcld_plugininstal as $plugin ) { | |
| 37 | - if ( is_object( $plugin ) ) { | |
| 38 | - $plugin = (array) $plugin; | |
| 39 | - } | |
| 40 | - | |
| 41 | - // Display the group heading if there is one. | |
| 42 | - if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) { | |
| 43 | - if ( isset( $this->groups[ $plugin['group'] ] ) ) { | |
| 44 | - $group_name = $this->groups[ $plugin['group'] ]; | |
| 45 | - if ( isset( $plugins_group_titles[ $group_name ] ) ) { | |
| 46 | - $group_name = $plugins_group_titles[ $group_name ]; | |
| 47 | - } | |
| 48 | - } else { | |
| 49 | - $group_name = $plugin['group']; | |
| 50 | - } | |
| 51 | - | |
| 52 | - // Starting a new group, close off the divs of the last one. | |
| 53 | - if ( ! empty( $group ) ) { | |
| 54 | - echo '</div></div>'; | |
| 55 | - } | |
| 56 | - | |
| 57 | - echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>'; | |
| 58 | - // Needs an extra wrapping div for nth-child selectors to work. | |
| 59 | - echo '<div class="plugin-items">'; | |
| 60 | - | |
| 61 | - $group = $plugin['group']; | |
| 62 | - } | |
| 63 | - $title = wp_kses( $plugin['name'], $qcld_chatplugintags ); | |
| 64 | - | |
| 65 | - // Remove any HTML from the description. | |
| 66 | - $description = wp_strip_all_tags( $plugin['short_description'] ); | |
| 67 | - $version = wp_kses( $plugin['version'], $qcld_chatplugintags ); | |
| 68 | - | |
| 69 | - $name = wp_strip_all_tags( $title . ' ' . $version ); | |
| 70 | - | |
| 71 | - $author = wp_kses( $plugin['author'], $qcld_chatplugintags ); | |
| 72 | - if ( ! empty( $author ) ) { | |
| 73 | - /* translators: %s: Plugin author. */ | |
| 74 | - $author = ' <cite>' . sprintf( __( 'By %s', 'chatbot' ), $author ) . '</cite>'; | |
| 75 | - } | |
| 76 | - | |
| 77 | - $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null; | |
| 78 | - $requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null; | |
| 79 | - | |
| 80 | - $compatible_php = is_php_version_compatible( $requires_php ); | |
| 81 | - $compatible_wp = is_wp_version_compatible( $requires_wp ); | |
| 82 | - $tested_wp = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) ); | |
| 83 | - | |
| 84 | - $action_links = array(); | |
| 85 | - | |
| 86 | - if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) { | |
| 87 | - $status = install_plugin_install_status( $plugin ); | |
| 88 | - | |
| 89 | - switch ( $status['status'] ) { | |
| 90 | - case 'install': | |
| 91 | - if ( $status['url'] ) { | |
| 92 | - if ( $compatible_php && $compatible_wp ) { | |
| 93 | - $action_links[] = sprintf( | |
| 94 | - '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>', | |
| 95 | - esc_attr( $plugin['slug'] ), | |
| 96 | - esc_url( $status['url'] ), | |
| 97 | - /* translators: %s: Plugin name and version. */ | |
| 98 | - esc_attr( sprintf( _x( 'Install %s now', 'Install plugin', 'chatbot' ), $name ) ), | |
| 99 | - | |
| 100 | - esc_attr( $name ), | |
| 101 | - __( 'Install Now', 'chatbot' ) | |
| 102 | - ); | |
| 103 | - } else { | |
| 104 | - $action_links[] = sprintf( | |
| 105 | - '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', | |
| 106 | - __( 'Cannot Install', 'chatbot' ) | |
| 107 | - ); | |
| 108 | - } | |
| 109 | - } | |
| 110 | - break; | |
| 111 | - | |
| 112 | - case 'update_available': | |
| 113 | - if ( $status['url'] ) { | |
| 114 | - if ( $compatible_php && $compatible_wp ) { | |
| 115 | - $action_links[] = sprintf( | |
| 116 | - '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>', | |
| 117 | - esc_attr( $status['file'] ), | |
| 118 | - esc_attr( $plugin['slug'] ), | |
| 119 | - esc_url( $status['url'] ), | |
| 120 | - /* translators: %s: Plugin name and version. */ | |
| 121 | - esc_attr( sprintf( _x( 'Update %s now', 'Update plugin', 'chatbot' ), $name ) ), | |
| 122 | - | |
| 123 | - esc_attr( $name ), | |
| 124 | - __( 'Update Now', 'chatbot' ) | |
| 125 | - ); | |
| 126 | - } else { | |
| 127 | - $action_links[] = sprintf( | |
| 128 | - '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', | |
| 129 | - __( 'Cannot Update', 'chatbot' ) | |
| 130 | - ); | |
| 131 | - } | |
| 132 | - } | |
| 133 | - break; | |
| 134 | - | |
| 135 | - case 'latest_installed': | |
| 136 | - case 'newer_installed': | |
| 137 | - if ( is_plugin_active( $status['file'] ) ) { | |
| 138 | - $action_links[] = sprintf( | |
| 139 | - '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', | |
| 140 | - __( 'Active', 'chatbot' ) | |
| 141 | - ); | |
| 142 | - } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) { | |
| 143 | - $button_text = __( 'Activate', 'chatbot' ); | |
| 144 | - /* translators: %s: Plugin name. */ | |
| 145 | - $button_label = _x( 'Activate %s', 'plugin name', 'chatbot' ); | |
| 146 | - $activate_url = add_query_arg( | |
| 147 | - array( | |
| 148 | - '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), | |
| 149 | - 'action' => 'activate', | |
| 150 | - 'plugin' => $status['file'], | |
| 151 | - ), | |
| 152 | - network_admin_url( 'plugins.php' ) | |
| 153 | - ); | |
| 154 | - | |
| 155 | - if ( is_network_admin() ) { | |
| 156 | - $button_text = __( 'Network Activate', 'chatbot' ); | |
| 157 | - /* translators: %s: Plugin name. */ | |
| 158 | - $button_label = _x( 'Network Activate %s', 'plugin name', 'chatbot' ); | |
| 159 | - $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); | |
| 160 | - } | |
| 161 | - | |
| 162 | - $action_links[] = sprintf( | |
| 163 | - '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>', | |
| 164 | - esc_url( $activate_url ), | |
| 165 | - esc_attr( sprintf( $button_label, $plugin['name'] ) ), | |
| 166 | - $button_text | |
| 167 | - ); | |
| 168 | - } else { | |
| 169 | - $action_links[] = sprintf( | |
| 170 | - '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', | |
| 171 | - _x( 'Installed', 'plugin status', 'chatbot' ) | |
| 172 | - ); | |
| 173 | - } | |
| 174 | - break; | |
| 175 | - } | |
| 176 | - } | |
| 177 | - | |
| 178 | - $details_link = self_admin_url( | |
| 179 | - 'plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . | |
| 180 | - '&width=700&height=550' | |
| 181 | - ); | |
| 182 | - $action_links[] = sprintf( '%s','<a href="#" data-toggle="modal" data-target="#myModal">More Details</a><div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button></div><div class="modal-body"><iframe width="100%" height="550" src="'.$details_link.'"></iframe></div></div></div></div>'); | |
| 183 | - /*===show icon ==*/ | |
| 184 | - if ( ! empty( $plugin['icons']['svg'] ) ) { | |
| 185 | - $plugin_icon_url = $plugin['icons']['svg']; | |
| 186 | - } elseif ( ! empty( $plugin['icons']['2x'] ) ) { | |
| 187 | - $plugin_icon_url = $plugin['icons']['2x']; | |
| 188 | - } elseif ( ! empty( $plugin['icons']['1x'] ) ) { | |
| 189 | - $plugin_icon_url = $plugin['icons']['1x']; | |
| 190 | - } else { | |
| 191 | - $plugin_icon_url = $plugin['icons']['default']; | |
| 192 | - } | |
| 193 | - /* | |
| 194 | - * $action_links An array of plugin action links. Defaults are links to Details and Install Now. | |
| 195 | - * $plugin The plugin currently being listed. | |
| 196 | - */ | |
| 197 | - $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin ); | |
| 198 | - | |
| 199 | - $last_updated_timestamp = strtotime( $plugin['last_updated'] ); | |
| 200 | - ?> | |
| 201 | - <div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>"> | |
| 202 | - <?php | |
| 203 | - if ( ! $compatible_php || ! $compatible_wp ) { | |
| 204 | - echo '<div class="notice inline notice-error notice-alt"><p>'; | |
| 205 | - if ( ! $compatible_php && ! $compatible_wp ) { | |
| 206 | - esc_html_e( 'This plugin doesn’t work with your versions of WordPress and PHP.', 'chatbot' ); | |
| 207 | - if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { | |
| 208 | - printf( | |
| 209 | - /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ | |
| 210 | - '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.', | |
| 211 | - esc_url( self_admin_url( 'update-core.php' ) ), | |
| 212 | - esc_url( wp_get_update_php_url() ) | |
| 213 | - ); | |
| 214 | - wp_update_php_annotation( '</p><p><em>', '</em>' ); | |
| 215 | - } elseif ( current_user_can( 'update_core' ) ) { | |
| 216 | - printf( | |
| 217 | - /* translators: %s: URL to WordPress Updates screen. */ | |
| 218 | - '<a href="%s">Please update WordPress</a>.', | |
| 219 | - esc_url( self_admin_url( 'update-core.php' ) ) | |
| 220 | - ); | |
| 221 | - } elseif ( current_user_can( 'update_php' ) ) { | |
| 222 | - printf( | |
| 223 | - /* translators: %s: URL to Update PHP page. */ | |
| 224 | - '<a href="%s">Learn more about updating PHP</a>.', | |
| 225 | - esc_url( wp_get_update_php_url() ) | |
| 226 | - ); | |
| 227 | - wp_update_php_annotation( '</p><p><em>', '</em>' ); | |
| 228 | - } | |
| 229 | - } elseif ( ! $compatible_wp ) { | |
| 230 | - esc_html_e( 'This plugin doesn’t work with your version of WordPress.', 'chatbot' ); | |
| 231 | - if ( current_user_can( 'update_core' ) ) { | |
| 232 | - printf( | |
| 233 | - /* translators: %s: URL to WordPress Updates screen. */ | |
| 234 | - '<a href="%s">Please update WordPress</a>.', | |
| 235 | - esc_url( self_admin_url( 'update-core.php' ) ) | |
| 236 | - ); | |
| 237 | - } | |
| 238 | - } elseif ( ! $compatible_php ) { | |
| 239 | - esc_html_e( 'This plugin doesn’t work with your version of PHP.', 'chatbot' ); | |
| 240 | - if ( current_user_can( 'update_php' ) ) { | |
| 241 | - printf( | |
| 242 | - /* translators: %s: URL to Update PHP page. */ | |
| 243 | - '<a href="%s">Learn more about updating PHP</a>.', | |
| 244 | - esc_url( wp_get_update_php_url() ) | |
| 245 | - ); | |
| 246 | - wp_update_php_annotation( '</p><p><em>', '</em>' ); | |
| 247 | - } | |
| 248 | - } | |
| 249 | - echo '</p></div>'; | |
| 250 | - } | |
| 251 | - ?> | |
| 252 | - <div class="plugin-card-top"> | |
| 253 | - <div class="name column-name"> | |
| 254 | - <h3> | |
| 255 | - <a href="<?php echo esc_url( $details_link ); ?>" class="thickbox open-plugin-details-modal"> | |
| 256 | - <?php echo esc_attr($title); ?> | |
| 257 | - <img src="<?php echo esc_attr( $plugin_icon_url ); ?>" class="plugin-icon" alt="" /> | |
| 258 | - </a> | |
| 259 | - </h3> | |
| 260 | - </div> | |
| 261 | - <div class="action-links"> | |
| 262 | - <?php | |
| 263 | - if ( $action_links ) { | |
| 264 | - // phpcs:ignore | |
| 265 | - echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li></ul>'; | |
| 266 | - } | |
| 267 | - ?> | |
| 268 | - </div> | |
| 269 | - | |
| 270 | - </div> | |
| 271 | - </div> | |
| 272 | - <?php | |
| 273 | - } ?> | |
| 274 | - </div> | |
| 275 | - </div> | |
| 276 | - | |
| 1 | +<?php | |
| 2 | +if (defined('ABSPATH') === false) { | |
| 3 | + exit; | |
| 4 | +} | |
| 5 | + | |
| 6 | +?> | |
| 7 | +<?php | |
| 8 | +require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; | |
| 9 | +remove_all_filters('plugins_api'); | |
| 10 | +$qcld_chatplugintags = array( | |
| 11 | + 'a' => array( | |
| 12 | + 'href' => array(), | |
| 13 | + 'title' => array(), | |
| 14 | + 'target' => array(), | |
| 15 | + ), | |
| 16 | +); | |
| 17 | + | |
| 18 | +$qcld_plugininstal = array(); | |
| 19 | + | |
| 20 | +/* Conversational Forms Plugins */ | |
| 21 | + $argus = [ | |
| 22 | + 'slug' => 'conversational-forms', | |
| 23 | + 'fields' => [ | |
| 24 | + 'short_description' => true, | |
| 25 | + 'icons' => true, | |
| 26 | + 'reviews' => false, // excludes all reviews | |
| 27 | + ], | |
| 28 | + ]; | |
| 29 | + | |
| 30 | + $data = plugins_api( 'plugin_information', $argus ); | |
| 31 | + if ( $data && ! is_wp_error( $data ) ) { | |
| 32 | + $qcld_plugininstal['convers-form'] = $data; | |
| 33 | + $qcld_plugininstal['convers-form']->name = 'Conversational Forms for ChatBot'; | |
| 34 | + } | |
| 35 | +?> | |
| 36 | + | |
| 37 | +<div class="wrap recommended-plugins"> | |
| 38 | + <div class="wp-list-table widefat plugin-install"> | |
| 39 | + <div class="the-list"> | |
| 40 | + <?php | |
| 41 | + foreach ( (array) $qcld_plugininstal as $plugin ) { | |
| 42 | + if ( is_object( $plugin ) ) { | |
| 43 | + $plugin = (array) $plugin; | |
| 44 | + } | |
| 45 | + | |
| 46 | + // Display the group heading if there is one. | |
| 47 | + if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) { | |
| 48 | + if ( isset( $this->groups[ $plugin['group'] ] ) ) { | |
| 49 | + $group_name = $this->groups[ $plugin['group'] ]; | |
| 50 | + if ( isset( $plugins_group_titles[ $group_name ] ) ) { | |
| 51 | + $group_name = $plugins_group_titles[ $group_name ]; | |
| 52 | + } | |
| 53 | + } else { | |
| 54 | + $group_name = $plugin['group']; | |
| 55 | + } | |
| 56 | + | |
| 57 | + // Starting a new group, close off the divs of the last one. | |
| 58 | + if ( ! empty( $group ) ) { | |
| 59 | + echo '</div></div>'; | |
| 60 | + } | |
| 61 | + | |
| 62 | + echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>'; | |
| 63 | + // Needs an extra wrapping div for nth-child selectors to work. | |
| 64 | + echo '<div class="plugin-items">'; | |
| 65 | + | |
| 66 | + $group = $plugin['group']; | |
| 67 | + } | |
| 68 | + $title = wp_kses( $plugin['name'], $qcld_chatplugintags ); | |
| 69 | + | |
| 70 | + // Remove any HTML from the description. | |
| 71 | + $description = wp_strip_all_tags( $plugin['short_description'] ); | |
| 72 | + $version = wp_kses( $plugin['version'], $qcld_chatplugintags ); | |
| 73 | + | |
| 74 | + $name = wp_strip_all_tags( $title . ' ' . $version ); | |
| 75 | + | |
| 76 | + $author = wp_kses( $plugin['author'], $qcld_chatplugintags ); | |
| 77 | + if ( ! empty( $author ) ) { | |
| 78 | + /* translators: %s: Plugin author. */ | |
| 79 | + $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>'; | |
| 80 | + } | |
| 81 | + | |
| 82 | + $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null; | |
| 83 | + $requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null; | |
| 84 | + | |
| 85 | + $compatible_php = is_php_version_compatible( $requires_php ); | |
| 86 | + $compatible_wp = is_wp_version_compatible( $requires_wp ); | |
| 87 | + $tested_wp = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) ); | |
| 88 | + | |
| 89 | + $action_links = array(); | |
| 90 | + | |
| 91 | + if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) { | |
| 92 | + $status = install_plugin_install_status( $plugin ); | |
| 93 | + | |
| 94 | + switch ( $status['status'] ) { | |
| 95 | + case 'install': | |
| 96 | + if ( $status['url'] ) { | |
| 97 | + if ( $compatible_php && $compatible_wp ) { | |
| 98 | + $action_links[] = sprintf( | |
| 99 | + '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>', | |
| 100 | + esc_attr( $plugin['slug'] ), | |
| 101 | + esc_url( $status['url'] ), | |
| 102 | + /* translators: %s: Plugin name and version. */ | |
| 103 | + esc_attr( sprintf( _x( 'Install %s now', 'plugin' ), $name ) ), | |
| 104 | + esc_attr( $name ), | |
| 105 | + __( 'Install Now' ) | |
| 106 | + ); | |
| 107 | + } else { | |
| 108 | + $action_links[] = sprintf( | |
| 109 | + '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', | |
| 110 | + _x( 'Cannot Install', 'plugin' ) | |
| 111 | + ); | |
| 112 | + } | |
| 113 | + } | |
| 114 | + break; | |
| 115 | + | |
| 116 | + case 'update_available': | |
| 117 | + if ( $status['url'] ) { | |
| 118 | + if ( $compatible_php && $compatible_wp ) { | |
| 119 | + $action_links[] = sprintf( | |
| 120 | + '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>', | |
| 121 | + esc_attr( $status['file'] ), | |
| 122 | + esc_attr( $plugin['slug'] ), | |
| 123 | + esc_url( $status['url'] ), | |
| 124 | + /* translators: %s: Plugin name and version. */ | |
| 125 | + esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $name ) ), | |
| 126 | + esc_attr( $name ), | |
| 127 | + __( 'Update Now' ) | |
| 128 | + ); | |
| 129 | + } else { | |
| 130 | + $action_links[] = sprintf( | |
| 131 | + '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', | |
| 132 | + _x( 'Cannot Update', 'plugin' ) | |
| 133 | + ); | |
| 134 | + } | |
| 135 | + } | |
| 136 | + break; | |
| 137 | + | |
| 138 | + case 'latest_installed': | |
| 139 | + case 'newer_installed': | |
| 140 | + if ( is_plugin_active( $status['file'] ) ) { | |
| 141 | + $action_links[] = sprintf( | |
| 142 | + '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', | |
| 143 | + _x( 'Active', 'plugin' ) | |
| 144 | + ); | |
| 145 | + } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) { | |
| 146 | + $button_text = __( 'Activate' ); | |
| 147 | + /* translators: %s: Plugin name. */ | |
| 148 | + $button_label = _x( 'Activate %s', 'plugin' ); | |
| 149 | + $activate_url = add_query_arg( | |
| 150 | + array( | |
| 151 | + '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), | |
| 152 | + 'action' => 'activate', | |
| 153 | + 'plugin' => $status['file'], | |
| 154 | + ), | |
| 155 | + network_admin_url( 'plugins.php' ) | |
| 156 | + ); | |
| 157 | + | |
| 158 | + if ( is_network_admin() ) { | |
| 159 | + $button_text = __( 'Network Activate' ); | |
| 160 | + /* translators: %s: Plugin name. */ | |
| 161 | + $button_label = _x( 'Network Activate %s', 'plugin' ); | |
| 162 | + $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); | |
| 163 | + } | |
| 164 | + | |
| 165 | + $action_links[] = sprintf( | |
| 166 | + '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>', | |
| 167 | + esc_url( $activate_url ), | |
| 168 | + esc_attr( sprintf( $button_label, $plugin['name'] ) ), | |
| 169 | + $button_text | |
| 170 | + ); | |
| 171 | + } else { | |
| 172 | + $action_links[] = sprintf( | |
| 173 | + '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', | |
| 174 | + _x( 'Installed', 'plugin' ) | |
| 175 | + ); | |
| 176 | + } | |
| 177 | + break; | |
| 178 | + } | |
| 179 | + } | |
| 180 | + | |
| 181 | + $details_link = self_admin_url( | |
| 182 | + 'plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . | |
| 183 | + '&width=700&height=550' | |
| 184 | + ); | |
| 185 | + $action_links[] = sprintf( '%s','<a href="#" data-toggle="modal" data-target="#myModal">More Details</a><div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button></div><div class="modal-body"><iframe width="100%" height="550" src="'.$details_link.'"></iframe></div></div></div></div>'); | |
| 186 | + /*===show icon ==*/ | |
| 187 | + if ( ! empty( $plugin['icons']['svg'] ) ) { | |
| 188 | + $plugin_icon_url = $plugin['icons']['svg']; | |
| 189 | + } elseif ( ! empty( $plugin['icons']['2x'] ) ) { | |
| 190 | + $plugin_icon_url = $plugin['icons']['2x']; | |
| 191 | + } elseif ( ! empty( $plugin['icons']['1x'] ) ) { | |
| 192 | + $plugin_icon_url = $plugin['icons']['1x']; | |
| 193 | + } else { | |
| 194 | + $plugin_icon_url = $plugin['icons']['default']; | |
| 195 | + } | |
| 196 | + /* | |
| 197 | + * $action_links An array of plugin action links. Defaults are links to Details and Install Now. | |
| 198 | + * $plugin The plugin currently being listed. | |
| 199 | + */ | |
| 200 | + $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin ); | |
| 201 | + | |
| 202 | + $last_updated_timestamp = strtotime( $plugin['last_updated'] ); | |
| 203 | + ?> | |
| 204 | + <div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>"> | |
| 205 | + <?php | |
| 206 | + if ( ! $compatible_php || ! $compatible_wp ) { | |
| 207 | + echo '<div class="notice inline notice-error notice-alt"><p>'; | |
| 208 | + if ( ! $compatible_php && ! $compatible_wp ) { | |
| 209 | + esc_html_e( 'This plugin doesn’t work with your versions of WordPress and PHP.' ); | |
| 210 | + if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { | |
| 211 | + printf( | |
| 212 | + /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ | |
| 213 | + '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.', | |
| 214 | + esc_url( self_admin_url( 'update-core.php' ) ), | |
| 215 | + esc_url( wp_get_update_php_url() ) | |
| 216 | + ); | |
| 217 | + wp_update_php_annotation( '</p><p><em>', '</em>' ); | |
| 218 | + } elseif ( current_user_can( 'update_core' ) ) { | |
| 219 | + printf( | |
| 220 | + /* translators: %s: URL to WordPress Updates screen. */ | |
| 221 | + '<a href="%s">Please update WordPress</a>.', | |
| 222 | + esc_url( self_admin_url( 'update-core.php' ) ) | |
| 223 | + ); | |
| 224 | + } elseif ( current_user_can( 'update_php' ) ) { | |
| 225 | + printf( | |
| 226 | + /* translators: %s: URL to Update PHP page. */ | |
| 227 | + '<a href="%s">Learn more about updating PHP</a>.', | |
| 228 | + esc_url( wp_get_update_php_url() ) | |
| 229 | + ); | |
| 230 | + wp_update_php_annotation( '</p><p><em>', '</em>' ); | |
| 231 | + } | |
| 232 | + } elseif ( ! $compatible_wp ) { | |
| 233 | + esc_html_e( 'This plugin doesn’t work with your version of WordPress.' ); | |
| 234 | + if ( current_user_can( 'update_core' ) ) { | |
| 235 | + printf( | |
| 236 | + /* translators: %s: URL to WordPress Updates screen. */ | |
| 237 | + '<a href="%s">Please update WordPress</a>.', | |
| 238 | + esc_url( self_admin_url( 'update-core.php' ) ) | |
| 239 | + ); | |
| 240 | + } | |
| 241 | + } elseif ( ! $compatible_php ) { | |
| 242 | + esc_html_e( 'This plugin doesn’t work with your version of PHP.' ); | |
| 243 | + if ( current_user_can( 'update_php' ) ) { | |
| 244 | + printf( | |
| 245 | + /* translators: %s: URL to Update PHP page. */ | |
| 246 | + '<a href="%s">Learn more about updating PHP</a>.', | |
| 247 | + esc_url( wp_get_update_php_url() ) | |
| 248 | + ); | |
| 249 | + wp_update_php_annotation( '</p><p><em>', '</em>' ); | |
| 250 | + } | |
| 251 | + } | |
| 252 | + echo '</p></div>'; | |
| 253 | + } | |
| 254 | + ?> | |
| 255 | + <div class="plugin-card-top"> | |
| 256 | + <div class="name column-name"> | |
| 257 | + <h3> | |
| 258 | + <a href="<?php echo esc_url( $details_link ); ?>" class="thickbox open-plugin-details-modal"> | |
| 259 | + <?php echo esc_attr($title); ?> | |
| 260 | + <img src="<?php echo esc_attr( $plugin_icon_url ); ?>" class="plugin-icon" alt="" /> | |
| 261 | + </a> | |
| 262 | + </h3> | |
| 263 | + </div> | |
| 264 | + <div class="action-links"> | |
| 265 | + <?php | |
| 266 | + if ( $action_links ) { | |
| 267 | + // phpcs:ignore | |
| 268 | + echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li></ul>'; | |
| 269 | + } | |
| 270 | + ?> | |
| 271 | + </div> | |
| 272 | + | |
| 273 | + </div> | |
| 274 | + </div> | |
| 275 | + <?php | |
| 276 | + } ?> | |
| 277 | + </div> | |
| 278 | + </div> | |
| 279 | + | |
| 277 | 280 | </div> |