codeigniter_vender 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (350) hide show
  1. data/.gitignore +2 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README +40 -0
  4. data/Rakefile +18 -0
  5. data/VERSION +1 -0
  6. data/codeigniter_vender.gemspec +389 -0
  7. data/generators/ci_app/USAGE +8 -0
  8. data/generators/ci_app/ci_app_generator.rb +12 -0
  9. data/generators/ci_app/templates/CodeIgniter_1.7.2/index.php +118 -0
  10. data/generators/ci_app/templates/CodeIgniter_1.7.2/license.txt +52 -0
  11. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/autoload.php +116 -0
  12. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/config.php +329 -0
  13. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/constants.php +41 -0
  14. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/database.php +55 -0
  15. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/doctypes.php +15 -0
  16. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/hooks.php +16 -0
  17. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/index.html +10 -0
  18. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/mimes.php +105 -0
  19. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/routes.php +48 -0
  20. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/smileys.php +66 -0
  21. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/user_agents.php +175 -0
  22. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/controllers/index.html +10 -0
  23. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/controllers/welcome.php +17 -0
  24. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_404.php +34 -0
  25. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_db.php +34 -0
  26. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_general.php +34 -0
  27. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_php.php +10 -0
  28. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/index.html +10 -0
  29. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/helpers/index.html +10 -0
  30. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/hooks/index.html +10 -0
  31. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/index.html +10 -0
  32. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/language/english/index.html +10 -0
  33. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/libraries/index.html +10 -0
  34. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/models/index.html +10 -0
  35. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/views/index.html +10 -0
  36. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/views/welcome_message.php +62 -0
  37. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/cache/index.html +10 -0
  38. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Base4.php +69 -0
  39. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Base5.php +56 -0
  40. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/CodeIgniter.php +280 -0
  41. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Common.php +421 -0
  42. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Compat.php +93 -0
  43. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/index.html +10 -0
  44. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB.php +146 -0
  45. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_active_rec.php +1820 -0
  46. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_cache.php +195 -0
  47. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_driver.php +1366 -0
  48. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_forge.php +375 -0
  49. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_result.php +342 -0
  50. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_utility.php +389 -0
  51. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/index.html +10 -0
  52. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/index.html +10 -0
  53. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_driver.php +667 -0
  54. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_forge.php +248 -0
  55. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_result.php +169 -0
  56. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_utility.php +123 -0
  57. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/index.html +10 -0
  58. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_driver.php +670 -0
  59. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_forge.php +254 -0
  60. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_result.php +169 -0
  61. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_utility.php +245 -0
  62. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/index.html +10 -0
  63. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_driver.php +671 -0
  64. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_forge.php +254 -0
  65. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_result.php +169 -0
  66. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_utility.php +123 -0
  67. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/index.html +10 -0
  68. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_driver.php +780 -0
  69. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_forge.php +248 -0
  70. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_result.php +249 -0
  71. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_utility.php +122 -0
  72. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/index.html +10 -0
  73. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_driver.php +639 -0
  74. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_forge.php +266 -0
  75. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_result.php +228 -0
  76. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_utility.php +148 -0
  77. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/index.html +10 -0
  78. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_driver.php +684 -0
  79. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_forge.php +248 -0
  80. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_result.php +169 -0
  81. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_utility.php +124 -0
  82. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/index.html +10 -0
  83. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_driver.php +657 -0
  84. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_forge.php +265 -0
  85. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_result.php +179 -0
  86. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_utility.php +141 -0
  87. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/index.html +10 -0
  88. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/fonts/index.html +10 -0
  89. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/fonts/texb.ttf +0 -0
  90. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/array_helper.php +78 -0
  91. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/compatibility_helper.php +498 -0
  92. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/cookie_helper.php +144 -0
  93. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/date_helper.php +611 -0
  94. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/directory_helper.php +84 -0
  95. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/download_helper.php +100 -0
  96. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/email_helper.php +62 -0
  97. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/file_helper.php +464 -0
  98. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/form_helper.php +1025 -0
  99. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/html_helper.php +416 -0
  100. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/index.html +10 -0
  101. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/inflector_helper.php +171 -0
  102. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/language_helper.php +58 -0
  103. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/number_helper.php +75 -0
  104. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/path_helper.php +72 -0
  105. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/security_helper.php +126 -0
  106. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/smiley_helper.php +273 -0
  107. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/string_helper.php +273 -0
  108. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/text_helper.php +462 -0
  109. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/typography_helper.php +71 -0
  110. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/url_helper.php +593 -0
  111. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/xml_helper.php +62 -0
  112. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/index.html +10 -0
  113. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/calendar_lang.php +51 -0
  114. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/date_lang.php +60 -0
  115. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/db_lang.php +28 -0
  116. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/email_lang.php +24 -0
  117. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/form_validation_lang.php +24 -0
  118. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/ftp_lang.php +17 -0
  119. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/imglib_lang.php +24 -0
  120. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/index.html +10 -0
  121. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/number_lang.php +10 -0
  122. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/profiler_lang.php +19 -0
  123. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/scaffolding_lang.php +17 -0
  124. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/unit_test_lang.php +24 -0
  125. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/upload_lang.php +22 -0
  126. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/validation_lang.php +24 -0
  127. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/index.html +10 -0
  128. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Benchmark.php +113 -0
  129. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Calendar.php +477 -0
  130. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Cart.php +550 -0
  131. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Config.php +244 -0
  132. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Controller.php +127 -0
  133. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Email.php +2041 -0
  134. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Encrypt.php +484 -0
  135. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Exceptions.php +174 -0
  136. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Form_validation.php +1278 -0
  137. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Ftp.php +618 -0
  138. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Hooks.php +226 -0
  139. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Image_lib.php +1544 -0
  140. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Input.php +1067 -0
  141. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Language.php +123 -0
  142. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Loader.php +1085 -0
  143. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Log.php +117 -0
  144. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Model.php +83 -0
  145. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Output.php +409 -0
  146. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Pagination.php +244 -0
  147. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Parser.php +173 -0
  148. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Profiler.php +392 -0
  149. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Router.php +389 -0
  150. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Session.php +758 -0
  151. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Sha1.php +251 -0
  152. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Table.php +440 -0
  153. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Trackback.php +547 -0
  154. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Typography.php +406 -0
  155. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/URI.php +586 -0
  156. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Unit_test.php +347 -0
  157. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Upload.php +970 -0
  158. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/User_agent.php +502 -0
  159. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Validation.php +875 -0
  160. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Xmlrpc.php +1421 -0
  161. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Xmlrpcs.php +536 -0
  162. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Zip.php +359 -0
  163. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/index.html +10 -0
  164. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/logs/index.html +10 -0
  165. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/plugins/captcha_pi.php +356 -0
  166. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/plugins/index.html +10 -0
  167. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/plugins/js_calendar_pi.php +629 -0
  168. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/Scaffolding.php +291 -0
  169. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/images/background.jpg +0 -0
  170. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/images/index.html +10 -0
  171. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/images/logo.jpg +0 -0
  172. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/index.html +10 -0
  173. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/add.php +32 -0
  174. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/delete.php +9 -0
  175. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/edit.php +33 -0
  176. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/footer.php +10 -0
  177. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/header.php +29 -0
  178. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/index.html +10 -0
  179. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/no_data.php +8 -0
  180. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/stylesheet.css +143 -0
  181. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/view.php +27 -0
  182. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/changelog.html +1080 -0
  183. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/active_record.html +757 -0
  184. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/caching.html +220 -0
  185. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/call_function.html +118 -0
  186. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/configuration.html +157 -0
  187. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/connecting.html +186 -0
  188. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/examples.html +217 -0
  189. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/fields.html +163 -0
  190. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/forge.html +234 -0
  191. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/helpers.html +151 -0
  192. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/index.html +99 -0
  193. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/queries.html +153 -0
  194. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/results.html +238 -0
  195. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/table_data.html +113 -0
  196. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/transactions.html +200 -0
  197. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/utilities.html +295 -0
  198. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/doc_style/index.html +86 -0
  199. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/doc_style/template.html +128 -0
  200. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/alternative_php.html +147 -0
  201. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/ancillary_classes.html +117 -0
  202. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/autoloader.html +101 -0
  203. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/caching.html +115 -0
  204. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/common_functions.html +119 -0
  205. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/controllers.html +385 -0
  206. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/core_classes.html +185 -0
  207. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/creating_libraries.html +298 -0
  208. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/credits.html +86 -0
  209. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/errors.html +138 -0
  210. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/helpers.html +185 -0
  211. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/hooks.html +167 -0
  212. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/libraries.html +94 -0
  213. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/managing_apps.html +133 -0
  214. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/models.html +251 -0
  215. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/plugins.html +127 -0
  216. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/profiling.html +104 -0
  217. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/quick_reference.html +77 -0
  218. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/requirements.html +82 -0
  219. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/reserved_names.html +156 -0
  220. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/routing.html +176 -0
  221. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/scaffolding.html +147 -0
  222. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/security.html +153 -0
  223. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/styleguide.html +687 -0
  224. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/urls.html +151 -0
  225. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/views.html +274 -0
  226. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/array_helper.html +119 -0
  227. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/compatibility_helper.html +118 -0
  228. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/cookie_helper.html +147 -0
  229. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/date_helper.html +408 -0
  230. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/directory_helper.html +143 -0
  231. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/download_helper.html +112 -0
  232. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/email_helper.html +102 -0
  233. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/file_helper.html +178 -0
  234. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/form_helper.html +484 -0
  235. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/html_helper.html +385 -0
  236. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/inflector_helper.html +151 -0
  237. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/language_helper.html +98 -0
  238. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/number_helper.html +107 -0
  239. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/path_helper.html +106 -0
  240. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/security_helper.html +125 -0
  241. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/smiley_helper.html +215 -0
  242. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/string_helper.html +176 -0
  243. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/text_helper.html +192 -0
  244. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/typography_helper.html +112 -0
  245. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/url_helper.html +289 -0
  246. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/xml_helper.html +105 -0
  247. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/appflowchart.gif +0 -0
  248. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/arrow.gif +0 -0
  249. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/ci_logo.jpg +0 -0
  250. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/ci_logo_flame.jpg +0 -0
  251. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/ci_quick_ref.png +0 -0
  252. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_helper_reference.pdf +0 -0
  253. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_helper_reference.png +0 -0
  254. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_library_reference.pdf +0 -0
  255. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_library_reference.png +0 -0
  256. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/file.gif +0 -0
  257. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/folder.gif +0 -0
  258. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/nav_bg_darker.jpg +0 -0
  259. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/nav_separator_darker.jpg +0 -0
  260. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/nav_toggle_darker.jpg +0 -0
  261. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/smile.gif +0 -0
  262. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/transparent.gif +0 -0
  263. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/index.html +99 -0
  264. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/downloads.html +105 -0
  265. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/index.html +97 -0
  266. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/troubleshooting.html +90 -0
  267. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_120.html +92 -0
  268. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_130.html +203 -0
  269. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_131.html +102 -0
  270. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_132.html +100 -0
  271. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_133.html +112 -0
  272. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_140.html +145 -0
  273. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_141.html +148 -0
  274. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_150.html +178 -0
  275. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_152.html +111 -0
  276. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_153.html +100 -0
  277. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_154.html +116 -0
  278. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_160.html +125 -0
  279. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_161.html +98 -0
  280. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_162.html +106 -0
  281. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_163.html +99 -0
  282. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_170.html +121 -0
  283. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_171.html +98 -0
  284. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_172.html +105 -0
  285. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_b11.html +144 -0
  286. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrading.html +101 -0
  287. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/benchmark.html +198 -0
  288. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/calendar.html +249 -0
  289. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/cart.html +346 -0
  290. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/config.html +181 -0
  291. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/email.html +307 -0
  292. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/encryption.html +182 -0
  293. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/file_uploading.html +451 -0
  294. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/form_validation.html +1221 -0
  295. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/ftp.html +303 -0
  296. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/image_lib.html +666 -0
  297. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/input.html +231 -0
  298. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/language.html +137 -0
  299. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/loader.html +214 -0
  300. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/output.html +145 -0
  301. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/pagination.html +218 -0
  302. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/parser.html +208 -0
  303. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/sessions.html +311 -0
  304. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/table.html +292 -0
  305. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/trackback.html +246 -0
  306. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/typography.html +160 -0
  307. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/unit_testing.html +205 -0
  308. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/uri.html +252 -0
  309. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/user_agent.html +201 -0
  310. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/validation.html +740 -0
  311. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/xmlrpc.html +517 -0
  312. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/zip.html +278 -0
  313. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/license.html +107 -0
  314. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/hacks.txt +9 -0
  315. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/moo.fx.js +119 -0
  316. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/moo.fx.pack.js +241 -0
  317. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/nav.js +139 -0
  318. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/prototype.lite.js +127 -0
  319. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/user_guide_menu.js +4 -0
  320. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/appflow.html +95 -0
  321. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/at_a_glance.html +172 -0
  322. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/cheatsheets.html +83 -0
  323. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/features.html +120 -0
  324. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/getting_started.html +92 -0
  325. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/goals.html +98 -0
  326. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/index.html +84 -0
  327. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/mvc.html +100 -0
  328. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/toc.html +209 -0
  329. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/userguide.css +406 -0
  330. data/generators/ci_app/templates/README +1 -0
  331. data/generators/ci_controller/USAGE +2 -0
  332. data/generators/ci_controller/ci_controller_generator.rb +11 -0
  333. data/generators/ci_controller/templates/ci_controller.php.erb +15 -0
  334. data/generators/ci_controller/templates/ci_view.php.erb +8 -0
  335. data/generators/ci_layout/USAGE +2 -0
  336. data/generators/ci_layout/ci_layout_generator.rb +24 -0
  337. data/generators/ci_layout/templates/application_layout.php.erb +19 -0
  338. data/generators/ci_model/USAGE +2 -0
  339. data/generators/ci_model/ci_model_generator.rb +42 -0
  340. data/generators/ci_model/templates/ci_model.php.erb +15 -0
  341. data/generators/ci_model/templates/model.rb +5 -0
  342. data/generators/ci_model/templates/model_migration.rb.erb +16 -0
  343. data/init.rb +1 -0
  344. data/install.rb +1 -0
  345. data/lib/codeigniter_vender.rb +1 -0
  346. data/lib/tasks/app.rake +8 -0
  347. data/test/codeigniter_vender_test.rb +8 -0
  348. data/test/test_helper.rb +3 -0
  349. data/uninstall.rb +1 -0
  350. metadata +411 -0
