当前位置: 首页>>代码示例>>PHP>>正文


PHP Doku_Event::advise_after方法代码示例

本文整理汇总了PHP中Doku_Event::advise_after方法的典型用法代码示例。如果您正苦于以下问题:PHP Doku_Event::advise_after方法的具体用法?PHP Doku_Event::advise_after怎么用?PHP Doku_Event::advise_after使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doku_Event的用法示例。


在下文中一共展示了Doku_Event::advise_after方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _tpl_toolsevent

/**
 * Create event for tools menues
 *
 * @author Anika Henke <anika@selfthinker.org>
 */
function _tpl_toolsevent($toolsname, $items, $view = 'main')
{
    $data = array('view' => $view, 'items' => $items);
    $hook = 'TEMPLATE_' . strtoupper($toolsname) . '_DISPLAY';
    $evt = new Doku_Event($hook, $data);
    if ($evt->advise_before()) {
        foreach ($evt->data['items'] as $k => $html) {
            echo $html;
        }
    }
    $evt->advise_after();
}
开发者ID:nicoverbruggen,项目名称:dw-writr-alt,代码行数:17,代码来源:tpl_functions.php

示例2: sendRequest

 /**
  * Wraps an event around the parent function
  *
  * @triggers HTTPCLIENT_REQUEST_SEND
  * @author   Andreas Gohr <andi@splitbrain.org>
  */
 function sendRequest($url, $data = '', $method = 'GET')
 {
     $httpdata = array('url' => $url, 'data' => $data, 'method' => $method);
     $evt = new Doku_Event('HTTPCLIENT_REQUEST_SEND', $httpdata);
     if ($evt->advise_before()) {
         $url = $httpdata['url'];
         $data = $httpdata['data'];
         $method = $httpdata['method'];
     }
     $evt->advise_after();
     unset($evt);
     return parent::sendRequest($url, $data, $method);
 }
开发者ID:ryankask,项目名称:dokuwiki,代码行数:19,代码来源:HTTPClient.php

示例3: toolbar_JSdefines

/**
 * Prepares and prints an JavaScript array with all toolbar buttons
 *
 * @emits  TOOLBAR_DEFINE
 * @param  string $varname Name of the JS variable to fill
 * @author Andreas Gohr <andi@splitbrain.org>
 */
