示例#1
0
 public function load($group)
 {
     $config = array();
     if ($files = JsonApiApplication::find_file($this->_directory, $group, NULL, TRUE)) {
         foreach ($files as $file) {
             $config = Arr::merge($config, JsonApiApplication::load($file));
         }
     }
     return $config;
 }
示例#2
0
 public static function load($lang)
 {
     if (isset(I18n::$_cache[$lang])) {
         return I18n::$_cache[$lang];
     }
     $table = array();
     $parts = explode("-", $lang);
     do {
         $path = implode(DIRECTORY_SEPARATOR, $parts);
         if ($files = JsonApiApplication::find_file("i18n", $path, NULL, TRUE)) {
             $t = array();
             foreach ($files as $file) {
                 $t = array_merge($t, JsonApiApplication::load($file));
             }
             $table += $t;
         }
         array_pop($parts);
     } while ($parts);
     return I18n::$_cache[$lang] = $table;
 }
示例#3
0
 public static function message($file, $path = NULL, $default = NULL)
 {
     static $messages;
     if (!isset($messages[$file])) {
         $messages[$file] = array();
         if ($files = JsonApiApplication::find_file("messages", $file)) {
             foreach ($files as $f) {
                 $messages[$file] = Arr::merge($messages[$file], JsonApiApplication::load($f));
             }
         }
     }
     if ($path === NULL) {
         return $messages[$file];
     } else {
         return Arr::path($messages[$file], $path, $default);
     }
 }
示例#4
0
 public static function gen_mt_rand()
 {
     if (!isset(UTF8::$called[__FUNCTION__])) {
         require JsonApiApplication::find_file("utf8", __FUNCTION__);
         // Function has been called
         UTF8::$called[__FUNCTION__] = TRUE;
     }
     return _gen_mt_rand();
 }
示例#5
0
<?php

if (count(get_included_files()) == 1) {
    exit("Direct access not permitted.");
}
?>

<style type="text/css">
<?php 
include JsonApiApplication::find_file("views", "profiler/style", "css");
?>
</style>

<?php 
$group_stats = Profiler::group_stats();
$group_cols = array('min', 'max', 'average', 'total');
$application_cols = array('min', 'max', 'average', 'current');
?>

<div class="JsonApiApplication">
	<?php 
foreach (Profiler::groups() as $group => $benchmarks) {
    ?>
	<table class="profiler">
		<tr class="group">
			<th class="name" rowspan="2"><?php 
    echo __(ucfirst($group));
    ?>
</th>
			<td class="time" colspan="4"><?php 
    echo number_format($group_stats[$group]['total']['time'], 6);
示例#6
0
        $this->_message->attach(Swift_Attachment::newInstance($data, $file, $mime));
        return $this;
    }
    public function send(array &$failed = NULL)
    {
        return Email::mailer()->send($this->_message, $failed);
    }
    public function batch(array $to, array &$failed = NULL)
    {
        $message = clone $this->_message;
        $mailer = Email::mailer();
        $total = 0;
        foreach ($to as $email => $name) {
            if (ctype_digit((string) $email)) {
                $email = $name;
                $name = NULL;
            }
            $message->setTo($email, $name);
            $total += $mailer->send($message, $failed);
        }
        return $total;
    }
}
if (!class_exists("Swift")) {
    require JsonApiApplication::find_file("vendor" . DIRECTORY_SEPARATOR . "swiftmailer", "lib" . DIRECTORY_SEPARATOR . "swift_required");
}
function swiftmailer_configurator()
{
    Swift_Preferences::getInstance()->setCharset(JsonApiApplication::$charset);
}
Swift::init("swiftmailer_configurator");
示例#7
0
 public function set_filename($file)
 {
     if (($path = JsonApiApplication::find_file("views", $file)) === FALSE) {
         throw new View_Exception("The requested view :file could not be found", array(":file" => $file));
     }
     $this->_file = $path;
     return $this;
 }
示例#8
0
 public static function from_unicode($arr)
 {
     if (!isset(UTF8::$called[__FUNCTION__])) {
         require JsonApiApplication::find_file("utf8", __FUNCTION__);
         // Function has been called
         UTF8::$called[__FUNCTION__] = TRUE;
     }
     return _from_unicode($arr);
 }
示例#9
0
 /**
  * Creates a new Mailer object.
  *
  * @param   string  configuration
  * @return  void
  */
 public function __construct($config = "default")
 {
     if (!class_exists('Swift', FALSE)) {
         // Load SwiftMailer Autoloader
         require_once JsonApiApplication::find_file('vendor', 'swift/swift_required');
     }
     // Load configuration
     $this->before();
 }