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


PHP p_get_instructions函数代码示例

本文整理汇总了PHP中p_get_instructions函数的典型用法代码示例。如果您正苦于以下问题:PHP p_get_instructions函数的具体用法?PHP p_get_instructions怎么用?PHP p_get_instructions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_localparse

 public function test_localparse()
 {
     $source = '{{just:some.svg?400x500 |test}}';
     $parser_response = p_get_instructions($source);
     $calls = array(array('document_start', array()), array('p_open', array()), array('plugin', array('svgpureinsert', array('id' => 'just:some.svg', 'title' => 'test', 'align' => 'left', 'width' => 400, 'height' => 500, 'cache' => 'cache'), 5, $source)), array('cdata', array(null)), array('p_close', array()), array('document_end', array()));
     $this->assertEquals($calls, array_map('stripbyteindex', $parser_response));
 }
开发者ID:xudianyang,项目名称:wiki.phpboy.net,代码行数:7,代码来源:syntax.test.php

示例2: testVideoOGVInternal

 function testVideoOGVInternal()
 {
     $file = 'wiki:kind_zu_katze.ogv';
     $parser_response = p_get_instructions('{{' . $file . '}}');
     $calls = array(array('document_start', array()), array('p_open', array()), array('internalmedia', array($file, null, null, null, null, 'cache', 'details')), array('cdata', array(null)), array('p_close', array()), array('document_end', array()));
     $this->assertEquals(array_map('stripbyteindex', $parser_response), $calls);
     $Renderer = new Doku_Renderer_xhtml();
     $url = $Renderer->externalmedia($file, null, null, null, null, 'cache', 'details', true);
     $video = '<video class="media" width="320" height="240" controls="controls" poster="' . DOKU_BASE . 'lib/exe/fetch.php?media=wiki:kind_zu_katze.png">';
     $substr_start = 0;
     $substr_len = strlen($video);
     $this->assertEquals($video, substr($url, $substr_start, $substr_len));
     // find $source_webm in $url
     $source_webm = '<source src="' . DOKU_BASE . 'lib/exe/fetch.php?media=wiki:kind_zu_katze.webm" type="video/webm" />';
     $substr_start = strpos($url, $source_webm, $substr_start + $substr_len);
     $this->assertNotSame(false, $substr_start, 'Substring not found.');
     // find $source_ogv in $url
     $source_ogv = '<source src="' . DOKU_BASE . 'lib/exe/fetch.php?media=wiki:kind_zu_katze.ogv" type="video/ogg" />';
     $substr_start = strpos($url, $source_ogv, $substr_start + strlen($source_webm));
     $this->assertNotSame(false, $substr_start, 'Substring not found.');
     // find $a_webm in $url
     $a_webm = '<a href="' . DOKU_BASE . 'lib/exe/fetch.php?id=&amp;cache=&amp;media=wiki:kind_zu_katze.webm" class="media mediafile mf_webm" title="wiki:kind_zu_katze.webm (99.1 KB)">kind_zu_katze.webm</a>';
     $substr_start = strpos($url, $a_webm, $substr_start + strlen($source_ogv));
     $this->assertNotSame(false, $substr_start, 'Substring not found.');
     // find $a_webm in $url
     $a_ogv = '<a href="' . DOKU_BASE . 'lib/exe/fetch.php?id=&amp;cache=&amp;media=wiki:kind_zu_katze.ogv" class="media mediafile mf_ogv" title="wiki:kind_zu_katze.ogv (44.8 KB)">kind_zu_katze.ogv</a>';
     $substr_start = strpos($url, $a_ogv, $substr_start + strlen($a_webm));
     $this->assertNotSame(false, $substr_start, 'Substring not found.');
     $rest = '</video>' . "\n";
     $substr_start = strlen($url) - strlen($rest);
     $this->assertEquals($rest, substr($url, $substr_start));
 }
开发者ID:richmahn,项目名称:Door43,代码行数:32,代码来源:parser_media.test.php

