Esempio n. 1
0
 /**
  * @param $column
  * @return string
  */
 public function __get($column)
 {
     if ($column == 'form_fields') {
         return $this->getService('com://admin/wufoo.model.api.fields')->id($this->hash)->getItem()->toArray();
     }
     return parent::__get($column);
 }
 public function __get($name)
 {
     if ($name == 'relation' && is_null($this->relation)) {
         $this->relation = $this->getService('com://admin/attachments.database.table.relations')->select(array('attachments_attachment_id' => $this->id), KDatabase::FETCH_ROW);
     }
     return parent::__get($name);
 }
Esempio n. 3
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);
 }
Esempio n. 4
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_ADMINISTRATOR . '/components/' . $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_ADMINISTRATOR . '/components/' . $this->option . '/config.xml';
         $this->_data['params'] = new JParameter($this->_data['params'], $file, 'component');
     }
     return parent::__get($column);
 }
Esempio n. 5
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 == 'manifest' && empty($this->_data['manifest'])) 
		{
            $file = JPATH_PLUGINS.'/'.$this->type.'/'.$this->name.'.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_PLUGINS.'/'.$this->type.'/'.$this->name.'.xml';
	        $this->_data['params'] = new JParameter( $this->_data['params'], $file, 'module' );
        }
	   
		return parent::__get($column);
	}
Esempio n. 6
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);
 }
 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();
                 }
             }
         }
     }
     return parent::__get($column);
 }
Esempio n. 8
0
 public function __get($key)
 {
     if ($key == 'category_title') {
         return $this->getService('com://admin/carousel.model.category')->id($this->carousel_category_id)->getItem()->title;
     } else {
         return parent::__get($key);
     }
 }
Esempio n. 9
0
 public function __get($column)
 {
     if ($column == 'params' && !$this->_data['params'] instanceof JParameter) {
         $file = JPATH_BASE . '/components/com_contacts/databases/rows/contact.xml';
         $params = new JParameter($this->_data['params']);
         $params->loadSetupFile($file);
         $this->_data['params'] = $params;
     }
     return parent::__get($column);
 }
Esempio n. 10
0
 /**
  * Specialized in order to dynamically get the type icon
  *
  * @TODO performance optimize this
  *
  * @param  	string 	The column name.
  */
 public function __get($column)
 {
     if ($column == 'type') {
         if (!isset($this->_type)) {
             $this->_type = MediaHelper::getTypeIcon($this->name);
         }
         return $this->_type;
     }
     return parent::__get($column);
 }
Esempio n. 11
0
 public function __get($key)
 {
     $value = parent::__get($key);
     if ($key == 'metadata' && is_string($value)) {
         // Try to decode it.
         $metadata = json_decode($value);
         if ($metadata !== null) {
             $value = $metadata;
         }
     }
     return $value;
 }
Esempio n. 12
0
 public function __get($column)
 {
     if ($column == 'params' && !$this->_data['params'] instanceof JParameter) {
         $file = JPATH_BASE . '/components/com_articles/databases/rows/article.xml';
         $params = new JParameter($this->_data['params']);
         $params->loadSetupFile($file);
         $this->_data['params'] = $params;
     }
     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);
 }
Esempio n. 13
0
 public function __get($column)
 {
     if ($column == 'params' && !$this->_data['params'] instanceof JParameter) {
         $xml_path = JPATH_ADMINISTRATOR . '/components/com_users/databases/rows';
         $xml_name = str_replace(' ', '_', strtolower($this->group_name));
         if (!file_exists($file = $xml_path . '/' . $xml_name . '.xml')) {
             $file = $xml_path . '/user.xml';
         }
         $params = new JParameter($this->_data['params']);
         $params->loadSetupFile($file);
         $this->_data['params'] = $params;
     }
     return parent::__get($column);
 }
Esempio n. 14
0
 /**
  * Retrieve row field value
  *
  * @param  	string 	The column name.
  * @return 	string 	The corresponding column value.
  */
 public function __get($column)
 {
     $result = parent::__get($column);
     if ($column != 'theme' || is_string($this->params) || !isset($this->params->board_details->theme)) {
         return $result;
     }
     if (!isset($this->_theme)) {
         if (!isset($this->_data['theme']) || !$this->_data['theme']) {
             $this->_data['theme'] = $this->params->board_details->theme;
         }
         $this->_theme = KInflector::humanize($this->_data['theme']);
     }
     return $this->_theme;
 }