function toolbar_JSdefines($varname)
{
    global $lang;
    $menu = array();
    $evt = new Doku_Event('TOOLBAR_DEFINE', $menu);
    if ($evt->advise_before()) {
        // build button array
        $menu = array_merge($menu, array(array('type' => 'format', 'title' => $lang['qb_bold'], 'icon' => 'bold.png', 'key' => 'b', 'open' => '**', 'close' => '**', 'block' => false), array('type' => 'format', 'title' => $lang['qb_italic'], 'icon' => 'italic.png', 'key' => 'i', 'open' => '//', 'close' => '//', 'block' => false), array('type' => 'format', 'title' => $lang['qb_underl'], 'icon' => 'underline.png', 'key' => 'u', 'open' => '__', 'close' => '__', 'block' => false), array('type' => 'format', 'title' => $lang['qb_code'], 'icon' => 'mono.png', 'key' => 'c', 'open' => "''", 'close' => "''", 'block' => false), array('type' => 'format', 'title' => $lang['qb_strike'], 'icon' => 'strike.png', 'key' => 'd', 'open' => '<del>', 'close' => '</del>', 'block' => false), array('type' => 'autohead', 'title' => $lang['qb_hequal'], 'icon' => 'hequal.png', 'key' => '8', 'text' => $lang['qb_h'], 'mod' => 0, 'block' => true), array('type' => 'autohead', 'title' => $lang['qb_hminus'], 'icon' => 'hminus.png', 'key' => '9', 'text' => $lang['qb_h'], 'mod' => 1, 'block' => true), array('type' => 'autohead', 'title' => $lang['qb_hplus'], 'icon' => 'hplus.png', 'key' => '0', 'text' => $lang['qb_h'], 'mod' => -1, 'block' => true), array('type' => 'picker', 'title' => $lang['qb_hs'], 'icon' => 'h.png', 'class' => 'pk_hl', 'list' => array(array('type' => 'format', 'title' => $lang['qb_h1'], 'icon' => 'h1.png', 'key' => '1', 'open' => '====== ', 'close' => ' ======\\n'), array('type' => 'format', 'title' => $lang['qb_h2'], 'icon' => 'h2.png', 'key' => '2', 'open' => '===== ', 'close' => ' =====\\n'), array('type' => 'format', 'title' => $lang['qb_h3'], 'icon' => 'h3.png', 'key' => '3', 'open' => '==== ', 'close' => ' ====\\n'), array('type' => 'format', 'title' => $lang['qb_h4'], 'icon' => 'h4.png', 'key' => '4', 'open' => '=== ', 'close' => ' ===\\n'), array('type' => 'format', 'title' => $lang['qb_h5'], 'icon' => 'h5.png', 'key' => '5', 'open' => '== ', 'close' => ' ==\\n')), 'block' => true), array('type' => 'linkwiz', 'title' => $lang['qb_link'], 'icon' => 'link.png', 'key' => 'l', 'open' => '[[', 'close' => ']]', 'block' => false), array('type' => 'format', 'title' => $lang['qb_extlink'], 'icon' => 'linkextern.png', 'open' => '[[', 'close' => ']]', 'sample' => 'http://example.com|' . $lang['qb_extlink'], 'block' => false), array('type' => 'formatln', 'title' => $lang['qb_ol'], 'icon' => 'ol.png', 'open' => '  - ', 'close' => '', 'key' => '-', 'block' => true), array('type' => 'formatln', 'title' => $lang['qb_ul'], 'icon' => 'ul.png', 'open' => '  * ', 'close' => '', 'key' => '.', 'block' => true), array('type' => 'insert', 'title' => $lang['qb_hr'], 'icon' => 'hr.png', 'insert' => '\\n----\\n', 'block' => true), array('type' => 'mediapopup', 'title' => $lang['qb_media'], 'icon' => 'image.png', 'url' => 'lib/exe/mediamanager.php?ns=', 'name' => 'mediaselect', 'options' => 'width=750,height=500,left=20,top=20,scrollbars=yes,resizable=yes', 'block' => false), array('type' => 'picker', 'title' => $lang['qb_smileys'], 'icon' => 'smiley.png', 'list' => getSmileys(), 'icobase' => 'smileys', 'block' => false), array('type' => 'picker', 'title' => $lang['qb_chars'], 'icon' => 'chars.png', 'list' => explode(' ', 'À à Á á  â à ã Ä ä Ǎ ǎ Ă ă Å å Ā ā Ą ą Æ æ Ć ć Ç ç Č č Ĉ ĉ Ċ ċ Ð đ ð Ď ď È è É é Ê ê Ë ë Ě ě Ē ē Ė ė Ę ę Ģ ģ Ĝ ĝ Ğ ğ Ġ ġ Ĥ ĥ Ì ì Í í Î î Ï ï Ǐ ǐ Ī ī İ ı Į į Ĵ ĵ Ķ ķ Ĺ ĺ Ļ ļ Ľ ľ Ł ł Ŀ ŀ Ń ń Ñ ñ Ņ ņ Ň ň Ò ò Ó ó Ô ô Õ õ Ö ö Ǒ ǒ Ō ō Ő ő Œ œ Ø ø Ŕ ŕ Ŗ ŗ Ř ř Ś ś Ş ş Š š Ŝ ŝ Ţ ţ Ť ť Ù ù Ú ú Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ů ů ǖ ǘ ǚ ǜ Ų ų Ű ű Ŵ ŵ Ý ý Ÿ ÿ Ŷ ŷ Ź ź Ž ž Ż ż Þ þ ß Ħ ħ ¿ ¡ ¢ £ ¤ ¥ € ¦ § ª ¬ ¯ ° ± ÷ ‰ ¼ ½ ¾ ¹ ² ³ µ ¶ † ‡ · • º ∀ ∂ ∃ Ə ə ∅ ∇ ∈ ∉ ∋ ∏ ∑ ‾ − ∗ √ ∝ ∞ ∠ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥ ⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ◊ ℘ ℑ ℜ ℵ ♠ ♣ ♥ ♦ α β Γ γ Δ δ ε ζ η Θ θ ι κ Λ λ μ Ξ ξ Π π ρ Σ σ Τ τ υ Φ φ χ Ψ ψ Ω ω ★ ☆ ☎ ☚ ☛ ☜ ☝ ☞ ☟ ☹ ☺ ✔ ✘ × „ “ ” ‚ ‘ ’ « » ‹ › — – … ← ↑ → ↓ ↔ ⇐ ⇑ ⇒ ⇓ ⇔ © ™ ® ′ ″ [ ] { } ~ ( ) % § $ # | @'), 'block' => false), array('type' => 'signature', 'title' => $lang['qb_sig'], 'icon' => 'sig.png', 'key' => 'y', 'block' => false)));
    }
    // end event TOOLBAR_DEFINE default action
    $evt->advise_after();
    unset($evt);
    // use JSON to build the JavaScript array
    $json = new JSON();
    print "var {$varname} = " . $json->encode($menu) . ";\n";
}
开发者ID:stretchyboy,项目名称:dokuwiki,代码行数:23,代码来源:toolbar.php

