コード例 #1
0
 private function getShortcode()
 {
     $shortcode = new Shortcode();
     $shortcode->register('name', function (ShortcodeInterface $s) {
         return $s->getName();
     });
     $shortcode->register('content', function (ShortcodeInterface $s) {
         return $s->getContent();
     });
     $shortcode->register('nc', function (ShortcodeInterface $s) {
         return $s->getName() . ': ' . $s->getContent();
     });
     return $shortcode;
 }
コード例 #2
0
 function testRegisterShortcodeUsingClasses()
 {
     $shortcode = new Shortcode();
     $shortcode->register('div', 'HTMLShortcode@div');
     $shortcode->register('img', 'HTMLShortcode@img');
     $exceptedDiv = '<div>Hello</div>';
     $exceptedImg = '<img src="#">';
     $this->assertEquals($exceptedDiv, $shortcode->compile('[div]Hello[/div]'));
     $this->assertEquals($exceptedImg, $shortcode->compile('[img src="#"]'));
 }
コード例 #3
0
ファイル: _ide_helper.php プロジェクト: stcoder/uf-vova
 /**
  * Render the current calld shortcode.
  *
  * @param array $matches
  * @return void 
  * @static 
  */
 public static function render($matches)
 {
     \Pingpong\Shortcode\Shortcode::render($matches);
 }