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


PHP TimberURLHelper::get_rel_url方法代码示例

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


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

示例1: testGetRelURL

 function testGetRelURL()
 {
     $local = 'http://example.org/directory';
     $subdomain = 'http://cdn.example.org/directory';
     $external = 'http://upstatement.com';
     $rel_url = '/directory/';
     $this->assertEquals('/directory', TimberURLHelper::get_rel_url($local));
     $this->assertEquals($subdomain, TimberURLHelper::get_rel_url($subdomain));
     $this->assertEquals($external, TimberURLHelper::get_rel_url($external));
     $this->assertEquals($rel_url, TimberURLHelper::get_rel_url($rel_url));
 }
开发者ID:hamedb89,项目名称:wp-theme-boilerplate,代码行数:11,代码来源:test-timber-url-helper.php

示例2: get_path

 /**
  *
  *
  * @return string
  */
 function get_path()
 {
     return TimberURLHelper::get_rel_url($this->get_link());
 }
开发者ID:wpmu,项目名称:maera,代码行数:9,代码来源:timber-menu-item.php

示例3: add_timber_filters

 /**
  *
  *
  * @param Twig_Environment $twig
  * @return Twig_Environment
  */
 function add_timber_filters($twig)
 {
     /* image filters */
     $twig->addFilter(new Twig_SimpleFilter('resize', array('TimberImageHelper', 'resize')));
     $twig->addFilter(new Twig_SimpleFilter('retina', array('TimberImageHelper', 'retina_resize')));
     $twig->addFilter(new Twig_SimpleFilter('letterbox', array('TimberImageHelper', 'letterbox')));
     $twig->addFilter(new Twig_SimpleFilter('tojpg', array('TimberImageHelper', 'img_to_jpg')));
     /* debugging filters */
     $twig->addFilter(new Twig_SimpleFilter('docs', 'twig_object_docs'));
     $twig->addFilter(new Twig_SimpleFilter('get_class', 'get_class'));
     $twig->addFilter(new Twig_SimpleFilter('get_type', 'get_type'));
     $twig->addFilter(new Twig_SimpleFilter('print_r', function ($arr) {
         return print_r($arr, true);
     }));
     $twig->addFilter(new Twig_SimpleFilter('print_a', function ($arr) {
         return '<pre>' . self::object_docs($arr, true) . '</pre>';
     }));
     /* other filters */
     $twig->addFilter(new Twig_SimpleFilter('stripshortcodes', 'strip_shortcodes'));
     $twig->addFilter(new Twig_SimpleFilter('array', array($this, 'to_array')));
     $twig->addFilter(new Twig_SimpleFilter('excerpt', 'wp_trim_words'));
     $twig->addFilter(new Twig_SimpleFilter('function', array($this, 'exec_function')));
     $twig->addFilter(new Twig_SimpleFilter('pretags', array($this, 'twig_pretags')));
     $twig->addFilter(new Twig_SimpleFilter('sanitize', 'sanitize_title'));
     $twig->addFilter(new Twig_SimpleFilter('shortcodes', 'do_shortcode'));
     $twig->addFilter(new Twig_SimpleFilter('time_ago', array($this, 'time_ago')));
     $twig->addFilter(new Twig_SimpleFilter('wpautop', 'wpautop'));
     $twig->addFilter(new Twig_SimpleFilter('relative', function ($link) {
         return TimberURLHelper::get_rel_url($link, true);
     }));
     $twig->addFilter(new Twig_SimpleFilter('date', array($this, 'intl_date')));
     $twig->addFilter(new Twig_SimpleFilter('truncate', function ($text, $len) {
         return TimberHelper::trim_words($text, $len);
     }));
     /* actions and filters */
     $twig->addFunction(new Twig_SimpleFunction('action', function ($context) {
         $args = func_get_args();
         array_shift($args);
         $args[] = $context;
         call_user_func_array('do_action', $args);
     }, array('needs_context' => true)));
     $twig->addFilter(new Twig_SimpleFilter('apply_filters', function () {
         $args = func_get_args();
         $tag = current(array_splice($args, 1, 1));
         return apply_filters_ref_array($tag, $args);
     }));
     $twig->addFunction(new Twig_SimpleFunction('function', array(&$this, 'exec_function')));
     $twig->addFunction(new Twig_SimpleFunction('fn', array(&$this, 'exec_function')));
     $twig->addFunction(new Twig_SimpleFunction('shortcode', 'do_shortcode'));
     /* TimberObjects */
     $twig->addFunction(new Twig_SimpleFunction('TimberPost', function ($pid, $PostClass = 'TimberPost') {
         if (is_array($pid) && !TimberHelper::is_array_assoc($pid)) {
             foreach ($pid as &$p) {
                 $p = new $PostClass($p);
             }
             return $pid;
         }
         return new $PostClass($pid);
     }));
     $twig->addFunction(new Twig_SimpleFunction('TimberImage', function ($pid, $ImageClass = 'TimberImage') {
         if (is_array($pid) && !TimberHelper::is_array_assoc($pid)) {
             foreach ($pid as &$p) {
                 $p = new $ImageClass($p);
             }
             return $pid;
         }
         return new $ImageClass($pid);
     }));
     $twig->addFunction(new Twig_SimpleFunction('TimberTerm', function ($pid, $TermClass = 'TimberTerm') {
         if (is_array($pid) && !TimberHelper::is_array_assoc($pid)) {
             foreach ($pid as &$p) {
                 $p = new $TermClass($p);
             }
             return $pid;
         }
         return new $TermClass($pid);
     }));
     $twig->addFunction(new Twig_SimpleFunction('TimberUser', function ($pid, $UserClass = 'TimberUser') {
         if (is_array($pid) && !TimberHelper::is_array_assoc($pid)) {
             foreach ($pid as &$p) {
                 $p = new $UserClass($p);
             }
             return $pid;
         }
         return new $UserClass($pid);
     }));
     /* TimberObjects Alias */
     $twig->addFunction(new Twig_SimpleFunction('Post', function ($pid, $PostClass = 'TimberPost') {
         if (is_array($pid) && !TimberHelper::is_array_assoc($pid)) {
             foreach ($pid as &$p) {
                 $p = new $PostClass($p);
             }
             return $pid;
         }
//.........这里部分代码省略.........
开发者ID:adrianjonmiller,项目名称:hearts-being-healed,代码行数:101,代码来源:timber-twig.php

示例4: init_with_url

 /**
  * @param string $url
  */
 private function init_with_url($url)
 {
     $this->abs_url = $url;
     if (TimberURLHelper::is_local($url)) {
         $this->file = ABSPATH . TimberURLHelper::get_rel_url($url);
         $this->file_loc = ABSPATH . TimberURLHelper::get_rel_url($url);
     }
 }
开发者ID:pensesmart,项目名称:timber,代码行数:11,代码来源:timber-image.php

示例5: get_rel_url

 /**
  * @deprecated
  */
 static function get_rel_url($url, $force = false)
 {
     return TimberURLHelper::get_rel_url($url, $force);
 }
开发者ID:aauroux,项目名称:timber,代码行数:7,代码来源:timber-helper.php

示例6: get_path

 /**
  * @return string
  */
 public function get_path()
 {
     $link = $this->get_link();
     $rel = TimberURLHelper::get_rel_url($link, true);
     return apply_filters('timber_term_path', $rel, $this);
 }
开发者ID:wpmu,项目名称:maera,代码行数:9,代码来源:timber-term.php

示例7: path

 /**
  * @api
  * @return  string the relative path to the theme (ex: `/wp-content/themes/my-timber-theme`)
  */
 public function path()
 {
     return TimberURLHelper::get_rel_url($this->link());
 }
开发者ID:Butterwell,项目名称:timber,代码行数:8,代码来源:timber-theme.php

示例8: get_path

 /**
  *
  *
  * @return string
  */
 function get_path()
 {
     return TimberURLHelper::remove_trailing_slash(TimberURLHelper::get_rel_url($this->get_link()));
 }
开发者ID:aauroux,项目名称:timber,代码行数:9,代码来源:timber-menu-item.php


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