protected function getContent() { $content = '<ol class="breadcrumb"> <li><a href="' . ROOT_DIR . 'admin/courseadmin">' . I18n::t('courseoverview.title') . '</a></li> <li><a href="' . ROOT_DIR . 'admin/lessonadmin/' . $this->course->getId() . '">' . $this->course->getName(I18n::getLang()) . '</a></li> <li class="active">' . $this->lesson->getName(I18n::getLang()) . '</li> </ol>'; $content .= '<form method="post"><input type="hidden" name="action" value="saveExercises" /> <table id="exercise-admin-table" class="table table-hover"> <thead> <tr> <th>' . I18n::t('admin.exerciseadmin.question') . '</th> <th>' . I18n::t('admin.exerciseadmin.answer') . ' (EN)</th> <th>' . I18n::t('admin.exerciseadmin.answer') . ' (DE)</th> <th> </th> </tr> </thead> <tbody>'; foreach ((array) Exercise::getMultipleExercises($this->lesson->getId(), 50, 0) as $exercise) { $content .= '<tr><input type="hidden" name="exercise_id[]" value="' . $exercise->getId() . '" /> <td><input type="text" name="question[]" value="' . $exercise->getQuestion() . '" /></td> <td><input type="text" name="answer_en[]" value="' . $exercise->getAnswer('en') . '" /></td> <td><input type="text" name="answer_de[]" value="' . $exercise->getAnswer('de') . '" /></td> </tr>'; } $content .= '</tbody> </table> <table width="100%"> <tr><td width="50%" align="left"><button id="exercise-add-btn" class="btn btn-default" type="button">' . I18n::t('button.add') . '</button></td> <td width="50%" align="right"><input type="submit" class="btn btn-default" value="' . I18n::t('button.save') . '" /></td></tr> </table> </form>'; return $content; }
public function Index() { if ($this->request->isPost()) { if (Config::$authentication['authentication']) { $server = isset(Config::$server['server']) && !empty(Config::$server['server']) ? Config::$server['server'] : Config::$server['host'] . ':' . Config::$server['port']; $db = $this->request->getParam('db'); $options = array('username' => $this->request->getParam('username'), 'password' => $this->request->getParam('password'), 'db' => !empty($db) ? $db : 'admin'); $mongo = PHPMongoDB::getInstance($server, $options); if ($mongo->getConnection()) { $seesion = Application::getInstance('Session'); $seesion->isLogedIn = TRUE; $seesion->server = $server; $seesion->options = $options; $this->request->redirect(Theme::URL('Index/Index')); } else { $this->message->error = $mongo->getExceptionMessage(); } } else { if ($this->request->getParam('username') == Config::$authentication['user'] && $this->request->getParam('password') == Config::$authentication['password']) { $server = isset(Config::$server['server']) && !empty(Config::$server['server']) ? Config::$server['server'] : Config::$server['host'] . ':' . Config::$server['port']; $seesion = Application::getInstance('Session'); $seesion->isLogedIn = TRUE; $seesion->server = $server; $seesion->options = array(); $this->request->redirect(Theme::URL('Index/Index')); } else { $this->message->error = I18n::t('AUTH_FAIL'); } } } $data = array(); $this->display('index', $data); }
public function isReadonly() { if (Application::isReadonly()) { $this->message->error = I18n::t('I_A'); $this->request->redirect(Theme::URL('Index/Index')); } }
protected function getContent() { $content = '<ol class="breadcrumb"> <li><a href="' . ROOT_DIR . 'courseoverview">' . I18n::t('courseoverview.title') . '</a></li> <li><a href="' . ROOT_DIR . 'course/' . $this->course->getId() . '">' . $this->course->getName(I18n::getLang()) . '</a></li> <li><a href="' . ROOT_DIR . 'lesson/' . $this->lesson->getId() . '">' . $this->lesson->getName(I18n::getLang()) . '</a></li> <li class="active">' . I18n::t('exercises.title') . '</li> </ol>'; $content .= '<h1>' . $this->lesson->getName(I18n::getLang()) . ': ' . I18n::t('exercises.title') . '</h1> <p> </p> <form method="post" class="form-horizontal"><input type="hidden" name="action" value="evaluate" /> <div class="form-group"> <label for="inputPassword3" class="col-sm-3 control-label">' . $this->question . '</label> <div class="col-sm-9"> <input type="text" class="form-control" name="answer" placeholder="' . I18n::t('exercise.youranswer') . '"> </div> </div> <div class="form-group"> <div class="col-sm-offset-3 col-sm-9"> <button type="submit" class="btn btn-default">' . I18n::t('button.submit') . '</button> </div> </div> </form>'; return $content; }
public function GetLogMessage($msgId, $params = "") { $message = isset($this->m_Messages[$msgId]) ? $this->m_Messages[$msgId] : constant($msgId); $message = I18n::t($message, $msgId, 'eventlog'); $params = unserialize($params); $result = vsprintf($message, $params); return $result; }
static function getGlossaryTypes() { # Type definition $arr_types = array('lexicon' => (object) array('label' => I18n::t('Словник'), 'slug' => I18n::t('lexicon', 'URL slug'))); # Run filter $arr_types = Apply_Filters('glossary_types', $arr_types); return $arr_types; }
static function addOptionsPage() { $handle = Add_Options_Page(I18n::t('Glossary Options'), I18n::t('Glossary'), 'manage_options', self::$page_slug, array(__CLASS__, 'printOptionsPage')); # Add JavaScript to this handle Add_Action('load-' . $handle, array(__CLASS__, 'loadOptionsPage')); # Add option boxes self::addOptionBox(__('General'), Core::$plugin_folder . '/options-page/box-general.php'); self::addOptionBox(I18n::t('Archive Url'), Core::$plugin_folder . '/options-page/box-archive-link.php', 'side'); }
public static function forceClearance($roles, $user, $params = array(), $error = 'error.insufficient_rights') { $app_url = Settings::getProtected('app_url'); $i18n = new I18n("../translations", Settings::getProtected('language')); if (!self::verify($roles, $user, $params)) { Utils::redirectToDashboard('', $i18n->t($error)); return false; } return true; }
public function addDeleteConfirmation() { $this->addContentBefore('<form method="post"> <a class="btn btn-default" href="' . ROOT_DIR . 'admin/courseadmin">' . I18n::t('button.cancel') . '</a> <input type="hidden" name="action" value="deleteLesson" /> <input type="hidden" name="confirmed" value="true" /> <input type="hidden" name="lessonId" value="' . $_POST['lessonId'] . '" /> <input type="submit" class="btn btn-danger" value="' . I18n::t('button.delete') . '" /> </form>'); }
/** * Translate error message * * @param string $string String to translate * @param array $opt Array of arguments to pass to the translation (like field name) * @return string The translated string if exists else the original string */ protected function translate($string, $opt = array()) { $args = !empty($this->fullName) ? array('name' => $this->fullName) : array('name' => $this->fieldName); $args = array_merge($args, $opt); $moduleName = get_module_name(get_class($this)); if ($moduleName !== null) { $file = MODULES_DIR . DS . $moduleName . DS . 'i18n' . DS . 'rules.' . I18n::getLang() . '.xml'; } else { $file = FW_DIR . DS . 'form' . DS . 'check' . DS . 'i18n' . DS . 'rules.' . I18n::getLang() . '.xml'; } return I18n::t($file, $string, $args, 'en', 'rules', true); }
public function SetLanguage() { $this->isReadonly(); $language = $this->request->getParam('language'); $languages = Config::$language; //$this->debug($languages); if (array_key_exists($language, $languages)) { $session = new Session(); $session->language = $language; } else { $this->message->error = I18n::t('LAN_NOT_AVA'); } $this->request->redirect($_SERVER['HTTP_REFERER']); }
public function Drop() { $this->isReadonly(); $db = $this->request->getParam('db'); if (!empty($db)) { $response = $this->getModel()->dropDatabase($db); if ($response['ok'] == 1) { $this->message->sucess = I18n::t('D_D', $db); } else { $this->message->error = $response; } } $this->gotoDatabse(); }
public function addNewCourseInput() { $this->addContentAfter('<form method="post"> <input type="hidden" name="action" value="saveNewCourse" /> <table class="table"> <tr> <td>' . I18n::t('text.new') . '</td> <td><input type="text" name="nameEN" placeholder="Name EN" /></td> <td><input type="text" name="nameDE" placeholder="Name DE" /></td> <td><input type="submit" class="btn btn-default" value="' . I18n::t('button.save') . '" /></td> </tr> </table> </form>'); }
public function validate($val) { if (filter_var($val, FILTER_VALIDATE_EMAIL) === false) { if (class_exists("I18n")) { $err_msg = I18n::t("makiavelo.entities.errors.email"); } else { $err_msg = " doesn't have a valid e-mail format"; } $this->setErrorMsg($err_msg); return false; } else { return true; } }
public function validate($val) { Makiavelo::info("Validating if '{$val}' is numeric..."); if (!is_numeric($val)) { if (class_exists("I18n")) { $err_msg = I18n::t("makiavelo.entities.errors.integer"); } else { $err_msg = " must be an integer"; } $this->setErrorMsg($err_msg); return false; } return true; }
public function validate($val) { if ($val == "") { if (class_exists("I18n")) { $err_msg = I18n::t("makiavelo.entities.errors.blank"); } else { $err_msg = " can't be blank"; } $this->setErrorMsg($err_msg); return false; } else { return true; } }
public function createAccount($user) { $app_url = Settings::getProtected('app_url'); $email_subject = Settings::getProtected('email_subject'); $admin_email = Settings::getProtected('admin_email'); $i18n = new I18n("../translations", Settings::getProtected('language')); // Add username/email here if they're not already in Unbindery (unnecessary for Alibaba) // Example: // $user->username = $this->getUsername(); // $user->email = $this->getEmail(); // Generate hash $user->hash = md5($user->email . $user->username . time()); // Add user to the database or update if they're already there $user->save(); // Send confirmation link to user via email $message = $i18n->t('signup.confirmation_email', array("url" => "{$app_url}/signup/activate/{$user->hash}")); $status = Mail::sendMessage($user->email, "{$email_subject} " . $i18n->t('signup.confirmation_link'), $message); if ($status == 1) { $status = "done"; } else { $status = "error mailing"; } $status = Mail::sendMessage($admin_email, "{$email_subject} " . $i18n->t('signup.new_signup'), $i18n->t('signup.new_user') . " {$user->username} <{$user->email}>"); }
public function validate($val) { $regExp = "/^([0-9]{1,2}):([0-9]{2})(?(::[0-9]{2}))\$/"; if (preg_match($regExp, $val) === 0) { if (class_exists("I18n")) { $err_msg = I18n::t("makiavelo.entities.errors.time"); } else { $err_msg = " doesn't have a valid time format"; } $this->setErrorMsg($err_msg); return false; } else { return true; } }
/** * This method will translate or create an enter in the module xliff locale file * * @param array $params An array of parameters to give to i18n::translate() * @param string $content The string to translate {t}...content...{/t} * @param Smarty $smarty The current Smarty instance * @param boolean $repeat Are we in the end of {t} tag * @return string The translated string, else the original string */ function smarty_block_t($params, $content, &$smarty, &$repeat) { if ($repeat == false) { // we get the template locale if setted by {setLocale} tag $srcLocale = isset($smarty->tpl_vars['TPL_LOCALE']) ? $smarty->tpl_vars['TPL_LOCALE']->value : i18n::getDefaultLocale(); // if template locale is equal to current locale we don't need to translate if ($srcLocale === i18n::getLocale()) { return i18n::replaceArgs($content, $params); } // we get the template path $path = explode(DS, str_replace(APP_DIR . DS, '', $smarty->template_resource)); // module var has been setted in smarty if (isset($smarty->smarty->module)) { $isModule = true; $module = $smarty->smarty->module; } else { $isModule = array_search('module', $path); if ($isModule !== false) { $module = $path[$isModule + 1]; } } // we are in a module, we can translate if ($isModule !== false) { // Get locale file with full locale code (ex : fr_CA) for overloading if ($file = get_module_file($module, '/i18n/templates.' . $srcLocale . '.xml')) { $str = I18n::t($file, $content, $params, $srcLang, end($path)); if ($str !== $string) { return $str; } // There is a specific translation for full locale code, return } // get the lang code preg_match('/^([a-z]{2,3})[_-]([A-Z]{2})$/', $srcLocale, $m); $srcLang = $m[0]; // If default lang is equal to the current lang : return if ($srcLang == i18n::getLang()) { return i18n::replaceArgs($content, $params); } // Get locale file with only lang code (ex : fr) or create it $file = get_module_file($module, '/i18n/templates.' . I18n::getLang() . '.xml', false); return I18n::t($file, $content, $params, $srcLang, end($path)); } return i18n::replaceArgs($content, $params); } }
public function evaluate() { if (isset($_POST['answer']) && !empty($_POST['answer'])) { $input = $this->secureString($_POST['answer']); $correct = $_SESSION['currentExercise']->getAnswer(I18n::getLang()); // trim whitespaces, remove not relevant characters in order to be more flexible with user input $removedChars = '/(\\W+)|[0-9]|_/'; $input = trim($input); $input = preg_replace($removedChars, '', $input); $correct = trim($correct); $correct = preg_replace($removedChars, '', $correct); if (strtolower($input) === strtolower($correct)) { $updated = Exercise::addCorrectAnswer($_SESSION['user']->getEmail(), $_SESSION['currentExercise']->getId()); if (!$updated) { $this->getView()->addErrorMessage('Could not update DB.'); } $this->getView()->addSuccessMessage(I18n::t('exercise.correct')); } else { $this->getView()->addErrorMessage(I18n::t('exercise.wrong')); } } $this->defaultAction(); }
if (!isset($_GET['id']) || empty($_GET['id'])) { die("Please first select a lesson!"); } $lessonId = htmlspecialchars($_GET['id']); $lessonId = DB::escapeString($lessonId); $lesson = Lesson::getLesson($lessonId); $course = Course::getCourseById($lesson->getCourseId()); if (!isset($lesson)) { die("This lesson was not found!"); } $courseId = $lesson->getCourseId(); $filePath = PAGE_DIR . "lessons/{$courseId}-{$lessonId}.html"; $exerciseComponent = '<div class="well ui"> <form action="' . ROOT_DIR . 'exercises/' . $lessonId . '" method="post"> <button type="submit" class="btn btn-default btn-block">' . I18n::t('lesson.startexercises') . '</button> </form> </div>'; // display content echo '<ol class="breadcrumb"> <li><a href="' . ROOT_DIR . 'courseoverview">' . I18n::t('courseoverview.title') . '</a></li> <li><a href="' . ROOT_DIR . 'course/' . $course->getId() . '">' . $course->getName(I18n::getLang()) . '</a></li> <li class="active">' . $lesson->getName(I18n::getLang()) . '</li> </ol>'; echo $exerciseComponent; echo '<h1>' . $lesson->getName(I18n::getLang()) . '</h1>'; if (file_exists($filePath) && filesize($filePath) > 1) { echo '<h2>Tutorial</h2>'; echo file_get_contents($filePath); echo $exerciseComponent; }
function t($key) { return I18n::t($key); }
<?php echo '<h1>' . I18n::t('about.title') . '</h1>'; echo I18n::t('about.content');
public function Import() { $this->isReadonly(); $this->setDB(); $this->setCollection(); if ($this->request->isPost()) { if ($_FILES['import_file']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['import_file']['tmp_name'])) { //checks that file is uploaded $handle = @fopen($_FILES['import_file']['tmp_name'], "r"); if ($handle) { while (($record = fgets($handle)) !== false) { $response = $this->getModel()->insert($this->db, $this->collection, $record, 'json'); if ($response['ok'] == 1) { $this->message->sucess = I18n::t('A_D_I_S'); } else { $this->message->error = $response['errmsg']; } } if (!feof($handle)) { $this->message->error = I18n::t('E_U_F'); } fclose($handle); } } } $this->application->view = 'Collection'; $this->display('import'); }
<?php } ?> </div> <div class="postbox-container right meta-box-sortables"> <?php foreach (Options::$arr_option_box['side'] as $box) { ?> <div class="postbox should-be-<?php echo $box->state; ?> "> <button type="button" class="handlediv button-link" aria-expanded="true"> <span class="screen-reader-text"><?php PrintF(I18n::t('Toggle panel: %s'), $box->title); ?> </span> <span class="toggle-indicator" aria-hidden="true"></span> </button> <h2 class="hndle"><span><?php echo $box->title; ?> </span></h2> <div class="inside"><?php include $box->file; ?> </div> </div> <?php }
namespace WordPress\Plugin\Fancy_Gallery; ?> <p><?php echo $this->core->mocking_bird->Pro_Notice('feature'); ?> </p> <?php # User capabilities $post_type = Get_Post_Type_Object($this->core->gallery_post_type->name); if (!$post_type) { return; } $arr_capabilities = array($post_type->cap->edit_posts => I18n::t('Edit and create (own) galleries'), $post_type->cap->edit_others_posts => I18n::t('Edit others galleries'), $post_type->cap->edit_private_posts => I18n::t('Edit (own) private galleries'), $post_type->cap->edit_published_posts => I18n::t('Edit (own) published galleries'), $post_type->cap->delete_posts => I18n::t('Delete (own) galleries'), $post_type->cap->delete_private_posts => I18n::t('Delete (own) private galleries'), $post_type->cap->delete_published_posts => I18n::t('Delete (own) published galleries'), $post_type->cap->delete_others_posts => I18n::t('Delete others galleries'), $post_type->cap->publish_posts => I18n::t('Publish galleries'), $post_type->cap->read_private_posts => I18n::t('View (others) private galleries'), 'manage_categories' => I18n::t('Manage taxonomies')); # Show the user roles foreach ($GLOBALS['wp_roles']->roles as $role_name => $arr_role) { ?> <h4><?php echo Translate_User_Role($arr_role['name']); ?> </h4> <?php foreach ($arr_capabilities as $capability => $caption) { ?> <div class="capability-selection"> <span class="caption"><?php echo $caption;
/** * Smarty block function, provides gettext support for smarty. * * The block content is the text that should be translated. * * Any parameter that is sent to the function will be represented as %n in the translation text, * where n is 1 for the first parameter. The following parameters are reserved: * - escape - sets escape mode: * - 'html' for HTML escaping, this is the default. * - 'js' for javascript escaping. * - 'url' for url escaping. * - 'no'/'off'/0 - turns off escaping * - plural - The plural version of the text (2nd parameter of ngettext()) * - count - The item count for plural mode (3rd parameter of ngettext()) */ function smarty_block_t($params, $text, &$smarty) { $text = stripslashes($text); // set escape mode if (isset($params['escape'])) { $escape = $params['escape']; unset($params['escape']); } // set plural version if (isset($params['plural'])) { $plural = $params['plural']; unset($params['plural']); // set count if (isset($params['count'])) { $count = $params['count']; unset($params['count']); } } //debut modif lolo // use plural if required parameters are set /*if (isset($count) && isset($plural)) { $text = ngettext($text, $plural, $count); } else { // use normal $text = gettext($text); }*/ //$text=I18n::getInstance()->translate($text); $module = $smarty->_tpl_vars['module']; $key = strtoupper('STRING_' . md5($text)); $text = I18n::t($text, $key, $module); //fin modif lolo // run strarg if there are parameters if (count($params)) { $text = smarty_gettext_strarg($text, $params); } if (!isset($escape) || $escape == 'html') { // html escape, default $text = nl2br(htmlspecialchars($text)); } elseif (isset($escape)) { switch ($escape) { case 'javascript': case 'js': // javascript escape $text = str_replace('\'', '\\\'', stripslashes($text)); break; case 'url': // url escape $text = urlencode($text); break; } } return $text; }
echo I18n::t('Template as ZIP File'); ?> </label> <input type="file" id="template_zip" <?php Disabled(True); ?> ></p> <h4><?php echo I18n::t('Install a template in PHP format'); $this->core->mocking_bird->Pro_Notice('unlock'); ?> </h4> <p><?php echo I18n::t('If you have a template as a .php file, you may install it by uploading it here.'); ?> </p> <p><label for="template_php"><?php echo I18n::t('Templates PHP File'); ?> </label> <input type="file" id="template_php" <?php Disabled(True); ?> ></p> <p><input type="button" value="<?php echo I18n::t('Install template and save all options'); ?> " class="button-primary" <?php Disabled(True); ?> ></p><?php
static function filterUpdatedMessages($arr_message) { return Array_Merge($arr_message, array(self::$post_type_name => array(1 => SPrintF(I18n::t('Term updated. (<a href="%s">View Term</a>)'), Get_Permalink()), 2 => __('Custom field updated.'), 3 => __('Custom field deleted.'), 4 => I18n::t('Term updated.'), 5 => isset($_GET['revision']) ? SPrintF(I18n::t('Term restored to revision from %s'), WP_Post_Revision_Title((int) $_GET['revision'], False)) : False, 6 => SPrintF(I18n::t('Term published. (<a href="%s">View Term</a>)'), Get_Permalink()), 7 => I18n::t('Term saved.'), 8 => I18n::t('Term submitted.'), 9 => SPrintF(I18n::t('Term scheduled. (<a target="_blank" href="%s">View Term</a>)'), Get_Permalink()), 10 => SPrintF(I18n::t('Draft updated. (<a target="_blank" href="%s">Preview Term</a>)'), Add_Query_Arg('preview', 'true', Get_Permalink()))))); }
</h1> <table class="table table-hover"> <thead> <tr> <th>Nickname</th> <th><?php echo I18n::t('text.email'); ?> </th> <th><?php echo I18n::t('admin.useroverview.admin'); ?> </th> <th><?php echo I18n::t('register.title'); ?> </th> </tr> </thead> <tbody> <?php foreach ($users as $user) { echo '<tr> <td>' . $user->getNickname() . '</td> <td>' . $user->getEmail() . '</td> <td>' . $user->isAdmin() . '</td> <td>' . $user->timestampRegistered() . '</td> </tr>'; } ?>