';
+ echo '';
+ echo <<
-WootookProfilerCallback(function(){
+(function(){
var sections = jQuery('.config-profiler');
sections.each(function(){
var element = jQuery(this);
@@ -460,13 +400,9 @@ jQuery('.config-profiler-link').click(function(e){
}
});
});
-});
+})();
JS_EOF;
- } else {
- echo 'Could not load application configuration.';
- }
- echo '';
}
public static function register()
@@ -474,7 +410,9 @@ JS_EOF;
set_error_handler(array(self::getSingleton(), 'errorManager'));
set_exception_handler(array(self::getSingleton(), 'exceptionManager'));
- self::getSingleton()->_mute = false;
+ if (defined('DEBUG')) {
+ self::getSingleton()->_mute = false;
+ }
if (self::$_isTraceRegistered === false && defined('DEBUG')) {
self::$_isTraceRegistered = true;
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Deletable.php b/src/application/code/core/Wootook/Core/Event.php
similarity index 92%
rename from src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Deletable.php
rename to src/application/code/core/Wootook/Core/Event.php
index 123eea7..42b4de7 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Deletable.php
+++ b/src/application/code/core/Wootook/Core/Event.php
@@ -28,12 +28,13 @@
*
*/
-namespace Wootook\Core\Mvc\Model\Action;
-
/**
+ *
+ * Enter description here ...
+ * @author Greg
*
*/
-interface Deletable
+class Wootook_Core_Event
+ extends Wootook_Object
{
- public function save();
-}
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Event/Break.php b/src/application/code/core/Wootook/Core/Event/Break.php
new file mode 100644
index 0000000..2722566
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Event/Break.php
@@ -0,0 +1,7 @@
+_adapter = $adapter;
+ }
+
+ public function getAdapter()
+ {
+ return $this->_adapter;
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Exception/Database/Error.php b/src/application/code/core/Wootook/Core/Exception/Database/Error.php
new file mode 100644
index 0000000..6d485fa
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Exception/Database/Error.php
@@ -0,0 +1,5 @@
+_statement = $statement;
+ }
+
+ public function getStatement()
+ {
+ return $this->_statement;
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Exception/Deprecated.php b/src/application/code/core/Wootook/Core/Exception/Deprecated.php
new file mode 100644
index 0000000..75cbf77
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Exception/Deprecated.php
@@ -0,0 +1,7 @@
+= 50300) {
+ parent::__construct($message, $code, $previous);
+ } else {
+ parent::__construct($message, $code);
+ $this->_previous = $previous;
+ }
+ }
+
+ public function __call($method, $params)
+ {
+ if (strtolower($method) == 'getprevious') {
+ return $this->_previous;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Exception/GameError.php b/src/application/code/core/Wootook/Core/Exception/GameError.php
new file mode 100644
index 0000000..ab228a8
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Exception/GameError.php
@@ -0,0 +1,7 @@
+= 50300) {
+ parent::__construct($message, $code, $previous);
+ } else {
+ parent::__construct($message, $code);
+ $this->_previous = $previous;
+ }
+ }
+
+ public function __call($method, $params)
+ {
+ if (strtolower($method) == 'getprevious') {
+ return $this->_previous;
+ }
+ }
+
+ public function __toString()
+ {
+ return <<_session = $session;
- $this->_elementLoader = new ElementLoader($this, array(
- 'Wootook\\Core\\Form\\Element' => 'Wootook/Core/Form/Element'
+ $this->_elementLoader = new Wootook_Core_Form_ElementLoader($this, array(
+ 'Wootook_Core_Form_Element_' => 'Wootook/Core/Form/Element'
));
- $this->_validatorLoader = new ValidatorLoader($this, array(
- 'Wootook\\Core\\Form\\Validator' => 'Wootook/Core/Form/Validator'
+ $this->_validatorLoader = new Wootook_Core_Form_ValidatorLoader($this, array(
+ 'Wootook_Core_Form_Validator_' => 'Wootook/Core/Form/Validator'
));
$this->addElement('__formkey', 'text', array('form_key' => 'formKey'));
@@ -102,7 +78,7 @@ class Form
foreach ($elements as $elementName => $elementConfig) {
if (is_string($elementConfig)) {
$this->addElement($elementName, $elementConfig);
- } else if ($elementConfig instanceof Element\BaseElement) {
+ } else if ($elementConfig instanceof Wootook_Core_Form_ElementAbstract) {
$this->addElement($elementName, $elementConfig);
} else {
if (isset($elementConfig['validators'])) {
@@ -114,11 +90,6 @@ class Form
}
}
- /**
- * Validated the form field values
- *
- * @return bool
- */
public function validate()
{
foreach ($this->_elements as $element) {
@@ -130,23 +101,23 @@ class Form
}
/**
- * Add a field element to the current form
*
+ * Enter description here ...
* @param string $name
- * @param string|Element\BaseElement $type
- * @return Form
+ * @param string|Wootook_Core_Form_ElementAbstract $type
+ * @return Wootook_Core_Form
*/
public function addElement($name, $type = 'text', Array $validators = array())
{
- if ($type instanceof Element\BaseElement) {
+ if ($type instanceof Wootook_Core_Form_ElementAbstract) {
$this->_elements[$name] = $type;
$this->_elements[$name]->setForm($this);
} else {
$element = $this->_elementLoader->load($type);
if ($element === null) {
- Profiler\ErrorProfiler::getSingleton()
- ->addException(new CoreException\RuntimeException(sprintf('Element %1$s (type: %2$s) could not be created.', $name, $type)));
+ Wootook_Core_ErrorProfiler::getSingleton()
+ ->addException(new Wootook_Core_Exception_RuntimeException(sprintf('Element %1$s (type: %2$s) could not be created.', $name, $type)));
return $this;
}
$element->setForm($this);
@@ -155,14 +126,14 @@ class Form
$this->_elements[$name]->setName($name);
foreach ($validators as $validatorName => $validatorType) {
- if ($validatorType instanceof Element\BaseElement) {
+ if ($validatorType instanceof Wootook_Core_Form_ElementAbstract) {
$this->_elements[$name]->addValidator($validatorType, $validatorName);
} else {
$validator = $this->_validatorLoader->load($validatorType);
if ($validator === null) {
- Profiler\ErrorProfiler::getSingleton()
- ->addException(new CoreException\RuntimeException(sprintf('Validator %1$s (type: %2$s) could not be created.', $validatorName, $validatorType)));
+ Wootook_Core_ErrorProfiler::getSingleton()
+ ->addException(new Wootook_Core_Exception_RuntimeException(sprintf('Validator %1$s (type: %2$s) could not be created.', $validatorName, $validatorType)));
return $this;
}
$this->_elements[$name]->addValidator($validator, $validatorName);
@@ -173,10 +144,10 @@ class Form
}
/**
- * Returns the form field element instance
*
+ * Enter description here ...
* @param string $name
- * @return Element\BaseElement
+ * @return Wootook_Core_Form_ElementAbstract
*/
public function getElement($name)
{
@@ -188,22 +159,17 @@ class Form
}
/**
- * Get the currently used session instance
*
- * @return Model\Session
+ * Enter description here ...
+ * @param string $name
+ * @return Wootook_Core_Model_Session
*/
public function getSession()
{
return $this->_session;
}
- /**
- * Use a new MVC request handler instance
- *
- * @param Request\Http $request
- * @return Form
- */
- public function setRequest(Request\Http $request)
+ public function setRequest(Wootook_Core_Mvc_Controller_Request_Http $request)
{
$this->_request = $request;
@@ -211,20 +177,15 @@ class Form
}
/**
- * Get the currently used MVC request handler
*
- * @return Request\Http
+ * Enter description here ...
+ * @return Wootook_Core_Mvc_Controller_Request_Http
*/
public function getRequest()
{
return $this->_request;
}
- /**
- * Return the validated and filtered form data
- *
- * @return array
- */
public function getData()
{
$request = $this->getRequest();
@@ -237,11 +198,6 @@ class Form
return $request->getAllQueryData();
}
- /**
- * Populates form fields using the data provided.
- *
- * @param array $datas
- */
public function populate(Array $datas = array())
{
$request = $this->getRequest();
@@ -256,4 +212,4 @@ class Form
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Form/Element/Button.php b/src/application/code/core/Wootook/Core/Form/Element/Button.php
new file mode 100644
index 0000000..4e17721
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Form/Element/Button.php
@@ -0,0 +1,11 @@
+
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-namespace Wootook\Core\Form\Element;
-
-use Wootook\Core\Form,
- Wootook\Core\Form\Validator;
-
-abstract class BaseElement
+abstract class Wootook_Core_Form_ElementAbstract
{
protected $_name = null;
protected $_form = null;
@@ -43,7 +10,7 @@ abstract class BaseElement
protected $_validators = array();
- public function __construct($name, $params = array(), Form\Form $form = null)
+ public function __construct($name, $params = array(), Wootook_Core_Form $form = null)
{
if ($form !== null) {
$this->setForm($form);
@@ -115,7 +82,7 @@ abstract class BaseElement
return $this;
}
- public function setForm(Form\Form $form)
+ public function setForm(Wootook_Core_Form $form)
{
$this->_form = $form;
@@ -139,7 +106,7 @@ abstract class BaseElement
return $this;
}
- public function addValidator(Validator\BaseValidator $validator, $name = null)
+ public function addValidator(Wootook_Core_Form_ValidatorAbstract $validator, $name = null)
{
if ($name === null) {
$this->_validators = array();
@@ -175,4 +142,4 @@ abstract class BaseElement
return $this;
}
-}
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Form/ElementLoader.php b/src/application/code/core/Wootook/Core/Form/ElementLoader.php
new file mode 100644
index 0000000..019f082
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Form/ElementLoader.php
@@ -0,0 +1,37 @@
+_form = $form;
+
+ foreach ($namespaces as $namespace => $path) {
+ if (is_int($namespace)) {
+ $this->registerNamespace($path);
+ } else {
+ $this->registerNamespace($namespace, $path);
+ }
+ }
+ }
+
+ protected function _load($className, $useSingleton, Array $constructorParams = array())
+ {
+ $reflection = new ReflectionClass($className);
+ if ($useSingleton && $reflection->implementsInterface('Wootook_Core_Singleton')) {
+ $method = $reflection->getMethod('getSingleton');
+ return $method->invoke(null);
+ }
+
+ try {
+ return $reflection->newInstance($this->_form);
+ } catch (ReflectionException $e) {
+ Wootook_Core_ErrorProfiler::getSingleton()
+ ->addException($e);
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Alnum.php b/src/application/code/core/Wootook/Core/Form/Validator/Alnum.php
new file mode 100644
index 0000000..cdacc4f
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Form/Validator/Alnum.php
@@ -0,0 +1,21 @@
+_validate($element, $data)) {
+ $this->_getSession($element)
+ ->addError('Field "%s" should only contain alphanumeric characters.', $element->getName());
+
+ return false;
+ }
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Alpha.php b/src/application/code/core/Wootook/Core/Form/Validator/Alpha.php
new file mode 100644
index 0000000..fb091ce
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Form/Validator/Alpha.php
@@ -0,0 +1,21 @@
+_validate($element, $data)) {
+ $this->_getSession($element)
+ ->addError('Field "%s" should only contain alphabetic characters.', $element->getName());
+
+ return false;
+ }
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Email.php b/src/application/code/core/Wootook/Core/Form/Validator/Email.php
new file mode 100644
index 0000000..3ec8e21
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Form/Validator/Email.php
@@ -0,0 +1,21 @@
+_validate($element, $data)) {
+ $this->_getSession($element)
+ ->addError('Field "%s" should contain an email.', $element->getName());
+
+ return false;
+ }
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Form/Validator/FormKey.php b/src/application/code/core/Wootook/Core/Form/Validator/FormKey.php
new file mode 100644
index 0000000..11f49d0
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Form/Validator/FormKey.php
@@ -0,0 +1,20 @@
+getForm();
+ $session = $form->getSession();
+
+ if ($session->getFormKey(false) == $data) {
+ return true;
+ }
+
+ $this->_getSession($field)
+ ->addError('CSRF token failure.', $field->getName());
+
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Hex.php b/src/application/code/core/Wootook/Core/Form/Validator/Hex.php
new file mode 100644
index 0000000..cbb2913
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Form/Validator/Hex.php
@@ -0,0 +1,22 @@
+_validate($element, $data)) {
+ $this->_getSession($element)
+ ->addError('Field "%s" should only contain numeric characters.', $element->getName());
+
+ return false;
+ }
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Host.php b/src/application/code/core/Wootook/Core/Form/Validator/Host.php
new file mode 100644
index 0000000..4d1f7f5
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Form/Validator/Host.php
@@ -0,0 +1,21 @@
+_validate($element, $data)) {
+ $this->_getSession($element)
+ ->addError('Field "%s" should contain a host name.', $element->getName());
+
+ return false;
+ }
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Numeric.php b/src/application/code/core/Wootook/Core/Form/Validator/Numeric.php
new file mode 100644
index 0000000..35f275d
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Form/Validator/Numeric.php
@@ -0,0 +1,22 @@
+_validate($element, $data)) {
+ $this->_getSession($element)
+ ->addError('Field "%s" should only contain numeric characters.', $element->getName());
+
+ return false;
+ }
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Form/Validator/Regex.php b/src/application/code/core/Wootook/Core/Form/Validator/Regex.php
new file mode 100644
index 0000000..172a787
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Form/Validator/Regex.php
@@ -0,0 +1,28 @@
+_expression = $expression;
+ }
+
+ public function validate(Wootook_Core_Form_ElementAbstract $element, $data)
+ {
+ if (!$this->_validate($element, $data)) {
+ $this->_getSession($element)
+ ->addError('Field "%s" does not match the validation pattern.', $element->getName());
+
+ return false;
+ }
+ return true;
+ }
+
+ protected function _validate(Wootook_Core_Form_ElementAbstract $element, $data)
+ {
+ return preg_match($this->_expression, $data);
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Form/ValidatorAbstract.php b/src/application/code/core/Wootook/Core/Form/ValidatorAbstract.php
new file mode 100644
index 0000000..d3f6da2
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Form/ValidatorAbstract.php
@@ -0,0 +1,15 @@
+getForm();
+ if (!$form instanceof Wootook_Core_Form) {
+ return null;
+ }
+ return $element->getSession();
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Form/ValidatorLoader.php b/src/application/code/core/Wootook/Core/Form/ValidatorLoader.php
new file mode 100644
index 0000000..123bd64
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Form/ValidatorLoader.php
@@ -0,0 +1,37 @@
+_form = $form;
+
+ foreach ($namespaces as $namespace => $path) {
+ if (is_int($namespace)) {
+ $this->registerNamespace($path);
+ } else {
+ $this->registerNamespace($namespace, $path);
+ }
+ }
+ }
+
+ protected function _load($className, $useSingleton, Array $constructorParams = array())
+ {
+ $reflection = new ReflectionClass($className);
+ if ($useSingleton && $reflection->implementsInterface('Wootook_Core_Singleton')) {
+ $method = $reflection->getMethod('getSingleton');
+ return $method->invoke(null);
+ }
+
+ try {
+ return $reflection->newInstance();
+ } catch (ReflectionException $e) {
+ Wootook_Core_ErrorProfiler::getSingleton()
+ ->addException($e);
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Helper/Config/ConfigHandler.php b/src/application/code/core/Wootook/Core/Helper/Config/ConfigHandler.php
new file mode 100644
index 0000000..7421bad
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Helper/Config/ConfigHandler.php
@@ -0,0 +1,59 @@
+ 'default',
+ 'episode' => 'default'
+ );
+ } else {
+ $config = $config->toArray();
+ }
+
+ $path = 'gamedata' . DIRECTORY_SEPARATOR . $config['universe'] . DIRECTORY_SEPARATOR
+ . $config['episode'] . DIRECTORY_SEPARATOR . $filename . '.php';
+
+ foreach (include APPLICATION_PATH . $path as $elementId => $fieldName) {
+ $this->setData($elementId, $fieldName);
+ }
+
+ return $this;
+ }
+
+ public function count()
+ {
+ return count($this->_data);
+ }
+
+ public function current()
+ {
+ return current($this->_data);
+ }
+
+ public function next()
+ {
+ return next($this->_data);
+ }
+
+ public function key()
+ {
+ return key($this->_data);
+ }
+
+ public function valid()
+ {
+ return $this->current() !== false;
+ }
+
+ public function rewind()
+ {
+ reset($this->_data);
+ }
+}
diff --git a/src/application/code/core/Wootook/Core/Helper/Config/Events.php b/src/application/code/core/Wootook/Core/Helper/Config/Events.php
new file mode 100644
index 0000000..30b0528
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Helper/Config/Events.php
@@ -0,0 +1,56 @@
+ $listenerList) {
+ foreach ($listenerList as $listener) {
+ Wootook::registerListener($event, $listener);
+ }
+ }
+ }
+
+ protected function _init()
+ {
+ $this->_initData('events');
+ return $this;
+ }
+
+ protected function _load()
+ {
+ // NOP
+ return $this;
+ }
+
+ protected function _save()
+ {
+ // NOP
+ return $this;
+ }
+
+ protected function _delete()
+ {
+ // NOP
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Helper/Config/Modules.php b/src/application/code/core/Wootook/Core/Helper/Config/Modules.php
new file mode 100644
index 0000000..17d1a46
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Helper/Config/Modules.php
@@ -0,0 +1,47 @@
+_initData('modules');
+ return $this;
+ }
+
+ protected function _load()
+ {
+ // NOP
+ return $this;
+ }
+
+ protected function _save()
+ {
+ // NOP
+ return $this;
+ }
+
+ protected function _delete()
+ {
+ // NOP
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Model/Config.php b/src/application/code/core/Wootook/Core/Model/Config.php
new file mode 100644
index 0000000..5607ddf
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Model/Config.php
@@ -0,0 +1,61 @@
+_tableName = 'core_config';
+ $this->_idFieldNames = array('config_path', 'website_id', 'game_id');
+ }
+
+ public function setWebsiteId($websiteId)
+ {
+ return $this->setData('website_id', $websiteId);
+ }
+
+ public function getWebsiteId()
+ {
+ return $this->getData('website_id');
+ }
+
+ public function setGameId($gameId)
+ {
+ return $this->setData('game_id', $gameId);
+ }
+
+ public function getGameId()
+ {
+ return $this->getData('game_id');
+ }
+
+ public function setPath($path)
+ {
+ return $this->setData('config_path', $path);
+ }
+
+ public function getPath()
+ {
+ return $this->getData('config_path');
+ }
+
+ public function setValue($value)
+ {
+ return $this->setData('config_value', $value);
+ }
+
+ public function getValue()
+ {
+ return $this->getData('config_value');
+ }
+}
diff --git a/src/application/code/core/Wootook/Core/Model/Game.php b/src/application/code/core/Wootook/Core/Model/Game.php
new file mode 100644
index 0000000..bc4c234
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Model/Game.php
@@ -0,0 +1,23 @@
+_tableName = 'core_game';
+ $this->_idFieldName = 'game_id';
+ }
+}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Model/Image/Png.php b/src/application/code/core/Wootook/Core/Model/Image/Png.php
similarity index 79%
rename from src/application/modules/WootookCore/src/Wootook/Core/Model/Image/Png.php
rename to src/application/code/core/Wootook/Core/Model/Image/Png.php
index 1d4303a..0b3f5f9 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Model/Image/Png.php
+++ b/src/application/code/core/Wootook/Core/Model/Image/Png.php
@@ -1,34 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Model\Image;
/**
*
@@ -36,7 +6,7 @@ namespace Wootook\Core\Model\Image;
* @author Greg
*
*/
-class Png
+class Wootook_Core_Model_Image_Png
{
private $_format = NULL;
private $_mime = NULL;
@@ -221,4 +191,4 @@ class Png
return $imageData;
}
-}
+}
\ No newline at end of file
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Layout/Manager.php b/src/application/code/core/Wootook/Core/Model/Layout.php
similarity index 84%
rename from src/application/modules/WootookCore/src/Wootook/Core/Layout/Manager.php
rename to src/application/code/core/Wootook/Core/Model/Layout.php
index b3a95e0..d15057f 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Layout/Manager.php
+++ b/src/application/code/core/Wootook/Core/Model/Layout.php
@@ -28,19 +28,6 @@
*
*/
-namespace Wootook\Core\Layout;
-
-use Wootook\Core,
- Wootook\Core\Base,
- Wootook\Core\Block,
- Wootook\Core\Config,
- Wootook\Core\Exception as CoreException,
- Wootook\Core\Helper\Config as ConfigHelper,
- Wootook\Core\Model\Layout,
- Wootook\Core\Mvc\Model,
- Wootook\Core\Mvc\View,
- Wootook\Core\Profiler;
-
/**
* Page layout class utility.
* Builds page structures from flexible layout declaration files, written in a
@@ -49,14 +36,12 @@ use Wootook\Core,
* @author Greg
* @since 1.5.0
* @package Wootook
- * @subpackage WootookCore
+ * @subpackage Wootook_Core
* @category layout
*/
-class Manager
- //extends Core\BaseObject
+class Wootook_Core_Model_Layout
+ extends Wootook_Core_Mvc_Model_Model
{
- use Base\Service\App, Base\DataContainer;
-
const DEFAULT_PACKAGE = 'base';
const DEFAULT_THEME = 'default';
@@ -66,10 +51,10 @@ class Manager
/** @var array */
protected $_blocks = array();
- /** @var View\View */
+ /** @var Wootook_Core_Mvc_View_View */
protected $_messageBlock = null;
- /** @var View\View */
+ /** @var Wootook_Core_Mvc_View_View */
protected $_rootView = null;
/** @var string */
@@ -90,7 +75,7 @@ class Manager
/** @var array */
protected $_namespaces = array(
'core' => array(
- 'Wootook\\Core\\Block' => 'Wootook/Core/Block'
+ 'Wootook_Core_Block_' => 'Wootook/Core/Block'
)
);
@@ -102,10 +87,10 @@ class Manager
* @param string $theme
* @param array $data
*/
- protected function _construct($domain = null, $package = null, $theme = null, Array $data = array())
+ public function __construct($domain = null, $package = null, $theme = null, Array $data = array())
{
if ($domain === null) {
- if (\Wootook::app()->getDefaultWebsiteId() == 0) {
+ if (Wootook::getDefaultWebsite()->getId() == 0) {
$this->_domain = self::DOMAIN_BACKEND;
} else {
$this->_domain = self::DOMAIN_FRONTEND;
@@ -119,12 +104,13 @@ class Manager
if ($theme !== null) {
$this->setTheme($theme);
}
- $this->addData($data);
+
+ parent::__construct($data);
}
public function _init()
{
- $modules = ConfigHelper\Modules::getSingleton();
+ $modules = Wootook_Core_Helper_Config_Modules::getSingleton();
foreach ($modules['block'] as $module => $moduleNamespaces) {
foreach ($moduleNamespaces as $namespace => $path) {
@@ -132,8 +118,8 @@ class Manager
}
}
- $fileList = \Wootook::app()->getDefaultGame()->getConfig('layout');
- if ($fileList instanceof Config\Node) {
+ $fileList = Wootook::getGameConfig('layout');
+ if ($fileList instanceof Wootook_Core_Config_Node) {
$fileList = $fileList->toArray();
}
if (!is_array($fileList) || empty($fileList)) {
@@ -141,10 +127,10 @@ class Manager
}
$this->_data = array();
- $this->setPackage(\Wootook::app()->getDefaultWebsite()->getConfig('package'));
- $this->setTheme(\Wootook::app()->getDefaultGame()->getConfig('theme'));
+ $this->setPackage(Wootook::getWebsiteConfig('package'));
+ $this->setTheme(Wootook::getGameConfig('theme'));
- $parser = new Layout\Parser();
+ $parser = new Wootook_Core_Model_Layout_Parser();
foreach ($fileList as $layoutFile) {
try {
if (preg_match('#\.php$#', $layoutFile)) {
@@ -152,8 +138,8 @@ class Manager
} else {
$layoutData = $parser->parse($this->_getLayoutPath($layoutFile), $this->_getLayoutCachePath($layoutFile), 3600);
}
- } catch (CoreException\LayoutException $e) {
- Profiler\ErrorProfiler::getSingleton()->addException($e);
+ } catch (Wootook_Core_Exception_LayoutException $e) {
+ Wootook_Core_ErrorProfiler::getSingleton()->addException($e);
continue;
}
@@ -200,8 +186,10 @@ class Manager
}
}
- public function load($layoutId)
+ protected function _load()
{
+ $layoutId = func_get_arg(0);
+
if (!$this->hasData($layoutId)) {
return $this;
}
@@ -270,7 +258,7 @@ class Manager
}
}
- \Wootook::dispatchEvent($this->_eventPrefix . '.prepare.before', array(
+ Wootook::dispatchEvent($this->_eventPrefix . '.prepare.before', array(
$this->_eventObject => $this
));
@@ -278,19 +266,19 @@ class Manager
$block->prepareLayout();
}
- \Wootook::dispatchEvent($this->_eventPrefix . '.prepare.after', array(
+ Wootook::dispatchEvent($this->_eventPrefix . '.prepare.after', array(
$this->_eventObject => $this
));
}
protected function _save()
{
- throw new CoreException\LayoutException('Save not permitted for the layout manager.');
+ throw new Wootook_Core_Exception_LayoutException('Save not permitted for the layout manager.');
}
protected function _delete()
{
- throw new CoreException\LayoutException('Delete not permitted for the layout manager.');
+ throw new Wootook_Core_Exception_LayoutException('Delete not permitted for the layout manager.');
}
protected function _resolveBlockClassType($type)
@@ -315,12 +303,12 @@ class Manager
$className = $namespace . $block;
$fileName = $path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $block) . '.php';
- Profiler\ErrorProfiler::getSingleton()->sleep();
+ Wootook_Core_ErrorProfiler::getSingleton()->sleep();
if (!($fp = @fopen($fileName, 'r', true))) {
- Profiler\ErrorProfiler::getSingleton()->wakeup();
+ Wootook_Core_ErrorProfiler::getSingleton()->wakeup();
continue;
}
- Profiler\ErrorProfiler::getSingleton()->wakeup();
+ Wootook_Core_ErrorProfiler::getSingleton()->wakeup();
fclose($fp);
if (!class_exists($className, true)) {
@@ -331,8 +319,8 @@ class Manager
}
}
- Profiler\ErrorProfiler::getSingleton()
- ->addException(new CoreException\LayoutException(sprintf('Class type "%s" could not be resolved.', $type)));
+ Wootook_Core_ErrorProfiler::getSingleton()
+ ->addException(new Wootook_Core_Exception_LayoutException(sprintf('Class type "%s" could not be resolved.', $type)));
return null;
}
@@ -343,7 +331,7 @@ class Manager
* @param string $module
* @param string $namespace
* @param string|null $path
- * @return Layout
+ * @return Wootook_Core_Model_Layout
*/
public function registerBlockNamespace($module, $namespace, $path = null)
{
@@ -364,7 +352,7 @@ class Manager
* @since 1.5.0
* @param string $module
* @param string $namespace
- * @return Layout
+ * @return Wootook_Core_Model_Layout
*/
public function unregisterBlockNamespace($module, $namespace)
{
@@ -381,7 +369,7 @@ class Manager
* @param string $type
* @param string $name
* @param array $config
- * @return View\View
+ * @return Wootook_Core_Mvc_View_View
*/
public function createBlock($type, $name, $config = array())
{
@@ -431,7 +419,7 @@ class Manager
}
if (!isset($config['type'])) {
- $instance->$alias = new View\View($config);
+ $instance->$alias = new Wootook_Core_Mvc_View_View($config);
} else {
$child = $this->_createBlock($config['type'], $name, $config);
if ($child !== null) {
@@ -439,8 +427,8 @@ class Manager
}
}
}
- } catch (\ReflectionException $e) {
- Profiler\ErrorProfiler::getSingleton()
+ } catch (ReflectionException $e) {
+ Wootook_Core_ErrorProfiler::getSingleton()
->addException($e);
return null;
}
@@ -479,18 +467,18 @@ class Manager
$callParamaters[$paramterPosition] = $parameter->getDefaultValue();
//} else if (!$parameter->isOptionnal()) {
} else if ($paramterPosition <= $requiredParameterCount) {
- throw new CoreException\LayoutException(\Wootook::__('Method %s requires parameter %d ($%s) to be defined.',
+ throw new Wootook_Core_Exception_LayoutException(Wootook::__('Method %s requires parameter %d ($%s) to be defined.',
$reflectionMethod->getName(), $paramterPosition + 1, $paramterName));
}
}
$reflectionMethod->invokeArgs($block, $callParamaters);
- } catch (\ReflectionException $e) {
- Profiler\ErrorProfiler::getSingleton()
+ } catch (ReflectionException $e) {
+ Wootook_Core_ErrorProfiler::getSingleton()
->addException($e);
continue;
- } catch (\RuntimeException $e) {
- Profiler\ErrorProfiler::getSingleton()
+ } catch (RuntimeException $e) {
+ Wootook_Core_ErrorProfiler::getSingleton()
->addException($e);
continue;
}
@@ -513,7 +501,7 @@ class Manager
*
* @since 1.5.0
* @param string $domain
- * @return Layout
+ * @return Wootook_Core_Model_Layout
*/
public function setDomain($domain)
{
@@ -555,7 +543,7 @@ class Manager
public function getScriptPath()
{
- return \Wootook::getBasePath('design') . DIRECTORY_SEPARATOR . $this->getDomain();
+ return Wootook::getBasePath('design') . DIRECTORY_SEPARATOR . $this->getDomain();
}
public function getAllBlocks()
@@ -573,13 +561,13 @@ class Manager
public function render()
{
- if (!$this->_rootView instanceof View\View) {
- throw new CoreException\LayoutException(\Wootook::__('No root view declared.'));
+ if (!$this->_rootView instanceof Wootook_Core_Mvc_View_View) {
+ throw new Wootook_Core_Exception_LayoutException(Wootook::__('No root view declared.'));
}
$scriptPath = $this->getScriptPath();
foreach ($this->_blocks as $block) {
- if ($block instanceof Block\Template) {
+ if ($block instanceof Wootook_Core_Block_Template) {
$block->setScriptPath($scriptPath);
}
$block->beforeToHtml();
@@ -613,29 +601,29 @@ class Manager
if ($package !== null && $theme !== null) {
$path = sprintf($pattern, $package, $theme);
- if (\Wootook::fileExists($path)) {
+ if (Wootook::fileExists($path)) {
return $path;
}
}
if ($package !== null) {
$path = sprintf($pattern, $package, self::DEFAULT_THEME);
- if (\Wootook::fileExists($path)) {
+ if (Wootook::fileExists($path)) {
return $path;
}
}
$path = sprintf($pattern, self::DEFAULT_PACKAGE, self::DEFAULT_THEME);
- if (\Wootook::fileExists($path)) {
+ if (Wootook::fileExists($path)) {
return $path;
}
- throw new CoreException\LayoutException(sprintf("Layout file '%s' does not exist.", $file));
+ throw new Wootook_Core_Exception_LayoutException(sprintf("Layout file '%s' does not exist.", $file));
}
/**
*
- * @return Block\Messages
+ * @return Wootook_Core_Block_Messages
*/
public function getMessagesBlock()
{
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Layout/Parser.php b/src/application/code/core/Wootook/Core/Model/Layout/Parser.php
similarity index 63%
rename from src/application/modules/WootookCore/src/Wootook/Core/Layout/Parser.php
rename to src/application/code/core/Wootook/Core/Model/Layout/Parser.php
index b0a5bf2..1e07ae8 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Layout/Parser.php
+++ b/src/application/code/core/Wootook/Core/Model/Layout/Parser.php
@@ -1,47 +1,15 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-namespace Wootook\Core\Model\Layout;
-
-use Wootook\Core\Config;
-
-class Parser
+class Wootook_Core_Model_Layout_Parser
{
/**
*
* Enter description here ...
- * @param string $filename
+ * @param unknown_type $filename
*/
public function parse($filename, $cachePath = null, $cacheLifetime = 86400)
{
- if ($cachePath !== null && \Wootook::fileExists($cachePath) && $cacheLifetime > 0 && (time() - filemtime($cachePath) <= $cacheLifetime)) {
+ if ($cachePath !== null && Wootook::fileExists($cachePath) && $cacheLifetime > 0 && (time() - filemtime($cachePath) <= $cacheLifetime)) {
return include $cachePath;
}
@@ -62,18 +30,18 @@ class Parser
return array();
}
- $result = new Config\Adapter\PhpArray();
+ $result = new Wootook_Core_Config_Adapter_Array();
foreach ($layout->handle as $handle) {
$name = (string) $handle['name'];
if (empty($name)) {
continue;
}
- $handleNode = new Config\Node(array(), $result);
+ $handleNode = new Wootook_Core_Config_Node(array(), $result);
$result->$name = $handleNode;
if (isset($handle->update)) {
- $updateListNode = new Config\Node(array(), $handleNode);
+ $updateListNode = new Wootook_Core_Config_Node(array(), $handleNode);
$handleNode->update = $updateListNode;
foreach ($handle->update as $update) {
@@ -88,7 +56,7 @@ class Parser
}
if (isset($handle->reference)) {
- $referenceListNode = new Config\Node(array(), $handleNode);
+ $referenceListNode = new Wootook_Core_Config_Node(array(), $handleNode);
$handleNode->reference = $referenceListNode;
foreach ($handle->reference as $reference) {
@@ -97,7 +65,7 @@ class Parser
continue;
}
- $referenceNode = new Config\Node(array(), $referenceListNode);
+ $referenceNode = new Wootook_Core_Config_Node(array(), $referenceListNode);
$referenceListNode->$referenceName = $referenceNode;
$this->_parseBlockBody($reference, $referenceNode);
@@ -108,7 +76,7 @@ class Parser
return $result;
}
- protected function _parseBlock(\SimpleXMLElement $handle, Config\Node $blockNode)
+ protected function _parseBlock(SimpleXMLElement $handle, Wootook_Core_Config_Node $blockNode)
{
foreach ($handle->attributes() as $attributeName => $attributeValue) {
$blockNode->$attributeName = (string) $attributeValue;
@@ -117,10 +85,10 @@ class Parser
$this->_parseBlockBody($handle, $blockNode);
}
- protected function _parseBlockBody(\SimpleXMLElement $handle, Config\Node $blockNode)
+ protected function _parseBlockBody(SimpleXMLElement $handle, Wootook_Core_Config_Node $blockNode)
{
if (isset($handle->block)) {
- $childrenNode = new Config\Node(array(), $blockNode);
+ $childrenNode = new Wootook_Core_Config_Node(array(), $blockNode);
$blockNode->children = $childrenNode;
foreach ($handle->block as $block) {
@@ -129,7 +97,7 @@ class Parser
continue;
}
- $childNode = new Config\Node(array(), $childrenNode);
+ $childNode = new Wootook_Core_Config_Node(array(), $childrenNode);
$childrenNode->$blockName = $childNode;
$this->_parseBlock($block, $childNode);
@@ -137,7 +105,7 @@ class Parser
}
if (isset($handle->action)) {
- $actionListNode = new Config\Node(array(), $blockNode);
+ $actionListNode = new Wootook_Core_Config_Node(array(), $blockNode);
$blockNode->actions = $actionListNode;
foreach ($handle->action as $action) {
@@ -146,7 +114,7 @@ class Parser
continue;
}
- $actionNode = new Config\Node(array(
+ $actionNode = new Wootook_Core_Config_Node(array(
'method' => $methodName,
'params' => array()
), $actionListNode);
@@ -166,7 +134,7 @@ class Parser
if (isset($param->const) && isset($param->const['name']) && defined((string) $param->const['name'])) {
$paramsNode->$paramName = constant((string) $param->const['name']);
} else {
- $paramArrayNode = new Config\Node(array(), $paramsNode);
+ $paramArrayNode = new Wootook_Core_Config_Node(array(), $paramsNode);
$paramsNode->$paramName = $paramArrayNode;
$this->_parseArrayParam($param, $paramArrayNode);
@@ -180,11 +148,11 @@ class Parser
}
}
- protected function _parseArrayParam(\SimpleXMLElement $element, Config\Node $parentNode)
+ protected function _parseArrayParam(SimpleXMLElement $element, Wootook_Core_Config_Node $parentNode)
{
foreach ($element->children() as $child) {
if (count($child)) {
- $childNode = new Config\Node(array(), $parentNode);
+ $childNode = new Wootook_Core_Config_Node(array(), $parentNode);
$parentNode->{$child->getName()} = $childNode;
$this->_parseArrayParam($child, $childNode);
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Model/Session.php b/src/application/code/core/Wootook/Core/Model/Session.php
similarity index 76%
rename from src/application/modules/WootookCore/src/Wootook/Core/Model/Session.php
rename to src/application/code/core/Wootook/Core/Model/Session.php
index a378f28..2306f03 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Model/Session.php
+++ b/src/application/code/core/Wootook/Core/Model/Session.php
@@ -1,49 +1,15 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Model;
-
-use Wootook\Core,
- Wootook\Core\Base;
/**
*
* Enter description here ...
*
- * @uses Wootook\Core\BaseObject
+ * @uses Wootook_Object
* @uses Legacies_Empire
*/
-class Session
+class Wootook_Core_Model_Session
+ extends Wootook_Object
{
- use Base\Service\App, Base\DataContainer;
-
const CRIT = 0x80;
const ERR = 0x40;
const WARN = 0x20;
@@ -85,7 +51,7 @@ class Session
session_destroy();
}
- public function _construct($namespace)
+ public function __construct($namespace)
{
if (session_id() == '') {
session_set_cookie_params($this->getCookieLifetime(), $this->getCookiePath(), $this->getCookieDomain(), false, true);
@@ -114,7 +80,7 @@ class Session
public function getCookieLifetime()
{
- $lifetime = \Wootook::app()->getDefaultWebsite()->getConfig(self::COOKIE_LIFETIME_CONFIG_KEY);
+ $lifetime = Wootook::getWebsiteConfig(self::COOKIE_LIFETIME_CONFIG_KEY);
if (!is_numeric($lifetime) || $lifetime <= 0) {
return 900;
}
@@ -124,7 +90,7 @@ class Session
public function getCookieDomain()
{
- $domain = \Wootook::app()->getDefaultWebsite()->getConfig(self::COOKIE_DOMAIN_CONFIG_KEY);
+ $domain = Wootook::getWebsiteConfig(self::COOKIE_DOMAIN_CONFIG_KEY);
if ($domain === null) {
return $_SERVER['SERVER_NAME'];
}
@@ -133,7 +99,7 @@ class Session
public function getCookiePath()
{
- $path = \Wootook::app()->getDefaultWebsite()->getConfig(self::COOKIE_PATH_CONFIG_KEY);
+ $path = Wootook::getWebsiteConfig(self::COOKIE_PATH_CONFIG_KEY);
if ($path === null) {
return '/';
}
diff --git a/src/application/code/core/Wootook/Core/Model/Translator.php b/src/application/code/core/Wootook/Core/Model/Translator.php
new file mode 100644
index 0000000..6d81883
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Model/Translator.php
@@ -0,0 +1,37 @@
+= 2) {
+ $this->_translations[$line[0]] = $line[1];
+ }
+ }
+ }
+ }
+
+ public function translate($message, $_ = null)
+ {
+ $args = func_get_args();
+ array_shift($args);
+
+ return $this->translateArgs($message, $args);
+ }
+
+ public function translateArgs($message, Array $args = array())
+ {
+ if (isset($this->_translations[$message])) {
+ $message = $this->_translations[$message];
+ }
+
+ return vsprintf($message, $args);
+ }
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Core/Model/Website.php b/src/application/code/core/Wootook/Core/Model/Website.php
new file mode 100644
index 0000000..018edac
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Model/Website.php
@@ -0,0 +1,23 @@
+_tableName = 'core_website';
+ $this->_idFieldName = 'website_id';
+ }
+}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Action.php b/src/application/code/core/Wootook/Core/Mvc/Controller/Action.php
similarity index 57%
rename from src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Action.php
rename to src/application/code/core/Wootook/Core/Mvc/Controller/Action.php
index 3a530c3..e6230ba 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Action.php
+++ b/src/application/code/core/Wootook/Core/Mvc/Controller/Action.php
@@ -1,54 +1,14 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-namespace Wootook\Core\Mvc\Controller;
-
-use Wootook\Core,
- Wootook\Core\Exception as CoreException,
- Wootook\Core\Layout,
- Wootook\Core\Model,
- Wootook\Core\Profiler;
-
-abstract class Action
+abstract class Wootook_Core_Mvc_Controller_Action
{
- protected $_app = null;
-
private $_request = null;
private $_response = null;
private $_layout = null;
- public function __construct(Core\App\App $app, Request\Request $request, Response\Response $response)
+ public function __construct(Wootook_Core_Mvc_Controller_Request_Http $request, Wootook_Core_Mvc_Controller_Response_Http $response)
{
- $this->_app = $app;
-
$this->setRequest($request);
$this->setResponse($response);
}
@@ -57,11 +17,6 @@ abstract class Action
{
}
- public function app()
- {
- return $this->_app;
- }
-
public function preDispatch()
{
}
@@ -70,14 +25,14 @@ abstract class Action
{
}
- public function setRequest(Request\Request $request)
+ public function setRequest(Wootook_Core_Mvc_Controller_Request_Http $request)
{
$this->_request = $request;
return $this;
}
- public function setResponse(Response\Response $response)
+ public function setResponse(Wootook_Core_Mvc_Controller_Response_Http $response)
{
$this->_response = $response;
@@ -86,7 +41,7 @@ abstract class Action
/**
*
- * @return Request\Request
+ * @return Wootook_Core_Mvc_Controller_Request_Http
*/
public function getRequest()
{
@@ -95,7 +50,7 @@ abstract class Action
/**
*
- * @return Response\Response
+ * @return Wootook_Core_Mvc_Controller_Response_Http
*/
public function getResponse()
{
@@ -116,7 +71,7 @@ abstract class Action
$this->getResponse()->setIsDispatched(false);
}
- protected function _redirect($uri, Array $params = array(), $code = Response\Response::REDIRECT_FOUND)
+ protected function _redirect($uri, Array $params = array(), $code = Wootook_Core_Mvc_Controller_Response_Http::REDIRECT_FOUND)
{
$parts = explode('/', $uri);
$partsCount = count($parts);
@@ -132,14 +87,14 @@ abstract class Action
$uri = implode('/', array_slice($parts, 0, 3));
$this->getResponse()
- ->setRedirect(\Wootook::getUrl($uri, $params), $code);
+ ->setRedirect(Wootook::getUrl($uri, $params), $code);
- Profiler\ErrorProfiler::unregister(true);
+ Wootook_Core_ErrorProfiler::unregister(true);
return $this;
}
- protected function _redirectUrl($url, $code = Response\Response::REDIRECT_FOUND)
+ protected function _redirectUrl($url, $code = Wootook_Core_Mvc_Controller_Response_Http::REDIRECT_FOUND)
{
$this->getResponse()->setRedirect($url, $code);
@@ -173,12 +128,12 @@ abstract class Action
protected function _initLayout()
{
- return new Layout\Manager($this->app(), Layout\Manager::DOMAIN_FRONTEND);
+ return new Wootook_Core_Model_Layout(Wootook_Core_Model_Layout::DOMAIN_FRONTEND);
}
/**
*
- * @return Layout\Manager
+ * @return Wootook_Core_Model_Layout
*/
public function getLayout()
{
@@ -189,8 +144,8 @@ abstract class Action
{
try {
$content = $this->getLayout()->render();
- } catch (CoreException\LayoutException $e) {
- Profiler\ErrorProfiler::getSingleton()->addException($e);
+ } catch (Wootook_Core_Exception_LayoutException $e) {
+ Wootook_Core_ErrorProfiler::getSingleton()->addException($e);
return $this;
}
$this->getResponse()->setBody($content);
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Front.php b/src/application/code/core/Wootook/Core/Mvc/Controller/Front.php
similarity index 62%
rename from src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Front.php
rename to src/application/code/core/Wootook/Core/Mvc/Controller/Front.php
index a95ce7d..6c6b20f 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Front.php
+++ b/src/application/code/core/Wootook/Core/Mvc/Controller/Front.php
@@ -1,41 +1,7 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-namespace Wootook\Core\Mvc\Controller;
-
-use Wootook\Core\Base\Service;
-
-class Front
+class Wootook_Core_Mvc_Controller_Front
{
- use Service\App;
-
const ROUTE_DEFAULT = 'default';
const ROUTE_ERROR = 'error';
@@ -44,7 +10,8 @@ class Front
self::ROUTE_ERROR => array(
'modules' => array(
'core' => array(
- 100 => 'Wootook\\Core\\Controller'
+ 'class' => 'Wootook_Core_Controller_',
+ 'path' => 'Wootook/Core/Controller'
)
),
'defaults' => array(
@@ -67,50 +34,11 @@ class Front
protected $_request = null;
protected $_response = null;
- protected function _construct(Request\Request $request = null, Response\Response $response = null)
- {
- if ($request !== null) {
- $this->setRequest($request);
- }
- if ($response !== null) {
- $this->setResponse($response);
- }
- }
-
- /**
- * @return Request\Request
- */
- public function getRequest()
- {
- if ($this->_request === null) {
- $this->_request = new Request\Http($this->app());
- }
- return $this->_request;
- }
-
- public function setRequest(Request\Request $request)
+ public function __construct(Wootook_Core_Mvc_Controller_Request_Request $request,
+ Wootook_Core_Mvc_Controller_Response_Response $response)
{
$this->_request = $request;
-
- return $this;
- }
-
- /**
- * @return Response\Response
- */
- public function getResponse()
- {
- if ($this->_response === null) {
- $this->_response = new Response\Http($this->app());
- }
- return $this->_response;
- }
-
- public function setResponse(Response\Response $response)
- {
$this->_response = $response;
-
- return $this;
}
protected function _setNoRouteAction(&$route, &$moduleKey, &$controllerKey, &$actionKey)
@@ -136,7 +64,14 @@ class Front
protected function _camelizeClass($string)
{
$string = strtolower($string);
- $string = str_replace(' ', '\\', ucwords(str_replace('.', ' ', $string)));
+ $string = str_replace(' ', '_', ucwords(str_replace('.', ' ', $string)));
+ return str_replace(' ', '', ucwords(str_replace('-', ' ', $string)));
+ }
+
+ protected function _camelizePath($string)
+ {
+ $string = strtolower($string);
+ $string = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('.', ' ', $string)));
return str_replace(' ', '', ucwords(str_replace('-', ' ', $string)));
}
@@ -153,8 +88,21 @@ class Front
if (!isset($this->_routes[$route]['modules'][$module])) {
return null;
}
- $modulePrefix = current($this->_routes[$route]['modules'][$module]);
- return $modulePrefix . '\\' . $this->_camelizeClass($controllerKey) . 'Controller';
+ $modulePrefix = $this->_routes[$route]['modules'][$module]['class'];
+ return $modulePrefix . $this->_camelizeClass($controllerKey) . 'Controller';
+ }
+
+ protected function _getControllerFilename($route, $module, $controllerKey)
+ {
+ if (!isset($this->_routes[$route])) {
+ return null;
+ }
+ if (!isset($this->_routes[$route]['modules'][$module])) {
+ return null;
+ }
+ $modulePath = $this->_routes[$route]['modules'][$module]['path'];
+
+ return $modulePath . DIRECTORY_SEPARATOR . $this->_camelizePath($controllerKey) . 'Controller.php';
}
protected function _getActionMethod($actionKey)
@@ -164,14 +112,14 @@ class Front
protected function _forward($action, $controller = null, $module = null)
{
- $this->getRequest()->setActionName($action);
+ $this->_request->setActionName($action);
if ($controller !== null) {
- $this->getRequest()->setControllerName($controller);
+ $this->_request->setControllerName($controller);
if ($module != null) {
- $this->getRequest()->setModuleName($module);
+ $this->_request->setModuleName($module);
}
}
- $this->getResponse()->setIsDispatched(false);
+ $this->_response->setIsDispatched(false);
}
public function dispatch($route = null)
@@ -186,7 +134,7 @@ class Front
$loop = 0;
while ($loop++ < 100) {
- $moduleKey = $this->getRequest()->getModuleName();
+ $moduleKey = $this->_request->getModuleName();
if (empty($moduleKey)) {
$this->_forward(
$this->_routes[$route]['defaults']['action'],
@@ -206,14 +154,19 @@ class Front
continue;
}
- $controllerKey = $this->getRequest()->getControllerName();
+ $controllerKey = $this->_request->getControllerName();
if (empty($controllerKey)) {
$controllerKey = $this->_routes[$route]['defaults']['controller'];
}
$controllerClass = $this->_getControllerClass($route, $moduleKey, $controllerKey);
+ $controllerPath = $this->_getControllerFilename($route, $moduleKey, $controllerKey);
- if (!class_exists($controllerClass, true)) {
+ if (!class_exists($controllerClass, false) && Wootook::fileExists($controllerPath)) {
+ include_once $controllerPath;
+ }
+
+ if (!class_exists($controllerClass, false)) {
$this->_forward(
$this->_routes[self::ROUTE_ERROR]['defaults']['action'],
$this->_routes[self::ROUTE_ERROR]['defaults']['controller'],
@@ -223,7 +176,7 @@ class Front
continue;
}
- $actionKey = $this->getRequest()->getActionName();
+ $actionKey = $this->_request->getActionName();
if (empty($actionKey)) {
$actionKey = $this->_routes[$route]['defaults']['action'];
}
@@ -239,30 +192,30 @@ class Front
continue;
}
- $controller = new $controllerClass($this->app(), $this->getRequest(), $this->getResponse());
+ $controller = new $controllerClass($this->_request, $this->_response);
$controller->init();
- $this->getResponse()->setIsDispatched();
+ $this->_response->setIsDispatched();
$this->preDispatch();
$controller->preDispatch();
- if (!$this->getResponse()->isDispatched()) {
+ if (!$this->_response->isDispatched()) {
continue;
}
- if ($this->getResponse()->isRedirect()) {
+ if ($this->_response->isRedirect()) {
break;
}
$controller->$actionMethod();
- if (!$this->getResponse()->isDispatched()) {
+ if (!$this->_response->isDispatched()) {
continue;
}
$controller->postDispatch();
$this->postDispatch();
- if ($this->getResponse()->isDispatched() || $this->getResponse()->isRedirect()) {
+ if ($this->_response->isDispatched() || $this->_response->isRedirect()) {
break;
}
}
@@ -272,7 +225,7 @@ class Front
public function send()
{
- $this->getResponse()->render();
+ $this->_response->render();
}
public function addModule($frontName, $namespace, $path)
@@ -298,9 +251,9 @@ class Front
public function preDispatch()
{
- \Wootook::dispatchEvent('core.mvc.controller.front.pre-dispatch', array(
- 'request' => $this->getRequest(),
- 'response' => $this->getResponse()
+ Wootook::dispatchEvent('core.mvc.controller.front.pre-dispatch', array(
+ 'request' => $this->_request,
+ 'response' => $this->_response
));
return $this;
@@ -308,9 +261,9 @@ class Front
public function postDispatch()
{
- \Wootook::dispatchEvent('core.mvc.controller.front.post-dispatch', array(
- 'request' => $this->getRequest(),
- 'response' => $this->getResponse()
+ Wootook::dispatchEvent('core.mvc.controller.front.post-dispatch', array(
+ 'request' => $this->_request,
+ 'response' => $this->_response
));
return $this;
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Request/Http.php b/src/application/code/core/Wootook/Core/Mvc/Controller/Request/Http.php
similarity index 86%
rename from src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Request/Http.php
rename to src/application/code/core/Wootook/Core/Mvc/Controller/Request/Http.php
index 71b0f63..3780a37 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Request/Http.php
+++ b/src/application/code/core/Wootook/Core/Mvc/Controller/Request/Http.php
@@ -1,37 +1,7 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-namespace Wootook\Core\Mvc\Controller\Request;
-
-class Http
- extends Request
+class Wootook_Core_Mvc_Controller_Request_Http
+ extends Wootook_Core_Mvc_Controller_Request_Request
{
protected $_baseUrl = null;
@@ -45,11 +15,11 @@ class Http
protected $_serverVars = array();
protected $_postFiles = array();
- protected function _construct(Array $options = array())
+ public function __construct(Array $options = array())
{
- parent::_construct($options);
+ parent::__construct($options);
- $this->_baseUrl = \Wootook::getBaseUrl('link');
+ $this->_baseUrl = Wootook::getBaseUrl('link');
if ($this->_baseUrl === null) {
$this->_baseUrl = 'http://' . $this->getServer('HTTP_HOST') . $this->getServer('REQUEST_URI');
}
diff --git a/src/application/code/core/Wootook/Core/Mvc/Controller/Request/Request.php b/src/application/code/core/Wootook/Core/Mvc/Controller/Request/Request.php
new file mode 100644
index 0000000..3a77073
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Mvc/Controller/Request/Request.php
@@ -0,0 +1,35 @@
+init();
+
+ parent::__construct($data);
+ }
+
+ public function setParam($key, $value)
+ {
+ return $this->setData($key, $value);
+ }
+
+ public function getParam($key, $default = null)
+ {
+ if ($this->hasData($key)) {
+ return $this->getData($key);
+ }
+ return $default;
+ }
+
+ abstract public function init();
+
+ abstract public function getModuleName();
+ abstract public function getControllerName();
+ abstract public function getActionName();
+
+ abstract public function setModuleName($name);
+ abstract public function setControllerName($name);
+ abstract public function setActionName($name);
+}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Response/Http.php b/src/application/code/core/Wootook/Core/Mvc/Controller/Response/Http.php
similarity index 75%
rename from src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Response/Http.php
rename to src/application/code/core/Wootook/Core/Mvc/Controller/Response/Http.php
index 74fbd71..3025249 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Response/Http.php
+++ b/src/application/code/core/Wootook/Core/Mvc/Controller/Response/Http.php
@@ -1,39 +1,7 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-namespace Wootook\Core\Mvc\Controller\Response;
-
-use Wootook\Core;
-
-class Http
- extends Response
+class Wootook_Core_Mvc_Controller_Response_Http
+ extends Wootook_Core_Mvc_Controller_Response_Response
{
const STATUS_OK = 200;
@@ -159,7 +127,7 @@ class Http
public function setRawCookie($name, $value, $lifetime = null, $path = null, $domain = null)
{
- $date = new Core\DateTime();
+ $date = new Wootook_Core_DateTime();
$date->add($lifetime);
setcookie($name, $value, $date->getTimestamp(), $path, $domain);
diff --git a/src/application/code/core/Wootook/Core/Mvc/Controller/Response/Response.php b/src/application/code/core/Wootook/Core/Mvc/Controller/Response/Response.php
new file mode 100644
index 0000000..a36048a
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Mvc/Controller/Response/Response.php
@@ -0,0 +1,21 @@
+_isDispatched = $dispatched;
+
+ return $this;
+ }
+
+ public function isDispatched()
+ {
+ return $this->_isDispatched;
+ }
+
+ abstract public function render($send = true);
+}
diff --git a/src/application/code/core/Wootook/Core/Mvc/Model/Entity.php b/src/application/code/core/Wootook/Core/Mvc/Model/Entity.php
new file mode 100644
index 0000000..2c19005
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Mvc/Model/Entity.php
@@ -0,0 +1,142 @@
+_idFieldName = $fieldName;
+
+ return $this;
+ }
+
+ public function getIdFieldName()
+ {
+ return $this->_idFieldName;
+ }
+
+ public function setId($id)
+ {
+ $this->setData($this->getIdFieldName(), $id);
+
+ return $this;
+ }
+
+ public function getId()
+ {
+ return $this->getData($this->getIdFieldName());
+ }
+
+ protected function _load()
+ {
+ $id = func_get_arg(0);
+
+ if (func_num_args() >= 2) {
+ $idFieldName = func_get_arg(1);
+ } else {
+ $idFieldName = $this->getIdFieldName();
+ }
+
+ $database = $this->getReadConnection();
+ if ($database === null) {
+ throw new Wootook_Core_Exception_DataAccessException('Could not load data: no read connection configured.');
+ }
+
+ $select = $database->select()
+ ->from(array('main_table' => $database->getTable($this->getTableName())))
+ ->where($idFieldName, new Wootook_Core_Database_Sql_Placeholder_Param('id', $id))
+ ->limit(1);
+
+ $statement = $select->prepare();
+ $statement->execute(array(
+ 'id' => $id
+ ));
+
+ $datas = $statement->fetch(PDO::FETCH_ASSOC);
+ if (!is_array($datas) || empty($datas)) {
+ throw new Wootook_Core_Exception_DataAccessException('Could not load data: this id could not be found.');
+ }
+ $realId = $datas[$this->getIdFieldName()];
+ unset($datas[$this->getIdFieldName()]);
+
+ $this->_data = array();
+ $this->getDataMapper()->decode($this, $datas);
+ $this->setId($realId);
+
+ return $this;
+ }
+
+ protected function _save()
+ {
+ $adapter = $this->getWriteConnection();
+
+ if ($adapter === null) {
+ throw new Wootook_Core_Exception_DataAccessException('Could not save data: no write connection configured.');
+ }
+
+ if ($this->getId() !== null) {
+ $update = $adapter->update()
+ ->into($adapter->getTable($this->getTableName()))
+ ->where(new Wootook_Core_Database_Sql_Placeholder_Expression("{$adapter->quoteIdentifier($this->getIdFieldName())}=:id", array('id' => $this->getId())));
+
+ foreach ($this->getDataMapper()->encode($this, $this->getChangedDatas()) as $field => $value) {
+ $update->set($field, new Wootook_Core_Database_Sql_Placeholder_Param($field, $value));
+ }
+ try {
+ $statement = $update->prepare();
+ $statement->execute();
+ } catch (Wootook_Core_Exception_Database_AdapterError $e) {
+ throw new Wootook_Core_Exception_DataAccessException('Could not save data: ' . $e->getMessage(), null, $e);
+ } catch (Wootook_Core_Exception_Database_StatementError $e) {
+ throw new Wootook_Core_Exception_DataAccessException('Could not save data: ' . $e->getMessage(), null, $e);
+ }
+ } else {
+ $insert = $adapter->insert()
+ ->into($adapter->getTable($this->getTableName()));
+
+ foreach ($this->getDataMapper()->encode($this, $this->getAllDatas()) as $field => $value) {
+ $insert->set($field, new Wootook_Core_Database_Sql_Placeholder_Param($field, $value));
+ }
+ try {
+ $statement = $insert->prepare();
+ $statement->execute();
+
+ $id = $adapter->lastInsertId($adapter->getTable($this->getTableName()));
+ $this->setId($id);
+ } catch (Wootook_Core_Exception_Database_AdapterError $e) {
+ throw new Wootook_Core_Exception_DataAccessException('Could not save data: ' . $e->getMessage(), null, $e);
+ } catch (Wootook_Core_Exception_Database_StatementError $e) {
+ throw new Wootook_Core_Exception_DataAccessException('Could not save data: ' . $e->getMessage(), null, $e);
+ }
+ }
+
+ return $this;
+ }
+
+ protected function _delete()
+ {
+ $adapter = $this->getWriteConnection();
+ if ($adapter === null) {
+ throw new Wootook_Core_Exception_DataAccessException('Could not delete data: no write connection configured.');
+ }
+ $delete = $adapter
+ ->delete()
+ ->from($adapter->getTable($this->getTableName()))
+ ->where($this->getIdFieldName(), $this->getId())
+ ->limit(1);
+
+ try {
+ $statement = $adapter->prepare($delete);
+ $statement->execute();
+ } catch (Wootook_Core_Exception_Database_AdapterError $e) {
+ throw new Wootook_Core_Exception_DataAccessException('Could not delete data: ' . $e->getMessage(), null, $e);
+ } catch (Wootook_Core_Exception_Database_StatementError $e) {
+ throw new Wootook_Core_Exception_DataAccessException('Could not delete data: ' . $e->getMessage(), null, $e);
+ }
+
+ return $this;
+ }
+}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/SubTable.php b/src/application/code/core/Wootook/Core/Mvc/Model/Entity/SubTable.php
similarity index 67%
rename from src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/SubTable.php
rename to src/application/code/core/Wootook/Core/Mvc/Model/Entity/SubTable.php
index faa3cc5..791d481 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/SubTable.php
+++ b/src/application/code/core/Wootook/Core/Mvc/Model/Entity/SubTable.php
@@ -1,44 +1,13 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-namespace Wootook\Core\Mvc\Model;
-
-use Wootook\Core,
- Wootook\Core\Database,
- Wootook\Core\Exception as CoreException;
/**
*
- * @uses Wootook\Core\BaseObject
+ * @uses Wootook_Object
+ * @uses Legacies_Empire
+ * @uses Wootook_Player_Model_Entity
*/
-abstract class SubTable
- extends Core\Base\BaseObject
+abstract class Wootook_Core_Mvc_Model_Entity_SubTable
+ extends Wootook_Core_Database_Resource
{
private $_isLoaded = false;
protected $_idFieldNames = array();
@@ -112,7 +81,7 @@ SQL_EOF;
$datas = $statement->fetch(PDO::FETCH_ASSOC);
if (!is_array($datas) || empty($datas)) {
- throw new CoreException\DataAccessException('Could not load data: this id combination could not be found.');
+ throw new Wootook_Core_Exception_DataAccessException('Could not load data: this id combination could not be found.');
}
$this->_data = array();
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/EntityInterface.php b/src/application/code/core/Wootook/Core/Mvc/Model/EntityInterface.php
similarity index 96%
rename from src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/EntityInterface.php
rename to src/application/code/core/Wootook/Core/Mvc/Model/EntityInterface.php
index da60043..e512a5d 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/EntityInterface.php
+++ b/src/application/code/core/Wootook/Core/Mvc/Model/EntityInterface.php
@@ -28,15 +28,13 @@
*
*/
-namespace Wootook\Core\Mvc\Model;
-
/**
*
* Enter description here ...
* @author Greg
*
*/
-interface EntityInterface
+interface Wootook_Core_Mvc_Model_EntityInterface
{
public function getId();
public function setId($id);
diff --git a/src/application/code/core/Wootook/Core/Mvc/Model/Model.php b/src/application/code/core/Wootook/Core/Mvc/Model/Model.php
new file mode 100644
index 0000000..e91265f
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Mvc/Model/Model.php
@@ -0,0 +1,205 @@
+
+ * All rights reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ * --> NOTICE <--
+ * This file is part of the core development branch, changing its contents will
+ * make you unable to use the automatic updates manager. Please refer to the
+ * documentation for further information about customizing Wootook.
+ *
+ */
+
+/**
+ *
+ * Enter description here ...
+ * @author Greg
+ *
+ */
+abstract class Wootook_Core_Mvc_Model_Model
+ extends Wootook_Object
+{
+ protected $_originalData = array();
+
+ protected $_eventPrefix = null;
+ protected $_eventObject = null;
+
+ public function __construct(Array $data = array())
+ {
+ $this->_data = $data;
+
+ $this->_init();
+ $this->_setOriginalData();
+ }
+
+ abstract protected function _init();
+
+ protected function _setOriginalData()
+ {
+ $this->_originalData = $this->_data;
+ }
+
+ public function getChangedDatas()
+ {
+ return array_diff_assoc($this->_data, $this->_originalData);
+ }
+
+ public function hasChangedDatas()
+ {
+ if (count($this->getChangedDatas()) > 0) {
+ return true;
+ }
+ return false;
+ }
+
+ final public function save()
+ {
+ try {
+ $params = func_get_args();
+ call_user_func_array(array($this, '_beforeSave'), $params);
+ call_user_func_array(array($this, '_save'), $params);
+ call_user_func_array(array($this, '_afterSave'), $params);
+ $this->_setOriginalData($this->_data);
+ } catch (PDOException $e) {
+ throw new Wootook_Core_Exception_DataAccessException('Could not save data: ' . $e->getMessage(), 0);
+ }
+ return $this;
+ }
+
+ abstract protected function _save();
+
+ protected function _beforeSave()
+ {
+ Wootook::dispatchEvent('model.before-save', array('model' => $this));
+
+ if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
+ Wootook::dispatchEvent($this->_eventPrefix . '.before-save', array($this->_eventObject => $this));
+ }
+
+ return $this;
+ }
+
+ protected function _afterSave()
+ {
+ Wootook::dispatchEvent('model.after-save', array('model' => $this));
+
+ if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
+ Wootook::dispatchEvent($this->_eventPrefix . '.after-save', array($this->_eventObject => $this));
+ }
+
+ return $this;
+ }
+
+ final public function load()
+ {
+ try {
+ $params = func_get_args();
+ call_user_func_array(array($this, '_beforeLoad'), $params);
+ call_user_func_array(array($this, '_load'), $params);
+ call_user_func_array(array($this, '_afterLoad'), $params);
+ $this->_setOriginalData($this->_data);
+ } catch (PDOException $e) {
+ throw new Wootook_Core_Exception_DataAccessException('Could not load data: ' . $e->getMessage(), 0, $e);
+ }
+ return $this;
+ }
+
+ abstract protected function _load();
+
+ protected function _beforeLoad()
+ {
+ Wootook::dispatchEvent('model.before-load', array('model' => $this));
+
+ if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
+ Wootook::dispatchEvent($this->_eventPrefix . '.before-load', array($this->_eventObject => $this));
+ }
+
+ return $this;
+ }
+
+ protected function _afterLoad()
+ {
+ Wootook::dispatchEvent('model.after-load', array('model' => $this));
+
+ if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
+ Wootook::dispatchEvent($this->_eventPrefix . '.after-load', array($this->_eventObject => $this));
+ }
+
+ return $this;
+ }
+
+ final public function delete()
+ {
+ try {
+ $params = func_get_args();
+ call_user_func_array(array($this, '_beforeDelete'), $params);
+ call_user_func_array(array($this, '_delete'), $params);
+ call_user_func_array(array($this, '_afterDelete'), $params);
+ } catch (PDOException $e) {
+ throw new Wootook_Core_Exception_DataAccessException('Could not delete entity: ' . $e->getMessage(), 0);
+ }
+ return $this;
+ }
+
+ abstract protected function _delete();
+
+ protected function _beforeDelete()
+ {
+ Wootook::dispatchEvent('model.before-delete', array('model' => $this));
+
+ if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
+ Wootook::dispatchEvent($this->_eventPrefix . '.before-delete', array($this->_eventObject => $this));
+ }
+
+ return $this;
+ }
+
+ protected function _afterDelete()
+ {
+ Wootook::dispatchEvent('model.after-delete', array('model' => $this));
+
+ if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
+ Wootook::dispatchEvent($this->_eventPrefix . '.after-delete', array($this->_eventObject => $this));
+ }
+
+ return $this;
+ }
+
+ public function __set($key, $value)
+ {
+ return $this->setData($key, $value);
+ }
+
+ public function __get($key)
+ {
+ return $this->getData($key);
+ }
+
+ public function __unset($key)
+ {
+ return $this->unsetData($key);
+ }
+
+ public function __isset($key)
+ {
+ return $this->hasData($key);
+ }
+}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/View/View.php b/src/application/code/core/Wootook/Core/Mvc/View/View.php
similarity index 85%
rename from src/application/modules/WootookCore/src/Wootook/Core/Mvc/View/View.php
rename to src/application/code/core/Wootook/Core/Mvc/View/View.php
index b95b941..4847061 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/View/View.php
+++ b/src/application/code/core/Wootook/Core/Mvc/View/View.php
@@ -28,20 +28,14 @@
*
*/
-namespace Wootook\Core\Mvc\View;
-
-use Wootook\Core,
- Wootook\Core\Model;
-use Wootook_Player_Model_Session;
-
/**
*
* Enter description here ...
* @author Greg
*
*/
-class View
- extends Core\Base\BaseObject
+class Wootook_Core_Mvc_View_View
+ extends Wootook_Object
{
protected $_template = null;
protected $_partials = array();
@@ -50,14 +44,14 @@ class View
protected $_scriptPath = null;
- public function _construct(Array $data = array())
+ public function __construct(Array $data = array())
{
if (isset($data['template'])) {
$this->_template = $data['template'];
unset($data['template']);
}
- parent::_construct($data);
+ parent::__construct($data);
}
protected function _prepareRender()
@@ -101,8 +95,8 @@ class View
if ($format === null) {
$format = 'H:i:s';
}
- if (!$dateTime instanceof Core\DateTime) {
- $dateTime = new Core\DateTime($dateTime);
+ if (!$dateTime instanceof Wootook_Core_DateTime) {
+ $dateTime = new Wootook_Core_DateTime($dateTime);
}
return $dateTime->toString($format);
}
@@ -122,7 +116,7 @@ class View
$args = func_get_args();
array_shift($args);
- return \Wootook::translate(\Wootook::getDefaultLocale(), $message, $args);
+ return Wootook::translate(Wootook::getDefaultLocale(), $message, $args);
}
public function translate($message, $_ = null)
@@ -130,7 +124,7 @@ class View
$args = func_get_args();
array_shift($args);
- return \Wootook::translate(\Wootook::getLocale(), $message, $args);
+ return Wootook::translate(Wootook::getLocale(), $message, $args);
}
public function renderScript($file)
@@ -185,19 +179,18 @@ class View
public function getUrl($uri, Array $params = array())
{
- return \Wootook::getUrl($uri, $params);
+ return Wootook::getUrl($uri, $params);
}
public function getStaticUrl($uri, Array $params = array())
{
- return \Wootook::getStaticUrl($uri, $params);
+ return Wootook::getStaticUrl($uri, $params);
}
public function getSkinUrl($uri, Array $params = array(), $theme = null, $package = null)
{
- if (\Wootook::$isInstalled) {
- // FIXME: External dependency should not exist
- $player = \Wootook\Player\Model\Session::getSingleton()->getPlayer();
+ if (Wootook::$isInstalled) {
+ $player = Wootook_Player_Model_Session::getSingleton()->getPlayer();
if ($player !== null && $player->getId()) {
$theme = $player->getSkinPath();
}
@@ -206,19 +199,19 @@ class View
$theme = $this->getLayout()->getTheme();
}
if ($theme === null || empty($theme)) {
- $theme = Model\Layout::DEFAULT_THEME;
+ $theme = Wootook_Core_Model_Layout::DEFAULT_THEME;
}
if ($package === null || empty($package)) {
$package = $this->getLayout()->getPackage();
}
if ($package === null || empty($package)) {
- $package = Model\Layout::DEFAULT_PACKAGE;
+ $package = Wootook_Core_Model_Layout::DEFAULT_PACKAGE;
}
$domain = $this->getLayout()->getDomain();
- $baseUrl = \Wootook::getBaseUrl('skin');
- $basePath = \Wootook::getBasePath('skin');
+ $baseUrl = Wootook::getBaseUrl('skin');
+ $basePath = Wootook::getBasePath('skin');
$pathPattern = $basePath . "{$domain}/%s/%s/{$uri}";
$urlPattern = $baseUrl . "{$domain}/%s/%s/{$uri}";
@@ -233,14 +226,14 @@ class View
$urlPattern .= '?' . implode('&', $serializedParams);
}
- if (\Wootook::fileExists(sprintf($pathPattern, $package, $theme))) {
+ if (Wootook::fileExists(sprintf($pathPattern, $package, $theme))) {
return sprintf($urlPattern, $package, $theme);
}
- if (\Wootook::fileExists(sprintf($pathPattern, $package, Model\Layout::DEFAULT_THEME))) {
- return sprintf($urlPattern, $package, Model\Layout::DEFAULT_THEME);
+ if (Wootook::fileExists(sprintf($pathPattern, $package, Wootook_Core_Model_Layout::DEFAULT_THEME))) {
+ return sprintf($urlPattern, $package, Wootook_Core_Model_Layout::DEFAULT_THEME);
}
- return sprintf($urlPattern, Model\Layout::DEFAULT_PACKAGE, Model\Layout::DEFAULT_THEME);
+ return sprintf($urlPattern, Wootook_Core_Model_Layout::DEFAULT_PACKAGE, Wootook_Core_Model_Layout::DEFAULT_THEME);
}
public function setPartial($name, $content)
@@ -312,7 +305,7 @@ class View
/**
*
- * @return Model\Layout
+ * @return Wootook_Core_Model_Layout
*/
public function getLayout()
{
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/PluginLoader/PluginLoader.php b/src/application/code/core/Wootook/Core/PluginLoader/PluginLoader.php
similarity index 53%
rename from src/application/modules/WootookCore/src/Wootook/Core/PluginLoader/PluginLoader.php
rename to src/application/code/core/Wootook/Core/PluginLoader/PluginLoader.php
index 3d86696..eaaff7a 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/PluginLoader/PluginLoader.php
+++ b/src/application/code/core/Wootook/Core/PluginLoader/PluginLoader.php
@@ -1,36 +1,6 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-namespace Wootook\Core\PluginLoader;
-
-abstract class PluginLoader
+abstract class Wootook_Core_PluginLoader_PluginLoader
{
protected $_pluginInstances = array();
protected $_namespaces = array();
@@ -41,13 +11,17 @@ abstract class PluginLoader
return $this->_pluginInstances[$pluginName];
}
- $pluginName = str_replace(' ', '\\', ucwords(str_replace('.', ' ', $pluginName)));
+ $pluginName = str_replace(' ', '_', ucwords(str_replace('.', ' ', $pluginName)));
$pluginName = str_replace(' ', '', ucwords(str_replace('-', ' ', $pluginName)));
foreach ($this->_namespaces as $namespace => $path) {
- $className = $namespace . '\\' . $pluginName;
+ $className = $namespace . $pluginName;
$fileName = $path . DIRECTORY_SEPARATOR .
- str_replace('\\', DIRECTORY_SEPARATOR, $pluginName) . '.php';
+ str_replace('_', DIRECTORY_SEPARATOR, $pluginName) . '.php';
+
+ if (!Wootook::fileExists($fileName)) {
+ continue;
+ }
if (!class_exists($className, true)) {
continue;
@@ -62,7 +36,7 @@ abstract class PluginLoader
public function registerNamespace($namespace, $path = null)
{
if ($path === null) {
- $path = str_replace('\\', DIRECTORY_SEPARATOR, $namespace);
+ $path = str_replace('_', DIRECTORY_SEPARATOR, $namespace);
}
$this->_namespaces[$namespace] = $path;
@@ -103,4 +77,4 @@ abstract class PluginLoader
return $this;
}
-}
+}
\ No newline at end of file
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Resource/EntityCollection.php b/src/application/code/core/Wootook/Core/Resource/EntityCollection.php
similarity index 50%
rename from src/application/modules/WootookCore/src/Wootook/Core/Resource/EntityCollection.php
rename to src/application/code/core/Wootook/Core/Resource/EntityCollection.php
index 6f1a1de..0f0d29b 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Resource/EntityCollection.php
+++ b/src/application/code/core/Wootook/Core/Resource/EntityCollection.php
@@ -1,47 +1,12 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-namespace Wootook\Core\Resource;
-
-use Wootook\Core\Database,
- Wootook\Core\Database\Adapter,
- Wootook\Core\Database\Orm,
- Wootook\Core\Database\Sql,
- Wootook\Core\Database\Sql\Placeholder,
- Wootook\Core\Exception as CoreException;
-
-abstract class EntityCollection
- implements \Iterator, \Countable
+abstract class Wootook_Core_Resource_EntityCollection
+ implements Iterator, Countable
{
- use Database\Resource\DataMapper,
- Database\Resource\ReadConnection;
+ protected $_connection = null;
+
+ /** @var Wootook_Core_Database_Sql_Select */
+ protected $_select = null;
protected $_entityTable = null;
protected $_entityClass = null;
@@ -49,12 +14,14 @@ abstract class EntityCollection
protected $_eventObject = null;
protected $_eventPrefix = null;
+ protected $_dataMapper = null;
+
protected $_curPage = null;
protected $_pageSize = null;
protected $_items = array();
- public function __construct(Adapter\Adapter $connection = null)
+ public function __construct(Wootook_Core_Database_Adapter_Adapter $connection = null)
{
$this->setReadConnection($connection);
@@ -69,7 +36,59 @@ abstract class EntityCollection
$this->_entityClass = $entityClass;
}
- public function load()
+ public function getSelect()
+ {
+ if ($this->_select === null) {
+ $this->_select = $this->getReadConnection()
+ ->select()
+ ->from(array('main_table' => $this->getReadConnection()->getTable($this->_entityTable)));
+
+ $this->_prepareSelect($this->_select);
+ }
+
+ return $this->_select;
+ }
+
+ public function _prepareSelect(Wootook_Core_Database_Sql_Select $select)
+ {
+ }
+
+ /**
+ *
+ * @return Wootook_Core_Database_Orm_DataMapper
+ */
+ public function getDataMapper()
+ {
+ if ($this->_dataMapper === null) {
+ $this->_dataMapper = new Wootook_Core_Database_Orm_DataMapper();
+ }
+ return $this->_dataMapper;
+ }
+
+ /**
+ * @return Wootook_Core_Database_Adapter_Adapter
+ */
+ public function getReadConnection()
+ {
+ return $this->_connection;
+ }
+
+ public function setReadConnection($connection)
+ {
+ if ($connection instanceof Wootook_Core_Database_Adapter_Pdo_Mysql) {
+ $this->_connection = $connection;
+ } else if (is_string($connection)) {
+ $this->_connection = Wootook_Core_Database_ConnectionManager::getSingleton()
+ ->getConnection($connection);
+ } else {
+ throw new Wootook_Core_Exception_RuntimeException(
+ 'First parameter should be either a database connection object or a string identifier.');
+ }
+
+ return $this;
+ }
+
+ final public function load()
{
$this->_beforeLoad();
$this->_load();
@@ -80,10 +99,10 @@ abstract class EntityCollection
protected function _beforeLoad()
{
- \Wootook::dispatchEvent('resource.collection.before-load', array('model' => $this));
+ Wootook::dispatchEvent('resource.collection.before-load', array('model' => $this));
if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
- \Wootook::dispatchEvent($this->_eventPrefix . '.before-load', array($this->_eventObject => $this));
+ Wootook::dispatchEvent($this->_eventPrefix . '.before-load', array($this->_eventObject => $this));
}
return $this;
@@ -91,10 +110,10 @@ abstract class EntityCollection
protected function _afterLoad()
{
- \Wootook::dispatchEvent('resource.collection.after-load', array('model' => $this));
+ Wootook::dispatchEvent('resource.collection.after-load', array('model' => $this));
if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
- \Wootook::dispatchEvent($this->_eventPrefix . '.after-load', array($this->_eventObject => $this));
+ Wootook::dispatchEvent($this->_eventPrefix . '.after-load', array($this->_eventObject => $this));
}
return $this;
@@ -119,9 +138,9 @@ abstract class EntityCollection
$this->_items = array();
if (func_num_args() > 1) {
- $reflection = new \ReflectionClass(array_shift($args));
+ $reflection = new ReflectionClass(array_shift($args));
} else {
- $reflection = new \ReflectionClass($this->_entityClass);
+ $reflection = new ReflectionClass($this->_entityClass);
}
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
@@ -134,6 +153,33 @@ abstract class EntityCollection
return $this;
}
+ public function getSize($maintainGrouping = array())
+ {
+ $clone = clone $this->_select;
+ $clone->reset(Wootook_Core_Database_Sql_Select::COLUMNS);
+ if (empty($maintainGrouping)) {
+ $clone->reset(Wootook_Core_Database_Sql_Select::GROUP);
+ } else {
+ $groupingFields = $clone->getPart(Wootook_Core_Database_Sql_Select::GROUP);
+ $clone->reset(Wootook_Core_Database_Sql_Select::GROUP);
+ foreach ($groupingFields as $field) {
+ if (in_array($field, $maintainGrouping)) {
+ $clone->group($field);
+ }
+ }
+ }
+ $clone->column(new Wootook_Core_Database_Sql_Placeholder_Expression('COUNT(*)'));
+
+ $database = $this->getReadConnection();
+ $statement = $database->prepare($clone);
+
+ $statement->execute();
+ $count = $statement->fetchColumn();
+ $statement->closeCursor();
+
+ return $count;
+ }
+
public function count()
{
return count($this->_items);
diff --git a/src/application/code/core/Wootook/Core/Setup/Exception/RuntimeException.php b/src/application/code/core/Wootook/Core/Setup/Exception/RuntimeException.php
new file mode 100644
index 0000000..29a8002
--- /dev/null
+++ b/src/application/code/core/Wootook/Core/Setup/Exception/RuntimeException.php
@@ -0,0 +1,7 @@
+_setupConnection = Wootook_Core_Database_ConnectionManager::getSingleton()
+ ->getConnection($connection);
+ } else {
+ $this->_setupConnection = $connection;
+ }
+
+ return $this;
+ }
+
+ /**
+ *
+ * Enter description here ...
+ * @return Wootook_Core_Database_Adapter_Pdo_Mysql
+ */
+ public function getSetupConnection()
+ {
+ if ($this->_setupConnection === null) {
+ $this->setSetupConnection('default');
+ }
+ return $this->_setupConnection;
+ }
+
+ public function getTableName($tableName)
+ {
+ return $this->getSetupConnection()->getTable($tableName);
+ }
+
+ public function query($statement)
+ {
+ try {
+ if (!$this->getSetupConnection()->query($statement)) {
+ $info = $this->getSetupConnection()->errorInfo();
+ throw new Wootook_Core_Setup_Exception_RuntimeException(
+ Wootook::__('Query failed: SQLSTATE %s: %s.', $info[1], $info[2]));
+ }
+ } catch (PDOException $e) {
+ Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
+ throw new Wootook_Core_Setup_Exception_RuntimeException($e->getMessage(), null, $e);
+ }
+ }
+
+ public function grant($tableName, $connectionName, $perms = null)
+ {
+ $hostname = Wootook::getConfig("database/{$connectionName}/params/hostname");
+ $username = Wootook::getConfig("database/{$connectionName}/params/username");
+ $database = Wootook::getConfig("database/{$connectionName}/params/database");
+ $password = Wootook::getConfig("database/{$connectionName}/params/password");
+
+ if ($perms === null) {
+ $perms = 'ALL PRIVILEGES';
+ } else if (is_array($perms)) {
+ $perms = implode(' ', $perms);
+ }
+
+ $sql =<<getTable($tableName)}
+TO '{$username}@{$hostname}' IDENTIFIED BY '$password'
+SQL_EOF;
+
+ $this->getSetupConnection()->query($sql);
+
+ return $this;
+ }
+
+ public function revoke($tableName, $connectionName, $perms = null)
+ {
+ $hostname = Wootook::getConfig("database/{$connectionName}/params/hostname");
+ $username = Wootook::getConfig("database/{$connectionName}/params/username");
+ $database = Wootook::getConfig("database/{$connectionName}/params/database");
+ $password = Wootook::getConfig("database/{$connectionName}/params/password");
+
+ if ($perms === null) {
+ $perms = 'ALL PRIVILEGES';
+ } else if (is_array($perms)) {
+ $perms = implode(' ', $perms);
+ }
+
+ $sql =<<getTable($tableName)}
+FROM '{$username}@{$hostname}'
+SQL_EOF;
+
+ $this->getSetupConnection()->query($sql);
+
+ return $this;
+ }
+
+ public function run($script)
+ {
+ include $script;
+ }
+
+ public function getConfig($path = null)
+ {
+ return Wootook::getConfig($path);
+ }
+
+ public function getWebsiteConfig($path = null, $websiteId = null)
+ {
+ return Wootook::getWebsiteConfig($path, $websiteId);
+ }
+
+ public function getGameConfig($path = null, $gameId = null)
+ {
+ return Wootook::getGameConfig($path, $gameId);
+ }
+}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Setup/Updater/ScriptQueue.php b/src/application/code/core/Wootook/Core/Setup/Updater/ScriptQueue.php
similarity index 89%
rename from src/application/modules/WootookCore/src/Wootook/Core/Setup/Updater/ScriptQueue.php
rename to src/application/code/core/Wootook/Core/Setup/Updater/ScriptQueue.php
index 3d8ff5e..e0ce1d5 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Setup/Updater/ScriptQueue.php
+++ b/src/application/code/core/Wootook/Core/Setup/Updater/ScriptQueue.php
@@ -1,43 +1,7 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-namespace Wootook\Core\Setup\Updater;
-
-use Wootook\Core\Exception as CoreException,
- Wootook\Core\Setup\Exception as SetupException;
-
-/**
- *
- */
-class ScriptQueue
- implements \Iterator, \Countable, \ArrayAccess
+class Wootook_Core_Setup_Updater_ScriptQueue
+ implements Iterator, Countable, ArrayAccess
{
const PCRE_FILE_PATTERN = '%^(?install|upgrade|uninstall|downgrade)-(?[0-9]+\.[0-9]+\.[0-9]+)(?:\.(?[a-z]+)(?[0-9]+))?(?:-(?[0-9]+\.[0-9]+\.[0-9]+)(?:\.(?[a-z]+)(?[0-9]+))?)?$%';
const PCRE_VERSION_PATTERN = '%^(?[0-9]+\.[0-9]+\.[0-9]+)(?:-(?[a-z]+)(?[0-9]+)?)?$%';
@@ -124,7 +88,7 @@ class ScriptQueue
if ($fromVersion['level'] < $toVersion['level']) {
$this->_upgradeToVersion($fromVersion, $toVersion);
} else {
-// throw new CoreException\RuntimeException("Version already installed.");
+// throw new Wootook_Core_Exception_RuntimeException("Version already installed.");
}
} else {
$this->_upgradeToVersion($fromVersion, $toVersion);
@@ -136,7 +100,7 @@ class ScriptQueue
if ($fromVersion['level'] < $toVersion['level']) {
$this->_upgradeToVersion($fromVersion, $toVersion);
} else {
-// throw new CoreException\RuntimeException("Version already installed.");
+// throw new Wootook_Core_Exception_RuntimeException("Version already installed.");
}
} else {
$this->_upgradeToVersion($fromVersion, $toVersion);
@@ -148,13 +112,13 @@ class ScriptQueue
if ($fromVersion['level'] < $toVersion['level']) {
$this->_upgradeToVersion($fromVersion, $toVersion);
} else {
-// throw new CoreException\RuntimeException("Version already installed.");
+// throw new Wootook_Core_Exception_RuntimeException("Version already installed.");
}
} else {
$this->_upgradeToVersion($fromVersion, $toVersion);
}
} else {
- throw new SetupException\VersionStageError("Invalid version stage.");
+ throw new Wootook_Core_Setup_Exception_VersionStageError("Invalid version stage.");
}
break;
}
@@ -203,7 +167,7 @@ class ScriptQueue
} else if (isset($this->_installVersions[$highestVersion][self::STAGE_ALPHA])) {
$stage = self::STAGE_ALPHA;
} else {
- throw new SetupException\VersionStageError("Invalid version stage.");
+ throw new Wootook_Core_Setup_Exception_VersionStageError("Invalid version stage.");
}
$levelList = array_keys($this->_installVersions[$highestVersion][$stage]);
@@ -228,7 +192,7 @@ class ScriptQueue
protected function _downgradeToVersion($fromVersion, $toVersion)
{
- throw new CoreException\RuntimeException("Downgrade isn't yet implemented.");
+ throw new Wootook_Core_Exception_RuntimeException("Downgrade isn't yet implemented.");
}
protected function _upgradeToVersion($fromVersion, $toVersion)
@@ -285,7 +249,7 @@ class ScriptQueue
$level = max(array_keys($versionPointer[$highestVersion][$stage]));
} else {
- throw new SetupException\VersionValueError("Invalid version value.");
+ throw new Wootook_Core_Setup_Exception_VersionValueError("Invalid version value.");
}
$currentVersion = array(
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Base/Singleton.php b/src/application/code/core/Wootook/Core/Singleton.php
similarity index 96%
rename from src/application/modules/WootookCore/src/Wootook/Core/Base/Singleton.php
rename to src/application/code/core/Wootook/Core/Singleton.php
index c8a1cf2..c136e82 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Base/Singleton.php
+++ b/src/application/code/core/Wootook/Core/Singleton.php
@@ -28,15 +28,13 @@
*
*/
-namespace Wootook\Core\Base;
-
/**
*
* Enter description here ...
* @author Greg
*
*/
-interface Singleton
+interface Wootook_Core_Singleton
{
public static function getSingleton();
-}
+}
\ No newline at end of file
diff --git a/src/application/modules/WootookCore/config/module.php b/src/application/code/core/Wootook/Core/configs/module.php
similarity index 65%
rename from src/application/modules/WootookCore/config/module.php
rename to src/application/code/core/Wootook/Core/configs/module.php
index 0ab6e23..9b01f6a 100644
--- a/src/application/modules/WootookCore/config/module.php
+++ b/src/application/code/core/Wootook/Core/configs/module.php
@@ -1,13 +1,13 @@
array(
- 'modules' => array(
- 'WootookCore' => array(
- 'version' => '1.5.0'
+ 'modules' => array(
+ 'Wootook_Core' => array(
+ 'version' => '1.5.0'
)
),
+ 'global' => array(
'models' => array(
'core' => array(
- 'namespace' => 'Wootook\\Core\\Model',
+ 'namespace' => 'Warner_Core_Model_',
'connection' => array(
'read' => 'core_read',
'write' => 'core_write',
@@ -17,17 +17,17 @@
),
'blocks' => array(
'core' => array(
- 'namespace' => 'Wootook\\Core\\Block'
+ 'namespace' => 'Warner_Core_Block_'
)
)
),
'frontend' => array(
'routes' => array(
'core' => array(
- 'controllers' => array(
- 'core' => 'Wootook\\Core\\Controller'
+ 'modules' => array(
+ 'core' => 'Wootook_Core'
)
)
)
)
- );
+ );
\ No newline at end of file
diff --git a/src/application/modules/WootookCore/install/mysql5/install-1.5.0.beta2.php b/src/application/code/core/Wootook/Core/install/mysql5/install-1.5.0.php
similarity index 100%
rename from src/application/modules/WootookCore/install/mysql5/install-1.5.0.beta2.php
rename to src/application/code/core/Wootook/Core/install/mysql5/install-1.5.0.php
diff --git a/src/application/modules/WootookCore/install/mysql5/uninstall-1.5.0.beta2.php b/src/application/code/core/Wootook/Core/install/mysql5/uninstall-1.5.0.php
similarity index 100%
rename from src/application/modules/WootookCore/install/mysql5/uninstall-1.5.0.beta2.php
rename to src/application/code/core/Wootook/Core/install/mysql5/uninstall-1.5.0.php
diff --git a/src/application/code/core/Wootook/Empire/Block/Overview/DestroyPlanet.php b/src/application/code/core/Wootook/Empire/Block/Overview/DestroyPlanet.php
index a780d30..8d78612 100644
--- a/src/application/code/core/Wootook/Empire/Block/Overview/DestroyPlanet.php
+++ b/src/application/code/core/Wootook/Empire/Block/Overview/DestroyPlanet.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Block_Overview_DestroyPlanet
extends Wootook_Core_Block_Html_Form
diff --git a/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List.php b/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List.php
index dd2c30a..770fcbb 100644
--- a/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List.php
+++ b/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Block_Overview_Fleet_List
extends Wootook_Core_Block_Template
diff --git a/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List/Item.php b/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List/Item.php
index 0a8fbc1..cd1cffc 100644
--- a/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List/Item.php
+++ b/src/application/code/core/Wootook/Empire/Block/Overview/Fleet/List/Item.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Block_Overview_Fleet_List_Item
extends Wootook_Core_Block_Template
@@ -131,12 +103,12 @@ class Wootook_Empire_Block_Overview_Fleet_List_Item
public function getOriginPlanetName()
{
- return $this->getFleetItem()->getOriginPlanetName();
+ return $this->getOriginPlanetName();
}
public function getOriginPlanetCoords()
{
- return $this->getFleetItem()->getOriginPlanetCoords();
+ return $this->getOriginPlanetCoords();
}
public function getDestinationPlanet()
@@ -161,12 +133,12 @@ class Wootook_Empire_Block_Overview_Fleet_List_Item
public function getDestinationPlanetName()
{
- return $this->getFleetItem()->getDestinationPlanetName();
+ return $this->getDestinationPlanetName();
}
public function getDestinationPlanetCoords()
{
- return $this->getFleetItem()->getDestinationPlanetCoords();
+ return $this->getDestinationPlanetCoords();
}
public function getMissionLabel()
diff --git a/src/application/code/core/Wootook/Empire/Block/Overview/RenamePlanet.php b/src/application/code/core/Wootook/Empire/Block/Overview/RenamePlanet.php
index 8aebc64..24ece3e 100644
--- a/src/application/code/core/Wootook/Empire/Block/Overview/RenamePlanet.php
+++ b/src/application/code/core/Wootook/Empire/Block/Overview/RenamePlanet.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Block_Overview_RenamePlanet
extends Wootook_Core_Block_Html_Form
diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Builder/ItemAbstract.php b/src/application/code/core/Wootook/Empire/Block/Planet/Builder/ItemAbstract.php
index eb65634..dfffacd 100644
--- a/src/application/code/core/Wootook/Empire/Block/Planet/Builder/ItemAbstract.php
+++ b/src/application/code/core/Wootook/Empire/Block/Planet/Builder/ItemAbstract.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
abstract class Wootook_Empire_Block_Planet_Builder_ItemAbstract
extends Wootook_Core_Block_Template
diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Builder/Queue/ItemAbstract.php b/src/application/code/core/Wootook/Empire/Block/Planet/Builder/Queue/ItemAbstract.php
index 38d33a9..962783a 100644
--- a/src/application/code/core/Wootook/Empire/Block/Planet/Builder/Queue/ItemAbstract.php
+++ b/src/application/code/core/Wootook/Empire/Block/Planet/Builder/Queue/ItemAbstract.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
abstract class Wootook_Empire_Block_Planet_Builder_Queue_ItemAbstract
extends Wootook_Empire_Block_Planet_Builder_ItemAbstract
diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Builder/QueueAbstract.php b/src/application/code/core/Wootook/Empire/Block/Planet/Builder/QueueAbstract.php
index 93167af..baf9c71 100644
--- a/src/application/code/core/Wootook/Empire/Block/Planet/Builder/QueueAbstract.php
+++ b/src/application/code/core/Wootook/Empire/Block/Planet/Builder/QueueAbstract.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
abstract class Wootook_Empire_Block_Planet_Builder_QueueAbstract
extends Wootook_Core_Block_Template
diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/BuilderAbstract.php b/src/application/code/core/Wootook/Empire/Block/Planet/BuilderAbstract.php
index c3a7ef9..9cc98f2 100644
--- a/src/application/code/core/Wootook/Empire/Block/Planet/BuilderAbstract.php
+++ b/src/application/code/core/Wootook/Empire/Block/Planet/BuilderAbstract.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
abstract class Wootook_Empire_Block_Planet_BuilderAbstract
extends Wootook_Core_Block_Template
diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings.php b/src/application/code/core/Wootook/Empire/Block/Planet/Buildings.php
index 5cbc9e4..77d4a86 100644
--- a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings.php
+++ b/src/application/code/core/Wootook/Empire/Block/Planet/Buildings.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Block_Planet_Buildings
extends Wootook_Empire_Block_Planet_BuilderAbstract
diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Item.php b/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Item.php
index 3abe561..1c4a970 100644
--- a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Item.php
+++ b/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Item.php
@@ -1,40 +1,7 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-namespace Wootook\Empire\Block\Planet\Buildings;
-
-use Wootook\Core,
- Wootook\Empire\Block\Planet\Builder;
-
-class Item
- extends Builder\ItemAbstract
+class Wootook_Empire_Block_Planet_Buildings_Item
+ extends Wootook_Empire_Block_Planet_Builder_ItemAbstract
{
public function getLevel()
{
@@ -78,7 +45,7 @@ class Item
$resourceConfig = array();
foreach ($resources as $resourceId => $resourceValue) {
- $resourceConfig[$resourceId] = new Core\BaseObject($this->app(), array(
+ $resourceConfig[$resourceId] = new Wootook_Object(array(
'resource_id' => $resourceId,
'value' => $resourceValue
));
@@ -102,4 +69,4 @@ class Item
{
return $this->getBuildingTime($this->getNextLevel());
}
-}
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue.php b/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue.php
index cb9664a..b1c3f55 100644
--- a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue.php
+++ b/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Block_Planet_Buildings_Queue
extends Wootook_Empire_Block_Planet_Builder_QueueAbstract
diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue/Item.php b/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue/Item.php
index 196814a..6941b62 100644
--- a/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue/Item.php
+++ b/src/application/code/core/Wootook/Empire/Block/Planet/Buildings/Queue/Item.php
@@ -28,19 +28,14 @@
*
*/
-namespace Wootook\Empire\Block\Planet\Buildings\Queue;
-
-use Wootook\Core,
-Wootook\Empire\Block\Planet\Builder\Queue;
-
/**
*
* Enter description here ...
* @author Greg
*
*/
-class Item
- extends Queue\ItemAbstract
+class Wootook_Empire_Block_Planet_Buildings_Queue_Item
+ extends Wootook_Empire_Block_Planet_Builder_Queue_ItemAbstract
{
protected $_itemIdField = 'building_id';
@@ -83,7 +78,7 @@ class Item
$resourceConfig = array();
foreach ($resources as $resourceId => $resourceValue) {
- $resourceConfig[$resourceId] = new Core\BaseObject($this->app(), array(
+ $resourceConfig[$resourceId] = new Wootook_Object(array(
'resource_id' => $resourceId,
'value' => $resourceValue
));
@@ -107,4 +102,4 @@ class Item
{
return $this->getBuildingTime($this->getNextLevel());
}
-}
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Overview.php b/src/application/code/core/Wootook/Empire/Block/Planet/Overview.php
index 603e910..f24f5dc 100644
--- a/src/application/code/core/Wootook/Empire/Block/Planet/Overview.php
+++ b/src/application/code/core/Wootook/Empire/Block/Planet/Overview.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Block_Planet_Overview
extends Wootook_Core_Block_Template
diff --git a/src/application/code/core/Wootook/Empire/Block/PlanetList.php b/src/application/code/core/Wootook/Empire/Block/PlanetList.php
index 4b54f75..4d1decf 100644
--- a/src/application/code/core/Wootook/Empire/Block/PlanetList.php
+++ b/src/application/code/core/Wootook/Empire/Block/PlanetList.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Block_PlanetList
extends Wootook_Core_Block_Template
diff --git a/src/application/code/core/Wootook/Empire/Block/Topnav.php b/src/application/code/core/Wootook/Empire/Block/Topnav.php
index 1b31d84..72a6d5b 100644
--- a/src/application/code/core/Wootook/Empire/Block/Topnav.php
+++ b/src/application/code/core/Wootook/Empire/Block/Topnav.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Block_Topnav
extends Wootook_Core_Block_Template
diff --git a/src/application/code/core/Wootook/Empire/Controller/BuildingsController.php b/src/application/code/core/Wootook/Empire/Controller/BuildingsController.php
index 777ac8c..6a5234b 100644
--- a/src/application/code/core/Wootook/Empire/Controller/BuildingsController.php
+++ b/src/application/code/core/Wootook/Empire/Controller/BuildingsController.php
@@ -1,31 +1,10 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
+ * Created by JetBrains PhpStorm.
+ * User: Greg
+ * Date: 19/03/12
+ * Time: 18:46
+ * To change this template use File | Settings | File Templates.
*/
class Wootook_Empire_Controller_BuildingsController
extends Wootook_Player_Mvc_Controller_Registered
diff --git a/src/application/code/core/Wootook/Empire/Exception.php b/src/application/code/core/Wootook/Empire/Exception.php
index 9633dca..e2bd909 100644
--- a/src/application/code/core/Wootook/Empire/Exception.php
+++ b/src/application/code/core/Wootook/Empire/Exception.php
@@ -1,31 +1,3 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
interface Wootook_Empire_Exception extends Wootook_Exception {}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Empire/Exception/Exception.php b/src/application/code/core/Wootook/Empire/Exception/Exception.php
index fb0647b..b3154b8 100644
--- a/src/application/code/core/Wootook/Empire/Exception/Exception.php
+++ b/src/application/code/core/Wootook/Empire/Exception/Exception.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Exception_Exception
extends Exception
diff --git a/src/application/code/core/Wootook/Empire/Exception/Planet.php b/src/application/code/core/Wootook/Empire/Exception/Planet.php
index 9a4f00b..36c2cf2 100644
--- a/src/application/code/core/Wootook/Empire/Exception/Planet.php
+++ b/src/application/code/core/Wootook/Empire/Exception/Planet.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Exception_Planet
extends Wootook_Empire_Exception_RuntimeException
diff --git a/src/application/code/core/Wootook/Empire/Exception/RuntimeException.php b/src/application/code/core/Wootook/Empire/Exception/RuntimeException.php
index 7e03d1e..c4dcb32 100644
--- a/src/application/code/core/Wootook/Empire/Exception/RuntimeException.php
+++ b/src/application/code/core/Wootook/Empire/Exception/RuntimeException.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Exception_RuntimeException
extends RuntimeException
diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Combat.php b/src/application/code/core/Wootook/Empire/Helper/Config/Combat.php
index f89db25..26a1bc8 100644
--- a/src/application/code/core/Wootook/Empire/Helper/Config/Combat.php
+++ b/src/application/code/core/Wootook/Empire/Helper/Config/Combat.php
@@ -1,38 +1,10 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
/**
*
* Enter description here ...
*
- * @uses Wootook\Core\BaseObject
+ * @uses Wootook_Object
* @uses Legacies_Empire
*/
class Wootook_Empire_Helper_Config_Combat
@@ -72,4 +44,4 @@ class Wootook_Empire_Helper_Config_Combat
// NOP
return $this;
}
-}
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/FieldsAlias.php b/src/application/code/core/Wootook/Empire/Helper/Config/FieldsAlias.php
index f171de0..101bc5f 100644
--- a/src/application/code/core/Wootook/Empire/Helper/Config/FieldsAlias.php
+++ b/src/application/code/core/Wootook/Empire/Helper/Config/FieldsAlias.php
@@ -1,38 +1,10 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
/**
*
* Enter description here ...
*
- * @uses Wootook\Core\BaseObject
+ * @uses Wootook_Object
* @uses Legacies_Empire
*/
class Wootook_Empire_Helper_Config_FieldsAlias
@@ -72,4 +44,4 @@ class Wootook_Empire_Helper_Config_FieldsAlias
// NOP
return $this;
}
-}
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Labels.php b/src/application/code/core/Wootook/Empire/Helper/Config/Labels.php
index 1e0b860..94297a2 100644
--- a/src/application/code/core/Wootook/Empire/Helper/Config/Labels.php
+++ b/src/application/code/core/Wootook/Empire/Helper/Config/Labels.php
@@ -1,38 +1,10 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
/**
*
* Enter description here ...
*
- * @uses Wootook\Core\BaseObject
+ * @uses Wootook_Object
* @uses Legacies_Empire
*/
class Wootook_Empire_Helper_Config_Labels
diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Prices.php b/src/application/code/core/Wootook/Empire/Helper/Config/Prices.php
index 889e506..1a328de 100644
--- a/src/application/code/core/Wootook/Empire/Helper/Config/Prices.php
+++ b/src/application/code/core/Wootook/Empire/Helper/Config/Prices.php
@@ -1,38 +1,10 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
/**
*
* Enter description here ...
*
- * @uses Wootook\Core\BaseObject
+ * @uses Wootook_Object
* @uses Legacies_Empire
*/
class Wootook_Empire_Helper_Config_Prices
@@ -72,4 +44,4 @@ class Wootook_Empire_Helper_Config_Prices
// NOP
return $this;
}
-}
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Production.php b/src/application/code/core/Wootook/Empire/Helper/Config/Production.php
index 11be14e..d4539fc 100644
--- a/src/application/code/core/Wootook/Empire/Helper/Config/Production.php
+++ b/src/application/code/core/Wootook/Empire/Helper/Config/Production.php
@@ -1,38 +1,10 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
/**
*
* Enter description here ...
*
- * @uses Wootook\Core\BaseObject
+ * @uses Wootook_Object
* @uses Legacies_Empire
*/
class Wootook_Empire_Helper_Config_Production
@@ -72,4 +44,4 @@ class Wootook_Empire_Helper_Config_Production
// NOP
return $this;
}
-}
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Requirements.php b/src/application/code/core/Wootook/Empire/Helper/Config/Requirements.php
index 3a7c544..04ea042 100644
--- a/src/application/code/core/Wootook/Empire/Helper/Config/Requirements.php
+++ b/src/application/code/core/Wootook/Empire/Helper/Config/Requirements.php
@@ -1,38 +1,10 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
/**
*
* Enter description here ...
*
- * @uses Wootook\Core\BaseObject
+ * @uses Wootook_Object
* @uses Legacies_Empire
*/
class Wootook_Empire_Helper_Config_Requirements
@@ -72,4 +44,4 @@ class Wootook_Empire_Helper_Config_Requirements
// NOP
return $this;
}
-}
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Resources.php b/src/application/code/core/Wootook/Empire/Helper/Config/Resources.php
index 212ebaa..8ce2483 100644
--- a/src/application/code/core/Wootook/Empire/Helper/Config/Resources.php
+++ b/src/application/code/core/Wootook/Empire/Helper/Config/Resources.php
@@ -1,38 +1,10 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
/**
*
* Enter description here ...
*
- * @uses Wootook\Core\BaseObject
+ * @uses Wootook_Object
* @uses Legacies_Empire
*/
class Wootook_Empire_Helper_Config_Resources
@@ -72,4 +44,4 @@ class Wootook_Empire_Helper_Config_Resources
// NOP
return $this;
}
-}
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Types.php b/src/application/code/core/Wootook/Empire/Helper/Config/Types.php
index ac3feaa..9ef029d 100644
--- a/src/application/code/core/Wootook/Empire/Helper/Config/Types.php
+++ b/src/application/code/core/Wootook/Empire/Helper/Config/Types.php
@@ -1,38 +1,10 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
/**
*
* Enter description here ...
*
- * @uses Wootook\Core\BaseObject
+ * @uses Wootook_Object
* @uses Legacies_Empire
*/
class Wootook_Empire_Helper_Config_Types
@@ -80,4 +52,4 @@ class Wootook_Empire_Helper_Config_Types
}
return in_array($element, $this->getData($type));
}
-}
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Empire/Model/Builder/Break.php b/src/application/code/core/Wootook/Empire/Model/Builder/Break.php
index af6d5f7..a1bfc75 100644
--- a/src/application/code/core/Wootook/Empire/Model/Builder/Break.php
+++ b/src/application/code/core/Wootook/Empire/Model/Builder/Break.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Model_Builder_Break
extends Exception
diff --git a/src/application/code/core/Wootook/Empire/Model/Builder/Item.php b/src/application/code/core/Wootook/Empire/Model/Builder/Item.php
index 0817b55..d590b81 100644
--- a/src/application/code/core/Wootook/Empire/Model/Builder/Item.php
+++ b/src/application/code/core/Wootook/Empire/Model/Builder/Item.php
@@ -1,39 +1,7 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-namespace Wootook\Empire\Model\Builder;
-
-use Wootook\Core;
-
-class Item
- extends Core\BaseObject
+class Wootook_Empire_Model_Builder_Item
+ extends Wootook_Object
{
protected $_index = null;
@@ -48,4 +16,4 @@ class Item
return $this;
}
-}
+}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Empire/Model/BuilderAbstract.php b/src/application/code/core/Wootook/Empire/Model/BuilderAbstract.php
index 05e3306..dc0899e 100644
--- a/src/application/code/core/Wootook/Empire/Model/BuilderAbstract.php
+++ b/src/application/code/core/Wootook/Empire/Model/BuilderAbstract.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
abstract class Wootook_Empire_Model_BuilderAbstract
implements Countable, Serializable, Iterator
diff --git a/src/application/code/core/Wootook/Empire/Model/Fleet.php b/src/application/code/core/Wootook/Empire/Model/Fleet.php
index 010c2b7..e622226 100644
--- a/src/application/code/core/Wootook/Empire/Model/Fleet.php
+++ b/src/application/code/core/Wootook/Empire/Model/Fleet.php
@@ -1,37 +1,9 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
/**
*
* Enter description here ...
*
- * @uses Wootook\Core\BaseObject
+ * @uses Wootook_Object
* @uses Legacies_Empire
*/
class Wootook_Empire_Model_Fleet
diff --git a/src/application/code/core/Wootook/Empire/Model/Galaxy/Position.php b/src/application/code/core/Wootook/Empire/Model/Galaxy/Position.php
index c2567c7..2ce4b24 100644
--- a/src/application/code/core/Wootook/Empire/Model/Galaxy/Position.php
+++ b/src/application/code/core/Wootook/Empire/Model/Galaxy/Position.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Model_Galaxy_Position
extends Wootook_Core_Mvc_Model_Entity_SubTable
diff --git a/src/application/code/core/Wootook/Empire/Model/Planet.php b/src/application/code/core/Wootook/Empire/Model/Planet.php
index 1f099e5..980524f 100644
--- a/src/application/code/core/Wootook/Empire/Model/Planet.php
+++ b/src/application/code/core/Wootook/Empire/Model/Planet.php
@@ -1,36 +1,8 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
/**
*
- * @uses Wootook\Core\BaseObject
+ * @uses Wootook_Object
* @uses Legacies_Empire
* @uses Wootook_Player_Model_Entity
*/
@@ -192,7 +164,7 @@ class Wootook_Empire_Model_Planet
break;
}
- throw new Wootook_Core_Exception_RuntimeException(\Wootook::__('Undefined method %s::%s.', get_class($this), $method));
+ throw new Wootook_Core_Exception_RuntimeException(Wootook::__('Undefined method %s::%s.', get_class($this), $method));
}
/**
@@ -248,7 +220,7 @@ class Wootook_Empire_Model_Planet
$storageSize = Math::add(BASE_STORAGE_SIZE, $storageEnhancement);
- $event = \Wootook::dispatchEvent($this->_eventPrefix . 'update-storage.resource', array(
+ $event = Wootook::dispatchEvent($this->_eventPrefix . 'update-storage.resource', array(
'resource_id' => $resource,
'resource_data' => $resourceData,
'default_size' => $storageSize,
@@ -297,7 +269,7 @@ class Wootook_Empire_Model_Planet
}
if ($this->getPlayer()->isVacation()) {
- $resourceConfig = \Wootook::app()->getDefaultGame()->getConfig('resource/base-income');
+ $resourceConfig = Wootook::getGameConfig('resource/base-income');
foreach ($resources->getAllDatas() as $resource => $resourceData) {
$this->setData($resourceData['production_field'], $resourceConfig[$resource]);
}
@@ -390,7 +362,7 @@ class Wootook_Empire_Model_Planet
}
// Dispatch 'planet.update-production.before' event
- \Wootook::dispatchEvent($this->_eventPrefix . '.update-production.before', array(
+ Wootook::dispatchEvent($this->_eventPrefix . '.update-production.before', array(
$this->_eventObject => $this,
'player' => $this->getPlayer(),
'productions' => $actualProduction
@@ -406,7 +378,7 @@ class Wootook_Empire_Model_Planet
}
// Dispatch 'planet.update-production.after' event
- \Wootook::dispatchEvent($this->_eventPrefix . '.update-production.after', array(
+ Wootook::dispatchEvent($this->_eventPrefix . '.update-production.after', array(
$this->_eventObject => $this,
'player' => $this->getPlayer()
));
@@ -644,16 +616,16 @@ class Wootook_Empire_Model_Planet
}
if ($this->isDestroyed()) {
- throw new Wootook_Empire_Exception_Planet(\Wootook::__('Planet is already destroyed.'));
+ throw new Wootook_Empire_Exception_Planet(Wootook::__('Planet is already destroyed.'));
}
if ($this->getFleetCollection()->count() > 0) {
- throw new Wootook_Empire_Exception_Planet(\Wootook::__("Could not delete planet until fleets aten't retuned."));
+ throw new Wootook_Empire_Exception_Planet(Wootook::__("Could not delete planet until fleets aten't retuned."));
}
$player = $this->getPlayer();
if ($player->getHomePlanet()->getId() == $this->getId()) {
- throw new Wootook_Empire_Exception_Planet(\Wootook::__("You can't destroy your home planet."));
+ throw new Wootook_Empire_Exception_Planet(Wootook::__("You can't destroy your home planet."));
}
if ($player->getCurrentPlanet()->getId() == $this->getId()) {
@@ -723,7 +695,7 @@ class Wootook_Empire_Model_Planet
}
// Dispatch 'planet.building.append-queue.before' event
- \Wootook::dispatchEvent($this->_eventPrefix . '.building.append-queue.before', array(
+ Wootook::dispatchEvent($this->_eventPrefix . '.building.append-queue.before', array(
'bulding_id' => $buildingId,
'level' => $this->getElement($buildingId),
$this->_eventObject => $this,
@@ -740,7 +712,7 @@ class Wootook_Empire_Model_Planet
$this->getBuildingQueue()->appendQueue($buildingId, $level, $time);
// Dispatch 'planet.shipyard.append-queue.after' event
- \Wootook::dispatchEvent($this->_eventPrefix . '.building.append-queue.after', array(
+ Wootook::dispatchEvent($this->_eventPrefix . '.building.append-queue.after', array(
'bulding_id' => $buildingId,
'level' => $this->getElement($buildingId),
$this->_eventObject => $this,
@@ -758,7 +730,7 @@ class Wootook_Empire_Model_Planet
}
// Dispatch event
- \Wootook::dispatchEvent($this->_eventPrefix . '.update-queue.before', array(
+ Wootook::dispatchEvent($this->_eventPrefix . '.update-queue.before', array(
'time' => &$time,
$this->_eventObject => $this,
'player' => $this->getPlayer()
@@ -767,7 +739,7 @@ class Wootook_Empire_Model_Planet
$this->getBuildingQueue()->updateQueue($time);
// Dispatch event
- \Wootook::dispatchEvent($this->_eventPrefix . '.update-queue.after', array(
+ Wootook::dispatchEvent($this->_eventPrefix . '.update-queue.after', array(
'time' => $time,
$this->_eventObject => $this,
'player' => $this->getPlayer()
@@ -843,7 +815,7 @@ class Wootook_Empire_Model_Planet
try {
// Dispatch event. Throw an exception to break the avaliability.
- \Wootook::dispatchEvent($this->_eventPrefix . '.check-availability', array(
+ Wootook::dispatchEvent($this->_eventPrefix . '.check-availability', array(
'ship_id' => $buildingId,
'shipyard' => $this,
$this->_eventObject => $this,
@@ -893,8 +865,8 @@ class Wootook_Empire_Model_Planet
->group('galaxy.system')
;
- if ($galaxyList === null && \Wootook::app()->getDefaultGame()->getConfig('user/registration/galaxy_list')) {
- $galaxyList = explode(',', \Wootook::app()->getDefaultGame()->getConfig('user/registration/galaxy_list'));
+ if ($galaxyList === null && Wootook::getGameConfig('user/registration/galaxy_list')) {
+ $galaxyList = explode(',', Wootook::getGameConfig('user/registration/galaxy_list'));
}
if ($galaxyList !== null) {
@@ -902,8 +874,8 @@ class Wootook_Empire_Model_Planet
$select->where('galaxy', array(array(Wootook_Core_Database_Sql_Select::OPERATOR_IN => $galaxyList)));
}
- if ($systemList === null && \Wootook::app()->getDefaultGame()->getConfig('user/registration/system_list')) {
- $systemList = explode(',', \Wootook::app()->getDefaultGame()->getConfig('user/registration/system_list'));
+ if ($systemList === null && Wootook::getGameConfig('user/registration/system_list')) {
+ $systemList = explode(',', Wootook::getGameConfig('user/registration/system_list'));
}
if ($systemList !== null) {
@@ -912,15 +884,15 @@ class Wootook_Empire_Model_Planet
}
$orders = array(
- "COUNT(*) / {$adapter->quote(\Wootook::app()->getDefaultGame()->getConfig('engine/universe/positions'))}",
- "1 + ABS(galaxy.galaxy - CEIL({$adapter->quote(\\Wootook::app()->getDefaultGame()->getConfig('engine/universe/galaxies'))} / 2))",
- "1 + 2 * ABS(galaxy.system - CEIL({$adapter->quote(\\Wootook::app()->getDefaultGame()->getConfig('engine/universe/systems'))} / 2))",
+ "COUNT(*) / {$adapter->quote(Wootook::getGameConfig('engine/universe/positions'))}",
+ "1 + ABS(galaxy.galaxy - CEIL({$adapter->quote(Wootook::getGameConfig('engine/universe/galaxies'))} / 2))",
+ "1 + 2 * ABS(galaxy.system - CEIL({$adapter->quote(Wootook::getGameConfig('engine/universe/systems'))} / 2))",
"RAND() / 1000",
);
$select
->order(new Wootook_Core_Database_Sql_Placeholder_Expression('((' . implode(') * (', $orders) . '))'), 'ASC')
- //->order("ABS(galaxy.system - CEIL({$collection->quote(\\Wootook::app()->getDefaultGame()->getConfig('engine/universe/systems'))} / 2))", 'ASC')
- //->order("ABS(galaxy.galaxy - CEIL({$collection->quote(\\Wootook::app()->getDefaultGame()->getConfig('engine/universe/galaxies'))} / 2))", 'ASC')
+ //->order("ABS(galaxy.system - CEIL({$collection->quote(Wootook::getGameConfig('engine/universe/systems'))} / 2))", 'ASC')
+ //->order("ABS(galaxy.galaxy - CEIL({$collection->quote(Wootook::getGameConfig('engine/universe/galaxies'))} / 2))", 'ASC')
//->order("1.5 / COUNT(*)", 'ASC')
->order('RAND()', 'ASC');
diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/Builder/Item.php b/src/application/code/core/Wootook/Empire/Model/Planet/Builder/Item.php
index 7980561..2e40fd2 100644
--- a/src/application/code/core/Wootook/Empire/Model/Planet/Builder/Item.php
+++ b/src/application/code/core/Wootook/Empire/Model/Planet/Builder/Item.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Model_Planet_Builder_Item
extends Wootook_Empire_Model_Builder_Item
diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/BuildingInterface.php b/src/application/code/core/Wootook/Empire/Model/Planet/BuildingInterface.php
index 9434aa3..d9d694b 100644
--- a/src/application/code/core/Wootook/Empire/Model/Planet/BuildingInterface.php
+++ b/src/application/code/core/Wootook/Empire/Model/Planet/BuildingInterface.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
interface Wootook_Empire_Model_Planet_BuildingInterface
{
diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/PluginLoader.php b/src/application/code/core/Wootook/Empire/Model/Planet/PluginLoader.php
index 04da029..d3cc37b 100644
--- a/src/application/code/core/Wootook/Empire/Model/Planet/PluginLoader.php
+++ b/src/application/code/core/Wootook/Empire/Model/Planet/PluginLoader.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Model_Planet_PluginLoader
extends Wootook_Core_PluginLoader_PluginLoader
diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/QueueInterface.php b/src/application/code/core/Wootook/Empire/Model/Planet/QueueInterface.php
index 2d1380a..7bd2c42 100644
--- a/src/application/code/core/Wootook/Empire/Model/Planet/QueueInterface.php
+++ b/src/application/code/core/Wootook/Empire/Model/Planet/QueueInterface.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
interface Wootook_Empire_Model_Planet_QueueInterface
{
diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/ResourceProductionInterface.php b/src/application/code/core/Wootook/Empire/Model/Planet/ResourceProductionInterface.php
index 604cab1..9556195 100644
--- a/src/application/code/core/Wootook/Empire/Model/Planet/ResourceProductionInterface.php
+++ b/src/application/code/core/Wootook/Empire/Model/Planet/ResourceProductionInterface.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
interface Wootook_Empire_Model_Planet_ResourceProductionInterface
{
diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/ShipAbstract.php b/src/application/code/core/Wootook/Empire/Model/Planet/ShipAbstract.php
index 722dbb7..d108099 100644
--- a/src/application/code/core/Wootook/Empire/Model/Planet/ShipAbstract.php
+++ b/src/application/code/core/Wootook/Empire/Model/Planet/ShipAbstract.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
abstract class Wootook_Empire_Model_Planet_ShipAbstract
implements Wootook_Empire_Model_Planet_ShipInterface
diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/ShipInterface.php b/src/application/code/core/Wootook/Empire/Model/Planet/ShipInterface.php
index 999cff4..dc9863a 100644
--- a/src/application/code/core/Wootook/Empire/Model/Planet/ShipInterface.php
+++ b/src/application/code/core/Wootook/Empire/Model/Planet/ShipInterface.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
interface Wootook_Empire_Model_Planet_ShipInterface
{
diff --git a/src/application/code/core/Wootook/Empire/Model/Player/TechnologyInterface.php b/src/application/code/core/Wootook/Empire/Model/Player/TechnologyInterface.php
index 0fdb57f..589914b 100644
--- a/src/application/code/core/Wootook/Empire/Model/Player/TechnologyInterface.php
+++ b/src/application/code/core/Wootook/Empire/Model/Player/TechnologyInterface.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
interface Wootook_Empire_Model_Player_TechnologyInterface
{
diff --git a/src/application/code/core/Wootook/Empire/Resource/Fleet/Collection.php b/src/application/code/core/Wootook/Empire/Resource/Fleet/Collection.php
index 1ecde5e..ea399f3 100644
--- a/src/application/code/core/Wootook/Empire/Resource/Fleet/Collection.php
+++ b/src/application/code/core/Wootook/Empire/Resource/Fleet/Collection.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Resource_Fleet_Collection
extends Wootook_Core_Resource_EntityCollection
diff --git a/src/application/code/core/Wootook/Empire/Resource/Planet/Collection.php b/src/application/code/core/Wootook/Empire/Resource/Planet/Collection.php
index dbf7999..fc3e8ee 100644
--- a/src/application/code/core/Wootook/Empire/Resource/Planet/Collection.php
+++ b/src/application/code/core/Wootook/Empire/Resource/Planet/Collection.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Empire_Resource_Planet_Collection
extends Wootook_Core_Resource_EntityCollection
diff --git a/src/application/code/core/Wootook/Exception.php b/src/application/code/core/Wootook/Exception.php
index 80d3b8e..c3b339a 100644
--- a/src/application/code/core/Wootook/Exception.php
+++ b/src/application/code/core/Wootook/Exception.php
@@ -28,12 +28,10 @@
*
*/
-namespace Wootook;
-
/**
*
* Enter description here ...
* @author Greg
*
*/
-interface Exception {}
+interface Wootook_Exception {}
\ No newline at end of file
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Base/DataContainer.php b/src/application/code/core/Wootook/Object.php
similarity index 77%
rename from src/application/modules/WootookCore/src/Wootook/Core/Base/DataContainer.php
rename to src/application/code/core/Wootook/Object.php
index 1399ba1..d3271ee 100644
--- a/src/application/modules/WootookCore/src/Wootook/Core/Base/DataContainer.php
+++ b/src/application/code/core/Wootook/Object.php
@@ -28,12 +28,22 @@
*
*/
-namespace Wootook\Core\Base;
-
-trait DataContainer
+/**
+ *
+ * Enter description here ...
+ * @author Greg
+ *
+ */
+class Wootook_Object
+ implements ArrayAccess
{
protected $_data = array();
+ public function __construct(Array $data = array())
+ {
+ $this->_data = $data;
+ }
+
public function getData($key)
{
if ($this->hasData($key)) {
@@ -83,4 +93,24 @@ trait DataContainer
return $this;
}
+
+ public function offsetExists($offset)
+ {
+ return $this->hasData($offset);
+ }
+
+ public function offsetGet($offset)
+ {
+ return $this->getData($offset);
+ }
+
+ public function offsetSet($offset, $data)
+ {
+ return $this->setData($offset, $data);
+ }
+
+ public function offsetUnset($offset)
+ {
+ return $this->unsetData($offset);
+ }
}
diff --git a/src/application/code/core/Wootook/Player/Block/Overview.php b/src/application/code/core/Wootook/Player/Block/Overview.php
index 374e168..bf689f0 100644
--- a/src/application/code/core/Wootook/Player/Block/Overview.php
+++ b/src/application/code/core/Wootook/Player/Block/Overview.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Player_Block_Overview
extends Wootook_Core_Block_Template
diff --git a/src/application/code/core/Wootook/Player/Block/TopBar.php b/src/application/code/core/Wootook/Player/Block/TopBar.php
index ecf19b3..9b7adaf 100644
--- a/src/application/code/core/Wootook/Player/Block/TopBar.php
+++ b/src/application/code/core/Wootook/Player/Block/TopBar.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Player_Block_TopBar
extends Wootook_Core_Block_Template
diff --git a/src/application/code/core/Wootook/Player/Controller/OverviewController.php b/src/application/code/core/Wootook/Player/Controller/OverviewController.php
index a167551..97db0cf 100644
--- a/src/application/code/core/Wootook/Player/Controller/OverviewController.php
+++ b/src/application/code/core/Wootook/Player/Controller/OverviewController.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Player_Controller_OverviewController
extends Wootook_Player_Mvc_Controller_Registered
diff --git a/src/application/code/core/Wootook/Player/Exception.php b/src/application/code/core/Wootook/Player/Exception.php
index 9004d66..6a51351 100644
--- a/src/application/code/core/Wootook/Player/Exception.php
+++ b/src/application/code/core/Wootook/Player/Exception.php
@@ -1,31 +1,3 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
interface Wootook_Player_Exception extends Wootook_Exception {}
\ No newline at end of file
diff --git a/src/application/code/core/Wootook/Player/Exception/Exception.php b/src/application/code/core/Wootook/Player/Exception/Exception.php
index 7d5b9b1..5e50e0a 100644
--- a/src/application/code/core/Wootook/Player/Exception/Exception.php
+++ b/src/application/code/core/Wootook/Player/Exception/Exception.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Player_Exception_Exception
extends Exception
diff --git a/src/application/code/core/Wootook/Player/Exception/Session.php b/src/application/code/core/Wootook/Player/Exception/Session.php
index f6ae97f..b546e5d 100644
--- a/src/application/code/core/Wootook/Player/Exception/Session.php
+++ b/src/application/code/core/Wootook/Player/Exception/Session.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Player_Exception_Session
extends Wootook_Player_Exception_RuntimeException
diff --git a/src/application/code/core/Wootook/Player/Model/Entity.php b/src/application/code/core/Wootook/Player/Model/Entity.php
index 4bfc6be..389b8ba 100644
--- a/src/application/code/core/Wootook/Player/Model/Entity.php
+++ b/src/application/code/core/Wootook/Player/Model/Entity.php
@@ -1,38 +1,10 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
/**
*
* Enter description here ...
*
- * @uses Wootook\Core\BaseObject
+ * @uses Wootook_Object
* @uses Legacies_Empire
*/
class Wootook_Player_Model_Entity
@@ -655,6 +627,11 @@ class Wootook_Player_Model_Entity
return $this->getData('urlaubs_until');
}
+ public function getLastLoginDate()
+ {
+ return $this->getData('onlinetime');
+ }
+
public function setVacation($active = true)
{
$this->setData('urlaubs_modus', $active);
diff --git a/src/application/code/core/Wootook/Player/Model/Message.php b/src/application/code/core/Wootook/Player/Model/Message.php
index 129f0f3..0002d94 100644
--- a/src/application/code/core/Wootook/Player/Model/Message.php
+++ b/src/application/code/core/Wootook/Player/Model/Message.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Player_Model_Message
extends Wootook_Core_Mvc_Model_Entity_SubTable
diff --git a/src/application/code/core/Wootook/Player/Model/Session.php b/src/application/code/core/Wootook/Player/Model/Session.php
index 85c463e..9ae226c 100644
--- a/src/application/code/core/Wootook/Player/Model/Session.php
+++ b/src/application/code/core/Wootook/Player/Model/Session.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Player_Model_Session
extends Wootook_Core_Model_Session
diff --git a/src/application/code/core/Wootook/Player/Mvc/Controller/Registered.php b/src/application/code/core/Wootook/Player/Mvc/Controller/Registered.php
index 9282caa..3374acf 100644
--- a/src/application/code/core/Wootook/Player/Mvc/Controller/Registered.php
+++ b/src/application/code/core/Wootook/Player/Mvc/Controller/Registered.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Player_Mvc_Controller_Registered
extends Wootook_Core_Mvc_Controller_Action
diff --git a/src/application/code/core/Wootook/Player/Resource/Entity/Collection.php b/src/application/code/core/Wootook/Player/Resource/Entity/Collection.php
index e2288ad..3e2c1bc 100644
--- a/src/application/code/core/Wootook/Player/Resource/Entity/Collection.php
+++ b/src/application/code/core/Wootook/Player/Resource/Entity/Collection.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Player_Resource_Entity_Collection
extends Wootook_Core_Resource_EntityCollection
diff --git a/src/application/code/core/Wootook/Player/Resource/Message/Collection.php b/src/application/code/core/Wootook/Player/Resource/Message/Collection.php
index 0a0921c..e6d9198 100644
--- a/src/application/code/core/Wootook/Player/Resource/Message/Collection.php
+++ b/src/application/code/core/Wootook/Player/Resource/Message/Collection.php
@@ -1,32 +1,4 @@
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
class Wootook_Player_Resource_Message_Collection
extends Wootook_Core_Resource_EntityCollection
diff --git a/src/application/code/libraries/Wildfire/Stream.php b/src/application/code/libraries/Wildfire/Stream.php
new file mode 100644
index 0000000..9966a44
--- /dev/null
+++ b/src/application/code/libraries/Wildfire/Stream.php
@@ -0,0 +1,1753 @@
+
+ * @license http://www.opensource.org/licenses/bsd-license.php
+ * @package FirePHPCore
+ */
+
+
+/**
+ * Sends the given data to the FirePHP Firefox Extension.
+ * The data can be displayed in the Firebug Console or in the
+ * "Server" request tab.
+ *
+ * For more information see: http://www.firephp.org/
+ *
+ * @copyright Copyright (C) 2007-2009 Christoph Dorn
+ * @author Christoph Dorn
+ * @license http://www.opensource.org/licenses/bsd-license.php
+ * @package FirePHPCore
+ */
+class Wildfire_Stream {
+
+ /**
+ * FirePHP version
+ *
+ * @var string
+ */
+ const VERSION = '0.3'; // @pinf replace '0.3' with '%%package.version%%'
+
+ /**
+ * Firebug LOG level
+ *
+ * Logs a message to firebug console.
+ *
+ * @var string
+ */
+ const LOG = 'LOG';
+
+ /**
+ * Firebug INFO level
+ *
+ * Logs a message to firebug console and displays an info icon before the message.
+ *
+ * @var string
+ */
+ const INFO = 'INFO';
+
+ /**
+ * Firebug WARN level
+ *
+ * Logs a message to firebug console, displays an warning icon before the message and colors the line turquoise.
+ *
+ * @var string
+ */
+ const WARN = 'WARN';
+
+ /**
+ * Firebug ERROR level
+ *
+ * Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count.
+ *
+ * @var string
+ */
+ const ERROR = 'ERROR';
+
+ /**
+ * Dumps a variable to firebug's server panel
+ *
+ * @var string
+ */
+ const DUMP = 'DUMP';
+
+ /**
+ * Displays a stack trace in firebug console
+ *
+ * @var string
+ */
+ const TRACE = 'TRACE';
+
+ /**
+ * Displays an exception in firebug console
+ *
+ * Increments the firebug error count.
+ *
+ * @var string
+ */
+ const EXCEPTION = 'EXCEPTION';
+
+ /**
+ * Displays an table in firebug console
+ *
+ * @var string
+ */
+ const TABLE = 'TABLE';
+
+ /**
+ * Starts a group in firebug console
+ *
+ * @var string
+ */
+ const GROUP_START = 'GROUP_START';
+
+ /**
+ * Ends a group in firebug console
+ *
+ * @var string
+ */
+ const GROUP_END = 'GROUP_END';
+
+ /**
+ * Singleton instance of FirePHP
+ *
+ * @var FirePHP
+ */
+ protected static $instance = null;
+
+ /**
+ * Flag whether we are logging from within the exception handler
+ *
+ * @var boolean
+ */
+ protected $inExceptionHandler = false;
+
+ /**
+ * Flag whether to throw PHP errors that have been converted to ErrorExceptions
+ *
+ * @var boolean
+ */
+ protected $throwErrorExceptions = true;
+
+ /**
+ * Flag whether to convert PHP assertion errors to Exceptions
+ *
+ * @var boolean
+ */
+ protected $convertAssertionErrorsToExceptions = true;
+
+ /**
+ * Flag whether to throw PHP assertion errors that have been converted to Exceptions
+ *
+ * @var boolean
+ */
+ protected $throwAssertionExceptions = false;
+
+ /**
+ * Wildfire protocol message index
+ *
+ * @var int
+ */
+ protected $messageIndex = 1;
+
+ /**
+ * Options for the library
+ *
+ * @var array
+ */
+ protected $options = array('maxDepth' => 10,
+ 'maxObjectDepth' => 5,
+ 'maxArrayDepth' => 5,
+ 'useNativeJsonEncode' => true,
+ 'includeLineNumbers' => true);
+
+ /**
+ * Filters used to exclude object members when encoding
+ *
+ * @var array
+ */
+ protected $objectFilters = array(
+ 'firephp' => array('objectStack', 'instance', 'json_objectStack'),
+ 'firephp_test_class' => array('objectStack', 'instance', 'json_objectStack')
+ );
+
+ /**
+ * A stack of objects used to detect recursion during object encoding
+ *
+ * @var object
+ */
+ protected $objectStack = array();
+
+ /**
+ * Flag to enable/disable logging
+ *
+ * @var boolean
+ */
+ protected $enabled = true;
+
+ /**
+ * The insight console to log to if applicable
+ *
+ * @var object
+ */
+ protected $logToInsightConsole = null;
+
+ /**
+ * When the object gets serialized only include specific object members.
+ *
+ * @return array
+ */
+ public function __sleep()
+ {
+ return array('options','objectFilters','enabled');
+ }
+
+ /**
+ * Gets singleton instance of FirePHP
+ *
+ * @param boolean $AutoCreate
+ * @return FirePHP
+ */
+ public static function getInstance($AutoCreate = false)
+ {
+ if ($AutoCreate===true && !self::$instance) {
+ self::init();
+ }
+ return self::$instance;
+ }
+
+ /**
+ * Creates FirePHP object and stores it for singleton access
+ *
+ * @return FirePHP
+ */
+ public static function init()
+ {
+ return self::setInstance(new self());
+ }
+
+ /**
+ * Set the instance of the FirePHP singleton
+ *
+ * @param FirePHP $instance The FirePHP object instance
+ * @return FirePHP
+ */
+ public static function setInstance($instance)
+ {
+ return self::$instance = $instance;
+ }
+
+ /**
+ * Set an Insight console to direct all logging calls to
+ *
+ * @param object $console The console object to log to
+ * @return void
+ */
+ public function setLogToInsightConsole($console)
+ {
+ if(is_string($console)) {
+ if(get_class($this)!='FirePHP_Insight' && !is_subclass_of($this, 'FirePHP_Insight')) {
+ throw new Exception('FirePHP instance not an instance or subclass of FirePHP_Insight!');
+ }
+ $this->logToInsightConsole = $this->to('request')->console($console);
+ } else {
+ $this->logToInsightConsole = $console;
+ }
+ }
+
+ /**
+ * Enable and disable logging to Firebug
+ *
+ * @param boolean $Enabled TRUE to enable, FALSE to disable
+ * @return void
+ */
+ public function setEnabled($Enabled)
+ {
+ $this->enabled = $Enabled;
+ }
+
+ /**
+ * Check if logging is enabled
+ *
+ * @return boolean TRUE if enabled
+ */
+ public function getEnabled()
+ {
+ return $this->enabled;
+ }
+
+ /**
+ * Specify a filter to be used when encoding an object
+ *
+ * Filters are used to exclude object members.
+ *
+ * @param string $Class The class name of the object
+ * @param array $Filter An array of members to exclude
+ * @return void
+ */
+ public function setObjectFilter($Class, $Filter)
+ {
+ $this->objectFilters[strtolower($Class)] = $Filter;
+ }
+
+ /**
+ * Set some options for the library
+ *
+ * Options:
+ * - maxDepth: The maximum depth to traverse (default: 10)
+ * - maxObjectDepth: The maximum depth to traverse objects (default: 5)
+ * - maxArrayDepth: The maximum depth to traverse arrays (default: 5)
+ * - useNativeJsonEncode: If true will use json_encode() (default: true)
+ * - includeLineNumbers: If true will include line numbers and filenames (default: true)
+ *
+ * @param array $Options The options to be set
+ * @return void
+ */
+ public function setOptions($Options)
+ {
+ $this->options = array_merge($this->options,$Options);
+ }
+
+ /**
+ * Get options from the library
+ *
+ * @return array The currently set options
+ */
+ public function getOptions()
+ {
+ return $this->options;
+ }
+
+ /**
+ * Set an option for the library
+ *
+ * @param string $Name
+ * @param mixed $Value
+ * @throws Exception
+ * @return void
+ */
+ public function setOption($Name, $Value)
+ {
+ if (!isset($this->options[$Name])) {
+ throw $this->newException('Unknown option: ' . $Name);
+ }
+ $this->options[$Name] = $Value;
+ }
+
+ /**
+ * Get an option from the library
+ *
+ * @param string $Name
+ * @throws Exception
+ * @return mixed
+ */
+ public function getOption($Name)
+ {
+ if (!isset($this->options[$Name])) {
+ throw $this->newException('Unknown option: ' . $Name);
+ }
+ return $this->options[$Name];
+ }
+
+ /**
+ * Register FirePHP as your error handler
+ *
+ * Will throw exceptions for each php error.
+ *
+ * @return mixed Returns a string containing the previously defined error handler (if any)
+ */
+ public function registerErrorHandler($throwErrorExceptions = false)
+ {
+ //NOTE: The following errors will not be caught by this error handler:
+ // E_ERROR, E_PARSE, E_CORE_ERROR,
+ // E_CORE_WARNING, E_COMPILE_ERROR,
+ // E_COMPILE_WARNING, E_STRICT
+
+ $this->throwErrorExceptions = $throwErrorExceptions;
+
+ return set_error_handler(array($this,'errorHandler'));
+ }
+
+ /**
+ * FirePHP's error handler
+ *
+ * Throws exception for each php error that will occur.
+ *
+ * @param int $errno
+ * @param string $errstr
+ * @param string $errfile
+ * @param int $errline
+ * @param array $errcontext
+ */
+ public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
+ {
+ // Don't throw exception if error reporting is switched off
+ if (error_reporting() == 0) {
+ return;
+ }
+ // Only throw exceptions for errors we are asking for
+ if (error_reporting() & $errno) {
+
+ $exception = new ErrorException($errstr, 0, $errno, $errfile, $errline);
+ if ($this->throwErrorExceptions) {
+ throw $exception;
+ } else {
+ $this->fb($exception);
+ }
+ }
+ }
+
+ /**
+ * Register FirePHP as your exception handler
+ *
+ * @return mixed Returns the name of the previously defined exception handler,
+ * or NULL on error.
+ * If no previous handler was defined, NULL is also returned.
+ */
+ public function registerExceptionHandler()
+ {
+ return set_exception_handler(array($this,'exceptionHandler'));
+ }
+
+ /**
+ * FirePHP's exception handler
+ *
+ * Logs all exceptions to your firebug console and then stops the script.
+ *
+ * @param Exception $Exception
+ * @throws Exception
+ */
+ function exceptionHandler($Exception)
+ {
+
+ $this->inExceptionHandler = true;
+
+ header('HTTP/1.1 500 Internal Server Error');
+
+ try {
+ $this->fb($Exception);
+ } catch (Exception $e) {
+ echo 'We had an exception: ' . $e;
+ }
+ $this->inExceptionHandler = false;
+ }
+
+ /**
+ * Register FirePHP driver as your assert callback
+ *
+ * @param boolean $convertAssertionErrorsToExceptions
+ * @param boolean $throwAssertionExceptions
+ * @return mixed Returns the original setting or FALSE on errors
+ */
+ public function registerAssertionHandler($convertAssertionErrorsToExceptions = true, $throwAssertionExceptions = false)
+ {
+ $this->convertAssertionErrorsToExceptions = $convertAssertionErrorsToExceptions;
+ $this->throwAssertionExceptions = $throwAssertionExceptions;
+
+ if ($throwAssertionExceptions && !$convertAssertionErrorsToExceptions) {
+ throw $this->newException('Cannot throw assertion exceptions as assertion errors are not being converted to exceptions!');
+ }
+
+ return assert_options(ASSERT_CALLBACK, array($this, 'assertionHandler'));
+ }
+
+ /**
+ * FirePHP's assertion handler
+ *
+ * Logs all assertions to your firebug console and then stops the script.
+ *
+ * @param string $file File source of assertion
+ * @param int $line Line source of assertion
+ * @param mixed $code Assertion code
+ */
+ public function assertionHandler($file, $line, $code)
+ {
+ if ($this->convertAssertionErrorsToExceptions) {
+
+ $exception = new ErrorException('Assertion Failed - Code[ '.$code.' ]', 0, null, $file, $line);
+
+ if ($this->throwAssertionExceptions) {
+ throw $exception;
+ } else {
+ $this->fb($exception);
+ }
+
+ } else {
+ $this->fb($code, 'Assertion Failed', FirePHP::ERROR, array('File'=>$file,'Line'=>$line));
+ }
+ }
+
+ /**
+ * Start a group for following messages.
+ *
+ * Options:
+ * Collapsed: [true|false]
+ * Color: [#RRGGBB|ColorName]
+ *
+ * @param string $Name
+ * @param array $Options OPTIONAL Instructions on how to log the group
+ * @return true
+ * @throws Exception
+ */
+ public function group($Name, $Options = null)
+ {
+
+ if (!$Name) {
+ throw $this->newException('You must specify a label for the group!');
+ }
+
+ if ($Options) {
+ if (!is_array($Options)) {
+ throw $this->newException('Options must be defined as an array!');
+ }
+ if (array_key_exists('Collapsed', $Options)) {
+ $Options['Collapsed'] = ($Options['Collapsed'])?'true':'false';
+ }
+ }
+
+ return $this->fb(null, $Name, FirePHP::GROUP_START, $Options);
+ }
+
+ /**
+ * Ends a group you have started before
+ *
+ * @return true
+ * @throws Exception
+ */
+ public function groupEnd()
+ {
+ return $this->fb(null, null, FirePHP::GROUP_END);
+ }
+
+ /**
+ * Log object with label to firebug console
+ *
+ * @see FirePHP::LOG
+ * @param mixes $Object
+ * @param string $Label
+ * @return true
+ * @throws Exception
+ */
+ public function log($Object, $Label = null, $Options = array())
+ {
+ return $this->fb($Object, $Label, FirePHP::LOG, $Options);
+ }
+
+ /**
+ * Log object with label to firebug console
+ *
+ * @see FirePHP::INFO
+ * @param mixes $Object
+ * @param string $Label
+ * @return true
+ * @throws Exception
+ */
+ public function info($Object, $Label = null, $Options = array())
+ {
+ return $this->fb($Object, $Label, FirePHP::INFO, $Options);
+ }
+
+ /**
+ * Log object with label to firebug console
+ *
+ * @see FirePHP::WARN
+ * @param mixes $Object
+ * @param string $Label
+ * @return true
+ * @throws Exception
+ */
+ public function warn($Object, $Label = null, $Options = array())
+ {
+ return $this->fb($Object, $Label, FirePHP::WARN, $Options);
+ }
+
+ /**
+ * Log object with label to firebug console
+ *
+ * @see FirePHP::ERROR
+ * @param mixes $Object
+ * @param string $Label
+ * @return true
+ * @throws Exception
+ */
+ public function error($Object, $Label = null, $Options = array())
+ {
+ return $this->fb($Object, $Label, FirePHP::ERROR, $Options);
+ }
+
+ /**
+ * Dumps key and variable to firebug server panel
+ *
+ * @see FirePHP::DUMP
+ * @param string $Key
+ * @param mixed $Variable
+ * @return true
+ * @throws Exception
+ */
+ public function dump($Key, $Variable, $Options = array())
+ {
+ if (!is_string($Key)) {
+ throw $this->newException('Key passed to dump() is not a string');
+ }
+ if (strlen($Key)>100) {
+ throw $this->newException('Key passed to dump() is longer than 100 characters');
+ }
+ if (!preg_match_all('/^[a-zA-Z0-9-_\.:]*$/', $Key, $m)) {
+ throw $this->newException('Key passed to dump() contains invalid characters [a-zA-Z0-9-_\.:]');
+ }
+ return $this->fb($Variable, $Key, FirePHP::DUMP, $Options);
+ }
+
+ /**
+ * Log a trace in the firebug console
+ *
+ * @see FirePHP::TRACE
+ * @param string $Label
+ * @return true
+ * @throws Exception
+ */
+ public function trace($Label)
+ {
+ return $this->fb($Label, FirePHP::TRACE);
+ }
+
+ /**
+ * Log a table in the firebug console
+ *
+ * @see FirePHP::TABLE
+ * @param string $Label
+ * @param string $Table
+ * @return true
+ * @throws Exception
+ */
+ public function table($Label, $Table, $Options = array())
+ {
+ return $this->fb($Table, $Label, FirePHP::TABLE, $Options);
+ }
+
+ /**
+ * Insight API wrapper
+ *
+ * @see Insight_Helper::to()
+ */
+ public static function to()
+ {
+ $instance = self::getInstance();
+ if (!method_exists($instance, "_to")) {
+ throw new Exception("FirePHP::to() implementation not loaded");
+ }
+ $args = func_get_args();
+ return call_user_func_array(array($instance, '_to'), $args);
+ }
+
+ /**
+ * Insight API wrapper
+ *
+ * @see Insight_Helper::plugin()
+ */
+ public static function plugin()
+ {
+ $instance = self::getInstance();
+ if (!method_exists($instance, "_plugin")) {
+ throw new Exception("FirePHP::plugin() implementation not loaded");
+ }
+ $args = func_get_args();
+ return call_user_func_array(array($instance, '_plugin'), $args);
+ }
+
+ /**
+ * Check if FirePHP is installed on client
+ *
+ * @return boolean
+ */
+ public function detectClientExtension()
+ {
+ // Check if FirePHP is installed on client via User-Agent header
+ if (@preg_match_all('/\sFirePHP\/([\.\d]*)\s?/si',$this->getUserAgent(),$m) &&
+ version_compare($m[1][0],'0.0.6','>=')) {
+ return true;
+ } else
+ // Check if FirePHP is installed on client via X-FirePHP-Version header
+ if (@preg_match_all('/^([\.\d]*)$/si',$this->getRequestHeader("X-FirePHP-Version"),$m) &&
+ version_compare($m[1][0],'0.0.6','>=')) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Log varible to Firebug
+ *
+ * @see http://www.firephp.org/Wiki/Reference/Fb
+ * @param mixed $Object The variable to be logged
+ * @return true Return TRUE if message was added to headers, FALSE otherwise
+ * @throws Exception
+ */
+ public function fb($Object)
+ {
+ if($this instanceof FirePHP_Insight && method_exists($this, '_logUpgradeClientMessage')) {
+ if(!FirePHP_Insight::$upgradeClientMessageLogged) { // avoid infinite recursion as _logUpgradeClientMessage() logs a message
+ $this->_logUpgradeClientMessage();
+ }
+ }
+
+ static $insightGroupStack = array();
+
+ if (!$this->getEnabled()) {
+ return false;
+ }
+
+ if ($this->headersSent($filename, $linenum)) {
+ // If we are logging from within the exception handler we cannot throw another exception
+ if ($this->inExceptionHandler) {
+ // Simply echo the error out to the page
+ echo '
FirePHP ERROR: Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.
';
+ } else {
+ throw $this->newException('Headers already sent in '.$filename.' on line '.$linenum.'. Cannot send log data to FirePHP. You must have Output Buffering enabled via ob_start() or output_buffering ini directive.');
+ }
+ }
+
+ $Type = null;
+ $Label = null;
+ $Options = array();
+
+ if (func_num_args()==1) {
+ } else
+ if (func_num_args()==2) {
+ switch(func_get_arg(1)) {
+ case self::LOG:
+ case self::INFO:
+ case self::WARN:
+ case self::ERROR:
+ case self::DUMP:
+ case self::TRACE:
+ case self::EXCEPTION:
+ case self::TABLE:
+ case self::GROUP_START:
+ case self::GROUP_END:
+ $Type = func_get_arg(1);
+ break;
+ default:
+ $Label = func_get_arg(1);
+ break;
+ }
+ } else
+ if (func_num_args()==3) {
+ $Type = func_get_arg(2);
+ $Label = func_get_arg(1);
+ } else
+ if (func_num_args()==4) {
+ $Type = func_get_arg(2);
+ $Label = func_get_arg(1);
+ $Options = func_get_arg(3);
+ } else {
+ throw $this->newException('Wrong number of arguments to fb() function!');
+ }
+
+ if($this->logToInsightConsole!==null && (get_class($this)=='FirePHP_Insight' || is_subclass_of($this, 'FirePHP_Insight'))) {
+ $msg = $this->logToInsightConsole;
+ if ($Object instanceof Exception) {
+ $Type = self::EXCEPTION;
+ }
+ if($Label && $Type!=self::TABLE && $Type!=self::GROUP_START) {
+ $msg = $msg->label($Label);
+ }
+ switch($Type) {
+ case self::DUMP:
+ case self::LOG:
+ return $msg->log($Object);
+ case self::INFO:
+ return $msg->info($Object);
+ case self::WARN:
+ return $msg->warn($Object);
+ case self::ERROR:
+ return $msg->error($Object);
+ case self::TRACE:
+ return $msg->trace($Object);
+ case self::EXCEPTION:
+ return $this->plugin('engine')->handleException($Object, $msg);
+ case self::TABLE:
+ if (isset($Object[0]) && !is_string($Object[0]) && $Label) {
+ $Object = array($Label, $Object);
+ }
+ return $msg->table($Object[0], array_slice($Object[1],1), $Object[1][0]);
+ case self::GROUP_START:
+ $insightGroupStack[] = $msg->group(md5($Label))->open();
+ return $msg->log($Label);
+ case self::GROUP_END:
+ if(count($insightGroupStack)==0) {
+ throw new Error('Too many groupEnd() as opposed to group() calls!');
+ }
+ $group = array_pop($insightGroupStack);
+ return $group->close();
+ default:
+ return $msg->log($Object);
+ }
+ }
+
+ if (!$this->detectClientExtension()) {
+ return false;
+ }
+
+ $meta = array();
+ $skipFinalObjectEncode = false;
+
+ if ($Object instanceof Exception) {
+
+ $meta['file'] = $this->_escapeTraceFile($Object->getFile());
+ $meta['line'] = $Object->getLine();
+
+ $trace = $Object->getTrace();
+ if ($Object instanceof ErrorException
+ && isset($trace[0]['function'])
+ && $trace[0]['function']=='errorHandler'
+ && isset($trace[0]['class'])
+ && $trace[0]['class']=='FirePHP') {
+
+ $severity = false;
+ switch($Object->getSeverity()) {
+ case E_WARNING: $severity = 'E_WARNING'; break;
+ case E_NOTICE: $severity = 'E_NOTICE'; break;
+ case E_USER_ERROR: $severity = 'E_USER_ERROR'; break;
+ case E_USER_WARNING: $severity = 'E_USER_WARNING'; break;
+ case E_USER_NOTICE: $severity = 'E_USER_NOTICE'; break;
+ case E_STRICT: $severity = 'E_STRICT'; break;
+ case E_RECOVERABLE_ERROR: $severity = 'E_RECOVERABLE_ERROR'; break;
+ case E_DEPRECATED: $severity = 'E_DEPRECATED'; break;
+ case E_USER_DEPRECATED: $severity = 'E_USER_DEPRECATED'; break;
+ }
+
+ $Object = array('Class'=>get_class($Object),
+ 'Message'=>$severity.': '.$Object->getMessage(),
+ 'File'=>$this->_escapeTraceFile($Object->getFile()),
+ 'Line'=>$Object->getLine(),
+ 'Type'=>'trigger',
+ 'Trace'=>$this->_escapeTrace(array_splice($trace,2)));
+ $skipFinalObjectEncode = true;
+ } else {
+ $Object = array('Class'=>get_class($Object),
+ 'Message'=>$Object->getMessage(),
+ 'File'=>$this->_escapeTraceFile($Object->getFile()),
+ 'Line'=>$Object->getLine(),
+ 'Type'=>'throw',
+ 'Trace'=>$this->_escapeTrace($trace));
+ $skipFinalObjectEncode = true;
+ }
+ $Type = self::EXCEPTION;
+
+ } else
+ if ($Type==self::TRACE) {
+
+ $trace = debug_backtrace();
+ if (!$trace) return false;
+ for( $i=0 ; $i_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
+ || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) {
+ /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */
+ } else
+ if (isset($trace[$i]['class'])
+ && isset($trace[$i+1]['file'])
+ && $trace[$i]['class']=='FirePHP'
+ && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') {
+ /* Skip fb() */
+ } else
+ if ($trace[$i]['function']=='fb'
+ || $trace[$i]['function']=='trace'
+ || $trace[$i]['function']=='send') {
+
+ $Object = array('Class'=>isset($trace[$i]['class'])?$trace[$i]['class']:'',
+ 'Type'=>isset($trace[$i]['type'])?$trace[$i]['type']:'',
+ 'Function'=>isset($trace[$i]['function'])?$trace[$i]['function']:'',
+ 'Message'=>$trace[$i]['args'][0],
+ 'File'=>isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'',
+ 'Line'=>isset($trace[$i]['line'])?$trace[$i]['line']:'',
+ 'Args'=>isset($trace[$i]['args'])?$this->encodeObject($trace[$i]['args']):'',
+ 'Trace'=>$this->_escapeTrace(array_splice($trace,$i+1)));
+
+ $skipFinalObjectEncode = true;
+ $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'';
+ $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:'';
+ break;
+ }
+ }
+
+ } else
+ if ($Type==self::TABLE) {
+
+ if (isset($Object[0]) && is_string($Object[0])) {
+ $Object[1] = $this->encodeTable($Object[1]);
+ } else {
+ $Object = $this->encodeTable($Object);
+ }
+
+ $skipFinalObjectEncode = true;
+
+ } else
+ if ($Type==self::GROUP_START) {
+
+ if (!$Label) {
+ throw $this->newException('You must specify a label for the group!');
+ }
+
+ } else {
+ if ($Type===null) {
+ $Type = self::LOG;
+ }
+ }
+
+ if ($this->options['includeLineNumbers']) {
+ if (!isset($meta['file']) || !isset($meta['line'])) {
+
+ $trace = debug_backtrace();
+ for( $i=0 ; $trace && $i_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php'
+ || substr($this->_standardizePath($trace[$i]['file']),-29,29)=='FirePHPCore/FirePHP.class.php')) {
+ /* Skip - FB::trace(), FB::send(), $firephp->trace(), $firephp->fb() */
+ } else
+ if (isset($trace[$i]['class'])
+ && isset($trace[$i+1]['file'])
+ && $trace[$i]['class']=='FirePHP'
+ && substr($this->_standardizePath($trace[$i+1]['file']),-18,18)=='FirePHPCore/fb.php') {
+ /* Skip fb() */
+ } else
+ if (isset($trace[$i]['file'])
+ && substr($this->_standardizePath($trace[$i]['file']),-18,18)=='FirePHPCore/fb.php') {
+ /* Skip FB::fb() */
+ } else {
+ $meta['file'] = isset($trace[$i]['file'])?$this->_escapeTraceFile($trace[$i]['file']):'';
+ $meta['line'] = isset($trace[$i]['line'])?$trace[$i]['line']:'';
+ break;
+ }
+ }
+ }
+ } else {
+ unset($meta['file']);
+ unset($meta['line']);
+ }
+
+ $this->setHeader('X-Wf-Protocol-1','http://meta.wildfirehq.org/Protocol/JsonStream/0.2');
+ $this->setHeader('X-Wf-1-Plugin-1','http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/'.self::VERSION);
+
+ $structure_index = 1;
+ if ($Type==self::DUMP) {
+ $structure_index = 2;
+ $this->setHeader('X-Wf-1-Structure-2','http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1');
+ } else {
+ $this->setHeader('X-Wf-1-Structure-1','http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1');
+ }
+
+ if ($Type==self::DUMP) {
+ $msg = '{"'.$Label.'":'.$this->jsonEncode($Object, $skipFinalObjectEncode).'}';
+ } else {
+ $msg_meta = $Options;
+ $msg_meta['Type'] = $Type;
+ if ($Label!==null) {
+ $msg_meta['Label'] = $Label;
+ }
+ if (isset($meta['file']) && !isset($msg_meta['File'])) {
+ $msg_meta['File'] = $meta['file'];
+ }
+ if (isset($meta['line']) && !isset($msg_meta['Line'])) {
+ $msg_meta['Line'] = $meta['line'];
+ }
+ $msg = '['.$this->jsonEncode($msg_meta).','.$this->jsonEncode($Object, $skipFinalObjectEncode).']';
+ }
+
+ $parts = explode("\n",chunk_split($msg, 5000, "\n"));
+
+ for( $i=0 ; $i2) {
+ // Message needs to be split into multiple parts
+ $this->setHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex,
+ (($i==0)?strlen($msg):'')
+ . '|' . $part . '|'
+ . (($isetHeader('X-Wf-1-'.$structure_index.'-'.'1-'.$this->messageIndex,
+ strlen($part) . '|' . $part . '|');
+ }
+
+ $this->messageIndex++;
+
+ if ($this->messageIndex > 99999) {
+ throw $this->newException('Maximum number (99,999) of messages reached!');
+ }
+ }
+ }
+
+ $this->setHeader('X-Wf-1-Index',$this->messageIndex-1);
+
+ return true;
+ }
+
+ /**
+ * Standardizes path for windows systems.
+ *
+ * @param string $Path
+ * @return string
+ */
+ protected function _standardizePath($Path)
+ {
+ return preg_replace('/\\\\+/','/',$Path);
+ }
+
+ /**
+ * Escape trace path for windows systems
+ *
+ * @param array $Trace
+ * @return array
+ */
+ protected function _escapeTrace($Trace)
+ {
+ if (!$Trace) return $Trace;
+ for( $i=0 ; $i_escapeTraceFile($Trace[$i]['file']);
+ }
+ if (isset($Trace[$i]['args'])) {
+ $Trace[$i]['args'] = $this->encodeObject($Trace[$i]['args']);
+ }
+ }
+ return $Trace;
+ }
+
+ /**
+ * Escape file information of trace for windows systems
+ *
+ * @param string $File
+ * @return string
+ */
+ protected function _escapeTraceFile($File)
+ {
+ /* Check if we have a windows filepath */
+ if (strpos($File,'\\')) {
+ /* First strip down to single \ */
+
+ $file = preg_replace('/\\\\+/','\\',$File);
+
+ return $file;
+ }
+ return $File;
+ }
+
+ /**
+ * Check if headers have already been sent
+ *
+ * @param string $Filename
+ * @param integer $Linenum
+ */
+ protected function headersSent(&$Filename, &$Linenum)
+ {
+ return headers_sent($Filename, $Linenum);
+ }
+
+ /**
+ * Send header
+ *
+ * @param string $Name
+ * @param string $Value
+ */
+ protected function setHeader($Name, $Value)
+ {
+ return header($Name.': '.$Value);
+ }
+
+ /**
+ * Get user agent
+ *
+ * @return string|false
+ */
+ protected function getUserAgent()
+ {
+ if (!isset($_SERVER['HTTP_USER_AGENT'])) return false;
+ return $_SERVER['HTTP_USER_AGENT'];
+ }
+
+ /**
+ * Get all request headers
+ *
+ * @return array
+ */
+ public static function getAllRequestHeaders() {
+ static $_cached_headers = false;
+ if($_cached_headers!==false) {
+ return $_cached_headers;
+ }
+ $headers = array();
+ if(function_exists('getallheaders')) {
+ foreach( getallheaders() as $name => $value ) {
+ $headers[strtolower($name)] = $value;
+ }
+ } else {
+ foreach($_SERVER as $name => $value) {
+ if(substr($name, 0, 5) == 'HTTP_') {
+ $headers[strtolower(str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))))] = $value;
+ }
+ }
+ }
+ return $_cached_headers = $headers;
+ }
+
+ /**
+ * Get a request header
+ *
+ * @return string|false
+ */
+ protected function getRequestHeader($Name)
+ {
+ $headers = self::getAllRequestHeaders();
+ if (isset($headers[strtolower($Name)])) {
+ return $headers[strtolower($Name)];
+ }
+ return false;
+ }
+
+ /**
+ * Returns a new exception
+ *
+ * @param string $Message
+ * @return Exception
+ */
+ protected function newException($Message)
+ {
+ return new Exception($Message);
+ }
+
+ /**
+ * Encode an object into a JSON string
+ *
+ * Uses PHP's jeson_encode() if available
+ *
+ * @param object $Object The object to be encoded
+ * @return string The JSON string
+ */
+ public function jsonEncode($Object, $skipObjectEncode = false)
+ {
+ if (!$skipObjectEncode) {
+ $Object = $this->encodeObject($Object);
+ }
+
+ if (function_exists('json_encode')
+ && $this->options['useNativeJsonEncode']!=false) {
+
+ return json_encode($Object);
+ } else {
+ return $this->json_encode($Object);
+ }
+ }
+
+ /**
+ * Encodes a table by encoding each row and column with encodeObject()
+ *
+ * @param array $Table The table to be encoded
+ * @return array
+ */
+ protected function encodeTable($Table)
+ {
+
+ if (!$Table) return $Table;
+
+ $new_table = array();
+ foreach($Table as $row) {
+
+ if (is_array($row)) {
+ $new_row = array();
+
+ foreach($row as $item) {
+ $new_row[] = $this->encodeObject($item);
+ }
+
+ $new_table[] = $new_row;
+ }
+ }
+
+ return $new_table;
+ }
+
+ /**
+ * Encodes an object including members with
+ * protected and private visibility
+ *
+ * @param Object $Object The object to be encoded
+ * @param int $Depth The current traversal depth
+ * @return array All members of the object
+ */
+ protected function encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $MaxDepth = 1)
+ {
+ if ($MaxDepth > $this->options['maxDepth']) {
+ return '** Max Depth ('.$this->options['maxDepth'].') **';
+ }
+
+ $return = array();
+
+ if (is_resource($Object)) {
+
+ return '** '.(string)$Object.' **';
+
+ } else
+ if (is_object($Object)) {
+
+ if ($ObjectDepth > $this->options['maxObjectDepth']) {
+ return '** Max Object Depth ('.$this->options['maxObjectDepth'].') **';
+ }
+
+ foreach ($this->objectStack as $refVal) {
+ if ($refVal === $Object) {
+ return '** Recursion ('.get_class($Object).') **';
+ }
+ }
+ array_push($this->objectStack, $Object);
+
+ $return['__className'] = $class = get_class($Object);
+ $class_lower = strtolower($class);
+
+ $reflectionClass = new ReflectionClass($class);
+ $properties = array();
+ foreach( $reflectionClass->getProperties() as $property) {
+ $properties[$property->getName()] = $property;
+ }
+
+ $members = (array)$Object;
+
+ foreach( $properties as $plain_name => $property ) {
+
+ $name = $raw_name = $plain_name;
+ if ($property->isStatic()) {
+ $name = 'static:'.$name;
+ }
+ if ($property->isPublic()) {
+ $name = 'public:'.$name;
+ } else
+ if ($property->isPrivate()) {
+ $name = 'private:'.$name;
+ $raw_name = "\0".$class."\0".$raw_name;
+ } else
+ if ($property->isProtected()) {
+ $name = 'protected:'.$name;
+ $raw_name = "\0".'*'."\0".$raw_name;
+ }
+
+ if (!(isset($this->objectFilters[$class_lower])
+ && is_array($this->objectFilters[$class_lower])
+ && in_array($plain_name,$this->objectFilters[$class_lower]))) {
+
+ if (array_key_exists($raw_name,$members)
+ && !$property->isStatic()) {
+
+ $return[$name] = $this->encodeObject($members[$raw_name], $ObjectDepth + 1, 1, $MaxDepth + 1);
+
+ } else {
+ if (method_exists($property,'setAccessible')) {
+ $property->setAccessible(true);
+ $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1, $MaxDepth + 1);
+ } else
+ if ($property->isPublic()) {
+ $return[$name] = $this->encodeObject($property->getValue($Object), $ObjectDepth + 1, 1, $MaxDepth + 1);
+ } else {
+ $return[$name] = '** Need PHP 5.3 to get value **';
+ }
+ }
+ } else {
+ $return[$name] = '** Excluded by Filter **';
+ }
+ }
+
+ // Include all members that are not defined in the class
+ // but exist in the object
+ foreach( $members as $raw_name => $value ) {
+
+ $name = $raw_name;
+
+ if ($name{0} == "\0") {
+ $parts = explode("\0", $name);
+ $name = $parts[2];
+ }
+
+ $plain_name = $name;
+
+ if (!isset($properties[$name])) {
+ $name = 'undeclared:'.$name;
+
+ if (!(isset($this->objectFilters[$class_lower])
+ && is_array($this->objectFilters[$class_lower])
+ && in_array($plain_name,$this->objectFilters[$class_lower]))) {
+
+ $return[$name] = $this->encodeObject($value, $ObjectDepth + 1, 1, $MaxDepth + 1);
+ } else {
+ $return[$name] = '** Excluded by Filter **';
+ }
+ }
+ }
+
+ array_pop($this->objectStack);
+
+ } elseif (is_array($Object)) {
+
+ if ($ArrayDepth > $this->options['maxArrayDepth']) {
+ return '** Max Array Depth ('.$this->options['maxArrayDepth'].') **';
+ }
+
+ foreach ($Object as $key => $val) {
+
+ // Encoding the $GLOBALS PHP array causes an infinite loop
+ // if the recursion is not reset here as it contains
+ // a reference to itself. This is the only way I have come up
+ // with to stop infinite recursion in this case.
+ if ($key=='GLOBALS'
+ && is_array($val)
+ && array_key_exists('GLOBALS',$val)) {
+ $val['GLOBALS'] = '** Recursion (GLOBALS) **';
+ }
+
+ $return[$key] = $this->encodeObject($val, 1, $ArrayDepth + 1, $MaxDepth + 1);
+ }
+ } else {
+ if (self::is_utf8($Object)) {
+ return $Object;
+ } else {
+ return utf8_encode($Object);
+ }
+ }
+ return $return;
+ }
+
+ /**
+ * Returns true if $string is valid UTF-8 and false otherwise.
+ *
+ * @param mixed $str String to be tested
+ * @return boolean
+ */
+ protected static function is_utf8($str)
+ {
+ if(function_exists('mb_detect_encoding')) {
+ return (mb_detect_encoding($str) == 'UTF-8');
+ }
+ $c=0; $b=0;
+ $bits=0;
+ $len=strlen($str);
+ for($i=0; $i<$len; $i++){
+ $c=ord($str[$i]);
+ if ($c > 128){
+ if (($c >= 254)) return false;
+ elseif ($c >= 252) $bits=6;
+ elseif ($c >= 248) $bits=5;
+ elseif ($c >= 240) $bits=4;
+ elseif ($c >= 224) $bits=3;
+ elseif ($c >= 192) $bits=2;
+ else return false;
+ if (($i+$bits) > $len) return false;
+ while($bits > 1){
+ $i++;
+ $b=ord($str[$i]);
+ if ($b < 128 || $b > 191) return false;
+ $bits--;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Converts to and from JSON format.
+ *
+ * JSON (JavaScript Object Notation) is a lightweight data-interchange
+ * format. It is easy for humans to read and write. It is easy for machines
+ * to parse and generate. It is based on a subset of the JavaScript
+ * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
+ * This feature can also be found in Python. JSON is a text format that is
+ * completely language independent but uses conventions that are familiar
+ * to programmers of the C-family of languages, including C, C++, C#, Java,
+ * JavaScript, Perl, TCL, and many others. These properties make JSON an
+ * ideal data-interchange language.
+ *
+ * This package provides a simple encoder and decoder for JSON notation. It
+ * is intended for use with client-side Javascript applications that make
+ * use of HTTPRequest to perform server communication functions - data can
+ * be encoded into JSON notation for use in a client-side javascript, or
+ * decoded from incoming Javascript requests. JSON format is native to
+ * Javascript, and can be directly eval()'ed with no further parsing
+ * overhead
+ *
+ * All strings should be in ASCII or UTF-8 format!
+ *
+ * LICENSE: Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met: Redistributions of source code must retain the
+ * above copyright notice, this list of conditions and the following
+ * disclaimer. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * @category
+ * @package Services_JSON
+ * @author Michal Migurski
+ * @author Matt Knapp
+ * @author Brett Stimmerman
+ * @author Christoph Dorn
+ * @copyright 2005 Michal Migurski
+ * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
+ * @license http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
+ */
+
+
+ /**
+ * Keep a list of objects as we descend into the array so we can detect recursion.
+ */
+ private $json_objectStack = array();
+
+
+ /**
+ * convert a string from one UTF-8 char to one UTF-16 char
+ *
+ * Normally should be handled by mb_convert_encoding, but
+ * provides a slower PHP-only method for installations
+ * that lack the multibye string extension.
+ *
+ * @param string $utf8 UTF-8 character
+ * @return string UTF-16 character
+ * @access private
+ */
+ private function json_utf82utf16($utf8)
+ {
+ // oh please oh please oh please oh please oh please
+ if (function_exists('mb_convert_encoding')) {
+ return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
+ }
+
+ switch(strlen($utf8)) {
+ case 1:
+ // this case should never be reached, because we are in ASCII range
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return $utf8;
+
+ case 2:
+ // return a UTF-16 character from a 2-byte UTF-8 char
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr(0x07 & (ord($utf8{0}) >> 2))
+ . chr((0xC0 & (ord($utf8{0}) << 6))
+ | (0x3F & ord($utf8{1})));
+
+ case 3:
+ // return a UTF-16 character from a 3-byte UTF-8 char
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr((0xF0 & (ord($utf8{0}) << 4))
+ | (0x0F & (ord($utf8{1}) >> 2)))
+ . chr((0xC0 & (ord($utf8{1}) << 6))
+ | (0x7F & ord($utf8{2})));
+ }
+
+ // ignoring UTF-32 for now, sorry
+ return '';
+ }
+
+ /**
+ * encodes an arbitrary variable into JSON format
+ *
+ * @param mixed $var any number, boolean, string, array, or object to be encoded.
+ * see argument 1 to Services_JSON() above for array-parsing behavior.
+ * if var is a strng, note that encode() always expects it
+ * to be in ASCII or UTF-8 format!
+ *
+ * @return mixed JSON string representation of input var or an error if a problem occurs
+ * @access public
+ */
+ private function json_encode($var)
+ {
+
+ if (is_object($var)) {
+ if (in_array($var,$this->json_objectStack)) {
+ return '"** Recursion **"';
+ }
+ }
+
+ switch (gettype($var)) {
+ case 'boolean':
+ return $var ? 'true' : 'false';
+
+ case 'NULL':
+ return 'null';
+
+ case 'integer':
+ return (int) $var;
+
+ case 'double':
+ case 'float':
+ return (float) $var;
+
+ case 'string':
+ // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
+ $ascii = '';
+ $strlen_var = strlen($var);
+
+ /*
+ * Iterate over every character in the string,
+ * escaping with a slash or encoding to UTF-8 where necessary
+ */
+ for ($c = 0; $c < $strlen_var; ++$c) {
+
+ $ord_var_c = ord($var{$c});
+
+ switch (true) {
+ case $ord_var_c == 0x08:
+ $ascii .= '\b';
+ break;
+ case $ord_var_c == 0x09:
+ $ascii .= '\t';
+ break;
+ case $ord_var_c == 0x0A:
+ $ascii .= '\n';
+ break;
+ case $ord_var_c == 0x0C:
+ $ascii .= '\f';
+ break;
+ case $ord_var_c == 0x0D:
+ $ascii .= '\r';
+ break;
+
+ case $ord_var_c == 0x22:
+ case $ord_var_c == 0x2F:
+ case $ord_var_c == 0x5C:
+ // double quote, slash, slosh
+ $ascii .= '\\'.$var{$c};
+ break;
+
+ case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
+ // characters U-00000000 - U-0000007F (same as ASCII)
+ $ascii .= $var{$c};
+ break;
+
+ case (($ord_var_c & 0xE0) == 0xC0):
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
+ $c += 1;
+ $utf16 = $this->json_utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xF0) == 0xE0):
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}));
+ $c += 2;
+ $utf16 = $this->json_utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xF8) == 0xF0):
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}),
+ ord($var{$c + 3}));
+ $c += 3;
+ $utf16 = $this->json_utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xFC) == 0xF8):
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}),
+ ord($var{$c + 3}),
+ ord($var{$c + 4}));
+ $c += 4;
+ $utf16 = $this->json_utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xFE) == 0xFC):
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}),
+ ord($var{$c + 3}),
+ ord($var{$c + 4}),
+ ord($var{$c + 5}));
+ $c += 5;
+ $utf16 = $this->json_utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+ }
+ }
+
+ return '"'.$ascii.'"';
+
+ case 'array':
+ /*
+ * As per JSON spec if any array key is not an integer
+ * we must treat the the whole array as an object. We
+ * also try to catch a sparsely populated associative
+ * array with numeric keys here because some JS engines
+ * will create an array with empty indexes up to
+ * max_index which can cause memory issues and because
+ * the keys, which may be relevant, will be remapped
+ * otherwise.
+ *
+ * As per the ECMA and JSON specification an object may
+ * have any string as a property. Unfortunately due to
+ * a hole in the ECMA specification if the key is a
+ * ECMA reserved word or starts with a digit the
+ * parameter is only accessible using ECMAScript's
+ * bracket notation.
+ */
+
+ // treat as a JSON object
+ if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
+
+ $this->json_objectStack[] = $var;
+
+ $properties = array_map(array($this, 'json_name_value'),
+ array_keys($var),
+ array_values($var));
+
+ array_pop($this->json_objectStack);
+
+ foreach($properties as $property) {
+ if ($property instanceof Exception) {
+ return $property;
+ }
+ }
+
+ return '{' . join(',', $properties) . '}';
+ }
+
+ $this->json_objectStack[] = $var;
+
+ // treat it like a regular array
+ $elements = array_map(array($this, 'json_encode'), $var);
+
+ array_pop($this->json_objectStack);
+
+ foreach($elements as $element) {
+ if ($element instanceof Exception) {
+ return $element;
+ }
+ }
+
+ return '[' . join(',', $elements) . ']';
+
+ case 'object':
+ $vars = self::encodeObject($var);
+
+ $this->json_objectStack[] = $var;
+
+ $properties = array_map(array($this, 'json_name_value'),
+ array_keys($vars),
+ array_values($vars));
+
+ array_pop($this->json_objectStack);
+
+ foreach($properties as $property) {
+ if ($property instanceof Exception) {
+ return $property;
+ }
+ }
+
+ return '{' . join(',', $properties) . '}';
+
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * array-walking function for use in generating JSON-formatted name-value pairs
+ *
+ * @param string $name name of key to use
+ * @param mixed $value reference to an array element to be encoded
+ *
+ * @return string JSON-formatted name-value pair, like '"name":value'
+ * @access private
+ */
+ private function json_name_value($name, $value)
+ {
+ // Encoding the $GLOBALS PHP array causes an infinite loop
+ // if the recursion is not reset here as it contains
+ // a reference to itself. This is the only way I have come up
+ // with to stop infinite recursion in this case.
+ if ($name=='GLOBALS'
+ && is_array($value)
+ && array_key_exists('GLOBALS',$value)) {
+ $value['GLOBALS'] = '** Recursion **';
+ }
+
+ $encoded_value = $this->json_encode($value);
+
+ if ($encoded_value instanceof Exception) {
+ return $encoded_value;
+ }
+
+ return $this->json_encode(strval($name)) . ':' . $encoded_value;
+ }
+}
diff --git a/src/application/configs/modules/Wootook.php b/src/application/configs/modules/Wootook.php
deleted file mode 100644
index c94c9e0..0000000
--- a/src/application/configs/modules/Wootook.php
+++ /dev/null
@@ -1,17 +0,0 @@
- array(
- 'modules' => array(
- 'WootookCore' => array(
- 'active' => true,
- 'code-pool' => 'core'
- ),
- 'WootookPlayer' => array(
- 'active' => false,
- 'code-pool' => 'core',
- 'dependencies' => array(
- 'WootookCore' => '1.5.0'
- )
- )
- )
- )
- );
diff --git a/src/application/configs/system.php b/src/application/configs/system.php
index 033ef82..8246cb4 100644
--- a/src/application/configs/system.php
+++ b/src/application/configs/system.php
@@ -52,7 +52,7 @@
),
'home' => array(
'title' => 'Welcome on Wootook!',
- 'formatted-welcome-text' => '
Wootook make you an emperor.
Conquer outer space and master other players on Wootook.
'
+ 'formated-welcome-text' => '
Wootook make you an emperor.
Conquer outer space and master other players on Wootook.
La centrale électrique solaire est la source d'énergie la plus abordable.
Elle puise sa source des étoiles les plus proches de la planète sur laquelle elle est implantée. De ce fait, les planètes les plus proches du centre du système solaires produiront une plus grande quantité d'énergie que les planètes les plus éloignées.
",
+ 'description' => "
La centrale électrique solaire est la source d'énergie la plus abordable.
Fruit de longues décénnies de recherche, le réacteur à fusion nucléaire est désormais une source d'énergie rentable.
Nourrie par l'énergie engendrée par la fusion des isotopes d'hydrogène, cette centrale génère plus d'énergie que toutes les autres sources d'énergie disponibles aujourd'hui. La contrepartie à cette surgénération d'énergie est son côut en deutérium.
",
+ 'description' => "
Fruit de longues décénnies de recherche, le réacteur à fusion nucléaire est désormais une source d'énergie rentable.
Nourrie par l'énergie engendrée par la fusion des isotopes d'hydrogène, cette centrale génère plus d'énergie que toutes les autres sources d'énergie. La contrepartie à cette surgénération d'énergie, est son côut en deutérium.
",
'image' => 'medias/klore/images/building/fusion-reactor.jpg'
),
diff --git a/src/application/modules/WootookCore/autoload_classmap.php b/src/application/modules/WootookCore/autoload_classmap.php
deleted file mode 100644
index 52d6e08..0000000
--- a/src/application/modules/WootookCore/autoload_classmap.php
+++ /dev/null
@@ -1,168 +0,0 @@
- __DIR__ . '/src/Wootook/Core/App/App.php',
- 'Wootook\\Core\\Base\\BaseObject' => __DIR__ . '/src/Wootook/Core/Base/BaseObject.php',
- 'Wootook\\Core\\Base\\DataContainer' => __DIR__ . '/src/Wootook/Core/Base/DataContainer.php',
- 'Wootook\\Core\\Base\\Service\\App' => __DIR__ . '/src/Wootook/Core/Base/Service/App.php',
- 'Wootook\\Core\\Base\\Singleton' => __DIR__ . '/src/Wootook/Core/Base/Singleton.php',
- 'Wootook\\Core\\Base\\Util\FileSystem' => __DIR__ . '/src/Wootook/Core/Base/Util/FileSystem.php',
- 'Wootook\\Core\\Block\\Concat' => __DIR__ . '/src/Wootook/Core/Block/Concat.php',
- 'Wootook\\Core\\Block\\Deprecated' => __DIR__ . '/src/Wootook/Core/Block/Deprecated.php',
- 'Wootook\\Core\\Block\\Html\\Form' => __DIR__ . '/src/Wootook/Core/Block/Html/Form.php',
- 'Wootook\\Core\\Block\\Html\\Head' => __DIR__ . '/src/Wootook/Core/Block/Html/Head.php',
- 'Wootook\\Core\\Block\\Html\\Home' => __DIR__ . '/src/Wootook/Core/Block/Html/Home.php',
- 'Wootook\\Core\\Block\\Html\\Navigation\\Link' => __DIR__ . '/src/Wootook/Core/Block/Html/Navigation/Link.php',
- 'Wootook\\Core\\Block\\Html\\Navigation\\Menu' => __DIR__ . '/src/Wootook/Core/Block/Html/Navigation/Menu.php',
- 'Wootook\\Core\\Block\\Html\\Navigation\\Node' => __DIR__ . '/src/Wootook/Core/Block/Html/Navigation/Node.php',
- 'Wootook\\Core\\Block\\Html\\Page' => __DIR__ . '/src/Wootook/Core/Block/Html/Page.php',
- 'Wootook\\Core\\Block\\Messages' => __DIR__ . '/src/Wootook/Core/Block/Messages.php',
- 'Wootook\\Core\\Block\\Template' => __DIR__ . '/src/Wootook/Core/Block/Template.php',
- 'Wootook\\Core\\Block\\Text' => __DIR__ . '/src/Wootook/Core/Block/Text.php',
- 'Wootook\\Core\\Config\\Adapter\\Adapter' => __DIR__ . '/src/Wootook/Core/Config/Adapter/Adapter.php',
- 'Wootook\\Core\\Config\\Adapter\\PhpArray' => __DIR__ . '/src/Wootook/Core/Config/Adapter/PhpArray.php',
- 'Wootook\\Core\\Config\\Node' => __DIR__ . '/src/Wootook/Core/Config/Node.php',
- 'Wootook\\Core\\Controller\\ErrorController' => __DIR__ . '/src/Wootook/Core/Controller/ErrorController.php',
- 'Wootook\\Core\\Controller\\IndexController' => __DIR__ . '/src/Wootook/Core/Controller/IndexController.php',
- 'Wootook\\Core\\Database\\Adapter\\Adapter' => __DIR__ . '/src/Wootook/Core/Database/Adapter/Adapter.php',
- 'Wootook\\Core\\Database\\Adapter\\Mysql' => __DIR__ . '/src/Wootook/Core/Database/Adapter/Mysql.php',
- 'Wootook\\Core\\Database\\Adapter\\Pdo' => __DIR__ . '/src/Wootook/Core/Database/Adapter/Pdo.php',
- 'Wootook\\Core\\Database\\Adapter\\Pdo\\Mysql' => __DIR__ . '/src/Wootook/Core/Database/Adapter/Pdo/Mysql.php',
- 'Wootook\\Core\\Database\\Adapter\\Pdo\\Sqlite' => __DIR__ . '/src/Wootook/Core/Database/Adapter/Pdo/Sqlite.php',
- 'Wootook\\Core\\Database\\ConnectionManager' => __DIR__ . '/src/Wootook/Core/Database/ConnectionManager.php',
- 'Wootook\\Core\\Database\\Orm\\DataMapper\\Config' => __DIR__ . '/src/Wootook/Core/Database/Orm/DataMapper/Config.php',
- 'Wootook\\Core\\Database\\Orm\\DataMapper\\DateTime' => __DIR__ . '/src/Wootook/Core/Database/Orm/DataMapper/DateTime.php',
- 'Wootook\\Core\\Database\\Orm\\DataMapper\\FieldMapper' => __DIR__ . '/src/Wootook/Core/Database/Orm/DataMapper/FieldMapper.php',
- 'Wootook\\Core\\Database\\Orm\\DataMapper\\PhpArray' => __DIR__ . '/src/Wootook/Core/Database/Orm/DataMapper/PhpArray.php',
- 'Wootook\\Core\\Database\\Orm\\DataMapper\\PhpObject' => __DIR__ . '/src/Wootook/Core/Database/Orm/DataMapper/PhpObject.php',
- 'Wootook\\Core\\Database\\Orm\\DataMapper' => __DIR__ . '/src/Wootook/Core/Database/Orm/DataMapper.php',
- 'Wootook\\Core\\Database\\Resource\\DataMapper' => __DIR__ . '/src/Wootook/Core/Database/Resource/DataMapper.php',
- 'Wootook\\Core\\Database\\Resource\\ReadConnection' => __DIR__ . '/src/Wootook/Core/Database/Resource/ReadConnection.php',
- 'Wootook\\Core\\Database\\Resource\\WriteConnection' => __DIR__ . '/src/Wootook/Core/Database/Resource/WriteConnection.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Delete' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Delete.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Dml' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Dml.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\DmlQuery' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/DmlQuery.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Insert' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Insert.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Select' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Select.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Update' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Update.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Condition\\Condition' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Condition/Condition.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Condition\\LogicalOperator' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Condition/LogicalOperator.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Condition\\MathOperator' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Condition/MathOperator.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Column' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Column.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\ColumnAware' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/ColumnAware.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\From' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/From.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\FromAware' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/FromAware.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Into' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Into.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\IntoAware' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/IntoAware.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Limit' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Limit.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\LimitAware' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/LimitAware.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Set' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Set.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\SetAware' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/SetAware.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Where' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Where.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\WhereAware' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/WhereAware.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\Column' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Column.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\ColumnAware' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/ColumnAware.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\From' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/From.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\FromAware' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/FromAware.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\Into' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Into.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\IntoAware' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/IntoAware.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\Limit' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Limit.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\LimitAware' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/LimitAware.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\Set' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Set.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\SetAware' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/SetAware.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\Where' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Where.php',
- 'Wootook\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\WhereAware' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/WhereAware.php',
- 'Wootook\\Core\\Database\\Sql\\Placeholder\\Expression' => __DIR__ . '/src/Wootook/Core/Database/Sql/Placeholder/Expression.php',
- 'Wootook\\Core\\Database\\Sql\\Placeholder\\Param' => __DIR__ . '/src/Wootook/Core/Database/Sql/Placeholder/Param.php',
- 'Wootook\\Core\\Database\\Sql\\Placeholder\\Placeholder' => __DIR__ . '/src/Wootook/Core/Database/Sql/Placeholder/Placeholder.php',
- 'Wootook\\Core\\Database\\Sql\\Placeholder\\Variable' => __DIR__ . '/src/Wootook/Core/Database/Sql/Placeholder/Variable.php',
- 'Wootook\\Core\\Database\\Statement\\Mysql' => __DIR__ . '/src/Wootook/Core/Database/Statement/Mysql.php',
- 'Wootook\\Core\\Database\\Statement\\Pdo' => __DIR__ . '/src/Wootook/Core/Database/Statement/Pdo.php',
- 'Wootook\\Core\\Database\\Statement\\Statement' => __DIR__ . '/src/Wootook/Core/Database/Statement/Statement.php',
- 'Wootook\\Core\\DateTime\\DateInterval' => __DIR__ . '/src/Wootook/Core/DateTime/DateInterval.php',
- 'Wootook\\Core\\DateTime\\DatePeriod' => __DIR__ . '/src/Wootook/Core/DateTime/DatePeriod.php',
- 'Wootook\\Core\\DateTime\\DateTime' => __DIR__ . '/src/Wootook/Core/DateTime/DateTime.php',
- 'Wootook\\Core\\DateTime\\DateTimeZone' => __DIR__ . '/src/Wootook/Core/DateTime/DateTimeZone.php',
- 'Wootook\\Core\\DependencyInjection\\Definition\\ClassDefinition' => __DIR__ . '/src/Wootook/Core/DependencyInjection/Definition/ClassDefinition.php',
- 'Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition' => __DIR__ . '/src/Wootook/Core/DependencyInjection/Definition/MethodDefinition.php',
- 'Wootook\\Core\\DependencyInjection\\Definition\\ArgumentDefinition' => __DIR__ . '/src/Wootook/Core/DependencyInjection/Definition/ArgumentDefinition.php',
- 'Wootook\\Core\\DependencyInjection\\Factory' => __DIR__ . '/src/Wootook/Core/DependencyInjection/Factory.php',
- 'Wootook\\Core\\DependencyInjection\\Registry' => __DIR__ . '/src/Wootook/Core/DependencyInjection/Registry.php',
- 'Wootook\\Core\\Email\\Email' => __DIR__ . '/src/Wootook/Core/Email/Email.php',
- 'Wootook\\Core\\Email\\Part\\Part' => __DIR__ . '/src/Wootook/Core/Email/Part/Part.php',
- 'Wootook\\Core\\Email\\Transport\\Sendmail' => __DIR__ . '/src/Wootook/Core/Email/Transport/Sendmail.php',
- 'Wootook\\Core\\Email\\Transport\\Transport' => __DIR__ . '/src/Wootook/Core/Email/Transport/Transport.php',
- 'Wootook\\Core\\Event\\Break' => __DIR__ . '/src/Wootook/Core/Event/Break.php',
- 'Wootook\\Core\\Event\\Event' => __DIR__ . '/src/Wootook/Core/Event/Event.php',
- 'Wootook\\Core\\Event\\EventTarget' => __DIR__ . '/src/Wootook/Core/Event/EventTarget.php',
- 'Wootook\\Core\\Exception\\CoreException' => __DIR__ . '/src/Wootook/Core/Exception/CoreException.php',
- 'Wootook\\Core\\Exception\\BadMethodCallException' => __DIR__ . '/src/Wootook/Core/Exception/BadMethodCallException.php',
- 'Wootook\\Core\\Exception\\DataAccessException' => __DIR__ . '/src/Wootook/Core/Exception/DataAccessException.php',
- 'Wootook\\Core\\Exception\\Database\\AdapterError' => __DIR__ . '/src/Wootook/Core/Exception/Database/AdapterError.php',
- 'Wootook\\Core\\Exception\\Database\\Error' => __DIR__ . '/src/Wootook/Core/Exception/Database/Error.php',
- 'Wootook\\Core\\Exception\\Database\\StatementError' => __DIR__ . '/src/Wootook/Core/Exception/Database/StatementError.php',
- 'Wootook\\Core\\Exception\\DependencyInjection\\BadMethodCallException' => __DIR__ . '/src/Wootook/Core/Exception/DependencyInjection/BadMethodCallException.php',
- 'Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException' => __DIR__ . '/src/Wootook/Core/Exception/DependencyInjection/InvalidArgumentException.php',
- 'Wootook\\Core\\Exception\\DependencyInjection\\RuntimeException' => __DIR__ . '/src/Wootook/Core/Exception/DependencyInjection/RuntimeException.php',
- 'Wootook\\Core\\Exception\\Deprecated' => __DIR__ . '/src/Wootook/Core/Exception/Deprecated.php',
- 'Wootook\\Core\\Exception\\Exception' => __DIR__ . '/src/Wootook/Core/Exception/Exception.php',
- 'Wootook\\Core\\Exception\\GameError' => __DIR__ . '/src/Wootook/Core/Exception/GameError.php',
- 'Wootook\\Core\\Exception\\InvalidArgumentException' => __DIR__ . '/src/Wootook/Core/Exception/InvalidArgumentException.php',
- 'Wootook\\Core\\Exception\\LayoutException' => __DIR__ . '/src/Wootook/Core/Exception/LayoutException.php',
- 'Wootook\\Core\\Exception\\RuntimeException' => __DIR__ . '/src/Wootook/Core/Exception/RuntimeException.php',
- 'Wootook\\Core\\Exception\\WebsiteError' => __DIR__ . '/src/Wootook/Core/Exception/WebsiteError.php',
- 'Wootook\\Core\\Form\\Element\\BaseElement' => __DIR__ . '/src/Wootook/Core/Form/Element/BaseElement.php',
- 'Wootook\\Core\\Form\\Element\\Button' => __DIR__ . '/src/Wootook/Core/Form/Element/Button.php',
- 'Wootook\\Core\\Form\\Element\\Text' => __DIR__ . '/src/Wootook/Core/Form/Element/Text.php',
- 'Wootook\\Core\\Form\\ElementLoader' => __DIR__ . '/src/Wootook/Core/Form/ElementLoader.php',
- 'Wootook\\Core\\Form\\Form' => __DIR__ . '/src/Wootook/Core/Form/Form.php',
- 'Wootook\\Core\\Form\\Validator\\Alnum' => __DIR__ . '/src/Wootook/Core/Form/Validator/Alnum.php',
- 'Wootook\\Core\\Form\\Validator\\Alpha' => __DIR__ . '/src/Wootook/Core/Form/Validator/Alpha.php',
- 'Wootook\\Core\\Form\\Validator\\BaseValidator' => __DIR__ . '/src/Wootook/Core/Form/Validator/BaseValidator.php',
- 'Wootook\\Core\\Form\\Validator\\Email' => __DIR__ . '/src/Wootook/Core/Form/Validator/Email.php',
- 'Wootook\\Core\\Form\\Validator\\FormKey' => __DIR__ . '/src/Wootook/Core/Form/Validator/FormKey.php',
- 'Wootook\\Core\\Form\\Validator\\Hex' => __DIR__ . '/src/Wootook/Core/Form/Validator/Hex.php',
- 'Wootook\\Core\\Form\\Validator\\Host' => __DIR__ . '/src/Wootook/Core/Form/Validator/Host.php',
- 'Wootook\\Core\\Form\\Validator\\Numeric' => __DIR__ . '/src/Wootook/Core/Form/Validator/Numeric.php',
- 'Wootook\\Core\\Form\\Validator\\Regex' => __DIR__ . '/src/Wootook/Core/Form/Validator/Regex.php',
- 'Wootook\\Core\\Form\\ValidatorLoader' => __DIR__ . '/src/Wootook/Core/Form/ValidatorLoader.php',
- 'Wootook\\Core\\Helper\\Config\\ConfigHandler' => __DIR__ . '/src/Wootook/Core/Helper/Config/ConfigHandler.php',
- 'Wootook\\Core\\Helper\\Config\\Events' => __DIR__ . '/src/Wootook/Core/Helper/Config/Events.php',
- 'Wootook\\Core\\Helper\\Config\\Modules' => __DIR__ . '/src/Wootook/Core/Helper/Config/Modules.php',
- 'Wootook\\Core\\Layout\\Manager' => __DIR__ . '/src/Wootook/Core/Layout/Manager.php',
- 'Wootook\\Core\\Layout\\Parser' => __DIR__ . '/src/Wootook/Core/Layout/Parser.php',
- 'Wootook\\Core\\Model\\Config' => __DIR__ . '/src/Wootook/Core/Model/Config.php',
- 'Wootook\\Core\\Model\\Game' => __DIR__ . '/src/Wootook/Core/Model/Game.php',
- 'Wootook\\Core\\Model\\Image\\Png' => __DIR__ . '/src/Wootook/Core/Model/Image/Png.php',
- 'Wootook\\Core\\Model\\Session' => __DIR__ . '/src/Wootook/Core/Model/Session.php',
- 'Wootook\\Core\\Model\\Translator' => __DIR__ . '/src/Wootook/Core/Model/Translator.php',
- 'Wootook\\Core\\Model\\Website' => __DIR__ . '/src/Wootook/Core/Model/Website.php',
- 'Wootook\\Core\\Mvc\\Controller\\Action' => __DIR__ . '/src/Wootook/Core/Mvc/Controller/Action.php',
- 'Wootook\\Core\\Mvc\\Controller\\Front' => __DIR__ . '/src/Wootook/Core/Mvc/Controller/Front.php',
- 'Wootook\\Core\\Mvc\\Controller\\Request\\Http' => __DIR__ . '/src/Wootook/Core/Mvc/Controller/Request/Http.php',
- 'Wootook\\Core\\Mvc\\Controller\\Request\\Request' => __DIR__ . '/src/Wootook/Core/Mvc/Controller/Request/Request.php',
- 'Wootook\\Core\\Mvc\\Controller\\Response\\Http' => __DIR__ . '/src/Wootook/Core/Mvc/Controller/Response/Http.php',
- 'Wootook\\Core\\Mvc\\Controller\\Response\\Response' => __DIR__ . '/src/Wootook/Core/Mvc/Controller/Response/Response.php',
- 'Wootook\\Core\\Mvc\\Model\\Action\\Deletable' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Action/Deletable.php',
- 'Wootook\\Core\\Mvc\\Model\\Action\\Delete' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Action/Delete.php',
- 'Wootook\\Core\\Mvc\\Model\\Action\\Load' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Action/Load.php',
- 'Wootook\\Core\\Mvc\\Model\\Action\\Loadable' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Action/Loadable.php',
- 'Wootook\\Core\\Mvc\\Model\\Action\\Savable' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Action/Savable.php',
- 'Wootook\\Core\\Mvc\\Model\\Action\\Save' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Action/Save.php',
- 'Wootook\\Core\\Mvc\\Model\\Entity' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Entity.php',
- 'Wootook\\Core\\Mvc\\Model\\EntityInterface' => __DIR__ . '/src/Wootook/Core/Mvc/Model/EntityInterface.php',
- 'Wootook\\Core\\Mvc\\Model\\SubTable' => __DIR__ . '/src/Wootook/Core/Mvc/Model/SubTable.php',
- 'Wootook\\Core\\Mvc\\Model\\Type\\Base' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Type/Base.php',
- 'Wootook\\Core\\Mvc\\Model\\Type\\Full' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Type/Full.php',
- 'Wootook\\Core\\Mvc\\Model\\Type\\Readonly' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Type/Readonly.php',
- 'Wootook\\Core\\Mvc\\View\\View' => __DIR__ . '/src/Wootook/Core/Mvc/View/View.php',
- 'Wootook\\Core\\PluginLoader\\PluginLoader' => __DIR__ . '/src/Wootook/Core/PluginLoader/PluginLoader.php',
- 'Wootook\\Core\\Profiler\\ErrorProfiler' => __DIR__ . '/src/Wootook/Core/Profiler/ErrorProfiler.php',
- 'Wootook\\Core\\Resource\\Entity' => __DIR__ . '/src/Wootook/Core/Resource/Entity.php',
- 'Wootook\\Core\\Resource\\EntityCollection\\Action\\Load' => __DIR__ . '/src/Wootook/Core/Resource/EntityCollection/Action/Load.php',
- 'Wootook\\Core\\Resource\\EntityCollection\\Action\\Loadable' => __DIR__ . '/src/Wootook/Core/Resource/EntityCollection/Action/Loadable.php',
- 'Wootook\\Core\\Resource\\EntityCollection' => __DIR__ . '/src/Wootook/Core/Resource/EntityCollection.php',
- 'Wootook\\Core\\Setup\\Exception\\RuntimeException' => __DIR__ . '/src/Wootook/Core/Setup/Exception/RuntimeException.php',
- 'Wootook\\Core\\Setup\\Exception\\VersionStageError' => __DIR__ . '/src/Wootook/Core/Setup/Exception/VersionStageError.php',
- 'Wootook\\Core\\Setup\\Exception\\VersionValueError' => __DIR__ . '/src/Wootook/Core/Setup/Exception/VersionValueError.php',
- 'Wootook\\Core\\Setup\\Updater\\ScriptQueue' => __DIR__ . '/src/Wootook/Core/Setup/Updater/ScriptQueue.php',
- 'Wootook\\Core\\Setup\\Updater' => __DIR__ . '/src/Wootook/Core/Setup/Updater.php',
-);
diff --git a/src/application/modules/WootookCore/autoload_function.php b/src/application/modules/WootookCore/autoload_function.php
deleted file mode 100644
index 3cce3b6..0000000
--- a/src/application/modules/WootookCore/autoload_function.php
+++ /dev/null
@@ -1,11 +0,0 @@
- array(
- 'routes' => array(
- 'default' => array(
- 'type' => 'Zend\Mvc\Router\Http\Segment',
- 'options' => array(
- 'route' => '/[:controller[/:action]]',
- 'constraints' => array(
- 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- ),
- 'defaults' => array(
- 'controller' => 'IndexController',
- 'action' => 'index',
- ),
- ),
- ),
- 'home' => array(
- 'type' => 'Zend\Mvc\Router\Http\Literal',
- 'options' => array(
- 'route' => '/',
- 'defaults' => array(
- 'controller' => 'IndexController',
- 'action' => 'index',
- ),
- ),
- ),
- ),
- ),
- 'controller' => array(
- 'classes' => array(
- 'IndexController' => 'Application\Controller\IndexController'
- ),
- ),
- 'view_manager' => array(
- 'display_not_found_reason' => true,
- 'display_exceptions' => true,
- 'doctype' => 'HTML5',
- 'not_found_template' => 'error/404',
- 'exception_template' => 'error/index',
- 'template_map' => array(
- 'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
- 'index/index' => __DIR__ . '/../view/index/index.phtml',
- 'error/404' => __DIR__ . '/../view/error/404.phtml',
- 'error/index' => __DIR__ . '/../view/error/index.phtml',
- ),
- 'template_path_stack' => array(
- 'application' => __DIR__ . '/../view',
- ),
- ),
-);
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/App/App.php b/src/application/modules/WootookCore/src/Wootook/Core/App/App.php
deleted file mode 100644
index 898527a..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/App/App.php
+++ /dev/null
@@ -1,498 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-
-namespace Wootook\Core\App;
-
-use Wootook\Core,
- Wootook\Core\Config\Adapter as ConfigAdapter,
- Wootook\Core\Database,
- Wootook\Core\Exception as CoreException,
- Wootook\Core\Mvc\Controller as MvcController,
- Wootook\Core\Profiler;
-/**
- *
- */
-class App
-{
- const ENV_PRODUCTION = 'prod';
- const ENV_INTEGRATION = 'inte';
- const ENV_TESTING = 'test';
- const ENV_DEVELOPMENT = 'devel';
-
- const DOMAIN_INSTALL = 'install';
- const DOMAIN_BACKEND = 'backend';
- const DOMAIN_FRONTEND = 'frontend';
- const DOMAIN_WEBSOCKET = 'websocket';
-
- const SCOPE_GLOBAL = 'global';
- const SCOPE_WEBSITE = 'website';
- const SCOPE_GAME = 'game';
-
- /**
- *
- * Enter description here ...
- * @var ConfigAdapter\Adapter
- */
- private $_rootConfig = null;
- private $_globalConfig = null;
-
- protected $_websiteList = array();
- protected $_gameList = array();
-
- protected $_defaultWebsiteId = 1;
- protected $_defaultGameId = 1;
-
- protected $_blockSingletons = array();
- protected $_modelSingletons = array();
- protected $_resourceSingletons = array();
- protected $_helperSingletons = array();
-
- protected $_frontController = null;
-
- protected $_connectionManager = null;
-
- public function __construct($configPath, $domain = self::DOMAIN_FRONTEND, $environment = self::ENV_PRODUCTION)
- {
- try {
- $this->_rootConfig = new ConfigAdapter\PhpArray();
- $this->_rootConfig->load($configPath . DIRECTORY_SEPARATOR . 'system.php');
-
- $localConfig = new ConfigAdapter\PhpArray();
- $localConfig->load($configPath . DIRECTORY_SEPARATOR . 'local.php');
-
- $this->_rootConfig->merge($localConfig);
-
- $directoryIterator = new \FilesystemIterator($configPath . DIRECTORY_SEPARATOR . 'modules');
- foreach ($directoryIterator as $file) {
- $modulesConfig = new ConfigAdapter\PhpArray();
- $modulesConfig->load($file->getPathname());
-
- $this->_rootConfig->merge($modulesConfig);
- }
-
- foreach ($this->_rootConfig->getConfig('global/modules') as $moduleName => $moduleConfig) {
- if (!$moduleConfig->getConfig('active')) {
- continue;
- }
-
- $path = $moduleName . '/config/module.php';
-
- try {
- $additionalModuleConfig = new ConfigAdapter\PhpArray();
- $additionalModuleConfig->load($path);
-
- $this->_rootConfig->merge($additionalModuleConfig);
- } catch (CoreException\DataAccessException $e) {
- Profiler\ErrorProfiler::getSingleton()->addException($e);
- continue;
- }
- }
-
- if (empty($domain) || !$this->_rootConfig[$domain]) {
- $domain = self::DOMAIN_FRONTEND;
- }
-
- if (empty($environment) || !$this->_rootConfig[$environment]) {
- $environment = self::ENV_PRODUCTION;
- }
-
- $this->_globalConfig = clone $this->_rootConfig['default'];
-
- $this->appendEnvironmentConfig($this->_globalConfig, 'global')
- ->appendEnvironmentConfig($this->_globalConfig, $environment)
- ->appendEnvironmentConfig($this->_globalConfig, $domain);
- } catch (CoreException\DataAccessException $e) {
- Profiler\ErrorProfiler::getSingleton()->addException($e);
- }
- }
-
- /**
- * @return MvcController\Front
- */
- public function getFrontController()
- {
- if ($this->_frontController === null) {
- $this->_frontController = new MvcController\Front($this);
- }
- return $this->_frontController;
- }
-
- /**
- * @return MvcController\Front
- */
- public function getConnectionManager()
- {
- if ($this->_connectionManager === null) {
- $this->_connectionManager = new Database\ConnectionManager($this);
- }
- return $this->_connectionManager;
- }
-
- /**
- * @param MvcController\Front $frontController
- * @return Core\App
- */
- public function setFrontController(MvcController\Front $frontController)
- {
- $this->_frontController = $frontController;
-
- return $this;
- }
-
- public function appendEnvironmentConfig(Core\Config\Node $config, $environment)
- {
- if (isset($this->_rootConfig[$environment])) {
- $config->merge($this->_rootConfig[$environment]);
- }
-
- return $this;
- }
-
- public function appendDatabaseConfig(Core\Config\Node $config, $scope = self::SCOPE_GLOBAL, $scopeId = 0)
- {
- if (empty($scope)) {
- $scope = self::SCOPE_GLOBAL;
- }
-
- if ($scope !== self::SCOPE_GLOBAL && $scopeId <= 0) {
- $scope = self::SCOPE_GLOBAL;
- Profiler\ErrorProfiler::getSingleton()
- ->addException(new CoreException\RuntimeException('Please specify a valid scope ID.'));
- }
-
- if ($scope === self::SCOPE_GLOBAL && $scopeId != 0) {
- $scopeId = 0;
- }
-
- $readAdapter = $this->getConnectionManager()
- ->getConnection('core_read');
-
- $select = $readAdapter->select()
- ->column(array('path' => 'config_path', 'value' => 'config_value'))
- ->from(array('config' => $readAdapter->getTable('core_config')))
- ;
- switch ($scope) {
- case self::SCOPE_GLOBAL:
- $select->where('game_id', 0)->where('website_id', 0);
- break;
- case self::SCOPE_WEBSITE:
- $select->where('website_id', $scopeId);
- break;
- case self::SCOPE_GAME:
- $select->where('game_id', $scopeId);
- break;
- }
- /** @var Core\Database\Statement\Statement $statement */
- $statement = $select->prepare();
-
- $statement->execute();
- foreach ($statement as $row) {
- $config->setConfig($row['path'], $row['value']);
- }
-
- return $this;
- }
-
- public function setDefaultWebsiteId($websiteIdentifier)
- {
- $this->_defaultWebsiteId = $websiteIdentifier;
-
- return $this;
- }
-
- public function getDefaultWebsiteId()
- {
- return $this->_defaultWebsiteId;
- }
-
- /**
- * @return \Wootook\Core\Model\Website
- */
- public function getDefaultWebsite()
- {
- return $this->getWebsite($this->_defaultWebsiteId);
- }
-
- public function setDefaultGameId($gameIdentifier)
- {
- $this->_defaultGameId = $gameIdentifier;
-
- return $this;
- }
-
- public function getDefaultGameId()
- {
- return $this->_defaultGameId;
- }
-
- public function getDefaultGame()
- {
- return $this->getGame($this->_defaultGameId);
- }
-
- /**
- * @param string|int $websiteIdentifier
- * @return \Wootook\Core\Model\Website
- */
- public function getWebsite($websiteIdentifier)
- {
- if (!isset($this->_websiteList[$websiteIdentifier])) {
- /** @var Model\Website $website */
- //$website = $this->getModel('core', 'website', array($this));
- $website = new Model\Website($this);
-
- if (is_numeric($websiteIdentifier)) {
- $website->load($websiteIdentifier);
- } else if ($websiteIdentifier !== null) {
- $website->load($websiteIdentifier, 'code');
- } else {
- throw new CoreException\RuntimeException('Website identifier should be specified.');
- }
-
- $this->_websiteList[$website->getId()] = $website;
- $this->_websiteList[$website->getCode()] = $website;
- }
-
- return $this->_websiteList[$websiteIdentifier];
- }
-
- /**
- * @param string|int $gameIdentifier
- * @return \Wootook\Core\Model\Game
- */
- public function getGame($gameIdentifier)
- {
- if (!isset($this->_gameList[$gameIdentifier])) {
- /** @var Model\Game $game */
- //$game = $this->getModel('core', 'game', array($this));
- $game = new Model\Game($this);
-
- if (is_numeric($gameIdentifier)) {
- $game->load($gameIdentifier);
- } else if ($gameIdentifier !== null) {
- $game->load($gameIdentifier, 'code');
- } else {
- throw new CoreException\RuntimeException('Game identifier should be specified.');
- }
-
- $this->_gameList[$game->getId()] = $game;
- $this->_gameList[$game->getCode()] = $game;
- }
-
- return $this->_gameList[$gameIdentifier];
- }
-
- public function getGlobalConfig($path = null)
- {
- if ($this->_globalConfig === null) {
- return null;
- }
- if ($path !== null) {
- return $this->_globalConfig->getConfig($path);
- }
- return $this->_globalConfig;
- }
-
- protected function _resolveClassType(&$namespaces, $module, $class)
- {
- $classSuffix = str_replace(' ', '', ucwords(str_replace('-', ' ', $class)));
- $classSuffix = str_replace(' ', '_', ucwords(str_replace('.', ' ', $classSuffix)));
-
- if (isset($namespaces[$module])) {
- foreach ($namespaces[$module] as $namespace => $path) {
- $className = $namespace . $classSuffix;
- $fileName = $path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $classSuffix) . '.php';
-
- Profiler\ErrorProfiler::getSingleton()->sleep();
- if (!($fp = @fopen($fileName, 'r', true))) {
- Profiler\ErrorProfiler::getSingleton()->wakeup();
- continue;
- }
- Profiler\ErrorProfiler::getSingleton()->wakeup();
- fclose($fp);
-
- if (!class_exists($className, true)) {
- continue;
- }
-
- return $className;
- }
- }
-
- Profiler\ErrorProfiler::getSingleton()
- ->addException(new CoreException\RuntimeException(sprintf('Class type "%1$s/%2$s" could not be resolved.', $module, $class)));
- return null;
- }
-
- protected function _newInstance($className, Array $constructorParams)
- {
- if ($className === null) {
- return null;
- }
-
- if (empty($constructorParams)) {
- return new $className;
- } else {
- $reflection = new ReflectionClass($className);
- return $reflection->newInstanceArgs($constructorParams);
- }
- }
-
- protected function _parseIdentifier($identifier, &$module, &$class)
- {
- $offset = strpos($identifier, '/');
- if ($offset === false) {
- $module = $identifier;
- $class = null;
-
- return;
- }
-
- $module = substr($identifier, 0, $offset);
- $class = substr($identifier, $offset + 1);
- }
-
- public function block($identifier, Array $constructorParams = array())
- {
- $this->_parseIdentifier($identifier, $module, $class);
-
- if ($class === null) {
- $class = 'view';
- }
-
- return $this->getBlock($module, $class, $constructorParams);
- }
-
- public function model($identifier, Array $constructorParams = array())
- {
- $this->_parseIdentifier($identifier, $module, $class);
-
- if ($class === null) {
- $class = 'entity';
- }
-
- return $this->getModel($module, $class, $constructorParams);
- }
-
- public function resource($identifier, Array $constructorParams = array())
- {
- $this->_parseIdentifier($identifier, $module, $class);
-
- if ($class === null) {
- $class = 'entity';
- }
-
- return $this->getResource($module, $class, $constructorParams);
- }
-
- public function helper($identifier, Array $constructorParams = array())
- {
- $this->_parseIdentifier($identifier, $module, $class);
-
- if ($class === null) {
- $class = 'data';
- }
-
- return $this->getResource($module, $class, $constructorParams);
- }
-
- public function getBlock($module, $class, Array $constructorParams = array())
- {
- $className = $this->_resolveClassType($this->_globalConfig->getConfig('blocks'), $module, $class);
-
- return $this->_newInstance($className, $constructorParams);
- }
-
- public function getModel($module, $class, Array $constructorParams = array())
- {
- $className = $this->_resolveClassType($this->_globalConfig->getConfig('models'), $module, $class);
-
- return $this->_newInstance($className, $constructorParams);
- }
-
- public function getResource($module, $class, Array $constructorParams = array())
- {
- $className = $this->_resolveClassType($this->_globalConfig->getConfig('resources'), $module, $class);
-
- return $this->_newInstance($className, $constructorParams);
- }
-
- public function getHelper($module, $class, Array $constructorParams = array())
- {
- $className = $this->_resolveClassType($this->_globalConfig->getConfig('helpers'), $module, $class);
-
- return $this->_newInstance($className, $constructorParams);
- }
-
- public function getBlockSingleton($module, $class, Array $constructorParams = array())
- {
- if (!isset($this->_blockSingletons[$module])) {
- $this->_blockSingletons[$module] = array();
- }
- if (!isset($this->_blockSingletons[$module][$class])) {
- $this->_blockSingletons[$module][$class] = $this->getBlock($module, $class, $constructorParams);
- }
- return $this->_blockSingletons[$module][$class];
- }
-
- public function getModelSingleton($module, $class, Array $constructorParams = array())
- {
- if (!isset($this->_modelSingletons[$module])) {
- $this->_modelSingletons[$module] = array();
- }
- if (!isset($this->_modelSingletons[$module][$class])) {
- $this->_modelSingletons[$module][$class] = $this->getModel($module, $class, $constructorParams);
- }
- return $this->_modelSingletons[$module][$class];
- }
-
- public function getResourceSingleton($module, $class, Array $constructorParams = array())
- {
- if (!isset($this->_resourceSingletons[$module])) {
- $this->_resourceSingletons[$module] = array();
- }
- if (!isset($this->_resourceSingletons[$module][$class])) {
- $this->_resourceSingletons[$module][$class] = $this->getResource($module, $class, $constructorParams);
- }
- return $this->_resourceSingletons[$module][$class];
- }
-
- public function getHelperSingleton($module, $class, Array $constructorParams = array())
- {
- if (!isset($this->_helperSingletons[$module])) {
- $this->_helperSingletons[$module] = array();
- }
- if (!isset($this->_helperSingletons[$module][$class])) {
- $this->_helperSingletons[$module][$class] = $this->getHelper($module, $class, $constructorParams);
- }
- return $this->_helperSingletons[$module][$class];
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Base/BaseObject.php b/src/application/modules/WootookCore/src/Wootook/Core/Base/BaseObject.php
deleted file mode 100644
index db1e7c1..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Base/BaseObject.php
+++ /dev/null
@@ -1,68 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Base;
-
-/**
- *
- * Enter description here ...
- * @author Greg
- *
- */
-class BaseObject
- implements \ArrayAccess
-{
- use Service\App, DataContainer;
-
- protected function _construct(Array $data = array())
- {
- $this->addData($data);
- }
-
- public function offsetExists($offset)
- {
- return $this->hasData($offset);
- }
-
- public function offsetGet($offset)
- {
- return $this->getData($offset);
- }
-
- public function offsetSet($offset, $data)
- {
- return $this->setData($offset, $data);
- }
-
- public function offsetUnset($offset)
- {
- return $this->unsetData($offset);
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Base/Service/App.php b/src/application/modules/WootookCore/src/Wootook/Core/Base/Service/App.php
deleted file mode 100644
index d2c142e..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Base/Service/App.php
+++ /dev/null
@@ -1,67 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Base\Service;
-
-use Wootook\Core;
-
-/**
- *
- *
- */
-trait App
-{
- /**
- * @var \Wootook\Core\App
- */
- protected $_app = null;
-
- /**
- * @param \Wootook\Core\App $app
- * @param null $...
- */
- public function __construct(Core\App\App $app, $_ = null)
- {
- $this->_app = $app;
-
- $params = func_get_args();
- array_shift($params);
-
- call_user_func_array(array($this, '_construct'), $params);
- }
-
- /**
- * @return \Wootook\Core\App
- */
- public function app()
- {
- return $this->_app;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Base/Util/FileSystem.php b/src/application/modules/WootookCore/src/Wootook/Core/Base/Util/FileSystem.php
deleted file mode 100644
index 3516202..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Base/Util/FileSystem.php
+++ /dev/null
@@ -1,68 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Base\Util;
-
-use Wootook\Core\Profiler;
-
-class FileSystem
-{
- public function fileExists($fileName)
- {
- if ($fileName === null || empty($fileName)) {
- return false;
- }
-
- if (($fp = @fopen($fileName, 'r', true)) === false) {
- return false;
- }
- fclose($fp);
-
- return true;
- }
-
- public function directoryExists($directoryName)
- {
- if ($directoryName === null || empty($directoryName)) {
- return false;
- }
-
- return is_dir($directoryName);
- }
-
- public function includeFile($fileName)
- {
- if ($fileName === null || empty($fileName)) {
- return null;
- }
-
- return include $fileName;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Block/Concat.php b/src/application/modules/WootookCore/src/Wootook/Core/Block/Concat.php
deleted file mode 100644
index 9eaeae8..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Block/Concat.php
+++ /dev/null
@@ -1,46 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Block;
-
-use Wootook\Core\Mvc\View;
-
-class Concat
- extends View\View
-{
- public function render()
- {
- $content = '';
- foreach ($this->_partials as $partial) {
- $content .= $partial->render();
- }
- return $content;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Block/Deprecated.php b/src/application/modules/WootookCore/src/Wootook/Core/Block/Deprecated.php
deleted file mode 100644
index b3f9edb..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Block/Deprecated.php
+++ /dev/null
@@ -1,40 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Block;
-
-class Deprecated
- extends Template
-{
- public function getScriptPath()
- {
- return $this->getLayout()->getScriptPath();
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Block/Html/Form.php b/src/application/modules/WootookCore/src/Wootook/Core/Block/Html/Form.php
deleted file mode 100644
index d98e023..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Block/Html/Form.php
+++ /dev/null
@@ -1,41 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Block;
-
-class Form
- extends Template
-{
- public function getFormKey()
- {
- $session = \Wootook::getSession('security');
- return $session->getFormKey(true);
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Block/Html/Home.php b/src/application/modules/WootookCore/src/Wootook/Core/Block/Html/Home.php
deleted file mode 100644
index 6634cd7..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Block/Html/Home.php
+++ /dev/null
@@ -1,45 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Block;
-
-class Home
- extends Template
-{
- public function getTitle()
- {
- return \Wootook::app()->getDefaultGame()->getConfig('game/home/title');
- }
-
- public function getFormattedWelcomeText()
- {
- return \Wootook::app()->getDefaultGame()->getConfig('game/home/formatted-welcome-text');
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Block/Html/Navigation/Node.php b/src/application/modules/WootookCore/src/Wootook/Core/Block/Html/Navigation/Node.php
deleted file mode 100644
index e60a391..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Block/Html/Navigation/Node.php
+++ /dev/null
@@ -1,57 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Block\Html\Navigation;
-
-class Node
- extends Menu
-{
- protected $_title = '';
-
- public function setTitle($title)
- {
- $this->_title = $title;
-
- return $this;
- }
-
- public function getTitle()
- {
- return $this->_title;
- }
-
- public function getTemplate()
- {
- if ($this->_template !== null) {
- return $this->_template;
- }
- return 'page/html/navigation/node.phtml';
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Block/Html/Page.php b/src/application/modules/WootookCore/src/Wootook/Core/Block/Html/Page.php
deleted file mode 100644
index 0d4135b..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Block/Html/Page.php
+++ /dev/null
@@ -1,51 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Block\Html;
-
-use Wootook\Core\Block;
-
-class Page
- extends Block\Template
-{
- protected $_bodyClasses = array();
-
- public function getBodyClasses()
- {
- return implode(' ', $this->_bodyClasses);
- }
-
- public function addBodyClass($class)
- {
- $this->_bodyClasses[] = $class;
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Block/Messages.php b/src/application/modules/WootookCore/src/Wootook/Core/Block/Messages.php
deleted file mode 100644
index e483a09..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Block/Messages.php
+++ /dev/null
@@ -1,77 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Block;
-
-class Messages
- extends Template
-{
- protected $_storages = array();
-
- public function prepareMessages($namespace)
- {
- $this->_storages[] = $namespace;
- }
-
- public function renderGroupedHtml()
- {
- $messages = array();
-
- foreach ($this->_storages as $namespace) {
- $session = \Wootook::getSession($namespace);
-
- $messageList = $session->getMessages();
- if (!is_array($messageList)) {
- continue;
- }
- foreach ($messageList as $messageLevel => $messageList) {
- if (!isset($messages[$messageLevel])) {
- $messages[$messageLevel] = $messageList;
- } else {
- $messages[$messageLevel] += $messageList;
- }
- }
- }
-
- rsort($messages, SORT_NUMERIC);
-
- $output = '
';
-
- return $output;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Block/Template.php b/src/application/modules/WootookCore/src/Wootook/Core/Block/Template.php
deleted file mode 100644
index 6e4fe80..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Block/Template.php
+++ /dev/null
@@ -1,81 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Block;
-
-use Wootook\Core\Profiler,
- Wootook\Core\Mvc\View,
- Wootook\Core\Model,
- Wootook\Core\Exception as CoreException;
-
-class Template
- extends View\View
-{
- protected function _getTemplatePath($file)
- {
- if ($this->getScriptPath() == '') {
- Profiler\ErrorProfiler::getSingleton()
- ->addException(new CoreException\RuntimeException("No script path defined in block {$this->getNameInLayout()}."));
- return null;
- }
-
- $pattern = "{$this->getScriptPath()}/%s/%s/scripts/{$file}";
- if (($layout = $this->getLayout()) !== null) {
- $package = $this->getLayout()->getPackage();
- $theme = $this->getLayout()->getTheme();
-
- if ($package !== Model\Layout::DEFAULT_PACKAGE) {
- if ($theme !== Model\Layout::DEFAULT_THEME) {
- $path = sprintf($pattern, $package, $theme);
- if (\Wootook::fileExists($path)) {
- return $path;
- }
- }
-
- $path = sprintf($pattern, $package, Model\Layout::DEFAULT_THEME);
- if (\Wootook::fileExists($path)) {
- return $path;
- }
- }
- } else {
- Profiler\ErrorProfiler::getSingleton()
- ->addException(new CoreException\RuntimeException("No layout defined."));
- }
-
- $path = sprintf($pattern, Model\Layout::DEFAULT_PACKAGE, Model\Layout::DEFAULT_THEME);
- if (\Wootook::fileExists($path)) {
- return $path;
- }
-
- Profiler\ErrorProfiler::getSingleton()
- ->addException(new CoreException\RuntimeException("Template '{$file}' could not be found."));
- return null;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Block/Text.php b/src/application/modules/WootookCore/src/Wootook/Core/Block/Text.php
deleted file mode 100644
index a28e04d..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Block/Text.php
+++ /dev/null
@@ -1,60 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Block;
-
-use Wootook\Core\Mvc\View;
-
-class Text
- extends View\View
-{
- protected $_content = null;
-
- public function setContent($content)
- {
- $this->_content = $content;
-
- return $this;
- }
-
- public function getContent()
- {
- return $this->_content;
- }
-
- public function render()
- {
- $content = $this->getContent();
- if (empty($content)) {
- return null;
- }
- return $content;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Bootstrap/Module.php b/src/application/modules/WootookCore/src/Wootook/Core/Bootstrap/Module.php
deleted file mode 100644
index d1f460d..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Bootstrap/Module.php
+++ /dev/null
@@ -1,55 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Bootstrap;
-
-use Wootook\Core\Config,
- Wootook\Core\Base\Service;
-
-class Module
-{
- use Service\App;
-
- protected function _construct(Config\Node $rootConfig)
- {
- return;
-
- foreach ($rootConfig->getConfig('global/modules') as $moduleAlias => $moduleConfig) {
- if ($moduleConfig->getConfig('active') !== true) {
- continue;
- }
- if (($codePool = $moduleConfig->getConfig('code-pool')) === null) {
- continue;
- }
-
-
- }
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Config/Adapter/Adapter.php b/src/application/modules/WootookCore/src/Wootook/Core/Config/Adapter/Adapter.php
deleted file mode 100644
index e688136..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Config/Adapter/Adapter.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Config\Adapter;
-
-use Wootook\Core\Config;
-
-abstract class Adapter
- extends Config\Node
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Config/Adapter/PhpArray.php b/src/application/modules/WootookCore/src/Wootook/Core/Config/Adapter/PhpArray.php
deleted file mode 100644
index 0282447..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Config/Adapter/PhpArray.php
+++ /dev/null
@@ -1,72 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Config\Adapter;
-
-use Wootook\Core\Base\Util,
- Wootook\Core\Exception as CoreException;
-
-class PhpArray
- extends Adapter
-{
- protected $_ioHelper = null;
-
- public function __construct($filename = null)
- {
- if ($filename !== null) {
- $this->load($filename);
- }
-
- $this->_ioHelper = new Util\FileSystem();
- }
-
- public function load($filename)
- {
- if (!$this->_ioHelper->fileExists($filename)) {
- throw new CoreException\DataAccessException(sprintf('Could not load config file "%s"', $filename));
- }
- $data = $this->_ioHelper->includeFile($filename);
-
- if (!is_array($data)) {
- throw new CoreException\DataAccessException('Configuration file could not be loaded.');
- }
-
- $this->_init($data);
-
- return $this;
- }
-
- public function save($filename)
- {
- file_put_contents($filename, '<' . '?p' . 'hp return ' . var_export($this->toArray(), true) . ';');
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Controller/ErrorController.php b/src/application/modules/WootookCore/src/Wootook/Core/Controller/ErrorController.php
deleted file mode 100644
index 17ecba0..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Controller/ErrorController.php
+++ /dev/null
@@ -1,43 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Controller;
-
-use Wootook\Core\Mvc\Controller as MvcController;
-
-class ErrorController
- extends MvcController\Action
-{
- public function noRouteAction()
- {
- $this->loadLayout('no-route');
- $this->renderLayout();
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Controller/IndexController.php b/src/application/modules/WootookCore/src/Wootook/Core/Controller/IndexController.php
deleted file mode 100644
index 4a1993a..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Controller/IndexController.php
+++ /dev/null
@@ -1,43 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Controller;
-
-use Wootook\Core\Mvc\Controller as MvcController;
-
-class IndexController
- extends MvcController\Action
-{
- public function indexAction()
- {
- $this->loadLayout('home');
- $this->renderLayout();
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Adapter.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Adapter.php
deleted file mode 100644
index 09ff943..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Adapter.php
+++ /dev/null
@@ -1,281 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Adapter;
-
-use Wootook\Core,
- Wootook\Core\Database\Orm,
- Wootook\Core\Database\Sql,
- Wootook\Core\Database\Statement,
- Wootook\Core\Event,
- Wootook\Core\Exception as CoreException;
-
-abstract class Adapter
-{
- use Event\EventTarget;
-
- protected $_handler = null;
-
- protected $_tablePrefix = null;
-
- protected $_statementClass = null;
-
- public function setStatementClass($statementClass)
- {
- $this->_statementClass = $statementClass;
-
- return $this;
- }
-
- public function getStatementClass()
- {
- return $this->_statementClass;
- }
-
- public function getDriverHandler()
- {
- return $this->_handler;
- }
-
- public function getDataMapper()
- {
- return new Orm\DataMapper();
- }
-
- /**
- *
- * @param string $prefix
- * @return Adapter
- */
- public function setTablePrefix($prefix)
- {
- $this->_tablePrefix = $prefix;
-
- return $this;
- }
-
- /**
- * @return string
- */
- public function getTablePrefix()
- {
- return $this->_tablePrefix;
- }
-
- /**
- * @return string
- */
- public function getTable($table)
- {
- return $this->getTablePrefix() . $table;
- }
-
- /**
- * @return Sql\Select
- */
- public function select()
- {
- return new Sql\Select($this);
- }
-
- /**
- * @return Sql\Insert
- */
- public function insert()
- {
- return new Sql\Insert($this);
- }
-
- /**
- * @return Sql\Update
- */
- public function update()
- {
- return new Sql\Update($this);
- }
-
- /**
- * @return Sql\Delete
- */
- public function delete()
- {
- return new Sql\Delete($this);
- }
-
- /**
- * @param string $data
- * @return string
- */
- abstract public function quote($data);
-
- /**
- * @param string $identifier
- * @return string
- */
- abstract public function quoteIdentifier($identifier);
-
- /**
- * @param string $identifier
- * @return string
- */
- public function quoteInto($string, $values)
- {
- $parts = preg_split('#(:[\w_]+|[?])#', $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
-
- $result = '';
- if (is_array($values)) {
- $index = 0;
- foreach ($parts as $part) {
- if ($part == '?') {
- $result .= $this->quote($values[$index++]);
- } else if (!empty($part) && $part[0] == ':') {
- $key = substr($part, 1);
-
- if (isset($values[$key])) {
- $result .= $this->quote($values[$key]);
- } else if (isset($values[$part])) {
- $result .= $this->quote($values[$part]);
- } else {
- $result .= $part;
- }
- } else {
- $result .= $part;
- }
- }
- } else {
- foreach ($parts as $part) {
- if ($part == '?' || $part[0] == ':') {
- $result .= $this->quote($values);
- } else {
- $result .= $part;
- }
- }
- }
-
- return $result;
- }
-
- /**
- * @param $sql
- * @param array|null $params
- * @param Closure|null $asynchronousCallback
- * @return \Wootook\Core\Database\Statement\Statement
- * @throws \Wootook\Core\Exception\Database\StatementError
- */
- public function query($sql, Array $params = null, Closure $asynchronousCallback = null)
- {
- $statement = $this->prepare($sql, $params);
-
- if ($asynchronousCallback !== null) {
- $statement->registerEventListener(Statement\Statement::EVENT_READY, $asynchronousCallback);
- }
- if (!$statement->execute(null, $asynchronousCallback !== null)) {
- $message = sprintf('[SQLSTATE %s] Could not execute query: %s', $statement->errorState(), $statement->errorMessage());
- throw new CoreException\Database\StatementError($statement, $message);
- }
-
- return $statement;
- }
-
- /**
- * @param $sql
- * @param array|null $params
- * @param Closure|null $asynchronousCallback
- * @return bool
- */
- public function execute($sql, Array $params = null, Closure $asynchronousCallback = null)
- {
- $statement = $this->prepare($sql, $params);
-
- if ($asynchronousCallback !== null) {
- $statement->registerEventListener(Statement\Statement::EVENT_READY, $asynchronousCallback);
- }
-
- return $statement->execute(null, $asynchronousCallback !== null);
- }
-
- /**
- * @param $sql
- * @param array|null $params
- * @return \Wootook\Core\Database\Statement\Statement
- */
- public function prepare($sql, Array $params = null)
- {
- $statement = new $this->_statementClass($this, $sql);
-
- if ($params !== null) {
- foreach ($params as $paramKey => $paramValue) {
- $statement->bindValue($paramKey, $paramValue, $statement->getParamType($paramValue));
- }
- }
-
- return $statement;
- }
-
- /**
- * @return bool
- */
- abstract public function beginTransaction();
-
- /**
- * @return bool
- */
- abstract public function commit();
-
- /**
- * @return bool
- */
- abstract public function rollback();
-
- /**
- * @return bool
- */
- abstract public function lastInsertId();
-
- /**
- * @return string
- */
- abstract public function errorCode();
-
- /**
- * @return string
- */
- abstract public function errorMessage();
-
- /**
- * @return array
- */
- abstract public function errorInfo();
-
- /**
- * @return string
- */
- abstract public function errorState();
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Mysql.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Mysql.php
deleted file mode 100644
index 9596466..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Mysql.php
+++ /dev/null
@@ -1,178 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Adapter;
-
-use Wootook\Core\Config,
- Wootook\Core\Database,
- Wootook\Core\Database\Statement,
- Wootook\Core\Database\Sql,
- Wootook\Core\Exception as CoreException;
-
-class Mysql
- extends Adapter
-{
- protected $_statementClass = 'Wootook\\Core\\Database\\Statement\\Mysql';
-
- /**
- *
- * Enter description here ...
- * @param Config\Node $config
- * @param array $params
- */
- public function __construct(Config\Node $config, Array $options = array())
- {
- if (!isset($options[Database\ConnectionManager::ATTR_ERRMODE])) {
- $options[Database\ConnectionManager::ATTR_ERRMODE] = Database\ConnectionManager::ERRMODE_EXCEPTION;
- }
-
- try {
- $this->_handler = new \mysqli($config->hostname, $config->username, $config->password, $config->database, (int) $config->port, $options);
- } catch (\mysqli_sql_exception $e) {
- throw new CoreException\Database\AdapterError($this, $e->getMessage(), null, $e);
- }
-
- if ($this->_handler->connect_errno) {
- throw new CoreException\Database\AdapterError($this, $this->_handler->connect_error, $this->_handler->connect_errno);
- }
- }
-
- /**
- * (non-PHPdoc)
- * @see Adapter\Adapter::quoteIdentifier()
- */
- public function quoteIdentifier($identifier)
- {
- return "`$identifier`";
- }
-
- public function quote($data)
- {
- $result = $this->_handler->real_escape_string($data);
-
- if ($this->_handler->errno) {
- throw new CoreException\Database\AdapterError($this, $this->_handler->connect_error, $this->_handler->connect_errno);
- }
-
- return $result;
- }
-
- /**
- * @return bool
- */
- public function beginTransaction()
- {
- $result = $this->_handler->autocommit(false);
-
- if ($this->_handler->errno) {
- throw new CoreException\Database\AdapterError($this, $this->_handler->connect_error, $this->_handler->connect_errno);
- }
-
- return $result;
- }
-
- /**
- * @return bool
- */
- public function commit()
- {
- $result = $this->_handler->commit();
- $this->_handler->autocommit(true);
-
- if ($this->_handler->errno) {
- throw new CoreException\Database\AdapterError($this, $this->_handler->connect_error, $this->_handler->connect_errno);
- }
-
- return $result;
- }
-
- /**
- * @return bool
- */
- public function rollback()
- {
- $result = $this->_handler->rollback();
- $this->_handler->autocommit(true);
-
- if ($this->_handler->errno) {
- throw new CoreException\Database\AdapterError($this, $this->_handler->connect_error, $this->_handler->connect_errno);
- }
-
- return $result;
- }
-
- /**
- * @return int
- */
- public function lastInsertId()
- {
- return $this->_handler->insert_id;
- }
-
- /**
- * @return string
- */
- public function errorCode()
- {
- return $this->_handler->errno;
- }
-
- /**
- * @return array
- */
- public function errorInfo()
- {
- return array(
- $this->_handler->sqlstate,
- $this->_handler->errno,
- $this->_handler->error,
- );
- }
-
- /**
- * @return string
- */
- public function errorMessage()
- {
- $info = $this->_handler->error;
-
- return $info[2];
- }
-
- /**
- * @return string
- */
- public function errorState()
- {
- $info = $this->_handler->sqlstate;
-
- return $info[0];
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Pdo.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Pdo.php
deleted file mode 100644
index c9bc397..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Pdo.php
+++ /dev/null
@@ -1,180 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Adapter;
-
-use Wootook\Core\Config,
- Wootook\Core\Database,
- Wootook\Core\Database\Statement,
- Wootook\Core\Database\Sql,
- Wootook\Core\Exception as CoreException;
-
-abstract class Pdo
- extends Adapter
-{
- /**
- *
- * Enter description here ...
- * @param Config\Node $config
- * @param array $params
- */
- public function __construct(Config\Node $config, Array $options = array())
- {
- if (!isset($options[Database\ConnectionManager::ATTR_ERRMODE])) {
- $options[Database\ConnectionManager::ATTR_ERRMODE] = Database\ConnectionManager::ERRMODE_EXCEPTION;
- }
-
- try {
- $this->_handler = new \PDO($this->_buildDsn($config), $config->username, $config->password, $options);
- } catch (\PDOException $e) {
- throw new CoreException\Database\AdapterError($this, $e->getMessage(), null, $e);
- }
- }
-
- /**
- * @abstract
- * @param \Wootook\Core\Config\Node $config
- * @return string
- */
- abstract protected function _buildDsn(Config\Node $config);
-
- public function quote($data)
- {
- try {
- return $this->_handler->quote($data);
- } catch (\PDOException $e) {
- throw new CoreException\Database\AdapterError($this, $e->getMessage(), null, $e);
- }
- }
-
- /**
- * @return Statement\Statement
- */
- public function prepare($sql, Array $params = null)
- {
- $statement = new $this->_statementClass($this, $sql);
-
- if ($params !== null) {
- foreach ($params as $paramKey => $paramValue) {
- $statement->bindValue($paramKey, $paramValue, $statement->getParamType($paramValue));
- }
- }
-
- return $statement;
- }
-
- /**
- * @return bool
- */
- public function beginTransaction()
- {
- try {
- return $this->_handler->beginTransaction();
- } catch (\PDOException $e) {
- throw new CoreException\Database\AdapterError($this, $e->getMessage(), null, $e);
- }
- return false;
- }
-
- /**
- * @return bool
- */
- public function commit()
- {
- try {
- return $this->_handler->commit();
- } catch (\PDOException $e) {
- throw new CoreException\Database\AdapterError($this, $e->getMessage(), null, $e);
- }
- return false;
- }
-
- /**
- * @return bool
- */
- public function rollback()
- {
- try {
- return $this->_handler->rollback();
- } catch (\PDOException $e) {
- throw new CoreException\Database\AdapterError($this, $e->getMessage(), null, $e);
- }
- return false;
- }
-
- /**
- * @return int
- */
- public function lastInsertId()
- {
- try {
- return $this->_handler->lastInsertId();
- } catch (\PDOException $e) {
- throw new CoreException\Database\AdapterError($this, $e->getMessage(), null, $e);
- }
- return false;
- }
-
- /**
- * @return string
- */
- public function errorCode()
- {
- return $this->_handler->errorCode();
- }
-
- /**
- * @return array
- */
- public function errorInfo()
- {
- return $this->_handler->errorInfo();
- }
-
- /**
- * @return string
- */
- public function errorMessage()
- {
- $info = $this->_handler->errorInfo();
-
- return $info[2];
- }
-
- /**
- * @return string
- */
- public function errorState()
- {
- $info = $this->_handler->errorInfo();
-
- return $info[0];
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Pdo/Mysql.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Pdo/Mysql.php
deleted file mode 100644
index 3cc0e0f..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Pdo/Mysql.php
+++ /dev/null
@@ -1,63 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Adapter\Pdo;
-
-use Wootook\Core\Config,
- Wootook\Core\Database,
- Wootook\Core\Database\Adapter,
- Wootook\Core\Database\Statement,
- Wootook\Core\Database\Sql,
- Wootook\Core\Exception as CoreException;
-
-class Mysql
- extends Adapter\Pdo
-{
- protected $_statementClass = 'Wootook\\Core\\Database\\Statement\\Pdo\\Mysql';
-
- protected function _buildDsn(Config\Node $config)
- {
- $dsn = "mysql:host={$config->hostname};dbname={$config->database}";
- if (is_numeric($config->port)) {
- $dsn .= ";port={$config->database}";
- }
-
- return $dsn;
- }
-
- /**
- * (non-PHPdoc)
- * @see Adapter\Adapter::quoteIdentifier()
- */
- public function quoteIdentifier($identifier)
- {
- return "`$identifier`";
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Pdo/Sqlite.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Pdo/Sqlite.php
deleted file mode 100644
index 8a24958..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Adapter/Pdo/Sqlite.php
+++ /dev/null
@@ -1,60 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Adapter\Pdo;
-
-use Wootook\Core\Config,
- Wootook\Core\Database,
- Wootook\Core\Database\Adapter,
- Wootook\Core\Database\Statement,
- Wootook\Core\Database\Sql,
- Wootook\Core\Exception as CoreException;
-
-class Sqlite
- extends Adapter\Pdo
-{
- protected $_statementClass = 'Wootook\\Core\\Database\\Statement\\Pdo\\Sqlite';
-
- protected function _buildDsn(Config\Node $config)
- {
- $dsn = "sqlite:{$config->database}";
-
- return $dsn;
- }
-
- /**
- * (non-PHPdoc)
- * @see Adapter\Adapter::quoteIdentifier()
- */
- public function quoteIdentifier($identifier)
- {
- return "\"$identifier\"";
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/Config.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/Config.php
deleted file mode 100644
index dbb88ff..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/Config.php
+++ /dev/null
@@ -1,47 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Orm\DataMapper;
-
-use Wootook\Core\Config as CoreConfig;
-
-class Config
- extends FieldMapper
-{
- public function encode($value)
- {
- return parent::encode($value->toArray());
- }
-
- public function decode($value)
- {
- return new CoreConfig\Node(parent::decode($value));
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/DateTime.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/DateTime.php
deleted file mode 100644
index b8e624f..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/DateTime.php
+++ /dev/null
@@ -1,70 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Orm\DataMapper;
-
-use Wootook\Core;
-
-class DateTime
- extends FieldMapper
-{
- const DATE_FORMAT_MYSQL = 'Y-m-d G:i:s';
-
- protected $_format = self::DATE_FORMAT_MYSQL;
-
- public function setFormat($format = null)
- {
- if ($format === null) {
- $this->_format = self::DATE_FORMAT_MYSQL;
- } else {
- $this->_format = $format;
- }
- return $this;
- }
-
- public function getFormat()
- {
- return $this->_format;
- }
-
- public function encode($value)
- {
- if (!$value instanceof Core\DateTime) {
- $value = new Core\DateTime($value);
- }
-
- return $value->toString($this->getFormat());
- }
-
- public function decode($value)
- {
- return new Core\DateTime($value, $this->getFormat());
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/FieldMapper.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/FieldMapper.php
deleted file mode 100644
index 7399fed..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/FieldMapper.php
+++ /dev/null
@@ -1,47 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Orm\DataMapper;
-
-use Wootook\Core\Database\Orm;
-
-abstract class FieldMapper
-{
- protected $_mapper = null;
-
- public function __construct(Orm\DataMapper $mapper = null)
- {
- $this->_mapper = $mapper;
- }
-
- abstract public function encode($value);
-
- abstract public function decode($value);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/PhpArray.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/PhpArray.php
deleted file mode 100644
index aa25a02..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/PhpArray.php
+++ /dev/null
@@ -1,45 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Orm\DataMapper;
-
-class PhpArray
- extends FieldMapper
-{
- public function encode($value)
- {
- return serialize($value);
- }
-
- public function decode($value)
- {
- return unserialize($value);
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/PhpObject.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/PhpObject.php
deleted file mode 100644
index 8e52740..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Orm/DataMapper/PhpObject.php
+++ /dev/null
@@ -1,73 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Orm\DataMapper;
-
-class PhpObject
- extends FieldMapper
-{
- protected $_entityClass = null;
-
- protected $_reflectionClass = null;
-
- public function setEntityClass($class)
- {
- $this->_entityClass = $class;
-
- return $this;
- }
-
- public function getEntityClass()
- {
- return $this->_entityClass;
- }
-
- protected function _newInstance(Array $args = array())
- {
- if ($this->_reflectionClass === null && $this->_entityClass !== null) {
- $this->_reflectionClass = new ReflectionClass($this->_entityClass);
- }
-
- return $this->newInstanceArgs($args);
- }
-
- public function encode($value)
- {
- return parent::encode($value->getAllDatas());
- }
-
- public function decode($value)
- {
- $object = $this->_newInstance();
- $object->addData(parent::decode($value));
-
- return $object;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Resource/DataMapper.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Resource/DataMapper.php
deleted file mode 100644
index db0e086..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Resource/DataMapper.php
+++ /dev/null
@@ -1,61 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Resource;
-
-use Wootook\Core\Database\Orm;
-
-trait DataMapper
-{
- protected $_dataMapper = null;
-
- /**
- *
- * @return Orm\DataMapper
- */
- public function getDataMapper()
- {
- if ($this->_dataMapper === null) {
- $this->_dataMapper = new Orm\DataMapper();
- }
- return $this->_dataMapper;
- }
-
- /**
- *
- * @param Orm\DataMapper $dataMapper
- */
- public function setDataMapper(Orm\DataMapper $dataMapper)
- {
- $this->_dataMapper = $dataMapper;
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Resource/ReadConnection.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Resource/ReadConnection.php
deleted file mode 100644
index 4dfea06..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Resource/ReadConnection.php
+++ /dev/null
@@ -1,72 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Resource;
-
-use Wootook\Core,
- Wootook\Core\Database,
- Wootook\Core\Database\Adapter as DatabaseAdapter,
- Wootook\Core\Exception as CoreException;
-
-/**
- *
- */
-trait ReadConnection
-{
- protected $_readConnection = null;
-
- /**
- * @return DatabaseAdapter\Adapter
- */
- public function getReadConnection()
- {
- if ($this->_readConnection === null) {
- $this->_readConnection = $this->app()->getConnectionManager()
- ->getConnection('core_read');
- }
-
- return $this->_readConnection;
- }
-
- public function setReadConnection($connection)
- {
- if ($connection instanceof DatabaseAdapter\Adapter) {
- $this->_readConnection = $connection;
- } else if (is_string($connection)) {
- $this->_readConnection = $this->app()->getConnectionManager()
- ->getConnection($connection);
- } else {
- throw new CoreException\RuntimeException(
- 'First parameter should be either a database connection object or a string identifier.');
- }
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Resource/WriteConnection.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Resource/WriteConnection.php
deleted file mode 100644
index 61b0dc5..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Resource/WriteConnection.php
+++ /dev/null
@@ -1,70 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Resource;
-
-use Wootook\Core,
- Wootook\Core\Database\Adapter as DatabaseAdapter,
- Wootook\Core\Exception as CoreException;
-
-/**
- *
- */
-trait WriteConnection
-{
- protected $_writeConnection = null;
-
- /**
- * @return DatabaseAdapter\Adapter
- */
- public function getWriteConnection()
- {
- if ($this->_writeConnection === null) {
- $this->_writeConnection = $this->app()->getConnectionManager()
- ->getConnection('core_write');
- }
- return $this->_writeConnection;
- }
-
- public function setWriteConnection($connection)
- {
- if ($connection instanceof DatabaseAdapter\Adapter) {
- $this->_readConnection = $connection;
- } else if (is_string($connection)) {
- $this->_readConnection = $this->app()->getConnectionManager()
- ->getConnection($connection);
- } else {
- throw new CoreException\RuntimeException(
- 'First parameter should be either a database connection object or a string identifier.');
- }
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/Condition.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/Condition.php
deleted file mode 100644
index cc807d3..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/Condition.php
+++ /dev/null
@@ -1,123 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Condition;
-
-use Wootook\Core\Database\Adapter,
- Wootook\Core\Database\Sql\Placeholder,
- Wootook\Core\Database\Sql\Dml,
- Wootook\Core\Database\Statement;
-
-abstract class Condition
-{
- protected $_query = null;
- protected $_placeholders = array();
-
- abstract public function render();
-
- public function __toString()
- {
- return (string) $this->render();
- }
-
- abstract public function reset();
-
- public function setQuery(Dml\Dml $query)
- {
- $this->_query = $query;
-
- return $this;
- }
-
- public function getQuery()
- {
- return $this->_query;
- }
-
- public function addPlaceholder(Placeholder\Placeholder $placeholder)
- {
- $this->_placeholders[] = $placeholder;
-
- return $this;
- }
-
- public function clearPlaceholders()
- {
- $this->_placeholders = array();
-
- return $this;
- }
-
- public function getAllPlaceholders()
- {
- return $this->_placeholders;
- }
-
- public function beforePrepare(Statement\Statement $statement)
- {
- foreach ($this->getAllPlaceholders() as $placeholder) {
- /** @var \Wootook\Core\Database\Sql\Placeholder\Placeholder $placeholder */
- $placeholder->beforePrepare($statement);
- }
-
- return $this;
- }
-
- public function afterPrepare(Statement\Statement $statement)
- {
- foreach ($this->getAllPlaceholders() as $placeholder) {
- /** @var \Wootook\Core\Database\Sql\Placeholder\Placeholder $placeholder */
- $placeholder->afterPrepare($statement);
- }
-
- return $this;
- }
-
- public function beforeExecute(Statement\Statement $statement)
- {
- foreach ($this->getAllPlaceholders() as $placeholder) {
- /** @var \Wootook\Core\Database\Sql\Placeholder\Placeholder $placeholder */
- $placeholder->beforeExecute($statement);
- }
-
- return $this;
- }
-
- public function afterExecute(Statement\Statement $statement)
- {
- foreach ($this->getAllPlaceholders() as $placeholder) {
- /** @var \Wootook\Core\Database\Sql\Placeholder\Placeholder $placeholder */
- $placeholder->afterExecute($statement);
- }
-
- return $this;
- }
-
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/InListOperator.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/InListOperator.php
deleted file mode 100644
index fb289e5..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/InListOperator.php
+++ /dev/null
@@ -1,127 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Condition;
-
-use Wootook\Core\Database\Sql\Dml,
- Wootook\Core\Database\Sql\Placeholder;
-
-
-class InListOperator
- extends Condition
-{
- protected $_operator = null;
- protected $_field = null;
- protected $_values = array();
-
- public function __construct(Dml\Dml $query, $operator)
- {
- $this->_query = $query;
- $this->_operator = $operator;
- }
-
- protected function _render($rawOperator)
- {
- $output = array();
- foreach ($this->_values as $value) {
- if ($this->_value instanceof Placeholder\Placeholder) {
- $output[] = $value;
- }
-
- $output[] = $this->getQuery()->quote($value);
- }
-
- return $rawOperator . '(' . implode(', ', $output) . ')';
- }
-
- public function render()
- {
- switch ($this->_operator) {
- case Dml\Section\WhereAware::OPERATOR_IN:
- return $this->_render('=');
-
- case Dml\Section\WhereAware::OPERATOR_NOT_IN:
- return $this->_render('!=');
- }
-
- return '';
- }
-
- public function reset()
- {
- $this->_operator = null;
- $this->_field = null;
- $this->_values = array();
-
- $this->_clearPlaceholders();
-
- return $this;
- }
-
- public function setOperator($operator)
- {
- $this->_operator = $operator;
-
- return $this;
- }
-
- public function getOperator()
- {
- return $this->_operator;
- }
-
- public function setField($field)
- {
- $this->_field = $field;
-
- return $this;
- }
-
- public function getField()
- {
- return $this->_field;
- }
-
- public function addValue($value)
- {
- if ($value instanceof Placeholder\Placeholder) {
- $this->_addPlaceholder($value);
- }
-
- $this->_values[] = $value;
-
- return $this;
- }
-
- public function getAllValues()
- {
- return $this->_values;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/LogicalOperator.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/LogicalOperator.php
deleted file mode 100644
index c7f8c15..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/LogicalOperator.php
+++ /dev/null
@@ -1,264 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Condition;
-
-use Wootook\Core\Database\Sql\Dml,
- Wootook\Core\Exception as CoreException;
-
-class LogicalOperator
- extends Condition
- implements \ArrayAccess, \Countable, \Iterator
-{
- /**
- * @var string|int
- */
- protected $_operator = null;
-
- /**
- * @var array
- */
- protected $_conditions = array();
-
- /**
- * @var array
- */
- protected $_allowedOperators = array();
-
- public function __construct(Dml\Dml $query, $operator = null, Array $allowedOperators = array())
- {
- $this->_query = $query;
- $this->_operator = $operator;
-
- $this->_allowedOperators = array(
- Dml\Section\WhereAware::OPERATOR_NOT => function(LogicalOperator $conditions) {
- return '(NOT (' . $conditions[0] . ')';
- },
- Dml\Section\WhereAware::OPERATOR_AND => function(LogicalOperator $conditions) {
- return '(' . implode(') AND (', $conditions->getAllConditions()) . ')';
- },
- Dml\Section\WhereAware::OPERATOR_NAND => function(LogicalOperator $conditions) {
- return '(NOT (' . implode(') AND (', $conditions->getAllConditions()) . '))';
- },
- Dml\Section\WhereAware::OPERATOR_OR => function(LogicalOperator $conditions) {
- return '(' . implode(') OR (', $conditions->getAllConditions()) . ')';
- },
- Dml\Section\WhereAware::OPERATOR_NOR => function(LogicalOperator $conditions) {
- return '(NOT (' . implode(') OR (', $conditions->getAllConditions()) . '))';
- },
- Dml\Section\WhereAware::OPERATOR_XOR => function(LogicalOperator $conditions) {
- return '(' . implode(') XOR (', $conditions->getAllConditions()) . ')';
- },
- Dml\Section\WhereAware::OPERATOR_NXOR => function(LogicalOperator $conditions) {
- return '(NOT (' . implode(') XOR (', $conditions->getAllConditions()) . '))';
- },
- );
-
- foreach ($allowedOperators as $operatorKey => $operator) {
- if (!$operator instanceof \Closure) {
- continue;
- }
- /** @var \Closure $operator */
- $this->addAllowedOperator($operatorKey, $operator);
- }
- }
-
- /**
- * @return LogicalOperator
- */
- public function reset()
- {
- $this->_operator = null;
- $this->_conditions = array();
-
- $this->_clearPlaceholders();
-
- return $this;
- }
-
- /**
- * @return string
- */
- public function render()
- {
- if (isset($this->_allowedOperators[$this->_operator])) {
- return $this->_allowedOperators[$this->_operator]($this);
- }
-
- return '';
- }
-
- /**
- * @param string|int $operator
- * @return LogicalOperator
- */
- public function setOperator($operator)
- {
- if (!isset($this->_allowedOperators[$operator])) {
- throw new CoreException\InvalidArgumentException('Inexistent operator');
- }
- $this->_operator = $operator;
-
- return $this;
- }
-
- /**
- * @return string|int
- */
- public function getOperator()
- {
- return $this->_operator;
- }
-
- /**
- * @param string|int $operator
- * @param Closure $renderer
- * @return LogicalOperator
- */
- public function addAllowedOperator($operator, \Closure $renderer)
- {
- $this->_allowedOperators[$operator] = $renderer;
-
- return $this;
- }
-
- /**
- * @param string|int $operator
- * @return LogicalOperator
- */
- public function removeAllowedOperator($operator)
- {
- $key = array_search($operator, $this->_allowedOperators);
- if ($key !== null) {
- unset($this->_allowedOperators[$key]);
- }
-
- return $this;
- }
-
- /**
- * @param string|int $operator
- * @param Closure $renderer
- * @return \Closure
- */
- public function getAllowedOperatorRenderer($operator)
- {
- if (!isset($this->_allowedOperators[$operator])) {
- throw new CoreException\InvalidArgumentException('Inexistent operator');
- }
- return $this->_allowedOperators[$operator];
- }
-
- /**
- * @return array
- */
- public function getAllAllowedOperators()
- {
- return $this->_allowedOperators;
- }
-
- /**
- * @param Condition $condition
- * @return LogicalOperator
- */
- public function addCondition(Condition $condition)
- {
- $this->_conditions[] = $condition;
-
- return $this;
- }
-
- /**
- * @return array
- */
- public function getAllConditions()
- {
- return $this->_conditions;
- }
-
- public function count()
- {
- return count($this->_conditions);
- }
-
- public function current()
- {
- return current($this->_conditions);
- }
-
- public function key()
- {
- return key($this->_conditions);
- }
-
- public function valid()
- {
- return key($this->_conditions) !== false;
- }
-
- public function next()
- {
- next($this->_conditions);
- }
-
- public function rewind()
- {
- reset($this->_conditions);
- }
-
- public function offsetExists($offset)
- {
- return isset($this->_conditions[$offset]);
- }
-
- public function offsetSet($offset, $value)
- {
- if (!is_int($offset)) {
- throw new CoreException\InvalidArgumentException('Offset should be an integer');
- }
- $this->_conditions[$offset] = $value;
- }
-
- public function offsetGet($offset)
- {
- if (!is_int($offset)) {
- throw new CoreException\InvalidArgumentException('Offset should be an integer');
- }
- return $this->_conditions[$offset];
- }
-
- public function offsetUnset($offset)
- {
- if (!is_int($offset)) {
- throw new CoreException\InvalidArgumentException('Offset should be an integer');
- }
- unset($this->_conditions[$offset]);
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/MathOperator.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/MathOperator.php
deleted file mode 100644
index 95fe6a6..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/MathOperator.php
+++ /dev/null
@@ -1,136 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Condition;
-
-use Wootook\Core\Database\Sql\Dml,
- Wootook\Core\Database\Sql\Placeholder;
-
-
-class MathOperator
- extends Condition
-{
- protected $_operator = null;
- protected $_field = null;
- protected $_value = null;
-
- public function __construct(Dml\Dml $query, $field, $operator, $value)
- {
- $this->_query = $query;
- $this->_field = $field;
- $this->_operator = $operator;
- $this->_value = $value;
- }
-
- protected function _render($rawOperator)
- {
- if ($this->_value instanceof Placeholder\Placeholder) {
- return "{$this->getQuery()->quoteIdentifier($this->_field)}{$rawOperator}{$this->_value}";
- }
-
- return "{$this->getQuery()->quoteIdentifier($this->_field)}{$rawOperator}{$this->getQuery()->quote($this->_value)}";
- }
-
- public function render()
- {
- switch ($this->_operator) {
- case Dml\Section\WhereAware::OPERATOR_EQUALS:
- return $this->_render('=');
-
- case Dml\Section\WhereAware::OPERATOR_NOT_EQUALS:
- return $this->_render('!=');
-
- case Dml\Section\WhereAware::OPERATOR_LOWER:
- return $this->_render('<');
-
- case Dml\Section\WhereAware::OPERATOR_GREATER:
- return $this->_render('>');
-
- case Dml\Section\WhereAware::OPERATOR_LOWER_EQUALS:
- return $this->_render('<=');
-
- case Dml\Section\WhereAware::OPERATOR_GREATER_EQUALS:
- return $this->_render('>=');
- }
-
- return '';
- }
-
- public function reset()
- {
- $this->_operator = null;
- $this->_field = null;
- $this->_value = null;
-
- $this->_clearPlaceholders();
-
- return $this;
- }
-
- public function setOperator($operator)
- {
- $this->_operator = $operator;
-
- return $this;
- }
-
- public function getOperator()
- {
- return $this->_operator;
- }
-
- public function setField($field)
- {
- $this->_field = $field;
-
- return $this;
- }
-
- public function getField()
- {
- return $this->_field;
- }
-
- public function setValue($value)
- {
- if ($value instanceof Placeholder\Placeholder) {
- $this->_addPlaceholder($value);
- }
-
- $this->_value = $value;
-
- return $this;
- }
-
- public function getValue()
- {
- return $this->_value;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/Placeholder.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/Placeholder.php
deleted file mode 100644
index 58d3ea7..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Condition/Placeholder.php
+++ /dev/null
@@ -1,72 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Condition;
-
-use Wootook\Core\Database\Sql\Placeholder as SqlPlaceholder;
-
-class Placeholder
- extends Condition
-{
- protected $_placeholder = null;
-
- public function __construct(SqlPlaceholder\Placeholder $placeholder)
- {
- $this->_placeholder = $placeholder;
-
- $this->_addPlaceholder($placeholder);
- }
-
- public function render()
- {
- return $this->_placeholder->toString();
- }
-
- public function reset()
- {
- $this->_placeholder = null;
-
- $this->_clearPlaceholders();
-
- return $this;
- }
-
- public function setPlaceholder($placeholder)
- {
- $this->_placeholder = $placeholder;
-
- return $this;
- }
-
- public function getPlaceholder()
- {
- return $this->_placeholder;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Dml.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Dml.php
deleted file mode 100644
index 3e2f22c..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Dml.php
+++ /dev/null
@@ -1,63 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml;
-
-use Wootook\Core\Database\Adapter,
- Wootook\Core\Database\Sql\Placeholder,
- Wootook\Core\Database\Statement;
-
-interface Dml
-{
- function __construct(Adapter\Adapter $connection, $param = null);
-
- function render();
- function toString($part = null);
-
- function reset($part = null);
-
- function quote($data);
- function quoteIdentifier($identifier);
-
- function setConnection(Adapter\Adapter $connection);
- function getConnection();
-
- function beforePrepare(Statement\Statement $statement);
- function afterPrepare(Statement\Statement $statement);
-
- function beforeExecute(Statement\Statement $statement);
- function afterExecute(Statement\Statement $statement);
-
- function getPart($part);
- function setPart($part, $value);
- function getAllParts();
-
- function addPlaceholder(Placeholder\Placeholder $placeholder);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/DmlQuery.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/DmlQuery.php
deleted file mode 100644
index 146be4d..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/DmlQuery.php
+++ /dev/null
@@ -1,162 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml;
-
-use Wootook\Core\Database\Adapter,
- Wootook\Core\Database\Sql\Placeholder,
- Wootook\Core\Database\Statement;
-
-abstract class DmlQuery
- implements Dml
-{
- protected $_parts = array();
-
- protected $_connection = null;
-
- protected $_placeholders = array();
-
- public function __construct(Adapter\Adapter $connection, $tableName = null)
- {
- $this->setConnection($connection);
-
- $this->reset();
- $this->_init($tableName);
- }
-
- /**
- * @return \Wootook\Core\Database\Adapter\Adapter
- */
- public function getConnection()
- {
- return $this->_connection;
- }
-
- public function setConnection(Adapter\Adapter $connection)
- {
- $this->_connection = $connection;
-
- return $this;
- }
-
- protected function _init($param = null)
- {
- return $this;
- }
-
- public function setPart($part, $value)
- {
- $this->_parts[$part] = $value;
-
- return $this;
- }
-
- public function getPart($part)
- {
- if (isset($this->_parts[$part])) {
- return $this->_parts[$part];
- }
-
- return null;
- }
-
- public function getAllParts()
- {
- return $this->_parts;
- }
-
- public function quote($data)
- {
- return $this->getConnection()->quote($data);
- }
-
- public function quoteIdentifier($identifier)
- {
- return $this->getConnection()->quoteIdentifier($identifier);
- }
-
- public function quoteInto($identifier, $values)
- {
- return $this->getConnection()->quoteInto($identifier, $values);
- }
-
- public function addPlaceholder(Placeholder\Placeholder $placeholder)
- {
- $this->_placeholders[] = $placeholder;
-
- return $this;
- }
-
- public function beforePrepare(Statement\Statement $statement)
- {
- foreach ($this->_placeholders as $placeholder) {
- $placeholder->beforePrepare($statement);
- }
-
- return $this;
- }
-
- public function afterPrepare(Statement\Statement $statement)
- {
- foreach ($this->_placeholders as $placeholder) {
- $placeholder->afterPrepare($statement);
- }
-
- return $this;
- }
-
- public function beforeExecute(Statement\Statement $statement)
- {
- foreach ($this->_placeholders as $placeholder) {
- $placeholder->beforeExecute($statement);
- }
-
- return $this;
- }
-
- public function afterExecute(Statement\Statement $statement)
- {
- foreach ($this->_placeholders as $placeholder) {
- $placeholder->afterExecute($statement);
- }
-
- return $this;
- }
-
- public function prepare()
- {
- return $this->getConnection()->prepare($this);
- }
-
- public function execute(Array $params = null)
- {
- return $this->getConnection()->execute($this, $params);
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Renderer.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Renderer.php
deleted file mode 100644
index c8b6a6d..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Renderer.php
+++ /dev/null
@@ -1,44 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql;
-
-use Wootook\Core\Database\Adapter,
- Wootook\Core\Database\Statement;
-
-interface Renderer
-{
- function __construct(Adapter\Adapter $connection);
-
- function render(Dml $query);
-
- function quote($data);
- function quoteIdentifier($identifier);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Column.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Column.php
deleted file mode 100644
index 2326d56..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Column.php
+++ /dev/null
@@ -1,72 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section;
-
-use Wootook\Core\Database\Sql\Dml,
- Wootook\Core\Database\Sql\Placeholder;
-
-trait Column
-{
- public function column($column = '*', $table = null)
- {
- $parts = $this->getPart(Dml\Section\ColumnAware::COLUMNS);
- if (is_array($column)) {
- foreach ($column as $alias => $field) {
- if (is_int($alias)) {
- $parts[] = array(
- 'table' => $table,
- 'alias' => null,
- 'field' => $field
- );
- } else {
- $parts[] = array(
- 'table' => $table,
- 'alias' => $alias,
- 'field' => $field
- );
- }
- }
- } else {
- if ($column instanceof Placeholder\Placeholder) {
- $this->_placeholders[] = $column;
- }
-
- $parts[] = array(
- 'table' => $table,
- 'alias' => null,
- 'field' => $column
- );
- }
- $this->setPart(Dml\Section\ColumnAware::COLUMNS, $parts);
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/ColumnAware.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/ColumnAware.php
deleted file mode 100644
index a75f0be..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/ColumnAware.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section;
-
-interface ColumnAware
-{
- const COLUMNS = 'COLUMNS';
-
- public function column($column = '*', $table = null);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/From.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/From.php
deleted file mode 100644
index 414c40f..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/From.php
+++ /dev/null
@@ -1,61 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section;
-
-use Wootook\Core\Database\Sql\Dml;
-
-trait From
-{
- public function from($table, $schema = null)
- {
- if (is_array($table)) {
- $alias = key($table);
- $table = current($table);
- } else {
- $alias = null;
- }
-
- $part = $this->getPart(FromAware::FROM);
- if (!is_array($part)) {
- $part = array();
- }
-
- $part[] = array(
- 'table' => $table,
- 'alias' => $alias,
- 'schema' => $schema
- );
-
- $this->setPart(FromAware::FROM, $part);
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/FromAware.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/FromAware.php
deleted file mode 100644
index 1c16e2b..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/FromAware.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section;
-
-interface FromAware
-{
- const FROM = 'FROM';
-
- public function from($table, $schema = null);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Into.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Into.php
deleted file mode 100644
index 7b70980..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Into.php
+++ /dev/null
@@ -1,44 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section;
-
-trait Into
-{
- public function into($table, $schema = null)
- {
- $this->setPart(IntoAware::INTO, array(
- 'table' => $table,
- 'schema' => $schema,
- ));
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/IntoAware.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/IntoAware.php
deleted file mode 100644
index d0c3d7e..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/IntoAware.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section;
-
-interface IntoAware
-{
- const INTO = 'INTO';
-
- public function into($table, $schema = null);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Limit.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Limit.php
deleted file mode 100644
index 54ed5d7..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Limit.php
+++ /dev/null
@@ -1,42 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section;
-
-trait Limit
-{
- public function limit($limit, $offset = null)
- {
- $this->setPart(LimitAware::LIMIT, intval($limit));
- $this->setPart(LimitAware::OFFSET, intval($offset));
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/LimitAware.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/LimitAware.php
deleted file mode 100644
index 586d4be..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/LimitAware.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section;
-
-interface LimitAware
-{
- const LIMIT = 'LIMIT';
- const OFFSET = 'OFFSET';
-
- public function limit($limit, $offset = null);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Column.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Column.php
deleted file mode 100644
index 3920de5..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Column.php
+++ /dev/null
@@ -1,73 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section\Renderer;
-
-use Wootook\Core\Database\Sql\Dml,
- Wootook\Core\Database\Sql\Placeholder;
-
-trait Column
-{
- public function renderColumn(Dml\Dml $query)
- {
- $fields = array();
- $part = $query->getPart(Dml\Section\ColumnAware::COLUMNS);
- foreach ($part as $field) {
- if ($field['field'] instanceof Dml\Dml) {
- if ($field['alias'] !== null) {
- $fields[] = "({$field['field']}) AS {$field['alias']}";
- } else {
- $fields[] = "({$field['field']})";
- }
- } else if ($field['field'] instanceof Placeholder\Placeholder) {
- if ($field['alias'] !== null) {
- $fields[] = "({$field['field']}) AS {$field['alias']}";
- } else {
- $fields[] = "({$field['field']})";
- }
- } else if ($field['alias'] !== null) {
- if ($field['table'] !== null) {
- $fields[] = "{$field['table']}.{$field['field']} AS {$field['alias']}";
- } else {
- $fields[] = "{$field['field']} AS {$field['alias']}";
- }
- } else if ($field['table'] !== null) {
- $fields[] = "{$field['table']}.{$field['field']}";
- } else {
- $fields[] = "{$field['field']}";
- }
- }
-
- if (!empty($fields)) {
- return implode(", ", $fields);
- }
- return '*';
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/ColumnAware.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/ColumnAware.php
deleted file mode 100644
index dfaf4c2..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/ColumnAware.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section\Renderer;
-
-use Wootook\Core\Database\Sql\Dml;
-
-interface ColumnAware
-{
- public function renderColumn(Dml\Dml $query);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/From.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/From.php
deleted file mode 100644
index a57f6a1..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/From.php
+++ /dev/null
@@ -1,68 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section\Renderer;
-
-use Wootook\Core\Database\Sql\Dml;
-
-trait From
-{
- public function renderFrom(Dml\Dml $query)
- {
- $part = $query->getPart(Dml\Section\FromAware::FROM);
-
- if (!is_array($part)) {
- return '';
- }
-
- $tables = array();
- foreach ($part as $table) {
- if ($table['table'] instanceof Dml\Dml) {
- if ($table['alias'] !== null) {
- $tables[] = "({$table['table']}) AS {$query->quoteIdentifier($table['alias'])}";
- } else {
- $tables[] = "({$table['table']})";
- }
- } else if ($table['alias'] !== null) {
- if ($table['schema'] !== null) {
- $tables[] = "{$query->quoteIdentifier($table['schema'])}.{$query->quoteIdentifier($table['table'])} AS {$query->quoteIdentifier($table['alias'])}";
- } else {
- $tables[] = "{$query->quoteIdentifier($table['table'])} AS {$query->quoteIdentifier($table['alias'])}";
- }
- } else if ($table['schema'] !== null) {
- $tables[] = "{$query->quoteIdentifier($table['schema'])}.{$query->quoteIdentifier($table['table'])}";
- } else {
- $tables[] = "{$query->quoteIdentifier($table['table'])}";
- }
- }
-
- return " FROM " . implode(', ', $tables);
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/FromAware.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/FromAware.php
deleted file mode 100644
index 52e6ab6..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/FromAware.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section\Renderer;
-
-use Wootook\Core\Database\Sql\Dml;
-
-interface FromAware
-{
- public function renderFrom(Dml\Dml $query);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Into.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Into.php
deleted file mode 100644
index f5d6cfb..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Into.php
+++ /dev/null
@@ -1,48 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section\Renderer;
-
-use Wootook\Core\Database\Sql\Dml;
-
-trait Into
-{
- public function renderInto(Dml\Dml $query)
- {
- $part = $query->getPart(Dml\Section\IntoAware::INTO);
-
-
- if ($part['schema'] !== null) {
- return "{$query->quoteIdentifier($part['schema'])}.{$query->quoteIdentifier($part['table'])}";
- }
-
- return "{$query->quoteIdentifier($part['table'])}";
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/IntoAware.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/IntoAware.php
deleted file mode 100644
index 05be8b2..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/IntoAware.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section\Renderer;
-
-use Wootook\Core\Database\Sql\Dml;
-
-interface IntoAware
-{
- public function renderLimit(Dml\Dml $query);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Limit.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Limit.php
deleted file mode 100644
index 4b7efdd..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Limit.php
+++ /dev/null
@@ -1,47 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section\Renderer;
-
-use Wootook\Core\Database\Sql\Dml;
-
-trait Limit
-{
- public function renderLimit(Dml\Dml $query)
- {
- if (!($limit = $query->getPart(Dml\Section\LimitAware::LIMIT))) {
- return '';
- }
- if (!($offset = $query->getPart(Dml\Section\LimitAware::OFFSET))) {
- return sprintf(" LIMIT %d", $limit);
- }
- return sprintf(" LIMIT %d,%d", $limit, $offset);
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/LimitAware.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/LimitAware.php
deleted file mode 100644
index b4a4c8d..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/LimitAware.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section\Renderer;
-
-use Wootook\Core\Database\Sql\Dml;
-
-interface LimitAware
-{
- public function renderLimit(Dml\Dml $query);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Set.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Set.php
deleted file mode 100644
index cc14251..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/Set.php
+++ /dev/null
@@ -1,60 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section\Renderer;
-
-use Wootook\Core\Database\Sql\Dml,
- Wootook\Core\Database\Sql\Placeholder;
-
-trait Set
-{
- public function renderSet(Dml\Dml $query)
- {
- $fields = array();
- $parts = $query->getPart(Dml\Section\SetAware::SET);
- if (is_array($parts)) {
- foreach ($parts as $field) {
- if ($field['value'] instanceof Placeholder\Placeholder) {
- $fields[] = "{$query->quoteIdentifier($field['field'])}={$field['value']->toString()}";
- } else if ($field['value'] === null) {
- $fields[] = "{$query->quoteIdentifier($field['field'])}=NULL";
- } else {
- $fields[] = "{$query->quoteIdentifier($field['field'])}={$query->quote($field['value'])}";
- }
- }
- }
-
- if (!empty($fields)) {
- return ' SET ' . implode(', ', $fields);
- }
-
- return '';
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/SetAware.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/SetAware.php
deleted file mode 100644
index f072e75..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/SetAware.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section\Renderer;
-
-use Wootook\Core\Database\Sql\Dml;
-
-interface SetAware
-{
- public function renderSet(Dml\Dml $query);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/WhereAware.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/WhereAware.php
deleted file mode 100644
index 063a748..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Renderer/WhereAware.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section\Renderer;
-
-use Wootook\Core\Database\Sql\Dml;
-
-interface WhereAware
-{
- public function renderWhere(Dml\Dml $query);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Set.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Set.php
deleted file mode 100644
index 14d75c9..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Set.php
+++ /dev/null
@@ -1,63 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section;
-
-use Wootook\Core\Database\Sql\Placeholder;
-
-trait Set
-{
- public function set($column, $value = null)
- {
- if (!is_array($column)) {
- $column = array($column => $value);
- }
-
- $parts = $this->getPart(SetAware::SET);
- if (!is_array($parts)) {
- $parts = array();
- }
-
- foreach ($column as $field => $value) {
- if ($value instanceof Placeholder\Placeholder) {
- $this->addPlaceholder($value);
- }
-
- $parts[] = array(
- 'value' => $value,
- 'field' => $field
- );
- }
-
- $this->setPart(SetAware::SET, $parts);
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/SetAware.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/SetAware.php
deleted file mode 100644
index 28c4996..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/SetAware.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section;
-
-interface SetAware
-{
- const SET = 'SET';
-
- public function set($column, $value = null);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Where.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Where.php
deleted file mode 100644
index f3bebbb..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/Where.php
+++ /dev/null
@@ -1,204 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section;
-
-use Wootook\Core,
- Wootook\Core\Database\Adapter,
- Wootook\Core\Database\Statement,
- Wootook\Core\Database\Sql\Placeholder;
-
-trait Where
-{
- public function where($condition, $value = null)
- {
- if ($condition instanceof Placeholder\Placeholder) {
- $this->_placeholders[] = $condition;
- $this->_parts[WhereAware::WHERE][] = $condition;
- } else if (is_array($value)) {
- $where = $this->_translateSqlWhere($condition, 'or', $value);
- if ($where !== null) {
- $this->_parts[WhereAware::WHERE][] = $where;
- }
- } else if ($value instanceof Placeholder\Placeholder) {
- $this->_parts[WhereAware::WHERE][] = "{$this->getConnection()->quoteIdentifier($condition)}=" . $value;
- } else {
- $this->_parts[WhereAware::WHERE][] = $this->getConnection()->quoteInto("{$this->getConnection()->quoteIdentifier($condition)}=?", $value);
- }
-
- return $this;
- }
-
- public function renderWhere()
- {
- if (count($this->_parts[self::WHERE]) <= 0) {
- return '';
- }
-
- return " WHERE (" . implode(")\n AND (", $this->_parts[self::WHERE]) . ')';
- }
-
- protected function _translateSqlWhere($field, $operator, $value)
- {
- if ($value === null) {
- return null;
- }
- $operator = strtoupper($operator);
- $adapter = $this->getConnection();
-
- $basicBinayOperatorList = array(
- WhereAware::OPERATOR_EQUALS => '=',
- WhereAware::OPERATOR_NOT_EQUALS => '!=',
- WhereAware::OPERATOR_LOWER => '<',
- WhereAware::OPERATOR_GREATER => '>',
- WhereAware::OPERATOR_LOWER_EQUALS => '<=',
- WhereAware::OPERATOR_GREATER_EQUALS => '>='
- );
-
- if (in_array($operator, $basicBinayOperatorList)) {
- if ($value === true) {
- return "{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}TRUE";
- } else if ($value === false) {
- return "{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}FALSE";
- } else if (is_numeric($value)) {
- return sprintf("{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}%d", $value);
- } else if ($value instanceof Placeholder\Placeholder) {
- $this->_placeholders[] = $value;
- return sprintf("{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}%s", $adapter->quote($value->toString()));
- } else {
- return sprintf("{$adapter->quoteIdentifier($field)}{$basicBinayOperatorList[$operator]}%s", $adapter->quote($value));
- }
- }
-
- switch ($operator) {
- case WhereAware::OPERATOR_IS_NULL:
- if ($value == false) {
- return "{$adapter->quoteIdentifier($field)} IS NOT NULL";
- } else {
- return "{$adapter->quoteIdentifier($field)} IS NULL";
- }
- break;
-
- case WhereAware::OPERATOR_AND:
- case WhereAware::OPERATOR_OR:
- case WhereAware::OPERATOR_XOR:
- $where = array();
- foreach ($value as $valueItem) {
- $subOperator = key($valueItem);
- $realValue = current($valueItem);
-
- if (is_array($realValue) && isset($realValue['field'])) {
- if (!isset($realValue['value'])) {
- continue;
- }
-
- $realField = $realValue['field'];
- $realValue = $realValue['value'];
- } else {
- $realField = $field;
- }
-
- if ($realValue === null) {
- continue;
- }
- $actualValue = $this->_translateSqlWhere($realField, $subOperator, $realValue);
- if ($actualValue !== null) {
- $where[] = $actualValue;
- }
- }
-
- if (count($where)) {
- return '((' . implode(') ' . strtoupper($operator) . ' (', $where) . '))';
- }
- break;
-
- case WhereAware::OPERATOR_IN:
- $valueList = array();
- foreach ($value as $setValue) {
- $valueList[] = $adapter->quote($setValue);
- }
- $implodedList = implode(',', $valueList);
- return "{$adapter->quoteIdentifier($field)} IN({$implodedList})";
- break;
-
- case WhereAware::OPERATOR_NOT_IN:
- $valueList = array();
- foreach ($value as $setValue) {
- $valueList[] = $adapter->quote($setValue);
- }
- $implodedList = implode(',', $valueList);
- return "{$adapter->quoteIdentifier($field)} NOT IN({$implodedList})";
- break;
-
- case WhereAware::OPERATOR_FIND_IN_SET:
- if (is_array($value)) {
- $subField = current($value);
- $subOperator = key($value);
-
- if (in_array($subOperator, $basicBinayOperatorList)) {
- return "FIND_IN_SET({$adapter->quote($value)}, {$adapter->quoteIdentifier($field)}){$basicBinayOperatorList[$operator]}{$adapter->quoteIdentifier($subField)}";
- }
- } else {
- return "0 < FIND_IN_SET({$adapter->quote($value)}, {$adapter->quoteIdentifier($field)})";
- }
- break;
-
- case WhereAware::OPERATOR_NOT_FIND_IN_SET:
- return "0 = FIND_IN_SET({$adapter->quote($value)}, {$adapter->quoteIdentifier($field)})";
- break;
-
- case WhereAware::OPERATOR_DATE:
- $dateValues = array();
- if (isset($value['from'])) {
- if ($value['from'] instanceof Core\DateTime) {
- $dateValues['from'] = "{$adapter->quoteIdentifier($field)} >= {$adapter->quote($this->getConnection()->getDataMapper()->load('DateTime')->encode($value['from']))}";
- } else if (is_string($value['from'])) {
- $dateValues['from'] = "{$adapter->quoteIdentifier($field)} >= {$adapter->quote($value['from'])}";
- } else if (is_numeric($value['from'])) {
- $dateValues['from'] = "UNIX_TIMESTAMP({$adapter->quoteIdentifier($field)}) >= {$adapter->quote($value['from'])}";
- }
- }
- if (isset($value['to'])) {
- if ($value['to'] instanceof Core\DateTime) {
- $dateValues['to'] = "{$adapter->quoteIdentifier($field)} <= {$adapter->quote($this->getConnection()->getDataMapper()->load('DateTime')->encode($value['to']))}";
- } else if (is_string($value['to'])) {
- $dateValues['to'] = "{$adapter->quoteIdentifier($field)} <= {$adapter->quote($value['to'])}";
- } else if (is_numeric($value['to'])) {
- $dateValues['to'] = "UNIX_TIMESTAMP({$adapter->quoteIdentifier($field)}) <= {$adapter->quote($value['to'])}";
- }
- }
-
- return '(' . implode(' AND ', $dateValues) . ')';
- break;
- }
-
- return null;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/WhereAware.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/WhereAware.php
deleted file mode 100644
index a45b415..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Dml/Section/WhereAware.php
+++ /dev/null
@@ -1,58 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Dml\Section;
-
-interface WhereAware
-{
- const WHERE = 'WHERE';
-
- const OPERATOR_NOT = 'NOT';
- const OPERATOR_AND = 'AND';
- const OPERATOR_OR = 'OR';
- const OPERATOR_XOR = 'XOR';
- const OPERATOR_NAND = 'NAND';
- const OPERATOR_NOR = 'NOR';
- const OPERATOR_NXOR = 'NXOR';
- const OPERATOR_EQUALS = 'EQ';
- const OPERATOR_NOT_EQUALS = 'NEQ';
- const OPERATOR_LOWER = 'LT';
- const OPERATOR_GREATER = 'GT';
- const OPERATOR_LOWER_EQUALS = 'LTEQ';
- const OPERATOR_GREATER_EQUALS = 'GTEQ';
- const OPERATOR_IS_NULL = 'NULL';
- const OPERATOR_IN = 'IN';
- const OPERATOR_NOT_IN = 'NIN';
- const OPERATOR_FIND_IN_SET = 'FINSET';
- const OPERATOR_NOT_FIND_IN_SET = 'NFINSET';
- const OPERATOR_DATE = 'DATE';
-
- public function where($condition, $value = null);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Placeholder/Expression.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Placeholder/Expression.php
deleted file mode 100644
index 796fc9f..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Placeholder/Expression.php
+++ /dev/null
@@ -1,62 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Placeholder;
-
-use Wootook\Core\Database\Statement;
-
-class Expression
- extends Placeholder
-{
- protected $_expression = null;
- protected $_params = array();
-
- public function __construct($expression, Array $params = array())
- {
- $this->_expression = (string) $expression;
- $this->_params = $params;
- }
-
- public function __toString()
- {
- return $this->_expression;
- }
-
- public function beforeExecute(Statement\Statement $statement)
- {
- parent::beforeExecute($statement);
-
- foreach ($this->_params as $paramName => $value) {
- $statement->bindValue($paramName, $value, $statement->getParamType($value));
- }
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Placeholder/Param.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Placeholder/Param.php
deleted file mode 100644
index 18155c0..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Placeholder/Param.php
+++ /dev/null
@@ -1,63 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Placeholder;
-
-use Wootook\Core\Database\Statement;
-
-class Param
- extends Placeholder
-{
- protected $_paramType = null;
- protected $_paramName = null;
- protected $_value = null;
-
- public function __construct($paramName, $value, $type = null)
- {
- $this->_paramName = $paramName;
- $this->_paramType = $type;
- $this->_value = $value;
- }
-
- public function __toString()
- {
- return ':' . $this->_paramName;
- }
-
- public function beforeExecute(Statement\Statement $statement)
- {
- parent::beforeExecute($statement);
-
- $type = $this->_paramType !== null ? $this->_paramType : $statement->getParamType($this->_value);
- $statement->bindValue($this->_paramName, $this->_value, $type);
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Placeholder/Placeholder.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Placeholder/Placeholder.php
deleted file mode 100644
index 188cd03..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Placeholder/Placeholder.php
+++ /dev/null
@@ -1,63 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Placeholder;
-
-use Wootook\Core\Database\Statement;
-
-abstract class Placeholder
-{
- public function toString()
- {
- return $this->__toString();
- }
-
- abstract public function __toString();
-
- public function beforePrepare(Statement\Statement $statement)
- {
- return $this;
- }
-
- public function afterPrepare(Statement\Statement $statement)
- {
- return $this;
- }
-
- public function beforeExecute(Statement\Statement $statement)
- {
- return $this;
- }
-
- public function afterExecute(Statement\Statement $statement)
- {
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Placeholder/Variable.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Placeholder/Variable.php
deleted file mode 100644
index ef1bfdc..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/Placeholder/Variable.php
+++ /dev/null
@@ -1,52 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Sql\Placeholder;
-
-use Wootook\Core\Database\Statement;
-
-class Variable
- extends Placeholder
-{
- protected $_paramType = null;
- protected $_paramName = null;
- protected $_value = null;
-
- public function __construct($paramName, $type = null)
- {
- $this->_paramName = $paramName;
- $this->_paramType = $type;
- }
-
- public function __toString()
- {
- return ':' . $this->_paramName;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/QueryBuilder/QueryBuilder.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/QueryBuilder/QueryBuilder.php
deleted file mode 100644
index dbda08e..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Sql/QueryBuilder/QueryBuilder.php
+++ /dev/null
@@ -1,8 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Statement;
-
-use Wootook\Core\Database,
- Wootook\Core\Database\Adapter,
- Wootook\Core\Database\Sql,
- Wootook\Core\Exception as CoreException;
-
-class Mysql
- extends Statement
-{
- /**
- * @var \mysqli_stmt
- */
- protected $_handler = null;
-
- /**
- * @var string|Sql\Dml
- */
- protected $_query = null;
-
- protected function _init($query)
- {
- $this->_query = $query;
-
- if ($this->_query instanceof Sql\Dml) {
- $this->_query->beforePrepare($this);
- }
-
- try {
- $this->_handler = $this->_adapter->getDriverHandler()->stmt_init();
-
- if (!$this->_handler->prepare($this->_query)) {
- throw new CoreException\Database\StatementError($this, $this->_handler->error, $this->_handler->errno);
- }
- } catch (\mysqli_sql_exception $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
-
- if ($this->_query instanceof Sql\Dml) {
- $this->_query->afterPrepare($this);
- }
-
- $this->dispatchEvent(self::EVENT_INIT);
-
- return $this;
- }
-
- /**
- *
- * @param string|int $column
- * @param mixed $param
- * @param int $type
- * @return Statement
- */
- public function bindColumn($column, &$param, $type = null)
- {
- try {
- return $this->_handler->bindColumn($column, $param, $type);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), null, $e);
- }
- }
-
- /**
- *
- * @param string|int $parameter
- * @param mixed $variable
- * @param int $type
- * @param int $length
- * @param unknown_type $options
- * @return Statement
- */
- public function bindParam($parameter, &$variable, $type = null, $length = null, $options = null)
- {
- try {
- return $this->_handler->bindParam($parameter, $variable, $type, $length, $options);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- *
- * @param string|int $parameter
- * @param mixed $value
- * @param int $type
- * @return Statement\Statement
- */
- public function bindValue($parameter, $value, $type = null)
- {
- try {
- return $this->_handler->bindValue($parameter, $value, $type);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- *
- * @param array $params
- * @return bool
- */
- public function execute(Array $params = null, $asynchronous = false)
- {
- if ($this->_query instanceof Sql\Dml) {
- $this->_query->beforeExecute($this);
- }
-
- try {
- foreach ($params as $paramKey => $paramValue) {
- $this->_handler->bind_param('', $paramValue);
- }
- $result = $this->_handler->execute($params);
- } catch (\mysqli_sql_exception $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
-
- if ($this->_query instanceof Sql\Dml) {
- $this->_query->afterExecute($this);
- }
-
- $this->dispatchEvent(self::EVENT_READY, array(
- 'result' => $result
- ));
-
- return $result;
- }
-
- /**
- *
- * @param int $style
- * @param int $col
- * @return mixed
- */
- public function fetchAll($style = null, $col = null)
- {
- try {
- if ($style !== null) {
- if ($col !== null) {
- $result = $this->_handler->fetchAll($style, $col);
- } else {
- $result = $this->_handler->fetchAll($style);
- }
- } else {
- $result = $this->_handler->fetchAll($style);
- }
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
-
- $this->dispatchEvent(self::EVENT_FETCH_ALL, array(
- 'result' => $result
- ));
-
- return $result;
- }
-
- /**
- *
- * @param int $col
- * @return mixed
- */
- public function fetchColumn($col = 0)
- {
- try {
- $result = $this->_handler->fetchColumn($col);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
-
- $this->dispatchEvent(self::EVENT_FETCH_COL, array(
- 'result' => $result
- ));
-
- return $result;
- }
-
- /**
- *
- * @return Database\Adapter\Adapter
- */
- public function getAdapter()
- {
- return $this->_adapter;
- }
-
- /**
- *
- * @param string $key
- */
- public function getAttribute($key)
- {
- try {
- return $this->_handler->getAttribute($key);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- *
- * @param string $key
- * @param mixed $value
- * @return Statement\Statement
- */
- public function setAttribute($key, $value)
- {
- try {
- return $this->_handler->setAttribute($key, $value);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * @param unknown_type $mode
- * @return Statement\Statement
- */
- public function setFetchMode($mode)
- {
- try {
- $params = func_get_args();
- return call_user_func_array(array($this->_handler, 'setFetchMode'), $params);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * @return int
- */
- public function columnCount()
- {
- try {
- return $this->_handler->columnCount();
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * @return int
- */
- public function rowCount()
- {
- try {
- return $this->_handler->rowCount();
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * @param int $col
- * @return mixed
- */
- public function fetch($style = null, $orientation = Database\ConnectionManager::FETCH_ORI_NEXT, $cursorOffset = 0)
- {
- try {
- $result = $this->_handler->fetch($style, $orientation, $cursorOffset);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
-
- $this->dispatchEvent(self::EVENT_FETCH, array(
- 'result' => $result,
- 'style' => $style,
- 'orientation' => $orientation,
- 'offset' => $cursorOffset
- ));
-
- return $result;
- }
-
- /**
- * @param string $class
- * @param array $config
- * @return Wootook\Core\BaseBaseObject
- */
- public function fetchObject($class = 'Wootook\\Core\\BaseBaseObject', Array $constructorArgs = array())
- {
- try {
- array_unshift($constructorArgs, $this->app());
-
- $result = $this->_handler->fetchObject($class, $constructorArgs);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
-
- $this->dispatchEvent(self::EVENT_FETCH, array(
- 'result' => $result,
- 'style' => Database\ConnectionManager::FETCH_OBJ,
- 'orientation' => Database\ConnectionManager::FETCH_ORI_NEXT,
- 'offset' => 0
- ));
-
- return $result;
- }
-
- /**
- * @return bool
- */
- public function closeCursor()
- {
- try {
- return $this->_handler->closeCursor();
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * @return bool
- */
- public function nextRowset()
- {
- try {
- return $this->_handler->nextRowset();
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * @return string
- */
- public function errorCode()
- {
- return $this->_handler->errorCode();
- }
-
- /**
- * @return array
- */
- public function errorInfo()
- {
- return $this->_handler->errorInfo();
- }
-
- /**
- * @return string
- */
- public function errorMessage()
- {
- $info = $this->_handler->errorInfo();
-
- return $info[2];
- }
-
- /**
- * @return string
- */
- public function errorState()
- {
- $info = $this->_handler->errorInfo();
-
- return $info[0];
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Statement/Pdo.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Statement/Pdo.php
deleted file mode 100644
index 492c409..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Statement/Pdo.php
+++ /dev/null
@@ -1,387 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Statement;
-
-use Wootook\Core\Database,
- Wootook\Core\Database\Adapter,
- Wootook\Core\Database\Statement,
- Wootook\Core\Database\Sql,
- Wootook\Core\Exception as CoreException;
-
-class Pdo
- extends Statement
-{
- /**
- * @var \PDOStatement
- */
- protected $_handler = null;
-
- /**
- * @var string|Sql\Dml
- */
- protected $_query = null;
-
- protected function _init($query)
- {
- $this->_query = $query;
-
- if ($this->_query instanceof Sql\Dml) {
- $this->_query->beforePrepare($this);
- }
-
- try {
- $this->_handler = $this->_adapter->getDriverHandler()->prepare($this->_query);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), null, $e);
- }
-
- if ($this->_query instanceof Sql\Dml) {
- $this->_query->afterPrepare($this);
- }
-
- $this->dispatchEvent(self::EVENT_INIT);
-
- return $this;
- }
-
- /**
- *
- * @param string|int $column
- * @param mixed $param
- * @param int $type
- * @return Statement\Statement
- */
- public function bindColumn($column, &$param, $type = null)
- {
- try {
- return $this->_handler->bindColumn($column, $param, $type);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), null, $e);
- }
- }
-
- /**
- *
- * @param string|int $parameter
- * @param mixed $variable
- * @param int $type
- * @param int $length
- * @param unknown_type $options
- * @return Statement\Statement
- */
- public function bindParam($parameter, &$variable, $type = null, $length = null, $options = null)
- {
- try {
- return $this->_handler->bindParam($parameter, $variable, $type, $length, $options);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- *
- * @param string|int $parameter
- * @param mixed $value
- * @param int $type
- * @return Statement\Statement
- */
- public function bindValue($parameter, $value, $type = null)
- {
- try {
- return $this->_handler->bindValue($parameter, $value, $type);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- *
- * @param array $params
- * @return bool
- */
- public function execute(Array $params = null, $asynchronous = false)
- {
- if ($this->_query instanceof Sql\Dml) {
- $this->_query->beforeExecute($this);
- }
-
- if ($asynchronous === true) {
- throw new CoreException\Database\StatementError($this, 'Asynchronous calls are not available with this driver.');
- }
-
- try {
- $result = $this->_handler->execute($params);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
-
- if ($this->_query instanceof Sql\Dml) {
- $this->_query->afterExecute($this);
- }
-
- $this->dispatchEvent(self::EVENT_READY, array(
- 'result' => $result
- ));
-
- return $result;
- }
-
- /**
- *
- * @param int $style
- * @param int $col
- * @return mixed
- */
- public function fetchAll($style = null, $col = null)
- {
- try {
- if ($style !== null) {
- if ($col !== null) {
- $result = $this->_handler->fetchAll($style, $col);
- } else {
- $result = $this->_handler->fetchAll($style);
- }
- } else {
- $result = $this->_handler->fetchAll($style);
- }
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
-
- $this->dispatchEvent(self::EVENT_FETCH_ALL, array(
- 'result' => $result
- ));
-
- return $result;
- }
-
- /**
- *
- * @param int $col
- * @return mixed
- */
- public function fetchColumn($col = 0)
- {
- try {
- $result = $this->_handler->fetchColumn($col);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
-
- $this->dispatchEvent(self::EVENT_FETCH_COL, array(
- 'result' => $result
- ));
-
- return $result;
- }
-
- /**
- *
- * @return Database\Adapter\Adapter
- */
- public function getAdapter()
- {
- return $this->_adapter;
- }
-
- /**
- *
- * @param string $key
- */
- public function getAttribute($key)
- {
- try {
- return $this->_handler->getAttribute($key);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- *
- * @param string $key
- * @param mixed $value
- * @return Statement\Statement
- */
- public function setAttribute($key, $value)
- {
- try {
- return $this->_handler->setAttribute($key, $value);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * @param unknown_type $mode
- * @return Statement\Statement
- */
- public function setFetchMode($mode)
- {
- try {
- $params = func_get_args();
- return call_user_func_array(array($this->_handler, 'setFetchMode'), $params);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * @return int
- */
- public function columnCount()
- {
- try {
- return $this->_handler->columnCount();
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * @return int
- */
- public function rowCount()
- {
- try {
- return $this->_handler->rowCount();
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * @param int $col
- * @return mixed
- */
- public function fetch($style = null, $orientation = Database\ConnectionManager::FETCH_ORI_NEXT, $cursorOffset = 0)
- {
- try {
- $result = $this->_handler->fetch($style, $orientation, $cursorOffset);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
-
- $this->dispatchEvent(self::EVENT_FETCH, array(
- 'result' => $result,
- 'style' => $style,
- 'orientation' => $orientation,
- 'offset' => $cursorOffset
- ));
-
- return $result;
- }
-
- /**
- * @param string $class
- * @param array $config
- * @return Wootook\Core\BaseBaseObject
- */
- public function fetchObject($class = 'Wootook\\Core\\BaseBaseObject', Array $constructorArgs = array())
- {
- try {
- array_unshift($constructorArgs, $this->app());
-
- $result = $this->_handler->fetchObject($class, $constructorArgs);
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
-
- $this->dispatchEvent(self::EVENT_FETCH, array(
- 'result' => $result,
- 'style' => Database\ConnectionManager::FETCH_OBJ,
- 'orientation' => Database\ConnectionManager::FETCH_ORI_NEXT,
- 'offset' => 0
- ));
-
- return $result;
- }
-
- /**
- * @return bool
- */
- public function closeCursor()
- {
- try {
- return $this->_handler->closeCursor();
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * @return bool
- */
- public function nextRowset()
- {
- try {
- return $this->_handler->nextRowset();
- } catch (\PDOException $e) {
- throw new CoreException\Database\StatementError($this, $e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * @return string
- */
- public function errorCode()
- {
- return $this->_handler->errorCode();
- }
-
- /**
- * @return array
- */
- public function errorInfo()
- {
- return $this->_handler->errorInfo();
- }
-
- /**
- * @return string
- */
- public function errorMessage()
- {
- $info = $this->_handler->errorInfo();
-
- return $info[2];
- }
-
- /**
- * @return string
- */
- public function errorState()
- {
- $info = $this->_handler->errorInfo();
-
- return $info[0];
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Database/Statement/Statement.php b/src/application/modules/WootookCore/src/Wootook/Core/Database/Statement/Statement.php
deleted file mode 100644
index 150901e..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Database/Statement/Statement.php
+++ /dev/null
@@ -1,275 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Database\Statement;
-
-use Wootook\Core\Database,
- Wootook\Core\Database\Adapter,
- Wootook\Core\Event,
- Wootook\Core\Exception as CoreException;
-
-abstract class Statement
- implements \Iterator
-{
- use Event\EventTarget;
-
- const EVENT_INIT = 'init';
- const EVENT_READY = 'ready';
- const EVENT_ERROR = 'error';
- const EVENT_FETCH = 'fetch';
- const EVENT_FETCH_ALL = 'fetch-all';
- const EVENT_FETCH_COL = 'fetch-column';
-
- protected $_adapter = null;
-
- protected $_currentIndex = 0;
- protected $_currentRow = null;
-
- protected $_asynchronousCallbacks = array();
-
- public function __construct(Adapter\Adapter $adapter, $sql)
- {
- $this->_adapter = $adapter;
-
- $this->_init($sql);
- }
-
- abstract protected function _init($sql);
-
- /**
- *
- * @param string|int $column
- * @param mixed $param
- * @param int $type
- * @return Statement
- */
- abstract public function bindColumn($column, &$param, $type = null);
-
- /**
- *
- * @param string|int $parameter
- * @param mixed $variable
- * @param int $type
- * @param int $length
- * @param unknown_type $options
- * @return Statement
- */
- abstract public function bindParam($parameter, &$variable, $type = null, $length = null, $options = null);
-
- /**
- *
- * @param string|int $parameter
- * @param mixed $value
- * @param int $type
- * @return Statement
- */
- abstract public function bindValue($parameter, $value, $type = null);
-
- /**
- * @abstract
- * @param array|null $params
- * @param bool $synchronous
- * @return bool
- */
- abstract public function execute(Array $params = null, $synchronous = false);
-
- /**
- * @abstract
- * @param null $style
- * @param int $orientation
- * @param int $cursorOffset
- * @return mixed
- */
- abstract public function fetch($style = null, $orientation = Database\ConnectionManager::FETCH_ORI_NEXT, $cursorOffset = 0);
-
- /**
- * @param int $style
- * @param int $col
- * @return mixed
- */
- abstract public function fetchAll($style = null, $col = null);
-
- /**
- * @param int $col
- * @return mixed
- */
- abstract public function fetchColumn($col = 0);
-
- /**
- *
- * @param string $class
- * @param array $config
- * @return \Wootook\Core\Base\BaseObject
- */
- abstract public function fetchObject($class = 'Wootook\\Core\\Base\\BaseObject', Array $constructorArgs = array());
-
- /**
- *
- * @param string $class
- * @param array $config
- * @return \Wootook\Core\Mvc\Model\Entity
- */
- public function fetchEntity($class = 'Wootook\\Core\\Mvc\\Model\\Entity', Array $constructorArgs = array())
- {
- $reflection = new ReflectionClass($class);
- $object = $reflection->newInstanceArgs($constructorArgs);
-
- if (!$object instanceof Wootook\Core\Mvc\Model\Entity) {
- throw new CoreException\Database\StatementError($this, 'Destination object should be a Wootook\\Core\\Mvc\\Model\\Entity instance.');
- }
-
- $data = $this->fetch(Database\ConnectionManager::FETCH_ASSOC);
- $object->getDataMapper()->decode($object, $data);
-
- return $object;
- }
-
- /**
- *
- * @return \Wootook\Core\Database\Adapter\Adapter
- */
- abstract public function getAdapter();
-
- /**
- * @param mixed $key
- */
- abstract public function getAttribute($key);
-
- /**
- * @param string $key
- * @param mixed $value
- * @return Statement
- */
- abstract public function setAttribute($key, $value);
-
- /**
- * @param int $mode
- * @return Statement
- */
- abstract public function setFetchMode($mode);
-
- /**
- * @return int
- */
- abstract public function columnCount();
-
- /**
- * @return string
- */
- abstract public function errorCode();
-
- /**
- * @return string
- */
- abstract public function errorMessage();
-
- /**
- * @return array
- */
- abstract public function errorInfo();
-
- /**
- * @return string
- */
- abstract public function errorState();
-
- /**
- * @return int
- */
- abstract public function rowCount();
-
- /**
- * @return bool
- */
- abstract public function closeCursor();
-
- /**
- * @return bool
- */
- abstract public function nextRowset();
-
- /**
- * @param mixed $value
- * @return int|null
- */
- public function getParamType($value)
- {
- if (is_numeric($value)) {
- return Database\ConnectionManager::PARAM_INT;
- } else if (is_bool($value)) {
- return Database\ConnectionManager::PARAM_BOOL;
- } else if (is_string($value)) {
- return Database\ConnectionManager::PARAM_STR;
- }
-
- return null;
- }
-
- /**
- * @return null|mixed
- */
- public function current()
- {
- return $this->_currentRow;
- }
-
- /**
- * @return void
- */
- public function next()
- {
- $this->_currentRow = $this->fetch();
- $this->_currentIndex++;
- }
-
- /**
- * @return int
- */
- public function key()
- {
- return $this->_currentIndex;
- }
-
- /**
- * @return int
- */
- public function rewind()
- {
- return $this->_currentIndex;
- }
-
- /**
- * @return bool
- */
- public function valid()
- {
- return $this->_currentIndex < $this->rowCount() && $this->_currentIndex >= 0;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/DateTime/DateInterval.php b/src/application/modules/WootookCore/src/Wootook/Core/DateTime/DateInterval.php
deleted file mode 100644
index 0a9babb..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/DateTime/DateInterval.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\DateTime;
-
-/**
- * Date interval management class
- */
-class DateInterval
- extends \DateInterval
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/DateTime/DatePeriod.php b/src/application/modules/WootookCore/src/Wootook/Core/DateTime/DatePeriod.php
deleted file mode 100644
index 1b2701c..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/DateTime/DatePeriod.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\DateTime;
-
-/**
- * Date period management class
- */
-class DatePeriod
- extends \DatePeriod
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/DateTime/DateTime.php b/src/application/modules/WootookCore/src/Wootook/Core/DateTime/DateTime.php
deleted file mode 100644
index db2d3fe..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/DateTime/DateTime.php
+++ /dev/null
@@ -1,226 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\DateTime;
-
-use Wootook\Core\Exception as CoreException;
-
-/**
- * Date period management class
- */
-class DateTime
- extends \DateTime
-{
- /**
- * @var Formatter
- */
- protected $_formatter = null;
-
- /**
- * @param string|int $dateTime
- * @param null|DateTimeZone $timeZone
- * @param Formatter $formatter
- */
- public function __construct($dateTime = null, DateTimeZone $timeZone = null, Formatter $formatter = null, $useIntlParsing = true)
- {
- if ($formatter === null || $useIntlParsing === false) {
- parent::__construct($dateTime, $timeZone);
- } else {
- parent::__construct();
-
- $this->setTimestamp($formatter->parse($dateTime));
- }
-
- $this->_formatter = $formatter;
- }
-
- /**
- * @param Formatter $formatter
- * @return DateTime
- */
- public function setFormatter(Formatter $formatter)
- {
- $this->_formatter = $formatter;
-
- return $this;
- }
-
- /**
- * @return null|Formatter
- */
- public function getFormatter()
- {
- return $this->_formatter;
- }
-
- /**
- * @param string|int $dateTime
- * @param Formatter $formatter
- * @param null|DateTimeZone $timeZone
- */
- public function set($dateTime, DateTimeZone $timeZone = null, Formatter $formatter)
- {
- if ($formatter === null) {
- $this->setTimestamp(strtotime($dateTime));
- } else {
- $this->setTimestamp($formatter->parse($dateTime));
- }
-
- return $this;
- }
-
- /**
- * @param DateTime $dateTime
- * @return bool
- */
- public function isEarlier(\DateTime $dateTime)
- {
- return $this < $dateTime;
- }
-
- /**
- * @param DateTime $dateTime
- * @return bool
- */
- public function isLater(\DateTime $dateTime)
- {
- return $this > $dateTime;
- }
-
- /**
- * @param DateTime $dateTime
- * @return bool
- */
- public function isToday(\DateTime $today = null)
- {
- if ($today === null) {
- $today = new self(null, $this->getTimezone());
- } else {
- $today = clone $today;
- }
-
- $today->setTime(0, 0, 0);
- if ($this->isEarlier($today)) {
- return false;
- }
-
- $today->setTime(23, 59, 59);
- if ($this->isLater($today)) {
- return false;
- }
-
- return true;
- }
-
- /**
- * @param DateTime $dateTime
- * @return bool
- */
- public function isTomorrow(\DateTime $tomorrow = null)
- {
- if ($tomorrow === null) {
- $tomorrow = new self(null, $this->getTimezone());
- } else {
- $tomorrow = clone $tomorrow;
- }
- $tomorrow->add(new \DateInterval('P1D'));
-
- $tomorrow->setTime(0, 0, 0);
- if ($this->isEarlier($tomorrow)) {
- return false;
- }
-
- $tomorrow->setTime(23, 59, 59);
- if ($this->isLater($tomorrow)) {
- return false;
- }
-
- return true;
- }
-
- /**
- * @param DateTime $dateTime
- * @return bool
- */
- public function isYesterday(\DateTime $yesterday = null)
- {
- if ($yesterday === null) {
- $yesterday = new self(null, $this->getTimezone());
- } else {
- $yesterday = clone $yesterday;
- }
- $yesterday->sub(new \DateInterval('P1D'));
-
- $yesterday->setTime(0, 0, 0);
- if ($this->isEarlier($yesterday)) {
- return false;
- }
-
- $yesterday->setTime(23, 59, 59);
- if ($this->isLater($yesterday)) {
- return false;
- }
-
- return true;
- }
-
- /**
- * @param null|Formatter $formatter
- * @param string $pattern
- * @return string
- */
- public function toString(Formatter $formatter = null, $pattern = null)
- {
- if ($formatter === null) {
- $formatter = $this->_formatter;
- }
-
- if ($formatter === null) {
- return null;
- }
-
- if ($pattern !== null) {
- $formatter = clone $this->_formatter;
- $formatter->setPattern($pattern);
- return $formatter->format($this);
- }
-
- return $this->_formatter->format($this);
- }
-
- /**
- * @param DateTime $dateTime
- * @return bool
- */
- public function __toString()
- {
- return $this->toString();
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/DateTime/DateTimeZone.php b/src/application/modules/WootookCore/src/Wootook/Core/DateTime/DateTimeZone.php
deleted file mode 100644
index 08b2a7c..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/DateTime/DateTimeZone.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\DateTime;
-
-/**
- * Date time zone management class
- */
-class DateTimeZone
- extends \DateTimeZone
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/DateTime/Formatter.php b/src/application/modules/WootookCore/src/Wootook/Core/DateTime/Formatter.php
deleted file mode 100644
index 44b8196..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/DateTime/Formatter.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\DateTime;
-
-/**
- * Date formatter and parser
- */
-class Formatter
-// extends \IntlDateFormatter
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Config/Config.php b/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Config/Config.php
deleted file mode 100644
index 198e1f2..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Config/Config.php
+++ /dev/null
@@ -1,22 +0,0 @@
- $classConfig) {
- $factory->addClassDefinition($className);
-
- if ($classConfig->methods instanceof Node) {
- foreach ($classConfig->methods as $methodName => $methodConfig) {
- //$classDefinition->
- }
- }
- }
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Definition/ArgumentDefinition.php b/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Definition/ArgumentDefinition.php
deleted file mode 100644
index ea033c1..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Definition/ArgumentDefinition.php
+++ /dev/null
@@ -1,137 +0,0 @@
-_methodDefinition = $methodDefinition;
- $this->_argumentName = $argumentName;
-
- $this->setReflector($methodDefinition->getArgumentReflector($argumentName));
-
- if ($registry !== null) {
- $this->setRegistry($registry);
- }
- }
-
- public function setRegistry(DependencyInjection\Registry $registry)
- {
- $this->_registry = $registry;
-
- return $this;
- }
-
- public function getRegistry()
- {
- return $this->_registry;
- }
-
- public function bindValue($argumentValue)
- {
- $this->_value = $argumentValue;
- $this->_type = self::TYPE_VALUE;
-
- return $this;
- }
-
- public function bindVariable(&$argumentVariable)
- {
- $this->_value = &$argumentVariable;
- $this->_type = self::TYPE_VARIABLE;
-
- return $this;
- }
-
- public function bindRegistryEntry($registryKey)
- {
- $this->_value = $registryKey;
- $this->_type = self::TYPE_REGISTRY;
-
- return $this;
- }
-
- public function getType()
- {
- return $this->_type;
- }
-
- public function getValue()
- {
- return $this->_value;
- }
-
- public function getReflector()
- {
- return $this->_reflector;
- }
-
- public function setReflector(\ReflectionParameter $reflector)
- {
- $this->_reflector = $reflector;
-
- return $this;
- }
-
- public function compileInto(Array &$compiledArgs)
- {
- $position = $this->getReflector()->getPosition();
-
- if ($this->_type === self::TYPE_VALUE) {
- $compiledArgs[$position] = $this->_value;
- } else if ($this->_type === self::TYPE_VARIABLE) {
- $compiledArgs[$position] = &$this->_value;
- } else if ($this->_type === self::TYPE_REGISTRY) {
- if (($registry = $this->getRegistry()) === null) {
- throw new CoreException\DependencyInjection\RuntimeException('No registry available');
- }
-
- $compiledArgs[$position] = $registry->get($this->_value);
- }
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Definition/ClassDefinition.php b/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Definition/ClassDefinition.php
deleted file mode 100644
index d72783d..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Definition/ClassDefinition.php
+++ /dev/null
@@ -1,288 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\DependencyInjection\Definition;
-
-use Wootook\Core\Base\Service,
- Wootook\Core\Config,
- Wootook\Core\DependencyInjection,
- Wootook\Core\Exception as CoreException;
-
-/**
- * Class definition for the DependencyInjection component, used to define a
- * class's dependencies.
- *
- * @package WootookCore
- * @subpackage DependencyInjection
- * @author Grégory PLANCHAT
- * @see http://wootook.org/
- */
-class ClassDefinition
-{
- /**
- * @var string
- */
- protected $_className = null;
-
- /**
- * @var \ReflectionClass
- */
- protected $_reflector = null;
-
- /**
- * @var array
- */
- protected $_methodDefinitions = array();
-
- /**
- * @var null|\Wootook\Core\DependencyInjection\Registry
- */
- protected $_registry = null;
-
- /**
- * @var string
- */
- protected $_methodDefinitionClassName = 'Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition';
-
- /**
- * @param string $className
- * @param null|string $methodDefinitionHandlerClass
- */
- public function __construct($className, DependencyInjection\Registry $registry = null, $methodDefinitionClassName = null)
- {
- $this->_className = $className;
- try {
- $this->_reflector = new \ReflectionClass($className);
- } catch (\ReflectionException $e) {
- throw new CoreException\DependencyInjection\BadMethodCallException($e->getMessage(), $e->getCode(), $e);
- }
-
- if ($methodDefinitionClassName !== null) {
- $this->setMethodDefinitionClassName($methodDefinitionClassName);
- }
-
- if ($registry !== null) {
- $this->setRegistry($registry);
- }
- }
-
- /**
- * @param \Wootook\Core\DependencyInjection\Registry $registry
- * @return ClassDefinition
- */
- public function setRegistry(DependencyInjection\Registry $registry)
- {
- $this->_registry = $registry;
-
- return $this;
- }
-
- /**
- * @return null|\Wootook\Core\DependencyInjection\Registry
- */
- public function getRegistry()
- {
- return $this->_registry;
- }
-
- /**
- * @param string $methodName
- * @return \Wootook\Core\DependencyInjection\Definition\MethodDefinition
- * @throws \Wootook\Core\Exception\DependencyInjection\InvalidArgumentException
- */
- public function getMethodDefinition($methodName, $registerInstanceIfNew = false)
- {
- if (!is_string($methodName)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Method names only accept string.');
- }
-
- if (isset($this->_methodDefinitions[$methodName])) {
- return $this->_methodDefinitions[$methodName];
- }
-
- $definition = $this->initMethodDefinition($methodName);
- if ($registerInstanceIfNew === true) {
- $this->registerMethodDefinition($methodName, $definition);
- }
- return $definition;
- }
-
- /**
- * @param string $methodName
- * @return \Wootook\Core\DependencyInjection\Definition\MethodDefinition
- */
- public function initMethodDefinition($methodName)
- {
- if (!is_string($methodName)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Method names only accept string.');
- }
-
- $class = $this->getMethodDefinitionClassName();
-
- return new $class($this, $methodName, $this->getRegistry());
- }
-
- /**
- * @param $methodName
- * @param MethodDefinition $methodDefinition
- * @return ClassDefinition
- * @throws \Wootook\Core\Exception\DependencyInjection\InvalidArgumentException
- */
- public function registerMethodDefinition($methodName, MethodDefinition $methodDefinition)
- {
- if (!is_string($methodName)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Method names only accept string.');
- }
-
- $this->_methodDefinitions[$methodName] = $methodDefinition;
-
- return $this;
- }
-
- /**
- * @param $methodName
- * @return ClassDefinition
- */
- public function addMethodDefinition($methodName)
- {
- $this->registerMethodDefinition($methodName, $this->initMethodDefinition($methodName));
-
- return $this;
- }
-
- /**
- * @param $methodName
- * @param MethodDefinition $definition
- * @return ClassDefinition
- * @throws \Wootook\Core\Exception\DependencyInjection\InvalidArgumentException
- */
- public function setMethodDefinition($methodName, MethodDefinition $definition)
- {
- if (!is_string($methodName)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Method names only accept string.');
- }
-
- $this->_methodDefinitions[$methodName] = $definition;
-
- return $this;
- }
-
- /**
- * @param $methodDefinitionClassName
- * @return string
- * @throws \Wootook\Core\Exception\DependencyInjection\InvalidArgumentException
- */
- public function setMethodDefinitionClassName($methodDefinitionClassName)
- {
- if (!is_string($methodDefinitionClassName)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Class names only accept string.');
- }
-
- $this->_methodDefinitionClassName = $methodDefinitionClassName;
-
- return $this;
- }
-
- /**
- * @return string
- */
- public function getMethodDefinitionClassName()
- {
- return $this->_methodDefinitionClassName;
- }
-
- /**
- * @return array
- */
- public function getAllMethodDefinitions()
- {
- return $this->_methodDefinitions;
- }
-
- /**
- * @param array $args
- * @return object
- * @throws \Wootook\Core\Exception\DependencyInjection\RuntimeException
- */
- public function newInstance(Array $args = array())
- {
- try {
- if ($this->getReflector()->hasMethod('__construct')) {
- $methodDefinition = $this->getMethodDefinition('__construct');
-
- return $this->getReflector()->newInstanceArgs($methodDefinition->compileArgs($args));
- } else {
- return $this->getReflector()->newInstance();
- }
- } catch (\ReflectionException $e) {
- throw new CoreException\DependencyInjection\RuntimeException('Could not instantiate class : constructor may be non-public.', null, $e);
- }
- }
-
- /**
- * @return mixed
- * @throws \Wootook\Core\Exception\DependencyInjection\RuntimeException
- */
- public function newInstanceWithoutConstructor()
- {
- try {
- return $this->getReflector()->newInstanceWithoutConstructor();
- } catch (\ReflectionException $e) {
- throw new CoreException\DependencyInjection\RuntimeException('Could not instantiate class : may be a PHP-internal class.', null, $e);
- }
- }
-
- /**
- * @return array
- */
- public function reset()
- {
- return $this->_methodDefinitions = array();
- }
-
- /**
- * @return null|\ReflectionClass
- */
- public function getReflector()
- {
- return $this->_reflector;
- }
-
- /**
- * @param \ReflectionClass $reflector
- * @return ClassDefinition
- */
- public function setReflector(\ReflectionClass $reflector)
- {
- $this->_reflector = $reflector;
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Definition/MethodDefinition.php b/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Definition/MethodDefinition.php
deleted file mode 100644
index 6e5720e..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Definition/MethodDefinition.php
+++ /dev/null
@@ -1,298 +0,0 @@
-_classDefinition = $classDefinition;
-
- $this->_methodName = $methodName;
-
- try {
- $this->setReflector($classDefinition->getReflector()->getMethod($methodName));
- } catch (\ReflectionException $e) {
- throw new CoreException\DependencyInjection\BadMethodCallException($e->getMessage(), $e->getCode(), $e);
- }
-
- if ($argumentDefinitionClassName !== null) {
- $this->setArgumentDefinitionClassName($argumentDefinitionClassName);
- }
-
- if ($registry !== null) {
- $this->setRegistry($registry);
- }
- }
-
- /**
- * @param \Wootook\Core\DependencyInjection\Registry $registry
- * @return MethodDefinition
- */
- public function setRegistry(DependencyInjection\Registry $registry)
- {
- $this->_registry = $registry;
-
- return $this;
- }
-
- /**
- * @return null|\Wootook\Core\DependencyInjection\Registry
- */
- public function getRegistry()
- {
- return $this->_registry;
- }
-
- /**
- * @param int|string $argumentPosition
- * @return \Wootook\Core\DependencyInjection\Definition\ArgumentDefinition
- * @throws \Wootook\Core\Exception\DependencyInjection\InvalidArgumentException
- */
- public function getArgumentDefinition($argumentPosition, $registerInstanceIfNew = false)
- {
- if (is_string($argumentPosition) && isset($this->_argumentIndex[$argumentPosition])) {
- $argumentPosition = $this->_argumentIndex[$argumentPosition];
- }
-
- if (!is_int($argumentPosition)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Argument could only be found by position or by name.');
- }
-
- if (isset($this->_argumentDefinitions[$argumentPosition])) {
- return $this->_argumentDefinitions[$argumentPosition];
- }
-
- $definition = $this->initArgumentDefinition($argumentPosition);
- if ($registerInstanceIfNew === true) {
- $this->registerArgumentDefinition($argumentPosition, $definition);
- }
- return $definition;
- }
-
- public function initArgumentDefinition($argumentPosition)
- {
- if (is_string($argumentPosition) && isset($this->_argumentIndex[$argumentPosition])) {
- $argumentPosition = $this->_argumentIndex[$argumentPosition];
- }
-
- if (!is_int($argumentPosition)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Argument could only be found by position or by name.');
- }
-
- $class = $this->getArgumentDefinitionClassName();
-
- return new $class($this, $argumentPosition, $this->getRegistry());
- }
-
- public function registerArgumentDefinition($argumentPosition, ArgumentDefinition $argumentDefinition)
- {
- if (is_string($argumentPosition) && isset($this->_argumentIndex[$argumentPosition])) {
- $argumentName = $argumentPosition;
- $argumentPosition = $this->_argumentIndex[$argumentPosition];
- } else if (($reflector = $argumentDefinition->getReflector()) instanceof \ReflectionParameter) {
- $argumentName = $reflector->getName();
- } else {
- $argumentName = null;
- }
-
- if (!is_int($argumentPosition)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Argument could only be found by position or by name.');
- }
-
- $this->_argumentDefinitions[$argumentPosition] = $argumentDefinition;
- if ($argumentName !== null) {
- $this->_argumentIndex[$argumentName] = $argumentPosition;
- }
-
- return $this;
- }
-
- public function addArgumentDefinition($argumentPosition)
- {
- $this->registerArgumentDefinition($argumentPosition, $this->initArgumentDefinition($argumentPosition));
-
- return $this;
- }
-
- public function setArgumentDefinition($argumentPosition, ArgumentDefinition $definition)
- {
- if (is_string($argumentPosition) && isset($this->_argumentIndex[$argumentPosition])) {
- $argumentPosition = $this->_argumentIndex[$argumentPosition];
- }
-
- if (!is_int($argumentPosition)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Argument could only be found by position or by name.');
- }
-
- $this->_argumentDefinitions[$argumentPosition] = $definition;
-
- return $this;
- }
-
- /**
- * @return array
- */
- public function getAllArgumentDefinitions()
- {
- return $this->_argumentDefinitions;
- }
-
- /**
- * @return array
- */
- public function reset()
- {
- $this->_argumentDefinitions = array();
-
- return $this;
- }
-
- public function setArgumentDefinitionClassName($argumentDefinitionClassName)
- {
- if (!is_string($argumentDefinitionClassName)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Class names only accept string.');
- }
-
- $this->_argumentDefinitionClassName = $argumentDefinitionClassName;
-
- return $this;
- }
-
- public function getArgumentDefinitionClassName()
- {
- return $this->_argumentDefinitionClassName;
- }
-
- /**
- * @param string|int $argumentPosition
- * @param mixed $argumentValue
- * @return MethodDefinition
- * @throws \Wootook\Core\Exception\DependencyInjection\InvalidArgumentException
- */
- public function bindArgumentValue($argumentPosition, $argumentValue)
- {
- $this->getArgumentDefinition($argumentPosition, true)->bindValue($argumentValue);
-
- return $this;
- }
-
- /**
- * @param string|int $argumentPosition
- * @param mixed $argumentVariable
- * @return MethodDefinition
- * @throws \Wootook\Core\Exception\DependencyInjection\InvalidArgumentException
- */
- public function bindArgumentVariable($argumentPosition, &$argumentVariable)
- {
- $this->getArgumentDefinition($argumentPosition, true)->bindVariable($argumentVariable);
-
- return $this;
- }
-
- /**
- * @param string|int $argumentPosition
- * @param string $registryKey
- * @return MethodDefinition
- * @throws \Wootook\Core\Exception\DependencyInjection\RuntimeException
- * @throws \Wootook\Core\Exception\DependencyInjection\InvalidArgumentException
- */
- public function bindArgumentRegistryEntry($argumentPosition, $registryKey)
- {
- $this->getArgumentDefinition($argumentPosition, true)->bindRegistryEntry($registryKey);
-
- return $this;
- }
-
- /**
- * @return \ReflectionMethod
- */
- public function getReflector()
- {
- return $this->_reflector;
- }
-
- /**
- * @param \ReflectionMethod $reflector
- * @return MethodDefinition
- */
- public function setReflector(\ReflectionMethod $reflector)
- {
- $this->_reflector = $reflector;
-
- foreach ($this->_reflector->getParameters() as $argumentReflector) {
- $argumentName = $argumentReflector->getName();
- $argumentPosition = $argumentReflector->getPosition();
-
- $this->_argumentIndex[$argumentName] = $argumentPosition;
- $this->_argumentReflectors[$argumentPosition] = $argumentReflector;
- }
-
- return $this;
- }
-
- /**
- * @param $argumentPosition
- * @return \ReflectionParameter
- * @throws \Wootook\Core\Exception\DependencyInjection\InvalidArgumentException
- */
- public function getArgumentReflector($argumentPosition)
- {
- if (is_string($argumentPosition) && isset($this->_argumentIndex[$argumentPosition])) {
- $argumentPosition = $this->_argumentIndex[$argumentPosition];
- }
-
- if (!is_int($argumentPosition) || !isset($this->_argumentReflectors[$argumentPosition])) {
- throw new CoreException\DependencyInjection\BadMethodCallException('Argument does not exist.');
- }
-
- return $this->_argumentReflectors[$argumentPosition];
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Factory.php b/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Factory.php
deleted file mode 100644
index bbff31f..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Factory.php
+++ /dev/null
@@ -1,133 +0,0 @@
-setRegistry($registry);
- }
-
- if ($classDefinitionClassName !== null) {
- $this->setClassDefinitionClassName($classDefinitionClassName);
- }
- }
-
- public function setRegistry(Registry $registry)
- {
- $this->_registry = $registry;
-
- return $this;
- }
-
- public function getRegistry()
- {
- if ($this->_registry === null) {
- $this->_registry = new Registry($this->app());
- }
-
- return $this->_registry;
- }
-
- public function getClassDefinition($className, $registerInstanceIfNew = false)
- {
- if (!is_string($className)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Class names only accept string.');
- }
-
- if (isset($this->_classDefinitions[$className])) {
- return $this->_classDefinitions[$className];
- }
-
- $definition = $this->initClassDefinition($className);
- if ($registerInstanceIfNew === true) {
- $this->registerClassDefinition($className, $definition);
- }
- return $definition;
-
- return $this->initClassDefinition($className);
- }
-
- public function initClassDefinition($className)
- {
- $class = $this->getClassDefinitionClassName();
-
- return new $class($className);
- }
-
- public function registerClassDefinition($className, Definition\ClassDefinition $classDefinition)
- {
- if (!is_string($className)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Class names only accept string.');
- }
-
- $this->_classDefinitions[$className] = $classDefinition;
-
- return $this;
- }
-
- public function addClassDefinition($className)
- {
- $this->registerClassDefinition($className, $this->initClassDefinition($className));
-
- return $this;
- }
-
- public function setClassDefinition($className, Definition\ClassDefinition $definition)
- {
- if (!is_string($className)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Class names only accept string.');
- }
-
- $this->_classDefinitions[$className] = $definition;
-
- return $this;
- }
-
- public function getAllClassDefinitions()
- {
- return $this->_classDefinitions;
- }
-
- public function setClassDefinitionClassName($classDefinitionClassName)
- {
- if (!is_string($classDefinitionClassName)) {
- throw new CoreException\DependencyInjection\InvalidArgumentException('Class names only accept string.');
- }
-
- $this->_classDefinitionClassName = $classDefinitionClassName;
-
- return $this;
- }
-
- public function getClassDefinitionClassName()
- {
- return $this->_classDefinitionClassName;
- }
-
- public function reset()
- {
- return $this->_classDefinitions = array();
- }
-
- public function __invoke($className, Array $additionalArguments = array())
- {
- $definition = $this->getClassDefinition($className);
-
- return $definition->newInstance($additionalArguments);
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Registry.php b/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Registry.php
deleted file mode 100644
index df4c3fb..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/DependencyInjection/Registry.php
+++ /dev/null
@@ -1,60 +0,0 @@
-_instances = array();
-
- return $this;
- }
-
- public function add($identifier, $value)
- {
- if ($this->has($identifier)) {
- throw new CoreException\RuntimeException('Instance already exists.');
- }
- $this->set($identifier, $value);
- }
-
- public function set($identifier, $value)
- {
- if (isset($this->_instances[$identifier])) {
- throw new CoreException\BadMethodCallException;
- }
- $this->_instances[$identifier] = $value;
-
- return $this;
- }
-
- public function get($identifier)
- {
- return $this->_instances[$identifier];
- }
-
- public function delete($identifier)
- {
- unset($this->_instances[$identifier]);
-
- return $this;
- }
-
- public function has($identifier)
- {
- return isset($this->_instances[$identifier]);
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Email/Email.php b/src/application/modules/WootookCore/src/Wootook/Core/Email/Email.php
deleted file mode 100644
index df01526..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Email/Email.php
+++ /dev/null
@@ -1,104 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Email;
-
-use Wootook\Core,
- Wootook\Core\Exception as CoreException,
- Wootook\Core\Email\Transport,
- Wootook\Core\Email\Part;
-
-/**
- * Email management class
- */
-class Email
-{
- /**
- * @var Transport\Transport
- */
- protected $_transport = null;
-
- /**
- * @param null|Transport\Transport $transport
- */
- public function __construct(Transport\Transport $transport = null)
- {
- if ($transport === null) {
- $transport = new Transport\Sendmail();
- }
- $this->setTransport($transport);
- }
-
- /**
- * @param Transport\Transport $transport
- */
- public function setTransport(Transport\Transport $transport)
- {
- $this->_transport = $transport;
- }
-
- /**
- * @return Transport\Transport
- */
- public function getTransport()
- {
- return $this->_transport;
- }
-
- /**
- * @param string|array $to
- * @param string|array $from
- * @param string $subject
- * @param $body
- * @param array $headers
- * @return Core\Email
- * @throws CoreException\RuntimeException
- */
- public function send($to, $from, $subject, $body, Array $headers = array())
- {
- try {
- $this->_transport
- ->addRecipient($to)
- ->setFrom($from)
- ->setSubject($subject)
- ->addPart(new Part\Part($body))
- ->addHeaders($headers)
- ->connect()
- ->send()
- ;
- } catch (CoreException\RuntimeException $e) {
- throw new CoreException\RuntimeException('Could not send mail.', null, $e);
- }
-
- $this->_transport->disconnect();
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Email/Part/Part.php b/src/application/modules/WootookCore/src/Wootook/Core/Email/Part/Part.php
deleted file mode 100644
index ea8d79e..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Email/Part/Part.php
+++ /dev/null
@@ -1,46 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Email\Part;
-
-class Part
-{
- protected $_content = null;
-
- public function __construct($content, $mime = 'text/plain')
- {
- $this->_content = $content;
- }
-
- public function render()
- {
- return $this->_content;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Email/Transport/Transport.php b/src/application/modules/WootookCore/src/Wootook/Core/Email/Transport/Transport.php
deleted file mode 100644
index 371f40a..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Email/Transport/Transport.php
+++ /dev/null
@@ -1,54 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Email\Transport;
-
-use Wootook\Core\Email\Part;
-
-interface Transport
-{
- public function setFrom($from);
- public function addRecipient($recipient);
- public function setSubject($subject);
- public function addHeader($name, $value);
- public function addPart(Part\Part $part);
-
- public function reset();
- public function clearFrom();
- public function clearHeaders();
- public function clearRecipients();
- public function clearSubject();
- public function clearParts();
-
- public function connect();
- public function disconnect();
-
- public function send();
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Event/Break.php b/src/application/modules/WootookCore/src/Wootook/Core/Event/Break.php
deleted file mode 100644
index 4ca10bb..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Event/Break.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Event;
-
-use Wootook\Core\Exception as CoreException;
-
-class EventBreak
- extends CoreException\Exception
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Event/Event.php b/src/application/modules/WootookCore/src/Wootook/Core/Event/Event.php
deleted file mode 100644
index 3d37596..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Event/Event.php
+++ /dev/null
@@ -1,117 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Event;
-
-use Wootook\Core,
- Wootook\Core\Exception as CoreException;
-
-/**
- * Event
- */
-class Event
- extends Core\Base\BaseObject
-{
- protected $_propagationStopped = false;
-
- public function __call($method, $params)
- {
- $prefix = substr($method, 0, 3);
- $dataKey = substr($method, 3);
-
- $dataKey = str_replace(' ', '', ucwords(str_replace('-', ' ', $dataKey)));
- $dataKey = str_replace(' ', '_', ucwords(str_replace('.', ' ', $dataKey)));
-
- switch ($prefix) {
- case 'get':
- return $this->getData($dataKey);
- case 'set':
- return $this->setData($dataKey, isset($params[0]) ? $params[0] : null);
- case 'uns':
- return $this->unsetData($dataKey);
- case 'has':
- return $this->hasData($dataKey);
- }
-
- throw new CoreException\RuntimeException(sprintf('Method %d does not exist.', $method));
- }
-
- public function setType($type)
- {
- return $this->setData('type', $type);
- }
-
- public function getType()
- {
- return $this->getData('type');
- }
-
- public function hasType()
- {
- return $this->hasData('type');
- }
-
- public function unsType()
- {
- return $this->unsetData('type');
- }
-
- public function setTarget($target)
- {
- return $this->setData('target', $target);
- }
-
- public function getTarget()
- {
- return $this->getData('target');
- }
-
- public function hasTarget()
- {
- return $this->hasData('target');
- }
-
- public function unsTarget()
- {
- return $this->unsetData('target');
- }
-
- public function stopPropagation()
- {
- $this->_propagationStopped = true;
-
- return $this;
- }
-
- public function isPropagationStopped()
- {
- return $this->_propagationStopped;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Event/EventTarget.php b/src/application/modules/WootookCore/src/Wootook/Core/Event/EventTarget.php
deleted file mode 100644
index 0808e9e..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Event/EventTarget.php
+++ /dev/null
@@ -1,94 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Event;
-
-/**
- * EventTarget
- */
-trait EventTarget
-{
- protected $_eventListeners = array();
-
- /**
- * @param $type
- * @param Closure $listener
- * @return EventTarget
- */
- public function registerEventListener($type, Closure $listener)
- {
- if (!isset($this->_eventListeners[$type])) {
- $this->_eventListeners[$type] = array();
- }
- $this->_eventListeners[$type][] = $listener;
-
- return $this;
- }
-
- /**
- * @param $type
- * @param Closure $listener
- * @return EventTarget
- */
- public function unregisterEventListener($type, Closure $listener)
- {
- if (!isset($this->_eventListeners[$type])) {
- return $this;
- }
- $key = array_search($listener, $this->_eventListeners[$type]);
- unset($this->_eventListeners[$type][$key]);
-
- return $this;
- }
-
- /**
- * @param $type
- * @return Event
- */
- public function dispatchEvent($type, Array $datas = array())
- {
- if (!isset($this->_eventListeners[$type])) {
- return $this;
- }
-
- $event = new Event($datas);
- $event->setType($type);
- $event->setTarget($this);
-
- foreach ($this->_eventListeners[$type] as $eventListener) {
- $eventListener($event);
- if ($event->isPropagationStopped()) {
- break;
- }
- }
-
- return $event;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/BadMethodCallException.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/BadMethodCallException.php
deleted file mode 100644
index 0dacf2f..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/BadMethodCallException.php
+++ /dev/null
@@ -1,37 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception;
-
-class BadMethodCallException
- extends \BadMethodCallException
- implements CoreException
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/CoreException.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/CoreException.php
deleted file mode 100644
index ef691e2..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/CoreException.php
+++ /dev/null
@@ -1,40 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception;
-
-use Wootook;
-
-/**
- * Base exception identifier for the Core module
- */
-interface CoreException
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/DataAccessException.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/DataAccessException.php
deleted file mode 100644
index b7fc6da..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/DataAccessException.php
+++ /dev/null
@@ -1,36 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception;
-
-class DataAccessException
- extends RuntimeException
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/Database/AdapterError.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/Database/AdapterError.php
deleted file mode 100644
index 90e41c7..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/Database/AdapterError.php
+++ /dev/null
@@ -1,53 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception\Database;
-
-use Wootook\Core\Database\Adapter,
- Wootook\Core\Exception as CoreException;
-
-class AdapterError
- extends CoreException\RuntimeException
- implements Error
-{
- protected $_adapter = null;
-
- public function __construct(Adapter\Adapter $adapter, $message = null, $code = null, $previous = null)
- {
- parent::__construct($message, null, $previous);
-
- $this->_adapter = $adapter;
- }
-
- public function getAdapter()
- {
- return $this->_adapter;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/Database/Error.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/Database/Error.php
deleted file mode 100644
index c1c30b1..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/Database/Error.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception\Database;
-
-interface Error
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/Database/StatementError.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/Database/StatementError.php
deleted file mode 100644
index 7876465..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/Database/StatementError.php
+++ /dev/null
@@ -1,53 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception\Database;
-
-use Wootook\Core\Database\Statement,
- Wootook\Core\Exception as CoreException;
-
-class StatementError
- extends CoreException\RuntimeException
- implements Error
-{
- protected $_statement = null;
-
- public function __construct(Statement\Statement $statement, $message = null, $code = null, $previous = null)
- {
- parent::__construct($message, $code, $previous);
-
- $this->_statement = $statement;
- }
-
- public function getStatement()
- {
- return $this->_statement;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/DependencyInjection/BadMethodCallException.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/DependencyInjection/BadMethodCallException.php
deleted file mode 100644
index 4b19b85..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/DependencyInjection/BadMethodCallException.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception\DependencyInjection;
-
-use Wootook\Core\Exception;
-
-class BadMethodCallException
- extends \BadMethodCallException
- implements Exception\CoreException
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/DependencyInjection/InvalidArgumentException.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/DependencyInjection/InvalidArgumentException.php
deleted file mode 100644
index d24998d..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/DependencyInjection/InvalidArgumentException.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception\DependencyInjection;
-
-use Wootook\Core\Exception;
-
-class InvalidArgumentException
- extends \InvalidArgumentException
- implements Exception\CoreException
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/DependencyInjection/RuntimeException.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/DependencyInjection/RuntimeException.php
deleted file mode 100644
index 1185dad..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/DependencyInjection/RuntimeException.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception\DependencyInjection;
-
-use Wootook\Core\Exception;
-
-class RuntimeException
- extends \RuntimeException
- implements Exception\CoreException
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/Deprecated.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/Deprecated.php
deleted file mode 100644
index 138c74e..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/Deprecated.php
+++ /dev/null
@@ -1,37 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception;
-
-class Deprecated
- extends RuntimeException
-{
-
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/Exception.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/Exception.php
deleted file mode 100644
index 1c594e0..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/Exception.php
+++ /dev/null
@@ -1,37 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception;
-
-class Exception
- extends \Exception
- implements CoreException
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/GameError.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/GameError.php
deleted file mode 100644
index 6738dc9..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/GameError.php
+++ /dev/null
@@ -1,37 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception;
-
-class GameError
- extends RuntimeException
-{
-
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/InvalidArgumentException.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/InvalidArgumentException.php
deleted file mode 100644
index d1d5838..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/InvalidArgumentException.php
+++ /dev/null
@@ -1,37 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception;
-
-class InvalidArgumentException
- extends \InvalidArgumentException
- implements CoreException
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/LayoutException.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/LayoutException.php
deleted file mode 100644
index 81d9822..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/LayoutException.php
+++ /dev/null
@@ -1,36 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception;
-
-class LayoutException
- extends RuntimeException
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/RuntimeException.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/RuntimeException.php
deleted file mode 100644
index 4dd710f..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/RuntimeException.php
+++ /dev/null
@@ -1,37 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception;
-
-class RuntimeException
- extends \RuntimeException
- implements CoreException
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Exception/WebsiteError.php b/src/application/modules/WootookCore/src/Wootook/Core/Exception/WebsiteError.php
deleted file mode 100644
index 00d4292..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Exception/WebsiteError.php
+++ /dev/null
@@ -1,37 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Exception;
-
-class WebsiteError
- extends RuntimeException
-{
-
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Form/Element/Button.php b/src/application/modules/WootookCore/src/Wootook/Core/Form/Element/Button.php
deleted file mode 100644
index d573d52..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Form/Element/Button.php
+++ /dev/null
@@ -1,40 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Form\Element;
-
-class Button
- extends BaseElement
-{
- public function getType()
- {
- return 'button';
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Form/Element/Text.php b/src/application/modules/WootookCore/src/Wootook/Core/Form/Element/Text.php
deleted file mode 100644
index 2df3e25..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Form/Element/Text.php
+++ /dev/null
@@ -1,40 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Form\Element;
-
-class Text
- extends BaseElement
-{
- public function getType()
- {
- return 'text';
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Form/ElementLoader.php b/src/application/modules/WootookCore/src/Wootook/Core/Form/ElementLoader.php
deleted file mode 100644
index 63a7b25..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Form/ElementLoader.php
+++ /dev/null
@@ -1,70 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Form;
-
-use Wootook\Core\Profiler,
- Wootook\Core\PluginLoader;
-
-class ElementLoader
- extends PluginLoader\PluginLoader
-{
- protected $_form = null;
-
- public function __construct(Form $form, Array $namespaces = array())
- {
- $this->_form = $form;
-
- foreach ($namespaces as $namespace => $path) {
- if (is_int($namespace)) {
- $this->registerNamespace($path);
- } else {
- $this->registerNamespace($namespace, $path);
- }
- }
- }
-
- protected function _load($className, $useSingleton, Array $constructorParams = array())
- {
- $reflection = new \ReflectionClass($className);
- if ($useSingleton && $reflection->implementsInterface('Wootook\\Core\\Base\\Singleton')) {
- $method = $reflection->getMethod('getSingleton');
- return $method->invoke(null);
- }
-
- try {
- return $reflection->newInstance($this->_form);
- } catch (\ReflectionException $e) {
- Profiler\ErrorProfiler::getSingleton()
- ->addException($e);
- return null;
- }
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Alnum.php b/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Alnum.php
deleted file mode 100644
index 459dbb7..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Alnum.php
+++ /dev/null
@@ -1,53 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Form\Validator;
-
-use Wootook\Core\Form\Element;
-
-class Alnum
- extends Regex
-{
- public function __construct()
- {
- parent::__construct('#[^[:alnum:]]#');
- }
-
- public function validate(Element\BaseElement $element, $data)
- {
- if ($this->_validate($element, $data)) {
- $this->_getSession($element)
- ->addError('Field "%s" should only contain alphanumeric characters.', $element->getName());
-
- return false;
- }
- return true;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Alpha.php b/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Alpha.php
deleted file mode 100644
index 98eb3cf..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Alpha.php
+++ /dev/null
@@ -1,53 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Form\Validator;
-
-use Wootook\Core\Form\Element;
-
-class Alpha
- extends Regex
-{
- public function __construct()
- {
- parent::__construct('#[^[:alpha:]]#');
- }
-
- public function validate(Element\BaseElement $element, $data)
- {
- if ($this->_validate($element, $data)) {
- $this->_getSession($element)
- ->addError('Field "%s" should only contain alphabetic characters.', $element->getName());
-
- return false;
- }
- return true;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/BaseValidator.php b/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/BaseValidator.php
deleted file mode 100644
index 3307b02..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/BaseValidator.php
+++ /dev/null
@@ -1,48 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Form\Validator;
-
-use Wootook\Core\Form,
- Wootook\Core\Form\Element;
-
-abstract class BaseValidator
-{
- abstract public function validate(Element\BaseElement $element, $data);
-
- protected function _getSession(Element\BaseElement $element)
- {
- $form = $element->getForm();
- if (!$form instanceof Form\Form) {
- return null;
- }
- return $element->getSession();
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Email.php b/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Email.php
deleted file mode 100644
index 8e36960..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Email.php
+++ /dev/null
@@ -1,53 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Form\Validator;
-
-use Wootook\Core\Form\Element;
-
-class Email
- extends Regex
-{
- public function __construct()
- {
- parent::__construct('#^[[:alnum:]\._\-]@[[:alnum:]\._\-]\.[a-z]{2,}$#');
- }
-
- public function validate(Element\BaseElement $element, $data)
- {
- if (!$this->_validate($element, $data)) {
- $this->_getSession($element)
- ->addError('Field "%s" should contain an email.', $element->getName());
-
- return false;
- }
- return true;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/FormKey.php b/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/FormKey.php
deleted file mode 100644
index 32d54bd..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/FormKey.php
+++ /dev/null
@@ -1,52 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Form\Validator;
-
-use Wootook\Core\Form\Element;
-
-class FormKey
- extends BaseValidator
-{
- public function validate(Element\BaseElement $element, $data)
- {
- $form = $element->getForm();
- $session = $form->getSession();
-
- if ($session->getFormKey(false) == $data) {
- return true;
- }
-
- $this->_getSession($field)
- ->addError('CSRF token failure.', $field->getName());
-
- return false;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Hex.php b/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Hex.php
deleted file mode 100644
index 2009a54..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Hex.php
+++ /dev/null
@@ -1,54 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Form\Validator;
-
-use Wootook\Core\Form\Element;
-
-class Hex
- extends Regex
-{
-
- public function __construct()
- {
- parent::__construct('#(?:0x)?[^0-9a-f]#i');
- }
-
- public function validate(Element\BaseElement $element, $data)
- {
- if ($this->_validate($element, $data)) {
- $this->_getSession($element)
- ->addError('Field "%s" should only contain numeric characters.', $element->getName());
-
- return false;
- }
- return true;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Host.php b/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Host.php
deleted file mode 100644
index f8df82f..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Host.php
+++ /dev/null
@@ -1,53 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Form\Validator;
-
-use Wootook\Core\Form\Element;
-
-class Host
- extends Regex
-{
- public function __construct()
- {
- parent::__construct('#^[[:alnum:]\._\-]\.[a-z]{2,}$#');
- }
-
- public function validate(Element\BaseElement $element, $data)
- {
- if (!$this->_validate($element, $data)) {
- $this->_getSession($element)
- ->addError('Field "%s" should contain a host name.', $element->getName());
-
- return false;
- }
- return true;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Numeric.php b/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Numeric.php
deleted file mode 100644
index b3ed15b..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Numeric.php
+++ /dev/null
@@ -1,54 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Form\Validator;
-
-use Wootook\Core\Form\Element;
-
-class Numeric
- extends Regex
-{
-
- public function __construct()
- {
- parent::__construct('#[^[:digit:]]#');
- }
-
- public function validate(Element\BaseElement $element, $data)
- {
- if ($this->_validate($element, $data)) {
- $this->_getSession($element)
- ->addError('Field "%s" should only contain numeric characters.', $element->getName());
-
- return false;
- }
- return true;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Regex.php b/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Regex.php
deleted file mode 100644
index c692ec0..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Form/Validator/Regex.php
+++ /dev/null
@@ -1,60 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Form\Validator;
-
-use Wootook\Core\Form\Element;
-
-class Regex
- extends BaseValidator
-{
- protected $_expression = null;
-
- public function __construct($expression)
- {
- $this->_expression = $expression;
- }
-
- public function validate(Element\BaseElement $element, $data)
- {
- if (!$this->_validate($element, $data)) {
- $this->_getSession($element)
- ->addError('Field "%s" does not match the validation pattern.', $element->getName());
-
- return false;
- }
- return true;
- }
-
- protected function _validate(Element\BaseElement $element, $data)
- {
- return preg_match($this->_expression, $data);
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Form/ValidatorLoader.php b/src/application/modules/WootookCore/src/Wootook/Core/Form/ValidatorLoader.php
deleted file mode 100644
index 8acc4b4..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Form/ValidatorLoader.php
+++ /dev/null
@@ -1,70 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Form;
-
-use Wootook\Core\Profiler,
- Wootook\Core\PluginLoader;
-
-class ValidatorLoader
- extends PluginLoader\PluginLoader
-{
- protected $_form = null;
-
- public function __construct(Form $form, Array $namespaces = array())
- {
- $this->_form = $form;
-
- foreach ($namespaces as $namespace => $path) {
- if (is_int($namespace)) {
- $this->registerNamespace($path);
- } else {
- $this->registerNamespace($namespace, $path);
- }
- }
- }
-
- protected function _load($className, $useSingleton, Array $constructorParams = array())
- {
- $reflection = new \ReflectionClass($className);
- if ($useSingleton && $reflection->implementsInterface('Wootook\\Core\\Base\\Singleton')) {
- $method = $reflection->getMethod('getSingleton');
- return $method->invoke(null);
- }
-
- try {
- return $reflection->newInstance();
- } catch (\ReflectionException $e) {
- Profiler\ErrorProfiler::getSingleton()
- ->addException($e);
- return null;
- }
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Helper/Config/ConfigHandler.php b/src/application/modules/WootookCore/src/Wootook/Core/Helper/Config/ConfigHandler.php
deleted file mode 100644
index 6fb1cae..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Helper/Config/ConfigHandler.php
+++ /dev/null
@@ -1,93 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Helper\Config;
-
-use Wootook\Core\Mvc\Model\Type,
- Wootook\Core\Mvc\Model\Action;
-
-abstract class ConfigHandler
- implements \Iterator, \Countable
-{
- protected $_data = array();
-
- protected function _initData($filename)
- {
- $config = \Wootook::app()->getDefaultGame()->getConfig('engine/storyline');
-
- if ($config === null) {
- $config = array(
- 'universe' => 'default',
- 'episode' => 'default'
- );
- } else {
- $config = $config->toArray();
- }
-
- $path = 'gamedata' . DIRECTORY_SEPARATOR . $config['universe'] . DIRECTORY_SEPARATOR
- . $config['episode'] . DIRECTORY_SEPARATOR . $filename . '.php';
-
- foreach (include APPLICATION_PATH . $path as $elementId => $fieldName) {
- $this->setData($elementId, $fieldName);
- }
-
- return $this;
- }
-
- public function count()
- {
- return count($this->_data);
- }
-
- public function current()
- {
- return current($this->_data);
- }
-
- public function next()
- {
- return next($this->_data);
- }
-
- public function key()
- {
- return key($this->_data);
- }
-
- public function valid()
- {
- return $this->current() !== false;
- }
-
- public function rewind()
- {
- reset($this->_data);
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Helper/Config/Events.php b/src/application/modules/WootookCore/src/Wootook/Core/Helper/Config/Events.php
deleted file mode 100644
index 9809eed..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Helper/Config/Events.php
+++ /dev/null
@@ -1,71 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Helper\Config;
-
-use Wootook\Core,
- Wootook\Core\Config;
-
-/**
- *
- * Enter description here ...
- *
- * @uses Wootook\Core\BaseObject
- * @uses Legacies_Empire
- */
-class Events
- extends ConfigHandler
- implements Core\Base\Singleton
-{
- private static $_singleton = null;
-
- public static function getSingleton()
- {
- if (self::$_singleton === null) {
- self::$_singleton = new self();
- }
- return self::$_singleton;
- }
-
- public static function registerEvents()
- {
- foreach (self::getSingleton() as $event => $listenerList) {
- foreach ($listenerList as $listener) {
- \Wootook::registerListener($event, $listener);
- }
- }
- }
-
- protected function _init()
- {
- $this->_initData('events');
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Helper/Config/Modules.php b/src/application/modules/WootookCore/src/Wootook/Core/Helper/Config/Modules.php
deleted file mode 100644
index cfad504..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Helper/Config/Modules.php
+++ /dev/null
@@ -1,79 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Helper\Config;
-
-use Wootook\Core;
-
-/**
- *
- * Enter description here ...
- *
- * @uses Wootook\Core\BaseObject
- * @uses Legacies_Empire
- */
-class Modules
- extends ConfigHandler
- implements Core\Base\Singleton
-{
- private static $_singleton = null;
-
- public static function getSingleton()
- {
- if (self::$_singleton === null) {
- self::$_singleton = new self();
- }
- return self::$_singleton;
- }
-
- protected function _init()
- {
- $this->_initData('modules');
- return $this;
- }
-
- protected function _load()
- {
- // NOP
- return $this;
- }
-
- protected function _save()
- {
- // NOP
- return $this;
- }
-
- protected function _delete()
- {
- // NOP
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Model/Config.php b/src/application/modules/WootookCore/src/Wootook/Core/Model/Config.php
deleted file mode 100644
index 81d2095..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Model/Config.php
+++ /dev/null
@@ -1,93 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Model;
-
-use Wootook\Core\Mvc\Model;
-
-/**
- *
- * Enter description here ...
- *
- * @uses Wootook\Core\BaseObject
- * @uses Legacies_Empire
- */
-class Config
- extends Model\SubTable
-{
- protected $_eventPrefix = 'core.config';
- protected $_eventObject = 'config';
-
- protected function _init()
- {
- $this->_tableName = 'core_config';
- $this->_idFieldNames = array('config_path', 'website_id', 'game_id');
- }
-
- public function setWebsiteId($websiteId)
- {
- return $this->setData('website_id', $websiteId);
- }
-
- public function getWebsiteId()
- {
- return $this->getData('website_id');
- }
-
- public function setGameId($gameId)
- {
- return $this->setData('game_id', $gameId);
- }
-
- public function getGameId()
- {
- return $this->getData('game_id');
- }
-
- public function setPath($path)
- {
- return $this->setData('config_path', $path);
- }
-
- public function getPath()
- {
- return $this->getData('config_path');
- }
-
- public function setValue($value)
- {
- return $this->setData('config_value', $value);
- }
-
- public function getValue()
- {
- return $this->getData('config_value');
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Model/Game.php b/src/application/modules/WootookCore/src/Wootook/Core/Model/Game.php
deleted file mode 100644
index 4453274..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Model/Game.php
+++ /dev/null
@@ -1,139 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Model;
-
-use Wootook\Core,
- Wootook\Core\Mvc\Model,
- Wootook\Core\Mvc\Model\Type;
-
-/**
- *
- * Enter description here ...
- *
- * @uses Wootook\Core\BaseObject
- * @uses Legacies_Empire
- */
-class Game
- extends Model\Entity
-{
- use Type\Full;
-
- const DEFAULT_CODE = 'default';
-
- protected $_website = null;
-
- protected function _construct(Array $data = array())
- {
- $this->_eventPrefix = 'core.game';
- $this->_eventObject = 'game';
-
- parent::_construct($data);
-
- $this->_tableName = 'core_game';
- $this->_idFieldName = 'game_id';
- }
-
- public function getWebsiteId()
- {
- return $this->getData('website_id');
- }
-
- public function setWebsiteId($websiteId)
- {
- $this->_website = $this->app()->getWebsite($websiteId);
- return $this->setData('website_id', $websiteId);
- }
-
- /**
- * @return Website
- */
- public function getWebsite()
- {
- if ($this->_website === null) {
- $this->_website = $this->app()->getWebsite($this->getWebsiteId());
- }
-
- return $this->_website;
- }
-
- /**
- * @param Website $website
- * @return Game
- */
- public function setWebsite(Website $website)
- {
- $this->_website = $website;
- $this->setWebsiteId($website->getId());
-
- return $this;
- }
-
- /**
- * @return string
- */
- public function getCode()
- {
- return $this->getData('code');
- }
-
- /**
- * @param string $code
- * @return Game
- */
- public function setCode($code)
- {
- return $this->setData('code', $code);
- }
-
- /**
- * @return Core\Config\Node
- */
- public function getConfig($path = null)
- {
- if ($this->_config === null) {
- $this->_config = clone $this->getWebsite()->getConfig();
-
- $this->app()->appendEnvironmentConfig($this->_config, $this->getCode());
- $this->app()->appendDatabaseConfig($this->_config, Core\App\App::SCOPE_GAME, $this->getId());
- }
-
- if ($path !== null) {
- return $this->_config->getConfig($path);
- }
-
- return $this->_config;
- }
-
- public function getBaseUrl()
- {
- return $this->getConfig('web/url/base');
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Model/Translator.php b/src/application/modules/WootookCore/src/Wootook/Core/Model/Translator.php
deleted file mode 100644
index 3e2bf53..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Model/Translator.php
+++ /dev/null
@@ -1,67 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Model;
-
-class Translator
-{
- protected $_translations = array();
-
- public function __construct($path, $locale)
- {
- $fileList = glob($path . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . '*.csv');
- foreach ($fileList as $file) {
- $fp = fopen($file, 'r');
- while (!feof($fp)) {
- $line = fgetcsv($fp);
- if (count($line) >= 2) {
- $this->_translations[$line[0]] = $line[1];
- }
- }
- }
- }
-
- public function translate($message, $_ = null)
- {
- $args = func_get_args();
- array_shift($args);
-
- return $this->translateArgs($message, $args);
- }
-
- public function translateArgs($message, Array $args = array())
- {
- if (isset($this->_translations[$message])) {
- $message = $this->_translations[$message];
- }
-
- return vsprintf($message, $args);
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Model/Website.php b/src/application/modules/WootookCore/src/Wootook/Core/Model/Website.php
deleted file mode 100644
index 3a1552f..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Model/Website.php
+++ /dev/null
@@ -1,96 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Model;
-
-use Wootook\Core,
- Wootook\Core\Mvc\Model,
- Wootook\Core\Mvc\Model\Type;
-
-/**
- *
- * Enter description here ...
- *
- * @uses Wootook\Core\BaseObject
- * @uses Legacies_Empire
- */
-class Website
- extends Model\Entity
-{
- use Type\Full;
-
- const DEFAULT_CODE = 'default';
-
- protected $_config = null;
-
- protected function _construct(Array $data = array())
- {
- $this->_eventPrefix = 'core.website';
- $this->_eventObject = 'website';
-
- parent::_construct($data);
-
- $this->_tableName = 'core_website';
- $this->_idFieldName = 'website_id';
- }
-
- public function getCode()
- {
- return $this->getData('code');
- }
-
- public function setCode($code)
- {
- return $this->setData('code', $code);
- }
-
- /**
- * @return Core\Config\Node
- */
- public function getConfig($path = null)
- {
- if ($this->_config === null) {
- $this->_config = clone $this->app()->getGlobalConfig();
-
- $this->app()->appendEnvironmentConfig($this->_config, $this->getCode());
- $this->app()->appendDatabaseConfig($this->_config, Core\App\App::SCOPE_WEBSITE, $this->getId());
- }
-
- if ($path !== null) {
- return $this->_config->getConfig($path);
- }
- return $this->_config;
- }
-
- public function getBaseUrl()
- {
- return $this->getConfig('web/url/base');
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Request/Request.php b/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Request/Request.php
deleted file mode 100644
index 3eb24ca..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Request/Request.php
+++ /dev/null
@@ -1,67 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Mvc\Controller\Request;
-
-use Wootook\Core;
-
-abstract class Request
- extends Core\Base\BaseObject
-{
- protected function _construct(Array $data = array())
- {
- $this->init();
-
- parent::_construct($data);
- }
-
- public function setParam($key, $value)
- {
- return $this->setData($key, $value);
- }
-
- public function getParam($key, $default = null)
- {
- if ($this->hasData($key)) {
- return $this->getData($key);
- }
- return $default;
- }
-
- abstract public function init();
-
- abstract public function getModuleName();
- abstract public function getControllerName();
- abstract public function getActionName();
-
- abstract public function setModuleName($name);
- abstract public function setControllerName($name);
- abstract public function setActionName($name);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Response/Response.php b/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Response/Response.php
deleted file mode 100644
index 1afa0af..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Controller/Response/Response.php
+++ /dev/null
@@ -1,53 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Mvc\Controller\Response;
-
-use Wootook\Core;
-
-abstract class Response
- extends Core\Base\BaseObject
-{
- protected $_isDispatched = false;
-
- public function setIsDispatched($dispatched = true)
- {
- $this->_isDispatched = $dispatched;
-
- return $this;
- }
-
- public function isDispatched()
- {
- return $this->_isDispatched;
- }
-
- abstract public function render($send = true);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Delete.php b/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Delete.php
deleted file mode 100644
index 76c577d..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Delete.php
+++ /dev/null
@@ -1,75 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Mvc\Model\Action;
-
-use Wootook\Core\Exception as CoreException;
-
-/**
- *
- */
-trait Delete
-{
- public function delete()
- {
- try {
- $this->_beforeDelete();
- $this->_delete();
- $this->_afterDelete();
- } catch (\PDOException $e) {
- throw new CoreException\DataAccessException('Could not delete entity: ' . $e->getMessage(), 0);
- }
- return $this;
- }
-
- abstract protected function _delete();
-
- protected function _beforeDelete()
- {
- \Wootook::dispatchEvent('model.before-delete', array('model' => $this));
-
- if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
- \Wootook::dispatchEvent($this->_eventPrefix . '.before-delete', array($this->_eventObject => $this));
- }
-
- return $this;
- }
-
- protected function _afterDelete()
- {
- \Wootook::dispatchEvent('model.after-delete', array('model' => $this));
-
- if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
- \Wootook::dispatchEvent($this->_eventPrefix . '.after-delete', array($this->_eventObject => $this));
- }
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Load.php b/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Load.php
deleted file mode 100644
index 1d39b9b..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Load.php
+++ /dev/null
@@ -1,77 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Mvc\Model\Action;
-
-use Wootook\Core\Exception as CoreException;
-
-/**
- *
- */
-trait Load
-{
- public function load($entityId, $field = null, $_ = null)
- {
- try {
- $this->_beforeLoad();
- $this->_load($entityId, $field);
- $this->_afterLoad();
-
- $this->_setOriginalData($this->_data);
- } catch (\PDOException $e) {
- throw new CoreException\DataAccessException('Could not load data: ' . $e->getMessage(), 0, $e);
- }
- return $this;
- }
-
- abstract protected function _load();
-
- protected function _beforeLoad()
- {
- \Wootook::dispatchEvent('model.before-load', array('model' => $this));
-
- if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
- \Wootook::dispatchEvent($this->_eventPrefix . '.before-load', array($this->_eventObject => $this));
- }
-
- return $this;
- }
-
- protected function _afterLoad()
- {
- \Wootook::dispatchEvent('model.after-load', array('model' => $this));
-
- if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
- \Wootook::dispatchEvent($this->_eventPrefix . '.after-load', array($this->_eventObject => $this));
- }
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Loadable.php b/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Loadable.php
deleted file mode 100644
index d809788..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Loadable.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Mvc\Model\Action;
-
-/**
- *
- */
-interface Loadable
-{
- public function load($entityId, $field = null, $_ = null);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Save.php b/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Save.php
deleted file mode 100644
index 9089e37..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Action/Save.php
+++ /dev/null
@@ -1,77 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Mvc\Model\Action;
-
-use Wootook\Core\Exception as CoreException;
-
-/**
- *
- */
-trait Save
-{
- public function save()
- {
- try {
- $this->_beforeSave();
- $this->_save();
- $this->_afterSave();
-
- $this->_setOriginalData($this->_data);
- } catch (PDOException $e) {
- throw new CoreException\DataAccessException('Could not save data: ' . $e->getMessage(), 0);
- }
- return $this;
- }
-
- abstract protected function _save();
-
- protected function _beforeSave()
- {
- \Wootook::dispatchEvent('model.before-save', array('model' => $this));
-
- if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
- \Wootook::dispatchEvent($this->_eventPrefix . '.before-save', array($this->_eventObject => $this));
- }
-
- return $this;
- }
-
- protected function _afterSave()
- {
- \Wootook::dispatchEvent('model.after-save', array('model' => $this));
-
- if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
- \Wootook::dispatchEvent($this->_eventPrefix . '.after-save', array($this->_eventObject => $this));
- }
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Entity.php b/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Entity.php
deleted file mode 100644
index dc4891b..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Entity.php
+++ /dev/null
@@ -1,193 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Mvc\Model;
-
-use Wootook\Core,
- Wootook\Core\Database,
- Wootook\Core\Database\Sql,
- Wootook\Core\Exception as CoreException;
-
-abstract class Entity
- extends Core\Base\BaseObject
- implements EntityInterface
-{
- protected $_tableName = null;
-
- protected $_idFieldName = null;
-
- public function setIdFieldName($fieldName)
- {
- $this->_idFieldName = $fieldName;
-
- return $this;
- }
-
- public function getIdFieldName()
- {
- return $this->_idFieldName;
- }
-
- public function setId($id)
- {
- $this->setData($this->getIdFieldName(), $id);
-
- return $this;
- }
-
- public function getId()
- {
- return $this->getData($this->getIdFieldName());
- }
-
- protected function _load()
- {
- $id = func_get_arg(0);
-
- $idFieldName = null;
- if (func_num_args() >= 2) {
- $idFieldName = func_get_arg(1);
- }
- if ($idFieldName === null) {
- $idFieldName = $this->getIdFieldName();
- }
-
- $database = $this->getReadConnection();
- if ($database === null) {
- throw new CoreException\DataAccessException('Could not load data: no read connection configured.');
- }
-
- $select = $database->select()
- ->from(array('main_table' => $database->getTable($this->getTableName())))
- ->where($idFieldName, new Sql\Placeholder\Param('id', $id))
- ->limit(1);
-
- $statement = $select->prepare();
- $statement->execute(array(
- 'id' => $id
- ));
-
- $datas = $statement->fetch(Database\ConnectionManager::FETCH_ASSOC);
- if (!is_array($datas) || empty($datas)) {
- throw new CoreException\DataAccessException('Could not load data: this id could not be found.');
- }
- $realId = $datas[$this->getIdFieldName()];
- unset($datas[$this->getIdFieldName()]);
-
- $this->_data = array();
- $this->getDataMapper()->decode($this, $datas);
- $this->setId($realId);
-
- return $this;
- }
-
- protected function _save()
- {
- $adapter = $this->getWriteConnection();
-
- if ($adapter === null) {
- throw new CoreException\DataAccessException('Could not save data: no write connection configured.');
- }
-
- if ($this->getId() !== null) {
- $update = $adapter->update()
- ->into($adapter->getTable($this->getTableName()))
- ->where(new Sql\Placeholder\Expression("{$adapter->quoteIdentifier($this->getIdFieldName())}=:id", array('id' => $this->getId())));
-
- foreach ($this->getDataMapper()->encode($this, $this->getChangedDatas()) as $field => $value) {
- $update->set($field, new Sql\Placeholder\Param($field, $value));
- }
- try {
- $statement = $update->prepare();
- $statement->execute();
- } catch (CoreException\Database\AdapterError $e) {
- throw new CoreException\DataAccessException('Could not save data: ' . $e->getMessage(), null, $e);
- } catch (CoreException\Database\StatementError $e) {
- throw new CoreException\DataAccessException('Could not save data: ' . $e->getMessage(), null, $e);
- }
- } else {
- $insert = $adapter->insert()
- ->into($adapter->getTable($this->getTableName()));
-
- foreach ($this->getDataMapper()->encode($this, $this->getAllDatas()) as $field => $value) {
- $insert->set($field, new Sql\Placeholder\Param($field, $value));
- }
- try {
- $statement = $insert->prepare();
- $statement->execute();
-
- $id = $adapter->lastInsertId($adapter->getTable($this->getTableName()));
- $this->setId($id);
- } catch (CoreException\Database\AdapterError $e) {
- throw new CoreException\DataAccessException('Could not save data: ' . $e->getMessage(), null, $e);
- } catch (CoreException\Database\StatementError $e) {
- throw new CoreException\DataAccessException('Could not save data: ' . $e->getMessage(), null, $e);
- }
- }
-
- return $this;
- }
-
- protected function _delete()
- {
- $adapter = $this->getWriteConnection();
- if ($adapter === null) {
- throw new CoreException\DataAccessException('Could not delete data: no write connection configured.');
- }
- $delete = $adapter
- ->delete()
- ->from($adapter->getTable($this->getTableName()))
- ->where($this->getIdFieldName(), $this->getId())
- ->limit(1);
-
- try {
- $statement = $adapter->prepare($delete);
- $statement->execute();
- } catch (CoreException\Database\AdapterError $e) {
- throw new CoreException\DataAccessException('Could not delete data: ' . $e->getMessage(), null, $e);
- } catch (CoreException\Database\StatementError $e) {
- throw new CoreException\DataAccessException('Could not delete data: ' . $e->getMessage(), null, $e);
- }
-
- return $this;
- }
-
- public function setTableName($tableName)
- {
- $this->_tableName = $tableName;
-
- return $this;
- }
-
- public function getTableName()
- {
- return $this->_tableName;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Type/Base.php b/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Type/Base.php
deleted file mode 100644
index 631bae3..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Type/Base.php
+++ /dev/null
@@ -1,96 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Mvc\Model\Type;
-
-use Wootook\Core,
- Wootook\Core\Database\Resource,
- Wootook\Core\Exception as CoreException;
-
-/**
- * Base model implementation, should be consumed by a Wootook\Core\BaseObject derived class
- */
-trait Base
-{
- protected $_originalData = array();
-
- protected $_eventPrefix = null;
- protected $_eventObject = null;
-
- public function _construct(Array $data = array())
- {
- parent::_construct($data);
-
- $this->_init();
- $this->_setOriginalData();
- }
-
- protected function _init()
- {
- }
-
- protected function _setOriginalData()
- {
- $this->_originalData = $this->_data;
- }
-
- public function getChangedDatas()
- {
- return array_diff_assoc($this->_data, $this->_originalData);
- }
-
- public function hasChangedDatas()
- {
- if (count($this->getChangedDatas()) > 0) {
- return true;
- }
- return false;
- }
-
- public function __set($key, $value)
- {
- return $this->setData($key, $value);
- }
-
- public function __get($key)
- {
- return $this->getData($key);
- }
-
- public function __unset($key)
- {
- return $this->unsetData($key);
- }
-
- public function __isset($key)
- {
- return $this->hasData($key);
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Type/Full.php b/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Type/Full.php
deleted file mode 100644
index ef18229..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Type/Full.php
+++ /dev/null
@@ -1,46 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Mvc\Model\Type;
-
-use Wootook\Core,
- Wootook\Core\Database\Resource,
- Wootook\Core\Mvc\Model\Action;
-
-/**
- *
- * Enter description here ...
- * @author Greg
- *
- */
-trait Full
-{
- use Base, Action\Load, Action\Save, Action\Delete, Resource\ReadConnection, Resource\WriteConnection, Resource\DataMapper;
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Type/Readonly.php b/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Type/Readonly.php
deleted file mode 100644
index c210162..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Mvc/Model/Type/Readonly.php
+++ /dev/null
@@ -1,46 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Mvc\Model\Type;
-
-use Wootook\Core,
- Wootook\Core\Mvc\Model\Action,
- Wootook\Core\Exception as CoreException;
-
-/**
- *
- * Enter description here ...
- * @author Greg
- *
- */
-trait Readonly
-{
- use Base, Action\Load;
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Resource/Entity.php b/src/application/modules/WootookCore/src/Wootook/Core/Resource/Entity.php
deleted file mode 100644
index 57bdba7..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Resource/Entity.php
+++ /dev/null
@@ -1,36 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Resource;
-
-class Entity
-{
-
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Resource/EntityCollection/Action/Load.php b/src/application/modules/WootookCore/src/Wootook/Core/Resource/EntityCollection/Action/Load.php
deleted file mode 100644
index aa99624..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Resource/EntityCollection/Action/Load.php
+++ /dev/null
@@ -1,144 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Resource\EntityCollection\Action;
-
-use Wootook\Core\Database\Sql,
- Wootook\Core\Exception as CoreException;
-
-/**
- *
- */
-trait Load
-{
- /** @var Sql\Select */
- protected $_select = null;
-
- public function getSelect()
- {
- if ($this->_select === null) {
- $this->_select = $this->getReadConnection()
- ->select()
- ->from(array('main_table' => $this->getReadConnection()->getTable($this->_entityTable)));
-
- $this->_prepareSelect($this->_select);
- }
-
- return $this->_select;
- }
-
- /**
- * @return Sql\Select
- */
- public function getSelectCount(Array $maintainGrouping)
- {
- $clone = clone $this->getSelect();
- $clone->reset(Sql\Select::COLUMNS);
-
- if (empty($maintainGrouping)) {
- $clone->reset(Sql\Select::GROUP);
- } else {
- $groupingFields = $clone->getPart(Sql\Select::GROUP);
- $clone->reset(Sql\Select::GROUP);
- foreach ($groupingFields as $field) {
- if (!in_array($field, $maintainGrouping)) {
- continue;
- }
- $clone->group($field);
- }
- }
-
- $clone->column(new Sql\Placeholder\Expression('COUNT(*)'));
- }
-
- public function _prepareSelect(Sql\Select $select)
- {
- }
-
- public function _prepareSelectCount(Sql\Select $select)
- {
- }
-
- public function getSize(Array $maintainGrouping = array())
- {
- $select = $this->_getSelectCount($maintainGrouping);
-
- $database = $this->getReadConnection();
- try {
- $statement = $database->prepare($select);
-
- $statement->execute();
- $count = $statement->fetchColumn();
- $statement->closeCursor();
- } catch (\PDOException $e) {
- throw new CoreException\DataAccessException('Could not load data: ' . $e->getMessage(), 0, $e);
- }
-
- return $count;
- }
-
- public function load()
- {
- try {
- $this->_beforeLoad();
- $this->_load();
- $this->_afterLoad();
-
- $this->_setOriginalData($this->_data);
- } catch (\PDOException $e) {
- throw new CoreException\DataAccessException('Could not load data: ' . $e->getMessage(), 0, $e);
- }
- return $this;
- }
-
- abstract protected function _load();
-
- protected function _beforeLoad()
- {
- \Wootook::dispatchEvent('model.before-load', array('model' => $this));
-
- if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
- \Wootook::dispatchEvent($this->_eventPrefix . '.before-load', array($this->_eventObject => $this));
- }
-
- return $this;
- }
-
- protected function _afterLoad()
- {
- \Wootook::dispatchEvent('model.after-load', array('model' => $this));
-
- if ($this->_eventPrefix !== null && $this->_eventObject !== null) {
- \Wootook::dispatchEvent($this->_eventPrefix . '.after-load', array($this->_eventObject => $this));
- }
-
- return $this;
- }
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Resource/EntityCollection/Action/Loadable.php b/src/application/modules/WootookCore/src/Wootook/Core/Resource/EntityCollection/Action/Loadable.php
deleted file mode 100644
index 0a1eeec..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Resource/EntityCollection/Action/Loadable.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Resource\EntityCollection\Action;
-
-/**
- *
- */
-interface Loadable
-{
- public function load($entityId, $field = null, $_ = null);
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Setup/Exception/RuntimeException.php b/src/application/modules/WootookCore/src/Wootook/Core/Setup/Exception/RuntimeException.php
deleted file mode 100644
index 88e0ef9..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Setup/Exception/RuntimeException.php
+++ /dev/null
@@ -1,40 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Setup\Exception;
-
-use Wootook\Core,
- Wootook\Core\Exception as CoreException;
-
-class RuntimeException
- extends CoreException\RuntimeException
- implements Core\Exception\CoreException
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Setup/Exception/VersionStageError.php b/src/application/modules/WootookCore/src/Wootook/Core/Setup/Exception/VersionStageError.php
deleted file mode 100644
index f14909c..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Setup/Exception/VersionStageError.php
+++ /dev/null
@@ -1,39 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Setup\Exception;
-
-use Wootook\Core;
-
-class VersionStageError
- extends RuntimeException
- implements Core\Exception\CoreException
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Setup/Exception/VersionValueError.php b/src/application/modules/WootookCore/src/Wootook/Core/Setup/Exception/VersionValueError.php
deleted file mode 100644
index 95d8b39..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Setup/Exception/VersionValueError.php
+++ /dev/null
@@ -1,42 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Setup\Exception;
-
-use Wootook\Core;
-
-/**
- *
- */
-class VersionValueError
- extends \RuntimeException
- implements Core\Exception\CoreException
-{
-}
diff --git a/src/application/modules/WootookCore/src/Wootook/Core/Setup/Updater.php b/src/application/modules/WootookCore/src/Wootook/Core/Setup/Updater.php
deleted file mode 100644
index 0cdd15b..0000000
--- a/src/application/modules/WootookCore/src/Wootook/Core/Setup/Updater.php
+++ /dev/null
@@ -1,159 +0,0 @@
-
- * All rights reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- *
- * --> NOTICE <--
- * This file is part of the core development branch, changing its contents will
- * make you unable to use the automatic updates manager. Please refer to the
- * documentation for further information about customizing Wootook.
- *
- */
-
-namespace Wootook\Core\Setup;
-
-use Wootook\Core\Profiler,
- Wootook\Core\Database,
- Wootook\Core\Database\Adapter as DatabaseAdapter,
- Wootook\Core\Setup\Exception as SetupException;
-
-class Updater
-{
- protected $_setupConnection = null;
-
- /**
- *
- * Enter description here ...
- * @param unknown_type $connection
- * @return Updater
- */
- public function setSetupConnection($connection)
- {
- if (is_string($connection)) {
- $this->_setupConnection = Database\ConnectionManager::getSingleton()
- ->getConnection($connection);
- } else {
- $this->_setupConnection = $connection;
- }
-
- return $this;
- }
-
- /**
- *
- * Enter description here ...
- * @return DatabaseAdapter\Adapter
- */
- public function getSetupConnection()
- {
- if ($this->_setupConnection === null) {
- $this->setSetupConnection('default');
- }
- return $this->_setupConnection;
- }
-
- public function getTableName($tableName)
- {
- return $this->getSetupConnection()->getTable($tableName);
- }
-
- public function query($statement)
- {
- try {
- if (!$this->getSetupConnection()->query($statement)) {
- $info = $this->getSetupConnection()->errorInfo();
- throw new SetupException\RuntimeException(
- \Wootook::__('Query failed: SQLSTATE %s: %s.', $info[1], $info[2]));
- }
- } catch (PDOException $e) {
- Profiler\ErrorProfiler::getSingleton()->exceptionManager($e);
- throw new SetupException\RuntimeException($e->getMessage(), null, $e);
- }
- }
-
- public function grant($tableName, $connectionName, $perms = null)
- {
- $hostname = \Wootook::app()->getGlobalConfig("database/{$connectionName}/params/hostname");
- $username = \Wootook::app()->getGlobalConfig("database/{$connectionName}/params/username");
- $database = \Wootook::app()->getGlobalConfig("database/{$connectionName}/params/database");
- $password = \Wootook::app()->getGlobalConfig("database/{$connectionName}/params/password");
-
- if ($perms === null) {
- $perms = 'ALL PRIVILEGES';
- } else if (is_array($perms)) {
- $perms = implode(' ', $perms);
- }
-
- $sql =<<getTable($tableName)}
-TO '{$username}@{$hostname}' IDENTIFIED BY '$password'
-SQL_EOF;
-
- $this->getSetupConnection()->query($sql);
-
- return $this;
- }
-
- public function revoke($tableName, $connectionName, $perms = null)
- {
- $hostname = \Wootook::app()->getGlobalConfig("database/{$connectionName}/params/hostname");
- $username = \Wootook::app()->getGlobalConfig("database/{$connectionName}/params/username");
- $database = \Wootook::app()->getGlobalConfig("database/{$connectionName}/params/database");
- $password = \Wootook::app()->getGlobalConfig("database/{$connectionName}/params/password");
-
- if ($perms === null) {
- $perms = 'ALL PRIVILEGES';
- } else if (is_array($perms)) {
- $perms = implode(' ', $perms);
- }
-
- $sql =<<getTable($tableName)}
-FROM '{$username}@{$hostname}'
-SQL_EOF;
-
- $this->getSetupConnection()->query($sql);
-
- return $this;
- }
-
- public function run($script)
- {
- include $script;
- }
-
- public function getConfig($path = null)
- {
- return \Wootook::app()->getGlobalConfig($path);
- }
-
- public function getWebsiteConfig($path = null, $websiteId = null)
- {
- return \Wootook::app()->getWebsite($websiteId)->getConfig($path);
- }
-
- public function getGameConfig($path = null, $gameId = null)
- {
- return \Wootook::app()->getGame($gameId)->getConfig($path);
- }
-}
diff --git a/src/application/modules/WootookCore/test/bootstrap.php b/src/application/modules/WootookCore/test/bootstrap.php
deleted file mode 100644
index 858d9f2..0000000
--- a/src/application/modules/WootookCore/test/bootstrap.php
+++ /dev/null
@@ -1,13 +0,0 @@
-getMock('Wootook\\Core\\App\\App', $methods, $constructorArgs);
- }
-
- public function testConfigurationLoadingWithEnvironments()
- {
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Base/BaseObjectTest.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Base/BaseObjectTest.php
deleted file mode 100644
index f8fce1b..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Base/BaseObjectTest.php
+++ /dev/null
@@ -1,227 +0,0 @@
-_app = $this->getMock('Wootook\\Core\\App\\App', array('__construct'), array(''));
- }
-
- public function testAppMethod()
- {
- $object = new Base\BaseObject($this->_app);
-
- $this->assertAttributeSame($this->_app, '_app', $object);
-
- $this->assertSame($this->_app, $object->app());
- }
-
- public function testSetData()
- {
- $object = new Base\BaseObject($this->_app);
-
- $this->assertAttributeEmpty('_data', $object);
-
- $object->setData('test', true);
- $expected = array('test' => true);
- $this->assertAttributeEquals($expected, '_data', $object);
-
- $object->setData('test', 'testing');
- $expected = array('test' => 'testing');
- $this->assertAttributeEquals($expected, '_data', $object);
- }
-
- /**
- * @requires testSetData
- */
- public function testGetData()
- {
- $object = new Base\BaseObject($this->_app);
-
- $object->setData('test', 'testing');
-
- $this->assertEquals('testing', $object->getData('test'));
-
- $object->setData('test', true);
- $this->assertTrue($object->getData('test'));
-
- $this->assertNull($object->getData('testing'));
- }
-
- /**
- * @requires testSetData
- * @requires testGetData
- */
- public function testGetAllDatas()
- {
- $object = new Base\BaseObject($this->_app);
-
- $object->setData('test', 'testing');
-
- $expected = array('test' => 'testing');
- $this->assertEquals($expected, $object->getAllDatas());
-
- $object->setData('test', true);
- $expected = array('test' => true);
- $this->assertEquals($expected, $object->getAllDatas());
- }
-
- /**
- * @requires testSetData
- * @requires testGetData
- */
- public function testHasData()
- {
- $object = new Base\BaseObject($this->_app);
-
- $object->setData('test', 'testing');
-
- $this->assertTrue($object->hasData('test'));
- $this->assertFalse($object->hasData('testing'));
- }
-
- /**
- * @requires testSetData
- */
- public function testAddData()
- {
- $object = new Base\BaseObject($this->_app);
-
- $object->setData('test', 'testing');
-
- $expected = array(
- 'test' => 'testing',
- 'testing' => true,
- 'legacies' => false
- );
-
- $object->addData(array(
- 'testing' => true,
- 'legacies' => false
- ));
- $this->assertAttributeEquals($expected, '_data', $object);
-
- $expected = array(
- 'test' => 'legacies',
- 'testing' => false,
- 'legacies' => 'Wootook_Object'
- );
-
- $object->addData($expected);
- $this->assertAttributeEquals($expected, '_data', $object);
- }
-
- /**
- * @requires testSetData
- */
- public function testUnsetData()
- {
- $object = new Base\BaseObject($this->_app);
-
- $object->setData('test', 'testing');
- $object->setData('testing', true);
- $object->setData('removed', 'me!');
- $object->setData('legacies', false);
-
- $expected = array(
- 'test' => 'testing',
- 'testing' => true,
- 'legacies' => false
- );
-
- $object->unsetData('removed');
- $this->assertAttributeEquals($expected, '_data', $object);
- }
-
- public function testClearData()
- {
- $object = new Base\BaseObject($this->_app);
-
- $object->setData('test', 'testing');
- $object->setData('testing', true);
- $object->setData('removed', 'me!');
- $object->setData('legacies', false);
-
- $expected = array(
- 'test' => 'testing',
- 'testing' => true,
- 'legacies' => false
- );
-
- $object->clearData();
- $this->assertAttributeEmpty('_data', $object);
- }
-
- /**
- * @requires testSetData
- * @requires testHasData
- */
- public function testOffsetExists()
- {
- $object = new Base\BaseObject($this->_app);
-
- $object->setData('test', 'testing');
-
- $this->assertTrue(isset($object['test']));
- }
-
- /**
- * @requires testSetData
- * @requires testGetData
- */
- public function testOffsetGet()
- {
- $object = new Base\BaseObject($this->_app);
-
- $object->setData('test', 'testing');
-
- $this->assertEquals('testing', $object['test']);
- }
-
- /**
- * @requires testGetData
- * @requires testSetData
- */
- public function testOffsetSet()
- {
- $object = new Base\BaseObject($this->_app);
-
- $object['test'] = 'testing';
-
- $this->assertEquals('testing', $object->getData('test'));
- }
-
- /**
- * @requires testSetData
- * @requires testGetData
- */
- public function testOffsetUnset()
- {
- $object = new Base\BaseObject($this->_app);
-
- $object->setData('test', 'testing');
-
- unset($object['test']);
-
- $this->assertAttributeEmpty('_data', $object);
- $this->assertNull($object->getData('test'));
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Config/NodeTest.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Config/NodeTest.php
deleted file mode 100644
index dcaa6d9..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Config/NodeTest.php
+++ /dev/null
@@ -1,518 +0,0 @@
-assertAttributeEmpty('_children', $object);
- $this->assertAttributeEquals(null, '_parent', $object);
- }
-
- public function testCreateEmptyWithoutParentCheckInitMethodCallWithInitialData()
- {
- $dataItems = array(
- 'first-child' => 1,
- 'second-child' => 2,
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $mock = $this->getMock('Wootook\\Core\\Config\\Node', array('__construct', '_init'), array($dataItems), '', false);
-
- $mock->expects($this->once())
- ->method('_init')
- ->with($this->equalTo($dataItems))
- ;
-
- $mock->__construct($dataItems);
- $this->assertAttributeNotEmpty('_children', $mock);
- }
-
- public function testCreateEmptyWithParent()
- {
- $parent = new Config\Node();
- $object = new Config\Node(array(), $parent);
-
- $this->assertAttributeEmpty('_children', $object);
- $this->assertAttributeEquals($parent, '_parent', $object);
- $this->assertEquals($parent, $object->getParent());
- }
-
- public function testDirectChildAccessWithObjectNotation()
- {
- $object = new Config\Node();
-
- $object->testingAttribute = 'testing random data';
- $this->assertAttributeEquals(array('testing-attribute' => 'testing random data'), '_children', $object);
-
- $this->assertEquals('testing random data', $object->testingAttribute);
-
- $this->assertEquals(true, isset($object->testingAttribute));
-
- unset($object->testingAttribute);
- $this->assertAttributeEmpty('_children', $object);
- }
-
- public function testDirectChildAccessWithArrayNotation()
- {
- $object = new Config\Node();
-
- $object['testing-attribute'] = 'testing random data';
- $this->assertAttributeEquals(array('testing-attribute' => 'testing random data'), '_children', $object);
-
- $this->assertEquals('testing random data', $object['testing-attribute']);
-
- $this->assertEquals(true, isset($object['testing-attribute']));
-
- unset($object['testing-attribute']);
- $this->assertAttributeEmpty('_children', $object);
- }
-
- public function testDirectChildSettingArrayNotationWithoutKey()
- {
- $object = new Config\Node();
-
- $object[] = 'testing random data';
- $this->assertAttributeEquals(array('testing random data'), '_children', $object);
- }
-
- public function testDirectChildGettingArrayNotationKeyNotExists()
- {
- $object = new Config\Node();
-
- $this->assertEquals(null, $object['inexistent']);
- }
-
- public function testSwitchingArrayNotationToObjectNotation()
- {
- $object = new Config\Node();
-
- $object['testing-attribute'] = 'testing random data';
- $this->assertEquals('testing random data', $object->testingAttribute);
-
- $this->assertEquals(true, isset($object->testingAttribute));
-
- unset($object->testingAttribute);
- $this->assertAttributeEmpty('_children', $object);
- }
-
- public function testSwitchingObjectNotationToArrayNotation()
- {
- $object = new Config\Node();
-
- $object->testingAttribute = 'testing random data';
- $this->assertEquals('testing random data', $object['testing-attribute']);
-
- $this->assertEquals(true, isset($object['testing-attribute']));
-
- unset($object['testing-attribute']);
- $this->assertAttributeEmpty('_children', $object);
- }
-
- public function testGetConfigByPath()
- {
- $parent = new Config\Node();
- $object = new Config\Node(array(), $parent);
-
- $parent->superChild = $object;
- $object->testingAttribute = 'testing random data';
-
- $this->assertEquals('testing random data', $parent->getConfig('super-child/testing-attribute'));
- }
-
- public function testGetConfigAsArray()
- {
- $parent = new Config\Node();
- $object = new Config\Node(array(), $parent);
-
- $parent->superChild = $object;
- $object->testingAttribute = 'testing random data';
-
- $this->assertEquals(array('super-child' => array('testing-attribute' => 'testing random data')), $parent->toArray());
- }
-
- public function testCount()
- {
- $object = new Config\Node(array(
- 'first-child' => 1,
- 'second-child' => 2,
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- ));
-
- $this->assertCount(4, $object);
- }
-
- protected function _getIteratorMock($class, $dataItems, $useKeys = false)
- {
- $mock = $this->getMock($class, array(), array($dataItems));
-
- $callCounter = 0;
- $mock->expects($this->at($callCounter++))
- ->method('rewind')
- ;
- foreach ($dataItems as $dataKey => $dataValue) {
- $mock->expects($this->at($callCounter++))
- ->method('valid')
- ->will($this->returnValue(true))
- ;
-
- $mock->expects($this->at($callCounter++))
- ->method('current')
- ->will($this->returnValue($dataValue))
- ;
-
- if ($useKeys === true) {
- $mock->expects($this->at($callCounter++))
- ->method('key')
- ->will($this->returnValue($dataKey))
- ;
- }
- $mock->expects($this->at($callCounter++))
- ->method('next')
- ;
- }
- $mock->expects($this->at($callCounter))
- ->method('valid')
- ->will($this->returnValue(false))
- ;
-
- return $mock;
- }
-
- /**
- * @covers Wootook\Core\Config\Node::rewind
- * @covers Wootook\Core\Config\Node::valid
- * @covers Wootook\Core\Config\Node::current
- * @covers Wootook\Core\Config\Node::next
- */
- public function testIteratorOneItemWithoutKey()
- {
- $dataItems = array(
- 'first-child' => 1,
- );
-
- $mock = $this->_getIteratorMock('Wootook\\Core\\Config\\Node', $dataItems);
-
- $counter = 0;
- foreach ($mock as $value) {
- $counter++;
- }
-
- $this->assertEquals(1, $counter);
- }
-
- /**
- * @covers Wootook\Core\Config\Node::rewind
- * @covers Wootook\Core\Config\Node::valid
- * @covers Wootook\Core\Config\Node::key
- * @covers Wootook\Core\Config\Node::current
- * @covers Wootook\Core\Config\Node::next
- */
- public function testIteratorOneItemWithKey()
- {
- $dataItems = array(
- 'first-child' => 1,
- );
-
- $mock = $this->_getIteratorMock('Wootook\\Core\\Config\\Node', $dataItems, true);
-
- $counter = 0;
- foreach ($mock as $key => $value) {
- $counter++;
- }
-
- $this->assertEquals(1, $counter);
- }
-
- /**
- * @covers Wootook\Core\Config\Node::rewind
- * @covers Wootook\Core\Config\Node::valid
- * @covers Wootook\Core\Config\Node::current
- * @covers Wootook\Core\Config\Node::next
- */
- public function testIteratorMultipleItemsWithoutKey()
- {
- $dataItems = array(
- 'first-child' => 1,
- 'second-child' => 2,
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $mock = $this->_getIteratorMock('Wootook\\Core\\Config\\Node', $dataItems);
-
- $counter = 0;
- foreach ($mock as $value) {
- $counter++;
- }
-
- $this->assertEquals(4, $counter);
- }
-
- /**
- * @covers Wootook\Core\Config\Node::rewind
- * @covers Wootook\Core\Config\Node::valid
- * @covers Wootook\Core\Config\Node::key
- * @covers Wootook\Core\Config\Node::current
- * @covers Wootook\Core\Config\Node::next
- */
- public function testIteratorMultipleItemsWithKey()
- {
- $dataItems = array(
- 'first-child' => 1,
- 'second-child' => 2,
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $mock = $this->_getIteratorMock('Wootook\\Core\\Config\\Node', $dataItems, true);
-
- $counter = 0;
- foreach ($mock as $key => $value) {
- $counter++;
- }
-
- $this->assertEquals(4, $counter);
- }
-
- /**
- * @covers Wootook\Core\Config\Node::rewind
- * @covers Wootook\Core\Config\Node::valid
- * @covers Wootook\Core\Config\Node::key
- * @covers Wootook\Core\Config\Node::current
- * @covers Wootook\Core\Config\Node::next
- */
- public function testIterator()
- {
- $dataItems = array(
- 'first-child' => 1,
- 'second-child' => 2,
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $mock = new Config\Node($dataItems);
-
- $counter = 0;
- reset($dataItems);
- foreach ($mock as $key => $value) {
- $this->assertEquals(key($dataItems), $key);
- $this->assertEquals(current($dataItems), $value);
- next($dataItems);
- $counter++;
- }
-
- $this->assertEquals(4, $counter);
- }
-
- public function testTwoLevelsHierarchyInitializationWithPathRequest()
- {
- $dataItems = array(
- 'first-child' => 1,
- 'second-child' => array(
- 'first-sub-child' => 1,
- 'second-sub-child' => 1,
- ),
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $mock = new Config\Node($dataItems);
- $this->assertInstanceOf('Wootook\\Core\\Config\\Node', $mock->getConfig('second-child'));
- $this->assertEquals(1, $mock->getConfig('second-child/second-sub-child'));
- }
-
- public function testTwoLevelsHierarchyInitializationWithInexistentPathRequest()
- {
- $dataItems = array(
- 'first-child' => 1,
- 'second-child' => array(
- 'first-sub-child' => 1,
- 'second-sub-child' => 1,
- ),
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $mock = new Config\Node($dataItems);
- $this->assertEquals(null, $mock->getConfig('second-child/third-inexisting-sub-child'));
- }
-
- public function testTwoLevelsHierarchyInitializationTooDeepPathRequest()
- {
- $dataItems = array(
- 'first-child' => 1,
- 'second-child' => array(
- 'first-sub-child' => 1,
- 'second-sub-child' => 1,
- ),
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $mock = new Config\Node($dataItems);
- $this->setExpectedException('Wootook\\Core\\Exception\\RuntimeException');
- $mock->getConfig('second-child/second-sub-child/inexistent-depth-child');
- }
-
- public function testClone()
- {
- $dataItems = array(
- 'first-child' => 1,
- 'second-child' => array(
- 'first-sub-child' => 1,
- 'second-sub-child' => 1,
- ),
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $object = new Config\Node($dataItems);
- $clone = clone $object;
- $this->assertEquals($dataItems, $clone->toArray());
- }
-
- public function testUseNumericAttribute()
- {
- $object = new Config\Node();
- $object->{1} = 'first-child';
- $this->assertEquals('first-child', $object->{1});
- $this->assertEquals(array(1 => 'first-child'), $object->toArray());
- }
-
- public function testMergeConfigs()
- {
- $rootDataItems = array(
- 'first-child' => 1,
- 'second-child' => array(
- 'first-sub-child' => 1,
- 'second-sub-child' => 2,
- ),
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
- $secondaryDataItems = array(
- 'second-sub-child' => 3,
- 'third-sub-child' => '72',
- 'fourth-sub-child' => array(
- 'random-level-child' => 54
- ),
- );
- $expectedDataItems = array(
- 'first-child' => 1,
- 'second-child' => array(
- 'first-sub-child' => 1,
- 'second-sub-child' => 3,
- 'third-sub-child' => '72',
- 'fourth-sub-child' => array(
- 'random-level-child' => 54
- ),
- ),
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $root = new Config\Node($rootDataItems);
- $secondary = new Config\Node($secondaryDataItems);
- $root->secondChild->merge($secondary);
- $this->assertEquals($expectedDataItems, $root->toArray());
- }
-
- public function testResetConfig()
- {
- $dataItems = array(
- 'first-child' => 1,
- 'second-child' => array(
- 'first-sub-child' => 1,
- 'second-sub-child' => 2,
- ),
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $object = new Config\Node($dataItems);
- $object->reset();
- $this->assertEmpty($object->toArray());
- }
-
- public function testSetConfig()
- {
- $dataItems = array(
- 'first-child' => 1,
- 'second-child' => array(
- 'first-sub-child' => 1,
- 'second-sub-child' => 3,
- 'third-sub-child' => '72',
- 'fourth-sub-child' => array(
- 'random-level-child' => 54
- ),
- ),
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $expected = array(
- 'first-child' => 1,
- 'second-child' => array(
- 'first-sub-child' => 1,
- 'second-sub-child' => 3,
- 'third-sub-child' => '72',
- 'fourth-sub-child' => array(
- 'random-level-child' => 72
- ),
- ),
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $object = new Config\Node($dataItems);
- $object->setConfig('second-child/fourth-sub-child/random-level-child', 72);
- $this->assertEquals($expected, $object->toArray());
- }
-
- public function testSetConfigExpectError()
- {
- $dataItems = array(
- 'first-child' => 1,
- 'second-child' => array(
- 'first-sub-child' => 1,
- 'second-sub-child' => 3,
- 'third-sub-child' => '72',
- 'fourth-sub-child' => array(
- 'random-level-child' => 54
- ),
- ),
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $expected = array(
- 'first-child' => 1,
- 'second-child' => array(
- 'first-sub-child' => 1,
- 'second-sub-child' => 3,
- 'third-sub-child' => '72',
- 'fourth-sub-child' => array(
- 'random-level-child' => 72
- ),
- ),
- '3rd-child' => '3rd',
- 'fourth-child' => '4th'
- );
-
- $object = new Config\Node($dataItems);
- $this->setExpectedException('Wootook\\Core\\Exception\\RuntimeException');
- $object->setConfig('second-child/third-sub-child/random-inexisting-level-child', 72);
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Condition/ConditionTest.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Condition/ConditionTest.php
deleted file mode 100644
index 771d872..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Condition/ConditionTest.php
+++ /dev/null
@@ -1,210 +0,0 @@
-_setUp();
-
- $this->_conditionMockClassName = 'Wootook\\Core\\Database\\Sql\\Dml\\Condition\\Condition';
- }
-
- protected function _setUp()
- {
- $this->_adapterMock = $this->getMockForAbstractClass('Wootook\\Core\\Database\\Adapter\\Adapter');
- $this->_queryMock = $this->getMockForAbstractClass('Wootook\\Core\\Database\\Sql\\Dml\\DmlQuery', array($this->_adapterMock));
- $this->_statementMock = $this->getMockForAbstractClass('Wootook\\Core\\Database\\Statement\\Statement', array($this->_adapterMock, $this->_queryMock));
- }
-
- protected function buildMock(Array $methods = array(), $callOriginalconstructor = true, $callOriginalClone = true)
- {
- return $this->getMockForAbstractClass($this->_conditionMockClassName, array(), '', $callOriginalconstructor, $callOriginalClone, true, $methods);
- }
-
- public function callNonPublicMethod($object, $method, Array $params = array())
- {
- $conditionMock = $this->buildMock();
-
- $method = new \ReflectionMethod(get_class($object), $method);
- $method->setAccessible(true);
-
- return $method->invokeArgs($conditionMock, $params);
- }
-
- public function testMagicToString()
- {
- $conditionMock = $this->buildMock(array('render'));
- $conditionMock->expects($this->once())
- ->method('render')
- ->will($this->returnValue('foo'))
- ;
-
- $this->assertInternalType('string', $conditionMock->__toString());
- }
-
- public function testMagicToStringWithRenderReturnsNull()
- {
- $conditionMock = $this->buildMock(array('render'));
- $conditionMock->expects($this->once())
- ->method('render')
- ->will($this->returnValue(null))
- ;
-
- $this->assertInternalType('string', $conditionMock->__toString());
- }
-
- public function testMagicToStringWithRenderReturnsInt()
- {
- $conditionMock = $this->buildMock(array('render'));
- $conditionMock->expects($this->once())
- ->method('render')
- ->will($this->returnValue(32))
- ;
-
- $this->assertInternalType('string', $conditionMock->__toString());
- }
-
- public function testMagicToStringWithRenderReturnsFloat()
- {
- $conditionMock = $this->buildMock(array('render'));
- $conditionMock->expects($this->once())
- ->method('render')
- ->will($this->returnValue(.1))
- ;
-
- $this->assertInternalType('string', $conditionMock->__toString());
- }
-
- public function testQueryAccessMethods()
- {
- $conditionMock = $this->buildMock();
- $adapter = $this->getMockForAbstractClass('Wootook\\Core\\Database\\Adapter\\Adapter');
- $query = $this->getMockForAbstractClass('Wootook\\Core\\Database\\Sql\\Dml\\DmlQuery', array($adapter));
-
- $conditionMock->setQuery($query);
-
- $this->assertSame($query, $conditionMock->getQuery());
- }
-
- /**
- * @expectedException \PHPUnit_Framework_Error
- */
- public function testSetQueryWithInvalidParameter()
- {
- $conditionMock = $this->buildMock();
- $conditionMock->setQuery('SELECT * FROM my_table');
- }
-
- public function testPlaceholderAssignment()
- {
- $conditionMock = $this->buildMock();
- $placeholderMock = $this->getMockForAbstractClass('Wootook\\Core\\Database\\Sql\\Placeholder\\Placeholder');
-
- $conditionMock->addPlaceholder($placeholderMock);
-
- $result = $conditionMock->getAllPlaceholders();
- $this->assertArrayHasKey(0, $result);
- $this->assertSame($placeholderMock, $result[0]);
- }
-
- public function testPlaceholderClearing()
- {
- $conditionMock = $this->buildMock();
- $placeholderMock = $this->getMockForAbstractClass('Wootook\\Core\\Database\\Sql\\Placeholder\\Placeholder');
-
- $conditionMock->addPlaceholder($placeholderMock);
- $conditionMock->addPlaceholder($placeholderMock);
- $conditionMock->clearPlaceholders();
-
- $expected = array();
- $this->assertEquals($expected, $conditionMock->getAllPlaceholders());
- }
-
- public function testPlaceholderCallTrigger_beforePrepare()
- {
- /** @var \Wootook\Core\Database\Sql\Dml\Condition\Condition $conditionMock */
- $conditionMock = $this->buildMock();
- $placeholderMock = $this->getMockForAbstractClass('Wootook\\Core\\Database\\Sql\\Placeholder\\Placeholder',
- array(), '', true, true, true, array('beforePrepare'));
-
- $placeholderMock->expects($this->once())
- ->method('beforePrepare')
- ->with($this->_statementMock)
- ;
-
- $conditionMock->addPlaceholder($placeholderMock);
-
- $conditionMock->beforePrepare($this->_statementMock);
- }
-
- public function testPlaceholderCallTrigger_afterPrepare()
- {
- $conditionMock = $this->buildMock();
- $placeholderMock = $this->getMockForAbstractClass('Wootook\\Core\\Database\\Sql\\Placeholder\\Placeholder',
- array(), '', true, true, true, array('afterPrepare'));
-
- $placeholderMock->expects($this->once())
- ->method('afterPrepare')
- ->with($this->_statementMock)
- ;
-
- $conditionMock->addPlaceholder($placeholderMock);
-
- $conditionMock->afterPrepare($this->_statementMock);
- }
-
- public function testPlaceholderCallTrigger_beforeExecute()
- {
- $conditionMock = $this->buildMock();
- $placeholderMock = $this->getMockForAbstractClass('Wootook\\Core\\Database\\Sql\\Placeholder\\Placeholder',
- array(), '', true, true, true, array('beforeExecute'));
-
- $placeholderMock->expects($this->once())
- ->method('beforeExecute')
- ->with($this->_statementMock)
- ;
-
- $conditionMock->addPlaceholder($placeholderMock);
-
- $conditionMock->beforeExecute($this->_statementMock);
- }
-
- public function testPlaceholderCallTrigger_afterExecute()
- {
- $conditionMock = $this->buildMock();
- $placeholderMock = $this->getMockForAbstractClass('Wootook\\Core\\Database\\Sql\\Placeholder\\Placeholder',
- array(), '', true, true, true, array('afterExecute'));
-
- $placeholderMock->expects($this->once())
- ->method('afterExecute')
- ->with($this->_statementMock)
- ;
-
- $conditionMock->addPlaceholder($placeholderMock);
-
- $conditionMock->afterExecute($this->_statementMock);
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Condition/LogicalOperatorTest.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Condition/LogicalOperatorTest.php
deleted file mode 100644
index 10758e8..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Condition/LogicalOperatorTest.php
+++ /dev/null
@@ -1,67 +0,0 @@
-_setUp();
-
- $this->_conditionMockClassName = 'Wootook\\Core\\Database\\Sql\\Dml\\Condition\\LogicalOperator';
- }
-
- protected function buildMock(Array $methods = array(), $callOriginalconstructor = true, $callOriginalClone = true)
- {
- return $this->getMockForAbstractClass($this->_conditionMockClassName, array($this->_queryMock), '', $callOriginalconstructor, $callOriginalClone, true, $methods);
- }
-
- public function testOperatorAccessMethods()
- {
- $conditionMock = $this->buildMock(array($this->_queryMock));
-
- $conditionMock->setOperator(Dml\Section\WhereAware::OPERATOR_NOT);
- $this->assertEquals(Dml\Section\WhereAware::OPERATOR_NOT, $conditionMock->getOperator());
-
- $conditionMock->setOperator(Dml\Section\WhereAware::OPERATOR_AND);
- $this->assertEquals(Dml\Section\WhereAware::OPERATOR_AND, $conditionMock->getOperator());
-
- $conditionMock->setOperator(Dml\Section\WhereAware::OPERATOR_NAND);
- $this->assertEquals(Dml\Section\WhereAware::OPERATOR_NAND, $conditionMock->getOperator());
-
- $conditionMock->setOperator(Dml\Section\WhereAware::OPERATOR_OR);
- $this->assertEquals(Dml\Section\WhereAware::OPERATOR_OR, $conditionMock->getOperator());
-
- $conditionMock->setOperator(Dml\Section\WhereAware::OPERATOR_NOR);
- $this->assertEquals(Dml\Section\WhereAware::OPERATOR_NOR, $conditionMock->getOperator());
-
- $conditionMock->setOperator(Dml\Section\WhereAware::OPERATOR_XOR);
- $this->assertEquals(Dml\Section\WhereAware::OPERATOR_XOR, $conditionMock->getOperator());
-
- $conditionMock->setOperator(Dml\Section\WhereAware::OPERATOR_NXOR);
- $this->assertEquals(Dml\Section\WhereAware::OPERATOR_NXOR, $conditionMock->getOperator());
- }
-
- public function testNewOperatorAssignment()
- {
- $conditionMock = $this->buildMock(array($this->_queryMock));
- $closure = function(\Wootook\Core\Database\Sql\Dml\Condition\LogicalOperator $conditions){
- return 'foo';
- };
- $conditionMock->addAllowedOperator('inexistent', $closure);
-
- $this->assertSame($closure, $conditionMock->getAllowedOperatorRenderer('inexistent'));
- }
-
- /**
- * @expectedException \Wootook\Core\Exception\InvalidArgumentException
- */
- public function testInexistentOperatorAssignment()
- {
- $conditionMock = $this->buildMock(array($this->_queryMock));
- $conditionMock->setOperator('inexistent');
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/ColumnMock.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/ColumnMock.php
deleted file mode 100644
index 643dd01..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/ColumnMock.php
+++ /dev/null
@@ -1,13 +0,0 @@
-getMockForAbstractClass('Wootook\\Core\\Database\\Adapter\\Adapter');
- $this->_mock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\ColumnMock', array($adapter));
- }
-
- public function testAddColumnWithoutTableWithoutAlias()
- {
- $this->_mock->column('foo_column');
-
- $expected = array(
- array(
- 'field' => 'foo_column',
- 'alias' => null,
- 'table' => null
- )
- );
- $this->assertEquals($expected, $this->_mock->getPart(ColumnMock::COLUMNS));
- }
-
- public function testAddColumnWithTableWithoutAlias()
- {
- $this->_mock->column('foo_column', 'testing_table');
-
- $expected = array(
- array(
- 'field' => 'foo_column',
- 'alias' => null,
- 'table' => 'testing_table'
- )
- );
-
- $this->assertEquals($expected, $this->_mock->getPart(ColumnMock::COLUMNS));
- }
-
- public function testAddOneTableWithoutTableWithAlias()
- {
- $this->_mock->column(array('my_alias' => 'foo_column'));
-
- $expected = array(
- array(
- 'field' => 'foo_column',
- 'alias' => 'my_alias',
- 'table' => null
- )
- );
- $this->assertEquals($expected, $this->_mock->getPart(ColumnMock::COLUMNS));
- }
-
- public function testAddColumnWithTableWithAlias()
- {
- $this->_mock->column(array('my_alias' => 'foo_column'), 'testing_table');
-
- $expected = array(
- array(
- 'field' => 'foo_column',
- 'alias' => 'my_alias',
- 'table' => 'testing_table'
- )
- );
-
- $this->assertEquals($expected, $this->_mock->getPart(ColumnMock::COLUMNS));
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/FromMock.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/FromMock.php
deleted file mode 100644
index 7d8354c..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/FromMock.php
+++ /dev/null
@@ -1,13 +0,0 @@
-getMockForAbstractClass('Wootook\\Core\\Database\\Adapter\\Adapter');
- $this->_mock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\FromMock', array($adapter));
- }
-
- public function testSetOneTableWithoutSchemaWithoutAlias()
- {
- $this->_mock->from('foo_table');
-
- $expected = array(
- array(
- 'table' => 'foo_table',
- 'alias' => null,
- 'schema' => null
- )
- );
- $this->assertEquals($expected, $this->_mock->getPart(FromMock::FROM));
- }
-
- public function testSetTableWithSchemaWithoutAlias()
- {
- $this->_mock->from('foo_table', 'testing_schema');
-
- $expected = array(
- array(
- 'table' => 'foo_table',
- 'alias' => null,
- 'schema' => 'testing_schema'
- )
- );
-
- $this->assertEquals($expected, $this->_mock->getPart(FromMock::FROM));
- }
-
- public function testSetOneTableWithoutSchemaWithAlias()
- {
- $this->_mock->from(array('my_alias' => 'foo_table'));
-
- $expected = array(
- array(
- 'table' => 'foo_table',
- 'alias' => 'my_alias',
- 'schema' => null
- )
- );
- $this->assertEquals($expected, $this->_mock->getPart(FromMock::FROM));
- }
-
- public function testSetTableWithSchemaWithAlias()
- {
- $this->_mock->from(array('my_alias' => 'foo_table'), 'testing_schema');
-
- $expected = array(
- array(
- 'table' => 'foo_table',
- 'alias' => 'my_alias',
- 'schema' => 'testing_schema'
- )
- );
-
- $this->assertEquals($expected, $this->_mock->getPart(FromMock::FROM));
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/IntoMock.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/IntoMock.php
deleted file mode 100644
index 0d39fb4..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/IntoMock.php
+++ /dev/null
@@ -1,13 +0,0 @@
-getMockForAbstractClass('Wootook\\Core\\Database\\Adapter\\Adapter');
- $this->_mock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\IntoMock', array($adapter));
- }
-
- public function testSetTableWithoutSchema()
- {
- $this->_mock->into('foo_table');
-
- $expected = array(
- 'table' => 'foo_table',
- 'schema' => null
- );
- $this->assertEquals($expected, $this->_mock->getPart(IntoMock::INTO));
- }
-
- public function testSetTableWithSchema()
- {
- $this->_mock->into('foo_table', 'testing_schema');
-
- $expected = array(
- 'table' => 'foo_table',
- 'schema' => 'testing_schema'
- );
- $this->assertEquals($expected, $this->_mock->getPart(IntoMock::INTO));
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/LimitMock.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/LimitMock.php
deleted file mode 100644
index 774461f..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/LimitMock.php
+++ /dev/null
@@ -1,13 +0,0 @@
-getMockForAbstractClass('Wootook\\Core\\Database\\Adapter\\Adapter');
- $this->_mock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\LimitMock', array($adapter));
- }
-
- public function testSetLimitWithoutOffset()
- {
- $this->_mock->limit(100);
-
- $this->assertEquals(100, $this->_mock->getPart(LimitMock::LIMIT));
- $this->assertEquals(0, $this->_mock->getPart(LimitMock::OFFSET));
- }
-
- public function testSetLimitWithOffset()
- {
- $this->_mock->limit(100, 20);
-
- $this->assertEquals(100, $this->_mock->getPart(LimitMock::LIMIT));
- $this->assertEquals(20, $this->_mock->getPart(LimitMock::OFFSET));
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/ColumnMock.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/ColumnMock.php
deleted file mode 100644
index fe66d53..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/ColumnMock.php
+++ /dev/null
@@ -1,12 +0,0 @@
-getMockForAbstractClass('Wootook\\Core\\Database\\Adapter\\Adapter');
-
- $adapterMock->expects($this->any())
- ->method('quoteIdentifier')
- ->will($this->returnArgument(0))
- ;
-
- $this->_queryMock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\ColumnMock', array($adapterMock));
- $this->_rendererMock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\ColumnMock');
- }
-
- public function testRenderColumnWithoutTableWithoutAlias()
- {
- $this->_queryMock->column('foo_column');
-
- $this->assertRegExp('#\s*[a-zA-Z_][a-zA-Z0-9_]+\s*#', $this->_rendererMock->renderColumn($this->_queryMock));
- }
-
- public function testRenderColumnWithTableWithoutAlias()
- {
- $this->_queryMock->column('foo_column', 'testing_table');
-
- $this->assertRegExp('#\s*[a-zA-Z_][a-zA-Z0-9_]+\.[a-zA-Z_][a-zA-Z0-9_]+\s*#', $this->_rendererMock->renderColumn($this->_queryMock));
- }
-
- public function testRenderOneTableWithoutTableWithAlias()
- {
- $this->_queryMock->column(array('my_alias' => 'foo_column'));
-
- $this->assertRegExp('#\s*[a-zA-Z_][a-zA-Z0-9_]+\s+AS\s+[a-zA-Z_][a-zA-Z0-9_]+\s*#', $this->_rendererMock->renderColumn($this->_queryMock));
- }
-
- public function testRenderColumnWithTableWithAlias()
- {
- $this->_queryMock->column(array('my_alias' => 'foo_column'), 'testing_table');
-
- $this->assertRegExp('#\s*[a-zA-Z_][a-zA-Z0-9_]+\.[a-zA-Z_][a-zA-Z0-9_]+\s+AS\s+[a-zA-Z_][a-zA-Z0-9_]+\s*#', $this->_rendererMock->renderColumn($this->_queryMock));
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/FromMock.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/FromMock.php
deleted file mode 100644
index 833908c..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/FromMock.php
+++ /dev/null
@@ -1,12 +0,0 @@
-getMockForAbstractClass('Wootook\\Core\\Database\\Adapter\\Adapter');
-
- $adapterMock->expects($this->any())
- ->method('quoteIdentifier')
- ->will($this->returnArgument(0))
- ;
-
- $this->_queryMock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\FromMock', array($adapterMock));
- $this->_rendererMock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\FromMock');
- }
-
- public function testRenderOneTableWithoutSchemaWithoutAlias()
- {
- $this->_queryMock->from('foo_table');
-
- $this->assertRegExp('#\s*FROM\s*[a-zA-Z_][a-zA-Z0-9_]+\s*#', $this->_rendererMock->renderFrom($this->_queryMock));
- }
-
- public function testRenderTableWithSchemaWithoutAlias()
- {
- $this->_queryMock->from('foo_table', 'testing_schema');
-
- $this->assertRegExp('#\s*FROM\s*[a-zA-Z_][a-zA-Z0-9_]+\.[a-zA-Z_][a-zA-Z0-9_]+\s*#', $this->_rendererMock->renderFrom($this->_queryMock));
- }
-
- public function testRenderOneTableWithoutSchemaWithAlias()
- {
- $this->_queryMock->from(array('my_alias' => 'foo_table'));
-
- $this->assertRegExp('#\s*FROM\s*[a-zA-Z_][a-zA-Z0-9_]+\s+AS\s+[a-zA-Z_][a-zA-Z0-9_]+\s*#', $this->_rendererMock->renderFrom($this->_queryMock));
- }
-
- public function testRenderTableWithSchemaWithAlias()
- {
- $this->_queryMock->from(array('my_alias' => 'foo_table'), 'testing_schema');
-
- $this->assertRegExp('#\s*FROM\s*[a-zA-Z_][a-zA-Z0-9_]+\.[a-zA-Z_][a-zA-Z0-9_]+\s+AS\s+[a-zA-Z_][a-zA-Z0-9_]+\s*#', $this->_rendererMock->renderFrom($this->_queryMock));
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/IntoMock.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/IntoMock.php
deleted file mode 100644
index 5d2805c..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/IntoMock.php
+++ /dev/null
@@ -1,12 +0,0 @@
-getMockForAbstractClass('Wootook\\Core\\Database\\Adapter\\Adapter');
-
- $adapterMock->expects($this->any())
- ->method('quoteIdentifier')
- ->will($this->returnArgument(0))
- ;
-
- $this->_queryMock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\IntoMock', array($adapterMock));
- $this->_rendererMock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\IntoMock');
- }
-
- public function testRenderTableWithoutSchema()
- {
- $this->_queryMock->into('foo_table');
-
- $this->assertRegExp('#\s*foo_table\s*#', $this->_rendererMock->renderInto($this->_queryMock));
- }
-
- public function testRenderTableWithSchema()
- {
- $this->_queryMock->into('foo_table', 'testing_schema');
-
- $this->assertRegExp('#\s*testing_schema\.foo_table\s*#', $this->_rendererMock->renderInto($this->_queryMock));
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/LimitMock.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/LimitMock.php
deleted file mode 100644
index a47d70a..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/LimitMock.php
+++ /dev/null
@@ -1,12 +0,0 @@
-getMockForAbstractClass('Wootook\\Core\\Database\\Adapter\\Adapter');
- $this->_queryMock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\LimitMock', array($adapter));
- $this->_rendererMock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\LimitMock');
- }
-
- public function testRenderLimitWithoutOffset()
- {
- $this->_queryMock->limit(100);
-
- $this->assertRegExp('#\s*LIMIT\s+\d+\s*#', $this->_rendererMock->renderLimit($this->_queryMock));
- }
-
- public function testRenderLimitWithOffset()
- {
- $this->_queryMock->limit(100, 20);
-
- $this->assertRegExp('#\s*LIMIT\s+\d+\s*,\s*\d+\s*#', $this->_rendererMock->renderLimit($this->_queryMock));
- }
-
- public function testRenderNoLimit()
- {
- $this->assertEmpty($this->_rendererMock->renderLimit($this->_queryMock));
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/SetMock.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/SetMock.php
deleted file mode 100644
index 5f34c99..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/Renderer/SetMock.php
+++ /dev/null
@@ -1,12 +0,0 @@
-getMockForAbstractClass('Wootook\\Core\\Database\\Adapter\\Adapter');
-
- $adapterMock->expects($this->any())
- ->method('quoteIdentifier')
- ->will($this->returnArgument(0))
- ;
-
- $adapterMock->expects($this->any())
- ->method('quote')
- ->will($this->returnArgument(0))
- ;
-
- $this->_queryMock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\SetMock', array($adapterMock));
- $this->_rendererMock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\Renderer\\SetMock');
- }
-
- public function testRenderFieldAndValue()
- {
- $this->_queryMock->set('foo_field', 18);
-
- $this->assertRegExp('#\s*SET\s*foo_field=18\s*#', $this->_rendererMock->renderSet($this->_queryMock));
- }
-
- public function testRenderFieldAndValueWithPlaceholder()
- {
- $placeholder = $this->getMockForAbstractClass('Wootook\\Core\\Database\\Sql\\Placeholder\\Placeholder');
-
- $placeholder->expects($this->any())
- ->method('__toString')
- ->will($this->returnValue('18'))
- ;
-
- $this->_queryMock->set('foo_field', $placeholder);
-
- $this->assertRegExp('#\s*SET\s*foo_field=18\s*#', $this->_rendererMock->renderSet($this->_queryMock));
- }
-
- public function testRenderMultipleFieldAndValueAsArray()
- {
- $this->_queryMock->set(array(
- 'id' => 18,
- 'foo_field' => 'test',
- 'example' => null
- ));
-
- $this->assertRegExp('#\s*SET\s+[a-zA-Z_][a-zA-Z0-9_]*\s*=\s*[0-9]+\s*,\s*[a-zA-Z_][a-zA-Z0-9_]*\s*=\s*[a-zA-Z]+\s*,\s*[a-zA-Z_][a-zA-Z0-9_]*\s*=\s*NULL\s*#', $this->_rendererMock->renderSet($this->_queryMock));
- }
-
- public function testRenderNoField()
- {
- $this->assertEmpty($this->_rendererMock->renderSet($this->_queryMock));
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/SetMock.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/SetMock.php
deleted file mode 100644
index 4cc42d5..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/SetMock.php
+++ /dev/null
@@ -1,13 +0,0 @@
-getMockForAbstractClass('Wootook\\Core\\Database\\Adapter\\Adapter');
- $this->_mock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\SetMock', array($adapter));
- }
-
- public function testSetFieldAndValue()
- {
- $this->_mock->set('foo_field', 18);
-
- $expected = array(
- array(
- 'value' => 18,
- 'field' => 'foo_field'
- )
- );
-
- $this->assertEquals($expected, $this->_mock->getPart(SetMock::SET));
- }
-
- public function testSetFieldAndValueWithPlaceholder()
- {
- $placeholder = $this->getMockForAbstractClass('Wootook\\Core\\Database\\Sql\\Placeholder\\Placeholder');
-
- $this->_mock->set('foo_field', $placeholder);
-
- $expected = array(
- array(
- 'value' => $placeholder,
- 'field' => 'foo_field'
- )
- );
-
- $this->assertEquals($expected, $this->_mock->getPart(SetMock::SET));
- }
-
- public function testSetMultipleFieldAndValueAsArray()
- {
- $this->_mock->set(array(
- 'id' => 18,
- 'foo_field' => 'test',
- 'example' => null
- ));
-
- $expected = array(
- array(
- 'value' => 18,
- 'field' => 'id'
- ),
- array(
- 'value' => 'test',
- 'field' => 'foo_field'
- ),
- array(
- 'value' => null,
- 'field' => 'example'
- )
- );
-
- $this->assertEquals($expected, $this->_mock->getPart(SetMock::SET));
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/WhereMock.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/WhereMock.php
deleted file mode 100644
index b5d78ed..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/Database/Sql/Dml/Section/WhereMock.php
+++ /dev/null
@@ -1,13 +0,0 @@
-getMockForAbstractClass('Wootook\\Core\\Database\\Adapter\\Adapter');
- $this->_mock = $this->getMockForAbstractClass('WootookUnit\\Core\\Database\\Sql\\Dml\\Section\\WhereMock', array($adapter));
- }
-
- public function testAddScalarCondition()
- {
- $this->markTestIncomplete();
- $this->_mock->where('testing_field', 23);
-
- $expected = array(
- array(
- 'field' => 'foo_column',
- 'alias' => null,
- 'table' => null
- )
- );
- $this->assertEquals($expected, $this->_mock->getPart(WhereMock::WHERE));
- }
-
- public function testAddColumnWithTableWithoutAlias()
- {
- $this->markTestIncomplete();
- $this->_mock->where('testing_field', 23);
-
- $expected = array(
- array(
- 'field' => 'foo_column',
- 'alias' => null,
- 'table' => 'testing_table'
- )
- );
-
- $this->assertEquals($expected, $this->_mock->getPart(WhereMock::WHERE));
- }
-
- public function testAddOneTableWithoutTableWithAlias()
- {
- $this->markTestIncomplete();
- $this->_mock->where('testing_field', 23);
-
- $expected = array(
- array(
- 'field' => 'foo_column',
- 'alias' => 'my_alias',
- 'table' => null
- )
- );
- $this->assertEquals($expected, $this->_mock->getPart(WhereMock::WHERE));
- }
-
- public function testAddColumnWithTableWithAlias()
- {
- $this->markTestIncomplete();
- $this->_mock->where('testing_field', 23);
-
- $expected = array(
- array(
- 'field' => 'foo_column',
- 'alias' => 'my_alias',
- 'table' => 'testing_table'
- )
- );
-
- $this->assertEquals($expected, $this->_mock->getPart(WhereMock::WHERE));
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DateTime/DateTimeTest.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/DateTime/DateTimeTest.php
deleted file mode 100644
index 4aa4576..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DateTime/DateTimeTest.php
+++ /dev/null
@@ -1,42 +0,0 @@
-add(new \DateInterval('P15D')); // Period of 15 Days
- $this->assertEquals('2010-12-11', $date->format('Y-m-d'));
- }
-
- public function testSupportsSubtractionOfMonths()
- {
- $date = new \DateTime('2010-11-26');
- $date->sub(new \DateInterval('P20M')); // Period of 15 Days
- $this->assertEquals('2009-03-26', $date->format('Y-m-d'));
- }
-
- // takes into account leap years, number of days of the month, etc.
- public function testSupportsDifferenceOfDates()
- {
- $stopDate = new \DateTime('2010-11-26');
- $startDate = new \DateTime('2010-10-28');
- $duration = $stopDate->diff($startDate);
- $this->assertEquals('29', $duration->format('%d'));
- }
-
- // never use mktime() again
- public function testSupportsAlsoTimeAndOperatorOverloading()
- {
- $datetime = new \DateTime('2010-11-26 12:00');
- $this->assertTrue($datetime > new \DateTime('2010-11-26 11:00'));
- $this->assertTrue($datetime == new \DateTime('2010-11-26 12:00'));
- $this->assertTrue($datetime < new \DateTime('2010-11-26 13:00'));
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DateTime/DateTimeTest.php.old b/src/application/modules/WootookCore/test/php/WootookUnit/Core/DateTime/DateTimeTest.php.old
deleted file mode 100644
index 1e1707a..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DateTime/DateTimeTest.php.old
+++ /dev/null
@@ -1,243 +0,0 @@
-assertEquals(1338874542, $object->getTimestamp());
-
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('@1338906942');
- $this->assertEquals(1338906942, $object->getTimestamp());
- }
-
- public function testParseStringGeneralDatabaseMySqlDateTimeFormat()
- {
- // 2012-06-05 05:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('2012-06-05 05:35:42', 'Y-m-d H:i:s');
- $this->assertEquals(1338874542, $object->getTimestamp());
-
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('2012-06-05 14:35:42', 'Y-m-d H:i:s');
- $this->assertEquals(1338906942, $object->getTimestamp());
-
- // 2012-06-05 00:00:00 +000
- $object = new Wootook\Core\DateTime\DateTime('2012-06-05 02:35:42', 'Y-m-d');
- $this->assertEquals(1338854400, $object->getTimestamp());
- }
-
- public function testParseStringGeneralDatabaseIsoDateTimeFormat()
- {
- // 2012-06-05 05:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('2012-06-05T05:35:42', 'Y-m-d\\TH:i:s');
- $this->assertEquals(1338874542, $object->getTimestamp());
-
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('2012-06-05T14:35:42', 'Y-m-d\\TH:i:s');
- $this->assertEquals(1338906942, $object->getTimestamp());
-
- // 2012-06-05 00:00:00 +000
- $object = new Wootook\Core\DateTime\DateTime('2012-06-05 02:35:42', 'Y-m-d');
- $this->assertEquals(1338854400, $object->getTimestamp());
- }
-
- public function testParseStringAmPmWhenAm()
- {
- // 2012-06-05 05:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('2012-06-05 05:35:42 AM', 'Y-m-d h:i:s A');
- $this->assertEquals(1338874542, $object->getTimestamp());
-
- // 2012-06-05 05:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('2012-06-05 05:35:42 am', 'Y-m-d h:i:s a');
- $this->assertEquals(1338874542, $object->getTimestamp());
- }
-
- public function testParseStringAmPmWhenPm()
- {
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('2012-06-05 02:35:42 PM', 'Y-m-d h:i:s A');
- $this->assertEquals(1338906942, $object->getTimestamp());
-
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('2012-06-05 02:35:42 pm', 'Y-m-d h:i:s a');
- $this->assertEquals(1338906942, $object->getTimestamp());
- }
-
- public function testParseStringShortLiteralDaysMonths()
- {
- // 2012-06-05 00:00:00 +000
- $object = new Wootook\Core\DateTime\DateTime('Tue Jun 5, 2012', 'D M j, Y');
- $this->assertEquals(1338854400, $object->getTimestamp());
- }
-
- public function testParseStringLongLiteralDaysMonthsWithErrors()
- {
- // 2012-06-05 00:00:00 +000
- $object = new Wootook\Core\DateTime\DateTime('Tuesday June 5, 2012', 'D M j, Y');
- $this->assertEquals(1338854400, $object->getTimestamp());
- }
-
- public function testParseStringLongLiteralDaysMonthsWithTypoError()
- {
- // 2012-06-05 00:00:00 +000
- $object = new Wootook\Core\DateTime\DateTime('Tusday Jume 5, 2012', 'D M j, Y');
- $this->assertAttributeNotEquals(1338854400, '_datetime', $object);
- }
-
- public function testParseStringLiteralDaysMonthsAmPm()
- {
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('Tue Jun 5, 2012 02:35:42 pm', 'D M j, Y H:i:s a');
- $this->assertEquals(1338906942, $object->getTimestamp());
- }
-
- public function testToStringLiteralDaysMonths()
- {
- // 2012-06-05 02:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('@1338906942');
- $this->assertEquals('Tue Jun 5, 2012 02:35:42 pm', $object->toString('D M j, Y h:i:s a'));
- }
-
- public function testToStringGeneral()
- {
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('@1338906942');
- $this->assertEquals('2012-06-05 14:35:42', $object->toString('Y-m-d H:i:s'));
- }
-
- public function testToStringIso8601()
- {
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('@1338906942');
- $this->assertEquals('2012-06-05T14:35:42+0000', $object->getIso());
- }
-
- public function testDateOperations()
- {
- $this->markTestSkipped();
- return;
-
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('@1338906942');
- $object->add(10, Wootook\Core\DateTime\DateTime::SECOND);
- $this->assertEquals('2012-06-05 14:35:52', $object->toString('Y-m-d H:i:s'));
-
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('@1338906942');
- $object->add(70, Wootook\Core\DateTime\DateTime::SECOND);
- $this->assertEquals('2012-06-05 14:36:52', $object->toString('Y-m-d H:i:s'));
-
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('@1338906942');
- $object->sub(10, Wootook\Core\DateTime\DateTime::MINUTE);
- $this->assertEquals('2012-06-05 14:25:42', $object->toString('Y-m-d H:i:s'));
-
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('@1338906942');
- $object->sub(70, Wootook\Core\DateTime\DateTime::MINUTE);
- $this->assertEquals('2012-06-05 13:25:42', $object->toString('Y-m-d H:i:s'));
-
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('@1338906942');
- $object->set(25, Wootook\Core\DateTime\DateTime::DAY);
- $this->assertEquals('2012-06-25 14:35:42', $object->toString('Y-m-d H:i:s'));
-
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('@1338906942');
- // 2012-06-05 00:00:00 +000
- $object->set(1338854400, Wootook\Core\DateTime\DateTime::TIMESTAMP);
- $this->assertEquals('2012-06-05 00:00:00', $object->toString('Y-m-d H:i:s'));
-
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('@1338906942');
- $object->add(3600, Wootook\Core\DateTime\DateTime::TIMESTAMP);
- $this->assertEquals('2012-06-05 15:35:42', $object->toString('Y-m-d H:i:s'));
-
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('@1338906942');
- $object->sub(3600, Wootook\Core\DateTime\DateTime::TIMESTAMP);
- $this->assertEquals('2012-06-05 13:35:42', $object->toString('Y-m-d H:i:s'));
- }
-
- public function testDateDifference()
- {
- // 2012-06-05 14:35:42 +000
- $objectOne = new Wootook\Core\DateTime\DateTime('@1338906942');
- // 2012-06-05 00:00:00 +000
- $objectTwo = new Wootook\Core\DateTime\DateTime('@1338854400');
-
- $this->assertInstanceOf('DateInterval', $diff = $objectOne->diff($objectTwo));
- //$this->assertInstanceOf('Wootook\\Core\\DateTime\\DateInterval', $diff = $objectOne->diff($objectTwo));
- $this->assertEquals(0, $diff->y);
- $this->assertEquals(0, $diff->m);
- $this->assertEquals(0, $diff->d);
- $this->assertEquals(14, $diff->h);
- $this->assertEquals(35, $diff->i);
- $this->assertEquals(42, $diff->s);
- $this->assertEquals(1, $diff->invert);
- $this->assertEquals(0, $diff->days);
- /*
- $this->assertEquals(52542, $objectOne->diff($objectTwo, true));
- $this->assertEquals(-52542, $objectTwo->diff($objectOne, true));
- $this->assertEquals(0, $objectOne->diff($objectOne, true));
- */
- }
-
- public function testParseStringErrorMeridiem()
- {
- // 2012-06-05 05:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('2012-06-05 05:35:42 DX', 'Y-m-d h:i:s A');
- $this->assertEquals('2012-06-05 05:35:42', $object->toString('Y-m-d H:i:s'));
- }
-
- public function testParseStringShortYear()
- {
- // 2012-06-05 05:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('12-06-05 05:35:42', 'y-m-d h:i:s A');
- $this->assertEquals('2012-06-05 05:35:42', $object->toString('Y-m-d H:i:s'));
-
- // 1969-06-05 05:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('69-06-05 05:35:42', 'y-m-d h:i:s A');
- $this->assertEquals('1969-06-05 05:35:42', $object->toString('Y-m-d H:i:s'));
- }
-
- public function testDateEarlierLater()
- {
- // 2012-06-05 14:35:42 +000
- $objectOne = new Wootook\Core\DateTime\DateTime('@1338906942');
- // 2012-06-05 00:00:00 +000
- $objectTwo = new Wootook\Core\DateTime\DateTime('@1338854400');
-
- $this->assertFalse($objectOne->isEarlier($objectTwo));
- $this->assertFalse($objectTwo->isLater($objectOne));
-
- $this->assertFalse($objectTwo->isLater());
- $this->assertTrue($objectTwo->isEarlier());
- }
-
- public function testGetTimestamp()
- {
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('2012-06-05 14:35:42', 'Y-m-d H:i:s');
-
- $this->assertEquals(1338906942, $object->getTimestamp());
- }
-
- public function testMagicMethodToString()
- {
- // 2012-06-05 14:35:42 +000
- $object = new Wootook\Core\DateTime\DateTime('@1338906942');
-
- $this->assertEquals('2012-06-05T14:35:42+00:00', $object.'');
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/Config/ConfigTest.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/Config/ConfigTest.php
deleted file mode 100644
index de0327e..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/Config/ConfigTest.php
+++ /dev/null
@@ -1,143 +0,0 @@
-_app = $this->getMock('Wootook\\Core\\App\\App', array('__construct'), array(''));
- $this->_registry = new \Wootook\Core\DependencyInjection\Registry($this->_app);
- }
-
- public function testGetRegistryWhilePassedToConstructor()
- {
- $object = new \Wootook\Core\DependencyInjection\Factory($this->_app, $this->_registry);
-
- $this->assertAttributeSame($this->_registry, '_registry', $object);
- $this->assertSame($object->getRegistry(), $this->_registry);
- }
-
- public function testGetClassDefinition_usingSpecialClassName()
- {
- $object = new \Wootook\Core\DependencyInjection\Factory($this->_app, $this->_registry, 'stdClass');
-
- $this->assertInstanceOf('stdClass', $object->getClassDefinition('stdClass'));
- }
-
- public function testGetRegistryWhileNonePassedToConstructor()
- {
- $object = new \Wootook\Core\DependencyInjection\Factory($this->_app);
-
- $this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Registry', $object->getRegistry());
- $this->assertAttributeNotEmpty('_registry', $object);
- $this->assertAttributeNotSame($this->_registry, '_registry', $object);
-
- $object->setRegistry($this->_registry);
-
- $this->assertAttributeSame($this->_registry, '_registry', $object);
- $this->assertSame($object->getRegistry(), $this->_registry);
- }
-
- public function testGetUndeclaredClassDefinition()
- {
- $object = new \Wootook\Core\DependencyInjection\Factory($this->_app, $this->_registry);
-
- $this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Definition\\ClassDefinition', $object->getClassDefinition('stdClass'));
- }
-
- public function testGetDeclaredClassDefinition()
- {
- $object = new \Wootook\Core\DependencyInjection\Factory($this->_app, $this->_registry);
-
- $classDefinition = $this->getMockBuilder('Wootook\\Core\\DependencyInjection\\Definition\\ClassDefinition')
- ->disableOriginalConstructor()
- ->getMock()
- ;
-
- $object->registerClassDefinition('stdClass', $classDefinition);
-
- $this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Definition\\ClassDefinition', $object->getClassDefinition('stdClass'));
- }
-
- public function testAddClassDefinition()
- {
- $classDefinition = $this->getMockBuilder('Wootook\\Core\\DependencyInjection\\Definition\\ClassDefinition')
- ->disableOriginalConstructor()
- ->getMock()
- ;
-
- $object = $this->getMockBuilder('Wootook\\Core\\DependencyInjection\\Factory')
- ->disableOriginalConstructor()
- ->setMethods(array('initClassDefinition', 'registerClassDefinition'))
- ->getMock()
- ;
-
- $object->expects($this->once())
- ->method('initClassDefinition')
- ->with('stdClass')
- ->will($this->returnValue($classDefinition))
- ;
-
- $object->expects($this->once())
- ->method('registerClassDefinition')
- ->with('stdClass', $classDefinition)
- ->will($this->returnSelf())
- ;
-
- $object->addClassDefinition('stdClass');
- }
-
- public function testInstanceInvocation()
- {
- $classDefinition = $this->getMockBuilder('Wootook\\Core\\DependencyInjection\\Definition\\ClassDefinition')
- ->disableOriginalConstructor()
- ->setMethods(array('newInstance'))
- ->getMock()
- ;
-
- $classDefinition->expects($this->once())
- ->method('newInstance')
- ->with(array())
- ->will($this->returnValue(new \stdClass))
- ;
-
- $object = $this->getMockBuilder('Wootook\\Core\\DependencyInjection\\Factory')
- ->disableOriginalConstructor()
- ->setMethods(array('getClassDefinition'))
- ->getMock()
- ;
-
- $object->expects($this->once())
- ->method('getClassDefinition')
- ->with('stdClass')
- ->will($this->returnValue($classDefinition))
- ;
-
- $object('stdClass');
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/Definition/ArgumentDefinitionTest.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/Definition/ArgumentDefinitionTest.php
deleted file mode 100644
index 713b86c..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/Definition/ArgumentDefinitionTest.php
+++ /dev/null
@@ -1,186 +0,0 @@
-_methodDefinitionMock = $this->getMock('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition',
- array(), array(), '', false);
- }
-
- public function testBuildNewWithoutRegistryWithParameterId_bindValue()
- {
- $reflectionParameter = new \ReflectionParameter(array(__CLASS__, 'myTestingMethod'), 0);
-
- $this->_methodDefinitionMock->expects($this->any())
- ->method('getArgumentReflector')
- ->with(0)
- ->will($this->returnValue($reflectionParameter))
- ;
-
- $definition = new Definition\ArgumentDefinition($this->_methodDefinitionMock, 0);
-
- $definition->bindValue(36);
-
- $compiledArguments = array();
- $definition->compileInto($compiledArguments);
-
- $this->assertEquals(array(36), $compiledArguments);
- }
-
- public function testBuildNewWithoutRegistryWithParameterName_bindValue()
- {
- $reflectionParameter = new \ReflectionParameter(array(__CLASS__, 'myTestingMethod'), 0);
-
- $this->_methodDefinitionMock->expects($this->any())
- ->method('getArgumentReflector')
- ->with('param1')
- ->will($this->returnValue($reflectionParameter))
- ;
-
- $definition = new Definition\ArgumentDefinition($this->_methodDefinitionMock, 'param1');
-
- $definition->bindValue(36);
-
- $compiledArguments = array();
- $definition->compileInto($compiledArguments);
-
- $this->assertEquals(array(36), $compiledArguments);
- }
-
- public function testBuildNewWithRegistryWithParameterId_bindValue()
- {
- $reflectionParameter = new \ReflectionParameter(array(__CLASS__, 'myTestingMethod'), 0);
-
- $this->_methodDefinitionMock->expects($this->any())
- ->method('getArgumentReflector')
- ->with(0)
- ->will($this->returnValue($reflectionParameter))
- ;
-
- $registry = $this->getMock('DependencyInjection\Registry');
- $definition = new Definition\ArgumentDefinition($this->_methodDefinitionMock, 0);
-
- $definition->bindValue(36);
-
- $compiledArguments = array();
- $definition->compileInto($compiledArguments);
-
- $this->assertEquals(array(36), $compiledArguments);
- }
-
- public function testBuildNewWithRegistryWithParameterName_bindValue()
- {
- $reflectionParameter = new \ReflectionParameter(array(__CLASS__, 'myTestingMethod'), 0);
-
- $this->_methodDefinitionMock->expects($this->any())
- ->method('getArgumentReflector')
- ->with('param1')
- ->will($this->returnValue($reflectionParameter))
- ;
-
- $definition = new Definition\ArgumentDefinition($this->_methodDefinitionMock, 'param1');
-
- $definition->bindValue(36);
-
- $compiledArguments = array();
- $definition->compileInto($compiledArguments);
-
- $this->assertEquals(array(36), $compiledArguments);
- }
-
- public function testBuildNewWithoutRegistryWithParameterId_bindVariable()
- {
- $reflectionParameter = new \ReflectionParameter(array(__CLASS__, 'myTestingMethod'), 0);
-
- $this->_methodDefinitionMock->expects($this->any())
- ->method('getArgumentReflector')
- ->with(0)
- ->will($this->returnValue($reflectionParameter))
- ;
-
- $definition = new Definition\ArgumentDefinition($this->_methodDefinitionMock, 0);
-
- $var = 36;
- $definition->bindVariable($var);
-
- $compiledArguments = array();
- $definition->compileInto($compiledArguments);
-
- $this->assertEquals(array(&$var), $compiledArguments);
- }
-
- public function testBuildNewWithoutRegistryWithParameterName_bindVariable()
- {
- $reflectionParameter = new \ReflectionParameter(array(__CLASS__, 'myTestingMethod'), 0);
-
- $this->_methodDefinitionMock->expects($this->any())
- ->method('getArgumentReflector')
- ->with('param1')
- ->will($this->returnValue($reflectionParameter))
- ;
-
- $definition = new Definition\ArgumentDefinition($this->_methodDefinitionMock, 'param1');
-
- $var = 36;
- $definition->bindVariable($var);
-
- $compiledArguments = array();
- $definition->compileInto($compiledArguments);
-
- $this->assertEquals(array(&$var), $compiledArguments);
- }
-
- public function testBuildNewWithoutRegistryWithParameterId_bindRegistryEntry()
- {
- $reflectionParameter = new \ReflectionParameter(array(__CLASS__, 'myTestingMethod'), 0);
-
- $this->_methodDefinitionMock->expects($this->any())
- ->method('getArgumentReflector')
- ->with(0)
- ->will($this->returnValue($reflectionParameter))
- ;
-
- $definition = new Definition\ArgumentDefinition($this->_methodDefinitionMock, 0);
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\RuntimeException');
- $definition->bindRegistryEntry('testing');
-
- $compiledArguments = array();
- $definition->compileInto($compiledArguments);
- }
-
- public function testBuildNewWithoutRegistryWithParameterName_bindRegistryEntry()
- {
- $reflectionParameter = new \ReflectionParameter(array(__CLASS__, 'myTestingMethod'), 0);
-
- $this->_methodDefinitionMock->expects($this->any())
- ->method('getArgumentReflector')
- ->with('param1')
- ->will($this->returnValue($reflectionParameter))
- ;
-
- $definition = new Definition\ArgumentDefinition($this->_methodDefinitionMock, 'param1');
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\RuntimeException');
- $definition->bindRegistryEntry('testing');
-
- $compiledArguments = array();
- $definition->compileInto($compiledArguments);
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/Definition/ClassDefinitionTest.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/Definition/ClassDefinitionTest.php
deleted file mode 100644
index 60cf743..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/Definition/ClassDefinitionTest.php
+++ /dev/null
@@ -1,365 +0,0 @@
-getMockBuilder('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition')
- ->setMethods($additionalMethods)
- ->disableOriginalConstructor(true)
- ->getMock()
- ;
-
- return $argumentDefinition;
- }
-
- /**
- * @return \Wootook\Core\DependencyInjection\Registry
- */
- public function getRegistryMock(Array $additionalMethods = array())
- {
- $registry = $this->getMockBuilder('Wootook\\Core\\DependencyInjection\\Registry')
- ->setMethods($additionalMethods)
- ->disableOriginalConstructor(true)
- ->getMock()
- ;
-
- return $registry;
- }
-
- public function testClassDefinitionInstantiation_withNonExistingClass()
- {
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\BadMethodCallException');
- new Definition\ClassDefinition('InexistentClass');
- }
-
- public function testClassDefinitionInstantiation_withExistingClass()
- {
- $definition = new Definition\ClassDefinition('stdClass');
-
- $this->assertEquals('stdClass', $definition->getReflector()->getName());
- }
-
- public function testClassDefinitionInstantiation_withExistingClassWithRegistry()
- {
- /** @var \Wootook\Core\DependencyInjection\Registry $registry */
- $registry = $this->getRegistryMock();
-
- $definition = new Definition\ClassDefinition('stdClass', $registry);
-
- $this->assertEquals('stdClass', $definition->getReflector()->getName());
- $this->assertSame($registry, $definition->getRegistry());
- }
-
- public function testClassDefinitionInstantiation_withExistingClass_withRegistry_withSpecialMethodDefinitionClassName()
- {
- /** @var \Wootook\Core\DependencyInjection\Registry $registry */
- $registry = $this->getRegistryMock();
-
- $definition = new Definition\ClassDefinition('stdClass', $registry, 'stdClass');
-
- $this->assertEquals('stdClass', $definition->getMethodDefinitionClassName());
- $this->assertSame($registry, $definition->getRegistry());
- }
-
- public function testClassDefinitionInstantiation_withInvalidSpecialArgumentDefinitionClassName()
- {
- /** @var \Wootook\Core\DependencyInjection\Registry $registry */
- $registry = $this->getRegistryMock();
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
- $definition = new Definition\ClassDefinition('stdClass', $registry, 32);
- }
-
- public function testClassDefinitionInstantiation_validateReflectorInstance()
- {
- $definition = new Definition\ClassDefinition('stdClass');
-
- $this->assertInstanceOf('ReflectionClass', $definition->getReflector());
- $this->assertEquals('stdClass', $definition->getReflector()->getName());
- }
-
- public function testClassDefinitionAccessorsAndMutators_usingReflector()
- {
- $definition = new Definition\classDefinition('stdClass');
-
- $this->assertInstanceOf('ReflectionClass', $definition->getReflector());
-
- $reflector = new \Reflectionclass(__CLASS__);
- $definition->setReflector($reflector);
-
- $this->assertSame($reflector, $definition->getReflector());
- }
-
- public function testClassDefinitionMethodDefinitions_initMethodDefinition()
- {
- $definition = new Definition\ClassDefinition(__CLASS__, null, 'stdClass');
-
- $methodDefinition = $definition->initMethodDefinition('methodToTest');
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
- $definition->initMethodDefinition(0);
- }
-
- public function testClassDefinitionMethodDefinitions_registerMethodDefinition()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $methodDefinition */
- $methodDefinition = $this->getMethodDefinitionMock();
-
- $definition = new Definition\ClassDefinition('stdClass');
-
- $definition->registerMethodDefinition('methodToTest', $methodDefinition);
- $this->assertCount(1, $definition->getAllMethodDefinitions());
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
- $definition->registerMethodDefinition(array(), $methodDefinition);
- }
-
- public function testClassDefinitionMethodDefinitions_addMethodDefinition()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ArgumentDefinition $argumentDefinition */
- $methodDefinition = $this->getMethodDefinitionMock(array('__construct'));
-
- $definition = new Definition\ClassDefinition(__CLASS__, null, get_class($methodDefinition));
-
- $definition->addMethodDefinition('methodToTest');
- $this->assertCount(1, $definition->getAllMethodDefinitions());
- $this->assertInstanceOf(get_class($methodDefinition), $definition->getAllMethodDefinitions()['methodToTest']);
- }
-
- public function testClassDefinitionMethodDefinitions_setMethodDefinition()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ArgumentDefinition $argumentDefinition */
- $methodDefinition = $this->getMethodDefinitionMock();
-
- $definition = new Definition\ClassDefinition(__CLASS__, null, 'stdClass');
-
- $definition->setMethodDefinition('methodToTest', $methodDefinition);
- $this->assertCount(1, $definition->getAllMethodDefinitions());
- $this->assertInstanceOf(get_class($methodDefinition), $definition->getAllMethodDefinitions()['methodToTest']);
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
- $definition->setMethodDefinition(0, $methodDefinition);
- }
-
- public function testClassDefinition_getMethodDefinitionWithInvalidMethodName()
- {
- $definition = new Definition\ClassDefinition(__CLASS__);
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->getMethodDefinition(1.5);
- }
-
- public function testMethodDefinition_getArgumentReflector_withInexistentMethodName()
- {
- $definition = new Definition\ClassDefinition(__CLASS__);
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\BadMethodCallException');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->getMethodDefinition('inexistentMethod');
- }
-
- public function testGetAllMethodDefinitions()
- {
- $mock = $this->getMethodDefinitionMock();
-
- $definition = new Definition\ClassDefinition(__CLASS__);
- $definition->setMethodDefinition('fooMethod', $mock);
-
- $expected = array(
- 'fooMethod' => $mock
- );
- $this->assertEquals($expected, $definition->getAllMethodDefinitions());
- }
-
- public function testReset()
- {
- $mock = $this->getMethodDefinitionMock();
-
- $definition = new Definition\ClassDefinition(__CLASS__);
- $definition->setMethodDefinition('fooMethod', $mock);
-
- $definition->reset();
-
- $this->assertEquals(array(), $definition->getAllMethodDefinitions());
- }
-
-
-// public function testClassDefinitionInstantiation_withSpecialMethodDefinitionClassName()
-// {
-// $methodDefinitionClassName = \uniqid('WootookUnit_Core_DependencyInjection_Mock_MethodDefinition_TestNewInstance_');
-// $this->getMock('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition', array(), array(), $methodDefinitionClassName, false);
-//
-// $definition = new Definition\ClassDefinition(__CLASS__, null, $methodDefinitionClassName);
-//
-// $this->assertInstanceOf($methodDefinitionClassName, $definition->getMethodDefinition(__FUNCTION__));
-// }
-
-// public function testClassDefinitionInstantiation_assignNewMethodDefinitionInstance()
-// {
-// $mock = $this->getMock('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition', array(), array(), '', false);
-//
-// $definition = new Definition\ClassDefinition(__CLASS__);
-// $definition->setMethodDefinition(__FUNCTION__, $mock);
-//
-// $this->assertSame($mock, $definition->getMethodDefinition(__FUNCTION__));
-// }
-//
-// public function testGetMethodDefinition_withInvalidMethodName()
-// {
-// $definition = new Definition\ClassDefinition(__CLASS__);
-//
-// $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
-// $definition->getMethodDefinition(42);
-// }
-//
-// public function testSetMethodDefinition_withInvalidMethodName()
-// {
-// $mock = $this->getMock('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition', array(), array(), '', false);
-//
-// $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
-//
-// $definition = new Definition\ClassDefinition(__CLASS__);
-// $definition->setMethodDefinition(42, $mock);
-// }
-//
-// public function testClassDefinitionAccessors_getReflector()
-// {
-// $definition = new Definition\ClassDefinition(__CLASS__);
-//
-// $this->assertInstanceOf('\\ReflectionClass', $definition->getReflector());
-// }
-//
-// public function testClassDefinitionMutators_setReflector()
-// {
-// $definition = new Definition\ClassDefinition(__CLASS__);
-// $reflector = new \ReflectionClass(__CLASS__);
-// $definition->setReflector($reflector);
-//
-// $this->assertSame($reflector, $definition->getReflector());
-// }
-//
-// public function testNewInstance_hasNoConstructor()
-// {
-// $this->markTestSkipped("Method ReflectionClass::newInstance() couldn't be mocked due to API<->Reflection inconsistencies.");
-//
-// $reflectionClassMock = $this->getMock('ReflectionClass', array('hasMethod', 'newInstance'), array('stdClass'));
-// $reflectionClassMock->expects($this->once())
-// ->method('hasMethod')
-// ->with('__construct')
-// ->will($this->returnValue(false))
-// ;
-// $reflectionClassMock->expects($this->once())
-// ->method('newInstance')
-// ->will($this->returnValue(new \stdClass()))
-// ;
-//
-// $classDefinition = new Definition\ClassDefinition(__CLASS__);
-// $classDefinition->setReflector($reflectionClassMock);
-//
-// $this->assertInstanceOf('stdClass', $classDefinition->newInstance());
-// }
-//
-// public function testNewInstance_usingConstructor()
-// {
-// $expectedArguments = array(42);
-//
-// $reflectionClassMock = $this->getMock('ReflectionClass', array('hasMethod', 'newInstanceArgs'), array('stdClass'));
-// $reflectionClassMock->expects($this->once())
-// ->method('hasMethod')
-// ->with('__construct')
-// ->will($this->returnValue(true))
-// ;
-// $reflectionClassMock->expects($this->once())
-// ->method('newInstanceArgs')
-// ->with($expectedArguments)
-// ->will($this->returnValue(new \stdClass()))
-// ;
-//
-// $classDefinition = new Definition\ClassDefinition(__CLASS__);
-// $classDefinition->setReflector($reflectionClassMock);
-//
-// $methodDefinitionMock = $this->getMock('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition', array('compileArgs'), array(), '', false);
-// $methodDefinitionMock->expects($this->once())
-// ->method('compileArgs')
-// ->will($this->returnValue(array(42)))
-// ;
-// $classDefinition->setMethodDefinition('__construct', $methodDefinitionMock);
-//
-// $this->assertInstanceOf('stdClass', $classDefinition->newInstance());
-// }
-//
-// public function testNewInstance_usingNonPublicConstructor()
-// {
-// $reflectionClassMock = $this->getMock('ReflectionClass', array('hasMethod', 'newInstanceArgs'), array('stdClass'));
-// $reflectionClassMock->expects($this->once())
-// ->method('hasMethod')
-// ->with('__construct')
-// ->will($this->returnValue(true))
-// ;
-// $reflectionClassMock->expects($this->once())
-// ->method('newInstanceArgs')
-// ->will($this->throwException($this->getMock('ReflectionException')))
-// ;
-//
-// $classDefinition = new Definition\ClassDefinition(__CLASS__);
-// $classDefinition->setReflector($reflectionClassMock);
-//
-// $methodDefinitionMock = $this->getMock('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition', array('compileArgs'), array(), '', false);
-// $methodDefinitionMock->expects($this->once())
-// ->method('compileArgs')
-// ->will($this->returnValue(array(42)))
-// ;
-// $classDefinition->setMethodDefinition('__construct', $methodDefinitionMock);
-//
-// $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\RuntimeException');
-//
-// $this->assertInstanceOf('stdClass', $classDefinition->newInstance());
-// }
-//
-// public function testNewInstanceWithoutConstructor()
-// {
-// $reflectionClassMock = $this->getMock('ReflectionClass', array('newInstanceWithoutConstructor'), array('stdClass'));
-// $reflectionClassMock->expects($this->once())
-// ->method('newInstanceWithoutConstructor')
-// ->will($this->returnValue(new \stdClass()))
-// ;
-//
-// $classDefinition = new Definition\ClassDefinition(__CLASS__);
-// $classDefinition->setReflector($reflectionClassMock);
-//
-// $this->assertInstanceOf('stdClass', $classDefinition->newInstanceWithoutConstructor());
-// }
-//
-// public function testNewInstanceWithoutConstructor_throwsException()
-// {
-// $reflectionClassMock = $this->getMock('ReflectionClass', array('newInstanceWithoutConstructor'), array('stdClass'));
-// $reflectionClassMock->expects($this->once())
-// ->method('newInstanceWithoutConstructor')
-// ->will($this->throwException($this->getMock('ReflectionException')))
-// ;
-//
-// $classDefinition = new Definition\ClassDefinition(__CLASS__);
-// $classDefinition->setReflector($reflectionClassMock);
-//
-// $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\RuntimeException');
-//
-// $this->assertInstanceOf('stdClass', $classDefinition->newInstanceWithoutConstructor());
-// }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/Definition/MethodDefinitionTest.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/Definition/MethodDefinitionTest.php
deleted file mode 100644
index 945b681..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/Definition/MethodDefinitionTest.php
+++ /dev/null
@@ -1,610 +0,0 @@
-getMockBuilder('Wootook\\Core\\DependencyInjection\\Definition\\ClassDefinition')
- ->setMethods($methods)
- ->disableOriginalConstructor(true)
- ->getMock()
- ;
-
- $classDefinition->expects($this->once())
- ->method('getReflector')
- ->will($this->returnValue(new \ReflectionClass(__CLASS__)))
- ;
-
- return $classDefinition;
- }
-
- /**
- * @return \Wootook\Core\DependencyInjection\Definition\ArgumentDefinition
- */
- public function getArgumentDefinitionMock(Array $additionalMethods = array())
- {
- $argumentDefinition = $this->getMockBuilder('Wootook\\Core\\DependencyInjection\\Definition\\ArgumentDefinition')
- ->setMethods($additionalMethods)
- ->disableOriginalConstructor(true)
- ->getMock()
- ;
-
- return $argumentDefinition;
- }
-
- /**
- * @return \Wootook\Core\DependencyInjection\Registry
- */
- public function getRegistryMock(Array $additionalMethods = array())
- {
- $registry = $this->getMockBuilder('Wootook\\Core\\DependencyInjection\\Registry')
- ->setMethods($additionalMethods)
- ->disableOriginalConstructor(true)
- ->getMock()
- ;
-
- return $registry;
- }
-
- public function testMethodDefinitionInstantiation_withNonExistingMethod()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\BadMethodCallException');
- new Definition\MethodDefinition($classDefinition, 'inexistentMethod');
- }
-
- public function testMethodDefinitionInstantiation_withExistingMethod()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- new Definition\MethodDefinition($classDefinition, 'methodToTest');
- }
-
- public function testMethodDefinitionInstantiation_withoutRegistry_withSpecialArgumentDefinitionClassName()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest', null, 'stdClass');
-
- $this->assertEquals('stdClass', $definition->getArgumentDefinitionClassName());
- }
-
- public function testMethodDefinitionInstantiation_withRegistry_withSpecialArgumentDefinitionClassName()
- {
- /** @var \Wootook\Core\DependencyInjection\Registry $registry */
- $registry = $this->getRegistryMock();
-
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest', $registry, 'stdClass');
-
- $this->assertEquals('stdClass', $definition->getArgumentDefinitionClassName());
- $this->assertSame($registry, $definition->getRegistry());
- }
-
- public function testMethodDefinitionInstantiation_withInvalidSpecialArgumentDefinitionClassName()
- {
- /** @var \Wootook\Core\DependencyInjection\Registry $registry */
- $registry = $this->getRegistryMock();
-
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest', $registry, 32);
- }
-
- public function testMethodDefinitionInstantiation_validateReflectorInstance()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- $this->assertInstanceOf('ReflectionMethod', $definition->getReflector());
- $this->assertEquals('methodToTest', $definition->getReflector()->getName());
- }
-
- public function testMethodDefinitionAccessorsAndMutators_usingReflector()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- $this->assertInstanceOf('ReflectionMethod', $definition->getReflector());
-
- $reflector = new \ReflectionMethod(__CLASS__, 'methodToTest');
- $definition->setReflector($reflector);
-
- $this->assertSame($reflector, $definition->getReflector());
- }
-
- public function testMethodDefinitionAccessors_usingArgumentReflector()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- $reflector = $definition->getArgumentReflector(0);
- $this->assertInstanceOf('ReflectionParameter', $reflector);
- $this->assertEquals('fooArgumentOne', $reflector->getName());
- $this->assertEquals(0, $reflector->getPosition());
-
- $reflector = $definition->getArgumentReflector('fooArgumentOne');
- $this->assertInstanceOf('ReflectionParameter', $reflector);
- $this->assertEquals('fooArgumentOne', $reflector->getName());
- $this->assertEquals(0, $reflector->getPosition());
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\BadMethodCallException');
- $definition->getArgumentReflector(array());
- }
-
- public function testMethodDefinitionArgumentDefinitions_initArgumentDefinition()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest', null, 'stdClass');
-
- $argumentDefinition = $definition->initArgumentDefinition(0);
- $this->assertInstanceOf('stdClass', $argumentDefinition);
-
- $argumentDefinition = $definition->initArgumentDefinition('fooArgumentOne');
- $this->assertInstanceOf('stdClass', $argumentDefinition);
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
- $definition->initArgumentDefinition(array());
- }
-
- public function testMethodDefinitionArgumentDefinitions_registerArgumentDefinition()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- /** @var \Wootook\Core\DependencyInjection\Definition\ArgumentDefinition $argumentDefinition */
- $argumentDefinition = $this->getArgumentDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- $definition->registerArgumentDefinition(0, $argumentDefinition);
- $this->assertCount(1, $definition->getAllArgumentDefinitions());
-
- $definition->registerArgumentDefinition('fooArgumentOne', $argumentDefinition);
- $this->assertCount(1, $definition->getAllArgumentDefinitions());
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
- $definition->registerArgumentDefinition(array(), $argumentDefinition);
- }
-
- public function testMethodDefinitionArgumentDefinitions_addArgumentDefinition()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- /** @var \Wootook\Core\DependencyInjection\Definition\ArgumentDefinition $argumentDefinition */
- $argumentDefinition = $this->getArgumentDefinitionMock(array('__construct'));
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest', null, get_class($argumentDefinition));
-
- $definition->addArgumentDefinition(0);
- $this->assertCount(1, $definition->getAllArgumentDefinitions());
- $this->assertInstanceOf(get_class($argumentDefinition), $definition->getAllArgumentDefinitions()[0]);
- }
-
- public function testMethodDefinitionArgumentDefinitions_setArgumentDefinition()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- /** @var \Wootook\Core\DependencyInjection\Definition\ArgumentDefinition $argumentDefinition */
- $argumentDefinition = $this->getArgumentDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest', null, 'stdClass');
-
- $definition->setArgumentDefinition(0, $argumentDefinition);
- $this->assertCount(1, $definition->getAllArgumentDefinitions());
- $this->assertInstanceOf(get_class($argumentDefinition), $definition->getAllArgumentDefinitions()[0]);
-
- $definition->setArgumentDefinition('fooArgumentOne', $argumentDefinition);
- $this->assertCount(1, $definition->getAllArgumentDefinitions());
- $this->assertInstanceOf(get_class($argumentDefinition), $definition->getAllArgumentDefinitions()[0]);
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
- $definition->setArgumentDefinition(array(), $argumentDefinition);
- }
-
- public function testMethodDefinitionBindings_bindArgumentValueWithNumericArgumentIndex()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = $this->getMock('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition',
- array('getArgumentDefinition'), array($classDefinition, 'methodToTest'));
-
- $argumentDefinition = $this->getArgumentDefinitionMock(array('bindValue'));
-
- $definition->expects($this->once())
- ->method('getArgumentDefinition')
- ->with(0, true)
- ->will($this->returnValue($argumentDefinition))
- ;
-
- $argumentDefinition->expects($this->once())
- ->method('bindValue')
- ->with(65)
- ;
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->bindArgumentValue(0, 65);
- }
-
- public function testMethodDefinitionBindings_bindArgumentValueWithNamedArgumentIndex()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = $this->getMock('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition',
- array('getArgumentDefinition'), array($classDefinition, 'methodToTest'));
-
- $argumentDefinition = $this->getArgumentDefinitionMock(array('bindValue'));
-
- $definition->expects($this->once())
- ->method('getArgumentDefinition')
- ->with('fooArgumentOne', true)
- ->will($this->returnValue($argumentDefinition))
- ;
-
- $argumentDefinition->expects($this->once())
- ->method('bindValue')
- ->with(65)
- ;
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->bindArgumentValue('fooArgumentOne', 65);
- }
-
- public function testMethodDefinitionBindings_bindArgumentVariableWithNumericArgumentIndex()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = $this->getMock('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition',
- array('getArgumentDefinition'), array($classDefinition, 'methodToTest'));
-
- $argumentDefinition = $this->getArgumentDefinitionMock(array('bindVariable'));
-
- $definition->expects($this->once())
- ->method('getArgumentDefinition')
- ->with(0, true)
- ->will($this->returnValue($argumentDefinition))
- ;
-
- $argumentDefinition->expects($this->once())
- ->method('bindVariable')
- ->with(42)
- ;
-
- $variable = 42;
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->bindArgumentVariable(0, $variable);
- }
-
- public function testMethodDefinitionBindings_bindArgumentVariableWithNamedArgumentIndex()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = $this->getMock('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition',
- array('getArgumentDefinition'), array($classDefinition, 'methodToTest'));
-
- $argumentDefinition = $this->getArgumentDefinitionMock(array('bindVariable'));
-
- $definition->expects($this->once())
- ->method('getArgumentDefinition')
- ->with('fooArgumentOne', true)
- ->will($this->returnValue($argumentDefinition))
- ;
-
- $argumentDefinition->expects($this->once())
- ->method('bindVariable')
- ->with(42)
- ;
-
- $variable = 42;
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->bindArgumentVariable('fooArgumentOne', $variable);
- }
-
- public function testMethodDefinitionBindings_bindArgumentRegistryEntryWithNumericArgumentIndex()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
- /** @var \Wootook\Core\DependencyInjection\Registry $registry */
- $registry = $this->getRegistryMock();
-
- $definition = $this->getMock('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition',
- array('getArgumentDefinition'), array($classDefinition, 'methodToTest', $registry));
-
- $argumentDefinition = $this->getArgumentDefinitionMock(array('bindRegistryEntry'));
-
- $definition->expects($this->once())
- ->method('getArgumentDefinition')
- ->with(0, true)
- ->will($this->returnValue($argumentDefinition))
- ;
-
- $argumentDefinition->expects($this->once())
- ->method('bindRegistryEntry')
- ->with('foo')
- ;
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->bindArgumentRegistryEntry(0, 'foo');
- }
-
- public function testMethodDefinitionBindings_bindArgumentRegistryEntryWithNamedArgumentIndex()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
- /** @var \Wootook\Core\DependencyInjection\Registry $registry */
- $registry = $this->getRegistryMock();
-
- $definition = $this->getMock('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition',
- array('getArgumentDefinition'), array($classDefinition, 'methodToTest', $registry));
-
- $argumentDefinition = $this->getArgumentDefinitionMock(array('bindRegistryEntry'));
-
- $definition->expects($this->once())
- ->method('getArgumentDefinition')
- ->with('fooArgumentOne', true)
- ->will($this->returnValue($argumentDefinition))
- ;
-
- $argumentDefinition->expects($this->once())
- ->method('bindRegistryEntry')
- ->with('foo')
- ;
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->bindArgumentRegistryEntry('fooArgumentOne', 'foo');
- }
-
- public function testMethodDefinitionBindings_bindArgumentRegistryEntryWithNoRegistry()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = $this->getMock('Wootook\\Core\\DependencyInjection\\Definition\\MethodDefinition',
- array('getArgumentDefinition'), array($classDefinition, 'methodToTest'));
-
- $argumentDefinition = $this->getArgumentDefinitionMock(array('bindRegistryEntry'));
-
- $definition->expects($this->once())
- ->method('getArgumentDefinition')
- ->with('fooArgumentOne', true)
- ->will($this->returnValue($argumentDefinition))
- ;
-
- $argumentDefinition->expects($this->once())
- ->method('bindRegistryEntry')
- ->with('foo')
- ->will($this->throwException(new \Wootook\Core\Exception\DependencyInjection\RuntimeException))
- ;
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\RuntimeException');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->bindArgumentRegistryEntry('fooArgumentOne', 'foo');
- }
-
- public function testMethodDefinition_getArgumentDefinitionWithInvalidArgumentId()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->getArgumentDefinition(1.5);
- }
-
- public function testMethodDefinition_getArgumentReflector_withNumericArgumentId()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $reflector = $definition->getArgumentReflector(0);
- $this->assertInstanceOf('ReflectionParameter', $reflector);
- $this->assertEquals(0, $reflector->getPosition());
- }
-
- public function testMethodDefinition_getArgumentReflector_withInexistentNumericArgumentId()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\BadMethodCallException');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->getArgumentReflector(5);
- }
-
- public function testMethodDefinition_getArgumentReflector_withNamedArgumentId()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $reflector = $definition->getArgumentReflector('fooArgumentOne');
- $this->assertInstanceOf('ReflectionParameter', $reflector);
- $this->assertEquals(0, $reflector->getPosition());
- }
-
- public function testMethodDefinition_getArgumentReflector_withInexistentNamedArgumentId()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\BadMethodCallException');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->getArgumentReflector('inexistentArgument');
- }
-
- public function testMethodDefinition_getArgumentReflector_withInvalidArgumentId()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\BadMethodCallException');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->getArgumentReflector(1.5);
- }
-
- public function testMethodDefinition_getArgumentDefinition_withNumericArgumentId()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $argumentDefinition = $definition->getArgumentDefinition(0);
- $this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Definition\\ArgumentDefinition', $argumentDefinition);
- }
-
- public function testMethodDefinition_getArgumentDefinition_withInexistentNumericArgumentId()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\BadMethodCallException');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->getArgumentDefinition(5);
- }
-
- public function testMethodDefinition_getArgumentDefinition_withNamedArgumentId()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $argumentDefinition = $definition->getArgumentDefinition('fooArgumentOne');
- $this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Definition\\ArgumentDefinition', $argumentDefinition);
- }
-
- public function testMethodDefinition_getArgumentDefinition_withInexistentNamedArgumentId()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->getArgumentDefinition('inexistentArgument');
- }
-
- public function testMethodDefinition_getArgumentDefinition_withInvalidArgumentId()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- $this->setExpectedException('Wootook\\Core\\Exception\\DependencyInjection\\InvalidArgumentException');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->getArgumentDefinition(1.5);
- }
-
- public function testMethodDefinition_getArgumentDefinition_withExistingArgument()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->addArgumentDefinition(0);
-
- $argumentDefinition = $definition->getArgumentDefinition(0);
- $this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Definition\\ArgumentDefinition', $argumentDefinition);
- }
-
- public function testMethodDefinition_getArgumentDefinition_withInexistingArgumentRegistered()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $argumentDefinition = $definition->getArgumentDefinition(0, true);
- $this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Definition\\ArgumentDefinition', $argumentDefinition);
- }
-
- public function testMethodDefinition_resetArgumentDefinitionList()
- {
- /** @var \Wootook\Core\DependencyInjection\Definition\ClassDefinition $classDefinition */
- $classDefinition = $this->getClassDefinitionMock();
-
- $definition = new Definition\MethodDefinition($classDefinition, 'methodToTest');
-
- /** @var \Wootook\Core\DependencyInjection\Definition\MethodDefinition $definition */
- $definition->getArgumentDefinition(0, true);
- $definition->getArgumentDefinition(1, true);
-
- $all = $definition->getAllArgumentDefinitions();
- $this->assertInternalType('array', $all);
- $this->assertCount(2, $all);
-
- $definition->reset();
- $all = $definition->getAllArgumentDefinitions();
- $this->assertInternalType('array', $all);
- $this->assertCount(0, $all);
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/FactoryTest.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/FactoryTest.php
deleted file mode 100644
index 01d3349..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/FactoryTest.php
+++ /dev/null
@@ -1,143 +0,0 @@
-_app = $this->getMock('Wootook\\Core\\App\\App', array('__construct'), array(''));
- $this->_registry = new \Wootook\Core\DependencyInjection\Registry($this->_app);
- }
-
- public function testGetRegistryWhilePassedToConstructor()
- {
- $object = new \Wootook\Core\DependencyInjection\Factory($this->_app, $this->_registry);
-
- $this->assertAttributeSame($this->_registry, '_registry', $object);
- $this->assertSame($object->getRegistry(), $this->_registry);
- }
-
- public function testGetClassDefinition_usingSpecialClassName()
- {
- $object = new \Wootook\Core\DependencyInjection\Factory($this->_app, $this->_registry, 'stdClass');
-
- $this->assertInstanceOf('stdClass', $object->getClassDefinition('stdClass'));
- }
-
- public function testGetRegistryWhileNonePassedToConstructor()
- {
- $object = new \Wootook\Core\DependencyInjection\Factory($this->_app);
-
- $this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Registry', $object->getRegistry());
- $this->assertAttributeNotEmpty('_registry', $object);
- $this->assertAttributeNotSame($this->_registry, '_registry', $object);
-
- $object->setRegistry($this->_registry);
-
- $this->assertAttributeSame($this->_registry, '_registry', $object);
- $this->assertSame($object->getRegistry(), $this->_registry);
- }
-
- public function testGetUndeclaredClassDefinition()
- {
- $object = new \Wootook\Core\DependencyInjection\Factory($this->_app, $this->_registry);
-
- $this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Definition\\ClassDefinition', $object->getClassDefinition('stdClass'));
- }
-
- public function testGetDeclaredClassDefinition()
- {
- $object = new \Wootook\Core\DependencyInjection\Factory($this->_app, $this->_registry);
-
- $classDefinition = $this->getMockBuilder('Wootook\\Core\\DependencyInjection\\Definition\\ClassDefinition')
- ->disableOriginalConstructor()
- ->getMock()
- ;
-
- $object->registerClassDefinition('stdClass', $classDefinition);
-
- $this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Definition\\ClassDefinition', $object->getClassDefinition('stdClass'));
- }
-
- public function testAddClassDefinition()
- {
- $classDefinition = $this->getMockBuilder('Wootook\\Core\\DependencyInjection\\Definition\\ClassDefinition')
- ->disableOriginalConstructor()
- ->getMock()
- ;
-
- $object = $this->getMockBuilder('Wootook\\Core\\DependencyInjection\\Factory')
- ->disableOriginalConstructor()
- ->setMethods(array('initClassDefinition', 'registerClassDefinition'))
- ->getMock()
- ;
-
- $object->expects($this->once())
- ->method('initClassDefinition')
- ->with('stdClass')
- ->will($this->returnValue($classDefinition))
- ;
-
- $object->expects($this->once())
- ->method('registerClassDefinition')
- ->with('stdClass', $classDefinition)
- ->will($this->returnSelf())
- ;
-
- $object->addClassDefinition('stdClass');
- }
-
- public function testInstanceInvocation()
- {
- $classDefinition = $this->getMockBuilder('Wootook\\Core\\DependencyInjection\\Definition\\ClassDefinition')
- ->disableOriginalConstructor()
- ->setMethods(array('newInstance'))
- ->getMock()
- ;
-
- $classDefinition->expects($this->once())
- ->method('newInstance')
- ->with(array())
- ->will($this->returnValue(new \stdClass))
- ;
-
- $object = $this->getMockBuilder('Wootook\\Core\\DependencyInjection\\Factory')
- ->disableOriginalConstructor()
- ->setMethods(array('getClassDefinition'))
- ->getMock()
- ;
-
- $object->expects($this->once())
- ->method('getClassDefinition')
- ->with('stdClass')
- ->will($this->returnValue($classDefinition))
- ;
-
- $object('stdClass');
- }
-}
diff --git a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/RegistryTest.php b/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/RegistryTest.php
deleted file mode 100644
index 6f4ede0..0000000
--- a/src/application/modules/WootookCore/test/php/WootookUnit/Core/DependencyInjection/RegistryTest.php
+++ /dev/null
@@ -1,133 +0,0 @@
-_app = $this->getMock('Wootook\\Core\\App\\App', array('__construct'), array(''));
- }
-
- public function testAddInstance()
- {
- $object = new \Wootook\Core\DependencyInjection\Registry($this->_app);
-
- $this->assertAttributeEmpty('_instances', $object);
-
- $instance = new \StdClass();
- $object->add('testing-instance', $instance);
-
- $expected = array('testing-instance' => $instance);
- $this->assertAttributeEquals($expected, '_instances', $object);
- }
-
- public function testAddInstanceWhileAlreadyExists()
- {
- $object = new \Wootook\Core\DependencyInjection\Registry($this->_app);
-
- $this->assertAttributeEmpty('_instances', $object);
-
- $instanceOne = new \StdClass();
- $object->add('testing-instance', $instanceOne);
-
- $this->setExpectedException('Wootook\\Core\\Exception\\RuntimeException');
- $instanceTwo = new \StdClass();
- $object->add('testing-instance', $instanceTwo);
- }
-
- public function testSetInstance()
- {
- $object = new \Wootook\Core\DependencyInjection\Registry($this->_app);
-
- $this->assertAttributeEmpty('_instances', $object);
-
- $instance = new \StdClass();
- $object->set('testing-instance', $instance);
-
- $expected = array('testing-instance' => $instance);
- $this->assertAttributeEquals($expected, '_instances', $object);
- }
-
- public function testSetInstanceWhileOneIsAlreadyExisting()
- {
- $object = new \Wootook\Core\DependencyInjection\Registry($this->_app);
-
- $this->assertAttributeEmpty('_instances', $object);
-
- $instanceOne = new \StdClass();
- $object->set('testing-instance', $instanceOne);
- $expected = array('testing-instance' => $instanceOne);
- $this->assertAttributeEquals($expected, '_instances', $object);
-
- $this->setExpectedException('Wootook\\Core\\Exception\\BadMethodCallException');
- $instanceTwo = new \StdClass();
- $object->set('testing-instance', $instanceTwo);
- }
-
- public function testGetInstance()
- {
- $object = new \Wootook\Core\DependencyInjection\Registry($this->_app);
-
- $this->assertAttributeEmpty('_instances', $object);
-
- $instance = new \StdClass();
- $object->set('testing-instance', $instance);
-
- $this->assertSame($instance, $object->get('testing-instance'));
- }
-
- public function testDeleteInstance()
- {
- $object = new \Wootook\Core\DependencyInjection\Registry($this->_app);
-
- $this->assertAttributeEmpty('_instances', $object);
-
- $instanceOne = new \StdClass();
- $object->set('testing-instance', $instanceOne);
-
- $instanceTwo = new \StdClass();
- $object->set('testing-instance2', $instanceTwo);
-
- $expected = array('testing-instance' => $instanceOne, 'testing-instance2' => $instanceTwo);
- $this->assertAttributeEquals($expected, '_instances', $object);
-
- $object->delete('testing-instance2');
-
- $expected = array('testing-instance' => $instanceOne);
- $this->assertAttributeEquals($expected, '_instances', $object);
- }
-
- public function testClearAllInstances()
- {
- $object = new \Wootook\Core\DependencyInjection\Registry($this->_app);
-
- $this->assertAttributeEmpty('_instances', $object);
-
- $instanceOne = new \StdClass();
- $object->set('testing-instance', $instanceOne);
-
- $instanceTwo = new \StdClass();
- $object->set('testing-instance2', $instanceTwo);
-
- $expected = array('testing-instance' => $instanceOne, 'testing-instance2' => $instanceTwo);
- $this->assertAttributeEquals($expected, '_instances', $object);
-
- $object->clear();
-
- $this->assertAttributeEquals(array(), '_instances', $object);
- }
-}
diff --git a/src/application/modules/WootookCore/test/phpunit.xml b/src/application/modules/WootookCore/test/phpunit.xml
deleted file mode 100644
index 76bb90c..0000000
--- a/src/application/modules/WootookCore/test/phpunit.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
- ./php/WootookUnit/Core
-
-
-
-
-
-
- ../src/Wootook/Core
-
-
-
-
-
-
-
-
diff --git a/src/application/modules/WootookPlayer/autoload_classmap.php b/src/application/modules/WootookPlayer/autoload_classmap.php
deleted file mode 100644
index ef9d742..0000000
--- a/src/application/modules/WootookPlayer/autoload_classmap.php
+++ /dev/null
@@ -1,123 +0,0 @@
- __DIR__ . '/src/Wootook/Core/App.php',
- 'Wootook\\Core\\Base\\Service\\App' => __DIR__ . '/src/Wootook/Core/Base/Service/App.php',
- 'Wootook\\Core\\BaseObject' => __DIR__ . '/src/Wootook/Core/BaseObject.php',
- 'Wootook\\Core\\Block\\Concat' => __DIR__ . '/src/Wootook/Core/Block/Concat.php',
- 'Wootook\\Core\\Block\\Deprecated' => __DIR__ . '/src/Wootook/Core/Block/Deprecated.php',
- 'Wootook\\Core\\Block\\Html\\Form' => __DIR__ . '/src/Wootook/Core/Block/Html/Form.php',
- 'Wootook\\Core\\Block\\Html\\Head' => __DIR__ . '/src/Wootook/Core/Block/Html/Head.php',
- 'Wootook\\Core\\Block\\Html\\Home' => __DIR__ . '/src/Wootook/Core/Block/Html/Home.php',
- 'Wootook\\Core\\Block\\Html\\Navigation\\Link' => __DIR__ . '/src/Wootook/Core/Block/Html/Navigation/Link.php',
- 'Wootook\\Core\\Block\\Html\\Navigation\\Menu' => __DIR__ . '/src/Wootook/Core/Block/Html/Navigation/Menu.php',
- 'Wootook\\Core\\Block\\Html\\Navigation\\Node' => __DIR__ . '/src/Wootook/Core/Block/Html/Navigation/Node.php',
- 'Wootook\\Core\\Block\\Html\\Page' => __DIR__ . '/src/Wootook/Core/Block/Html/Page.php',
- 'Wootook\\Core\\Block\\Messages' => __DIR__ . '/src/Wootook/Core/Block/Messages.php',
- 'Wootook\\Core\\Block\\Template' => __DIR__ . '/src/Wootook/Core/Block/Template.php',
- 'Wootook\\Core\\Block\\Text' => __DIR__ . '/src/Wootook/Core/Block/Text.php',
- 'Wootook\\Core\\Config\\Adapter\\Adapter' => __DIR__ . '/src/Wootook/Core/Config/Adapter/Adapter.php',
- 'Wootook\\Core\\Config\\Adapter\\PhpArray' => __DIR__ . '/src/Wootook/Core/Config/Adapter/PhpArray.php',
- 'Wootook\\Core\\Config\\Node' => __DIR__ . '/src/Wootook/Core/Config/Node.php',
- 'Wootook\\Core\\Controller\\ErrorController' => __DIR__ . '/src/Wootook/Core/Controller/ErrorController.php',
- 'Wootook\\Core\\Controller\\IndexController' => __DIR__ . '/src/Wootook/Core/Controller/IndexController.php',
- 'Wootook\\Core\\Database\\Adapter\\Adapter' => __DIR__ . '/src/Wootook/Core/Database/Adapter/Adapter.php',
- 'Wootook\\Core\\Database\\Adapter\\Pdo\\Mysql' => __DIR__ . '/src/Wootook/Core/Database/Adapter/Pdo/Mysql.php',
- 'Wootook\\Core\\Database\\ConnectionManager' => __DIR__ . '/src/Wootook/Core/Database/ConnectionManager.php',
- 'Wootook\\Core\\Database\\Orm\\DataMapper\\Config' => __DIR__ . '/src/Wootook/Core/Database/Orm/DataMapper/Config.php',
- 'Wootook\\Core\\Database\\Orm\\DataMapper\\DateTime' => __DIR__ . '/src/Wootook/Core/Database/Orm/DataMapper/DateTime.php',
- 'Wootook\\Core\\Database\\Orm\\DataMapper\\FieldMapper' => __DIR__ . '/src/Wootook/Core/Database/Orm/DataMapper/FieldMapper.php',
- 'Wootook\\Core\\Database\\Orm\\DataMapper\\PhpArray' => __DIR__ . '/src/Wootook/Core/Database/Orm/DataMapper/PhpArray.php',
- 'Wootook\\Core\\Database\\Orm\\DataMapper\\PhpObject' => __DIR__ . '/src/Wootook/Core/Database/Orm/DataMapper/PhpObject.php',
- 'Wootook\\Core\\Database\\Orm\\DataMapper' => __DIR__ . '/src/Wootook/Core/Database/Orm/DataMapper.php',
- 'Wootook\\Core\\Database\\Resource\\DataMapper' => __DIR__ . '/src/Wootook/Core/Database/Resource/DataMapper.php',
- 'Wootook\\Core\\Database\\Resource\\ReadConnection' => __DIR__ . '/src/Wootook/Core/Database/Resource/ReadConnection.php',
- 'Wootook\\Core\\Database\\Resource\\WriteConnection' => __DIR__ . '/src/Wootook/Core/Database/Resource/WriteConnection.php',
- 'Wootook\\Core\\Database\\Sql\\Delete' => __DIR__ . '/src/Wootook/Core/Database/Sql/Delete.php',
- 'Wootook\\Core\\Database\\Sql\\Dml' => __DIR__ . '/src/Wootook/Core/Database/Sql/Dml.php',
- 'Wootook\\Core\\Database\\Sql\\DmlFilterableQuery' => __DIR__ . '/src/Wootook/Core/Database/Sql/DmlFilterableQuery.php',
- 'Wootook\\Core\\Database\\Sql\\DmlQuery' => __DIR__ . '/src/Wootook/Core/Database/Sql/DmlQuery.php',
- 'Wootook\\Core\\Database\\Sql\\Insert' => __DIR__ . '/src/Wootook/Core/Database/Sql/Insert.php',
- 'Wootook\\Core\\Database\\Sql\\Mysql\\Select' => __DIR__ . '/src/Wootook/Core/Database/Sql/Mysql/Select.php',
- 'Wootook\\Core\\Database\\Sql\\Placeholder\\Expression' => __DIR__ . '/src/Wootook/Core/Database/Sql/Placeholder/Expression.php',
- 'Wootook\\Core\\Database\\Sql\\Placeholder\\Param' => __DIR__ . '/src/Wootook/Core/Database/Sql/Placeholder/Param.php',
- 'Wootook\\Core\\Database\\Sql\\Placeholder\\Placeholder' => __DIR__ . '/src/Wootook/Core/Database/Sql/Placeholder/Placeholder.php',
- 'Wootook\\Core\\Database\\Sql\\Placeholder\\Variable' => __DIR__ . '/src/Wootook/Core/Database/Sql/Placeholder/Variable.php',
- 'Wootook\\Core\\Database\\Sql\\Select' => __DIR__ . '/src/Wootook/Core/Database/Sql/Select.php',
- 'Wootook\\Core\\Database\\Sql\\Update' => __DIR__ . '/src/Wootook/Core/Database/Sql/Update.php',
- 'Wootook\\Core\\Database\\Statement\\Pdo\\Mysql' => __DIR__ . '/src/Wootook/Core/Database/Statement/Pdo/Mysql.php',
- 'Wootook\\Core\\Database\\Statement\\Statement' => __DIR__ . '/src/Wootook/Core/Database/Statement/Statement.php',
- 'Wootook\\Core\\DateTime' => __DIR__ . '/src/Wootook/Core/DateTime.php',
- 'Wootook\\Core\\Email\\Email' => __DIR__ . '/src/Wootook/Core/Email/Email.php',
- 'Wootook\\Core\\Email\\Part\\Part' => __DIR__ . '/src/Wootook/Core/Email/Part/Part.php',
- 'Wootook\\Core\\Email\\Transport\\Sendmail' => __DIR__ . '/src/Wootook/Core/Email/Transport/Sendmail.php',
- 'Wootook\\Core\\Email\\Transport\\Transport' => __DIR__ . '/src/Wootook/Core/Email/Transport/Transport.php',
- 'Wootook\\Core\\Event\\Break' => __DIR__ . '/src/Wootook/Core/Event/Break.php',
- 'Wootook\\Core\\Event' => __DIR__ . '/src/Wootook/Core/Event.php',
- 'Wootook\\Core\\Exception\\CoreException' => __DIR__ . '/src/Wootook/Core/Exception/CoreException.php',
- 'Wootook\\Core\\Exception\\DataAccessException' => __DIR__ . '/src/Wootook/Core/Exception/DataAccessException.php',
- 'Wootook\\Core\\Exception\\Database\\AdapterError' => __DIR__ . '/src/Wootook/Core/Exception/Database/AdapterError.php',
- 'Wootook\\Core\\Exception\\Database\\Error' => __DIR__ . '/src/Wootook/Core/Exception/Database/Error.php',
- 'Wootook\\Core\\Exception\\Database\\StatementError' => __DIR__ . '/src/Wootook/Core/Exception/Database/StatementError.php',
- 'Wootook\\Core\\Exception\\Deprecated' => __DIR__ . '/src/Wootook/Core/Exception/Deprecated.php',
- 'Wootook\\Core\\Exception\\Exception' => __DIR__ . '/src/Wootook/Core/Exception/Exception.php',
- 'Wootook\\Core\\Exception\\GameError' => __DIR__ . '/src/Wootook/Core/Exception/GameError.php',
- 'Wootook\\Core\\Exception\\LayoutException' => __DIR__ . '/src/Wootook/Core/Exception/LayoutException.php',
- 'Wootook\\Core\\Exception\\RuntimeException' => __DIR__ . '/src/Wootook/Core/Exception/RuntimeException.php',
- 'Wootook\\Core\\Exception\\WebsiteError' => __DIR__ . '/src/Wootook/Core/Exception/WebsiteError.php',
- 'Wootook\\Core\\Form\\Element\\BaseElement' => __DIR__ . '/src/Wootook/Core/Form/Element/BaseElement.php',
- 'Wootook\\Core\\Form\\Element\\Button' => __DIR__ . '/src/Wootook/Core/Form/Element/Button.php',
- 'Wootook\\Core\\Form\\Element\\Text' => __DIR__ . '/src/Wootook/Core/Form/Element/Text.php',
- 'Wootook\\Core\\Form\\ElementLoader' => __DIR__ . '/src/Wootook/Core/Form/ElementLoader.php',
- 'Wootook\\Core\\Form\\Form' => __DIR__ . '/src/Wootook/Core/Form/Form.php',
- 'Wootook\\Core\\Form\\Validator\\Alnum' => __DIR__ . '/src/Wootook/Core/Form/Validator/Alnum.php',
- 'Wootook\\Core\\Form\\Validator\\Alpha' => __DIR__ . '/src/Wootook/Core/Form/Validator/Alpha.php',
- 'Wootook\\Core\\Form\\Validator\\BaseValidator' => __DIR__ . '/src/Wootook/Core/Form/Validator/BaseValidator.php',
- 'Wootook\\Core\\Form\\Validator\\Email' => __DIR__ . '/src/Wootook/Core/Form/Validator/Email.php',
- 'Wootook\\Core\\Form\\Validator\\FormKey' => __DIR__ . '/src/Wootook/Core/Form/Validator/FormKey.php',
- 'Wootook\\Core\\Form\\Validator\\Hex' => __DIR__ . '/src/Wootook/Core/Form/Validator/Hex.php',
- 'Wootook\\Core\\Form\\Validator\\Host' => __DIR__ . '/src/Wootook/Core/Form/Validator/Host.php',
- 'Wootook\\Core\\Form\\Validator\\Numeric' => __DIR__ . '/src/Wootook/Core/Form/Validator/Numeric.php',
- 'Wootook\\Core\\Form\\Validator\\Regex' => __DIR__ . '/src/Wootook/Core/Form/Validator/Regex.php',
- 'Wootook\\Core\\Form\\ValidatorLoader' => __DIR__ . '/src/Wootook/Core/Form/ValidatorLoader.php',
- 'Wootook\\Core\\Helper\\Config\\ConfigHandler' => __DIR__ . '/src/Wootook/Core/Helper/Config/ConfigHandler.php',
- 'Wootook\\Core\\Helper\\Config\\Events' => __DIR__ . '/src/Wootook/Core/Helper/Config/Events.php',
- 'Wootook\\Core\\Helper\\Config\\Modules' => __DIR__ . '/src/Wootook/Core/Helper/Config/Modules.php',
- 'Wootook\\Core\\Layout\\Manager' => __DIR__ . '/src/Wootook/Core/Layout/Manager.php',
- 'Wootook\\Core\\Layout\\Parser' => __DIR__ . '/src/Wootook/Core/Layout/Parser.php',
- 'Wootook\\Core\\Model\\Config' => __DIR__ . '/src/Wootook/Core/Model/Config.php',
- 'Wootook\\Core\\Model\\Game' => __DIR__ . '/src/Wootook/Core/Model/Game.php',
- 'Wootook\\Core\\Model\\Image\\Png' => __DIR__ . '/src/Wootook/Core/Model/Image/Png.php',
- 'Wootook\\Core\\Model\\Session' => __DIR__ . '/src/Wootook/Core/Model/Session.php',
- 'Wootook\\Core\\Model\\Translator' => __DIR__ . '/src/Wootook/Core/Model/Translator.php',
- 'Wootook\\Core\\Model\\Website' => __DIR__ . '/src/Wootook/Core/Model/Website.php',
- 'Wootook\\Core\\Mvc\\Controller\\Action' => __DIR__ . '/src/Wootook/Core/Mvc/Controller/Action.php',
- 'Wootook\\Core\\Mvc\\Controller\\Front' => __DIR__ . '/src/Wootook/Core/Mvc/Controller/Front.php',
- 'Wootook\\Core\\Mvc\\Controller\\Request\\Http' => __DIR__ . '/src/Wootook/Core/Mvc/Controller/Request/Http.php',
- 'Wootook\\Core\\Mvc\\Controller\\Request\\Request' => __DIR__ . '/src/Wootook/Core/Mvc/Controller/Request/Request.php',
- 'Wootook\\Core\\Mvc\\Controller\\Response\\Http' => __DIR__ . '/src/Wootook/Core/Mvc/Controller/Response/Http.php',
- 'Wootook\\Core\\Mvc\\Controller\\Response\\Response' => __DIR__ . '/src/Wootook/Core/Mvc/Controller/Response/Response.php',
- 'Wootook\\Core\\Mvc\\Model\\Action\\Deletable' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Action/Deletable.php',
- 'Wootook\\Core\\Mvc\\Model\\Action\\Delete' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Action/Delete.php',
- 'Wootook\\Core\\Mvc\\Model\\Action\\Load' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Action/Load.php',
- 'Wootook\\Core\\Mvc\\Model\\Action\\Loadable' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Action/Loadable.php',
- 'Wootook\\Core\\Mvc\\Model\\Action\\Savable' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Action/Savable.php',
- 'Wootook\\Core\\Mvc\\Model\\Action\\Save' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Action/Save.php',
- 'Wootook\\Core\\Mvc\\Model\\Entity' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Entity.php',
- 'Wootook\\Core\\Mvc\\Model\\EntityInterface' => __DIR__ . '/src/Wootook/Core/Mvc/Model/EntityInterface.php',
- 'Wootook\\Core\\Mvc\\Model\\SubTable' => __DIR__ . '/src/Wootook/Core/Mvc/Model/SubTable.php',
- 'Wootook\\Core\\Mvc\\Model\\Type\\Base' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Type/Base.php',
- 'Wootook\\Core\\Mvc\\Model\\Type\\Full' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Type/Full.php',
- 'Wootook\\Core\\Mvc\\Model\\Type\\Readonly' => __DIR__ . '/src/Wootook/Core/Mvc/Model/Type/Readonly.php',
- 'Wootook\\Core\\Mvc\\View\\View' => __DIR__ . '/src/Wootook/Core/Mvc/View/View.php',
- 'Wootook\\Core\\PluginLoader\\PluginLoader' => __DIR__ . '/src/Wootook/Core/PluginLoader/PluginLoader.php',
- 'Wootook\\Core\\Profiler\\ErrorProfiler' => __DIR__ . '/src/Wootook/Core/Profiler/ErrorProfiler.php',
- 'Wootook\\Core\\Resource\\Entity' => __DIR__ . '/src/Wootook/Core/Resource/Entity.php',
- 'Wootook\\Core\\Resource\\EntityCollection\\Action\\Load' => __DIR__ . '/src/Wootook/Core/Resource/EntityCollection/Action/Load.php',
- 'Wootook\\Core\\Resource\\EntityCollection\\Action\\Loadable' => __DIR__ . '/src/Wootook/Core/Resource/EntityCollection/Action/Loadable.php',
- 'Wootook\\Core\\Resource\\EntityCollection' => __DIR__ . '/src/Wootook/Core/Resource/EntityCollection.php',
- 'Wootook\\Core\\Setup\\Exception\\RuntimeException' => __DIR__ . '/src/Wootook/Core/Setup/Exception/RuntimeException.php',
- 'Wootook\\Core\\Setup\\Exception\\VersionStageError' => __DIR__ . '/src/Wootook/Core/Setup/Exception/VersionStageError.php',
- 'Wootook\\Core\\Setup\\Exception\\VersionValueError' => __DIR__ . '/src/Wootook/Core/Setup/Exception/VersionValueError.php',
- 'Wootook\\Core\\Setup\\Updater\\ScriptQueue' => __DIR__ . '/src/Wootook/Core/Setup/Updater/ScriptQueue.php',
- 'Wootook\\Core\\Setup\\Updater' => __DIR__ . '/src/Wootook/Core/Setup/Updater.php',
- 'Wootook\\Core\\Singleton' => __DIR__ . '/src/Wootook/Core/Singleton.php',
-);
diff --git a/src/application/modules/WootookPlayer/autoload_function.php b/src/application/modules/WootookPlayer/autoload_function.php
deleted file mode 100644
index 3cce3b6..0000000
--- a/src/application/modules/WootookPlayer/autoload_function.php
+++ /dev/null
@@ -1,11 +0,0 @@
-isDir()) {
- export($fileList, instance($file->getPathname()),
- ($baseNamespace === null ? $file->getBasename('.php') : $baseNamespace . "\\" . $file->getBasename('.php')),
- ($basePath === null ? $file->getBasename() : $basePath . "/" . $file->getBasename()));
- } else if (strtolower($file->getExtension()) !== 'php') {
- continue;
- } else {
- $className = $baseNamespace . '\\' . $file->getBasename('.php');
- $fileList[$className] = $basePath . '/' . $file->getBasename();
- }
- }
-};
-
-$directory = dirname(__DIR__) . '/code/core/WootookCore/src';
-$fileList = array();
-
-export($fileList, instance($directory));
-
-$longest = 0;
-foreach ($fileList as $class => $file) {
- $length = strlen($class);
- if ($length > $longest) {
- $longest = $length;
- }
-}
-echo " $file) {
- $pad = str_pad('', $longest - strlen($class), ' ', STR_PAD_RIGHT);
- echo " '{$class}'{$pad} => __DIR__ . '/src/{$file}',\n";
-}
-echo " );\n";
-
diff --git a/src/banned.php b/src/banned.php
index a90d418..7874d75 100644
--- a/src/banned.php
+++ b/src/banned.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
includeLang('banned');
@@ -59,4 +59,4 @@ else
display(parsetemplate(gettemplate('banned_body'), $parse),'Banned',true);
-?>
+?>
\ No newline at end of file
diff --git a/src/buddy.php b/src/buddy.php
index 213cdcc..edc72dc 100644
--- a/src/buddy.php
+++ b/src/buddy.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
includeLang('buddy');
diff --git a/src/changelog.php b/src/changelog.php
index 106d5f5..ff78373 100644
--- a/src/changelog.php
+++ b/src/changelog.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
includeLang('changelog');
$template = gettemplate('changelog_table');
@@ -53,4 +53,4 @@ $page .= parsetemplate(gettemplate('changelog_body'), $parse);
display($page,"Change Log");
-?>
+?>
\ No newline at end of file
diff --git a/src/chat.php b/src/chat.php
index bab9077..a10f64b 100644
--- a/src/chat.php
+++ b/src/chat.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
includeLang('chat');
$BodyTPL = gettemplate('chat_body');
@@ -42,4 +42,4 @@ require_once dirname(__FILE__) .'/application/bc.php';
display($page, $lang['Chat'], false);
// Shoutbox by e-Zobar - Copyright Wootook Team 2008
-?>
+?>
\ No newline at end of file
diff --git a/src/chat_add.php b/src/chat_add.php
index cb9e8e0..62381d4 100644
--- a/src/chat_add.php
+++ b/src/chat_add.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
// On récupère les informations du message et de l'envoyeur
if (isset($_POST["msg"]) && isset($user['username'])) {
@@ -50,4 +50,4 @@ require_once dirname(__FILE__) .'/application/bc.php';
}
// Shoutbox by e-Zobar - Copyright Wootook Team 2008
-?>
+?>
\ No newline at end of file
diff --git a/src/chat_msg.php b/src/chat_msg.php
index ce31199..7228440 100644
--- a/src/chat_msg.php
+++ b/src/chat_msg.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
// On efface les anciens messages
$timemoment=time();
@@ -70,4 +70,4 @@ while($v=mysql_fetch_object($query)){
}
// Shoutbox by e-Zobar - Copyright Wootook Team 2008
-?>
+?>
\ No newline at end of file
diff --git a/src/contact.php b/src/contact.php
index beac507..437950c 100644
--- a/src/contact.php
+++ b/src/contact.php
@@ -31,7 +31,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
define('DISABLE_IDENTITY_CHECK', true);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
includeLang('contact');
diff --git a/src/fleet.php b/src/fleet.php
index e2b5ebb..e43bc39 100644
--- a/src/fleet.php
+++ b/src/fleet.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
$labels = Wootook_Empire_Helper_Config_Labels::getSingleton();
//Compteur de flotte en expéditions et nombre d'expédition maximum
diff --git a/src/fleetback.php b/src/fleetback.php
index 10c21fd..4075674 100644
--- a/src/fleetback.php
+++ b/src/fleetback.php
@@ -13,7 +13,7 @@ Last revision: 13/07/11
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
includeLang('fleet');
$BoxTitle = $lang['fl_error'];
diff --git a/src/fleetshortcut.php b/src/fleetshortcut.php
index e309fb6..016de90 100644
--- a/src/fleetshortcut.php
+++ b/src/fleetshortcut.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
$mode = isset($_GET['mode']) ? $_GET['mode'] : null;
diff --git a/src/floten1.php b/src/floten1.php
index 908729e..5c881a1 100644
--- a/src/floten1.php
+++ b/src/floten1.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
includeLang('fleet');
$speed = array(
diff --git a/src/floten2.php b/src/floten2.php
index 2e42657..1563070 100644
--- a/src/floten2.php
+++ b/src/floten2.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
includeLang('fleet');
$session = Wootook::getSession('fleet');
diff --git a/src/floten3.php b/src/floten3.php
index a121e29..23f3985 100644
--- a/src/floten3.php
+++ b/src/floten3.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
includeLang('fleet');
diff --git a/src/flotenajax.php b/src/flotenajax.php
index 5a1e2b6..8101ab0 100644
--- a/src/flotenajax.php
+++ b/src/flotenajax.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
includeLang('galaxy');
includeLang('fleet');
@@ -275,4 +275,4 @@ require_once dirname(__FILE__) .'/application/bc.php';
$ResultMessage .= $CurrentFlyingFleets ." ".$UserSpyProbes." ".$UserRecycles." ".$UserMissiles;
die ( $ResultMessage );
-?>
+?>
\ No newline at end of file
diff --git a/src/galaxy.php b/src/galaxy.php
index 19c83fd..b3f8cb5 100644
--- a/src/galaxy.php
+++ b/src/galaxy.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
includeLang('galaxy');
@@ -140,7 +140,7 @@ if ($mode == 2) {
$page .= ShowGalaxyMISelector($galaxy, $system, $planet, $CurrentPlanet['id'], $CurrentMIP);
}
-$page .= '
';
+$page .= "
";
$page .= ShowGalaxyTitles($galaxy, $system);
$page .= ShowGalaxyRows($galaxy, $system);
@@ -156,4 +156,4 @@ display($page, $lang, false, '', false);
// 1.1 - Modified by -MoF- (UGamela germany)
// 1.2 - 1er Nettoyage Chlorel ...
// 1.3 - 2eme Nettoyage Chlorel ... Mise en fonction et debuging complet
-?>
+?>
\ No newline at end of file
diff --git a/src/imperium.php b/src/imperium.php
index 34c4307..fb89688 100644
--- a/src/imperium.php
+++ b/src/imperium.php
@@ -30,7 +30,7 @@
define('INSIDE' , true);
define('INSTALL' , false);
-require_once dirname(__FILE__) .'/application/bc.php';
+require_once dirname(__FILE__) .'/application/bootstrap.php';
includeLang('imperium');
diff --git a/src/includes/functions/GalaxyCheckFunctions.php b/src/includes/functions/GalaxyCheckFunctions.php
index d2431ba..505fc8f 100644
--- a/src/includes/functions/GalaxyCheckFunctions.php
+++ b/src/includes/functions/GalaxyCheckFunctions.php
@@ -31,29 +31,27 @@
/**
*
* @deprecated
- * @param Wootook_Empire_Model_Planet $moon
+ * @param unknown_type $lunarow
*/
-function CheckAbandonMoonState($moon)
-{
- if ($moon->isErasable()) {
- $moon->getGalaxyData()->setData('id_luna', 0)->save();
- $moon->delete();
- }
+function CheckAbandonMoonState ($lunarow) {
+ if (($lunarow['destruyed'] + 172800) <= time() && $lunarow['destruyed'] != 0) {
+ $query = doquery("DELETE FROM {{table}} WHERE id = '" . $lunarow['id'] . "'", "lunas");
+ }
}
/**
- * Suppression complete d'une planète
+ * Suppression complete d'une planete
*
- * @param Wootook_Empire_Model_Planet
* @deprecated
*/
-function CheckAbandonPlanetState(Wootook_Empire_Model_Planet $planet)
-{
- if ($planet->isErasable()) {
- $planet->getGalaxyData()->delete();
- if ($moon = $planet->getMoon()) {
- $moon->delete();
- }
- $planet->delete();
- }
-}
\ No newline at end of file
+function CheckAbandonPlanetState (&$planet) {
+ trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
+ if ($planet['destruyed'] <= time()) {
+ $id = $planet['id'];
+ doquery("DELETE FROM {{table}} WHERE id={$id}", 'planets');
+ doquery("DELETE FROM {{table}} WHERE id_planet={$id}", 'galaxy');
+ }
+}
+
+
+?>
\ No newline at end of file
diff --git a/src/includes/functions/GalaxyRowPlanet.php b/src/includes/functions/GalaxyRowPlanet.php
index 888f791..36301be 100644
--- a/src/includes/functions/GalaxyRowPlanet.php
+++ b/src/includes/functions/GalaxyRowPlanet.php
@@ -109,7 +109,7 @@ function GalaxyRowPlanet ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy
$Result .= "";
$Result .= "