Permalink
Browse files

Merge branch 'master' of github.com:joomla/joomla-platform into files…

…ystem
  • Loading branch information...
2 parents 27c6348 + 0b3d7a9 commit d14f7dc5a2b8663158ed96a63a06d815ea24a5bf @chdemko committed May 30, 2012
Showing with 1,792 additions and 2,418 deletions.
  1. +1 −1 build/phpcs/Joomla/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php
  2. +2 −2 build/phpcs/Joomla/ruleset.xml
  3. +1 −1 docs/coding-standards/en-US/Book_Info.xml
  4. +1 −1 docs/manual/en-US/Book_Info.xml
  5. +38 −13 docs/manual/en-US/appendices/analysis.xml
  6. +11 −10 docs/manual/en-US/chapters/classes/jcontrollerbase.xml
  7. +15 −14 docs/manual/en-US/chapters/classes/jhttp.xml
  8. +7 −7 docs/manual/en-US/chapters/classes/jmodelbase.xml
  9. +7 −7 docs/manual/en-US/chapters/classes/jmodeldatabase.xml
  10. +7 −7 docs/manual/en-US/chapters/classes/jviewbase.xml
  11. +16 −6 docs/manual/en-US/chapters/classes/jviewhtml.xml
  12. +4 −2 docs/manual/en-US/chapters/packages.xml
  13. +9 −12 docs/manual/en-US/chapters/packages/database.xml
  14. +44 −53 docs/manual/en-US/chapters/packages/github.xml
  15. +13 −14 docs/manual/en-US/chapters/packages/log.xml
  16. +3 −3 docs/manual/en-US/chapters/testing.xml
  17. +5 −0 libraries/import.legacy.php
  18. +1 −0 libraries/joomla/access/rule.php
  19. +1 −0 libraries/joomla/access/rules.php
  20. +18 −10 libraries/joomla/application/router.php
  21. +5 −5 libraries/joomla/application/web.php
  22. +2 −1 libraries/joomla/application/web/client.php
  23. +2 −2 libraries/joomla/base/adapter.php
  24. +0 −13 libraries/joomla/base/object.php
  25. +0 −1 libraries/joomla/cache/controller/callback.php
  26. +0 −3 libraries/joomla/cache/controller/page.php
  27. +0 −1 libraries/joomla/cache/controller/view.php
  28. +0 −1 libraries/joomla/cache/storage/cachelite.php
  29. +0 −257 libraries/joomla/cache/storage/eaccelerator.php
  30. +1 −0 libraries/joomla/client/ldap.php
  31. +4 −5 libraries/joomla/database/database.php
  32. +1 −2 libraries/joomla/database/database/mysql.php
  33. +1 −2 libraries/joomla/database/database/mysqlexporter.php
  34. +1 −2 libraries/joomla/database/database/mysqli.php
  35. +1 −2 libraries/joomla/database/database/mysqliexporter.php
  36. +1 −2 libraries/joomla/database/database/mysqliimporter.php
  37. +1 −2 libraries/joomla/database/database/mysqlimporter.php
  38. +1 −2 libraries/joomla/database/database/mysqliquery.php
  39. +1 −2 libraries/joomla/database/database/mysqlquery.php
  40. +1 −2 libraries/joomla/database/database/sqlazure.php
  41. +1 −2 libraries/joomla/database/database/sqlazurequery.php
  42. +1 −2 libraries/joomla/database/database/sqlsrv.php
  43. +1 −2 libraries/joomla/database/database/sqlsrvquery.php
  44. +22 −10 libraries/joomla/database/driver.php
  45. +23 −8 libraries/joomla/database/driver/mysql.php
  46. +20 −2 libraries/joomla/database/driver/mysqli.php
  47. +19 −6 libraries/joomla/database/driver/oracle.php
  48. +15 −2 libraries/joomla/database/driver/pdo.php
  49. +123 −32 libraries/joomla/database/driver/postgresql.php
  50. +18 −4 libraries/joomla/database/driver/sqlite.php
  51. +23 −5 libraries/joomla/database/driver/sqlsrv.php
  52. +3 −3 libraries/joomla/database/query.php
  53. +16 −22 libraries/joomla/database/query/oracle.php
  54. +13 −19 libraries/joomla/database/query/preparable.php
  55. +16 −22 libraries/joomla/database/query/sqlite.php
  56. +3 −3 libraries/joomla/date/date.php
  57. +1 −1 libraries/joomla/document/opensearch/opensearch.php
  58. +5 −4 libraries/joomla/factory.php
  59. +6 −1 libraries/joomla/filesystem/path.php
  60. +1 −1 libraries/joomla/filesystem/streams/string.php
  61. +16 −3 libraries/joomla/form/field.php
  62. +0 −6 libraries/joomla/form/fields/password.php
  63. +6 −6 libraries/joomla/form/form.php
  64. +2 −2 libraries/joomla/form/helper.php
  65. +1 −1 libraries/joomla/form/rule.php
  66. +1 −1 libraries/joomla/form/rules/color.php
  67. +1 −1 libraries/joomla/form/rules/email.php
  68. +4 −4 libraries/joomla/form/rules/equals.php
  69. +1 −1 libraries/joomla/form/rules/options.php
  70. +2 −2 libraries/joomla/form/rules/rules.php
  71. +1 −1 libraries/joomla/form/rules/tel.php
  72. +1 −1 libraries/joomla/form/rules/url.php
  73. +1 −1 libraries/joomla/form/rules/username.php
  74. +3 −3 libraries/joomla/html/html.php
  75. +2 −2 libraries/joomla/html/html/rules.php
  76. +0 −1 libraries/joomla/html/html/select.php
  77. +7 −8 libraries/joomla/image/image.php
  78. +14 −14 libraries/joomla/input/input.php
  79. +5 −7 libraries/joomla/installer/adapters/component.php
  80. +0 −3 libraries/joomla/installer/adapters/file.php
  81. +0 −3 libraries/joomla/installer/adapters/module.php
  82. +0 −3 libraries/joomla/installer/adapters/package.php
  83. +24 −16 libraries/joomla/installer/adapters/template.php
  84. +1 −3 libraries/joomla/installer/installer.php
  85. +1 −1 libraries/joomla/log/entry.php
  86. +7 −131 libraries/joomla/log/log.php
  87. +15 −1 libraries/joomla/log/logger.php
  88. +15 −30 libraries/joomla/log/loggers/database.php
  89. +23 −14 libraries/joomla/log/loggers/echo.php
  90. +6 −21 libraries/joomla/log/loggers/formattedtext.php
  91. +2 −4 libraries/joomla/log/loggers/messagequeue.php
  92. +11 −13 libraries/joomla/log/loggers/syslog.php
  93. +3 −8 libraries/joomla/log/loggers/w3c.php
  94. +18 −4 libraries/joomla/mail/mail.php
  95. +2 −6 libraries/joomla/plugin/helper.php
  96. +39 −11 libraries/joomla/session/session.php
  97. +3 −4 libraries/joomla/session/storage.php
  98. +0 −37 libraries/joomla/session/storage/apc.php
  99. +0 −33 libraries/joomla/session/storage/database.php
  100. +0 −133 libraries/joomla/session/storage/eaccelerator.php
  101. +0 −25 libraries/joomla/session/storage/memcached.php
  102. +1 −101 libraries/joomla/session/storage/none.php
  103. +0 −35 libraries/joomla/session/storage/wincache.php
  104. +0 −39 libraries/joomla/session/storage/xcache.php
  105. +33 −27 libraries/joomla/string/normalise.php
  106. +4 −1 libraries/joomla/string/string.php
  107. +0 −2 libraries/joomla/table/table.php
  108. +13 −2 libraries/joomla/table/user.php
  109. +1 −1 libraries/joomla/updater/adapters/collection.php
  110. +0 −1 libraries/joomla/user/user.php
  111. +1 −5 libraries/joomla/utilities/arrayhelper.php
  112. +2 −2 libraries/joomla/utilities/xmlelement.php
  113. +18 −2 libraries/joomla/view/html.php
  114. +12 −6 libraries/legacy/application/application.php
  115. +0 −7 libraries/legacy/base/node.php
  116. +0 −4 libraries/legacy/base/tree.php
  117. +2 −2 libraries/legacy/component/helper.php
  118. +2 −2 libraries/legacy/controller/admin.php
  119. +38 −23 libraries/legacy/controller/controller.php
  120. +2 −2 libraries/legacy/controller/form.php
  121. +1 −2 libraries/{joomla → legacy}/database/exception.php
  122. +9 −30 libraries/legacy/error/error.php
  123. +8 −6 libraries/legacy/exception/exception.php
  124. 0 libraries/{joomla/form/fields → legacy/form/field}/contentlanguage.php
  125. +90 −1 libraries/legacy/form/field/media.php
  126. 0 libraries/{joomla/html → legacy}/html/batch.php
  127. 0 libraries/{joomla/html → legacy}/html/category.php
  128. 0 libraries/{joomla/html → legacy}/html/contentlanguage.php
  129. 0 libraries/{joomla/html → legacy}/html/menu.php
  130. +3 −1 libraries/{joomla → legacy}/log/logexception.php
  131. +16 −16 libraries/legacy/menu/menu.php
  132. +13 −0 libraries/legacy/module/helper.php
  133. +0 −2 libraries/legacy/pathway/pathway.php
  134. +9 −6 libraries/legacy/simplecrypt/simplecrypt.php
  135. +3 −3 libraries/platform.php
  136. +19 −12 media/system/js/mooRainbow-uncompressed.js
  137. +24 −24 media/system/js/mooRainbow.js
  138. +60 −0 tests/core/mock/application/base.php
  139. +53 −0 tests/core/mock/application/cli.php
  140. +110 −4 tests/core/mock/application/web.php
  141. +1 −0 tests/core/mock/database/driver.php
  142. +109 −30 tests/suites/database/driver/postgresql/JDatabasePostgresqlTest.php
  143. 0 tests/suites/{unit → }/legacy/base/JNodeTest.php
  144. 0 tests/suites/{unit → }/legacy/base/JTreeTest.php
  145. +3 −1 tests/suites/legacy/controller/JControllerTest.php
  146. +4 −3 tests/suites/{unit/joomla/form/fields → legacy/form/field}/JFormFieldContentLanguageTest.php
  147. +6 −2 tests/suites/{unit/joomla/html → legacy}/html/JHtmlBatchTest.php
  148. +1 −1 tests/suites/{unit/joomla/html → legacy}/html/JHtmlCategoryTest.php
  149. +4 −2 tests/suites/{unit/joomla/html → legacy}/html/JHtmlMenuTest.php
  150. +0 −185 tests/suites/unit/joomla/cache/storage/JCacheStorageEacceleratorTest.php
  151. +0 −1 tests/suites/unit/joomla/database/database/JDatabaseImporterPostgresqlInspector.php
  152. +11 −11 tests/suites/unit/joomla/database/stubs/nosqldriver.php
  153. +82 −80 tests/suites/unit/joomla/filesystem/JPathTest.php
  154. +41 −17 tests/suites/unit/joomla/form/JFormFieldTest.php
  155. +2 −2 tests/suites/unit/joomla/http/JHttpTransportTest.php
  156. +31 −11 tests/suites/unit/joomla/input/JInputTest.php
  157. +2 −91 tests/suites/unit/joomla/log/JLogTest.php
  158. +0 −48 tests/suites/unit/joomla/log/LogExceptionTest.php
  159. +13 −13 tests/suites/unit/joomla/log/loggers/{JLoggerDatabaseTest.php → JLogLoggerDatabaseTest.php}
  160. +10 −10 tests/suites/unit/joomla/log/loggers/{JLoggerEchoTest.php → JLogLoggerEchoTest.php}
  161. +12 −12 ...s/suites/unit/joomla/log/loggers/{JLoggerFormattedTextTest.php → JLogLoggerFormattedTextTest.php}
  162. +4 −4 tests/suites/unit/joomla/log/loggers/{JLoggerMessageQueueTest.php → JLogLoggerMessageQueueTest.php}
  163. +3 −3 tests/suites/unit/joomla/log/loggers/{JLoggerSyslogTest.php → JLogLoggerSyslogTest.php}
  164. +4 −4 tests/suites/unit/joomla/log/loggers/{JLoggerW3CTest.php → JLogLoggerW3CTest.php}
  165. +1 −1 tests/suites/unit/joomla/log/loggers/stubs/database/inspector.php
  166. +1 −1 tests/suites/unit/joomla/log/loggers/stubs/formattedtext/inspector.php
  167. +1 −1 tests/suites/unit/joomla/log/loggers/stubs/w3c/inspector.php
  168. +2 −3 tests/suites/unit/joomla/{base → object}/JObjectTest.php
  169. +0 −27 tests/suites/unit/joomla/session/storage/JSessionStorageApcTest.php
  170. +0 −20 tests/suites/unit/joomla/session/storage/JSessionStorageDatabaseTest.php
  171. +0 −107 tests/suites/unit/joomla/session/storage/JSessionStorageEacceleratorTest.php
  172. +0 −63 tests/suites/unit/joomla/session/storage/JSessionStorageNoneTest.php
  173. +0 −27 tests/suites/unit/joomla/session/storage/JSessionStorageWincacheTest.php
  174. +0 −27 tests/suites/unit/joomla/session/storage/JSessionStorageXcacheTest.php
  175. +37 −2 tests/suites/unit/joomla/string/JStringNormaliseTest.php
  176. +0 −24 tests/suites/unit/joomla/string/JStringTest.php
  177. +0 −19 tests/suites/unit/joomla/string/TestHelpers/JString-helper-dataset.php
  178. +43 −2 tests/suites/unit/joomla/user/JUserTest.php
  179. +22 −2 tests/suites/unit/joomla/view/JViewHtmlTest.php
