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


PHP Filter::apply方法代码示例

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


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

示例1: __callStatic

 public static function __callStatic($id, $arguments = array())
 {
     $c = get_called_class();
     $d = Tree::$config;
     $dd = self::$config['classes'];
     if (!isset(self::$menus[$c][$id])) {
         return false;
     }
     $AD = array('ul', "", $id . ':');
     $arguments = Mecha::extend($AD, $arguments);
     $type = $arguments[0];
     $arguments[0] = Filter::apply('menu:input', self::$menus[$c][$id], $id);
     if (!is_array($arguments[0])) {
         return "";
     }
     Tree::$config['trunk'] = $type;
     Tree::$config['branch'] = $type;
     Tree::$config['twig'] = 'li';
     Tree::$config['classes']['trunk'] = $dd['parent'];
     Tree::$config['classes']['branch'] = $dd['child'];
     Tree::$config['classes']['twig'] = false;
     Tree::$config['classes']['current'] = $dd['current'];
     Tree::$config['classes']['chink'] = $dd['separator'];
     $output = call_user_func_array('Tree::grow', $arguments);
     Tree::$config = $d;
     // reset to the previous state
     return Filter::apply('menu:output', $output, $id);
 }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:28,代码来源:menu.php

示例2: cdbr_register_verify_field

/** save field in database, if field is valid */
function cdbr_register_verify_field()
{
    $reponse = array();
    $filter = new Filter();
    $validator = new Validator();
    foreach ($_POST as $stepfield => $value) {
        $field = $stepfield;
        $filter->apply('register', $field, $value);
        $result = $validator->validate_field('register', $field, $value, $type_user);
        $response[$field] = $result;
    }
    print json_encode($response);
    die;
    // or wordpress will print 0
}
开发者ID:CoordCulturaDigital-Minc,项目名称:pna,代码行数:16,代码来源:custom-profile.php

示例3: save

 /**
  */
 public function save($sid, array $params)
 {
     //$params should be array of "key"=>"value". So query will be "  update set `key`='value'  "
     $sql_k = $sql_v = array();
     foreach ($params as $k => $v) {
         if (is_string($k)) {
             $sql_k[] = "`{$k}`";
             $sql_v[] = "'" . Filter::apply($v, Filter::STRING_QUOTE_ENCODE) . "'";
         }
     }
     if (empty($sql_k)) {
         throw new CasseaException("Cannot save session. Data array is empty");
     }
     DB::query("replace into " . self::TABLE . " ( " . implode(", ", $sql_k) . " ) values (" . implode(", ", $sql_v) . ")");
 }
开发者ID:point,项目名称:cassea,代码行数:17,代码来源:DatabaseSession.php

示例4: get

 /**
  * Get Page Block
  *
  *  <code>
  *      $block = Blocks::get('my-block');
  *  </code>
  *
  * @access public
  * @param  string $name Block name
  * @return string Formatted Block content
  */
 public static function get($name)
 {
     if (File::exists($block_path = STORAGE_PATH . '/blocks/' . $name . '.md')) {
         // Create Unique Cache ID for Block
         $block_cache_id = md5('block' . ROOT_DIR . $block_path . filemtime($block_path));
         if (Cache::driver()->contains($block_cache_id)) {
             return Cache::driver()->fetch($block_cache_id);
         } else {
             Cache::driver()->save($block_cache_id, $block = Filter::apply('content', file_get_contents($block_path)));
             return $block;
         }
     } else {
         return 'Block ' . $name . ' is not found!';
     }
 }
开发者ID:cv0,项目名称:fansoro,代码行数:26,代码来源:Blocks.php

示例5: send

 public static function send($from, $to, $subject, $message, $FP = 'common:')
 {
     if (trim($to) === "" || !Guardian::check($to, '->email')) {
         return false;
     }
     $header = "MIME-Version: 1.0\n";
     $header .= "Content-Type: text/html; charset=ISO-8859-1\n";
     $header .= "From: " . $from . "\n";
     $header .= "Reply-To: " . $from . "\n";
     $header .= "Return-Path: " . $from . "\n";
     $header .= "X-Mailer: PHP/" . phpversion();
     $header = Filter::apply($FP . 'notification.email.header', $header);
     $message = Filter::apply($FP . 'notification.email.message', $message);
     return mail($to, $subject, $message, $header);
 }
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:15,代码来源:notify.php

