本文整理汇总了PHP中gp_tmpl_load函数的典型用法代码示例。如果您正苦于以下问题:PHP gp_tmpl_load函数的具体用法?PHP gp_tmpl_load怎么用?PHP gp_tmpl_load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gp_tmpl_load函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login_get
function login_get()
{
if (!GP::$user->logged_in()) {
gp_tmpl_load('login', array());
} else {
gp_redirect(gp_url('/'));
}
}
示例2: new_get
function new_get()
{
$set = new GP_Translation_Set();
$set->project_id = gp_get('project_id');
if ($set->project_id) {
$this->can_or_redirect('write', 'project', $set->project_id, gp_url_project(GP::$project->get($set->project_id)));
}
$all_project_options = self::_options_from_projects(GP::$project->all());
$all_locale_options = self::_options_from_locales(GP_Locales::locales());
gp_tmpl_load('translation-set-new', get_defined_vars());
}
示例3: gp_title
<?php
gp_title(__('Create New Translation Set < GlotPress'));
gp_breadcrumb(array(__('Create New Translation Set')));
gp_tmpl_header();
?>
<h2><?php
_e('Create New Translation Set');
?>
</h2>
<form action="" method="post">
<?php
gp_tmpl_load('translation-set-form', get_defined_vars());
?>
<p><input type="submit" name="submit" value="<?php
echo esc_attr(__('Create'));
?>
" id="submit" /></p>
</form>
<?php
gp_tmpl_footer();
示例4: gp_tmpl_404
function gp_tmpl_404($args = array())
{
gp_tmpl_load('404', $args + array('title' => __('Not Found'), 'http_status' => 404));
exit;
}
示例5: _e
_e('Original string', 'glotpress');
?>
</th>
<th class="translation"><?php
_e('Translation', 'glotpress');
?>
</th>
<th>—</th>
</tr>
</thead>
<?php
if ($glossary) {
$translations = map_glossary_entries_to_translations_originals($translations, $glossary);
}
foreach ($translations as $t) {
gp_tmpl_load('translation-row', get_defined_vars());
}
if (!$translations) {
?>
<tr><td colspan="<?php
echo $can_approve ? 5 : 4;
?>
"><?php
_e('No translations were found!', 'glotpress');
?>
</td></tr>
<?php
}
?>
</table>
<?php
示例6: foreach
?>
</th>
<?php
if ($can_edit) {
?>
<th style="width:10%">—</th>
<?php
}
?>
</tr>
</thead>
<tbody>
<?php
if (count($glossary_entries) > 0) {
foreach ($glossary_entries as $entry) {
gp_tmpl_load('glossary-entry-row', get_defined_vars());
}
} else {
?>
<tr>
<td colspan="5">
<?php
_e('No glossary entries yet.', 'glotpress');
?>
</td>
</tr>
<?php
}
?>
<?php
if ($can_edit) {
示例7: new_post
function new_post()
{
$post = gp_post('project');
$parent_project_id = gp_array_get($post, 'parent_project_id', null);
$this->can_or_redirect('write', 'project', $parent_project_id);
$new_project = new GP_Project($post);
$this->validate_or_redirect($new_project);
$project = GP::$project->create_and_select($new_project);
if (!$project) {
$project = new GP_Project();
$this->errors[] = __('Error in creating project!');
$all_project_options = self::_options_from_projects(GP::$project->all());
gp_tmpl_load('project-new', get_defined_vars());
} else {
$this->notices[] = __('The project was created!');
gp_redirect(gp_url_project($project, '_edit'));
}
}
示例8: tmpl
/**
* Loads a template.
*
* @param string $template template name to load
* @param array $args Associative array with arguements, which will be exported in the template PHP file
* @param bool|string $honor_api If this is true or 'api' and the route is processing an API request
* the template name will be suffixed with .api. The actual file loaded will be template.api.php
*/
function tmpl($template, $args = array(), $honor_api = true)
{
if ($this->fake_request) {
$this->rendered_template = true;
$this->loaded_template = $template;
}
$this->set_notices_and_errors();
if ($this->api && $honor_api !== false && 'no-api' !== $honor_api) {
$template = $template . '.api';
$this->header('Content-Type: application/json');
} else {
$this->header('Content-Type: text/html; charset=utf-8');
}
if ($this->fake_request) {
$this->template_output = gp_tmpl_get_output($template, $args, $this->template_path);
return true;
}
return gp_tmpl_load($template, $args, $this->template_path);
}
示例9: discard_warning
function discard_warning($project_path, $locale_slug, $translation_set_slug)
{
$project = GP::$project->by_path($project_path);
$locale = GP_Locales::by_slug($locale_slug);
$translation_set = GP::$translation_set->by_project_id_slug_and_locale($project->id, $translation_set_slug, $locale_slug);
if (!$project || !$locale || !$translation_set) {
gp_tmpl_404();
}
$this->can_or_forbidden('write', 'project', $project->id);
$translation = GP::$translation->get(gp_post('translation_id'));
if (!$translation) {
$this->die_with_error('Translation doesn’t exist!');
}
if (!isset($translation->warnings[gp_post('index')][gp_post('key')])) {
$this->die_with_error('The warning doesn’exist!');
}
unset($translation->warnings[gp_post('index')][gp_post('key')]);
if (empty($translation->warnings[gp_post('index')])) {
unset($translation->warnings[gp_post('index')]);
}
$res = $translation->save();
if (!$res) {
$this->die_with_error('Error in saving the translation!');
}
$translations = GP::$translation->for_translation($project, $translation_set, 'no-limit', array('translation_id' => gp_post('translation_id')), array());
if ($translations) {
$t = $translations[0];
$parity = returner('even');
$can_edit = GP::$user->logged_in();
$can_approve = $this->can('approve', 'translation-set', $translation_set->id);
gp_tmpl_load('translation-row', get_defined_vars());
} else {
$this->die_with_error('Error in retrieving translation!');
}
}
示例10: __
$errors[] = __('Please specify a password.');
} elseif ($admin_password != $admin_password_check) {
$errors[] = __('Your passwords do not match. Please try again.');
} else {
if (empty($admin_email)) {
$errors[] = __('You must provide an email address.');
} elseif (!is_email($admin_email)) {
$errors[] = __('You have an invalid email Address.');
}
}
if (!$errors) {
$errors = gp_install();
$success_message = __('GlotPress was successully installed!');
$success_message .= ' <a href="' . gp_url_login() . '">' . __('Log in') . '</a>';
if (!$errors) {
gp_create_initial_contents($user_name, $admin_password, $admin_email);
}
$show_htaccess_instructions = !gp_set_htaccess() && empty($errors);
$action = 'installed';
} else {
$action = 'install';
}
} else {
$action = 'install';
$user_name = $admin_email = '';
}
}
}
}
gp_tmpl_load('install', get_defined_vars());