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


PHP Texy::prependRoot方法代码示例

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


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

示例1: imageHandler

/**
 * User handler for images
 *
 * @param TexyHandlerInvocation  handler invocation
 * @param TexyImage
 * @param TexyLink
 * @return TexyHtml|string|FALSE
 */
function imageHandler($invocation, $image, $link)
{
    $texy = $invocation->getTexy();
    if (substr($image->URL, -4) === '.swf') {
        $movie = Texy::prependRoot($image->URL, $texy->imageModule->root);
        $dimensions = ($image->width ? 'width="' . $image->width . '" ' : '') . ($image->height ? 'width="' . $image->height . '" ' : '');
        $movie = htmlSpecialChars($movie);
        $altContent = htmlSpecialChars($image->modifier->title);
        // @see http://phpfashion.com/how-to-correctly-insert-a-flash-into-xhtml
        $code = '
<!--[if !IE]> -->
<object type="application/x-shockwave-flash" data="' . $movie . '" ' . $dimensions . '>
<!-- <![endif]-->

<!--[if IE]>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' . $dimensions . '
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0">
<param name="movie" value="' . $movie . '" />
<!--><!--dgx-->

	<p>' . $altContent . '</p>
</object>
<!-- <![endif]-->
';
        return $texy->protect($code, Texy::CONTENT_BLOCK);
    }
    return $invocation->proceed();
}
开发者ID:ppwalks33,项目名称:cleansure,代码行数:36,代码来源:demo.php

示例2: solve

 /**
  * Finish invocation.
  *
  * @param  TexyHandlerInvocation  handler invocation
  * @param  string
  * @param  string
  * @return TexyHtml|FALSE
  */
 public function solve($invocation, $emoticon, $raw)
 {
     $tx = $this->texy;
     $file = $this->icons[$emoticon];
     $el = TexyHtml::el('img');
     $el->attrs['src'] = Texy::prependRoot($file, $this->root === NULL ? $tx->imageModule->root : $this->root);
     $el->attrs['alt'] = $raw;
     $el->attrs['class'][] = $this->class;
     // file path
     $file = rtrim($this->fileRoot === NULL ? $tx->imageModule->fileRoot : $this->fileRoot, '/\\') . '/' . $file;
     if (@is_file($file)) {
         // intentionally @
         $size = @getImageSize($file);
         // intentionally @
         if (is_array($size)) {
             $el->attrs['width'] = $size[0];
             $el->attrs['height'] = $size[1];
         }
     }
     $tx->summary['images'][] = $el->attrs['src'];
     return $el;
 }
开发者ID:anagio,项目名称:woocommerce,代码行数:30,代码来源:TexyEmoticonModule.php

