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


PHP Content::transform方法代码示例

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


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

示例1: getUserProfile

 /**
  * Returns a given user's profile
  * 
  * @param string  $username  Username's profile to return
  * @return array
  */
 public static function getUserProfile($username)
 {
     if (!UserAuth::isUser($username)) {
         return null;
     }
     $content = substr(File::get(Config::getConfigPath() . "/users/" . $username . ".yaml"), 3);
     $divide = strpos($content, "\n---");
     $front_matter = trim(substr($content, 0, $divide));
     $content_raw = trim(substr($content, $divide + 4));
     $profile = YAML::parse($front_matter);
     $profile['biography_raw'] = $content_raw;
     $profile['biography'] = Content::transform($content_raw);
     $profile['username'] = $username;
     return $profile;
 }
开发者ID:kwanpt,项目名称:kwan-website,代码行数:21,代码来源:userauth.php

示例2: getMember

 /**
  * Returns a Member object for one member
  * 
  * @param string  $username  Username of member to get
  * @return Member
  */
 public static function getMember($username)
 {
     self::loadMembers();
     if (!self::isMember($username)) {
         return array();
     }
     // get data
     $data = self::$members[$username];
     // load bio
     $file = File::get(sprintf(self::$path, $username));
     if ($file) {
         $content = substr(File::get($file), 3);
         $divide = strpos($content, "\n---");
         $data['biography_raw'] = trim(substr($content, $divide + 4));
         $data['biography'] = Content::transform($data['biography_raw']);
     }
     return new Member($data);
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:24,代码来源:memberservice.php

示例3: loadMemberData

 /**
  * Loads a Member's profile
  * 
  * @param string  $username  username to load data for
  * @return array
  * @throws Exception
  */
 private static function loadMemberData($username)
 {
     // pull profile data from filesystem
     $file = Config::getConfigPath() . '/users/' . $username . '.yaml';
     $raw_profile = substr(File::get($file), 3);
     // no profile found, throw an exception
     if (!$raw_profile) {
         throw new Exception('Member `' . $username . '` not found.');
     }
     // split out the profile into parts
     $divide = strpos($raw_profile, "\n---");
     $front_matter = trim(substr($raw_profile, 0, $divide));
     $content_raw = trim(substr($raw_profile, $divide + 4));
     // create data array for populating into the Member object
     $data = YAML::parse($front_matter);
     $data['biography_raw'] = $content_raw;
     $data['biography'] = Content::transform($content_raw);
     $data['username'] = $username;
     // return the Member data
     return $data;
 }
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:28,代码来源:member.php

示例4: yamlize_content

 public static function yamlize_content($meta_raw, $content_key = 'content')
 {
     if (File::exists($meta_raw)) {
         $meta_raw = File::get($meta_raw);
     }
     if (Pattern::endsWith($meta_raw, "---")) {
         $meta_raw .= "\n";
         # prevent parse failure
     }
     // Parse YAML Front Matter
     if (strpos($meta_raw, "---") === false) {
         $meta = YAML::parse($meta_raw);
         $meta['content'] = "";
     } else {
         list($yaml, $content) = preg_split("/---/", $meta_raw, 2, PREG_SPLIT_NO_EMPTY);
         $meta = YAML::parse($yaml);
         $meta[$content_key . '_raw'] = trim($content);
         $meta[$content_key] = Content::transform($content);
         return $meta;
     }
 }
开发者ID:zane-insight,项目名称:WhiteLaceInn,代码行数:21,代码来源:statamic.php

示例5: transform_content

 public static function transform_content($content, $content_type = NULL)
 {
     Log::warn("Use of Statamic::transform_content() is deprecated. Use Content::render() instead.", "core", "Statamic");
     return Content::transform($content, $content_type);
 }
开发者ID:nob,项目名称:joi,代码行数:5,代码来源:statamic.php

示例6: load

 public static function load($username)
 {
     $meta_raw = "";
     if (File::exists("_config/users/{$username}.yaml")) {
         $meta_raw = file_get_contents("_config/users/{$username}.yaml");
     } else {
         return NULL;
     }
     if (Pattern::endsWith($meta_raw, "---")) {
         $meta_raw .= "\n";
         # prevent parse failure
     }
     # Parse YAML Front Matter
     if (stripos($meta_raw, "---") === FALSE) {
         $meta = YAML::Parse($meta_raw);
         $meta['content'] = "";
     } else {
         list($yaml, $content) = preg_split("/---/", $meta_raw, 2, PREG_SPLIT_NO_EMPTY);
         $meta = YAML::Parse($yaml);
         $meta['biography_raw'] = trim($content);
         $meta['biography'] = Content::transform($content);
         $u = new Statamic_User($meta);
         $u->set_name($username);
         return $u;
     }
 }
开发者ID:nob,项目名称:joi,代码行数:26,代码来源:user.php


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