示例3: render

 function render($mode, Doku_Renderer $renderer, $data)
 {
     if (empty($data)) {
         return false;
     }
     if ($mode == 'xhtml') {
         /** @var Doku_Renderer_xhtml $renderer */
         list($state, $content, $classes, $attributes) = $data;
         switch ($state) {
             case DOKU_LEXER_ENTER:
                 $location = $attributes['location'] ? $attributes['location'] : 'top';
                 $title = $attributes['title'] ? $attributes['title'] : null;
                 $markup = sprintf('<span data-toggle="tooltip" data-html="true" data-placement="%s" title="%s" style="border-bottom:1px dotted">', $location, $title);
                 $renderer->doc .= $markup;
                 return true;
             case DOKU_LEXER_UNMATCHED:
                 $renderer->doc .= sprintf($this->template_content, str_replace(array('<p>', '</p>'), '', p_render("xhtml", p_get_instructions($content), $info)));
                 return true;
             case DOKU_LEXER_EXIT:
                 $renderer->doc .= '</span>';
                 return true;
         }
         return true;
     }
     return false;
 }
开发者ID:sawachan,项目名称:dokuwiki-plugin-bootswrapper,代码行数:26,代码来源:tooltip.php

示例4: getRenderedODTDocument

 /**
  * This function renders $content using the ODT-page-renderer.
  * It then unzips the ODT document and reads in the file contents
  * of the files 'content.xml', 'meta.xml' and 'styles.xml' and
  * saves the strings in $files ['content-xml'], $files ['meta-xml']
  * and $files ['styles-xml'].
  *
  * @param array       $files
  * @param string      $content
  * @return boolean
  */
 public static function getRenderedODTDocument(array &$files, $content)
 {
     // Create parser instructions for wiki page $content
     $instructions = p_get_instructions($content);
     // Render the page by looping through the instructions.
     $renderer = new renderer_plugin_odt_page();
     foreach ($instructions as $instruction) {
         // Execute the callback against the Renderer
         if (method_exists($renderer, $instruction[0])) {
             call_user_func_array(array(&$renderer, $instruction[0]), $instruction[1] ? $instruction[1] : array());
         }
     }
     io_savefile(TMP_DIR . '/odt/temp_test_doc.odt', $renderer->doc);
     $ZIP = new ZipLib();
     $ok = $ZIP->Extract(TMP_DIR . '/odt/temp_test_doc.odt', TMP_DIR . '/odt/unpacked');
     if ($ok == -1) {
         // Error unzipping document
         return false;
     }
     $files['content-xml'] = file_get_contents(TMP_DIR . '/odt/unpacked/content.xml');
     $files['meta-xml'] = file_get_contents(TMP_DIR . '/odt/unpacked/meta.xml');
     $files['styles-xml'] = file_get_contents(TMP_DIR . '/odt/unpacked/styles.xml');
     // Success
     return true;
 }
开发者ID:a-gundy,项目名称:dokuwiki-plugin-odt,代码行数:36,代码来源:ODTTestUtils.php

示例5: render

 /**
  * Create output
  */
 public function render($format, Doku_Renderer $renderer, $indata)
 {
     if (empty($indata)) {
         return false;
     }
     list($state, $data) = $indata;
     if ($format != 'xhtml') {
         return false;
     }
     switch ($state) {
         case DOKU_LEXER_ENTER:
             list($class, $title) = $data;
             if ($title) {
                 //$html = '<div class="plugin_codeprettify">'.hsc($title).'</div>';
                 $html = p_render($format, p_get_instructions($title), $info);
                 $html = '<div class="plugin_codeprettify">' . $html . '</div>';
                 $renderer->doc .= $html;
             }
             $class = implode(' ', $class);
             $renderer->doc .= '<pre class="' . $class . '">';
             break;
         case DOKU_LEXER_UNMATCHED:
             $renderer->doc .= $renderer->_xmlEntities($data);
             break;
         case DOKU_LEXER_EXIT:
             $renderer->doc .= '</pre>';
             break;
     }
     return true;
 }
开发者ID:EricFromCanada,项目名称:dw-plugin-codeprettify,代码行数:33,代码来源:code.php

