', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', chr( 0 ), ], '', $directory ); } /** * Escapes a URL, adding https by default if protocol is not specified. * * @param string $url The URL to escape. * @param array|null $protocols A list of allowed protocols. * * @return string The escaped URL. */ function backwpup_esc_url_default_secure( $url, $protocols = null ) { // Add https to protocols if not present. if ( is_array( $protocols ) && ! in_array( 'https', $protocols, true ) ) { $protocols[] = 'https'; } $escaped_url = esc_url_raw( $url, $protocols ); if ( empty( $escaped_url ) ) { return $escaped_url; } // We must check for both http: and http;. // Because esc_url_raw() corrects http; to http: automatically. // So if we do not check for it in the original, we could have invalid results. if ( ! preg_match( '/http[:;]/', $url ) && strpos( $escaped_url, 'http://' ) === 0 ) { $escaped_url = preg_replace( '/^http:/', 'https:', $escaped_url ); } return $escaped_url; } /** * Compatibility code for cal_days_in_month. * * @param int $month Month. * @param int $year Year. * * @return int */ function backwpup_cal_days_in_month( $month, $year ) { $month = (int) $month; $year = (int) $year; // Array of the number of days in each month for a non-leap year. $days_in_months = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]; // Check if the month is February and if the year is a leap year. if ( 2 === $month && ( ( 0 === ( $year % 4 ) && 0 !== ( $year % 100 ) ) || ( 0 === $year % 400 ) ) ) { return 29; // February in a leap year has 29 days. } // Return the number of days for the given month. return $days_in_months[ $month - 1 ]; } /** * Outputs notice HTML * * @param array $args An array of arguments used to determine the notice output. * @return void */ function backwpup_notice_html( $args ) { $defaults = [ 'status' => 'success', 'dismissible' => 'is-dismissible', 'message' => '', 'action' => '', 'dismiss_button' => false, 'dismiss_button_message' => __( 'Dismiss this notice', 'backwpup' ), 'readonly_content' => '', 'id' => '', ]; $args = wp_parse_args( $args, $defaults ); switch ( $args['action'] ) { case 'dropbox': case 'legacy_jobs': $args['action'] = ''; // This can be a specific action to be carried out. break; } $notice_id = ''; if ( ! empty( $args['id'] ) ) { $notice_id = ' id="' . esc_attr( $args['id'] ) . '"'; } ?>
class="notice notice-inpsyde notice- ">

' : '' ) . $args['message'] . ( $tag ? '

' : '' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Dynamic content is properly escaped in the view. ?>