示例4: white_toolsevent

/**
 * copied to core (available since Detritus)
 */
function white_toolsevent($toolsname, $items, $view = 'main')
{
    $data = array('view' => $view, 'items' => $items);
    $hook = 'TEMPLATE_' . strtoupper($toolsname) . '_DISPLAY';
    $evt = new Doku_Event($hook, $data);
    if ($evt->advise_before()) {
        $actions = array('export_pdf');
        foreach ($evt->data['items'] as $k => $html) {
            if (in_array($k, $actions)) {
                $html = str_replace(' ' . $k, ' plugin_' . $k, $html);
            }
            echo $html;
        }
    }
    $evt->advise_after();
}
开发者ID:ipari,项目名称:dokuwiki-template-white,代码行数:19,代码来源:tpl_functions.php

示例5: _preview_before

 /**
  * Triggers before preview xhtml render,
  * allows plugins to metadata render on the preview.
  */
 public function _preview_before(&$event, $param)
 {
     global $ACT;
     global $TEXT;
     global $SUF;
     global $PRE;
     global $ID;
     global $METADATA_RENDERERS;
     if ($ACT == 'preview') {
         $triples =& plugin_load('helper', 'strata_triples');
         $triples->beginPreview();
         $text = $PRE . $TEXT . $SUF;
         $orig = p_read_metadata($ID);
         // store the original metadata in the global $METADATA_RENDERERS so p_set_metadata can use it
         $METADATA_RENDERERS[$ID] =& $orig;
         // add an extra key for the event - to tell event handlers the page whose metadata this is
         $orig['page'] = $ID;
         $evt = new Doku_Event('STRATA_PREVIEW_METADATA_RENDER', $orig);
         if ($evt->advise_before()) {
             // get instructions
             $instructions = p_get_instructions($text);
             if (is_null($instructions)) {
                 unset($METADATA_RENDERERS[$ID]);
                 return null;
                 // something went wrong with the instructions
             }
             // set up the renderer
             $renderer = new renderer_plugin_strata();
             $renderer->meta =& $orig['current'];
             $renderer->persistent =& $orig['persistent'];
             // loop through the instructions
             foreach ($instructions as $instruction) {
                 // execute the callback against the renderer
                 call_user_func_array(array(&$renderer, $instruction[0]), (array) $instruction[1]);
             }
             $evt->result = array('current' => &$renderer->meta, 'persistent' => &$renderer->persistent);
         }
         $evt->advise_after();
         // clean up
         unset($METADATA_RENDERERS[$id]);
     }
 }
开发者ID:virk,项目名称:dokuwiki-strata,代码行数:46,代码来源:action.php

示例6: tpl_content_core

function tpl_content_core()
{
    global $ACT;
    global $TEXT;
    global $PRE;
    global $SUF;
    global $SUM;
    global $IDX;
    switch ($ACT) {
        case 'show':
            html_show();
            break;
        case 'preview':
            html_edit($TEXT);
            html_show($TEXT);
            break;
        case 'recover':
            html_edit($TEXT);
            break;
        case 'edit':
            html_edit();
            break;
        case 'draft':
            html_draft();
            break;
        case 'wordblock':
            html_edit($TEXT, 'wordblock');
            break;
        case 'search':
            html_search();
            break;
        case 'revisions':
            $first = is_numeric($_REQUEST['first']) ? intval($_REQUEST['first']) : 0;
            html_revisions($first);
            break;
        case 'diff':
            html_diff();
            break;
        case 'recent':
            if (is_array($_REQUEST['first'])) {
                $_REQUEST['first'] = array_keys($_REQUEST['first']);
                $_REQUEST['first'] = $_REQUEST['first'][0];
            }
            $first = is_numeric($_REQUEST['first']) ? intval($_REQUEST['first']) : 0;
            html_recent($first);
            break;
        case 'index':
            html_index($IDX);
            #FIXME can this be pulled from globals? is it sanitized correctly?
            break;
        case 'backlink':
            html_backlinks();
            break;
        case 'conflict':
            html_conflict(con($PRE, $TEXT, $SUF), $SUM);
            html_diff(con($PRE, $TEXT, $SUF), false);
            break;
        case 'locked':
            html_locked();
            html_edit();
            break;
        case 'login':
            html_login();
            break;
        case 'register':
            html_register();
            break;
        case 'resendpwd':
            html_resendpwd();
            break;
        case 'denied':
            print p_locale_xhtml('denied');
            break;
        case 'profile':
            html_updateprofile();
            break;
        case 'admin':
            tpl_admin();
            break;
        default:
            $evt = new Doku_Event('TPL_ACT_UNKNOWN', $ACT);
            if ($evt->advise_before()) {
                msg("Failed to handle command: " . hsc($ACT), -1);
            }
            $evt->advise_after();
            unset($evt);
            return false;
    }
    return true;
}
开发者ID:jalemanyf,项目名称:wsnlocalizationscala,代码行数:90,代码来源:template.php