示例6: render

 function render($mode, Doku_Renderer $renderer, $data)
 {
     if (empty($data)) {
         return false;
     }
     if ($mode == 'xhtml') {
         /** @var Doku_Renderer_xhtml $renderer */
         list($state, $content, $classes, $attributes) = $data;
         switch ($state) {
             case DOKU_LEXER_ENTER:
                 $type = $attributes['type'] ? $attributes['type'] : 'info';
                 $icon = $attributes['icon'] ? $attributes['icon'] : null;
                 $markup = sprintf('<div class="label label-%s">', $type);
                 if ($icon) {
                     $markup .= sprintf('<i class="%s"></i> ', $icon);
                 }
                 $renderer->doc .= $markup;
                 return true;
             case DOKU_LEXER_UNMATCHED:
                 $renderer->doc .= sprintf($this->template_content, str_replace(array('<p>', '</p>'), '', p_render("xhtml", p_get_instructions($content), $info)));
                 return true;
             case DOKU_LEXER_EXIT:
                 $renderer->doc .= '</div>';
                 return true;
         }
         return true;
     }
     return false;
 }
开发者ID:sawachan,项目名称:dokuwiki-plugin-bootswrapper,代码行数:29,代码来源:label.php

示例7: renderValue

 /**
  * @param int|string $value
  * @param \Doku_Renderer $R
  * @param string $mode
  * @return bool
  */
 public function renderValue($value, \Doku_Renderer $R, $mode)
 {
     $doc = p_render($mode, p_get_instructions($value), $info);
     $R->doc .= $doc;
     // FIXME this probably does not work for all renderers
     return true;
 }
开发者ID:cosmocode,项目名称:dokuwiki-plugin-struct,代码行数:13,代码来源:Wiki.php

示例8: handle

 /**
  * Handle matches of the articlelinks syntax
  *
  * @param string $match The match of the syntax
  * @param int    $state The state of the handler
  * @param int    $pos The position in the document
  * @param Doku_Handler    $handler The handler
  * @return array Data for the renderer
  */
 public function handle($match, $state, $pos, Doku_Handler $handler)
 {
     $data = array();
     $type = substr($match, 1, strpos($match, '>') - 1);
     switch ($type) {
         case 'relatedarticles':
             $links = $this->getLang('related articles');
             $endtag = '</article>';
             break;
         case 'relatedarticle':
             $links = $this->getLang('related article');
             $endtag = '</article>';
             break;
         case 'mainarticle':
             $links = $this->getLang('main article');
             $endtag = '</article>';
             break;
         case 'relatedsection':
             $links = $this->getLang('related section');
             $endtag = '</section>';
             break;
         default:
             $links = '';
     }
     $links .= substr($match, strpos($match, '>') + 1, strpos($match, $endtag) - strpos($match, '>') - 1);
     $data['links'] = p_get_instructions($links);
     return $data;
 }
开发者ID:cosmocode,项目名称:dokuwiki-plugin-articlelinks,代码行数:37,代码来源:syntax.php

示例9: render

 function render($mode, Doku_Renderer $renderer, $data)
 {
     if (empty($data)) {
         return false;
     }
     if ($mode == 'xhtml') {
         /** @var Doku_Renderer_xhtml $renderer */
         list($state, $content, $classes, $attributes) = $data;
         switch ($state) {
             case DOKU_LEXER_ENTER:
                 $type = $attributes['type'] ? $attributes['type'] : 'info';
                 $icon = $attributes['icon'] ? $attributes['icon'] : null;
                 $dismiss = $attributes['dismiss'] ? $attributes['dismiss'] : false;
                 $markup = sprintf('<div class="alert alert-%s %s" role="alert">', $type, $dismiss ? 'alert-dismissible' : '');
                 if ($dismiss) {
                     $markup .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>';
                 }
                 if ($icon) {
                     $markup .= sprintf('<i class="%s"></i> ', $icon);
                 }
                 $renderer->doc .= $markup;
                 return true;
             case DOKU_LEXER_UNMATCHED:
                 $renderer->doc .= sprintf($this->template_content, str_replace(array('<p>', '</p>'), '', p_render("xhtml", p_get_instructions($content), $info)));
                 return true;
             case DOKU_LEXER_EXIT:
                 $renderer->doc .= '</div>';
                 return true;
         }
         return true;
     }
     return false;
 }
开发者ID:sawachan,项目名称:dokuwiki-plugin-bootswrapper,代码行数:33,代码来源:alert.php

