@@ -19,88 +19,88 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | abstract class Base |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * Returns a list of tax rates and values for the given basket. |
|
| 26 | - * |
|
| 27 | - * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket containing the products, services, etc. |
|
| 28 | - * @return array Associative list of tax rates as key and corresponding amounts as value |
|
| 29 | - */ |
|
| 30 | - protected function getTaxRates( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 31 | - { |
|
| 32 | - $taxrates = array(); |
|
| 24 | + /** |
|
| 25 | + * Returns a list of tax rates and values for the given basket. |
|
| 26 | + * |
|
| 27 | + * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket containing the products, services, etc. |
|
| 28 | + * @return array Associative list of tax rates as key and corresponding amounts as value |
|
| 29 | + */ |
|
| 30 | + protected function getTaxRates( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 31 | + { |
|
| 32 | + $taxrates = array(); |
|
| 33 | 33 | |
| 34 | - foreach( $basket->getProducts() as $product ) |
|
| 35 | - { |
|
| 36 | - $price = clone $product->getPrice(); |
|
| 37 | - $taxrate = $price->getTaxrate(); |
|
| 34 | + foreach( $basket->getProducts() as $product ) |
|
| 35 | + { |
|
| 36 | + $price = clone $product->getPrice(); |
|
| 37 | + $taxrate = $price->getTaxrate(); |
|
| 38 | 38 | |
| 39 | - if( isset( $taxrates[$taxrate] ) ) { |
|
| 40 | - $taxrates[$taxrate]->addItem( $price, $product->getQuantity() ); |
|
| 41 | - } else { |
|
| 42 | - $taxrates[$taxrate] = $price->addItem( $price, $product->getQuantity() - 1 ); |
|
| 43 | - } |
|
| 44 | - } |
|
| 39 | + if( isset( $taxrates[$taxrate] ) ) { |
|
| 40 | + $taxrates[$taxrate]->addItem( $price, $product->getQuantity() ); |
|
| 41 | + } else { |
|
| 42 | + $taxrates[$taxrate] = $price->addItem( $price, $product->getQuantity() - 1 ); |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - try |
|
| 47 | - { |
|
| 48 | - $price = clone $basket->getService( 'delivery' )->getPrice(); |
|
| 49 | - $taxrate = $price->getTaxrate(); |
|
| 46 | + try |
|
| 47 | + { |
|
| 48 | + $price = clone $basket->getService( 'delivery' )->getPrice(); |
|
| 49 | + $taxrate = $price->getTaxrate(); |
|
| 50 | 50 | |
| 51 | - if( isset( $taxrates[$taxrate] ) ) { |
|
| 52 | - $taxrates[$taxrate]->addItem( $price ); |
|
| 53 | - } else { |
|
| 54 | - $taxrates[$taxrate] = $price; |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | - catch( \Exception $e ) { ; } // if delivery service isn't available |
|
| 51 | + if( isset( $taxrates[$taxrate] ) ) { |
|
| 52 | + $taxrates[$taxrate]->addItem( $price ); |
|
| 53 | + } else { |
|
| 54 | + $taxrates[$taxrate] = $price; |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | + catch( \Exception $e ) { ; } // if delivery service isn't available |
|
| 58 | 58 | |
| 59 | - try |
|
| 60 | - { |
|
| 61 | - $price = clone $basket->getService( 'payment' )->getPrice(); |
|
| 62 | - $taxrate = $price->getTaxrate(); |
|
| 59 | + try |
|
| 60 | + { |
|
| 61 | + $price = clone $basket->getService( 'payment' )->getPrice(); |
|
| 62 | + $taxrate = $price->getTaxrate(); |
|
| 63 | 63 | |
| 64 | - if( isset( $taxrates[$taxrate] ) ) { |
|
| 65 | - $taxrates[$taxrate]->addItem( $price ); |
|
| 66 | - } else { |
|
| 67 | - $taxrates[$taxrate] = $price; |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - catch( \Exception $e ) { ; } // if payment service isn't available |
|
| 64 | + if( isset( $taxrates[$taxrate] ) ) { |
|
| 65 | + $taxrates[$taxrate]->addItem( $price ); |
|
| 66 | + } else { |
|
| 67 | + $taxrates[$taxrate] = $price; |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + catch( \Exception $e ) { ; } // if payment service isn't available |
|
| 71 | 71 | |
| 72 | - return $taxrates; |
|
| 73 | - } |
|
| 72 | + return $taxrates; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Returns the payment status at which download files are shown |
|
| 78 | - * |
|
| 79 | - * @return integer Payment status from \Aimeos\MShop\Order\Item\Base |
|
| 80 | - */ |
|
| 81 | - protected function getDownloadPaymentStatus() |
|
| 82 | - { |
|
| 83 | - $config = $this->getContext()->getConfig(); |
|
| 84 | - $default = \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED; |
|
| 76 | + /** |
|
| 77 | + * Returns the payment status at which download files are shown |
|
| 78 | + * |
|
| 79 | + * @return integer Payment status from \Aimeos\MShop\Order\Item\Base |
|
| 80 | + */ |
|
| 81 | + protected function getDownloadPaymentStatus() |
|
| 82 | + { |
|
| 83 | + $config = $this->getContext()->getConfig(); |
|
| 84 | + $default = \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED; |
|
| 85 | 85 | |
| 86 | - /** client/html/common/summary/detail/download/payment-status |
|
| 87 | - * Minium payment status value for product download files |
|
| 88 | - * |
|
| 89 | - * This setting specifies the payment status value of an order for which |
|
| 90 | - * links to bought product download files are shown on the "thank you" |
|
| 91 | - * page, in the "MyAccount" and in the e-mails sent to the customers. |
|
| 92 | - * |
|
| 93 | - * The value is one of the payment constant values from |
|
| 94 | - * {@link https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Order/Item/Base.php#L105}. |
|
| 95 | - * Most of the time, only two values are of interest: |
|
| 96 | - * * 5: payment authorized |
|
| 97 | - * * 6: payment received |
|
| 98 | - * |
|
| 99 | - * @param integer Order payment constant value |
|
| 100 | - * @since 2016.3 |
|
| 101 | - * @category User |
|
| 102 | - * @category Developer |
|
| 103 | - */ |
|
| 104 | - return $config->get( 'client/html/common/summary/detail/download/payment-status', $default ); |
|
| 105 | - } |
|
| 86 | + /** client/html/common/summary/detail/download/payment-status |
|
| 87 | + * Minium payment status value for product download files |
|
| 88 | + * |
|
| 89 | + * This setting specifies the payment status value of an order for which |
|
| 90 | + * links to bought product download files are shown on the "thank you" |
|
| 91 | + * page, in the "MyAccount" and in the e-mails sent to the customers. |
|
| 92 | + * |
|
| 93 | + * The value is one of the payment constant values from |
|
| 94 | + * {@link https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Order/Item/Base.php#L105}. |
|
| 95 | + * Most of the time, only two values are of interest: |
|
| 96 | + * * 5: payment authorized |
|
| 97 | + * * 6: payment received |
|
| 98 | + * |
|
| 99 | + * @param integer Order payment constant value |
|
| 100 | + * @since 2016.3 |
|
| 101 | + * @category User |
|
| 102 | + * @category Developer |
|
| 103 | + */ |
|
| 104 | + return $config->get( 'client/html/common/summary/detail/download/payment-status', $default ); |
|
| 105 | + } |
|
| 106 | 106 | } |
| 107 | 107 | \ No newline at end of file |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | } else { |
| 54 | 54 | $taxrates[$taxrate] = $price; |
| 55 | 55 | } |
| 56 | - } |
|
| 57 | - catch( \Exception $e ) { ; } // if delivery service isn't available |
|
| 56 | + } catch( \Exception $e ) { ; } // if delivery service isn't available |
|
| 58 | 57 | |
| 59 | 58 | try |
| 60 | 59 | { |
@@ -66,8 +65,7 @@ discard block |
||
| 66 | 65 | } else { |
| 67 | 66 | $taxrates[$taxrate] = $price; |
| 68 | 67 | } |
| 69 | - } |
|
| 70 | - catch( \Exception $e ) { ; } // if payment service isn't available |
|
| 68 | + } catch( \Exception $e ) { ; } // if payment service isn't available |
|
| 71 | 69 | |
| 72 | 70 | return $taxrates; |
| 73 | 71 | } |
@@ -19,6 +19,6 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | abstract class Base |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | 23 | { |
| 24 | 24 | } |
| 25 | 25 | \ No newline at end of file |
@@ -19,15 +19,15 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | interface Iface |
| 22 | - extends \Aimeos\Client\Html\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Iface |
|
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * Initializes the class instance. |
|
| 26 | - * |
|
| 27 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
|
| 28 | - * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 29 | - * and a list of relative paths inside the core or the extension as values |
|
| 30 | - * @return void |
|
| 31 | - */ |
|
| 32 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ); |
|
| 24 | + /** |
|
| 25 | + * Initializes the class instance. |
|
| 26 | + * |
|
| 27 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
|
| 28 | + * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 29 | + * and a list of relative paths inside the core or the extension as values |
|
| 30 | + * @return void |
|
| 31 | + */ |
|
| 32 | + public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ); |
|
| 33 | 33 | } |
@@ -18,19 +18,19 @@ |
||
| 18 | 18 | * @subpackage Html |
| 19 | 19 | */ |
| 20 | 20 | abstract class Base |
| 21 | - extends \Aimeos\Client\Html\Base |
|
| 22 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 21 | + extends \Aimeos\Client\Html\Base |
|
| 22 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * Initializes the object instance |
|
| 26 | - * |
|
| 27 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
|
| 28 | - * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 29 | - * and a list of relative paths inside the core or the extension as values |
|
| 30 | - * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 31 | - */ |
|
| 32 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
| 33 | - { |
|
| 34 | - parent::__construct( $context, $templatePaths ); |
|
| 35 | - } |
|
| 24 | + /** |
|
| 25 | + * Initializes the object instance |
|
| 26 | + * |
|
| 27 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
|
| 28 | + * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 29 | + * and a list of relative paths inside the core or the extension as values |
|
| 30 | + * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 31 | + */ |
|
| 32 | + public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
| 33 | + { |
|
| 34 | + parent::__construct( $context, $templatePaths ); |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -19,16 +19,16 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | interface Iface |
| 22 | - extends \Aimeos\Client\Html\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Iface |
|
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * Initializes a new client decorator object. |
|
| 26 | - * |
|
| 27 | - * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 28 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
|
| 29 | - * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 30 | - * and a list of relative paths inside the core or the extension as values |
|
| 31 | - */ |
|
| 32 | - public function __construct( \Aimeos\Client\Html\Iface $client, |
|
| 33 | - \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ); |
|
| 24 | + /** |
|
| 25 | + * Initializes a new client decorator object. |
|
| 26 | + * |
|
| 27 | + * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 28 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
|
| 29 | + * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 30 | + * and a list of relative paths inside the core or the extension as values |
|
| 31 | + */ |
|
| 32 | + public function __construct( \Aimeos\Client\Html\Iface $client, |
|
| 33 | + \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ); |
|
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -19,167 +19,167 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | abstract class Base |
| 22 | - extends \Aimeos\Client\Html\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Decorator\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Decorator\Iface |
|
| 24 | 24 | { |
| 25 | - private $client; |
|
| 26 | - |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Initializes a new client decorator object. |
|
| 30 | - * |
|
| 31 | - * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 32 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
|
| 33 | - * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 34 | - * and a list of relative paths inside the core or the extension as values |
|
| 35 | - */ |
|
| 36 | - public function __construct( \Aimeos\Client\Html\Iface $client, |
|
| 37 | - \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
| 38 | - { |
|
| 39 | - parent::__construct( $context, $templatePaths ); |
|
| 40 | - |
|
| 41 | - $this->client = $client; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Passes unknown methods to wrapped objects. |
|
| 47 | - * |
|
| 48 | - * @param string $name Name of the method |
|
| 49 | - * @param array $param List of method parameter |
|
| 50 | - * @return mixed Returns the value of the called method |
|
| 51 | - * @throws \Aimeos\Client\Html\Exception If method call failed |
|
| 52 | - */ |
|
| 53 | - public function __call( $name, array $param ) |
|
| 54 | - { |
|
| 55 | - if( ( $result = call_user_func_array( array( $this->client, $name ), $param ) ) === false ) { |
|
| 56 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Unable to call method "%1$s"', $name ) ); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - return $result; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Returns the sub-client given by its name. |
|
| 65 | - * |
|
| 66 | - * @param string $type Name of the client type |
|
| 67 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 68 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 69 | - */ |
|
| 70 | - public function getSubClient( $type, $name = null ) |
|
| 71 | - { |
|
| 72 | - return $this->client->getSubClient( $type, $name ); |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Returns the HTML string for insertion into the header. |
|
| 78 | - * |
|
| 79 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 80 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 81 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 82 | - * @return string|null String including HTML tags for the header on error |
|
| 83 | - */ |
|
| 84 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 85 | - { |
|
| 86 | - return $this->client->getHeader( $uid, $tags, $expire ); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * Returns the HTML code for insertion into the body. |
|
| 92 | - * |
|
| 93 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 94 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 95 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 96 | - * @return string HTML code |
|
| 97 | - */ |
|
| 98 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 99 | - { |
|
| 100 | - return $this->client->getBody( $uid, $tags, $expire ); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * Returns the view object that will generate the HTML output. |
|
| 106 | - * |
|
| 107 | - * @return \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 108 | - */ |
|
| 109 | - public function getView() |
|
| 110 | - { |
|
| 111 | - return $this->client->getView(); |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * Sets the view object that will generate the HTML output. |
|
| 117 | - * |
|
| 118 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 119 | - * @return \Aimeos\Client\Html\Iface Reference to this object for fluent calls |
|
| 120 | - */ |
|
| 121 | - public function setView( \Aimeos\MW\View\Iface $view ) |
|
| 122 | - { |
|
| 123 | - $this->client->setView( $view ); |
|
| 124 | - return $this; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 130 | - * |
|
| 131 | - * @param string $content Cached content |
|
| 132 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 133 | - * @return string Modified body content |
|
| 134 | - */ |
|
| 135 | - public function modifyBody( $content, $uid ) |
|
| 136 | - { |
|
| 137 | - return $this->client->modifyBody( $content, $uid ); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * Modifies the cached header content to replace content based on sessions or cookies. |
|
| 143 | - * |
|
| 144 | - * @param string $content Cached content |
|
| 145 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 146 | - * @return string Modified header content |
|
| 147 | - */ |
|
| 148 | - public function modifyHeader( $content, $uid ) |
|
| 149 | - { |
|
| 150 | - return $this->client->modifyHeader( $content, $uid ); |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Processes the input, e.g. store given values. |
|
| 156 | - * A view must be available and this method doesn't generate any output |
|
| 157 | - * besides setting view variables. |
|
| 158 | - */ |
|
| 159 | - public function process() |
|
| 160 | - { |
|
| 161 | - $this->client->process(); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * Returns the inner client object |
|
| 167 | - * |
|
| 168 | - * @return \Aimeos\Client\Html\Iface HTML client |
|
| 169 | - */ |
|
| 170 | - protected function getClient() |
|
| 171 | - { |
|
| 172 | - return $this->client; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * Returns the list of sub-client names configured for the client. |
|
| 178 | - * |
|
| 179 | - * @return array List of HTML client names |
|
| 180 | - */ |
|
| 181 | - protected function getSubClientNames() |
|
| 182 | - { |
|
| 183 | - return array(); |
|
| 184 | - } |
|
| 25 | + private $client; |
|
| 26 | + |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Initializes a new client decorator object. |
|
| 30 | + * |
|
| 31 | + * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 32 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
|
| 33 | + * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 34 | + * and a list of relative paths inside the core or the extension as values |
|
| 35 | + */ |
|
| 36 | + public function __construct( \Aimeos\Client\Html\Iface $client, |
|
| 37 | + \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
| 38 | + { |
|
| 39 | + parent::__construct( $context, $templatePaths ); |
|
| 40 | + |
|
| 41 | + $this->client = $client; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Passes unknown methods to wrapped objects. |
|
| 47 | + * |
|
| 48 | + * @param string $name Name of the method |
|
| 49 | + * @param array $param List of method parameter |
|
| 50 | + * @return mixed Returns the value of the called method |
|
| 51 | + * @throws \Aimeos\Client\Html\Exception If method call failed |
|
| 52 | + */ |
|
| 53 | + public function __call( $name, array $param ) |
|
| 54 | + { |
|
| 55 | + if( ( $result = call_user_func_array( array( $this->client, $name ), $param ) ) === false ) { |
|
| 56 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Unable to call method "%1$s"', $name ) ); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + return $result; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Returns the sub-client given by its name. |
|
| 65 | + * |
|
| 66 | + * @param string $type Name of the client type |
|
| 67 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 68 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 69 | + */ |
|
| 70 | + public function getSubClient( $type, $name = null ) |
|
| 71 | + { |
|
| 72 | + return $this->client->getSubClient( $type, $name ); |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Returns the HTML string for insertion into the header. |
|
| 78 | + * |
|
| 79 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 80 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 81 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 82 | + * @return string|null String including HTML tags for the header on error |
|
| 83 | + */ |
|
| 84 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 85 | + { |
|
| 86 | + return $this->client->getHeader( $uid, $tags, $expire ); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * Returns the HTML code for insertion into the body. |
|
| 92 | + * |
|
| 93 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 94 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 95 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 96 | + * @return string HTML code |
|
| 97 | + */ |
|
| 98 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 99 | + { |
|
| 100 | + return $this->client->getBody( $uid, $tags, $expire ); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * Returns the view object that will generate the HTML output. |
|
| 106 | + * |
|
| 107 | + * @return \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 108 | + */ |
|
| 109 | + public function getView() |
|
| 110 | + { |
|
| 111 | + return $this->client->getView(); |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * Sets the view object that will generate the HTML output. |
|
| 117 | + * |
|
| 118 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 119 | + * @return \Aimeos\Client\Html\Iface Reference to this object for fluent calls |
|
| 120 | + */ |
|
| 121 | + public function setView( \Aimeos\MW\View\Iface $view ) |
|
| 122 | + { |
|
| 123 | + $this->client->setView( $view ); |
|
| 124 | + return $this; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 130 | + * |
|
| 131 | + * @param string $content Cached content |
|
| 132 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 133 | + * @return string Modified body content |
|
| 134 | + */ |
|
| 135 | + public function modifyBody( $content, $uid ) |
|
| 136 | + { |
|
| 137 | + return $this->client->modifyBody( $content, $uid ); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * Modifies the cached header content to replace content based on sessions or cookies. |
|
| 143 | + * |
|
| 144 | + * @param string $content Cached content |
|
| 145 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 146 | + * @return string Modified header content |
|
| 147 | + */ |
|
| 148 | + public function modifyHeader( $content, $uid ) |
|
| 149 | + { |
|
| 150 | + return $this->client->modifyHeader( $content, $uid ); |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Processes the input, e.g. store given values. |
|
| 156 | + * A view must be available and this method doesn't generate any output |
|
| 157 | + * besides setting view variables. |
|
| 158 | + */ |
|
| 159 | + public function process() |
|
| 160 | + { |
|
| 161 | + $this->client->process(); |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * Returns the inner client object |
|
| 167 | + * |
|
| 168 | + * @return \Aimeos\Client\Html\Iface HTML client |
|
| 169 | + */ |
|
| 170 | + protected function getClient() |
|
| 171 | + { |
|
| 172 | + return $this->client; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * Returns the list of sub-client names configured for the client. |
|
| 178 | + * |
|
| 179 | + * @return array List of HTML client names |
|
| 180 | + */ |
|
| 181 | + protected function getSubClientNames() |
|
| 182 | + { |
|
| 183 | + return array(); |
|
| 184 | + } |
|
| 185 | 185 | } |
| 186 | 186 | \ No newline at end of file |
@@ -20,13 +20,13 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | interface Iface |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * Creates a client object. |
|
| 25 | - * |
|
| 26 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context instance with necessary objects |
|
| 27 | - * @param array List of file system paths where the templates are stored |
|
| 28 | - * @param string $name Client name (from configuration or "Standard" if null) |
|
| 29 | - * @return \Aimeos\Client\Html\Iface New client object |
|
| 30 | - */ |
|
| 31 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ); |
|
| 23 | + /** |
|
| 24 | + * Creates a client object. |
|
| 25 | + * |
|
| 26 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context instance with necessary objects |
|
| 27 | + * @param array List of file system paths where the templates are stored |
|
| 28 | + * @param string $name Client name (from configuration or "Standard" if null) |
|
| 29 | + * @return \Aimeos\Client\Html\Iface New client object |
|
| 30 | + */ |
|
| 31 | + public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ); |
|
| 32 | 32 | } |
@@ -20,155 +20,155 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class Base |
| 22 | 22 | { |
| 23 | - private static $objects = array(); |
|
| 24 | - |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * Injects a client object. |
|
| 28 | - * The object is returned via createClient() if an instance of the class |
|
| 29 | - * with the name name is requested. |
|
| 30 | - * |
|
| 31 | - * @param string $classname Full name of the class for which the object should be returned |
|
| 32 | - * @param \Aimeos\Client\Html\Iface|null $client ExtJS client object |
|
| 33 | - */ |
|
| 34 | - public static function injectClient( $classname, \Aimeos\Client\Html\Iface $client = null ) |
|
| 35 | - { |
|
| 36 | - self::$objects[$classname] = $client; |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * Adds the decorators to the client object. |
|
| 42 | - * |
|
| 43 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context instance with necessary objects |
|
| 44 | - * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 45 | - * @param array $templatePaths List of file system paths where the templates are stored |
|
| 46 | - * @param array $decorators List of decorator name that should be wrapped around the client |
|
| 47 | - * @param string $classprefix Decorator class prefix, e.g. "\Aimeos\Client\Html\Catalog\Decorator\" |
|
| 48 | - * @return \Aimeos\Client\Html\Iface Client object |
|
| 49 | - */ |
|
| 50 | - protected static function addDecorators( \Aimeos\MShop\Context\Item\Iface $context, |
|
| 51 | - \Aimeos\Client\Html\Iface $client, array $templatePaths, array $decorators, $classprefix ) |
|
| 52 | - { |
|
| 53 | - $iface = '\\Aimeos\\Client\\Html\\Common\\Decorator\\Iface'; |
|
| 54 | - |
|
| 55 | - foreach( $decorators as $name ) |
|
| 56 | - { |
|
| 57 | - if( ctype_alnum( $name ) === false ) |
|
| 58 | - { |
|
| 59 | - $classname = is_string( $name ) ? $classprefix . $name : '<not a string>'; |
|
| 60 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) ); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - $classname = $classprefix . $name; |
|
| 64 | - |
|
| 65 | - if( class_exists( $classname ) === false ) { |
|
| 66 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - $client = new $classname( $client, $context, $templatePaths ); |
|
| 70 | - |
|
| 71 | - if( !( $client instanceof $iface ) ) { |
|
| 72 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $iface ) ); |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - return $client; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Adds the decorators to the client object. |
|
| 82 | - * |
|
| 83 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context instance with necessary objects |
|
| 84 | - * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 85 | - * @param array $templatePaths List of file system paths where the templates are stored |
|
| 86 | - * @param string $path Path of the client in lower case, e.g. "catalog/detail" |
|
| 87 | - * @return \Aimeos\Client\Html\Iface Client object |
|
| 88 | - */ |
|
| 89 | - protected static function addClientDecorators( \Aimeos\MShop\Context\Item\Iface $context, |
|
| 90 | - \Aimeos\Client\Html\Iface $client, array $templatePaths, $path ) |
|
| 91 | - { |
|
| 92 | - if( !is_string( $path ) || $path === '' ) { |
|
| 93 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid domain "%1$s"', $path ) ); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); |
|
| 97 | - $config = $context->getConfig(); |
|
| 98 | - |
|
| 99 | - /** client/html/common/decorators/default |
|
| 100 | - * Configures the list of decorators applied to all html clients |
|
| 101 | - * |
|
| 102 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 103 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 104 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 105 | - * modify what is returned to the caller. |
|
| 106 | - * |
|
| 107 | - * This option allows you to configure a list of decorator names that should |
|
| 108 | - * be wrapped around the original instance of all created clients: |
|
| 109 | - * |
|
| 110 | - * client/html/common/decorators/default = array( 'decorator1', 'decorator2' ) |
|
| 111 | - * |
|
| 112 | - * This would wrap the decorators named "decorator1" and "decorator2" around |
|
| 113 | - * all client instances in that order. The decorator classes would be |
|
| 114 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" and |
|
| 115 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator2". |
|
| 116 | - * |
|
| 117 | - * @param array List of decorator names |
|
| 118 | - * @since 2014.03 |
|
| 119 | - * @category Developer |
|
| 120 | - */ |
|
| 121 | - $decorators = $config->get( 'client/html/common/decorators/default', array() ); |
|
| 122 | - $excludes = $config->get( 'client/html/' . $path . '/decorators/excludes', array() ); |
|
| 123 | - |
|
| 124 | - foreach( $decorators as $key => $name ) |
|
| 125 | - { |
|
| 126 | - if( in_array( $name, $excludes ) ) { |
|
| 127 | - unset( $decorators[$key] ); |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - $classprefix = '\\Aimeos\\Client\\Html\\Common\\Decorator\\'; |
|
| 132 | - $client = self::addDecorators( $context, $client, $templatePaths, $decorators, $classprefix ); |
|
| 133 | - |
|
| 134 | - $classprefix = '\\Aimeos\\Client\\Html\\Common\\Decorator\\'; |
|
| 135 | - $decorators = $config->get( 'client/html/' . $path . '/decorators/global', array() ); |
|
| 136 | - $client = self::addDecorators( $context, $client, $templatePaths, $decorators, $classprefix ); |
|
| 137 | - |
|
| 138 | - $classprefix = '\\Aimeos\\Client\\Html\\' . $localClass . '\\Decorator\\'; |
|
| 139 | - $decorators = $config->get( 'client/html/' . $path . '/decorators/local', array() ); |
|
| 140 | - $client = self::addDecorators( $context, $client, $templatePaths, $decorators, $classprefix ); |
|
| 141 | - |
|
| 142 | - return $client; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * Creates a client object. |
|
| 148 | - * |
|
| 149 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context instance with necessary objects |
|
| 150 | - * @param string $classname Name of the client class |
|
| 151 | - * @param string $interface Name of the client interface |
|
| 152 | - * @param array $templatePaths List of file system paths where the templates are stored |
|
| 153 | - * @return \Aimeos\Client\Html\\Iface Client object |
|
| 154 | - * @throws \Aimeos\Client\Html\Exception If client couldn't be found or doesn't implement the interface |
|
| 155 | - */ |
|
| 156 | - protected static function createClientBase( \Aimeos\MShop\Context\Item\Iface $context, $classname, $interface, $templatePaths ) |
|
| 157 | - { |
|
| 158 | - if( isset( self::$objects[$classname] ) ) { |
|
| 159 | - return self::$objects[$classname]; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - if( class_exists( $classname ) === false ) { |
|
| 163 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - $client = new $classname( $context, $templatePaths ); |
|
| 167 | - |
|
| 168 | - if( !( $client instanceof $interface ) ) { |
|
| 169 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $interface ) ); |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - return $client; |
|
| 173 | - } |
|
| 23 | + private static $objects = array(); |
|
| 24 | + |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * Injects a client object. |
|
| 28 | + * The object is returned via createClient() if an instance of the class |
|
| 29 | + * with the name name is requested. |
|
| 30 | + * |
|
| 31 | + * @param string $classname Full name of the class for which the object should be returned |
|
| 32 | + * @param \Aimeos\Client\Html\Iface|null $client ExtJS client object |
|
| 33 | + */ |
|
| 34 | + public static function injectClient( $classname, \Aimeos\Client\Html\Iface $client = null ) |
|
| 35 | + { |
|
| 36 | + self::$objects[$classname] = $client; |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * Adds the decorators to the client object. |
|
| 42 | + * |
|
| 43 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context instance with necessary objects |
|
| 44 | + * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 45 | + * @param array $templatePaths List of file system paths where the templates are stored |
|
| 46 | + * @param array $decorators List of decorator name that should be wrapped around the client |
|
| 47 | + * @param string $classprefix Decorator class prefix, e.g. "\Aimeos\Client\Html\Catalog\Decorator\" |
|
| 48 | + * @return \Aimeos\Client\Html\Iface Client object |
|
| 49 | + */ |
|
| 50 | + protected static function addDecorators( \Aimeos\MShop\Context\Item\Iface $context, |
|
| 51 | + \Aimeos\Client\Html\Iface $client, array $templatePaths, array $decorators, $classprefix ) |
|
| 52 | + { |
|
| 53 | + $iface = '\\Aimeos\\Client\\Html\\Common\\Decorator\\Iface'; |
|
| 54 | + |
|
| 55 | + foreach( $decorators as $name ) |
|
| 56 | + { |
|
| 57 | + if( ctype_alnum( $name ) === false ) |
|
| 58 | + { |
|
| 59 | + $classname = is_string( $name ) ? $classprefix . $name : '<not a string>'; |
|
| 60 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) ); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + $classname = $classprefix . $name; |
|
| 64 | + |
|
| 65 | + if( class_exists( $classname ) === false ) { |
|
| 66 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + $client = new $classname( $client, $context, $templatePaths ); |
|
| 70 | + |
|
| 71 | + if( !( $client instanceof $iface ) ) { |
|
| 72 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $iface ) ); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + return $client; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Adds the decorators to the client object. |
|
| 82 | + * |
|
| 83 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context instance with necessary objects |
|
| 84 | + * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 85 | + * @param array $templatePaths List of file system paths where the templates are stored |
|
| 86 | + * @param string $path Path of the client in lower case, e.g. "catalog/detail" |
|
| 87 | + * @return \Aimeos\Client\Html\Iface Client object |
|
| 88 | + */ |
|
| 89 | + protected static function addClientDecorators( \Aimeos\MShop\Context\Item\Iface $context, |
|
| 90 | + \Aimeos\Client\Html\Iface $client, array $templatePaths, $path ) |
|
| 91 | + { |
|
| 92 | + if( !is_string( $path ) || $path === '' ) { |
|
| 93 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid domain "%1$s"', $path ) ); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); |
|
| 97 | + $config = $context->getConfig(); |
|
| 98 | + |
|
| 99 | + /** client/html/common/decorators/default |
|
| 100 | + * Configures the list of decorators applied to all html clients |
|
| 101 | + * |
|
| 102 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 103 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 104 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 105 | + * modify what is returned to the caller. |
|
| 106 | + * |
|
| 107 | + * This option allows you to configure a list of decorator names that should |
|
| 108 | + * be wrapped around the original instance of all created clients: |
|
| 109 | + * |
|
| 110 | + * client/html/common/decorators/default = array( 'decorator1', 'decorator2' ) |
|
| 111 | + * |
|
| 112 | + * This would wrap the decorators named "decorator1" and "decorator2" around |
|
| 113 | + * all client instances in that order. The decorator classes would be |
|
| 114 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" and |
|
| 115 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator2". |
|
| 116 | + * |
|
| 117 | + * @param array List of decorator names |
|
| 118 | + * @since 2014.03 |
|
| 119 | + * @category Developer |
|
| 120 | + */ |
|
| 121 | + $decorators = $config->get( 'client/html/common/decorators/default', array() ); |
|
| 122 | + $excludes = $config->get( 'client/html/' . $path . '/decorators/excludes', array() ); |
|
| 123 | + |
|
| 124 | + foreach( $decorators as $key => $name ) |
|
| 125 | + { |
|
| 126 | + if( in_array( $name, $excludes ) ) { |
|
| 127 | + unset( $decorators[$key] ); |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + $classprefix = '\\Aimeos\\Client\\Html\\Common\\Decorator\\'; |
|
| 132 | + $client = self::addDecorators( $context, $client, $templatePaths, $decorators, $classprefix ); |
|
| 133 | + |
|
| 134 | + $classprefix = '\\Aimeos\\Client\\Html\\Common\\Decorator\\'; |
|
| 135 | + $decorators = $config->get( 'client/html/' . $path . '/decorators/global', array() ); |
|
| 136 | + $client = self::addDecorators( $context, $client, $templatePaths, $decorators, $classprefix ); |
|
| 137 | + |
|
| 138 | + $classprefix = '\\Aimeos\\Client\\Html\\' . $localClass . '\\Decorator\\'; |
|
| 139 | + $decorators = $config->get( 'client/html/' . $path . '/decorators/local', array() ); |
|
| 140 | + $client = self::addDecorators( $context, $client, $templatePaths, $decorators, $classprefix ); |
|
| 141 | + |
|
| 142 | + return $client; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * Creates a client object. |
|
| 148 | + * |
|
| 149 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context instance with necessary objects |
|
| 150 | + * @param string $classname Name of the client class |
|
| 151 | + * @param string $interface Name of the client interface |
|
| 152 | + * @param array $templatePaths List of file system paths where the templates are stored |
|
| 153 | + * @return \Aimeos\Client\Html\\Iface Client object |
|
| 154 | + * @throws \Aimeos\Client\Html\Exception If client couldn't be found or doesn't implement the interface |
|
| 155 | + */ |
|
| 156 | + protected static function createClientBase( \Aimeos\MShop\Context\Item\Iface $context, $classname, $interface, $templatePaths ) |
|
| 157 | + { |
|
| 158 | + if( isset( self::$objects[$classname] ) ) { |
|
| 159 | + return self::$objects[$classname]; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + if( class_exists( $classname ) === false ) { |
|
| 163 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + $client = new $classname( $context, $templatePaths ); |
|
| 167 | + |
|
| 168 | + if( !( $client instanceof $interface ) ) { |
|
| 169 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $interface ) ); |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + return $client; |
|
| 173 | + } |
|
| 174 | 174 | } |
@@ -20,74 +20,74 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | interface Iface |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * Returns the sub-client given by its name. |
|
| 25 | - * |
|
| 26 | - * @param string $type Name of the client type |
|
| 27 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 28 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 29 | - */ |
|
| 30 | - public function getSubClient( $type, $name = null ); |
|
| 23 | + /** |
|
| 24 | + * Returns the sub-client given by its name. |
|
| 25 | + * |
|
| 26 | + * @param string $type Name of the client type |
|
| 27 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 28 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 29 | + */ |
|
| 30 | + public function getSubClient( $type, $name = null ); |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Returns the HTML string for insertion into the header. |
|
| 34 | - * |
|
| 35 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 36 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 37 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 38 | - * @return string|null String including HTML tags for the header on error |
|
| 39 | - */ |
|
| 40 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ); |
|
| 32 | + /** |
|
| 33 | + * Returns the HTML string for insertion into the header. |
|
| 34 | + * |
|
| 35 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 36 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 37 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 38 | + * @return string|null String including HTML tags for the header on error |
|
| 39 | + */ |
|
| 40 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ); |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Returns the HTML code for insertion into the body. |
|
| 44 | - * |
|
| 45 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 46 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 47 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 48 | - * @return string HTML code |
|
| 49 | - */ |
|
| 50 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ); |
|
| 42 | + /** |
|
| 43 | + * Returns the HTML code for insertion into the body. |
|
| 44 | + * |
|
| 45 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 46 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 47 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 48 | + * @return string HTML code |
|
| 49 | + */ |
|
| 50 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ); |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Returns the view object that will generate the HTML output. |
|
| 54 | - * |
|
| 55 | - * @return \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 56 | - */ |
|
| 57 | - public function getView(); |
|
| 52 | + /** |
|
| 53 | + * Returns the view object that will generate the HTML output. |
|
| 54 | + * |
|
| 55 | + * @return \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 56 | + */ |
|
| 57 | + public function getView(); |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Sets the view object that will generate the HTML output. |
|
| 61 | - * |
|
| 62 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 63 | - * @return \Aimeos\Client\Html\Iface Reference to this object for fluent calls |
|
| 64 | - */ |
|
| 65 | - public function setView( \Aimeos\MW\View\Iface $view ); |
|
| 59 | + /** |
|
| 60 | + * Sets the view object that will generate the HTML output. |
|
| 61 | + * |
|
| 62 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 63 | + * @return \Aimeos\Client\Html\Iface Reference to this object for fluent calls |
|
| 64 | + */ |
|
| 65 | + public function setView( \Aimeos\MW\View\Iface $view ); |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 69 | - * |
|
| 70 | - * @param string $content Cached content |
|
| 71 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 72 | - * @return string Modified body content |
|
| 73 | - */ |
|
| 74 | - public function modifyBody( $content, $uid ); |
|
| 67 | + /** |
|
| 68 | + * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 69 | + * |
|
| 70 | + * @param string $content Cached content |
|
| 71 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 72 | + * @return string Modified body content |
|
| 73 | + */ |
|
| 74 | + public function modifyBody( $content, $uid ); |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Modifies the cached header content to replace content based on sessions or cookies. |
|
| 78 | - * |
|
| 79 | - * @param string $content Cached content |
|
| 80 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 81 | - * @return string Modified header content |
|
| 82 | - */ |
|
| 83 | - public function modifyHeader( $content, $uid ); |
|
| 76 | + /** |
|
| 77 | + * Modifies the cached header content to replace content based on sessions or cookies. |
|
| 78 | + * |
|
| 79 | + * @param string $content Cached content |
|
| 80 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 81 | + * @return string Modified header content |
|
| 82 | + */ |
|
| 83 | + public function modifyHeader( $content, $uid ); |
|
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * Processes the input, e.g. store given values. |
|
| 87 | - * A view must be available and this method doesn't generate any output |
|
| 88 | - * besides setting view variables. |
|
| 89 | - * |
|
| 90 | - * @return boolean False if processing is stopped, otherwise all processing was completed successfully |
|
| 91 | - */ |
|
| 92 | - public function process(); |
|
| 85 | + /** |
|
| 86 | + * Processes the input, e.g. store given values. |
|
| 87 | + * A view must be available and this method doesn't generate any output |
|
| 88 | + * besides setting view variables. |
|
| 89 | + * |
|
| 90 | + * @return boolean False if processing is stopped, otherwise all processing was completed successfully |
|
| 91 | + */ |
|
| 92 | + public function process(); |
|
| 93 | 93 | } |