mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
4f67f84ff8
Conflicts: app/config/acl.ini.php app/config/bootstrap.php app/config/core.php app/config/database.php.default app/config/inflections.php app/config/routes.php app/config/schema/db_acl.php app/config/schema/i18n.php app/config/schema/sessions.php app/config/sql/db_acl.sql app/config/sql/i18n.sql app/index.php app/webroot/css.php app/webroot/css/cake.generic.css app/webroot/index.php app/webroot/js/vendors.php app/webroot/test.php cake/LICENSE.txt cake/basics.php cake/bootstrap.php cake/config/config.php cake/config/paths.php cake/config/unicode/casefolding/0080_00ff.php cake/config/unicode/casefolding/0100_017f.php cake/config/unicode/casefolding/0180_024F.php cake/config/unicode/casefolding/0250_02af.php cake/config/unicode/casefolding/0370_03ff.php cake/config/unicode/casefolding/0400_04ff.php cake/config/unicode/casefolding/0500_052f.php cake/config/unicode/casefolding/0530_058f.php cake/config/unicode/casefolding/1e00_1eff.php cake/config/unicode/casefolding/1f00_1fff.php cake/config/unicode/casefolding/2100_214f.php cake/config/unicode/casefolding/2150_218f.php cake/config/unicode/casefolding/2460_24ff.php cake/config/unicode/casefolding/2c00_2c5f.php cake/config/unicode/casefolding/2c60_2c7f.php cake/config/unicode/casefolding/2c80_2cff.php cake/config/unicode/casefolding/ff00_ffef.php cake/console/cake cake/console/cake.bat cake/console/cake.php cake/console/error.php cake/console/libs/acl.php cake/console/libs/api.php cake/console/libs/bake.php cake/console/libs/console.php cake/console/libs/i18n.php cake/console/libs/schema.php cake/console/libs/shell.php cake/console/libs/tasks/controller.php cake/console/libs/tasks/db_config.php cake/console/libs/tasks/extract.php cake/console/libs/tasks/model.php cake/console/libs/tasks/plugin.php cake/console/libs/tasks/project.php cake/console/libs/tasks/test.php cake/console/libs/tasks/view.php cake/console/libs/templates/skel/config/bootstrap.php cake/console/libs/templates/skel/config/inflections.php cake/console/libs/templates/skel/config/sql/sessions.sql cake/console/libs/templates/skel/index.php cake/console/libs/templates/skel/views/elements/email/html/default.ctp cake/console/libs/templates/skel/views/elements/email/text/default.ctp cake/console/libs/templates/skel/views/layouts/ajax.ctp cake/console/libs/templates/skel/views/layouts/default.ctp cake/console/libs/templates/skel/views/layouts/email/html/default.ctp cake/console/libs/templates/skel/views/layouts/email/text/default.ctp cake/console/libs/templates/skel/webroot/js/vendors.php cake/console/libs/templates/skel/webroot/test.php cake/console/libs/templates/views/form.ctp cake/console/libs/templates/views/index.ctp cake/console/libs/testsuite.php cake/console/templates/default/views/view.ctp cake/console/templates/skel/app_controller.php cake/console/templates/skel/app_helper.php cake/console/templates/skel/app_model.php cake/console/templates/skel/config/acl.ini.php cake/console/templates/skel/config/core.php cake/console/templates/skel/config/database.php.default cake/console/templates/skel/config/routes.php cake/console/templates/skel/config/schema/db_acl.php cake/console/templates/skel/config/schema/db_acl.sql cake/console/templates/skel/config/schema/i18n.php cake/console/templates/skel/config/schema/i18n.sql cake/console/templates/skel/config/schema/sessions.php cake/console/templates/skel/config/schema/sessions.sql cake/console/templates/skel/controllers/pages_controller.php cake/console/templates/skel/views/layouts/flash.ctp cake/console/templates/skel/webroot/css.php cake/console/templates/skel/webroot/css/cake.generic.css cake/console/templates/skel/webroot/index.php cake/dispatcher.php cake/libs/cache.php cake/libs/cache/apc.php cake/libs/cache/file.php cake/libs/cache/memcache.php cake/libs/cache/xcache.php cake/libs/cake_log.php cake/libs/cake_session.php cake/libs/cake_socket.php cake/libs/class_registry.php cake/libs/configure.php cake/libs/controller/app_controller.php cake/libs/controller/component.php cake/libs/controller/components/acl.php cake/libs/controller/components/auth.php cake/libs/controller/components/cookie.php cake/libs/controller/components/email.php cake/libs/controller/components/request_handler.php cake/libs/controller/components/security.php cake/libs/controller/components/session.php cake/libs/controller/controller.php cake/libs/controller/pages_controller.php cake/libs/controller/scaffold.php cake/libs/debugger.php cake/libs/error.php cake/libs/file.php cake/libs/flay.php cake/libs/folder.php cake/libs/http_socket.php cake/libs/i18n.php cake/libs/inflector.php cake/libs/l10n.php cake/libs/magic_db.php cake/libs/model/app_model.php cake/libs/model/behaviors/acl.php cake/libs/model/behaviors/containable.php cake/libs/model/behaviors/translate.php cake/libs/model/behaviors/tree.php cake/libs/model/cake_schema.php cake/libs/model/connection_manager.php cake/libs/model/datasources/datasource.php cake/libs/model/datasources/dbo/dbo_adodb.php cake/libs/model/datasources/dbo/dbo_db2.php cake/libs/model/datasources/dbo/dbo_firebird.php cake/libs/model/datasources/dbo/dbo_mssql.php cake/libs/model/datasources/dbo/dbo_mysql.php cake/libs/model/datasources/dbo/dbo_mysqli.php cake/libs/model/datasources/dbo/dbo_odbc.php cake/libs/model/datasources/dbo/dbo_oracle.php cake/libs/model/datasources/dbo/dbo_postgres.php cake/libs/model/datasources/dbo/dbo_sqlite.php cake/libs/model/datasources/dbo/dbo_sybase.php cake/libs/model/datasources/dbo_source.php cake/libs/model/db_acl.php cake/libs/model/model.php cake/libs/model/model_behavior.php cake/libs/multibyte.php cake/libs/object.php cake/libs/overloadable.php cake/libs/overloadable_php4.php cake/libs/overloadable_php5.php cake/libs/router.php cake/libs/sanitize.php cake/libs/security.php cake/libs/set.php cake/libs/string.php cake/libs/validation.php cake/libs/view/elements/dump.ctp cake/libs/view/elements/email/html/default.ctp cake/libs/view/elements/email/text/default.ctp cake/libs/view/errors/error404.ctp cake/libs/view/errors/missing_action.ctp cake/libs/view/errors/missing_component_class.ctp cake/libs/view/errors/missing_component_file.ctp cake/libs/view/errors/missing_connection.ctp cake/libs/view/errors/missing_controller.ctp cake/libs/view/errors/missing_helper_class.ctp cake/libs/view/errors/missing_helper_file.ctp cake/libs/view/errors/missing_layout.ctp cake/libs/view/errors/missing_model.ctp cake/libs/view/errors/missing_scaffolddb.ctp cake/libs/view/errors/missing_table.ctp cake/libs/view/errors/missing_view.ctp cake/libs/view/errors/private_action.ctp cake/libs/view/errors/scaffold_error.ctp cake/libs/view/helper.php cake/libs/view/helpers/ajax.php cake/libs/view/helpers/app_helper.php cake/libs/view/helpers/cache.php cake/libs/view/helpers/form.php cake/libs/view/helpers/html.php cake/libs/view/helpers/javascript.php cake/libs/view/helpers/js.php cake/libs/view/helpers/number.php cake/libs/view/helpers/paginator.php cake/libs/view/helpers/rss.php cake/libs/view/helpers/session.php cake/libs/view/helpers/text.php cake/libs/view/helpers/time.php cake/libs/view/helpers/xml.php cake/libs/view/layouts/ajax.ctp cake/libs/view/layouts/default.ctp cake/libs/view/layouts/email/html/default.ctp cake/libs/view/layouts/email/text/default.ctp cake/libs/view/layouts/flash.ctp cake/libs/view/media.php cake/libs/view/pages/home.ctp cake/libs/view/scaffolds/edit.ctp cake/libs/view/scaffolds/index.ctp cake/libs/view/scaffolds/view.ctp cake/libs/view/theme.php cake/libs/view/view.php cake/libs/xml.php cake/tests/cases/basics.test.php cake/tests/cases/console/cake.test.php cake/tests/cases/console/libs/acl.test.php cake/tests/cases/console/libs/api.test.php cake/tests/cases/console/libs/schema.test.php cake/tests/cases/console/libs/shell.test.php cake/tests/cases/console/libs/tasks/extract.test.php cake/tests/cases/console/libs/tasks/model.test.php cake/tests/cases/console/libs/tasks/test.test.php cake/tests/cases/dispatcher.test.php cake/tests/cases/libs/cache.test.php cake/tests/cases/libs/cache/apc.test.php cake/tests/cases/libs/cache/file.test.php cake/tests/cases/libs/cache/memcache.test.php cake/tests/cases/libs/cache/xcache.test.php cake/tests/cases/libs/cake_log.test.php cake/tests/cases/libs/cake_session.test.php cake/tests/cases/libs/cake_socket.test.php cake/tests/cases/libs/cake_test_case.test.php cake/tests/cases/libs/cake_test_fixture.test.php cake/tests/cases/libs/class_registry.test.php cake/tests/cases/libs/code_coverage_manager.test.php cake/tests/cases/libs/configure.test.php cake/tests/cases/libs/controller/component.test.php cake/tests/cases/libs/controller/components/acl.test.php cake/tests/cases/libs/controller/components/auth.test.php cake/tests/cases/libs/controller/components/cookie.test.php cake/tests/cases/libs/controller/components/email.test.php cake/tests/cases/libs/controller/components/request_handler.test.php cake/tests/cases/libs/controller/components/security.test.php cake/tests/cases/libs/controller/components/session.test.php cake/tests/cases/libs/controller/controller.test.php cake/tests/cases/libs/controller/controller_merge_vars.test.php cake/tests/cases/libs/controller/pages_controller.test.php cake/tests/cases/libs/controller/scaffold.test.php cake/tests/cases/libs/debugger.test.php cake/tests/cases/libs/error.test.php cake/tests/cases/libs/file.test.php cake/tests/cases/libs/flay.test.php cake/tests/cases/libs/folder.test.php cake/tests/cases/libs/http_socket.test.php cake/tests/cases/libs/i18n.test.php cake/tests/cases/libs/inflector.test.php cake/tests/cases/libs/l10n.test.php cake/tests/cases/libs/magic_db.test.php cake/tests/cases/libs/model/behaviors/acl.test.php cake/tests/cases/libs/model/behaviors/containable.test.php cake/tests/cases/libs/model/behaviors/translate.test.php cake/tests/cases/libs/model/behaviors/tree.test.php cake/tests/cases/libs/model/cake_schema.test.php cake/tests/cases/libs/model/connection_manager.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_adodb.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_mssql.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_oracle.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_sqlite.test.php cake/tests/cases/libs/model/datasources/dbo_source.test.php cake/tests/cases/libs/model/db_acl.test.php cake/tests/cases/libs/model/model.test.php cake/tests/cases/libs/model/model_behavior.test.php cake/tests/cases/libs/model/model_delete.test.php cake/tests/cases/libs/model/model_integration.test.php cake/tests/cases/libs/model/model_read.test.php cake/tests/cases/libs/model/model_validation.test.php cake/tests/cases/libs/model/model_write.test.php cake/tests/cases/libs/model/models.php cake/tests/cases/libs/multibyte.test.php cake/tests/cases/libs/object.test.php cake/tests/cases/libs/overloadable.test.php cake/tests/cases/libs/router.test.php cake/tests/cases/libs/sanitize.test.php cake/tests/cases/libs/security.test.php cake/tests/cases/libs/set.test.php cake/tests/cases/libs/string.test.php cake/tests/cases/libs/test_manager.test.php cake/tests/cases/libs/validation.test.php cake/tests/cases/libs/view/helper.test.php cake/tests/cases/libs/view/helpers/ajax.test.php cake/tests/cases/libs/view/helpers/cache.test.php cake/tests/cases/libs/view/helpers/form.test.php cake/tests/cases/libs/view/helpers/html.test.php cake/tests/cases/libs/view/helpers/javascript.test.php cake/tests/cases/libs/view/helpers/js.test.php cake/tests/cases/libs/view/helpers/number.test.php cake/tests/cases/libs/view/helpers/paginator.test.php cake/tests/cases/libs/view/helpers/rss.test.php cake/tests/cases/libs/view/helpers/session.test.php cake/tests/cases/libs/view/helpers/text.test.php cake/tests/cases/libs/view/helpers/time.test.php cake/tests/cases/libs/view/helpers/xml.test.php cake/tests/cases/libs/view/theme.test.php cake/tests/cases/libs/view/view.test.php cake/tests/cases/libs/xml.test.php cake/tests/fixtures/account_fixture.php cake/tests/fixtures/aco_action_fixture.php cake/tests/fixtures/aco_fixture.php cake/tests/fixtures/aco_two_fixture.php cake/tests/fixtures/advertisement_fixture.php cake/tests/fixtures/another_article_fixture.php cake/tests/fixtures/apple_fixture.php cake/tests/fixtures/aro_fixture.php cake/tests/fixtures/aro_two_fixture.php cake/tests/fixtures/aros_aco_fixture.php cake/tests/fixtures/aros_aco_two_fixture.php cake/tests/fixtures/article_featured_fixture.php cake/tests/fixtures/article_featureds_tags_fixture.php cake/tests/fixtures/article_fixture.php cake/tests/fixtures/articles_tag_fixture.php cake/tests/fixtures/attachment_fixture.php cake/tests/fixtures/auth_user_custom_field_fixture.php cake/tests/fixtures/auth_user_fixture.php cake/tests/fixtures/author_fixture.php cake/tests/fixtures/basket_fixture.php cake/tests/fixtures/bid_fixture.php cake/tests/fixtures/binary_test_fixture.php cake/tests/fixtures/book_fixture.php cake/tests/fixtures/cache_test_model_fixture.php cake/tests/fixtures/callback_fixture.php cake/tests/fixtures/category_fixture.php cake/tests/fixtures/category_thread_fixture.php cake/tests/fixtures/cd_fixture.php cake/tests/fixtures/comment_fixture.php cake/tests/fixtures/content_account_fixture.php cake/tests/fixtures/content_fixture.php cake/tests/fixtures/counter_cache_post_fixture.php cake/tests/fixtures/counter_cache_post_nonstandard_primary_key_fixture.php cake/tests/fixtures/counter_cache_user_fixture.php cake/tests/fixtures/counter_cache_user_nonstandard_primary_key_fixture.php cake/tests/fixtures/data_test_fixture.php cake/tests/fixtures/datatype_fixture.php cake/tests/fixtures/dependency_fixture.php cake/tests/fixtures/device_fixture.php cake/tests/fixtures/device_type_category_fixture.php cake/tests/fixtures/device_type_fixture.php cake/tests/fixtures/document_directory_fixture.php cake/tests/fixtures/document_fixture.php cake/tests/fixtures/exterior_type_category_fixture.php cake/tests/fixtures/feature_set_fixture.php cake/tests/fixtures/featured_fixture.php cake/tests/fixtures/film_file_fixture.php cake/tests/fixtures/flag_tree_fixture.php cake/tests/fixtures/fruit_fixture.php cake/tests/fixtures/fruits_uuid_tag_fixture.php cake/tests/fixtures/home_fixture.php cake/tests/fixtures/image_fixture.php cake/tests/fixtures/item_fixture.php cake/tests/fixtures/items_portfolio_fixture.php cake/tests/fixtures/join_a_b_fixture.php cake/tests/fixtures/join_a_c_fixture.php cake/tests/fixtures/join_a_fixture.php cake/tests/fixtures/join_b_fixture.php cake/tests/fixtures/join_c_fixture.php cake/tests/fixtures/join_thing_fixture.php cake/tests/fixtures/message_fixture.php cake/tests/fixtures/my_categories_my_products_fixture.php cake/tests/fixtures/my_categories_my_users_fixture.php cake/tests/fixtures/my_category_fixture.php cake/tests/fixtures/my_product_fixture.php cake/tests/fixtures/my_user_fixture.php cake/tests/fixtures/node_fixture.php cake/tests/fixtures/number_tree_fixture.php cake/tests/fixtures/number_tree_two_fixture.php cake/tests/fixtures/numeric_article_fixture.php cake/tests/fixtures/overall_favorite_fixture.php cake/tests/fixtures/person_fixture.php cake/tests/fixtures/portfolio_fixture.php cake/tests/fixtures/post_fixture.php cake/tests/fixtures/posts_tag_fixture.php cake/tests/fixtures/primary_model_fixture.php cake/tests/fixtures/product_fixture.php cake/tests/fixtures/project_fixture.php cake/tests/fixtures/sample_fixture.php cake/tests/fixtures/secondary_model_fixture.php cake/tests/fixtures/session_fixture.php cake/tests/fixtures/something_else_fixture.php cake/tests/fixtures/something_fixture.php cake/tests/fixtures/stories_tag_fixture.php cake/tests/fixtures/story_fixture.php cake/tests/fixtures/syfile_fixture.php cake/tests/fixtures/tag_fixture.php cake/tests/fixtures/test_plugin_article_fixture.php cake/tests/fixtures/test_plugin_comment_fixture.php cake/tests/fixtures/the_paper_monkies_fixture.php cake/tests/fixtures/thread_fixture.php cake/tests/fixtures/translate_article_fixture.php cake/tests/fixtures/translate_fixture.php cake/tests/fixtures/translate_table_fixture.php cake/tests/fixtures/translated_article_fixture.php cake/tests/fixtures/translated_item_fixture.php cake/tests/fixtures/unconventional_tree_fixture.php cake/tests/fixtures/underscore_field_fixture.php cake/tests/fixtures/user_fixture.php cake/tests/fixtures/uuid_fixture.php cake/tests/fixtures/uuid_tag_fixture.php cake/tests/fixtures/uuid_tree_fixture.php cake/tests/fixtures/uuiditem_fixture.php cake/tests/fixtures/uuiditems_uuidportfolio_fixture.php cake/tests/fixtures/uuiditems_uuidportfolio_numericid_fixture.php cake/tests/fixtures/uuidportfolio_fixture.php cake/tests/groups/acl.group.php cake/tests/groups/cache.group.php cake/tests/groups/components.group.php cake/tests/groups/configure.group.php cake/tests/groups/console.group.php cake/tests/groups/controller.group.php cake/tests/groups/database.group.php cake/tests/groups/helpers.group.php cake/tests/groups/lib.group.php cake/tests/groups/model.group.php cake/tests/groups/no_cross_contamination.group.php cake/tests/groups/routing_system.group.php cake/tests/groups/socket.group.php cake/tests/groups/test_suite.group.php cake/tests/groups/view.group.php cake/tests/groups/xml.group.php cake/tests/lib/cake_reporter.php cake/tests/lib/cake_test_case.php cake/tests/lib/cake_test_fixture.php cake/tests/lib/cake_test_model.php cake/tests/lib/cake_web_test_case.php cake/tests/lib/cli_reporter.php cake/tests/lib/code_coverage_manager.php cake/tests/lib/templates/footer.php cake/tests/lib/templates/header.php cake/tests/lib/templates/menu.php cake/tests/lib/templates/simpletest.php cake/tests/lib/test_manager.php cake/tests/lib/xdebug.php cake/tests/test_app/config/acl.ini.php cake/tests/test_app/controllers/tests_apps_controller.php cake/tests/test_app/controllers/tests_apps_posts_controller.php cake/tests/test_app/models/behaviors/persister_one_behavior.php cake/tests/test_app/models/behaviors/persister_two_behavior.php cake/tests/test_app/models/comment.php cake/tests/test_app/models/persister_one.php cake/tests/test_app/models/persister_two.php cake/tests/test_app/models/post.php cake/tests/test_app/plugins/test_plugin/controllers/components/other_component.php cake/tests/test_app/plugins/test_plugin/controllers/components/plugins_component.php cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_component.php cake/tests/test_app/plugins/test_plugin/controllers/components/test_plugin_other_component.php cake/tests/test_app/plugins/test_plugin/controllers/tests_controller.php cake/tests/test_app/plugins/test_plugin/models/test_plugin_post.php cake/tests/test_app/plugins/test_plugin/test_plugin_app_controller.php cake/tests/test_app/plugins/test_plugin/test_plugin_app_model.php cake/tests/test_app/plugins/test_plugin/vendors/sample/sample_plugin.php cake/tests/test_app/plugins/test_plugin/vendors/shells/example.php cake/tests/test_app/plugins/test_plugin/vendors/welcome.php cake/tests/test_app/plugins/test_plugin/views/helpers/other_helper.php cake/tests/test_app/plugins/test_plugin/views/helpers/plugged_helper.php cake/tests/test_app/plugins/test_plugin_two/vendors/shells/example.php cake/tests/test_app/plugins/test_plugin_two/vendors/shells/welcome.php cake/tests/test_app/vendors/Test/MyTest.php cake/tests/test_app/vendors/Test/hello.php cake/tests/test_app/vendors/sample/configure_test_vendor_sample.php cake/tests/test_app/vendors/shells/sample.php cake/tests/test_app/vendors/somename/some.name.php cake/tests/test_app/vendors/welcome.php cake/tests/test_app/views/elements/email/html/default.ctp cake/tests/test_app/views/elements/email/text/default.ctp cake/tests/test_app/views/elements/email/text/wide.ctp cake/tests/test_app/views/layouts/ajax.ctp cake/tests/test_app/views/layouts/ajax2.ctp cake/tests/test_app/views/layouts/cache_layout.ctp cake/tests/test_app/views/layouts/default.ctp cake/tests/test_app/views/layouts/email/html/default.ctp cake/tests/test_app/views/layouts/email/html/thin.ctp cake/tests/test_app/views/layouts/email/text/default.ctp cake/tests/test_app/views/layouts/flash.ctp cake/tests/test_app/views/layouts/multi_cache.ctp cake/tests/test_app/views/posts/sequencial_nocache.ctp cake/tests/test_app/views/posts/test_nocache_tags.ctp index.php
885 lines
No EOL
24 KiB
PHP
885 lines
No EOL
24 KiB
PHP
<?php
|
|
/**
|
|
* Backend for helpers.
|
|
*
|
|
* Internal methods for the Helpers.
|
|
*
|
|
* PHP versions 4 and 5
|
|
*
|
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
*
|
|
* Licensed under The MIT License
|
|
* Redistributions of files must retain the above copyright notice.
|
|
*
|
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
* @link http://cakephp.org CakePHP(tm) Project
|
|
* @package cake
|
|
* @subpackage cake.cake.libs.view
|
|
* @since CakePHP(tm) v 0.2.9
|
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
|
*/
|
|
|
|
/**
|
|
* Included libs
|
|
*/
|
|
App::import('Core', 'Overloadable');
|
|
|
|
/**
|
|
* Abstract base class for all other Helpers in CakePHP.
|
|
* Provides common methods and features.
|
|
*
|
|
* @package cake
|
|
* @subpackage cake.cake.libs.view
|
|
*/
|
|
class Helper extends Overloadable {
|
|
|
|
/**
|
|
* List of helpers used by this helper
|
|
*
|
|
* @var array
|
|
*/
|
|
var $helpers = null;
|
|
|
|
/**
|
|
* Base URL
|
|
*
|
|
* @var string
|
|
*/
|
|
var $base = null;
|
|
|
|
/**
|
|
* Webroot path
|
|
*
|
|
* @var string
|
|
*/
|
|
var $webroot = null;
|
|
|
|
/**
|
|
* The current theme name if any.
|
|
*
|
|
* @var string
|
|
*/
|
|
var $theme = null;
|
|
|
|
/**
|
|
* URL to current action.
|
|
*
|
|
* @var string
|
|
*/
|
|
var $here = null;
|
|
|
|
/**
|
|
* Parameter array.
|
|
*
|
|
* @var array
|
|
*/
|
|
var $params = array();
|
|
|
|
/**
|
|
* Current action.
|
|
*
|
|
* @var string
|
|
*/
|
|
var $action = null;
|
|
|
|
/**
|
|
* Plugin path
|
|
*
|
|
* @var string
|
|
*/
|
|
var $plugin = null;
|
|
|
|
/**
|
|
* POST data for models
|
|
*
|
|
* @var array
|
|
*/
|
|
var $data = null;
|
|
|
|
/**
|
|
* List of named arguments
|
|
*
|
|
* @var array
|
|
*/
|
|
var $namedArgs = null;
|
|
|
|
/**
|
|
* URL argument separator character
|
|
*
|
|
* @var string
|
|
*/
|
|
var $argSeparator = null;
|
|
|
|
/**
|
|
* Contains model validation errors of form post-backs
|
|
*
|
|
* @access public
|
|
* @var array
|
|
*/
|
|
var $validationErrors = null;
|
|
|
|
/**
|
|
* Holds tag templates.
|
|
*
|
|
* @access public
|
|
* @var array
|
|
*/
|
|
var $tags = array();
|
|
|
|
/**
|
|
* Holds the content to be cleaned.
|
|
*
|
|
* @access private
|
|
* @var mixed
|
|
*/
|
|
var $__tainted = null;
|
|
|
|
/**
|
|
* Holds the cleaned content.
|
|
*
|
|
* @access private
|
|
* @var mixed
|
|
*/
|
|
var $__cleaned = null;
|
|
|
|
/**
|
|
* Default overload methods
|
|
*
|
|
* @access protected
|
|
*/
|
|
function get__($name) {}
|
|
function set__($name, $value) {}
|
|
function call__($method, $params) {
|
|
trigger_error(sprintf(__('Method %1$s::%2$s does not exist', true), get_class($this), $method), E_USER_WARNING);
|
|
}
|
|
|
|
/**
|
|
* Parses tag templates into $this->tags.
|
|
*
|
|
* @param $name file name inside app/config to load.
|
|
* @return array merged tags from config/$name.php
|
|
* @access public
|
|
*/
|
|
function loadConfig($name = 'tags') {
|
|
if (file_exists(CONFIGS . $name .'.php')) {
|
|
require(CONFIGS . $name .'.php');
|
|
if (isset($tags)) {
|
|
$this->tags = array_merge($this->tags, $tags);
|
|
}
|
|
}
|
|
return $this->tags;
|
|
}
|
|
|
|
/**
|
|
* Finds URL for specified action.
|
|
*
|
|
* Returns a URL pointing at the provided parameters.
|
|
*
|
|
* @param mixed $url Either a relative string url like `/products/view/23` or
|
|
* an array of url parameters. Using an array for urls will allow you to leverage
|
|
* the reverse routing features of CakePHP.
|
|
* @param boolean $full If true, the full base URL will be prepended to the result
|
|
* @return string Full translated URL with base path.
|
|
* @access public
|
|
*/
|
|
function url($url = null, $full = false) {
|
|
return h(Router::url($url, $full));
|
|
}
|
|
|
|
/**
|
|
* Checks if a file exists when theme is used, if no file is found default location is returned
|
|
*
|
|
* @param string $file The file to create a webroot path to.
|
|
* @return string $webPath web path to file.
|
|
* @access public
|
|
*/
|
|
function webroot($file) {
|
|
$asset = explode('?', $file);
|
|
$asset[1] = isset($asset[1]) ? '?' . $asset[1] : null;
|
|
$webPath = "{$this->webroot}" . $asset[0];
|
|
$file = $asset[0];
|
|
|
|
if (!empty($this->theme)) {
|
|
$file = trim($file, '/');
|
|
$theme = $this->theme . '/';
|
|
|
|
if (DS === '\\') {
|
|
$file = str_replace('/', '\\', $file);
|
|
}
|
|
|
|
if (file_exists(Configure::read('App.www_root') . 'theme' . DS . $this->theme . DS . $file)) {
|
|
$webPath = "{$this->webroot}theme/" . $theme . $asset[0];
|
|
} else {
|
|
$viewPaths = App::path('views');
|
|
|
|
foreach ($viewPaths as $viewPath) {
|
|
$path = $viewPath . 'themed'. DS . $this->theme . DS . 'webroot' . DS . $file;
|
|
|
|
if (file_exists($path)) {
|
|
$webPath = "{$this->webroot}theme/" . $theme . $asset[0];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (strpos($webPath, '//') !== false) {
|
|
return str_replace('//', '/', $webPath);
|
|
}
|
|
return $webPath . $asset[1];
|
|
}
|
|
|
|
/**
|
|
* Adds a timestamp to a file based resource based on the value of `Asset.timestamp` in
|
|
* Configure. If Asset.timestamp is true and debug > 0, or Asset.timestamp == 'force'
|
|
* a timestamp will be added.
|
|
*
|
|
* @param string $path The file path to timestamp, the path must be inside WWW_ROOT
|
|
* @return string Path with a timestamp added, or not.
|
|
* @access public
|
|
*/
|
|
function assetTimestamp($path) {
|
|
$timestampEnabled = (
|
|
(Configure::read('Asset.timestamp') === true && Configure::read() > 0) ||
|
|
Configure::read('Asset.timestamp') === 'force'
|
|
);
|
|
if (strpos($path, '?') === false && $timestampEnabled) {
|
|
$path .= '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $path));
|
|
}
|
|
return $path;
|
|
}
|
|
|
|
/**
|
|
* Used to remove harmful tags from content
|
|
*
|
|
* @param mixed $output
|
|
* @return cleaned content for output
|
|
* @access public
|
|
*/
|
|
function clean($output) {
|
|
$this->__reset();
|
|
if (empty($output)) {
|
|
return null;
|
|
}
|
|
if (is_array($output)) {
|
|
foreach ($output as $key => $value) {
|
|
$return[$key] = $this->clean($value);
|
|
}
|
|
return $return;
|
|
}
|
|
$this->__tainted = $output;
|
|
$this->__clean();
|
|
return $this->__cleaned;
|
|
}
|
|
|
|
/**
|
|
* Returns a space-delimited string with items of the $options array. If a
|
|
* key of $options array happens to be one of:
|
|
*
|
|
* - 'compact'
|
|
* - 'checked'
|
|
* - 'declare'
|
|
* - 'readonly'
|
|
* - 'disabled'
|
|
* - 'selected'
|
|
* - 'defer'
|
|
* - 'ismap'
|
|
* - 'nohref'
|
|
* - 'noshade'
|
|
* - 'nowrap'
|
|
* - 'multiple'
|
|
* - 'noresize'
|
|
*
|
|
* And its value is one of:
|
|
*
|
|
* - 1
|
|
* - true
|
|
* - 'true'
|
|
*
|
|
* Then the value will be reset to be identical with key's name.
|
|
* If the value is not one of these 3, the parameter is not output.
|
|
*
|
|
* 'escape' is a special option in that it controls the conversion of
|
|
* attributes to their html-entity encoded equivalents. Set to false to disable html-encoding.
|
|
*
|
|
* @param array $options Array of options.
|
|
* @param array $exclude Array of options to be excluded, the options here will not be part of the return.
|
|
* @param string $insertBefore String to be inserted before options.
|
|
* @param string $insertAfter String to be inserted ater options.
|
|
* @return string Composed attributes.
|
|
* @access public
|
|
*/
|
|
function _parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) {
|
|
if (is_array($options)) {
|
|
$options = array_merge(array('escape' => true), $options);
|
|
|
|
if (!is_array($exclude)) {
|
|
$exclude = array();
|
|
}
|
|
$keys = array_diff(array_keys($options), array_merge($exclude, array('escape')));
|
|
$values = array_intersect_key(array_values($options), $keys);
|
|
$escape = $options['escape'];
|
|
$attributes = array();
|
|
|
|
foreach ($keys as $index => $key) {
|
|
$attributes[] = $this->__formatAttribute($key, $values[$index], $escape);
|
|
}
|
|
$out = implode(' ', $attributes);
|
|
} else {
|
|
$out = $options;
|
|
}
|
|
return $out ? $insertBefore . $out . $insertAfter : '';
|
|
}
|
|
|
|
/**
|
|
* Formats an individual attribute, and returns the string value of the composed attribute.
|
|
* Works with minimized attributes that have the same value as their name such as 'disabled' and 'checked'
|
|
*
|
|
* @param string $key The name of the attribute to create
|
|
* @param string $value The value of the attribute to create.
|
|
* @return string The composed attribute.
|
|
* @access private
|
|
*/
|
|
function __formatAttribute($key, $value, $escape = true) {
|
|
$attribute = '';
|
|
$attributeFormat = '%s="%s"';
|
|
$minimizedAttributes = array('compact', 'checked', 'declare', 'readonly', 'disabled',
|
|
'selected', 'defer', 'ismap', 'nohref', 'noshade', 'nowrap', 'multiple', 'noresize');
|
|
if (is_array($value)) {
|
|
$value = '';
|
|
}
|
|
|
|
if (in_array($key, $minimizedAttributes)) {
|
|
if ($value === 1 || $value === true || $value === 'true' || $value == $key) {
|
|
$attribute = sprintf($attributeFormat, $key, $key);
|
|
}
|
|
} else {
|
|
$attribute = sprintf($attributeFormat, $key, ($escape ? h($value) : $value));
|
|
}
|
|
return $attribute;
|
|
}
|
|
|
|
/**
|
|
* Sets this helper's model and field properties to the dot-separated value-pair in $entity.
|
|
*
|
|
* @param mixed $entity A field name, like "ModelName.fieldName" or "ModelName.ID.fieldName"
|
|
* @param boolean $setScope Sets the view scope to the model specified in $tagValue
|
|
* @return void
|
|
* @access public
|
|
*/
|
|
function setEntity($entity, $setScope = false) {
|
|
$view =& ClassRegistry::getObject('view');
|
|
|
|
if ($setScope) {
|
|
$view->modelScope = false;
|
|
} elseif (!empty($view->entityPath) && $view->entityPath == $entity) {
|
|
return;
|
|
}
|
|
|
|
if ($entity === null) {
|
|
$view->model = null;
|
|
$view->association = null;
|
|
$view->modelId = null;
|
|
$view->modelScope = false;
|
|
$view->entityPath = null;
|
|
return;
|
|
}
|
|
|
|
$view->entityPath = $entity;
|
|
$model = $view->model;
|
|
$sameScope = $hasField = false;
|
|
$parts = array_values(Set::filter(explode('.', $entity), true));
|
|
|
|
if (empty($parts)) {
|
|
return;
|
|
}
|
|
|
|
$count = count($parts);
|
|
if ($count === 1) {
|
|
$sameScope = true;
|
|
} else {
|
|
if (is_numeric($parts[0])) {
|
|
$sameScope = true;
|
|
}
|
|
$reverse = array_reverse($parts);
|
|
$field = array_shift($reverse);
|
|
while(!empty($reverse)) {
|
|
$subject = array_shift($reverse);
|
|
if (is_numeric($subject)) {
|
|
continue;
|
|
}
|
|
if (ClassRegistry::isKeySet($subject)) {
|
|
$model = $subject;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (ClassRegistry::isKeySet($model)) {
|
|
$ModelObj =& ClassRegistry::getObject($model);
|
|
for ($i = 0; $i < $count; $i++) {
|
|
if ($ModelObj->hasField($parts[$i]) || array_key_exists($parts[$i], $ModelObj->validate)) {
|
|
$hasField = $i;
|
|
if ($hasField === 0 || ($hasField === 1 && is_numeric($parts[0]))) {
|
|
$sameScope = true;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ($sameScope === true && in_array($parts[0], array_keys($ModelObj->hasAndBelongsToMany))) {
|
|
$sameScope = false;
|
|
}
|
|
}
|
|
|
|
if (!$view->association && $parts[0] == $view->field && $view->field != $view->model) {
|
|
array_unshift($parts, $model);
|
|
$hasField = true;
|
|
}
|
|
$view->field = $view->modelId = $view->fieldSuffix = $view->association = null;
|
|
|
|
switch (count($parts)) {
|
|
case 1:
|
|
if ($view->modelScope === false) {
|
|
$view->model = $parts[0];
|
|
} else {
|
|
$view->field = $parts[0];
|
|
if ($sameScope === false) {
|
|
$view->association = $parts[0];
|
|
}
|
|
}
|
|
break;
|
|
case 2:
|
|
if ($view->modelScope === false) {
|
|
list($view->model, $view->field) = $parts;
|
|
} elseif ($sameScope === true && $hasField === 0) {
|
|
list($view->field, $view->fieldSuffix) = $parts;
|
|
} elseif ($sameScope === true && $hasField === 1) {
|
|
list($view->modelId, $view->field) = $parts;
|
|
} else {
|
|
list($view->association, $view->field) = $parts;
|
|
}
|
|
break;
|
|
case 3:
|
|
if ($sameScope === true && $hasField === 1) {
|
|
list($view->modelId, $view->field, $view->fieldSuffix) = $parts;
|
|
} elseif ($hasField === 2) {
|
|
list($view->association, $view->modelId, $view->field) = $parts;
|
|
} else {
|
|
list($view->association, $view->field, $view->fieldSuffix) = $parts;
|
|
}
|
|
break;
|
|
case 4:
|
|
if ($parts[0] === $view->model) {
|
|
list($view->model, $view->modelId, $view->field, $view->fieldSuffix) = $parts;
|
|
} else {
|
|
list($view->association, $view->modelId, $view->field, $view->fieldSuffix) = $parts;
|
|
}
|
|
break;
|
|
default:
|
|
$reverse = array_reverse($parts);
|
|
|
|
if ($hasField) {
|
|
$view->field = $field;
|
|
if (!is_numeric($reverse[1]) && $reverse[1] != $model) {
|
|
$view->field = $reverse[1];
|
|
$view->fieldSuffix = $field;
|
|
}
|
|
}
|
|
if (is_numeric($parts[0])) {
|
|
$view->modelId = $parts[0];
|
|
} elseif ($view->model == $parts[0] && is_numeric($parts[1])) {
|
|
$view->modelId = $parts[1];
|
|
}
|
|
$view->association = $model;
|
|
break;
|
|
}
|
|
|
|
if (!isset($view->model) || empty($view->model)) {
|
|
$view->model = $view->association;
|
|
$view->association = null;
|
|
} elseif ($view->model === $view->association) {
|
|
$view->association = null;
|
|
}
|
|
|
|
if ($setScope) {
|
|
$view->modelScope = true;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Gets the currently-used model of the rendering context.
|
|
*
|
|
* @return string
|
|
* @access public
|
|
*/
|
|
function model() {
|
|
$view =& ClassRegistry::getObject('view');
|
|
if (!empty($view->association)) {
|
|
return $view->association;
|
|
} else {
|
|
return $view->model;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Gets the ID of the currently-used model of the rendering context.
|
|
*
|
|
* @return mixed
|
|
* @access public
|
|
*/
|
|
function modelID() {
|
|
$view =& ClassRegistry::getObject('view');
|
|
return $view->modelId;
|
|
}
|
|
|
|
/**
|
|
* Gets the currently-used model field of the rendering context.
|
|
*
|
|
* @return string
|
|
* @access public
|
|
*/
|
|
function field() {
|
|
$view =& ClassRegistry::getObject('view');
|
|
return $view->field;
|
|
}
|
|
|
|
/**
|
|
* Returns false if given FORM field has no errors. Otherwise it returns the constant set in
|
|
* the array Model->validationErrors.
|
|
*
|
|
* @param string $model Model name as a string
|
|
* @param string $field Fieldname as a string
|
|
* @param integer $modelID Unique index identifying this record within the form
|
|
* @return boolean True on errors.
|
|
*/
|
|
function tagIsInvalid($model = null, $field = null, $modelID = null) {
|
|
$view =& ClassRegistry::getObject('view');
|
|
$errors = $this->validationErrors;
|
|
$entity = $view->entity();
|
|
if (!empty($entity)) {
|
|
return Set::extract($errors, join('.', $entity));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Generates a DOM ID for the selected element, if one is not set.
|
|
* Uses the current View::entity() settings to generate a CamelCased id attribute.
|
|
*
|
|
* @param mixed $options Either an array of html attributes to add $id into, or a string
|
|
* with a view entity path to get a domId for.
|
|
* @param string $id The name of the 'id' attribute.
|
|
* @return mixed If $options was an array, an array will be returned with $id set. If a string
|
|
* was supplied, a string will be returned.
|
|
* @todo Refactor this method to not have as many input/output options.
|
|
*/
|
|
function domId($options = null, $id = 'id') {
|
|
$view =& ClassRegistry::getObject('view');
|
|
|
|
if (is_array($options) && array_key_exists($id, $options) && $options[$id] === null) {
|
|
unset($options[$id]);
|
|
return $options;
|
|
} elseif (!is_array($options) && $options !== null) {
|
|
$this->setEntity($options);
|
|
return $this->domId();
|
|
}
|
|
|
|
$entity = $view->entity();
|
|
$model = array_shift($entity);
|
|
$dom = $model . join('', array_map(array('Inflector', 'camelize'), $entity));
|
|
|
|
if (is_array($options) && !array_key_exists($id, $options)) {
|
|
$options[$id] = $dom;
|
|
} elseif ($options === null) {
|
|
return $dom;
|
|
}
|
|
return $options;
|
|
}
|
|
|
|
/**
|
|
* Gets the input field name for the current tag. Creates input name attributes
|
|
* using CakePHP's data[Model][field] formatting.
|
|
*
|
|
* @param mixed $options If an array, should be an array of attributes that $key needs to be added to.
|
|
* If a string or null, will be used as the View entity.
|
|
* @param string $field
|
|
* @param string $key The name of the attribute to be set, defaults to 'name'
|
|
* @return mixed If an array was given for $options, an array with $key set will be returned.
|
|
* If a string was supplied a string will be returned.
|
|
* @access protected
|
|
* @todo Refactor this method to not have as many input/output options.
|
|
*/
|
|
function _name($options = array(), $field = null, $key = 'name') {
|
|
$view =& ClassRegistry::getObject('view');
|
|
if ($options === null) {
|
|
$options = array();
|
|
} elseif (is_string($options)) {
|
|
$field = $options;
|
|
$options = 0;
|
|
}
|
|
|
|
if (!empty($field)) {
|
|
$this->setEntity($field);
|
|
}
|
|
|
|
if (is_array($options) && array_key_exists($key, $options)) {
|
|
return $options;
|
|
}
|
|
|
|
switch ($field) {
|
|
case '_method':
|
|
$name = $field;
|
|
break;
|
|
default:
|
|
$name = 'data[' . implode('][', $view->entity()) . ']';
|
|
break;
|
|
}
|
|
|
|
if (is_array($options)) {
|
|
$options[$key] = $name;
|
|
return $options;
|
|
} else {
|
|
return $name;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Gets the data for the current tag
|
|
*
|
|
* @param mixed $options If an array, should be an array of attributes that $key needs to be added to.
|
|
* If a string or null, will be used as the View entity.
|
|
* @param string $field
|
|
* @param string $key The name of the attribute to be set, defaults to 'value'
|
|
* @return mixed If an array was given for $options, an array with $key set will be returned.
|
|
* If a string was supplied a string will be returned.
|
|
* @access public
|
|
* @todo Refactor this method to not have as many input/output options.
|
|
*/
|
|
function value($options = array(), $field = null, $key = 'value') {
|
|
if ($options === null) {
|
|
$options = array();
|
|
} elseif (is_string($options)) {
|
|
$field = $options;
|
|
$options = 0;
|
|
}
|
|
|
|
if (is_array($options) && isset($options[$key])) {
|
|
return $options;
|
|
}
|
|
|
|
if (!empty($field)) {
|
|
$this->setEntity($field);
|
|
}
|
|
|
|
$view =& ClassRegistry::getObject('view');
|
|
$result = null;
|
|
|
|
$entity = $view->entity();
|
|
if (!empty($this->data) && !empty($entity)) {
|
|
$result = Set::extract($this->data, join('.', $entity));
|
|
}
|
|
|
|
$habtmKey = $this->field();
|
|
if (empty($result) && isset($this->data[$habtmKey][$habtmKey])) {
|
|
$result = $this->data[$habtmKey][$habtmKey];
|
|
} elseif (empty($result) && isset($this->data[$habtmKey]) && is_array($this->data[$habtmKey])) {
|
|
if (ClassRegistry::isKeySet($habtmKey)) {
|
|
$model =& ClassRegistry::getObject($habtmKey);
|
|
$result = $this->__selectedArray($this->data[$habtmKey], $model->primaryKey);
|
|
}
|
|
}
|
|
|
|
if (is_array($result)) {
|
|
if (array_key_exists($view->fieldSuffix, $result)) {
|
|
$result = $result[$view->fieldSuffix];
|
|
}
|
|
}
|
|
|
|
if (is_array($options)) {
|
|
if (empty($result) && isset($options['default'])) {
|
|
$result = $options['default'];
|
|
}
|
|
unset($options['default']);
|
|
}
|
|
|
|
if (is_array($options)) {
|
|
$options[$key] = $result;
|
|
return $options;
|
|
} else {
|
|
return $result;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Sets the defaults for an input tag. Will set the
|
|
* name, value, and id attributes for an array of html attributes. Will also
|
|
* add a 'form-error' class if the field contains validation errors.
|
|
*
|
|
* @param string $field The field name to initialize.
|
|
* @param array $options Array of options to use while initializing an input field.
|
|
* @return array Array options for the form input.
|
|
* @access protected
|
|
*/
|
|
function _initInputField($field, $options = array()) {
|
|
if ($field !== null) {
|
|
$this->setEntity($field);
|
|
}
|
|
$options = (array)$options;
|
|
$options = $this->_name($options);
|
|
$options = $this->value($options);
|
|
$options = $this->domId($options);
|
|
if ($this->tagIsInvalid()) {
|
|
$options = $this->addClass($options, 'form-error');
|
|
}
|
|
return $options;
|
|
}
|
|
|
|
/**
|
|
* Adds the given class to the element options
|
|
*
|
|
* @param array $options Array options/attributes to add a class to
|
|
* @param string $class The classname being added.
|
|
* @param string $key the key to use for class.
|
|
* @return array Array of options with $key set.
|
|
* @access public
|
|
*/
|
|
function addClass($options = array(), $class = null, $key = 'class') {
|
|
if (isset($options[$key]) && trim($options[$key]) != '') {
|
|
$options[$key] .= ' ' . $class;
|
|
} else {
|
|
$options[$key] = $class;
|
|
}
|
|
return $options;
|
|
}
|
|
|
|
/**
|
|
* Returns a string generated by a helper method
|
|
*
|
|
* This method can be overridden in subclasses to do generalized output post-processing
|
|
*
|
|
* @param string $str String to be output.
|
|
* @return string
|
|
* @deprecated This method will be removed in future versions.
|
|
*/
|
|
function output($str) {
|
|
return $str;
|
|
}
|
|
|
|
/**
|
|
* Before render callback. beforeRender is called before the view file is rendered.
|
|
*
|
|
* Overridden in subclasses.
|
|
*
|
|
* @return void
|
|
* @access public
|
|
*/
|
|
function beforeRender() {
|
|
}
|
|
|
|
/**
|
|
* After render callback. afterRender is called after the view file is rendered
|
|
* but before the layout has been rendered.
|
|
*
|
|
* Overridden in subclasses.
|
|
*
|
|
* @return void
|
|
* @access public
|
|
*/
|
|
function afterRender() {
|
|
}
|
|
|
|
/**
|
|
* Before layout callback. beforeLayout is called before the layout is rendered.
|
|
*
|
|
* Overridden in subclasses.
|
|
*
|
|
* @return void
|
|
* @access public
|
|
*/
|
|
function beforeLayout() {
|
|
}
|
|
|
|
/**
|
|
* After layout callback. afterLayout is called after the layout has rendered.
|
|
*
|
|
* Overridden in subclasses.
|
|
*
|
|
* @return void
|
|
* @access public
|
|
*/
|
|
function afterLayout() {
|
|
}
|
|
|
|
/**
|
|
* Transforms a recordset from a hasAndBelongsToMany association to a list of selected
|
|
* options for a multiple select element
|
|
*
|
|
* @param mixed $data
|
|
* @param string $key
|
|
* @return array
|
|
* @access private
|
|
*/
|
|
function __selectedArray($data, $key = 'id') {
|
|
if (!is_array($data)) {
|
|
$model = $data;
|
|
if (!empty($this->data[$model][$model])) {
|
|
return $this->data[$model][$model];
|
|
}
|
|
if (!empty($this->data[$model])) {
|
|
$data = $this->data[$model];
|
|
}
|
|
}
|
|
$array = array();
|
|
if (!empty($data)) {
|
|
foreach ($data as $var) {
|
|
$array[$var[$key]] = $var[$key];
|
|
}
|
|
}
|
|
return $array;
|
|
}
|
|
|
|
/**
|
|
* Resets the vars used by Helper::clean() to null
|
|
*
|
|
* @return void
|
|
* @access private
|
|
*/
|
|
function __reset() {
|
|
$this->__tainted = null;
|
|
$this->__cleaned = null;
|
|
}
|
|
|
|
/**
|
|
* Removes harmful content from output
|
|
*
|
|
* @return void
|
|
* @access private
|
|
*/
|
|
function __clean() {
|
|
if (get_magic_quotes_gpc()) {
|
|
$this->__cleaned = stripslashes($this->__tainted);
|
|
} else {
|
|
$this->__cleaned = $this->__tainted;
|
|
}
|
|
|
|
$this->__cleaned = str_replace(array("&", "<", ">"), array("&amp;", "&lt;", "&gt;"), $this->__cleaned);
|
|
$this->__cleaned = preg_replace('#(&\#*\w+)[\x00-\x20]+;#u', "$1;", $this->__cleaned);
|
|
$this->__cleaned = preg_replace('#(&\#x*)([0-9A-F]+);*#iu', "$1$2;", $this->__cleaned);
|
|
$this->__cleaned = html_entity_decode($this->__cleaned, ENT_COMPAT, "UTF-8");
|
|
$this->__cleaned = preg_replace('#(<[^>]+[\x00-\x20\"\'\/])(on|xmlns)[^>]*>#iUu', "$1>", $this->__cleaned);
|
|
$this->__cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*)[\\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2nojavascript...', $this->__cleaned);
|
|
$this->__cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=([\'\"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2novbscript...', $this->__cleaned);
|
|
$this->__cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=*([\'\"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#iUu','$1=$2nomozbinding...', $this->__cleaned);
|
|
$this->__cleaned = preg_replace('#([a-z]*)[\x00-\x20]*=([\'\"]*)[\x00-\x20]*data[\x00-\x20]*:#Uu', '$1=$2nodata...', $this->__cleaned);
|
|
$this->__cleaned = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*expression[\x00-\x20]*\([^>]*>#iU', "$1>", $this->__cleaned);
|
|
$this->__cleaned = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*behaviour[\x00-\x20]*\([^>]*>#iU', "$1>", $this->__cleaned);
|
|
$this->__cleaned = preg_replace('#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*>#iUu', "$1>", $this->__cleaned);
|
|
$this->__cleaned = preg_replace('#</*\w+:\w[^>]*>#i', "", $this->__cleaned);
|
|
do {
|
|
$oldstring = $this->__cleaned;
|
|
$this->__cleaned = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i', "", $this->__cleaned);
|
|
} while ($oldstring != $this->__cleaned);
|
|
$this->__cleaned = str_replace(array("&", "<", ">"), array("&amp;", "&lt;", "&gt;"), $this->__cleaned);
|
|
}
|
|
}
|
|
?>
|