示例10: render

 function render($mode, Doku_Renderer $renderer, $data)
 {
     if (empty($data)) {
         return false;
     }
     if ($mode == 'xhtml') {
         /** @var Doku_Renderer_xhtml $renderer */
         list($state, $match, $attributes) = $data;
         switch ($state) {
             case DOKU_LEXER_ENTER:
                 $placement = $attributes['placement'];
                 $title = $attributes['title'];
                 $html = $attributes['html'];
                 if ($html) {
                     $title = hsc(p_render('xhtml', p_get_instructions($title), $info));
                 }
                 $markup = sprintf('<span class="bs-wrap bs-wrap-tooltip" data-toggle="tooltip" data-html="%s" data-placement="%s" title="%s" style="border-bottom:1px dotted">', $html, $placement, $title);
                 $renderer->doc .= $markup;
                 return true;
             case DOKU_LEXER_EXIT:
                 $renderer->doc .= '</span>';
                 return true;
         }
         return true;
     }
     return false;
 }
开发者ID:Juergen-aus-Koeln,项目名称:dokuwiki-plugin-bootswrapper,代码行数:27,代码来源:tooltip.php

示例11: parse

 function parse($string)
 {
     $info = array();
     $rendered = p_render('xhtml', p_get_instructions($string), $info);
     dbglog($string, 'alphalist helper::parse before');
     dbglog($rendered, 'alphalist helper::parse after');
     return $rendered;
 }
开发者ID:johanvanl,项目名称:dokuwiki-plugin-alphalist,代码行数:8,代码来源:helper.php

示例12: test_instructions

 public function test_instructions()
 {
     $instructions = p_get_instructions("~~REDIRECT>namespace:page~~");
     // this is '/tmp' somewhy when ran from IDEA
     $doku_root = '/.';
     $expected = array(0 => array(0 => 'document_start', 1 => array(), 2 => 0), 1 => array(0 => 'plugin', 1 => array(0 => 'pageredirect', 1 => array(0 => 'namespace:page', 1 => '<div class="noteredirect">This page has been moved, the new location is <a href="' . $doku_root . '/doku.php?id=namespace:page" class="wikilink2" title="namespace:page" rel="nofollow">page</a>.</div>'), 2 => 5, 3 => '~~REDIRECT>namespace:page~~'), 2 => 1), 2 => array(0 => 'document_end', 1 => array(), 2 => 1));
     $this->assertEquals($expected, $instructions);
 }
开发者ID:cinlloc,项目名称:dokuwiki-plugin-pageredirect,代码行数:8,代码来源:instructions.test.php

示例13: test_HTMLinclusion

 public function test_HTMLinclusion()
 {
     $input = file_get_contents(dirname(__FILE__) . '/input.txt');
     $xhtml = p_render('xhtml', p_get_instructions($input), $info);
     $doc = phpQuery::newDocument($xhtml);
     // HTML Check - there should be no bold tag anywhere
     $this->assertEquals(0, pq('bold', $doc)->length);
 }
开发者ID:elaratain,项目名称:dokuwiki-plugin-bureaucracy,代码行数:8,代码来源:syntax.test.php

示例14: render

 /**
  * render the given text with the inverse renderer
  *
  * @param $text
  * @return string
  */
 protected function render($text)
 {
     $instructions = p_get_instructions($text);
     $Renderer = new renderer_plugin_edittable_inverse();
     foreach ($instructions as $instruction) {
         // Execute the callback against the Renderer
         call_user_func_array(array(&$Renderer, $instruction[0]), $instruction[1]);
     }
     return $Renderer->doc;
 }
开发者ID:hefanbo,项目名称:edittable,代码行数:16,代码来源:renderer_plugin_edittable_inverse.test.php

示例15: main

 /**
  * Your main program
  *
  * Arguments and options have been parsed when this is run
  *
  * @param DokuCLI_Options $options
  * @throws DokuCLI_Exception
  * @return void
  */
 protected function main(DokuCLI_Options $options)
 {
     $renderer = $options->getOpt('renderer', 'xhtml');
     // do the action
     $source = stream_get_contents(STDIN);
     $info = array();
     $result = p_render($renderer, p_get_instructions($source), $info);
     if (is_null($result)) {
         throw new DokuCLI_Exception("No such renderer {$renderer}");
     }
     echo $result;
 }
开发者ID:jotttt,项目名称:ttu-wiki,代码行数:21,代码来源:render.php


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