示例7: handle

    public function handle() {
    	global $conf, $ID;

        //$this->_debug_print_r($data);        
        //$this->_debug_print_r($_REQUEST);
        
        
        //If delete requested
        if(isset($_REQUEST['media_id_to_delete'])){

        	if(checkSecurityToken($_REQUEST['sectok'])){
        	
	        	$mediaToDelete = $_REQUEST['media_id_to_delete'];   
				
	        	$file = mediaFN($mediaToDelete);
	        	
	        	if(file_exists($file)){
	        		if(media_inuse($mediaToDelete)===false){
	
					    // trigger an event - MEDIA_DELETE_FILE
					    $data['id']   = $mediaToDelete;
					    $data['name'] = basename($file);
					    $data['path'] = $file;
					    $data['size'] = (@file_exists($file)) ? filesize($file) : 0;
					
					    $data['unl'] = false;
					    $data['del'] = false;
					    $evt = new Doku_Event('MEDIA_DELETE_FILE',$data);
					    if ($evt->advise_before()) {
					        $data['unl'] = @unlink($file);
					        if($data['unl']){
					            addMediaLogEntry(time(), $mediaToDelete, DOKU_CHANGE_TYPE_DELETE);
					            $data['del'] = io_sweepNS($mediaToDelete,'mediadir');
					        }
					    }
					    $evt->advise_after();
					    unset($evt);
	        			
						$this->ok = sprintf($this->getLang('delete_file_ok'),$mediaToDelete);
						;
	        		}else{
	        			$this->error = sprintf($this->getLang('delete_file_in_use'),$mediaToDelete);
	        		}        		
	        		
	        	}else{
	        		$this->error = sprintf($this->getLang('delete_file_not_found'),$mediaToDelete);
	        	}
        	
        	}//end of csrf check
        }
        
        
        //Searching for orphaned medias
        
        $data = array();
        
        //getting all medias
        search($data,$conf['mediadir'],'search_media', array('showmsg'=>true,'depth'=>500),str_replace(':', '/', getNS($ID)));
        

        
        
        //check if they are (still) in use or not.
        foreach($data as $media){
        	$isUsed = media_inuse($media['id']);

        	if($isUsed === false){
        		$this->orphans_medias[$media['id']] = $media;
        	}
        }
        

    }
开发者ID:Jguilbaud,项目名称:dokuwikipluginUnusedMedias,代码行数:73,代码来源:list.php

