Beispiel #1
0
 protected function translate($message)
 {
     try {
         return Locale::t($message, $this->get_translation_replace_pairs());
     } catch (\Exception $e) {
         return strtr($message, $this->get_translation_replace_pairs());
     }
 }
Beispiel #2
0
 public function validate()
 {
     if (isset($this->valid)) {
         return $this->valid;
     }
     if ($this->required && !isset($this->value)) {
         $this->errors[] = Locale::t('The field @name is required.', array('@name' => $this->label));
     }
     return $this->valid = empty($this->errors);
 }
Beispiel #3
0
<?php

$loader = (require __DIR__ . '/vendor/autoload.php');
$loader->add('Custom\\', __DIR__);
use Sedra\App;
use Sedra\Locale;
use Sedra\Router;
use Sedra\Request;
use Sedra\Response;
# Enable custom locales
Locale::enable(array('fr_BE', 'en_US'));
# Setup the router
Router::setup(array('rewrite' => true));
# Configure & register the Sedra CMS and core controllers
App::register(new Sedra\Controller\i18n());
App::register(new Sedra\Controller\Admin());
App::register(new Sedra\Controller\Sedra(array('site_name' => 'My amazing website')));
# Add custom controllers
App::register(new Sedra\Controller\Blog());
App::register(new Custom\Controller\MyPhotoGallery());
# Process the request
App::process();
Beispiel #4
0
 function __construct()
 {
     parent::__construct('blog_categories', array('fields' => array('id' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'hidden' => TRUE), 'name' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', 'display name' => 'Category name', 'show name' => FALSE), 'locale' => array('type' => 'varchar', 'length' => 6, 'not null' => FALSE, 'options' => Locale::enabled(), 'display name' => 'Language')), 'primary key' => array('id')));
 }