Skip to content
Code-Schnipsel Gruppen Projekte
Commit 7deab9f9 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

psr-2

Übergeordneter 2f3e590d
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
werden angezeigt mit 128 Ergänzungen und 154 Löschungen
......@@ -22,35 +22,35 @@ class Brick extends QUI\QDOM
*
* @var
*/
protected $_id = false;
protected $id = false;
/**
* Brick settings
*
* @var array
*/
protected $_settings = array();
protected $settings = array();
/**
* Fields can be overwritten by another user
*
* @var array
*/
protected $_customfields = array();
protected $customfields = array();
/**
* Internal control
*
* @var null
*/
protected $_Control = null;
protected $Control = null;
/**
* List of extra css classes
*
* @var array
*/
protected $_cssClasses = array();
protected $cssClasses = array();
/**
* Constructor
......@@ -61,15 +61,15 @@ public function __construct($params = array())
{
// default
$default = array(
'type' => 'content',
'content' => '',
'title' => '',
'type' => 'content',
'content' => '',
'title' => '',
'description' => '',
'project' => '',
'areas' => '',
'height' => '',
'width' => '',
'classes' => ''
'project' => '',
'areas' => '',
'height' => '',
'width' => '',
'classes' => ''
);
$this->setAttributes($default);
......@@ -81,7 +81,7 @@ public function __construct($params = array())
}
if (isset($params['id'])) {
$this->_id = $params['id'];
$this->id = $params['id'];
}
// default settings from control
......@@ -93,16 +93,16 @@ public function __construct($params = array())
);
foreach ($availableSettings as $entry) {
$this->_settings[$entry['name']] = false;
$this->settings[$entry['name']] = false;
}
// control default settings
if (is_object($Control)) {
$controlSettings = $Control->getAttributes();
foreach ($this->_settings as $key => $value) {
foreach ($this->settings as $key => $value) {
if (isset($controlSettings[$key])) {
$this->_settings[$key] = $controlSettings[$key];
$this->settings[$key] = $controlSettings[$key];
}
}
}
......@@ -116,9 +116,9 @@ public function __construct($params = array())
}
if (is_array($settings)) {
foreach ($this->_settings as $key => $value) {
foreach ($this->settings as $key => $value) {
if (isset($settings[$key])) {
$this->_settings[$key] = $settings[$key];
$this->settings[$key] = $settings[$key];
}
}
}
......@@ -133,7 +133,7 @@ public function __construct($params = array())
}
if (is_array($customfields)) {
$this->_customfields = $customfields;
$this->customfields = $customfields;
}
}
}
......@@ -185,12 +185,11 @@ public function check()
public function create()
{
if ($this->getAttribute('type') == 'content') {
$_classes = array(
'brick-' . $this->_id
'brick-' . $this->id
);
foreach ($this->_cssClasses as $cssClass) {
foreach ($this->cssClasses as $cssClass) {
$_classes[] = $cssClass;
}
......@@ -231,11 +230,11 @@ public function create()
}
}
if ($this->_id) {
$Control->addCSSClass('brick-' . $this->_id);
if ($this->id) {
$Control->addCSSClass('brick-' . $this->id);
}
foreach ($this->_cssClasses as $cssClass) {
foreach ($this->cssClasses as $cssClass) {
$Control->addCSSClass($cssClass);
}
......@@ -249,8 +248,8 @@ public function create()
*/
protected function getControl()
{
if ($this->_Control) {
return $this->_Control;
if ($this->Control) {
return $this->Control;
}
$Ctrl = $this->getAttribute('type');
......@@ -275,7 +274,7 @@ protected function getControl()
return false;
}
$this->_Control = $Control;
$this->Control = $Control;
return $Control;
}
......@@ -287,7 +286,7 @@ protected function getControl()
*/
public function getSettings()
{
return $this->_settings;
return $this->settings;
}
/**
......@@ -313,8 +312,8 @@ public function setSettings($settings)
*/
public function getSetting($name)
{
if (isset($this->_settings[$name])) {
return $this->_settings[$name];
if (isset($this->settings[$name])) {
return $this->settings[$name];
}
return false;
......@@ -323,15 +322,15 @@ public function getSetting($name)
/**
* Set a brick setting
*
* @param string $name - name of the setting
* @param string $name - name of the setting
* @param string $value - value of the setting
*
* @return void
*/
public function setSetting($name, $value)
{
if (isset($this->_settings[$name])) {
$this->_settings[$name] = $value;
if (isset($this->settings[$name])) {
$this->settings[$name] = $value;
}
}
......@@ -342,7 +341,7 @@ public function setSetting($name, $value)
*/
public function getCustomFields()
{
return $this->_customfields;
return $this->customfields;
}
/**
......@@ -354,7 +353,7 @@ public function getCustomFields()
*/
public function addCSSClass($cssClass)
{
$this->_cssClasses[] = $cssClass;
$this->cssClasses[] = $cssClass;
}
/**
......@@ -372,11 +371,11 @@ public function hasCSSClass($pattern)
return true;
}
if (empty($this->_cssClasses)) {
if (empty($this->cssClasses)) {
return false;
}
foreach ($this->_cssClasses as $cssClass) {
foreach ($this->cssClasses as $cssClass) {
if (fnmatch($pattern, $cssClass)) {
return true;
}
......
......@@ -18,7 +18,7 @@ class Banner extends QUI\Control
/**
* constructor
*
* @param Array $attributes
* @param array $attributes
*/
public function __construct($attributes = array())
{
......
......@@ -18,21 +18,21 @@ class BoxContent extends QUI\Control
/**
* constructor
*
* @param Array $attributes
* @param array $attributes
*/
public function __construct($attributes = array())
{
// default options
$this->setAttributes(array(
'title' => 'Box Content',
'title' => 'Box Content',
'contentList' => false,
'entries' => array()
'entries' => array()
));
parent::__construct($attributes);
$this->addCSSFile(
dirname(__FILE__).'/BoxContent.css'
dirname(__FILE__) . '/BoxContent.css'
);
}
......@@ -43,18 +43,17 @@ public function __construct($attributes = array())
*/
public function getBody()
{
$Engine = QUI::getTemplateManager()->getEngine();
$Engine = QUI::getTemplateManager()->getEngine();
$entries = $this->getAttribute('entries');
if (is_string($entries)) {
$entries = json_decode($entries, true);
}
$count = count($entries);
$count = count($entries);
$extraClass = '';
switch ($count) {
case 1:
$extraClass = ' box-content-entry-1';
break;
......@@ -88,15 +87,12 @@ public function getBody()
}
$Engine->assign(array(
'this' => $this,
'entries' => $entries,
'entries' => $entries,
'extraClass' => $extraClass
));
return $Engine->fetch(dirname(__FILE__).'/BoxContent.html');
return $Engine->fetch(dirname(__FILE__) . '/BoxContent.html');
}
}
\ No newline at end of file
}
......@@ -18,21 +18,21 @@ class ContentSwitcher extends QUI\Control
/**
* constructor
*
* @param Array $attributes
* @param array $attributes
*/
public function __construct($attributes = array())
{
// default options
$this->setAttributes(array(
'title' => 'Content Switcher',
'title' => 'Content Switcher',
'contentList' => false,
'entries' => array()
'entries' => array()
));
parent::__construct($attributes);
$this->addCSSFile(
dirname(__FILE__).'/ContentSwitcher.css'
dirname(__FILE__) . '/ContentSwitcher.css'
);
}
......@@ -43,7 +43,7 @@ public function __construct($attributes = array())
*/
public function getBody()
{
$Engine = QUI::getTemplateManager()->getEngine();
$Engine = QUI::getTemplateManager()->getEngine();
$entries = $this->getAttribute('entries');
if (is_string($entries)) {
......@@ -51,11 +51,11 @@ public function getBody()
}
$Engine->assign(array(
'this' => $this,
'this' => $this,
'entries' => $entries
));
return $Engine->fetch(dirname(__FILE__).'/ContentSwitcher.html');
return $Engine->fetch(dirname(__FILE__) . '/ContentSwitcher.html');
}
}
\ No newline at end of file
}
......@@ -13,14 +13,12 @@
*
* @package quiqqer/bricks
*/
class Image extends QUI\Control
{
/**
* constructor
*
* @param Array $attributes
* @param array $attributes
*/
public function __construct($attributes = array())
{
......@@ -37,7 +35,6 @@ public function __construct($attributes = array())
);
}
/**
* (non-PHPdoc)
*
......@@ -50,16 +47,12 @@ public function getBody()
$brickLink = $this->getAttribute('link');
$Engine->assign(array(
'this' => $this,
'brickImage' => $brickImage,
'brickLink' => $brickLink
'this' => $this,
'brickImage' => $brickImage,
'brickLink' => $brickLink
));
return $Engine->fetch(dirname(__FILE__).'/Image.html');
return $Engine->fetch(dirname(__FILE__) . '/Image.html');
}
}
......@@ -33,7 +33,7 @@ class Pagination extends QUI\Control
/**
* constructor
*
* @param Array $attributes
* @param array $attributes
*/
public function __construct($attributes = array())
{
......@@ -237,7 +237,7 @@ public function getSQLParams()
if ($this->getAttribute('order')) {
$result['order'] = $this->getAttribute('order');
}
return $result;
}
......@@ -266,7 +266,6 @@ public function setGetParams($name, $value)
$value = QUI\Utils\Security\Orthos::clearFormRequest($value);
if (empty($value)) {
if (isset($this->_getParams[$name])) {
unset($this->_getParams[$name]);
}
......@@ -289,7 +288,6 @@ public function setUrlParams($name, $value)
$value = QUI\Utils\Security\Orthos::clear($value);
if (empty($value)) {
if (isset($this->_urlParams[$name])) {
unset($this->_urlParams[$name]);
}
......
......@@ -18,7 +18,7 @@ class SideBox1 extends QUI\Control
/**
* constructor
*
* @param Array $attributes
* @param array $attributes
*/
public function __construct($attributes = array())
{
......@@ -48,7 +48,7 @@ public function getBody()
$Engine->assign(array(
'this' => $this,
'Site' => $this->_getSite()
'Site' => $this->getSite()
));
return $Engine->fetch(dirname(__FILE__) . '/SideBox1.html');
......@@ -59,7 +59,7 @@ public function getBody()
*
* @return QUI\Projects\Site
*/
protected function _getSite()
protected function getSite()
{
$Project = $this->_getProject();
$site = $this->getAttribute('site');
......@@ -97,7 +97,7 @@ protected function _getSite()
}
$children = QUI\Projects\Site\Utils::getSitesByInputList(
$this->_getProject(),
$this->getProject(),
$this->getAttribute('site'),
array(
'limit' => 1,
......@@ -111,4 +111,4 @@ protected function _getSite()
return $Project->firstChild();
}
}
\ No newline at end of file
}
......@@ -18,7 +18,7 @@ class SideBox2 extends QUI\Control
/**
* constructor
*
* @param Array $attributes
* @param array $attributes
*/
public function __construct($attributes = array())
{
......@@ -75,7 +75,7 @@ public function getBody()
}
$children = QUI\Projects\Site\Utils::getSitesByInputList(
$this->_getProject(),
$this->getProject(),
$this->getAttribute('site'),
array(
'limit' => $limit,
......@@ -90,4 +90,4 @@ public function getBody()
return $Engine->fetch(dirname(__FILE__) . '/SideBox2.html');
}
}
\ No newline at end of file
}
......@@ -18,7 +18,7 @@ class SideBox3 extends QUI\Control
/**
* constructor
*
* @param Array $attributes
* @param array $attributes
*/
public function __construct($attributes = array())
{
......@@ -75,7 +75,7 @@ public function getBody()
}
$children = QUI\Projects\Site\Utils::getSitesByInputList(
$this->_getProject(),
$this->getProject(),
$this->getAttribute('site'),
array(
'limit' => $limit,
......@@ -90,4 +90,4 @@ public function getBody()
return $Engine->fetch(dirname(__FILE__) . '/SideBox3.html');
}
}
\ No newline at end of file
}
......@@ -23,7 +23,7 @@ class SideBox3TitleTop extends QUI\Bricks\Controls\SideBox3
public function getBody()
{
$Engine = QUI::getTemplateManager()->getEngine();
$limit = $this->getAttribute('limit');
$limit = $this->getAttribute('limit');
if (!$limit) {
$limit = 3;
......@@ -50,7 +50,7 @@ public function getBody()
}
$children = QUI\Projects\Site\Utils::getSitesByInputList(
$this->_getProject(),
$this->getProject(),
$this->getAttribute('site'),
array(
'limit' => $limit,
......@@ -58,12 +58,11 @@ public function getBody()
)
);
$Engine->assign(array(
'this' => $this,
'children' => $children
));
return $Engine->fetch(dirname(__FILE__).'/SideBox3TitleTop.html');
return $Engine->fetch(dirname(__FILE__) . '/SideBox3TitleTop.html');
}
}
......@@ -18,7 +18,7 @@ class SideBox4 extends QUI\Control
/**
* constructor
*
* @param Array $attributes
* @param array $attributes
*/
public function __construct($attributes = array())
{
......@@ -73,7 +73,7 @@ public function getBody()
}
$children = QUI\Projects\Site\Utils::getSitesByInputList(
$this->_getProject(),
$this->getProject(),
$this->getAttribute('site'),
array(
'limit' => $limit,
......@@ -88,4 +88,4 @@ public function getBody()
return $Engine->fetch(dirname(__FILE__) . '/SideBox4.html');
}
}
\ No newline at end of file
}
......@@ -18,7 +18,7 @@ class SimpleGoogleMaps extends QUI\Control
/**
* constructor
*
* @param Array $attributes
* @param array $attributes
*/
public function __construct($attributes = array())
{
......@@ -56,7 +56,7 @@ public function getBody()
$url = 'https://www.google.com/maps/embed/v1/place?' . $query . "&zoom=" . $zoom . "&";
$Engine->assign(array(
'url' => $url
'url' => $url
));
return $Engine->fetch(dirname(__FILE__) . '/SimpleGoogleMaps.html');
......
......@@ -18,7 +18,7 @@ class SocialBox extends QUI\Control
/**
* constructor
*
* @param Array $attributes
* @param array $attributes
*/
public function __construct($attributes = array())
{
......@@ -31,7 +31,7 @@ public function __construct($attributes = array())
parent::setAttributes($attributes);
$this->addCSSFile(
dirname(__FILE__).'/SocialBox.css'
dirname(__FILE__) . '/SocialBox.css'
);
}
......@@ -42,20 +42,18 @@ public function __construct($attributes = array())
*/
public function getBody()
{
$Engine = QUI::getTemplateManager()->getEngine();
$Engine = QUI::getTemplateManager()->getEngine();
$socialList = $this->getAttribute('socialList');
if ($socialList) {
$socialList = json_decode($socialList, true);
}
$Engine->assign(array(
'this' => $this,
'socialList' => $socialList
));
return $Engine->fetch(dirname(__FILE__).'/SocialBox.html');
return $Engine->fetch(dirname(__FILE__) . '/SocialBox.html');
}
}
\ No newline at end of file
}
......@@ -84,11 +84,11 @@ public function createBrickForProject(Project $Project, Brick $Brick)
QUI::getDataBase()->insert(
$this->getTable(),
array(
'project' => $Project->getName(),
'lang' => $Project->getLang(),
'title' => $Brick->getAttribute('title'),
'project' => $Project->getName(),
'lang' => $Project->getLang(),
'title' => $Brick->getAttribute('title'),
'description' => $Brick->getAttribute('description'),
'type' => $Brick->getAttribute('type')
'type' => $Brick->getAttribute('type')
)
);
......@@ -220,19 +220,18 @@ public function getAvailableBricks()
return QUI\Cache\Manager::get($cache);
} catch (QUI\Exception $Exception) {
}
$xmlFiles = $this->getBricksXMLFiles();
$result = array();
$result[] = array(
'title' => array('quiqqer/bricks', 'brick.content.title'),
'title' => array('quiqqer/bricks', 'brick.content.title'),
'description' => array(
'quiqqer/bricks',
'brick.content.description'
),
'control' => 'content'
'control' => 'content'
);
foreach ($xmlFiles as $bricksXML) {
......@@ -260,7 +259,7 @@ public function getBrickById($id)
}
$data = QUI::getDataBase()->fetch(array(
'from' => $this->getTable(),
'from' => $this->getTable(),
'where' => array(
'id' => (int)$id
),
......@@ -296,7 +295,6 @@ public function getAvailableBrickSettingsByBrickType($brickType)
return QUI\Cache\Manager::get($cache);
} catch (QUI\Exception $Exception) {
}
......@@ -327,22 +325,18 @@ public function getAvailableBrickSettingsByBrickType($brickType)
foreach ($optionElements as $Option) {
$options[] = array(
'value' => $Option->getAttribute('value'),
'text' => QUI\Utils\DOM::getTextFromNode(
$Option, false
)
'text' => QUI\Utils\DOM::getTextFromNode($Option, false)
);
}
}
$settings[] = array(
'name' => $Setting->getAttribute('name'),
'text' => QUI\Utils\DOM::getTextFromNode(
$Setting, false
),
'type' => $Setting->getAttribute('type'),
'class' => $Setting->getAttribute('class'),
'name' => $Setting->getAttribute('name'),
'text' => QUI\Utils\DOM::getTextFromNode($Setting, false),
'type' => $Setting->getAttribute('type'),
'class' => $Setting->getAttribute('class'),
'data-qui' => $Setting->getAttribute('data-qui'),
'options' => $options
'options' => $options
);
}
......@@ -391,7 +385,6 @@ public function getBricksByArea($brickArea, Site $Site)
$result = array();
foreach ($bricks as $brickData) {
$brickId = (int)$brickData['brickId'];
try {
......@@ -432,10 +425,10 @@ public function getBricksFromProject(Project $Project)
$result = array();
$list = QUI::getDataBase()->fetch(array(
'from' => $this->getTable(),
'from' => $this->getTable(),
'where' => array(
'project' => $Project->getName(),
'lang' => $Project->getLang()
'lang' => $Project->getLang()
)
));
......@@ -500,9 +493,7 @@ public function saveBrick($brickId, array $brickData)
// fields
if (isset($brickData['attributes'])) {
foreach ($brickData['attributes'] as $key => $value) {
if ($key == 'areas') {
continue;
}
......@@ -542,16 +533,16 @@ public function saveBrick($brickId, array $brickData)
// update
QUI::getDataBase()->update($this->getTable(), array(
'title' => $Brick->getAttribute('title'),
'description' => $Brick->getAttribute('description'),
'content' => $Brick->getAttribute('content'),
'type' => $Brick->getAttribute('type'),
'settings' => json_encode($Brick->getSettings()),
'title' => $Brick->getAttribute('title'),
'description' => $Brick->getAttribute('description'),
'content' => $Brick->getAttribute('content'),
'type' => $Brick->getAttribute('type'),
'settings' => json_encode($Brick->getSettings()),
'customfields' => json_encode($customfields),
'areas' => $areaString,
'height' => $Brick->getAttribute('height'),
'width' => $Brick->getAttribute('width'),
'classes' => $Brick->getAttribute('classes')
'areas' => $areaString,
'height' => $Brick->getAttribute('height'),
'width' => $Brick->getAttribute('width'),
'classes' => $Brick->getAttribute('classes')
), array(
'id' => (int)$brickId
));
......@@ -580,7 +571,6 @@ protected function getBricksXMLFiles()
return QUI\Cache\Manager::get($cache);
} catch (QUI\Exception $Exception) {
}
$PKM = QUI::getPackageManager();
......@@ -664,11 +654,10 @@ protected function getInheritedBricks($brickArea, Site $Site)
);
foreach ($parentIds as $parentId) {
$bricks = QUI::getDataBase()->fetch(array(
'from' => $projectCacheTable,
'from' => $projectCacheTable,
'where' => array(
'id' => $parentId,
'id' => $parentId,
'area' => $brickArea
)
));
......
......@@ -26,7 +26,7 @@ class Utils
*
* @return array
*/
static function getBricksFromXML($file)
public static function getBricksFromXML($file)
{
if (!file_exists($file)) {
return array();
......@@ -57,7 +57,7 @@ static function getBricksFromXML($file)
*
* @return array
*/
static function getTemplateAreasFromXML($file, $layoutType = false)
public static function getTemplateAreasFromXML($file, $layoutType = false)
{
if (!file_exists($file)) {
return array();
......@@ -97,14 +97,16 @@ static function getTemplateAreasFromXML($file, $layoutType = false)
return $list;
}
static function getGlobalTemplateAreasFromXML()
public static function getGlobalTemplateAreasFromXML()
{
}
static function getTypeTemplateAreasFromXML($file, $siteType)
/**
* @param $file
* @param $siteType
*/
public static function getTypeTemplateAreasFromXML($file, $siteType)
{
}
......@@ -117,7 +119,7 @@ static function getTypeTemplateAreasFromXML($file, $siteType)
*
* @return array
*/
static function parseAreaToArray(\DOMElement $Brick, \DOMXPath $Path)
public static function parseAreaToArray(\DOMElement $Brick, \DOMXPath $Path)
{
$control = $Brick->getAttribute('control');
$name = $Brick->getAttribute('name');
......@@ -130,21 +132,21 @@ static function parseAreaToArray(\DOMElement $Brick, \DOMXPath $Path)
if ($titleLocale->length) {
$title = array(
'group' => $titleLocale->item(0)->getAttribute('group'),
'var' => $titleLocale->item(0)->getAttribute('var')
'var' => $titleLocale->item(0)->getAttribute('var')
);
}
if ($descLocale->length) {
$description = array(
'group' => $descLocale->item(0)->getAttribute('group'),
'var' => $descLocale->item(0)->getAttribute('var')
'var' => $descLocale->item(0)->getAttribute('var')
);
}
return array(
'control' => $control,
'name' => $name,
'title' => $title,
'control' => $control,
'name' => $name,
'title' => $title,
'description' => $description,
'inheritance' => $Brick->getAttribute('inheritance')
);
......@@ -157,7 +159,7 @@ static function parseAreaToArray(\DOMElement $Brick, \DOMXPath $Path)
*
* @return bool
*/
static function hasInheritance(Project $Project, $areaName)
public static function hasInheritance(Project $Project, $areaName)
{
$template = $Project->getAttribute('template');
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren