예제 #1
0
 public function __get($column)
 {
     if ($column == 'text' && !isset($this->_data['text'])) {
         $this->_data['text'] = $this->fulltext ? $this->introtext . '<hr id="system-readmore" />' . $this->fulltext : $this->introtext;
     }
     return parent::__get($column);
 }
예제 #2
0
 public function __get($column)
 {
     if ($column == 'data' && is_string($this->_data['data'])) {
         $this->_data['data'] = json_decode($this->_data['data'], true);
     }
     return parent::__get($column);
 }
예제 #3
0
 /**
  * Get a value by key
  *
  * This method is specialized because of the magic property "description"
  * which reads from the plugin xml file
  *
  * @param   string  The key name.
  * @return  string  The corresponding value.
  */
 public function __get($column)
 {
     if ($column == 'title' && empty($this->_data['title'])) {
         if (!empty($this->manifest)) {
             $this->_data['title'] = $this->manifest->name;
         } else {
             $this->_data['title'] = '';
         }
     }
     if ($column == 'manifest' && empty($this->_data['manifest'])) {
         $file = JPATH_APPLICATION . '/component/' . $this->option . '/manifest.xml';
         if (file_exists($file)) {
             $this->_data['manifest'] = simplexml_load_file($file);
         } else {
             $this->_data['manifest'] = '';
         }
     }
     if (in_array($column, self::$_manifest_fields) && empty($this->_data[$column])) {
         $this->_data[$column] = isset($this->manifest->{$column}) ? $this->manifest->{$column} : '';
     }
     if ($column == 'params' && !$this->_data['params'] instanceof \JParameter) {
         $file = JPATH_APPLICATION . '/component/' . $this->option . '/config.xml';
         $this->_data['params'] = new \JParameter($this->_data['params'], $file, 'component');
     }
     return parent::__get($column);
 }
예제 #4
0
 public function __get($column)
 {
     if ($column == 'path' && !empty($this->_data['path'])) {
         $result = $this->_data['path'];
         // Prepend with site root if it is a relative path
         if ($this->adapter === 'local' && !preg_match('#^(?:[a-z]\\:|~*/)#i', $result)) {
             $result = JPATH_FILES . '/' . $result;
         }
         $result = rtrim(str_replace('\\', '/', $result), '\\');
         return $result;
     } else {
         if ($column == 'relative_path') {
             return $this->getRelativePath();
         } else {
             if ($column == 'path_value') {
                 return $this->_data['path'];
             } else {
                 if ($column == 'parameters' && !is_object($this->_data['parameters'])) {
                     return $this->getParameters();
                 } else {
                     if ($column == 'adapter') {
                         if (strpos($this->_data['path'], '://') !== false) {
                             return substr($this->_data['path'], 0, strpos($this->_data['path'], '://'));
                         } else {
                             return 'local';
                         }
                     }
                 }
             }
         }
     }
     return parent::__get($column);
 }
예제 #5
0
 public function __get($column)
 {
     if ($column == 'text' && !isset($this->_data['text'])) {
         $this->_data['text'] = $this->fulltext ? $this->introtext . '<hr id="system-readmore" />' . $this->fulltext : $this->introtext;
     }
     if ($column == 'params') {
         $this->_data['params'] = $this->getObject('object.config.factory')->getFormat('json')->fromString($this->_data['params']);
     }
     return parent::__get($column);
 }
예제 #6
0
 public function __get($column)
 {
     if ($column == 'params' && !$this->_data['params'] instanceof \JParameter) {
         $file = __DIR__ . '/contact.xml';
         $params = new \JParameter($this->_data['params']);
         $params->loadSetupFile($file);
         $this->_data['params'] = $params;
     }
     return parent::__get($column);
 }
예제 #7
0
 public function __get($column)
 {
     if ($column == 'params' && !$this->_data['params'] instanceof \JParameter) {
         $path = JPATH_APPLICATION . '/component/users/databases/rows';
         $name = str_replace(' ', '_', strtolower((string) $this->getRole()->name));
         $file = $path . '/' . $name . '.xml';
         if (!file_exists($file)) {
             $file = $path . '/user.xml';
         }
         $params = new \JParameter($this->_data['params']);
         $params->loadSetupFile($file);
         $this->_data['params'] = $params;
     }
     return parent::__get($column);
 }