Esempio n. 15
0
 /**
  * Retrieve row field value
  *
  * @param  	string 	The column name.
  * @return 	string 	The corresponding column value.
  */
 public function __get($column)
 {
     if ($column == 'usergroups') {
         if (!$this->_usergroups) {
             $ids = explode('|', $this->ninjaboard_usergroup_id);
             $this->_usergroups = KFactory::tmp('admin::com.ninjaboard.model.usergroups')->limit(0)->id($ids)->getList();
         }
         return $this->_usergroups;
     }
     if ($column == 'ninjaboard_usergroup_id') {
         if (!isset($this->_ninjaboard_usergroup_id)) {
             $original = parent::__get($column);
             $table = $this->getTable();
             $query = $table->getDatabase()->getQuery();
             $query->select("joomla_map.ninjaboard_gid AS ninjaboard_usergroup_id")->from('ninjaboard_joomla_user_group_maps AS joomla_map')->where('joomla_map.joomla_gid', '=', (int) $this->gid)->where('joomla_map.ninjaboard_gid', '!=', 0)->limit(1);
             $ninjaboard_usergroup_id = $table->getDatabase()->select($query, KDatabase::FETCH_FIELD, 'ninjaboard_usergroup_id');
             if ($this->id) {
                 $query = $table->getDatabase()->getQuery();
                 $query->select("ninjaboard_map.ninjaboard_user_group_id AS ninjaboard_usergroup_id")->from('ninjaboard_user_group_maps AS ninjaboard_map')->where('ninjaboard_map.joomla_user_id', '=', $this->id);
                 $groups = $table->getDatabase()->select($query, KDatabase::FETCH_FIELD_LIST);
                 $ninjaboard_usergroup_id = $groups ? implode('|', $groups) : $ninjaboard_usergroup_id;
             }
             $this->_ninjaboard_usergroup_id = $ninjaboard_usergroup_id;
         }
         return $this->_ninjaboard_usergroup_id;
     }
     if (strpos($column, '_permissions') !== false) {
         $object = str_replace('_permissions', '', $column);
         if (!isset($this->_permissions[$object])) {
             $table = KFactory::get('admin::com.ninjaboard.database.table.assets');
             $query = KFactory::tmp('lib.koowa.database.query');
             $gids = explode('|', $this->ninjaboard_usergroup_id);
             //If super admin, then the permission level is always 3
             if ($this->gid == 25) {
                 return $this->_permissions[$object] = 3;
             }
             $query->select('tbl.level')->from('ninjaboard_assets AS tbl')->order('tbl.level', 'DESC')->limit(1);
             $where = array();
             foreach ($gids as $gid) {
                 $where[] = 'com_ninjaboard.usergroup.' . $gid . '.' . $object;
             }
             if ($where) {
                 $query->where('tbl.name', 'in', $where);
             }
             $this->_permissions[$object] = $table->getDatabase()->select($query, KDatabase::FETCH_FIELD);
         }
         return $this->_permissions[$object];
     }
     return parent::__get($column);
 }