@@ -143,7 +143,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
}
}
- // It cant be the last thing on the line either.
+ // It can't be the last thing on the line either.
$content = $phpcsFile->findNext(T_WHITESPACE, ($next + 1), null, true);
if ($tokens[$content]['line'] !== $tokens[$next]['line']) {
$error = 'Object operator must be at the start of the line, not the end';
@@ -16,7 +16,7 @@
<exclude-pattern>*/modal.css</exclude-pattern>
<!-- Include all sniffs in an external standard directory -->
-
+
<!-- Include some additional sniffs from the Generic standard -->
<rule ref="PEAR.Classes.ClassDeclaration"/>
@@ -67,7 +67,7 @@
</properties>
</rule>
- <!-- This messgae is not required as spaces are allowed for alignment -->
+ <!-- This message is not required as spaces are allowed for alignment -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma">
<severity>0</severity>
</rule>
@@ -7,7 +7,7 @@
<title>Coding Standards</title>
<subtitle>A Concise Guide</subtitle>
<productname>Joomla Platform</productname>
- <productnumber>11.4</productnumber>
+ <productnumber>12.1</productnumber>
<edition>1</edition>
<pubsnumber>1</pubsnumber>
<abstract>
@@ -7,7 +7,7 @@
<title>Developer Manual</title>
<subtitle>A Reference Guide</subtitle>
<productname>Joomla Platform</productname>
- <productnumber>11.3</productnumber>
+ <productnumber>12.1</productnumber>
<edition>1</edition>
<pubsnumber>1</pubsnumber>
<abstract>
@@ -20,23 +20,23 @@
<section>
<title>Configuring Your Environment: The Database</title>
- <para>Standard unit tests run against a <ulink url="http://www.sqlite.org/quickstart.html">Sqlite</ulink> in memory
- database for ease of setup and performance. Other than <ulink url="http://www.sqlite.org/quickstart.html">installing Sqlite</ulink>
- no manual intervention or set up is required. The database is built at runtime and deleted when finished.
+ <para>Standard unit tests run against a <ulink url="http://www.sqlite.org/quickstart.html">Sqlite</ulink> in memory
+ database for ease of setup and performance. Other than <ulink url="http://www.sqlite.org/quickstart.html">installing Sqlite</ulink>
+ no manual intervention or set up is required. The database is built at runtime and deleted when finished.
</para>
<para>To run the specific database tests:</para>
<itemizedlist>
<listitem>
- <para>Create your database and use the appropriate database-specific DDL located in
+ <para>Create your database and use the appropriate database-specific DDL located in
tests/suites/database/stubs to create the database tables required.</para>
</listitem>
-
+
<listitem>
<para>In the root directory, copy the file named phpunit.xml.dist, leaving it in the same
folder and naming it phpunit.xml.</para>
- </listitem>
+ </listitem>
<listitem>
<para>Uncomment the php block and include the const line(s) related to the database(s) you will be testing.</para>
@@ -49,17 +49,39 @@
</section>
<section>
- <title>Configuring Your Environment: The JHttpTransport Test Stubs</title>
-
- <para>There is a special stub that is required for testing the JHttp transports so that actual web requests can be simulated
- and assertions can be made about the results. To set these up, copy the file jhttp_stub.php to a web server and add the address
- to your config file with the config variable <code>$jhttp_stub</code>.</para>
- </section>
+ <title>Configuring Your Environment: The JHttpTransport Test Stubs</title>
+
+ <para>There is a special stub that is required for testing the JHttp transports so that actual web requests can be simulated
+ and assertions can be made about the results. To set these up, you'll need to do the following:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>In the root directory, copy the file named phpunit.xml.dist, leaving it in the same
+ folder and naming it phpunit.xml.</para>
+ </listitem>
+
+ <listitem>
+ <para>Uncomment the php block and include the "JTEST_HTTP_STUB" const.</para>
+ </listitem>
+
+ <listitem>
+ <para>The default file path for the const assumes that you have checked out the Joomla Platform to the web root
+ of your test environment inside a folder named "joomla-platform". If this is not the case, you can change
+ the path to suit your environment and, if need be, copy the file from its default location to be available within
+ your web environment.</para>
+ </listitem>
+ </itemizedlist>
+ </section>
<section>
<title>Running the Tests</title>
<para>You can run the tests by going to the platform root directory and executing <command>phpunit</command></para>
+
+ <para>Alternatively, if you have Ant installed on your system, you may run the unit tests by going to the platform root
+ directory and executing <command>ant phpunit</command> to execute the tests on classes located under the libraries/joomla
+ directory or executing <command>ant phpunit-legacy</command> to execute the tests on classes located under the
+ libraries/legacy directory.</para>
</section>
</section>
@@ -78,8 +100,11 @@
<section>
<title>Running CodeSniffer</title>
- <para>You can run CodeSniffer by going to the platform root directory and executing <command>phpcs --report=checkstyle
+ <para>You can run the CodeSniffer by going to the platform root directory and executing <command>phpcs --report=checkstyle
--report-file=build/logs/checkstyle.xml --standard=/path/to/platform/build/phpcs/Joomla /path/to/platform</command></para>
+
+ <para>Alternatively, if you have Ant installed on your system, you may run the CodeSniffer by going to the platform root
+ directory and executing <command>ant phpcs</command></para>
</section>
<section>
@@ -21,20 +21,21 @@
<para>The <classname>JControllerBase</classname> class is abstract so cannot be used directly. The derived class must
implement the execute method to satisfy the interface requirements. Note that the execute method no longer takes a "task"
- argument as each controller class. Multi-task controllers are still possible but not recommended. Each controller class should
- do just one sort of 'thing', just as saving, deleting, checking in, checking out and so on. However, controllers, or even
- models and views, have the liberty of invoking other controllers to allow for HMVC architectures.</para>
+ argument as each controller class. Multi-task controllers are still possible by overriding the
+ <methodname>execute</methodname> method in derived classes. Each controller class should do just one sort of 'thing', such as
+ saving, deleting, checking in, checking out and so on. However, controllers, or even models and views, have the liberty of
+ invoking other controllers to allow for HMVC architectures.</para>
<example>
<title>Example controller</title>
- <programlisting> /**
- * My custom controller.
- *
- * @package Examples
- *
- * @since 12.1
- */
+ <programlisting>/**
+ * My custom controller.
+ *
+ * @package Examples
+ *
+ * @since 12.1
+ */
class MyController extends JControllerBase
{
/**
@@ -62,23 +62,23 @@ var_dump($response-&gt;body);</programlisting>
<section>
<title>Making a GET request</title>
- <para>An HTTP GET request can be made using the get method passing a URL and an optional key-value array of header variables.
- In RESTful terms, a GET request is sent to read data from the server.</para>
+ <para>An HTTP GET request can be made using the get method passing a URL, an optional key-value array of header variables and
+ an optional timeout value. In RESTful terms, a GET request is sent to read data from the server.</para>
<example>
<title>Making a GET request</title>
<programlisting>// Invoke the GET request.
-$response = $http-&gt;head('http://api.example.com/cars');</programlisting>
+$response = $http-&gt;get('http://api.example.com/cars');</programlisting>
</example>
</section>
<section>
<title>Making a POST request</title>
- <para>An HTTP POST request can be made using the post method passing a URL, a data variable and an optional key-value array of
- header variables. The data can be either an associative array of POST variables, or a string to be sent with the request. In
- RESTful terms, a POST request is sent to create new data on th server.</para>
+ <para>An HTTP POST request can be made using the post method passing a URL, a data variable, an optional key-value array of
+ header variables and an optional timeout value. The data can be either an associative array of POST variables, or a string to
+ be sent with the request. In RESTful terms, a POST request is sent to create new data on the server.</para>
<example>
<title>Making a POST request</title>
@@ -87,16 +87,16 @@ $response = $http-&gt;head('http://api.example.com/cars');</programlisting>
$data = array('make' =&gt; 'Holden', model =&gt; 'EJ-Special');
// Invoke the GET request.
-$response = $http-&gt;head('http://api.example.com/cars/1');</programlisting>
+$response = $http-&gt;post('http://api.example.com/cars/1', $data);</programlisting>
</example>
</section>
<section>
<title>Making a PUT request</title>
- <para>An HTTP POST request can be made using the post method passing a URL, a data variable and an optional key-value array of
- header variables. The data can be either an associative array of POST variables, or a string to be sent with the request. In
- RESTful terms, a PUT request is typically sent to update existing data on the server.</para>
+ <para>An HTTP POST request can be made using the post method passing a URL, a data variable, an optional key-value array of
+ header variables and an optional timeout value. The data can be either an associative array of POST variables, or a string to
+ be sent with the request. In RESTful terms, a PUT request is typically sent to update existing data on the server.</para>
<example>
<title>Making a PUT request</title>
@@ -105,21 +105,22 @@ $response = $http-&gt;head('http://api.example.com/cars/1');</programlisting>
$data = array('description' =&gt; 'My first car.', 'color' =&gt; 'gray');
// Invoke the GET request.
-$response = $http-&gt;head('http://api.example.com/cars/1', $data);</programlisting>
+$response = $http-&gt;put('http://api.example.com/cars/1', $data);</programlisting>
</example>
</section>
<section>
<title>Making a DELETE request</title>
- <para>An HTTP DELETE request can be made using the delete method passing a URL and an optional key-value array of header
- variables. In RESTful terms, a DELETE request is typically sent to delete existing data on the server.</para>
+ <para>An HTTP DELETE request can be made using the delete method passing a URL, an optional key-value array of header
+ variables and an optional timeout value. In RESTful terms, a DELETE request is typically sent to delete existing data on the
+ server.</para>
<example>
<title>Making a DELETE request</title>
<programlisting>// Invoke the DELETE request.
-$response = $http-&gt;head('http://api.example.com/cars/1');</programlisting>
+$response = $http-&gt;delete('http://api.example.com/cars/1');</programlisting>
</example>
</section>
@@ -25,13 +25,13 @@
<example>
<title>Example model</title>
- <programlisting> /**
- * My custom model.
- *
- * @pacakge Examples
- *
- * @since 12.1
- */
+ <programlisting>/**
+ * My custom model.
+ *
+ * @pacakge Examples
+ *
+ * @since 12.1
+ */
class MyModel extends JModelBase
{
/**
@@ -25,13 +25,13 @@
<example>
<title>Example database model</title>
- <programlisting> /**
- * My custom database model.
- *
- * @package Examples
- *
- * @since 12.1
- */
+ <programlisting>/**
+ * My custom database model.
+ *
+ * @package Examples
+ *
+ * @since 12.1
+ */
class MyDatabaseModel extends JModelDatabase
{
/**
@@ -31,13 +31,13 @@
<example>
<title>Example view</title>
- <programlisting> /**
- * My custom view.
- *
- * @package Examples
- *
- * @since 12.1
- */
+ <programlisting>/**
+ * My custom view.
+ *
+ * @package Examples
+ *
+ * @since 12.1
+ */
class MyView extends JViewBase
{
/**
@@ -47,12 +47,12 @@
<example>
<title>Example HTML view</title>
- <programlisting> /**
- * My custom HTML view.
- *
- * @package Examples
- * @since 12.1
- */
+ <programlisting>/**
+ * My custom HTML view.
+ *
+ * @package Examples
+ * @since 12.1
+ */
class MyHtmlView extends JViewHtml
{
/**
@@ -72,6 +72,16 @@ try
$view = new MyView(new MyDatabaseModel, new MyController, $paths);
$view-&gt;setLayout('count');
echo $view-&gt;render();
+
+ // Alternative approach.
+ $view = new MyView(new MyDatabaseModel);
+
+ // Use some chaining.
+ $view-&gt;setPaths($paths)
+ -&gt;setLayout('count');
+
+ // Take advantage of the magic __toString method.
+ echo $view;
}
catch (RuntimeException $e)
{
@@ -9,13 +9,15 @@
<para>This is information about the core platform packages.</para>
+ <xi:include href="packages/database.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
<xi:include href="packages/github.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="packages/http.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
<xi:include href="packages/input.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="packages/log.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-
- <xi:include href="packages/database.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="packages/mvc.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
@@ -5,29 +5,26 @@
%BOOK_ENTITIES;
]>
<section id="chap-Joomla_Platform_Manual-Database">
- <title>Database</title>
+ <title>The Database Package</title>
<section>
<title>Introduction</title>
- <para>The <emphasis>Database</emphasis> package is designed to manage the operations of data management through the use of a generic database engine.</para>
-
+ <para>The <emphasis>Database</emphasis> package is designed to manage the operations of data management through the use of a
+ generic database engine.</para>
</section>
<section>
<title>Iterating on results</title>
- <para>The <code language="PHP (HTML)">JDatabaseIterator</code> class allows iteration over database results
- <programlisting language="PHP (HTML)"><![CDATA[$dbo = JFactory::getDbo();
-$iterator = $dbo->setQuery($dbo->getQuery(true)->select('*')->from('#__content'))->getIterator();
+ <para>The <code language="PHP (HTML)">JDatabaseIterator</code> class allows iteration over database results <programlisting
+ language="PHP (HTML)">$dbo = JFactory::getDbo();
+$iterator = $dbo-&gt;setQuery($dbo-&gt;getQuery(true)-&gt;select('*')-&gt;from('#__content'))-&gt;getIterator();
foreach ($iterator as $row)
{
// Deal with $row
-}]]></programlisting>
- </para>
- <para>It allows also to count the results.
- <programlisting language="PHP (HTML)"><![CDATA[$count = count($iterator);]]></programlisting>
- </para>
+}</programlisting></para>
+
+ <para>It allows also to count the results. <programlisting language="PHP (HTML)">$count = count($iterator);</programlisting></para>
</section>
</section>
-
Oops, something went wrong.

0 comments on commit d14f7dc

Please sign in to comment.