after-kubio-activation.php
4 months ago
allow-kubio-blog-override.php
2 years ago
cache-plugins.php
4 years ago
default-editor-overlay.php
1 year ago
dismissable-notice.php
1 month ago
gutenerg-plugin-check.php
1 year ago
image-size-auto-fix.php
1 year ago
kubio-fresh-site.php
2 years ago
post-insert.php
3 months ago
register-meta-fields.php
3 years ago
requirements-notices.php
1 year ago
site-urls.php
1 year ago
starter-sites-feature.php
1 year ago
svg-kses.php
1 year ago
wp-import.php
2 months ago
requirements-notices.php
137 lines
| 1 | <?php |
| 2 | |
| 3 | use Kubio\Core\Utils; |
| 4 | |
| 5 | function _kubio_requirements_not_met_notice() { |
| 6 | $has_valid_req = Utils::validateRequirements(); |
| 7 | list($error_message) = _wp_die_process_input( $has_valid_req ); |
| 8 | |
| 9 | $plugin_headers = get_plugin_data( KUBIO_ENTRY_FILE ); |
| 10 | include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 11 | $required_php = ! empty( $plugin_headers['RequiresPHP'] ) ? $plugin_headers['RequiresPHP'] : ''; |
| 12 | |
| 13 | // translators: %s - php version e.g. 7.2 |
| 14 | $required_php = sprintf( __( 'PHP %1$s', 'kubio' ), $required_php ); |
| 15 | |
| 16 | // translators: %s - WordPress version e.g. 5.0 |
| 17 | $required_wp = sprintf( __( 'WordPress %1$s', 'kubio' ), KUBIO_MINIMUM_WP_VERSION ); |
| 18 | $requirement_message = ''; |
| 19 | |
| 20 | if ( $has_valid_req->get_error_code() === 'plugin_wp_incompatible' ) { |
| 21 | |
| 22 | $requirement_message = $required_wp; |
| 23 | } |
| 24 | if ( $has_valid_req->get_error_code() === 'plugin_wp_php_incompatible' ) { |
| 25 | $requirement_message = sprintf( |
| 26 | // translators: %1$s and %2$s - PHP and WordPress versions version e.g. 5.0 |
| 27 | esc_html__( '%1$s and %2$s', 'kubio' ), |
| 28 | $required_wp, |
| 29 | $required_php |
| 30 | ); |
| 31 | } |
| 32 | |
| 33 | if ( $has_valid_req->get_error_code() === 'plugin_php_incompatible' ) { |
| 34 | $requirement_message = $required_php; |
| 35 | } |
| 36 | |
| 37 | $kubio_previous_versions = Utils::getPluginVersions( true ); |
| 38 | $previous_version = isset( $kubio_previous_versions['1.4.3'] ) ? $kubio_previous_versions['1.4.3'] : null; |
| 39 | |
| 40 | $kubio_rollback_message = sprintf( |
| 41 | // translators: the placeholders are urls or a product name |
| 42 | __( 'If you want to rollback to a previous version you can get it here: <a href="%1$s">%2$s</a>. You can follow this steps to manually install a Kubio: <a target="_blank" href="%3$s">Manual plugin update</a>', 'kubio' ), |
| 43 | $previous_version ['url'], |
| 44 | $previous_version ['named_version'], |
| 45 | 'https://kubiobuilder.com/documentation/how-to-manually-update-kubio' |
| 46 | ); |
| 47 | |
| 48 | $kubio_rollback_message = apply_filters( 'kubio/rollback/rollback_notice_message', $kubio_rollback_message ); |
| 49 | |
| 50 | ?> |
| 51 | <style> |
| 52 | .kubio-mrn { |
| 53 | display: flex; |
| 54 | align-items: flex-start; |
| 55 | padding: 12px 0; |
| 56 | } |
| 57 | |
| 58 | .kubio-mrn svg { |
| 59 | width: 20px; |
| 60 | display: block; |
| 61 | fill: #D63638; |
| 62 | } |
| 63 | |
| 64 | .kubio-mrn-icon-wrapper { |
| 65 | width: 60px; |
| 66 | height: 60px; |
| 67 | display: flex; |
| 68 | align-items: center; |
| 69 | background: rgb(214 ,54 ,56,.1); |
| 70 | align-content: center; |
| 71 | justify-items: center; |
| 72 | justify-content: center; |
| 73 | border-radius: 60px; |
| 74 | } |
| 75 | |
| 76 | .kubio-mrn-icon-holder {padding-right: 12px;} |
| 77 | .kubio-mrn-content-wrapper h2, |
| 78 | .kubio-mrn-content-wrapper p{ |
| 79 | margin: 0; |
| 80 | padding: 0; |
| 81 | } |
| 82 | |
| 83 | .kubio-mrn-content-wrapper h2{ |
| 84 | margin-bottom: 10px; |
| 85 | } |
| 86 | .kubio-mrn-content-wrapper a { |
| 87 | font-weight: 500; |
| 88 | } |
| 89 | |
| 90 | </style> |
| 91 | <div class="kubio-mrn"> |
| 92 | <div class="kubio-mrn-icon-holder"> |
| 93 | <div class="kubio-mrn-icon-wrapper"> |
| 94 | <?php echo wp_kses_post( KUBIO_LOGO_SVG ); ?> |
| 95 | </div> |
| 96 | |
| 97 | </div> |
| 98 | <div class="kubio-mrn-content-wrapper"> |
| 99 | <h2> |
| 100 | <?php |
| 101 | |
| 102 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 103 | echo sprintf( |
| 104 | // translators: %s required message. e.g. WordPress 6.0 and PHP 7.2 |
| 105 | esc_html__( 'Kubio Page Builder requires %s!', 'kubio' ), |
| 106 | // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 107 | $requirement_message |
| 108 | ); |
| 109 | ?> |
| 110 | </h2> |
| 111 | <?php echo wp_kses_post( $error_message ); ?> |
| 112 | <p class="kubio-mrn-rollback-message"> |
| 113 | <?php echo wp_kses_post( $kubio_rollback_message ); ?> |
| 114 | </p> |
| 115 | </div> |
| 116 | </div> |
| 117 | <?php |
| 118 | } |
| 119 | |
| 120 | add_action( |
| 121 | 'init', |
| 122 | function () { |
| 123 | $has_valid_req = Utils::validateRequirements(); |
| 124 | |
| 125 | if ( is_wp_error( $has_valid_req ) ) { |
| 126 | kubio_add_dismissable_notice( |
| 127 | 'kubio_requirements_notice', |
| 128 | '_kubio_requirements_not_met_notice', |
| 129 | 1, // set time limit to a small amount to always display the notice |
| 130 | array(), |
| 131 | 'notice-error' |
| 132 | ); |
| 133 | } |
| 134 | }, |
| 135 | 5 |
| 136 | ); |
| 137 |