[wordpress插件] Appcachify追查

wordpress 插件 文章 2020-02-20 01:00 636 0 全屏看文

AI助手支持GPT4.0

评分
100
描述

The plugin adds an iframe to the footer of your website which points to example.com/manifest.

该插件会在您网站的页脚中添加一个iframe,该iframe指向 example.com/manifest

That URL is an empty page that references the generated manifest file at example.com/manifest.appcache.

该URL是一个空页面,引用了 example.com/manifest.appcache 上生成的清单文件。

The manifest itself is built in the following way:

清单本身是通过以下方式构建的:

    1. adds URLs of all queued scripts and styles
    2. 添加所有排队的脚本和样式的URL

    3. searches theme files and folder for any images or other static assets
    4. 在主题文件和文件夹中搜索任何图像或其他静态资产

    5. if a theme has a 307.php template it is used as an offline fallback
    6. 如果主题具有307.php模板,则将其用作脱机后备广告

    7. a timestamp of the most recently modified file is added to force appcache to refresh
    8. 添加了最近修改文件的时间戳,以强制刷新应用缓存

    The net result of all this is that your main static files are stored locally on your visitors devices.

    所有这些的最终结果是,主要的静态文件存储在本地的访问者设备上。

    For mobile this greatly helps to improve download and rendering times.

    对于移动设备,这大大有助于缩短下载和渲染时间。

    Documentation

    文档

    Adding items to the manifest

    将商品添加到清单

    Appcache can do more than store static assets.

    Appcache可以做的不仅仅是存储静态资产。

    You could cache entire pages, or add fallbacks for when a user is offline.

    您可以缓存整个页面,也可以为用户离线时添加备用。

    There are 3 main sections to a manifest:

    清单有3个主要部分:

    CACHE

    CACHE

    The main CACHE section is for URLs that should be explicitly cached.

    CACHE 主要部分用于应显式缓存的URL。

      <?php

    add_filter( 'appcache_cache', function( $urls ) {   

    add_filter('appcache_cache',function($ urls){   

    $urls[] = '/page-available-offline/';   

    $ urls [] ='/ page-available-offline /';   

    return $urls;

    返回$ urls;

    } );

    });

    ?>

    ?>

    NETWORK

    网络

    This section is for specifying URLs that should never be cached.

    此部分用于指定不应永远进行缓存的URL。

      <?php

    add_filter( 'appcache_network', function( $urls ) {   

    add_filter('appcache_network',function($ urls){   

    $urls[] = '*';   

    $ urls [] ='*';   

    $urls[] = '/online-only-page/';   

    $ urls [] ='/ online-only-page /';   

    return $urls;

    返回$ urls;

    } );

    });

    ?>

    ?>

    FALLBACK

    Fallback

    The fallback section allows you to set fallback pages or images if the user is offline.

    如果用户处于离线状态,可以使用后备部分来设置后备页面或图像。

      <?php

    add_filter( 'appcache_fallback', function( $patterns ) {   

    add_filter('appcache_fallback',function($ patterns){   

    $patterns[] = 'wp-content/uploads/ wp-content/uploads/offline.jpg';   

    $ patterns [] ='wp-content / uploads / wp-content / uploads / offline.jpg';   

    return $patterns;

    返回$ patterns;

    } );

    });

    ?>

    ?>

    The update header

    更新标头

    Appcaches are refetched when the manifest file content changes so we add a few items as comments at the top of the file.

    清单文件内容更改时,将重新获取应用程序缓存,因此我们在文件顶部添加了一些项目作为注释。

      1. The current theme (and version if available)
      2. 当前主题(和版本,如果可用)

      3. The most recent modified time of any files we find the server path for
      4. 我们找到服务器文件路径的所有文件的最新修改时间

      5. The size of all the files that we find a server path for

        我们找到服务器路径的所有文件的大小

        get_var( “SELECT post_modified FROM $wpdb->posts WHERE post_type = ‘post’ ORDER BY post_modified DESC LIMIT 1” );
           

        get_var(“从$ wpdb->中选择post_modified = posts WHERE post_type ='post'ORDER BY post_modified DESC LIMIT 1”);
           

        return $headers;

        返回$ headers;

        } );

        });

        ?>

      6. ?>

      More about appcache

      有关appcache的更多信息

      I strongly recommend learning more about what you can do with appcache by reading the following articles:

      我强烈建议您阅读以下文章,详细了解如何使用appcache:

安装步骤

Upload the plugin to your plugins directory and activate it.

将插件上传到您的插件目录并激活它。

There’s no configuration involved or settings screen.

没有任何配置或设置屏幕。

下载地址
https://downloads.wordpress.org/plugin/appcachify.zip
-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
[wordpress插件] AW WooCommerce TIKI ShippingAW WooCommerce TIKI送货
[wordpress插件] BP default user noificationsBP默认用户提名
[wordpress插件] DobsonDev ShortcodesDobsonDev简码
[wordpress插件] Easy Calculator简易计算器
[wordpress插件] Advanced Youtube Channel Pagination进阶YouTube频道分页
随便看看
企业微信通讯录账号被管理员误/恶意删除,怎么办? 9568
问题? 9048
如何快速搭建抽奖助手小程序(无需代码知识) 6177
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 7472
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 6793
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 6128
如何解决渲染层网络错误Failed to load media? 17393
小程序找号找回 释放昵称? 3253
我的小程序广告主收入5301,实际进账4406,是怎么回事呀? 3108
删除部分微信用户个人数据的通知,怎么删除? 6381