示例8: ping

 function ping($sourceUri, $targetUri)
 {
     // Plugin not enabled? Quit
     if (plugin_isdisabled('linkback')) {
         return new IXR_Error(PINGBACK_ERROR_TARGETURI_CANNOT_BE_USED, '');
     }
     // pingback disabled? Quit
     if (!$this->tools->getConf('enable_pingback')) {
         return new IXR_Error(PINGBACK_ERROR_TARGETURI_CANNOT_BE_USED, '');
     }
     // Given URLs are no urls? Quit
     if (!preg_match("#^([a-z0-9\\-\\.+]+?)://.*#i", $sourceUri)) {
         return new IXR_Error(PINGBACK_ERROR_GENERIC, '');
     }
     if (!preg_match("#^([a-z0-9\\-\\.+]+?)://.*#i", $targetUri)) {
         return new IXR_Error(PINGBACK_ERROR_GENERIC, '');
     }
     // Source URL does not exist? Quit
     $page = $this->tools->getPage($sourceUri);
     if (!$page['success'] && ($page['status'] < 200 || $page['status'] >= 300)) {
         return new IXR_Error(PINGBACK_ERROR_SOURCEURI_DOES_NOT_EXIST, '');
     }
     // Target URL does not match with request? Quit
     $ID = substr($_SERVER['PATH_INFO'], 1);
     if ($targetUri != wl($ID, '', true)) {
         return new IXR_Error(PINGBACK_ERROR_GENERIC, '');
     }
     $file = metaFN($ID, '.linkbacks');
     $data = array('send' => false, 'receive' => false, 'display' => false, 'sentpings' => array(), 'receivedpings' => array(), 'number' => 0);
     if (@file_exists($file)) {
         $data = unserialize(io_readFile($file, false));
     }
     // Target URL is not pingback enabled? Quit
     if (!$data['receive']) {
         return new IXR_Error(PINGBACK_ERROR_TARGETURI_CANNOT_BE_USED, '');
     }
     // Pingback already done? Quit
     if ($data['receivedpings'][md5($sourceUri)]) {
         return new IXR_Error(PINGBACK_ERROR_PINGBACK_ALREADY_MADE, '');
     }
     // Retrieve data from source
     $linkback = $this->_getTrackbackData($sourceUri, $targetUri, $page);
     // Source URL does not contain link to target? Quit
     if (!$linkback) {
         return new IXR_Error(PINGBACK_ERROR_SOURCEURI_DOES_NOT_CONTAIN_LINK, '');
     }
     // Prepare event for Antispam plugins
     $evt_data = array('linkback' => $linkback, 'page' => $page, 'target' => $targetUri, 'show' => true, 'log' => array(date('Y/m/d H:i', time()) . ': Received pingback from ' . $linkback['url'] . ' (' . $linkback['lid'] . ')'));
     $event = new Doku_Event('ACTION_LINKBACK_RECEIVED', $evt_data);
     if ($event->advise_before()) {
         $linkback['show'] = $evt_data['show'];
         if ($this->tools->getConf('usefavicon')) {
             $linkback['favicon'] = $this->tools->getFavicon($linkback['url'], $page['body']);
         }
         // add pingback
         $data['receivedpings'][$linkback['lid']] = $linkback;
         if ($linkback['show']) {
             $data['number']++;
         }
         io_saveFile($file, serialize($data));
         $this->tools->addLogEntry($linkback['received'], $ID, 'cl', '', $linkback['lid']);
         $this->tools->notify($ID, $linkback);
         if ($this->tools->getConf('log_processing')) {
             $this->tools->addProcessLogEntry($evt_data['log']);
         }
         $event->advise_after();
     } else {
         // Pingback was denied
         if ($this->tools->getConf('log_processing')) {
             $this->tools->addProcessLogEntry($evt_data['log']);
         }
         $event->advise_after();
         return new IXR_Error(PINGBACK_ERROR_ACCESS_DENIED, $helper->getLang('error_noreason'));
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:75,代码来源:pingback.php

示例9: rss_buildItems


//.........这里部分代码省略.........
                $item->title .= ' - ' . strip_tags($ditem['sum']);
            }
            // add item link
            switch ($opt['link_to']) {
                case 'page':
                    $item->link = wl($id, 'rev=' . $date, true, '&');
                    break;
                case 'rev':
                    $item->link = wl($id, 'do=revisions&rev=' . $date, true, '&');
                    break;
                case 'current':
                    $item->link = wl($id, '', true, '&');
                    break;
                case 'diff':
                default:
                    $item->link = wl($id, 'rev=' . $date . '&do=diff', true, '&');
            }
            // add item content
            switch ($opt['item_content']) {
                case 'diff':
                case 'htmldiff':
                    require_once DOKU_INC . 'inc/DifferenceEngine.php';
                    $revs = getRevisions($id, 0, 1);
                    $rev = $revs[0];
                    if ($rev) {
                        $df = new Diff(explode("\n", htmlspecialchars(rawWiki($id, $rev))), explode("\n", htmlspecialchars(rawWiki($id, ''))));
                    } else {
                        $df = new Diff(array(''), explode("\n", htmlspecialchars(rawWiki($id, ''))));
                    }
                    if ($opt['item_content'] == 'htmldiff') {
                        $tdf = new TableDiffFormatter();
                        $content = '<table>';
                        $content .= '<tr><th colspan="2" width="50%">' . $rev . '</th>';
                        $content .= '<th colspan="2" width="50%">' . $lang['current'] . '</th></tr>';
                        $content .= $tdf->format($df);
                        $content .= '</table>';
                    } else {
                        $udf = new UnifiedDiffFormatter();
                        $content = "<pre>\n" . $udf->format($df) . "\n</pre>";
                    }
                    break;
                case 'html':
                    $content = p_wiki_xhtml($id, $date, false);
                    // no TOC in feeds
                    $content = preg_replace('/(<!-- TOC START -->).*(<!-- TOC END -->)/s', '', $content);
                    // make URLs work when canonical is not set, regexp instead of rerendering!
                    if (!$conf['canonical']) {
                        $base = preg_quote(DOKU_REL, '/');
                        $content = preg_replace('/(<a href|<img src)="(' . $base . ')/s', '$1="' . DOKU_URL, $content);
                    }
                    break;
                case 'abstract':
                default:
                    $content = $meta['description']['abstract'];
            }
            $item->description = $content;
            //FIXME a plugin hook here could be senseful
            // add user
            # FIXME should the user be pulled from metadata as well?
            $user = null;
            $user = @$ditem['user'];
            // the @ spares time repeating lookup
            $item->author = '';
            if ($user && $conf['useacl'] && $auth) {
                $userInfo = $auth->getUserData($user);
                $item->author = $userInfo['name'];
                if ($userInfo && !$opt['guardmail']) {
                    $item->authorEmail = $userInfo['mail'];
                } else {
                    //cannot obfuscate because some RSS readers may check validity
                    $item->authorEmail = $user . '@' . $ditem['ip'];
                }
            } elseif ($user) {
                // this happens when no ACL but some Apache auth is used
                $item->author = $user;
                $item->authorEmail = $user . '@' . $ditem['ip'];
            } else {
                $item->authorEmail = 'anonymous@' . $ditem['ip'];
            }
            // add category
            if ($meta['subject']) {
                $item->category = $meta['subject'];
            } else {
                $cat = getNS($id);
                if ($cat) {
                    $item->category = $cat;
                }
            }
            // finally add the item to the feed object, after handing it to registered plugins
            $evdata = array('item' => &$item, 'opt' => &$opt, 'ditem' => &$ditem, 'rss' => &$rss);
            $evt = new Doku_Event('FEED_ITEM_ADD', $evdata);
            if ($evt->advise_before()) {
                $rss->addItem($item);
            }
            $evt->advise_after();
            // for completeness
        }
    }
    $event->advise_after();
}
开发者ID:Harvie,项目名称:dokuwiki,代码行数:101,代码来源:feed.php