Esempio n. 16
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 == 'application' && empty($this->_data['application'])) {
         $client = JApplicationHelper::getClientInfo($this->client_id);
         $this->_data['application'] = $client->name;
     }
     if ($column == 'manifest' && empty($this->_data['manifest'])) {
         $client = JApplicationHelper::getClientInfo($this->application, true);
         $file = $client->path . '/modules/' . $this->type . '/' . $this->type . '.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) {
         $client = JApplicationHelper::getClientInfo($this->application, true);
         $file = $client->path . '/modules/' . $this->type . '/' . $this->type . '.xml';
         $this->_data['params'] = new JParameter($this->_data['params'], $file, 'module');
     }
     if ($column == 'pages' && !isset($this->_data['pages'])) {
         if (!$this->isNew()) {
             $table = $this->getService('com://admin/extensions.database.table.menus');
             $query = $table->getDatabase()->getQuery()->select('menuid')->where('moduleid', '=', $this->id);
             $pages = $table->select($query, KDatabase::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);
 }
Esempio n. 17
0
 public function __get($column)
 {
     if ($column == 'params' && !$this->_data['params'] instanceof JParameter) {
         $params = new JParameter($this->_data['params']);
         $this->_data['params'] = $params;
     }
     if ($column == 'type' && empty($this->_data['type'])) {
         if (trim($this->custombannercode)) {
             $type = 'custom';
         } elseif (preg_match('/.swf$/i', $this->imageurl)) {
             $type = 'flash';
         } else {
             $type = 'image';
         }
         $this->_data['type'] = $type;
     }
     return parent::__get($column);
 }
Esempio n. 18
0
 /**
  * Retrieve row field value
  *
  * @param  	string 	The column name.
  * @return 	string 	The corresponding column value.
  */
 public function __get($column)
 {
     $result = parent::__get($column);
     if (!in_array($column, array('usergroups', 'inherits'))) {
         return $result;
     }
     if ($column == 'usergroups') {
         if (!$this->_usergroups) {
             $ids = explode('|', $this->ninjaboard_usergroup_id);
             $this->_usergroups = KFactory::tmp('admin::com.ninjaboard.model.usergroups')->id($ids)->visible(KFactory::get('lib.joomla.application')->isSite())->limit(0)->getList();
         }
         return $this->_usergroups;
     }
     if ($column == 'inherits') {
         if (!isset($this->_inherits)) {
             //@TODO this should be optimized
             $this->_inherits = KFactory::tmp('admin::com.ninjaboard.model.usergroupmaps')->id($this->id)->getTotal() < 1;
         }
         return $this->_inherits;
     }
 }
Esempio n. 19
0
 public function __get($column)
 {
     $result = parent::__get($column);
     if (!empty($this->ancestors) && empty($result)) {
         $ancestors = json_decode($this->ancestors, true);
         if (is_array($ancestors) && array_key_exists($column, $ancestors)) {
             $result = $this->__getRelation('ancestors', $column);
             $this->setData(array($column => $result));
             return $result;
         }
     }
     if (!empty($this->descendants) && empty($result)) {
         $descendants = json_decode($this->descendants, true);
         if (is_array($descendants) && array_key_exists($column, $descendants) || isset($this->getRelations()->descendants->{$column}) && $this->getRelations()->descendants->{$column}->fallback == 1) {
             $result = $this->__getRelation('descendants', $column);
             $this->setData(array($column => $result));
             return $result;
         }
     }
     return $result;
 }
Esempio n. 20
0
 /**
  * Retrieve row field value
  *
  * @param  	string 	The column name.
  * @return 	string 	The corresponding column value.
  */
 public function __get($column)
 {
     $result = parent::__get($column);
     if ($column != 'params') {
         return $result;
     }
     if (!isset($this->_params)) {
         $identifier = clone $this->getIdentifier();
         $identifier->path = array('model');
         $identifier->name = 'settings';
         $defaults = KFactory::get($identifier)->getParams()->toArray();
         $params = is_string($result) ? json_decode($result, true) : $result;
         if ($params !== null) {
             $params = new KConfig($params);
             //@TODO Make this configurable, instead of hardcoding the defaults to only apply when JSite
             $params->append($defaults);
         } else {
             $params = $defaults;
         }
         $this->_params = $params;
     }
     return $this->_params;
 }
Esempio n. 21
0
 public function __get($column)
 {
     if ($column == 'image_path' && !isset($this->_data['image_path'])) {
         return $this->image ? KRequest::root() . '/joomlatools-files/docman-images/' . $this->image : null;
     }
     if ($column == 'icon') {
         if (!is_object($this->params)) {
             $this->params = json_decode($this->params);
         }
         $icon = $this->params->icon ? $this->params->icon : 'icon:default.png';
         return $icon;
     }
     if ($column == 'icon_path') {
         $icon = $this->icon;
         if (substr($icon, 0, 5) === 'icon:') {
             $icon = '/joomlatools-files/docman-icons/' . substr($icon, 5);
         } else {
             $icon = '/media/com_docman/images/icons/' . $icon;
         }
         return KRequest::root() . $icon;
     }
     if ($column == 'storage' && !isset($this->_data['storage'])) {
         return $this->getStorageInfo();
     }
     if (in_array($column, array('published', 'pending', 'expired'))) {
         return $this->{'is' . ucfirst($column)}();
     }
     if ($column === 'status') {
         return $this->isPublished() ? 'published' : ($this->isPending() ? 'pending' : 'expired');
     }
     if (in_array($column, array('size', 'mimetype', 'extension')) && $this->getStorageInfo()) {
         return $this->storage->{$column};
     }
     if ($column == 'category') {
         return $this->getService('com://admin/docman.model.categories')->id($this->docman_category_id)->getItem();
     }
     if ($column === 'description_summary') {
         $description = $this->description;
         $position = strpos($description, '<hr id="system-readmore" />');
         if ($position !== false) {
             return substr($description, 0, $position);
         }
         return $description;
     }
     if ($column === 'description_full') {
         return str_replace('<hr id="system-readmore" />', '', $this->description);
     }
     return parent::__get($column);
 }
Esempio n. 22
0
 public function __get($property)
 {
     if ($property === 'parent_ids') {
         $pieces = array_map('intval', explode('/', $this->path));
         array_pop($pieces);
         return $pieces;
     }
     if ($property === 'parent_path') {
         return substr($this->path, 0, strrpos($this->path, '/'));
     }
     if ($property === 'parent_slug_path' && empty($this->_data['parent_slug_path'])) {
         $parts = explode('/', $this->getSlugPath());
         array_pop($parts);
         if (is_array($parts)) {
             $this->_data['parent_slug_path'] = implode("/", $parts);
         }
     }
     if ($property === 'slug_path' && empty($this->_data['slug_path'])) {
         $this->_data['slug_path'] = $this->getSlugPath();
     }
     return parent::__get($property);
 }
Esempio n. 23
0
 public function __get($column)
 {
     switch ($column) {
         case 'left':
             return parent::__get($this->_left_column);
             break;
         case 'right':
             return parent::__get($this->_right_column);
             break;
         case 'level':
             return parent::__get($this->_level_column);
             break;
         case 'parent':
             return parent::__get($this->_parent_column);
             break;
         case 'children':
             return $this->getChildren();
             break;
         case 'descendants':
             return $this->getDescendants();
             break;
         case 'parents':
             return $this->getParents();
             break;
     }
     return parent::__get($column);
 }