cdn
2 months ago
data_structure
2 months ago
activation.cls.php
2 months ago
admin-display.cls.php
2 months ago
admin-settings.cls.php
2 months ago
admin.cls.php
2 months ago
api.cls.php
2 months ago
avatar.cls.php
2 months ago
base.cls.php
2 months ago
cdn.cls.php
2 months ago
cloud-auth-callback.trait.php
2 months ago
cloud-auth-ip.trait.php
2 months ago
cloud-auth.trait.php
2 months ago
cloud-misc.trait.php
2 months ago
cloud-node.trait.php
2 months ago
cloud-request.trait.php
2 months ago
cloud.cls.php
2 months ago
conf.cls.php
2 months ago
control.cls.php
2 months ago
core.cls.php
2 months ago
crawler-map.cls.php
2 months ago
crawler.cls.php
2 months ago
css.cls.php
2 months ago
data.cls.php
2 months ago
data.upgrade.func.php
2 months ago
db-optm.cls.php
2 months ago
debug2.cls.php
2 months ago
doc.cls.php
2 months ago
error.cls.php
2 months ago
esi.cls.php
2 months ago
file.cls.php
2 months ago
guest.cls.php
2 months ago
gui.cls.php
2 months ago
health.cls.php
2 months ago
htaccess.cls.php
2 months ago
img-optm-manage.trait.php
2 months ago
img-optm-pull.trait.php
2 months ago
img-optm-send.trait.php
2 months ago
img-optm.cls.php
2 months ago
import.cls.php
2 months ago
import.preset.cls.php
2 months ago
lang.cls.php
2 months ago
localization.cls.php
2 months ago
media.cls.php
2 months ago
metabox.cls.php
2 months ago
object-cache-wp.cls.php
2 months ago
object-cache.cls.php
2 months ago
object.lib.php
2 months ago
optimize.cls.php
2 months ago
optimizer.cls.php
2 months ago
placeholder.cls.php
2 months ago
purge.cls.php
2 months ago
report.cls.php
2 months ago
rest.cls.php
2 months ago
root.cls.php
2 months ago
router.cls.php
2 months ago
str.cls.php
2 months ago
tag.cls.php
2 months ago
task.cls.php
2 months ago
tool.cls.php
2 months ago
ucss.cls.php
2 months ago
utility.cls.php
2 months ago
vary.cls.php
2 months ago
vpi.cls.php
2 months ago
doc.cls.php
188 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Helper to render small documentation/tooltips in the UI. |
| 4 | * |
| 5 | * @package LiteSpeed |
| 6 | * @since 2.2.7 |
| 7 | */ |
| 8 | |
| 9 | namespace LiteSpeed; |
| 10 | |
| 11 | defined( 'WPINC' ) || exit(); |
| 12 | |
| 13 | /** |
| 14 | * Small utility view helpers for docs/warnings/links. |
| 15 | */ |
| 16 | class Doc { |
| 17 | |
| 18 | /** |
| 19 | * Show a notice when an option is effectively forced ON by Guest Mode. |
| 20 | * |
| 21 | * @since 5.5 |
| 22 | * |
| 23 | * @param string $id Option id. |
| 24 | * @return void |
| 25 | */ |
| 26 | public static function maybe_on_by_gm( $id ) { |
| 27 | if ( apply_filters( 'litespeed_conf', $id ) ) { |
| 28 | return; |
| 29 | } |
| 30 | if ( ! apply_filters( 'litespeed_conf', Base::O_GUEST ) ) { |
| 31 | return; |
| 32 | } |
| 33 | if ( ! apply_filters( 'litespeed_conf', Base::O_GUEST_OPTM ) ) { |
| 34 | return; |
| 35 | } |
| 36 | echo '<font class="litespeed-warning">'; |
| 37 | echo wp_kses_post( |
| 38 | '⚠️ ' . |
| 39 | sprintf( |
| 40 | __( 'This setting is %1$s for certain qualifying requests due to %2$s!', 'litespeed-cache' ), |
| 41 | '<code>' . esc_html__( 'ON', 'litespeed-cache' ) . '</code>', |
| 42 | esc_html( Lang::title( Base::O_GUEST_OPTM ) ) |
| 43 | ) |
| 44 | ); |
| 45 | self::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/general/#guest-optimization' ); |
| 46 | echo '</font>'; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Warn that changes affect the crawler list. |
| 51 | * |
| 52 | * @since 4.3 |
| 53 | * @return void |
| 54 | */ |
| 55 | public static function crawler_affected() { |
| 56 | echo '<span class="litespeed-primary">'; |
| 57 | echo '⚠️ ' . esc_html__( 'This setting will regenerate crawler list and clear the disabled list!', 'litespeed-cache' ); |
| 58 | echo '</span>'; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Privacy policy text for front-end disclosure. |
| 63 | * |
| 64 | * @since 2.2.7 |
| 65 | * |
| 66 | * @return string Safe HTML string. |
| 67 | */ |
| 68 | public static function privacy_policy() { |
| 69 | $text = esc_html__( |
| 70 | 'This site utilizes caching in order to facilitate a faster response time and better user experience. Caching potentially stores a duplicate copy of every web page that is on display on this site. All cache files are temporary, and are never accessed by any third party, except as necessary to obtain technical support from the cache plugin vendor. Cache files expire on a schedule set by the site administrator, but may easily be purged by the admin before their natural expiration, if necessary. We may use QUIC.cloud services to process & cache your data temporarily.', |
| 71 | 'litespeed-cache' |
| 72 | ); |
| 73 | |
| 74 | $link = sprintf( |
| 75 | /* translators: %s: QUIC.cloud privacy policy URL */ |
| 76 | esc_html__( 'Please see %s for more details.', 'litespeed-cache' ), |
| 77 | sprintf( |
| 78 | '<a href="%1$s" target="_blank" rel="noopener noreferrer">%1$s</a>', |
| 79 | esc_url( 'https://quic.cloud/privacy-policy/' ) |
| 80 | ) |
| 81 | ); |
| 82 | |
| 83 | // Return as HTML (link already escaped). |
| 84 | return $text . ' ' . $link; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Render (or return) a "Learn more" link. |
| 89 | * |
| 90 | * @since 2.4.2 |
| 91 | * |
| 92 | * @param string $url Destination URL. |
| 93 | * @param string $title Optional link text. Defaults to "Learn More". |
| 94 | * @param bool $self_tab Open in self tab or new tab (adds target/_blank + rel). |
| 95 | * @param string $css_class CSS class for the anchor. |
| 96 | * @param bool $return_output Return instead of echo. |
| 97 | * @return string|void |
| 98 | */ |
| 99 | public static function learn_more( $url, $title = '', $self_tab = false, $css_class = '', $return_output = false ) { |
| 100 | $css_class = $css_class ? $css_class : 'litespeed-learn-more'; |
| 101 | $title = $title ? $title : esc_html__( 'Learn More', 'litespeed-cache' ); |
| 102 | |
| 103 | $target_rel = $self_tab ? '' : ' target="_blank" rel="noopener noreferrer"'; |
| 104 | $anchor = sprintf( |
| 105 | ' <a href="%s"%s class="%s">%s</a>', |
| 106 | esc_url( $url ), |
| 107 | $target_rel, // Already hardcoded/safe. |
| 108 | esc_attr( $css_class ), |
| 109 | wp_kses_post( $title ) |
| 110 | ); |
| 111 | |
| 112 | if ( $return_output ) { |
| 113 | return $anchor; |
| 114 | } |
| 115 | |
| 116 | echo wp_kses_post( $anchor ); |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Output "One per line." helper text. |
| 121 | * |
| 122 | * @since 3.0 |
| 123 | * |
| 124 | * @param bool $return_output Return the string instead of echoing. |
| 125 | * @return string|void |
| 126 | */ |
| 127 | public static function one_per_line( $return_output = false ) { |
| 128 | $str = esc_html__( 'One per line.', 'litespeed-cache' ); |
| 129 | if ( $return_output ) { |
| 130 | return $str; |
| 131 | } |
| 132 | echo esc_html( $str ); |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * Output helper text about full/partial URL support. |
| 137 | * |
| 138 | * @since 3.4 |
| 139 | * |
| 140 | * @param bool $string_only If true, say "strings" only; otherwise specify URLs/strings. |
| 141 | * @return void |
| 142 | */ |
| 143 | public static function full_or_partial_url( $string_only = false ) { |
| 144 | if ( $string_only ) { |
| 145 | echo esc_html__( 'Both full and partial strings can be used.', 'litespeed-cache' ); |
| 146 | } else { |
| 147 | echo esc_html__( 'Both full URLs and partial strings can be used.', 'litespeed-cache' ); |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * Notice that a setting will edit .htaccess. |
| 153 | * |
| 154 | * @since 3.0 |
| 155 | * @return void |
| 156 | */ |
| 157 | public static function notice_htaccess() { |
| 158 | echo '<span class="litespeed-primary">'; |
| 159 | echo '⚠️ ' . esc_html__( 'This setting will edit the .htaccess file.', 'litespeed-cache' ) . ' '; |
| 160 | self::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/toolbox/#edit-htaccess-tab' ); |
| 161 | echo '</span>'; |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * Gentle reminder that QUIC.cloud queues are asynchronous. |
| 166 | * |
| 167 | * @since 5.3.1 |
| 168 | * |
| 169 | * @param bool $return_output Return the HTML instead of echoing. |
| 170 | * @return string|void |
| 171 | */ |
| 172 | public static function queue_issues( $return_output = false ) { |
| 173 | $link = self::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/troubleshoot/#quiccloud-queue-issues', '', false, '', true ); |
| 174 | |
| 175 | $html = sprintf( |
| 176 | '<div class="litespeed-desc">%s %s</div>', |
| 177 | esc_html__( 'The queue is processed asynchronously. It may take time.', 'litespeed-cache' ), |
| 178 | $link // already escaped. |
| 179 | ); |
| 180 | |
| 181 | if ( $return_output ) { |
| 182 | return $html; |
| 183 | } |
| 184 | |
| 185 | echo wp_kses_post( $html ); |
| 186 | } |
| 187 | } |
| 188 |