/home/fortodpl/thecutediva.com/wp-content/plugins/litespeed-cache/src/admin-display.cls.php (49929B)
' . esc_html( $cdn_url ) . '' );
$localize_data['lang']['one_per_line'] = Doc::one_per_line( true );
$localize_data['lang']['cdn_mapping_remove'] = __( 'Remove CDN URL', 'litespeed-cache' );
$localize_data['lang']['add_cdn_mapping_row'] = __( 'Add new CDN URL', 'litespeed-cache' );
$localize_data['lang']['cdn_file_types_url'] = 'https://docs.litespeedtech.com/lscache/lscwp/cdn/#include-file-types';
$localize_data['lang']['cdn_file_types_link_text'] = __( 'Learn more about file types', 'litespeed-cache' );
$localize_data['lang']['on'] = __( 'ON', 'litespeed-cache' );
$localize_data['lang']['off'] = __( 'OFF', 'litespeed-cache' );
if ( empty( $localize_data['ids'] ) ) {
$localize_data['ids'] = [];
}
$localize_data['ids']['cdn_mapping'] = self::O_CDN_MAPPING;
}
}
// Load iziModal JS and CSS
$show_deactivation_modal = ( is_multisite() && ! is_network_admin() ) ? false : true;
// Once the survey has been answered on a prior deactivation, suppress the modal for good.
if ( file_exists( LITESPEED_STATIC_DIR . '/' . Activation::SURVEY_DONE_FLAG ) ) {
$show_deactivation_modal = false;
}
if ( $show_deactivation_modal && 'plugins.php' === $pagenow ) {
wp_enqueue_script( Core::PLUGIN_NAME . '-iziModal', LSWCP_PLUGIN_URL . 'assets/js/iziModal.min.js', [], Core::VER, true );
wp_enqueue_style( Core::PLUGIN_NAME . '-iziModal', LSWCP_PLUGIN_URL . 'assets/css/iziModal.min.css', [], Core::VER, 'all' );
add_action( 'admin_footer', [ $this, 'add_deactivation_html' ] );
}
if ( $localize_data ) {
wp_localize_script( Core::PLUGIN_NAME, 'litespeed_data', $localize_data );
}
wp_enqueue_script( Core::PLUGIN_NAME );
}
/**
* Add modal HTML on Plugins screen.
*
* @since 7.3
* @return void
*/
public function add_deactivation_html() {
require LSCWP_DIR . 'tpl/inc/modal.deactivation.php';
}
/**
* Filter the script tag for specific handles to set Babel type.
*
* @since 3.6
*
* @param string $tag The script tag.
* @param string $handle Script handle.
* @param string $src Script source URL.
* @return string The filtered script tag.
*/
public function babel_type( $tag, $handle, $src ) {
if ( Core::PLUGIN_NAME . '-crawler' !== $handle && Core::PLUGIN_NAME . '-cdn' !== $handle ) {
return $tag;
}
// phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
return '';
}
/**
* Callback that adds LiteSpeed Cache's action links.
*
* @since 1.0.0
*
* @param array' . wp_kses_post( $str ) . '
' . esc_html__( 'Dismiss', 'litespeed-cache' ) . '' . '
'; } echo wp_kses_post( $msg ); } } if ( empty( $_GET['page'] ) || 0 !== strpos( sanitize_text_field( wp_unslash( $_GET['page'] ) ), 'litespeed' ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended global $pagenow; if ( 'plugins.php' !== $pagenow ) { return; } } if ( ! $this->conf( self::O_NEWS ) ) { return; } // Show promo from cloud Cloud::cls()->show_promo(); /** * Check promo msg first * * @since 2.9 */ GUI::cls()->show_promo(); // Show version news Cloud::cls()->news(); } /** * Dismiss pinned msg. * * @since 3.5.2 * @return void */ public static function dismiss_pin() { if ( ! isset( $_GET['msgid'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended return; } $messages = self::get_option( self::DB_MSG_PIN, [] ); $msgid = sanitize_text_field( wp_unslash( $_GET['msgid'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( ! is_array( $messages ) || empty( $messages[ $msgid ] ) ) { return; } unset( $messages[ $msgid ] ); if ( ! $messages ) { $messages = -1; } self::update_option( self::DB_MSG_PIN, $messages ); } /** * Dismiss pinned msg by msg content. * * @since 7.0 * * @param string $content Message content. * @param string $color Color CSS class. * @param bool $irremovable Is irremovable. * @return void */ public static function dismiss_pin_by_content( $content, $color, $irremovable ) { $content = self::build_notice( $color, $content, $irremovable ); $messages = self::get_option( self::DB_MSG_PIN, [] ); $hit = false; if ( -1 !== $messages ) { foreach ( $messages as $k => $v ) { if ( $v === $content ) { unset( $messages[ $k ] ); $hit = true; self::debug( '✅ pinned msg content hit. Removed' ); break; } } } if ( $hit ) { if ( ! $messages ) { $messages = -1; } self::update_option( self::DB_MSG_PIN, $messages ); } else { self::debug( '❌ No pinned msg content hit' ); } } /** * Hooked to the in_widget_form action. * Appends LiteSpeed Cache settings to the widget edit settings screen. * This will append the esi on/off selector and ttl text. * * @since 1.1.0 * * @param \WP_Widget $widget The widget instance (passed by reference). * @param mixed $return_val Return param (unused). * @param array $instance The widget instance's settings. * @return void */ public function show_widget_edit( $widget, $return_val, $instance ) { require LSCWP_DIR . 'tpl/esi_widget_edit.php'; } /** * Outputs a notice when the plugin is installed via WHM. * * @since 1.0.12 * @return void */ public function show_display_installed() { require_once LSCWP_DIR . 'tpl/inc/show_display_installed.php'; } /** * Display error cookie msg. * * @since 1.0.12 * @return void */ public static function show_error_cookie() { require_once LSCWP_DIR . 'tpl/inc/show_error_cookie.php'; } /** * Display warning if lscache is disabled. * * @since 2.1 * @return void */ public function cache_disabled_warning() { include LSCWP_DIR . 'tpl/inc/check_cache_disabled.php'; } /** * Display conf data upgrading banner. * * @since 2.1 * @access private * @return void */ private function _in_upgrading() { include LSCWP_DIR . 'tpl/inc/in_upgrading.php'; } /** * Output LiteSpeed form open tag and hidden fields. * * @since 3.0 * * @param string|false $action Router action. * @param string|false $type Router type. * @param bool $has_upload Whether form has file uploads. * @return void */ public function form_action( $action = false, $type = false, $has_upload = false ) { if ( ! $action ) { $action = Router::ACTION_SAVE_SETTINGS; } if ( ! defined( 'LITESPEED_CONF_LOADED' ) ) { echo '' . esc_html( Base::conf_const( $id ) ) . '' );
} elseif ( is_multisite() ) {
// Show multisite overwrite.
if ( get_current_blog_id() !== BLOG_ID_CURRENT_SITE && $this->conf( self::NETWORK_O_USE_PRIMARY ) ) {
echo esc_html__( 'This value is overwritten by the primary site setting.', 'litespeed-cache' );
} else {
echo esc_html__( 'This value is overwritten by the Network setting.', 'litespeed-cache' );
}
} elseif ( null !== $filter_val ) {
// Show filter value.
echo esc_html__( 'This value is overwritten by the filter.', 'litespeed-cache' );
}
echo ' ' . sprintf( esc_html__( 'Currently set to %s', 'litespeed-cache' ), '' . esc_html( $val ) . '' ) . '%s',
esc_html__( 'Default value', 'litespeed-cache' ),
esc_html( $val )
);
return;
}
$rows = 5;
$cols = 30;
// Flexible rows/cols.
$lines = count( $val ) + 1;
$rows = min( max( $lines, $rows ), 40 );
foreach ( $val as $v ) {
$cols = max( strlen( $v ), $cols );
}
$cols = min( $cols, 150 );
$val = implode( "\n", $val );
printf(
'' . wp_kses_post( $v ) . '';
}
}
}
/**
* Validate if the .htaccess path is valid.
*
* @since 3.0
*
* @param string $id Setting ID.
* @return void
*/
protected function _validate_htaccess_path( $id ) {
$val = $this->conf( $id, true );
if ( ! $val ) {
return;
}
if ( '/.htaccess' !== substr( $val, -10 ) ) {
echo '/.htaccess' ) . '';
}
}
/**
* Check TTL ranges and show tips.
*
* @since 3.0
*
* @param string $id Setting ID.
* @param int|bool $min Minimum value (or false).
* @param int|bool $max Maximum value (or false).
* @param bool $allow_zero Whether zero is allowed.
* @return void
*/
protected function _validate_ttl( $id, $min = false, $max = false, $allow_zero = false ) {
$val = $this->conf( $id, true );
$tip = [];
if ( $min && $val < $min && ( ! $allow_zero || 0 !== $val ) ) {
$tip[] = esc_html__( 'Minimum value', 'litespeed-cache' ) . ': ' . $min . '.';
}
if ( $max && $val > $max ) {
$tip[] = esc_html__( 'Maximum value', 'litespeed-cache' ) . ': ' . $max . '.';
}
echo '' . esc_html( $range ) . '';
}
/**
* Validate IPs in a list.
*
* @since 3.0
*
* @param string $id Setting ID.
* @return void
*/
protected function _validate_ip( $id ) {
$val = $this->conf( $id, true );
if ( ! $val ) {
return;
}
if ( ! is_array( $val ) ) {
$val = [ $val ];
}
$tip = [];
foreach ( $val as $v ) {
if ( ! $v ) {
continue;
}
if ( ! \WP_Http::is_ip_address( $v ) ) {
$tip[] = esc_html__( 'Invalid IP', 'litespeed-cache' ) . ': ' . esc_html( $v ) . '.';
}
}
if ( $tip ) {
echo ' tags */
esc_html__( 'Server variable(s) %s available to override this setting.', 'litespeed-cache' ),
'' . implode( ', ', array_map( 'esc_html', $args ) ) . ''
) .
'';
Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/admin/#limiting-the-crawler' );
}
/**
* Display URI setting example.
*
* @since 2.6.1
* @access protected
* @return void
*/
protected function _uri_usage_example() {
echo esc_html__( 'The URLs will be compared to the REQUEST_URI server variable.', 'litespeed-cache' );
/* translators: 1: example URL, 2: pattern example */
echo ' ' . sprintf( esc_html__( 'For example, for %1$s, %2$s can be used here.', 'litespeed-cache' ), '/mypath/mypage?aa=bb', 'mypage?aa=' );
echo '^' );
/* translators: %s: dollar symbol */
echo ' ' . sprintf( esc_html__( 'To do an exact match, add %s to the end of the URL.', 'litespeed-cache' ), '$' );
echo ' ' . esc_html__( 'One per line.', 'litespeed-cache' );
echo '';
}
/**
* Return pluralized strings.
*
* @since 2.0
*
* @param int $num Number.
* @param string $kind Kind of item (group|image).
* @return string
*/
public static function print_plural( $num, $kind = 'group' ) {
if ( $num > 1 ) {
switch ( $kind ) {
case 'group':
return sprintf( esc_html__( '%s groups', 'litespeed-cache' ), $num );
case 'image':
return sprintf( esc_html__( '%s images', 'litespeed-cache' ), $num );
default:
return $num;
}
}
switch ( $kind ) {
case 'group':
return sprintf( esc_html__( '%s group', 'litespeed-cache' ), $num );
case 'image':
return sprintf( esc_html__( '%s image', 'litespeed-cache' ), $num );
default:
return $num;
}
}
/**
* Return guidance HTML.
*
* @since 2.0
*
* @param string $title Title HTML.
* @param array