Ejemplo n.º 1
0
Archivo: Feed.php Proyecto: rburch/core
 /**
  * Return an object property
  * 
  * @param string $strKey The property name
  * 
  * @return mixed The property value
  */
 public function __get($strKey)
 {
     if (isset($this->arrData[$strKey])) {
         return $this->arrData[$strKey];
     }
     return parent::__get($strKey);
 }
Ejemplo n.º 2
0
 /**
  * Return an object property
  * 
  * Supported keys:
  * 
  * * subject:     the e-mail subject
  * * text:        the text part of the mail
  * * html:        the HTML part of the mail
  * * from:        the sender's e-mail address
  * * fromName:    the sender's name
  * * priority:    the e-mail priority
  * * charset:     the e-mail character set
  * * imageDir:    the base directory to look for internal images
  * * embedImages: whether to embed images inline
  * * logFile:     the log file path
  * * failures:    an array of rejected e-mail addresses
  * 
  * @param string $strKey The property name
  * 
  * @return mixed The property value
  */
 public function __get($strKey)
 {
     switch ($strKey) {
         case 'subject':
             return $this->strSubject;
             break;
         case 'text':
             return $this->strText;
             break;
         case 'html':
             return $this->strHtml;
             break;
         case 'from':
             return $this->strSender;
             break;
         case 'fromName':
             return $this->strSenderName;
             break;
         case 'priority':
             return $this->intPriority;
             break;
         case 'charset':
             return $this->strCharset;
             break;
         case 'imageDir':
             return $this->strImageDir;
             break;
         case 'embedImages':
             return $this->blnEmbedImages;
             break;
         case 'logFile':
             return $this->strLogFile;
             break;
         case 'failures':
             return $this->arrFailures;
             break;
     }
     return parent::__get($strKey);
 }
Ejemplo n.º 3
0
 /**
  * Return a parameter
  * @return string
  * @throws Exception
  */
 public function __get($strKey)
 {
     switch ($strKey) {
         case 'fortable':
             return $this->forTable;
             break;
         case 'tagtable':
             return $this->strTagTable;
             break;
         case 'tagfield':
             return $this->strTagField;
             break;
         case 'maxtags':
             return $this->intMaxTags;
             break;
         case 'topnumber':
             return $this->intTopNumber;
             break;
         case 'buckets':
             return $this->intBuckets;
             break;
         case 'addNamedClass':
             return $this->boolNamedClass;
             break;
         default:
             return parent::__get($strKey);
             break;
     }
 }
Ejemplo n.º 4
0
 /**
  * Return an object property
  *
  * @param string $strKey The property name
  *
  * @return mixed The property value
  */
 public function __get($strKey)
 {
     switch ($strKey) {
         case 'hash':
             return $this->getHash();
             break;
         case 'name':
         case 'basename':
             return basename($this->strFolder);
             break;
         case 'path':
         case 'value':
             return $this->strFolder;
             break;
         case 'size':
             return $this->getSize();
             break;
         default:
             return parent::__get($strKey);
             break;
     }
 }
Ejemplo n.º 5
0
 /**
  * Return an object property
  * 
  * Supported keys:
  * 
  * * hash: the folder's MD5 hash
  * * path: the path to the folder
  * * size: the folder size
  * 
  * @param string $strKey The property name
  * 
  * @return mixed The property value
  */
 public function __get($strKey)
 {
     $strCacheKey = __METHOD__ . '-' . $this->strFolder . '-' . $strKey;
     if (!\Cache::has($strCacheKey)) {
         switch ($strKey) {
             case 'hash':
                 \Cache::set($strCacheKey, $this->getHash());
                 break;
             case 'path':
             case 'value':
                 \Cache::set($strCacheKey, $this->strFolder);
                 break;
             case 'size':
                 \Cache::set($strCacheKey, $this->getSize());
                 break;
             default:
                 return parent::__get($strKey);
                 break;
         }
     }
     return \Cache::get($strCacheKey);
 }
