本文整理汇总了PHP中add_privs函数的典型用法代码示例。如果您正苦于以下问题:PHP add_privs函数的具体用法?PHP add_privs怎么用?PHP add_privs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_privs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Hook UI, setup privileges
*/
function __construct()
{
if (txpinterface == 'admin') {
add_privs('wet_sql2php', '1');
register_tab('presentation', 'wet_sql2php', gTxt('wet_sql2php'));
register_callback(array(__CLASS__, 'ui'), 'wet_sql2php');
}
}
示例2: __construct
/**
* Constructor
*/
public function __construct()
{
if (@txpinterface === 'admin') {
add_privs(self::$slug, '1,2,3,4,5,6');
//add_privs('plugin_prefs.'.self::$slug, '1');
register_callback(array($this, 'handle_request'), self::$slug, '', 1);
register_callback(array($this, 'inject_assets'), 'admin_side', 'head_end');
//register_callback(array($this, 'render_prefs'), 'plugin_prefs.'.self::$slug);
register_callback(array($this, 'install'), 'plugin_lifecycle.' . self::$slug, 'installed');
//register_callback(array($this, 'uninstall'), 'plugin_lifecycle.'.self::$slug, 'deleted');
}
register_callback(array($this, 'handle_public'), 'textpattern');
}
示例3: __construct
/**
* The constructor merges this plugin with the core system.
*/
function __construct()
{
// In a full-fledged plugin your data would probably come from the database, or other more useful sources
// but for educational purposes we content ourselves with this constants.
self::$my_name = 'Donald Swain';
// Some things just never change...
self::$greeting = array('Hello', 'Good-bye');
// Everybody may use this extension
add_privs(__CLASS__, '1,2,3,4,5,6');
// Our user interface lives as a separate tab under 'Extensions'
register_tab('extensions', __CLASS__, gTxt(__CLASS__));
// This plugin has a single entry point 'dispatch' for its sole event
register_callback(array(__CLASS__, 'dispatch'), __CLASS__);
}
示例4: __construct
/**
* Constructor.
*/
public function __construct()
{
add_privs('rah_blobin_sync', '1');
add_privs('prefs.rah_blobin', '1');
register_callback(array($this, 'install'), 'plugin_lifecycle.rah_blobin', 'installed');
register_callback(array($this, 'uninstall'), 'plugin_lifecycle.rah_blobin', 'deleted');
$this->dir = txpath;
if (!defined('rah_blobin_plugins_dir')) {
define('rah_blobin_plugins_dir', $this->path(get_pref('rah_blobin_path')));
}
if (rah_blobin_plugins_dir) {
register_callback(array($this, 'endpoint'), 'textpattern');
$this->sync();
}
}
示例5: define
if (!defined('PLUGIN_LIFECYCLE_NOTIFY')) {
define('PLUGIN_LIFECYCLE_NOTIFY', 0x2);
}
// This plugin wants to receive "plugin_lifecycle.{$plugin['name']}" events
$plugin['flags'] = '0';
if (!defined('txpinterface')) {
@(include_once 'zem_tpl.php');
}
# --- BEGIN PLUGIN CODE ---
if (@txpinterface == 'admin') {
add_privs('article', '1,2,3,4,5,6');
add_privs('hak_tinymce_prefs', '1,2');
add_privs('hak_tinymce_js', '1,2,3,4,5,6');
add_privs('hak_tinymce_compressor_js', '1,2,3,4,5,6');
add_privs('hak_txpimage', '1,2,3,4,5,6');
add_privs('hak_txpcatselect', '1,2,3,4,5,6');
register_callback(array("hak_tinymce", "js_prep"), "hak_tinymce_js");
register_callback(array("hak_tinymce", "compressor_js_prep"), "hak_tinymce_compressor_js");
register_callback("hak_txpimage", "hak_txpimage");
register_callback("hak_txpcatselect", "hak_txpcatselect");
register_tab('extensions', 'hak_tinymce_prefs', 'hak_tinymce');
register_callback(array('hak_tinymce', 'prefs'), 'hak_tinymce_prefs');
register_callback(array('hak_tinymce', 'inject_toggle'), 'article_ui', 'extend_col_1');
register_callback(array("hak_tinymce", "inject_js"), "article_ui", "extend_col_1");
register_callback(array('hak_tinymce', 'override_markup_selects'), 'article_ui', 'markup');
register_callback(array('hak_tinymce', 'track_markup_selection'), 'article_ui', 'view');
}
class hak_tinymce
{
function inject_toggle($event, $step, $default, $context_data = '')
{
示例6: array_merge
if (0) {
?>
# --- BEGIN PLUGIN HELP ---
//inc <README.textile>
# --- END PLUGIN HELP ---
<?php
}
# --- BEGIN PLUGIN CODE ---
if (txpinterface === 'admin') {
global $textarray;
$textarray = array_merge($textarray, array('jmd_dashboard_tab' => 'Dashboard'));
add_privs('jmd_dashboard', 1);
register_callback('jmd_dashboard', 'jmd_dashboard');
ob_start('jmd_dashboard_tab');
}
/**
* Redirects users to ?event=jmd_dashboard upon login (unless they were
* loading another event).
*/
function jmd_dashboard_login()
{
global $siteurl;
if (gps('p_password') && !gps('event')) {
txp_status_header("302 Found");
header("Location: http://{$siteurl}/textpattern/?event=jmd_dashboard");
exit;
}
示例7: _cbe_rndc_texts
// Internal long prefix
if (@txpinterface == 'admin') {
/**
* _cbe_rndc_texts - Admin-side: language strings definitions
*
* @return array
*/
function _cbe_rndc_texts()
{
/* ============== Possible language customisation here ============== */
return array(CBE_RNDC_LPFX . 'tab_label' => 'Random content', CBE_RNDC_LPFX . 'pop_com' => 'Comments generation', CBE_RNDC_LPFX . 'pop_art' => 'Articles generation', CBE_RNDC_LPFX . 'go_back' => 'Back', CBE_RNDC_LPFX . 'no_comm_allowed' => 'Comments are not allowed', CBE_RNDC_LPFX . 'populate' => 'Populate !', CBE_RNDC_LPFX . 'populate_end' => 'Populating finished', CBE_RNDC_LPFX . 'with_errors' => 'with errors');
/* =========================== Stop editing =========================== */
}
global $textarray;
$textarray += call_user_func('_' . CBE_RNDC_SPFX . 'texts');
add_privs(CBE_RNDC_EVENT, '1, 2');
register_tab('extensions', CBE_RNDC_EVENT, gTxt(CBE_RNDC_LPFX . 'tab_label'));
register_callback(CBE_RNDC_LPFX . 'lifecycle', 'plugin_lifecycle.' . CBE_RNDC_EVENT);
register_callback(CBE_RNDC_LPFX . 'router', CBE_RNDC_EVENT);
/* ============================ Internal ============================ */
define('DIGITS', 0);
define('ALPHAMAJUS', 1);
define('ALPHAMINUS', 2);
function _cbe_rndc_minimax(&$mini, &$maxi)
{
if ($maxi == 0) {
$maxi = $mini;
}
if ($maxi < $mini) {
$a = $mini;
$mini = $maxi;
示例8: add_privs
<?php
$plugin['name'] = 'sed_plugin_help_viewer';
$plugin['version'] = '0.4';
$plugin['author'] = 'Netcarver';
$plugin['author_uri'] = 'http://txp-plugins.netcarving.com';
$plugin['description'] = 'Quickly check your plugin\'s help section from the plugin cache dirctory.';
$plugin['type'] = 1;
@(include_once '../zem_tpl.php');
# --- BEGIN PLUGIN CODE ---
if (@txpinterface == 'admin') {
add_privs('sed_plugin_help_viewer', '1,2');
register_tab('extensions', 'sed_plugin_help_viewer', 'Help Viewer');
register_callback('sed_plugin_help_viewer', 'sed_plugin_help_viewer');
}
function sed_plugin_help_viewer($event, $step)
{
if (!$step or !in_array($step, array('view_help'))) {
_sed_list_plugins_from_cache();
} else {
$step();
}
}
function view_help($message = '')
{
pagetop(gTxt('edit_plugins'), $message);
$filename = gps('filename');
$plugin = array();
if (!empty($filename)) {
$content = file($filename);
$source_lines = count($content);
示例9: register_callback
if (function_exists("register_callback")) {
register_callback("asy_flush_event", "article", "edit");
register_callback("asy_flush_event", "article", "create");
register_callback("asy_flush_event", "link");
register_callback("asy_flush_event", "page", "page_save");
register_callback("asy_flush_event", "form", "form_save");
register_callback("asy_flush_event", "list", "list_multi_edit");
register_callback("asy_flush_event", "discuss");
// We do not have a callback when comments are posted on the front_end
// but that's ok, I hacked some magic into jpcache-main.php
register_callback('asy_public_flush', 'zemcontact.submit');
# Thanks Adam Messinger
}
// Add a new tab to the Content area.
if (@txpinterface == 'admin') {
add_privs('asy_jpcache', '1,2');
register_tab("extensions", "asy_jpcache", "jpcache-cleaner");
register_callback("asy_jpcachecleaner", "asy_jpcache");
}
// This is the callback-function when something in the Admin-Panel gets changed. (Wrapper)
function asy_flush_event($event, $step)
{
if ($event === 'article' && ($step === 'create' || $step === 'edit') && (count($_POST) == 0 || isset($_REQUEST['view']) && $_REQUEST['view'] != '')) {
return;
} elseif (count($_POST) == 0) {
return;
}
$count = asy_flushdir(true);
}
// Thanks Adam Messinger
function asy_public_flush()
示例10: add_privs
* @description Thickbox-style image selector
* @author Jon-Michael Deldin
* @author_uri http://jmdeldin.com
* @version 1.0b2
* @type 3
* @order 5
*/
if (txpinterface === 'admin') {
global $event, $jmdImgSel, $prefs;
$jmdImgSel_privs = '1,2,3,4,5';
add_privs('jmd_img_selector', $jmdImgSel_privs);
register_tab('extensions', 'jmd_img_selector', 'jmd_img_selector');
register_callback('jmd_img_selector', 'jmd_img_selector');
add_privs('jmd_img_selector_js', $jmdImgSel_privs);
register_callback('jmd_img_selector_js', 'jmd_img_selector_js');
add_privs('jmd_img_selector_thickbox', $jmdImgSel_privs);
register_callback('jmd_img_selector_thickbox', 'jmd_img_selector_thickbox');
$jmdImgSel_view = gps('view');
if ($event === 'article' && $jmdImgSel_view !== 'preview' && $jmdImgSel_view !== 'html') {
ob_start('jmd_img_selector_head');
}
$jmdImgSel = new JMD_ImgSelector();
if (empty($prefs[$jmdImgSel->prefix('tbWidth')])) {
$jmdImgSel->upsertPref('tbWidth', 600, 1);
}
if (empty($prefs[$jmdImgSel->prefix('tbHeight')])) {
$jmdImgSel->upsertPref('tbHeight', 600, 1);
}
if (empty($prefs[$jmdImgSel->prefix('imgWidth')])) {
$jmdImgSel->upsertPref('imgWidth', 80, 1);
}
示例11: require_plugin
$plugin['author_uri'] = 'http://txp-plugins.netcarving.com';
$plugin['description'] = 'Provides admin interface field customisation on a per-section basis.';
$plugin['type'] = '1';
$plugin['order'] = 5;
@(include_once '../zem_tpl.php');
# --- BEGIN PLUGIN CODE ---
require_plugin('sed_plugin_library');
if (!defined('sed_sf_prefix')) {
define('sed_sf_prefix', 'sed_sf');
}
#===============================================================================
# Admin interface features...
#===============================================================================
if (@txpinterface === 'admin') {
add_privs('sed_sf', '1,2,3,4,5,6');
add_privs('sed_sf.static_sections', '1');
# which users always see all sections in the write-tab select box
global $_sed_sf_using_glz_custom_fields, $prefs, $textarray, $_sed_sf_l18n, $sed_sf_prefs, $_sed_sf_field_keys;
#===========================================================================
# Strings for internationalisation...
#===========================================================================
$_sed_sf_l18n = array('write_tab_heading' => 'Write Tab Fields...', 'hide_cf' => '{global_label} (#{cfnum})', 'hide_section' => 'Hide from non-publishers?', 'hide_all_text' => 'Hide all?', 'show_all_text' => 'Show all?', 'alter_section_tab' => 'Alter Presentation > Section tab?', 'filter_label' => 'Filter…', 'filter_limit' => 'Show section index filter after how many sections?', 'hide' => 'Hide', 'show' => 'Show');
$mlp = new sed_lib_mlp('sed_section_fields', $_sed_sf_l18n, '', 'admin');
#===========================================================================
# Plugin preferences...
#===========================================================================
$sed_sf_prefs = array('alter_section_tab' => array('type' => 'yesnoradio', 'val' => '0'), 'filter_limit' => array('type' => 'text_input', 'val' => '18'));
foreach ($sed_sf_prefs as $key => $data) {
_sed_sf_install_pref($key, $data['val'], $data['type']);
}
#===========================================================================
示例12: array
<?php
# --- BEGIN PLUGIN META ---
$plugin = array('name' => 'rss_article_edit', 'version' => '0.1', 'author' => 'Rob Sable', 'author_uri' => 'http://www.wilshireone.com/', 'description' => 'Add edit article links to your public site.', 'type' => '1');
# --- END PLUGIN META ---
# --- BEGIN PLUGIN CODE ---
if ('admin' === @txpinterface) {
add_privs('editlink', '1,2,3,4,5,6');
// Add a new tab under 'extensions' called 'edit link', for the 'editlink' event
register_tab("extensions", "editlink", "edit link");
// 'rss_admin_editlink' will be called to handle the 'editlink' event
register_callback("rss_admin_editlink", "editlink");
}
function rss_admin_editlink($event, $step)
{
global $rss_ae_cookie;
include txpath . '/include/txp_prefs.php';
if (!isset($rss_ae_cookie)) {
$rss_ae_cookie = "rss_article_edit";
$rs = safe_insert('txp_prefs', "name='rss_ae_cookie', val='{$rss_ae_cookie}', prefs_id='1'");
}
if (gps("add")) {
safe_update("txp_prefs", "val = '" . addslashes(ps('rss_ae_cookie')) . "'", "name = 'rss_ae_cookie' and prefs_id ='1'");
setcookie($rss_ae_cookie, $rss_ae_cookie, time() + 31536000, "/");
header("Location: index.php?event=editlink");
} else {
if (gps("rem")) {
safe_update("txp_prefs", "val = '" . addslashes(ps('rss_ae_cookie')) . "'", "name = 'rss_ae_cookie' and prefs_id ='1'");
setcookie($rss_ae_cookie, $rss_ae_cookie, time() - 3600, "/");
header("Location: index.php?event=editlink");
}
示例13: add_privs
$new_product_event = 'product';
$new_product_name = 'Product';
$products_event = 'products';
$products_name = 'Products';
$customers_event = 'customers';
$customers_name = 'Customers';
$customer_event = 'customer';
$customer_name = 'Customer';
$orders_event = 'orders';
$orders_name = 'Orders';
$settings_event = 'settings';
$settings_name = 'Settings';
$dashboard_event = 'store';
$dashboard_name = 'Dashboard';
// Set the privilege levels for our new event
add_privs($store_categories_event, '1,2');
if (isset($_REQUEST['step'])) {
$step = $_REQUEST['step'];
} else {
$step = "";
}
if (isset($_REQUEST['event'])) {
$event = $_REQUEST['event'];
}
if ($event == "product") {
switch (strtolower($step)) {
// 'zem_admin_test' will be called to handle the new event
case "":
register_callback("product_edit", $new_product_event);
break;
case "create":
示例14: define
if (!defined('PLUGIN_HAS_PREFS')) {
define('PLUGIN_HAS_PREFS', 0x1);
}
// This plugin wants to receive "plugin_prefs.{$plugin['name']}" events
if (!defined('PLUGIN_LIFECYCLE_NOTIFY')) {
define('PLUGIN_LIFECYCLE_NOTIFY', 0x2);
}
// This plugin wants to receive "plugin_lifecycle.{$plugin['name']}" events
$plugin['flags'] = '0';
if (!defined('txpinterface')) {
@(include_once 'zem_tpl.php');
}
# --- BEGIN PLUGIN CODE ---
//<?php
if (@txpinterface == 'admin') {
add_privs('bot_admin_tooltips_tab', '1,2');
register_tab('extensions', 'bot_admin_tooltips_tab', 'bot_admin_tooltips');
register_callback('bot_admin_tooltips_tab', 'bot_admin_tooltips_tab');
register_callback('bot_admin_tooltips', 'article');
register_callback('bot_admin_tooltips', 'category');
register_callback('bot_admin_tooltips', 'list');
register_callback('bot_admin_tooltips', 'image');
register_callback('bot_admin_tooltips', 'file');
register_callback('bot_admin_tooltips', 'link');
register_callback('bot_admin_tooltips', 'discuss');
register_callback('bot_admin_tooltips', 'admin');
}
global $bot_admin_tooltips, $bot_admin_tooltips_main_array;
//set globals
if (getThings("Show tables like '" . PFX . "bot_admin_tooltips'")) {
// if plugin is installed loads items and tips from db
示例15: rah_textile_bar_install
##################
#
# rah_textile_bar-plugin for Textpattern
# version 0.7
# by Jukka Svahn
# http://rahforum.biz
#
# Copyright (C) 2011 Jukka Svahn <http://rahforum.biz>
# Licensed under GNU Genral Public License version 2
# http://www.gnu.org/licenses/gpl-2.0.html
#
###################
if (@txpinterface == 'admin') {
rah_textile_bar_install();
rah_textile_bar_img();
add_privs('plugin_prefs.rah_textile_bar', '1,2');
register_callback('rah_textile_bar_prefs', 'plugin_prefs.rah_textile_bar');
register_callback('rah_textile_bar_install', 'plugin_lifecycle.rah_textile_bar');
register_callback('rah_textile_bar', 'admin_side', 'head_end');
}
/**
Installer
@param $event string Admin-side event.
@param $step string Admin-side event, plugin-lifecycle step.
*/
function rah_textile_bar_install($event = '', $step = '')
{
if ($step == 'deleted') {
safe_delete('txp_prefs', "name like 'rah_textile_bar_%'");
return;
}