當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。