bar-preview.php
7 months ago
bar-settings.php
1 year ago
customize-bar.php
7 months ago
display-rules.php
7 months ago
email-signup.php
7 months ago
help.php
9 months ago
poptin-plugin.php
7 months ago
poptin-popup.php
7 months ago
stickymenu-dashboard.php
9 months ago
poptin-plugin.php
353 lines
| 1 | <?php |
| 2 | // You may comment this out IF you're sure the function exists. |
| 3 | require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
| 4 | remove_all_filters('plugins_api'); |
| 5 | $plugins_allowedtags = array( |
| 6 | 'a' => array( |
| 7 | 'href' => array(), |
| 8 | 'title' => array(), |
| 9 | 'target' => array(), |
| 10 | ), |
| 11 | 'abbr' => array( 'title' => array() ), |
| 12 | 'acronym' => array( 'title' => array() ), |
| 13 | 'code' => array(), |
| 14 | 'pre' => array(), |
| 15 | 'em' => array(), |
| 16 | 'strong' => array(), |
| 17 | 'ul' => array(), |
| 18 | 'ol' => array(), |
| 19 | 'li' => array(), |
| 20 | 'p' => array(), |
| 21 | 'br' => array(), |
| 22 | ); |
| 23 | |
| 24 | /* Poptin Plugins */ |
| 25 | $args = [ |
| 26 | 'slug' => 'poptin', |
| 27 | 'fields' => [ |
| 28 | 'short_description' => true, |
| 29 | 'icons' => true, |
| 30 | 'reviews' => false, // excludes all reviews |
| 31 | ], |
| 32 | ]; |
| 33 | $data = plugins_api( 'plugin_information', $args ); |
| 34 | $poptin_plugin = array(); |
| 35 | if ( $data && ! is_wp_error( $data ) ) { |
| 36 | $poptin_plugin['poptin'] = $data; |
| 37 | $poptin_plugin['poptin']->name = 'Poptin: Beautiful Pop Ups and Embedded Inline Contact Forms for Your Website'; |
| 38 | $poptin_plugin['poptin']->short_description = 'Pop ups and contact forms builder for your website. Get more sales, leads, and subscribers with beautiful popups & inline forms templates, no coding skills required'; |
| 39 | } |
| 40 | ?> |
| 41 | <div class="wrap mystickyelement-wrap recommended-plugins"> |
| 42 | <h2> |
| 43 | <?php _e('Install Poptin', 'mystickymenu'); ?> |
| 44 | </h2> |
| 45 | </div> |
| 46 | <div class="wrap recommended-plugins"> |
| 47 | <div class="wp-list-table widefat plugin-install"> |
| 48 | <div class="the-list"> |
| 49 | <?php |
| 50 | foreach ( (array) $poptin_plugin as $plugin ) { |
| 51 | if ( is_object( $plugin ) ) { |
| 52 | $plugin = (array) $plugin; |
| 53 | } |
| 54 | |
| 55 | // Display the group heading if there is one. |
| 56 | if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) { |
| 57 | if ( isset( $this->groups[ $plugin['group'] ] ) ) { |
| 58 | $group_name = $this->groups[ $plugin['group'] ]; |
| 59 | if ( isset( $plugins_group_titles[ $group_name ] ) ) { |
| 60 | $group_name = $plugins_group_titles[ $group_name ]; |
| 61 | } |
| 62 | } else { |
| 63 | $group_name = $plugin['group']; |
| 64 | } |
| 65 | |
| 66 | // Starting a new group, close off the divs of the last one. |
| 67 | if ( ! empty( $group ) ) { |
| 68 | echo '</div></div>'; |
| 69 | } |
| 70 | |
| 71 | echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>'; |
| 72 | // Needs an extra wrapping div for nth-child selectors to work. |
| 73 | echo '<div class="plugin-items">'; |
| 74 | |
| 75 | $group = $plugin['group']; |
| 76 | } |
| 77 | $title = wp_kses( $plugin['name'], $plugins_allowedtags ); |
| 78 | |
| 79 | // Remove any HTML from the description. |
| 80 | $description = strip_tags( $plugin['short_description'] ); |
| 81 | $version = wp_kses( $plugin['version'], $plugins_allowedtags ); |
| 82 | |
| 83 | $name = strip_tags( $title . ' ' . $version ); |
| 84 | |
| 85 | $author = wp_kses( $plugin['author'], $plugins_allowedtags ); |
| 86 | if ( ! empty( $author ) ) { |
| 87 | /* translators: %s: Plugin author. */ |
| 88 | $author = ' <cite>' . sprintf( __( 'By %s', 'mystickymenu' ), $author ) . '</cite>'; |
| 89 | } |
| 90 | |
| 91 | $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null; |
| 92 | $requires_wp = isset( $plugin['requires'] ) ? $plugin['requires'] : null; |
| 93 | |
| 94 | $compatible_php = is_php_version_compatible( $requires_php ); |
| 95 | $compatible_wp = is_wp_version_compatible( $requires_wp ); |
| 96 | $tested_wp = ( empty( $plugin['tested'] ) || version_compare( get_bloginfo( 'version' ), $plugin['tested'], '<=' ) ); |
| 97 | |
| 98 | $action_links = array(); |
| 99 | |
| 100 | if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) { |
| 101 | $status = install_plugin_install_status( $plugin ); |
| 102 | |
| 103 | switch ( $status['status'] ) { |
| 104 | case 'install': |
| 105 | if ( $status['url'] ) { |
| 106 | if ( $compatible_php && $compatible_wp ) { |
| 107 | $action_links[] = sprintf( |
| 108 | '<a class="install-now button" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>', |
| 109 | esc_attr( $plugin['slug'] ), |
| 110 | esc_url( $status['url'] ), |
| 111 | /* translators: %s: Plugin name and version. */ |
| 112 | esc_attr( sprintf( _x( 'Install %s now', 'plugin', 'mystickymenu' ), $name ) ), |
| 113 | esc_attr( $name ), |
| 114 | __( 'Install Now', 'mystickymenu' ) |
| 115 | ); |
| 116 | } else { |
| 117 | $action_links[] = sprintf( |
| 118 | '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
| 119 | _x( 'Cannot Install', 'plugin', 'mystickymenu' ) |
| 120 | ); |
| 121 | } |
| 122 | } |
| 123 | break; |
| 124 | |
| 125 | case 'update_available': |
| 126 | if ( $status['url'] ) { |
| 127 | if ( $compatible_php && $compatible_wp ) { |
| 128 | $action_links[] = sprintf( |
| 129 | '<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>', |
| 130 | esc_attr( $status['file'] ), |
| 131 | esc_attr( $plugin['slug'] ), |
| 132 | esc_url( $status['url'] ), |
| 133 | /* translators: %s: Plugin name and version. */ |
| 134 | esc_attr( sprintf( _x( 'Update %s now', 'plugin', 'mystickymenu' ), $name ) ), |
| 135 | esc_attr( $name ), |
| 136 | __( 'Update Now', 'mystickymenu' ) |
| 137 | ); |
| 138 | } else { |
| 139 | $action_links[] = sprintf( |
| 140 | '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
| 141 | _x( 'Cannot Update', 'plugin', 'mystickymenu' ) |
| 142 | ); |
| 143 | } |
| 144 | } |
| 145 | break; |
| 146 | |
| 147 | case 'latest_installed': |
| 148 | case 'newer_installed': |
| 149 | if ( is_plugin_active( $status['file'] ) ) { |
| 150 | $action_links[] = sprintf( |
| 151 | '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
| 152 | _x( 'Active', 'plugin', 'mystickymenu' ) |
| 153 | ); |
| 154 | } elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) { |
| 155 | $button_text = __( 'Activate', 'mystickymenu' ); |
| 156 | /* translators: %s: Plugin name. */ |
| 157 | $button_label = _x( 'Activate %s', 'plugin', 'mystickymenu' ); |
| 158 | $activate_url = add_query_arg( |
| 159 | array( |
| 160 | '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ), |
| 161 | 'action' => 'activate', |
| 162 | 'plugin' => $status['file'], |
| 163 | ), |
| 164 | network_admin_url( 'plugins.php' ) |
| 165 | ); |
| 166 | |
| 167 | if ( is_network_admin() ) { |
| 168 | $button_text = __( 'Network Activate', 'mystickymenu' ); |
| 169 | /* translators: %s: Plugin name. */ |
| 170 | $button_label = _x( 'Network Activate %s', 'plugin', 'mystickymenu' ); |
| 171 | $activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url ); |
| 172 | } |
| 173 | |
| 174 | $action_links[] = sprintf( |
| 175 | '<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>', |
| 176 | esc_url( $activate_url ), |
| 177 | esc_attr( sprintf( $button_label, $plugin['name'] ) ), |
| 178 | $button_text |
| 179 | ); |
| 180 | } else { |
| 181 | $action_links[] = sprintf( |
| 182 | '<button type="button" class="button button-disabled" disabled="disabled">%s</button>', |
| 183 | _x( 'Installed', 'plugin', 'mystickymenu' ) |
| 184 | ); |
| 185 | } |
| 186 | break; |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | $details_link = self_admin_url( |
| 191 | 'plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . |
| 192 | '&TB_iframe=true&width=600&height=550' |
| 193 | ); |
| 194 | |
| 195 | $action_links[] = sprintf( |
| 196 | '<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>', |
| 197 | esc_url( $details_link ), |
| 198 | /* translators: %s: Plugin name and version. */ |
| 199 | esc_attr( sprintf( __( 'More information about %s', 'mystickymenu' ), $name ) ), |
| 200 | esc_attr( $name ), |
| 201 | __( 'More Details', 'mystickymenu' ) |
| 202 | ); |
| 203 | |
| 204 | if ( ! empty( $plugin['icons']['svg'] ) ) { |
| 205 | $plugin_icon_url = $plugin['icons']['svg']; |
| 206 | } elseif ( ! empty( $plugin['icons']['2x'] ) ) { |
| 207 | $plugin_icon_url = $plugin['icons']['2x']; |
| 208 | } elseif ( ! empty( $plugin['icons']['1x'] ) ) { |
| 209 | $plugin_icon_url = $plugin['icons']['1x']; |
| 210 | } else { |
| 211 | $plugin_icon_url = $plugin['icons']['default']; |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Filters the install action links for a plugin. |
| 216 | * |
| 217 | * @since 2.7.0 |
| 218 | * |
| 219 | * @param string[] $action_links An array of plugin action links. Defaults are links to Details and Install Now. |
| 220 | * @param array $plugin The plugin currently being listed. |
| 221 | */ |
| 222 | $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin ); |
| 223 | |
| 224 | $last_updated_timestamp = strtotime( $plugin['last_updated'] ); |
| 225 | ?> |
| 226 | <div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>"> |
| 227 | <?php |
| 228 | if ( ! $compatible_php || ! $compatible_wp ) { |
| 229 | echo '<div class="notice inline notice-error notice-alt"><p>'; |
| 230 | if ( ! $compatible_php && ! $compatible_wp ) { |
| 231 | _e( 'This plugin doesn’t work with your versions of WordPress and PHP.', 'mystickymenu' ); |
| 232 | if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
| 233 | printf( |
| 234 | /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
| 235 | ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.', 'mystickymenu' ), |
| 236 | self_admin_url( 'update-core.php' ), |
| 237 | esc_url( wp_get_update_php_url() ) |
| 238 | ); |
| 239 | wp_update_php_annotation( '</p><p><em>', '</em>' ); |
| 240 | } elseif ( current_user_can( 'update_core' ) ) { |
| 241 | printf( |
| 242 | /* translators: %s: URL to WordPress Updates screen. */ |
| 243 | ' ' . __( '<a href="%s">Please update WordPress</a>.', 'mystickymenu' ), |
| 244 | self_admin_url( 'update-core.php' ) |
| 245 | ); |
| 246 | } elseif ( current_user_can( 'update_php' ) ) { |
| 247 | printf( |
| 248 | /* translators: %s: URL to Update PHP page. */ |
| 249 | ' ' . __( '<a href="%s">Learn more about updating PHP</a>.', 'mystickymenu' ), |
| 250 | esc_url( wp_get_update_php_url() ) |
| 251 | ); |
| 252 | wp_update_php_annotation( '</p><p><em>', '</em>' ); |
| 253 | } |
| 254 | } elseif ( ! $compatible_wp ) { |
| 255 | _e( 'This plugin doesn’t work with your version of WordPress.', 'mystickymenu' ); |
| 256 | if ( current_user_can( 'update_core' ) ) { |
| 257 | printf( |
| 258 | /* translators: %s: URL to WordPress Updates screen. */ |
| 259 | ' ' . __( '<a href="%s">Please update WordPress</a>.', 'mystickymenu' ), |
| 260 | self_admin_url( 'update-core.php' ) |
| 261 | ); |
| 262 | } |
| 263 | } elseif ( ! $compatible_php ) { |
| 264 | _e( 'This plugin doesn’t work with your version of PHP.', 'mystickymenu' ); |
| 265 | if ( current_user_can( 'update_php' ) ) { |
| 266 | printf( |
| 267 | /* translators: %s: URL to Update PHP page. */ |
| 268 | ' ' . __( '<a href="%s">Learn more about updating PHP</a>.', 'mystickymenu' ), |
| 269 | esc_url( wp_get_update_php_url() ) |
| 270 | ); |
| 271 | wp_update_php_annotation( '</p><p><em>', '</em>' ); |
| 272 | } |
| 273 | } |
| 274 | echo '</p></div>'; |
| 275 | } |
| 276 | ?> |
| 277 | <div class="plugin-card-top"> |
| 278 | <div class="name column-name"> |
| 279 | <h3> |
| 280 | <a href="<?php echo esc_url( $details_link ); ?>" class="thickbox open-plugin-details-modal"> |
| 281 | <?php echo wp_kses($title, $plugins_allowedtags); ?> |
| 282 | <img src="<?php echo esc_attr( $plugin_icon_url ); ?>" class="plugin-icon" alt="" /> |
| 283 | </a> |
| 284 | </h3> |
| 285 | </div> |
| 286 | <div class="action-links"> |
| 287 | <?php |
| 288 | if ( $action_links ) { |
| 289 | echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li></ul>'; |
| 290 | } |
| 291 | ?> |
| 292 | </div> |
| 293 | <div class="desc column-description"> |
| 294 | <p><?php echo wp_kses($description, $plugins_allowedtags); ?></p> |
| 295 | <p class="authors"><?php echo wp_kses($author, $plugins_allowedtags); ?></p> |
| 296 | </div> |
| 297 | </div> |
| 298 | <div class="plugin-card-bottom"> |
| 299 | <div class="vers column-rating"> |
| 300 | <?php |
| 301 | wp_star_rating( |
| 302 | array( |
| 303 | 'rating' => $plugin['rating'], |
| 304 | 'type' => 'percent', |
| 305 | 'number' => $plugin['num_ratings'], |
| 306 | ) |
| 307 | ); |
| 308 | ?> |
| 309 | <span class="num-ratings" aria-hidden="true">(<?php echo number_format_i18n( $plugin['num_ratings'] ); ?>)</span> |
| 310 | </div> |
| 311 | <div class="column-updated"> |
| 312 | <strong><?php _e( 'Last Updated:', 'mystickymenu' ); ?></strong> |
| 313 | <?php |
| 314 | /* translators: %s: Human-readable time difference. */ |
| 315 | printf( __( '%s ago', 'mystickymenu' ), human_time_diff( $last_updated_timestamp ) ); |
| 316 | ?> |
| 317 | </div> |
| 318 | <div class="column-downloaded"> |
| 319 | <?php |
| 320 | if ( $plugin['active_installs'] >= 1000000 ) { |
| 321 | $active_installs_millions = floor( $plugin['active_installs'] / 1000000 ); |
| 322 | $active_installs_text = sprintf( |
| 323 | /* translators: %s: Number of millions. */ |
| 324 | _nx( '%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations', 'mystickymenu' ), |
| 325 | number_format_i18n( $active_installs_millions ) |
| 326 | ); |
| 327 | } elseif ( 0 == $plugin['active_installs'] ) { |
| 328 | $active_installs_text = _x( 'Less Than 10', 'Active plugin installations', 'mystickymenu' ); |
| 329 | } else { |
| 330 | $active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+'; |
| 331 | } |
| 332 | /* translators: %s: Number of installations. */ |
| 333 | printf( __( '%s Active Installations', 'mystickymenu' ), $active_installs_text ); |
| 334 | ?> |
| 335 | </div> |
| 336 | <div class="column-compatibility"> |
| 337 | <?php |
| 338 | if ( ! $tested_wp ) { |
| 339 | echo '<span class="compatibility-untested">' . __( 'Untested with your version of WordPress', 'mystickymenu' ) . '</span>'; |
| 340 | } elseif ( ! $compatible_wp ) { |
| 341 | echo '<span class="compatibility-incompatible">' . __( '<strong>Incompatible</strong> with your version of WordPress', 'mystickymenu' ) . '</span>'; |
| 342 | } else { |
| 343 | echo '<span class="compatibility-compatible">' . __( '<strong>Compatible</strong> with your version of WordPress', 'mystickymenu' ) . '</span>'; |
| 344 | } |
| 345 | ?> |
| 346 | </div> |
| 347 | </div> |
| 348 | </div> |
| 349 | <?php |
| 350 | } ?> |
| 351 | </div> |
| 352 | </div> |
| 353 | </div> |