scossdl_off_options() │ WPSCache 1.0
Show CDN settings.
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
scossdl_off_options();
Код scossdl_off_options() scossdl off options WPSCache 1.12.4
<?php function scossdl_off_options() { global $ossdlcdn, $ossdl_off_blog_url, $ossdl_off_cdn_url, $ossdl_cname, $ossdl_https; global $ossdl_off_include_dirs, $ossdl_off_excludes; scossdl_off_update(); scossdl_off_get_options(); $example_cdn_uri = ( is_ssl() ? 'https' : 'http' ) . '://cdn.' . preg_replace( '`^(https?:)?//(www\.)?`', '', get_site_url() ); $example_cnames = str_replace( '://cdn.', '://cdn1.', $example_cdn_uri ); $example_cnames .= ',' . str_replace( '://cdn.', '://cdn2.', $example_cdn_uri ); $example_cnames .= ',' . str_replace( '://cdn.', '://cdn3.', $example_cdn_uri ); $example_cdn_uri = ( get_site_url() === $ossdl_off_cdn_url ) ? $example_cdn_uri : $ossdl_off_cdn_url; $example_cdn_uri .= '/wp-includes/js/jquery/jquery-migrate.js'; $example_cdn_uri = esc_url( $example_cdn_uri ); ?> <div class="wpsc-card"> <h3><?php _e( 'Jetpack CDN' ); ?></h3> <p><?php printf( __( 'The free %1$sJetpack plugin%2$s has a %3$sSite Accelerator%2$s feature that is easier to use than the CDN functionality in this plugin. However files will be cached "forever" and will not update if you update the local file. Files will need to be renamed to refresh them. The %3$sJetpack documentation%2$s explains more about this.', 'wp-super-cache' ), '<a href="https://jetpack.com/">', '</a>', '<a href="https://jetpack.com/support/site-accelerator/">' ); ?></p> <?php if ( class_exists( 'Jetpack' ) ) { if ( Jetpack::is_module_active( 'photon' ) ) { ?><p><strong><?php printf( __( 'You already have Jetpack installed and %1$sSite Accelerator%2$s enabled on this blog. The CDN here is disabled to avoid conflicts with Jetpack.', 'wp-super-cache' ), '<a href="https://jetpack.com/support/site-accelerator/">', '</a>' ); ?></strong></p><?php } else { ?><p><?php printf( __( 'You already have Jetpack installed but %1$sSite Accelerator%2$s is disabled on this blog. Enable it on the %3$sJetpack settings page%2$s.', 'wp-super-cache' ), '<a href="https://jetpack.com/support/site-accelerator/">', '</a>', '<a href="' . admin_url( 'admin.php?page=jetpack#/settings' ) . '">' ); ?></p><?php } } else { ?><p><strong><?php printf( __( '%1$sJetpack%2$s was not found on your site but %3$syou can install it%2$s. The Site Accelerator feature is free to use on any WordPress site and offers the same benefit as other CDN services. You should give it a try!', 'wp-super-cache' ), '<a href="https://jetpack.com/">', '</a>', '<a href="' . admin_url( 'plugin-install.php?s=jetpack&tab=search&type=term' ) . '">' ); ?></strong></p><?php } if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) { echo '</div>'; // close wpsc-card return; } ?> <h3><?php _e( 'Simple CDN' ); ?></h3> <p><?php _e( 'Your website probably uses lots of static files. Image, Javascript and CSS files are usually static files that could just as easily be served from another site or CDN. Therefore, this plugin replaces any links in the <code>wp-content</code> and <code>wp-includes</code> directories (except for PHP files) on your site with the URL you provide below. That way you can either copy all the static content to a dedicated host or mirror the files to a CDN by <a href="https://www.google.com/search?q=cdn+origin+pull" target="_blank">origin pull</a>.', 'wp-super-cache' ); ?></p> <p><?php printf( __( '<strong style="color: red">WARNING:</strong> Test some static urls e.g., %s to ensure your CDN service is fully working before saving changes.', 'wp-super-cache' ), '<code>' . esc_html( $example_cdn_uri ) . '</code>' ); ?></p> <?php if ( get_home_url() !== $ossdl_off_blog_url ) { ?> <p><?php printf( __( '<strong style="color: red">WARNING:</strong> Your siteurl and homeurl are different. The plugin is using %s as the homepage URL of your site but if that is wrong please use the filter "ossdl_off_blog_url" to fix it.', 'wp-super-cache' ), '<code>' . esc_html( $ossdl_off_blog_url ) . '</code>' ); ?></p> <?php } ?> <p><?php esc_html_e( 'You can define different CDN URLs for each site on a multsite network.', 'wp-super-cache' ); ?></p> <p><form method="post" action=""> <?php wp_nonce_field( 'wp-cache' ); ?> <table class="form-table"><tbody> <tr valign="top"> <td style='text-align: right'> <input id='ossdlcdn' type="checkbox" name="ossdlcdn" value="1" <?php checked( $ossdlcdn ); ?> /> </td> <th scope="row"><label for="ossdlcdn"><?php esc_html_e( 'Enable CDN Support', 'wp-super-cache' ); ?></label></th> </tr> <tr valign="top"> <th scope="row"><label for="ossdl_off_cdn_url"><?php esc_html_e( 'Site URL', 'wp-super-cache' ); ?></label></th> <td> <input type="text" name="ossdl_off_blog_url" value="<?php echo esc_attr( untrailingslashit( $ossdl_off_blog_url ) ); ?>" size="64" class="regular-text code" /><br /> <span class="description"><?php _e( 'The URL of your site. No trailing <code>/</code> please.', 'wp-super-cache' ); ?></span> </td> </tr> <tr valign="top"> <th scope="row"><label for="ossdl_off_cdn_url"><?php esc_html_e( 'Off-site URL', 'wp-super-cache' ); ?></label></th> <td> <input type="text" name="ossdl_off_cdn_url" value="<?php echo esc_attr( $ossdl_off_cdn_url ); ?>" size="64" class="regular-text code" /><br /> <span class="description"><?php printf( __( 'The new URL to be used in place of %1$s for rewriting. No trailing <code>/</code> please.<br />Example: <code>%2$s</code>.', 'wp-super-cache' ), esc_html( get_site_url() ), esc_html( $example_cdn_uri ) ); ?></span> </td> </tr> <tr valign="top"> <th scope="row"><label for="ossdl_off_include_dirs"><?php esc_html_e( 'Include directories', 'wp-super-cache' ); ?></label></th> <td> <input type="text" name="ossdl_off_include_dirs" value="<?php echo esc_attr( implode( ',', $ossdl_off_include_dirs ) ); ?>" size="64" class="regular-text code" /><br /> <span class="description"><?php _e( 'Directories to include in static file matching. Use a comma as the delimiter. Default is <code>wp-content, wp-includes</code>, which will be enforced if this field is left empty.', 'wp-super-cache' ); ?></span> </td> </tr> <tr valign="top"> <th scope="row"><label for="ossdl_off_exclude"><?php esc_html_e( 'Exclude if substring', 'wp-super-cache' ); ?></label></th> <td> <input type="text" name="ossdl_off_exclude" value="<?php echo esc_attr( implode( ',', $ossdl_off_excludes ) ); ?>" size="64" class="regular-text code" /><br /> <span class="description"><?php _e( 'Excludes something from being rewritten if one of the above strings is found in the URL. Use a comma as the delimiter like this, <code>.php, .flv, .do</code>, and always include <code>.php</code> (default).', 'wp-super-cache' ); ?></span> </td> </tr> <tr valign="top"> <th scope="row"><label for="ossdl_cname"><?php esc_html_e( 'Additional CNAMES', 'wp-super-cache' ); ?></label></th> <td> <input type="text" name="ossdl_cname" value="<?php echo esc_attr( $ossdl_cname ); ?>" size="64" class="regular-text code" /><br /> <span class="description"><?php printf( __( 'These <a href="https://www.wikipedia.org/wiki/CNAME_record">CNAMES</a> will be used in place of %1$s for rewriting (in addition to the off-site URL above). Use a comma as the delimiter. For pages with a large number of static files, this can improve browser performance. CNAMEs may also need to be configured on your CDN.<br />Example: %2$s', 'wp-super-cache' ), esc_html( get_site_url() ), esc_html( $example_cnames ) ); ?></span> </td> </tr> <tr valign="top"> <th scope="row" colspan='2'><label><input type='checkbox' name='ossdl_https' value='1' <?php checked( $ossdl_https ); ?> /><?php esc_html_e( 'Skip https URLs to avoid "mixed content" errors', 'wp-super-cache' ); ?></label></th> </tr> </tbody></table> <input type="hidden" name="action" value="update_ossdl_off" /> <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes', 'wp-super-cache' ); ?>" /></p> </form></p> <p> <?php printf( /* Translators: placeholder is a link to OSSDL CDN Off Linker plugin on WordPress.org */ esc_html__( 'CDN functionality provided by %s by Mark Kubacki', 'wp-super-cache' ), '<a href="https://wordpress.org/plugins/ossdl-cdn-off-linker/">OSSDL CDN Off Linker</a>' ); ?> </p> </div> <!-- Close .wpsc-card --> <?php }