PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.2
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.2
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | class/class-mainwp-error-helper.php +13 -2 5.2.1 → 6.2.2 View file →
@@ -9,8 +9,13 @@
9 9 */
10 10
11 11 namespace MainWP\Dashboard;
12 12
13 +// Exit if accessed directly.
14 +if ( ! defined( 'ABSPATH' ) ) {
15 + exit;
16 +}
17 +
13 18 /**
14 19 * Class MainWP Error Helper
15 20 *
16 21 * @return $error
@@ -21,12 +26,13 @@
21 26 *
22 27 * Check for http error and or "nomainwp" error.
23 28 *
24 29 * @param object $pException Exception object.
30 + * @param bool $escape_msg escape message or not.
25 31 *
26 32 * @return string $error Error message.
27 33 */
28 - public static function get_error_message( $pException ) {
34 + public static function get_error_message( $pException, $escape_msg = false ) {
29 35 $error = $pException->getMessage();
30 36
31 37 if ( $pException->getMessage() === 'HTTPERROR' ) {
32 38 $error = 'HTTP error' . ( ! empty( $pException->get_message_extra() ) ? ' - ' . $pException->get_message_extra() : '' );
@@ -33,8 +39,12 @@
33 39 } elseif ( $pException->getMessage() === 'NOMAINWP' ) {
34 40 $error = static::get_error_not_detected_connect();
35 41 }
36 42
43 + if ( $escape_msg ) {
44 + return esc_html( wp_strip_all_tags( $error ) );
45 + }
46 +
37 47 return $error;
38 48 }
39 49
40 50 /**
@@ -65,7 +75,8 @@
65 75 *
66 76 * @return string @error Error message.
67 77 */
68 78 public static function get_error_not_detected_connect() {
69 - return sprintf( esc_html__( 'MainWP Child plugin not detected or could not be reached! Ensure the MainWP Child plugin is installed and activated on the child site, and there are no security rules blocking requests. If you continue experiencing this issue, check the %1$sMainWP Community%2$s for help.', 'mainwp' ), '<a href="https://managers.mainwp.com/c/community-support/5" target="_blank">', '</a>' );
79 + /* translators: 1: Opening anchor tag, 2: Closing anchor tag */
80 + return sprintf( esc_html__( 'MainWP Child plugin not detected or could not be reached! Ensure the MainWP Child plugin is installed and activated on the child site, and there are no security rules blocking requests. If you continue experiencing this issue, check the %1$sMainWP Community%2$s for help.', 'mainwp' ), '<a href="https://community.mainwp.com/c/community-support/5" target="_blank">', '</a>' );
70 81 }
71 82 }