Ejemplo n.º 6
0
Archivo: Date.php Proyecto: rburch/core
 /**
  * Return an object property
  * 
  * Supported keys:
  * 
  * * timestamp:  the Unix timestamp
  * * date:       the formatted date
  * * time:       the formatted time
  * * datim:      the formatted date and time
  * * dayBegin:   the beginning of the current day
  * * dayEnd:     the end of the current day
  * * monthBegin: the beginning of the current month
  * * monthEnd:   the end of the current month
  * * yearBegin:  the beginning of the current year
  * * yearEnd:    the end of the current year
  * * format:     the date format string
  * 
  * @param string $strKey The property name
  * 
  * @return mixed The property value
  */
 public function __get($strKey)
 {
     switch ($strKey) {
         case 'tstamp':
         case 'timestamp':
             return $this->strDate;
             break;
         case 'date':
             return $this->strToDate;
             break;
         case 'time':
             return $this->strToTime;
             break;
         case 'datim':
             return $this->strToDatim;
             break;
         case 'dayBegin':
             return $this->arrRange['day']['begin'];
             break;
         case 'dayEnd':
             return $this->arrRange['day']['end'];
             break;
         case 'monthBegin':
             return $this->arrRange['month']['begin'];
             break;
         case 'monthEnd':
             return $this->arrRange['month']['end'];
             break;
         case 'yearBegin':
             return $this->arrRange['year']['begin'];
             break;
         case 'yearEnd':
             return $this->arrRange['year']['end'];
             break;
         case 'format':
             return $this->strFormat;
             break;
     }
     return parent::__get($strKey);
 }
Ejemplo n.º 7
0
Archivo: File.php Proyecto: rburch/core
 /**
  * Return an object property
  * 
  * Supported keys:
  * 
  * * size:      the file size
  * * name:      the file name without extension
  * * dirname:   the path of the parent folder
  * * extension: the file extension
  * * filename:  the file name and extension
  * * mime:      the file's mime type
  * * hash:      the file's MD5 checksum
  * * ctime:     the file's ctime
  * * mtime:     the file's mtime
  * * atime:     the file's atime
  * * icon:      the name of the corresponding mime icon
  * * path:      the path to the file
  * * width:     the file width (images only)
  * * height:    the file height (images only)
  * * isGdImage: true if the file can be handled by the GDlib
  * * handle:    the file handle (returned by fopen())
  * 
  * @param string $strKey The property name
  * 
  * @return mixed The property value
  */
 public function __get($strKey)
 {
     $strCacheKey = __METHOD__ . '-' . $this->strFile . '-' . $strKey;
     if (!\Cache::has($strCacheKey)) {
         switch ($strKey) {
             case 'size':
             case 'filesize':
                 \Cache::set($strCacheKey, filesize(TL_ROOT . '/' . $this->strFile));
                 break;
             case 'name':
             case 'basename':
                 if (!isset($this->arrPathinfo[$strKey])) {
                     $this->arrPathinfo = pathinfo(TL_ROOT . '/' . $this->strFile);
                 }
                 \Cache::set($strCacheKey, $this->arrPathinfo['basename']);
                 break;
             case 'dirname':
                 if (!isset($this->arrPathinfo[$strKey])) {
                     $this->arrPathinfo = pathinfo(TL_ROOT . '/' . $this->strFile);
                 }
                 \Cache::set($strCacheKey, $this->arrPathinfo['dirname']);
                 break;
             case 'extension':
                 if (!isset($this->arrPathinfo['extension'])) {
                     $this->arrPathinfo = pathinfo(TL_ROOT . '/' . $this->strFile);
                 }
                 \Cache::set($strCacheKey, strtolower($this->arrPathinfo['extension']));
                 break;
             case 'filename':
                 \Cache::set($strCacheKey, basename($this->basename, '.' . $this->extension));
                 break;
             case 'mime':
                 \Cache::set($strCacheKey, $this->getMimeType());
                 break;
             case 'hash':
                 \Cache::set($strCacheKey, $this->getHash());
                 break;
             case 'ctime':
                 \Cache::set($strCacheKey, filectime(TL_ROOT . '/' . $this->strFile));
                 break;
             case 'mtime':
                 \Cache::set($strCacheKey, filemtime(TL_ROOT . '/' . $this->strFile));
                 break;
             case 'atime':
                 \Cache::set($strCacheKey, fileatime(TL_ROOT . '/' . $this->strFile));
                 break;
             case 'icon':
                 \Cache::set($strCacheKey, $this->getIcon());
                 break;
             case 'path':
             case 'value':
                 \Cache::set($strCacheKey, $this->strFile);
                 break;
             case 'width':
                 if (empty($this->arrImageSize)) {
                     $this->arrImageSize = @getimagesize(TL_ROOT . '/' . $this->strFile);
                 }
                 \Cache::set($strCacheKey, $this->arrImageSize[0]);
                 break;
             case 'height':
                 if (empty($this->arrImageSize)) {
                     $this->arrImageSize = @getimagesize(TL_ROOT . '/' . $this->strFile);
                 }
                 \Cache::set($strCacheKey, $this->arrImageSize[1]);
                 break;
             case 'isGdImage':
                 \Cache::set($strCacheKey, in_array($this->extension, array('gif', 'jpg', 'jpeg', 'png')));
                 break;
             case 'handle':
                 if (!is_resource($this->resFile)) {
                     $this->resFile = fopen(TL_ROOT . '/' . $this->strFile, 'rb');
                 }
                 return $this->resFile;
                 break;
             default:
                 return parent::__get($strKey);
                 break;
         }
     }
     return \Cache::get($strCacheKey);
 }
