codeigniter_vender 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/MIT-LICENSE +20 -0
- data/README +40 -0
- data/Rakefile +18 -0
- data/VERSION +1 -0
- data/codeigniter_vender.gemspec +389 -0
- data/generators/ci_app/USAGE +8 -0
- data/generators/ci_app/ci_app_generator.rb +12 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/index.php +118 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/license.txt +52 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/autoload.php +116 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/config.php +329 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/constants.php +41 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/database.php +55 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/doctypes.php +15 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/hooks.php +16 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/mimes.php +105 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/routes.php +48 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/smileys.php +66 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/user_agents.php +175 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/controllers/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/controllers/welcome.php +17 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_404.php +34 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_db.php +34 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_general.php +34 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_php.php +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/helpers/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/hooks/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/language/english/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/libraries/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/models/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/views/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/views/welcome_message.php +62 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/cache/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Base4.php +69 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Base5.php +56 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/CodeIgniter.php +280 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Common.php +421 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Compat.php +93 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB.php +146 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_active_rec.php +1820 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_cache.php +195 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_driver.php +1366 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_forge.php +375 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_result.php +342 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_utility.php +389 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_driver.php +667 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_forge.php +248 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_result.php +169 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_utility.php +123 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_driver.php +670 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_forge.php +254 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_result.php +169 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_utility.php +245 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_driver.php +671 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_forge.php +254 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_result.php +169 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_utility.php +123 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_driver.php +780 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_forge.php +248 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_result.php +249 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_utility.php +122 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_driver.php +639 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_forge.php +266 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_result.php +228 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_utility.php +148 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_driver.php +684 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_forge.php +248 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_result.php +169 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_utility.php +124 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_driver.php +657 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_forge.php +265 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_result.php +179 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_utility.php +141 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/fonts/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/fonts/texb.ttf +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/array_helper.php +78 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/compatibility_helper.php +498 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/cookie_helper.php +144 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/date_helper.php +611 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/directory_helper.php +84 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/download_helper.php +100 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/email_helper.php +62 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/file_helper.php +464 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/form_helper.php +1025 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/html_helper.php +416 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/inflector_helper.php +171 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/language_helper.php +58 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/number_helper.php +75 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/path_helper.php +72 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/security_helper.php +126 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/smiley_helper.php +273 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/string_helper.php +273 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/text_helper.php +462 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/typography_helper.php +71 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/url_helper.php +593 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/xml_helper.php +62 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/calendar_lang.php +51 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/date_lang.php +60 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/db_lang.php +28 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/email_lang.php +24 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/form_validation_lang.php +24 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/ftp_lang.php +17 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/imglib_lang.php +24 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/number_lang.php +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/profiler_lang.php +19 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/scaffolding_lang.php +17 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/unit_test_lang.php +24 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/upload_lang.php +22 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/validation_lang.php +24 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Benchmark.php +113 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Calendar.php +477 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Cart.php +550 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Config.php +244 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Controller.php +127 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Email.php +2041 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Encrypt.php +484 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Exceptions.php +174 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Form_validation.php +1278 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Ftp.php +618 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Hooks.php +226 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Image_lib.php +1544 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Input.php +1067 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Language.php +123 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Loader.php +1085 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Log.php +117 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Model.php +83 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Output.php +409 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Pagination.php +244 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Parser.php +173 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Profiler.php +392 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Router.php +389 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Session.php +758 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Sha1.php +251 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Table.php +440 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Trackback.php +547 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Typography.php +406 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/URI.php +586 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Unit_test.php +347 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Upload.php +970 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/User_agent.php +502 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Validation.php +875 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Xmlrpc.php +1421 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Xmlrpcs.php +536 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Zip.php +359 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/logs/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/plugins/captcha_pi.php +356 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/plugins/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/plugins/js_calendar_pi.php +629 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/Scaffolding.php +291 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/images/background.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/images/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/images/logo.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/add.php +32 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/delete.php +9 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/edit.php +33 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/footer.php +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/header.php +29 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/index.html +10 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/no_data.php +8 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/stylesheet.css +143 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/view.php +27 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/changelog.html +1080 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/active_record.html +757 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/caching.html +220 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/call_function.html +118 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/configuration.html +157 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/connecting.html +186 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/examples.html +217 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/fields.html +163 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/forge.html +234 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/helpers.html +151 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/index.html +99 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/queries.html +153 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/results.html +238 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/table_data.html +113 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/transactions.html +200 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/utilities.html +295 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/doc_style/index.html +86 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/doc_style/template.html +128 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/alternative_php.html +147 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/ancillary_classes.html +117 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/autoloader.html +101 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/caching.html +115 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/common_functions.html +119 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/controllers.html +385 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/core_classes.html +185 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/creating_libraries.html +298 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/credits.html +86 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/errors.html +138 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/helpers.html +185 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/hooks.html +167 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/libraries.html +94 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/managing_apps.html +133 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/models.html +251 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/plugins.html +127 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/profiling.html +104 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/quick_reference.html +77 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/requirements.html +82 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/reserved_names.html +156 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/routing.html +176 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/scaffolding.html +147 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/security.html +153 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/styleguide.html +687 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/urls.html +151 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/views.html +274 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/array_helper.html +119 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/compatibility_helper.html +118 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/cookie_helper.html +147 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/date_helper.html +408 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/directory_helper.html +143 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/download_helper.html +112 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/email_helper.html +102 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/file_helper.html +178 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/form_helper.html +484 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/html_helper.html +385 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/inflector_helper.html +151 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/language_helper.html +98 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/number_helper.html +107 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/path_helper.html +106 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/security_helper.html +125 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/smiley_helper.html +215 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/string_helper.html +176 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/text_helper.html +192 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/typography_helper.html +112 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/url_helper.html +289 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/xml_helper.html +105 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/appflowchart.gif +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/arrow.gif +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/ci_logo.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/ci_logo_flame.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/ci_quick_ref.png +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_helper_reference.pdf +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_helper_reference.png +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_library_reference.pdf +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_library_reference.png +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/file.gif +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/folder.gif +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/nav_bg_darker.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/nav_separator_darker.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/nav_toggle_darker.jpg +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/smile.gif +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/transparent.gif +0 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/index.html +99 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/downloads.html +105 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/index.html +97 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/troubleshooting.html +90 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_120.html +92 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_130.html +203 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_131.html +102 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_132.html +100 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_133.html +112 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_140.html +145 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_141.html +148 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_150.html +178 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_152.html +111 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_153.html +100 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_154.html +116 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_160.html +125 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_161.html +98 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_162.html +106 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_163.html +99 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_170.html +121 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_171.html +98 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_172.html +105 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_b11.html +144 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrading.html +101 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/benchmark.html +198 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/calendar.html +249 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/cart.html +346 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/config.html +181 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/email.html +307 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/encryption.html +182 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/file_uploading.html +451 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/form_validation.html +1221 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/ftp.html +303 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/image_lib.html +666 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/input.html +231 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/language.html +137 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/loader.html +214 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/output.html +145 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/pagination.html +218 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/parser.html +208 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/sessions.html +311 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/table.html +292 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/trackback.html +246 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/typography.html +160 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/unit_testing.html +205 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/uri.html +252 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/user_agent.html +201 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/validation.html +740 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/xmlrpc.html +517 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/zip.html +278 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/license.html +107 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/hacks.txt +9 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/moo.fx.js +119 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/moo.fx.pack.js +241 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/nav.js +139 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/prototype.lite.js +127 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/user_guide_menu.js +4 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/appflow.html +95 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/at_a_glance.html +172 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/cheatsheets.html +83 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/features.html +120 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/getting_started.html +92 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/goals.html +98 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/index.html +84 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/mvc.html +100 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/toc.html +209 -0
- data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/userguide.css +406 -0
- data/generators/ci_app/templates/README +1 -0
- data/generators/ci_controller/USAGE +2 -0
- data/generators/ci_controller/ci_controller_generator.rb +11 -0
- data/generators/ci_controller/templates/ci_controller.php.erb +15 -0
- data/generators/ci_controller/templates/ci_view.php.erb +8 -0
- data/generators/ci_layout/USAGE +2 -0
- data/generators/ci_layout/ci_layout_generator.rb +24 -0
- data/generators/ci_layout/templates/application_layout.php.erb +19 -0
- data/generators/ci_model/USAGE +2 -0
- data/generators/ci_model/ci_model_generator.rb +42 -0
- data/generators/ci_model/templates/ci_model.php.erb +15 -0
- data/generators/ci_model/templates/model.rb +5 -0
- data/generators/ci_model/templates/model_migration.rb.erb +16 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/codeigniter_vender.rb +1 -0
- data/lib/tasks/app.rake +8 -0
- data/test/codeigniter_vender_test.rb +8 -0
- data/test/test_helper.rb +3 -0
- data/uninstall.rb +1 -0
- metadata +411 -0
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
2
|
+
/**
|
|
3
|
+
* CodeIgniter
|
|
4
|
+
*
|
|
5
|
+
* An open source application development framework for PHP 4.3.2 or newer
|
|
6
|
+
*
|
|
7
|
+
* @package CodeIgniter
|
|
8
|
+
* @author ExpressionEngine Dev Team
|
|
9
|
+
* @copyright Copyright (c) 2006 - 2010, EllisLab, Inc.
|
|
10
|
+
* @license http://codeigniter.com/user_guide/license.html
|
|
11
|
+
* @link http://codeigniter.com
|
|
12
|
+
* @since Version 1.0
|
|
13
|
+
* @filesource
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// ------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Shopping Cart Class
|
|
20
|
+
*
|
|
21
|
+
* @package CodeIgniter
|
|
22
|
+
* @subpackage Libraries
|
|
23
|
+
* @category Shopping Cart
|
|
24
|
+
* @author ExpressionEngine Dev Team
|
|
25
|
+
* @link http://codeigniter.com/user_guide/libraries/cart.html
|
|
26
|
+
*/
|
|
27
|
+
class CI_Cart {
|
|
28
|
+
|
|
29
|
+
// These are the regular expression rules that we use to validate the product ID and product name
|
|
30
|
+
var $product_id_rules = '\.a-z0-9_-'; // alpha-numeric, dashes, underscores, or periods
|
|
31
|
+
var $product_name_rules = '\.\:\-_ a-z0-9'; // alpha-numeric, dashes, underscores, colons or periods
|
|
32
|
+
|
|
33
|
+
// Private variables. Do not change!
|
|
34
|
+
var $CI;
|
|
35
|
+
var $_cart_contents = array();
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Shopping Class Constructor
|
|
40
|
+
*
|
|
41
|
+
* The constructor loads the Session class, used to store the shopping cart contents.
|
|
42
|
+
*/
|
|
43
|
+
function CI_Cart($params = array())
|
|
44
|
+
{
|
|
45
|
+
// Set the super object to a local variable for use later
|
|
46
|
+
$this->CI =& get_instance();
|
|
47
|
+
|
|
48
|
+
// Are any config settings being passed manually? If so, set them
|
|
49
|
+
$config = array();
|
|
50
|
+
if (count($params) > 0)
|
|
51
|
+
{
|
|
52
|
+
foreach ($params as $key => $val)
|
|
53
|
+
{
|
|
54
|
+
$config[$key] = $val;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Load the Sessions class
|
|
59
|
+
$this->CI->load->library('session', $config);
|
|
60
|
+
|
|
61
|
+
// Grab the shopping cart array from the session table, if it exists
|
|
62
|
+
if ($this->CI->session->userdata('cart_contents') !== FALSE)
|
|
63
|
+
{
|
|
64
|
+
$this->_cart_contents = $this->CI->session->userdata('cart_contents');
|
|
65
|
+
}
|
|
66
|
+
else
|
|
67
|
+
{
|
|
68
|
+
// No cart exists so we'll set some base values
|
|
69
|
+
$this->_cart_contents['cart_total'] = 0;
|
|
70
|
+
$this->_cart_contents['total_items'] = 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
log_message('debug', "Cart Class Initialized");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// --------------------------------------------------------------------
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Insert items into the cart and save it to the session table
|
|
80
|
+
*
|
|
81
|
+
* @access public
|
|
82
|
+
* @param array
|
|
83
|
+
* @return bool
|
|
84
|
+
*/
|
|
85
|
+
function insert($items = array())
|
|
86
|
+
{
|
|
87
|
+
// Was any cart data passed? No? Bah...
|
|
88
|
+
if ( ! is_array($items) OR count($items) == 0)
|
|
89
|
+
{
|
|
90
|
+
log_message('error', 'The insert method must be passed an array containing data.');
|
|
91
|
+
return FALSE;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// You can either insert a single product using a one-dimensional array,
|
|
95
|
+
// or multiple products using a multi-dimensional one. The way we
|
|
96
|
+
// determine the array type is by looking for a required array key named "id"
|
|
97
|
+
// at the top level. If it's not found, we will assume it's a multi-dimensional array.
|
|
98
|
+
|
|
99
|
+
$save_cart = FALSE;
|
|
100
|
+
if (isset($items['id']))
|
|
101
|
+
{
|
|
102
|
+
if ($this->_insert($items) == TRUE)
|
|
103
|
+
{
|
|
104
|
+
$save_cart = TRUE;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else
|
|
108
|
+
{
|
|
109
|
+
foreach ($items as $val)
|
|
110
|
+
{
|
|
111
|
+
if (is_array($val) AND isset($val['id']))
|
|
112
|
+
{
|
|
113
|
+
if ($this->_insert($val) == TRUE)
|
|
114
|
+
{
|
|
115
|
+
$save_cart = TRUE;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Save the cart data if the insert was successful
|
|
122
|
+
if ($save_cart == TRUE)
|
|
123
|
+
{
|
|
124
|
+
$this->_save_cart();
|
|
125
|
+
return TRUE;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return FALSE;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// --------------------------------------------------------------------
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Insert
|
|
135
|
+
*
|
|
136
|
+
* @access private
|
|
137
|
+
* @param array
|
|
138
|
+
* @return bool
|
|
139
|
+
*/
|
|
140
|
+
function _insert($items = array())
|
|
141
|
+
{
|
|
142
|
+
// Was any cart data passed? No? Bah...
|
|
143
|
+
if ( ! is_array($items) OR count($items) == 0)
|
|
144
|
+
{
|
|
145
|
+
log_message('error', 'The insert method must be passed an array containing data.');
|
|
146
|
+
return FALSE;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// --------------------------------------------------------------------
|
|
150
|
+
|
|
151
|
+
// Does the $items array contain an id, quantity, price, and name? These are required
|
|
152
|
+
if ( ! isset($items['id']) OR ! isset($items['qty']) OR ! isset($items['price']) OR ! isset($items['name']))
|
|
153
|
+
{
|
|
154
|
+
log_message('error', 'The cart array must contain a product ID, quantity, price, and name.');
|
|
155
|
+
return FALSE;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// --------------------------------------------------------------------
|
|
159
|
+
|
|
160
|
+
// Prep the quantity. It can only be a number. Duh...
|
|
161
|
+
$items['qty'] = trim(preg_replace('/([^0-9])/i', '', $items['qty']));
|
|
162
|
+
// Trim any leading zeros
|
|
163
|
+
$items['qty'] = trim(preg_replace('/(^[0]+)/i', '', $items['qty']));
|
|
164
|
+
|
|
165
|
+
// If the quantity is zero or blank there's nothing for us to do
|
|
166
|
+
if ( ! is_numeric($items['qty']) OR $items['qty'] == 0)
|
|
167
|
+
{
|
|
168
|
+
return FALSE;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// --------------------------------------------------------------------
|
|
172
|
+
|
|
173
|
+
// Validate the product ID. It can only be alpha-numeric, dashes, underscores or periods
|
|
174
|
+
// Not totally sure we should impose this rule, but it seems prudent to standardize IDs.
|
|
175
|
+
// Note: These can be user-specified by setting the $this->product_id_rules variable.
|
|
176
|
+
if ( ! preg_match("/^[".$this->product_id_rules."]+$/i", $items['id']))
|
|
177
|
+
{
|
|
178
|
+
log_message('error', 'Invalid product ID. The product ID can only contain alpha-numeric characters, dashes, and underscores');
|
|
179
|
+
return FALSE;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// --------------------------------------------------------------------
|
|
183
|
+
|
|
184
|
+
// Validate the product name. It can only be alpha-numeric, dashes, underscores, colons or periods.
|
|
185
|
+
// Note: These can be user-specified by setting the $this->product_name_rules variable.
|
|
186
|
+
if ( ! preg_match("/^[".$this->product_name_rules."]+$/i", $items['name']))
|
|
187
|
+
{
|
|
188
|
+
log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces');
|
|
189
|
+
return FALSE;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// --------------------------------------------------------------------
|
|
193
|
+
|
|
194
|
+
// Prep the price. Remove anything that isn't a number or decimal point.
|
|
195
|
+
$items['price'] = trim(preg_replace('/([^0-9\.])/i', '', $items['price']));
|
|
196
|
+
// Trim any leading zeros
|
|
197
|
+
$items['price'] = trim(preg_replace('/(^[0]+)/i', '', $items['price']));
|
|
198
|
+
|
|
199
|
+
// Is the price a valid number?
|
|
200
|
+
if ( ! is_numeric($items['price']))
|
|
201
|
+
{
|
|
202
|
+
log_message('error', 'An invalid price was submitted for product ID: '.$items['id']);
|
|
203
|
+
return FALSE;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// --------------------------------------------------------------------
|
|
207
|
+
|
|
208
|
+
// We now need to create a unique identifier for the item being inserted into the cart.
|
|
209
|
+
// Every time something is added to the cart it is stored in the master cart array.
|
|
210
|
+
// Each row in the cart array, however, must have a unique index that identifies not only
|
|
211
|
+
// a particular product, but makes it possible to store identical products with different options.
|
|
212
|
+
// For example, what if someone buys two identical t-shirts (same product ID), but in
|
|
213
|
+
// different sizes? The product ID (and other attributes, like the name) will be identical for
|
|
214
|
+
// both sizes because it's the same shirt. The only difference will be the size.
|
|
215
|
+
// Internally, we need to treat identical submissions, but with different options, as a unique product.
|
|
216
|
+
// Our solution is to convert the options array to a string and MD5 it along with the product ID.
|
|
217
|
+
// This becomes the unique "row ID"
|
|
218
|
+
if (isset($items['options']) AND count($items['options']) > 0)
|
|
219
|
+
{
|
|
220
|
+
$rowid = md5($items['id'].implode('', $items['options']));
|
|
221
|
+
}
|
|
222
|
+
else
|
|
223
|
+
{
|
|
224
|
+
// No options were submitted so we simply MD5 the product ID.
|
|
225
|
+
// Technically, we don't need to MD5 the ID in this case, but it makes
|
|
226
|
+
// sense to standardize the format of array indexes for both conditions
|
|
227
|
+
$rowid = md5($items['id']);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// --------------------------------------------------------------------
|
|
231
|
+
|
|
232
|
+
// Now that we have our unique "row ID", we'll add our cart items to the master array
|
|
233
|
+
|
|
234
|
+
// let's unset this first, just to make sure our index contains only the data from this submission
|
|
235
|
+
unset($this->_cart_contents[$rowid]);
|
|
236
|
+
|
|
237
|
+
// Create a new index with our new row ID
|
|
238
|
+
$this->_cart_contents[$rowid]['rowid'] = $rowid;
|
|
239
|
+
|
|
240
|
+
// And add the new items to the cart array
|
|
241
|
+
foreach ($items as $key => $val)
|
|
242
|
+
{
|
|
243
|
+
$this->_cart_contents[$rowid][$key] = $val;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Woot!
|
|
247
|
+
return TRUE;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// --------------------------------------------------------------------
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Update the cart
|
|
254
|
+
*
|
|
255
|
+
* This function permits the quantity of a given item to be changed.
|
|
256
|
+
* Typically it is called from the "view cart" page if a user makes
|
|
257
|
+
* changes to the quantity before checkout. That array must contain the
|
|
258
|
+
* product ID and quantity for each item.
|
|
259
|
+
*
|
|
260
|
+
* @access public
|
|
261
|
+
* @param array
|
|
262
|
+
* @param string
|
|
263
|
+
* @return bool
|
|
264
|
+
*/
|
|
265
|
+
function update($items = array())
|
|
266
|
+
{
|
|
267
|
+
// Was any cart data passed?
|
|
268
|
+
if ( ! is_array($items) OR count($items) == 0)
|
|
269
|
+
{
|
|
270
|
+
return FALSE;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// You can either update a single product using a one-dimensional array,
|
|
274
|
+
// or multiple products using a multi-dimensional one. The way we
|
|
275
|
+
// determine the array type is by looking for a required array key named "id".
|
|
276
|
+
// If it's not found we assume it's a multi-dimensional array
|
|
277
|
+
$save_cart = FALSE;
|
|
278
|
+
if (isset($items['rowid']) AND isset($items['qty']))
|
|
279
|
+
{
|
|
280
|
+
if ($this->_update($items) == TRUE)
|
|
281
|
+
{
|
|
282
|
+
$save_cart = TRUE;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
else
|
|
286
|
+
{
|
|
287
|
+
foreach ($items as $val)
|
|
288
|
+
{
|
|
289
|
+
if (is_array($val) AND isset($val['rowid']) AND isset($val['qty']))
|
|
290
|
+
{
|
|
291
|
+
if ($this->_update($val) == TRUE)
|
|
292
|
+
{
|
|
293
|
+
$save_cart = TRUE;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Save the cart data if the insert was successful
|
|
300
|
+
if ($save_cart == TRUE)
|
|
301
|
+
{
|
|
302
|
+
$this->_save_cart();
|
|
303
|
+
return TRUE;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return FALSE;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// --------------------------------------------------------------------
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Update the cart
|
|
313
|
+
*
|
|
314
|
+
* This function permits the quantity of a given item to be changed.
|
|
315
|
+
* Typically it is called from the "view cart" page if a user makes
|
|
316
|
+
* changes to the quantity before checkout. That array must contain the
|
|
317
|
+
* product ID and quantity for each item.
|
|
318
|
+
*
|
|
319
|
+
* @access private
|
|
320
|
+
* @param array
|
|
321
|
+
* @return bool
|
|
322
|
+
*/
|
|
323
|
+
function _update($items = array())
|
|
324
|
+
{
|
|
325
|
+
// Without these array indexes there is nothing we can do
|
|
326
|
+
if ( ! isset($items['qty']) OR ! isset($items['rowid']) OR ! isset($this->_cart_contents[$items['rowid']]))
|
|
327
|
+
{
|
|
328
|
+
return FALSE;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Prep the quantity
|
|
332
|
+
$items['qty'] = preg_replace('/([^0-9])/i', '', $items['qty']);
|
|
333
|
+
|
|
334
|
+
// Is the quantity a number?
|
|
335
|
+
if ( ! is_numeric($items['qty']))
|
|
336
|
+
{
|
|
337
|
+
return FALSE;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Is the new quantity different than what is already saved in the cart?
|
|
341
|
+
// If it's the same there's nothing to do
|
|
342
|
+
if ($this->_cart_contents[$items['rowid']]['qty'] == $items['qty'])
|
|
343
|
+
{
|
|
344
|
+
return FALSE;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Is the quantity zero? If so we will remove the item from the cart.
|
|
348
|
+
// If the quantity is greater than zero we are updating
|
|
349
|
+
if ($items['qty'] == 0)
|
|
350
|
+
{
|
|
351
|
+
unset($this->_cart_contents[$items['rowid']]);
|
|
352
|
+
}
|
|
353
|
+
else
|
|
354
|
+
{
|
|
355
|
+
$this->_cart_contents[$items['rowid']]['qty'] = $items['qty'];
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
return TRUE;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// --------------------------------------------------------------------
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Save the cart array to the session DB
|
|
365
|
+
*
|
|
366
|
+
* @access private
|
|
367
|
+
* @return bool
|
|
368
|
+
*/
|
|
369
|
+
function _save_cart()
|
|
370
|
+
{
|
|
371
|
+
// Unset these so our total can be calculated correctly below
|
|
372
|
+
unset($this->_cart_contents['total_items']);
|
|
373
|
+
unset($this->_cart_contents['cart_total']);
|
|
374
|
+
|
|
375
|
+
// Lets add up the individual prices and set the cart sub-total
|
|
376
|
+
$total = 0;
|
|
377
|
+
foreach ($this->_cart_contents as $key => $val)
|
|
378
|
+
{
|
|
379
|
+
// We make sure the array contains the proper indexes
|
|
380
|
+
if ( ! is_array($val) OR ! isset($val['price']) OR ! isset($val['qty']))
|
|
381
|
+
{
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
$total += ($val['price'] * $val['qty']);
|
|
386
|
+
|
|
387
|
+
// Set the subtotal
|
|
388
|
+
$this->_cart_contents[$key]['subtotal'] = ($this->_cart_contents[$key]['price'] * $this->_cart_contents[$key]['qty']);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// Set the cart total and total items.
|
|
392
|
+
$this->_cart_contents['total_items'] = count($this->_cart_contents);
|
|
393
|
+
$this->_cart_contents['cart_total'] = $total;
|
|
394
|
+
|
|
395
|
+
// Is our cart empty? If so we delete it from the session
|
|
396
|
+
if (count($this->_cart_contents) <= 2)
|
|
397
|
+
{
|
|
398
|
+
$this->CI->session->unset_userdata('cart_contents');
|
|
399
|
+
|
|
400
|
+
// Nothing more to do... coffee time!
|
|
401
|
+
return FALSE;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// If we made it this far it means that our cart has data.
|
|
405
|
+
// Let's pass it to the Session class so it can be stored
|
|
406
|
+
$this->CI->session->set_userdata(array('cart_contents' => $this->_cart_contents));
|
|
407
|
+
|
|
408
|
+
// Woot!
|
|
409
|
+
return TRUE;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// --------------------------------------------------------------------
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Cart Total
|
|
416
|
+
*
|
|
417
|
+
* @access public
|
|
418
|
+
* @return integer
|
|
419
|
+
*/
|
|
420
|
+
function total()
|
|
421
|
+
{
|
|
422
|
+
return $this->_cart_contents['cart_total'];
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// --------------------------------------------------------------------
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Total Items
|
|
429
|
+
*
|
|
430
|
+
* Returns the total item count
|
|
431
|
+
*
|
|
432
|
+
* @access public
|
|
433
|
+
* @return integer
|
|
434
|
+
*/
|
|
435
|
+
function total_items()
|
|
436
|
+
{
|
|
437
|
+
return $this->_cart_contents['total_items'];
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// --------------------------------------------------------------------
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Cart Contents
|
|
444
|
+
*
|
|
445
|
+
* Returns the entire cart array
|
|
446
|
+
*
|
|
447
|
+
* @access public
|
|
448
|
+
* @return array
|
|
449
|
+
*/
|
|
450
|
+
function contents()
|
|
451
|
+
{
|
|
452
|
+
$cart = $this->_cart_contents;
|
|
453
|
+
|
|
454
|
+
// Remove these so they don't create a problem when showing the cart table
|
|
455
|
+
unset($cart['total_items']);
|
|
456
|
+
unset($cart['cart_total']);
|
|
457
|
+
|
|
458
|
+
return $cart;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// --------------------------------------------------------------------
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Has options
|
|
465
|
+
*
|
|
466
|
+
* Returns TRUE if the rowid passed to this function correlates to an item
|
|
467
|
+
* that has options associated with it.
|
|
468
|
+
*
|
|
469
|
+
* @access public
|
|
470
|
+
* @return array
|
|
471
|
+
*/
|
|
472
|
+
function has_options($rowid = '')
|
|
473
|
+
{
|
|
474
|
+
if ( ! isset($this->_cart_contents[$rowid]['options']) OR count($this->_cart_contents[$rowid]['options']) === 0)
|
|
475
|
+
{
|
|
476
|
+
return FALSE;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
return TRUE;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// --------------------------------------------------------------------
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Product options
|
|
486
|
+
*
|
|
487
|
+
* Returns the an array of options, for a particular product row ID
|
|
488
|
+
*
|
|
489
|
+
* @access public
|
|
490
|
+
* @return array
|
|
491
|
+
*/
|
|
492
|
+
function product_options($rowid = '')
|
|
493
|
+
{
|
|
494
|
+
if ( ! isset($this->_cart_contents[$rowid]['options']))
|
|
495
|
+
{
|
|
496
|
+
return array();
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
return $this->_cart_contents[$rowid]['options'];
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// --------------------------------------------------------------------
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Format Number
|
|
506
|
+
*
|
|
507
|
+
* Returns the supplied number with commas and a decimal point.
|
|
508
|
+
*
|
|
509
|
+
* @access public
|
|
510
|
+
* @return integer
|
|
511
|
+
*/
|
|
512
|
+
function format_number($n = '')
|
|
513
|
+
{
|
|
514
|
+
if ($n == '')
|
|
515
|
+
{
|
|
516
|
+
return '';
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// Remove anything that isn't a number or decimal point.
|
|
520
|
+
$n = trim(preg_replace('/([^0-9\.])/i', '', $n));
|
|
521
|
+
|
|
522
|
+
return number_format($n, 2, '.', ',');
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// --------------------------------------------------------------------
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Destroy the cart
|
|
529
|
+
*
|
|
530
|
+
* Empties the cart and kills the session
|
|
531
|
+
*
|
|
532
|
+
* @access public
|
|
533
|
+
* @return null
|
|
534
|
+
*/
|
|
535
|
+
function destroy()
|
|
536
|
+
{
|
|
537
|
+
unset($this->_cart_contents);
|
|
538
|
+
|
|
539
|
+
$this->_cart_contents['cart_total'] = 0;
|
|
540
|
+
$this->_cart_contents['total_items'] = 0;
|
|
541
|
+
|
|
542
|
+
$this->CI->session->unset_userdata('cart_contents');
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
}
|
|
547
|
+
// END Cart Class
|
|
548
|
+
|
|
549
|
+
/* End of file Cart.php */
|
|
550
|
+
/* Location: ./system/libraries/Cart.php */
|