'tl' => $this->targetLanguage, 'tk' => $this->tokenProvider->generateToken($this->sourceLanguage, $this->targetLanguage, $tokenData), ]); $queryUrl = preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', http_build_query($queryArray)); try { $response = $this->httpClient->post($this->urlBase, ['body' => $queryUrl]); } catch (GuzzleRequestException $e) { throw new ErrorException($e->getMessage()); } $body = $response->getBody(); // Get response body // Modify body to avoid json errors $bodyJson = preg_replace(array_keys($this->resultRegexes), array_values($this->resultRegexes), $body); // Decode JSON data if (($bodyArray = json_decode($bodyJson, true)) === null) {
{ // Whether or not is the data an array $isArray = is_array($data); // Rethrow exceptions try { $responseArray = $this->getResponse($data); } catch (Exception $e) { throw $e; } // if response in text and the content has zero the empty returns true, lets check // if response is string and not empty and create array for further logic
switch ($name) { case 'translate': if (count($args) < 1) { throw new InvalidArgumentException('Expecting 1 parameter'); } try { $result = $this->instanceTranslate($args[0]); } catch (Exception $e) { throw $e; } return $result; case 'getLastDetectedSource':
{ self::checkStaticInstance(); try { $result = self::$staticInstance ->setSource($source) ->setTarget($target) ->translate($string); } catch (Exception $e) { throw $e; } return $result; }
{ self::checkStaticInstance(); try { $result = self::$staticInstance ->setSource($source) ->setTarget($target) ->translate($string); } catch (Exception $e) { throw $e; } return $result; }
switch ($name) { case 'translate': if (count($args) < 3) { throw new InvalidArgumentException('Expecting 3 parameters'); } try { $result = self::staticTranslate($args[0], $args[1], $args[2]); } catch (Exception $e) { throw $e; } return $result; case 'getLastDetectedSource':
public static function tr($text){ if(self::get_lang() == "en"){ return $text; } return TranslateClient::translate('en', self::get_lang() ,strip_tags(html_entity_decode($text, ENT_QUOTES, 'UTF-8'))); } public static function alert( $task , $message) {
public static function tr($text){ if(self::get_lang() == "en"){ return $text; } return TranslateClient::translate('en', self::get_lang() ,strip_tags(html_entity_decode($text, ENT_QUOTES, 'UTF-8'))); } public static function alert( $task , $message) {
<div class="about clearfix"><!-- About Section --> <div class="container"> <div class="row"> <div class="about-title pos-center margint60"> <h2><?= SiteHelpers::tr(strtoupper($f->tag_line)) ?></h2> <div class="title-shape"><img alt="Shape" src="<?= Url::to('@web/front/img/shape.png')?>"></div> <p><?= SiteHelpers::tr(strtoupper($f->tag_line_sub)) ?></p> <?php // remove temporarily if(isset($f->announce_text) && isset($f->announce_mode)){
*/ public function renderPhpFile($_file_, $_params_ = []) { ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); require($_file_); return ob_get_clean(); } /** * Renders dynamic content returned by the given PHP statements.
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); } array_pop($this->_viewFiles); $this->context = $oldContext;
* @throws InvalidParamException if the view cannot be resolved or the view file does not exist. * @see renderFile() */ public function render($view, $params = [], $context = null) { $viewFile = $this->findViewFile($view, $context); return $this->renderFile($viewFile, $params, $context); } /** * Finds the view file based on the given view name. * @param string $view the view name or the path alias of the view file. Please refer to [[render()]] * on how to specify this parameter.
* These parameters will not be available in the layout. * @return string the rendering result. * @throws InvalidParamException if the view file or the layout file does not exist. */ public function render($view, $params = []) { $content = $this->getView()->render($view, $params, $this); return $this->renderContent($content); } /** * Renders a static string by applying a layout. * @param string $content the static string being rendered
//} #set currency here SiteHelpers::set_currency(); AccessHelpers::SetHotelActive(); return $this->render('_index'); } /** * SiteController::actionLogin() * This will automate login form and get
$args = $this->controller->bindActionParams($this, $params); Yii::trace('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); Yii::$app->controller = $oldController; return $result; } else { $id = $this->getUniqueId(); throw new InvalidRouteException('Unable to resolve the request "' . ($id === '' ? $route : $id . '/' . $route) . '".');
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require(__DIR__ . '/../vendor/autoload.php'); require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); $config = require(__DIR__ . '/../config/web.php'); (new yii\web\Application($config))->run(); //use \app\models\HotelImages; //use yii\helpers\Html; // //$img_data = HotelImages::find(['hotel_image_id' => 10])->one(); //
$_GET = [ 'language' => 'FRANCAIS', ]; $_SERVER = [ 'CONTEXT_DOCUMENT_ROOT' => '/home/chelseahotelabj/public_html', 'CONTEXT_PREFIX' => '', 'DOCUMENT_ROOT' => '/home/chelseahotelabj/public_html', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'H2PUSH' => 'off', 'H2_PUSH' => 'off', 'H2_PUSHED' => '', 'H2_PUSHED_ON' => '', 'H2_STREAM_ID' => '3', 'H2_STREAM_TAG' => '897162-172-3', 'HTTP2' => 'on', 'HTTPS' => 'on', 'HTTP_ACCEPT' => '*/*', 'HTTP_HOST' => 'chelseahotelabuja.com', 'HTTP_USER_AGENT' => 'claudebot', 'HTTP_X_HTTPS' => '1', 'PATH' => '/bin:/usr/bin', 'QUERY_STRING' => 'language=FRANCAIS', 'REDIRECT_H2PUSH' => 'off', 'REDIRECT_H2_PUSH' => 'off', 'REDIRECT_H2_PUSHED' => '', 'REDIRECT_H2_PUSHED_ON' => '', 'REDIRECT_H2_STREAM_ID' => '3', 'REDIRECT_H2_STREAM_TAG' => '897162-172-3', 'REDIRECT_HTTP2' => 'on', 'REDIRECT_HTTPS' => 'on', 'REDIRECT_QUERY_STRING' => 'language=FRANCAIS', 'REDIRECT_SCRIPT_URI' => 'https://chelseahotelabuja.com/', 'REDIRECT_SCRIPT_URL' => '/', 'REDIRECT_SSL_TLS_SNI' => 'chelseahotelabuja.com', 'REDIRECT_STATUS' => '200', 'REDIRECT_UNIQUE_ID' => 'ZgaNOs3VPUnXe90HcfpZWwADRhY', 'REDIRECT_URL' => '/', 'REMOTE_ADDR' => '3.88.185.100', 'REMOTE_PORT' => '38932', 'REQUEST_METHOD' => 'GET', 'REQUEST_SCHEME' => 'https', 'REQUEST_URI' => '/?language=FRANCAIS', 'SCRIPT_FILENAME' => '/home/chelseahotelabj/public_html/web/index.php', 'SCRIPT_NAME' => '/web/index.php', 'SCRIPT_URI' => 'https://chelseahotelabuja.com/', 'SCRIPT_URL' => '/', 'SERVER_ADDR' => '23.235.212.232', 'SERVER_ADMIN' => 'webmaster@chelseahotelabuja.com', 'SERVER_NAME' => 'chelseahotelabuja.com', 'SERVER_PORT' => '443', 'SERVER_PROTOCOL' => 'HTTP/2.0', 'SERVER_SIGNATURE' => '', 'SERVER_SOFTWARE' => 'Apache', 'SSL_TLS_SNI' => 'chelseahotelabuja.com', 'TZ' => 'America/Los_Angeles', 'UNIQUE_ID' => 'ZgaNOs3VPUnXe90HcfpZWwADRhY', 'PHP_SELF' => '/web/index.php', 'REQUEST_TIME_FLOAT' => 1711705402.709311008453369140625, 'REQUEST_TIME' => 1711705402, 'argv' => [ 'language=FRANCAIS', ], 'argc' => 1, ]; $_SESSION = [ '__flash' => [], 'currency' => 'NGN', 'language' => 'FRANCAIS', ];