/** * Register Nav Menus. * * @see http://codex.wordpress.org/Navigation_Menus */ public static function registerNavMenus() { add_action('init', function () { foreach (Menu::getMenusActive() as $menu) { $menus[$menu] = I18n::transu($menu); } register_nav_menus($menus); }); }
/** * * @param string $user_ID */ public function getRenderLanguage($user_ID = false) { if (!$user_ID) { global $user_ID; } $user = User::find($user_ID); // Format the list $userLang = $user->getLang(); foreach (I18n::getAllLangAvailable() as $t) { $languages[] = ['value' => $t, 'text' => I18n::transu('lang_' . $t), 'selected' => $userLang == $t]; } $args = ['user' => $user, 'KEY_LANGUAGE' => User::KEY_LANGUAGE, 'languages' => $languages]; return $this->render('backend/user/_lang', $args); }
/** * tag.php */ public function getTag() { $tag = get_queried_object(); $args = ['postsWhereKey' => Ajax::TAG, 'postsWhereValue' => $tag->term_id, 'thingType' => I18n::transu('tag'), 'thingToSearch' => $tag->name, 'posts' => Post::getByTag($tag->term_id)]; return $this->renderPage('base/search', $args); }
/** * Return the form for comments * * @return string */ public function getFormComments() { ob_start(); $placeTextarea = I18n::transu('post.share_comment'); $params = ['comment_notes_after' => '', 'author' => '<p class="comment-form-author">' . '<label for="author">' . __('Your Name') . '</label> <input id="author" name="author" type="text" value="Your First and Last Name" size="30" /></p>', 'comment_field' => ' <div class="form-group comment-form-comment"> <label for="comment">' . _x('Comment', 'noun') . '</label> <textarea class="form-control" id="comment" name="comment" cols="45" rows="2" maxlength="1000" aria-required="true" placeholder="' . $placeTextarea . '"></textarea> </div>']; $placeAuthor = I18n::transu('name'); $placeEmail = I18n::transu('email'); $placeUrl = I18n::transu('website'); comment_form($params, $this->ID); $comment_form = ob_get_clean(); $comment_form = str_replace('id="author"', 'class="author form-control" placeholder="' . $placeAuthor . '"', $comment_form); $comment_form = str_replace('id="email"', 'class="email form-control" placeholder="' . $placeEmail . '"', $comment_form); $comment_form = str_replace('id="url"', 'class="url form-control" placeholder="' . $placeUrl . '"', $comment_form); $comment_form = str_replace('id="submit"', 'class="btn btn-default"', $comment_form); return $comment_form; }
* file that was distributed with this source code. */ namespace Config; use Knob\I18n\I18n; /** * ============================ * Your Mustache helpers * ============================ * * @see knob-base/src/config/mustache_helpers.php -> Parent file * * ---------------------------- * For example: * ---------------------------- * $lower_text = 'lower text to upper'; // var from PHP code * * {{#case.upper}} lower_text {{/case.upper}} -> LOWER TEXT TO UPPER * Or * {{ lower_text | case.upper}} -> LOWER TEXT TO UPPER * * * @link https://github.com/bobthecow/mustache.php#usage * @link https://github.com/bobthecow/mustache.php/wiki/FILTERS-pragma * */ return ['trans' => function ($value) { return I18n::trans($value); }, 'transu' => function ($value) { return I18n::transu($value); }];