本文整理汇总了PHP中Language::GetText方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::GetText方法的具体用法?PHP Language::GetText怎么用?PHP Language::GetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Language
的用法示例。
在下文中一共展示了Language::GetText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: NeedAuth
public static function NeedAuth($sType = '')
{
if (Auth::IsAuth()) {
if ($sType && Auth::$aUser['type_'] != $sType) {
if (Base::GetConstant('auth:error_type_redirect', 1)) {
Auth::LoginErrorRedirect(false);
} else {
Base::$sText .= Language::GetText('auth_error_type_redirect');
Base::Process();
die;
}
}
return true;
} else {
Auth::LoginErrorRedirect();
}
}
示例2: Video
App::Throw404();
}
// Check if video is valid
if (!Video::Exist(array('video_id' => $_POST['video_id'], 'status' => 'approved'))) {
App::Throw404();
}
$video = new Video($_POST['video_id']);
// Verify rating was given
if (!isset($_POST['rating']) || !in_array($_POST['rating'], array('1', '0'))) {
App::Throw404();
}
// Verify user is logged in
if (!$logged_in) {
echo json_encode(array('result' => 0, 'msg' => (string) Language::GetText('error_rate_login')));
exit;
}
// Check user doesn't rate his own video
if ($user->user_id == $video->user_id) {
echo json_encode(array('result' => 0, 'msg' => (string) Language::GetText('error_rate_own')));
exit;
}
// Submit rating if none exists
if (Rating::AddRating($_POST['rating'], $video->video_id, $logged_in)) {
Plugin::Trigger('rate.ajax.rate_video');
echo json_encode(array('result' => 1, 'msg' => (string) Language::GetText('success_rated'), 'other' => Rating::GetRating($video->video_id)));
exit;
} else {
Plugin::Trigger('rate.ajax.rate_video_duplicate');
echo json_encode(array('result' => 0, 'msg' => (string) Language::GetText('error_rate_duplicate')));
exit;
}
示例3: Exception
### Move video to site temp directory
$target = UPLOAD_PATH . '/temp/' . $video->filename . '.' . $extension;
Plugin::Trigger('upload.ajax.before_move_video');
if (!@move_uploaded_file($_FILES['upload']['tmp_name'], $target)) {
App::Alert('Error During Video Upload', 'The raw video file transfer failed. Video File: ' . $target);
throw new Exception(Language::GetText('error_uploadify_system', array('host' => HOST)));
}
### Change permissions on raw video file
Plugin::Trigger('upload.ajax.before_change_permissions');
try {
Filesystem::Open();
Filesystem::SetPermissions($target, 0644);
Filesystem::Close();
} catch (Exception $e) {
App::Alert('Error During Video Upload', $e->getMessage());
throw new Exception(Language::GetText('error_uploadify_system', array('host' => HOST)));
}
### Update video information
$data = array('status' => 'pending conversion', 'original_extension' => $extension);
Plugin::Trigger('upload.ajax.before_update_video');
$video->Update($data);
### Initilize Encoder
$cmd_output = $config->debug_conversion ? CONVERSION_LOG : '/dev/null';
Plugin::Trigger('upload.ajax.before_encode');
$converter_cmd = 'nohup ' . Settings::Get('php') . ' ' . DOC_ROOT . '/cc-core/system/encode.php --video="' . $video->video_id . '" >> ' . $cmd_output . ' 2>&1 &';
exec($converter_cmd);
Plugin::Trigger('upload.ajax.encode');
// Output success message
exit(json_encode(array('result' => 1, 'msg' => '')));
} catch (Exception $e) {
exit(json_encode(array('result' => 0, 'msg' => $e->getMessage())));
示例4: Comment
$comment_id = Comment::Create($data);
$comment = new Comment($comment_id);
$comment->Approve('activate');
// Retrieve formatted new comment
if (Settings::Get('auto_approve_comments') == 1) {
if ($block) {
View::InitView();
ob_start();
View::RepeatingBlock($block, array($comment->comment_id));
$output = ob_get_contents();
ob_end_clean();
} else {
$output = $comment;
}
$message = (string) Language::GetText('success_comment_posted');
$other = array('auto_approve' => 1, 'output' => $output);
} else {
$message = (string) Language::GetText('success_comment_approve');
$other = array('auto_approve' => 0, 'output' => '');
}
echo json_encode(array('result' => 1, 'msg' => $message, 'other' => $other));
Plugin::Trigger('comment.ajax.post_comment');
exit;
} else {
$error_msg = Language::GetText('errors_below');
$error_msg .= '<br /><br /> - ' . implode('<br /> - ', $Errors);
echo json_encode(array('result' => 0, 'msg' => $error_msg));
exit;
}
}
// END verify if page was submitted
示例5: implode
if (empty(View::$vars->Errors)) {
View::$vars->message = Language::GetText('success_profile_updated');
View::$vars->message_type = 'success';
View::$vars->user->Update(View::$vars->data);
Plugin::Trigger('update_profile.update_profile');
} else {
View::$vars->message = Language::GetText('errors_below');
View::$vars->message .= '<br /><br /> - ' . implode('<br /> - ', View::$vars->Errors);
View::$vars->message_type = 'error';
}
}
// END Handle Profile form
/**************************
Handle Reset Avatar Action
**************************/
if (!empty($_GET['action']) && $_GET['action'] == 'reset' && !empty(View::$vars->user->avatar)) {
try {
Filesystem::Open();
Filesystem::Delete(UPLOAD_PATH . '/avatars/' . View::$vars->user->avatar);
Filesystem::Close();
} catch (Exception $e) {
App::Alert('Error during Avatar Reset', $e->getMessage());
}
View::$vars->user->Update(array('avatar' => ''));
View::$vars->message = Language::GetText('success_avatar_reset');
View::$vars->message_type = 'success';
Plugin::Trigger('update_profile.avatar_reset');
}
// Output page
Plugin::Trigger('update_profile.before_render');
View::Render('myaccount/update_profile.tpl');
示例6: trim
$string = '/^[a-z0-9][a-z0-9_\\.\\-]+@[a-z0-9][a-z0-9\\.-]+\\.[a-z0-9]{2,4}$/i';
if (!empty($_POST['email']) && !ctype_space($_POST['email']) && preg_match($string, $_POST['email'])) {
View::$vars->email = trim($_POST['email']);
} else {
View::$vars->Errors['email'] = Language::GetText('error_email');
}
// Validate feedback
if (!empty($_POST['feedback']) && !ctype_space($_POST['feedback'])) {
View::$vars->feedback = trim($_POST['feedback']);
} else {
View::$vars->Errors['feedback'] = Language::GetText('error_message');
}
// Send email if no errors
if (empty(View::$vars->Errors)) {
$subject = 'Message received From ' . $config->sitename;
$Msg = "Name: " . View::$vars->name . "\n";
$Msg .= "E-mail: " . View::$vars->email . "\n";
$Msg .= "Message:\n" . View::$vars->feedback;
App::Alert($subject, $Msg);
Plugin::Trigger('contact.send');
View::$vars->message_type = 'success';
View::$vars->message = Language::GetText('success_contact_sent');
} else {
View::$vars->message_type = 'error';
View::$vars->message = Language::GetText('errors_below');
View::$vars->message .= '<br /><br /> - ' . implode('<br /> - ', View::$vars->Errors);
}
}
// Output Page
Plugin::Trigger('contact.before_render');
View::Render('contact.tpl');
示例7: Exception
throw new Exception(Language::GetText('error_flag_own'));
}
// Verify Flag doesn't exist
$data = array('type' => $_POST['type'], 'id' => $_POST['id'], 'user_id' => $user->user_id);
if (Flag::Exist($data)) {
throw new Exception(Language::GetText('error_flag_duplicate'));
}
Plugin::Trigger('flag.ajax.before_flag');
// Send admin alert
if (Settings::Get('alerts_flags') == '1') {
$subject = 'Content Flagged As Inappropriate';
$body = "One of your members flagged content as inappropriate. ";
$body .= "Please review the content to verify it is valid. ";
$body .= "You can login to the Admin Panel to dismiss the flag, or uphold it and ban the content.";
$body .= "\n\n=======================================================\n";
$body .= "Content Type: {$type}\n";
$body .= "URL: {$url}\n";
$body .= "{$name}\n";
$body .= "=======================================================";
Plugin::Trigger('flag.ajax.alert');
App::Alert($subject, $body);
}
// Create flag and output message
Flag::Create($data);
Plugin::Trigger('flag.ajax.flag');
echo json_encode(array('result' => 1, 'msg' => (string) Language::GetText('success_flag')));
exit;
} catch (Exception $e) {
echo json_encode(array('result' => 0, 'msg' => $e->getMessage()));
exit;
}
示例8: User
View::InitView('myfavorites');
Plugin::Trigger('myfavorites.start');
Functions::RedirectIf(View::$vars->logged_in = User::LoginCheck(), HOST . '/login/');
View::$vars->user = new User(View::$vars->logged_in);
$records_per_page = 9;
$url = HOST . '/myaccount/myfavorites';
View::$vars->message = null;
/***********************
Handle Form if submitted
***********************/
if (isset($_GET['vid']) && is_numeric($_GET['vid']) && $_GET['vid'] != 0) {
$data = array('user_id' => View::$vars->user->user_id, 'video_id' => $_GET['vid']);
$id = Favorite::Exist($data);
if ($id) {
Favorite::Delete($id);
View::$vars->message = Language::GetText('success_favorite_removed');
View::$vars->message_type = 'success';
Plugin::Trigger('myfavorites.remove_favorite');
}
}
// Retrieve total count
$query = "SELECT " . DB_PREFIX . "favorites.video_id FROM " . DB_PREFIX . "favorites INNER JOIN " . DB_PREFIX . "videos ON " . DB_PREFIX . "favorites.video_id = " . DB_PREFIX . "videos.video_id WHERE status = 'approved' AND private = '0' AND " . DB_PREFIX . "favorites.user_id = " . View::$vars->user->user_id;
$result_count = $db->Query($query);
$total = $db->Count($result_count);
// Initialize pagination
View::$vars->pagination = new Pagination($url, $total, $records_per_page);
$start_record = View::$vars->pagination->GetStartRecord();
// Retrieve limited results
$query .= " LIMIT {$start_record}, {$records_per_page}";
View::$vars->result = $db->Query($query);
// Output page
示例9: dirname
<?php
// Include required files
include_once dirname(dirname(__FILE__)) . '/config/bootstrap.php';
App::LoadClass('User');
Plugin::Trigger('username.ajax.start');
### Check if username is in use
if (!empty($_POST['username']) && strlen($_POST['username']) >= 4) {
if (User::Exist(array('username' => $_POST['username']))) {
echo json_encode(array('result' => 0, 'msg' => (string) Language::GetText('error_username_unavailable')));
} else {
echo json_encode(array('result' => 1, 'msg' => (string) Language::GetText('username_available')));
}
} else {
echo json_encode(array('result' => 0, 'msg' => (string) Language::GetText('username_minimum')));
}
示例10: User
Plugin::Trigger('subscriptions.start');
Functions::RedirectIf(View::$vars->logged_in = User::LoginCheck(), HOST . '/login/');
View::$vars->user = new User(View::$vars->logged_in);
$records_per_page = 9;
$url = HOST . '/myaccount/subscriptions';
View::$vars->message = null;
/***********************
Handle Form if submitted
***********************/
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$data = array('user_id' => View::$vars->user->user_id, 'member' => $_GET['id']);
$id = Subscription::Exist($data);
if ($id) {
$subscribed_user = new User($_GET['id']);
Subscription::Delete($id);
View::$vars->message = Language::GetText('success_unsubscribed', array('username' => $subscribed_user->username));
View::$vars->message_type = 'success';
Plugin::Trigger('subscriptions.unsubscribe');
}
}
/******************
Prepare page to run
******************/
// Retrieve total count
$query = "SELECT sub_id FROM " . DB_PREFIX . "subscriptions WHERE user_id = " . View::$vars->user->user_id;
$result_count = $db->Query($query);
$total = $db->Count($result_count);
// Initialize pagination
View::$vars->pagination = new Pagination($url, $total, $records_per_page);
$start_record = View::$vars->pagination->GetStartRecord();
// Retrieve limited results
示例11: User
View::InitView('myvideos');
Plugin::Trigger('myvideos.start');
Functions::RedirectIf(View::$vars->logged_in = User::LoginCheck(), HOST . '/login/');
View::$vars->user = new User(View::$vars->logged_in);
$records_per_page = 9;
$url = HOST . '/myaccount/myvideos';
View::$vars->message = null;
/***********************
Handle Form if submitted
***********************/
if (isset($_GET['vid']) && is_numeric($_GET['vid'])) {
$data = array('user_id' => View::$vars->user->user_id, 'video_id' => $_GET['vid']);
$video_id = Video::Exist($data);
if ($video_id) {
Video::Delete($video_id);
View::$vars->message = Language::GetText('success_video_deleted');
View::$vars->message_type = 'success';
Plugin::Trigger('myvideos.delete_video');
}
}
// Retrieve total count
$query = "SELECT video_id FROM " . DB_PREFIX . "videos WHERE user_id = " . View::$vars->user->user_id . " AND status = 'approved'";
$result_count = $db->Query($query);
$total = $db->Count($result_count);
// Initialize pagination
View::$vars->pagination = new Pagination($url, $total, $records_per_page);
$start_record = View::$vars->pagination->GetStartRecord();
// Retrieve limited results
$query .= " LIMIT {$start_record}, {$records_per_page}";
View::$vars->result = $db->Query($query);
// Output page
示例12: dirname
<?php
// Include required files
include_once dirname(dirname(dirname(__FILE__))) . '/config/bootstrap.php';
App::LoadClass('Video');
// Establish page variables, objects, arrays, etc
View::InitView('mobile_index');
Plugin::Trigger('mobile_index.start');
// Retrieve updated page title
View::$vars->meta->title = Language::GetText('mobile_heading', array('sitename' => $config->sitename));
// Retrieve Featured Video
$query = "SELECT video_id FROM " . DB_PREFIX . "videos WHERE status = 'approved' AND featured = 1 AND private = '0' AND gated = '0'";
View::$vars->featured_video = array();
$result_featured = $db->Query($query);
while ($video = $db->FetchObj($result_featured)) {
View::$vars->featured_video[] = $video->video_id;
}
// Retrieve Recent Videos
$query = "SELECT video_id FROM " . DB_PREFIX . "videos WHERE status = 'approved' AND private = '0' AND gated = '0' ORDER BY video_id DESC LIMIT 3";
View::$vars->recent_videos = array();
$result_recent = $db->Query($query);
while ($video = $db->FetchObj($result_recent)) {
View::$vars->recent_videos[] = $video->video_id;
}
// Output Page
Plugin::Trigger('mobile_index.before_render');
View::Render('index.tpl');
示例13: User
// Establish page variables, objects, arrays, etc
View::InitView('activate');
Plugin::Trigger('activate.start');
View::$vars->logged_in = User::LoginCheck();
Functions::RedirectIf(!View::$vars->logged_in, HOST . '/myaccount/');
View::$vars->message = null;
### Verify token was provided
if (isset($_GET['token'])) {
$token = $_GET['token'];
$id = User::Exist(array('confirm_code' => $token, 'status' => 'new'));
if ($id) {
$user = new User($id);
$user->Approve('activate');
if (Settings::Get('auto_approve_users') == 1) {
View::$vars->message = Language::GetText('activate_success', array('host' => HOST));
$_SESSION['user_id'] = $user->user_id;
} else {
View::$vars->message = Language::GetText('activate_approve');
}
View::$vars->message_type = 'success';
Plugin::Trigger('activate.activate');
} else {
View::$vars->message = Language::GetText('activate_error', array('host' => HOST));
View::$vars->message_type = 'error';
}
} else {
App::Throw404();
}
// Output Page
Plugin::Trigger('activate.before_render');
View::Render('activate.tpl');
示例14: elseif
$url .= '/' . $_GET['category'];
}
} elseif (isset($_GET['load']) && in_array($_GET['load'], $load)) {
switch ($_GET['load']) {
case 'most-viewed':
View::$vars->sub_header = Language::GetText('most_viewed');
$query = "SELECT video_id FROM " . DB_PREFIX . "videos WHERE status = 'approved' AND private = '0' ORDER BY views DESC";
$url .= '/most-viewed';
break;
case 'most-discussed':
View::$vars->sub_header = Language::GetText('most_discussed');
$query = "SELECT " . DB_PREFIX . "videos.video_id, COUNT(comment_id) AS 'sum' from " . DB_PREFIX . "videos LEFT JOIN " . DB_PREFIX . "comments ON " . DB_PREFIX . "videos.video_id = " . DB_PREFIX . "comments.video_id WHERE " . DB_PREFIX . "videos.status = 'approved' AND private = '0' GROUP BY video_id ORDER BY sum DESC";
$url .= '/most-discussed';
break;
case 'most-rated':
View::$vars->sub_header = Language::GetText('most_rated');
$query = "SELECT " . DB_PREFIX . "videos.video_id, COUNT(rating) AS 'rating_count', SUM(rating) as 'rating_sum' from " . DB_PREFIX . "videos LEFT JOIN " . DB_PREFIX . "ratings ON " . DB_PREFIX . "videos.video_id = " . DB_PREFIX . "ratings.video_id WHERE " . DB_PREFIX . "videos.status = 'approved' AND private = '0' GROUP BY video_id ORDER BY rating_count DESC, rating_sum DESC";
$url .= '/most-rated';
break;
}
}
// Retrieve total count
$result_count = $db->Query($query);
$total = $db->Count($result_count);
// Initialize pagination
View::$vars->pagination = new Pagination($url, $total, $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->browse_videos = array();
示例15: fopen
}
### Validate image data
$handle = fopen($_FILES['upload']['tmp_name'], 'r');
$image_data = fread($handle, filesize($_FILES['upload']['tmp_name']));
if (!@imagecreatefromstring($image_data)) {
throw new Exception(Language::GetText('error_uploadify_extension'));
}
### Change permissions on avatar & delete previous IF/APP
try {
Filesystem::Open();
$avatar_path = UPLOAD_PATH . '/avatars';
$save_as = Avatar::CreateFilename($extension);
Avatar::SaveAvatar($_FILES['upload']['tmp_name'], $extension, $save_as);
// Check for existing avatar
if (!empty($user->avatar)) {
Avatar::Delete($user->avatar);
}
Filesystem::SetPermissions("{$avatar_path}/{$save_as}", 0644);
Filesystem::Close();
} catch (Exception $e) {
App::Alert('Error During Avatar Upload', $e->getMessage());
throw new Exception(Language::GetText('error_uploadify_system', array('host' => HOST)));
}
### Update User
$user->Update(array('avatar' => $save_as));
Plugin::Trigger('update_profile.update_avatar');
// Output success message
exit(json_encode(array('result' => 1, 'msg' => (string) Language::GetText('success_avatar_updated'), 'other' => $user->avatar_url)));
} catch (Exception $e) {
exit(json_encode(array('result' => 0, 'msg' => $e->getMessage())));
}