function gp_nav_menu_items($location = 'main') { $items = array(); if ('main' === $location) { $items[gp_url('/projects')] = __('Projects'); $items[gp_url('/languages')] = __('Locales'); } elseif ('side' === $location) { if (GP::$user->logged_in()) { $user = GP::$user->current(); $items[gp_url('/profile')] = __('Profile'); $items[gp_url('/logout')] = __('Log out'); } else { $items[gp_url_login()] = __('Log in'); } } return apply_filters('gp_nav_menu_items', $items, $location); }
function login_post() { global $wp_users_object, $wp_auth_object; $user = GP::$user->by_login($_POST['user_login']); if (!$user || is_wp_error($user)) { $this->errors[] = __("Invalid username!"); $this->redirect(gp_url_login()); return; } if ($user->login(gp_post('user_pass'))) { if (gp_post('redirect_to')) { $this->redirect(gp_post('redirect_to')); } else { $this->notices[] = sprintf(__("Welcome, %s!"), $_POST['user_login']); $this->redirect(gp_url_public_root()); } } else { $this->errors[] = __("Invalid password!"); $this->redirect(gp_url_login()); } }
echo '</a></li>'; ?> <li><a href="<?php echo gp_url('/logout'); ?> "><?php _e('Log out'); ?> </a></li> <?php } else { ?> <li><a href="<?php echo gp_url_login(); ?> "><?php _e('Log in'); ?> </a></li> <?php } ?> <?php do_action('after_hello'); ?> </ul> </nav> </div>
" /> </a> <?php echo gp_breadcrumb(); ?> <span id="hello"> <?php if (GP::$user->logged_in()) { $user = GP::$user->current(); printf(__('Hi, %s.'), '<a href="' . gp_url('/profile') . '">' . $user->user_login . '</a>'); $logout_string = '<a href="' . gp_url('/logout') . '">' . __('Log out') . '</a>'; echo apply_filters('gp_logout_link', $logout_string); ?> <?php } elseif (!GP_INSTALLING) { $login_string = '<strong><a href="' . gp_url_login() . '">' . __('Log in') . '</a></strong>'; echo apply_filters('gp_login_link', $login_string); } ?> <?php do_action('after_hello'); ?> </span> <div class="clearfix"></div> </h1> <div class="clear after-h1"></div> <?php if (gp_notice('error')) { ?> <div class="error"> <?php
?> <span class="context bubble" title="<?php printf(__('Context: %s'), esc_html($t->context)); ?> "><?php echo esc_html($t->context); ?> </span> <?php } ?> </td> <td class="translation foreign-text"> <?php $edit_text = $can_edit ? __('Double-click to add') : sprintf(__('You <a href="%s">have to login</a> to add a translation.'), gp_url_login()); $missing_text = "<span class='missing'>{$edit_text}</span>"; if (!count(array_filter($t->translations, 'gp_is_not_empty_string'))) { echo $missing_text; } elseif (!$t->plural) { echo esc_translation($t->translations[0]); } else { ?> <ul> <?php foreach ($t->translations as $translation) { ?> <li><?php echo gp_is_empty_string($translation) ? $missing_text : esc_translation($translation); ?> </li>
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 }
function textareas($entry, $can_edit, $index = 0) { $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"> <strong>Warning:</strong> <?php echo esc_html($warning['value']); ?> <?php if (GP::$user->current()->admin()) { // TODO: allow users with write permissions, too ?> <a href="#" class="discard-warning" key="<?php echo $warning['key']; ?> " index="<?php echo $index; ?> ">Discard</a> <?php } ?> </div> <?php } ?> <textarea name="translation[<?php echo $entry->original_id; ?> ][]" <?php echo $disabled; ?> ><?php echo esc_translation(gp_array_get($entry->translations, $index)); ?> </textarea> <?php if ($can_edit) { ?> <p> <a href="#" class="copy" tabindex="-1">Copy from original</a> </p> <?php } else { ?> <p> You <a href="<?php echo gp_url_login(); ?> ">have to log in</a> to edit this translation. </p> <?php } ?> </div> <?php }
$errors[] = __('The username you provided has invalid characters.'); } elseif (empty($admin_password)) { $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 = ''; } } } }
echo esc_html($t->context); ?> </span> <?php } ?> </td> <td class="translation foreign-text"> <?php if ($can_edit) { $edit_text = __('Double-click to add'); } elseif (GP::$user->logged_in()) { $edit_text = __('You are not allowed to add a translation.'); } else { $edit_text = sprintf(__('You <a href="%s">have to login</a> to add a translation.'), gp_url_login()); } $missing_text = "<span class='missing'>{$edit_text}</span>"; if (!count(array_filter($t->translations, 'gp_is_not_empty_string'))) { echo $missing_text; } elseif (!$t->plural) { echo esc_translation($t->translations[0]); } else { ?> <ul> <?php foreach ($t->translations as $translation) { ?> <li><?php echo gp_is_empty_string($translation) ? $missing_text : esc_translation($translation); ?>
?> <span class="context" title="<?php printf(__('Context: %s'), esc_html($t->context)); ?> "><?php echo esc_html($t->context); ?> </span> <?php } ?> </td> <td class="translation"> <?php $edit_text = $can_edit ? 'Double-click to add' : 'You <a href="' . gp_url_login() . '">have to login</a> to add a translation.'; $missing_text = "<span class='missing'>{$edit_text}</span>"; if (!count(array_filter($t->translations))) { echo $missing_text; } elseif (!$t->plural) { echo esc_translation($t->translations[0]); } else { ?> <ul> <?php foreach ($t->translations as $translation) { ?> <li><?php echo $translation ? esc_translation($translation) : $missing_text;