示例10: tpl_mediaContent

/**
 * prints the "main content" in the mediamanger popup
 *
 * Depending on the user's actions this may be a list of
 * files in a namespace, the meta editing dialog or
 * a message of referencing pages
 *
 * Only allowed in mediamanager.php
 *
 * @triggers MEDIAMANAGER_CONTENT_OUTPUT
 * @param bool $fromajax - set true when calling this function via ajax
 * @author Andreas Gohr <andi@splitbrain.org>
 */
function tpl_mediaContent($fromajax = false)
{
    global $IMG;
    global $AUTH;
    global $INUSE;
    global $NS;
    global $JUMPTO;
    global $INPUT;
    $do = $INPUT->extract('do')->str('do');
    if (in_array($do, array('save', 'cancel'))) {
        $do = '';
    }
    if (!$do) {
        if ($INPUT->bool('edit')) {
            $do = 'metaform';
        } elseif (is_array($INUSE)) {
            $do = 'filesinuse';
        } else {
            $do = 'filelist';
        }
    }
    // output the content pane, wrapped in an event.
    if (!$fromajax) {
        ptln('<div id="media__content">');
    }
    $data = array('do' => $do);
    $evt = new Doku_Event('MEDIAMANAGER_CONTENT_OUTPUT', $data);
    if ($evt->advise_before()) {
        $do = $data['do'];
        if ($do == 'filesinuse') {
            media_filesinuse($INUSE, $IMG);
        } elseif ($do == 'filelist') {
            media_filelist($NS, $AUTH, $JUMPTO);
        } elseif ($do == 'searchlist') {
            media_searchlist($INPUT->str('q'), $NS, $AUTH);
        } else {
            msg('Unknown action ' . hsc($do), -1);
        }
    }
    $evt->advise_after();
    unset($evt);
    if (!$fromajax) {
        ptln('</div>');
    }
}
开发者ID:neosunchess,项目名称:dokuwiki,代码行数:58,代码来源:template.php

示例11: p_render_metadata

/**
 * renders the metadata of a page
 *
 * @author Esther Brunner <esther@kaffeehaus.ch>
 */
