本文整理汇总了PHP中plugin_load函数的典型用法代码示例。如果您正苦于以下问题:PHP plugin_load函数的具体用法?PHP plugin_load怎么用?PHP plugin_load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plugin_load函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: numberingProcessNum
function numberingProcessNum()
{
$db = numberingDB();
$helper = plugin_load('helper', 'numbering');
$start = urldecode($helper->getConfValue('nstart'));
$number = getNumberingNextNumber($db, $start);
$padding = urldecode($helper->getConfValue('padding'));
$len = (int) urldecode($helper->getConfValue('pad_length'));
$set_date = $helper->getConfValue('set_date');
$format = urldecode($helper->getConfValue('format'));
if ($helper->getConfValue('use_imgs')) {
$imagestr = urldecode($helper->getConfValue('imgs'));
$images = explode(',', $imagestr);
$i_no = 0;
foreach ($images as $img) {
$nxt = '%i' . ++$i_no;
$format = str_replace($nxt, '{{' . $img . '}}', $format);
}
}
if ($set_date) {
$dformat = urldecode($helper->getConfValue('datestyle'));
$time = strftime($dformat);
$format = str_replace('%d', $time, $format);
}
$n = str_pad((string) $number, (int) $len, $padding, STR_PAD_LEFT);
$format = str_replace('%n', $n, $format);
echo "{$format}\n\n";
}
示例2: handle
/**
* handle user request
*/
function handle()
{
if (!isset($_REQUEST['cmd'])) {
return;
// first time - nothing to do
}
if (!checkSecurityToken()) {
return;
}
if (!is_array($_REQUEST['cmd'])) {
return;
}
$crud = plugin_load('helper', 'judge_crud', true);
// verify valid values
switch (key($_REQUEST['cmd'])) {
case 'get':
$this->output = '<div class="table sectionedit1">
<table class="inline">';
$table = $crud->tableRender(array('problem_name' => $_REQUEST['problem_name'], 'type' => $_REQUEST['type'], 'user' => $_REQUEST['user']), "html", 1, "timestamp");
if ($table["count"] == 0) {
$this->output .= '<p>' . $this->getLang("empty_result") . '</p>';
break;
} else {
$this->output .= $table["submissions_table"];
}
$this->output .= "</table></div>";
break;
case 'delete':
$this->output = $crud->delSubmissions(array('problem_name' => $_REQUEST['problem_name'], 'type' => $_REQUEST['type'], 'user' => $_REQUEST['user']));
break;
}
}
示例3: handle_schema
/**
* Load a whole schema as fields
*
* @param Doku_Event $event event object by reference
* @param mixed $param [the parameters passed as fifth argument to register_hook() when this
* handler was registered]
* @return bool
*/
public function handle_schema(Doku_Event $event, $param)
{
$args = $event->data['args'];
if ($args[0] != 'struct_schema') {
return false;
}
$event->preventDefault();
$event->stopPropagation();
/** @var helper_plugin_bureaucracy_field $helper */
$helper = plugin_load('helper', 'bureaucracy_field');
$helper->initialize($args);
$schema = new Schema($helper->opt['label']);
if (!$schema->getId()) {
msg('This schema does not exist', -1);
return false;
}
foreach ($schema->getColumns(false) as $column) {
/** @var helper_plugin_struct_field $field */
$field = plugin_load('helper', 'struct_field');
// we don't initialize the field but set the appropriate values
$field->opt = $helper->opt;
// copy all the settings to each field
$field->opt['label'] = $column->getFullQualifiedLabel();
$field->column = $column;
$event->data['fields'][] = $field;
}
return true;
}
示例4: handle_ajax
/**
* Rename a single page
*/
public function handle_ajax(Doku_Event $event)
{
if ($event->data != 'plugin_move_rename') {
return;
}
$event->preventDefault();
$event->stopPropagation();
global $MSG;
global $INPUT;
$src = cleanID($INPUT->str('id'));
$dst = cleanID($INPUT->str('newid'));
/** @var helper_plugin_move_op $MoveOperator */
$MoveOperator = plugin_load('helper', 'move_op');
$JSON = new JSON();
header('Content-Type: application/json');
if ($this->renameOkay($src) && $MoveOperator->movePage($src, $dst)) {
// all went well, redirect
echo $JSON->encode(array('redirect_url' => wl($dst, '', true, '&')));
} else {
if (isset($MSG[0])) {
$error = $MSG[0];
// first error
} else {
$error = $this->getLang('cantrename');
}
echo $JSON->encode(array('error' => $error));
}
}
示例5: handle
function handle()
{
global $lang;
$cid = $_REQUEST['cid'];
if (is_array($cid)) {
$cid = array_keys($cid);
}
$action =& plugin_load('action', 'discussion');
if (!$action) {
return;
}
// couldn't load action plugin component
switch ($_REQUEST['comment']) {
case $lang['btn_delete']:
$action->_save($cid, '');
break;
case $this->getLang('btn_show'):
$action->_save($cid, '', 'show');
break;
case $this->getLang('btn_hide'):
$action->_save($cid, '', 'hide');
break;
case $this->getLang('btn_change'):
$this->_changeStatus($_REQUEST['status']);
break;
}
}
示例6: handle
function handle($match, $state, $pos, Doku_Handler $handler)
{
global $DOKU_PLUGINS;
preg_match('/^\\n[ \\t]*>(?:[ \\t>]*>)?[ \\t]?/', $match, $quotearg);
$quoteinarg = preg_replace('/^\\n[ \\t]*>(?:[ \\t>]*>)?[ \\t]?/', '', $match);
if ($state == DOKU_LEXER_ENTER) {
$ReWriter = new Doku_Handler_Markdown_Quote($handler->CallWriter);
$handler->CallWriter =& $ReWriter;
$handler->_addCall('quote_start', $quotearg, $pos);
} elseif ($state == DOKU_LEXER_EXIT) {
$handler->_addCall('quote_end', array(), $pos);
$handler->CallWriter->process();
$ReWriter =& $handler->CallWriter;
$handler->CallWriter =& $ReWriter->CallWriter;
}
if ($quoteinarg == '') {
$handler->_addCall('quote_newline', $quotearg, $pos);
/* ATX headers (headeratx) */
} elseif (preg_match('/^\\#{1,6}[ \\t]*.+?[ \\t]*\\#*/', $quoteinarg)) {
$plugin =& plugin_load('syntax', 'markdowku_headeratx');
$plugin->handle($quoteinarg, $state, $pos, $handler);
/* Horizontal rulers (hr) */
} elseif (preg_match('/[ ]{0,2}(?:[ ]?_[ ]?){3,}[ \\t]*/', $quoteinarg) or preg_match('/[ ]{0,2}(?:[ ]?-[ ]?){3,}[ \\t]*/', $quoteinarg) or preg_match('/[ ]{0,2}(?:[ ]?\\*[ ]?){3,}[ \\t]*/', $quoteinarg)) {
$plugin =& plugin_load('syntax', 'markdowku_hr');
$plugin->handle($quoteinarg, $state, $pos, $handler);
/* Setext headers (headersetext) */
} elseif (preg_match('/^[^\\n]+?[ \\t]*\\n[ \\t]*>(?:[ \\t>]*>)?[ \\t]?=+[ \\t]*/', $quoteinarg) or preg_match('/^[^\\n]+?[ \\t]*\\n[ \\t]*>(?:[ \\t>]*>)?[ \\t]?-+[ \\t]*/', $quoteinarg)) {
$quoteinarg = preg_replace('/(?<=\\n)[ \\t]*>(?:[ \\t>]*>)?[ \\t]?/', '', $quoteinarg);
$plugin =& plugin_load('syntax', 'markdowku_headersetext');
$plugin->handle($quoteinarg, $state, $pos, $handler);
} else {
$handler->_addCall('cdata', array($quoteinarg), $pos);
}
return true;
}
示例7: handle
function handle()
{
global $lang;
$lid = $_REQUEST['lid'];
if (is_array($lid)) {
$lid = array_keys($lid);
}
$action =& plugin_load('action', 'linkback_display');
if (!$action) {
return;
}
// couldn't load action plugin component
switch ($_REQUEST['linkback']) {
case $lang['btn_delete']:
$action->_deleteLinkbacks($lid);
break;
case $this->getLang('btn_show'):
$action->_changeLinkbackVisibilities($lid, true);
break;
case $this->getLang('btn_hide'):
$action->_changeLinkbackVisibilities($lid, false);
break;
case $this->getLang('btn_ham'):
$action->_markLinkbacks($lid, false);
break;
case $this->getLang('btn_spam'):
$action->_markLinkbacks($lid, true);
break;
case $this->getLang('btn_change'):
$this->_changeStatus($_REQUEST['status']);
break;
}
}
示例8: handle_editform_output
/**
* Create the additional fields for the edit form
*/
function handle_editform_output(&$event, $param)
{
// check if source view -> no captcha needed
if (!$param['oldhook']) {
// get position of submit button
$pos = $event->data->findElementByAttribute('type', 'submit');
if (!$pos) {
return;
}
// no button -> source view mode
} elseif ($param['editform'] && !$event->data['writable']) {
if ($param['editform'] && !$event->data['writable']) {
return;
}
}
// do nothing if logged in user and no CAPTCHA required
if (!$this->getConf('forusers') && $_SERVER['REMOTE_USER']) {
return;
}
// get the CAPTCHA
$helper = plugin_load('helper', 'captcha');
$out = $helper->getHTML();
if ($param['oldhook']) {
// old wiki - just print
echo $out;
} else {
// new wiki - insert at correct position
$event->data->insertElement($pos++, $out);
}
}
示例9: setUp
public function setUp()
{
parent::setUp();
/** @var \helper_plugin_struct_db $sqlite */
$sqlite = plugin_load('helper', 'struct_db');
$this->sqlite = $sqlite->getDB();
}
示例10: addApproval
function addApproval()
{
global $USERINFO;
global $ID;
global $INFO;
if (!$INFO['exists']) {
msg($this->getLang('cannot approve a non-existing revision'), -1);
return;
}
$approvalRevision = $this->helper->getRevision();
$approvals = $this->helper->getApprovals();
if (!isset($approvals[$approvalRevision])) {
$approvals[$approvalRevision] = array();
}
$approvals[$approvalRevision][$INFO['client']] = array($INFO['client'], $_SERVER['REMOTE_USER'], $USERINFO['mail'], time());
$success = p_set_metadata($ID, array('approval' => $approvals), true, true);
if ($success) {
msg($this->getLang('version approved'), 1);
$data = array();
$data['rev'] = $approvalRevision;
$data['id'] = $ID;
$data['approver'] = $_SERVER['REMOTE_USER'];
$data['approver_info'] = $USERINFO;
if ($this->getConf('send_mail_on_approve') && $this->helper->isRevisionApproved($approvalRevision)) {
/** @var action_plugin_publish_mail $mail */
$mail = plugin_load('action', 'publish_mail');
$mail->send_approve_mail();
}
trigger_event('PLUGIN_PUBLISH_APPROVE', $data);
} else {
msg($this->getLang('cannot approve error'), -1);
}
send_redirect(wl($ID, array('rev' => $this->helper->getRevision()), true, '&'));
}
示例11: handle_ajax
/**
* Step up
*
* @param Doku_Event $event
*/
public function handle_ajax(Doku_Event $event)
{
if ($event->data != 'plugin_move_progress') {
return;
}
$event->preventDefault();
$event->stopPropagation();
global $INPUT;
global $USERINFO;
if (!auth_ismanager($_SERVER['REMOTE_USER'], $USERINFO['grps'])) {
http_status(403);
exit;
}
$return = array('error' => '', 'complete' => false, 'progress' => 0);
/** @var helper_plugin_move_plan $plan */
$plan = plugin_load('helper', 'move_plan');
if (!$plan->isCommited()) {
// There is no plan. Something went wrong
$return['complete'] = true;
} else {
$todo = $plan->nextStep($INPUT->bool('skip'));
$return['progress'] = $plan->getProgress();
$return['error'] = $plan->getLastError();
if ($todo === 0) {
$return['complete'] = true;
}
}
$json = new JSON();
header('Content-Type: application/json');
echo $json->encode($return);
}
示例12: ajax_siteexport_cron_provider
/**
* AJAX Provider - check what is going to be done
* @param $event
* @param $args
*/
public function ajax_siteexport_cron_provider(&$event, $args)
{
// If this is not a siteexport call - and cron call, ignore it.
if (!(strstr($event->data, '__siteexport') && strstr($event->data, 'cron'))) {
return;
}
$this->__init_functions();
$cronOverwriteExisting = intval($_REQUEST['cronOverwriteExisting']) == 1;
list($url, $combined) = $this->ajax_siteexport_prepareURL_and_POSTData($event);
if (!($function =& plugin_load('cron', 'siteexport'))) {
$this->functions->debug->message("Could not load Cron base", null, 4);
return;
}
$this->functions->debug->message("Will write parameters to Cron:", $combined, 1);
$status = null;
switch ($event->data) {
case '__siteexport_savecron':
$status = $function->saveCronDataWithParameters($combined, $cronOverwriteExisting);
break;
case '__siteexport_deletecron':
$status = $function->deleteCronDataWithParameters($combined);
break;
case '__siteexport_showcron':
$status = $this->printCronDataList($function->configuration);
break;
default:
$this->functions->debug->message("Uhoh. You did not say the magic word.", null, 4);
}
if (!empty($status)) {
$this->functions->debug->message("Tried to do an action with siteexport/cron, but failed.", "Tried to do an action with siteexport/cron, but failed. ({$status})" . 4);
}
}
示例13: init
/**
* Initialize the database
*
* @throws Exception
*/
protected function init()
{
/** @var helper_plugin_sqlite $sqlite */
$this->sqlite = plugin_load('helper', 'sqlite');
if (!$this->sqlite) {
if (defined('DOKU_UNITTEST')) {
throw new \Exception('Couldn\'t load sqlite.');
}
msg('The struct plugin requires the sqlite plugin. Please install it', -1);
return;
}
if ($this->sqlite->getAdapter()->getName() != DOKU_EXT_PDO) {
if (defined('DOKU_UNITTEST')) {
throw new \Exception('Couldn\'t load PDO sqlite.');
}
msg('The struct plugin requires sqlite3 you\'re still using sqlite2', -1);
$this->sqlite = null;
return;
}
$this->sqlite->getAdapter()->setUseNativeAlter(true);
// initialize the database connection
if (!$this->sqlite->init('struct', DOKU_PLUGIN . 'struct/db/')) {
if (defined('DOKU_UNITTEST')) {
throw new \Exception('Couldn\'t init sqlite.');
}
return;
}
// register our JSON function with variable parameters
// todo this might be useful to be moved into the sqlite plugin
$this->sqlite->create_function('STRUCT_JSON', array($this, 'STRUCT_JSON'), -1);
}
示例14: admin_plugin_blogtng
function admin_plugin_blogtng()
{
$this->commenthelper =& plugin_load('helper', 'blogtng_comments');
$this->entryhelper =& plugin_load('helper', 'blogtng_entry');
$this->sqlitehelper =& plugin_load('helper', 'blogtng_sqlite');
$this->taghelper =& plugin_load('helper', 'blogtng_tags');
}
示例15: render
function render($mode, &$renderer, $indata)
{
if ($mode == 'xhtml') {
list($state, $data) = $indata;
switch ($state) {
case DOKU_LEXER_ENTER:
$pluginClass = $this->getConf('addStyling') ? 'blockquote-plugin' : '';
$attr = '';
if ($data && strlen($data) > 0 && !plugin_isdisabled('wrap')) {
// get attributes from wrap helper plugin (if installed)
$wrap =& plugin_load('helper', 'wrap');
$attr = $wrap->buildAttributes($data, $pluginClass);
} else {
if ($pluginClass) {
$attr = 'class="' . $pluginClass . '"';
}
}
$renderer->doc .= '<cite ' . $attr . '>';
break;
case DOKU_LEXER_UNMATCHED:
$renderer->doc .= $renderer->_xmlEntities($data);
break;
case DOKU_LEXER_EXIT:
$renderer->doc .= "</cite>";
break;
}
return true;
}
// unsupported $mode
return false;
}