示例3: solve

 /**
  * Finish invocation.
  *
  * @param  TexyHandlerInvocation  handler invocation
  * @param  TexyLink
  * @param  TexyHtml|string
  * @return TexyHtml|string
  */
 public function solve($invocation, $link, $content = NULL)
 {
     if ($link->URL == NULL) {
         return $content;
     }
     $tx = $this->texy;
     $el = TexyHtml::el('a');
     if (empty($link->modifier)) {
         $nofollow = $popup = FALSE;
     } else {
         $nofollow = isset($link->modifier->classes['nofollow']);
         $popup = isset($link->modifier->classes['popup']);
         unset($link->modifier->classes['nofollow'], $link->modifier->classes['popup']);
         $el->attrs['href'] = NULL;
         // trick - move to front
         $link->modifier->decorate($tx, $el);
     }
     if ($link->type === TexyLink::IMAGE) {
         // image
         $el->attrs['href'] = Texy::prependRoot($link->URL, $tx->imageModule->linkedRoot);
         if ($this->imageClass) {
             $el->attrs['class'][] = $this->imageClass;
         } else {
             $el->attrs['onclick'] = $this->imageOnClick;
         }
     } else {
         $el->attrs['href'] = Texy::prependRoot($link->URL, $this->root);
         // rel="nofollow"
         if ($nofollow || $this->forceNoFollow && strpos($el->attrs['href'], '//') !== FALSE) {
             $el->attrs['rel'] = 'nofollow';
         }
     }
     // popup on click
     if ($popup) {
         $el->attrs['onclick'] = $this->popupOnClick;
     }
     if ($content !== NULL) {
         $el->add($content);
     }
     $tx->summary['links'][] = $el->attrs['href'];
     return $el;
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:50,代码来源:TexyLinkModule.php

示例4: solve

 /**
  * Finish invocation.
  *
  * @param  TexyHandlerInvocation  handler invocation
  * @param  TexyImage
  * @param  TexyLink
  * @return TexyHtml|FALSE
  */
 public function solve($invocation, TexyImage $image, $link)
 {
     if ($image->URL == NULL) {
         return FALSE;
     }
     $tx = $this->texy;
     $mod = $image->modifier;
     $alt = $mod->title;
     $mod->title = NULL;
     $hAlign = $mod->hAlign;
     $mod->hAlign = NULL;
     $el = TexyHtml::el('img');
     $el->attrs['src'] = NULL;
     // trick - move to front
     $mod->decorate($tx, $el);
     $el->attrs['src'] = Texy::prependRoot($image->URL, $this->root);
     if (!isset($el->attrs['alt'])) {
         if ($alt !== NULL) {
             $el->attrs['alt'] = $tx->typographyModule->postLine($alt);
         } else {
             $el->attrs['alt'] = $this->defaultAlt;
         }
     }
     if ($hAlign) {
         $var = $hAlign . 'Class';
         // leftClass, rightClass
         if (!empty($this->{$var})) {
             $el->attrs['class'][] = $this->{$var};
         } elseif (empty($tx->alignClasses[$hAlign])) {
             $el->attrs['style']['float'] = $hAlign;
         } else {
             $el->attrs['class'][] = $tx->alignClasses[$hAlign];
         }
     }
     if (!is_int($image->width) || !is_int($image->height) || $image->asMax) {
         // autodetect fileRoot
         if ($this->fileRoot === NULL && isset($_SERVER['SCRIPT_FILENAME'])) {
             $this->fileRoot = dirname($_SERVER['SCRIPT_FILENAME']) . '/' . $this->root;
         }
         // detect dimensions
         // absolute URL & security check for double dot
         if (Texy::isRelative($image->URL) && strpos($image->URL, '..') === FALSE) {
             $file = rtrim($this->fileRoot, '/\\') . '/' . $image->URL;
             if (@is_file($file)) {
                 $size = getImageSize($file);
                 if (is_array($size)) {
                     if ($image->asMax) {
                         $ratio = 1;
                         if (is_int($image->width)) {
                             $ratio = min($ratio, $image->width / $size[0]);
                         }
                         if (is_int($image->height)) {
                             $ratio = min($ratio, $image->height / $size[1]);
                         }
                         $image->width = round($ratio * $size[0]);
                         $image->height = round($ratio * $size[1]);
                     } elseif (is_int($image->width)) {
                         $ratio = round($size[1] / $size[0] * $image->width);
                         $image->height = round($size[1] / $size[0] * $image->width);
                     } elseif (is_int($image->height)) {
                         $image->width = round($size[0] / $size[1] * $image->height);
                     } else {
                         $image->width = $size[0];
                         $image->height = $size[1];
                     }
                 }
             }
         }
     }
     $el->attrs['width'] = $image->width;
     $el->attrs['height'] = $image->height;
     // onmouseover actions generate
     if ($image->overURL !== NULL) {
         $overSrc = Texy::prependRoot($image->overURL, $this->root);
         $el->attrs['onmouseover'] = 'this.src=\'' . addSlashes($overSrc) . '\'';
         $el->attrs['onmouseout'] = 'this.src=\'' . addSlashes($el->attrs['src']) . '\'';
         $el->attrs['onload'] = str_replace('%i', addSlashes($overSrc), $this->onLoad);
         $tx->summary['preload'][] = $overSrc;
     }
     $tx->summary['images'][] = $el->attrs['src'];
     if ($link) {
         return $tx->linkModule->solve(NULL, $link, $el);
     }
     return $el;
 }
开发者ID:uuking,项目名称:wildflower,代码行数:93,代码来源:TexyImageModule.php

示例5: flashHandler

 /**
  * Flash handler for images
  *
  * @example [* flash.swf 200x150 .(alternative content) *]
  *
  * @param TexyHandlerInvocation  handler invocation
  * @param TexyImage
  * @param TexyLink
  * @return TexyHtml|string|FALSE
  */
 public function flashHandler($invocation, $image, $link)
 {
     if (!Strings::endsWith($image->URL, ".swf")) {
         return $invocation->proceed();
     }
     $template = $this->createTemplate()->setFile(APP_DIR . "/templates/inc/@flash.latte");
     $template->url = Texy::prependRoot($image->URL, $this->imageModule->root);
     $template->width = $image->width;
     $template->height = $image->height;
     if ($image->modifier->title) {
         $template->title = $image->modifier->title;
     }
     return $this->protect((string) $template, Texy::CONTENT_BLOCK);
 }
开发者ID:darkmoon32,项目名称:Texyla,代码行数:24,代码来源:MyTexy.php

示例6: citeLink

 /**
  * Converts cite source to URL.
  *
  * @param  string
  *
  * @return string|NULL
  */
 public function citeLink($link)
 {
     $tx = $this->texy;
     if ($link == null) {
         return null;
     }
     if ($link[0] === '[') {
         // [ref]
         $link = substr($link, 1, -1);
         $ref = $tx->linkModule->getReference($link);
         if ($ref) {
             return Texy::prependRoot($ref->URL, $tx->linkModule->root);
         }
     }
     // special supported case
     if (strncasecmp($link, 'www.', 4) === 0) {
         return 'http://' . $link;
     }
     return Texy::prependRoot($link, $tx->linkModule->root);
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:27,代码来源:TexyBlockQuoteModule.php


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