function p_render_metadata($id, $orig)
{
    // make sure the correct ID is in global ID
    global $ID, $METADATA_RENDERERS;
    // avoid recursive rendering processes for the same id
    if (isset($METADATA_RENDERERS[$id])) {
        return $orig;
    }
    // store the original metadata in the global $METADATA_RENDERERS so p_set_metadata can use it
    $METADATA_RENDERERS[$id] =& $orig;
    $keep = $ID;
    $ID = $id;
    // add an extra key for the event - to tell event handlers the page whose metadata this is
    $orig['page'] = $id;
    $evt = new Doku_Event('PARSER_METADATA_RENDER', $orig);
    if ($evt->advise_before()) {
        require_once DOKU_INC . "inc/parser/metadata.php";
        // get instructions
        $instructions = p_cached_instructions(wikiFN($id), false, $id);
        if (is_null($instructions)) {
            $ID = $keep;
            unset($METADATA_RENDERERS[$id]);
            return null;
            // something went wrong with the instructions
        }
        // set up the renderer
        $renderer = new Doku_Renderer_metadata();
        $renderer->meta =& $orig['current'];
        $renderer->persistent =& $orig['persistent'];
        // loop through the instructions
        foreach ($instructions as $instruction) {
            // execute the callback against the renderer
            call_user_func_array(array(&$renderer, $instruction[0]), (array) $instruction[1]);
        }
        $evt->result = array('current' => &$renderer->meta, 'persistent' => &$renderer->persistent);
    }
    $evt->advise_after();
    // clean up
    $ID = $keep;
    unset($METADATA_RENDERERS[$id]);
    return $evt->result;
}
开发者ID:nextghost,项目名称:dokuwiki,代码行数:47,代码来源:parserutils.php

示例12: triggerUserMod

 /**
  * Trigger the AUTH_USERDATA_CHANGE event and call the modification function. [ DO NOT OVERRIDE ]
  *
  * You should use this function instead of calling createUser, modifyUser or
  * deleteUsers directly. The event handlers can prevent the modification, for
  * example for enforcing a user name schema.
  *
  * @author Gabriel Birke <birke@d-scribe.de>
  * @param string $type Modification type ('create', 'modify', 'delete')
  * @param array $params Parameters for the createUser, modifyUser or deleteUsers method. The content of this array depends on the modification type
  * @return mixed Result from the modification function or false if an event handler has canceled the action
  */
 function triggerUserMod($type, $params)
 {
     $validTypes = array('create' => 'createUser', 'modify' => 'modifyUser', 'delete' => 'deleteUsers');
     if (empty($validTypes[$type])) {
         return false;
     }
     $eventdata = array('type' => $type, 'params' => $params, 'modification_result' => null);
     $evt = new Doku_Event('AUTH_USER_CHANGE', $eventdata);
     if ($evt->advise_before(true)) {
         $result = call_user_func_array(array($this, $validTypes[$type]), $params);
         $evt->data['modification_result'] = $result;
     }
     $evt->advise_after();
     unset($evt);
     return $result;
 }
开发者ID:projectesIF,项目名称:Ateneu,代码行数:28,代码来源:basic.class.php

