return $abbr ? Text::_('WED') : Text::_('WEDNESDAY'); case 4: return $abbr ? Text::_('THU') : Text::_('THURSDAY'); case 5: return $abbr ? Text::_('FRI') : Text::_('FRIDAY'); case 6: return $abbr ? Text::_('SAT') : Text::_('SATURDAY'); } return ''; } /** * Gets the date as a formatted string in a local calendar. * * @param string $format The date format specification string (see {@link PHP_MANUAL#date}) * @param boolean $local True to return the date string in the local time zone, false to return it in GMT. * @param boolean $translate True to translate localised strings * * @return string The date string in the specified format format. * * @since 1.7.0 */ public function calendar($format, $local = false, $translate = true) { return $this->format($format, $local, $translate); } /** * Gets the date as a formatted string. * * @param string $format The date format specification string (see {@link PHP_MANUAL#date}) * @param boolean $local True to return the date string in the local time zone, false to return it in GMT. * @param boolean $translate True to translate localised strings * * @return string The date string in the specified format format. * * @since 1.7.0 */ public function format($format, $local = false, $translate = true): string { if ($translate) { // Do string replacements for date format options that can be translated. $format = preg_replace('/(^|[^\\\])D/', "\\1" . self::DAY_ABBR, $format); $format = preg_replace('/(^|[^\\\])l/', "\\1" . self::DAY_NAME, $format); $format = preg_replace('/(^|[^\\\])M/', "\\1" . self::MONTH_ABBR, $format); $format = preg_replace('/(^|[^\\\])F/', "\\1" . self::MONTH_NAME, $format); } // If the returned time should not be local use UTC. if ($local == false) { parent::setTimezone(new \DateTimeZone('UTC')); } // Format the date. $return = parent::format($format); if ($translate) { // Manually modify the month and day strings in the formatted time. if (str_contains($return, self::DAY_ABBR)) { $return = str_replace(self::DAY_ABBR, $this->dayToString(parent::format('w'), true), $return); } if (str_contains($return, self::DAY_NAME)) { $return = str_replace(self::DAY_NAME, $this->dayToString(parent::format('w')), $return); } if (str_contains($return, self::MONTH_ABBR)) { $return = str_replace(self::MONTH_ABBR, $this->monthToString(parent::format('n'), true), $return); } if (str_contains($return, self::MONTH_NAME)) { $return = str_replace(self::MONTH_NAME, $this->monthToString(parent::format('n')), $return); } } if ($local == false && $this->tz !== null) { parent::setTimezone($this->tz); } return $return; } /** * Get the time offset from GMT in hours or seconds. * * @param boolean $hours True to return the value in hours. * * @return float The time offset from GMT either in hours or in seconds. * * @since 1.7.0 */ public function getOffsetFromGmt($hours = false) { return (float) $hours ? ($this->tz->getOffset($this) / 3600) : $this->tz->getOffset($this); } /** * Translates month number to a string. * * @param integer $month The numeric month of the year. * @param boolean $abbr If true, return the abbreviated month string * * @return string The month of the year. * * @since 1.7.0 */ public function monthToString($month, $abbr = false) { switch ($month) { case 1: return $abbr ? Text::_('JANUARY_SHORT') : Text::_('JANUARY'); case 2: return $abbr ? Text::_('FEBRUARY_SHORT') : Text::_('FEBRUARY'); case 3: return $abbr ? Text::_('MARCH_SHORT') : Text::_('MARCH'); case 4: return $abbr ? Text::_('APRIL_SHORT') : Text::_('APRIL'); case 5: return $abbr ? Text::_('MAY_SHORT') : Text::_('MAY'); case 6: return $abbr ? Text::_('JUNE_SHORT') : Text::_('JUNE'); case 7: return $abbr ? Text::_('JULY_SHORT') : Text::_('JULY'); case 8: return $abbr ? Text::_('AUGUST_SHORT') : Text::_('AUGUST'); case 9: return $abbr ? Text::_('SEPTEMBER_SHORT') : Text::_('SEPTEMBER'); case 10: return $abbr ? Text::_('OCTOBER_SHORT') : Text::_('OCTOBER'); case 11: return $abbr ? Text::_('NOVEMBER_SHORT') : Text::_('NOVEMBER'); case 12: return $abbr ? Text::_('DECEMBER_SHORT') : Text::_('DECEMBER'); } return ''; } /** * Method to wrap the setTimezone() function and set the internal time zone object. * * @param \DateTimeZone $tz The new \DateTimeZone object. * * @return Date * * @since 1.7.0 * @note This method can't be type hinted due to a PHP bug: https://bugs.php.net/bug.php?id=61483 */ public function setTimezone($tz): \Datetime { $this->tz = $tz; return parent::setTimezone($tz); } /** * Gets the date as an ISO 8601 string. IETF RFC 3339 defines the ISO 8601 format * and it can be found at the IETF Web site. * * @param boolean $local True to return the date string in the local time zone, false to return it in GMT. * * @return string The date string in ISO 8601 format. * * @link http://www.ietf.org/rfc/rfc3339.txt * @since 1.7.0 */ public function toISO8601($local = false) { return $this->format(\DateTimeInterface::RFC3339, $local, false); } /** * Gets the date as an SQL datetime string. * * @param boolean $local True to return the date string in the local time zone, false to return it in GMT. * @param ?DatabaseDriver $db The database driver or null to use Factory::getDbo() * * @return string The date string in SQL datetime format. * * @link http://dev.mysql.com/doc/refman/5.0/en/datetime.html * @since 2.5.0 */ public function toSql($local = false, ?DatabaseDriver $db = null) { if ($db === null) { $db = Factory::getDbo(); } return $this->format($db->getDateFormat(), $local, false); } /** * Gets the date as an RFC 822 string. IETF RFC 2822 supercedes RFC 822 and its definition * can be found at the IETF Web site. * * @param boolean $local True to return the date string in the local time zone, false to return it in GMT. * * @return string The date string in RFC 822 format. * * @link http://www.ietf.org/rfc/rfc2822.txt * @since 1.7.0 */ public function toRFC822($local = false) { return $this->format(\DateTimeInterface::RFC2822, $local, false); } /** * Gets the date as UNIX time stamp. * * @return integer The date as a UNIX timestamp. * * @since 1.7.0 */ public function toUnix() { return (int) parent::format('U'); } }
use Joomla\CMS\Uri\Uri;use Joomla\CMS\Language\Text;$app = Factory::getApplication();$doc = Factory::getDocument();$template = Helper::loadTemplateData();$params = $template->params;$fontCSS = '';function addGoogleFont($fonts){ // Store the file path $this->_file = $directory . '/' . $filename; // Get the file content ob_start(); require $directory . '/' . $filename; $contents = ob_get_clean(); } return $contents; } $this->baseurl = Uri::base(true); $this->params = $params['params'] ?? new Registry(); $this->template = $template; // Load $this->_template = $this->_loadTemplate($baseDir, $file); return $this; } /** * * @since 1.7.0 */ public function parse($params = []) { return $this->_fetchTemplate($params)->_parseTemplate(); } /** * Outputs the template to the browser. * public function render($caching = false, $params = []) { $this->_caching = $caching; if (empty($this->_template)) { $this->parse($params); } if (\array_key_exists('csp_nonce', $params) && $params['csp_nonce'] !== null) { $this->cspNonce = $params['csp_nonce']; } $this->debug = $params['debug'] ?? false; $this->error = $this->_error; $params['file'] = 'error.php'; return parent::render($cache, $params); } /** * Render the backtrace * 'template' => $template->template, 'directory' => JPATH_THEMES, 'debug' => JDEBUG, 'csp_nonce' => $app->get('csp_nonce'), 'templateInherits' => $template->parent, 'params' => $template->params, ] ); }} 'subject' => $app, 'document' => $renderer->getDocument(), ]) ); $data = $renderer->render($error); // If nothing was rendered, just use the message from the Exception if (empty($data)) { $data = $error->getMessage(); } * @since 3.10.0 */ public static function handleException(\Throwable $error) { static::logException($error); static::render($error); } /** * Render the error page based on an exception. * ); // Trigger the onError event. $this->dispatchEvent('onError', $event); ExceptionHandler::handleException($event->getError()); } // Trigger the onBeforeRespond event. $this->dispatchEvent( 'onBeforeRespond',// Set the application as global app\Joomla\CMS\Factory::$application = $app;// Execute the application.$app->execute(); * define() is used rather than "const" to not error for PHP 5.2 and lower */define('_JEXEC', 1);// Run the application - All executable code should be triggered through this filerequire_once __DIR__ . '/includes/app.php'; return 200;
}
}
class fa_IRDate extends Date {
const DAY_NUMBER = "\x027\x03";
const DAY_NUMBER2 = "\x030\x03";
const DAY_YEAR = "\x032\x03";
const MONTH_ABBR = "\x033\x03";
const MONTH_NAME = "\x034\x03";
ksort($paths); $path = reset($paths); while (!class_exists($class) && $path) { if (is_file($path)) { require_once $path; } $path = next($paths); } * * @since 4.0.0 */ public function createLanguage($lang, $debug = false): Language { return new Language($lang, $debug); }} * @since 4.0.0 */ public function createLanguage($lang, $debug = false): Language { if (!isset(self::$languages[$lang . $debug])) { self::$languages[$lang . $debug] = parent::createLanguage($lang, $debug); } return self::$languages[$lang . $debug]; }} if (isset($options['language'])) { $this->set('language', $options['language']); } // Build our language object $lang = $this->getContainer()->get(LanguageFactoryInterface::class)->createLanguage($this->get('language'), $this->get('debug_lang')); // Load the language to the API $this->loadLanguage($lang); // Register the language object with Factory