stnvh/silverstripe-infoboxes 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

stnvh/silverstripe-infoboxes

最新稳定版本:1.2.1

Composer 安装命令:

composer require stnvh/silverstripe-infoboxes

包简介

Conditional CMS info boxes.

README 文档

README

Build Status Latest Stable Version License

Conditional CMS info boxes.

Info Boxes

By Stan Hutcheon - Bigfork Ltd

Installation:

Composer:

composer require stnvh/silverstripe-infoboxes ~1

Download:

Clone this repo into a folder called infoboxes in your silverstripe installation folder.

Usage:

It currently has 5 built in checks:

  • Dev mode
  • Favicon existance
  • Google analytics code
  • Default password
  • if www is used

To add a check, create a file in /mysite/code/ called InfoBox_[your_check_name].php with the following functions:

example:

<?php

class InfoBox_example implements InfoBox {

	public function show() {
        return Director::isLive(); // Our conditional code, this can be anything as long as it returns true or false
	}

	public function message() {
		return 'Live Mode'; // Message to be displayed
	}

	public function severity() {
		return 2; // 0 = severe, 1 = warning, 2 = info
	}

	public function link() {
		// Can be any internal or external URL, or false if none
		return 'http://doc.silverstripe.org/framework/en/topics/debugging/#environment-types';
	}
    
}

You can now programmatically disable specific checks via the config API. Either via config.yml:

InfoBoxes:
  disabled:
    - example
    - dev
    - www

or via _config.php:

<?php

InfoBoxes::set_disabled('example');
// or
InfoBoxes::set_disabled(array('www', 'dev'));

You can either use the concatenated classname (e.g InfoBox_www -> www) or the full class name.

After installing via composer, or after adding a new InfoBox, you must /dev/build

统计信息

  • 总下载量: 2.23k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2014-07-23