@@ -0,0 +1,740 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>Form Validation : CodeIgniter User Guide</title>
7
+
8
+ <style type='text/css' media='all'>@import url('../userguide.css');</style>
9
+ <link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
10
+
11
+ <script type="text/javascript" src="../nav/nav.js"></script>
12
+ <script type="text/javascript" src="../nav/prototype.lite.js"></script>
13
+ <script type="text/javascript" src="../nav/moo.fx.js"></script>
14
+ <script type="text/javascript" src="../nav/user_guide_menu.js"></script>
15
+
16
+ <meta http-equiv='expires' content='-1' />
17
+ <meta http-equiv= 'pragma' content='no-cache' />
18
+ <meta name='robots' content='all' />
19
+ <meta name='author' content='ExpressionEngine Dev Team' />
20
+ <meta name='description' content='CodeIgniter User Guide' />
21
+ </head>
22
+ <body>
23
+
24
+ <!-- START NAVIGATION -->
25
+ <div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
26
+ <div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
27
+ <div id="masthead">
28
+ <table cellpadding="0" cellspacing="0" border="0" style="width:100%">
29
+ <tr>
30
+ <td><h1>CodeIgniter User Guide Version 1.7.2</h1></td>
31
+ <td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
32
+ </tr>
33
+ </table>
34
+ </div>
35
+ <!-- END NAVIGATION -->
36
+
37
+
38
+ <!-- START BREADCRUMB -->
39
+ <table cellpadding="0" cellspacing="0" border="0" style="width:100%">
40
+ <tr>
41
+ <td id="breadcrumb">
42
+ <a href="http://codeigniter.com/">CodeIgniter Home</a> &nbsp;&#8250;&nbsp;
43
+ <a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
44
+ Form Validation
45
+ </td>
46
+ <td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
47
+ </tr>
48
+ </table>
49
+ <!-- END BREADCRUMB -->
50
+
51
+ <br clear="all" />
52
+
53
+
54
+ <!-- START CONTENT -->
55
+ <div id="content">
56
+
57
+ <p class="important">
58
+ This library has been deprecated. Use of the form_validation library is encouraged.
59
+ </p>
60
+
61
+ <h1>Form Validation</h1>
62
+
63
+ <p>Before explaining CodeIgniter's approach to data validation, let's describe the ideal scenario:</p>
64
+
65
+ <ol>
66
+ <li>A form is displayed.</li>
67
+ <li>You fill it in and submit it.</li>
68
+ <li>If you submitted something invalid, or perhaps missed a required item, the form is redisplayed containing your data along with an error message describing the problem.</li>
69
+ <li>This process continues until you have submitted a valid form.</li>
70
+ </ol>
71
+
72
+ <p>On the receiving end, the script must:</p>
73
+
74
+ <ol>
75
+ <li>Check for required data.</li>
76
+ <li>Verify that the data is of the correct type, and meets the correct criteria. (For example, if a username is submitted
77
+ it must be validated to contain only permitted characters. It must be of a minimum length,
78
+ and not exceed a maximum length. The username can't be someone else's existing username, or perhaps even a reserved word. Etc.)</li>
79
+ <li>Sanitize the data for security.</li>
80
+ <li>Pre-format the data if needed (Does the data need to be trimmed? HTML encoded? Etc.)</li>
81
+ <li>Prep the data for insertion in the database.</li>
82
+ </ol>
83
+
84
+
85
+ <p>Although there is nothing complex about the above process, it usually requires a significant
86
+ amount of code, and to display error messages, various control structures are usually placed within the form HTML.
87
+ Form validation, while simple to create, is generally very messy and tedious to implement.</p>
88
+
89
+ <dfn>CodeIgniter provides a comprehensive validation framework that truly minimizes the amount of code you'll write.
90
+ It also removes all control structures from your form HTML, permitting it to be clean and free of code.</dfn>
91
+
92
+ <h2>Overview</h2>
93
+
94
+ <p>In order to implement CodeIgniter's form validation you'll need three things:</p>
95
+
96
+ <ol>
97
+ <li>A <a href="../general/views.html">View</a> file containing the form.</li>
98
+ <li>A View file containing a "success" message to be displayed upon successful submission.</li>
99
+ <li>A <a href="../general/controllers.html">controller</a> function to receive and process the submitted data.</li>
100
+ </ol>
101
+
102
+ <p>Let's create those three things, using a member sign-up form as the example.</p>
103
+
104
+ <h2>The Form</h2>
105
+
106
+ <p>Using a text editor, create a form called <dfn>myform.php</dfn>. In it, place this code and save it to your <samp>applications/views/</samp>
107
+ folder:</p>
108
+
109
+
110
+ <textarea class="textarea" style="width:100%" cols="50" rows="30">&lt;html>
111
+ &lt;head>
112
+ &lt;title>My Form&lt;/title>
113
+ &lt;/head>
114
+ &lt;body>
115
+
116
+ &lt;?php echo $this->validation->error_string; ?>
117
+
118
+ &lt;?php echo form_open('form'); ?>
119
+
120
+ &lt;h5>Username&lt;/h5>
121
+ &lt;input type="text" name="username" value="" size="50" />
122
+
123
+ &lt;h5>Password&lt;/h5>
124
+ &lt;input type="text" name="password" value="" size="50" />
125
+
126
+ &lt;h5>Password Confirm&lt;/h5>
127
+ &lt;input type="text" name="passconf" value="" size="50" />
128
+
129
+ &lt;h5>Email Address&lt;/h5>
130
+ &lt;input type="text" name="email" value="" size="50" />
131
+
132
+ &lt;div>&lt;input type="submit" value="Submit" />&lt;/div>
133
+
134
+ &lt;/form>
135
+
136
+ &lt;/body>
137
+ &lt;/html>
138
+ </textarea>
139
+
140
+
141
+ <h2>The Success Page</h2>
142
+
143
+
144
+ <p>Using a text editor, create a form called <dfn>formsuccess.php</dfn>. In it, place this code and save it to your <samp>applications/views/</samp>
145
+ folder:</p>
146
+
147
+
148
+ <textarea class="textarea" style="width:100%" cols="50" rows="14">
149
+ &lt;html>
150
+ &lt;head>
151
+ &lt;title>My Form&lt;/title>
152
+ &lt;/head>
153
+ &lt;body>
154
+
155
+ &lt;h3>Your form was successfully submitted!&lt;/h3>
156
+
157
+ &lt;p>&lt;?php echo anchor('form', 'Try it again!'); ?>&lt;/p>
158
+
159
+ &lt;/body>
160
+ &lt;/html>
161
+ </textarea>
162
+
163
+
164
+ <h2>The Controller</h2>
165
+
166
+ <p>Using a text editor, create a controller called <dfn>form.php</dfn>. In it, place this code and save it to your <samp>applications/controllers/</samp>
167
+ folder:</p>
168
+
169
+
170
+ <textarea class="textarea" style="width:100%" cols="50" rows="21">&lt;?php
171
+
172
+ class Form extends Controller {
173
+
174
+ function index()
175
+ {
176
+ $this->load->helper(array('form', 'url'));
177
+
178
+ $this->load->library('validation');
179
+
180
+ if ($this->validation->run() == FALSE)
181
+ {
182
+ $this->load->view('myform');
183
+ }
184
+ else
185
+ {
186
+ $this->load->view('formsuccess');
187
+ }
188
+ }
189
+ }
190
+ ?></textarea>
191
+
192
+
193
+ <h2>Try it!</h2>
194
+
195
+ <p>To try your form, visit your site using a URL similar to this one:</p>
196
+
197
+ <code>example.com/index.php/<var>form</var>/</code>
198
+
199
+ <p><strong>If you submit the form you should simply see the form reload. That's because you haven't set up any validation
200
+ rules yet, which we'll get to in a moment.</strong></p>
201
+
202
+
203
+ <h2>Explanation</h2>
204
+
205
+ <p>You'll notice several things about the above pages:</p>
206
+
207
+ <p>The <dfn>form</dfn> (myform.php) is a standard web form with a couple exceptions:</p>
208
+
209
+ <ol>
210
+ <li>It uses a <dfn>form helper</dfn> to create the form opening.
211
+ Technically, this isn't necessary. You could create the form using standard HTML. However, the benefit of using the helper
212
+ is that it generates the action URL for you, based on the URL in your config file. This makes your application more portable
213
+ and flexible in the event your URLs change.</li>
214
+
215
+ <li>At the top of the form you'll notice the following variable:
216
+ <code>&lt;?php echo $this->validation->error_string; ?&gt;</code>
217
+
218
+ <p>This variable will display any error messages sent back by the validator. If there are no messages it returns nothing.</p>
219
+ </li>
220
+ </ol>
221
+
222
+ <p>The <dfn>controller</dfn> (form.php) has one function: <dfn>index()</dfn>. This function initializes the validation class and
223
+ loads the <var>form helper</var> and <var>URL helper</var> used by your view files. It also <samp>runs</samp>
224
+ the validation routine. Based on
225
+ whether the validation was successful it either presents the form or the success page.</p>
226
+
227
+ <p><strong>Since you haven't told the validation class to validate anything yet, it returns "false" (boolean false) by default. The <samp>run()</samp>
228
+ function only returns "true" if it has successfully applied your rules without any of them failing.</strong></p>
229
+
230
+
231
+ <h2>Setting Validation Rules</h2>
232
+
233
+ <p>CodeIgniter lets you set as many validation rules as you need for a given field, cascading them in order, and it even lets you prep and pre-process the field data
234
+ at the same time. Let's see it in action, we'll explain it afterwards.</p>
235
+
236
+ <p>In your <dfn>controller</dfn> (form.php), add this code just below the validation initialization function:</p>
237
+
238
+ <code>$rules['username'] = "required";<br />
239
+ $rules['password'] = "required";<br />
240
+ $rules['passconf'] = "required";<br />
241
+ $rules['email'] = "required";<br />
242
+ <br />
243
+ $this->validation->set_rules($rules);</code>
244
+
245
+ <p>Your controller should now look like this:</p>
246
+
247
+ <textarea class="textarea" style="width:100%" cols="50" rows="28">&lt;?php
248
+
249
+ class Form extends Controller {
250
+
251
+ function index()
252
+ {
253
+ $this->load->helper(array('form', 'url'));
254
+
255
+ $this->load->library('validation');
256
+
257
+ $rules['username'] = "required";
258
+ $rules['password'] = "required";
259
+ $rules['passconf'] = "required";
260
+ $rules['email'] = "required";
261
+
262
+ $this->validation->set_rules($rules);
263
+
264
+ if ($this->validation->run() == FALSE)
265
+ {
266
+ $this->load->view('myform');
267
+ }
268
+ else
269
+ {
270
+ $this->load->view('formsuccess');
271
+ }
272
+ }
273
+ }
274
+ ?></textarea>
275
+
276
+ <p><dfn>Now submit the form with the fields blank and you should see the error message.
277
+ If you submit the form with all the fields populated you'll see your success page.</dfn></p>
278
+
279
+ <p class="important"><strong>Note:</strong> The form fields are not yet being re-populated with the data when
280
+ there is an error. We'll get to that shortly, once we're through explaining the validation rules.</p>
281
+
282
+
283
+ <h2>Changing the Error Delimiters</h2>
284
+
285
+ <p>By default, the system adds a paragraph tag (&lt;p&gt;) around each error message shown. You can easily change these delimiters with
286
+ this code, placed in your controller:</p>
287
+
288
+ <code>$this->validation->set_error_delimiters('<kbd>&lt;div class="error"></kbd>', '<kbd>&lt;/div></kbd>');</code>
289
+
290
+ <p>In this example, we've switched to using div tags.</p>
291
+
292
+ <h2>Cascading Rules</h2>
293
+
294
+ <p>CodeIgniter lets you pipe multiple rules together. Let's try it. Change your rules array like this:</p>
295
+
296
+
297
+ <code>$rules['username'] = "required|min_length[5]|max_length[12]";<br />
298
+ $rules['password'] = "required|matches[passconf]";<br />
299
+ $rules['passconf'] = "required";<br />
300
+ $rules['email'] = "required|valid_email";</code>
301
+
302
+ <p>The above code requires that:</p>
303
+
304
+ <ol>
305
+ <li>The username field be no shorter than 5 characters and no longer than 12.</li>
306
+ <li>The password field must match the password confirmation field.</li>
307
+ <li>The email field must contain a valid email address.</li>
308
+ </ol>
309
+
310
+ <p>Give it a try!</p>
311
+
312
+ <p class="important"><strong>Note:</strong> There are numerous rules available which you can read about in the validation reference.</p>
313
+
314
+
315
+ <h2>Prepping Data</h2>
316
+
317
+ <p>In addition to the validation functions like the ones we used above, you can also prep your data in various ways.
318
+ For example, you can set up rules like this:</p>
319
+
320
+ <code>$rules['username'] = "<kbd>trim</kbd>|required|min_length[5]|max_length[12]|<kbd>xss_clean</kbd>";<br />
321
+ $rules['password'] = "<kbd>trim</kbd>|required|matches[passconf]|<kbd>md5</kbd>";<br />
322
+ $rules['passconf'] = "<kbd>trim</kbd>|required";<br />
323
+ $rules['email'] = "<kbd>trim</kbd>|required|valid_email";</code>
324
+
325
+ <p>In the above example, we are "trimming" the fields, converting the password to MD5, and running the username through
326
+ the "xss_clean" function, which removes malicious data.</p>
327
+
328
+ <p class="important"><strong>Any native PHP function that accepts one parameter can be used as a rule, like <dfn>htmlspecialchars</dfn>,
329
+ <dfn>trim</dfn>, <dfn>MD5</dfn>, etc.</strong></p>
330
+
331
+ <p><strong>Note:</strong> You will generally want to use the prepping functions <strong>after</strong>
332
+ the validation rules so if there is an error, the original data will be shown in the form.</p>
333
+
334
+ <h2>Callbacks: Your own Validation Functions</h2>
335
+
336
+ <p>The validation system supports callbacks to your own validation functions. This permits you to extend the validation class
337
+ to meet your needs. For example, if you need to run a database query to see if the user is choosing a unique username, you can
338
+ create a callback function that does that. Let's create a simple example.</p>
339
+
340
+ <p>In your controller, change the "username" rule to this:</p>
341
+
342
+ <code>$rules['username'] = "callback_username_check"; </code>
343
+
344
+ <p>Then add a new function called <dfn>username_check</dfn> to your controller. Here's how your controller should look:</p>
345
+
346
+
347
+ <textarea class="textarea" style="width:100%" cols="50" rows="44">&lt;?php
348
+
349
+ class Form extends Controller {
350
+
351
+ function index()
352
+ {
353
+ $this->load->helper(array('form', 'url'));
354
+
355
+ $this->load->library('validation');
356
+
357
+ $rules['username'] = "callback_username_check";
358
+ $rules['password'] = "required";
359
+ $rules['passconf'] = "required";
360
+ $rules['email'] = "required";
361
+
362
+ $this->validation->set_rules($rules);
363
+
364
+ if ($this->validation->run() == FALSE)
365
+ {
366
+ $this->load->view('myform');
367
+ }
368
+ else
369
+ {
370
+ $this->load->view('formsuccess');
371
+ }
372
+ }
373
+
374
+ function username_check($str)
375
+ {
376
+ if ($str == 'test')
377
+ {
378
+ $this->validation->set_message('username_check', 'The %s field can not be the word "test"');
379
+ return FALSE;
380
+ }
381
+ else
382
+ {
383
+ return TRUE;
384
+ }
385
+ }
386
+
387
+ }
388
+ ?></textarea>
389
+
390
+ <p>Reload your form and submit it with the word "test" as the username. You can see that the form field data was passed to your
391
+ callback function for you to process.</p>
392
+
393
+ <p><strong>To invoke a callback just put the function name in a rule, with "callback_" as the rule prefix.</strong></p>
394
+
395
+ <p>The error message was set using the <dfn>$this->validation->set_message</dfn> function.
396
+ Just remember that the message key (the first parameter) must match your function name.</p>
397
+
398
+ <p class="important"><strong>Note:</strong> You can apply your own custom error messages to any rule, just by setting the
399
+ message similarly. For example, to change the message for the "required" rule you will do this:</p>
400
+
401
+ <code>$this->validation->set_message('required', 'Your custom message here');</code>
402
+
403
+ <h2>Re-populating the form</h2>
404
+
405
+ <p>Thus far we have only been dealing with errors. It's time to repopulate the form field with the submitted data.
406
+ This is done similarly to your rules. Add the following code to your controller, just below your rules:</p>
407
+
408
+ <code>$fields['username'] = 'Username';<br />
409
+ $fields['password'] = 'Password';<br />
410
+ $fields['passconf'] = 'Password Confirmation';<br />
411
+ $fields['email'] = 'Email Address';<br />
412
+ <br />
413
+ $this->validation->set_fields($fields);</code>
414
+
415
+ <p>The array keys are the actual names of the form fields, the value represents the full name that you want shown in the
416
+ error message.</p>
417
+
418
+ <p>The index function of your controller should now look like this:</p>
419
+
420
+
421
+ <textarea class="textarea" style="width:100%" cols="50" rows="30">function index()
422
+ {
423
+ $this->load->helper(array('form', 'url'));
424
+
425
+ $this->load->library('validation');
426
+
427
+ $rules['username'] = "required";
428
+ $rules['password'] = "required";
429
+ $rules['passconf'] = "required";
430
+ $rules['email'] = "required";
431
+
432
+ $this->validation->set_rules($rules);
433
+
434
+ $fields['username'] = 'Username';
435
+ $fields['password'] = 'Password';
436
+ $fields['passconf'] = 'Password Confirmation';
437
+ $fields['email'] = 'Email Address';
438
+
439
+ $this->validation->set_fields($fields);
440
+
441
+ if ($this->validation->run() == FALSE)
442
+ {
443
+ $this->load->view('myform');
444
+ }
445
+ else
446
+ {
447
+ $this->load->view('formsuccess');
448
+ }
449
+ }</textarea>
450
+
451
+
452
+ <p>Now open your <dfn>myform.php</dfn> view file and update the value in each field so that it has an attribute corresponding to its name:</p>
453
+
454
+
455
+ <textarea class="textarea" style="width:100%" cols="50" rows="30">
456
+ &lt;html>
457
+ &lt;head>
458
+ &lt;title>My Form&lt;/title>
459
+ &lt;/head>
460
+ &lt;body>
461
+
462
+ &lt;?php echo $this->validation->error_string; ?>
463
+
464
+ &lt;?php echo form_open('form'); ?>
465
+
466
+ &lt;h5>Username&lt;/h5>
467
+ &lt;input type="text" name="username" value="&lt;?php echo $this->validation->username;?>" size="50" />
468
+
469
+ &lt;h5>Password&lt;/h5>
470
+ &lt;input type="text" name="password" value="&lt;?php echo $this->validation->password;?>" size="50" />
471
+
472
+ &lt;h5>Password Confirm&lt;/h5>
473
+ &lt;input type="text" name="passconf" value="&lt;?php echo $this->validation->passconf;?>" size="50" />
474
+
475
+ &lt;h5>Email Address&lt;/h5>
476
+ &lt;input type="text" name="email" value="&lt;?php echo $this->validation->email;?>" size="50" />
477
+
478
+ &lt;div>&lt;input type="submit" value="Submit" />&lt;/div>
479
+
480
+ &lt;/form>
481
+
482
+ &lt;/body>
483
+ &lt;/html>
484
+ </textarea>
485
+
486
+
487
+ <p>Now reload your page and submit the form so that it triggers an error. Your form fields should be populated
488
+ and the error messages will contain a more relevant field name.</p>
489
+
490
+
491
+
492
+ <h2>Showing Errors Individually</h2>
493
+
494
+ <p>If you prefer to show an error message next to each form field, rather than as a list, you can change your form so that it looks like this:</p>
495
+
496
+
497
+ <textarea class="textarea" style="width:100%" cols="50" rows="20">
498
+ &lt;h5>Username&lt;/h5>
499
+ &lt;?php echo $this->validation->username_error; ?>
500
+ &lt;input type="text" name="username" value="&lt;?php echo $this->validation->username;?>" size="50" />
501
+
502
+ &lt;h5>Password&lt;/h5>
503
+ &lt;?php echo $this->validation->password_error; ?>
504
+ &lt;input type="text" name="password" value="&lt;?php echo $this->validation->password;?>" size="50" />
505
+
506
+ &lt;h5>Password Confirm&lt;/h5>
507
+ &lt;?php echo $this->validation->passconf_error; ?>
508
+ &lt;input type="text" name="passconf" value="&lt;?php echo $this->validation->passconf;?>" size="50" />
509
+
510
+ &lt;h5>Email Address&lt;/h5>
511
+ &lt;?php echo $this->validation->email_error; ?>
512
+ &lt;input type="text" name="email" value="&lt;?php echo $this->validation->email;?>" size="50" /></textarea>
513
+
514
+ <p>If there are no errors, nothing will be shown. If there is an error, the message will appear, wrapped in the delimiters you
515
+ have set (&lt;p> tags by default).</p>
516
+
517
+ <p class="important"><strong>Note: </strong>To display errors this way you must remember to set your fields using the <kbd>$this->validation->set_fields</kbd>
518
+ function described earlier. The errors will be turned into variables that have "_error" after your field name.
519
+ For example, your "username" error will be available at:<br /><dfn>$this->validation->username_error</dfn>.</p>
520
+
521
+
522
+ <h2>Rule Reference</h2>
523
+
524
+ <p>The following is a list of all the native rules that are available to use:</p>
525
+
526
+
527
+
528
+ <table cellpadding="0" cellspacing="1" border="0" style="width:100%" class="tableborder">
529
+ <tr>
530
+ <th>Rule</th>
531
+ <th>Parameter</th>
532
+ <th>Description</th>
533
+ <th>Example</th>
534
+ </tr><tr>
535
+
536
+ <td class="td"><strong>required</strong></td>
537
+ <td class="td">No</td>
538
+ <td class="td">Returns FALSE if the form element is empty.</td>
539
+ <td class="td">&nbsp;</td>
540
+ </tr><tr>
541
+
542
+ <td class="td"><strong>matches</strong></td>
543
+ <td class="td">Yes</td>
544
+ <td class="td">Returns FALSE if the form element does not match the one in the parameter.</td>
545
+ <td class="td">matches[form_item]</td>
546
+ </tr><tr>
547
+
548
+ <td class="td"><strong>min_length</strong></td>
549
+ <td class="td">Yes</td>
550
+ <td class="td">Returns FALSE if the form element is shorter then the parameter value.</td>
551
+ <td class="td">min_length[6]</td>
552
+ </tr><tr>
553
+
554
+ <td class="td"><strong>max_length</strong></td>
555
+ <td class="td">Yes</td>
556
+ <td class="td">Returns FALSE if the form element is longer then the parameter value.</td>
557
+ <td class="td">max_length[12]</td>
558
+ </tr><tr>
559
+
560
+ <td class="td"><strong>exact_length</strong></td>
561
+ <td class="td">Yes</td>
562
+ <td class="td">Returns FALSE if the form element is not exactly the parameter value.</td>
563
+ <td class="td">exact_length[8]</td>
564
+ </tr><tr>
565
+
566
+ <td class="td"><strong>alpha</strong></td>
567
+ <td class="td">No</td>
568
+ <td class="td">Returns FALSE if the form element contains anything other than alphabetical characters.</td>
569
+ <td class="td">&nbsp;</td>
570
+ </tr><tr>
571
+
572
+ <td class="td"><strong>alpha_numeric</strong></td>
573
+ <td class="td">No</td>
574
+ <td class="td">Returns FALSE if the form element contains anything other than alpha-numeric characters.</td>
575
+ <td class="td">&nbsp;</td>
576
+ </tr><tr>
577
+
578
+ <td class="td"><strong>alpha_dash</strong></td>
579
+ <td class="td">No</td>
580
+ <td class="td">Returns FALSE if the form element contains anything other than alpha-numeric characters, underscores or dashes.</td>
581
+ <td class="td">&nbsp;</td>
582
+ </tr>
583
+ <tr>
584
+ <td class="td"><strong>numeric</strong></td>
585
+ <td class="td">No</td>
586
+ <td class="td">Returns FALSE if the form element contains anything other than numeric characters.</td>
587
+ <td class="td">&nbsp;</td>
588
+ </tr>
589
+ <tr>
590
+
591
+ <td class="td"><strong>integer</strong></td>
592
+ <td class="td">No</td>
593
+ <td class="td">Returns FALSE if the form element contains anything other than an integer.</td>
594
+ <td class="td">&nbsp;</td>
595
+ </tr><tr>
596
+
597
+ <td class="td"><strong>valid_email</strong></td>
598
+ <td class="td">No</td>
599
+ <td class="td">Returns FALSE if the form element does not contain a valid email address.</td>
600
+ <td class="td">&nbsp;</td>
601
+ </tr>
602
+ <tr>
603
+ <td class="td"><strong>valid_emails</strong></td>
604
+ <td class="td">No</td>
605
+ <td class="td">Returns FALSE if any value provided in a comma separated list is not a valid email.</td>
606
+ <td class="td">&nbsp;</td>
607
+ </tr>
608
+ <tr>
609
+ <td class="td"><strong>valid_ip</strong></td>
610
+ <td class="td">No</td>
611
+ <td class="td">Returns FALSE if the supplied IP is not valid.</td>
612
+ <td class="td">&nbsp;</td>
613
+ </tr>
614
+ <tr>
615
+ <td class="td"><strong>valid_base64</strong></td>
616
+ <td class="td">No</td>
617
+ <td class="td">Returns FALSE if the supplied string contains anything other than valid Base64 characters.</td>
618
+ <td class="td">&nbsp;</td>
619
+ </tr>
620
+ </table>
621
+
622
+ <p><strong>Note:</strong> These rules can also be called as discrete functions. For example:</p>
623
+
624
+ <code>$this->validation->required($string);</code>
625
+
626
+ <p class="important"><strong>Note:</strong> You can also use any native PHP functions that permit one parameter.</p>
627
+
628
+
629
+
630
+ <h2>Prepping Reference</h2>
631
+
632
+ <p>The following is a list of all the prepping functions that are available to use:</p>
633
+
634
+
635
+
636
+ <table cellpadding="0" cellspacing="1" border="0" style="width:100%" class="tableborder">
637
+ <tr>
638
+ <th>Name</th>
639
+ <th>Parameter</th>
640
+ <th>Description</th>
641
+ </tr><tr>
642
+
643
+ <td class="td"><strong>xss_clean</strong></td>
644
+ <td class="td">No</td>
645
+ <td class="td">Runs the data through the XSS filtering function, described in the <a href="input.html">Input Class</a> page.</td>
646
+ </tr><tr>
647
+
648
+ <td class="td"><strong>prep_for_form</strong></td>
649
+ <td class="td">No</td>
650
+ <td class="td">Converts special characters so that HTML data can be shown in a form field without breaking it.</td>
651
+ </tr><tr>
652
+
653
+ <td class="td"><strong>prep_url</strong></td>
654
+ <td class="td">No</td>
655
+ <td class="td">Adds "http://" to URLs if missing.</td>
656
+ </tr><tr>
657
+
658
+ <td class="td"><strong>strip_image_tags</strong></td>
659
+ <td class="td">No</td>
660
+ <td class="td">Strips the HTML from image tags leaving the raw URL.</td>
661
+ </tr><tr>
662
+
663
+ <td class="td"><strong>encode_php_tags</strong></td>
664
+ <td class="td">No</td>
665
+ <td class="td">Converts PHP tags to entities.</td>
666
+ </tr>
667
+
668
+ </table>
669
+
670
+ <p class="important"><strong>Note:</strong> You can also use any native PHP functions that permit one parameter,
671
+ like <kbd>trim</kbd>, <kbd>htmlspecialchars</kbd>, <kbd>urldecode</kbd>, etc.</p>
672
+
673
+
674
+ <h2>Setting Custom Error Messages</h2>
675
+
676
+ <p>All of the native error messages are located in the following language file: <dfn>language/english/validation_lang.php</dfn></p>
677
+
678
+ <p>To set your own custom message you can either edit that file, or use the following function:</p>
679
+
680
+ <code>$this->validation->set_message('<var>rule</var>', '<var>Error Message</var>');</code>
681
+
682
+ <p>Where <var>rule</var> corresponds to the name of a particular rule, and <var>Error Message</var> is the text you would like displayed.</p>
683
+
684
+
685
+ <h2>Dealing with Select Menus, Radio Buttons, and Checkboxes</h2>
686
+
687
+ <p>If you use select menus, radio buttons or checkboxes, you will want the state of
688
+ these items to be retained in the event of an error. The Validation class has three functions that help you do this:</p>
689
+
690
+ <h2>set_select()</h2>
691
+
692
+ <p>Permits you to display the menu item that was selected. The first parameter
693
+ must contain the name of the select menu, the second parameter must contain the value of
694
+ each item. Example:</p>
695
+
696
+ <code>
697
+ &lt;select name="myselect"><br />
698
+ &lt;option value="one" <dfn>&lt;?php echo $this->validation->set_select('myselect', 'one'); ?></dfn> >One&lt;/option><br />
699
+ &lt;option value="two" <dfn>&lt;?php echo $this->validation->set_select('myselect', 'two'); ?></dfn> >Two&lt;/option><br />
700
+ &lt;option value="three" <dfn>&lt;?php echo $this->validation->set_select('myselect', 'three'); ?></dfn> >Three&lt;/option><br />
701
+ &lt;/select>
702
+ </code>
703
+
704
+
705
+ <h2>set_checkbox()</h2>
706
+
707
+ <p>Permits you to display a checkbox in the state it was submitted. The first parameter
708
+ must contain the name of the checkbox, the second parameter must contain its value. Example:</p>
709
+
710
+ <code>&lt;input type="checkbox" name="mycheck" value="1" <dfn>&lt;?php echo $this->validation->set_checkbox('mycheck', '1'); ?></dfn> /></code>
711
+
712
+
713
+ <h2>set_radio()</h2>
714
+
715
+ <p>Permits you to display radio buttons in the state they were submitted. The first parameter
716
+ must contain the name of the radio button, the second parameter must contain its value. Example:</p>
717
+
718
+ <code>&lt;input type="radio" name="myradio" value="1" <dfn>&lt;?php echo $this->validation->set_radio('myradio', '1'); ?></dfn> /></code>
719
+
720
+
721
+
722
+
723
+
724
+ </div>
725
+ <!-- END CONTENT -->
726
+
727
+
728
+ <div id="footer">
729
+ <p>
730
+ Previous Topic:&nbsp;&nbsp;<a href="user_agent.html">User Agent Class</a>
731
+ &nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
732
+ <a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
733
+ <a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
734
+ Next Topic:&nbsp;&nbsp;<a href="xmlrpc.html">XML-RPC Class</a>
735
+ </p>
736
+ <p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006-2010 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">Ellislab, Inc.</a></p>
737
+ </div>
738
+
739
+ </body>
740
+ </html>