コード例 #1
0
ファイル: Object.php プロジェクト: pH7s/phpfox
 public function __construct($keys)
 {
     parent::__construct($keys);
     if (!$this->icon) {
         $name = $this->name[0];
         $parts = explode(' ', $this->name);
         if (isset($parts[1])) {
             $name .= trim($parts[1])[0];
         } else {
             $name .= $this->name[1];
         }
         $this->icon = '<b class="app_icons"><i class="app_icon _' . strtolower($name) . '">' . $name . '</i></b>';
     } else {
         $this->icon = '<div class="app_icons image_load" data-src="' . $this->icon . '"></div>';
     }
     $this->vendor = explode('/', $this->id)[0];
     if (!$this->is_module) {
         $file = PHPFOX_DIR_SETTINGS . md5($this->id . \Phpfox::getParam('core.salt')) . '.php';
         if (!file_exists($file)) {
             $id = md5(uniqid());
             $key = md5(uniqid() . rand(0, 10000));
             // throw new \Exception('App "' . $this->id . '" is missing auth file. Something went wrong with the install of this product.');
             $response = ['id' => $id, 'key' => $key];
             $paste = "<?php\n// @app ' . {$this->id} . ' \nreturn " . var_export((array) $response, true) . ';';
             file_put_contents($file, $paste);
         }
         $this->auth = (object) (require $file);
     }
 }
コード例 #2
0
ファイル: Object.php プロジェクト: lev1976g/core
 public function __construct($objects)
 {
     parent::__construct($objects);
     $this->custom = (object) $this->custom;
     if (substr($this->content, 0, 1) == '{') {
         $this->content = json_decode($this->content);
     }
 }
コード例 #3
0
ファイル: Object.php プロジェクト: Goudarzi-hahram/phpfox
 public function __construct($objects)
 {
     parent::__construct($objects);
     $this->custom = (object) $this->custom;
     if (substr($this->content, 0, 1) == '{') {
         $this->content = json_decode($this->content);
     }
     $this->time = empty($this->custom->time_stamp) ? '' : \Phpfox_Date::instance()->convertTime($this->custom->time_stamp);
 }
コード例 #4
0
ファイル: Object.php プロジェクト: JerwinPRO/phpfox
 public function __construct($keys)
 {
     parent::__construct($keys);
     if (isset($this->website) && substr($this->website, 0, 1) == '{') {
         foreach (json_decode($this->website) as $key => $value) {
             if ($key == 'id') {
                 $key = 'internal_id';
             }
             $this->{$key} = $value;
         }
         unset($this->website);
     }
     $currentImage = $this->image;
     $this->_db = new \Core\Db();
     $this->image = new \Core\Objectify(function () use($currentImage) {
         // class="image_load" data-src="{$theme.image}"
         $html = '';
         if ($currentImage) {
             $html = 'class="image_load" data-src="' . $currentImage . '"';
         } else {
             $hex = function ($color) {
                 $color = trim($color);
                 $color = preg_replace('/(lighten|darken)\\(\\#(.*), (.*)\\)/i', '#\\2', $color);
                 return '<span style="background:' . $color . ';"></span>';
             };
             $flavor = (new \Core\Theme\Flavor($this))->getDefault();
             $path = $this->getPath() . 'flavor/' . $flavor->folder . '.less';
             if (file_exists($path)) {
                 $colors = [];
                 $lines = file($path);
                 foreach ($lines as $line) {
                     // p($line);
                     if (preg_match('/@brandPrimary\\:(.*?);/s', $line, $matches)) {
                         $colors[] = $hex($matches[1]);
                     } else {
                         if (preg_match('/@bodyBg\\:(.*?);/s', $line, $matches)) {
                             $colors[] = $hex($matches[1]);
                         } else {
                             if (preg_match('/@blockBg\\:(.*?);/s', $line, $matches)) {
                                 $colors[] = $hex($matches[1]);
                             } else {
                                 if (preg_match('/@headerBg\\:(.*?);/s', $line, $matches)) {
                                     $colors[] = $hex($matches[1]);
                                 }
                             }
                         }
                     }
                 }
                 if ($colors) {
                     $colors = implode('', $colors);
                     $html = '><div class="theme_colors">' . $colors . '<' . "/div";
                 }
             }
         }
         return $html;
     });
 }
コード例 #5
0
ファイル: Object.php プロジェクト: lev1976g/core
 public function __construct($object)
 {
     $map = ['id' => (int) $object['message_id'], 'message' => $object['text'], 'time' => (int) $object['time_stamp'], 'user' => $object];
     parent::__construct($map);
 }
コード例 #6
0
ファイル: Object.php プロジェクト: lev1976g/core
 public function __construct($object)
 {
     $map = ['id' => (int) $object['comment_id'], 'comment' => $object['text'], 'time' => (int) $object['unix_time_stamp']];
     parent::__construct(array_merge($object, $map));
 }