示例6: _content

 /**
  * Returns block content for shortcode {block get="blockname"}
  *
  * @param array $attributes block filename
  */
 public static function _content($attributes)
 {
     if (isset($attributes['get'])) {
         $name = (string) $attributes['get'];
     } else {
         $name = '';
     }
     $block_path = STORAGE . DS . 'blocks' . DS . $name . '.block.html';
     if (File::exists($block_path)) {
         ob_start();
         include $block_path;
         $block_contents = ob_get_contents();
         ob_end_clean();
         return Filter::apply('content', Text::toHtml($block_contents));
     } else {
         if (Session::exists('admin') && Session::get('admin') == true) {
             return __('<b>Block <u>:name</u> is not found!</b>', 'blocks', array(':name' => $name));
         }
     }
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:25,代码来源:blocks.plugin.php

示例7: create

 public static function create($array, $type = 'ul', $depth = "", $FP = "", $i = 0)
 {
     $c_url = Config::get('url');
     $c_url_current = Config::get('url_current');
     $c_class = self::$config['classes'];
     $html = $depth . str_repeat(TAB, $i) . '<' . $type . ($i > 0 ? $c_class['children'] !== false ? ' class="' . sprintf($c_class['children'], $i / 2) . '"' : "" : ($c_class['parent'] !== false ? ' class="' . $c_class['parent'] . '"' : "")) . '>' . NL;
     foreach ($array as $key => $value) {
         if (!is_array($value)) {
             // List item separator: `array('|')`
             if ($key === '|' || is_int($key) && $value === '|') {
                 $html .= Filter::apply($FP . 'list.item.separator', Filter::apply($FP . 'list.item', $depth . str_repeat(TAB, $i + 1) . '<li class="' . $c_class['separator'] . '"></li>' . NL, $i + 1), $i + 1);
                 // List item without link: `array('foo')`
             } else {
                 if (is_int($key)) {
                     $html .= Filter::apply($FP . 'list.item', $depth . str_repeat(TAB, $i + 1) . '<li><span class="a">' . $value . '</span></li>' . NL, $i + 1);
                     // List item without link: `array('foo' => null)`
                 } else {
                     if (is_null($value)) {
                         $html .= Filter::apply($FP . 'list.item', $depth . str_repeat(TAB, $i + 1) . '<li><span class="a">' . $key . '</span></li>' . NL, $i + 1);
                         // List item with link: `array('foo' => '/')`
                     } else {
                         $value = Converter::url($value);
                         $html .= Filter::apply($FP . 'list.item', $depth . str_repeat(TAB, $i + 1) . '<li' . ($value === $c_url_current || $value !== $c_url && strpos($c_url_current . '/', $value . '/') === 0 ? ' class="' . $c_class['selected'] . '"' : "") . '><a href="' . $value . '">' . $key . '</a></li>' . NL, $i + 1);
                     }
                 }
             }
         } else {
             if (preg_match('#(.*?)\\s*\\((.*?)\\)\\s*$#', $key, $matches)) {
                 $_key = $matches[1];
                 $_value = Converter::url($matches[2]);
             } else {
                 $_key = $key;
                 $_value = '#';
             }
             $html .= Filter::apply($FP . 'list.item', $depth . str_repeat(TAB, $i + 1) . '<li' . ($_value === $c_url_current || $_value !== $c_url && strpos($c_url_current . '/', $_value . '/') === 0 ? ' class="' . $c_class['selected'] . '"' : "") . '>' . NL . str_repeat(TAB, $i + 2) . '<a href="' . $_value . '">' . $_key . '</a>' . NL . self::create($value, $type, $depth, $FP, $i + 2) . $depth . str_repeat(TAB, $i + 1) . '</li>' . NL, $i + 1);
         }
     }
     return Filter::apply($FP . 'list', rtrim($html, NL) . (!empty($array) ? NL . $depth . str_repeat(TAB, $i) : "") . '</' . $type . '>' . NL, $i);
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:39,代码来源:menu.php

示例8: chunk

 /**
  * ==========================================================
  *  RENDER A SHIELD CHUNK
  * ==========================================================
  *
  * -- CODE: -------------------------------------------------
  *
  *    Shield::chunk('header');
  *
  * ----------------------------------------------------------
  *
  *    Shield::chunk('header', array('title' => 'Yo!'));
  *
  * ----------------------------------------------------------
  *
  */
 public static function chunk($name, $fallback = false, $buffer = true)
 {
     $path__ = File::path($name);
     $G = array('data' => array('name' => $name));
     if (is_array($fallback)) {
         self::$lot = array_merge(self::$lot, $fallback);
         $fallback = false;
     }
     $path__ = Filter::apply('chunk:path', self::path($path__, $fallback));
     $G['data']['lot'] = self::$lot;
     $G['data']['path'] = $path__;
     $out = "";
     if ($path__) {
         // Begin chunk
         Weapon::fire('chunk_lot_before', array($G, $G));
         extract(Filter::apply('chunk:lot', self::$lot));
         Weapon::fire('chunk_lot_after', array($G, $G));
         Weapon::fire('chunk_before', array($G, $G));
         if ($buffer) {
             ob_start(function ($content) use($path__, &$out) {
                 $content = Filter::apply('chunk:input', $content, $path__);
                 $out = Filter::apply('chunk:output', $content, $path__);
                 return $out;
             });
             require $path__;
             ob_end_flush();
         } else {
             require $path__;
         }
         $G['data']['content'] = $out;
         // End chunk
         Weapon::fire('chunk_after', array($G, $G));
     }
 }
开发者ID:AdeHaze,项目名称:mecha-cms,代码行数:50,代码来源:shield.php

示例9: __construct

 /**
  * Parses given XML node and extracting info about from where to
  * take parameters for user's models methods.
  * Additionally, it filters and re-arrange this data to give more
  * flexibility to the models design.
  *
  * Base syntax is 
  * <pre><code>
  * <param from="p2" count="2" offset="1">
  *		<filter>int</filter>
  * </param>
  * </code></pre>
  *
  * It takes two parameters ("count" attribute), starting from 
  * the second ("offset" attribute). Indexing is zero-based.  
  * Then, received values  might be passed to, for example, dataset as first and second parameters.
  * Besides, {@link Filter} int applies to each parameter. If parameters were 
  * strings, after applying they becomes NULL values.
  *
  * Offset and count attributes are valid only while retrieving "p2" parameters.
  *
  * Another example:
  * <pre><code>
  * <param from="p2" count="2" offset="1" as="array">
  *		<filter>array_int</filter>
  * </param>
  * </code></pre>
  *
  * Here "as" attribute was presented. If "as" equals to "array", than collected data will be
  * passed to the model's method as single parameter as int-indexed array. "array_int" 
  * filter will be applied to the obtained array. Applying "int" filter int this case will cause
  * to receiving a NULL value.
  *
  * To receive "p1" parameter, you should use this syntax:
  * <pre><code>
  * <param from="p1">
  *		<filter>int</filter>
  * </param>
  * </code></pre>
  *
  * Specifying "count" and "offset" attributes will give no effect. There is single "p1" parameter.
  * It also may be filtered.
  *
  * System allows you to retrieve certain $_GET parameters. To do so use such syntax:
  * <pre><code>
  * <param from="p3" var="q">
  *		<filter>int</filter>
  * </param>
  * </code></pre>
  *
  * For example, if current url is <code>http://example.com/index.html?q=123</code>, value "123" will be
  * passed to the model's method.
  *
  * If you want to pass some constant value to the method (ie some flag), use syntax:
  * <pre><code>
  * <param constant="1">
  * </param>
  * </code></pre>
  *
  * Internal pagination system could pass predicted 'from' and 'limit' values to the model.
  * Use:
  * <pre><code>
  * <param from="limit">
  * </param>
  * </code></pre>
  * In this case, <code>array("from"=>$from, "limit"=>$limit)</code> will be passed.
  *
  * @param SimpleXMLElement XML document node with parameters.
  * @return null
  */
 function __construct(SimpleXMLElement $elem = null)
 {
     if (!isset($elem, $elem->param)) {
         return;
     }
     $controller = Controller::getInstance();
     $p2_cursor = 0;
     foreach ($elem->param as $param) {
         if ($param['from'] == "p1") {
             $this->params_from[] = "p1";
             $p = $controller->p1;
             if (isset($param['as']) && $param['as'] == "array") {
                 $p = array($p);
             }
             //slightly idiotic usage
             if (isset($param->filter)) {
                 $p = Filter::apply($p, (string) $param->filter);
             }
             $this->params[] = $p;
         } elseif ($param['from'] == "p2") {
             $total_count = count($controller->p2);
             if (isset($param['offset'])) {
                 if ((int) $param['offset'] > 0) {
                     $p2_cursor = (int) $param['offset'];
                 } elseif ((int) $param['offset'] < 0) {
                     $p2_cursor = max(0, $total_count - abs((int) $param['offset']));
                 }
             }
             $c = 1;
             if (isset($param['count'])) {
//.........这里部分代码省略.........
开发者ID:point,项目名称:cassea,代码行数:101,代码来源:DataObjectParams.php

示例10: __set

 /**
  * Magic method for setting value to given profile field.
  *
  * It also updates DB table with new value.
  *
  * @param string name of the profile field
  * @param scalar value 
  * @throws ProfileException in case of error
  */
 function __set($field_name, $value)
 {
     if (!is_scalar($value) || !array_key_exists($field_name, $this->fields)) {
         throw new ProfileException("Incorrect value or profile parameter '{$field_name}' doesn't exist");
     }
     $this->fields[$field_name] = $value;
     $field_name = Filter::apply($field_name, Filter::STRING_QUOTE_ENCODE);
     $value = Filter::apply($value, Filter::STRING_QUOTE_ENCODE);
     DB::query("update " . self::TABLE . " set " . $field_name . " = '" . $value . "' where user_id='" . $this->user_id . "' limit 1");
 }
开发者ID:point,项目名称:cassea,代码行数:19,代码来源:CasseaProfile.php

示例11: post


//.........这里部分代码省略.........
     if (!$results || !file_exists($results['path'])) {
         return false;
     }
     // RULES: Do not do any tags looping, content parsing
     // and external file requesting if it has been marked as
     // the excluded field(s). For better performance.
     $results = $results + Text::toPage(file_get_contents($results['path']), isset($excludes['content']) ? false : 'content', $FP, array('link' => "", 'author' => $config->author->name, 'description' => "", 'content_type' => $config->html_parser->active, 'fields' => array(), 'content' => "", 'css' => "", 'js' => ""), $results);
     $content = $results['content_raw'];
     $time = str_replace(array(' ', ':'), '-', $results['time']);
     $e = File::E($results['path']);
     // Custom post content with PHP file, named as the post slug
     if ($php = File::exist(File::D($results['path']) . DS . $results['slug'] . '.php')) {
         ob_start();
         include $php;
         $results['content'] = ob_get_clean();
     }
     $results['date'] = Filter::colon($FP . 'date', Date::extract($results['time']), $results);
     $results['url'] = Filter::colon($FP . 'url', $config->url . $connector . $results['slug'], $results);
     $results['excerpt'] = $more = "";
     if ($content !== "") {
         $exc = isset($excludes['content']) && strpos($content, '<!--') !== false ? Text::toPage(Converter::ES($content), 'content', $FP, array(), $results) : $results;
         $exc = $exc['content'];
         $exc = is_array($exc) ? implode("", $exc) : $exc;
         // Generate fake description data
         if ($results['description'] === "") {
             $results['description'] = Converter::curt($exc, $config->excerpt->length, $config->excerpt->suffix);
         }
         // Manual post excerpt with `<!-- cut+ "Read More" -->`
         if (strpos($exc, '<!-- cut+ ') !== false) {
             preg_match('#<!-- cut\\+( +([\'"]?)(.*?)\\2)? -->#', $exc, $matches);
             $more = !empty($matches[3]) ? $matches[3] : $speak->read_more;
             $more = '<p><a class="fi-link" href="' . $results['url'] . '#' . sprintf($config->excerpt->id, $results['id']) . '">' . $more . '</a></p>';
             $exc = preg_replace('#<!-- cut\\+( +(.*?))? -->#', '<!-- cut -->', $exc);
         }
         // ... or `<!-- cut -->`
         if (strpos($exc, '<!-- cut -->') !== false) {
             $parts = explode('<!-- cut -->', $exc, 2);
             $results['excerpt'] = Filter::colon($FP . 'excerpt', trim($parts[0]) . $more, $results);
             $results['content'] = trim($parts[0]) . NL . NL . '<span class="fi" id="' . sprintf($config->excerpt->id, $results['id']) . '" aria-hidden="true"></span>' . NL . NL . trim($parts[1]);
         }
     }
     // Post Tags
     if (!isset($excludes['tags'])) {
         $tags = array();
         foreach ($results['kind'] as $id) {
             $tags[] = call_user_func('self::' . rtrim($FP, ':') . 'Tag', 'id:' . $id);
         }
         $results['tags'] = Filter::colon($FP . 'tags', Mecha::eat($tags)->order('ASC', 'name')->vomit(), $results);
     }
     // Post Images
     $results['images'] = Filter::colon($FP . 'images', self::imagesURL($results['content']), $results);
     $results['image'] = Filter::colon($FP . 'image', isset($results['images'][0]) ? $results['images'][0] : Image::placeholder(), $results);
     // Post CSS and JS
     if ($file = File::exist(CUSTOM . DS . Date::slug($results['time']) . '.' . File::E($results['path']))) {
         $custom = explode(SEPARATOR, File::open($file)->read());
         $css = isset($custom[0]) ? Converter::DS(trim($custom[0])) : "";
         $js = isset($custom[1]) ? Converter::DS(trim($custom[1])) : "";
         // css_raw
         // post:css_raw
         // custom:css_raw
         // shortcode
         // custom:shortcode
         // css:shortcode
         // css
         // post:css
         // custom:css
         $css = Filter::colon($FP . 'css_raw', $css, $results);
         $results['css_raw'] = Filter::apply('custom:css_raw', $css, $results);
         $css = Filter::colon('css:shortcode', $css, $results);
         $css = Filter::apply('custom:shortcode', $css, $results);
         $css = Filter::colon($FP . 'css', $css, $results);
         $results['css'] = Filter::apply('custom:css', $css, $results);
         // js_raw
         // post:js_raw
         // custom:js_raw
         // shortcode
         // custom:shortcode
         // js:shortcode
         // js
         // post:js
         // custom:js
         $js = Filter::colon($FP . 'js_raw', $js, $results);
         $results['js_raw'] = Filter::apply('custom:js_raw', $js, $results);
         $js = Filter::colon('js:shortcode', $js, $results);
         $js = Filter::apply('custom:shortcode', $js, $results);
         $js = Filter::colon($FP . 'js', $js, $results);
         $results['js'] = Filter::apply('custom:js', $js, $results);
     }
     // Post Field(s)
     if (!isset($excludes['fields'])) {
         self::__fields($results, $FP);
     }
     // Exclude some field(s) from result(s)
     foreach ($results as $key => $value) {
         if (isset($excludes[$key])) {
             unset($results[$key]);
         }
     }
     return Mecha::O($results);
 }
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:101,代码来源:get.php

示例12: extract

 /**
  * ============================================================================
  *  PAGINATION EXTRACTOR FOR LIST OF FILE(S)
  * ============================================================================
  *
  * -- CODE: -------------------------------------------------------------------
  *
  *    $pager = Navigator::extract(glob('some/files/*.txt'), 1, 5, 'foo/bar');
  *    echo $pager->prev->anchor;
  *
  * ----------------------------------------------------------------------------
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *  Parameter  | Type    | Description
  *  ---------- | ------- | ----------------------------------------------------
  *  $pages     | array   | Array of file(s) to be paginated
  *  $current   | integer | The current page offset
  *  $current   | string  | The current page path
  *  $per_page  | integer | Number of file(s) to show per page request
  *  $connector | string  | Extra path to be inserted into URL
  *  ---------- | ------- | ----------------------------------------------------
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  */
 public static function extract($pages = array(), $current = 1, $per_page = 10, $connector = '/')
 {
     // Set default next, previous and step data
     $bucket = array('prev' => false, 'next' => false, 'step' => false);
     $pages = (array) $pages;
     $config = Config::get();
     $speak = Config::speak();
     $base = $config->url;
     $q = str_replace('&', '&amp;', $config->url_query);
     $qq = strpos($connector, '?') !== false ? str_replace('?', '&amp;', $q) : $q;
     $total = count($pages);
     $c = self::$config;
     if (strpos($connector, '%s') === false) {
         if (trim($connector, '/') !== "") {
             $connector = '/' . trim($connector, '/') . '/%s';
         } else {
             $connector = '/%s';
         }
     }
     if (is_int($current)) {
         $current = (int) $current;
         $prev = $current > 1 ? $current - 1 : false;
         $next = $current < ceil($total / $per_page) ? $current + 1 : false;
         // Generate next/previous URL for index page
         $bucket['prev']['url'] = Filter::apply(array('pager:prev.url', 'pager:url', 'url'), $prev ? $base . sprintf($connector, $prev) . $qq : $base . $q, $prev, $connector);
         $bucket['next']['url'] = Filter::apply(array('pager:next.url', 'pager:url', 'url'), $next ? $base . sprintf($connector, $next) . $qq : $base . $q, $next, $connector);
         // Generate next/previous anchor for index page
         $bucket['prev']['anchor'] = Filter::apply(array('pager:prev.anchor', 'pager:anchor', 'anchor'), $prev ? '<a href="' . $bucket['prev']['url'] . '" rel="prev">' . $speak->newer . '</a>' : "", $prev, $connector);
         $bucket['next']['anchor'] = Filter::apply(array('pager:next.anchor', 'pager:anchor', 'anchor'), $next ? '<a href="' . $bucket['next']['url'] . '" rel="next">' . $speak->older . '</a>' : "", $next, $connector);
         // Generate pagination anchor(s) for index page
         $html = '<span' . ($c['classes']['pagination'] !== false ? ' class="' . $c['classes']['pagination'] . '"' : "") . '>';
         $chunk = (int) ceil($total / $per_page);
         $step = $chunk > self::$config['step'] ? self::$config['step'] : $chunk;
         $left = $current - $step;
         if ($left < 1) {
             $left = 1;
         }
         if ($chunk > 1) {
             $bucket['step']['url']['first'] = Filter::apply(array('pager:step.url', 'pager:url', 'url'), $prev ? $base . sprintf($connector, 1) . $qq : false, 1, $connector);
             $bucket['step']['url']['prev'] = Filter::apply(array('pager:step.url', 'pager:url', 'url'), $prev ? $base . sprintf($connector, $prev) . $qq : false, $prev, $connector);
             $bucket['step']['anchor']['first'] = Filter::apply(array('pager:step.anchor', 'pager:anchor', 'anchor'), $prev ? '<a href="' . $bucket['step']['url']['first'] . '">' . $speak->first . '</a>' : '<span>' . $speak->first . '</span>', 1, $connector);
             $bucket['step']['anchor']['prev'] = Filter::apply(array('pager:step.anchor', 'pager:anchor', 'anchor'), $prev ? '<a href="' . $bucket['step']['url']['prev'] . '" rel="prev">' . $speak->prev . '</a>' : '<span>' . $speak->prev . '</span>', $prev, $connector);
             $html .= $bucket['step']['anchor']['first'] . $bucket['step']['anchor']['prev'];
             $html .= '<span>';
             for ($i = $current - $step + 1; $i < $current + $step; ++$i) {
                 if ($chunk > 1) {
                     if ($i - 1 < $chunk && ($i > 0 && $i + 1 > $current - $left - round($chunk / 2))) {
                         $bucket['step']['url'][$i] = Filter::apply(array('pager:step.url', 'pager:url'), $i !== $current ? $base . sprintf($connector, $i) . $qq : false, $i, $connector);
                         $bucket['step']['anchor'][$i] = Filter::apply(array('pager:step.anchor', 'pager:anchor', 'anchor'), $i !== $current ? '<a href="' . $bucket['step']['url'][$i] . '">' . $i . '</a>' : '<strong' . ($c['classes']['current'] !== false ? ' class="' . $c['classes']['current'] . '"' : "") . '>' . $i . '</strong>', $i, $connector);
                         $html .= $bucket['step']['anchor'][$i];
                     }
                 }
             }
             $html .= '</span>';
             $bucket['step']['url']['next'] = Filter::apply(array('pager:step.url', 'pager:url', 'url'), $next ? $base . sprintf($connector, $next) . $qq : false, $next, $connector);
             $bucket['step']['url']['last'] = Filter::apply(array('pager:step.url', 'pager:url', 'url'), $next ? $base . sprintf($connector, $chunk) . $qq : false, $chunk, $connector);
             $bucket['step']['anchor']['next'] = Filter::apply(array('pager:step.anchor', 'pager:anchor'), $next ? '<a href="' . $bucket['step']['url']['next'] . '" rel="next">' . $speak->next . '</a>' : '<span>' . $speak->next . '</span>', $next, $connector);
             $bucket['step']['anchor']['last'] = Filter::apply(array('pager:step.anchor', 'pager:anchor'), $next ? '<a href="' . $bucket['step']['url']['last'] . '">' . $speak->last . '</a>' : '<span>' . $speak->last . '</span>', $chunk, $connector);
             $html .= $bucket['step']['anchor']['next'] . $bucket['step']['anchor']['last'];
         }
         $bucket['step']['html'] = Filter::apply('pager:step.html', $html . '</span>');
     }
     if (is_string($current)) {
         for ($i = 0; $i < $total; ++$i) {
             if ($pages[$i] === $current) {
                 $prev = isset($pages[$i - 1]) ? $pages[$i - 1] : false;
                 $next = isset($pages[$i + 1]) ? $pages[$i + 1] : false;
                 // Generate next/previous URL for single page
                 $bucket['prev']['url'] = Filter::apply(array('pager:prev.url', 'pager:url', 'url'), $prev ? $base . sprintf($connector, $prev) . $qq : $base . $q, $prev, $connector);
                 $bucket['next']['url'] = Filter::apply(array('pager:next.url', 'pager:url', 'url'), $next ? $base . sprintf($connector, $next) . $qq : $base . $q, $next, $connector);
                 // Generate next/previous anchor for single page
                 $bucket['prev']['anchor'] = Filter::apply(array('pager:prev.anchor', 'pager:anchor', 'anchor'), $bucket['prev']['url'] !== $base ? '<a href="' . $bucket['prev']['url'] . '" rel="prev">' . $speak->newer . '</a>' : "", $prev, $connector);
                 $bucket['next']['anchor'] = Filter::apply(array('pager:next.anchor', 'pager:anchor', 'anchor'), $bucket['next']['url'] !== $base ? '<a href="' . $bucket['next']['url'] . '" rel="next">' . $speak->older . '</a>' : "", $next, $connector);
                 break;
             }
         }
//.........这里部分代码省略.........
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:101,代码来源:navigator.php

示例13: image

 public static function image($path, $addon = "", $merge = false)
 {
     if ($merge) {
         return self::merge($path, $merge, $addon, 'image');
     }
     $path = is_string($path) && strpos($path, ';') !== false ? explode(';', $path) : (array) $path;
     $html = "";
     for ($i = 0, $count = count($path); $i < $count; ++$i) {
         if (self::url($path[$i]) !== false) {
             self::$loaded[$path[$i]] = 1;
             $html .= !self::ignored($path[$i]) ? Filter::apply('asset:image', '<img src="' . self::url($path[$i]) . '"' . (is_array($addon) ? $addon[$i] : $addon) . ES . NL, $path[$i]) : "";
         } else {
             // File does not exist
             $html .= '<!-- ' . $path[$i] . ' -->' . NL;
         }
     }
     return O_BEGIN . rtrim($html, NL) . O_END;
 }
开发者ID:razordaze,项目名称:mecha-cms,代码行数:18,代码来源:asset.php

示例14: content

 /**
  * Get pages contents
  *
  * @return string
  */
 public static function content($slug = '')
 {
     if (!empty($slug)) {
         $page = Table::factory('pages')->select('[slug="' . $slug . '"]', null);
         if (!empty($page)) {
             $content = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt'));
             $content = Filter::apply('content', $content);
             return $content;
         } else {
             return '';
         }
     } else {
         return Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . Pages::$page['id'] . '.page.txt'));
     }
 }
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:20,代码来源:pages.plugin.php

示例15: page


//.........这里部分代码省略.........
         $results['excerpt'] = self::AMF(trim($parts[0]), $FP, 'excerpt');
         $results['content'] = preg_replace('#<p><a class="fi-link" href=".*?">.*?<\\/a><\\/p>#', "", trim($parts[0])) . NL . NL . '<span class="fi" id="read-more:' . $results['id'] . '" aria-hidden="true"></span>' . NL . NL . trim($parts[1]);
     }
     if (!isset($excludes['tags'])) {
         $tags = array();
         foreach ($results['kind'] as $id) {
             $tags[] = self::rawTag($id);
         }
         $results['tags'] = self::AMF(Mecha::eat($tags)->order('ASC', 'name')->vomit(), $FP, 'tags');
     }
     if (!isset($excludes['css']) || !isset($excludes['js'])) {
         if ($file = File::exist(CUSTOM . DS . $time . '.' . $extension)) {
             $custom = explode(SEPARATOR, File::open($file)->read());
             $css = isset($custom[0]) ? Text::DS(trim($custom[0])) : "";
             $js = isset($custom[1]) ? Text::DS(trim($custom[1])) : "";
             /**
              * CSS
              * ---
              *
              * css_raw
              * page:css_raw
              * custom:css_raw
              *
              * shortcode
              * page:shortcode
              * custom:shortcode
              *
              * css
              * page:css
              * custom:css
              *
              */
             $css = self::AMF($css, $FP, 'css_raw');
             $results['css_raw'] = Filter::apply('custom:css_raw', $css);
             $css = self::AMF($css, $FP, 'shortcode');
             $css = Filter::apply('custom:shortcode', $css);
             $css = self::AMF($css, $FP, 'css');
             $results['css'] = Filter::apply('custom:css', $css);
             /**
              * JS
              * --
              *
              * js_raw
              * page:js_raw
              * custom:js_raw
              *
              * shortcode
              * page:shortcode
              * custom:shortcode
              *
              * js
              * page:js
              * custom:js
              *
              */
             $js = self::AMF($js, $FP, 'js_raw');
             $results['js_raw'] = Filter::apply('custom:js_raw', $js);
             $js = self::AMF($js, $FP, 'shortcode');
             $js = Filter::apply('custom:shortcode', $js);
             $js = self::AMF($js, $FP, 'js');
             $results['js'] = Filter::apply('custom:js', $js);
         } else {
             $results['css'] = $results['js'] = $results['css_raw'] = $results['js_raw'] = "";
         }
         $custom = $results['css'] . $results['js'];
     } else {
开发者ID:razordaze,项目名称:mecha-cms,代码行数:67,代码来源:get.php


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