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


PHP Functions::Replace方法代码示例

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


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

示例1: GetCustomText

 /**
  * Retrieve custom text from the loaded language xml file
  * @param string $node The name of the custom language xml node to retrieve
  * @param array $replace Optional Replacements for placeholders (See Functions::Replace for more deails)
  * @return string The requested string is returned with replacements made
  * to it or boolean false if requested node is invalid
  */
 static function GetCustomText($node, $replace = array())
 {
     // Retrieve node text if it exists
     if (isset(self::$xml->custom->{$node})) {
         $string = self::$xml->custom->{$node};
         // Check for text replacements
         if (!empty($replace)) {
             $string = Functions::Replace($string, $replace);
         }
         return $string;
     } else {
         return false;
     }
 }
开发者ID:KmServer,项目名称:CumulusClips,代码行数:21,代码来源:Language.php

示例2: array

}
$success = NULL;
$errors = NULL;
$sub_id = NULL;
$post_count = 5;
// Verify Member was supplied
if (isset($_GET['username'])) {
    $data = array('username' => $_GET['username'], 'status' => 'Active');
    $user_id = User::Exist($data);
} else {
    App::Throw404();
}
// Verify Member exists
if ($user_id) {
    View::$vars->member = new User($user_id);
    View::$vars->meta->title = Functions::Replace(View::$vars->meta->title, array('member' => View::$vars->member->username));
    Plugin::Trigger('profile.load_member');
} else {
    App::Throw404();
}
### Check if user is subscribed
if (View::$vars->logged_in) {
    $data = array('user_id' => View::$vars->user->user_id, 'member' => View::$vars->member->user_id);
    View::$vars->subscribe_text = Subscription::Exist($data) ? 'unsubscribe' : 'subscribe';
} else {
    View::$vars->subscribe_text = 'subscribe';
}
### Count subscription
$query = "SELECT COUNT(sub_id) FROM " . DB_PREFIX . "subscriptions WHERE member = " . View::$vars->member->user_id;
$result = $db->Query($query);
View::$vars->sub_count = $db->FetchRow($result);
开发者ID:KmServer,项目名称:CumulusClips,代码行数:31,代码来源:profile.php

示例3: User

if (View::$vars->logged_in) {
    View::$vars->user = new User(View::$vars->logged_in);
}
$keyword = NULL;
View::$vars->cleaned = NULL;
$url = HOST . '/search';
$query_string = array();
$records_per_page = 9;
// Verify a keyword was given
if (isset($_POST['submitted_search'])) {
    View::$vars->cleaned = htmlspecialchars($_POST['keyword']);
} elseif (isset($_GET['keyword'])) {
    View::$vars->cleaned = htmlspecialchars($_GET['keyword']);
}
$query_string['keyword'] = View::$vars->cleaned;
View::$vars->meta->title = Functions::Replace(View::$vars->meta->title, array('keyword' => View::$vars->cleaned));
$keyword = $db->Escape(View::$vars->cleaned);
// Retrieve count of all videos
$query = "SELECT COUNT(video_id) as total FROM " . DB_PREFIX . "videos WHERE status = 'approved' AND private = '0'";
$result_total = $db->Query($query);
$total = $db->FetchObj($result_total);
// Retrieve total count
if ($total->total > 20 && strlen($keyword) > 3) {
    // Use FULLTEXT query
    $query = "SELECT video_id FROM " . DB_PREFIX . "videos WHERE status = 'approved' AND private = '0' AND MATCH(title, tags, description) AGAINST('{$keyword}')";
    Plugin::Trigger('search.search_count');
    $result_count = $db->Query($query);
    $count = $db->Count($result_count);
} else {
    // Use LIKE query
    $query = "SELECT video_id FROM " . DB_PREFIX . "videos WHERE status = 'approved' AND private = '0' AND (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%' OR tags LIKE '%{$keyword}%')";
开发者ID:KmServer,项目名称:CumulusClips,代码行数:31,代码来源:search.php

示例4: Video

if (!empty($_GET['vid']) && is_numeric($_GET['vid']) && Video::Exist(array('status' => 'approved', 'video_id' => $_GET['vid']))) {
    View::$vars->video = new Video($_GET['vid']);
    View::$vars->video_url = View::$vars->video->url;
    $url = HOST . '/videos/' . View::$vars->video->video_id . '/comments';
} else {
    if (!empty($_GET['private']) && ($video_id = Video::Exist(array('status' => 'approved', 'private_url' => $_GET['private'])))) {
        View::$vars->video = new Video($video_id);
        View::$vars->private = true;
        View::$vars->video_url = HOST . '/private/videos/' . View::$vars->video->private_url;
        $url = HOST . '/private/comments/' . View::$vars->video->private_url;
    } else {
        App::Throw404();
    }
}
// Retrieve Video
View::$vars->meta->title = Functions::Replace(View::$vars->meta->title, array('video' => View::$vars->video->title));
// Retrieve comments count
$query = "SELECT comment_id FROM " . DB_PREFIX . "comments WHERE video_id = " . View::$vars->video->video_id . " ORDER BY comment_id DESC";
$result_count = $db->Query($query);
View::$vars->total_comments = $db->Count($result_count);
// Initialize pagination
View::$vars->pagination = new Pagination($url, View::$vars->total_comments, $records_per_page);
$start_record = View::$vars->pagination->GetStartRecord();
// Retrieve limited results
$query .= " LIMIT {$start_record}, {$records_per_page}";
$result = $db->Query($query);
View::$vars->comment_list = array();
while ($row = $db->FetchObj($result)) {
    View::$vars->comment_list[] = $row->comment_id;
}
// Output page
开发者ID:KmServer,项目名称:CumulusClips,代码行数:31,代码来源:comments.php


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