Ejemplo n.º 8
0
 /**
  * Return an object property
  *
  * @param string $strKey The property name
  *
  * @return mixed The property value
  */
 public function __get($strKey)
 {
     switch ($strKey) {
         case 'hash':
             return $this->getHash();
             break;
         case 'name':
         case 'basename':
             if (!isset($this->arrPathinfo[$strKey])) {
                 $this->arrPathinfo = $this->getPathinfo();
             }
             return $this->arrPathinfo['basename'];
             break;
         case 'dirname':
         case 'filename':
             if (!isset($this->arrPathinfo[$strKey])) {
                 $this->arrPathinfo = $this->getPathinfo();
             }
             return $this->arrPathinfo[$strKey];
             break;
         case 'path':
         case 'value':
             return $this->strFolder;
             break;
         case 'size':
             return $this->getSize();
             break;
         case 'ctime':
             return filectime(TL_ROOT . '/' . $this->strFolder);
             break;
         case 'mtime':
             return filemtime(TL_ROOT . '/' . $this->strFolder);
             break;
         case 'atime':
             return fileatime(TL_ROOT . '/' . $this->strFolder);
             break;
         default:
             return parent::__get($strKey);
             break;
     }
 }
Ejemplo n.º 9
0
Archivo: File.php Proyecto: eknoes/core
 /**
  * Return an object property
  *
  * @param string $strKey The property name
  *
  * @return mixed The property value
  */
 public function __get($strKey)
 {
     switch ($strKey) {
         case 'size':
         case 'filesize':
             return filesize(TL_ROOT . '/' . $this->strFile);
             break;
         case 'name':
         case 'basename':
             if (!isset($this->arrPathinfo[$strKey])) {
                 $this->arrPathinfo = $this->getPathinfo();
             }
             return $this->arrPathinfo['basename'];
             break;
         case 'dirname':
         case 'filename':
             if (!isset($this->arrPathinfo[$strKey])) {
                 $this->arrPathinfo = $this->getPathinfo();
             }
             return $this->arrPathinfo[$strKey];
         case 'extension':
             if (!isset($this->arrPathinfo['extension'])) {
                 $this->arrPathinfo = $this->getPathinfo();
             }
             return strtolower($this->arrPathinfo['extension']);
             break;
         case 'origext':
             if (!isset($this->arrPathinfo['extension'])) {
                 $this->arrPathinfo = $this->getPathinfo();
             }
             return $this->arrPathinfo['extension'];
             break;
         case 'tmpname':
             return basename($this->strTmp);
             break;
         case 'path':
         case 'value':
             return $this->strFile;
             break;
         case 'mime':
             return $this->getMimeType();
             break;
         case 'hash':
             return $this->getHash();
             break;
         case 'ctime':
             return filectime(TL_ROOT . '/' . $this->strFile);
             break;
         case 'mtime':
             return filemtime(TL_ROOT . '/' . $this->strFile);
             break;
         case 'atime':
             return fileatime(TL_ROOT . '/' . $this->strFile);
             break;
         case 'icon':
             return $this->getIcon();
             break;
         case 'imageSize':
             if (empty($this->arrImageSize)) {
                 if ($this->isGdImage) {
                     $this->arrImageSize = @getimagesize(TL_ROOT . '/' . $this->strFile);
                 } elseif ($this->isSvgImage) {
                     $doc = new \DOMDocument();
                     if ($this->extension == 'svgz') {
                         $doc->loadXML(gzdecode($this->getContent()));
                     } else {
                         $doc->loadXML($this->getContent());
                     }
                     $svgElement = $doc->documentElement;
                     if ($svgElement->getAttribute('width') && $svgElement->getAttribute('height') && substr(rtrim($svgElement->getAttribute('width')), -1) != '%' && substr(rtrim($svgElement->getAttribute('height')), -1) != '%') {
                         $this->arrImageSize = array(\Image::getPixelValue($svgElement->getAttribute('width')), \Image::getPixelValue($svgElement->getAttribute('height')));
                     }
                     if ($this->arrImageSize && $this->arrImageSize[0] && $this->arrImageSize[1]) {
                         $this->arrImageSize[2] = 0;
                         // replace this with IMAGETYPE_SVG when it becomes available
                         $this->arrImageSize[3] = 'width="' . $this->arrImageSize[0] . '" height="' . $this->arrImageSize[1] . '"';
                         $this->arrImageSize['bits'] = 8;
                         $this->arrImageSize['channels'] = 3;
                         $this->arrImageSize['mime'] = $this->getMimeType();
                     } else {
                         $this->arrImageSize = false;
                     }
                 }
             }
             return $this->arrImageSize;
             break;
         case 'width':
             return $this->imageSize[0];
             break;
         case 'height':
             return $this->imageSize[1];
             break;
         case 'imageViewSize':
             if (empty($this->arrImageViewSize)) {
                 if ($this->imageSize) {
                     $this->arrImageViewSize = array($this->imageSize[0], $this->imageSize[1]);
                 } elseif ($this->isSvgImage) {
                     $doc = new \DOMDocument();
                     if ($this->extension == 'svgz') {
                         $doc->loadXML(gzdecode($this->getContent()));
                     } else {
                         $doc->loadXML($this->getContent());
                     }
                     $svgElement = $doc->documentElement;
                     if ($svgElement->getAttribute('viewBox')) {
                         $svgViewBox = preg_split('/[\\s,]+/', $svgElement->getAttribute('viewBox'));
                         $this->arrImageViewSize = array(intval($svgViewBox[2]), intval($svgViewBox[3]));
                     }
                     if (!$this->arrImageViewSize || !$this->arrImageViewSize[0] || !$this->arrImageViewSize[1]) {
                         $this->arrImageViewSize = false;
                     }
                 }
             }
             return $this->arrImageViewSize;
             break;
         case 'viewWidth':
             return $this->imageViewSize[0];
             break;
         case 'viewHeight':
             return $this->imageViewSize[1];
             break;
         case 'isImage':
             return $this->isGdImage || $this->isSvgImage;
             break;
         case 'isGdImage':
             return in_array($this->extension, array('gif', 'jpg', 'jpeg', 'png'));
             break;
         case 'isSvgImage':
             return in_array($this->extension, array('svg', 'svgz'));
             break;
         case 'channels':
             return $this->imageSize['channels'];
             break;
         case 'bits':
             return $this->imageSize['bits'];
             break;
         case 'isRgbImage':
             return $this->channels == 3;
             break;
         case 'isCmykImage':
             return $this->channels == 4;
             break;
         case 'handle':
             if (!is_resource($this->resFile)) {
                 $this->resFile = fopen(TL_ROOT . '/' . $this->strFile, 'rb');
             }
             return $this->resFile;
             break;
         default:
             return parent::__get($strKey);
             break;
     }
 }
Ejemplo n.º 10
0
 /**
  * Return a cache entry
  * 
  * @param string $strKey The cache key
  * 
  * @return mixed|null The cached data
  * 
  * @deprecated Use Cache::get() instead
  */
 public function __get($strKey)
 {
     if (static::has($strKey)) {
         return static::get($strKey);
     }
     return parent::__get($strKey);
 }