示例13: tokenizer

 /**
  * Split the text into words for fulltext search
  *
  * TODO: does this also need &$stopwords ?
  *
  * @triggers INDEXER_TEXT_PREPARE
  * This event allows plugins to modify the text before it gets tokenized.
  * Plugins intercepting this event should also intercept INDEX_VERSION_GET
  *
  * @param string    $text   plain text
  * @param boolean   $wc     are wildcards allowed?
  * @return array            list of words in the text
  * @author Tom N Harris <tnharris@whoopdedo.org>
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 public function tokenizer($text, $wc = false)
 {
     $wc = $wc ? '' : '\\*';
     $stopwords =& idx_get_stopwords();
     // prepare the text to be tokenized
     $evt = new Doku_Event('INDEXER_TEXT_PREPARE', $text);
     if ($evt->advise_before(true)) {
         if (preg_match('/[^0-9A-Za-z ]/u', $text)) {
             // handle asian chars as single words (may fail on older PHP version)
             $asia = @preg_replace('/(' . IDX_ASIAN . ')/u', ' \\1 ', $text);
             if (!is_null($asia)) {
                 $text = $asia;
             }
             // recover from regexp falure
         }
     }
     $evt->advise_after();
     unset($evt);
     $text = strtr($text, array("\r" => ' ', "\n" => ' ', "\t" => ' ', "­" => ''));
     if (preg_match('/[^0-9A-Za-z ]/u', $text)) {
         $text = utf8_stripspecials($text, ' ', '\\._\\-:' . $wc);
     }
     $wordlist = explode(' ', $text);
     foreach ($wordlist as $i => $word) {
         $wordlist[$i] = preg_match('/[^0-9A-Za-z]/u', $word) ? utf8_strtolower($word) : strtolower($word);
     }
     foreach ($wordlist as $i => $word) {
         if (!is_numeric($word) && strlen($word) < IDX_MINWORDLENGTH || array_search($word, $stopwords, true) !== false) {
             unset($wordlist[$i]);
         }
     }
     return array_values($wordlist);
 }
开发者ID:neutrinog,项目名称:Door43,代码行数:48,代码来源:indexer.php

示例14: sendGIF

$defer = !@ignore_user_abort() || $conf['broken_iua'];
if (!$defer) {
    sendGIF();
    // send gif
}
$ID = cleanID($_REQUEST['id']);
// Catch any possible output (e.g. errors)
if (!isset($_REQUEST['debug'])) {
    ob_start();
}
// run one of the jobs
$tmp = array();
// No event data
$evt = new Doku_Event('INDEXER_TASKS_RUN', $tmp);
if ($evt->advise_before()) {
    runIndexer() or metaUpdate() or runSitemapper() or runTrimRecentChanges() or runTrimRecentChanges(true) or $evt->advise_after();
}
if ($defer) {
    sendGIF();
}
if (!isset($_REQUEST['debug'])) {
    ob_end_clean();
}
exit;
// --------------------------------------------------------------------
/**
 * Trims the recent changes cache (or imports the old changelog) as needed.
 *
 * @param media_changes If the media changelog shall be trimmed instead of
 * the page changelog
 *
开发者ID:lorea,项目名称:Hydra-dev,代码行数:31,代码来源:indexer.php

示例15: act_dispatch


//.........这里部分代码省略.........
                $ACT = act_subscription($ACT);
            } catch (Exception $e) {
                msg($e->getMessage(), -1);
            }
        }
        //check permissions
        $ACT = act_permcheck($ACT);
        //register
        $nil = array();
        if ($ACT == 'register' && $_POST['save'] && register()) {
            $ACT = 'login';
        }
        if ($ACT == 'resendpwd' && act_resendpwd()) {
            $ACT = 'login';
        }
        //update user profile
        if ($ACT == 'profile') {
            if (!$_SERVER['REMOTE_USER']) {
                $ACT = 'login';
            } else {
                if (updateprofile()) {
                    msg($lang['profchanged'], 1);
                    $ACT = 'show';
                }
            }
        }
        //revert
        if ($ACT == 'revert') {
            if (checkSecurityToken()) {
                $ACT = act_revert($ACT);
            } else {
                $ACT = 'show';
            }
        }
        //save
        if ($ACT == 'save') {
            if (checkSecurityToken()) {
                $ACT = act_save($ACT);
            } else {
                $ACT = 'show';
            }
        }
        //cancel conflicting edit
        if ($ACT == 'cancel') {
            $ACT = 'show';
        }
        //draft deletion
        if ($ACT == 'draftdel') {
            $ACT = act_draftdel($ACT);
        }
        //draft saving on preview
        if ($ACT == 'preview') {
            $ACT = act_draftsave($ACT);
        }
        //edit
        if (($ACT == 'edit' || $ACT == 'preview') && $INFO['editable']) {
            $ACT = act_edit($ACT);
        } else {
            unlock($ID);
            //try to unlock
        }
        //handle export
        if (substr($ACT, 0, 7) == 'export_') {
            $ACT = act_export($ACT);
        }
        //display some infos
        if ($ACT == 'check') {
            check();
            $ACT = 'show';
        }
        //handle admin tasks
        if ($ACT == 'admin') {
            // retrieve admin plugin name from $_REQUEST['page']
            if (!empty($_REQUEST['page'])) {
                $pluginlist = plugin_list('admin');
                if (in_array($_REQUEST['page'], $pluginlist)) {
                    // attempt to load the plugin
                    if (($plugin =& plugin_load('admin', $_REQUEST['page'])) !== null) {
                        $plugin->handle();
                    }
                }
            }
        }
        // check permissions again - the action may have changed
        $ACT = act_permcheck($ACT);
    }
    // end event ACTION_ACT_PREPROCESS default action
    $evt->advise_after();
    unset($evt);
    // when action 'show', the intial not 'show' and POST, do a redirect
    if ($ACT == 'show' && $preact != 'show' && strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
        act_redirect($ID, $preact);
    }
    //call template FIXME: all needed vars available?
    $headers[] = 'Content-Type: text/html; charset=utf-8';
    trigger_event('ACTION_HEADERS_SEND', $headers, 'act_sendheaders');
    include template('main.php');
    // output for the commands is now handled in inc/templates.php
    // in function tpl_content()
}
开发者ID:JeromeS,项目名称:dokuwiki,代码行数:101,代码来源:actions.php


注:本文中的Doku_Event::advise_after方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。