framecreative / frame-core
Frame Core 类似于 normalize.css,适用于您的 WordPress 网站。除了设置合理的默认值外,还包括开发助手和帮助在不同环境中工作的功能。
Requires
- composer/installers: ~1.0
- rollbar/rollbar: ^2.0
README
Frame Core 是 normalize.css 的服务器端等效物 - 它设置了一些更好的默认值,平滑处理了一些奇怪边缘情况,并提供了一些开发便利的功能。
除了受密码保护的屏幕外,永远不会为网站的前端生成任何标记。
用法
首选方法:在项目的 .env
文件中添加变量
FC_PASSWORD_PROTECT_PASSWORD="1234"
或者在内置 wp-config.php
define('FC_PASSWORD_PROTECT_PASSWORD', '1234');
自动添加的功能
在管理界面中移除 ACF '自定义字段' 链接
这样客户就无法更改我们漂亮的自定义字段。
禁用插件、主题和 WordPress 核心的更改
以下是一般用户限制
- 禁用安装和删除插件
- 禁用安装和切换主题
- 在管理界面中添加 '插件安装已禁用' 通知
- 用户将能够更新插件、主题和 WordPress 核心
如果移交没有管理代码的协议,请将其设置为 false
FC_CODE_MANAGED="false"
注意:此功能仅适用于非管理员账户。Frame 账户(默认:frame
)将不受影响)。
自定义功能 - 通用
持续网站维护协议
如果我们有维护网站的协议(执行更新、维护等),请将其设置为 true
FC_SITE_MAINTAINED="true"
如果设置为 true
,则
- 禁用安装、删除和更新插件(包括 WordPress)
- 禁用安装和切换主题
- 在管理界面中添加 '插件安装已禁用' 通知
设置自定义 Frame 管理员用户名
这定义了开发用户的用户名,该用户名将不受管理员限制。该用户可以随时安装和更新插件,并将能够编辑 ACF 字段组。如果我们的管理员 WordPress 登录名 不是 frame
,则可以定义该名称。
FC_DEV_USER=""
自动 Google Tag Manager 嵌入代码
通过输入 ID,Frame Core 将在页面的 <head>
和 <body>
中添加必要的嵌入代码。注意:由于代码放置方式略有不同,因此您不能使用 Google Tag Manager 验证方法在 Google 网站控制台(网络管理员工具)中验证网站。
FC_GTM_ID=""
# values: string (google tag manager container id)
冻结内容(默认:false
)
这会激活内容冻结,因此只有 Frame 管理员才能登录到 CMS。
FC_CONTENT_FREEZE="true"
# values: true | false
自定义功能 - 开发工具
# Define a password that blocks access to the site. Should be used for staging sites.
FC_PASSWORD_PROTECT_PASSWORD=""
# values: string (password)
# default: false / empty string
# Define the URL for the uploads directory that uploads should be accessed
# from if not available locally. The first time the image is accessed from
# the proxy URL it will be stored locally.
# Note: Proxy uploads don't work with Laravel Valet WordPress Driver
FC_PROXY_UPLOADS_URL=""
# values: string (url of remote site's uploads dir, no trailing slash)
# default: false / empty string
# This configures the above action to not download images that are
# unavailable locally, but always display them from the proxy source.
FC_PROXY_DISPLAY_ONLY=""
# values : true | false
# default : false / empty string
自定义功能 - 域名工具
在 Frame 托管中,这些设置主要在 Serverpilot / Cloudflare 中执行
# Defines the domain that the site should be loaded on.
# Will redirect to this domain if accessed via another.
# Because of the logic of force SSL etc this domain wshould be without protocol or slashes
# eg: "mysite.com"
# Note: Required for FORCE_SSL to work
FC_FORCE_DOMAIN=""
# values: string (fully qualified domain name, without slashes or protocal)
# default: false / empty string
# Used in conjunction with force domain, this will
# redirect to the desired domain on the HTTPS protocol.
FC_PREFER_SSL=""
# values: true | false
# default: false
# Similar to above, but will also redirect the desired domain to the HTTPS protocol.
FC_FORCE_SSL=""
# values: true | false
# default: false
自定义功能 - 邮件
# Configures the hostname that the site should send emails
# through via the SMTP protocol. Must be used in conjunction
# with username and password.
FC_SMTP_HOST=""
# Configures the SMTP username.
FC_SMTP_USER=""
# Configures the SMTP password.
FC_SMTP_PASSWORD=""
# Configures the port that emails are sent over.
# Defaults to 25 (standard for SMTP) or 1025 in a
# dev environment (the port required for MailHog).
FC_SMTP_PORT=""
# Defines the email address that should be shown as the sender of the email.
FC_SMTP_FROM=""
# Defines the name that should be shown as the sender of the email.
FC_SMTP_FROM_NAME=""
自定义功能 - 日志记录
快速轻松地将 PHP 错误发送到 RollBar,只需设置正确的项目 API Key 为 env 变量。
# Rollbar Access token (project specific)
FC_ROLLBAR_API_KEY=""
如果为此项目全新设置了 Rollbar 日志记录,则需要向 RollBar 发送错误或消息以“激活”项目。使用查询字符串参数 rollbar_test=1
将测试消息发送到 Rollbar。
贡献和扩展
我们欢迎来自 Frame 团队的 PR,但是请记住在设计功能时考虑以下事项
- 功能必须适用于所有 frame 网站
- PHP必须与PHP 5.5向后兼容
- 不建议修改数据库或生成客户端标记
- 所有模块功能应采用可选的,并具有合理的默认值
示例.env值
#
# ALL VALUES IN .ENV ARE STRINGS
# "true" / "false" will be converted to their boolean equivalents
#
# ==============================================================================
# PRODUCTION TOOLS - CODE MANAGEMENT
# ==============================================================================
# values : true | false
# default : true
FC_CODE_MANAGED="false"
# values : true | false
# default : false
FC_SITE_MAINTAINED="true"
# values : string (username)
# default : 'frame'
FC_DEV_USER="frame"
# ==============================================================================
# DOMAIN TOOLS - HTTPS, FORCE DOMAIN
# ==============================================================================
# On Frame hosting this is mostly done via serverpilot/cloudflare
# values : string (fully qualified domain name)
# default : false / empty string
FC_FORCE_DOMAIN=""
# values : true | false
# default : false
FC_FORCE_SSL=""
# values : true | false
# default : false
FC_PREFER_SSL=""
# ==============================================================================
# DEV TOOLS - PASSWORDS, PROXY
# ==============================================================================
# Note to Valet users: Proxy uploads don't work with the Laravel Valet WordPress Driver
# values : string (password)
# default : false / empty string
FC_PASSWORD_PROTECT_PASSWORD=""
# values : string (url of remote site's uploads dir, no trailing slash)
# default : false / empty string
FC_PROXY_UPLOADS_URL=""
# values : true | false
# default : false / empty string
FC_PROXY_DISPLAY_ONLY=""
# ==============================================================================
# PRODUCTION TOOLS - CONTENT FREEZE, TAG MANAGER
# ==============================================================================
# values : true | false
# default : false / empty string
FC_CONTENT_FREEZE=""
# values : string (google tag manager container id)
# default : false / empty string
# For Multisite, add blog ID after env variable eg FC_GTM_ID_2. This will override the default FC_GTM_ID if set
FC_GTM_ID=""
# ==============================================================================
# MAIL
# ==============================================================================
# values : string (smtp details)
# default : false / empty string
FC_SMTP_HOST=""
FC_SMTP_USER=""
FC_SMTP_PASSWORD=""
FC_SMTP_PORT=""
FC_SMTP_FROM=""
FC_SMTP_FROM_NAME=""
# Sample values for Shared mailtrap account
# FC_SMTP_HOST="smtp.mailtrap.io"
# FC_SMTP_USER="b0691b59004c8e"
# FC_SMTP_PASSWORD="0c2f40265e95e1"
# FC_SMTP_PORT="2525"
# ==============================================================================
# Logging
# ==============================================================================
# values : string (Rollbar Access Key)
# default : false / empty string
# FC_ROLLBAR_API_KEY=""