예제 #8
0
 public function __get($name)
 {
     if ($name == 'relation' && !isset($this->relation)) {
         $this->relation = $this->getObject('com:attachments.database.table.relations')->select(array('attachments_attachment_id' => $this->id), Library\Database::FETCH_ROW);
     }
     if ($name == 'file' && !isset($this->file)) {
         $this->file = $this->getObject('com:files.model.files')->container($this->container)->folder($this->path)->name($this->name)->getRow();
     }
     if ($name == 'thumbnail' && !isset($this->thumbnail)) {
         $file = $this->file;
         if ($file && $file->isImage()) {
             $this->thumbnail = $this->getObject('com:files.controller.thumbnail')->container($this->container)->filename($this->path)->read();
         }
     }
     return parent::__get($name);
 }
예제 #9
0
 public function __get($name)
 {
     if ($name == 'relation' && !isset($this->relation)) {
         $this->relation = $this->getObject('com:attachments.database.table.relations')->select(array('attachments_attachment_id' => $this->id), Library\Database::FETCH_ROW);
     }
     if ($name == 'file' && !isset($this->file)) {
         $this->file = $this->getObject('com:files.model.files')->container($this->container)->name($this->path)->getRow();
     }
     if ($name == 'thumbnail' && !isset($this->thumbnail) && $this->file) {
         $path = pathinfo($this->path);
         $path['dirname'] = $path['dirname'] === '.' ? '' : $path['dirname'] . '/';
         $thumbnail = $path['dirname'] . $path['filename'] . '_thumb.' . $path['extension'];
         $this->thumbnail = $thumbnail;
     }
     if ($name == 'thumbnail_fullpath' && $this->file) {
         $this->thumbnail_fullpath = dirname($this->file->fullpath) . '/' . $this->thumbnail;
     }
     return parent::__get($name);
 }
예제 #10
0
 /**
  * Get a value by key
  *
  * This method is specialized because of the magic property "pages" which is in a 1:n relation with modules
  *
  * @param   string  The key name.
  * @return  string  The corresponding value.
  */
 public function __get($column)
 {
     if ($column == 'title' && empty($this->_data['title'])) {
         if ($this->manifest instanceof \SimpleXMLElement) {
             $this->_data['title'] = $this->manifest->name;
         } else {
             $this->_data['title'] = null;
         }
     }
     if ($column == 'identifier' && empty($this->_data['identifier'])) {
         $name = substr($this->name, 4);
         $package = substr($this->extension_name, 4);
         $this->_data['identifier'] = $this->getIdentifier('com:' . $package . '.module.' . $name . '.html');
     }
     if ($column == 'attribs' && empty($this->_data['attribs'])) {
         $this->_data['attribs'] = array();
     }
     if ($column == 'chrome' && empty($this->_data['chrome'])) {
         $this->_data['chrome'] = array();
     }
     if ($column == 'manifest' && empty($this->_data['manifest'])) {
         $path = dirname($this->identifier->classpath);
         $file = $path . '/' . basename($path) . '.xml';
         if (file_exists($file)) {
             $this->_data['manifest'] = simplexml_load_file($file);
         } else {
             $this->_data['manifest'] = '';
         }
     }
     if (in_array($column, self::$_manifest_fields) && empty($this->_data[$column])) {
         $this->_data[$column] = isset($this->manifest->{$column}) ? $this->manifest->{$column} : '';
     }
     if ($column == 'params' && !$this->_data['params'] instanceof \JParameter) {
         $path = dirname($this->identifier->classpath);
         $file = $path . '/config.xml';
         $this->_data['params'] = new \JParameter($this->_data['params'], $file, 'module');
     }
     if ($column == 'pages' && !isset($this->_data['pages'])) {
         if (!$this->isNew()) {
             $table = $this->getObject('com:pages.database.table.modules_pages');
             $query = $this->getObject('lib:database.query.select')->columns('pages_page_id')->where('pages_module_id = :id')->bind(array('id' => $this->id));
             $pages = $table->select($query, Library\Database::FETCH_FIELD_LIST);
             if (count($pages) == 1 && $pages[0] == 0) {
                 $pages = 'all';
             }
             if (!$pages) {
                 $pages = 'none';
             }
         } else {
             $pages = 'all';
         }
         $this->_data['pages'] = $pages;
     }
     return parent::__get($column);
 }