本文整理汇总了PHP中gp_array_get函数的典型用法代码示例。如果您正苦于以下问题:PHP gp_array_get函数的具体用法?PHP gp_array_get怎么用?PHP gp_array_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gp_array_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __invoke
/**
* Import originals for a project from a file
*
* ## OPTIONS
*
* <project>
* : Project name
*
* <file>
* : File to import from
*
* [--format=<format>]
* : Accepted values: po, mo, android, resx, strings. Default: po
*/
public function __invoke($args, $assoc_args)
{
// Double-check for compatibility
if ($args[0] === '-p' || $args[1] === '-f') {
WP_CLI::error(__('-p and -f are no longer required and should be removed.', 'glotpress'));
}
$project = GP::$project->by_path($args[0]);
if (!$project) {
WP_CLI::error(__('Project not found!', 'glotpress'));
}
$format = isset($assoc_args['format']) ? $assoc_args['format'] : 'po';
$format = gp_array_get(GP::$formats, $format, null);
if (!$format) {
WP_CLI::error(__('No such format.', 'glotpress'));
}
$translations = $format->read_originals_from_file($args[1], $project);
if (!$translations) {
WP_CLI::error(__("Couldn't load translations from file!", 'glotpress'));
}
list($originals_added, $originals_existing, $originals_fuzzied, $originals_obsoleted, $originals_error) = GP::$original->import_for_project($project, $translations);
$notice = sprintf(__('%1$s new strings added, %2$s updated, %3$s fuzzied, and %4$s obsoleted.', 'glotpress'), $originals_added, $originals_existing, $originals_fuzzied, $originals_obsoleted);
if ($originals_error) {
$notice = ' ' . sprintf(_n('%s new string was not imported due to an error.', '%s new strings were not imported due to an error.', $originals_error, 'glotpress'), $originals_error);
}
WP_CLI::line($notice);
}
开发者ID:ramiy,项目名称:GlotPress-WP,代码行数:40,代码来源:import-originals.php
示例2: export
/**
* Export the translation set
*
* ## OPTIONS
*
* <project>
* : Project path
*
* <locale>
* : Locale to export
*
* [--set=<set>]
* : Translation set slug; default is "default"
*
* [--format=<format>]
* : Format for output (one of "po", "mo", "android", "resx", "strings"; default is "po")
*
* [--search=<search>]
* : Search term
*
* [--status=<status>]
* : Translation string status; default is "current"
*
* [--priority=<priorities>]
* : Original priorities, comma separated. Possible values are "hidden,low,normal,high"
*/
public function export($args, $assoc_args)
{
$set_slug = isset($assoc_args['set']) ? $assoc_args['set'] : 'default';
$translation_set = $this->get_translation_set($args[0], $args[1], $set_slug);
if (is_wp_error($translation_set)) {
WP_CLI::error($translation_set->get_error_message());
}
$format = isset($assoc_args['format']) ? $assoc_args['format'] : 'po';
$format = gp_array_get(GP::$formats, $format, null);
if (!$format) {
WP_CLI::error(__('No such format.', 'glotpress'));
}
$filters = array();
if (isset($assoc_args['search'])) {
$filters['term'] = $assoc_args['search'];
}
$filters['status'] = isset($assoc_args['status']) ? $assoc_args['status'] : 'current';
if (isset($assoc_args['priority'])) {
$filters['priority'] = array();
$priorities = explode(',', $assoc_args['priority']);
$valid_priorities = GP::$original->get_static('priorities');
foreach ($priorities as $priority) {
$key = array_search($priority, $valid_priorities);
if (false === $key) {
WP_CLI::warning(sprintf('Invalid priority %s', $priority));
} else {
$filters['priority'][] = $key;
}
}
}
$entries = GP::$translation->for_export($this->project, $translation_set, $filters);
WP_CLI::line($format->print_exported_file($this->project, $this->locale, $translation_set, $entries));
}
开发者ID:ramiy,项目名称:GlotPress-WP,代码行数:59,代码来源:translation-set.php
示例3: _options_from_projects
function _options_from_projects($projects)
{
// TODO: mark which nodes are editable by the current user
$tree = array();
$top = array();
foreach ($projects as $p) {
$tree[$p->id]['self'] = $p;
if ($p->parent_project_id) {
$tree[$p->parent_project_id]['children'][] = $p->id;
} else {
$top[] = $p->id;
}
}
$options = array('' => __('No parent'));
$stack = array();
foreach ($top as $top_id) {
$stack = array($top_id);
while (!empty($stack)) {
$id = array_pop($stack);
$tree[$id]['level'] = gp_array_get($tree[$id], 'level', 0);
$options[$id] = str_repeat('-', $tree[$id]['level']) . $tree[$id]['self']->name;
foreach (gp_array_get($tree[$id], 'children', array()) as $child_id) {
$stack[] = $child_id;
$tree[$child_id]['level'] = $tree[$id]['level'] + 1;
}
}
}
return $options;
}
开发者ID:rmccue,项目名称:GlotPress,代码行数:29,代码来源:_main.php
示例4: run
function run()
{
if (!isset($this->options['p'])) {
$this->usage();
}
$project = GP::$project->by_path($this->options['p']);
if (!$project) {
$this->error(__('Project not found!'));
}
$format = gp_array_get(GP::$formats, isset($this->options['o']) ? $this->options['o'] : 'po', null);
if (!$format) {
$this->error(__('No such format.'));
}
$translations = $format->read_originals_from_file($this->options['f'], $project);
if (!$translations) {
$this->error(__("Couldn't load translations from file!"));
}
$disable_propagating = isset($this->options['disable-propagating']);
$disable_matching = isset($this->options['disable-matching']);
if ($disable_propagating) {
add_filter('enable_propagate_translations_across_projects', '__return_false');
}
if ($disable_matching) {
add_filter('enable_add_translations_from_other_projects', '__return_false');
}
list($originals_added, $originals_existing, $originals_fuzzied, $originals_obsoleted) = GP::$original->import_for_project($project, $translations);
if ($disable_matching) {
remove_filter('enable_add_translations_from_other_projects', '__return_false');
}
if ($disable_propagating) {
remove_filter('enable_propagate_translations_across_projects', '__return_false');
}
printf(__('%1$s new strings added, %2$s updated, %3$s fuzzied, and %4$s obsoleted.'), $originals_added, $originals_existing, $originals_fuzzied, $originals_obsoleted);
echo "\n";
}
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:35,代码来源:import-originals.php
示例5: gp_url_current
function gp_url_current()
{
// TODO: https
// TODO: port
$host = gp_array_get($_SERVER, 'HTTP_HOST');
$path_and_args = gp_array_get($_SERVER, 'REQUEST_URI');
return "http://{$host}{$path_and_args}";
}
开发者ID:rmccue,项目名称:GlotPress,代码行数:8,代码来源:url.php
示例6: action_on_translation_set
function action_on_translation_set($translation_set)
{
$format = gp_array_get(GP::$formats, isset($this->options['o']) ? $this->options['o'] : 'po', null);
if (!$format) {
$this->error(__('No such format.'));
}
$entries = GP::$translation->for_export($this->project, $translation_set, $this->get_filters_for_translation());
echo $format->print_exported_file($this->project, $this->locale, $translation_set, $entries) . "\n";
}
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:9,代码来源:export.php
示例7: guess_uri
/**
* Guesses the final installed URI based on the location of the install script
*
* @return string The guessed URI
*/
function guess_uri()
{
$schema = 'http://';
if (strtolower(gp_array_get($_SERVER, 'HTTPS')) == 'on') {
$schema = 'https://';
}
$uri = preg_replace('|/[^/]*$|i', '/', $schema . gp_array_get($_SERVER, 'HTTP_HOST') . gp_array_get($_SERVER, 'REQUEST_URI'));
return rtrim($uri, " \t\n\r\v/") . '/';
}
开发者ID:rmccue,项目名称:GlotPress,代码行数:14,代码来源:install-upgrade.php
示例8: prepare_fields_for_save
function prepare_fields_for_save($args)
{
$args = (array) $args;
$args['object_type'] = $this->object_type;
if (gp_array_get($args, 'project_id') && gp_array_get($args, 'locale_slug') && gp_array_get($args, 'set_slug') && !gp_array_get($args, 'object_id')) {
$args['object_id'] = $this->object_id($args['project_id'], $args['locale_slug'], $args['set_slug']);
}
$args = parent::prepare_fields_for_save($args);
return $args;
}
开发者ID:akirk,项目名称:GlotPress,代码行数:10,代码来源:validator-permission.php
示例9: can_user
function can_user($verdict, $args)
{
if (!($verdict === false && $args['action'] == 'approve' && $args['object_type'] == GP::$validator_permission->object_type && $args['object_id'] && $args['user'])) {
return $verdict;
}
list($project_id, $locale_slug, $set_slug) = GP::$validator_permission->project_id_locale_slug_set_slug($args['object_id']);
if (!gp_array_get($this->permissions_map, $project_id)) {
return $verdict;
}
return $args['user']->can('approve', $args['object_type'], GP::$validator_permission->object_id(gp_array_get($this->permissions_map, $project_id), $locale_slug, $set_slug));
}
开发者ID:serhi,项目名称:wordpress-sites,代码行数:11,代码来源:common-permissions.php
示例10: export
/**
* Export the translation set
*
* ## OPTIONS
*
* <project>
* : Project path
*
* <locale>
* : Locale to export
*
* [--set=<set>]
* : Translation set slug; default is "default"
*
* [--format=<format>]
* : Format for output (one of "po", "mo", "android", "resx", "strings"; default is "po")
*
* [--search=<search>]
* : Search term
*
* [--status=<status>]
* : Translation string status; default is "current"
*/
public function export($args, $assoc_args)
{
$set_slug = isset($assoc_args['set']) ? $assoc_args['set'] : 'default';
$translation_set = $this->get_translation_set($args[0], $args[1], $set_slug);
if (is_wp_error($translation_set)) {
WP_CLI::error($translation_set->get_error_message());
}
$format = isset($assoc_args['format']) ? $assoc_args['format'] : 'po';
$format = gp_array_get(GP::$formats, $format, null);
if (!$format) {
WP_CLI::error(__('No such format.', 'glotpress'));
}
$filters = array();
if (isset($assoc_args['search'])) {
$filters['term'] = $assoc_args['search'];
}
$assoc_args['status'] = isset($assoc_args['status']) ? $assoc_args['status'] : 'current';
$entries = GP::$translation->for_export($this->project, $translation_set, $filters);
WP_CLI::line($format->print_exported_file($this->project, $this->locale, $translation_set, $entries));
}
开发者ID:akirk,项目名称:GlotPress,代码行数:43,代码来源:translation-set.php
示例11: run
public function run()
{
if (!isset($this->options['l']) || !isset($this->options['p'])) {
$this->usage();
}
$this->project = GP::$project->by_path($this->options['p']);
if (!$this->project) {
$this->error(__('Project not found!', 'glotpress'));
}
$this->locale = GP_Locales::by_slug($this->options['l']);
if (!$this->locale) {
$this->error(__('Locale not found!', 'glotpress'));
}
$this->options['t'] = gp_array_get($this->options, 't', 'default');
$this->translation_set = GP::$translation_set->by_project_id_slug_and_locale($this->project->id, $this->options['t'], $this->locale->slug);
if (!$this->translation_set) {
$this->error(__('Translation set not found!', 'glotpress'));
}
$this->action_on_translation_set($this->translation_set);
}
开发者ID:ramiy,项目名称:GlotPress-WP,代码行数:20,代码来源:cli.php
示例12: __invoke
/**
* Import originals for a project from a file
*
* ## OPTIONS
*
* <project>
* : Project name
*
* <file>
* : File to import from
*
* [--format=<format>]
* : Accepted values: po, mo, android, resx, strings. Default: po
*
* [--disable-propagating]
* : If set, propagation will be disabled.
*
* [--disable-matching]
* : If set, matching will be disabled.
*/
public function __invoke($args, $assoc_args)
{
// Double-check for compatibility
if ($args[0] === '-p' || $args[1] === '-f') {
WP_CLI::error(__('-p and -f are no longer required and should be removed.', 'glotpress'));
}
$project = GP::$project->by_path($args[0]);
if (!$project) {
WP_CLI::error(__('Project not found!', 'glotpress'));
}
$format = isset($assoc_args['format']) ? $assoc_args['format'] : 'po';
$format = gp_array_get(GP::$formats, $format, null);
if (!$format) {
WP_CLI::error(__('No such format.', 'glotpress'));
}
$translations = $format->read_originals_from_file($args[1], $project);
if (!$translations) {
WP_CLI::error(__("Couldn't load translations from file!", 'glotpress'));
}
$disable_propagating = isset($assoc_args['disable-propagating']);
$disable_matching = isset($assoc_args['disable-matching']);
if ($disable_propagating) {
add_filter('gp_enable_propagate_translations_across_projects', '__return_false');
}
if ($disable_matching) {
add_filter('gp_enable_add_translations_from_other_projects', '__return_false');
}
list($originals_added, $originals_existing, $originals_fuzzied, $originals_obsoleted) = GP::$original->import_for_project($project, $translations);
if ($disable_matching) {
remove_filter('gp_enable_add_translations_from_other_projects', '__return_false');
}
if ($disable_propagating) {
remove_filter('gp_enable_propagate_translations_across_projects', '__return_false');
}
WP_CLI::line(sprintf(__('%1$s new strings added, %2$s updated, %3$s fuzzied, and %4$s obsoleted.', 'glotpress'), $originals_added, $originals_existing, $originals_fuzzied, $originals_obsoleted));
}
开发者ID:akirk,项目名称:GlotPress,代码行数:56,代码来源:import-originals.php
示例13: translations_get
function translations_get($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();
}
$page = gp_get('page', 1);
$filters = gp_get('filters', array());
$sort = gp_get('sort', array());
if ('random' == gp_array_get($sort, 'by')) {
add_filter('gp_pagination', create_function('$html', 'return "";'));
}
$translations = GP::$translation->for_translation($project, $translation_set, $page, $filters, $sort);
$total_translations_count = GP::$translation->found_rows;
$per_page = GP::$translation->per_page;
$can_edit = GP::$user->logged_in();
$can_approve = $this->can('approve', 'translation-set', $translation_set->id);
$url = gp_url_project($project, gp_url_join($locale->slug, $translation_set->slug));
$discard_warning_url = gp_url_project($project, gp_url_join($locale->slug, $translation_set->slug, '_discard-warning'));
$approve_action = gp_url_join($url, '_approve');
gp_tmpl_load('translations', get_defined_vars());
}
开发者ID:rmccue,项目名称:GlotPress,代码行数:24,代码来源:translation.php
示例14: _bulk_set_priority
function _bulk_set_priority($project, $locale, $translation_set, $bulk)
{
if ($this->cannot_and_redirect('write', 'project', $project->id)) {
return;
}
$ok = $error = 0;
foreach ($bulk['row-ids'] as $row_id) {
$original_id = gp_array_get(explode('-', $row_id), 0);
$original = GP::$original->get($original_id);
if (!$original) {
continue;
}
$original->priority = $bulk['priority'];
if (!$original->validate()) {
return $this->die_with_error('Invalid priority value!');
}
if (!$original->save()) {
$error++;
} else {
$ok++;
}
}
if (0 === $error) {
$this->notices[] = sprintf(_n('Priority of %d original was modified.', 'Priority of %d originals were modified.', $ok, 'glotpress'), $ok);
} else {
if ($ok > 0) {
$message = sprintf(_n('Error modifying priority of %d original.', 'Error modifying priority of %d originals.', $error, 'glotpress'), $error);
$message .= sprintf(_n('The remaining %d original was modified successfully.', 'The remaining %d originals were modified successfully.', $ok, 'glotpress'), $ok);
$this->errors[] = $message;
} else {
$this->errors[] = sprintf(_n('Error modifying priority of %d original.', 'Error modifying priority of all %d originals.', $error, 'glotpress'), $error);
}
}
}
开发者ID:akirk,项目名称:GlotPress,代码行数:34,代码来源:translation.php
示例15: gp_url_current
/**
* The URL of the current page
*/
function gp_url_current()
{
$protocol = is_ssl() ? 'https://' : 'http://';
$host = gp_array_get($_SERVER, 'HTTP_HOST');
$path_and_args = gp_array_get($_SERVER, 'REQUEST_URI');
return $protocol . $host . $path_and_args;
}
开发者ID:johnjamesjacoby,项目名称:GlotPress-WP,代码行数:10,代码来源:url.php
示例16: _e
</tr>
<tr>
<th><label for="default_sort[by]"><?php
_e("Default Sort By:");
?>
</label></th>
<td><?php
echo gp_radio_buttons('default_sort[by]', array('original_date_added' => __('Date added (original)'), 'translation_date_added' => __('Date added (translation)'), 'original' => __('Original string'), 'translation' => __('Translation'), 'priority' => __('Priority'), 'references' => __('Filename in source'), 'random' => __('Random')), gp_array_get($default_sort, 'by', 'priority'));
?>
</td>
</tr>
<tr>
<th><label for="default_sort[how]"><?php
_e("Default Sort Order:");
?>
</label></th>
<td><?php
echo gp_radio_buttons('default_sort[how]', array('asc' => __('Ascending'), 'desc' => __('Descending')), gp_array_get($default_sort, 'how', 'desc'));
?>
</td>
</tr>
</table>
<br>
<input type="submit" name="submit" value="<?php
esc_attr_e("Change Settings");
?>
">
</form>
<?php
gp_tmpl_footer();
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:31,代码来源:profile.php
示例17: for_translation
function for_translation($project, $translation_set, $page, $filters = array(), $sort = array())
{
global $gpdb;
$locale = GP_Locales::by_slug($translation_set->locale);
$join_type = 'INNER';
$sort_bys = array('original' => 'o.singular %s', 'translation' => 't.translation_0 %s', 'priority' => 'o.priority %s, o.date_added DESC', 'random' => 'o.priority DESC, RAND()', 'translation_date_added' => 't.date_added %s', 'original_date_added' => 'o.date_added %s', 'references' => 'o.references');
$default_sort = GP::$user->current()->sort_defaults();
$sort_by = gp_array_get($sort_bys, gp_array_get($sort, 'by'), gp_array_get($sort_bys, $default_sort['by']));
$sort_hows = array('asc' => 'ASC', 'desc' => 'DESC');
$sort_how = gp_array_get($sort_hows, gp_array_get($sort, 'how'), gp_array_get($sort_hows, $default_sort['how']));
$where = array();
if (gp_array_get($filters, 'term')) {
$like = "LIKE '%" . $gpdb->escape(like_escape(gp_array_get($filters, 'term'))) . "%'";
$where[] = '(' . implode(' OR ', array_map(function ($x) use($like) {
return "({$x} {$like})";
}, array('o.singular', 't.translation_0', 'o.plural', 't.translation_1', 'o.context', 'o.references'))) . ')';
}
if (gp_array_get($filters, 'before_date_added')) {
$where[] = $gpdb->prepare('t.date_added > %s', gp_array_get($filters, 'before_date_added'));
}
if (gp_array_get($filters, 'translation_id')) {
$where[] = $gpdb->prepare('t.id = %d', gp_array_get($filters, 'translation_id'));
}
if (gp_array_get($filters, 'original_id')) {
$where[] = $gpdb->prepare('o.id = %d', gp_array_get($filters, 'original_id'));
}
if ('yes' == gp_array_get($filters, 'warnings')) {
$where[] = 't.warnings IS NOT NULL';
$where[] = 't.warnings != ""';
} elseif ('no' == gp_array_get($filters, 'warnings')) {
$where[] = 't.warnings IS NULL';
}
if ('yes' == gp_array_get($filters, 'with_context')) {
$where[] = 'o.context IS NOT NULL';
}
if ('yes' == gp_array_get($filters, 'with_comment')) {
$where[] = 'o.comment IS NOT NULL AND o.comment <> ""';
}
if (gp_array_get($filters, 'user_login')) {
$user = GP::$user->by_login($filters['user_login']);
// do not return any entries if the user doesn't exist
$where[] = $gpdb->prepare('t.user_id = %d', $user && $user->id ? $user->id : -1);
}
if (!GP::$user->current()->can('write', 'project', $project->id)) {
$where[] = 'o.priority > -2';
}
$join_where = array();
$status = gp_array_get($filters, 'status', 'current_or_waiting_or_fuzzy_or_untranslated');
$statuses = explode('_or_', $status);
if (in_array('untranslated', $statuses)) {
if ($statuses == array('untranslated')) {
$where[] = 't.translation_0 IS NULL';
}
$join_type = 'LEFT';
$join_where[] = 't.status != "rejected"';
$join_where[] = 't.status != "old"';
$statuses = array_filter($statuses, function ($x) {
return $x != 'untranslated';
});
}
$all_statuses = $this->get_static('statuses');
$statuses = array_filter($statuses, function ($s) use($all_statuses) {
return in_array($s, $all_statuses);
});
if ($statuses) {
$statuses_where = array();
foreach ($statuses as $single_status) {
$statuses_where[] = $gpdb->prepare('t.status = %s', $single_status);
}
$statuses_where = '(' . implode(' OR ', $statuses_where) . ')';
$join_where[] = $statuses_where;
}
$where = apply_filters('for_translation_where', $where, $translation_set);
$where = implode(' AND ', $where);
if ($where) {
$where = 'AND ' . $where;
}
$join_where = implode(' AND ', $join_where);
if ($join_where) {
$join_where = 'AND ' . $join_where;
}
$sql_sort = sprintf($sort_by, $sort_how);
$limit = $this->sql_limit_for_paging($page, $this->per_page);
$sql_for_translations = "\n\t\t\tSELECT SQL_CALC_FOUND_ROWS t.*, o.*, t.id as id, o.id as original_id, t.status as translation_status, o.status as original_status, t.date_added as translation_added, o.date_added as original_added\n\t\t\tFROM {$gpdb->originals} as o\n\t\t\t{$join_type} JOIN {$gpdb->translations} AS t ON o.id = t.original_id AND t.translation_set_id = " . $gpdb->escape($translation_set->id) . " {$join_where}\n\t\t\tWHERE o.project_id = " . $gpdb->escape($project->id) . " AND o.status LIKE '+%' {$where} ORDER BY {$sql_sort} {$limit}";
$rows = $this->many_no_map($sql_for_translations);
$this->found_rows = $this->found_rows();
$translations = array();
foreach ((array) $rows as $row) {
if ($row->user_id && $this->per_page != 'no-limit') {
$user = GP::$user->get($row->user_id);
if ($user) {
$row->user_login = $user->user_login;
$row->user_display_name = $user->display_name;
$row->user_nicename = $user->user_nicename;
}
} else {
$row->user_login = $row->user_display_name = $row->user_nicename = '';
}
$row->translations = array();
for ($i = 0; $i < $locale->nplurals; $i++) {
//.........这里部分代码省略.........
开发者ID:rmccue,项目名称:glotpress-plugin,代码行数:101,代码来源:translation.php
示例18: array
</label>
<div class="col-sm-8">
<?php
echo GP_Bootstrap_Theme_Hacks::gp_radio_buttons('default_sort[by]', array('original_date_added' => __('Date added (original)'), 'translation_date_added' => __('Date added (translation)'), 'original' => __('Original string'), 'translation' => __('Translation'), 'priority' => __('Priority'), 'references' => __('Filename in source'), 'random' => __('Random')), gp_array_get($default_sort, 'by', 'priority'));
?>
</div>
</div>
<div class="form-group">
<label for="default_sort[how]" class="col-sm-4 col-md-3 control-label"><?php
_e("Default Sort Order:");
?>
</label>
<div class="col-sm-8">
<?php
echo GP_Bootstrap_Theme_Hacks::gp_radio_buttons('default_sort[how]', array('asc' => __('Ascending'), 'desc' => __('Descending')), gp_array_get($default_sort, 'how', 'desc'));
?>
</div>
</div>
<div class="form-group">
<label for="default_theme" class="col-sm-4 col-md-3 control-label"><?php
_e("Theme:");
?>
</label>
<div class="col-sm-4">
<?php
$default_theme = 'default' == GP::$user->current()->get_meta('default_theme') ? 'default' : 'bootstrap';
echo gp_select('default_theme', array('default' => __('Default theme'), 'bootstrap' => __('Bootstrap theme')), $default_theme, array('class' => 'form-control'));
?>
开发者ID:WeFoster,项目名称:translate.wefoster.co,代码行数:31,代码来源:profile.php
示例19: textareas
function textareas($entry, $permissions, $index = 0)
{
list($can_edit, $can_approve) = $permissions;
$disabled = $can_edit ? '' : 'disabled="disabled"';
?>
<div class="textareas">
<?php
if (isset($entry->warnings[$index])) {
$referenceable = $entry->warnings[$index];
$warning = each($referenceable);
?>
<div class="warning secondary">
<?php
printf(__('<strong>Warning:</strong> %s'), esc_html($warning['value']));
?>
<?php
if ($can_approve) {
?>
<a href="#" class="discard-warning" key="<?php
echo $warning['key'];
?>
" index="<?php
echo $index;
?>
"><?php
_e('Discard');
?>
</a>
<?php
}
?>
</div>
<?php
}
?>
<blockquote><em><small><?php
echo esc_translation(gp_array_get($entry->translations, $index));
?>
</small></em></blockquote>
<textarea class="foreign-text" name="translation[<?php
echo $entry->original_id;
?>
][]" <?php
echo $disabled;
?>
><?php
echo esc_translation(gp_array_get($entry->translations, $index));
?>
</textarea>
<p>
<?php
if ($can_edit) {
gp_entry_actions();
} elseif (GP::$user->logged_in()) {
_e('You are not allowed to edit this translation.');
} else {
printf(__('You <a href="%s">have to log in</a> to edit this translation.'), gp_url_login());
}
?>
</p>
</div>
<?php
}
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:66,代码来源:helper-functions.php
示例20: get_user_option
<dd>
<?php
$default_sort = get_user_option('gp_default_sort');
if (!is_array($default_sort)) {
$default_sort = array('by' => 'priority', 'how' => 'desc');
}
echo gp_radio_buttons('sort[by]', array('original_date_added' => __('Date added (original)', 'glotpress'), 'translation_date_added' => __('Date added (translation)', 'glotpress'), 'original' => __('Original string', 'glotpress'), 'translation' => __('Translation', 'glotpress'), 'priority' => __('Priority', 'glotpress'), 'references' => __('Filename in source', 'glotpress'), 'random' => __('Random', 'glotpress')), gp_array_get($sort, 'by', $default_sort['by']));
?>
</dd>
<dt><?php
_e('Order:', 'glotpress');
?>
</dt>
<dd>
<?php
echo gp_radio_buttons('sort[how]', array('asc' => __('Ascending', 'glotpress'), 'desc' => __('Descending', 'glotpress')), gp_array_get($sort, 'how', $default_sort['how']));
?>
</dd>
<?php
do_action('gp_translation_set_filters');
?>
<dd><input type="submit" value="<?php
esc_attr_e('Sort', 'glotpress');
?>
" name="sorts" /></dd>
</dl>
</form>
<table id="translations" class="translations clear<?php
if ('rtl' == $locale->text_direction) {
echo ' translation-sets-rtl';
开发者ID:akirk,项目名称:GlotPress,代码行数:31,代码来源:translations.php
注:本文中的gp_array_get函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论