本文整理汇总了PHP中Dashboard::addNewItem方法的典型用法代码示例。如果您正苦于以下问题:PHP Dashboard::addNewItem方法的具体用法?PHP Dashboard::addNewItem怎么用?PHP Dashboard::addNewItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dashboard
的用法示例。
在下文中一共展示了Dashboard::addNewItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __
<?php
// Add plugin navigation link
Navigation::add(__('Blocks', 'blocks'), 'content', 'blocks', 2);
Dashboard::addNewItem('blocks', __('Blocks', 'blocks'), 'index.php?id=blocks&action=add_block', 2);
/**
* Blocks Admin Class
*/
class BlocksAdmin extends Backend
{
/**
* Blocks admin function
*/
public static function main()
{
// Init vars
$blocks_path = STORAGE . DS . 'blocks' . DS;
$blocks_list = array();
$errors = array();
// Check for get actions
// -------------------------------------
if (Request::get('action')) {
// Switch actions
// -------------------------------------
switch (Request::get('action')) {
// Add block
// -------------------------------------
case "add_block":
if (Request::post('add_blocks') || Request::post('add_blocks_and_exit')) {
if (Security::check(Request::post('csrf'))) {
if (trim(Request::post('name')) == '') {
示例2: __
<?php
// Add plugin navigation link
Navigation::add(__('Snippets', 'snippets'), 'extends', 'snippets', 3);
Dashboard::addNewItem('snippets', __('Snippets', 'snippets'), 'index.php?id=snippets&action=add_snippet', 3);
/**
* Snippets Admin Class
*/
class SnippetsAdmin extends Backend
{
/**
* Snippets admin function
*/
public static function main()
{
// Init vars
$snippets_path = STORAGE . DS . 'snippets' . DS;
$snippets_list = array();
$errors = array();
// Check for get actions
// -------------------------------------
if (Request::get('action')) {
// Switch actions
// -------------------------------------
switch (Request::get('action')) {
// Add snippet
// -------------------------------------
case "add_snippet":
if (Request::post('add_snippets') || Request::post('add_snippets_and_exit')) {
if (Security::check(Request::post('csrf'))) {
if (trim(Request::post('name')) == '') {
示例3: __
<?php
// Add plugin navigation link
Navigation::add(__('Pages', 'pages'), 'content', 'pages', 1);
Dashboard::addNewItem('pages', __('Page', 'pages'), 'index.php?id=pages&action=add_page', 1);
// Add action on admin_pre_render hook
Action::add('admin_pre_render', 'PagesAdmin::_pageExpandAjax');
/**
* Pages Admin Class
*/
class PagesAdmin extends Backend
{
/**
* Pages tables
*
* @var object
*/
public static $pages = null;
/**
* _pageExpandAjax
*/
public static function _pageExpandAjax()
{
if (Request::post('page_slug')) {
if (Security::check(Request::post('token'))) {
$pages = new Table('pages');
$pages->updateWhere('[slug="' . Request::post('page_slug') . '"]', array('expand' => Request::post('page_expand')));
Request::shutdown();
} else {
die('Request was denied because it contained an invalid security token. Please refresh the page and try again.');
}