seravo / seravo-plugin
增强WordPress,添加Seravo.com特定功能和集成
Requires
- php: >=7.0
Requires (Dev)
- dev-master
- 1.10.2
- v1.10.1
- 1.10.0
- 1.9.44
- 1.9.43
- 1.9.42
- 1.9.41
- 1.9.40
- 1.9.39
- 1.9.38
- v1.9.37
- 1.9.36
- 1.9.35
- 1.9.34
- 1.9.33
- 1.9.32
- 1.9.31
- 1.9.30
- 1.9.29
- 1.9.28
- 1.9.27
- 1.9.26
- 1.9.25
- 1.9.24
- 1.9.23
- 1.9.22
- 1.9.21
- 1.9.20
- 1.9.19
- 1.9.18
- 1.9.17
- 1.9.16
- 1.9.15
- 1.9.14
- 1.9.13
- 1.9.12
- 1.9.11
- 1.9.10
- 1.9.9
- 1.9.8
- 1.9.7
- 1.9.6
- 1.9.5
- 1.9.4
- 1.9.3
- 1.9.2
- 1.9.1
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.1
- 1.4.0
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3
- 1.2
- 1.1
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0
- dev-testing/acceptance
- dev-test-ci-docker
- dev-backup/actual-composer
- dev-feature/last-login-country
- dev-seravo-plugin-2/rewrite-cruftplugins
- dev-dev-sami
- dev-santeri-dev
- dev-search-replace-escaped
- dev-search-replace-hook
- dev-bugfix/seravo-class-everywhere
- dev-feature/stronger-passwords
- dev-feature/cruft-quarantine
- dev-feature/cache-keys
- dev-feature/thirdparty-aiosp
- dev-feature/rcp-bypass
- dev-feature/postbox-5.5-format
- dev-feature/exec_with_output
- dev-fix/custom-toolbox
- dev-feature/extend-cruft-remover
- dev-fix/shadows-box
- dev-feature/wpml-cache
- dev-testi/demo-branch
- dev-seravo-toolbox-translations-update
- dev-bugfix/https-redirect
- dev-dev-seravo-toolbox
- dev-feature/custom-welcome-panel
- dev-feature/full-width-postboxes
- dev-dev-mikkov
- dev-dev-samuli-whitelabel
- dev-dev-samuli-toolbox
- dev-dev-samuli
- dev-bugfix/clarify-tests-message
- dev-feature/instance-data-moving
- dev-dev-markus
- dev-demobranch
- dev-dev-leo
- dev-dev-nasusa-cruft-files
- dev-dev/introduce-control-panel
- dev-bugfix/check-url-attr
- dev-bugfix/reports-local
- dev-dev-maf-backups
- dev-dev-maf-notification-factory
- dev-dev-maf-2
- dev-dev-maf-updates
- dev-dev-nasusa-fix-code
- dev-dev-maf
- dev-dev-maf-login-notification
- dev-dev-maf-shui
- dev-feature/improved-site-information
- dev-feature/shadow-notice-after-12h
- dev-feature/crawl-delay
- dev-feature/whitelist-ipgeoblock
- dev-bug/fix-83
- dev-feature/screenshot-comparison
- dev-feature/site-info
- dev-feature-shadow-pull
- dev-dev-leo-2
- dev-feature-cruft-remove-inactive-plugins
- dev-feature-shadows
- dev-nasusa-master
- dev-feature/pwnedpasswords
- dev-fix-reports-page-style
- dev-update_instance_switching_feature
- dev-add_nonce_to_update_page_form
- dev-feature-update-checker
- dev-feature-vagrant-load-missing-pictures-from-prod
- dev-feature-add-wpdb-injector
This package is auto-updated.
Last update: 2024-09-15 11:26:33 UTC
README
必须使用Seravo插件
增强WordPress,添加Seravo.com特定功能和集成(在芬兰称为WP-palvelu.fi)。
安装
为了使用Composer,您需要添加此mu-plugin
https://github.com/roots/bedrock/blob/master/web/app/mu-plugins/bedrock-autoloader.php
这是因为WordPress不会使用其自己的文件夹中的mu-plugin。
然后将其添加到您的composer中
{ "require": { "seravo/seravo-plugin": "*" }, "extra": { "installer-paths": { "htdocs/wp-content/mu-plugins/{$name}/": ["type:wordpress-muplugin"] } } }
Seravo客户可以简单地运行wp-seravo-plugin-update
来获取最新(标记)版本。对于喜欢冒险的人,可以使用wp-seravo-plugin-update --dev
获取git master头。
功能
- 强制使用规范URL
- 强制使用HTTPS,如果PHP版本太低会发出警告,如果未启用对象缓存会显示通知等
- 显示来自WP-palvelu.fi的通知(待改进:切换到Seravo.com)
- 登录失败后返回401(未经授权)的http状态码
- 将所有登录尝试记录到/data/log/wp-login.log
- 隐藏更新提醒,因为Seravo已经处理了这个问题
- 如果网站处于开发模式,则使用nocache头
- 在管理栏中添加“清除缓存”按钮
- 如果有任何影子实例,则自动显示影子实例切换器
- 允许列出和重置影子环境
- 查找并建议从站点中删除的垃圾文件
- 显示有关数据库、表大小等信息
- 显示有关磁盘使用情况、服务器日志、更新、测试等信息
- 还有更多,更多!
过滤器
您可以为处于影子中的用户插入自己的管理通知
function my_shadow_admin_notice($admin_notice, $current_screen) { return '<div class="notice notice-error"><p>This is staging. All content edited here will be lost. Return to production to create or edit content.</p></div>'; } add_filter( 'seravo_instance_switcher_admin_notice', 'my_shadow_admin_notice', 10, 2 );
目前开发速度非常快,文档远远落后。要查找更多过滤器,只需在源代码中搜索apply_filters
。
开发
使用真实站点进行开发
一些Seravo插件的功能依赖于仅在实际生产站点上可用的API,因此不能在Vagrant盒子等内部进行测试。
为了在您的电脑和自己的编辑器上拥有git仓库,同时仍然能够看到在测试站点(生产环境中)运行的代码,您可以使用以下命令。它将监视所有文件的变化,并将它们自动同步到远程服务器
seravo-plugin$ find * | entr rsync -avz -e 'ssh -q -p 12345' * example@example.seravo.com:/data/wordpress/htdocs/wp-content/mu-plugins/seravo-plugin/
sending incremental file list
README.md
sent 2,999 bytes received 64 bytes 2,042.00 bytes/sec
total size is 370,596 speedup is 120.99
安装开发依赖项
为了简化Seravo插件开发,应使用Composer安装开发依赖项。运行composer install
安装PHPCS、PHPCBF、WordPress PHPCS标准和Rector。
更新翻译
请记住,通过在Vagrant中运行来更新所有面向公众的字符串的翻译
cd /data/wordpress/htdocs/wp-content/mu-plugins/seravo-plugin
wp i18n make-pot . languages/seravo.pot
注意!如果失败,出现
PHP致命错误:未捕获错误:函数嵌套级别达到'256'的最大值
,则暂时使用rm js/cruft*
删除过于复杂的文件。
可以使用Poedit等工具进行翻译。在编辑器中打开languages/seravo-fi.po
并选择“从pot文件更新”,这将更新po文件。翻译后,将po文件编译为seravo-fi.mo
mo文件。
运行Rector和PHPCS
如果您使用composer install
在本地上安装了Rector和PHPCS,只需运行composer test
。或者,在本地Vagrant或Docker镜像内部或与测试相同的远程站点上运行PHPCS。
ssh -q -p 12345 example@example.seravo.com 'cd '/data/wordpress/htdocs/wp-content/mu-plugins/seravo-plugin/ && phpcs
........S.......WWWWWWWWWWEWWEWWWWW.WWEWWWW.W.WWEWWEWEW..... 60 / 68 (88%)
......W. 68 / 68 (100%)
FILE: ...press/htdocs/wp-content/mu-plugins/seravo-plugin/lib/helpers.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
35 | WARNING | Filesystem function dirname() detected with dynamic
| | parameter
35 | WARNING | Line exceeds 100 characters; contains 118 characters
44 | WARNING | Line exceeds 100 characters; contains 107 characters
----------------------------------------------------------------------
...
使用 composer fix
可以自动修复Rector和PHPCS错误。在合并到master分支之前,应解决所有Rector错误,即使它不是CI测试的一部分。
变更日志
查看git历史记录和发布提交消息。