Linux 软件免费装
Banner图

网站时间

开发者 coffee2code
更新时间 2021年6月19日 17:18
捐献地址: 去捐款
PHP版本: 4.6 及以上
WordPress版本: 5.7
版权: GPLv2 or later
版权网址: 版权信息

标签

widget admin widgets blog time coffee2code server clock datetime template tag

下载

1.0 1.0.1 2.0 3.6.2 4.0.1 1.0.2 1.1 1.2 3.0 3.2 3.3 3.3.1 3.3.2 3.4 3.5 3.5.1 3.6 3.6.1 4.0

详情介绍:

This plugin adds a dynamic, functional clock to the admin bar (at top of all admin pages) to show the server time for the blog. The clock automatically updates as time passes, as you would expect of a digital clock. This plugin also supports a static mode which puts a timestamp string at the top of all admin pages instead of the dynamic clock. This static admin time widget can be clicked to update the time in-place (without a page reload) to show the new current server time. Also provided is a "Blog Time" widget providing the same functionality as the admin widget, but for your sidebars. You may also utilize the plugin's functionality directly within a theme template via use of the template tag c2c_blog_time(). NOTE: For the front-end widget, if the "Use dynamic clock?" configuration option is unchecked, this plugin generates a timestamp and NOT a clock. The time being displayed is the time of the page load, or if clicked, the time when the widget last retrieved the time. It won't actively increment time on the display. By default the widget displays a dynamic clock that does increment time. This is most useful to see the server/blog time to judge when a time sensitive post, comment, or action would be dated by the blog (i.e. such as monitoring for when to close comments on a contest post, or just accounting for the server being hosted in a different timezone). Or, when used statically as a timestamp and not a clock, it can indicate/preserve when the page was loaded. Thanks to Moment.js for the JavaScript date handling library. Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage

安装:

  1. Install via the built-in WordPress plugin installer or download and unzip blog-time.zip inside the plugins directory for your site (typically wp-content/plugins/)
  2. Activate the plugin through the 'Plugins' admin menu in WordPress
  3. Optional: Customize the time format used for displaying the time via the "Blog Time Format" setting found in Settings -> General.
  4. Optional: Use the 'Blog Time' widget or the template tag c2c_blog_time() in a theme template file to display the blog's time at the time of the page's rendering.

屏幕截图:

  • The blog time being displayed in the admin toolbar.
  • The "Blog Time" widget.
  • The "Blog Time Format" setting found on Settings -> General.

升级注意事项:

4.0 Recommended update: ntroduced setting for configuring blog time format, added support for 'T' timezone format token, updated bundled Moment.js library, improved documentation, restructured unit test files, noted compatibility through 5.7+, and incorporated numerous behind-the-scenes tweaks. 3.6.2 Minor update: Updated the Moment.js library, added TODO.md file, updated a few URLs to be HTTPS, expanded unit testing, and noted compatibility through WP 5.4+. 3.6.1 Trivial update: modernized unit tests, noted compatibility through WP 5.3+, and updated copyright date (2020) 3.6 Recommended update: updated packaged Moment.js to v2.24.0, defer to using Moment.js now enqueued by WP, tweaked plugin initialization, added more unit tests, noted compatibility through WP 5.1+, updated copyright date (2019), more. 3.5.1 Minor update: updated Moment.js to v2.22.2, noted compatibility through WP 4.9+, added README.md for GitHub, updated copyright date (2018), and other minor changes 3.5 Recommended update: major refactoring of dynamic clock (which now honors custom time format), added clock dashicon, compatibility is now WP 4.6 through 4.7+ (though it should continue to work for earlier versions of WP), and other improvements. 3.4 Minor update: bugfix to add proper markup around widget; improved support for localization; verified compatibility through WP 4.4; updated widget framework; updated copyright date (2016) 3.3.2 Minor bugfix update: Prevented PHP notice under PHP7+ for widget; added more unit tests; updated widget framework to 010; noted compatibility through WP 4.3+ 3.3.1 Minor bugfix release for users running PHP 5.2.x: revert use of a constant only defined in PHP 5.3+. You really should upgrade your PHP or your host if this affects you. 3.3 Recommended update: added unit tests; minor backend improvements; noted compatibility through WP 4.1+; updated copyright date (2015) 3.2 Recommended update: incorporated unreleased 3.1; noted compatibility through WP 4.0+; added plugin icon. 3.1 Recommended update: slight dynamic clock reimplementation that should fix DST off-by-one-hour bug; deprecate 'blog_time_format' filter in favor of 'c2c_blog_time_format'; noted compatibility through WP 3.4+; explicitly stated license 3.0 Major update: Admin widget now appears in admin toolbar; new dynamic JS clock; fixed JS clock time bug; added support for WP 3.3+; dropped support for versions of WP older than 3.3; internationalization; and a lot more. 2.0.1 Recommended update: fixed bug relating to showing time in incorrect timezone. 2.0 Feature update: added dynamic clock capability (new default behavior; admin side only); added more hooks; display admin widget even if JS disabled; noted compatibility with WP 3.2; dropped compatibility with versions of WP older than 3.1; and more. 1.3 Minor update: noted compatibility through WP 3.2+ 1.2 Recommended update: fixed incompatibility introduced by WP 3.1; updated copyright date; other minor code changes. 1.1 Recommended minor update. Highlights: added hook for customization; minor fixes and tweaks; renamed blog_time() to c2c_blog_time(); renamed class; verified WP 3.0 compatibility; dropped compatbility with versions of WP older than 2.8.

常见问题:

How do I customize the format of the time string?

Under the site's general admin settings -- at Settings -> General -- you'll find a "Blog Time Format" setting that accepts any valid PHP time format token. See https://www.php.net/manual/en/datetime.format.php for more information regarding valid time format tokens. The widget and template tag also allow you to specify a time format directly. The default value for the time format, and the one used by the display of the blog time in the static admin widget, can be overridden by hooking the c2c_blog_time_format filter and returning the desired time format. This takes precedence over the setting's value.

Why is the time not changing in the sidebar widget?

The widget's "Use dynamic clock?" configuration setting may not be checked (which it is by default). Or JavaScript could be disabled in the browser.

How do I know if this thing is working if the time matches my computer's time?

Your machine may well be synced with the server's clock. One test you can perform is to change the blog's time zone (under Settings -> General). The blog's time will then be set to a different hour, which should then be reflected by the widget. Remember to change the time zone back to its proper value!

Can the clock be enabled/disabled on a per-user basis?

Yes, but only programmatically at the moment. Check out the docs for the 'c2c_blog_time_toolbar_widget_for_user' filter for more information and a code example.

How do I go back to having the legacy static timestamp as opposed to the dynamic clock?

See the Filters section for the 'c2c_blog_time_active_clock' filter, which includes an example line of code you'll need to add to your theme.

How can I show the blog's date instead of the time?

Via Settings -> General, you can set the "Blog Time Format" value to something like M d, Y, which results in a time format like "Jun 21, 2021". See https://www.php.net/manual/en/datetime.format.php for other month, day, and year time format tokens.

Does this plugin include unit tests?

Yes.

更新日志:

4.0 (2021-06-19) Highlights: This recommended release introduces a setting for configuring the blog time format, adds support for the 'T' timezone format token, updates the bundled Moment.js library, improves documentation, restructures unit test files, notes compatibility through 5.7+, and incorporates numerous behind-the-scenes tweaks. Details: 3.6.2 (2020-06-11) 3.6.1 (2019-12-01)