| @@ -6,12 +6,8 @@ | ||
| 6 | 6 | * |
| 7 | 7 | * @package MainWP/Dashboard |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'FILTER_SANITIZE_STRING_COMPATIBLE' ) ) { // to compatible. | |
| 11 | - define( 'FILTER_SANITIZE_STRING_COMPATIBLE', 513 ); | |
| 12 | -} | |
| 13 | - | |
| 14 | 10 | if ( ! function_exists( 'mainwpdir' ) ) { |
| 15 | 11 | |
| 16 | 12 | /** |
| 17 | 13 | * Grab MainWP Directory |
| @@ -29,14 +25,14 @@ | ||
| 29 | 25 | /** |
| 30 | 26 | * Detect permission level & display message to end user. |
| 31 | 27 | * |
| 32 | 28 | * @param string $where User's location. |
| 33 | - * @param bool $echo_out Defines weather or not to echo error message. | |
| 29 | + * @param bool $echo Defines weather or not to echo error message. | |
| 34 | 30 | * @return string|bool $msg|false |
| 35 | 31 | */ |
| 36 | - function mainwp_do_not_have_permissions( $where = '', $echo_out = true ) { | |
| 37 | - $msg = sprintf( esc_html__( 'You do not have sufficient permissions to access this page (%s).', 'mainwp' ), ucwords( $where ) ); | |
| 38 | - if ( $echo_out ) { | |
| 32 | + function mainwp_do_not_have_permissions( $where = '', $echo = true ) { | |
| 33 | + $msg = sprintf( __( 'You do not have sufficient permissions to access this page (%s).', 'mainwp' ), ucwords( $where ) ); | |
| 34 | + if ( $echo ) { | |
| 39 | 35 | echo '<div class="mainwp-permission-error"><p>' . esc_html( $msg ) . '</p>If you need access to this page please contact the dashboard administrator.</div>'; |
| 40 | 36 | } else { |
| 41 | 37 | return $msg; |
| 42 | 38 | } |
| @@ -56,57 +52,11 @@ | ||
| 56 | 52 | * @param string $cap Capabilities for current user. |
| 57 | 53 | * |
| 58 | 54 | * @return bool true|false |
| 59 | 55 | */ |
| 60 | - function mainwp_current_user_can( $cap_type = '', $cap = '' ) { | |
| 56 | + function mainwp_current_user_can( $cap_type = '', $cap ) { | |
| 61 | 57 | if ( function_exists( 'MainWP\Dashboard\mainwp_current_user_have_right' ) ) { |
| 62 | 58 | return MainWP\Dashboard\mainwp_current_user_have_right( $cap_type, $cap ); |
| 63 | 59 | } |
| 64 | 60 | return true; |
| 65 | - } | |
| 66 | -} | |
| 67 | - | |
| 68 | -if ( ! function_exists( 'mainwp_get_actions_handler_instance' ) ) { | |
| 69 | - | |
| 70 | - /** | |
| 71 | - * Function to get mainwp actions handler instance. | |
| 72 | - * | |
| 73 | - * @return bool true|false | |
| 74 | - */ | |
| 75 | - function mainwp_get_actions_handler_instance() { | |
| 76 | - return \MainWP\Dashboard\MainWP_Actions_Handler::instance(); | |
| 77 | - } | |
| 78 | -} | |
| 79 | - | |
| 80 | -if ( ! function_exists( 'mainwp_send_json_output' ) ) { | |
| 81 | - /** | |
| 82 | - * Handle send json output. | |
| 83 | - * | |
| 84 | - * @param array $output Array output. | |
| 85 | - */ | |
| 86 | - function mainwp_send_json_output( $output ) { | |
| 87 | - if ( is_array( $output ) ) { | |
| 88 | - $output['execute_time'] = \MainWP\Dashboard\MainWP_Execution_Helper::instance()->get_exec_time(); | |
| 89 | - } | |
| 90 | - wp_send_json( $output ); | |
| 91 | - } | |
| 92 | -} | |
| 93 | - | |
| 94 | - | |
| 95 | -if ( ! function_exists( 'mainwp_modules_is_enabled' ) ) { | |
| 96 | - | |
| 97 | - /** | |
| 98 | - * Check if module is enable. | |
| 99 | - * | |
| 100 | - * @param string $module module slug. | |
| 101 | - * | |
| 102 | - * @return bool true|false | |
| 103 | - */ | |
| 104 | - function mainwp_modules_is_enabled( $module ) { | |
| 105 | - $enable_mainwp_modules = array( | |
| 106 | - 'logs' => defined( 'MAINWP_MODULE_LOG_ENABLED' ) && MAINWP_MODULE_LOG_ENABLED ? true : false, | |
| 107 | - 'cost-tracker' => defined( 'MAINWP_MODULE_COST_TRACKER_ENABLED' ) && MAINWP_MODULE_COST_TRACKER_ENABLED ? true : false, | |
| 108 | - 'api-backups' => defined( 'MAINWP_MODULE_API_BACKUPS_ENABLED' ) && MAINWP_MODULE_API_BACKUPS_ENABLED ? true : false, | |
| 109 | - ); | |
| 110 | - return ! empty( $enable_mainwp_modules[ $module ] ) ? true : false; | |
| 111 | 61 | } |
| 112 | 62 | } |