本文整理汇总了PHP中Localization::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Localization::fetch方法的具体用法?PHP Localization::fetch怎么用?PHP Localization::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Localization
的用法示例。
在下文中一共展示了Localization::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
// Let's make sure they set an upload destination
if (array_get($this->field_config, 'destination', false) === false) {
throw new Exception("You need to set a destination for your File field.");
}
if ($this->field_data) {
$file = Path::toAsset($this->field_data);
$html = "<div class='file-field-container file-exists'>";
$html .= "<div>";
if (File::isImage(Path::fromAsset($this->field_data, true))) {
$html .= "<img src='{$file}' height='58'>";
}
$html .= "<p>" . basename($this->field_data) . "</p>";
$html .= "<a class='btn btn-small btn-remove-file' href='#'>" . Localization::fetch('remove') . "</a>";
$html .= "</div>";
$html .= $this->makeFileSelect($file);
} else {
$html = "<div class='file-field-container'>";
$html .= "<div class='upload-file'>";
$html .= "<p><input type='file' name='{$this->fieldname}' tabindex='{$this->tabindex}' value='' /></p>";
$html .= $this->makeFileSelect();
$html .= "</div>";
}
$html .= "</div>";
return $html;
}
示例2: render
/**
* Renders the field
*
* @return string
*/
function render()
{
$random_keys = array('name' => $this->field_id, 'latitude' => Helper::getRandomString(), 'longitude' => Helper::getRandomString());
$values = array('name' => isset($this->field_data['name']) ? $this->field_data['name'] : '', 'latitude' => isset($this->field_data['latitude']) ? $this->field_data['latitude'] : '', 'longitude' => isset($this->field_data['longitude']) ? $this->field_data['longitude'] : '');
$html = '<div class="map"';
// add in per-field settings
$settings = array();
foreach ($this->field_config as $setting => $value) {
if (!in_array($setting, $this->allowed_settings) || is_null($value)) {
continue;
}
$settings[$setting] = $value;
}
// if we found something, add the configuration to the element
if (count($settings)) {
$html .= " data-location-configuration='" . json_encode($settings) . "'";
}
$html .= '></div>';
$html .= '<div class="entry">';
$html .= ' <div class="name">';
$html .= ' <p>';
$html .= Fieldtype::render_fieldtype('text', 'yaml][' . $this->field . '][name', array('display' => Localization::fetch('location_name')), $values['name'], NULL, NULL, $random_keys['name']);
$html .= ' </p>';
$html .= ' </div>';
$html .= ' <div class="coordinates">';
$html .= ' <p class="latitude">';
$html .= Fieldtype::render_fieldtype('text', 'yaml][' . $this->field . '][latitude', array('display' => Localization::fetch('latitude')), $values['latitude'], NULL, NULL, $random_keys['latitude']);
$html .= ' </p>';
$html .= ' <p class="longitude">';
$html .= Fieldtype::render_fieldtype('text', 'yaml][' . $this->field . '][longitude', array('display' => Localization::fetch('longitude')), $values['longitude'], NULL, NULL, $random_keys['longitude']);
$html .= ' </p>';
$html .= ' </div>';
$html .= '</div>';
return $html;
}
示例3: control_panel__add_routes
public function control_panel__add_routes()
{
$app = \Slim\Slim::getInstance();
$app->get('/globes', function () use($app) {
authenticateForRole('admin');
doStatamicVersionCheck($app);
Statamic_View::set_templates(array('globes-overview'), __DIR__ . '/templates');
$data = $this->tasks->getThemeSettings();
$app->render(null, array('route' => 'globes', 'app' => $app) + $data);
})->name('globes');
// Update global vars
$app->post('/globes/update', function () use($app) {
authenticateForRole('admin');
doStatamicVersionCheck($app);
$data = $this->tasks->getThemeSettings();
$vars = Request::fetch('pageglobals');
foreach ($vars as $name => $var) {
foreach ($data['globals'] as $key => $item) {
if ($item['name'] === $name) {
$data['globals'][$key]['value'] = $var;
}
}
}
File::put($this->tasks->getThemeSettingsPath(), YAML::dump($data, 1));
$app->flash('success', Localization::fetch('update_success'));
$app->redirect($app->urlFor('globes'));
});
}
示例4: control_panel__add_to_foot
public function control_panel__add_to_foot()
{
if (URL::getCurrent() == '/publish' && Request::get('path') == $this->tasks->getFilename()) {
return $this->js->inline('
$(".input-block").first().hide();
$(".status-block")
.html("<span class=\'folder\'>' . Localization::fetch('editing_globals') . '</span>")
.next().find("li").first().hide();
$("#item-content a").removeClass("active");
$("#item-globals a").addClass("active");
');
}
}
示例5: render
public function render()
{
$html = "<div class='file-field-container'>";
if ($this->field_data) {
$html .= "<div class='file-exists'>";
if (File::isImage(Path::fromAsset($this->field_data, true))) {
$html .= "<img src='" . Path::toAsset($this->field_data) . "' height='58'>";
}
$html .= "<p>" . basename($this->field_data) . "</p>";
$html .= "<a class='btn btn-small btn-remove-file' href='#'>" . Localization::fetch('remove') . "</a>";
$html .= "<input type='hidden' name='{$this->fieldname}' value='{$this->field_data}' />";
$html .= "</div>";
} else {
$html .= "<div class='upload-file'>";
$html .= "<p><input type='file' name='{$this->fieldname}' tabindex='{$this->tabindex}' value='' /></p>";
$html .= "</div>";
}
$html .= "</div>";
return $html;
}
示例6: control_panel__add_routes
public function control_panel__add_routes()
{
$app = \Slim\Slim::getInstance();
$app->get('/raven', function () use($app) {
authenticateForRole('admin');
doStatamicVersionCheck($app);
$template_list = array("raven-overview");
Statamic_View::set_templates(array_reverse($template_list), __DIR__ . '/templates');
$data = $this->tasks->getOverviewData();
if (count($data['formsets']) === 1) {
$app->redirect($app->urlFor('raven') . '/' . key($data['formsets']));
}
$app->render(null, array('route' => 'raven', 'app' => $app) + $data);
})->name('raven');
$app->get('/raven/:formset', function ($formset) use($app) {
authenticateForRole('admin');
doStatamicVersionCheck($app);
$template_list = array("raven-detail");
Statamic_View::set_templates(array_reverse($template_list), __DIR__ . '/templates');
$app->render(null, array('route' => 'raven', 'app' => $app) + $this->tasks->getFormsetData($formset));
});
$app->get('/raven/:formset/spam', function ($formset) use($app) {
authenticateForRole('admin');
doStatamicVersionCheck($app);
$template_list = array("raven-spam");
Statamic_View::set_templates(array_reverse($template_list), __DIR__ . '/templates');
$app->render(null, array('route' => 'raven', 'app' => $app) + $this->tasks->getFormsetSpamData($formset));
});
$app->get('/raven/:formset/export', function ($formset) use($app) {
authenticateForRole('admin');
doStatamicVersionCheck($app);
$res = $app->response();
$res['Content-Type'] = 'text/csv';
$res['Content-Disposition'] = 'attachment;filename=' . $formset . '-export.csv';
$this->tasks->exportCSV($formset);
});
$app->post('/raven/:formset/batch', function ($formset) use($app) {
authenticateForRole('admin');
doStatamicVersionCheck($app);
$files = (array) Request::fetch('files');
$action = Request::fetch('action');
$count = count($files);
foreach ($files as $file) {
switch ($action) {
case "delete":
File::delete($file);
break;
case "spam":
$this->tasks->markAsSpam($file);
break;
case "ham":
$this->tasks->markAsHam($file);
break;
}
}
$app->flash('success', Localization::fetch('batch_' . $action));
$app->redirect($app->urlFor('raven') . '/' . $formset);
});
$app->map('/raven/:formset/delete', function ($formset) use($app) {
authenticateForRole('admin');
doStatamicVersionCheck($app);
$files = (array) Request::fetch('files');
$count = count($files);
foreach ($files as $file) {
File::delete($file);
}
if ($count > 1) {
$app->flash('success', Localization::fetch('files_deleted'));
} else {
$app->flash('success', Localization::fetch('file_deleted'));
}
$app->redirect($app->urlFor('raven') . '/' . $formset);
})->via('GET', 'POST');
}
示例7: selectedEntries
<div class="input-select-wrap">
<select data-bind="enable: selectedEntries().length > 0, selectedOptions: selectedAction">
<option value=""><?php
echo Localization::fetch('take_action');
?>
</option>
<option value="delete"><?php
echo Localization::fetch('delete_entries');
?>
</option>
</select>
</div>
</div>
<input type="submit" class="btn pull-left" data-bind="visible: selectedAction() != '' && selectedEntries().length > 0" value="<?php
echo Localization::fetch('confirm_action');
?>
">
</div>
</form>
</div>
</div>
<script type="text/javascript">
var viewModel = {
selectedEntries: ko.observableArray(),
selectedAction: ko.observable(''),
};
示例8: elseif
<th><div class="header-inner"><?php
echo Localization::fetch('date');
?>
</div></th>
<?php
} elseif ($type == 'number') {
?>
<th><div class="header-inner"><?php
echo Localization::fetch('number');
?>
</div></th>
<?php
}
?>
<th style="width:80px"><div class="header-inner"><?php
echo Localization::fetch('status');
?>
</div></th>
</tr>
</thead>
<tbody>
<?php
foreach ($entries as $slug => $entry) {
?>
<?php
$status = isset($entry['status']) ? $entry['status'] : 'live';
?>
<tr>
<td class="checkbox-col">
<input type="checkbox" name="entries[]" value="<?php
示例9: index
public function index()
{
$str = $this->fetchParam('fetch', null, null, false, false);
return Localization::fetch($str);
}
示例10:
?>
</span>
<span class="folder"><?php
echo Localization::fetch('members');
?>
</span>
</div>
<ul>
<li>
<a href="<?php
print $app->urlFor('member') . "?new=1";
?>
">
<span class="ss-icon">adduser</span>
<?php
echo Localization::fetch('new_member');
?>
</a>
</li>
</ul>
</div>
<div class="section">
<?php
foreach ($members as $name => $member) {
?>
<div class="block member-block">
<img src="<?php
echo $member->get_gravatar(42);
?>
示例11: member__forgot_password
public function member__forgot_password()
{
$globals = Statamic::loadAllConfigs();
$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
$token = filter_input(INPUT_POST, 'token', FILTER_SANITIZE_STRING);
$return = filter_input(INPUT_POST, 'return', FILTER_SANITIZE_STRING);
$reset_return = filter_input(INPUT_POST, 'reset_return', FILTER_SANITIZE_STRING);
$referrer = Request::getReferrer();
// validate form token
if (!$this->tokens->validate($token)) {
$this->flash->set('forgot_password_error', 'Invalid token.');
URL::redirect($referrer);
}
// bail if member doesn't exist
if (!($member = Member::load($username))) {
$this->flash->set('forgot_password_error', Localization::fetch('member_doesnt_exist'));
URL::redirect($referrer);
}
// cache reset data
$token = $this->tokens->create();
$reset_data = array('username' => $username);
if (isset($reset_return)) {
$reset_data['return'] = $reset_return;
}
$this->cache->putYAML($token, $reset_data);
// generate reset url
$reset_url = URL::makeFull($this->fetchConfig('reset_password_url', str_replace(Config::getSiteURL(), '', $referrer)));
$reset_url .= '?H=' . $token;
// send email
$attributes = array('from' => $this->fetchConfig('email_sender', Config::get('email_sender'), null, false, false), 'to' => $member->get('email'), 'subject' => $this->fetchConfig('reset_password_subject', 'Password Reset', null, false, false));
if ($html_template = $this->fetchConfig('reset_password_html_email', false, null, false, false)) {
$attributes['html'] = Theme::getTemplate($html_template);
}
if ($text_template = $this->fetchConfig('reset_password_text_email', false, null, false, false)) {
$attributes['text'] = Theme::getTemplate($text_template);
}
foreach ($attributes as $key => $value) {
$attributes[$key] = Parse::template($value, array('reset_url' => $reset_url), array('statamic_view', 'callback'), $globals);
}
Email::send($attributes);
$this->flash->set('forgot_password_sent', true);
// redirect
URL::redirect($return);
}
示例12: rename
/**
* Renames this member
*
* @param string $username username to rename this Member to
* @return boolean
* @throws Exception
*/
public function rename($username)
{
// the files in question
$current_file = Config::getConfigPath() . '/users/' . $this->get('username') . '.yaml';
$new_file = Config::getConfigPath() . '/users/' . $username . '.yaml';
// is this the same that it already is?
if ($username === $this->get('username')) {
return true;
}
// is this a valid username?
if (!self::isValidusername($username)) {
throw new Exception(Localization::fetch('invalid_username'));
}
// does this filename already exist?
if (File::exists($new_file)) {
throw new Exception(Localization::fetch('username_already_exists'));
}
// everything checks out, rename the file and return true
File::rename($current_file, $new_file);
return true;
}
示例13: tabindex
>
<?php
print Fieldtype::render_fieldtype($fieldtype, $key, $value, $val, tabindex(), $input_key);
?>
</div>
<?php
}
?>
</div>
<div id="publish-action" class="footer-controls push-down">
<button type="submit" class="btn" id="publish-submit"><?php
echo Localization::fetch('save_publish');
?>
</button>
<button type="submit" class="btn" id="publish-continue-submit" name="continue" value="true"><?php
echo Localization::fetch('save_publish_continue');
?>
</button>
</div>
</form>
</div>
<?php
function tabindex()
{
static $count = 1;
return $count++;
}
示例14:
<div id="screen">
<h1><?php
echo Localization::fetch('error');
?>
</h1>
<?php
if ($flash['error']) {
?>
<div id="flash-msg-still" class="error">
<span class="icon">c</span>
<span class="msg"><?php
print $flash['error'];
?>
</p>
</div>
<?php
}
?>
</div>
示例15: display_folder
function display_folder($app, $folder, $base = "")
{
?>
<ul class="subpages">
<?php
foreach ($folder as $page) {
?>
<li class="page">
<div class="page-wrapper">
<div class="page-primary">
<!-- PAGE TITLE -->
<?php
if ($page['type'] == 'file') {
?>
<a href="<?php
print $app->urlFor('publish') . "?path={$base}/{$page['slug']}";
?>
"><span class="page-title"><?php
print isset($page['title']) ? $page['title'] : Statamic_Helper::prettify($page['slug']);
?>
</span></a>
<?php
} else {
?>
<a href="<?php
print $app->urlFor('publish') . "?path={$page['file_path']}";
?>
"><span class="page-title"><?php
print isset($page['title']) ? $page['title'] : Statamic_Helper::prettify($page['slug']);
?>
</span></a>
<?php
}
?>
<!-- ENTRIES -->
<?php
if (isset($page['has_entries']) && $page['has_entries']) {
?>
<div class="control-entries">
<span class="ss-icon">textfile</span>
<span class="muted"><?php
echo Localization::fetch('entries');
?>
:</span>
<a href="<?php
print $app->urlFor('entries') . "?path={$base}/{$page['slug']}";
?>
">
<?php
echo Localization::fetch('list');
?>
</a>
<span class="muted">or</span>
<a href="<?php
print $app->urlFor('publish') . "?path={$base}/{$page['slug']}&new=true";
?>
">
<?php
echo Localization::fetch('create');
?>
</a>
</div>
<?php
}
?>
</div>
<!-- SLUG & VIEW PAGE LINK -->
<div class="page-extras">
<div class="page-view">
<a href="<?php
print $page['url'];
?>
" class="tip" title="View Page">
<span class="ss-icon">link</span>
</a>
</div>
<?php
if ($page['type'] != 'file') {
?>
<div class="page-add"><a href="#" data-path="<?php
print $page['raw_url'];
?>
" data-title="<?php
print $page['title'];
?>
" class="tip add-page-btn" title="<?php
echo Localization::fetch('new_child_page');
?>
"><span class="ss-icon">addfile</span></a></div>
<?php
}
?>
<?php
//.........这里部分代码省略.........