diff --git a/composer.lock b/composer.lock index 4459dad30..fee986171 100644 --- a/composer.lock +++ b/composer.lock @@ -2393,23 +2393,23 @@ }, { "name": "drupal/drupal", - "version": "7.94.0", + "version": "7.95.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/drupal.git", - "reference": "7.94" + "reference": "7.95" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/drupal-7.94.zip", - "reference": "7.94", - "shasum": "4d732bbf9b50a5076e8c353cd77d1a4e879d94a4" + "url": "https://ftp.drupal.org/files/projects/drupal-7.95.zip", + "reference": "7.95", + "shasum": "f84efd3b32dc1fe66749750bf1d6cf09e59f9cba" }, "type": "drupal-core", "extra": { "drupal": { - "version": "7.94", - "datestamp": "1671034684", + "version": "7.95", + "datestamp": "1678902947", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -2911,17 +2911,17 @@ }, { "name": "drupal/entityreference", - "version": "1.6.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/entityreference.git", - "reference": "7.x-1.6" + "reference": "7.x-1.7" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/entityreference-7.x-1.6.zip", - "reference": "7.x-1.6", - "shasum": "066a5760c2e6c3c04f06ccdb1b69264f645ba4f0" + "url": "https://ftp.drupal.org/files/projects/entityreference-7.x-1.7.zip", + "reference": "7.x-1.7", + "shasum": "de2a655ebb2dd2a1588a16c7d7ea7a6fce97918a" }, "require": { "drupal/ctools": "*", @@ -2935,8 +2935,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "7.x-1.6", - "datestamp": "1676069762", + "version": "7.x-1.7", + "datestamp": "1678809340", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -10169,17 +10169,17 @@ }, { "name": "drupal/views", - "version": "3.28.0", + "version": "3.29.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/views.git", - "reference": "7.x-3.28" + "reference": "7.x-3.29" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/views-7.x-3.28.zip", - "reference": "7.x-3.28", - "shasum": "7466904eed5892f881832a9f89fd6ecf4b41b029" + "url": "https://ftp.drupal.org/files/projects/views-7.x-3.29.zip", + "reference": "7.x-3.29", + "shasum": "4fc548a8f5252993d5edba557e2aa77ba0fe5b3b" }, "require": { "drupal/ctools": "*", @@ -10188,8 +10188,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "7.x-3.28", - "datestamp": "1671451977", + "version": "7.x-3.29", + "datestamp": "1678722009", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -13131,16 +13131,16 @@ }, { "name": "sirbrillig/phpcs-variable-analysis", - "version": "v2.11.10", + "version": "v2.11.12", "source": { "type": "git", "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "0f25a3766f26df91d6bdda0c8931303fc85499d7" + "reference": "d8a00fb972b9317ef4decf66725a25e712cc4cbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/0f25a3766f26df91d6bdda0c8931303fc85499d7", - "reference": "0f25a3766f26df91d6bdda0c8931303fc85499d7", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/d8a00fb972b9317ef4decf66725a25e712cc4cbe", + "reference": "d8a00fb972b9317ef4decf66725a25e712cc4cbe", "shasum": "" }, "require": { @@ -13185,7 +13185,7 @@ "source": "https://github.com/sirbrillig/phpcs-variable-analysis", "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" }, - "time": "2023-01-05T18:45:16+00:00" + "time": "2023-03-13T14:54:42+00:00" }, { "name": "slevomat/coding-standard", diff --git a/html/CHANGELOG.txt b/html/CHANGELOG.txt index 2844995d6..028179509 100644 --- a/html/CHANGELOG.txt +++ b/html/CHANGELOG.txt @@ -1,3 +1,8 @@ +Drupal 7.95, 2023-03-15 +----------------------- +- Fixed security issues: + - SA-CORE-2023-004 + Drupal 7.94, 2022-12-14 ----------------------- - Hotfix for book.module and Select query properties diff --git a/html/includes/bootstrap.inc b/html/includes/bootstrap.inc index 30d58744e..980ad3599 100644 --- a/html/includes/bootstrap.inc +++ b/html/includes/bootstrap.inc @@ -8,7 +8,7 @@ /** * The current system version. */ -define('VERSION', '7.94'); +define('VERSION', '7.95'); /** * Core API compatibility. diff --git a/html/modules/aggregator/aggregator.info b/html/modules/aggregator/aggregator.info index 59f3c30bb..b76ed74da 100644 --- a/html/modules/aggregator/aggregator.info +++ b/html/modules/aggregator/aggregator.info @@ -7,7 +7,7 @@ files[] = aggregator.test configure = admin/config/services/aggregator/settings stylesheets[all][] = aggregator.css -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/aggregator/tests/aggregator_test.info b/html/modules/aggregator/tests/aggregator_test.info index 99b07741f..a44dd7e85 100644 --- a/html/modules/aggregator/tests/aggregator_test.info +++ b/html/modules/aggregator/tests/aggregator_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/block/block.info b/html/modules/block/block.info index 0ae08cc04..fc066e0d2 100644 --- a/html/modules/block/block.info +++ b/html/modules/block/block.info @@ -6,7 +6,7 @@ core = 7.x files[] = block.test configure = admin/structure/block -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/block/tests/block_test.info b/html/modules/block/tests/block_test.info index 85ddd8b64..e9c3c6166 100644 --- a/html/modules/block/tests/block_test.info +++ b/html/modules/block/tests/block_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/block/tests/themes/block_test_theme/block_test_theme.info b/html/modules/block/tests/themes/block_test_theme/block_test_theme.info index 2aaf700fc..804e42e4d 100644 --- a/html/modules/block/tests/themes/block_test_theme/block_test_theme.info +++ b/html/modules/block/tests/themes/block_test_theme/block_test_theme.info @@ -13,7 +13,7 @@ regions[footer] = Footer regions[highlighted] = Highlighted regions[help] = Help -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/blog/blog.info b/html/modules/blog/blog.info index 043d8ab1b..2961b51d2 100644 --- a/html/modules/blog/blog.info +++ b/html/modules/blog/blog.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x files[] = blog.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/book/book.info b/html/modules/book/book.info index 938fc8ef4..58805e918 100644 --- a/html/modules/book/book.info +++ b/html/modules/book/book.info @@ -7,7 +7,7 @@ files[] = book.test configure = admin/content/book/settings stylesheets[all][] = book.css -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/color/color.info b/html/modules/color/color.info index f6748435f..fd3bf9c28 100644 --- a/html/modules/color/color.info +++ b/html/modules/color/color.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x files[] = color.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/comment/comment.info b/html/modules/comment/comment.info index f6c0f4702..98e3ede15 100644 --- a/html/modules/comment/comment.info +++ b/html/modules/comment/comment.info @@ -9,7 +9,7 @@ files[] = comment.test configure = admin/content/comment stylesheets[all][] = comment.css -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/comment/tests/comment_hook_test.info b/html/modules/comment/tests/comment_hook_test.info index 225015ca8..46411de50 100644 --- a/html/modules/comment/tests/comment_hook_test.info +++ b/html/modules/comment/tests/comment_hook_test.info @@ -5,7 +5,7 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/contact/contact.info b/html/modules/contact/contact.info index c9e09774c..e2b0c3bab 100644 --- a/html/modules/contact/contact.info +++ b/html/modules/contact/contact.info @@ -6,7 +6,7 @@ core = 7.x files[] = contact.test configure = admin/structure/contact -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/contextual/contextual.info b/html/modules/contextual/contextual.info index 66a542e27..202bbfa33 100644 --- a/html/modules/contextual/contextual.info +++ b/html/modules/contextual/contextual.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x files[] = contextual.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/dashboard/dashboard.info b/html/modules/dashboard/dashboard.info index ce1dae6a9..fe89ed22a 100644 --- a/html/modules/dashboard/dashboard.info +++ b/html/modules/dashboard/dashboard.info @@ -7,7 +7,7 @@ files[] = dashboard.test dependencies[] = block configure = admin/dashboard/customize -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/dblog/dblog.info b/html/modules/dblog/dblog.info index 2bea5e804..fa63cfe07 100644 --- a/html/modules/dblog/dblog.info +++ b/html/modules/dblog/dblog.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x files[] = dblog.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/field/field.info b/html/modules/field/field.info index a1be592db..e260084f4 100644 --- a/html/modules/field/field.info +++ b/html/modules/field/field.info @@ -11,7 +11,7 @@ dependencies[] = field_sql_storage required = TRUE stylesheets[all][] = theme/field.css -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/field/modules/field_sql_storage/field_sql_storage.info b/html/modules/field/modules/field_sql_storage/field_sql_storage.info index 1d4036097..c295748cb 100644 --- a/html/modules/field/modules/field_sql_storage/field_sql_storage.info +++ b/html/modules/field/modules/field_sql_storage/field_sql_storage.info @@ -7,7 +7,7 @@ dependencies[] = field files[] = field_sql_storage.test required = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/field/modules/list/list.info b/html/modules/field/modules/list/list.info index 95621e061..c9e1e3e6a 100644 --- a/html/modules/field/modules/list/list.info +++ b/html/modules/field/modules/list/list.info @@ -7,7 +7,7 @@ dependencies[] = field dependencies[] = options files[] = tests/list.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/field/modules/list/tests/list_test.info b/html/modules/field/modules/list/tests/list_test.info index f95d5b400..2ecea39da 100644 --- a/html/modules/field/modules/list/tests/list_test.info +++ b/html/modules/field/modules/list/tests/list_test.info @@ -5,7 +5,7 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/field/modules/number/number.info b/html/modules/field/modules/number/number.info index 3f7078ccb..edea52c66 100644 --- a/html/modules/field/modules/number/number.info +++ b/html/modules/field/modules/number/number.info @@ -6,7 +6,7 @@ core = 7.x dependencies[] = field files[] = number.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/field/modules/options/options.info b/html/modules/field/modules/options/options.info index 25ee9aa28..33d6bbe48 100644 --- a/html/modules/field/modules/options/options.info +++ b/html/modules/field/modules/options/options.info @@ -6,7 +6,7 @@ core = 7.x dependencies[] = field files[] = options.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/field/modules/text/text.info b/html/modules/field/modules/text/text.info index 4c9aa925d..08602fa84 100644 --- a/html/modules/field/modules/text/text.info +++ b/html/modules/field/modules/text/text.info @@ -7,7 +7,7 @@ dependencies[] = field files[] = text.test required = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/field/tests/field_test.info b/html/modules/field/tests/field_test.info index adfbebaaf..039df6b41 100644 --- a/html/modules/field/tests/field_test.info +++ b/html/modules/field/tests/field_test.info @@ -6,7 +6,7 @@ files[] = field_test.entity.inc version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/field_ui/field_ui.info b/html/modules/field_ui/field_ui.info index f17b3c3ff..ebbcee9d5 100644 --- a/html/modules/field_ui/field_ui.info +++ b/html/modules/field_ui/field_ui.info @@ -6,7 +6,7 @@ core = 7.x dependencies[] = field files[] = field_ui.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/file/file.info b/html/modules/file/file.info index 0bf5f28be..7bea3557f 100644 --- a/html/modules/file/file.info +++ b/html/modules/file/file.info @@ -6,7 +6,7 @@ core = 7.x dependencies[] = field files[] = tests/file.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/file/tests/file_module_test.info b/html/modules/file/tests/file_module_test.info index fa355f9ed..8ef0a2830 100644 --- a/html/modules/file/tests/file_module_test.info +++ b/html/modules/file/tests/file_module_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/filter/filter.info b/html/modules/filter/filter.info index c00b8f8c0..8f1e4bf34 100644 --- a/html/modules/filter/filter.info +++ b/html/modules/filter/filter.info @@ -7,7 +7,7 @@ files[] = filter.test required = TRUE configure = admin/config/content/formats -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/forum/forum.info b/html/modules/forum/forum.info index d1f2cf86a..47825f414 100644 --- a/html/modules/forum/forum.info +++ b/html/modules/forum/forum.info @@ -9,7 +9,7 @@ files[] = forum.test configure = admin/structure/forum stylesheets[all][] = forum.css -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/help/help.info b/html/modules/help/help.info index 7e3542c1d..7e191a18f 100644 --- a/html/modules/help/help.info +++ b/html/modules/help/help.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x files[] = help.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/image/image.info b/html/modules/image/image.info index 4846e1afa..474e06e10 100644 --- a/html/modules/image/image.info +++ b/html/modules/image/image.info @@ -7,7 +7,7 @@ dependencies[] = file files[] = image.test configure = admin/config/media/image-styles -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/image/tests/image_module_styles_test.info b/html/modules/image/tests/image_module_styles_test.info index d1155b4bc..f4aab0364 100644 --- a/html/modules/image/tests/image_module_styles_test.info +++ b/html/modules/image/tests/image_module_styles_test.info @@ -7,7 +7,7 @@ files[] = image_module_styles_test.module dependencies[] = image_module_test hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/image/tests/image_module_test.info b/html/modules/image/tests/image_module_test.info index f86bae751..8c6e9320d 100644 --- a/html/modules/image/tests/image_module_test.info +++ b/html/modules/image/tests/image_module_test.info @@ -6,7 +6,7 @@ core = 7.x files[] = image_module_test.module hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/locale/locale.info b/html/modules/locale/locale.info index ae782230d..4056b2b9f 100644 --- a/html/modules/locale/locale.info +++ b/html/modules/locale/locale.info @@ -6,7 +6,7 @@ core = 7.x files[] = locale.test configure = admin/config/regional/language -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/locale/tests/locale_test.info b/html/modules/locale/tests/locale_test.info index f2fbdbe67..127b22a4a 100644 --- a/html/modules/locale/tests/locale_test.info +++ b/html/modules/locale/tests/locale_test.info @@ -5,7 +5,7 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/menu/menu.info b/html/modules/menu/menu.info index 11e9c4dd7..af4880ce9 100644 --- a/html/modules/menu/menu.info +++ b/html/modules/menu/menu.info @@ -6,7 +6,7 @@ core = 7.x files[] = menu.test configure = admin/structure/menu -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/node/node.info b/html/modules/node/node.info index ad74aac91..8e263efa0 100644 --- a/html/modules/node/node.info +++ b/html/modules/node/node.info @@ -9,7 +9,7 @@ required = TRUE configure = admin/structure/types stylesheets[all][] = node.css -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/node/tests/node_access_test.info b/html/modules/node/tests/node_access_test.info index f68651cf2..d0c1ad72e 100644 --- a/html/modules/node/tests/node_access_test.info +++ b/html/modules/node/tests/node_access_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/node/tests/node_test.info b/html/modules/node/tests/node_test.info index 2f589b153..726d12d69 100644 --- a/html/modules/node/tests/node_test.info +++ b/html/modules/node/tests/node_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/node/tests/node_test_exception.info b/html/modules/node/tests/node_test_exception.info index 39e8dc002..7678d8fc4 100644 --- a/html/modules/node/tests/node_test_exception.info +++ b/html/modules/node/tests/node_test_exception.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/openid/openid.info b/html/modules/openid/openid.info index 41fddac95..d3d847175 100644 --- a/html/modules/openid/openid.info +++ b/html/modules/openid/openid.info @@ -5,7 +5,7 @@ package = Core core = 7.x files[] = openid.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/openid/tests/openid_test.info b/html/modules/openid/tests/openid_test.info index c962383d7..560682c24 100644 --- a/html/modules/openid/tests/openid_test.info +++ b/html/modules/openid/tests/openid_test.info @@ -6,7 +6,7 @@ core = 7.x dependencies[] = openid hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/overlay/overlay.info b/html/modules/overlay/overlay.info index 7205a0752..52e7c4cd5 100644 --- a/html/modules/overlay/overlay.info +++ b/html/modules/overlay/overlay.info @@ -4,7 +4,7 @@ package = Core version = VERSION core = 7.x -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/path/path.info b/html/modules/path/path.info index 095e3b50e..f7f3770de 100644 --- a/html/modules/path/path.info +++ b/html/modules/path/path.info @@ -6,7 +6,7 @@ core = 7.x files[] = path.test configure = admin/config/search/path -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/php/php.info b/html/modules/php/php.info index 4d4add735..0b0cd4fa3 100644 --- a/html/modules/php/php.info +++ b/html/modules/php/php.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x files[] = php.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/poll/poll.info b/html/modules/poll/poll.info index f9dddcc74..cffaa608f 100644 --- a/html/modules/poll/poll.info +++ b/html/modules/poll/poll.info @@ -6,7 +6,7 @@ core = 7.x files[] = poll.test stylesheets[all][] = poll.css -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/profile/profile.info b/html/modules/profile/profile.info index 34d3e5303..1fd26ee54 100644 --- a/html/modules/profile/profile.info +++ b/html/modules/profile/profile.info @@ -11,7 +11,7 @@ configure = admin/config/people/profile ; See user_system_info_alter(). hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/rdf/rdf.info b/html/modules/rdf/rdf.info index d0b486e36..fea3b5572 100644 --- a/html/modules/rdf/rdf.info +++ b/html/modules/rdf/rdf.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x files[] = rdf.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/rdf/tests/rdf_test.info b/html/modules/rdf/tests/rdf_test.info index 902a59a3b..8512a2510 100644 --- a/html/modules/rdf/tests/rdf_test.info +++ b/html/modules/rdf/tests/rdf_test.info @@ -6,7 +6,7 @@ core = 7.x hidden = TRUE dependencies[] = blog -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/search/search.info b/html/modules/search/search.info index a8d510372..511eca54e 100644 --- a/html/modules/search/search.info +++ b/html/modules/search/search.info @@ -8,7 +8,7 @@ files[] = search.test configure = admin/config/search/settings stylesheets[all][] = search.css -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/search/tests/search_embedded_form.info b/html/modules/search/tests/search_embedded_form.info index 7a79b8db3..2b1628457 100644 --- a/html/modules/search/tests/search_embedded_form.info +++ b/html/modules/search/tests/search_embedded_form.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/search/tests/search_extra_type.info b/html/modules/search/tests/search_extra_type.info index 5e551759c..d5a6986f2 100644 --- a/html/modules/search/tests/search_extra_type.info +++ b/html/modules/search/tests/search_extra_type.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/search/tests/search_node_tags.info b/html/modules/search/tests/search_node_tags.info index d61aaeb0b..b02cb9a89 100644 --- a/html/modules/search/tests/search_node_tags.info +++ b/html/modules/search/tests/search_node_tags.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/shortcut/shortcut.info b/html/modules/shortcut/shortcut.info index 3700460cb..f06e84d63 100644 --- a/html/modules/shortcut/shortcut.info +++ b/html/modules/shortcut/shortcut.info @@ -6,7 +6,7 @@ core = 7.x files[] = shortcut.test configure = admin/config/user-interface/shortcut -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/simpletest.info b/html/modules/simpletest/simpletest.info index ab3a76dec..2fdd08f2c 100644 --- a/html/modules/simpletest/simpletest.info +++ b/html/modules/simpletest/simpletest.info @@ -58,7 +58,7 @@ files[] = tests/upgrade/update.trigger.test files[] = tests/upgrade/update.field.test files[] = tests/upgrade/update.user.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/actions_loop_test.info b/html/modules/simpletest/tests/actions_loop_test.info index 3e0703cfd..1fc191af0 100644 --- a/html/modules/simpletest/tests/actions_loop_test.info +++ b/html/modules/simpletest/tests/actions_loop_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/ajax_forms_test.info b/html/modules/simpletest/tests/ajax_forms_test.info index 124c386c3..9a9e28c25 100644 --- a/html/modules/simpletest/tests/ajax_forms_test.info +++ b/html/modules/simpletest/tests/ajax_forms_test.info @@ -5,7 +5,7 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/ajax_test.info b/html/modules/simpletest/tests/ajax_test.info index b905bfb4f..847cd7332 100644 --- a/html/modules/simpletest/tests/ajax_test.info +++ b/html/modules/simpletest/tests/ajax_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/batch_test.info b/html/modules/simpletest/tests/batch_test.info index 720926b08..fe2406fa0 100644 --- a/html/modules/simpletest/tests/batch_test.info +++ b/html/modules/simpletest/tests/batch_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/boot_test_1.info b/html/modules/simpletest/tests/boot_test_1.info index bdcad136d..6b6ea6295 100644 --- a/html/modules/simpletest/tests/boot_test_1.info +++ b/html/modules/simpletest/tests/boot_test_1.info @@ -5,7 +5,7 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/boot_test_2.info b/html/modules/simpletest/tests/boot_test_2.info index e6f88395c..5ffcb3a7b 100644 --- a/html/modules/simpletest/tests/boot_test_2.info +++ b/html/modules/simpletest/tests/boot_test_2.info @@ -5,7 +5,7 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/common_test.info b/html/modules/simpletest/tests/common_test.info index 8fdef6350..559f97b34 100644 --- a/html/modules/simpletest/tests/common_test.info +++ b/html/modules/simpletest/tests/common_test.info @@ -7,7 +7,7 @@ stylesheets[all][] = common_test.css stylesheets[print][] = common_test.print.css hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/common_test_cron_helper.info b/html/modules/simpletest/tests/common_test_cron_helper.info index cd23b2124..7122c7e29 100644 --- a/html/modules/simpletest/tests/common_test_cron_helper.info +++ b/html/modules/simpletest/tests/common_test_cron_helper.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/database_test.info b/html/modules/simpletest/tests/database_test.info index 0a70e0773..551a0f613 100644 --- a/html/modules/simpletest/tests/database_test.info +++ b/html/modules/simpletest/tests/database_test.info @@ -5,7 +5,7 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/drupal_autoload_test/drupal_autoload_test.info b/html/modules/simpletest/tests/drupal_autoload_test/drupal_autoload_test.info index dfaea9d93..2841f7c65 100644 --- a/html/modules/simpletest/tests/drupal_autoload_test/drupal_autoload_test.info +++ b/html/modules/simpletest/tests/drupal_autoload_test/drupal_autoload_test.info @@ -7,7 +7,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info b/html/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info index 7b3586f71..a65771ff0 100644 --- a/html/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info +++ b/html/modules/simpletest/tests/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info b/html/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info index fc2043909..c1e883ca9 100644 --- a/html/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info +++ b/html/modules/simpletest/tests/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/entity_cache_test.info b/html/modules/simpletest/tests/entity_cache_test.info index f07a4f0b7..5b4849ee9 100644 --- a/html/modules/simpletest/tests/entity_cache_test.info +++ b/html/modules/simpletest/tests/entity_cache_test.info @@ -6,7 +6,7 @@ core = 7.x dependencies[] = entity_cache_test_dependency hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/entity_cache_test_dependency.info b/html/modules/simpletest/tests/entity_cache_test_dependency.info index 7134e72c2..7cde0ea0a 100644 --- a/html/modules/simpletest/tests/entity_cache_test_dependency.info +++ b/html/modules/simpletest/tests/entity_cache_test_dependency.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/entity_crud_hook_test.info b/html/modules/simpletest/tests/entity_crud_hook_test.info index 38c502aad..8afdb5f82 100644 --- a/html/modules/simpletest/tests/entity_crud_hook_test.info +++ b/html/modules/simpletest/tests/entity_crud_hook_test.info @@ -5,7 +5,7 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/entity_query_access_test.info b/html/modules/simpletest/tests/entity_query_access_test.info index 4dfc595e3..395559fff 100644 --- a/html/modules/simpletest/tests/entity_query_access_test.info +++ b/html/modules/simpletest/tests/entity_query_access_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/error_test.info b/html/modules/simpletest/tests/error_test.info index b50fd2274..a7f8ff8f2 100644 --- a/html/modules/simpletest/tests/error_test.info +++ b/html/modules/simpletest/tests/error_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/file_test.info b/html/modules/simpletest/tests/file_test.info index cb7e5342e..13a8bf6d9 100644 --- a/html/modules/simpletest/tests/file_test.info +++ b/html/modules/simpletest/tests/file_test.info @@ -6,7 +6,7 @@ core = 7.x files[] = file_test.module hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/filter_test.info b/html/modules/simpletest/tests/filter_test.info index ef51effd2..fd93e8ae9 100644 --- a/html/modules/simpletest/tests/filter_test.info +++ b/html/modules/simpletest/tests/filter_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/form_test.info b/html/modules/simpletest/tests/form_test.info index 5e9d9e963..7c339e26c 100644 --- a/html/modules/simpletest/tests/form_test.info +++ b/html/modules/simpletest/tests/form_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/image_test.info b/html/modules/simpletest/tests/image_test.info index d6126095d..60b47ddaa 100644 --- a/html/modules/simpletest/tests/image_test.info +++ b/html/modules/simpletest/tests/image_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/menu_test.info b/html/modules/simpletest/tests/menu_test.info index 2729d6976..959be8c67 100644 --- a/html/modules/simpletest/tests/menu_test.info +++ b/html/modules/simpletest/tests/menu_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/module_test.info b/html/modules/simpletest/tests/module_test.info index 6751642d7..d4c939d5a 100644 --- a/html/modules/simpletest/tests/module_test.info +++ b/html/modules/simpletest/tests/module_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/path_test.info b/html/modules/simpletest/tests/path_test.info index 5406c3c4f..083df3dd0 100644 --- a/html/modules/simpletest/tests/path_test.info +++ b/html/modules/simpletest/tests/path_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/psr_0_test/psr_0_test.info b/html/modules/simpletest/tests/psr_0_test/psr_0_test.info index 92862f456..5d5d9ba80 100644 --- a/html/modules/simpletest/tests/psr_0_test/psr_0_test.info +++ b/html/modules/simpletest/tests/psr_0_test/psr_0_test.info @@ -5,7 +5,7 @@ core = 7.x hidden = TRUE package = Testing -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/psr_4_test/psr_4_test.info b/html/modules/simpletest/tests/psr_4_test/psr_4_test.info index fb878f2cb..30af060af 100644 --- a/html/modules/simpletest/tests/psr_4_test/psr_4_test.info +++ b/html/modules/simpletest/tests/psr_4_test/psr_4_test.info @@ -5,7 +5,7 @@ core = 7.x hidden = TRUE package = Testing -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/requirements1_test.info b/html/modules/simpletest/tests/requirements1_test.info index 7553d1123..17cf5fd34 100644 --- a/html/modules/simpletest/tests/requirements1_test.info +++ b/html/modules/simpletest/tests/requirements1_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/requirements2_test.info b/html/modules/simpletest/tests/requirements2_test.info index e0d81407c..4f6f23a8e 100644 --- a/html/modules/simpletest/tests/requirements2_test.info +++ b/html/modules/simpletest/tests/requirements2_test.info @@ -7,7 +7,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/session_test.info b/html/modules/simpletest/tests/session_test.info index 45c65d694..907f7e927 100644 --- a/html/modules/simpletest/tests/session_test.info +++ b/html/modules/simpletest/tests/session_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/system_admin_test.info b/html/modules/simpletest/tests/system_admin_test.info index 9a10118f0..ea9643cb5 100644 --- a/html/modules/simpletest/tests/system_admin_test.info +++ b/html/modules/simpletest/tests/system_admin_test.info @@ -6,7 +6,7 @@ core = 7.x hidden = FALSE configure = config/broken -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/system_dependencies_test.info b/html/modules/simpletest/tests/system_dependencies_test.info index 121080492..d00cb45f2 100644 --- a/html/modules/simpletest/tests/system_dependencies_test.info +++ b/html/modules/simpletest/tests/system_dependencies_test.info @@ -6,7 +6,7 @@ core = 7.x hidden = TRUE dependencies[] = _missing_dependency -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info b/html/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info index b2ead7f15..f1b853438 100644 --- a/html/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info +++ b/html/modules/simpletest/tests/system_incompatible_core_version_dependencies_test.info @@ -6,7 +6,7 @@ core = 7.x hidden = TRUE dependencies[] = system_incompatible_core_version_test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/system_incompatible_core_version_test.info b/html/modules/simpletest/tests/system_incompatible_core_version_test.info index 5c713cee9..7185eb573 100644 --- a/html/modules/simpletest/tests/system_incompatible_core_version_test.info +++ b/html/modules/simpletest/tests/system_incompatible_core_version_test.info @@ -5,7 +5,7 @@ version = VERSION core = 5.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.info b/html/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.info index e1849532f..54ab48b75 100644 --- a/html/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.info +++ b/html/modules/simpletest/tests/system_incompatible_module_version_dependencies_test.info @@ -7,7 +7,7 @@ hidden = TRUE ; system_incompatible_module_version_test declares version 1.0 dependencies[] = system_incompatible_module_version_test (>2.0) -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/system_incompatible_module_version_test.info b/html/modules/simpletest/tests/system_incompatible_module_version_test.info index 4e57475fa..27fd60fed 100644 --- a/html/modules/simpletest/tests/system_incompatible_module_version_test.info +++ b/html/modules/simpletest/tests/system_incompatible_module_version_test.info @@ -5,7 +5,7 @@ version = 1.0 core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/system_null_version_test.info b/html/modules/simpletest/tests/system_null_version_test.info index 548d6a221..1d025238e 100644 --- a/html/modules/simpletest/tests/system_null_version_test.info +++ b/html/modules/simpletest/tests/system_null_version_test.info @@ -4,7 +4,7 @@ package = Only For Testing core = 7.x hidden = FALSE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/system_project_namespace_test.info b/html/modules/simpletest/tests/system_project_namespace_test.info index edc6fd480..4aea55ca2 100644 --- a/html/modules/simpletest/tests/system_project_namespace_test.info +++ b/html/modules/simpletest/tests/system_project_namespace_test.info @@ -6,7 +6,7 @@ core = 7.x hidden = TRUE dependencies[] = drupal:filter -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/system_requires_null_version_test.info b/html/modules/simpletest/tests/system_requires_null_version_test.info index 81d31e63f..d691975f1 100644 --- a/html/modules/simpletest/tests/system_requires_null_version_test.info +++ b/html/modules/simpletest/tests/system_requires_null_version_test.info @@ -6,7 +6,7 @@ version = VERSION hidden = FALSE dependencies[] = system_null_version_test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/system_test.info b/html/modules/simpletest/tests/system_test.info index 91745b6d3..2838e231c 100644 --- a/html/modules/simpletest/tests/system_test.info +++ b/html/modules/simpletest/tests/system_test.info @@ -6,7 +6,7 @@ core = 7.x files[] = system_test.module hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/taxonomy_nodes_test.info b/html/modules/simpletest/tests/taxonomy_nodes_test.info index b360c680d..8bc75dd5f 100644 --- a/html/modules/simpletest/tests/taxonomy_nodes_test.info +++ b/html/modules/simpletest/tests/taxonomy_nodes_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/taxonomy_test.info b/html/modules/simpletest/tests/taxonomy_test.info index dbba2e46e..dd401b777 100644 --- a/html/modules/simpletest/tests/taxonomy_test.info +++ b/html/modules/simpletest/tests/taxonomy_test.info @@ -6,7 +6,7 @@ core = 7.x hidden = TRUE dependencies[] = taxonomy -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/theme_test.info b/html/modules/simpletest/tests/theme_test.info index 1d5e74d5e..aee9bad20 100644 --- a/html/modules/simpletest/tests/theme_test.info +++ b/html/modules/simpletest/tests/theme_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info b/html/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info index 1b34909ce..982a2c9bc 100644 --- a/html/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info +++ b/html/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info @@ -6,7 +6,7 @@ hidden = TRUE settings[basetheme_only] = base theme value settings[subtheme_override] = base theme value -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info b/html/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info index ccd3b427e..993272e4f 100644 --- a/html/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info +++ b/html/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info @@ -6,7 +6,7 @@ hidden = TRUE settings[subtheme_override] = subtheme value -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/themes/test_theme/test_theme.info b/html/modules/simpletest/tests/themes/test_theme/test_theme.info index 958105fae..0217410bc 100644 --- a/html/modules/simpletest/tests/themes/test_theme/test_theme.info +++ b/html/modules/simpletest/tests/themes/test_theme/test_theme.info @@ -17,7 +17,7 @@ stylesheets[all][] = system.base.css settings[theme_test_setting] = default value -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/themes/test_theme_nyan_cat/test_theme_nyan_cat.info b/html/modules/simpletest/tests/themes/test_theme_nyan_cat/test_theme_nyan_cat.info index 3326fe568..6d3850a22 100644 --- a/html/modules/simpletest/tests/themes/test_theme_nyan_cat/test_theme_nyan_cat.info +++ b/html/modules/simpletest/tests/themes/test_theme_nyan_cat/test_theme_nyan_cat.info @@ -4,7 +4,7 @@ core = 7.x hidden = TRUE engine = nyan_cat -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/update_script_test.info b/html/modules/simpletest/tests/update_script_test.info index 897ea1efa..164154892 100644 --- a/html/modules/simpletest/tests/update_script_test.info +++ b/html/modules/simpletest/tests/update_script_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/update_test_1.info b/html/modules/simpletest/tests/update_test_1.info index 3545fb745..191cd5f0c 100644 --- a/html/modules/simpletest/tests/update_test_1.info +++ b/html/modules/simpletest/tests/update_test_1.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/update_test_2.info b/html/modules/simpletest/tests/update_test_2.info index 3545fb745..191cd5f0c 100644 --- a/html/modules/simpletest/tests/update_test_2.info +++ b/html/modules/simpletest/tests/update_test_2.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/update_test_3.info b/html/modules/simpletest/tests/update_test_3.info index 3545fb745..191cd5f0c 100644 --- a/html/modules/simpletest/tests/update_test_3.info +++ b/html/modules/simpletest/tests/update_test_3.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/url_alter_test.info b/html/modules/simpletest/tests/url_alter_test.info index ee0a82382..10c2943e7 100644 --- a/html/modules/simpletest/tests/url_alter_test.info +++ b/html/modules/simpletest/tests/url_alter_test.info @@ -5,7 +5,7 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/simpletest/tests/xmlrpc_test.info b/html/modules/simpletest/tests/xmlrpc_test.info index 31ae9d277..e1fb22d8d 100644 --- a/html/modules/simpletest/tests/xmlrpc_test.info +++ b/html/modules/simpletest/tests/xmlrpc_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/statistics/statistics.info b/html/modules/statistics/statistics.info index 18d6f02e2..3bdfd4d4d 100644 --- a/html/modules/statistics/statistics.info +++ b/html/modules/statistics/statistics.info @@ -6,7 +6,7 @@ core = 7.x files[] = statistics.test configure = admin/config/system/statistics -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/syslog/syslog.info b/html/modules/syslog/syslog.info index d0f25a104..8077233e6 100644 --- a/html/modules/syslog/syslog.info +++ b/html/modules/syslog/syslog.info @@ -6,7 +6,7 @@ core = 7.x files[] = syslog.test configure = admin/config/development/logging -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/system/system.admin.inc b/html/modules/system/system.admin.inc index bf3abb67d..f7f7cdb6a 100644 --- a/html/modules/system/system.admin.inc +++ b/html/modules/system/system.admin.inc @@ -2385,7 +2385,7 @@ function system_run_cron() { * Menu callback: return information about PHP. */ function system_php() { - phpinfo(); + phpinfo(~ (INFO_VARIABLES | INFO_ENVIRONMENT)); drupal_exit(); } diff --git a/html/modules/system/system.info b/html/modules/system/system.info index 3c4fbeaff..285205782 100644 --- a/html/modules/system/system.info +++ b/html/modules/system/system.info @@ -12,7 +12,7 @@ files[] = system.test required = TRUE configure = admin/config/system -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/system/tests/cron_queue_test.info b/html/modules/system/tests/cron_queue_test.info index b9d7ec728..534ed01dc 100644 --- a/html/modules/system/tests/cron_queue_test.info +++ b/html/modules/system/tests/cron_queue_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/system/tests/system_cron_test.info b/html/modules/system/tests/system_cron_test.info index a701fb978..94ff1511e 100644 --- a/html/modules/system/tests/system_cron_test.info +++ b/html/modules/system/tests/system_cron_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/taxonomy/taxonomy.info b/html/modules/taxonomy/taxonomy.info index cbb39bf4c..c4e48626c 100644 --- a/html/modules/taxonomy/taxonomy.info +++ b/html/modules/taxonomy/taxonomy.info @@ -8,7 +8,7 @@ files[] = taxonomy.module files[] = taxonomy.test configure = admin/structure/taxonomy -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/toolbar/toolbar.info b/html/modules/toolbar/toolbar.info index 5c33250e1..d041fb99e 100644 --- a/html/modules/toolbar/toolbar.info +++ b/html/modules/toolbar/toolbar.info @@ -5,7 +5,7 @@ package = Core version = VERSION files[] = toolbar.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/tracker/tracker.info b/html/modules/tracker/tracker.info index f34a3d190..47320b072 100644 --- a/html/modules/tracker/tracker.info +++ b/html/modules/tracker/tracker.info @@ -6,7 +6,7 @@ version = VERSION core = 7.x files[] = tracker.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/translation/tests/translation_test.info b/html/modules/translation/tests/translation_test.info index 7714c09c9..ec29b2087 100644 --- a/html/modules/translation/tests/translation_test.info +++ b/html/modules/translation/tests/translation_test.info @@ -5,7 +5,7 @@ package = Testing version = VERSION hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/translation/translation.info b/html/modules/translation/translation.info index 7dc3ef2c7..2bba716df 100644 --- a/html/modules/translation/translation.info +++ b/html/modules/translation/translation.info @@ -6,7 +6,7 @@ version = VERSION core = 7.x files[] = translation.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/trigger/tests/trigger_test.info b/html/modules/trigger/tests/trigger_test.info index 78320bfcd..639186977 100644 --- a/html/modules/trigger/tests/trigger_test.info +++ b/html/modules/trigger/tests/trigger_test.info @@ -4,7 +4,7 @@ package = Testing core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/trigger/trigger.info b/html/modules/trigger/trigger.info index 21dedd948..21b85526e 100644 --- a/html/modules/trigger/trigger.info +++ b/html/modules/trigger/trigger.info @@ -6,7 +6,7 @@ core = 7.x files[] = trigger.test configure = admin/structure/trigger -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/update/tests/aaa_update_test.info b/html/modules/update/tests/aaa_update_test.info index 7aff9e159..2e43d1549 100644 --- a/html/modules/update/tests/aaa_update_test.info +++ b/html/modules/update/tests/aaa_update_test.info @@ -4,7 +4,7 @@ package = Testing core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/update/tests/bbb_update_test.info b/html/modules/update/tests/bbb_update_test.info index dbe25d977..dcd1701f2 100644 --- a/html/modules/update/tests/bbb_update_test.info +++ b/html/modules/update/tests/bbb_update_test.info @@ -4,7 +4,7 @@ package = Testing core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/update/tests/ccc_update_test.info b/html/modules/update/tests/ccc_update_test.info index 543af5d5b..a220c832e 100644 --- a/html/modules/update/tests/ccc_update_test.info +++ b/html/modules/update/tests/ccc_update_test.info @@ -4,7 +4,7 @@ package = Testing core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/update/tests/themes/update_test_admintheme/update_test_admintheme.info b/html/modules/update/tests/themes/update_test_admintheme/update_test_admintheme.info index a2322f11d..4fed03ed2 100644 --- a/html/modules/update/tests/themes/update_test_admintheme/update_test_admintheme.info +++ b/html/modules/update/tests/themes/update_test_admintheme/update_test_admintheme.info @@ -3,7 +3,7 @@ description = Test theme which is used as admin theme. core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/update/tests/themes/update_test_basetheme/update_test_basetheme.info b/html/modules/update/tests/themes/update_test_basetheme/update_test_basetheme.info index 6f14e93d0..765e2c01c 100644 --- a/html/modules/update/tests/themes/update_test_basetheme/update_test_basetheme.info +++ b/html/modules/update/tests/themes/update_test_basetheme/update_test_basetheme.info @@ -3,7 +3,7 @@ description = Test theme which acts as a base theme for other test subthemes. core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/update/tests/themes/update_test_subtheme/update_test_subtheme.info b/html/modules/update/tests/themes/update_test_subtheme/update_test_subtheme.info index a255444ac..4f57be645 100644 --- a/html/modules/update/tests/themes/update_test_subtheme/update_test_subtheme.info +++ b/html/modules/update/tests/themes/update_test_subtheme/update_test_subtheme.info @@ -4,7 +4,7 @@ core = 7.x base theme = update_test_basetheme hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/update/tests/update_test.info b/html/modules/update/tests/update_test.info index bf4e64e07..8c9ce8f7c 100644 --- a/html/modules/update/tests/update_test.info +++ b/html/modules/update/tests/update_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/update/update.info b/html/modules/update/update.info index dcf5feeae..c8d8224e9 100644 --- a/html/modules/update/update.info +++ b/html/modules/update/update.info @@ -6,7 +6,7 @@ core = 7.x files[] = update.test configure = admin/reports/updates/settings -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/user/tests/anonymous_user_unblock_test.info b/html/modules/user/tests/anonymous_user_unblock_test.info index 0be0183a1..933596021 100644 --- a/html/modules/user/tests/anonymous_user_unblock_test.info +++ b/html/modules/user/tests/anonymous_user_unblock_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/user/tests/user_email_validation_test.info b/html/modules/user/tests/user_email_validation_test.info index e53298af5..8c439c5db 100644 --- a/html/modules/user/tests/user_email_validation_test.info +++ b/html/modules/user/tests/user_email_validation_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/user/tests/user_flood_test.info b/html/modules/user/tests/user_flood_test.info index bdc9f2456..e32c76893 100644 --- a/html/modules/user/tests/user_flood_test.info +++ b/html/modules/user/tests/user_flood_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/user/tests/user_form_test.info b/html/modules/user/tests/user_form_test.info index c82926fc9..d44f8855c 100644 --- a/html/modules/user/tests/user_form_test.info +++ b/html/modules/user/tests/user_form_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/user/tests/user_session_test.info b/html/modules/user/tests/user_session_test.info index 77aaf30d0..f042bebac 100644 --- a/html/modules/user/tests/user_session_test.info +++ b/html/modules/user/tests/user_session_test.info @@ -5,7 +5,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/modules/user/user.info b/html/modules/user/user.info index cb3fa85dd..4a9a39f26 100644 --- a/html/modules/user/user.info +++ b/html/modules/user/user.info @@ -9,7 +9,7 @@ required = TRUE configure = admin/config/people stylesheets[all][] = user.css -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/profiles/minimal/minimal.info b/html/profiles/minimal/minimal.info index 7cc411d4a..e796c8a40 100644 --- a/html/profiles/minimal/minimal.info +++ b/html/profiles/minimal/minimal.info @@ -5,7 +5,7 @@ core = 7.x dependencies[] = block dependencies[] = dblog -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/profiles/standard/standard.info b/html/profiles/standard/standard.info index e797e117b..3dd1b05bd 100644 --- a/html/profiles/standard/standard.info +++ b/html/profiles/standard/standard.info @@ -24,7 +24,7 @@ dependencies[] = field_ui dependencies[] = file dependencies[] = rdf -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info b/html/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info index 900e353f7..ec7e25805 100644 --- a/html/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info +++ b/html/profiles/testing/modules/drupal_system_listing_compatible_test/drupal_system_listing_compatible_test.info @@ -6,7 +6,7 @@ core = 7.x hidden = TRUE files[] = drupal_system_listing_compatible_test.test -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info b/html/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info index 8276bc35d..7689a7367 100644 --- a/html/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info +++ b/html/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info @@ -8,7 +8,7 @@ version = VERSION core = 6.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/profiles/testing/testing.info b/html/profiles/testing/testing.info index 9efd9dd28..04789c818 100644 --- a/html/profiles/testing/testing.info +++ b/html/profiles/testing/testing.info @@ -4,7 +4,7 @@ version = VERSION core = 7.x hidden = TRUE -; Information added by Drupal.org packaging script on 2022-12-14 -version = "7.94" +; Information added by Drupal.org packaging script on 2023-03-15 +version = "7.95" project = "drupal" -datestamp = "1671034612" +datestamp = "1678902530" diff --git a/html/sites/all/modules/contrib/addressfield/LICENSE.txt b/html/sites/all/modules/contrib/addressfield/LICENSE.txt deleted file mode 100644 index d159169d1..000000000 --- a/html/sites/all/modules/contrib/addressfield/LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/html/sites/all/modules/contrib/addressfield/addresses.txt b/html/sites/all/modules/contrib/addressfield/addresses.txt deleted file mode 100644 index 1f11bd89f..000000000 --- a/html/sites/all/modules/contrib/addressfield/addresses.txt +++ /dev/null @@ -1,298 +0,0 @@ -AT NULL Feldkirch NULL 6800 Pater Grimm Weg 20 NULL -AU NULL Melbourne NULL NULL -AU NULL Sydney NULL NULL -AU 4 NULL NORMANBY NULL 4059 30 Normanby Terrace NULL -BD NULL Dhaka NULL 1205 23, Subal Das Road, Chowdhury Bazar, Lalbagh NULL -BD NULL Dhaka NULL 1207 R-1,H-19,Kallaynpur,Mirpur,Dhaka NULL -BD NULL Dhaka NULL 1207 World Bank Office Dhaka, Plot E 32, Agargaon, Sher-E-Bangla Nagar NULL -BD NULL Dhaka NULL 1209 House# 66B, Flat# B2 Zigatola NULL -BD NULL Dhaka NULL 1219 390 West Rampura Dhaka NULL -BD NULL Dhaka NULL 1230 Uttara NULL -BD 81 NULL Dhaka NULL 1000 Institute of Water and Flood Management NULL -BD 81 NULL Dhaka NULL 1203 84/a maniknagar NULL -BD 81 NULL Dhaka NULL 1205 Dhaka Bangladesh NULL -BD 81 NULL Dhaka NULL 1207 BetterStories Limited 17 West Panthopath NULL -BD 81 NULL Dhaka NULL 1216 Mirpur, Dhaka NULL -BD 81 NULL Dhaka NULL 1230 830, Prembagan, Dhakshin Khan NULL -BD 82 NULL khulna NULL 9203 NULL -BD NULL NULL Dhaka NULL 1000 Institute of Water and Flood Management NULL -BD NULL NULL Dhaka NULL 1207 World Bank Office Dhaka, Plot E 32, Agargaon, Sher-E-Bangla Nagar NULL -BE NULL Brussels NULL NULL -BE NULL Watermael-Boitsfort NULL 1170 Avenue des Staphylins NULL -BH NULL Manama NULL 973 Manama Bahrain Manama Bahrain NULL -BR NULL Porto Alegre NULL NULL -BR NULL Recife NULL NULL -BR RJ NULL Rio de Janeiro NULL NULL -BW NULL Francistown NULL NULL NULL -BW NULL NULL Francistown NULL NULL NULL -CA NULL Montreal NULL NULL -CA NULL Toronto NULL NULL -CA BC NULL Vancouver NULL NULL -CA ON NULL Kitchener NULL NULL -CA ON NULL wterloo NULL n2l3g1 200 University Avenue West NULL -CH NULL Geneva NULL 1202 15, chemin Louis-Dunant NULL -CH 25 NULL Zurich NULL 8098 UBS Optimus Foundation Augustinerhof 1 NULL -DE NULL Berlin NULL NULL -DE 5 NULL Frankfurt am Main NULL 60386 Johanna-Tesch-Platz 7 NULL -DK NULL Aarhus NULL NULL -ES NULL Bilbao NULL NULL -ET 44 NULL ADDIS ABABA NULL 11945 ADDIS ABABA,P.O.BOX 11945 NULL -FI NULL Espoo NULL 2130 Mahlarinne 3B NULL -FI NULL Helsinki NULL 580 Hermannin rantatie 2 A Hermannin rantatie 2 A NULL -FI NULL Tampere NULL 33101 Tampere University of Technology NULL -FI 13 NULL Espoo NULL 2150 Aalto Venture Garage Betonimiehenkuja 3 NULL -GB NULL Exeter NULL NULL -GB NULL London NULL NULL -GB NULL London NULL N4 2DP 2 Myddleton Ave NULL -GB NULL London NULL N7 0AH 104 St George’s Avenue NULL -GB NULL London NULL SE16 3UL 25 Blue Anchor Lane NULL -GB NULL London NULL SW18 5SP Flat 1 150 Merton road NULL -GB NULL London NULL W1T 4BQ 13 Fitzroy Street NULL -GB NULL Oxford NULL NULL -GB NULL Southampton NULL NULL -GB C3 NULL NULL cb244qg 32 market street swavesey NULL -GB E7 NULL London NULL SE3 7TP NULL -GB F3 NULL Wood Green NULL N22 5RU 6 Cedar House NULL -GB H1 NULL London NULL SE11 5JD 47-49 Durham Street NULL -GB H6 NULL London NULL SE8 4DD 8 Harton St Deptford NULL -GB K2 NULL Oxford NULL OX2 6QY 3 The Villas, Rutherway NULL -GH 5 NULL NSAWAM NULL NULL P.O.BOX 455 NULL -GH NULL NULL Accra NULL NULL NULL -ID NULL Bandung NULL 40134 Jalan Sadang Hegar 1 No. 12 RT04 RW13 Sadang Serang NULL -ID NULL Bekasi NULL 17411 Jl.Binadharma 1 No.62. Jatiwaringin NULL -ID NULL Jakarta NULL NULL -ID NULL Jakarta NULL 12440 Jl. H. Niin 7 Lebak Bulus, Cilandak NULL -ID NULL Jakarta NULL 13330 Otista NULL -ID NULL Jakarta selatan NULL 12000 jl. rawa jati timur 6 no. 10 NULL -ID NULL Jakarta Timur NULL Jl.Mulia No.15B Kel.Bidara Cina, Kec.Jatinegara, Jakarta Timur NULL -ID NULL Pematang Siantar NULL 51511 Jl. Durian I 30 NULL -ID 4 NULL Bogor NULL 16165 NULL -ID 4 NULL jakarta NULL otista NULL -ID 4 NULL Jakarta NULL 12520 Jl. Pertanian Raya III No.42 Jakarta Selatan Pasar Minggu NULL -ID 4 NULL Jakarta NULL 13330 Jakarta NULL -ID 4 NULL Jakarta NULL 13330 Jl Sensus IIC Bidaracina Jaktim NULL -ID 4 NULL Jakarta NULL 13330 Jl. Bonasut 2 no.22 NULL -ID 4 NULL Jakarta NULL 13330 Otista 64c NULL -ID 4 NULL jakarta NULL 13330 Otista jaktim NULL -ID 4 NULL Jakarta Timur NULL 13330 Kebon Sayur I no. 1 RT 10/15 NULL -ID 4 NULL Jakarta Timur NULL 13460 Jl. Pondok Kopi Blok G4/5 RT. 005/08 Jakarta Timur NULL -ID 4 NULL Jakarta Timur NULL 13810 Jl. Raya Pondok Gede Rt03 Rw08 no.35 , Lubang Buaya, Jakarta Timur Jl. Raya Pondok Gede Rt03 Rw08 no.35 , Lubang Buaya, Jakarta Timur NULL -ID 7 NULL Brebes NULL 54321 Jl Kersem Blok D14 Perum Taman Indo Kaligangsa Wetan Brebes NULL -ID 7 NULL Semarang NULL 50143 Puspowarno Tengah 2/2 NULL -ID 8 NULL Lumajang NULL 67373 Desa Tumpeng Kecamatan Candipuro Lumajang NULL -ID 30 NULL Bandung NULL 55241 Jl Pelesiran No 55A/56 NULL -ID 30 NULL Bekasi NULL 17510 bekasi West Java Indonesia NULL -ID 30 NULL Depok NULL 16245 Jalan juragan sinda 2 no 10 NULL -ID 30 NULL Depok NULL 16424 Jalan Margonda RayaJalan Kober Gang Mawar NULL -ID 30 NULL Depok NULL 16424 Jl. Haji Yahya Nuih no.24, Pondok Cina NULL -ID 30 NULL Depok NULL 16425 Kukusan Kelurahan NULL -ID 30 NULL Depok NULL 16518 Jl. Salak No.1/C.88 Durenseribu Bojongsari NULL -ID 30 NULL Depok NULL 16952 Jl. Merak No.34 -36 Rt.004/014 Jl. Merak No. 34 -36 Rt. 004/014 NULL -ID 36 NULL biak numfor NULL 98111 jl. s. mamberamo no 6782 biak numfor NULL -IL NULL Tel Aviv NULL NULL -IN NULL Bangalore NULL NULL -IN NULL India NULL NULL -IN NULL new delhi NULL 110003 55 lodi estate NULL -IN 7 NULL NEW DELHI NULL 110018 15/11 A 1ST FLOOR TILAK NAGAR NULL -IN 7 NULL New Delhu NULL 110075 B 54 Hilansh Apartments Plot No 1, Sector 10, Dwarka NULL -IN 10 NULL Gurgaon NULL D- 201 Ivy Apartments Sushant Lok 1 Gurgaon Haryana NULL -IN 13 NULL Trivandrum NULL 695010 TC 9/1615, SRMH Road, Sasthamangalam, Trivandrum NULL -IN 16 NULL Mumbai NULL 400020 Bharat Mahal, Flat#55 Marine Drive NULL -IN 16 NULL Mumbai NULL 400028 303,Shree Parvati Co-Op Housing Society, D.L.Vaidya Road,Dadar NULL -IN 16 NULL Pune NULL NULL -IN 16 NULL Pune NULL Infosys Campus Hinjewadi Phase 2 NULL -IN 16 NULL Pune NULL 400705 #22 Iris Garden Gokhale Road NULL -IN 16 NULL PUNE NULL 411043 NULL -IN 16 NULL Pune NULL 411051 NULL -IN 16 NULL Pune NULL 411057 Infosys Ltd. Rajiv gandhi infostech park Hinjewadi phase 2 NULL -IN 16 NULL Pune NULL 412108 Pune Maharatshtra NULL -IN 16 NULL Pune NULL 433011 502 utkarsh vihar golande state pune NULL -IN 19 NULL Bangalore NULL 560080 Indian Institute for Human Settlements IIHS Bangalore City Campus, Sadashivanagar, NULL -IN 19 NULL Bangalore NULL 560100 electronic city NULL -IN 19 NULL Bhalki NULL 585411 bhalki,bidar ,karnataka karnataka NULL -IN 24 NULL Jaipur NULL 302011 Institute of Health Management Research 1, Prabhu Dayal Marg NULL -IR 26 NULL Tehran NULL 1118844454 Baharestan sq. mostafa khomeini str., javahery Ave., no. 11, NULL -IT NULL Trento NULL NULL -JM 8 NULL Kingston NULL Kgn 7 MOna Campus UWI NULL -KE NULL Nairobi NULL NULL -KE 5 NULL Nairobi NULL 30300 212,kapsabet NULL -KH NULL NULL Phnom Penh NULL NULL -LR NULL Monrovia NULL 0 NULL -NG 11 NULL Abuja NULL 930001 17 Bechar street Wuse zone 2 NULL -PE 15 NULL Lima NULL 18 Lima Lima NULL -PE 15 NULL Lima NULL Lima 18 123 Miraflores NULL -PE NULL NULL Lima NULL 3 Calle Granada 104 NULL -PE NULL NULL Lima NULL 18 Lima Lima NULL -PH NULL Manila NULL Globe Telepark 111 Valero Street NULL -PH NULL Quezon Coty NULL 1109 86 Harvard Street, Cubao, Quezon City, Philippines 84 Harvard Street, Cubao, Quezon City,hilippines NULL -PH 20 NULL Silang NULL 4118 370 Bayungan Kaong Silang Cavite NULL -PH 57 NULL Kidapawan NULL 9400 Kidapawan City Kidapawan City NULL -PH 66 NULL zamboanga NULL 7000 29-tripplet rd san jose 29-tripplet rd san jose NULL -PH D9 NULL Pasig City NULL World Bank Office Manila, 20/F Taipan Place F. Ortigas Jr. Road, Ortigas Center NULL -PK NULL Lahore NULL 54000 17-R Model Town Lahore NULL -PK NULL Lahore NULL 54000 53- chamber lane road Lahore NULL -PK NULL Lahore NULL 54000 85 E block Model Town NULL -PK NULL Lahore NULL 54000 House no 227, street no 5, Imamia Colony Shahadra Lahore NULL -PK NULL LAHORE NULL 54000 room no.6 khalid bim waleed hall, near New Anarkali, LAHORE room no.6 khalid bim waleed hall, near New Anarkali, LAHORE NULL -PK NULL Lahore NULL pk097 LUMS, Lahore, NULL -PK NULL Sheikhupura NULL 3935 D.H.Q.Hospital Sheikhupura House number 08. Room no 109 Khalid bin waleed haal, punjab University lahore old campus. NULL -PK 2 NULL Quetta NULL 87000 Postal Address 87000, Kuchlak, Quetta, Balochistan. H#24 Peer Abul Khair road Quetta, Balochistan. NULL -PK 2 NULL Quetta NULL 87300 block no-1 falt no. 7 New Crime Branch Abbas Ali Road Cantt NULL -PK 2 NULL Quetta NULL 87300 Flat no. 3 Shafeen Centre Jinnah Town ,Near I.T university , Quetta NULL -PK 2 NULL Quetta NULL 87300 H-no. C-220 Zarghoonabad Phase-2 , Nawa Killi ,Quetta NULL -PK 4 NULL burewala NULL 60101 Fatima Fayyaz Hazrat Sakina hall girls hostel number 9 Punjab university Lahore Pakistan Sardar Wajid Azim Azeem abad Burewala dist Vehari Pakistan NULL -PK 4 NULL Faisalabad NULL 38000 P 101/1, Green Town, Millat Road, Faisalabad NULL -PK 4 NULL Islamabad NULL 44000 P.O Tarlai kalan chappar Islamabad NULL -PK 4 NULL lahore NULL NULL -PK 4 NULL Lahore NULL 54000 NULL -PK 4 NULL lahore NULL 54000 Street No.63 House 36/A Al-madad Pak Colony Ravi Road, Lahore. Street No.63 House 36/A Al-madad Pak Colony Ravi Road, Lahore. NULL -PK 4 NULL Lahore NULL 54000 1149-1-D2 Green Town Lahore NULL -PK 4 NULL Lahore NULL 54000 124, street# 2, karim block Allama Iqbal Town lahore. 124, street# 2, karim block Allama Iqbal Town lahore. NULL -PK 4 NULL Lahore NULL 54000 150 A Qila Lachman Singh Ravi Road lahore NULL -PK 4 NULL Lahore NULL 54000 166/1L DHA Lahore NULL -PK 4 NULL Lahore NULL 54000 172 A2 Township Lahore NULL -PK 4 NULL Lahore NULL 54000 183,S/Block, Model Town, Lhr NULL -PK 4 NULL lahore NULL 54000 19- A block ,Eden Lane Villas Raiwind Road ,Lahore NULL -PK 4 NULL lahore NULL 54000 3-c kaliyar road opposite kids lyceum, rustam park near mor samnabad NULL -PK 4 NULL Lahore NULL 54000 31 Saeed Block, Canal Bank Scheme NULL -PK 4 NULL Lahore NULL 54000 31c DHA Lahore NULL -PK 4 NULL Lahore NULL 54000 387 E1 wapda town, Lahore NULL -PK 4 NULL Lahore NULL 54000 45-D dha eme sector multan road,lahore NULL -PK 4 NULL Lahore NULL 54000 5 Zafar Ali Road NULL -PK 4 NULL Lahore NULL 54000 54-R PGECHS NULL -PK 4 NULL lahore NULL 54000 566 E-1 johar town lahore 566 E-1 johar town lahore NULL -PK 4 NULL Lahore NULL 54000 82/1 Z Block, Phase 3 DHA NULL -PK 4 NULL Lahore NULL 54000 A-1 VRI Zarrar shaheed road lahore cantt A-1 VRI Zarrar shaheed road lahore cantt NULL -PK 4 NULL lahore NULL 54000 e5/39D street 6 zaman colony cavalry ground ext NULL -PK 4 NULL Lahore NULL 54000 Ho # 61, Block G3, Johar Town Lahore NULL -PK 4 NULL LAhore NULL 54000 House #19-A street #5 Usman nagr Ghaziabad Lahore NULL -PK 4 NULL lahore NULL 54000 House no 692 street no 67 sadar bazar NULL -PK 4 NULL Lahore NULL 54000 Khosa Law Chamber 1 Turner Road NULL -PK 4 NULL Lahore NULL 54000 Lahore,Pakistan Lahore,Pakistan NULL -PK 4 NULL Lahore NULL 54000 room no 69, khalid bin waleed hall, anarkali NULL -PK 4 NULL Lahore NULL 54000 Suite # 8, Al-Hafeez Suites, Gulberg II NULL -PK 4 NULL Lahore NULL 54085 199 Shadman 2 NULL -PK 4 NULL Lahore NULL 54300 Mughalpura Lahore Pakistan NULL -PK 4 NULL Lahore NULL 54660 SD 69 falcon complex gulberg III lahore NULL -PK 4 NULL lahore NULL 54800 764-G4 johar town ,lahore NULL -PK 4 NULL Rawalpindi NULL 44000 House 522, F-Block Sattellite Town, Rawalpindi NULL -PK 4 NULL Rawalpindi NULL 46000 1950/c, Indusroad 2, Tariqabad, Rawalpindi Cantt NULL -PK 4 NULL Rawalpindi NULL 46000 House 54-E Lane 9 Sector 4, AECHS Chaklala Rawalpindi NULL -PK 4 NULL Rawalpindi NULL 46000 House B-1343, Sattellite town Rawalpindi NULL -PK 4 NULL Rawalpindi NULL 46000 House CB-299F, Street 1, Lane 4 Peshawar Road Rawalpindi NULL -PK 4 NULL Rawalpindi NULL 46300 House No 1518 Umer Block phase 8 BehriaTown NULL -PK 4 NULL sialkot NULL 51310 The National Model School, Ismaiealabad, Pacca Garah Sialkot NULL -PK 8 NULL Islamabad NULL CIomsats Institute of Information Technology Islamabad NULL -PK 8 NULL Islamabad NULL 38700 COMSATS tarlai boys hostel Islamabad. COMSATS tarlai boys hostel Islamabad (Room 30) NULL -PK 8 NULL Islamabad NULL 44000 NULL -PK 8 NULL Islamabad NULL 44000 House # 256, Street # 9, Shahzad Town, Islamabad. NULL -PK 8 NULL Islamabad NULL 44000 Islamabad , Comsats University Islamabd ,Pakistan NULL -PK 8 NULL Islamabad NULL 44000 World Bank Building Sector G 5 NULL -PK 8 NULL lahore NULL 54000 3c zafar ali road gulburg 5 3c zafar ali road gulburg 5 NULL -PK 8 NULL lahore NULL 54000 49-a bilal park, chaburgy 49-a bilal park, chaburgy NULL -PK NULL NULL Lahore NULL 54000 NULL -PK NULL NULL Lahore NULL 54000 85 E block Model Town NULL -SN 1 NULL NULL ouakam cité comico en face 217 NULL -SN 1 NULL Dakar NULL NULL -SN 1 NULL Dakar NULL IDEV-ic Patte d'oie Builder's Villa B11 NULL -SN 1 NULL Dakar NULL liberte 6/ dakar NULL -SN 1 NULL Dakar NULL ngor NULL -SN 1 NULL Dakar NULL 4027 ZAC Mbao Cité Fadia NULL -SN NULL NULL Dakar NULL IDEV-ic Patte d'oie Builder's Villa B11 NULL -TZ NULL Dar es Salaam NULL NULL NULL -TZ NULL Dar es salaam NULL NULL 76021 Dar es salaam 1507 Morogoro NULL -TZ NULL Dar es salaam NULL NULL dar es salaam nassoro.ahmedy@yahoo.com NULL -TZ NULL DAR ES SALAAM NULL NULL dar es salaam UDSM NULL -TZ NULL Dar es salaam NULL NULL NA NULL -TZ NULL DAR ES SALAAM NULL NULL P O BOX 23409 NULL -TZ NULL dar es salaam NULL NULL p. o. box 104994 NULL -TZ NULL Dar es Salaam NULL NULL P.o. BOX 71415 Dar es Salaam NULL -TZ NULL Dar es Salaam NULL NULL P.O.BOx 66675 DSM NULL -TZ NULL Dar es salaam NULL NULL Tz Tz NULL -TZ NULL dsm NULL NULL NULL -TZ 2 NULL Bagamoyo NULL NULL PO.Box 393 NULL -TZ 2 NULL Dar es salaam NULL NULL 22548 NULL -TZ 3 NULL Dar-es-salaam NULL NULL Dodoma Municipal Kimara, Dar-es-salaa, NULL -TZ 23 NULL Dar es Salaam NULL NULL NULL -TZ 23 NULL dar es salaam NULL NULL 35074 NULL -TZ 23 NULL dar es salaam NULL NULL 67389 NULL -TZ 23 NULL Dar es Salaam NULL NULL COSTECH, Dar es Salaam, Tanzania NULL -TZ 23 NULL Dar es salaam NULL NULL na NULL -TZ 23 NULL dar es salaam NULL NULL p o box 60164 NULL -TZ 23 NULL dar es salaam NULL NULL P. O. Box 77588 NULL -TZ 23 NULL dar es salaam NULL NULL P.O BOX 78144 NULL -TZ 23 NULL Dar es Salaam NULL NULL P.O.BOX 78373 NULL -TZ 23 NULL Dar es salaam NULL NULL UDSM Dar es Salaam NULL -TZ 23 NULL Dar es salaam NULL NULL udsm udsm NULL -TZ 23 NULL Temeke NULL NULL P.O. Box 50127 NULL -TZ NULL NULL Dar es Salaam NULL NULL NULL -TZ NULL NULL Dar es Salaam NULL NULL Kigoma NULL -TZ NULL NULL Dar es Salaam NULL NULL Mwanza NULL -UG NULL Kampala NULL NULL NULL -UG NULL Kampala NULL NULL Kampala Uganda East Africa NULL -US NULL London NULL SE1 8RT Capital Tower 91 Waterloo Road NULL -US CA NULL Los Angeles NULL NULL -US CA NULL Pleasanton NULL 94588 3412 Pickens Lane NULL -US CA NULL Sacramento NULL NULL -US CA NULL San Francisco NULL NULL -US CA NULL seattle NULL 98113 1234 1st st NULL -US CO NULL Denver NULL 80235 6666 West Quincy Ave NULL -US CT NULL Greenwich NULL 6830 140 Milbank NULL -US CT NULL Hartford NULL 6106 Center for Urban and Global Studies at Trinity College, 70 Vernon Street NULL -US DC NULL Washington NULL NULL -US DC NULL Washington NULL 20007 World Bank Headquarters 1818 H Street NW NULL -US DC NULL Washington NULL 20010 NULL -US DC NULL Washington NULL 20036 NULL -US DC NULL Washington NULL 20405 1889 F St NW NULL -US DC NULL Washington NULL 20433 NULL -US DC NULL Washington NULL 20433 1818 H Street NW NULL -US DC NULL Washington NULL 20433 1818H St NULL -US DC NULL Washington NULL 20433 1818 H Street NW NULL -US DC NULL Washington DC NULL 20005 1424, K Street, NW Suite 600 NULL -US DC NULL Washington DC NULL 20010 1818 H Street, NW NULL -US DC NULL Washington, DC NULL 20003 1818 H Street NW NULL -US DE NULL Virgin Islands|Charlotte Amalie,Cruz Bay,Christiansted NULL Morocco|Tafraout,Rabat,Tangier,Tetouan,Casablanca,Marrakesh,Fez,Oujda,Meknes,Agadir United Arab Emirates|Garhoud,Dubai,Bur Dubai,Ras al Khaymah,Abu Dhabi,Ajman,Al Fujayrah,Sharjah NULL -US FL NULL Falmouth NULL Falmouth Falmouth NULL -US FL NULL Lilongwe NULL Lilongwe Lilongwe NULL -US GA NULL Atlanta NULL NULL -US GU NULL Herndon NULL 15642 Ht USA NULL -US GU NULL Miami NULL Miami Miami NULL -US MD NULL Gaithersburg NULL 20877 554 N Frederick Avenue Suite 216 NULL -US MD NULL Potomac NULL 20854 14 Sandalfoot Court NULL -US MD NULL Silver Spring NULL 20901 9202 Whitney St. NULL -US MI NULL Traverse City NULL 49685 PO Box 792 NULL -US ND NULL Pirassununga NULL Pirassununga Pirassununga NULL -US NJ NULL Princeton NULL NULL -US NY NULL Brooklyn NULL 11206-1980 25 Montrose Ave. Apt 304 NULL -US NY NULL Brooklyn NULL 11225 975 washington ave 2d NULL -US NY NULL Brooklyn NULL 11217 150 4TH AVE APT 9E NULL -US NY NULL New York NULL NULL -US NY NULL New York NULL 10013 148 Lafayette St. PH NULL -US NY NULL New York NULL 10017 UNICEF 3 UN Plaza NULL -US NY NULL New York NULL 10019 25 Columbus Circle Suite 52E NULL -US NY NULL New York NULL 10024 65 West 85th Street 3A NULL -US NY NULL New York NULL 10027 606 W. 116th Street #22 NULL -US NY NULL New York NULL 10037 NULL -US NY NULL Rochester NULL NULL -US NY NULL Scarsdale NULL 10583-1423 54 Walworth Avenue NULL -US OR NULL Portland NULL NULL -US PA NULL Philadelphia NULL NULL -US PA NULL Philadelphia NULL NULL -US PR NULL Colonel Hill NULL Colonel Hill Colonel Hill NULL -US SD NULL Banjul NULL Banjul Banjul NULL -US SD NULL London NULL London London NULL -US TX NULL Aledo NULL 76008 1588 Hunterglenn Dr NULL -US TX NULL Keller NULL 76248 810 Placid View Ct. NULL -US WA NULL Seattle NULL NULL -ZA NULL Cape Town NULL NULL -ZA NULL Cape Town NULL 7945 Alexander Road Muizenberg NULL -ZA NULL Pretoria NULL NULL -ZA 11 NULL Cape Town NULL NULL -ZA 11 NULL Cape Town NULL 7435 PostNet Suite #57, Private Bag X18 Milnerton NULL -ZA 11 NULL Cape town NULL 7508 24 Solyet Court, Lansdowne Road Claremont NULL -ZA 11 NULL Cape Town NULL 7701 NULL -ZA 11 NULL Cape Town NULL 7785 10 Nyamakazi Road Luzuko Park Phillipi East NULL -ZA 11 NULL Cape Town NULL 7915 66 Albert Rd NULL -ZA 11 NULL Cape Town NULL 8001 210 Long Street NULL -ZM NULL Lusaka NULL NULL -ZM 9 NULL LUSAKA NULL 10101 P.O. BOX FW 174 NULL diff --git a/html/sites/all/modules/contrib/addressfield/addressfield-rtl.css b/html/sites/all/modules/contrib/addressfield/addressfield-rtl.css deleted file mode 100644 index d979946d3..000000000 --- a/html/sites/all/modules/contrib/addressfield/addressfield-rtl.css +++ /dev/null @@ -1,10 +0,0 @@ -div.addressfield-container-inline > div.form-item { - float: right; - margin-right: 0; - margin-left: 1em; -} - -div.addressfield-container-inline.country-GB > div.form-item { - margin-left: auto; - margin-right: 0; -} diff --git a/html/sites/all/modules/contrib/addressfield/addressfield.address_formats.inc b/html/sites/all/modules/contrib/addressfield/addressfield.address_formats.inc deleted file mode 100644 index 65aac347d..000000000 --- a/html/sites/all/modules/contrib/addressfield/addressfield.address_formats.inc +++ /dev/null @@ -1,454 +0,0 @@ - array('locality'), - 'required_fields' => array('locality'), - 'dependent_locality_label' => t('Suburb'), - 'locality_label' => t('City'), - 'administrative_area_label' => t('Province'), - 'postal_code_label' => t('Postal code'), - 'render_administrative_area_value' => FALSE, - ); - - $address_formats = array(); - // These formats differ from the default only by the presence of the - // postal code in 'used_fields'. - $countries_with_optional_postal_code = array( - 'AC', 'AD', 'AF', 'AI', 'AL', 'AZ', 'BA', 'BB', 'BD', 'BG', 'BH', 'BM', - 'BN', 'BT', 'CU', 'CR', 'CY', 'DO', 'DZ', 'EC', 'EH', 'ET', 'FO', 'GE', - 'GN', 'GT', 'GW', 'HR', 'HM', 'HT', 'IL', 'IS', 'JO', 'KE', 'KG', 'KH', - 'KP', 'KW', 'LA', 'LB', 'LK', 'LR', 'LS', 'MA', 'MC', 'MD', 'ME', 'MG', - 'MK', 'MM', 'MT', 'MU', 'MV', 'NE', 'NP', 'OM', 'PK', 'PY', 'RO', 'RS', - 'SA', 'SD', 'SI', 'SN', 'SZ', 'TA', 'TJ', 'TM', 'TN', 'TZ', 'VA', 'VC', - 'VG', 'XK', 'ZM', - ); - foreach ($countries_with_optional_postal_code as $code) { - $address_formats[$code] = array( - 'used_fields' => array('locality', 'postal_code'), - ); - } - - // These formats differ from the default only by the presence of the - // postal code in 'used_fields' and 'required_fields'. - $countries_with_required_postal_code = array( - 'AT', 'AX', 'BE', 'BL', 'CH', 'CZ', 'DE', 'DK', 'FI', 'FK', 'FR', 'GF', 'GG', - 'GL', 'GP', 'GR', 'GS', 'HU', 'IM', 'IO', 'JE', 'LI', 'LU', 'MF', 'MQ', 'NC', - 'NL', 'NO', 'PL', 'PM', 'PN', 'PT', 'RE', 'SE', 'SH', 'SJ', 'SK', 'TC', 'WF', - 'YT', - ); - foreach ($countries_with_required_postal_code as $code) { - $address_formats[$code] = array( - 'used_fields' => array('locality', 'postal_code'), - 'required_fields' => array('locality', 'postal_code'), - ); - } - - $address_formats['AE'] = array( - 'used_fields' => array('administrative_area'), - 'administrative_area_label' => t('Emirate'), - 'render_administrative_area_value' => TRUE, - 'required_fields' => array('administrative_area'), - ); - $address_formats['AM'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - ); - $address_formats['AR'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['AS'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'postal_code_label' => t('ZIP code'), - ); - $address_formats['AU'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'locality_label' => t('City/Suburb'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'postal_code_label' => t('Postcode'), - ); - $address_formats['BR'] = array( - 'used_fields' => array('dependent_locality', 'locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'dependent_locality_label' => t('Neighborhood'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - ); - $address_formats['BS'] = array( - 'used_fields' => array('locality', 'administrative_area'), - 'administrative_area_label' => t('Island'), - ); - $address_formats['BY'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - ); - $address_formats['CA'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - ); - $address_formats['CC'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - ); - $address_formats['CL'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['CN'] = array( - 'used_fields' => array('dependent_locality', 'locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area'), - 'dependent_locality_label' => t('District'), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['CO'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area'), - 'administrative_area_label' => t('Department', array(), array('context' => 'Territory of a country')), - ); - $address_formats['CV'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('Island'), - ); - $address_formats['CX'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - ); - $address_formats['EG'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('Governorate'), - ); - $address_formats['EE'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'postal_code'), - 'administrative_area_label' => t('County'), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['ES'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['FM'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'postal_code_label' => t('ZIP code'), - ); - $address_formats['GB'] = array( - 'used_fields' => array('locality', 'postal_code'), - 'required_fields' => array('locality', 'postal_code'), - 'locality_label' => t('Town/City'), - 'administrative_area_label' => t('County'), - 'postal_code_label' => t('Postcode'), - ); - $address_formats['GI'] = array( - 'used_fields' => array('postal_code'), - ); - $address_formats['GU'] = array( - 'used_fields' => array('locality', 'postal_code'), - 'required_fields' => array('locality', 'postal_code'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'postal_code_label' => t('ZIP code'), - ); - $address_formats['HK'] = array( - 'used_fields' => array('locality', 'administrative_area'), - 'required_fields' => array('administrative_area'), - 'locality_label' => t('District'), - 'administrative_area_label' => t('Area', array(), array('context' => 'Territory of a country')), - ); - $address_formats['HN'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area'), - ); - $address_formats['ID'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('administrative_area'), - 'locality_label' => t('City/Regency'), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['IE'] = array( - 'used_fields' => array('dependent_locality', 'locality', 'administrative_area', 'postal_code'), - 'locality_label' => t('Town/City'), - 'administrative_area_label' => t('County'), - 'postal_code_label' => t('Eircode'), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['IN'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'postal_code_label' => t('PIN code'), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['IQ'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area'), - ); - $address_formats['IR'] = array( - 'used_fields' => array('dependent_locality', 'locality', 'administrative_area', 'postal_code'), - 'dependent_locality_label' => t('Neighborhood'), - ); - $address_formats['IT'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - ); - $address_formats['JM'] = array( - 'used_fields' => array('locality', 'administrative_area'), - 'required_fields' => array('locality', 'administrative_area'), - 'administrative_area_label' => t('Parish', array(), array('context' => 'Territory of a country')), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['JP'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('Prefecture'), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['KI'] = array( - 'used_fields' => array('locality', 'administrative_area'), - 'administrative_area_label' => t('Island'), - ); - $address_formats['KN'] = array( - 'used_fields' => array('locality', 'administrative_area'), - 'required_fields' => array('locality', 'administrative_area'), - 'administrative_area_label' => t('Island'), - ); - $address_formats['KR'] = array( - 'used_fields' => array('dependent_locality', 'locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'dependent_locality_label' => t('District'), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['KY'] = array( - 'used_fields' => array('administrative_area', 'postal_code'), - 'required_fields' => array('administrative_area'), - 'administrative_area_label' => t('Island'), - ); - $address_formats['KZ'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('Region', array(), array('context' => 'Territory of a country')), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['LT'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'postal_code'), - 'administrative_area_label' => t('County'), - ); - $address_formats['LV'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'postal_code'), - 'administrative_area_label' => t('Municipality'), - ); - $address_formats['MH'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'postal_code_label' => t('ZIP code'), - ); - $address_formats['MN'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - ); - $address_formats['MP'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'postal_code_label' => t('ZIP code'), - ); - $address_formats['MX'] = array( - 'used_fields' => array('dependent_locality', 'locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'postal_code'), - 'dependent_locality_label' => t('Neighborhood'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - ); - $address_formats['MY'] = array( - 'used_fields' => array('dependent_locality', 'locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'postal_code'), - 'dependent_locality_label' => t('Village / Township'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['MZ'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - ); - $address_formats['NF'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - ); - $address_formats['NG'] = array( - 'used_fields' => array('dependent_locality', 'locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - ); - $address_formats['NI'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('Department', array(), array('context' => 'Territory of a country')), - ); - $address_formats['NR'] = array( - 'used_fields' => array('administrative_area'), - 'required_fields' => array('administrative_area'), - 'administrative_area_label' => t('District'), - ); - $address_formats['NZ'] = array( - 'used_fields' => array('dependent_locality', 'locality', 'postal_code'), - 'required_fields' => array('locality', 'postal_code'), - 'locality_label' => t('Town/City'), - 'postal_code_label' => t('Postcode'), - ); - $address_formats['PA'] = array( - 'used_fields' => array('locality', 'administrative_area'), - ); - $address_formats['PE'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'locality_label' => t('District'), - 'administrative_area_label' => t('Department', array(), array('context' => 'Territory of a country')), - ); - $address_formats['PF'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('Island'), - ); - $address_formats['PG'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area'), - ); - $address_formats['PH'] = array( - 'used_fields' => array('dependent_locality', 'locality', 'administrative_area', 'postal_code'), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['PR'] = array( - 'used_fields' => array('locality', 'postal_code'), - 'required_fields' => array('locality', 'postal_code'), - 'postal_code_label' => t('ZIP code'), - ); - $address_formats['PW'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'postal_code_label' => t('ZIP code'), - ); - $address_formats['RU'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['SC'] = array( - 'used_fields' => array('locality', 'administrative_area'), - 'administrative_area_label' => t('Island'), - ); - $address_formats['SG'] = array( - 'used_fields' => array('postal_code'), - 'required_fields' => array('postal_code'), - ); - $address_formats['SM'] = array( - 'used_fields' => array('locality', 'postal_code'), - 'required_fields' => array('postal_code'), - ); - $address_formats['SO'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area'), - ); - $address_formats['SR'] = array( - 'used_fields' => array('locality', 'administrative_area'), - ); - $address_formats['SV'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area'), - ); - $address_formats['TH'] = array( - 'used_fields' => array('dependent_locality', 'locality', 'administrative_area', 'postal_code'), - ); - $address_formats['TR'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'postal_code'), - 'locality_label' => t('District'), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['TV'] = array( - 'used_fields' => array('locality', 'administrative_area'), - 'administrative_area_label' => t('Island'), - ); - $address_formats['TW'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - ); - $address_formats['UA'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('Region', array(), array('context' => 'Territory of a country')), - ); - $address_formats['UM'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'postal_code_label' => t('ZIP code'), - ); - $address_formats['US'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'postal_code_label' => t('ZIP code'), - ); - $address_formats['UY'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - ); - $address_formats['UZ'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - ); - $address_formats['VE'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area'), - 'render_administrative_area_value' => TRUE, - ); - $address_formats['VI'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - 'required_fields' => array('locality', 'administrative_area', 'postal_code'), - 'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), - 'postal_code_label' => t('ZIP code'), - ); - $address_formats['VN'] = array( - 'used_fields' => array('locality', 'administrative_area', 'postal_code'), - ); - $address_formats['ZA'] = array( - 'used_fields' => array('dependent_locality', 'locality', 'postal_code'), - 'required_fields' => array('locality', 'postal_code'), - ); - - // Allow other modules to alter the formats. - drupal_alter('addressfield_address_formats', $address_formats); - - if (isset($address_formats[$country_code])) { - $format = $address_formats[$country_code] + $default_values; - } - else { - // There is no predefined address format for the requested country, - // but the defaults should work fine. - $format = $default_values; - } - - return $format; -} diff --git a/html/sites/all/modules/contrib/addressfield/addressfield.administrative_areas.inc b/html/sites/all/modules/contrib/addressfield/addressfield.administrative_areas.inc deleted file mode 100644 index a2eeaccb8..000000000 --- a/html/sites/all/modules/contrib/addressfield/addressfield.administrative_areas.inc +++ /dev/null @@ -1,1138 +0,0 @@ - t('Abu Dhabi'), - 'FU' => t('Fujairah'), - 'UQ' => t('Umm al-Quwain'), - 'SH' => t('Sharjah'), - 'DU' => t('Dubai'), - 'RK' => t('Ras al-Khaimah'), - 'AJ' => t('AjmÄn'), - ); - $administrative_areas['AR'] = array( - 'B' => 'Buenos Aires', - 'K' => 'Catamarca', - 'H' => 'Chaco', - 'U' => 'Chubut', - 'C' => 'Ciudad de Buenos Aires', - 'X' => 'Córdoba', - 'W' => 'Corrientes', - 'E' => 'Entre Ríos', - 'P' => 'Formosa', - 'Y' => 'Jujuy', - 'L' => 'La Pampa', - 'F' => 'La Rioja', - 'M' => 'Mendoza', - 'N' => 'Misiones', - 'Q' => 'Neuquén', - 'R' => 'Río Negro', - 'A' => 'Salta', - 'J' => 'San Juan', - 'D' => 'San Luis', - 'Z' => 'Santa Cruz', - 'S' => 'Santa Fe', - 'G' => 'Santiago del Estero', - 'V' => 'Tierra del Fuego', - 'T' => 'Tucumán', - ); - $administrative_areas['AU'] = array( - 'ACT' => 'Australian Capital Territory', - 'NSW' => 'New South Wales', - 'NT' => 'Northern Territory', - 'QLD' => 'Queensland', - 'SA' => 'South Australia', - 'TAS' => 'Tasmania', - 'VIC' => 'Victoria', - 'WA' => 'Western Australia', - ); - $administrative_areas['BR'] = array( - 'AC' => 'Acre', - 'AL' => 'Alagoas', - 'AM' => 'Amazonas', - 'AP' => 'Amapá', - 'BA' => 'Bahia', - 'CE' => 'Ceará', - 'DF' => 'Distrito Federal', - 'ES' => 'Espírito Santo', - 'GO' => 'Goiás', - 'MA' => 'Maranhão', - 'MG' => 'Minas Gerais', - 'MS' => 'Mato Grosso do Sul', - 'MT' => 'Mato Grosso', - 'PA' => 'Pará', - 'PB' => 'Paraíba', - 'PE' => 'Pernambuco', - 'PI' => 'Piauí', - 'PR' => 'Paraná', - 'RJ' => 'Rio de Janeiro', - 'RN' => 'Rio Grande do Norte', - 'RO' => 'Rondônia', - 'RR' => 'Roraima', - 'RS' => 'Rio Grande do Sul', - 'SC' => 'Santa Catarina', - 'SE' => 'Sergipe', - 'SP' => 'São Paulo', - 'TO' => 'Tocantins', - ); - $administrative_areas['CA'] = array( - 'AB' => t('Alberta'), - 'BC' => t('British Columbia'), - 'MB' => t('Manitoba'), - 'NB' => t('New Brunswick'), - 'NL' => t('Newfoundland and Labrador'), - 'NT' => t('Northwest Territories'), - 'NS' => t('Nova Scotia'), - 'NU' => t('Nunavut'), - 'ON' => t('Ontario'), - 'PE' => t('Prince Edward Island'), - 'QC' => t('Quebec'), - 'SK' => t('Saskatchewan'), - 'YT' => t('Yukon Territory'), - ); - $administrative_areas['CL'] = array( - 'AI' => 'Aysén del General Carlos Ibáñez del Campo', - 'AN' => 'Antofagasta', - 'AR' => 'Araucanía', - 'AP' => 'Arica y Parinacota', - 'AT' => 'Atacama', - 'BI' => 'Biobío', - 'CO' => 'Coquimbo', - 'LI' => "Libertador General Bernardo O'Higgins", - 'LL' => 'Los Lagos', - 'LR' => 'Los Ríos', - 'MA' => 'Magallanes y de la Antártica Chilena', - 'ML' => 'Maule', - 'RM' => 'Metropolitana de Santiago', - 'TA' => 'Tarapacá', - 'VS' => 'Valparaíso', - ); - $administrative_areas['CN'] = array( - '34' => t('Anhui Sheng'), - '92' => t('Macau'), - '11' => t('Beijing Shi'), - '50' => t('Chongqing Shi'), - '35' => t('Fujian Sheng'), - '62' => t('Gansu Sheng'), - '44' => t('Guangdong Sheng'), - '45' => t('Guangxi Zhuangzuzizhiqu'), - '52' => t('Guizhou Sheng'), - '46' => t('Hainan Sheng'), - '13' => t('Hebei Sheng'), - '41' => t('Henan Sheng'), - '23' => t('Heilongjiang Sheng'), - '42' => t('Hubei Sheng'), - '43' => t('Hunan Sheng'), - '22' => t('Jilin Sheng'), - '32' => t('Jiangsu Sheng'), - '36' => t('Jiangxi Sheng'), - '21' => t('Liaoning Sheng'), - '15' => t('Neimenggu Zizhiqu'), - '64' => t('Ningxia Huizuzizhiqu'), - '63' => t('Qinghai Sheng'), - '37' => t('Shandong Sheng'), - '14' => t('Shanxi Sheng'), - '61' => t('Shaanxi Sheng'), - '31' => t('Shanghai Shi'), - '51' => t('Sichuan Sheng'), - '71' => t('Taiwan'), - '12' => t('Tianjin Shi'), - '54' => t('Xizang Zizhiqu'), - '91' => t('Hong Kong'), - '65' => t('Xinjiang Weiwuerzizhiqu'), - '53' => t('Yunnan Sheng'), - '33' => t('Zhejiang Sheng'), - ); - $administrative_areas['CO'] = array( - 'AMA' => 'Amazonas', - 'ANT' => 'Antioquia', - 'ARA' => 'Arauca', - 'ATL' => 'Atlántico', - 'BOL' => 'Bolívar', - 'BOY' => 'Boyacá', - 'CAL' => 'Caldas', - 'CAQ' => 'Caquetá', - 'CAS' => 'Casanare', - 'CAU' => 'Cauca', - 'CES' => 'Cesar', - 'COR' => 'Córdoba', - 'CUN' => 'Cundinamarca', - 'CHO' => 'Chocó', - 'GUA' => 'Guainía', - 'GUV' => 'Guaviare', - 'HUI' => 'Huila', - 'LAG' => 'La Guajira', - 'MAG' => 'Magdalena', - 'MET' => 'Meta', - 'NAR' => 'Nariño', - 'NSA' => 'Norte de Santander', - 'PUT' => 'Putumayo', - 'QUI' => 'Quindío', - 'RIS' => 'Risaralda', - 'SAP' => 'San Andrés, Providencia y Santa Catalina', - 'SAN' => 'Santander', - 'SUC' => 'Sucre', - 'TOL' => 'Tolima', - 'VAC' => 'Valle del Cauca', - 'VAU' => 'Vaupés', - 'VID' => 'Vichada', - ); - $administrative_areas['EE'] = array( - '37' => 'Harjumaa', - '39' => 'Hiiumaa', - '44' => 'Ida-Virumaa', - '49' => 'Jõgevamaa', - '51' => 'Järvamaa', - '57' => 'Läänemaa', - '59' => 'Lääne-Virumaa', - '65' => 'Põlvamaa', - '67' => 'Pärnumaa', - '70' => 'Raplamaa', - '74' => 'Saaremaa', - '78' => 'Tartumaa', - '82' => 'Valgamaa', - '84' => 'Viljandimaa', - '86' => 'Võrumaa', - ); - $administrative_areas['EG'] = array( - 'ALX' => t('Alexandria'), - 'ASN' => t('Aswan'), - 'AST' => t('Asyut'), - 'BH' => t('Beheira'), - 'BNS' => t('Beni Suef'), - 'C' => t('Cairo'), - 'DK' => t('Dakahlia'), - 'DT' => t('Damietta'), - 'FYM' => t('Faiyum'), - 'GH' => t('Gharbia'), - 'GZ' => t('Giza'), - 'IS' => t('Ismailia'), - 'KFS' => t('Kafr el-Sheikh'), - 'MT' => t('Matruh'), - 'MN' => t('Minya'), - 'MNF' => t('Monufia'), - 'WAD' => t('New Valley'), - 'SIN' => t('North Sinai'), - 'PTS' => t('Port Said'), - 'KB' => t('Qalyubia'), - 'KN' => t('Qena'), - 'BA' => t('Red Sea'), - 'SHR' => t('Sharqia'), - 'SHG' => t('Sohag'), - 'JS' => t('South Sinai'), - 'SUZ' => t('Suez'), - 'LX' => t('Luxor'), - ); - $administrative_areas['ES'] = array( - 'C' => "A Coruña", - 'VI' => 'Alava', - 'AB' => 'Albacete', - 'A' => 'Alicante', - 'AL' => "Almería", - 'O' => 'Asturias', - 'AV' => "Ãvila", - 'BA' => 'Badajoz', - 'PM' => 'Baleares', - 'B' => 'Barcelona', - 'BU' => 'Burgos', - 'CC' => "Cáceres", - 'CA' => "Cádiz", - 'S' => 'Cantabria', - 'CS' => "Castellón", - 'CE' => 'Ceuta', - 'CR' => 'Ciudad Real', - 'CO' => "Córdoba", - 'CU' => 'Cuenca', - 'GI' => 'Girona', - 'GR' => 'Granada', - 'GU' => 'Guadalajara', - 'SS' => "Guipúzcoa", - 'H' => 'Huelva', - 'HU' => 'Huesca', - 'J' => "Jaén", - 'LO' => 'La Rioja', - 'GC' => 'Las Palmas', - 'LE' => "León", - 'L' => "Lleida", - 'LU' => 'Lugo', - 'M' => 'Madrid', - 'MA' => "Málaga", - 'ML' => 'Melilla', - 'MU' => 'Murcia', - 'NA' => 'Navarra', - 'OR' => 'Ourense', - 'P' => 'Palencia', - 'PO' => 'Pontevedra', - 'SA' => 'Salamanca', - 'TF' => 'Santa Cruz de Tenerife', - 'SG' => 'Segovia', - 'SE' => 'Sevilla', - 'SO' => 'Soria', - 'T' => 'Tarragona', - 'TE' => 'Teruel', - 'TO' => 'Toledo', - 'V' => 'Valencia', - 'VA' => 'Valladolid', - 'BI' => 'Vizcaya', - 'ZA' => 'Zamora', - 'Z' => 'Zaragoza', - ); - $administrative_areas['HK'] = array( - // HK subdivisions have no ISO codes assigned. - 'Kowloon' => t('Kowloon'), - 'Hong Kong Island' => t('Hong Kong Island'), - 'New Territories' => t('New Territories'), - ); - $administrative_areas['ID'] = array( - 'AC' => t('Aceh'), - 'BA' => t('Bali'), - 'BB' => t('Bangka Belitung'), - 'BT' => t('Banten'), - 'BE' => t('Bengkulu'), - 'JK' => t('DKI Jakarta'), - 'YO' => t('D.I. Yogyakarta'), - 'GO' => t('Gorontalo'), - 'JA' => t('Jambi'), - 'JB' => t('Jawa Barat'), - 'JT' => t('Jawa Tengah'), - 'JI' => t('Jawa Timur'), - 'KB' => t('Kalimantan Barat'), - 'KS' => t('Kalimantan Selatan'), - 'KT' => t('Kalimantan Tengah'), - 'KI' => t('Kalimantan Timur'), - 'KR' => t('Kepulauan Riau'), - 'LA' => t('Lampung'), - 'MA' => t('Maluku'), - 'MU' => t('Maluku Utara'), - 'NB' => t('Nusa Tenggara Barat'), - 'NT' => t('Nusa Tenggara Timur'), - 'PA' => t('Papua'), - 'PB' => t('Papua Barat'), - 'RI' => t('Riau'), - 'SR' => t('Sulawesi Barat'), - 'SN' => t('Sulawesi Selatan'), - 'ST' => t('Sulawesi Tengah'), - 'SG' => t('Sulawesi Tenggara'), - 'SA' => t('Sulawesi Utara'), - 'SB' => t('Sumatera Barat'), - 'SS' => t('Sumatera Selatan'), - 'SU' => t('Sumatera Utara'), - ); - $administrative_areas['IE'] = array( - 'CW' => 'Co Carlow', - 'CN' => 'Co Cavan', - 'CE' => 'Co Clare', - 'CO' => 'Co Cork', - 'DL' => 'Co Donegal', - 'D' => 'Co Dublin', - 'D1' => 'Dublin 1', - 'D2' => 'Dublin 2', - 'D3' => 'Dublin 3', - 'D4' => 'Dublin 4', - 'D5' => 'Dublin 5', - 'D6' => 'Dublin 6', - 'D6W' => 'Dublin 6w', - 'D7' => 'Dublin 7', - 'D8' => 'Dublin 8', - 'D9' => 'Dublin 9', - 'D10' => 'Dublin 10', - 'D11' => 'Dublin 11', - 'D12' => 'Dublin 12', - 'D13' => 'Dublin 13', - 'D14' => 'Dublin 14', - 'D15' => 'Dublin 15', - 'D16' => 'Dublin 16', - 'D17' => 'Dublin 17', - 'D18' => 'Dublin 18', - 'D19' => 'Dublin 19', - 'D20' => 'Dublin 20', - 'D21' => 'Dublin 21', - 'D22' => 'Dublin 22', - 'D23' => 'Dublin 23', - 'D24' => 'Dublin 24', - 'G' => 'Co Galway', - 'KY' => 'Co Kerry', - 'KE' => 'Co Kildare', - 'KK' => 'Co Kilkenny', - 'LS' => 'Co Laois', - 'LM' => 'Co Leitrim', - 'LK' => 'Co Limerick', - 'LD' => 'Co Longford', - 'LH' => 'Co Louth', - 'MO' => 'Co Mayo', - 'MH' => 'Co Meath', - 'MN' => 'Co Monaghan', - 'OY' => 'Co Offaly', - 'RN' => 'Co Roscommon', - 'SO' => 'Co Sligo', - 'TA' => 'Co Tipperary', - 'WD' => 'Co Waterford', - 'WH' => 'Co Westmeath', - 'WX' => 'Co Wexford', - 'WW' => 'Co Wicklow', - ); - $administrative_areas['IN'] = array( - 'AP' => t('Andhra Pradesh'), - 'AR' => t('Arunachal Pradesh'), - 'AS' => t('Assam'), - 'BR' => t('Bihar'), - 'CT' => t('Chhattisgarh'), - 'GA' => t('Goa'), - 'GJ' => t('Gujarat'), - 'HP' => t('Himachal Pradesh'), - 'HR' => t('Haryana'), - 'JH' => t('Jharkhand'), - 'JK' => t('Jammu & Kashmir'), - 'KA' => t('Karnataka'), - 'KL' => t('Kerala'), - 'MH' => t('Maharashtra'), - 'MN' => t('Manipur'), - 'ML' => t('Meghalaya'), - 'MP' => t('Madhya Pradesh'), - 'MZ' => t('Mizoram'), - 'NL' => t('Nagaland'), - 'OR' => t('Odisha'), - 'PB' => t('Punjab'), - 'RJ' => t('Rajasthan'), - 'SK' => t('Sikkim'), - 'TN' => t('Tamil Nadu'), - 'TG' => t('Telangana'), - 'TR' => t('Tripura'), - 'UP' => t('Uttar Pradesh'), - 'UT' => t('Uttarakhand'), - 'WB' => t('West Bengal'), - ' ' => t('--'), - 'AN' => t('Andaman & Nicobar'), - 'CH' => t('Chandigarh'), - 'DN' => t('Dadra & Nagar Haveli'), - 'DD' => t('Daman & Diu'), - 'DL' => t('Delhi'), - 'LD' => t('Lakshadweep'), - 'PY' => t('Puducherry'), - ); - $administrative_areas['IT'] = array( - 'AG' => 'Agrigento', - 'AL' => 'Alessandria', - 'AN' => 'Ancona', - 'AO' => 'Aosta', - 'AR' => 'Arezzo', - 'AP' => 'Ascoli Piceno', - 'AT' => 'Asti', - 'AV' => 'Avellino', - 'BA' => 'Bari', - 'BT' => 'Barletta-Andria-Trani', - 'BL' => 'Belluno', - 'BN' => 'Benevento', - 'BG' => 'Bergamo', - 'BI' => 'Biella', - 'BO' => 'Bologna', - 'BZ' => 'Bolzano/Bozen', - 'BS' => 'Brescia', - 'BR' => 'Brindisi', - 'CA' => 'Cagliari', - 'CL' => 'Caltanissetta', - 'CB' => 'Campobasso', - 'CI' => 'Carbonia-Iglesias', - 'CE' => 'Caserta', - 'CT' => 'Catania', - 'CZ' => 'Catanzaro', - 'CH' => 'Chieti', - 'CO' => 'Como', - 'CS' => 'Cosenza', - 'CR' => 'Cremona', - 'KR' => 'Crotone', - 'CN' => 'Cuneo', - 'EN' => 'Enna', - 'FM' => 'Fermo', - 'FE' => 'Ferrara', - 'FI' => 'Firenze', - 'FG' => 'Foggia', - 'FC' => 'Forlì-Cesena', - 'FR' => 'Frosinone', - 'GE' => 'Genova', - 'GO' => 'Gorizia', - 'GR' => 'Grosseto', - 'IM' => 'Imperia', - 'IS' => 'Isernia', - 'AQ' => "L'Aquila", - 'SP' => 'La Spezia', - 'LT' => 'Latina', - 'LE' => 'Lecce', - 'LC' => 'Lecco', - 'LI' => 'Livorno', - 'LO' => 'Lodi', - 'LU' => 'Lucca', - 'MC' => 'Macerata', - 'MN' => 'Mantova', - 'MS' => 'Massa-Carrara', - 'MT' => 'Matera', - 'VS' => 'Medio Campidano', - 'ME' => 'Messina', - 'MI' => 'Milano', - 'MO' => 'Modena', - 'MB' => 'Monza e Brianza', - 'NA' => 'Napoli', - 'NO' => 'Novara', - 'NU' => 'Nuoro', - 'OG' => 'Ogliastra', - 'OT' => 'Olbia-Tempio', - 'OR' => 'Oristano', - 'PD' => 'Padova', - 'PA' => 'Palermo', - 'PR' => 'Parma', - 'PV' => 'Pavia', - 'PG' => 'Perugia', - 'PU' => 'Pesaro e Urbino', - 'PE' => 'Pescara', - 'PC' => 'Piacenza', - 'PI' => 'Pisa', - 'PT' => 'Pistoia', - 'PN' => 'Pordenone', - 'PZ' => 'Potenza', - 'PO' => 'Prato', - 'RG' => 'Ragusa', - 'RA' => 'Ravenna', - 'RC' => 'Reggio Calabria', - 'RE' => 'Reggio Emilia', - 'RI' => 'Rieti', - 'RN' => 'Rimini', - 'RM' => 'Roma', - 'RO' => 'Rovigo', - 'SA' => 'Salerno', - 'SS' => 'Sassari', - 'SV' => 'Savona', - 'SI' => 'Siena', - 'SR' => 'Siracusa', - 'SO' => 'Sondrio', - 'TA' => 'Taranto', - 'TE' => 'Teramo', - 'TR' => 'Terni', - 'TO' => 'Torino', - 'TP' => 'Trapani', - 'TN' => 'Trento', - 'TV' => 'Treviso', - 'TS' => 'Trieste', - 'UD' => 'Udine', - 'VA' => 'Varese', - 'VE' => 'Venezia', - 'VB' => 'Verbano-Cusio-Ossola', - 'VC' => 'Vercelli', - 'VR' => 'Verona', - 'VV' => 'Vibo Valentia', - 'VI' => 'Vicenza', - 'VT' => 'Viterbo', - ); - $administrative_areas['JM'] = array( - '13' => 'Clarendon', - '09' => 'Hanover', - '01' => 'Kingston', - '12' => 'Manchester', - '04' => 'Portland', - '02' => 'St. Andrew', - '06' => 'St. Ann', - '14' => 'St. Catherine', - '11' => 'St. Elizabeth', - '08' => 'St. James', - '05' => 'St. Mary', - '03' => 'St. Thomas', - '07' => 'Trelawny', - '10' => 'Westmoreland', - ); - $administrative_areas['JP'] = array( - '01' => t('Hokkaido'), - '02' => t('Aomori'), - '03' => t('Iwate'), - '04' => t('Miyagi'), - '05' => t('Akita'), - '06' => t('Yamagata'), - '07' => t('Fukushima'), - '08' => t('Ibaraki'), - '09' => t('Tochigi'), - '10' => t('Gunma'), - '11' => t('Saitama'), - '12' => t('Chiba'), - '13' => t('Tokyo'), - '14' => t('Kanagawa'), - '15' => t('Niigata'), - '16' => t('Toyama'), - '17' => t('Ishikawa'), - '18' => t('Fukui'), - '19' => t('Yamanashi'), - '20' => t('Nagano'), - '21' => t('Gifu'), - '22' => t('Shizuoka'), - '23' => t('Aichi'), - '24' => t('Mie'), - '25' => t('Shiga'), - '26' => t('Kyoto'), - '27' => t('Osaka'), - '28' => t('Hyogo'), - '29' => t('Nara'), - '30' => t('Wakayama'), - '31' => t('Tottori'), - '32' => t('Shimane'), - '33' => t('Okayama'), - '34' => t('Hiroshima'), - '35' => t('Yamaguchi'), - '36' => t('Tokushima'), - '37' => t('Kagawa'), - '38' => t('Ehime'), - '39' => t('Kochi'), - '40' => t('Fukuoka'), - '41' => t('Saga'), - '42' => t('Nagasaki'), - '43' => t('Kumamoto'), - '44' => t('Oita'), - '45' => t('Miyazaki'), - '46' => t('Kagoshima'), - '47' => t('Okinawa'), - ); - $administrative_areas['KR'] = array( - '11' => t('Seoul'), - '26' => t('Busan'), - '27' => t('Daegu'), - '30' => t('Daejeon'), - '29' => t('Gwangju'), - '28' => t('Incheon'), - '31' => t('Ulsan'), - '43' => t('Chungcheongbuk-do'), - '44' => t('Chungcheongnam-do'), - '42' => t('Gangwon-do'), - '41' => t('Gyeonggi-do'), - '47' => t('Gyeongsangbuk-do'), - '48' => t('Gyeongsangnam-do'), - '49' => t('Jeju-do'), - '45' => t('Jeollabuk-do'), - '46' => t('Jeollanam-do'), - '50' => t('Sejong'), - ); - $administrative_areas['KZ'] = array( - 'AST' => t('Astana'), - 'ALA' => t('Almaty'), - 'ALM' => t('Almaty region'), - 'AKM' => t('Aqmola region'), - 'AKT' => t('Aqtöbe region'), - 'ATY' => t('AtyraÅ« region'), - 'ZAP' => t('Batys Qazaqstan region'), - 'MAN' => t('MangghystaÅ« region'), - 'YUZ' => t('Ongtüstik Qazaqstan region'), - 'PAV' => t('Pavlodar region'), - 'KAR' => t('Qaraghandy region'), - 'KUS' => t('Qostanay region'), - 'KZY' => t('Qyzylorda region'), - 'VOS' => t('Shyghys Qazaqstan region'), - 'SEV' => t('Soltüstik Qazaqstan region'), - 'ZHA' => t('Zhambyl region'), - ); - $administrative_areas['MX'] = array( - 'AGU' => 'Aguascalientes', - 'BCN' => 'Baja California', - 'BCS' => 'Baja California Sur', - 'CAM' => 'Campeche', - 'CMX' => 'Ciudad de México', - 'COA' => 'Coahuila', - 'COL' => 'Colima', - 'CHP' => 'Chiapas', - 'CHH' => 'Chihuahua', - 'DUG' => 'Durango', - 'MEX' => 'Estado de México', - 'GUA' => 'Guanajuato', - 'GRO' => 'Guerrero', - 'HID' => 'Hidalgo', - 'JAL' => 'Jalisco', - 'MIC' => 'Michoacán', - 'MOR' => 'Morelos', - 'NAY' => 'Nayarit', - 'NLE' => 'Nuevo León', - 'OAX' => 'Oaxaca', - 'PUE' => 'Puebla', - 'QUE' => 'Queretaro', - 'ROO' => 'Quintana Roo', - 'SLP' => 'San Luis Potosí', - 'SIN' => 'Sinaloa', - 'SON' => 'Sonora', - 'TAB' => 'Tabasco', - 'TAM' => 'Tamaulipas', - 'TLA' => 'Tlaxcala', - 'VER' => 'Veracruz', - 'YUC' => 'Yucatán', - 'ZAC' => 'Zacatecas', - ); - $administrative_areas['MY'] = array( - '01' => t('Johor'), - '02' => t('Kedah'), - '03' => t('Kelantan'), - '14' => t('Kuala Lumpur'), - '15' => t('Labuan'), - '04' => t('Melaka'), - '05' => t('Negeri Sembilan'), - '06' => t('Pahang'), - '08' => t('Perak'), - '09' => t('Perlis'), - '07' => t('Pulau Pinang'), - '16' => t('Putrajaya'), - '12' => t('Sabah'), - '13' => t('Sarawak'), - '10' => t('Selangor'), - '11' => t('Terengganu'), - ); - $administrative_areas['PE'] = array( - 'AMA' => 'Amazonas', - 'ANC' => 'Ancash', - 'APU' => 'Apurimac', - 'ARE' => 'Arequipa', - 'AYA' => 'Ayacucho', - 'CAJ' => 'Cajamarca', - 'CAL' => 'Callao', - 'CUS' => 'Cusco', - 'HUV' => 'Huancavelica', - 'HUC' => 'Huanuco', - 'ICA' => 'Ica', - 'JUN' => 'Junin', - 'LAL' => 'La Libertad', - 'LAM' => 'Lambayeque', - 'LIM' => 'Lima', - 'LOR' => 'Loreto', - 'MDD' => 'Madre de Dios', - 'MOQ' => 'Moquegua', - 'PAS' => 'Pasco', - 'PIU' => 'Piura', - 'PUN' => 'Puno', - 'SAM' => 'San Martin', - 'TAC' => 'Tacna', - 'TUM' => 'Tumbes', - 'UCA' => 'Ucayali', - ); - $administrative_areas['PH'] = array( - 'ABR' => 'Abra', - 'AGN' => 'Agusan del Norte', - 'AGS' => 'Agusan del Sur', - 'AKL' => 'Aklan', - 'ALB' => 'Albay', - 'ANT' => 'Antique', - 'APA' => 'Apayao', - 'AUR' => 'Aurora', - 'BAS' => 'Basilan', - 'BAN' => 'Bataan', - 'BTN' => 'Batanes', - 'BTG' => 'Batangas', - 'BEN' => 'Benguet', - 'BIL' => 'Biliran', - 'BOH' => 'Bohol', - 'BUK' => 'Bukidnon', - 'BUL' => 'Bulacan', - 'CAG' => 'Cagayan', - 'CAN' => 'Camarines Norte', - 'CAS' => 'Camarines Sur', - 'CAM' => 'Camiguin', - 'CAP' => 'Capiz', - 'CAT' => 'Catanduanes', - 'CAV' => 'Cavite', - 'CEB' => 'Cebu', - 'COM' => 'Compostela Valley', - 'NCO' => 'Cotabato', - 'DAV' => 'Davao del Norte', - 'DAS' => 'Davao del Sur', - 'a9d' => 'Davao Occidental', - 'DAO' => 'Davao Oriental', - 'DIN' => 'Dinagat Islands', - 'EAS' => 'Eastern Samar', - 'GUI' => 'Guimaras', - 'IFU' => 'Ifugao', - 'ILN' => 'Ilocos Norte', - 'ILS' => 'Ilocos Sur', - 'ILI' => 'Iloilo', - 'ISA' => 'Isabela', - 'KAL' => 'Kalinga', - 'LUN' => 'La Union', - 'LAG' => 'Laguna', - 'LAN' => 'Lanao del Norte', - 'LAS' => 'Lanao del Sur', - 'LEY' => 'Leyte', - 'MAG' => 'Maguindanao', - 'MAD' => 'Marinduque', - 'MAS' => 'Masbate', - '00' => 'Metro Manila', - 'MDC' => 'Mindoro Occidental', - 'MDR' => 'Mindoro Oriental', - 'MSC' => 'Misamis Occidental', - 'MSR' => 'Misamis Oriental', - 'MOU' => 'Mountain Province', - 'NEC' => 'Negros Occidental', - 'NER' => 'Negros Oriental', - 'NSA' => 'Northern Samar', - 'NUE' => 'Nueva Ecija', - 'NUV' => 'Nueva Vizcaya', - 'PLW' => 'Palawan', - 'PAM' => 'Pampanga', - 'PAN' => 'Pangasinan', - 'QUE' => 'Quezon Province', - 'QUI' => 'Quirino', - 'RIZ' => 'Rizal', - 'ROM' => 'Romblon', - 'WSA' => 'Samar', - 'SAR' => 'Sarangani', - 'SIG' => 'Siquijor', - 'SOR' => 'Sorsogon', - 'SCO' => 'South Cotabato', - 'SLE' => 'Southern Leyte', - 'SUK' => 'Sultan Kudarat', - 'SLU' => 'Sulu', - 'SUN' => 'Surigao del Norte', - 'SUR' => 'Surigao del Sur', - 'TAR' => 'Tarlac', - 'TAW' => 'Tawi-Tawi', - 'ZMB' => 'Zambales', - 'ZAN' => 'Zamboanga del Norte', - 'ZAS' => 'Zamboanga del Sur', - 'ZSI' => 'Zamboanga Sibuguey', - ); - $administrative_areas['RU'] = array( - 'MOW' => t('Moskva'), - 'SPE' => t('Sankt-Peterburg'), - 'AD' => t('Adygeya, Respublika'), - 'AL' => t('Altay, Respublika'), - 'BA' => t('Bashkortostan, Respublika'), - 'BU' => t('Buryatiya, Respublika'), - 'CE' => t('Chechenskaya Respublika'), - 'CU' => t('Chuvashskaya Respublika'), - 'DA' => t('Dagestan, Respublika'), - 'IN' => t('Ingushetiya, Respublika'), - 'KB' => t('Kabardino-Balkarskaya Respublika'), - 'KL' => t('Kalmykiya, Respublika'), - 'KC' => t('Karachayevo-Cherkesskaya Respublika'), - 'KR' => t('Kareliya, Respublika'), - 'KK' => t('Khakasiya, Respublika'), - 'KO' => t('Komi, Respublika'), - 'ME' => t('Mariy El, Respublika'), - 'MO' => t('Mordoviya, Respublika'), - 'SA' => t('Sakha, Respublika [Yakutiya]'), - 'SE' => t('Severnaya Osetiya-Alaniya, Respublika'), - 'TA' => t('Tatarstan, Respublika'), - 'TY' => t('Tyva, Respublika [Tuva]'), - 'UD' => t('Udmurtskaya Respublika'), - 'ALT' => t('Altayskiy kray'), - 'KAM' => t('Kamchatskiy kray'), - 'KHA' => t('Khabarovskiy kray'), - 'KDA' => t('Krasnodarskiy kray'), - 'KYA' => t('Krasnoyarskiy kray'), - 'PER' => t('Permskiy kray'), - 'PRI' => t('Primorskiy kray'), - 'STA' => t('Stavropolskiy kray'), - 'ZAB' => t('Zabaykalskiy kray'), - 'AMU' => t('Amurskaya oblast'), - 'ARK' => t('Arkhangelskaya oblast'), - 'AST' => t('Astrakhanskaya oblast'), - 'BEL' => t('Belgorodskaya oblast'), - 'BRY' => t('Bryanskaya oblast'), - 'CHE' => t('Chelyabinskaya oblast'), - 'IRK' => t('Irkutskaya oblast'), - 'IVA' => t('Ivanovskaya oblast'), - 'KGD' => t('Kaliningradskaya oblast'), - 'KLU' => t('Kaluzhskaya oblast'), - 'KEM' => t('Kemerovskaya oblast'), - 'KIR' => t('Kirovskaya oblast'), - 'KOS' => t('Kostromskaya oblast'), - 'KGN' => t('Kurganskaya oblast'), - 'KRS' => t('Kurskaya oblast'), - 'LEN' => t('Leningradskaya oblast'), - 'LIP' => t('Lipetskaya oblast'), - 'MAG' => t('Magadanskaya oblast'), - 'MOS' => t('Moskovskaya oblast'), - 'MUR' => t('Murmanskaya oblast'), - 'NIZ' => t('Nizhegorodskaya oblast'), - 'NGR' => t('Novgorodskaya oblast'), - 'NVS' => t('Novosibirskaya oblast'), - 'OMS' => t('Omskaya oblast'), - 'ORE' => t('Orenburgskaya oblast'), - 'ORL' => t('Orlovskaya oblast'), - 'PNZ' => t('Penzenskaya oblast'), - 'PSK' => t('Pskovskaya oblast'), - 'ROS' => t('Rostovskaya oblast'), - 'RYA' => t('Ryazanskaya oblast'), - 'SAK' => t('Sakhalinskaya oblast'), - 'SAM' => t('Samarskaya oblast'), - 'SAR' => t('Saratovskaya oblast'), - 'SMO' => t('Smolenskaya oblast'), - 'SVE' => t('Sverdlovskaya oblast'), - 'TAM' => t('Tambovskaya oblast'), - 'TOM' => t('Tomskaya oblast'), - 'TUL' => t('Tulskaya oblast'), - 'TVE' => t('Tverskaya oblast'), - 'TYU' => t('Tyumenskaya oblast'), - 'ULY' => t('Ulyanovskaya oblast'), - 'VLA' => t('Vladimirskaya oblast'), - 'VGG' => t('Volgogradskaya oblast'), - 'VLG' => t('Vologodskaya oblast'), - 'VOR' => t('Voronezhskaya oblast'), - 'YAR' => t('Yaroslavskaya oblast'), - 'YEV' => t('Yevreyskaya avtonomnaya oblast'), - 'CHU' => t('Chukotskiy avtonomnyy okrug'), - 'KHM' => t('Khanty-Mansiyskiy avtonomnyy okrug-Yugra'), - 'NEN' => t('Nenetskiy avtonomnyy okrug'), - 'YAN' => t('Yamalo-Nenetskiy avtonomnyy okrug'), - ); - $administrative_areas['TR'] = array( - '01' => t('Adana'), - '02' => t('Adıyaman'), - '03' => t('Afyon'), - '04' => t('AÄŸrı'), - '68' => t('Aksaray'), - '05' => t('Amasya'), - '06' => t('Ankara'), - '07' => t('Antalya'), - '75' => t('Ardahan'), - '08' => t('Artvin'), - '09' => t('Aydın'), - '10' => t('Balıkesir'), - '74' => t('Bartın'), - '72' => t('Batman'), - '69' => t('Bayburt'), - '11' => t('Bilecik'), - '12' => t('Bingöl'), - '13' => t('Bitlis'), - '14' => t('Bolu'), - '15' => t('Burdur'), - '16' => t('Bursa'), - '17' => t('Çanakkale'), - '18' => t('Çankırı'), - '19' => t('Çorum'), - '20' => t('Denizli'), - '21' => t('Diyarbakır'), - '81' => t('Düzce'), - '22' => t('Edirne'), - '23' => t('Elazığ'), - '24' => t('Erzincan'), - '25' => t('Erzurum'), - '26' => t('EskiÅŸehir'), - '27' => t('Gaziantep'), - '28' => t('Giresun'), - '29' => t('Gümüşhane'), - '30' => t('Hakkari'), - '31' => t('Hatay'), - '76' => t('IÄŸdır'), - '32' => t('Isparta'), - '34' => t('Ä°stanbul'), - '35' => t('Ä°zmir'), - '46' => t('KahramanmaraÅŸ'), - '78' => t('Karabük'), - '70' => t('Karaman'), - '36' => t('Kars'), - '37' => t('Kastamonu'), - '38' => t('Kayseri'), - '71' => t('Kırıkkale'), - '39' => t('Kırklareli'), - '40' => t('KırÅŸehir'), - '79' => t('Kilis'), - '41' => t('Kocaeli'), - '42' => t('Konya'), - '43' => t('Kütahya'), - '44' => t('Malatya'), - '45' => t('Manisa'), - '47' => t('Mardin'), - '33' => t('Mersin'), - '48' => t('MuÄŸla'), - '49' => t('MuÅŸ'), - '50' => t('NevÅŸehir'), - '51' => t('NiÄŸde'), - '52' => t('Ordu'), - '80' => t('Osmaniye'), - '53' => t('Rize'), - '54' => t('Sakarya'), - '55' => t('Samsun'), - '56' => t('Siirt'), - '57' => t('Sinop'), - '58' => t('Sivas'), - '63' => t('Åžanlıurfa'), - '73' => t('Şırnak'), - '59' => t('TekirdaÄŸ'), - '60' => t('Tokat'), - '61' => t('Trabzon'), - '62' => t('Tunceli'), - '64' => t('UÅŸak'), - '65' => t('Van'), - '77' => t('Yalova'), - '66' => t('Yozgat'), - '67' => t('Zonguldak'), - ); - $administrative_areas['TW'] = array( - 'TXG' => t('Taichung City'), - 'TPE' => t('Taipei City'), - 'TTT' => t('Taitung County'), - 'TNN' => t('Tainan City'), - 'ILA' => t('Yilan County'), - 'HUA' => t('Hualien County'), - 'Kinmen County' => t('Kinmen County'), - 'NAN' => t('Nantou County'), - 'PIF' => t('Pingtung County'), - 'MIA' => t('Miaoli County'), - 'TAO' => t('Taoyuan County'), - 'KHH' => t('Kaohsiung City'), - 'KEE' => t('Keelung City'), - 'Lienchiang County' => t('Lienchiang County'), - 'YUN' => t('Yunlin County'), - 'TPQ' => t('New Taipei City'), - 'HSZ' => t('Hsinchu City'), - 'HSQ' => t('Hsinchu County'), - 'CYI' => t('Chiayi City'), - 'CYQ' => t('Chiayi County'), - 'CHA' => t('Changhua County'), - 'PEN' => t('Penghu County'), - ); - $administrative_areas['UA'] = array( - '43' => t('Crimea'), - '05' => t("Vinnyts'ka oblast"), - '07' => t("Volyns'ka oblast"), - '12' => t('Dnipropetrovsk Oblast'), - '14' => t('Donetsk Oblast'), - '18' => t("Zhytomyrs'ka oblast"), - '21' => t("Zakarpats'ka oblast"), - '23' => t("Zaporiz'ka oblast"), - '26' => t("Ivano-Frankivs'ka oblast"), - '30' => t('Kyiv Oblast'), - '35' => t("Kirovohrads'ka oblast"), - '09' => t("Luhans'ka oblast"), - '46' => t('Lviv Oblast'), - '48' => t("Mykolaivs'ka oblast"), - '51' => t('Odessa Oblast'), - '53' => t("Poltavs'ka oblast"), - '56' => t("Rivnens'ka oblast"), - '40' => t("Sevastopol' city"), - '59' => t("Sums'ka oblast"), - '61' => t("Ternopil's'ka oblast"), - '63' => t('Kharkiv Oblast'), - '65' => t("Khersons'ka oblast"), - '68' => t("Khmel'nyts'ka oblast"), - '71' => t("Cherkas'ka oblast"), - '77' => t("Chernivets'ka oblast"), - '74' => t("Chernihivs'ka oblast"), - ); - $administrative_areas['US'] = array( - 'AL' => t('Alabama'), - 'AK' => t('Alaska'), - 'AZ' => t('Arizona'), - 'AR' => t('Arkansas'), - 'CA' => t('California'), - 'CO' => t('Colorado'), - 'CT' => t('Connecticut'), - 'DE' => t('Delaware'), - 'DC' => t('District of Columbia'), - 'FL' => t('Florida'), - 'GA' => t('Georgia'), - 'HI' => t('Hawaii'), - 'ID' => t('Idaho'), - 'IL' => t('Illinois'), - 'IN' => t('Indiana'), - 'IA' => t('Iowa'), - 'KS' => t('Kansas'), - 'KY' => t('Kentucky'), - 'LA' => t('Louisiana'), - 'ME' => t('Maine'), - 'MD' => t('Maryland'), - 'MA' => t('Massachusetts'), - 'MI' => t('Michigan'), - 'MN' => t('Minnesota'), - 'MS' => t('Mississippi'), - 'MO' => t('Missouri'), - 'MT' => t('Montana'), - 'NE' => t('Nebraska'), - 'NV' => t('Nevada'), - 'NH' => t('New Hampshire'), - 'NJ' => t('New Jersey'), - 'NM' => t('New Mexico'), - 'NY' => t('New York'), - 'NC' => t('North Carolina'), - 'ND' => t('North Dakota'), - 'OH' => t('Ohio'), - 'OK' => t('Oklahoma'), - 'OR' => t('Oregon'), - 'PA' => t('Pennsylvania'), - 'RI' => t('Rhode Island'), - 'SC' => t('South Carolina'), - 'SD' => t('South Dakota'), - 'TN' => t('Tennessee'), - 'TX' => t('Texas'), - 'UT' => t('Utah'), - 'VT' => t('Vermont'), - 'VA' => t('Virginia'), - 'WA' => t('Washington'), - 'WV' => t('West Virginia'), - 'WI' => t('Wisconsin'), - 'WY' => t('Wyoming'), - ' ' => t('--'), - 'AA' => t('Armed Forces (Americas)'), - 'AE' => t('Armed Forces (Europe, Canada, Middle East, Africa)'), - 'AP' => t('Armed Forces (Pacific)'), - 'AS' => t('American Samoa'), - 'FM' => t('Federated States of Micronesia'), - 'GU' => t('Guam'), - 'MH' => t('Marshall Islands'), - 'MP' => t('Northern Mariana Islands'), - 'PW' => t('Palau'), - 'PR' => t('Puerto Rico'), - 'VI' => t('Virgin Islands'), - ); - $administrative_areas['VE'] = array( - 'Z' => 'Amazonas', - 'B' => 'Anzoátegui', - 'C' => 'Apure', - 'D' => 'Aragua', - 'E' => 'Barinas', - 'F' => 'Bolívar', - 'G' => 'Carabobo', - 'H' => 'Cojedes', - 'Y' => 'Delta Amacuro', - 'W' => 'Dependencias Federales', - 'A' => 'Distrito Federal', - 'I' => 'Falcón', - 'J' => 'Guárico', - 'K' => 'Lara', - 'L' => 'Mérida', - 'M' => 'Miranda', - 'N' => 'Monagas', - 'O' => 'Nueva Esparta', - 'P' => 'Portuguesa', - 'R' => 'Sucre', - 'S' => 'Táchira', - 'T' => 'Trujillo', - 'X' => 'Vargas', - 'U' => 'Yaracuy', - 'V' => 'Zulia', - ); - - return $administrative_areas; -} diff --git a/html/sites/all/modules/contrib/addressfield/addressfield.api.php b/html/sites/all/modules/contrib/addressfield/addressfield.api.php deleted file mode 100644 index b52b9503a..000000000 --- a/html/sites/all/modules/contrib/addressfield/addressfield.api.php +++ /dev/null @@ -1,114 +0,0 @@ - t('Aland'), - 'B' => t('Bland'), - ); -} - -/** - * Allows modules to add arbitrary AJAX commands to the array returned from the - * standard address field widget refresh. - * - * @param &$commands - * The array of AJAX commands used to refresh the address field widget. - * @param $form - * The rebuilt form array. - * @param $form_state - * The form state array from the form. - * - * @see addressfield_standard_widget_refresh() - */ -function hook_addressfield_standard_widget_refresh_alter(&$commands, $form, $form_state) { - // Display an alert message. - $commands[] = ajax_command_alert(t('The address field widget has been updated.')); -} diff --git a/html/sites/all/modules/contrib/addressfield/addressfield.css b/html/sites/all/modules/contrib/addressfield/addressfield.css deleted file mode 100644 index 3d7fd40d2..000000000 --- a/html/sites/all/modules/contrib/addressfield/addressfield.css +++ /dev/null @@ -1,26 +0,0 @@ -div.addressfield-container-inline > div.form-item { - float: left; /* LTR */ - margin-right: 1em; /* LTR */ -} - -div.addressfield-container-inline.country-GB > div.form-item { - float: none; - margin-right: auto; /* LTR */ -} - -/* Clear-fix markup for the inline container */ -div.addressfield-container-inline:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -} -/* IE6 */ -* html div.addressfield-container-inline { - height: 1%; -} -/* IE7 */ -*:first-child + html div.addressfield-container-inline { - min-height: 1%; -} diff --git a/html/sites/all/modules/contrib/addressfield/addressfield.devel_generate.inc b/html/sites/all/modules/contrib/addressfield/addressfield.devel_generate.inc deleted file mode 100644 index f72daccbc..000000000 --- a/html/sites/all/modules/contrib/addressfield/addressfield.devel_generate.inc +++ /dev/null @@ -1,65 +0,0 @@ - ($country == 'NULL') ? NULL : trim($country), - 'administrative_area' => ($administrative_area == 'NULL') ? NULL : trim($administrative_area), - 'sub_administrative_area' => ($sub_administrative_area == 'NULL') ? NULL : trim($sub_administrative_area), - 'locality' => ($locality == 'NULL') ? NULL : trim($locality), - 'dependent_locality' => ($dependent_locality == 'NULL') ? NULL : trim($dependent_locality), - 'postal_code' => ($postal_code == 'NULL') ? NULL : trim($postal_code), - 'thoroughfare' => ($thoroughfare == 'NULL') ? NULL : trim($thoroughfare), - 'premise' => ($premise == 'NULL') ? NULL : trim($premise), - 'sub_premise' => ($sub_premise == 'NULL') ? NULL : trim($sub_premise), - ); - } - } - fclose($handle); - } - } - return $fields; -} diff --git a/html/sites/all/modules/contrib/addressfield/addressfield.feeds.inc b/html/sites/all/modules/contrib/addressfield/addressfield.feeds.inc deleted file mode 100644 index 695f838d4..000000000 --- a/html/sites/all/modules/contrib/addressfield/addressfield.feeds.inc +++ /dev/null @@ -1,73 +0,0 @@ - $instance) { - $info = field_info_field($name); - if ($info['type'] == 'addressfield') { - foreach ($info['columns'] as $sub_field => $schema_info) { - $name_label = $instance['label'] . ': ' . drupal_ucfirst(str_replace('_', ' ', $sub_field)); - $targets[$name . ':' . $sub_field] = array( - 'name' => $name_label, - 'callback' => 'addressfield_set_target', - 'real_target' => $info['field_name'], - 'description' => $schema_info['description'], - ); - } - } - } -} - -/** - * Callback for hook_feeds_processor_targets_alter(). - * - * @param $source - * Field mapper source settings. - * @param $entity - * An entity object, for instance a node object. - * @param $target - * A string identifying the target on the node. - * @param $values - * The value to populate the target with. - * @param array $mapping - * Associative array of the mapping settings from the per mapping - * configuration form. - */ -function addressfield_set_target($source, $entity, $target, $values, $mapping) { - $language = $mapping['language']; - list($field_name, $sub_field) = explode(':', $target, 2); - - // Field info and instance are required for setting default values. - $entity_type = $source->importer->processor->entityType(); - list(, , $bundle_name) = entity_extract_ids($entity_type, $entity); - $info = field_info_field($field_name); - $instance = field_info_instance($entity_type, $field_name, $bundle_name); - - // Convert the values into an array if it isn't one already to correspond to - // Drupal's handling of field value arrays. - if (!is_array($values)) { - $values = array($values); - } - - // If the field is already set on the given entity, update the existing value - // array. Otherwise start with a fresh field value array. - $field = isset($entity->{$field_name}) ? $entity->{$field_name} : array(); - - // Loop over the field values array... - foreach ($values as $delta => $value) { - // Set defaults for new values. - if (!isset($field[$language][$delta])) { - $field[$language][$delta] = addressfield_default_values($info, $instance); - } - $field[$language][$delta][$sub_field] = $value; - } - - $entity->{$field_name} = $field; -} diff --git a/html/sites/all/modules/contrib/addressfield/addressfield.info b/html/sites/all/modules/contrib/addressfield/addressfield.info deleted file mode 100644 index 3ed18f060..000000000 --- a/html/sites/all/modules/contrib/addressfield/addressfield.info +++ /dev/null @@ -1,17 +0,0 @@ -name = Address Field -description = Manage a flexible address field, implementing the xNAL standard. -core = 7.x -package = Fields - -dependencies[] = ctools - -files[] = addressfield.migrate.inc -files[] = views/addressfield_views_handler_field_administrative_area.inc -files[] = views/addressfield_views_handler_field_country.inc -files[] = views/addressfield_views_handler_filter_country.inc - -; Information added by Drupal.org packaging script on 2018-10-26 -version = "7.x-1.3" -core = "7.x" -project = "addressfield" -datestamp = "1540579391" diff --git a/html/sites/all/modules/contrib/addressfield/addressfield.install b/html/sites/all/modules/contrib/addressfield/addressfield.install deleted file mode 100644 index 3d0c83559..000000000 --- a/html/sites/all/modules/contrib/addressfield/addressfield.install +++ /dev/null @@ -1,216 +0,0 @@ - array( - 'description' => 'Two letter ISO country code of this address.', - 'type' => 'varchar', - 'length' => 2, - 'not null' => FALSE, - 'default' => '', - ), - 'administrative_area' => array( - 'description' => 'The administrative area of this address. (i.e. State/Province)', - 'type' => 'varchar', - 'length' => 255, - 'default' => '', - 'not null' => FALSE, - ), - 'sub_administrative_area' => array( - 'description' => 'The sub administrative area of this address.', - 'type' => 'varchar', - 'length' => 255, - 'default' => '', - 'not null' => FALSE, - ), - 'locality' => array( - 'description' => 'The locality of this address. (i.e. City)', - 'type' => 'varchar', - 'length' => 255, - 'default' => '', - 'not null' => FALSE, - ), - 'dependent_locality' => array( - 'description' => 'The dependent locality of this address.', - 'type' => 'varchar', - 'length' => 255, - 'default' => '', - 'not null' => FALSE, - ), - 'postal_code' => array( - 'description' => 'The postal code of this address.', - 'type' => 'varchar', - 'length' => 255, - 'default' => '', - 'not null' => FALSE, - ), - 'thoroughfare' => array( - 'description' => 'The thoroughfare of this address. (i.e. Street address)', - 'type' => 'varchar', - 'length' => 255, - 'default' => '', - 'not null' => FALSE, - ), - 'premise' => array( - 'description' => 'The premise of this address. (i.e. Apartment / Suite number)', - 'type' => 'varchar', - 'length' => 255, - 'default' => '', - 'not null' => FALSE, - ), - 'sub_premise' => array( - 'description' => 'The sub_premise of this address.', - 'type' => 'varchar', - 'length' => 255, - 'default' => '', - 'not null' => FALSE, - ), - 'organisation_name' => array( - 'description' => 'Contents of a primary OrganisationName element in the xNL XML.', - 'type' => 'varchar', - 'length' => 255, - 'not null' => FALSE, - 'default' => '', - ), - 'name_line' => array( - 'description' => 'Contents of a primary NameLine element in the xNL XML.', - 'type' => 'varchar', - 'length' => 255, - 'not null' => FALSE, - 'default' => '', - ), - 'first_name' => array( - 'description' => 'Contents of the FirstName element of a primary PersonName element in the xNL XML.', - 'type' => 'varchar', - 'length' => 255, - 'not null' => FALSE, - 'default' => '', - ), - 'last_name' => array( - 'description' => 'Contents of the LastName element of a primary PersonName element in the xNL XML.', - 'type' => 'varchar', - 'length' => 255, - 'not null' => FALSE, - 'default' => '', - ), - 'data' => array( - 'description' => 'Additional data for this address.', - 'type' => 'text', - 'size' => 'big', - 'not null' => FALSE, - 'serialize' => TRUE, - ), - ); - - return array( - 'columns' => $columns, - // TODO Add indexes. - ); -} - -/** - * Update the field configuration to the new plugin structure. - */ -function addressfield_update_7000() { - // Enable ctools. - if (!module_enable(array('ctools'))) { - throw new Exception('This version of addressfield requires ctools, but it could not be enabled.'); - } - - // Get the list of fields of type 'addressfield'. - $address_fields = array(); - foreach (field_info_fields() as $field_name => $field_info) { - if ($field_info['type'] == 'addressfield') { - $address_fields[$field_name] = $field_name; - } - } - - foreach (field_info_instances() as $entity_type => $bundles) { - foreach ($bundles as $bundle_name => $instances) { - foreach (array_intersect_key($instances, $address_fields) as $field_name => $instance) { - $widget_settings = &$instance['widget']['settings']; - - if ($instance['widget']['type'] == 'addressfield_standard') { - // Default to use the country-based address widget. - $format_handlers = array('address'); - - // Map the old 'name_format' setting to the name and organization widgets. - if (in_array($widget_settings['name_format'], array('name_line_organisation', 'first_last_organisation'))) { - $format_handlers[] = 'organisation'; - } - if (in_array($widget_settings['name_format'], array('name_line', 'name_line_organisation'))) { - $format_handlers[] = 'name-oneline'; - } - else { - $format_handlers[] = 'name-full'; - } - unset($widget_settings['name_format']); - $widget_settings['format_handlers'] = $format_handlers; - } - - // Update displays. - foreach ($instance['display'] as $view_mode => &$view_mode_info) { - $display_settings = &$view_mode_info['settings']; - - if ($view_mode_info['type'] == 'addressfield_default') { - if (isset($widget_settings['format_handlers'])) { - $display_settings['use_widget_handlers'] = 1; - } - else { - // If the widget is non-standard, just use a sane default. - $display_settings['use_widget_handlers'] = 0; - $display_settings['format_handlers'] = array('address', 'name-oneline'); - } - } - else if ($view_mode_info['type'] == 'addressfield_name') { - // Migrate the 'addressfield_name' formatter to the new framework. - $view_mode_info['type'] = 'addressfield_default'; - // Start from the widget configuration. - $display_settings['use_widget_handlers'] = 0; - $display_settings['format_handlers'] = isset($widget_settings['format_handlers']) ? $widget_settings['format_handlers'] : array('address', 'name-oneline'); - - if (empty($display_settings['organisation'])) { - $display_settings['format_handlers'] = array_diff( $display_settings['format_handlers'], array('organisation')); - } - unset($display_settings['organisation']); - } - } - - field_update_instance($instance); - } - } - } -} - -/** - * Sets the value of the new "Default country" setting. - */ -function addressfield_update_7001() { - $address_fields = array(); - foreach (field_info_fields() as $field_name => $field_info) { - if ($field_info['type'] == 'addressfield') { - $address_fields[$field_name] = $field_name; - } - } - - foreach (field_info_instances() as $entity_type => $bundles) { - foreach ($bundles as $bundle_name => $instances) { - foreach (array_intersect_key($instances, $address_fields) as $field_name => $instance) { - // Optional fields get the None default. Required fields get the - // previously selected default country. - $default_country = ''; - if (!empty($instance['required']) && !empty($instance['default_value'])) { - $default_country = $instance['default_value'][0]['country']; - } - - $instance['widget']['settings']['default_country'] = $default_country; - unset($instance['default_value']); - - field_update_instance($instance); - } - } - } -} diff --git a/html/sites/all/modules/contrib/addressfield/addressfield.migrate.inc b/html/sites/all/modules/contrib/addressfield/addressfield.migrate.inc deleted file mode 100644 index f88536bb3..000000000 --- a/html/sites/all/modules/contrib/addressfield/addressfield.migrate.inc +++ /dev/null @@ -1,177 +0,0 @@ - 2, - 'field handlers' => array('MigrateAddressFieldHandler'), - ); - return $api; -} - -/** - * Primary value passed to this field must be the two letter ISO country code of - * the address. - * - * Arguments are used to specify all the other values: - * 'administrative_area' - The administrative area of this address. (i.e. State/Province) - * 'sub_administrative_area' - The sub administrative area of this address. - * 'locality' - The locality of this address. (i.e. City) - * 'dependent_locality' - The dependent locality of this address. - * 'postal_code' - The postal code of this address. - * 'thoroughfare' - The thoroughfare of this address. (i.e. Street address) - * 'premise' - The premise of this address. (i.e. Apartment / Suite number) - * 'sub_premise' - The sub_premise of this address. - * 'organisation_name' - Contents of a primary OrganisationName element in the xNL XML. - * 'name_line' - Contents of a primary NameLine element in the xNL XML. - * 'first_name' - Contents of the FirstName element of a primary PersonName element in the xNL XML. - * 'last_name' - Contents of the LastName element of a primary PersonName element in the xNL XML. - * 'data' - Additional data for this address. - * - * Add the source field mappings to the argument array then add null mappings to - * avoid having fields flagged as as unmapped: - * @code - * // The country should be passed in as the primary value. - * $this->addFieldMapping('field_address', 'profile_country'); - * $this->addFieldMapping('field_address:thoroughfare', 'profile_address'); - * $this->addFieldMapping('field_address:locality', 'profile_city'); - * $this->addFieldMapping('field_address:administrative_area', 'profile_state'); - * @endcode - */ -class MigrateAddressFieldHandler extends MigrateFieldHandler { - public function __construct() { - $this->registerTypes(array('addressfield')); - } - - /** - * Provide subfields for the addressfield columns. - */ - public function fields() { - // Declare our arguments to also be available as subfields. - $fields = array( - 'administrative_area' => t('The administrative area of ' . - 'this address (i.e. State/Province)', - array('@doc' => 'http://drupal.org/node/1996546#administrative_area')), - 'sub_administrative_area' => t('The sub administrative ' . - 'area of this address', - array('@doc' => 'http://drupal.org/node/1996546#sub_administrative_area')), - 'locality' => t('The locality of this address (i.e. ' . - 'City)', - array('@doc' => 'http://drupal.org/node/1996546#locality')), - 'dependent_locality' => t('The dependent locality of ' . - 'this address', - array('@doc' => 'http://drupal.org/node/1996546#dependent_locality')), - 'postal_code' => t('The postal code of this address', - array('@doc' => 'http://drupal.org/node/1996546#postal_code')), - 'thoroughfare' => t('The thoroughfare of this address ' . - '(i.e. Street address)', - array('@doc' => 'http://drupal.org/node/1996546#thoroughfare')), - 'premise' => t('The premise of this address (i.e. Apartment / Suite number)', - array('@doc' => 'http://drupal.org/node/1996546#premise')), - 'sub_premise' => t('The sub_premise of this address', - array('@doc' => 'http://drupal.org/node/1996546#sub_premise')), - 'organisation_name' => t('Contents of a primary ' . - 'OrganisationName element in the xNL XML', - array('@doc' => 'http://drupal.org/node/1996546#organisation_name')), - 'name_line' => t('Contents of a primary NameLine element ' . - 'in the xNL XML', - array('@doc' => 'http://drupal.org/node/1996546#name_line')), - 'first_name' => t('Contents of the FirstName element of ' . - 'a primary PersonName element in the xNL XML', - array('@doc' => 'http://drupal.org/node/1996546#first_name')), - 'last_name' => t('Contents of the LastName element of a ' . - 'primary PersonName element in the xNL XML', - array('@doc' => 'http://drupal.org/node/1996546#last_name')), - 'data' => t('Additional data for this address', - array('@doc' => 'http://drupal.org/node/1996546#data')), - ); - return $fields; - } - - /** - * Implements MigrateFieldHandler::prepare(). - * - * @param $entity - * @param array $field_info - * @param array $instance - * @param array $values - * - * @return null - */ - public function prepare($entity, array $field_info, array $instance, - array $values) { - $arguments = array(); - if (isset($values['arguments'])) { - $arguments = array_filter($values['arguments']); - unset($values['arguments']); - } - $language = $this->getFieldLanguage($entity, $field_info, $arguments); - - // Setup the standard Field API array for saving. - $delta = 0; - foreach ($values as $value) { - $return[$language][$delta] = array('country' => $value) - + $this->prepareArguments($arguments, $field_info, $delta); - $delta++; - } - - return isset($return) ? $return : NULL; - } - - /** - * Builds an array with additional data for the current $delta. - * - * @param array $arguments - * @param array $field_info - * @param $delta - * - * @return array - */ - protected function prepareArguments(array $arguments, array $field_info, $delta) { - $result = array(); - $data = array(); - - foreach ($arguments as $column_key => $column_value) { - $value = NULL; - - if (is_array($arguments[$column_key])) { - if (!empty($arguments[$column_key][$delta])) { - $value = $arguments[$column_key][$delta]; - } - } - else { - $value = $arguments[$column_key]; - } - - if ($value) { - if (isset($field_info['columns'][$column_key])) { - // Store the data in a separate column. - $result[$column_key] = $value; - } - else { - // Add the data to the 'data' column. - $data[$column_key] = $value; - } - } - } - - // Store all the other data as a serialized array in the data field. - if (!empty($data)) { - $result['data'] = serialize($data); - } - - return $result; - } -} diff --git a/html/sites/all/modules/contrib/addressfield/addressfield.module b/html/sites/all/modules/contrib/addressfield/addressfield.module deleted file mode 100644 index bf0bf701f..000000000 --- a/html/sites/all/modules/contrib/addressfield/addressfield.module +++ /dev/null @@ -1,939 +0,0 @@ - TRUE, - ); - return $plugins; -} - -/** - * Implements hook_views_api(). - */ -function addressfield_views_api() { - return array( - 'api' => 3, - 'path' => drupal_get_path('module', 'addressfield') . '/views', - ); -} - -/** - * Implements hook_module_implements_alter(). - * - * Moves the hook_token_info_alter() implementation to the bottom so it is - * invoked after all modules implementing the same hook. - */ -function addressfield_module_implements_alter(&$implementations, $hook) { - if ($hook == 'token_info_alter') { - // Make sure that the $implementations list is populated before altering it, - // to work around a crash experienced by some people (#2181001). - if (isset($implementations['addressfield'])) { - $group = $implementations['addressfield']; - unset($implementations['addressfield']); - $implementations['addressfield'] = $group; - } - } -} - -/** - * Returns a list of address fields optionally filtered by entity type. - * - * @param string $entity_type - * Optional machine-name of an entity type to filter the returned array by. - * - * @return array - * An array of address field mapping data. - */ -function addressfield_get_address_fields($entity_type = '') { - $fields = &drupal_static(__FUNCTION__ . '_' . $entity_type); - - if (isset($fields)) { - return $fields; - } - - // Get mapping data for all address fields. - $fields = array_filter(field_info_field_map(), 'addressfield_field_map_filter'); - - // Filter the list of fields by entity type if specified. - if (!empty($fields) && !empty($entity_type)) { - foreach ($fields as $field_name => $field) { - if (!isset($field['bundles'][$entity_type])) { - unset($fields[$field_name]); - } - } - } - - return $fields; -} - -/** - * Returns TRUE if a field map array value represents an addressfield. - * - * Provided for use as a callback by array_filter(). - */ -function addressfield_field_map_filter($field) { - return !empty($field['type']) && $field['type'] == 'addressfield'; -} - -/** - * Get the list of format plugins. - */ -function addressfield_format_plugins() { - ctools_include('plugins'); - $plugins = ctools_get_plugins('addressfield', 'format'); - uasort($plugins, 'ctools_plugin_sort'); - - return $plugins; -} - -/** - * Get the list of format plugins in a format suitable for #options. - */ -function addressfield_format_plugins_options() { - $options = array(); - foreach (addressfield_format_plugins() as $widget => $info) { - $options[$widget] = check_plain($info['title']); - } - return $options; -} - -/** - * @defgroup addressfield_format Address format API - * @{ - * API for generating address forms and display formats. - * - * Addresses forms and display formats are collaboratively generated by one or - * more format handler plugins. An address with a name and a company, for example, - * will be generated by three handlers: - * - 'address' that will generate the country, locality, street blocks - * - 'organisation' that will add the organisation block to the address - * - 'name-full' that will add a first name and last name block to the address - * - * A format handler is a CTools plugin of type 'addressfield' / 'format'. Each - * handler is passed the format in turn, and can add to or modify the format. - * - * The format itself is a renderable array stub. This stub will be transformed - * into either a Form API array suitable for use as part of a form or into a - * renderable array suitable for use with drupal_render(). The following - * modifications are done: - * - when rendering as a form, every element which name (its key in the array) - * is a valid addressfield column (see addressfield_field_schema()), will - * be transformed into a form element, either using a type explicitly - * defined in '#widget_type' or using 'select' if '#options' is set or - * 'textfield' if it is not. In addition, the '#default_value' of every - * field will be populated from the address being edited. - * - when rendering as a formatter, every element which name (its key in the array) - * is a valid addressfield column (see addressfield_field_schema()), will - * be transformed into a renderable element, either using a type explicitly - * defined in '#render_type' or else using 'addressfield_container'. When - * the type is 'addressfield_container' the element will be rendered as - * an HTML element set by '#tag' (default: span). - */ - -/** - * Generate a format for a given address. - * - * @param $address - * The address format being generated. - * @param $handlers - * The format handlers to use to generate the format. - * @param $context - * An associative array of context information pertaining to how the address - * format should be generated. If no mode is given, it will initialize to the - * default value. The remaining context keys should only be present when the - * address format is being generated for a field: - * - mode: either 'form' or 'render'; defaults to 'render'. - * - field: the field info array. - * - instance: the field instance array. - * - langcode: the langcode of the language the field is being rendered in. - * - delta: the delta value of the given address. - * - * @return - * A renderable array suitable for use as part of a form (if 'mode' is 'form') - * or for formatted address output when passed to drupal_render(). - */ -function addressfield_generate($address, array $handlers, array $context = array()) { - // If no mode is given in the context array, default it to 'render'. - if (empty($context['mode'])) { - $context['mode'] = 'render'; - } - - ctools_include('plugins'); - $format = array(); - // Add the handlers, ordered by weight. - $plugins = addressfield_format_plugins(); - $format['#handlers'] = array_intersect(array_keys($plugins), $handlers); - - foreach ($format['#handlers'] as $handler) { - if ($callback = ctools_plugin_load_function('addressfield', 'format', $handler, 'format callback')) { - $callback($format, $address, $context); - } - } - - // Store the address in the format, for processing. - $format['#address'] = $address; - - // Post-process the format stub, depending on the rendering mode. - if ($context['mode'] == 'form') { - $format['#addressfield'] = TRUE; - $format['#process'][] = 'addressfield_process_format_form'; - } - elseif ($context['mode'] == 'render') { - $format['#pre_render'][] = 'addressfield_render_address'; - } - - return $format; -} - -/** - * Generate a full-fledged form from a format snippet, as returned by addressfield_formats(). - */ -function addressfield_process_format_form($format, &$form_state, $complete_form) { - // Make sure to load all the plugins that participated in this format. - ctools_include('plugins'); - foreach ($format['#handlers'] as $handler) { - ctools_plugin_load_function('addressfield', 'format', $handler, 'format callback'); - } - - _addressfield_process_format_form($format, $format['#address']); - return $format; -} - -function _addressfield_process_format_form(&$format, $address) { - foreach (element_children($format) as $key) { - $child = &$format[$key]; - - // Automatically convert any element in the format array to an appropriate - // form element that matches one of the address component names. - if (in_array($key, array('name_line', 'first_name', 'last_name', 'organisation_name', 'country', 'administrative_area', 'sub_administrative_area', 'locality', 'dependent_locality', 'postal_code', 'thoroughfare', 'premise', 'sub_premise'))) { - // Set the form element type for the address component to whatever the - // address format specified in its #widget_type property. - if (isset($child['#widget_type'])) { - $child['#type'] = $child['#widget_type']; - } - else { - // If the element didn't specify a #widget_type and has options, turn it - // into a select list and unset its #size value, which is typically used - // to provide the width of a textfield. - if (isset($child['#options'])) { - $child['#type'] = 'select'; - unset($child['#size']); - } - else { - // Otherwise go ahead and make it a textfield. - $child['#type'] = 'textfield'; - } - } - - if (isset($address[$key])) { - $child['#default_value'] = $address[$key]; - } - } - - // Recurse through the element's children if it has any. - _addressfield_process_format_form($child, $address); - } -} - -/** - * Render an address in a given format. - */ -function addressfield_render_address($format) { - _addressfield_render_address($format, $format['#address']); - return $format; -} - -function _addressfield_render_address(&$format, $address) { - foreach (element_children($format) as $key) { - $child = &$format[$key]; - - // Automatically expand elements that match one of the fields of the address - // structure. - if (in_array($key, array('name_line', 'first_name', 'last_name', 'organisation_name', 'country', 'administrative_area', 'sub_administrative_area', 'locality', 'dependent_locality', 'postal_code', 'thoroughfare', 'premise', 'sub_premise'), TRUE)) { - if (isset($child['#render_type'])) { - $child['#type'] = $child['#render_type']; - } - else { - $child['#type'] = 'addressfield_container'; - if (!isset($child['#tag'])) { - $child['#tag'] = 'span'; - } - } - - // If the element instructs us to render the option value instead of the - // raw address element value and its #options array has a matching key, - // swap it out for the option value now. - if (!empty($child['#render_option_value']) && isset($address[$key]) && isset($child['#options'][$address[$key]])) { - $child['#children'] = check_plain($child['#options'][$address[$key]]); - } - elseif (isset($address[$key])) { - $child['#children'] = check_plain($address[$key]); - } - else { - $child['#children'] = ''; - } - - // Skip empty elements. - if ((string) $child['#children'] === '') { - $child['#access'] = FALSE; - } - - // Add #field_prefix and #field_suffix to the prefixes and suffixes. - if (isset($child['#field_prefix'])) { - $child['#prefix'] = (isset($child['#prefix']) ? $child['#prefix'] : '') . $child['#field_prefix']; - } - if (isset($child['#field_suffix'])) { - $child['#suffix'] = (isset($child['#suffix']) ? $child['#suffix'] : '') . $child['#field_suffix']; - } - } - - // Recurse through the child. - _addressfield_render_address($child, $address); - } -} - -/** - * @} End of "ingroup addressfield_format" - */ - -/** - * Implementation of hook_theme(). - */ -function addressfield_theme() { - $hooks['addressfield_container'] = array( - 'render element' => 'element', - ); - return $hooks; -} - -/** - * Render a container for a set of address fields. - */ -function theme_addressfield_container($variables) { - $element = $variables['element']; - $element['#children'] = trim($element['#children']); - // Remove the autocomplete attribute because the W3C validator complains. - // It's only used on forms anyway. - unset($element['#attributes']['autocomplete']); - - if (strlen($element['#children']) > 0) { - $output = '<' . $element['#tag'] . drupal_attributes($element['#attributes']) . '>'; - $output .= $element['#children']; - $output .= ''; - // Add a linebreak to the HTML after a div. This is invisible on the - // rendered page but improves the appearance of address field output when - // HTML tags are stripped, such as by Views Data Export. - if ($element['#tag'] == 'div') { - $output .= PHP_EOL; - } - - return $output; - } - else { - return ''; - } -} - -/** - * Implementation of hook_element_info(). - */ -function addressfield_element_info() { - $types['addressfield_container'] = array( - '#theme_wrappers' => array('addressfield_container'), - '#process' => array('addressfield_widget_process'), - '#attributes' => array(), - '#tag' => 'div', - ); - return $types; -} - -/** - * Form API process function: set the #parents of the children of this element so they appear at the same level as the parent. - */ -function addressfield_widget_process($element) { - foreach (element_children($element) as $key) { - $element[$key]['#parents'] = $element['#parents']; - $element[$key]['#parents'][count($element[$key]['#parents']) - 1] = $key; - } - - return $element; -} - -/** - * Implements hook_field_info() - */ -function addressfield_field_info() { - $fields = array(); - - $fields['addressfield'] = array( - 'label' => t('Postal address'), - 'description' => t('A field type used for storing postal addresses according the xNAL standard.'), - 'settings' => array(), - 'instance_settings' => array(), - 'default_widget' => 'addressfield_standard', - 'default_formatter' => 'addressfield_default', - 'property_type' => 'addressfield', - 'property_callbacks' => array('addressfield_property_info_callback'), - ); - - return $fields; -} - -/** - * Returns an array of default values for the addressfield form elements. - * - * @param $field - * The field array. - * @param $instance - * The instance array. - * @param $address - * The current address values, if known. Allows for per-country defaults. - * - * @return - * An array of default values. - */ -function addressfield_default_values($field, $instance, array $address = array()) { - $available_countries = _addressfield_country_options_list($field, $instance); - $default_country = $instance['widget']['settings']['default_country']; - // Resolve the special site_default option. - if ($default_country == 'site_default') { - $default_country = variable_get('site_default_country', ''); - } - // Fallback to the first country in the list if the default country is not - // available, or is empty even though the field is required. - $not_available = $default_country && !isset($available_countries[$default_country]); - $empty_but_required = empty($default_country) && !empty($instance['required']); - if ($not_available || $empty_but_required) { - $default_country = key($available_countries); - } - - $default_values = array( - 'country' => $default_country, - 'name_line' => '', - 'first_name' => '', - 'last_name' => '', - 'organisation_name' => '', - 'administrative_area' => '', - 'sub_administrative_area' => '', - 'locality' => '', - 'dependent_locality' => '', - 'postal_code' => '', - 'thoroughfare' => '', - 'premise' => '', - 'sub_premise' => '', - 'data' => '', - ); - - // Allow other modules to alter the default values. - $context = array( - 'field' => $field, - 'instance' => $instance, - 'address' => $address, - ); - drupal_alter('addressfield_default_values', $default_values, $context); - - return $default_values; -} - -/** - * Implements hook_field_is_empty(). - */ -function addressfield_field_is_empty($item, $field) { - // Every address field must have at least a country value or it is considered - // empty, even if it has name information. - return empty($item['country']); -} - -/** - * Implements hook_field_presave(). - */ -function addressfield_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) { - foreach ($items as $delta => &$item) { - // If the first name and last name are set but the name line isn't... - if (isset($item['first_name']) && isset($item['last_name']) && !isset($item['name_line'])) { - // Combine the first and last name to be the name line. - $items[$delta]['name_line'] = $items[$delta]['first_name'] . ' ' . $items[$delta]['last_name']; - } - elseif (isset($item['name_line'])) { - // Otherwise if the name line is set, separate it out into a best guess at - // the first and last name. - $names = explode(' ', $item['name_line']); - - $item['first_name'] = array_shift($names); - $item['last_name'] = implode(' ', $names); - } - - // Trim whitespace from all of the address components and convert any double - // spaces to single spaces. - foreach ($item as $key => &$value) { - if (!in_array($key, array('data')) && is_string($value)) { - $value = trim(preg_replace('/[[:blank:]]{2,}/u', ' ', $value)); - } - } - } -} - -/** - * Implements hook_field_widget_info() - */ -function addressfield_field_widget_info() { - $widgets = array(); - - $widgets['addressfield_standard'] = array( - 'label' => t('Dynamic address form'), - 'field types' => array('addressfield'), - 'settings' => array( - 'available_countries' => array(), - // Can't use variable_get('site_default_country') here because it would - // set the value in stone. Instead, the site_default option allows the - // default country to always reflect the current site setting. - 'default_country' => 'site_default', - 'format_handlers' => array('address'), - ), - ); - - return $widgets; -} - -/** - * Implements hook_field_widget_settings_form() - */ -function addressfield_field_widget_settings_form($field, $instance) { - $widget = $instance['widget']; - $defaults = field_info_widget_settings($widget['type']); - $settings = array_merge($defaults, $widget['settings']); - $form = array(); - - if ($widget['type'] == 'addressfield_standard') { - $form['available_countries'] = array( - '#type' => 'select', - '#multiple' => TRUE, - '#title' => t('Available countries'), - '#description' => t('If no countries are selected, all countries will be available.'), - '#options' => _addressfield_country_options_list(), - '#default_value' => $settings['available_countries'], - ); - $form['default_country'] = array( - '#type' => 'select', - '#title' => t('Default country'), - '#options' => array('site_default' => t('- Site default -')) + _addressfield_country_options_list(), - '#default_value' => $settings['default_country'], - '#empty_value' => '', - ); - $form['format_handlers'] = array( - '#type' => 'checkboxes', - '#title' => t('Format handlers'), - '#options' => addressfield_format_plugins_options(), - '#default_value' => $settings['format_handlers'], - ); - } - - return $form; -} - -/** - * Implements hook_form_BASE_FORM_ID_alter(). - * - * Removes the default values form from the field settings page. - * Allows the module to implement its own, more predictable default value - * handling, getting around #1253820 and other bugs. - */ -function addressfield_form_field_ui_field_edit_form_alter(&$form, $form_state) { - if ($form['#field']['type'] == 'addressfield') { - $form['instance']['default_value_widget']['#access'] = FALSE; - } -} - -/** - * Implements hook_field_widget_form() - */ -function addressfield_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) { - $settings = $instance['widget']['settings']; - - $address = array(); - // If the form has been rebuilt via AJAX, use the form state values. - // $form_state['values'] is empty because of #limit_validation_errors, so - // $form_state['input'] needs to be used instead. - $parents = array_merge($element['#field_parents'], array($element['#field_name'], $langcode, $delta)); - if (!empty($form_state['input'])) { - $input_address = drupal_array_get_nested_value($form_state['input'], $parents); - } - if (!empty($input_address)) { - $address = $input_address; - } - elseif (!empty($items[$delta]['country'])) { - // Else use the saved value for the field. - $address = $items[$delta]; - } - - // Determine the list of available countries, and if the currently selected - // country is not in it, unset it so it can be reset to the default country. - $countries = _addressfield_country_options_list($field, $instance); - if (!empty($address['country']) && !isset($countries[$address['country']])) { - unset($address['country']); - } - - // Merge in default values. - $address += addressfield_default_values($field, $instance, $address); - - // Add the form elements for the standard widget, which includes a country - // select list at the top that reloads the available address elements when the - // country is changed. - if ($instance['widget']['type'] == 'addressfield_standard') { - // Wrap everything in a fieldset. This is not the best looking element, - // but it's the only wrapper available in Drupal we can properly use - // in that context, and it is overridable if necessary. - $element['#type'] = 'fieldset'; - - if (!empty($instance['description'])) { - // Checkout panes convert the fieldset into a container, causing - // #description to not be rendered. Hence, a real element is added and - // the old #description is removed. - $element['#description'] = ''; - $element['element_description'] = array( - '#markup' => $instance['description'], - '#prefix' => '
', - '#suffix' => '
', - '#weight' => -999, - ); - } - - // Generate the address form. - $context = array( - 'mode' => 'form', - 'field' => $field, - 'instance' => $instance, - 'langcode' => $langcode, - 'delta' => $delta, - ); - $element += addressfield_generate($address, $settings['format_handlers'], $context); - - // Remove any already saved default value. - // See addressfield_form_field_ui_field_edit_form_alter() for the reasoning. - if ($form_state['build_info']['form_id'] == 'field_ui_field_edit_form') { - $element['#address'] = array('country' => ''); - } - } - - return $element; -} - -/** - * Element validate callback: rebuilds the form on country change. - */ -function addressfield_standard_country_validate($element, &$form_state) { - if ($element['#default_value'] != $element['#value']) { - $parents = $element['#parents']; - array_pop($parents); - $address = drupal_array_get_nested_value($form_state['values'], $parents); - - // Clear the country-specific field values. - $country_specific_data = array( - 'dependent_locality' => '', - 'locality' => '', - 'administrative_area' => '', - 'postal_code' => '', - ); - $address = array_diff_key($address, $country_specific_data); - - drupal_array_set_nested_value($form_state['values'], $parents, $address); - drupal_array_set_nested_value($form_state['input'], $parents, $address); - - $form_state['rebuild'] = TRUE; - } -} - -/** - * Ajax callback in response to a change of country in an address field. - * - * The only thing we have to do is to find the proper element to render. - */ -function addressfield_standard_widget_refresh($form, $form_state) { - // The target element is one element below the triggering country selector. - $array_parents = $form_state['triggering_element']['#array_parents']; - array_pop($array_parents); - - // Iterate over the form parents to find the element. - $element = $form; - foreach ($array_parents as $name) { - $element = &$element[$name]; - if (!empty($element['#addressfield'])) { - break; - } - } - - // Return the address block, but remove the '_weight' element inserted - // by the field API. - unset($element['_weight']); - - // Replace the address field widget with the updated widget and focus on the - // new country select list. - $commands[] = ajax_command_replace(NULL, render($element)); - $commands[] = ajax_command_invoke('#' . $element['country']['#id'], 'focus'); - // Add the status messages inside the new addressfield's wrapper element, - // just like core does. - $commands[] = ajax_command_prepend(NULL, theme('status_messages')); - - // Allow other modules to add arbitrary AJAX commands on the refresh. - drupal_alter('addressfield_standard_widget_refresh', $commands, $form, $form_state); - - return array('#type' => 'ajax', '#commands' => $commands); -} - -/** - * Implements hook_field_formatter_info(). - */ -function addressfield_field_formatter_info() { - return array( - 'addressfield_default' => array( - 'label' => t('Default'), - 'field types' => array('addressfield'), - 'settings' => array( - 'use_widget_handlers' => 1, - 'format_handlers' => array('address'), - ), - ), - ); -} - -/** - * Implements hook_field_formatter_settings_form(). - */ -function addressfield_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) { - $display = $instance['display'][$view_mode]; - $settings = $display['settings']; - - $element['use_widget_handlers'] = array( - '#type' => 'checkbox', - '#title' => t('Use the same configuration as the widget.'), - '#default_value' => !empty($settings['use_widget_handlers']), - ); - - $element['format_handlers'] = array( - '#type' => 'checkboxes', - '#title' => t('Format handlers'), - '#options' => addressfield_format_plugins_options(), - '#default_value' => $settings['format_handlers'], - '#process' => array('form_process_checkboxes', '_addressfield_field_formatter_settings_form_process_add_state'), - '#element_validate' => array('_addressfield_field_formatter_settings_form_validate') - ); - - return $element; -} - -/** - * Helper function: set the proper #states to the use widget handlers checkbox. - */ -function _addressfield_field_formatter_settings_form_process_add_state($element, $form_state) { - // Build a #parents based on the current checkbox. - $target_parents = array_slice($element['#parents'], 0, -1); - $target_parents[] = 'use_widget_handlers'; - $target_parents = array_shift($target_parents) . ($target_parents ? '[' . implode('][', $target_parents) . ']' : ''); - - $element['#states']['visible'] = array( - ':input[name="' . $target_parents . '"]' => array('checked' => FALSE), - ); - - return $element; -} - -/** - * Helper function: filter the results of the checkboxes form element. - */ -function _addressfield_field_formatter_settings_form_validate($element, &$element_state) { - form_set_value($element, array_filter($element['#value']), $element_state); -} - -/** - * Implements hook_field_formatter_settings_summary(). - */ -function addressfield_field_formatter_settings_summary($field, $instance, $view_mode) { - $display = $instance['display'][$view_mode]; - $settings = $display['settings']; - - if ($settings['use_widget_handlers']) { - return t('Use widget configuration'); - } - else { - $summary = array(); - $plugins = addressfield_format_plugins(); - foreach ($settings['format_handlers'] as $handler) { - $summary[] = $plugins[$handler]['title']; - } - return $summary ? implode(', ', $summary) : t('No handler'); - } -} - -/** - * Implements hook_field_formatter_view(). - */ -function addressfield_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { - $settings = $display['settings']; - $element = array(); - - switch ($display['type']) { - case 'addressfield_default': - if (!empty($settings['use_widget_handlers'])) { - $handlers = $instance['widget']['settings']['format_handlers']; - } - else { - $handlers = $settings['format_handlers']; - } - foreach ($items as $delta => $address) { - // Generate the address format. - $context = array( - 'mode' => 'render', - 'field' => $field, - 'instance' => $instance, - 'langcode' => $langcode, - 'delta' => $delta, - ); - $element[$delta] = addressfield_generate($address, $handlers, $context); - } - break; - } - - return $element; -} - -/** - * Callback to alter the property info of address fields. - * - * @see addressfield_field_info(). - */ -function addressfield_property_info_callback(&$info, $entity_type, $field, $instance, $field_type) { - $name = $field['field_name']; - $property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$name]; - - $property['type'] = ($field['cardinality'] != 1) ? 'list' : 'addressfield'; - $property['getter callback'] = 'entity_metadata_field_verbatim_get'; - $property['setter callback'] = 'entity_metadata_field_verbatim_set'; - $property['auto creation'] = 'addressfield_auto_creation'; - $property['property info'] = addressfield_data_property_info(); - - unset($property['query callback']); -} - -/** - * Auto creation callback for an addressfield value array. - * - * @see addressfield_property_info_callback() - */ -function addressfield_auto_creation($property_name, $context) { - return addressfield_default_values($context['field'], $context['instance']); -} - -/** - * Defines info for the properties of the address field data structure. - */ -function addressfield_data_property_info($name = NULL) { - // Build an array of basic property information for the address field. - $properties = array( - 'country' => array( - 'label' => t('Country'), - 'options list' => '_addressfield_country_options_list', - ), - 'name_line' => array( - 'label' => t('Full name'), - ), - 'first_name' => array( - 'label' => t('First name'), - ), - 'last_name' => array( - 'label' => t('Last name'), - ), - 'organisation_name' => array( - 'label' => t('Company'), - ), - 'administrative_area' => array( - 'label' => t('Administrative area (i.e. State / Province)'), - ), - 'sub_administrative_area' => array( - 'label' => t('Sub administrative area'), - ), - 'locality' => array( - 'label' => t('Locality (i.e. City)'), - ), - 'dependent_locality' => array( - 'label' => t('Dependent locality'), - ), - 'postal_code' => array( - 'label' => t('Postal code'), - ), - 'thoroughfare' => array( - 'label' => t('Thoroughfare (i.e. Street address)'), - ), - 'premise' => array( - 'label' => t('Premise (i.e. Apartment / Suite number)'), - ), - 'sub_premise' => array( - 'label' => t('Sub Premise (i.e. Suite, Apartment, Floor, Unknown.'), - ), - ); - - // Add the default values for each of the address field properties. - foreach ($properties as $key => &$value) { - $value += array( - 'description' => !empty($name) ? t('!label of field %name', array('!label' => $value['label'], '%name' => $name)) : '', - 'type' => 'text', - 'getter callback' => 'entity_property_verbatim_get', - 'setter callback' => 'entity_property_verbatim_set', - ); - } - - return $properties; -} - -/** - * Returns the country list in a format suitable for use as an options list. - */ -function _addressfield_country_options_list($field = NULL, $instance = NULL) { - if (module_exists('countries')) { - $countries = countries_get_countries('name', array('enabled' => COUNTRIES_ENABLED)); - } - else { - require_once DRUPAL_ROOT . '/includes/locale.inc'; - $countries = country_get_list(); - } - - if (isset($field)) { - // If the instance is not specified, loop against all the instances of the field. - if (!isset($instance)) { - $instances = array(); - foreach ($field['bundles'] as $entity_type => $bundles) { - foreach ($bundles as $bundle_name) { - $instances[] = field_info_instance($entity_type, $field['field_name'], $bundle_name); - } - } - } - else { - $instances = array($instance); - } - - foreach ($instances as $instance) { - if (!empty($instance['widget']['settings']['available_countries'])) { - $countries = array_intersect_key($countries, $instance['widget']['settings']['available_countries']); - break; - } - } - } - - return $countries; -} diff --git a/html/sites/all/modules/contrib/addressfield/addressfield.tokens.inc b/html/sites/all/modules/contrib/addressfield/addressfield.tokens.inc deleted file mode 100644 index 5c325f0d2..000000000 --- a/html/sites/all/modules/contrib/addressfield/addressfield.tokens.inc +++ /dev/null @@ -1,243 +0,0 @@ - t('Address field'), - 'description' => t('Tokens related to address field values and their components.'), - 'needs-data' => 'address-field', - 'field' => TRUE, - ); - - // Define tokens for the various components of addresses supported through the - // user interface along with two helper tokens for country and administrative - // area to distinguish between names and abbreviations. - $info['country'] = array( - 'name' => t('Country name'), - 'description' => t('The full name of the country.'), - ); - $info['country-code'] = array( - 'name' => t('Country code'), - 'description' => t('The two letter ISO country code.'), - ); - $info['administrative-area'] = array( - 'name' => t('Administrative area (i.e. State/Province)'), - 'description' => t('The administrative area value, expanded to the full name if applicable.'), - ); - $info['administrative-area-raw'] = array( - 'name' => t('Administrative area (raw value)'), - 'description' => t('The raw administrative area value.'), - ); - $info['locality'] = array( - 'name' => t('Locality (i.e. City)'), - 'description' => t('The locality value.'), - ); - $info['postal-code'] = array( - 'name' => t('Postal code'), - 'description' => t('The postal code value.'), - ); - $info['thoroughfare'] = array( - 'name' => t('Thoroughfare (i.e. Street address)'), - 'description' => t('The thoroughfare value.'), - ); - $info['premise'] = array( - 'name' => t('Premise (i.e. Street address)'), - 'description' => t('The premise value.'), - ); - $info['sub_premise'] = array( - 'name' => t('Sub Premise (i.e. Suite, Apartment, Floor, Unknown.)'), - 'description' => t('The sub premise value.'), - ); - $info['organisation'] = array( - 'name' => t('Organisation'), - 'description' => t('The organisation name value.'), - ); - $info['name-line'] = array( - 'name' => t('Full name'), - 'description' => t('The name line value of the address.'), - ); - $info['first-name'] = array( - 'name' => t('First name'), - 'description' => t('The first name value.'), - ); - $info['last-name'] = array( - 'name' => t('Last name'), - 'description' => t('The last name value.'), - ); - - // Add a helper token to format addresses as expected by MailChimp. - $info['format-mailchimp'] = array( - 'name' => t('Address formatted for MailChimp'), - 'description' => t('The full address formatted for import into MailChimp.'), - ); - - return array( - 'types' => array('address-field' => $type), - 'tokens' => array('address-field' => $info), - ); -} - -/** - * Implements hook_token_info_alter(). - */ -function addressfield_token_info_alter(&$data) { - // Loop over every address field on the site. - foreach (addressfield_get_address_fields() as $field_name => $field) { - foreach (array($field_name, strtr($field_name, '_', '-')) as $name) { - foreach ($data['tokens'] as $group => $token) { - if (isset($data['tokens'][$group][$name]) && is_array($data['tokens'][$group][$name])) { - // Set the token type for the field to use the addressfield child tokens. - $data['tokens'][$group][$name]['type'] = 'address-field'; - } - } - } - } -} - -/** - * Implements hook_tokens(). - */ -function addressfield_tokens($type, $tokens, array $data = array(), array $options = array()) { - if (isset($options['language'])) { - $language_code = $options['language']->language; - } - else { - $language_code = LANGUAGE_NONE; - } - - $sanitize = !empty($options['sanitize']); - - $replacements = array(); - - // If we're generating tokens for an address field, extract the address data - // from the field value array and generate the necessary replacements. - if ($type == 'address-field' && !empty($data['address-field'][$language_code]) && is_array($data['address-field'][$language_code])) { - $address = reset($data['address-field'][$language_code]); - - foreach ($tokens as $name => $original) { - switch ($name) { - case 'country': - $countries = _addressfield_country_options_list(); - $replacements[$original] = $sanitize ? check_plain($countries[$address['country']]) : $countries[$address['country']]; - break; - - case 'country-code': - $replacements[$original] = $sanitize ? check_plain($address['country']) : $address['country']; - break; - - case 'administrative-area': - // If we received format handlers in the data array, generate the form - // for the address field to see if the administrative area should be - // expanded from an abbreviation to a related name. - $administrative_area = $address['administrative_area']; - - if (!empty($data['format_handlers'])) { - $form = addressfield_generate($address, $data['format_handlers'], array('mode' => 'form')); - - if (!empty($form['locality_block']['administrative_area']['#options'][$administrative_area])) { - $administrative_area = $form['locality_block']['administrative_area']['#options'][$administrative_area]; - } - } - - $replacements[$original] = $sanitize ? check_plain($administrative_area) : $administrative_area; - break; - - case 'administrative-area-raw': - $replacements[$original] = $sanitize ? check_plain($address['administrative_area']) : $address['administrative_area']; - break; - - case 'locality': - $replacements[$original] = $sanitize ? check_plain($address['locality']) : $address['locality']; - break; - - case 'postal-code': - $replacements[$original] = $sanitize ? check_plain($address['postal_code']) : $address['postal_code']; - break; - - case 'thoroughfare': - $replacements[$original] = $sanitize ? check_plain($address['thoroughfare']) : $address['thoroughfare']; - break; - - case 'premise': - $replacements[$original] = $sanitize ? check_plain($address['premise']) : $address['premise']; - break; - - case 'sub_premise': - $replacements[$original] = $sanitize ? check_plain($address['sub_premise']) : $address['sub_premise']; - break; - - case 'organisation': - $replacements[$original] = $sanitize ? check_plain($address['organisation_name']) : $address['organisation_name']; - break; - - case 'name-line': - $replacements[$original] = $sanitize ? check_plain($address['name_line']) : $address['name_line']; - break; - - case 'first-name': - $replacements[$original] = $sanitize ? check_plain($address['first_name']) : $address['first_name']; - break; - - case 'last-name': - $replacements[$original] = $sanitize ? check_plain($address['last_name']) : $address['last_name']; - break; - - // See: http://kb.mailchimp.com/article/how-do-i-format-my-list-fields-to-import-them - case 'format-mailchimp': - $components = array(); - - foreach (array('thoroughfare', 'premise', 'locality', 'administrative_area', 'postal_code', 'country') as $component) { - if (!empty($address[$component])) { - $components[] = $address[$component]; - } - } - - $format_mailchimp = implode(' ', $components); - $replacements[$original] = $sanitize ? check_plain($format_mailchimp) : $format_mailchimp; - break; - } - } - } - - // The Token module extends direct token generation by using a generic entity - // token generation process. Since we intend to overwrite the default Token - // module implementation of address field tokens, we use this generic token - // generation process to find and replace address field tokens on relevant - // entities. This ensures our tokens aren't overwritten by the Token module - // and helps us avoid having to do the entity detection ourselves. - if ($type == 'entity') { - // Loop over the address fields defined on the site. - foreach (addressfield_get_address_fields($data['entity_type']) as $field_name => $field) { - // If the current field is on the matching entity type... - if (!empty($field['bundles'][$data['entity_type']])) { - // Extract the format handlers selected in a representative instance - // settings form for use in formatting tokens. - $instance = field_info_instance($data['entity_type'], $field_name, reset($field['bundles'][$data['entity_type']])); - $format_handlers = $instance['widget']['settings']['format_handlers']; - } - - foreach (array($field_name, strtr($field_name, '_', '-')) as $prefix) { - // If there are any address field tokens in the token list... - $addressfield_tokens = token_find_with_prefix($tokens, $prefix); - - if (!$addressfield_tokens) { - continue; - } - - if (property_exists($data['entity'], $field_name)) { - // Generate the necessary address field tokens for the entity. - $replacements += token_generate('address-field', $addressfield_tokens, array('address-field' => $data['entity']->$field_name, 'format_handlers' => $format_handlers), $options); - } - } - } - } - - return $replacements; -} diff --git a/html/sites/all/modules/contrib/addressfield/example/addressfield_example.info b/html/sites/all/modules/contrib/addressfield/example/addressfield_example.info deleted file mode 100644 index a5dea64c3..000000000 --- a/html/sites/all/modules/contrib/addressfield/example/addressfield_example.info +++ /dev/null @@ -1,14 +0,0 @@ -name = Address Field Example -description = Example module for how to implement an addressfield format handler. -core = 7.x -package = Fields -hidden = TRUE - -dependencies[] = ctools -dependencies[] = addressfield - -; Information added by Drupal.org packaging script on 2018-10-26 -version = "7.x-1.3" -core = "7.x" -project = "addressfield" -datestamp = "1540579391" diff --git a/html/sites/all/modules/contrib/addressfield/example/addressfield_example.module b/html/sites/all/modules/contrib/addressfield/example/addressfield_example.module deleted file mode 100644 index 453b62599..000000000 --- a/html/sites/all/modules/contrib/addressfield/example/addressfield_example.module +++ /dev/null @@ -1,10 +0,0 @@ - t('Address form (CH add-on)'), - 'format callback' => 'addressfield_format_address_ch_generate', - 'type' => 'address', - 'weight' => -80, -); - -function addressfield_format_address_ch_generate(&$format, $address, $context = array()) { - if ($address['country'] == 'CH' && $context['mode'] == 'form') { - $format['locality_block']['postal_code']['#wrapper_id'] = $format['#wrapper_id']; - $format['locality_block']['postal_code']['#process'][] = 'ajax_process_form'; - $format['locality_block']['postal_code']['#process'][] = 'addressfield_format_address_ch_postal_code_process'; - - $format['locality_block']['postal_code']['#element_validate'] = array('addressfield_form_ch_postal_code_validation'); - $format['locality_block']['postal_code']['#ajax'] = array( - 'callback' => 'addressfield_standard_widget_refresh', - 'wrapper' => $format['#wrapper_id'], - ); - } - else { - if (isset($format['locality_block']['postal_code'])) { - // Cancel the AJAX for forms we don't control. - $format['locality_block']['postal_code']['#ajax'] = array(); - } - } -} - -function addressfield_format_address_ch_postal_code_process($element) { - $element['#limit_validation_errors'] = array($element['#parents']); - - return $element; -} - -function addressfield_form_ch_postal_code_validation($element, &$form_state, &$form) { - $data = array( - '1000' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1001' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1002' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1003' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1004' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1005' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1006' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1007' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1008' => array('town' => 'Prilly', 'canton' => 'VD'), - '1009' => array('town' => 'Pully', 'canton' => 'VD'), - '1010' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1011' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1012' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1014' => array('town' => 'Lausanne Adm cant', 'canton' => 'VD'), - '1015' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1018' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1020' => array('town' => 'Renens VD', 'canton' => 'VD'), - '1022' => array('town' => 'Chavannes-Renens', 'canton' => 'VD'), - '1023' => array('town' => 'Crissier', 'canton' => 'VD'), - '1024' => array('town' => 'Ecublens VD', 'canton' => 'VD'), - '1025' => array('town' => 'St-Sulpice VD', 'canton' => 'VD'), - '1026' => array('town' => 'Echandens-Denges', 'canton' => 'VD'), - '1027' => array('town' => 'Lonay', 'canton' => 'VD'), - '1028' => array('town' => 'Préverenges', 'canton' => 'VD'), - '1030' => array('town' => 'Bussigny-Lausanne', 'canton' => 'VD'), - '1032' => array('town' => 'Romanel-s-Lausanne', 'canton' => 'VD'), - '1033' => array('town' => 'Cheseaux-Lausanne', 'canton' => 'VD'), - '1037' => array('town' => 'Etagnières', 'canton' => 'VD'), - '1038' => array('town' => 'Bercher', 'canton' => 'VD'), - '1040' => array('town' => 'Echallens', 'canton' => 'VD'), - '1377' => array('town' => 'Oulens-Echallens', 'canton' => 'VD'), - '1042' => array('town' => 'Bettens', 'canton' => 'VD'), - '1417' => array('town' => 'Epautheyres', 'canton' => 'VD'), - '1041' => array('town' => 'Dommartin', 'canton' => 'VD'), - '1063' => array('town' => 'Peyres-Possens', 'canton' => 'VD'), - '1053' => array('town' => 'Bretigny-Morrens', 'canton' => 'VD'), - '1034' => array('town' => 'Boussens', 'canton' => 'VD'), - '1035' => array('town' => 'Bournens', 'canton' => 'VD'), - '1036' => array('town' => 'Sullens', 'canton' => 'VD'), - '1043' => array('town' => 'Sugnens', 'canton' => 'VD'), - '1044' => array('town' => 'Fey', 'canton' => 'VD'), - '1045' => array('town' => 'Ogens', 'canton' => 'VD'), - '1407' => array('town' => 'Bioley-Magnoux', 'canton' => 'VD'), - '1052' => array('town' => 'Mont-sur-Lausanne', 'canton' => 'VD'), - '1054' => array('town' => 'Morrens VD', 'canton' => 'VD'), - '1055' => array('town' => 'Froideville', 'canton' => 'VD'), - '1410' => array('town' => 'Thierrens', 'canton' => 'VD'), - '1066' => array('town' => 'Epalinges', 'canton' => 'VD'), - '1073' => array('town' => 'Savigny', 'canton' => 'VD'), - '1083' => array('town' => 'Mézières VD', 'canton' => 'VD'), - '1092' => array('town' => 'Belmont-Lausanne', 'canton' => 'VD'), - '1093' => array('town' => 'La Conversion', 'canton' => 'VD'), - '1094' => array('town' => 'Paudex', 'canton' => 'VD'), - '1095' => array('town' => 'Lutry', 'canton' => 'VD'), - '1096' => array('town' => 'Cully', 'canton' => 'VD'), - '1097' => array('town' => 'Riex', 'canton' => 'VD'), - '1098' => array('town' => 'Epesses', 'canton' => 'VD'), - '1058' => array('town' => 'Villars-Tiercelin', 'canton' => 'VD'), - '1059' => array('town' => 'Peney-le-Jorat', 'canton' => 'VD'), - '1061' => array('town' => 'Villars-Mendraz', 'canton' => 'VD'), - '1062' => array('town' => 'Sottens', 'canton' => 'VD'), - '1080' => array('town' => 'Les Cullayes', 'canton' => 'VD'), - '1081' => array('town' => 'Montpreveyres', 'canton' => 'VD'), - '1082' => array('town' => 'Corcelles-le-Jorat', 'canton' => 'VD'), - '1088' => array('town' => 'Ropraz', 'canton' => 'VD'), - '1084' => array('town' => 'Carrouge VD', 'canton' => 'VD'), - '1085' => array('town' => 'Vulliens', 'canton' => 'VD'), - '1509' => array('town' => 'Vucherens', 'canton' => 'VD'), - '1510' => array('town' => 'Syens', 'canton' => 'VD'), - '1076' => array('town' => 'Ferlens VD', 'canton' => 'VD'), - '1077' => array('town' => 'Servion', 'canton' => 'VD'), - '1078' => array('town' => 'Essertes', 'canton' => 'VD'), - '1673' => array('town' => 'Auboranges', 'canton' => 'FR'), - '1110' => array('town' => 'Morges', 'canton' => 'VD'), - '1112' => array('town' => 'Echichens', 'canton' => 'VD'), - '1167' => array('town' => 'Lussy-sur-Morges', 'canton' => 'VD'), - '1132' => array('town' => 'Lully VD', 'canton' => 'VD'), - '1131' => array('town' => 'Tolochenaz', 'canton' => 'VD'), - '1125' => array('town' => 'Monnaz', 'canton' => 'VD'), - '1126' => array('town' => 'Vaux-sur-Morges', 'canton' => 'VD'), - '1127' => array('town' => 'Clarmont', 'canton' => 'VD'), - '1128' => array('town' => 'Reverolle', 'canton' => 'VD'), - '1113' => array('town' => 'St-Saphorin-Morges', 'canton' => 'VD'), - '1114' => array('town' => 'Colombier VD', 'canton' => 'VD'), - '1115' => array('town' => 'Vullierens', 'canton' => 'VD'), - '1116' => array('town' => 'Cottens VD', 'canton' => 'VD'), - '1117' => array('town' => 'Grancy', 'canton' => 'VD'), - '1304' => array('town' => 'Senarclens', 'canton' => 'VD'), - '1121' => array('town' => 'Bremblens', 'canton' => 'VD'), - '1122' => array('town' => 'Romanel-sur-Morges', 'canton' => 'VD'), - '1123' => array('town' => 'Aclens', 'canton' => 'VD'), - '1124' => array('town' => 'Gollion', 'canton' => 'VD'), - '1134' => array('town' => 'Vufflens-Château', 'canton' => 'VD'), - '1135' => array('town' => 'Denens', 'canton' => 'VD'), - '1136' => array('town' => 'Bussy-Chardonney', 'canton' => 'VD'), - '1169' => array('town' => 'Yens', 'canton' => 'VD'), - '1168' => array('town' => 'Villars-sous-Yens', 'canton' => 'VD'), - '1144' => array('town' => 'Ballens', 'canton' => 'VD'), - '1149' => array('town' => 'Berolle', 'canton' => 'VD'), - '1146' => array('town' => 'Mollens VD', 'canton' => 'VD'), - '1147' => array('town' => 'Montricher', 'canton' => 'VD'), - '1142' => array('town' => 'Pampigny', 'canton' => 'VD'), - '1141' => array('town' => 'Sévery', 'canton' => 'VD'), - '1143' => array('town' => 'Apples', 'canton' => 'VD'), - '1145' => array('town' => 'Bière', 'canton' => 'VD'), - '1148' => array('town' => 'L\'Isle', 'canton' => 'VD'), - '1162' => array('town' => 'St-Prex', 'canton' => 'VD'), - '1163' => array('town' => 'Etoy', 'canton' => 'VD'), - '1164' => array('town' => 'Buchillon', 'canton' => 'VD'), - '1165' => array('town' => 'Allaman', 'canton' => 'VD'), - '1166' => array('town' => 'Perroy', 'canton' => 'VD'), - '1170' => array('town' => 'Aubonne', 'canton' => 'VD'), - '1172' => array('town' => 'Bougy-Villars', 'canton' => 'VD'), - '1173' => array('town' => 'Féchy', 'canton' => 'VD'), - '1174' => array('town' => 'Montherod', 'canton' => 'VD'), - '1175' => array('town' => 'Lavigny', 'canton' => 'VD'), - '1176' => array('town' => 'St-Livres', 'canton' => 'VD'), - '1180' => array('town' => 'Rolle', 'canton' => 'VD'), - '1182' => array('town' => 'Gilly', 'canton' => 'VD'), - '1183' => array('town' => 'Bursins', 'canton' => 'VD'), - '1184' => array('town' => 'Vinzel', 'canton' => 'VD'), - '1185' => array('town' => 'Mont-sur-Rolle', 'canton' => 'VD'), - '1186' => array('town' => 'Essertines-Rolle', 'canton' => 'VD'), - '1187' => array('town' => 'St-Oyens', 'canton' => 'VD'), - '1189' => array('town' => 'Saubraz', 'canton' => 'VD'), - '1188' => array('town' => 'Gimel', 'canton' => 'VD'), - '1195' => array('town' => 'Dully-Bursinel', 'canton' => 'VD'), - '1196' => array('town' => 'Gland', 'canton' => 'VD'), - '1197' => array('town' => 'Prangins', 'canton' => 'VD'), - '1200' => array('town' => 'Genève', 'canton' => 'GE'), - '1201' => array('town' => 'Genève', 'canton' => 'GE'), - '1202' => array('town' => 'Genève', 'canton' => 'GE'), - '1203' => array('town' => 'Genève', 'canton' => 'GE'), - '1204' => array('town' => 'Genève', 'canton' => 'GE'), - '1205' => array('town' => 'Genève', 'canton' => 'GE'), - '1206' => array('town' => 'Genève', 'canton' => 'GE'), - '1207' => array('town' => 'Genève', 'canton' => 'GE'), - '1208' => array('town' => 'Genève', 'canton' => 'GE'), - '1209' => array('town' => 'Genève', 'canton' => 'GE'), - '1211' => array('town' => 'Genève 1', 'canton' => 'GE'), - '1212' => array('town' => 'Grand-Lancy', 'canton' => 'GE'), - '1213' => array('town' => 'Petit-Lancy', 'canton' => 'GE'), - '1214' => array('town' => 'Vernier', 'canton' => 'GE'), - '1215' => array('town' => 'Genève', 'canton' => 'GE'), - '1216' => array('town' => 'Cointrin', 'canton' => 'GE'), - '1217' => array('town' => 'Meyrin', 'canton' => 'GE'), - '1218' => array('town' => 'Le Grand-Saconnex', 'canton' => 'GE'), - '1219' => array('town' => 'Le Lignon', 'canton' => 'GE'), - '1220' => array('town' => 'Les Avanchets', 'canton' => 'GE'), - '1222' => array('town' => 'Vésenaz', 'canton' => 'GE'), - '1223' => array('town' => 'Cologny', 'canton' => 'GE'), - '1224' => array('town' => 'Chêne-Bougeries', 'canton' => 'GE'), - '1225' => array('town' => 'Chêne-Bourg', 'canton' => 'GE'), - '1226' => array('town' => 'Thônex', 'canton' => 'GE'), - '1227' => array('town' => 'Carouge GE', 'canton' => 'GE'), - '1228' => array('town' => 'Plan-les-Ouates', 'canton' => 'GE'), - '1231' => array('town' => 'Conches', 'canton' => 'GE'), - '1232' => array('town' => 'Confignon', 'canton' => 'GE'), - '1233' => array('town' => 'Bernex', 'canton' => 'GE'), - '1234' => array('town' => 'Vessy', 'canton' => 'GE'), - '1236' => array('town' => 'Cartigny', 'canton' => 'GE'), - '1237' => array('town' => 'Avully', 'canton' => 'GE'), - '1239' => array('town' => 'Collex', 'canton' => 'GE'), - '1241' => array('town' => 'Puplinge', 'canton' => 'GE'), - '1242' => array('town' => 'Satigny', 'canton' => 'GE'), - '1243' => array('town' => 'Presinge', 'canton' => 'GE'), - '1244' => array('town' => 'Choulex', 'canton' => 'GE'), - '1245' => array('town' => 'Collonge-Bellerive', 'canton' => 'GE'), - '1246' => array('town' => 'Corsier GE', 'canton' => 'GE'), - '1247' => array('town' => 'Anières', 'canton' => 'GE'), - '1248' => array('town' => 'Hermance', 'canton' => 'GE'), - '1251' => array('town' => 'Gy', 'canton' => 'GE'), - '1252' => array('town' => 'Meinier', 'canton' => 'GE'), - '1253' => array('town' => 'Vandoeuvres', 'canton' => 'GE'), - '1254' => array('town' => 'Jussy', 'canton' => 'GE'), - '1255' => array('town' => 'Veyrier', 'canton' => 'GE'), - '1256' => array('town' => 'Troinex', 'canton' => 'GE'), - '1257' => array('town' => 'La Croix-de-Rozon', 'canton' => 'GE'), - '1258' => array('town' => 'Perly', 'canton' => 'GE'), - '1260' => array('town' => 'Nyon', 'canton' => 'VD'), - '1277' => array('town' => 'Borex', 'canton' => 'VD'), - '1278' => array('town' => 'La Rippe', 'canton' => 'VD'), - '1279' => array('town' => 'Chavannes-de-Bogis', 'canton' => 'VD'), - '1274' => array('town' => 'Grens', 'canton' => 'VD'), - '1275' => array('town' => 'Chéserex', 'canton' => 'VD'), - '1276' => array('town' => 'Gingins', 'canton' => 'VD'), - '1270' => array('town' => 'Trélex', 'canton' => 'VD'), - '1271' => array('town' => 'Givrins', 'canton' => 'VD'), - '1272' => array('town' => 'Genolier', 'canton' => 'VD'), - '1273' => array('town' => 'Le Muids', 'canton' => 'VD'), - '1268' => array('town' => 'Burtigny', 'canton' => 'VD'), - '1261' => array('town' => 'Marchissy', 'canton' => 'VD'), - '1269' => array('town' => 'Bassins', 'canton' => 'VD'), - '1262' => array('town' => 'Eysins', 'canton' => 'VD'), - '1263' => array('town' => 'Crassier', 'canton' => 'VD'), - '1264' => array('town' => 'St-Cergue', 'canton' => 'VD'), - '1265' => array('town' => 'La Cure', 'canton' => 'VD'), - '1266' => array('town' => 'Duillier', 'canton' => 'VD'), - '1267' => array('town' => 'Vich-Coinsins', 'canton' => 'VD'), - '1281' => array('town' => 'Russin', 'canton' => 'GE'), - '1283' => array('town' => 'Dardagny', 'canton' => 'GE'), - '1284' => array('town' => 'Chancy', 'canton' => 'GE'), - '1285' => array('town' => 'Athenaz (Avusy)', 'canton' => 'GE'), - '1286' => array('town' => 'Soral', 'canton' => 'GE'), - '1287' => array('town' => 'Laconnex', 'canton' => 'GE'), - '1288' => array('town' => 'Aire-la-Ville', 'canton' => 'GE'), - '1290' => array('town' => 'Versoix', 'canton' => 'GE'), - '1291' => array('town' => 'Commugny', 'canton' => 'VD'), - '1292' => array('town' => 'Chambésy', 'canton' => 'GE'), - '1293' => array('town' => 'Bellevue', 'canton' => 'GE'), - '1294' => array('town' => 'Genthod', 'canton' => 'GE'), - '1295' => array('town' => 'Mies-Tannay', 'canton' => 'VD'), - '1296' => array('town' => 'Coppet', 'canton' => 'VD'), - '1297' => array('town' => 'Founex', 'canton' => 'VD'), - '1298' => array('town' => 'Céligny', 'canton' => 'GE'), - '1299' => array('town' => 'Crans-près-Céligny', 'canton' => 'VD'), - '1302' => array('town' => 'Vufflens-la-Ville', 'canton' => 'VD'), - '1307' => array('town' => 'Lussery-Villars', 'canton' => 'VD'), - '1305' => array('town' => 'Penthalaz', 'canton' => 'VD'), - '1315' => array('town' => 'La Sarraz', 'canton' => 'VD'), - '1317' => array('town' => 'Orny', 'canton' => 'VD'), - '1316' => array('town' => 'Chevilly', 'canton' => 'VD'), - '1337' => array('town' => 'Vallorbe', 'canton' => 'VD'), - '1338' => array('town' => 'Ballaigues', 'canton' => 'VD'), - '1341' => array('town' => 'Orient', 'canton' => 'VD'), - '1346' => array('town' => 'Les Bioux', 'canton' => 'VD'), - '1344' => array('town' => 'L\'Abbaye', 'canton' => 'VD'), - '1342' => array('town' => 'Le Pont', 'canton' => 'VD'), - '1343' => array('town' => 'Les Charbonnières', 'canton' => 'VD'), - '1345' => array('town' => 'Le Lieu', 'canton' => 'VD'), - '1347' => array('town' => 'Le Sentier', 'canton' => 'VD'), - '1348' => array('town' => 'Le Brassus', 'canton' => 'VD'), - '1306' => array('town' => 'Daillens', 'canton' => 'VD'), - '1303' => array('town' => 'Penthaz', 'canton' => 'VD'), - '1308' => array('town' => 'La Chaux-Cossonay', 'canton' => 'VD'), - '1313' => array('town' => 'Ferreyres', 'canton' => 'VD'), - '1321' => array('town' => 'Arnex-sur-Orbe', 'canton' => 'VD'), - '1318' => array('town' => 'Pompaples', 'canton' => 'VD'), - '1312' => array('town' => 'Eclépens', 'canton' => 'VD'), - '1329' => array('town' => 'Bretonnières', 'canton' => 'VD'), - '1322' => array('town' => 'Croy', 'canton' => 'VD'), - '1323' => array('town' => 'Romainmôtier', 'canton' => 'VD'), - '1324' => array('town' => 'Premier', 'canton' => 'VD'), - '1325' => array('town' => 'Vaulion', 'canton' => 'VD'), - '1326' => array('town' => 'Juriens', 'canton' => 'VD'), - '1350' => array('town' => 'Orbe', 'canton' => 'VD'), - '1352' => array('town' => 'Agiez', 'canton' => 'VD'), - '1353' => array('town' => 'Bofflens', 'canton' => 'VD'), - '1354' => array('town' => 'Montcherand', 'canton' => 'VD'), - '1355' => array('town' => 'L\'Abergement', 'canton' => 'VD'), - '1356' => array('town' => 'Les Clées', 'canton' => 'VD'), - '1357' => array('town' => 'Lignerolle', 'canton' => 'VD'), - '1358' => array('town' => 'Valeyres-Rances', 'canton' => 'VD'), - '1439' => array('town' => 'Rances', 'canton' => 'VD'), - '1373' => array('town' => 'Chavornay', 'canton' => 'VD'), - '1372' => array('town' => 'Bavois', 'canton' => 'VD'), - '1374' => array('town' => 'Corcelles-Chavorn', 'canton' => 'VD'), - '1375' => array('town' => 'Penthéréaz', 'canton' => 'VD'), - '1376' => array('town' => 'Goumoens-la-Ville', 'canton' => 'VD'), - '1400' => array('town' => 'Yverdon-les-Bains', 'canton' => 'VD'), - '1401' => array('town' => 'Yverdon-les-Bains', 'canton' => 'VD'), - '1416' => array('town' => 'Pailly', 'canton' => 'VD'), - '1418' => array('town' => 'Vuarrens', 'canton' => 'VD'), - '1420' => array('town' => 'Fiez', 'canton' => 'VD'), - '1421' => array('town' => 'Fontaines-Grandson', 'canton' => 'VD'), - '1423' => array('town' => 'Villars-Burquin', 'canton' => 'VD'), - '1453' => array('town' => 'Mauborget', 'canton' => 'VD'), - '1429' => array('town' => 'Giez', 'canton' => 'VD'), - '1430' => array('town' => 'Orges', 'canton' => 'VD'), - '1431' => array('town' => 'Vugelles-La Mothe', 'canton' => 'VD'), - '1405' => array('town' => 'Pomy', 'canton' => 'VD'), - '1406' => array('town' => 'Cronay', 'canton' => 'VD'), - '1408' => array('town' => 'Prahins', 'canton' => 'VD'), - '1409' => array('town' => 'Chanéaz', 'canton' => 'VD'), - '1412' => array('town' => 'Valeyres-Ursins', 'canton' => 'VD'), - '1413' => array('town' => 'Orzens', 'canton' => 'VD'), - '1046' => array('town' => 'Rueyres', 'canton' => 'VD'), - '1404' => array('town' => 'Cuarny', 'canton' => 'VD'), - '1427' => array('town' => 'Bonvillars', 'canton' => 'VD'), - '1424' => array('town' => 'Champagne', 'canton' => 'VD'), - '1415' => array('town' => 'Molondin', 'canton' => 'VD'), - '1422' => array('town' => 'Grandson', 'canton' => 'VD'), - '1425' => array('town' => 'Onnens VD', 'canton' => 'VD'), - '1426' => array('town' => 'Concise', 'canton' => 'VD'), - '1432' => array('town' => 'Belmont-Yverdon', 'canton' => 'VD'), - '1433' => array('town' => 'Suchy', 'canton' => 'VD'), - '1434' => array('town' => 'Ependes VD', 'canton' => 'VD'), - '1435' => array('town' => 'Essert-Pittet', 'canton' => 'VD'), - '1436' => array('town' => 'Treycovagnes', 'canton' => 'VD'), - '1437' => array('town' => 'Suscévaz', 'canton' => 'VD'), - '1438' => array('town' => 'Mathod', 'canton' => 'VD'), - '1441' => array('town' => 'Valeyres-Montagny', 'canton' => 'VD'), - '1442' => array('town' => 'Montagny-Yverdon', 'canton' => 'VD'), - '1443' => array('town' => 'Champvent', 'canton' => 'VD'), - '1445' => array('town' => 'Vuiteboeuf', 'canton' => 'VD'), - '1446' => array('town' => 'Baulmes', 'canton' => 'VD'), - '1450' => array('town' => 'Ste-Croix', 'canton' => 'VD'), - '1454' => array('town' => 'L\'Auberson', 'canton' => 'VD'), - '1452' => array('town' => 'Les Rasses', 'canton' => 'VD'), - '1462' => array('town' => 'Yvonand', 'canton' => 'VD'), - '1463' => array('town' => 'Rovray', 'canton' => 'VD'), - '1464' => array('town' => 'Chavannes-le-Chêne', 'canton' => 'VD'), - '1468' => array('town' => 'Cheyres', 'canton' => 'FR'), - '1470' => array('town' => 'Estavayer-le-Lac', 'canton' => 'FR'), - '1473' => array('town' => 'Font', 'canton' => 'FR'), - '1474' => array('town' => 'Châbles FR', 'canton' => 'FR'), - '1483' => array('town' => 'Montet (Broye)', 'canton' => 'FR'), - '1482' => array('town' => 'Cugy FR', 'canton' => 'FR'), - '1541' => array('town' => 'Bussy FR', 'canton' => 'FR'), - '1484' => array('town' => 'Aumont', 'canton' => 'FR'), - '1485' => array('town' => 'Nuvilly', 'canton' => 'FR'), - '1486' => array('town' => 'Vuissens', 'canton' => 'FR'), - '1537' => array('town' => 'Champtauroz', 'canton' => 'VD'), - '1538' => array('town' => 'Treytorrens-Payern', 'canton' => 'VD'), - '1489' => array('town' => 'Murist', 'canton' => 'FR'), - '1512' => array('town' => 'Chavannes-s-Moudon', 'canton' => 'VD'), - '1513' => array('town' => 'Hermenches', 'canton' => 'VD'), - '1514' => array('town' => 'Bussy-sur-Moudon', 'canton' => 'VD'), - '1522' => array('town' => 'Oulens-sur-Lucens', 'canton' => 'VD'), - '1515' => array('town' => 'Villars-le-Comte', 'canton' => 'VD'), - '1521' => array('town' => 'Curtilles', 'canton' => 'VD'), - '1523' => array('town' => 'Granges-Marnand', 'canton' => 'VD'), - '1527' => array('town' => 'Villeneuve FR', 'canton' => 'FR'), - '1528' => array('town' => 'Surpierre', 'canton' => 'FR'), - '1529' => array('town' => 'Cheiry', 'canton' => 'FR'), - '1530' => array('town' => 'Payerne', 'canton' => 'VD'), - '1532' => array('town' => 'Fétigny', 'canton' => 'FR'), - '1533' => array('town' => 'Ménières', 'canton' => 'FR'), - '1534' => array('town' => 'Sassel', 'canton' => 'VD'), - '1536' => array('town' => 'Combremont-Petit', 'canton' => 'VD'), - '1526' => array('town' => 'Forel-sur-Lucens', 'canton' => 'VD'), - '1542' => array('town' => 'Rueyres-les-Prés', 'canton' => 'FR'), - '1543' => array('town' => 'Grandcour', 'canton' => 'VD'), - '1544' => array('town' => 'Gletterens', 'canton' => 'FR'), - '1545' => array('town' => 'Chevroux', 'canton' => 'VD'), - '1551' => array('town' => 'Vers-chez-Perrin', 'canton' => 'VD'), - '1552' => array('town' => 'Trey', 'canton' => 'VD'), - '1553' => array('town' => 'Châtonnaye', 'canton' => 'FR'), - '1554' => array('town' => 'Sédeilles', 'canton' => 'VD'), - '1555' => array('town' => 'Villarzel', 'canton' => 'VD'), - '1682' => array('town' => 'Villars-Bramard', 'canton' => 'VD'), - '1535' => array('town' => 'Combremont-Grand', 'canton' => 'VD'), - '1562' => array('town' => 'Corcelles-Payerne', 'canton' => 'VD'), - '1563' => array('town' => 'Dompierre FR', 'canton' => 'FR'), - '1564' => array('town' => 'Domdidier', 'canton' => 'FR'), - '1565' => array('town' => 'Missy', 'canton' => 'VD'), - '1475' => array('town' => 'Autavaux', 'canton' => 'FR'), - '1567' => array('town' => 'Delley', 'canton' => 'FR'), - '1568' => array('town' => 'Portalban', 'canton' => 'FR'), - '1566' => array('town' => 'St-Aubin FR', 'canton' => 'FR'), - '1580' => array('town' => 'Avenches', 'canton' => 'VD'), - '1582' => array('town' => 'Donatyre', 'canton' => 'VD'), - '1583' => array('town' => 'Villarepos', 'canton' => 'FR'), - '1584' => array('town' => 'Villars-le-Grand', 'canton' => 'VD'), - '1585' => array('town' => 'Salavaux', 'canton' => 'VD'), - '1586' => array('town' => 'Vallamand', 'canton' => 'VD'), - '1587' => array('town' => 'Montmagny', 'canton' => 'VD'), - '1589' => array('town' => 'Chabrey', 'canton' => 'VD'), - '1588' => array('town' => 'Cudrefin', 'canton' => 'VD'), - '1595' => array('town' => 'Faoug', 'canton' => 'VD'), - '1607' => array('town' => 'Palézieux-Village', 'canton' => 'VD'), - '1610' => array('town' => 'Châtillens', 'canton' => 'VD'), - '1525' => array('town' => 'Henniez', 'canton' => 'VD'), - '1524' => array('town' => 'Marnand', 'canton' => 'VD'), - '1090' => array('town' => 'La Croix (Lutry)', 'canton' => 'VD'), - '1091' => array('town' => 'Grandvaux', 'canton' => 'VD'), - '1070' => array('town' => 'Puidoux-Gare', 'canton' => 'VD'), - '1071' => array('town' => 'Chexbres', 'canton' => 'VD'), - '1072' => array('town' => 'Forel (Lavaux)', 'canton' => 'VD'), - '1614' => array('town' => 'Granges (Veveyse)', 'canton' => 'FR'), - '1615' => array('town' => 'Bossonnens', 'canton' => 'FR'), - '1616' => array('town' => 'Attalens', 'canton' => 'FR'), - '1617' => array('town' => 'Remaufens', 'canton' => 'FR'), - '1618' => array('town' => 'Châtel-St-Denis', 'canton' => 'FR'), - '1619' => array('town' => 'Les Paccots', 'canton' => 'FR'), - '1623' => array('town' => 'Semsales', 'canton' => 'FR'), - '1624' => array('town' => 'La Verrerie', 'canton' => 'FR'), - '1627' => array('town' => 'Vaulruz', 'canton' => 'FR'), - '1628' => array('town' => 'Vuadens', 'canton' => 'FR'), - '1630' => array('town' => 'Bulle', 'canton' => 'FR'), - '1633' => array('town' => 'Vuippens', 'canton' => 'FR'), - '1642' => array('town' => 'Sorens', 'canton' => 'FR'), - '1643' => array('town' => 'Gumefens', 'canton' => 'FR'), - '1644' => array('town' => 'Avry-devant-Pont', 'canton' => 'FR'), - '1645' => array('town' => 'Le Bry', 'canton' => 'FR'), - '1646' => array('town' => 'Echarlens', 'canton' => 'FR'), - '1647' => array('town' => 'Corbières', 'canton' => 'FR'), - '1648' => array('town' => 'Hauteville', 'canton' => 'FR'), - '1656' => array('town' => 'Im Fang', 'canton' => 'FR'), - '1657' => array('town' => 'Abländschen', 'canton' => 'BE'), - '1654' => array('town' => 'Cerniat FR', 'canton' => 'FR'), - '1651' => array('town' => 'Villarvolard', 'canton' => 'FR'), - '1652' => array('town' => 'Botterens', 'canton' => 'FR'), - '1638' => array('town' => 'Morlon', 'canton' => 'FR'), - '1663' => array('town' => 'Moléson-s-Gruyères', 'canton' => 'FR'), - '1632' => array('town' => 'Riaz', 'canton' => 'FR'), - '1634' => array('town' => 'La Roche FR', 'canton' => 'FR'), - '1649' => array('town' => 'Pont-la-Ville', 'canton' => 'FR'), - '1635' => array('town' => 'La Tour-de-Trême', 'canton' => 'FR'), - '1636' => array('town' => 'Broc', 'canton' => 'FR'), - '1637' => array('town' => 'Charmey (Gruyère)', 'canton' => 'FR'), - '1661' => array('town' => 'Pâquier-Montbarry', 'canton' => 'FR'), - '1665' => array('town' => 'Estavannens', 'canton' => 'FR'), - '1667' => array('town' => 'Enney', 'canton' => 'FR'), - '1669' => array('town' => 'Neirivue', 'canton' => 'FR'), - '1666' => array('town' => 'Grandvillard', 'canton' => 'FR'), - '1675' => array('town' => 'Vauderens', 'canton' => 'FR'), - '1670' => array('town' => 'Ursy', 'canton' => 'FR'), - '1674' => array('town' => 'Vuarmarens', 'canton' => 'FR'), - '1678' => array('town' => 'Siviriez', 'canton' => 'FR'), - '1679' => array('town' => 'Villaraboud', 'canton' => 'FR'), - '1676' => array('town' => 'Chavannes-Forts', 'canton' => 'FR'), - '1677' => array('town' => 'Prez-vers-Siviriez', 'canton' => 'FR'), - '1680' => array('town' => 'Romont FR', 'canton' => 'FR'), - '1681' => array('town' => 'Billens', 'canton' => 'FR'), - '1683' => array('town' => 'Brenles', 'canton' => 'VD'), - '1694' => array('town' => 'Orsonnens', 'canton' => 'FR'), - '1695' => array('town' => 'Villarlod', 'canton' => 'FR'), - '1696' => array('town' => 'Vuisternens-Ogoz', 'canton' => 'FR'), - '1684' => array('town' => 'Mézières FR', 'canton' => 'FR'), - '1685' => array('town' => 'Villariaz', 'canton' => 'FR'), - '1687' => array('town' => 'Estévenens', 'canton' => 'FR'), - '1686' => array('town' => 'Grangettes-Romont', 'canton' => 'FR'), - '1689' => array('town' => 'Châtelard-p-Romont', 'canton' => 'FR'), - '1688' => array('town' => 'Sommentier', 'canton' => 'FR'), - '1626' => array('town' => 'Romanens', 'canton' => 'FR'), - '1692' => array('town' => 'Massonnens', 'canton' => 'FR'), - '1625' => array('town' => 'Sâles (Gruyère)', 'canton' => 'FR'), - '1612' => array('town' => 'Ecoteaux', 'canton' => 'VD'), - '1613' => array('town' => 'Maracon', 'canton' => 'VD'), - '1608' => array('town' => 'Oron-le-Châtel', 'canton' => 'VD'), - '1609' => array('town' => 'St-Martin FR', 'canton' => 'FR'), - '1611' => array('town' => 'Le Crêt-p-Semsales', 'canton' => 'FR'), - '1697' => array('town' => 'La Joux FR', 'canton' => 'FR'), - '1699' => array('town' => 'Bouloz', 'canton' => 'FR'), - '1700' => array('town' => 'Fribourg', 'canton' => 'FR'), - '1702' => array('town' => 'Fribourg', 'canton' => 'FR'), - '1704' => array('town' => 'Fribourg', 'canton' => 'FR'), - '1705' => array('town' => 'Fribourg', 'canton' => 'FR'), - '1707' => array('town' => 'Fribourg', 'canton' => 'FR'), - '1708' => array('town' => 'Fribourg', 'canton' => 'FR'), - '1763' => array('town' => 'Granges-Paccot', 'canton' => 'FR'), - '1701' => array('town' => 'Fribourg', 'canton' => 'FR'), - '1720' => array('town' => 'Corminboeuf', 'canton' => 'FR'), - '1721' => array('town' => 'Misery-Courtion', 'canton' => 'FR'), - '1735' => array('town' => 'Giffers', 'canton' => 'FR'), - '1736' => array('town' => 'St. Silvester', 'canton' => 'FR'), - '1737' => array('town' => 'Plasselb', 'canton' => 'FR'), - '1738' => array('town' => 'Sangernboden', 'canton' => 'BE'), - '1716' => array('town' => 'Schwarzsee', 'canton' => 'FR'), - '1724' => array('town' => 'Bonnefontaine', 'canton' => 'FR'), - '1727' => array('town' => 'Corpataux-Magneden', 'canton' => 'FR'), - '1728' => array('town' => 'Rossens FR', 'canton' => 'FR'), - '1719' => array('town' => 'Brünisried', 'canton' => 'FR'), - '1731' => array('town' => 'Ependes FR', 'canton' => 'FR'), - '1732' => array('town' => 'Arconciel', 'canton' => 'FR'), - '1733' => array('town' => 'Treyvaux', 'canton' => 'FR'), - '1712' => array('town' => 'Tafers', 'canton' => 'FR'), - '1713' => array('town' => 'St. Antoni', 'canton' => 'FR'), - '1714' => array('town' => 'Heitenried', 'canton' => 'FR'), - '1715' => array('town' => 'Alterswil FR', 'canton' => 'FR'), - '1717' => array('town' => 'St. Ursen', 'canton' => 'FR'), - '1718' => array('town' => 'Rechthalten', 'canton' => 'FR'), - '1722' => array('town' => 'Bourguillon', 'canton' => 'FR'), - '1723' => array('town' => 'Marly', 'canton' => 'FR'), - '1725' => array('town' => 'Posieux', 'canton' => 'FR'), - '1726' => array('town' => 'Farvagny', 'canton' => 'FR'), - '1746' => array('town' => 'Prez-vers-Noréaz', 'canton' => 'FR'), - '1747' => array('town' => 'Corserey', 'canton' => 'FR'), - '1748' => array('town' => 'Torny-le-Grand', 'canton' => 'FR'), - '1749' => array('town' => 'Middes', 'canton' => 'FR'), - '1740' => array('town' => 'Neyruz FR', 'canton' => 'FR'), - '1741' => array('town' => 'Cottens FR', 'canton' => 'FR'), - '1744' => array('town' => 'Chénens', 'canton' => 'FR'), - '1745' => array('town' => 'Lentigny', 'canton' => 'FR'), - '1742' => array('town' => 'Autigny', 'canton' => 'FR'), - '1691' => array('town' => 'Villarimboud', 'canton' => 'FR'), - '1752' => array('town' => 'Villars-sur-Glâne', 'canton' => 'FR'), - '1753' => array('town' => 'Matran', 'canton' => 'FR'), - '1754' => array('town' => 'Rosé', 'canton' => 'FR'), - '1756' => array('town' => 'Onnens FR', 'canton' => 'FR'), - '1757' => array('town' => 'Noréaz', 'canton' => 'FR'), - '1690' => array('town' => 'Villaz-St-Pierre', 'canton' => 'FR'), - '1762' => array('town' => 'Givisiez', 'canton' => 'FR'), - '1772' => array('town' => 'Grolley', 'canton' => 'FR'), - '1773' => array('town' => 'Léchelles', 'canton' => 'FR'), - '1774' => array('town' => 'Cousset', 'canton' => 'FR'), - '1776' => array('town' => 'Montagny-la-Ville', 'canton' => 'FR'), - '1795' => array('town' => 'Courlevon', 'canton' => 'FR'), - '1796' => array('town' => 'Courgevaux', 'canton' => 'FR'), - '1797' => array('town' => 'Münchenwiler', 'canton' => 'BE'), - '1794' => array('town' => 'Salvenach', 'canton' => 'FR'), - '1793' => array('town' => 'Jeuss', 'canton' => 'FR'), - '1792' => array('town' => 'Cordast', 'canton' => 'FR'), - '1791' => array('town' => 'Courtaman', 'canton' => 'FR'), - '1788' => array('town' => 'Praz (Vully)', 'canton' => 'FR'), - '1789' => array('town' => 'Lugnorre', 'canton' => 'FR'), - '1782' => array('town' => 'Belfaux', 'canton' => 'FR'), - '1783' => array('town' => 'Pensier', 'canton' => 'FR'), - '1784' => array('town' => 'Courtepin', 'canton' => 'FR'), - '1785' => array('town' => 'Cressier FR', 'canton' => 'FR'), - '1786' => array('town' => 'Sugiez', 'canton' => 'FR'), - '1787' => array('town' => 'Môtier (Vully)', 'canton' => 'FR'), - '1800' => array('town' => 'Vevey', 'canton' => 'VD'), - '1801' => array('town' => 'Le Mont-Pèlerin', 'canton' => 'VD'), - '1808' => array('town' => 'Monts-de-Corsier', 'canton' => 'VD'), - '1809' => array('town' => 'Fenil-sur-Corsier', 'canton' => 'VD'), - '1802' => array('town' => 'Corseaux', 'canton' => 'VD'), - '1803' => array('town' => 'Chardonne', 'canton' => 'VD'), - '1804' => array('town' => 'Corsier-sur-Vevey', 'canton' => 'VD'), - '1805' => array('town' => 'Jongny', 'canton' => 'VD'), - '1806' => array('town' => 'St-Légier-Chiésaz', 'canton' => 'VD'), - '1807' => array('town' => 'Blonay', 'canton' => 'VD'), - '1814' => array('town' => 'La Tour-de-Peilz', 'canton' => 'VD'), - '1815' => array('town' => 'Clarens', 'canton' => 'VD'), - '1816' => array('town' => 'Chailly-Montreux', 'canton' => 'VD'), - '1817' => array('town' => 'Brent', 'canton' => 'VD'), - '1820' => array('town' => 'Montreux', 'canton' => 'VD'), - '1822' => array('town' => 'Chernex', 'canton' => 'VD'), - '1823' => array('town' => 'Glion', 'canton' => 'VD'), - '1824' => array('town' => 'Caux', 'canton' => 'VD'), - '1832' => array('town' => 'Villard-sur-Chamby', 'canton' => 'VD'), - '1658' => array('town' => 'La Tine', 'canton' => 'VD'), - '1660' => array('town' => 'Les Moulins', 'canton' => 'VD'), - '1659' => array('town' => 'Flendruz', 'canton' => 'VD'), - '1833' => array('town' => 'Les Avants', 'canton' => 'VD'), - '1844' => array('town' => 'Villeneuve VD', 'canton' => 'VD'), - '1847' => array('town' => 'Rennaz', 'canton' => 'VD'), - '1845' => array('town' => 'Noville', 'canton' => 'VD'), - '1846' => array('town' => 'Chessel', 'canton' => 'VD'), - '1852' => array('town' => 'Roche VD', 'canton' => 'VD'), - '1853' => array('town' => 'Yvorne', 'canton' => 'VD'), - '1854' => array('town' => 'Leysin', 'canton' => 'VD'), - '1867' => array('town' => 'St-Triphon', 'canton' => 'VD'), - '1860' => array('town' => 'Aigle', 'canton' => 'VD'), - '1856' => array('town' => 'Corbeyrier', 'canton' => 'VD'), - '1862' => array('town' => 'La Comballaz', 'canton' => 'VD'), - '1866' => array('town' => 'La Forclaz VD', 'canton' => 'VD'), - '1884' => array('town' => 'Huémoz', 'canton' => 'VD'), - '1863' => array('town' => 'Le Sépey', 'canton' => 'VD'), - '1864' => array('town' => 'Vers-l\'Eglise', 'canton' => 'VD'), - '1865' => array('town' => 'Les Diablerets', 'canton' => 'VD'), - '1868' => array('town' => 'Collombey', 'canton' => 'VS'), - '1870' => array('town' => 'Monthey', 'canton' => 'VS'), - '1871' => array('town' => 'Choëx', 'canton' => 'VS'), - '1872' => array('town' => 'Troistorrents', 'canton' => 'VS'), - '1873' => array('town' => 'Val-d\'Illiez', 'canton' => 'VS'), - '1874' => array('town' => 'Champéry', 'canton' => 'VS'), - '1875' => array('town' => 'Morgins', 'canton' => 'VS'), - '1880' => array('town' => 'Bex', 'canton' => 'VD'), - '1882' => array('town' => 'Les Posses-sur-Bex', 'canton' => 'VD'), - '1885' => array('town' => 'Chesières', 'canton' => 'VD'), - '1890' => array('town' => 'St-Maurice', 'canton' => 'VS'), - '1891' => array('town' => 'Vérossaz', 'canton' => 'VS'), - '1869' => array('town' => 'Massongex', 'canton' => 'VS'), - '1895' => array('town' => 'Vionnaz', 'canton' => 'VS'), - '1897' => array('town' => 'Les Evouettes', 'canton' => 'VS'), - '1899' => array('town' => 'Torgon', 'canton' => 'VS'), - '1892' => array('town' => 'Lavey-Village', 'canton' => 'VD'), - '1893' => array('town' => 'Muraz (Collombey)', 'canton' => 'VS'), - '1896' => array('town' => 'Vouvry', 'canton' => 'VS'), - '1898' => array('town' => 'St-Gingolph', 'canton' => 'VS'), - '1902' => array('town' => 'Evionnaz', 'canton' => 'VS'), - '1903' => array('town' => 'Collonges', 'canton' => 'VS'), - '1904' => array('town' => 'Vernayaz', 'canton' => 'VS'), - '1905' => array('town' => 'Dorénaz', 'canton' => 'VS'), - '1906' => array('town' => 'Charrat', 'canton' => 'VS'), - '1907' => array('town' => 'Saxon', 'canton' => 'VS'), - '1908' => array('town' => 'Riddes', 'canton' => 'VS'), - '1912' => array('town' => 'Leytron', 'canton' => 'VS'), - '1911' => array('town' => 'Ovronnaz', 'canton' => 'VS'), - '1913' => array('town' => 'Saillon', 'canton' => 'VS'), - '1914' => array('town' => 'Isérables', 'canton' => 'VS'), - '1918' => array('town' => 'La Tzoumaz', 'canton' => 'VS'), - '1955' => array('town' => 'Chamoson', 'canton' => 'VS'), - '1957' => array('town' => 'Ardon', 'canton' => 'VS'), - '1920' => array('town' => 'Martigny', 'canton' => 'VS'), - '1921' => array('town' => 'Martigny-Croix', 'canton' => 'VS'), - '1923' => array('town' => 'Le Trétien', 'canton' => 'VS'), - '1925' => array('town' => 'Le Châtelard VS', 'canton' => 'VS'), - '1927' => array('town' => 'Chemin', 'canton' => 'VS'), - '1929' => array('town' => 'Trient', 'canton' => 'VS'), - '1928' => array('town' => 'Ravoire', 'canton' => 'VS'), - '1922' => array('town' => 'Salvan', 'canton' => 'VS'), - '1926' => array('town' => 'Fully', 'canton' => 'VS'), - '1932' => array('town' => 'Bovernier', 'canton' => 'VS'), - '1947' => array('town' => 'Versegères', 'canton' => 'VS'), - '1941' => array('town' => 'Vollèges', 'canton' => 'VS'), - '1942' => array('town' => 'Levron', 'canton' => 'VS'), - '1948' => array('town' => 'Lourtier', 'canton' => 'VS'), - '1945' => array('town' => 'Liddes', 'canton' => 'VS'), - '1946' => array('town' => 'Bourg-St-Pierre', 'canton' => 'VS'), - '1943' => array('town' => 'Praz-de-Fort', 'canton' => 'VS'), - '1944' => array('town' => 'La Fouly VS', 'canton' => 'VS'), - '1933' => array('town' => 'Sembrancher', 'canton' => 'VS'), - '1934' => array('town' => 'Le Châble VS', 'canton' => 'VS'), - '1936' => array('town' => 'Verbier', 'canton' => 'VS'), - '1937' => array('town' => 'Orsières', 'canton' => 'VS'), - '1938' => array('town' => 'Champex-Lac', 'canton' => 'VS'), - '1950' => array('town' => 'Sion', 'canton' => 'VS'), - '1951' => array('town' => 'Sion', 'canton' => 'VS'), - '1975' => array('town' => 'St-Séverin', 'canton' => 'VS'), - '1976' => array('town' => 'Erde', 'canton' => 'VS'), - '1971' => array('town' => 'Grimisuat', 'canton' => 'VS'), - '1974' => array('town' => 'Arbaz', 'canton' => 'VS'), - '1961' => array('town' => 'Vernamiège', 'canton' => 'VS'), - '1973' => array('town' => 'Nax', 'canton' => 'VS'), - '1968' => array('town' => 'Mase', 'canton' => 'VS'), - '1969' => array('town' => 'St-Martin VS', 'canton' => 'VS'), - '1981' => array('town' => 'Vex', 'canton' => 'VS'), - '1982' => array('town' => 'Euseigne', 'canton' => 'VS'), - '1984' => array('town' => 'Les Haudères', 'canton' => 'VS'), - '1986' => array('town' => 'Arolla', 'canton' => 'VS'), - '1985' => array('town' => 'La Sage', 'canton' => 'VS'), - '1987' => array('town' => 'Hérémence', 'canton' => 'VS'), - '1988' => array('town' => 'Les Collons', 'canton' => 'VS'), - '1991' => array('town' => 'Salins', 'canton' => 'VS'), - '1992' => array('town' => 'Les Agettes', 'canton' => 'VS'), - '1993' => array('town' => 'Veysonnaz', 'canton' => 'VS'), - '1997' => array('town' => 'Siviez (Nendaz)', 'canton' => 'VS'), - '1996' => array('town' => 'Fey (Nendaz)', 'canton' => 'VS'), - '1994' => array('town' => 'Aproz (Nendaz)', 'canton' => 'VS'), - '1962' => array('town' => 'Pont-de-la-Morge', 'canton' => 'VS'), - '1963' => array('town' => 'Vétroz', 'canton' => 'VS'), - '1964' => array('town' => 'Conthey', 'canton' => 'VS'), - '1965' => array('town' => 'Savièse', 'canton' => 'VS'), - '1966' => array('town' => 'Ayent', 'canton' => 'VS'), - '1967' => array('town' => 'Bramois', 'canton' => 'VS'), - '1983' => array('town' => 'Evolène', 'canton' => 'VS'), - '1972' => array('town' => 'Anzère', 'canton' => 'VS'), - '2000' => array('town' => 'Neuchâtel', 'canton' => 'NE'), - '2004' => array('town' => 'Neuchâtel 4', 'canton' => 'NE'), - '2007' => array('town' => 'Neuchâtel 7', 'canton' => 'NE'), - '2008' => array('town' => 'Neuchâtel', 'canton' => 'NE'), - '2009' => array('town' => 'Neuchâtel 9', 'canton' => 'NE'), - '2001' => array('town' => 'Neuchâtel 1', 'canton' => 'NE'), - '2002' => array('town' => 'Neuchâtel 2', 'canton' => 'NE'), - '2003' => array('town' => 'Neuchâtel 3', 'canton' => 'NE'), - '2006' => array('town' => 'Neuchâtel 6', 'canton' => 'NE'), - '2012' => array('town' => 'Auvernier', 'canton' => 'NE'), - '2013' => array('town' => 'Colombier NE', 'canton' => 'NE'), - '2014' => array('town' => 'Bôle', 'canton' => 'NE'), - '2015' => array('town' => 'Areuse', 'canton' => 'NE'), - '2016' => array('town' => 'Cortaillod', 'canton' => 'NE'), - '2017' => array('town' => 'Boudry', 'canton' => 'NE'), - '2022' => array('town' => 'Bevaix', 'canton' => 'NE'), - '2023' => array('town' => 'Gorgier', 'canton' => 'NE'), - '2024' => array('town' => 'St-Aubin-Sauges', 'canton' => 'NE'), - '2025' => array('town' => 'Chez-le-Bart', 'canton' => 'NE'), - '2028' => array('town' => 'Vaumarcus', 'canton' => 'NE'), - '2034' => array('town' => 'Peseux', 'canton' => 'NE'), - '2035' => array('town' => 'Corcelles NE', 'canton' => 'NE'), - '2036' => array('town' => 'Cormondrèche', 'canton' => 'NE'), - '2042' => array('town' => 'Valangin', 'canton' => 'NE'), - '2043' => array('town' => 'Boudevilliers', 'canton' => 'NE'), - '2046' => array('town' => 'Fontaines NE', 'canton' => 'NE'), - '2052' => array('town' => 'Fontainemelon', 'canton' => 'NE'), - '2053' => array('town' => 'Cernier', 'canton' => 'NE'), - '2054' => array('town' => 'Chézard-St-Martin', 'canton' => 'NE'), - '2056' => array('town' => 'Dombresson', 'canton' => 'NE'), - '2057' => array('town' => 'Villiers', 'canton' => 'NE'), - '2058' => array('town' => 'Le Pâquier NE', 'canton' => 'NE'), - '2063' => array('town' => 'Vilars NE', 'canton' => 'NE'), - '2065' => array('town' => 'Savagnier', 'canton' => 'NE'), - '2067' => array('town' => 'Chaumont', 'canton' => 'NE'), - '2068' => array('town' => 'Hauterive NE', 'canton' => 'NE'), - '2072' => array('town' => 'St-Blaise', 'canton' => 'NE'), - '2073' => array('town' => 'Enges', 'canton' => 'NE'), - '2074' => array('town' => 'Marin-Epagnier', 'canton' => 'NE'), - '3238' => array('town' => 'Gals', 'canton' => 'BE'), - '2087' => array('town' => 'Cornaux NE', 'canton' => 'NE'), - '2088' => array('town' => 'Cressier NE', 'canton' => 'NE'), - '2318' => array('town' => 'Brot-Plamboz', 'canton' => 'NE'), - '2103' => array('town' => 'Noiraigue', 'canton' => 'NE'), - '2105' => array('town' => 'Travers', 'canton' => 'NE'), - '2108' => array('town' => 'Couvet', 'canton' => 'NE'), - '2112' => array('town' => 'Môtiers NE', 'canton' => 'NE'), - '2113' => array('town' => 'Boveresse', 'canton' => 'NE'), - '2114' => array('town' => 'Fleurier', 'canton' => 'NE'), - '2115' => array('town' => 'Buttes', 'canton' => 'NE'), - '2117' => array('town' => 'La Côte-aux-Fées', 'canton' => 'NE'), - '2123' => array('town' => 'St-Sulpice NE', 'canton' => 'NE'), - '2406' => array('town' => 'La Brévine', 'canton' => 'NE'), - '2126' => array('town' => 'Les Verrières', 'canton' => 'NE'), - '2127' => array('town' => 'Les Bayards', 'canton' => 'NE'), - '2149' => array('town' => 'Champ-du-Moulin', 'canton' => 'NE'), - '2124' => array('town' => 'Les Sagnettes', 'canton' => 'NE'), - '2116' => array('town' => 'Mont-de-Buttes', 'canton' => 'NE'), - '2019' => array('town' => 'Chambrelien', 'canton' => 'NE'), - '2037' => array('town' => 'Montmollin', 'canton' => 'NE'), - '2206' => array('town' => 'Geneveys-Coffrane', 'canton' => 'NE'), - '2207' => array('town' => 'Coffrane', 'canton' => 'NE'), - '2208' => array('town' => 'Les Hauts-Geneveys', 'canton' => 'NE'), - '2300' => array('town' => 'La Chaux-de-Fonds', 'canton' => 'NE'), - '2302' => array('town' => 'La Chaux-de-Fonds', 'canton' => 'NE'), - '2303' => array('town' => 'La Chaux-de-Fonds', 'canton' => 'NE'), - '2306' => array('town' => 'La Chaux-de-Fonds', 'canton' => 'NE'), - '2301' => array('town' => 'La Chaux-de-Fonds', 'canton' => 'NE'), - '2304' => array('town' => 'La Chaux-de-Fonds', 'canton' => 'NE'), - '2316' => array('town' => 'Petit-Martel', 'canton' => 'NE'), - '2338' => array('town' => 'Les Emibois', 'canton' => 'JU'), - '2314' => array('town' => 'La Sagne NE', 'canton' => 'NE'), - '2322' => array('town' => 'Le Crêt-du-Locle', 'canton' => 'NE'), - '2325' => array('town' => 'Les Planchettes', 'canton' => 'NE'), - '2333' => array('town' => 'La Ferrière', 'canton' => 'BE'), - '2336' => array('town' => 'Les Bois', 'canton' => 'JU'), - '2400' => array('town' => 'Le Locle', 'canton' => 'NE'), - '2405' => array('town' => 'La Chaux-du-Milieu', 'canton' => 'NE'), - '2414' => array('town' => 'Cerneux-Péquignot', 'canton' => 'NE'), - '2416' => array('town' => 'Les Brenets', 'canton' => 'NE'), - '2500' => array('town' => 'Biel/Bienne', 'canton' => 'BE'), - '2501' => array('town' => 'Biel/Bienne', 'canton' => 'BE'), - '2502' => array('town' => 'Biel/Bienne', 'canton' => 'BE'), - '2503' => array('town' => 'Biel/Bienne', 'canton' => 'BE'), - '2504' => array('town' => 'Biel/Bienne', 'canton' => 'BE'), - '2505' => array('town' => 'Biel/Bienne', 'canton' => 'BE'), - '2512' => array('town' => 'Tüscherz-Alfermée', 'canton' => 'BE'), - '2513' => array('town' => 'Twann', 'canton' => 'BE'), - '2514' => array('town' => 'Ligerz', 'canton' => 'BE'), - '2515' => array('town' => 'Prêles', 'canton' => 'BE'), - '2516' => array('town' => 'Lamboing', 'canton' => 'BE'), - '2517' => array('town' => 'Diesse', 'canton' => 'BE'), - '2518' => array('town' => 'Nods', 'canton' => 'BE'), - '2520' => array('town' => 'La Neuveville', 'canton' => 'BE'), - '2523' => array('town' => 'Lignières', 'canton' => 'NE'), - '2525' => array('town' => 'Le Landeron', 'canton' => 'NE'), - '2532' => array('town' => 'Magglingen/Macolin', 'canton' => 'BE'), - '2533' => array('town' => 'Evilard', 'canton' => 'BE'), - '2534' => array('town' => 'Orvin', 'canton' => 'BE'), - '2535' => array('town' => 'Frinvillier', 'canton' => 'BE'), - '2536' => array('town' => 'Plagne', 'canton' => 'BE'), - '2537' => array('town' => 'Vauffelin', 'canton' => 'BE'), - '2538' => array('town' => 'Romont BE', 'canton' => 'BE'), - '2540' => array('town' => 'Grenchen', 'canton' => 'SO'), - '2542' => array('town' => 'Pieterlen', 'canton' => 'BE'), - '2543' => array('town' => 'Lengnau BE', 'canton' => 'BE'), - '2544' => array('town' => 'Bettlach', 'canton' => 'SO'), - '2545' => array('town' => 'Selzach', 'canton' => 'SO'), - '2552' => array('town' => 'Orpund', 'canton' => 'BE'), - '2553' => array('town' => 'Safnern', 'canton' => 'BE'), - '2554' => array('town' => 'Meinisberg', 'canton' => 'BE'), - '2555' => array('town' => 'Brügg BE', 'canton' => 'BE'), - '2556' => array('town' => 'Scheuren', 'canton' => 'BE'), - '2557' => array('town' => 'Studen BE', 'canton' => 'BE'), - '2558' => array('town' => 'Aegerten', 'canton' => 'BE'), - '2560' => array('town' => 'Nidau', 'canton' => 'BE'), - '2562' => array('town' => 'Port', 'canton' => 'BE'), - '2563' => array('town' => 'Ipsach', 'canton' => 'BE'), - '2564' => array('town' => 'Bellmund', 'canton' => 'BE'), - '2565' => array('town' => 'Jens', 'canton' => 'BE'), - '2572' => array('town' => 'Sutz', 'canton' => 'BE'), - '2575' => array('town' => 'Täuffelen', 'canton' => 'BE'), - '2576' => array('town' => 'Lüscherz', 'canton' => 'BE'), - '2577' => array('town' => 'Siselen BE', 'canton' => 'BE'), - '3237' => array('town' => 'Brüttelen', 'canton' => 'BE'), - '2603' => array('town' => 'Péry', 'canton' => 'BE'), - '2604' => array('town' => 'La Heutte', 'canton' => 'BE'), - '2605' => array('town' => 'Sonceboz-Sombeval', 'canton' => 'BE'), - '2606' => array('town' => 'Corgémont', 'canton' => 'BE'), - '2607' => array('town' => 'Cortébert', 'canton' => 'BE'), - '2608' => array('town' => 'Courtelary', 'canton' => 'BE'), - '2610' => array('town' => 'St-Imier', 'canton' => 'BE'), - '2612' => array('town' => 'Cormoret', 'canton' => 'BE'), - '2613' => array('town' => 'Villeret', 'canton' => 'BE'), - '2615' => array('town' => 'Sonvilier', 'canton' => 'BE'), - '2616' => array('town' => 'Renan BE', 'canton' => 'BE'), - '2710' => array('town' => 'Tavannes', 'canton' => 'BE'), - '2712' => array('town' => 'Le Fuet', 'canton' => 'BE'), - '2714' => array('town' => 'Le Prédame', 'canton' => 'JU'), - '2717' => array('town' => 'Fornet-Dessous', 'canton' => 'BE'), - '2718' => array('town' => 'Fornet-Dessus', 'canton' => 'JU'), - '2716' => array('town' => 'Sornetan', 'canton' => 'BE'), - '2713' => array('town' => 'Bellelay', 'canton' => 'BE'), - '2720' => array('town' => 'Tramelan', 'canton' => 'BE'), - '2722' => array('town' => 'Les Reussilles', 'canton' => 'BE'), - '2723' => array('town' => 'Mont-Tramelan', 'canton' => 'BE'), - '2345' => array('town' => 'Les Breuleux', 'canton' => 'JU'), - '2340' => array('town' => 'Le Noirmont', 'canton' => 'JU'), - '2350' => array('town' => 'Saignelégier', 'canton' => 'JU'), - '2353' => array('town' => 'Les Pommerats', 'canton' => 'JU'), - '2354' => array('town' => 'Goumois', 'canton' => 'JU'), - '2732' => array('town' => 'Reconvilier', 'canton' => 'BE'), - '2733' => array('town' => 'Pontenet', 'canton' => 'BE'), - '2735' => array('town' => 'Malleray-Bévilard', 'canton' => 'BE'), - '2736' => array('town' => 'Sorvilier', 'canton' => 'BE'), - '2738' => array('town' => 'Court', 'canton' => 'BE'), - '2740' => array('town' => 'Moutier', 'canton' => 'BE'), - '2742' => array('town' => 'Perrefitte', 'canton' => 'BE'), - '2748' => array('town' => 'Souboz', 'canton' => 'BE'), - '2743' => array('town' => 'Eschert', 'canton' => 'BE'), - '2744' => array('town' => 'Belprahon', 'canton' => 'BE'), - '2747' => array('town' => 'Seehof', 'canton' => 'BE'), - '2745' => array('town' => 'Grandval', 'canton' => 'BE'), - '2746' => array('town' => 'Crémines', 'canton' => 'BE'), - '2762' => array('town' => 'Roches BE', 'canton' => 'BE'), - '2832' => array('town' => 'Rebeuvelier', 'canton' => 'JU'), - '2830' => array('town' => 'Courrendlin', 'canton' => 'JU'), - '2800' => array('town' => 'Delémont', 'canton' => 'JU'), - '2802' => array('town' => 'Develier', 'canton' => 'JU'), - '2803' => array('town' => 'Bourrignon', 'canton' => 'JU'), - '2805' => array('town' => 'Soyhières', 'canton' => 'JU'), - '2806' => array('town' => 'Mettembert', 'canton' => 'JU'), - '2807' => array('town' => 'Pleigne', 'canton' => 'JU'), - '2812' => array('town' => 'Movelier', 'canton' => 'JU'), - '2813' => array('town' => 'Ederswiler', 'canton' => 'JU'), - '2814' => array('town' => 'Roggenburg', 'canton' => 'BL'), - '2822' => array('town' => 'Courroux', 'canton' => 'JU'), - '2823' => array('town' => 'Courcelon', 'canton' => 'JU'), - '2824' => array('town' => 'Vicques', 'canton' => 'JU'), - '2825' => array('town' => 'Courchapoix', 'canton' => 'JU'), - '2826' => array('town' => 'Corban', 'canton' => 'JU'), - '2827' => array('town' => 'Mervelier', 'canton' => 'JU'), - '2828' => array('town' => 'Montsevelier', 'canton' => 'JU'), - '2829' => array('town' => 'Vermes', 'canton' => 'JU'), - '2842' => array('town' => 'Rossemaison', 'canton' => 'JU'), - '2843' => array('town' => 'Châtillon JU', 'canton' => 'JU'), - '2852' => array('town' => 'Courtételle', 'canton' => 'JU'), - '2853' => array('town' => 'Courfaivre', 'canton' => 'JU'), - '2854' => array('town' => 'Bassecourt', 'canton' => 'JU'), - '2855' => array('town' => 'Glovelier', 'canton' => 'JU'), - '2856' => array('town' => 'Boécourt', 'canton' => 'JU'), - '2857' => array('town' => 'Montavon', 'canton' => 'JU'), - '2863' => array('town' => 'Undervelier', 'canton' => 'JU'), - '2864' => array('town' => 'Soulce', 'canton' => 'JU'), - '2873' => array('town' => 'Saulcy', 'canton' => 'JU'), - '2882' => array('town' => 'St-Ursanne', 'canton' => 'JU'), - '2883' => array('town' => 'Montmelon', 'canton' => 'JU'), - '2884' => array('town' => 'Montenol', 'canton' => 'JU'), - '2885' => array('town' => 'Epauvillers', 'canton' => 'JU'), - '2886' => array('town' => 'Epiquerez', 'canton' => 'JU'), - '2887' => array('town' => 'Soubey', 'canton' => 'JU'), - '2888' => array('town' => 'Seleute', 'canton' => 'JU'), - '2889' => array('town' => 'Ocourt', 'canton' => 'JU'), - '2950' => array('town' => 'Courgenay', 'canton' => 'JU'), - '2900' => array('town' => 'Porrentruy', 'canton' => 'JU'), - '2902' => array('town' => 'Fontenais', 'canton' => 'JU'), - '2903' => array('town' => 'Villars-Fontenais', 'canton' => 'JU'), - '2904' => array('town' => 'Bressaucourt', 'canton' => 'JU'), - '2905' => array('town' => 'Courtedoux', 'canton' => 'JU'), - '2906' => array('town' => 'Chevenez', 'canton' => 'JU'), - '2907' => array('town' => 'Rocourt', 'canton' => 'JU'), - '2908' => array('town' => 'Grandfontaine', 'canton' => 'JU'), - '2912' => array('town' => 'Roche-d\'Or', 'canton' => 'JU'), - '2914' => array('town' => 'Damvant', 'canton' => 'JU'), - '2915' => array('town' => 'Bure', 'canton' => 'JU'), - '2916' => array('town' => 'Fahy', 'canton' => 'JU'), - '2922' => array('town' => 'Courchavon', 'canton' => 'JU'), - '2923' => array('town' => 'Courtemaîche', 'canton' => 'JU'), - '2924' => array('town' => 'Montignez', 'canton' => 'JU'), - '2925' => array('town' => 'Buix', 'canton' => 'JU'), - '2926' => array('town' => 'Boncourt', 'canton' => 'JU'), - '2932' => array('town' => 'Coeuve', 'canton' => 'JU'), - '2935' => array('town' => 'Beurnevésin', 'canton' => 'JU'), - '2942' => array('town' => 'Alle', 'canton' => 'JU'), - '2943' => array('town' => 'Vendlincourt', 'canton' => 'JU'), - '2944' => array('town' => 'Bonfol', 'canton' => 'JU'), - '2946' => array('town' => 'Miécourt', 'canton' => 'JU'), - '2947' => array('town' => 'Charmoille', 'canton' => 'JU'), - '2952' => array('town' => 'Cornol', 'canton' => 'JU'), - '2953' => array('town' => 'Fregiécourt-Pleuj', 'canton' => 'JU'), - '2954' => array('town' => 'Asuel', 'canton' => 'JU'), - '3000' => array('town' => 'Bern', 'canton' => 'BE'), - '3001' => array('town' => 'Bern', 'canton' => 'BE'), - '3002' => array('town' => 'Bern Postfinance', 'canton' => 'BE'), - '3003' => array('town' => 'Bern', 'canton' => 'BE'), - '3004' => array('town' => 'Bern', 'canton' => 'BE'), - '3005' => array('town' => 'Bern', 'canton' => 'BE'), - '3006' => array('town' => 'Bern', 'canton' => 'BE'), - '3007' => array('town' => 'Bern', 'canton' => 'BE'), - '3008' => array('town' => 'Bern', 'canton' => 'BE'), - '3010' => array('town' => 'Bern', 'canton' => 'BE'), - '3011' => array('town' => 'Bern', 'canton' => 'BE'), - '3012' => array('town' => 'Bern', 'canton' => 'BE'), - '3013' => array('town' => 'Bern', 'canton' => 'BE'), - '3014' => array('town' => 'Bern', 'canton' => 'BE'), - '3015' => array('town' => 'Bern', 'canton' => 'BE'), - '3018' => array('town' => 'Bern', 'canton' => 'BE'), - '3019' => array('town' => 'Bern', 'canton' => 'BE'), - '3020' => array('town' => 'Bern', 'canton' => 'BE'), - '3027' => array('town' => 'Bern', 'canton' => 'BE'), - '3095' => array('town' => 'Spiegel b. Bern', 'canton' => 'BE'), - '3032' => array('town' => 'Hinterkappelen', 'canton' => 'BE'), - '3033' => array('town' => 'Wohlen b. Bern', 'canton' => 'BE'), - '3034' => array('town' => 'Murzelen', 'canton' => 'BE'), - '3035' => array('town' => 'Frieswil', 'canton' => 'BE'), - '3036' => array('town' => 'Detligen', 'canton' => 'BE'), - '3037' => array('town' => 'Herrenschwanden', 'canton' => 'BE'), - '3038' => array('town' => 'Kirchlindach', 'canton' => 'BE'), - '3042' => array('town' => 'Ortschwaben', 'canton' => 'BE'), - '3043' => array('town' => 'Uettligen', 'canton' => 'BE'), - '3049' => array('town' => 'Säriswil', 'canton' => 'BE'), - '3045' => array('town' => 'Meikirch', 'canton' => 'BE'), - '3046' => array('town' => 'Wahlendorf', 'canton' => 'BE'), - '3047' => array('town' => 'Bremgarten b. Bern', 'canton' => 'BE'), - '3048' => array('town' => 'Worblaufen', 'canton' => 'BE'), - '3052' => array('town' => 'Zollikofen', 'canton' => 'BE'), - '3053' => array('town' => 'Münchenbuchsee', 'canton' => 'BE'), - '3054' => array('town' => 'Schüpfen', 'canton' => 'BE'), - '3063' => array('town' => 'Ittigen', 'canton' => 'BE'), - '3065' => array('town' => 'Bolligen', 'canton' => 'BE'), - '3066' => array('town' => 'Stettlen', 'canton' => 'BE'), - '3067' => array('town' => 'Boll', 'canton' => 'BE'), - '3068' => array('town' => 'Utzigen', 'canton' => 'BE'), - '3072' => array('town' => 'Ostermundigen', 'canton' => 'BE'), - '3073' => array('town' => 'Gümligen', 'canton' => 'BE'), - '3074' => array('town' => 'Muri b. Bern', 'canton' => 'BE'), - '3075' => array('town' => 'Rüfenacht BE', 'canton' => 'BE'), - '3076' => array('town' => 'Worb', 'canton' => 'BE'), - '3077' => array('town' => 'Enggistein', 'canton' => 'BE'), - '3078' => array('town' => 'Richigen', 'canton' => 'BE'), - '3082' => array('town' => 'Schlosswil', 'canton' => 'BE'), - '3083' => array('town' => 'Trimstein', 'canton' => 'BE'), - '3084' => array('town' => 'Wabern', 'canton' => 'BE'), - '3088' => array('town' => 'Oberbütschel', 'canton' => 'BE'), - '3086' => array('town' => 'Zimmerwald', 'canton' => 'BE'), - '3087' => array('town' => 'Niedermuhlern', 'canton' => 'BE'), - '3089' => array('town' => 'Hinterfultigen', 'canton' => 'BE'), - '3096' => array('town' => 'Oberbalm', 'canton' => 'BE'), - '3097' => array('town' => 'Liebefeld', 'canton' => 'BE'), - '3098' => array('town' => 'Köniz', 'canton' => 'BE'), - '3099' => array('town' => 'Rüti b. Riggisberg', 'canton' => 'BE'), - '3110' => array('town' => 'Münsingen', 'canton' => 'BE'), - '3112' => array('town' => 'Allmendingen b. BE', 'canton' => 'BE'), - '3114' => array('town' => 'Wichtrach', 'canton' => 'BE'), - '3115' => array('town' => 'Gerzensee', 'canton' => 'BE'), - '3116' => array('town' => 'Kirchdorf BE', 'canton' => 'BE'), - '3629' => array('town' => 'Kiesen', 'canton' => 'BE'), - '3628' => array('town' => 'Uttigen', 'canton' => 'BE'), - '3122' => array('town' => 'Kehrsatz', 'canton' => 'BE'), - '3123' => array('town' => 'Belp', 'canton' => 'BE'), - '3124' => array('town' => 'Belpberg', 'canton' => 'BE'), - '3125' => array('town' => 'Toffen', 'canton' => 'BE'), - '3126' => array('town' => 'Kaufdorf', 'canton' => 'BE'), - '3127' => array('town' => 'Mühlethurnen', 'canton' => 'BE'), - '3128' => array('town' => 'Kirchenthurnen', 'canton' => 'BE'), - '3132' => array('town' => 'Riggisberg', 'canton' => 'BE'), - '3664' => array('town' => 'Burgistein', 'canton' => 'BE'), - '3665' => array('town' => 'Wattenwil', 'canton' => 'BE'), - '3662' => array('town' => 'Seftigen', 'canton' => 'BE'), - '3663' => array('town' => 'Gurzelen', 'canton' => 'BE'), - '3661' => array('town' => 'Uetendorf', 'canton' => 'BE'), - '3144' => array('town' => 'Gasel', 'canton' => 'BE'), - '3145' => array('town' => 'Niederscherli', 'canton' => 'BE'), - '3147' => array('town' => 'Mittelhäusern', 'canton' => 'BE'), - '3148' => array('town' => 'Lanzenhäusern', 'canton' => 'BE'), - '3150' => array('town' => 'Schwarzenburg', 'canton' => 'BE'), - '3152' => array('town' => 'Mamishaus', 'canton' => 'BE'), - '3153' => array('town' => 'Rüschegg Gambach', 'canton' => 'BE'), - '3154' => array('town' => 'Rüschegg Heubach', 'canton' => 'BE'), - '3155' => array('town' => 'Helgisried', 'canton' => 'BE'), - '3156' => array('town' => 'Riffenmatt', 'canton' => 'BE'), - '3157' => array('town' => 'Milken', 'canton' => 'BE'), - '3158' => array('town' => 'Guggisberg', 'canton' => 'BE'), - '3159' => array('town' => 'Riedstätt', 'canton' => 'BE'), - '3172' => array('town' => 'Niederwangen BE', 'canton' => 'BE'), - '3173' => array('town' => 'Oberwangen b. Bern', 'canton' => 'BE'), - '3174' => array('town' => 'Thörishaus', 'canton' => 'BE'), - '3175' => array('town' => 'Flamatt', 'canton' => 'FR'), - '3176' => array('town' => 'Neuenegg', 'canton' => 'BE'), - '3177' => array('town' => 'Laupen BE', 'canton' => 'BE'), - '3178' => array('town' => 'Bösingen', 'canton' => 'FR'), - '3179' => array('town' => 'Kriechenwil', 'canton' => 'BE'), - '3182' => array('town' => 'Ueberstorf', 'canton' => 'FR'), - '3183' => array('town' => 'Albligen', 'canton' => 'BE'), - '3184' => array('town' => 'Wünnewil', 'canton' => 'FR'), - '3186' => array('town' => 'Düdingen', 'canton' => 'FR'), - '3202' => array('town' => 'Frauenkappelen', 'canton' => 'BE'), - '3203' => array('town' => 'Mühleberg', 'canton' => 'BE'), - '3204' => array('town' => 'Rosshäusern', 'canton' => 'BE'), - '3205' => array('town' => 'Gümmenen', 'canton' => 'BE'), - '3206' => array('town' => 'Rizenbach', 'canton' => 'BE'), - '3207' => array('town' => 'Wileroltigen', 'canton' => 'BE'), - '3208' => array('town' => 'Gurbrü', 'canton' => 'BE'), - '3210' => array('town' => 'Kerzers', 'canton' => 'FR'), - '3216' => array('town' => 'Ried b. Kerzers', 'canton' => 'FR'), - '3215' => array('town' => 'Gempenach', 'canton' => 'FR'), - '3214' => array('town' => 'Ulmiz', 'canton' => 'FR'), - '3213' => array('town' => 'Liebistorf', 'canton' => 'FR'), - '3212' => array('town' => 'Gurmels', 'canton' => 'FR'), - '3225' => array('town' => 'Müntschemier', 'canton' => 'BE'), - '3226' => array('town' => 'Treiten', 'canton' => 'BE'), - '3232' => array('town' => 'Ins', 'canton' => 'BE'), - '3233' => array('town' => 'Tschugg', 'canton' => 'BE'), - '3234' => array('town' => 'Vinelz', 'canton' => 'BE'), - '3235' => array('town' => 'Erlach', 'canton' => 'BE'), - '3236' => array('town' => 'Gampelen', 'canton' => 'BE'), - '3250' => array('town' => 'Lyss', 'canton' => 'BE'), - '3251' => array('town' => 'Wengi b. Büren', 'canton' => 'BE'), - '3252' => array('town' => 'Worben', 'canton' => 'BE'), - '3253' => array('town' => 'Schnottwil', 'canton' => 'SO'), - '3254' => array('town' => 'Messen', 'canton' => 'SO'), - '3255' => array('town' => 'Rapperswil BE', 'canton' => 'BE'), - '3256' => array('town' => 'Dieterswil', 'canton' => 'BE'), - '3257' => array('town' => 'Grossaffoltern', 'canton' => 'BE'), - '3262' => array('town' => 'Suberg', 'canton' => 'BE'), - '3263' => array('town' => 'Büetigen', 'canton' => 'BE'), - '3264' => array('town' => 'Diessbach b. Büren', 'canton' => 'BE'), - '3266' => array('town' => 'Wiler b. Seedorf', 'canton' => 'BE'), - '3267' => array('town' => 'Seedorf BE', 'canton' => 'BE'), - '3268' => array('town' => 'Lobsigen', 'canton' => 'BE'), - '3270' => array('town' => 'Aarberg', 'canton' => 'BE'), - '3271' => array('town' => 'Radelfingen', 'canton' => 'BE'), - '3272' => array('town' => 'Walperswil', 'canton' => 'BE'), - '3273' => array('town' => 'Kappelen', 'canton' => 'BE'), - '3274' => array('town' => 'Hermrigen', 'canton' => 'BE'), - '3280' => array('town' => 'Murten', 'canton' => 'FR'), - '3282' => array('town' => 'Bargen BE', 'canton' => 'BE'), - '3283' => array('town' => 'Kallnach', 'canton' => 'BE'), - '3284' => array('town' => 'Fräschels', 'canton' => 'FR'), - '3285' => array('town' => 'Galmiz', 'canton' => 'FR'), - '3286' => array('town' => 'Muntelier', 'canton' => 'FR'), - '3292' => array('town' => 'Busswil b. Büren', 'canton' => 'BE'), - '3293' => array('town' => 'Dotzigen', 'canton' => 'BE'), - '3294' => array('town' => 'Büren an der Aare', 'canton' => 'BE'), - '3295' => array('town' => 'Rüti b. Büren', 'canton' => 'BE'), - '3296' => array('town' => 'Arch', 'canton' => 'BE'), - '3297' => array('town' => 'Leuzigen', 'canton' => 'BE'), - '3298' => array('town' => 'Oberwil b. Büren', 'canton' => 'BE'), - '3302' => array('town' => 'Moosseedorf', 'canton' => 'BE'), - '3303' => array('town' => 'Jegenstorf', 'canton' => 'BE'), - '3308' => array('town' => 'Grafenried', 'canton' => 'BE'), - '3312' => array('town' => 'Fraubrunnen', 'canton' => 'BE'), - '3313' => array('town' => 'Büren zum Hof', 'canton' => 'BE'), - '3314' => array('town' => 'Schalunen', 'canton' => 'BE'), - '3315' => array('town' => 'Bätterkinden', 'canton' => 'BE'), - '3321' => array('town' => 'Schönbühl EKZ', 'canton' => 'BE'), - '3322' => array('town' => 'Urtenen-Schönbühl', 'canton' => 'BE'), - '3323' => array('town' => 'Bäriswil BE', 'canton' => 'BE'), - '3324' => array('town' => 'Hindelbank', 'canton' => 'BE'), - '3325' => array('town' => 'Hettiswil', 'canton' => 'BE'), - '3326' => array('town' => 'Krauchthal', 'canton' => 'BE'), - '3305' => array('town' => 'Iffwil', 'canton' => 'BE'), - '3306' => array('town' => 'Etzelkofen', 'canton' => 'BE'), - '3307' => array('town' => 'Brunnenthal', 'canton' => 'SO'), - '3309' => array('town' => 'Kernenried', 'canton' => 'BE'), - '3317' => array('town' => 'Limpach', 'canton' => 'BE'), - '3360' => array('town' => 'Herzogenbuchsee', 'canton' => 'BE'), - '4556' => array('town' => 'Aeschi SO', 'canton' => 'SO'), - '3376' => array('town' => 'Graben', 'canton' => 'BE'), - '3372' => array('town' => 'Wanzwil', 'canton' => 'BE'), - '3373' => array('town' => 'Heimenhausen', 'canton' => 'BE'), - '3374' => array('town' => 'Wangenried', 'canton' => 'BE'), - '3362' => array('town' => 'Niederönz', 'canton' => 'BE'), - '3363' => array('town' => 'Oberönz', 'canton' => 'BE'), - '3365' => array('town' => 'Seeberg', 'canton' => 'BE'), - '3366' => array('town' => 'Bettenhausen', 'canton' => 'BE'), - '3367' => array('town' => 'Thörigen', 'canton' => 'BE'), - '3368' => array('town' => 'Bleienbach', 'canton' => 'BE'), - '3400' => array('town' => 'Burgdorf', 'canton' => 'BE'), - '3401' => array('town' => 'Burgdorf', 'canton' => 'BE'), - '3402' => array('town' => 'Burgdorf', 'canton' => 'BE'), - '3412' => array('town' => 'Heimiswil', 'canton' => 'BE'), - '3413' => array('town' => 'Kaltacker', 'canton' => 'BE'), - '3414' => array('town' => 'Oberburg', 'canton' => 'BE'), - '3415' => array('town' => 'Hasle-Rüegsau', 'canton' => 'BE'), - '3416' => array('town' => 'Affoltern BE', 'canton' => 'BE'), - '3417' => array('town' => 'Rüegsau', 'canton' => 'BE'), - '3418' => array('town' => 'Rüegsbach', 'canton' => 'BE'), - '3419' => array('town' => 'Biembach', 'canton' => 'BE'), - '3421' => array('town' => 'Lyssach', 'canton' => 'BE'), - '3422' => array('town' => 'Kirchberg BE', 'canton' => 'BE'), - '3423' => array('town' => 'Ersigen', 'canton' => 'BE'), - '3424' => array('town' => 'Niederösch', 'canton' => 'BE'), - '3425' => array('town' => 'Koppigen', 'canton' => 'BE'), - '3426' => array('town' => 'Aefligen', 'canton' => 'BE'), - '3427' => array('town' => 'Utzenstorf', 'canton' => 'BE'), - '3428' => array('town' => 'Wiler b.Utzenstorf', 'canton' => 'BE'), - '3432' => array('town' => 'Lützelflüh-Goldb', 'canton' => 'BE'), - '3433' => array('town' => 'Schwanden i. E.', 'canton' => 'BE'), - '3434' => array('town' => 'Obergoldbach', 'canton' => 'BE'), - '3435' => array('town' => 'Ramsei', 'canton' => 'BE'), - '3436' => array('town' => 'Zollbrück', 'canton' => 'BE'), - '3437' => array('town' => 'Rüderswil', 'canton' => 'BE'), - '3438' => array('town' => 'Lauperswil', 'canton' => 'BE'), - '3439' => array('town' => 'Ranflüh', 'canton' => 'BE'), - '3452' => array('town' => 'Grünenmatt', 'canton' => 'BE'), - '3453' => array('town' => 'Heimisbach', 'canton' => 'BE'), - '3454' => array('town' => 'Sumiswald', 'canton' => 'BE'), - '3455' => array('town' => 'Grünen', 'canton' => 'BE'), - '3456' => array('town' => 'Trachselwald', 'canton' => 'BE'), - '3457' => array('town' => 'Wasen im Emmental', 'canton' => 'BE'), - '3462' => array('town' => 'Weier im Emmental', 'canton' => 'BE'), - '3463' => array('town' => 'Häusernmoos', 'canton' => 'BE'), - '3464' => array('town' => 'Schmidigen-Mühlew', 'canton' => 'BE'), - '3465' => array('town' => 'Dürrenroth', 'canton' => 'BE'), - '3472' => array('town' => 'Wynigen', 'canton' => 'BE'), - '3473' => array('town' => 'Alchenstorf', 'canton' => 'BE'), - '3474' => array('town' => 'Rüedisbach', 'canton' => 'BE'), - '3475' => array('town' => 'Riedtwil', 'canton' => 'BE'), - '3476' => array('town' => 'Oschwand', 'canton' => 'BE'), - '3111' => array('town' => 'Tägertschi', 'canton' => 'BE'), - '3503' => array('town' => 'Gysenstein', 'canton' => 'BE'), - '3504' => array('town' => 'Niederhünigen', 'canton' => 'BE'), - '3506' => array('town' => 'Grosshöchstetten', 'canton' => 'BE'), - '3507' => array('town' => 'Biglen', 'canton' => 'BE'), - '3508' => array('town' => 'Arni BE', 'canton' => 'BE'), - '3510' => array('town' => 'Konolfingen', 'canton' => 'BE'), - '3512' => array('town' => 'Walkringen', 'canton' => 'BE'), - '3513' => array('town' => 'Bigenthal', 'canton' => 'BE'), - '3672' => array('town' => 'Oberdiessbach', 'canton' => 'BE'), - '3673' => array('town' => 'Linden', 'canton' => 'BE'), - '3674' => array('town' => 'Bleiken', 'canton' => 'BE'), - '3671' => array('town' => 'Brenzikofen', 'canton' => 'BE'), - '3531' => array('town' => 'Oberthal', 'canton' => 'BE'), - '3532' => array('town' => 'Zäziwil', 'canton' => 'BE'), - '3533' => array('town' => 'Bowil', 'canton' => 'BE'), - '3534' => array('town' => 'Signau', 'canton' => 'BE'), - '3535' => array('town' => 'Schüpbach', 'canton' => 'BE'), - '3536' => array('town' => 'Aeschau', 'canton' => 'BE'), - '3537' => array('town' => 'Eggiwil', 'canton' => 'BE'), - '3538' => array('town' => 'Röthenbach i. E.', 'canton' => 'BE'), - '3543' => array('town' => 'Emmenmatt', 'canton' => 'BE'), - '3550' => array('town' => 'Langnau i. E.', 'canton' => 'BE'), - '3551' => array('town' => 'Oberfrittenbach', 'canton' => 'BE'), - '3552' => array('town' => 'Bärau', 'canton' => 'BE'), - '3553' => array('town' => 'Gohl', 'canton' => 'BE'), - '3555' => array('town' => 'Trubschachen', 'canton' => 'BE'), - '3556' => array('town' => 'Trub', 'canton' => 'BE'), - '3557' => array('town' => 'Fankhaus (Trub)', 'canton' => 'BE'), - '3600' => array('town' => 'Thun', 'canton' => 'BE'), - '3601' => array('town' => 'Thun', 'canton' => 'BE'), - '3602' => array('town' => 'Thun 2', 'canton' => 'BE'), - '3603' => array('town' => 'Thun', 'canton' => 'BE'), - '3604' => array('town' => 'Thun', 'canton' => 'BE'), - '3605' => array('town' => 'Thun', 'canton' => 'BE'), - '3607' => array('town' => 'Thun', 'canton' => 'BE'), - '3608' => array('town' => 'Thun', 'canton' => 'BE'), - '3617' => array('town' => 'Fahrni b. Thun', 'canton' => 'BE'), - '3618' => array('town' => 'Süderen', 'canton' => 'BE'), - '3619' => array('town' => 'Eriz', 'canton' => 'BE'), - '3622' => array('town' => 'Homberg b. Thun', 'canton' => 'BE'), - '3635' => array('town' => 'Uebeschi', 'canton' => 'BE'), - '3631' => array('town' => 'Höfen b. Thun', 'canton' => 'BE'), - '3636' => array('town' => 'Längenbühl', 'canton' => 'BE'), - '3612' => array('town' => 'Steffisburg', 'canton' => 'BE'), - '3613' => array('town' => 'Steffisburg', 'canton' => 'BE'), - '3614' => array('town' => 'Unterlangenegg', 'canton' => 'BE'), - '3615' => array('town' => 'Heimenschwand', 'canton' => 'BE'), - '3616' => array('town' => 'Schwarzenegg', 'canton' => 'BE'), - '3623' => array('town' => 'Teuffenthal BE', 'canton' => 'BE'), - '3624' => array('town' => 'Goldiwil (Thun)', 'canton' => 'BE'), - '3625' => array('town' => 'Heiligenschwendi', 'canton' => 'BE'), - '3626' => array('town' => 'Hünibach', 'canton' => 'BE'), - '3627' => array('town' => 'Heimberg', 'canton' => 'BE'), - '3633' => array('town' => 'Amsoldingen', 'canton' => 'BE'), - '3634' => array('town' => 'Thierachern', 'canton' => 'BE'), - '3638' => array('town' => 'Blumenstein', 'canton' => 'BE'), - '3645' => array('town' => 'Gwatt (Thun)', 'canton' => 'BE'), - '3646' => array('town' => 'Einigen', 'canton' => 'BE'), - '3647' => array('town' => 'Reutigen', 'canton' => 'BE'), - '3652' => array('town' => 'Hilterfingen', 'canton' => 'BE'), - '3653' => array('town' => 'Oberhofen Thun\'see', 'canton' => 'BE'), - '3654' => array('town' => 'Gunten', 'canton' => 'BE'), - '3655' => array('town' => 'Sigriswil', 'canton' => 'BE'), - '3656' => array('town' => 'Tschingel', 'canton' => 'BE'), - '3657' => array('town' => 'Schwanden Sigrisw', 'canton' => 'BE'), - '3658' => array('town' => 'Merligen', 'canton' => 'BE'), - '3700' => array('town' => 'Spiez', 'canton' => 'BE'), - '3702' => array('town' => 'Hondrich', 'canton' => 'BE'), - '3703' => array('town' => 'Aeschi b. Spiez', 'canton' => 'BE'), - '3704' => array('town' => 'Krattigen', 'canton' => 'BE'), - '3705' => array('town' => 'Faulensee', 'canton' => 'BE'), - '3706' => array('town' => 'Leissigen', 'canton' => 'BE'), - '3707' => array('town' => 'Därligen', 'canton' => 'BE'), - '3711' => array('town' => 'Emdthal', 'canton' => 'BE'), - '3713' => array('town' => 'Reichenbach i. K.', 'canton' => 'BE'), - '3714' => array('town' => 'Frutigen', 'canton' => 'BE'), - '3715' => array('town' => 'Adelboden', 'canton' => 'BE'), - '3716' => array('town' => 'Kandergrund', 'canton' => 'BE'), - '3717' => array('town' => 'Blausee-Mitholz', 'canton' => 'BE'), - '3718' => array('town' => 'Kandersteg', 'canton' => 'BE'), - '3722' => array('town' => 'Scharnachtal', 'canton' => 'BE'), - '3723' => array('town' => 'Kiental', 'canton' => 'BE'), - '3724' => array('town' => 'Ried (Frutigen)', 'canton' => 'BE'), - '3725' => array('town' => 'Achseten', 'canton' => 'BE'), - '3752' => array('town' => 'Wimmis', 'canton' => 'BE'), - '3753' => array('town' => 'Oey', 'canton' => 'BE'), - '3754' => array('town' => 'Diemtigen', 'canton' => 'BE'), - '3755' => array('town' => 'Horboden', 'canton' => 'BE'), - '3756' => array('town' => 'Zwischenflüh', 'canton' => 'BE'), - '3757' => array('town' => 'Schwenden', 'canton' => 'BE'), - '3758' => array('town' => 'Latterbach', 'canton' => 'BE'), - '3762' => array('town' => 'Erlenbach i. S.', 'canton' => 'BE'), - '3763' => array('town' => 'Därstetten', 'canton' => 'BE'), - '3764' => array('town' => 'Weissenburg', 'canton' => 'BE'), - '3765' => array('town' => 'Oberwil i. S.', 'canton' => 'BE'), - '3766' => array('town' => 'Boltigen', 'canton' => 'BE'), - '3770' => array('town' => 'Zweisimmen', 'canton' => 'BE'), - '3771' => array('town' => 'Blankenburg', 'canton' => 'BE'), - '3772' => array('town' => 'St. Stephan', 'canton' => 'BE'), - '3773' => array('town' => 'Matten(St.Stephan)', 'canton' => 'BE'), - '3775' => array('town' => 'Lenk im Simmental', 'canton' => 'BE'), - '3776' => array('town' => 'Oeschseite', 'canton' => 'BE'), - '3777' => array('town' => 'Saanenmöser', 'canton' => 'BE'), - '3778' => array('town' => 'Schönried', 'canton' => 'BE'), - '3780' => array('town' => 'Gstaad', 'canton' => 'BE'), - '3781' => array('town' => 'Turbach', 'canton' => 'BE'), - '3782' => array('town' => 'Lauenen b. Gstaad', 'canton' => 'BE'), - '3783' => array('town' => 'Grund b. Gstaad', 'canton' => 'BE'), - '3784' => array('town' => 'Feutersoey', 'canton' => 'BE'), - '3785' => array('town' => 'Gsteig b. Gstaad', 'canton' => 'BE'), - '3792' => array('town' => 'Saanen', 'canton' => 'BE'), - '3800' => array('town' => 'Interlaken', 'canton' => 'BE'), - '3801' => array('town' => 'Jungfraujoch', 'canton' => 'VS'), - '3803' => array('town' => 'Beatenberg', 'canton' => 'BE'), - '3804' => array('town' => 'Habkern', 'canton' => 'BE'), - '3805' => array('town' => 'Goldswil', 'canton' => 'BE'), - '3806' => array('town' => 'Bönigen', 'canton' => 'BE'), - '3807' => array('town' => 'Iseltwald', 'canton' => 'BE'), - '3812' => array('town' => 'Wilderswil', 'canton' => 'BE'), - '3813' => array('town' => 'Saxeten', 'canton' => 'BE'), - '3814' => array('town' => 'Gsteigwiler', 'canton' => 'BE'), - '3815' => array('town' => 'Zweilütschinen', 'canton' => 'BE'), - '3816' => array('town' => 'Lütschental', 'canton' => 'BE'), - '3818' => array('town' => 'Grindelwald', 'canton' => 'BE'), - '3822' => array('town' => 'Lauterbrunnen', 'canton' => 'BE'), - '3823' => array('town' => 'Wengen', 'canton' => 'BE'), - '3824' => array('town' => 'Stechelberg', 'canton' => 'BE'), - '3825' => array('town' => 'Mürren', 'canton' => 'BE'), - '3826' => array('town' => 'Gimmelwald', 'canton' => 'BE'), - '3852' => array('town' => 'Ringgenberg BE', 'canton' => 'BE'), - '3853' => array('town' => 'Niederried Interl', 'canton' => 'BE'), - '3854' => array('town' => 'Oberried Brienz', 'canton' => 'BE'), - '3855' => array('town' => 'Brienz BE', 'canton' => 'BE'), - '3856' => array('town' => 'Brienzwiler', 'canton' => 'BE'), - '3857' => array('town' => 'Unterbach BE', 'canton' => 'BE'), - '3858' => array('town' => 'Hofstetten BE', 'canton' => 'BE'), - '3860' => array('town' => 'Meiringen', 'canton' => 'BE'), - '3862' => array('town' => 'Innertkirchen', 'canton' => 'BE'), - '3863' => array('town' => 'Gadmen', 'canton' => 'BE'), - '3864' => array('town' => 'Guttannen', 'canton' => 'BE'), - '3900' => array('town' => 'Brig', 'canton' => 'VS'), - '3949' => array('town' => 'Hohtenn', 'canton' => 'VS'), - '3903' => array('town' => 'Birgisch', 'canton' => 'VS'), - '3914' => array('town' => 'Blatten b. Naters', 'canton' => 'VS'), - '3913' => array('town' => 'Rosswald', 'canton' => 'VS'), - '3911' => array('town' => 'Ried-Brig', 'canton' => 'VS'), - '3912' => array('town' => 'Termen', 'canton' => 'VS'), - '3901' => array('town' => 'Rothwald', 'canton' => 'VS'), - '3907' => array('town' => 'Simplon Hospiz', 'canton' => 'VS'), - '3922' => array('town' => 'Eisten', 'canton' => 'VS'), - '3908' => array('town' => 'Saas-Balen', 'canton' => 'VS'), - '3910' => array('town' => 'Saas-Grund', 'canton' => 'VS'), - '3902' => array('town' => 'Glis', 'canton' => 'VS'), - '3917' => array('town' => 'Goppenstein', 'canton' => 'VS'), - '3916' => array('town' => 'Ferden', 'canton' => 'VS'), - '3918' => array('town' => 'Wiler (Lötschen)', 'canton' => 'VS'), - '3919' => array('town' => 'Blatten(Lötschen)', 'canton' => 'VS'), - '3904' => array('town' => 'Naters', 'canton' => 'VS'), - '3905' => array('town' => 'Saas-Almagell', 'canton' => 'VS'), - '3906' => array('town' => 'Saas-Fee', 'canton' => 'VS'), - '3920' => array('town' => 'Zermatt', 'canton' => 'VS'), - '3923' => array('town' => 'Törbel', 'canton' => 'VS'), - '3926' => array('town' => 'Embd', 'canton' => 'VS'), - '3927' => array('town' => 'Herbriggen', 'canton' => 'VS'), - '3928' => array('town' => 'Randa', 'canton' => 'VS'), - '3929' => array('town' => 'Täsch', 'canton' => 'VS'), - '3924' => array('town' => 'St. Niklaus VS', 'canton' => 'VS'), - '3925' => array('town' => 'Grächen', 'canton' => 'VS'), - '3930' => array('town' => 'Visp', 'canton' => 'VS'), - '3942' => array('town' => 'St. German', 'canton' => 'VS'), - '3933' => array('town' => 'Staldenried', 'canton' => 'VS'), - '3937' => array('town' => 'Baltschieder', 'canton' => 'VS'), - '3938' => array('town' => 'Ausserberg', 'canton' => 'VS'), - '3939' => array('town' => 'Eggerberg', 'canton' => 'VS'), - '3931' => array('town' => 'Lalden', 'canton' => 'VS'), - '3932' => array('town' => 'Visperterminen', 'canton' => 'VS'), - '3934' => array('town' => 'Zeneggen', 'canton' => 'VS'), - '3935' => array('town' => 'Bürchen', 'canton' => 'VS'), - '3943' => array('town' => 'Eischoll', 'canton' => 'VS'), - '3944' => array('town' => 'Unterbäch VS', 'canton' => 'VS'), - '3947' => array('town' => 'Ergisch', 'canton' => 'VS'), - '3948' => array('town' => 'Unterems', 'canton' => 'VS'), - '3946' => array('town' => 'Gruben', 'canton' => 'VS'), - '3951' => array('town' => 'Agarn', 'canton' => 'VS'), - '3955' => array('town' => 'Albinen', 'canton' => 'VS'), - '3956' => array('town' => 'Guttet-Feschel', 'canton' => 'VS'), - '3957' => array('town' => 'Erschmatt', 'canton' => 'VS'), - '3953' => array('town' => 'Varen', 'canton' => 'VS'), - '3976' => array('town' => 'Noës', 'canton' => 'VS'), - '3978' => array('town' => 'Flanthey', 'canton' => 'VS'), - '1978' => array('town' => 'Lens', 'canton' => 'VS'), - '1977' => array('town' => 'Icogne', 'canton' => 'VS'), - '3979' => array('town' => 'Grône', 'canton' => 'VS'), - '3945' => array('town' => 'Gampel', 'canton' => 'VS'), - '3952' => array('town' => 'Susten', 'canton' => 'VS'), - '3954' => array('town' => 'Leukerbad', 'canton' => 'VS'), - '3970' => array('town' => 'Salgesch', 'canton' => 'VS'), - '3977' => array('town' => 'Granges VS', 'canton' => 'VS'), - '1958' => array('town' => 'St-Léonard', 'canton' => 'VS'), - '3960' => array('town' => 'Sierre', 'canton' => 'VS'), - '3971' => array('town' => 'Chermignon', 'canton' => 'VS'), - '3972' => array('town' => 'Miège', 'canton' => 'VS'), - '3973' => array('town' => 'Venthône', 'canton' => 'VS'), - '3974' => array('town' => 'Mollens VS', 'canton' => 'VS'), - '3975' => array('town' => 'Randogne', 'canton' => 'VS'), - '3961' => array('town' => 'Vissoie', 'canton' => 'VS'), - '3967' => array('town' => 'Vercorin', 'canton' => 'VS'), - '3963' => array('town' => 'Montana', 'canton' => 'VS'), - '3965' => array('town' => 'Chippis', 'canton' => 'VS'), - '3966' => array('town' => 'Chalais', 'canton' => 'VS'), - '3968' => array('town' => 'Veyras', 'canton' => 'VS'), - '3982' => array('town' => 'Bitsch', 'canton' => 'VS'), - '3993' => array('town' => 'Grengiols', 'canton' => 'VS'), - '3994' => array('town' => 'Lax', 'canton' => 'VS'), - '3997' => array('town' => 'Bellwald', 'canton' => 'VS'), - '3989' => array('town' => 'Niederwald', 'canton' => 'VS'), - '3998' => array('town' => 'Gluringen', 'canton' => 'VS'), - '3985' => array('town' => 'Geschinen', 'canton' => 'VS'), - '3988' => array('town' => 'Obergesteln', 'canton' => 'VS'), - '3999' => array('town' => 'Oberwald', 'canton' => 'VS'), - '3986' => array('town' => 'Ried-Mörel', 'canton' => 'VS'), - '3987' => array('town' => 'Riederalp', 'canton' => 'VS'), - '3991' => array('town' => 'Betten', 'canton' => 'VS'), - '3992' => array('town' => 'Bettmeralp', 'canton' => 'VS'), - '3995' => array('town' => 'Ernen', 'canton' => 'VS'), - '3996' => array('town' => 'Binn', 'canton' => 'VS'), - '3983' => array('town' => 'Mörel', 'canton' => 'VS'), - '3984' => array('town' => 'Fiesch', 'canton' => 'VS'), - '4000' => array('town' => 'Basel', 'canton' => 'BS'), - '4001' => array('town' => 'Basel', 'canton' => 'BS'), - '4002' => array('town' => 'Basel', 'canton' => 'BS'), - '4003' => array('town' => 'Basel', 'canton' => 'BS'), - '4004' => array('town' => 'Basel', 'canton' => 'BS'), - '4005' => array('town' => 'Basel', 'canton' => 'BS'), - '4007' => array('town' => 'Basel', 'canton' => 'BS'), - '4008' => array('town' => 'Basel', 'canton' => 'BS'), - '4009' => array('town' => 'Basel', 'canton' => 'BS'), - '4010' => array('town' => 'Basel', 'canton' => 'BS'), - '4011' => array('town' => 'Basel', 'canton' => 'BS'), - '4012' => array('town' => 'Basel', 'canton' => 'BS'), - '4013' => array('town' => 'Basel', 'canton' => 'BS'), - '4015' => array('town' => 'Basel', 'canton' => 'BS'), - '4016' => array('town' => 'Basel', 'canton' => 'BS'), - '4017' => array('town' => 'Basel', 'canton' => 'BS'), - '4018' => array('town' => 'Basel', 'canton' => 'BS'), - '4019' => array('town' => 'Basel', 'canton' => 'BS'), - '4020' => array('town' => 'Basel', 'canton' => 'BS'), - '4023' => array('town' => 'Basel', 'canton' => 'BL'), - '4024' => array('town' => 'Basel', 'canton' => 'BS'), - '4025' => array('town' => 'Basel', 'canton' => 'BS'), - '4030' => array('town' => 'Basel', 'canton' => 'BS'), - '4031' => array('town' => 'Basel UniSpital', 'canton' => 'BS'), - '4032' => array('town' => 'Basel', 'canton' => 'BS'), - '4051' => array('town' => 'Basel', 'canton' => 'BS'), - '4052' => array('town' => 'Basel', 'canton' => 'BS'), - '4053' => array('town' => 'Basel', 'canton' => 'BS'), - '4054' => array('town' => 'Basel', 'canton' => 'BS'), - '4055' => array('town' => 'Basel', 'canton' => 'BS'), - '4056' => array('town' => 'Basel', 'canton' => 'BS'), - '4057' => array('town' => 'Basel', 'canton' => 'BS'), - '4058' => array('town' => 'Basel', 'canton' => 'BS'), - '4059' => array('town' => 'Basel', 'canton' => 'BS'), - '4091' => array('town' => 'Basel', 'canton' => 'BS'), - '4101' => array('town' => 'Bruderholz', 'canton' => 'BL'), - '4102' => array('town' => 'Binningen', 'canton' => 'BL'), - '4103' => array('town' => 'Bottmingen', 'canton' => 'BL'), - '4104' => array('town' => 'Oberwil BL', 'canton' => 'BL'), - '4105' => array('town' => 'Biel-Benken BL', 'canton' => 'BL'), - '4106' => array('town' => 'Therwil', 'canton' => 'BL'), - '4107' => array('town' => 'Ettingen', 'canton' => 'BL'), - '4108' => array('town' => 'Witterswil', 'canton' => 'SO'), - '4112' => array('town' => 'Bättwil-Flüh', 'canton' => 'SO'), - '4114' => array('town' => 'Hofstetten SO', 'canton' => 'SO'), - '4115' => array('town' => 'Mariastein', 'canton' => 'SO'), - '4116' => array('town' => 'Metzerlen', 'canton' => 'SO'), - '4117' => array('town' => 'Burg im Leimental', 'canton' => 'BL'), - '4118' => array('town' => 'Rodersdorf', 'canton' => 'SO'), - '4123' => array('town' => 'Allschwil', 'canton' => 'BL'), - '4124' => array('town' => 'Schönenbuch', 'canton' => 'BL'), - '4125' => array('town' => 'Riehen', 'canton' => 'BS'), - '4126' => array('town' => 'Bettingen', 'canton' => 'BS'), - '4127' => array('town' => 'Birsfelden', 'canton' => 'BL'), - '4132' => array('town' => 'Muttenz', 'canton' => 'BL'), - '4133' => array('town' => 'Pratteln', 'canton' => 'BL'), - '4142' => array('town' => 'Münchenstein', 'canton' => 'BL'), - '4143' => array('town' => 'Dornach', 'canton' => 'SO'), - '4144' => array('town' => 'Arlesheim', 'canton' => 'BL'), - '4145' => array('town' => 'Gempen', 'canton' => 'SO'), - '4146' => array('town' => 'Hochwald', 'canton' => 'SO'), - '4147' => array('town' => 'Aesch BL', 'canton' => 'BL'), - '4148' => array('town' => 'Pfeffingen', 'canton' => 'BL'), - '4153' => array('town' => 'Reinach BL', 'canton' => 'BL'), - '4202' => array('town' => 'Duggingen', 'canton' => 'BL'), - '4203' => array('town' => 'Grellingen', 'canton' => 'BL'), - '4206' => array('town' => 'Seewen SO', 'canton' => 'SO'), - '4207' => array('town' => 'Bretzwil', 'canton' => 'BL'), - '4208' => array('town' => 'Nunningen', 'canton' => 'SO'), - '4222' => array('town' => 'Zwingen', 'canton' => 'BL'), - '4225' => array('town' => 'Brislach', 'canton' => 'BL'), - '4226' => array('town' => 'Breitenbach', 'canton' => 'SO'), - '4227' => array('town' => 'Büsserach', 'canton' => 'SO'), - '4228' => array('town' => 'Erschwil', 'canton' => 'SO'), - '4242' => array('town' => 'Laufen', 'canton' => 'BL'), - '4243' => array('town' => 'Dittingen', 'canton' => 'BL'), - '4244' => array('town' => 'Röschenz', 'canton' => 'BL'), - '4245' => array('town' => 'Kleinlützel', 'canton' => 'SO'), - '4204' => array('town' => 'Himmelried', 'canton' => 'SO'), - '4223' => array('town' => 'Blauen', 'canton' => 'BL'), - '4224' => array('town' => 'Nenzlingen', 'canton' => 'BL'), - '4229' => array('town' => 'Beinwil SO', 'canton' => 'SO'), - '4232' => array('town' => 'Fehren', 'canton' => 'SO'), - '4233' => array('town' => 'Meltingen', 'canton' => 'SO'), - '4234' => array('town' => 'Zullwil', 'canton' => 'SO'), - '4246' => array('town' => 'Wahlen b. Laufen', 'canton' => 'BL'), - '4247' => array('town' => 'Grindel', 'canton' => 'SO'), - '4252' => array('town' => 'Bärschwil', 'canton' => 'SO'), - '4253' => array('town' => 'Liesberg', 'canton' => 'BL'), - '4254' => array('town' => 'Liesberg Dorf', 'canton' => 'BL'), - '4302' => array('town' => 'Augst BL', 'canton' => 'BL'), - '4303' => array('town' => 'Kaiseraugst', 'canton' => 'AG'), - '4304' => array('town' => 'Giebenach', 'canton' => 'BL'), - '4305' => array('town' => 'Olsberg', 'canton' => 'AG'), - '4310' => array('town' => 'Rheinfelden', 'canton' => 'AG'), - '4312' => array('town' => 'Magden', 'canton' => 'AG'), - '4313' => array('town' => 'Möhlin', 'canton' => 'AG'), - '4314' => array('town' => 'Zeiningen', 'canton' => 'AG'), - '4315' => array('town' => 'Zuzgen', 'canton' => 'AG'), - '4316' => array('town' => 'Hellikon', 'canton' => 'AG'), - '4317' => array('town' => 'Wegenstetten', 'canton' => 'AG'), - '4322' => array('town' => 'Mumpf', 'canton' => 'AG'), - '4323' => array('town' => 'Wallbach', 'canton' => 'AG'), - '4324' => array('town' => 'Obermumpf', 'canton' => 'AG'), - '4325' => array('town' => 'Schupfart', 'canton' => 'AG'), - '4332' => array('town' => 'Stein AG', 'canton' => 'AG'), - '4333' => array('town' => 'Münchwilen AG', 'canton' => 'AG'), - '4334' => array('town' => 'Sisseln AG', 'canton' => 'AG'), - '5080' => array('town' => 'Laufenburg', 'canton' => 'AG'), - '5082' => array('town' => 'Kaisten', 'canton' => 'AG'), - '5083' => array('town' => 'Ittenthal', 'canton' => 'AG'), - '5084' => array('town' => 'Rheinsulz', 'canton' => 'AG'), - '5085' => array('town' => 'Sulz AG', 'canton' => 'AG'), - '5275' => array('town' => 'Etzgen', 'canton' => 'AG'), - '5274' => array('town' => 'Mettau', 'canton' => 'AG'), - '5273' => array('town' => 'Oberhofen AG', 'canton' => 'AG'), - '5272' => array('town' => 'Gansingen', 'canton' => 'AG'), - '5276' => array('town' => 'Wil AG', 'canton' => 'AG'), - '5277' => array('town' => 'Hottwil', 'canton' => 'AG'), - '5326' => array('town' => 'Schwaderloch', 'canton' => 'AG'), - '5325' => array('town' => 'Leibstadt', 'canton' => 'AG'), - '5324' => array('town' => 'Full-Reuenthal', 'canton' => 'AG'), - '4402' => array('town' => 'Frenkendorf', 'canton' => 'BL'), - '4410' => array('town' => 'Liestal', 'canton' => 'BL'), - '4411' => array('town' => 'Seltisberg', 'canton' => 'BL'), - '4412' => array('town' => 'Nuglar', 'canton' => 'SO'), - '4413' => array('town' => 'Büren SO', 'canton' => 'SO'), - '4414' => array('town' => 'Füllinsdorf', 'canton' => 'BL'), - '4415' => array('town' => 'Lausen', 'canton' => 'BL'), - '4416' => array('town' => 'Bubendorf', 'canton' => 'BL'), - '4417' => array('town' => 'Ziefen', 'canton' => 'BL'), - '4418' => array('town' => 'Reigoldswil', 'canton' => 'BL'), - '4419' => array('town' => 'Lupsingen', 'canton' => 'BL'), - '4421' => array('town' => 'St. Pantaleon', 'canton' => 'SO'), - '4422' => array('town' => 'Arisdorf', 'canton' => 'BL'), - '4423' => array('town' => 'Hersberg', 'canton' => 'BL'), - '4424' => array('town' => 'Arboldswil', 'canton' => 'BL'), - '4425' => array('town' => 'Titterten', 'canton' => 'BL'), - '4426' => array('town' => 'Lauwil', 'canton' => 'BL'), - '4431' => array('town' => 'Bennwil', 'canton' => 'BL'), - '4432' => array('town' => 'Lampenberg', 'canton' => 'BL'), - '4433' => array('town' => 'Ramlinsburg', 'canton' => 'BL'), - '4434' => array('town' => 'Hölstein', 'canton' => 'BL'), - '4435' => array('town' => 'Niederdorf', 'canton' => 'BL'), - '4436' => array('town' => 'Oberdorf BL', 'canton' => 'BL'), - '4437' => array('town' => 'Waldenburg', 'canton' => 'BL'), - '4438' => array('town' => 'Langenbruck', 'canton' => 'BL'), - '4441' => array('town' => 'Thürnen', 'canton' => 'BL'), - '4442' => array('town' => 'Diepflingen', 'canton' => 'BL'), - '4443' => array('town' => 'Wittinsburg', 'canton' => 'BL'), - '4444' => array('town' => 'Rümlingen', 'canton' => 'BL'), - '4445' => array('town' => 'Häfelfingen', 'canton' => 'BL'), - '4446' => array('town' => 'Buckten', 'canton' => 'BL'), - '4447' => array('town' => 'Känerkinden', 'canton' => 'BL'), - '4448' => array('town' => 'Läufelfingen', 'canton' => 'BL'), - '4450' => array('town' => 'Sissach', 'canton' => 'BL'), - '4451' => array('town' => 'Wintersingen', 'canton' => 'BL'), - '4452' => array('town' => 'Itingen', 'canton' => 'BL'), - '4453' => array('town' => 'Nusshof', 'canton' => 'BL'), - '4455' => array('town' => 'Zunzgen', 'canton' => 'BL'), - '4456' => array('town' => 'Tenniken', 'canton' => 'BL'), - '4457' => array('town' => 'Diegten', 'canton' => 'BL'), - '4458' => array('town' => 'Eptingen', 'canton' => 'BL'), - '4460' => array('town' => 'Gelterkinden', 'canton' => 'BL'), - '4461' => array('town' => 'Böckten', 'canton' => 'BL'), - '4465' => array('town' => 'Hemmiken', 'canton' => 'BL'), - '4469' => array('town' => 'Anwil', 'canton' => 'BL'), - '4462' => array('town' => 'Rickenbach BL', 'canton' => 'BL'), - '4463' => array('town' => 'Buus', 'canton' => 'BL'), - '4464' => array('town' => 'Maisprach', 'canton' => 'BL'), - '4466' => array('town' => 'Ormalingen', 'canton' => 'BL'), - '4467' => array('town' => 'Rothenfluh', 'canton' => 'BL'), - '4468' => array('town' => 'Kienberg', 'canton' => 'SO'), - '4492' => array('town' => 'Tecknau', 'canton' => 'BL'), - '4493' => array('town' => 'Wenslingen', 'canton' => 'BL'), - '4494' => array('town' => 'Oltingen', 'canton' => 'BL'), - '4495' => array('town' => 'Zeglingen', 'canton' => 'BL'), - '4496' => array('town' => 'Kilchberg BL', 'canton' => 'BL'), - '4497' => array('town' => 'Rünenberg', 'canton' => 'BL'), - '4500' => array('town' => 'Solothurn', 'canton' => 'SO'), - '4501' => array('town' => 'Solothurn', 'canton' => 'SO'), - '4502' => array('town' => 'Solothurn', 'canton' => 'SO'), - '4503' => array('town' => 'Solothurn', 'canton' => 'SO'), - '4515' => array('town' => 'Weissenstein', 'canton' => 'SO'), - '4525' => array('town' => 'Balm b. Günsberg', 'canton' => 'SO'), - '4523' => array('town' => 'Niederwil SO', 'canton' => 'SO'), - '4535' => array('town' => 'Hubersdorf', 'canton' => 'SO'), - '4539' => array('town' => 'Rumisberg', 'canton' => 'BE'), - '4557' => array('town' => 'Horriwil', 'canton' => 'SO'), - '4558' => array('town' => 'Hersiwil', 'canton' => 'SO'), - '4512' => array('town' => 'Bellach', 'canton' => 'SO'), - '4513' => array('town' => 'Langendorf', 'canton' => 'SO'), - '4514' => array('town' => 'Lommiswil', 'canton' => 'SO'), - '4522' => array('town' => 'Rüttenen', 'canton' => 'SO'), - '4524' => array('town' => 'Günsberg', 'canton' => 'SO'), - '4528' => array('town' => 'Zuchwil', 'canton' => 'SO'), - '4532' => array('town' => 'Feldbrunnen', 'canton' => 'SO'), - '4533' => array('town' => 'Riedholz', 'canton' => 'SO'), - '4534' => array('town' => 'Flumenthal', 'canton' => 'SO'), - '4536' => array('town' => 'Attiswil', 'canton' => 'BE'), - '4537' => array('town' => 'Wiedlisbach', 'canton' => 'BE'), - '4538' => array('town' => 'Oberbipp', 'canton' => 'BE'), - '4552' => array('town' => 'Derendingen', 'canton' => 'SO'), - '4553' => array('town' => 'Subingen', 'canton' => 'SO'), - '4554' => array('town' => 'Etziken', 'canton' => 'SO'), - '3375' => array('town' => 'Inkwil', 'canton' => 'BE'), - '4562' => array('town' => 'Biberist', 'canton' => 'SO'), - '4563' => array('town' => 'Gerlafingen', 'canton' => 'SO'), - '4564' => array('town' => 'Obergerlafingen', 'canton' => 'SO'), - '4565' => array('town' => 'Recherswil', 'canton' => 'SO'), - '4566' => array('town' => 'Kriegstetten', 'canton' => 'SO'), - '4581' => array('town' => 'Küttigkofen', 'canton' => 'SO'), - '4586' => array('town' => 'Kyburg-Buchegg', 'canton' => 'SO'), - '4582' => array('town' => 'Brügglen', 'canton' => 'SO'), - '4583' => array('town' => 'Mühledorf SO', 'canton' => 'SO'), - '4579' => array('town' => 'Gossliwil', 'canton' => 'SO'), - '4578' => array('town' => 'Bibern SO', 'canton' => 'SO'), - '4571' => array('town' => 'Lüterkofen-Ichert', 'canton' => 'SO'), - '4576' => array('town' => 'Tscheppach', 'canton' => 'SO'), - '4577' => array('town' => 'Hessigkofen', 'canton' => 'SO'), - '4585' => array('town' => 'Biezwil', 'canton' => 'SO'), - '4587' => array('town' => 'Aetingen', 'canton' => 'SO'), - '4588' => array('town' => 'Unterramsern', 'canton' => 'SO'), - '4574' => array('town' => 'Nennigkofen', 'canton' => 'SO'), - '4600' => array('town' => 'Olten', 'canton' => 'SO'), - '4601' => array('town' => 'Olten', 'canton' => 'SO'), - '4603' => array('town' => 'Olten', 'canton' => 'SO'), - '4612' => array('town' => 'Wangen b. Olten', 'canton' => 'SO'), - '4613' => array('town' => 'Rickenbach SO', 'canton' => 'SO'), - '4614' => array('town' => 'Hägendorf', 'canton' => 'SO'), - '4616' => array('town' => 'Kappel SO', 'canton' => 'SO'), - '4617' => array('town' => 'Gunzgen', 'canton' => 'SO'), - '4618' => array('town' => 'Boningen', 'canton' => 'SO'), - '4622' => array('town' => 'Egerkingen', 'canton' => 'SO'), - '4623' => array('town' => 'Neuendorf', 'canton' => 'SO'), - '4624' => array('town' => 'Härkingen', 'canton' => 'SO'), - '4625' => array('town' => 'Oberbuchsiten', 'canton' => 'SO'), - '4626' => array('town' => 'Niederbuchsiten', 'canton' => 'SO'), - '4632' => array('town' => 'Trimbach', 'canton' => 'SO'), - '4652' => array('town' => 'Winznau', 'canton' => 'SO'), - '4653' => array('town' => 'Obergösgen', 'canton' => 'SO'), - '4654' => array('town' => 'Lostorf', 'canton' => 'SO'), - '4655' => array('town' => 'Stüsslingen', 'canton' => 'SO'), - '4656' => array('town' => 'Starrkirch-Wil', 'canton' => 'SO'), - '4657' => array('town' => 'Dulliken', 'canton' => 'SO'), - '4658' => array('town' => 'Däniken SO', 'canton' => 'SO'), - '5010' => array('town' => 'Däniken PZ', 'canton' => 'SO'), - '4663' => array('town' => 'Aarburg', 'canton' => 'AG'), - '4665' => array('town' => 'Oftringen', 'canton' => 'AG'), - '4615' => array('town' => 'Allerheiligenberg', 'canton' => 'SO'), - '4633' => array('town' => 'Hauenstein', 'canton' => 'SO'), - '4634' => array('town' => 'Wisen SO', 'canton' => 'SO'), - '4702' => array('town' => 'Oensingen', 'canton' => 'SO'), - '4703' => array('town' => 'Kestenholz', 'canton' => 'SO'), - '4704' => array('town' => 'Niederbipp', 'canton' => 'BE'), - '3380' => array('town' => 'Wangen an der Aare', 'canton' => 'BE'), - '3377' => array('town' => 'Walliswil b.Wangen', 'canton' => 'BE'), - '4543' => array('town' => 'Deitingen', 'canton' => 'SO'), - '4542' => array('town' => 'Luterbach', 'canton' => 'SO'), - '4710' => array('town' => 'Balsthal', 'canton' => 'SO'), - '4714' => array('town' => 'Aedermannsdorf', 'canton' => 'SO'), - '4715' => array('town' => 'Herbetswil', 'canton' => 'SO'), - '4719' => array('town' => 'Ramiswil', 'canton' => 'SO'), - '4712' => array('town' => 'Laupersdorf', 'canton' => 'SO'), - '4713' => array('town' => 'Matzendorf', 'canton' => 'SO'), - '4716' => array('town' => 'Welschenrohr', 'canton' => 'SO'), - '4717' => array('town' => 'Mümliswil', 'canton' => 'SO'), - '4718' => array('town' => 'Holderbank SO', 'canton' => 'SO'), - '4800' => array('town' => 'Zofingen', 'canton' => 'AG'), - '4801' => array('town' => 'Zofingen', 'canton' => 'AG'), - '4802' => array('town' => 'Strengelbach', 'canton' => 'AG'), - '4803' => array('town' => 'Vordemwald', 'canton' => 'AG'), - '4805' => array('town' => 'Brittnau', 'canton' => 'AG'), - '4806' => array('town' => 'Wikon', 'canton' => 'LU'), - '4812' => array('town' => 'Mühlethal', 'canton' => 'AG'), - '4813' => array('town' => 'Uerkheim', 'canton' => 'AG'), - '4814' => array('town' => 'Bottenwil', 'canton' => 'AG'), - '4852' => array('town' => 'Rothrist', 'canton' => 'AG'), - '4853' => array('town' => 'Murgenthal', 'canton' => 'AG'), - '4629' => array('town' => 'Fulenbach', 'canton' => 'SO'), - '4628' => array('town' => 'Wolfwil', 'canton' => 'SO'), - '4856' => array('town' => 'Glashütten', 'canton' => 'AG'), - '4900' => array('town' => 'Langenthal', 'canton' => 'BE'), - '4901' => array('town' => 'Langenthal', 'canton' => 'BE'), - '4902' => array('town' => 'Langenthal', 'canton' => 'BE'), - '4911' => array('town' => 'Schwarzhäusern', 'canton' => 'BE'), - '4912' => array('town' => 'Aarwangen', 'canton' => 'BE'), - '4913' => array('town' => 'Bannwil', 'canton' => 'BE'), - '4914' => array('town' => 'Roggwil BE', 'canton' => 'BE'), - '4915' => array('town' => 'St. Urban', 'canton' => 'LU'), - '4916' => array('town' => 'Untersteckholz', 'canton' => 'BE'), - '4917' => array('town' => 'Melchnau', 'canton' => 'BE'), - '4955' => array('town' => 'Gondiswil', 'canton' => 'BE'), - '4919' => array('town' => 'Reisiswil', 'canton' => 'BE'), - '4922' => array('town' => 'Bützberg', 'canton' => 'BE'), - '4923' => array('town' => 'Wynau', 'canton' => 'BE'), - '4924' => array('town' => 'Obersteckholz', 'canton' => 'BE'), - '4932' => array('town' => 'Lotzwil', 'canton' => 'BE'), - '4933' => array('town' => 'Rütschelen', 'canton' => 'BE'), - '4934' => array('town' => 'Madiswil', 'canton' => 'BE'), - '4935' => array('town' => 'Leimiswil', 'canton' => 'BE'), - '4936' => array('town' => 'Kleindietwil', 'canton' => 'BE'), - '4937' => array('town' => 'Ursenbach', 'canton' => 'BE'), - '4938' => array('town' => 'Rohrbach', 'canton' => 'BE'), - '4942' => array('town' => 'Walterswil BE', 'canton' => 'BE'), - '4943' => array('town' => 'Oeschenbach', 'canton' => 'BE'), - '4944' => array('town' => 'Auswil', 'canton' => 'BE'), - '4950' => array('town' => 'Huttwil', 'canton' => 'BE'), - '4952' => array('town' => 'Eriswil', 'canton' => 'BE'), - '4953' => array('town' => 'Schwarzenbach BE', 'canton' => 'BE'), - '4954' => array('town' => 'Wyssachen', 'canton' => 'BE'), - '5000' => array('town' => 'Aarau', 'canton' => 'AG'), - '5001' => array('town' => 'Aarau', 'canton' => 'AG'), - '5004' => array('town' => 'Aarau', 'canton' => 'AG'), - '5012' => array('town' => 'Schönenwerd', 'canton' => 'SO'), - '5013' => array('town' => 'Niedergösgen', 'canton' => 'SO'), - '5014' => array('town' => 'Gretzenbach', 'canton' => 'SO'), - '5015' => array('town' => 'Erlinsbach SO', 'canton' => 'SO'), - '5017' => array('town' => 'Barmelweid', 'canton' => 'AG'), - '5022' => array('town' => 'Rombach', 'canton' => 'AG'), - '5023' => array('town' => 'Biberstein', 'canton' => 'AG'), - '5024' => array('town' => 'Küttigen', 'canton' => 'AG'), - '5025' => array('town' => 'Asp', 'canton' => 'AG'), - '5026' => array('town' => 'Densbüren', 'canton' => 'AG'), - '5027' => array('town' => 'Herznach', 'canton' => 'AG'), - '5028' => array('town' => 'Ueken', 'canton' => 'AG'), - '5032' => array('town' => 'Aarau Rohr', 'canton' => 'AG'), - '5033' => array('town' => 'Buchs AG', 'canton' => 'AG'), - '5034' => array('town' => 'Suhr', 'canton' => 'AG'), - '5035' => array('town' => 'Unterentfelden', 'canton' => 'AG'), - '5036' => array('town' => 'Oberentfelden', 'canton' => 'AG'), - '5037' => array('town' => 'Muhen', 'canton' => 'AG'), - '5040' => array('town' => 'Schöftland', 'canton' => 'AG'), - '5042' => array('town' => 'Hirschthal', 'canton' => 'AG'), - '5043' => array('town' => 'Holziken', 'canton' => 'AG'), - '5044' => array('town' => 'Schlossrued', 'canton' => 'AG'), - '5046' => array('town' => 'Schmiedrued', 'canton' => 'AG'), - '5053' => array('town' => 'Staffelbach', 'canton' => 'AG'), - '5054' => array('town' => 'Kirchleerau-Moosle', 'canton' => 'AG'), - '5056' => array('town' => 'Attelwil', 'canton' => 'AG'), - '5057' => array('town' => 'Reitnau', 'canton' => 'AG'), - '5102' => array('town' => 'Rupperswil', 'canton' => 'AG'), - '5103' => array('town' => 'Wildegg', 'canton' => 'AG'), - '5105' => array('town' => 'Auenstein', 'canton' => 'AG'), - '5106' => array('town' => 'Veltheim AG', 'canton' => 'AG'), - '5107' => array('town' => 'Schinznach Dorf', 'canton' => 'AG'), - '5108' => array('town' => 'Oberflachs', 'canton' => 'AG'), - '5112' => array('town' => 'Thalheim AG', 'canton' => 'AG'), - '5113' => array('town' => 'Holderbank AG', 'canton' => 'AG'), - '5116' => array('town' => 'Schinznach Bad', 'canton' => 'AG'), - '5245' => array('town' => 'Habsburg', 'canton' => 'AG'), - '5246' => array('town' => 'Scherz', 'canton' => 'AG'), - '5200' => array('town' => 'Brugg AG', 'canton' => 'AG'), - '5210' => array('town' => 'Windisch', 'canton' => 'AG'), - '5201' => array('town' => 'Brugg AG', 'canton' => 'AG'), - '5212' => array('town' => 'Hausen AG', 'canton' => 'AG'), - '5213' => array('town' => 'Villnachern', 'canton' => 'AG'), - '5222' => array('town' => 'Umiken', 'canton' => 'AG'), - '5223' => array('town' => 'Riniken', 'canton' => 'AG'), - '5224' => array('town' => 'Unterbözberg', 'canton' => 'AG'), - '5225' => array('town' => 'Oberbözberg', 'canton' => 'AG'), - '5233' => array('town' => 'Stilli', 'canton' => 'AG'), - '5234' => array('town' => 'Villigen', 'canton' => 'AG'), - '5235' => array('town' => 'Rüfenach AG', 'canton' => 'AG'), - '5236' => array('town' => 'Remigen', 'canton' => 'AG'), - '5237' => array('town' => 'Mönthal', 'canton' => 'AG'), - '5242' => array('town' => 'Birr-Lupfig', 'canton' => 'AG'), - '5243' => array('town' => 'Mülligen', 'canton' => 'AG'), - '5244' => array('town' => 'Birrhard', 'canton' => 'AG'), - '5078' => array('town' => 'Effingen', 'canton' => 'AG'), - '5076' => array('town' => 'Bözen', 'canton' => 'AG'), - '5077' => array('town' => 'Elfingen', 'canton' => 'AG'), - '5079' => array('town' => 'Zeihen', 'canton' => 'AG'), - '5075' => array('town' => 'Hornussen', 'canton' => 'AG'), - '5070' => array('town' => 'Frick', 'canton' => 'AG'), - '5072' => array('town' => 'Oeschgen', 'canton' => 'AG'), - '5073' => array('town' => 'Gipf-Oberfrick', 'canton' => 'AG'), - '5064' => array('town' => 'Wittnau', 'canton' => 'AG'), - '5063' => array('town' => 'Wölflinswil', 'canton' => 'AG'), - '5062' => array('town' => 'Oberhof', 'canton' => 'AG'), - '5074' => array('town' => 'Eiken', 'canton' => 'AG'), - '5300' => array('town' => 'Turgi', 'canton' => 'AG'), - '5301' => array('town' => 'Siggenthal Station', 'canton' => 'AG'), - '5303' => array('town' => 'Würenlingen', 'canton' => 'AG'), - '5304' => array('town' => 'Endingen', 'canton' => 'AG'), - '5305' => array('town' => 'Unterendingen', 'canton' => 'AG'), - '5306' => array('town' => 'Tegerfelden', 'canton' => 'AG'), - '5312' => array('town' => 'Döttingen', 'canton' => 'AG'), - '5313' => array('town' => 'Klingnau', 'canton' => 'AG'), - '5314' => array('town' => 'Kleindöttingen', 'canton' => 'AG'), - '5315' => array('town' => 'Böttstein', 'canton' => 'AG'), - '5316' => array('town' => 'Leuggern', 'canton' => 'AG'), - '5317' => array('town' => 'Hettenschwil', 'canton' => 'AG'), - '5318' => array('town' => 'Mandach', 'canton' => 'AG'), - '5322' => array('town' => 'Koblenz', 'canton' => 'AG'), - '5400' => array('town' => 'Baden', 'canton' => 'AG'), - '5408' => array('town' => 'Ennetbaden', 'canton' => 'AG'), - '5401' => array('town' => 'Baden', 'canton' => 'AG'), - '5402' => array('town' => 'Baden', 'canton' => 'AG'), - '5404' => array('town' => 'Baden', 'canton' => 'AG'), - '5405' => array('town' => 'Baden', 'canton' => 'AG'), - '5406' => array('town' => 'Baden', 'canton' => 'AG'), - '5412' => array('town' => 'Gebenstorf', 'canton' => 'AG'), - '5413' => array('town' => 'Birmenstorf AG', 'canton' => 'AG'), - '5415' => array('town' => 'Nussbaumen AG', 'canton' => 'AG'), - '5416' => array('town' => 'Kirchdorf AG', 'canton' => 'AG'), - '5417' => array('town' => 'Untersiggenthal', 'canton' => 'AG'), - '5420' => array('town' => 'Ehrendingen', 'canton' => 'AG'), - '5423' => array('town' => 'Freienwil', 'canton' => 'AG'), - '5425' => array('town' => 'Schneisingen', 'canton' => 'AG'), - '5426' => array('town' => 'Lengnau AG', 'canton' => 'AG'), - '5430' => array('town' => 'Wettingen', 'canton' => 'AG'), - '5431' => array('town' => 'Wettingen Sonderd', 'canton' => 'AG'), - '5432' => array('town' => 'Neuenhof', 'canton' => 'AG'), - '5442' => array('town' => 'Fislisbach', 'canton' => 'AG'), - '5443' => array('town' => 'Niederrohrdorf', 'canton' => 'AG'), - '5444' => array('town' => 'Künten', 'canton' => 'AG'), - '5445' => array('town' => 'Eggenwil', 'canton' => 'AG'), - '5452' => array('town' => 'Oberrohrdorf', 'canton' => 'AG'), - '5453' => array('town' => 'Remetschwil', 'canton' => 'AG'), - '5454' => array('town' => 'Bellikon', 'canton' => 'AG'), - '5502' => array('town' => 'Hunzenschwil', 'canton' => 'AG'), - '5503' => array('town' => 'Schafisheim', 'canton' => 'AG'), - '5504' => array('town' => 'Othmarsingen', 'canton' => 'AG'), - '5505' => array('town' => 'Brunegg', 'canton' => 'AG'), - '5506' => array('town' => 'Mägenwil', 'canton' => 'AG'), - '5507' => array('town' => 'Mellingen', 'canton' => 'AG'), - '5512' => array('town' => 'Wohlenschwil', 'canton' => 'AG'), - '5522' => array('town' => 'Tägerig', 'canton' => 'AG'), - '5524' => array('town' => 'Nesselnbach', 'canton' => 'AG'), - '5525' => array('town' => 'Fischbach-Göslikon', 'canton' => 'AG'), - '5600' => array('town' => 'Lenzburg', 'canton' => 'AG'), - '5603' => array('town' => 'Staufen', 'canton' => 'AG'), - '5604' => array('town' => 'Hendschiken', 'canton' => 'AG'), - '5605' => array('town' => 'Dottikon', 'canton' => 'AG'), - '5606' => array('town' => 'Dintikon', 'canton' => 'AG'), - '5607' => array('town' => 'Hägglingen', 'canton' => 'AG'), - '5608' => array('town' => 'Stetten AG', 'canton' => 'AG'), - '5610' => array('town' => 'Wohlen AG', 'canton' => 'AG'), - '5611' => array('town' => 'Anglikon', 'canton' => 'AG'), - '5619' => array('town' => 'Büttikon AG', 'canton' => 'AG'), - '5612' => array('town' => 'Villmergen', 'canton' => 'AG'), - '5613' => array('town' => 'Hilfikon', 'canton' => 'AG'), - '5614' => array('town' => 'Sarmenstorf', 'canton' => 'AG'), - '5615' => array('town' => 'Fahrwangen', 'canton' => 'AG'), - '5616' => array('town' => 'Meisterschwanden', 'canton' => 'AG'), - '5617' => array('town' => 'Tennwil', 'canton' => 'AG'), - '5618' => array('town' => 'Bettwil', 'canton' => 'AG'), - '5620' => array('town' => 'Bremgarten AG', 'canton' => 'AG'), - '5621' => array('town' => 'Zufikon', 'canton' => 'AG'), - '5622' => array('town' => 'Waltenschwil', 'canton' => 'AG'), - '5623' => array('town' => 'Boswil', 'canton' => 'AG'), - '5624' => array('town' => 'Bünzen', 'canton' => 'AG'), - '5625' => array('town' => 'Kallern', 'canton' => 'AG'), - '5626' => array('town' => 'Hermetschwil-Staff', 'canton' => 'AG'), - '5627' => array('town' => 'Besenbüren', 'canton' => 'AG'), - '5628' => array('town' => 'Aristau', 'canton' => 'AG'), - '5630' => array('town' => 'Muri AG', 'canton' => 'AG'), - '5632' => array('town' => 'Buttwil', 'canton' => 'AG'), - '5634' => array('town' => 'Merenschwand', 'canton' => 'AG'), - '5636' => array('town' => 'Benzenschwil', 'canton' => 'AG'), - '5637' => array('town' => 'Beinwil (Freiamt)', 'canton' => 'AG'), - '5642' => array('town' => 'Mühlau', 'canton' => 'AG'), - '5643' => array('town' => 'Sins', 'canton' => 'AG'), - '5644' => array('town' => 'Auw', 'canton' => 'AG'), - '5645' => array('town' => 'Aettenschwil', 'canton' => 'AG'), - '5646' => array('town' => 'Abtwil AG', 'canton' => 'AG'), - '5647' => array('town' => 'Oberrüti', 'canton' => 'AG'), - '5702' => array('town' => 'Niederlenz', 'canton' => 'AG'), - '5703' => array('town' => 'Seon', 'canton' => 'AG'), - '5704' => array('town' => 'Egliswil', 'canton' => 'AG'), - '5705' => array('town' => 'Hallwil', 'canton' => 'AG'), - '5706' => array('town' => 'Boniswil', 'canton' => 'AG'), - '5707' => array('town' => 'Seengen', 'canton' => 'AG'), - '5708' => array('town' => 'Birrwil', 'canton' => 'AG'), - '5712' => array('town' => 'Beinwil am See', 'canton' => 'AG'), - '5722' => array('town' => 'Gränichen', 'canton' => 'AG'), - '5723' => array('town' => 'Teufenthal AG', 'canton' => 'AG'), - '5724' => array('town' => 'Dürrenäsch', 'canton' => 'AG'), - '5725' => array('town' => 'Leutwil', 'canton' => 'AG'), - '5726' => array('town' => 'Unterkulm', 'canton' => 'AG'), - '5727' => array('town' => 'Oberkulm', 'canton' => 'AG'), - '5728' => array('town' => 'Gontenschwil', 'canton' => 'AG'), - '5732' => array('town' => 'Zetzwil', 'canton' => 'AG'), - '5733' => array('town' => 'Leimbach AG', 'canton' => 'AG'), - '5734' => array('town' => 'Reinach AG', 'canton' => 'AG'), - '5735' => array('town' => 'Pfeffikon LU', 'canton' => 'LU'), - '5736' => array('town' => 'Burg AG', 'canton' => 'AG'), - '5737' => array('town' => 'Menziken', 'canton' => 'AG'), - '5742' => array('town' => 'Kölliken', 'canton' => 'AG'), - '5745' => array('town' => 'Safenwil', 'canton' => 'AG'), - '5746' => array('town' => 'Walterswil SO', 'canton' => 'SO'), - '6000' => array('town' => 'Luzern', 'canton' => 'LU'), - '6002' => array('town' => 'Luzern', 'canton' => 'LU'), - '6003' => array('town' => 'Luzern', 'canton' => 'LU'), - '6004' => array('town' => 'Luzern', 'canton' => 'LU'), - '6005' => array('town' => 'Luzern', 'canton' => 'LU'), - '6006' => array('town' => 'Luzern', 'canton' => 'LU'), - '6010' => array('town' => 'Kriens', 'canton' => 'LU'), - '6012' => array('town' => 'Obernau', 'canton' => 'LU'), - '6013' => array('town' => 'Eigenthal', 'canton' => 'LU'), - '6014' => array('town' => 'Luzern', 'canton' => 'LU'), - '6015' => array('town' => 'Luzern', 'canton' => 'LU'), - '6016' => array('town' => 'Hellbühl', 'canton' => 'LU'), - '6017' => array('town' => 'Ruswil', 'canton' => 'LU'), - '6019' => array('town' => 'Sigigen', 'canton' => 'LU'), - '6018' => array('town' => 'Buttisholz', 'canton' => 'LU'), - '6020' => array('town' => 'Emmenbrücke', 'canton' => 'LU'), - '6022' => array('town' => 'Grosswangen', 'canton' => 'LU'), - '6023' => array('town' => 'Rothenburg', 'canton' => 'LU'), - '6024' => array('town' => 'Hildisrieden', 'canton' => 'LU'), - '6025' => array('town' => 'Neudorf', 'canton' => 'LU'), - '6026' => array('town' => 'Rain', 'canton' => 'LU'), - '6027' => array('town' => 'Römerswil LU', 'canton' => 'LU'), - '6028' => array('town' => 'Herlisberg', 'canton' => 'LU'), - '6030' => array('town' => 'Ebikon', 'canton' => 'LU'), - '6032' => array('town' => 'Emmen', 'canton' => 'LU'), - '6033' => array('town' => 'Buchrain', 'canton' => 'LU'), - '6034' => array('town' => 'Inwil', 'canton' => 'LU'), - '6035' => array('town' => 'Perlen', 'canton' => 'LU'), - '6036' => array('town' => 'Dierikon', 'canton' => 'LU'), - '6037' => array('town' => 'Root', 'canton' => 'LU'), - '6038' => array('town' => 'Gisikon', 'canton' => 'LU'), - '6042' => array('town' => 'Dietwil', 'canton' => 'AG'), - '6043' => array('town' => 'Adligenswil', 'canton' => 'LU'), - '6044' => array('town' => 'Udligenswil', 'canton' => 'LU'), - '6045' => array('town' => 'Meggen', 'canton' => 'LU'), - '6047' => array('town' => 'Kastanienbaum', 'canton' => 'LU'), - '6048' => array('town' => 'Horw', 'canton' => 'LU'), - '6052' => array('town' => 'Hergiswil NW', 'canton' => 'NW'), - '6053' => array('town' => 'Alpnachstad', 'canton' => 'OW'), - '6055' => array('town' => 'Alpnach Dorf', 'canton' => 'OW'), - '6056' => array('town' => 'Kägiswil', 'canton' => 'OW'), - '6060' => array('town' => 'Sarnen', 'canton' => 'OW'), - '6068' => array('town' => 'Melchsee-Frutt', 'canton' => 'OW'), - '6062' => array('town' => 'Wilen (Sarnen)', 'canton' => 'OW'), - '6063' => array('town' => 'Stalden (Sarnen)', 'canton' => 'OW'), - '6064' => array('town' => 'Kerns', 'canton' => 'OW'), - '6066' => array('town' => 'St. Niklausen OW', 'canton' => 'OW'), - '6067' => array('town' => 'Melchtal', 'canton' => 'OW'), - '6072' => array('town' => 'Sachseln', 'canton' => 'OW'), - '6073' => array('town' => 'Flüeli-Ranft', 'canton' => 'OW'), - '6074' => array('town' => 'Giswil', 'canton' => 'OW'), - '6078' => array('town' => 'Bürglen OW', 'canton' => 'OW'), - '6083' => array('town' => 'Hasliberg Hohfluh', 'canton' => 'BE'), - '6084' => array('town' => 'Hasliberg Wasserw', 'canton' => 'BE'), - '6085' => array('town' => 'Hasliberg Goldern', 'canton' => 'BE'), - '6086' => array('town' => 'Hasliberg Reuti', 'canton' => 'BE'), - '6102' => array('town' => 'Malters', 'canton' => 'LU'), - '6103' => array('town' => 'Schwarzenberg LU', 'canton' => 'LU'), - '6105' => array('town' => 'Schachen LU', 'canton' => 'LU'), - '6106' => array('town' => 'Werthenstein', 'canton' => 'LU'), - '6110' => array('town' => 'Wolhusen', 'canton' => 'LU'), - '6114' => array('town' => 'Steinhuserberg', 'canton' => 'LU'), - '6112' => array('town' => 'Doppleschwand', 'canton' => 'LU'), - '6113' => array('town' => 'Romoos', 'canton' => 'LU'), - '6122' => array('town' => 'Menznau', 'canton' => 'LU'), - '6123' => array('town' => 'Geiss', 'canton' => 'LU'), - '6125' => array('town' => 'Menzberg', 'canton' => 'LU'), - '6126' => array('town' => 'Daiwil', 'canton' => 'LU'), - '6130' => array('town' => 'Willisau', 'canton' => 'LU'), - '6132' => array('town' => 'Rohrmatt', 'canton' => 'LU'), - '6133' => array('town' => 'Hergiswil LU', 'canton' => 'LU'), - '6142' => array('town' => 'Gettnau', 'canton' => 'LU'), - '6143' => array('town' => 'Ohmstal', 'canton' => 'LU'), - '6144' => array('town' => 'Zell LU', 'canton' => 'LU'), - '6145' => array('town' => 'Fischbach LU', 'canton' => 'LU'), - '6146' => array('town' => 'Grossdietwil', 'canton' => 'LU'), - '6147' => array('town' => 'Altbüron', 'canton' => 'LU'), - '6152' => array('town' => 'Hüswil', 'canton' => 'LU'), - '6153' => array('town' => 'Ufhusen', 'canton' => 'LU'), - '6154' => array('town' => 'Hofstatt', 'canton' => 'LU'), - '6156' => array('town' => 'Luthern', 'canton' => 'LU'), - '6160' => array('town' => 'Entlebuch', 'canton' => 'LU'), - '6162' => array('town' => 'Entlebuch', 'canton' => 'LU'), - '6163' => array('town' => 'Ebnet', 'canton' => 'LU'), - '6166' => array('town' => 'Hasle LU', 'canton' => 'LU'), - '6167' => array('town' => 'Bramboden', 'canton' => 'LU'), - '6170' => array('town' => 'Schüpfheim', 'canton' => 'LU'), - '6173' => array('town' => 'Flühli LU', 'canton' => 'LU'), - '6174' => array('town' => 'Sörenberg', 'canton' => 'LU'), - '6182' => array('town' => 'Escholzmatt', 'canton' => 'LU'), - '6192' => array('town' => 'Wiggen', 'canton' => 'LU'), - '6196' => array('town' => 'Marbach LU', 'canton' => 'LU'), - '6197' => array('town' => 'Schangnau', 'canton' => 'BE'), - '6203' => array('town' => 'Sempach Station', 'canton' => 'LU'), - '6204' => array('town' => 'Sempach', 'canton' => 'LU'), - '6205' => array('town' => 'Eich', 'canton' => 'LU'), - '6206' => array('town' => 'Neuenkirch', 'canton' => 'LU'), - '6207' => array('town' => 'Nottwil', 'canton' => 'LU'), - '6208' => array('town' => 'Oberkirch LU', 'canton' => 'LU'), - '6210' => array('town' => 'Sursee', 'canton' => 'LU'), - '6211' => array('town' => 'Buchs LU', 'canton' => 'LU'), - '6212' => array('town' => 'St. Erhard', 'canton' => 'LU'), - '6213' => array('town' => 'Knutwil', 'canton' => 'LU'), - '6214' => array('town' => 'Schenkon', 'canton' => 'LU'), - '6215' => array('town' => 'Beromünster', 'canton' => 'LU'), - '6216' => array('town' => 'Mauensee', 'canton' => 'LU'), - '6217' => array('town' => 'Kottwil', 'canton' => 'LU'), - '6218' => array('town' => 'Ettiswil', 'canton' => 'LU'), - '6221' => array('town' => 'Rickenbach LU', 'canton' => 'LU'), - '6222' => array('town' => 'Gunzwil', 'canton' => 'LU'), - '6231' => array('town' => 'Schlierbach', 'canton' => 'LU'), - '6232' => array('town' => 'Geuensee', 'canton' => 'LU'), - '6233' => array('town' => 'Büron', 'canton' => 'LU'), - '6234' => array('town' => 'Triengen', 'canton' => 'LU'), - '6236' => array('town' => 'Wilihof', 'canton' => 'LU'), - '6235' => array('town' => 'Winikon', 'canton' => 'LU'), - '6242' => array('town' => 'Wauwil', 'canton' => 'LU'), - '6243' => array('town' => 'Egolzwil', 'canton' => 'LU'), - '6244' => array('town' => 'Nebikon', 'canton' => 'LU'), - '6245' => array('town' => 'Ebersecken', 'canton' => 'LU'), - '6246' => array('town' => 'Altishofen', 'canton' => 'LU'), - '6247' => array('town' => 'Schötz', 'canton' => 'LU'), - '6248' => array('town' => 'Alberswil', 'canton' => 'LU'), - '6252' => array('town' => 'Dagmersellen', 'canton' => 'LU'), - '6253' => array('town' => 'Uffikon', 'canton' => 'LU'), - '6260' => array('town' => 'Reiden', 'canton' => 'LU'), - '6262' => array('town' => 'Langnau b. Reiden', 'canton' => 'LU'), - '6263' => array('town' => 'Richenthal', 'canton' => 'LU'), - '6264' => array('town' => 'Pfaffnau', 'canton' => 'LU'), - '6265' => array('town' => 'Roggliswil', 'canton' => 'LU'), - '6274' => array('town' => 'Eschenbach LU', 'canton' => 'LU'), - '6275' => array('town' => 'Ballwil', 'canton' => 'LU'), - '6276' => array('town' => 'Hohenrain', 'canton' => 'LU'), - '6277' => array('town' => 'Kleinwangen', 'canton' => 'LU'), - '6280' => array('town' => 'Hochdorf', 'canton' => 'LU'), - '6283' => array('town' => 'Baldegg', 'canton' => 'LU'), - '6284' => array('town' => 'Gelfingen', 'canton' => 'LU'), - '6285' => array('town' => 'Hitzkirch', 'canton' => 'LU'), - '6289' => array('town' => 'Müswangen', 'canton' => 'LU'), - '6286' => array('town' => 'Altwis', 'canton' => 'LU'), - '6287' => array('town' => 'Aesch LU', 'canton' => 'LU'), - '6288' => array('town' => 'Schongau', 'canton' => 'LU'), - '6294' => array('town' => 'Ermensee', 'canton' => 'LU'), - '6295' => array('town' => 'Mosen', 'canton' => 'LU'), - '6300' => array('town' => 'Zug', 'canton' => 'ZG'), - '6330' => array('town' => 'Cham 2', 'canton' => 'ZG'), - '6301' => array('town' => 'Zug', 'canton' => 'ZG'), - '6310' => array('town' => 'Zug', 'canton' => 'ZG'), - '6313' => array('town' => 'Edlibach', 'canton' => 'ZG'), - '6319' => array('town' => 'Allenwinden', 'canton' => 'ZG'), - '6315' => array('town' => 'Morgarten', 'canton' => 'ZG'), - '6312' => array('town' => 'Steinhausen', 'canton' => 'ZG'), - '6314' => array('town' => 'Unterägeri', 'canton' => 'ZG'), - '6317' => array('town' => 'Oberwil b. Zug', 'canton' => 'ZG'), - '6318' => array('town' => 'Walchwil', 'canton' => 'ZG'), - '6331' => array('town' => 'Hünenberg', 'canton' => 'ZG'), - '6332' => array('town' => 'Hagendorn', 'canton' => 'ZG'), - '6340' => array('town' => 'Baar', 'canton' => 'ZG'), - '6343' => array('town' => 'Rotkreuz', 'canton' => 'ZG'), - '6344' => array('town' => 'Meierskappel', 'canton' => 'LU'), - '6345' => array('town' => 'Neuheim', 'canton' => 'ZG'), - '6353' => array('town' => 'Weggis', 'canton' => 'LU'), - '6354' => array('town' => 'Vitznau', 'canton' => 'LU'), - '6356' => array('town' => 'Rigi Kaltbad', 'canton' => 'LU'), - '6362' => array('town' => 'Stansstad', 'canton' => 'NW'), - '6363' => array('town' => 'Obbürgen', 'canton' => 'NW'), - '6365' => array('town' => 'Kehrsiten', 'canton' => 'NW'), - '6370' => array('town' => 'Stans', 'canton' => 'NW'), - '6372' => array('town' => 'Ennetmoos', 'canton' => 'NW'), - '6373' => array('town' => 'Ennetbürgen', 'canton' => 'NW'), - '6374' => array('town' => 'Buochs', 'canton' => 'NW'), - '6375' => array('town' => 'Beckenried', 'canton' => 'NW'), - '6376' => array('town' => 'Emmetten', 'canton' => 'NW'), - '6377' => array('town' => 'Seelisberg', 'canton' => 'UR'), - '6382' => array('town' => 'Büren NW', 'canton' => 'NW'), - '6383' => array('town' => 'Dallenwil', 'canton' => 'NW'), - '6386' => array('town' => 'Wolfenschiessen', 'canton' => 'NW'), - '6387' => array('town' => 'Oberrickenbach', 'canton' => 'NW'), - '6388' => array('town' => 'Grafenort', 'canton' => 'OW'), - '6390' => array('town' => 'Engelberg', 'canton' => 'OW'), - '6402' => array('town' => 'Merlischachen', 'canton' => 'SZ'), - '6403' => array('town' => 'Küssnacht am Rigi', 'canton' => 'SZ'), - '6404' => array('town' => 'Greppen', 'canton' => 'LU'), - '6405' => array('town' => 'Immensee', 'canton' => 'SZ'), - '6410' => array('town' => 'Goldau', 'canton' => 'SZ'), - '6414' => array('town' => 'Oberarth', 'canton' => 'SZ'), - '6415' => array('town' => 'Arth', 'canton' => 'SZ'), - '6416' => array('town' => 'Steinerberg', 'canton' => 'SZ'), - '6417' => array('town' => 'Sattel', 'canton' => 'SZ'), - '6418' => array('town' => 'Rothenthurm', 'canton' => 'SZ'), - '6422' => array('town' => 'Steinen', 'canton' => 'SZ'), - '6423' => array('town' => 'Seewen SZ', 'canton' => 'SZ'), - '6424' => array('town' => 'Lauerz', 'canton' => 'SZ'), - '6430' => array('town' => 'Schwyz', 'canton' => 'SZ'), - '6436' => array('town' => 'Ried (Muotathal)', 'canton' => 'SZ'), - '6432' => array('town' => 'Rickenbach SZ', 'canton' => 'SZ'), - '6433' => array('town' => 'Stoos SZ', 'canton' => 'SZ'), - '6434' => array('town' => 'Illgau', 'canton' => 'SZ'), - '6438' => array('town' => 'Ibach', 'canton' => 'SZ'), - '6440' => array('town' => 'Brunnen', 'canton' => 'SZ'), - '6441' => array('town' => 'Rütli', 'canton' => 'UR'), - '6442' => array('town' => 'Gersau', 'canton' => 'SZ'), - '6443' => array('town' => 'Morschach', 'canton' => 'SZ'), - '6452' => array('town' => 'Sisikon', 'canton' => 'UR'), - '6454' => array('town' => 'Flüelen', 'canton' => 'UR'), - '6460' => array('town' => 'Altdorf UR', 'canton' => 'UR'), - '6461' => array('town' => 'Isenthal', 'canton' => 'UR'), - '6462' => array('town' => 'Seedorf UR', 'canton' => 'UR'), - '6463' => array('town' => 'Bürglen UR', 'canton' => 'UR'), - '6464' => array('town' => 'Spiringen', 'canton' => 'UR'), - '6465' => array('town' => 'Unterschächen', 'canton' => 'UR'), - '6466' => array('town' => 'Bauen', 'canton' => 'UR'), - '6467' => array('town' => 'Schattdorf', 'canton' => 'UR'), - '6469' => array('town' => 'Haldi b.Schattdorf', 'canton' => 'UR'), - '6468' => array('town' => 'Attinghausen', 'canton' => 'UR'), - '6472' => array('town' => 'Erstfeld', 'canton' => 'UR'), - '6473' => array('town' => 'Silenen', 'canton' => 'UR'), - '6474' => array('town' => 'Amsteg', 'canton' => 'UR'), - '6475' => array('town' => 'Bristen', 'canton' => 'UR'), - '6476' => array('town' => 'Intschi', 'canton' => 'UR'), - '6482' => array('town' => 'Gurtnellen', 'canton' => 'UR'), - '6484' => array('town' => 'Wassen UR', 'canton' => 'UR'), - '6485' => array('town' => 'Meien', 'canton' => 'UR'), - '6487' => array('town' => 'Göschenen', 'canton' => 'UR'), - '6490' => array('town' => 'Andermatt', 'canton' => 'UR'), - '6491' => array('town' => 'Realp', 'canton' => 'UR'), - '6493' => array('town' => 'Hospental', 'canton' => 'UR'), - '6500' => array('town' => 'Bellinzona', 'canton' => 'TI'), - '6501' => array('town' => 'Bellinzona', 'canton' => 'TI'), - '6503' => array('town' => 'Bellinzona', 'canton' => 'TI'), - '6506' => array('town' => 'Bellinzona 6 Autop', 'canton' => 'TI'), - '6512' => array('town' => 'Giubiasco', 'canton' => 'TI'), - '6513' => array('town' => 'Monte Carasso', 'canton' => 'TI'), - '6514' => array('town' => 'Sementina', 'canton' => 'TI'), - '6515' => array('town' => 'Gudo', 'canton' => 'TI'), - '6516' => array('town' => 'Cugnasco', 'canton' => 'TI'), - '6517' => array('town' => 'Arbedo', 'canton' => 'TI'), - '6518' => array('town' => 'Gorduno', 'canton' => 'TI'), - '6525' => array('town' => 'Gnosca', 'canton' => 'TI'), - '6526' => array('town' => 'Prosito', 'canton' => 'TI'), - '6527' => array('town' => 'Lodrino', 'canton' => 'TI'), - '6528' => array('town' => 'Camorino', 'canton' => 'TI'), - '6532' => array('town' => 'Castione', 'canton' => 'TI'), - '6533' => array('town' => 'Lumino', 'canton' => 'TI'), - '6534' => array('town' => 'S. Vittore', 'canton' => 'GR'), - '6535' => array('town' => 'Roveredo GR', 'canton' => 'GR'), - '6537' => array('town' => 'Grono', 'canton' => 'GR'), - '6523' => array('town' => 'Preonzo', 'canton' => 'TI'), - '6524' => array('town' => 'Moleno', 'canton' => 'TI'), - '6582' => array('town' => 'Pianezzo', 'canton' => 'TI'), - '6583' => array('town' => 'S. Antonio', 'canton' => 'TI'), - '6584' => array('town' => 'Carena', 'canton' => 'TI'), - '6549' => array('town' => 'Laura', 'canton' => 'GR'), - '6540' => array('town' => 'Castaneda', 'canton' => 'GR'), - '6541' => array('town' => 'Sta. Maria', 'canton' => 'GR'), - '6538' => array('town' => 'Verdabbio', 'canton' => 'GR'), - '6542' => array('town' => 'Buseno', 'canton' => 'GR'), - '6543' => array('town' => 'Arvigo', 'canton' => 'GR'), - '6544' => array('town' => 'Braggio', 'canton' => 'GR'), - '6545' => array('town' => 'Selma', 'canton' => 'GR'), - '6546' => array('town' => 'Cauco', 'canton' => 'GR'), - '6547' => array('town' => 'Augio', 'canton' => 'GR'), - '6548' => array('town' => 'Rossa', 'canton' => 'GR'), - '6556' => array('town' => 'Leggia', 'canton' => 'GR'), - '6565' => array('town' => 'S. Bernardino', 'canton' => 'GR'), - '6557' => array('town' => 'Cama', 'canton' => 'GR'), - '6558' => array('town' => 'Lostallo', 'canton' => 'GR'), - '6562' => array('town' => 'Soazza', 'canton' => 'GR'), - '6563' => array('town' => 'Mesocco', 'canton' => 'GR'), - '6572' => array('town' => 'Quartino', 'canton' => 'TI'), - '6573' => array('town' => 'Magadino', 'canton' => 'TI'), - '6574' => array('town' => 'Vira (Gambarogno)', 'canton' => 'TI'), - '6575' => array('town' => 'S. Nazzaro', 'canton' => 'TI'), - '6576' => array('town' => 'Gerra (Gambarogno)', 'canton' => 'TI'), - '6577' => array('town' => 'Ranzo', 'canton' => 'TI'), - '6578' => array('town' => 'Caviano', 'canton' => 'TI'), - '6579' => array('town' => 'Piazzogna', 'canton' => 'TI'), - '6571' => array('town' => 'Indemini', 'canton' => 'TI'), - '6592' => array('town' => 'S. Antonino', 'canton' => 'TI'), - '6593' => array('town' => 'Cadenazzo', 'canton' => 'TI'), - '6594' => array('town' => 'Contone', 'canton' => 'TI'), - '6595' => array('town' => 'Riazzino', 'canton' => 'TI'), - '6596' => array('town' => 'Gordola', 'canton' => 'TI'), - '6597' => array('town' => 'Agarone', 'canton' => 'TI'), - '6598' => array('town' => 'Tenero', 'canton' => 'TI'), - '6599' => array('town' => 'Robasacco', 'canton' => 'TI'), - '6600' => array('town' => 'Locarno', 'canton' => 'TI'), - '6601' => array('town' => 'Locarno', 'canton' => 'TI'), - '6604' => array('town' => 'Locarno', 'canton' => 'TI'), - '6605' => array('town' => 'Locarno', 'canton' => 'TI'), - '6656' => array('town' => 'Golino', 'canton' => 'TI'), - '6618' => array('town' => 'Arcegno', 'canton' => 'TI'), - '6646' => array('town' => 'Contra', 'canton' => 'TI'), - '6647' => array('town' => 'Mergoscia', 'canton' => 'TI'), - '6661' => array('town' => 'Auressio', 'canton' => 'TI'), - '6611' => array('town' => 'Mosogno', 'canton' => 'TI'), - '6662' => array('town' => 'Russo', 'canton' => 'TI'), - '6664' => array('town' => 'Vergeletto', 'canton' => 'TI'), - '6663' => array('town' => 'Comologno', 'canton' => 'TI'), - '6632' => array('town' => 'Vogorno', 'canton' => 'TI'), - '6631' => array('town' => 'Corippo', 'canton' => 'TI'), - '6633' => array('town' => 'Lavertezzo', 'canton' => 'TI'), - '6634' => array('town' => 'Brione (Verzasca)', 'canton' => 'TI'), - '6635' => array('town' => 'Gerra (Verzasca)', 'canton' => 'TI'), - '6636' => array('town' => 'Frasco', 'canton' => 'TI'), - '6637' => array('town' => 'Sonogno', 'canton' => 'TI'), - '6612' => array('town' => 'Ascona', 'canton' => 'TI'), - '6613' => array('town' => 'Porto Ronco', 'canton' => 'TI'), - '6614' => array('town' => 'Brissago', 'canton' => 'TI'), - '6616' => array('town' => 'Losone', 'canton' => 'TI'), - '6622' => array('town' => 'Ronco sopra Ascona', 'canton' => 'TI'), - '6644' => array('town' => 'Orselina', 'canton' => 'TI'), - '6645' => array('town' => 'Brione s. Minusio', 'canton' => 'TI'), - '6648' => array('town' => 'Minusio', 'canton' => 'TI'), - '6655' => array('town' => 'Verdasio', 'canton' => 'TI'), - '6657' => array('town' => 'Palagnedra', 'canton' => 'TI'), - '6658' => array('town' => 'Borgnone', 'canton' => 'TI'), - '6659' => array('town' => 'Camedo', 'canton' => 'TI'), - '6652' => array('town' => 'Tegna', 'canton' => 'TI'), - '6653' => array('town' => 'Verscio', 'canton' => 'TI'), - '6654' => array('town' => 'Cavigliano', 'canton' => 'TI'), - '6670' => array('town' => 'Avegno', 'canton' => 'TI'), - '6677' => array('town' => 'Moghegno', 'canton' => 'TI'), - '6678' => array('town' => 'Coglio', 'canton' => 'TI'), - '6674' => array('town' => 'Riveo', 'canton' => 'TI'), - '6682' => array('town' => 'Linescio', 'canton' => 'TI'), - '6683' => array('town' => 'Cerentino', 'canton' => 'TI'), - '6685' => array('town' => 'Bosco/Gurin', 'canton' => 'TI'), - '6684' => array('town' => 'Campo (VM)', 'canton' => 'TI'), - '6690' => array('town' => 'Cavergno', 'canton' => 'TI'), - '6692' => array('town' => 'Brontallo', 'canton' => 'TI'), - '6693' => array('town' => 'Broglio', 'canton' => 'TI'), - '6694' => array('town' => 'Prato-Sornico', 'canton' => 'TI'), - '6695' => array('town' => 'Peccia', 'canton' => 'TI'), - '6696' => array('town' => 'Fusio', 'canton' => 'TI'), - '6672' => array('town' => 'Gordevio', 'canton' => 'TI'), - '6673' => array('town' => 'Maggia', 'canton' => 'TI'), - '6675' => array('town' => 'Cevio', 'canton' => 'TI'), - '6676' => array('town' => 'Bignasco', 'canton' => 'TI'), - '6702' => array('town' => 'Claro', 'canton' => 'TI'), - '6703' => array('town' => 'Osogna', 'canton' => 'TI'), - '6705' => array('town' => 'Cresciano', 'canton' => 'TI'), - '6707' => array('town' => 'Iragna', 'canton' => 'TI'), - '6710' => array('town' => 'Biasca', 'canton' => 'TI'), - '6721' => array('town' => 'Ludiano', 'canton' => 'TI'), - '6722' => array('town' => 'Corzoneso', 'canton' => 'TI'), - '6716' => array('town' => 'Leontica', 'canton' => 'TI'), - '6723' => array('town' => 'Prugiasco', 'canton' => 'TI'), - '6724' => array('town' => 'Ponto Valentino', 'canton' => 'TI'), - '6719' => array('town' => 'Aquila', 'canton' => 'TI'), - '6720' => array('town' => 'Campo (Blenio)', 'canton' => 'TI'), - '6713' => array('town' => 'Malvaglia', 'canton' => 'TI'), - '6714' => array('town' => 'Semione', 'canton' => 'TI'), - '6715' => array('town' => 'Dongio', 'canton' => 'TI'), - '6717' => array('town' => 'Dangio-Torre', 'canton' => 'TI'), - '6718' => array('town' => 'Olivone', 'canton' => 'TI'), - '6742' => array('town' => 'Pollegio', 'canton' => 'TI'), - '6743' => array('town' => 'Bodio TI', 'canton' => 'TI'), - '6745' => array('town' => 'Giornico', 'canton' => 'TI'), - '6746' => array('town' => 'Lavorgo', 'canton' => 'TI'), - '6747' => array('town' => 'Chironico', 'canton' => 'TI'), - '6760' => array('town' => 'Faido', 'canton' => 'TI'), - '6772' => array('town' => 'Rodi-Fiesso', 'canton' => 'TI'), - '6775' => array('town' => 'Ambrì', 'canton' => 'TI'), - '6776' => array('town' => 'Piotta', 'canton' => 'TI'), - '6777' => array('town' => 'Quinto', 'canton' => 'TI'), - '6780' => array('town' => 'Airolo', 'canton' => 'TI'), - '6781' => array('town' => 'Villa Bedretto', 'canton' => 'TI'), - '6744' => array('town' => 'Personico', 'canton' => 'TI'), - '6748' => array('town' => 'Anzonico', 'canton' => 'TI'), - '6749' => array('town' => 'Sobrio', 'canton' => 'TI'), - '6763' => array('town' => 'Mairengo', 'canton' => 'TI'), - '6764' => array('town' => 'Chiggiogna', 'canton' => 'TI'), - '6773' => array('town' => 'Prato (Leventina)', 'canton' => 'TI'), - '6774' => array('town' => 'Dalpe', 'canton' => 'TI'), - '6802' => array('town' => 'Rivera', 'canton' => 'TI'), - '6804' => array('town' => 'Bironico', 'canton' => 'TI'), - '6803' => array('town' => 'Camignolo', 'canton' => 'TI'), - '6807' => array('town' => 'Taverne', 'canton' => 'TI'), - '6808' => array('town' => 'Torricella', 'canton' => 'TI'), - '6814' => array('town' => 'Lamone-Cadempino', 'canton' => 'TI'), - '6815' => array('town' => 'Melide', 'canton' => 'TI'), - '6816' => array('town' => 'Bissone', 'canton' => 'TI'), - '6817' => array('town' => 'Maroggia', 'canton' => 'TI'), - '6818' => array('town' => 'Melano', 'canton' => 'TI'), - '6822' => array('town' => 'Arogno', 'canton' => 'TI'), - '6825' => array('town' => 'Capolago', 'canton' => 'TI'), - '6826' => array('town' => 'Riva San Vitale', 'canton' => 'TI'), - '6828' => array('town' => 'Balerna', 'canton' => 'TI'), - '6830' => array('town' => 'Chiasso', 'canton' => 'TI'), - '6839' => array('town' => 'Sagno', 'canton' => 'TI'), - '6837' => array('town' => 'Caneggio', 'canton' => 'TI'), - '6838' => array('town' => 'Cabbio', 'canton' => 'TI'), - '6832' => array('town' => 'Pedrinate', 'canton' => 'TI'), - '6833' => array('town' => 'Vacallo', 'canton' => 'TI'), - '6834' => array('town' => 'Morbio Inferiore', 'canton' => 'TI'), - '6836' => array('town' => 'Serfontana', 'canton' => 'TI'), - '6835' => array('town' => 'Morbio Superiore', 'canton' => 'TI'), - '6809' => array('town' => 'Medeglia', 'canton' => 'TI'), - '6810' => array('town' => 'Isone', 'canton' => 'TI'), - '6805' => array('town' => 'Mezzovico', 'canton' => 'TI'), - '6806' => array('town' => 'Sigirino', 'canton' => 'TI'), - '6821' => array('town' => 'Rovio', 'canton' => 'TI'), - '6823' => array('town' => 'Pugerna', 'canton' => 'TI'), - '6850' => array('town' => 'Mendrisio', 'canton' => 'TI'), - '6875' => array('town' => 'Monte', 'canton' => 'TI'), - '6873' => array('town' => 'Corteglia', 'canton' => 'TI'), - '6852' => array('town' => 'Genestrerio', 'canton' => 'TI'), - '6853' => array('town' => 'Ligornetto', 'canton' => 'TI'), - '6854' => array('town' => 'S. Pietro', 'canton' => 'TI'), - '6855' => array('town' => 'Stabio', 'canton' => 'TI'), - '6862' => array('town' => 'Rancate', 'canton' => 'TI'), - '6863' => array('town' => 'Besazio', 'canton' => 'TI'), - '6864' => array('town' => 'Arzo', 'canton' => 'TI'), - '6865' => array('town' => 'Tremona', 'canton' => 'TI'), - '6866' => array('town' => 'Meride', 'canton' => 'TI'), - '6867' => array('town' => 'Serpiano', 'canton' => 'TI'), - '6872' => array('town' => 'Salorino', 'canton' => 'TI'), - '6874' => array('town' => 'Castel San Pietro', 'canton' => 'TI'), - '6877' => array('town' => 'Coldrerio', 'canton' => 'TI'), - '6883' => array('town' => 'Novazzano', 'canton' => 'TI'), - '6900' => array('town' => 'Lugano', 'canton' => 'TI'), - '6901' => array('town' => 'Lugano', 'canton' => 'TI'), - '6902' => array('town' => 'Lugano 2 Caselle', 'canton' => 'TI'), - '6903' => array('town' => 'Lugano', 'canton' => 'TI'), - '6904' => array('town' => 'Lugano 4 Caselle', 'canton' => 'TI'), - '6905' => array('town' => 'Lugano 5 Autoposta', 'canton' => 'TI'), - '6906' => array('town' => 'Lugano 6 Caselle', 'canton' => 'TI'), - '6913' => array('town' => 'Carabbia', 'canton' => 'TI'), - '6915' => array('town' => 'Pambio-Noranco', 'canton' => 'TI'), - '6916' => array('town' => 'Grancia', 'canton' => 'TI'), - '6917' => array('town' => 'Barbengo', 'canton' => 'TI'), - '6919' => array('town' => 'Carabietta', 'canton' => 'TI'), - '6921' => array('town' => 'Vico Morcote', 'canton' => 'TI'), - '6928' => array('town' => 'Manno', 'canton' => 'TI'), - '6929' => array('town' => 'Gravesano', 'canton' => 'TI'), - '6930' => array('town' => 'Bedano', 'canton' => 'TI'), - '6939' => array('town' => 'Arosio', 'canton' => 'TI'), - '6938' => array('town' => 'Vezio', 'canton' => 'TI'), - '6937' => array('town' => 'Breno', 'canton' => 'TI'), - '6949' => array('town' => 'Comano', 'canton' => 'TI'), - '6979' => array('town' => 'Brè sopra Lugano', 'canton' => 'TI'), - '6827' => array('town' => 'Brusino Arsizio', 'canton' => 'TI'), - '6912' => array('town' => 'Pazzallo', 'canton' => 'TI'), - '6914' => array('town' => 'Carona', 'canton' => 'TI'), - '6918' => array('town' => 'Figino', 'canton' => 'TI'), - '6922' => array('town' => 'Morcote', 'canton' => 'TI'), - '6924' => array('town' => 'Sorengo', 'canton' => 'TI'), - '6925' => array('town' => 'Gentilino', 'canton' => 'TI'), - '6926' => array('town' => 'Montagnola', 'canton' => 'TI'), - '6927' => array('town' => 'Agra', 'canton' => 'TI'), - '6932' => array('town' => 'Breganzona', 'canton' => 'TI'), - '6933' => array('town' => 'Muzzano', 'canton' => 'TI'), - '6934' => array('town' => 'Bioggio', 'canton' => 'TI'), - '6935' => array('town' => 'Bosco Luganese', 'canton' => 'TI'), - '6936' => array('town' => 'Cademario', 'canton' => 'TI'), - '6942' => array('town' => 'Savosa', 'canton' => 'TI'), - '6943' => array('town' => 'Vezia', 'canton' => 'TI'), - '6948' => array('town' => 'Porza', 'canton' => 'TI'), - '6950' => array('town' => 'Tesserete', 'canton' => 'TI'), - '6944' => array('town' => 'Cureglia', 'canton' => 'TI'), - '6945' => array('town' => 'Origlio', 'canton' => 'TI'), - '6946' => array('town' => 'Ponte Capriasca', 'canton' => 'TI'), - '6947' => array('town' => 'Vaglio', 'canton' => 'TI'), - '6954' => array('town' => 'Sala Capriasca', 'canton' => 'TI'), - '6953' => array('town' => 'Lugaggia', 'canton' => 'TI'), - '6951' => array('town' => 'Insone', 'canton' => 'TI'), - '6956' => array('town' => 'Lopagno', 'canton' => 'TI'), - '6957' => array('town' => 'Roveredo TI', 'canton' => 'TI'), - '6958' => array('town' => 'Bidogno', 'canton' => 'TI'), - '6955' => array('town' => 'Cagiallo', 'canton' => 'TI'), - '6959' => array('town' => 'Cimadera', 'canton' => 'TI'), - '6952' => array('town' => 'Canobbio', 'canton' => 'TI'), - '6962' => array('town' => 'Viganello', 'canton' => 'TI'), - '6963' => array('town' => 'Pregassona', 'canton' => 'TI'), - '6964' => array('town' => 'Davesco-Soragno', 'canton' => 'TI'), - '6965' => array('town' => 'Cadro', 'canton' => 'TI'), - '6966' => array('town' => 'Villa Luganese', 'canton' => 'TI'), - '6967' => array('town' => 'Dino', 'canton' => 'TI'), - '6968' => array('town' => 'Sonvico', 'canton' => 'TI'), - '6974' => array('town' => 'Aldesago', 'canton' => 'TI'), - '6976' => array('town' => 'Castagnola', 'canton' => 'TI'), - '6977' => array('town' => 'Ruvigliana', 'canton' => 'TI'), - '6978' => array('town' => 'Gandria', 'canton' => 'TI'), - '6990' => array('town' => 'Cassina d\'Agno', 'canton' => 'TI'), - '6991' => array('town' => 'Neggio', 'canton' => 'TI'), - '6992' => array('town' => 'Vernate', 'canton' => 'TI'), - '6993' => array('town' => 'Iseo', 'canton' => 'TI'), - '6994' => array('town' => 'Aranno', 'canton' => 'TI'), - '6981' => array('town' => 'Bedigliora', 'canton' => 'TI'), - '6980' => array('town' => 'Castelrotto', 'canton' => 'TI'), - '6999' => array('town' => 'Astano', 'canton' => 'TI'), - '6986' => array('town' => 'Miglieglia', 'canton' => 'TI'), - '6989' => array('town' => 'Purasca', 'canton' => 'TI'), - '6995' => array('town' => 'Molinazzo', 'canton' => 'TI'), - '6996' => array('town' => 'Ponte Cremenaga', 'canton' => 'TI'), - '6997' => array('town' => 'Sessa', 'canton' => 'TI'), - '6998' => array('town' => 'Termine', 'canton' => 'TI'), - '6982' => array('town' => 'Agno', 'canton' => 'TI'), - '6983' => array('town' => 'Magliaso', 'canton' => 'TI'), - '6984' => array('town' => 'Pura', 'canton' => 'TI'), - '6987' => array('town' => 'Caslano', 'canton' => 'TI'), - '6988' => array('town' => 'Ponte Tresa', 'canton' => 'TI'), - '7000' => array('town' => 'Chur', 'canton' => 'GR'), - '7001' => array('town' => 'Chur', 'canton' => 'GR'), - '7002' => array('town' => 'Chur', 'canton' => 'GR'), - '7004' => array('town' => 'Chur', 'canton' => 'GR'), - '7006' => array('town' => 'Chur', 'canton' => 'GR'), - '7007' => array('town' => 'Chur', 'canton' => 'GR'), - '7012' => array('town' => 'Felsberg', 'canton' => 'GR'), - '7013' => array('town' => 'Domat/Ems', 'canton' => 'GR'), - '7015' => array('town' => 'Tamins', 'canton' => 'GR'), - '7017' => array('town' => 'Flims Dorf', 'canton' => 'GR'), - '7018' => array('town' => 'Flims Waldhaus', 'canton' => 'GR'), - '7023' => array('town' => 'Haldenstein', 'canton' => 'GR'), - '7026' => array('town' => 'Maladers', 'canton' => 'GR'), - '7031' => array('town' => 'Laax GR', 'canton' => 'GR'), - '7032' => array('town' => 'Laax GR 2', 'canton' => 'GR'), - '7050' => array('town' => 'Arosa', 'canton' => 'GR'), - '7062' => array('town' => 'Passugg-Araschgen', 'canton' => 'GR'), - '7063' => array('town' => 'Praden', 'canton' => 'GR'), - '7064' => array('town' => 'Tschiertschen', 'canton' => 'GR'), - '7074' => array('town' => 'Malix', 'canton' => 'GR'), - '7075' => array('town' => 'Churwalden', 'canton' => 'GR'), - '7076' => array('town' => 'Parpan', 'canton' => 'GR'), - '7077' => array('town' => 'Valbella', 'canton' => 'GR'), - '7078' => array('town' => 'Lenzerheide/Lai', 'canton' => 'GR'), - '7082' => array('town' => 'Vaz/Obervaz', 'canton' => 'GR'), - '7083' => array('town' => 'Lantsch/Lenz', 'canton' => 'GR'), - '7084' => array('town' => 'Brienz/Brinzauls', 'canton' => 'GR'), - '7014' => array('town' => 'Trin', 'canton' => 'GR'), - '7016' => array('town' => 'Trin Mulin', 'canton' => 'GR'), - '7019' => array('town' => 'Fidaz', 'canton' => 'GR'), - '7027' => array('town' => 'Lüen', 'canton' => 'GR'), - '7028' => array('town' => 'St. Peter', 'canton' => 'GR'), - '7056' => array('town' => 'Molinis', 'canton' => 'GR'), - '7029' => array('town' => 'Peist', 'canton' => 'GR'), - '7057' => array('town' => 'Langwies', 'canton' => 'GR'), - '7058' => array('town' => 'Litzirüti', 'canton' => 'GR'), - '7104' => array('town' => 'Versam', 'canton' => 'GR'), - '7106' => array('town' => 'Tenna', 'canton' => 'GR'), - '7107' => array('town' => 'Safien Platz', 'canton' => 'GR'), - '7109' => array('town' => 'Thalkirch', 'canton' => 'GR'), - '7122' => array('town' => 'Valendas', 'canton' => 'GR'), - '7126' => array('town' => 'Castrisch', 'canton' => 'GR'), - '7130' => array('town' => 'Ilanz', 'canton' => 'GR'), - '7154' => array('town' => 'Ruschein', 'canton' => 'GR'), - '7155' => array('town' => 'Ladir', 'canton' => 'GR'), - '7151' => array('town' => 'Schluein', 'canton' => 'GR'), - '7153' => array('town' => 'Falera', 'canton' => 'GR'), - '7152' => array('town' => 'Sagogn', 'canton' => 'GR'), - '7127' => array('town' => 'Sevgein', 'canton' => 'GR'), - '7128' => array('town' => 'Riein', 'canton' => 'GR'), - '7111' => array('town' => 'Pitasch', 'canton' => 'GR'), - '7112' => array('town' => 'Duvin', 'canton' => 'GR'), - '7113' => array('town' => 'Camuns', 'canton' => 'GR'), - '7114' => array('town' => 'Uors (Lumnezia)', 'canton' => 'GR'), - '7115' => array('town' => 'Surcasti', 'canton' => 'GR'), - '7116' => array('town' => 'Tersnaus', 'canton' => 'GR'), - '7141' => array('town' => 'Luven', 'canton' => 'GR'), - '7142' => array('town' => 'Cumbel', 'canton' => 'GR'), - '7143' => array('town' => 'Morissen', 'canton' => 'GR'), - '7144' => array('town' => 'Vella', 'canton' => 'GR'), - '7145' => array('town' => 'Degen', 'canton' => 'GR'), - '7146' => array('town' => 'Vattiz', 'canton' => 'GR'), - '7147' => array('town' => 'Vignogn', 'canton' => 'GR'), - '7148' => array('town' => 'Lumbrein', 'canton' => 'GR'), - '7149' => array('town' => 'Vrin', 'canton' => 'GR'), - '7137' => array('town' => 'Flond', 'canton' => 'GR'), - '7138' => array('town' => 'Surcuolm', 'canton' => 'GR'), - '7132' => array('town' => 'Vals', 'canton' => 'GR'), - '7133' => array('town' => 'Obersaxen Affeier', 'canton' => 'GR'), - '7134' => array('town' => 'Obersaxen Meierhof', 'canton' => 'GR'), - '7135' => array('town' => 'Obersaxen Giraniga', 'canton' => 'GR'), - '7136' => array('town' => 'Obers Friggahüs', 'canton' => 'GR'), - '7156' => array('town' => 'Pigniu', 'canton' => 'GR'), - '7157' => array('town' => 'Siat', 'canton' => 'GR'), - '7158' => array('town' => 'Waltensburg/Vuorz', 'canton' => 'GR'), - '7159' => array('town' => 'Andiast', 'canton' => 'GR'), - '7162' => array('town' => 'Tavanasa', 'canton' => 'GR'), - '7163' => array('town' => 'Danis', 'canton' => 'GR'), - '7164' => array('town' => 'Dardin', 'canton' => 'GR'), - '7165' => array('town' => 'Breil/Brigels', 'canton' => 'GR'), - '7166' => array('town' => 'Trun', 'canton' => 'GR'), - '7168' => array('town' => 'Schlans', 'canton' => 'GR'), - '7167' => array('town' => 'Zignau', 'canton' => 'GR'), - '7172' => array('town' => 'Rabius', 'canton' => 'GR'), - '7175' => array('town' => 'Sumvitg', 'canton' => 'GR'), - '7174' => array('town' => 'S. Benedetg', 'canton' => 'GR'), - '7180' => array('town' => 'Disentis/Mustér', 'canton' => 'GR'), - '7182' => array('town' => 'Cavardiras', 'canton' => 'GR'), - '7183' => array('town' => 'Mompé Medel', 'canton' => 'GR'), - '7184' => array('town' => 'Curaglia', 'canton' => 'GR'), - '7185' => array('town' => 'Platta', 'canton' => 'GR'), - '7186' => array('town' => 'Segnas', 'canton' => 'GR'), - '7187' => array('town' => 'Camischolas', 'canton' => 'GR'), - '7189' => array('town' => 'Rueras', 'canton' => 'GR'), - '7188' => array('town' => 'Sedrun', 'canton' => 'GR'), - '7173' => array('town' => 'Surrein', 'canton' => 'GR'), - '7176' => array('town' => 'Cumpadials', 'canton' => 'GR'), - '7201' => array('town' => 'Untervaz Bahnhof', 'canton' => 'GR'), - '7203' => array('town' => 'Trimmis', 'canton' => 'GR'), - '7202' => array('town' => 'Says', 'canton' => 'GR'), - '7204' => array('town' => 'Untervaz', 'canton' => 'GR'), - '7205' => array('town' => 'Zizers', 'canton' => 'GR'), - '7206' => array('town' => 'Igis', 'canton' => 'GR'), - '7208' => array('town' => 'Malans GR', 'canton' => 'GR'), - '7212' => array('town' => 'Seewis Dorf', 'canton' => 'GR'), - '7213' => array('town' => 'Valzeina', 'canton' => 'GR'), - '7214' => array('town' => 'Grüsch', 'canton' => 'GR'), - '7215' => array('town' => 'Fanas', 'canton' => 'GR'), - '7220' => array('town' => 'Schiers', 'canton' => 'GR'), - '7228' => array('town' => 'Schuders', 'canton' => 'GR'), - '7226' => array('town' => 'Stels', 'canton' => 'GR'), - '7222' => array('town' => 'Mittellunden', 'canton' => 'GR'), - '7223' => array('town' => 'Buchen', 'canton' => 'GR'), - '7224' => array('town' => 'Putz', 'canton' => 'GR'), - '7231' => array('town' => 'Pragg-Jenaz', 'canton' => 'GR'), - '7232' => array('town' => 'Furna', 'canton' => 'GR'), - '7233' => array('town' => 'Jenaz', 'canton' => 'GR'), - '7235' => array('town' => 'Fideris', 'canton' => 'GR'), - '7240' => array('town' => 'Küblis', 'canton' => 'GR'), - '7242' => array('town' => 'Luzein', 'canton' => 'GR'), - '7243' => array('town' => 'Pany', 'canton' => 'GR'), - '7244' => array('town' => 'Gadenstätt', 'canton' => 'GR'), - '7245' => array('town' => 'Ascharina', 'canton' => 'GR'), - '7246' => array('town' => 'St. Antönien', 'canton' => 'GR'), - '7241' => array('town' => 'Conters', 'canton' => 'GR'), - '7247' => array('town' => 'Saas im Prättigau', 'canton' => 'GR'), - '7249' => array('town' => 'Serneus', 'canton' => 'GR'), - '7250' => array('town' => 'Klosters', 'canton' => 'GR'), - '7252' => array('town' => 'Klosters Dorf', 'canton' => 'GR'), - '7260' => array('town' => 'Davos Dorf', 'canton' => 'GR'), - '7265' => array('town' => 'Davos Wolfgang', 'canton' => 'GR'), - '7270' => array('town' => 'Davos Platz', 'canton' => 'GR'), - '7272' => array('town' => 'Davos Clavadel', 'canton' => 'GR'), - '7276' => array('town' => 'Davos Frauenkirch', 'canton' => 'GR'), - '7277' => array('town' => 'Davos Glaris', 'canton' => 'GR'), - '7278' => array('town' => 'Davos Monstein', 'canton' => 'GR'), - '7302' => array('town' => 'Landquart', 'canton' => 'GR'), - '7303' => array('town' => 'Mastrils', 'canton' => 'GR'), - '7304' => array('town' => 'Maienfeld', 'canton' => 'GR'), - '7306' => array('town' => 'Fläsch', 'canton' => 'GR'), - '7307' => array('town' => 'Jenins', 'canton' => 'GR'), - '7310' => array('town' => 'Bad Ragaz', 'canton' => 'SG'), - '7317' => array('town' => 'Valens', 'canton' => 'SG'), - '7314' => array('town' => 'Vadura', 'canton' => 'SG'), - '7315' => array('town' => 'Vättis', 'canton' => 'SG'), - '7312' => array('town' => 'Pfäfers', 'canton' => 'SG'), - '7313' => array('town' => 'St. Margrethenberg', 'canton' => 'SG'), - '7320' => array('town' => 'Sargans', 'canton' => 'SG'), - '7325' => array('town' => 'Schwendi', 'canton' => 'SG'), - '7326' => array('town' => 'Weisstannen', 'canton' => 'SG'), - '7323' => array('town' => 'Wangs', 'canton' => 'SG'), - '7324' => array('town' => 'Vilters', 'canton' => 'SG'), - '7402' => array('town' => 'Bonaduz', 'canton' => 'GR'), - '7403' => array('town' => 'Rhäzüns', 'canton' => 'GR'), - '7404' => array('town' => 'Feldis/Veulden', 'canton' => 'GR'), - '7405' => array('town' => 'Rothenbrunnen', 'canton' => 'GR'), - '7408' => array('town' => 'Cazis', 'canton' => 'GR'), - '7411' => array('town' => 'Sils im Domleschg', 'canton' => 'GR'), - '7412' => array('town' => 'Scharans', 'canton' => 'GR'), - '7413' => array('town' => 'Fürstenaubruck', 'canton' => 'GR'), - '7414' => array('town' => 'Fürstenau', 'canton' => 'GR'), - '7415' => array('town' => 'Rodels', 'canton' => 'GR'), - '7416' => array('town' => 'Almens', 'canton' => 'GR'), - '7417' => array('town' => 'Paspels', 'canton' => 'GR'), - '7407' => array('town' => 'Trans', 'canton' => 'GR'), - '7418' => array('town' => 'Tumegl/Tomils', 'canton' => 'GR'), - '7419' => array('town' => 'Scheid', 'canton' => 'GR'), - '7430' => array('town' => 'Thusis', 'canton' => 'GR'), - '7425' => array('town' => 'Masein', 'canton' => 'GR'), - '7426' => array('town' => 'Flerden', 'canton' => 'GR'), - '7427' => array('town' => 'Urmein', 'canton' => 'GR'), - '7428' => array('town' => 'Tschappina', 'canton' => 'GR'), - '7421' => array('town' => 'Summaprada', 'canton' => 'GR'), - '7422' => array('town' => 'Tartar', 'canton' => 'GR'), - '7423' => array('town' => 'Sarn', 'canton' => 'GR'), - '7424' => array('town' => 'Präz', 'canton' => 'GR'), - '7431' => array('town' => 'Mutten', 'canton' => 'GR'), - '7432' => array('town' => 'Zillis', 'canton' => 'GR'), - '7433' => array('town' => 'Donat', 'canton' => 'GR'), - '7434' => array('town' => 'Sufers', 'canton' => 'GR'), - '7435' => array('town' => 'Splügen', 'canton' => 'GR'), - '7436' => array('town' => 'Medels', 'canton' => 'GR'), - '7437' => array('town' => 'Nufenen', 'canton' => 'GR'), - '7438' => array('town' => 'Hinterrhein', 'canton' => 'GR'), - '7440' => array('town' => 'Andeer', 'canton' => 'GR'), - '7442' => array('town' => 'Clugin', 'canton' => 'GR'), - '7443' => array('town' => 'Pignia', 'canton' => 'GR'), - '7444' => array('town' => 'Ausserferrera', 'canton' => 'GR'), - '7445' => array('town' => 'Innerferrera', 'canton' => 'GR'), - '7446' => array('town' => 'Campsut-Cröt', 'canton' => 'GR'), - '7447' => array('town' => 'Cresta (Avers)', 'canton' => 'GR'), - '7448' => array('town' => 'Juf', 'canton' => 'GR'), - '7450' => array('town' => 'Tiefencastel', 'canton' => 'GR'), - '7458' => array('town' => 'Mon', 'canton' => 'GR'), - '7459' => array('town' => 'Stierva', 'canton' => 'GR'), - '7451' => array('town' => 'Alvaschein', 'canton' => 'GR'), - '7452' => array('town' => 'Cunter', 'canton' => 'GR'), - '7453' => array('town' => 'Tinizong', 'canton' => 'GR'), - '7454' => array('town' => 'Rona', 'canton' => 'GR'), - '7455' => array('town' => 'Mulegns', 'canton' => 'GR'), - '7456' => array('town' => 'Sur', 'canton' => 'GR'), - '7457' => array('town' => 'Bivio', 'canton' => 'GR'), - '7460' => array('town' => 'Savognin', 'canton' => 'GR'), - '7462' => array('town' => 'Salouf', 'canton' => 'GR'), - '7463' => array('town' => 'Riom', 'canton' => 'GR'), - '7464' => array('town' => 'Parsonz', 'canton' => 'GR'), - '7472' => array('town' => 'Surava', 'canton' => 'GR'), - '7473' => array('town' => 'Alvaneu Bad', 'canton' => 'GR'), - '7477' => array('town' => 'Filisur', 'canton' => 'GR'), - '7482' => array('town' => 'Bergün/Bravuogn', 'canton' => 'GR'), - '7484' => array('town' => 'Latsch', 'canton' => 'GR'), - '7492' => array('town' => 'Alvaneu Dorf', 'canton' => 'GR'), - '7493' => array('town' => 'Schmitten (Albula)', 'canton' => 'GR'), - '7494' => array('town' => 'Davos Wiesen', 'canton' => 'GR'), - '7500' => array('town' => 'St. Moritz', 'canton' => 'GR'), - '7502' => array('town' => 'Bever', 'canton' => 'GR'), - '7503' => array('town' => 'Samedan', 'canton' => 'GR'), - '7504' => array('town' => 'Pontresina', 'canton' => 'GR'), - '7505' => array('town' => 'Celerina', 'canton' => 'GR'), - '7512' => array('town' => 'Champfèr', 'canton' => 'GR'), - '7513' => array('town' => 'Silvaplana', 'canton' => 'GR'), - '7514' => array('town' => 'Sils/Segl Maria', 'canton' => 'GR'), - '7515' => array('town' => 'Sils/Segl Baselgia', 'canton' => 'GR'), - '7516' => array('town' => 'Maloja', 'canton' => 'GR'), - '7517' => array('town' => 'Plaun da Lej', 'canton' => 'GR'), - '7522' => array('town' => 'La Punt-Chamues-ch', 'canton' => 'GR'), - '7523' => array('town' => 'Madulain', 'canton' => 'GR'), - '7524' => array('town' => 'Zuoz', 'canton' => 'GR'), - '7525' => array('town' => 'S-chanf', 'canton' => 'GR'), - '7526' => array('town' => 'Cinuos-chel', 'canton' => 'GR'), - '7527' => array('town' => 'Brail', 'canton' => 'GR'), - '7530' => array('town' => 'Zernez', 'canton' => 'GR'), - '7532' => array('town' => 'Tschierv', 'canton' => 'GR'), - '7533' => array('town' => 'Fuldera', 'canton' => 'GR'), - '7534' => array('town' => 'Lü', 'canton' => 'GR'), - '7535' => array('town' => 'Valchava', 'canton' => 'GR'), - '7536' => array('town' => 'Sta. Maria V. M.', 'canton' => 'GR'), - '7537' => array('town' => 'Müstair', 'canton' => 'GR'), - '7542' => array('town' => 'Susch', 'canton' => 'GR'), - '7543' => array('town' => 'Lavin', 'canton' => 'GR'), - '7545' => array('town' => 'Guarda', 'canton' => 'GR'), - '7546' => array('town' => 'Ardez', 'canton' => 'GR'), - '7550' => array('town' => 'Scuol', 'canton' => 'GR'), - '7551' => array('town' => 'Ftan', 'canton' => 'GR'), - '7552' => array('town' => 'Vulpera', 'canton' => 'GR'), - '7553' => array('town' => 'Tarasp', 'canton' => 'GR'), - '7554' => array('town' => 'Sent', 'canton' => 'GR'), - '7556' => array('town' => 'Ramosch', 'canton' => 'GR'), - '7557' => array('town' => 'Vnà', 'canton' => 'GR'), - '7558' => array('town' => 'Strada', 'canton' => 'GR'), - '7559' => array('town' => 'Tschlin', 'canton' => 'GR'), - '7560' => array('town' => 'Martina', 'canton' => 'GR'), - '7562' => array('town' => 'Samnaun-Compatsch', 'canton' => 'GR'), - '7563' => array('town' => 'Samnaun Dorf', 'canton' => 'GR'), - '7602' => array('town' => 'Casaccia', 'canton' => 'GR'), - '7603' => array('town' => 'Vicosoprano', 'canton' => 'GR'), - '7604' => array('town' => 'Borgonovo', 'canton' => 'GR'), - '7605' => array('town' => 'Stampa', 'canton' => 'GR'), - '7606' => array('town' => 'Promontogno', 'canton' => 'GR'), - '7610' => array('town' => 'Soglio', 'canton' => 'GR'), - '7608' => array('town' => 'Castasegna', 'canton' => 'GR'), - '7742' => array('town' => 'Poschiavo', 'canton' => 'GR'), - '7743' => array('town' => 'Brusio', 'canton' => 'GR'), - '7747' => array('town' => 'Viano', 'canton' => 'GR'), - '7744' => array('town' => 'Campocologno', 'canton' => 'GR'), - '7710' => array('town' => 'Ospizio Bernina', 'canton' => 'GR'), - '7741' => array('town' => 'S. Carlo GR', 'canton' => 'GR'), - '7745' => array('town' => 'Li Curt', 'canton' => 'GR'), - '7746' => array('town' => 'Le Prese', 'canton' => 'GR'), - '7748' => array('town' => 'Campascio', 'canton' => 'GR'), - '8000' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8001' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8002' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8003' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8004' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8005' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8006' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8008' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8010' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8020' => array('town' => 'Zürich 1', 'canton' => 'ZH'), - '8016' => array('town' => 'Zürich 16 Zust', 'canton' => 'ZH'), - '8080' => array('town' => 'Zürich 80', 'canton' => 'ZH'), - '8021' => array('town' => 'Zürich 1 Sihlpost', 'canton' => 'ZH'), - '8022' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8023' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8024' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8026' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8027' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8030' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8031' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8032' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8033' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8034' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8036' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8037' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8038' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8039' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8040' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8041' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8042' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8044' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8045' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8046' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8047' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8048' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8049' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8050' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8051' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8052' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8053' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8055' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8057' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8058' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8061' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8063' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8064' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8065' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8088' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8090' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8091' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8092' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8093' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8099' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8102' => array('town' => 'Oberengstringen', 'canton' => 'ZH'), - '8103' => array('town' => 'Unterengstringen', 'canton' => 'ZH'), - '8104' => array('town' => 'Weiningen ZH', 'canton' => 'ZH'), - '8105' => array('town' => 'Regensdorf', 'canton' => 'ZH'), - '8107' => array('town' => 'Buchs ZH', 'canton' => 'ZH'), - '8108' => array('town' => 'Dällikon', 'canton' => 'ZH'), - '8112' => array('town' => 'Otelfingen', 'canton' => 'ZH'), - '8113' => array('town' => 'Boppelsen', 'canton' => 'ZH'), - '8114' => array('town' => 'Dänikon ZH', 'canton' => 'ZH'), - '8115' => array('town' => 'Hüttikon', 'canton' => 'ZH'), - '5436' => array('town' => 'Würenlos', 'canton' => 'AG'), - '8117' => array('town' => 'Fällanden', 'canton' => 'ZH'), - '8121' => array('town' => 'Benglen', 'canton' => 'ZH'), - '8122' => array('town' => 'Binz', 'canton' => 'ZH'), - '8123' => array('town' => 'Ebmatingen', 'canton' => 'ZH'), - '8124' => array('town' => 'Maur', 'canton' => 'ZH'), - '8125' => array('town' => 'Zollikerberg', 'canton' => 'ZH'), - '8126' => array('town' => 'Zumikon', 'canton' => 'ZH'), - '8127' => array('town' => 'Forch', 'canton' => 'ZH'), - '8132' => array('town' => 'Hinteregg', 'canton' => 'ZH'), - '8133' => array('town' => 'Esslingen', 'canton' => 'ZH'), - '8134' => array('town' => 'Adliswil', 'canton' => 'ZH'), - '8135' => array('town' => 'Langnau am Albis', 'canton' => 'ZH'), - '8136' => array('town' => 'Gattikon', 'canton' => 'ZH'), - '8143' => array('town' => 'Uetliberg', 'canton' => 'ZH'), - '8142' => array('town' => 'Uitikon Waldegg', 'canton' => 'ZH'), - '8152' => array('town' => 'Glattbrugg', 'canton' => 'ZH'), - '8153' => array('town' => 'Rümlang', 'canton' => 'ZH'), - '8154' => array('town' => 'Oberglatt ZH', 'canton' => 'ZH'), - '8155' => array('town' => 'Niederhasli', 'canton' => 'ZH'), - '8156' => array('town' => 'Oberhasli', 'canton' => 'ZH'), - '8157' => array('town' => 'Dielsdorf', 'canton' => 'ZH'), - '8158' => array('town' => 'Regensberg', 'canton' => 'ZH'), - '8162' => array('town' => 'Steinmaur', 'canton' => 'ZH'), - '8164' => array('town' => 'Bachs', 'canton' => 'ZH'), - '8165' => array('town' => 'Schöfflisdorf', 'canton' => 'ZH'), - '8166' => array('town' => 'Niederweningen', 'canton' => 'ZH'), - '8172' => array('town' => 'Niederglatt ZH', 'canton' => 'ZH'), - '8173' => array('town' => 'Neerach', 'canton' => 'ZH'), - '8174' => array('town' => 'Stadel', 'canton' => 'ZH'), - '8175' => array('town' => 'Windlach', 'canton' => 'ZH'), - '8180' => array('town' => 'Bülach', 'canton' => 'ZH'), - '8181' => array('town' => 'Höri', 'canton' => 'ZH'), - '8182' => array('town' => 'Hochfelden', 'canton' => 'ZH'), - '8184' => array('town' => 'Bachenbülach', 'canton' => 'ZH'), - '8185' => array('town' => 'Winkel', 'canton' => 'ZH'), - '8192' => array('town' => 'Glattfelden', 'canton' => 'ZH'), - '8193' => array('town' => 'Eglisau', 'canton' => 'ZH'), - '8194' => array('town' => 'Hüntwangen', 'canton' => 'ZH'), - '8195' => array('town' => 'Wasterkingen', 'canton' => 'ZH'), - '8196' => array('town' => 'Wil ZH', 'canton' => 'ZH'), - '8197' => array('town' => 'Rafz', 'canton' => 'ZH'), - '8200' => array('town' => 'Schaffhausen', 'canton' => 'SH'), - '8201' => array('town' => 'Schaffhausen', 'canton' => 'SH'), - '8202' => array('town' => 'Schaffhausen', 'canton' => 'SH'), - '8203' => array('town' => 'Schaffhausen', 'canton' => 'SH'), - '8204' => array('town' => 'Schaffhausen', 'canton' => 'SH'), - '8205' => array('town' => 'Schaffhausen', 'canton' => 'SH'), - '8207' => array('town' => 'Schaffhausen', 'canton' => 'SH'), - '8208' => array('town' => 'Schaffhausen', 'canton' => 'SH'), - '8219' => array('town' => 'Trasadingen', 'canton' => 'SH'), - '8228' => array('town' => 'Beggingen', 'canton' => 'SH'), - '8231' => array('town' => 'Hemmental', 'canton' => 'SH'), - '8234' => array('town' => 'Stetten SH', 'canton' => 'SH'), - '8235' => array('town' => 'Lohn SH', 'canton' => 'SH'), - '8236' => array('town' => 'Opfertshofen SH', 'canton' => 'SH'), - '8242' => array('town' => 'Bibern SH', 'canton' => 'SH'), - '8243' => array('town' => 'Altdorf SH', 'canton' => 'SH'), - '8239' => array('town' => 'Dörflingen', 'canton' => 'SH'), - '8212' => array('town' => 'Neuhausen', 'canton' => 'SH'), - '8213' => array('town' => 'Neunkirch', 'canton' => 'SH'), - '8214' => array('town' => 'Gächlingen', 'canton' => 'SH'), - '8215' => array('town' => 'Hallau', 'canton' => 'SH'), - '8216' => array('town' => 'Oberhallau', 'canton' => 'SH'), - '8217' => array('town' => 'Wilchingen', 'canton' => 'SH'), - '8218' => array('town' => 'Osterfingen', 'canton' => 'SH'), - '8222' => array('town' => 'Beringen', 'canton' => 'SH'), - '8223' => array('town' => 'Guntmadingen', 'canton' => 'SH'), - '8224' => array('town' => 'Löhningen', 'canton' => 'SH'), - '8225' => array('town' => 'Siblingen', 'canton' => 'SH'), - '8226' => array('town' => 'Schleitheim', 'canton' => 'SH'), - '8232' => array('town' => 'Merishausen', 'canton' => 'SH'), - '8233' => array('town' => 'Bargen SH', 'canton' => 'SH'), - '8240' => array('town' => 'Thayngen', 'canton' => 'SH'), - '8241' => array('town' => 'Barzheim', 'canton' => 'SH'), - '8245' => array('town' => 'Feuerthalen', 'canton' => 'ZH'), - '8246' => array('town' => 'Langwiesen', 'canton' => 'ZH'), - '8247' => array('town' => 'Flurlingen', 'canton' => 'ZH'), - '8252' => array('town' => 'Schlatt TG', 'canton' => 'TG'), - '8254' => array('town' => 'Basadingen', 'canton' => 'TG'), - '8259' => array('town' => 'Kaltenbach', 'canton' => 'TG'), - '8253' => array('town' => 'Diessenhofen', 'canton' => 'TG'), - '8255' => array('town' => 'Schlattingen', 'canton' => 'TG'), - '8260' => array('town' => 'Stein am Rhein', 'canton' => 'SH'), - '8261' => array('town' => 'Hemishofen', 'canton' => 'SH'), - '8262' => array('town' => 'Ramsen', 'canton' => 'SH'), - '8263' => array('town' => 'Buch SH', 'canton' => 'SH'), - '8264' => array('town' => 'Eschenz', 'canton' => 'TG'), - '8265' => array('town' => 'Mammern', 'canton' => 'TG'), - '8266' => array('town' => 'Steckborn', 'canton' => 'TG'), - '8267' => array('town' => 'Berlingen', 'canton' => 'TG'), - '8268' => array('town' => 'Mannenbach-Salenst', 'canton' => 'TG'), - '8272' => array('town' => 'Ermatingen', 'canton' => 'TG'), - '8273' => array('town' => 'Triboltingen', 'canton' => 'TG'), - '8274' => array('town' => 'Tägerwilen', 'canton' => 'TG'), - '8280' => array('town' => 'Kreuzlingen', 'canton' => 'TG'), - '8301' => array('town' => 'Glattzentrum', 'canton' => 'ZH'), - '8302' => array('town' => 'Kloten', 'canton' => 'ZH'), - '8303' => array('town' => 'Bassersdorf', 'canton' => 'ZH'), - '8304' => array('town' => 'Wallisellen', 'canton' => 'ZH'), - '8305' => array('town' => 'Dietlikon', 'canton' => 'ZH'), - '8306' => array('town' => 'Brüttisellen', 'canton' => 'ZH'), - '8307' => array('town' => 'Effretikon', 'canton' => 'ZH'), - '8315' => array('town' => 'Lindau', 'canton' => 'ZH'), - '8308' => array('town' => 'Illnau', 'canton' => 'ZH'), - '8309' => array('town' => 'Nürensdorf', 'canton' => 'ZH'), - '8310' => array('town' => 'Kemptthal', 'canton' => 'ZH'), - '8312' => array('town' => 'Winterberg ZH', 'canton' => 'ZH'), - '8311' => array('town' => 'Brütten', 'canton' => 'ZH'), - '8314' => array('town' => 'Kyburg', 'canton' => 'ZH'), - '8130' => array('town' => 'Zumikon Y. Rocher', 'canton' => 'ZH'), - '8320' => array('town' => 'Fehraltorf', 'canton' => 'ZH'), - '8489' => array('town' => 'Wildberg', 'canton' => 'ZH'), - '8322' => array('town' => 'Madetswil', 'canton' => 'ZH'), - '8330' => array('town' => 'Pfäffikon ZH', 'canton' => 'ZH'), - '8331' => array('town' => 'Auslikon', 'canton' => 'ZH'), - '8332' => array('town' => 'Russikon', 'canton' => 'ZH'), - '8335' => array('town' => 'Hittnau', 'canton' => 'ZH'), - '8340' => array('town' => 'Hinwil', 'canton' => 'ZH'), - '8342' => array('town' => 'Wernetshausen', 'canton' => 'ZH'), - '8344' => array('town' => 'Bäretswil', 'canton' => 'ZH'), - '8345' => array('town' => 'Adetswil', 'canton' => 'ZH'), - '8352' => array('town' => 'Elsau', 'canton' => 'ZH'), - '8353' => array('town' => 'Elgg', 'canton' => 'ZH'), - '8354' => array('town' => 'Hofstetten ZH', 'canton' => 'ZH'), - '8355' => array('town' => 'Aadorf', 'canton' => 'TG'), - '8356' => array('town' => 'Ettenhausen TG', 'canton' => 'TG'), - '8357' => array('town' => 'Guntershausen', 'canton' => 'TG'), - '8360' => array('town' => 'Eschlikon TG', 'canton' => 'TG'), - '8362' => array('town' => 'Balterswil', 'canton' => 'TG'), - '8363' => array('town' => 'Bichelsee', 'canton' => 'TG'), - '8370' => array('town' => 'Sirnach', 'canton' => 'TG'), - '8372' => array('town' => 'Wiezikon b.Sirnach', 'canton' => 'TG'), - '8374' => array('town' => 'Oberwangen TG', 'canton' => 'TG'), - '8376' => array('town' => 'Fischingen', 'canton' => 'TG'), - '8400' => array('town' => 'Winterthur', 'canton' => 'ZH'), - '8401' => array('town' => 'Winterthur', 'canton' => 'ZH'), - '8402' => array('town' => 'Winterthur', 'canton' => 'ZH'), - '8404' => array('town' => 'Winterthur', 'canton' => 'ZH'), - '8405' => array('town' => 'Winterthur', 'canton' => 'ZH'), - '8406' => array('town' => 'Winterthur', 'canton' => 'ZH'), - '8408' => array('town' => 'Winterthur', 'canton' => 'ZH'), - '8409' => array('town' => 'Winterthur', 'canton' => 'ZH'), - '8410' => array('town' => 'Winterthur', 'canton' => 'ZH'), - '8411' => array('town' => 'Winterthur', 'canton' => 'ZH'), - '8412' => array('town' => 'Aesch (Neftenbach)', 'canton' => 'ZH'), - '8413' => array('town' => 'Neftenbach', 'canton' => 'ZH'), - '8414' => array('town' => 'Buch am Irchel', 'canton' => 'ZH'), - '8415' => array('town' => 'Berg am Irchel', 'canton' => 'ZH'), - '8416' => array('town' => 'Flaach', 'canton' => 'ZH'), - '8418' => array('town' => 'Schlatt', 'canton' => 'ZH'), - '8422' => array('town' => 'Pfungen', 'canton' => 'ZH'), - '8421' => array('town' => 'Dättlikon', 'canton' => 'ZH'), - '8423' => array('town' => 'Embrach-Embraport', 'canton' => 'ZH'), - '8424' => array('town' => 'Embrach', 'canton' => 'ZH'), - '8425' => array('town' => 'Oberembrach', 'canton' => 'ZH'), - '8426' => array('town' => 'Lufingen', 'canton' => 'ZH'), - '8427' => array('town' => 'Rorbas-Freienstein', 'canton' => 'ZH'), - '8428' => array('town' => 'Teufen ZH', 'canton' => 'ZH'), - '8187' => array('town' => 'Weiach', 'canton' => 'ZH'), - '5466' => array('town' => 'Kaiserstuhl AG', 'canton' => 'AG'), - '5467' => array('town' => 'Fisibach', 'canton' => 'AG'), - '5332' => array('town' => 'Rekingen AG', 'canton' => 'AG'), - '5330' => array('town' => 'Bad Zurzach', 'canton' => 'AG'), - '5323' => array('town' => 'Rietheim', 'canton' => 'AG'), - '5464' => array('town' => 'Rümikon AG', 'canton' => 'AG'), - '5465' => array('town' => 'Mellikon', 'canton' => 'AG'), - '5463' => array('town' => 'Wislikofen', 'canton' => 'AG'), - '5462' => array('town' => 'Siglistorf', 'canton' => 'AG'), - '5333' => array('town' => 'Baldingen', 'canton' => 'AG'), - '5334' => array('town' => 'Böbikon', 'canton' => 'AG'), - '8442' => array('town' => 'Hettlingen', 'canton' => 'ZH'), - '8444' => array('town' => 'Henggart', 'canton' => 'ZH'), - '8447' => array('town' => 'Dachsen', 'canton' => 'ZH'), - '8248' => array('town' => 'Uhwiesen', 'canton' => 'ZH'), - '8450' => array('town' => 'Andelfingen', 'canton' => 'ZH'), - '8453' => array('town' => 'Alten', 'canton' => 'ZH'), - '8451' => array('town' => 'Kleinandelfingen', 'canton' => 'ZH'), - '8452' => array('town' => 'Adlikon', 'canton' => 'ZH'), - '8457' => array('town' => 'Humlikon', 'canton' => 'ZH'), - '8458' => array('town' => 'Dorf', 'canton' => 'ZH'), - '8459' => array('town' => 'Volken', 'canton' => 'ZH'), - '8454' => array('town' => 'Buchberg', 'canton' => 'SH'), - '8455' => array('town' => 'Rüdlingen', 'canton' => 'SH'), - '8460' => array('town' => 'Marthalen', 'canton' => 'ZH'), - '8464' => array('town' => 'Ellikon am Rhein', 'canton' => 'ZH'), - '8461' => array('town' => 'Oerlingen', 'canton' => 'ZH'), - '8465' => array('town' => 'Rudolfingen', 'canton' => 'ZH'), - '8466' => array('town' => 'Trüllikon', 'canton' => 'ZH'), - '8462' => array('town' => 'Rheinau', 'canton' => 'ZH'), - '8463' => array('town' => 'Benken ZH', 'canton' => 'ZH'), - '8472' => array('town' => 'Seuzach', 'canton' => 'ZH'), - '8474' => array('town' => 'Dinhard', 'canton' => 'ZH'), - '8475' => array('town' => 'Ossingen', 'canton' => 'ZH'), - '8476' => array('town' => 'Unterstammheim', 'canton' => 'ZH'), - '8477' => array('town' => 'Oberstammheim', 'canton' => 'ZH'), - '8471' => array('town' => 'Rutschwil', 'canton' => 'ZH'), - '8478' => array('town' => 'Thalheim', 'canton' => 'ZH'), - '8479' => array('town' => 'Altikon', 'canton' => 'ZH'), - '8467' => array('town' => 'Truttikon', 'canton' => 'ZH'), - '8468' => array('town' => 'Guntalingen', 'canton' => 'ZH'), - '8482' => array('town' => 'Sennhof', 'canton' => 'ZH'), - '8483' => array('town' => 'Kollbrunn', 'canton' => 'ZH'), - '8484' => array('town' => 'Weisslingen', 'canton' => 'ZH'), - '8486' => array('town' => 'Rikon im Tösstal', 'canton' => 'ZH'), - '8487' => array('town' => 'Rämismühle', 'canton' => 'ZH'), - '8488' => array('town' => 'Turbenthal', 'canton' => 'ZH'), - '8492' => array('town' => 'Wila', 'canton' => 'ZH'), - '8493' => array('town' => 'Saland', 'canton' => 'ZH'), - '8494' => array('town' => 'Bauma', 'canton' => 'ZH'), - '8496' => array('town' => 'Steg im Tösstal', 'canton' => 'ZH'), - '8497' => array('town' => 'Fischenthal', 'canton' => 'ZH'), - '8498' => array('town' => 'Gibswil-Ried', 'canton' => 'ZH'), - '8495' => array('town' => 'Schmidrüti', 'canton' => 'ZH'), - '8499' => array('town' => 'Sternenberg', 'canton' => 'ZH'), - '8500' => array('town' => 'Frauenfeld', 'canton' => 'TG'), - '8501' => array('town' => 'Frauenfeld', 'canton' => 'TG'), - '8502' => array('town' => 'Frauenfeld', 'canton' => 'TG'), - '8503' => array('town' => 'Frauenfeld', 'canton' => 'TG'), - '8505' => array('town' => 'Pfyn', 'canton' => 'TG'), - '8506' => array('town' => 'Lanzenneunforn', 'canton' => 'TG'), - '8507' => array('town' => 'Hörhausen', 'canton' => 'TG'), - '8508' => array('town' => 'Homburg', 'canton' => 'TG'), - '8512' => array('town' => 'Thundorf', 'canton' => 'TG'), - '8514' => array('town' => 'Amlikon-Bissegg', 'canton' => 'TG'), - '8522' => array('town' => 'Häuslenen', 'canton' => 'TG'), - '8523' => array('town' => 'Hagenbuch ZH', 'canton' => 'ZH'), - '8524' => array('town' => 'Uesslingen', 'canton' => 'TG'), - '8525' => array('town' => 'Niederneunforn', 'canton' => 'TG'), - '8526' => array('town' => 'Oberneunforn', 'canton' => 'TG'), - '8532' => array('town' => 'Warth', 'canton' => 'TG'), - '8535' => array('town' => 'Herdern', 'canton' => 'TG'), - '8536' => array('town' => 'Hüttwilen', 'canton' => 'TG'), - '8537' => array('town' => 'Nussbaumen TG', 'canton' => 'TG'), - '8542' => array('town' => 'Wiesendangen', 'canton' => 'ZH'), - '8545' => array('town' => 'Rickenbach ZH', 'canton' => 'ZH'), - '8544' => array('town' => 'Attikon', 'canton' => 'ZH'), - '8546' => array('town' => 'Islikon', 'canton' => 'TG'), - '8547' => array('town' => 'Gachnang', 'canton' => 'TG'), - '8548' => array('town' => 'Ellikon a d Thur', 'canton' => 'ZH'), - '8552' => array('town' => 'Felben-Wellhausen', 'canton' => 'TG'), - '8553' => array('town' => 'Hüttlingen-Mettdf', 'canton' => 'TG'), - '8554' => array('town' => 'Müllheim-Wigoltgn', 'canton' => 'TG'), - '8555' => array('town' => 'Müllheim Dorf', 'canton' => 'TG'), - '8556' => array('town' => 'Wigoltingen', 'canton' => 'TG'), - '8564' => array('town' => 'Lipperswil', 'canton' => 'TG'), - '8558' => array('town' => 'Raperswilen', 'canton' => 'TG'), - '8269' => array('town' => 'Fruthwilen', 'canton' => 'TG'), - '8560' => array('town' => 'Märstetten', 'canton' => 'TG'), - '8561' => array('town' => 'Ottoberg', 'canton' => 'TG'), - '8565' => array('town' => 'Hugelshofen', 'canton' => 'TG'), - '8566' => array('town' => 'Dotnacht', 'canton' => 'TG'), - '8570' => array('town' => 'Weinfelden', 'canton' => 'TG'), - '8572' => array('town' => 'Berg TG', 'canton' => 'TG'), - '8573' => array('town' => 'Siegershausen', 'canton' => 'TG'), - '8574' => array('town' => 'Lengwil-Oberhofen', 'canton' => 'TG'), - '8575' => array('town' => 'Bürglen TG', 'canton' => 'TG'), - '8576' => array('town' => 'Mauren TG', 'canton' => 'TG'), - '8577' => array('town' => 'Schönholzerswilen', 'canton' => 'TG'), - '9217' => array('town' => 'Neukirch', 'canton' => 'TG'), - '8580' => array('town' => 'Amriswil', 'canton' => 'TG'), - '8582' => array('town' => 'Dozwil', 'canton' => 'TG'), - '8581' => array('town' => 'Schocherswil', 'canton' => 'TG'), - '8588' => array('town' => 'Zihlschlacht', 'canton' => 'TG'), - '8589' => array('town' => 'Sitterdorf', 'canton' => 'TG'), - '8583' => array('town' => 'Sulgen', 'canton' => 'TG'), - '8584' => array('town' => 'Leimbach TG', 'canton' => 'TG'), - '8585' => array('town' => 'Mattwil', 'canton' => 'TG'), - '8586' => array('town' => 'Erlen', 'canton' => 'TG'), - '8587' => array('town' => 'Oberaach', 'canton' => 'TG'), - '8590' => array('town' => 'Romanshorn', 'canton' => 'TG'), - '8599' => array('town' => 'Salmsach', 'canton' => 'TG'), - '8592' => array('town' => 'Uttwil', 'canton' => 'TG'), - '8593' => array('town' => 'Kesswil', 'canton' => 'TG'), - '8594' => array('town' => 'Güttingen', 'canton' => 'TG'), - '8595' => array('town' => 'Altnau', 'canton' => 'TG'), - '8596' => array('town' => 'Scherzingen', 'canton' => 'TG'), - '8597' => array('town' => 'Landschlacht', 'canton' => 'TG'), - '8598' => array('town' => 'Bottighofen', 'canton' => 'TG'), - '8600' => array('town' => 'Dübendorf', 'canton' => 'ZH'), - '8602' => array('town' => 'Wangen ZH', 'canton' => 'ZH'), - '8603' => array('town' => 'Schwerzenbach', 'canton' => 'ZH'), - '8604' => array('town' => 'Volketswil', 'canton' => 'ZH'), - '8605' => array('town' => 'Gutenswil', 'canton' => 'ZH'), - '8606' => array('town' => 'Nänikon', 'canton' => 'ZH'), - '8607' => array('town' => 'Aathal-Seegräben', 'canton' => 'ZH'), - '8608' => array('town' => 'Bubikon', 'canton' => 'ZH'), - '8610' => array('town' => 'Uster', 'canton' => 'ZH'), - '8612' => array('town' => 'Uster 2', 'canton' => 'ZH'), - '8613' => array('town' => 'Uster 3', 'canton' => 'ZH'), - '8614' => array('town' => 'Bertschikon Gossau', 'canton' => 'ZH'), - '8615' => array('town' => 'Wermatswil', 'canton' => 'ZH'), - '8616' => array('town' => 'Riedikon', 'canton' => 'ZH'), - '8617' => array('town' => 'Mönchaltorf', 'canton' => 'ZH'), - '8618' => array('town' => 'Oetwil am See', 'canton' => 'ZH'), - '8620' => array('town' => 'Wetzikon ZH', 'canton' => 'ZH'), - '8621' => array('town' => 'Wetzikon ZH 4', 'canton' => 'ZH'), - '8622' => array('town' => 'Wetzikon ZH', 'canton' => 'ZH'), - '8623' => array('town' => 'Wetzikon ZH', 'canton' => 'ZH'), - '8624' => array('town' => 'Grüt (Gossau ZH)', 'canton' => 'ZH'), - '8625' => array('town' => 'Gossau ZH', 'canton' => 'ZH'), - '8626' => array('town' => 'Ottikon', 'canton' => 'ZH'), - '8627' => array('town' => 'Grüningen', 'canton' => 'ZH'), - '8630' => array('town' => 'Rüti ZH', 'canton' => 'ZH'), - '8632' => array('town' => 'Tann', 'canton' => 'ZH'), - '8633' => array('town' => 'Wolfhausen', 'canton' => 'ZH'), - '8634' => array('town' => 'Hombrechtikon', 'canton' => 'ZH'), - '8635' => array('town' => 'Dürnten', 'canton' => 'ZH'), - '8636' => array('town' => 'Wald ZH', 'canton' => 'ZH'), - '8639' => array('town' => 'Faltigberg', 'canton' => 'ZH'), - '8637' => array('town' => 'Laupen ZH', 'canton' => 'ZH'), - '8638' => array('town' => 'Goldingen', 'canton' => 'SG'), - '8640' => array('town' => 'Rapperswil SG', 'canton' => 'SG'), - '8645' => array('town' => 'Jona', 'canton' => 'SG'), - '8646' => array('town' => 'Wagen', 'canton' => 'SG'), - '8700' => array('town' => 'Küsnacht ZH', 'canton' => 'ZH'), - '8702' => array('town' => 'Zollikon', 'canton' => 'ZH'), - '8703' => array('town' => 'Erlenbach ZH', 'canton' => 'ZH'), - '8704' => array('town' => 'Herrliberg', 'canton' => 'ZH'), - '8706' => array('town' => 'Meilen', 'canton' => 'ZH'), - '8707' => array('town' => 'Uetikon am See', 'canton' => 'ZH'), - '8708' => array('town' => 'Männedorf', 'canton' => 'ZH'), - '8712' => array('town' => 'Stäfa', 'canton' => 'ZH'), - '8713' => array('town' => 'Uerikon', 'canton' => 'ZH'), - '8714' => array('town' => 'Feldbach', 'canton' => 'ZH'), - '8715' => array('town' => 'Bollingen', 'canton' => 'SG'), - '8716' => array('town' => 'Schmerikon', 'canton' => 'SG'), - '8717' => array('town' => 'Benken SG', 'canton' => 'SG'), - '8718' => array('town' => 'Schänis', 'canton' => 'SG'), - '8722' => array('town' => 'Kaltbrunn', 'canton' => 'SG'), - '8723' => array('town' => 'Rufi', 'canton' => 'SG'), - '8725' => array('town' => 'Ernetschwil', 'canton' => 'SG'), - '8726' => array('town' => 'Ricken SG', 'canton' => 'SG'), - '8727' => array('town' => 'Walde SG', 'canton' => 'SG'), - '8730' => array('town' => 'Uznach', 'canton' => 'SG'), - '8732' => array('town' => 'Neuhaus SG', 'canton' => 'SG'), - '8733' => array('town' => 'Eschenbach SG', 'canton' => 'SG'), - '8734' => array('town' => 'Ermenswil', 'canton' => 'SG'), - '8735' => array('town' => 'St. Gallenkappel', 'canton' => 'SG'), - '8737' => array('town' => 'Gommiswald', 'canton' => 'SG'), - '8738' => array('town' => 'Uetliburg SG', 'canton' => 'SG'), - '8739' => array('town' => 'Rieden SG', 'canton' => 'SG'), - '8740' => array('town' => 'Uznach Vögele AG', 'canton' => 'SG'), - '8750' => array('town' => 'Glarus', 'canton' => 'GL'), - '8751' => array('town' => 'Urnerboden', 'canton' => 'UR'), - '8752' => array('town' => 'Näfels', 'canton' => 'GL'), - '8753' => array('town' => 'Mollis', 'canton' => 'GL'), - '8754' => array('town' => 'Netstal', 'canton' => 'GL'), - '8755' => array('town' => 'Ennenda', 'canton' => 'GL'), - '8756' => array('town' => 'Mitlödi', 'canton' => 'GL'), - '8762' => array('town' => 'Schwanden GL', 'canton' => 'GL'), - '8765' => array('town' => 'Engi', 'canton' => 'GL'), - '8766' => array('town' => 'Matt', 'canton' => 'GL'), - '8767' => array('town' => 'Elm', 'canton' => 'GL'), - '8772' => array('town' => 'Nidfurn', 'canton' => 'GL'), - '8773' => array('town' => 'Haslen GL', 'canton' => 'GL'), - '8775' => array('town' => 'Luchsingen', 'canton' => 'GL'), - '8777' => array('town' => 'Diesbach GL', 'canton' => 'GL'), - '8782' => array('town' => 'Rüti GL', 'canton' => 'GL'), - '8783' => array('town' => 'Linthal', 'canton' => 'GL'), - '8784' => array('town' => 'Braunwald', 'canton' => 'GL'), - '8800' => array('town' => 'Thalwil', 'canton' => 'ZH'), - '8802' => array('town' => 'Kilchberg ZH', 'canton' => 'ZH'), - '8803' => array('town' => 'Rüschlikon', 'canton' => 'ZH'), - '8804' => array('town' => 'Au ZH', 'canton' => 'ZH'), - '8805' => array('town' => 'Richterswil', 'canton' => 'ZH'), - '8806' => array('town' => 'Bäch SZ', 'canton' => 'SZ'), - '8807' => array('town' => 'Freienbach', 'canton' => 'SZ'), - '8808' => array('town' => 'Pfäffikon SZ', 'canton' => 'SZ'), - '8810' => array('town' => 'Horgen', 'canton' => 'ZH'), - '8812' => array('town' => 'Horgen', 'canton' => 'ZH'), - '8813' => array('town' => 'Horgen', 'canton' => 'ZH'), - '8815' => array('town' => 'Horgenberg', 'canton' => 'ZH'), - '8816' => array('town' => 'Hirzel', 'canton' => 'ZH'), - '8820' => array('town' => 'Wädenswil', 'canton' => 'ZH'), - '8824' => array('town' => 'Schönenberg ZH', 'canton' => 'ZH'), - '8825' => array('town' => 'Hütten', 'canton' => 'ZH'), - '8832' => array('town' => 'Wollerau', 'canton' => 'SZ'), - '8833' => array('town' => 'Samstagern', 'canton' => 'ZH'), - '8834' => array('town' => 'Schindellegi', 'canton' => 'SZ'), - '8835' => array('town' => 'Feusisberg', 'canton' => 'SZ'), - '8836' => array('town' => 'Bennau', 'canton' => 'SZ'), - '8840' => array('town' => 'Einsiedeln', 'canton' => 'SZ'), - '8849' => array('town' => 'Alpthal', 'canton' => 'SZ'), - '8846' => array('town' => 'Willerzell', 'canton' => 'SZ'), - '8847' => array('town' => 'Egg SZ', 'canton' => 'SZ'), - '8841' => array('town' => 'Gross', 'canton' => 'SZ'), - '8844' => array('town' => 'Euthal', 'canton' => 'SZ'), - '8845' => array('town' => 'Studen SZ', 'canton' => 'SZ'), - '8842' => array('town' => 'Unteriberg', 'canton' => 'SZ'), - '8843' => array('town' => 'Oberiberg', 'canton' => 'SZ'), - '8852' => array('town' => 'Altendorf', 'canton' => 'SZ'), - '8853' => array('town' => 'Lachen SZ', 'canton' => 'SZ'), - '8854' => array('town' => 'Siebnen', 'canton' => 'SZ'), - '8855' => array('town' => 'Wangen SZ', 'canton' => 'SZ'), - '8856' => array('town' => 'Tuggen', 'canton' => 'SZ'), - '8857' => array('town' => 'Vorderthal', 'canton' => 'SZ'), - '8858' => array('town' => 'Innerthal', 'canton' => 'SZ'), - '8862' => array('town' => 'Schübelbach', 'canton' => 'SZ'), - '8863' => array('town' => 'Buttikon SZ', 'canton' => 'SZ'), - '8864' => array('town' => 'Reichenburg', 'canton' => 'SZ'), - '8865' => array('town' => 'Bilten', 'canton' => 'GL'), - '8866' => array('town' => 'Ziegelbrücke', 'canton' => 'GL'), - '8867' => array('town' => 'Niederurnen', 'canton' => 'GL'), - '8868' => array('town' => 'Oberurnen', 'canton' => 'GL'), - '8872' => array('town' => 'Weesen', 'canton' => 'SG'), - '8873' => array('town' => 'Amden', 'canton' => 'SG'), - '8874' => array('town' => 'Mühlehorn', 'canton' => 'GL'), - '8758' => array('town' => 'Obstalden', 'canton' => 'GL'), - '8757' => array('town' => 'Filzbach', 'canton' => 'GL'), - '8877' => array('town' => 'Murg', 'canton' => 'SG'), - '8878' => array('town' => 'Quinten', 'canton' => 'SG'), - '8880' => array('town' => 'Walenstadt', 'canton' => 'SG'), - '8881' => array('town' => 'Walenstadtberg', 'canton' => 'SG'), - '8882' => array('town' => 'Unterterzen', 'canton' => 'SG'), - '8883' => array('town' => 'Quarten', 'canton' => 'SG'), - '8884' => array('town' => 'Oberterzen', 'canton' => 'SG'), - '8885' => array('town' => 'Mols', 'canton' => 'SG'), - '8887' => array('town' => 'Mels', 'canton' => 'SG'), - '8886' => array('town' => 'Mädris-Vermol', 'canton' => 'SG'), - '8889' => array('town' => 'Plons', 'canton' => 'SG'), - '8888' => array('town' => 'Heiligkreuz (Mels)', 'canton' => 'SG'), - '8890' => array('town' => 'Flums', 'canton' => 'SG'), - '8892' => array('town' => 'Berschis', 'canton' => 'SG'), - '8893' => array('town' => 'Flums Hochwiese', 'canton' => 'SG'), - '8894' => array('town' => 'Flumserberg Saxli', 'canton' => 'SG'), - '8895' => array('town' => 'Flumserberg Portel', 'canton' => 'SG'), - '8896' => array('town' => 'Flumserberg Bergh', 'canton' => 'SG'), - '8897' => array('town' => 'Flumserberg Theim', 'canton' => 'SG'), - '8898' => array('town' => 'Flumserberg Tboden', 'canton' => 'SG'), - '8902' => array('town' => 'Urdorf', 'canton' => 'ZH'), - '8903' => array('town' => 'Birmensdorf ZH', 'canton' => 'ZH'), - '8904' => array('town' => 'Aesch ZH', 'canton' => 'ZH'), - '8905' => array('town' => 'Arni-Islisberg', 'canton' => 'AG'), - '8906' => array('town' => 'Bonstetten', 'canton' => 'ZH'), - '8907' => array('town' => 'Wettswil', 'canton' => 'ZH'), - '8908' => array('town' => 'Hedingen', 'canton' => 'ZH'), - '8910' => array('town' => 'Affoltern am Albis', 'canton' => 'ZH'), - '8909' => array('town' => 'Zwillikon', 'canton' => 'ZH'), - '8911' => array('town' => 'Rifferswil', 'canton' => 'ZH'), - '8912' => array('town' => 'Obfelden', 'canton' => 'ZH'), - '8913' => array('town' => 'Ottenbach', 'canton' => 'ZH'), - '8914' => array('town' => 'Aeugst am Albis', 'canton' => 'ZH'), - '8915' => array('town' => 'Hausen am Albis', 'canton' => 'ZH'), - '8916' => array('town' => 'Jonen', 'canton' => 'AG'), - '8917' => array('town' => 'Oberlunkhofen', 'canton' => 'AG'), - '8918' => array('town' => 'Unterlunkhofen', 'canton' => 'AG'), - '8919' => array('town' => 'Rottenschwil', 'canton' => 'AG'), - '8925' => array('town' => 'Ebertswil', 'canton' => 'ZH'), - '8926' => array('town' => 'Kappel am Albis', 'canton' => 'ZH'), - '8932' => array('town' => 'Mettmenstetten', 'canton' => 'ZH'), - '8933' => array('town' => 'Maschwanden', 'canton' => 'ZH'), - '8934' => array('town' => 'Knonau', 'canton' => 'ZH'), - '8942' => array('town' => 'Oberrieden', 'canton' => 'ZH'), - '8951' => array('town' => 'Fahrweid', 'canton' => 'ZH'), - '8952' => array('town' => 'Schlieren', 'canton' => 'ZH'), - '8953' => array('town' => 'Dietikon', 'canton' => 'ZH'), - '8954' => array('town' => 'Geroldswil', 'canton' => 'ZH'), - '8955' => array('town' => 'Oetwil a.d. Limmat', 'canton' => 'ZH'), - '8956' => array('town' => 'Killwangen', 'canton' => 'AG'), - '8957' => array('town' => 'Spreitenbach', 'canton' => 'AG'), - '8962' => array('town' => 'Bergdietikon', 'canton' => 'AG'), - '8964' => array('town' => 'Rudolfstetten', 'canton' => 'AG'), - '8965' => array('town' => 'Berikon', 'canton' => 'AG'), - '8966' => array('town' => 'Oberwil-Lieli', 'canton' => 'AG'), - '8967' => array('town' => 'Widen', 'canton' => 'AG'), - '9000' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9001' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9004' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9006' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9007' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9008' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9009' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9010' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9011' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9012' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9013' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9014' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9015' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9016' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '9030' => array('town' => 'Abtwil SG', 'canton' => 'SG'), - '9032' => array('town' => 'Engelburg', 'canton' => 'SG'), - '9033' => array('town' => 'Untereggen', 'canton' => 'SG'), - '9034' => array('town' => 'Eggersriet', 'canton' => 'SG'), - '9035' => array('town' => 'Grub AR', 'canton' => 'AR'), - '9036' => array('town' => 'Grub SG', 'canton' => 'SG'), - '9037' => array('town' => 'Speicherschwendi', 'canton' => 'AR'), - '9038' => array('town' => 'Rehetobel', 'canton' => 'AR'), - '9042' => array('town' => 'Speicher', 'canton' => 'AR'), - '9043' => array('town' => 'Trogen', 'canton' => 'AR'), - '9044' => array('town' => 'Wald AR', 'canton' => 'AR'), - '9050' => array('town' => 'Appenzell', 'canton' => 'AI'), - '9052' => array('town' => 'Niederteufen', 'canton' => 'AR'), - '9053' => array('town' => 'Teufen AR', 'canton' => 'AR'), - '9054' => array('town' => 'Haslen AI', 'canton' => 'AI'), - '9055' => array('town' => 'Bühler', 'canton' => 'AR'), - '9056' => array('town' => 'Gais', 'canton' => 'AR'), - '9057' => array('town' => 'Weissbad', 'canton' => 'AI'), - '9058' => array('town' => 'Brülisau', 'canton' => 'AI'), - '9062' => array('town' => 'Lustmühle', 'canton' => 'AR'), - '9063' => array('town' => 'Stein AR', 'canton' => 'AR'), - '9064' => array('town' => 'Hundwil', 'canton' => 'AR'), - '9100' => array('town' => 'Herisau', 'canton' => 'AR'), - '9102' => array('town' => 'Herisau', 'canton' => 'AR'), - '9103' => array('town' => 'Schwellbrunn', 'canton' => 'AR'), - '9104' => array('town' => 'Waldstatt', 'canton' => 'AR'), - '9105' => array('town' => 'Schönengrund', 'canton' => 'AR'), - '9107' => array('town' => 'Urnäsch', 'canton' => 'AR'), - '9108' => array('town' => 'Gonten', 'canton' => 'AI'), - '9112' => array('town' => 'Schachen b.Herisau', 'canton' => 'AR'), - '9113' => array('town' => 'Degersheim', 'canton' => 'SG'), - '9114' => array('town' => 'Hoffeld', 'canton' => 'SG'), - '9115' => array('town' => 'Dicken', 'canton' => 'SG'), - '9116' => array('town' => 'Wolfertswil', 'canton' => 'SG'), - '9122' => array('town' => 'Mogelsberg', 'canton' => 'SG'), - '9123' => array('town' => 'Nassen', 'canton' => 'SG'), - '9125' => array('town' => 'Brunnadern', 'canton' => 'SG'), - '9126' => array('town' => 'Necker', 'canton' => 'SG'), - '9127' => array('town' => 'St. Peterzell', 'canton' => 'SG'), - '9633' => array('town' => 'Bächli (Hemberg)', 'canton' => 'SG'), - '9200' => array('town' => 'Gossau SG', 'canton' => 'SG'), - '9203' => array('town' => 'Niederwil SG', 'canton' => 'SG'), - '9204' => array('town' => 'Andwil SG', 'canton' => 'SG'), - '9205' => array('town' => 'Waldkirch', 'canton' => 'SG'), - '9212' => array('town' => 'Arnegg', 'canton' => 'SG'), - '9213' => array('town' => 'Hauptwil', 'canton' => 'TG'), - '9214' => array('town' => 'Kradolf-Schönenb.', 'canton' => 'TG'), - '9216' => array('town' => 'Heldswil', 'canton' => 'TG'), - '9215' => array('town' => 'Schönenberg TG', 'canton' => 'TG'), - '9220' => array('town' => 'Bischofszell', 'canton' => 'TG'), - '9223' => array('town' => 'Schweizersholz', 'canton' => 'TG'), - '9225' => array('town' => 'Wilen (Gottshaus)', 'canton' => 'TG'), - '9230' => array('town' => 'Flawil', 'canton' => 'SG'), - '9231' => array('town' => 'Egg (Flawil)', 'canton' => 'SG'), - '9604' => array('town' => 'Oberrindal', 'canton' => 'SG'), - '9240' => array('town' => 'Uzwil', 'canton' => 'SG'), - '9242' => array('town' => 'Oberuzwil', 'canton' => 'SG'), - '9248' => array('town' => 'Bichwil', 'canton' => 'SG'), - '9243' => array('town' => 'Jonschwil', 'canton' => 'SG'), - '9244' => array('town' => 'Niederuzwil', 'canton' => 'SG'), - '9245' => array('town' => 'Oberbüren', 'canton' => 'SG'), - '9246' => array('town' => 'Niederbüren', 'canton' => 'SG'), - '9247' => array('town' => 'Henau', 'canton' => 'SG'), - '9249' => array('town' => 'Algetshausen', 'canton' => 'SG'), - '9300' => array('town' => 'Wittenbach', 'canton' => 'SG'), - '9304' => array('town' => 'Bernhardzell', 'canton' => 'SG'), - '9305' => array('town' => 'Berg SG', 'canton' => 'SG'), - '9306' => array('town' => 'Freidorf TG', 'canton' => 'TG'), - '9315' => array('town' => 'Winden', 'canton' => 'TG'), - '9308' => array('town' => 'Lömmenschwil', 'canton' => 'SG'), - '9312' => array('town' => 'Häggenschwil', 'canton' => 'SG'), - '9313' => array('town' => 'Muolen', 'canton' => 'SG'), - '9314' => array('town' => 'Steinebrunn', 'canton' => 'TG'), - '9320' => array('town' => 'Arbon', 'canton' => 'TG'), - '9322' => array('town' => 'Egnach', 'canton' => 'TG'), - '9323' => array('town' => 'Steinach', 'canton' => 'SG'), - '9325' => array('town' => 'Roggwil TG', 'canton' => 'TG'), - '9326' => array('town' => 'Horn', 'canton' => 'TG'), - '9327' => array('town' => 'Tübach', 'canton' => 'SG'), - '9400' => array('town' => 'Rorschach', 'canton' => 'SG'), - '9404' => array('town' => 'Rorschacherberg', 'canton' => 'SG'), - '9402' => array('town' => 'Mörschwil', 'canton' => 'SG'), - '9403' => array('town' => 'Goldach', 'canton' => 'SG'), - '9405' => array('town' => 'Wienacht-Tobel', 'canton' => 'AR'), - '9410' => array('town' => 'Heiden', 'canton' => 'AR'), - '9411' => array('town' => 'Reute AR', 'canton' => 'AR'), - '9413' => array('town' => 'Oberegg', 'canton' => 'AI'), - '9414' => array('town' => 'Schachen b. Reute', 'canton' => 'AR'), - '9422' => array('town' => 'Staad SG', 'canton' => 'SG'), - '9423' => array('town' => 'Altenrhein', 'canton' => 'SG'), - '9424' => array('town' => 'Rheineck', 'canton' => 'SG'), - '9425' => array('town' => 'Thal', 'canton' => 'SG'), - '9426' => array('town' => 'Lutzenberg', 'canton' => 'AR'), - '9427' => array('town' => 'Wolfhalden', 'canton' => 'AR'), - '9428' => array('town' => 'Walzenhausen', 'canton' => 'AR'), - '9430' => array('town' => 'St. Margrethen SG', 'canton' => 'SG'), - '9434' => array('town' => 'Au SG', 'canton' => 'SG'), - '9435' => array('town' => 'Heerbrugg', 'canton' => 'SG'), - '9436' => array('town' => 'Balgach', 'canton' => 'SG'), - '9437' => array('town' => 'Marbach SG', 'canton' => 'SG'), - '9450' => array('town' => 'Lüchingen', 'canton' => 'SG'), - '9442' => array('town' => 'Berneck', 'canton' => 'SG'), - '9443' => array('town' => 'Widnau', 'canton' => 'SG'), - '9444' => array('town' => 'Diepoldsau', 'canton' => 'SG'), - '9445' => array('town' => 'Rebstein', 'canton' => 'SG'), - '9451' => array('town' => 'Kriessern', 'canton' => 'SG'), - '9452' => array('town' => 'Hinterforst', 'canton' => 'SG'), - '9453' => array('town' => 'Eichberg', 'canton' => 'SG'), - '9462' => array('town' => 'Montlingen', 'canton' => 'SG'), - '9463' => array('town' => 'Oberriet SG', 'canton' => 'SG'), - '9464' => array('town' => 'Rüthi (Rheintal)', 'canton' => 'SG'), - '9465' => array('town' => 'Salez', 'canton' => 'SG'), - '9466' => array('town' => 'Sennwald', 'canton' => 'SG'), - '9467' => array('town' => 'Frümsen', 'canton' => 'SG'), - '9468' => array('town' => 'Sax', 'canton' => 'SG'), - '9469' => array('town' => 'Haag (Rheintal)', 'canton' => 'SG'), - '9470' => array('town' => 'Buchs SG', 'canton' => 'SG'), - '9472' => array('town' => 'Grabs', 'canton' => 'SG'), - '9473' => array('town' => 'Gams', 'canton' => 'SG'), - '9475' => array('town' => 'Sevelen', 'canton' => 'SG'), - '9476' => array('town' => 'Weite', 'canton' => 'SG'), - '9477' => array('town' => 'Trübbach', 'canton' => 'SG'), - '9478' => array('town' => 'Azmoos', 'canton' => 'SG'), - '9479' => array('town' => 'Oberschan', 'canton' => 'SG'), - '9485' => array('town' => 'Nendeln', 'canton' => 'FL'), - '9486' => array('town' => 'Schaanwald', 'canton' => 'FL'), - '9487' => array('town' => 'Gamprin-Bendern', 'canton' => 'FL'), - '9488' => array('town' => 'Schellenberg', 'canton' => 'FL'), - '9490' => array('town' => 'Vaduz', 'canton' => 'FL'), - '9491' => array('town' => 'Ruggell', 'canton' => 'FL'), - '9492' => array('town' => 'Eschen', 'canton' => 'FL'), - '9493' => array('town' => 'Mauren FL', 'canton' => 'FL'), - '9494' => array('town' => 'Schaan', 'canton' => 'FL'), - '9495' => array('town' => 'Triesen', 'canton' => 'FL'), - '9496' => array('town' => 'Balzers', 'canton' => 'FL'), - '9497' => array('town' => 'Triesenberg', 'canton' => 'FL'), - '9500' => array('town' => 'Wil SG', 'canton' => 'SG'), - '9502' => array('town' => 'Braunau', 'canton' => 'TG'), - '9503' => array('town' => 'Stehrenberg', 'canton' => 'TG'), - '9504' => array('town' => 'Friltschen', 'canton' => 'TG'), - '9506' => array('town' => 'Lommis', 'canton' => 'TG'), - '9507' => array('town' => 'Stettfurt', 'canton' => 'TG'), - '9508' => array('town' => 'Weingarten-Kalth', 'canton' => 'TG'), - '9512' => array('town' => 'Rossrüti', 'canton' => 'SG'), - '9514' => array('town' => 'Wuppenau', 'canton' => 'TG'), - '9515' => array('town' => 'Hosenruck', 'canton' => 'TG'), - '9517' => array('town' => 'Mettlen', 'canton' => 'TG'), - '9565' => array('town' => 'Rothenhausen', 'canton' => 'TG'), - '9523' => array('town' => 'Züberwangen', 'canton' => 'SG'), - '9524' => array('town' => 'Zuzwil SG', 'canton' => 'SG'), - '9525' => array('town' => 'Lenggenwil', 'canton' => 'SG'), - '9526' => array('town' => 'Zuckenriet', 'canton' => 'SG'), - '9527' => array('town' => 'Niederhelfenschwil', 'canton' => 'SG'), - '9532' => array('town' => 'Rickenbach b. Wil', 'canton' => 'TG'), - '9533' => array('town' => 'Kirchberg SG', 'canton' => 'SG'), - '9534' => array('town' => 'Gähwil', 'canton' => 'SG'), - '9535' => array('town' => 'Wilen b. Wil', 'canton' => 'TG'), - '9536' => array('town' => 'Schwarzenbach SG', 'canton' => 'SG'), - '9542' => array('town' => 'Münchwilen TG', 'canton' => 'TG'), - '9543' => array('town' => 'St. Margarethen TG', 'canton' => 'TG'), - '9545' => array('town' => 'Wängi', 'canton' => 'TG'), - '9546' => array('town' => 'Tuttwil', 'canton' => 'TG'), - '9547' => array('town' => 'Wittenwil', 'canton' => 'TG'), - '9548' => array('town' => 'Matzingen', 'canton' => 'TG'), - '9552' => array('town' => 'Bronschhofen', 'canton' => 'SG'), - '9553' => array('town' => 'Bettwiesen', 'canton' => 'TG'), - '9554' => array('town' => 'Tägerschen', 'canton' => 'TG'), - '9555' => array('town' => 'Tobel', 'canton' => 'TG'), - '9556' => array('town' => 'Affeltrangen', 'canton' => 'TG'), - '9562' => array('town' => 'Märwil', 'canton' => 'TG'), - '9573' => array('town' => 'Littenheid', 'canton' => 'TG'), - '9601' => array('town' => 'Lütisburg Station', 'canton' => 'SG'), - '9602' => array('town' => 'Bazenheid', 'canton' => 'SG'), - '9606' => array('town' => 'Bütschwil', 'canton' => 'SG'), - '9607' => array('town' => 'Mosnang', 'canton' => 'SG'), - '9608' => array('town' => 'Ganterschwil', 'canton' => 'SG'), - '9612' => array('town' => 'Dreien', 'canton' => 'SG'), - '9613' => array('town' => 'Mühlrüti', 'canton' => 'SG'), - '9614' => array('town' => 'Libingen', 'canton' => 'SG'), - '9615' => array('town' => 'Dietfurt', 'canton' => 'SG'), - '9620' => array('town' => 'Lichtensteig', 'canton' => 'SG'), - '9621' => array('town' => 'Oberhelfenschwil', 'canton' => 'SG'), - '9622' => array('town' => 'Krinau', 'canton' => 'SG'), - '9630' => array('town' => 'Wattwil', 'canton' => 'SG'), - '9631' => array('town' => 'Ulisbach', 'canton' => 'SG'), - '9642' => array('town' => 'Ebnat-Kappel', 'canton' => 'SG'), - '9643' => array('town' => 'Krummenau', 'canton' => 'SG'), - '9650' => array('town' => 'Nesslau', 'canton' => 'SG'), - '9651' => array('town' => 'Ennetbühl', 'canton' => 'SG'), - '9655' => array('town' => 'Stein SG', 'canton' => 'SG'), - '9652' => array('town' => 'Neu St. Johann', 'canton' => 'SG'), - '9656' => array('town' => 'Alt St. Johann', 'canton' => 'SG'), - '9657' => array('town' => 'Unterwasser', 'canton' => 'SG'), - '9658' => array('town' => 'Wildhaus', 'canton' => 'SG'), - '3185' => array('town' => 'Schmitten FR', 'canton' => 'FR'), - '3113' => array('town' => 'Rubigen', 'canton' => 'BE'), - '6304' => array('town' => 'Zug', 'canton' => 'ZG'), - '6911' => array('town' => 'Campione', 'canton' => 'IT'), - '8238' => array('town' => 'Büsingen', 'canton' => 'DE'), - '6302' => array('town' => 'Zug', 'canton' => 'ZG'), - '6303' => array('town' => 'Zug', 'canton' => 'ZG'), - '1289' => array('town' => 'Genève Serv. Spéc.', 'canton' => 'GE'), - '7003' => array('town' => 'Chur Postauto', 'canton' => 'GR'), - '3024' => array('town' => 'Bern', 'canton' => 'BE'), - '1017' => array('town' => 'Lausanne Veillon', 'canton' => 'VD'), - '1099' => array('town' => 'Montpreveyres Foto', 'canton' => 'VD'), - '3030' => array('town' => 'Bern', 'canton' => 'BE'), - '1031' => array('town' => 'Mex VD', 'canton' => 'VD'), - '1734' => array('town' => 'Tentlingen', 'canton' => 'FR'), - '1029' => array('town' => 'Villars-Ste-Croix', 'canton' => 'VD'), - '9101' => array('town' => 'Herisau', 'canton' => 'AR'), - '3044' => array('town' => 'Innerberg', 'canton' => 'BE'), - '8317' => array('town' => 'Tagelswangen', 'canton' => 'ZH'), - '6908' => array('town' => 'Massagno Caselle', 'canton' => 'TI'), - '6009' => array('town' => 'Luzern', 'canton' => 'LU'), - '6910' => array('town' => 'Lugano', 'canton' => 'TI'), - '5232' => array('town' => 'Villigen PSI', 'canton' => 'AG'), - '6349' => array('town' => 'Baar', 'canton' => 'ZG'), - '2715' => array('town' => 'Monible', 'canton' => 'BE'), - '1653' => array('town' => 'Châtel-Montsalvens', 'canton' => 'FR'), - '1730' => array('town' => 'Ecuvillens', 'canton' => 'FR'), - '1428' => array('town' => 'Mutrux', 'canton' => 'VD'), - '1047' => array('town' => 'Oppens', 'canton' => 'VD'), - '2027' => array('town' => 'Montalchez', 'canton' => 'NE'), - '2933' => array('town' => 'Damphreux', 'canton' => 'JU'), - '8543' => array('town' => 'Bertschikon', 'canton' => 'ZH'), - '3429' => array('town' => 'Hellsau', 'canton' => 'BE'), - '3632' => array('town' => 'Niederstocken', 'canton' => 'BE'), - '8774' => array('town' => 'Leuggelbach', 'canton' => 'GL'), - '4584' => array('town' => 'Gächliwil', 'canton' => 'SO'), - '5058' => array('town' => 'Wiliberg', 'canton' => 'AG'), - '3940' => array('town' => 'Steg VS', 'canton' => 'VS'), - '9498' => array('town' => 'Planken', 'canton' => 'FL'), - '8801' => array('town' => 'Thalwil', 'canton' => 'ZH'), - '6341' => array('town' => 'Baar', 'canton' => 'ZG'), - '6342' => array('town' => 'Baar', 'canton' => 'ZG'), - '9029' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '1709' => array('town' => 'Fribourg', 'canton' => 'FR'), - '8879' => array('town' => 'Pizolpark (Mels)', 'canton' => 'SG'), - '8118' => array('town' => 'Pfaffhausen', 'canton' => 'ZH'), - '5601' => array('town' => 'Lenzburg Sonderdst', 'canton' => 'AG'), - '9028' => array('town' => 'St. Gallen CV AG', 'canton' => 'SG'), - '9027' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '1811' => array('town' => 'Vevey', 'canton' => 'VD'), - '3609' => array('town' => 'Thun', 'canton' => 'BE'), - '1775' => array('town' => 'Mannens', 'canton' => 'FR'), - '8106' => array('town' => 'Adlikon b.Regensdf', 'canton' => 'ZH'), - '8070' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8071' => array('town' => 'Zürich CS PZ', 'canton' => 'ZH'), - '1631' => array('town' => 'Bulle', 'canton' => 'FR'), - '3040' => array('town' => 'Bern', 'canton' => 'BE'), - '4040' => array('town' => 'Basel', 'canton' => 'BL'), - '6007' => array('town' => 'Luzern', 'canton' => 'LU'), - '8759' => array('town' => 'Netstal', 'canton' => 'GL'), - '9020' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '4573' => array('town' => 'Lohn-Ammannsegg', 'canton' => 'SO'), - '9026' => array('town' => 'St. Gallen K AG', 'canton' => 'SG'), - '6031' => array('town' => 'Ebikon', 'canton' => 'LU'), - '6021' => array('town' => 'Emmenbrücke 1', 'canton' => 'LU'), - '6391' => array('town' => 'Engelberg', 'canton' => 'OW'), - '6281' => array('town' => 'Hochdorf', 'canton' => 'LU'), - '6011' => array('town' => 'Kriens', 'canton' => 'LU'), - '6061' => array('town' => 'Sarnen 1', 'canton' => 'OW'), - '6371' => array('town' => 'Stans', 'canton' => 'NW'), - '6431' => array('town' => 'Schwyz', 'canton' => 'SZ'), - '9025' => array('town' => 'St. Gallen Quelle', 'canton' => 'SG'), - '6907' => array('town' => 'Lugano 7 Caselle', 'canton' => 'TI'), - '1240' => array('town' => 'Genève', 'canton' => 'GE'), - '9471' => array('town' => 'Buchs SG 1', 'canton' => 'SG'), - '9401' => array('town' => 'Rorschach', 'canton' => 'SG'), - '9501' => array('town' => 'Wil SG 1', 'canton' => 'SG'), - '4509' => array('town' => 'Solothurn', 'canton' => 'SO'), - '4070' => array('town' => 'Basel', 'canton' => 'BS'), - '8609' => array('town' => 'Schwerzenbach', 'canton' => 'ZH'), - '6602' => array('town' => 'Muralto', 'canton' => 'TI'), - '6161' => array('town' => 'Entlebuch', 'canton' => 'LU'), - '9201' => array('town' => 'Gossau SG', 'canton' => 'SG'), - '8510' => array('town' => 'Frauenfeld', 'canton' => 'TG'), - '3050' => array('town' => 'Bern', 'canton' => 'BE'), - '8086' => array('town' => 'Zürich R Digest', 'canton' => 'ZH'), - '8085' => array('town' => 'Zürich Versich.', 'canton' => 'ZH'), - '2075' => array('town' => 'Thielle', 'canton' => 'NE'), - '1068' => array('town' => 'Les Monts-de-Pully', 'canton' => 'VD'), - '2010' => array('town' => 'Neuchâtel OFS', 'canton' => 'NE'), - '8285' => array('town' => 'Kreuzlingen Ifolor', 'canton' => 'TG'), - '4039' => array('town' => 'Basel', 'canton' => 'BS'), - '2510' => array('town' => 'Biel/Bienne DistBa', 'canton' => 'BE'), - '5510' => array('town' => 'Hunzenschwil DistB', 'canton' => 'AG'), - '8210' => array('town' => 'Schaffhausen DistB', 'canton' => 'SH'), - '9510' => array('town' => 'Wil SG Dist Ba', 'canton' => 'SG'), - '5018' => array('town' => 'Erlinsbach', 'canton' => 'AG'), - '1310' => array('town' => 'Daillens Dist Ba', 'canton' => 'VD'), - '8098' => array('town' => 'Zürich', 'canton' => 'ZH'), - '8066' => array('town' => 'Zürich', 'canton' => 'ZH'), - '4620' => array('town' => 'Härkingen PZ', 'canton' => 'SO'), - '8183' => array('town' => 'Bülach Dist Ba', 'canton' => 'ZH'), - '8325' => array('town' => 'Effretikon Dist Ba', 'canton' => 'ZH'), - '8520' => array('town' => 'Frauenfeld PZ', 'canton' => 'TG'), - '8343' => array('town' => 'Hinwil Dist Ba', 'canton' => 'ZH'), - '8087' => array('town' => 'Zürich', 'canton' => 'ZH'), - '4078' => array('town' => 'Basel Reader\'s D.', 'canton' => 'BS'), - '9024' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '4609' => array('town' => 'Olten', 'canton' => 'SO'), - '8015' => array('town' => 'Zürich 15', 'canton' => 'ZH'), - '1818' => array('town' => 'Montreux Redoute', 'canton' => 'VD'), - '8540' => array('town' => 'Frauenfeld ST PP 1', 'canton' => 'TG'), - '8530' => array('town' => 'Frauenfeld CALL', 'canton' => 'TG'), - '4640' => array('town' => 'Härkingen ST PP 1', 'canton' => 'SO'), - '4630' => array('town' => 'Härkingen CALL', 'canton' => 'SO'), - '1330' => array('town' => 'Daillens CALL', 'canton' => 'VD'), - '1320' => array('town' => 'Daillens ST PP 1', 'canton' => 'VD'), - '1440' => array('town' => 'Montagny-Chamard', 'canton' => 'VD'), - '4065' => array('town' => 'Basel SBB Cargo AG', 'canton' => 'BS'), - '8075' => array('town' => 'Zürich', 'canton' => 'ZH'), - '4080' => array('town' => 'Basel', 'canton' => 'BS'), - '6039' => array('town' => 'Root Längenbold', 'canton' => 'LU'), - '4034' => array('town' => 'Basel 34 Breite', 'canton' => 'BS'), - '4035' => array('town' => 'Basel', 'canton' => 'BS'), - '4089' => array('town' => 'Basel', 'canton' => 'BS'), - '8068' => array('town' => 'Zürich', 'canton' => 'ZH'), - '3071' => array('town' => 'Ostermundigen Zust', 'canton' => 'BE'), - '4033' => array('town' => 'Basel', 'canton' => 'BS'), - '4081' => array('town' => 'Basel', 'canton' => 'BS'), - '4082' => array('town' => 'Basel', 'canton' => 'BS'), - '8186' => array('town' => 'Bülach', 'canton' => 'ZH'), - '3039' => array('town' => 'Bern PF OC', 'canton' => 'BE'), - '4042' => array('town' => 'Basel PF OC', 'canton' => 'BL'), - '4083' => array('town' => 'Basel', 'canton' => 'BS'), - '4084' => array('town' => 'Basel', 'canton' => 'BS'), - '4085' => array('town' => 'Basel', 'canton' => 'BS'), - '4086' => array('town' => 'Basel', 'canton' => 'BS'), - '4087' => array('town' => 'Basel', 'canton' => 'BS'), - '4088' => array('town' => 'Basel', 'canton' => 'BS'), - '8081' => array('town' => 'Zürich', 'canton' => 'ZH'), - '4092' => array('town' => 'Basel SPI AS 22', 'canton' => 'BS'), - '4093' => array('town' => 'Basel SPI AS 23', 'canton' => 'BS'), - '4094' => array('town' => 'Basel SPI AS 24', 'canton' => 'BS'), - '4095' => array('town' => 'Basel SPI AS 25', 'canton' => 'BS'), - '4096' => array('town' => 'Basel SPI AS 26', 'canton' => 'BS'), - '8901' => array('town' => 'Urdorf', 'canton' => 'ZH'), - '3041' => array('town' => 'Bern', 'canton' => 'BE'), - '6008' => array('town' => 'Luzern', 'canton' => 'LU'), - '4041' => array('town' => 'Basel', 'canton' => 'BS'), - '9489' => array('town' => 'Vaduz', 'canton' => 'FL'), - '4551' => array('town' => 'Derendingen', 'canton' => 'SO'), - '4075' => array('town' => 'Basel', 'canton' => 'BS'), - '9022' => array('town' => 'St. Gallen', 'canton' => 'SG'), - '8109' => array('town' => 'Kloster Fahr', 'canton' => 'AG'), - '1019' => array('town' => 'Lausanne', 'canton' => 'VD'), - '1039' => array('town' => 'Cheseaux Polyval', 'canton' => 'VD'), - '6346' => array('town' => 'Baar 3', 'canton' => 'ZG'), - '3085' => array('town' => 'Wabern Weihnachten', 'canton' => 'BE'), - '1300' => array('town' => 'Eclépens CC', 'canton' => 'VD'), - '3070' => array('town' => 'Ostermundigen LZB', 'canton' => 'BE'), - '4621' => array('town' => 'Härkingen BZ', 'canton' => 'SO'), - '6590' => array('town' => 'Cadenazzo (CLL)', 'canton' => 'TI'), - '1919' => array('town' => 'Martigny Mutuel', 'canton' => 'VS'), - '8096' => array('town' => 'Zürich IBRS local', 'canton' => 'ZH'), - '4808' => array('town' => 'Zofingen PF', 'canton' => 'AG'), - '4807' => array('town' => 'Zofingen PF', 'canton' => 'AG'), - '1311' => array('town' => 'Eclépens SC', 'canton' => 'VD'), - '4611' => array('town' => 'Härkingen SC', 'canton' => 'SO'), - '8011' => array('town' => 'Zürich Mülligen SC', 'canton' => 'ZH'), - '8060' => array('town' => 'Zürich', 'canton' => 'ZH'), - '6333' => array('town' => 'Hünenberg See', 'canton' => 'ZG'), - '4809' => array('town' => 'Zofingen PF', 'canton' => 'AG'), - '8059' => array('town' => 'Zürich 59 EO', 'canton' => 'ZH'), - '3017' => array('town' => 'Bern Zustellung', 'canton' => 'BE'), - '9301' => array('town' => 'Wittenbach', 'canton' => 'SG'), - '6511' => array('town' => 'Cadenazzo SC', 'canton' => 'TI'), - '8074' => array('town' => 'Zürich Voice Pub', 'canton' => 'ZH'), - '3029' => array('town' => 'Bern Entris', 'canton' => 'BE'), - '7110' => array('town' => 'Peiden', 'canton' => 'GR'), - '8012' => array('town' => 'Zürich', 'canton' => 'ZH'), - '2360' => array('town' => 'Le Bémont', 'canton' => 'JU'), - '2362' => array('town' => 'Montfaucon', 'canton' => 'JU'), - '2363' => array('town' => 'Les Enfers', 'canton' => 'JU'), - '2364' => array('town' => 'St-Brais', 'canton' => 'JU'), - '8970' => array('town' => 'Urdorf Exchange', 'canton' => 'ZH'), - ); - - // Check if theres something for autocomplete - if (!empty($element['#value']) && (isset($data[$element['#value']]))) { - // Get the base #parents for this address form. - $base_parents = array_slice($element['#parents'], 0, -1); - $city = $data[$element['#value']]; - - // Set the new values in the form. - drupal_array_set_nested_value($form_state['values'], array_merge($base_parents, array('locality')), $city['town'], TRUE); - drupal_array_set_nested_value($form_state['values'], array_merge($base_parents, array('administrative_area')), $city['canton'], TRUE); - - // Discard value the user has already entered there. - drupal_array_set_nested_value($form_state['input'], array_merge($base_parents, array('locality')), NULL, TRUE); - drupal_array_set_nested_value($form_state['input'], array_merge($base_parents, array('administrative_area')), NULL, TRUE); - } -} diff --git a/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-administrative-area.inc b/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-administrative-area.inc deleted file mode 100644 index eb3be37bc..000000000 --- a/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-administrative-area.inc +++ /dev/null @@ -1,24 +0,0 @@ - t('Hide the administrative area'), - 'format callback' => 'addressfield_format_address_hide_administrative_area', - 'type' => 'address', - 'weight' => -84, -); - -/** - * Format callback. - * - * @see CALLBACK_addressfield_format_callback() - */ -function addressfield_format_address_hide_administrative_area(&$format, $address, $context = array()) { - if (isset($format['locality_block']['administrative_area'])) { - $format['locality_block']['administrative_area']['#access'] = FALSE; - } -} diff --git a/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-country.inc b/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-country.inc deleted file mode 100644 index 59881fb89..000000000 --- a/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-country.inc +++ /dev/null @@ -1,40 +0,0 @@ - t('Hide the country when only one is available'), - 'format callback' => 'addressfield_format_address_hide_country', - 'type' => 'address', - 'weight' => -80, -); - -/** - * Format callback. - * - * @see CALLBACK_addressfield_format_callback() - */ -function addressfield_format_address_hide_country(&$format, $address, $context = array()) { - // Hide the country element only if the whole field is required, otherwise - // there will always be an additional None option. - if ($context['mode'] == 'form' && (empty($context['instance']) || $context['instance']['required'])) { - if (!empty($format['country']['#options']) && count($format['country']['#options']) == 1) { - $format['country']['#access'] = FALSE; - } - } - elseif ($context['mode'] == 'render') { - // However, in render mode, the element does not have an #options list, so - // we look instead in the field instance settings if given. If we find a - // single country option and it matches the country of the current address, - // go ahead and hide it. - if (!empty($context['instance']['widget']['settings']['available_countries']) && - count($context['instance']['widget']['settings']['available_countries']) == 1) { - if (isset($context['instance']['widget']['settings']['available_countries'][$address['country']])) { - $format['country']['#access'] = FALSE; - } - } - } -} diff --git a/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-locality.inc b/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-locality.inc deleted file mode 100644 index 1e3800252..000000000 --- a/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-locality.inc +++ /dev/null @@ -1,24 +0,0 @@ - t('Hide the locality'), - 'format callback' => 'addressfield_format_address_hide_locality', - 'type' => 'address', - 'weight' => -84, -); - -/** - * Format callback. - * - * @see CALLBACK_addressfield_format_callback() - */ -function addressfield_format_address_hide_locality(&$format, $address, $context = array()) { - if (isset($format['locality_block']['locality'])) { - $format['locality_block']['locality']['#access'] = FALSE; - } -} diff --git a/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-postal-code.inc b/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-postal-code.inc deleted file mode 100644 index 4f058d34c..000000000 --- a/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-postal-code.inc +++ /dev/null @@ -1,24 +0,0 @@ - t('Hide the postal code'), - 'format callback' => 'addressfield_format_address_hide_postal_code', - 'type' => 'address', - 'weight' => -85, -); - -/** - * Format callback. - * - * @see CALLBACK_addressfield_format_callback() - */ -function addressfield_format_address_hide_postal_code(&$format, $address, $context = array()) { - if (isset($format['locality_block']['postal_code'])) { - $format['locality_block']['postal_code']['#access'] = FALSE; - } -} diff --git a/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-street.inc b/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-street.inc deleted file mode 100644 index a5912dce2..000000000 --- a/html/sites/all/modules/contrib/addressfield/plugins/format/address-hide-street.inc +++ /dev/null @@ -1,24 +0,0 @@ - t('Hide the street address'), - 'format callback' => 'addressfield_format_address_hide_street', - 'type' => 'address', - 'weight' => -85, -); - -/** - * Format callback. - * - * @see CALLBACK_addressfield_format_callback() - */ -function addressfield_format_address_hide_street(&$format, $address, $context = array()) { - if (isset($format['street_block'])) { - $format['street_block']['#access'] = FALSE; - } -} diff --git a/html/sites/all/modules/contrib/addressfield/plugins/format/address-optional.inc b/html/sites/all/modules/contrib/addressfield/plugins/format/address-optional.inc deleted file mode 100644 index bb4408be5..000000000 --- a/html/sites/all/modules/contrib/addressfield/plugins/format/address-optional.inc +++ /dev/null @@ -1,36 +0,0 @@ - t('Make all fields optional (No validation - unsuitable for postal purposes)'), - 'format callback' => 'addressfield_format_address_optional', - 'type' => 'address', - 'weight' => 100, -); - -/** - * Format callback. - * - * @see CALLBACK_addressfield_format_callback() - */ -function addressfield_format_address_optional(&$format, $address, $context = array()) { - if (isset($format['name_block'])) { - if (isset($format['name_block']['name_line'])) { - $format['name_block']['name_line']['#required'] = FALSE; - } - elseif (isset($format['name_block']['first_name'])) { - $format['name_block']['first_name']['#required'] = FALSE; - $format['name_block']['last_name']['#required'] = FALSE; - } - } - $format['street_block']['thoroughfare']['#required'] = FALSE; - $format['locality_block']['postal_code']['#required'] = FALSE; - $format['locality_block']['dependent_locality']['#required'] = FALSE; - $format['locality_block']['locality']['#required'] = FALSE; - $format['locality_block']['administrative_area']['#required'] = FALSE; -} diff --git a/html/sites/all/modules/contrib/addressfield/plugins/format/address.inc b/html/sites/all/modules/contrib/addressfield/plugins/format/address.inc deleted file mode 100644 index ca354d570..000000000 --- a/html/sites/all/modules/contrib/addressfield/plugins/format/address.inc +++ /dev/null @@ -1,297 +0,0 @@ - t('Address form (country-specific)'), - 'format callback' => 'addressfield_format_address_generate', - 'type' => 'address', - 'weight' => -100, -); - -/** - * Format callback. - * - * @see CALLBACK_addressfield_format_callback() - */ -function addressfield_format_address_generate(&$format, $address, $context = array()) { - // Load the predefined address format for the selected country. - module_load_include('inc', 'addressfield', 'addressfield.address_formats'); - $address_format = addressfield_get_address_format($address['country']); - - // Used to move certain fields to their own row. - $clearfix = '
'; - - // The street block. - $format['street_block'] = array( - '#type' => 'addressfield_container', - '#attributes' => array( - 'class' => array('street-block'), - ), - '#weight' => 0, - ); - $format['street_block']['thoroughfare'] = array( - '#title' => t('Address 1'), - '#tag' => 'div', - '#attributes' => array( - 'class' => array('thoroughfare'), - 'autocomplete' => 'address-line1', - ), - '#size' => 30, - '#maxlength' => 255, - '#required' => TRUE, - ); - $format['street_block']['premise'] = array( - '#title' => t('Address 2'), - '#tag' => 'div', - '#attributes' => array( - 'class' => array('premise'), - 'autocomplete' => 'address-line2', - ), - '#size' => 30, - '#maxlength' => 255, - ); - $format['locality_block'] = array( - '#type' => 'addressfield_container', - '#attributes' => array( - 'class' => array('addressfield-container-inline', 'locality-block', 'country-' . $address['country']), - ), - '#weight' => 50, - '#maxlength' => 255, - ); - $format['locality_block']['#attached']['css'][] = drupal_get_path('module', 'addressfield') . '/addressfield.css'; - $format['locality_block']['postal_code'] = array( - '#title' => $address_format['postal_code_label'], - '#required' => in_array('postal_code', $address_format['required_fields']), - '#access' => in_array('postal_code', $address_format['used_fields']), - '#size' => 10, - '#maxlength' => 255, - '#attributes' => array( - 'class' => array('postal-code'), - 'autocomplete' => 'postal-code', - ), - ); - $format['locality_block']['dependent_locality'] = array( - '#title' => $address_format['dependent_locality_label'], - '#required' => in_array('dependent_locality', $address_format['required_fields']), - '#access' => in_array('dependent_locality', $address_format['used_fields']), - '#size' => 25, - '#maxlength' => 255, - '#tag' => 'div', - '#attributes' => array( - 'class' => array('dependent-locality'), - 'autocomplete' => 'address-level3', - ), - // Most formats place this field in its own row. - '#suffix' => $clearfix, - ); - $format['locality_block']['locality'] = array( - '#title' => $address_format['locality_label'], - '#required' => in_array('locality', $address_format['required_fields']), - '#access' => in_array('locality', $address_format['used_fields']), - '#size' => 30, - '#maxlength' => 255, - '#prefix' => ' ', - '#attributes' => array( - 'class' => array('locality'), - 'autocomplete' => 'address-level2', - ), - ); - $format['locality_block']['administrative_area'] = array( - '#title' => $address_format['administrative_area_label'], - '#required' => in_array('administrative_area', $address_format['required_fields']), - '#access' => in_array('administrative_area', $address_format['used_fields']), - '#empty_value' => '', - '#size' => 10, - '#maxlength' => 255, - '#prefix' => ' ', - '#render_option_value' => $address_format['render_administrative_area_value'], - '#attributes' => array( - 'class' => array('state'), - 'autocomplete' => 'address-level1', - ), - ); - $format['country'] = array( - '#title' => t('Country'), - '#options' => _addressfield_country_options_list(), - '#render_option_value' => TRUE, - '#required' => TRUE, - '#attributes' => array( - 'class' => array('country'), - 'autocomplete' => 'country', - ), - '#weight' => 100, - ); - - if (empty($format['locality_block']['postal_code']['#access'])) { - // Remove the prefix from the first widget of the block. - $element_children = element_children($format['locality_block']); - $first_child = reset($element_children); - unset($format['locality_block'][$first_child]['#prefix']); - } - - if (!empty($format['locality_block']['administrative_area']['#access'])) { - // Set the predefined administrative areas, if found. - module_load_include('inc', 'addressfield', 'addressfield.administrative_areas'); - $administrative_areas = addressfield_get_administrative_areas($address['country']); - $format['locality_block']['administrative_area']['#options'] = $administrative_areas; - } - - // Country-specific customizations. - if (in_array($address['country'], array('AU', 'EE', 'LT', 'LV', 'NZ', 'RU'))) { - // These countries don't use the "Address 2" line. - // Leave it as a precaution, but hide the label to avoid confusing users. - $format['street_block']['thoroughfare']['#title'] = t('Address'); - $format['street_block']['premise']['#title_display'] = 'invisible'; - } - elseif ($address['country'] == 'US') { - if ($context['mode'] == 'render') { - $format['locality_block']['locality']['#suffix'] = ','; - } - } - elseif ($address['country'] == 'BR') { - $format['locality_block']['dependent_locality']['#suffix'] = $clearfix; - $format['locality_block']['dependent_locality']['#tag'] = 'div'; - $format['locality_block']['administrative_area']['#suffix'] = $clearfix; - $format['locality_block']['postal_code']['#tag'] = 'div'; - // Change some titles to make translation easier. - $format['street_block']['#attributes'] = array( - 'class' => array('addressfield-container-inline'), - ); - $format['street_block']['thoroughfare']['#title'] = t('Thoroughfare'); - $format['street_block']['thoroughfare']['#tag'] = NULL; - $format['street_block']['premise'] = array( - '#title' => t('Complement'), - '#tag' => NULL, - '#attributes' => array('class' => array('premise')), - '#size' => 20, - '#maxlength' => 255, - '#prefix' => ', ', - ); - $format['locality_block']['locality']['#suffix'] = ' - '; - // Hide suffixes and prefixes while in form. - if ($context['mode'] == 'form') { - $format['street_block']['premise']['#prefix'] = NULL; - $format['street_block']['premise']['#suffix'] = NULL; - $format['locality_block']['locality']['#suffix'] = NULL; - } - } - elseif ($address['country'] == 'CN') { - $format['locality_block']['locality']['#suffix'] = $clearfix; - } - elseif ($address['country'] == 'CA') { - if ($context['mode'] == 'render') { - $format['locality_block']['locality']['#suffix'] = ','; - } - } - elseif ($address['country'] == 'GB') { - $format['locality_block']['administrative_area']['#size'] = '30'; - } - elseif ($address['country'] == 'ID') { - $format['locality_block']['administrative_area']['#weight'] = 1; - } - elseif ($address['country'] == 'JP') { - $format['locality_block']['#weight'] = 10; - $format['locality_block']['postal_code']['#weight'] = 10; - $format['locality_block']['postal_code']['#tag'] = 'div'; - $format['locality_block']['postal_code']['#size'] = 30; - $format['locality_block']['administrative_area']['#weight'] = 20; - $format['locality_block']['administrative_area']['#size'] = 30; - $format['locality_block']['locality']['#weight'] = 30; - $format['street_block']['#weight'] = 20; - } - elseif ($address['country'] == 'PE') { - $format['locality_block']['administrative_area']['#weight'] = 1; - $format['locality_block']['locality']['#weight'] = 2; - } - elseif ($address['country'] == 'PH' || $address['country'] == 'TH') { - $format['locality_block']['dependent_locality']['#suffix'] = ''; - $format['locality_block']['locality']['#suffix'] = $clearfix; - } - - // These countries show every field in its own row. - $countries_field_per_row = array( - 'AM', 'EG', 'FK', 'GB', 'GG', 'GS', 'HK', 'HU', 'IE', 'IM', 'IO', 'JE', 'JM', - 'JP', 'KE', 'KR', 'KZ', 'LK', 'PA', 'PN', 'RU', 'SC', 'SH', 'SZ', 'TC', 'UA', - 'VG', 'ZA', - ); - if (in_array($address['country'], $countries_field_per_row)) { - $format['locality_block']['#attributes']['class'][0] = 'addressfield-container'; - $format['locality_block']['postal_code']['#prefix'] = ''; - $format['locality_block']['postal_code']['#tag'] = 'div'; - $format['locality_block']['locality']['#prefix'] = ''; - $format['locality_block']['locality']['#tag'] = 'div'; - $format['locality_block']['administrative_area']['#prefix'] = ''; - $format['locality_block']['administrative_area']['#tag'] = 'div'; - } - - // These countries tend to put the postal code after the locality. - $countries_postal_code_after_locality = array( - 'AS', 'AU', 'BD', 'BF', 'BH', 'BM', 'BN', 'BR', 'BT', 'CA', 'CC', 'CN', 'CX', - 'EG', 'FK', 'FM', 'GB', 'GG', 'GS', 'GU', 'HN', 'HU', 'ID', 'IL', 'IM', 'IN', - 'IO', 'IQ', 'IR', 'JE', 'JO', 'JP', 'KE', 'KH', 'KR', 'LB', 'LK', 'LS', 'LV', - 'MH', 'MM', 'MN', 'MP', 'MT', 'MV', 'MX', 'MY', 'NF', 'NG', 'NP', 'NZ', 'PG', - 'PH', 'PK', 'PN', 'PR', 'PW', 'RU', 'SA', 'SH', 'SO', 'SZ', 'TC', 'TH', 'TW', - 'UA', 'UM', 'US', 'VE', 'VI', 'VG', 'VN', 'ZA', - ); - if (in_array($address['country'], $countries_postal_code_after_locality)) { - // Take the widget out of the array. - $postal_code_widget = $format['locality_block']['postal_code']; - - // If the postal code not in its own row, add a separating space. - if (empty($postal_code_widget['#tag'])) { - $postal_code_widget['#prefix'] = ' '; - } - - unset($format['locality_block']['postal_code']); - - // Add it back. - $format['locality_block']['postal_code'] = $postal_code_widget; - - // Remove the prefix from the first widget of the block. - $element_children = element_children($format['locality_block']); - $first_child = reset($element_children); - unset($format['locality_block'][$first_child]['#prefix']); - } - - if ($context['mode'] == 'form') { - // Provide a wrapper ID for AJAX replacement based on country selection. - if (!isset($format['#wrapper_id'])) { - $format['#wrapper_id'] = drupal_html_id('addressfield-wrapper'); - $format['#prefix'] = '
'; - $format['#suffix'] = '
'; - } - // AJAX enable it. - $format['country']['#ajax'] = array( - 'callback' => 'addressfield_standard_widget_refresh', - 'wrapper' => $format['#wrapper_id'], - ); - $format['country']['#element_validate'] = array('addressfield_standard_country_validate'); - // Don't validate any element when the country is changed. - $format['country']['#limit_validation_errors'] = array(); - - // Move the country selector to the top of the form. - $format['country']['#weight'] = -500; - // Limit it to the countries supported by the widget. - if (isset($context['field'])) { - $format['country']['#options'] = _addressfield_country_options_list($context['field'], $context['instance']); - } - - // The whole field is considered empty if the country column is empty. - // Therefore, if the field is optional, allow the country to be optional. - // The same logic applies if the field allows multiple values, in which case - // only the first delta needs to have a value. - if (empty($context['instance']['required']) || (isset($context['delta']) && $context['delta'] > 0)) { - $format['country']['#required'] = FALSE; - $format['country']['#empty_value'] = ''; - // Hide all other fields until the country is selected. - if (empty($address['country'])) { - $format['street_block']['#access'] = FALSE; - $format['locality_block']['#access'] = FALSE; - } - } - } -} diff --git a/html/sites/all/modules/contrib/addressfield/plugins/format/name-full.inc b/html/sites/all/modules/contrib/addressfield/plugins/format/name-full.inc deleted file mode 100644 index b9c6b22b2..000000000 --- a/html/sites/all/modules/contrib/addressfield/plugins/format/name-full.inc +++ /dev/null @@ -1,54 +0,0 @@ - t('Name (First name, Last name)'), - 'format callback' => 'addressfield_format_name_full_generate', - 'type' => 'name', - 'weight' => 0, -); - -/** - * Format callback. - * - * @see CALLBACK_addressfield_format_callback() - */ -function addressfield_format_name_full_generate(&$format, $address) { - $format['name_block'] = array( - '#type' => 'addressfield_container', - '#attributes' => array( - 'class' => array('addressfield-container-inline', 'name-block'), - ), - '#weight' => -100, - // The addressfield is considered empty without a country, hide all fields - // until one is selected. - '#access' => !empty($address['country']), - ); - // Maxlength is set to 127 so that the name_line still can be created without - // exceeding the char limit from the database. - $format['name_block']['first_name'] = array( - '#title' => t('First name'), - '#size' => 30, - '#maxlength' => 127, - '#required' => TRUE, - '#attributes' => array( - 'class' => array('first-name'), - 'autocomplete' => 'given-name', - ), - ); - $format['name_block']['last_name'] = array( - '#title' => t('Last name'), - '#size' => 30, - '#maxlength' => 127, - '#required' => TRUE, - '#prefix' => ' ', - '#attributes' => array( - 'class' => array('last-name'), - 'autocomplete' => 'family-name', - ), - ); -} diff --git a/html/sites/all/modules/contrib/addressfield/plugins/format/name-oneline.inc b/html/sites/all/modules/contrib/addressfield/plugins/format/name-oneline.inc deleted file mode 100644 index cd6f72693..000000000 --- a/html/sites/all/modules/contrib/addressfield/plugins/format/name-oneline.inc +++ /dev/null @@ -1,40 +0,0 @@ - t('Name (single line)'), - 'format callback' => 'addressfield_format_name_oneline_generate', - 'type' => 'name', - 'weight' => 0, -); - -/** - * Format callback. - * - * @see CALLBACK_addressfield_format_callback() - */ -function addressfield_format_name_oneline_generate(&$format, $address) { - $format['name_block'] = array( - '#type' => 'addressfield_container', - '#attributes' => array('class' => array('addressfield-container-inline', 'name-block')), - '#weight' => -100, - // The addressfield is considered empty without a country, hide all fields - // until one is selected. - '#access' => !empty($address['country']), - ); - $format['name_block']['name_line'] = array( - '#title' => t('Full name'), - '#tag' => 'div', - '#attributes' => array( - 'class' => array('name-block'), - 'autocomplete' => 'name', - ), - '#size' => 30, - '#maxlength' => 255, - '#required' => TRUE, - ); -} diff --git a/html/sites/all/modules/contrib/addressfield/plugins/format/organisation.inc b/html/sites/all/modules/contrib/addressfield/plugins/format/organisation.inc deleted file mode 100644 index 3cec0f7f9..000000000 --- a/html/sites/all/modules/contrib/addressfield/plugins/format/organisation.inc +++ /dev/null @@ -1,38 +0,0 @@ - t('Organisation (single line)'), - 'format callback' => 'addressfield_format_organisation_generate', - 'type' => 'organisation', - 'weight' => -10, -); - -/** - * Format callback. - * - * @see CALLBACK_addressfield_format_callback() - */ -function addressfield_format_organisation_generate(&$format, $address) { - $format['organisation_block'] = array( - '#type' => 'addressfield_container', - '#attributes' => array('class' => array('addressfield-container-inline', 'organisation-block')), - '#weight' => -50, - // The addressfield is considered empty without a country, hide all fields - // until one is selected. - '#access' => !empty($address['country']), - ); - $format['organisation_block']['organisation_name'] = array( - '#title' => t('Company'), - '#size' => 30, - '#maxlength' => 255, - '#attributes' => array( - 'class' => array('organisation-name'), - 'autocomplete' => 'organization', - ), - ); -} diff --git a/html/sites/all/modules/contrib/addressfield/views/addressfield.views.inc b/html/sites/all/modules/contrib/addressfield/views/addressfield.views.inc deleted file mode 100644 index f059da34e..000000000 --- a/html/sites/all/modules/contrib/addressfield/views/addressfield.views.inc +++ /dev/null @@ -1,95 +0,0 @@ - $tables) { - foreach ($tables as $table_name => $columns) { - if (!isset($columns['country'])) { - continue; - } - - $column_real_name = $columns['country']; - if (!isset($data[$table_name][$column_real_name]['filter'])) { - continue; - } - - $data[$table_name][$column_real_name]['filter']['handler'] = 'addressfield_views_handler_filter_country'; - } - } - - // Only expose these components as Views field handlers. - $implemented = array( - 'country' => 'addressfield_views_handler_field_country', - 'administrative_area' => 'addressfield_views_handler_field_administrative_area', - 'sub_administrative_area' => 'views_handler_field', - 'dependent_locality' => 'views_handler_field', - 'locality' => 'views_handler_field', - 'postal_code' => 'views_handler_field', - 'thoroughfare' => 'views_handler_field', - 'premise' => 'views_handler_field', - 'sub_premise' => 'views_handler_field', - 'organisation_name' => 'views_handler_field', - 'name_line' => 'views_handler_field', - 'first_name' => 'views_handler_field', - 'last_name' => 'views_handler_field', - 'data' => 'views_handler_field_serialized', - ); - - // Get the translated field information. - $properties = addressfield_data_property_info(); - - // Iterate over addressfield defined tables. - foreach ($data as &$table) { - // Make sure the parent Views field (addressfield) is defined. - if (isset($table[$field['field_name']]['field'])) { - // Use the parent field definition as a template for component columns. - $field_def = $table[$field['field_name']]['field']; - - // Remove 'additional fields' from the field definition. We don't - // necessarily want all our sibling columns. - unset($field_def['additional fields']); - - // Define the valid columns. - $valid_columns = array(); - foreach ($implemented as $implement => $handler) { - $column_name = $field['field_name'] . '_' . $implement; - $valid_columns[$column_name] = $handler; - } - - // Iterate over the addressfield components. - foreach ($table as $column_name => &$column) { - if (empty($column['field']) && isset($valid_columns[$column_name])) { - // Assign the default component definition. - $column['field'] = $field_def; - $column['field']['real field'] = $column_name; - $column['field']['handler'] = $valid_columns[$column_name]; - - // Assign human-friendly field labels for addressfield components. - $field_labels = field_views_field_label($field['field_name']); - $field_label = array_shift($field_labels); - $property = str_replace($field_def['field_name'] . '_', '', $column_name); - - if (!empty($properties[$property])) { - $property_label = $properties[$property]['label']; - - $title = t('@field-label - @property-label', array( - '@field-label' => $field_label, - '@property-label' => $property_label, - )); - - $column['title'] = $title; - $column['title short'] = $title; - } - } - } - } - } - - return $data; -} diff --git a/html/sites/all/modules/contrib/addressfield/views/addressfield_views_handler_field_administrative_area.inc b/html/sites/all/modules/contrib/addressfield/views/addressfield_views_handler_field_administrative_area.inc deleted file mode 100644 index daeae6626..000000000 --- a/html/sites/all/modules/contrib/addressfield/views/addressfield_views_handler_field_administrative_area.inc +++ /dev/null @@ -1,48 +0,0 @@ -country_alias = $this->query->add_field($this->table_alias, $this->definition['field_name'] . '_country'); - } - - function option_definition() { - $options = parent::option_definition(); - $options['display_name'] = array('default' => TRUE); - return $options; - } - - function options_form(&$form, &$form_state) { - parent::options_form($form, $form_state); - - $form['display_name'] = array( - '#type' => 'checkbox', - '#title' => t('Display the name of administrative area instead of the code.'), - '#default_value' => $this->options['display_name'], - ); - } - - function get_value($values, $field = NULL) { - $value = parent::get_value($values, $field); - - // If we have a value for the field, look for the administrative area name in the - // Address Field options list array if specified. - if (!empty($value) && !empty($this->options['display_name'])) { - module_load_include('inc', 'addressfield', 'addressfield.administrative_areas'); - $country = $values->{$this->country_alias}; - $areas = addressfield_get_administrative_areas($country); - - if (!empty($areas[$value])) { - $value = $areas[$value]; - } - } - - return $value; - } -} diff --git a/html/sites/all/modules/contrib/addressfield/views/addressfield_views_handler_field_country.inc b/html/sites/all/modules/contrib/addressfield/views/addressfield_views_handler_field_country.inc deleted file mode 100644 index 65ca79d3c..000000000 --- a/html/sites/all/modules/contrib/addressfield/views/addressfield_views_handler_field_country.inc +++ /dev/null @@ -1,40 +0,0 @@ - TRUE); - return $options; - } - - function options_form(&$form, &$form_state) { - parent::options_form($form, $form_state); - - $form['display_name'] = array( - '#type' => 'checkbox', - '#title' => t('Display the localized country name instead of the two character country code'), - '#default_value' => $this->options['display_name'], - ); - } - - function get_value($values, $field = NULL) { - $value = parent::get_value($values, $field); - - // If we have a value for the field, look for the country name in the - // Address Field options list array if specified. - if (!empty($value) && !empty($this->options['display_name'])) { - $countries = _addressfield_country_options_list(); - - if (!empty($countries[$value])) { - $value = $countries[$value]; - } - } - - return $value; - } -} diff --git a/html/sites/all/modules/contrib/addressfield/views/addressfield_views_handler_filter_country.inc b/html/sites/all/modules/contrib/addressfield/views/addressfield_views_handler_filter_country.inc deleted file mode 100644 index d1b11c197..000000000 --- a/html/sites/all/modules/contrib/addressfield/views/addressfield_views_handler_filter_country.inc +++ /dev/null @@ -1,9 +0,0 @@ -value_title = t('Country'); - $field = field_info_field($this->definition['field_name']); - $this->value_options = _addressfield_country_options_list($field); - } -} \ No newline at end of file diff --git a/html/sites/all/modules/contrib/admin_views/CHANGELOG.txt b/html/sites/all/modules/contrib/admin_views/CHANGELOG.txt deleted file mode 100644 index bc395cdbb..000000000 --- a/html/sites/all/modules/contrib/admin_views/CHANGELOG.txt +++ /dev/null @@ -1,148 +0,0 @@ -Admin_Views 7.x-1.8, 2021-09-09 -------------------------------- -#2569575 by sdstyles, zvse: Wrong module dependency declaration. -#2411193 by DamienMcKenna, damiankloip: Move 'system' display plugin to a - submodule. -#3101921 by DamienMcKenna: Add a CHANGELOG.txt file. -#2919169 by dani3lr0se, DamienMcKenna, volkswagenchick: Add hook_help(). -#1698784 by damiankloip, mvc, DamienMcKenna, Stevel, sun: Missing handler: node - term_node_tid relationship. -#2802533 by schifazl, DamienMcKenna, ann b, DigitalFrontiersMedia, Chris - Matthews, selvanathan: Sort By Updated Column Not Working (Content Page). -#3096612 by fprevos2, DamienMcKenna, MrDaleSmith, oskylark, newaytech, GaëlG, - marameodesign: AJAX fails due to hardcoded permission. -#2951251 by lachezar.valchev, DamienMcKenna, Chris Matthews: Support for Domain - Access. -#2034717 by damiankloip, DamienMcKenna, Chris Matthews: Wildcards/regular - expression when searching. -#2591539 by calebtr, DamienMcKenna, Chris Matthews, kiritoly, damiankloip, - Juterpillar: exposed filter descriptions are hidden by default. -#2836511 by volkswagenchick, DamienMcKenna, loopduplicate, dhruveshdtripathi, - Stevel: Add README file. -#1780004 by ron_s, DamienMcKenna, acbramley, damiankloip, tdurocher, antiorario, - giorgio79, drupalerocant, afoster, Dane Powell, kenorb, superjerms: Trying to - get property of non-object in user_access() with 2 admin views on the same - path. -#3096612 by coranda, DamienMcKenna: Copy/pasta. -#3133983 by DamienMcKenna, trong.nguyen.tcec: Undefined function: - admin_views_duplicate_path. - - -Admin_Views 7.x-1.7, 2019-11-19 -------------------------------- -By David_Rothstein, dsnopek, vijaycs85, mcdruid, dawehner, damiankloip, mglaman, - greggles, mlhess, rickmanelius, larowlan: Fix SA-CONTRIB-2019-076. -#2545750 by Sam152, marcoscano: Allow modules to easily override existing views - provided by admin_views. - - -Admin_Views 7.x-1.6, 2016-08-02 -------------------------------- -By damiankloip: Check path is not empty before getting the menu item. -#2358953 by xurizaemon: Admin Views tests fail (class view not defined). - - -Admin_Views 7.x-1.5, 2015-07-08 -------------------------------- -By damiankloip: Always use display configured path in access handler. - - -Admin_Views 7.x-1.4, 2015-02-20 -------------------------------- -#2425349 by Haza: Strings missings from translatables. -#2425121 by Rob230, AdamPS, reallifedesign, damiankloip: Security flaw when used - with "Administer Users By Role" module. - - -Admin_Views 7.x-1.3, 2014-05-29 -------------------------------- -#2125683 by rooby, John Bickar | joshmelbs: Fixed Replace delete user with - cancel user action. -#1940328 by damiankloip | kaizerking: Fixed Notice: Undefined index: module in - views_plugin_display_system(). -#1949786 by plach | sydneyshan: Fixed Call to undefined method - view::get_option() in views_plugin_access_menu().inc on line 28. - - -Admin_Views 7.x-1.2, 2013-05-18 -------------------------------- -#1974234 by damiankloip | hass: Added Table title 'Operations' is missing on - User view. -#1787078 by damiankloip | Mazzhe: Fixed Notice : Undefined index: - admin/structure/taxonomy/% in - views_plugin_display_system()->execute_hook_menu(). - - -Admin_Views 7.x-1.1, 2012-12-17 -------------------------------- -#1868510 by damiankloip: Tidy and reorder methods in - views_plugin_display_system(). -#1778058 by damiankloip, sun: Remove contextual links from admin views. -#1868504 by damiankloip: Fixed No empty text for book view. -#1787078 by damiankloip | Mazzhe: Fixed Notice : Undefined index: - admin/structure/taxonomy/% in - views_plugin_display_system()->execute_hook_menu(). -#1786522 by damiankloip | vulfox: Fixed Conflict with other modules. - - -Admin_Views 7.x-1.0, 2012-09-09 -------------------------------- -By damiankloip: Removed remember roles. -By damiankloip: Added destination to link url, fixed typo, Added description - text in exposed filter. -#1714690 by damiankloip: Added an admin view for books. -#1714634 by damiankloip: Added 'Content: Has new content' field to content view. -#1774354 by populist: Filter out Anonymous from People View. -#1770206 by damiankloip: Fixed Comment view exposed filters don't remember last - selection like all other exposed filters. -#1652724 by damiankloip: Added empty table and text when there are no results. -#1673820 by damiankloip, alexweber | nikosnikos: Fixed Fatal error when there's - a views page with admin/content/xxx path. -By damiankloip: Re-exported default views. -#1701834 by damiankloip: Remove get_pager_text(). -#1697902 by damiankloip, sun: Fixed Access should be inherited from menu router - item, not view access plugin. -#1603828 by damiankloip, dawehner: Fixed admin_views().css is not loaded for - Views live preview. -#1627020 by mrfelton, damiankloip: Fixed No accessible menu item if only 'Access - the content overview page' permission is granted. -#1691404 by damiankloip: Remove call to get_breadcrumb() in display handler. -#1673636 by damiankloip: Fixed 'Member for' field should use raw time ago - formatter. -#1650118 by damiankloip: Use autocomplete for Username/author on all views. -#1647394 by damiankloip, dkingofpa: Added Change 'Name' filter field label to - 'Username' on People view. -#1630058 by damiankloip: Fixed Can't filter content by author. -#1616324 by sun, damiankloip: Added view display for - admin/content/comment/approval. -#1599148 by dawehner | giorgio79: Added 'Modify entity valuesr' VBO action to - every admin view. -By damiankloip: Fixed machine-names in translatables. -#1551194 by sun, damiankloip: Added e-mail field and filter to user view. -#1559780 by sun: Fixed system_block_ip_action() blocks the current user. -By damiankloip: Re-exported all default admin views (without changes). -By damiankloip: Updated Taxonomy term view to D7 / Views 3. -By damiankloip: Fixed Coder Review coding style violations. -#1565720 by sun: Fixed User creation form, permissions, roles, tabs, and actions - on admin/people are broken. -#1064928 by sun: Fixed Default views appear despite missing module dependency; - no way for other modules to provide default admin views. -#1064928 by dawehner: Fixed Comments view link appears despite disabled Comment - module. -#1557794 by damiankloip: Enqueue shouldn't be enabled by default. -#1332238 by zambrey, dereine: Add distinct to the node view to fix duplicate - results. -#1429692 by dereine: Bump views api version to 3. -#1177202 by das-peter, dereine, sun: Fixed copying and re-injection of child - router items breaks badly. -#1212064 by sun: Updated admin_views default views for VBO 3.x. -#1196590 by sun: Fixed errors and notices for admin_views with Views 3. -#1008380 by bdragon, sun: Updated admin_views for D7. -By sun: Disabled admin_content_taxonomy view as it's not ready for prime-time - yet. -#730156 by sun: Fixed Administration views. -#730156 by sun: Fixed Administration views. -#550132 by sun: Fixed (temporarily) admin_views menu items. -By sun: Updated admin_views.info for D7. -By sun: Added Administration views sub-module, converting all administrative - listing pages in Drupal core into real, ajaxified, and alterable views. diff --git a/html/sites/all/modules/contrib/admin_views/LICENSE.txt b/html/sites/all/modules/contrib/admin_views/LICENSE.txt deleted file mode 100644 index d159169d1..000000000 --- a/html/sites/all/modules/contrib/admin_views/LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/html/sites/all/modules/contrib/admin_views/README.txt b/html/sites/all/modules/contrib/admin_views/README.txt deleted file mode 100644 index 8b047f48c..000000000 --- a/html/sites/all/modules/contrib/admin_views/README.txt +++ /dev/null @@ -1,84 +0,0 @@ -Administration Views --------------------- -The Administration Views module replaces your content administration and user -administration pages with actual Drupal views that provide expanded field and -filtering capabilities, and also the ability to quickly customize your -administration pages since they are now real Views. This module improves the -usability of searching and modifying content. - - -Features --------------------------------------------------------------------------------- -* Provides new replacements for the following: - * Books admin page - * Comments admin page - * Node admin page - * User admin page - * Vocabular admin page - -* Includes a separate Views display plugin that allows replacing system pages. - This is provided by a submodule and may be used independently of the included - administrative pages. - - -Requirements --------------------------------------------------------------------------------- -* Views: https://www.drupal.org/project/views -* Views Bulk Operations: https://www.drupal.org/project/views_bulk_operations - - -Installation --------------------------------------------------------------------------------- -Install the Administration Views module as you would normally install a -contributed Drupal module. Visit https://www.drupal.org/node/1897420 for -further information. - -Included in this package is the Admin Views System Display module, which will be -automatically installed when Administration Views module itself is installed. It -may also be used on its own, should a site want to override system pages without -needing to use the included default displays. - - -Configuration --------------------------------------------------------------------------------- -Enable the Administrative views module from the module page. - -This module requires no configuration. It adds five new items to the Views page; -now that these are views, they can be edited and enhanced to fit individual -needs by adding fields and filters. These Views integrate well with Views Bulk -Operations. - - -Troubleshooting --------------------------------------------------------------------------------- -If you are upgrading from an older version of Administration Views and the -default views have been overridden (saved in the database) you could encounter -issues or not see any new changes unless you revert these views, so the default -in-code views are used. This can be done in the Views UI listing or using drush -(drush cter views_view --module=admin_views). - - -Credits / contact --------------------------------------------------------------------------------- -Currently maintained by Damien McKenna [1]; previously maintained by Vijaya -Chandran Mani [2], Daniel Wehner [3], Damian Lee [4] and Yonas Yanfa [5]. -Originally written by Daniel Kudwien [6]. - -Ongoing development is sponsored by Mediacurrent [7]. Original development was -sponsored by Unleashed Mind [8]. - -The best way to contact the authors is to submit an issue, be it a support -request, a feature request or a bug report, in the project issue queue: - https://www.drupal.org/project/issues/admin_views - - -References --------------------------------------------------------------------------------- -1: https://www.drupal.org/u/damienmckenna -2: https://www.drupal.org/u/vijaycs85 -3: https://www.drupal.org/u/vijaycs85 -4: https://www.drupal.org/u/damiankloip -5: https://www.drupal.org/u/fizk -6: https://www.drupal.org/u/sun -7: https://www.mediacurrent.com/ -8: https://www.drupal.org/unleashed-mind diff --git a/html/sites/all/modules/contrib/admin_views/admin_views.info b/html/sites/all/modules/contrib/admin_views/admin_views.info deleted file mode 100644 index d3585293a..000000000 --- a/html/sites/all/modules/contrib/admin_views/admin_views.info +++ /dev/null @@ -1,18 +0,0 @@ -name = Administration Views -description = Replaces all system object management pages in Drupal core with real views. -package = Administration -core = 7.x - -dependencies[] = views -dependencies[] = views_bulk_operations - -; The 'system' display plugin for Views is managed in this submodule. -dependencies[] = admin_views_system_display - -files[] = tests/admin_views.test - -; Information added by Drupal.org packaging script on 2021-09-09 -version = "7.x-1.8" -core = "7.x" -project = "admin_views" -datestamp = "1631191208" diff --git a/html/sites/all/modules/contrib/admin_views/admin_views.install b/html/sites/all/modules/contrib/admin_views/admin_views.install deleted file mode 100644 index 984aa60c0..000000000 --- a/html/sites/all/modules/contrib/admin_views/admin_views.install +++ /dev/null @@ -1,51 +0,0 @@ -display_options); - if (isset($options['access']) && is_array($options['access']) && isset($options['access']['type']) && $options['access']['type'] === 'menu') { - $options['access'] = array( - 'type' => 'perm', - 'perm' => 'access administration pages', - ); - - db_query("UPDATE {views_display} SET display_options = :options WHERE vid = :vid AND id = :id", array( - 'vid' => $record->vid, - 'id' => $record->id, - 'options' => serialize($options), - )); - } - } -} - -/** - * Enable the new system display submodule. - */ -function admin_views_update_7101() { - if (module_enable(array('admin_views_system_display'))) { - return t('Enabled the new Admin Views System Display submodule.'); - } - else { - throw new DrupalUpdateException('Unable to enable the new Admin Views System Display submodule.'); - } -} - -/** - * Reset this module's weight. - */ -function admin_views_update_7102() { - db_query("UPDATE {system} SET weight = 0 WHERE name = 'admin_views'"); -} diff --git a/html/sites/all/modules/contrib/admin_views/admin_views.module b/html/sites/all/modules/contrib/admin_views/admin_views.module deleted file mode 100644 index 8f4fddd49..000000000 --- a/html/sites/all/modules/contrib/admin_views/admin_views.module +++ /dev/null @@ -1,25 +0,0 @@ - 3, - ); -} - -/** - * Implements hook_help(). - */ -function admin_views_help($path, $arg) { - switch ($path) { - case 'admin/help#admin_views': - return t('This module replaces administrative overview/listing pages with actual views for superior usability. It allows a user to sort through large amounts of data more easily with exposed filters. It is also easier to perform bulk operations.'); - } -} diff --git a/html/sites/all/modules/contrib/admin_views/admin_views.views.inc b/html/sites/all/modules/contrib/admin_views/admin_views.views.inc deleted file mode 100644 index f63d0581b..000000000 --- a/html/sites/all/modules/contrib/admin_views/admin_views.views.inc +++ /dev/null @@ -1,41 +0,0 @@ - 'views', // This just tells our themes are elsewhere. - 'display' => array( - 'system' => array( - 'title' => t('System'), - 'help' => t('Display the view as replacement for an existing menu path.'), - 'path' => "$path/plugins", - 'handler' => 'views_plugin_display_system', - 'theme' => 'views_view', - 'uses hook menu' => TRUE, - 'use ajax' => TRUE, - 'use pager' => TRUE, - 'accept attachments' => TRUE, - 'admin' => t('System'), - ), - ), - 'access' => array( - 'menu' => array( - 'title' => t('(Deprecated) Menu system path'), - 'help' => t('This has been deprecated. DO NOT USE!'), - 'handler' => 'views_plugin_access_menu', - 'uses options' => FALSE, - 'path' => "$path/plugins", - ), - ), - ); - - return $plugins; -} diff --git a/html/sites/all/modules/contrib/admin_views/admin_views.views_default.inc b/html/sites/all/modules/contrib/admin_views/admin_views.views_default.inc deleted file mode 100644 index b0b1d37bf..000000000 --- a/html/sites/all/modules/contrib/admin_views/admin_views.views_default.inc +++ /dev/null @@ -1,46 +0,0 @@ - 'admin_views') + $modules; - foreach ($modules as $module) { - $dir = DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . '/admin_views_default'; - if (is_dir($dir)) { - // Scan each admin_views_default directory for provided default views. - foreach (file_scan_directory($dir, '/\.inc$/') as $filepath => $file) { - // Extract the primary module dependency of the default admin view, which - // is the filename prefix delimited by a period/dot; e.g., - // 'taxonomy.foo-bar.inc', and only include it if that module is enabled. - $dependency = strtok($file->filename, '.'); - if (isset($modules[$dependency])) { - include $filepath; - if (isset($view)) { - $views[$view->name] = $view; - } - } - } - } - } - return $views; -} - diff --git a/html/sites/all/modules/contrib/admin_views/admin_views_default/book.admin-content-book.inc b/html/sites/all/modules/contrib/admin_views/admin_views_default/book.admin-content-book.inc deleted file mode 100644 index a6b327cfc..000000000 --- a/html/sites/all/modules/contrib/admin_views/admin_views_default/book.admin-content-book.inc +++ /dev/null @@ -1,399 +0,0 @@ -name = 'admin_views_book'; -$view->description = 'Manage your site\'s book outlines.'; -$view->tag = 'default'; -$view->base_table = 'node'; -$view->human_name = 'Administration: Books'; -$view->core = 7; -$view->api_version = '3.0'; -$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ - -/* Display: Master */ -$handler = $view->new_display('default', 'Master', 'default'); -$handler->display->display_options['title'] = 'Books'; -$handler->display->display_options['use_ajax'] = TRUE; -$handler->display->display_options['use_more_always'] = FALSE; -$handler->display->display_options['access']['type'] = 'perm'; -$handler->display->display_options['access']['perm'] = 'access administration pages'; -$handler->display->display_options['cache']['type'] = 'none'; -$handler->display->display_options['query']['type'] = 'views_query'; -$handler->display->display_options['exposed_form']['type'] = 'basic'; -$handler->display->display_options['exposed_form']['options']['reset_button'] = TRUE; -$handler->display->display_options['pager']['type'] = 'full'; -$handler->display->display_options['pager']['options']['items_per_page'] = '50'; -$handler->display->display_options['pager']['options']['offset'] = '0'; -$handler->display->display_options['pager']['options']['id'] = '0'; -$handler->display->display_options['pager']['options']['quantity'] = '9'; -$handler->display->display_options['style_plugin'] = 'table'; -$handler->display->display_options['style_options']['columns'] = array( - 'views_bulk_operations' => 'views_bulk_operations', - 'title' => 'title', - 'timestamp' => 'title', - 'nid' => 'nid', - 'created' => 'created', - 'changed' => 'changed', - 'status' => 'status', - 'nothing' => 'nothing', -); -$handler->display->display_options['style_options']['default'] = 'created'; -$handler->display->display_options['style_options']['info'] = array( - 'views_bulk_operations' => array( - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'title' => array( - 'sortable' => 1, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => ' ', - 'empty_column' => 0, - ), - 'timestamp' => array( - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'nid' => array( - 'sortable' => 0, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'created' => array( - 'sortable' => 1, - 'default_sort_order' => 'desc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'changed' => array( - 'sortable' => 1, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'status' => array( - 'sortable' => 0, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'nothing' => array( - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), -); -$handler->display->display_options['style_options']['empty_table'] = TRUE; -/* No results behavior: Global: Unfiltered text */ -$handler->display->display_options['empty']['area_text_custom']['id'] = 'area_text_custom'; -$handler->display->display_options['empty']['area_text_custom']['table'] = 'views'; -$handler->display->display_options['empty']['area_text_custom']['field'] = 'area_text_custom'; -$handler->display->display_options['empty']['area_text_custom']['empty'] = TRUE; -$handler->display->display_options['empty']['area_text_custom']['content'] = 'No books available.'; -/* Relationship: Book: Top level book */ -$handler->display->display_options['relationships']['bid']['id'] = 'bid'; -$handler->display->display_options['relationships']['bid']['table'] = 'book'; -$handler->display->display_options['relationships']['bid']['field'] = 'bid'; -$handler->display->display_options['relationships']['bid']['required'] = TRUE; -/* Relationship: Content: Author */ -$handler->display->display_options['relationships']['uid']['id'] = 'uid'; -$handler->display->display_options['relationships']['uid']['table'] = 'node'; -$handler->display->display_options['relationships']['uid']['field'] = 'uid'; -/* Field: Bulk operations: Content */ -$handler->display->display_options['fields']['views_bulk_operations']['id'] = 'views_bulk_operations'; -$handler->display->display_options['fields']['views_bulk_operations']['table'] = 'node'; -$handler->display->display_options['fields']['views_bulk_operations']['field'] = 'views_bulk_operations'; -$handler->display->display_options['fields']['views_bulk_operations']['label'] = ''; -$handler->display->display_options['fields']['views_bulk_operations']['element_label_colon'] = FALSE; -$handler->display->display_options['fields']['views_bulk_operations']['vbo']['entity_load_capacity'] = '10'; -$handler->display->display_options['fields']['views_bulk_operations']['vbo']['operations'] = array( - 'action::node_assign_owner_action' => array( - 'selected' => 1, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 1, - 'label' => 'Change author', - ), - 'action::views_bulk_operations_delete_item' => array( - 'selected' => 1, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 1, - 'label' => 'Delete', - ), - 'action::system_message_action' => array( - 'selected' => 0, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - ), - 'action::views_bulk_operations_script_action' => array( - 'selected' => 0, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - ), - 'action::node_make_sticky_action' => array( - 'selected' => 0, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - ), - 'action::node_make_unsticky_action' => array( - 'selected' => 0, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - ), - 'action::views_bulk_operations_modify_action' => array( - 'selected' => 1, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 1, - 'label' => 'Modify values', - 'settings' => array( - 'show_all_tokens' => 1, - 'display_values' => array( - '_all_' => '_all_', - ), - ), - ), - 'action::views_bulk_operations_argument_selector_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'settings' => array( - 'url' => '', - ), - ), - 'action::node_promote_action' => array( - 'selected' => 0, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - ), - 'action::node_publish_action' => array( - 'selected' => 1, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 1, - 'label' => 'Publish', - ), - 'action::system_goto_action' => array( - 'selected' => 0, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - ), - 'action::node_unpromote_action' => array( - 'selected' => 0, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - ), - 'action::node_save_action' => array( - 'selected' => 0, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - ), - 'action::system_send_email_action' => array( - 'selected' => 0, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - ), - 'action::node_unpublish_action' => array( - 'selected' => 1, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 1, - 'label' => 'Unpublish', - ), - 'action::node_unpublish_by_keyword_action' => array( - 'selected' => 0, - 'use_queue' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - ), -); -$handler->display->display_options['fields']['views_bulk_operations']['vbo']['enable_select_all_pages'] = 1; -$handler->display->display_options['fields']['views_bulk_operations']['vbo']['display_type'] = '0'; -$handler->display->display_options['fields']['views_bulk_operations']['vbo']['display_result'] = 1; -$handler->display->display_options['fields']['views_bulk_operations']['vbo']['force_single'] = 0; -/* Field: Content: Nid */ -$handler->display->display_options['fields']['nid']['id'] = 'nid'; -$handler->display->display_options['fields']['nid']['table'] = 'node'; -$handler->display->display_options['fields']['nid']['field'] = 'nid'; -$handler->display->display_options['fields']['nid']['label'] = ''; -$handler->display->display_options['fields']['nid']['exclude'] = TRUE; -$handler->display->display_options['fields']['nid']['element_label_colon'] = FALSE; -/* Field: Content: Title */ -$handler->display->display_options['fields']['title']['id'] = 'title'; -$handler->display->display_options['fields']['title']['table'] = 'node'; -$handler->display->display_options['fields']['title']['field'] = 'title'; -$handler->display->display_options['fields']['title']['label'] = 'Book'; -$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE; -$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE; -/* Field: Content: Has new content */ -$handler->display->display_options['fields']['timestamp']['id'] = 'timestamp'; -$handler->display->display_options['fields']['timestamp']['table'] = 'history'; -$handler->display->display_options['fields']['timestamp']['field'] = 'timestamp'; -$handler->display->display_options['fields']['timestamp']['label'] = ''; -$handler->display->display_options['fields']['timestamp']['element_label_colon'] = FALSE; -/* Field: User: Name */ -$handler->display->display_options['fields']['name']['id'] = 'name'; -$handler->display->display_options['fields']['name']['table'] = 'users'; -$handler->display->display_options['fields']['name']['field'] = 'name'; -$handler->display->display_options['fields']['name']['relationship'] = 'uid'; -$handler->display->display_options['fields']['name']['label'] = 'Author'; -/* Field: Content: Post date */ -$handler->display->display_options['fields']['created']['id'] = 'created'; -$handler->display->display_options['fields']['created']['table'] = 'node'; -$handler->display->display_options['fields']['created']['field'] = 'created'; -$handler->display->display_options['fields']['created']['date_format'] = 'short'; -/* Field: Content: Updated date */ -$handler->display->display_options['fields']['changed']['id'] = 'changed'; -$handler->display->display_options['fields']['changed']['table'] = 'node'; -$handler->display->display_options['fields']['changed']['field'] = 'changed'; -$handler->display->display_options['fields']['changed']['date_format'] = 'time ago'; -/* Field: Content: Published */ -$handler->display->display_options['fields']['status']['id'] = 'status'; -$handler->display->display_options['fields']['status']['table'] = 'node'; -$handler->display->display_options['fields']['status']['field'] = 'status'; -$handler->display->display_options['fields']['status']['label'] = 'Status'; -$handler->display->display_options['fields']['status']['type'] = 'published-notpublished'; -$handler->display->display_options['fields']['status']['not'] = 0; -/* Field: Global: Custom text */ -$handler->display->display_options['fields']['nothing']['id'] = 'nothing'; -$handler->display->display_options['fields']['nothing']['table'] = 'views'; -$handler->display->display_options['fields']['nothing']['field'] = 'nothing'; -$handler->display->display_options['fields']['nothing']['label'] = 'Operations'; -$handler->display->display_options['fields']['nothing']['alter']['text'] = 'edit order and titles'; -$handler->display->display_options['fields']['nothing']['alter']['make_link'] = TRUE; -$handler->display->display_options['fields']['nothing']['alter']['path'] = 'admin/content/book/[nid]?destination=admin/content/book'; -$handler->display->display_options['fields']['nothing']['element_label_colon'] = FALSE; -/* Sort criterion: Content: Post date */ -$handler->display->display_options['sorts']['created']['id'] = 'created'; -$handler->display->display_options['sorts']['created']['table'] = 'node'; -$handler->display->display_options['sorts']['created']['field'] = 'created'; -$handler->display->display_options['sorts']['created']['order'] = 'DESC'; -/* Filter criterion: Content: Published */ -$handler->display->display_options['filters']['status']['id'] = 'status'; -$handler->display->display_options['filters']['status']['table'] = 'node'; -$handler->display->display_options['filters']['status']['field'] = 'status'; -$handler->display->display_options['filters']['status']['value'] = 1; -$handler->display->display_options['filters']['status']['group'] = 1; -$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; -/* Filter criterion: Book: Depth */ -$handler->display->display_options['filters']['depth']['id'] = 'depth'; -$handler->display->display_options['filters']['depth']['table'] = 'book_menu_links'; -$handler->display->display_options['filters']['depth']['field'] = 'depth'; -$handler->display->display_options['filters']['depth']['value']['value'] = '1'; -$handler->display->display_options['filters']['depth']['group'] = 1; -/* Filter criterion: Global: Combine fields filter */ -$handler->display->display_options['filters']['combine']['id'] = 'combine'; -$handler->display->display_options['filters']['combine']['table'] = 'views'; -$handler->display->display_options['filters']['combine']['field'] = 'combine'; -$handler->display->display_options['filters']['combine']['operator'] = 'contains'; -$handler->display->display_options['filters']['combine']['group'] = 1; -$handler->display->display_options['filters']['combine']['exposed'] = TRUE; -$handler->display->display_options['filters']['combine']['expose']['operator_id'] = 'combine_op'; -$handler->display->display_options['filters']['combine']['expose']['label'] = 'Title/node ID'; -$handler->display->display_options['filters']['combine']['expose']['description'] = 'Search by the node\'s title or ID.'; -$handler->display->display_options['filters']['combine']['expose']['operator'] = 'combine_op'; -$handler->display->display_options['filters']['combine']['expose']['identifier'] = 'combine'; -$handler->display->display_options['filters']['combine']['expose']['remember'] = TRUE; -$handler->display->display_options['filters']['combine']['fields'] = array( - 'nid' => 'nid', - 'title' => 'title', -); -/* Filter criterion: User: Name */ -$handler->display->display_options['filters']['uid']['id'] = 'uid'; -$handler->display->display_options['filters']['uid']['table'] = 'users'; -$handler->display->display_options['filters']['uid']['field'] = 'uid'; -$handler->display->display_options['filters']['uid']['relationship'] = 'uid'; -$handler->display->display_options['filters']['uid']['value'] = ''; -$handler->display->display_options['filters']['uid']['group'] = 1; -$handler->display->display_options['filters']['uid']['exposed'] = TRUE; -$handler->display->display_options['filters']['uid']['expose']['operator_id'] = 'uid_op'; -$handler->display->display_options['filters']['uid']['expose']['label'] = 'Author'; -$handler->display->display_options['filters']['uid']['expose']['operator'] = 'uid_op'; -$handler->display->display_options['filters']['uid']['expose']['identifier'] = 'uid'; -/* Filter criterion: Content: Published */ -$handler->display->display_options['filters']['status_1']['id'] = 'status_1'; -$handler->display->display_options['filters']['status_1']['table'] = 'node'; -$handler->display->display_options['filters']['status_1']['field'] = 'status'; -$handler->display->display_options['filters']['status_1']['value'] = 'All'; -$handler->display->display_options['filters']['status_1']['exposed'] = TRUE; -$handler->display->display_options['filters']['status_1']['expose']['operator_id'] = ''; -$handler->display->display_options['filters']['status_1']['expose']['label'] = 'Published'; -$handler->display->display_options['filters']['status_1']['expose']['operator'] = 'status_1_op'; -$handler->display->display_options['filters']['status_1']['expose']['identifier'] = 'status_1'; -$handler->display->display_options['filters']['status_1']['expose']['remember'] = TRUE; - -/* Display: System */ -$handler = $view->new_display('system', 'System', 'system_1'); -$handler->display->display_options['defaults']['hide_admin_links'] = FALSE; -$handler->display->display_options['hide_admin_links'] = TRUE; -$handler->display->display_options['defaults']['access'] = FALSE; -$handler->display->display_options['path'] = 'admin/content/book'; -$translatables['admin_views_book'] = array( - t('Master'), - t('Books'), - t('more'), - t('Apply'), - t('Reset'), - t('Sort by'), - t('Asc'), - t('Desc'), - t('Items per page'), - t('- All -'), - t('Offset'), - t('« first'), - t('‹ previous'), - t('next ›'), - t('last »'), - t('No books available.'), - t('Book'), - t('author'), - t('- Choose an operation -'), - t('Change author'), - t('Delete'), - t('Modify values'), - t('Publish'), - t('Unpublish'), - t('Author'), - t('Post date'), - t('Updated date'), - t('Status'), - t('Operations'), - t('edit order and titles'), - t('Title/node ID'), - t('Search by the node\'s title or ID.'), - t('Published'), - t('System'), -); diff --git a/html/sites/all/modules/contrib/admin_views/admin_views_default/comment.admin-content-comment.inc b/html/sites/all/modules/contrib/admin_views/admin_views_default/comment.admin-content-comment.inc deleted file mode 100644 index 5c1b1d891..000000000 --- a/html/sites/all/modules/contrib/admin_views/admin_views_default/comment.admin-content-comment.inc +++ /dev/null @@ -1,385 +0,0 @@ -name = 'admin_views_comment'; -$view->description = 'List and edit site comments and the comment moderation queue.'; -$view->tag = 'admin'; -$view->base_table = 'comment'; -$view->human_name = 'Administration: Comments'; -$view->core = 0; -$view->api_version = '3.0'; -$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ - -/* Display: Defaults */ -$handler = $view->new_display('default', 'Defaults', 'default'); -$handler->display->display_options['title'] = 'Comments'; -$handler->display->display_options['css_class'] = 'admin-views-view'; -$handler->display->display_options['use_ajax'] = TRUE; -$handler->display->display_options['use_more_always'] = FALSE; -$handler->display->display_options['access']['type'] = 'perm'; -$handler->display->display_options['access']['perm'] = 'access administration pages'; -$handler->display->display_options['cache']['type'] = 'none'; -$handler->display->display_options['query']['type'] = 'views_query'; -$handler->display->display_options['query']['options']['query_comment'] = FALSE; -$handler->display->display_options['exposed_form']['type'] = 'basic'; -$handler->display->display_options['exposed_form']['options']['reset_button'] = TRUE; -$handler->display->display_options['pager']['type'] = 'full'; -$handler->display->display_options['pager']['options']['items_per_page'] = 50; -$handler->display->display_options['style_plugin'] = 'table'; -$handler->display->display_options['style_options']['columns'] = array( - 'views_bulk_operations' => 'views_bulk_operations', - 'subject' => 'subject', - 'name' => 'name', - 'title' => 'title', - 'timestamp' => 'timestamp', - 'edit_comment' => 'edit_comment', - 'delete_comment' => 'edit_comment', -); -$handler->display->display_options['style_options']['default'] = 'timestamp'; -$handler->display->display_options['style_options']['info'] = array( - 'views_bulk_operations' => array( - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'subject' => array( - 'sortable' => 1, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'name' => array( - 'sortable' => 1, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'title' => array( - 'sortable' => 1, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'timestamp' => array( - 'sortable' => 1, - 'default_sort_order' => 'desc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'edit_comment' => array( - 'align' => '', - 'separator' => ' ', - 'empty_column' => 0, - ), - 'delete_comment' => array( - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), -); -$handler->display->display_options['style_options']['sticky'] = TRUE; -$handler->display->display_options['style_options']['empty_table'] = TRUE; -/* No results behavior: Global: Unfiltered text */ -$handler->display->display_options['empty']['area_text_custom']['id'] = 'area_text_custom'; -$handler->display->display_options['empty']['area_text_custom']['table'] = 'views'; -$handler->display->display_options['empty']['area_text_custom']['field'] = 'area_text_custom'; -$handler->display->display_options['empty']['area_text_custom']['empty'] = TRUE; -$handler->display->display_options['empty']['area_text_custom']['content'] = 'No comments available.'; -/* Relationship: Comment: Content */ -$handler->display->display_options['relationships']['nid']['id'] = 'nid'; -$handler->display->display_options['relationships']['nid']['table'] = 'comment'; -$handler->display->display_options['relationships']['nid']['field'] = 'nid'; -$handler->display->display_options['relationships']['nid']['label'] = 'Node'; -/* Relationship: Comment: Author */ -$handler->display->display_options['relationships']['uid']['id'] = 'uid'; -$handler->display->display_options['relationships']['uid']['table'] = 'comment'; -$handler->display->display_options['relationships']['uid']['field'] = 'uid'; -/* Field: Bulk operations: Comment */ -$handler->display->display_options['fields']['views_bulk_operations']['id'] = 'views_bulk_operations'; -$handler->display->display_options['fields']['views_bulk_operations']['table'] = 'comment'; -$handler->display->display_options['fields']['views_bulk_operations']['field'] = 'views_bulk_operations'; -$handler->display->display_options['fields']['views_bulk_operations']['label'] = ''; -$handler->display->display_options['fields']['views_bulk_operations']['element_label_colon'] = FALSE; -$handler->display->display_options['fields']['views_bulk_operations']['hide_alter_empty'] = FALSE; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['display_type'] = '0'; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['enable_select_all_pages'] = 1; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['force_single'] = 0; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['entity_load_capacity'] = '10'; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_operations'] = array( - 'action::views_bulk_operations_delete_item' => array( - 'selected' => 1, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Delete', - 'postpone_processing' => 0, - ), - 'action::views_bulk_operations_modify_action' => array( - 'selected' => 1, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Change value', - 'settings' => array( - 'show_all_tokens' => 1, - 'display_values' => array( - '_all_' => '_all_', - ), - ), - 'postpone_processing' => 0, - ), - 'action::system_message_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::views_bulk_operations_script_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::views_bulk_operations_argument_selector_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'settings' => array( - 'url' => '', - ), - ), - 'action::comment_publish_action' => array( - 'selected' => 1, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Publish', - 'postpone_processing' => 0, - ), - 'action::system_goto_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::comment_save_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::system_send_email_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::comment_unpublish_action' => array( - 'selected' => 1, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Unpublish', - 'postpone_processing' => 0, - ), - 'action::comment_unpublish_by_keyword_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), -); -/* Field: Comment: Title */ -$handler->display->display_options['fields']['subject']['id'] = 'subject'; -$handler->display->display_options['fields']['subject']['table'] = 'comment'; -$handler->display->display_options['fields']['subject']['field'] = 'subject'; -/* Field: Comment: Author */ -$handler->display->display_options['fields']['name']['id'] = 'name'; -$handler->display->display_options['fields']['name']['table'] = 'comment'; -$handler->display->display_options['fields']['name']['field'] = 'name'; -/* Field: Content: Title */ -$handler->display->display_options['fields']['title']['id'] = 'title'; -$handler->display->display_options['fields']['title']['table'] = 'node'; -$handler->display->display_options['fields']['title']['field'] = 'title'; -$handler->display->display_options['fields']['title']['relationship'] = 'nid'; -$handler->display->display_options['fields']['title']['label'] = 'Posted in'; -$handler->display->display_options['fields']['title']['alter']['max_length'] = '16'; -$handler->display->display_options['fields']['title']['alter']['trim'] = TRUE; -/* Field: Comment: Updated date */ -$handler->display->display_options['fields']['timestamp']['id'] = 'timestamp'; -$handler->display->display_options['fields']['timestamp']['table'] = 'comment'; -$handler->display->display_options['fields']['timestamp']['field'] = 'changed'; -$handler->display->display_options['fields']['timestamp']['label'] = 'Updated'; -$handler->display->display_options['fields']['timestamp']['hide_alter_empty'] = FALSE; -$handler->display->display_options['fields']['timestamp']['date_format'] = 'time ago'; -/* Field: Comment: Edit link */ -$handler->display->display_options['fields']['edit_comment']['id'] = 'edit_comment'; -$handler->display->display_options['fields']['edit_comment']['table'] = 'comment'; -$handler->display->display_options['fields']['edit_comment']['field'] = 'edit_comment'; -$handler->display->display_options['fields']['edit_comment']['label'] = 'Operations'; -/* Field: Comment: Delete link */ -$handler->display->display_options['fields']['delete_comment']['id'] = 'delete_comment'; -$handler->display->display_options['fields']['delete_comment']['table'] = 'comment'; -$handler->display->display_options['fields']['delete_comment']['field'] = 'delete_comment'; -$handler->display->display_options['fields']['delete_comment']['label'] = ''; -/* Sort criterion: Comment: Updated date */ -$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp'; -$handler->display->display_options['sorts']['timestamp']['table'] = 'comment'; -$handler->display->display_options['sorts']['timestamp']['field'] = 'changed'; -$handler->display->display_options['sorts']['timestamp']['order'] = 'DESC'; -/* Filter criterion: Comment: Title */ -$handler->display->display_options['filters']['subject']['id'] = 'subject'; -$handler->display->display_options['filters']['subject']['table'] = 'comment'; -$handler->display->display_options['filters']['subject']['field'] = 'subject'; -$handler->display->display_options['filters']['subject']['operator'] = 'contains'; -$handler->display->display_options['filters']['subject']['group'] = 1; -$handler->display->display_options['filters']['subject']['exposed'] = TRUE; -$handler->display->display_options['filters']['subject']['expose']['operator_id'] = 'subject_op'; -$handler->display->display_options['filters']['subject']['expose']['label'] = 'Title'; -$handler->display->display_options['filters']['subject']['expose']['operator'] = 'subject_op'; -$handler->display->display_options['filters']['subject']['expose']['identifier'] = 'subject'; -$handler->display->display_options['filters']['subject']['expose']['remember'] = TRUE; -/* Filter criterion: User: Name */ -$handler->display->display_options['filters']['uid']['id'] = 'uid'; -$handler->display->display_options['filters']['uid']['table'] = 'users'; -$handler->display->display_options['filters']['uid']['field'] = 'uid'; -$handler->display->display_options['filters']['uid']['relationship'] = 'uid'; -$handler->display->display_options['filters']['uid']['value'] = ''; -$handler->display->display_options['filters']['uid']['group'] = 1; -$handler->display->display_options['filters']['uid']['exposed'] = TRUE; -$handler->display->display_options['filters']['uid']['expose']['operator_id'] = 'uid_op'; -$handler->display->display_options['filters']['uid']['expose']['label'] = 'Author'; -$handler->display->display_options['filters']['uid']['expose']['operator'] = 'uid_op'; -$handler->display->display_options['filters']['uid']['expose']['identifier'] = 'author'; -$handler->display->display_options['filters']['uid']['expose']['remember'] = TRUE; -/* Filter criterion: Content: Title */ -$handler->display->display_options['filters']['title']['id'] = 'title'; -$handler->display->display_options['filters']['title']['table'] = 'node'; -$handler->display->display_options['filters']['title']['field'] = 'title'; -$handler->display->display_options['filters']['title']['relationship'] = 'nid'; -$handler->display->display_options['filters']['title']['operator'] = 'contains'; -$handler->display->display_options['filters']['title']['group'] = 1; -$handler->display->display_options['filters']['title']['exposed'] = TRUE; -$handler->display->display_options['filters']['title']['expose']['operator_id'] = 'title_op'; -$handler->display->display_options['filters']['title']['expose']['label'] = 'Posted in'; -$handler->display->display_options['filters']['title']['expose']['operator'] = 'title_op'; -$handler->display->display_options['filters']['title']['expose']['identifier'] = 'nodeTitle'; -$handler->display->display_options['filters']['title']['expose']['remember'] = TRUE; -/* Filter criterion: Comment: Approved */ -$handler->display->display_options['filters']['status']['id'] = 'status'; -$handler->display->display_options['filters']['status']['table'] = 'comment'; -$handler->display->display_options['filters']['status']['field'] = 'status'; -$handler->display->display_options['filters']['status']['value'] = 'All'; -$handler->display->display_options['filters']['status']['group'] = 1; -$handler->display->display_options['filters']['status']['exposed'] = TRUE; -$handler->display->display_options['filters']['status']['expose']['operator_id'] = ''; -$handler->display->display_options['filters']['status']['expose']['label'] = 'Published'; -$handler->display->display_options['filters']['status']['expose']['identifier'] = 'status'; -$handler->display->display_options['filters']['status']['expose']['remember'] = TRUE; - -/* Display: Comments */ -$handler = $view->new_display('system', 'Comments', 'system_1'); -$handler->display->display_options['defaults']['hide_admin_links'] = FALSE; -$handler->display->display_options['hide_admin_links'] = TRUE; -$handler->display->display_options['defaults']['access'] = FALSE; -$handler->display->display_options['path'] = 'admin/content/comment'; - -/* Display: Unpublished */ -$handler = $view->new_display('system', 'Unpublished', 'system_2'); -$handler->display->display_options['defaults']['hide_admin_links'] = FALSE; -$handler->display->display_options['hide_admin_links'] = TRUE; -$handler->display->display_options['defaults']['access'] = FALSE; -$handler->display->display_options['defaults']['filter_groups'] = FALSE; -$handler->display->display_options['defaults']['filters'] = FALSE; -/* Filter criterion: Comment: Title */ -$handler->display->display_options['filters']['subject']['id'] = 'subject'; -$handler->display->display_options['filters']['subject']['table'] = 'comment'; -$handler->display->display_options['filters']['subject']['field'] = 'subject'; -$handler->display->display_options['filters']['subject']['operator'] = 'contains'; -$handler->display->display_options['filters']['subject']['group'] = 1; -$handler->display->display_options['filters']['subject']['exposed'] = TRUE; -$handler->display->display_options['filters']['subject']['expose']['operator_id'] = 'subject_op'; -$handler->display->display_options['filters']['subject']['expose']['label'] = 'Title'; -$handler->display->display_options['filters']['subject']['expose']['operator'] = 'subject_op'; -$handler->display->display_options['filters']['subject']['expose']['identifier'] = 'subject'; -/* Filter criterion: User: Name */ -$handler->display->display_options['filters']['uid']['id'] = 'uid'; -$handler->display->display_options['filters']['uid']['table'] = 'users'; -$handler->display->display_options['filters']['uid']['field'] = 'uid'; -$handler->display->display_options['filters']['uid']['relationship'] = 'uid'; -$handler->display->display_options['filters']['uid']['value'] = ''; -$handler->display->display_options['filters']['uid']['group'] = 1; -$handler->display->display_options['filters']['uid']['exposed'] = TRUE; -$handler->display->display_options['filters']['uid']['expose']['operator_id'] = 'uid_op'; -$handler->display->display_options['filters']['uid']['expose']['label'] = 'Author'; -$handler->display->display_options['filters']['uid']['expose']['operator'] = 'uid_op'; -$handler->display->display_options['filters']['uid']['expose']['identifier'] = 'author'; -$handler->display->display_options['filters']['uid']['expose']['remember'] = TRUE; -/* Filter criterion: Content: Title */ -$handler->display->display_options['filters']['title']['id'] = 'title'; -$handler->display->display_options['filters']['title']['table'] = 'node'; -$handler->display->display_options['filters']['title']['field'] = 'title'; -$handler->display->display_options['filters']['title']['relationship'] = 'nid'; -$handler->display->display_options['filters']['title']['operator'] = 'contains'; -$handler->display->display_options['filters']['title']['group'] = 1; -$handler->display->display_options['filters']['title']['exposed'] = TRUE; -$handler->display->display_options['filters']['title']['expose']['operator_id'] = 'title_op'; -$handler->display->display_options['filters']['title']['expose']['label'] = 'Posted in'; -$handler->display->display_options['filters']['title']['expose']['operator'] = 'title_op'; -$handler->display->display_options['filters']['title']['expose']['identifier'] = 'nodeTitle'; -/* Filter criterion: Comment: Approved */ -$handler->display->display_options['filters']['status']['id'] = 'status'; -$handler->display->display_options['filters']['status']['table'] = 'comment'; -$handler->display->display_options['filters']['status']['field'] = 'status'; -$handler->display->display_options['filters']['status']['value'] = '0'; -$handler->display->display_options['filters']['status']['group'] = 1; -$handler->display->display_options['filters']['status']['exposed'] = TRUE; -$handler->display->display_options['filters']['status']['expose']['operator_id'] = ''; -$handler->display->display_options['filters']['status']['expose']['label'] = 'Published'; -$handler->display->display_options['filters']['status']['expose']['identifier'] = 'status'; -$handler->display->display_options['filters']['status']['expose']['remember'] = TRUE; -$handler->display->display_options['path'] = 'admin/content/comment/approval'; -$translatables['admin_views_comment'] = array( - t('Defaults'), - t('Comments'), - t('more'), - t('Apply'), - t('Reset'), - t('Sort by'), - t('Asc'), - t('Desc'), - t('Items per page'), - t('- All -'), - t('Offset'), - t('« first'), - t('‹ previous'), - t('next ›'), - t('last »'), - t('No comments available.'), - t('Node'), - t('author'), - t('- Choose an operation -'), - t('Delete'), - t('Change value'), - t('Publish'), - t('Unpublish'), - t('Title'), - t('Author'), - t('Posted in'), - t('Updated'), - t('Operations'), - t('Published'), - t('Unpublished'), -); diff --git a/html/sites/all/modules/contrib/admin_views/admin_views_default/node.admin-content.inc b/html/sites/all/modules/contrib/admin_views/admin_views_default/node.admin-content.inc deleted file mode 100644 index d73256b2c..000000000 --- a/html/sites/all/modules/contrib/admin_views/admin_views_default/node.admin-content.inc +++ /dev/null @@ -1,417 +0,0 @@ -name = 'admin_views_node'; -$view->description = 'Find and manage content.'; -$view->tag = 'admin'; -$view->base_table = 'node'; -$view->human_name = 'Administration: Nodes'; -$view->core = 0; -$view->api_version = '3.0'; -$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ - -/* Display: Defaults */ -$handler = $view->new_display('default', 'Defaults', 'default'); -$handler->display->display_options['title'] = 'Content'; -$handler->display->display_options['css_class'] = 'admin-views-view'; -$handler->display->display_options['use_ajax'] = TRUE; -$handler->display->display_options['use_more_always'] = FALSE; -$handler->display->display_options['group_by'] = TRUE; -$handler->display->display_options['access']['type'] = 'perm'; -$handler->display->display_options['access']['perm'] = 'access administration pages'; -$handler->display->display_options['cache']['type'] = 'none'; -$handler->display->display_options['query']['type'] = 'views_query'; -$handler->display->display_options['query']['options']['distinct'] = TRUE; -$handler->display->display_options['query']['options']['query_comment'] = FALSE; -$handler->display->display_options['exposed_form']['type'] = 'basic'; -$handler->display->display_options['exposed_form']['options']['reset_button'] = TRUE; -$handler->display->display_options['pager']['type'] = 'full'; -$handler->display->display_options['pager']['options']['items_per_page'] = 50; -$handler->display->display_options['style_plugin'] = 'table'; -$handler->display->display_options['style_options']['columns'] = array( - 'views_bulk_operations' => 'views_bulk_operations', - 'title' => 'title', - 'timestamp' => 'title', - 'type' => 'type', - 'name' => 'name', - 'status' => 'status', - 'changed' => 'changed', - 'edit_node' => 'edit_node', - 'delete_node' => 'edit_node', -); -$handler->display->display_options['style_options']['default'] = 'changed'; -$handler->display->display_options['style_options']['info'] = array( - 'views_bulk_operations' => array( - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'title' => array( - 'sortable' => 1, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => ' ', - 'empty_column' => 0, - ), - 'timestamp' => array( - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'type' => array( - 'sortable' => 1, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'name' => array( - 'sortable' => 1, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'status' => array( - 'sortable' => 1, - 'default_sort_order' => 'desc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'changed' => array( - 'sortable' => 1, - 'default_sort_order' => 'desc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'edit_node' => array( - 'align' => '', - 'separator' => ' ', - 'empty_column' => 0, - ), - 'delete_node' => array( - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), -); -$handler->display->display_options['style_options']['sticky'] = TRUE; -$handler->display->display_options['style_options']['empty_table'] = TRUE; -/* No results behavior: Global: Unfiltered text */ -$handler->display->display_options['empty']['area_text_custom']['id'] = 'area_text_custom'; -$handler->display->display_options['empty']['area_text_custom']['table'] = 'views'; -$handler->display->display_options['empty']['area_text_custom']['field'] = 'area_text_custom'; -$handler->display->display_options['empty']['area_text_custom']['empty'] = TRUE; -$handler->display->display_options['empty']['area_text_custom']['content'] = 'No content available.'; -/* Relationship: Content: Author */ -$handler->display->display_options['relationships']['uid']['id'] = 'uid'; -$handler->display->display_options['relationships']['uid']['table'] = 'node'; -$handler->display->display_options['relationships']['uid']['field'] = 'uid'; -/* Relationship: Content: Taxonomy terms on node */ -if (module_exists('taxonomy')) { - $handler->display->display_options['relationships']['term_node_tid']['id'] = 'term_node_tid'; - $handler->display->display_options['relationships']['term_node_tid']['table'] = 'node'; - $handler->display->display_options['relationships']['term_node_tid']['field'] = 'term_node_tid'; - $handler->display->display_options['relationships']['term_node_tid']['vocabularies'] = array( - 'forums' => 0, - 'tags' => 0, - ); -} -/* Field: Bulk operations: Content */ -$handler->display->display_options['fields']['views_bulk_operations']['id'] = 'views_bulk_operations'; -$handler->display->display_options['fields']['views_bulk_operations']['table'] = 'node'; -$handler->display->display_options['fields']['views_bulk_operations']['field'] = 'views_bulk_operations'; -$handler->display->display_options['fields']['views_bulk_operations']['label'] = ''; -$handler->display->display_options['fields']['views_bulk_operations']['element_label_colon'] = FALSE; -$handler->display->display_options['fields']['views_bulk_operations']['hide_alter_empty'] = FALSE; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['display_type'] = '0'; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['enable_select_all_pages'] = 1; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['force_single'] = 0; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['entity_load_capacity'] = '10'; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_operations'] = array( - 'action::node_assign_owner_action' => array( - 'selected' => 1, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Change author', - 'postpone_processing' => 0, - ), - 'action::views_bulk_operations_delete_item' => array( - 'selected' => 1, - 'skip_confirmation' => 0, - 'override_label' => 1, - 'label' => 'Delete', - 'postpone_processing' => 0, - ), - 'action::views_bulk_operations_modify_action' => array( - 'selected' => 1, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Change value', - 'settings' => array( - 'show_all_tokens' => 1, - 'display_values' => array( - '_all_' => '_all_', - ), - ), - 'postpone_processing' => 0, - ), - 'action::system_message_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::views_bulk_operations_script_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::node_make_sticky_action' => array( - 'selected' => 1, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Stick', - 'postpone_processing' => 0, - ), - 'action::node_make_unsticky_action' => array( - 'selected' => 1, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Unstick', - 'postpone_processing' => 0, - ), - 'action::views_bulk_operations_argument_selector_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'settings' => array( - 'url' => '', - ), - ), - 'action::node_promote_action' => array( - 'selected' => 1, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Promote to front page', - 'postpone_processing' => 0, - ), - 'action::node_publish_action' => array( - 'selected' => 1, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Publish', - 'postpone_processing' => 0, - ), - 'action::system_goto_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::node_unpromote_action' => array( - 'selected' => 1, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Demote from front page', - 'postpone_processing' => 0, - ), - 'action::node_save_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::system_send_email_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::node_unpublish_action' => array( - 'selected' => 1, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Unpublish', - 'postpone_processing' => 0, - ), - 'action::node_unpublish_by_keyword_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), -); -/* Field: Content: Title */ -$handler->display->display_options['fields']['title']['id'] = 'title'; -$handler->display->display_options['fields']['title']['table'] = 'node'; -$handler->display->display_options['fields']['title']['field'] = 'title'; -/* Field: Content: Has new content */ -$handler->display->display_options['fields']['timestamp']['id'] = 'timestamp'; -$handler->display->display_options['fields']['timestamp']['table'] = 'history'; -$handler->display->display_options['fields']['timestamp']['field'] = 'timestamp'; -$handler->display->display_options['fields']['timestamp']['label'] = ''; -$handler->display->display_options['fields']['timestamp']['element_label_colon'] = FALSE; -/* Field: Content: Type */ -$handler->display->display_options['fields']['type']['id'] = 'type'; -$handler->display->display_options['fields']['type']['table'] = 'node'; -$handler->display->display_options['fields']['type']['field'] = 'type'; -/* Field: User: Name */ -$handler->display->display_options['fields']['name']['id'] = 'name'; -$handler->display->display_options['fields']['name']['table'] = 'users'; -$handler->display->display_options['fields']['name']['field'] = 'name'; -$handler->display->display_options['fields']['name']['relationship'] = 'uid'; -$handler->display->display_options['fields']['name']['label'] = 'Author'; -$handler->display->display_options['fields']['name']['hide_alter_empty'] = FALSE; -/* Field: Content: Published */ -$handler->display->display_options['fields']['status']['id'] = 'status'; -$handler->display->display_options['fields']['status']['table'] = 'node'; -$handler->display->display_options['fields']['status']['field'] = 'status'; -$handler->display->display_options['fields']['status']['not'] = 0; -/* Field: Content: Updated date */ -$handler->display->display_options['fields']['changed']['id'] = 'changed'; -$handler->display->display_options['fields']['changed']['table'] = 'node'; -$handler->display->display_options['fields']['changed']['field'] = 'changed'; -$handler->display->display_options['fields']['changed']['label'] = 'Updated'; -$handler->display->display_options['fields']['changed']['date_format'] = 'short'; -/* Field: Content: Edit link */ -$handler->display->display_options['fields']['edit_node']['id'] = 'edit_node'; -$handler->display->display_options['fields']['edit_node']['table'] = 'views_entity_node'; -$handler->display->display_options['fields']['edit_node']['field'] = 'edit_node'; -$handler->display->display_options['fields']['edit_node']['label'] = 'Operations'; -/* Field: Content: Delete link */ -$handler->display->display_options['fields']['delete_node']['id'] = 'delete_node'; -$handler->display->display_options['fields']['delete_node']['table'] = 'views_entity_node'; -$handler->display->display_options['fields']['delete_node']['field'] = 'delete_node'; -$handler->display->display_options['fields']['delete_node']['label'] = ''; -/* Filter criterion: Content: Title */ -$handler->display->display_options['filters']['title']['id'] = 'title'; -$handler->display->display_options['filters']['title']['table'] = 'node'; -$handler->display->display_options['filters']['title']['field'] = 'title'; -$handler->display->display_options['filters']['title']['operator'] = 'contains'; -$handler->display->display_options['filters']['title']['exposed'] = TRUE; -$handler->display->display_options['filters']['title']['expose']['operator_id'] = 'title_op'; -$handler->display->display_options['filters']['title']['expose']['label'] = 'Title'; -$handler->display->display_options['filters']['title']['expose']['use_operator'] = TRUE; -$handler->display->display_options['filters']['title']['expose']['operator'] = 'title_op'; -$handler->display->display_options['filters']['title']['expose']['identifier'] = 'title'; -$handler->display->display_options['filters']['title']['expose']['remember'] = TRUE; -/* Filter criterion: Content: Type */ -$handler->display->display_options['filters']['type']['id'] = 'type'; -$handler->display->display_options['filters']['type']['table'] = 'node'; -$handler->display->display_options['filters']['type']['field'] = 'type'; -$handler->display->display_options['filters']['type']['exposed'] = TRUE; -$handler->display->display_options['filters']['type']['expose']['operator_id'] = 'type_op'; -$handler->display->display_options['filters']['type']['expose']['label'] = 'Type'; -$handler->display->display_options['filters']['type']['expose']['operator'] = 'type_op'; -$handler->display->display_options['filters']['type']['expose']['identifier'] = 'type'; -$handler->display->display_options['filters']['type']['expose']['remember'] = TRUE; -/* Filter criterion: User: Name */ -$handler->display->display_options['filters']['uid']['id'] = 'uid'; -$handler->display->display_options['filters']['uid']['table'] = 'users'; -$handler->display->display_options['filters']['uid']['field'] = 'uid'; -$handler->display->display_options['filters']['uid']['relationship'] = 'uid'; -$handler->display->display_options['filters']['uid']['value'] = ''; -$handler->display->display_options['filters']['uid']['exposed'] = TRUE; -$handler->display->display_options['filters']['uid']['expose']['operator_id'] = 'uid_op'; -$handler->display->display_options['filters']['uid']['expose']['label'] = 'Author'; -$handler->display->display_options['filters']['uid']['expose']['operator'] = 'uid_op'; -$handler->display->display_options['filters']['uid']['expose']['identifier'] = 'author'; -$handler->display->display_options['filters']['uid']['expose']['remember'] = TRUE; -/* Filter criterion: Content: Published */ -$handler->display->display_options['filters']['status']['id'] = 'status'; -$handler->display->display_options['filters']['status']['table'] = 'node'; -$handler->display->display_options['filters']['status']['field'] = 'status'; -$handler->display->display_options['filters']['status']['value'] = 'All'; -$handler->display->display_options['filters']['status']['exposed'] = TRUE; -$handler->display->display_options['filters']['status']['expose']['operator_id'] = ''; -$handler->display->display_options['filters']['status']['expose']['label'] = 'Published'; -$handler->display->display_options['filters']['status']['expose']['operator'] = 'status_op'; -$handler->display->display_options['filters']['status']['expose']['identifier'] = 'status'; -$handler->display->display_options['filters']['status']['expose']['remember'] = TRUE; -if (module_exists('taxonomy')) { -/* Filter criterion: Taxonomy term: Vocabulary */ - $handler->display->display_options['filters']['vid']['id'] = 'vid'; - $handler->display->display_options['filters']['vid']['table'] = 'taxonomy_term_data'; - $handler->display->display_options['filters']['vid']['field'] = 'vid'; - $handler->display->display_options['filters']['vid']['relationship'] = 'term_node_tid'; - $handler->display->display_options['filters']['vid']['exposed'] = TRUE; - $handler->display->display_options['filters']['vid']['expose']['operator_id'] = 'vid_op'; - $handler->display->display_options['filters']['vid']['expose']['label'] = 'Vocabulary'; - $handler->display->display_options['filters']['vid']['expose']['operator'] = 'vid_op'; - $handler->display->display_options['filters']['vid']['expose']['identifier'] = 'vid'; - $handler->display->display_options['filters']['vid']['expose']['remember'] = TRUE; -} -if (module_exists('domain')) { - /* Filter criterion: Domain Access: Domain ID */ - $handler->display->display_options['filters']['gid']['id'] = 'gid'; - $handler->display->display_options['filters']['gid']['table'] = 'domain_access'; - $handler->display->display_options['filters']['gid']['field'] = 'gid'; - $handler->display->display_options['filters']['gid']['exposed'] = TRUE; - $handler->display->display_options['filters']['gid']['expose']['operator_id'] = 'gid_op'; - $handler->display->display_options['filters']['gid']['expose']['label'] = 'Domain'; - $handler->display->display_options['filters']['gid']['expose']['operator'] = 'gid_op'; - $handler->display->display_options['filters']['gid']['expose']['identifier'] = 'gid'; - $handler->display->display_options['filters']['gid']['expose']['remember'] = TRUE; -} - -/* Display: System */ -$handler = $view->new_display('system', 'System', 'system_1'); -$handler->display->display_options['defaults']['hide_admin_links'] = FALSE; -$handler->display->display_options['hide_admin_links'] = TRUE; -$handler->display->display_options['defaults']['access'] = FALSE; -$handler->display->display_options['path'] = 'admin/content'; -$translatables['admin_views_node'] = array( - t('Defaults'), - t('Content'), - t('more'), - t('Apply'), - t('Reset'), - t('Sort by'), - t('Asc'), - t('Desc'), - t('Items per page'), - t('- All -'), - t('Offset'), - t('« first'), - t('‹ previous'), - t('next ›'), - t('last »'), - t('No content available.'), - t('author'), - t('term'), - t('- Choose an operation -'), - t('Change author'), - t('Delete'), - t('Change value'), - t('Stick'), - t('Unstick'), - t('Promote to front page'), - t('Publish'), - t('Demote from front page'), - t('Unpublish'), - t('Title'), - t('Type'), - t('Author'), - t('Published'), - t('Updated'), - t('Operations'), - t('Vocabulary'), - t('Domain'), - t('System'), -); diff --git a/html/sites/all/modules/contrib/admin_views/admin_views_default/taxonomy.admin-content-taxonomy.inc b/html/sites/all/modules/contrib/admin_views/admin_views_default/taxonomy.admin-content-taxonomy.inc deleted file mode 100644 index a31add7c7..000000000 --- a/html/sites/all/modules/contrib/admin_views/admin_views_default/taxonomy.admin-content-taxonomy.inc +++ /dev/null @@ -1,153 +0,0 @@ -name = 'admin_views_taxonomy_term'; -$view->description = 'Manage tagging, categorization, and classification of your content.'; -$view->tag = 'admin'; -$view->base_table = 'taxonomy_term_data'; -$view->human_name = 'Administration: Taxonomy terms'; -$view->core = 0; -$view->api_version = '3.0'; -$view->disabled = TRUE; /* Edit this to true to make a default view disabled initially */ - -/* Display: Defaults */ -$handler = $view->new_display('default', 'Defaults', 'default'); -$handler->display->display_options['title'] = 'Terms'; -$handler->display->display_options['use_ajax'] = TRUE; -$handler->display->display_options['use_more_always'] = FALSE; -$handler->display->display_options['access']['type'] = 'perm'; -$handler->display->display_options['access']['perm'] = 'access administration pages'; -$handler->display->display_options['cache']['type'] = 'none'; -$handler->display->display_options['query']['type'] = 'views_query'; -$handler->display->display_options['exposed_form']['type'] = 'basic'; -$handler->display->display_options['exposed_form']['options']['reset_button'] = TRUE; -$handler->display->display_options['pager']['type'] = 'none'; -$handler->display->display_options['style_plugin'] = 'table'; -$handler->display->display_options['style_options']['columns'] = array( - 'name_1' => 'name_1', - 'name' => 'name', - 'tid' => 'tid', -); -$handler->display->display_options['style_options']['default'] = 'name'; -$handler->display->display_options['style_options']['info'] = array( - 'name_1' => array( - 'sortable' => 0, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'name' => array( - 'sortable' => 1, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'tid' => array( - 'sortable' => 0, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), -); -$handler->display->display_options['style_options']['sticky'] = TRUE; -/* Field: Taxonomy vocabulary: Name */ -$handler->display->display_options['fields']['name_1']['id'] = 'name_1'; -$handler->display->display_options['fields']['name_1']['table'] = 'taxonomy_vocabulary'; -$handler->display->display_options['fields']['name_1']['field'] = 'name'; -$handler->display->display_options['fields']['name_1']['label'] = ''; -$handler->display->display_options['fields']['name_1']['exclude'] = TRUE; -/* Field: Taxonomy term: Name */ -$handler->display->display_options['fields']['name']['id'] = 'name'; -$handler->display->display_options['fields']['name']['table'] = 'taxonomy_term_data'; -$handler->display->display_options['fields']['name']['field'] = 'name'; -$handler->display->display_options['fields']['name']['label'] = 'Term'; -$handler->display->display_options['fields']['name']['link_to_taxonomy'] = TRUE; -/* Field: Taxonomy term: Term ID */ -$handler->display->display_options['fields']['tid']['id'] = 'tid'; -$handler->display->display_options['fields']['tid']['table'] = 'taxonomy_term_data'; -$handler->display->display_options['fields']['tid']['field'] = 'tid'; -$handler->display->display_options['fields']['tid']['label'] = 'Operations'; -$handler->display->display_options['fields']['tid']['alter']['alter_text'] = TRUE; -$handler->display->display_options['fields']['tid']['alter']['text'] = 'edit'; -$handler->display->display_options['fields']['tid']['alter']['make_link'] = TRUE; -$handler->display->display_options['fields']['tid']['alter']['path'] = 'taxonomy/term/[tid]/edit'; -$handler->display->display_options['fields']['tid']['separator'] = ''; -/* Sort criterion: Taxonomy term: Weight */ -$handler->display->display_options['sorts']['weight']['id'] = 'weight'; -$handler->display->display_options['sorts']['weight']['table'] = 'taxonomy_term_data'; -$handler->display->display_options['sorts']['weight']['field'] = 'weight'; -/* Sort criterion: Taxonomy term: Name */ -$handler->display->display_options['sorts']['name']['id'] = 'name'; -$handler->display->display_options['sorts']['name']['table'] = 'taxonomy_term_data'; -$handler->display->display_options['sorts']['name']['field'] = 'name'; -/* Contextual filter: Taxonomy vocabulary: Machine name */ -$handler->display->display_options['arguments']['machine_name']['id'] = 'machine_name'; -$handler->display->display_options['arguments']['machine_name']['table'] = 'taxonomy_vocabulary'; -$handler->display->display_options['arguments']['machine_name']['field'] = 'machine_name'; -$handler->display->display_options['arguments']['machine_name']['title_enable'] = TRUE; -$handler->display->display_options['arguments']['machine_name']['title'] = 'Terms in %1'; -$handler->display->display_options['arguments']['machine_name']['breadcrumb_enable'] = TRUE; -$handler->display->display_options['arguments']['machine_name']['breadcrumb'] = '%1'; -$handler->display->display_options['arguments']['machine_name']['default_argument_type'] = 'fixed'; -$handler->display->display_options['arguments']['machine_name']['summary']['number_of_records'] = '0'; -$handler->display->display_options['arguments']['machine_name']['summary']['format'] = 'default_summary'; -$handler->display->display_options['arguments']['machine_name']['summary_options']['items_per_page'] = '25'; -$handler->display->display_options['arguments']['machine_name']['specify_validation'] = TRUE; -$handler->display->display_options['arguments']['machine_name']['validate']['fail'] = 'ignore'; -$handler->display->display_options['arguments']['machine_name']['limit'] = '0'; -/* Filter criterion: Taxonomy term: Vocabulary */ -$handler->display->display_options['filters']['vid']['id'] = 'vid'; -$handler->display->display_options['filters']['vid']['table'] = 'taxonomy_term_data'; -$handler->display->display_options['filters']['vid']['field'] = 'vid'; -$handler->display->display_options['filters']['vid']['group'] = '0'; -$handler->display->display_options['filters']['vid']['exposed'] = TRUE; -$handler->display->display_options['filters']['vid']['expose']['operator_id'] = 'vid_op'; -$handler->display->display_options['filters']['vid']['expose']['label'] = 'Vocabulary'; -$handler->display->display_options['filters']['vid']['expose']['operator'] = 'vid_op'; -$handler->display->display_options['filters']['vid']['expose']['identifier'] = 'vid'; -$handler->display->display_options['filters']['vid']['expose']['remember'] = TRUE; -/* Filter criterion: Taxonomy term: Name */ -$handler->display->display_options['filters']['name']['id'] = 'name'; -$handler->display->display_options['filters']['name']['table'] = 'taxonomy_term_data'; -$handler->display->display_options['filters']['name']['field'] = 'name'; -$handler->display->display_options['filters']['name']['operator'] = 'word'; -$handler->display->display_options['filters']['name']['exposed'] = TRUE; -$handler->display->display_options['filters']['name']['expose']['operator_id'] = 'name_op'; -$handler->display->display_options['filters']['name']['expose']['label'] = 'Name'; -$handler->display->display_options['filters']['name']['expose']['operator'] = 'name_op'; -$handler->display->display_options['filters']['name']['expose']['identifier'] = 'name'; -$handler->display->display_options['filters']['name']['expose']['remember'] = TRUE; - -/* Display: System */ -$handler = $view->new_display('system', 'System', 'system_1'); -$handler->display->display_options['defaults']['hide_admin_links'] = FALSE; -$handler->display->display_options['defaults']['access'] = FALSE; -$handler->display->display_options['path'] = 'admin/structure/taxonomy/%'; -$translatables['admin_views_taxonomy_term'] = array( - t('Defaults'), - t('Terms'), - t('more'), - t('Apply'), - t('Reset'), - t('Sort by'), - t('Asc'), - t('Desc'), - t('Term'), - t('Operations'), - t('edit'), - t('.'), - t('All'), - t('Terms in %1'), - t('%1'), - t('Vocabulary'), - t('Name'), - t('System'), -); diff --git a/html/sites/all/modules/contrib/admin_views/admin_views_default/user.admin-people.inc b/html/sites/all/modules/contrib/admin_views/admin_views_default/user.admin-people.inc deleted file mode 100644 index 0860a9160..000000000 --- a/html/sites/all/modules/contrib/admin_views/admin_views_default/user.admin-people.inc +++ /dev/null @@ -1,354 +0,0 @@ -name = 'admin_views_user'; -$view->description = 'List, add, and edit users.'; -$view->tag = 'admin'; -$view->base_table = 'users'; -$view->human_name = 'Administration: Users'; -$view->core = 0; -$view->api_version = '3.0'; -$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ - -/* Display: Defaults */ -$handler = $view->new_display('default', 'Defaults', 'default'); -$handler->display->display_options['title'] = 'Users'; -$handler->display->display_options['css_class'] = 'admin-views-view'; -$handler->display->display_options['use_ajax'] = TRUE; -$handler->display->display_options['use_more_always'] = FALSE; -$handler->display->display_options['access']['type'] = 'perm'; -$handler->display->display_options['access']['perm'] = 'access administration pages'; -$handler->display->display_options['cache']['type'] = 'none'; -$handler->display->display_options['query']['type'] = 'views_query'; -$handler->display->display_options['query']['options']['query_comment'] = FALSE; -$handler->display->display_options['exposed_form']['type'] = 'basic'; -$handler->display->display_options['exposed_form']['options']['reset_button'] = TRUE; -$handler->display->display_options['pager']['type'] = 'full'; -$handler->display->display_options['pager']['options']['items_per_page'] = 50; -$handler->display->display_options['style_plugin'] = 'table'; -$handler->display->display_options['style_options']['columns'] = array( - 'views_bulk_operations' => 'views_bulk_operations', - 'name' => 'name', - 'mail' => 'name', - 'status' => 'status', - 'rid' => 'rid', - 'created' => 'created', - 'access' => 'access', - 'edit_node' => 'edit_node', - 'cancel_node' => 'edit_node', -); -$handler->display->display_options['style_options']['default'] = 'access'; -$handler->display->display_options['style_options']['info'] = array( - 'views_bulk_operations' => array( - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'name' => array( - 'sortable' => 1, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '
', - 'empty_column' => 0, - ), - 'mail' => array( - 'sortable' => 0, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'status' => array( - 'sortable' => 1, - 'default_sort_order' => 'desc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'rid' => array( - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'created' => array( - 'sortable' => 1, - 'default_sort_order' => 'desc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'access' => array( - 'sortable' => 1, - 'default_sort_order' => 'desc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - 'edit_node' => array( - 'align' => '', - 'separator' => ' ', - 'empty_column' => 0, - ), - 'cancel_node' => array( - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), -); -$handler->display->display_options['style_options']['sticky'] = TRUE; -$handler->display->display_options['style_options']['empty_table'] = TRUE; -/* No results behavior: Global: Unfiltered text */ -$handler->display->display_options['empty']['area_text_custom']['id'] = 'area_text_custom'; -$handler->display->display_options['empty']['area_text_custom']['table'] = 'views'; -$handler->display->display_options['empty']['area_text_custom']['field'] = 'area_text_custom'; -$handler->display->display_options['empty']['area_text_custom']['empty'] = TRUE; -$handler->display->display_options['empty']['area_text_custom']['content'] = 'No users available.'; -/* Field: Bulk operations: User */ -$handler->display->display_options['fields']['views_bulk_operations']['id'] = 'views_bulk_operations'; -$handler->display->display_options['fields']['views_bulk_operations']['table'] = 'users'; -$handler->display->display_options['fields']['views_bulk_operations']['field'] = 'views_bulk_operations'; -$handler->display->display_options['fields']['views_bulk_operations']['label'] = ''; -$handler->display->display_options['fields']['views_bulk_operations']['element_label_colon'] = FALSE; -$handler->display->display_options['fields']['views_bulk_operations']['hide_alter_empty'] = FALSE; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['display_type'] = '0'; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['enable_select_all_pages'] = 1; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['force_single'] = 0; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['entity_load_capacity'] = '10'; -$handler->display->display_options['fields']['views_bulk_operations']['vbo_operations'] = array( - 'action::system_block_ip_action' => array( - 'selected' => 0, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Ban IP address of the current user', - 'postpone_processing' => 0, - ), - 'action::user_block_user_action' => array( - 'selected' => 0, - 'skip_confirmation' => 1, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::views_bulk_operations_user_cancel_action' => array( - 'selected' => 1, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::views_bulk_operations_delete_item' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 1, - 'label' => 'Delete', - 'postpone_processing' => 0, - ), - 'action::views_bulk_operations_modify_action' => array( - 'selected' => 1, - 'skip_confirmation' => 1, - 'override_label' => 1, - 'label' => 'Change value', - 'settings' => array( - 'show_all_tokens' => 1, - 'display_values' => array( - '_all_' => '_all_', - ), - ), - 'postpone_processing' => 0, - ), - 'action::system_message_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::views_bulk_operations_script_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::views_bulk_operations_user_roles_action' => array( - 'selected' => 1, - 'skip_confirmation' => 0, - 'override_label' => 1, - 'label' => 'Change user roles', - 'postpone_processing' => 0, - ), - 'action::views_bulk_operations_argument_selector_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'settings' => array( - 'url' => '', - ), - ), - 'action::system_goto_action' => array( - 'selected' => 0, - 'skip_confirmation' => 0, - 'override_label' => 0, - 'label' => '', - 'postpone_processing' => 0, - ), - 'action::system_send_email_action' => array( - 'selected' => 1, - 'skip_confirmation' => 0, - 'override_label' => 1, - 'label' => 'Send e-mail', - 'postpone_processing' => 0, - ), -); -/* Field: User: Name */ -$handler->display->display_options['fields']['name']['id'] = 'name'; -$handler->display->display_options['fields']['name']['table'] = 'users'; -$handler->display->display_options['fields']['name']['field'] = 'name'; -/* Field: User: E-mail */ -$handler->display->display_options['fields']['mail']['id'] = 'mail'; -$handler->display->display_options['fields']['mail']['table'] = 'users'; -$handler->display->display_options['fields']['mail']['field'] = 'mail'; -$handler->display->display_options['fields']['mail']['label'] = ''; -$handler->display->display_options['fields']['mail']['element_label_colon'] = FALSE; -$handler->display->display_options['fields']['mail']['link_to_user'] = '0'; -/* Field: User: Active */ -$handler->display->display_options['fields']['status']['id'] = 'status'; -$handler->display->display_options['fields']['status']['table'] = 'users'; -$handler->display->display_options['fields']['status']['field'] = 'status'; -$handler->display->display_options['fields']['status']['not'] = 0; -/* Field: User: Roles */ -$handler->display->display_options['fields']['rid']['id'] = 'rid'; -$handler->display->display_options['fields']['rid']['table'] = 'users_roles'; -$handler->display->display_options['fields']['rid']['field'] = 'rid'; -$handler->display->display_options['fields']['rid']['type'] = 'ul'; -/* Field: User: Created date */ -$handler->display->display_options['fields']['created']['id'] = 'created'; -$handler->display->display_options['fields']['created']['table'] = 'users'; -$handler->display->display_options['fields']['created']['field'] = 'created'; -$handler->display->display_options['fields']['created']['label'] = 'Member for'; -$handler->display->display_options['fields']['created']['date_format'] = 'raw time ago'; -/* Field: User: Last access */ -$handler->display->display_options['fields']['access']['id'] = 'access'; -$handler->display->display_options['fields']['access']['table'] = 'users'; -$handler->display->display_options['fields']['access']['field'] = 'access'; -$handler->display->display_options['fields']['access']['date_format'] = 'time ago'; -/* Field: User: Edit link */ -$handler->display->display_options['fields']['edit_node']['id'] = 'edit_node'; -$handler->display->display_options['fields']['edit_node']['table'] = 'users'; -$handler->display->display_options['fields']['edit_node']['field'] = 'edit_node'; -$handler->display->display_options['fields']['edit_node']['label'] = 'Operations'; -/* Field: User: Cancel link */ -$handler->display->display_options['fields']['cancel_node']['id'] = 'cancel_node'; -$handler->display->display_options['fields']['cancel_node']['table'] = 'users'; -$handler->display->display_options['fields']['cancel_node']['field'] = 'cancel_node'; -$handler->display->display_options['fields']['cancel_node']['label'] = ''; -$handler->display->display_options['fields']['cancel_node']['element_label_colon'] = FALSE; -$handler->display->display_options['fields']['cancel_node']['hide_alter_empty'] = FALSE; -/* Sort criterion: User: Created date */ -$handler->display->display_options['sorts']['created']['id'] = 'created'; -$handler->display->display_options['sorts']['created']['table'] = 'users'; -$handler->display->display_options['sorts']['created']['field'] = 'created'; -$handler->display->display_options['sorts']['created']['order'] = 'DESC'; -/* Filter criterion: User: Name */ -$handler->display->display_options['filters']['uid']['id'] = 'uid'; -$handler->display->display_options['filters']['uid']['table'] = 'users'; -$handler->display->display_options['filters']['uid']['field'] = 'uid'; -$handler->display->display_options['filters']['uid']['operator'] = 'not in'; -$handler->display->display_options['filters']['uid']['value'] = array( - 0 => 0, -); -$handler->display->display_options['filters']['uid']['group'] = 1; -/* Filter criterion: User: Name (raw) */ -$handler->display->display_options['filters']['name']['id'] = 'name'; -$handler->display->display_options['filters']['name']['table'] = 'users'; -$handler->display->display_options['filters']['name']['field'] = 'name'; -$handler->display->display_options['filters']['name']['operator'] = 'contains'; -$handler->display->display_options['filters']['name']['group'] = 1; -$handler->display->display_options['filters']['name']['exposed'] = TRUE; -$handler->display->display_options['filters']['name']['expose']['operator_id'] = 'name_op'; -$handler->display->display_options['filters']['name']['expose']['label'] = 'Username'; -$handler->display->display_options['filters']['name']['expose']['operator'] = 'name_op'; -$handler->display->display_options['filters']['name']['expose']['identifier'] = 'name'; -$handler->display->display_options['filters']['name']['expose']['remember'] = TRUE; -/* Filter criterion: User: E-mail */ -$handler->display->display_options['filters']['mail']['id'] = 'mail'; -$handler->display->display_options['filters']['mail']['table'] = 'users'; -$handler->display->display_options['filters']['mail']['field'] = 'mail'; -$handler->display->display_options['filters']['mail']['operator'] = 'contains'; -$handler->display->display_options['filters']['mail']['group'] = 1; -$handler->display->display_options['filters']['mail']['exposed'] = TRUE; -$handler->display->display_options['filters']['mail']['expose']['operator_id'] = 'mail_op'; -$handler->display->display_options['filters']['mail']['expose']['label'] = 'E-mail'; -$handler->display->display_options['filters']['mail']['expose']['operator'] = 'mail_op'; -$handler->display->display_options['filters']['mail']['expose']['identifier'] = 'mail'; -$handler->display->display_options['filters']['mail']['expose']['remember'] = TRUE; -/* Filter criterion: User: Active */ -$handler->display->display_options['filters']['status']['id'] = 'status'; -$handler->display->display_options['filters']['status']['table'] = 'users'; -$handler->display->display_options['filters']['status']['field'] = 'status'; -$handler->display->display_options['filters']['status']['value'] = 'All'; -$handler->display->display_options['filters']['status']['group'] = 1; -$handler->display->display_options['filters']['status']['exposed'] = TRUE; -$handler->display->display_options['filters']['status']['expose']['operator_id'] = ''; -$handler->display->display_options['filters']['status']['expose']['label'] = 'Active'; -$handler->display->display_options['filters']['status']['expose']['operator'] = 'status_op'; -$handler->display->display_options['filters']['status']['expose']['identifier'] = 'status'; -$handler->display->display_options['filters']['status']['expose']['remember'] = TRUE; -/* Filter criterion: User: Roles */ -$handler->display->display_options['filters']['rid']['id'] = 'rid'; -$handler->display->display_options['filters']['rid']['table'] = 'users_roles'; -$handler->display->display_options['filters']['rid']['field'] = 'rid'; -$handler->display->display_options['filters']['rid']['group'] = 1; -$handler->display->display_options['filters']['rid']['exposed'] = TRUE; -$handler->display->display_options['filters']['rid']['expose']['operator_id'] = 'rid_op'; -$handler->display->display_options['filters']['rid']['expose']['label'] = 'Role'; -$handler->display->display_options['filters']['rid']['expose']['operator'] = 'rid_op'; -$handler->display->display_options['filters']['rid']['expose']['identifier'] = 'rid'; -$handler->display->display_options['filters']['rid']['expose']['remember'] = TRUE; - -/* Display: System */ -$handler = $view->new_display('system', 'System', 'system_1'); -$handler->display->display_options['defaults']['hide_admin_links'] = FALSE; -$handler->display->display_options['hide_admin_links'] = TRUE; -$handler->display->display_options['defaults']['access'] = FALSE; -$handler->display->display_options['path'] = 'admin/people'; -$translatables['admin_views_user'] = array( - t('Defaults'), - t('Users'), - t('more'), - t('Apply'), - t('Reset'), - t('Sort by'), - t('Asc'), - t('Desc'), - t('Items per page'), - t('- All -'), - t('Offset'), - t('« first'), - t('‹ previous'), - t('next ›'), - t('last »'), - t('No users available.'), - t('- Choose an operation -'), - t('Ban IP address of the current user'), - t('Delete'), - t('Change value'), - t('Change user roles'), - t('Send e-mail'), - t('Name'), - t('Active'), - t('Roles'), - t('Member for'), - t('Last access'), - t('Operations'), - t('Username'), - t('E-mail'), - t('Role'), - t('System'), -); diff --git a/html/sites/all/modules/contrib/admin_views/admin_views_system_display.css b/html/sites/all/modules/contrib/admin_views/admin_views_system_display.css deleted file mode 100644 index fc88e2bce..000000000 --- a/html/sites/all/modules/contrib/admin_views/admin_views_system_display.css +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @file - * Custom CSS for the admin_views_system_display module. - */ - -.admin-views-view .views-exposed-form .form-text { - width: 10em; -} - -.admin-views-view .views-exposed-form .views-widget input { - width: 100%; -} - -.admin-views-view .views-exposed-form .views-submit-button, -.admin-views-view .views-exposed-form .views-reset-button { - padding-right: 0; -} - -.admin-views-view .form-item-operation { - float: left; - margin-top: 0; - margin-bottom: 0; - margin-right: 1em; -} diff --git a/html/sites/all/modules/contrib/admin_views/admin_views_system_display.info b/html/sites/all/modules/contrib/admin_views/admin_views_system_display.info deleted file mode 100644 index d83f98b2f..000000000 --- a/html/sites/all/modules/contrib/admin_views/admin_views_system_display.info +++ /dev/null @@ -1,14 +0,0 @@ -name = Admin Views System Display -description = Custom Views display plugin for overriding system pages. -package = Views -core = 7.x -dependencies[] = views - -files[] = plugins/views_plugin_access_menu.inc -files[] = plugins/views_plugin_display_system.inc - -; Information added by Drupal.org packaging script on 2021-09-09 -version = "7.x-1.8" -core = "7.x" -project = "admin_views" -datestamp = "1631191208" diff --git a/html/sites/all/modules/contrib/admin_views/admin_views_system_display.install b/html/sites/all/modules/contrib/admin_views/admin_views_system_display.install deleted file mode 100644 index 077749d62..000000000 --- a/html/sites/all/modules/contrib/admin_views/admin_views_system_display.install +++ /dev/null @@ -1,15 +0,0 @@ - 3, - ); -} - -/** - * Implements hook_help(). - */ -function admin_views_system_display_help($path, $arg) { - switch ($path) { - case 'admin/help#admin_views_system_display': - return t('This adds a new page display plugin for Views that allows system pages provided by Drupal core to be overridden. This is used by the Admin Views module to replace some of the Drupal core admin pages.'); - } -} - -/** - * Implements hook_permission(). - */ -function admin_views_system_display_permission() { - return array( - 'use admin views system display ajax pages' => array( - 'title' => t('Use ajax pages on Administration Views System Display'), - ), - ); -} - -/** - * Implements hook_form_FORM_ID_alter(). - */ -function admin_views_system_display_form_views_ui_edit_form_alter(&$form, &$form_state) { - array_unshift($form['actions']['save']['#validate'], '_admin_views_system_display_form_views_ui_edit_form_validate'); -} - -/** - * Custom validation function when Views UI edit form is submitted. - */ -function _admin_views_system_display_form_views_ui_edit_form_validate(&$form, &$form_state) { - if (isset($form_state['view'])) { - // Retrieve system paths on the current view. - $system_paths = admin_views_system_display_system_paths($form_state['view']); - // If system paths exist, check if any duplicates. - if (!empty($system_paths)) { - $duplicate_paths = array(); - foreach ($system_paths as $path => $path_views) { - foreach ($path_views as $path_view) { - foreach ($path_view as $view_name => $view_display) { - $system_view[$path] = array($view_name => $view_display); - if (admin_views_system_display_duplicate_path($system_view)) { - $duplicate_paths[] = $path; - } - } - } - } - // If any duplicates, display error message. - if (!empty($duplicate_paths)) { - form_set_error('', t('Paths are already in use by other system views: !path. Enter a different path, or modify, disable, or delete the conflicting views.', array( - '!path' => implode(', ', $duplicate_paths)))); - } - } - } -} - -/** - * Paths for enabled system views. - * - * @param object $view - * (optional) A view to be checked for system view displays. If not - * included, all views are checked. - * - * @return array - * An array of system paths, including view name and view display. - */ -function admin_views_system_display_system_paths($view = NULL) { - $system_paths = array(); - if ($view == NULL) { - $views = views_get_all_views(); - } - else { - $views[] = $view; - } - foreach ($views as $view) { - if ($view->disabled) { - continue; - } - foreach ($view->display as $display => $settings) { - if (isset($settings->display_plugin) && $settings->display_plugin == 'system' && isset($settings->display_options['path'])) { - $system_paths[$settings->display_options['path']][] = array($view->name => $display); - } - } - } - return $system_paths; -} - -/** - * Determine if there are duplicate views system paths. - * - * @param array $view - * Array including a system path, and the view name and display where it is - * located. - * - * @return boolean - * Duplicate path exists other than current view name/display combination. - */ -function admin_views_system_display_duplicate_path(array $view) { - $system_paths = admin_views_system_display_system_paths(); - $view_path = key($view); - if (!isset($system_paths[$view_path])) { - return FALSE; - } - $view_name = key($view[$view_path]); - $view_display = $view[$view_path][$view_name]; - foreach ($system_paths[$view_path] as $system_views) { - foreach ($system_views as $system_view_name => $system_view_display) { - if (!($system_view_name == $view_name && $system_view_display == $view_display)) { - return TRUE; - } - } - } - - return FALSE; -} diff --git a/html/sites/all/modules/contrib/admin_views/plugins/views_plugin_access_menu.inc b/html/sites/all/modules/contrib/admin_views/plugins/views_plugin_access_menu.inc deleted file mode 100644 index 127da181e..000000000 --- a/html/sites/all/modules/contrib/admin_views/plugins/views_plugin_access_menu.inc +++ /dev/null @@ -1,29 +0,0 @@ - '', - ); - - // Override the access plugin to always enforce views_plugin_access_menu. - // The UI widget for configuring access is additionally hidden. - // @see options_summary() - $options['defaults']['default']['access'] = FALSE; - $options['access'] = array( - // This isn't actually used, but we set it to a reasonable value, in case - // this gets cloned to a display of a different type. - 'default' => array( - 'type' => 'perm', - 'perm' => 'use admin views system display ajax pages', - ), - ); - - return $options; - } - - /** - * Overrides views_plugin_display::options_summary(). - */ - function options_summary(&$categories, &$options) { - parent::options_summary($categories, $options); - - $categories['system'] = array( - 'title' => t('System path settings'), - ); - - // Disable the access plugin configuration in the UI. - // @see option_definition() - $categories['access']['build']['#access'] = FALSE; - - $path = strip_tags('/' . $this->get_option('path')); - if (empty($path)) { - $path = t('None'); - } - - $options['path'] = array( - 'category' => 'system', - 'title' => t('Path'), - 'value' => views_ui_truncate($path, 24), - ); - } - - /** - * Overrides views_plugin_display::options_form(). - */ - function options_form(&$form, &$form_state) { - parent::options_form($form, $form_state); - - switch ($form_state['section']) { - case 'path': - $form['#title'] .= t('An existing menu path this view replaces'); - $form['path'] = array( - '#type' => 'textfield', - '#description' => t('This view replaces this path on your site. You may use "%" in your URL to represent values that will be used for contextual filters. For example: "node/%/feed". The path must not be used by another enabled system view, otherwise conflicts will occur and user_access() notices displayed.'), - '#default_value' => $this->get_option('path'), - '#field_prefix' => '' . url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), - '#field_suffix' => '‎', - '#attributes' => array('dir' => 'ltr'), - ); - break; - } - } - - /** - * Overrides views_plugin_display::options_validate(). - */ - function options_validate(&$form, &$form_state) { - parent::options_validate($form, $form_state); - - switch ($form_state['section']) { - case 'path': - if (strpos($form_state['values']['path'], '$arg') !== FALSE) { - form_error($form['path'], t('"$arg" is no longer supported. Use % instead.')); - } - - if (strpos($form_state['values']['path'], '%') === 0) { - form_error($form['path'], t('"%" may not be used for the first segment of a path.')); - } - // Automatically remove '/' from path. - $form_state['values']['path'] = trim($form_state['values']['path'], '/'); - - $system_view[$form_state['values']['path']] = array($this->view->name => $this->view->current_display); - if (admin_views_system_display_duplicate_path($system_view)) { - form_error($form['path'], t('Already used by another system view. Enter a different path.')); - } - break; - } - } - - /** - * Overrides views_plugin_display::options_submit(). - */ - function options_submit(&$form, &$form_state) { - parent::options_submit($form, $form_state); - - switch ($form_state['section']) { - case 'path': - $this->set_option('path', $form_state['values']['path']); - break; - } - } - - /** - * Add this display's path information to Drupal's menu system. - * - * @param array $callbacks - * All existing menu router items defined by modules. Taken by reference, in - * order to adjust any possibly existing child router items of the replaced - * system path. (This method only returns new router items normally.) - */ - function execute_hook_menu(&$callbacks) { - $items = array(); - - // Replace % with the link to our standard views argument loader - // views_arg_load(). - $bits = explode('/', $this->get_option('path')); - $page_arguments = array($this->view->name, $this->display->id); - $this->view->init_handlers(); - $view_arguments = $this->view->argument; - - // Replace % with %views_arg for menu autoloading and add to the - // page arguments so the argument actually comes through. - foreach ($bits as $pos => $bit) { - if ($bit == '%') { - $argument = array_shift($view_arguments); - if (!empty($argument->options['specify_validation']) && $argument->options['validate']['type'] != 'none') { - $bits[$pos] = '%views_arg'; - } - $page_arguments[] = $pos; - } - } - - $path = implode('/', $bits); - if (!$path) { - return $items; - } - - // Only existing system paths can be replaced. - if (!isset($callbacks[$path])) { - // However, if the specified path contains dynamic argument placeholders, - // then we need to search more carefully. - $views_path = $this->get_option('path'); - if (strpos($views_path, '%') !== FALSE) { - $views_path = preg_quote($views_path, '@'); - $views_path = strtr($views_path, array('%' => '%[^/]*')); - $result = preg_grep('@^' . $views_path . '$@', array_keys($callbacks)); - if ($result) { - $parent_path = reset($result); - $parent = &$callbacks[$parent_path]; - } - else { - return $items; - } - } - // No dynamic placeholders found, so nothing can be replaced. - else { - return $items; - } - } - else { - $parent = &$callbacks[$path]; - } - - // Work out whether we need to get the access callback and arguments from - // the parent item. - $default_map = array( - 'access callback' => 'user_access', - 'access arguments' => array(), - ); - - foreach ($default_map as $menu_key => &$default) { - // Override the default if we can. Otherwise this will use the defaults - // above. - if (!empty($callbacks[$path][$menu_key])) { - $default = $callbacks[$path][$menu_key]; - } - elseif (!empty($parent[$menu_key])) { - $default = $parent[$menu_key]; - } - } - - $items[$path] = array( - // default views page entry - 'page callback' => 'views_page', - 'page arguments' => $page_arguments, - // Take over the access definition from the original router item. - // @see option_definition() - // @see views_plugin_access_menu - 'access callback' => $default_map['access callback'], - 'access arguments' => $default_map['access arguments'], - // Identify URL embedded arguments and correlate them to a handler - 'load arguments' => array($this->view->name, $this->display->id, '%index'), - ); - - // List of router item default property values, which are inherited to - // children. These default values are only applied if the original parent - // item does not define them (see below). - // @see _menu_router_build() - $defaults = array( - 'access callback' => 'user_access', - 'menu_name' => NULL, - 'file' => NULL, - 'file path' => NULL, - 'delivery callback' => NULL, - 'theme callback' => NULL, - 'theme arguments' => array(), - ); - - // Grep all router items below the target path. - $num_parent_parts = count(explode('/', $path)); - $children = preg_grep('@^' . preg_quote($path, '@') . '/@', array_keys($callbacks)); - - // Ensure correct inheritance of properties on the original parent path - // (being replaced) to child items. - foreach ($children as $child_path) { - // Only apply property inheritance to direct children of the parent path. - $num_child_parts = count(explode('/', $child_path)); - if ($num_parent_parts == $num_child_parts - 1) { - // Check if the child router item is a views page. If so, there are - // default properties we do not want this item to inherit. - if (isset($callbacks[$child_path]['page callback']) && ($callbacks[$child_path]['page callback'] === 'views_page')) { - continue; - } - $child = &$callbacks[$child_path]; - // Get these first, as we want to know if they existed before parent and - // default values are merged. - $file = isset($child['file']); - $access_callback = isset($child['access callback']); - // Copy all properties from the original parent that will be replaced - // with new values. - // This typically resets 'access arguments', etc. - $child += array_intersect_key($parent, $items[$path]); - // Copy all properties from the original parent, for which the router - // system would inherit parent values or fill in default values. - // This typically adds back 'file' and other properties defined on the - // parent but not on $items[$path]. (The two operations could be - // combined with $items[$path] + $defaults, but are separated for - // documentation purposes and clarity.) - $child += array_intersect_key($parent, $defaults); - // Unset the child 'file' property if its implementing module doesn't - // match it's parent and it didn't have a 'file' preoperty specified - // before. Otherwise, for example, example_module could inherit a 'file' - // property of 'node.admin.inc', so the actual include path would be - // something like .../modules/example_module/node.admin.inc. - if (!$file && isset($child['module'], $parent['module']) && ($child['module'] != $parent['module'])) { - unset($child['file']); - } - // The access callback should only be inherited for default local tasks. - // Ensure it hasn't been mistakenly set. - if (!$access_callback && (!isset($child['type']) || $child['type'] != MENU_DEFAULT_LOCAL_TASK)) { - unset($child['access callback']); - } - // Last catch-22, insert new default properties and their default values - // for the child, which may not be defined on the original parent. - // This typically inserts 'access callback', which can be omitted in - // router item definitions and only gets a default of user_access() in - // the final _menu_router_build(). Without this, the new access callback - // views_access() in $items[$path] would be inherited to all children. - $child += $defaults; - } - } - - // If the original parent path already existed, copy over its remaining - // properties. - $items[$path] += $parent; - - return $items; - } - - /** - * Overrides views_plugin_display::execute(). - * - * Build and render the page view. - * - * Since we replace an existing page, we need to invoke views_set_page_view(). - * Also set the page title, because original page callbacks might do this. - */ - function execute() { - // Let the world know that this is the page view we're using. - views_set_page_view($this->view); - - // Prior to this being called, the $view should already be set to this - // display, and arguments should be set on the view. - $this->view->build(); - if (!empty($this->view->build_info['fail'])) { - return drupal_not_found(); - } - - if (!empty($this->view->build_info['denied'])) { - return drupal_access_denied(); - } - - drupal_add_css(drupal_get_path('module', 'admin_views_system_display') . '/admin_views_system_display.css'); - - return $this->view->render(); - } - - /** - * Overrides views_plugin_display::get_argument_text(). - */ - function get_argument_text() { - return array( - 'filter value not present' => t('When the filter value is NOT in the URL'), - 'filter value present' => t('When the filter value IS in the URL or a default is provided'), - 'description' => t('The contextual filter values is provided by the URL.'), - ); - } -} diff --git a/html/sites/all/modules/contrib/admin_views/tests/admin_views.test b/html/sites/all/modules/contrib/admin_views/tests/admin_views.test deleted file mode 100644 index 97d76771c..000000000 --- a/html/sites/all/modules/contrib/admin_views/tests/admin_views.test +++ /dev/null @@ -1,423 +0,0 @@ - array('administer users', 'administer permissions'), - 'node' => array('access content overview'), - 'comment' => array('administer comments'), - 'taxonomy' => array('administer taxonomy'), - ); - - /** - * {@inheritdoc} - */ - public function setUp(array $modules = array()) { - // Setup site and modules. - $modules[] = 'admin_views_system_display'; - $modules[] = 'admin_views'; - parent::setUp($modules); - - // Fix testing environment. - theme_enable(array('stark')); - variable_set('theme_default', 'stark'); - - // Setup permissions. - $permissions = array( - 'access administration pages', - ); - foreach ($this->permissionMap as $module => $module_permissions) { - if (module_exists($module)) { - $permissions = array_merge($permissions, $module_permissions); - } - } - $this->admin_user = $this->drupalCreateUser($permissions); - - // Setup default configuration. - if (in_array('node', $modules)) { - $this->node_type = $this->drupalCreateContentType(array( - 'type' => 'article', - 'name' => 'Article', - // 2 == COMMENT_NODE_OPEN. - 'comment' => 2, - )); - } - if (in_array('comment', $modules)) { - variable_set('comment_preview_article', DRUPAL_OPTIONAL); - } - } - - /** - * Log in as user 1. - */ - protected function loginUser1() { - $password = user_password(); - // Reset the user 1 password. - $account = user_load(1); - $edit = array( - 'pass' => $password, - ); - $account = user_save($account, $edit); - $account->pass_raw = $password; - - // Log in as user 1. - $this->drupalLogin($account); - } - - protected function assertOriginalRouterItem($module, $path) { - // Retrieve the original router item definition. - $items = module_invoke($module, 'menu'); - $original_item = $items[$path]; - // Retrieve the computed router item definition. - $item = menu_get_item($path); - - // Verify that basic properties are identical. - $title = (isset($original_item['title callback']) ? $original_item['title callback']() : $original_item['title']); - $this->assertEqual($title, $item['title']); - if (isset($original_item['description'])) { - $this->assertEqual($original_item['description'], $item['description']); - } - - // Verify that the title appears. - $this->assertResponse(200); - $this->assertText($original_item['title']); - } - -} - -/** - * Tests System display functionality. - */ -class AdminViewsSystemDisplayTestCase extends AdminViewsWebTestCase { - - /** - * Define this test class. - * - * @return array - * The test's meta data. - */ - public static function getInfo() { - return array( - 'name' => 'Views System display plugin', - 'description' => 'Tests Views System display plugin functionality.', - 'group' => 'Administration views', - ); - } - - /** - * {@inheritdoc} - */ - public function setUp(array $modules = array()) { - $modules[] = 'node'; - $modules[] = 'comment'; - $modules[] = 'admin_views_test'; - parent::setUp($modules); - } - - /** - * Tests proper inheritance of router item properties. - */ - public function testRouterItemInheritance() { - $this->drupalLogin($this->admin_user); - $path = 'admin/people'; - $out = $this->drupalGet($path); - $this->assertOriginalRouterItem('user', $path); - - // Verify that local tasks and actions exist and can be accessed. - foreach (array(t('List'), t('Permissions'), t('Add user')) as $link) { - $this->drupalSetContent($out); - $this->assertLink($link); - $this->clickLink($link); - $this->assertResponse(200); - } - - // Test that child page callbacks of a system display work. - $this->drupalGet('admin/content/admin_views_test'); - $this->assertResponse(200); - $this->assertTitle('Administration views test | Drupal'); - $this->assertText('Administration views test page callback'); - } - -} - -/** - * Tests default views. - */ -class AdminViewsDefaultViewsTestCase extends AdminViewsWebTestCase { - - /** - * Define this test class. - * - * @return array - * The test's meta data. - */ - public static function getInfo() { - return array( - 'name' => 'Default views', - 'description' => 'Tests default views.', - 'group' => 'Administration views', - ); - } - - /** - * {@inheritdoc} - */ - public function setUp(array $modules = array()) { - $modules[] = 'node'; - $modules[] = 'comment'; - parent::setUp($modules); - } - - /** - * Tests basic appearance and behavior of built-in default views. - */ - public function testComment() { - $this->drupalLogin($this->admin_user); - - foreach (array('admin/content/comment', 'admin/content/comment/approval') as $path) { - $this->drupalGet($path); - $this->assertOriginalRouterItem('comment', $path); - - // Verify that a view with its exposed filters appears. - $this->assertFieldByName('subject'); - $this->assertFieldByName('author'); - $this->assertFieldByName('nodeTitle'); - $this->assertFieldByName('status'); - $this->assertFieldByXPath('//select[@name="status"]/option', 'All', 'Published: All option found.'); - $this->assertFieldByXPath('//select[@name="status"]/option', '1', 'Published: Yes option found.'); - $this->assertFieldByXPath('//select[@name="status"]/option', '0', 'Published: No option found.'); - $this->assertFieldByXPath('//input[@type="submit"]', t('Apply'), 'Apply button found.'); - $this->assertFieldByXPath('//input[@type="submit"]', t('Reset'), 'Reset button found.'); - } - } - -} - -/** - * Tests system child page display functionality. - * - * This is important, as any other page view menu items that are children of a - * system view can otherwise inherit item properties they don't want. - */ -class AdminViewsPageDisplayTestCase extends AdminViewsWebTestCase { - - /** - * Define this test class. - * - * @return array - * The test's meta data. - */ - public static function getInfo() { - return array( - 'name' => 'Views Page display plugin', - 'description' => 'Tests views page functionality for children of system plugins.', - 'group' => 'Administration views', - ); - } - - /** - * {@inheritdoc} - */ - public function setUp(array $modules = array()) { - $modules[] = 'node'; - parent::setUp($modules); - - // Save the test page view. - $this->normalPageView()->save(); - - // Reset views static cache. - views_get_view('admin_views_test_normal', TRUE); - - // Rebuild the menu. - // views_invalidate_cache only sets the rebuild variable. - menu_rebuild(); - } - - /** - * Tests creation of a view page display that is a child of "admin/content". - */ - public function testAddPageViewAdminContent() { - $this->drupalLogin($this->admin_user); - - // Test the child view exists by checking for the page title. - $this->drupalGet('admin/content/test'); - $this->assertText('admin_views_test_normal'); - } - - /** - * Returns a test page view with a path under "admin/content". - */ - protected function normalPageView() { - views_include('view'); - $view = new view(); - $view->name = 'admin_views_test_normal'; - $view->description = ''; - $view->tag = 'default'; - $view->base_table = 'node'; - $view->human_name = 'admin_views_test_normal'; - $view->core = 7; - $view->api_version = '3.0'; - $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ - - /* Display: Master */ - $handler = $view->new_display('default', 'Master', 'default'); - $handler->display->display_options['title'] = 'admin_views_test_normal'; - $handler->display->display_options['use_more_always'] = FALSE; - $handler->display->display_options['access']['type'] = 'perm'; - $handler->display->display_options['cache']['type'] = 'none'; - $handler->display->display_options['query']['type'] = 'views_query'; - $handler->display->display_options['exposed_form']['type'] = 'basic'; - $handler->display->display_options['pager']['type'] = 'full'; - $handler->display->display_options['pager']['options']['items_per_page'] = '10'; - $handler->display->display_options['style_plugin'] = 'default'; - $handler->display->display_options['row_plugin'] = 'node'; - /* Field: Content: Title */ - $handler->display->display_options['fields']['title']['id'] = 'title'; - $handler->display->display_options['fields']['title']['table'] = 'node'; - $handler->display->display_options['fields']['title']['field'] = 'title'; - $handler->display->display_options['fields']['title']['label'] = ''; - $handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE; - $handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE; - /* Sort criterion: Content: Post date */ - $handler->display->display_options['sorts']['created']['id'] = 'created'; - $handler->display->display_options['sorts']['created']['table'] = 'node'; - $handler->display->display_options['sorts']['created']['field'] = 'created'; - $handler->display->display_options['sorts']['created']['order'] = 'DESC'; - /* Filter criterion: Content: Published */ - $handler->display->display_options['filters']['status']['id'] = 'status'; - $handler->display->display_options['filters']['status']['table'] = 'node'; - $handler->display->display_options['filters']['status']['field'] = 'status'; - $handler->display->display_options['filters']['status']['value'] = 1; - $handler->display->display_options['filters']['status']['group'] = 1; - $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; - - /* Display: Page */ - $handler = $view->new_display('page', 'Page', 'page'); - $handler->display->display_options['defaults']['hide_admin_links'] = FALSE; - $handler->display->display_options['path'] = 'admin/content/test'; - - return $view; - } - -} - -/** - * Tests default views. - */ -class AdminViewsAccessHandlerTestCase extends AdminViewsWebTestCase { - - /** - * Define this test class. - * - * @return array - * The test's meta data. - */ - public static function getInfo() { - return array( - 'name' => 'Access handler', - 'description' => 'Tests views_plugin_access_menu handler.', - 'group' => 'Administration views', - ); - } - - /** - * {@inheritdoc} - */ - public function setUp(array $modules = array()) { - $modules[] = 'node'; - parent::setUp($modules); - } - - /** - * Tests access handler via views/ajax. - */ - public function testAjaxAccess() { - $params = array( - 'view_name' => 'admin_views_user', - 'view_display_id' => 'system_1', - ); - $response_data = $this->drupalGetAJAX('views/ajax', array('query' => $params)); - - $this->assertResponse(200); - // Check no views settings are returned. - $this->assertTrue(empty($response_data[0]['settings']['views'])); - // The next item in the AJAX data will be the insert command containing the - // rendered view. - $this->assertTrue(empty($response_data[1])); - - // Test the access again with the default display. - $params['views_display_id'] = 'default'; - - $response_data = $this->drupalGetAJAX('views/ajax', array('query' => $params)); - - $this->assertResponse(200); - // Check no views settings are returned. - $this->assertTrue(empty($response_data[0]['settings']['views'])); - // The next item in the AJAX data will be the insert command containing the - // rendered view. - $this->assertTrue(empty($response_data[1])); - } - -} - -/** - * Tests the bundled node admin page. - */ -class AdminViewsNodeAdminTestCase extends AdminViewsWebTestCase { - - /** - * Define this test class. - * - * @return array - * The test's meta data. - */ - public static function getInfo() { - return array( - 'name' => 'Node admin', - 'description' => 'Tests the bundled node admin page.', - 'group' => 'Administration views', - ); - } - - /** - * {@inheritdoc} - */ - public function setUp(array $modules = array()) { - $modules[] = 'node'; - $modules[] = 'taxonomy'; - parent::setUp($modules); - - // Log in as user 1, so permissions won't matter. - $this->loginUser1(); - - // Create some sample content. - for ($x = 0; $x <= 50; $x++) { - $this->drupalCreateNode(array( - 'type' => 'article', - )); - } - } - - /** - * Tests the node admin page. - */ - public function testAdminPage() { - $this->drupalGet('admin/content'); - $this->assertResponse(200); - $this->assertRaw('view-admin-views-node'); - $this->assertRaw('view-id-admin_views_node'); - $this->assertRaw('view-display-id-system_1'); - $this->assertRaw('admin-views-view'); - $this->assertRaw('id="views-exposed-form-admin-views-node-system-1"'); - } - -} diff --git a/html/sites/all/modules/contrib/admin_views/tests/admin_views_test/admin_views_test.info b/html/sites/all/modules/contrib/admin_views/tests/admin_views_test/admin_views_test.info deleted file mode 100644 index 6713062cb..000000000 --- a/html/sites/all/modules/contrib/admin_views/tests/admin_views_test/admin_views_test.info +++ /dev/null @@ -1,13 +0,0 @@ -name = Administration views test -description = Administration views test module -core = 7.x -package = administration -hidden = TRUE - -dependencies[] = admin_views - -; Information added by Drupal.org packaging script on 2021-09-09 -version = "7.x-1.8" -core = "7.x" -project = "admin_views" -datestamp = "1631191208" diff --git a/html/sites/all/modules/contrib/admin_views/tests/admin_views_test/admin_views_test.module b/html/sites/all/modules/contrib/admin_views/tests/admin_views_test/admin_views_test.module deleted file mode 100644 index 6f83cc9d6..000000000 --- a/html/sites/all/modules/contrib/admin_views/tests/admin_views_test/admin_views_test.module +++ /dev/null @@ -1,29 +0,0 @@ - 'Administration views test', - 'description' => 'Administration views test', - 'page callback' => 'admin_views_test_page_callback', - 'access callback' => TRUE, - ); - - return $items; -} - -/** - * Test page callback. - */ -function admin_views_test_page_callback() { - return 'Administration views test page callback'; -} diff --git a/html/sites/all/modules/contrib/advagg/LICENSE.txt b/html/sites/all/modules/contrib/advagg/LICENSE.txt deleted file mode 100644 index d159169d1..000000000 --- a/html/sites/all/modules/contrib/advagg/LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/html/sites/all/modules/contrib/advagg/README.md b/html/sites/all/modules/contrib/advagg/README.md deleted file mode 100644 index 8740c676c..000000000 --- a/html/sites/all/modules/contrib/advagg/README.md +++ /dev/null @@ -1,806 +0,0 @@ - -ADVANCED CSS/JS AGGREGATION MODULE -================================== - - -CONTENTS OF THIS FILE ---------------------- - - - Introduction - - Requirements - - Recommended modules - - Installation - - How to get a high PageSpeed score - - JSMin PHP Extension - - Brotli PHP Extension - - Zopfli PHP Extension - - nginx Configuration - - JavaScript Bookmarklet - - Troubleshooting - - Features & benefits - - Configuration - - Additional options for `drupal_add_css/js` functions - - Technical Details & Hooks - - -INTRODUCTION ------------- - -The Advanced CSS/JS Aggregation allows you to improve the frontend performance -of your site. Be sure to do a before and after comparison by using Google's -PageSpeed Insights and WebPagetest.org. -https://developers.google.com/speed/pagespeed/insights/ -http://www.webpagetest.org/easy - - -REQUIREMENTS ------------- - -No special requirements. - - -RECOMMENDED MODULES -------------------- - - - Libraries (https://www.drupal.org/project/libraries) - Allows for 3rd party code for minification to be used by AdvAgg. - - -INSTALLATION ------------- - - - Install as you would normally install a contributed Drupal module. Visit: - https://drupal.org/documentation/install/modules-themes/modules-7 - for further information. - - -HOW TO GET A HIGH PAGESPEED SCORE ---------------------------------- - -Be sure to check the site after every section to make sure the change didn't -mess up your site. The changes under AdvAgg Modifier are usually the most -problematic but they offer the biggest improvements. - -#### Advanced CSS/JS Aggregation #### -Go to `admin/config/development/performance/advagg` - -Select "Use recommended (optimized) settings" - -#### AdvAgg Compress Javascript #### -Install AdvAgg Compress Javascript if not enabled and go to -`admin/config/development/performance/advagg/js-compress` - - - Select JSMin if available; otherwise select JSMin+ - - Select Strip everything (smallest files) - - Save configuration - - Click the batch compress link to process these files at the top. - -#### AdvAgg Async Font Loader #### -Install AdvAgg Async Font Loader if not enabled and go to -`admin/config/development/performance/advagg/font` - - - Select Local file included in aggregate (version: X.X.X). If this option is - not available follow the directions right below the options on how to install - it. - -Keep the 2 checkboxes checked. - -#### AdvAgg Bundler #### -Install AdvAgg Bundler if not enabled and go to -`admin/config/development/performance/advagg/bundler` - -If your server supports HTTP 2 then select "Use HTTP 2.0 settings"; otherwise -leave it at the "Use HTTP 1.1 settings". - -#### AdvAgg Relocate #### -Install AdvAgg Relocate if not enabled and go to -`admin/config/development/performance/advagg/relocate` - -Select "Use recommended (optimized) settings" - -#### AdvAgg Modifier #### -Install AdvAgg Modifier if not enabled and go to -`admin/config/development/performance/advagg/mod` - -Select "Use recommended (optimized) settings" - -#### AdvAgg Critical CSS module #### -Install AdvAgg Critical CSS if not enabled and go to -`admin/config/development/performance/advagg/critical-css` - -These are the directions for the front page of your site. - -Under Add Critical CSS -- Select the theme that is your front page; usually the default is correct. -- User type should be set to 'anonymous' under most circumstances. -- Type of lookup, select URL -- Value to lookup, type in `` -- Critical CSS, paste in the generated CSS from running your homepage url -through https://www.sitelocity.com/critical-path-css-generator which is inside -of the 'Critical Path CSS' textarea on the sitelocity page. -- Click Save Configuration. - -Other landing pages should have their critical CSS added as well. If you have -Google Analytics this will show you how to find your top landing pages -https://developers.google.com/analytics/devguides/reporting/core/v3/common-queries#top-landing-pages -or for Piwik https://piwik.org/faq/how-to/faq_160/. You can also use this -chrome browser plugin to generate critical CSS -https://chrome.google.com/webstore/detail/critical-style-snapshot/gkoeffcejdhhojognlonafnijfkcepob?hl=en - - -JSMIN PHP EXTENSION -------------------- - -The AdvAgg JS Compress module can take advantage of jsmin.c. JavaScript parsing -and minimizing will be done in C instead of PHP dramatically speeding up the -process. If using PHP 5.3.10 or higher https://github.com/sqmk/pecl-jsmin is -recommended. If using PHP 5.3.9 or lower -http://www.ypass.net/software/php_jsmin/ is recommended. - - -BROTLI PHP EXTENSION --------------------- - -The AdvAgg module can take advantage of Brotli compression. Install this -extension to take advantage of it. Should reduce CSS/JS files by 20%. -https://github.com/kjdev/php-ext-brotli - - -ZOPFLI PHP EXTENSION --------------------- - -The AdvAgg module can take advantage of the Zopfli compression algorithm. -Install this extension to take advantage of it. This gives higher gzip -compression ratios compared to stock PHP. -https://github.com/kjdev/php-ext-zopfli - - -NGINX CONFIGURATION -------------------- - -https://drupal.org/node/1116618 -Note that @drupal (last line of code below) might be @rewrite or @rewrites -depending on your servers configuration. If there are image style rules in your -Nginx configuration add this right below that. If you want to have brotli -support https://github.com/google/ngx_brotli is how to install that; add -`brotli_static on;` right above `gzip_static on;` in the configuration below. - - ### - ### advagg_css and advagg_js support - ### - location ~* files/advagg_(?:css|js)/ { - gzip_static on; - access_log off; - expires max; - add_header ETag ""; - add_header Cache-Control "max-age=31449600, no-transform, public"; - try_files $uri $uri/ @drupal; - } - -Also noted that some ready made nginx configurations add in a Last-Modified -header inside the advagg directories. These should be removed. - - -JAVASCRIPT BOOKMARKLET ----------------------- - -You can use this JS code as a bookmarklet for toggling the AdvAgg URL parameter. -See http://en.wikipedia.org/wiki/Bookmarklet for more details. - - javascript:(function(){var loc = document.location.href,qs = document.location.search,regex_off = /\&?advagg=-1/,goto = loc;if(qs.match(regex_off)) {goto = loc.replace(regex_off, '');} else {qs = qs ? qs + '&advagg=-1' : '?advagg=-1';goto = document.location.pathname + qs;}window.location = goto;})(); - - -TROUBLESHOOTING ---------------- - -If the core Fast 404 Pages functionality is enabled via settings.php, the -settings must be changed in order for the on-demand file compilation to work. -Change this: - - $conf['404_fast_paths_exclude'] = '/\/(?:styles)\//'; - -to this: - - $conf['404_fast_paths_exclude'] = '/\/(?:styles|advagg_(cs|j)s)\//'; - -Similarly, if the Fast_404 module is enabled, the 'fast_404_string_whitelisting' -variable must be set inside of settings.php. Add this to your settings.php file: - - $conf['fast_404_string_whitelisting'][] = '/advagg_'; - - -Modules like the Central Authentication Services https://drupal.org/project/cas -will redirect all anonymous requests to a login page. Most of the time there is -a setting that allows certain pages to be excluded from the redirect. You should -add the following to those exclusions. Note that sites/default/files is the -location of you public file system (public://) so you might have to adjust this -to fit your setup. services/* is the default (`CAS_EXCLUDE`) and -`httprl_async_function_callback` is needed if httprl will be used. - - services/* - sites/default/files/advagg_css/* - sites/default/files/advagg_js/* - httprl_async_function_callback - -In the example of CAS this setting can be found on the `admin/config/people/cas` -page and under Redirection there should be a setting called "Excluded Pages". - - -If Far-Future headers are not being sent out and you are using Apache here are -some tips to hopefully get it working. For Apache enable `mod_rewrite`, -`mod_headers`, and `mod_expires`. Add the following code to the bottom of -Drupal's core .htaccess file (located at the webroot level). - - - # No mod_headers. Apache module headers is not enabled. - - # No mod_expires. Apache module expires is not enabled. - - # Use ETags. - FileETag MTime Size - - - - # Use Expires Directive if apache module expires is enabled. - - # Do not use ETags. - FileETag None - # Enable expirations. - ExpiresActive On - # Cache all aggregated css/js files for 52 weeks after access (A). - ExpiresDefault A31449600 - - - # Use Headers Directive if apache module headers is enabled. - - # Do not use etags for cache validation. - Header unset ETag - - # Set a far future Cache-Control header to 52 weeks. - Header set Cache-Control "max-age=31449600, no-transform, public" - - - Header append Cache-Control "no-transform, public" - - - - # Force advagg .js file to have the type of application/javascript. - - ForceType application/javascript - - - -If pages on the site stop working correctly or looks broken after Advanced -CSS/JS Aggregation is enabled, the first step should be to validate the -individual CSS and/or JS files using the included `advagg_validator` module - -something as simple as an errant unfinished comment in one file may cause entire -aggregates of files to be ignored. - - -If AdvAgg was installed via drush sometimes directory permissions need to be -fixed. Using `chown -R` on the advagg directories usually solves this issue. - - -If hosting on Pantheon, you might need to add this to your settings.php file if -you get Numerous login prompts after enabling Adv Agg module on Pantheon Test -and Live instances. - - if (isset($_SERVER['PANTHEON_ENVIRONMENT'])) { - // NO trailing slash when setting the $base_url variable. - switch ($_SERVER['PANTHEON_ENVIRONMENT']) { - case 'dev': - $base_url = 'http://dev-sitename.gotpantheon.com'; - break; - - case 'test': - $base_url = 'http://test-sitename.gotpantheon.com'; - break; - - case 'live': - $base_url = 'http://www.domain.tld'; - break; - } - // Remove a trailing slash if one was added. - if (!empty($base_url)) { - $base_url = rtrim($base_url, '/'); - } - } - - -If you're getting the "HTTP requests to advagg are not getting though" error, -you can try to fix it by making sure the `$base_url` is correctly set for -production and not production environments. - - -If you're getting mixed content error for CSS JS files over HTTPS then you can -try to redirect all http traffic to be https. - - RewriteCond %{HTTPS} off - RewriteCond %{HTTP:X-Forwarded-Proto} !https - RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] - - -If brotli compression is not working and you are using Apache here are some tips -to hopefully get it working. For Apache enable `mod_rewrite`, `mod_headers`, and -`mod_expires`. Add the following code right above this line `# Rules to -correctly serve gzip compressed CSS and JS files.` - - - # Serve brotli compressed CSS if they exist and the client accepts br. - RewriteCond %{HTTP:Accept-encoding} br - RewriteCond %{REQUEST_FILENAME}\.br -s - RewriteRule ^(.*)\.css $1\.css\.br [QSA] - RewriteRule \.css\.br$ - [T=text/css,E=no-gzip:1] - - # Serve brotli compressed JS if they exist and the client accepts br. - RewriteCond %{HTTP:Accept-encoding} br - RewriteCond %{REQUEST_FILENAME}\.br -s - RewriteRule ^(.*)\.js $1\.js\.br [QSA] - RewriteRule \.js\.br$ - [T=application/javascript,E=no-gzip:1] - - - # Serve correct encoding type. - Header set Content-Encoding br - # Force proxies to cache compressed and non-compressed css/js files - # separately. - Header append Vary Accept-Encoding - - - - -If you are having 5 minute or longer timeouts on the admin/reports/status page -then you might need to use an alternative to drupal_httP_request(). The cURL -HTTP Request module https://www.drupal.org/project/chr might fix this issue. - - -FEATURES & BENEFITS -------------------- - -**Advanced CSS/JS Aggregation core features** - - - On demand generation of CSS/JS Aggregates. If the file doesn't exist it will - be generated on demand. - - Stampede protection for CSS and JS aggregation. Uses locking so multiple - requests for the same thing will result in only one thread doing the work. - - Fully cached CSS/JS assets allow for zero file I/O if the Aggregated file - already exists. Results in better page generation performance. - - Smarter aggregate deletion. CSS/JS aggregates only get removed from the - folder if they have not been used/accessed in the last 30 days. - - Smarter cache flushing. Scans all CSS/JS files that have been added to any - aggregate; if that file has changed then flush the correct caches so the - changes go out. The new name ensures changes go out when using CDNs. - - One can add JS to any region of the theme & have it aggregated. - - Url query string to turn off aggregation for that request. `?advagg=0` will - turn off file aggregation if the user has the "bypass advanced aggregation" - permission. `?advagg=-1` will completely bypass all of Advanced CSS/JS - Aggregations modules and submodules. `?advagg=1` will enable Advanced CSS/JS - Aggregation if it is currently disabled. - - Button on the admin page for dropping a cookie that will turn off file - aggregation. Useful for theme development. - - Gzip support. All aggregated files can be pre-compressed into a .gz file and - served from Apache. This is faster then gzipping the file on each request. - -**Included submodules** - - - `advagg_bundler`: - Smartly groups files together - given a target number of CSS/JS aggregates, - this will try very hard to meet that goal. - - `advagg_css_cdn`: - Load CSS libraries from a public CDN; currently only supports Google's CDN. - - `advagg_css_compress`: - Compress the compiled CSS files using a 3rd party compressor; currently - supports YUI (included). - - `advagg_js_cdn`: - Load JavaScript libraries from a public CDN; currently only supports Google's - CDN. - - `advagg_js_compress`: - Compress the compiled JavaScript files using a 3rd party compressor; - currently supports JSMin+ (included). - - `advagg_mod`: - Includes additional tweaks that may not work for all sites: - - Force preprocessing for all CSS/JS. - - Move JS to footer. - - Add defer tag to all JS. - - Defer loading of CSS. - - Inline all CSS/JS for given paths. - - Use a shared directory for a unified multisite. - - `advagg_validator`: - Validate all CSS files using jigsaw.w3.org. Check all CSS files with CSSLint. - Check all JS files with JSHint. - - -CONFIGURATION -------------- - -Settings page is located at: -`admin/config/development/performance/advagg` - -**Global Options** - - - Enable Advanced Aggregation: Check this to start using this module. You can - also quickly disable the module here. For testing purposes, this has the same - effect as placing `?advagg=-1` in the URL. Disabled by default. - - Use Cores Grouping Logic: Leave this checkbox enabled until you are ready to - begin exploring the AdvAgg Bundler sub-module which overrides Core's - functionality. This groups files just like Core does so should just work. - Enabled by default. You will also have to disable this checkbox if you wish - to enable some of the CSS Options below on this settings page. - - Use HTTPRL to generate aggregates: If the HTTPRL module is enabled - - https://drupal.org/project/httprl - advagg will use it to generate aggregates - on the fly in a background parallel process. Enabling HTTPRL will improve - page generation speeds when a new aggregate is created because the CSS/JS - file creation will happen in a different process. If HTTPRL is installed it - is Enabled by default; otherwise is it Disabled. - - AdvAgg Cache Settings: As a reference, core takes about 25 ms to run. - Development will scan all files for a change on every page load. Normal is - fine for all use cases. Aggressive should be fine in almost all use cases; - if your inline css/js changes based off of a variable then the aggressive - cache hit ratio will be low; if that is the case consider using - Drupal.settings for a better cache hit ratio. - -**Resource Hints** - -Preemptively get resources (CSS/JS & sub requests). This will set tags in the -document head telling the browser to open up connections before they are needed. - - - DNS Prefetch: Start the DNS lookup for external CSS and JavaScript files as - soon as possible. - - Preconnect: Start the connection to external resources before an HTTP request - is actually sent to the server. On HTTPS this can have a dramatic effect. - - Location of resource hints: This only needs to be changed if the above - settings are not working. - - Preload link http headers: If your server supports HTTP/2 push then this - allows for resources to be sent before the browser knows it needs it. - -**Cron Options** - -Adjusting the frequency of how often something happens on cron. - -**Obscure Options** - - - Create .gz files: Check this by default as it will improve your performance. - For every Aggregated file generated, this will create a gzip version of file - and then only serve it out if the browser accepts gzip files compression. - Enabled by default. - - Create .br files: Check this by default as it will improve your performance. - For every Aggregated file generated, this will create a brotli version of - file and then only serve it out if the browser accepts gzip files - compression. Enabled by default IF the Brotli Extension for PHP is installed. - See https://github.com/kjdev/php-ext-brotli - - Run advagg_ajax_render_alter(): Turn this off if you're having issues with - ajax. Also keep in mind that the max_input_vars setting can cause issues if - you are submitting a lot of data. - - Include the base_url variable in the hooks hash array: Enabled only if you - know you need it. - - Convert absolute paths to be self references: Turn on unless pages are used - inside of an iframe. - - Convert absolute paths to be protocol relative paths: Safe to use unless you - need to support IE6. - - Convert http:// to https://: Usually not needed, but here in case you do. - - Do not run CSS url() values through file_create_url(): Usually not needed, - but here in case you do. - - -**CSS Options & JS Options** - - - Combine CSS files by using media queries: "Use cores grouping logic" needs to - be unchecked in order for this to work. Also noted is that due to an issue - with IE9, compatibility mode is forced off if this is enabled by adding this - tag in the html head: - - - - Disabled by default. - - Prevent more than 4095 CSS selectors in an aggregated CSS file: Internet - Explorer before version 10; IE9, IE8, IE7, & IE6 all have 4095 as the limit - for the maximum number of css selectors that can be in a file. Enabling this - will prevent CSS aggregates from being created that exceed this limit. For - more information see - http://blogs.msdn.com/b/ieinternals/archive/2011/05/14/10164546.aspx Disabled - by default. - - Fix improperly set type (CSS/JS): If type is external but does not start with - http, https, or // change it to be type file. If type is file but it starts - with http, https, or // change type to be external. - -**Information page** - -located at `admin/config/development/performance/advagg/info`. This page -provides debugging information. There are no configuration options here. - - - Hook Theme Info: Displays the `process_html` order. Used for debugging. - - Hook Render Info: Displays the scripts and styles render callbakcs. Used for - debugging. - - CSS files: Displays how often a file has changed. - - JS files: Displays how often a file has changed. - - Modules implementing AdvAgg CSS/JS hooks: Lets you know what modules are - using advagg. - - AdvAgg CSS/JS hooks implemented by modules: Lets you know what advagg hooks - are in use. - - Hooks And Variables Used In Hash: Show what is used to calculate the 3rd hash - of an aggregates filename. - - Get detailed info about an aggregate file: Look up detailed array about any - CSS or JS file listed. - -**Operations page** - -located at `admin/config/development/performance/advagg/operations`. This is a -collection of commands to control the cache and to manage testing of this -module. In general this page is useful when troubleshooting some aggregation -issues. For normal operations, you do not need to do anything on this page below -the Smart Cache Flush. There are no configuration options here. - - - Smart Cache Flush - - Flush AdvAgg Cache: Scan all files referenced in aggregated files. If - any of them have changed, increment the counters containing that file and - rebuild the bundle. - - - Aggregation Bypass Cookie - - Toggle The "aggregation bypass cookie" For This Browser: This will set or - remove a cookie that disables aggregation for the remainder of the browser - session. It acts almost the same as adding `?advagg=0` to every URL. - - - Cron Maintenance Tasks - - Clear All Stale Files: Scan all files in the `advagg_css/js` directories - and remove the ones that have not been accessed in the last 30 days. - - Delete Orphaned Aggregates: Scan CSS/JS advagg dir and remove file if - there is no associated db record. - - Clear Missing Files From the Database: Scan for missing files and remove - the associated entries in the database. - - Delete Unused Aggregates from Database: Delete aggregates that have not - been accessed in the last 6 weeks. - - Delete orphaned/expired advagg locks from the semaphore database table. - - Delete leftover temporary files: Delete old temporary files from the - filesystem. - - - Drastic Measures - - Clear All Caches: Remove all data stored in the advagg cache bins. - - Clear All Files: Remove All Generated Files. Remove all files in the - `advagg_(css|js)` directories. - - Force New Aggregates: Increment Global Counter. Force the creation of all - new aggregates by incrementing a global counter. - - Rescan All Files: Force rescan all files and clear the cache. Useful if a - css/js change from a deployment did not work. - - Remove deleted files in the advagg_files table: Remove entries in the - advagg_files table that have a filesize of 0 and delete the - javascript_parsed variable. This gets around the grace period that the - cron cleanup does. - - Reset the AdvAgg Files table: Truncate the advagg_files table and delete - the javascript_parsed variable. This may cause some 404s for CSS/JS assets - for a short amount of time (seconds). Useful if you really want to reset - some stuff. Might be best to put the site into maintenance mode before - doing this. - -**Hidden Settings** - -The following settings are not configurable from the admin UI and must be set in -settings.php. In general they are settings that should not be changed. The -current defaults are shown. - - // Display a message that the bypass cookie is set. - $conf['advagg_show_bypass_cookie_message'] = TRUE; - - // Display a message when a css/js file changed while in development mode. - $conf['advagg_show_file_changed_message'] = TRUE; - - // Skip the 404 check on status page. - $conf['advagg_skip_404_check'] = FALSE; - - // Force the scripts #aggregate_callback to always be _advagg_aggregate_js. - $conf['advagg_enforce_scripts_callback'] = TRUE; - - // Default location of AdvAgg configuration items. - $conf['advagg_admin_config_root_path'] = 'admin/config/development/performance'; - - // Run advagg_url_inbound_alter(). - $conf['advagg_url_inbound_alter'] = TRUE; - - // Allow JavaScript insertion into any scope even if theme does not support - // it. - $conf['advagg_scripts_scope_anywhere'] = FALSE; - - // Empty the scripts key inside of template_process_html replacement - // function. - $conf['advagg_scripts_scope_anywhere'] = FALSE; - - // Do more file operations in main thread if the file system is fast. If - // AdvAgg's directories are mounted on something like S3, you might want to - // set this to FALSE. - $conf['advagg_fast_filesystem'] = TRUE; - - // Pregenerate aggregate files. If disable the browser requesting the file - // will cause the generation to happen. If advagg 404 handling is broken - // then setting this to false will break your site in bad ways. - $conf['advagg_pregenerate_aggregate_files'] = TRUE; - - // Set the jQuery UI version. - $conf['advagg_css_cdn_jquery_ui_version'] = '1.8.7'; - - // See if jQuery UI should be grabbed from the Google CDN. - $conf['advagg_css_cdn_jquery_ui'] = TRUE; - - // Set the jQuery UI version. - $conf['advagg_js_cdn_jquery_ui_version'] = '1.8.7'; - - // Set the jQuery version. - $conf['advagg_js_cdn_jquery_version'] = '1.4.4'; - - // Use minification. - $conf['advagg_js_cdn_compression'] = TRUE; - - // See if jQuery UI should be grabbed from the Google CDN. - $conf['advagg_js_cdn_jquery_ui'] = TRUE; - - // See if jQuery should be grabbed from the Google CDN. - $conf['advagg_js_cdn_jquery'] = TRUE; - - // Value for the compression ratio test. - $conf['advagg_js_compress_max_ratio'] = 0.9; - - // Value for the compression ratio test. - $conf['advagg_js_compress_ratio'] = 0.1; - - // Skip far future check on status page. - $conf['advagg_skip_far_future_check'] = FALSE; - - // Skip preprocess and enabled checks. - $conf['advagg_skip_enabled_preprocess_check'] = FALSE; - - // Default root dir for the advagg files; see advagg_get_root_files_dir(). - $conf['advagg_root_dir_prefix'] = 'public://'; - - // How long to wait when writing the aggregate if a file is missing or the - // hash doesn't match. - $conf['advagg_file_read_failure_timeout'] = 3600; - - // If FALSE mtime of files will only trigger a change if they are in the - // future. - $conf['advagg_strict_mtime_check'] = TRUE; - - // Skip 304 check on status page. - $conf['advagg_skip_304_check'] = FALSE; - - // Control how many bytes can be inlined. - $conf['advagg_mod_css_defer_inline_size_limit'] = 12288; - - // Control how many bytes the preload header can use. - $conf['advagg_resource_hints_preload_max_size'] = 3072; - - // If TRUE, only verify 1st hash instead of all 3 of the filename. - $conf['advagg_weak_file_verification'] = FALSE; - - -ADDITIONAL OPTIONS FOR DRUPAL_ADD_CSS/JS FUNCTIONS --------------------------------------------------- - -AdvAgg extends the available options inside of `drupal_add_css` and -`drupal_add_js`. - -`drupal_add_js` - additional keys for $options. - - - `browsers`: Works the same as the one found in drupal_add_css. - - `onload`: Run this js code when after the js file has loaded. - - `onerror`: Run this js code when if the js file did not load. - - `async`: TRUE - Load this file using async. - - `no_defer`: TRUE - Never defer or async load this js file. - -Both `drupal_add_js` + `drupal_add_css` - additional keys for $options. - - - `scope_lock`: TRUE - Make sure the scope of this will not ever change. - - `movable`: FALSE - Make sure the ordering of this will not ever change. - - `preprocess_lock`: TRUE - Make sure the preprocess key will not ever change. - - -TECHNICAL DETAILS & HOOKS -------------------------- - -**Technical Details** - - - There are five database tables and two cache table used by advagg. - `advagg_schema` documents what they are used for. - - Files are generated by this pattern: - - css__[BASE64_HASH]__[BASE64_HASH]__[BASE64_HASH].css - - The first base64 hash value tells us what files are included in the - aggregate. Changing what files get included will change this value. - - The second base64 hash value is used as a sort of version control; it changes - if any of the base files contents have changed. Changing a base files content - (like drupal.js) will change this value. - - The third base64 hash value records what settings were used when generating - the aggregate. Changing a setting that affects how aggregates get built - (like toggling "Create .gz files") will change this value. - - - To trigger scanning of the CSS / JS file cache to identify new files, run - the following: - - // Trigger reloading the CSS and JS file cache in AdvAgg. - if (module_exists('advagg')) { - module_load_include('inc', 'advagg', 'advagg.cache'); - advagg_push_new_changes(); - } - - - Aggressive Cache Setting: This will fully cache the rendered html generated - by AdvAgg. The cache ID is set by this code: - - // CSS. - $hooks_hash = advagg_get_current_hooks_hash(); - $css_cache_id_full = - 'advagg:css:full:' . $hooks_hash . ':' . - drupal_hash_base64(serialize($full_css)); - // JS. - $hooks_hash = advagg_get_current_hooks_hash(); - $js_cache_id_full = - 'advagg:js:full:' . $hooks_hash . ':' . - drupal_hash_base64(serialize($js_scope_array)); - - The second and final hash value in this cache id is the css/js_hash value. - This takes the input from `drupal_add_css/js()` and creates a hash value from - it. If a different file is added and/or inline code changed, this hash value - will be different. - - The first hash value will take the current_hooks_hash value which is the - third base64 hash value listed above in this section (Technical Details) as - the first part of the hash. This means that if any value is changed in this - nested array a different cache id will be used. You can see the contents of - this nested array by going to - `admin/config/development/performance/advagg/info` under - "Hooks And Variables Used In Hash". An example of this being properly used is - if you enable the core locale module the language key will appear in the - array. This is needed because the `locale_css_alter` and `locale_js_alter` - functions both use the global $language variable in determining what css or - js files need to be altered. To add in your own context you can use - `hook_advagg_current_hooks_hash_array_alter` to do so. Be careful when doing - so as including something like the user id will make every user have a - different set of aggregate files. - -**Hooks** - -Modify file contents: - - - `advagg_get_css_file_contents_alter`. Modify the data of each file before it - gets glued together into the bigger aggregate. Useful for minification. - - `advagg_get_js_file_contents_alter`. Modify the data of each file before it - gets glued together into the bigger aggregate. Useful for minification. - - `advagg_get_css_aggregate_contents_alter`. Modify the data of the complete - aggregate before it gets written to a file. Useful for minification. - - `advagg_get_js_aggregate_contents_alter`. Modify the data of the complete - aggregate before it gets written to a file.Useful for minification. - - `advagg_save_aggregate_alter`. Modify the data of the complete aggregate - allowing one create multiple files from one base file. Useful for gzip - compression. Also useful for mirroring data. - -Modify file names and aggregate bundles: - - - `advagg_current_hooks_hash_array_alter`. Add in your own settings and hooks - allowing one to modify the 3rd base64 hash in a filename. - - `advagg_build_aggregate_plans_alter`. Regroup files into different - aggregates. - - `advagg_css_groups_alter`. Allow other modules to modify `$css_groups` right - before it is processed. - - `advagg_js_groups_alter`. Allow other modules to modify `$js_groups` right - before it is processed. - -Others: - - - `advagg_hooks_implemented_alter`. Tell advagg about other hooks related to - advagg. - - `advagg_get_root_files_dir_alter`. Allow other modules to alter css and js - paths. - - `advagg_modify_css_pre_render_alter`. Allow other modules to modify $children - & $elements before they are rendered. - - `advagg_modify_js_pre_render_alter`. Allow other modules to modify $children - & $elements before they are rendered. - - `advagg_changed_files`. Let other modules know about the changed files. - - `advagg_removed_aggregates`. Let other modules know about removed aggregates. - - `advagg_scan_for_changes`. Let other modules see if files related to this - file has changed. Useful for detecting changes to referenced images in css. - - `advagg_get_info_on_files_alter`. Let other modules modify information about - the base CSS/JS files. - - `advagg_context_alter`. Allow other modules to swap important contextual - information on generation. - - `advagg_bundler_analysis`. If the bundler module is installed allow for other - modules to change the bundler analysis. diff --git a/html/sites/all/modules/contrib/advagg/advagg.admin.inc b/html/sites/all/modules/contrib/advagg/advagg.admin.inc deleted file mode 100644 index 80601001e..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg.admin.inc +++ /dev/null @@ -1,1965 +0,0 @@ - t('Use default (safe) settings'), - 2 => t('Use recommended (optimized) settings'), - 4 => t('Use customized settings'), - ); - $form['advagg_admin_mode'] = array( - '#type' => 'radios', - '#title' => t('AdvAgg Settings'), - '#default_value' => variable_get('advagg_admin_mode', ADVAGG_ADMIN_MODE), - '#options' => $options, - '#description' => t("Default settings will mirror core as closely as possible.
Recommended settings are optimized for speed."), - ); - - $form['global_container'] = array( - '#type' => 'container', - '#hidden' => TRUE, - '#states' => array( - 'visible' => array( - ':input[name="advagg_admin_mode"]' => array('value' => '4'), - ), - ), - ); - - // Simple checkbox settings. - $form['global_container']['global'] = array( - '#type' => 'fieldset', - '#title' => t('Global Options'), - ); - $form['global_container']['global']['advagg_enabled'] = array( - '#type' => 'checkbox', - '#title' => t('Enable advanced aggregation (recommended)'), - '#default_value' => variable_get('advagg_enabled', ADVAGG_ENABLED), - '#description' => t('Uncheck this box to completely disable AdvAgg functionality.'), - '#recommended_value' => TRUE, - ); - $advagg_core_groups_default = variable_get('advagg_core_groups', ADVAGG_CORE_GROUPS); - if (variable_get('advagg_combine_css_media', ADVAGG_COMBINE_CSS_MEDIA) - || variable_get('advagg_ie_css_selector_limiter', ADVAGG_IE_CSS_SELECTOR_LIMITER) - || (module_exists('advagg_bundler') && variable_get('advagg_bundler_active', ADVAGG_BUNDLER_ACTIVE))) { - $advagg_core_groups_default = FALSE; - } - $form['global_container']['global']['advagg_core_groups'] = array( - '#type' => 'checkbox', - '#title' => t('Use cores grouping logic'), - '#default_value' => $advagg_core_groups_default, - '#description' => t('Will group files just like core does.'), - '#recommended_value' => FALSE, - '#states' => array( - 'enabled' => array( - '#edit-advagg-combine-css-media' => array('checked' => FALSE), - '#edit-advagg-ie-css-selector-limiter' => array('checked' => FALSE), - ), - ), - ); - $form['global_container']['global']['advagg_use_httprl'] = array( - '#type' => 'checkbox', - '#title' => t('Use HTTPRL to generate aggregates (recommended)'), - '#default_value' => module_exists('httprl') ? variable_get('advagg_use_httprl', ADVAGG_USE_HTTPRL) : FALSE, - '#disabled' => module_exists('httprl') ? FALSE : TRUE, - '#description' => t('If HTTPRL is installed, advagg will use it to generate aggregates on the fly in a background parallel process.', array('@link' => 'http://drupal.org/project/httprl')), - '#recommended_value' => TRUE, - ); - - $aggressive_cache_conflicts = advagg_aggressive_cache_conflicts(); - if (empty($aggressive_cache_conflicts)) { - $description = t('It appears that there are no incompatible modules, so you should be able to safely use the Aggressive cache.'); - } - else { - $description = t('It appears that there might be some incompatible modules. I would test these out before setting the cache to aggressive: %modules', array('%modules' => implode(', ', $aggressive_cache_conflicts))); - } - $options = array( - -1 => t('Development ~ 300ms'), - 1 => t('Normal ~ 60ms'), - 3 => t('Render Cache ~ 30ms (recommended)'), - 5 => t('Aggressive Render Cache ~ 10ms'), - ); - $form['global_container']['global']['advagg_cache_level'] = array( - '#type' => 'radios', - '#title' => t('AdvAgg Cache Settings'), - '#default_value' => variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL), - '#options' => $options, - '#recommended_value' => 3, - '#description' => t("As a reference, core takes about 25 ms to run. Development will scan all files for a change on every page load. Normal and the render cache is fine for all use cases. Aggressive should be fine for most use cases. If your inline css/js changes based off of a variable then the cache hit ratio will be low; if that is the case consider using Drupal.settings for a better cache hit ratio when using the render cache. The aggressive render cache will cache the output from js_alter and css_alter. !description", array( - '@information' => url($config_path . '/advagg/info', array( - 'fragment' => 'edit-hooks-implemented', - )), - '!description' => $description, - )), - ); - $stream_wrappers = file_get_stream_wrappers(); - $prefix = variable_get('advagg_root_dir_prefix', ADVAGG_ROOT_DIR_PREFIX); - if ($prefix !== 'public://' - || $stream_wrappers['public']['class'] !== 'DrupalPublicStreamWrapper' - || count($stream_wrappers) > 2 - || file_default_scheme() !== 'public' - ) { - $stream_wrappers_string = array(); - foreach ($stream_wrappers as $key => $values) { - $stream_wrappers_string[] = t("@key:// uses @class; @description", array( - '@key' => $key, - '@class' => $values['class'], - '@description' => $values['description'], - )); - } - $stream_wrappers_string = implode("
\n", $stream_wrappers_string); - $form['global_container']['global']['advagg_root_dir_prefix'] = array( - '#type' => 'textfield', - '#title' => t('Stream wrapper for AdvAgg.'), - '#default_value' => $prefix, - '#description' => t("Options:
\n!stream_wrappers", array( - '!stream_wrappers' => $stream_wrappers_string, - )), - ); - } - - $form['global_container']['global']['dev_container'] = array( - '#type' => 'container', - '#states' => array( - 'visible' => array( - ':input[name="advagg_cache_level"]' => array('value' => '-1'), - ), - ), - ); - // Show msg about advagg css compress. - if (module_exists('advagg_css_compress') && (variable_get('advagg_css_compressor', ADVAGG_CSS_COMPRESSOR) > 0 || variable_get('advagg_css_compress_inline', ADVAGG_CSS_COMPRESS_INLINE))) { - $form['global_container']['global']['dev_container']['advagg_css_compress_msg'] = array( - '#markup' => '

' . t('The AdvAgg CSS Compression module is disabled when in development mode.', array('@css' => url($config_path . '/advagg/css-compress'))) . '

', - ); - } - // Show msg about advagg js compress. - if (module_exists('advagg_js_compress') && (variable_get('advagg_js_compressor', ADVAGG_JS_COMPRESSOR) || variable_get('advagg_js_compress_inline', ADVAGG_JS_COMPRESS_INLINE))) { - $form['global_container']['global']['dev_container']['advagg_js_compress_msg'] = array( - '#markup' => '

' . t('The AdvAgg JS Compression module is disabled when in development mode.', array('@js' => url($config_path . '/advagg/js-compress'))) . '

', - ); - } - - // Show msg about the jquery update compression setting. - if (module_exists('jquery_update')) { - if (variable_get('jquery_update_compression_type', 'min') === 'min') { - $form['global_container']['global']['dev_container']['advagg_jquery_update_development'] = array( - '#markup' => '

' . t('You might want to change the jQuery update compression level to "Development" as well.', array( - '!url' => url('admin/config/development/jquery_update'), - )) . '

', - ); - } - else { - $form['global_container']['global']['prod_container'] = array( - '#type' => 'container', - '#states' => array( - 'visible' => array( - ':input[name="advagg_cache_level"]' => array('!value' => '-1'), - ), - ), - ); - $form['global_container']['global']['prod_container']['advagg_jquery_update_development'] = array( - '#markup' => '

' . t('You might want to change the jQuery update compression level to "Production" as well.', array( - '!url' => url('admin/config/development/jquery_update'), - )) . '

', - ); - } - } - - $advagg_resource_hints_dns_prefetch = variable_get('advagg_resource_hints_dns_prefetch', ADVAGG_RESOURCE_HINTS_DNS_PREFETCH); - $advagg_resource_hints_preconnect = variable_get('advagg_resource_hints_preconnect', ADVAGG_RESOURCE_HINTS_PRECONNECT); - $advagg_resource_hints_preload = variable_get('advagg_resource_hints_preload', ADVAGG_RESOURCE_HINTS_PRELOAD); - $form['global_container']['global']['resource_hints'] = array( - '#type' => 'fieldset', - '#title' => t('Resource Hints'), - '#collapsible' => TRUE, - '#collapsed' => ($advagg_resource_hints_dns_prefetch || $advagg_resource_hints_preconnect || $advagg_resource_hints_preload) ? FALSE : TRUE, - '#description' => t('Preemptively get resources (CSS/JS & sub requests).'), - ); - $form['global_container']['global']['resource_hints']['advagg_resource_hints_dns_prefetch'] = array( - '#type' => 'checkbox', - '#title' => t('DNS Prefetch (recommended).'), - '#default_value' => $advagg_resource_hints_dns_prefetch, - '#disabled' => '', - '#description' => t('Start the DNS lookup for external CSS and JavaScript files as soon as possible.'), - '#recommended_value' => TRUE, - ); - $form['global_container']['global']['resource_hints']['advagg_resource_hints_preconnect'] = array( - '#type' => 'checkbox', - '#title' => t('Preconnect (recommended).'), - '#default_value' => $advagg_resource_hints_preconnect, - '#disabled' => '', - '#description' => t('Start the connection to external resources before an HTTP request is actually sent to the server.'), - '#recommended_value' => TRUE, - ); - $form['global_container']['global']['resource_hints']['advagg_resource_hints_location'] = array( - '#type' => 'radios', - '#title' => t('Location of resource hints.'), - '#default_value' => variable_get('advagg_resource_hints_location', ADVAGG_RESOURCE_HINTS_LOCATION), - '#description' => t('If you have css and/or js files being loaded right after the "charset=utf-8" meta tag, you need to use the "above charset=utf-8" option in order for some of the resource hints to work; Optimizely is an example that would need this other option. Link headers are not supported in every browser.'), - '#recommended_value' => 1, - '#options' => array( - 1 => t('Below charset=utf-8 (recommended)'), - 3 => t('Above charset=utf-8'), - ), - '#states' => array( - 'disabled' => array( - '#edit-advagg-resource-hints-dns-prefetch' => array('checked' => FALSE), - '#edit-advagg-resource-hints-preconnect' => array('checked' => FALSE), - ), - ), - ); - - // Preload Section. - $form['global_container']['global']['resource_hints']['preload']['advagg_resource_hints_preload'] = array( - '#type' => 'checkbox', - '#title' => t('Preload link http headers.'), - '#default_value' => $advagg_resource_hints_preload, - '#disabled' => '', - '#description' => t('Use link http headers to send out preload hints for local and external resources.'), - '#recommended_value' => FALSE, - ); - $advagg_resource_hints_preload_settings = advagg_get_resource_hints_preload_settings(); - $form['global_container']['global']['resource_hints']['preload']['advagg_resource_hints_preload_settings'] = array( - '#type' => 'fieldset', - '#title' => t('Preload Ordering and Settings'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#description' => t('Change the order of what preload items get sent first. Can also control what will be sent and if HTTP/2 push should be used (if your server supports it). If your webserver supports HTTP/2 Push, and it is enabled, the server will send every asset flagged to be pushed to the browser on every request, ignoring the browser cache (not a good thing for repeat visits). More complex server configuration will be needed to make this efficient; no solutions are currently available.'), - '#states' => array( - 'invisible' => array( - '#edit-advagg-resource-hints-preload' => array('checked' => FALSE), - ), - ), - ); - // Build the rows. - foreach ($advagg_resource_hints_preload_settings as $id => $entry) { - // Build the table rows. - $rows[$id] = array( - 'data' => array( - // Cell for the cross drag and drop element. - array('class' => array('entry-cross')), - // Weight item for the tabledrag. - array( - 'data' => array( - '#type' => 'weight', - '#title' => t('Weight'), - '#title_display' => 'invisible', - '#default_value' => $entry['#weight'], - '#parents' => array( - 'advagg_resource_hints_preload_settings', - $id, - 'weight', - ), - '#attributes' => array( - 'class' => array('entry-order-weight'), - ), - ), - ), - check_plain($entry['title']), - array( - 'data' => array( - '#type' => 'checkbox', - '#title' => t('Enable'), - '#title_display' => 'invisible', - '#default_value' => $entry['enabled'], - '#parents' => array( - 'advagg_resource_hints_preload_settings', - $id, - 'enabled', - ), - ), - ), - array( - 'data' => array( - '#type' => 'checkbox', - '#title' => t('HTTP/2 Push'), - '#title_display' => 'invisible', - '#default_value' => $entry['push'], - '#parents' => array( - 'advagg_resource_hints_preload_settings', - $id, - 'push', - ), - ), - ), - array( - 'data' => array( - '#type' => 'checkbox', - '#title' => t('Local'), - '#title_display' => 'invisible', - '#default_value' => $entry['local'], - '#parents' => array( - 'advagg_resource_hints_preload_settings', - $id, - 'local', - ), - ), - ), - array( - 'data' => array( - '#type' => 'checkbox', - '#title' => t('External'), - '#title_display' => 'invisible', - '#default_value' => $entry['external'], - '#parents' => array( - 'advagg_resource_hints_preload_settings', - $id, - 'external', - ), - ), - ), - ), - 'class' => array('draggable'), - ); - // Build rows of the form elements in the table. - $row_elements[$id] = array( - 'weight' => &$rows[$id]['data'][1]['data'], - 'enabled' => &$rows[$id]['data'][3]['data'], - 'push' => &$rows[$id]['data'][4]['data'], - 'local' => &$rows[$id]['data'][5]['data'], - 'external' => &$rows[$id]['data'][6]['data'], - ); - } - - // Add the table to the form. - $form['global_container']['global']['resource_hints']['preload']['advagg_resource_hints_preload_settings']['advagg_table'] = array( - '#theme' => 'table', - // The row form elements need to be processed and build, - // therefore pass them as element children. - 'elements' => $row_elements, - '#header' => array( - // We need two empty columns for the weight field and the cross. - array('data' => NULL, 'colspan' => 2), - t('Name'), - t('Enabled'), - t('HTTP/2 Push'), - t('Local'), - t('External'), - ), - '#rows' => $rows, - '#attributes' => array('id' => 'entry-order'), - ); - drupal_add_tabledrag('entry-order', 'order', 'sibling', 'entry-order-weight'); - $form['global_container']['global']['resource_hints']['preload']['advagg_resource_hints_preload_settings']['advagg_resource_hints_preload_reset'] = array( - '#type' => 'submit', - '#value' => t('Reset'), - '#submit' => array('advagg_admin_resource_hints_preload_reset'), - ); - $form['global_container']['global']['resource_hints']['advagg_resource_hints_use_immutable'] = array( - '#type' => 'checkbox', - '#title' => t('Send immutable header for all aggregated files (recommended).'), - '#default_value' => variable_get('advagg_resource_hints_use_immutable', ADVAGG_RESOURCE_HINTS_USE_IMMUTABLE), - '#description' => t('Have Apache send Cache-Control: immutable for all aggregated files. Current browser support', array( - '@url1' => 'http://bitsup.blogspot.de/2016/05/cache-control-immutable.html', - '@url2' => 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#Browser_compatibility', - )), - '#recommended_value' => TRUE, - ); - - $form['global_container']['global']['cron'] = array( - '#type' => 'fieldset', - '#title' => t('Cron Options'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#description' => t('Unless you have a good reason to adjust these values you should leave them alone.'), - ); - // @codingStandardsIgnoreStart - $short_times = drupal_map_assoc(array( - 60 * 15, // 15 min. - 60 * 30, // 30 min. - 60 * 45, // 45 min. - 60 * 60, // 1 hour. - 60 * 60 * 2, // 2 hours. - 60 * 60 * 4, // 4 hours. - 60 * 60 * 6, // 6 hours. - 60 * 60 * 8, // 8 hours. - 60 * 60 * 10, // 10 hours. - 60 * 60 * 12, // 12 hours. - 60 * 60 * 18, // 18 hours. - 60 * 60 * 23, // 23 hours. - 60 * 60 * 24, // 1 day. - 60 * 60 * 24 * 2, // 2 days. - ), 'format_interval'); - $long_times = drupal_map_assoc(array( - 60 * 60 * 24 * 2, // 2 days. - 60 * 60 * 24 * 3, // 3 days. - 60 * 60 * 24 * 4, // 4 days. - 60 * 60 * 24 * 5, // 5 days. - 60 * 60 * 24 * 6, // 6 days. - 60 * 60 * 24 * 7, // 1 week. - 60 * 60 * 24 * 7 * 2, // 2 weeks. - 60 * 60 * 24 * 7 * 3, // 3 weeks. - 60 * 60 * 24 * 30, // 1 month. - 60 * 60 * 24 * 45, // 1 month 2 weeks. - 60 * 60 * 24 * 60, // 2 months. - ), 'format_interval'); - // @codingStandardsIgnoreEnd - $last_ran = variable_get('advagg_cron_timestamp', 0); - if (!empty($last_ran)) { - $last_ran = t('@time ago', array('@time' => format_interval(REQUEST_TIME - $last_ran))); - } - else { - $last_ran = t('never'); - } - - $form['global_container']['global']['cron']['advagg_cron_frequency'] = array( - '#type' => 'select', - '#options' => $short_times, - '#title' => 'Minimum amount of time between advagg_cron() runs.', - '#default_value' => variable_get('advagg_cron_frequency', ADVAGG_CRON_FREQUENCY), - '#description' => t('The default value for this is %value. The last time advagg_cron was ran is %time.', array( - '%value' => format_interval(ADVAGG_CRON_FREQUENCY), - '%time' => $last_ran, - )), - ); - $form['global_container']['global']['cron']['drupal_stale_file_threshold'] = array( - '#type' => 'select', - '#options' => $long_times, - '#title' => 'Delete aggregates accessed/modified more than a set time ago.', - // @codingStandardsIgnoreLine - '#default_value' => variable_get('drupal_stale_file_threshold', 2592000), - '#description' => t('The default value for this is %value.', array('%value' => format_interval(2592000))), - ); - $form['global_container']['global']['cron']['advagg_remove_missing_files_from_db_time'] = array( - '#type' => 'select', - '#options' => $long_times, - '#title' => 'How long to wait until unaccessed aggregates with missing files are removed from the database.', - '#default_value' => variable_get('advagg_remove_missing_files_from_db_time', ADVAGG_REMOVE_MISSING_FILES_FROM_DB_TIME), - '#description' => t('The default value for this is %value.', array('%value' => format_interval(ADVAGG_REMOVE_MISSING_FILES_FROM_DB_TIME))), - ); - $form['global_container']['global']['cron']['advagg_remove_old_unused_aggregates_time'] = array( - '#type' => 'select', - '#options' => $long_times, - '#title' => 'How long to wait until unaccessed aggregates are removed from the database.', - '#default_value' => variable_get('advagg_remove_old_unused_aggregates_time', ADVAGG_REMOVE_OLD_UNUSED_AGGREGATES_TIME), - '#description' => t('The default value for this is %value.', array('%value' => format_interval(ADVAGG_REMOVE_OLD_UNUSED_AGGREGATES_TIME))), - ); - - $form['global_container']['global']['obscure'] = array( - '#type' => 'fieldset', - '#title' => t('Obscure Options'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#description' => t('Some of the more obscure AdvAgg settings. Odds are you do not need to change anything in here.'), - ); - $form['global_container']['global']['obscure']['advagg_gzip'] = array( - '#type' => 'checkbox', - '#title' => t('Create .gz files'), - '#default_value' => variable_get('advagg_gzip', ADVAGG_GZIP), - '#description' => t('All aggregated files can be pre-compressed into a .gz file and - served from Apache. This is faster then gzipping the file on each request.'), - ); - $form['global_container']['global']['obscure']['advagg_brotli'] = array( - '#type' => 'checkbox', - '#title' => t('Create .br files'), - '#default_value' => variable_get('advagg_brotli', ADVAGG_BROTLI), - '#description' => t('All aggregated files can be pre-compressed into a .br file and - served from Apache. This is faster then brotli compressing the file on each request.'), - ); - if (!function_exists('brotli_compress') || !defined('BROTLI_TEXT')) { - $form['global_container']['global']['obscure']['advagg_brotli']['#default_value'] = FALSE; - $form['global_container']['global']['obscure']['advagg_brotli']['#disabled'] = TRUE; - $form['global_container']['global']['obscure']['advagg_brotli']['#description'] .= ' ' . t('The PHP brotli extension is needed in order to enable this feature.', array('@url' => 'https://github.com/kjdev/php-ext-brotli')); - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $form['global_container']['global']['obscure']['advagg_brotli']['#description'] .= ' ' . t('If running on windows this is a helpful guide on how to compile PHP extensions. Also noted that IIS has a Brotli extension,', array( - '@url' => 'https://wiki.php.net/internals/windows/stepbystepbuild', - '@iis' => 'https://www.iis.net/downloads/community/2016/03/iis-brotli', - )); - } - } - $form['global_container']['global']['obscure']['advagg_ajax_render_alter'] = array( - '#type' => 'checkbox', - '#title' => t('Run advagg_ajax_render_alter()'), - '#default_value' => variable_get('advagg_ajax_render_alter', ADVAGG_AJAX_RENDER_ALTER), - '#description' => t('If disabled, AdvAgg will not alter the aggregates returned by ajax requests.'), - ); - $form['global_container']['global']['obscure']['advagg_include_base_url'] = array( - '#type' => 'checkbox', - '#title' => t('Include the base_url variable in the hooks hash array.'), - '#default_value' => variable_get('advagg_include_base_url', ADVAGG_INCLUDE_BASE_URL), - '#description' => t('If you would like a unique set of aggregates for every permutation of the base_url (current value: %value) then enable this setting. Read more.', array( - '%value' => $GLOBALS['base_url'], - '@issue' => 'https://www.drupal.org/node/2353811', - )), - ); - $form['global_container']['global']['obscure']['advagg_convert_absolute_to_relative_path'] = array( - '#type' => 'checkbox', - '#title' => t('Convert absolute paths to be self references.'), - '#default_value' => variable_get('advagg_convert_absolute_to_relative_path', ADVAGG_CONVERT_ABSOLUTE_TO_RELATIVE_PATH), - '#description' => t('If the src to a CSS/JS file points to this domain, convert the absolute path to a relative path. Will also convert url() references inside of css files. This is generally safe unless the drupal page will be embedded, like it is when used as an iframe.'), - ); - $form['global_container']['global']['obscure']['advagg_convert_absolute_to_protocol_relative_path'] = array( - '#type' => 'checkbox', - '#title' => t('Convert absolute paths to be protocol relative paths.'), - '#default_value' => variable_get('advagg_convert_absolute_to_protocol_relative_path', ADVAGG_CONVERT_ABSOLUTE_TO_PROTOCOL_RELATIVE_PATH), - '#description' => t('If the src to a CSS/JS file points starts with http:// or https://, convert it to use a protocol relative path //. Will also convert url() references inside of css files. This is incompatible with IE6 and might cause extra bandwidth usage in IE7 and IE8 in regards to url() statements inside css files. According to current web browser market share IE 6 is less than 0.2% of the total number of browsers in use and IE 7+8 make up under 5% of browsers in use.', array( - '@url' => 'http://www.w3counter.com/trends', - )), - '#states' => array( - 'enabled' => array( - '#edit-advagg-force-https-path' => array('checked' => FALSE), - ), - ), - ); - $form['global_container']['global']['obscure']['advagg_force_https_path'] = array( - '#type' => 'checkbox', - '#title' => t('Convert http:// to https://.'), - '#default_value' => variable_get('advagg_force_https_path', ADVAGG_FORCE_HTTPS_PATH), - '#description' => t('If the src to a CSS/JS file starts with http:// convert it https://. Will also convert url() references inside of css files.'), - '#states' => array( - 'enabled' => array( - '#edit-advagg-convert-absolute-to-protocol-relative-path' => array('checked' => FALSE), - ), - ), - ); - $form['global_container']['global']['obscure']['advagg_css_absolute_path'] = array( - '#type' => 'checkbox', - '#title' => t('Convert CSS url() to absolute paths if file is outside of the public:// dir.'), - '#default_value' => variable_get('advagg_css_absolute_path', ADVAGG_CSS_ABSOLUTE_PATH), - '#description' => t('Useful for CSS files hosted on S3 where the referenced files inside of url() is not in the same location as the aggregated CSS file.'), - ); - $form['global_container']['global']['obscure']['advagg_skip_file_create_url_inside_css'] = array( - '#type' => 'checkbox', - '#title' => t('Do not run CSS url() values through file_create_url().'), - '#default_value' => variable_get('advagg_skip_file_create_url_inside_css', ADVAGG_SKIP_FILE_CREATE_URL_INSIDE_CSS), - '#description' => t('If checked, the processing of url() values within CSS will be handled more like core than the CDN module. This will not convert relative paths in your source CSS to absolute paths in the aggregated CSS.'), - ); - $form['global_container']['global']['obscure']['advagg_htaccess_symlinksifownermatch'] = array( - '#type' => 'checkbox', - '#title' => t('Use "Options +SymLinksIfOwnerMatch"'), - '#default_value' => variable_get('advagg_htaccess_symlinksifownermatch', ADVAGG_HTACCESS_SYMLINKSIFOWNERMATCH), - '#description' => t('By default the custom .htaccess files are configured to use "Options +FollowSymLinks". Some hosting companies do not support this so "Options +SymLinksIfOwnerMatch" must be used instead.'), - ); - $form['global_container']['global']['obscure']['advagg_disable_on_admin'] = array( - '#type' => 'checkbox', - '#title' => t('Do not use AdvAgg or any aggregation in the admin section.'), - '#default_value' => variable_get('advagg_disable_on_admin', ADVAGG_DISABLE_ON_ADMIN), - '#description' => t('If checked, AdvAgg will not be used in the /admin section as well as any place the admin theme is used.'), - ); - $form['global_container']['global']['obscure']['advagg_disable_on_listed_pages'] = array( - '#type' => 'textarea', - '#title' => t('Do not use AdvAgg or any aggregation in the following pages'), - '#default_value' => variable_get('advagg_disable_on_listed_pages', ADVAGG_DISABLE_ON_LISTED_PAGES), - '#description' => t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog.", array( - '%blog' => 'blog', - '%blog-wildcard' => 'blog/*', - )), - ); - // Get core htaccess files. - $core_htaccess = advagg_htaccess_rewritebase(); - $advagg_htaccess_rewritebase = variable_get('advagg_htaccess_rewritebase', ADVAGG_HTACCESS_REWRITEBASE); - if (!empty($core_htaccess)) { - // Get advagg htaccess files. - list($css_path, $js_path) = advagg_get_root_files_dir(); - $advagg_css_htaccess = advagg_htaccess_rewritebase($css_path[1]); - $advagg_js_htaccess = advagg_htaccess_rewritebase($js_path[1]); - // Build best guess dir name. - $core_htaccess_directive = trim(str_ireplace('RewriteBase ', '', $core_htaccess)); - $new_dir = str_replace('//', '/', $core_htaccess_directive . '/' . dirname($css_path[1])); - - $form['global_container']['global']['obscure']['advagg_htaccess_rewritebase'] = array( - '#type' => 'textfield', - '#title' => t('AdvAgg RewriteBase Directive in .htaccess files.'), - '#default_value' => $advagg_htaccess_rewritebase, - '#description' => t('If gzip and/or brotli files are getting a 307 instead of a 200, this might fix the issue. This Drupal install is using "@core_htaccess" in the webroot .htaccess file. Based off of this and the current location of the advagg css/js directories (@css_path, @js_path) this is the recommended value for this field:

@best_guess

Current advagg htaccess values:

@advagg_css_htaccess
@advagg_js_htaccess

Note that the advagg CSS/JS directories are automatically added onto the end of the given input value.', array( - '@core_htaccess' => $core_htaccess, - '@best_guess' => $new_dir, - '@css_path' => $css_path[1], - '@js_path' => $js_path[1], - '@advagg_css_htaccess' => $advagg_css_htaccess, - '@advagg_js_htaccess' => $advagg_js_htaccess, - )), - ); - } - elseif (!empty($advagg_htaccess_rewritebase)) { - list($css_path, $js_path) = advagg_get_root_files_dir(); - $advagg_css_htaccess = advagg_htaccess_rewritebase($css_path[1]); - $advagg_js_htaccess = advagg_htaccess_rewritebase($js_path[1]); - // Offer advice if this setting should be disabled. - $form['global_container']['global']['obscure']['advagg_htaccess_rewritebase'] = array( - '#type' => 'textfield', - '#title' => t('AdvAgg RewriteBase Directive in .htaccess files.'), - '#default_value' => $advagg_htaccess_rewritebase, - '#description' => t('This Drupal install is no longer using RewriteBase in the webroot .htaccess file. The recommended value for this field is a blank string (empty)
Current advagg htaccess values:

@advagg_css_htaccess
@advagg_js_htaccess

', array( - '@advagg_css_htaccess' => $advagg_css_htaccess, - '@advagg_js_htaccess' => $advagg_js_htaccess, - )), - ); - } - - $form['global_container']['css'] = array( - '#type' => 'fieldset', - '#title' => t('CSS Options'), - ); - $form['global_container']['css']['advagg_combine_css_media'] = array( - '#type' => 'checkbox', - '#title' => t('Combine CSS files by using media queries (recommended)'), - '#default_value' => variable_get('advagg_combine_css_media', ADVAGG_COMBINE_CSS_MEDIA), - '#description' => t('Will combine more CSS files together because different CSS media types can be used in the same file by using media queries. Use cores grouping logic needs to be unchecked in order for this to work. Also noted is that due to an issue with IE9, compatibility mode is forced off if this is enabled.'), - '#states' => array( - 'disabled' => array( - '#edit-advagg-core-groups' => array('checked' => TRUE), - ), - ), - '#recommended_value' => TRUE, - ); - $form['global_container']['css']['advagg_ie_css_selector_limiter'] = array( - '#type' => 'checkbox', - '#title' => t('Prevent more than %limit CSS selectors in an aggregated CSS file', array('%limit' => variable_get('advagg_ie_css_selector_limiter_value', ADVAGG_IE_CSS_SELECTOR_LIMITER_VALUE))), - '#default_value' => variable_get('advagg_ie_css_selector_limiter', ADVAGG_IE_CSS_SELECTOR_LIMITER), - '#description' => t('Internet Explorer before version 10; IE9, IE8, IE7, and IE6 all have 4095 as the limit for the maximum number of css selectors that can be in a file. Enabling this will prevent CSS aggregates from being created that exceed this limit. More info. Use cores grouping logic needs to be unchecked in order for this to work.', array('@link' => 'http://blogs.msdn.com/b/ieinternals/archive/2011/05/14/10164546.aspx')), - '#states' => array( - 'disabled' => array( - '#edit-advagg-core-groups' => array('checked' => TRUE), - ), - ), - '#recommended_value' => FALSE, - ); - $form['global_container']['css']['advagg_ie_css_selector_limiter_value'] = array( - '#type' => 'textfield', - '#title' => t('The selector count the IE CSS limiter should use'), - '#default_value' => variable_get('advagg_ie_css_selector_limiter_value', ADVAGG_IE_CSS_SELECTOR_LIMITER_VALUE), - '#description' => t('Internet Explorer before version 10; IE9, IE8, IE7, and IE6 all have 4095 as the limit for the maximum number of css selectors that can be in a file. Use this field to modify the value used; 4095 sometimes may be still be too many with media queries.'), - '#states' => array( - 'visible' => array( - '#edit-advagg-ie-css-selector-limiter' => array('checked' => TRUE), - ), - 'disabled' => array( - '#edit-advagg-ie-css-selector-limiter' => array('checked' => FALSE), - ), - ), - ); - $form['global_container']['css']['advagg_css_fix_type'] = array( - '#type' => 'checkbox', - '#title' => t('Fix improperly set type (recommended)'), - '#default_value' => variable_get('advagg_css_fix_type', ADVAGG_CSS_FIX_TYPE), - '#description' => t('If type is external but does not start with http, https, or // change it to be type file. If type is file but it starts with http, https, or // change type to be external. Note that if this is causing issues, odds are you have a double slash when there should be a single; see this issue', array( - '@link' => 'https://www.drupal.org/node/2336217', - )), - '#recommended_value' => TRUE, - ); - $form['global_container']['css']['advagg_css_remove_empty_files'] = array( - '#type' => 'checkbox', - '#title' => t('Remove empty CSS files from aggregates (recommended)'), - '#default_value' => variable_get('advagg_css_remove_empty_files', ADVAGG_CSS_REMOVE_EMPTY_FILES), - '#description' => t('If an empty CSS file ends up being in its own aggregate, that aggregate can end up as a 404.'), - '#recommended_value' => TRUE, - ); - - $form['global_container']['js'] = array( - '#type' => 'fieldset', - '#title' => t('JS Options'), - ); - $form['global_container']['js']['advagg_js_fix_type'] = array( - '#type' => 'checkbox', - '#title' => t('Fix improperly set type (recommended)'), - '#default_value' => variable_get('advagg_js_fix_type', ADVAGG_JS_FIX_TYPE), - '#description' => t('If type is external but does not start with http, https, or // change it to be type file. If type is file but it starts with http, https, or // change type to be external. Note that if this is causing issues, odds are you have a double slash when there should be a single; see this issue', array( - '@link' => 'https://www.drupal.org/node/2336217', - )), - '#recommended_value' => TRUE, - ); - $form['global_container']['js']['advagg_js_remove_empty_files'] = array( - '#type' => 'checkbox', - '#title' => t('Remove empty JS files from aggregates (recommended)'), - '#default_value' => variable_get('advagg_js_remove_empty_files', ADVAGG_JS_REMOVE_EMPTY_FILES), - '#description' => t('If an empty JS file ends up being in its own aggregate, that aggregate can end up as a 404.'), - '#recommended_value' => TRUE, - ); - $form['global_container']['js']['advagg_scripts_scope_anywhere'] = array( - '#type' => 'checkbox', - '#title' => t('Allow for JS to be added to blocks and views'), - '#default_value' => variable_get('advagg_scripts_scope_anywhere', ADVAGG_SCRIPTS_SCOPE_ANYWHERE), - '#description' => t('The scope key when using drupal_add_js and friends can be used to insert script tags throughout the html body. To see possible insertion points set @theme_debug in your settings.php file and view the page source while looking for @comment html comments. Some example scopes:

!example

', array( - '@theme_debug' => '$conf[\'theme_debug\'] = TRUE;', - '@comment' => '', - '!example' => "page_top:prefix
block:prefix:system:powered-by
view:suffix:frontpage:page", - )), - ); - - // Clear the cache bins on submit. - $form['#submit'][] = 'advagg_admin_settings_form_submit'; - - return system_settings_form($form); -} - -/** - * Form builder; Do advagg operations. - */ -function advagg_admin_operations_form($form, $form_state) { - drupal_set_title(t('AdvAgg: Operations')); - advagg_display_message_if_requirements_not_met(); - - // Explain what can be done on this page. - $form['tip'] = array( - '#markup' => '

' . t('This is a collection of commands to control the cache and to manage testing of this module. In general this page is useful when troubleshooting some aggregation issues. For normal operations, you do not need to do anything on this page below the Smart Cache Flush. There are no configuration options here.') . '

', - ); - - // Buttons to do stuff. - // AdvAgg smart cache flushing. - $form['smart_flush'] = array( - '#type' => 'fieldset', - '#title' => t('Smart Cache Flush'), - '#description' => t('Scan all files referenced in aggregated files. If any of them have changed, clear that cache so the changes will go out.'), - ); - $form['smart_flush']['advagg_flush'] = array( - '#type' => 'submit', - '#value' => t('Flush AdvAgg Cache'), - '#submit' => array('advagg_admin_flush_cache_button'), - ); - - // Set/Remove Bypass Cookie. - $form['bypass'] = array( - '#type' => 'fieldset', - '#title' => t('Aggregation Bypass Cookie'), - '#description' => t('This will set or remove a cookie that disables aggregation for a set period of time.'), - ); - $bypass_length = drupal_map_assoc(array( - 60 * 60 * 6, - 60 * 60 * 12, - 60 * 60 * 24, - 60 * 60 * 24 * 2, - 60 * 60 * 24 * 7, - 60 * 60 * 24 * 30, - 60 * 60 * 24 * 365, - ), 'format_interval'); - $form['bypass']['timespan'] = array( - '#type' => 'select', - '#title' => 'Bypass length', - '#options' => $bypass_length, - ); - $form['bypass']['submit'] = array( - '#type' => 'submit', - '#value' => t('Toggle The "aggregation bypass cookie" For This Browser'), - '#attributes' => array('onclick' => 'javascript:return advagg_toggle_cookie()'), - '#submit' => array('advagg_admin_toggle_bypass_cookie'), - ); - // Add in aggregation bypass cookie javascript. - $form['#attached']['js'][] = array( - 'data' => array( - 'advagg' => array( - 'key' => drupal_hmac_base64('advagg_cookie', drupal_get_private_key() . drupal_get_hash_salt() . variable_get('cron_key', 'drupal')), - ), - ), - 'type' => 'setting', - ); - $form['#attached']['js'][] = drupal_get_path('module', 'advagg') . '/advagg.admin.js'; - - // Regenerate .htaccess files. - if (variable_get('advagg_htaccess_check_generate', ADVAGG_HTACCESS_CHECK_GENERATE)) { - list($css_path, $js_path) = advagg_get_root_files_dir(); - $form['htaccess'] = array( - '#type' => 'fieldset', - '#title' => t('Regenerate .htaccess files'), - '#description' => t('@advagg_css_htaccess
@advagg_js_htaccess', array( - '@advagg_css_htaccess' => $css_path[1] . '/.htaccess', - '@advagg_js_htaccess' => $js_path[1] . '/.htaccess', - )), - ); - $form['htaccess']['advagg_regenerate_htaccess'] = array( - '#type' => 'submit', - '#value' => t('Recreate htaccess files'), - '#submit' => array('advagg_admin_regenerate_htaccess_button'), - ); - } - - // Tasks run by cron. - $form['cron'] = array( - '#type' => 'fieldset', - '#title' => t('Cron Maintenance Tasks'), - '#description' => t('The following 7 operations are ran on cron but you can run them manually here.'), - ); - $form['cron']['smart_file_flush'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Clear All Stale Files'), - '#description' => t('Remove all stale files. Scan all files in the advagg_css/js directories and remove the ones that have not been accessed in the last 30 days.'), - ); - $form['cron']['smart_file_flush']['advagg_flush_stale_files'] = array( - '#type' => 'submit', - '#value' => t('Remove All Stale Files'), - '#submit' => array('advagg_admin_flush_stale_files_button'), - ); - - $form['cron']['delete_empty_aggregates'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Delete empty aggregates'), - '#description' => t('Delete all aggregates that have no content so that they can be regenerated.'), - ); - $form['cron']['delete_empty_aggregates']['advagg_delete_empty_aggregates'] = array( - '#type' => 'submit', - '#value' => t('Delete empty aggregates'), - '#submit' => array('advagg_delete_empty_aggregates_button'), - ); - - $form['cron']['delete_orphaned_aggregates'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Delete orphaned aggregates'), - '#description' => t('Scan CSS/JS advagg dir and remove file if there is no associated db record.'), - ); - $form['cron']['delete_orphaned_aggregates']['advagg_delete_orphaned_aggregates'] = array( - '#type' => 'submit', - '#value' => t('Delete orphaned aggregates'), - '#submit' => array('advagg_admin_delete_orphaned_aggregates_button'), - ); - - $form['cron']['remove_missing_files'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Clear Missing Files From Database'), - '#description' => t('Scan for missing files and remove the associated entries in the database.'), - ); - $form['cron']['remove_missing_files']['advagg_remove_missing_files_from_db'] = array( - '#type' => 'submit', - '#value' => t('Clear Missing Files From Database'), - '#submit' => array('advagg_admin_remove_missing_files_from_db_button'), - ); - - $form['cron']['remove_old_aggregates'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Delete Unused Aggregates From Database'), - '#description' => t('Delete aggregates that have not been accessed in the last 6 weeks.'), - ); - $form['cron']['remove_old_aggregates']['advagg_remove_old_unused_aggregates'] = array( - '#type' => 'submit', - '#value' => t('Delete Unused Aggregates From Database'), - '#submit' => array('advagg_admin_remove_old_unused_aggregates_button'), - ); - - $form['cron']['cleanup_semaphore_table'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Delete Orphaned Semaphore Locks'), - '#description' => t('Delete orphaned/expired advagg locks from the semaphore database table.'), - ); - $form['cron']['cleanup_semaphore_table']['advagg_cleanup_semaphore_table'] = array( - '#type' => 'submit', - '#value' => t('Delete Orphaned Semaphore Locks'), - '#submit' => array('advagg_admin_cleanup_semaphore_table_button'), - ); - - $form['cron']['cleanup_temp_files'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Delete leftover temporary files'), - '#description' => t('Delete old temporary files from the filesystem.'), - ); - $form['cron']['cleanup_temp_files']['advagg_remove_temp_files'] = array( - '#type' => 'submit', - '#value' => t('Delete leftover temporary files'), - '#submit' => array('advagg_admin_cleanup_temp_files_button'), - ); - - if (module_exists('locale')) { - $form['cron']['refresh_locale_files'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Refresh all locale files'), - '#description' => t('Run all js files in the advagg_files table through locale_js_alter; loop for each enabled language.'), - ); - $form['cron']['refresh_locale_files']['advagg_refresh_all_locale_files'] = array( - '#type' => 'submit', - '#value' => t('Refresh all locale files'), - '#submit' => array('advagg_admin_refresh_locale_files_button'), - ); - } - - // Hide drastic measures as they should not be done unless you really need it. - $form['drastic_measures'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Drastic Measures'), - '#description' => t('The options below should normally never need to be done.'), - ); - $form['drastic_measures']['dumb_cache_flush'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Clear All Caches'), - '#description' => t('Remove all entries from the advagg cache bins. Useful if you suspect a cache is not getting cleared.'), - ); - $form['drastic_measures']['dumb_cache_flush']['advagg_flush_all_caches'] = array( - '#type' => 'submit', - '#value' => t('Clear All Caches'), - '#submit' => array('advagg_admin_clear_all_caches_button'), - ); - $form['drastic_measures']['dumb_file_flush'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Clear All Files'), - '#description' => t('Remove all generated files. Useful if you think some of the generated files got corrupted and thus need to be deleted.'), - ); - $form['drastic_measures']['dumb_file_flush']['advagg_flush_all_files'] = array( - '#type' => 'submit', - '#value' => t('Remove All Generated Files'), - '#submit' => array('advagg_admin_clear_all_files_button'), - ); - $form['drastic_measures']['force_change'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Force new aggregates'), - '#description' => t('Force the creation of all new aggregates by incrementing a global counter. Current value of counter: %value. This is useful if a CDN has cached an aggregate incorrectly as it will force new ones to be used even if nothing else has changed.', array('%value' => advagg_get_global_counter())), - ); - $form['drastic_measures']['force_change']['increment_global_counter'] = array( - '#type' => 'submit', - '#value' => t('Increment Global Counter'), - '#submit' => array('advagg_admin_increment_global_counter'), - ); - $form['drastic_measures']['rescan_files'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Rescan all files'), - '#description' => t('Force rescan all files and clear the cache. Useful if a css/js change from a deployment did not work.'), - ); - $form['drastic_measures']['rescan_files']['reset_mtime'] = array( - '#type' => 'submit', - '#value' => t('Reset All mtime Values'), - '#submit' => array('advagg_admin_reset_mtime'), - ); - $form['drastic_measures']['remove_empty_advagg_files'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Remove deleted files in the advagg_files table'), - '#description' => t('Remove entries in the advagg_files table that have a filesize of 0 and delete the javascript_parsed variable. This gets around the grace period that the cron cleanup does.'), - ); - $form['drastic_measures']['remove_empty_advagg_files']['advagg_admin_remove_empty_advagg_files'] = array( - '#type' => 'submit', - '#value' => t('Remove deleted files from advagg_files'), - '#submit' => array('advagg_admin_remove_empty_advagg_files'), - ); - $form['drastic_measures']['reset_advagg_files'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Reset the AdvAgg Files table'), - '#description' => t('Truncate the advagg_files table and delete the javascript_parsed variable. This may cause some 404s for CSS/JS assets for a short amount of time (seconds). Useful if you really want to reset some stuff. Might be best to put the site into maintenance mode before doing this.'), - ); - $form['drastic_measures']['reset_advagg_files']['truncate_advagg_files'] = array( - '#type' => 'submit', - '#value' => t('Truncate advagg_files'), - '#submit' => array('advagg_admin_truncate_advagg_files'), - ); - - $form['drastic_measures']['clear_base_file'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Delete all aggregates containing this base file.'), - '#description' => t('Pinpoint clearing of all aggregates that contain a file.'), - ); - $form['drastic_measures']['clear_base_file']['filename'] = array( - '#type' => 'textfield', - '#size' => 170, - '#maxlength' => 256, - '#default_value' => '', - '#title' => t('Filename'), - ); - $form['drastic_measures']['clear_base_file']['submit'] = array( - '#type' => 'submit', - '#value' => t('Delete Select Aggregates'), - '#validate' => array('advagg_admin_clear_file_aggregate_validate'), - '#submit' => array('advagg_admin_clear_file_aggregate_submit'), - '#ajax' => array( - 'callback' => 'advagg_admin_clear_file_aggregate_callback', - 'wrapper' => 'advagg-clear-file-aggregate-ajax', - 'effect' => 'fade', - ), - ); - $types = array('css', 'js'); - $css_file = ''; - $js_file = ''; - foreach ($types as $type) { - // Get valid filename. - $results = db_select('advagg_files', 'af') - ->fields('af', array('filename')) - ->condition('filetype', $type) - ->orderBy('filename', 'ASC') - ->execute(); - while ($row = $results->fetchAssoc()) { - if (empty($css_file) && $type === 'css') { - $css_file = $row['filename']; - break; - } - if (empty($js_file) && $type === 'js') { - $js_file = $row['filename']; - break; - } - } - } - $form['drastic_measures']['clear_base_file']['tip'] = array( - '#markup' => '

' . t('Takes input like "@css_file" or "@advagg_js"', array( - '@css_file' => $css_file, - '@advagg_js' => $js_file, - )) . '

', - ); - $form['drastic_measures']['clear_base_file']['wrapper'] = array( - '#markup' => "
", - ); - - return $form; -} - -/** - * Form builder; Show info about advagg and advagg settings. - * - * @see system_settings_form() - */ -function advagg_admin_info_form($form, $form_state) { - drupal_set_title(t('AdvAgg: Information')); - advagg_display_message_if_requirements_not_met(); - - // Explain what can be done on this page. - $form['tip'] = array( - '#markup' => '

' . t('This page provides debugging information. There are no configuration options here.') . '

', - ); - - // Get all hooks and variables. - drupal_theme_initialize(); - $core_hooks = theme_get_registry(); - $advagg_hooks = advagg_hooks_implemented(); - list(, $js_path) = advagg_get_root_files_dir(); - - // Output html process functions hooks. - $form['theme_info'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Hook Theme Info'), - ); - $data = implode("\n", $core_hooks['html']['process functions']); - $form['theme_info']['advagg_theme_info'] = array( - '#markup' => '
' . $data . '
', - ); - - $form['render_info'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Hook Render Info'), - ); - $element_info = array(); - $element_info['scripts'] = element_info('scripts'); - $element_info['styles'] = element_info('styles'); - $output = ''; - foreach ($element_info as $type => &$values) { - $output .= $type . ":\n"; - foreach ($values as $key => &$value) { - if ($key === '#items' || $key === '#type') { - continue; - } - if (empty($value)) { - $output .= ' ' . $key . ' - ' . str_replace(array("\r", "\n"), '', (string) var_export($value, TRUE)) . "\n"; - } - elseif (is_array($value)) { - $output .= ' ' . $key . ' - ' . implode(', ', $value) . "\n"; - } - else { - $output .= ' ' . $key . ' - ' . print_r($value, TRUE) . "\n"; - } - } - } - $form['render_info']['advagg_render_info'] = array( - '#markup' => '
' . $output . '
', - ); - - // Get all parent css and js files. - $types = array('css', 'js'); - $css_file = ''; - foreach ($types as $type) { - $form[$type] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('@type files', array('@type' => drupal_strtoupper($type))), - ); - // Get filename, filename_hash, and changes. - $results = db_select('advagg_files', 'af') - ->fields('af', array('filename', 'filename_hash', 'changes')) - ->condition('filetype', $type) - ->orderBy('filename', 'ASC') - ->execute(); - while ($row = $results->fetchAssoc()) { - if (empty($css_file) && $type === 'css') { - $css_file = basename($row['filename']); - } - - $form[$type][$row['filename_hash']] = array( - '#markup' => '
' . format_plural($row['changes'], 'changed 1 time - %file
', 'changed %changes times - %file
', array( - '%changes' => $row['changes'], - '%file' => $row['filename'], - )), - ); - } - } - - // Display as module -> hook instead of hook -> module. - ksort($advagg_hooks); - $module_hooks = array(); - foreach ($advagg_hooks as $hook => $values) { - if (!empty($values)) { - foreach ($values as $module_name) { - if (!isset($module_hooks[$module_name])) { - $module_hooks[$module_name] = array(); - } - $module_hooks[$module_name][] = $hook; - } - } - else { - $module_hooks['not in use'][] = $hook; - } - } - ksort($module_hooks); - - // Output all advagg hooks implemented. - foreach ($module_hooks as $hook => $values) { - if (empty($values)) { - $form['modules_implementing_advagg'][$hook] = array( - '#markup' => '
' . check_plain($hook) . ': 0
', - ); - } - else { - $form['modules_implementing_advagg'][$hook] = array( - '#markup' => '
' . check_plain($hook) . ': ' . count($values) . '
  ' . filter_xss(implode('
  ', $values), array('br')) . '
', - ); - } - } - $form['modules_implementing_advagg'] += array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Modules implementing AdvAgg CSS/JS hooks'), - ); - - // Output all advagg hooks implemented. - foreach ($advagg_hooks as $hook => $values) { - if (empty($values)) { - $form['hooks_implemented'][$hook] = array( - '#markup' => '
' . check_plain($hook) . ': 0
', - ); - } - else { - $form['hooks_implemented'][$hook] = array( - '#markup' => '
' . check_plain($hook) . ': ' . count($values) . '
  ' . filter_xss(implode('
  ', $values), array('br')) . '
', - ); - } - } - $form['hooks_implemented'] += array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('AdvAgg CSS/JS hooks implemented by modules'), - ); - - // Output what is used inside of the advagg_get_current_hooks_hash() function. - $form['hooks_variables_hash'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Hooks And Variables Used In Hash'), - ); - $form['hooks_variables_hash']['description'] = array( - '#markup' => t('Current Value: %value. Below is the listing of variables and hooks used to generate the 3rd hash of an aggregates filename.', array('%value' => advagg_get_current_hooks_hash())), - ); - $form['hooks_variables_hash']['output'] = array( - // @ignore production_php - '#markup' => '
' . print_r(advagg_current_hooks_hash_array(), TRUE) . '
', - ); - - // Get info about a file. - $form['get_info_about_agg'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => FALSE, - '#title' => t('Get detailed info about an aggregate file'), - ); - $form['get_info_about_agg']['filename'] = array( - '#type' => 'textfield', - '#size' => 170, - '#maxlength' => 256, - '#default_value' => '', - '#title' => t('Filename'), - ); - $form['get_info_about_agg']['submit'] = array( - '#type' => 'submit', - '#value' => t('Lookup Details'), - '#submit' => array('advagg_admin_get_file_info_submit'), - '#validate' => array('advagg_admin_get_file_info_validate'), - '#ajax' => array( - 'callback' => 'advagg_admin_get_file_info_callback', - 'wrapper' => 'advagg-file-info-ajax', - 'effect' => 'fade', - ), - ); - module_load_include('install', 'advagg', 'advagg'); - $first_file_path = (advagg_s3fs_evaluate_no_rewrite_cssjs(FALSE)) ? $js_path[0] : $js_path[1]; - $form['get_info_about_agg']['tip'] = array( - '#markup' => '

' . t('Takes input like "@css_file" or a full aggregate name like "@advagg_js"', array( - '@css_file' => $css_file, - '@advagg_js' => advagg_install_get_first_advagg_file($first_file_path, 'js'), - )) . '

', - ); - $form['get_info_about_agg']['wrapper'] = array( - '#markup' => "
", - ); - - return $form; -} - -/** - * Add various advagg settings to the system_performance_settings form. - */ -function advagg_admin_system_performance_settings_form(&$form, $form_state) { - $msg = t('NOTE: If you wish to bypass aggregation for a set amount of time, you can go to the AdvAgg operations page and press the "aggregation bypass cookie" button.', array( - '@operations' => url('admin/config/development/performance/advagg/operations'), - )); - $msg .= ' '; - if (user_access('bypass advanced aggregation')) { - $msg .= t('You can also selectively bypass aggregation by adding @code to the URL of any page.', array( - '@code' => '?advagg=0', - )); - } - else { - $msg .= t('You do not have the bypass advanced aggregation permission so adding @code to the URL will not work at this time for you; either grant this permission to your user role or use the bypass cookie if you wish to selectively bypass aggregation.', array( - '@permission' => url('admin/people/permissions', array('fragment' => 'module-advagg')), - '@code' => '?advagg=0', - )); - } - if (is_callable('omega_extension_enabled') - && is_callable('omega_theme_get_setting') - && omega_extension_enabled('development') - && omega_theme_get_setting('omega_livereload', TRUE) - ) { - $msg .= ' ' . t('The omega theme is in development mode and livereload is also enabled. This setting combination disables CSS aggregation. If you wish to have CSS aggregation turned on, go to the theme settings page, select the Omega theme/subtheme and turn off LiveReload and/or turn off the Development extension.', array('@url' => url('admin/appearance/settings'))); - } - - $form['bandwidth_optimization']['advagg_note'] = array( - '#markup' => $msg, - ); -} - -/** - * @} End of "defgroup advagg_forms". - */ - -/** - * @defgroup advagg_forms_callback AdvAgg forms callbacks and validation. - * @{ - * Functions that handle user input from forms. - */ - -/** - * Clear out the advagg cache bin when the save configuration button is pressed. - */ -function advagg_admin_settings_form_submit($form, &$form_state) { - // Remove non variables. - if (isset($form_state['values']['advagg_resource_hints_preload_reset'])) { - unset($form_state['values']['advagg_resource_hints_preload_reset']); - } - - // Reset this form to defaults or recommended values; also show what changed. - advagg_set_admin_form_defaults_recommended($form_state, 'advagg_admin_mode'); - - // Sort and fix values before saving to the db. - foreach ($form_state['values']['advagg_resource_hints_preload_settings'] as &$entry) { - if (isset($entry['weight'])) { - $entry['#weight'] = $entry['weight']; - unset($entry['weight']); - } - ksort($entry); - } - uasort($form_state['values']['advagg_resource_hints_preload_settings'], 'element_sort'); - - // Make sure .htaccess file exists in the advagg dir. - if (isset($form_state['values']['advagg_resource_hints_use_immutable']) - && variable_get('advagg_resource_hints_use_immutable', ADVAGG_RESOURCE_HINTS_USE_IMMUTABLE) != $form_state['values']['advagg_resource_hints_use_immutable'] - && variable_get('advagg_htaccess_check_generate', ADVAGG_HTACCESS_CHECK_GENERATE) - ) { - // Set variable. - variable_set('advagg_resource_hints_use_immutable', $form_state['values']['advagg_resource_hints_use_immutable']); - unset($form_state['values']['advagg_resource_hints_use_immutable']); - - // Get paths to .htaccess file. - list($css_path, $js_path) = advagg_get_root_files_dir(); - $files['css'] = $css_path[0] . '/.htaccess'; - $files['js'] = $js_path[0] . '/.htaccess'; - - // Make the advagg_htaccess_check_generate() function available. - module_load_include('inc', 'advagg', 'advagg.missing'); - - // Generate new .htaccess files in advagg dirs. - foreach ($files as $type => $uri) { - advagg_htaccess_check_generate(array($uri => $type), $type, TRUE); - } - } - - // Alter htaccess if needed. - if (isset($form_state['values']['advagg_htaccess_rewritebase']) - && variable_get('advagg_htaccess_rewritebase', ADVAGG_HTACCESS_REWRITEBASE) != $form_state['values']['advagg_htaccess_rewritebase'] - && variable_get('advagg_htaccess_check_generate', ADVAGG_HTACCESS_CHECK_GENERATE) - ) { - // Set variable. - variable_set('advagg_htaccess_rewritebase', trim($form_state['values']['advagg_htaccess_rewritebase'])); - unset($form_state['values']['advagg_htaccess_rewritebase']); - - // Get paths to .htaccess file. - list($css_path, $js_path) = advagg_get_root_files_dir(); - $files['css'] = $css_path[0] . '/.htaccess'; - $files['js'] = $js_path[0] . '/.htaccess'; - - // Make the advagg_htaccess_check_generate() function available. - module_load_include('inc', 'advagg', 'advagg.missing'); - - // Generate new .htaccess files in advagg dirs. - foreach ($files as $type => $uri) { - advagg_htaccess_check_generate(array($uri => $type), $type, TRUE); - } - } - - if (variable_get('advagg_htaccess_symlinksifownermatch', ADVAGG_HTACCESS_SYMLINKSIFOWNERMATCH) != $form_state['values']['advagg_htaccess_symlinksifownermatch'] - && variable_get('advagg_htaccess_check_generate', ADVAGG_HTACCESS_CHECK_GENERATE) - ) { - list($css_path, $js_path) = advagg_get_root_files_dir(); - $files['css'] = $css_path[0] . '/.htaccess'; - $files['js'] = $js_path[0] . '/.htaccess'; - - // Make the advagg_htaccess_check_generate() function available. - module_load_include('inc', 'advagg', 'advagg.missing'); - - // Push out new setting. - variable_set('advagg_htaccess_symlinksifownermatch', $form_state['values']['advagg_htaccess_symlinksifownermatch']); - unset($form_state['values']['advagg_htaccess_symlinksifownermatch']); - foreach ($files as $type => $uri) { - advagg_htaccess_check_generate(array($uri => $type), $type, TRUE); - } - } - - // Clear caches. - advagg_cache_clear_admin_submit(); -} - -/** - * Set or remove the AdvAggDisabled cookie. - */ -function advagg_admin_toggle_bypass_cookie($form, &$form_state) { - $cookie_name = 'AdvAggDisabled'; - $key = drupal_hmac_base64('advagg_cookie', drupal_get_private_key() . drupal_get_hash_salt() . variable_get('cron_key', 'drupal')); - - // If the cookie does exist then remove it. - if (!empty($_COOKIE[$cookie_name]) && $_COOKIE[$cookie_name] == $key) { - setcookie($cookie_name, '', -1, $GLOBALS['base_path'], '.' . $_SERVER['HTTP_HOST']); - unset($_COOKIE[$cookie_name]); - drupal_set_message(t('AdvAgg Bypass Cookie Removed.')); - } - // If the cookie does not exist then set it. - else { - // Cookie will last for 12 hours. - setcookie($cookie_name, $key, REQUEST_TIME + $form_state['values']['timespan'], $GLOBALS['base_path'], '.' . $_SERVER['HTTP_HOST']); - $_COOKIE[$cookie_name] = $key; - drupal_set_message(t('AdvAgg Bypass Cookie Set for %time.', array('%time' => format_interval($form_state['values']['timespan'])))); - } -} - -/** - * Display file info in a drupal message. - */ -function advagg_admin_get_file_info_submit($form, &$form_state) { - // @codingStandardsIgnoreLine - if (!empty($form_state['input']['ajax_page_state'])) { - return; - } - $info = advagg_admin_get_file_info($form_state['values']['filename']); - if (module_exists('httprl')) { - $output = httprl_pr($info); - } - else { - $output = '
' . check_plain(print_r($info, TRUE)) . '
'; - } - // @ignore security_dsm - drupal_set_message($output); -} - -/** - * Display file info via ajax callback. - */ -function advagg_admin_get_file_info_callback($form, &$form_state) { - if (!empty($form_state['values']['error'])) { - return '
'; - } - $info = advagg_admin_get_file_info($form_state['values']['filename']); - if (empty($info)) { - form_set_error('filename', t('Please input a valid aggregate filename.')); - return '
'; - } - else { - if (module_exists('httprl')) { - $output = httprl_pr($info); - } - else { - $output = '
' . print_r($info, TRUE) . '
'; - } - return '
' . $output . '
'; - } -} - -/** - * Verify that the filename is correct. - */ -function advagg_admin_get_file_info_validate($form, &$form_state) { - if (empty($form_state['values']['filename'])) { - form_set_error('filename', t('Please input an aggregate filename.')); - $form_state['values']['error'] = TRUE; - } -} - -/** - * Get detailed info about the given filename. - * - * @param string $filename - * Name of file to lookup. - * - * @return array - * Returns an array of detailed info about this file. - */ -function advagg_admin_get_file_info($filename) { - module_load_include('inc', 'advagg', 'advagg.missing'); - module_load_include('inc', 'advagg', 'advagg'); - - // Strip quotes and trim. - $filename = trim(str_replace(array('"', "'"), '', $filename)); - - $data = advagg_get_hashes_from_filename(basename($filename)); - $output = array(); - if (is_array($data)) { - list($type, $aggregate_filenames_hash, $aggregate_contents_hash) = $data; - - // Get a list of files. - $files = advagg_get_files_from_hashes($type, $aggregate_filenames_hash, $aggregate_contents_hash); - if (empty($files)) { - list($css_path, $js_path) = advagg_get_root_files_dir(); - // Skip if the file exists. - if ($type === 'css') { - $uri = $css_path[0] . '/' . $filename; - } - elseif ($type === 'js') { - $uri = $js_path[0] . '/' . $filename; - } - if (file_exists($uri)) { - $atime = advagg_get_atime($aggregate_filenames_hash, $aggregate_contents_hash, $uri); - if (REQUEST_TIME - $atime > variable_get('drupal_stale_file_threshold', 2592000)) { - $files = t('This is an old aggregate, it should be deleted on the next cron run.'); - } - else { - $files = t('This is an old aggregate, it should be deleted on the cron run after !time.', array('!time' => format_interval(variable_get('drupal_stale_file_threshold', 2592000) - (REQUEST_TIME - $atime)))); - } - } - else { - $files = t('This aggregate file no longer exists.'); - } - } - $data['files'] = $files; - - // Get detailed info on each file. - $files_info_filenames = array(); - foreach ($data['files'] as $filename => &$info) { - $files_info_filenames[] = $filename; - } - unset($info); - - // Get filesystem data. - $files_info = advagg_get_info_on_files($files_info_filenames); - - foreach ($data['files'] as $filename => &$info) { - $info += $files_info[$filename]; - if (module_exists('advagg_bundler')) { - $bundler = advagg_bundler_analysis($filename); - $info['group_hash'] = $bundler['group_hash']; - } - } - unset($info); - $output = $data; - } - else { - $results = db_select('advagg_files', 'af') - ->fields('af') - ->condition('filename', '%' . db_like($filename), 'LIKE') - ->execute(); - while ($row = $results->fetchAssoc()) { - $row += advagg_get_info_on_file($row['filename']); - if (module_exists('advagg_bundler')) { - $bundler = advagg_bundler_analysis($row['filename']); - $row['group_hash'] = $bundler['group_hash']; - } - $output[] = $row; - } - } - return $output; -} - -/** - * Reset the advagg_resource_hints_preload_settings variable. - */ -function advagg_admin_resource_hints_preload_reset() { - variable_del('advagg_resource_hints_preload_settings'); -} - -/** - * Recreate the advagg htaccess files. - */ -function advagg_admin_regenerate_htaccess_button() { - // Get paths to .htaccess file. - list($css_path, $js_path) = advagg_get_root_files_dir(); - $files['css'] = $css_path[0] . '/.htaccess'; - $files['js'] = $js_path[0] . '/.htaccess'; - - // Make the advagg_htaccess_check_generate() function available. - module_load_include('inc', 'advagg', 'advagg.missing'); - - // Generate new .htaccess files in advagg dirs. - $errors = array(); - foreach ($files as $type => $uri) { - $errors += advagg_htaccess_check_generate(array($uri => $type), $type, TRUE); - } - if (empty($errors)) { - drupal_set_message(t('The .htaccess files have been regenerated.')); - } - else { - drupal_set_message(t('The .htaccess files failed to be regenerated. @errors', array('@errors' => implode(', ', $errors)))); - } -} - -/** - * Perform a smart flush. - */ -function advagg_admin_flush_cache_button() { - // Clear the libraries cache. - if (function_exists('libraries_flush_caches')) { - $cache_tables = libraries_flush_caches(); - foreach ($cache_tables as $table) { - cache_clear_all('*', $table, TRUE); - } - } - - // Run the command. - module_load_include('inc', 'advagg', 'advagg.cache'); - $flushed = advagg_push_new_changes(); - - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 0) { - // Display a simple message if not in Development mode. - drupal_set_message(t('Advagg Cache Cleared')); - } - else { - list($css_path) = advagg_get_root_files_dir(); - $parts_uri = $css_path[1] . '/parts'; - - // Report back the results. - foreach ($flushed as $filename => $data) { - if (strpos($filename, $parts_uri) === 0) { - // Do not report on css files manged in the parts directory. - unset($flushed[$filename]); - continue; - } - $ext = pathinfo($filename, PATHINFO_EXTENSION); - drupal_set_message(t('The file %filename has changed. %db_usage aggregates are using this file. %db_count db cache entries and all %type full cache entries have been flushed from the cache bins. Trigger: @changes', array( - '%filename' => $filename, - '%db_usage' => $data[0], - '%db_count' => $data[1], - '@changes' => print_r($data[2], TRUE), - '%type' => $ext, - ))); - } - - if (empty($flushed)) { - drupal_set_message(t('No changes found. Nothing was cleared.')); - return; - } - } -} - -/** - * Clear out all advagg cache bins. - */ -function advagg_admin_clear_all_caches_button() { - // Clear the libraries cache. - if (function_exists('libraries_flush_caches')) { - $cache_tables = libraries_flush_caches(); - foreach ($cache_tables as $table) { - cache_clear_all('*', $table, TRUE); - } - } - - // Run the command. - module_load_include('inc', 'advagg', 'advagg.cache'); - advagg_flush_all_cache_bins(); - - // Report back the results. - drupal_set_message(t('All AdvAgg cache bins have been cleared.')); - // Clear it again at the end of the request to be sure. - drupal_register_shutdown_function('advagg_flush_all_cache_bins', FALSE); - drupal_register_shutdown_function('advagg_push_new_changes'); -} - -/** - * Clear out all advagg aggregated files. - */ -function advagg_admin_clear_all_files_button() { - // Run the command. - module_load_include('inc', 'advagg', 'advagg.cache'); - list($css_files, $js_files) = advagg_remove_all_aggregated_files(); - - // Report back the results. - drupal_set_message(t('All AdvAgg files have been deleted. %css_count CSS files and %js_count JS files have been removed.', array( - '%css_count' => count($css_files), - '%js_count' => count($js_files), - ))); -} - -/** - * Clear out all stale advagg aggregated files. - */ -function advagg_admin_flush_stale_files_button() { - // Run the command. - module_load_include('inc', 'advagg', 'advagg.cache'); - list($css_files, $js_files) = advagg_delete_stale_aggregates(); - - // Report back the results. - if (count($css_files) > 0 || count($js_files) > 0) { - drupal_set_message(t('All stale aggregates have been deleted. %css_count CSS files and %js_count JS files have been removed.', array( - '%css_count' => count($css_files), - '%js_count' => count($js_files), - ))); - } - else { - drupal_set_message(t('No stale aggregates found. Nothing was deleted.')); - } -} - -/** - * Delete all empty advagg aggregated files. - */ -function advagg_delete_empty_aggregates_button() { - // Run the command. - module_load_include('inc', 'advagg', 'advagg.cache'); - list($css_files, $js_files) = advagg_delete_empty_aggregates(); - - // Report back the results. - if (count($css_files) > 0 || count($js_files) > 0) { - drupal_set_message(t('All empty aggregates have been deleted. %css_count CSS files and %js_count JS files have been removed.', array( - '%css_count' => count($css_files), - '%js_count' => count($js_files), - ))); - } - else { - drupal_set_message(t('No empty aggregates found. Nothing was deleted.')); - } -} - -/** - * Clear out all advagg cache bins and increment the counter. - */ -function advagg_admin_increment_global_counter() { - // Clear out the cache. - advagg_admin_clear_all_caches_button(); - - // Increment counter. - module_load_include('inc', 'advagg', 'advagg.cache'); - $new_value = advagg_increment_global_counter(); - drupal_set_message(t('Global counter is now set to %new_value', array('%new_value' => $new_value))); -} - -/** - * Clear out all advagg cache bins and increment the counter. - */ -function advagg_admin_reset_mtime() { - // Reset mtime. - db_update('advagg_files') - ->fields(array( - 'mtime' => 0, - )) - ->execute(); - drupal_set_message(t('All files have been rescanned.')); - - // Smart cache clear. - advagg_admin_flush_cache_button(); - - // Clear out the cache. - advagg_admin_clear_all_caches_button(); -} - -/** - * Remove filesize zero files from the advagg_files table and clear caches. - */ -function advagg_admin_remove_empty_advagg_files() { - // Remove dead files from the advagg_files table. - db_delete('advagg_files') - ->condition('filesize', 0) - ->execute(); - variable_del('javascript_parsed'); - drupal_set_message(t('All empty files in the advagg_files table have been removed.')); - - // Clear out the cache. - advagg_admin_clear_all_caches_button(); -} - -/** - * Truncate the advagg_files table and clear caches. - */ -function advagg_admin_truncate_advagg_files() { - // Truncate advagg_files table. - db_truncate('advagg_files')->execute(); - variable_del('javascript_parsed'); - drupal_set_message(t('All files from the advagg_files table have been removed.')); - - // Clear out the cache. - advagg_admin_clear_all_caches_button(); -} - -/** - * Scan CSS/JS advagg dir and remove file if there is no associated db record. - */ -function advagg_admin_delete_orphaned_aggregates_button() { - module_load_include('inc', 'advagg', 'advagg.cache'); - - // Remove aggregates that include missing files. - $deleted = advagg_delete_orphaned_aggregates(); - if (empty($deleted[0]) && empty($deleted[1])) { - drupal_set_message(t('All files have an associated db record; nothing was deleted.')); - } - else { - drupal_set_message(t('Some files had no associated db record and could be safely deleted from the file system. @raw', array('@raw' => print_r($deleted[1], TRUE)))); - } -} - -/** - * Scan for missing files and remove the associated entries in the database. - */ -function advagg_admin_remove_missing_files_from_db_button() { - module_load_include('inc', 'advagg', 'advagg.cache'); - - // Remove aggregates that include missing files. - $deleted = advagg_remove_missing_files_from_db(); - if (empty($deleted)) { - drupal_set_message(t('No missing files found or they could not be safely cleared out of the database.')); - } - else { - drupal_set_message(t('Some missing files were found and could be safely cleared out of the database.
 @raw 
', array('@raw' => print_r($deleted, TRUE)))); - } -} - -/** - * Delete aggregates that have not been accessed in the last 6 weeks. - */ -function advagg_admin_remove_old_unused_aggregates_button() { - module_load_include('inc', 'advagg', 'advagg.cache'); - - // Remove unused aggregates. - $count = advagg_remove_old_unused_aggregates(); - if (empty($count)) { - drupal_set_message(t('No old and unused aggregates found. Nothing was deleted.')); - } - else { - drupal_set_message(t('Some old and unused aggregates were found. A total of %count database entries were removed.', array('%count' => $count))); - } -} - -/** - * Delete orphaned/expired advagg locks from the semaphore database table. - */ -function advagg_admin_cleanup_semaphore_table_button() { - module_load_include('inc', 'advagg', 'advagg.cache'); - - // Delete orphaned/expired advagg locks from the semaphore database table. - $count = advagg_cleanup_semaphore_table(); - if (empty($count)) { - drupal_set_message(t('No orphaned advagg semaphore database table locks discovered. Nothing was deleted.')); - } - else { - drupal_set_message(format_plural($count, '1 orphaned advagg semaphore database table lock was found. A total of 1 database entry was removed.', 'Some orphaned advagg semaphore database table locks were found. A total of @count database entries were removed.')); - } -} - -/** - * Delete orphaned/expired advagg locks from the semaphore database table. - */ -function advagg_admin_refresh_locale_files_button() { - module_load_include('inc', 'advagg', 'advagg.cache'); - - // Refresh all locale files. - $locale_files = advagg_refresh_all_locale_files(); - if (empty($locale_files)) { - drupal_set_message(t('No locale files are being used.')); - } - else { - drupal_set_message(t('The following locale files are being used:
@files
', array('@files' => print_r($locale_files, TRUE)))); - } -} - -/** - * Delete leftover temp files. - */ -function advagg_admin_cleanup_temp_files_button() { - module_load_include('inc', 'advagg', 'advagg.cache'); - - // Delete orphaned/expired advagg locks from the semaphore database table. - $count = advagg_remove_temp_files(); - if (empty($count)) { - drupal_set_message(t('No leftover temp files found. Nothing was deleted.')); - } - else { - drupal_set_message(format_plural($count, '1 leftover temp files from advagg was found. A total of 1 temp files was removed.', 'Some leftover temp files from advagg were found. A total of @count temp files were removed.')); - } -} - -/** - * Verify that the filename is correct. - */ -function advagg_admin_clear_file_aggregate_validate($form, &$form_state) { - if (empty($form_state['values']['filename'])) { - form_set_error('filename', t('Please input a filename.')); - $form_state['values']['error'] = TRUE; - } -} - -/** - * Display what files where deleted in a drupal message. - */ -function advagg_admin_clear_file_aggregate_submit($form, &$form_state) { - // @codingStandardsIgnoreLine - if (!empty($form_state['input']['ajax_page_state'])) { - return; - } - $info = advagg_admin_clear_file_aggregates($form_state['values']['filename']); - if (module_exists('httprl')) { - $output = httprl_pr($info); - } - else { - $output = '
' . check_plain(print_r($info, TRUE)) . '
'; - } - // @ignore security_dsm - drupal_set_message($output); -} - -/** - * Display what files where deleted via ajax callback. - */ -function advagg_admin_clear_file_aggregate_callback($form, &$form_state) { - if (!empty($form_state['values']['error'])) { - return '
'; - } - $info = advagg_admin_clear_file_aggregates($form_state['values']['filename']); - if (empty($info)) { - form_set_error('filename', t('Please input a valid filename.')); - return '
'; - } - else { - if (module_exists('httprl')) { - $output = httprl_pr($info); - } - else { - $output = '
' . print_r($info, TRUE) . '
'; - } - return '
' . $output . '
'; - } -} - -/** - * Remove the aggregates that contain the given filename. - * - * @param string $filename - * Name of file to lookup. Can be a comma separated list. - * @param bool $dry_run - * If TRUE, return the regex search string. - * - * @return array - * Returns an array of the parent file and what children where deleted. - */ -function advagg_admin_clear_file_aggregates($filename, $dry_run = FALSE) { - module_load_include('inc', 'advagg', 'advagg.cache'); - list($css_path, $js_path) = advagg_get_root_files_dir(); - $space = ADVAGG_SPACE; - $output = array(); - $options = array('callback' => 'file_unmanaged_delete'); - if ($dry_run) { - $options = array(); - } - - // Strip quotes and trim. - $filenames = array_map('trim', explode(',', trim(str_replace(array('"', "'"), '', $filename)))); - - foreach ($filenames as $filename) { - $results = db_select('advagg_files', 'af') - ->fields('af') - ->condition('filename', $filename) - ->execute(); - while ($row = $results->fetchAssoc()) { - // Get aggregates that use this file. - $row['aggregates_using_file'] = advagg_get_aggregates_using_file($row['filename_hash']); - // Get dir and other info from file. - if ($row['filetype'] === 'css') { - $dirname = $css_path[0]; - $basename_prefix = "{$row['filetype']}"; - } - if ($row['filetype'] === 'js') { - $dirname = $js_path[0]; - $basename_prefix = "{$row['filetype']}"; - } - - // Build regex search string for file_scan_directory(). - $regex_search = array(); - foreach ($row['aggregates_using_file'] as $values) { - $regex_search[] = preg_quote("{$basename_prefix}{$space}{$values['aggregate_filenames_hash']}{$space}") . '.*'; - } - $regex_search = array_unique($regex_search); - $regex_search_string = '/(' . implode('|', $regex_search) . ')/'; - $files = file_scan_directory($dirname, $regex_search_string, $options); - - // List what files were deleted. - $row['aggregates_deleted'] = array(); - $files_deleted = array_keys($files); - if (!empty($files_deleted)) { - $row['aggregates_deleted'][] = $files_deleted; - } - - $output[$filename] = $row['aggregates_deleted']; - } - } - - return $output; -} - -/** - * @} End of "defgroup advagg_forms_callback". - */ diff --git a/html/sites/all/modules/contrib/advagg/advagg.admin.js b/html/sites/all/modules/contrib/advagg/advagg.admin.js deleted file mode 100644 index 5a4e29ec2..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg.admin.js +++ /dev/null @@ -1,132 +0,0 @@ -/** - * @file - * Used to toggle the AdvAgg Bypass Cookie client side. - */ - -/* global Drupal:false */ -/* eslint-disable no-unused-vars */ - -/** - * Test to see if the given string contains unicode. - * - * @param {int} interval - * String to test. - * @param {int} granularity - * String to test. - * @param {string} langcode - * Language used in translation. - * - * @return {bool} - * true if string contains non ASCII characters. - * false if string only contains ASCII characters. - */ -Drupal.formatInterval = function (interval, granularity, langcode) { - 'use strict'; - granularity = typeof granularity !== 'undefined' ? granularity : 2; - langcode = typeof langcode !== 'undefined' ? langcode : null; - var output = ''; - - /* eslint-disable key-spacing */ - while (granularity > 0) { - var value = 0; - if (interval >= 31536000) { - value = 31536000; - output += (output.length ? ' ' : '') + Drupal.formatPlural(Math.floor(interval / value), '1 year', '@count years', {langcode : langcode}); - } - else if (interval >= 2592000) { - value = 2592000; - output += (output.length ? ' ' : '') + Drupal.formatPlural(Math.floor(interval / value), '1 month', '@count months', {langcode : langcode}); - } - else if (interval >= 604800) { - value = 604800; - output += (output.length ? ' ' : '') + Drupal.formatPlural(Math.floor(interval / value), '1 week', '@count weeks', {langcode : langcode}); - } - else if (interval >= 86400) { - value = 86400; - output += (output.length ? ' ' : '') + Drupal.formatPlural(Math.floor(interval / value), '1 day', '@count days', {langcode : langcode}); - } - else if (interval >= 3600) { - value = 3600; - output += (output.length ? ' ' : '') + Drupal.formatPlural(Math.floor(interval / value), '1 hour', '@count hours', {langcode : langcode}); - } - else if (interval >= 60) { - value = 60; - output += (output.length ? ' ' : '') + Drupal.formatPlural(Math.floor(interval / value), '1 min', '@count min', {langcode : langcode}); - } - else if (interval >= 1) { - value = 1; - output += (output.length ? ' ' : '') + Drupal.formatPlural(Math.floor(interval / value), '1 sec', '@count sec', {langcode : langcode}); - } - - interval %= value; - granularity--; - } - - return output.length ? output : Drupal.t('0 sec', {}, {langcode : langcode}); - /* eslint-enable key-spacing */ -}; - -/** - * Test to see if the given string contains unicode. - * - * @param {string} str - * String to test. - * - * @return {bool} - * true if string contains non ASCII characters. - * false if string only contains ASCII characters. - */ -function advagg_is_unicode(str) { - 'use strict'; - for (var i = 0, n = str.length; i < n; i++) { - if (str.charCodeAt(i) > 255) { - return true; - } - } - return false; -} - -/** - * Toggle the advagg cookie. - * - * @return {bool} - * true if hostname contains unicode. - * false so the form does not get submitted. - */ -function advagg_toggle_cookie() { - 'use strict'; - // Fallback to submitting the form for Unicode domains like ".рф". - if (advagg_is_unicode(document.location.hostname)) { - return true; - } - - var cookie_name = 'AdvAggDisabled'; - - // See if the cookie exists. - var cookie_pos = document.cookie.indexOf(cookie_name + '=' + Drupal.settings.advagg.key); - - // If the cookie does exist then remove it. - if (cookie_pos !== -1) { - document.cookie = - cookie_name + '=' - + '; expires=Thu, 01 Jan 1970 00:00:00 GMT' - + '; path=' + Drupal.settings.basePath - + '; domain=.' + document.location.hostname + ';'; - alert(Drupal.t('AdvAgg Bypass Cookie Removed')); - } - // If the cookie does not exist then set it. - else { - var bypass_length = document.getElementById('edit-timespan').value; - var expire_date = new Date(new Date().getTime() + bypass_length * 1000); - - document.cookie = - cookie_name + '=' + Drupal.settings.advagg.key - + '; expires=' + expire_date.toGMTString() - + '; path=' + Drupal.settings.basePath - + '; domain=.' + document.location.hostname + ';'; - alert(Drupal.t('AdvAgg Bypass Cookie Set for @time.', {'@time': Drupal.formatInterval(bypass_length)})); - } - - // Must return false, if returning true then form gets submitted. - return false; -} diff --git a/html/sites/all/modules/contrib/advagg/advagg.advagg.inc b/html/sites/all/modules/contrib/advagg/advagg.advagg.inc deleted file mode 100644 index bd6aba380..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg.advagg.inc +++ /dev/null @@ -1,662 +0,0 @@ - $contents). - // * @param array $aggregate_settings - // * Array of settings. - // * @param array $other_parameters - // * Array of containing $files and $type. - $file_types = array(); - // Handle gzip. - if (!empty($aggregate_settings['variables']['advagg_gzip'])) { - // Use zopfli_encode if it exists. - // See https://github.com/kjdev/php-ext-zopfli - if (function_exists('zopfli_encode') - && defined('ZOPFLI_GZIP') - && empty($aggregate_settings['variables']['advagg_no_zopfli']) - ) { - $file_types['.gz'] = array('zopfli_encode', 15, constant('ZOPFLI_GZIP')); - } - else { - $file_types['.gz'] = array('gzencode', 9, FORCE_GZIP); - } - } - // Handle brotli. - // See https://github.com/kjdev/php-ext-brotli - if (!empty($aggregate_settings['variables']['advagg_brotli']) - && defined('BROTLI_TEXT') - && function_exists('brotli_compress') - ) { - $file_types['.br'] = array('brotli_compress', 11, constant('BROTLI_TEXT')); - } - - if (empty($file_types)) { - return; - } - - // Special S3 handling. - $s3fs = FALSE; - $files_to_save_keys = array_keys($files_to_save); - foreach ($files_to_save_keys as $uri) { - $wrapper = file_stream_wrapper_get_instance_by_uri($uri); - if ($wrapper && get_class($wrapper) === 'S3fsStreamWrapper') { - $s3fs = TRUE; - break; - } - } - - foreach ($file_types as $ext => $settings) { - // See if a file already exists with this extension. - $ext_exists = FALSE; - foreach ($files_to_save as $uri => $contents) { - // See if this uri contains $ext near the end of it. - if (strlen($uri) > 91 + strlen(ADVAGG_SPACE) * 3) { - $pos = strripos($uri, $ext, 91 + strlen(ADVAGG_SPACE) * 3); - } - else { - $pos = strripos($uri, $ext); - } - if (!empty($pos)) { - $len = strlen($uri); - // $ext file exists, exit loop. - if ($pos == $len - 3) { - $ext_exists = TRUE; - break; - } - } - } - - // If a $ext file does not exist, create one. - if (!$ext_exists) { - // Use the first file in the array. - $data = reset($files_to_save); - $uri = key($files_to_save); - // Compress it and add it to the $files_to_save array. - $callback = $settings[0]; - $settings[0] = $data; - $compressed = call_user_func_array($callback, $settings); - if (!empty($compressed)) { - if ($s3fs && $ext === '.gz') { - // Only serve gzip files from S3. - $files_to_save[$uri] = $compressed; - } - elseif ($s3fs && $ext === '.br' && !isset($file_types['.gz'])) { - // Only serve br files from S3. - $files_to_save[$uri] = $compressed; - } - else { - $files_to_save[$uri . $ext] = $compressed; - } - } - } - } -} - -/** - * Implements hook_advagg_build_aggregate_plans_alter(). - * - * Used to alter the plan so it has the same grouping as cores. - */ -function advagg_advagg_build_aggregate_plans_alter(array &$files, &$modified, $type) { - // * @param array $files - // * List of files in the aggregate as well as the aggregate name. - // * @param bool $modified - // * Change this to TRUE if $files has been changed. - // * @param string $type - // * String containing css or js. - // - // Do nothing if core grouping is disabled. - if (!variable_get('advagg_core_groups', ADVAGG_CORE_GROUPS)) { - return; - } - - $temp_new_files = array(); - $counter = 0; - foreach ($files as $data) { - $group = NULL; - $every_page = NULL; - foreach ($data['files'] as $fileinfo) { - // Grouped by group and every_page variables. - if (is_null($group)) { - $group = $fileinfo['group']; - } - if (is_null($every_page)) { - $every_page = $fileinfo['every_page']; - } - - // Bump Counter if group/every_page has changed from the last one. - if ($group != $fileinfo['group'] || $every_page != $fileinfo['every_page']) { - ++$counter; - $group = $fileinfo['group']; - $every_page = $fileinfo['every_page']; - $modified = TRUE; - } - $temp_new_files[$counter][] = $fileinfo; - } - ++$counter; - } - - // Replace $files array with new aggregate filenames. - $files = advagg_generate_filenames(array($temp_new_files), $type); -} - -/** - * Implements hook_advagg_context_alter(). - */ -function advagg_advagg_context_alter(&$original, $aggregate_settings, $mode) { - if ($mode == 0) { - // Change context. - $original['base_root'] = $GLOBALS['base_root']; - $original['base_url'] = $GLOBALS['base_url']; - $original['base_path'] = $GLOBALS['base_path']; - $original['is_https'] = $GLOBALS['is_https']; - $original['language'] = isset($GLOBALS['language']) ? $GLOBALS['language'] : NULL; - - $GLOBALS['is_https'] = $aggregate_settings['variables']['is_https']; - if ($aggregate_settings['variables']['is_https']) { - $GLOBALS['base_root'] = str_replace('http://', 'https://', $GLOBALS['base_root']); - } - else { - $GLOBALS['base_root'] = str_replace('https://', 'http://', $GLOBALS['base_root']); - } - $GLOBALS['base_path'] = $aggregate_settings['variables']['base_path']; - $GLOBALS['base_url'] = rtrim($GLOBALS['base_root'] . $GLOBALS['base_path'], '/'); - - if (isset($aggregate_settings['variables']['language'])) { - $languages = language_list(); - if (isset($languages[$aggregate_settings['variables']['language']])) { - $GLOBALS['language'] = $languages[$aggregate_settings['variables']['language']]; - } - } - } - elseif ($mode == 1) { - // Change context back. - if (isset($original['base_root'])) { - $GLOBALS['base_root'] = $original['base_root']; - } - if (isset($original['base_url'])) { - $GLOBALS['base_url'] = $original['base_url']; - } - if (isset($original['base_path'])) { - $GLOBALS['base_path'] = $original['base_path']; - } - if (isset($original['is_https'])) { - $GLOBALS['is_https'] = $original['is_https']; - } - if (isset($original['language'])) { - $GLOBALS['language'] = $original['language']; - } - } - - // Moved this in here due to incomplete bug reports from - // https://www.drupal.org/node/1942230. I can not reproduce the reported - // issues with the patch for the CDN module so I've moved the code into - // advagg. - if (!function_exists('cdn_advagg_context_alter') && module_exists('cdn')) { - if ($mode == 0) { - // Save original context. - $original[CDN_MODE_VARIABLE] = variable_get(CDN_MODE_VARIABLE, CDN_MODE_BASIC); - $original[CDN_BASIC_FARFUTURE_VARIABLE] = variable_get(CDN_BASIC_FARFUTURE_VARIABLE, CDN_BASIC_FARFUTURE_DEFAULT); - $original[CDN_HTTPS_SUPPORT_VARIABLE] = variable_get(CDN_HTTPS_SUPPORT_VARIABLE, FALSE); - $original[CDN_STATUS_VARIABLE] = variable_get(CDN_STATUS_VARIABLE, CDN_DISABLED); - - // Set context for file_create_url()/cdn_file_url_alter(). - $GLOBALS['conf'][CDN_MODE_VARIABLE] = isset($aggregate_settings['variables'][CDN_MODE_VARIABLE]) - ? $aggregate_settings['variables'][CDN_MODE_VARIABLE] - : variable_get(CDN_MODE_VARIABLE, CDN_MODE_BASIC); - $GLOBALS['conf'][CDN_BASIC_FARFUTURE_VARIABLE] = isset($aggregate_settings['variables'][CDN_BASIC_FARFUTURE_VARIABLE]) - ? $aggregate_settings['variables'][CDN_BASIC_FARFUTURE_VARIABLE] - : variable_get(CDN_BASIC_FARFUTURE_VARIABLE, CDN_BASIC_FARFUTURE_DEFAULT); - $GLOBALS['conf'][CDN_HTTPS_SUPPORT_VARIABLE] = isset($aggregate_settings['variables'][CDN_HTTPS_SUPPORT_VARIABLE]) - ? $aggregate_settings['variables'][CDN_HTTPS_SUPPORT_VARIABLE] - : variable_get(CDN_HTTPS_SUPPORT_VARIABLE, FALSE); - $GLOBALS['conf'][CDN_STATUS_VARIABLE] = isset($aggregate_settings['variables'][CDN_STATUS_VARIABLE]) - ? $aggregate_settings['variables'][CDN_STATUS_VARIABLE] - : variable_get(CDN_STATUS_VARIABLE, CDN_DISABLED); - - // Disable CDN if cdn_check_drupal_path is FALSE. - if (empty($aggregate_settings['variables']['cdn_check_drupal_path'])) { - $original[CDN_STATUS_VARIABLE] = CDN_DISABLED; - } - - // Handle HTTPS. - if (!empty($aggregate_settings['variables']['cdn_request_is_https']) && !cdn_request_is_https()) { - if (isset($_SERVER['HTTPS'])) { - $original['HTTPS'] = $_SERVER['HTTPS']; - } - else { - $original['HTTPS'] = FALSE; - } - $_SERVER['HTTPS'] = 'on'; - } - } - elseif ($mode == 1) { - // Set context back. - $GLOBALS['conf'][CDN_MODE_VARIABLE] = $original[CDN_MODE_VARIABLE]; - $GLOBALS['conf'][CDN_BASIC_FARFUTURE_VARIABLE] = $original[CDN_BASIC_FARFUTURE_VARIABLE]; - $GLOBALS['conf'][CDN_HTTPS_SUPPORT_VARIABLE] = $original[CDN_HTTPS_SUPPORT_VARIABLE]; - $GLOBALS['conf'][CDN_STATUS_VARIABLE] = $original[CDN_STATUS_VARIABLE]; - - // Handle HTTPS. - if (isset($original['HTTPS']) && !is_null($original['HTTPS'])) { - $_SERVER['HTTPS'] = $original['HTTPS']; - } - } - } -} - -/** - * Implements hook_advagg_get_info_on_files_alter(). - * - * Used to make sure the info is up to date in the cache. - */ -function advagg_advagg_get_info_on_files_alter(&$return, $cached_data, $bypass_cache) { - // Check for the ie_css_selector_limiter. - if (variable_get('advagg_ie_css_selector_limiter', ADVAGG_IE_CSS_SELECTOR_LIMITER)) { - $limit_value = variable_get('advagg_ie_css_selector_limiter_value', ADVAGG_IE_CSS_SELECTOR_LIMITER_VALUE); - - // Get the css path. - list($css_path) = advagg_get_root_files_dir(); - $css_parts_path = (advagg_s3fs_evaluate_no_rewrite_cssjs(FALSE)) ? $css_path[0] : $css_path[1]; - $parts_path = $css_parts_path . '/parts/'; - - foreach ($return as &$info) { - // Skip if not a css file. - if (empty($info['fileext']) || $info['fileext'] !== 'css') { - continue; - } - - // Check if this is a split css file. - if (strpos($info['data'], $parts_path) !== FALSE) { - $info['split'] = TRUE; - } - // Break large file into multiple small files if needed. - elseif ($info['linecount'] > $limit_value) { - advagg_split_css_file($info); - } - } - unset($info); - } - - // Capture resource_hints. - if (variable_get('advagg_resource_hints_dns_prefetch', ADVAGG_RESOURCE_HINTS_DNS_PREFETCH) - || variable_get('advagg_resource_hints_preconnect', ADVAGG_RESOURCE_HINTS_PRECONNECT) - || variable_get('advagg_resource_hints_preload', ADVAGG_RESOURCE_HINTS_PRELOAD) - ) { - $aggregate_settings = advagg_current_hooks_hash_array(); - foreach ($return as &$info) { - // Skip if not a css file. - if (empty($info['fileext']) || $info['fileext'] !== 'css') { - continue; - } - // Get the file contents. - $file_contents = (string) @advagg_file_get_contents($info['data']); - $file_contents = advagg_load_css_stylesheet($info['data'], FALSE, $aggregate_settings, $file_contents); - - // Get domain names and external assets in this css file. - $hosts = array(); - $urls = array(); - $matches = array(); - $pattern = '%url\(\s*+[\'"]?+(http:\/\/|https:\/\/|\/\/)([^\'"()\s]++)[\'"]?+\s*+\)%i'; - preg_match_all($pattern, $file_contents, $matches); - if (!empty($matches[1])) { - foreach ($matches[1] as $key => $match) { - $url = $match . $matches[2][$key]; - $parse = @parse_url($url); - if (!empty($parse['host'])) { - $extra = ''; - $ext = strtolower(pathinfo($url, PATHINFO_EXTENSION)); - $supported = array( - 'eot', - 'woff2', - 'woff', - 'ttf', - 'otf', - ); - if (in_array($ext, $supported)) { - $extra .= '#crossorigin'; - } - $hosts[$parse['host'] . $extra] = $match . $parse['host'] . '/' . $extra; - $urls[$url] = $url; - } - } - } - if (!empty($hosts) && (variable_get('advagg_resource_hints_dns_prefetch', ADVAGG_RESOURCE_HINTS_DNS_PREFETCH) - || variable_get('advagg_resource_hints_preconnect', ADVAGG_RESOURCE_HINTS_PRECONNECT) - )) { - $info['dns_prefetch'] = array_values($hosts); - } - - // Get local files to preload in this css file. - if (variable_get('advagg_resource_hints_preload', ADVAGG_RESOURCE_HINTS_PRELOAD)) { - $matches = array(); - $pattern = '/url\(\s*+[\'"]?(.*?)[\'"\s]?+\)/i'; - preg_match_all($pattern, $file_contents, $matches); - if (!empty($matches[1])) { - foreach ($matches[1] as $key => $match) { - $url = advagg_convert_abs_to_rel($match); - $parse = @parse_url($url); - if (empty($parse['host'])) { - $urls[$url] = $url; - } - } - } - if (!empty($urls)) { - $info['preload'] = array_values($urls); - } - } - } - unset($info); - } -} - -/** - * Implements hook_advagg_changed_files(). - * - * If the color module is enabled regenerate color module css when it changes. - * If a responsive file inside an adaptive theme has changed, regenerate it. - */ -function advagg_advagg_changed_files(array $files, array $types) { - // * @param array $files - // * List of files that have changed. - // * @param array $types - // * Array with the css and or the js key. - if (module_exists('locale')) { - _advagg_locale_changed_files($files, $types); - } - - // Keep track of what themes have been done. - static $themes_done; - if (!isset($themes_done)) { - $themes_done = array(); - } - - // Skip if no css changed. - if (empty($types['css'])) { - return; - } - - foreach ($files as $filename => $meta_data) { - // Only care about css files. - $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - if ($ext !== 'css') { - continue; - } - advagg_advagg_scan_for_changes($filename, TRUE); - } - - // Save error states and clear them. - $errors_before = drupal_static('form_set_error', array()); - form_clear_error(); - - // See if the css file is used the theme. - $themes = list_themes(); - $changed_files = array_keys($files); - - $submit_ran = FALSE; - foreach ($themes as $theme_name => $theme_values) { - $files_in_theme = array(); - foreach ($changed_files as $css_file) { - // Skip if we already did a form submit for this theme. - if (!empty($themes_done[$theme_name])) { - continue; - } - - // Skip if the file that was changed is not in this themes directory. - $theme_path = drupal_get_path('theme', $theme_name); - if ((!empty($theme_path)) && strpos($css_file, $theme_path) !== 0) { - continue; - } - $files_in_theme[] = $css_file; - } - - // Skip the theme if none of the changed files live in here. - if (empty($files_in_theme)) { - continue; - } - - // Get the form for this theme. - $router_item = menu_get_item('admin/appearance/settings/' . $theme_name); - if ($router_item['include_file']) { - require_once DRUPAL_ROOT . '/' . $router_item['include_file']; - } - $form = drupal_get_form('system_theme_settings', $theme_name); - // Get the form defaults. - $defaults = array(); - advagg_get_defaults_from_form($defaults, $form); - - $rebuild = FALSE; - if (isset($defaults['atcore_version_test'])) { - // Rebuild if the theme is an adaptive theme. - $rebuild = TRUE; - } - if (!$rebuild && module_exists('color')) { - foreach ($files_in_theme as $css_file) { - if (isset($form['color'])) { - // Rebuild if the file that was changed is a color module file. - foreach ($defaults['info']['css'] as $theme_file) { - if ($theme_path . '/' . $theme_file === $css_file) { - $rebuild = TRUE; - break 2; - } - } - } - } - } - - // Skip if themes css does not need to be generated dynamically. - if (empty($rebuild)) { - continue; - } - - // Build the palette value. - $palette = array(); - if (isset($form['color'])) { - foreach (element_children($form['color']['palette']) as $key) { - $palette[$key] = $form['color']['palette'][$key]['#value']; - } - } - - // Build the form state array. - $form_state = array( - 'values' => array('palette' => $palette), - 'build_info' => array('args' => array(0 => $theme_name)), - ); - $form_state['values'] += $defaults; - - if (isset($defaults['atcore_version_test'])) { - // Validate form. - at_core_settings_validate($form, $form_state); - $errors = form_set_error(); - if (empty($errors)) { - // Only submit if no errors. - at_core_settings_submit($form, $form_state); - $themes_done[$theme_name] = TRUE; - $submit_ran = TRUE; - } - } - elseif (isset($form['color'])) { - // Validate form. - color_scheme_form_validate($form, $form_state); - $errors = form_set_error(); - if (empty($errors)) { - // Only submit if no errors. - color_scheme_form_submit($form, $form_state); - $themes_done[$theme_name] = TRUE; - $submit_ran = TRUE; - } - } - // Reset form errors. - form_clear_error(); - } - // Save error states back. - $form_set_error = &drupal_static('form_set_error', array()); - $form_set_error = $errors_before; - - // Rescan again as the submit will generate new files in the css dir. - if ($submit_ran) { - advagg_push_new_changes(); - } -} - -/** - * Implements hook_advagg_scan_for_changes(). - * - * Used to see if the responsive files inside an adaptive theme has changed. - */ -function advagg_advagg_scan_for_changes($filename, $save_changes = FALSE) { - // Skip if this file is not a css file. - $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - if ($ext !== 'css') { - return FALSE; - } - - // Skip if the file is not in an adaptive theme. - $adaptivethemes = array(); - $themes = list_themes(); - foreach ($themes as $theme_name => $theme_values) { - $path = variable_get('theme_' . $theme_name . '_files_directory', ''); - if (!empty($path) && strpos($filename, $path) !== FALSE) { - $adaptivethemes[$theme_name] = $path; - } - } - if (empty($adaptivethemes)) { - return; - } - - $file_changed = array(); - foreach ($adaptivethemes as $theme_name => $path) { - // Set up some paths we use to get and save files. - $path_to_responsive_css = drupal_get_path('theme', $theme_name) . '/css/'; - $path_to_panels_css = drupal_get_path('theme', 'adaptivetheme') . '/layouts/css/'; - - // Map files to generated file names. - $file_map = array( - "$path/$theme_name.responsive.styles.css" => array( - $path_to_responsive_css . 'responsive.custom.css', - $path_to_responsive_css . 'responsive.smalltouch.portrait.css', - $path_to_responsive_css . 'responsive.smartphone.portrait.css', - $path_to_responsive_css . 'responsive.smalltouch.landscape.css', - $path_to_responsive_css . 'responsive.smartphone.landscape.css', - $path_to_responsive_css . 'responsive.tablet.portrait.css', - $path_to_responsive_css . 'responsive.tablet.landscape.css', - $path_to_responsive_css . 'responsive.desktop.css', - ), - "$path/$theme_name.lt-ie8.layout.css" => array( - $path_to_panels_css . 'ie_defaults.css', - ), - ); - if (!isset($file_map[$filename])) { - continue; - } - - // See if anything has changed. - $changes = advagg_detect_subfile_changes($filename, $file_map[$filename], 'adaptivetheme', $save_changes); - if (!empty($changes)) { - $file_changed[$path] = $changes; - } - } - - return $file_changed; -} - -/** - * @} End of "addtogroup advagg_hooks". - */ - -/** - * If the locale module is enabled regenerate locale translations. - * - * @param array $files - * List of files that have changed. - * @param array $types - * Array with the css and or the js key. - */ -function _advagg_locale_changed_files(array $files, array $types) { - // Skip if no js changed. - if (empty($types['js'])) { - return; - } - - $javascript = array(); - foreach ($files as $filename => $meta_data) { - // Only care about js files. - $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - if ($ext !== 'js') { - continue; - } - $javascript[] = array( - 'type' => 'file', - 'data' => $filename, - ); - } - if (!empty($javascript)) { - $javascript_before = $javascript; - $language_before = $GLOBALS['language']; - $language_list = language_list(); - foreach ($language_list as $lang) { - if ($lang->enabled) { - $GLOBALS['language'] = $lang; - $javascript = $javascript_before; - _advagg_locale_js_alter($javascript); - } - } - $GLOBALS['language'] = $language_before; - } -} - -/** - * Given a form get the default values from it. - * - * @param array $defaults - * An empty array used to populate the default values. - * @param array $form - * The form returned from drupal_get_form(). - * @param string $parent_key - * The key name of the parent. - */ -function advagg_get_defaults_from_form(array &$defaults, array $form, $parent_key = '') { - foreach (element_children($form) as $key) { - $values = $form[$key]; - if (isset($values['#value'])) { - // Grab defaults at this level. - if (!isset($defaults[$key])) { - $defaults[$key] = $values['#value']; - } - else { - $defaults[$parent_key . '-' . $key] = $values['#value']; - } - } - elseif (isset($values['#default_value'])) { - // Grab defaults at this level. - if (!isset($defaults[$key])) { - $defaults[$key] = $values['#default_value']; - } - else { - $defaults[$parent_key . '-' . $key] = $values['#default_value']; - } - } - elseif (is_array($values)) { - // Go deeper if needed. - advagg_get_defaults_from_form($defaults, $values, $key); - } - } -} diff --git a/html/sites/all/modules/contrib/advagg/advagg.api.php b/html/sites/all/modules/contrib/advagg/advagg.api.php deleted file mode 100644 index b0e68d0d9..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg.api.php +++ /dev/null @@ -1,700 +0,0 @@ - $data) { - if ($filename) { - // This is the filename. - } - $group = NULL; - $every_page = NULL; - foreach ($data['files'] as $fileinfo) { - // Grouped by group and every_page variables. - if (is_null($group)) { - $group = $fileinfo['group']; - } - if (is_null($every_page)) { - $every_page = $fileinfo['every_page']; - } - - // Bump Counter if group/every_page has changed from the last one. - if ($group != $fileinfo['group'] || $every_page != $fileinfo['every_page']) { - ++$counter; - $group = $fileinfo['group']; - $every_page = $fileinfo['every_page']; - $modified = TRUE; - } - $temp_new_files[$counter][] = $fileinfo; - } - ++$counter; - } - - // Replace $files array with new aggregate filenames. - $files = advagg_generate_filenames(array($temp_new_files), $type); -} - -/** - * Let other modules know about the changed files. - * - * @param array $files - * An associative array. - * filename - meta_data. - * @param array $types - * Array containing css and/or js. - * - * @return array - * Not used currently. - * - * @see advagg_push_new_changes() - * @see advagg_js_compress_advagg_changed_files() - */ -function hook_advagg_changed_files(array $files, array $types) { - // Only care about js files. - if (empty($types['js'])) { - return array(); - } - $return = array(); - foreach ($files as $filename => $meta_data) { - // Only care about js files. - $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - if ($ext !== 'js') { - continue; - } - - $return[$filename] = advagg_js_compress_run_test($filename); - } - return $return; -} - -/** - * Allow other modules to add in their own settings and hooks. - * - * @param array $aggregate_settings - * An associative array of hooks and settings used. - * - * @see advagg_current_hooks_hash_array() - * @see advagg_js_compress_advagg_current_hooks_hash_array_alter() - */ -function hook_advagg_current_hooks_hash_array_alter(array &$aggregate_settings) { - $aggregate_settings['variables']['advagg_js_compressor'] = variable_get('advagg_js_compressor', ADVAGG_JS_COMPRESSOR); - $aggregate_settings['variables']['advagg_js_compress_packer'] = variable_get('advagg_js_compress_packer', ADVAGG_JS_COMPRESS_PACKER); - $aggregate_settings['variables']['advagg_js_compress_max_ratio'] = variable_get('advagg_js_compress_max_ratio', ADVAGG_JS_COMPRESS_MAX_RATIO); -} - -/** - * Allow other modules to alter the contents and add new files to save (.gz). - * - * @param array $files_to_save - * Array($uri => $contents). - * @param array $aggregate_settings - * Array of settings. - * @param array $other_parameters - * Array of containing $files and $type. - * - * @see advagg_save_aggregate() - * @see advagg_advagg_save_aggregate_alter() - */ -function hook_advagg_save_aggregate_alter(array &$files_to_save, array $aggregate_settings, array $other_parameters) { - // Return if gzip is disabled. - if (empty($aggregate_settings['variables']['advagg_gzip'])) { - return; - } - - // See if a .gz file already exists. - $gzip_exists = FALSE; - foreach ($files_to_save as $uri => $contents) { - // See if this uri contains .gz near the end of it. - $pos = strripos($uri, '.gz', 91 + strlen(ADVAGG_SPACE) * 3); - if (!empty($pos)) { - $len = strlen($uri); - // .gz file exists, exit loop. - if ($pos == $len - 3) { - $gzip_exists = TRUE; - break; - } - } - } - - // If a .gz file does not exist, create one. - if (!$gzip_exists) { - // Use the first file in the array. - $data = reset($files_to_save); - $uri = key($files_to_save); - // Compress it and add it to the $files_to_save array. - $compressed = gzencode($data, 9, FORCE_GZIP); - $files_to_save[$uri . '.gz'] = $compressed; - } -} - -/** - * Allow other modules to alter css and js paths. - * - * @param array $css_paths - * Array containing the local path and url path. - * @param array $js_paths - * Array containing the local path and url path. - * - * @see advagg_get_root_files_dir() - * @see advagg_mod_advagg_get_root_files_dir_alter() - */ -function hook_advagg_get_root_files_dir(array &$css_paths, array &$js_paths) { - $dir = rtrim(variable_get('advagg_mod_unified_multisite_dir', ''), '/'); - if (empty($dir) || !file_exists($dir) || !is_dir($dir)) { - return; - } - // Change directory. - $css_paths[0] = $dir . '/advagg_css'; - $js_paths[0] = $dir . '/advagg_js'; - - file_prepare_directory($css_paths[0], FILE_CREATE_DIRECTORY); - file_prepare_directory($js_paths[0], FILE_CREATE_DIRECTORY); - - // Set the URI of the directory. - $css_paths[1] = advagg_get_relative_path($css_paths[0]); - $js_paths[1] = advagg_get_relative_path($js_paths[0]); -} - -/** - * Allow other modules to modify this aggregates contents. - * - * @param string $data - * Raw CSS data. - * @param array $files - * List of files used to create this aggregate. - * @param array $aggregate_settings - * An associative array of hooks and settings used. - * - * @see advagg_get_css_aggregate_contents() - * @see advagg_css_compress_advagg_get_css_aggregate_contents_alter() - */ -function hook_advagg_get_css_aggregate_contents_alter(&$data, array $files, array $aggregate_settings) { - if (empty($aggregate_settings['variables']['advagg_css_compressor'])) { - return; - } - - if ($aggregate_settings['variables']['advagg_css_compressor'] == 2) { - advagg_css_compress_yui_cssmin($data); - } -} - -/** - * Allow other modules to modify this aggregates contents. - * - * @param string $data - * Raw JS data. - * @param array $files - * List of files used to create this aggregate. - * @param array $aggregate_settings - * An associative array of hooks and settings used. - * - * @see advagg_get_js_aggregate_contents() - * @see advagg_js_compress_advagg_get_js_aggregate_contents_alter() - */ -function hook_advagg_get_js_aggregate_contents_alter(&$data, array $files, array $aggregate_settings) { - // Do nothing if js file compression is disabled. - if (empty($aggregate_settings['variables']['advagg_js_compressor'])) { - return; - } - - // Compress it. - $filename = drupal_hash_base64(serialize($files)); - advagg_js_compress_prep($data, $filename, $aggregate_settings, FALSE); -} - -/** - * Allow other modules to modify this files contents. - * - * @param string $contents - * Raw file data. - * @param string $file - * Filename. - * @param array $aggregate_settings - * An associative array of hooks and settings used. - * - * @see advagg_get_css_aggregate_contents() - * @see advagg_css_compress_advagg_get_css_aggregate_contents_alter() - */ -function hook_advagg_get_css_file_contents_alter(&$contents, $file, array $aggregate_settings) { - if (empty($aggregate_settings['variables']['advagg_css_compressor'])) { - return; - } - - if ($aggregate_settings['variables']['advagg_css_compressor'] == 2) { - advagg_css_compress_yui_cssmin($contents); - } -} - -/** - * Allow other modules to modify this files contents. - * - * @param string $contents - * Raw file data. - * @param string $filename - * Filename. - * @param array $aggregate_settings - * An associative array of hooks and settings used. - * - * @see advagg_get_css_aggregate_contents() - * @see advagg_css_compress_advagg_get_css_aggregate_contents_alter() - */ -function hook_advagg_get_js_file_contents_alter(&$contents, $filename, array $aggregate_settings) { - // Do nothing if js file compression is disabled. - if (empty($aggregate_settings['variables']['advagg_js_compressor'])) { - return; - } - - // Make sure this file has been tested. - $compressor = $aggregate_settings['variables']['advagg_js_compressor']; - module_load_include('inc', 'advagg', 'advagg'); - $info = advagg_get_info_on_file($filename); - if (!isset($info['advagg_js_compress'][$compressor]['code'])) { - // Test file here on the spot. - $info = advagg_js_compress_run_test($filename); - } - - // Compress it if it passes the test. - if (!empty($info['advagg_js_compress'][$compressor]['code']) && $info['advagg_js_compress'][$compressor]['code'] == 1) { - advagg_js_compress_prep($contents, $filename, $aggregate_settings); - } -} - -/** - * Allow other modules to modify $css_groups right before it is processed. - * - * @param array $css_groups - * An associative array. - * key - group. - * @param bool $preprocess_css - * TRUE if preprocessing is enabled. - * - * @see _advagg_aggregate_css() - * @see advagg_css_cdn_advagg_css_groups_alter() - */ -function hook_advagg_css_groups_alter(array &$css_groups, $preprocess_css) { - // Work around a bug with seven_css_alter. - // http://drupal.org/node/1937860 - $theme_keys[] = $GLOBALS['theme']; - if (!empty($GLOBALS['base_theme_info'])) { - foreach ($GLOBALS['base_theme_info'] as $base) { - $theme_keys[] = $base->name; - } - } - $match = FALSE; - foreach ($theme_keys as $name) { - if ($name === 'seven') { - $match = TRUE; - } - } - if (empty($match)) { - return; - } - - $target = FALSE; - $last_group = FALSE; - $last_key = FALSE; - $kill_key = FALSE; - $replaced = FALSE; - foreach ($css_groups as $key => $group) { - if (empty($target)) { - if ($group['type'] === 'external' && $group['preprocess'] && $preprocess_css) { - foreach ($group['items'] as $k => $value) { - if ($value['data'] === 'themes/seven/jquery.ui.theme.css') { - // Type should be file and not external (core bug). - $value['type'] = 'file'; - $target = $value; - unset($css_groups[$key]['items'][$k]); - if (empty($css_groups[$key]['items'])) { - unset($css_groups[$key]); - $kill_key = $key; - } - } - } - } - } - else { - $diff = array_merge(array_diff_assoc($group['browsers'], $target['browsers']), array_diff_assoc($target['browsers'], $group['browsers'])); - if ($group['type'] != $target['type'] - || $group['group'] != $target['group'] - || $group['every_page'] != $target['every_page'] - || $group['media'] != $target['media'] - || $group['media'] != $target['media'] - || $group['preprocess'] != $target['preprocess'] - || !empty($diff) - ) { - if (!empty($last_group)) { - $diff = array_merge(array_diff_assoc($last_group['browsers'], $target['browsers']), array_diff_assoc($target['browsers'], $last_group['browsers'])); - if ($last_group['type'] != $target['type'] - || $last_group['group'] != $target['group'] - || $last_group['every_page'] != $target['every_page'] - || $last_group['media'] != $target['media'] - || $last_group['media'] != $target['media'] - || $last_group['preprocess'] != $target['preprocess'] - || !empty($diff) - ) { - // Insert New. - $css_groups[$kill_key] = array( - 'group' => $target['group'], - 'type' => $target['type'], - 'every_page' => $target['every_page'], - 'media' => $target['media'], - 'preprocess' => $target['preprocess'], - 'browsers' => $target['browsers'], - 'items' => array($target), - ); - $replaced = TRUE; - } - else { - // Insert above. - $css_groups[$last_key]['items'][] = $target; - $replaced = TRUE; - } - } - } - else { - // Insert below. - array_unshift($css_groups[$key]['items'], $target); - $replaced = TRUE; - } - } - $last_group = $group; - $last_key = $key; - if ($replaced) { - break; - } - } - ksort($css_groups); -} - -/** - * Allow other modules to modify $js_groups right before it is processed. - * - * @param array $js_groups - * An associative array. - * key - group. - * @param bool $preprocess_js - * TRUE if preprocessing is enabled. - * - * @see _advagg_aggregate_js() - * @see labjs_advagg_js_groups_alter() - */ -function hook_advagg_js_groups_alter(array &$js_groups, $preprocess_js) { - if (!$preprocess_js) { - return; - } - $labjs_location = labjs_get_path(); - - foreach ($js_groups as &$data) { - foreach ($data['items'] as &$values) { - if ($values['data'] == $labjs_location) { - // Strictly enforce preprocess = FALSE for labjs. - $values['preprocess'] = FALSE; - $data['preprocess'] = FALSE; - break 2; - } - } - unset($values); - } - unset($data); -} - -/** - * Allow other modules to modify $children and $elements before rendering. - * - * @param array $children - * An array of children elements. - * @param array $elements - * A render array containing: - * - #items: The CSS items as returned by drupal_add_css() and - * altered by drupal_get_css(). - * - #group_callback: A function to call to group #items. Following - * this function, #aggregate_callback is called to aggregate items within - * the same group into a single file. - * - #aggregate_callback: A function to call to aggregate the items within - * the groups arranged by the #group_callback function. - * - * @see advagg_modify_css_pre_render() - * @see advagg_css_compress_advagg_modify_css_pre_render_alter() - */ -function hook_advagg_modify_css_pre_render_alter(array &$children, array &$elements) { - // Get variables. - $compressor = variable_get('advagg_css_compress_inline', ADVAGG_CSS_COMPRESS_INLINE); - - // Do nothing if the compressor is disabled. - if (empty($compressor)) { - return; - } - - // Do nothing if the page is not cacheable and inline compress if not - // cacheable is not checked. - if (!variable_get('advagg_css_compress_inline_if_not_cacheable', ADVAGG_CSS_COMPRESS_INLINE_IF_NOT_CACHEABLE) && !drupal_page_is_cacheable()) { - return; - } - - module_load_include('inc', 'advagg_css_compress', 'advagg_css_compress.advagg'); - if ($compressor == 2) { - // Compress any inline CSS with YUI. - foreach ($children as &$values) { - if (!empty($values['#value'])) { - advagg_css_compress_yui_cssmin($values['#value']); - } - } - unset($values); - } -} - -/** - * Allow other modules to modify $children and $elements before rendering. - * - * @param array $children - * An array of children elements. - * @param array $elements - * A render array containing: - * - #items: The JavaScript items as returned by drupal_add_js() and - * altered by drupal_get_js(). - * - #group_callback: A function to call to group #items. Following - * this function, #aggregate_callback is called to aggregate items within - * the same group into a single file. - * - #aggregate_callback: A function to call to aggregate the items within - * the groups arranged by the #group_callback function. - * - * @see advagg_modify_js_pre_render() - * @see advagg_js_compress_advagg_modify_js_pre_render_alter() - */ -function hook_advagg_modify_js_pre_render_alter(array &$children, array &$elements) { - // Get variables. - $aggregate_settings['variables']['advagg_js_compressor'] = variable_get('advagg_js_compress_inline', ADVAGG_JS_COMPRESS_INLINE); - $aggregate_settings['variables']['advagg_js_compress_max_ratio'] = variable_get('advagg_js_compress_max_ratio', ADVAGG_JS_COMPRESS_MAX_RATIO); - - // Do nothing if the compressor is disabled. - if (empty($aggregate_settings['variables']['advagg_js_compressor'])) { - return; - } - - // Do nothing if the page is not cacheable and inline compress if not - // cacheable is not checked. - if (!variable_get('advagg_js_compress_inline_if_not_cacheable', ADVAGG_JS_COMPRESS_INLINE_IF_NOT_CACHEABLE) && !drupal_page_is_cacheable()) { - return; - } - - // Compress any inline JS. - module_load_include('inc', 'advagg_js_compress', 'advagg_js_compress.advagg'); - foreach ($children as &$values) { - if (!empty($values['#value'])) { - $contents = $values['#value']; - $filename = drupal_hash_base64($contents); - advagg_js_compress_prep($contents, $filename, $aggregate_settings, FALSE); - $values['#value'] = $contents; - } - } - unset($values); -} - -/** - * Allow other modules to swap important contextual information on generation. - * - * @param array $original - * Array of original settings. - * @param array $aggregate_settings - * Array of contextual settings. - * @param int $mode - * Use 0 to change context to what is inside of $aggregate_settings. - * Use 1 to change context back. - * - * @see advagg_context_switch() - * @see advagg_advagg_context_alter() - */ -function hook_advagg_context_alter(array &$original, array $aggregate_settings, $mode) { - if ($mode == 0) { - // Change context. - $original['base_root'] = $GLOBALS['base_root']; - $original['base_url'] = $GLOBALS['base_url']; - $original['base_path'] = $GLOBALS['base_path']; - $original['is_https'] = $GLOBALS['is_https']; - $GLOBALS['is_https'] = $aggregate_settings['variables']['is_https']; - if ($aggregate_settings['variables']['is_https']) { - $GLOBALS['base_root'] = str_replace('http://', 'https://', $GLOBALS['base_root']); - $GLOBALS['base_url'] = str_replace('http://', 'https://', $GLOBALS['base_url']); - } - else { - $GLOBALS['base_root'] = str_replace('https://', 'http://', $GLOBALS['base_root']); - $GLOBALS['base_url'] = str_replace('https://', 'http://', $GLOBALS['base_url']); - } - $GLOBALS['base_path'] = $aggregate_settings['variables']['base_path']; - } - elseif ($mode == 1) { - // Change context back. - if (isset($original['base_root'])) { - $GLOBALS['base_root'] = $original['base_root']; - } - if (isset($original['base_url'])) { - $GLOBALS['base_url'] = $original['base_url']; - } - if (isset($original['base_path'])) { - $GLOBALS['base_path'] = $original['base_path']; - } - if (isset($original['is_https'])) { - $GLOBALS['is_https'] = $original['is_https']; - } - } -} - -/** - * Let other modules know about the aggregate files that have been removed. - * - * @param array $kill_list - * An array of aggregate files that have been removed. - * - * @see advagg_delete_files_if_stale() - */ -function hook_advagg_removed_aggregates(array $kill_list) { - foreach ($kill_list as $uri) { - if ($uri) { - // This is the uri. - } - // Do something else. - } -} - -/** - * Let other modules tell advagg that a file has changed. - * - * Useful for things like embedded images in CSS; generating a new aggregate - * when the image in the CSS file has changed. - * - * @param string $filename - * Name of the root CSS or JavaScript file. - * - * @return bool - * Set to TRUE to trigger a rebuild of the aggregates that contain this file. - * - * @see advagg_scan_for_changes() - * @see css_emimage_advagg_scan_for_changes() - */ -function hook_advagg_scan_for_changes($filename) { - if ($filename) { - return FALSE; - } -} - -/** - * Let other modules add/alter additional information about files passed in. - * - * @param array $return - * An associative array; filename -> data. - * @param array $cached_data - * What data was found in the cache; cache_id -> data. - * @param bool $bypass_cache - * If TRUE the loaded data did not come from the cache. - * - * @see advagg_get_info_on_files() - * @see advagg_advagg_get_info_on_files_alter() - */ -function hook_advagg_get_info_on_files_alter(array &$return, array $cached_data, $bypass_cache) { - if (!variable_get('advagg_ie_css_selector_limiter', ADVAGG_IE_CSS_SELECTOR_LIMITER)) { - return; - } - $limit_value = variable_get('advagg_ie_css_selector_limiter_value', ADVAGG_IE_CSS_SELECTOR_LIMITER_VALUE); - list($css_path, $js_path) = advagg_get_root_files_dir(); - if ($js_path) { - // This is the js_path array. - } - $parts_path = $css_path[1] . '/parts'; - - foreach ($return as $filename => &$info) { - if ($filename) { - // This is the filename. - } - if (empty($info['fileext']) || $info['fileext'] !== 'css') { - continue; - } - - // Break large file into multiple small files. - if ($info['linecount'] > $limit_value) { - advagg_split_css_file($info); - } - elseif (strpos($info['data'], $parts_path) === 0) { - $info['split'] = TRUE; - } - } - unset($info); -} - -/** - * Tell advagg about other hooks related to advagg. - * - * @param array $hooks - * Array of hooks related to advagg. - * @param bool $all - * If FALSE get only the subset of hooks that alter the filename/contents. - * - * @see advagg_hooks_implemented() - * @see advagg_bundler_advagg_hooks_implemented_alter() - */ -function hook_advagg_hooks_implemented_alter(array &$hooks, $all) { - if ($all) { - $hooks['advagg_bundler_analysis_alter'] = array(); - } -} - -/** - * Let other modules modify the analysis array before it is used. - * - * @param array $analysis - * An associative array; filename -> data. - * - * @see advagg_bundler_analysis() - */ -function hook_advagg_bundler_analysis_alter(array &$analysis) { - foreach ($analysis as $filename => &$data) { - if ($filename) { - // This is the filename. - } - - // This changes often; 604800 is 1 week. - if ($data['changes'] > 10 && $data['mtime'] >= REQUEST_TIME - 604800) { - // Modify the group hash so this doesn't end up in a big aggregate. - $data['group_hash']; - } - } - unset($data); -} - -/** - * @} End of "defgroup advagg_hooks". - */ diff --git a/html/sites/all/modules/contrib/advagg/advagg.cache.inc b/html/sites/all/modules/contrib/advagg/advagg.cache.inc deleted file mode 100644 index 8d1d1586c..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg.cache.inc +++ /dev/null @@ -1,945 +0,0 @@ -fields('af') - ->execute(); - if (!empty($result)) { - module_load_include('inc', 'advagg', 'advagg'); - $filenames = array(); - - $data = array(); - foreach ($result as $row) { - $filenames[] = $row->filename; - $data[$row->filename] = (array) $row; - } - - // Get filesystem data. - $files_info = advagg_get_info_on_files($filenames, TRUE); - foreach ($files_info as $info) { - if (!isset($data[$info['data']])) { - continue; - } - $row = $data[$info['data']]; - - // Select the keys to compare. - $keys_to_compare = array( - 'filesize', - 'content_hash', - 'linecount', - ); - $changed = array(); - foreach ($keys_to_compare as $key) { - if ($row[$key] != $info[$key]) { - $changed[] = $key . ' db:' . $row[$key] . ' file:' . $info[$key]; - break; - } - } - // Compare mtime if it is not zero. - if (empty($info['split']) && !empty($info['mtime'])) { - if (variable_get('advagg_strict_mtime_check', ADVAGG_STRICT_MTIME_CHECK) && $row['mtime'] != $info['mtime']) { - $changed[] = 'mtime db:' . $row['mtime'] . ' file:' . $info['mtime']; - } - elseif ($row['mtime'] < $info['mtime']) { - $changed[] = 'mtime db:' . $row['mtime'] . ' file:' . $info['mtime']; - } - } - - if (empty($changed)) { - // Call hook_advagg_scan_for_changes(). - $changes_array = module_invoke_all('advagg_scan_for_changes', $row['filename']); - if (is_array($changes_array)) { - foreach ($changes_array as $value) { - if (!empty($value)) { - $changed[] = $value; - break; - } - } - } - } - - // If file has changed, add it to the array. - if (!empty($changed)) { - $info['changes'] = $changed; - $files_that_have_changed[$row['filename']] = $info; - } - } - } - - return $files_that_have_changed; -} - -/** - * Flush the correct caches so CSS/JS changes go live. - * - * @return array - * Array of files that have changed and caches flushed. - */ -function advagg_push_new_changes(array $files = array()) { - $results = array(); - // Scan the file system for changes to CSS/JS files. - if (empty($files)) { - $files = advagg_scan_for_changes(); - if (variable_get('advagg_debug', ADVAGG_DEBUG) >= 2) { - watchdog('advagg-debug', 'Changes detected in
@files
.', array('@files' => print_r($files, TRUE)), WATCHDOG_DEBUG); - } - } - - // Clear some static caches. - drupal_static_reset('advagg_get_info_on_file'); - drupal_static_reset('advagg_drupal_hash_base64'); - drupal_static_reset('advagg_current_hooks_hash_array'); - drupal_static_reset('advagg_get_current_hooks_hash'); - - if (variable_get('advagg_debug', ADVAGG_DEBUG) >= 2) { - // Exception used to get a compact stack trace. - $e = new Exception(); - watchdog('advagg-debug', 'New changes called by:
@changes
', array('@changes' => print_r($e->getTraceAsString(), TRUE)), WATCHDOG_DEBUG); - } - - // If something changed, flush the correct caches so that change goes out. - if (!empty($files)) { - $types = array(); - module_load_include('inc', 'advagg', 'advagg'); - foreach ($files as $filename => $meta_data) { - // Lookup the aggregates/cache ids that use this file. - $cache_ids = advagg_get_aggregates_using_file($meta_data['filename_hash'], TRUE); - $cache_hits = array(); - $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - $types[$ext] = TRUE; - - if (!empty($cache_ids)) { - $cache_hits = cache_get_multiple($cache_ids, 'cache_advagg_info'); - foreach ($cache_hits as $cid => $data) { - if (variable_get('advagg_debug', ADVAGG_DEBUG) >= 2) { - watchdog('advagg-debug', 'Clearing cache @cid.', array('@cid' => $cid), WATCHDOG_DEBUG); - } - cache_clear_all($cid, 'cache_advagg_info', FALSE); - } - } - - $changes = array(); - if (!empty($meta_data['changes'])) { - $changes = $meta_data['changes']; - unset($meta_data['changes']); - } - - $results[$filename] = array( - count($cache_ids), - count($cache_hits), - $changes, - ); - - // Update database. - advagg_insert_update_files(array($filename => $meta_data), $ext); - } - - // Change query-strings on css/js files to enforce reload for all users. - // Change css_js_query_string variable. - _drupal_flush_css_js(); - - // Let other modules know about the changed files. - // Call hook_advagg_changed_files(). - module_invoke_all('advagg_changed_files', $files, $types); - - // Clear out the full aggregates cache. - foreach ($types as $ext => $bool) { - if (variable_get('advagg_debug', ADVAGG_DEBUG) >= 2) { - watchdog('advagg-debug', 'Clearing cache advagg:@ext: in cache_advagg_aggregates.', array('@ext' => print_r($ext, TRUE)), WATCHDOG_DEBUG); - } - cache_clear_all('advagg:' . $ext . ':', 'cache_advagg_aggregates', TRUE); - } - } - // Return what was done. - return $results; -} - -/** - * Given a filename hash get back all aggregates that include it. - * - * @param string $filename_hash - * Hash of the filename. - * @param bool $cid_only - * Set to TRUE to only have cache ids returned. - * - * @return array - * Array of aggregates that use this file. - */ -function advagg_get_aggregates_using_file($filename_hash, $cid_only = FALSE) { - // Create main query for the advagg_aggregates table. - $query = db_select('advagg_aggregates', 'aa') - ->condition('aa.filename_hash', $filename_hash); - // Create join query for the advagg_aggregates_versions table. - $query->join('advagg_aggregates_versions', 'aav', 'aa.aggregate_filenames_hash = aav.aggregate_filenames_hash AND aav.atime > 0'); - $query = $query->fields('aav', array('aggregate_filenames_hash', 'aggregate_contents_hash')); - $query->comment('Query called from ' . __FUNCTION__ . '()'); - $results = $query->execute(); - - // Put results into $aggregates array. - $aggregates = array(); - foreach ($results as $row) { - $row = (array) $row; - $cid = 'advagg:db:' . $row['aggregate_filenames_hash'] . ADVAGG_SPACE . $row['aggregate_contents_hash']; - if ($cid_only) { - $aggregates[] = $cid; - } - else { - $row['cid'] = $cid; - $aggregates[] = $row; - } - } - return $aggregates; -} - -/** - * Get all CSS/JS advagg files. - * - * @param array $options - * Array of options to pass along to file_scan_directory(). - * - * @return array - * Array of css and js files. - */ -function advagg_get_all_files(array $options = array()) { - list($css_path, $js_path) = advagg_get_root_files_dir(); - $options += array('nomask' => '/(\.\.?|CVS|\.gz|\.br)$/'); - - // Get a list of files. - $css_files = file_scan_directory($css_path[0], '/.*/', $options); - $js_files = file_scan_directory($js_path[0], '/.*/', $options); - return array($css_files, $js_files); -} - -/** - * Scan CSS/JS advagg dir and remove that file if atime is grater than 30 days. - * - * @return array - * Array of files that got removed. - */ -function advagg_delete_stale_aggregates() { - list($css_files, $js_files) = advagg_get_all_files(); - - // Make the advagg_get_hashes_from_filename() function available. - module_load_include('inc', 'advagg', 'advagg.missing'); - $css_files = advagg_delete_files_if_stale($css_files); - $js_files = advagg_delete_files_if_stale($js_files); - return array($css_files, $js_files); -} - -/** - * Given an array of files remove that file if atime is grater than 30 days. - * - * @param array $files - * Array of files returned by file_scan_directory. - * - * @return array - * Array of files that got removed. - */ -function advagg_delete_files_if_stale(array $files) { - // Array used to record what files were deleted. - $kill_list = array(); - - foreach ($files as $uri => $file) { - // Get info on file. - $filename = $file->filename; - $data = advagg_get_hashes_from_filename($filename); - if (is_array($data)) { - list(, $aggregate_filenames_hash, $aggregate_contents_hash) = $data; - } - else { - // Can not get data on file, remove it. - $kill_list[] = advagg_delete_file_by_uri($uri); - continue; - } - - // Get atime of file. - $atime = advagg_get_atime($aggregate_filenames_hash, $aggregate_contents_hash, $uri); - if (empty($atime)) { - $kill_list[] = advagg_delete_file_by_uri($uri); - continue; - } - - // Default stale file threshold is 30 days. - if (REQUEST_TIME - $atime > variable_get('drupal_stale_file_threshold', 2592000)) { - $kill_list[] = advagg_delete_file_by_uri($uri); - continue; - } - - } - // Let other modules know about the removed files. - // Call hook_advagg_removed_aggregates(). - module_invoke_all('advagg_removed_aggregates', $kill_list); - return $kill_list; -} - -/** - * Scan CSS/JS advagg dir and remove that file if it is empty. - * - * @return array - * Array of files that got removed. - */ -function advagg_delete_empty_aggregates() { - list($css_files, $js_files) = advagg_get_all_files(); - $css_files = advagg_delete_files_if_empty($css_files); - $js_files = advagg_delete_files_if_empty($js_files); - return array($css_files, $js_files); -} - -/** - * Given an array of files remove that file if it is empty. - * - * @param array $files - * Array of files returned by file_scan_directory. - * - * @return array - * Array of files that got removed. - */ -function advagg_delete_files_if_empty(array $files) { - // Array used to record what files were deleted. - $kill_list = array(); - - foreach ($files as $uri => $file) { - // Ignore temp files. There's a separate process for cleaning those up. - if (strpos($uri, '/advagg_file_') !== FALSE) { - continue; - } - $size = filesize($uri); - if ($size === 0) { - $kill_list[] = advagg_delete_file_by_uri($uri); - continue; - } - } - // Let other modules know about the removed files. - // Call hook_advagg_removed_aggregates(). - module_invoke_all('advagg_removed_aggregates', $kill_list); - return $kill_list; -} - -/** - * Delete a file, and any compressed versions. - * - * @param string $uri - * URI of the file to delete. - * - * @return string - * The given URI. - */ -function advagg_delete_file_by_uri($uri) { - if (file_exists($uri)) { - file_unmanaged_delete($uri); - } - if (file_exists($uri . '.gz')) { - file_unmanaged_delete($uri . '.gz'); - } - if (file_exists($uri . '.br')) { - file_unmanaged_delete($uri . '.br'); - } - return $uri; -} - -/** - * Perform a cache_clear_all on all bins returned by advagg_flush_caches(TRUE). - * - * @param bool $push_new_changes - * FALSE: Do not scan for changes. - */ -function advagg_flush_all_cache_bins($push_new_changes = TRUE) { - $bins = advagg_flush_caches(TRUE, $push_new_changes); - foreach ($bins as $bin) { - cache_clear_all('*', $bin, TRUE); - } -} - -/** - * Remove all files from the advagg CSS/JS directories. - * - * @param bool $kill_htaccess - * Set to TRUE to remove the htaccess files as well. - * - * @return array - * Array of all files removed. - */ -function advagg_remove_all_aggregated_files($kill_htaccess = FALSE) { - $options = array( - 'callback' => 'file_unmanaged_delete', - 'nomask' => '/(\.\.?|CVS)$/', - ); - list($css_files, $js_files) = advagg_get_all_files($options); - // Let other modules know about the removed files. - // Call hook_advagg_removed_aggregates(). - module_invoke_all('advagg_removed_aggregates', $css_files); - module_invoke_all('advagg_removed_aggregates', $js_files); - - // Remove the htaccess files as well. - if ($kill_htaccess) { - list($css_path, $js_path) = advagg_get_root_files_dir(); - if (file_exists($css_path[0] . '/.htaccess')) { - file_unmanaged_delete($css_path[0] . '/.htaccess'); - $css_files[] = $css_path[0] . '/.htaccess'; - } - if (file_exists($js_path[0] . '/.htaccess')) { - file_unmanaged_delete($js_path[0] . '/.htaccess'); - $js_files[] = $js_path[0] . '/.htaccess'; - } - } - return array($css_files, $js_files); -} - -/** - * Increment the advagg_global_counter variable by one. - * - * @todo Allow this value to be kept in sync across a multisite. - * - * @return int - * New value of advagg_global_counter. - */ -function advagg_increment_global_counter() { - $new_value = advagg_get_global_counter() + 1; - variable_set('advagg_global_counter', $new_value); - return $new_value; -} - -/** - * Scan for missing files and remove the associated entries in the database. - * - * @return array - * Array of what files were cleared out of the database. - */ -function advagg_remove_missing_files_from_db() { - $missing_files = array(); - $deleted = array(); - - // Get all files stored in the database. - $result = db_select('advagg_files', 'af') - ->fields('af') - ->execute(); - if (empty($result)) { - return $deleted; - } - - // Find missing files. - module_load_include('inc', 'advagg', 'advagg'); - foreach ($result as $row) { - $row = (array) $row; - $info = advagg_get_info_on_file($row['filename'], TRUE); - - // Make sure file exists. - if (empty($info['content_hash'])) { - $info += advagg_get_aggregates_using_file($info['filename_hash']); - $missing_files[$row['filename']] = $info; - continue; - } - } - if (empty($missing_files)) { - return $deleted; - } - - // Remove missing file database entries. - $types = array(); - foreach ($missing_files as $filename => $data) { - // Setup this run. - $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - $advagg_files_del = 0; - $advagg_aggregates_del = 0; - $advagg_aggregates_versions_del = 0; - $clean_sweep = TRUE; - $filename_hash = ''; - - // Scan the data. - foreach ($data as $key => $values) { - if (!is_numeric($key)) { - $filename_hash = $values; - } - else { - // Remove the entry from the database if this aggregate has not been - // accessed in the last 2 weeks. - $can_delete = db_delete('advagg_aggregates_versions') - ->condition('aggregate_filenames_hash', $values['aggregate_filenames_hash']) - ->condition('atime', REQUEST_TIME - variable_get('advagg_remove_missing_files_from_db_time', ADVAGG_REMOVE_MISSING_FILES_FROM_DB_TIME), '<') - ->execute(); - - if ($can_delete > 0) { - $advagg_aggregates_versions_del += $can_delete; - $advagg_aggregates_del += db_delete('advagg_aggregates') - ->condition('aggregate_filenames_hash', $values['aggregate_filenames_hash']) - ->execute(); - } - else { - $clean_sweep = FALSE; - } - // Clear the cache. - cache_clear_all($values['cid'], 'cache_advagg_info', FALSE); - } - } - - // Remove the file entry if all aggregates referencing it have been removed. - if ($clean_sweep) { - $advagg_files_del += db_delete('advagg_files') - ->condition('filename_hash', $filename_hash) - ->execute(); - - // Add info to array. - if (!empty($advagg_files_del) - || !empty($advagg_aggregates_versions_del) - || !empty($advagg_aggregates_del) - ) { - $types[$ext] = TRUE; - $deleted[$filename] = array( - 'advagg_files' => $advagg_files_del, - 'advagg_aggregates_versions' => $advagg_aggregates_versions_del, - 'advagg_aggregates' => $advagg_aggregates_del, - ); - } - } - } - - // If something was deleted, clear the full aggregates cache. - if (!empty($deleted)) { - foreach ($types as $ext => $bool) { - cache_clear_all('advagg:' . $ext . ':', 'cache_advagg_aggregates', TRUE); - } - } - - // Return what was deleted. - return $deleted; -} - -/** - * Scan CSS/JS advagg dir and remove file if there is no associated db record. - * - * @return array - * Array of files that got removed. - */ -function advagg_delete_orphaned_aggregates() { - list($css_files, $js_files) = advagg_get_all_files(); - - // Make the advagg_get_hashes_from_filename() function available. - module_load_include('inc', 'advagg', 'advagg.missing'); - $css_files = advagg_delete_files_if_orphaned($css_files); - $js_files = advagg_delete_files_if_orphaned($js_files); - return array($css_files, $js_files); -} - -/** - * Given an array of files remove that file if there is no associated db record. - * - * @param array $files - * Array of files returned by file_scan_directory. - * - * @return array - * Array of files that got removed. - */ -function advagg_delete_files_if_orphaned(array $files) { - // Get the uri for the advagg_css/parts directory. - list($css_path) = advagg_get_root_files_dir(); - $parts_uri = $css_path[0] . '/parts/'; - - // Array used to record what files were deleted. - $kill_list = $keyed_file_list = array(); - - // Create a listing of all file names and associated hashes. - foreach ($files as $uri => $file) { - // Get info on file. - $data = advagg_get_hashes_from_filename($file->filename, TRUE); - if (is_array($data)) { - list(, $aggregate_filenames_hash) = $data; - // Check to see if the file is in the database. - $keyed_file_list[$aggregate_filenames_hash] = $uri; - } - else { - // Check to see if this is a parts css file. - $start = strpos($file->uri, $parts_uri); - if ($start !== FALSE) { - // Get the original filename. - $original_file = substr($file->uri, $start + strlen($parts_uri)); - $original_file = preg_replace('/(.\\d+\\.css)$/i', '.css', $original_file); - if (file_exists($original_file)) { - // Original file exists, do not delete. - continue; - } - } - - // Can not get data on file, remove it. - $kill_list[] = $uri; - continue; - } - } - - if (!empty($keyed_file_list)) { - $filenames_hash = array_keys($keyed_file_list); - $aggregates_in_database = array(); - // Process in chunks when a large array is passed. - do { - // Check if the aggregate_filenames_hash exists in the database. - $aggregates_in_database += db_select('advagg_aggregates_versions', 'av') - ->fields('av', array('aggregate_filenames_hash')) - ->condition('av.aggregate_filenames_hash', array_splice($filenames_hash, 0, 1000), 'IN') - ->distinct() - ->execute() - ->fetchAllAssoc('aggregate_filenames_hash'); - } while (count($filenames_hash)); - - // Get values not found in the database. - $to_delete = array_values(array_diff_key($keyed_file_list, $aggregates_in_database)); - // Add the file uri to the kill list. - $kill_list = array_merge($kill_list, $to_delete); - } - - if (!empty($kill_list)) { - foreach ($kill_list as $uri) { - advagg_delete_file_by_uri($uri); - } - } - - // Let other modules know about the removed files. - // Call hook_advagg_removed_aggregates(). - module_invoke_all('advagg_removed_aggregates', $kill_list); - return $kill_list; -} - -/** - * Delete aggregates that have not been accessed in the last 6 weeks. - * - * @return int - * Count of the number of rows removed from the databases. - */ -function advagg_remove_old_unused_aggregates() { - $advagg_aggregates_versions_del = 0; - $advagg_aggregates_del = 0; - - // Find orphaned aggregate versions entries. - // Create main query. - $query = db_select('advagg_aggregates_versions', 'aav') - ->fields('aav', array('aggregate_filenames_hash')) - ->groupBy('aav.aggregate_filenames_hash'); - // Create join and add in query comment. - $query->leftjoin('advagg_aggregates', 'aa', 'aa.aggregate_filenames_hash=aav.aggregate_filenames_hash'); - $query->isNull('aa.aggregate_filenames_hash'); - $query->comment('Query called from ' . __FUNCTION__ . '()'); - $results = $query->execute(); - // If we have an orphaned db entry, delete it. - if (!empty($results)) { - foreach ($results as $row) { - $advagg_aggregates_versions_del += db_delete('advagg_aggregates_versions') - ->condition('aggregate_filenames_hash', $row->aggregate_filenames_hash) - ->execute(); - } - } - - // Delete aggregate versions that have not been accessed in the last 45 days. - $advagg_aggregates_versions_del += db_delete('advagg_aggregates_versions') - ->condition('atime', REQUEST_TIME - variable_get('advagg_remove_old_unused_aggregates_time', ADVAGG_REMOVE_OLD_UNUSED_AGGREGATES_TIME), '<') - ->execute(); - - // See if any aggregates are orphaned now. - // Create main query. - $query = db_select('advagg_aggregates', 'aa') - ->fields('aa', array('aggregate_filenames_hash')) - ->groupBy('aa.aggregate_filenames_hash'); - // Create join and add in query comment. - $query->leftjoin('advagg_aggregates_versions', 'aav', 'aa.aggregate_filenames_hash=aav.aggregate_filenames_hash'); - $query->isNull('aav.aggregate_filenames_hash'); - $query->comment('Query called from ' . __FUNCTION__ . '()'); - $results = $query->execute(); - - // If we have an orphaned db entry, delete it. - if (!empty($results)) { - foreach ($results as $row) { - $advagg_aggregates_del += db_delete('advagg_aggregates') - ->condition('aggregate_filenames_hash', $row->aggregate_filenames_hash) - ->execute(); - } - } - - // Return the total count of entires removed from the database. - return $advagg_aggregates_versions_del + $advagg_aggregates_del; -} - -/** - * Delete orphaned/expired advagg locks from the semaphore database table. - * - * @return int - * Count of the number of rows removed from the databases. - */ -function advagg_cleanup_semaphore_table() { - // Let expiration times vary by 5 minutes. - $fuzz_factor = 300; - $results = db_delete('semaphore') - ->condition('name', db_like('advagg_') . '%', 'LIKE') - ->condition('expire', REQUEST_TIME - $fuzz_factor, '<') - ->execute(); - return $results; -} - -/** - * Delete leftover temp files. - * - * @return int - * Count of the number of files removed - */ -function advagg_remove_temp_files() { - // Make sure advagg_get_root_files_dir() is available. - drupal_load('module', 'advagg'); - // Make sure advagg_install_delete_empty_file_if_stale() is available. - module_load_include('install', 'advagg', 'advagg'); - - // Get the advagg paths. - $advagg_path = advagg_get_root_files_dir(); - $total_count = 0; - // Get the top level path. - $top_level = substr($advagg_path[0][0], 0, strpos($advagg_path[0][0], 'advagg_css')); - - // Remove empty temp files from public://. - $files = file_scan_directory($top_level, '/file.*|fil.*\.tmp/', array( - 'recurse' => FALSE, - 'callback' => 'advagg_install_delete_empty_file_if_stale', - )); - foreach ($files as $key => $file) { - if (file_exists($file->uri)) { - unset($files[$key]); - } - } - $total_count += count($files); - - // Remove empty temp files from public://advagg_css. - $files = file_scan_directory($advagg_path[0][0], '/file.*|fil.*\.tmp/', array( - 'recurse' => FALSE, - 'callback' => 'advagg_install_delete_empty_file_if_stale', - )); - foreach ($files as $key => $file) { - if (file_exists($file->uri)) { - unset($files[$key]); - } - } - $total_count += count($files); - - // Remove empty temp files from public://advagg_js. - $files = file_scan_directory($advagg_path[1][0], '/file.*|fil.*\.tmp/', array( - 'recurse' => FALSE, - 'callback' => 'advagg_install_delete_empty_file_if_stale', - )); - foreach ($files as $key => $file) { - if (file_exists($file->uri)) { - unset($files[$key]); - } - } - $total_count += count($files); - - // Remove empty temp files from public://. - $files = file_scan_directory($top_level, '/file_advagg_.*/', array( - 'recurse' => FALSE, - 'callback' => 'advagg_delete_temp_file_if_stale', - )); - foreach ($files as $key => $file) { - if (file_exists($file->uri)) { - unset($files[$key]); - } - } - $total_count += count($files); - - // Remove empty temp files from public://advagg_css. - $files = file_scan_directory($advagg_path[0][0], '/file_advagg_.*/', array( - 'recurse' => FALSE, - 'callback' => 'advagg_delete_temp_file_if_stale', - )); - foreach ($files as $key => $file) { - if (file_exists($file->uri)) { - unset($files[$key]); - } - } - $total_count += count($files); - - // Remove empty temp files from public://advagg_js. - $files = file_scan_directory($advagg_path[1][0], '/file_advagg_.*/', array( - 'recurse' => FALSE, - 'callback' => 'advagg_delete_temp_file_if_stale', - )); - foreach ($files as $key => $file) { - if (file_exists($file->uri)) { - unset($files[$key]); - } - } - $total_count += count($files); - - // Remove empty temp files from public://. - $files = file_scan_directory($top_level, '/advagg_file_.*/', array( - 'recurse' => FALSE, - 'callback' => 'advagg_delete_temp_file_if_stale', - )); - foreach ($files as $key => $file) { - if (file_exists($file->uri)) { - unset($files[$key]); - } - } - $total_count += count($files); - - // Remove empty temp files from public://advagg_css. - $files = file_scan_directory($advagg_path[0][0], '/advagg_file_.*/', array( - 'recurse' => FALSE, - 'callback' => 'advagg_delete_temp_file_if_stale', - )); - foreach ($files as $key => $file) { - if (file_exists($file->uri)) { - unset($files[$key]); - } - } - $total_count += count($files); - - // Remove empty temp files from public://advagg_js. - $files = file_scan_directory($advagg_path[1][0], '/advagg_file_.*/', array( - 'recurse' => FALSE, - 'callback' => 'advagg_delete_temp_file_if_stale', - )); - foreach ($files as $key => $file) { - if (file_exists($file->uri)) { - unset($files[$key]); - } - } - $total_count += count($files); - - // Output info. - return $total_count; -} - -/** - * Refresh all locale files. - * - * @return int - * Count of the number of files removed - */ -function advagg_refresh_all_locale_files() { - $locale_files = array(); - if (!module_exists('locale')) { - return $locale_files; - } - - $results = db_select('advagg_files', 'af') - ->fields('af') - ->condition('af.filetype', 'js') - ->condition('af.filesize', 0, '>') - ->execute(); - $javascript = array(); - foreach ($results as $row) { - $javascript[] = array( - 'type' => 'file', - 'data' => $row->filename, - ); - } - - if (!empty($javascript)) { - $javascript_before = $javascript; - $language_before = $GLOBALS['language']; - $language_list = language_list(); - foreach ($language_list as $lang) { - if ($lang->enabled) { - $GLOBALS['language'] = $lang; - $javascript = $javascript_before; - locale_js_alter($javascript); - $locale_file = array_diff_key($javascript, $javascript_before); - $locale_files += $locale_file; - } - } - $GLOBALS['language'] = $language_before; - } - return $locale_files; -} - -/** - * Callback to delete files if modified more than 60 seconds ago. - * - * @param string $uri - * Location of the file to check. - */ -function advagg_delete_temp_file_if_stale($uri) { - // Set stale file threshold to 60 seconds. - if (REQUEST_TIME - filemtime($uri) > 60) { - file_unmanaged_delete($uri); - } -} - -/** - * See if any of the subfiles has changed. - * - * @param string $filename - * Name of the file that is related to the subfiles. - * @param array $subfiles - * An array of files to check for changes. - * @param string $keyname - * Under what key to save the info on the files. - * @param bool $save_changes - * If TRUE then the changes will be updated in the cache. - * - * @return bool - * TRUE if one of the subfiles has changed. - */ -function advagg_detect_subfile_changes($filename, array $subfiles, $keyname, $save_changes = FALSE) { - // Get the info on this file from the cache. - module_load_include('inc', 'advagg', 'advagg'); - $info = advagg_get_info_on_file($filename); - $hash_id = 'advagg:subfiles:' . $keyname . ':' . $info['filename_hash']; - if (!isset($info[$keyname])) { - // Pull up the info from the database if missing from the cache. - $info[$keyname] = advagg_get_hash_settings($hash_id); - } - - $subfile_changed = array(); - // Check every subfile seeing if they have changed. - foreach ($subfiles as $subfile) { - $current_file_info = $defaults = array( - 'hash' => '', - 'size' => 0, - 'mtime' => 0, - ); - - // Get the currently saved info on this file. - $saved_file_info = isset($info[$keyname][$subfile]) ? $info[$keyname][$subfile] : array(); - $saved_file_info += $defaults; - - // Get the current info on the file. - if (file_exists($subfile)) { - $current_file_info = array( - 'hash' => drupal_hash_base64((string) @advagg_file_get_contents($subfile)), - 'size' => filesize($subfile), - 'mtime' => filemtime($subfile), - ); - } - - // Set the info in case a save happens. - $info[$keyname][$subfile] = $current_file_info; - - // Check for any differences. - $diff = array_diff_assoc($saved_file_info, $current_file_info); - if (!empty($diff)) { - $subfile_changed[$subfile] = $diff; - } - } - if (!empty($subfile_changed) && $save_changes) { - $cache_id = 'advagg:file:' . $info['filename_hash']; - - // Set static cache. - $filename_hashes = &drupal_static('advagg_get_info_on_file'); - $filename_hashes[$cache_id] = $info; - - // Set drupal cache. - cache_set($cache_id, $info, 'cache_advagg_info', CACHE_PERMANENT); - - // Save to database. - advagg_set_hash_settings($hash_id, $info[$keyname]); - } - return $subfile_changed; -} diff --git a/html/sites/all/modules/contrib/advagg/advagg.developer-documentation.php b/html/sites/all/modules/contrib/advagg/advagg.developer-documentation.php deleted file mode 100644 index f49d8ac0f..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg.developer-documentation.php +++ /dev/null @@ -1,41 +0,0 @@ - advagg_get_global_counter())); - } -} - -/** - * Implements hook_drush_command(). - */ -function advagg_drush_command() { - $items = array(); - $items['advagg-cron'] = array( - 'description' => dt('Run the advagg cron hook.'), - 'examples' => array( - 'Standard example' => 'drush advagg-cron', - ), - 'aliases' => array('advagg-c'), - ); - $items['advagg-clear-db-cache'] = array( - 'description' => dt('Remove all entries from the advagg cache bins.'), - 'examples' => array( - 'Standard example' => 'drush advagg-clear-db-cache', - ), - 'aliases' => array('advagg-cdc'), - ); - $items['advagg-clear-all-files'] = array( - 'description' => dt('Remove all generated files.'), - 'examples' => array( - 'Standard example' => 'drush advagg-clear-all-files', - ), - 'aliases' => array('advagg-caf'), - ); - $items['advagg-force-new-aggregates'] = array( - 'description' => dt('Force the creation of all new aggregates by incrementing a global counter.'), - 'examples' => array( - 'Standard example' => 'drush advagg-force-new-aggregates', - ), - 'aliases' => array('advagg-fna'), - ); - return $items; -} - -/** - * @} End of "addtogroup 3rd_party_hooks". - */ - -/** - * Callback function for drush advagg-force-new-aggregates. - * - * Callback is called by using drush_hook_command() where - * hook is the name of the module (advagg) and command is the name of - * the Drush command with all "-" characters converted to "_" characters. - */ -function drush_advagg_force_new_aggregates() { - // Clear out the cache. - drush_advagg_clear_db_cache(); - - // Increment counter. - module_load_include('inc', 'advagg', 'advagg.cache'); - $new_value = advagg_increment_global_counter(); - drush_log(dt('Global counter is now set to @new_value', array('@new_value' => $new_value)), 'ok'); -} - -/** - * Callback function for drush advagg-clear-all-files. - * - * Callback is called by using drush_hook_command() where - * hook is the name of the module (advagg) and command is the name of - * the Drush command with all "-" characters converted to "_" characters. - */ -function drush_advagg_clear_all_files() { - // Clear out the cache. - drush_advagg_clear_db_cache(); - - // Run the command. - module_load_include('inc', 'advagg', 'advagg.cache'); - list($css_files, $js_files) = advagg_remove_all_aggregated_files(); - - // Report back the results. - drush_log(dt('All AdvAgg files have been deleted. @css_count CSS files and @js_count JS files have been removed.', array( - '@css_count' => count($css_files), - '@js_count' => count($js_files), - )), 'ok'); -} - -/** - * Callback function for drush advagg-clear-db-cache. - * - * Callback is called by using drush_hook_command() where - * hook is the name of the module (advagg) and command is the name of - * the Drush command with all "-" characters converted to "_" characters. - */ -function drush_advagg_clear_db_cache() { - // Run the command. - module_load_include('inc', 'advagg', 'advagg.cache'); - advagg_flush_all_cache_bins(); - - // Report back the results. - drush_log(dt('All AdvAgg cache bins have been cleared.'), 'ok'); -} - -/** - * Callback function for drush advagg-cron. - * - * Callback is called by using drush_hook_command() where - * hook is the name of the module (advagg) and command is the name of - * the Drush command with all "-" characters converted to "_" characters. - */ -function drush_advagg_cron() { - // Run AdvAgg cron job. - $output = advagg_cron(TRUE); - - // Output results from running advagg_delete_stale_aggregates(). - list($css_files, $js_files) = $output[0]; - if (count($css_files) > 0 || count($js_files) > 0) { - drush_log(dt('All stale aggregates have been deleted. @css_count CSS files and @js_count JS files have been removed.', array( - '@css_count' => count($css_files), - '@js_count' => count($js_files), - )), 'ok'); - } - else { - drush_log(dt('No stale aggregates found. Nothing was deleted.'), 'ok'); - } - - // Output results from running advagg_delete_orphaned_aggregates(). - if (empty($output[1][0]) && empty($output[1][1])) { - drush_log(dt('All files have an associated db record; nothing was deleted.'), 'ok'); - } - else { - drush_log(dt('Some files had no associated db record and could be safely deleted from the file system. @raw', array('@raw' => print_r($output[1], TRUE))), 'ok'); - } - - // Output results from running advagg_remove_missing_files_from_db(). - if (empty($output[2])) { - drupal_set_message(dt('All source files where found, no database entries where pruned.'), 'ok'); - } - else { - // format_plural() not always available. - drupal_set_message(dt('Some source files are missing and as a result some unused aggregates were found. A total of @count database entries were removed.', array('@count' => count($output[2]))), 'ok'); - } - - // Output results from running advagg_remove_old_unused_aggregates(). - if (empty($output[3])) { - drupal_set_message(dt('No old and unused aggregates found. Nothing was deleted.'), 'ok'); - } - else { - // format_plural() not always available. - drupal_set_message(dt('Some old and unused aggregates were found. A total of @count database entries were removed.', array('@count' => $output[3])), 'ok'); - } - - // Output results from running advagg_cleanup_semaphore_table(). - if (empty($output[4])) { - drupal_set_message(dt('No old semaphore locks found.'), 'ok'); - } - else { - // format_plural() not always available. - drupal_set_message(dt('A total of @count old semaphore entries were removed.', array('@count' => count($output[4]))), 'ok'); - } - - // Output results from running advagg_remove_temp_files(). - if (empty($output[5])) { - drupal_set_message(dt('No leftover temporary files found. Nothing was deleted.'), 'ok'); - } - else { - // format_plural() not always available. - drupal_set_message(dt('Some oleftover temporary files were found. A total of @count temporary files were removed.', array('@count' => $output[5])), 'ok'); - } - - // Output results from running advagg_refresh_all_locale_files(). - if (empty($output[6])) { - drupal_set_message(dt('Locale did not translate anything in any JavaScript files.'), 'ok'); - } - else { - drupal_set_message(dt('Locale did translate some JavaScript files. Resulting locale js files: @files', array('@files' => print_r($output[6], TRUE))), 'ok'); - } -} - -/** - * Flush the correct caches so CSS/JS changes go live. - */ -function drush_advagg_smart_cache_flush() { - // Clear the libraries cache. - if (function_exists('libraries_flush_caches')) { - $cache_tables = libraries_flush_caches(); - foreach ($cache_tables as $table) { - cache_clear_all('*', $table, TRUE); - } - } - - // Run the command. - module_load_include('inc', 'advagg', 'advagg.cache'); - $flushed = advagg_push_new_changes(); - - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 0) { - // Display a simple message if not in Development mode. - drush_log('Advagg Cache Cleared', 'ok'); - } - else { - list($css_path) = advagg_get_root_files_dir(); - $parts_uri = $css_path[1] . '/parts'; - - // Report back the results. - foreach ($flushed as $filename => $data) { - if (strpos($filename, $parts_uri) === 0) { - // Do not report on css files manged in the parts directory. - unset($flushed[$filename]); - continue; - } - $ext = pathinfo($filename, PATHINFO_EXTENSION); - drush_log(dt('The file @filename has changed. @db_usage aggregates are using this file. @db_count db cache entries and all @type full cache entries have been flushed from the cache bins. Trigger: @changes', array( - '@filename' => $filename, - '@db_usage' => $data[0], - '@db_count' => $data[1], - '@changes' => print_r($data[2], TRUE), - '@type' => $ext, - )), 'ok'); - } - - if (empty($flushed)) { - drush_log(dt('No changes found. Nothing was cleared.'), 'ok'); - return; - } - } -} diff --git a/html/sites/all/modules/contrib/advagg/advagg.inc b/html/sites/all/modules/contrib/advagg/advagg.inc deleted file mode 100644 index 7db438b36..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg.inc +++ /dev/null @@ -1,1805 +0,0 @@ - $aggregate_filenames_hash, - 'aggregate_contents_hash' => $aggregate_contents_hash, - 'atime' => 0, - 'root' => $root, - ); - - // Save new aggregate into the database if it does not exist. - $return = db_merge('advagg_aggregates_versions') - ->key(array( - 'aggregate_filenames_hash' => $record['aggregate_filenames_hash'], - 'aggregate_contents_hash' => $record['aggregate_contents_hash'], - )) - ->insertFields($record) - ->execute(); - return $return; -} - -/** - * Insert/Update data in the advagg_aggregates table. - * - * @param array $files - * List of files in the aggregate including files meta data. - * @param string $aggregate_filenames_hash - * Hash of the groupings of files. - * - * @return bool - * Return TRUE if anything was written to the database. - */ -function advagg_insert_aggregate(array $files, $aggregate_filenames_hash) { - // Record if a database write was done. - $write_done = FALSE; - - // Check if the aggregate is in the database. - $files_in_db = array(); - $query = db_select('advagg_aggregates', 'aa') - ->fields('aa', array('filename_hash')) - ->condition('aggregate_filenames_hash', $aggregate_filenames_hash) - ->orderBy('aa.porder', 'ASC') - ->execute(); - foreach ($query as $row) { - $files_in_db[$row->filename_hash] = (array) $row; - } - - $count = 0; - foreach ($files as $file_meta_data) { - ++$count; - - // Skip if the file already exists in the aggregate. - if (!empty($files_in_db[$file_meta_data['filename_hash']])) { - continue; - } - - // Store settings for this file that depend on how it was added. - $settings = array(); - if (isset($file_meta_data['media_query'])) { - $settings['media'] = $file_meta_data['media_query']; - } - - // Write record into the database. - $record = array( - 'aggregate_filenames_hash' => $aggregate_filenames_hash, - 'filename_hash' => $file_meta_data['filename_hash'], - 'porder' => $count, - 'settings' => serialize($settings), - ); - $return = db_merge('advagg_aggregates') - ->key(array( - 'aggregate_filenames_hash' => $record['aggregate_filenames_hash'], - 'filename_hash' => $record['filename_hash'], - )) - ->insertFields($record) - ->execute(); - - if ($return) { - $write_done = TRUE; - } - } - return $write_done; -} - -/** - * Insert/Update data in the advagg_files table. - * - * @param array $files - * List of files in the aggregate including files meta data. - * @param string $type - * String; css or js. - * - * @return bool - * Return TRUE if anything was written to the database. - */ -function advagg_insert_update_files(array $files, $type) { - // Record if a database write was done. - $write_done = FALSE; - - $filename_hashes = array(); - foreach ($files as $file_meta_data) { - $filename_hashes[] = $file_meta_data['filename_hash']; - } - - $files_in_db = array(); - if (!empty($filename_hashes)) { - $query = db_select('advagg_files', 'af') - ->fields('af') - ->condition('filename_hash', $filename_hashes) - ->execute(); - foreach ($query as $row) { - $files_in_db[$row->filename] = (array) $row; - } - } - - // Make drupal_get_installed_schema_version() available. - include_once DRUPAL_ROOT . '/includes/install.inc'; - foreach ($files as $filename => $file_meta_data) { - // Create record. - $record = array( - 'filename' => $filename, - 'filename_hash' => $file_meta_data['filename_hash'], - 'content_hash' => $file_meta_data['content_hash'], - 'filetype' => $type, - 'filesize' => $file_meta_data['filesize'], - 'mtime' => $file_meta_data['mtime'], - 'linecount' => $file_meta_data['linecount'], - ); - try { - // Check the file in the database. - if (empty($files_in_db[$filename])) { - // Add in filesize_processed if the schema is 7210 or higher. - if (drupal_get_installed_schema_version('advagg') >= 7210) { - $record['filesize_processed'] = (int) advagg_generate_filesize_processed($filename, $type); - } - // Add in use_strict if the schema is 7212 or higher. - if (drupal_get_installed_schema_version('advagg') >= 7212) { - $record['use_strict'] = 0; - if ($type === 'js') { - $record['use_strict'] = (int) advagg_does_js_start_with_use_strict($filename); - } - } - - // Insert into database. - $record['changes'] = 1; - - $return = db_merge('advagg_files') - ->key(array( - 'filename_hash' => $record['filename_hash'], - )) - ->insertFields($record) - ->execute(); - if ($return) { - if (variable_get('advagg_debug', ADVAGG_DEBUG) >= 2) { - watchdog('advagg-debug', 'Inserting into db
@record
.', array('@record' => print_r($record, TRUE)), WATCHDOG_DEBUG); - } - $write_done = TRUE; - } - } - else { - // Take changes counter out of the diff equation. - $changes = $files_in_db[$filename]['changes']; - unset($files_in_db[$filename]['changes']); - // If not in strict mode, only use mtime if newer than the existing one. - if (!variable_get('advagg_strict_mtime_check', ADVAGG_STRICT_MTIME_CHECK)) { - // Make sure mtime only moves forward. - if ($record['mtime'] <= $files_in_db[$filename]['mtime']) { - $record['mtime'] = $files_in_db[$filename]['mtime']; - } - } - - // If something is different, update. - $diff = array_diff_assoc($record, $files_in_db[$filename]); - if (!empty($diff)) { - $diff['changes'] = $changes + 1; - $diff['filename_hash'] = $record['filename_hash']; - - // Add in filesize_processed if the schema is 7210 or higher. - if (drupal_get_installed_schema_version('advagg') >= 7210) { - $diff['filesize_processed'] = (int) advagg_generate_filesize_processed($filename, $type); - } - if (drupal_get_installed_schema_version('advagg') >= 7212) { - $diff['use_strict'] = 0; - if ($type === 'js') { - $diff['use_strict'] = (int) advagg_does_js_start_with_use_strict($filename); - if (empty($diff['use_strict'])) { - $diff['use_strict'] = 0; - } - } - } - - $return = db_merge('advagg_files') - ->key(array( - 'filename_hash' => $diff['filename_hash'], - )) - ->fields($diff) - ->execute(); - if ($return) { - if (variable_get('advagg_debug', ADVAGG_DEBUG) >= 2) { - watchdog('advagg-debug', 'Updating db
@diff
.', array('@diff' => print_r($diff, TRUE)), WATCHDOG_DEBUG); - } - $write_done = TRUE; - } - } - } - } - catch (PDOException $e) { - // If it fails we don't care, the file was added to the table by another - // process then. - // Still log it if in development mode. - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - watchdog('advagg', 'Development Mode - Caught PDO Exception: @info', array('@info' => $e)); - } - } - } - return $write_done; -} - -/** - * Given a filename calculate the processed filesize. - * - * @param string $filename - * String; filename containing path information as well. - * @param string $type - * String; css or js. - * - * @return int - * Processed filesize. - */ -function advagg_generate_filesize_processed($filename, $type) { - $files = &drupal_static(__FUNCTION__, array()); - if (!isset($files[$type][$filename])) { - // Make advagg_get_*_aggregate_contents() available. - module_load_include('inc', 'advagg', 'advagg.missing'); - $aggregate_settings = advagg_current_hooks_hash_array(); - - $file_aggregate = array($filename => array()); - if ($type === 'css') { - list($contents) = advagg_get_css_aggregate_contents($file_aggregate, $aggregate_settings); - } - elseif ($type === 'js') { - list($contents) = advagg_get_js_aggregate_contents($file_aggregate, $aggregate_settings); - } - if (!empty($contents)) { - $files[$type][$filename] = strlen(gzencode($contents, 9, FORCE_GZIP)); - } - else { - $files[$type][$filename] = 0; - } - } - return $files[$type][$filename]; -} - -/** - * Given a js string, see if "use strict"; is the first thing ran. - * - * @param string $filename - * String; filename containing path information as well. - * - * @return bool - * True if "use strict"; is the first thing ran. - */ -function advagg_does_js_start_with_use_strict($filename) { - $files = &drupal_static(__FUNCTION__, array()); - if (!isset($files[$filename])) { - // Make advagg_get_*_aggregate_contents() available. - module_load_include('inc', 'advagg', 'advagg.missing'); - $aggregate_settings = advagg_current_hooks_hash_array(); - - $file_aggregate = array($filename => array()); - list($contents) = advagg_get_js_aggregate_contents($file_aggregate, $aggregate_settings); - - // See if the js file starts with "use strict";. - // Trim the JS down to 24kb. - $length = variable_get('advagg_js_header_length', ADVAGG_JS_HEADER_LENGTH); - $header = advagg_get_js_header($contents, $length); - - // Look for the string. - $use_strict = stripos($header, '"use strict";'); - $strict_js = FALSE; - if ($use_strict === FALSE) { - $use_strict = stripos($header, "'use strict';"); - } - if ($use_strict !== FALSE) { - if ($use_strict == 0) { - $strict_js = TRUE; - } - else { - // Get all text before "use strict";. - $substr = substr($header, 0, $use_strict); - // Check if there are any comments. - $single_line_comment = strpos($substr, '//'); - $multi_line_comment = strpos($substr, '/*'); - $in_function = strpos($substr, '{'); - if ($single_line_comment !== FALSE || $multi_line_comment !== FALSE) { - // Remove js comments and try again. - advagg_remove_js_comments($header); - - // Look for the string. - $use_strict = stripos($header, '"use strict";'); - if ($use_strict === FALSE) { - $use_strict = stripos($header, "'use strict';"); - } - // Get all text before "use strict"; with comments removed. - $substr = substr($header, 0, $use_strict); - // Check if there is a function before use strict. - $in_function = strpos($substr, '{'); - } - if ($in_function === FALSE) { - $strict_js = TRUE; - } - } - } - - $files[$filename] = $strict_js; - } - return $files[$filename]; -} - -/** - * Read only the first 8192 bytes to get the file header. - * - * @param string $content - * JS string to cut. - * @param int $length - * The number of bytes to grab. See advagg_js_header_length variable. - * - * @return string - * The shortened JS string. - */ -function advagg_get_js_header($content, $length) { - $content = trim($content); - // Only grab the first X bytes. - if (function_exists('mb_strcut')) { - $header = mb_strcut($content, 0, $length); - } - else { - $header = substr($content, 0, $length); - } - - return $header; -} - -/** - * Remove comments from JavaScript. - * - * @param string $content - * JS string to minify. - */ -function advagg_remove_js_comments(&$content) { - // Remove comments. - $content = preg_replace('/(?:(?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:(?@finfo', array( - '@finfo' => var_export($info, TRUE), - )); - } - } - - // Get filesystem data. - $files_info = advagg_get_info_on_files($files_info_filenames); - - foreach ($files_with_meta_data as $info) { - // Skip if not a string or key doesn't exist. - if (!is_string($info['data']) || !array_key_exists($info['data'], $files_info)) { - continue; - } - - $filename = $info['data']; - $info += $files_info[$filename]; - // Skip if file doesn't exist. - if (empty($info['content_hash'])) { - continue; - } - - // Add info to arrays. - $filename_hashes[] = $info['filename_hash']; - $content_hashes[] = $info['content_hash']; - $filenames[$filename] = $info; - } - - // Generate filename. - $aggregate_filenames_hash = drupal_hash_base64(implode('', $filename_hashes)); - $aggregate_contents_hash = drupal_hash_base64(implode('', $content_hashes)); - $aggregate_filename = advagg_build_filename($type, $aggregate_filenames_hash, $aggregate_contents_hash); - return array( - $aggregate_filename, - $filenames, - $aggregate_filenames_hash, - $aggregate_contents_hash, - ); -} - -/** - * Load cache bin file info in static cache. - * - * @param array $files - * Array; array of filenames. - * - * @return array - * $cached_data. key is $cache_id; value is an array which contains - * - * @code - * 'filesize' => filesize($filename), - * 'mtime' => @filemtime($filename), - * 'filename_hash' => $filename_hash, - * 'content_hash' => drupal_hash_base64($file_contents), - * 'linecount' => $linecount, - * 'data' => $filename, - * 'fileext' => $ext, - * @endcode - */ -function &advagg_load_files_info_into_static_cache(array $files) { - // Get the static cache of this data. - $cached_data = &drupal_static('advagg_get_info_on_file'); - - // Get the statically cached data for all the given files. - $cache_ids = array(); - foreach ($files as $file) { - $cache_id = 'advagg:file:' . advagg_drupal_hash_base64($file); - if (!empty($cached_data) - && !empty($cached_data[$cache_id]) - ) { - // Make sure the cache_id is included. - $cached_data[$cache_id]['cache_id'] = $cache_id; - } - else { - $cache_ids[$file] = $cache_id; - } - } - // Get info from the cache back-end next. - if (!empty($cache_ids)) { - $values = array_values($cache_ids); - $cache_hits = cache_get_multiple($values, 'cache_advagg_info'); - if (!empty($cache_hits)) { - foreach ($cache_hits as $hit) { - if (!empty($hit->data['data'])) { - // Make sure the cache_id is included. - $hit->data['cache_id'] = $hit->cid; - // Add to static cache. - $cached_data[$hit->cid] = $hit->data; - } - } - } - } - return $cached_data; -} - -/** - * Given a filename calculate the hash for it. Uses static cache. - * - * @param string $file - * Filename. - * - * @return string - * hash of filename. - */ -function advagg_drupal_hash_base64($file) { - // Get the static cache of this data. - $cached_data = &drupal_static('advagg_drupal_hash_base64', array()); - if (!array_key_exists($file, $cached_data)) { - $cached_data[$file] = drupal_hash_base64($file); - } - return $cached_data[$file]; -} - -/** - * Given a filename calculate various hashes and gather meta data. - * - * @param array $files - * Array; array of filenames containing path information as well. - * @param bool $bypass_cache - * Bool: TRUE to bypass the cache. - * - * @return array - * $return['filename'] which contains - * - * @code - * 'filesize' => filesize($filename), - * 'mtime' => @filemtime($filename), - * 'filename_hash' => $filename_hash, - * 'content_hash' => drupal_hash_base64($file_contents), - * 'linecount' => $linecount, - * 'data' => $filename, - * 'fileext' => $ext, - * @endcode - */ -function advagg_get_info_on_files(array $files, $bypass_cache = FALSE, $run_alter = TRUE) { - // Get the cached data. - $cached_data = &advagg_load_files_info_into_static_cache($files); - - // Get basic info on the files. - $return = array(); - foreach ($files as $file) { - $filename_hash = advagg_drupal_hash_base64($file); - $cache_id = 'advagg:file:' . $filename_hash; - // If we are not bypassing the cache add cached data. - if ($bypass_cache == FALSE - && is_array($cached_data) - && array_key_exists($cache_id, $cached_data) - ) { - $return[$file] = $cached_data[$cache_id]; - continue; - } - - // Clear PHP's internal file status cache. - advagg_clearstatcache($file); - - // Remove file in the cache if it does not exist. - if (!file_exists($file) || is_dir($file)) { - if (isset($cached_data[$cache_id])) { - cache_clear_all($cache_id, 'cache_advagg_info', FALSE); - } - // Return filename_hash and data. Empty values for the other keys. - $return[$file] = array( - 'filesize' => 0, - 'mtime' => 0, - 'filename_hash' => $filename_hash, - 'content_hash' => '', - 'linecount' => 0, - 'data' => $file, - 'cache_id' => $cache_id, - '#no_cache' => TRUE, - ); - continue; - } - - // Get the file contents. - $file_contents = (string) @advagg_file_get_contents($file); - - $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); - if ($ext !== 'css' && $ext !== 'js') { - // Get the $ext from the database. - $row = db_select('advagg_files', 'af') - ->fields('af') - ->condition('filename', $file) - ->execute()->fetchAssoc(); - if (!empty($row['filetype'])) { - $ext = $row['filetype']; - } - if ($ext === 'less') { - $ext = 'css'; - } - } - - if ($ext === 'css') { - // Get the number of selectors. - $linecount = advagg_count_css_selectors($file_contents); - } - else { - // Get the number of lines. - $linecount = substr_count($file_contents, "\n"); - } - - // Build meta data array and set cache. - $return[$file] = array( - 'filesize' => (int) @filesize($file), - 'mtime' => @filemtime($file), - 'filename_hash' => $filename_hash, - 'content_hash' => drupal_hash_base64($file_contents), - 'linecount' => $linecount, - 'data' => $file, - 'fileext' => $ext, - 'cache_id' => $cache_id, - ); - if (isset($cached_data[$cache_id])) { - $return[$file] += $cached_data[$cache_id]; - } - } - - if ($run_alter) { - // Run hook so other modules can modify the data on these files. - // Call hook_advagg_get_info_on_files_alter(). - drupal_alter('advagg_get_info_on_files', $return, $cached_data, $bypass_cache); - - // Set the cache and populate return array. - foreach ($return as $info) { - // If no cache is empty add/update the cached entry. - // Update the cache if it is new or something changed. - if (empty($info['#no_cache']) - && !empty($info['cache_id']) - && (empty($cached_data[$info['cache_id']]) || $info !== $cached_data[$info['cache_id']]) - ) { - // CACHE_PERMANENT isn't good here. Use 2 weeks from now + 0-45 days. - // The random 0 to 45 day addition is to prevent a cache stampede. - cache_set($info['cache_id'], $info, 'cache_advagg_info', round(REQUEST_TIME + 1209600 + mt_rand(0, 3888000), -3)); - } - - // Update static cache. - $cached_data[$info['cache_id']] = $info; - } - } - - return $return; -} - -/** - * Given a filename calculate various hashes and gather meta data. - * - * @param string $filename - * String; filename containing path information. - * @param bool $bypass_cache - * (optional) Bool: TRUE to bypass the cache. - * @param bool $run_alter - * (optional) Bool: FALSE to not run drupal_alter. - * - * @return array - * Array containing key value pairs. - * - * @code - * 'filesize' => filesize($filename), - * 'mtime' => @filemtime($filename), - * 'filename_hash' => $filename_hash, - * 'content_hash' => drupal_hash_base64($file_contents), - * 'linecount' => $linecount, - * 'data' => $filename, - * 'fileext' => $ext, - * @endcode - */ -function advagg_get_info_on_file($filename, $bypass_cache = FALSE, $run_alter = TRUE) { - $files_info = advagg_get_info_on_files(array($filename), $bypass_cache, $run_alter); - return $files_info[$filename]; -} - -/** - * Build the filename. - * - * @param string $type - * String; css or js. - * @param string $aggregate_filenames_hash - * Hash of the groupings of files. - * @param string $aggregate_contents_hash - * Hash of the files contents. - * @param string $hooks_hash - * Hash value from advagg_get_current_hooks_hash(). - * - * @return string - * String: The filename. No path info. - */ -function advagg_build_filename($type, $aggregate_filenames_hash, $aggregate_contents_hash, $hooks_hash = '') { - if (empty($hooks_hash)) { - $hooks_hash = advagg_get_current_hooks_hash(); - } - return $type . ADVAGG_SPACE . - $aggregate_filenames_hash . ADVAGG_SPACE . - $aggregate_contents_hash . ADVAGG_SPACE . - $hooks_hash . '.' . $type; -} - -/** - * Wrapper around clearstatcache so it can use php 5.3's new features. - * - * @param string $filename - * String. - * - * @return null - * value from clearstatcache(). - */ -function advagg_clearstatcache($filename = NULL) { - static $php530; - if (!isset($php530)) { - $php530 = version_compare(PHP_VERSION, '5.3.0', '>='); - } - - if ($php530) { - return clearstatcache(TRUE, $filename); - } - else { - return clearstatcache(); - } -} - -/** - * Group the CSS/JS into the biggest buckets possible. - * - * @param array $files_to_aggregate - * An array of CSS/JS groups. - * @param string $type - * String; css or js. - * - * @return array - * New version of groups. - */ -function advagg_generate_groups(array $files_to_aggregate, $type) { - $groups = array(); - $count = 0; - $location = 0; - - $media = ''; - $defer = ''; - $async = ''; - $cache = ''; - $scope = ''; - $use_strict = 0; - $browsers = array(); - $selector_count = 0; - // Get CSS limit value. - $limit_value = variable_get('advagg_ie_css_selector_limiter_value', ADVAGG_IE_CSS_SELECTOR_LIMITER_VALUE); - - if (variable_get('advagg_ie_css_selector_limiter', ADVAGG_IE_CSS_SELECTOR_LIMITER) - || variable_get('advagg_resource_hints_dns_prefetch', ADVAGG_RESOURCE_HINTS_DNS_PREFETCH) - || variable_get('advagg_resource_hints_preconnect', ADVAGG_RESOURCE_HINTS_PRECONNECT) - || variable_get('advagg_resource_hints_preload', ADVAGG_RESOURCE_HINTS_PRELOAD) - ) { - $filenames = array(); - foreach ($files_to_aggregate as $data) { - foreach ($data as $values) { - foreach ($values['items'] as $file_info) { - if (!empty($file_info['data']) && is_string($file_info['data'])) { - $filenames[] = $file_info['data']; - } - else { - watchdog('advagg', 'Bad data key. File info: @finfo Group info: @ginfo', array( - '@finfo' => var_export($file_info, TRUE), - '@ginfo' => var_export($values, TRUE), - )); - } - } - } - } - - // Get filesystem data. - $files_info = advagg_get_info_on_files($filenames, TRUE); - } - - $strict_files = array(); - if ($type == 'js') { - // Make drupal_get_installed_schema_version() available. - include_once DRUPAL_ROOT . '/includes/install.inc'; - if (drupal_get_installed_schema_version('advagg') >= 7213) { - $query = db_select('advagg_files', 'af') - ->fields('af', array('filename', 'use_strict')) - ->condition('use_strict', 1) - ->execute(); - foreach ($query as $row) { - $strict_files[$row->filename] = $row->use_strict; - } - } - } - - foreach ($files_to_aggregate as $data) { - foreach ($data as $values) { - - // Group into the biggest buckets possible. - $last_ext = ''; - foreach ($values['items'] as $file_info) { - $parts = array(); - // Check to see if media, browsers, defer, async, cache, or scope has - // changed from the previous run of this loop. - $changed = FALSE; - $ext = isset($file_info['fileext']) ? $file_info['fileext'] : pathinfo($file_info['data'], PATHINFO_EXTENSION); - $ext = strtolower($ext); - if ($ext !== 'css' && $ext !== 'js') { - if (empty($last_ext)) { - // Get the $ext from the database. - $row = db_select('advagg_files', 'af') - ->fields('af') - ->condition('filename', $file_info['data']) - ->execute()->fetchAssoc(); - $ext = $row['filetype']; - } - else { - $ext = $last_ext; - } - } - $last_ext = $ext; - if ($ext === 'css') { - if (isset($file_info['media'])) { - if (variable_get('advagg_combine_css_media', ADVAGG_COMBINE_CSS_MEDIA)) { - $file_info['media_query'] = $file_info['media']; - } - elseif ($media != $file_info['media']) { - // Media changed. - $changed = TRUE; - $media = $file_info['media']; - } - } - if (empty($file_info['media']) && !empty($media)) { - // Media changed to empty. - $changed = TRUE; - $media = ''; - } - } - if (isset($file_info['browsers'])) { - // Browsers changed. - $diff = array_merge(array_diff_assoc($file_info['browsers'], $browsers), array_diff_assoc($browsers, $file_info['browsers'])); - if (!empty($diff)) { - $changed = TRUE; - $browsers = $file_info['browsers']; - } - } - if (empty($file_info['browsers']) && !empty($browsers)) { - // Browsers changed to empty. - $changed = TRUE; - $browsers = array(); - } - - if (!empty($strict_files[$file_info['data']]) && $use_strict != $strict_files[$file_info['data']]) { - // use_strict value changed to 1. - $changed = TRUE; - $use_strict = 1; - } - if (!empty($use_strict) && empty($strict_files[$file_info['data']])) { - // use_strict value changed to 0. - $changed = TRUE; - $use_strict = 0; - } - if (isset($file_info['defer']) && $defer != $file_info['defer']) { - // Defer value changed. - $changed = TRUE; - $defer = $file_info['defer']; - } - if (!empty($defer) && empty($file_info['defer'])) { - // Defer value changed to empty. - $changed = TRUE; - $defer = ''; - } - if (isset($file_info['async']) && $async != $file_info['async']) { - // Async value changed. - $changed = TRUE; - $async = $file_info['async']; - } - if (!empty($async) && empty($file_info['async'])) { - // Async value changed to empty. - $changed = TRUE; - $async = ''; - } - if (isset($file_info['cache']) && $cache != $file_info['cache']) { - // Cache value changed. - $changed = TRUE; - $cache = $file_info['cache']; - } - if (!empty($cache) && empty($file_info['cache'])) { - // Cache value changed to empty. - $changed = TRUE; - $cache = ''; - } - if (isset($file_info['scope']) && $scope != $file_info['scope']) { - // Scope value changed. - $changed = TRUE; - $scope = $file_info['scope']; - } - if (!empty($scope) && empty($file_info['scope'])) { - // Scope value changed to empty. - $changed = TRUE; - $scope = ''; - } - - if (variable_get('advagg_ie_css_selector_limiter', ADVAGG_IE_CSS_SELECTOR_LIMITER) - && array_key_exists('data', $file_info) - && is_string($file_info['data']) - && array_key_exists($file_info['data'], $files_info) - ) { - $file_info += $files_info[$file_info['data']]; - // Prevent CSS rules exceeding 4095 due to limits with IE9 and below. - if ($ext === 'css') { - $selector_count += $file_info['linecount']; - if ($selector_count > $limit_value) { - $changed = TRUE; - $selector_count = $file_info['linecount']; - - // Break large file into multiple smaller files. - if ($file_info['linecount'] > $limit_value) { - $parts = advagg_split_css_file($file_info); - } - } - } - } - - // Merge in dns_prefetch. - if ((variable_get('advagg_resource_hints_dns_prefetch', ADVAGG_RESOURCE_HINTS_DNS_PREFETCH) - || variable_get('advagg_resource_hints_preconnect', ADVAGG_RESOURCE_HINTS_PRECONNECT)) - && isset($files_info[$file_info['data']]['dns_prefetch']) - ) { - if (!isset($file_info['dns_prefetch'])) { - $file_info['dns_prefetch'] = array(); - } - if (!empty($file_info['dns_prefetch']) && is_string($file_info['dns_prefetch'])) { - $temp = $file_info['dns_prefetch']; - unset($file_info['dns_prefetch']); - $file_info['dns_prefetch'] = array($temp); - } - $file_info['dns_prefetch'] = array_filter(array_unique(array_merge($file_info['dns_prefetch'], $files_info[$file_info['data']]['dns_prefetch']))); - } - - // Merge in preload. - if (variable_get('advagg_resource_hints_preload', ADVAGG_RESOURCE_HINTS_PRELOAD) - && isset($files_info[$file_info['data']]['preload']) - ) { - if (!isset($file_info['preload'])) { - $file_info['preload'] = array(); - } - if (!empty($file_info['preload']) && is_string($file_info['preload'])) { - $temp = $file_info['preload']; - unset($file_info['preload']); - $file_info['preload'] = array($temp); - } - $file_info['preload'] = array_filter(array_unique(array_merge($file_info['preload'], $files_info[$file_info['data']]['preload']))); - } - - // If one of the above options changed, it needs to be in a different - // aggregate. - if (!empty($parts)) { - foreach ($parts as $part) { - ++$count; - $groups[$location][$count][] = $part; - } - } - else { - if ($changed) { - ++$count; - } - $groups[$location][$count][] = $file_info; - } - } - } - // Grouping if inline is mixed between files. - ++$location; - } - - return $groups; -} - -/** - * Given a file info array it will split the file up. - * - * @param array $file_info - * File info array from advagg_get_info_on_file(). - * @param string $file_contents - * CSS file contents. - * - * @return array - * Array with advagg_get_info_on_file data and split data. - */ -function advagg_split_css_file(array $file_info, $file_contents = '') { - // Make advagg_parse_media_blocks() available. - module_load_include('inc', 'advagg', 'advagg.missing'); - - // Get the CSS file and break up by media queries. - if (empty($file_contents)) { - $file_contents = (string) @advagg_file_get_contents($file_info['data']); - } - $media_blocks = advagg_parse_media_blocks($file_contents); - - // Get the advagg_ie_css_selector_limiter_value. - $selector_limit = (int) max(variable_get('advagg_ie_css_selector_limiter_value', ADVAGG_IE_CSS_SELECTOR_LIMITER_VALUE), 100); - - // Group media queries together. - $part_selector_count = 0; - $counter = 0; - $values = array(); - foreach ($media_blocks as $media_block) { - // Get the number of selectors. - $selector_count = advagg_count_css_selectors($media_block); - - // This chunk is bigger than $selector_limit. It needs to be split. - if ($selector_count > $selector_limit) { - $inner_selector_count = 0; - // Split css string. - list($media_query, $split_css_strings) = advagg_split_css_string($media_block, $selector_limit); - foreach ($split_css_strings as $split_css_strings) { - $counter_changed = FALSE; - if (empty($split_css_strings)) { - continue; - } - - // Make sure selector count doesn't go over selector limit. - $inner_selector_count = advagg_count_css_selectors($split_css_strings); - $part_selector_count += $inner_selector_count; - if ($part_selector_count > $selector_limit) { - if (!empty($values[$counter])) { - ++$counter; - } - $counter_changed = TRUE; - $part_selector_count = $inner_selector_count; - } - - // Add to output array. - if (isset($values[$counter])) { - if (!empty($media_query)) { - $values[$counter] .= "\n$media_query { $split_css_strings } "; - } - else { - $values[$counter] .= "$split_css_strings"; - } - } - else { - if (!empty($media_query)) { - $values[$counter] = "$media_query { $split_css_strings } "; - } - else { - $values[$counter] = $split_css_strings; - } - } - } - // Add to current selector counter and go to the next value. - if (!$counter_changed) { - $part_selector_count += $inner_selector_count; - } - continue; - } - - $part_selector_count += $selector_count; - if ($part_selector_count > $selector_limit) { - if (!empty($values[$counter])) { - ++$counter; - } - $values[$counter] = $media_block; - $part_selector_count = $selector_count; - } - else { - if (isset($values[$counter])) { - $values[$counter] .= "\n$media_block"; - } - else { - $values[$counter] = $media_block; - } - } - } - - // Save data. - $parts = array(); - $overall_counter = 0; - foreach ($values as $key => $value) { - $last_chunk = FALSE; - $file_info['split_last_part'] = FALSE; - if (count($values) - 1 == $key) { - $last_chunk = TRUE; - } - if ($last_chunk) { - $file_info['split_last_part'] = TRUE; - } - - // Get the number of selectors. - $selector_count = advagg_count_css_selectors($value); - $overall_counter += $selector_count; - - // Save file. - $subfile = advagg_create_subfile($value, $overall_counter, $file_info); - if (empty($subfile)) { - // Something broke; do not create a subfile. - watchdog('advagg', 'Spliting up a CSS file failed. File info: @info', array('@info' => var_export($file_info, TRUE))); - return array(); - } - $parts[] = $subfile; - } - return $parts; -} - -/** - * Count the number of selectors inside of a CSS string. - * - * @param string $css_string - * CSS string. - * - * @return int - * The number of CSS selectors. - */ -function advagg_count_css_selectors($css_string) { - return substr_count($css_string, ',') + substr_count($css_string, '{') - substr_count($css_string, '@media'); -} - -/** - * Given a css string it will split it if it's over the selector limit. - * - * @param string $css_string - * CSS string. - * @param int $selector_limit - * How many selectors can be grouped together. - * - * @return array - * Array that contains the $media_query and the $css_array. - */ -function advagg_split_css_string($css_string, $selector_limit) { - // See if this css string is wrapped in a @media statement. - $media_query = ''; - $media_query_pos = strpos($css_string, '@media'); - if ($media_query_pos !== FALSE) { - // Get the opening bracket. - $open_bracket_pos = strpos($css_string, "{", $media_query_pos); - // Skip if there is a syntax error. - if ($open_bracket_pos === FALSE) { - return array(); - } - $media_query = substr($css_string, $media_query_pos, $open_bracket_pos - $media_query_pos); - $css_string_inside = substr($css_string, $open_bracket_pos + 1); - } - else { - $css_string_inside = $css_string; - } - - // Split CSS into selector chunks. - $split = preg_split('/(\{.+?\}|,)/si', $css_string_inside, -1, PREG_SPLIT_DELIM_CAPTURE); - - $new_css_chunk = array(0 => ''); - $selector_chunk_counter = 0; - $counter = 0; - // Have the key value be the running selector count and put split array semi - // back together. - foreach ($split as $value) { - $new_css_chunk[$counter] .= $value; - if (strpos($value, '}') === FALSE) { - ++$selector_chunk_counter; - } - else { - if ($counter + 1 < $selector_chunk_counter) { - $selector_chunk_counter += ($counter - $selector_chunk_counter + 1) / 2; - } - $counter = $selector_chunk_counter; - if (!isset($new_css_chunk[$counter])) { - $new_css_chunk[$counter] = ''; - } - } - } - - // Generate output array in this function. - $css_array = array(); - $keys = array_keys($new_css_chunk); - $counter = 0; - $chunk_counter = 0; - foreach (array_keys($keys) as $key) { - // Get out of loop if at the end of the array. - if (!isset($keys[$key + 1])) { - break; - } - - // Get values, keys and counts. - $this_value = $new_css_chunk[$keys[$key]]; - $this_key = $keys[$key]; - $next_key = $keys[$key + 1]; - $this_selector_count = $next_key - $this_key; - - // Single rule is bigger than the selector limit. - if ($this_selector_count > $selector_limit) { - // Get css rules for these selectors. - $open_bracket_pos = strpos($this_value, "{"); - $css_rule = ' ' . substr($this_value, $open_bracket_pos); - - // Split on selectors. - $split = preg_split('/(\,)/si', $this_value, NULL, PREG_SPLIT_OFFSET_CAPTURE); - $index = 0; - $counter = 0; - while (isset($split[$index][1])) { - // Get starting and ending positions of the selectors given the selector - // limit. - $next_index = $index + $selector_limit - 1; - $start = $split[$index][1]; - if (isset($split[$next_index][1])) { - $end = $split[$next_index][1]; - } - else { - // Last one. - $temp = end($split); - $split_key = key($split); - $counter = $split_key % $selector_limit; - $end_open_bracket_pos = (int) strpos($temp[0], "{"); - $end = $temp[1] + $end_open_bracket_pos; - } - - // Extract substr. - $sub_this_value = substr($this_value, $start, $end - $start - 1) . $css_rule; - - // Save substr. - ++$chunk_counter; - $key_output = $selector_limit; - if (!empty($counter)) { - $key_output = $selector_limit - $counter; - } - $css_array["$chunk_counter $key_output"] = ''; - - if (!isset($css_array[$chunk_counter])) { - $css_array[$chunk_counter] = $sub_this_value; - } - else { - $css_array[$chunk_counter] .= $sub_this_value; - } - - // Move counter. - $index = $next_index; - } - continue; - } - - $counter += $this_selector_count; - if ($counter > $selector_limit) { - $key_output = $counter - $this_selector_count; - $css_array["$chunk_counter $key_output"] = ''; - $counter = $next_key - $this_key; - ++$chunk_counter; - } - if (!isset($css_array[$chunk_counter])) { - $css_array[$chunk_counter] = $this_value; - } - else { - $css_array[$chunk_counter] .= $this_value; - } - } - - // Group into sets smaller than $selector_limit. - return array($media_query, $css_array); -} - -/** - * Write CSS parts to disk; used when CSS selectors in one file is > 4096. - * - * @param string $css - * CSS data to write to disk. - * @param int $overall_split - * Running count of what selector we are from the original file. - * @param array $file_info - * File info array from advagg_get_info_on_file(). - * - * @return array - * Array with advagg_get_info_on_file data and split data; FALSE on failure. - */ -function advagg_create_subfile($css, $overall_split, array $file_info) { - static $parts_uri; - static $parts_path; - if (!isset($parts_uri)) { - list($css_path) = advagg_get_root_files_dir(); - $parts_uri = $css_path[0] . '/parts'; - $parts_path = $css_path[1] . '/parts'; - - // Create the public://advagg_css/parts dir. - file_prepare_directory($parts_uri, FILE_CREATE_DIRECTORY); - - // Make advagg_save_data() available. - module_load_include('inc', 'advagg', 'advagg.missing'); - } - - // Get the path from $file_info['data']. - $uri_path = advagg_get_relative_path($file_info['data']); - if (!file_exists($uri_path) || is_dir($uri_path)) { - return FALSE; - } - - // Write the current chunk of the CSS into a file. - $new_filename = str_ireplace('.css', '.' . $overall_split . '.css', $uri_path); - - // Fix for things that write dynamically to the public file system. - $scheme = file_uri_scheme($new_filename); - if ($scheme) { - $wrapper = file_stream_wrapper_get_instance_by_scheme($scheme); - if ($wrapper && method_exists($wrapper, 'getDirectoryPath')) { - // Use the wrappers directory path. - $new_filename = $wrapper->getDirectoryPath() . '/' . file_uri_target($new_filename); - } - else { - // If the scheme does not have a wrapper; prefix file with the scheme. - $new_filename = $scheme . '/' . file_uri_target($new_filename); - } - } - - $part_uri = $parts_uri . '/' . $new_filename; - $dirname = drupal_dirname($part_uri); - file_prepare_directory($dirname, FILE_CREATE_DIRECTORY); - $filename_path = (advagg_s3fs_evaluate_no_rewrite_cssjs(FALSE)) ? $parts_uri : $parts_path; - - // Get info on the file that was just created. - $part = advagg_get_info_on_file($filename_path . '/' . $new_filename, TRUE) + $file_info; - $part['split'] = TRUE; - $part['split_location'] = $overall_split; - $part['split_original'] = $file_info['data']; - - // Overwrite/create file if hash doesn't match. - $hash = drupal_hash_base64($css); - if ($part['content_hash'] !== $hash) { - advagg_save_data($part_uri, $css, TRUE); - $part = advagg_get_info_on_file($filename_path . '/' . $new_filename, TRUE) + $file_info; - $part['split'] = TRUE; - $part['split_location'] = $overall_split; - $part['split_original'] = $file_info['data']; - } - - return $part; -} - -/** - * Replacement for drupal_build_css_cache() and drupal_build_js_cache(). - * - * @param array $files_to_aggregate - * An array of CSS/JS groups. - * @param string $type - * String; css or js. - * - * @return array - * array of aggregate files. - */ -function advagg_build_aggregate_plans(array $files_to_aggregate, $type) { - if ($type !== 'css' && $type !== 'js') { - return array(); - } - - // Place into biggest grouping possible. - $groups = advagg_generate_groups($files_to_aggregate, $type); - - // Get filenames. - $files = advagg_generate_filenames($groups, $type); - - // Insert/Update Database. - advagg_insert_update_db($files, $type, 1); - // Update atimes for root. - advagg_multi_update_atime($files); - - // Run hooks to modify the aggregate. - // Call hook_advagg_build_aggregate_plans_alter(). - $modified = FALSE; - drupal_alter('advagg_build_aggregate_plans', $files, $modified, $type); - - // If the hook above modified anything, re-insert into database. - if ($modified) { - // Insert/Update Database. - advagg_insert_update_db($files, $type, 0); - // Update atimes for non root. - advagg_multi_update_atime($files); - } - - // Get file paths. - list($css_path, $js_path) = advagg_get_root_files_dir(); - - // Build the plan. - $plans = array(); - - foreach ($files as $agg_filename => $values) { - if ($type === 'css') { - $mixed_media = FALSE; - $media = NULL; - foreach ($values['files'] as $value) { - if (!isset($value['media'])) { - continue; - } - if (is_null($media)) { - $media = $value['media']; - } - if ($media != $value['media']) { - $mixed_media = TRUE; - } - } - } - - $onload = array(); - $onerror = array(); - $attributes = array(); - $onloadcss = array(); - foreach ($values['files'] as &$items) { - // Get onload. - if (!empty($items['onload'])) { - $onload[] = $items['onload']; - } - // Get attributes onload. - if (!empty($items['attributes']['onload'])) { - $onload[] = $items['attributes']['onload']; - unset($items['attributes']['onload']); - } - // Get onerror. - if (!empty($items['onerror'])) { - $onload[] = $items['onerror']; - } - // Get attributes onerror. - if (!empty($items['attributes']['onerror'])) { - $onload[] = $items['attributes']['onerror']; - unset($items['attributes']['onerror']); - } - // Get attributes onloadCSS. - if (!empty($items['onloadCSS'])) { - $onloadcss[] = $items['onloadCSS']; - } - // Get attributes onloadCSS. - if (!empty($items['attributes']['onloadCSS'])) { - $onloadcss[] = $items['attributes']['onloadCSS']; - unset($items['attributes']['onloadCSS']); - } - // Get attributes. - if (!empty($items['attributes'])) { - $attributes += $items['attributes']; - } - } - $onload = implode(';', array_unique(array_filter($onload))); - $onerror = implode(';', array_unique(array_filter($onerror))); - $onloadcss = implode(';', array_unique(array_filter($onloadcss))); - - $first = reset($values['files']); - if (!empty($mixed_media)) { - $first['media'] = 'all'; - } - $url = ($type === 'css') ? $css_path[0] : $js_path[0]; - $path = ($type === 'css') ? $css_path[1] : $js_path[1]; - $plans[$agg_filename] = array( - 'data' => $url . '/' . $agg_filename, - 'media' => isset($first['media']) ? $first['media'] : '', - 'defer' => isset($first['defer']) ? $first['defer'] : '', - 'async' => isset($first['async']) ? $first['async'] : '', - 'onload' => $onload, - 'onerror' => $onerror, - 'browsers' => isset($first['browsers']) ? $first['browsers'] : array(), - 'cache' => isset($first['cache']) ? $first['cache'] : TRUE, - 'type' => $first['type'], - 'items' => $values, - 'filepath' => $path . '/' . $agg_filename, - 'filename' => $agg_filename, - 'attributes' => $attributes, - ); - if (!empty($onloadcss)) { - $plans[$agg_filename]['attributes']['onloadCSS'] = $onloadcss; - } - } - $plans = array_values($plans); - - // Create the aggregate files. - if (variable_get('advagg_pregenerate_aggregate_files', ADVAGG_PREGENERATE_AGGREGATE_FILES)) { - advagg_create_aggregate_files($plans, $type); - } - - // Run hooks to modify the plans. - // Call hook_advagg_build_aggregate_plans_post_alter(). - drupal_alter('advagg_build_aggregate_plans_post', $plans, $type); - - return $plans; -} - -/** - * Create the aggregate if it does not exist; using HTTPRL if possible. - * - * @param array $plans - * An array of aggregate file names. - * @param string $type - * String; css or js. - * - * @return array - * An array of what was done when generating the file. - */ -function advagg_create_aggregate_files(array $plans, $type) { - $filenames = array(); - $return = array(); - foreach ($plans as $plan) { - $filenames[] = $plan['filename']; - } - - // If the httprl module exists and we want to use it. - if (module_exists('httprl') - && variable_get('advagg_use_httprl', ADVAGG_USE_HTTPRL) - && (is_callable('httprl_is_background_callback_capable') - && httprl_is_background_callback_capable() - || !is_callable('httprl_is_background_callback_capable') - ) - ) { - if (variable_get('advagg_fast_filesystem', ADVAGG_FAST_FILESYSTEM)) { - list($css_path, $js_path) = advagg_get_root_files_dir(); - foreach ($filenames as $key => $filename) { - if ($type === 'css') { - $uri = $css_path[0] . '/' . $filename; - } - elseif ($type === 'js') { - $uri = $js_path[0] . '/' . $filename; - } - if (file_exists($uri)) { - unset($filenames[$key]); - } - } - } - if (!empty($filenames)) { - // Setup callback options array; call function in the background. - $callback_options = array( - array( - 'function' => 'advagg_build_aggregates', - ), - $filenames, $type, - ); - // Queue up the request. - httprl_queue_background_callback($callback_options); - // Execute request. - $return = httprl_send_request(); - } - } - else { - $return = advagg_build_aggregates($filenames, $type); - } - return $return; -} - -/** - * Loads the stylesheet and resolves all @import commands. - * - * Loads a stylesheet and replaces @import commands with the contents of the - * imported file. Use this instead of file_get_contents when processing - * stylesheets. - * - * The returned contents are compressed removing white space and comments only - * when CSS aggregation is enabled. This optimization will not apply for - * color.module enabled themes with CSS aggregation turned off. - * - * @param string $file - * Name of the stylesheet to be processed. - * @param bool $optimize - * Defines if CSS contents should be compressed or not. - * @param array $aggregate_settings - * Array of settings. - * - * @return string - * Contents of the stylesheet, including any resolved @import commands. - */ -function advagg_load_css_stylesheet($file, $optimize = TRUE, array $aggregate_settings = array(), $contents = '') { - $old_base_path = $GLOBALS['base_path']; - - // Change context to that of when this aggregate was created. - advagg_context_switch($aggregate_settings, 0); - - // Get the stylesheets contents. - $contents = advagg_load_stylesheet($file, $optimize, TRUE, $contents); - - // Resolve public:// if needed. - if (!advagg_is_external($file) && file_uri_scheme($file)) { - $file = advagg_get_relative_path($file); - } - - // Get the parent directory of this file, relative to the Drupal root. - $css_base_url = substr($file, 0, strrpos($file, '/')); - - // Handle split css files. - list($css_path) = advagg_get_root_files_dir(); - $parts_path = ((advagg_s3fs_evaluate_no_rewrite_cssjs(FALSE)) ? $css_path[0] : $css_path[1]) . '/parts/'; - $url_parts = strpos($css_base_url, $parts_path); - // If this CSS file is actually a part of a previously split larger CSS file, - // don't use it to construct relative paths within the CSS file for - // 'url(...)' bits. - if ($url_parts !== FALSE) { - $css_base_url = substr($css_base_url, $url_parts + strlen($parts_path)); - } - - // Replace the old base path with the one that was passed in. - if (advagg_is_external($css_base_url) || variable_get('advagg_skip_file_create_url_inside_css', ADVAGG_SKIP_FILE_CREATE_URL_INSIDE_CSS)) { - $pos = strpos($css_base_url, $old_base_path); - if ($pos !== FALSE) { - $parsed_url = parse_url($css_base_url); - if (!empty($parsed_url['path'])) { - // Remove any double slash in path. - $parsed_url['path'] = str_replace('//', '/', $parsed_url['path']); - - // Get newly recalculated position. - $pos = strpos($parsed_url['path'], $old_base_path); - - // Replace. - if (strpos($parsed_url['path'], '/') !== 0 && $old_base_path === '/') { - // Special case if going to a subdir. - $parsed_url['path'] = $GLOBALS['base_path'] . $parsed_url['path']; - } - else { - $parsed_url['path'] = substr_replace($parsed_url['path'], $GLOBALS['base_path'], $pos, strlen($old_base_path)); - } - - $css_base_url = advagg_glue_url($parsed_url); - } - } - } - - _advagg_build_css_path(array(), $css_base_url . '/', $aggregate_settings); - // Anchor all paths in the CSS with its base URL, ignoring external, - // absolute paths, and urls that start with # or %23 (SVG). - $contents = preg_replace_callback('%url\(\s*+[\'"]?+(?![a-z]++:|/|\#|\%23+)([^\'"\)]++)[\'"]?+\s*+\)%i', '_advagg_build_css_path', $contents); - - // Change context back. - advagg_context_switch($aggregate_settings, 1); - - // Return the stylesheets contents. - return $contents; -} - -/** - * Changes context when generating CSS or JS files. - * - * @param array $aggregate_settings - * Array of settings. - * @param int $mode - * Use 0 to change context to what is inside of $aggregate_settings. - * Use 1 to change context back. - */ -function advagg_context_switch(array $aggregate_settings, $mode) { - $original = &drupal_static(__FUNCTION__); - - // Use current $aggregate_settings if none was passed in. - if (empty($aggregate_settings)) { - $aggregate_settings = advagg_current_hooks_hash_array(); - } - - // Call hook_advagg_context_alter(). - drupal_alter('advagg_context', $original, $aggregate_settings, $mode); -} - -/** - * Prefixes all paths within a CSS file for drupal_build_css_cache(). - * - * @param array $matches - * Array of matched items from preg_replace_callback(). - * @param string $base - * Base path. - * @param array $aggregate_settings - * Array of settings. - * - * @return string - * New version of the url() string from the css. - * - * @see _drupal_build_css_path() - * @see https://drupal.org/node/1961340#comment-7735815 - * @see https://drupal.org/node/1514182#comment-7875489 - */ -function _advagg_build_css_path(array $matches, $base = '', array $aggregate_settings = array()) { - $_base = &drupal_static(__FUNCTION__, ''); - $_aggregate_settings = &drupal_static(__FUNCTION__ . '_aggregate_settings', array()); - // Store base path for preg_replace_callback. - if (!empty($base)) { - $_base = $base; - } - if (!empty($aggregate_settings)) { - $_aggregate_settings = $aggregate_settings; - } - // Short circuit if no matches were passed in. - if (empty($matches)) { - return ''; - } - - // Prefix with base. - $url = $_base . $matches[1]; - - // If advagg_file_create_url() is not being used and the $url is local, redo - // the $url taking the base_path into account. - if (!advagg_is_external($url) && variable_get('advagg_skip_file_create_url_inside_css', ADVAGG_SKIP_FILE_CREATE_URL_INSIDE_CSS)) { - $new_base_path = $GLOBALS['base_path']; - if (isset($_aggregate_settings['variables']['base_path'])) { - $new_base_path = $_aggregate_settings['variables']['base_path']; - } - // Remove first /. - $new_base_path = ltrim($new_base_path, '/'); - $pos = FALSE; - // See if base_path is in the passed in $_base. - if (!empty($new_base_path)) { - $pos = strpos($_base, $new_base_path); - } - if ($pos !== FALSE) { - $url = substr($_base, $pos) . $matches[1]; - } - else { - $url = $new_base_path . $_base . $matches[1]; - } - } - // Remove '../' segments where possible. - $last = ''; - while ($url != $last) { - $last = $url; - $url = preg_replace('`(^|/)(?!\.\./)([^/]+)/\.\./`', '$1', $url); - } - - // Parse and build back the url without the query and fragment parts. - $parsed_url = parse_url($url); - $base_url = advagg_glue_url($parsed_url, TRUE); - - $query = isset($parsed_url['query']) ? $parsed_url['query'] : ''; - // In the case of certain URLs, we may have simply a '?' character without - // further parameters. parse_url() misses this and leaves 'query' blank, so - // need to this back in. - // See http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax - // for more information. - if ($query != '' || strpos($url, $base_url . '?') === 0) { - $query = '?' . $query; - } - $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; - - $run_file_create_url = FALSE; - if (!variable_get('advagg_skip_file_create_url_inside_css', ADVAGG_SKIP_FILE_CREATE_URL_INSIDE_CSS)) { - $run_file_create_url = TRUE; - } - if (empty($parsed_url['host'])) { - $base_url = ltrim($base_url, '/'); - } - $base_url = advagg_file_create_url($base_url, $_aggregate_settings, $run_file_create_url, 'css'); - - return 'url(' . $base_url . $query . $fragment . ')'; -} diff --git a/html/sites/all/modules/contrib/advagg/advagg.info b/html/sites/all/modules/contrib/advagg/advagg.info deleted file mode 100644 index f2ece0743..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg.info +++ /dev/null @@ -1,13 +0,0 @@ -name = Advanced CSS/JS Aggregation (AdvAgg) -description = Aggregates multiple CSS/JS files in a way that prevents 404 from happening when accessing a CSS or JS file. -package = Advanced CSS/JS Aggregation -core = 7.x -files[] = tests/advagg.test - -configure = admin/config/development/performance/advagg - -; Information added by Drupal.org packaging script on 2020-11-19 -version = "7.x-2.35" -core = "7.x" -project = "advagg" -datestamp = "1605792717" diff --git a/html/sites/all/modules/contrib/advagg/advagg.install b/html/sites/all/modules/contrib/advagg/advagg.install deleted file mode 100644 index cad60a2e8..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg.install +++ /dev/null @@ -1,2868 +0,0 @@ - array( - 'aggregate_filenames_hash', - 'filename_hash', - ), - 'advagg_aggregates_versions' => array( - 'aggregate_filenames_hash', - 'aggregate_contents_hash', - ), - 'advagg_files' => array( - 'filename_hash', - 'content_hash', - ), - ); - - $schema = advagg_schema(); - foreach ($tables as $table => $fields) { - // Change utf8_bin to ascii_bin. - advagg_install_change_table_collation($table, $fields, 'ascii_bin', $schema[$table]['fields']); - } - // New install gets a locked admin section. - variable_set('advagg_admin_mode', 0); -} - -/** - * Implements hook_enable(). - */ -function advagg_enable() { - // Make sure the advagg_get_root_files_dir() function is available. - drupal_load('module', 'advagg'); - - // Make sure permissions for dirs are correct. Needed if installed via drush. - list($css_path, $js_path) = advagg_get_root_files_dir(); - $stat_public = stat('public://'); - $stat_css = stat($css_path[0]); - $stat_js = stat($js_path[0]); - if (isset($stat_public['uid'])) { - if (isset($stat_css['uid']) && $stat_public['uid'] != $stat_css['uid']) { - @chown($css_path[0], $stat_public['uid']); - } - if (isset($stat_js['uid']) && $stat_public['uid'] != $stat_js['uid']) { - @chown($stat_js[0], $stat_public['uid']); - } - } - if (isset($stat_public['gid'])) { - if (isset($stat_css['gid']) && $stat_public['gid'] != $stat_css['gid']) { - @chgrp($css_path[0], $stat_public['gid']); - } - if (isset($stat_js['uid']) && $stat_public['gid'] != $stat_js['gid']) { - @chgrp($stat_js[0], $stat_public['gid']); - } - } - if (drupal_is_cli()) { - // Remove advagg and public dirs if empty and running from command line. - list($css_path, $js_path) = advagg_get_root_files_dir(); - $files = file_scan_directory($css_path[1], '/.*/'); - if (empty($files)) { - rmdir($css_path[1]); - } - $files = file_scan_directory($js_path[1], '/.*/'); - if (empty($files)) { - rmdir($js_path[1]); - } - $files = file_scan_directory('public://', '/.*/'); - if (empty($files)) { - rmdir('public://'); - } - } - - // Make sure the advagg_flush_all_cache_bins() function is available. - module_load_include('inc', 'advagg', 'advagg'); - module_load_include('inc', 'advagg', 'advagg.cache'); - - // Flush caches. - advagg_flush_all_cache_bins(); - - // Flush menu cache on shutdown. - register_shutdown_function('menu_rebuild'); - - // Set the advagg_needs_update variable if this is a major version update. - if (!db_table_exists('advagg_aggregates_versions')) { - variable_set('advagg_needs_update', TRUE); - } - else { - variable_del('advagg_needs_update'); - } -} - -/** - * Implements hook_disable(). - */ -function advagg_disable() { - // Make sure the advagg_get_root_files_dir() function is available. - drupal_load('module', 'advagg'); - - // Make sure the advagg_flush_all_cache_bins() function is available. - module_load_include('inc', 'advagg', 'advagg'); - module_load_include('inc', 'advagg', 'advagg.cache'); - - // Flush caches. - advagg_flush_all_cache_bins(); - _drupal_flush_css_js(); - drupal_clear_css_cache(); - drupal_clear_js_cache(); - cache_clear_all('*', 'cache_page', TRUE); - - // Make sure the theme_registry: cid is cleared. - register_shutdown_function('cache_clear_all', 'theme_registry:', 'cache', TRUE); -} - -/** - * Implements hook_uninstall(). - */ -function advagg_uninstall() { - // Make sure the advagg_get_root_files_dir() function is available. - drupal_load('module', 'advagg'); - list($css_path, $js_path) = advagg_get_root_files_dir(); - - // Make sure the advagg_flush_all_cache_bins() function is available. - module_load_include('inc', 'advagg', 'advagg.cache'); - // Flush caches. - advagg_flush_all_cache_bins(); - - // Remove variables. - db_delete('variable') - ->condition('name', 'advagg%', 'LIKE') - ->execute(); - - // Remove all files and directories. - file_unmanaged_delete_recursive($css_path[0]); - file_unmanaged_delete_recursive($js_path[0]); - - // Make sure the theme_registry: cid is cleared. - register_shutdown_function('cache_clear_all', 'theme_registry:', 'cache', TRUE); -} - -/** - * Implements hook_schema(). - */ -function advagg_schema() { - // Create cache tables. - $schema['cache_advagg_aggregates'] = drupal_get_schema_unprocessed('system', 'cache'); - $schema['cache_advagg_aggregates']['fields']['cid']['binary'] = TRUE; - $schema['cache_advagg_aggregates']['description'] = 'Cache table for Advanced CSS/JS Aggregation. Used to keep a cache of the CSS and JS HTML tags.'; - - $schema['cache_advagg_info'] = drupal_get_schema_unprocessed('system', 'cache'); - $schema['cache_advagg_info']['fields']['cid']['binary'] = TRUE; - $schema['cache_advagg_info']['description'] = 'Cache table for Advanced CSS/JS Aggregation. Used to keep a cache of the db and file info.'; - - // Create database tables. - $schema['advagg_files'] = array( - 'description' => 'Files used in CSS/JS aggregation.', - 'fields' => array( - 'filename' => array( - 'description' => 'Path and filename of the file relative to Drupal webroot.', - 'type' => 'text', - 'size' => 'normal', - 'not null' => TRUE, - ), - 'filename_hash' => array( - 'description' => 'Hash of path and filename. Used to join tables.', - 'type' => 'char', - 'length' => 43, - 'not null' => TRUE, - 'default' => '', - 'binary' => TRUE, - 'collation' => 'ascii_bin', - 'charset' => 'ascii', - 'mysql_character_set' => 'ascii', - ), - 'content_hash' => array( - 'description' => 'Hash of the file content. Used to see if the file has changed.', - 'type' => 'char', - 'length' => 43, - 'not null' => FALSE, - 'default' => '', - 'binary' => TRUE, - 'collation' => 'ascii_bin', - 'charset' => 'ascii', - 'mysql_character_set' => 'ascii', - ), - 'filetype' => array( - 'description' => 'Filetype.', - 'type' => 'varchar', - 'length' => 8, - 'not null' => TRUE, - 'default' => '', - 'binary' => TRUE, - ), - 'filesize' => array( - 'description' => 'The file size in bytes.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - 'linecount' => array( - 'description' => 'The number of lines in the file.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - 'mtime' => array( - 'description' => 'The time the file was last modified.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - 'changes' => array( - 'description' => 'This is incremented every time a file changes.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - 'filesize_processed' => array( - 'description' => 'The file size in bytes after minification and compression.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - 'use_strict' => array( - 'description' => 'If 1 then the js file starts with "use strict";. If 0 then it does not.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - ), - 'indexes' => array( - 'content_hash' => array('content_hash'), - 'filetype' => array('filetype'), - 'filesize' => array('filesize'), - 'use_strict' => array('use_strict'), - ), - 'primary key' => array('filename_hash'), - ); - - $schema['advagg_aggregates'] = array( - 'description' => 'What files are used in what aggregates.', - 'fields' => array( - 'aggregate_filenames_hash' => array( - 'description' => 'Hash of the aggregates list of files. Keep track of what files are in the aggregate.', - 'type' => 'char', - 'length' => 43, - 'not null' => TRUE, - 'default' => '', - 'binary' => TRUE, - 'collation' => 'ascii_bin', - 'charset' => 'ascii', - 'mysql_character_set' => 'ascii', - ), - 'filename_hash' => array( - 'description' => 'Hash of path and filename.', - 'type' => 'char', - 'length' => 43, - 'not null' => TRUE, - 'default' => '', - 'binary' => TRUE, - 'collation' => 'ascii_bin', - 'charset' => 'ascii', - 'mysql_character_set' => 'ascii', - ), - 'porder' => array( - 'description' => 'Processing order.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - 'settings' => array( - 'description' => 'Extra data about this file and how it is used in this aggregate.', - 'type' => 'blob', - 'not null' => TRUE, - 'size' => 'big', - 'translatable' => TRUE, - 'serialize' => TRUE, - ), - ), - 'indexes' => array( - 'porder' => array('porder'), - 'filename_hash' => array('filename_hash'), - 'aggregate_filenames_hash_porder' => array('aggregate_filenames_hash', 'porder'), - ), - 'primary key' => array('aggregate_filenames_hash', 'filename_hash'), - ); - - $schema['advagg_aggregates_versions'] = array( - 'description' => 'What files are used in what aggregates.', - 'fields' => array( - 'aggregate_filenames_hash' => array( - 'description' => 'Hash of the aggregates list of files. Keep track of what files are in the aggregate.', - 'type' => 'char', - 'length' => 43, - 'not null' => TRUE, - 'default' => '', - 'binary' => TRUE, - 'collation' => 'ascii_bin', - 'charset' => 'ascii', - 'mysql_character_set' => 'ascii', - ), - 'aggregate_contents_hash' => array( - 'description' => 'Hash of all content_hashes in this aggregate. Simple Version control of the aggregate.', - 'type' => 'char', - 'length' => 43, - 'not null' => TRUE, - 'default' => '', - 'binary' => TRUE, - 'collation' => 'ascii_bin', - 'charset' => 'ascii', - 'mysql_character_set' => 'ascii', - ), - 'atime' => array( - 'description' => 'Last access time for this version of the aggregate. Updated every 12 hours.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - 'root' => array( - 'description' => 'If 1 then it is a root aggregate. 0 means not root aggregate.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - ), - 'indexes' => array( - 'root' => array('root'), - 'atime' => array('atime'), - 'root_atime' => array( - 'root', - 'atime', - ), - ), - 'primary key' => array('aggregate_filenames_hash', 'aggregate_contents_hash'), - ); - - // Copy the variable table and change a couple of things. - $schema['advagg_aggregates_hashes'] = drupal_get_schema_unprocessed('system', 'variable'); - $schema['advagg_aggregates_hashes']['fields']['hash'] = $schema['advagg_aggregates_hashes']['fields']['name']; - $schema['advagg_aggregates_hashes']['fields']['hash']['length'] = 255; - $schema['advagg_aggregates_hashes']['fields']['hash']['description'] = 'The name of the hash.'; - $schema['advagg_aggregates_hashes']['fields']['hash']['binary'] = TRUE; - $schema['advagg_aggregates_hashes']['fields']['settings']['description'] = 'The settings associated with this hash.'; - $schema['advagg_aggregates_hashes']['fields']['settings'] = $schema['advagg_aggregates_hashes']['fields']['value']; - $schema['advagg_aggregates_hashes']['description'] = 'Key value pairs created by AdvAgg. Stores settings used at the time that the aggregate was created.'; - $schema['advagg_aggregates_hashes']['primary key'][0] = 'hash'; - unset($schema['advagg_aggregates_hashes']['fields']['name'], $schema['advagg_aggregates_hashes']['fields']['value']); - - return $schema; -} - -/** - * Upgrade AdvAgg previous versions (6.x-1.x and 7.x-1.x) to 7.x-2.x. - */ -function advagg_update_7200(&$sandbox) { - // Check and see if new tables exist. - $table_names = array_keys(advagg_schema()); - $all_tables_exist = TRUE; - foreach ($table_names as $table_name) { - if (!db_table_exists($table_name)) { - $all_tables_exist = FALSE; - } - } - // Bail if needed DB Tables exist. - if ($all_tables_exist) { - return t('Nothing needed to happen in Advanced CSS/JS Aggregation.'); - } - - // Remove all old advagg variables. - db_delete('variable') - ->condition('name', 'advagg%', 'LIKE') - ->execute(); - - // Remove old schema. - $tables_to_remove = array( - 'cache_advagg', - 'cache_advagg_files_data', - 'cache_advagg_bundle_reuse', - 'advagg_files', - 'advagg_bundles', - ); - foreach ($tables_to_remove as $table_to_remove) { - if (db_table_exists($table_to_remove)) { - db_drop_table($table_to_remove); - } - } - - // Install new schema. - drupal_install_schema('advagg'); - - return t('Upgraded Advanced CSS/JS Aggregation to 7.x-2.x.'); -} - -/** - * Remove Last-Modified Header from .htaccess to fix far future 304's. - */ -function advagg_update_7201(&$sandbox) { - return advagg_install_update_htaccess('Header set Last-Modified'); -} - -/** - * Remove the 480 week Far-Future code from .htaccess (violates RFC 2616 14.21). - */ -function advagg_update_7202(&$sandbox) { - return advagg_install_update_htaccess('290304000'); -} - -/** - * Add forcing of .js files to be application/javascript to follow RFC 4329 7.1. - */ -function advagg_update_7203(&$sandbox) { - return advagg_install_update_htaccess('', 'ForceType'); -} - -/** - * Remove empty temporary files left behind by AdvAgg. - */ -function advagg_update_7204(&$sandbox) { - // Make sure the advagg_get_root_files_dir() function is available. - drupal_load('module', 'advagg'); - - // Get the advagg paths. - $advagg_path = advagg_get_root_files_dir(); - - // Get the top level path. - $top_level = substr($advagg_path[0][0], 0, strpos($advagg_path[0][0], 'advagg_css')); - - // Start timer. - timer_start(__FUNCTION__); - - // Remove empty temp files from public://. - $files = file_scan_directory($top_level, '/file.*/', array( - 'recurse' => FALSE, - 'callback' => 'advagg_install_delete_empty_file_if_stale', - )); - - // Stop timer. - $time = timer_stop(__FUNCTION__); - $time = round($time['time'] / 1000, 4); - - // Output info. - if (count($files) > 0) { - return t('%count temporary files where removed in %time seconds', array( - '%count' => count($files), - '%time' => $time, - )); - } - else { - return t('Nothing needed to be done.'); - } -} - -/** - * Fix incorrect usage of ForceType in .htaccess from update 7203. - */ -function advagg_update_7205(&$sandbox) { - return t('First pattern results: !first Second pattern results: !second', array( - '!first' => advagg_install_update_htaccess('ForceType text/css .js'), - '!second' => advagg_install_update_htaccess('ForceType application/javascript .js'), - )); -} - -/** - * Update the schema making the varchar columns utf8_bin in MySQL. - */ -function advagg_update_7206(&$sandbox) { - $db_type = Database::getConnection()->databaseType(); - $tables_altered = array(); - if ($db_type === 'mysql') { - module_load_include('install', 'advagg', 'advagg'); - $schema = advagg_schema(); - $schema = array_keys($schema); - foreach ($schema as $table_name) { - $table_name = Database::getConnection()->prefixTables('{' . db_escape_table($table_name) . '}'); - $results = db_query("SHOW FULL FIELDS FROM $table_name")->fetchAllAssoc('Field'); - foreach ($results as $row) { - if (stripos($row->Type, 'varchar') !== FALSE && $row->Collation !== 'utf8_bin') { - db_query("ALTER TABLE $table_name MODIFY {$row->Field} {$row->Type} CHARACTER SET utf8 COLLATE utf8_bin"); - $tables_altered[$table_name][] = $row->Field; - } - } - } - } - - if (empty($tables_altered)) { - return t('Nothing needed to happen in AdvAgg.'); - } - - return t('The following columns inside of these database tables where converted to utf8_bin:
@data', array('@data' => print_r($tables_altered, TRUE))); -} - -/** - * Update schema making the varchar columns char. Change utf8_bin to ascii_bin. - */ -function advagg_update_7207(&$sandbox) { - $tables = array( - 'advagg_aggregates' => array( - 'aggregate_filenames_hash', - 'filename_hash', - ), - 'advagg_aggregates_versions' => array( - 'aggregate_filenames_hash', - 'aggregate_contents_hash', - ), - 'advagg_files' => array( - 'filename_hash', - 'content_hash', - ), - ); - - $schema = advagg_schema(); - foreach ($tables as $table => $fields) { - foreach ($fields as $field) { - // Change varchar to char. - db_change_field($table, $field, $field, $schema[$table]['fields'][$field]); - } - // Change utf8_bin to ascii_bin. - advagg_install_change_table_collation($table, $fields, 'ascii_bin', $schema[$table]['fields']); - } - return t('AdvAgg Tables converted from varchar to char and utf8_bin to ascii_bin.'); -} - -/** - * Add an index to the filename_hash column in the advagg_aggregates table. - */ -function advagg_update_7208(&$sandbox) { - if (!db_index_exists('advagg_aggregates', 'filename_hash')) { - db_add_index('advagg_aggregates', 'filename_hash', array('filename_hash')); - return t('Database index added to the filename_hash column of the advagg_aggregates table.'); - } - return t('Nothing needed to be done.'); -} - -/** - * Update schema making it match the definition. - */ -function advagg_update_7209(&$sandbox) { - $tables = array( - 'advagg_aggregates' => array( - 'aggregate_filenames_hash', - 'filename_hash', - ), - 'advagg_aggregates_versions' => array( - 'aggregate_filenames_hash', - 'aggregate_contents_hash', - ), - 'advagg_files' => array( - 'filename_hash', - 'content_hash', - ), - ); - - $schema = advagg_schema(); - foreach ($tables as $table => $fields) { - foreach ($fields as $field) { - // Change varchar to char. - db_change_field($table, $field, $field, $schema[$table]['fields'][$field]); - } - // Change utf8_bin to ascii_bin. - advagg_install_change_table_collation($table, $fields, 'ascii_bin', $schema[$table]['fields']); - } - return t('Database schema was adjusted to match what is listed in advagg_schema.'); -} - -/** - * Add filesize_processed field to advagg_files table. - */ -function advagg_update_7210() { - if (!db_field_exists('advagg_files', 'filesize_processed')) { - $spec = array( - 'description' => 'The file size in bytes after minification and compression.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ); - db_add_field('advagg_files', 'filesize_processed', $spec); - } - return t('The filesize_processed field has been added to the advagg_files table.'); -} - -/** - * Populate the filesize_processed field in the advagg_files table. - */ -function advagg_update_7211(&$sandbox) { - drupal_load('module', 'advagg'); - module_load_include('inc', 'advagg', 'advagg'); - $types = array('css', 'js'); - - // If first run of this update function then set progress variables. - if (!isset($sandbox['progress'])) { - $count = db_select('advagg_files', 'af') - ->fields('af') - ->condition('filesize_processed', 0) - ->countQuery() - ->execute() - ->fetchField(); - $sandbox['progress'] = 0; - $sandbox['max'] = $count; - } - - // How many items should be processed per pass. - $limit = 20; - - foreach ($types as $type) { - $query = db_select('advagg_files', 'af') - ->fields('af') - ->condition('filesize_processed', 0) - ->condition('filetype', $type) - ->range($sandbox['progress'], $limit) - ->execute(); - foreach ($query as $row) { - $row->filesize_processed = (int) advagg_generate_filesize_processed($row->filename, $type); - if (!empty($row->filesize_processed)) { - $write = (array) $row; - db_merge('advagg_files') - ->key(array( - 'filename_hash' => $write['filename_hash'], - )) - ->fields($write) - ->execute(); - } - } - } - - // Update our progress information. - $sandbox['progress'] += $limit; - // Set the value for finished. - $sandbox['#finished'] = ($sandbox['progress'] >= $sandbox['max']) ? TRUE : ($sandbox['progress'] / $sandbox['max']); - - if ($sandbox['#finished']) { - return t('The filesize_processed field has been populated inside the advagg_files table.'); - } -} - -/** - * Add use_strict field to advagg_files table. - */ -function advagg_update_7212() { - if (!db_field_exists('advagg_files', 'use_strict')) { - $spec = array( - 'description' => 'If 1 then the js file starts with "use strict";. If 0 then it does not.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ); - db_add_field('advagg_files', 'use_strict', $spec); - } - if (!db_index_exists('advagg_files', 'use_strict')) { - db_add_index('advagg_files', 'use_strict', array('use_strict')); - } - return t('The use_strict field has been added to the advagg_files table.'); -} - -/** - * Populate the use_strict field in the advagg_files table. - */ -function advagg_update_7213(&$sandbox) { - drupal_load('module', 'advagg'); - module_load_include('inc', 'advagg', 'advagg'); - - // If first run of this update function then set progress variables. - if (!isset($sandbox['progress'])) { - $count = db_select('advagg_files', 'af') - ->fields('af') - ->condition('filetype', 'js') - ->countQuery() - ->execute() - ->fetchField(); - $sandbox['progress'] = 0; - $sandbox['max'] = $count; - } - - // How many items should be processed per pass. - $limit = 10; - - $query = db_select('advagg_files', 'af') - ->fields('af') - ->condition('filetype', 'js') - ->range($sandbox['progress'], $limit) - ->execute(); - foreach ($query as $row) { - $row->use_strict = (int) advagg_does_js_start_with_use_strict($row->filename); - if (!empty($row->use_strict)) { - $write = (array) $row; - db_merge('advagg_files') - ->key(array( - 'filename_hash' => $write['filename_hash'], - )) - ->fields($write) - ->execute(); - } - } - - // Update our progress information. - $sandbox['progress'] += $limit; - // Set the value for finished. - $sandbox['#finished'] = ($sandbox['progress'] >= $sandbox['max']) ? TRUE : ($sandbox['progress'] / $sandbox['max']); - - if ($sandbox['#finished']) { - return t('The use_strict field has been populated inside the advagg_files table.'); - } -} - -/** - * Update .htaccess to support brotli compression (br). - */ -function advagg_update_7214(&$sandbox) { - return advagg_install_update_htaccess('', 'brotli'); -} - -/** - * Update .htaccess to support brotli compression (br). - */ -function advagg_update_7215(&$sandbox) { - return advagg_install_update_htaccess('', '%{HTTP:Accept-encoding} gzip'); -} - -/** - * Update .htaccess to support brotli compression (br). - */ -function advagg_update_7216(&$sandbox) { - if ($GLOBALS['base_path'] !== '/') { - return advagg_install_update_htaccess('', 'ErrorDocument 404'); - } -} - -/** - * Update migrate the advagg_browser_dns_prefetch variable. - */ -function advagg_update_7217(&$sandbox) { - $advagg_browser_dns_prefetch = variable_get('advagg_browser_dns_prefetch', NULL); - $advagg_resource_hints_dns_prefetch = variable_get('advagg_resource_hints_dns_prefetch', NULL); - $advagg_resource_hints_location = variable_get('advagg_resource_hints_location', NULL); - variable_del('advagg_browser_dns_prefetch'); - if (empty($advagg_browser_dns_prefetch) - || !is_null($advagg_resource_hints_dns_prefetch) - || !is_null($advagg_resource_hints_location) - ) { - return t('Nothing needed to be done.'); - } - drupal_load('module', 'advagg'); - $config_path = advagg_admin_config_root_path(); - - if ($advagg_browser_dns_prefetch == 1) { - variable_set('advagg_resource_hints_location', 1); - variable_set('advagg_resource_hints_dns_prefetch', TRUE); - } - elseif ($advagg_browser_dns_prefetch == 2) { - variable_set('advagg_resource_hints_location', 3); - variable_set('advagg_resource_hints_dns_prefetch', TRUE); - } - else { - return t('Nothing happened.'); - } - return t('Old DNS Prefetch variable transferred to the new variable. Other options are under Resource Hints on the configuration page', array('@url' => url($config_path . '/advagg', array('fragment' => 'edit-resource-hints')))); -} - -/** - * Update the advagg .htaccess file fixing edge cases with the new rules. - */ -function advagg_update_7218(&$sandbox) { - return advagg_install_update_htaccess('', 'Options +FollowSymLinks'); -} - -/** - * Update the .htaccess file in the advagg directories adding immutable header. - */ -function advagg_update_7219(&$sandbox) { - return advagg_install_update_htaccess('', 'immutable'); -} - -/** - * Update the advagg_files table; use_strict column might have been incorrect. - */ -function advagg_update_7220() { - // Get all files that have use_strict marked. - $filenames = array(); - $query = db_select('advagg_files', 'af') - ->fields('af', array('filename', 'use_strict')) - ->condition('use_strict', 1) - ->execute(); - foreach ($query as $row) { - $filenames[] = $row->filename; - } - if (empty($filenames)) { - return t('Nothing needed to happen. Good to go!'); - } - - drupal_load('module', 'advagg'); - module_load_include('inc', 'advagg', 'advagg'); - - // Force change. - $info = advagg_get_info_on_files($filenames); - foreach ($info as &$value) { - $value['mtime']++; - } - advagg_insert_update_files($info, 'js'); - - // Fix changed record. - advagg_get_info_on_files($filenames); - advagg_insert_update_files($info, 'js'); - - // Detect changes. - $filenames_new = array(); - $query = db_select('advagg_files', 'af') - ->fields('af', array('filename', 'use_strict')) - ->condition('use_strict', 1) - ->execute(); - foreach ($query as $row) { - $filenames_new[] = $row->filename; - } - - // Output results. - if (count($filenames_new) == count($filenames_new)) { - return t('Nothing needed to happen. Good to go!'); - } - else { - return t('The advagg_files table has been updated; use_strict column has been updated.'); - } -} - -/** - * Add index to aggregate_filenames_hash and porder in advagg_aggregates table. - */ -function advagg_update_7221(&$sandbox) { - if (!db_index_exists('advagg_aggregates', 'aggregate_filenames_hash_porder')) { - db_add_index('advagg_aggregates', 'aggregate_filenames_hash_porder', array('aggregate_filenames_hash', 'porder')); - return t('Database index added to the aggregate_filenames_hash and porder column of the advagg_aggregates table.'); - } - return t('Nothing needed to be done.'); -} - -/** - * Run various checks that are fast. - * - * @param string $phase - * Can be install, update, or runtime. - * - * @return array - * An associative array. - */ -function advagg_install_fast_checks($phase = 'runtime') { - $requirements = array(); - // Ensure translations don't break at install time. - $t = get_t(); - - // Always check these, independent of the current phase. - $function_list = array( - 'rename', - ); - // Check each function to make sure it exists. - foreach ($function_list as $function_name) { - if (!function_exists($function_name)) { - $requirements['advagg_function_' . $function_name] = array( - 'title' => $t('Adv CSS/JS Agg - Function Disabled'), - 'value' => $phase === 'install' ? FALSE : $function_name, - 'severity' => REQUIREMENT_ERROR, - 'description' => $t('%name() is disabled on this server. Please contact your hosting provider or server administrator and see if they can re-enable this function for you.', array( - '!url' => 'http://php.net/' . str_replace('_', '-', $function_name), - '%name' => $function_name, - )), - ); - } - } - // Check to see if any incompatible modules are installed. - if (module_exists('agrcache')) { - $requirements['advagg_module_agrcache'] = array( - 'title' => $t('Adv CSS/JS Agg - Aggregate cache module'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $phase === 'install' ? FALSE : $t('The Aggregate cache module is incompatible with AdvAgg.'), - 'description' => $t('You need to uninstall the agrcache module or uninstall AdvAgg.'), - ); - } - if (module_exists('bundle_aggregation')) { - $requirements['advagg_module_bundle_aggregation'] = array( - 'title' => $t('Adv CSS/JS Agg - Bundle aggregation module'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $phase === 'install' ? FALSE : $t('The Bundle aggregation module is incompatible with AdvAgg.'), - 'description' => $t('You need to uninstall the bundle_aggregation module or uninstall AdvAgg.'), - ); - } - if (module_exists('core_library')) { - $requirements['advagg_module_core_library'] = array( - 'title' => $t('Adv CSS/JS Agg - Core Library module'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $phase === 'install' ? FALSE : $t('The Core Library module is incompatible with AdvAgg.'), - 'description' => $t('You need to uninstall the core_library module or uninstall AdvAgg.'), - ); - } - - // If not at runtime, return here. - if ($phase !== 'runtime') { - return $requirements; - } - // Make sure the advagg default values for variable_get are available. - drupal_load('module', 'advagg'); - - // Do the following checks only at runtime. - list($css_path, $js_path) = advagg_get_root_files_dir(); - $config_path = advagg_admin_config_root_path(); - - // Make sure directories are writable. - if (!file_prepare_directory($css_path[0], FILE_CREATE_DIRECTORY + FILE_MODIFY_PERMISSIONS)) { - $requirements['advagg_css_path_0_prepare_dir'] = array( - 'title' => $t('Adv CSS/JS Agg - CSS Path'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('CSS directory is not created or writable.'), - 'description' => $t('%path is not setup correctly.', array('%path' => $css_path[0])), - ); - } - if (!is_writable($css_path[0])) { - $requirements['advagg_css_path_0_write'] = array( - 'title' => $t('Adv CSS/JS Agg - CSS Path'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('CSS directory is not writable.'), - 'description' => $t('%path is not setup correctly.', array('%path' => $css_path[0])), - ); - } - if (!is_readable($css_path[0])) { - $requirements['advagg_css_path_0_read'] = array( - 'title' => $t('Adv CSS/JS Agg - CSS Path'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('CSS directory is not readable.'), - 'description' => $t('%path is not setup correctly.', array('%path' => $css_path[0])), - ); - } - $css_wrapper = file_stream_wrapper_get_instance_by_uri($css_path[0]); - if ($css_wrapper instanceof DrupalLocalStreamWrapper) { - if (!is_writable($css_path[1])) { - $requirements['advagg_css_path_1_write'] = array( - 'title' => $t('Adv CSS/JS Agg - CSS Path'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('CSS directory is not writable.'), - 'description' => $t('%path is not setup correctly.', array('%path' => $css_path[1])), - ); - } - if (!is_readable($css_path[1])) { - $requirements['advagg_css_path_1_read'] = array( - 'title' => $t('Adv CSS/JS Agg - CSS Path'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('CSS directory is not readable.'), - 'description' => $t('%path is not setup correctly.', array('%path' => $css_path[1])), - ); - } - } - if (!file_prepare_directory($js_path[0], FILE_CREATE_DIRECTORY + FILE_MODIFY_PERMISSIONS)) { - $requirements['advagg_js_path_0_prepare_dir'] = array( - 'title' => $t('Adv CSS/JS Agg - JS Path'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('JS directory is not created or writable.'), - 'description' => $t('%path is not setup correctly.', array('%path' => $js_path[0])), - ); - } - if (!is_writable($js_path[0])) { - $requirements['advagg_js_path_0_write'] = array( - 'title' => $t('Adv CSS/JS Agg - JS Path'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('JS directory is not writable.'), - 'description' => $t('%path is not setup correctly.', array('%path' => $js_path[0])), - ); - } - if (!is_readable($js_path[0])) { - $requirements['advagg_js_path_0_read'] = array( - 'title' => $t('Adv CSS/JS Agg - JS Path'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('JS directory is not readable.'), - 'description' => $t('%path is not setup correctly.', array('%path' => $js_path[0])), - ); - } - $js_wrapper = file_stream_wrapper_get_instance_by_uri($js_path[0]); - if ($js_wrapper instanceof DrupalLocalStreamWrapper) { - if (!is_writable($js_path[1])) { - $requirements['advagg_js_path_1_write'] = array( - 'title' => $t('Adv CSS/JS Agg - JS Path'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('JS directory is not writable.'), - 'description' => $t('%path is not setup correctly.', array('%path' => $js_path[1])), - ); - } - if (!is_readable($js_path[1])) { - $requirements['advagg_js_path_1_read'] = array( - 'title' => $t('Adv CSS/JS Agg - JS Path'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('JS directory is not readable.'), - 'description' => $t('%path is not setup correctly.', array('%path' => $js_path[1])), - ); - } - } - - if (!variable_get('advagg_skip_enabled_preprocess_check', ADVAGG_SKIP_ENABLED_PREPROCESS_CHECK)) { - // Make sure variables are set correctly. - if (!variable_get('advagg_enabled', ADVAGG_ENABLED)) { - $requirements['advagg_not_on'] = array( - 'title' => $t('Adv CSS/JS Agg - Enabled'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('Advanced CSS/JS aggregation is disabled.'), - 'description' => $t('Go to the Advanced CSS/JS aggregation settings page and enable it.', array('@settings' => url($config_path . '/advagg'))), - ); - } - if (!variable_get('preprocess_css', FALSE) || !variable_get('preprocess_js', FALSE)) { - $requirements['advagg_core_off'] = array( - 'title' => $t('Adv CSS/JS Agg - Core Variables'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('Core CSS and/or JS aggregation is disabled.'), - 'description' => $t('"Optimize CSS files" and "Optimize JavaScript files" on the performance page should be enabled.', array('@performance' => url('admin/config/development/performance', array('fragment' => 'edit-bandwidth-optimization')))), - ); - } - } - - // Check that the menu router handler is working. - // Paths will vary based on s3fs no_rewrite_cssjs setting. - if (advagg_s3fs_evaluate_no_rewrite_cssjs(FALSE)) { - // If using s3fs and no_rewrite_cssjs is not set, external paths are needed. - // Use $css_path[0] and $js_path[0] since they contain the scheme. - $menu_path_key = 0; - $menu_css_path = trim(parse_url(file_create_url($css_path[0] . '/test.css'), PHP_URL_PATH)); - if (strpos($menu_css_path, $GLOBALS['base_path']) === 0) { - $menu_css_path = substr($menu_css_path, strlen($GLOBALS['base_path'])); - } - $menu_js_path = trim(parse_url(file_create_url($js_path[0] . '/test.js'), PHP_URL_PATH)); - if (strpos($menu_js_path, $GLOBALS['base_path']) === 0) { - $menu_js_path = substr($menu_js_path, strlen($GLOBALS['base_path'])); - } - } - else { - // Determine paths if not using s3fs, or no_rewrite_cssjs is set. - // Use $css_path[1] and $js_path[1] since they are without schemes. - $menu_path_key = 1; - $menu_css_path = $css_path[1] . '/test.css'; - $menu_js_path = $js_path[1] . '/test.js'; - } - - // Use the paths set above to check menu router handler. - $advagg_async_generation_menu_issue = FALSE; - if (!file_uri_scheme($css_path[$menu_path_key])) { - $item_css = menu_get_item($menu_css_path); - if (empty($item_css['page_callback']) - || strpos($item_css['page_callback'], 'advagg') === FALSE - ) { - $advagg_async_generation_menu_issue = TRUE; - } - } - if (!file_uri_scheme($js_path[$menu_path_key])) { - $item_js = menu_get_item($menu_js_path); - if (empty($item_js['page_callback']) - || strpos($item_js['page_callback'], 'advagg') === FALSE - ) { - $advagg_async_generation_menu_issue = TRUE; - } - } - if ($advagg_async_generation_menu_issue) { - $requirements['advagg_async_generation_menu_issue'] = array( - 'title' => $t('Adv CSS/JS Agg - Async Mode'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('Flush your caches.'), - 'description' => $t('You need to flush your menu cache. This can be done at the top of the performance page; under "Clear cache" press the "Clear all caches" button.', array( - '@performance' => url('admin/config/development/performance'), - )), - ); - } - - // Make hook_element_info_alter worked. - $styles_info = element_info('styles'); - $scripts_info = element_info('scripts'); - if (empty($styles_info['#pre_render']) - || !is_array($styles_info['#pre_render']) - || !in_array('advagg_modify_css_pre_render', $styles_info['#pre_render']) - || empty($scripts_info['#pre_render']) - || !is_array($scripts_info['#pre_render']) - || !in_array('advagg_modify_js_pre_render', $scripts_info['#pre_render']) - ) { - if (!empty($scripts_info['#group_callback']) && $scripts_info['#group_callback'] === 'omega_group_js') { - $requirements['advagg_hook_element_info_alter_omega'] = array( - 'title' => $t('Adv CSS/JS Agg - omega theme patch'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('Omega theme needs a patch.'), - 'description' => $t('The patch can be found in this issue', array( - '@patch' => 'https://www.drupal.org/files/issues/omega-2492461-1-smarter-element-info-alter.patch', - '@issue' => 'https://www.drupal.org/node/2492461', - )), - ); - } - else { - $requirements['advagg_hook_element_info_alter'] = array( - 'title' => $t('Adv CSS/JS Agg - element_info'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('Flush your caches.'), - 'description' => $t('You need to flush your cache_bootstrap cache bin as advagg_hook_element_info_alter() is not working correctly. This can be done near the top of the performance page under Clear cache.
Styles:

@styles

Scripts:

@scripts

', array( - '@performance' => url('admin/config/development/performance'), - '@styles' => print_r($styles_info, TRUE), - '@scripts' => print_r($scripts_info, TRUE), - )), - ); - } - } - - // Make sure some modules have the correct patches installed. - if (module_exists('css_emimage')) { - $file_path = drupal_get_path('module', 'css_emimage'); - if (!file_exists($file_path . '/css_emimage.advagg.inc')) { - $requirements['advagg_module_css_emimage_patch'] = array( - 'title' => $t('Adv CSS/JS Agg - CSS Embedded Images module'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('The CSS Embedded Images module needs to be updated.'), - 'description' => $t('CSS Embedded Images needs to be upgraded to version 1.3 or higher, the currently installed version is incompatible with AdvAgg.', array('@link' => 'http://drupal.org/project/css_emimage')), - ); - } - } - if (module_exists('labjs')) { - if (!function_exists('labjs_advagg_modify_js_pre_render_alter')) { - $requirements['advagg_module_labjs_patch'] = array( - 'title' => $t('Adv CSS/JS Agg - LAB.js module'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('The LAB.js module needs a patch to be compatible with AdvAgg.'), - 'description' => $t('You need to install the latest patch in this issue.', array('@link' => 'http://drupal.org/node/1977122')), - ); - } - } - - // Adjust some modules settings. - $search404_ignore_query = variable_get('search404_ignore_query', 'gif jpg jpeg bmp png'); - if (module_exists('search404') && - (strpos($search404_ignore_query, 'css') === FALSE - || strpos($search404_ignore_query, 'js') === FALSE - ) - ) { - $added_ext = array(); - if (strpos($search404_ignore_query, 'css') === FALSE) { - $added_ext[] = 'css'; - } - if (strpos($search404_ignore_query, 'js') === FALSE) { - $added_ext[] = 'js'; - } - $requirements['advagg_search404_module'] = array( - 'title' => $t('Adv CSS/JS Agg - Search 404 Settings'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('HTTP requests to advagg for css/js files may not be generating correctly.'), - 'description' => $t('The Search 404 module is enabled. You need to change the search404_ignore_query setting, also known as "Extensions to abort search" so advagg will work. Go to the Search 404 settings page under the "Advanced settings" fieldgroup and look for the "Extensions to abort search" setting. Add @code to the string that looks like this:

@old

so it will then look like this:

@new

', array( - '@config' => url('admin/config/search/search404'), - '@code' => ' ' . implode(' ', $added_ext), - '@old' => $search404_ignore_query, - '@new' => trim($search404_ignore_query) . ' ' . implode(' ', $added_ext), - )), - ); - } - - if (module_exists('securepages') && variable_get('securepages_enable', 0) && function_exists('securepages_match')) { - $test_css = securepages_match($css_path[1] . '/test.css'); - $test_js = securepages_match($js_path[1] . '/test.js'); - if ($test_css === 0 || $test_js === 0) { - $added_paths = array(); - $securepages_ignore = variable_get('securepages_ignore', ''); - if (strpos($securepages_ignore, $css_path[1]) === FALSE) { - $added_paths[] = $css_path[1] . '/*'; - } - if (strpos($securepages_ignore, $js_path[1]) === FALSE) { - $added_paths[] = $js_path[1] . '/*'; - } - if (!empty($added_paths)) { - $requirements['advagg_securepages_module'] = array( - 'title' => $t('Adv CSS/JS Agg - Secure Pages Settings'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('Requests to advagg for css/js files may be getting redirected to http on a https page.'), - ); - if (!empty($securepages_ignore)) { - $requirements['advagg_securepages_module']['description'] = $t('The Secure Pages module is enabled. You need to change the securepages_ignore setting, also known as "Ignore pages" so advagg will work. Go to the Secure Pages settings page and under the "Ignore pages" setting add

!code

to the string that looks like this:

@old

so it will then look like this:

@old
!code

', array( - '@config' => url('admin/config/system/securepages', array('fragment' => 'edit-securepages-ignore')), - '!code' => implode("\n
", $added_paths), - '@old' => trim($securepages_ignore), - )); - } - else { - $requirements['advagg_securepages_module']['description'] = $t('The Secure Pages module is enabled. You need to change the securepages_ignore setting, also known as "Ignore pages" so advagg will work. Go to the Secure Pages settings page and under the "Ignore pages" setting add

!code

to that section.', array( - '@config' => url('admin/config/system/securepages', array('fragment' => 'edit-securepages-ignore')), - '!code' => implode("\n
", $added_paths), - )); - } - } - } - } - - // Check that https is correct. - if (empty($GLOBALS['is_https']) && - ((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on') - || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') - || (isset($_SERVER['HTTP_HTTPS']) && $_SERVER['HTTP_HTTPS'] === 'on') - ) - ) { - $requirements['advagg_is_https_check'] = array( - 'title' => $t('Adv CSS/JS Agg - HTTPS'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('The core global $is_https is not TRUE.'), - 'description' => $t('You need to add in this logic near the top your settings.php file:
@code
', array( - '@code' => 'if ((isset($_SERVER[\'HTTPS\']) && strtolower($_SERVER[\'HTTPS\']) == \'on\') - || (isset($_SERVER[\'HTTP_X_FORWARDED_PROTO\']) && $_SERVER[\'HTTP_X_FORWARDED_PROTO\'] == \'https\') - || (isset($_SERVER[\'HTTP_HTTPS\']) && $_SERVER[\'HTTP_HTTPS\'] == \'on\') -) { - $_SERVER[\'HTTPS\'] = \'on\'; -}', - )), - ); - } - - // Make sure $base_url is correct. - // Site is https but $base_url starts with http://. - if (!empty($GLOBALS['is_https']) - && strpos($GLOBALS['base_url'], 'http://') === 0 - ) { - $requirements['advagg_is_https_check'] = array( - 'title' => $t('Adv CSS/JS Agg - $base_url'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('The core global $base_url\'s scheme is incorrect.'), - 'description' => $t('You need to add in this logic near the bottom of your settings.php file:

@code

', array( - '@code' => 'if (isset($_SERVER["HTTPS"]) && strtolower($_SERVER["HTTPS"]) == "on" && isset($base_url)) { - $base_url = str_replace("http://", "https://", $base_url); -}', - )), - ); - } - - return $requirements; -} - -/** - * Implements hook_requirements(). - */ -function advagg_requirements($phase) { - $t = get_t(); - $requirements = advagg_install_fast_checks($phase); - // If not at runtime, return here. - if ($phase !== 'runtime') { - return $requirements; - } - - // Make sure outbound http requests will work. - $request = drupal_http_request('https://www.google.com/robots.txt', array('timeout' => 8)); - if (empty($request->data) || $request->code != 200) { - $requirements['advagg_drupal_http_request_failure'] = array( - 'title' => $t('Adv CSS/JS Agg - drupal_http_request test'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('An external request for https://www.google.com/robots.txt could not be fulfilled.'), - 'description' => $t('If drupal_http_request does not work, the tests that AdvAgg performs may not be accurate.'), - ); - } - - // Make sure http requests to advagg will work. - advagg_install_check_via_http($requirements); - - // Check that file writes happen without any errors. - if (empty($requirements)) { - module_load_include("missing.inc", "advagg"); - $current_hash = advagg_get_current_hooks_hash(); - $aggregate_settings = advagg_get_hash_settings($current_hash); - $types = array('css', 'js'); - foreach ($types as $type) { - $filename = $type . ADVAGG_SPACE . 'test_write' . REQUEST_TIME . '.' . $type; - $files = array('misc/farbtastic/farbtastic.' . $type => array()); - list($files_to_save, $errors) = advagg_save_aggregate($filename, $files, $type, $aggregate_settings); - foreach ($files_to_save as $uri => $data) { - @unlink($uri); - } - if (!empty($errors)) { - $requirements['advagg_file_write_error_' . $type] = array( - 'title' => $t('Adv CSS/JS Agg - File Write'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('File write had some issues with %type files.', array('%type' => $type)), - 'description' => $t('Most likely there is an issue with file and/or directory premissions. Error: @error', array( - '@error' => print_r($errors, TRUE), - )), - ); - } - } - } - - // If all requirements have been met, state advagg should be working. - if (empty($requirements)) { - $description = ''; - - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - $description .= ' ' . $t('Currently running in development mode.'); - } - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 5) { - $aggressive_cache_conflicts = advagg_aggressive_cache_conflicts(); - if (empty($aggressive_cache_conflicts)) { - $description .= ' ' . $t('It appears that there are no incompatible modules, so you should be able to safely use the Aggressive cache. To adjust this setting, go to the AdvAgg: configuration page and under "AdvAgg Cache Settings" select Aggressive and then save.', array( - '@config' => url('admin/config/development/performance/advagg', array( - 'fragment' => 'edit-advagg-cache-level', - )), - )); - } - } - - $requirements['advagg_ok'] = array( - 'title' => $t('Adv CSS/JS Agg'), - 'severity' => REQUIREMENT_OK, - 'value' => $t('OK'), - 'description' => $t('Advanced CSS/JS Aggregator should be working correctly.') . ' ' . $description, - ); - } - - return $requirements; -} - -/** - * @} End of "addtogroup hooks". - */ - -/** - * Make sure http requests to css/js files work correctly. - * - * @param array $requirements - * Array of requirements used in hook_requirements(). - */ -function advagg_install_check_via_http(array &$requirements) { - // If other checks have not passed, do not test this. - if (!empty($requirements)) { - return; - } - - // Ensure translations don't break at install time. - $t = get_t(); - - // Setup some variables. - list($css_path, $js_path) = advagg_get_root_files_dir(); - $types = array('css', 'js'); - $config_path = advagg_admin_config_root_path(); - - // Get s3fs no_rewrite_cssjs setting. - $s3fs_no_rewrite_cssjs = advagg_get_s3fs_config('no_rewrite_cssjs'); - - // Make sure we get an advagg fast 404. - $mod_url = FALSE; - if (!variable_get('maintenance_mode', FALSE) && !variable_get('advagg_skip_404_check', FALSE)) { - foreach ($types as $type) { - if ($type === 'css') { - $url_path = $css_path[0]; - $file_path = $css_path[1]; - } - elseif ($type === 'js') { - $url_path = $js_path[0]; - $file_path = $js_path[1]; - } - - // Set arguments for drupal_http_request(). - // Make a 404 request to the advagg menu callback. - $url = file_create_url($url_path . '/' . $type . ADVAGG_SPACE . REQUEST_TIME . '.' . $type); - $options = array('timeout' => 8); - - if (empty($url)) { - $filename_path = (!is_null($s3fs_no_rewrite_cssjs) && empty($s3fs_no_rewrite_cssjs)) ? $url_path : $file_path; - $filename = advagg_install_get_first_advagg_file($filename_path, $type); - $url = file_create_url($url_path . '/' . $filename); - $end = strpos($url, $filename); - if ($end !== FALSE) { - $url = substr($url, 0, $end) . $type . ADVAGG_SPACE . REQUEST_TIME . '.' . $type; - } - else { - $requirements['advagg_self_request'] = array( - 'title' => $t('Adv CSS/JS Agg - Self Request Failure'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('The uri: %url can not be converted to a url.', array('%url' => $url_path . '/' . $type . ADVAGG_SPACE . REQUEST_TIME . '.' . $type)), - 'description' => $t('If you are using a non default stream wrapper this might be the issue.'), - ); - continue; - } - } - - // Send request. - advagg_install_url_mod($url, $options, $mod_url); - $request = drupal_http_request($url, $options); - - // Try an alt URL if the request code is not positive. - if ($request->code < 0) { - $mod_url = TRUE; - advagg_install_url_mod($url, $options, $mod_url); - $new_request = drupal_http_request($url, $options); - - if ($new_request->code < 0) { - $description = ''; - if (!module_exists('httprl')) { - $description = t('Enabling the HTTP Parallel Request and Threading Library module might be able to fix this as AdvAgg will use HTTPRL to build the URL if it is enabled.', array('!httprl' => 'https://drupal.org/project/httprl')); - } - $requirements['advagg_self_request'] = array( - 'title' => $t('Adv CSS/JS Agg - Self Request Failure'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('HTTP loopback requests to this server are returning a non positive response code of %code', array('%code' => $new_request->code)), - 'description' => $t('If you have manually verified that AdvAgg is working correctly you can set the advagg_skip_404_check variable to TRUE in your settings.php. Editing the servers hosts file so the host name points to the localhost might also fix this (127.0.0.1 !hostname). To manually check go to @url, view the source (press ctrl+u on your keyboard) and check for this string @string. If that string is in the source, you can safely add this to your settings.php file @code', array( - '!hostname' => $_SERVER['HTTP_HOST'], - '@url' => $url, - '@string' => '', - '@code' => '$conf[\'advagg_skip_404_check\'] = TRUE;', - )) . ' ' . $description, - ); - // Skip the rest of the advagg checks as they will all fail. - $types = array(); - break; - } - else { - $request = $new_request; - } - } - - // Try request without https. - if ($request->code == 0 && stripos($request->error, 'Error opening socket ssl://') !== FALSE) { - $url = advagg_force_http_path($url); - $request = drupal_http_request($url, $options); - } - - // Try request to 127.0.0.1. - if ($request->code == 0 && stripos($request->error, 'getaddrinfo failed') !== FALSE) { - $parts = @parse_url($url); - if ($parts['host'] !== '127.0.0.1') { - $options['headers']['Host'] = $parts['host']; - $parts['host'] = '127.0.0.1'; - $url = advagg_glue_url($parts); - $request = drupal_http_request($url, $options); - } - } - - // Check response. Report an error if - // - Not a 404 OR - // - No data returned OR - // - Headers do not contain "x-advagg" AND - // - Body does not contain "advagg_missing_fast404". - if ($request->code != 404 - || empty($request->data) - || (empty($request->headers['x-advagg']) - && strpos($request->data, '') === FALSE - ) - ) { - // Fast 404 check. - $url_path_404 = parse_url($url, PHP_URL_PATH); - $exclude_paths = variable_get('404_fast_paths_exclude', FALSE); - $fast_404_html = variable_get('404_fast_html', '404 Not Found

Not Found

The requested URL "@path" was not found on this server.

'); - // Replace @path in the variable with the page path. - $fast_404_html = trim(strtr($fast_404_html, array('@path' => check_plain($url_path_404)))); - if (!empty($request->data) - && $fast_404_html == trim($request->data) - && !empty($exclude_paths) - && strpos($exclude_paths, 'advagg_') === FALSE - ) { - $pos_a = strpos($exclude_paths, '(?:styles)'); - $pos_b = strpos($exclude_paths, '(?:styles|'); - if ($exclude_paths === '/\/(?:styles)\//') { - $description = $t('Change it from %value to /\/(?:styles|advagg_(cs|j)s)\//', array( - '%value' => $exclude_paths, - )); - } - elseif ($pos_a !== FALSE) { - $description = $t('Change it from %value to %code ', array( - '%value' => $exclude_paths, - '%code' => str_replace('(?:styles)', '(?:styles|advagg_(cs|j)s)', $exclude_paths), - )); - } - elseif ($pos_b !== FALSE) { - $description = $t('Change it from %value to %code ', array( - '%value' => $exclude_paths, - '%code' => str_replace('(?:styles|', '(?:styles|advagg_(cs|j)s|', $exclude_paths), - )); - } - else { - $description = $t('Add in advagg_(cs|j)s into the regex. Current value: %value', array( - '%value' => $exclude_paths, - )); - } - $requirements['advagg_404_fast_' . $type . '_generation'] = array( - 'title' => $t('Adv CSS/JS Agg - Fast 404: HTTP Request'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('HTTP requests to advagg for ' . $type . ' files are not getting through.'), - 'description' => $t('If you have fast 404 enabled in your settings.php file, you need to change the 404_fast_paths_exclude setting so advagg will work.') . ' ' . $description, - ); - } - elseif (module_exists('fast_404') - && defined('FAST_404_EXT_CHECKED') - && !in_array('/advagg_', variable_get('fast_404_string_whitelisting', array())) - && strpos(variable_get('fast_404_exts', '/^(?!robots).*\.(txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i'), $type) !== FALSE - ) { - $requirements['advagg_fast_404_module_' . $type . '_generation'] = array( - 'title' => $t('Adv CSS/JS Agg - Fast 404: HTTP Request'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('HTTP requests to advagg for ' . $type . ' files are not getting through.'), - 'description' => $t('The fast 404 module is enabled. You need to change the fast_404_string_whitelisting setting so advagg will work. In your settings.php file add in the code below:
@code
', - array('@code' => '$conf[\'fast_404_string_whitelisting\'][] = \'/advagg_\';')), - ); - } - elseif (module_exists('stage_file_proxy') - && variable_get('stage_file_proxy_origin', NULL) - && strpos(advagg_file_get_contents(drupal_get_path('module', 'stage_file_proxy') . '/stage_file_proxy.module'), 'advagg') === FALSE - ) { - // Stage File Proxy patch is missing. - $requirements['advagg_stage_file_proxy_' . $type . '_generation'] = array( - 'title' => $t('Adv CSS/JS Agg - Fast 404: HTTP Request'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('HTTP requests to advagg for ' . $type . ' files are not getting through.'), - 'description' => $t('If you have the Stage File Proxy module enabled, make sure this patch has been applied.', array( - '@patch' => 'https://drupal.org/node/1977170#comment-7331810', - '@module' => 'https://drupal.org/project/stage_file_proxy', - )), - ); - } - elseif (!variable_get('clean_url', 0)) { - $requirements['advagg_clean_url'] = array( - 'title' => $t('Adv CSS/JS Agg - Clean URLs'), - 'value' => $t('HTTP requests to advagg for ' . $type . ' files are not getting through.'), - 'severity' => REQUIREMENT_ERROR, - 'description' => $t('Go to the clean URL settings page and enable Clean URLs.', array( - '@settings' => url('admin/config/search/clean-urls'), - )), - ); - } - elseif ($request->code == 401) { - $requirements['advagg_set_user_pass'] = array( - 'title' => $t('Adv CSS/JS Agg - Set Basic Auth'), - 'value' => $t('HTTP requests to advagg for @type files are not getting through.', array('@type' => $type)), - 'severity' => REQUIREMENT_ERROR, - 'description' => $t('Authorization is required when accessing your site. In order to test that the @type files are working you will need to add the following code in your settings.php file:

@code1
@code2

filling in the correct username and password needed to access this site.', array( - '@code1' => '$conf[\'advagg_auth_basic_user\'] = \'\'; ', - '@code2' => '$conf[\'advagg_auth_basic_pass\'] = \'\';', - '@type' => $type, - )), - ); - } - elseif ($request->code == 403) { - $requirements['advagg_' . $type . '_server_permissions'] = array( - 'title' => $t('Adv CSS/JS Agg - Webserver can not access files'), - 'value' => $t('HTTP requests to advagg for @type files are not getting through.', array('@type' => $type)), - 'severity' => REQUIREMENT_ERROR, - 'description' => $t('Your webserver can not access @type advagg files. This is usually a server permissions issue. Raw request info:
@request
', array( - '@type' => $type, - '@request' => var_export($request, TRUE), - )), - ); - } - elseif (stripos($request->data, 'nginx')) { - $config_location = ''; - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - $config_location = ' ' . $t('You might be able to find the nginx configuration file by running
@command_1
or
@command_2
', array( - '@command_1' => 'ps -o args -C nginx', - '@command_2' => 'nginx -t', - )); - } - $requirements['advagg_' . $type . '_nginx_config'] = array( - 'title' => $t('Adv CSS/JS Agg - Nginx not sending 404 to Drupal.'), - 'value' => $t('HTTP requests to advagg for @type files are not getting through.', array('@type' => $type)), - 'severity' => REQUIREMENT_ERROR, - 'description' => $t('Your nginx webserver is not sending 404s to drupal. Please make sure that your nginx configuration has something like this in it:

@code

Note that @drupal (last line of code above) might be @rewrite or @rewrites depending on your servers configuration. If there are image style rules in your Nginx configuration add this right below that. !config_location Raw request info:
@request
', array( - '@request' => var_export($request, TRUE), - '@code' => ' -### -### advagg_css and advagg_js support -### -location ~* files/advagg_(?:css|js)/ { - gzip_static on; - access_log off; - expires max; - add_header ETag ""; - add_header Cache-Control "max-age=31449600, no-transform, public"; - try_files $uri $uri/ @drupal; -}', - '!config_location' => $config_location, - )), - ); - } - elseif (!advagg_install_htaccess_errordocument($type)) { - $parsed_base_url = parse_url($GLOBALS['base_url']); - if (isset($parsed_base_url['scheme'])) { - unset($parsed_base_url['scheme']); - } - if ($type === 'css') { - $location = $css_path[1] . '/.htaccess'; - } - if ($type === 'js') { - $location = $js_path[1] . '/.htaccess'; - } - $requirements['advagg_' . $type . '_errordoc_404'] = array( - 'title' => $t('Adv CSS/JS Agg - HTTP Request'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('HTTP requests to advagg for ' . $type . ' files are not getting through. The .htaccess needs to be rebuilt.'), - 'description' => $t('The .htaccess file generated by AdvAgg has the incorrect errordoc location. This can happen if Drush is used incorrectly or if the site has been moved to a different directory structure. If you are currently using drush this is how to access it correctly:

@drush

Odds are you will need to fix the errordoc location. Go to the AdvAgg: Operations page and under Regenerate .htaccess files press the Recreate htaccess files button. If you wish to manually edit the file go to the @htaccess_loc file and make sure the following line is in there near the top and any other ErrorDocument 404 statements have been removed.

@code

', array( - '@drush' => 'drush --root=' . DRUPAL_ROOT . '/ --uri=' . advagg_glue_url($parsed_base_url) . ' ', - '@url' => url($config_path . '/advagg/operations', array('fragment' => 'edit-htaccess')), - '@htaccess_loc' => $location, - '@code' => "ErrorDocument 404 {$GLOBALS['base_path']}index.php", - )), - ); - } - elseif (!is_null($s3fs_no_rewrite_cssjs) - && !empty($s3fs_no_rewrite_cssjs) - && !empty($request->headers['server']) - && $request->headers['server'] === 'AmazonS3' - ) { - $severity = REQUIREMENT_WARNING; - if (module_exists('httprl') && variable_get('advagg_use_httprl', ADVAGG_USE_HTTPRL)) { - $severity = REQUIREMENT_ERROR; - } - // S3 doesn't do origin pull. - $requirements['advagg_' . $type . '_generation'] = array( - 'title' => $t('Adv CSS/JS Agg - HTTP Request'), - 'severity' => $severity, - 'value' => $t('HTTP requests to advagg for ' . $type . ' files are not getting through.'), - 'description' => $t('AdvAgg will issue a request for a file that does not exist inside of the AdvAgg directory. If AdvAgg sends a 404, everything is ok; if something else sends a 404 then that means that AdvAgg will not be able to generate an aggregate if it is missing as something else is handling the 404 before AdvAgg has a chance to do it. If you are reading this, it means that something else is handling the 404 before AdvAgg can. In this case the s3fs Advanced Configuration Option "Don\'t render proxied CSS/JS file paths" should be disabled. Raw request info:
@request
', array( - '@request' => var_export($request, TRUE), - '@url' => url('admin/config/media/s3fs', array('fragment' => 'edit-s3fs-no-rewrite-cssjs')), - )), - ); - } - else { - // Menu callback failed. - $requirements['advagg_' . $type . '_generation'] = array( - 'title' => $t('Adv CSS/JS Agg - HTTP Request'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('HTTP requests to advagg for ' . $type . ' files are not getting through.'), - 'description' => $t('AdvAgg will issue a request for a file that does not exist inside of the AdvAgg directory. If AdvAgg sends a 404, everything is ok; if something else sends a 404 then that means that AdvAgg will not be able to generate an aggregate if it is missing as something else is handling the 404 before AdvAgg has a chance to do it. If you are reading this, it means that something else is handling the 404 before AdvAgg can. In some cases this can sometimes be a false report; go here: @url and check if the source (press ctrl+u on your keyboard) has an html comment that says "advagg_missing_fast404"; if it does, this is a false report, add this $conf[\'advagg_skip_404_check\'] = TRUE; to your settings.php file. Raw request info:
@request
', array( - '@request' => var_export($request, TRUE), - '@url' => $url, - )), - ); - } - } - } - } - elseif (variable_get('maintenance_mode', FALSE)) { - $requirements['advagg_maintenance_mode'] = array( - 'title' => $t('Adv CSS/JS Agg - HTTP Request'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t("HTTP requests to advagg's 404 handler can not be tested currently."), - 'description' => $t('This can not be tested while the site is in maintenance mode', array('@maintenance' => url('admin/config/development/maintenance'))), - ); - } - - // Check gzip encoding. - foreach ($types as $type) { - if ($type === 'css') { - $url_path = $css_path[0]; - $file_path = $css_path[1]; - } - elseif ($type === 'js') { - $url_path = $js_path[0]; - $file_path = $js_path[1]; - } - // Get filename. - $filename_path = (!is_null($s3fs_no_rewrite_cssjs) && empty($s3fs_no_rewrite_cssjs)) ? $url_path : $file_path; - $filename = advagg_install_get_first_advagg_file($filename_path, $type); - - // Skip if filename is empty. - if (empty($filename)) { - continue; - } - - $urls = array(); - $url = file_create_url($url_path . '/' . $filename); - if (empty($url)) { - continue; - } - $urls[] = $url; - if (module_exists('cdn')) { - // Get CDN defaults. - $blacklist = variable_get(CDN_EXCEPTION_DRUPAL_PATH_BLACKLIST_VARIABLE, CDN_EXCEPTION_DRUPAL_PATH_BLACKLIST_DEFAULT); - $auth_blacklist = variable_get(CDN_EXCEPTION_AUTH_USERS_BLACKLIST_VARIABLE, CDN_EXCEPTION_AUTH_USERS_BLACKLIST_DEFAULT); - // Set CDN blacklists to be empty. - $GLOBALS['conf'][CDN_EXCEPTION_DRUPAL_PATH_BLACKLIST_VARIABLE] = ''; - $GLOBALS['conf'][CDN_EXCEPTION_AUTH_USERS_BLACKLIST_VARIABLE] = ''; - // Create URL. - $urls[] = file_create_url($url_path . '/' . $filename); - // Set CDN blacklist back to the original value. - $GLOBALS['conf'][CDN_EXCEPTION_DRUPAL_PATH_BLACKLIST_VARIABLE] = $blacklist; - $GLOBALS['conf'][CDN_EXCEPTION_AUTH_USERS_BLACKLIST_VARIABLE] = $auth_blacklist; - } - $urls = array_unique($urls); - - // Set arguments for drupal_http_request(). - $options = array( - 'headers' => array( - 'Accept-Encoding' => 'gzip, deflate', - ), - 'version' => '1.0', - '#advagg_path' => "{$file_path}/{$filename}", - 'timeout' => 8, - ); - // Test http 1.0. - $old_requirements = $requirements; - advagg_install_chk_urls($requirements, $urls, $options, $mod_url, $type, $url_path, $file_path, $filename); - - // Test http 1.1 - // If Drupal version is >= 7.22 and httprl_override_core exists. - if (defined('VERSION') && floatval(VERSION) >= 7.22 && is_callable('httprl_override_core')) { - $old = variable_get('drupal_http_request_function', FALSE); - $GLOBALS['conf']['drupal_http_request_function'] = 'httprl_override_core'; - - // Only test 1.1; 1.0 is rarely used these days. - $requirements = $old_requirements; - - $options['version'] = '1.1'; - advagg_install_chk_urls($requirements, $urls, $options, $mod_url, $type, $url_path, $file_path, $filename); - - $GLOBALS['conf']['drupal_http_request_function'] = $old; - } - - if (function_exists('brotli_compress') - && defined('BROTLI_TEXT') - && variable_get('advagg_brotli', ADVAGG_BROTLI) - ) { - // Set arguments for drupal_http_request(). - $options = array( - 'headers' => array( - 'Accept-Encoding' => 'br', - ), - 'version' => '1.0', - 'timeout' => 8, - ); - // Test http 1.0. - $old_requirements = $requirements; - advagg_install_chk_urls($requirements, $urls, $options, $mod_url, $type, $url_path, $file_path, $filename); - - // Test http 1.1 - // If Drupal version is >= 7.22 and httprl_override_core exists. - if (defined('VERSION') && floatval(VERSION) >= 7.22 && is_callable('httprl_override_core')) { - $old = variable_get('drupal_http_request_function', FALSE); - $GLOBALS['conf']['drupal_http_request_function'] = 'httprl_override_core'; - - // Only test 1.1; 1.0 is rarely used these days. - $requirements = $old_requirements; - - $options['version'] = '1.1'; - advagg_install_chk_urls($requirements, $urls, $options, $mod_url, $type, $url_path, $file_path, $filename); - - $GLOBALS['conf']['drupal_http_request_function'] = $old; - } - } - } -} - -/** - * Make sure http requests to css/js files work correctly. - * - * @param array $requirements - * Array of requirements used in hook_requirements(). - * @param array $urls - * Array of urls. - * @param array $options - * Options array to pass to drupal_http_request(). - * @param bool $mod_url - * Set to TRUE if an alt URL was used. - * @param string $type - * String: css or js. - * @param string $url_path - * The url path to the file. - * @param string $file_path - * File path to the file. - * @param string $filename - * Name of the file. - */ -function advagg_install_chk_urls(array &$requirements, array $urls, array $options, $mod_url, $type, $url_path, $file_path, $filename) { - // Ensure translations don't break at install time. - $t = get_t(); - - list($css_path, $js_path) = advagg_get_root_files_dir(); - $config_path = advagg_admin_config_root_path(); - - $options += array( - 'timeout' => 8, - ); - - $is_apache = FALSE; - if (stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== FALSE || function_exists('apache_get_modules')) { - $is_apache = TRUE; - $mod_headers = advagg_install_apache_mod_loaded('mod_headers'); - $mod_rewrite = advagg_install_apache_mod_loaded('mod_rewrite'); - $mod_expires = advagg_install_apache_mod_loaded('mod_expires'); - } - foreach ($urls as $url) { - $key = strtolower(pathinfo($url, PATHINFO_EXTENSION)); - // Make sure the URL contains a schema. - if (strpos($url, 'http') !== 0) { - if ($GLOBALS['is_https']) { - $url = 'https:' . $url; - } - else { - $url = 'http:' . $url; - } - } - - // Before sending the request when using s3fs, check if the file exists. - if (module_exists('s3fs') && !file_exists($url_path . '/' . $filename)) { - if (module_exists('httprl') && variable_get('advagg_use_httprl', ADVAGG_USE_HTTPRL)) { - $httprl_message = 'This may be due to an issue with the HTTPRL module or its configuration. '; - } - else { - $httprl_message = ''; - } - $requirements['advagg_' . $type . '_missing' . $key] = array( - 'title' => $t('Adv CSS/JS Agg - file does not exist'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('Unable to find %type files.', array('%type' => $type)), - 'description' => $t('The AdvAgg database records and S3 files are not in sync. The file referenced in the database to perform a test cannot be found in the S3 file system. @httprl_messageFile URL:
@file
', array( - '@httprl_message' => $httprl_message, - '@file' => $url, - )), - ); - continue; - } - - // Send request. - advagg_install_url_mod($url, $options, $mod_url); - $request = drupal_http_request($url, $options); - $encoding_type = 'gzip'; - if (!empty($request->options['headers']['Accept-Encoding']) && strpos($request->options['headers']['Accept-Encoding'], 'br') !== FALSE) { - $encoding_type = 'br'; - } - - if (!variable_get('advagg_skip_gzip_check', ADVAGG_SKIP_GZIP_CHECK)) { - // Check response. Report an error if - // - Not a 200. - // - Headers do not contain "content-encoding". - // - content-encoding is not gzip, deflate or br. - if ($request->code != 200 - || empty($request->headers['content-encoding']) - || ($request->headers['content-encoding'] !== 'gzip' - && $request->headers['content-encoding'] !== 'deflate' - && $request->headers['content-encoding'] !== 'br' - ) - ) { - // Gzip failed. - if (!variable_get('advagg_gzip', ADVAGG_GZIP) - && $encoding_type === 'gzip' - ) { - // Recommend that gzip be turned on. - $requirements['advagg_' . $type . '_gzip' . $key] = array( - 'title' => $t('Adv CSS/JS Agg - gzip'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('Gzip is failing for %type files.', array('%type' => $type)), - 'description' => $t('Try enabling on the "Create .gz files" setting on the Advanced CSS/JS Aggregation Configuration page', array( - '@advagg' => url($config_path . '/advagg'), - '%type' => $type, - )), - ); - } - elseif (function_exists('brotli_compress') - && defined('BROTLI_TEXT') - && !variable_get('advagg_brotli', ADVAGG_BROTLI) - && $encoding_type === 'br' - ) { - // Recommend that br be turned on. - $requirements['advagg_' . $type . '_br' . $key] = array( - 'title' => $t('Adv CSS/JS Agg - brotli'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('Brotli is failing for %type files.', array('%type' => $type)), - 'description' => $t('Try enabling on the "Create .br files" setting on the Advanced CSS/JS Aggregation Configuration page', array( - '@advagg' => url($config_path . '/advagg'), - '%type' => $type, - )), - ); - } - else { - // If not apache skip this. - $apache_module_missing = FALSE; - if ($is_apache) { - if ($mod_headers === FALSE || $mod_rewrite === FALSE) { - $apache_module_missing = TRUE; - if ($mod_headers === FALSE) { - $requirements['advagg_mod_headers' . $key . '_' . $encoding_type] = array( - 'title' => $t('Adv CSS/JS Agg - Apache'), - 'description' => $t('The Apache module "mod_headers" is not available. Enable mod_headers for Apache if at all possible. This is causing @encoding to fail.', array( - '!link' => 'http://httpd.apache.org/docs/current/mod/mod_headers.html', - '@encoding' => $encoding_type, - )), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('Apache module "mod_headers" is not installed.'), - ); - } - if ($mod_rewrite === FALSE) { - $requirements['advagg_mod_rewrite' . $key . '_' . $encoding_type] = array( - 'title' => $t('Adv CSS/JS Agg - Apache'), - 'description' => $t('The Apache module "mod_rewrite" is not available. You must enable mod_rewrite for Apache. This is causing @encoding to fail.', array( - '!link' => 'http://httpd.apache.org/docs/current/mod/mod_rewrite.html', - '@encoding' => $encoding_type, - )), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('Apache module "mod_rewrite" is not installed.'), - ); - } - } - } - if (!$apache_module_missing) { - // Check via external service. - $ext_url = 'http://checkgzipcompression.com/?url=' . urlencode($url); - if ($encoding_type === 'br') { - $ext_url = 'https://tools.keycdn.com/brotli-query.php?url=' . urlencode($url) . '&public=0'; - } - $external_compression_request = drupal_http_request($ext_url, array( - 'timeout' => 7, - 'headers' => array('Connection' => 'close'), - )); - if (!empty($external_compression_request->data)) { - if ($encoding_type === 'br') { - if (stripos($external_compression_request->data, '') !== FALSE) { - preg_match("/(.*)<\/strong>/siU", $external_compression_request->data, $title_matches); - if (stripos($title_matches[1], 'Negative') === FALSE) { - $external_test_results = 1; - } - else { - $external_test_results = -1; - } - } - else { - $external_test_results = 0; - } - } - elseif (stripos($external_compression_request->data, '') !== FALSE) { - preg_match("/<title>(.*)<\/title>/siU", $external_compression_request->data, $title_matches); - if (stripos($title_matches[1], 'gzip') === FALSE) { - $external_test_results = 0; - } - elseif (stripos($title_matches[1], 'not gzip') === FALSE) { - $external_test_results = 1; - } - else { - $external_test_results = -1; - } - } - } - if (!isset($external_test_results) || $external_test_results !== 1) { - if ($request->code != 200) { - $rewritebase = advagg_htaccess_rewritebase(); - if (!empty($rewritebase)) { - if ($type === 'css') { - $rewritebase_advagg = advagg_htaccess_rewritebase($css_path[1]); - } - if ($type === 'js') { - $rewritebase_advagg = advagg_htaccess_rewritebase($js_path[1]); - } - } - $advagg_htaccess_rewritebase = variable_get('advagg_htaccess_rewritebase', ADVAGG_HTACCESS_REWRITEBASE); - if ($request->code == 307 && !empty($rewritebase) && empty($rewritebase_advagg) && empty($advagg_htaccess_rewritebase)) { - $requirements['advagg_' . $type . $encoding_type . $key . $options['version']] = array( - 'title' => $t('Adv CSS/JS Agg - @encoding', array('@encoding' => $encoding_type)), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('@encoding is failing for %type files.', array( - '%type' => $type, - '@encoding' => $encoding_type, - )), - 'description' => $t('The web server is not returning a 200, instead a @code is being returned. The RewriteBase option should be set on the <a href="@url">configuration page</a> under "Obscure Options" look for "AdvAgg RewriteBase Directive in .htaccess files". Raw request info: <pre>@request</pre>', array( - '@code' => $request->code, - '@encoding' => $encoding_type, - '@request' => print_r($request, TRUE), - '@url' => url($config_path . '/advagg', array('fragment' => 'edit-advagg-htaccess-rewritebase')), - )), - ); - } - else { - if (module_exists('s3fs') && ($request->code == 307 || $request->code == -2)) { - $requirements['advagg_' . $type . $encoding_type . $key . $options['version']] = array( - 'title' => $t('Adv CSS/JS Agg - Redirect Loop'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('S3fs issue. Proxy is not setup correctly for %type.', array( - '%type' => $type, - )), - 'description' => $t('The web server is not returning a 200, instead a @code is being returned. Apache proxy settings for httpd.conf: <p><code>!httpd</code></p>. Raw request info: <pre>@request</pre>', array( - '!httpd' => nl2br(str_replace(' ', '  ', htmlentities(advagg_install_s3fs_proxy_settings($type)))), - '@code' => $request->code, - '@encoding' => $encoding_type, - '@request' => print_r($request, TRUE), - )), - ); - } - else { - $requirements['advagg_' . $type . $encoding_type . $key . $options['version']] = array( - 'title' => $t('Adv CSS/JS Agg - @encoding', array('@encoding' => $encoding_type)), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('@encoding is failing for %type files.', array( - '%type' => $type, - '@encoding' => $encoding_type, - )), - 'description' => $t('The web server is not returning a 200, instead a @code is being returned. @encoding can not be tested. Raw request info: <pre>@request</pre>', array( - '@code' => $request->code, - '@encoding' => $encoding_type, - '@request' => print_r($request, TRUE), - )), - ); - } - } - } - elseif (empty($request->data)) { - $url = 'http://checkgzipcompression.com/?url=' . urlencode($url); - if ($encoding_type === 'br') { - $url = 'https://tools.keycdn.com/brotli-query.php?url=' . urlencode($url) . '&public=0'; - } - $requirements['advagg_' . $type . $encoding_type . $key . $options['version']] = array( - 'title' => $t('Adv CSS/JS Agg - @encoding', array('@encoding' => $encoding_type)), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('@encoding is failing for %type files.', array( - '%type' => $type, - '@encoding' => $encoding_type, - )), - 'description' => $t('No data was returned from your server; this @encoding test can not be done locally. Error: @error - @message You can manually test if @encoding is working by <a href="@urlGZ">going here</a> and seeing if @encoding is enabled. You can turn this warning off by adding this to your settings.php file: <code>@skipcode</code>', array( - '@error' => $request->code, - '@message' => isset($request->error) ? $request->error : '', - '@url' => $url, - '@skipcode' => '$conf[\'advagg_skip_gzip_check\'] = TRUE;', - '@encoding' => $encoding_type, - )), - ); - } - else { - // Recommend servers configuration be adjusted. - $request->data = '...'; - $requirements['advagg_' . $type . $encoding_type . $key . $options['version']] = array( - 'title' => $t('Adv CSS/JS Agg - @encoding', array('@encoding' => $encoding_type)), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('@encoding is failing for %type files.', array( - '%type' => $type, - '@encoding' => $encoding_type, - )), - 'description' => $t('The web servers configuration will need to be adjusted. In most cases make sure that the webroots .htaccess file still contains this section "Rules to correctly serve gzip compressed CSS and JS files". Also check in the <a href="@readme">readme</a>, under Troubleshooting. Certain default web server configurations (<a href="!nginx">nginx</a>) do not gzip HTTP/1.0 requests. If you are using cloudfront you will have to <a href="!cloudfront">add metadata</a> to the .gz files. There are some other options if using <a href="!so">cloudfront</a>. Raw request info: <pre>@request</pre>', array( - '!nginx' => 'http://www.cdnplanet.com/blog/gzip-nginx-cloudfront/', - '@request' => print_r($request, TRUE), - '!cloudfront' => 'http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html#CompressedS3', - '!so' => 'http://stackoverflow.com/questions/5442011/serving-gzipped-css-and-javascript-from-amazon-cloudfront-via-s3', - '@readme' => url(drupal_get_path('module', 'advagg') . '/README.txt'), - )), - ); - } - } - } - } - } - elseif ($request->code == 200 - && !empty($request->headers['content-encoding']) - && !empty($request->data) - && ($request->headers['content-encoding'] === 'gzip' - || $request->headers['content-encoding'] === 'deflate' - || $request->headers['content-encoding'] === 'br' - )) { - // Do the first level of decoding if not already done. - if (!isset($request->chunk_size)) { - if ($request->headers['content-encoding'] === 'gzip') { - $request->data = @gzinflate(substr($request->data, 10)); - } - elseif ($request->headers['content-encoding'] === 'deflate') { - $request->data = @gzinflate($request->data); - } - elseif ($request->headers['content-encoding'] === 'br' && is_callable('brotli_uncompress')) { - $request->data = @brotli_uncompress($request->data); - } - } - // Check for double gzip compression. - $contents = @file_get_contents($options['#advagg_path']); - if ($contents !== $request->data && (@gzinflate(substr($request->data, 10)) !== FALSE || @gzinflate($request->data) !== FALSE)) { - $config_path = advagg_admin_config_root_path(); - $description = ''; - if (variable_get('advagg_gzip', ADVAGG_GZIP)) { - $description .= $t('Go to the Advanced CSS/JS aggregation <a href="@settings">settings page</a>, under Obsucre Options uncheck the Create .gz files setting.', array( - '@settings' => url($config_path . '/advagg', array('fragment' => 'edit-obscure')), - )); - } - else { - $description .= $t('Your webserver configuration needs to be changed so that %type files are not being double compressed.', array( - '%type' => $type, - )); - if (isset($request->headers['content-type'])) { - $description .= ' ' . $t('The content type is: %type.', array( - '%type' => $request->headers['content-type'], - )); - } - } - $requirements['advagg_' . $type . '_gzip' . $key . $options['version']] = array( - 'title' => $t('Adv CSS/JS Agg - gzip'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('Double gzip encoding detected for %type files.', array('%type' => $type)), - 'description' => $description, - ); - } - if ($contents !== $request->data && (is_callable('brotli_uncompress') && @brotli_uncompress($request->data) !== FALSE)) { - $config_path = advagg_admin_config_root_path(); - $description = ''; - if (variable_get('advagg_brotli', ADVAGG_BROTLI)) { - $description .= $t('Go to the Advanced CSS/JS aggregation <a href="@settings">settings page</a>, under Obsucre Options uncheck the Create .br files setting.', array( - '@settings' => url($config_path . '/advagg', array('fragment' => 'edit-obscure')), - )); - } - else { - $description .= $t('Your webserver configuration needs to be changed so that %type files are not being double compressed.', array( - '%type' => $type, - )); - if (isset($request->headers['content-type'])) { - $description .= ' ' . $t('The content type is: %type.', array( - '%type' => $request->headers['content-type'], - )); - } - } - $requirements['advagg_' . $type . '_br' . $key . $options['version']] = array( - 'title' => $t('Adv CSS/JS Agg - br'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('Double br encoding detected for %type files.', array('%type' => $type)), - 'description' => $description, - ); - } - } - } - $content_type = $type; - if ($content_type === 'js') { - $content_type = 'javascript'; - } - - if ($request->code == 200) { - $matches = array(); - if (!empty($request->headers['x-advagg']) - && preg_match('/Generated file at (\\d+)/is', $request->headers['x-advagg'], $matches) - && $matches[1] + 30 > REQUEST_TIME - ) { - if (!file_exists($file_path . '/' . $filename)) { - $requirements['advagg_' . $type . '_file_write_' . $key] = array( - 'title' => $t('Adv CSS/JS Agg - Can not write to the filesystem'), - 'severity' => REQUIREMENT_ERROR, - 'value' => $t('The request for a file was served by Drupal instead of the web server (like Apache).'), - 'description' => $t('Something is preventing writes to your filesystem from working.'), - ); - } - else { - $requirements['advagg_' . $type . '_loopback_issue' . $key] = array( - 'title' => $t('Adv CSS/JS Agg - Incorrect readings'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('The request for a file was served by Drupal instead of the web server (like Apache).'), - 'description' => $t('It means that AdvAgg can not test for Far-Future headers internally and you will need to use an external tool in order to do so. Warnings given or not given about AdvAgg Expires, Cache-Control, and If-Modified-Since might be incorrect. In the <a href="@readme">readme</a>, under Troubleshooting try the Far-Future recommendations.', array('@readme' => url(drupal_get_path('module', 'advagg') . '/README.txt'))), - ); - } - } - - if ($type === 'css' - && (empty($request->headers['content-type']) - || strpos($request->headers['content-type'], 'text/' . $content_type) === FALSE - ) - ) { - // Recommend servers configuration be adjusted. - $requirements['advagg_' . $type . '_type' . $key] = array( - 'title' => $t('Adv CSS/JS Agg - Content-Type'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('The wrong Content-Type is being sent by your web server.'), - 'description' => $t('The web servers configuration will need to be adjusted. Was looking for <code>@typematch</code>, actually got <code>@received</code>.', array( - '@typematch' => 'text/' . $content_type, - '@received' => isset($request->headers['content-type']) ? $request->headers['content-type'] : 'NULL', - )), - ); - } - - if ($type === 'js' - && (empty($request->headers['content-type']) - || (strpos($request->headers['content-type'], 'application/' . $content_type) === FALSE - && strpos($request->headers['content-type'], 'application/x-' . $content_type) === FALSE - ) - ) - ) { - // Recommend servers configuration be adjusted. - $requirements['advagg_' . $type . '_type' . $key] = array( - 'title' => $t('Adv CSS/JS Agg - Content-Type'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('The wrong Content-Type is being sent by your web server.'), - 'description' => $t('The web servers configuration will need to be adjusted. Was looking for <code>@typematch</code>, actually got <code>@received</code>. You might need to apply the drupal core patch located here <a href="@url">@url</a>.', array( - '@url' => 'https://drupal.org/node/2193333#comment-8469991', - '@typematch' => 'application/' . $content_type, - '@received' => isset($request->headers['content-type']) ? $request->headers['content-type'] : 'NULL', - )), - ); - } - - // Test far future headers. - $apache_module_missing = FALSE; - if (!variable_get('advagg_skip_far_future_check', ADVAGG_SKIP_FAR_FUTURE_CHECK) - && empty($_SERVER['PANTHEON_ENVIRONMENT']) - && empty($_SERVER['PANTHEON_SITE_NAME']) - ) { - // Make sure the expires header is at least set to 1 month - // (2628000 seconds) in the future. - if (!empty($request->headers['expires']) - && strtotime($request->headers['expires']) < time() + 2628000 - ) { - // Recommend servers configuration be adjusted. - if ($is_apache && $mod_headers === FALSE) { - $apache_module_missing = TRUE; - } - else { - $requirements['advagg_' . $type . '_expires' . $key] = array( - 'title' => $t('Adv CSS/JS Agg - Expires'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('The expires header being sent by your web server is not at least 1 month in the future.'), - 'description' => $t('The web servers configuration should be adjusted only for AdvAgg files. Was looking for a second counter over 2,628,000 (1 month), actually got <code>@received</code> (@expires). You can turn this warning off if you can not adjust this value (Pantheon) by adding this to your settings.php file: <code>@skipcode</code>', array( - '@received' => isset($request->headers['expires']) ? number_format(strtotime($request->headers['expires']) - REQUEST_TIME) : 'NULL', - '@expires' => isset($request->headers['expires']) ? $request->headers['expires'] : 'NULL', - '@skipcode' => '$conf[\'advagg_skip_far_future_check\'] = TRUE;', - )), - ); - } - } - // Make sure the cache-control header max age value is at least set to - // 1 month (2628000 seconds) in the future. - $matches = array(); - if (empty($request->headers['cache-control']) - || !preg_match('/\s*max-age\s*=\s*(\\d+)\s*/is', $request->headers['cache-control'], $matches) - || $matches[1] < 2628000 - ) { - // Recommend servers configuration be adjusted. - if ($is_apache && $mod_headers === FALSE) { - $apache_module_missing = TRUE; - } - else { - $requirements['advagg_' . $type . '_cache_control' . $key] = array( - 'title' => $t('Adv CSS/JS Agg - Cache-Control'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t("The cache-control's max-age header being sent by your web server is not at least 1 month in the future."), - 'description' => $t('The web servers configuration should be adjusted only for AdvAgg files. Was looking that the max-age second counter is over 2,628,000 (1 month), actually got <code>@received</code>. You can turn this warning off if you can not adjust this value (Pantheon) by adding this to your settings.php file: <code>@skipcode</code>', array( - '@received' => isset($request->headers['cache-control']) ? $request->headers['cache-control'] : 'NULL', - '@skipcode' => '$conf[\'advagg_skip_far_future_check\'] = TRUE;', - )), - ); - } - } - } - - // Handle missing apache modules. - if ($apache_module_missing && $is_apache && $mod_headers === FALSE) { - $requirements['advagg_mod_headers_far_future_headers_' . $key] = array( - 'title' => $t('Adv CSS/JS Agg - Apache'), - 'description' => $t('The Apache module "mod_headers" is not available. Enable <a href="!link">mod_headers</a> for Apache if at all possible. This is causing far-future headers to not be sent correctly.', array('!link' => 'http://httpd.apache.org/docs/current/mod/mod_headers.html')), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('Apache module "mod_headers" is not installed.'), - ); - if ($mod_expires === FALSE) { - $requirements['advagg_mod_headers_far_future_expires_' . $key] = array( - 'title' => $t('Adv CSS/JS Agg - Apache'), - 'description' => $t('The Apache module "mod_expires" is not available. Enable <a href="!link">mod_expires</a> for Apache if at all possible. This is causing far-future headers to not be sent correctly.', array('!link' => 'http://httpd.apache.org/docs/current/mod/mod_expires.html')), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('Apache module "mod_headers" is not installed.'), - ); - } - } - - // Test 304. - if (!variable_get('advagg_skip_304_check', ADVAGG_SKIP_304_CHECK) - && empty($_SERVER['PANTHEON_ENVIRONMENT']) - && empty($_SERVER['PANTHEON_SITE_NAME']) - ) { - $etag_works = FALSE; - if (isset($request->headers['etag'])) { - // Send an Etag header and see if the web server returns a 304. - $url = file_create_url($url_path . '/' . $filename); - $if_modified_options = $options; - $if_modified_options['headers'] = array( - 'Accept-Encoding' => 'gzip, deflate, br', - 'If-None-Match' => $request->headers['etag'], - ); - if (!empty($request->options['headers']['Accept-Encoding'])) { - $if_modified_options['headers']['Accept-Encoding'] = $request->options['headers']['Accept-Encoding']; - } - - // Send request. - advagg_install_url_mod($url, $if_modified_options, $mod_url); - $request_304 = drupal_http_request($url, $if_modified_options); - if ($request_304->code != 304) { - // Recommend servers configuration be adjusted. - $requirements['advagg_' . $type . '_304' . $key . '_etag'] = array( - 'title' => $t('Adv CSS/JS Agg - Etag'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('The If-None-Match (Etag) header is being ignored by your web server.'), - 'description' => $t('The web servers configuration will need to be adjusted. The server should have responded with a 304, instead a @code was returned.', array( - '@code' => $request_304->code, - )), - ); - } - else { - $etag_works = TRUE; - } - } - if (isset($request->headers['last-modified'])) { - // Send a If-Modified-Since header and see if the web server returns a - // 304. - $url = file_create_url($url_path . '/' . $filename); - $if_modified_options = $options; - $if_modified_options['headers'] = array( - 'Accept-Encoding' => 'gzip, deflate, br', - 'If-Modified-Since' => $request->headers['last-modified'], - ); - if (!empty($request->options['headers']['Accept-Encoding'])) { - $if_modified_options['headers']['Accept-Encoding'] = $request->options['headers']['Accept-Encoding']; - } - - // Send request. - advagg_install_url_mod($url, $if_modified_options, $mod_url); - $request_304 = drupal_http_request($url, $if_modified_options); - if ($request_304->code != 304) { - // Recommend servers configuration be adjusted. - $requirements['advagg_' . $type . '_304' . $key . '_last_modified'] = array( - 'title' => $t('Adv CSS/JS Agg - If-Modified-Since'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('The If-Modified-Since (Last-Modified) header is being ignored by your web server.'), - 'description' => $t('The web servers configuration will need to be adjusted. The server should have responded with a 304, instead a @code was returned.', array( - '@code' => $request_304->code, - )), - ); - } - elseif (isset($requirements['advagg_' . $type . '_304' . $key . '_etag'])) { - // Last-Modified works, Etag is broken. 304s are working. Don't warn - // user. - unset($requirements['advagg_' . $type . '_304' . $key . '_etag']); - } - } - if ($etag_works && isset($requirements['advagg_' . $type . '_304' . $key . '_last_modified'])) { - // Etag works, Last-Modified is broken. 304s are working. Don't warn - // user. - unset($requirements['advagg_' . $type . '_304' . $key . '_last_modified']); - } - - // Both the Last-Modified and Etag header are missing. - if (empty($request->headers['last-modified']) && empty($request->headers['etag'])) { - // Get path to advagg .htaccess file. - $files = array( - $file_path . '/.htaccess', - DRUPAL_ROOT . '/.htaccess', - ); - - // Check for bad .htaccess files. - $bad_config_found = FALSE; - foreach ($files as $count => $file) { - if (!file_exists($file)) { - continue; - } - $contents = advagg_file_get_contents($file); - if (strpos($contents, 'Header unset Last-Modified') !== FALSE) { - $bad_config_found = TRUE; - $requirements['advagg_' . $type . '_last-modified_' . $key . $count] = array( - 'title' => $t('Adv CSS/JS Agg - Last-Modified'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('The Last-Modified header is not being sent out by your web server.'), - 'description' => $t('The web servers configuration will need to be adjusted. The server should have sent out a Last-Modified header. Remove "Header unset Last-Modified" inside this file to fix the issue: @file', array('@file' => $file)), - ); - } - } - - // Recommend servers configuration be adjusted. - if (!$bad_config_found) { - $requirements['advagg_' . $type . '_last-modified_' . $key] = array( - 'title' => $t('Adv CSS/JS Agg - Last-Modified'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('The Last-Modified header is not being sent out by your web server.'), - 'description' => $t('The web servers configuration will need to be adjusted. The server should have sent out a Last-Modified header and/or an Etag header. If you can not get the Last-Modified header to work, you can try using ETags. Inside <code>@htaccess</code> right before <code>@line1</code> at the bottom of the file add in <code>@line2</code>. You will also need to remove the <code>@line3</code> line further up.', array( - '@htaccess' => $file_path . '/.htaccess', - '@line1' => '</FilesMatch>', - '@line2' => 'FileETag MTime Size', - '@line3' => 'Header unset ETag', - )), - ); - } - } - } - } - } -} - -/** - * Given a advagg path this will return the first aggregate it can find. - * - * @param string $directory - * Path to the advagg css/js dir. - * @param string $type - * String: css or js. - * - * @return string - * Returns aggregate filename or an empty string on failure. - */ -function advagg_install_get_first_advagg_file($directory, $type) { - module_load_include('inc', 'advagg', 'advagg.missing'); - $filename = ''; - - // Get contents of the advagg directory. - $scanned_directory = @scandir($directory); - // Bailout here if the advagg directory is empty. - if (empty($scanned_directory)) { - // Get a file that will generate from the database. - return advagg_generate_advagg_filename_from_db($type); - } - // Filter list. - $blacklist = array('..', '.', '.htaccess', 'parts'); - $scanned_directory = array_diff($scanned_directory, $blacklist); - - // Make the last file empty. - $scanned_directory[] = ''; - - foreach ($scanned_directory as $key => $filename) { - // Skip if filename is not long enough. - $len = strlen($filename); - if ($len < 91 + strlen(ADVAGG_SPACE) * 3) { - continue; - } - - // See if this uri contains .gz near the end of it. - $pos = strripos($filename, '.gz', 91 + strlen(ADVAGG_SPACE) * 3); - if (!empty($pos)) { - // If this is a .gz file skip. - if ($pos == $len - 3) { - continue; - } - } - - $gzip_filename = $scanned_directory[$key + 1]; - $br_filename = $scanned_directory[$key + 1]; - if (function_exists('brotli_compress') - && defined('BROTLI_TEXT') - && variable_get('advagg_brotli', ADVAGG_BROTLI) - ) { - $gzip_filename = $scanned_directory[$key + 2]; - // Skip if the next file does not have a .br extension. - // This can occur if: - // - File is not .br compressed, or, - // - Using s3fs module and only .br compression is set. In - // this case, the advagg_advadgg_save_aggregate_alter() - // function will not add a file extension. - if (strcmp($filename . '.br', $br_filename) !== 0 - && (!module_exists('s3fs') - || (module_exists('s3fs') && variable_get('advagg_gzip', ADVAGG_GZIP)))) { - continue; - } - } - else { - // Skip if the next file is a .br file. - if (strcmp($filename . '.br', $br_filename) === 0) { - continue; - } - } - - if (variable_get('advagg_gzip', ADVAGG_GZIP)) { - // Skip if the next file does not have a .gz extension. - // This can occur if: - // - File is not .gz compressed, or, - // - Using s3fs module and either: - // - Only .gz compression option is set or, - // - Both .gz and .br compression options are set. In - // this case, the advagg_advagg_save_aggregate_alter() - // function creates a .gz file by default. - if (strcmp($filename . '.gz', $gzip_filename) !== 0 && !module_exists('s3fs')) { - continue; - } - } - else { - // Skip if the next file is a .gz file. - if (strcmp($filename . '.gz', $gzip_filename) === 0) { - continue; - } - } - - $data = advagg_get_hashes_from_filename(basename($filename)); - if (is_array($data)) { - list($type, $aggregate_filenames_hash, $aggregate_contents_hash) = $data; - - // Get a list of files. - $files = advagg_get_files_from_hashes($type, $aggregate_filenames_hash, $aggregate_contents_hash); - - if (!empty($files)) { - // All checked passed above, break out of loop. - break; - } - } - } - - if (empty($filename)) { - return advagg_generate_advagg_filename_from_db($type); - } - return $filename; -} - -/** - * Modify $url and $options before making the HTTP request. - * - * @param string $url - * Full URL. - * @param array $options - * Options array for drupal_http_request(). - * @param bool $mod_url - * Set to TRUE to try and modify the $url variable. - */ -function advagg_install_url_mod(&$url, array &$options, $mod_url = FALSE) { - // Set the $options array. - // Set all timeouts to 8 seconds. - $options += array( - 'timeout' => 8, - 'dns_timeout' => 8, - 'connect_timeout' => 8, - 'ttfb_timeout' => 8, - ); - // Set connection to closed to prevent keep-alive from causing a timeout. - $options['headers']['Connection'] = 'close'; - // Set referrer to current page. - $options['headers']['Referer'] = $GLOBALS['base_root'] . request_uri(); - - $parts = @parse_url($url); - if (!is_array($parts)) { - return; - } - - // Check if this is a protocol relative url, if so add a artificial scheme so - // that advagg_glue_url() will produce a proper absolute url. That will work - // with drupal_http_request(). - if (!isset($parts['scheme']) && substr($url, 0, 2) == '//') { - global $base_url; - $parts['scheme'] = @parse_url($base_url, PHP_URL_SCHEME); - } - // Pass along user/pass in the URL. - $advagg_auth_basic_user = variable_get('advagg_auth_basic_user', ADVAGG_AUTH_BASIC_USER); - if (module_exists('shield')) { - $parts['user'] = variable_get('shield_user', ''); - $parts['pass'] = variable_get('shield_pass', ''); - } - elseif (isset($_SERVER['AUTH_TYPE']) - && $_SERVER['AUTH_TYPE'] == 'Basic' - ) { - $parts['user'] = $_SERVER['PHP_AUTH_USER']; - $parts['pass'] = $_SERVER['PHP_AUTH_PW']; - } - elseif (isset($_SERVER['HTTP_AUTHORIZATION']) - && strpos($_SERVER['HTTP_AUTHORIZATION'], 'Basic ') === 0 - ) { - $user_pass = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 5))); - $parts['user'] = $user_pass[0]; - $parts['pass'] = $user_pass[1]; - } - elseif (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) - && strpos($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 'Basic ') === 0 - ) { - $user_pass = explode(':', base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 5))); - $parts['user'] = $user_pass[0]; - $parts['pass'] = $user_pass[1]; - } - elseif (!empty($advagg_auth_basic_user)) { - $parts['user'] = $advagg_auth_basic_user; - $parts['pass'] = variable_get('advagg_auth_basic_pass', ADVAGG_AUTH_BASIC_PASS); - } - - if ($mod_url) { - if (function_exists('httprl_build_url_self')) { - // Remove the base_path from path. - $path = substr($parts['path'], strlen($GLOBALS['base_path'])); - $new_url = httprl_build_url_self($path); - } - else { - if (!empty($_SERVER['HTTP_HOST'])) { - if ($parts['host'] != $_SERVER['HTTP_HOST']) { - $parts['host'] = $_SERVER['HTTP_HOST']; - } - } - elseif (!empty($_SERVER['SERVER_NAME'])) { - if ($parts['host'] != $_SERVER['SERVER_NAME']) { - $parts['host'] = $_SERVER['SERVER_NAME']; - } - } - elseif (!empty($_SERVER['SERVER_ADDR'])) { - if ($parts['host'] != $_SERVER['SERVER_ADDR']) { - $parts['host'] = $_SERVER['SERVER_ADDR']; - } - } - else { - $parts['host'] = '127.0.0.1'; - } - } - } - - if (empty($new_url)) { - $new_url = advagg_glue_url($parts); - } - $url = $new_url; -} - -/** - * Checks to see if an apache module is enabled. - * - * @param string $mod - * Name of an apache module. - * - * @return bool - * TRUE if it exists; FALSE if it does not; NULL if it can not be determined. - */ -function advagg_install_apache_mod_loaded($mod) { - $sapi_type = php_sapi_name(); - if (substr($sapi_type, 0, 3) == 'cgi' || $sapi_type == 'fpm-fcgi') { - // NULL returned, apache_get_modules and phpinfo can not be called. - return NULL; - } - if (is_callable('apache_get_modules')) { - $mods = apache_get_modules(); - if (in_array($mod, $mods)) { - // Return TRUE, module exists. - return TRUE; - } - } - elseif (is_callable('phpinfo') && FALSE === strpos(ini_get('disable_functions'), 'phpinfo')) { - // Use static so we don't run phpinfo multiple times. - $phpinfo = &drupal_static(__FUNCTION__); - if (empty($phpinfo)) { - // Use phpinfo to get the info if apache_get_modules doesn't exist. - ob_start(); - phpinfo(8); - $phpinfo = ob_get_clean(); - } - if (FALSE !== strpos($phpinfo, $mod)) { - // Return TRUE, module exists. - return TRUE; - } - } - else { - // NULL returned, apache_get_modules and phpinfo can not be called. - return NULL; - } - return FALSE; -} - -/** - * Convert the table to the specified collation. - * - * @param string $table_name - * Perform the operation on this table. - * @param array $fields - * An array of field names. - * @param string $collation - * The db collation to change to table columns to. - * @param array $schema_fields - * An array of field definitions. - * - * @return array - * Returns an array of tables and column names. - */ -function advagg_install_change_table_collation($table_name, array $fields, $collation, array $schema_fields) { - $db_type = Database::getConnection()->databaseType(); - // Skip if not MySQL. - if ($db_type !== 'mysql') { - return FALSE; - } - $table_name = Database::getConnection()->prefixTables('{' . db_escape_table($table_name) . '}'); - $results = db_query("SHOW FULL FIELDS FROM $table_name")->fetchAllAssoc('Field'); - $db_schema = Database::getConnection()->schema(); - foreach ($results as $row) { - if (!in_array($row->Field, $fields)) { - continue; - } - - $charset = strtolower(substr($collation, 0, strpos($collation, '_'))); - $query = "ALTER TABLE $table_name CHANGE `{$row->Field}` `{$row->Field}` {$row->Type}"; - $query .= " CHARACTER SET $charset COLLATE $collation"; - - if (isset($schema_fields[$row->Field]['not null'])) { - if ($schema_fields[$row->Field]['not null']) { - $query .= ' NOT NULL'; - } - else { - $query .= ' NULL'; - } - } - - // $schema_fields[$row->Field]['default'] can be NULL, so we explicitly - // check for the key here. - if (isset($schema_fields[$row->Field]) - && is_array($schema_fields[$row->Field]) - && array_key_exists('default', $schema_fields[$row->Field]) - ) { - $default = $schema_fields[$row->Field]['default']; - if (is_string($default)) { - $default = "'" . $default . "'"; - } - elseif (!isset($default)) { - $default = 'NULL'; - } - $query .= ' DEFAULT ' . $default; - } - - if (empty($schema_fields[$row->Field]['not null']) && !isset($schema_fields[$row->Field]['default'])) { - $query .= ' DEFAULT NULL'; - } - - // Add column comment. - if (!empty($schema_fields[$row->Field]['description'])) { - $query .= ' COMMENT ' . $db_schema->prepareComment($schema_fields[$row->Field]['description'], 255); - } - - db_query($query); - } -} - -/** - * Callback to delete files if size == 0 and modified more than 60 seconds ago. - * - * @param string $uri - * Location of the file to check. - */ -function advagg_install_delete_empty_file_if_stale($uri) { - // Set stale file threshold to 60 seconds. - if (filesize($uri) < 3 && REQUEST_TIME - filemtime($uri) > 60) { - file_unmanaged_delete($uri); - } -} - -/** - * Callback to delete files if size == 0 and modified more than 60 seconds ago. - * - * @param string $has_string - * If the .htaccess file contains this string it will be removed and - * recreated. - * @param string $does_not_have_string - * If the .htaccess file does not contains this string it will be removed & - * recreated. - * - * @return string - * Translated string indicating what was done. - */ -function advagg_install_update_htaccess($has_string = '', $does_not_have_string = '') { - // Make sure the advagg_get_root_files_dir() function is available. - drupal_load('module', 'advagg'); - - // Get paths to .htaccess file. - list($css_path, $js_path) = advagg_get_root_files_dir(); - $files['css'] = $css_path[0] . '/.htaccess'; - $files['js'] = $js_path[0] . '/.htaccess'; - - // Check for old .htaccess files. - $something_done = FALSE; - foreach ($files as $type => $uri) { - if (!file_exists($uri)) { - unset($files[$type]); - continue; - } - $contents = advagg_file_get_contents($uri); - // Remove old .htaccess file if it has this string. - if (!empty($has_string) && strpos($contents, $has_string) !== FALSE) { - drupal_unlink($uri); - $something_done = TRUE; - } - // Remove old .htaccess file if it does not have this string. - if (!empty($does_not_have_string) && strpos($contents, $does_not_have_string) === FALSE) { - drupal_unlink($uri); - $something_done = TRUE; - } - } - - // Create the new .htaccess file. - $new_htaccess = FALSE; - if (!empty($files) && $something_done && variable_get('advagg_htaccess_check_generate', ADVAGG_HTACCESS_CHECK_GENERATE)) { - // Make the advagg_htaccess_check_generate() function available. - module_load_include('inc', 'advagg', 'advagg.missing'); - foreach ($files as $type => $uri) { - advagg_htaccess_check_generate(array($uri => $type), $type, TRUE); - $new_htaccess = TRUE; - } - } - - // Output info. - if ($something_done) { - if ($new_htaccess) { - return t('Removed the old .htaccess file and put in a new one.'); - } - else { - return t('Removed the old .htaccess file.'); - } - } - else { - return t('Nothing needed to be done.'); - } -} - -/** - * See if the .htaccess file uses the RewriteBase directive. - * - * @param string $type - * Either css or js. - * - * @return bool - * FALSE if the ErrorDocument 404 statement is incorrect. - */ -function advagg_install_htaccess_errordocument($type) { - list($css_path, $js_path) = advagg_get_root_files_dir(); - if ($type === 'css') { - $location = $css_path[1] . '/.htaccess'; - } - if ($type === 'js') { - $location = $js_path[1] . '/.htaccess'; - } - $good = TRUE; - - // Get the location of the 404 error doc. - if (is_readable($location)) { - $htaccess = advagg_file_get_contents($location); - $matches = array(); - $found = preg_match_all('/\\n\s*ErrorDocument\s*404\s*(.*)/i', $htaccess, $matches); - if ($found && !empty($matches[0])) { - $matches[1] = array_map('trim', $matches[1]); - $location = array_pop($matches[1]); - } - } - else { - return $good; - } - // If it's pointing to the wrong place or doesn't exist return FALSE. - if (!empty($location) && $location !== "{$GLOBALS['base_path']}index.php") { - $good = FALSE; - } - if (empty($location) && $GLOBALS['base_path'] !== '/') { - $good = FALSE; - } - - return $good; -} - -/** - * Create proxy settings. - * - * @return string - * Apache httpd.conf settings for the s3fs module. - */ -function advagg_install_s3fs_proxy_settings() { - list($css_path, $js_path) = advagg_get_root_files_dir(); - - $position = strpos($css_path[0], '://'); - $dir = ''; - if ($position !== FALSE) { - $dir = substr($css_path[0], $position + 3); - } - $css_target = str_replace($dir, '', file_create_url($css_path[0])); - $position = strpos($js_path[0], '://'); - $dir = ''; - if ($position !== FALSE) { - $dir = substr($js_path[0], $position + 3); - } - $js_target = str_replace($dir, '', file_create_url($js_path[0])); - $scheme = parse_url($js_target, PHP_URL_SCHEME); - - $config = ''; - $extra = ''; - if ($scheme === 'http') { - $port = '80'; - } - elseif ($scheme === 'https') { - $port = '443'; - $extra = " SSLProxyEngine on\n"; - } - $config .= "<VirtualHost *:$port>\n"; - $config .= " ProxyRequests Off\n"; - $config .= $extra; - $config .= " <Proxy *>\n"; - $config .= " Order deny,allow\n"; - $config .= " Allow from all\n"; - $config .= " </Proxy>\n"; - $config .= " ProxyTimeout 4\n"; - $config .= " ProxyPass {$GLOBALS['base_path']}s3fs-css/ $css_target\n"; - $config .= " ProxyPassReverse {$GLOBALS['base_path']}s3fs-css/ $css_target\n"; - $config .= " ProxyPass {$GLOBALS['base_path']}s3fs-js/ $js_target\n"; - $config .= " ProxyPassReverse {$GLOBALS['base_path']}s3fs-js/ $js_target\n"; - $config .= " ProxyErrorOverride On\n"; - $config .= " ErrorDocument 404 {$GLOBALS['base_path']}index.php\n"; - $config .= "</VirtualHost>\n"; - - return $config; -} diff --git a/html/sites/all/modules/contrib/advagg/advagg.make.example b/html/sites/all/modules/contrib/advagg/advagg.make.example deleted file mode 100644 index 1971310e1..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg.make.example +++ /dev/null @@ -1,50 +0,0 @@ -; Rename this file to advagg.make to have it included within a drush make -; command. - -api = 2 -core = 7.x - -; Contrib module: libraries -; --------------------------------------- -projects[libraries][version] = "2" - -; JavaScript libraries -; --------------------------------------- - -; Library: CSSLint. -libraries[csslint][download][type] = git -libraries[csslint][download][url] = https://github.com/CSSLint/csslint - -; Library: fontfaceobserver. -libraries[fontfaceobserver][download][type] = git -libraries[fontfaceobserver][download][url] = https://github.com/bramstein/fontfaceobserver.git - -; Library: jshint. -libraries[jshint][download][type] = git -libraries[jshint][download][url] = https://github.com/jshint/jshint - -; Library: JShrink. -libraries[JShrink][download][type] = git -libraries[JShrink][download][url] = https://github.com/tedious/JShrink - -; Library: JSMinPlus. -libraries[jsminplus][download][type] = git -libraries[jsminplus][download][url] = https://github.com/JSMinPlus/JSMinPlus -libraries[jsminplus][directory_name] = "jsminplus" - -; Library: jspacker. -libraries[jspacker][download][type] = git -libraries[jspacker][download][url] = https://github.com/tholu/php-packer -libraries[jspacker][directory_name] = "jspacker" - -; Library: jsqueeze. -libraries[jsqueeze][download][type] = git -libraries[jsqueeze][download][url] = https://github.com/tchwork/jsqueeze - -; Library: loadCSS. -libraries[loadCSS][download][type] = git -libraries[loadCSS][download][url] = https://github.com/filamentgroup/loadCSS - -; Library: YUI-CSS-compressor-PHP-port. -libraries[YUI-CSS-compressor-PHP-port][download][type] = git -libraries[YUI-CSS-compressor-PHP-port][download][url] = https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port diff --git a/html/sites/all/modules/contrib/advagg/advagg.missing.inc b/html/sites/all/modules/contrib/advagg/advagg.missing.inc deleted file mode 100644 index 2bd1dddbd..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg.missing.inc +++ /dev/null @@ -1,1657 +0,0 @@ -<?php - -/** - * @file - * Advanced CSS/JS aggregation module. - * - * Functions used to generate a file given the filename. - */ - -/** - * Menu Callback; generates a missing CSS/JS file. - */ -function advagg_missing_aggregate($input = '') { - // Do not stop processing this request. - ignore_user_abort(TRUE); - - // Generate missing file. - $msg = advagg_missing_generate($input); - - if (module_exists('jquery_update')) { - $arg = arg(); - $filename = array_pop($arg); - $filename = explode('?', $filename); - $filename = array_shift($filename); - if (strpos($filename, 'min.map') !== FALSE && strpos($filename, 'jquery') !== FALSE) { - // Get filename from request. - $wrong_pattern = t('Wrong pattern.'); - if ($msg === $wrong_pattern) { - $version = variable_get('jquery_update_jquery_version', '1.10'); - $trueversion = '1.9.1'; - switch ($version) { - case '1.9': - $trueversion = '1.9.1'; - break; - - case '1.10': - $trueversion = '1.10.2'; - break; - - case '1.11': - $trueversion = '1.11.2'; - break; - - case '2.1': - $trueversion = '2.1.4'; - break; - } - $url = "https://cdn.jsdelivr.net/gh/jquery/jquery@$trueversion/jquery.min.map"; - drupal_goto($url, array('external' => TRUE), 301); - } - } - } - - // If here send out fast 404. - advagg_missing_fast404($msg); -} - -/** - * Generates a missing CSS/JS file and send it to client. - * - * @return string - * text if bundle couldn't be generated. - */ -function advagg_missing_generate($input = '') { - // Make sure we are not in a redirect loop. - $redirect_counter = isset($_GET['redirect_counter']) ? intval($_GET['redirect_counter']) : 0; - if ($redirect_counter > 5) { - watchdog('advagg', 'This request could not generate correctly. Loop detected. Request data: %info', array('%info' => $_GET['q'])); - return t('In a loop.'); - } - - // Get filename from request. - $arg = arg(); - $filename = array_pop($arg); - $filename = explode('?', $filename); - $filename = array_shift($filename); - - // Quit ASAP if filename does not match the AdvAgg pattern. - $data = advagg_get_hashes_from_filename($filename); - if (is_string($data) || !is_array($data)) { - // Try again with the function input. - $filename = $input; - $data1 = advagg_get_hashes_from_filename($filename); - if (is_string($data) || !is_array($data)) { - return "$data $data1"; - } - else { - $data = $data1; - } - } - - // Check to see if the file exists. - list($css_path, $js_path) = advagg_get_root_files_dir(); - if ($data[0] === 'css') { - $uri = $css_path[0] . '/' . $filename; - } - elseif ($data[0] === 'js') { - $uri = $js_path[0] . '/' . $filename; - } - - if (file_exists($uri) && filesize($uri) >= 0) { - // File does exist and filesize is bigger than zero, 307 to it. - $uri = advagg_generate_location_uri($filename, $data[0], $data[3]); - ++$redirect_counter; - $uri .= '?redirect_counter=' . $redirect_counter; - header('Location: ' . $uri, TRUE, 307); - exit(); - } - - // Get lock so only one process will do the work. - $lock_name = 'advagg_' . $filename; - $uri = $GLOBALS['base_path'] . $_GET['q']; - $created = FALSE; - $files_to_save = array(); - if (variable_get('advagg_no_locks', ADVAGG_NO_LOCKS)) { - $return = advagg_missing_create_file($filename, FALSE, $data); - if (!is_array($return)) { - return $return; - } - else { - list($files_to_save, $type) = $return; - $created = TRUE; - } - } - elseif (lock_acquire($lock_name, 10) || $redirect_counter > 4) { - if ($redirect_counter > 4) { - $return = advagg_missing_create_file($filename, TRUE, $data); - } - else { - $return = advagg_missing_create_file($filename, FALSE, $data); - } - lock_release($lock_name); - if (!is_array($return)) { - return $return; - } - else { - list($files_to_save, $type) = $return; - $created = TRUE; - } - } - else { - // Wait for another request that is already doing this work. - // We choose to block here since otherwise the router item may not - // be available in menu_execute_active_handler() resulting in a 404. - lock_wait($lock_name, 10); - if (file_exists($uri) && filesize($uri) > 0) { - $type = $data[0]; - $created = TRUE; - } - } - - // Redirect and try again on failure. - if (empty($created)) { - $uri = advagg_generate_location_uri($filename, $data[0], $data[3]); - ++$redirect_counter; - $uri .= '?redirect_counter=' . $redirect_counter; - header('Location: ' . $uri, TRUE, 307); - exit(); - } - - if ($redirect_counter > 4) { - watchdog('advagg', 'One of the alter hooks failed when generating this file: %uri. Thus this file was created without any alter hooks.', array('%uri' => $uri), WATCHDOG_ERROR); - } - - // Output file's contents if creating the file was successful. - // This function will call exit. - advagg_missing_send_saved_file($files_to_save, $uri, $created, $filename, $type, $redirect_counter, $data[3]); -} - -/** - * Given the filename, type, and settings, create absolute URL for 307 redirect. - * - * Due to url inbound alter we can not trust that the redirect will work if - * using $GLOBALS['base_path'] . $_GET['q']. Generate the uri as if it was - * going to be embedded in the html. - * - * @param string $filename - * Just the filename no path information. - * @param string $type - * String: css or js. - * @param array $aggregate_settings - * Array of settings. - * - * @return string - * String pointing to the URI of the file. - */ -function advagg_generate_location_uri($filename, $type, array $aggregate_settings = array()) { - list($css_path, $js_path) = advagg_get_root_files_dir(); - if ($type === 'css') { - $uri_307 = $css_path[0] . '/' . $filename; - } - elseif ($type === 'js') { - $uri_307 = $js_path[0] . '/' . $filename; - } - - if (empty($aggregate_settings)) { - $aggregate_settings = advagg_current_hooks_hash_array(); - } - - // 307s need to be absolute. RFC 2616 14.30. - $aggregate_settings['variables']['advagg_convert_absolute_to_relative_path'] = FALSE; - $aggregate_settings['variables']['advagg_convert_absolute_to_protocol_relative_path'] = FALSE; - - // Make advagg_context_switch available. - module_load_include('inc', 'advagg', 'advagg'); - advagg_context_switch($aggregate_settings, 0); - $uri_307 = advagg_file_create_url($uri_307, $aggregate_settings); - advagg_context_switch($aggregate_settings, 1); - - return $uri_307; -} - -/** - * Send the css/js file to the client. - * - * @param array $files_to_save - * Array of filenames and data. - * @param string $uri - * Requested filename. - * @param bool $created - * If file was created in a different thread. - * @param string $filename - * Just the filename no path information. - * @param string $type - * String: css or js. - * @param array $aggregate_settings - * Array of settings. Used to generate the 307 redirect location. - */ -function advagg_missing_send_saved_file(array $files_to_save, $uri, $created, $filename, $type, $redirect_counter, array $aggregate_settings = array()) { - // Send a 304 if this is a repeat request. - if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= REQUEST_TIME) { - header("HTTP/1.1 304 Not Modified"); - exit(); - } - - $return_compressed_br = FALSE; - $return_compressed_gz = FALSE; - // Negotiate whether to use gzip compression. - if (!empty($_SERVER['HTTP_ACCEPT_ENCODING'])) { - if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== FALSE) { - $return_compressed_br = TRUE; - } - if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE) { - $return_compressed_gz = TRUE; - } - } - header('Vary: Accept-Encoding', FALSE); - - if (!empty($created)) { - if ($return_compressed_br && file_exists($uri . '.br') && filesize($uri . '.br') > 0) { - $uri .= '.br'; - } - elseif ($return_compressed_gz && file_exists($uri . '.gz') && filesize($uri . '.gz') > 0) { - $uri .= '.gz'; - } - if (!isset($files_to_save[$uri]) && file_exists($uri) && filesize($uri)) { - // Do not use advagg_file_get_contents here. - $files_to_save[$uri] = (string) @file_get_contents($uri); - } - } - - // Make sure zlib.output_compression does not compress the output. - ini_set('zlib.output_compression', '0'); - header('Vary: Accept-Encoding', FALSE); - // Clear the output buffer. - if (ob_get_level()) { - ob_end_clean(); - } - // Set generic far future headers. - if (variable_get('advagg_farfuture_php', ADVAGG_FARFUTURE_PHP)) { - advagg_missing_set_farfuture_headers(); - } - // Return compressed content if we can. - if ($return_compressed_br || $return_compressed_gz) { - foreach ($files_to_save as $uri => $data) { - // See if this uri contains .br near the end of it. - $pos = strripos($uri, '.br', 91 + strlen(ADVAGG_SPACE) * 3); - if (!empty($pos)) { - $len = strlen($uri); - if ($pos == $len - 3) { - // .br file exists, send it out. - header('Content-Encoding: br'); - break; - } - } - - // See if this uri contains .gz near the end of it. - $pos = strripos($uri, '.gz', 91 + strlen(ADVAGG_SPACE) * 3); - if (!empty($pos)) { - $len = strlen($uri); - if ($pos == $len - 3) { - // .gz file exists, send it out. - header('Content-Encoding: gzip'); - break; - } - } - } - } - else { - $data = trim(reset($files_to_save)); - } - - // Output file and exit. - if (!empty($data)) { - $strlen = strlen($data); - // Send a 304 if this is a repeat request. - if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) { - $etags = explode(' ', $_SERVER['HTTP_IF_NONE_MATCH']); - if ($etags[0] < REQUEST_TIME + 31 * 24 * 60 * 60 - && isset($etags[1]) - && $etags[1] == $strlen - ) { - header("HTTP/1.1 304 Not Modified"); - exit(); - } - } - - // Send out a 200 OK status. - $default = ADVAGG_HTTP_200_CODE; - if (module_exists('httprl') - && variable_get('advagg_use_httprl', ADVAGG_USE_HTTPRL) - && (is_callable('httprl_is_background_callback_capable') - && httprl_is_background_callback_capable() - || !is_callable('httprl_is_background_callback_capable') - ) - ) { - // Use 203 instead of 200 if HTTPRL is being used. - $default = 203; - } - $number = variable_get('advagg_http_200_code', $default); - header("{$_SERVER['SERVER_PROTOCOL']} $number OK"); - - // Insure the Last-Modified header is set so 304's work correctly. - if (file_exists($uri) && $filemtime = @filemtime($uri)) { - header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T', $filemtime)); - // Etags generation in php is broken due to millisecond precision for the - // files mtime; apache has it, php does not. - } - else { - header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T', REQUEST_TIME)); - } - // Set the Expires date 1 month into the future. - if (variable_get('advagg_farfuture_php', ADVAGG_FARFUTURE_PHP)) { - header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', REQUEST_TIME + 31 * 24 * 60 * 60)); - } - // Also send an etag out. - header('Etag: ' . REQUEST_TIME . ' ' . $strlen); - - if ($type === 'css') { - header("Content-Type: text/css"); - } - elseif ($type === 'js') { - header("Content-Type: application/javascript; charset=UTF-8"); - } - header('X-AdvAgg: Generated file at ' . REQUEST_TIME); - - print $data; - exit(); - } - else { - // Redirect and try again on failure. - $uri = advagg_generate_location_uri($filename, $type, $aggregate_settings); - ++$redirect_counter; - $uri .= '?redirect_counter=' . $redirect_counter; - header('Location: ' . $uri, TRUE, 307); - exit(); - } -} - -/** - * Set various headers so the browser will cache the file for a long time. - */ -function advagg_missing_set_farfuture_headers() { - // Hat tip to the CDN module for the far future headers. - // - // Browsers that implement the W3C Access Control specification might refuse - // to use certain resources such as fonts if those resources violate the - // same-origin policy. Send a header to explicitly allow cross-domain use of - // those resources. This is called Cross-Origin Resource Sharing, or CORS. - header("Access-Control-Allow-Origin: *"); - // Remove all previously set Cache-Control headers, because we're going to - // override it. Since multiple Cache-Control headers might have been set, - // simply setting a new, overriding header isn't enough: that would only - // override the *last* Cache-Control header. Yay for PHP! - if (function_exists('header_remove')) { - header_remove('Cache-Control'); - header_remove('ETag'); - header_remove('Set-Cookie'); - } - else { - header('Cache-Control:'); - header('Cache-Control:'); - header('ETag:'); - header('ETag:'); - header('Set-Cookie:'); - header('Set-Cookie:'); - } - // Set a far future Cache-Control header (52 weeks), which prevents - // intermediate caches from transforming the data and allows any - // intermediate cache to cache it, since it's marked as a public resource. - if (variable_get('advagg_resource_hints_use_immutable', ADVAGG_RESOURCE_HINTS_USE_IMMUTABLE)) { - header('Cache-Control: max-age=31449600, no-transform, public, immutable'); - } - else { - header('Cache-Control: max-age=31449600, no-transform, public'); - } -} - -/** - * Given a filename create that file. - * - * @param string $filename - * Just the filename no path information. - * @param bool $no_alters - * (optional) Set to TRUE to do the bare amount of processing on the file. - * @param mixed $data - * (optional) Output from advagg_get_hashes_from_filename(). - * - * @return mixed - * On failure a string saying why it failed. - * On success the $files_to_save array. - */ -function advagg_missing_create_file($filename, $no_alters = FALSE, $data = array()) { - // Option to still delever the file if fatal error. - register_shutdown_function("advagg_missing_fatal_handler", $filename); - - if (empty($data)) { - $data = advagg_get_hashes_from_filename($filename); - } - if (is_array($data)) { - list($type, $aggregate_filenames_hash, $aggregate_contents_hash, $aggregate_settings) = $data; - } - else { - return $data; - } - - if (empty($aggregate_settings)) { - $aggregate_settings = advagg_current_hooks_hash_array(); - } - - // Set no alters if this is the last chance of generating the aggregate. - if ($no_alters) { - $aggregate_settings['settings']['no_alters'] = TRUE; - } - - // Get a list of files. - $files = advagg_get_files_from_hashes($type, $aggregate_filenames_hash, $aggregate_contents_hash); - if (empty($files)) { - return t('Hashes do not match database.'); - } - - // Save aggregate file. - list($files_to_save, $errors) = advagg_save_aggregate($filename, $files, $type, $aggregate_settings); - // Update atime. - advagg_multi_update_atime(array( - array( - 'aggregate_filenames_hash' => $aggregate_filenames_hash, - 'aggregate_contents_hash' => $aggregate_contents_hash, - ), - )); - // Make sure .htaccess file exists in the advagg dir. - if (variable_get('advagg_htaccess_check_generate', ADVAGG_HTACCESS_CHECK_GENERATE)) { - advagg_htaccess_check_generate($files_to_save, $type); - } - - // Return data. - return array( - $files_to_save, - $type, - $aggregate_filenames_hash, - $aggregate_contents_hash, - $aggregate_settings, - $files, - $errors, - ); -} - -/** - * Generate .htaccess rules and place them in advagg dir. - * - * @param array $files_to_save - * Array of files that where saved. - * @param string $type - * String: css or js. - * @param bool $force - * (Optional) force recreate the .htaccess file. - * - * @return array - * Empty array if not errors happened, list of errors if the write had any - * issues. - */ -function advagg_htaccess_check_generate(array $files_to_save, $type, $force = FALSE) { - list($css_path, $js_path) = advagg_get_root_files_dir(); - - $content_type = $type; - if ($content_type === 'js') { - $content_type = 'javascript'; - $advagg_dir = basename($js_path[1]); - } - elseif ($content_type === 'css') { - $advagg_dir = basename($css_path[1]); - } - $type_upper = strtoupper($type); - $data = "\n"; - - // Some hosting companies do not allow "FollowSymLinks" but will support - // "SymLinksIfOwnerMatch". - if (variable_get('advagg_htaccess_symlinksifownermatch', ADVAGG_HTACCESS_SYMLINKSIFOWNERMATCH)) { - $data .= "Options +SymLinksIfOwnerMatch\n"; - } - else { - $data .= "Options +FollowSymLinks\n"; - } - if ($GLOBALS['base_path'] !== '/') { - $data .= "ErrorDocument 404 {$GLOBALS['base_path']}index.php\n"; - } - // See if RewriteBase is needed. - $advagg_htaccess_rewritebase = trim(variable_get('advagg_htaccess_rewritebase', ADVAGG_HTACCESS_REWRITEBASE)); - if (!empty($advagg_htaccess_rewritebase) && !empty($advagg_dir)) { - $rewrite_base_rule = str_replace('//', '/', $advagg_htaccess_rewritebase . '/' . $advagg_dir); - $data .= "RewriteBase $rewrite_base_rule\n"; - } - - $data .= "\n"; - $data .= "<IfModule mod_rewrite.c>\n"; - $data .= " RewriteEngine on\n"; - $data .= " <IfModule mod_headers.c>\n"; - $data .= " # Serve brotli compressed ${type_upper} files if they exist and the client accepts br.\n"; - $data .= " RewriteCond %{HTTP:Accept-encoding} br\n"; - $data .= " RewriteCond %{REQUEST_FILENAME}\.br -s\n"; - $data .= " RewriteRule ^(.*)\.${type} " . '$1' . "\.${type}\.br [QSA]\n"; - if ($type === 'css') { - $data .= " RewriteRule \.${type}\.br$ - [T=text/${content_type},E=no-gzip:1]\n"; - } - else { - $data .= " RewriteRule \.${type}\.br$ - [T=application/${content_type},E=no-gzip:1]\n"; - } - $data .= "\n"; - $data .= " <FilesMatch \"\.${type}\.br$\">\n"; - $data .= " # Serve correct encoding type.\n"; - $data .= " Header set Content-Encoding br\n"; - $data .= " # Force proxies to cache gzipped & non-gzipped css/js files separately.\n"; - $data .= " Header append Vary Accept-Encoding\n"; - $data .= " </FilesMatch>\n"; - $data .= "\n"; - $data .= " # Serve gzip compressed ${type_upper} files if they exist and the client accepts gzip.\n"; - $data .= " RewriteCond %{HTTP:Accept-encoding} gzip\n"; - $data .= " RewriteCond %{REQUEST_FILENAME}\.gz -s\n"; - $data .= " RewriteRule ^(.*)\.${type} " . '$1' . "\.${type}\.gz [QSA]\n"; - if ($type === 'css') { - $data .= " RewriteRule \.${type}\.gz$ - [T=text/${content_type},E=no-gzip:1]\n"; - } - else { - $data .= " RewriteRule \.${type}\.gz$ - [T=application/${content_type},E=no-gzip:1]\n"; - } - $data .= "\n"; - $data .= " <FilesMatch \"\.${type}\.gz$\">\n"; - $data .= " # Serve correct encoding type.\n"; - $data .= " Header set Content-Encoding gzip\n"; - $data .= " # Force proxies to cache gzipped & non-gzipped css/js files separately.\n"; - $data .= " Header append Vary Accept-Encoding\n"; - $data .= " </FilesMatch>\n"; - $data .= " </IfModule>\n"; - $data .= "</IfModule>\n"; - $data .= "\n"; - $data .= "<FilesMatch \"^${type}" . ADVAGG_SPACE . "[A-Za-z0-9-_]{43}" . ADVAGG_SPACE . "[A-Za-z0-9-_]{43}" . ADVAGG_SPACE . "[A-Za-z0-9-_]{43}.${type}(\.gz|\.br)?\">\n"; - $data .= " # No mod_headers. Apache module headers is not enabled.\n"; - $data .= " <IfModule !mod_headers.c>\n"; - $data .= " # No mod_expires. Apache module expires is not enabled.\n"; - $data .= " <IfModule !mod_expires.c>\n"; - $data .= " # Use ETags.\n"; - $data .= " FileETag MTime Size\n"; - $data .= " </IfModule>\n"; - $data .= " </IfModule>\n"; - $data .= "\n"; - $data .= " # Use Expires Directive if apache module expires is enabled.\n"; - $data .= " <IfModule mod_expires.c>\n"; - $data .= " # Do not use ETags.\n"; - $data .= " FileETag None\n"; - $data .= " # Enable expirations.\n"; - $data .= " ExpiresActive On\n"; - $data .= " # Cache all aggregated ${type} files for 52 weeks after access (A).\n"; - $data .= " ExpiresDefault A31449600\n"; - $data .= " </IfModule>\n"; - $data .= "\n"; - $data .= " # Use Headers Directive if apache module headers is enabled.\n"; - $data .= " <IfModule mod_headers.c>\n"; - $data .= " # Do not use etags for cache validation.\n"; - $data .= " Header unset ETag\n"; - $data .= " # Serve correct content type.\n"; - if ($type === 'css') { - $data .= " Header set Content-Type text/${content_type}\n"; - } - else { - $data .= " Header set Content-Type application/${content_type}\n"; - } - $data .= " <IfModule !mod_expires.c>\n"; - $data .= " # Set a far future Cache-Control header to 52 weeks.\n"; - if (variable_get('advagg_resource_hints_use_immutable', ADVAGG_RESOURCE_HINTS_USE_IMMUTABLE)) { - $data .= " Header set Cache-Control \"max-age=31449600, no-transform, public, immutable\"\n"; - } - else { - $data .= " Header set Cache-Control \"max-age=31449600, no-transform, public\"\n"; - } - $data .= " </IfModule>\n"; - $data .= " <IfModule mod_expires.c>\n"; - if (variable_get('advagg_resource_hints_use_immutable', ADVAGG_RESOURCE_HINTS_USE_IMMUTABLE)) { - $data .= " Header append Cache-Control \"no-transform, public, immutable\"\n"; - } - else { - $data .= " Header append Cache-Control \"no-transform, public\"\n"; - } - $data .= " </IfModule>\n"; - $data .= " </IfModule>\n"; - if ($type === 'css') { - $data .= " ForceType text/${content_type}\n"; - } - else { - $data .= " ForceType application/${content_type}\n"; - } - $data .= "</FilesMatch>\n"; - - $errors = array(); - foreach (array_keys($files_to_save) as $uri) { - $dir = dirname($uri); - $htaccess_file = $dir . '/.htaccess'; - if (!$force && file_exists($htaccess_file)) { - continue; - } - - $errors = advagg_save_data($htaccess_file, $data, $force); - } - return $errors; -} - -/** - * Given a filename return the type and 2 hashes. - * - * @param string $filename - * Just the filename no path information. - * @param bool $skip_hash_settings - * Allows for the skipping of db lookup for required file hooks. - * - * @return mixed - * On failure a string saying why it failed. - * On success array($ext, $aggregate_hash, $files_hash). - */ -function advagg_get_hashes_from_filename($filename, $skip_hash_settings = FALSE) { - // Verify requested filename has the correct pattern. - if (!advagg_match_file_pattern($filename)) { - return t('Wrong pattern.'); - } - - // Get the extension. - $ext = substr($filename, strpos($filename, '.', 131 + strlen(ADVAGG_SPACE) * 3) + 1); - - // Set extraction points. - if ($ext === 'css') { - $aggregate_filenames_start = 3 + strlen(ADVAGG_SPACE); - $aggregate_contents_start = 46 + strlen(ADVAGG_SPACE) * 2; - $hooks_hashes_start = 89 + strlen(ADVAGG_SPACE) * 3; - } - elseif ($ext === 'js') { - $aggregate_filenames_start = 2 + strlen(ADVAGG_SPACE); - $aggregate_contents_start = 45 + strlen(ADVAGG_SPACE) * 2; - $hooks_hashes_start = 88 + strlen(ADVAGG_SPACE) * 3; - } - else { - return t('Wrong file type.'); - } - - // Extract info from wanted filename. - $aggregate_filenames_hash = substr($filename, $aggregate_filenames_start, 43); - $aggregate_contents_hash = substr($filename, $aggregate_contents_start, 43); - $hooks_hashes_value = substr($filename, $hooks_hashes_start, 43); - - $aggregate_settings = array(); - if (!$skip_hash_settings) { - // Verify that the hooks hashes is valid. - $aggregate_settings = advagg_get_hash_settings($hooks_hashes_value); - if (empty($aggregate_settings)) { - if (!variable_get('advagg_weak_file_verification', ADVAGG_WEAK_FILE_VERIFICATION)) { - return t('Bad hooks hashes value.'); - } - elseif (variable_get('advagg_debug', ADVAGG_DEBUG) >= 2) { - watchdog('advagg-debug', 'File @filename has an empty aggregate_settings variable; the 3rd hash is incorrect.', array('@filename' => $filename), WATCHDOG_DEBUG); - } - } - } - - return array( - $ext, - $aggregate_filenames_hash, - $aggregate_contents_hash, - $aggregate_settings, - ); -} - -/** - * Get the files that belong inside of this aggregate. - * - * @param string $type - * String: css or js. - * @param string $aggregate_filenames_hash - * Hash of the groupings of files. - * @param string $aggregate_contents_hash - * Hash of the files contents. - * - * @return array - * List of files in the order they should be included. - */ -function advagg_get_files_from_hashes($type, $aggregate_filenames_hash, $aggregate_contents_hash) { - // Create main query for the advagg_aggregates_versions table. - $query = db_select('advagg_aggregates_versions', 'aav') - ->condition('aav.aggregate_filenames_hash', $aggregate_filenames_hash) - ->condition('aav.aggregate_contents_hash', $aggregate_contents_hash); - // Create join query for the advagg_aggregates table. - $subquery_aggregates = $query->join('advagg_aggregates', 'aa', 'aa.aggregate_filenames_hash = - aav.aggregate_filenames_hash AND aa.aggregate_filenames_hash = :aggregate_filenames_hash', - array(':aggregate_filenames_hash' => $aggregate_filenames_hash)); - // Create join query for the advagg_files table. - $query->join('advagg_files', 'af', 'af.filename_hash = aa.filename_hash AND - af.filetype = :type AND af.filesize > 0', array(':type' => $type)); - // Select fields and ordering of the query; add in query comment as well. - $query = $query->fields('af', array('filename')) - ->fields($subquery_aggregates, array('settings')) - ->orderBy('porder', 'ASC'); - $query->comment('Query called from ' . __FUNCTION__ . '()'); - $results = $query->execute(); - - // Add in files that are included in this aggregate. - $files = array(); - foreach ($results as $value) { - $files[$value->filename] = unserialize($value->settings); - } - - // Try again with weak file verification. - if (empty($files) && variable_get('advagg_weak_file_verification', ADVAGG_WEAK_FILE_VERIFICATION)) { - if (variable_get('advagg_debug', ADVAGG_DEBUG) >= 2) { - watchdog('advagg-debug', 'Filehash @filename of type @type has an aggregate_contents_hash variable; the 2rd hash is incorrect.', array( - '@filename' => $aggregate_filenames_hash, - '@type' => $type, - ), WATCHDOG_DEBUG); - } - - // Create main query for the advagg_aggregates_versions table. - $query = db_select('advagg_aggregates_versions', 'aav') - ->condition('aav.aggregate_filenames_hash', $aggregate_filenames_hash); - // Create join query for the advagg_aggregates table. - $subquery_aggregates = $query->join('advagg_aggregates', 'aa', 'aa.aggregate_filenames_hash = - aav.aggregate_filenames_hash AND aa.aggregate_filenames_hash = :aggregate_filenames_hash', - array(':aggregate_filenames_hash' => $aggregate_filenames_hash)); - // Create join query for the advagg_files table. - $query->join('advagg_files', 'af', 'af.filename_hash = aa.filename_hash AND - af.filetype = :type AND af.filesize > 0', array(':type' => $type)); - // Select fields and ordering of the query; add in query comment as well. - $query = $query->fields('af', array('filename')) - ->fields($subquery_aggregates, array('settings')) - ->orderBy('porder', 'ASC'); - $query->comment('Query called from ' . __FUNCTION__ . '()'); - $results = $query->execute(); - - // Add in files that are included in this aggregate. - $files = array(); - foreach ($results as $value) { - $files[$value->filename] = unserialize($value->settings); - } - } - return $files; -} - -/** - * Given a list of files, grab their contents and glue it into one big string. - * - * @param array $files - * Array of filenames. - * @param array $aggregate_settings - * Array of settings. - * @param string $aggregate_filename - * Filename of the aggregeate. - * - * @return string - * String containing all the files. - */ -function advagg_get_css_aggregate_contents(array $files, array $aggregate_settings, $aggregate_filename = '') { - $write_aggregate = TRUE; - // Check if CSS compression is enabled. - $optimize = TRUE; - if (!empty($aggregate_settings['settings']['no_alters'])) { - $optimize = FALSE; - } - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - $optimize = FALSE; - } - - module_load_include('inc', 'advagg', 'advagg'); - $info_on_files = advagg_load_files_info_into_static_cache(array_keys($files)); - - $data = ''; - if (!empty($files)) { - $media_changes = FALSE; - $last_media = NULL; - foreach ($files as $settings) { - if (!isset($settings['media'])) { - continue; - } - if (is_null($last_media)) { - $last_media = $settings['media']; - continue; - } - if ($settings['media'] !== $last_media) { - $media_changes = TRUE; - break; - } - } - if ($media_changes) { - $global_file_media = 'all'; - } - else { - $global_file_media = $last_media; - } - - // https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries - $media_types = array( - 'all', - 'aural', - 'braille', - 'handheld', - 'print', - 'projection', - 'screen', - 'tty', - 'tv', - 'embossed', - ); - - $import_statements = array(); - module_load_include('inc', 'advagg', 'advagg'); - $original_settings = array($optimize, $aggregate_settings); - foreach ($files as $file => $settings) { - $media_changes = FALSE; - if (!isset($settings['media'])) { - $settings['media'] = ''; - } - - if ($settings['media'] !== $global_file_media) { - $media_changes = TRUE; - } - - list($optimize, $aggregate_settings) = $original_settings; - // Allow other modules to modify aggregate_settings optimize. - // Call hook_advagg_get_css_file_contents_pre_alter(). - if (empty($aggregate_settings['settings']['no_alters'])) { - drupal_alter('advagg_get_css_file_contents_pre', $file, $optimize, $aggregate_settings); - } - if (is_readable($file)) { - // Get the files contents. - $file_contents = (string) @advagg_file_get_contents($file); - // Get a hash of the file's contents. - $file_contents_hash = drupal_hash_base64($file_contents); - $cid = 'advagg:file:' . advagg_drupal_hash_base64($file); - if (empty($info_on_files[$cid]['content_hash'])) { - // If hash was not in the cache, get it from the DB. - $results = db_select('advagg_files', 'af') - ->fields('af', array('content_hash', 'filename_hash')) - ->condition('filename', $file) - ->execute(); - foreach ($results as $row) { - $info_on_files['advagg:file:' . $row->filename_hash]['content_hash'] = $row->content_hash; - } - } - if (isset($info_on_files[$cid]) == FALSE || $info_on_files[$cid]['content_hash'] !== $file_contents_hash) { - // If the content hash doesn't match don't write the file. - $write_aggregate = advagg_missing_file_not_readable($file, $aggregate_filename, FALSE); - } - $contents = advagg_load_css_stylesheet($file, $optimize, $aggregate_settings, $file_contents); - } - else { - // File is not readable. - $write_aggregate = advagg_missing_file_not_readable($file, $aggregate_filename, TRUE); - } - - // Allow other modules to modify this files contents. - // Call hook_advagg_get_css_file_contents_alter(). - if (empty($aggregate_settings['settings']['no_alters'])) { - drupal_alter('advagg_get_css_file_contents', $contents, $file, $aggregate_settings); - } - - if ($media_changes) { - $media_blocks = advagg_parse_media_blocks($contents); - $contents = ''; - - $file_has_type = FALSE; - if (!empty($settings['media'])) { - foreach ($media_types as $media_type) { - if (stripos($settings['media'], $media_type) !== FALSE) { - $file_has_type = TRUE; - break; - } - } - } - - foreach ($media_blocks as $css_rules) { - if (strpos($css_rules, '@media') !== FALSE) { - // Get start and end of the rules for this media query block. - $start = strpos($css_rules, '{'); - if ($start === FALSE) { - continue; - } - $end = strrpos($css_rules, '}'); - if ($end === FALSE) { - continue; - } - - // Get current media queries for this media block. - $media_rules = substr($css_rules, 6, $start - 6); - // Get everything else besides top level media query. - $css_selectors_rules = substr($css_rules, $start + 1, $end - ($start + 1)); - - // Add in main media rule if needed. - if (!empty($settings['media']) - && strpos($media_rules, $settings['media']) === FALSE - && $settings['media'] !== $global_file_media - ) { - $rule_has_type = FALSE; - if ($file_has_type) { - foreach ($media_types as $media_type) { - if (stripos($media_rules, $media_type) !== FALSE) { - $rule_has_type = TRUE; - break; - } - } - } - if (!$rule_has_type) { - $media_rules = $settings['media'] . ' and ' . $media_rules; - } - } - } - else { - $media_rules = $settings['media']; - $css_selectors_rules = $css_rules; - } - $media_rules = trim($media_rules); - - // Pul all @font-face defentions inside the @media declaration above. - $font_face_string = ''; - $font_blocks = advagg_parse_media_blocks($css_selectors_rules, '@font-face'); - $css_selectors_rules = ''; - foreach ($font_blocks as $rules) { - if (strpos($rules, '@font-face') !== FALSE) { - $font_face_string .= "\n {$rules}"; - } - else { - $css_selectors_rules .= $rules; - } - } - $css_selectors_rules = str_replace("\n", "\n ", $css_selectors_rules); - $font_face_string = str_replace("\n", "\n ", $font_face_string); - - // Wrap css in dedicated media query if it differs from the global - // media query and there actually are media rules. - if (!empty($media_rules) && $media_rules !== $global_file_media) { - $output = "{$font_face_string} \n@media {$media_rules} {\n {$css_selectors_rules} \n}"; - } - else { - $output = "{$font_face_string} \n {$css_selectors_rules}"; - } - - $contents .= trim($output); - } - - } - // Per the W3C specification at - // http://www.w3.org/TR/REC-CSS2/cascade.html#at-import, @import rules - // must proceed any other style, so we move those to the top. - $regexp = '/@import[^;]+;/i'; - preg_match_all($regexp, $contents, $matches); - $contents = preg_replace($regexp, '', $contents); - // Add the import statements with the media query of the current file. - $import_media = isset($settings['media']) ? $settings['media'] : ''; - $import_media = trim($import_media); - $import_statements[] = array($import_media, $matches[0]); - - // Close any open comment blocks. - $contents .= "\n/*})'\"*/\n"; - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - $contents .= "\n/* Above code came from $file */\n\n"; - } - - $data .= $contents; - } - - // Add import statements to the top of the stylesheet. - $import_string = ''; - foreach ($import_statements as $values) { - if ($media_changes) { - foreach ($values[1] as $statement) { - $import_string .= str_replace(';', $values[0] . ';', $statement); - } - } - else { - $import_string .= implode('', $values[1]); - } - } - $data = $import_string . $data; - } - - // Allow other modules to modify this aggregates contents. - // Call hook_advagg_get_css_aggregate_contents_alter(). - if (empty($aggregate_settings['settings']['no_alters'])) { - drupal_alter('advagg_get_css_aggregate_contents', $data, $files, $aggregate_settings); - } - return array($data, $write_aggregate); -} - -/** - * Given a list of files, grab their contents and glue it into one big string. - * - * @param array $files - * Array of filenames. - * @param array $aggregate_settings - * Array of settings. - * @param string $aggregate_filename - * Filename of the aggregeate. - * - * @return string - * String containing all the files. - */ -function advagg_get_js_aggregate_contents(array $files, array $aggregate_settings, $aggregate_filename = '') { - $write_aggregate = TRUE; - $data = ''; - - module_load_include('inc', 'advagg', 'advagg'); - $info_on_files = advagg_load_files_info_into_static_cache(array_keys($files)); - - if (!empty($files)) { - // Build aggregate JS file. - foreach ($files as $filename => $settings) { - $contents = ''; - // Append a ';' and a newline after each JS file to prevent them from - // running together. Also close any comment blocks. - if (is_readable($filename)) { - $file_contents = (string) @advagg_file_get_contents($filename); - $file_contents_hash = drupal_hash_base64($file_contents); - $cid = 'advagg:file:' . advagg_drupal_hash_base64($filename); - if (empty($info_on_files[$cid]['content_hash'])) { - $results = db_select('advagg_files', 'af') - ->fields('af', array('content_hash', 'filename_hash')) - ->condition('filename', $filename) - ->execute(); - foreach ($results as $row) { - $info_on_files['advagg:file:' . $row->filename_hash]['content_hash'] = $row->content_hash; - } - } - if (isset($info_on_files[$cid]['content_hash']) && $info_on_files[$cid]['content_hash'] !== $file_contents_hash) { - // If the content hash doesn't match don't write the file. - $write_aggregate = advagg_missing_file_not_readable($filename, $aggregate_filename, FALSE); - } - - // Make sure that the file is ended properly. - $file_contents .= "\n;/*})'\"*/\n"; - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - $file_contents .= "/* Above code came from $filename */\n\n"; - } - $contents .= $file_contents; - } - else { - // File is not readable. - $write_aggregate = advagg_missing_file_not_readable($filename, $aggregate_filename, TRUE); - } - // Allow other modules to modify this files contents. - // Call hook_advagg_get_js_file_contents_alter(). - if (empty($aggregate_settings['settings']['no_alters'])) { - drupal_alter('advagg_get_js_file_contents', $contents, $filename, $aggregate_settings); - } - // Make sure that the file is ended properly. - if (!empty($contents)) { - $contents .= ";/*})'\"*/\n"; - } - $data .= $contents; - } - } - - // Allow other modules to modify this aggregates contents. - // Call hook_advagg_get_js_aggregate_contents_alter(). - if (empty($aggregate_settings['settings']['no_alters'])) { - drupal_alter('advagg_get_js_aggregate_contents', $data, $files, $aggregate_settings); - } - return array($data, $write_aggregate); -} - -/** - * Let other modules know that this file couldn't be found. - * - * @param string $filename - * Filename of the missing file. - * @param string $aggregate_filename - * Filename of the aggregate that is trying to be generated. - * @param bool $fs_read_failure - * Set to TRUE if the file system couldn't be read. - */ -function advagg_missing_file_not_readable($filename, $aggregate_filename = '', $fs_read_failure = FALSE) { - $write_aggregate = FALSE; - $config_path = advagg_admin_config_root_path(); - list($css_path, $js_path) = advagg_get_root_files_dir(); - - // Get cache of this report. - $cid = 'advagg:file_issue:' . drupal_hash_base64($filename); - $cache = cache_get($cid, 'cache_advagg_info'); - - // Let other modules know about this missing file. - // Call hook_advagg_missing_root_file(). - module_invoke_all('advagg_missing_root_file', $aggregate_filename, $filename, $cache); - - // Report to watchdog if this is not cached and it does not start in the - // public dir and the advagg dirs. - if (empty($cache) - && strpos($filename, 'public://') !== 0 - && strpos($filename, $css_path[1]) !== 0 - && strpos($filename, $js_path[1]) !== 0 - ) { - if ($fs_read_failure) { - watchdog('advagg', 'Reading from the file system failed. This can sometimes happen during a deployment and/or a clear cache operation. Filename: %file Aggregate Filename: %aggregate. If this continues to happen go to the <a href="@operations">Operations page</a> and under Drastic Measures - Reset the AdvAgg Files table click the Truncate advagg_files button.', array( - '%file' => $filename, - '%aggregate' => $aggregate_filename, - '@operations' => url('admin/config/development/performance/advagg/operations', array('fragment' => 'edit-reset-advagg-files')), - ), WATCHDOG_WARNING); - } - else { - watchdog('advagg', 'The content hash for %file does not match the stored content hash from the database. Please <a href="@url">flush the advagg cache</a> under Smart Cache Flush. This can sometimes happen during a deployment. Filename: %file Aggregate Filename: %aggregate', array( - '%file' => $filename, - '%aggregate' => $aggregate_filename, - '@url' => url($config_path . '/advagg/operations', array( - 'fragment' => 'edit-smart-flush', - )), - ), WATCHDOG_WARNING); - } - cache_set($cid, TRUE, 'cache_advagg_info', CACHE_TEMPORARY); - } - elseif (!empty($cache) && $cache->created < (REQUEST_TIME - variable_get('advagg_file_read_failure_timeout', ADVAGG_FILE_READ_FAILURE_TIMEOUT))) { - // Write the aggregate if it's been in a failure state for over 30 minutes. - $write_aggregate = TRUE; - } - return $write_aggregate; -} - -/** - * Save an aggregate given a filename, the files included in it, and the type. - * - * @param string $filename - * Just the filename no path information. - * @param array $files - * Array of filenames. - * @param string $type - * String: css or js. - * @param array $aggregate_settings - * Array of settings. - * - * @return array - * array($files_to_save, $errors). - */ -function advagg_save_aggregate($filename, array $files, $type, array $aggregate_settings = array()) { - list($css_path, $js_path) = advagg_get_root_files_dir(); - $uri = ''; - if ($type === 'css') { - $uri = $css_path[0] . '/' . $filename; - } - elseif ($type === 'js') { - $uri = $js_path[0] . '/' . $filename; - } - - if (empty($aggregate_settings)) { - $aggregate_settings = advagg_current_hooks_hash_array(); - } - - // Allow other modules to alter the location, files included, and settings. - if (empty($aggregate_settings['settings']['no_alters'])) { - // Call hook_advagg_save_aggregate_pre_alter(). - drupal_alter('advagg_save_aggregate_pre', $uri, $files, $aggregate_settings); - } - - // Build the aggregates contents. - $contents = ''; - if ($type === 'css') { - list($contents, $write_aggregate) = advagg_get_css_aggregate_contents($files, $aggregate_settings, $filename); - } - elseif ($type === 'js') { - list($contents, $write_aggregate) = advagg_get_js_aggregate_contents($files, $aggregate_settings, $filename); - } - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - $contents = "/* This aggregate contains the following files:\n" . implode(",\n", array_keys($files)) . ". */\n\n" . $contents; - } - - // List of files to save. - $files_to_save = array( - $uri => $contents, - ); - - // Allow other modules to alter the contents and add new files to save. - // Call hook_advagg_save_aggregate_alter(). - $other_parameters = array($files, $type); - if (empty($aggregate_settings['settings']['no_alters'])) { - drupal_alter('advagg_save_aggregate', $files_to_save, $aggregate_settings, $other_parameters); - } - - $errors = array(); - if ($write_aggregate) { - foreach ($files_to_save as $uri => $data) { - $errors = advagg_save_data($uri, $data); - if (!file_exists($uri) || filesize($uri) == 0) { - if ($type === 'css') { - $full_dir = DRUPAL_ROOT . '/' . $css_path[1]; - } - elseif ($type === 'js') { - $full_dir = DRUPAL_ROOT . '/' . $js_path[1]; - } - $free_space = @disk_free_space($full_dir); - if ($free_space !== FALSE && strlen($data) > $free_space) { - watchdog('advagg', 'Write to file system failed. Disk is full. %uri. !errors. %full_dir.', array( - '%uri' => $uri, - '!errors' => print_r($errors, TRUE), - '%full_dir' => $full_dir, - ), WATCHDOG_ALERT); - } - elseif (!is_writable($full_dir)) { - watchdog('advagg', 'Write to file system failed. Check directory permissions. %uri. !errors. %full_dir.', array( - '%uri' => $uri, - '!errors' => print_r($errors, TRUE), - '%full_dir' => $full_dir, - ), WATCHDOG_ERROR); - } - else { - watchdog('advagg', 'Write to file system failed. %uri. !errors. %full_dir.', array( - '%uri' => $uri, - '!errors' => print_r($errors, TRUE), - '%full_dir' => $full_dir, - ), WATCHDOG_ERROR); - } - // If the file is empty, remove it. Serving via drupal is better than an - // empty aggregate being served. - if (file_exists($uri) && filesize($uri) == 0) { - @unlink($uri); - } - } - } - } - return array($files_to_save, $errors); -} - -/** - * Save data to a file. - * - * This will use the rename operation ensuring atomic file operations. - * - * @param string $uri - * A string containing the destination location. This must be a stream wrapper - * URI. - * @param string $data - * A string containing the contents of the file. - * @param bool $overwrite - * (optional) Bool, set to TRUE to overwrite a file. - * - * @return array - * Empty array if not errors happened, list of errors if the write had any - * issues. - */ -function advagg_save_data($uri, $data, $overwrite = FALSE) { - $t = get_t(); - $errors = array(); - // Clear the stat cache. - module_load_include('inc', 'advagg', 'advagg'); - advagg_clearstatcache($uri); - - // Prepare dir if needed. - $dir = dirname($uri); - $dir_good = file_prepare_directory($dir, FILE_CREATE_DIRECTORY); - if (!$dir_good) { - $errors[1] = $t('The directory for @file can not be created or is not writable.', array('@file' => $uri)); - return $errors; - } - - // File already exists. - if (!$overwrite && file_exists($uri) && filesize($uri) > 0) { - if (variable_get('advagg_debug', ADVAGG_DEBUG) >= 2) { - watchdog('advagg-debug', 'File @uri exists and overwrite is false.', array('@uri' => $uri), WATCHDOG_DEBUG); - } - $errors[2] = $t('File (@file) already exits.', array('@file' => $uri)); - return $errors; - } - - // If data is empty, write a space. - if (empty($data)) { - $data = ' '; - } - - // Perform the replace operation. Since there could be multiple processes - // writing to the same file, the best option is to create a temporary file in - // the same directory and then rename it to the destination. A temporary file - // is needed if the directory is mounted on a separate machine; thus ensuring - // the rename command stays local and atomic. - // - // Get a temporary filename in the destination directory. - $dir = $uri_dir = drupal_dirname($uri) . '/'; - - // Corect the bug with drupal_tempnam where it doesn't pass subdirs to - // tempnam() if the dir is a stream wrapper. - $scheme = file_uri_scheme($uri_dir); - if ($scheme && file_stream_wrapper_valid_scheme($scheme)) { - $wrapper = file_stream_wrapper_get_instance_by_scheme($scheme); - if ($wrapper && method_exists($wrapper, 'getDirectoryPath')) { - $wrapper_dir_path = $wrapper->getDirectoryPath(); - if (!empty($wrapper_dir_path)) { - $dir = $wrapper_dir_path . '/' . substr($uri_dir, strlen($scheme . '://')); - $uri = $dir . substr($uri, strlen($uri_dir)); - } - } - } - - // Get the extension of the original filename and append it to the temp file - // name. Preserves the mime type in different stream wrapper implementations. - $parts = pathinfo($uri); - if (variable_get('advagg_debug', ADVAGG_DEBUG) >= 2) { - watchdog('advagg-debug', 'Creating URI @uri', array('@uri' => $uri), WATCHDOG_DEBUG); - watchdog('advagg-debug', 'File Parts <pre>@parts</pre>', array('@parts' => print_r($parts, TRUE)), WATCHDOG_DEBUG); - } - $extension = '.' . $parts['extension']; - if ($extension === '.gz' || $extension === '.br') { - $parts = pathinfo($parts['filename']); - $extension = '.' . $parts['extension'] . $extension; - } - - // Create temp filename. - $temporary_file = $dir . 'advagg_file_' . drupal_hash_base64(microtime(TRUE) . mt_rand()) . $extension; - - // Save to temporary filename in the destination directory. - $filepath = file_unmanaged_save_data($data, $temporary_file, FILE_EXISTS_REPLACE); - - if ($filepath) { - // Perform the rename operation. - if (!advagg_rename($filepath, $uri)) { - // Unlink and try again for windows. Rename on windows does not replace - // the file if it already exists. - if (variable_get('advagg_debug', ADVAGG_DEBUG) >= 2) { - watchdog('advagg-debug', 'Rename failed. @to', array('@to' => $uri), WATCHDOG_WARNING); - } - @unlink($uri); - // Remove temporary_file if rename failed. - if (!advagg_rename($filepath, $uri)) { - $errors[20] = $t('Renaming the filename (@incorrect) to (@correct) failed.', array('@incorrect' => $filepath, '@correct' => $uri)); - - @unlink($filepath); - if (file_exists($filepath)) { - $errors[22] = $t('unlinking @file failed.', array('@file' => $filepath)); - } - watchdog('advagg', 'Rename 4 failed. Current: %current Target: %target', array( - '%current' => $filepath, - '%target' => $uri, - ), WATCHDOG_ERROR); - } - } - - // Check the filesize. - $file_size = @filesize($uri); - $expected_size = _advagg_string_size_in_bytes($data); - if ($file_size === 0) { - // Zero byte file. - $errors[26] = $t('Write successful, but the file is empty. @file', array('@file' => $filepath)); - watchdog('advagg', 'Write successful, but the file is empty. Target: target. The empty file has been removed. If this error continues, performance will be greatly degraded.', array( - '%target' => $uri, - ), WATCHDOG_ERROR); - // Better to serve straight from Drupal than have a broken file. - @unlink($uri); - } - elseif ($file_size > 0 && $file_size != $expected_size) { - // Data written to disk doesn't match. - $errors[28] = $t('Write successful, but the file is the wrong size. @file Expected size is @expected_size, actual size is @file_size', array( - '@file' => $uri, - '@expected_size' => $expected_size, - '@file_size' => $file_size, - )); - watchdog('advagg', 'Write successful, but the file is the wrong size. %file Expected size is %expected_size, actual size is %file_size. The broken file has been removed. If this error continues, performance will be greatly degraded.', array( - '%file' => $uri, - '%expected_size' => $expected_size, - '%file_size' => $file_size, - ), WATCHDOG_ERROR); - // Better to serve straight from Drupal than have a broken file. - @unlink($uri); - } - } - else { - $errors[24] = $t('Write failed. @file', array('@file' => $temporary_file)); - watchdog('advagg', 'Write failed. Target: %target', array( - '%target' => $temporary_file, - ), WATCHDOG_ERROR); - } - // Cleanup leftover files. - if (file_exists($temporary_file)) { - @unlink($temporary_file); - } - if (file_exists($filepath)) { - @unlink($filepath); - } - return $errors; -} - -/** - * Given a string, what is the size that it should be as a file? - * - * @param string $string - * Input data to be sized in bytes. - * @link http://stackoverflow.com/a/3511239/231914. - * - * @return int - * Number of bytes this string uses. - */ -function _advagg_string_size_in_bytes($string) { - if (function_exists('mb_strlen')) { - return mb_strlen($string, '8bit'); - } - else { - return strlen($string); - } -} - -/** - * Rename; fallback to copy delete if this fails. - * - * @param string $source - * A string containing the source location. - * @param string $destination - * A string containing the destination location. - * - * @return mixed - * Destination string on success, FALSE on failure. - */ -function advagg_rename($source, $destination) { - $real_source = drupal_realpath($source); - $real_source = $real_source ? $real_source : $source; - $real_destination = drupal_realpath($destination); - $real_destination = $real_destination ? $real_destination : $destination; - - // Try php rename. - if (!@rename($real_source, $real_destination)) { - // Try drupal move. - if (!file_unmanaged_move($source, $destination)) { - // Try file scheme's rename method if it exists. - $fs_wrapper = file_stream_wrapper_get_instance_by_scheme(file_uri_scheme($source)); - if (!$fs_wrapper || !method_exists($fs_wrapper, 'rename') || !$fs_wrapper->rename($source, $destination)) { - return FALSE; - } - } - } - - return $destination; -} - -/** - * Send out a fast 404 and exit. - * - * @param string $msg - * (optional) Small message reporting why the file didn't get created. - */ -function advagg_missing_fast404($msg = '') { - drupal_page_is_cacheable(FALSE); - - // Strip new lines & separators and limit header message to 512 characters. - $msg = substr(preg_replace("/[^\w\. ]+/", "", $msg), 0, 512); - - // Add in headers if possible. - if (!headers_sent()) { - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); - header('X-AdvAgg: Failed validation. ' . $msg); - } - - // Output fast 404 message and exit. - print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n"; - print '<html xmlns="http://www.w3.org/1999/xhtml">'; - print '<head><title>404 Not Found'; - print '

Not Found

'; - print '

The requested URL was not found on this server.

'; - print '

Home

'; - print ''; - print ''; - exit(); -} - -/** - * Read the atime value for the given aggregate. - * - * @param string $aggregate_filenames_hash - * Hash of the groupings of files. - * @param string $aggregate_contents_hash - * Hash of the files contents. - * @param string $uri - * URI pointing to the aggregate file. - * - * @return mixed - * File atime or FALSE if not found. - */ -function advagg_get_atime($aggregate_filenames_hash, $aggregate_contents_hash, $uri) { - // Try to use the cache to avoid hitting the database with a select query. - $cache_id = 'advagg:db:' . $aggregate_filenames_hash . ADVAGG_SPACE . $aggregate_contents_hash; - $cache = cache_get($cache_id, 'cache_advagg_info'); - if ($cache) { - // If the atime in the cache is less than 12 hours old, use that. - if (!empty($cache->data['atime']) && $cache->data['atime'] > REQUEST_TIME - (12 * 60 * 60)) { - return $cache->data['atime']; - } - } - - // Try to get the atime from the DB. - $atime = db_select('advagg_aggregates_versions', 'aav') - ->fields('aav', array('atime')) - ->condition('aav.aggregate_filenames_hash', $aggregate_filenames_hash) - ->condition('aav.aggregate_contents_hash', $aggregate_contents_hash) - ->execute() - ->fetchField(); - if (!empty($atime)) { - return $atime; - } - - // Return the atime from disk as a last resort. - if (file_exists($uri)) { - return fileatime($uri); - } - // No atime was found, return FALSE. - return FALSE; -} - -/** - * Split up as CSS string by @media queries. - * - * @param string $css - * String of CSS. - * @param string $starting_string - * What to look for when starting to parse the string. - * - * @return array - * array of css with only media queries. - * - * @see http://stackoverflow.com/a/14145856/125684 - */ -function advagg_parse_media_blocks($css, $starting_string = '@media') { - $media_blocks = array(); - $start = 0; - $last_start = 0; - - // Using the string as an array throughout this function. - // http://php.net/types.string#language.types.string.substr - while (($start = strpos($css, $starting_string, $start)) !== FALSE) { - // Stack to manage brackets. - $s = array(); - - // Get the first opening bracket. - $i = strpos($css, "{", $start); - - // If $i is false, then there is probably a css syntax error. - if ($i === FALSE) { - continue; - } - - // Push bracket onto stack. - array_push($s, $css[$i]); - // Move past first bracket. - ++$i; - - // Find the closing bracket for the @media statement. But ensure we don't - // overflow if there's an error. - while (!empty($s) && isset($css[$i])) { - // If the character is an opening bracket, push it onto the stack, - // otherwise pop the stack. - if ($css[$i] === "{") { - array_push($s, "{"); - } - elseif ($css[$i] === "}") { - array_pop($s); - } - ++$i; - } - - // Get CSS before @media and store it. - if ($last_start != $start) { - $insert = trim(substr($css, $last_start, $start - $last_start)); - if (!empty($insert)) { - $media_blocks[] = $insert; - } - } - // Cut @media block out of the css and store. - $media_blocks[] = trim(substr($css, $start, $i - $start)); - // Set the new $start to the end of the block. - $start = $i; - $last_start = $start; - } - - // Add in any remaining css rules after the last @media statement. - if (strlen($css) > $last_start) { - $insert = trim(substr($css, $last_start)); - if (!empty($insert)) { - $media_blocks[] = $insert; - } - } - - return $media_blocks; -} - -/** - * Given a filename create that file; usually works if PHP goes fatal. - * - * @param string $filename - * Just the filename no path information. - * - * @return mixed - * On failure a string saying why it failed. - * On success the $files_to_save array. - */ -function advagg_missing_fatal_handler($filename) { - static $counter = 0; - // Bail out if there is no error. - $error = error_get_last(); - if ($error === NULL) { - return; - } - - $counter++; - // Bail out if this is still in a loop. - if ($counter > 2) { - return; - } - - // Bail out if the file already exists. - $data = advagg_get_hashes_from_filename($filename); - $type = $data[0]; - list($css_path, $js_path) = advagg_get_root_files_dir(); - $uri = ''; - if ($type === 'css') { - $uri = $css_path[0] . '/' . $filename; - } - elseif ($type === 'js') { - $uri = $js_path[0] . '/' . $filename; - } - if (file_exists($uri)) { - return; - } - - // Generate the file with no alters. - set_time_limit(0); - $return = advagg_missing_create_file($filename, TRUE); - if (is_array($return) && !headers_sent()) { - $redirect_counter = isset($_GET['redirect_counter']) ? intval($_GET['redirect_counter']) : 0; - // 307 if headers have not been sent yet. - $uri = advagg_generate_location_uri($filename, $data[0], $data[3]); - ++$redirect_counter; - $uri .= '?redirect_counter=' . $redirect_counter; - header('Location: ' . $uri, TRUE, 307); - exit(); - } -} diff --git a/html/sites/all/modules/contrib/advagg/advagg.module b/html/sites/all/modules/contrib/advagg/advagg.module deleted file mode 100644 index 2b497ef05..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg.module +++ /dev/null @@ -1,6977 +0,0 @@ -' . $readme . ''; - } - } - else { - $output = '
' . $readme . '
'; - } - return $output; - } -} - -/** - * Implements hook_block_view_alter(). - */ -function advagg_block_view_alter(&$data, $block) { - // Do not run hook if AdvAgg is disabled. - if (!advagg_enabled()) { - return; - } - // Do not run hook if setting is disabled. - if (!variable_get('advagg_scripts_scope_anywhere', ADVAGG_SCRIPTS_SCOPE_ANYWHERE)) { - return; - } - - if (empty($data) || empty($data['content'])) { - return; - } - - $block_info = $block->module . ':' . $block->delta; - $prefix = ""; - $suffix = ""; - if (is_string($data['content'])) { - $data['content'] = $prefix . $data['content'] . $suffix; - } - else { - if (!isset($data['content']['#prefix'])) { - $data['content']['#prefix'] = ''; - } - $data['content']['#prefix'] .= $prefix; - if (!isset($data['content']['#suffix'])) { - $data['content']['#suffix'] = ''; - } - $data['content']['#suffix'] .= $suffix; - } -} - -/** - * Implements hook_views_pre_render(). - */ -function advagg_views_pre_render(&$view) { - // Do not run hook if AdvAgg is disabled. - if (!advagg_enabled()) { - return; - } - // Do not run hook if setting is disabled. - if (!variable_get('advagg_scripts_scope_anywhere', ADVAGG_SCRIPTS_SCOPE_ANYWHERE)) { - return; - } - - $info = "{$view->name}:{$view->current_display}"; - $prefix = ""; - $suffix = ""; - if (!isset($view->attachment_before)) { - $view->attachment_before = ''; - } - $view->attachment_before .= $prefix; - if (!isset($view->attachment_after)) { - $view->attachment_after = ''; - } - $view->attachment_after .= $suffix; -} - -/** - * Implements hook_panels_pre_render(). - */ -function advagg_panels_pre_render($panels_display, &$renderer) { - // Do not run hook if AdvAgg is disabled. - if (!advagg_enabled()) { - return; - } - // Do not run hook if setting is disabled. - if (!variable_get('advagg_scripts_scope_anywhere', ADVAGG_SCRIPTS_SCOPE_ANYWHERE)) { - return; - } - - $info = "{$panels_display->layout}:{$panels_display->css_id}"; - $prefix = ""; - $suffix = ""; - if (!isset($renderer->prefix)) { - $renderer->prefix = ''; - } - $renderer->prefix .= $prefix; - if (!isset($renderer->suffix)) { - $renderer->suffix = ''; - } - $renderer->suffix .= $suffix; -} - -/** - * Implements hook_url_inbound_alter(). - * - * Inbound URL rewrite helper. If host includes subdomain, rewrite URI and - * internal path if necessary. - */ -function advagg_url_inbound_alter(&$path, $original_path, $path_language) { - // Do nothing if this has been disabled. - if (!variable_get('advagg_url_inbound_alter', ADVAGG_URL_INBOUND_ALTER)) { - return; - } - - // Setup static so we only need to run the logic once. - $already_ran = &drupal_static(__FUNCTION__); - if (!isset($already_ran)) { - $already_ran = array(); - } - $request_path = request_path(); - - // Set the path again if we already did this alter. - if (array_key_exists($request_path, $already_ran)) { - $path = $already_ran[$request_path]; - return; - } - - // If requested path was for an advagg file but now it is something else - // switch is back to the advagg file. - if (!empty($path) - && $path != $request_path - && advagg_match_file_pattern($request_path) - ) { - // Get the advagg paths. - $advagg_path = advagg_get_root_files_dir(); - - // Get the top level path. - $top_level = substr($advagg_path[0][1], 0, strpos($advagg_path[0][1], 'advagg_css')); - - // Only change if it's an exact match. - $start = strpos($request_path, $top_level . 'advagg_'); - if ($start === 0) { - // Set path to correct advagg path. - $path = substr($request_path, $start); - $already_ran[$request_path] = $path; - } - else { - // Put all languages prefixes into an array. - $language_list = language_list(); - $prefixes = array(); - foreach ($language_list as $lang) { - if ($lang->enabled && !empty($lang->prefix) && strpos($request_path, $lang->prefix) !== FALSE) { - $prefixes[$lang->prefix] = $lang->prefix; - } - } - if (!empty($prefixes)) { - // Remove all enabled languages prefixes from the beginning of the path. - $substr_to_shrink = substr($request_path, 0, $start); - foreach ($prefixes as $prefix) { - $substr_to_shrink = str_replace($prefix . '/', '', $substr_to_shrink); - } - // Set path to correct advagg path. - $path = $substr_to_shrink . substr($request_path, $start); - $already_ran[$request_path] = $path; - } - } - } -} - -/** - * Implements hook_hook_info(). - */ -function advagg_hook_info() { - // List of hooks that can be inside of *.advagg.inc files. - // All advagg hooks except for: - // advagg_current_hooks_hash_array_alter - // advagg_hooks_implemented_alter - // advagg_get_root_files_dir_alter - // because these 3 hooks are used on most requests. - $advagg_hooks = array( - 'advagg_get_css_file_contents_pre_alter', - 'advagg_get_css_file_contents_alter', - 'advagg_get_js_file_contents_alter', - 'advagg_get_css_aggregate_contents_alter', - 'advagg_get_js_aggregate_contents_alter', - 'advagg_save_aggregate_pre_alter', - 'advagg_save_aggregate_alter', - 'advagg_build_aggregate_plans_alter', - 'advagg_build_aggregate_plans_post_alter', - 'advagg_css_groups_alter', - 'advagg_js_groups_alter', - 'advagg_modify_css_pre_render_alter', - 'advagg_modify_js_pre_render_alter', - 'advagg_changed_files', - 'advagg_removed_aggregates', - 'advagg_scan_for_changes', - 'advagg_get_info_on_files_alter', - 'advagg_context_alter', - 'advagg_missing_root_file', - ); - $hooks = array(); - foreach ($advagg_hooks as $hook) { - $hooks[$hook] = array('group' => 'advagg'); - } - return $hooks; -} - -/** - * Implements hook_module_implements_alter(). - */ -function advagg_module_implements_alter(&$implementations, $hook) { - // Move advagg_theme_registry_alter to the top. - if ($hook === 'theme_registry_alter' && array_key_exists('advagg', $implementations)) { - $item = array('advagg' => $implementations['advagg']); - unset($implementations['advagg']); - $implementations = array_merge($item, $implementations); - } - - // Move advagg_ajax_render_alter to the top. - if ($hook === 'ajax_render_alter' && array_key_exists('advagg', $implementations)) { - $item = array('advagg' => $implementations['advagg']); - unset($implementations['advagg']); - $implementations = array_merge($item, $implementations); - } - - // Move advagg_element_info_alter to the bottom. - if ($hook === 'element_info_alter' && array_key_exists('advagg', $implementations)) { - $item = $implementations['advagg']; - unset($implementations['advagg']); - $implementations['advagg'] = $item; - } - - // Replace locale_js_alter with _advagg_locale_js_alter. - if ($hook === 'js_alter' && array_key_exists('locale', $implementations)) { - unset($implementations['locale']); - $implementations['_advagg_locale'] = FALSE; - } - - // Move advagg_file_url_alter to the bottom. - if ($hook === 'file_url_alter' && array_key_exists('advagg', $implementations)) { - $item = $implementations['advagg']; - unset($implementations['advagg']); - $implementations['advagg'] = $item; - } - - if ($hook === 'requirements') { - // Move advagg_requirements to the bottom. - if (array_key_exists('advagg', $implementations)) { - $item = $implementations['advagg']; - unset($implementations['advagg']); - $implementations['advagg'] = $item; - } - // Move advagg_css_cdn to the bottom. - if (array_key_exists('advagg_css_cdn', $implementations)) { - $item = $implementations['advagg_css_cdn']; - unset($implementations['advagg_css_cdn']); - $implementations['advagg_css_cdn'] = $item; - } - // Move advagg_css_compress to the bottom. - if (array_key_exists('advagg_css_compress', $implementations)) { - $item = $implementations['advagg_css_compress']; - unset($implementations['advagg_css_compress']); - $implementations['advagg_css_compress'] = $item; - } - // Move advagg_js_cdn to the bottom. - if (array_key_exists('advagg_js_cdn', $implementations)) { - $item = $implementations['advagg_js_cdn']; - unset($implementations['advagg_js_cdn']); - $implementations['advagg_js_cdn'] = $item; - } - // Move advagg_js_compress to the bottom. - if (array_key_exists('advagg_js_compress', $implementations)) { - $item = $implementations['advagg_js_compress']; - unset($implementations['advagg_js_compress']); - $implementations['advagg_js_compress'] = $item; - } - } - - // Move advagg_cron to the bottom. - if ($hook === 'cron' && array_key_exists('advagg', $implementations)) { - $item = $implementations['advagg']; - unset($implementations['advagg']); - $implementations['advagg'] = $item; - } -} - -/** - * Implements hook_js_alter(). - * - * This is a locking wrapper for locale_js_alter(). - */ -function _advagg_locale_js_alter(&$js) { - // If the variable is empty then get the latest variable from the database. - $name = 'javascript_parsed'; - $parsed = variable_get($name, array()); - if (empty($parsed)) { - $variables = array_map('unserialize', db_query('SELECT name, value FROM {variable} WHERE name = :name', array(':name' => $name))->fetchAllKeyed()); - if (!empty($variables[$name])) { - $GLOBALS['conf'][$name] = $variables[$name]; - } - } - - // See if locale_js_alter() needs to do anything. - $dir = 'public://' . variable_get('locale_js_directory', 'languages'); - $new_files = FALSE; - // See if a rebuild of the translation file for the current language is - // needed. - if (!empty($parsed['refresh:' . $GLOBALS['language']->language])) { - $new_files = TRUE; - } - // Check for new js source files. - if (empty($new_files)) { - foreach ($js as $item) { - if ($item['type'] === 'file' - && !in_array($item['data'], $parsed) - && substr($item['data'], 0, strlen($dir)) != $dir - ) { - $new_files = TRUE; - break; - } - } - } - if (empty($new_files)) { - // No new files to manage, just add in available i18n files. - advagg_locale_js_add_translations($js, $dir); - // Exit function. - return; - } - - $count = 0; - while (!lock_acquire('locale_js_alter', 10)) { - ++$count; - // If we've waited over 3 times then skip. - if ($count > 3) { - lock_release('locale_js_alter'); - // Add in available i18n files. - advagg_locale_js_add_translations($js, $dir); - - // Disable saving to the cache as translations might be missing. - drupal_page_is_cacheable(FALSE); - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) > 1) { - $GLOBALS['conf']['advagg_cache_level'] = 0; - } - return; - } - - // Wait for the lock to be available. - lock_wait('locale_js_alter'); - } - - try { - // Run the alter. - locale_js_alter($js); - } - catch (PDOException $e) { - // If it fails we don't care, javascript_parsed is either already written or - // it will happen again on the next request. - // Still log it if in development mode. - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - watchdog('advagg', 'Development Mode - Caught PDO Exception: @info', array('@info' => $e)); - } - } - lock_release('locale_js_alter'); -} - -/** - * Implements hook_system_info_alter(). - */ -function advagg_system_info_alter(&$info, $file, $type) { - $config_path = &drupal_static(__FUNCTION__); - // Get advagg config path. - if (empty($config_path)) { - $config_path = advagg_admin_config_root_path(); - } - - // Replace advagg path. - if (!empty($info['configure']) - && strpos($info['configure'], '/advagg') !== FALSE - && ((!empty($info['dependencies']) - && is_array($info['dependencies']) - && in_array('advagg', $info['dependencies']) - ) || $file->name === 'advagg') - ) { - $pos = strpos($info['configure'], '/advagg') + 7; - $substr = substr($info['configure'], 0, $pos); - $info['configure'] = str_replace($substr, $config_path . '/advagg', $info['configure']); - } -} - -/** - * Implements hook_permission(). - */ -function advagg_permission() { - return array( - 'bypass advanced aggregation' => array( - 'title' => t('bypass advanced aggregation'), - 'description' => t('User can use URL query strings to bypass AdvAgg.'), - ), - ); -} - -/** - * Implements hook_file_url_alter(). - */ -function advagg_file_url_alter(&$original_uri) { - // Do nothing if URI does not contain /advagg_ - // OR file does not have the correct pattern. - if (strpos($original_uri, '/advagg_') === FALSE || !advagg_match_file_pattern($original_uri)) { - return; - } - - // CDN fix. - // Do nothing if - // in maintenance_mode - // CDN module does not exist - // CDN far future is disabled - // CDN mode is not basic - // URI does not contain cdn/farfuture/. - if (variable_get('maintenance_mode', FALSE) - || !module_exists('cdn') - || !variable_get(CDN_BASIC_FARFUTURE_VARIABLE, CDN_BASIC_FARFUTURE_DEFAULT) - || variable_get(CDN_MODE_VARIABLE, CDN_MODE_BASIC) != CDN_MODE_BASIC - || strpos($original_uri, 'cdn/farfuture/') === FALSE - ) { - return; - } - - // Remove cdn/farfuture/BASE64/prefix:value/ from the URI. - $original_uri = preg_replace('/cdn\/farfuture\/[A-Za-z0-9-_]{43}\/[A-Za-z]+\:[A-Za-z0-9-_]+\//', '', $original_uri); -} - -/** - * Implements hook_menu(). - */ -function advagg_menu() { - list($css_path, $js_path) = advagg_get_root_files_dir(); - $file_path = drupal_get_path('module', 'advagg'); - $config_path = advagg_admin_config_root_path(); - - $path_defined = FALSE; - if (advagg_s3fs_evaluate_no_rewrite_cssjs(FALSE)) { - $external_css = trim(parse_url(str_replace('/test.css', '/%', file_create_url($css_path[0] . '/test.css')), PHP_URL_PATH)); - if (strpos($external_css, $GLOBALS['base_path']) === 0) { - $external_css = substr($external_css, strlen($GLOBALS['base_path'])); - } - $external_js = trim(parse_url(str_replace('/test.js', '/%', file_create_url($js_path[0] . '/test.js')), PHP_URL_PATH)); - if (strpos($external_js, $GLOBALS['base_path']) === 0) { - $external_js = substr($external_js, strlen($GLOBALS['base_path'])); - } - $items[$external_css] = array( - 'title' => "Generate CSS Aggregate", - 'page callback' => 'advagg_missing_aggregate', - 'type' => MENU_CALLBACK, - // Allow anyone to access these public css files. - 'access callback' => TRUE, - 'file path' => $file_path, - 'file' => 'advagg.missing.inc', - ); - $items[$external_js] = array( - 'title' => "Generate JS Aggregate", - 'page callback' => 'advagg_missing_aggregate', - 'type' => MENU_CALLBACK, - // Allow anyone to access these public js files. - 'access callback' => TRUE, - 'file path' => $file_path, - 'file' => 'advagg.missing.inc', - ); - $path_defined = TRUE; - } - - if (!$path_defined) { - $items[$css_path[1] . '/%'] = array( - 'title' => "Generate CSS Aggregate", - 'page callback' => 'advagg_missing_aggregate', - 'type' => MENU_CALLBACK, - // Allow anyone to access these public css files. - 'access callback' => TRUE, - 'file path' => $file_path, - 'file' => 'advagg.missing.inc', - ); - $items[$js_path[1] . '/%'] = array( - 'title' => "Generate JS Aggregate", - 'page callback' => 'advagg_missing_aggregate', - 'type' => MENU_CALLBACK, - // Allow anyone to access these public js files. - 'access callback' => TRUE, - 'file path' => $file_path, - 'file' => 'advagg.missing.inc', - ); - } - - // If mutiple paths are symlinked to the same location; allow advagg to handle - // those addtional locations. - $advagg_additional_generate_paths = variable_get('advagg_additional_generate_paths', array()); - if (!empty($advagg_additional_generate_paths)) { - foreach ($advagg_additional_generate_paths as $path) { - $items[$path] = array( - 'title' => "Generate CSS/JS Aggregate", - 'page callback' => 'advagg_missing_aggregate', - 'type' => MENU_CALLBACK, - // Allow anyone to access these public css files. - 'access callback' => TRUE, - 'file path' => $file_path, - 'file' => 'advagg.missing.inc', - ); - } - } - - $items[$config_path . '/default'] = array( - 'title' => 'Performance', - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'file path' => drupal_get_path('module', 'system'), - 'weight' => -10, - ); - $items[$config_path . '/advagg'] = array( - 'title' => 'Advanced CSS/JS Aggregation', - 'description' => 'Configuration for Advanced CSS/JS Aggregation.', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('advagg_admin_settings_form'), - 'type' => MENU_LOCAL_TASK, - 'access arguments' => array('administer site configuration'), - 'file path' => $file_path, - 'file' => 'advagg.admin.inc', - 'weight' => 1, - ); - $items[$config_path . '/advagg/config'] = array( - 'title' => 'Configuration', - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, - ); - $items[$config_path . '/advagg/info'] = array( - 'title' => 'Information', - 'description' => 'More detailed information about advagg.', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('advagg_admin_info_form'), - 'type' => MENU_LOCAL_TASK, - 'access arguments' => array('administer site configuration'), - 'file path' => $file_path, - 'file' => 'advagg.admin.inc', - 'weight' => 18, - ); - $items[$config_path . '/advagg/operations'] = array( - 'title' => 'Operations', - 'description' => 'Flush caches, set the bypass cookie, take drastic actions.', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('advagg_admin_operations_form'), - 'type' => MENU_LOCAL_TASK, - 'access arguments' => array('administer site configuration'), - 'file path' => $file_path, - 'file' => 'advagg.admin.inc', - 'weight' => 20, - ); - return $items; -} - -/** - * Implements hook_cron(). - * - * This will be ran once a day at most. - */ -function advagg_cron($bypass_time_check = FALSE) { - // @param bool $bypass_time_check - // Set to TRUE to skip the 24 hour check. - // - // Execute once a day (24 hours). - if (!$bypass_time_check && variable_get('advagg_cron_timestamp', 0) > (REQUEST_TIME - variable_get('advagg_cron_frequency', ADVAGG_CRON_FREQUENCY))) { - return array(); - } - variable_set('advagg_cron_timestamp', REQUEST_TIME); - - // Flush the cache_advagg_info cache bin. - cache_clear_all(NULL, 'cache_advagg_info'); - - $return = array(); - // Clear out all stale advagg aggregated files. - module_load_include('inc', 'advagg', 'advagg.cache'); - $return[] = advagg_delete_stale_aggregates(); - - // Delete all empty aggregated files. - $return[] = advagg_delete_empty_aggregates(); - - // Delete orphaned aggregates. - $return[] = advagg_delete_orphaned_aggregates(); - - // Remove aggregates that include missing files. - $return[] = advagg_remove_missing_files_from_db(); - - // Remove unused aggregates. - $return[] = advagg_remove_old_unused_aggregates(); - - // Remove expired locks from the semaphore database table. - $return[] = advagg_cleanup_semaphore_table(); - - // Remove old temp files. - $return[] = advagg_remove_temp_files(); - - // Refresh all locale files. - $return[] = advagg_refresh_all_locale_files(); - - // Update libraries data. - advagg_get_remote_libraries_versions(TRUE); - - return $return; -} - -/** - * Implements hook_flush_caches(). - */ -function advagg_flush_caches($all_bins = FALSE, $push_new_changes = TRUE) { - // * @param bool $all_bins - // * TRUE: Get all advagg cache bins. - // * @param bool $push_new_changes - // * FALSE: Do not scan for changes. - // - // Send back a blank array if aav table doesn't exist. - if (!db_table_exists('advagg_aggregates_versions')) { - return array(); - } - - // Scan for and push new changes. - module_load_include('inc', 'advagg', 'advagg.cache'); - if ($push_new_changes) { - advagg_push_new_changes(); - } - - // Get list of cache bins to clear. - $bins = array('cache_advagg_aggregates'); - if ($all_bins) { - $bins[] = 'cache_advagg_info'; - } - return $bins; -} - -/** - * Implements hook_element_info_alter(). - */ -function advagg_element_info_alter(&$type) { - // Replace drupal_pre_render_styles with advagg_pre_render_styles. - $type['styles']['#items'] = array(); - if (!isset($type['styles']['#pre_render'])) { - $type['styles']['#pre_render'] = array(); - } - $key = array_search('drupal_pre_render_styles', $type['styles']['#pre_render']); - if ($key !== FALSE) { - $type['styles']['#pre_render'][$key] = 'advagg_pre_render_styles'; - } - else { - $type['styles']['#pre_render'][] = 'advagg_pre_render_styles'; - } - // Allow for other code to easily change the render with alter hooks. - $type['styles']['#pre_render'][] = 'advagg_modify_css_pre_render'; - $type['styles']['#group_callback'] = 'drupal_group_css'; - // Swap in our own aggregation callback. - $type['styles']['#aggregate_callback'] = '_advagg_aggregate_css'; - $type['styles']['#type'] = 'styles'; - - // Replace drupal_pre_render_scripts with advagg_pre_render_scripts. - $type['scripts']['#items'] = array(); - if (!isset($type['scripts']['#pre_render'])) { - $type['scripts']['#pre_render'] = array(); - } - $key_drupal = array_search('drupal_pre_render_scripts', $type['scripts']['#pre_render']); - $key_omega = array_search('omega_pre_render_scripts', $type['scripts']['#pre_render']); - $key_aurora = array_search('aurora_pre_render_scripts', $type['scripts']['#pre_render']); - if ($key_drupal !== FALSE) { - $type['scripts']['#pre_render'][$key_drupal] = 'advagg_pre_render_scripts'; - } - elseif ($key_omega !== FALSE) { - $type['scripts']['#pre_render'][$key_omega] = 'advagg_pre_render_scripts'; - } - elseif ($key_aurora !== FALSE) { - $type['scripts']['#pre_render'][$key_aurora] = 'advagg_pre_render_scripts'; - } - else { - $type['scripts']['#pre_render'][] = 'advagg_pre_render_scripts'; - } - // Allow for other code to easily change the render with alter hooks. - $type['scripts']['#pre_render'][] = 'advagg_modify_js_pre_render'; - $type['scripts']['#group_callback'] = 'advagg_group_js'; - // Swap in our own aggregation callback. - $type['scripts']['#aggregate_callback'] = '_advagg_aggregate_js'; - $type['scripts']['#type'] = 'scripts'; - - // Copy html_tag to html_script_tag. - $type['html_script_tag'] = $type['html_tag']; - $type['html_script_tag']['#theme'] = 'html_script_tag'; - $type['html_script_tag']['#type'] = 'html_script_tag'; -} - -/** - * Implements hook_theme_registry_alter(). - * - * Replace template_process_html with _advagg_process_html. - */ -function advagg_theme_registry_alter(&$theme_registry) { - if (!isset($theme_registry['html'])) { - return; - } - - // Replace core's process function with our own. - $index = array_search('template_process_html', $theme_registry['html']['process functions']); - if ($index !== FALSE) { - $theme_registry['html']['process functions'][$index] = '_advagg_process_html'; - } - else { - // Put AdvAgg at the bottom if we can't find the replacement. - $theme_registry['html']['process functions'][] = '_advagg_process_html'; - } - - // Copy html_tag to html_script_tag. - $theme_registry['html_script_tag'] = $theme_registry['html_tag']; - $theme_registry['html_script_tag']['function'] = 'theme_html_script_tag'; - - // Fix imce_page. - if (isset($theme_registry['imce_page'])) { - $advagg_path = drupal_get_path('module', 'advagg'); - $imce_path = drupal_get_path('module', 'imce'); - if (strpos($theme_registry['imce_page']['path'], $imce_path) !== FALSE) { - $theme_registry['imce_page']['path'] = $advagg_path . '/tpl'; - } - } -} - -/** - * Implements hook_ajax_render_alter(). - */ -function advagg_ajax_render_alter(&$commands) { - // Do not run hook if AdvAgg is disabled. - if (!advagg_enabled()) { - return; - } - - // Do not run hook if advagg_ajax_render_alter is FALSE. - if (!variable_get('advagg_ajax_render_alter', ADVAGG_AJAX_RENDER_ALTER)) { - return; - } - - // Conditionally adds the default Drupal/jQuery libraries to the page. - // @see http://drupal.org/node/1279226 - if (function_exists('drupal_add_js_page_defaults')) { - drupal_add_js_page_defaults(); - } - - // Get Core JS. - list(, $core_scripts_header, $core_scripts_footer, $items, $settings) = advagg_build_ajax_js_css(); - - // Get AdvAgg JS. - $scripts_header = $scripts_footer = ''; - if (!empty($items['js'])) { - $scripts_footer_array = advagg_get_js('footer', $items['js'], TRUE); - // Function advagg_pre_render_scripts() gets called here. - $scripts_footer = drupal_render($scripts_footer_array); - $scripts_header_array = advagg_get_js('header', $items['js'], TRUE); - // Function advagg_pre_render_scripts() gets called here. - $scripts_header = drupal_render($scripts_header_array); - } - - // Remove core JS. - foreach ($commands as $key => $values) { - // Skip if not an array or not a command. - if (!is_array($values) || empty($values['command'])) { - continue; - } - - if ($values['command'] === 'settings' - && is_array($values['settings']) - && !empty($values['merge']) - ) { - // Remove JS settings. - unset($commands[$key]); - continue; - } - if ($values['command'] === 'insert' - && is_null($values['settings']) - && $values['method'] === 'prepend' - && $values['data'] == $core_scripts_header - ) { - // Remove JS header. - unset($commands[$key]); - continue; - } - if ($values['command'] === 'insert' - && is_null($values['settings']) - && $values['method'] === 'append' - && $values['data'] == $core_scripts_footer - ) { - // Remove JS footer. - unset($commands[$key]); - continue; - } - } - - // Add in AdvAgg JS. - $extra_commands = array(); - if (!empty($scripts_header)) { - $extra_commands[] = ajax_command_prepend('head', $scripts_header); - } - if (!empty($scripts_footer)) { - $extra_commands[] = ajax_command_append('body', $scripts_footer); - } - if (!empty($extra_commands)) { - $commands = array_merge($extra_commands, $commands); - } - if (!empty($settings)) { - array_unshift($commands, ajax_command_settings(advagg_cleanup_settings_array(drupal_array_merge_deep_array(array_filter($settings['data'], 'is_array'))), TRUE)); - } -} - -/** - * Implements hook_preprocess_page(). - */ -function advagg_preprocess_page() { - // Scan for changes to any CSS/JS files if in development mode. - advagg_scan_filesystem_for_changes_live(); -} - -/** - * Implements hook_preprocess_html(). - * - * Add in rendering IE meta tag if "combine CSS" is enabled. - */ -function advagg_preprocess_html() { - // http://www.phpied.com/conditional-comments-block-downloads/#update - // Prevent conditional comments from stalling css downloads. - $fix_blocking_css_ie = array( - '#weight' => '-999999', - '#type' => 'markup', - '#markup' => "\n", - ); - // Add markup for IE conditional comments to head. - drupal_add_html_head($fix_blocking_css_ie, 'fix_blocking_css_ie'); - - // Do not force IE rendering mode if "combine CSS" is disabled. - if (!variable_get('advagg_combine_css_media', ADVAGG_COMBINE_CSS_MEDIA)) { - return; - } - - // Send IE meta tag to force IE rendering mode header. - $x_ua_compatible = 'IE=edge'; - if (variable_get('advagg_chrome_header_enabled', ADVAGG_CHROME_HEADER_ENABLED)) { - $x_ua_compatible .= ',chrome=1'; - } - drupal_add_http_header('X-UA-Compatible', $x_ua_compatible); -} - -/** - * Implements hook_form_FORM_ID_alter(). - * - * Give advice on how to temporarily disable css/js aggregation. - */ -function advagg_form_system_performance_settings_alter(&$form, &$form_state) { - module_load_include('admin.inc', 'advagg'); - advagg_admin_system_performance_settings_form($form, $form_state); -} - -/** - * Implements hook_js_alter(). - */ -function advagg_js_alter(&$js) { - if (module_exists('admin_menu')) { - // Fix for admin menu; put JS in footer. - $path = drupal_get_path('module', 'admin_menu'); - $filename = $path . '/admin_menu.js'; - if (isset($js[$filename])) { - $js[$filename]['scope'] = 'footer'; - } - } -} - -/** - * @} End of "addtogroup hooks". - */ - -/** - * @defgroup 3rd_party_hooks 3rd party hook implementations - * @{ - * Hooks that are not apart of core or AdvAgg. - */ - -/** - * Implements hook_cron_alter(). - */ -function advagg_cron_alter(&$data) { - // Run this cron job every 2 minutes. - if (isset($data['advagg_js_compress_cron'])) { - $data['advagg_js_compress_cron']['rule'] = '*/2 * * * *'; - } - // Run this cron job every 5 minutes. - if (isset($data['advagg_relocate_cron'])) { - $data['advagg_relocate_cron']['rule'] = '*/5 * * * *'; - } - // Run this cron job every day. - if (isset($data['advagg_cron'])) { - $data['advagg_cron']['rule'] = '0 0 * * *'; - } -} - -/** - * Implements hook_password_policy_force_change_allowed_paths_alter(). - */ -function advagg_password_policy_force_change_allowed_paths_alter(&$allowed_paths) { - $advagg_items = advagg_menu(); - foreach ($advagg_items as $path => $attributes) { - if (!empty($attributes['page callback']) && $attributes['page callback'] === 'advagg_missing_aggregate') { - $allowed_paths[] = str_replace('/%', '/*', $path); - } - } -} - -/** - * Implements hook_s3fs_upload_params_alter(). - * - * Set headers for advagg files. - */ -function advagg_s3fs_upload_params_alter(&$upload_params) { - // Get advagg dir. - list($css_path, $js_path) = advagg_get_root_files_dir(); - $scheme = file_uri_scheme($css_path[1]); - if ($scheme) { - $css_path_dir = parse_url($css_path[1]); - $css_path_dir = str_replace("$scheme://", '', $css_path[1]); - } - else { - $css_path_dir = ltrim($css_path[1], '/'); - } - $scheme = file_uri_scheme($js_path[1]); - if ($scheme) { - $js_path_dir = parse_url($js_path[1]); - $js_path_dir = str_replace("$scheme://", '', $js_path_dir[1]); - } - else { - $js_path_dir = ltrim($js_path[1], '/'); - } - - // Get file type in advagg dir, css or js. - $type = ''; - if (strpos($upload_params['Bucket'] . '/' . $upload_params['Key'], $css_path_dir) !== FALSE) { - $type = 'css'; - } - if (strpos($upload_params['Bucket'] . '/' . $upload_params['Key'], $js_path_dir) !== FALSE) { - $type = 'js'; - } - if ($js_path_dir === $css_path_dir && !empty($type)) { - $pathinfo = pathinfo($upload_params['Key']); - if ($pathinfo['extension'] === 'gz') { - $pathinfo = pathinfo($pathinfo['filename']); - } - $type = $pathinfo['extension']; - } - if (empty($type)) { - // Only change advagg files. - return; - } - - // Cache control is 52 weeeks. - if (variable_get('advagg_resource_hints_use_immutable', ADVAGG_RESOURCE_HINTS_USE_IMMUTABLE)) { - $upload_params['CacheControl'] = 'max-age=31449600, no-transform, public, immutable'; - } - else { - $upload_params['CacheControl'] = 'max-age=31449600, no-transform, public'; - } - // Expires in 365 days. - $upload_params['Expires'] = gmdate('D, d M Y H:i:s \G\M\T', REQUEST_TIME + 365 * 24 * 60 * 60); - - // The extension is .css or .js. - $pathinfo = pathinfo($upload_params['Key']); - if ($pathinfo['extension'] === $type) { - if (variable_get('advagg_gzip', ADVAGG_GZIP)) { - // Set gzip. - $upload_params['ContentEncoding'] = 'gzip'; - } - elseif (variable_get('advagg_brotli', ADVAGG_BROTLI)) { - // Set br. - $upload_params['ContentEncoding'] = 'br'; - } - } -} - -/** - * Return s3fs configuration settings and values. - * - * @param string $key - * A specific key available in the s3fs configuration. NULL by default. - * - * @return array|string|null - * The full s3fs configuration settings, value of a specific key, - * or NULL if s3fs and the function do not exist. - */ -function advagg_get_s3fs_config($key = NULL) { - if (module_exists('s3fs') && is_callable('_s3fs_get_config')) { - $s3fs_config = _s3fs_get_config(); - return (empty($key)) ? $s3fs_config : $s3fs_config[$key]; - } - else { - return NULL; - } -} - -/** - * Shortcut to evaluate if s3fs no_rewrite_cssjs is set or empty. - * - * If this needs to be accessed in a loop, it is more efficient to call - * advagg_get_s3fs_config() once from outside of the loop. An example - * can be seen in the advagg_install_check_via_http function. - * - * @param bool $is_set - * Check if no_write_cssjs field is set (TRUE) or empty (FALSE). - * - * @return bool - * TRUE or FALSE is returned based on evaluating the field. If - * s3fs_config returns a NULL, evaluate the function to FALSE. - * - * @see advagg_get_s3fs_config() - */ -function advagg_s3fs_evaluate_no_rewrite_cssjs($is_set = TRUE) { - $s3fs_no_rewrite_cssjs = advagg_get_s3fs_config('no_rewrite_cssjs'); - if (!is_null($s3fs_no_rewrite_cssjs)) { - return ($is_set) ? !empty($s3fs_no_rewrite_cssjs) : empty($s3fs_no_rewrite_cssjs); - } - else { - return FALSE; - } -} - -/** - * Implements hook_admin_menu_cache_info(). - * - * Add in a cache flush for advagg. - */ -function advagg_admin_menu_cache_info() { - if (variable_get('advagg_enabled', ADVAGG_ENABLED)) { - $caches['advagg'] = array( - 'title' => t('Adv CSS/JS Agg'), - 'callback' => 'advagg_admin_flush_cache', - ); - return $caches; - } -} - -/** - * Implements hook_admin_menu_output_alter(). - * - * Add in a cache flush for advagg. - */ -function advagg_admin_menu_output_alter(array &$content) { - if (variable_get('advagg_enabled', ADVAGG_ENABLED)) { - // Remove default core aggregation link. - unset($content['icon']['icon']['flush-cache']['assets']); - } -} - -/** - * Implements hook_anonymous_login_paths_alter(). - */ -function advagg_anonymous_login_paths_alter(&$paths) { - // Exclude advagg css/js paths. - list($css_path, $js_path) = advagg_get_root_files_dir(); - $paths['exclude'][] = $css_path[1] . '/*'; - $paths['exclude'][] = $js_path[1] . '/*'; -} - -/** - * Implements hook_pre_flush_all_caches(). - */ -function advagg_pre_flush_all_caches() { - static $run_once; - - if (!isset($run_once)) { - $run_once = TRUE; - // Only invoked by registry_rebuild. - module_load_include('admin.inc', 'advagg'); - // Truncate the advagg_files table. - advagg_admin_truncate_advagg_files(); - } -} - -/** - * @} End of "defgroup 3rd_party_hooks". - */ - -/** - * Only the alter part of locale_js_alter(), not the parsing part. - * - * @param array $javascript - * An array with all JavaScript code. Defaults to the default - * JavaScript array for the given scope. - * @param string $dir - * String pointing to the public locale_js_directory. - */ -function advagg_locale_js_add_translations(array &$javascript, $dir) { - // Add the translation JavaScript file to the page. - if (!empty($GLOBALS['language']->javascript)) { - // Add the translation JavaScript file to the page. - $file = $dir . '/' . $GLOBALS['language']->language . '_' . $GLOBALS['language']->javascript . '.js'; - $javascript[$file] = drupal_js_defaults($file); - } -} - -/** - * Callback for pre_render so elements can be modified before they are rendered. - * - * @param array $elements - * A render array containing: - * - #items: The JavaScript items as returned by drupal_add_js() and - * altered by drupal_get_js(). - * - #group_callback: A function to call to group #items. Following - * this function, #aggregate_callback is called to aggregate items within - * the same group into a single file. - * - #aggregate_callback: A function to call to aggregate the items within - * the groups arranged by the #group_callback function. - * - * @return array - * A render array that will render to a string of JavaScript tags. - */ -function advagg_modify_js_pre_render(array $elements) { - // Get the children elements. - $children = array_intersect_key($elements, array_flip(element_children($elements))); - - // Allow other modules to modify $children and $elements before they are - // rendered. - // Call hook_advagg_modify_js_pre_render_alter() - drupal_alter('advagg_modify_js_pre_render', $children, $elements); - - // Remove old children elements. - foreach ($children as $key => $value) { - if (isset($elements[$key])) { - unset($elements[$key]); - } - } - // Add in new children elements. - $elements += $children; - return $elements; -} - -/** - * Callback for pre_render so elements can be modified before they are rendered. - * - * @param array $elements - * A render array containing: - * - #items: The CSS items as returned by drupal_add_css() and - * altered by drupal_get_css(). - * - #group_callback: A function to call to group #items. Following - * this function, #aggregate_callback is called to aggregate items within - * the same group into a single file. - * - #aggregate_callback: A function to call to aggregate the items within - * the groups arranged by the #group_callback function. - * - * @return array - * A render array that will render to a string of JavaScript tags. - */ -function advagg_modify_css_pre_render(array $elements) { - if (!advagg_enabled()) { - return $elements; - } - - // Put children elements into a reference array. - $children = array(); - foreach ($elements as $key => &$value) { - if ($key !== '' && is_string($key) && (0 === strpos($key, '#'))) { - continue; - } - $children[$key] = &$value; - } - unset($value); - - // Allow other modules to modify $children and $elements before they are - // rendered. - // Call hook_advagg_modify_css_pre_render_alter() - drupal_alter('advagg_modify_css_pre_render', $children, $elements); - return $elements; -} - -/** - * Default callback to aggregate CSS files and inline content. - * - * Having the browser load fewer CSS files results in much faster page loads - * than when it loads many small files. This function aggregates files within - * the same group into a single file unless the site-wide setting to do so is - * disabled (commonly the case during site development). To optimize download, - * it also compresses the aggregate files by removing comments, whitespace, and - * other unnecessary content. Additionally, this functions aggregates inline - * content together, regardless of the site-wide aggregation setting. - * - * @param array $css_groups - * An array of CSS groups as returned by drupal_group_css(). This function - * modifies the group's 'data' property for each group that is aggregated. - * - * @see drupal_aggregate_css() - * @see drupal_group_css() - * @see drupal_pre_render_styles() - * @see system_element_info() - */ -function _advagg_aggregate_css(array &$css_groups) { - if (!advagg_enabled()) { - return drupal_aggregate_css($css_groups); - } - if (variable_get('advagg_debug', ADVAGG_DEBUG)) { - $GLOBALS['_advagg']['debug']['css_groups_before'][] = $css_groups; - } - - $preprocess_css = advagg_file_aggregation_enabled('css'); - - // Allow other modules to modify $css_groups right before it is processed. - // Call hook_advagg_css_groups_alter(). - drupal_alter('advagg_css_groups', $css_groups, $preprocess_css); - - // For each group that needs aggregation, aggregate its items. - $files_to_aggregate = array(); - // Allow for inline CSS to be between aggregated files. - $gap_counter = 0; - foreach ($css_groups as $key => $group) { - switch ($group['type']) { - // If a file group can be aggregated into a single file, do so, and set - // the group's data property to the file path of the aggregate file. - case 'file': - if ($group['preprocess'] && $preprocess_css) { - $files_to_aggregate[$gap_counter][$key] = $group; - } - else { - ++$gap_counter; - } - break; - - // Aggregate all inline CSS content into the group's data property. - case 'inline': - ++$gap_counter; - $css_groups[$key]['data'] = ''; - foreach ($group['items'] as $item) { - $css_groups[$key]['data'] .= advagg_load_stylesheet_content($item['data'], $item['preprocess']); - } - break; - - // Create a gap for external CSS. - case 'external': - ++$gap_counter; - break; - } - } - - if (!empty($files_to_aggregate)) { - $hooks_hash = advagg_get_current_hooks_hash(); - $serialize_function = variable_get('advagg_serialize', ADVAGG_SERIALIZE); - $css_hash = drupal_hash_base64($serialize_function($files_to_aggregate)); - $cache_id = 'advagg:css:' . $hooks_hash . ':' . $css_hash; - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 1 && $cache = cache_get($cache_id, 'cache_advagg_aggregates')) { - $plans = $cache->data; - } - else { - module_load_include('inc', 'advagg', 'advagg'); - $plans = advagg_build_aggregate_plans($files_to_aggregate, 'css'); - if (!empty($plans) && variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 1) { - cache_set($cache_id, $plans, 'cache_advagg_aggregates', CACHE_TEMPORARY); - } - } - $css_groups = advagg_merge_plans($css_groups, $plans); - } - if (variable_get('advagg_debug', ADVAGG_DEBUG)) { - $GLOBALS['_advagg']['debug']['css_groups_after'][] = $css_groups; - } -} - -/** - * Default callback to aggregate JavaScript files. - * - * Having the browser load fewer JavaScript files results in much faster page - * loads than when it loads many small files. This function aggregates files - * within the same group into a single file unless the site-wide setting to do - * so is disabled (commonly the case during site development). To optimize - * download, it also compresses the aggregate files by removing comments, - * whitespace, and other unnecessary content. - * - * @param array $js_groups - * An array of JavaScript groups as returned by drupal_group_js(). For each - * group that is aggregated, this function sets the value of the group's - * 'data' key to the URI of the aggregate file. - * - * @see drupal_group_js() - * @see drupal_pre_render_scripts() - */ -function _advagg_aggregate_js(array &$js_groups) { - if (!advagg_enabled()) { - if (function_exists('drupal_aggregate_js')) { - return drupal_aggregate_js($js_groups); - } - else { - return; - } - } - if (variable_get('advagg_debug', ADVAGG_DEBUG)) { - $GLOBALS['_advagg']['debug']['js_groups_before'][] = $js_groups; - } - - $preprocess_js = advagg_file_aggregation_enabled('js'); - - // Allow other modules to modify $js_groups right before it is processed. - // Call hook_advagg_js_groups_alter(). - drupal_alter('advagg_js_groups', $js_groups, $preprocess_js); - - // For each group that needs aggregation, aggregate its items. - $files_to_aggregate = array(); - // Only aggregate when the site is configured to do so, and not during an - // update. - $gap_counter = 0; - if ($preprocess_js) { - // Set boolean to TRUE if all JS in footer. - $all_in_footer = FALSE; - if (module_exists('advagg_mod') && variable_get('advagg_mod_js_footer', ADVAGG_MOD_JS_FOOTER) >= 2) { - $all_in_footer = TRUE; - } - foreach ($js_groups as $key => &$group) { - switch ($group['type']) { - // If a file group can be aggregated into a single file, do so, and set - // the group's data property to the file path of the aggregate file. - case 'file': - if (!empty($group['preprocess'])) { - // Special handing for when all JS is in the footer. - if ($all_in_footer && $group['scope'] === 'footer' && $group['group'] > 9000) { - ++$gap_counter; - $all_in_footer = FALSE; - } - $files_to_aggregate[$gap_counter][$key] = $group; - } - else { - ++$gap_counter; - } - break; - - // Create a gap for inline JS. - case 'inline': - ++$gap_counter; - break; - - // Create a gap for external JS. - case 'external': - ++$gap_counter; - break; - } - } - unset($group); - } - - if (!empty($files_to_aggregate)) { - $hooks_hash = advagg_get_current_hooks_hash(); - $serialize_function = variable_get('advagg_serialize', ADVAGG_SERIALIZE); - $js_hash = drupal_hash_base64($serialize_function($files_to_aggregate)); - $cache_id = 'advagg:js:' . $hooks_hash . ':' . $js_hash; - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 1 && $cache = cache_get($cache_id, 'cache_advagg_aggregates')) { - $plans = $cache->data; - } - else { - module_load_include('inc', 'advagg', 'advagg'); - $plans = advagg_build_aggregate_plans($files_to_aggregate, 'js'); - if (!empty($plans) && variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 1) { - cache_set($cache_id, $plans, 'cache_advagg_aggregates', CACHE_TEMPORARY); - } - } - $js_groups = advagg_merge_plans($js_groups, $plans); - } - if (variable_get('advagg_debug', ADVAGG_DEBUG)) { - $GLOBALS['_advagg']['debug']['js_groups_after'][] = $js_groups; - } -} - -/** - * Builds the arrays needed for css rendering and caching. - * - * @param bool $skip_alter - * (Optional) If set to TRUE, this function skips calling drupal_alter() on - * css, useful for the aggressive cache. - * - * @return array - * Array contains the 2 arrays used for css. - */ -function _advagg_build_css_arrays_for_rendering($skip_alter = FALSE) { - // Get the raw CSS variable. - $raw_css = drupal_add_css(); - // Process and Sort css. - $full_css = advagg_get_css($raw_css, $skip_alter); - // Add attached js to drupal_add_js() function. - if (!empty($full_css['#attached'])) { - drupal_process_attached($full_css); - // Remove #attached since it's been added to the javascript array now. - unset($full_css['#attached']); - } - return array($raw_css, $full_css); -} - -/** - * Builds the arrays needed for js rendering and caching. - * - * @param bool $skip_alter - * (Optional) If set to TRUE, this function skips calling drupal_alter() on - * js, useful for the aggressive cache. - * - * @return array - * Array contains the 3 arrays used for javascript. - */ -function _advagg_build_js_arrays_for_rendering($skip_alter = FALSE) { - // Get the raw JS variable. - $javascript = drupal_add_js(); - // Process and Sort JS. - $full_javascript = advagg_get_full_js($javascript, $skip_alter); - // Get scopes used in the js. - $scopes = advagg_get_js_scopes($full_javascript); - // Add JS to the header and footer of the page. - $js_scope_array = array(); - $js_scope_settings_array = array(); - foreach ($scopes as $scope => $use) { - if (!$use) { - // If the scope is not being used, skip it. - continue; - } - // advagg_get_js() will sort the JavaScript so that it appears in the - // correct order. - $scripts = advagg_get_js($scope, $full_javascript); - if (isset($scripts['#items']['settings'])) { - // Get the js settings. - $js_scope_settings_array[$scope]['settings'] = $scripts['#items']['settings']; - // Exclude JS Settings from the array; we'll add it back later. - $scripts['#items']['settings'] = array(); - } - $js_scope_array[$scope] = $scripts; - } - - // Fix settings; if more than 1 is set, use the largest one. - if (count($js_scope_settings_array) > 1) { - $max = -1; - $max_scope = ''; - foreach ($js_scope_settings_array as $scope => $settings) { - $count = count($settings); - $max = max($max, $count); - if ($max == $count) { - $max_scope = $scope; - } - } - - foreach ($js_scope_settings_array as $scope => $settings) { - if ($scope !== $max_scope) { - unset($js_scope_settings_array[$scope]); - } - } - } - return array($javascript, $js_scope_settings_array, $js_scope_array); -} - -/** - * Returns TRUE if the CSS is being loaded via JavaScript. - * - * @param object $css_cache - * Cache object from cache_get(). - * - * @return bool - * TRUE if CSS loaded via JS. FALSE if not. - */ -function advagg_css_in_js($css_cache = NULL) { - if (module_exists('advagg_mod') - && variable_get('advagg_mod_css_defer', ADVAGG_MOD_CSS_DEFER) - ) { - return TRUE; - } - if (module_exists('css_delivery') - && css_delivery_enabled() - ) { - return TRUE; - } - // Critical css added by another means. - if (!empty($css_cache->data[1]['#items'])) { - foreach ($css_cache->data[1]['#items'] as $values) { - if (!empty($values['critical-css'])) { - return TRUE; - } - } - } - return variable_get('advagg_css_in_js', ADVAGG_CSS_IN_JS); -} - -/** - * Given the full css and js scope array return back the render cache. - * - * @param array $full_css - * Array from advagg_get_css() with #attached removed because it was built by - * _advagg_build_css_arrays_for_rendering(). - * @param array $js_scope_array - * Array built from iterations of advagg_get_js() inside of - * _advagg_build_js_arrays_for_rendering(). - * - * @return array - * Array containing the $css_cache, $js_cache, $css_cache_id, $js_cache_id. - */ -function advagg_get_render_cache(array $full_css, array $js_scope_array) { - $cids = array(); - $css_cache_id = ''; - $js_cache_id = ''; - - // Get advagg hash. - $hooks_hash = advagg_get_current_hooks_hash(); - $serialize_function = variable_get('advagg_serialize', ADVAGG_SERIALIZE); - if (advagg_file_aggregation_enabled('css')) { - // Generate css cache id. - $cids[] = $css_cache_id = 'advagg:css:full:1.1:' . $hooks_hash . ':' . drupal_hash_base64($serialize_function($full_css)); - } - if (advagg_file_aggregation_enabled('js')) { - // Generate js cache id. - $cids[] = $js_cache_id = 'advagg:js:full:1.1:' . $hooks_hash . ':' . drupal_hash_base64($serialize_function($js_scope_array)); - } - - if (!empty($cids)) { - // Get the cached data. - $cached_data = cache_get_multiple($cids, 'cache_advagg_aggregates'); - - // Set variables from the cache. - if (isset($cached_data[$css_cache_id])) { - $css_cache = $cached_data[$css_cache_id]; - } - if (isset($cached_data[$js_cache_id])) { - $js_cache = $cached_data[$js_cache_id]; - } - } - - // Special handling if the css is loaded via JS. - if (!empty($css_cache) - && empty($js_cache) - && advagg_css_in_js($css_cache) - ) { - // If CSS is being loaded via JavaScript and the css cache is set but the - // js cache is not set; then unset the css cache as well. - unset($css_cache); - } - - // Set to empty arrays on a cache miss. - if (!isset($css_cache)) { - $css_cache = new stdClass(); - } - if (!isset($js_cache)) { - $js_cache = new stdClass(); - } - return array($css_cache, $js_cache, $css_cache_id, $js_cache_id); -} - -/** - * Replacement for template_process_html(). - */ -function _advagg_process_html(&$variables) { - // Don't fail even if the menu router failed. - if (drupal_get_http_header('status') === '404 Not Found') { - // See if the URI contains advagg. - $uri = request_uri(); - if (stripos($uri, '/advagg_') !== FALSE) { - $advagg_items = advagg_menu(); - - // Check css. - $css = reset($advagg_items); - $css_path = key($advagg_items); - $css_path = substr($css_path, 0, strlen($css_path) - 1); - $css_start = strpos($uri, $css_path); - if ($css_start !== FALSE) { - $filename = substr($uri, $css_start + strlen($css_path)); - } - - // Check js. - if (empty($filename)) { - $js = next($advagg_items); - $js_path = key($advagg_items); - $js_path = substr($js_path, 0, strlen($js_path) - 1); - $js_start = strpos($uri, $js_path); - if ($js_start !== FALSE) { - $filename = substr($uri, $js_start + strlen($js_path)); - } - } - - // If we have a filename call the page callback. - if (!empty($filename)) { - $router_item = $css; - if (isset($js)) { - $router_item = $js; - } - - // Include the file if needed. - if ($router_item['file']) { - $included = module_load_include($router_item['file'], 'advagg'); - if (!$included && !function_exists($router_item['page callback'])) { - $file = DRUPAL_ROOT . '/' . drupal_get_path('module', 'advagg') . '/' . $router_item['file']; - if (is_file($file)) { - require_once $file; - } - } - } - - // Call the function. - if (function_exists($router_item['page callback'])) { - // Strip query and fragment form the filename. - if ($pos = strpos($filename, '?')) { - $filename = substr($filename, 0, $pos); - } - if ($pos = strpos($filename, '#')) { - $filename = substr($filename, 0, $pos); - } - // Generate the file. - call_user_func_array($router_item['page callback'], array($filename)); - } - else { - // Report the bigger issue to watchdog. - watchdog('advagg', 'You need to flush your menu cache. This can be done at the top of the performance page. The advagg callback failed while trying to generate this file: @uri', array( - '@performance' => url('admin/config/development/performance'), - '@uri' => $uri, - ), WATCHDOG_CRITICAL); - } - } - } - } - - if (!advagg_enabled()) { - template_process_html($variables); - return; - } - - // Render page_top and page_bottom into top level variables. - if (isset($variables['page']) && is_array($variables['page']) && isset($variables['page']['page_top'])) { - $variables['page_top'] = drupal_render($variables['page']['page_top']); - } - elseif (!isset($variables['page_top'])) { - $variables['page_top'] = ''; - } - if (isset($variables['page']) && is_array($variables['page']) && isset($variables['page']['page_bottom'])) { - $variables['page_bottom'] = drupal_render($variables['page']['page_bottom']); - } - elseif (!isset($variables['page_bottom'])) { - $variables['page_bottom'] = ''; - } - // Place the rendered HTML for the page body into a top level variable. - if (isset($variables['page']) && is_array($variables['page']) && isset($variables['page']['#children'])) { - $variables['page'] = $variables['page']['#children']; - } - $advagg_script_alt_scope_scripts = array(); - if (variable_get('advagg_scripts_scope_anywhere', ADVAGG_SCRIPTS_SCOPE_ANYWHERE)) { - $prefix = ""; - $suffix = ""; - $variables['page'] = $prefix . $variables['page'] . $suffix; - $prefix = ""; - $suffix = ""; - $variables['page_top'] = $prefix . $variables['page_top'] . $suffix; - $prefix = ""; - $suffix = ""; - $variables['page_bottom'] = $prefix . $variables['page_bottom'] . $suffix; - - $matches = array(); - preg_match_all('//', $variables['page_top'], $matches); - $advagg_script_alt_scope_scripts = array_merge($matches[1], $advagg_script_alt_scope_scripts); - preg_match_all('//', $variables['page'], $matches); - $advagg_script_alt_scope_scripts = array_merge($matches[1], $advagg_script_alt_scope_scripts); - preg_match_all('//', $variables['page_bottom'], $matches); - $advagg_script_alt_scope_scripts = array_merge($matches[1], $advagg_script_alt_scope_scripts); - } - - // Parts of drupal_get_html_head(). - $elements = drupal_add_html_head(); - if (is_callable('advagg_mod_html_head_post_alter')) { - advagg_mod_html_head_post_alter($elements); - } - - // Get default javascript. - // @see http://drupal.org/node/1279226 - if (function_exists('drupal_add_js_page_defaults')) { - drupal_add_js_page_defaults(); - } - $javascript = array(); - - // Try the render cache. - if (!variable_get('advagg_debug', ADVAGG_DEBUG)) { - // No Alter. - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 5 && !module_exists('advagg_relocate')) { - // Get all CSS and JS variables needed; running no alters. - list($variables['css'], $full_css) = _advagg_build_css_arrays_for_rendering(TRUE); - list($javascript, $js_scope_settings_array, $js_scope_array) = _advagg_build_js_arrays_for_rendering(TRUE); - - // Get the render cache. - list($css_cache, $js_cache, $css_cache_id_no_alter, $js_cache_id_no_alter) = advagg_get_render_cache($full_css, $js_scope_array); - } - - // With Alter. - if ((empty($css_cache->data) || empty($js_cache->data)) && variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 3) { - // Get all CSS and JS variables needed; running alters. - list($variables['css'], $full_css) = _advagg_build_css_arrays_for_rendering(); - list($javascript, $js_scope_settings_array, $js_scope_array) = _advagg_build_js_arrays_for_rendering(); - - // Get the render cache. - list($css_cache, $js_cache, $css_cache_id, $js_cache_id) = advagg_get_render_cache($full_css, $js_scope_array); - } - } - - // CSS has nice hooks so we don't need to work around it. - if (!empty($css_cache->data)) { - // Use render cache. - list($variables['styles'], $full_css) = $css_cache->data; - } - else { - // Get the css if we have not done so. - if (empty($full_css)) { - list($variables['css'], $full_css) = _advagg_build_css_arrays_for_rendering(); - } - // Render the CSS; advagg_pre_render_styles() gets called here. - $variables['styles'] = drupal_render($full_css); - if (!empty($css_cache_id) && variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 3) { - // Save to the cache. - cache_set($css_cache_id, array($variables['styles'], $full_css), 'cache_advagg_aggregates', CACHE_TEMPORARY); - } - if (!empty($css_cache_id_no_alter) && variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 5) { - // Save to the cache. - cache_set($css_cache_id_no_alter, array($variables['styles'], $full_css), 'cache_advagg_aggregates', CACHE_TEMPORARY); - } - } - - if (module_exists('advagg_font') && variable_get('advagg_font_fontfaceobserver', ADVAGG_FONT_FONTFACEOBSERVER)) { - $fonts = array(); - foreach ($full_css['#groups'] as $groups) { - if (isset($groups['items']['files'])) { - foreach ($groups['items']['files'] as $file) { - if (isset($file['advagg_font'])) { - foreach ($file['advagg_font'] as $class => $name) { - $fonts[$class] = $name; - } - } - } - } - } - if (!empty($fonts)) { - if (isset($js_scope_settings_array)) { - $key = key($js_scope_settings_array); - $js_scope_settings_array[$key]['settings']['data'][] = array('advagg_font' => $fonts); - } - drupal_add_js(array('advagg_font' => $fonts), array('type' => 'setting')); - } - } - - if (variable_get('advagg_resource_hints_preload', ADVAGG_RESOURCE_HINTS_PRELOAD)) { - foreach ($full_css['#groups'] as $groups) { - if (empty($groups['data']) || $groups['type'] === 'inline') { - continue; - } - advagg_add_preload_header(advagg_convert_abs_to_rel(file_create_url($groups['data'])), 'style'); - } - } - - // JS needs hacks. - // Clear out all old scripts. - if (variable_get('advagg_clear_scripts', ADVAGG_CLEAR_SCRIPTS)) { - $variables['scripts'] = ''; - } - if (!isset($variables['scripts'])) { - $variables['scripts'] = ''; - } - if (!isset($variables['page_bottom']) || !is_string($variables['page_bottom'])) { - $variables['page_bottom'] = ''; - } - - $use_cache = FALSE; - if (!empty($js_cache->data) && !variable_get('advagg_debug', ADVAGG_DEBUG)) { - // Use render cache. - $use_cache = TRUE; - $add_to_variables = array(); - // Replace cached settings with current ones. - $js_settings_used = array(); - - $js_scope_settings_array_copy = $js_scope_settings_array; - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 5) { - if (!empty($js_scope_settings_array_copy['header']) && empty($js_scope_settings_array_copy['footer'])) { - // Copy header settings into the footer. - $js_scope_settings_array_copy['footer'] = $js_scope_settings_array_copy['header']; - } - } - - list($js_cache_data, $js_scope_array) = $js_cache->data; - - foreach ($js_cache_data as $scope => $value) { - $scope_settings = $scope; - if ($scope_settings === 'scripts') { - $scope_settings = 'header'; - } - if ($scope === 'page_bottom') { - $scope_settings = 'footer'; - } - // Search $value for Drupal.settings. - $start = strpos($value, 'jQuery.extend(Drupal.settings,'); - if ($start !== FALSE) { - // If the cache and current settings scope's do not match; do not use - // the cached version. - if (!isset($js_scope_settings_array_copy[$scope_settings]['settings'])) { - $use_cache = FALSE; - break; - } - - // Replace cached Drupal.settings with current Drupal.settings for this - // page. - $merged = advagg_cleanup_settings_array(drupal_array_merge_deep_array(array_filter($js_scope_settings_array_copy[$scope_settings]['settings']['data'], 'is_array'))); - $json_data = advagg_json_encode($merged); - if (!empty($json_data)) { - // Record that this is being used. - $js_settings_used[$scope_settings] = TRUE; - - // Replace the drupal settings string. - $value = advagg_replace_drupal_settings_string($value, $json_data); - } - } - $add_to_variables[$scope] = $value; - } - - if ($use_cache) { - $all_used = array_diff(array_keys($js_scope_settings_array_copy), array_keys($js_settings_used)); - // Ignore this check if the cache level is less than 5. - if (!empty($all_used) && variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 5 && !empty($js_settings_used)) { - // Some js settings did not make it into the output. Skip cache. - $use_cache = FALSE; - } - } - - if ($use_cache) { - // Using the cache; write to the $variables array. - foreach ($add_to_variables as $scope => $value) { - // Set the scope variable if not set. - if (!isset($variables[$scope]) || !is_string($variables[$scope])) { - $variables[$scope] = ''; - } - // Append the js to the scope. - $variables[$scope] .= $value; - } - } - } - - // If the cache isn't used. - if (!$use_cache) { - if (!empty($js_cache->data) && !empty($css_cache->data) && advagg_css_in_js($css_cache)) { - // Render the css so it will be added to the js array; - // advagg_pre_render_styles() gets called here. - $variables['styles'] = drupal_render($full_css); - } - - // Check if the js has changed. - $new_js = drupal_add_js(); - $diff = array_diff(array_keys($new_js), array_keys($javascript)); - if (!empty($diff) || empty($javascript)) { - // Get all JS variables needed again because js changed; or because we - // never got them in the first place. - list($javascript, $js_scope_settings_array, $js_scope_array) = _advagg_build_js_arrays_for_rendering(); - } - - $js_cache = array(); - $js_cache['scripts'] = ''; - if (!empty($js_scope_array)) { - // Add JS to the header and footer of the page. - foreach ($js_scope_array as $scope => &$scripts_array) { - // Add js settings. - if (!empty($js_scope_settings_array[$scope]['settings'])) { - $scripts_array['#items']['settings'] = $js_scope_settings_array[$scope]['settings']; - } - // Render js; advagg_pre_render_scripts() gets called here. - $scripts = drupal_render($scripts_array); - - if ($scope === 'header') { - // Add to the top of this section. - $variables['scripts'] = $scripts . $variables['scripts']; - $js_cache['scripts'] = $scripts . $js_cache['scripts']; - } - // Footer scripts. - elseif ($scope === 'footer') { - // Add to the bottom of this section. - $variables['page_bottom'] .= $scripts; - $js_cache['page_bottom'] = $scripts; - } - // Above css scripts. - elseif ($scope === 'above_css') { - // Put in this new section. - $variables['above_css'] = $scripts; - $js_cache['above_css'] = $scripts; - } - elseif (variable_get('advagg_scripts_scope_anywhere', ADVAGG_SCRIPTS_SCOPE_ANYWHERE)) { - // Scripts in other places. - if (isset($variables[$scope]) - && is_string($variables[$scope]) - && array_key_exists($scope, $GLOBALS['theme_info']->info['regions']) - ) { - // Add to the bottom of this section. - $variables[$scope] .= $scripts; - $js_cache[$scope] = $scripts; - } - elseif (array_search($scope, $advagg_script_alt_scope_scripts, TRUE) !== FALSE) { - // Add to the inline html. - $pos_page_top = strpos($variables['page_top'], ""); - $pos_page = strpos($variables['page'], ""); - $pos_page_bottom = strpos($variables['page_bottom'], ""); - if ($pos_page_top !== FALSE) { - $pos_page_top += strlen(""); - $variables['page_top'] = substr_replace($variables['page_top'], "\n$scripts", $pos_page_top, 0); - $js_cache[$scope] = $scripts; - } - elseif ($pos_page !== FALSE) { - $pos_page += strlen(""); - $variables['page'] = substr_replace($variables['page'], "\n$scripts", $pos_page, 0); - $js_cache[$scope] = $scripts; - } - elseif ($pos_page_bottom !== FALSE) { - $pos_page_bottom += strlen(""); - $variables['page_bottom'] = substr_replace($variables['page_bottom'], "\n$scripts", $pos_page_bottom, 0); - $js_cache[$scope] = $scripts; - } - } - // Add javascript to scripts if we can't find the region in the theme. - elseif (strpos($scope, ':') === FALSE) { - // Add to the bottom of this section. - $variables['scripts'] .= $scripts; - $js_cache['scripts'] .= $scripts; - } - } - } - unset($scripts_array); - - // Clear drupal settings so cache is smaller. - foreach ($js_cache as &$string) { - $string = advagg_replace_drupal_settings_string($string, '{}'); - } - unset($string); - - // Clear drupal settings and not needed items from render cache. - $js_scope_array = array_intersect_key($js_scope_array, array_flip(element_children($js_scope_array))); - foreach ($js_scope_array as $scope => &$scripts_array) { - // Clear element children. - $scripts_array = array_diff_key($scripts_array, array_flip(element_children($scripts_array))); - if (isset($scripts_array['#children'])) { - unset($scripts_array['#children']); - } - // Clear drupal settings. - if (isset($scripts_array['#items']['settings']['data']) && is_array($scripts_array['#items']['settings']['data'])) { - $scripts_array['#items']['settings']['data'] = array(); - } - // Clear printed keys. - if (isset($scripts_array['#printed'])) { - unset($scripts_array['#printed']); - } - // Clear not used groups. - foreach ($scripts_array['#groups'] as $key => $groups) { - if (!isset($groups['items']['files'])) { - unset($scripts_array['#groups'][$key]); - } - } - } - unset($scripts_array); - - if (!empty($js_cache_id) && !empty($js_cache) && variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 3) { - cache_set($js_cache_id, array($js_cache, $js_scope_array), 'cache_advagg_aggregates', CACHE_TEMPORARY); - } - if (!empty($js_cache_id_no_alter) && !empty($js_cache) && variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 5) { - cache_set($js_cache_id_no_alter, array($js_cache, $js_scope_array), 'cache_advagg_aggregates', CACHE_TEMPORARY); - } - } - } - if (!empty($variables['above_css'])) { - $variables['styles'] = $variables['above_css'] . $variables['styles']; - } - - if (variable_get('advagg_resource_hints_preload', ADVAGG_RESOURCE_HINTS_PRELOAD)) { - foreach ($js_scope_array as $scope => &$scripts_array) { - if ($scope !== 'header' - && $scope !== 'footer' - && $scope !== 'above_css' - && !variable_get('advagg_scripts_scope_anywhere', ADVAGG_SCRIPTS_SCOPE_ANYWHERE) - ) { - continue; - } - - foreach ($scripts_array['#groups'] as $groups) { - if (empty($groups['data']) || $groups['type'] === 'inline') { - continue; - } - advagg_add_preload_header(advagg_convert_abs_to_rel(file_create_url($groups['data'])), 'script'); - } - } - } - - $head_elements_before = drupal_add_html_head(); - if (variable_get('advagg_resource_hints_dns_prefetch', ADVAGG_RESOURCE_HINTS_DNS_PREFETCH) - || variable_get('advagg_resource_hints_preconnect', ADVAGG_RESOURCE_HINTS_PRECONNECT) - || variable_get('advagg_resource_hints_preload', ADVAGG_RESOURCE_HINTS_PRELOAD) - ) { - // Prefetch css domains. - foreach ($full_css['#items'] as $file) { - advagg_add_resource_hints_array($file); - } - foreach ($full_css['#groups'] as $groups) { - if (isset($groups['items']['files'])) { - foreach ($groups['items']['files'] as $file) { - advagg_add_resource_hints_array($file); - } - } - } - - // Prefetch js domains. - foreach ($js_scope_array as $scope_js) { - foreach ($scope_js['#items'] as $file) { - advagg_add_resource_hints_array($file); - } - if (isset($scope_js['#groups'])) { - foreach ($scope_js['#groups'] as $groups) { - if (isset($groups['items']['files'])) { - foreach ($groups['items']['files'] as $file) { - advagg_add_resource_hints_array($file); - } - } - } - } - } - } - - // Add in preload link headers. - advagg_add_preload_header(); - - // Add in the headers added by advagg. - $head_elements_after = drupal_add_html_head(); - $elements += array_diff_key($head_elements_after, $head_elements_before); - - // Parts of drupal_get_html_head(). - drupal_alter('html_head', $elements); - $head = drupal_render($elements); - if (variable_get('advagg_html_head_in_css_location', ADVAGG_HTML_HEAD_IN_CSS_LOCATION)) { - $variables['styles'] = $head . $variables['styles']; - $variables['head'] = ''; - } - else { - $variables['head'] = $head; - } - - // Remove AdvAgg comments. - if (variable_get('advagg_scripts_scope_anywhere', ADVAGG_SCRIPTS_SCOPE_ANYWHERE) - && !empty($advagg_script_alt_scope_scripts) - && !variable_get('theme_debug', FALSE) - ) { - $variables['page_top'] = preg_replace('//', '', $variables['page_top']); - $variables['page'] = preg_replace('//', '', $variables['page']); - $variables['page_bottom'] = preg_replace('//', '', $variables['page_bottom']); - } - - // Output debug info. - if (variable_get('advagg_debug', ADVAGG_DEBUG)) { - $debug = $GLOBALS['_advagg']['debug']; - if (is_callable('httprl_pr')) { - $output = ' ' . httprl_pr($debug); - } - else { - $output = '
' . str_replace(array('<', '>'), array('<', '>'), print_r($debug, TRUE)) . '
'; - } - watchdog('advagg_debug', $output, array(), WATCHDOG_DEBUG); - } -} - -/** - * Replace inline drupal settings script. - * - * @param string $subject - * Inline js. - * @param string $replace - * JS settings replacement. - * - * @return string - * Returns the subject with the replacement in place if this is a drupal - * settings json blob. - */ -function advagg_replace_drupal_settings_string($subject, $replace) { - $start = strpos($subject, 'jQuery.extend(Drupal.settings,'); - if ($start === FALSE) { - return $subject; - } - - // Find the end of the Drupal.settings. - $script_end = stripos($subject, '', $start); - $settings_substring = substr($subject, $start, $script_end - $start); - $json_end = strripos($settings_substring, '});'); - - // Check if LABjs has added an additional wrapper around Drupal settings. - $script_tag_start = strripos(substr($subject, 0, $start), ' $value) { - if (advagg_remove_short_keys($key)) { - if (is_array($data['ajaxPageState']['js']) && isset($data['ajaxPageState']['js'][$key])) { - unset($data['ajaxPageState']['js'][$key]); - } - elseif (is_object($data['ajaxPageState']['js']) && isset($data['ajaxPageState']['js']->{$key})) { - unset($data['ajaxPageState']['js']->{$key}); - } - } - } - } - // Remove inline css from the ajaxPageState data. - if (isset($data['ajaxPageState']['css'])) { - foreach ((array) $data['ajaxPageState']['css'] as $key => $value) { - if (advagg_remove_short_keys($key, 6)) { - if (is_object($data['ajaxPageState']['css']) && isset($data['ajaxPageState']['css']->{$key})) { - unset($data['ajaxPageState']['css']->{$key}); - } - elseif (is_array($data['ajaxPageState']['css']) && isset($data['ajaxPageState']['css'][$key])) { - unset($data['ajaxPageState']['css'][$key]); - } - } - } - } - // Remove settings from the js ajaxPageState data. - if (isset($data['ajaxPageState']['js']['settings'])) { - unset($data['ajaxPageState']['js']['settings']); - } - if (isset($data['ajaxPageState']['js']->settings)) { - unset($data['ajaxPageState']['js']->settings); - } - return $data; -} - -/** - * Find dns_prefetch and call advagg_add_dns_prefetch(). - * - * @param array $values - * Attributes added via code for the file. - */ -function advagg_add_resource_hints_array(array $values) { - if (variable_get('advagg_resource_hints_dns_prefetch', ADVAGG_RESOURCE_HINTS_DNS_PREFETCH) - || variable_get('advagg_resource_hints_preconnect', ADVAGG_RESOURCE_HINTS_PRECONNECT)) { - if (!empty($values['type']) - && ($values['type'] === 'external' || $values['type'] === 'file') - ) { - // Get external domains. - advagg_add_dns_prefetch($values['data']); - } - if (!empty($values['dns_prefetch'])) { - // Grab domains that will be access when this file is loaded. - if (is_array($values['dns_prefetch'])) { - foreach ($values['dns_prefetch'] as $url) { - advagg_add_dns_prefetch($url); - } - } - else { - advagg_add_dns_prefetch($values['dns_prefetch']); - } - } - } - if (!empty($values['preload']) && variable_get('advagg_resource_hints_preload', ADVAGG_RESOURCE_HINTS_PRELOAD)) { - if (is_array($values['preload'])) { - foreach ($values['preload'] as $url) { - advagg_add_preload_header($url); - } - } - else { - advagg_add_preload_header($values['preload']); - } - } -} - -/** - * Add in the dns-prefetch header for CSS and JS external files. - * - * @param string $url - * The url of the external host. - * - * @return bool - * TRUE if it was added to the head. - */ -function advagg_add_dns_prefetch($url) { - // Keep the order. - $advagg_resource_hints_location = variable_get('advagg_resource_hints_location', ADVAGG_RESOURCE_HINTS_LOCATION); - static $weight = -1001; - if ($advagg_resource_hints_location == 3) { - $weight = -999.9; - } - $weight += 0.0001; - - // Get the host. - $parse = @parse_url($url); - if (empty($parse['host'])) { - // If just the hostname was given, build proper url. - if (strpos($url, '.') && strpos($url, '/') === FALSE) { - $parse['scheme'] = '//'; - $parse['host'] = $url; - // Check for fragment. - $pos = strpos($url, '#'); - if ($pos !== FALSE) { - $parse['fragment'] = substr($url, $pos + 1); - $parse['host'] = substr($url, 0, $pos); - } - // Put it back together and parse again. - $url = advagg_glue_url($parse); - $parse = @parse_url($url); - } - if (empty($parse['host'])) { - return FALSE; - } - } - - // Filter out wrong schemes. - if (!empty($parse['scheme']) - && $parse['scheme'] !== 'http' - && $parse['scheme'] !== 'https' - ) { - return FALSE; - } - - // Filter out local host. - $host = @parse_url($GLOBALS['base_root'], PHP_URL_HOST); - if ($parse['host'] === $host) { - return FALSE; - } - - // Add DNS information for more domains. - if (strpos($parse['host'], 'fonts.googleapis.com') !== FALSE) { - // Add fonts.gstatic.com when fonts.googleapis.com is added. - advagg_add_dns_prefetch('https://fonts.gstatic.com/#crossorigin'); - } - - // Build render array. - if (variable_get('advagg_resource_hints_dns_prefetch', ADVAGG_RESOURCE_HINTS_DNS_PREFETCH)) { - $element = array( - '#type' => 'html_tag', - '#tag' => 'link', - '#attributes' => array( - 'rel' => 'dns-prefetch', - 'href' => '//' . $parse['host'], - ), - '#weight' => $weight, - ); - // Add markup for dns-prefetch to html_head. - drupal_add_html_head($element, 'advagg_resource_hints_dns_prefetch:' . $parse['host']); - } - if (variable_get('advagg_resource_hints_preconnect', ADVAGG_RESOURCE_HINTS_PRECONNECT)) { - // HTTPS use Protocol Relative; HTTP and scheme defined use given scheme. - $href = '//' . $parse['host']; - if (!$GLOBALS['is_https'] && isset($parse['scheme'])) { - $href = "{$parse['scheme']}://{$parse['host']}"; - } - - $element = array( - '#type' => 'html_tag', - '#tag' => 'link', - '#attributes' => array( - 'rel' => 'preconnect', - 'href' => $href, - ), - '#weight' => $weight, - ); - if (!empty($parse['fragment']) && $parse['fragment'] === 'crossorigin') { - $element['#attributes']['crossorigin'] = ''; - } - // Add markup for dns-prefetch to html_head. - drupal_add_html_head($element, 'advagg_resource_hints_preconnect:' . $parse['host']); - } - - // Build render array. Goes after charset tag. - if (!empty($parse['fragment']) && $parse['fragment'] === 'prefetch') { - // Hacky way to open up a connection to the remote host. - $element = array( - '#type' => 'html_tag', - '#tag' => 'link', - '#attributes' => array( - 'rel' => 'prefetch', - 'href' => '//' . $parse['host'] . '/robots.txt', - ), - '#weight' => $weight, - ); - drupal_add_html_head($element, 'advagg_prefetch:' . $parse['host']); - } - return TRUE; -} - -/** - * Returns a themed representation of all stylesheets to attach to the page. - * - * It loads the CSS in order, with 'module' first, then 'theme' afterwards. - * This ensures proper cascading of styles so themes can easily override - * module styles through CSS selectors. - * - * Themes may replace module-defined CSS files by adding a stylesheet with the - * same filename. For example, themes/bartik/system-menus.css would replace - * modules/system/system-menus.css. This allows themes to override complete - * CSS files, rather than specific selectors, when necessary. - * - * If the original CSS file is being overridden by a theme, the theme is - * responsible for supplying an accompanying RTL CSS file to replace the - * module's. - * - * @param array $css - * (Optional) An array of CSS files. If no array is provided, the default - * stylesheets array is used instead. - * @param bool $skip_alter - * (Optional) If set to TRUE, this function skips calling drupal_alter() on - * $css, useful when the calling function passes a $css array that has already - * been altered. - * - * @return array - * An array ready to be passed into drupal_render(). - * - * @see drupal_add_css() - */ -function advagg_get_css(array $css = array(), $skip_alter = FALSE) { - if (empty($css)) { - $css = drupal_add_css(); - } - - // Allow modules and themes to alter the CSS items. - if (!$skip_alter) { - advagg_add_default_dns_lookups($css, 'css'); - // Call hook_css_alter(). - drupal_alter('css', $css); - // Call hook_css_post_alter(). - drupal_alter('css_post', $css); - // Call these advagg functions after the hook_css_alter was called. - advagg_fix_type($css, 'css'); - } - - // Sort CSS items, so that they appear in the correct order. - advagg_drupal_sort_css_js_stable($css); - - // Provide the page with information about the individual CSS files used, - // information not otherwise available when CSS aggregation is enabled. The - // setting is attached later in this function, but is set here, so that CSS - // files removed below are still considered "used" and prevented from being - // added in a later AJAX request. - // Skip if no files were added to the page or jQuery.extend() will overwrite - // the Drupal.settings.ajaxPageState.css object with an empty array. - if (!empty($css)) { - // Cast the array to an object to be on the safe side even if not empty. - $setting['ajaxPageState']['css'] = (object) array_fill_keys(array_keys($css), 1); - } - - // Remove the overridden CSS files. Later CSS files override former ones. - $previous_item = array(); - foreach ($css as $key => $item) { - if ($item['type'] == 'file') { - // If defined, force a unique basename for this file. - $basename = isset($item['basename']) ? $item['basename'] : drupal_basename($item['data']); - if (isset($previous_item[$basename])) { - // Remove the previous item that shared the same base name. - unset($css[$previous_item[$basename]]); - } - $previous_item[$basename] = $key; - } - } - - // Remove empty files. - advagg_remove_empty_files($css); - - // Render the HTML needed to load the CSS. - $styles = array( - '#type' => 'styles', - '#items' => $css, - ); - - if (!empty($setting)) { - $styles['#attached']['js'][] = array('type' => 'setting', 'data' => $setting); - } - - return $styles; -} - -/** - * Get full JS array. - * - * Note that hook_js_alter(&$javascript) is called during this function call - * to allow alterations of the JavaScript during its presentation. Calls to - * drupal_add_js() from hook_js_alter() will not be added to the output - * presentation. The correct way to add JavaScript during hook_js_alter() - * is to add another element to the $javascript array, deriving from - * drupal_js_defaults(). See locale_js_alter() for an example of this. - * - * @param array $javascript - * (optional) An array with all JavaScript code. Defaults to the default - * JavaScript array for the given scope. - * @param bool $skip_alter - * (optional) If set to TRUE, this function skips calling drupal_alter() on - * $javascript, useful when the calling function passes a $javascript array - * that has already been altered. - * - * @return array - * The raw JavaScript array. - * - * @see drupal_add_js() - * @see locale_js_alter() - * @see drupal_js_defaults() - */ -function advagg_get_full_js(array $javascript = array(), $skip_alter = FALSE) { - if (empty($javascript)) { - $javascript = drupal_add_js(); - } - - // Return an empty array if - // no javascript is used, - // only the settings array is used and scope is header. - if (empty($javascript) - || (isset($javascript['settings']) && count($javascript) == 1) - ) { - return array(); - } - - // Allow modules to alter the JavaScript. - if (!$skip_alter) { - advagg_add_default_dns_lookups($javascript, 'js'); - if (is_callable('advagg_mod_js_pre_alter')) { - advagg_mod_js_pre_alter($javascript); - } - // Call hook_js_alter(). - drupal_alter('js', $javascript); - // Call hook_js_post_alter(). - drupal_alter('js_post', $javascript); - // Call these advagg functions after the hook_js_alter was called. - advagg_fix_type($javascript, 'js'); - } - elseif (is_callable('advagg_mod_js_move_to_footer')) { - if (variable_get('advagg_mod_js_footer', ADVAGG_MOD_JS_FOOTER) == 3) { - advagg_mod_js_move_to_footer($javascript); - } - } - - // If in development mode make sure the ajaxPageState css is there. - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - $have_css = FALSE; - foreach ($javascript['settings']['data'] as $setting) { - if (!empty($setting['ajaxPageState']['css'])) { - $have_css = TRUE; - break; - } - } - if (!$have_css) { - $css = drupal_add_css(); - if (!empty($css)) { - // Cast the array to an object to be on the safe side even if not empty. - $javascript['settings']['data'][]['ajaxPageState']['css'] = (object) array_fill_keys(array_keys($css), 1); - } - } - } - - // Remove empty files. - advagg_remove_empty_files($javascript); - - return $javascript; -} - -/** - * Returns a themed presentation of all JavaScript code for the current page. - * - * References to JavaScript files are placed in a certain order: first, all - * 'core' files, then all 'module' and finally all 'theme' JavaScript files - * are added to the page. Then, all settings are output, followed by 'inline' - * JavaScript code. If running update.php, all preprocessing is disabled. - * - * Note that hook_js_alter(&$javascript) is called during this function call - * to allow alterations of the JavaScript during its presentation. Calls to - * drupal_add_js() from hook_js_alter() will not be added to the output - * presentation. The correct way to add JavaScript during hook_js_alter() - * is to add another element to the $javascript array, deriving from - * drupal_js_defaults(). See locale_js_alter() for an example of this. - * - * @param string $scope - * (optional) The scope for which the JavaScript rules should be returned. - * Defaults to 'header'. - * @param array $javascript - * (optional) An array with all JavaScript code. Defaults to the default - * JavaScript array for the given scope. - * @param bool $ajax - * (optional) If set to TRUE, this function will not output Drupal.settings. - * - * @return array - * An array ready to be passed into drupal_render() containing all JavaScript - * code segments and includes for the scope as HTML tags. - * - * @see drupal_add_js() - * @see locale_js_alter() - * @see drupal_js_defaults() - */ -function advagg_get_js($scope = 'header', array $javascript = array(), $ajax = FALSE) { - // Keep track of js added for ajaxPageState. - $page_state = &drupal_static(__FUNCTION__, array()); - - // Add in javascript if none was passed in. - if (empty($javascript) && !$ajax) { - $javascript = advagg_get_full_js(); - } - - // Return an empty array if no javascript is used. - if (empty($javascript)) { - return array(); - } - - // Filter out elements of the given scope. - $items = array(); - foreach ($javascript as $key => $item) { - if (!empty($item['scope']) && $item['scope'] === $scope) { - $items[$key] = $item; - } - } - - // Sort the JavaScript so that it appears in the correct order. - advagg_drupal_sort_css_js_stable($items); - - // In Drupal 8, there's a JS_SETTING group for making setting variables - // appear last after libraries have loaded. In Drupal 7, this is forced - // without that group. We do not use the $key => $item type of iteration, - // because PHP uses an internal array pointer for that, and we're modifying - // the array order inside the loop. - if ($scope === 'footer' && !empty($items['settings'])) { - // Remove settings array from items. - $settings_js['settings'] = $items['settings']; - unset($items['settings']); - - // Move $settings_js to the bottom of the js that was added to the - // header, but has now been moved to the footer via advagg_mod. - $counter = 0; - foreach ($items as $key => $item) { - if ($item['group'] > 9000) { - advagg_array_splice_assoc($items, $counter, 0, $settings_js); - unset($settings_js); - break; - } - ++$counter; - } - // Nothing in the footer, add settings to the bottom of the array. - if (isset($settings_js)) { - $items = array_merge($items, $settings_js); - } - } - else { - foreach (array_keys($items) as $key) { - if ($items[$key]['type'] === 'setting') { - $item = $items[$key]; - unset($items[$key]); - $items[$key] = $item; - } - } - } - - // Provide the page with information about the individual JavaScript files - // used, information not otherwise available when aggregation is enabled. - $page_state = array_merge($page_state, array_fill_keys(array_keys($items), 1)); - - // If we're outputting the header scope, then this should be the final time - // that drupal_get_js() is running, so add the setting to this output as well - // as to the drupal_add_js() cache. If $items['settings'] doesn't exist, it's - // because drupal_get_js() was intentionally passed a $javascript argument - // stripped of settings, potentially in order to override how settings get - // output, so in this case, do not add the setting to this output. - // Also output the settings if we have pushed all javascript to the footer. - if (isset($items['settings'])) { - $items['settings']['data'][] = array( - 'ajaxPageState' => array( - 'js' => $page_state, - ), - ); - } - - // Do not include jQuery.extend(Drupal.settings) if the output is ajax. - if ($ajax) { - unset($items['settings']['data']); - } - - // Semi support of the attributes array. - foreach ($items as $key => $item) { - if (!isset($item['attributes'])) { - continue; - } - if (isset($item['attributes']['defer'])) { - $items[$key]['defer'] = $item['attributes']['defer']; - } - if (isset($item['attributes']['async'])) { - $items[$key]['async'] = $item['attributes']['async']; - } - if (isset($item['attributes']['onload'])) { - $items[$key]['onload'] = $item['attributes']['onload']; - } - if (isset($item['attributes']['onerror'])) { - $items[$key]['onerror'] = $item['attributes']['onerror']; - } - } - - // Render the HTML needed to load the JavaScript. - $elements = array( - '#type' => 'scripts', - '#items' => $items, - ); - - // Aurora and Omega themes uses alter without checking previous value. - if (variable_get('advagg_enforce_scripts_callback', TRUE)) { - // Get the element_info for scripts. - $scripts = element_info('scripts'); - if (empty($scripts) || $scripts['#aggregate_callback'] !== '_advagg_aggregate_js') { - // Directly alter the static. - $element_info = &drupal_static('element_info'); - advagg_element_info_alter($element_info); - if (function_exists('advagg_mod_element_info_alter')) { - advagg_mod_element_info_alter($element_info); - } - } - } - - // Remove ajaxPageState CSS/JS from Drupal.settings if ajax.js is not used. - if (function_exists('advagg_mod_js_no_ajaxpagestate')) { - if (variable_get('advagg_mod_js_no_ajaxpagestate', ADVAGG_MOD_JS_NO_AJAXPAGESTATE)) { - advagg_mod_js_no_ajaxpagestate($elements); - } - } - return $elements; -} - -/** - * Remove a portion of the array and replace it with something else. - * - * @param array $input - * The input array. - * @param int $offset - * If offset is positive then the start of removed portion is at that offset - * from the beginning of the input array. If offset is negative then it starts - * that far from the end of the input array. - * @param int $length - * If length is omitted, removes everything from offset to the end of the - * array. If length is specified and is positive, then that many elements will - * be removed. If length is specified and is negative then the end of the - * removed portion will be that many elements from the end of the array. Tip: - * to remove everything from offset to the end of the array when replacement - * is also specified, use count($input) for length. - * @param mixed $replacement - * If replacement array is specified, then the removed elements are replaced - * with elements from this array. - * If offset and length are such that nothing is removed, then the elements - * from the replacement array are inserted in the place specified by the - * offset. Note that keys in replacement array are preserved. - * If replacement is just one element it is not necessary to put array() - * around it, unless the element is an array itself, an object or NULL. - * - * @see http://php.net/array-splice#111204 - */ -function advagg_array_splice_assoc(array &$input, $offset, $length, $replacement) { - $replacement = (array) $replacement; - $key_indices = array_flip(array_keys($input)); - if (isset($input[$offset]) && is_string($offset)) { - $offset = $key_indices[$offset]; - } - if (isset($input[$length]) && is_string($length)) { - $length = $key_indices[$length] - $offset; - } - - $input = array_slice($input, 0, $offset, TRUE) + $replacement + array_slice($input, $offset + $length, NULL, TRUE); -} - -/** - * Callback for array_filter. Will return FALSE if strlen < 3. - * - * @param string $value - * A value from an array/object. - * @param int $min_len - * The strlen check length. - * - * @return bool - * TRUE or FALSE. - */ -function advagg_remove_short_keys($value, $min_len = 3) { - if (strlen($value) < $min_len) { - return TRUE; - } - else { - return FALSE; - } -} - -/** - * Get all javascript scopes set in the $javascript array. - * - * @param array $javascript - * An array with all JavaScript code. - * - * @return array - * Array of scopes that are currently being used. - */ -function advagg_get_js_scopes(array $javascript) { - // Return if nothing given to us. - if (empty($javascript)) { - return array(); - } - - // Filter out elements of the given scope. - $scopes = array(); - $js_settings_in_footer = FALSE; - foreach ($javascript as $name => $item) { - // Skip if the scope is not set. - if (!is_array($item) || empty($item['scope'])) { - continue; - } - if (!isset($scopes[$item['scope']])) { - $scopes[$item['scope']] = TRUE; - } - if ($name === 'settings' && $item['scope'] === 'footer') { - $js_settings_in_footer = TRUE; - } - } - - // Default to header if nothing found. - if (empty($scopes)) { - $scopes['header'] = TRUE; - } - - // Process header last. - if (isset($scopes['header']) && count($scopes) > 1) { - $temp = $scopes['header']; - unset($scopes['header']); - $scopes['header'] = $temp; - } - - // Process footer last if everything has been moved to the footer. - if (isset($scopes['footer']) - && count($scopes) > 1 - && $js_settings_in_footer - ) { - $temp = $scopes['footer']; - unset($scopes['footer']); - $scopes['footer'] = $temp; - } - - // Return the scopes. - return $scopes; -} - -/** - * Apply the advagg changes to the $css_js_groups array. - * - * @param array $css_js_groups - * An array of CSS or JS groups as returned by drupal_group_css/js(). - * @param array $plans - * An array of changes to do to the $css_js_groups array. - * - * @return array - * New version of $css_js_groups. - */ -function advagg_merge_plans(array $css_js_groups, array $plans) { - $used_keys = array(); - foreach ($plans as $plan) { - $plan_added = FALSE; - foreach ($css_js_groups as $key => $group) { - // Remove files from the old css/js array. - $file_removed = FALSE; - foreach ($css_js_groups[$key]['items'] as $k => $values) { - if (is_array($values) - && array_key_exists('data', $values) - && is_array($plan['items']['files']) - && is_string($values['data']) - ) { - // If the CSS is a split file, the first file is very meaningful, and - // is probably the only file. - $first_file = reset($plan['items']['files']); - if (array_key_exists($values['data'], $plan['items']['files'])) { - unset($css_js_groups[$key]['items'][$k]); - $file_removed = TRUE; - } - // This part will try to add each split part matching the original CSS - // path and only remove the original group if the current part is the - // last part. - elseif (!empty($first_file['split'])) { - if ($values['data'] == $first_file['split_original']) { - if (!empty($first_file['split_last_part'])) { - unset($css_js_groups[$key]['items'][$k]); - } - $file_removed = TRUE; - } - } - } - } - - // Replace first file of the old css/js array with one from advagg. - if ($file_removed && !$plan_added) { - $step = 0; - do { - ++$step; - $insert_key = '' . floatval($key) . '.' . sprintf('%03d', $step); - } while (array_key_exists($insert_key, $css_js_groups)); - $css_js_groups[(string) $insert_key] = $plan; - $plan_added = TRUE; - } - } - - // Remove old css/js grouping if no files are left in it. - foreach ($css_js_groups as $key => $group) { - if (empty($css_js_groups[$key]['items'])) { - unset($css_js_groups[$key]); - } - } - - if (!$plan_added) { - foreach ($css_js_groups as $key => $group) { - if (empty($group['items']['aggregate_filenames_hash']) - || $group['items']['aggregate_filenames_hash'] != $plan['items']['aggregate_filenames_hash'] - || empty($group['items']['aggregate_contents_hash']) - || $group['items']['aggregate_contents_hash'] != $plan['items']['aggregate_contents_hash'] - ) { - continue; - } - - // Insert a unique key. - do { - $key = '' . (floatval($key) + 0.01); - } while (array_key_exists((string) $key, $css_js_groups) || array_key_exists((string) $key, $used_keys)); - $used_keys[(string) $key] = TRUE; - $css_js_groups[(string) $key] = $plan; - $plan_added = TRUE; - break; - } - } - - } - - // Key sort and normalize the array before returning it. - ksort($css_js_groups); - $css_js_groups = array_values($css_js_groups); - return $css_js_groups; -} - -/** - * Function used to see if aggregation is enabled. - * - * @return bool - * The value of the advagg_enabled variable. - */ -function advagg_enabled() { - $init = &drupal_static(__FUNCTION__); - - if (!empty($init)) { - return variable_get('advagg_enabled', ADVAGG_ENABLED); - } - - // Set base_path if not set. - if (empty($GLOBALS['base_path'])) { - $GLOBALS['base_path'] = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/') . '/'; - } - - $init = TRUE; - // Disable AdvAgg if module needs to be upgraded from 1.x to 2.x. - if (variable_get('advagg_needs_update', ADVAGG_NEEDS_UPDATE)) { - if (!db_table_exists('advagg_aggregates_versions')) { - $GLOBALS['conf']['advagg_enabled'] = FALSE; - if (user_access('administer site configuration')) { - drupal_set_message(t('Please run database updates. AdvAgg will remain disabled until done.', array('@link' => url('update.php'))), 'error'); - } - } - else { - variable_del('advagg_needs_update'); - } - } - else { - // Get values and fill in defaults if needed. - $config_path = advagg_admin_config_root_path(); - $current_path = current_path(); - $arg = arg(); - $arg += array(1 => '', 2 => '', 3 => '', 4 => '', 5 => ''); - $admin_theme = variable_get('admin_theme'); - - // List of all the pages which will not have Advanced Aggregator enabled. - $list_of_pages = variable_get('advagg_disable_on_listed_pages'); - - $pages = trim(drupal_strtolower($list_of_pages)); - // Convert the Drupal path to lowercase. - $path = drupal_strtolower(drupal_get_path_alias(current_path())); - - // Compare the lowercase internal and lowercase path alias (if any). - $page_match = drupal_match_path($path, $pages); - if ($page_match) { - $GLOBALS['conf']['advagg_enabled'] = FALSE; - $GLOBALS['conf']['preprocess_css'] = FALSE; - $GLOBALS['conf']['preprocess_js'] = FALSE; - } - - // Disable advagg if on admin page and configured to do so. - // AND theme is admin theme - // AND NOT /admin/reports/status - // AND NOT /admin/config/development/performance/. - // AND NOT /admin/appearance/settings/*. - // AND NOT /admin/config/development/performance/advagg/*. - if (variable_get('advagg_disable_on_admin', ADVAGG_DISABLE_ON_ADMIN) - && $GLOBALS['theme'] === $admin_theme - && path_is_admin($current_path) - && !($arg[1] === 'reports' && $arg[2] === 'status') - && !($arg[2] === 'development' && $arg[3] === 'performance' && empty($arg[4])) - && !($arg[1] === 'appearance' && $arg[2] === 'settings' && !empty($arg[3])) - && stripos($current_path, $config_path . '/advagg') !== 0 - ) { - $GLOBALS['conf']['advagg_enabled'] = FALSE; - $GLOBALS['conf']['preprocess_css'] = FALSE; - $GLOBALS['conf']['preprocess_js'] = FALSE; - } - - // Check if the advagg cookie is set. - $cookie_name = 'AdvAggDisabled'; - $bypass_cookie = FALSE; - $key = drupal_hmac_base64('advagg_cookie', drupal_get_private_key() . drupal_get_hash_salt() . variable_get('cron_key', 'drupal')); - if (!empty($_COOKIE[$cookie_name]) && $_COOKIE[$cookie_name] == $key) { - $bypass_cookie = TRUE; - } - - // Allow for AdvAgg to be enabled per request. - if (isset($_GET['advagg']) - && $_GET['advagg'] == 1 - && !defined('MAINTENANCE_MODE') - && (user_access('bypass advanced aggregation') || $bypass_cookie) - ) { - $GLOBALS['conf']['advagg_enabled'] = TRUE; - $GLOBALS['conf']['preprocess_css'] = TRUE; - $GLOBALS['conf']['preprocess_js'] = TRUE; - } - - // Disable AdvAgg if maintenance mode is defined. - if (defined('MAINTENANCE_MODE')) { - $GLOBALS['conf']['advagg_enabled'] = FALSE; - } - // Only run code below if advagg is enabled. - if (variable_get('advagg_enabled', ADVAGG_ENABLED)) { - // Do not use AdvAgg or preprocessing functions if the disable cookie is - // set. - if ($bypass_cookie && !isset($_GET['advagg'])) { - $GLOBALS['conf']['advagg_enabled'] = FALSE; - $GLOBALS['conf']['preprocess_css'] = FALSE; - $GLOBALS['conf']['preprocess_js'] = FALSE; - $bypass_cookie = TRUE; - - // Let the user know that the AdvAgg bypass cookie is currently set. - static $msg_set; - if (!isset($msg_set) && variable_get('advagg_show_bypass_cookie_message', ADVAGG_SHOW_BYPASS_COOKIE_MESSAGE)) { - $msg_set = TRUE; - if (user_access('administer site configuration')) { - drupal_set_message(t('The AdvAgg bypass cookie is currently enabled. Turn it off by going to the AdvAgg Operations page and clicking the Toggle the "aggregation bypass cookie" for this browser button.', array( - '@advagg_operations' => url(advagg_admin_config_root_path() . '/advagg/operations', array('fragment' => 'edit-bypass')), - ))); - } - else { - drupal_set_message(t('The AdvAgg bypass cookie is currently enabled. Turn it off by logging in with a user with the "administer site configuration" permissions and going to the AdvAgg Operations page (located at @advagg_operations) and clicking the Toggle the "aggregation bypass cookie" for this browser button.', array( - '@login' => 'user/login', - '@advagg_operations' => advagg_admin_config_root_path() . '/advagg/operations', - ))); - } - } - } - // Disable advagg if requested. - if (isset($_GET['advagg']) - && $_GET['advagg'] == -1 - && (user_access('bypass advanced aggregation') || $bypass_cookie) - ) { - $GLOBALS['conf']['advagg_enabled'] = FALSE; - $GLOBALS['conf']['preprocess_css'] = FALSE; - $GLOBALS['conf']['preprocess_js'] = FALSE; - } - // Disable core preprocessing if requested. - if (isset($_GET['advagg-core']) - && $_GET['advagg-core'] == 0 - && (user_access('bypass advanced aggregation') || $bypass_cookie) - ) { - $GLOBALS['conf']['preprocess_css'] = FALSE; - $GLOBALS['conf']['preprocess_js'] = FALSE; - } - // Enable core preprocessing if requested. - if (isset($_GET['advagg-core']) - && $_GET['advagg-core'] == 1 - && (user_access('bypass advanced aggregation') || $bypass_cookie) - ) { - $GLOBALS['conf']['preprocess_css'] = TRUE; - $GLOBALS['conf']['preprocess_js'] = TRUE; - } - // Enable debugging if requested. - if (isset($_GET['advagg-debug']) - && (user_access('bypass advanced aggregation') || $bypass_cookie) - ) { - // Cast to an int. - $GLOBALS['conf']['advagg_debug'] = (int) $_GET['advagg-debug']; - } - } - } - - return variable_get('advagg_enabled', ADVAGG_ENABLED); -} - -/** - * Get the current path used for advagg admin configuration. - * - * @return string - * Path to root advagg config. - */ -function advagg_admin_config_root_path() { - return variable_get('advagg_admin_config_root_path', ADVAGG_ADMIN_CONFIG_ROOT_PATH); -} - -/** - * Get an array of all hooks and settings that affect aggregated files contents. - * - * @return array - * array('variables' => array(...), 'hooks' => array(...)) - */ -function advagg_current_hooks_hash_array() { - $aggregate_settings = &drupal_static(__FUNCTION__); - if (!empty($aggregate_settings)) { - return $aggregate_settings; - } - list($css_path, $js_path) = advagg_get_root_files_dir(); - - // Put all enabled hooks and settings into a big array. - $aggregate_settings = array( - 'variables' => array( - 'advagg_gzip' => variable_get('advagg_gzip', ADVAGG_GZIP), - 'advagg_brotli' => variable_get('advagg_brotli', ADVAGG_BROTLI), - 'advagg_no_zopfli' => variable_get('advagg_no_zopfli', ADVAGG_NO_ZOPFLI), - 'is_https' => $GLOBALS['is_https'], - 'advagg_global_counter' => advagg_get_global_counter(), - 'base_path' => $GLOBALS['base_path'], - 'advagg_ie_css_selector_limiter' => variable_get('advagg_ie_css_selector_limiter', ADVAGG_IE_CSS_SELECTOR_LIMITER), - 'advagg_ie_css_selector_limiter_value' => variable_get('advagg_ie_css_selector_limiter_value', ADVAGG_IE_CSS_SELECTOR_LIMITER_VALUE), - 'advagg_scripts_scope_anywhere' => variable_get('advagg_scripts_scope_anywhere', ADVAGG_SCRIPTS_SCOPE_ANYWHERE), - 'advagg_devel' => variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0 ? TRUE : FALSE, - 'advagg_convert_absolute_to_relative_path' => variable_get('advagg_convert_absolute_to_relative_path', ADVAGG_CONVERT_ABSOLUTE_TO_RELATIVE_PATH), - 'advagg_convert_absolute_to_protocol_relative_path' => variable_get('advagg_convert_absolute_to_protocol_relative_path', ADVAGG_CONVERT_ABSOLUTE_TO_PROTOCOL_RELATIVE_PATH), - 'advagg_css_absolute_path' => variable_get('advagg_css_absolute_path', ADVAGG_CSS_ABSOLUTE_PATH), - 'advagg_force_https_path' => variable_get('advagg_force_https_path', ADVAGG_FORCE_HTTPS_PATH), - 'advagg_css_dir' => $css_path[0], - 'advagg_js_dir' => $js_path[0], - ), - 'hooks' => advagg_hooks_implemented(FALSE), - ); - // Add in language if locale is enabled. - if (module_exists('locale')) { - $aggregate_settings['variables']['language'] = isset($GLOBALS['language']->language) ? $GLOBALS['language']->language : ''; - } - - // Add the base url if so desired to. - if (variable_get('advagg_include_base_url', ADVAGG_INCLUDE_BASE_URL)) { - $aggregate_settings['variables']['base_url'] = $GLOBALS['base_url']; - } - - // CDN module settings. - // Patch in https://www.drupal.org/node/1942230#comment-7927171 is fine - // on a technical level but I got frustrated with all the reports about it not - // working with no good reason as to why it doesn't work. - if (!function_exists('cdn_advagg_current_hooks_hash_array_alter') && module_exists('cdn')) { - $aggregate_settings['variables'][CDN_MODE_VARIABLE] = variable_get(CDN_MODE_VARIABLE, CDN_MODE_BASIC); - $aggregate_settings['variables'][CDN_BASIC_FARFUTURE_VARIABLE] = variable_get(CDN_BASIC_FARFUTURE_VARIABLE, CDN_BASIC_FARFUTURE_DEFAULT); - $aggregate_settings['variables'][CDN_HTTPS_SUPPORT_VARIABLE] = variable_get(CDN_HTTPS_SUPPORT_VARIABLE, FALSE); - $aggregate_settings['variables'][CDN_STATUS_VARIABLE] = variable_get(CDN_STATUS_VARIABLE, CDN_DISABLED); - $aggregate_settings['variables']['cdn_request_is_https'] = cdn_request_is_https(); - $aggregate_settings['variables']['cdn_check_drupal_path'] = cdn_check_drupal_path($_GET['q']); - } - - // Allow other modules to add in their own settings and hooks. - // Call hook_advagg_current_hooks_hash_array_alter(). - drupal_alter('advagg_current_hooks_hash_array', $aggregate_settings); - - return $aggregate_settings; -} - -/** - * Get the hash of all hooks and settings that affect aggregated files contents. - * - * @return string - * hash value. - */ -function advagg_get_current_hooks_hash() { - $current_hash = &drupal_static(__FUNCTION__); - - if (empty($current_hash)) { - // Get all advagg hooks and variables in use. - $aggregate_settings = advagg_current_hooks_hash_array(); - - // Generate the hash. - $serialize_function = variable_get('advagg_serialize', ADVAGG_SERIALIZE); - $current_hash = drupal_hash_base64($serialize_function($aggregate_settings)); - - // Save into variables for verification purposes later on if not found. - $settings = advagg_get_hash_settings($current_hash); - if (empty($settings)) { - // Save new hash into. - advagg_set_hash_settings($current_hash, $aggregate_settings); - } - } - - return $current_hash; -} - -/** - * Store settings associated with hash. - * - * @param string $hash - * The hash. - * @param array $settings - * The settings associated with this hash. - * - * @return MergeQuery - * value from db_merge - */ -function advagg_set_hash_settings($hash, array $settings = array()) { - return db_merge('advagg_aggregates_hashes') - ->key(array('hash' => $hash)) - ->fields(array( - 'hash' => $hash, - 'settings' => serialize($settings), - )) - ->execute(); -} - -/** - * Get back what hooks are implemented. - * - * @param bool $all - * If TRUE get all hooks related to css/js files. - * if FALSE get only the subset of hooks that alter the filename/contents. - * - * @return array - * List of hooks and what modules have implemented them. - */ -function advagg_hooks_implemented($all = TRUE) { - // Get hooks in use. - $hooks = array( - 'advagg_get_css_file_contents_pre_alter' => array(), - 'advagg_get_css_file_contents_alter' => array(), - 'advagg_get_css_aggregate_contents_alter' => array(), - 'advagg_get_js_file_contents_alter' => array(), - 'advagg_get_js_aggregate_contents_alter' => array(), - 'advagg_save_aggregate_pre_alter' => array(), - 'advagg_save_aggregate_alter' => array(), - 'advagg_current_hooks_hash_array_alter' => array(), - 'advagg_get_root_files_dir_alter' => array(), - 'advagg_context_alter' => array(), - ); - if ($all) { - $hooks += array( - 'advagg_build_aggregate_plans_alter' => array(), - 'advagg_build_aggregate_plans_post_alter' => array(), - 'advagg_changed_files' => array(), - 'advagg_css_groups_alter' => array(), - 'advagg_js_groups_alter' => array(), - 'advagg_modify_css_pre_render_alter' => array(), - 'advagg_modify_js_pre_render_alter' => array(), - 'advagg_get_info_on_files_alter' => array(), - 'advagg_hooks_implemented_alter' => array(), - 'advagg_removed_aggregates' => array(), - 'advagg_scan_for_changes' => array(), - 'advagg_missing_root_file' => array(), - 'js_alter' => array(), - 'css_alter' => array(), - ); - } - // Call hook_advagg_hooks_implemented_alter(). - drupal_alter('advagg_hooks_implemented', $hooks, $all); - - // Cache module_implements as this will load up .inc files. - $serialize_function = variable_get('advagg_serialize', ADVAGG_SERIALIZE); - $cid = 'advagg_hooks_implemented:' . (int) $all . ':' . drupal_hash_base64($serialize_function($hooks)); - $cache = cache_get($cid, 'cache_bootstrap'); - if (!empty($cache->data)) { - $hooks = $cache->data; - } - else { - foreach ($hooks as $hook => $values) { - $hooks[$hook] = module_implements($hook); - - // Also check themes as drupal_alter() allows for themes to alter things. - $theme_keys = array_keys(list_themes()); - if (!empty($theme_keys)) { - foreach ($theme_keys as $theme_key) { - $function = $theme_key . '_' . $hook; - if (function_exists($function)) { - $hooks[$hook][] = $theme_key; - } - } - } - } - cache_set($cid, $hooks, 'cache_bootstrap', CACHE_TEMPORARY); - } - - return $hooks; -} - -/** - * Returns the hashes settings. - * - * @param string $hash - * The name of the variable to return. - * - * @return array - * The settings array or an empty array if not found. - */ -function advagg_get_hash_settings($hash) { - $settings = db_select('advagg_aggregates_hashes', 'aah') - ->fields('aah', array('settings')) - ->condition('hash', $hash) - ->execute() - ->fetchField(); - - return !empty($settings) ? unserialize($settings) : array(); -} - -/** - * Get the CSS and JS path for advagg. - * - * @param bool $reset - * Set to TRUE to reset the static variables. - * - * @return array - * Example return below: - * - * @code - * array( - * array( - * public://advagg_css, - * sites/default/files/advagg_css, - * ), - * array( - * public://advagg_js, - * sites/default/files/advagg_js, - * ), - * ) - * @endcode - */ -function advagg_get_root_files_dir($reset = FALSE) { - $css_paths = &drupal_static(__FUNCTION__ . '_css'); - $js_paths = &drupal_static(__FUNCTION__ . '_js'); - - // Make sure directories are available and writable. - if (empty($css_paths) || empty($js_paths) || $reset) { - // Default is public://. - $prefix = variable_get('advagg_root_dir_prefix', ADVAGG_ROOT_DIR_PREFIX); - $css_paths[0] = $prefix . 'advagg_css'; - $js_paths[0] = $prefix . 'advagg_js'; - - file_prepare_directory($css_paths[0], FILE_CREATE_DIRECTORY); - file_prepare_directory($js_paths[0], FILE_CREATE_DIRECTORY); - - // Set the URI of the directory. - $css_paths[1] = advagg_get_relative_path($css_paths[0], 'css'); - $js_paths[1] = advagg_get_relative_path($js_paths[0], 'js'); - - // If the css or js got a path, use it for the other missing one. - if (empty($css_paths[1]) && !empty($js_paths[1])) { - $css_paths[1] = str_replace('/advagg_js', '/advagg_css', $js_paths[1]); - } - elseif (empty($js_paths[1]) && !empty($css_paths[1])) { - $js_paths[1] = str_replace('/advagg_css', '/advagg_js', $css_paths[1]); - } - - // Fix if empty. - if (empty($css_paths[1])) { - $css_paths[1] = $css_paths[0]; - } - if (empty($js_paths[1])) { - $js_paths[1] = $js_paths[0]; - } - - // Allow other modules to alter css and js paths. - // Call hook_advagg_get_root_files_dir_alter() - drupal_alter('advagg_get_root_files_dir', $css_paths, $js_paths); - } - - return array($css_paths, $js_paths); -} - -/** - * Given a uri, get the relative_path. - * - * @param string $uri - * The uri for the stream wrapper. - * @param string $type - * (Optional) String: css or js. - * - * @return string - * The relative path of the uri. - * - * @see https://www.drupal.org/node/837794#comment-9124435 - */ -function advagg_get_relative_path($uri, $type = '') { - $wrapper = file_stream_wrapper_get_instance_by_uri($uri); - if ($wrapper instanceof DrupalLocalStreamWrapper) { - $relative_path = $wrapper->getDirectoryPath() . '/' . file_uri_target($uri); - } - else { - $relative_path = parse_url(file_create_url($uri), PHP_URL_PATH); - if (empty($relative_path) && !empty($uri)) { - $filename = advagg_generate_advagg_filename_from_db($type); - $relative_path = parse_url(file_create_url("{$uri}/{$filename}"), PHP_URL_PATH); - $end = strpos($relative_path, "/{$filename}"); - if ($end !== FALSE) { - $relative_path = substr($relative_path, 0, $end); - } - } - if (substr($relative_path, 0, strlen($GLOBALS['base_path'])) == $GLOBALS['base_path']) { - $relative_path = substr($relative_path, strlen($GLOBALS['base_path'])); - } - $relative_path = ltrim($relative_path, '/'); - } - return $relative_path; -} - -/** - * Builds the requested CSS/JS aggregates. - * - * @param array $filenames - * Array of AdvAgg filenames to generate. - * @param string $type - * String: css or js. - * - * @return array - * Array keyed by filename, value is result from advagg_missing_create_file(). - */ -function advagg_build_aggregates(array $filenames, $type) { - // Check input values. - if (empty($filenames)) { - return array(); - } - if (empty($type)) { - $filename = reset($filenames); - $type = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); - } - - // Call the file generation function directly. - module_load_include('inc', 'advagg', 'advagg.missing'); - list($css_path, $js_path) = advagg_get_root_files_dir(); - $return = array(); - foreach ($filenames as $filename) { - // Skip if the file exists. - if ($type === 'css') { - $uri = $css_path[0] . '/' . $filename; - } - elseif ($type === 'js') { - $uri = $js_path[0] . '/' . $filename; - } - if (file_exists($uri)) { - continue; - } - - // Only create the file if we have a lock. - $lock_name = 'advagg_' . $filename; - if (variable_get('advagg_no_locks', ADVAGG_NO_LOCKS)) { - $return[$filename] = advagg_missing_create_file($filename); - } - elseif (lock_acquire($lock_name, 10)) { - $return[$filename] = advagg_missing_create_file($filename); - lock_release($lock_name); - } - } - return $return; -} - -/** - * Gets the core CSS/JS included in this ajax request. - * - * Used so core JS can be rendered through the AdvAgg pipeline. - * - * @see ajax_render() - * - * @return array - * Returns an array containing $styles, $scripts_header, $scripts_footer, - * $items, and $settings. - */ -function advagg_build_ajax_js_css() { - $settings = array(); - // Ajax responses aren't rendered with html.tpl.php, so we have to call - // drupal_get_css() and drupal_get_js() here, in order to have new files added - // during this request to be loaded by the page. We only want to send back - // files that the page hasn't already loaded, so we implement simple diffing - // logic using array_diff_key(). - foreach (array('css', 'js') as $type) { - // It is highly suspicious if $_POST['ajax_page_state'][$type] is empty, - // since the base page ought to have at least one JS file and one CSS file - // loaded. It probably indicates an error, and rather than making the page - // reload all of the files, instead we return no new files. - if (empty($_POST['ajax_page_state'][$type])) { - $items[$type] = array(); - $scripts = drupal_add_js(); - if (!empty($scripts['settings'])) { - $settings = $scripts['settings']; - } - } - else { - $function = 'drupal_add_' . $type; - // Get the current css/js needed for this page. - $items[$type] = $function(); - // Call hook_js_alter() OR hook_css_alter(). - drupal_alter($type, $items[$type]); - // @todo Inline CSS and JS items are indexed numerically. These can't be - // reliably diffed with array_diff_key(), since the number can change - // due to factors unrelated to the inline content, so for now, we strip - // the inline items from Ajax responses, and can add support for them - // when drupal_add_css() and drupal_add_js() are changed to use a hash - // of the inline content as the array key. - foreach ($items[$type] as $key => $item) { - if (is_numeric($key)) { - unset($items[$type][$key]); - } - } - // Ensure that the page doesn't reload what it already has. - // @ignore security_17 - $items[$type] = array_diff_key($items[$type], $_POST['ajax_page_state'][$type]); - } - } - - // Render the HTML to load these files, and add AJAX commands to insert this - // HTML in the page. We pass TRUE as the $skip_alter argument to prevent the - // data from being altered again, as we already altered it above. Settings are - // handled separately, afterwards. - $scripts = drupal_add_js(); - if (isset($scripts['settings'])) { - $settings = $scripts['settings']; - unset($items['js']['settings']); - } - - $styles = drupal_get_css($items['css'], TRUE); - $scripts_footer = drupal_get_js('footer', $items['js'], TRUE); - $scripts_header = drupal_get_js('header', $items['js'], TRUE); - return array($styles, $scripts_header, $scripts_footer, $items, $settings); -} - -/** - * Given the type lets us know if advagg is enabled or disabled. - * - * @param string $type - * String: css or js. - * - * @return bool - * TRUE or FALSE. - */ -function advagg_file_aggregation_enabled($type) { - if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE === 'update') { - return FALSE; - } - if (isset($_GET['advagg']) && $_GET['advagg'] == 0 && user_access('bypass advanced aggregation')) { - return FALSE; - } - if ($type === 'css') { - return variable_get('preprocess_css', FALSE); - } - if ($type === 'js') { - return variable_get('preprocess_js', FALSE); - } -} - -/** - * Update atime inside advagg_aggregates_versions and cache_advagg_info. - * - * @param array $files - * List of files in the aggregate as well as the aggregate name. - * - * @return bool - * Return TRUE if anything was written to the database. - */ -function advagg_multi_update_atime(array $files) { - $write_done = FALSE; - $records = array(); - foreach ($files as $values) { - // Create the cache id. - $cid = 'advagg:db:' . $values['aggregate_filenames_hash'] . ADVAGG_SPACE . $values['aggregate_contents_hash']; - // Create the db record. - $records[$cid] = array( - 'aggregate_filenames_hash' => $values['aggregate_filenames_hash'], - 'aggregate_contents_hash' => $values['aggregate_contents_hash'], - 'atime' => REQUEST_TIME, - ); - } - - // Use the cache. - $cids = array_keys($records); - $caches = cache_get_multiple($cids, 'cache_advagg_info'); - if (!empty($caches)) { - foreach ($caches as $cache) { - // See if the atime value needs to be updated. - if (!empty($cache->data['atime']) && $cache->data['atime'] > REQUEST_TIME - (12 * 60 * 60)) { - // If atime is less than 12 hours old, do nothing. - unset($records[$cache->cid]); - } - } - } - if (empty($records)) { - return $write_done; - } - - foreach ($records as $cid => $record) { - // Update atime in DB. - $result = db_merge('advagg_aggregates_versions') - ->key(array( - 'aggregate_filenames_hash' => $record['aggregate_filenames_hash'], - 'aggregate_contents_hash' => $record['aggregate_contents_hash'], - )) - ->fields(array('atime' => $record['atime'])) - ->execute(); - if (!$write_done && $result) { - $write_done = TRUE; - } - - // Update the atime in the cache. - // Get fresh copy of the cache. - $cache = cache_get($cid, 'cache_advagg_info'); - // Set the atime. - if (empty($cache->data)) { - $cache = new stdClass(); - } - $cache->data['atime'] = REQUEST_TIME; - - // Write to the cache. - // CACHE_PERMANENT isn't good here. Use 2 weeks from now + 0-45 days. - // The random 0 to 45 day addition is to prevent a cache stampede. - cache_set($cid, $cache->data, 'cache_advagg_info', round(REQUEST_TIME + 1209600 + mt_rand(0, 3888000), -3)); - } - return $write_done; -} - -/** - * Return the advagg_global_counter variable. - * - * @return int - * Int value. - */ -function advagg_get_global_counter() { - $global_counter = variable_get('advagg_global_counter', ADVAGG_GLOBAL_COUNTER); - - return $global_counter; -} - -/** - * Cache clear callback for admin_menu/flush-cache/advagg. - */ -function advagg_admin_flush_cache() { - module_load_include('inc', 'advagg', 'advagg.admin'); - advagg_admin_flush_cache_button(); -} - -/** - * Returns HTML for a generic HTML tag with attributes. - * - * @param array $variables - * An associative array containing: - * - element: An associative array describing the tag: - * - #tag: The tag name to output. Typical tags added to the HTML HEAD: - * - meta: To provide meta information, such as a page refresh. - * - link: To refer to stylesheets and other contextual information. - * - script: To load JavaScript. - * - #attributes: (optional) An array of HTML attributes to apply to the - * tag. - * - #value: (optional) A string containing tag content, such as inline - * CSS. - * - #value_prefix: (optional) A string to prepend to #value, e.g. a CDATA - * wrapper prefix. - * - #value_suffix: (optional) A string to append to #value, e.g. a CDATA - * wrapper suffix. - */ -function theme_html_script_tag(array $variables) { - $element = $variables['element']; - $attributes = ''; - $onload = ''; - $onerror = ''; - if (isset($element['#attributes'])) { - // On Load. - if (!empty($element['#attributes']['onload'])) { - $onload = $element['#attributes']['onload']; - unset($element['#attributes']['onload']); - } - // On Error. - if (!empty($element['#attributes']['onerror'])) { - $onerror = $element['#attributes']['onerror']; - unset($element['#attributes']['onerror']); - } - $attributes = !empty($element['#attributes']) ? drupal_attributes($element['#attributes']) : ''; - if (!empty($onload)) { - $attributes .= ' onload="' . advagg_jsspecialchars($onload) . '"'; - } - if (!empty($onerror)) { - $attributes .= ' onerror="' . advagg_jsspecialchars($onerror) . '"'; - } - } - - if (!isset($element['#value'])) { - return '<' . $element['#tag'] . $attributes . " />\n"; - } - else { - $output = '<' . $element['#tag'] . $attributes . '>'; - if (isset($element['#value_prefix'])) { - $output .= $element['#value_prefix']; - } - $output .= $element['#value']; - if (isset($element['#value_suffix'])) { - $output .= $element['#value_suffix']; - } - $output .= '\n"; - return $output; - } -} - -/** - * Replace quotes with the html version of it. - * - * @param string $string - * Input string. Convert quotes to html chars. - * - * @return string - * Transformed string. - */ -function advagg_jsspecialchars($string = '') { - $string = str_replace('"', '"', $string); - $string = str_replace("'", ''', $string); - - return $string; -} - -/** - * Callback for pre_render to add elements needed for JavaScript to be rendered. - * - * This function evaluates the aggregation enabled/disabled condition on a group - * by group basis by testing whether an aggregate file has been made for the - * group rather than by testing the site-wide aggregation setting. This allows - * this function to work correctly even if modules have implemented custom - * logic for grouping and aggregating files. - * - * @param array $elements - * A render array containing: - * - #items: The JavaScript items as returned by drupal_add_js() and - * altered by drupal_get_js(). - * - #group_callback: A function to call to group #items. Following - * this function, #aggregate_callback is called to aggregate items within - * the same group into a single file. - * - #aggregate_callback: A function to call to aggregate the items within - * the groups arranged by the #group_callback function. - * - * @return array - * A render array that will render to a string of JavaScript tags. - * - * @see drupal_get_js() - */ -function advagg_pre_render_scripts(array $elements) { - // Don't run it twice. - if (!empty($elements['#groups'])) { - return $elements; - } - - // Group and aggregate the items. - if (isset($elements['#group_callback'])) { - // Call advagg_group_js(). - $elements['#groups'] = $elements['#group_callback']($elements['#items']); - } - if (isset($elements['#aggregate_callback'])) { - // Call _advagg_aggregate_js(). - $elements['#aggregate_callback']($elements['#groups']); - } - - // A dummy query-string is added to filenames, to gain control over - // browser-caching. The string changes on every update or full cache - // flush, forcing browsers to load a new copy of the files, as the - // URL changed. Files that should not be cached (see drupal_add_js()) - // get REQUEST_TIME as query-string instead, to enforce reload on every - // page request. - $default_query_string = variable_get('css_js_query_string', '0'); - - // For inline JavaScript to validate as XHTML, all JavaScript containing - // XHTML needs to be wrapped in CDATA. To make that backwards compatible - // with HTML 4, we need to comment out the CDATA-tag. - $embed_prefix = "\n\n"; - - // Since JavaScript may look for arguments in the URL and act on them, some - // third-party code might require the use of a different query string. - $js_version_string = variable_get('drupal_js_version_query_string', 'v='); - - // Defaults for each SCRIPT element. - $element_defaults = array( - '#type' => 'html_script_tag', - '#tag' => 'script', - '#value' => '', - '#attributes' => array( - 'type' => 'text/javascript', - ), - ); - $hooks = theme_get_registry(FALSE); - if (empty($hooks['html_script_tag'])) { - $element_defaults['#type'] = 'html_tag'; - } - - // Loop through each group. - foreach ($elements['#groups'] as $group) { - // If a group of files has been aggregated into a single file, - // $group['data'] contains the URI of the aggregate file. Add a single - // script element for this file. - if (isset($group['type']) && $group['type'] === 'file' && isset($group['data'])) { - $element = $element_defaults; - $element['#attributes']['src'] = advagg_file_create_url($group['data']) . ($group['cache'] ? '' : '?' . REQUEST_TIME); - $element['#browsers'] = $group['browsers']; - if (!empty($group['defer'])) { - $element['#attributes']['defer'] = 'defer'; - } - if (!empty($group['async'])) { - $element['#attributes']['async'] = 'async'; - } - if (!empty($group['onload'])) { - if (!isset($element['#attributes']['onload'])) { - $element['#attributes']['onload'] = ''; - } - $element['#attributes']['onload'] .= $group['onload']; - } - if (!empty($group['onerror'])) { - if (!isset($element['#attributes']['onerror'])) { - $element['#attributes']['onerror'] = ''; - } - $element['#attributes']['onerror'] .= $group['onerror']; - } - if (!empty($group['attributes'])) { - $element['#attributes'] += $group['attributes']; - } - $elements[] = $element; - } - // For non-file types, and non-aggregated files, add a script element per - // item. - else { - foreach ($group['items'] as $item) { - // Skip if data is empty. - if (empty($item['data'])) { - continue; - } - - // Element properties that do not depend on item type. - $element = $element_defaults; - if (!empty($item['defer'])) { - $element['#attributes']['defer'] = 'defer'; - } - if (!empty($item['async'])) { - $element['#attributes']['async'] = 'async'; - } - if (!empty($item['onload'])) { - if (!isset($element['#attributes']['onload'])) { - $element['#attributes']['onload'] = ''; - } - $element['#attributes']['onload'] .= $item['onload']; - } - if (!empty($item['onerror'])) { - if (!isset($element['#attributes']['onerror'])) { - $element['#attributes']['onerror'] = ''; - } - $element['#attributes']['onerror'] .= $item['onerror']; - } - if (!empty($group['attributes'])) { - $element['#attributes'] += $group['attributes']; - } - $element['#browsers'] = isset($item['browsers']) ? $item['browsers'] : array(); - - // Crude type detection if needed. - if (empty($item['type'])) { - if (is_array($item['data'])) { - $item['type'] = 'setting'; - } - elseif (strpos($item['data'], 'http://') === 0 || strpos($item['data'], 'https://') === 0 || strpos($item['data'], '//') === 0) { - $item['type'] = 'external'; - } - elseif (file_exists(trim($item['data']))) { - $item['type'] = 'file'; - } - else { - $item['type'] = 'inline'; - } - } - // Element properties that depend on item type. - switch ($item['type']) { - case 'setting': - $data = advagg_cleanup_settings_array(drupal_array_merge_deep_array(array_filter($item['data'], 'is_array'))); - $json_data = advagg_json_encode($data); - $element['#value_prefix'] = $embed_prefix; - $element['#value'] = 'jQuery.extend(Drupal.settings, ' . $json_data . ");"; - $element['#value_suffix'] = $embed_suffix; - break; - - case 'inline': - // If a BOM is found, convert the string to UTF-8. - $encoding = advagg_get_encoding_from_bom($item['data']); - if (!empty($encoding)) { - $item['data'] = advagg_convert_to_utf8($item['data'], $encoding); - } - - $element['#value_prefix'] = $embed_prefix; - $element['#value'] = $item['data']; - $element['#value_suffix'] = $embed_suffix; - break; - - case 'file': - $query_string_separator = (strpos($item['data'], '?') !== FALSE) ? '&' : '?'; - $cache_validator = REQUEST_TIME; - if (!empty($item['cache'])) { - $cache_validator = empty($item['version']) ? $default_query_string : $js_version_string . $item['version'];; - } - - $element['#attributes']['src'] = advagg_file_create_url($item['data']) . $query_string_separator . $cache_validator; - break; - - case 'external': - // Convert to protocol relative path. - $file_uri = $item['data']; - if (variable_get('advagg_convert_absolute_to_protocol_relative_path', ADVAGG_CONVERT_ABSOLUTE_TO_PROTOCOL_RELATIVE_PATH)) { - $file_uri = advagg_convert_abs_to_protocol($item['data']); - } - $element['#attributes']['src'] = $file_uri; - break; - } - - $elements[] = $element; - } - } - } - - return $elements; -} - -/** - * Get the prefix and suffix for inline css. - * - * @return array - * An array where the prefix is key 0 and suffix is key 1. - */ -function advagg_get_css_prefix_suffix() { - $embed_prefix = "\n/* */\n"; - return array($embed_prefix, $embed_suffix); -} - -/** - * A #pre_render callback to add elements needed for CSS tags to be rendered. - * - * For production websites, LINK tags are preferable to STYLE tags with @import - * statements, because: - * - They are the standard tag intended for linking to a resource. - * - On Firefox 2 and perhaps other browsers, CSS files included with @import - * statements don't get saved when saving the complete web page for offline - * use: http://drupal.org/node/145218. - * - On IE, if only LINK tags and no @import statements are used, all the CSS - * files are downloaded in parallel, resulting in faster page load, but if - * the @import statements are used and span across multiple STYLE tags, all - * the ones from 1 STYLE tag must be downloaded before downloading begins for - * the next STYLE tag. Furthermore, IE7 does not support media declaration on - * the @import statement, so multiple STYLE tags must be used when different - * files are for different media types. Non-IE browsers always download in - * parallel, so this is an IE-specific performance quirk: - * http://www.stevesouders.com/blog/2009/04/09/dont-use-import/. - * - * However, IE has an annoying limit of 31 total CSS inclusion tags - * (http://drupal.org/node/228818) and LINK tags are limited to one file per - * tag, whereas STYLE tags can contain multiple @import statements allowing - * multiple files to be loaded per tag. When CSS aggregation is disabled, a - * Drupal site can easily have more than 31 CSS files that need to be loaded, so - * using LINK tags exclusively would result in a site that would display - * incorrectly in IE. Depending on different needs, different strategies can be - * employed to decide when to use LINK tags and when to use STYLE tags. - * - * The strategy employed by this function is to use LINK tags for all aggregate - * files and for all files that cannot be aggregated (e.g., if 'preprocess' is - * set to FALSE or the type is 'external'), and to use STYLE tags for groups - * of files that could be aggregated together but aren't (e.g., if the site-wide - * aggregation setting is disabled). This results in all LINK tags when - * aggregation is enabled, a guarantee that as many or only slightly more tags - * are used with aggregation disabled than enabled (so that if the limit were to - * be crossed with aggregation enabled, the site developer would also notice the - * problem while aggregation is disabled), and an easy way for a developer to - * view HTML source while aggregation is disabled and know what files will be - * aggregated together when aggregation becomes enabled. - * - * This function evaluates the aggregation enabled/disabled condition on a group - * by group basis by testing whether an aggregate file has been made for the - * group rather than by testing the site-wide aggregation setting. This allows - * this function to work correctly even if modules have implemented custom - * logic for grouping and aggregating files. - * - * @param array $elements - * A render array containing: - * - '#items': The CSS items as returned by drupal_add_css() and altered by - * drupal_get_css(). - * - '#group_callback': A function to call to group #items to enable the use - * of fewer tags by aggregating files and/or using multiple @import - * statements within a single tag. - * - '#aggregate_callback': A function to call to aggregate the items within - * the groups arranged by the #group_callback function. - * - * @return array - * A render array that will render to a string of XHTML CSS tags. - * - * @see drupal_get_css() - */ -function advagg_pre_render_styles(array $elements) { - // Skip if advagg is disabled. - if (!advagg_enabled()) { - return drupal_pre_render_styles($elements); - } - - // Don't run it twice. - if (!empty($elements['#groups'])) { - return $elements; - } - - // Group and aggregate the items. - if (isset($elements['#group_callback'])) { - // Call drupal_group_css(). - $elements['#groups'] = $elements['#group_callback']($elements['#items']); - } - if (isset($elements['#aggregate_callback'])) { - // Call _advagg_aggregate_css(). - $elements['#aggregate_callback']($elements['#groups']); - } - - // A dummy query-string is added to filenames, to gain control over - // browser-caching. The string changes on every update or full cache - // flush, forcing browsers to load a new copy of the files, as the - // URL changed. - $query_string = variable_get('css_js_query_string', '0'); - - // For inline CSS to validate as XHTML, all CSS containing XHTML needs to be - // wrapped in CDATA. To make that backwards compatible with HTML 4, we need to - // comment out the CDATA-tag. - // @see https://www.drupal.org/node/1021622 - list($embed_prefix, $embed_suffix) = advagg_get_css_prefix_suffix(); - - // Defaults for LINK and STYLE elements. - $link_element_defaults = array( - '#type' => 'html_tag', - '#tag' => 'link', - '#attributes' => array( - 'type' => 'text/css', - 'rel' => 'stylesheet', - ), - ); - $style_element_defaults = array( - '#type' => 'html_tag', - '#tag' => 'style', - '#attributes' => array( - 'type' => 'text/css', - ), - ); - - // Loop through each group. - foreach ($elements['#groups'] as $group) { - switch ($group['type']) { - // For file items, there are three possibilities. - // - The group has been aggregated: in this case, output a LINK tag for - // the aggregate file. - // - The group can be aggregated but has not been (most likely because - // the site administrator disabled the site-wide setting): in this case, - // output as few STYLE tags for the group as possible, using @import - // statement for each file in the group. This enables us to stay within - // IE's limit of 31 total CSS inclusion tags. - // - The group contains items not eligible for aggregation (their - // 'preprocess' flag has been set to FALSE): in this case, output a LINK - // tag for each file. - case 'file': - // The group has been aggregated into a single file: output a LINK tag - // for the aggregate file. - if (isset($group['data'])) { - $element = $link_element_defaults; - $element['#attributes']['href'] = advagg_file_create_url($group['data']); - $element['#attributes']['media'] = $group['media']; - $element['#browsers'] = $group['browsers']; - if (!empty($group['attributes'])) { - $element['#attributes'] += $group['attributes']; - } - $elements[] = $element; - } - // The group can be aggregated, but hasn't been: combine multiple items - // into as few STYLE tags as possible. - elseif ($group['preprocess']) { - $import = array(); - foreach ($group['items'] as $item) { - // A theme's .info file may have an entry for a file that doesn't - // exist as a way of overriding a module or base theme CSS file from - // being added to the page. Normally, file_exists() calls that need - // to run for every page request should be minimized, but this one - // is okay, because it only runs when CSS aggregation is disabled. - // On a server under heavy enough load that file_exists() calls need - // to be minimized, CSS aggregation should be enabled, in which case - // this code is not run. When aggregation is enabled, - // drupal_load_stylesheet() checks file_exists(), but only when - // building the aggregate file, which is then reused for many page - // requests. - if (file_exists($item['data'])) { - // The dummy query string needs to be added to the URL to control - // browser-caching. IE7 does not support a media type on the - // "@import" statement, so we instead specify the media for the - // group on the STYLE tag. - $import[] = '@import url("' . check_plain(advagg_file_create_url($item['data']) . '?' . $query_string) . '");'; - } - } - // In addition to IE's limit of 31 total CSS inclusion tags, it also - // has a limit of 31 @import statements per STYLE tag. - while (!empty($import)) { - $import_batch = array_slice($import, 0, 31); - $import = array_slice($import, 31); - $element = $style_element_defaults; - // This simplifies the JavaScript regex, allowing each line - // (separated by \n) to be treated as a completely different string. - // This means that we can use ^ and $ on one line at a time, and not - // worry about style tags since they'll never match the regex. - $element['#value'] = "\n" . implode("\n", $import_batch) . "\n"; - $element['#attributes']['media'] = $group['media']; - $element['#browsers'] = $group['browsers']; - if (!empty($group['attributes'])) { - $element['#attributes'] += $group['attributes']; - } - $elements[] = $element; - } - } - // The group contains items ineligible for aggregation: output a LINK - // tag for each file. - else { - foreach ($group['items'] as $item) { - $element = $link_element_defaults; - // We do not check file_exists() here, because this code runs for - // files whose 'preprocess' is set to FALSE, and therefore, even - // when aggregation is enabled, and we want to avoid needlessly - // taxing a server that may be under heavy load. The file_exists() - // performed above for files whose 'preprocess' is TRUE is done for - // the benefit of theme .info files, but code that deals with files - // whose 'preprocess' is FALSE is responsible for ensuring the file - // exists. - // The dummy query string needs to be added to the URL to control - // browser-caching. - $query_string_separator = (strpos($item['data'], '?') !== FALSE) ? '&' : '?'; - $element['#attributes']['href'] = advagg_file_create_url($item['data']) . $query_string_separator . $query_string; - $element['#attributes']['media'] = $item['media']; - $element['#browsers'] = $group['browsers']; - if (!empty($group['attributes'])) { - $element['#attributes'] += $group['attributes']; - } - $elements[] = $element; - } - } - break; - - // For inline content, the 'data' property contains the CSS content. If - // the group's 'data' property is set, then output it in a single STYLE - // tag. Otherwise, output a separate STYLE tag for each item. - case 'inline': - if (isset($group['data'])) { - $element = $style_element_defaults; - $element['#value'] = $group['data']; - $element['#value_prefix'] = $embed_prefix; - $element['#value_suffix'] = $embed_suffix; - $element['#attributes']['media'] = $group['media']; - $element['#browsers'] = $group['browsers']; - if (!empty($group['attributes'])) { - $element['#attributes'] += $group['attributes']; - } - $elements[] = $element; - } - else { - foreach ($group['items'] as $item) { - $element = $style_element_defaults; - $element['#value'] = $item['data']; - $element['#value_prefix'] = $embed_prefix; - $element['#value_suffix'] = $embed_suffix; - $element['#attributes']['media'] = $item['media']; - $element['#browsers'] = $group['browsers']; - if (!empty($group['attributes'])) { - $element['#attributes'] += $group['attributes']; - } - $elements[] = $element; - } - } - break; - - // Output a LINK tag for each external item. The item's 'data' property - // contains the full URL. - case 'external': - foreach ($group['items'] as $item) { - $element = $link_element_defaults; - // Convert to protocol relative path. - $file_uri = $item['data']; - if (variable_get('advagg_convert_absolute_to_protocol_relative_path', ADVAGG_CONVERT_ABSOLUTE_TO_PROTOCOL_RELATIVE_PATH)) { - $file_uri = advagg_convert_abs_to_protocol($item['data']); - } - $element['#attributes']['href'] = $file_uri; - $element['#attributes']['media'] = $item['media']; - $element['#browsers'] = $group['browsers']; - if (!empty($group['attributes'])) { - $element['#attributes'] += $group['attributes']; - } - $elements[] = $element; - } - break; - - } - } - - return $elements; -} - -/** - * Default callback to group JavaScript items. - * - * This function arranges the JavaScript items that are in the #items property - * of the scripts element into groups. When aggregation is enabled, files within - * a group are aggregated into a single file, significantly improving page - * loading performance by minimizing network traffic overhead. - * - * This function puts multiple items into the same group if they are groupable - * and if they are for the same browsers. Items of the 'file' type are groupable - * if their 'preprocess' flag is TRUE. Items of the 'inline', 'settings', or - * 'external' type are not groupable. - * - * This function also ensures that the process of grouping items does not change - * their relative order. This requirement may result in multiple groups for the - * same type and browsers, if needed to accommodate other items in - * between. - * - * @param array $javascript - * An array of JavaScript items, as returned by drupal_add_js(), but after - * alteration performed by drupal_get_js(). - * - * @return array - * An array of JavaScript groups. Each group contains the same keys (e.g., - * 'data', etc.) as a JavaScript item from the $javascript parameter, with the - * value of each key applying to the group as a whole. Each group also - * contains an 'items' key, which is the subset of items from $javascript that - * are in the group. - * - * @see drupal_pre_render_scripts() - */ -function advagg_group_js(array $javascript) { - $groups = array(); - // If a group can contain multiple items, we track the information that must - // be the same for each item in the group, so that when we iterate the next - // item, we can determine if it can be put into the current group, or if a - // new group needs to be made for it. - $current_group_keys = NULL; - $index = -1; - foreach ($javascript as $key => $item) { - if (empty($item)) { - continue; - } - // The browsers for which the JavaScript item needs to be loaded is part of - // the information that determines when a new group is needed, but the order - // of keys in the array doesn't matter, and we don't want a new group if all - // that's different is that order. - if (isset($item['browsers'])) { - ksort($item['browsers']); - } - else { - $item['browsers'] = array(); - } - - // Fix missing types. - if (empty($item['type'])) { - // Setting is easy. - if ($key === 'settings') { - $item['type'] = 'setting'; - } - // Check for the schema or // for protocol-relative. - elseif ((stripos($item['data'], 'http://') === 0 - || stripos($item['data'], 'https://') === 0 - || (strpos($item['data'], '//') === 0 && strpos($item['data'], '///') === FALSE)) - ) { - $item['type'] = 'external'; - } - // See if the data contains a semicolon, new line, $, or quotes. - elseif (strpos($item['data'], ';') !== FALSE - || strpos($item['data'], "\n") - || strpos($item['data'], "$") - || strpos($item['data'], "'") - || strpos($item['data'], '"') - ) { - $item['type'] = 'inline'; - } - // Ends in .js. - elseif (stripos(strrev($item['data']), strrev('.js')) === 0) { - $item['type'] = 'file'; - } - } - - switch ($item['type']) { - case 'file': - // Group file items if their 'preprocess' flag is TRUE. - // Help ensure maximum reuse of aggregate files by only grouping - // together items that share the same 'group' value and 'every_page' - // flag. See drupal_add_js() for details about that. - $group_keys = !empty($item['preprocess']) ? array( - $item['type'], - $item['group'], - $item['every_page'], - $item['browsers'], - ) : FALSE; - break; - - case 'external': - case 'setting': - case 'inline': - // Do not group external, settings, and inline items. - $group_keys = FALSE; - break; - - default: - // Define this here so we don't get undefined alerts down below. - $group_keys = NULL; - // Log the error as well. - watchdog('advagg', 'Bad javascript was added. Type is unknown. @key - @item', array( - '@key' => $key, - '@item' => print_r($item, TRUE), - ), WATCHDOG_NOTICE); - break; - - } - - // If the group keys don't match the most recent group we're working with, - // then a new group must be made. - if ($group_keys !== $current_group_keys) { - ++$index; - // Initialize the new group with the same properties as the first item - // being placed into it. The item's 'data' and 'weight' properties are - // unique to the item and should not be carried over to the group. - $groups[$index] = $item; - unset($groups[$index]['data'], $groups[$index]['weight']); - $groups[$index]['items'] = array(); - $current_group_keys = $group_keys ? $group_keys : NULL; - } - - // Add the item to the current group. - $groups[$index]['items'][] = $item; - } - - return $groups; -} - -/** - * Stable sort for CSS and JS items. - * - * Preserves the order of items with equal sort criteria. - * - * The function will sort by: - * - $item['group'], integer, ascending - * - $item['every_page'], boolean, first TRUE then FALSE - * - $item['weight'], integer, ascending - * - * @param array &$items - * Array of JS or CSS items, as in drupal_add_css() and drupal_add_js(). - * The array keys can be integers or strings. The items themselves are arrays. - * - * @see drupal_get_css() - * @see drupal_get_js() - * @see drupal_add_css() - * @see drupal_add_js() - * @see https://drupal.org/node/1388546 - */ -function advagg_drupal_sort_css_js_stable(array &$items) { - // Within a group, order all infrequently needed, page-specific files after - // common files needed throughout the website. Separating this way allows for - // the aggregate file generated for all of the common files to be reused - // across a site visit without being cut by a page using a less common file. - $nested = array(); - foreach ($items as $key => &$item) { - // If weight is not set, make it 0. - if (!isset($item['weight'])) { - $item['weight'] = 0; - } - // If every_page is not set, make it FALSE. - if (!isset($item['every_page'])) { - $item['every_page'] = FALSE; - } - // If group is not set, make it CSS_DEFAULT/JS_DEFAULT (0). - if (!isset($item['group'])) { - $item['group'] = 0; - } - // If scope is not set, make it header. - if (!isset($item['scope'])) { - $item['scope'] = 'header'; - } - - // Weight cast to string to preserve float. - $weight = (string) $item['weight']; - $nested[$item['group']][$item['every_page'] ? 1 : 0][$weight][$key] = $item; - } - // First order by group, so that, for example, all items in the CSS_SYSTEM - // group appear before items in the CSS_DEFAULT group, which appear before - // all items in the CSS_THEME group. Modules may create additional groups by - // defining their own constants. - $sorted = array(); - // Sort group; then iterate over it. - ksort($nested); - foreach ($nested as &$group_items) { - // Reverse sort every_page; then iterate over it. - krsort($group_items); - foreach ($group_items as &$ep_items) { - // Sort weight; then iterate over it. - ksort($ep_items); - // Finally, order by weight. - foreach ($ep_items as &$weight_items) { - foreach ($weight_items as $key => &$item) { - $sorted[$key] = $item; - } - unset($item); - } - } - unset($ep_items); - } - unset($group_items); - $items = $sorted; -} - -/** - * Converts a PHP variable into its JavaScript equivalent. - * - * @param mixed $data - * Usually an array of data to be converted into a JSON string. - * - * @return string - * If there are no errors, this will return a JSON string. FALSE will be - * returned on failure. - */ -function advagg_json_encode($data) { - // Different versions of PHP handle json_encode() differently. - static $php550; - static $php540; - static $php530; - if (!isset($php550)) { - $php550 = version_compare(PHP_VERSION, '5.5.0', '>='); - } - if (!isset($php540)) { - $php540 = version_compare(PHP_VERSION, '5.4.0', '>='); - } - if (!isset($php530)) { - $php530 = version_compare(PHP_VERSION, '5.3.0', '>='); - } - - // Use fallback drupal encoder if PHP < 5.3.0. - if (!$php530) { - return @drupal_json_encode($data); - } - - // Default json encode options. - $options = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT; - if ($php550 && variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 0) { - // Output partial json if not in development mode and PHP >= 5.5.0. - $options |= JSON_PARTIAL_OUTPUT_ON_ERROR; - } - if ($php540 && variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - // Pretty print JSON if in development mode and PHP >= 5.4.0. - $options |= JSON_PRETTY_PRINT; - } - // Encode to JSON. - $json_data = @json_encode($data, $options); - - // Uses json_last_error() if in development mode. - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - $error_number = json_last_error(); - switch ($error_number) { - case JSON_ERROR_NONE: - $error_message = ''; - break; - - case JSON_ERROR_DEPTH: - $error_message = 'Maximum stack depth exceeded'; - break; - - case JSON_ERROR_STATE_MISMATCH: - $error_message = 'Underflow or the modes mismatch'; - break; - - case JSON_ERROR_CTRL_CHAR: - $error_message = 'Unexpected control character found'; - break; - - case JSON_ERROR_SYNTAX: - $error_message = 'Syntax error, malformed JSON'; - break; - - case JSON_ERROR_UTF8: - $error_message = 'Malformed UTF-8 characters, possibly incorrectly encoded'; - break; - - default: - $error_message = 'Unknown error: ' . $error_number; - break; - } - if (!empty($error_message)) { - if (is_callable('httprl_pr')) { - $pretty_data = httprl_pr($data); - } - elseif (is_callable('kprint_r')) { - // @codingStandardsIgnoreLine - $pretty_data = kprint_r($data, TRUE); - } - else { - $pretty_data = '
' . filter_xss(print_r($data, TRUE)) . '
'; - } - watchdog('advagg_json', 'Error with json encoding the Drupal.settings value. Error Message: %error_message. JSON Data: !data', array( - '%error_message' => $error_message, - '!data' => $pretty_data, - ), WATCHDOG_ERROR); - } - } - return $json_data; -} - -/** - * Will scan, flush, use, and report any changes to css/js files in aggregates. - */ -function advagg_scan_filesystem_for_changes_live() { - static $function_has_ran; - if (isset($function_has_ran)) { - return; - } - $function_has_ran = TRUE; - - $bypass_cookie = FALSE; - $cookie_name = 'AdvAggDisabled'; - $key = drupal_hmac_base64('advagg_cookie', drupal_get_private_key() . drupal_get_hash_salt() . variable_get('cron_key', 'drupal')); - if (!empty($_COOKIE[$cookie_name]) && $_COOKIE[$cookie_name] == $key) { - $bypass_cookie = TRUE; - } - if ((!advagg_enabled() && !$bypass_cookie) || variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) >= 0) { - return; - } - - // Scan for changes to any CSS/JS files. - module_load_include('inc', 'advagg', 'advagg.cache'); - $flushed = advagg_push_new_changes(); - - // Report back the results. - if (empty($flushed) || !user_is_logged_in()) { - return; - } - - list($css_path) = advagg_get_root_files_dir(); - $parts_uri = $css_path[1] . '/parts'; - - foreach ($flushed as $filename => $data) { - if (strpos($filename, $parts_uri) === 0) { - // Do not report on css files manged in the parts directory. - continue; - } - if (variable_get('advagg_show_file_changed_message', ADVAGG_SHOW_FILE_CHANGED_MESSAGE)) { - $ext = pathinfo($filename, PATHINFO_EXTENSION); - drupal_set_message(t('The file %filename has changed. %db_usage aggregates are using this file. %db_count db cache entries and all %type full cache entries have been flushed from the cache bins. Trigger: @changes', array( - '%filename' => $filename, - '%db_usage' => count($data[0]), - '%db_count' => count($data[1]), - '@changes' => print_r($data[2], TRUE), - '%type' => $ext, - ))); - } - } -} - -/** - * Checks if the filename matches the advagg file pattern. - * - * @param string $filename - * Path to check. - * - * @return int - * Returns 1 if the pattern matches, 0 if it does not. - */ -function advagg_match_file_pattern($filename) { - return preg_match('/.*(j|cs)s' . ADVAGG_SPACE . '[A-Za-z0-9-_]{43}' . ADVAGG_SPACE . '[A-Za-z0-9-_]{43}' . ADVAGG_SPACE . '[A-Za-z0-9-_]{43}\.(j|cs)s$/', $filename); -} - -/** - * Converts absolute paths to be self references. - * - * @param string $path - * Path to check. - * @param bool $strip_base_path - * Do no add the base path to the given path if TRUE. - * - * @return string - * The path. - */ -function advagg_convert_abs_to_rel($path, $strip_base_path = FALSE) { - $base_url = $GLOBALS['base_url']; - // Add a slash to end if none is found. - if (strpos(strrev($base_url), '/') !== 0) { - $base_url .= '/'; - } - // Set base path. - $base_path = $GLOBALS['base_path']; - if ($strip_base_path) { - $base_path = ''; - } - - // Do conversion of https and http to self references. - $base_url_https = advagg_force_https_path($base_url); - $path = str_replace($base_url_https, $base_path, $path); - $base_url_http = advagg_force_http_path($base_url); - $path = str_replace($base_url_http, $base_path, $path); - - $base_url = advagg_convert_abs_to_protocol($GLOBALS['base_url']); - // Add a slash to end if none is found. - if (strpos(strrev($base_url), '/') !== 0) { - $base_url .= '/'; - } - // Do conversion of protocol relative to self references. - $path = str_replace($base_url, $base_path, $path); - - return $path; -} - -/** - * Converts absolute paths to be protocol relative paths. - * - * @param string $path - * Path to check. - * - * @return string - * The path. - */ -function advagg_convert_abs_to_protocol($path) { - if (strpos($path, 'http://') === 0) { - $path = substr($path, 5); - } - return $path; -} - -/** - * Convert http:// and // to https://. - * - * @param string $path - * Path to check. - * - * @return string - * The path. - */ -function advagg_force_https_path($path) { - if (strpos($path, 'http://') === 0) { - $path = 'https://' . substr($path, 7); - } - elseif (strpos($path, '//') === 0) { - $path = 'https:' . $path; - } - return $path; -} - -/** - * Convert https:// to http://. - * - * @param string $path - * Path to check. - * - * @return string - * The path. - */ -function advagg_force_http_path($path) { - if (strpos($path, 'https://') === 0) { - $path = 'http://' . substr($path, 8); - } - return $path; -} - -/** - * Wrapper around file_create_url() to do post-processing on the created url. - * - * @param string $path - * Path to check. - * @param array $aggregate_settings - * Array of settings used. - * @param bool $run_file_create_url - * If TRUE then run the given path through file_create_url(). - * @param string $source_type - * CSS or JS; if empty url in not embedded in another file. - * - * @return string - * The file uri. - */ -function advagg_file_create_url($path, array $aggregate_settings = array(), $run_file_create_url = TRUE, $source_type = '') { - $file_uri = $path; - if ($run_file_create_url) { - // This calls hook_file_url_alter(). - $file_uri = file_create_url($path); - } - elseif (strpos($path, '/') !== 0 && !advagg_is_external($path)) { - $file_uri = '/' . $path; - } - // Ideally convert to relative path. - if ((isset($aggregate_settings['variables']['advagg_convert_absolute_to_relative_path']) - && $aggregate_settings['variables']['advagg_convert_absolute_to_relative_path']) - || (!isset($aggregate_settings['variables']['advagg_convert_absolute_to_relative_path']) - && variable_get('advagg_convert_absolute_to_relative_path', ADVAGG_CONVERT_ABSOLUTE_TO_RELATIVE_PATH)) - ) { - $file_uri = advagg_convert_abs_to_rel($file_uri); - } - // Next try protocol relative path. - if ((isset($aggregate_settings['variables']['advagg_convert_absolute_to_protocol_relative_path']) - && $aggregate_settings['variables']['advagg_convert_absolute_to_protocol_relative_path']) - || (!isset($aggregate_settings['variables']['advagg_convert_absolute_to_protocol_relative_path']) - && variable_get('advagg_convert_absolute_to_protocol_relative_path', ADVAGG_CONVERT_ABSOLUTE_TO_PROTOCOL_RELATIVE_PATH)) - ) { - $file_uri = advagg_convert_abs_to_protocol($file_uri); - } - if ($source_type === 'css' - && !advagg_is_external($file_uri) - && ((isset($aggregate_settings['variables']['advagg_css_absolute_path']) - && $aggregate_settings['variables']['advagg_css_absolute_path']) - || (!isset($aggregate_settings['variables']['advagg_css_absolute_path']) - && variable_get('advagg_css_absolute_path', ADVAGG_CSS_ABSOLUTE_PATH))) - ) { - // Get public dir. - list($css_path) = advagg_get_root_files_dir(); - $parsed = parse_url($css_path[0]); - $new_parsed = array(); - if (!empty($parsed['host'])) { - $new_parsed['host'] = $parsed['host']; - } - if (!empty($parsed['path'])) { - $new_parsed['path'] = $parsed['path']; - } - $css_path_0 = advagg_glue_url($new_parsed); - $parsed = parse_url($css_path[1]); - $new_parsed = array(); - if (!empty($parsed['host'])) { - $new_parsed['host'] = $parsed['host']; - } - if (!empty($parsed['path'])) { - $new_parsed['path'] = $parsed['path']; - } - $css_path_1 = advagg_glue_url($new_parsed); - $pos = strpos($css_path_1, $css_path_0); - if (!empty($pos)) { - $public_dir = substr($css_path_1, 0, $pos); - - // If public dir is not in the file uri, use absolute URL. - if (strpos($file_uri, $public_dir) === FALSE) { - $file_uri = url($path, array('absolute' => TRUE)); - } - } - } - // Finally force https. - if ((isset($aggregate_settings['variables']['advagg_force_https_path']) - && $aggregate_settings['variables']['advagg_force_https_path']) - || (!isset($aggregate_settings['variables']['advagg_force_https_path']) - && variable_get('advagg_force_https_path', ADVAGG_FORCE_HTTPS_PATH)) - ) { - $file_uri = advagg_force_https_path($file_uri); - } - return $file_uri; -} - -/** - * Loads the stylesheet and resolves all @import commands. - * - * Loads a stylesheet and replaces @import commands with the contents of the - * imported file. Use this instead of file_get_contents when processing - * stylesheets. - * - * The returned contents are compressed removing white space and comments only - * when CSS aggregation is enabled. This optimization will not apply for - * color.module enabled themes with CSS aggregation turned off. - * - * @param string $file - * Name of the stylesheet to be processed. - * @param bool $optimize - * Defines if CSS contents should be compressed or not. - * @param bool $reset_basepath - * Used internally to facilitate recursive resolution of @import commands. - * - * @return string - * Contents of the stylesheet, including any resolved @import commands. - * - * @see drupal_load_stylesheet() - */ -function advagg_load_stylesheet($file, $optimize = FALSE, $reset_basepath = TRUE, $contents = '') { - // These static's are not cache variables, so we don't use drupal_static(). - static $_optimize, $basepath; - if ($reset_basepath) { - $basepath = ''; - } - // Store the value of $optimize for preg_replace_callback with nested @import - // loops. - if (isset($optimize)) { - $_optimize = $optimize; - } - - // Stylesheets are relative one to each other. Start by adding a base path - // prefix provided by the parent stylesheet (if necessary). - if ($basepath && !file_uri_scheme($file)) { - $file = $basepath . '/' . $file; - } - // Store the parent base path to restore it later. - $parent_base_path = $basepath; - // Set the current base path to process possible child imports. - $basepath = dirname($file); - - // Load the CSS stylesheet. We suppress errors because themes may specify - // stylesheets in their .info file that don't exist in the theme's path, - // but are merely there to disable certain module CSS files. - $content = ''; - if (empty($contents) && !empty($file)) { - $contents = (string) @advagg_file_get_contents($file); - } - if ($contents) { - // Return the processed stylesheet. - $content = advagg_load_stylesheet_content($contents, $_optimize); - } - - // Restore the parent base path as the file and its children are processed. - $basepath = $parent_base_path; - if ($_optimize) { - $content = trim($content); - } - return $content; -} - -/** - * Decodes UTF byte-order mark (BOM) into the encoding's name. - * - * @param string $data - * The data possibly containing a BOM. This can be the entire contents of - * a file, or just a fragment containing at least the first five bytes. - * - * @return string|bool - * The name of the encoding, or FALSE if no byte order mark was present. - * - * @see https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!Unicode.php/function/Unicode%3A%3AencodingFromBOM/8 - */ -function advagg_get_encoding_from_bom($data) { - static $bom_map = array( - "\xEF\xBB\xBF" => 'UTF-8', - "\xFE\xFF" => 'UTF-16BE', - "\xFF\xFE" => 'UTF-16LE', - "\x00\x00\xFE\xFF" => 'UTF-32BE', - "\xFF\xFE\x00\x00" => 'UTF-32LE', - "\x2B\x2F\x76\x38" => 'UTF-7', - "\x2B\x2F\x76\x39" => 'UTF-7', - "\x2B\x2F\x76\x2B" => 'UTF-7', - "\x2B\x2F\x76\x2F" => 'UTF-7', - "\x2B\x2F\x76\x38\x2D" => 'UTF-7', - ); - - foreach ($bom_map as $bom => $encoding) { - if (strpos($data, $bom) === 0) { - return $encoding; - } - } - return FALSE; -} - -/** - * Converts data to UTF-8. - * - * Requires the iconv, GNU recode or mbstring PHP extension. - * - * @param string $data - * The data to be converted. - * @param string $encoding - * The encoding that the data is in. - * - * @return string|bool - * Converted data or FALSE. - */ -function advagg_convert_to_utf8($data, $encoding) { - if (function_exists('iconv')) { - return @iconv($encoding, 'utf-8', $data); - } - elseif (function_exists('mb_convert_encoding')) { - return @mb_convert_encoding($data, 'utf-8', $encoding); - } - elseif (function_exists('recode_string')) { - return @recode_string($encoding . '..utf-8', $data); - } - // Cannot convert. - return FALSE; -} - -/** - * Processes the contents of a stylesheet for aggregation. - * - * @param string $contents - * The contents of the stylesheet. - * @param bool $optimize - * (Optional) Boolean whether CSS contents should be minified. Defaults to - * FALSE. - * - * @return string - * Contents of the stylesheet including the imported stylesheets. - * - * @see drupal_load_stylesheet_content() - */ -function advagg_load_stylesheet_content($contents, $optimize = FALSE) { - // If a BOM is found, convert the file to UTF-8. Used for inline CSS here. - $encoding = advagg_get_encoding_from_bom($contents); - if (!empty($encoding)) { - $contents = advagg_convert_to_utf8($contents, $encoding); - } - - if ($optimize) { - // Perform some safe CSS optimizations. - // Regexp to match comment blocks. - // Regexp to match double quoted strings. - // Regexp to match single quoted strings. - $comment = '/\*[^*]*\*+(?:[^/*][^*]*\*+)*/'; - $double_quot = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"'; - $single_quot = "'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'"; - // Strip all comment blocks, but keep double/single quoted strings. - $contents = preg_replace( - "<($double_quot|$single_quot)|$comment>Ss", - "$1", - $contents - ); - - // Remove certain whitespace. - // There are different conditions for removing leading and trailing - // whitespace. - // @see http://php.net/manual/regexp.reference.subpatterns.php - $contents = preg_replace('< - # Do not strip any space from within single or double quotes - (' . $double_quot . '|' . $single_quot . ') - # Strip leading and trailing whitespace. - | \s*([@{};,])\s* - # Strip only leading whitespace from: - # - Closing parenthesis: Retain "@media (bar) and foo". - | \s+([\)]) - # Strip only trailing whitespace from: - # - Opening parenthesis: Retain "@media (bar) and foo". - # - Colon: Retain :pseudo-selectors. - | ([\(:])\s+ - >xSs', - // Only one of the three capturing groups will match, so its reference - // will contain the wanted value and the references for the - // two non-matching groups will be replaced with empty strings. - '$1$2$3$4', - $contents - ); - // End the file with a new line. - $contents = trim($contents); - $contents .= "\n"; - } - - // Remove multiple charset declarations for standards compliance (and fixing - // Safari problems). - $contents = preg_replace('/^@charset\s+[\'"](\S*?)\b[\'"];/i', '', $contents); - - // Replaces @import commands with the actual stylesheet content. - // This happens recursively but omits external files. - $contents = preg_replace_callback('%@import\s*+(?:url\(\s*+)?+[\'"]?+(?![a-z]++:|/)([^\'"()\s]++)[\'"]?+\s*+\)?+\s*+;%i', '_advagg_load_stylesheet', $contents); - return $contents; -} - -/** - * Loads stylesheets recursively and returns contents with corrected paths. - * - * This function is used for recursive loading of stylesheets and - * returns the stylesheet content with all url() paths corrected. - * - * @param array $matches - * The matches from preg_replace_callback(). - * - * @return array - * String with altered internal url() paths. - * - * @see _drupal_load_stylesheet() - */ -function _advagg_load_stylesheet(array $matches) { - $filename = $matches[1]; - // Load the imported stylesheet and replace @import commands in there as well. - $file = advagg_load_stylesheet($filename, NULL, FALSE); - - if (empty($file)) { - if (strpos($matches[0], 'http://') === 0 - || strpos($matches[0], 'https://') === 0 - || strpos($matches[0], '//') === 0 - ) { - return $matches[0]; - } - if (variable_get('advagg_debug', ADVAGG_DEBUG) >= 2) { - watchdog('advagg-debug', 'Trying to load @file via @import statement but it was not found.', array('@file' => $filename), WATCHDOG_DEBUG); - } - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) <= 1) { - return $matches[0]; - } - else { - return ''; - } - } - - // Determine the file's directory. - $directory = dirname($filename); - // If the file is in the current directory, make sure '.' doesn't appear in - // the url() path. - $directory = $directory == '.' ? '' : $directory . '/'; - - // Alter all internal url() paths. Leave external paths alone. We don't need - // to normalize absolute paths here (i.e. remove folder/... segments) because - // that will be done later. - return preg_replace('%url\(\s*+([\'"]?+)(?![a-z]++:|/)([^\'")]+)([\'"]?+)\s*\)%i', 'url(\1' . $directory . '\2\3)', $file); -} - -/** - * Check and see if the aggressive cache can safely be enabled. - * - * @return array - * If there are no conflicts, this will return an empty array. - */ -function advagg_aggressive_cache_conflicts() { - $hooks = array('css_alter' => TRUE, 'js_alter' => TRUE); - foreach ($hooks as $hook => $values) { - $hooks[$hook] = module_implements($hook); - - // Also check themes as drupal_alter() allows for themes to alter things. - $themes = list_themes(); - $theme_keys = array_keys($themes); - if (!empty($theme_keys)) { - foreach ($theme_keys as $theme_key) { - $function = $theme_key . '_' . $hook; - // Search loaded themes. - if (function_exists($function)) { - $hooks[$hook][] = $theme_key; - continue; - } - // Skip disabled themes. - if (empty($themes[$theme_key]->status)) { - continue; - } - // Search enabled but not loaded themes. - $file = dirname($themes[$theme_key]->filename) . '/template.php'; - if (file_exists($file)) { - $contents = (string) @advagg_file_get_contents($file); - if (stripos($contents, $function)) { - $hooks[$hook][] = $theme_key; - } - } - } - } - } - - $whitelist = array( - // Core. - // - // locale_js_directory variable; default: languages. - // javascript_parsed variable; default: array(). - 'locale', - - // No control; same every time. - 'simpletest', - - // No control; same every time. - 'seven', - - // Popular contrib. - // - // No control; same every time. - 'at_commerce', - - // ais_adaptive_styles variable; Default: array(). - // ais_adaptive_styles_method; Default: 'both-max'. - // 'ais', - // - // No control; same every time. - 'bluecheese', - - // drupal_static('clientside_validation_settings') array. - // 'clientside_validation', - // - // version_compare(VERSION, '7.14', '<'). - 'conditional_fields', - - // _css_injector_load_rule() function. - // Changes the weight of all files added in init so no special handling. - // 'css_injector', - // - // disable_css_ . $theme . _all variable; default: FALSE. - // disable_css_ . $theme . _modules; default: array(). - // disable_css_ . $theme . _files; default: array(). - // 'disable_css', - // - // Empty call; commented code is same every time. - 'elfinder', - - // excluded_css_custom variable; Default: ''. - // excluded_javascript_custom variable; Default: ''. - // 'excluded', - // - // No control; same every time. - 'fences', - - // jqmulti_jquery_path() function. - // jqmulti_get_files() function. - // jqmulti_load_always variable; Default: FALSE. - // 'jqmulti', - // - // No control; same every time. - 'jquery_dollar', - - // labjs_suppress() function. - 'labjs_js', - - // Empty call. - 'panopoly_core', - - // speedy_js_production variable; Default: TRUE. - 'speedy', - - // logintoboggan_validating_id() function. - 'logintoboggan', - ); - // Allow other modules to modify the $whitelist. - // Call hook_advagg_aggressive_cache_conflicts_alter() - drupal_alter('advagg_aggressive_cache_conflicts', $whitelist); - - $questionable_modules = array(); - foreach ($hooks as $hook => $modules) { - foreach ($modules as $key => $module) { - // Anything from advagg is ok. - if (strpos($module, 'advagg') === 0 || strpos($module, '_advagg') === 0) { - unset($modules[$key]); - continue; - } - - // Remove known modules that should work with aggressive caching. - if (in_array($module, $whitelist)) { - unset($modules[$key]); - } - else { - $questionable_modules[$module] = $module; - } - } - } - return $questionable_modules; -} - -/** - * Alt to http_build_url(). - * - * @param array $parsed - * Array from parse_url(). - * @param bool $strip_query_and_fragment - * If set to TRUE the query and fragment will be removed from the output. - * - * @return string - * URI is returned. - * - * @see http://php.net/parse-url#85963 - */ -function advagg_glue_url(array $parsed, $strip_query_and_fragment = FALSE) { - $uri = ''; - if (isset($parsed['scheme'])) { - switch (strtolower($parsed['scheme'])) { - // Mailto uri. - case 'mailto': - $uri .= $parsed['scheme'] . ':'; - break; - - // Protocol relative uri. - case '//': - $uri .= $parsed['scheme']; - break; - - // Standard uri. - default: - $uri .= $parsed['scheme'] . '://'; - } - } - $uri .= isset($parsed['user']) ? $parsed['user'] . (isset($parsed['pass']) ? ':' . $parsed['pass'] : '') . '@' : ''; - $uri .= isset($parsed['host']) ? $parsed['host'] : ''; - $uri .= !empty($parsed['port']) ? ':' . $parsed['port'] : ''; - - if (isset($parsed['path'])) { - $uri .= (substr($parsed['path'], 0, 1) === '/') ? $parsed['path'] : ((!empty($uri) ? '/' : '') . $parsed['path']); - } - - if (!$strip_query_and_fragment) { - $uri .= isset($parsed['query']) ? '?' . $parsed['query'] : ''; - $uri .= isset($parsed['fragment']) ? '#' . $parsed['fragment'] : ''; - } - return $uri; -} - -/** - * Clear certain caches on form submit. - */ -function advagg_cache_clear_admin_submit() { - $cache_bins = advagg_flush_caches(); - foreach ($cache_bins as $bin) { - cache_clear_all('*', $bin, TRUE); - } - cache_clear_all('hook_info', 'cache_bootstrap'); - cache_clear_all('advagg_hooks_implemented:', 'cache_bootstrap', TRUE); -} - -/** - * Get the resource hint settings for the preload attribute. - * - * @param bool $return_defaults - * Default FALSE, TRUE returns the default values. - * - * @return array - * Ordered 2 dimensional array. - */ -function advagg_get_resource_hints_preload_settings($return_defaults = FALSE) { - $sub_defaults = array( - 'enabled' => 1, - 'push' => 0, - 'local' => 1, - 'external' => 1, - ); - // Collect your data. - $advagg_resource_hints_preload_settings_defaults = array( - 'style' => $sub_defaults + array( - '#weight' => -10, - 'title' => t('CSS Files'), - ), - 'font' => $sub_defaults + array( - '#weight' => -9, - 'title' => t('Font Files'), - ), - 'script' => $sub_defaults + array( - '#weight' => -8, - 'title' => t('JS Files'), - ), - 'svg' => $sub_defaults + array( - '#weight' => -7, - 'title' => t('SVG Files'), - ), - 'image' => $sub_defaults + array( - '#weight' => -6, - 'title' => t('Image Files'), - ), - 'all_others' => $sub_defaults + array( - '#weight' => -5, - 'title' => t('All Other Files'), - ), - ); - if ($return_defaults) { - return $advagg_resource_hints_preload_settings_defaults; - } - $advagg_resource_hints_preload_settings = variable_get('advagg_resource_hints_preload_settings', $advagg_resource_hints_preload_settings_defaults); - // Merge in defaults. - foreach ($advagg_resource_hints_preload_settings as $id => &$entry) { - if (isset($advagg_resource_hints_preload_settings_defaults[$id])) { - $entry += $advagg_resource_hints_preload_settings_defaults[$id]; - } - ksort($entry); - } - unset($entry); - // Sort the rows. - uasort($advagg_resource_hints_preload_settings, 'element_sort'); - return $advagg_resource_hints_preload_settings; -} - -/** - * See if the .htaccess file uses the RewriteBase directive. - * - * @param string $location - * The location of the .htaccess file. - * - * @return string - * The last active RewriteBase entry in htaccess. - */ -function advagg_htaccess_rewritebase($location = DRUPAL_ROOT) { - if (is_readable($location . '/.htaccess')) { - $htaccess = advagg_file_get_contents($location . '/.htaccess'); - $matches = array(); - $found = preg_match_all('/\\n\s*RewriteBase\s.*/i', $htaccess, $matches); - if ($found && !empty($matches[0])) { - $matches[0] = array_map('trim', $matches[0]); - return array_pop($matches[0]); - } - } - return ''; -} - -/** - * Get the latest version number for the remote version. - * - * @param array $library - * An associative array containing all information about the library. - * @param array $options - * An associative array containing options for the version parser. - * @param string $url - * URL for the remote version to lookup. - * - * @return string - * The latest version number as a string or 0 on failure. - */ -function advagg_get_github_version_json(array $library, array $options, $url) { - $http_options = array('timeout' => 2); - $package = drupal_http_request($url, $http_options); - if (empty($package->data)) { - // Try again. - $package = drupal_http_request($url, array('timeout' => 5)); - } - if (empty($package->data)) { - // Try again but force http. - $url = advagg_force_http_path($url); - $package = drupal_http_request($url, $http_options); - } - if (!empty($package->data)) { - $package = json_decode($package->data); - if (isset($package->version)) { - return (string) $package->version; - } - } - return 0; -} - -/** - * Get the latest version number for the remote version. - * - * @param array $library - * An associative array containing all information about the library. - * @param array $options - * An associative array containing options for the version parser. - * @param string $url - * URL for the remote version to lookup. - * - * @return string - * The latest version number as a string or 0 on failure. - */ -function advagg_get_github_version_txt(array $library, array $options, $url) { - $http_options = array('timeout' => 2); - $request = drupal_http_request($url, $http_options); - if (empty($request->data)) { - // Try again. - $request = drupal_http_request($url, array('timeout' => 5)); - } - if (empty($request->data)) { - // Try again but force http. - $url = advagg_force_http_path($url); - $request = drupal_http_request($url, $http_options); - } - if (!empty($request->data)) { - $matches = array(); - if (preg_match($options['pattern'], $request->data, $matches)) { - return $matches[1]; - } - } - return '0'; -} - -/** - * Update github version numbers to the latest. - * - * @param bool $refresh - * Set to TRUE to skip the cache and force a refresh of the data. - * - * @return mixed - * Key Value pair of the project name and remote version number. If $target is - * set then that version number is returned. - */ -function advagg_get_remote_libraries_versions($refresh = FALSE) { - $cid = __FUNCTION__; - $versions = array(); - if (!$refresh) { - $versions = advagg_get_remote_libraries_versions_cache($cid); - if (!empty($versions)) { - return $versions; - } - } - - if (is_callable('libraries_info')) { - $libraries = libraries_info(); - foreach ($libraries as $key => $library) { - // Get current version. - $libraries_detect = libraries_detect($key); - if (isset($libraries_detect['version'])) { - $versions[$key]['local'] = $libraries_detect['version']; - } - elseif (!empty($libraries_detect['local version'])) { - $versions[$key]['local'] = $libraries_detect['local version']; - } - - // Check if callback is live. - $remote = advagg_get_remote_libraries_version($key, $library, FALSE); - if (!empty($remote)) { - $versions[$key]['remote'] = $remote; - } - } - } - - if (!empty($versions)) { - cache_set($cid, $versions, 'cache_advagg_info'); - } - return $versions; -} - -/** - * Get the remote and local versions cache of the available libraries. - * - * @param string $cid - * Cache ID. - * - * @return array - * Library name => (local, remote). - */ -function advagg_get_remote_libraries_versions_cache($cid = '') { - if (empty($cid)) { - $cid = 'advagg_get_remote_libraries_versions'; - } - $versions = &drupal_static($cid, array()); - if (empty($versions)) { - $cache = cache_get($cid, 'cache_advagg_info'); - if (!empty($cache) && !empty($cache->data)) { - $versions = $cache->data; - } - } - return $versions; -} - -/** - * Get the latest version number for the remote version. - * - * @param string $name - * Name of the library. - * @param array $library - * An associative array containing all information about the library. - * @param bool $use_cache - * TRUE try the cache first. - * - * @return string - * The latest version number as a string or 0 on failure. - */ -function advagg_get_remote_libraries_version($name, array $library, $use_cache = TRUE) { - if ($use_cache) { - $cid = 'advagg_get_remote_libraries_versions'; - $versions = advagg_get_remote_libraries_versions_cache($cid); - if (isset($versions[$name]['remote'])) { - return $versions[$name]['remote']; - } - } - - // Remote url is not set, see if we can generate it given the current data. - if (empty($library['remote']['url']) - && !empty($library['version arguments']) - ) { - if (!isset($library['version arguments']['file']) - && isset($library['version arguments']['variants']) - ) { - // Use the first variant. - $file = reset($library['version arguments']['variants']); - $library['version arguments']['file'] = $file['file']; - $library['version arguments']['pattern'] = $file['pattern']; - } - - if (!empty($library['version arguments']['file'])) { - if (!empty($library['vendor url'])) { - // Use vendor url if it's a github one. - if (strpos($library['vendor url'], 'https://github.com/') === 0) { - $parsed_vendor = @parse_url($library['vendor url']); - // Previously: https://rawgit.com{$parsed_vendor['path']}/master/{$library['version arguments']['file']} . - $library['remote']['url'] = "https://cdn.jsdelivr.net/gh{$parsed_vendor['path']}@master/{$library['version arguments']['file']}"; - } - } - if (empty($library['remote']['url']) && !empty($library['download url'])) { - // Use download url if it's a github one. - if (strpos($library['download url'], 'https://github.com/') === 0) { - $parsed_download = @parse_url($library['download url']); - $paths = explode('/', $parsed_download['path']); - $parsed_download['path'] = "/{$paths[1]}/{$paths[2]}"; - // Previously: https://rawgit.com{$parsed_download['path']}/master/{$library['version arguments']['file']} . - $library['remote']['url'] = "https://cdn.jsdelivr.net/gh{$parsed_download['path']}@master/{$library['version arguments']['file']}"; - } - } - } - } - - // Remote callback is not set, try to generate it given the current data. - if (empty($library['remote']['callback']) - && isset($library['version arguments']['file']) - ) { - if (!empty($library['version callback'])) { - // Use defined parser. - $library['remote']['callback'] = $library['version callback']; - } - else { - if ($library['version arguments']['file'] === 'package.json') { - // JSON parser. - $library['remote']['callback'] = 'advagg_get_github_version_json'; - } - else { - // Text parser. - $library['remote']['callback'] = 'advagg_get_github_version_txt'; - } - } - } - - // Get remote version. - $return = 0; - if (!empty($library['remote']) - && !empty($library['remote']['callback']) - && !empty($library['remote']['url']) - && isset($library['version arguments']) - && is_callable($library['remote']['callback']) - ) { - $return = $library['remote']['callback']($library, $library['version arguments'], $library['remote']['url']); - - // Try package.json on failure. - if (empty($return) && $library['version arguments']['file'] !== 'package.json') { - $pos = strrpos($library['remote']['url'], $library['version arguments']['file']); - $library['remote']['url'] = substr($library['remote']['url'], 0, $pos) . 'package.json'; - $library['remote']['callback'] = 'advagg_get_github_version_json'; - $return = $library['remote']['callback']($library, $library['version arguments'], $library['remote']['url']); - } - } - return $return; -} - -/** - * Get the latest version number for the remote version. - * - * @param string $name - * Name of the library. - * @param string $module_name - * Name of the module where the library is registered. - * - * @return array - * The library array. - */ -function advagg_get_library($name, $module_name) { - $library = cache_get($name, 'cache_libraries'); - if ($library) { - $library = $library->data; - } - else { - if (is_callable('libraries_detect')) { - $library = libraries_detect($name); - } - elseif (is_callable("{$module_name}_libraries_info")) { - $library = call_user_func("{$module_name}_libraries_info"); - $library = $library[$name]; - } - } - return $library; -} - -/** - * Alter the js array fixing the type key if set incorrectly. - * - * @param array $array - * CSS or JS array. - * @param string $type - * CSS or JS. - */ -function advagg_fix_type(array &$array, $type) { - // Skip if advagg is disabled. - if (!advagg_enabled()) { - return; - } - - // Skip if setting is turned off. - if ($type === 'css' && !variable_get('advagg_css_fix_type', ADVAGG_CSS_FIX_TYPE)) { - return; - } - if ($type === 'js' && !variable_get('advagg_js_fix_type', ADVAGG_JS_FIX_TYPE)) { - return; - } - - // Fix type if it was incorrectly set. - // Get hostname and base path. - $mod_base_url = substr($GLOBALS['base_root'] . $GLOBALS['base_path'], strpos($GLOBALS['base_root'] . $GLOBALS['base_path'], '//') + 2); - $mod_base_url_len = strlen($mod_base_url); - - foreach ($array as &$value) { - // Skip if the data is empty or not a string. - if (empty($value['data']) || !is_string($value['data'])) { - continue; - } - - // Default to file if type is not set. - if (!isset($value['type'])) { - $value['type'] = 'file'; - } - - // If inline, be done with processing. - if ($value['type'] === 'inline') { - continue; - } - - // Default to file if not file, inline, external, setting. - if ($value['type'] !== 'file' - && $value['type'] !== 'inline' - && $value['type'] !== 'external' - && $value['type'] !== 'setting' - ) { - if ($value['type'] === 'settings') { - $value['type'] = 'setting'; - } - else { - $value['type'] = 'file'; - } - } - - $lower = strtolower($value['data']); - $http_pos = strpos($lower, 'http://'); - $https_pos = strpos($lower, 'https://'); - $double_slash_pos = strpos($lower, '//'); - $tripple_slash_pos = strpos($lower, '///'); - $mod_base_url_pos = stripos($value['data'], $mod_base_url); - - // If type is external but doesn't start with http, https, or // change it - // to file. - if ($value['type'] === 'external' - && $http_pos !== 0 - && $https_pos !== 0 - && $double_slash_pos !== 0 - ) { - if (is_readable($value['data'])) { - $value['type'] = 'file'; - } - else { - // Fix for subdir issues. - $parsed = parse_url($value['data']); - if (strpos($parsed['path'], $GLOBALS['base_path']) === 0) { - $path = substr($parsed['path'], strlen($GLOBALS['base_path'])); - if (is_readable($path)) { - $value['data'] = $path; - $value['type'] = 'file'; - } - } - } - } - - // If type is file but it starts with http, https, or // change it to - // external. Skip tripple slash for local files. - if ($value['type'] === 'file' - && ($http_pos === 0 - || $https_pos === 0 - || ($double_slash_pos === 0 && $tripple_slash_pos === FALSE)) - ) { - $value['type'] = 'external'; - } - - // If type is external and starts with http, https, or // but points to - // this host change to file, but move it to the top of the aggregation - // stack. - if ($value['type'] === 'external' - && $mod_base_url_pos - 2 === $double_slash_pos - && ($http_pos === 0 - || $https_pos === 0 - || $double_slash_pos === 0 - ) - ) { - $path = substr($value['data'], $mod_base_url_pos + $mod_base_url_len); - if (is_readable($path)) { - $value['data'] = $path; - $value['type'] = 'file'; - $value['group'] = JS_LIBRARY; - $value['every_page'] = TRUE; - $value['weight'] = -40000; - } - else { - // Fix for subdir issues. - $parsed = parse_url($path); - if (strpos($parsed['path'], $GLOBALS['base_path']) === 0) { - $path = substr($parsed['path'], strlen($GLOBALS['base_path'])); - if (is_readable($path)) { - $value['data'] = $path; - $value['type'] = 'file'; - $value['group'] = JS_LIBRARY; - $value['every_page'] = TRUE; - $value['weight'] = -40000; - } - } - } - } - } - unset($value); -} - -/** - * Alter the CSS or JS array removing empty files from the aggregates. - * - * @param array $array - * CSS or JS array. - */ -function advagg_remove_empty_files(array &$array) { - if (!variable_get('advagg_js_remove_empty_files', ADVAGG_JS_REMOVE_EMPTY_FILES)) { - return; - } - - if (variable_get('advagg_fast_filesystem', ADVAGG_FAST_FILESYSTEM)) { - foreach ($array as $key => $value) { - if ($value['type'] !== 'file') { - continue; - } - // Check locally. - if (!is_readable($value['data']) || filesize($value['data']) == 0) { - unset($array[$key]); - } - } - } - else { - module_load_include('inc', 'advagg', 'advagg'); - $files = array(); - foreach ($array as $key => $value) { - if ($value['type'] !== 'file') { - continue; - } - $files[$key] = $value['data']; - } - // Check cache/db. - $info = advagg_get_info_on_files($files); - foreach ($info as $key => $values) { - if (empty($values['filesize'])) { - $key = array_search($values['data'], $files); - if (isset($array[$key])) { - unset($array[$key]); - } - } - } - } -} - -/** - * Alter the CSS or JS array adding in DNS domain info. - * - * @param array $array - * CSS or JS array. - * @param string $type - * CSS or JS. - */ -function advagg_add_default_dns_lookups(array &$array, $type) { - // Skip if advagg is disabled. - if (!advagg_enabled()) { - return; - } - // Remove this return once CSS lookups are needed. - if ($type !== 'js') { - return; - } - - // Add DNS information for some of the more popular modules. - foreach ($array as &$value) { - if (!is_string($value['data'])) { - continue; - } - // Google Ad Manager. - if (strpos($value['data'], '/google_service.') !== FALSE) { - if (!empty($value['dns_prefetch']) && is_string($value['dns_prefetch'])) { - $temp = $value['dns_prefetch']; - unset($value['dns_prefetch']); - $value['dns_prefetch'] = array($temp); - } - // Domains in the google_service.js file. - $value['dns_prefetch'][] = 'https://csi.gstatic.com'; - $value['dns_prefetch'][] = 'https://pubads.g.doubleclick.net'; - $value['dns_prefetch'][] = 'https://partner.googleadservices.com'; - $value['dns_prefetch'][] = 'https://securepubads.g.doubleclick.net'; - - // Domains in the google_ads.js file. - $value['dns_prefetch'][] = 'https://pagead2.googlesyndication.com'; - - // Other domains that usually get hit. - $value['dns_prefetch'][] = 'https://cm.g.doubleclick.net'; - $value['dns_prefetch'][] = 'https://tpc.googlesyndication.com'; - } - - // Google Analytics. - if (strpos($value['data'], 'GoogleAnalyticsObject') !== FALSE - || strpos($value['data'], '.google-analytics.com/ga.js') !== FALSE - ) { - if (!empty($value['dns_prefetch']) && is_string($value['dns_prefetch'])) { - $temp = $value['dns_prefetch']; - unset($value['dns_prefetch']); - $value['dns_prefetch'] = array($temp); - } - if ($GLOBALS['is_https'] && strpos($value['data'], '.google-analytics.com/ga.js') !== FALSE) { - $value['dns_prefetch'][] = 'https://ssl.google-analytics.com'; - } - else { - $value['dns_prefetch'][] = 'https://www.google-analytics.com'; - } - $value['dns_prefetch'][] = 'https://stats.g.doubleclick.net'; - } - } -} - -/** - * Insert element into an array at a specific position. - * - * @param array $input_array - * The original array. - * @param array $new_value - * The element that is getting inserted. - * @param int $location_key - * The key location. - * - * @return array - * The new array with the element merged in. - */ -function advagg_insert_into_array_at_location(array $input_array, array $new_value, $location_key) { - return array_merge(array_slice($input_array, 0, $location_key), $new_value, array_slice($input_array, $location_key)); -} - -/** - * Insert element into an array at a specific key location. - * - * @param array $input_array - * The original array. - * @param array $insert - * The element that is getting inserted; array(key => value). - * @param string $target_key - * The key name. - * @param int $location - * After is 1 , 0 is replace, -1 is before. - * - * @return array - * The new array with the element merged in. - */ -function advagg_insert_into_array_at_key(array $input_array, array $insert, $target_key, $location = 1) { - $output = array(); - $new_value = reset($insert); - $new_key = key($insert); - foreach ($input_array as $key => $value) { - if ($key === $target_key) { - // Insert before. - if ($location == -1) { - $output[$new_key] = $new_value; - $output[$key] = $value; - } - // Replace. - if ($location == 0) { - $output[$new_key] = $new_value; - } - // After. - if ($location == 1) { - $output[$key] = $value; - $output[$new_key] = $new_value; - } - } - else { - // Pick next key if there is an number collision. - if (is_numeric($key)) { - while (isset($output[$key])) { - $key++; - } - } - $output[$key] = $value; - } - } - // Add to array if not found. - if (!isset($output[$new_key])) { - // Before everything. - if ($location == -1) { - $output = $insert + $output; - } - // After everything. - if ($location == 1) { - $output[$new_key] = $new_value; - } - - } - return $output; -} - -/** - * Given a URL output a filename. - * - * @param string $url - * The url. - * @param string $strict - * If FALSE then slashes will be kept. - * - * @return string - * The filename. - */ -function advagg_url_to_filename($url, $strict = TRUE) { - // Keep filtering till there are no more changes. - $decoded1 = _advagg_url_to_filename_filter($url, $strict); - $decoded2 = _advagg_url_to_filename_filter($decoded1, $strict); - while ($decoded1 != $decoded2) { - $decoded1 = _advagg_url_to_filename_filter($decoded2, $strict); - $decoded2 = _advagg_url_to_filename_filter($decoded1, $strict); - } - $filename = $decoded1; - - // Shorten filename to a max of 250 characters. - $filename = mb_strcut($filename, 0, 250, mb_detect_encoding($filename)); - return $filename; -} - -/** - * Given a URL output a filtered filename. - * - * @param string $url - * The url. - * @param string $strict - * If FALSE then slashes will be kept. - * - * @return string - * The filename. - */ -function _advagg_url_to_filename_filter($url, $strict = TRUE) { - // URL Decode if needed. - $decoded1 = $url; - $decoded2 = rawurldecode($decoded1); - while ($decoded1 != $decoded2) { - $decoded1 = rawurldecode($decoded2); - $decoded2 = rawurldecode($decoded1); - } - $url = $decoded1; - - // Replace url spaces with a dash. - $filename = str_replace(array('%20', '+'), '-', $url); - - // Remove file system reserved characters - // https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words - // Remove control charters - // http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx - // Remove non-printing characters DEL, NO-BREAK SPACE, SOFT HYPHEN - // Remove URI reserved characters - // https://tools.ietf.org/html/rfc3986#section-2.2 - // Remove URL unsafe characters - // https://www.ietf.org/rfc/rfc1738.txt - if ($strict) { - $filename = preg_replace('~[<>:"/\\|?*]|[\x00-\x1F]|[\x7F\xA0\xAD]|[#\[\]@!$&\'()+,;=%]|[{}^\~`]~x', '-', $filename); - } - else { - $filename = preg_replace('~[<>:"\\|?*]|[\x00-\x1F]|[\x7F\xA0\xAD]|[#\[\]@!$&\'()+,;=%]|[{}^\~`]~x', '-', $filename); - } - - // Replce all white spaces with a dash. - $filename = preg_replace('/[\r\n\t -]+/', '-', $filename); - - // Avoid ".", ".." or ".hiddenFiles". - $filename = ltrim($filename, '.-'); - - // Compress spaces in a file name and replace with a dash. - // Compress underscores in a file name and replace with a dash. - // Compress dashes in a file name and replace with a dash. - $filename = preg_replace(array('/ +/', '/_+/', '/-+/'), '-', $filename); - - // Compress dashes and dots in a file name and replace with a dot. - $filename = preg_replace(array('/-*\.-*/', '/\.{2,}/'), '.', $filename); - - // Lowercase for windows/unix interoperability - // http://support.microsoft.com/kb/100625. - $filename = mb_strtolower($filename, 'UTF-8'); - // Remove ? \ .. - $filename = str_replace(array('?', '\\', '..'), '', $filename); - - // ".file-name.-" becomes "file-name". - $filename = trim($filename, '.-'); - - return $filename; -} - -/** - * Given a URI return TRUE if it is external. - * - * @param string $uri - * The uri. - * - * @return bool - * TRUE if external. - */ -function advagg_is_external($uri) { - $http_pos = strpos($uri, 'http://'); - $https_pos = strpos($uri, 'https://'); - $double_slash_pos = strpos($uri, '//'); - if ($http_pos !== 0 - && $https_pos !== 0 - && $double_slash_pos !== 0 - ) { - return FALSE; - } - return TRUE; -} - -/** - * Same as file_get_contents() but will convert string to UTF-8 if needed. - * - * @return mixed - * The files contents or FALSE on failure. - */ -function advagg_file_get_contents() { - // Get the file contents. - $file_contents = call_user_func_array('file_get_contents', func_get_args()); - if ($file_contents === FALSE) { - return $file_contents; - } - - // If a BOM is found, convert the file to UTF-8. - $encoding = advagg_get_encoding_from_bom($file_contents); - if (!empty($encoding)) { - $file_contents = advagg_convert_to_utf8($file_contents, $encoding); - } - - return $file_contents; -} - -/** - * Get the description text based off the library version. - * - * @param string $library_name - * Name of the library. - * @param string $module_name - * Name of the module that contains hook_libraries_info for this library. - * - * @return array - * Description text and info array. - */ -function advagg_get_version_description($library_name, $module_name, $only_remote_ok = FALSE) { - $t = get_t(); - - // Get local and external library version numbers. - $versions = &drupal_static(__FUNCTION__); - if (!isset($versions)) { - $versions = advagg_get_remote_libraries_versions(TRUE); - } - - $description = ''; - if (!empty($versions[$library_name]['remote']) - && (empty($versions[$library_name]['local']) - || $versions[$library_name]['local'] !== $versions[$library_name]['remote'] - )) { - $library = advagg_get_library($library_name, $module_name); - if (empty($versions[$library_name]['local'])) { - $versions[$library_name]['local'] = 'NULL'; - } - if (!empty($library['installed'])) { - $description = $t('Go to the @name page and download the latest version (@remote) into the @lib_path folder. An example valid filename is %version_file. Current Version: %version.', array( - '@name' => $library['name'], - '@lib_path' => $library['library path'], - '@url-page' => $library['vendor url'], - '@url-zip' => $library['download url'], - '@remote' => $versions[$library_name]['remote'], - '%version' => $versions[$library_name]['local'], - '%version_file' => $library['library path'] . '/' . $library['version arguments']['file'], - )); - } - elseif (!$only_remote_ok && is_callable('libraries_load')) { - $description = $t('Go to the @name page and download the latest version (@remote) into the libraries folder (usually sites/all/libraries). An example valid filename is %version_file.', array( - '@name' => $library['name'], - '@url-page' => $library['vendor url'], - '@url-zip' => $library['download url'], - '@remote' => $versions[$library_name]['remote'], - '%version_file' => "sites/all/libraries/$library_name/{$library['version arguments']['file']}", - )); - } - elseif (!$only_remote_ok) { - $description = $t('Install the Libraries API module and then go to the @name page and download the latest version (@remote) into the libraries folder (usually sites/all/libraries). An example valid filename is %version_file.', array( - '@name' => $library['name'], - '@url-page' => $library['vendor url'], - '@url-zip' => $library['download url'], - '@remote' => $versions[$library_name]['remote'], - '%version_file' => "sites/all/libraries/$library_name/{$library['version arguments']['file']}", - '@url-lib-api' => 'https://www.drupal.org/project/libraries', - )); - } - } - $path = drupal_get_path('module', $module_name); - $info = drupal_parse_info_file("{$path}/{$module_name}.info"); - - // Check if library was unzipped with -master. - if (!empty($description) && is_callable('libraries_get_libraries')) { - $libraries_paths = libraries_get_libraries(); - if (!empty($libraries_paths["{$library_name}-master"])) { - $description = $t('Rename @lib_dir_master to @lib_dir at this location: @lib_path_master.', array( - '@lib_dir_master' => "{$library_name}-master", - '@lib_path_master' => $libraries_paths["{$library_name}-master"], - '@lib_dir' => $library_name, - )); - } - } - - return array($description, $info); -} - -/** - * Given a advagg type this will return the most recent aggregate from the db. - * - * @param string $type - * String: css or js. - * - * @return string - * Returns advagg filename or an empty string on failure. - */ -function advagg_generate_advagg_filename_from_db($type) { - // Get the most recently accessed file from the database. - $query = db_select('advagg_aggregates_versions', 'aav'); - $query->join('advagg_aggregates', 'aa', 'aa.aggregate_filenames_hash = - aav.aggregate_filenames_hash'); - $query->join('advagg_files', 'af', 'af.filename_hash = aa.filename_hash AND - af.filetype = :type', array(':type' => $type)); - $query = $query->fields('aav', array('aggregate_filenames_hash', 'aggregate_contents_hash')) - ->orderBy('atime', 'DESC') - ->range(0, 1); - $results = $query->execute(); - if (empty($results)) { - return ''; - } - $hooks_hash = advagg_get_current_hooks_hash(); - foreach ($results as $row) { - return $type . ADVAGG_SPACE . $row->aggregate_filenames_hash . ADVAGG_SPACE . $row->aggregate_contents_hash . ADVAGG_SPACE . $hooks_hash . '.' . $type; - } -} - -/** - * Display a message if there are requirement issues with AdvAgg. - * - * @param array $requirements - * Other requirements to list besides the standard ones. - */ -function advagg_display_message_if_requirements_not_met(array $requirements = array()) { - include_once DRUPAL_ROOT . '/includes/install.inc'; - module_load_include('install', 'advagg'); - $requirements += advagg_install_fast_checks(); - if (!empty($requirements)) { - module_load_include('admin.inc', 'system'); - usort($requirements, '_system_sort_requirements'); - $report = theme('status_report', array('requirements' => $requirements)); - drupal_set_message(t('Go to the status report page and fix the issues that AdvAgg lists there. Sneak peak: !report', array( - '@url' => url('admin/reports/status'), - '!report' => $report, - ))); - } -} - -/** - * Add in the preload header for CSS and JS external files. - * - * @param string $url - * The url of the external host. - * - * @return bool - * TRUE if it was added to the head. - */ -function advagg_add_preload_header($url = '', $as = '') { - // Get defaults and setup static's. - $list = &drupal_static(__FUNCTION__ . ':list', array()); - $output = &drupal_static(__FUNCTION__ . ':output'); - $header_strlen = &drupal_static(__FUNCTION__ . ':strlen', 0); - static $resource_hints_preload_order; - if (!isset($resource_hints_preload_order)) { - $resource_hints_preload_order = advagg_get_resource_hints_preload_settings(); - } - if (!isset($output)) { - $keys = array_keys($resource_hints_preload_order); - $output = array_fill_keys($keys, array()); - } - - // Output headers. - if (empty($url)) { - - // Call hook_advagg_preload_header_alter() - drupal_alter('advagg_preload_header', $output); - - // Build header string. - $header_value = ''; - foreach ($output as $value) { - if (!empty($value)) { - // Remove empty values. - $value = array_filter($value); - foreach ($value as $string) { - $header_strlen += strlen($string) + 2; - // Don't add if over the limit. - if ($header_strlen >= variable_get('advagg_resource_hints_preload_max_size', ADVAGG_RESOURCE_HINTS_PRELOAD_MAX_SIZE)) { - continue; - } - // Add to $header_value string. - if (empty($header_value)) { - $header_value = $string; - } - else { - $header_value .= ',' . $string; - } - } - } - } - if (!empty($header_value)) { - drupal_add_http_header('Link', $header_value, TRUE); - } - return FALSE; - } - - // Check for duplicates. - if (isset($list[$url])) { - return FALSE; - } - - // Fill in missing info. - $payload = "<{$url}>; rel=preload"; - list($as, $type, $crossorigin, $parse) = advagg_get_preload_info_from_url($url, $as); - if (!empty($as) && $as === 'php') { - $list[$url] = FALSE; - return FALSE; - } - - $additional_info = array(); - if (!empty($crossorigin)) { - $additional_info[] = "crossorigin"; - } - if (!empty($type)) { - $additional_info[] = $type; - } - $additional_info = implode('; ', $additional_info); - - // Get settings. - if (!empty($as) && !empty($resource_hints_preload_order[$as])) { - $settings = $resource_hints_preload_order[$as]; - } - elseif (!empty($resource_hints_preload_order['all_others'])) { - $settings = $resource_hints_preload_order['all_others']; - } - - // Apply settings. - if (!$settings['enabled']) { - $list[$url] = FALSE; - return FALSE; - } - if (!$settings['local'] && empty($parse['host'])) { - $list[$url] = FALSE; - return FALSE; - } - if (!$settings['external'] && !empty($parse['host'])) { - $list[$url] = FALSE; - return FALSE; - } - - // Add additional info and queue. - if (!empty($as)) { - $payload .= "; as={$as}"; - } - if (!empty($additional_info)) { - $payload .= "; {$additional_info}"; - } - if (!$settings['push']) { - $payload .= "; nopush"; - } - $list[$url] = TRUE; - $output[$as][] = $payload; -} - -/** - * Given a link get the as, type, and crossorigin attributes. - * - * @param string $url - * Link to the url that will be preloaded. - * @param string $as - * What type of content is this; font, image, video, etc. - * @param string $type - * The mime type of the file. - * @param string $crossorigin - * Preload cross-origin resources; fonts always need to be CORS. - * - * @return array - * An array containing - */ -function advagg_get_preload_info_from_url($url, $as = '', $type = '', $crossorigin = NULL) { - // Get extension. - $parse = @parse_url($url); - if (empty($parse['path'])) { - return FALSE; - } - $file_ext = strtolower(pathinfo($parse['path'], PATHINFO_EXTENSION)); - if (empty($file_ext)) { - $file_ext = basename($parse['path']); - } - - // Detect missing parts. - $list = advagg_preload_list(); - if (empty($as) && !empty($file_ext)) { - foreach ($list as $as_key => $list_type) { - $key = array_search($file_ext, $list_type); - if ($key !== FALSE) { - $as = $as_key; - // Type of font, ext is svg but file doesn't contain string font. - // This will be treated as an image. - if ($as === 'font' - && $file_ext === 'svg' - && stripos($url, 'font') === FALSE - ) { - $as = ''; - } - } - if (!empty($as)) { - break; - } - } - } - if (empty($type) && !empty($as)) { - $type = "$as/$file_ext"; - if ($file_ext === 'svg') { - $type .= '+xml'; - } - if ($file_ext === 'js') { - $type = 'text/javascript'; - } - } - if ($as === 'font' && is_null($crossorigin)) { - $crossorigin = 'anonymous'; - } - return array($as, $type, $crossorigin, $parse); -} - -/** - * Add preload link to the top of the html head. - * - * @param string $url - * Link to the url that will be preloaded. - * @param string $media - * Media types or media queries, allowing for responsive preloading. - * @param string $as - * What type of content is this; font, image, video, etc. - * @param string $type - * The mime type of the file. - * @param string $crossorigin - * Preload cross-origin resources; fonts always need to be CORS. - */ -function advagg_add_preload_link($url, $media = '', $as = '', $type = '', $crossorigin = NULL) { - static $weight = -2000; - $weight += 0.0001; - - $href = advagg_file_create_url($url); - $key = "advagg_preload:{$href}"; - - // Return here if url has already been added. - $stored_head = drupal_static('drupal_add_html_head'); - if (isset($stored_head[$key])) { - return TRUE; - } - - // Add basic attributes. - $attributes = array( - 'rel' => 'preload', - 'href' => $href, - ); - - // Fill in missing info. - list($as, $type, $crossorigin) = advagg_get_preload_info_from_url($url, $as, $type, $crossorigin); - - // Exit if no as. - if (empty($as)) { - return FALSE; - } - // Build up attributes array. - $attributes['as'] = $as; - if (!empty($type)) { - $attributes['type'] = $type; - } - if (!empty($crossorigin)) { - $attributes['crossorigin'] = $crossorigin; - } - if (!empty($media)) { - $attributes['media'] = $media; - } - // Call hook_advagg_preload_link_attributes_alter() - drupal_alter('advagg_preload_link_attributes', $attributes); - - // Add to HTML head. - $element = array( - '#type' => 'html_tag', - '#tag' => 'link', - '#attributes' => $attributes, - '#weight' => $weight, - ); - drupal_add_html_head($element, $key); - return TRUE; -} - -/** - * Generate a list of file types for the as field given the extension. - * - * @return array - * Returns an array of arrays. - */ -function advagg_preload_list() { - $list = array( - 'font' => array( - 'woff2', - 'woff', - 'ttf', - 'otf', - 'eot', - // Need to check if the svg file is in a font folder. - 'svg', - ), - 'image' => array( - 'gif', - 'jpg', - 'jpeg', - 'jpe', - 'jif', - 'jfif', - 'jfi', - 'png', - 'webp', - 'jp2', - 'jpx', - 'jxr', - 'heif', - 'heic', - 'bpg', - 'svg', - ), - 'style' => array( - 'css', - ), - 'script' => array( - 'js', - ), - 'video' => array( - 'mp4', - 'webm', - 'ogg', - ), - ); - - // Call hook_advagg_preload_list_alter() - drupal_alter('advagg_preload_list', $list); - return $list; -} - -/** - * Save form defaults or recommended values. - * - * @param array $element - * Form element or child element. - * - * @return array - * An array of form names and the recommended value for that setting. - */ -function advagg_find_all_recommended_admin_values(array &$element, $key_name = '#recommended_value') { - $results = array(); - $children = element_children($element); - foreach ($children as $key) { - $child = $element[$key]; - if (is_array($child)) { - if (!empty($child['#type']) - && !empty($child['#name']) - && isset($child[$key_name]) - ) { - $results[$child['#name']] = $child[$key_name]; - } - $results = array_merge($results, advagg_find_all_recommended_admin_values($child, $key_name)); - } - unset($child); - } - return $results; -} - -/** - * Get form values that have changed. - * - * @param array $element - * Form element or child element. - * - * @return array - * An array of form names and the recommended value for that setting. - */ -function advagg_find_all_changed_admin_values(array &$element) { - $results = array(); - $children = element_children($element); - foreach ($children as $key) { - $child = $element[$key]; - if (is_array($child)) { - if (!empty($child['#type']) - && !empty($child['#name']) - && isset($child['#default_value']) - && isset($child['#value']) - ) { - if ($child['#type'] === 'checkboxes') { - // Add in not selected by default values. - $child['#value'] += array_diff_assoc($child['#default_value'], $child['#value']); - } - if ($child['#default_value'] != $child['#value']) { - $results[$child['#name']] = array($child['#value'], $child['#default_value']); - } - } - $results = array_merge($results, advagg_find_all_changed_admin_values($child)); - } - unset($child); - } - return $results; -} - -/** - * Get form title and description. - * - * @param array $element - * Form element or child element. - * - * @return array - * An array of form names and the recommended value for that setting. - */ -function advagg_find_title(array &$element) { - $results = array(); - $children = element_children($element); - foreach ($children as $key) { - $child = $element[$key]; - if (is_array($child)) { - if (!empty($child['#type']) - && !empty($child['#name']) - && isset($child['#title']) - && isset($child['#default_value']) - && !isset($results[$child['#name']]) - && $child['#type'] !== 'radio' - ) { - $results[$child['#name']] = $child['#title']; - } - $results = array_merge($results, advagg_find_title($child)); - } - unset($child); - } - return $results; -} - -/** - * Save form defaults or recommended values. - * - * @param array $form_state - * Form state array from drupal form submit. - * @param string $trigger_key - * The key of the setting from the form that controls this. - */ -function advagg_set_admin_form_defaults_recommended(array &$form_state, $trigger_key) { - $changed = array(); - $recommended_values = array(); - - // Set to recommended values. - if ($form_state['values'][$trigger_key] == 2) { - $recommended_values = advagg_find_all_recommended_admin_values($form_state['complete form']); - foreach ($recommended_values as $key => $value) { - if (!isset($form_state['values'][$key])) { - $changed[$key] = array($value); - } - elseif ($value != $form_state['values'][$key]) { - $changed[$key] = array($value, $form_state['values'][$key]); - } - $form_state['values'][$key] = $value; - } - } - - // Set to defaults. - if ($form_state['values'][$trigger_key] == 0 || $form_state['values'][$trigger_key] == 2) { - // Reset to defaults. - foreach ($form_state['values'] as $key => &$value) { - // Skip non advagg settings, trigger key, or if a recommended value. - if (strpos($key, 'advagg_') !== 0 - || $key === $trigger_key - || isset($changed[$key]) - || isset($recommended_values[$key]) - ) { - continue; - } - - // Default to FALSE. - $default = FALSE; - // Get easy defaults. - if (defined(strtoupper($key))) { - $default = constant(strtoupper($key)); - } - - // Get more complex default values. - if ($key === 'advagg_resource_hints_preload_settings') { - $default = advagg_get_resource_hints_preload_settings(TRUE); - foreach ($default as $key => &$values) { - $default[$key]['weight'] = $values['#weight']; - unset($default[$key]['#weight'], $values['#weight'], $default[$key]['title'], $values['title']); - ksort($values); - } - ksort($default); - foreach ($value as $key => &$values) { - ksort($values); - } - ksort($value); - } - if ($key === 'advagg_relocate_css_inline_import_browsers') { - $default = array( - 'woff2' => 'woff2', - 'woff' => 'woff', - 'ttf' => 'ttf', - 'eot' => 0, - 'svg' => 0, - ); - } - - // See if it changed. - if ($default != $value) { - // After, Before. - $changed[$key] = array($default, $value); - $value = $default; - } - } - } - - if ($form_state['values'][$trigger_key] == 4) { - $changed = advagg_find_all_changed_admin_values($form_state['complete form']); - if (isset($changed[$trigger_key])) { - unset($changed[$trigger_key]); - } - } - - $all_titles_descriptions = advagg_find_title($form_state['complete form']); - foreach ($changed as $key => $values) { - - // Remove things that didn't really change. - if (isset($values[1])) { - if ($values[0] == $values[1]) { - unset($changed[$key]); - continue; - } - if (is_string($values[0]) - && is_string($values[1]) - && trim($values[0]) == trim($values[1]) - ) { - unset($changed[$key]); - continue; - } - } - - // Make output nicer. - if (!isset($values[1])) { - $values[1] = NULL; - } - if (is_bool($values[0]) && !is_bool($values[1]) - || !is_bool($values[0]) && is_bool($values[1]) - ) { - $values[0] = (bool) $values[0]; - $values[1] = (bool) $values[1]; - } - if (is_int($values[0]) && !is_int($values[1]) - || !is_int($values[0]) && is_int($values[1]) - ) { - $values[0] = (int) $values[0]; - $values[1] = (int) $values[1]; - } - - // Let user know what changed. - if (empty($all_titles_descriptions[$key])) { - drupal_set_message(t('%before -> %after for %title', array( - '%title' => $key, - '%before' => var_export($values[1], TRUE), - '%after' => var_export($values[0], TRUE), - ))); - } - else { - drupal_set_message(t('%before -> %after for %title', array( - '%title' => $all_titles_descriptions[$key], - '%before' => var_export($values[1], TRUE), - '%after' => var_export($values[0], TRUE), - ))); - } - } - - return $changed; -} - -/** - * Given a list of items see what ones need to be inserted/updated or deleted. - * - * @param array $defaults - * Array of default values, representing a row in the db. - * @param mixed $new_values - * Array of edited values, representing a row in the db. - * - * @return array - * Nested array strucutre; only the diff. - */ -function advagg_diff_multi(array $defaults, $new_values) { - $result = array(); - - foreach ($defaults as $key => $val) { - if (is_array($val) && isset($new_values[$key])) { - $tmp = advagg_diff_multi($val, $new_values[$key]); - if ($tmp) { - $result[$key] = $tmp; - } - } - elseif (!isset($new_values[$key])) { - $result[$key] = NULL; - } - elseif ($val != $new_values[$key]) { - $result[$key] = $new_values[$key]; - } - if (isset($new_values[$key])) { - unset($new_values[$key]); - } - } - - $result = $result + $new_values; - return $result; -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_bundler/advagg_bundler.admin.inc b/html/sites/all/modules/contrib/advagg/advagg_bundler/advagg_bundler.admin.inc deleted file mode 100644 index d7bfd0316..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_bundler/advagg_bundler.admin.inc +++ /dev/null @@ -1,229 +0,0 @@ - t('Use HTTP 1.1 settings'), - 2 => t('Use HTTP 2.0 settings'), - 4 => t('Use customized settings'), - ); - $form['advagg_bundler_admin_mode'] = array( - '#type' => 'radios', - '#title' => t('AdvAgg Settings'), - '#default_value' => variable_get('advagg_bundler_admin_mode', ADVAGG_BUNDLER_ADMIN_MODE), - '#options' => $options, - '#description' => t("Default settings will mirror core as closely as possible.
Recommended settings are optimized for speed."), - ); - - // Test http2. - $http2_support = 0; - $url = 'https://tools.keycdn.com/http2-query.php?url=' . url('', array('absolute' => TRUE)); - if (filter_var($_SERVER['HTTP_HOST'], FILTER_VALIDATE_IP) === FALSE && $_SERVER['HTTP_HOST'] !== 'localhost') { - $response = drupal_http_request($url, array( - 'timeout' => 3, - )); - } - else { - $response = new stdClass(); - $response->code = 0; - } - if ($response->code == 200 && !empty($response->data)) { - $http2_support = 1; - if (stripos($response->data, 'success') !== FALSE) { - $http2_support = 2; - } - } - if (stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== FALSE && is_callable('apache_get_modules')) { - $modules = apache_get_modules(); - $key_a = array_search('mod_http2', $modules); - $key_b = array_search('mod_h2', $modules); - if ($key_a !== FALSE || $key_b !== FALSE) { - $http2_support += 4; - } - } - // Display http2 info. - if ($http2_support & 2) { - $description = t('This server supports HTTP 2.0; the test from @url came back ok.', array('@url' => $url)); - } - else { - if ($http2_support == 0) { - $description = t('AdvAgg can not detect if this server supports HTTP 2.0. You can go here to learn how to enable it.', array('@url' => 'https://httpd.apache.org/docs/2.4/mod/mod_http2.html')); - } - elseif ($http2_support & 4) { - $description = t('It appears that this server could support HTTP 2.0 (apache mod_http2 found)', array( - '@url' => 'https://httpd.apache.org/docs/2.4/mod/mod_http2.html', - )); - if ($http2_support & 1) { - $description .= t(', but it may not be configured to do so. The test from here was inconclusive.', array( - '@test' => $url, - )); - } - else { - if (count($response) == 1) { - $description .= t(', but the test from here was not actually done due to the URL being an IP address or localhost.', array( - '@test' => $url, - )); - } - else { - $description .= t(', but the test from here was inconclusive.', array( - '@test' => $url, - )); - } - } - } - else { - $description = t('This server does not support HTTP 2.0.'); - } - $description .= ' ' . t('This guide can help you get http2 enabled on your site.', array('@url' => 'https://geekflare.com/http2-implementation-apache-nginx/')); - } - if (!empty($description)) { - $form['advagg_http2'] = array( - '#markup' => "

{$description}

", - ); - } - - $form['global_container'] = array( - '#type' => 'container', - '#hidden' => TRUE, - '#states' => array( - 'visible' => array( - ':input[name="advagg_bundler_admin_mode"]' => array('value' => '4'), - ), - ), - ); - - $form['global_container']['advagg_bundler_active'] = array( - '#type' => 'checkbox', - '#title' => t('Bundler is Active (recommended)'), - '#default_value' => variable_get('advagg_bundler_active', ADVAGG_BUNDLER_ACTIVE), - '#description' => t('If not checked, the bundler will passively monitor your site, but it will not split up aggregates.'), - ); - - $options = array( - 0 => 0, - 1 => 1, - 2 => 2, - 3 => 3, - 4 => 4, - 5 => 5, - 6 => 6, - 7 => 7, - 8 => 8, - 9 => 9, - 10 => 10, - 11 => 11, - 12 => 12, - 13 => 13, - 14 => 14, - 15 => 15, - 16 => 16, - 17 => 17, - 18 => 18, - 19 => 19, - 20 => 20, - 21 => 21, - 22 => 22, - 23 => 23, - 24 => 24, - 25 => 25, - ); - $form['global_container']['advagg_bundler_max_css'] = array( - '#type' => 'select', - '#title' => t('Target Number Of CSS Bundles Per Page'), - '#default_value' => variable_get('advagg_bundler_max_css', ADVAGG_BUNDLER_MAX_CSS), - '#options' => $options, - '#description' => t('If 0 is selected then the bundler is disabled. 2 is recommended for HTTP 1.1 and 25 for HTTP 2.0.'), - '#states' => array( - 'disabled' => array( - '#edit-advagg-bundler-active' => array('checked' => FALSE), - ), - ), - '#recommended_value' => 25, - ); - $form['global_container']['advagg_bundler_max_js'] = array( - '#type' => 'select', - '#title' => t('Target Number Of JS Bundles Per Page'), - '#default_value' => variable_get('advagg_bundler_max_js', ADVAGG_BUNDLER_MAX_JS), - '#options' => $options, - '#description' => t('If 0 is selected then the bundler is disabled. 5 is recommended for HTTP 1.1 and 25 for HTTP 2.0.'), - '#states' => array( - 'disabled' => array( - '#edit-advagg-bundler-active' => array('checked' => FALSE), - ), - ), - '#recommended_value' => 25, - ); - - $form['global_container']['advagg_bundler_grouping_logic'] = array( - '#type' => 'radios', - '#title' => t('Grouping logic'), - '#default_value' => variable_get('advagg_bundler_grouping_logic', ADVAGG_BUNDLER_GROUPING_LOGIC), - '#options' => array( - 0 => t('File count'), - 1 => t('File size'), - ), - '#description' => t('If file count is selected then each bundle will try to have a similar number of original files aggregated inside of it. If file size is selected then each bundle will try to have a similar file size.'), - '#states' => array( - 'disabled' => array( - '#edit-advagg-bundler-active' => array('checked' => FALSE), - ), - ), - '#recommended_value' => 0, - ); - - $form['global_container']['info'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Raw Grouping Info'), - ); - module_load_include('inc', 'advagg', 'advagg.admin'); - $analysis = advagg_bundler_analysis('', TRUE); - - $rawtext = print_r($analysis, TRUE); - $form['global_container']['info']['advagg_bundler_info'] = array( - '#type' => 'textarea', - '#title' => t('%count different groupings', array('%count' => count($analysis))), - '#default_value' => $rawtext, - '#rows' => 30, - ); - - // Clear the cache bins on submit. Also remove advagg_bundler_info so it - // doesn't get added to the variable table. - $form['#submit'][] = 'advagg_bundler_admin_settings_form_submit'; - - return system_settings_form($form); -} - -/** - * Submit callback, clear out the advagg cache bin. - * - * @ingroup advagg_forms_callback - */ -function advagg_bundler_admin_settings_form_submit($form, &$form_state) { - // Clear caches. - advagg_cache_clear_admin_submit(); - - // Unset advagg_bundler_info. - if (isset($form_state['values']['advagg_bundler_info'])) { - unset($form_state['values']['advagg_bundler_info']); - } - - // Reset this form to defaults or recommended values; also show what changed. - advagg_set_admin_form_defaults_recommended($form_state, 'advagg_bundler_admin_mode'); -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_bundler/advagg_bundler.advagg.inc b/html/sites/all/modules/contrib/advagg/advagg_bundler/advagg_bundler.advagg.inc deleted file mode 100644 index 1fed98a6e..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_bundler/advagg_bundler.advagg.inc +++ /dev/null @@ -1,286 +0,0 @@ - $max) { - $remerge_candidate = NULL; - $remerge_key = NULL; - $total_count = 0; - foreach ($final_groupings as $key => $groupings) { - if (count($groupings) > 1) { - if (is_null($remerge_candidate)) { - $remerge_candidate = $groupings; - $remerge_key = $key; - } - elseif (count($remerge_candidate) > count($groupings)) { - $remerge_candidate = $groupings; - $remerge_key = $key; - } - } - } - if (is_null($remerge_candidate)) { - break; - } - advagg_bundler_merge($remerge_candidate, count($remerge_candidate) - 1); - $final_groupings[$remerge_key] = $remerge_candidate; - - $total_count = 0; - foreach ($final_groupings as $key => $groupings) { - $total_count += count($groupings); - } - } - - // Replace $files array with new aggregate filenames. - $files = advagg_generate_filenames($final_groupings, $type); -} - -/** - * @} End of "addtogroup advagg_hooks". - */ - -/** - * Merge bundles together if too many where created. - * - * This preserves the order. - * - * @param array $groupings - * Array of requested groups. - * @param int $max - * Max number of grouping. - */ -function advagg_bundler_merge(array &$groupings, $max) { - $group_count = count($groupings); - - if (!empty($max)) { - // Keep going till array has been merged to the desired size. - while ($group_count > $max) { - // Get array sizes. - // Counts the number of files that are placed into each bundle. - $counts = array(); - $group_hash_counts = array(); - foreach ($groupings as $key => $values) { - // Get the group hash counts. - $file_size = 0; - $group_hash_counts[$key] = 0; - foreach ($values as $data) { - // Skip if bundler data is missing. - if (empty($data['bundler'])) { - continue; - } - $file_size += empty($data['bundler']['filesize_processed']) ? $data['bundler']['filesize'] : $data['bundler']['filesize_processed']; - $group_hash_counts[$key] += intval(substr($data['bundler']['group_hash'], 0, 8)); - } - if (variable_get('advagg_bundler_grouping_logic', ADVAGG_BUNDLER_GROUPING_LOGIC) == 0) { - $counts[$key] = count($values); - } - elseif (variable_get('advagg_bundler_grouping_logic', ADVAGG_BUNDLER_GROUPING_LOGIC) == 1) { - $counts[$key] = $file_size; - } - } - - // Create mapping. - // Calculates the file count of potential merges. It only merges with - // neighbors in order to preserve execution order. - $map = array(); - $prev_key = NULL; - foreach ($counts as $key => $val) { - // First run of the foreach loop; populate prev key/values and continue. - // We can't merge with the previous group in this case. - if (is_null($prev_key)) { - $prev_key = $key; - $prev_val = $val; - continue; - } - - // Array key ($prev_val + $val) is the file count of this new group if - // these 2 groups ($prev_key, $key) where to be merged together. - $map[] = array( - ($prev_val + $val) => array($prev_key, $key), - ); - - // Prep for next run. - $prev_key = $key; - $prev_val = $val; - } - - $group_hash_map = array(); - $prev_key = NULL; - foreach ($group_hash_counts as $key => $val) { - // First run of the foreach loop; populate prev key/values and continue. - // We can't merge with the previous group in this case. - if (is_null($prev_key)) { - $prev_key = $key; - $prev_val = $val; - continue; - } - - // Array value ($prev_val + $val) is the hash count of this new group if - // these 2 groups where to be merged together. - $group_hash_map[$prev_key . ' ' . $key] = $prev_val + $val; - - // Prep for next run. - $prev_key = $key; - $prev_val = $val; - } - - // Get best merge candidate. - // We are looking for the smallest file count. $min is populated with a - // large number (15 bits) so it won't be selected in this process. - $min = PHP_INT_MAX; - $first = NULL; - $last = NULL; - $last_min = NULL; - foreach ($map as $v) { - foreach ($v as $key => $values) { - $min = min($min, $key); - // If the min value (number of files in the proposed merged bundle) is - // the same as the key, then get the 2 bundle keys that generated this - // new min value. - if ($min == $key) { - if ($last_min == $min && !is_null($first) && !is_null($last)) { - list($new_first, $new_last) = $values; - // All things being equal pick the smaller count on the hash. - if ($group_hash_map[$first . ' ' . $last] > $group_hash_map[$new_first . ' ' . $new_last]) { - $first = $new_first; - $last = $new_last; - } - } - else { - list($first, $last) = $values; - } - $last_min = $min; - } - } - } - - // Create the new merged set. - $a = $groupings[$first]; - $b = $groupings[$last]; - $new_set = array_merge($a, $b); - - // Rebuild the array with the new set in the correct place. - $new_groupings = array(); - foreach ($groupings as $key => $files) { - if ($key == $first) { - $new_groupings[$first . ' ' . $last] = $new_set; - } - elseif ($key != $last) { - $new_groupings[$key] = $files; - } - } - $groupings = $new_groupings; - --$group_count; - } - } - - // Error prevention below. - // Make sure there isn't a group that has all files that don't exist or empty. - $bad_groups = array(); - foreach ($groupings as $key => $group) { - $missing_counter = 0; - foreach ($group as $data) { - if (empty($data['bundler']['filesize'])) { - ++$missing_counter; - } - } - - // If all files are missing/empty in this group then it is a bad set. - if ($missing_counter == count($group)) { - $bad_groups[$key] = TRUE; - } - } - - // Add the bad groups to the smallest grouping in this set. - if (!empty($bad_groups)) { - $merge_candidate_key = ''; - $merge_candidate_count = PHP_INT_MAX; - $bad_group = array(); - foreach ($groupings as $key => $group) { - if (isset($bad_groups[$key])) { - // Merge all bad groups into one. - $bad_group = array_merge($bad_group, $group); - - // Delete the bad group from the master set. - unset($groupings[$key]); - continue; - } - - // Find the smallest good grouping. - $min = min($merge_candidate_count, count($group)); - if ($min < $merge_candidate_count) { - $merge_candidate_key = $key; - $merge_candidate_count = $min; - } - } - - // Move the bad files into the smallest good group. - $new_set = isset($groupings[$merge_candidate_key]) ? $groupings[$merge_candidate_key] : array(); - $new_set = array_merge($new_set, $bad_group); - $groupings[$merge_candidate_key] = $new_set; - } -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_bundler/advagg_bundler.info b/html/sites/all/modules/contrib/advagg/advagg_bundler/advagg_bundler.info deleted file mode 100644 index 31477cffe..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_bundler/advagg_bundler.info +++ /dev/null @@ -1,13 +0,0 @@ -name = AdvAgg Bundler -description = Provides intelligent bundling of CSS and JS files by grouping files that belong together. -package = Advanced CSS/JS Aggregation -core = 7.x -dependencies[] = advagg - -configure = admin/config/development/performance/advagg/bundler - -; Information added by Drupal.org packaging script on 2020-11-19 -version = "7.x-2.35" -core = "7.x" -project = "advagg" -datestamp = "1605792717" diff --git a/html/sites/all/modules/contrib/advagg/advagg_bundler/advagg_bundler.install b/html/sites/all/modules/contrib/advagg/advagg_bundler/advagg_bundler.install deleted file mode 100644 index 0cfaf6e4e..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_bundler/advagg_bundler.install +++ /dev/null @@ -1,37 +0,0 @@ - 'Bundler', - 'description' => 'Adjust Bundler settings.', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('advagg_bundler_admin_settings_form'), - 'type' => MENU_LOCAL_TASK, - 'access arguments' => array('administer site configuration'), - 'file path' => $file_path, - 'file' => 'advagg_bundler.admin.inc', - 'weight' => 10, - ); - - return $items; -} - -/** - * Implements hook_advagg_hooks_implemented_alter(). - */ -function advagg_bundler_advagg_hooks_implemented_alter(&$hooks, $all) { - if ($all) { - $hooks['advagg_bundler_analysis_alter'] = array(); - } -} - -/** - * Implements hook_init(). - */ -function advagg_bundler_init() { - if (advagg_bundler_enabled()) { - $GLOBALS['conf']['advagg_core_groups'] = FALSE; - } -} - -/** - * Implements hook_form_FORM_ID_alter(). - */ -function advagg_bundler_form_advagg_admin_settings_form_alter(&$form, $form_state) { - if (advagg_bundler_enabled()) { - $form['global']['advagg_core_groups']['#disabled'] = TRUE; - $form['global']['advagg_core_groups']['#description'] = t('The bundler submodule disables core grouping logic.'); - $form['global']['advagg_core_groups']['#states'] = array(); - } -} - -/** - * @} End of "addtogroup hooks". - */ - -/** - * Returns TRUE if the bundler will run. - */ -function advagg_bundler_enabled() { - if (variable_get('advagg_bundler_active', ADVAGG_BUNDLER_ACTIVE) && (variable_get('advagg_bundler_max_css', ADVAGG_BUNDLER_MAX_CSS) || variable_get('advagg_bundler_max_js', ADVAGG_BUNDLER_MAX_JS))) { - return TRUE; - } -} - -/** - * Given a filename return a bundle key. - * - * @param string $filename - * Filename. - * @param bool $force - * Bypass the cache and get a fresh version of the analysis. - * @param bool $safesql - * Turn off SQL language that might cause errors. - * @param int $depth - * Used to prevent endless loops. - * - * @return string - * String to be used for the grouping key. - */ -function advagg_bundler_analysis($filename = '', $force = FALSE, $safesql = FALSE, $depth = 0) { - // Cache query in a static. - static $analysis = array(); - if (empty($analysis)) { - // See if we have a cached version of this. Generate cache ID. - $query = db_select('advagg_aggregates_versions', 'aav') - ->condition('aav.root', 1) - ->condition('aav.atime', REQUEST_TIME - max(172800, variable_get('advagg_bundler_outdated', ADVAGG_BUNDLER_OUTDATED), '>'), '>'); - $query->addExpression('COUNT(aggregate_filenames_hash)', 'counter'); - $count = $query->execute()->fetchField(); - $ideal_cid = 'advagg:bundler_analysis:' . $count; - - if (!$force) { - // Generate cache IDs. - $counts = range(max(0, $count - 3), $count + 3); - foreach ($counts as $count) { - $cache_ids[] = 'advagg:bundler_analysis:' . $count; - } - - // Get a range of cached bundler_analysis data. - $cache_hits = cache_get_multiple($cache_ids, 'cache_advagg_aggregates'); - if (!empty($cache_hits)) { - if (isset($cache_hits[$ideal_cid])) { - $cache = $cache_hits[$ideal_cid]; - } - elseif (!$force && module_exists('httprl') && httprl_is_background_callback_capable()) { - // Setup callback options array. - $callback_options = array( - array( - 'function' => 'advagg_bundler_analysis', - ), - $filename, TRUE, - ); - // Queue up the request. - httprl_queue_background_callback($callback_options); - // Execute request. - httprl_send_request(); - - // Use most recent bundler_analysis data. - $max = 0; - foreach ($cache_hits as $data) { - if ($data->created > $max) { - $max = $data->created; - $cache = $data; - } - } - } - } - } - - if ($force || empty($cache->data)) { - try { - $analysis = advagg_bundler_analyisis_query($safesql); - // Save results to the cache. - cache_set($ideal_cid, $analysis, 'cache_advagg_aggregates', CACHE_TEMPORARY); - } - catch (PDOException $e) { - if ($depth > 2) { - throw $e; - } - $depth++; - return advagg_bundler_analysis($filename, TRUE, TRUE, $depth); - } - } - else { - $analysis = $cache->data; - } - } - - // If no filename is given pass back then entire query results. - if (empty($filename)) { - return $analysis; - } - - // Return a key to be used in groupings. - if (!empty($analysis[$filename])) { - return $analysis[$filename]; - } - - // We need to return a value that can be used as an array key if the query - // didn't give us anything. - return 0; -} - -/** - * Run the analysis query and return the analysis array. - * - * "Magic Query"; only needs to run once. Results are cached. - * This is what the raw SQL looks like: - * - * @code - * SELECT - * af.filename AS filename, - * af.filesize AS filesize, - * af.mtime AS mtime, - * af.changes AS changes, - * af.linecount AS linecount, - * af.filename_hash AS filename_hash, - * aa.counter AS counter, - * aa.hashlist AS hashlist - * FROM advagg_files af - * INNER JOIN ( - * SELECT - * aa.filename_hash AS filename_hash, - * LPAD(CAST(COUNT(aav.aggregate_filenames_hash) AS char(8)), 8, '0') AS counter, - * HEX(SHA1(GROUP_CONCAT(DISTINCT aa.aggregate_filenames_hash ORDER BY aa.aggregate_filenames_hash ASC))) AS hashlist - * FROM advagg_aggregates aa - * INNER JOIN advagg_aggregates_versions aav - * ON aav.aggregate_filenames_hash = aa.aggregate_filenames_hash - * AND aav.root = 1 - * AND aav.atime > (UNIX_TIMESTAMP() - 1209600) - * GROUP BY aa.filename_hash - * ) aa ON af.filename_hash = aa.filename_hash - * @endcode - * - * @param bool $safesql - * Turn off SQL language that might cause errors. - * - * @return array - * The analysis array. - */ -function advagg_bundler_analyisis_query($safesql) { - // Return a count of how many root bundles all files are used in. Count is - // padded with eight zeros so the count can be key sorted as a string - // without worrying about it getting put in the wrong order. - // Return the bundle_md5's value; we need something more unique than count - // when grouping together. - // Return the filename. Used for lookup. - // We join the advagg bundles and files together making sure to only use - // root bundles that have been used in the last 2 weeks. This prevents an - // old site structure from influencing new bundles. - // Grouping by the filename gives us the count and makes it so we don't - // return a lot of rows. - $db_type = Database::getConnection()->databaseType(); - $schema = Database::getConnection()->schema(); - if ($safesql) { - $mssql_group_concat = FALSE; - $mssql_lpad = FALSE; - $mssql_md5 = FALSE; - $pg9 = FALSE; - } - else { - $mssql_group_concat = method_exists($schema, 'functionExists') && $schema->functionExists('GROUP_CONCAT'); - $mssql_lpad = method_exists($schema, 'functionExists') && $schema->functionExists('LPAD'); - $mssql_md5 = method_exists($schema, 'functionExists') && $schema->functionExists('MD5'); - if ($db_type === 'pgsql') { - $database_connection = Database::getConnection(); - $pg9 = FALSE; - if (version_compare($database_connection->version(), '9') >= 0) { - $pg9 = TRUE; - } - } - } - - // Create join query for the advagg_aggregates table. - $subquery_aggregates = db_select('advagg_aggregates', 'aa'); - - // Counter column. - $fields = array('counter'); - if ($db_type === 'sqlsrv' && !$mssql_lpad) { - // MS SQL does not support LPAD. - $subquery_aggregates->addExpression("RIGHT(REPLICATE('0',8) + CAST(COUNT(aav.aggregate_filenames_hash) AS char(8)),8)", 'counter'); - } - elseif ($db_type === 'sqlite') { - // SQLite does not support LPAD. - $subquery_aggregates->addExpression("substr('00000000' || CAST(COUNT(aav.aggregate_filenames_hash) AS char(8)), -8, 8)", 'counter'); - } - else { - $subquery_aggregates->addExpression("LPAD(CAST(COUNT(aav.aggregate_filenames_hash) AS char(8)), 8, '0')", 'counter'); - } - - // Hashlist column. - if ($db_type === 'mysql') { - $fields[] = 'hashlist'; - db_query('SET SESSION group_concat_max_len = 65535'); - $subquery_aggregates->addExpression('HEX(SHA1(GROUP_CONCAT(DISTINCT aa.aggregate_filenames_hash ORDER BY aa.aggregate_filenames_hash ASC)))', 'hashlist'); - } - elseif ($db_type === 'pgsql') { - if ($pg9) { - $fields[] = 'hashlist'; - $subquery_aggregates->addExpression("MD5(STRING_AGG(DISTINCT(aa.aggregate_filenames_hash), ',' ORDER BY aa.aggregate_filenames_hash ASC))", 'hashlist'); - } - } - elseif ($db_type === 'sqlite') { - $fields[] = 'hashlist'; - $subquery_aggregates->addExpression('GROUP_CONCAT(DISTINCT aa.aggregate_filenames_hash)', 'hashlist'); - $subquery_aggregates->orderBy("aa.aggregate_filenames_hash", "ASC"); - } - elseif ($db_type === 'sqlsrv' && $mssql_group_concat) { - $fields[] = 'hashlist'; - if ($mssql_md5) { - $subquery_aggregates->addExpression('MD5(GROUP_CONCAT(DISTINCT aa.aggregate_filenames_hash))', 'hashlist'); - } - else { - $subquery_aggregates->addExpression('GROUP_CONCAT(DISTINCT aa.aggregate_filenames_hash)', 'hashlist'); - } - // The ORDER BY clause is invalid in views, inline functions, - // derived tables, subqueries, and common table expressions, unless TOP or - // FOR XML is also specified. So no point in doing an order-by like in the - // other cases. - } - - // Create join for the advagg_aggregates_versions table. - // 1209600 = 2 weeks. - $time = REQUEST_TIME - max(172800, variable_get('advagg_bundler_outdated', ADVAGG_BUNDLER_OUTDATED), '>'); - $subquery_aggregates->join('advagg_aggregates_versions', 'aav', "aav.aggregate_filenames_hash=aa.aggregate_filenames_hash AND aav.root=1 AND aav.atime > $time"); - - $subquery_aggregates = $subquery_aggregates->fields('aa', array('filename_hash')) - ->groupBy('aa.filename_hash'); - - // Create main query for the advagg_files table. - $af_fields = array( - 'filename', - 'filesize', - 'mtime', - 'changes', - 'linecount', - 'filename_hash', - ); - // Make drupal_get_installed_schema_version() available. - include_once DRUPAL_ROOT . '/includes/install.inc'; - if (drupal_get_installed_schema_version('advagg') >= 7211) { - $af_fields[] = 'filesize_processed'; - } - - $query = db_select('advagg_files', 'af'); - $query->join($subquery_aggregates, 'aa', 'af.filename_hash=aa.filename_hash'); - $query = $query->fields('af', $af_fields) - ->fields('aa', $fields); - $query->comment('Query called from ' . __FUNCTION__ . '()'); - $results = $query->execute(); - - $analysis = array(); - foreach ($results as $row) { - // Implement slower GROUP_CONCAT functionality for non mysql databases. - if (empty($row->hashlist)) { - $subquery_aggregates_versions = db_select('advagg_aggregates_versions', 'aav') - ->fields('aav') - ->condition('aav.root', 1) - ->condition('aav.atime', REQUEST_TIME - max(172800, variable_get('advagg_bundler_outdated', ADVAGG_BUNDLER_OUTDATED), '>'), '>'); - - $subquery_aggregates = db_select('advagg_aggregates', 'aa'); - $subquery_aggregates->join($subquery_aggregates_versions, 'aav', 'aav.aggregate_filenames_hash=aa.aggregate_filenames_hash'); - $subquery_aggregates = $subquery_aggregates->fields('aa', array('aggregate_filenames_hash')) - ->condition('aa.filename_hash', $row->filename_hash) - ->groupBy('aa.aggregate_filenames_hash') - ->orderBy('aa.aggregate_filenames_hash', 'ASC'); - $subquery_aggregates->comment('Query called from ' . __FUNCTION__ . '()'); - $aa_results = $subquery_aggregates->execute(); - $aa_rows = array(); - foreach ($aa_results as $aa_row) { - $aa_rows[] = $aa_row->aggregate_filenames_hash; - } - $row->hashlist = implode(',', $aa_rows); - } - - $row->hashlist = drupal_hash_base64($row->hashlist); - $analysis[$row->filename] = array( - 'group_hash' => $row->counter . ' ' . $row->hashlist, - 'mtime' => $row->mtime, - 'filesize' => $row->filesize, - 'filesize_processed' => empty($row->filesize_processed) ? $row->filesize : $row->filesize_processed, - 'linecount' => $row->linecount, - 'changes' => $row->changes, - ); - } - arsort($analysis); - - // Invoke hook_advagg_bundler_analysis_alter() to give installed modules a - // chance to alter the analysis array. - drupal_alter('advagg_bundler_analysis', $analysis); - - return $analysis; -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_critical_css/advagg_critical_css.admin.inc b/html/sites/all/modules/contrib/advagg/advagg_critical_css/advagg_critical_css.admin.inc deleted file mode 100644 index c9cae0350..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_critical_css/advagg_critical_css.admin.inc +++ /dev/null @@ -1,381 +0,0 @@ - ".form-item-lookup{padding-bottom:0;margin-bottom:0;}", - 'type' => 'inline', - ); - $form['add_item']['theme'] = array( - '#type' => 'select', - '#title' => t('Theme'), - '#options' => array_combine($themes, $themes), - '#default_value' => $default_theme, - '#description' => t('Theme Default: %default, Current Theme: %current', array( - '%default' => $default_theme, - '%current' => $global_theme, - )), - ); - $form['add_item']['user'] = array( - '#type' => 'select', - '#title' => t('User type'), - '#default_value' => 0, - '#options' => array( - 'anonymous' => t('anonymous'), - 'authenticated' => t('authenticated'), - 'all' => t('all'), - ), - ); - $type_options = array( - 0 => t('Disabled'), - 2 => t('URL'), - 8 => t('Node Type'), - ); - $form['add_item']['type'] = array( - '#type' => 'select', - '#title' => t('Type of lookup'), - '#default_value' => 2, - '#options' => $type_options, - ); - - $form['add_item']['lookup'] = array( - '#type' => 'textfield', - '#title' => t('Value to lookup'), - '#maxlength' => 255, - '#states' => array( - 'disabled' => array( - ':input[name="type"]' => array('value' => 0), - ), - ), - ); - $form['add_item']['lookup_container_disabled'] = array( - '#type' => 'container', - '#states' => array( - 'visible' => array( - ':input[name="type"]' => array('value' => 0), - ), - ), - ); - $form['add_item']['lookup_container_disabled']['disabled'] = array( - '#markup' => '
', - ); - $form['add_item']['lookup_container_current_path'] = array( - '#type' => 'container', - '#states' => array( - 'visible' => array( - ':input[name="type"]' => array('value' => 2), - ), - ), - ); - $form['add_item']['lookup_container_current_path']['current_path'] = array( - '#markup' => t('%front is the front page; can use internal URLs like %internal or an alias like %here', array( - '%front' => '', - '%internal' => 'node/2', - '%here' => current_path(), - )), - ); - $form['add_item']['lookup_container_node_type'] = array( - '#type' => 'container', - '#states' => array( - 'visible' => array( - ':input[name="type"]' => array('value' => 8), - ), - ), - ); - $form['add_item']['lookup_container_node_type']['node_type'] = array( - '#markup' => t('Node type is the machine name of the node; list of node types: @node_types', array( - '@current_path' => 'https://api.drupal.org/api/drupal/includes%21path.inc/function/current_path/7.x', - '@request_path' => 'https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/request_path/7.x', - '@request_uri' => 'https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/request_uri/7.x', - '@node_types' => implode(', ', array_keys(node_type_get_names())), - )), - ); - - $form['add_item']['css'] = array( - '#type' => 'textarea', - '#title' => t('Critical CSS'), - '#description' => t('Can be generated via https://www.sitelocity.com/critical-path-css-generator. If this field is empty this entry will be deleted.', array( - '@url' => 'https://www.sitelocity.com/critical-path-css-generator', - )), - '#default_value' => '', - ); - $form['add_item']['dns'] = array( - '#type' => 'textarea', - '#title' => t('Hostnames to lookup'), - '#description' => t('Hosts that will be connected to.'), - '#default_value' => '', - ); - $form['add_item']['pre'] = array( - '#type' => 'textarea', - '#title' => t('Urls to Preload'), - '#description' => t('Assets for the browser that should be downloaded at a high priority.'), - '#default_value' => '', - ); - - // Lookup saved data. - $query = db_select('advagg_critical_css', 'acc') - ->fields('acc') - ->comment('Query called from ' . __FUNCTION__ . '()'); - $results = $query->execute(); - // Put results into array. - $counter = 0; - foreach ($results as $row) { - $counter++; - $row = (array) $row; - - foreach ($form['add_item'] as $key => $values) { - // Fix the states array for type. - if (!empty($values['#states'])) { - foreach ($values['#states'] as $states_key => $states_values) { - $states_value = reset($values['#states'][$states_key]); - $values['#states'][$states_key] = array(":input[name=\"{$counter}_type\"]" => $states_value); - } - } - $form['existing_items'][$counter]["{$counter}_{$key}"] = $values; - if (isset($row[$key])) { - $form['existing_items'][$counter]["{$counter}_{$key}"]['#default_value'] = $row[$key]; - } - } - - // Add in css to move the text hint up. - $form['#attached']['css'][] = array( - 'data' => ".form-item-{$counter}-lookup{padding-bottom:0;margin-bottom:0;}", - 'type' => 'inline', - ); - - // Add fieldset. - $filename = advagg_url_to_filename($row['lookup'], FALSE); - $base = drupal_get_path('theme', $row['theme']) . "/critical-css/{$row['user']}/"; - if ($row['type'] == 2) { - $base .= "urls/$filename"; - } - elseif ($row['type'] == 8) { - $base .= "type/$filename"; - } - else { - $base = ''; - } - $form['existing_items'][$counter] += array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('@type @theme @user @lookup', array( - '@theme' => $row['theme'], - '@type' => $type_options[$row['type']], - '@user' => $row['user'], - '@lookup' => $row['lookup'], - )), - ); - - if (!empty($base)) { - $form['existing_items'][$counter]['#description'] = t('If you wish to store this configuration in a file
Critical CSS: @css', array( - '@css' => "$base.css", - )); - if (!empty($row['dns'])) { - $form['existing_items'][$counter]['#description'] .= t('
Hostnames: @dns', array( - '@dns' => "$base.dns", - )); - } - if (!empty($row['pre'])) { - $form['existing_items'][$counter]['#description'] .= t('
Preload: @pre', array( - '@pre' => "$base.pre", - )); - } - } - } - - // Add top level fieldsets. - $form['add_item'] += array( - '#type' => 'fieldset', - '#title' => t('Add Critical CSS'), - '#collapsible' => TRUE, - '#collapsed' => $results->rowCount(), - ); - if (!empty($form['existing_items'])) { - $form['existing_items'] += array( - '#type' => 'fieldset', - '#title' => t('Edit Critical CSS'), - ); - } - - $form['advagg_critical_css_selector_blacklist'] = array( - '#type' => 'textarea', - '#title' => t('Selector Blacklist'), - '#description' => t('Selectors to exclude. Enter one per line. Useful for things like google ads.'), - '#default_value' => variable_get('advagg_critical_css_selector_blacklist', ''), - ); - - // Clear the cache bins on submit. - $form['#submit'][] = 'advagg_critical_css_admin_settings_form_submit'; - - // Most code below taken from system_settings_form(). - $form['actions']['#type'] = 'actions'; - $form['actions']['submit'] = array( - '#type' => 'submit', - '#value' => t('Save configuration'), - ); - $form['actions']['disable'] = array( - '#type' => 'submit', - '#value' => t('Disable All From Database'), - '#submit' => array('advagg_critical_css_admin_settings_form_submit_disable'), - ); - if (!empty($_POST) && form_get_errors()) { - drupal_set_message(t('The settings have not been saved because of the errors.'), 'error'); - } - // By default, render the form using theme_system_settings_form(). - if (!isset($form['#theme'])) { - $form['#theme'] = 'system_settings_form'; - } - return $form; -} - -/** - * Submit callback, process the advagg_critical_css form. - * - * Also clear out the advagg cache bin. - * - * @ingroup advagg_forms_callback - */ -function advagg_critical_css_admin_settings_form_submit_disable($form, &$form_state) { - $query = db_select('advagg_critical_css', 'acc') - ->fields('acc') - ->comment('Query called from ' . __FUNCTION__ . '()'); - $results = $query->execute(); - // Put results into array. - $insert_update = array(); - foreach ($results as $row) { - $row = (array) $row; - $new_row = $row; - $new_row['type'] = 0; - $insert_update[] = array( - $row, - $new_row, - ); - } - advagg_critical_css_table_insert_update($insert_update); -} - -/** - * Submit callback, process the advagg_critical_css form. - * - * Also clear out the advagg cache bin. - * - * @ingroup advagg_forms_callback - */ -function advagg_critical_css_admin_settings_form_submit($form, &$form_state) { - // Exclude unnecessary elements. - form_state_values_clean($form_state); - - // Save advagg_critical_css_selector_blacklist. - if (!isset($form_state['values']['advagg_critical_css_selector_blacklist'])) { - $form_state['values']['advagg_critical_css_selector_blacklist'] = ''; - } - $advagg_critical_css_selector_blacklist = variable_get('advagg_critical_css_selector_blacklist', ''); - if ($form_state['values']['advagg_critical_css_selector_blacklist'] !== $advagg_critical_css_selector_blacklist) { - variable_set('advagg_critical_css_selector_blacklist', $form_state['values']['advagg_critical_css_selector_blacklist']); - } - unset($form_state['values']['advagg_critical_css_selector_blacklist']); - - // Rearrange form values into key value pairs. - $items = advagg_critical_css_get_rows_from_form($form_state['values']); - // Get default values. - $default_values = advagg_find_all_recommended_admin_values($form_state['complete form'], '#default_value'); - unset($default_values['form_token']); - $default_items = advagg_critical_css_get_rows_from_form($default_values); - - // Get diff, see what items need to be saved. - $diff = advagg_diff_multi($default_items, $items); - $changed_items = array(); - foreach ($diff as $key => $values) { - $changed_items[$key] = $items[$key]; - } - - // Get items to insert/update and delete. - list($insert_update, $delete) = advagg_critical_css_get_db_operations_arrays($changed_items, $default_items); - advagg_critical_css_table_insert_update($insert_update); - advagg_critical_css_table_delete($delete); - - // Clear caches. - advagg_cache_clear_admin_submit(); - drupal_set_message(t('The configuration options have been saved.')); -} - -/** - * Translate from state values into a nested array strucutre. - * - * @param array $form_state_values - * From state values; from $form_state['values']. - * - * @return array - * Nested array strucutre, each index is a row in the db. - */ -function advagg_critical_css_get_rows_from_form(array $form_state_values) { - $items = array(); - $counter = 0; - foreach ($form_state_values as $key => $values) { - // Get the index from the start of the form name. - $matches = array(); - // 1_type turns into $counter = 1 and $key = type. - preg_match('/^(\d)_(.*)/', $key, $matches); - if (!empty($matches)) { - $counter = $matches[1]; - $key = $matches[2]; - } - $items[$counter][$key] = $values; - } - return $items; -} - -/** - * Given a list of items see what ones need to be inserted/updated or deleted. - * - * @param array $items - * Array of values, representing a row in the db. - * - * @return array - * Nested array strucutre, index 0 is the insert update, 1 is the deleted. - */ -function advagg_critical_css_get_db_operations_arrays(array $items, array $old_items) { - $insert_update = array(); - $delete = array(); - foreach ($items as $key => $values) { - // If the css is empty then this needs to be deleted. - if (empty($values['css'])) { - // Do not delete the new items entry (0); it's not in the db currently. - if (!empty($key)) { - $delete[$key] = $values; - } - } - else { - // Pass along the old key value pairs for db_merge. - if (!empty($old_items[$key])) { - $keys = $old_items[$key] + $values; - } - else { - $keys = $values; - } - $insert_update[$key] = array($keys, $values); - } - } - return array($insert_update, $delete); -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_critical_css/advagg_critical_css.info b/html/sites/all/modules/contrib/advagg/advagg_critical_css/advagg_critical_css.info deleted file mode 100644 index a6a78db0a..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_critical_css/advagg_critical_css.info +++ /dev/null @@ -1,14 +0,0 @@ -name = AdvAgg Critical CSS -description = Control Critical CSS via UI and/or a 3rd party service. -package = Advanced CSS/JS Aggregation -core = 7.x -dependencies[] = advagg -dependencies[] = advagg_mod - -configure = admin/config/development/performance/advagg/critical-css - -; Information added by Drupal.org packaging script on 2020-11-19 -version = "7.x-2.35" -core = "7.x" -project = "advagg" -datestamp = "1605792717" diff --git a/html/sites/all/modules/contrib/advagg/advagg_critical_css/advagg_critical_css.install b/html/sites/all/modules/contrib/advagg/advagg_critical_css/advagg_critical_css.install deleted file mode 100644 index 98c954d6f..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_critical_css/advagg_critical_css.install +++ /dev/null @@ -1,84 +0,0 @@ - 'The critical css to inline.', - 'fields' => array( - 'theme' => array( - 'description' => 'The theme name.', - 'type' => 'varchar', - 'length' => 255, - 'default' => '', - 'binary' => TRUE, - ), - 'type' => array( - 'description' => 'Type like url or node.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - 'user' => array( - 'description' => 'User Type or UID.', - 'type' => 'varchar', - 'length' => 255, - 'default' => '', - 'binary' => TRUE, - ), - 'lookup' => array( - 'description' => 'Value from current_path if url or node type if node.', - 'type' => 'varchar', - 'length' => 255, - 'default' => '', - 'binary' => TRUE, - ), - 'css' => array( - 'description' => 'Critical CSS.', - 'type' => 'blob', - 'size' => 'big', - ), - 'dns' => array( - 'description' => 'Hosts for dns lookedup.', - 'type' => 'blob', - 'size' => 'big', - ), - 'pre' => array( - 'description' => 'URLs for preloading.', - 'type' => 'blob', - 'size' => 'big', - ), - 'settings' => array( - 'description' => 'Extra settings if desired.', - 'type' => 'blob', - 'size' => 'big', - 'translatable' => TRUE, - 'serialize' => TRUE, - ), - ), - 'primary key' => array( - 'lookup', - 'user', - 'type', - 'theme', - ), - ); - - return $schema; -} - -/** - * @} End of "addtogroup hooks". - */ diff --git a/html/sites/all/modules/contrib/advagg/advagg_critical_css/advagg_critical_css.module b/html/sites/all/modules/contrib/advagg/advagg_critical_css/advagg_critical_css.module deleted file mode 100644 index 6bd3c5727..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_critical_css/advagg_critical_css.module +++ /dev/null @@ -1,239 +0,0 @@ - 'Critical CSS', - 'description' => 'Control critical css.', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('advagg_critical_css_admin_settings_form'), - 'type' => MENU_LOCAL_TASK, - 'access arguments' => array('administer site configuration'), - 'file path' => $file_path, - 'file' => 'advagg_critical_css.admin.inc', - 'weight' => 10, - ); - - return $items; -} - -/** - * Implements hook_module_implements_alter(). - */ -function advagg_critical_css_module_implements_alter(&$implementations, $hook) { - // Move critical_css_advagg_mod_critical_css_file_pre_alter to the bottom. - if ($hook === 'critical_css_advagg_mod_critical_css_file_pre_alter' && array_key_exists('advagg_critical_css', $implementations)) { - $item = $implementations['advagg_critical_css']; - unset($implementations['advagg_critical_css']); - $implementations['advagg_critical_css'] = $item; - } -} - -/** - * @} End of "addtogroup hooks". - */ - -/** - * @addtogroup advagg_hooks - * @{ - */ - -/** - * Implements hook_advagg_mod_critical_css_file_pre_alter(). - */ -function advagg_critical_css_advagg_mod_critical_css_file_pre_alter(&$filename, &$params, &$inline_strings) { - list($dirs, $front_page, $object) = $params; - - // Build query parameters. - $lookup = array($dirs[6]); - if ($front_page) { - $lookup = array(''); - } - $lookup[] = $dirs[9]; - $lookup[] = $dirs[10]; - if (!empty($object->type)) { - $lookup[] = $object->type; - } - $type = array(2, 8); - $users = array(rtrim($dirs[2], '/\\'), rtrim($dirs[3], '/\\')); - - // Get Results. - $result = advagg_critical_css_table_get($GLOBALS['theme'], $type, $lookup, $users); - - // Put into the inline strings array. - if (!empty($result)) { - // Set string values. - $inline_strings[0] = $result['css']; - $inline_strings[1] = $result['dns']; - $inline_strings[2] = $result['pre']; - // Disable file lookup. - $dirs[0] = ''; - $dirs[1] = ''; - } - - // Repack the $params array. - $params = array($dirs, $front_page, $object); -} - -/** - * Implements hook_advagg_mod_critical_css_file_post_alter(). - */ -function advagg_critical_css_advagg_mod_critical_css_file_post_alter(&$filename, &$params, &$inline_strings) { - if (!empty($inline_strings[0])) { - // Remove given css selectors. - $selectors = variable_get('advagg_critical_css_selector_blacklist', ''); - $selectors_array = array_filter(array_map('trim', explode("\n", $selectors))); - foreach ($selectors_array as $pattern) { - $pattern = preg_quote($pattern, '/'); - $pattern = "/([^}]*{$pattern}[^{]*[^}]*\})/s"; - $inline_strings[0] = preg_replace($pattern, '', $inline_strings[0]); - } - } -} - -/** - * @} End of "addtogroup advagg_hooks". - */ - -/** - * Get the db select return object. - * - * @param string $theme - * Name of the current theme. - * @param array $type - * Array of int types to lookup. - * @param array $lookup - * The lookup value. - * @param array $user - * Array of user string values. - * - * @return SelectQuery - * Return the SelectQuery object after it has been executed. - */ -function advagg_critical_css_table_get($theme, array $type, array $lookup, array $user) { - $output = array(); - try { - $results = db_select('advagg_critical_css', 'acc') - ->fields('acc') - ->condition('theme', $theme) - ->condition('type', $type, 'IN') - ->condition('user', $user, 'IN') - ->condition('lookup', $lookup, 'IN') - ->orderBy('type', 'DESC') - ->execute(); - - // Get first result. - $output = $results->fetchAssoc(); - - // Check for a better match in other results if they exist. - foreach ($results as $values) { - $values = (array) $values; - if ($values['type'] < $output['type']) { - $output = $values; - break; - } - if ($values['type'] = $output['type']) { - if (($values['user'] === 'anonymous' || $values['user'] === 'authenticated') - && $output['user'] === 'all' - ) { - $output = $values; - break; - } - if (is_int($values['user'])) { - $output = $values; - break; - } - } - } - } - catch (PDOException $e) { - // Log the error if in development mode. - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - watchdog('advagg_critical_css', 'Development Mode - Caught PDO Exception: @info', array('@info' => $e)); - } - } - - return $output; -} - -/** - * Insert/Update data in the advagg_critical_css table. - * - * @param array $records - * List of rows needed that need to be changed in the db. - * - * @return array - * Return array of booleans if anything was written to the database. - */ -function advagg_critical_css_table_insert_update(array $records) { - $return = array(); - foreach ($records as $values) { - list($keys, $record) = $values; - if (!isset($record['settings'])) { - $record['settings'] = ''; - } - try { - $return[] = db_merge('advagg_critical_css') - ->key(array( - 'theme' => $keys['theme'], - 'user' => $keys['user'], - 'type' => $keys['type'], - 'lookup' => $keys['lookup'], - )) - ->fields($record) - ->execute(); - } - catch (PDOException $e) { - // Log the error if in development mode. - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - watchdog('advagg_critical_css', 'Development Mode - Caught PDO Exception: @info', array('@info' => $e)); - } - } - } - return $return; -} - -/** - * Delete data in the advagg_critical_css table. - * - * @param array $records - * List of rows needed that need to be removed from the db. - * - * @return array - * Return array of booleans if anything was removed from the database. - */ -function advagg_critical_css_table_delete(array $records) { - $return = array(); - foreach ($records as $record) { - try { - $return[] = db_delete('advagg_critical_css') - ->condition('theme', $record['theme']) - ->condition('user', $record['user']) - ->condition('type', $record['type']) - ->condition('lookup', $record['lookup']) - ->execute(); - } - catch (PDOException $e) { - // Log the error if in development mode. - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - watchdog('advagg_critical_css', 'Development Mode - Caught PDO Exception: @info', array('@info' => $e)); - } - } - } - return $return; -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_css_cdn/advagg_css_cdn.info b/html/sites/all/modules/contrib/advagg/advagg_css_cdn/advagg_css_cdn.info deleted file mode 100644 index e6e0319a9..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_css_cdn/advagg_css_cdn.info +++ /dev/null @@ -1,11 +0,0 @@ -name = AdvAgg CDN CSS -description = Use a shared CDN for CSS libraries, Google Libraries API currently. -package = Advanced CSS/JS Aggregation -core = 7.x -dependencies[] = advagg - -; Information added by Drupal.org packaging script on 2020-11-19 -version = "7.x-2.35" -core = "7.x" -project = "advagg" -datestamp = "1605792717" diff --git a/html/sites/all/modules/contrib/advagg/advagg_css_cdn/advagg_css_cdn.install b/html/sites/all/modules/contrib/advagg/advagg_css_cdn/advagg_css_cdn.install deleted file mode 100644 index 213c2599c..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_css_cdn/advagg_css_cdn.install +++ /dev/null @@ -1,65 +0,0 @@ -jquery update settings page and select a CDN instead of using this module.', array( - '@settings' => url('admin/config/development/jquery_update', array( - 'fragment' => 'edit-jquery-update-jquery-cdn', - )), - )); - } - else { - $jquery_description = $t('The jquery update module is already configured to use the external CDN "@cdn".', array('@cdn' => $jquery_cdn)); - } - - $requirements['advagg_css_cdn_jquery_update'] = array( - 'title' => $t('Adv CSS CDN - jquery update'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('Duplicate Functionality: Use jquery update instead of the advagg_css_cdn sub module.'), - 'description' => $jquery_description . ' ' . $t('You should go to the modules page and disable the "AdvAgg CDN CSS" module.', array( - '@modules' => url('admin/modules', array( - 'fragment' => 'edit-modules-advanced-cssjs-aggregation', - )), - )), - ); - } - - if (empty($requirements)) { - $requirements['advagg_css_cdn'] = array( - 'title' => $t('Adv CSS CDN'), - 'severity' => REQUIREMENT_OK, - 'value' => $t('OK'), - 'description' => $t('jQuery UI CSS should be coming from a CDN.'), - ); - } - - return $requirements; -} - -/** - * @} End of "addtogroup hooks". - */ diff --git a/html/sites/all/modules/contrib/advagg/advagg_css_cdn/advagg_css_cdn.module b/html/sites/all/modules/contrib/advagg/advagg_css_cdn/advagg_css_cdn.module deleted file mode 100644 index bd6cd4283..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_css_cdn/advagg_css_cdn.module +++ /dev/null @@ -1,195 +0,0 @@ - $values) { - // Only modify if - // advagg_css_cdn_jquery_ui is enabled, - // name is in the $ui_mapping array. - // and type is file. - if (variable_get('advagg_css_cdn_jquery_ui', ADVAGG_CSS_CDN_JQUERY_UI) - && array_key_exists($name, $ui_mapping) - && $css[$name]['type'] === 'file' - ) { - $css[$name]['data'] = '//ajax.googleapis.com/ajax/libs/jqueryui/' . $jquery_ui_version . '/themes/base/jquery.' . $ui_mapping[$name] . '.css'; - $css[$name]['type'] = 'external'; - - // Fallback does not work do to - // "SecurityError: The operation is insecure.". - } - } -} - -/** - * @} End of "addtogroup hooks". - */ - -/** - * @addtogroup advagg_hooks - * @{ - */ - -/** - * Implements hook_advagg_css_groups_alter(). - */ -function advagg_css_cdn_advagg_css_groups_alter(&$css_groups, $preprocess_css) { - // Work around a bug with seven_css_alter. - // http://drupal.org/node/1937860 - $theme_keys[] = $GLOBALS['theme']; - if (!empty($GLOBALS['base_theme_info'])) { - foreach ($GLOBALS['base_theme_info'] as $base) { - $theme_keys[] = $base->name; - } - } - $match = FALSE; - foreach ($theme_keys as $name) { - if ($name === 'seven') { - $match = TRUE; - } - } - if (empty($match)) { - return; - } - - $target = FALSE; - $last_group = FALSE; - $last_key = FALSE; - $kill_key = FALSE; - $replaced = FALSE; - foreach ($css_groups as $key => $group) { - if (empty($target)) { - if ($group['type'] === 'external' && $group['preprocess'] && $preprocess_css) { - foreach ($group['items'] as $k => $value) { - if ($value['data'] === 'themes/seven/jquery.ui.theme.css') { - // Type should be file and not external (core bug). - $value['type'] = 'file'; - $target = $value; - unset($css_groups[$key]['items'][$k]); - if (empty($css_groups[$key]['items'])) { - unset($css_groups[$key]); - $kill_key = $key; - } - } - } - } - } - else { - $diff = array_merge(array_diff_assoc($group['browsers'], $target['browsers']), array_diff_assoc($target['browsers'], $group['browsers'])); - if ($group['type'] != $target['type'] - || $group['group'] != $target['group'] - || $group['every_page'] != $target['every_page'] - || $group['media'] != $target['media'] - || $group['media'] != $target['media'] - || $group['preprocess'] != $target['preprocess'] - || !empty($diff) - ) { - if (!empty($last_group)) { - $diff = array_merge(array_diff_assoc($last_group['browsers'], $target['browsers']), array_diff_assoc($target['browsers'], $last_group['browsers'])); - if ($last_group['type'] != $target['type'] - || $last_group['group'] != $target['group'] - || $last_group['every_page'] != $target['every_page'] - || $last_group['media'] != $target['media'] - || $last_group['media'] != $target['media'] - || $last_group['preprocess'] != $target['preprocess'] - || !empty($diff) - ) { - // Insert New. - $css_groups[$kill_key] = array( - 'group' => $target['group'], - 'type' => $target['type'], - 'every_page' => $target['every_page'], - 'media' => $target['media'], - 'preprocess' => $target['preprocess'], - 'browsers' => $target['browsers'], - 'items' => array($target), - ); - $replaced = TRUE; - } - else { - // Insert above. - $css_groups[$last_key]['items'][] = $target; - $replaced = TRUE; - } - } - } - else { - // Insert below. - array_unshift($css_groups[$key]['items'], $target); - $replaced = TRUE; - } - } - $last_group = $group; - $last_key = $key; - if ($replaced) { - break; - } - } - ksort($css_groups); -} - -/** - * @} End of "addtogroup advagg_hooks". - */ - -/** - * Return an array of jquery ui files. - */ -function advagg_css_cdn_get_ui_mapping() { - // Replace jQuery UI's CSS, beginning by defining the mapping. - $ui_mapping = array( - 'misc/ui/jquery.ui.accordion.css' => 'ui.accordion', - 'misc/ui/jquery.ui.autocomplete.css' => 'ui.autocomplete', - 'misc/ui/jquery.ui.button.css' => 'ui.button', - 'misc/ui/jquery.ui.core.css' => 'ui.core', - 'misc/ui/jquery.ui.datepicker.css' => 'ui.datepicker', - 'misc/ui/jquery.ui.dialog.css' => 'ui.dialog', - 'misc/ui/jquery.ui.progressbar.css' => 'ui.progressbar', - 'misc/ui/jquery.ui.resizable.css' => 'ui.resizable', - 'misc/ui/jquery.ui.selectable.css' => 'ui.selectable', - 'misc/ui/jquery.ui.slider.css' => 'ui.slider', - 'misc/ui/jquery.ui.tabs.css' => 'ui.tabs', - 'misc/ui/jquery.ui.theme.css' => 'ui.theme', - ); - return $ui_mapping; -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.admin.inc b/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.admin.inc deleted file mode 100644 index 66e1a1076..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.admin.inc +++ /dev/null @@ -1,157 +0,0 @@ - '

' . t('The settings below will not have any effect because AdvAgg is currently in development mode. Once the cache settings have been set to normal or aggressive, CSS minification will take place.', array('@devel' => url($config_path . '/advagg', array('fragment' => 'edit-advagg-cache-level')))) . '

', - ); - } - - // Tell user to update library if a new version is available. - $library_name = 'YUI-CSS-compressor-PHP-port'; - $module_name = 'advagg_css_compress'; - list($description) = advagg_get_version_description($library_name, $module_name); - if (!empty($description)) { - $form['advagg_version_msg'] = array( - '#markup' => "

{$description}

", - ); - } - - list($options, $description) = advagg_css_compress_configuration(); - - $form['advagg_css_compressor'] = array( - '#type' => 'radios', - '#title' => t('File Compression: Select a Compressor'), - '#default_value' => variable_get('advagg_css_compressor', ADVAGG_CSS_COMPRESSOR), - '#options' => $options, - '#description' => filter_xss($description), - ); - $inline_options = $options; - unset($inline_options[-1]); - $inline_options[0] = t('Disabled'); - $form['advagg_css_compress_inline'] = array( - '#type' => 'radios', - '#title' => t('Inline Compression: Select a Compressor'), - '#default_value' => variable_get('advagg_css_compress_inline', ADVAGG_CSS_COMPRESS_INLINE), - '#options' => $inline_options, - '#description' => filter_xss($description), - ); - $form['advagg_css_compress_inline_if_not_cacheable'] = array( - '#type' => 'checkbox', - '#title' => t('Inline Compression: Use even if this page is not cacheable'), - '#default_value' => variable_get('advagg_css_compress_inline_if_not_cacheable', ADVAGG_CSS_COMPRESS_INLINE_IF_NOT_CACHEABLE), - '#description' => t('By checking this box, all Inline CSS will be compressed regardless of the state of drupal_page_is_cacheable().', array('@link' => 'http://api.drupal.org/api/drupal/includes!bootstrap.inc/function/drupal_page_is_cacheable/7')), - '#states' => array( - 'disabled' => array( - ':input[name="advagg_css_compress_inline"]' => array('value' => "0"), - ), - ), - ); - - $options[ADVAGG_CSS_COMPRESSOR_FILE_SETTINGS] = t('Default'); - ksort($options); - - $form['per_file_settings'] = array( - '#type' => 'fieldset', - '#title' => t('Per File Settings'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - ); - // Get filename and filename_hash. - $results = db_select('advagg_files', 'af') - ->fields('af', array('filename')) - ->condition('filetype', 'css') - ->orderBy('filename', 'ASC') - ->execute(); - $file_settings = variable_get('advagg_css_compressor_file_settings', array()); - foreach ($results as $row) { - $dir = dirname($row->filename); - if (!isset($form['per_file_settings'][$dir])) { - $form['per_file_settings'][$dir] = array( - '#type' => 'fieldset', - '#title' => check_plain($dir), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - ); - } - $form_api_filename = str_replace(array('/', '.'), array('__', '--'), $row->filename); - $form['per_file_settings'][$dir]['advagg_css_compressor_file_settings_' . $form_api_filename] = array( - '#type' => 'radios', - '#title' => t('%filename: Select a Compressor', array('%filename' => $row->filename)), - '#default_value' => isset($file_settings[$form_api_filename]) ? $file_settings[$form_api_filename] : ADVAGG_CSS_COMPRESSOR_FILE_SETTINGS, - '#options' => $options, - ); - if ($form['per_file_settings'][$dir]['advagg_css_compressor_file_settings_' . $form_api_filename]['#default_value'] != ADVAGG_CSS_COMPRESSOR_FILE_SETTINGS) { - $form['per_file_settings'][$dir]['#collapsed'] = FALSE; - $form['per_file_settings']['#collapsed'] = FALSE; - } - } - - // No css files are found. - if (empty($results)) { - $form['per_file_settings']['#description'] = t('No CSS files have been aggregated. You need to enable aggregation. No css files where found in the advagg_files table.'); - } - - // Clear the cache bins on submit. - $form['#submit'][] = 'advagg_css_compress_admin_settings_form_submit'; - - return system_settings_form($form); -} - -/** - * Submit callback that clears out the advagg cache bin. - * - * Also remove default settings inside of the per_file_settings fieldgroup. - * - * @ingroup advagg_forms_callback - */ -function advagg_css_compress_admin_settings_form_submit($form, &$form_state) { - // Clear caches. - advagg_cache_clear_admin_submit(); - - // Get current defaults. - $file_settings = variable_get('advagg_css_compressor_file_settings', array()); - - // Save per file settings. - $new_settings = array(); - foreach ($form_state['values'] as $key => $value) { - // Skip if not advagg_css_compressor_file_settings. - if (strpos($key, 'advagg_css_compressor_file_settings_') === FALSE) { - continue; - } - // Do not process default settings. - if ($value == ADVAGG_CSS_COMPRESSOR_FILE_SETTINGS) { - unset($form_state['values'][$key]); - continue; - } - $new_settings[substr($key, 36)] = $value; - - // Do not save this field into its own variable. - unset($form_state['values'][$key]); - } - if (!empty($new_settings) || !empty($file_settings)) { - if (empty($new_settings)) { - variable_del('advagg_css_compressor_file_settings'); - } - else { - variable_set('advagg_css_compressor_file_settings', $new_settings); - } - } -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.advagg.inc b/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.advagg.inc deleted file mode 100644 index d152670a4..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.advagg.inc +++ /dev/null @@ -1,110 +0,0 @@ - $settings) { - if (!empty($aggregate_settings['variables']['advagg_css_compressor_file_settings'])) { - $form_api_filename = str_replace(array('/', '.'), array('__', '--'), $filename); - if (isset($aggregate_settings['variables']['advagg_css_compressor_file_settings'][$form_api_filename])) { - $aggregate_settings['variables']['advagg_css_compressor'] = $aggregate_settings['variables']['advagg_css_compressor_file_settings'][$form_api_filename]; - // If one file can not be compressed then the whole aggregrate can not - // be compressed. - if ($aggregate_settings['variables']['advagg_css_compressor'] == 0) { - break; - } - } - } - } - - // Do nothing if the compressor is disabled. - if (empty($aggregate_settings['variables']['advagg_css_compressor'])) { - return; - } - // Do nothing if the cache settings are set to Development. - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - return; - } - - list(, , , $functions) = advagg_css_compress_configuration(); - - if (isset($functions[$aggregate_settings['variables']['advagg_css_compressor']])) { - $run = $functions[$aggregate_settings['variables']['advagg_css_compressor']]; - if (function_exists($run)) { - $functions[$aggregate_settings['variables']['advagg_css_compressor']]($data); - } - } -} - -/** - * @} End of "addtogroup advagg_hooks". - */ - -/** - * Use the CSSmin library from YUI to compress the CSS. - */ -function advagg_css_compress_yui_cssmin(&$data) { - // Try libraries for YUI. - if (is_callable('libraries_load')) { - libraries_load('YUI-CSS-compressor-PHP-port'); - if (class_exists('tubalmartin\CssMin\Minifier')) { - // The "use" alias requires php 5.3. - // @codingStandardsIgnoreLine - $cssmin = new tubalmartin\CssMin\Minifier(); - } - elseif (class_exists('CSSmin')) { - $cssmin = new CSSmin(); - } - } - if (!isset($cssmin)) { - // Load CSSMin.inc if the CSSmin class variable is not set. - if (!class_exists('CSSmin')) { - include drupal_get_path('module', 'advagg_css_compress') . '/yui/CSSMin.inc'; - } - $cssmin = new CSSmin(); - } - if (!isset($cssmin)) { - return; - } - - // Set line break to 4k of text. - if (method_exists($cssmin, 'setLineBreakPosition')) { - $cssmin->setLineBreakPosition(4096); - } - // Compress the CSS splitting lines after 4k of text. - if (method_exists($cssmin, 'run')) { - $compressed = $cssmin->run($data, 4096); - } - if (!empty($compressed)) { - $data = $compressed; - } -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.info b/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.info deleted file mode 100644 index aba0cc76e..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.info +++ /dev/null @@ -1,14 +0,0 @@ -name = AdvAgg Compress CSS -description = Compress CSS with a 3rd party compressor, YUI currently. -package = Advanced CSS/JS Aggregation -core = 7.x -dependencies[] = advagg -recommends[] = libraries - -configure = admin/config/development/performance/advagg/css-compress - -; Information added by Drupal.org packaging script on 2020-11-19 -version = "7.x-2.35" -core = "7.x" -project = "advagg" -datestamp = "1605792717" diff --git a/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.install b/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.install deleted file mode 100644 index b4daf3f6b..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.install +++ /dev/null @@ -1,128 +0,0 @@ - $t('AdvAgg CSS Compressor'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('AdvAgg CSS Compression is disabled.'), - 'description' => $t('Go to the advagg css compress settings page and select a compressor, or go to the modules page and disable the "AdvAgg Compress CSS" module.', array( - '@settings' => url($config_path . '/advagg/css-compress'), - '@modules' => url('admin/modules', array( - 'fragment' => 'edit-modules-advanced-cssjs-aggregation', - )), - )), - ); - } - } - - // Check version. - $lib_name = 'YUI-CSS-compressor-PHP-port'; - $module_name = 'advagg_css_compress'; - list($description, $info) = advagg_get_version_description($lib_name, $module_name); - if (!empty($description)) { - $requirements["{$module_name}_{$lib_name}_updates"] = array( - 'title' => $t('@module_name', array('@module_name' => $info['name'])), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('The @name library needs to be updated.', array('@name' => $lib_name)), - 'description' => $description, - ); - } - - return $requirements; -} - -/** - * Upgrade AdvAgg CSS Compress versions (6.x-1.x and 7.x-1.x) to 7.x-2.x. - */ -function advagg_css_compress_update_7200(&$sandbox) { - // Bail if old DB Table does not exist. - if (!db_table_exists('cache_advagg_css_compress_inline')) { - return t('Nothing needed to happen in AdvAgg CSS Compress.'); - } - - // Remove all old advagg css compress variables. - db_delete('variable') - ->condition('name', 'advagg_css%compress%', 'LIKE') - ->execute(); - - // Remove old schema. - db_drop_table('cache_advagg_css_compress_inline'); - - return t('Upgraded AdvAgg CSS Compress to 7.x-2.x.'); -} - -/** - * Change variable names so they are prefixed with the modules name. - */ -function advagg_css_compress_update_7201(&$sandbox) { - // Rename advagg_css_inline_compressor to advagg_css_compress_inline. - $old = variable_get('advagg_css_inline_compressor', NULL); - if (!is_null($old)) { - variable_del('advagg_css_inline_compressor'); - } - if ($old !== ADVAGG_CSS_COMPRESS_INLINE) { - variable_set('advagg_css_compress_inline', $old); - } - - // Rename advagg_css_inline_compress_if_not_cacheable to - // advagg_css_compress_inline_if_not_cacheable. - $old = variable_get('advagg_css_inline_compress_if_not_cacheable', NULL); - if (!is_null($old)) { - variable_del('advagg_css_inline_compress_if_not_cacheable'); - } - if ($old !== ADVAGG_CSS_COMPRESS_INLINE_IF_NOT_CACHEABLE) { - variable_set('advagg_css_compress_inline_if_not_cacheable', $old); - } -} - -/** - * Remove unused variables from the variable table. - */ -function advagg_css_compress_update_7202(&$sandbox) { - // Remove all old advagg css compress variables. - db_delete('variable') - ->condition('name', 'advagg_css_compressor_file_settings_%', 'LIKE') - ->execute(); -} - -/** - * @} End of "addtogroup hooks". - */ diff --git a/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.module b/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.module deleted file mode 100644 index 5f6fbb231..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_css_compress/advagg_css_compress.module +++ /dev/null @@ -1,231 +0,0 @@ - 'CSS Compression', - 'description' => 'Adjust CSS Compression settings.', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('advagg_css_compress_admin_settings_form'), - 'type' => MENU_LOCAL_TASK, - 'access arguments' => array('administer site configuration'), - 'file path' => $file_path, - 'file' => 'advagg_css_compress.admin.inc', - 'weight' => 10, - ); - - return $items; -} - -/** - * @} End of "addtogroup hooks". - */ - -/** - * @addtogroup advagg_hooks - * @{ - */ - -/** - * Implements hook_advagg_current_hooks_hash_array_alter(). - */ -function advagg_css_compress_advagg_current_hooks_hash_array_alter(&$aggregate_settings) { - $aggregate_settings['variables']['advagg_css_compressor'] = variable_get('advagg_css_compressor', ADVAGG_CSS_COMPRESSOR); - $aggregate_settings['variables']['advagg_css_compressor_file_settings'] = variable_get('advagg_css_compressor_file_settings', array()); -} - -/** - * Implements hook_advagg_modify_css_pre_render_alter(). - * - * Used to compress inline css. - */ -function advagg_css_compress_advagg_modify_css_pre_render_alter(&$children, &$elements) { - // Get variables. - $compressor = variable_get('advagg_css_compress_inline', ADVAGG_CSS_COMPRESS_INLINE); - - // Do nothing if the compressor is disabled. - if (empty($compressor)) { - return; - } - - // Do nothing if the page is not cacheable and inline compress if not - // cacheable is not checked. - if (!variable_get('advagg_css_compress_inline_if_not_cacheable', ADVAGG_CSS_COMPRESS_INLINE_IF_NOT_CACHEABLE) && !drupal_page_is_cacheable()) { - return; - } - - module_load_include('inc', 'advagg_css_compress', 'advagg_css_compress.advagg'); - if ($compressor == 2) { - // Compress any inline CSS with YUI. - foreach ($children as &$values) { - if (!empty($values['#value'])) { - advagg_css_compress_yui_cssmin($values['#value']); - } - } - unset($values); - } -} - -/** - * @} End of "addtogroup advagg_hooks". - */ - -/** - * @addtogroup 3rd_party_hooks - * @{ - */ - -/** - * Implements hook_libraries_info(). - */ -function advagg_css_compress_libraries_info() { - $libraries['YUI-CSS-compressor-PHP-port'] = array( - // Only used in administrative UI of Libraries API. - 'name' => 'YUI CSS compressor PHP port', - 'vendor url' => 'https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port', - 'download url' => 'https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port/archive/master.zip', - 'version callback' => 'advagg_css_compress_libraries_get_version', - 'version arguments' => array( - 'file' => 'README.md', - 'pattern' => '/###\s+v([0-9a-zA-Z\.-]+)/', - 'lines' => 1000, - 'cols' => 20, - 'default_version' => '2.4.8', - ), - 'local version' => '2.4.8-p10', - 'remote' => array( - 'callback' => 'advagg_get_github_version_txt', - 'url' => 'https://cdn.jsdelivr.net/gh/tubalmartin/YUI-CSS-compressor-PHP-port@master/README.md', - ), - 'versions' => array( - '2' => array( - 'files' => array( - 'php' => array( - 'cssmin.php', - 'data/hex-to-named-color-map.php', - 'data/named-to-hex-color-map.php', - ), - ), - ), - '3' => array( - 'files' => array( - 'php' => array( - 'src/Minifier.php', - 'src/Utils.php', - 'src/Colors.php', - 'src/data/hex-to-named-color-map.php', - 'src/data/named-to-hex-color-map.php', - ), - ), - ), - '4' => array( - 'files' => array( - 'php' => array( - 'src/Minifier.php', - 'src/Utils.php', - 'src/Colors.php', - ), - ), - ), - ), - ); - - return $libraries; -} - -/** - * @} End of "addtogroup 3rd_party_hooks". - */ - -/** - * Try libraries_get_version(), on failure use the passed in default_version. - * - * @param array $library - * An associative array containing all information about the library. - * @param array $options - * An associative array containing options for the version parser. - * - * @return string - * Version number. - */ -function advagg_css_compress_libraries_get_version(array $library, array $options) { - $return = libraries_get_version($library, $options); - if (empty($return) && !empty($options['default_version'])) { - $file = DRUPAL_ROOT . '/' . $library['library path'] . '/' . $options['file']; - if (is_readable($file)) { - return $options['default_version']; - } - } - return $return; -} - -/** - * Generate the js compress configuration. - * - * @return array - * Array($options, $description, $compressors, $functions). - */ -function advagg_css_compress_configuration() { - $description = ''; - $options = array( - -1 => t('Disable Core'), - 0 => t('Core'), - 2 => t('YUI'), - ); - - $compressors = array(); - $functions = array( - 2 => 'advagg_css_compress_yui_cssmin', - ); - - // Allow for other modules to alter this list. - $options_desc = array($options, $description); - drupal_alter('advagg_css_compress_configuration', $options_desc, $compressors, $functions); - list($options, $description) = $options_desc; - - return array($options, $description, $compressors, $functions); -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_css_compress/yui/CSSMin.inc b/html/sites/all/modules/contrib/advagg/advagg_css_compress/yui/CSSMin.inc deleted file mode 100644 index 88df45130..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_css_compress/yui/CSSMin.inc +++ /dev/null @@ -1,1263 +0,0 @@ -memoryLimit = 128 * 1048576; // 128MB in bytes - $this->pcreBacktrackLimit = 1000 * 1000; - $this->pcreRecursionLimit = 500 * 1000; - - $this->raisePhpLimits = (bool) $raisePhpLimits; - - $this->numRegex = '(?:\+|-)?\d*\.?\d+' . $this->unitsGroupRegex .'?'; - } - - /** - * Minifies a string of CSS - * @param string $css - * @param int|bool $linebreakPos - * @return string - */ - public function run($css = '', $linebreakPos = false) - { - if (empty($css)) { - return ''; - } - - if ($this->raisePhpLimits) { - $this->doRaisePhpLimits(); - } - - $this->comments = array(); - $this->atRuleBlocks = array(); - $this->preservedTokens = array(); - - // process data urls - $css = $this->processDataUrls($css); - - // process comments - $css = preg_replace_callback('/(?chunkLength} chars aprox. - // Reason: PHP's PCRE functions like preg_replace have a "backtrack limit" - // of 100.000 chars by default (php < 5.3.7) so if we're dealing with really - // long strings and a (sub)pattern matches a number of chars greater than - // the backtrack limit number (i.e. /(.*)/s) PCRE functions may fail silently - // returning NULL and $css would be empty. - $charset = ''; - $charsetRegexp = '/(@charset)( [^;]+;)/i'; - $cssChunks = array(); - $l = strlen($css); - - // if the number of characters is <= {$this->chunkLength}, do not chunk - if ($l <= $this->chunkLength) { - $cssChunks[] = $css; - } else { - // chunk css code securely - for ($startIndex = 0, $i = $this->chunkLength; $i < $l; $i++) { - if ($css[$i - 1] === '}' && $i - $startIndex >= $this->chunkLength) { - $cssChunks[] = $this->strSlice($css, $startIndex, $i); - $startIndex = $i; - // Move forward saving iterations when possible! - if ($startIndex + $this->chunkLength < $l) { - $i += $this->chunkLength; - } - } - } - - // Final chunk - $cssChunks[] = $this->strSlice($css, $startIndex); - } - - // Minify each chunk - for ($i = 0, $n = count($cssChunks); $i < $n; $i++) { - $cssChunks[$i] = $this->minify($cssChunks[$i], $linebreakPos); - // Keep the first @charset at-rule found - if (empty($charset) && preg_match($charsetRegexp, $cssChunks[$i], $matches)) { - $charset = strtolower($matches[1]) . $matches[2]; - } - // Delete all @charset at-rules - $cssChunks[$i] = preg_replace($charsetRegexp, '', $cssChunks[$i]); - } - - // Update the first chunk and push the charset to the top of the file. - $cssChunks[0] = $charset . $cssChunks[0]; - - return trim(implode('', $cssChunks)); - } - - /** - * Sets the approximate number of characters to use when splitting a string in chunks. - * @param int $length - */ - public function set_chunk_length($length) - { - $length = (int) $length; - $this->chunkLength = $length < $this->minChunkLength ? $this->minChunkLength : $length; - } - - /** - * Sets the memory limit for this script - * @param int|string $limit - */ - public function set_memory_limit($limit) - { - $this->memoryLimit = $this->normalizeInt($limit); - } - - /** - * Sets the maximum execution time for this script - * @param int|string $seconds - */ - public function set_max_execution_time($seconds) - { - $this->maxExecutionTime = (int) $seconds; - } - - /** - * Sets the PCRE backtrack limit for this script - * @param int $limit - */ - public function set_pcre_backtrack_limit($limit) - { - $this->pcreBacktrackLimit = (int) $limit; - } - - /** - * Sets the PCRE recursion limit for this script - * @param int $limit - */ - public function set_pcre_recursion_limit($limit) - { - $this->pcreRecursionLimit = (int) $limit; - } - - /** - * Tries to configure PHP to use at least the suggested minimum settings - * @return void - */ - private function doRaisePhpLimits() - { - $phpLimits = array( - 'memory_limit' => $this->memoryLimit, - 'max_execution_time' => $this->maxExecutionTime, - 'pcre.backtrack_limit' => $this->pcreBacktrackLimit, - 'pcre.recursion_limit' => $this->pcreRecursionLimit - ); - - // If current settings are higher respect them. - foreach ($phpLimits as $name => $suggested) { - $current = $this->normalizeInt(ini_get($name)); - - if ($current > $suggested) { - continue; - } - - // memoryLimit exception: allow -1 for "no memory limit". - if ($name === 'memory_limit' && $current === -1) { - continue; - } - - // maxExecutionTime exception: allow 0 for "no memory limit". - if ($name === 'max_execution_time' && $current === 0) { - continue; - } - - ini_set($name, $suggested); - } - } - - /** - * Registers a preserved token - * @param $token - * @return string The token ID string - */ - private function registerPreservedToken($token) - { - $this->preservedTokens[] = $token; - return self::TOKEN . (count($this->preservedTokens) - 1) .'___'; - } - - /** - * Gets the regular expression to match the specified token ID string - * @param $id - * @return string - */ - private function getPreservedTokenPlaceholderRegexById($id) - { - return '/'. self::TOKEN . $id .'___/'; - } - - /** - * Registers a candidate comment token - * @param $comment - * @return string The comment token ID string - */ - private function registerComment($comment) - { - $this->comments[] = $comment; - return '/*'. self::COMMENT . (count($this->comments) - 1) .'___*/'; - } - - /** - * Gets the candidate comment token ID string for the specified comment token ID - * @param $id - * @return string - */ - private function getCommentPlaceholderById($id) - { - return self::COMMENT . $id .'___'; - } - - /** - * Gets the regular expression to match the specified comment token ID string - * @param $id - * @return string - */ - private function getCommentPlaceholderRegexById($id) - { - return '/'. $this->getCommentPlaceholderById($id) .'/'; - } - - /** - * Registers an at rule block token - * @param $block - * @return string The comment token ID string - */ - private function registerAtRuleBlock($block) - { - $this->atRuleBlocks[] = $block; - return self::AT_RULE_BLOCK . (count($this->atRuleBlocks) - 1) .'___'; - } - - /** - * Gets the regular expression to match the specified at rule block token ID string - * @param $id - * @return string - */ - private function getAtRuleBlockPlaceholderRegexById($id) - { - return '/'. self::AT_RULE_BLOCK . $id .'___/'; - } - - /** - * Minifies the given input CSS string - * @param string $css - * @param int|bool $linebreakPos - * @return string - */ - private function minify($css, $linebreakPos) - { - // Restore preserved at rule blocks - for ($i = 0, $max = count($this->atRuleBlocks); $i < $max; $i++) { - $css = preg_replace( - $this->getAtRuleBlockPlaceholderRegexById($i), - $this->escapeReplacementString($this->atRuleBlocks[$i]), - $css, - 1 - ); - } - - // strings are safe, now wrestle the comments - for ($i = 0, $max = count($this->comments); $i < $max; $i++) { - $comment = $this->comments[$i]; - $commentPlaceholder = $this->getCommentPlaceholderById($i); - $commentPlaceholderRegex = $this->getCommentPlaceholderRegexById($i); - - // ! in the first position of the comment means preserve - // so push to the preserved tokens keeping the ! - if (preg_match('/^!/', $comment)) { - $preservedTokenPlaceholder = $this->registerPreservedToken($comment); - $css = preg_replace($commentPlaceholderRegex, $preservedTokenPlaceholder, $css, 1); - // Preserve new lines for /*! important comments - $css = preg_replace('/\R+\s*(\/\*'. $preservedTokenPlaceholder .')/', self::NL.'$1', $css); - $css = preg_replace('/('. $preservedTokenPlaceholder .'\*\/)\s*\R+/', '$1'.self::NL, $css); - continue; - } - - // \ in the last position looks like hack for Mac/IE5 - // shorten that to /*\*/ and the next one to /**/ - if (preg_match('/\\\\$/', $comment)) { - $preservedTokenPlaceholder = $this->registerPreservedToken('\\'); - $css = preg_replace($commentPlaceholderRegex, $preservedTokenPlaceholder, $css, 1); - $i = $i + 1; // attn: advancing the loop - $preservedTokenPlaceholder = $this->registerPreservedToken(''); - $css = preg_replace($this->getCommentPlaceholderRegexById($i), $preservedTokenPlaceholder, $css, 1); - continue; - } - - // keep empty comments after child selectors (IE7 hack) - // e.g. html >/**/ body - if (strlen($comment) === 0) { - $startIndex = $this->indexOf($css, $commentPlaceholder); - if ($startIndex > 2) { - if (substr($css, $startIndex - 3, 1) === '>') { - $preservedTokenPlaceholder = $this->registerPreservedToken(''); - $css = preg_replace($commentPlaceholderRegex, $preservedTokenPlaceholder, $css, 1); - continue; - } - } - } - - // in all other cases kill the comment - $css = preg_replace('/\/\*' . $commentPlaceholder . '\*\//', '', $css, 1); - } - - // Normalize all whitespace strings to single spaces. Easier to work with that way. - $css = preg_replace('/\s+/', ' ', $css); - - // Remove spaces before & after newlines - $css = preg_replace('/\s*'. self::NL .'\s*/', self::NL, $css); - - // Fix IE7 issue on matrix filters which browser accept whitespaces between Matrix parameters - $css = preg_replace_callback( - '/\s*filter:\s*progid:DXImageTransform\.Microsoft\.Matrix\(([^)]+)\)/', - array($this, 'processOldIeSpecificMatrixDefinition'), - $css - ); - - // Shorten & preserve calculations calc(...) since spaces are important - $css = preg_replace_callback('/calc(\(((?:[^()]+|(?1))*)\))/i', array($this, 'processCalc'), $css); - - // Replace positive sign from numbers preceded by : or a white-space before the leading space is removed - // +1.2em to 1.2em, +.8px to .8px, +2% to 2% - $css = preg_replace('/((? -9.0 to -9 - $css = preg_replace('/((?+()\]~=,])/', '$1', $css); - - // Restore spaces for !important - $css = preg_replace('/!important/i', ' !important', $css); - - // bring back the colon - $css = preg_replace('/'. self::CLASSCOLON .'/', ':', $css); - - // retain space for special IE6 cases - $css = preg_replace_callback('/:first-(line|letter)(\{|,)/i', array($this, 'lowercasePseudoFirst'), $css); - - // no space after the end of a preserved comment - $css = preg_replace('/\*\/ /', '*/', $css); - - // lowercase some popular @directives - $css = preg_replace_callback( - '/@(document|font-face|import|(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?keyframes|media|namespace|page|' . - 'supports|viewport)/i', - array($this, 'lowercaseDirectives'), - $css - ); - - // lowercase some more common pseudo-elements - $css = preg_replace_callback( - '/:(active|after|before|checked|disabled|empty|enabled|first-(?:child|of-type)|focus|hover|' . - 'last-(?:child|of-type)|link|only-(?:child|of-type)|root|:selection|target|visited)/i', - array($this, 'lowercasePseudoElements'), - $css - ); - - // lowercase some more common functions - $css = preg_replace_callback( - '/:(lang|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|(?:-(?:moz|webkit)-)?any)\(/i', - array($this, 'lowercaseCommonFunctions'), - $css - ); - - // lower case some common function that can be values - // NOTE: rgb() isn't useful as we replace with #hex later, as well as and() is already done for us - $css = preg_replace_callback( - '/([:,( ]\s*)(attr|color-stop|from|rgba|to|url|-webkit-gradient|' . - '(?:-(?:atsc|khtml|moz|ms|o|wap|webkit)-)?(?:calc|max|min|(?:repeating-)?(?:linear|radial)-gradient))/iS', - array($this, 'lowercaseCommonFunctionsValues'), - $css - ); - - // Put the space back in some cases, to support stuff like - // @media screen and (-webkit-min-device-pixel-ratio:0){ - $css = preg_replace_callback('/(\s|\)\s)(and|not|or)\(/i', array($this, 'processAtRulesOperators'), $css); - - // Remove the spaces after the things that should not have spaces after them. - $css = preg_replace('/([!{}:;>+(\[~=,])\s+/S', '$1', $css); - - // remove unnecessary semicolons - $css = preg_replace('/;+\}/', '}', $css); - - // Fix for issue: #2528146 - // Restore semicolon if the last property is prefixed with a `*` (lte IE7 hack) - // to avoid issues on Symbian S60 3.x browsers. - $css = preg_replace('/(\*[a-z0-9\-]+\s*:[^;}]+)(\})/', '$1;$2', $css); - - // Shorten zero values for safe properties only - $css = $this->shortenZeroValues($css); - - // Shorten font-weight values - $css = preg_replace('/(font-weight:)bold\b/i', '${1}700', $css); - $css = preg_replace('/(font-weight:)normal\b/i', '${1}400', $css); - - // Shorten suitable shorthand properties with repeated non-zero values - $css = preg_replace( - '/(margin|padding):('.$this->numRegex.') ('.$this->numRegex.') (?:\2) (?:\3)(;|\}| !)/i', - '$1:$2 $3$4', - $css - ); - $css = preg_replace( - '/(margin|padding):('.$this->numRegex.') ('.$this->numRegex.') ('.$this->numRegex.') (?:\3)(;|\}| !)/i', - '$1:$2 $3 $4$5', - $css - ); - - // Shorten colors from rgb(51,102,153) to #336699, rgb(100%,0%,0%) to #ff0000 (sRGB color space) - // Shorten colors from hsl(0, 100%, 50%) to #ff0000 (sRGB color space) - // This makes it more likely that it'll get further compressed in the next step. - $css = preg_replace_callback('/rgb\s*\(\s*([0-9,\s\-.%]+)\s*\)(.{1})/i', array($this, 'rgbToHex'), $css); - $css = preg_replace_callback('/hsl\s*\(\s*([0-9,\s\-.%]+)\s*\)(.{1})/i', array($this, 'hslToHex'), $css); - - // Shorten colors from #AABBCC to #ABC or shorter color name. - $css = $this->shortenHexColors($css); - - // Shorten long named colors: white -> #fff. - $css = $this->shortenNamedColors($css); - - // shorter opacity IE filter - $css = preg_replace('/progid:DXImageTransform\.Microsoft\.Alpha\(Opacity=/i', 'alpha(opacity=', $css); - - // Find a fraction that is used for Opera's -o-device-pixel-ratio query - // Add token to add the "\" back in later - $css = preg_replace('/\(([a-z\-]+):([0-9]+)\/([0-9]+)\)/i', '($1:$2'. self::QUERY_FRACTION .'$3)', $css); - - // Patch new lines to avoid being removed when followed by empty rules cases - $css = preg_replace('/'. self::NL .'/', self::NL .'}', $css); - - // Remove empty rules. - $css = preg_replace('/[^{};\/]+\{\}/S', '', $css); - - // Restore new lines for /*! important comments - $css = preg_replace('/'. self::NL .'}/', "\n", $css); - - // Add "/" back to fix Opera -o-device-pixel-ratio query - $css = preg_replace('/'. self::QUERY_FRACTION .'/', '/', $css); - - // Replace multiple semi-colons in a row by a single one - // See SF bug #1980989 - $css = preg_replace('/;;+/', ';', $css); - - // Lowercase all uppercase properties - $css = preg_replace_callback('/(\{|;)([A-Z\-]+)(:)/', array($this, 'lowercaseProperties'), $css); - - // Some source control tools don't like it when files containing lines longer - // than, say 8000 characters, are checked in. The linebreak option is used in - // that case to split long lines after a specific column. - if ($linebreakPos !== false && (int) $linebreakPos >= 0) { - $linebreakPos = (int) $linebreakPos; - for ($startIndex = $i = 1, $l = strlen($css); $i < $l; $i++) { - if ($css[$i - 1] === '}' && $i - $startIndex > $linebreakPos) { - $css = $this->strSlice($css, 0, $i) . "\n" . $this->strSlice($css, $i); - $l = strlen($css); - $startIndex = $i; - } - } - } - - // restore preserved comments and strings in reverse order - for ($i = count($this->preservedTokens) - 1; $i >= 0; $i--) { - $css = preg_replace( - $this->getPreservedTokenPlaceholderRegexById($i), - $this->escapeReplacementString($this->preservedTokens[$i]), - $css, - 1 - ); - } - - // Trim the final string for any leading or trailing white space but respect newlines! - $css = preg_replace('/(^ | $)/', '', $css); - - return $css; - } - - /** - * Searches & replaces all data urls with tokens before we start compressing, - * to avoid performance issues running some of the subsequent regexes against large string chunks. - * @param string $css - * @return string - */ - private function processDataUrls($css) - { - // Leave data urls alone to increase parse performance. - $maxIndex = strlen($css) - 1; - $appenIndex = $index = $lastIndex = $offset = 0; - $sb = array(); - $pattern = '/url\(\s*(["\']?)data:/i'; - - // Since we need to account for non-base64 data urls, we need to handle - // ' and ) being part of the data string. Hence switching to indexOf, - // to determine whether or not we have matching string terminators and - // handling sb appends directly, instead of using matcher.append* methods. - while (preg_match($pattern, $css, $m, 0, $offset)) { - $index = $this->indexOf($css, $m[0], $offset); - $lastIndex = $index + strlen($m[0]); - $startIndex = $index + 4; // "url(".length() - $endIndex = $lastIndex - 1; - $terminator = $m[1]; // ', " or empty (not quoted) - $terminatorFound = false; - - if (strlen($terminator) === 0) { - $terminator = ')'; - } - - while ($terminatorFound === false && $endIndex+1 <= $maxIndex) { - $endIndex = $this->indexOf($css, $terminator, $endIndex + 1); - // endIndex == 0 doesn't really apply here - if ($endIndex > 0 && substr($css, $endIndex - 1, 1) !== '\\') { - $terminatorFound = true; - if (')' !== $terminator) { - $endIndex = $this->indexOf($css, ')', $endIndex); - } - } - } - - // Enough searching, start moving stuff over to the buffer - $sb[] = $this->strSlice($css, $appenIndex, $index); - - if ($terminatorFound) { - $token = $this->strSlice($css, $startIndex, $endIndex); - // Remove all spaces only for base64 encoded URLs. - $token = preg_replace_callback( - '/.+base64,.+/s', - array($this, 'removeSpacesFromDataUrls'), - trim($token) - ); - $preservedTokenPlaceholder = $this->registerPreservedToken($token); - $sb[] = 'url('. $preservedTokenPlaceholder .')'; - $appenIndex = $endIndex + 1; - } else { - // No end terminator found, re-add the whole match. Should we throw/warn here? - $sb[] = $this->strSlice($css, $index, $lastIndex); - $appenIndex = $lastIndex; - } - - $offset = $lastIndex; - } - - $sb[] = $this->strSlice($css, $appenIndex); - - return implode('', $sb); - } - - /** - * Shortens all zero values for a set of safe properties - * e.g. padding: 0px 1px; -> padding:0 1px - * e.g. padding: 0px 0rem 0em 0.0pc; -> padding:0 - * @param string $css - * @return string - */ - private function shortenZeroValues($css) - { - $unitsGroupReg = $this->unitsGroupRegex; - $numOrPosReg = '('. $this->numRegex .'|top|left|bottom|right|center)'; - $oneZeroSafeProperties = array( - '(?:line-)?height', - '(?:(?:min|max)-)?width', - 'top', - 'left', - 'background-position', - 'bottom', - 'right', - 'border(?:-(?:top|left|bottom|right))?(?:-width)?', - 'border-(?:(?:top|bottom)-(?:left|right)-)?radius', - 'column-(?:gap|width)', - 'margin(?:-(?:top|left|bottom|right))?', - 'outline-width', - 'padding(?:-(?:top|left|bottom|right))?' - ); - $nZeroSafeProperties = array( - 'margin', - 'padding', - 'background-position' - ); - - $regStart = '/(;|\{)'; - $regEnd = '/i'; - - // First zero regex start - $oneZeroRegStart = $regStart .'('. implode('|', $oneZeroSafeProperties) .'):'; - - // Multiple zeros regex start - $nZerosRegStart = $regStart .'('. implode('|', $nZeroSafeProperties) .'):'; - - $css = preg_replace( - array( - $oneZeroRegStart .'0'. $unitsGroupReg . $regEnd, - $nZerosRegStart . $numOrPosReg .' 0'. $unitsGroupReg . $regEnd, - $nZerosRegStart . $numOrPosReg .' '. $numOrPosReg .' 0'. $unitsGroupReg . $regEnd, - $nZerosRegStart . $numOrPosReg .' '. $numOrPosReg .' '. $numOrPosReg .' 0'. $unitsGroupReg . $regEnd - ), - array( - '$1$2:0', - '$1$2:$3 0', - '$1$2:$3 $4 0', - '$1$2:$3 $4 $5 0' - ), - $css - ); - - // Remove background-position - array_pop($nZeroSafeProperties); - - // Replace 0 0; or 0 0 0; or 0 0 0 0; with 0 for safe properties only. - $css = preg_replace( - '/('. implode('|', $nZeroSafeProperties) .'):0(?: 0){1,3}(;|\}| !)'. $regEnd, - '$1:0$2', - $css - ); - - // Replace 0 0 0; or 0 0 0 0; with 0 0 for background-position property. - $css = preg_replace('/(background-position):0(?: 0){2,3}(;|\}| !)'. $regEnd, '$1:0 0$2', $css); - - return $css; - } - - /** - * Shortens all named colors with a shorter HEX counterpart for a set of safe properties - * e.g. white -> #fff - * @param string $css - * @return string - */ - private function shortenNamedColors($css) - { - $patterns = array(); - $replacements = array(); - $longNamedColors = array( - 'aliceblue' => '#f0f8ff', - 'antiquewhite' => '#faebd7', - 'aquamarine' => '#7fffd4', - 'black' => '#000', - 'blanchedalmond' => '#ffebcd', - 'blueviolet' => '#8a2be2', - 'burlywood' => '#deb887', - 'cadetblue' => '#5f9ea0', - 'chartreuse' => '#7fff00', - 'chocolate' => '#d2691e', - 'cornflowerblue' => '#6495ed', - 'cornsilk' => '#fff8dc', - 'darkblue' => '#00008b', - 'darkcyan' => '#008b8b', - 'darkgoldenrod' => '#b8860b', - 'darkgray' => '#a9a9a9', - 'darkgreen' => '#006400', - 'darkgrey' => '#a9a9a9', - 'darkkhaki' => '#bdb76b', - 'darkmagenta' => '#8b008b', - 'darkolivegreen' => '#556b2f', - 'darkorange' => '#ff8c00', - 'darkorchid' => '#9932cc', - 'darksalmon' => '#e9967a', - 'darkseagreen' => '#8fbc8f', - 'darkslateblue' => '#483d8b', - 'darkslategray' => '#2f4f4f', - 'darkslategrey' => '#2f4f4f', - 'darkturquoise' => '#00ced1', - 'darkviolet' => '#9400d3', - 'deeppink' => '#ff1493', - 'deepskyblue' => '#00bfff', - 'dodgerblue' => '#1e90ff', - 'firebrick' => '#b22222', - 'floralwhite' => '#fffaf0', - 'forestgreen' => '#228b22', - 'fuchsia' => '#f0f', - 'gainsboro' => '#dcdcdc', - 'ghostwhite' => '#f8f8ff', - 'goldenrod' => '#daa520', - 'greenyellow' => '#adff2f', - 'honeydew' => '#f0fff0', - 'indianred' => '#cd5c5c', - 'lavender' => '#e6e6fa', - 'lavenderblush' => '#fff0f5', - 'lawngreen' => '#7cfc00', - 'lemonchiffon' => '#fffacd', - 'lightblue' => '#add8e6', - 'lightcoral' => '#f08080', - 'lightcyan' => '#e0ffff', - 'lightgoldenrodyellow' => '#fafad2', - 'lightgray' => '#d3d3d3', - 'lightgreen' => '#90ee90', - 'lightgrey' => '#d3d3d3', - 'lightpink' => '#ffb6c1', - 'lightsalmon' => '#ffa07a', - 'lightseagreen' => '#20b2aa', - 'lightskyblue' => '#87cefa', - 'lightslategray' => '#778899', - 'lightslategrey' => '#778899', - 'lightsteelblue' => '#b0c4de', - 'lightyellow' => '#ffffe0', - 'limegreen' => '#32cd32', - 'mediumaquamarine' => '#66cdaa', - 'mediumblue' => '#0000cd', - 'mediumorchid' => '#ba55d3', - 'mediumpurple' => '#9370db', - 'mediumseagreen' => '#3cb371', - 'mediumslateblue' => '#7b68ee', - 'mediumspringgreen' => '#00fa9a', - 'mediumturquoise' => '#48d1cc', - 'mediumvioletred' => '#c71585', - 'midnightblue' => '#191970', - 'mintcream' => '#f5fffa', - 'mistyrose' => '#ffe4e1', - 'moccasin' => '#ffe4b5', - 'navajowhite' => '#ffdead', - 'olivedrab' => '#6b8e23', - 'orangered' => '#ff4500', - 'palegoldenrod' => '#eee8aa', - 'palegreen' => '#98fb98', - 'paleturquoise' => '#afeeee', - 'palevioletred' => '#db7093', - 'papayawhip' => '#ffefd5', - 'peachpuff' => '#ffdab9', - 'powderblue' => '#b0e0e6', - 'rebeccapurple' => '#663399', - 'rosybrown' => '#bc8f8f', - 'royalblue' => '#4169e1', - 'saddlebrown' => '#8b4513', - 'sandybrown' => '#f4a460', - 'seagreen' => '#2e8b57', - 'seashell' => '#fff5ee', - 'slateblue' => '#6a5acd', - 'slategray' => '#708090', - 'slategrey' => '#708090', - 'springgreen' => '#00ff7f', - 'steelblue' => '#4682b4', - 'turquoise' => '#40e0d0', - 'white' => '#fff', - 'whitesmoke' => '#f5f5f5', - 'yellow' => '#ff0', - 'yellowgreen' => '#9acd32' - ); - $propertiesWithColors = array( - 'color', - 'background(?:-color)?', - 'border(?:-(?:top|right|bottom|left|color)(?:-color)?)?', - 'outline(?:-color)?', - '(?:text|box)-shadow' - ); - - $regStart = '/(;|\{)('. implode('|', $propertiesWithColors) .'):([^;}]*)\b'; - $regEnd = '\b/iS'; - - foreach ($longNamedColors as $colorName => $colorCode) { - $patterns[] = $regStart . $colorName . $regEnd; - $replacements[] = '$1$2:$3'. $colorCode; - } - - // Run at least 4 times to cover most cases (same color used several times for the same property) - for ($i = 0; $i < 4; $i++) { - $css = preg_replace($patterns, $replacements, $css); - } - - return $css; - } - - /** - * Compresses HEX color values of the form #AABBCC to #ABC or short color name. - * - * DOES NOT compress CSS ID selectors which match the above pattern (which would break things). - * e.g. #AddressForm { ... } - * - * DOES NOT compress IE filters, which have hex color values (which would break things). - * e.g. filter: chroma(color="#FFFFFF"); - * - * DOES NOT compress invalid hex values. - * e.g. background-color: #aabbccdd - * - * @param string $css - * @return string - */ - private function shortenHexColors($css) - { - // Look for hex colors inside { ... } (to avoid IDs) and - // which don't have a =, or a " in front of them (to avoid filters) - $pattern = - '/(=\s*?["\']?)?#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])(\}|[^0-9a-f{][^{]*?\})/iS'; - $_index = $index = $lastIndex = $offset = 0; - $longHexColors = array( - '#f0ffff' => 'azure', - '#f5f5dc' => 'beige', - '#ffe4c4' => 'bisque', - '#a52a2a' => 'brown', - '#ff7f50' => 'coral', - '#ffd700' => 'gold', - '#808080' => 'gray', - '#008000' => 'green', - '#4b0082' => 'indigo', - '#fffff0' => 'ivory', - '#f0e68c' => 'khaki', - '#faf0e6' => 'linen', - '#800000' => 'maroon', - '#000080' => 'navy', - '#fdf5e6' => 'oldlace', - '#808000' => 'olive', - '#ffa500' => 'orange', - '#da70d6' => 'orchid', - '#cd853f' => 'peru', - '#ffc0cb' => 'pink', - '#dda0dd' => 'plum', - '#800080' => 'purple', - '#f00' => 'red', - '#fa8072' => 'salmon', - '#a0522d' => 'sienna', - '#c0c0c0' => 'silver', - '#fffafa' => 'snow', - '#d2b48c' => 'tan', - '#008080' => 'teal', - '#ff6347' => 'tomato', - '#ee82ee' => 'violet', - '#f5deb3' => 'wheat' - ); - $sb = array(); - - while (preg_match($pattern, $css, $m, 0, $offset)) { - $index = $this->indexOf($css, $m[0], $offset); - $lastIndex = $index + strlen($m[0]); - $isFilter = $m[1] !== null && $m[1] !== ''; - - $sb[] = $this->strSlice($css, $_index, $index); - - if ($isFilter) { - // Restore, maintain case, otherwise filter will break - $sb[] = $m[1] .'#'. $m[2] . $m[3] . $m[4] . $m[5] . $m[6] . $m[7]; - } else { - if (strtolower($m[2]) == strtolower($m[3]) && - strtolower($m[4]) == strtolower($m[5]) && - strtolower($m[6]) == strtolower($m[7])) { - // Compress. - $hex = '#'. strtolower($m[3] . $m[5] . $m[7]); - } else { - // Non compressible color, restore but lower case. - $hex = '#'. strtolower($m[2] . $m[3] . $m[4] . $m[5] . $m[6] . $m[7]); - } - // replace Hex colors with shorter color names - $sb[] = array_key_exists($hex, $longHexColors) ? $longHexColors[$hex] : $hex; - } - - $_index = $offset = $lastIndex - strlen($m[8]); - } - - $sb[] = $this->strSlice($css, $_index); - - return implode('', $sb); - } - - // --------------------------------------------------------------------------------------------- - // CALLBACKS - // --------------------------------------------------------------------------------------------- - - private function processComments($matches) - { - $match = !empty($matches[1]) ? $matches[1] : ''; - return $this->registerComment($match); - } - - private function processStrings($matches) - { - $match = $matches[0]; - $quote = substr($match, 0, 1); - $match = $this->strSlice($match, 1, -1); - - // maybe the string contains a comment-like substring? - // one, maybe more? put'em back then - if (($pos = strpos($match, self::COMMENT)) !== false) { - for ($i = 0, $max = count($this->comments); $i < $max; $i++) { - $match = preg_replace( - $this->getCommentPlaceholderRegexById($i), - $this->escapeReplacementString($this->comments[$i]), - $match, - 1 - ); - } - } - - // minify alpha opacity in filter strings - $match = preg_replace('/progid:DXImageTransform\.Microsoft\.Alpha\(Opacity=/i', 'alpha(opacity=', $match); - - $preservedTokenPlaceholder = $this->registerPreservedToken($match); - return $quote . $preservedTokenPlaceholder . $quote; - } - - private function processAtRuleBlocks($matches) - { - return $this->registerAtRuleBlock($matches[0]); - } - - private function processCalc($matches) - { - $token = preg_replace( - '/\)([+\-]{1})/', - ') $1', - preg_replace( - '/([+\-]{1})\(/', - '$1 (', - trim(preg_replace('/\s*([*\/(),])\s*/', '$1', $matches[2])) - ) - ); - $preservedTokenPlaceholder = $this->registerPreservedToken($token); - return 'calc('. $preservedTokenPlaceholder .')'; - } - - private function processOldIeSpecificMatrixDefinition($matches) - { - $preservedTokenPlaceholder = $this->registerPreservedToken($matches[1]); - return 'filter:progid:DXImageTransform.Microsoft.Matrix('. $preservedTokenPlaceholder .')'; - } - - private function processColon($matches) - { - return preg_replace('/\:/', self::CLASSCOLON, $matches[0]); - } - - private function removeSpacesFromDataUrls($matches) - { - return preg_replace('/\s+/', '', $matches[0]); - } - - private function rgbToHex($matches) - { - $hexColors = array(); - $rgbColors = explode(',', $matches[1]); - - // Values outside the sRGB color space should be clipped (0-255) - for ($i = 0, $l = count($rgbColors); $i < $l; $i++) { - $hexColors[$i] = sprintf("%02x", $this->clampNumberSrgb($this->rgbPercentageToRgbInteger($rgbColors[$i]))); - } - - // Fix for issue #2528093 - if (!preg_match('/[\s,);}]/', $matches[2])) { - $matches[2] = ' '. $matches[2]; - } - - return '#'. implode('', $hexColors) . $matches[2]; - } - - private function hslToHex($matches) - { - $hslValues = explode(',', $matches[1]); - - $rgbColors = $this->hslToRgb($hslValues); - - return $this->rgbToHex(array('', implode(',', $rgbColors), $matches[2])); - } - - private function processAtRulesOperators($matches) - { - return $matches[1] . strtolower($matches[2]) .' ('; - } - - private function lowercasePseudoFirst($matches) - { - return ':first-'. strtolower($matches[1]) .' '. $matches[2]; - } - - private function lowercaseDirectives($matches) - { - return '@'. strtolower($matches[1]); - } - - private function lowercasePseudoElements($matches) - { - return ':'. strtolower($matches[1]); - } - - private function lowercaseCommonFunctions($matches) - { - return ':'. strtolower($matches[1]) .'('; - } - - private function lowercaseCommonFunctionsValues($matches) - { - return $matches[1] . strtolower($matches[2]); - } - - private function lowercaseProperties($matches) - { - return $matches[1] . strtolower($matches[2]) . $matches[3]; - } - - // --------------------------------------------------------------------------------------------- - // HELPERS - // --------------------------------------------------------------------------------------------- - - /** - * Clamps a number between a minimum and a maximum value. - * @param int|float $n the number to clamp - * @param int|float $min the lower end number allowed - * @param int|float $max the higher end number allowed - * @return int|float - */ - private function clampNumber($n, $min, $max) - { - return min(max($n, $min), $max); - } - - /** - * Clamps a RGB color number outside the sRGB color space - * @param int|float $n the number to clamp - * @return int|float - */ - private function clampNumberSrgb($n) - { - return $this->clampNumber($n, 0, 255); - } - - /** - * Escapes backreferences such as \1 and $1 in a regular expression replacement string - * @param $string - * @return string - */ - private function escapeReplacementString($string) - { - return addcslashes($string, '\\$'); - } - - /** - * Converts a HSL color into a RGB color - * @param array $hslValues - * @return array - */ - private function hslToRgb($hslValues) - { - $h = floatval($hslValues[0]); - $s = floatval(str_replace('%', '', $hslValues[1])); - $l = floatval(str_replace('%', '', $hslValues[2])); - - // Wrap and clamp, then fraction! - $h = ((($h % 360) + 360) % 360) / 360; - $s = $this->clampNumber($s, 0, 100) / 100; - $l = $this->clampNumber($l, 0, 100) / 100; - - if ($s == 0) { - $r = $g = $b = $this->roundNumber(255 * $l); - } else { - $v2 = $l < 0.5 ? $l * (1 + $s) : ($l + $s) - ($s * $l); - $v1 = (2 * $l) - $v2; - $r = $this->roundNumber(255 * $this->hueToRgb($v1, $v2, $h + (1/3))); - $g = $this->roundNumber(255 * $this->hueToRgb($v1, $v2, $h)); - $b = $this->roundNumber(255 * $this->hueToRgb($v1, $v2, $h - (1/3))); - } - - return array($r, $g, $b); - } - - /** - * Tests and selects the correct formula for each RGB color channel - * @param $v1 - * @param $v2 - * @param $vh - * @return mixed - */ - private function hueToRgb($v1, $v2, $vh) - { - $vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh); - - if ($vh * 6 < 1) { - return $v1 + ($v2 - $v1) * 6 * $vh; - } - - if ($vh * 2 < 1) { - return $v2; - } - - if ($vh * 3 < 2) { - return $v1 + ($v2 - $v1) * ((2 / 3) - $vh) * 6; - } - - return $v1; - } - - /** - * PHP port of Javascript's "indexOf" function for strings only - * Author: Tubal Martin - * - * @param string $haystack - * @param string $needle - * @param int $offset index (optional) - * @return int - */ - private function indexOf($haystack, $needle, $offset = 0) - { - $index = strpos($haystack, $needle, $offset); - - return ($index !== false) ? $index : -1; - } - - /** - * Convert strings like "64M" or "30" to int values - * @param mixed $size - * @return int - */ - private function normalizeInt($size) - { - if (is_string($size)) { - $letter = substr($size, -1); - $size = intval($size); - switch ($letter) { - case 'M': - case 'm': - return (int) $size * 1048576; - case 'K': - case 'k': - return (int) $size * 1024; - case 'G': - case 'g': - return (int) $size * 1073741824; - } - } - return (int) $size; - } - - /** - * Converts a string containing and RGB percentage value into a RGB integer value i.e. '90%' -> 229.5 - * @param $rgbPercentage - * @return int - */ - private function rgbPercentageToRgbInteger($rgbPercentage) - { - if (strpos($rgbPercentage, '%') !== false) { - $rgbPercentage = $this->roundNumber(floatval(str_replace('%', '', $rgbPercentage)) * 2.55); - } - - return intval($rgbPercentage, 10); - } - - /** - * Rounds a number to its closest integer - * @param $n - * @return int - */ - private function roundNumber($n) - { - return intval(round(floatval($n)), 10); - } - - /** - * PHP port of Javascript's "slice" function for strings only - * Author: Tubal Martin - * - * @param string $str - * @param int $start index - * @param int|bool $end index (optional) - * @return string - */ - private function strSlice($str, $start = 0, $end = false) - { - if ($end !== false && ($start < 0 || $end <= 0)) { - $max = strlen($str); - - if ($start < 0) { - if (($start = $max + $start) < 0) { - return ''; - } - } - - if ($end < 0) { - if (($end = $max + $end) < 0) { - return ''; - } - } - - if ($end <= $start) { - return ''; - } - } - - $slice = ($end === false) ? substr($str, $start) : substr($str, $start, $end - $start); - return ($slice === false) ? '' : $slice; - } -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_ext_compress/advagg_ext_compress.admin.inc b/html/sites/all/modules/contrib/advagg/advagg_ext_compress/advagg_ext_compress.admin.inc deleted file mode 100644 index ec9457a1c..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_ext_compress/advagg_ext_compress.admin.inc +++ /dev/null @@ -1,83 +0,0 @@ - 'fieldset', - '#title' => t('@title', array('@title' => $params[1])), - ); - $form[$params[0]]['cmd'] = array( - '#type' => 'fieldset', - '#title' => t('Command Line'), - ); - - $description = t('{%CWD%} = DRUPAL_ROOT.
{%IN%} = input file.
{%IN_URL_ENC%} = url pointing to the input file that has been url encoded.
{%OUT%} = output file.

'); - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $description .= ' ' . t('Example using the Microsoft Ajax Minifier.

@code1

', array( - '@link1' => 'http://ajaxmin.codeplex.com/', - '@code1' => 'AjaxMinifier {%IN%} -o {%OUT%}', - )); - } - - if ($params[0] === 'js') { - $description .= ' ' . t('Example using the Google Closure Compiler.

@code1

', array( - '@link1' => 'https://developers.google.com/closure/compiler/docs/gettingstarted_app', - '@code1' => 'java -jar compiler.jar --js {%CWD%}/{%IN%} --js_output_file {%OUT%}', - )); - - $description .= ' ' . t('Example using curl to compress via the Online Google Closure Compiler.

@code1

', array( - '@link1' => 'https://developers.google.com/closure/compiler/docs/api-ref', - '@code1' => 'curl -o {%OUT%} -d output_info=compiled_code -d code_url={%IN_URL_ENC%} http://closure-compiler.appspot.com/compile', - )); - } - if ($params[0] === 'css') { - $description .= ' ' . t('Example using the YUI Compressor.

@code1

', array( - '@link1' => 'http://yui.github.io/yuicompressor/', - '@code1' => 'java -jar yuicompressor-x.y.z.jar --type css --line-break 4096 {%CWD%}/{%IN%} -o {%OUT%}', - )); - - $description .= ' ' . t('Example using curl to compress via an online CSS Compressor.

@code1

', array( - '@link1' => 'http://cnvyr.io/', - '@code1' => 'curl -o {%OUT%} -F \'files0=@{%IN%}\' http://srv.cnvyr.io/v1?min=css', - )); - } - - $form[$params[0]]['cmd']['advagg_ext_compress_' . $params[0] . '_cmd'] = array( - '#type' => 'textfield', - '#title' => t('Command to run'), - '#default_value' => variable_get('advagg_ext_compress_' . $params[0] . '_cmd', ''), - '#description' => $description, - ); -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_ext_compress/advagg_ext_compress.info b/html/sites/all/modules/contrib/advagg/advagg_ext_compress/advagg_ext_compress.info deleted file mode 100644 index 955a0c570..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_ext_compress/advagg_ext_compress.info +++ /dev/null @@ -1,13 +0,0 @@ -name = AdvAgg External Compression -description = Compress Javascript and/or CSS with a command line compressor. -package = Advanced CSS/JS Aggregation -core = 7.x -dependencies[] = advagg - -configure = admin/config/development/performance/advagg/ext-compress - -; Information added by Drupal.org packaging script on 2020-11-19 -version = "7.x-2.35" -core = "7.x" -project = "advagg" -datestamp = "1605792717" diff --git a/html/sites/all/modules/contrib/advagg/advagg_ext_compress/advagg_ext_compress.module b/html/sites/all/modules/contrib/advagg/advagg_ext_compress/advagg_ext_compress.module deleted file mode 100644 index 5bfe00f4b..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_ext_compress/advagg_ext_compress.module +++ /dev/null @@ -1,241 +0,0 @@ - 'External Compression', - 'description' => 'Adjust External Compression settings.', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('advagg_ext_compress_admin_settings_form'), - 'type' => MENU_LOCAL_TASK, - 'access arguments' => array('administer site configuration'), - 'file path' => $file_path, - 'file' => 'advagg_ext_compress.admin.inc', - 'weight' => 10, - ); - - return $items; -} - -/** - * @} End of "addtogroup hooks". - */ - -/** - * @addtogroup advagg_hooks - * @{ - */ - -/** - * Implements hook_advagg_js_compress_configuration_alter(). - */ -function advagg_ext_compress_advagg_js_compress_configuration_alter(&$options_desc, &$compressors, &$functions) { - list($options, $description) = $options_desc; - - $key = 10; - while (isset($options[$key])) { - $key++; - } - $options[$key] = t('AdvAgg Command Line Compressor'); - $compressors[$key] = 'advagg_cmdline'; - $functions[$key] = 'advagg_ext_compress_js_compress'; - - $options_desc = array($options, $description); -} - -/** - * Implements hook_advagg_css_compress_configuration_alter(). - */ -function advagg_ext_compress_advagg_css_compress_configuration_alter(&$options_desc, &$compressors, &$functions) { - list($options, $description) = $options_desc; - - $key = 10; - while (isset($options[$key])) { - $key++; - } - $options[$key] = t('AdvAgg Command Line Compressor'); - $functions[$key] = 'advagg_ext_compress_css_compress'; - - $options_desc = array($options, $description); -} - -/** - * @} End of "addtogroup advagg_hooks". - */ - -/** - * Compress Javascript using via command line. - * - * @param string $input_file - * The file containing the uncompressed css/js data. - * @param string $ext - * The string css or js. - * @param array $debug - * Optional debug array. - * - * @return string - * The filename containing the compressed css/js data. - */ -function advagg_ext_compress_execute_cmd($input_file, $ext = '', array &$debug = array()) { - $run = variable_get("advagg_ext_compress_{$ext}_cmd", ''); - if (empty($run)) { - return FALSE; - } - - // Get file extension. - if (empty($ext)) { - $ext = strtolower(pathinfo($input_file, PATHINFO_EXTENSION)); - if ($ext !== 'css' && $ext !== 'js') { - // Get the $ext from the database. - $row = db_select('advagg_files', 'af') - ->fields('af') - ->condition('filename', $input_file) - ->execute()->fetchAssoc(); - if (!empty($row['filetype'])) { - $ext = $row['filetype']; - } - if ($ext === 'less') { - $ext = 'css'; - } - } - } - - // Generate temp file. - $temp_file = drupal_tempnam('temporary://', 'advagg_file_'); - $new_temp_file = $temp_file . '.' . basename($input_file); - @rename($temp_file, $new_temp_file); - // Set the permissions on the temp file. - drupal_chmod($new_temp_file); - $output = advagg_get_relative_path($new_temp_file); - - // Create command to run. - $cmd = str_replace(array( - '{%CWD%}', - '{%IN%}', - '{%IN_URL_ENC%}', - '{%OUT%}', - ), array( - DRUPAL_ROOT, - $input_file, - urlencode(file_create_url($input_file)), - escapeshellarg(realpath($output)), - ), $run); - - // Run command and return the output file. - $shell_output = array(); - $return_var = 0; - $shell = exec($cmd, $shell_output, $return_var); - $debug = array($cmd, $shell_output, $return_var, $shell); - - // Cleanup leftover files. - if (file_exists($temp_file)) { - @unlink($temp_file); - } - return $output; -} - -/** - * Compress Javascript using via command line. - * - * @param string $contents - * The JavaScript to compress. - * @param bool $log_errors - * TRUE to log errors. - * - * @return bool - * FALSE if this failed. - */ -function advagg_ext_compress_js_compress(&$contents, $log_errors) { - return advagg_ext_compress_string($contents, 'js', $log_errors); -} - -/** - * Compress CSS using via command line. - * - * @param string $contents - * The CSS to compress. - * @param bool $log_errors - * TRUE to log errors. - * - * @return bool - * FALSE if this failed. - */ -function advagg_ext_compress_css_compress(&$contents, $log_errors) { - return advagg_ext_compress_string($contents, 'css', $log_errors); -} - -/** - * Compress CSS using via command line. - * - * @param string $contents - * The data to compress. - * @param string $type - * Should be css or js. - * @param bool $log_errors - * TRUE to log errors. - * - * @return bool - * TRUE on success. - */ -function advagg_ext_compress_string(&$contents, $type, $log_errors) { - list($css_path, $js_path) = advagg_get_root_files_dir(); - if ($type === 'css') { - $dir = $css_path[0]; - } - else { - $dir = $js_path[0]; - } - $new_temp_file = $dir . '/advagg_file_' . drupal_hash_base64(microtime(TRUE) . mt_rand()) . '.' . $type; - $temp_file_full = advagg_get_relative_path($new_temp_file); - - file_put_contents($new_temp_file, $contents); - // Set the permissions on the temp file. - drupal_chmod($new_temp_file); - $debug = array(); - $output = advagg_ext_compress_execute_cmd($temp_file_full, $type, $debug); - if (empty($output)) { - return FALSE; - } - $new_contents = advagg_file_get_contents($output); - if (strpos($new_contents, 'Error') === 0) { - if ($log_errors) { - watchdog('advagg_ext_compress', "@a \n
\n
@b", array( - // Only log 4k of data. - '@a' => substr($new_contents, 0, 4096), - '@b' => print_r($debug, TRUE), - )); - } - $return = FALSE; - } - else { - $contents = $new_contents; - $return = TRUE; - } - - // Cleanup. - if (file_exists($new_temp_file)) { - unlink($new_temp_file); - } - if (file_exists($temp_file_full)) { - unlink($temp_file_full); - } - if (file_exists($output)) { - unlink($output); - } - return $return; -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.admin.inc b/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.admin.inc deleted file mode 100644 index 32406e585..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.admin.inc +++ /dev/null @@ -1,209 +0,0 @@ - t('Disabled'), - 6 => t('Externally load the latest from github (version: @version)', array('@version' => $version)), - ); - $description = t('This will use the fallback font until the font has been downloaded. See fontfaceobserver for more info.', array( - '@link' => $library['vendor url'], - )); - if (function_exists('libraries_info')) { - if ($library['installed']) { - $options += array( - 2 => t('Inline javascript (version: @version)', array('@version' => $library['version'])), - 4 => t('Local file included in aggregate (version: @version)', array('@version' => $library['version'])), - ); - } - elseif (!is_readable('sites/all/libraries/fontfaceobserver/fontfaceobserver.js')) { - $description .= ' ' . t('To use fontfaceobserver locally fontfaceobserver needs to be placed inside the sites/all/libraries directory so sites/all/libraries/fontfaceobserver/fontfaceobserver.js and package.json can be found at that location.', array( - '@url' => 'https://www.drupal.org/project/libraries', - )); - } - else { - $description .= ' ' . t('Go to the library report page and make sure fontfaceobserver is installed correctly.', array( - '@url' => url('admin/reports/libraries'), - )); - } - } - elseif (is_readable('sites/all/libraries/fontfaceobserver/fontfaceobserver.js')) { - $description .= ' ' . t('To use fontfaceobserver locally the libraries api module needs to be installed.', array( - '@url' => 'https://www.drupal.org/project/libraries', - )); - } - else { - $description .= ' ' . t('To use fontfaceobserver locally the libraries api module needs to be installed and then fontfaceobserver needs to be placed inside the sites/all/libraries directory so sites/all/libraries/fontfaceobserver/fontfaceobserver.js and package.json can be found at that location.', array( - '@url' => 'https://www.drupal.org/project/libraries', - )); - } - - ksort($options); - $form['advagg_font_fontfaceobserver'] = array( - '#type' => 'radios', - '#title' => t('Use font face observer to load fonts asynchronously.'), - '#default_value' => variable_get('advagg_font_fontfaceobserver', ADVAGG_FONT_FONTFACEOBSERVER), - '#options' => $options, - '#description' => $description, - ); - - $form['container'] = array( - '#type' => 'container', - '#states' => array( - 'invisible' => array( - ':input[name="advagg_font_fontfaceobserver"]' => array('value' => '0'), - ), - ), - ); - $form['container']['advagg_font_storage'] = array( - '#type' => 'checkbox', - '#title' => t('Use localStorage so the flash of unstyled text (FOUT) only happens once.'), - '#default_value' => variable_get('advagg_font_storage', ADVAGG_FONT_STORAGE), - '#description' => t('Data is stored in localStorage under advagg_fonts. If this is a problem you can disable localStorage from being used; if doing so the FOUT (Flash of Unstyled Text) will happen on every page load if cookies is also not being used.', array('@cookie' => 'advaggfont_pt-sans=PT Sans')), - ); - $form['container']['advagg_font_cookie'] = array( - '#type' => 'checkbox', - '#title' => t('Set a cookie so the flash of unstyled text (FOUT) only happens once.'), - '#default_value' => variable_get('advagg_font_cookie', ADVAGG_FONT_COOKIE), - '#description' => t('Cookies are name like @cookie. If this is a problem you can disable cookies from being set; if doing so the FOUT (Flash of Unstyled Text) will happen on every page load if localStorage is also not being used.', array('@cookie' => 'advaggfont_pt-sans=PT Sans')), - ); - $form['container']['advagg_font_no_fout'] = array( - '#type' => 'checkbox', - '#title' => t('Prevent the Flash of Unstyled Text.'), - '#default_value' => variable_get('advagg_font_no_fout', ADVAGG_FONT_NO_FOUT), - '#description' => t('The font will not be changed unless the browser already has the font downloaded. Font gets downloaded on the first page view.', array('@cookie' => 'advaggfont_pt-sans=PT Sans')), - '#states' => array( - 'disabled' => array( - '#edit-advagg-font-cookie' => array('checked' => FALSE), - '#edit-advagg-font-storage' => array('checked' => FALSE), - ), - ), - ); - - // Get all css files and scan for quoted fonts. - $form['fonts'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('Async Loaded fonts in CSS'), - '#description' => t('Assumes quoted fonts will be downloaded and unquoted fonts are fallbacks.'), - ); - $form['fonts_not_async'] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => t('NOT Async Loaded in CSS'), - '#description' => t('Assumes quoted fonts will be downloaded and unquoted fonts are fallbacks. If there is no fallback it will apear below.'), - ); - // Get filename, filename_hash, and changes. - $results = db_select('advagg_files', 'af') - ->fields('af', array('filename', 'filename_hash', 'changes')) - ->condition('filetype', 'css') - ->orderBy('filename', 'ASC') - ->execute(); - while ($row = $results->fetchAssoc()) { - if (!file_exists($row['filename'])) { - continue; - } - // Get the file contents. - $file_contents = (string) @advagg_file_get_contents($row['filename']); - // Get font names. - list($replacements, $fonts_with_no_replacements) = advagg_font_get_replacements_array($file_contents); - if (!empty($replacements)) { - $fonts = array(); - foreach ($replacements as $key => $replacement) { - // Do not display !important after the fallback font name. - $replacement[5] = str_replace(' !important', '', $replacement[5]); - $fonts[$key . ' ' . $replacement[3]] = $replacement[5]; - } - - $form['fonts'][$row['filename_hash']] = array( - '#markup' => '
' . t('%file - @replacements
', array( - '@replacements' => str_ireplace('array', '', print_r($fonts, TRUE)), - '%file' => $row['filename'], - )) . '
', - ); - } - if (!empty($fonts_with_no_replacements)) { - $fonts = array(); - foreach ($fonts_with_no_replacements as $key => $replacement) { - // Do not display !important after the fallback font name. - $replacement = str_replace(' !important', '', $replacement); - $fonts[$key . ' ' . $replacement] = $replacement; - } - - $form['fonts_not_async'][$row['filename_hash']] = array( - '#markup' => '
' . t('%file - @replacements
', array( - '@replacements' => str_ireplace('array', '', print_r($fonts, TRUE)), - '%file' => $row['filename'], - )) . '
', - ); - } - } - $children = element_children($form['fonts']); - - // If no fonts are found; disable this module. - if (count($children) == 0) { - $form['advagg_font_fontfaceobserver']['#default_value'] = 0; - $form['advagg_font_fontfaceobserver']['#disabled'] = TRUE; - - if (empty($results)) { - $form['fonts'] = array( - '#type' => 'fieldset', - '#title' => t('No CSS files have been aggregated.'), - '#description' => t('You need to enable aggregation. No css files where found in the advagg_files table.'), - ); - } - else { - $form['fonts'] = array( - '#type' => 'fieldset', - '#title' => t('No CSS files with external fonts found.'), - '#description' => t('Currently this module is not doing anything. Recommend uninstalling it as advagg is not processing any css files that use an external font file.'), - ); - } - } - - // Clear the cache bins on submit. - $form['#submit'][] = 'advagg_font_admin_settings_form_submit'; - - return system_settings_form($form); -} - -/** - * Submit callback, clear out the advagg cache bin. - * - * @ingroup advagg_forms_callback - */ -function advagg_font_admin_settings_form_submit($form, &$form_state) { - // Clear caches. - advagg_cache_clear_admin_submit(); - - // Disable cookie and local storage if ffo is disabled. - if (empty($form_state['values']['advagg_font_fontfaceobserver'])) { - $form_state['values']['advagg_font_cookie'] = 0; - $form_state['values']['advagg_font_storage'] = 0; - } - // Disable no fout if cookies and local storage are disabled. - if (empty($form_state['values']['advagg_font_cookie']) - && empty($form_state['values']['advagg_font_storage']) - ) { - $form_state['values']['advagg_font_no_fout'] = 0; - } -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.advagg.inc b/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.advagg.inc deleted file mode 100644 index ef1ef3a04..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.advagg.inc +++ /dev/null @@ -1,63 +0,0 @@ -= current_time) { - // Only allow alpha numeric class names. - window.document.documentElement.className += ' ' + key.replace(/[^a-zA-Z0-9-]/g, ''); - } - } - } -} - - -// Check cookies ASAP and set class. -advagg_font_inline(); diff --git a/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.install b/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.install deleted file mode 100644 index 24081aba9..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.install +++ /dev/null @@ -1,61 +0,0 @@ - $t('AdvAgg Font'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('AdvAgg async font loading is disabled.'), - 'description' => $t('Go to the AdvAgg Async Font Loader settings page and select an option other than disabled, or go to the modules page and disable the "AdvAgg Async Font Loader" module.', array( - '@settings' => url($config_path . '/advagg/font'), - '@modules' => url('admin/modules', array( - 'fragment' => 'edit-modules-advanced-cssjs-aggregation', - )), - )), - ); - } - - // Check version. - $lib_name = 'fontfaceobserver'; - $module_name = 'advagg_css_compress'; - list($description, $info) = advagg_get_version_description($lib_name, $module_name); - if (!empty($description)) { - $requirements["{$module_name}_{$lib_name}_updates"] = array( - 'title' => $t('@module_name', array('@module_name' => $info['name'])), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('The @name library needs to be updated.', array('@name' => $lib_name)), - 'description' => $description, - ); - } - - return $requirements; -} - -/** - * @} End of "addtogroup hooks". - */ diff --git a/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.js b/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.js deleted file mode 100644 index 8b031464f..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.js +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @file - * Used to add a class to the top level element when an external font is ready. - */ - -/* global Drupal:false */ - -/** - * Run the check. - * - * @param {string} key - * The class name to add to the html tag. - * @param {string} value - * The font name. - */ -function advagg_run_check(key, value) { - 'use strict'; - // Only run if window.FontFaceObserver is defined. - if (window.FontFaceObserver) { - // Only alpha numeric value. - key = key.replace(/[^a-zA-Z0-9-]/g, ''); - if (typeof window.FontFaceObserver.prototype.load === 'function') { - new window.FontFaceObserver(value).load().then(function () { - advagg_run_check_inner(key, value); - }, function () {}); - } - else { - new window.FontFaceObserver(value).check().then(function () { - advagg_run_check_inner(key, value); - }, function () {}); - } - } - else { - // Try again in 100 ms. - window.setTimeout(function () { - advagg_run_check(key, value); - }, 100); - } -} - -/** - * Run the check. - * - * @param {string} key - * The class name to add to the html tag. - * @param {string} value - * The font name. - */ -function advagg_run_check_inner(key, value) { - 'use strict'; - // Set Class. - if (parseInt(Drupal.settings.advagg_font_no_fout, 10) !== 1) { - window.document.documentElement.className += ' ' + key; - } - - // Set for a day. - var expire_date = new Date().getTime() + 86400 * 1000; - - if (Storage !== void 0 && parseInt(Drupal.settings.advagg_font_storage, 10) === 1) { - // Use local storage. - var fonts = JSON.parse(localStorage.getItem('advagg_fonts')); - if (!fonts) { - fonts = {}; - } - fonts[key] = expire_date; - localStorage.setItem('advagg_fonts', JSON.stringify(fonts)); - } - else if (parseInt(Drupal.settings.advagg_font_cookie, 10) === 1) { - // Use cookies if enabled and local storage not available. - expire_date = new Date(expire_date).toUTCString(); - document.cookie = 'advaggfont_' + key + '=' + value - + '; expires=' + expire_date - + '; domain=.' + document.location.hostname - + '; path=/'; - } -} - -/** - * Get the list of fonts to check for. - */ -function advagg_font_add_font_classes_on_load() { - 'use strict'; - for (var key in Drupal.settings.advagg_font) { - if (Drupal.settings.advagg_font.hasOwnProperty(key)) { - var html_class = (' ' + window.document.documentElement.className + ' ').indexOf(' ' + key + ' '); - // If the class already exists in the html element do nothing. - if (html_class === -1) { - // Wait till the font is downloaded, then set cookie & class. - advagg_run_check(key, Drupal.settings.advagg_font[key]); - } - } - } -} - -/** - * Make sure window.Drupal.settings.advagg_font is defined before running. - */ -function advagg_font_check() { - 'use strict'; - if (window.Drupal && window.Drupal.settings && window.Drupal.settings.advagg_font) { - advagg_font_add_font_classes_on_load(); - } - else { - // Try again in 20 ms. - window.setTimeout(advagg_font_check, 20); - } -} - -// Start the process. -advagg_font_check(); diff --git a/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.module b/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.module deleted file mode 100644 index 9f3a9c868..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_font/advagg_font.module +++ /dev/null @@ -1,542 +0,0 @@ - array(), - 'advagg_font_storage' => variable_get('advagg_font_storage', ADVAGG_FONT_STORAGE), - 'advagg_font_cookie' => variable_get('advagg_font_cookie', ADVAGG_FONT_COOKIE), - 'advagg_font_no_fout' => variable_get('advagg_font_no_fout', ADVAGG_FONT_NO_FOUT), - ), array('type' => 'setting')); - - // Add inline script for reading the cookies and adding the fonts already - // loaded to the html class. - if (variable_get('advagg_font_cookie', ADVAGG_FONT_COOKIE) || variable_get('advagg_font_storage', ADVAGG_FONT_STORAGE)) { - $inline_script_min = 'for(var fonts=document.cookie.split("advaggf"),i=0;i=current_time&&(window.document.documentElement.className+=" "+key.replace(/[^a-zA-Z0-9\-]/g,""))}'; - drupal_add_js($inline_script_min, array( - 'type' => 'inline', - 'group' => JS_LIBRARY - 1, - 'weight' => -50000, - 'scope' => 'above_css', - 'scope_lock' => TRUE, - 'movable' => FALSE, - 'no_defer' => TRUE, - )); - } - - // Get library data for fontfaceobserver. - $library = advagg_get_library('fontfaceobserver', 'advagg_font'); - // If libraries_load() does not exist load library externally. - if (!is_callable('libraries_load')) { - $advagg_font_ffo = 6; - } - // Add fontfaceobserver.js. - if ($advagg_font_ffo != 6 && empty($library['installed'])) { - // The fontfaceobserver library is not installed; use external variant. - $advagg_font_ffo = 6; - } - if ($advagg_font_ffo == 6) { - // Use the external variant. - foreach ($library['variants']['external']['files']['js'] as $data => $options) { - drupal_add_js($data, $options); - } - } - else { - // Load the fontfaceobserver library. - if ($advagg_font_ffo == 2) { - // Use the inline variant. - libraries_load('fontfaceobserver', 'inline'); - } - else { - libraries_load('fontfaceobserver'); - } - } - - // Add advagg_font.js; sets cookie and changes the class of the top level - // element once a font has been downloaded. - $file_path = drupal_get_path('module', 'advagg_font') . '/advagg_font.js'; - drupal_add_js($file_path, array( - 'async' => TRUE, - 'defer' => TRUE, - )); -} - -/** - * Implements hook_css_alter(). - */ -function advagg_css_alter(&$css) { - // Skip if advagg is disabled. - if (!advagg_enabled()) { - return; - } - - // Skip if fontface is disabled. - if (empty(variable_get('advagg_font_fontfaceobserver', ADVAGG_FONT_FONTFACEOBSERVER))) { - return; - } - - // Skip if fonts added to critical css is disabled. - if (empty(variable_get('advagg_font_add_to_critical_css', ADVAGG_FONT_ADD_TO_CRITICAL_CSS))) { - return; - } - - $critical_css_key = NULL; - foreach ($css as $key => $values) { - if (!empty($values['critical-css']) && $values['type'] === 'inline') { - $critical_css_key = $key; - } - } - - // Skip if no critical css. - if (is_null($critical_css_key)) { - return; - } - - module_load_include('inc', 'advagg', 'advagg'); - $css_to_add = ''; - foreach ($css as $key => $values) { - if ($values['type'] === 'file') { - $info = advagg_get_info_on_file($key); - if (!empty($info['advagg_font'])) { - // Get the file contents. - $file_contents = (string) @advagg_file_get_contents($info['data']); - if (empty($file_contents)) { - continue; - } - list($replacements) = advagg_font_get_replacements_array($file_contents); - foreach ($replacements as $replace) { - $css_to_add .= $replace[2]; - } - } - } - } - if (!empty($css_to_add)) { - $css[$critical_css_key]['data'] .= "\n{$css_to_add}"; - } -} - -/** - * Implements hook_menu(). - */ -function advagg_font_menu() { - $file_path = drupal_get_path('module', 'advagg_font'); - $config_path = advagg_admin_config_root_path(); - - $items[$config_path . '/advagg/font'] = array( - 'title' => 'Async Font Loader', - 'description' => 'Load external fonts in a non blocking manner.', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('advagg_font_admin_settings_form'), - 'type' => MENU_LOCAL_TASK, - 'access arguments' => array('administer site configuration'), - 'file path' => $file_path, - 'file' => 'advagg_font.admin.inc', - 'weight' => 10, - ); - - return $items; -} - -/** - * @} End of "addtogroup hooks". - */ - -/** - * @addtogroup 3rd_party_hooks - * @{ - */ - -/** - * Implements hook_libraries_info(). - */ -function advagg_font_libraries_info() { - $libraries['fontfaceobserver'] = array( - // Only used in administrative UI of Libraries API. - 'name' => 'fontfaceobserver', - 'vendor url' => 'https://github.com/bramstein/fontfaceobserver', - 'download url' => 'https://github.com/bramstein/fontfaceobserver/archive/master.zip', - 'version arguments' => array( - 'file' => 'package.json', - // 1.50. : "version": "1.5.0". - 'pattern' => '/"version":\\s+"([0-9\.]+)"/', - 'lines' => 10, - ), - 'remote' => array( - 'callback' => 'advagg_get_github_version_json', - 'url' => 'https://cdn.jsdelivr.net/gh/bramstein/fontfaceobserver@master/package.json', - ), - 'files' => array( - 'js' => array( - 'fontfaceobserver.js' => array( - 'type' => 'file', - 'group' => JS_LIBRARY, - 'async' => TRUE, - 'defer' => TRUE, - ), - ), - ), - 'variants' => array(), - ); - // Get the latest tagged version for external file loading. - $version = advagg_get_remote_libraries_version('fontfaceobserver', $libraries['fontfaceobserver']); - $libraries['fontfaceobserver']['variants'] += array( - 'external' => array( - 'files' => array( - 'js' => array( - "https://cdn.jsdelivr.net/gh/bramstein/fontfaceobserver@v{$version}/fontfaceobserver.js" => array( - 'type' => 'external', - 'data' => "https://cdn.jsdelivr.net/gh/bramstein/fontfaceobserver@v{$version}/fontfaceobserver.js", - 'async' => TRUE, - 'defer' => TRUE, - ), - ), - ), - ), - ); - // Inline if local js is there. - $libraries_paths = array(); - if (is_callable('libraries_get_libraries')) { - $libraries_paths = libraries_get_libraries(); - } - if (!empty($libraries_paths['fontfaceobserver']) && is_readable($libraries_paths['fontfaceobserver'] . '/fontfaceobserver.js')) { - $libraries['fontfaceobserver']['variants'] += array( - 'inline' => array( - 'files' => array( - 'js' => array( - 'loadCSS_inline' => array( - 'type' => 'inline', - 'data' => (string) @advagg_file_get_contents($libraries_paths['fontfaceobserver'] . '/fontfaceobserver.js'), - 'no_defer' => TRUE, - ), - ), - ), - ), - ); - } - - return $libraries; -} - -/** - * @} End of "addtogroup 3rd_party_hooks". - */ - -/** - * @addtogroup advagg_hooks - * @{ - */ - -/** - * Implements hook_advagg_current_hooks_hash_array_alter(). - */ -function advagg_font_advagg_current_hooks_hash_array_alter(&$aggregate_settings) { - $aggregate_settings['variables']['advagg_font_fontfaceobserver'] = variable_get('advagg_font_fontfaceobserver', ADVAGG_FONT_FONTFACEOBSERVER); -} - -/** - * @} End of "addtogroup advagg_hooks". - */ - -/** - * Get the replacements array for the css. - * - * @param string $css_string - * String of CSS. - * - * @return array - * An array containing the replacemnts and the font class name. - */ -function advagg_font_get_replacements_array($css_string) { - // Get the CSS that contains a font-family rule. - $length = strlen($css_string); - $property_position = 0; - $property = 'font'; - $property_alt = 'font-family'; - $replacements = array(); - $fonts_with_no_replacements = array(); - $lower = strtolower($css_string); - $safe_fonts_list = array( - 'georgia' => TRUE, - 'palatino' => TRUE, - 'times new roman' => TRUE, - 'times' => TRUE, - - 'arial' => TRUE, - 'helvetica' => TRUE, - 'gadget' => TRUE, - 'verdana' => TRUE, - 'geneva' => TRUE, - 'tahoma' => TRUE, - 'garamond' => TRUE, - 'bookman' => TRUE, - 'comic sans ms' => TRUE, - 'cursive' => TRUE, - 'trebuchet ms' => TRUE, - 'arial black' => TRUE, - 'impact' => TRUE, - 'charcoal' => TRUE, - - 'courier new' => TRUE, - 'courier' => TRUE, - 'monaco' => TRUE, - - 'system' => TRUE, - ); - - while (($property_position = strpos($lower, $property, $property_position)) !== FALSE) { - // Find the start of the values for the property. - $start_of_values = strpos($css_string, ':', $property_position); - // Get the property at this location of the css. - $property_in_loop = trim(substr($css_string, $property_position, ($start_of_values - $property_position))); - - // Make sure this property is one of the ones we're looking for. - if ($property_in_loop !== $property && $property_in_loop !== $property_alt) { - $property_position += strlen($property); - continue; - } - - // Get position of the last closing bracket plus 1 (start of this section). - $start = strrpos($css_string, '}', -($length - $property_position)); - if ($start === FALSE) { - // Property is in the first selector and a declaration block (full rule - // set). - $start = 0; - } - else { - // Add one to start after the }. - $start++; - } - - // Get closing bracket (end of this section). - $end = strpos($css_string, '}', $property_position); - if ($end === FALSE) { - // The end is the end of this file. - $end = $length; - } - - // Get closing ; in order to get the end of the declaration of the property. - $declaration_end_a = strpos($css_string, ';', $property_position); - $declaration_end_b = strpos($css_string, '}', $property_position); - if ($declaration_end_a === FALSE) { - $declaration_end = $declaration_end_b; - } - else { - $declaration_end = min($declaration_end_a, $declaration_end_b); - } - if ($declaration_end > $end) { - $declaration_end = $end; - } - // Add one in order to capture the } when we ge the full rule set. - $end++; - // Advance position for the next run of the while loop. - $property_position = $end; - - // Get values assigned to this property. - $values_string = substr($css_string, $start_of_values + 1, $declaration_end - ($start_of_values + 1)); - // Parse values string into an array of values. - $values_array = explode(',', $values_string); - if (empty($values_array)) { - continue; - } - - // Values array, first element is a quoted string. - $dq = strpos($values_array[0], '"'); - $sq = strpos($values_array[0], "'"); - $quote_pos = ($sq !== FALSE) ? $sq : $dq; - // Skip if the first font is not quoted. - if ($quote_pos === FALSE) { - continue; - } - - $values_array[0] = trim($values_array[0]); - // Skip if only one font is listed. - if (count($values_array) === 1) { - $fonts_with_no_replacements[$values_array[0]] = ''; - continue; - } - - // Save the first value to a variable; starting at the quote. - $removed_value_original = substr($values_array[0], max($quote_pos - 1, 0)); - - // Resave first value. - if ($quote_pos > 1) { - $values_array[0] = trim(substr($values_array[0], 0, $quote_pos - 1)); - } - - // Get value as a classname. Remove quotes, trim, lowercase, and replace - // spaces with dashes. - $removed_value_classname = strtolower(trim(str_replace(array('"', "'"), '', $removed_value_original))); - $removed_value_classname = str_replace(' ', '-', $removed_value_classname); - - // Remove value if it contains a quote. - $values_array_copy = $values_array; - foreach ($values_array as $key => $value) { - if (strpos($value, '"') !== FALSE || strpos($value, "'") !== FALSE) { - unset($values_array[$key]); - } - elseif ($key !== 0) { - break; - } - } - - if (empty($values_array)) { - // See if there's a "safe" fallback that is quoted. - $values_array = $values_array_copy; - foreach ($values_array as $key => $value) { - if (strpos($value, '"') !== FALSE || strpos($value, "'") !== FALSE) { - if ($key !== 0) { - $lower_key = trim(trim(strtolower(trim($value)), '"'), "'"); - if (!empty($safe_fonts_list[$lower_key])) { - break; - } - } - unset($values_array[$key]); - } - elseif ($key !== 0) { - break; - } - } - if (empty($values_array)) { - // No unquoted values left; do not modify the css. - $key = array_shift($values_array_copy); - $fonts_with_no_replacements[$key] = implode(',', $values_array_copy); - continue; - } - } - - $extra = ''; - if (isset($values_array[0])) { - $extra = $values_array[0] . ' '; - unset($values_array[0]); - } - // Rezero the keys. - $values_array = array_values($values_array); - // Save next value. - $next_value_original = trim($values_array[0]); - // Create the values string. - $new_values_string = $extra . implode(',', $values_array); - - // Get all selectors. - $end_of_selectors = strpos($css_string, '{', $start); - $selectors = substr($css_string, $start, $end_of_selectors - $start); - // Ensure selectors is not a media query. - if (stripos($selectors, "@media") !== FALSE) { - // Move the start to the end of the media query. - $start = $end_of_selectors + 1; - // Get the selectors again. - $end_of_selectors = strpos($css_string, '{', $start); - $selectors = substr($css_string, $start, $end_of_selectors - $start); - } - - // From advagg_load_stylesheet_content(). - // Perform some safe CSS optimizations. - // Regexp to match comment blocks. - // Regexp to match double quoted strings. - // Regexp to match single quoted strings. - $comment = '/\*[^*]*\*+(?:[^/*][^*]*\*+)*/'; - $double_quot = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"'; - $single_quot = "'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'"; - // Strip all comment blocks, but keep double/single quoted strings. - $selectors_stripped = preg_replace( - "<($double_quot|$single_quot)|$comment>Ss", - "$1", - $selectors - ); - - // Add css class to all the selectors. - $selectors_array = explode(',', $selectors_stripped); - foreach ($selectors_array as &$selector) { - // Remove extra whitespace. - $selector = trim($selector); - $selector = " .{$removed_value_classname} {$selector}"; - } - $new_selectors = implode(',', $selectors_array); - - // Get full rule set. - $full_rule_set = substr($css_string, $start, $end - $start); - // Replace values. - $new_values_full_rule_set = str_replace($values_string, $new_values_string, $full_rule_set); - // Add in old rule set with new selectors. - $new_selectors_full_rule_set = $new_selectors . '{' . $property_in_loop . ': ' . $values_string . ';}'; - - // Record info. - $replacements[] = array( - $full_rule_set, - $new_values_full_rule_set, - $new_selectors_full_rule_set, - $removed_value_original, - $removed_value_classname, - $next_value_original, - ); - } - return array($replacements, $fonts_with_no_replacements); -} diff --git a/html/sites/all/modules/contrib/advagg/advagg_js_cdn/advagg_js_cdn.info b/html/sites/all/modules/contrib/advagg/advagg_js_cdn/advagg_js_cdn.info deleted file mode 100644 index d7a6735cf..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_js_cdn/advagg_js_cdn.info +++ /dev/null @@ -1,11 +0,0 @@ -name = AdvAgg CDN Javascript -description = Use a shared CDN for javascript libraries, Google Libraries API currently. -package = Advanced CSS/JS Aggregation -core = 7.x -dependencies[] = advagg - -; Information added by Drupal.org packaging script on 2020-11-19 -version = "7.x-2.35" -core = "7.x" -project = "advagg" -datestamp = "1605792717" diff --git a/html/sites/all/modules/contrib/advagg/advagg_js_cdn/advagg_js_cdn.install b/html/sites/all/modules/contrib/advagg/advagg_js_cdn/advagg_js_cdn.install deleted file mode 100644 index 39502ea5c..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_js_cdn/advagg_js_cdn.install +++ /dev/null @@ -1,69 +0,0 @@ -jquery update settings page and select a CDN instead of using this module.', array( - '@settings' => url('admin/config/development/jquery_update', array( - 'fragment' => 'edit-jquery-update-jquery-cdn', - )), - )); - } - else { - $jquery_description = $t('The jquery update module is already configured to use the external CDN "@cdn".', array('@cdn' => $jquery_cdn)); - } - - $requirements['advagg_js_cdn_jquery_update'] = array( - 'title' => $t('Adv JS CDN - jquery update'), - 'severity' => REQUIREMENT_WARNING, - 'value' => $t('Duplicate Functionality: Use jquery update instead of the advagg_js_cdn sub module.'), - 'description' => $jquery_description . ' ' . $t('You should go to the modules page and disable the "AdvAgg CDN JS" module.', array( - '@modules' => url('admin/modules', array( - 'fragment' => 'edit-modules-advanced-cssjs-aggregation', - )), - )), - ); - } - - if (empty($requirements)) { - $description = ''; - if (variable_get('advagg_cache_level', ADVAGG_CACHE_LEVEL) < 0) { - $description = $t('Will be using the unminified version due to AdvAgg being in Development mode.'); - } - $requirements['advagg_js_cdn'] = array( - 'title' => $t('Adv JS CDN'), - 'severity' => REQUIREMENT_OK, - 'value' => $t('OK'), - 'description' => $t('jQuery and jQuery UI JS should be coming from a CDN.') . ' ' . $description, - ); - } - - return $requirements; -} - -/** - * @} End of "addtogroup hooks". - */ diff --git a/html/sites/all/modules/contrib/advagg/advagg_js_cdn/advagg_js_cdn.module b/html/sites/all/modules/contrib/advagg/advagg_js_cdn/advagg_js_cdn.module deleted file mode 100644 index bcb164d83..000000000 --- a/html/sites/all/modules/contrib/advagg/advagg_js_cdn/advagg_js_cdn.module +++ /dev/null @@ -1,162 +0,0 @@ - $values) { - // Only modify if - // advagg_js_cdn_jquery is enabled, - // name is misc/jquery.js, - // and type is file. - if (variable_get('advagg_js_cdn_jquery', ADVAGG_JS_CDN_JQUERY) - && $name === 'misc/jquery.js' - && $javascript[$name]['type'] === 'file' - ) { - // Add in backup. - $values['weight'] += 0.00001; - $values['data'] = 'window.jQuery || document.write(" - - - - - - - - - - - - -
- - $hour): ?> - -
- -
- -
- $hour): ?> - -
-
 
- -
- - -
- -
- - - - - - - -
-
-
- -
- - - - - - diff --git a/html/sites/all/modules/contrib/calendar/theme/calendar-day.tpl.php b/html/sites/all/modules/contrib/calendar/theme/calendar-day.tpl.php deleted file mode 100644 index ea5c71df2..000000000 --- a/html/sites/all/modules/contrib/calendar/theme/calendar-day.tpl.php +++ /dev/null @@ -1,79 +0,0 @@ - - * based on the number of columns presented. The values passed in will - * work to set the 'hour' column to 10% and split the remaining columns - * evenly over the remaining 90% of the table. - */ -?> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0 ? t('Time') : ''; ?>
- 0 ? t('All day', array(), array('context' => 'datetime')) : ''; ?> - -
-
- -
-
-
- - -
-
- -
-
-
-
diff --git a/html/sites/all/modules/contrib/calendar/theme/calendar-item.tpl.php b/html/sites/all/modules/contrib/calendar/theme/calendar-item.tpl.php deleted file mode 100644 index 8b0989f3b..000000000 --- a/html/sites/all/modules/contrib/calendar/theme/calendar-item.tpl.php +++ /dev/null @@ -1,63 +0,0 @@ - -
-
-
- $item)); ?> -
- - continuation) && $item->continuation)) : ?> -
«
- - - -
- continues) && $item->continues) : ?> -
»
- -
 
- -
-
-
diff --git a/html/sites/all/modules/contrib/calendar/theme/calendar-mini.tpl.php b/html/sites/all/modules/contrib/calendar/theme/calendar-mini.tpl.php deleted file mode 100644 index 7fc827ef2..000000000 --- a/html/sites/all/modules/contrib/calendar/theme/calendar-mini.tpl.php +++ /dev/null @@ -1,57 +0,0 @@ - $view, - 'granularity' => 'month', - 'link' => FALSE, -); -?> -
- -
-
-
- -
-
-
- - - - - - - - - - - - - - - - - - -
- -
- -
-
diff --git a/html/sites/all/modules/contrib/calendar/theme/calendar-month-col.tpl.php b/html/sites/all/modules/contrib/calendar/theme/calendar-month-col.tpl.php deleted file mode 100644 index e505c254f..000000000 --- a/html/sites/all/modules/contrib/calendar/theme/calendar-month-col.tpl.php +++ /dev/null @@ -1,18 +0,0 @@ - -class="" colspan="" rowspan=""> -
- -
- diff --git a/html/sites/all/modules/contrib/calendar/theme/calendar-month-multiple-entity.tpl.php b/html/sites/all/modules/contrib/calendar/theme/calendar-month-multiple-entity.tpl.php deleted file mode 100755 index a31f202ee..000000000 --- a/html/sites/all/modules/contrib/calendar/theme/calendar-month-multiple-entity.tpl.php +++ /dev/null @@ -1,27 +0,0 @@ - -
-
- - date_info->style_max_items_behavior != 'more'): ?> - - - -
- date_info->style_max_items_behavior != 'more'): ?> -
- $count)), $link); ?> -
-
- -
»
- -
-
diff --git a/html/sites/all/modules/contrib/calendar/theme/calendar-month-row.tpl.php b/html/sites/all/modules/contrib/calendar/theme/calendar-month-row.tpl.php deleted file mode 100644 index 0ce2caa7e..000000000 --- a/html/sites/all/modules/contrib/calendar/theme/calendar-month-row.tpl.php +++ /dev/null @@ -1,18 +0,0 @@ - 0) ? ' iehint="' . $iehint . '"' : ''; -?> - -> - - - - - diff --git a/html/sites/all/modules/contrib/calendar/theme/calendar-month.tpl.php b/html/sites/all/modules/contrib/calendar/theme/calendar-month.tpl.php deleted file mode 100644 index 4bdf72654..000000000 --- a/html/sites/all/modules/contrib/calendar/theme/calendar-month.tpl.php +++ /dev/null @@ -1,55 +0,0 @@ - -
- - - - $cell): ?> - - - - - - - -
- -
-
- diff --git a/html/sites/all/modules/contrib/calendar/theme/calendar-style.tpl.php b/html/sites/all/modules/contrib/calendar/theme/calendar-style.tpl.php deleted file mode 100644 index fca6766c5..000000000 --- a/html/sites/all/modules/contrib/calendar/theme/calendar-style.tpl.php +++ /dev/null @@ -1,5 +0,0 @@ - $value) { - $header_ids[$key] = $value['header_id']; -} -?> -
-
- - - - - - - - - - - -
  - -
-
-
- - - - - - - 0 || !empty($start_times))) :?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 'datetime'))?> -
 
-
- -
-
 
- 'datetime'))?> -
 
-   -
 
-
-
 
-
- - - - - - - - - - - - - -
- - - - - - $start_time): ?> - - - -
- -
- -
-
 
-
-
- - - -
- -
- - -
- - -
-
-
- - -
-
- -
- - - diff --git a/html/sites/all/modules/contrib/calendar/theme/calendar-week.tpl.php b/html/sites/all/modules/contrib/calendar/theme/calendar-week.tpl.php deleted file mode 100644 index 77cedf561..000000000 --- a/html/sites/all/modules/contrib/calendar/theme/calendar-week.tpl.php +++ /dev/null @@ -1,122 +0,0 @@ - $value) { - $header_ids[$key] = $value['header_id']; -} -?> -
- - - - 0 || !empty($start_times)): ?> - - - - - - - - - - - - 0 || !empty($start_times))): ?> - - - - - - - - - - - - - - - - - - - - - - $column): ?> - - - - - - - - - - - - - -
- -
- 'datetime')); ?> -
 
-
- -
-
 
- - -
-
 
-
-
-
-
- - - - - -
-
-
-
-
 
-
-
-
diff --git a/html/sites/all/modules/contrib/calendar/theme/calendar-year.tpl.php b/html/sites/all/modules/contrib/calendar/theme/calendar-year.tpl.php deleted file mode 100644 index 5dbdfce3c..000000000 --- a/html/sites/all/modules/contrib/calendar/theme/calendar-year.tpl.php +++ /dev/null @@ -1,26 +0,0 @@ - -
-
- class="mini"> - - - - - - - -
-
diff --git a/html/sites/all/modules/contrib/calendar/theme/theme.inc b/html/sites/all/modules/contrib/calendar/theme/theme.inc deleted file mode 100644 index 09fd03210..000000000 --- a/html/sites/all/modules/contrib/calendar/theme/theme.inc +++ /dev/null @@ -1,881 +0,0 @@ - 1) { - $day_names = array_shift($rows); - } - else { - $day_names = $rows; - $rows = array(); - } - - $month_rows = $rows; - foreach ($rows as $weekno => $row) { - // If this row is already rendered, don't do anything. - if (!isset($row['data'])) { - foreach ($row as $day => $data) { - $cell = $data['data']; - - // If this cell is already rendered, like the weekno column, - // move to the next item. - if (!is_array($cell)) { - $month_rows[$weekno][$day]['data'] = $cell; - continue; - } - $data = $cell['datebox']; - if ($cell['empty']) { - $data .= $cell['empty']; - } - else { - $data .= implode($cell['all_day']); - foreach ($cell['items'] as $hour => $item) { - $data .= implode($item); - } - $data .= $cell['link']; - } - if ($view->date_info->mini) { - $month_rows[$weekno][$day]['data'] = $data; - } - else { - $month_rows[$weekno][$day]['data'] = '
' . $data . '
'; - } - } - } - } - - $vars['rows'] = $month_rows; - $vars['day_names'] = $day_names; - - $vars['display_type'] = $view->date_info->granularity; - $vars['min_date_formatted'] = date_format($view->date_info->min_date, DATE_FORMAT_DATETIME); - $vars['max_date_formatted'] = date_format($view->date_info->max_date, DATE_FORMAT_DATETIME); -} - -/** - * Display a mini month view. - */ -function template_preprocess_calendar_mini(&$vars) { - // Add in all the $vars added by the main calendar preprocessor. - template_preprocess_calendar_month($vars); - - $view = $vars['view']; - - // Make sure that the calendar title links go to the month view, - // not the year view (if this is embedded in a year display). - $view->override_path = calendar_granularity_path($view, 'month'); - - $view->date_info->show_title = !empty($view->date_info->show_title) ? $view->date_info->show_title : FALSE; - $vars['show_title'] = $view->date_info->show_title; - $vars['view'] = $view; -} - -/** - * Display a year view. - */ -function template_preprocess_calendar_year(&$vars) { - - // Construct a calendar for each month, adjusting the $view passed - // to the theme so it will produce the right results. - $view = clone($vars['view']); - $year = date_format($view->date_info->min_date, 'Y'); - $view->date_info->style_with_weekno = FALSE; - $rows = $vars['rows']; - $months = array(); - foreach ($rows as $month => $month_rows) { - $view->date_info->month = $month; - $view->date_info->granularity = 'month'; - $view->date_info->mini = TRUE; - $view->date_info->hide_nav = TRUE; - $view->date_info->show_title = TRUE; - $view->date_info->url = date_pager_url($view, NULL, date_pad($year, 4) . '-' . date_pad($month)); - $view->date_info->min_date = new DateObject($view->date_info->year . '-' . date_pad($month) . '-01 00:00:00', date_default_timezone()); - $view->date_info->max_date = clone($view->date_info->min_date); - date_modify($view->date_info->max_date, '+1 month'); - date_modify($view->date_info->max_date, '-1 second'); - $variables = array( - 'view' => $view, - 'options' => $vars['options'], - 'rows' => $month_rows, - ); - $months[$month] = theme('calendar_mini', $variables); - } - $view->date_info->mini = FALSE; - - $vars['months'] = $months; - $vars['view']->date_info->hide_nav = FALSE; - $vars['view']->date_info->granularity = 'year'; - $vars['mini'] = FALSE; - -} - -/** - * Display a day overlap view. - */ -function template_preprocess_calendar_day_overlap(&$vars) { - template_preprocess_calendar_day($vars); -} - -/** - * Display a day view. - */ -function template_preprocess_calendar_day(&$vars) { - $vars['view']->style_with_weekno = FALSE; - $view = $vars['view']; - $rows = $vars['rows']; - - $item_count = 0; - $by_hour_count = 0; - $grouping_field = !empty($view->date_info->style_groupby_field) ? ($view->date_info->style_groupby_field) : NULL; - $display_overlap = !empty($view->date_info->style_theme_style) && !empty($view->date_info->style_groupby_times); - $vars['scroll_content'] = !empty($view->date_info->style_theme_style) && $view->date_info->style_theme_style == 1; - - // Add optional css. - if ($display_overlap) { - $overlapped_items = array(); - drupal_add_css(drupal_get_path('module', 'calendar') . '/css/calendar-overlap.css'); - if (empty($view->live_preview) && !empty($vars['scroll_content'])) { - drupal_add_js(drupal_get_path('module', 'calendar') . '/js/calendar_overlap.js'); - } - if (empty($vars['scroll_content'])) { - drupal_add_css(drupal_get_path('module', 'calendar') . '/css/calendar-overlap-no-scroll.css'); - } - } - - // If we're not grouping by time, move all items into the 'all day' array. - if (empty($view->date_info->style_groupby_times)) { - // Items are already grouped into times, so we need to process each time-group. - foreach ($rows['items'] as $time => $items) { - foreach ($items as $item) { - $rows['all_day'][] = $item; - } - } - $rows['items'] = array(); - } - - $columns = array(); - - // Move all_day items into the right columns and render them. - $grouped_items = array(); - foreach ($rows['all_day'] as $item) { - if (!empty($item->rendered_fields[$grouping_field])) { - $column = $item->rendered_fields[$grouping_field]; - if (!in_array($column, $columns)) { - $columns[] = $column; - } - } - else { - $column = t('Items'); - } - $grouped_items[$column][] = theme('calendar_item', array('view' => $view, 'rendered_fields' => $item->rendered_fields, 'item' => $item)); - $item_count++; - } - $vars['rows']['all_day'] = $grouped_items; - - // Moved timed items into the right columns and render them. - $start_times = $view->date_info->style_groupby_times; - $show_empty_times = $view->date_info->style_show_empty_times; - $end_start_time = '23:59:59'; - $start_time = array_shift($start_times); - $next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time; - - $grouped_items = array(); - foreach ($rows['items'] as &$items) { - foreach ($items as &$item) { - $time = date_format($item->calendar_start_date, 'H:i:s'); - if (!empty($item->rendered_fields[$grouping_field])) { - $column = $item->rendered_fields[$grouping_field]; - if (!in_array($column, $columns)) { - $columns[] = $column; - } - } - else { - $column = t('Items'); - } - // Find the next time slot and fill it. Populate the skipped - // slots if the option to show empty times was chosen. - while ($time >= $next_start_time && $time < $end_start_time) { - if ((!empty($show_empty_times) || $display_overlap) && !array_key_exists($start_time, $grouped_items)) { - $grouped_items[$start_time]['values'] = array(); - } - $start_time = $next_start_time; - $next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time; - } - $grouped_items[$start_time]['values'][$column][] = $item; - if ($display_overlap) { - $time_end = date_format($item->calendar_end_date, 'H:i:s'); - $item->time_start = $time; - $item->time_end = $time_end; - _calc_indents($overlapped_items, $time, $time_end, $item); - } - $item_count++; - $by_hour_count++; - } - } - - // Finish out the day's time values if we want to see empty times. - if (!empty($show_empty_times) || $display_overlap) { - while ($start_time < $end_start_time && (!empty($start_time) || $display_overlap)) { - if (empty($start_time)) { - $start_times = $view->date_info->style_groupby_times; - $start_time = array_shift($start_times); - $next_start_time = array_shift($start_times); - } - if (!array_key_exists($start_time, $grouped_items)) { - $grouped_items[$start_time]['values'] = array(); - } - $start_time = $next_start_time; - $next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time; - } - } - - // Do the headers last, once we know what the actual values are. - $i = 0; - $start_times = array_keys($grouped_items); - foreach ($start_times as $start_time) { - $next_start_time = array_key_exists($i + 1, $start_times) ? $start_times[$i + 1] : '23:59:59'; - $variables = array( - 'start_time' => $start_time, - 'next_start_time' => $next_start_time, - 'curday_date' => $rows['date'], - ); - $heading = theme('calendar_time_row_heading', $variables); - $grouped_items[$start_time]['hour'] = $heading['hour']; - $grouped_items[$start_time]['ampm'] = $heading['ampm']; - foreach ($grouped_items[$start_time]['values'] as $column => &$items) { - foreach ($items as $index => &$item) { - $group_time = NULL; - $divisor = NULL; - if ($display_overlap) { - if ($view->style_plugin->options['groupby_times'] == 'half') { - $group_time = 30; - $divisor = 7.5; - } - elseif ($view->style_plugin->options['groupby_times'] == 'hour') { - $group_time = 60; - $divisor = 15; - } - else { - $item->class = ''; - } - if (!empty($group_time) && !empty($divisor)) { - $start_minute = intval(substr($start_time, 3, 2)); - $offset = round((date_format($item->date_start, 'i') - $start_minute) / $divisor); - $duration = round(($item->date_end->format('U') - $item->date_start->format('U')) / 60 / $divisor); - $item->class = 'd_' . $duration . ' o_' . $offset . ' i_' . $item->indent . ' md_' . min($item->max_depth, 5); - } - } - $grouped_items[$start_time]['values'][$column][$index] = theme('calendar_item', array('view' => $view, 'rendered_fields' => $item->rendered_fields, 'item' => $item)); - } - } - $i++; - } - ksort($grouped_items); - $vars['rows']['items'] = $grouped_items; - - if (empty($columns)) { - $columns = array(t('Items')); - } - $vars['columns'] = $columns; - - $vars['agenda_hour_class'] = 'calendar-agenda-hour'; - $first_column_width = 10; - - if (empty($view->date_info->style_groupby_times)) { - $vars['agenda_hour_class'] .= ' calendar-agenda-no-hours'; - $first_column_width = 1; - } - - $vars['first_column_width'] = $first_column_width; - if (count($columns)) { - $vars['column_width'] = round((100 - $first_column_width) / count($columns)); - } - else { - $vars['column_width'] = (100 - $first_column_width); - } - $vars['item_count'] = $item_count; - $vars['by_hour_count'] = $by_hour_count; - $vars['start_times'] = $view->date_info->style_groupby_times; - return; -} - -/** - * Display a week overlap view. - */ -function template_preprocess_calendar_week_overlap(&$vars) { - template_preprocess_calendar_week($vars); -} - -/** - * Display a week view. - */ -function template_preprocess_calendar_week(&$vars) { - $vars['view']->style_with_weekno = FALSE; - - $view = $vars['view']; - $rows = $vars['rows']; - $item_count = 0; - $by_hour_count = 0; - $start_time = NULL; - $columns = array(); - - if (count($rows) > 1) { - $day_names = array_shift($rows); - } - else { - $day_names = $rows; - $rows = array(); - } - - // Moved timed items into the right columns and render them. - $show_empty_times = $view->date_info->style_show_empty_times; - $end_start_time = '23:59:59'; - - $grouped_items = array(); - - // Pass the multiday buckets. - $vars['all_day'] = $rows['multiday_buckets']; - - // Remove the count for singleday. - $vars['multiday_rows'] = max(0, $rows['total_rows'] - 1); - $display_overlap = ($view->date_info->style_multiday_theme == '1' && !empty($view->date_info->style_theme_style)); - $vars['display_overlap'] = $display_overlap; - $vars['scroll_content'] = !empty($view->date_info->style_theme_style) && $view->date_info->style_theme_style == 1; - - // Add optional css. - if ($display_overlap) { - drupal_add_css(drupal_get_path('module', 'calendar') . '/css/calendar-overlap.css'); - if (empty($view->live_preview) && !empty($vars['scroll_content'])) { - drupal_add_js(drupal_get_path('module', 'calendar') . '/js/calendar_overlap.js'); - } - if (empty($vars['scroll_content'])) { - drupal_add_css(drupal_get_path('module', 'calendar') . '/css/calendar-overlap-no-scroll.css'); - } - $overlapped_items = array(array(), array(), array(), array(), array(), array(), array()); - - // Locate the first item. - $first_time = '23:59:59'; - $first_time_index = -1; - for ($i = 0; $i < 7; $i++) { - if (count($rows['singleday_buckets'][$i]) > 0) { - $time_slot = reset($rows['singleday_buckets'][$i]); - $time = date_format($time_slot[0]['item']->date_start, 'H:i:s'); - if ($time < $first_time) { - $first_time = $time; - $first_time_index = $i; - } - } - } - if ($first_time_index > -1) { - $rows['singleday_buckets'][$first_time_index][$first_time][0]['is_first'] = TRUE; - } - } - - // If we're not grouping by time, move all items into the 'all day' array. - if (empty($view->date_info->style_groupby_times)) { - $add_row = FALSE; - foreach ($vars['all_day'] as $index => &$day) { - foreach ($rows['singleday_buckets'][$index] as $item) { - foreach ($item as $event) { - $day[] = $event; - $add_row = TRUE; - } - } - } - if ($add_row) { - $vars['multiday_rows']++; - } - } - else { - foreach ($rows['singleday_buckets'] as $wday => $singleday_row) { - $columns[] = $wday; - foreach ($singleday_row as &$row) { - $start_times = $view->date_info->style_groupby_times; - $start_time = array_shift($start_times); - $next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time; - foreach ($row as &$item) { - $time = date_format($item['item']->date_start, 'H:i:s'); - if ($item['item']->calendar_all_day) { - $vars['all_day'][$item['wday']][] = $item; - if ($vars['multiday_rows'] == 0) { - $vars['multiday_rows']++; - } - } - else { - // Find the next time slot and fill it. Populate the skipped - // slots if the option to show empty times was chosen. - while ($time >= $next_start_time && $time < $end_start_time) { - if (($show_empty_times || $display_overlap) && !array_key_exists($start_time, $grouped_items)) { - $grouped_items[$start_time]['values'][$wday] = array(); - } - $start_time = $next_start_time; - $next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time; - } - $grouped_items[$start_time]['values'][$wday][] = &$item; - if ($display_overlap) { - $date_end = date_format($item['item']->date_end, 'H:i:s'); - _calc_indents($overlapped_items[$wday], $time, $date_end, $item); - } - $item_count++; - $by_hour_count++; - } - } - } - // Finish out the day's time values if we want to see empty times. - if ($show_empty_times || $display_overlap) { - while ($start_time < $end_start_time && ($start_time != NULL || $display_overlap)) { - if ($start_time == NULL) { - $start_times = $view->date_info->style_groupby_times; - $start_time = array_shift($start_times); - $next_start_time = array_shift($start_times); - } - if (!array_key_exists($start_time, $grouped_items)) { - $grouped_items[$start_time]['values'][$wday] = array(); - } - $start_time = $next_start_time; - $next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time; - } - } - ksort($grouped_items); - } - } - - // Do the headers last, once we know what the actual values are. - $i = 0; - $start_times = array_keys($grouped_items); - foreach ($start_times as $start_time) { - $next_start_time = array_key_exists($i + 1, $start_times) ? $start_times[$i + 1] : '23:59:59'; - $variables = array( - 'start_time' => $start_time, - 'next_start_time' => $next_start_time, - 'curday_date' => (isset($row['data'])) ? $row['data']['date'] : NULL, - ); - $heading = theme('calendar_time_row_heading', $variables); - $grouped_items[$start_time]['hour'] = $heading['hour']; - $grouped_items[$start_time]['ampm'] = $heading['ampm']; - $grouped_items[$start_time]['time'] = $start_time; - if ($display_overlap) { - foreach ($grouped_items[$start_time]['values'] as $wday => &$items) { - foreach ($items as &$item) { - if ($display_overlap) { - $group_time = NULL; - $divisor = NULL; - if ($view->style_plugin->options['groupby_times'] == 'half') { - $group_time = 30; - $divisor = 7.5; - } - elseif ($view->style_plugin->options['groupby_times'] == 'hour') { - $group_time = 60; - $divisor = 15; - } - else { - $item['class'] = ''; - } - if (!empty($group_time) && !empty($divisor)) { - $start_minute = intval(substr($start_time, 3, 2)); - $offset = round((date_format($item['item']->date_start, 'i') - $start_minute) / $divisor); - $duration = round(($item['item']->date_end->format('U') - $item['item']->date_start->format('U')) / 60 / $divisor); - $item['class'] = 'd_' . $duration . ' o_' . $offset . ' i_' . $item['indent'] . ' md_' . min($item['max_depth'], 5); - } - } - } - } - } - } - - $vars['items'] = $grouped_items; - - $vars['day_names'] = $day_names; - $vars['columns'] = $columns; - $vars['start_times'] = $view->date_info->style_groupby_times; - $vars['first_time'] = !empty($first_time) ? $first_time : ''; - - $vars['agenda_hour_class'] = 'calendar-agenda-hour'; - $first_column_width = 10; - - if (empty($view->date_info->style_groupby_times)) { - $vars['agenda_hour_class'] .= ' calendar-agenda-no-hours'; - $first_column_width = 1; - } - $vars['item_count'] = $item_count; - $vars['by_hour_count'] = $by_hour_count; - return; -} - -/** - * Implementation of hook_preprocess_calendar_item(). - */ -function template_preprocess_calendar_item(&$vars) { - // At the last possible minute we fix the values in rendered_fields so it - // contains the correct rendered content for the type of item and item display. - $item = $vars['item']; - - $multiday_hidden = !empty($vars['view']->style_options['multiday_hidden']) ? $vars['view']->style_options['multiday_hidden'] : array(); - - if (!empty($item->rendered) && empty($item->is_multi_day)) { - $vars['rendered_fields'] = array($item->rendered); - } - else { - foreach ($vars['view']->field as $id => $field) { - if ($field->options['exclude'] || (!empty($item->is_multi_day) && in_array($id, $multiday_hidden))) { - unset($vars['rendered_fields'][$id]); - } - } - } -} - -/** - * Create the calendar date box. - */ -function template_preprocess_calendar_datebox(&$vars) { - $date = $vars['date']; - $view = $vars['view']; - $vars['day'] = intval(substr($date, 8, 2)); - $force_view_url = !empty($view->date_info->block) ? TRUE : FALSE; - $month_path = calendar_granularity_path($view, 'month'); - $year_path = calendar_granularity_path($view, 'year'); - $day_path = calendar_granularity_path($view, 'day'); - $vars['url'] = str_replace(array($month_path, $year_path), $day_path, date_pager_url($view, NULL, $date, $force_view_url)); - $vars['link'] = !empty($day_path) ? l($vars['day'], $vars['url']) : $vars['day']; - $vars['granularity'] = $view->date_info->granularity; - $vars['mini'] = !empty($view->date_info->mini); - if ($vars['mini']) { - if (!empty($vars['selected'])) { - $vars['class'] = 'mini-day-on'; - } - else { - $vars['class'] = 'mini-day-off'; - } - } - else { - $vars['class'] = 'day'; - } -} - -/** - * Format an calendar month node for display. - */ -function template_preprocess_calendar_month_multiple_entity(&$vars) { - $view = $vars['view']; - $curday = $vars['curday']; - $count = $vars['count']; - $ids = $vars['ids']; - - // Get the year month and date. - $parts = explode('-', substr($curday, 0, 10)); - $year = $parts[0]; - $month = intval($parts[1]); - $day = intval($parts[2]); - - // Create the link to the day. - $month_path = calendar_granularity_path($view, 'month'); - $day_path = calendar_granularity_path($view, 'day'); - $vars['link'] = str_replace($month_path, $day_path, date_pager_url($view, NULL, date_pad($year, 4) . '-' . date_pad($month) . '-' . date_pad($day))); -} - -/** - * Theme function for rendering views fields as a calendar 'item'. - * - * $vars['rendered_fields'] = An array of the rendered display of each field in the View. - * $vars['item'] = The source data for this item. - * $vars['view'] = The view that this item is displayed on. - * - * @TODO We need some options about how to combine rendered fields. - * Fields rendered in multiday containers need to be inline. - */ - -/** - * Format the time row headings in the week and day view. - */ -function theme_calendar_time_row_heading($vars) { - $start_time = $vars['start_time']; - $next_start_time = $vars['next_start_time']; - $curday_date = $vars['curday_date']; - static $format_hour, $format_ampm; - if (empty($format_hour)) { - $format = variable_get('date_format_short', 'm/d/Y - H:i'); - if (substr($start_time, -5) == '00:00' && substr($next_start_time, -5) == '00:00') { - $limit = array('hour'); - } - else { - $limit = array('hour', 'minute'); - } - $format_hour = str_replace(array('a', 'A'), '', date_limit_format($format, $limit)); - $format_ampm = strstr($format, 'a') ? 'a' : (strstr($format, 'A') ? 'A' : ''); - } - if ($start_time == '00:00:00' && $next_start_time == '23:59:59') { - $hour = t('All times'); - } - elseif ($start_time == '00:00:00') { - $date = date_create($curday_date . ' ' . $next_start_time); - $hour = t('Before @time', array('@time' => date_format($date, $format_hour))); - } - else { - $date = date_create($curday_date . ' ' . $start_time); - $hour = date_format($date, $format_hour); - } - if (!empty($date)) { - $ampm = date_format($date, $format_ampm); - } - else { - $ampm = ''; - } - return array('hour' => $hour, 'ampm' => $ampm); -} - -/** - * Format a node stripe legend. - */ -function theme_calendar_stripe_legend($vars) { - if (empty($vars) || !$view = $vars['view']) { - return ''; - } - - list($view_name, $display_id) = explode(':', $view); - - $view = views_get_view($view_name); - $view->set_display($display_id); - $row_options = $view->display_handler->get_option('row_options'); - - $legend_type = $row_options['colors']['legend']; - $display_options = $row_options['colors']['calendar_colors_' . $legend_type]; - $options = array(); - switch ($legend_type) { - - case 'type': - $options = node_type_get_names(); - break; - - case 'taxonomy': - $vocabularies = (array) $row_options['colors']['calendar_colors_vocabulary']; - foreach ($vocabularies as $field_name => $vid) { - $vocab = taxonomy_get_tree($vid); - foreach ($vocab as $key => $term) { - $options[$term->tid] = $term->name; - } - } - break; - - case 'group': - // The 7.1 version of OG. - if (function_exists('og_label')) { - $gids = og_get_all_group(); - foreach ($gids as $gid) { - $options[$gid] = check_plain(t(og_label($gid))); - } - } - - // The 7.2 version of OG. - else { - $types = og_get_all_group_entity(); - foreach ($types as $entity_type => $name) { - $gids = og_get_all_group($entity_type); - $entities = entity_load($entity_type, $gids); - foreach ($entities as $entity) { - list($gid) = entity_extract_ids($entity_type, $entity); - $options[$gid] = check_plain(t(entity_label($entity_type, $entity))); - } - } - } - break; - } - - $header = array( - array('class' => 'calendar-legend', 'data' => t('Item')), - array('class' => 'calendar-legend', 'data' => t('Key')), - ); - - $rows = array(); - $output = ''; - foreach ($options as $key => $label) { - $stripe = array_key_exists($key, $display_options) ? $display_options[$key] : CALENDAR_EMPTY_STRIPE; - if ($stripe != CALENDAR_EMPTY_STRIPE) { - $rows[] = array($label, '
 
'); - } - } - - if (!empty($rows)) { - $variables = array( - 'header' => $header, - 'rows' => $rows, - 'attributes' => array('class' => array('mini', 'calendar-legend')), - ); - $output .= theme('table', $variables); - $output = '
' . $output . '
'; - } - return $output; -} - -/** - * Format item stripes. - */ -function theme_calendar_stripe_stripe($vars) { - $item = $vars['item']; - if (empty($item->stripe) || (!count($item->stripe))) { - return; - } - $output = ''; - if (is_array($item->stripe_label)) { - foreach ($item->stripe_label as $k => $stripe_label) { - if (!empty($item->stripe[$k]) && !empty($stripe_label)) { - $output .= '
 
' . "\n"; - } - } - } - return $output; -} - -/** - * Format an empty day on a calendar. - * - * @param day - * The day to display. - */ -function theme_calendar_empty_day($vars) { - $curday = $vars['curday']; - $view = $vars['view']; - - if ($view->date_info->calendar_type != 'day') { - return '
 
' . "\n"; - } - else { - return '
' . t('Empty day') . '
'; - } -} - -/** - * Indent items based off a nested tree structure of overlapping items. - * - * @param array $overlapped_items - * Tree of overlapped items. - * @param date $start - * Start time of the event. - * @param date $end - * End time of the event. - * @param array $item - * The event to add to the tree. - * @param int $depth - * Current depth of the tree. - * - * @return rc - * Returns an array with the max depth of the branch and whether an overlap occurred - */ -function _calc_indents(&$overlapped_items, $start, $end, &$item, $depth = 0) { - - // Are there any items at this depth? - if (!empty($overlapped_items)) { - - // Iterate for each item as this depth and see if we overlap. - foreach ($overlapped_items as $index => &$entry) { - - // We search depth-first, so if there are children for this item, recurse into - // each child tree looking for an overlap. - if (!empty($entry['children'])) { - $rc = _calc_indents($entry['children'], $start, $end, $item, $depth + 1); - - // Was there an overlap in the child tree? - if ($rc['overlap']) { - if (is_object($entry['item'])) { - $entry['item']->indent = _calc_indent($entry['depth'], $rc['max_depth']); - $entry['item']->max_depth = $rc['max_depth']; - } - else { - $entry['item']['indent'] = _calc_indent($entry['depth'], $rc['max_depth']); - $entry['item']['max_depth'] = $rc['max_depth']; - } - - // There was an overlap, pop out of this depth. - return $rc; - } - } - // No, child overlap, so check if we overlap this item. - if ($start >= $entry['start'] && $start <= $entry['end']) { - - // We overlap, create an overlapping entry. - $entry['children'][] = array('item' => &$item, 'depth' => $depth + 1, 'start' => $start, 'end' => $end, 'children' => array()); - if (is_object($entry['item'])) { - $max_depth = max($entry['item']->max_depth, $depth + 1); - $entry['item']->indent = _calc_indent($depth, $max_depth); - $entry['item']->max_depth = $max_depth; - } - else { - $max_depth = max($entry['item']['max_depth'], $depth + 1); - $entry['item']['indent'] = _calc_indent($depth, $max_depth); - $entry['item']['max_depth'] = $max_depth; - } - if (is_object($item)) { - $item->indent = _calc_indent($depth + 1, $max_depth); - $item->max_depth = $max_depth; - } - else { - $item['indent'] = _calc_indent($depth + 1, $max_depth); - $item['max_depth'] = $max_depth; - } - - // We overlap, so pop out of this depth. - return array('overlap' => TRUE, 'max_depth' => $max_depth); - } - } - - // If there are items at this depth, but no overlap, then return no overlap and pop - // out of this depth. - if ($depth > 0) { - return array('overlap' => FALSE, 'max_depth' => 0); - } - } - - // No overlap at any depth, reset the array of overlaps. - if ($depth == 0) { - reset($overlapped_items); - $overlapped_items[0] = array('item' => &$item, 'depth' => $depth, 'start' => $start, 'end' => $end, 'children' => array()); - } - else { - $overlapped_items[] = array('item' => &$item, 'depth' => $depth, 'start' => $start, 'end' => $end, 'children' => array()); - } - - if (is_object($item)) { - $item->indent = _calc_indent($depth, $depth); - $item->max_depth = $depth; - } - else { - $item['indent'] = _calc_indent($depth, $depth); - $item['max_depth'] = $depth; - } - return array('overlap' => FALSE, 'max_depth' => $depth); -} - -/** - * Calculates the indent based of the current depth and the depth of this branch in the tree. - * - * @param int $cur_depth - * @param int $depth - * - * @return int - */ -function _calc_indent($cur_depth, $depth) { - return round(10 * $cur_depth / ($depth + 1)); -} - -/** - * @} End of addtogroup themeable */ diff --git a/html/sites/all/modules/contrib/chosen/LICENSE.txt b/html/sites/all/modules/contrib/chosen/LICENSE.txt deleted file mode 100644 index d159169d1..000000000 --- a/html/sites/all/modules/contrib/chosen/LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/html/sites/all/modules/contrib/chosen/README.txt b/html/sites/all/modules/contrib/chosen/README.txt deleted file mode 100644 index 619533e2d..000000000 --- a/html/sites/all/modules/contrib/chosen/README.txt +++ /dev/null @@ -1,37 +0,0 @@ --- SUMMARY -- - -Chosen uses the Chosen jQuery plugin to make your '); - this.wrapper.append(this.input); - - $(this.parent).append(this.wrapper); - this.createHandlers(); - }, - createHandlers : function(){ - var self = this; - $(this.input).keyup(function(e){ - self.filter(); - }); - }, - filter : function(){ - //show all first off - $('*', this.list).show(); - //hide ignored items - if(this.input.val()) { - $('*', this.list).not(this.type).hide(); - } - - var regex = new RegExp(this.input.val(), 'i'); - - var self = this; - $(this.type, this.list).each(function(ind, el) { - var string = self.strip(el.innerHTML); - if(!regex.test(string)){ - $(el).hide(); - } else { //show the parent and any labels or whatever in the parent - var parent = $(el).parent().show(); - $('*', parent).not(self.type).show(); - } - }); - }, - strip : function(string){ - var strip = /<([^<|^>]*)>/i; - while(strip.test(string)){ - var matches = string.match(strip); - string = string.replace(strip, ''); - } - return string; - } - }; -})(jQuery); \ No newline at end of file diff --git a/html/sites/all/modules/contrib/context/context_ui/theme/theme.inc b/html/sites/all/modules/contrib/context/context_ui/theme/theme.inc deleted file mode 100644 index 8004e9ee7..000000000 --- a/html/sites/all/modules/contrib/context/context_ui/theme/theme.inc +++ /dev/null @@ -1,54 +0,0 @@ - $vars['form']['plugins'][$plugin]['#plugin']->title . "" . t('Remove') . "", - 'href' => $_GET['q'], - 'html' => TRUE, - 'fragment' => "context-plugin-form-{$plugin}", - ); - $class = $vars['form']['plugins'][$plugin]['#context_enabled'] ? "context-plugin-{$plugin}" : "context-plugin-{$plugin} disabled"; - $vars['plugins'][$class] = $link; - } -} - -/** - * Preprocessor for theme('context_ui_form'). - */ -function template_preprocess_context_ui_form(&$vars) { - drupal_add_css(drupal_get_path("module", "context_ui") . "/context_ui.css"); - drupal_add_js(drupal_get_path("module", "context_ui") . "/context_ui.js"); - drupal_add_js(drupal_get_path('module', 'context_ui') . '/jquery.pageEditor.js'); - $vars['buttons'] = $vars['form']['buttons']; - unset($vars['form']['buttons']); -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition.inc b/html/sites/all/modules/contrib/context/plugins/context_condition.inc deleted file mode 100644 index 95951d9bb..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition.inc +++ /dev/null @@ -1,196 +0,0 @@ - $val) { - if (is_object($val) || (is_array($val))) { - $this->{$key} = unserialize(serialize($val)); - } - } - } - - /** - * Constructor. Do not override. - */ - function __construct($plugin, $info) { - $this->plugin = $plugin; - $this->title = isset($info['title']) ? $info['title'] : $plugin; - $this->description = isset($info['description']) ? $info['description'] : ''; - } - - /** - * Condition values. - */ - function condition_values() { - return array(); - } - - /** - * Condition form. - */ - function condition_form($context) { - return array( - '#title' => $this->title, - '#description' => $this->description, - '#options' => $this->condition_values(), - '#type' => 'checkboxes', - '#default_value' => $this->fetch_from_context($context, 'values'), - ); - } - - /** - * Condition form submit handler. - */ - function condition_form_submit($values) { - ksort($values); - - // Editor forms are generally checkboxes -- do some checkbox processing. - return drupal_map_assoc(array_keys(array_filter($values))); - } - - /** - * Options form. Provide additional options for your condition. - */ - function options_form($context) { - return array(); - } - - /** - * Options form submit handler. - */ - function options_form_submit($values) { - return $values; - } - - /** - * Settings form. Provide variable settings for your condition. - */ - function settings_form() { - return array(); - } - - /** - * Context editor form for conditions. - */ - function editor_form($context = NULL) { - $form = array(); - if (!empty($this->values)) { - $options = $this->condition_values(); - foreach ($this->values as $value => $contexts) { - $label = "{$this->title}: "; - $label .= isset($options[$value]) ? trim($options[$value], ' -') : $value; - $form[$value] = array( - '#type' => 'checkbox', - '#title' => check_plain($label), - '#default_value' => empty($context->name) ? TRUE : in_array($context->name, $contexts, TRUE), - ); - } - } - return $form; - } - - /** - * Context editor form submit handler. - */ - function editor_form_submit(&$context, $values) { - // Merge existing values in from non-active conditions. - $existing = $this->fetch_from_context($context, 'values'); - $values += !empty($existing) ? $existing : array(); - - ksort($values); - - // Editor forms are generally checkboxes -- do some checkbox processing. - return drupal_map_assoc(array_keys(array_filter($values))); - } - - /** - * Public method that is called from hooks or other integration points with - * Drupal. Note that it is not implemented in the base class, allowing - * extending classes to change the function signature if necessary. - * - * function execute($value) { - * foreach ($this->get_contexts($value) as $context) { - * $this->condition_met($context, $value); - * } - * } - */ - - /** - * Marks a context as having met this particular condition. - */ - function condition_met($context, $value = NULL) { - if (isset($value)) { - $this->values[$value] = isset($this->values[$value]) ? $this->values[$value] : array(); - $this->values[$value][] = $context->name; - } - context_condition_met($context, $this->plugin); - } - - /** - * Check whether this condition is used by any contexts. Can be used to - * prevent expensive condition checks from being triggered when no contexts - * use this condition. - */ - function condition_used() { - $map = context_condition_map(); - return !empty($map[$this->plugin]); - } - - /** - * Retrieve all contexts with the condition value provided. - */ - function get_contexts($value = NULL) { - $map = context_condition_map(); - $map = isset($map[$this->plugin]) ? $map[$this->plugin] : array(); - - $contexts = array(); - if (isset($value) && (is_string($value) || is_numeric($value))) { - if (isset($map[$value]) && is_array($map[$value])) { - foreach ($map[$value] as $name) { - if (!isset($contexts[$name])) { - $context = context_load($name); - $contexts[$context->name] = $context; - } - } - } - } - else { - foreach ($map as $submap) { - foreach ($submap as $name) { - if (!isset($contexts[$name])) { - $context = context_load($name); - $contexts[$context->name] = $context; - } - } - } - } - return $contexts; - } - - /** - * Retrieve options from the context provided. - */ - function fetch_from_context($context, $key = NULL) { - if (isset($key)) { - return isset($context->conditions[$this->plugin][$key]) ? $context->conditions[$this->plugin][$key] : array(); - } - return isset($context->conditions[$this->plugin]) ? $context->conditions[$this->plugin] : array(); - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_book.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_book.inc deleted file mode 100644 index 24fe76903..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_book.inc +++ /dev/null @@ -1,22 +0,0 @@ -book, $node->book['menu_name'])) { - foreach ($this->get_contexts($node->book['menu_name']) as $context) { - $this->condition_met($context, $node->book['menu_name']); - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_bookroot.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_bookroot.inc deleted file mode 100644 index 778b826e9..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_bookroot.inc +++ /dev/null @@ -1,19 +0,0 @@ -condition_used() && !empty($node->book['bid'])) { - $type = db_select('node') - ->fields('node', array('type')) - ->condition('nid', $node->book['bid']) - ->execute() - ->fetchField(); - $book = new stdClass(); - $book->type = $type; - parent::execute($book, $op); - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_context.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_context.inc deleted file mode 100644 index aca0e6ae1..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_context.inc +++ /dev/null @@ -1,65 +0,0 @@ -condition_used()) { - $active_contexts = array_keys(context_active_contexts()); - foreach ($this->get_contexts() as $context) { - if (!in_array($context->name, $active_contexts, TRUE) && $values = $this->fetch_from_context($context, 'values')) { - // Always check against the active contexts. - if ($this->match(array_keys(context_active_contexts()), $values)) { - $this->condition_met($context); - } - } - } - // If the list of active contexts has changed, we need to recurse. - if ($active_contexts != array_keys(context_active_contexts())) { - $this->execute(); - } - } - } - - /** - * Retrieve all context conditions. - * - * This method is slightly adapted to context_condition::get_contexts() in - * order to ensure that a context that is used as condition in another context - * gets handled before. - */ - function get_contexts($value = NULL) { - $map = context_condition_map(); - $map = isset($map[$this->plugin]) ? $map[$this->plugin] : array(); - - $contexts = array(); - - // Add the contexts that are needed for conditions in the other contexts - // first. Start with the negated ones first, as we can not unset a met - // condition afterwards. - krsort($map); - foreach ($map as $key => $submap) { - // Negated context conditions start with a "~". - if (substr($key, 0, 1) == "~") { - $key = substr($key, 1); - } - if (!isset($contexts[$key])) { - $context = context_load($key); - // Check if context exists. This will fail for wildcards. - if ($context) { - $contexts[$context->name] = $context; - } - } - } - foreach ($map as $key => $submap) { - foreach ($submap as $name) { - if (!isset($contexts[$name])) { - $context = context_load($name); - $contexts[$context->name] = $context; - } - } - } - return $contexts; - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_context_all.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_context_all.inc deleted file mode 100644 index ad4c0fc1a..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_context_all.inc +++ /dev/null @@ -1,81 +0,0 @@ -condition_used()) { - $active_contexts = array_keys(context_active_contexts()); - foreach ($this->get_contexts() as $context) { - - // Only test contexts that haven't been activated yet, - // and have values set. - if (!in_array($context->name, $active_contexts, TRUE) && $values = $this->fetch_from_context($context, 'values')) { - - $contexts_matched = 0; - - // Count the matched contexts - foreach($values as $value) { - // Always check against the active contexts. - if ($this->match(array_keys(context_active_contexts()), array($value))) { - $contexts_matched++; - } - } - - // The condition is met if all contexts are active. - if ($contexts_matched == count($values)) { - $this->condition_met($context); - } - } - } - - // If the list of active contexts has changed, we need to recurse. - if ($active_contexts != array_keys(context_active_contexts())) { - $this->execute(); - } - } - } - - /** - * Retrieve all context conditions. - * - * This method is slightly adapted to context_condition::get_contexts() in - * order to ensure that a context that is used as condition in another context - * gets handled before. - */ - function get_contexts($value = NULL) { - $map = context_condition_map(); - $map = isset($map[$this->plugin]) ? $map[$this->plugin] : array(); - - $contexts = array(); - - // Add the contexts that are needed for conditions in the other contexts - // first. Start with the negated ones first, as we can not unset a met - // condition afterwards. - krsort($map); - foreach ($map as $key => $submap) { - // Negated context conditions start with a "~". - if (substr($key, 0, 1) == "~") { - $key = substr($key, 1); - } - if (!isset($contexts[$key])) { - $context = context_load($key); - // Check if context exists. This will fail for wildcards. - if ($context) { - $contexts[$context->name] = $context; - } - } - } - foreach ($map as $key => $submap) { - foreach ($submap as $name) { - if (!isset($contexts[$name])) { - $context = context_load($name); - $contexts[$context->name] = $context; - } - } - } - - return $contexts; - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_default.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_default.inc deleted file mode 100644 index b463c0a99..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_default.inc +++ /dev/null @@ -1,35 +0,0 @@ - t('Default context')); - } - - function editor_form($context = NULL) { - $form = parent::editor_form($context); - $form[1]['#title'] = t('Default context'); - $form['#weight'] = -10; - return $form; - } - - function execute() { - if ($this->condition_used()) { - $active_contexts = context_active_contexts(); - - foreach ($active_contexts as $name => $context) { - foreach (array_keys($context->conditions) as $cond) { - if (!in_array($cond, array('default', 'sitewide'))) { - return; - } - } - } - foreach ($this->get_contexts('context_condition_default') as $context) { - $this->condition_met($context, 'context_condition_default'); - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_language.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_language.inc deleted file mode 100644 index 2d9cc43e0..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_language.inc +++ /dev/null @@ -1,16 +0,0 @@ -get_contexts($value) as $context) { - $this->condition_met($context, $value); - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_menu.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_menu.inc deleted file mode 100644 index 4b19e02a7..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_menu.inc +++ /dev/null @@ -1,80 +0,0 @@ - 0)); - $root_menus = array(); - foreach ($menus as $key => $name) { - $id = explode(':', $key); - if ($id[1] == '0') { - $root_menus[$id[0]] = $name; - } - else { - $link = menu_link_load($id[1]); - $identifier = $link['link_path']; - $root_menu = $root_menus[$id[0]]; - while (isset($menus[$root_menu][$identifier])) { - $identifier .= "'"; - } - $menus[$root_menu][$identifier] = $name; - } - unset($menus[$key]); - } - array_unshift($menus, "-- " . t('None') . " --"); - } - else { - $menus = array(); - } - return $menus; - } - - /** - * Override of condition_form(). - * Use multiselect widget. - */ - function condition_form($context) { - $form = parent::condition_form($context); - $menu_count = count($form['#options'], COUNT_RECURSIVE); - $form['#type'] = 'select'; - $form['#multiple'] = TRUE; - $form['#attributes'] = array('size' => $menu_count > 20 ? 20 : $menu_count); - return $form; - } - - /** - * Override of condition_form_submit(). - * Trim any identifier padding for non-unique path menu items. - */ - function condition_form_submit($values) { - // Trim any identifier padding for non-unique path menu items. - $values = parent::condition_form_submit($values); - $trimmed = array(); - foreach ($values as $key => $value) { - $trimmed[trim($key, "'")] = trim($value, "'"); - } - return $trimmed; - } - - /** - * Override of execute(). - */ - function execute() { - if ($this->condition_used()) { - $trail = menu_get_active_trail(); - foreach ($trail as $item) { - if (!empty($item['href'])) { - foreach ($this->get_contexts($item['href']) as $context) { - $this->condition_met($context, $item['href']); - } - } - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_node.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_node.inc deleted file mode 100644 index 6c2c534c2..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_node.inc +++ /dev/null @@ -1,62 +0,0 @@ -type] = check_plain($type->name); - } - return $values; - } - - function options_form($context) { - $defaults = $this->fetch_from_context($context, 'options'); - return array( - 'node_form' => array( - '#title' => t('Set on node form'), - '#type' => 'select', - '#options' => array( - CONTEXT_NODE_VIEW => t('No'), - CONTEXT_NODE_FORM => t('Yes'), - CONTEXT_NODE_FORM_ONLY => t('Only on node form') - ), - '#description' => t('Set this context on node forms'), - '#default_value' => isset($defaults['node_form']) ? $defaults['node_form'] : TRUE, - ), - ); - } - - function execute($node, $op) { - foreach ($this->get_contexts($node->type) as $context) { - // Check the node form option. - $options = $this->fetch_from_context($context, 'options'); - if ($op === 'form') { - $options = $this->fetch_from_context($context, 'options'); - if (!empty($options['node_form']) && in_array($options['node_form'], array(CONTEXT_NODE_FORM, CONTEXT_NODE_FORM_ONLY))) { - $this->condition_met($context, $node->type); - } - } - elseif (empty($options['node_form']) || $options['node_form'] != CONTEXT_NODE_FORM_ONLY) { - $this->condition_met($context, $node->type); - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_node_taxonomy.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_node_taxonomy.inc deleted file mode 100644 index 00905aa70..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_node_taxonomy.inc +++ /dev/null @@ -1,77 +0,0 @@ -tags)) { - foreach (taxonomy_get_tree($vocab->vid) as $term) { - $values[$term->tid] = check_plain($term->name); - } - } - } - } - return $values; - } - - function condition_form($context) { - $form = parent::condition_form($context); - $form['#type'] = 'select'; - $form['#size'] = 12; - $form['#multiple'] = TRUE; - $vocabularies = taxonomy_get_vocabularies(); - $options = array(); - foreach ($vocabularies as $vid => $vocabulary) { - $tree = taxonomy_get_tree($vid); - if ($tree && (count($tree) > 0)) { - $options[$vocabulary->name] = array(); - foreach ($tree as $term) { - $options[$vocabulary->name][$term->tid] = str_repeat('-', $term->depth) . $term->name; - } - } - } - $form['#options'] = $options; - return $form; - } - - function execute($node, $op) { - // build a list of each taxonomy reference field belonging to the bundle for the current node - $fields = field_info_fields(); - $instance_fields = field_info_instances('node', $node->type); - $check_fields = array(); - foreach ($instance_fields as $key => $field_info) { - if ($fields[$key]['type'] == 'taxonomy_term_reference') { - $check_fields[$key] = 'tid'; - } - else if ($fields[$key]['type'] == 'entityreference' && - $fields[$key]['settings']['target_type'] == 'taxonomy_term') { - $check_fields[$key] = 'target_id'; - } - } - - if ($this->condition_used() && !empty($check_fields)) { - foreach ($check_fields as $field => $term_id_key) { - if ($terms = field_get_items('node', $node, $field)) { - foreach ($terms as $term) { - foreach ($this->get_contexts($term[$term_id_key]) as $context) { - // Check the node form option. - if ($op === 'form') { - $options = $this->fetch_from_context($context, 'options'); - if (!empty($options['node_form'])) { - $this->condition_met($context, $term[$term_id_key]); - } - } - else { - $this->condition_met($context, $term[$term_id_key]); - } - } - } - } - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_path.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_path.inc deleted file mode 100644 index d3717c8b4..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_path.inc +++ /dev/null @@ -1,116 +0,0 @@ -fetch_from_context($context, 'values')); - return $form; - } - - /** - * Condition form submit handler. - */ - function condition_form_submit($values) { - $parsed = array(); - $items = explode("\n", $values); - if (!empty($items)) { - foreach ($items as $v) { - $v = trim($v); - if (!empty($v)) { - $parsed[$v] = $v; - } - } - } - return $parsed; - } - - /** - * Execute. - */ - function execute() { - if ($this->condition_used()) { - // Include both the path alias and normal path for matching. - $current_path = array(drupal_get_path_alias($_GET['q'])); - if ($current_path[0] != $_GET['q']) { - $current_path[] = $_GET['q']; - } - foreach ($this->get_contexts() as $context) { - $paths = $this->fetch_from_context($context, 'values'); - if ($this->match($current_path, $paths, TRUE)) { - $this->condition_met($context); - } - } - } - } - - /** - * Match the subject against a set of regex patterns. - * Similar to drupal_match_path() but also handles negation through the use - * of the ~ character. - * - * @param mixed $subject - * The subject string or an array of strings to be matched. - * @param array $patterns - * An array of patterns. Any patterns that begin with ~ are considered - * negative or excluded conditions. - * @param boolean $path - * Whether the given subject should be matched as a Drupal path. If TRUE, - * '' will be replaced with the site frontpage when matching against - * $patterns. - */ - protected function match($subject, $patterns, $path = FALSE) { - static $regexps; - $match = FALSE; - $positives = $negatives = 0; - $subject = !is_array($subject) ? array($subject) : $subject; - foreach ($patterns as $pattern) { - if (strpos($pattern, '~') === 0) { - $negate = TRUE; - $negatives++; - } - else { - $negate = FALSE; - $positives++; - } - $pattern = ltrim($pattern, '~'); - if (!isset($regexps[$pattern])) { - if ($path) { - $regexps[$pattern] = '/^(' . preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\($|\|)/'), array('|', '.*', '\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\2'), preg_quote($pattern, '/')) . ')$/'; - } - else { - $regexps[$pattern] = '/^(' . preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/'), array('|', '.*'), preg_quote($pattern, '/')) . ')$/'; - } - } - foreach ($subject as $value) { - if (preg_match($regexps[$pattern], $value)) { - if ($negate) { - return FALSE; - } - $match = TRUE; - } - } - } - // If there are **only** negative conditions and we've gotten this far none - // we actually have a match. - if ($positives === 0 && $negatives) { - return TRUE; - } - return $match; - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_query_string.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_query_string.inc deleted file mode 100644 index b7bf5d515..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_query_string.inc +++ /dev/null @@ -1,28 +0,0 @@ -condition_used()) { - $current_query_string = empty($_SERVER["QUERY_STRING"]) ? '' : $_SERVER["QUERY_STRING"]; - foreach ($this->get_contexts() as $context) { - $query_strings = $this->fetch_from_context($context, 'values'); - if ($this->match($current_query_string, $query_strings, TRUE)) { - $this->condition_met($context); - } - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_sitewide.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_sitewide.inc deleted file mode 100644 index 11e64c1d4..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_sitewide.inc +++ /dev/null @@ -1,23 +0,0 @@ - t('Always active')); - } - - function editor_form($context = NULL) { - $form = parent::editor_form($context); - $form[1]['#title'] = t('Always active'); - $form['#weight'] = -10; - return $form; - } - - function execute($value) { - foreach ($this->get_contexts($value) as $context) { - $this->condition_met($context, $value); - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_taxonomy_term.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_taxonomy_term.inc deleted file mode 100644 index e3e047870..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_taxonomy_term.inc +++ /dev/null @@ -1,47 +0,0 @@ -machine_name] = check_plain($vocab->name); - } - return $values; - } - - function options_form($context) { - $defaults = $this->fetch_from_context($context, 'options'); - return array( - 'term_form' => array( - '#title' => t('Set on term form'), - '#type' => 'select', - '#options' => array( - 0 => t('No'), - 1 => t('Yes'), - 2 => t('Only on term form') - ), - '#description' => t('Set this context on term forms'), - '#default_value' => isset($defaults['term_form']) ? $defaults['term_form'] : TRUE, - ), - ); - } - - function execute($term, $op) { - foreach ($this->get_contexts($term->vocabulary_machine_name) as $context) { - // Check the node form option. - $options = $this->fetch_from_context($context, 'options'); - if ($op === 'form') { - $options = $this->fetch_from_context($context, 'options'); - if (!empty($options['term_form']) && in_array($options['term_form'], array(1, 2))) { - $this->condition_met($context, $term->vocabulary_machine_name); - } - } - elseif (empty($options['term_form']) || $options['term_form'] != 2) { - $this->condition_met($context, $term->vocabulary_machine_name); - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_user.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_user.inc deleted file mode 100644 index a6d62ccca..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_user.inc +++ /dev/null @@ -1,64 +0,0 @@ - $role_name) { - if ($rid == DRUPAL_ANONYMOUS_RID) { - $values['anonymous user'] = check_plain($role_name); - } - elseif ($rid == DRUPAL_AUTHENTICATED_RID) { - $values['authenticated user'] = check_plain($role_name); - } - else { - $values[$role_name] = check_plain($role_name); - } - } - return $values; - } - - function options_form($context) { - $defaults = $this->fetch_from_context($context, 'options'); - return array( - 'negate_role' => array( - '#title' => t('Make role a negative condition'), - '#type' => 'checkbox', - '#description' => t("Checking this box will make this condition fire if the user's role is NOT one of the role's checked"), - '#default_value' => isset($defaults['negate_role']) ? $defaults['negate_role'] : 0, - ), - ); - } - - function execute($account) { - $all_roles = user_roles(); - $users_roles = $account->roles; - foreach ($all_roles as $rid => $role) { - foreach ($this->get_contexts($role) as $context) { - $options = $this->fetch_from_context($context, 'options'); - if (empty($options['negate_role'])) { - if (in_array($role, $users_roles)){ - $this->condition_met($context, $role); - } - } - else { - $negate_flag = TRUE; - foreach ($this->fetch_from_context($context, 'values') as $nid => $negated_role) { - if (!in_array($negated_role, $users_roles)) { - $negate_flag &= TRUE; - } - else { - $negate_flag &= FALSE; - } - } - if ($negate_flag) { - $this->condition_met($context, $role); - } - } - } - } - } - -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_user_page.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_user_page.inc deleted file mode 100644 index 4e1596b88..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_user_page.inc +++ /dev/null @@ -1,59 +0,0 @@ -fetch_from_context($context, 'options'); - return array( - 'mode' => array( - '#title' => t('Active for'), - '#type' => 'select', - '#options' => array( - 'all' => t('Any user'), - 'current' => t('Only the current user'), - 'other' => t('Only other users'), - ), - '#default_value' => isset($defaults['mode']) ? $defaults['mode'] : 'all', - ), - ); - } - - function execute($account, $op) { - global $user; - foreach ($this->get_contexts($op) as $context) { - if ($op === 'register') { - $this->condition_met($context); - } - else { - $options = $this->fetch_from_context($context, 'options'); - $mode = !empty($options['mode']) ? $options['mode'] : 'all'; - switch ($options['mode']) { - case 'current': - if ($account->uid == $user->uid) { - $this->condition_met($context); - } - break; - case 'other': - if ($account->uid != $user->uid) { - $this->condition_met($context); - } - break; - case 'all': - default: - $this->condition_met($context); - break; - } - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_condition_views.inc b/html/sites/all/modules/contrib/context/plugins/context_condition_views.inc deleted file mode 100644 index 4cb92f61c..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_condition_views.inc +++ /dev/null @@ -1,48 +0,0 @@ -name]->disabled) || !$views[$view->name]->disabled) { - $enabled_views[$view->name] = check_plain($view->name); - - // Provide more granular options for each page display - $displays = array(); - foreach ($view->display as $id => $display) { - if ($display->display_plugin == 'page') { - $displays[$view->name . ":" . $id] = check_plain("-- {$display->display_title}"); - } - } - $enabled_views += $displays; - } - } - return $enabled_views; - } - - function execute($view) { - switch ($view->display_handler->display->display_plugin) { - case 'page': - case 'calendar': - // Set contexts for this view. - foreach ($this->get_contexts($view->name) as $context) { - $this->condition_met($context, $view->name); - } - // Set any contexts associated with the current display - if (!empty($view->current_display)) { - foreach ($this->get_contexts("{$view->name}:{$view->current_display}") as $context) { - $this->condition_met($context, "{$view->name}:{$view->current_display}"); - } - } - break; - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction.inc b/html/sites/all/modules/contrib/context/plugins/context_reaction.inc deleted file mode 100644 index f32433959..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_reaction.inc +++ /dev/null @@ -1,86 +0,0 @@ - $val) { - if (is_object($val) || (is_array($val))) { - $this->{$key} = unserialize(serialize($val)); - } - } - } - - /** - * Constructor. Do not override. - */ - function __construct($plugin, $info) { - $this->plugin = $plugin; - $this->title = isset($info['title']) ? $info['title'] : $plugin; - $this->description = isset($info['description']) ? $info['description'] : ''; - } - - function options_form($context) { - return array(); - } - - /** - * Options form submit handler. - */ - function options_form_submit($values) { - return $values; - } - - /** - * Settings form. Provide variable settings for your reaction. - */ - function settings_form() { - return array(); - } - - /** - * Public method that is called from hooks or other integration points with - * Drupal. Note that it is not implemented in the base class, allowing - * extending classes to change the function signature if necessary. - * - * function execute($value) { - * foreach ($this->get_contexts($value) as $context) { - * $this->condition_met($context, $value); - * } - * } - */ - - /** - * Retrieve active contexts that have values for this reaction. - */ - function get_contexts() { - $contexts = array(); - foreach (context_active_contexts() as $context) { - if ($this->fetch_from_context($context)) { - $contexts[$context->name] = $context; - } - } - return $contexts; - } - - /** - * Retrieve options from the context provided. - */ - function fetch_from_context($context) { - return isset($context->reactions[$this->plugin]) ? $context->reactions[$this->plugin] : array(); - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction_block.css b/html/sites/all/modules/contrib/context/plugins/context_reaction_block.css deleted file mode 100644 index e82a6a66b..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_reaction_block.css +++ /dev/null @@ -1,262 +0,0 @@ -/** - * Script placeholder markup. - */ -.script-placeholder { - padding:100px 0px; - text-align:center; - } - -/** - * Browser - */ -.context-block-browser { - width: 600px; -} - -.context-block-browser .blocks { - height:98%; - overflow: auto; - float: left; - width: 320px; -} - -.context-block-browser .block-browser-sidebar { - float: left; - width: 250px; - padding: 0 0 0 15px; -} - -.context-block-item, -.context-block-browser .draggable-placeholder, -#admin-toolbar .context-block-browser .context-block-item { - font-size:11px; - line-height:20px; - height:20px; - - color:#333; - - padding:3px 3px 3px 3px; - margin:0px 1px 1px 0px; - max-width:300px; - white-space:nowrap; - overflow:hidden; - - background:#efefef; - border:1px solid #ddd; - position:relative; - - border-radius:5px; - -moz-border-radius:5px; - -moz-user-select:none; - -webkit-user-select:none; -} - - - .context-block-addable { cursor: pointer; } - - .context-block-item span.icon { - background:url(context_reaction_block.png) 0px -80px no-repeat; - display:block; - width:20px; - height:20px; - float:left; - margin-right:5px; - } - - .context-block-loading { max-width:none; } - - .context-block-loading span.icon { - background-position:-20px -80px; - float:none; - margin:0px auto; - } - - .context-block-browser .draggable-placeholder { padding:2px 1px 1px 2px; } - - #admin-toolbar.horizontal .context-block-browser .draggable-placeholder, - #admin-toolbar.horizontal .context-block-browser .context-block-item { - width:180px; - margin-right:1px; - padding-right:9px; - float:left; - } - - - .context-block-added { display:none !important; } - -/** - * Inline editing elements ============================================ - */ -div.context-block-region {display: none;} -a.context-block { display:none !important; } - -body.context-editing div.context-block-region { - -moz-border-radius:5px; - -webkit-border-radius:5px; - background:#666; - color:#fff; - opacity: 0.5; - -moz-opacity: 0.5; - filter:alpha(opacity=50); - - display:block; - height:40px; - line-height:24px; - - text-align:center; - font-size:18px; - white-space:nowrap; -} - -.context-block-region .region-name { - width:100%; - text-align:center; - font-size:18px; - color:#fff; - white-space:nowrap; - display:block; - -moz-user-select:none; - -webkit-user-select:none; - } - -body.context-editing .ui-sortable .block { opacity:.25; } - -body.context-editing .ui-sortable .draggable { - position:relative; - opacity:1; - } - -body.context-editing .draggable-placeholder { - -moz-border-radius:5px; - -webkit-border-radius:5px; - - background:#fff; - border:3px dashed #666; - opacity:.2; - } - -body.context-editing .draggable:hover a.context-block-remove, -body.context-editing .draggable:hover a.context-block-handle { - background:url(context_reaction_block.png) no-repeat; - cursor:move; - display:block; - width:40px; - height:40px; - position:absolute; - right:35px; - top:-5px; - z-index:100; - } - -body.context-editing .draggable:hover a.context-block-remove { - background-position:-40px 0px; - cursor:pointer; - right:-5px; - } - - .context-block-hidden { display:none !important; } - - .block .context-block-empty-content { - text-align:center; - padding:10px; - opacity:.5; - background:#fff; - color:#666; - } - -/** - * Block visibility =================================================== - */ -#context-blockform .context-blockform-selector { - overflow:auto; - } - -#context-blockform span.system-blocks { color:#999; } - -#context-blockform td.blocks, -#context-blockform td.selector { - border:1px solid #ddd; - padding:10px; - width:50%; - vertical-align: top; - } - -#context-blockform td.blocks .label, -#context-blockform td.blocks td, -#context-blockform td.blocks th { - background:#fff; - padding:5px 5px 4px; - border:0px; - border-bottom:1px solid #ddd; - } - - #context-blockform td.blocks .label { background:#eee; } - #context-blockform td.blocks .label a { float:right; } - -#context-ui-items #context-blockform { - font-size:11px; - line-height:15px; - } - -#context-ui-items #context-blockform .form-checkboxes { - height:auto; - overflow:visible; - padding:0px; - margin:0px; - border:0px; - } - -#context-ui-items #context-blockform .form-item { padding:0px; } - -#context-ui-items #context-blockform label { - background:#eee; - display:block; - padding:5px; - line-height:15px; - } - -#context-ui-items #context-blockform label.option { - background:#fff; - display:block; - border:0px; - } - -#context-blockform .tabledrag-toggle-weight-wrapper { - margin-bottom:0; - } - -a.context-ui-add-link, a:link.context-ui-add-link, a:visited.context-ui-add-link { - display:block; - width:100%; - text-align:center; - font-size:12px; - color:#fff; - cursor: pointer; - line-height:14px; -} - -.editing-context-label { - position: fixed; - top:70px; - background:#fff; - color:#222; - padding:10px; - font-weight:bold; - opacity: 0.5; - -moz-opacity: 0.5; - filter:alpha(opacity=50); - border:1px solid #ddd; - border-left:0; - border-radius:0 6px 6px 0; -} - -.context-help { - font-size:12px; - font-weight:normal; -} - -.context-editor-title { - font-size:24px; - margin:10px 0px; - padding:0; -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction_block.inc b/html/sites/all/modules/contrib/context/plugins/context_reaction_block.inc deleted file mode 100644 index 90c005c64..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_reaction_block.inc +++ /dev/null @@ -1,682 +0,0 @@ -get_blocks(NULL, NULL, $this->rebuild_needed()); - $this->rebuild_needed(FALSE); - - $theme_key = variable_get('theme_default', 'garland'); - $weight_delta = $this->max_block_weight(); - - $form = array( - '#tree' => TRUE, - '#theme' => 'context_block_form', - 'max_block_weight' => array( - '#value' => $weight_delta, - '#type' => 'value', - ), - 'state' => array( - '#type' => 'hidden', - '#attributes' => array('class' => 'context-blockform-state'), - ), - ); - - /** - * Selector. - */ - $modules = module_list(); - $form['selector'] = array( - '#type' => 'item', - '#tree' => TRUE, - '#prefix' => '
', - '#suffix' => '
', - ); - foreach ($this->get_blocks() as $block) { - $group = isset($block->context_group) ? $block->context_group : $block->module; - if (!isset($form['selector'][$group])) { - $form['selector'][$group] = array( - '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#title' => isset($block->context_group) ? $block->context_group : $modules[$block->module], - ); - $form['selector'][$group]['checkboxes'] = array( - '#type' => 'checkboxes', - '#options' => array(), - ); - } - $form['selector'][$group]['checkboxes']['#options'][$block->bid] = check_plain($block->info); - } - - ksort($form['selector']); - - /** - * Regions. - */ - $form['blocks'] = array( - '#tree' => TRUE, - '#theme' => 'context_block_regions_form', - ); - foreach ($this->system_region_list($theme_key, REGIONS_VISIBLE) as $region => $label) { - $form['blocks'][$region] = array( - '#type' => 'item', - '#title' => $label, - '#tree' => TRUE, - ); - foreach ($this->get_blocks($region, $context) as $block) { - if (!empty($block->context)) { - $form['blocks'][$region][$block->bid] = array( - '#value' => check_plain($block->info), - '#weight' => $block->weight, - '#type' => 'markup', - '#tree' => TRUE, - 'weight' => array('#type' => 'weight', '#delta' => $weight_delta, '#default_value' => $block->weight), - ); - } - } - } - return $form; - } - - /** - * Options form submit handler. - */ - function options_form_submit($values) { - $blocks = array(); - $block_info = $this->get_blocks(); - - // Retrieve blocks from submitted JSON string. - if (!empty($values['state'])) { - $edited = $this->json_decode($values['state']); - } - else { - $edited = array(); - } - - foreach ($edited as $region => $block_data) { - foreach ($block_data as $position => $data) { - if (isset($block_info[$data->bid])) { - $blocks[$data->bid] = array( - 'module' => $block_info[$data->bid]->module, - 'delta' => $block_info[$data->bid]->delta, - 'region' => $region, - 'weight' => $data->weight, - ); - } - } - } - return array('blocks' => $blocks); - } - - /** - * Context editor form for blocks. - */ - function editor_form($context) { - $form = array(); - drupal_add_library('system', 'ui.droppable'); - drupal_add_library('system', 'ui.sortable'); - drupal_add_js(drupal_get_path('module', 'context_ui') . '/json2.js'); - drupal_add_js(drupal_get_path('module', 'context_ui') . '/theme/filter.js'); - drupal_add_js(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.js'); - drupal_add_css(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.css'); - - // We might be called multiple times so use a static to ensure this is set just once. - static $once; - if (!isset($once)) { - $settings = array( - 'path' => drupal_is_front_page() ? base_path() : url($_GET['q']), - 'params' => (object) array_diff_key($_GET, array('q' => '')), - 'scriptPlaceholder' => theme('context_block_script_placeholder', array('text' => '')), - ); - drupal_add_js(array('contextBlockEditor' => $settings), 'setting'); - $once = TRUE; - } - - $form['state'] = array( - '#type' => 'hidden', - '#attributes' => array('class' => array('context-block-editor-state')), - ); - $form['browser'] = array( - '#markup' => theme('context_block_browser', array( - 'blocks' => $this->get_blocks(NULL, NULL, $this->rebuild_needed()), - 'context' => $context - )), - ); - $this->rebuild_needed(FALSE); - return $form; - } - - /** - * Submit handler context editor form. - */ - function editor_form_submit(&$context, $values) { - $edited = !empty($values['state']) ? (array) $this->json_decode($values['state']) : array(); - - $options = array(); - - // Take the existing context values and remove blocks that belong affected regions. - $affected_regions = array_keys($edited); - if (!empty($context->reactions['block']['blocks'])) { - $options = $context->reactions['block']; - foreach ($options['blocks'] as $key => $block) { - if (in_array($block['region'], $affected_regions)) { - unset($options['blocks'][$key]); - } - } - } - - // Iterate through blocks and add in the ones that belong to the context. - foreach ($edited as $region => $blocks) { - foreach ($blocks as $weight => $block) { - if ($block->context === $context->name) { - $split = explode('-', $block->bid); - $options['blocks'][$block->bid] = array( - 'module' => array_shift($split), - 'delta' => implode('-', $split), - 'region' => $region, - 'weight' => $weight, - ); - } - } - } - - return $options; - } - - /** - * Settings form for variables. - */ - function settings_form() { - $form = array(); - $form['context_reaction_block_all_regions'] = array( - '#title' => t('Show all regions'), - '#type' => 'checkbox', - '#default_value' => variable_get('context_reaction_block_all_regions', FALSE), - '#description' => t('Show all regions including those that are empty. Enable if you are administering your site using the inline editor.') - ); - return $form; - } - - /** - * Execute. - */ - function execute(&$page) { - global $theme; - - // The theme system might not yet be initialized. We need $theme. - drupal_theme_initialize(); - - // If the context_block querystring param is set, switch to AJAX rendering. - // Note that we check the output buffer for any content to ensure that we - // are not in the middle of a PHP template render. - if (isset($_GET['context_block']) && !ob_get_contents()) { - return $this->render_ajax($_GET['context_block']); - } - - // Populate all block regions - $all_regions = $this->system_region_list($theme); - - // Load all region content assigned via blocks. - foreach (array_keys($all_regions) as $region) { - if ($this->is_enabled_region($region)) { - if ($blocks = $this->block_get_blocks_by_region($region)) { - - // Are the blocks already sorted. - $blocks_sorted = TRUE; - - // If blocks have already been placed in this region (most likely by - // Block module), then merge in blocks from Context. - if (isset($page[$region])) { - $page[$region] = array_merge($page[$region], $blocks); - - // Restore the weights that Block module manufactured - // @see _block_get_renderable_array() - foreach ($page[$region] as &$block) { - if (isset($block['#block']->weight)) { - $block['#weight'] = $block['#block']->weight; - $blocks_sorted = FALSE; - } - } - } - else { - $page[$region] = $blocks; - } - - $page[$region]['#sorted'] = $blocks_sorted; - } - } - } - } - - /** - * Return a list of enabled regions for which blocks should be built. - * Split out into a separate method for easy overrides in extending classes. - */ - protected function is_enabled_region($region) { - global $theme; - $regions = array_keys($this->system_region_list($theme)); - return in_array($region, $regions, TRUE); - } - - /** - * Determine whether inline editing requirements are met and that the current - * user may edit. - */ - protected function is_editable_region($region, $reset = FALSE) { - // Check requirements. - // Generally speaking, it does not make sense to allow anonymous users to - // edit a context inline. Though it may be possible to save (and restore) - // an edited context to an anonymous user's cookie or session, it's an - // edge case and probably not something we want to encourage anyway. - static $requirements; - if (!isset($requirements) || $reset) { - global $user; - if ($user->uid && user_access('administer contexts') && variable_get('context_ui_dialog_enabled', FALSE)) { - $requirements = TRUE; - drupal_add_library('system', 'ui.droppable'); - drupal_add_library('system', 'ui.sortable'); - drupal_add_js(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.js'); - drupal_add_css(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.css'); - } - else { - $requirements = FALSE; - } - } - // Check that this region is not locked by the theme. - global $theme; - $info = system_get_info('theme', $theme); - if ($info && isset($info['regions_locked']) && in_array($region, $info['regions_locked'])) { - return FALSE; - } - // Check that this region is not hidden - $visible = $this->system_region_list($theme, REGIONS_VISIBLE); - return $requirements && $this->is_enabled_region($region) && isset($visible[$region]); - } - - /** - * Add markup for making a block editable. - */ - protected function editable_block($block) { - if (!empty($block->content)) { - $block->content['#theme_wrappers'][] = 'context_block_edit_wrap'; - } - else { - // the block alter in context.module should ensure that blocks are never - // empty if the inline editor is present but in the case that they are, - // warn that editing the context is likely to cause this block to be dropped - drupal_set_message(t('The block with delta @delta from module @module is not compatible with the inline editor and will be dropped from the context containing it if you edit contexts here', array('@delta' => $block->delta, '@module' => $block->module)), 'warning'); - } - return $block; - } - - /** - * Add markup for making a region editable. - */ - protected function editable_region($region, $build) { - if ($this->is_editable_region($region) && - (!empty($build) || - variable_get('context_reaction_block_all_regions', FALSE) || - context_isset('context_ui', 'context_ui_editor_present')) - ) { - global $theme; - $regions = $this->system_region_list($theme); - $name = isset($regions[$region]) ? $regions[$region] : $region; - // The negative weight + sorted will push our region marker to the top of the region - $build['context'] = array( - '#prefix' => "
", - '#markup' => "{$name}" . - "" . t('Add a block here.') . '', - '#suffix' => '
', - '#weight' => -100, - ); - $build['#sorted'] = FALSE; - } - - return $build; - } - - /** - * Get a renderable array of a region containing all enabled blocks. - */ - function block_get_blocks_by_region($region) { - module_load_include('module', 'block', 'block'); - - $build = array(); - if ($list = $this->block_list($region)) { - $build = _block_get_renderable_array($list); - } - if ($this->is_editable_region($region)) { - $build = $this->editable_region($region, $build); - } - return $build; - } - - /** - * An alternative version of block_list() that provides any context enabled blocks. - */ - function block_list($region) { - module_load_include('module', 'block', 'block'); - - $context_blocks = &drupal_static('context_reaction_block_list');; - $contexts = context_active_contexts(); - if (!isset($context_blocks)) { - $info = $this->get_blocks(); - $context_blocks = array(); - foreach ($contexts as $context) { - $options = $this->fetch_from_context($context); - if (!empty($options['blocks'])) { - foreach ($options['blocks'] as $context_block) { - $bid = "{$context_block['module']}-{$context_block['delta']}"; - if (isset($info[$bid])) { - $block = (object) array_merge((array) $info[$bid], $context_block); - $block->context = $context->name; - $block->title = isset($info[$block->bid]->title) ? $info[$block->bid]->title : NULL; - $block->cache = isset($info[$block->bid]->cache) ? $info[$block->bid]->cache : DRUPAL_NO_CACHE; - $context_blocks[$block->region][$block->bid] = $block; - } - } - } - } - - $this->is_editable_check($context_blocks); - global $theme; - $active_regions = $this->system_region_list($theme); - - // Make context renders regions in the same order as core. - $_context_blocks = array(); - foreach ($active_regions as $r => $name) { - if (isset($context_blocks[$r])) { - $_context_blocks[$r] = $context_blocks[$r]; - } - } - $context_blocks = $_context_blocks; - unset($_context_blocks); - - foreach ($context_blocks as $r => $blocks) { - // Only render blocks in an active region. - if (array_key_exists($r, $active_regions)) { - $context_blocks[$r] = _block_render_blocks($blocks); - - $editable = $this->is_editable_region($r); - foreach ($context_blocks[$r] as $key => $block) { - // Add the region property to each block. - $context_blocks[$r][$key]->region = $r; - - // Make blocks editable if allowed. - if ($editable) { - $context_blocks[$r][$key] = $this->editable_block($block); - } - } - } - - // Sort blocks. - uasort($context_blocks[$r], array('context_reaction_block', 'block_sort')); - } - } - return isset($context_blocks[$region]) ? $context_blocks[$region] : array(); - } - - /** - * Determine if there is an active context editor block, and set a flag. We will set a flag so - * that we can make sure that blocks with empty content have some default content. This is - * needed so the save of the context inline editor does not remove the blocks with no content. - */ - function is_editable_check($context_blocks) { - foreach ($context_blocks as $r => $blocks) { - if (isset($blocks['context_ui-editor'])) { - $block = $blocks['context_ui-editor']; - // see if the editor is actually enabled, lifted from _block_render_blocks - if (!count(module_implements('node_grants')) && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD') && ($cid = _block_get_cache_id($block)) && ($cache = cache_get($cid, 'cache_block'))) { - $array = $cache->data; - } - else { - $array = module_invoke($block->module, 'block_view', $block->delta); - drupal_alter(array('block_view', "block_view_{$block->module}_{$block->delta}"), $array, $block); - } - if(!empty($array['content'])) { - context_set('context_ui', 'context_ui_editor_present', TRUE); - } - break; - } - } - } - - /** - * Generate the safe weight range for a block being added to a region such that - * there are enough potential unique weights to support all blocks. - */ - protected function max_block_weight() { - $blocks = $this->get_blocks(); - - // Add 2 to make sure there's space at either end of the block list. - return round((count($blocks) + 2) / 2); - } - - /** - * Check or set whether a rebuild of the block info cache is needed. - */ - function rebuild_needed($set = NULL) { - if (isset($set) && $set != variable_get('context_block_rebuild_needed', FALSE)) { - variable_set('context_block_rebuild_needed', $set); - } - return (bool) variable_get('context_block_rebuild_needed', FALSE); - } - - /** - * Helper function to generate a list of blocks from a specified region. If provided a context object, - * will generate a full list of blocks for that region distinguishing between system blocks and - * context-provided blocks. - * - * @param $region - * The string identifier for a theme region. e.g. "left" - * @param $context - * A context object. - * - * @return - * A keyed (by "module_delta" convention) array of blocks. - */ - function get_blocks($region = NULL, $context = NULL, $reset = FALSE) { - static $block_info; - $theme_key = variable_get('theme_default', 'garland'); - - if (!isset($block_info) || $reset) { - $block_info = array(); - if (!$reset) { - $block_info = context_cache_get('block_info'); - } - if (empty($block_info)) { - if (module_exists('block')) { - $block_blocks = _block_rehash($theme_key); - $block_info = array(); - // Change from numeric keys to module-delta. - foreach ($block_blocks as $block) { - $block = (object) $block; - unset($block->theme, $block->status, $block->weight, $block->region, $block->custom, $block->visibility, $block->pages); - $block->bid = "{$block->module}-{$block->delta}"; - $block_info[$block->bid] = $block; - } - } - else { - $block_info = array(); - foreach (module_implements('block_info') as $module) { - $module_blocks = module_invoke($module, 'block_info'); - if (!empty($module_blocks)) { - foreach ($module_blocks as $delta => $block) { - $block = (object) $block; - $block->module = $module; - $block->delta = $delta; - $block->bid = "{$block->module}-{$block->delta}"; - $block_info[$block->bid] = $block; - } - } - } - } - context_cache_set('block_info', $block_info); - } - // Allow other modules that may declare blocks dynamically to alter - // this list. - drupal_alter('context_block_info', $block_info); - - // Gather only region info from the database. - if (module_exists('block')) { - $result = db_select('block') - ->fields('block') - ->condition('theme', $theme_key) - ->execute() - ->fetchAllAssoc('bid'); - - drupal_alter('block_list', $result); - drupal_alter('context_block_list', $result); - - foreach ($result as $row) { - if (isset($block_info["{$row->module}-{$row->delta}"])) { - $block_info["{$row->module}-{$row->delta}"] = (object) array_merge((array) $row, (array) $block_info["{$row->module}-{$row->delta}"]); - unset($block_info["{$row->module}-{$row->delta}"]->status); - unset($block_info["{$row->module}-{$row->delta}"]->visibility); - } - } - } - } - - $blocks = array(); - - // No region specified, provide all blocks. - if (!isset($region)) { - $blocks = $block_info; - } - // Region specified. - else { - foreach ($block_info as $bid => $block) { - if (isset($block->region) && $block->region == $region) { - $blocks[$bid] = $block; - } - } - } - - // Add context blocks if provided. - if (is_object($context) && $options = $this->fetch_from_context($context)) { - if (!empty($options['blocks'])) { - foreach ($options['blocks'] as $block) { - if ( - isset($block_info["{$block['module']}-{$block['delta']}"]) && // Block is valid. - (!isset($region) || (!empty($region) && $block['region'] == $region)) // No region specified or regions match. - ) { - $context_block = $block_info["{$block['module']}-{$block['delta']}"]; - $context_block->weight = $block['weight']; - $context_block->region = $block['region']; - $context_block->context = !empty($context->name) ? $context->name : 'tempname'; - $blocks[$context_block->bid] = $context_block; - } - } - } - uasort($blocks, array('context_reaction_block', 'block_sort')); - } - return $blocks; - } - - /** - * Sort callback. - */ - static function block_sort($a, $b) { - return ($a->weight - $b->weight); - } - - /** - * Compatibility wrapper around json_decode(). - */ - protected function json_decode($json, $assoc = FALSE) { - // Requires PHP 5.2. - if (function_exists('json_decode')) { - return json_decode($json, $assoc); - } - else { - watchdog('context', 'Please upgrade your PHP version to one that supports json_decode.'); - } - } - - /** - * Block renderer for AJAX requests. Triggered when $_GET['context_block'] - * is set. See ->execute() for how this is called. - */ - function render_ajax($param) { - // Besure the page isn't a 404 or 403. - $headers = drupal_get_http_header(); - if (array_key_exists('status', $headers) && ($headers['status'] == "404 Not Found" || $headers['status'] == "403 Forbidden")) { - return; - } - // Set the header right away. This will inform any players in the stack - // that we are in the middle of responding to an AJAX request. - drupal_add_http_header('Content-Type', 'text/javascript; charset=utf-8'); - - if (strpos($param, ',') !== FALSE) { - list($bid, $context) = explode(',', $param); - list($module, $delta) = explode('-', $bid, 2); - // Check token to make sure user has access to block. - if (!(user_access('administer contexts') || user_access('context ajax block access') || $this->context_block_ajax_rendering_allowed($bid))) { - echo drupal_json_encode(array('status' => 0)); - exit; - } - - // Ensure $bid is valid. - $info = $this->get_blocks(); - if (isset($info[$bid])) { - module_load_include('module', 'block', 'block'); - $block = $info[$bid]; - $block->title = isset($block->title) ? $block->title : ''; - $block->context = $context; - $block->region = ''; - $rendered_blocks = _block_render_blocks(array($block)); // For E_STRICT warning - $block = array_shift($rendered_blocks); - if (empty($block->content['#markup'])) { - $block->content['#markup'] = "
" . t('This block appears empty when displayed on this page.') . "
"; - } - $block = $this->editable_block($block); - $renderable_block = _block_get_renderable_array(array($block)); // For E_STRICT warning - echo drupal_json_encode(array( - 'status' => 1, - 'block' => drupal_render($renderable_block), - )); - drupal_exit(); - } - } - echo drupal_json_encode(array('status' => 0)); - drupal_exit(); - } - - /** - * Provide caching for system_region_list since it can get called - * frequently. Evaluate for removal once https://drupal.org/node/1873450 - * lands or system_region_list is otherwise cached in core - */ - protected function system_region_list($theme_key, $show = REGIONS_ALL) { - static $cache = array(); - if (!isset($cache[$theme_key])) { - $cache[$theme_key] = array(); - } - if (!isset($cache[$theme_key][$show])) { - $cache[$theme_key][$show] = system_region_list($theme_key, $show); - } - return $cache[$theme_key][$show]; - } - - /** - * Allow modules to selectively allow ajax rendering of a specific block - */ - private function context_block_ajax_rendering_allowed($bid) { - $allowed = FALSE; - foreach (module_invoke_all('context_allow_ajax_block_access', $bid) as $module_allow) { - $allowed = $allow || $module_allow; - if ($allowed) { - break; - } - } - return $allowed; - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction_block.js b/html/sites/all/modules/contrib/context/plugins/context_reaction_block.js deleted file mode 100644 index 8d1042c1d..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_reaction_block.js +++ /dev/null @@ -1,495 +0,0 @@ -(function($){ -Drupal.behaviors.contextReactionBlock = {attach: function(context) { - $('form.context-editor:not(.context-block-processed)') - .addClass('context-block-processed') - .each(function() { - var id = $(this).attr('id'); - Drupal.contextBlockEditor = Drupal.contextBlockEditor || {}; - $(this).bind('init.pageEditor', function(event) { - Drupal.contextBlockEditor[id] = new DrupalContextBlockEditor($(this)); - }); - $(this).bind('start.pageEditor', function(event, context) { - // Fallback to first context if param is empty. - if (!context) { - context = $(this).data('defaultContext'); - } - Drupal.contextBlockEditor[id].editStart($(this), context); - }); - $(this).bind('end.pageEditor', function(event) { - Drupal.contextBlockEditor[id].editFinish(); - }); - }); - - // - // Admin Form ======================================================= - // - // ContextBlockForm: Init. - $('#context-blockform:not(.processed)').each(function() { - $(this).addClass('processed'); - Drupal.contextBlockForm = new DrupalContextBlockForm($(this)); - Drupal.contextBlockForm.setState(); - }); - - // ContextBlockForm: Attach block removal handlers. - // Lives in behaviors as it may be required for attachment to new DOM elements. - $('#context-blockform a.remove:not(.processed)').each(function() { - $(this).addClass('processed'); - $(this).click(function() { - $(this).parents('tr').eq(0).remove(); - Drupal.contextBlockForm.setState(); - return false; - }); - }); - - // Conceal Section title, subtitle and class - $('div.context-block-browser', context).nextAll('.form-item').hide(); -}}; - -/** - * Context block form. Default form for editing context block reactions. - */ -DrupalContextBlockForm = function(blockForm) { - this.state = {}; - - this.setState = function() { - $('table.context-blockform-region', blockForm).each(function() { - var region = $(this).attr('id').split('context-blockform-region-')[1]; - var blocks = []; - $('tr', $(this)).each(function() { - var bid = $(this).attr('id'); - var weight = $(this).find('select,input').first().val(); - blocks.push({'bid' : bid, 'weight' : weight}); - }); - Drupal.contextBlockForm.state[region] = blocks; - }); - - // Serialize here and set form element value. - $('form input.context-blockform-state').val(JSON.stringify(this.state)); - - // Hide enabled blocks from selector that are used - $('table.context-blockform-region tr').each(function() { - var bid = Drupal.checkPlain($(this).attr('id')); - $('div.context-blockform-selector input[value="'+bid+'"]').parents('div.form-item').eq(0).hide(); - }); - // Show blocks in selector that are unused - $('div.context-blockform-selector input').each(function() { - var bid = $(this).val(); - if ($('table.context-blockform-region tr#'+bid).size() === 0) { - $(this).parents('div.form-item').eq(0).show(); - } - }); - - }; - - // make sure we update the state right before submits, this takes care of an - // apparent race condition between saving the state and the weights getting set - // by tabledrag - $('#ctools-export-ui-edit-item-form').submit(function() { Drupal.contextBlockForm.setState(); }); - - // Tabledrag - // Add additional handlers to update our blocks. - $.each(Drupal.settings.tableDrag, function(base) { - var table = $('#' + base + ':not(.processed)', blockForm); - if (table && table.is('.context-blockform-region')) { - table.addClass('processed'); - table.bind('mouseup', function(event) { - Drupal.contextBlockForm.setState(); - return; - }); - } - }); - - // Add blocks to a region - $('td.blocks a', blockForm).each(function() { - $(this).click(function() { - var region = $(this).attr('href').split('#')[1]; - var base = "context-blockform-region-"+ region; - var selected = $("div.context-blockform-selector input:checked"); - if (selected.size() > 0) { - var weight_warn = false; - var min_weight_option = -10; - var max_weight_option = 10; - var max_observed_weight = min_weight_option - 1; - $('table#' + base + ' tr').each(function() { - var weight_input_val = $(this).find('select,input').first().val(); - if (+weight_input_val > +max_observed_weight) { - max_observed_weight = weight_input_val; - } - }); - - selected.each(function() { - // create new block markup - var block = document.createElement('tr'); - var text = $(this).parents('div.form-item').eq(0).hide().children('label').text(); - var select = '
'; - $(block).attr('id', $(this).attr('value')).addClass('draggable'); - $(block).html(""+ Drupal.checkPlain(text) + "" + select + "X"); - - // add block item to region - //TODO : Fix it so long blocks don't get stuck when added to top regions and dragged towards bottom regions - Drupal.tableDrag[base].makeDraggable(block); - $('table#'+base).append(block); - if ($.cookie('Drupal.tableDrag.showWeight') == 1) { - $('table#'+base).find('.tabledrag-hide').css('display', ''); - $('table#'+base).find('.tabledrag-handle').css('display', 'none'); - } - else { - $('table#'+base).find('.tabledrag-hide').css('display', 'none'); - $('table#'+base).find('.tabledrag-handle').css('display', ''); - } - Drupal.attachBehaviors($('table#'+base)); - - Drupal.contextBlockForm.setState(); - $(this).removeAttr('checked'); - }); - if (weight_warn) { - alert(Drupal.t('Desired block weight exceeds available weight options, please check weights for blocks before saving.')); - } - } - return false; - }); - }); -}; - -/** - * Context block editor. AHAH editor for live block reaction editing. - */ -DrupalContextBlockEditor = function(editor) { - this.editor = editor; - this.state = {}; - this.blocks = {}; - this.regions = {}; - - return this; -}; - -DrupalContextBlockEditor.prototype = { - initBlocks : function(blocks) { - var self = this; - this.blocks = blocks; - blocks.each(function() { - if($(this).hasClass('context-block-empty')) { - $(this).removeClass('context-block-hidden'); - } - $(this).addClass('draggable'); - $(this).prepend($('')); - $(this).prepend($('').click(function() { - $(this).parent ('.block').eq(0).fadeOut('medium', function() { - $(this).remove(); - self.updateBlocks(); - }); - return false; - })); - }); - }, - initRegions : function(regions) { - this.regions = regions; - var ref = this; - - $(regions).not('.context-ui-processed') - .each(function(index, el) { - $('.context-ui-add-link', el).click(function(e){ - ref.showBlockBrowser($(this).parent()); - }).addClass('context-ui-processed'); - }); - $('.context-block-browser').hide(); - }, - showBlockBrowser : function(region) { - var toggled = false; - //figure out the id of the context - var activeId = $('.context-editing', this.editor).attr('id').replace('-trigger', ''), - context = $('#' + activeId)[0]; - - this.browser = $('.context-block-browser', context).addClass('active'); - - //add the filter element to the block browser - if (!this.browser.has('input.filter').size()) { - var parent = $('.block-browser-sidebar .filter', this.browser); - var list = $('.blocks', this.browser); - new Drupal.Filter (list, false, '.context-block-addable', parent); - } - //show a dialog for the blocks list - this.browser.show().dialog({ - modal : true, - close : function() { - $(this).dialog('destroy'); - //reshow all the categories - $('.category', this).show(); - $(this).hide().appendTo(context).removeClass('active'); - }, - height: (.8 * $(window).height()), - minHeight:400, - minWidth:680, - width:680 - }); - - //handle showing / hiding block items when a different category is selected - $('.context-block-browser-categories', this.browser).change(function(e) { - //if no category is selected we want to show all the items - if ($(this).val() == 0) { - $('.category', self.browser).show(); - } else { - $('.category', self.browser).hide(); - $('.category-' + $(this).val(), self.browser).show(); - } - }); - - //if we already have the function for a different context, rebind it so we don't get dupes - if(this.addToRegion) { - $('.context-block-addable', this.browser).unbind('click.addToRegion') - } - - //protected function for adding a clicked block to a region - var self = this; - this.addToRegion = function(e){ - var ui = { - 'item' : $(this).clone(), - 'sender' : $(region) - }; - $(this).parents('.context-block-browser.active').dialog('close'); - $(region).after(ui.item); - self.addBlock(e, ui, this.editor, activeId.replace('context-editable-', '')); - }; - - $('.context-block-addable', this.browser).bind('click.addToRegion', this.addToRegion); - }, - // Update UI to match the current block states. - updateBlocks : function() { - var browser = $('div.context-block-browser'); - - // For all enabled blocks, mark corresponding addables as having been added. - $('.block, .admin-block').each(function() { - var bid = $(this).attr('id').split('block-')[1]; // Ugh. - }); - // For all hidden addables with no corresponding blocks, mark as addable. - $('.context-block-item', browser).each(function() { - var bid = $(this).attr('id').split('context-block-addable-')[1]; - }); - - // Mark empty regions. - $(this.regions).each(function() { - if ($('.block:has(a.context-block)', this).size() > 0) { - $(this).removeClass('context-block-region-empty'); - } - else { - $(this).addClass('context-block-region-empty'); - } - }); - }, - // Live update a region - updateRegion : function(event, ui, region, op) { - switch (op) { - case 'over': - $(region).removeClass('context-block-region-empty'); - break; - case 'out': - if ( - // jQuery UI 1.8 - $('.draggable-placeholder', region).size() === 1 && - $('.block:has(a.context-block)', region).size() == 0 - ) { - $(region).addClass('context-block-region-empty'); - } - break; - } - }, - // Remove script elements while dragging & dropping. - scriptFix : function(event, ui, editor, context) { - if ($('script', ui.item)) { - var placeholder = $(Drupal.settings.contextBlockEditor.scriptPlaceholder); - var label = $('div.handle label', ui.item).text(); - placeholder.children('strong').html(label); - $('script', ui.item).parent().empty().append(placeholder); - } - }, - // Add a block to a region through an AJAX load of the block contents. - addBlock : function(event, ui, editor, context) { - var self = this; - if (ui.item.is('.context-block-addable')) { - var bid = ui.item.attr('id').split('context-block-addable-')[1]; - - // Construct query params for our AJAX block request. - var params = Drupal.settings.contextBlockEditor.params; - params.context_block = bid + ',' + context; - - // Replace item with loading block. - //ui.sender.append(ui.item); - - var blockLoading = $('
'); - ui.item.addClass('context-block-added'); - ui.item.after(blockLoading); - - - $.getJSON(Drupal.settings.contextBlockEditor.path, params, function(data) { - if (data.status) { - var newBlock = $(data.block); - if ($('script', newBlock)) { - $('script', newBlock).remove(); - } - blockLoading.fadeOut(function() { - $(this).replaceWith(newBlock); - self.initBlocks(newBlock); - self.updateBlocks(); - Drupal.attachBehaviors(newBlock); - }); - } - else { - blockLoading.fadeOut(function() { $(this).remove(); }); - } - }); - } - else if (ui.item.is(':has(a.context-block)')) { - self.updateBlocks(); - } - }, - // Update form hidden field with JSON representation of current block visibility states. - setState : function() { - var self = this; - - $(this.regions).each(function() { - var region = $('.context-block-region', this).attr('id').split('context-block-region-')[1]; - var blocks = []; - $('a.context-block', $(this)).each(function() { - if ($(this).attr('class').indexOf('edit-') != -1) { - var bid = $(this).attr('id').split('context-block-')[1]; - var context = $(this).attr('class').split('edit-')[1].split(' ')[0]; - context = context ? context : 0; - var block = {'bid': bid, 'context': context}; - blocks.push(block); - } - }); - self.state[region] = blocks; - }); - // Serialize here and set form element value. - $('input.context-block-editor-state', this.editor).val(JSON.stringify(this.state)); - }, - //Disable text selection. - disableTextSelect : function() { - if ($.browser.safari) { - $('.block:has(a.context-block):not(:has(input,textarea))').css('WebkitUserSelect','none'); - } - else if ($.browser.mozilla) { - $('.block:has(a.context-block):not(:has(input,textarea))').css('MozUserSelect','none'); - } - else if ($.browser.msie) { - $('.block:has(a.context-block):not(:has(input,textarea))').bind('selectstart.contextBlockEditor', function() { return false; }); - } - else { - $(this).bind('mousedown.contextBlockEditor', function() { return false; }); - } - }, - //Enable text selection. - enableTextSelect : function() { - if ($.browser.safari) { - $('*').css('WebkitUserSelect',''); - } - else if ($.browser.mozilla) { - $('*').css('MozUserSelect',''); - } - else if ($.browser.msie) { - $('*').unbind('selectstart.contextBlockEditor'); - } - else { - $(this).unbind('mousedown.contextBlockEditor'); - } - }, - // Start editing. Attach handlers, begin draggable/sortables. - editStart : function(editor, context) { - var self = this; - // This is redundant to the start handler found in context_ui.js. - // However it's necessary that we trigger this class addition before - // we call .sortable() as the empty regions need to be visible. - $(document.body).addClass('context-editing'); - this.editor.addClass('context-editing'); - this.disableTextSelect(); - this.initBlocks($('.block:has(a.context-block.edit-'+context+')')); - this.initRegions($('.context-block-region').parent()); - this.updateBlocks(); - - $('a.context_ui_dialog-stop').hide(); - - $('.editing-context-label').remove(); - var label = $('#context-editable-trigger-'+context+' .label.top').text(); - label = Drupal.t('Now editing: @label', {'@label': label}); - editor.parent().parent().prepend('
' + label + '
'); - - // First pass, enable sortables on all regions. - $(this.regions).each(function() { - var region = $(this); - var params = { - revert: true, - dropOnEmpty: true, - placeholder: 'draggable-placeholder', - forcePlaceholderSize: true, - items: '> *:has(a.context-block.editable)', - handle: 'a.context-block-handle', - start: function(event, ui) { self.scriptFix(event, ui, editor, context); }, - stop: function(event, ui) { self.addBlock(event, ui, editor, context); }, - receive: function(event, ui) { self.addBlock(event, ui, editor, context); }, - over: function(event, ui) { self.updateRegion(event, ui, region, 'over'); }, - out: function(event, ui) { self.updateRegion(event, ui, region, 'out'); }, - cursorAt: {left: 300, top: 0} - }; - region.sortable(params); - }); - - // Second pass, hook up all regions via connectWith to each other. - $(this.regions).each(function() { - $(this).sortable('option', 'connectWith', ['.ui-sortable']); - }); - - // Terrible, terrible workaround for parentoffset issue in Safari. - // The proper fix for this issue has been committed to jQuery UI, but was - // not included in the 1.6 release. Therefore, we do a browser agent hack - // to ensure that Safari users are covered by the offset fix found here: - // http://dev.jqueryui.com/changeset/2073. - if ($.ui.version === '1.6' && $.browser.safari) { - $.browser.mozilla = true; - } - }, - // Finish editing. Remove handlers. - editFinish : function() { - this.editor.removeClass('context-editing'); - this.enableTextSelect(); - - $('.editing-context-label').remove(); - - // Remove UI elements. - $(this.blocks).each(function() { - $('a.context-block-handle, a.context-block-remove', this).remove(); - if($(this).hasClass('context-block-empty')) { - $(this).addClass('context-block-hidden'); - } - $(this).removeClass('draggable'); - }); - - $('a.context_ui_dialog-stop').show(); - - this.regions.sortable('destroy'); - - this.setState(); - - // Unhack the user agent. - if ($.ui.version === '1.6' && $.browser.safari) { - $.browser.mozilla = false; - } - } -}; //End of DrupalContextBlockEditor prototype - -})(jQuery); diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction_block.png b/html/sites/all/modules/contrib/context/plugins/context_reaction_block.png deleted file mode 100644 index 50ad859c4..000000000 Binary files a/html/sites/all/modules/contrib/context/plugins/context_reaction_block.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction_block.svg b/html/sites/all/modules/contrib/context/plugins/context_reaction_block.svg deleted file mode 100644 index 536254cd0..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_reaction_block.svg +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction_breadcrumb.inc b/html/sites/all/modules/contrib/context/plugins/context_reaction_breadcrumb.inc deleted file mode 100644 index e6ce6fd65..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_reaction_breadcrumb.inc +++ /dev/null @@ -1,40 +0,0 @@ -')); - $result = db_select('menu_links') - ->fields('menu_links', array('p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8')) - ->condition('hidden', 0) - ->condition('link_path', $item['link_path']) - ->execute(); - while ($parents = $result->fetchAssoc()) { - $set = FALSE; - foreach (array_filter($parents) as $plid) { - $parent = menu_link_load($plid); - if ($parent && $parent['access'] && empty($parent['hidden']) && !empty($parent['title'])) { - $set = TRUE; - $breadcrumb[] = l($parent['title'], $parent['href']); - } - } - // Only set the breadcrumb if one or more links were added to the - // trail. If not, continue iterating through possible menu links. - if ($set) { - drupal_set_breadcrumb($breadcrumb); - break; - } - } - } - /** - * Return the title to be used for the current menu item. - */ - function get_link_title($item) { - return module_exists('i18n_menu') ? _i18n_menu_link_title($item) : $item['title']; - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction_css_injector.inc b/html/sites/all/modules/contrib/context/plugins/context_reaction_css_injector.inc deleted file mode 100644 index 0ff790ffb..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_reaction_css_injector.inc +++ /dev/null @@ -1,33 +0,0 @@ - $this->title, - '#description' => $this->description, - '#options' => $list, - '#type' => 'checkboxes', - '#default_value' => $this->fetch_from_context($context), - ); - } - - function execute() { - $contexts = $this->get_contexts(); - foreach ($contexts as $context) { - if (!empty($context->reactions[$this->plugin])) { - foreach ($context->reactions[$this->plugin] as $crid => $enabled) { - if ($enabled && $css_rule = _css_injector_load_rule($crid)) { - drupal_add_css(_css_injector_rule_uri($crid), 'module', $css_rule['media'], $css_rule['preprocess']); - } - } - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction_debug.inc b/html/sites/all/modules/contrib/context/plugins/context_reaction_debug.inc deleted file mode 100644 index 97f386799..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_reaction_debug.inc +++ /dev/null @@ -1,46 +0,0 @@ - array('#type' => 'value', '#value' => TRUE)); - } - - function options_form_submit($values) { - return array('debug' => 1); - } - - /** - * Settings form for variables. - */ - function settings_form() { - $form = array(); - $form['context_reaction_debug_enable_global'] = array( - '#title' => t('Enable debug reaction on all contexts'), - '#type' => 'checkbox', - '#default_value' => variable_get('context_reaction_debug_enable_global', FALSE), - '#description' => t('Enable the debug reaction on all contexts.') - ); - return $form; - } - - /** - * Output a list of active contexts. - */ - function execute() { - $contexts = context_active_contexts(); - foreach ($contexts as $context) { - if (!empty($context->reactions['debug']) || variable_get('context_reaction_debug_enable_global', FALSE)) { - if (user_access('administer site configuration') && module_exists('context_ui')) { - $name = l($context->name, "admin/structure/context/list/{$context->name}", array('query' => array('destination' => $_GET['q']))); - } - else { - $name = check_plain($context->name); - } - drupal_set_message(t("Active context: !name", array('!name' => $name))); - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction_menu.inc b/html/sites/all/modules/contrib/context/plugins/context_reaction_menu.inc deleted file mode 100644 index 4f0e54c0d..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_reaction_menu.inc +++ /dev/null @@ -1,145 +0,0 @@ - 0)); - $menu_names = array(); - foreach ($menus as $id => $title) { - list($menu_name, $mlid) = explode(':', $id); - // Store the title each menu for reference. - if ($mlid == '0') { - $menu_names[$menu_name] = $title; - } - else { - $link = menu_link_load($mlid); - $identifier = $link['link_path']; - $root_menu = $menu_names[$menu_name]; - while (isset($options[$root_menu][$menu_name . ':' . $identifier])) { - $identifier .= "'"; - } - $options[$root_menu][$menu_name . ':' . $identifier] = $title; - } - } - } - $menu_count = count($options, COUNT_RECURSIVE); - return array( - '#title' => $this->title, - '#description' => $this->description, - '#options' => $options, - '#type' => 'select', - '#multiple' => TRUE, - '#size' => $menu_count > 20 ? 20 : $menu_count, - '#default_value' => $this->fetch_from_context($context), - ); - } - - /** - * Override of options_form_submit(). - * Trim any identifier padding for non-unique path menu items. - */ - function options_form_submit($values) { - $trimmed = array(); - foreach ($values as $value) { - $value = trim($value, "'"); - $trimmed[] = $value; - } - return $trimmed; - } - - /** - * Overrides parent function to include legacy handling for old format of just storing a single path. - */ - function fetch_from_context($context) { - $values = parent::fetch_from_context($context); - // Legacy - convert single string value to an array with a preferred menu - if (is_string($values)) { - $menu = menu_link_get_preferred($values); - if (!$menu) { - return array(); - } - return array($menu['menu_name'] . ':' . $menu['link_path']); - } - return $values; - } - - /** - * Provide active trail in all menus in which our path appears. - */ - function execute(&$vars = NULL) { - $menu_names = menu_get_active_menu_names(); - $active_paths = $this->get_active_paths(); - foreach ($menu_names as $menu_name) { - if (isset($active_paths[$menu_name])) { - foreach($active_paths[$menu_name] as $path) { - if ($link = menu_link_get_preferred($path, $menu_name)) { - $this->set_active_trail_from_link($link); - return; - } - } - } - } - - // None of the links can be found in their preferred menus. Instead we just try to find any of the paths in any - // menu. Note that the preferred menu names list is still used but not always honoured. - // We hope to not have to fall into this section as we could end up doing rather a lot of lookups. - foreach ($active_paths as $menu_name => $paths) { - foreach($paths as $path) { - if ($link = menu_link_get_preferred($path)) { - $this->set_active_trail_from_link($link); - return; - } - } - } - } - - /** - * Helper function to build and set the active trail from a menu link. - * - * @param $item - * A menu link item. - */ - function set_active_trail_from_link($item) { - menu_tree_set_path($item['menu_name'], $item['link_path']); - $trail = array(); - while($item) { - array_unshift($trail, $item); - $item = menu_link_load($item['plid']); - } - array_unshift($trail, array( - 'title' => t('Home'), - 'href' => '', - 'link_path' => '', - 'localized_options' => array(), - 'type' => 0, - )); - menu_set_active_trail($trail); - } - - /** - * Helper function to return the list of currently active paths. - * - * The paths are grouped by menu name. - */ - function get_active_paths() { - $active_paths = array(); - foreach ($this->get_contexts() as $context) { - $paths = $this->fetch_from_context($context); - $active_paths = array_merge($active_paths, $paths); - } - - $by_menu_name = array(); - foreach ($active_paths as $id) { - list($menu_name, $path) = explode(':', $id); - $by_menu_name[$menu_name][] = $path; - } - return $by_menu_name; - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction_region.inc b/html/sites/all/modules/contrib/context/plugins/context_reaction_region.inc deleted file mode 100644 index d9c0a8ed3..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_reaction_region.inc +++ /dev/null @@ -1,50 +0,0 @@ -fetch_from_context($context); - $form = array(); - foreach (list_themes() as $theme) { - if ($theme->status) { - $regions = system_region_list($theme->name); - $default = isset($values[$theme->name]) ? $values[$theme->name]['disable'] : array(); - - $form[$theme->name] = array( - '#type' => 'fieldset', - '#title' => "Disable Regions in {$theme->name} Theme", - '#collapsible' => TRUE, - '#collapsed' => !array_reduce($default, 'context_reaction_region::collapseRegion'), - ); - $form[$theme->name]['disable'] = array( - '#type' => 'checkboxes', - '#title' => t("Disable the following"), - '#options' => $regions, - '#default_value' => $default, - ); - } - } - return $form; - } - - function collapseRegion($a, $b) { - return $a || $b; - } - - function execute(&$page) { - global $theme; - foreach ($this->get_contexts() as $k => $v) { - if (isset($v->reactions[$this->plugin][$theme])) { - $regions = $v->reactions[$this->plugin][$theme]['disable']; - foreach ($regions as $region => $disable) { - if ($disable && isset($page[$region])) { - unset($page[$region]); - } - } - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction_template_suggestions.inc b/html/sites/all/modules/contrib/context/plugins/context_reaction_template_suggestions.inc deleted file mode 100644 index 03a7ba63a..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_reaction_template_suggestions.inc +++ /dev/null @@ -1,47 +0,0 @@ -fetch_from_context($context); - - return array( - '#title' => t('Template suggestions'), - '#type' => 'textarea', - '#description' => t('Enter template suggestions such as "page__front", one per line, in order of preference (using underscores instead of hyphens). For more information, please visit Drupal 7 Template (Theme Hook) Suggestions.', array('@template-suggestions' => 'http://drupal.org/node/1089656')), - '#default_value' => is_string($default_value) ? $default_value : '', - ); - } - - /** - * Add any new template suggestions to the current list. - */ - function execute(&$vars = NULL) { - - // Get the list of contexts associated with this reaction. - $contexts = $this->get_contexts(); - - // Iterate through each, and process those with something set. - foreach ($contexts as $context) { - if (isset($context->reactions) && (!empty($context->reactions[$this->plugin]))) { - - // Get the suggestion data entered by the user. - $suggestions = $this->fetch_from_context($context, 'values'); - - // Convert it to an list and reverse it (as higher priority items - // should be on the bottom). - $suggestions = array_reverse(explode("\n", $suggestions)); - - // Append the suggested list to the existing list. - $vars['theme_hook_suggestions'] = array_merge($vars['theme_hook_suggestions'], $suggestions); - } - } - } -} - diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction_theme.inc b/html/sites/all/modules/contrib/context/plugins/context_reaction_theme.inc deleted file mode 100644 index 4d5b677cc..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_reaction_theme.inc +++ /dev/null @@ -1,67 +0,0 @@ -options_form($context); - - // Hide descriptions which take up too much space. - unset($form['title']['#description']); - unset($form['subtitle']['#description']); - unset($form['class']['#description']); - return $form; - } - - /** - * Submit handler for editor form. - */ - function editor_form_submit($context, $values) { - return $values; - } - - /** - * Allow admins to provide a section title, section subtitle and section class. - */ - function options_form($context) { - $values = $this->fetch_from_context($context); - $form = array( - '#tree' => TRUE, - '#title' => t('Theme variables'), - 'title' => array( - '#title' => t('Section title'), - '#description' => t('Provides this text as a $section_title variable for display in page.tpl.php when this context is active.'), - '#type' => 'textfield', - '#maxlength' => 255, - '#default_value' => isset($values['title']) ? $values['title'] : '', - ), - 'subtitle' => array( - '#title' => t('Section subtitle'), - '#description' => t('Provides this text as a $section_subtitle variable for display in page.tpl.php when this context is active.'), - '#type' => 'textfield', - '#maxlength' => 255, - '#default_value' => isset($values['subtitle']) ? $values['subtitle'] : '', - ), - ); - return $form; - } - - /** - * Set 'section_title', and 'section_subtitle' if not set - */ - function execute(&$vars) { - $classes = array(); - foreach ($this->get_contexts() as $k => $v) { - if (!empty($v->reactions[$this->plugin]['title']) && !isset($vars['section_title'])) { - $vars['section_title'] = check_plain(t($v->reactions[$this->plugin]['title'])); - } - if (!empty($v->reactions[$this->plugin]['subtitle']) && !isset($vars['section_subtitle'])) { - $vars['section_subtitle'] = check_plain(t($v->reactions[$this->plugin]['subtitle'])); - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/plugins/context_reaction_theme_html.inc b/html/sites/all/modules/contrib/context/plugins/context_reaction_theme_html.inc deleted file mode 100644 index 42d17227a..000000000 --- a/html/sites/all/modules/contrib/context/plugins/context_reaction_theme_html.inc +++ /dev/null @@ -1,34 +0,0 @@ -fetch_from_context($context); - $form = array( - 'class' => array( - '#title' => t('Section class'), - '#description' => t('Provides this text as an additional body class (in $classes in html.tpl.php) when this section is active.'), - '#type' => 'textfield', - '#maxlength' => 64, - '#default_value' => isset($values['class']) ? $values['class'] : '', - ), - ); - return $form; - } - - /** - * Set additional classes onto the 'body_classes'. - */ - function execute(&$vars) { - $classes = array(); - foreach ($this->get_contexts() as $k => $v) { - if (!empty($v->reactions[$this->plugin]['class'])) { - $vars['classes_array'][] = $v->reactions[$this->plugin]['class']; - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/tests/context.conditions.test b/html/sites/all/modules/contrib/context/tests/context.conditions.test deleted file mode 100644 index f18ec7b7d..000000000 --- a/html/sites/all/modules/contrib/context/tests/context.conditions.test +++ /dev/null @@ -1,577 +0,0 @@ - 'Condition: user', - 'description' => 'Test user condition.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools'); - $this->user1 = $this->drupalCreateUser(array('access content', 'administer site configuration')); - $this->user2 = $this->drupalCreateUser(array('access content')); - - // The role name is not reliably put on the user object. Retrive from - // user_roles(). - $role = ''; - foreach (array_keys($this->user1->roles) as $rid) { - if ($rid !== DRUPAL_AUTHENTICATED_RID) { - $role = user_role_load($rid)->name; - break; - } - } - - // Create test context. - ctools_include('export'); - $this->context = ctools_export_new_object('context'); - $this->context->name = 'testcontext'; - $this->context->conditions = array('user' => array('values' => array($role))); - $this->context->reactions = array('debug' => array('debug' => TRUE)); - $saved = context_save($this->context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - } - - function test() { - // User 1 triggers the context. - $this->drupalLogin($this->user1); - $this->drupalGet('node'); - $this->assertText('Active context: testcontext'); - - // User 2 does not. - $this->drupalLogin($this->user2); - $this->drupalGet('node'); - $this->assertNoText('Active context: testcontext'); - } -} - -class ContextConditionNagateUserTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Condition: nagate user', - 'description' => 'Test nagate user condition.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools'); - $this->user1 = $this->drupalCreateUser(array('access content', 'administer site configuration')); - - // Create test context. - ctools_include('export'); - $this->context = ctools_export_new_object('context'); - $this->context->name = 'testcontext'; - $this->context->conditions = array('user' => array('values' => array('authenticated user' => 'authenticated user'), 'options' => array('negate_role' => 1))); - $this->context->reactions = array('debug' => array('debug' => TRUE)); - $saved = context_save($this->context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - } - - function test() { - // User 1 does not trigger the context. - $this->drupalLogin($this->user1); - $this->drupalGet('node'); - $this->assertNoText('Active context: testcontext'); - - // Anonymous triggers the context. - $this->drupalLogout(); - $this->drupalGet(''); - $this->assertText('Active context: testcontext'); - } -} - -class ContextConditionUserPageTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Condition: user page', - 'description' => 'Test user page condition.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools'); - $this->user1 = $this->drupalCreateUser(array('access user profiles', 'access content', 'administer site configuration')); - $this->user2 = $this->drupalCreateUser(array('access user profiles', 'access content')); - - // Create test context. - ctools_include('export'); - $this->context = ctools_export_new_object('context'); - $this->context->name = 'testcontext'; - $this->context->conditions = array('user_page' => array('values' => array('view' => 'view'), 'options' => array('mode' => 'all'))); - $this->context->reactions = array('debug' => array('debug' => TRUE)); - $saved = context_save($this->context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - } - - function test() { - // Viewing any user profile triggers context. - $this->drupalLogin($this->user1); - $this->drupalGet("user/{$this->user1->uid}"); - $this->assertText('Active context: testcontext'); - $this->drupalGet("user/{$this->user2->uid}"); - $this->assertText('Active context: testcontext'); - // User form does not. - $this->drupalGet("user/{$this->user1->uid}/edit"); - $this->assertNoText('Active context: testcontext'); - - // Test current user mode - $this->context->conditions['user_page']['options']['mode'] = 'current'; - $saved = context_save($this->context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - $this->drupalGet("user/{$this->user1->uid}"); - $this->assertText('Active context: testcontext'); - $this->drupalGet("user/{$this->user2->uid}"); - $this->assertNoText('Active context: testcontext'); - - // Test other user mode - $this->context->conditions['user_page']['options']['mode'] = 'other'; - $saved = context_save($this->context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - $this->drupalGet("user/{$this->user1->uid}"); - $this->assertNoText('Active context: testcontext'); - $this->drupalGet("user/{$this->user2->uid}"); - $this->assertText('Active context: testcontext'); - } -} - -class ContextConditionNodeTaxonomyTest extends DrupalWebTestCase { - // We want the default taxonomy and content types created - protected $profile = 'standard'; - - public static function getInfo() { - return array( - 'name' => 'Condition: taxonomy', - 'description' => 'Test taxonomy condition.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools', 'taxonomy'); - $admin_user = $this->drupalCreateUser(array('administer site configuration', 'create article content')); - $this->drupalLogin($admin_user); - - // Create test terms. - $this->vocab = taxonomy_vocabulary_machine_name_load('tags'); - - $this->terms = array(); - $this->terms['apples'] = (object)array('name' => 'apples', 'vid' => $this->vocab->vid); - $this->terms['oranges'] = (object)array('name' => 'oranges', 'vid' => $this->vocab->vid); - taxonomy_term_save($this->terms['apples']); - taxonomy_term_save($this->terms['oranges']); - - // Create test context. - ctools_include('export'); - $this->context = ctools_export_new_object('context'); - $this->context->name = 'testcontext'; - $this->context->conditions = array('node_taxonomy' => array('values' => array($this->terms['apples']->tid))); - $this->context->reactions = array('debug' => array('debug' => TRUE)); - $saved = context_save($this->context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - } - - function test() { - // Apples does trigger the context. - $edit = array( - 'title' => 'Apples', - 'field_tags[und]' => $this->terms['apples']->name - ); - $this->drupalPost('node/add/article', $edit, t('Save')); - $node = $this->drupalGetNodeByTitle($edit['title']); - $this->drupalGet('node/' . $node->nid); - $this->assertText('Active context: testcontext'); - - // Oranges does not trigger the context. - $edit = array( - 'title' => 'Oranges', - 'field_tags[und]' => $this->terms['oranges']->name - ); - $this->drupalPost('node/add/article', $edit, t('Save')); - $node = $this->drupalGetNodeByTitle($edit['title']); - $this->drupalGet('node/' . $node->nid); - $this->assertNoText('Active context: testcontext'); - } -} - -class ContextConditionLanguageTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Condition: language', - 'description' => 'Test language condition.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools', 'locale'); - $admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer languages')); - $this->drupalLogin($admin_user); - $this->drupalPost('admin/config/development/performance', array(), t('Clear all caches')); - - // Set up Spanish as second language. - $this->drupalPost('admin/config/regional/language/add', array('langcode' => 'es'), t('Add language')); - $this->drupalPost('admin/config/regional/language/configure', array('language[enabled][locale-url]' => 1), t('Save settings')); - } - - function test() { - ctools_include('export'); - $context = ctools_export_new_object('context'); - $context->name = 'testcontext'; - $context->conditions = array('language' => array('values' => array('es'))); - $context->reactions = array('debug' => array('debug' => TRUE)); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $this->drupalGet('node'); - $this->assertNoText('Active context: testcontext'); - - $this->drupalGet('es/node'); - $this->assertText('Active context: testcontext'); - - // Cleanup - context_delete($context); - } -} - -class ContextConditionSitewideTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Condition: sitewide', - 'description' => 'Test sitewide condition.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools'); - $admin_user = $this->drupalCreateUser(array('administer site configuration')); - $this->drupalLogin($admin_user); - } - - function test() { - ctools_include('export'); - $context = ctools_export_new_object('context'); - $context->name = 'testcontext'; - $context->conditions = array('sitewide' => array('values' => array(1))); - $context->reactions = array('debug' => array('debug' => TRUE)); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $this->drupalGet('node'); - $this->assertText('Active context: testcontext'); - - // Cleanup - context_delete($context); - } -} - -class ContextConditionPathTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Condition: path', - 'description' => 'Test path condition.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools', 'path'); - $admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer nodes')); - $this->drupalLogin($admin_user); - } - - function test() { - ctools_include('export'); - $context = ctools_export_new_object('context'); - $context->name = 'testcontext'; - $context->conditions = array('path' => array('values' => array('admin', 'node/*'))); - $context->reactions = array('debug' => array('debug' => TRUE)); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $this->drupalGet('admin'); - $this->assertText('Active context: testcontext'); - - $node = $this->drupalCreateNode(); - $this->drupalGet("node/{$node->nid}"); - $this->assertText('Active context: testcontext'); - - $this->drupalGet('node'); - $this->assertNoText('Active context: testcontext'); - - // Cleanup - context_delete($context); - - // @TODO: Test with path alias - // @TODO: Test with language prefixes - } -} - -class ContextConditionContextTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Condition: context', - 'description' => 'Test context condition.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools'); - $admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer nodes')); - $this->drupalLogin($admin_user); - } - - function test() { - ctools_include('export'); - $context = ctools_export_new_object('context'); - $context->name = 'testcontext'; - $context->conditions = array('path' => array('values' => array('admin'))); - $context->reactions = array('debug' => array('debug' => TRUE)); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $subcontext = ctools_export_new_object('context'); - $subcontext->name = 'subcontext'; - $subcontext->conditions = array('context' => array('values' => array('testcontext'))); - $subcontext->reactions = array('debug' => array('debug' => TRUE)); - $saved = context_save($subcontext); - $this->assertTrue($saved, "Context 'subcontext' saved."); - - $this->drupalGet('admin'); - $this->assertText('Active context: testcontext'); - $this->assertText('Active context: subcontext'); - - // Cleanup - context_delete($context); - - // @TODO: Test exclusion - } -} - -class ContextConditionNodeTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Condition: node', - 'description' => 'Test node condition.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools', 'blog', 'book'); - $admin_user = $this->drupalCreateUser(array( - 'administer site configuration', - 'administer nodes', - 'create blog content', - 'create book content' - )); - $this->drupalLogin($admin_user); - } - - function test() { - ctools_include('export'); - $context = ctools_export_new_object('context'); - $context->name = 'testcontext'; - $context->conditions = array('node' => array('values' => array('blog'))); - $context->reactions = array('debug' => array('debug' => TRUE)); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $this->drupalGet("node/add/blog"); - $this->assertNoText('Active context: testcontext'); - - $this->drupalGet("node/add/book"); - $this->assertNoText('Active context: testcontext'); - - $node = $this->drupalCreateNode(array('type' => 'blog')); - $this->drupalGet("node/{$node->nid}"); - $this->assertText('Active context: testcontext'); - - $node = $this->drupalCreateNode(array('type' => 'book')); - $this->drupalGet("node/{$node->nid}"); - $this->assertNoText('Active context: testcontext'); - - $context->conditions['node']['options']['node_form'] = 1; - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $this->drupalGet("node/add/blog"); - $this->assertText('Active context: testcontext'); - - $this->drupalGet("node/add/book"); - $this->assertNoText('Active context: testcontext'); - - // Cleanup - context_delete($context); - } -} - -class ContextConditionMenuTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Condition: menu', - 'description' => 'Test menu condition.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools', 'blog', 'menu'); - $admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer nodes', 'create blog content')); - $this->drupalLogin($admin_user); - } - - function test() { - ctools_include('export'); - $context = ctools_export_new_object('context'); - $context->name = 'testcontext'; - $context->conditions = array('menu' => array('values' => array('node/add'))); - $context->reactions = array('debug' => array('debug' => TRUE)); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $this->drupalGet("node/add/blog"); - $this->assertText('Active context: testcontext'); - - $this->drupalGet("node/add"); - $this->assertText('Active context: testcontext'); - - $this->drupalGet("node"); - $this->assertNoText('Active context: testcontext'); - - // Cleanup - context_delete($context); - } -} - -class ContextConditionBookTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Condition: book', - 'description' => 'Test book condition.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools', 'book', 'menu'); - $admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer nodes')); - $this->drupalLogin($admin_user); - } - - function test() { - $book = $this->drupalCreateNode(array('type' => 'book', 'book' => array('bid' => 'new'))); - $child = $this->drupalCreateNode(array('type' => 'book', 'book' => array('bid' => $book->nid))); - $dummy = $this->drupalCreateNode(array('type' => 'book')); - - ctools_include('export'); - $context = ctools_export_new_object('context'); - $context->name = 'testcontext'; - $context->conditions = array('book' => array('values' => array(book_menu_name($book->book['bid'])))); - $context->reactions = array('debug' => array('debug' => TRUE)); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $this->drupalGet("node/{$book->nid}"); - $this->assertText('Active context: testcontext'); - - $this->drupalGet("node/{$child->nid}"); - $this->assertText('Active context: testcontext'); - - $this->drupalGet("node/{$dummy->nid}"); - $this->assertNoText('Active context: testcontext'); - - // Cleanup - context_delete($context); - } -} - -class ContextConditionBookroot extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Condition: bookroot', - 'description' => 'Test bookroot condition.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools', 'book', 'menu'); - $admin_user = $this->drupalCreateUser(array( - 'administer site configuration', - 'administer nodes', - 'create book content', - 'edit any book content', - )); - $this->drupalLogin($admin_user); - variable_set('book_allowed_types', array('book', 'page')); - } - - function test() { - $book = $this->drupalCreateNode(array('type' => 'book', 'book' => array('bid' => 'new'))); - $child = $this->drupalCreateNode(array('type' => 'book', 'book' => array('bid' => $book->nid))); - - $dummy = $this->drupalCreateNode(array('type' => 'page', 'book' => array('bid' => 'new'))); - $dummy_child = $this->drupalCreateNode(array('type' => 'page', 'book' => array('bid' => $dummy->nid))); - - ctools_include('export'); - $context = ctools_export_new_object('context'); - $context->name = 'testcontext'; - $context->conditions = array('bookroot' => array('values' => array('book'))); - $context->reactions = array('debug' => array('debug' => TRUE)); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $this->drupalGet("node/{$book->nid}"); - $this->assertText('Active context: testcontext'); - - $this->drupalGet("node/{$child->nid}"); - $this->assertText('Active context: testcontext'); - - $this->drupalGet("node/{$dummy->nid}"); - $this->assertNoText('Active context: testcontext'); - - $this->drupalGet("node/{$dummy_child->nid}"); - $this->assertNoText('Active context: testcontext'); - - $this->drupalGet("node/{$book->nid}/edit"); - $this->assertNoText('Active context: testcontext'); - - $context->conditions['bookroot']['options']['node_form'] = 1; - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $this->drupalGet("node/{$book->nid}/edit"); - $this->assertText('Active context: testcontext'); - - // Cleanup - context_delete($context); - } -} diff --git a/html/sites/all/modules/contrib/context/tests/context.reactions.test b/html/sites/all/modules/contrib/context/tests/context.reactions.test deleted file mode 100644 index 1ac215f88..000000000 --- a/html/sites/all/modules/contrib/context/tests/context.reactions.test +++ /dev/null @@ -1,311 +0,0 @@ - 'Reaction: block', - 'description' => 'Test block reaction.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools', 'block'); - $admin_user = $this->drupalCreateUser(array( - 'administer site configuration', - 'administer blocks' - )); - $this->drupalLogin($admin_user); - } - - function test() { - ctools_include('export'); - $context = ctools_export_new_object('context'); - $context->name = 'testcontext'; - $context->conditions = array('sitewide' => array('values' => array(1))); - $context->reactions = array('block' => array('blocks' => array( - 'user-online' => array( - 'module' => 'user', - 'delta' => 'online', - 'region' => 'sidebar_first', - 'weight' => 0, - ), - ))); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - theme_enable(array('bartik')); - variable_set('theme_default', 'bartik'); - $this->refreshVariables(); - - $this->drupalGet('node'); - $this->assertText('Who\'s online'); - - // Test title override of code provided block - $edit = array('title' => 'Context Online Block'); - $this->drupalPost('admin/structure/block/manage/user/online/configure', $edit, t('Save block')); - $this->drupalPost('admin/config/development/performance', array(), t('Clear all caches')); - $this->drupalGet('node'); - $this->assertText('Context Online Block'); - - // Test title of custom block - $edit = array( - 'info' => 'Context Custom Block Info', - 'title' => 'Context Custom Block Title', - 'body[value]' => $this->randomName(32), - ); - $this->drupalPost('admin/structure/block/add', $edit, t('Save block')); - $bid = db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(':info' => $edit['info']))->fetchField(); - - $context->reactions['block']['blocks']["block-{$bid}"] = array( - 'module' => 'block', - 'delta' => $bid, - 'region' => 'sidebar_first', - 'weight' => 2, - ); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $this->drupalGet('node'); - $this->assertText('Context Custom Block Title'); - - // Cleanup - context_delete($context); - } -} - -class ContextReactionBlockAjaxTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Reaction: block ajax', - 'description' => 'Test block reaction ajax behavior.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'context_ui', 'ctools'); - $admin_user = $this->drupalCreateUser(array('context ajax block access')); - $this->drupalLogin($admin_user); - } - - function test() { - $this->drupalGet('node', array( - 'query' => array('context_block' => 'user-online,testcontext') - )); - - $this->assertText('"status":1', 'Successful return status.'); - $this->assertText('Who\\u0027s online', 'Expected text in block data.'); - } -} - -class ContextReactionBlockAjaxAccessTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Reaction: block ajax access', - 'description' => 'Test block reaction ajax access behavior.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools'); - $admin_user = $this->drupalCreateUser(); - $this->drupalLogin($admin_user); - } - - function test() { - $this->drupalGet('node', array( - 'query' => array('context_block' => 'user-online,testcontext') - )); - - $this->assertText('"status":0', 'Failed return status.'); - } -} - -class ContextReactionMenuTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Reaction: menu', - 'description' => 'Test menu reaction.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools', 'menu', 'blog'); - $admin_user = $this->drupalCreateUser(array( - 'administer menu', - 'administer nodes', - 'administer site configuration', - 'create blog content', - )); - $this->drupalLogin($admin_user); - } - - function test() { - ctools_include('export'); - $context = ctools_export_new_object('context'); - $context->name = 'testcontext'; - $context->conditions = array('sitewide' => array('values' => array(1))); - $context->reactions = array('menu' => 'node/add'); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $this->drupalPost('admin/structure/menu/settings', array('menu_main_links_source' => 'navigation'), 'Save configuration'); - theme_enable(array('bartik')); - variable_set('theme_default', 'bartik'); - $this->refreshVariables(); - - $output = $this->drupalGet('user'); - $url = url('node/add'); - $active = $this->xpath('//li[contains(@class, "active")]/a[@href="' . $url . '"]'); - $this->assertTrue(!empty($active), t('Active menu item found.')); - - // Cleanup - context_delete($context); - } -} - -class ContextReactionBreadcrumbTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Reaction: breadcrumb', - 'description' => 'Test breadcrumb reaction.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools'); - $admin_user = $this->drupalCreateUser(array( - 'access administration pages', - 'administer nodes', - 'administer site configuration' - )); - $this->drupalLogin($admin_user); - } - - function test() { - ctools_include('export'); - $context = ctools_export_new_object('context'); - $context->name = 'testcontext'; - $context->conditions = array('path' => array('values' => array('node'))); - $context->reactions = array('breadcrumb' => 'admin/structure'); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - theme_enable(array('bartik')); - variable_set('theme_default', 'bartik'); - $this->refreshVariables(); - - $output = $this->drupalGet('node'); - $this->assertText('Home » Administration » Structure'); - $output = $this->drupalGet('user'); - $this->assertNoText('Home » Administration » Structure'); - - // Cleanup - context_delete($context); - } -} - -class ContextReactionThemeHtmlTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Reaction: theme html', - 'description' => 'Test theme html reaction.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools'); - $admin_user = $this->drupalCreateUser(array( - 'access administration pages', - 'administer nodes', - 'administer site configuration' - )); - $this->drupalLogin($admin_user); - } - - function test() { - ctools_include('export'); - $context = ctools_export_new_object('context'); - $context->name = 'testcontext'; - $context->conditions = array('sitewide' => array('values' => array(1))); - $context->reactions = array('theme_html' => array('class' => 'context-test-class')); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $output = $this->drupalGet('node'); - $this->assertRaw('context-test-class'); - - // Cleanup - context_delete($context); - } -} - -class ContextReactionRegionTest extends DrupalWebTestCase { - protected $profile = 'testing'; - - public static function getInfo() { - return array( - 'name' => 'Reaction: Region', - 'description' => 'Test Region disable reaction.', - 'group' => 'Context', - ); - } - - function setUp() { - parent::setUp('context', 'ctools'); - $admin_user = $this->drupalCreateUser(array( - 'access administration pages', - 'administer nodes', - 'administer site configuration' - )); - $this->drupalLogin($admin_user); - } - - function test() { - ctools_include('export'); - theme_enable(array('bartik')); - variable_set('theme_default', 'bartik'); - global $theme; - $context = ctools_export_new_object('context'); - $context->name = 'testcontext'; - $context->conditions = array('sitewide' => array('values' => array(1))); - $context->reactions = array( - 'block' => array( - 'blocks' => array( - 'user-online' => array( - 'module' => 'user', - 'delta' => 'online', - 'region' => 'sidebar_first', - 'weight' => '-10', - ), - ), - ), - 'region' => array('bartik' => array('disable' => array('sidebar_first' => 'sidebar_first'))) - ); - $saved = context_save($context); - $this->assertTrue($saved, "Context 'testcontext' saved."); - - $output = $this->drupalGet('node'); - $this->assertNoText("Who's online"); - - // Cleanup - context_delete($context); - } -} diff --git a/html/sites/all/modules/contrib/context/tests/context.test b/html/sites/all/modules/contrib/context/tests/context.test deleted file mode 100644 index 5061d65ab..000000000 --- a/html/sites/all/modules/contrib/context/tests/context.test +++ /dev/null @@ -1,89 +0,0 @@ - 'API unit tests', - 'description' => 'Sets all possible context types and checks for integrity.', - 'group' => 'Context', - ); - } - - public function setUp() { - parent::setUp('context'); - } - - public function test() { - // define possible data types - $set_types = array( - 'bool' => TRUE, - 'int' => 1, - 'string' => 'lorem', - 'array' => array('lorem'), - 'object' => new stdClass(), - ); - $id_types = array('int', 'string'); - - // NAMESPACE - foreach ($set_types as $type => $val) { - $set = context_set($val); - // Test return value of context_set() - if (in_array($type, $id_types)) { - // test set integrity - $this->assertIdentical(true, $set, 'Space set successful.'); - // test get integrity - $this->assertIdentical(array(), context_get($val), 'Namespace get successful.'); - $this->assertIdentical(true, context_exists($val), 'Namespace exists successful.'); - } - else { - $this->assertIdentical(false, $set, 'Prohibited namespace not established.'); - } - context_clear(); - } - - // NAMESPACE+ATTRIBUTE - foreach ($set_types as $type => $val) { - foreach ($set_types as $type2 => $val2) { - // test set integrity - $set = context_set($val, $val2); - if (in_array($type, $id_types)) { - // test set integrity - if ($type2 != 'bool') { - $this->assertIdentical(true, $set, 'Namespace and attribute set successful.'); - } - else { - $this->assertIdentical(false, $set); - } - // test get + exists integrity - if (in_array($type2, $id_types)) { - $this->assertIdentical(true, (context_get($val, $val2) == $val2), 'Namespace and attribute get successful.'); - $this->assertIdentical(true, context_exists($val, $val2), 'Namespace and attribute exists.'); - } - elseif (in_array($type2, array('array', 'object'))) { - $this->assertIdentical(true, (context_get($val) == $val2), 'Namespace and attribute get successful.'); - $this->assertIdentical(true, context_exists($val), 'Namespace and attribute exists.'); - } - } - } - context_clear(); - } - - // NAMESPACE+ATTRIBUTE+VALUE, o lord - foreach ($set_types as $type => $val) { - foreach ($set_types as $type2 => $val2) { - foreach ($set_types as $type3 => $val3) { - $set = context_set($val, $val2, $val3); - if (in_array($type, $id_types)) { - if (in_array($type2, $id_types)) { - $this->assertIdentical(true, (context_get($val, $val2, $val3) == $val3), 'Namespace, attribute and value get successful.'); - $this->assertIdentical(true, context_exists($val, $val2, $val3), 'Namespace, attribute and value exists.'); - } - } - context_clear(); - } - } - } - } -} diff --git a/html/sites/all/modules/contrib/context/theme/context-block-browser-item.tpl.php b/html/sites/all/modules/contrib/context/theme/context-block-browser-item.tpl.php deleted file mode 100644 index 788f84c1c..000000000 --- a/html/sites/all/modules/contrib/context/theme/context-block-browser-item.tpl.php +++ /dev/null @@ -1,4 +0,0 @@ -
- - -
diff --git a/html/sites/all/modules/contrib/context/theme/context-block-browser.tpl.php b/html/sites/all/modules/contrib/context/theme/context-block-browser.tpl.php deleted file mode 100644 index 69e8a150f..000000000 --- a/html/sites/all/modules/contrib/context/theme/context-block-browser.tpl.php +++ /dev/null @@ -1,21 +0,0 @@ -
-
- $module_blocks): ?> - - -
-
- - $block)); ?> - -
- - - -
-
-
-
- -
-
diff --git a/html/sites/all/modules/contrib/context/theme/context_reaction_block.theme.inc b/html/sites/all/modules/contrib/context/theme/context_reaction_block.theme.inc deleted file mode 100644 index e5fe9de22..000000000 --- a/html/sites/all/modules/contrib/context/theme/context_reaction_block.theme.inc +++ /dev/null @@ -1,135 +0,0 @@ - drupal_render($vars['form']['blocks']), 'class' => array('blocks')), - array('data' => drupal_render($vars['form']['selector']) . drupal_render($vars['form']['block']['help']), 'class' => array('selector')), - ); - - $output = drupal_render_children($vars['form']); - - $table = array( - 'rows' => array($row), - 'attributes' => array('id' => 'context-blockform'), - ); - $output .= theme('table', $table); - return $output; -} - -/** - * Generates the AJAX enabled block administration portion of the context_ui admin form. - */ -function theme_context_block_regions_form($vars) { - $form = $vars['form']; - - // Add draggable weights - drupal_add_js('misc/tableheader.js'); - drupal_add_js(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.js'); - drupal_add_css(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.css'); - - $output = ''; - - foreach (element_children($form) as $region) { - $attr = array( - 'id' => "context-blockform-region-{$region}", - 'class' => array("context-blockform-region"), - ); - drupal_add_tabledrag($attr['id'], 'order', 'sibling', 'tabledrag-hide', NULL, NULL, FALSE); - $rows = array(); - foreach (element_children($form[$region]) as $id) { - $form[$region][$id]['weight']['#attributes'] = array('class' => array('tabledrag-hide')); - $label = $form[$region][$id]['#value']; - $remove = l(t('X'), $_GET['q'], array('fragment' => 'remove', 'attributes' => array('class' => array('remove')))); - $rows[] = array( - 'data' => array($label, drupal_render($form[$region][$id]['weight']), $remove), - 'class' => array('draggable'), - 'id' => $id, - ); - } - $output .= "
"; - $output .= l(t('+') . ' ' . t('Add'), $_GET['q'], array('fragment' => $region, 'attributes' => array('class' => array('add-block')))); - $output .= $form[$region]['#title']; - $output .= '
'; - $output .= theme('table', array('rows' => $rows, 'attributes' => $attr)); - } - return $output; -} - -/** - * Use placeholder content for script tags that need to be replaced. - */ -function theme_context_block_script_placeholder($vars) { - $text = $vars['text']; - $message = t('Please reload the page to view this block.'); - return "
{$text}
{$message}
"; -} - -/** - * Preprocessor for theme('context_block_browser'). - */ -function template_preprocess_context_block_browser(&$vars) { - $categories = array( - '#type' => 'select', - '#options' => array(0 => '<' . t('All Categories') . '>'), - '#attributes' => array('class' => array('context-block-browser-categories')), - '#value' => 0, - '#size' => 1, - '#id' => '', - '#name' => '', - '#parents' => array(''), - '#multiple' => FALSE, - '#required' => FALSE, - ); - $blocks = array(); - // Group blocks by module. - foreach ($vars['blocks'] as $block) { - $group = isset($block->context_group) ? $block->context_group : $block->module; - // Normalize the $group, borrowed from drupal_html_id - $group = strtr(drupal_strtolower($group), array(' ' => '-', '_' => '-', '[' => '-', ']' => '')); - if (!isset($categories[$group])) { - $info = system_get_info('module', $block->module); - $title = isset($block->context_group) ? $block->context_group : (!empty($info['name']) ? $info['name'] : $block->module); - $categories['#options'][$group] = $title; - } - $blocks[$group][$block->bid] = $block; // Don't call theme('context_block_browser_item') to allow others to alter. - } - - //add help text to tell people how to use the block browser - $help_text = array( - '#prefix' => '
', - '#markup' => t('To add a block to the current region, simply click on the block. You may use the category filter to filter by block type or the search filter to find the block that you wish to add.'), - '#suffix' => '
', - ); - - $filter_label = array( - '#prefix' => '
', - '#markup' => t('Search filter'), - '#suffix' => '
', - ); - - $vars['categories'] = $categories; // Don't call theme('select') here to allow further preprocesses to alter the element. - $vars['blocks'] = $blocks; - $vars['help_text'] = $help_text; - $vars['filter_label'] = $filter_label; -} - -/** - * Preprocessor for theme('context_block_browser_item'). - */ -function template_preprocess_context_block_browser_item(&$vars) { - $vars['bid'] = $vars['block']->bid; - $vars['info'] = check_plain($vars['block']->info); -} - -/** - * Theme wrapper for editable blocks. - * - * @ingroup themeable - */ -function theme_context_block_edit_wrap($vars) { - $block = $vars['element']['#block']; - return $vars['element']['#children'] . ""; -} diff --git a/html/sites/all/modules/contrib/context_disable_context/LICENSE.txt b/html/sites/all/modules/contrib/context_disable_context/LICENSE.txt deleted file mode 100644 index d159169d1..000000000 --- a/html/sites/all/modules/contrib/context_disable_context/LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/html/sites/all/modules/contrib/context_disable_context/context_disable_context.info b/html/sites/all/modules/contrib/context_disable_context/context_disable_context.info deleted file mode 100644 index c794116d0..000000000 --- a/html/sites/all/modules/contrib/context_disable_context/context_disable_context.info +++ /dev/null @@ -1,13 +0,0 @@ -name = "Context disable context reaction" -dependencies[] = "context" -description = "Disable certain contexts by another context." -package = "Context" -core = "7.x" - - -; Information added by drupal.org packaging script on 2012-10-09 -version = "7.x-3.0" -core = "7.x" -project = "context_disable_context" -datestamp = "1349787369" - diff --git a/html/sites/all/modules/contrib/context_disable_context/context_disable_context.module b/html/sites/all/modules/contrib/context_disable_context/context_disable_context.module deleted file mode 100644 index b00198447..000000000 --- a/html/sites/all/modules/contrib/context_disable_context/context_disable_context.module +++ /dev/null @@ -1,51 +0,0 @@ - array( - 'path' => drupal_get_path('module', 'context_disable_context') .'/plugins', - 'file' => 'context_reaction_disable_context.inc', - 'class' => 'context_reaction_disable_context', - 'parent' => 'context_reaction', - ), - ); - - return $plugins; -} - -/** - * Registry hook for conditions & reactions. - * - * Each entry associates a condition or reaction with the CTools plugin to be - * used as its plugin class. - */ -function context_disable_context_context_registry() { - return array( - 'reactions' => array( - 'disable_context' => array( - 'title' => t('Disable context'), - 'plugin' => 'context_reaction_disable_context', - ), - ), - ); -} - -/** - * Implementation of hook_context_page_reaction(). - */ -function context_disable_context_context_page_reaction() { - if ($plugin = context_get_plugin('reaction', 'disable_context')) { - $plugin->execute(); - } -} \ No newline at end of file diff --git a/html/sites/all/modules/contrib/context_disable_context/plugins/context_reaction_disable_context.inc b/html/sites/all/modules/contrib/context_disable_context/plugins/context_reaction_disable_context.inc deleted file mode 100644 index cf9a7435c..000000000 --- a/html/sites/all/modules/contrib/context_disable_context/plugins/context_reaction_disable_context.inc +++ /dev/null @@ -1,56 +0,0 @@ -fetch_from_context($context); - $values = context_context_list(); - ksort($values); - - // TODO: exclude current context from $values - - $form = array(); - $form['disabled'] = array( - '#title' => t('Contexts to disable'), - '#decription' => t('Select the contexts that should be disabled'), - '#type' => 'checkboxes', - '#multiple' => TRUE, - '#options' => $values, - '#default_value' => isset($defaults['disabled']) ? $defaults['disabled'] : array() , - ); - - return $form; - } - - /** - * Options form submit handler. - */ - function options_form_submit($values) { - $values['disabled'] = array_filter($values['disabled']); - return $values; - } - - function execute() { - $contexts = $this->get_contexts(); - $processed = array(); - - foreach ($contexts as $context) { - $values = $this->fetch_from_context($context); - - foreach ($values['disabled'] as $disable) { - if (context_isset('context', $disable) && !in_array($disable, $processed)) { - context_set('context', $disable, FALSE); - } - } - - // Add the current context to $processed so it is not removed by other contexts - $processed[] = $context->name; - } - } -} diff --git a/html/sites/all/modules/contrib/context_og/LICENSE.txt b/html/sites/all/modules/contrib/context_og/LICENSE.txt deleted file mode 100644 index d159169d1..000000000 --- a/html/sites/all/modules/contrib/context_og/LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/html/sites/all/modules/contrib/context_og/PATCHES.txt b/html/sites/all/modules/contrib/context_og/PATCHES.txt deleted file mode 100644 index e5a67920e..000000000 --- a/html/sites/all/modules/contrib/context_og/PATCHES.txt +++ /dev/null @@ -1,7 +0,0 @@ -This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches) -Patches applied to this directory: - -Copied over -Source: https://drupal.org/files/context_og-2065373-conditions_dont_fire_early_enough-2.patch - - diff --git a/html/sites/all/modules/contrib/context_og/README.txt b/html/sites/all/modules/contrib/context_og/README.txt deleted file mode 100644 index d04e4bc2d..000000000 --- a/html/sites/all/modules/contrib/context_og/README.txt +++ /dev/null @@ -1,20 +0,0 @@ - -Context OG for Context 3.x for Drupal 6.x ------------------------------------------ -Context OG provides some Organic Groups related conditions and reactions -for Context. If you are already familiar with the Context module and its -conditions and reactions then this module should help you fill in the missing -pieces in regards to Organic Groups. - -Installation ------------- -1. Context can be installed like any other Drupal module -- place it in -the modules directory for your site and enable it. - -2. Currently you must clear all caches (the button on the -admin/settings/performance screen is one way to do it) in order to -see the new conditions and reactions that are provided by this module. - -Maintainers ------------ -This module was developed by the friendly primates at FunnyMonkey.com. diff --git a/html/sites/all/modules/contrib/context_og/context_og.info b/html/sites/all/modules/contrib/context_og/context_og.info deleted file mode 100644 index 2ab19fc93..000000000 --- a/html/sites/all/modules/contrib/context_og/context_og.info +++ /dev/null @@ -1,15 +0,0 @@ -name = Context OG -description = "Provides Organic Groups conditions and reactions for the Context module." -package = "Context" -core = "7.x" -dependencies[] = og -dependencies[] = og_context -dependencies[] = ctools -dependencies[] = context - -; Information added by drupal.org packaging script on 2012-12-17 -version = "7.x-2.1" -core = "7.x" -project = "context_og" -datestamp = "1355739999" - diff --git a/html/sites/all/modules/contrib/context_og/context_og.install b/html/sites/all/modules/contrib/context_og/context_og.install deleted file mode 100644 index e858ff4a7..000000000 --- a/html/sites/all/modules/contrib/context_og/context_og.install +++ /dev/null @@ -1,14 +0,0 @@ - 3); - } -} - -function context_og_context_plugins() { - $plugins = array(); - $plugins['context_og_condition_group_node'] = array( - 'handler' => array( - 'path' => drupal_get_path('module', 'context_og') . '/plugins', - 'file' => 'context_og_condition_group_node.inc', - 'class' => 'context_og_condition_group_node', - 'parent' => 'context_condition', - ), - ); - $plugins['context_og_condition_group_type'] = array( - 'handler' => array( - 'path' => drupal_get_path('module', 'context_og') . '/plugins', - 'file' => 'context_og_condition_group_type.inc', - 'class' => 'context_og_condition_group_type', - 'parent' => 'context_condition', - ), - ); - $plugins['context_og_condition_member_status'] = array( - 'handler' => array( - 'path' => drupal_get_path('module', 'context_og') . '/plugins', - 'file' => 'context_og_condition_member_status.inc', - 'class' => 'context_og_condition_member_status', - 'parent' => 'context_condition', - ), - ); - $plugins['context_og_condition_member_role'] = array( - 'handler' => array( - 'path' => drupal_get_path('module', 'context_og') . '/plugins', - 'file' => 'context_og_condition_member_role.inc', - 'class' => 'context_og_condition_member_role', - 'parent' => 'context_condition', - ), - ); - $plugins['context_og_reaction_set_group_context'] = array( - 'handler' => array( - 'path' => drupal_get_path('module', 'context_og') . '/plugins', - 'file' => 'context_og_reaction_set_group_context.inc', - 'class' => 'context_og_reaction_set_group_context', - 'parent' => 'context_reaction', - ), - ); - return $plugins; -} - -/** - * Implementation of hook_context_registry(). - */ -function context_og_context_registry() { - return array( - 'conditions' => array( - 'context_og_condition_group_node' => array( - 'title' => t('OG - group node context'), - 'description' => t("Set this context when viewing a node or other page that is in any of the selected groups."), - 'plugin' => 'context_og_condition_group_node', - ), - 'context_og_condition_group_type' => array( - 'title' => t('OG - group type context'), - 'description' => t("Set this context when viewing a node or other page that is in any group of the selected types. Select Not in a group to also set the context when viewing a node or other page that is not in any group."), - 'plugin' => 'context_og_condition_group_type', - ), - 'context_og_condition_member_status' => array( - 'title' => t('OG - Member Status'), - 'description' => t("Set this context based on the current user's OG membership status."), - 'plugin' => 'context_og_condition_member_status', - ), - 'context_og_condition_member_role' => array( - 'title' => t('OG - Member Role'), - 'description' => t("Set this context based on the current user's OG Role. Note that this currently only supports global non-overridden roles."), - 'plugin' => 'context_og_condition_member_role', - ), - ), - 'reactions' => array( - 'context_og_reaction_set_group_context' => array( - 'title' => t('OG - set group context'), - 'description' => t("Set this group's context."), - 'plugin' => 'context_og_reaction_set_group_context', - ), - ), - ); -} - -/* - * Implementation of hook_context_page_condition(). - */ -function context_og_context_page_condition() { - $group = og_context(); - - // Only execute the group context conditions if there is a group node. - if ($group) { - $plugin = context_get_plugin('condition', 'context_og_condition_group_node'); - if ($plugin) { - $plugin->execute($group); - } - - $plugin = context_get_plugin('condition', 'context_og_condition_member_status'); - if ($plugin) { - $plugin->execute($group); - } - - $plugin = context_get_plugin('condition', 'context_og_condition_member_role'); - if ($plugin) { - $plugin->execute($group); - } - } - - // Execute the group type context condition all the time because we want - // to use that condition to be able to check for "no group context." - $plugin = context_get_plugin('condition', 'context_og_condition_group_type'); - if ($plugin) { - $plugin->execute($group); - } -} - -/** - * Execute the "set group context" reaction here so that our conditions will work - * when they get executed. We want to come after organic groups' hook_init() so - * the context doesn't get switched out from under us. - */ -function context_og_context_page_reaction() { - $plugin = context_get_plugin('reaction', 'context_og_reaction_set_group_context'); - - if ($plugin) { - $plugin->execute(); - } -} - diff --git a/html/sites/all/modules/contrib/context_og/plugins/context_og_condition_group_node.inc b/html/sites/all/modules/contrib/context_og/plugins/context_og_condition_group_node.inc deleted file mode 100644 index 24b185899..000000000 --- a/html/sites/all/modules/contrib/context_og/plugins/context_og_condition_group_node.inc +++ /dev/null @@ -1,60 +0,0 @@ -type); - - $values[$group->nid] = $type . ': ' . $group->title; - } - - return $values; - } - - function condition_form($context) { - $form = parent::condition_form($context); - $form['#type'] = 'select'; - $form['#multiple'] = TRUE; - return $form; - } - - function options_form($context) { - $defaults = $this->fetch_from_context($context, 'options'); - return array( - 'node_form' => array( - '#title' => t('Set on node form'), - '#type' => 'checkbox', - '#description' => t('Set this context on node forms'), - '#default_value' => isset($defaults['node_form']) ? $defaults['node_form'] : TRUE, - ), - ); - } - - function execute($group) { - if (isset($group) && $group['group_type'] == 'node') { - $node = entity_load_single($group['group_type'], $group['gid']); - $node_form = ((arg(0) == 'node') && ((is_numeric(arg(1)) && (arg(2) == 'edit')) || (arg(1) == 'add'))); - if (!empty($node->nid)) { - $contexts = $this->get_contexts($node->nid); - $this->values[$node->nid] = array(); - - foreach ($contexts as $context) { - $options = $this->fetch_from_context($context, 'options'); - // The condition is met unless we are looking at a node form - // and the "Set on node form" option is unchecked. - if (!$node_form || !empty($options['node_form'])) { - $this->condition_met($context, $group['gid']); - } - } - } - } - } -} diff --git a/html/sites/all/modules/contrib/context_og/plugins/context_og_condition_group_type.inc b/html/sites/all/modules/contrib/context_og/plugins/context_og_condition_group_type.inc deleted file mode 100644 index d430f2355..000000000 --- a/html/sites/all/modules/contrib/context_og/plugins/context_og_condition_group_type.inc +++ /dev/null @@ -1,73 +0,0 @@ - t('Not in any group'), - '_any_' => t('In any group'), - ); - foreach (node_type_get_types() as $type) { - if (og_is_group_type('node', $type->type)) { - $values[$type->type] = $type->name; - } - } - return $values; - } - - function options_form($context) { - $defaults = $this->fetch_from_context($context, 'options'); - return array( - 'node_form' => array( - '#title' => t('Set on node form'), - '#type' => 'checkbox', - '#description' => t('Set this context on node forms'), - '#default_value' => isset($defaults['node_form']) ? $defaults['node_form'] : TRUE, - ), - ); - } - - function execute($group) { - $node_form = ((arg(0) == 'node') && ((is_numeric(arg(1)) && (arg(2) == 'edit')) || (arg(1) == 'add'))); - if (!empty($group) && $group['group_type'] == 'node') { - $node = entity_load_single($group['group_type'], $group['gid']); - $type = $node ? $node->type : '_none_'; - $contexts = $this->get_contexts($type); - $this->values[$type] = array(); - - // check if we are in _any_ group as well - if ($type != '_none_') { - $allcontexts = $this->get_contexts('_any_'); - $this->values['_any_'] = array(); - foreach($allcontexts as $acontext) { - $options = $this->fetch_from_context($acontext, 'options'); - if (!$node_form || !empty($options['node_form'])) { - $this->condition_met($acontext, '_any_'); - } - } - } - - foreach ($contexts as $context) { - $options = $this->fetch_from_context($context, 'options'); - // The condition is met unless we are looking at a node form - // and the "Set on node form" option is unchecked. - if (!$node_form || !empty($options['node_form'])) { - $this->condition_met($context, $type); - } - } - } - else { - $no_group_contexts = $this->get_contexts('_none_'); - $this->get_contexts('_none_'); - $this->values['_none_'] = array(); - foreach($no_group_contexts as $context) { - $options = $this->fetch_from_context($context, 'options'); - if (!$node_form || !empty($options['node_form'])) { - $this->condition_met($context, '_none_'); - } - } - } - } -} diff --git a/html/sites/all/modules/contrib/context_og/plugins/context_og_condition_member_role.inc b/html/sites/all/modules/contrib/context_og/plugins/context_og_condition_member_role.inc deleted file mode 100644 index f4e812e50..000000000 --- a/html/sites/all/modules/contrib/context_og/plugins/context_og_condition_member_role.inc +++ /dev/null @@ -1,63 +0,0 @@ -fields('ogr', array('rid', 'name', 'group_type', 'group_bundle')) - ->condition('gid', 0, '=') - ->orderBy('group_type, group_bundle, name', 'ASC'); - $rids = $query - ->execute() - ->fetchAll(); - - $roles = array(); - foreach ($rids as $rid => $fields) { - $roles[$rid] = $fields->group_type . '-' . $fields->group_bundle . ': ' . $fields->name; - } - return $roles; - } - - function condition_form($context) { - $form = parent::condition_form($context); - $form['#type'] = 'select'; - $form['#multiple'] = TRUE; - return $form; - } - - function options_form($context) { - $defaults = $this->fetch_from_context($context, 'options'); - return array( - 'node_form' => array( - '#title' => t('Set on node form'), - '#type' => 'checkbox', - '#description' => t('Set this context on node forms'), - '#default_value' => isset($defaults['node_form']) ? $defaults['node_form'] : TRUE, - ), - ); - } - - function execute($group) { - global $user; - $node_form = ((arg(0) == 'node') && ((is_numeric(arg(1)) && (arg(2) == 'edit')) || (arg(1) == 'add'))); - // load the current roles for the user. - $roles = og_get_user_roles($group['group_type'], $group['gid'], $user->uid); - if (!empty($roles)) { - // Load all contexts that trigger on this context. - foreach ($roles as $rid => $name) { - $contexts = $this->get_contexts($rid); - - foreach($contexts as $context) { - $options = $this->fetch_from_context($context, 'options'); - // Check node_Form status and trigger context accordingly. - if (!$node_form || !empty($options['node_form'])) { - $this->condition_met($context, $rid); - } - } - } - } - } -} diff --git a/html/sites/all/modules/contrib/context_og/plugins/context_og_condition_member_status.inc b/html/sites/all/modules/contrib/context_og/plugins/context_og_condition_member_status.inc deleted file mode 100644 index c1513b807..000000000 --- a/html/sites/all/modules/contrib/context_og/plugins/context_og_condition_member_status.inc +++ /dev/null @@ -1,50 +0,0 @@ -fetch_from_context($context, 'options'); - return array( - 'node_form' => array( - '#title' => t('Set on node form'), - '#type' => 'checkbox', - '#description' => t('Set this context on node forms'), - '#default_value' => isset($defaults['node_form']) ? $defaults['node_form'] : TRUE, - ), - ); - } - - function execute($group) { - global $user; - $node_form = ((arg(0) == 'node') && ((is_numeric(arg(1)) && (arg(2) == 'edit')) || (arg(1) == 'add'))); - // load the og_membership corresponding to the current user and group - $og_membership = og_get_membership($group['group_type'], $group['gid'], 'user', $user->uid); - - if (!empty($og_membership)) { - // Load all contexts that trigger on this context. - $contexts = $this->get_contexts($og_membership->state); - - // iterate over all the states and trigger contexts for - foreach($contexts as $context) { - $options = $this->fetch_from_context($context, 'options'); - // Check node_Form status and trigger context accordingly. - if (!$node_form || !empty($options['node_form'])) { - $this->condition_met($context, $og_membership->state); - } - } - } - } -} diff --git a/html/sites/all/modules/contrib/context_og/plugins/context_og_reaction_set_group_context.inc b/html/sites/all/modules/contrib/context_og/plugins/context_og_reaction_set_group_context.inc deleted file mode 100644 index dc6e32649..000000000 --- a/html/sites/all/modules/contrib/context_og/plugins/context_og_reaction_set_group_context.inc +++ /dev/null @@ -1,47 +0,0 @@ -type); - - $options[$gid] = $type . ': ' . $group->title; - } - - $values = $this->fetch_from_context($context); - - $form = array( - 'group' => array( - '#title' => t('Group'), - '#description' => t('Set the group context to the selected group.'), - '#type' => 'select', - '#multiple' => FALSE, - '#options' => $options, - '#default_value' => isset($values['group']) ? $values['group'] : '', - ), - ); - return $form; - } - - function execute() { - $contexts = context_active_contexts(); - //dpm($contexts); - - foreach ($contexts as $k => $v) { - if (!empty($v->reactions[$this->plugin]['group'])) { - $group = node_load($v->reactions[$this->plugin]['group']); - og_context($group); - } - } - } -} diff --git a/html/sites/all/modules/contrib/cors/LICENSE.txt b/html/sites/all/modules/contrib/cors/LICENSE.txt deleted file mode 100755 index d159169d1..000000000 --- a/html/sites/all/modules/contrib/cors/LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/html/sites/all/modules/contrib/cors/PATCHES.txt b/html/sites/all/modules/contrib/cors/PATCHES.txt deleted file mode 100644 index 41acb33ba..000000000 --- a/html/sites/all/modules/contrib/cors/PATCHES.txt +++ /dev/null @@ -1,7 +0,0 @@ -This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches) -Patches applied to this directory: - -#2280323: Sends Multiple Access-Control-Allow-Origin -Source: https://www.drupal.org/files/issues/sends_multiple-2280323-10.patch - - diff --git a/html/sites/all/modules/contrib/cors/README b/html/sites/all/modules/contrib/cors/README deleted file mode 100644 index e359d2ce3..000000000 --- a/html/sites/all/modules/contrib/cors/README +++ /dev/null @@ -1,5 +0,0 @@ -Cross-origin resource sharing (CORS) is a mechanism that allows a web page to make XMLHttpRequests to another domain. Such "cross-domain" requests would otherwise be forbidden by web browsers, per the same origin security policy. - -This module provides a configuration page to map domains to paths and add the necessary Access-Control-Allow-Origin header. - -Turn it on and visit /admin/config/services/cors diff --git a/html/sites/all/modules/contrib/cors/cors.info b/html/sites/all/modules/contrib/cors/cors.info deleted file mode 100644 index 1dcc87abc..000000000 --- a/html/sites/all/modules/contrib/cors/cors.info +++ /dev/null @@ -1,12 +0,0 @@ -name = CORS -description = Allows Cross-origin resource sharing. -package = Other -core = 7.x -files[] = cors.module -configure = admin/config/services/cors -; Information added by Drupal.org packaging script on 2014-03-22 -version = "7.x-1.3" -core = "7.x" -project = "cors" -datestamp = "1395477558" - diff --git a/html/sites/all/modules/contrib/cors/cors.module b/html/sites/all/modules/contrib/cors/cors.module deleted file mode 100644 index a5f9aecd1..000000000 --- a/html/sites/all/modules/contrib/cors/cors.module +++ /dev/null @@ -1,164 +0,0 @@ - 'CORS', - 'description' => 'Enable Cross-origin resource sharing', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('cors_admin_form'), - 'access arguments' => array('administer site configuration'), - ); - - return $items; -} - -/** - * CORS admin configuration form. - */ -function cors_admin_form($form, &$form_state) { - $form = array(); - - $cors_domains = ''; - foreach (variable_get('cors_domains', array()) as $path => $domain) { - $cors_domains .= $path . '|' . $domain . "\n"; - } - - $form['cors_domains'] = array( - '#type' => 'textarea', - '#title' => t('Domains'), - '#description' => t('A list of paths and corresponding domains to enable for CORS. Multiple entries should be separated by a comma. Enter one value per line separated by a pipe, in this order: -
    -
  • Internal path
  • -
  • Access-Control-Allow-Origin. Use <mirror> to echo back the Origin header (equivalent to setting *, but can be used with Access-Control-Allow-Credentials: true). If you use <mirror>, it will match any Origin, and should not be used with other domain names.
  • -
  • Access-Control-Allow-Methods
  • -
  • Access-Control-Allow-Headers
  • -
  • Access-Control-Allow-Credentials
  • -
- Examples: -
    -
  • *|http://example.com
  • -
  • api|http://example.com:8080,http://example.com,https://example.org
  • -
  • api/*|<mirror>
  • -
  • api/*|<mirror>|POST|Content-Type,Authorization|true
  • -
'), - '#default_value' => $cors_domains, - '#rows' => 10, - ); - - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('Save configuration'), - ); - - return $form; -} - -/** - * CORS admin configuration form submit. - */ -function cors_admin_form_submit($form, &$form_state) { - $domains = explode("\n", $form_state['values']['cors_domains'], 2); - $settings = array(); - foreach ($domains as $domain) { - $domain = explode("|", $domain, 2); - if (count($domain) === 2) { - $settings[$domain[0]] = (isset($settings[$domain[0]])) ? $settings[$domain[0]] . ' ' : ''; - $settings[$domain[0]] .= trim($domain[1]); - } - } - - variable_set('cors_domains', $settings); -} - -/** - * Implements hook_init(). - */ -function cors_init() { - $domains = variable_get('cors_domains', array()); - $current_path = drupal_strtolower(drupal_get_path_alias($_GET['q'])); - // Change the header keys to lower case. - $request_headers = array_change_key_case(getallheaders(), CASE_LOWER); - $headers = array( - 'all' => array( - 'Access-Control-Allow-Origin' => array(), - 'Access-Control-Allow-Credentials' => array(), - ), - 'OPTIONS' => array( - 'Access-Control-Allow-Methods' => array(), - 'Access-Control-Allow-Headers' => array(), - ), - ); - foreach ($domains as $path => $settings) { - $settings = explode("|", $settings); - $page_match = drupal_match_path($current_path, $path); - if ($current_path != $_GET['q']) { - $page_match = $page_match || drupal_match_path($_GET['q'], $path); - } - if ($page_match) { - if (!empty($settings[0])) { - $origins = explode(',', trim($settings[0])); - if (isset($request_headers['origin'])) { - if (in_array('', $origins)) { - $headers['all']['Access-Control-Allow-Origin'][] = $request_headers['origin']; - } - elseif (in_array($request_headers['origin'], $origins)) { - $headers['all']['Access-Control-Allow-Origin'][] = $request_headers['origin']; - } - else { - $headers['all']['Access-Control-Allow-Origin'] = NULL; - } - if (!empty($settings[1])) { - $headers['OPTIONS']['Access-Control-Allow-Methods'] = explode(',', trim($settings[1])); - } - if (!empty($settings[2])) { - $headers['OPTIONS']['Access-Control-Allow-Headers'] = explode(',', trim($settings[2])); - } - if (!empty($settings[3])) { - $headers['all']['Access-Control-Allow-Credentials'] = explode(',', trim($settings[3])); - } - } - else { - $headers['all']['Access-Control-Allow-Origin'] = NULL; - } - } - } - } - - foreach ($headers as $method => $allowed) { - if ($method === 'all' || $method === $_SERVER['REQUEST_METHOD']) { - foreach ($allowed as $header => $values) { - if (!empty($values)) { - foreach ($values as $value) { - drupal_add_http_header($header, $value, TRUE); - } - } - } - } - } -} - -/** - * If running nginx, implement getallheaders ourself. - * - * Code is taken from http://php.net/manual/en/function.getallheaders.php - */ -if (!function_exists('getallheaders')) { - function getallheaders() { - foreach ($_SERVER as $name => $value) { - if (substr($name, 0, 5) == 'HTTP_') { - $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; - } - } - return $headers; - } -} \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/API.txt b/html/sites/all/modules/contrib/ctools/API.txt deleted file mode 100644 index b698b7986..000000000 --- a/html/sites/all/modules/contrib/ctools/API.txt +++ /dev/null @@ -1,54 +0,0 @@ -Current API Version: 2.0.8 - -Please note that the API version is an internal number and does not match release numbers. It is entirely possible that releases will not increase the API version number, and increasing this number too often would burden contrib module maintainers who need to keep up with API changes. - -This file contains a log of changes to the API. -API Version 2.0.9 -Changed import permissions to use the new 'use ctools import' permission. - -API Version 2.0.8 - Introduce ctools_class_add(). - Introduce ctools_class_remove(). - -API Version 2.0.7 - All ctools object cache database functions can now accept session_id as an optional - argument to facilitate using non-session id keys. - -API Version 2.0.6 - Introduce a hook to alter the implementors of a certain api via hook_[ctools_api_hook]_alter. - -API Version 2.0.5 - Introduce ctools_fields_get_fields_by_type(). - Add language.inc - Introduce hook_ctools_content_subtype_alter($subtype, $plugin); - -API Version 2.0.4 - Introduce ctools_form_include_file() - -API Version 2.0.3 - Introduce ctools_field_invoke_field() and ctools_field_invoke_field_default(). - -API Version 2.0.2 - Introduce ctools_export_crud_load_multiple() and 'load multiple callback' to - export schema. - -API Version 2.0.1 - Introduce ctools_export_crud_enable(), ctools_export_crud_disable() and - ctools_export_crud_set_status() and requisite changes. - Introduce 'object factory' to export schema, allowing modules to control - how the exportable objects are instantiated. - Introduce 'hook_ctools_math_expression_functions_alter'. - -API Version 2.0 - Remove the deprecated callback-based behavior of the 'defaults' property on - plugin types; array addition is now the only option. If you need more - complex logic, do it with the 'process' callback. - Introduce a global plugin type registration hook and remove the per-plugin - type magic callbacks. - Introduce $owner . '_' . $api . '_hook_name' allowing modules to use their own - API hook in place of 'hook_ctools_plugin_api'. - Introduce ctools_plugin_api_get_hook() to get the hook name above. - Introduce 'cache defaults' and 'default cache bin' keys to export.inc - -Versions prior to 2.0 have been removed from this document. See the D6 version -for that information. diff --git a/html/sites/all/modules/contrib/ctools/LICENSE.txt b/html/sites/all/modules/contrib/ctools/LICENSE.txt deleted file mode 100644 index d159169d1..000000000 --- a/html/sites/all/modules/contrib/ctools/LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/html/sites/all/modules/contrib/ctools/PATCHES.txt b/html/sites/all/modules/contrib/ctools/PATCHES.txt deleted file mode 100644 index 6754b27c8..000000000 --- a/html/sites/all/modules/contrib/ctools/PATCHES.txt +++ /dev/null @@ -1,11 +0,0 @@ -This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches) -Patches applied to this directory: - -Missing plugin classes -Source: https://www.drupal.org/files/issues/2067997-reload-plugins-class-7.patch - - -Ctools modal title -Source: PATCHES/ctools-translate-modal-title.patch - - diff --git a/html/sites/all/modules/contrib/ctools/README.txt b/html/sites/all/modules/contrib/ctools/README.txt deleted file mode 100644 index abdd913e9..000000000 --- a/html/sites/all/modules/contrib/ctools/README.txt +++ /dev/null @@ -1,78 +0,0 @@ -CONTENTS OF THIS FILE ---------------------- - - * Introduction - * Requirements - * Recommended Modules - * Installation - * Configuration - - -INTRODUCTION ------------- - -The Chaos tool suite (ctools) module is primarily a set of APIs and tools to -improve the developer experience. It also contains a module called the Page -Manager whose job is to manage pages. In particular it manages panel pages, but -as it grows it will be able to manage far more than just Panels. - -The Chaos Tool Suite (ctools) is a series of tools that makes code readily -available for developers and creates libraries for other modules to use. Modules -that use ctools include Views and Panels. - -End users will use ctools as underlying user interface libraries when operating -Views and Panels modules and will not need to explore further (ctools is geared -more toward developer usage). Developers will use the module differently and -work more with the tools provided. - -For the moment, it includes the following tools: - - * Plugins -- tools to make it easy for modules to let other modules implement - plugins from .inc files. - * Exportables -- tools to make it easier for modules to have objects that live - in database or live in code, such as 'default views'. - * AJAX responder -- tools to make it easier for the server to handle AJAX - requests and tell the client what to do with them. - * Form tools -- tools to make it easier for forms to deal with AJAX. - * Object caching -- tool to make it easier to edit an object across multiple - page requests and cache the editing work. - * Contexts -- the notion of wrapping objects in a unified wrapper and providing - an API to create and accept these contexts as input. - * Modal dialog -- tool to make it simple to put a form in a modal dialog. - * Dependent -- a simple form widget to make form items appear and disappear - based upon the selections in another item. - * Content -- pluggable content types used as panes in Panels and other modules - like Dashboard. - * Form wizard -- an API to make multi-step forms much easier. - * CSS tools -- tools to cache and sanitize CSS easily to make user-input CSS - safe. - - * For a full description of the module visit: - https://www.drupal.org/project/ctools - - * To submit bug reports and feature suggestions, or to track changes visit: - https://www.drupal.org/project/issues/ctools - - -REQUIREMENTS ------------- - -This module requires no modules outside of Drupal core. - - -RECOMMENDED MODULES -------------------- - -The Advanced help module provides extended documentation. Once enabled, -navigate to Administration > Advanced Help and select the Chaos tools link to -view documentation. - - * Advanced help - https://www.drupal.org/project/advanced_help - - -INSTALLATION ------------- - - * Install the Chaos tool suite module as you would normally install a - contributed Drupal module. Visit https://www.drupal.org/node/895232 for - further information. diff --git a/html/sites/all/modules/contrib/ctools/UPGRADE.txt b/html/sites/all/modules/contrib/ctools/UPGRADE.txt deleted file mode 100644 index 2fbfa4f74..000000000 --- a/html/sites/all/modules/contrib/ctools/UPGRADE.txt +++ /dev/null @@ -1,63 +0,0 @@ -Upgrading from ctools-6.x-1.x to ctools-7.x-2.x: - - - Remove ctools_ajax_associate_url_to_element as it shouldn't be necessary - with the new AJAX api's in Drupal core. - - - All calls to the ctools_ajax_command_prepend() should be replace with - the core function ajax_command_prepend(); - This is also the case for append, insert, after, before, replace, html, - and remove commands. - Each of these commands have been incorporated into the - Drupal.ajax.prototype.commands.insert - function with a corresponding parameter specifying which method to use. - - - All calls to ctools_ajax_render() should be replaced with calls to core - ajax_render(). Note that ctools_ajax_render() printed the json object and - exited, ajax_render() gives you this responsibility. - - ctools_ajax_render() - - becomes - - print ajax_render(); - exit; - - - All calls to ctools_static*() should be replaced with corresponding calls - to drupal_static*(). - - - All calls to ctools_css_add_css should be replaced with calls to - drupal_add_css(). Note that the arguments to drupal_add_css() have changed. - - - All wizard form builder functions must now return a form array(). - - - ctools_build_form is very close to being removed. In anticipation of this, - all $form_state['wrapper callback']s must now be - $form_state['wrapper_callback']. In addition to this $form_state['args'] - must now be $form_state['build_info']['args']. - - NOTE: Previously checking to see if the return from ctools_build_form() - is empty would be enough to see if the form was submitted. This is no - longer true. Please check for $form_state['executed']. If using a wizard - check for $form_state['complete']. - - - Plugin types now must be explicitly registered via a registration hook, - hook_ctools_plugin_type(); info once provided in magically-named functions - (e.g., ctools_ctools_plugin_content_types() was the old function to - provide plugin type info for ctools' content_type plugins) now must be - provided in that global hook. See http://drupal.org/node/910538 for more - details. - - - Plugins that use 'theme arguments' now use 'theme variables' instead. - - - Context, argument and relationship plugins now use 'add form' and/or - 'edit form' rather than 'settings form'. These plugins now support - form wizards just like content plugins. These forms now all take - $form, &$form_state as arguments, and the configuration for the plugin - can be found in $form_state['conf']. - - For all these forms, the submit handler MUST put appropriate data in - $form_state['conf']. Data will no longer be stored automatically. - - For all of these forms, the separate settings #trees in the form are now - gone, so form ids may be adjusted. Also, these are now all real forms - using CTools form wizard instead of fake subforms as previously. diff --git a/html/sites/all/modules/contrib/ctools/bulk_export/bulk_export.css b/html/sites/all/modules/contrib/ctools/bulk_export/bulk_export.css deleted file mode 100644 index 45a172d46..000000000 --- a/html/sites/all/modules/contrib/ctools/bulk_export/bulk_export.css +++ /dev/null @@ -1,18 +0,0 @@ -.export-container { - width: 48%; - float: left; - padding: 5px 1% 0; -} -.export-container table { - width: 100%; -} -.export-container table input, -.export-container table th, -.export-container table td { - padding: 0 0 .2em .5em; - margin: 0; - vertical-align: middle; -} -.export-container .select-all { - width: 1.5em; -} diff --git a/html/sites/all/modules/contrib/ctools/bulk_export/bulk_export.info b/html/sites/all/modules/contrib/ctools/bulk_export/bulk_export.info deleted file mode 100644 index 96a230940..000000000 --- a/html/sites/all/modules/contrib/ctools/bulk_export/bulk_export.info +++ /dev/null @@ -1,11 +0,0 @@ -name = Bulk Export -description = Performs bulk exporting of data objects known about by Chaos tools. -core = 7.x -dependencies[] = ctools:ctools -package = Chaos tool suite - -; Information added by Drupal.org packaging script on 2023-01-31 -version = "7.x-1.21" -core = "7.x" -project = "ctools" -datestamp = "1675152418" diff --git a/html/sites/all/modules/contrib/ctools/bulk_export/bulk_export.js b/html/sites/all/modules/contrib/ctools/bulk_export/bulk_export.js deleted file mode 100644 index a4fb3f2ec..000000000 --- a/html/sites/all/modules/contrib/ctools/bulk_export/bulk_export.js +++ /dev/null @@ -1,29 +0,0 @@ - -/** - * @file - * CTools Bulk Export javascript functions. - */ - -(function ($) { - -Drupal.behaviors.CToolsBulkExport = { - attach: function (context) { - - $('#bulk-export-export-form .vertical-tabs-pane', context).drupalSetSummary(function (context) { - - // Check if any individual checkbox is checked. - if ($('.bulk-selection input:checked', context).length > 0) { - return Drupal.t('Exportables selected'); - } - - return ''; - }); - - // Special bind click on the select-all checkbox. - $('.select-all').bind('click', function(context) { - $(this, '.vertical-tabs-pane').drupalSetSummary(context); - }); - } -}; - -})(jQuery); diff --git a/html/sites/all/modules/contrib/ctools/bulk_export/bulk_export.module b/html/sites/all/modules/contrib/ctools/bulk_export/bulk_export.module deleted file mode 100644 index 1050caa60..000000000 --- a/html/sites/all/modules/contrib/ctools/bulk_export/bulk_export.module +++ /dev/null @@ -1,278 +0,0 @@ - array( - 'title' => t('Access Bulk Exporter'), - 'description' => t('Export various system objects into code.'), - ), - ); -} - -/** - * Implements hook_menu(). - */ -function bulk_export_menu() { - $items['admin/structure/bulk-export'] = array( - 'title' => 'Bulk Exporter', - 'description' => 'Bulk-export multiple CTools-handled data objects to code.', - 'access arguments' => array('use bulk exporter'), - 'page callback' => 'bulk_export_export', - ); - $items['admin/structure/bulk-export/results'] = array( - 'access arguments' => array('use bulk exporter'), - 'page callback' => 'bulk_export_export', - 'type' => MENU_CALLBACK, - ); - return $items; -} - -/** - * FAPI gateway to the bulk exporter. - * - * @param $cli - * Whether this function is called from command line. - * @param $options - * A collection of options, only passed in by drush_ctools_export(). - */ -function bulk_export_export($cli = FALSE, $options = array()) { - ctools_include('export'); - $form = array(); - $schemas = ctools_export_get_schemas(TRUE); - $exportables = $export_tables = array(); - - foreach ($schemas as $table => $schema) { - if (!empty($schema['export']['list callback']) && function_exists($schema['export']['list callback'])) { - $exportables[$table] = $schema['export']['list callback'](); - } - else { - $exportables[$table] = ctools_export_default_list($table, $schema); - } - natcasesort($exportables[$table]); - $export_tables[$table] = $schema['module']; - } - if ($exportables) { - $form_state = array( - 're_render' => FALSE, - 'no_redirect' => TRUE, - 'exportables' => $exportables, - 'export_tables' => $export_tables, - 'name' => '', - 'code' => '', - 'module' => '', - ); - - // If called from drush_ctools_export, get the module name and - // select all exportables and call the submit function directly. - if ($cli) { - $module_name = $options['name']; - $form_state['values']['name'] = $module_name; - if (isset($options['selections'])) { - $exportables = $options['selections']; - } - $form_state['values']['tables'] = array(); - foreach ($exportables as $table => $names) { - if (!empty($names)) { - $form_state['values']['tables'][] = $table; - $form_state['values'][$table] = array(); - foreach ($names as $name => $title) { - $form_state['values'][$table][$name] = $name; - } - } - } - $output = bulk_export_export_form_submit($form, $form_state); - } - else { - $output = drupal_build_form('bulk_export_export_form', $form_state); - $module_name = $form_state['module']; - } - - if (!empty($form_state['submitted']) || $cli) { - drupal_set_title(t('Bulk export results')); - $output = ''; - $module_code = ''; - $api_code = array(); - $dependencies = $file_data = array(); - foreach ($form_state['code'] as $module => $api_info) { - if ($module == 'general') { - $module_code .= $api_info; - } - else { - foreach ($api_info as $api => $info) { - $api_hook = ctools_plugin_api_get_hook($module, $api); - if (empty($api_code[$api_hook])) { - $api_code[$api_hook] = ''; - } - $api_code[$api_hook] .= " if (\$module == '$module' && \$api == '$api') {\n"; - $api_code[$api_hook] .= " return array('version' => $info[version]);\n"; - $api_code[$api_hook] .= " }\n"; - $dependencies[$module] = TRUE; - - $file = $module_name . '.' . $api . '.inc'; - $code = " $file))); - $output .= drupal_render($export_form); - } - } - } - } - - // Add hook_ctools_plugin_api at the top of the module code, if there is any. - if ($api_code) { - foreach ($api_code as $api_hook => $text) { - $api = "\n/**\n"; - $api .= " * Implements hook_$api_hook().\n"; - $api .= " */\n"; - $api .= "function {$module_name}_$api_hook(\$module, \$api) {\n"; - $api .= $text; - $api .= "}\n"; - $module_code = $api . $module_code; - } - } - - if ($module_code) { - $module = " $form_state['module'] . '.module'))); - $output = drupal_render($export_form) . $output; - } - } - - $info = strtr("name = @module export module\n", array('@module' => $form_state['module'])); - $info .= strtr("description = Export objects from CTools\n", array('@module' => $form_state['values']['name'])); - foreach ($dependencies as $module => $junk) { - $info .= "dependencies[] = $module\n"; - } - $info .= "package = Chaos tool suite\n"; - $info .= "core = 7.x\n"; - if ($cli) { - $file_data[$module_name . '.info'] = $info; - } - else { - $export_form = drupal_get_form('ctools_export_form', $info, t('Place this in @file', array('@file' => $form_state['module'] . '.info'))); - $output = drupal_render($export_form) . $output; - } - } - - if ($cli) { - return $file_data; - } - else { - return $output; - } - } - else { - return t('There are no objects to be exported at this time.'); - } -} - -/** - * FAPI definition for the bulk exporter form. - */ -function bulk_export_export_form($form, &$form_state) { - - $files = system_rebuild_module_data(); - - $form['additional_settings'] = array( - '#type' => 'vertical_tabs', - ); - - $options = $tables = array(); - foreach ($form_state['exportables'] as $table => $list) { - if (empty($list)) { - continue; - } - - foreach ($list as $id => $title) { - $options[$table][$id] = array($title); - $options[$table][$id]['#attributes'] = array('class' => array('bulk-selection')); - } - - $module = $form_state['export_tables'][$table]; - $header = array($table); - $module_name = $files[$module]->info['name']; - $tables[] = $table; - - if (!isset($form[$module_name])) { - $form[$files[$module]->info['name']] = array( - '#type' => 'fieldset', - '#group' => 'additional_settings', - '#title' => $module_name, - ); - } - - $form[$module_name]['tables'][$table] = array( - '#prefix' => '
', - '#suffix' => '
', - '#type' => 'tableselect', - '#header' => $header, - '#options' => $options[$table], - ); - } - - $form['tables'] = array( - '#type' => 'value', - '#value' => $tables, - ); - - $form['name'] = array( - '#type' => 'textfield', - '#title' => t('Module name'), - '#description' => t('Enter the module name to export code to.'), - ); - - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('Export'), - ); - - $form['#action'] = url('admin/structure/bulk-export/results'); - $form['#attached']['css'][] = drupal_get_path('module', 'bulk_export') . '/bulk_export.css'; - $form['#attached']['js'][] = drupal_get_path('module', 'bulk_export') . '/bulk_export.js'; - return $form; -} - -/** - * Process the bulk export submit form and make the results available. - */ -function bulk_export_export_form_submit($form, &$form_state) { - $code = array(); - $name = empty($form_state['values']['name']) ? 'foo' : $form_state['values']['name']; - $tables = $form_state['values']['tables']; - - foreach ($tables as $table) { - $names = array_keys(array_filter($form_state['values'][$table])); - if ($names) { - natcasesort($names); - ctools_export_to_hook_code($code, $table, $names, $name); - } - } - - $form_state['code'] = $code; - $form_state['module'] = $name; -} diff --git a/html/sites/all/modules/contrib/ctools/css/button.css b/html/sites/all/modules/contrib/ctools/css/button.css deleted file mode 100644 index de214080a..000000000 --- a/html/sites/all/modules/contrib/ctools/css/button.css +++ /dev/null @@ -1,30 +0,0 @@ -.ctools-button-processed { - border-style: solid; - border-width: 1px; - display: inline-block; - line-height: 1; -} - -.ctools-button-processed:hover { - cursor: pointer; -} - -.ctools-button-processed .ctools-content { - padding-bottom: 2px; - padding-top: 2px; -} - -.ctools-no-js .ctools-content ul, -.ctools-button-processed .ctools-content ul { - list-style: none none; - margin-left: 0; -} - -.ctools-button-processed li { - line-height: 1.3333; -} - -.ctools-button li a { - padding-left: 12px; - padding-right: 12px; -} diff --git a/html/sites/all/modules/contrib/ctools/css/collapsible-div.css b/html/sites/all/modules/contrib/ctools/css/collapsible-div.css deleted file mode 100644 index 5366a0a87..000000000 --- a/html/sites/all/modules/contrib/ctools/css/collapsible-div.css +++ /dev/null @@ -1,23 +0,0 @@ -.ctools-collapsible-container .ctools-toggle { - float: left; - width: 21px; - height: 21px; - cursor: pointer; - background: url(../images/collapsible-expanded.png) no-repeat 7px 7px; -} - -.ctools-collapsible-container .ctools-collapsible-handle { - display: none; -} - -html.js .ctools-collapsible-container .ctools-collapsible-handle { - display: block; -} - -.ctools-collapsible-container .ctools-collapsible-handle { - cursor: pointer; -} - -.ctools-collapsible-container .ctools-toggle-collapsed { - background-image: url(../images/collapsible-collapsed.png); -} diff --git a/html/sites/all/modules/contrib/ctools/css/context.css b/html/sites/all/modules/contrib/ctools/css/context.css deleted file mode 100644 index 5093104c8..000000000 --- a/html/sites/all/modules/contrib/ctools/css/context.css +++ /dev/null @@ -1,10 +0,0 @@ -.ctools-context-holder .ctools-context-title { - float: left; - width: 49%; - font-style: italic; -} - -.ctools-context-holder .ctools-context-content { - float: right; - width: 49%; -} diff --git a/html/sites/all/modules/contrib/ctools/css/ctools.css b/html/sites/all/modules/contrib/ctools/css/ctools.css deleted file mode 100644 index 66dcd59fd..000000000 --- a/html/sites/all/modules/contrib/ctools/css/ctools.css +++ /dev/null @@ -1,25 +0,0 @@ -.ctools-locked { - color: red; - border: 1px solid red; - padding: 1em; -} - -.ctools-owns-lock { - background: #ffffdd none repeat scroll 0 0; - border: 1px solid #f0c020; - padding: 1em; -} - -a.ctools-ajaxing, -input.ctools-ajaxing, -button.ctools-ajaxing, -select.ctools-ajaxing { - padding-right: 18px !important; - background: url(../images/status-active.gif) right center no-repeat; -} - -div.ctools-ajaxing { - float: left; - width: 18px; - background: url(../images/status-active.gif) center center no-repeat; -} diff --git a/html/sites/all/modules/contrib/ctools/css/dropbutton.css b/html/sites/all/modules/contrib/ctools/css/dropbutton.css deleted file mode 100644 index 486ac3eda..000000000 --- a/html/sites/all/modules/contrib/ctools/css/dropbutton.css +++ /dev/null @@ -1,65 +0,0 @@ -.ctools-dropbutton-processed { - padding-right: 18px; - position: relative; - background-color: inherit; -} - -.ctools-dropbutton-processed.open { - z-index: 200; -} - -.ctools-dropbutton-processed .ctools-content li, -.ctools-dropbutton-processed .ctools-content a { - display: block; -} - -.ctools-dropbutton-processed .ctools-link { - bottom: 0; - display: block; - height: auto; - position: absolute; - right: 0; - top: 0; - width: 17px; -} - -.ctools-dropbutton-processed .ctools-link a { - overflow: hidden; -} - -.ctools-dropbutton-processed .ctools-content ul { - margin: 0; - overflow: hidden; -} - -.ctools-dropbutton-processed.open li + li { - padding-top: 4px; -} - -/** - * This creates the dropbutton arrow and inherits the link color - */ -.ctools-twisty { - border-bottom-color: transparent; - border-left-color: transparent; - border-right-color: transparent; - border-style: solid; - border-width: 4px 4px 0; - line-height: 0; - right: 6px; - position: absolute; - top: 0.75em; - white-space: nowrap; -} - -.ctools-dropbutton-processed.open .ctools-twisty { - border-bottom: 4px solid; - border-left-color: transparent; - border-right-color: transparent; - border-top-color: transparent; - top: 0.5em; -} - -.ctools-no-js .ctools-twisty { - display: none; -} diff --git a/html/sites/all/modules/contrib/ctools/css/dropdown.css b/html/sites/all/modules/contrib/ctools/css/dropdown.css deleted file mode 100644 index d63bb7b26..000000000 --- a/html/sites/all/modules/contrib/ctools/css/dropdown.css +++ /dev/null @@ -1,73 +0,0 @@ -html.js div.ctools-dropdown div.ctools-dropdown-container { - z-index: 1001; - display: none; - text-align: left; - position: absolute; -} - -html.js div.ctools-dropdown div.ctools-dropdown-container ul li a { - display: block; -} - -html.js div.ctools-dropdown div.ctools-dropdown-container ul { - list-style-type: none; - margin: 0; - padding: 0; -} - -html.js div.ctools-dropdown div.ctools-dropdown-container ul li { - display: block; - /* prevent excess right margin in IE */ - margin-right: 0; - margin-left: 0; - padding-right: 0; - padding-left: 0; - background-image: none; /* prevent list backgrounds from mucking things up */ -} - -.ctools-dropdown-no-js .ctools-dropdown-link, -.ctools-dropdown-no-js span.text { - display: none; -} - -/* Everything from here down is purely visual style and can be overridden. */ - -html.js div.ctools-dropdown a.ctools-dropdown-text-link { - background: url(../images/collapsible-expanded.png) 3px 5px no-repeat; - padding-left: 12px; -} - -html.js div.ctools-dropdown div.ctools-dropdown-container { - width: 175px; - background: #fff; - border: 1px solid black; - margin: 4px 1px 0 0; - padding: 0; - color: #494949; -} - -html.js div.ctools-dropdown div.ctools-dropdown-container ul li li a { - padding-left: 25px; - width: 150px; - color: #027ac6; -} - -html.js div.ctools-dropdown div.ctools-dropdown-container ul li a { - text-decoration: none; - padding-left: 5px; - width: 170px; - color: #027ac6; -} - -html.js div.ctools-dropdown div.ctools-dropdown-container ul li span { - display: block; -} - -html.js div.ctools-dropdown div.ctools-dropdown-container ul li span.text { - font-style: italic; - padding-left: 5px; -} - -html.js .ctools-dropdown-hover { - background-color: #ececec; -} diff --git a/html/sites/all/modules/contrib/ctools/css/export-ui-list.css b/html/sites/all/modules/contrib/ctools/css/export-ui-list.css deleted file mode 100644 index 170d128ad..000000000 --- a/html/sites/all/modules/contrib/ctools/css/export-ui-list.css +++ /dev/null @@ -1,45 +0,0 @@ -body form#ctools-export-ui-list-form { - margin: 0 0 20px 0; -} - -#ctools-export-ui-list-form .form-item { - padding-right: 1em; /* LTR */ - float: left; /* LTR */ - margin-top: 0; - margin-bottom: 0; -} - -#ctools-export-ui-list-items { - width: 100%; -} - -#edit-order-wrapper { - clear: left; /* LTR */ -} - -#ctools-export-ui-list-form .form-submit { - margin-top: 1.65em; - float: left; /* LTR */ -} - -tr.ctools-export-ui-disabled td { - color: #999; -} - -th.ctools-export-ui-operations, -td.ctools-export-ui-operations { - text-align: right; /* LTR */ - vertical-align: top; -} - -/* Force the background color to inherit so that the dropbuttons do not need - a specific background color. */ -td.ctools-export-ui-operations { - background-color: inherit; -} - -td.ctools-export-ui-operations .ctools-dropbutton { - text-align: left; /* LTR */ - position: absolute; - right: 10px; -} diff --git a/html/sites/all/modules/contrib/ctools/css/modal-rtl.css b/html/sites/all/modules/contrib/ctools/css/modal-rtl.css deleted file mode 100644 index 5231b9fe1..000000000 --- a/html/sites/all/modules/contrib/ctools/css/modal-rtl.css +++ /dev/null @@ -1,60 +0,0 @@ -div.ctools-modal-content { - text-align: right; -} - -div.ctools-modal-content .modal-header { - background-color: #2385c2; - padding: 0 1em 0 .25em; -} - -div.ctools-modal-content a.close { - color: white; - float: left; -} - -/** modal forms CSS **/ -div.ctools-modal-content .form-item label { - float: right; -} - -div.ctools-modal-content .form-item .description { - clear: right; -} - -div.ctools-modal-content .form-item .description .tips { - margin-left: 0; - margin-right: 2em; -} - -div.ctools-modal-content fieldset, -div.ctools-modal-content .form-radios, -div.ctools-modal-content .form-checkboxes { - clear: right; -} - -div.ctools-modal-content .resizable-textarea { - margin-left: 5em; - margin-right: 15em; -} - -div.ctools-modal-content .container-inline .form-item { - margin-right: 0; - margin-left: 2em; -} - -div.ctools-modal-content label.hidden-options { - background-position: left; - padding-right: 0; - padding-left: 12px; -} - -div.ctools-modal-content label.expanded-options { - background-position: left; - padding-right: 0; - padding-left: 16px; -} - -div.ctools-modal-content .dependent-options { - padding-left: 0; - padding-right: 30px; -} diff --git a/html/sites/all/modules/contrib/ctools/css/modal.css b/html/sites/all/modules/contrib/ctools/css/modal.css deleted file mode 100644 index 0045ecc99..000000000 --- a/html/sites/all/modules/contrib/ctools/css/modal.css +++ /dev/null @@ -1,130 +0,0 @@ -div.ctools-modal-content { - background: #fff; - color: #000; - padding: 0; - margin: 2px; - border: 1px solid #000; - width: 600px; - text-align: left; -} - -div.ctools-modal-content .modal-title { - font-size: 120%; - font-weight: bold; - color: white; - overflow: hidden; - white-space: nowrap; -} - -div.ctools-modal-content .modal-header { - background-color: #2385c2; - padding: 0 .25em 0 1em; -} - -div.ctools-modal-content .modal-header a { - color: white; -} - -div.ctools-modal-content .modal-content { - padding: 1em 1em 0 1em; - overflow: auto; - position: relative; /* Keeps IE7 from flowing outside the modal. */ -} - -div.ctools-modal-content .modal-form { -} - -div.ctools-modal-content a.close { - color: white; - float: right; -} - -div.ctools-modal-content a.close:hover { - text-decoration: none; -} - -div.ctools-modal-content a.close img { - position: relative; - top: 1px; -} - -div.ctools-modal-content .modal-content .modal-throbber-wrapper { - text-align: center; -} - -div.ctools-modal-content .modal-content .modal-throbber-wrapper img { - margin-top: 160px; -} - -/** modal forms CSS **/ -div.ctools-modal-content .form-item label { - width: 15em; - float: left; -} - -div.ctools-modal-content .form-item label.option { - width: auto; - float: none; -} - -div.ctools-modal-content .form-item .description { - clear: left; -} - -div.ctools-modal-content .form-item .description .tips { - margin-left: 2em; -} - -div.ctools-modal-content .no-float .form-item * { - float: none; -} - -div.ctools-modal-content .modal-form .no-float label { - width: auto; -} - -div.ctools-modal-content fieldset, -div.ctools-modal-content .form-radios, -div.ctools-modal-content .form-checkboxes { - clear: left; -} - -div.ctools-modal-content .vertical-tabs-panes > fieldset { - clear: none; -} - -div.ctools-modal-content .resizable-textarea { - width: auto; - margin-left: 15em; - margin-right: 5em; -} - -div.ctools-modal-content .container-inline .form-item { - margin-right: 2em; -} - -#views-exposed-pane-wrapper .form-item { - margin-top: 0; - margin-bottom: 0; -} - -div.ctools-modal-content label.hidden-options { - background: transparent url(../images/arrow-active.png) no-repeat right; - height: 12px; - padding-right: 12px; -} - -div.ctools-modal-content label.expanded-options { - background: transparent url(../images/expanded-options.png) no-repeat right; - height: 12px; - padding-right: 16px; -} - -div.ctools-modal-content .option-text-aligner label.expanded-options, -div.ctools-modal-content .option-text-aligner label.hidden-options { - background: none; -} - -div.ctools-modal-content .dependent-options { - padding-left: 30px; -} diff --git a/html/sites/all/modules/contrib/ctools/css/ruleset.css b/html/sites/all/modules/contrib/ctools/css/ruleset.css deleted file mode 100644 index 891455f01..000000000 --- a/html/sites/all/modules/contrib/ctools/css/ruleset.css +++ /dev/null @@ -1,11 +0,0 @@ -.ctools-right-container { - float: right; - padding: 0 0 0 .5em; - margin: 0; - width: 48.5%; -} - -.ctools-left-container { - padding-right: .5em; - width: 48.5%; -} diff --git a/html/sites/all/modules/contrib/ctools/css/stylizer.css b/html/sites/all/modules/contrib/ctools/css/stylizer.css deleted file mode 100644 index fc8dcb2ee..000000000 --- a/html/sites/all/modules/contrib/ctools/css/stylizer.css +++ /dev/null @@ -1,129 +0,0 @@ -/* Farbtastic placement */ -.color-form { - max-width: 50em; - position: relative; - min-height: 195px; -} -#placeholder { -/* - position: absolute; - top: 0; - right: 0; -*/ - margin: 0 auto; - width: 195px; -} - -/* Palette */ -.color-form .form-item { - height: 2em; - line-height: 2em; - padding-left: 1em; /* LTR */ - margin: 0.5em 0; -} - -.color-form .form-item input { - margin-top: .2em; -} - -.color-form label { - float: left; /* LTR */ - clear: left; /* LTR */ - width: 14em; -} -.color-form .form-text, -.color-form .form-select { - float: left; /* LTR */ -} -.color-form .form-text { - text-align: center; - margin-right: 5px; /* LTR */ - cursor: pointer; -} - -#palette .hook { - float: left; /* LTR */ - margin-top: 3px; - width: 16px; - height: 16px; -} -#palette .up { - background-position: 100% -27px; /* LTR */ -} -#palette .both { - background-position: 100% -54px; /* LTR */ -} - - -#palette .form-item { - width: 24em; -} -#palette .item-selected { - background: #eee; -} - -/* Preview */ -#preview { - width: 45%; - float: right; - margin: 0; -} - -#ctools_stylizer_color_scheme_form { - float: left; - width: 45%; - margin: 0; -} - -/* general style for the layout-icon */ -.ctools-style-icon .caption { - width: 100px; - margin-bottom: 1em; - line-height: 1em; - text-align: center; - cursor: default; -} - -.ctools-style-icons .form-item { - width: 100px; - float: left; - margin: 0 3px !important; -} - -.ctools-style-icons .form-item .ctools-style-icon { - float: none; - height: 150px; - width: 100px; -} - -.ctools-style-icons .form-item label.option { - width: 100px; - display: block; - text-align: center; -} - -.ctools-style-icons .form-item label.option input { - margin: 0 auto; -} - -.ctools-style-icons .ctools-style-category { - height: 190px; -} - -.ctools-style-icons .ctools-style-category label { - font-weight: bold; - width: 100%; - float: left; -} - -/** - * Stylizer font editor widget - */ -.ctools-stylizer-spacing-form .form-item { - float: left; - margin: .25em; -} - -#edit-font-font { - width: 9em; -} diff --git a/html/sites/all/modules/contrib/ctools/css/wizard.css b/html/sites/all/modules/contrib/ctools/css/wizard.css deleted file mode 100644 index ab80def36..000000000 --- a/html/sites/all/modules/contrib/ctools/css/wizard.css +++ /dev/null @@ -1,7 +0,0 @@ -.wizard-trail { - font-size: 120%; -} - -.wizard-trail-current { - font-weight: bold; -} diff --git a/html/sites/all/modules/contrib/ctools/ctools.api.php b/html/sites/all/modules/contrib/ctools/ctools.api.php deleted file mode 100644 index 0948e8798..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools.api.php +++ /dev/null @@ -1,340 +0,0 @@ - TRUE, - ); - - return $plugins; -} - -/** - * Tells CTools where to find module-defined plugins. - * - * This hook is used to inform the CTools plugin system about the location of a - * directory that should be searched for files containing plugins of a - * particular type. CTools invokes this same hook for all plugins, using the - * two passed parameters to indicate the specific type of plugin for which it - * is searching. - * - * The $plugin_type parameter is self-explanatory - it is the string name of the - * plugin type (e.g., Panels' 'layouts' or 'styles'). The $owner parameter is - * necessary because CTools internally namespaces plugins by the module that - * owns them. This is an extension of Drupal best practices on avoiding global - * namespace pollution by prepending your module name to all its functions. - * Consequently, it is possible for two different modules to create a plugin - * type with exactly the same name and have them operate in harmony. In fact, - * this system renders it impossible for modules to encroach on other modules' - * plugin namespaces. - * - * Given this namespacing, it is important that implementations of this hook - * check BOTH the $owner and $plugin_type parameters before returning a path. - * If your module does not implement plugins for the requested module/plugin - * combination, it is safe to return nothing at all (or NULL). As a convenience, - * it is also safe to return a path that does not exist for plugins your module - * does not implement - see form 2 for a use case. - * - * Note that modules implementing a plugin also must implement this hook to - * instruct CTools as to the location of the plugins. See form 3 for a use case. - * - * The conventional structure to return is "plugins/$plugin_type" - that is, a - * 'plugins' subdirectory in your main module directory, with individual - * directories contained therein named for the plugin type they contain. - * - * @param string $owner - * The system name of the module owning the plugin type for which a base - * directory location is being requested. - * @param string $plugin_type - * The name of the plugin type for which a base directory is being requested. - * - * @return string - * The path where CTools' plugin system should search for plugin files, - * relative to your module's root. Omit leading and trailing slashes. - */ -function hook_ctools_plugin_directory($owner, $plugin_type) { - // Form 1 - for a module implementing only the 'content_types' plugin owned - // by CTools, this would cause the plugin system to search the - // /plugins/content_types directory for .inc plugin files. - if ($owner == 'ctools' && $plugin_type == 'content_types') { - return 'plugins/content_types'; - } - - // Form 2 - if your module implements only Panels plugins, and has 'layouts' - // and 'styles' plugins but no 'cache' or 'display_renderers', it is OK to be - // lazy and return a directory for a plugin you don't actually implement (so - // long as that directory doesn't exist). This lets you avoid ugly in_array() - // logic in your conditional, and also makes it easy to add plugins of those - // types later without having to change this hook implementation. - if ($owner == 'panels') { - return "plugins/$plugin_type"; - } - - // Form 3 - CTools makes no assumptions about where your plugins are located, - // so you still have to implement this hook even for plugins created by your - // own module. - if ($owner == 'mymodule') { - // Yes, this is exactly like Form 2 - just a different reasoning for it. - return "plugins/$plugin_type"; - } - // Finally, if nothing matches, it's safe to return nothing at all (== NULL). -} - -/** - * Alter a plugin before it has been processed. - * - * This hook is useful for altering flags or other information that will be - * used or possibly overriden by the process hook if defined. - * - * @param array $plugin - * An associative array defining a plugin. - * @param array $info - * An associative array of plugin type info. - */ -function hook_ctools_plugin_pre_alter(array &$plugin, array &$info) { - // Override a function defined by the plugin. - if ($info['type'] == 'my_type') { - $plugin['my_flag'] = 'new_value'; - } -} - -/** - * Alter a plugin after it has been processed. - * - * This hook is useful for overriding the final values for a plugin after it - * has been processed. - * - * @param array $plugin - * An associative array defining a plugin. - * @param array $info - * An associative array of plugin type info. - */ -function hook_ctools_plugin_post_alter(array &$plugin, array &$info) { - // Override a function defined by the plugin. - if ($info['type'] == 'my_type') { - $plugin['my_function'] = 'new_function'; - } -} - -/** - * Alter the list of modules/themes which implement a certain api. - * - * The hook named here is just an example, as the real existing hooks are named - * for example 'hook_views_api_alter'. - * - * @param array $list - * An array of informations about the implementors of a certain api. - * The key of this array are the module names/theme names. - */ -function hook_ctools_api_hook_alter(array &$list) { - // Alter the path of the node implementation. - $list['node']['path'] = drupal_get_path('module', 'node'); -} - -/** - * Alter the available functions to be used in ctools math expression api. - * - * One use case would be to create your own function in your module and - * allow to use it in the math expression api. - * - * @param array $functions - * An array which has the functions as value. - * @param array $context - * An array containing an item 'final' whose value is a reference to the - * definitions for multiple-arg functions. Use this to add in functions that - * require more than one arg. - */ -function hook_ctools_math_expression_functions_alter(array &$functions, array $context) { - // Allow to convert from degrees to radians. - $functions[] = 'deg2rad'; - - $multiarg = $context['final']; - $multiarg['pow'] = array( - 'function' => 'pow', - 'arguments' => 2, - ); -} - -/** - * Alter the available functions to be used in ctools math expression api. - * - * One usecase would be to create your own function in your module and - * allow to use it in the math expression api. - * - * @param array $constants - * An array of name:value pairs, one for each named constant. Values added - * to this array become read-only variables with the value assigned here. - */ -function hook_ctools_math_expression_constants_alter(array &$constants) { - // Add the speed of light as constant 'c': - $constants['c'] = 299792458; -} - -/** - * Alter everything. - * - * @param array $info - * An associative array containing the following keys: - * - content: The rendered content. - * - title: The content's title. - * - no_blocks: A boolean to decide if blocks should be displayed. - * @param bool $page - * If TRUE then this renderer owns the page and can use theme('page') - * for no blocks; if false, output is returned regardless of any no - * blocks settings. - * @param array $context - * An associative array containing the following keys: - * - args: The raw arguments behind the contexts. - * - contexts: The context objects in use. - * - task: The task object in use. - * - subtask: The subtask object in use. - * - handler: The handler object in use. - */ -function hook_ctools_render_alter(array &$info, &$page, array &$context) { - if ($context['handler']->name == 'my_handler') { - ctools_add_css('my_module.theme', 'my_module'); - } -} - -/** - * Alter a content plugin subtype. - * - * While content types can be altered via hook_ctools_plugin_pre_alter() or - * hook_ctools_plugin_post_alter(), the subtypes that content types rely on - * are special and require their own hook. - * - * This hook can be used to add things like 'render last' or change icons - * or categories or to rename content on specific sites. - */ -function hook_ctools_content_subtype_alter($subtype, $plugin) { - // Force a particular subtype of a particular plugin to render last. - if ($plugin['module'] === 'some_plugin_module' - && $plugin['name'] === 'some_plugin_name' - && $subtype['subtype_id'] === 'my_subtype_id' - ) { - $subtype['render last'] = TRUE; - } -} - -/** - * Alter the definition of an entity context plugin. - * - * @param array $plugin - * An associative array defining a plugin. - * @param array $entity - * The entity info array of a specific entity type. - * @param string $plugin_id - * The plugin ID, in the format NAME:KEY. - */ -function hook_ctools_entity_context_alter(array &$plugin, array &$entity, $plugin_id) { - ctools_include('context'); - switch ($plugin_id) { - case 'entity_id:taxonomy_term': - $plugin['no ui'] = TRUE; - case 'entity:user': - $plugin = ctools_get_context('user'); - unset($plugin['no ui']); - unset($plugin['no required context ui']); - break; - } -} - -/** - * Alter the conversion of context items by ctools context plugin convert()s. - * - * @param ctools_context $context - * The current context plugin object. If this implemented a 'convert' - * function, the value passed in has been processed by that function. - * @param string $converter - * A string associated with the plugin type, identifying the operation. - * @param string $value - * The value being converted; this is the only return from the function. - * @param array $converter_options - * Array of key-value pairs to pass to a converter function from higher - * levels. - * - * @see ctools_context_convert_context() - */ -function hook_ctools_context_converter_alter(ctools_context $context, $converter, &$value, array $converter_options) { - if ($converter === 'mystring') { - $value = 'fixed'; - } -} - -/** - * Alter the definition of entity context plugins. - * - * @param array $plugins - * An associative array of plugin definitions, keyed by plugin ID. - * - * @see hook_ctools_entity_context_alter() - */ -function hook_ctools_entity_contexts_alter(array &$plugins) { - $plugins['entity_id:taxonomy_term']['no ui'] = TRUE; -} - -/** - * Change cleanstring settings. - * - * @param array $settings - * An associative array of cleanstring settings. - * - * @see ctools_cleanstring() - */ -function hook_ctools_cleanstring_alter(array &$settings) { - // Convert all strings to lower case. - $settings['lower case'] = TRUE; -} - -/** - * Change cleanstring settings for a specific clean ID. - * - * @param array $settings - * An associative array of cleanstring settings. - * - * @see ctools_cleanstring() - */ -function hook_ctools_cleanstring_CLEAN_ID_alter(array &$settings) { - // Convert all strings to lower case. - $settings['lower case'] = TRUE; -} - -/** - * Let other modules modify the context handler before it is rendered. - * - * @param object $handler - * A handler for a current task and subtask. - * @param array $contexts - * An associative array of contexts. - * @param array $args - * An array for current args. - * - * @see ctools_context_handler_pre_render() - */ -function ctools_context_handler_pre_render($handler, array $contexts, array $args) { - $handler->conf['css_id'] = 'my-id'; -} - -/** - * @} End of "addtogroup hooks". - */ diff --git a/html/sites/all/modules/contrib/ctools/ctools.info b/html/sites/all/modules/contrib/ctools/ctools.info deleted file mode 100644 index c4b3d5777..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools.info +++ /dev/null @@ -1,26 +0,0 @@ -name = Chaos tools -description = A library of helpful tools by Merlin of Chaos. -core = 7.x -package = Chaos tool suite -files[] = includes/context.inc -files[] = includes/css-cache.inc -files[] = includes/math-expr.inc -files[] = includes/stylizer.inc - -; Tests. -files[] = tests/context.test -files[] = tests/css.test -files[] = tests/css_cache.test -files[] = tests/ctools.plugins.test -files[] = tests/ctools.test -files[] = tests/math_expression.test -files[] = tests/math_expression_stack.test -files[] = tests/object_cache.test -files[] = tests/object_cache_unit.test -files[] = tests/page_tokens.test - -; Information added by Drupal.org packaging script on 2023-01-31 -version = "7.x-1.21" -core = "7.x" -project = "ctools" -datestamp = "1675152418" diff --git a/html/sites/all/modules/contrib/ctools/ctools.install b/html/sites/all/modules/contrib/ctools/ctools.install deleted file mode 100644 index d50bc9f8f..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools.install +++ /dev/null @@ -1,299 +0,0 @@ - $t('CTools CSS Cache'), - 'severity' => REQUIREMENT_OK, - 'value' => $t('Exists'), - ); - - $path = 'public://ctools/css'; - if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY)) { - $requirements['ctools_css_cache']['description'] = $t('The CTools CSS cache directory, %path could not be created due to a misconfigured files directory. Please ensure that the files directory is correctly configured and that the webserver has permission to create directories.', array('%path' => file_uri_target($path))); - $requirements['ctools_css_cache']['severity'] = REQUIREMENT_ERROR; - $requirements['ctools_css_cache']['value'] = $t('Unable to create'); - } - - if (!function_exists('error_get_last')) { - $requirements['ctools_php_52']['title'] = $t('CTools PHP requirements'); - $requirements['ctools_php_52']['description'] = $t('CTools requires certain features only available in PHP 5.2.0 or higher.'); - $requirements['ctools_php_52']['severity'] = REQUIREMENT_WARNING; - $requirements['ctools_php_52']['value'] = $t('PHP !version', array('!version' => phpversion())); - } - } - - return $requirements; -} - -/** - * Implements hook_schema(). - */ -function ctools_schema() { - return ctools_schema_4(); -} - -/** - * Version 4 of the CTools schema. - */ -function ctools_schema_4() { - $schema = ctools_schema_3(); - - // Removed due to alternative database configuration issues. - // @see https://www.drupal.org/project/ctools/issues/2941920 - - return $schema; -} - -/** - * Version 3 of the CTools schema. - */ -function ctools_schema_3() { - $schema = ctools_schema_2(); - - // Update the 'obj' field to be 128 bytes long: - $schema['ctools_object_cache']['fields']['obj']['length'] = 128; - - return $schema; -} - -/** - * Version 2 of the CTools schema. - */ -function ctools_schema_2() { - $schema = ctools_schema_1(); - - // Update the 'name' field to be 128 bytes long: - $schema['ctools_object_cache']['fields']['name']['length'] = 128; - - // Update the 'data' field to be type 'blob'. - $schema['ctools_object_cache']['fields']['data'] = array( - 'type' => 'blob', - 'size' => 'big', - 'description' => 'Serialized data being stored.', - 'serialize' => TRUE, - ); - - // DO NOT MODIFY THIS TABLE -- this definition is used to create the table. - // Changes to this table must be made in schema_3 or higher. - $schema['ctools_css_cache'] = array( - 'description' => 'A special cache used to store CSS that must be non-volatile.', - 'fields' => array( - 'cid' => array( - 'type' => 'varchar', - 'length' => '128', - 'description' => 'The CSS ID this cache object belongs to.', - 'not null' => TRUE, - ), - 'filename' => array( - 'type' => 'varchar', - 'length' => '255', - 'description' => 'The filename this CSS is stored in.', - ), - 'css' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'CSS being stored.', - 'serialize' => TRUE, - ), - 'filter' => array( - 'type' => 'int', - 'size' => 'tiny', - 'description' => 'Whether or not this CSS needs to be filtered.', - ), - ), - 'primary key' => array('cid'), - ); - - return $schema; -} - -/** - * CTools' initial schema; separated for the purposes of updates. - * - * DO NOT MAKE CHANGES HERE. This schema version is locked. - */ -function ctools_schema_1() { - $schema['ctools_object_cache'] = array( - 'description' => t('A special cache used to store objects that are being edited; it serves to save state in an ordinarily stateless environment.'), - 'fields' => array( - 'sid' => array( - 'type' => 'varchar', - 'length' => '64', - 'not null' => TRUE, - 'description' => 'The session ID this cache object belongs to.', - ), - 'name' => array( - 'type' => 'varchar', - 'length' => '32', - 'not null' => TRUE, - 'description' => 'The name of the object this cache is attached to.', - ), - 'obj' => array( - 'type' => 'varchar', - 'length' => '32', - 'not null' => TRUE, - 'description' => 'The type of the object this cache is attached to; this essentially represents the owner so that several sub-systems can use this cache.', - ), - 'updated' => array( - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - 'description' => 'The time this cache was created or updated.', - ), - 'data' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'Serialized data being stored.', - 'serialize' => TRUE, - ), - ), - 'primary key' => array('sid', 'obj', 'name'), - 'indexes' => array('updated' => array('updated')), - ); - return $schema; -} - -/** - * Implements hook_install(). - */ -function ctools_install() { - // Activate our custom cache handler for the CSS cache. - variable_set('cache_class_cache_ctools_css', 'CToolsCssCache'); -} - -/** - * Implements hook_uninstall(). - */ -function ctools_uninstall() { - variable_del('cache_class_cache_ctools_css'); -} - -/** - * Enlarge the ctools_object_cache.name column to prevent truncation and weird - * errors. - */ -function ctools_update_6001() { - // Perform updates like this to reduce code duplication. - $schema = ctools_schema_2(); - - db_change_field('ctools_object_cache', 'name', 'name', $schema['ctools_object_cache']['fields']['name']); -} - -/** - * Add the new css cache table. - */ -function ctools_update_6002() { - // Schema 2 is locked and should not be changed. - $schema = ctools_schema_2(); - - db_create_table('ctools_css_cache', $schema['ctools_css_cache']); -} - -/** - * Take over for the panels_views module if it was on. - */ -function ctools_update_6003() { - $result = db_query('SELECT status FROM {system} WHERE name = :name', array(':name' => 'panels_views'))->fetchField(); - if ($result) { - db_delete('system')->condition('name', 'panels_views')->execute(); - module_enable(array('views_content'), TRUE); - } -} - -/** - * Add primary key to the ctools_object_cache table. - */ -function ctools_update_6004() { - db_add_primary_key('ctools_object_cache', array('sid', 'obj', 'name')); - db_drop_index('ctools_object_cache', 'sid_obj_name'); -} - -/** - * Removed update. - */ -function ctools_update_6005() { - return array(); -} - -/** - * The ctools_custom_content table was originally here, but is now moved to - * its own module. - */ -function ctools_update_6007() { - $ret = array(); - if (db_table_exists('ctools_custom_content')) { - // Enable the module to make everything as seamless as possible. - module_enable(array('ctools_custom_content'), TRUE); - } - - return $ret; -} - -/** - * The ctools_object_cache needs to be defined as a blob. - */ -function ctools_update_6008() { - db_delete('ctools_object_cache') - ->execute(); - - db_change_field('ctools_object_cache', 'data', 'data', array( - 'type' => 'blob', - 'size' => 'big', - 'description' => 'Serialized data being stored.', - 'serialize' => TRUE, - ) - ); -} - -/** - * Enable the custom CSS cache handler. - */ -function ctools_update_7000() { - variable_set('cache_class_cache_ctools_css', 'CToolsCssCache'); -} - -/** - * Increase the length of the ctools_object_cache.obj column. - */ -function ctools_update_7001() { - db_change_field('ctools_object_cache', 'obj', 'obj', array( - 'type' => 'varchar', - 'length' => '128', - 'not null' => TRUE, - 'description' => 'The type of the object this cache is attached to; this essentially represents the owner so that several sub-systems can use this cache.', - )); -} - -/** - * Increase the length of the ctools_object_cache.name column to 255. - */ -function ctools_update_7002() { - // Removed due to alternative database configuration issues. - // @see https://www.drupal.org/project/ctools/issues/2941920 -} - -/** - * Revert the length of the ctools_object_cache.name column back to 128. - */ -function ctools_update_7003() { - db_delete('ctools_object_cache')->execute(); - db_change_field('ctools_object_cache', 'name', 'name', array( - 'type' => 'varchar', - 'length' => '128', - 'not null' => TRUE, - 'description' => 'The name of the object this cache is attached to.', - )); -} diff --git a/html/sites/all/modules/contrib/ctools/ctools.module b/html/sites/all/modules/contrib/ctools/ctools.module deleted file mode 100644 index 2ec0ab73f..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools.module +++ /dev/null @@ -1,1206 +0,0 @@ - 7.x-1.x. - * - * To define a specific version of CTools as a dependency for another module, - * simply include a dependency line in that module's info file, e.g.: - * ; Requires CTools v7.x-1.4 or newer. - * dependencies[] = ctools (>=1.4) - * - * @deprecated in CTools 1.15 and will be removed before CTools 2.0.0. - * Use the version provided by the drupal.org packaging system. - */ -define('CTOOLS_MODULE_VERSION', '7.x-1.13'); - -/** - * Test the CTools API version. - * - * This function can always be used to safely test if CTools has the minimum - * API version that your module can use. It can also try to protect you from - * running if the CTools API version is too new, but if you do that you need - * to be very quick about watching CTools API releases and release new versions - * of your software as soon as the new release is made, or people might end up - * updating CTools and having your module shut down without any recourse. - * - * It is recommended that every hook of your module that might use CTools or - * might lead to a use of CTools be guarded like this: - * - * @code - * if (!module_invoke('ctools', 'api_version', '1.0')) { - * return; - * } - * @endcode - * - * Note that some hooks such as _menu() or _theme() must return an array(). - * - * You can use it in your hook_requirements to report this error condition - * like this: - * - * @code - * define('MODULENAME_MINIMUM_CTOOLS_API_VERSION', '1.0'); - * define('MODULENAME_MAXIMUM_CTOOLS_API_VERSION', '1.1'); - * - * function MODULENAME_requirements($phase) { - * $requirements = array(); - * if (!module_invoke('ctools', 'api_version', MODULENAME_MINIMUM_CTOOLS_API_VERSION, MODULENAME_MAXIMUM_CTOOLS_API_VERSION)) { - * $requirements['MODULENAME_ctools'] = array( - * 'title' => $t('MODULENAME required Chaos Tool Suite (CTools) API Version'), - * 'value' => t('Between @a and @b', array('@a' => MODULENAME_MINIMUM_CTOOLS_API_VERSION, '@b' => MODULENAME_MAXIMUM_CTOOLS_API_VERSION)), - * 'severity' => REQUIREMENT_ERROR, - * ); - * } - * return $requirements; - * } - * @endcode - * - * Please note that the version is a string, not an floating point number. - * This will matter once CTools reaches version 1.10. - * - * A CTools API changes history will be kept in API.txt. Not every new - * version of CTools will necessarily update the API version. - * @param $minimum - * The minimum version of CTools necessary for your software to run with it. - * @param $maximum - * The maximum version of CTools allowed for your software to run with it. - * - * @return bool - * TRUE if the running ctools is usable, FALSE otherwise. - */ -function ctools_api_version($minimum, $maximum = NULL) { - if (version_compare(CTOOLS_API_VERSION, $minimum, '<')) { - return FALSE; - } - - if (isset($maximum) && version_compare(CTOOLS_API_VERSION, $maximum, '>')) { - return FALSE; - } - - return TRUE; -} - -// ----------------------------------------------------------------------- -// General utility functions. -/** - * Include .inc files as necessary. - * - * This fuction is helpful for including .inc files for your module. The - * general case is including ctools funcitonality like this: - * - * @code - * ctools_include('plugins'); - * @endcode - * - * Similar funcitonality can be used for other modules by providing the $module - * and $dir arguments like this: - * - * @code - * // include mymodule/includes/import.inc - * ctools_include('import', 'mymodule'); - * // include mymodule/plugins/foobar.inc - * ctools_include('foobar', 'mymodule', 'plugins'); - * @endcode - * - * @param $file - * The base file name to be included. - * @param $module - * Optional module containing the include. - * @param $dir - * Optional subdirectory containing the include file. - */ - -function ctools_include($file, $module = 'ctools', $dir = 'includes') { - static $used = array(); - - $dir = '/' . ($dir ? $dir . '/' : ''); - - if (!isset($used[$module][$dir][$file])) { - require_once DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . "$dir$file.inc"; - $used[$module][$dir][$file] = TRUE; - } -} - -/** - * Include .inc files in a form context. - * - * This is a variant of ctools_include that will save information in the - * the form_state so that cached forms will properly include things. - */ -function ctools_form_include(&$form_state, $file, $module = 'ctools', $dir = 'includes') { - if (!isset($form_state['build_info']['args'])) { - $form_state['build_info']['args'] = array(); - } - - $dir = '/' . ($dir ? $dir . '/' : ''); - form_load_include($form_state, 'inc', $module, $dir . $file); -} - -/** - * Add an arbitrary path to the $form_state so it can work with form cache. - * - * The module_load_include() function uses an unfortunately annoying syntax to - * work, making it difficult to translate the more simple $path + $file syntax. - */ -function ctools_form_include_file(&$form_state, $filename) { - if (!isset($form_state['build_info']['args'])) { - $form_state['build_info']['args'] = array(); - } - - // Now add this to the build info files so that AJAX requests will know to load it. - $form_state['build_info']['files']["$filename"] = $filename; - require_once DRUPAL_ROOT . '/' . $filename; -} - -/** - * Provide the proper path to an image as necessary. - * - * This helper function is used by ctools but can also be used in other - * modules in the same way as explained in the comments of ctools_include. - * - * @param $image - * The base file name (with extension) of the image to be included. - * @param $module - * Optional module containing the include. - * @param $dir - * Optional subdirectory containing the include file. - * - * @return string - * A string containing the appropriate path from drupal root. - */ -function ctools_image_path($image, $module = 'ctools', $dir = 'images') { - return drupal_get_path('module', $module) . "/$dir/" . $image; -} - -/** - * Include css files as necessary. - * - * This helper function is used by ctools but can also be used in other - * modules in the same way as explained in the comments of ctools_include. - * - * @param $file - * The base file name to be included. - * @param $module - * Optional module containing the include. - * @param $dir - * Optional subdirectory containing the include file. - */ -function ctools_add_css($file, $module = 'ctools', $dir = 'css') { - drupal_add_css(drupal_get_path('module', $module) . "/$dir/$file.css"); -} - -/** - * Format a css file name for use with $form['#attached']['css']. - * - * This helper function is used by ctools but can also be used in other - * modules in the same way as explained in the comments of ctools_include. - * - * @code - * $form['#attached']['css'] = array(ctools_attach_css('collapsible-div')); - * $form['#attached']['css'][ctools_attach_css('collapsible-div')] = array('preprocess' => FALSE); - * @endcode - * - * @param $file - * The base file name to be included. - * @param $module - * Optional module containing the include. - * @param $dir - * Optional subdirectory containing the include file. - * - * @return string - * A string containing the appropriate path from drupal root. - */ -function ctools_attach_css($file, $module = 'ctools', $dir = 'css') { - return drupal_get_path('module', $module) . "/$dir/$file.css"; -} - -/** - * Include js files as necessary. - * - * This helper function is used by ctools but can also be used in other - * modules in the same way as explained in the comments of ctools_include. - * - * @param $file - * The base file name to be included. - * @param $module - * Optional module containing the include. - * @param $dir - * Optional subdirectory containing the include file. - */ -function ctools_add_js($file, $module = 'ctools', $dir = 'js') { - drupal_add_js(drupal_get_path('module', $module) . "/$dir/$file.js"); -} - -/** - * Format a javascript file name for use with $form['#attached']['js']. - * - * This helper function is used by ctools but can also be used in other - * modules in the same way as explained in the comments of ctools_include. - * - * @code - * $form['#attached']['js'] = array(ctools_attach_js('auto-submit')); - * @endcode - * - * @param $file - * The base file name to be included. - * @param $module - * Optional module containing the include. - * @param $dir - * Optional subdirectory containing the include file. - * - * @return string - * A string containing the appropriate path from drupal root. - */ -function ctools_attach_js($file, $module = 'ctools', $dir = 'js') { - return drupal_get_path('module', $module) . "/$dir/$file.js"; -} - -/** - * Get a list of roles in the system. - * - * @return - * An array of role names keyed by role ID. - * - * @deprecated - * user_roles() should be used instead. - */ -function ctools_get_roles() { - return user_roles(); -} - -/** - * Parse integer sequences of the form "x,y,z" or "x+y+z" into separate values. - * - * A string with integers separated by comma (,) is reported as an 'and' set; - * separation by a plus sign (+) or a space ( ) is an 'or' set. The meaning - * of this is up to the caller. Negative or fractional numbers are not - * recognised. - * - * Additional space characters within or around the sequence are not allowed. - * - * @param $str - * The string to parse. - * - * @return object - * An object containing the properties: - * - * - operator: Either 'and' or 'or' when there are multiple matched values. - * Absent when invalid_input is TRUE or there is only one value. - * - value: An array of integers (never strings) from $str. An empty array is - * returned if the input is empty. A single integer input is returned - * as a single value, but no 'operator' is defined. - * - invalid_input: TRUE if input could not be parsed and the values array - * will contain just -1. This property is otherwise absent. - */ -function ctools_break_phrase($str) { - $object = new stdClass(); - - if (preg_match('/^([0-9]+[+ ])+[0-9]+$/', $str)) { - // The '+' character in a query string may be parsed as ' '. - $object->operator = 'or'; - $object->value = preg_split('/[+ ]/', $str); - } - elseif (preg_match('/^([0-9]+,)*[0-9]+$/', $str)) { - $object->operator = 'and'; - $object->value = explode(',', $str); - } - - // Keep an 'error' value if invalid strings were given. - if (!empty($str) && (empty($object->value) || !is_array($object->value))) { - $object->value = array(-1); - $object->invalid_input = TRUE; - return $object; - } - - if (empty($object->value)) { - $object->value = array(); - } - - // Doubly ensure that all values are numeric only. - foreach ($object->value as $id => $value) { - $object->value[$id] = (int) $value; - } - - return $object; -} - -/** - * Set a token/value pair to be replaced later in the request, specifically in - * ctools_page_token_processing(). - * - * @param string $token - * The token to be replaced later, during page rendering. This should - * ideally be a string inside of an HTML comment, so that if there is - * no replacement, the token will not render on the page. - * If $token is NULL, the token set is not changed, but is still - * returned. - * @param string $type - * The type of the token. Can be either 'variable', which will pull data - * directly from the page variables, or 'callback', which causes a function - * to be called to calculate the value. No other values are supported. - * @param string|array $argument - * For $type of: - * - 'variable': argument should be the key to fetch from the $variables. - * - 'callback': then it should either be the callback function name as a - * string, or an array that will be sent to call_user_func_array(). Argument - * arrays must not use array keys (i.e. $a[0] is the first and $a[1] the - * second element, etc.) - * - * @return array - * A array of token/variable names to be replaced. - */ -function ctools_set_page_token($token = NULL, $type = NULL, $argument = NULL) { - $tokens = &drupal_static('ctools_set_page_token', array()); - - if (isset($token)) { - $tokens[$token] = array($type, $argument); - } - return $tokens; -} - -/** - * Reset the defined page tokens within this request. - * - * Introduced for simpletest purposes. Normally not needed. - */ -function ctools_reset_page_tokens() { - drupal_static_reset('ctools_set_page_token'); -} - -/** - * Set a replacement token from the containing element's children during #post_render. - * - * This function can be used like this: - * $token = ctools_set_variable_token('tabs'); - * - * The token "" would then be replaced by the value of - * this element's (sibling) render array key 'tabs' during post-render (or be - * deleted if there was no such key by that point). - * - * @param string $token - * The token string for the page callback, e.g. 'title'. - * - * @return string - * The constructed token. - * - * @see ctools_set_callback_token() - * @see ctools_page_token_processing() - */ -function ctools_set_variable_token($token) { - $string = ''; - ctools_set_page_token($string, 'variable', $token); - return $string; -} - -/** - * Set a replacement token from the value of a function during #post_render. - * - * This function can be used like this: - * $token = ctools_set_callback_token('id', 'mymodule_myfunction'); - * - * Or this (from its use in ctools_page_title_content_type_render): - * $token = ctools_set_callback_token('title', array( - * 'ctools_page_title_content_type_token', $conf['markup'], $conf['id'], $conf['class'] - * ) - * ); - * - * The token (e.g: "") - * would then be replaced during post-render by the return value of: - * - * ctools_page_title_content_type_token($value_markup, $value_id, $value_class); - * - * @param string $token - * The token string for the page callback, e.g. 'title'. - * - * @param string|array $callback - * For callback functions that require no args, the name of the function as a - * string; otherwise an array of two or more elements: the function name - * followed by one or more function arguments. - * - * NB: the value of $callback must be a procedural (non-class) function that - * passes the php function_exists() check. - * - * The callback function itself will be called with args dependent - * on $callback. If: - * - $callback is a string, the function is called with a reference to the - * render array; - * - $callback is an array, the function is called with $callback merged - * with an array containing a reference to the render array. - * - * @return string - * The constructed token. - * - * @see ctools_set_variable_token() - * @see ctools_page_token_processing() - */ -function ctools_set_callback_token($token, $callback) { - // If the callback uses arguments they are considered in the token. - if (is_array($callback)) { - $token .= '-' . md5(serialize($callback)); - } - $string = ''; - ctools_set_page_token($string, 'callback', $callback); - return $string; -} - -/** - * Tell CTools that sidebar blocks should not be rendered. - * - * It is often desirable to not display sidebars when rendering a page, - * particularly when using Panels. This informs CTools to alter out any - * sidebar regions during block render. - */ -function ctools_set_no_blocks($blocks = FALSE) { - $status = &drupal_static(__FUNCTION__, TRUE); - $status = $blocks; -} - -/** - * Wrapper function to create UUIDs via ctools, falls back on UUID module - * if it is enabled. This code is a copy of uuid.inc from the uuid module. - * - * @see http://php.net/uniqid#65879 - */ -function ctools_uuid_generate() { - if (!module_exists('uuid')) { - ctools_include('uuid'); - - $callback = &drupal_static(__FUNCTION__); - - if (empty($callback)) { - if (function_exists('uuid_create') && !function_exists('uuid_make')) { - $callback = '_ctools_uuid_generate_pecl'; - } - elseif (function_exists('com_create_guid')) { - $callback = '_ctools_uuid_generate_com'; - } - else { - $callback = '_ctools_uuid_generate_php'; - } - } - return $callback(); - } - else { - return uuid_generate(); - } -} - -/** - * Check that a string appears to be in the format of a UUID. - * - * @see http://drupal.org/project/uuid - * - * @param $uuid - * The string to test. - * - * @return - * TRUE if the string is well formed. - */ -function ctools_uuid_is_valid($uuid = '') { - if (empty($uuid)) { - return FALSE; - } - if (function_exists('uuid_is_valid') || module_exists('uuid')) { - return uuid_is_valid($uuid); - } - else { - ctools_include('uuid'); - return uuid_is_valid($uuid); - } -} - -/** - * Add an array of classes to the body. - * - * @param mixed $classes - * A string or an array of class strings to add. - * @param string $hook - * The theme hook to add the class to. The default is 'html' which will - * affect the body tag. - */ -function ctools_class_add($classes, $hook = 'html') { - if (!is_array($classes)) { - $classes = array($classes); - } - - $static = &drupal_static('ctools_process_classes', array()); - if (!isset($static[$hook]['add'])) { - $static[$hook]['add'] = array(); - } - foreach ($classes as $class) { - $static[$hook]['add'][] = $class; - } -} - -/** - * Remove an array of classes from the body. - * - * @param mixed $classes - * A string or an array of class strings to remove. - * @param string $hook - * The theme hook to remove the class from. The default is 'html' which will - * affect the body tag. - */ -function ctools_class_remove($classes, $hook = 'html') { - if (!is_array($classes)) { - // @todo Consider using explode(' ', $classes); - // @todo Consider checking that $classes is a string before adding. - $classes = array($classes); - } - - $static = &drupal_static('ctools_process_classes', array()); - if (!isset($static[$hook]['remove'])) { - $static[$hook]['remove'] = array(); - } - foreach ($classes as $class) { - $static[$hook]['remove'][] = $class; - } -} - -/** - * Reset the storage used for ctools_class_add and ctools_class_remove. - * - * @see ctools_class_add() - * @see ctools_class_remove() - */ -function ctools_class_reset() { - drupal_static_reset('ctools_process_classes'); -} - -/** - * Return the classes for the body (added by ctools_class_add). - * - * @return array - * A copy of the array of classes to add to the body tag. If none have been - * added, this will be an empty array. - * - * @see ctools_class_add() - */ -function ctools_get_classes() { - return drupal_static('ctools_process_classes', array()); -} - -// ----------------------------------------------------------------------- -// Drupal core hooks. -/** - * Implement hook_init to keep our global CSS at the ready. - */ - -function ctools_init() { - ctools_add_css('ctools'); - // If we are sure that CTools' AJAX is in use, change the error handling. - if (!empty($_REQUEST['ctools_ajax'])) { - ini_set('display_errors', 0); - register_shutdown_function('ctools_shutdown_handler'); - } - - // Clear plugin cache on the module page submit. - if ($_GET['q'] == 'admin/modules/list/confirm' && !empty($_POST)) { - cache_clear_all('ctools_plugin_files:', 'cache', TRUE); - } -} - -/** - * Shutdown handler used during ajax operations to help catch fatal errors. - */ -function ctools_shutdown_handler() { - if (function_exists('error_get_last') && ($error = error_get_last())) { - switch ($error['type']) { - case E_ERROR: - case E_CORE_ERROR: - case E_COMPILE_ERROR: - case E_USER_ERROR: - // Do this manually because including files here is dangerous. - $commands = array( - array( - 'command' => 'alert', - 'title' => t('Error'), - 'text' => t('Unable to complete operation. Fatal error in @file on line @line: @message', array( - '@file' => $error['file'], - '@line' => $error['line'], - '@message' => $error['message'], - )), - ), - ); - - // Change the status code so that the client will read the AJAX returned. - header('HTTP/1.1 200 OK'); - drupal_json($commands); - } - } -} - -/** - * Implements hook_theme(). - */ -function ctools_theme() { - ctools_include('utility'); - $items = array(); - ctools_passthrough('ctools', 'theme', $items); - return $items; -} - -/** - * Implements hook_menu(). - */ -function ctools_menu() { - ctools_include('utility'); - $items = array(); - ctools_passthrough('ctools', 'menu', $items); - return $items; -} - -/** - * Implements hook_permission(). - */ -function ctools_permission() { - return array( - 'use ctools import' => array( - 'title' => t('Use CTools importer'), - 'description' => t('The import functionality allows users to execute arbitrary PHP code, so extreme caution must be taken.'), - 'restrict access' => TRUE, - ), - ); -} - -/** - * Implementation of hook_cron. Clean up old caches. - */ -function ctools_cron() { - ctools_include('utility'); - $items = array(); - ctools_passthrough('ctools', 'cron', $items); -} - -/** - * Implements hook_flush_caches(). - */ -function ctools_flush_caches() { - // Only return the CSS cache bin if it has been activated, to avoid - // drupal_flush_all_caches() from trying to truncate a non-existing table. - return variable_get('cache_class_cache_ctools_css', FALSE) ? array('cache_ctools_css') : array(); -} - -/** - * Implements hook_element_info_alter(). - */ -function ctools_element_info_alter(&$type) { - ctools_include('dependent'); - ctools_dependent_element_info_alter($type); -} - -/** - * Implementation of hook_file_download() - * - * When using the private file system, we have to let Drupal know it's ok to - * download CSS and image files from our temporary directory. - */ -function ctools_file_download($filepath) { - if (strpos($filepath, 'ctools') === 0) { - $mime = file_get_mimetype($filepath); - // For safety's sake, we allow only text and images. - if (strpos($mime, 'text') === 0 || strpos($mime, 'image') === 0) { - return array('Content-type:' . $mime); - } - } -} - -/** - * Implements hook_registry_files_alter(). - * - * Alter the registry of files to automagically include all classes in - * class-based plugins. - */ -function ctools_registry_files_alter(&$files, $indexed_modules) { - ctools_include('registry'); - return _ctools_registry_files_alter($files, $indexed_modules); -} - -// ----------------------------------------------------------------------- -// FAPI hooks that must be in the .module file. -/** - * Alter the comment form to get a little more control over it. - */ - -function ctools_form_comment_form_alter(&$form, &$form_state) { - if (!empty($form_state['ctools comment alter'])) { - // Force the form to post back to wherever we are. - $form['#action'] = url($_GET['q'], array('fragment' => 'comment-form')); - if (empty($form['#submit'])) { - $form['#submit'] = array('comment_form_submit'); - } - $form['#submit'][] = 'ctools_node_comment_form_submit'; - } -} - -function ctools_node_comment_form_submit(&$form, &$form_state) { - $form_state['redirect'][0] = $_GET['q']; -} - -// ----------------------------------------------------------------------- -// CTools hook implementations. -/** - * Implementation of hook_ctools_plugin_directory() to let the system know - * where all our own plugins are. - */ - -function ctools_ctools_plugin_directory($owner, $plugin_type) { - if ($owner == 'ctools') { - return 'plugins/' . $plugin_type; - } -} - -/** - * Implements hook_ctools_plugin_type(). - */ -function ctools_ctools_plugin_type() { - ctools_include('utility'); - $items = array(); - // Add all the plugins that have their own declaration space elsewhere. - ctools_passthrough('ctools', 'plugin-type', $items); - - return $items; -} - -// ----------------------------------------------------------------------- -// Drupal theme preprocess hooks that must be in the .module file. -/** - * A theme preprocess function to automatically allow panels-based node - * templates based upon input when the panel was configured. - */ - -function ctools_preprocess_node(&$vars) { - // The 'ctools_template_identifier' attribute of the node is added when the pane is - // rendered. - if (!empty($vars['node']->ctools_template_identifier)) { - $vars['ctools_template_identifier'] = check_plain($vars['node']->ctools_template_identifier); - $vars['theme_hook_suggestions'][] = 'node__panel__' . check_plain($vars['node']->ctools_template_identifier); - } -} - -/** - * Implements hook_page_alter(). - * - * Last ditch attempt to remove sidebar regions if the "no blocks" - * functionality has been activated. - * - * @see ctools_block_list_alter() - */ -function ctools_page_alter(&$page) { - $check = drupal_static('ctools_set_no_blocks', TRUE); - if (!$check) { - foreach ($page as $region_id => $region) { - // @todo -- possibly we can set configuration for this so that users can - // specify which blocks will not get rendered. - if (strpos($region_id, 'sidebar') !== FALSE) { - unset($page[$region_id]); - } - } - } - $page['#post_render'][] = 'ctools_page_token_processing'; -} - -/** - * A theme post_render callback to allow content type plugins to use page - * template variables which are not yet available when the content type is - * rendered. - */ -function ctools_page_token_processing($children, $elements) { - $tokens = ctools_set_page_token(); - if (!empty($tokens)) { - foreach ($tokens as $token => $key) { - list($type, $argument) = $key; - switch ($type) { - case 'variable': - $tokens[$token] = isset($elements[$argument]) ? $elements[$argument] : ''; - break; - - case 'callback': - if (is_string($argument) && function_exists($argument)) { - $tokens[$token] = $argument($elements); - } - if (is_array($argument) && function_exists($argument[0])) { - $function = array_shift($argument); - $argument = array_merge(array(&$elements), $argument); - $tokens[$token] = call_user_func_array($function, $argument); - } - break; - } - } - $children = strtr($children, $tokens); - } - return $children; -} - -/** - * Implements hook_process(). - * - * Add and remove CSS classes from the variables array. We use process so that - * we alter anything added in the preprocess hooks. - */ -function ctools_process(&$variables, $hook) { - if (!isset($variables['classes'])) { - return; - } - - $classes = ctools_get_classes(); - - // Process the classses to add. - if (!empty($classes[$hook]['add'])) { - $add_classes = array_map('drupal_clean_css_identifier', $classes[$hook]['add']); - $variables['classes_array'] = array_unique(array_merge($variables['classes_array'], $add_classes)); - } - - // Process the classes to remove. - if (!empty($classes[$hook]['remove'])) { - $remove_classes = array_map('drupal_clean_css_identifier', $classes[$hook]['remove']); - $variables['classes_array'] = array_diff($variables['classes_array'], $remove_classes); - } - - // Since this runs after template_process(), we need to re-implode the - // classes array. - $variables['classes'] = implode(' ', $variables['classes_array']); -} - -// ----------------------------------------------------------------------- -// Menu callbacks that must be in the .module file. -/** - * Determine if the current user has access via a plugin. - * - * This function is meant to be embedded in the Drupal menu system, and - * therefore is in the .module file since sub files can't be loaded, and - * takes arguments a little bit more haphazardly than ctools_access(). - * - * @param $access - * An access control array which contains the following information: - * - 'logic': and or or. Whether all tests must pass or one must pass. - * - 'plugins': An array of access plugins. Each contains: - * - - 'name': The name of the plugin - * - - 'settings': The settings from the plugin UI. - * - - 'context': Which context to use. - * @param ... - * zero or more context arguments generated from argument plugins. These - * contexts must have an 'id' attached to them so that they can be - * properly associated. The argument plugin system should set this, but - * if the context is coming from elsewhere it will need to be set manually. - * - * @return - * TRUE if access is granted, false if otherwise. - */ - -function ctools_access_menu($access) { - $func_args = func_get_args(); - // Short circuit everything if there are no access tests. - if (empty($access['plugins'])) { - return TRUE; - } - - $contexts = array(); - foreach ($func_args as $arg) { - if (is_object($arg) && get_class($arg) == 'ctools_context') { - $contexts[$arg->id] = $arg; - } - } - - ctools_include('context'); - return ctools_access($access, $contexts); -} - -/** - * Determine if the current user has access via checks to multiple different - * permissions. - * - * This function is a thin wrapper around user_access that allows multiple - * permissions to be easily designated for use on, for example, a menu callback. - * - * @param ... - * An indexed array of zero or more permission strings to be checked by - * user_access(). - * - * @return bool - * Iff all checks pass will this function return TRUE. If an invalid argument - * is passed (e.g., not a string), this function errs on the safe said and - * returns FALSE. - */ -function ctools_access_multiperm() { - foreach (func_get_args() as $arg) { - if (!is_string($arg) || !user_access($arg)) { - return FALSE; - } - } - return TRUE; -} - -/** - * Check to see if the incoming menu item is js capable or not. - * - * This can be used as %ctools_js as part of a path in hook menu. CTools - * ajax functions will automatically change the phrase 'nojs' to 'ajax' - * when it attaches ajax to a link. This can be used to autodetect if - * that happened. - */ -function ctools_js_load($js) { - if ($js == 'ajax') { - return TRUE; - } - return 0; -} - -/** - * Provides the default value for %ctools_js. - * - * This allows drupal_valid_path() to work with %ctools_js. - */ -function ctools_js_to_arg($arg) { - return empty($arg) || $arg == '%' ? 'nojs' : $arg; -} - -/** - * Menu _load hook. - * - * This function will be called to load an object as a replacement for - * %ctools_export_ui in menu paths. - */ -function ctools_export_ui_load($item_name, $plugin_name) { - $return = &drupal_static(__FUNCTION__, FALSE); - - if (!$return) { - ctools_include('export-ui'); - $plugin = ctools_get_export_ui($plugin_name); - $handler = ctools_export_ui_get_handler($plugin); - - if ($handler) { - return $handler->load_item($item_name); - } - } - - return $return; -} - -// ----------------------------------------------------------------------- -// Caching callbacks on behalf of export-ui. -/** - * Menu access callback for various tasks of export-ui. - */ -function ctools_export_ui_task_access($plugin_name, $op, $item = NULL) { - ctools_include('export-ui'); - $plugin = ctools_get_export_ui($plugin_name); - $handler = ctools_export_ui_get_handler($plugin); - - if ($handler) { - return $handler->access($op, $item); - } - - // Deny access if the handler cannot be found. - return FALSE; -} - -/** - * Callback for access control ajax form on behalf of export ui. - * - * Returns the cached access config and contexts used. - * Note that this is assuming that access will be in $item->access -- if it - * is not, an export UI plugin will have to make its own callbacks. - */ -function ctools_export_ui_ctools_access_get($argument) { - ctools_include('export-ui'); - list($plugin_name, $key) = explode(':', $argument, 2); - - $plugin = ctools_get_export_ui($plugin_name); - $handler = ctools_export_ui_get_handler($plugin); - - if ($handler) { - ctools_include('context'); - $item = $handler->edit_cache_get($key); - if (!$item) { - $item = ctools_export_crud_load($handler->plugin['schema'], $key); - } - - $contexts = ctools_context_load_contexts($item); - return array($item->access, $contexts); - } -} - -/** - * Callback for access control ajax form on behalf of export ui. - * - * Returns the cached access config and contexts used. - * Note that this is assuming that access will be in $item->access -- if it - * is not, an export UI plugin will have to make its own callbacks. - */ -function ctools_export_ui_ctools_access_set($argument, $access) { - ctools_include('export-ui'); - list($plugin_name, $key) = explode(':', $argument, 2); - - $plugin = ctools_get_export_ui($plugin_name); - $handler = ctools_export_ui_get_handler($plugin); - - if ($handler) { - ctools_include('context'); - $item = $handler->edit_cache_get($key); - if (!$item) { - $item = ctools_export_crud_load($handler->plugin['schema'], $key); - } - $item->access = $access; - return $handler->edit_cache_set_key($item, $key); - } -} - -/** - * Implements hook_menu_local_tasks_alter(). - */ -function ctools_menu_local_tasks_alter(&$data, $router_item, $root_path) { - ctools_include('menu'); - _ctools_menu_add_dynamic_items($data, $router_item, $root_path); -} - -/** - * Implements hook_block_list_alter(). - * - * Used to potentially remove blocks. - * This exists in order to replicate Drupal 6's "no blocks" functionality. - */ -function ctools_block_list_alter(&$blocks) { - $check = drupal_static('ctools_set_no_blocks', TRUE); - if (!$check) { - foreach ($blocks as $block_id => $block) { - // @todo -- possibly we can set configuration for this so that users can - // specify which blocks will not get rendered. - if (strpos($block->region, 'sidebar') !== FALSE) { - unset($blocks[$block_id]); - } - } - } -} - -/** - * Implements hook_modules_enabled(). - * - * Clear caches for detecting new plugins. - */ -function ctools_modules_enabled($modules) { - ctools_include('plugins'); - ctools_get_plugins_reset(); - cache_clear_all('ctools_plugin_files:', 'cache', TRUE); -} - -/** - * Implements hook_modules_disabled(). - * - * Clear caches for removing disabled plugins. - */ -function ctools_modules_disabled($modules) { - ctools_include('plugins'); - ctools_get_plugins_reset(); - cache_clear_all('ctools_plugin_files:', 'cache', TRUE); -} - -/** - * Menu theme callback. - * - * This simply ensures that Panels ajax calls are rendered in the same - * theme as the original page to prevent .css file confusion. - * - * To use this, set this as the theme callback on AJAX related menu - * items. Since the ajax page state won't be sent during ajax requests, - * it should be safe to use even if ajax isn't invoked. - */ -function ctools_ajax_theme_callback() { - if (!empty($_POST['ajax_page_state']['theme'])) { - return $_POST['ajax_page_state']['theme']; - } -} - -/** - * Implements hook_ctools_entity_context_alter(). - */ -function ctools_ctools_entity_context_alter(&$plugin, &$entity, $plugin_id) { - ctools_include('context'); - switch ($plugin_id) { - case 'entity_id:taxonomy_term': - $plugin['no ui'] = TRUE; - break; - - case 'entity:user': - $plugin = ctools_get_context('user'); - unset($plugin['no ui']); - unset($plugin['no required context ui']); - break; - } - - // Apply restrictions on taxonomy term reverse relationships whose - // restrictions are in the settings on the field. - if (!empty($plugin['parent']) && - $plugin['parent'] == 'entity_from_field' && - !empty($plugin['reverse']) && - $plugin['to entity'] == 'taxonomy_term') { - $field = field_info_field($plugin['field name']); - if (isset($field['settings']['allowed_values'][0]['vocabulary'])) { - $plugin['required context']->restrictions = array('vocabulary' => array($field['settings']['allowed_values'][0]['vocabulary'])); - } - } -} - -/** - * Implements hook_field_create_field(). - */ -function ctools_field_create_field($field) { - ctools_flush_field_caches(); -} - -/** - * Implements hook_field_create_instance(). - */ -function ctools_field_create_instance($instance) { - ctools_flush_field_caches(); -} - -/** - * Implements hook_field_delete_field(). - */ -function ctools_field_delete_field($field) { - ctools_flush_field_caches(); -} - -/** - * Implements hook_field_delete_instance(). - */ -function ctools_field_delete_instance($instance) { - ctools_flush_field_caches(); -} - -/** - * Implements hook_field_update_field(). - */ -function ctools_field_update_field($field, $prior_field, $has_data) { - ctools_flush_field_caches(); -} - -/** - * Implements hook_field_update_instance(). - */ -function ctools_field_update_instance($instance, $prior_instance) { - ctools_flush_field_caches(); -} - -/** - * Clear field related caches. - */ -function ctools_flush_field_caches() { - // Clear caches of 'Entity field' content type plugin. - cache_clear_all('ctools_entity_field_content_type_content_types', 'cache'); -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/ctools_access_ruleset.info b/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/ctools_access_ruleset.info deleted file mode 100644 index e8d3c1313..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/ctools_access_ruleset.info +++ /dev/null @@ -1,11 +0,0 @@ -name = Custom rulesets -description = Create custom, exportable, reusable access rulesets for applications like Panels. -core = 7.x -package = Chaos tool suite -dependencies[] = ctools:ctools - -; Information added by Drupal.org packaging script on 2023-01-31 -version = "7.x-1.21" -core = "7.x" -project = "ctools" -datestamp = "1675152418" diff --git a/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/ctools_access_ruleset.install b/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/ctools_access_ruleset.install deleted file mode 100644 index 70afb3c69..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/ctools_access_ruleset.install +++ /dev/null @@ -1,86 +0,0 @@ - 'Contains exportable customized access rulesets.', - 'export' => array( - 'identifier' => 'ruleset', - 'bulk export' => TRUE, - 'primary key' => 'rsid', - 'api' => array( - 'owner' => 'ctools_access_ruleset', - 'api' => 'ctools_rulesets', - 'minimum_version' => 1, - 'current_version' => 1, - ), - ), - 'fields' => array( - 'rsid' => array( - 'type' => 'serial', - 'description' => 'A database primary key to ensure uniqueness', - 'not null' => TRUE, - 'no export' => TRUE, - ), - 'name' => array( - 'type' => 'varchar', - 'length' => '255', - 'description' => 'Unique ID for this ruleset. Used to identify it programmatically.', - ), - 'admin_title' => array( - 'type' => 'varchar', - 'length' => '255', - 'description' => 'Administrative title for this ruleset.', - ), - 'admin_description' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'Administrative description for this ruleset.', - 'object default' => '', - ), - 'requiredcontexts' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'Any required contexts for this ruleset.', - 'serialize' => TRUE, - 'object default' => array(), - ), - 'contexts' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'Any embedded contexts for this ruleset.', - 'serialize' => TRUE, - 'object default' => array(), - ), - 'relationships' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'Any relationships for this ruleset.', - 'serialize' => TRUE, - 'object default' => array(), - ), - 'access' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'The actual group of access plugins for this ruleset.', - 'serialize' => TRUE, - 'object default' => array(), - ), - ), - 'primary key' => array('rsid'), - ); - - return $schema; -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/ctools_access_ruleset.module b/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/ctools_access_ruleset.module deleted file mode 100644 index 47a5d874d..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/ctools_access_ruleset.module +++ /dev/null @@ -1,85 +0,0 @@ - array( - 'title' => t('Administer access rulesets'), - 'description' => t('Add, delete and edit custom access rulesets.'), - ), - ); -} - -/** - * Implementation of hook_ctools_plugin_directory() to let the system know - * we implement task and task_handler plugins. - */ -function ctools_access_ruleset_ctools_plugin_directory($module, $plugin) { - // Most of this module is implemented as an export ui plugin, and the - // rest is in ctools/includes/ctools_access_ruleset.inc. - if ($module == 'ctools' && ($plugin == 'export_ui' || $plugin == 'access')) { - return 'plugins/' . $plugin; - } -} - -/** - * Implementation of hook_panels_dashboard_blocks(). - * - * Adds page information to the Panels dashboard. - */ -function ctools_access_ruleset_panels_dashboard_blocks(&$vars) { - $vars['links']['ctools_access_ruleset'] = array( - 'title' => l(t('Custom ruleset'), 'admin/structure/ctools-rulesets/add'), - 'description' => t('Custom rulesets are combinations of access plugins you can use for access control, selection criteria and pane visibility.'), - ); - - // Load all mini panels and their displays. - ctools_include('export'); - $items = ctools_export_crud_load_all('ctools_access_ruleset'); - $count = 0; - $rows = array(); - - foreach ($items as $item) { - $rows[] = array( - check_plain($item->admin_title), - array( - 'data' => l(t('Edit'), "admin/structure/ctools-rulesets/list/$item->name/edit"), - 'class' => 'links', - ), - ); - - // Only show 10. - if (++$count >= 10) { - break; - } - } - - if ($rows) { - $content = theme('table', array('rows' => $rows, 'attributes' => array('class' => 'panels-manage'))); - } - else { - $content = '

' . t('There are no custom rulesets.') . '

'; - } - - $vars['blocks']['ctools_access_ruleset'] = array( - 'title' => t('Manage custom rulesets'), - 'link' => l(t('Go to list'), 'admin/structure/ctools-rulesets'), - 'content' => $content, - 'class' => 'dashboard-ruleset', - 'section' => 'right', - ); -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/plugins/access/ruleset.inc b/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/plugins/access/ruleset.inc deleted file mode 100644 index 95f32c37f..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/plugins/access/ruleset.inc +++ /dev/null @@ -1,108 +0,0 @@ - '', - 'description' => '', - 'callback' => 'ctools_ruleset_ctools_access_check', - 'settings form' => 'ctools_ruleset_ctools_access_settings', - 'summary' => 'ctools_ruleset_ctools_access_summary', - - // This access plugin actually just contains child plugins that are - // exportable, UI configured rulesets. - 'get child' => 'ctools_ruleset_ctools_access_get_child', - 'get children' => 'ctools_ruleset_ctools_access_get_children', -); - -/** - * Merge the main access plugin with a loaded ruleset to form a child plugin. - */ -function ctools_ruleset_ctools_access_merge_plugin($plugin, $parent, $item) { - $plugin['name'] = $parent . ':' . $item->name; - $plugin['title'] = check_plain($item->admin_title); - $plugin['description'] = check_plain($item->admin_description); - - // TODO: Generalize this in CTools. - if (!empty($item->requiredcontexts)) { - $plugin['required context'] = array(); - foreach ($item->requiredcontexts as $context) { - $info = ctools_get_context($context['name']); - // TODO: allow an optional setting. - $plugin['required context'][] = new ctools_context_required($context['identifier'], $info['context name']); - } - } - - // Store the loaded ruleset in the plugin. - $plugin['ruleset'] = $item; - return $plugin; -} - -/** - * Get a single child access plugin. - */ -function ctools_ruleset_ctools_access_get_child($plugin, $parent, $child) { - ctools_include('export'); - $item = ctools_export_crud_load('ctools_access_ruleset', $child); - if ($item) { - return ctools_ruleset_ctools_access_merge_plugin($plugin, $parent, $item); - } -} - -/** - * Get all child access plugins. - */ -function ctools_ruleset_ctools_access_get_children($plugin, $parent) { - $plugins = array(); - ctools_include('export'); - $items = ctools_export_crud_load_all('ctools_access_ruleset'); - foreach ($items as $name => $item) { - $child = ctools_ruleset_ctools_access_merge_plugin($plugin, $parent, $item); - $plugins[$child['name']] = $child; - } - - return $plugins; -} - -/** - * Settings form for the 'by ruleset' access plugin. - */ -function ctools_ruleset_ctools_access_settings(&$form, &$form_state, $conf) { - if (!empty($form_state['plugin']['ruleset']->admin_description)) { - $form['markup'] = array( - '#markup' => '
' . check_plain($form_state['plugin']['ruleset']->admin_description) . '
', - ); - } - - return $form; -} - -/** - * Check for access. - */ -function ctools_ruleset_ctools_access_check($conf, $context, $plugin) { - // Load up any contexts we might be using. - $contexts = ctools_context_match_required_contexts($plugin['ruleset']->requiredcontexts, $context); - $contexts = ctools_context_load_contexts($plugin['ruleset'], FALSE, $contexts); - - return ctools_access($plugin['ruleset']->access, $contexts); -} - -/** - * Provide a summary description based upon the checked roles. - */ -function ctools_ruleset_ctools_access_summary($conf, $context, $plugin) { - if (!empty($plugin['ruleset']->admin_description)) { - return check_plain($plugin['ruleset']->admin_description); - } - else { - return check_plain($plugin['ruleset']->admin_title); - } -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc b/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc deleted file mode 100644 index 2589ac38f..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc +++ /dev/null @@ -1,32 +0,0 @@ - 'ctools_access_ruleset', - 'access' => 'administer ctools access ruleset', - - 'menu' => array( - 'menu item' => 'ctools-rulesets', - 'menu title' => 'Custom access rulesets', - 'menu description' => 'Add, edit or delete custom access rulesets for use with Panels and other systems that utilize CTools content plugins.', - ), - - 'title singular' => t('ruleset'), - 'title singular proper' => t('Ruleset'), - 'title plural' => t('rulesets'), - 'title plural proper' => t('Rulesets'), - - 'handler' => 'ctools_access_ruleset_ui', - - 'use wizard' => TRUE, - 'form info' => array( - 'order' => array( - 'basic' => t('Basic information'), - 'context' => t('Contexts'), - 'rules' => t('Rules'), - ), - ), -); diff --git a/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php b/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php deleted file mode 100644 index c9f8c20f6..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php +++ /dev/null @@ -1,54 +0,0 @@ - '
', - '#suffix' => '
', - ); - - $form['left'] = array( - '#prefix' => '
', - '#suffix' => '
', - ); - - // Set this up and we can use CTools' Export UI's built in wizard caching, - // which already has callbacks for the context cache under this name. - $module = 'export_ui::' . $this->plugin['name']; - $name = $this->edit_cache_get_key($form_state['item'], $form_state['form type']); - - ctools_context_add_context_form($module, $form, $form_state, $form['right']['contexts_table'], $form_state['item'], $name); - ctools_context_add_required_context_form($module, $form, $form_state, $form['left']['required_contexts_table'], $form_state['item'], $name); - ctools_context_add_relationship_form($module, $form, $form_state, $form['right']['relationships_table'], $form_state['item'], $name); - } - - public function edit_form_rules(&$form, &$form_state) { - // The 'access' UI passes everything via $form_state, unlike the 'context' UI. - // The main difference is that one is about 3 years newer than the other. - ctools_include('context'); - ctools_include('context-access-admin'); - - $form_state['access'] = $form_state['item']->access; - $form_state['contexts'] = ctools_context_load_contexts($form_state['item']); - - $form_state['module'] = 'ctools_export_ui'; - $form_state['callback argument'] = $form_state['object']->plugin['name'] . ':' . $form_state['object']->edit_cache_get_key($form_state['item'], $form_state['form type']); - $form_state['no buttons'] = TRUE; - - $form = ctools_access_admin_form($form, $form_state); - } - - public function edit_form_rules_submit(&$form, &$form_state) { - $form_state['item']->access['logic'] = $form_state['values']['logic']; - } - - public function edit_form_submit(&$form, &$form_state) { - parent::edit_form_submit($form, $form_state); - } - -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css b/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css deleted file mode 100644 index c312e9913..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css +++ /dev/null @@ -1,149 +0,0 @@ -div.ctools-sample-modal-content { - background: none; - border: 0; - color: #000; - margin: 0; - padding: 0; - text-align: left; -} -div.ctools-sample-modal-content .modal-scroll { - overflow: hidden; - overflow-y: auto; -} -div.ctools-sample-modal-content #popups-overlay { - background-color: transparent; -} -div.ctools-sample-modal-content #popups-loading { - width: 248px; - position: absolute; - display: none; - opacity: 1; - -moz-border-radius: 8px; - -webkit-border-radius: 8px; - z-index: 99; -} -div.ctools-sample-modal-content #popups-loading span.popups-loading-message { - background: #fff url(../images/loading-large.gif) no-repeat 8px center; - display: block; - color: #444; - font-family: Arial, serif; - font-size: 22px; - font-weight: bold; - height: 36px; - line-height: 36px; - padding: 0 40px; -} -div.ctools-sample-modal-content #popups-loading table, -div.ctools-sample-modal-content .popups-box table { - margin: 0; -} -div.ctools-sample-modal-content #popups-loading tbody, -div.ctools-sample-modal-content .popups-box tbody { - border: none; -} -div.ctools-sample-modal-content .popups-box tr { - background-color: transparent; -} -div.ctools-sample-modal-content td.popups-border { - background: url(../images/popups-border.png); - background-color: transparent; - border: none; -} -div.ctools-sample-modal-content td.popups-tl, -div.ctools-sample-modal-content td.popups-tr, -div.ctools-sample-modal-content td.popups-bl, -div.ctools-sample-modal-content td.popups-br { - background-repeat: no-repeat; - height: 10px; - padding: 0; -} -div.ctools-sample-modal-content td.popups-tl { - background-position: 0 0; -} -div.ctools-sample-modal-content td.popups-t, -div.ctools-sample-modal-content td.popups-b { - background-position: 0 -40px; - background-repeat: repeat-x; -} -div.ctools-sample-modal-content td.popups-tr { - background-position: 0 -10px; - width: 10px; -} -div.ctools-sample-modal-content td.popups-cl, -div.ctools-sample-modal-content td.popups-cr { - background-position: -10px 0; - background-repeat: repeat-y; - width: 10px; -} -div.ctools-sample-modal-content td.popups-cl, -div.ctools-sample-modal-content td.popups-cr, -div.ctools-sample-modal-content td.popups-c { - padding: 0; - border: none; -} -div.ctools-sample-modal-content td.popups-c { - background: #fff; -} -div.ctools-sample-modal-content td.popups-bl { - background-position: 0 -20px; -} -div.ctools-sample-modal-content td.popups-br { - background-position: 0 -30px; - width: 10px; -} - -div.ctools-sample-modal-content .popups-box, -div.ctools-sample-modal-content #popups-loading { - border: 0 solid #454545; - opacity: 1; - overflow: hidden; - padding: 0; - background-color: transparent; -} -div.ctools-sample-modal-content .popups-container { - overflow: hidden; - height: 100%; - background-color: #fff; -} -div.ctools-sample-modal-content div.popups-title { - -moz-border-radius-topleft: 0; - -webkit-border-radius-topleft: 0; - margin-bottom: 0; - background-color: #ff7200; - border: 1px solid #ce5c00; - padding: 4px 10px 5px; - color: white; - font-size: 1em; - font-weight: bold; -} -div.ctools-sample-modal-content .popups-body { - background-color: #fff; - padding: 8px; -} -div.ctools-sample-modal-content .popups-box .popups-buttons, -div.ctools-sample-modal-content .popups-box .popups-footer { - background-color: #fff; -} -div.ctools-sample-modal-content .popups-title a.close { - color: #fff; - text-decoration: none; -} -div.ctools-sample-modal-content .popups-close { - font-size: 120%; - float: right; - text-align: right; -} -div.ctools-sample-modal-content .modal-loading-wrapper { - width: 220px; - height: 19px; - margin: 0 auto; - margin-top: 2%; -} - -div.ctools-sample-modal-content tbody { - border: none; -} - -div.ctools-sample-modal-content .modal-content .modal-throbber-wrapper img { - margin-top: 100px; -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/ctools_ajax_sample.info b/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/ctools_ajax_sample.info deleted file mode 100644 index 742126552..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/ctools_ajax_sample.info +++ /dev/null @@ -1,11 +0,0 @@ -name = Chaos Tools (CTools) AJAX Example -description = Shows how to use the power of Chaos AJAX. -package = Chaos tool suite -dependencies[] = ctools:ctools -core = 7.x - -; Information added by Drupal.org packaging script on 2023-01-31 -version = "7.x-1.21" -core = "7.x" -project = "ctools" -datestamp = "1675152418" diff --git a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/ctools_ajax_sample.install b/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/ctools_ajax_sample.install deleted file mode 100644 index e0fdfc6f9..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/ctools_ajax_sample.install +++ /dev/null @@ -1,19 +0,0 @@ - 'Chaos Tools AJAX Demo', - 'page callback' => 'ctools_ajax_sample_page', - 'access callback' => TRUE, - 'type' => MENU_NORMAL_ITEM, - ); - $items['ctools_ajax_sample/simple_form'] = array( - 'title' => 'Simple Form', - 'page callback' => 'ctools_ajax_simple_form', - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, - ); - $items['ctools_ajax_sample/%ctools_js/hello'] = array( - 'title' => 'Hello World', - 'page callback' => 'ctools_ajax_sample_hello', - 'page arguments' => array(1), - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, - ); - $items['ctools_ajax_sample/%ctools_js/tablenix/%'] = array( - 'title' => 'Hello World', - 'page callback' => 'ctools_ajax_sample_tablenix', - 'page arguments' => array(1, 3), - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, - ); - $items['ctools_ajax_sample/%ctools_js/login'] = array( - 'title' => 'Login', - 'page callback' => 'ctools_ajax_sample_login', - 'page arguments' => array(1), - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, - ); - $items['ctools_ajax_sample/%ctools_js/animal'] = array( - 'title' => 'Animal', - 'page callback' => 'ctools_ajax_sample_animal', - 'page arguments' => array(1), - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, - ); - $items['ctools_ajax_sample/%ctools_js/login/%'] = array( - 'title' => 'Post-Login Action', - 'page callback' => 'ctools_ajax_sample_login_success', - 'page arguments' => array(1, 3), - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, - ); - $items['ctools_ajax_sample/jumped'] = array( - 'title' => 'Successful Jumping', - 'page callback' => 'ctools_ajax_sample_jump_menu_page', - 'access callback' => TRUE, - 'type' => MENU_NORMAL_ITEM, - ); - - return $items; -} - -function ctools_ajax_simple_form() { - ctools_include('content'); - ctools_include('context'); - $node = node_load(1); - $context = ctools_context_create('node', $node); - $context = array('context_node_1' => $context); - return ctools_content_render('node_comment_form', 'node_comment_form', ctools_ajax_simple_form_pane(), array(), array(), $context); -} - -function ctools_ajax_simple_form_pane() { - $configuration = array( - 'anon_links' => 0, - 'context' => 'context_node_1', - 'override_title' => 0, - 'override_title_text' => '', - ); - return $configuration; -} - -/** - * Implementation of hook_theme() - * - * Render some basic output for this module. - */ -function ctools_ajax_sample_theme() { - return array( - // Sample theme functions. - 'ctools_ajax_sample_container' => array( - 'arguments' => array('content' => NULL), - ), - ); -} - -// --------------------------------------------------------------------------- -// Page callbacks. -/** - * Page callback to display links and render a container for AJAX stuff. - */ - -function ctools_ajax_sample_page() { - global $user; - - // Include the CTools tools that we need. - ctools_include('ajax'); - ctools_include('modal'); - - // Add CTools' javascript to the page. - ctools_modal_add_js(); - - // Create our own javascript that will be used to theme a modal. - $sample_style = array( - 'ctools-sample-style' => array( - 'modalSize' => array( - 'type' => 'fixed', - 'width' => 500, - 'height' => 300, - 'addWidth' => 20, - 'addHeight' => 15, - ), - 'modalOptions' => array( - 'opacity' => .5, - 'background-color' => '#000', - ), - 'animation' => 'fadeIn', - 'modalTheme' => 'CToolsSampleModal', - 'throbber' => theme('image', array('path' => ctools_image_path('ajax-loader.gif', 'ctools_ajax_sample'), 'alt' => t('Loading...'), 'title' => t('Loading'))), - ), - ); - - drupal_add_js($sample_style, 'setting'); - - // Since we have our js, css and images in well-known named directories, - // CTools makes it easy for us to just use them without worrying about - // using drupal_get_path() and all that ugliness. - ctools_add_js('ctools-ajax-sample', 'ctools_ajax_sample'); - ctools_add_css('ctools-ajax-sample', 'ctools_ajax_sample'); - - // Create a list of clickable links. - $links = array(); - - // Only show login links to the anonymous user. - if ($user->uid == 0) { - $links[] = ctools_modal_text_button(t('Modal Login (default style)'), 'ctools_ajax_sample/nojs/login', t('Login via modal')); - - // The extra class points to the info in ctools-sample-style which we added - // to the settings, prefixed with 'ctools-modal'. - $links[] = ctools_modal_text_button(t('Modal Login (custom style)'), 'ctools_ajax_sample/nojs/login', t('Login via modal'), 'ctools-modal-ctools-sample-style'); - } - - // Four ways to do our animal picking wizard. - $button_form = ctools_ajax_sample_ajax_button_form(); - $links[] = l(t('Wizard (no modal)'), 'ctools_ajax_sample/nojs/animal'); - $links[] = ctools_modal_text_button(t('Wizard (default modal)'), 'ctools_ajax_sample/nojs/animal', t('Pick an animal')); - $links[] = ctools_modal_text_button(t('Wizard (custom modal)'), 'ctools_ajax_sample/nojs/animal', t('Pick an animal'), 'ctools-modal-ctools-sample-style'); - $links[] = drupal_render($button_form); - - $links[] = ctools_ajax_text_button(t('Hello world!'), "ctools_ajax_sample/nojs/hello", t('Replace text with "hello world"')); - - $output = theme('item_list', array('items' => $links, 'title' => t('Actions'))); - - // This container will have data AJAXed into it. - $output .= theme('ctools_ajax_sample_container', array('content' => '

' . t('Sample Content') . '

')); - - // Create a table that we can have data removed from via AJAX. - $header = array(t('Row'), t('Content'), t('Actions')); - $rows = array(); - for ($i = 1; $i < 11; $i++) { - $rows[] = array( - 'class' => array('ajax-sample-row-' . $i), - 'data' => array( - $i, - md5($i), - ctools_ajax_text_button("remove", "ctools_ajax_sample/nojs/tablenix/$i", t('Delete this row')), - ), - ); - } - - $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('class' => array('ajax-sample-table')))); - - // Show examples of ctools javascript widgets. - $output .= '

' . t('CTools Javascript Widgets') . '

'; - - // Create a drop down menu. - $links = array(); - $links[] = array('title' => t('Link 1'), 'href' => $_GET['q']); - $links[] = array('title' => t('Link 2'), 'href' => $_GET['q']); - $links[] = array('title' => t('Link 3'), 'href' => $_GET['q']); - - $output .= '

' . t('Drop Down Menu') . '

'; - $output .= theme('ctools_dropdown', array('title' => t('Click to Drop Down'), 'links' => $links)); - - // Create a collapsible div. - $handle = t('Click to Collapse'); - $content = 'Nulla ligula ante, aliquam at adipiscing egestas, varius vel arcu. Etiam laoreet elementum mi vel consequat. Etiam scelerisque lorem vel neque consequat quis bibendum libero congue. Nulla facilisi. Mauris a elit a leo feugiat porta. Phasellus placerat cursus est vitae elementum.'; - $output .= '

' . t('Collapsible Div') . '

'; - $output .= theme('ctools_collapsible', array('handle' => $handle, 'content' => $content, 'collapsed' => FALSE)); - - // Create a jump menu. - ctools_include('jump-menu'); - $form = drupal_get_form('ctools_ajax_sample_jump_menu_form'); - $output .= '

' . t('Jump Menu') . '

'; - $output .= drupal_render($form); - - return array('markup' => array('#markup' => $output)); -} - -/** - * Returns a "take it all over" hello world style request. - */ -function ctools_ajax_sample_hello($js = NULL) { - $output = '

' . t('Hello World') . '

'; - if ($js) { - ctools_include('ajax'); - $commands = array(); - $commands[] = ajax_command_html('#ctools-sample', $output); - // This function exits. - print ajax_render($commands); - exit; - } - else { - return $output; - } -} - -/** - * Nix a row from a table and restripe. - */ -function ctools_ajax_sample_tablenix($js, $row) { - if (!$js) { - // We don't support degrading this from js because we're not - // using the server to remember the state of the table. - return MENU_ACCESS_DENIED; - } - ctools_include('ajax'); - - $commands = array(); - $commands[] = ajax_command_remove("tr.ajax-sample-row-$row"); - $commands[] = ajax_command_restripe("table.ajax-sample-table"); - print ajax_render($commands); - exit; -} - -/** - * A modal login callback. - */ -function ctools_ajax_sample_login($js = NULL) { - // Fall back if $js is not set. - if (!$js) { - return drupal_get_form('user_login'); - } - - ctools_include('modal'); - ctools_include('ajax'); - $form_state = array( - 'title' => t('Login'), - 'ajax' => TRUE, - ); - $output = ctools_modal_form_wrapper('user_login', $form_state); - if (!empty($form_state['executed'])) { - // We'll just overwrite the form output if it was successful. - $output = array(); - $inplace = ctools_ajax_text_button(t('remain here'), 'ctools_ajax_sample/nojs/login/inplace', t('Go to your account')); - $account = ctools_ajax_text_button(t('your account'), 'ctools_ajax_sample/nojs/login/user', t('Go to your account')); - $output[] = ctools_modal_command_display(t('Login Success'), ''); - } - print ajax_render($output); - exit; -} - -/** - * Post-login processor: should we go to the user account or stay in place? - */ -function ctools_ajax_sample_login_success($js, $action) { - if (!$js) { - // We should never be here out of ajax context. - return MENU_NOT_FOUND; - } - - ctools_include('ajax'); - ctools_add_js('ajax-responder'); - $commands = array(); - if ($action == 'inplace') { - // Stay here. - $commands[] = ctools_ajax_command_reload(); - } - else { - // Bounce bounce. - $commands[] = ctools_ajax_command_redirect('user'); - } - print ajax_render($commands); - exit; -} - -/** - * A modal login callback. - */ -function ctools_ajax_sample_animal($js = NULL, $step = NULL) { - if ($js) { - ctools_include('modal'); - ctools_include('ajax'); - } - - $form_info = array( - 'id' => 'animals', - 'path' => "ctools_ajax_sample/" . ($js ? 'ajax' : 'nojs') . "/animal/%step", - 'show trail' => TRUE, - 'show back' => TRUE, - 'show cancel' => TRUE, - 'show return' => FALSE, - 'next callback' => 'ctools_ajax_sample_wizard_next', - 'finish callback' => 'ctools_ajax_sample_wizard_finish', - 'cancel callback' => 'ctools_ajax_sample_wizard_cancel', - // This controls order, as well as form labels. - 'order' => array( - 'start' => t('Choose animal'), - ), - // Here we map a step to a form id. - 'forms' => array( - // e.g. this for the step at wombat/create. - 'start' => array( - 'form id' => 'ctools_ajax_sample_start', - ), - ), - ); - - // We're not using any real storage here, so we're going to set our - // object_id to 1. When using wizard forms, id management turns - // out to be one of the hardest parts. Editing an object with an id - // is easy, but new objects don't usually have ids until somewhere - // in creation. - // - // We skip all this here by just using an id of 1. - $object_id = 1; - - if (empty($step)) { - // We reset the form when $step is NULL because that means they have - // for whatever reason started over. - ctools_ajax_sample_cache_clear($object_id); - $step = 'start'; - } - - // This automatically gets defaults if there wasn't anything saved. - $object = ctools_ajax_sample_cache_get($object_id); - - $animals = ctools_ajax_sample_animals(); - - // Make sure we can't somehow accidentally go to an invalid animal. - if (empty($animals[$object->type])) { - $object->type = 'unknown'; - } - - // Now that we have our object, dynamically add the animal's form. - if ($object->type == 'unknown') { - // If they haven't selected a type, add a form that doesn't exist yet. - $form_info['order']['unknown'] = t('Configure animal'); - $form_info['forms']['unknown'] = array('form id' => 'nothing'); - } - else { - // Add the selected animal to the order so that it shows up properly in the trail. - $form_info['order'][$object->type] = $animals[$object->type]['config title']; - } - - // Make sure all animals forms are represented so that the next stuff can - // work correctly: - foreach ($animals as $id => $animal) { - $form_info['forms'][$id] = array('form id' => $animals[$id]['form']); - } - - $form_state = array( - 'ajax' => $js, - // Put our object and ID into the form state cache so we can easily find - // it. - 'object_id' => $object_id, - 'object' => &$object, - ); - - // Send this all off to our form. This is like drupal_get_form only wizardy. - ctools_include('wizard'); - $form = ctools_wizard_multistep_form($form_info, $step, $form_state); - $output = drupal_render($form); - - if ($output === FALSE || !empty($form_state['complete'])) { - // This creates a string based upon the animal and its setting using - // function indirection. - $animal = $animals[$object->type]['output']($object); - } - - // If $output is FALSE, there was no actual form. - if ($js) { - // If javascript is active, we have to use a render array. - $commands = array(); - if ($output === FALSE || !empty($form_state['complete'])) { - // Dismiss the modal. - $commands[] = ajax_command_html('#ctools-sample', $animal); - $commands[] = ctools_modal_command_dismiss(); - } - elseif (!empty($form_state['cancel'])) { - // If cancelling, return to the activity. - $commands[] = ctools_modal_command_dismiss(); - } - else { - $commands = ctools_modal_form_render($form_state, $output); - } - print ajax_render($commands); - exit; - } - else { - if ($output === FALSE || !empty($form_state['complete'])) { - return $animal; - } - elseif (!empty($form_state['cancel'])) { - drupal_goto('ctools_ajax_sample'); - } - else { - return $output; - } - } -} - -// --------------------------------------------------------------------------- -// Themes. -/** - * Theme function for main rendered output. - */ - -function theme_ctools_ajax_sample_container($vars) { - $output = '
'; - $output .= $vars['content']; - $output .= '
'; - - return $output; -} - -// --------------------------------------------------------------------------- -// Stuff needed for our little wizard. -/** - * Get a list of our animals and associated forms. - * - * What we're doing is making it easy to add more animals in just one place, - * which is often how it will work in the real world. If using CTools, what - * you would probably really have, here, is a set of plugins for each animal. - */ - -function ctools_ajax_sample_animals() { - return array( - 'sheep' => array( - 'title' => t('Sheep'), - 'config title' => t('Configure sheep'), - 'form' => 'ctools_ajax_sample_configure_sheep', - 'output' => 'ctools_ajax_sample_show_sheep', - ), - 'lizard' => array( - 'title' => t('Lizard'), - 'config title' => t('Configure lizard'), - 'form' => 'ctools_ajax_sample_configure_lizard', - 'output' => 'ctools_ajax_sample_show_lizard', - ), - 'raptor' => array( - 'title' => t('Raptor'), - 'config title' => t('Configure raptor'), - 'form' => 'ctools_ajax_sample_configure_raptor', - 'output' => 'ctools_ajax_sample_show_raptor', - ), - ); -} - -// --------------------------------------------------------------------------- -// Wizard caching helpers. -/** - * Store our little cache so that we can retain data from form to form. - */ - -function ctools_ajax_sample_cache_set($id, $object) { - ctools_include('object-cache'); - ctools_object_cache_set('ctools_ajax_sample', $id, $object); -} - -/** - * Get the current object from the cache, or default. - */ -function ctools_ajax_sample_cache_get($id) { - ctools_include('object-cache'); - $object = ctools_object_cache_get('ctools_ajax_sample', $id); - if (!$object) { - // Create a default object. - $object = new stdClass(); - $object->type = 'unknown'; - $object->name = ''; - } - - return $object; -} - -/** - * Clear the wizard cache. - */ -function ctools_ajax_sample_cache_clear($id) { - ctools_include('object-cache'); - ctools_object_cache_clear('ctools_ajax_sample', $id); -} - -// --------------------------------------------------------------------------- -// Wizard in-between helpers; what to do between or after forms. -/** - * Handle the 'next' click on the add/edit pane form wizard. - * - * All we need to do is store the updated pane in the cache. - */ - -function ctools_ajax_sample_wizard_next(&$form_state) { - ctools_ajax_sample_cache_set($form_state['object_id'], $form_state['object']); -} - -/** - * Handle the 'finish' click on the add/edit pane form wizard. - * - * All we need to do is set a flag so the return can handle adding - * the pane. - */ -function ctools_ajax_sample_wizard_finish(&$form_state) { - $form_state['complete'] = TRUE; -} - -/** - * Handle the 'cancel' click on the add/edit pane form wizard. - */ -function ctools_ajax_sample_wizard_cancel(&$form_state) { - $form_state['cancel'] = TRUE; -} - -// --------------------------------------------------------------------------- -// Wizard forms for our simple info collection wizard. -/** - * Wizard start form. Choose an animal. - */ - -function ctools_ajax_sample_start($form, &$form_state) { - $form_state['title'] = t('Choose animal'); - - $animals = ctools_ajax_sample_animals(); - foreach ($animals as $id => $animal) { - $options[$id] = $animal['title']; - } - - $form['type'] = array( - '#title' => t('Choose your animal'), - '#type' => 'radios', - '#options' => $options, - '#default_value' => $form_state['object']->type, - '#required' => TRUE, - ); - - return $form; -} - -/** - * They have selected a sheep. Set it. - */ -function ctools_ajax_sample_start_submit(&$form, &$form_state) { - $form_state['object']->type = $form_state['values']['type']; - // Override where to go next based on the animal selected. - $form_state['clicked_button']['#next'] = $form_state['values']['type']; -} - -/** - * Wizard form to configure your sheep. - */ -function ctools_ajax_sample_configure_sheep($form, &$form_state) { - $form_state['title'] = t('Configure sheep'); - - $form['name'] = array( - '#type' => 'textfield', - '#title' => t('Name your sheep'), - '#default_value' => $form_state['object']->name, - '#required' => TRUE, - ); - - $form['sheep'] = array( - '#title' => t('What kind of sheep'), - '#type' => 'radios', - '#options' => array( - t('Wensleydale') => t('Wensleydale'), - t('Merino') => t('Merino'), - t('Corriedale') => t('Coriedale'), - ), - '#default_value' => !empty($form_state['object']->sheep) ? $form_state['object']->sheep : '', - '#required' => TRUE, - ); - return $form; -} - -/** - * Submit the sheep and store the values from the form. - */ -function ctools_ajax_sample_configure_sheep_submit(&$form, &$form_state) { - $form_state['object']->name = $form_state['values']['name']; - $form_state['object']->sheep = $form_state['values']['sheep']; -} - -/** - * Provide some output for our sheep. - */ -function ctools_ajax_sample_show_sheep($object) { - return t('You have a @type sheep named "@name".', array( - '@type' => $object->sheep, - '@name' => $object->name, - )); -} - -/** - * Wizard form to configure your lizard. - */ -function ctools_ajax_sample_configure_lizard($form, &$form_state) { - $form_state['title'] = t('Configure lizard'); - - $form['name'] = array( - '#type' => 'textfield', - '#title' => t('Name your lizard'), - '#default_value' => $form_state['object']->name, - '#required' => TRUE, - ); - - $form['lizard'] = array( - '#title' => t('Venomous'), - '#type' => 'checkbox', - '#default_value' => !empty($form_state['object']->lizard), - ); - return $form; -} - -/** - * Submit the lizard and store the values from the form. - */ -function ctools_ajax_sample_configure_lizard_submit(&$form, &$form_state) { - $form_state['object']->name = $form_state['values']['name']; - $form_state['object']->lizard = $form_state['values']['lizard']; -} - -/** - * Provide some output for our raptor. - */ -function ctools_ajax_sample_show_lizard($object) { - return t('You have a @type lizard named "@name".', array( - '@type' => empty($object->lizard) ? t('non-venomous') : t('venomous'), - '@name' => $object->name, - )); -} - -/** - * Wizard form to configure your raptor. - */ -function ctools_ajax_sample_configure_raptor($form, &$form_state) { - $form_state['title'] = t('Configure raptor'); - - $form['name'] = array( - '#type' => 'textfield', - '#title' => t('Name your raptor'), - '#default_value' => $form_state['object']->name, - '#required' => TRUE, - ); - - $form['raptor'] = array( - '#title' => t('What kind of raptor'), - '#type' => 'radios', - '#options' => array( - t('Eagle') => t('Eagle'), - t('Hawk') => t('Hawk'), - t('Owl') => t('Owl'), - t('Buzzard') => t('Buzzard'), - ), - '#default_value' => !empty($form_state['object']->raptor) ? $form_state['object']->raptor : '', - '#required' => TRUE, - ); - - $form['domesticated'] = array( - '#title' => t('Domesticated'), - '#type' => 'checkbox', - '#default_value' => !empty($form_state['object']->domesticated), - ); - return $form; -} - -/** - * Submit the raptor and store the values from the form. - */ -function ctools_ajax_sample_configure_raptor_submit(&$form, &$form_state) { - $form_state['object']->name = $form_state['values']['name']; - $form_state['object']->raptor = $form_state['values']['raptor']; - $form_state['object']->domesticated = $form_state['values']['domesticated']; -} - -/** - * Provide some output for our raptor. - */ -function ctools_ajax_sample_show_raptor($object) { - return t('You have a @type @raptor named "@name".', array( - '@type' => empty($object->domesticated) ? t('wild') : t('domesticated'), - '@raptor' => $object->raptor, - '@name' => $object->name, - )); -} - -/** - * Helper function to provide a sample jump menu form. - */ -function ctools_ajax_sample_jump_menu_form() { - $url = url('ctools_ajax_sample/jumped'); - $form_state = array(); - $form = ctools_jump_menu(array(), $form_state, array($url => t('Jump!')), array()); - return $form; -} - -/** - * Provide a message to the user that the jump menu worked. - */ -function ctools_ajax_sample_jump_menu_page() { - $return_link = l(t('Return to the examples page.'), 'ctools_ajax_sample'); - $output = t('You successfully jumped! !return_link', array('!return_link' => $return_link)); - return $output; -} - -/** - * Provide a form for an example ajax modal button. - */ -function ctools_ajax_sample_ajax_button_form() { - $form = array(); - - $form['url'] = array( - '#type' => 'hidden', - // The name of the class is the #id of $form['ajax_button'] with "-url" - // suffix. - '#attributes' => array('class' => array('ctools-ajax-sample-button-url')), - '#value' => url('ctools_ajax_sample/nojs/animal'), - ); - - $form['ajax_button'] = array( - '#type' => 'button', - '#value' => 'Wizard (button modal)', - '#attributes' => array('class' => array('ctools-use-modal')), - '#id' => 'ctools-ajax-sample-button', - ); - - return $form; -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/images/ajax-loader.gif b/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/images/ajax-loader.gif deleted file mode 100644 index d84f65378..000000000 Binary files a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/images/ajax-loader.gif and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/images/loading-large.gif b/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/images/loading-large.gif deleted file mode 100644 index 1c72ebb55..000000000 Binary files a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/images/loading-large.gif and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/images/loading.gif b/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/images/loading.gif deleted file mode 100644 index dc21df183..000000000 Binary files a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/images/loading.gif and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/images/popups-border.png b/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/images/popups-border.png deleted file mode 100644 index ba939f899..000000000 Binary files a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/images/popups-border.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/js/ctools-ajax-sample.js b/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/js/ctools-ajax-sample.js deleted file mode 100644 index 0cbfc871a..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_ajax_sample/js/ctools-ajax-sample.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* Provide the HTML to create the modal dialog. -*/ -Drupal.theme.prototype.CToolsSampleModal = function () { - var html = ''; - - html += '
'; - html += '
'; - html += ' '; - html += ' '; - html += ' '; - html += ' '; - html += ' '; - html += ' '; - html += ' '; - html += ' '; - html += ' '; - html += ' '; - html += ' '; - html += ' '; - html += ' '; - html += ' '; - html += ' '; - html += ' '; - html += '
'; - html += '
'; - html += ' '; - html += ' '; - html += '
'; //Maybe someday add the option for some specific buttons. - html += ' '; //Maybe someday add some footer. - html += '
'; - html += '
'; - html += '
'; - html += '
'; - - return html; - -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_custom_content/ctools_custom_content.info b/html/sites/all/modules/contrib/ctools/ctools_custom_content/ctools_custom_content.info deleted file mode 100644 index 3289120b2..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_custom_content/ctools_custom_content.info +++ /dev/null @@ -1,11 +0,0 @@ -name = Custom content panes -description = Create custom, exportable, reusable content panes for applications like Panels. -core = 7.x -package = Chaos tool suite -dependencies[] = ctools:ctools - -; Information added by Drupal.org packaging script on 2023-01-31 -version = "7.x-1.21" -core = "7.x" -project = "ctools" -datestamp = "1675152418" diff --git a/html/sites/all/modules/contrib/ctools/ctools_custom_content/ctools_custom_content.install b/html/sites/all/modules/contrib/ctools/ctools_custom_content/ctools_custom_content.install deleted file mode 100644 index dcf87e734..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_custom_content/ctools_custom_content.install +++ /dev/null @@ -1,71 +0,0 @@ - 'Contains exportable customized content for this site.', - 'export' => array( - 'identifier' => 'content', - 'bulk export' => TRUE, - 'primary key' => 'cid', - 'api' => array( - 'owner' => 'ctools_custom_content', - 'api' => 'ctools_content', - 'minimum_version' => 1, - 'current_version' => 1, - ), - 'create callback' => 'ctools_content_type_new', - ), - 'fields' => array( - 'cid' => array( - 'type' => 'serial', - 'description' => 'A database primary key to ensure uniqueness', - 'not null' => TRUE, - 'no export' => TRUE, - ), - 'name' => array( - 'type' => 'varchar', - 'length' => '255', - 'description' => 'Unique ID for this content. Used to identify it programmatically.', - ), - 'admin_title' => array( - 'type' => 'varchar', - 'length' => '255', - 'description' => 'Administrative title for this content.', - ), - 'admin_description' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'Administrative description for this content.', - 'object default' => '', - ), - 'category' => array( - 'type' => 'varchar', - 'length' => '255', - 'description' => 'Administrative category for this content.', - ), - 'settings' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'Serialized settings for the actual content to be used', - 'serialize' => TRUE, - 'object default' => array(), - ), - ), - 'primary key' => array('cid'), - ); - - return $schema; -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_custom_content/ctools_custom_content.module b/html/sites/all/modules/contrib/ctools/ctools_custom_content/ctools_custom_content.module deleted file mode 100644 index 3060fa604..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_custom_content/ctools_custom_content.module +++ /dev/null @@ -1,118 +0,0 @@ - array( - 'title' => t('Administer custom content'), - 'description' => t('Add, edit and delete CTools custom stored custom content'), - ), - ); -} - -/** - * Implementation of hook_ctools_plugin_directory() to let the system know - * we implement task and task_handler plugins. - */ -function ctools_custom_content_ctools_plugin_directory($module, $plugin) { - // Most of this module is implemented as an export ui plugin, and the - // rest is in ctools/includes/ctools_custom_content.inc. - if ($module == 'ctools' && $plugin == 'export_ui') { - return 'plugins/' . $plugin; - } -} - -/** - * Implements hook_get_pane_links_alter(). - */ -function ctools_custom_content_get_pane_links_alter(&$links, $pane, $content_type) { - if ($pane->type == 'custom') { - if (!isset($pane->configuration['name'])) { - $name_of_pane = $pane->subtype; - } - else { - $name_of_pane = $pane->configuration['name']; - } - - $links['top']['edit_custom_content'] = array( - 'title' => t('Edit custom content pane'), - 'href' => url('admin/structure/ctools-content/list/' . $name_of_pane . '/edit', array('absolute' => TRUE)), - 'attributes' => array('target' => array('_blank')), - ); - } -} - -/** - * Create callback for creating a new CTools custom content type. - * - * This ensures we get proper defaults from the plugin for its settings. - */ -function ctools_content_type_new($set_defaults) { - $item = ctools_export_new_object('ctools_custom_content', $set_defaults); - ctools_include('content'); - $plugin = ctools_get_content_type('custom'); - $item->settings = ctools_content_get_defaults($plugin, array()); - return $item; -} - -/** - * Implementation of hook_panels_dashboard_blocks(). - * - * Adds page information to the Panels dashboard. - */ -function ctools_custom_content_panels_dashboard_blocks(&$vars) { - $vars['links']['ctools_custom_content'] = array( - 'title' => l(t('Custom content'), 'admin/structure/ctools-content/add'), - 'description' => t('Custom content panes are basic HTML you enter that can be reused in all of your panels.'), - ); - - // Load all mini panels and their displays. - ctools_include('export'); - $items = ctools_export_crud_load_all('ctools_custom_content'); - $count = 0; - $rows = array(); - - foreach ($items as $item) { - $rows[] = array( - check_plain($item->admin_title), - array( - 'data' => l(t('Edit'), "admin/structure/ctools-content/list/$item->name/edit"), - 'class' => 'links', - ), - ); - - // Only show 10. - if (++$count >= 10) { - break; - } - } - - if ($rows) { - $content = theme('table', array('rows' => $rows, 'attributes' => array('class' => 'panels-manage'))); - } - else { - $content = '

' . t('There are no custom content panes.') . '

'; - } - - $vars['blocks']['ctools_custom_content'] = array( - 'title' => t('Manage custom content'), - 'link' => l(t('Go to list'), 'admin/structure/ctools-content'), - 'content' => $content, - 'class' => 'dashboard-content', - 'section' => 'right', - ); -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc b/html/sites/all/modules/contrib/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc deleted file mode 100644 index c7933bcb3..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc +++ /dev/null @@ -1,23 +0,0 @@ - 'ctools_custom_content', - 'access' => 'administer custom content', - - 'menu' => array( - 'menu item' => 'ctools-content', - 'menu title' => 'Custom content panes', - 'menu description' => 'Add, edit or delete custom content panes.', - ), - - 'title singular' => t('content pane'), - 'title singular proper' => t('Content pane'), - 'title plural' => t('content panes'), - 'title plural proper' => t('Content panes'), - - 'handler' => 'ctools_custom_content_ui', -); diff --git a/html/sites/all/modules/contrib/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php b/html/sites/all/modules/contrib/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php deleted file mode 100644 index e56f7a7ec..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php +++ /dev/null @@ -1,150 +0,0 @@ -settings['body'])) { - $form_state['item']->settings['format'] = $form_state['item']->settings['body']['format']; - $form_state['item']->settings['body'] = $form_state['item']->settings['body']['value']; - } - parent::edit_form($form, $form_state); - - $form['category'] = array( - '#type' => 'textfield', - '#title' => t('Category'), - '#description' => t('What category this content should appear in. If left blank the category will be "Miscellaneous".'), - '#default_value' => $form_state['item']->category, - ); - - $form['title'] = array( - '#type' => 'textfield', - '#default_value' => $form_state['item']->settings['title'], - '#title' => t('Title'), - ); - - $form['title_heading'] = array( - '#title' => t('Title heading'), - '#type' => 'select', - '#default_value' => isset($form_state['item']->settings['title_heading']) ? $form_state['item']->settings['title_heading'] : 'h2', - '#options' => array( - 'h1' => t('h1'), - 'h2' => t('h2'), - 'h3' => t('h3'), - 'h4' => t('h4'), - 'h5' => t('h5'), - 'h6' => t('h6'), - 'div' => t('div'), - 'span' => t('span'), - ), - ); - - $form['body'] = array( - '#type' => 'text_format', - '#title' => t('Body'), - '#default_value' => $form_state['item']->settings['body'], - '#format' => $form_state['item']->settings['format'], - ); - - $form['substitute'] = array( - '#type' => 'checkbox', - '#title' => t('Use context keywords'), - '#description' => t('If checked, context keywords will be substituted in this content.'), - '#default_value' => !empty($form_state['item']->settings['substitute']), - ); - } - - public function edit_form_submit(&$form, &$form_state) { - parent::edit_form_submit($form, $form_state); - - // Since items in our settings are not in the schema, we have to do these manually: - $form_state['item']->settings['title'] = $form_state['values']['title']; - $form_state['item']->settings['title_heading'] = $form_state['values']['title_heading']; - $form_state['item']->settings['body'] = $form_state['values']['body']['value']; - $form_state['item']->settings['format'] = $form_state['values']['body']['format']; - $form_state['item']->settings['substitute'] = $form_state['values']['substitute']; - } - - public function list_form(&$form, &$form_state) { - parent::list_form($form, $form_state); - - $options = array('all' => t('- All -')); - foreach ($this->items as $item) { - $options[$item->category] = $item->category; - } - - $form['top row']['category'] = array( - '#type' => 'select', - '#title' => t('Category'), - '#options' => $options, - '#default_value' => 'all', - '#weight' => -10, - ); - } - - public function list_filter($form_state, $item) { - if ($form_state['values']['category'] != 'all' && $form_state['values']['category'] != $item->category) { - return TRUE; - } - - return parent::list_filter($form_state, $item); - } - - public function list_sort_options() { - return array( - 'disabled' => t('Enabled, title'), - 'title' => t('Title'), - 'name' => t('Name'), - 'category' => t('Category'), - 'storage' => t('Storage'), - ); - } - - public function list_build_row($item, &$form_state, $operations) { - // Set up sorting. - switch ($form_state['values']['order']) { - case 'disabled': - $this->sorts[$item->name] = empty($item->disabled) . $item->admin_title; - break; - - case 'title': - $this->sorts[$item->name] = $item->admin_title; - break; - - case 'name': - $this->sorts[$item->name] = $item->name; - break; - - case 'category': - $this->sorts[$item->name] = $item->category; - break; - - case 'storage': - $this->sorts[$item->name] = $item->type . $item->admin_title; - break; - } - - $ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline')))); - - $this->rows[$item->name] = array( - 'data' => array( - array('data' => check_plain($item->name), 'class' => array('ctools-export-ui-name')), - array('data' => check_plain($item->admin_title), 'class' => array('ctools-export-ui-title')), - array('data' => check_plain($item->category), 'class' => array('ctools-export-ui-category')), - array('data' => $ops, 'class' => array('ctools-export-ui-operations')), - ), - 'title' => check_plain($item->admin_description), - 'class' => array(!empty($item->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled'), - ); - } - - public function list_table_header() { - return array( - array('data' => t('Name'), 'class' => array('ctools-export-ui-name')), - array('data' => t('Title'), 'class' => array('ctools-export-ui-title')), - array('data' => t('Category'), 'class' => array('ctools-export-ui-category')), - array('data' => t('Operations'), 'class' => array('ctools-export-ui-operations')), - ); - } - -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/README.txt b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/README.txt deleted file mode 100644 index 2f9b0fffa..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/README.txt +++ /dev/null @@ -1,14 +0,0 @@ - -The CTools Plugin Example is an example for developers of how to CTools -access, argument, content type, context, and relationship plugins. - -There are a number of ways to profit from this: - -1. The code itself intends to be as simple and self-explanatory as possible. - Nothing fancy is attempted: It's just trying to use the plugin API to show - how it can be used. - -2. There is a sample panel. You can access it at /ctools_plugin_example/xxxx - to see how it works. - -3. There is Advanced Help at admin/advanced_help/ctools_plugin_example. diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.info b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.info deleted file mode 100644 index fab0684f0..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.info +++ /dev/null @@ -1,14 +0,0 @@ -name = Chaos Tools (CTools) Plugin Example -description = Shows how an external module can provide ctools plugins (for Panels, etc.). -core = 7.x -package = Chaos tool suite -dependencies[] = advanced_help:advanced_help -dependencies[] = ctools:ctools -dependencies[] = ctools:page_manager -dependencies[] = panels:panels - -; Information added by Drupal.org packaging script on 2023-01-31 -version = "7.x-1.21" -core = "7.x" -project = "ctools" -datestamp = "1675152418" diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.module b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.module deleted file mode 100644 index a9a6080b9..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.module +++ /dev/null @@ -1,94 +0,0 @@ - 'CTools plugin example', - 'description' => t("Demonstration code, advanced help, and a demo panel to show how to build ctools plugins."), - 'page callback' => 'ctools_plugin_example_explanation_page', - 'access arguments' => array('administer site configuration'), - 'type' => MENU_NORMAL_ITEM, - ); - - return $items; -} - -/** - * Implements hook_ctools_plugin_directory(). - * - * It simply tells panels where to find the .inc files that define various - * args, contexts, content_types. In this case the subdirectories of - * ctools_plugin_example/panels are used. - */ -function ctools_plugin_example_ctools_plugin_directory($module, $plugin) { - if ($module == 'ctools' && !empty($plugin)) { - return "plugins/$plugin"; - } -} - -/** - * Implement hook_ctools_plugin_api(). - * - * If you do this, CTools will pick up default panels pages in - * .pages_default.inc. - */ -function ctools_plugin_example_ctools_plugin_api($module, $api) { - // @todo -- this example should explain how to put it in a different file. - if ($module == 'panels_mini' && $api == 'panels_default') { - return array('version' => 1); - } - if ($module == 'page_manager' && $api == 'pages_default') { - return array('version' => 1); - } -} - -/** - * Just provide an explanation page for the admin section. - * - * @return unknown_type - */ -function ctools_plugin_example_explanation_page() { - $content = '

' . t("The CTools Plugin Example is simply a developer's demo of how to create plugins for CTools. It provides no useful functionality for an ordinary user.") . '

'; - - $content .= '

' . t( - 'There is a demo panel demonstrating much of the functionality provided at - CTools demo panel, and you can find documentation on the examples at - !ctools_plugin_example_help. - CTools itself provides documentation at !ctools_help. Mostly, though, the code itself is intended to be the teacher. - You can find it in %path.', - array( - '@demo_url' => url('ctools_plugin_example/xxxxx'), - '!ctools_plugin_example_help' => theme('advanced_help_topic', array('module' => 'ctools_plugin_example', 'topic' => 'Chaos-Tools--CTools--Plugin-Examples', 'type' => 'title')), - '!ctools_help' => theme('advanced_help_topic', array('module' => 'ctools', 'topic' => 'plugins', 'type' => 'title')), - '%path' => drupal_get_path('module', 'ctools_plugin_example'), - )) . '

'; - - return $content; -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc deleted file mode 100644 index ed3ffd776..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc +++ /dev/null @@ -1,449 +0,0 @@ -.pages_default.inc - * With this naming, no additional code needs to be provided. CTools will just find the file. - * The name of the hook is _default_page_manager_pages() - * - * This example provides two pages, but the returned array could - * have several pages. - * - * @return - * Array of pages, normally exported from Panels. - */ -function ctools_plugin_example_default_page_manager_pages() { - - // Begin exported panel. - $page = new stdClass(); - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ - $page->api_version = 1; - $page->name = 'ctools_plugin_example'; - $page->task = 'page'; - $page->admin_title = 'CTools plugin example'; - $page->admin_description = 'This panel provides no functionality to a working Drupal system. It\'s intended to display the various sample plugins provided by the CTools Plugin Example module. '; - $page->path = 'ctools_plugin_example/%sc'; - $page->access = array( - 'logic' => 'and', - ); - $page->menu = array( - 'type' => 'normal', - 'title' => 'CTools plugin example', - 'name' => 'navigation', - 'weight' => '0', - 'parent' => array( - 'type' => 'none', - 'title' => '', - 'name' => 'navigation', - 'weight' => '0', - ), - ); - $page->arguments = array( - 'sc' => array( - 'id' => 2, - 'identifier' => 'simplecontext-arg', - 'name' => 'simplecontext_arg', - 'settings' => array(), - ), - ); - $page->conf = array(); - $page->default_handlers = array(); - $handler = new stdClass(); - $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ - $handler->api_version = 1; - $handler->name = 'page_ctools_panel_context'; - $handler->task = 'page'; - $handler->subtask = 'ctools_plugin_example'; - $handler->handler = 'panel_context'; - $handler->weight = 0; - $handler->conf = array( - 'title' => 'Panel', - 'no_blocks' => FALSE, - 'css_id' => '', - 'css' => '', - 'contexts' => array( - '0' => array( - 'name' => 'simplecontext', - 'id' => 1, - 'identifier' => 'Configured simplecontext (not from argument)', - 'keyword' => 'configured_simplecontext', - 'context_settings' => array( - 'sample_simplecontext_setting' => 'default simplecontext setting', - ), - ), - ), - 'relationships' => array( - '0' => array( - 'context' => 'argument_simplecontext_arg_2', - 'name' => 'relcontext_from_simplecontext', - 'id' => 1, - 'identifier' => 'Relcontext from simplecontext (from relationship)', - 'keyword' => 'relcontext', - ), - ), - 'access' => array( - 'logic' => 'and', - ), - 'pipeline' => 'standard', - ); - $display = new panels_display(); - $display->layout = 'threecol_33_34_33_stacked'; - $display->layout_settings = array(); - $display->panel_settings = array( - 'style' => 'rounded_corners', - 'style_settings' => array( - 'default' => array( - 'corner_location' => 'pane', - ), - ), - ); - $display->cache = array(); - $display->title = 'CTools plugin example panel'; - $display->hide_title = FALSE; - $display->title_pane = 1; - $display->content = array(); - $display->panels = array(); - $pane = new stdClass(); - $pane->pid = 'new-1'; - $pane->panel = 'left'; - $pane->type = 'no_context_content_type'; - $pane->subtype = 'no_context_content_type'; - $pane->shown = TRUE; - $pane->access = array(); - $pane->configuration = array( - 'item1' => 'contents of config item 1', - 'item2' => 'contents of config item 2', - 'override_title' => 0, - 'override_title_text' => '', - ); - $pane->cache = array(); - $pane->style = array(); - $pane->css = array(); - $pane->extras = array(); - $pane->position = 0; - $display->content['new-1'] = $pane; - $display->panels['left'][0] = 'new-1'; - $pane = new stdClass(); - $pane->pid = 'new-2'; - $pane->panel = 'left'; - $pane->type = 'custom'; - $pane->subtype = 'custom'; - $pane->shown = TRUE; - $pane->access = array( - 'plugins' => array( - '0' => array( - 'name' => 'arg_length', - 'settings' => array( - 'greater_than' => '1', - 'arg_length' => '4', - ), - 'context' => 'argument_simplecontext_arg_2', - ), - ), - ); - $pane->configuration = array( - 'title' => 'Long Arg Visibility Block', - 'body' => 'This block will be here when the argument is longer than configured arg length. It uses the \'arg_length\' access plugin to test against the length of the argument used for Simplecontext.', - 'format' => 'filtered_html', - 'substitute' => 1, - ); - $pane->cache = array(); - $pane->style = array(); - $pane->css = array(); - $pane->extras = array(); - $pane->position = 1; - $display->content['new-2'] = $pane; - $display->panels['left'][1] = 'new-2'; - $pane = new stdClass(); - $pane->pid = 'new-3'; - $pane->panel = 'left'; - $pane->type = 'custom'; - $pane->subtype = 'custom'; - $pane->shown = TRUE; - $pane->access = array( - 'plugins' => array( - '0' => array( - 'name' => 'arg_length', - 'settings' => array( - 'greater_than' => '0', - 'arg_length' => '4', - ), - 'context' => 'argument_simplecontext_arg_2', - ), - ), - ); - $pane->configuration = array( - 'title' => 'Short Arg Visibility', - 'body' => 'This block appears when the simplecontext argument is less than the configured length.', - 'format' => 'filtered_html', - 'substitute' => 1, - ); - $pane->cache = array(); - $pane->style = array(); - $pane->css = array(); - $pane->extras = array(); - $pane->position = 2; - $display->content['new-3'] = $pane; - $display->panels['left'][2] = 'new-3'; - $pane = new stdClass(); - $pane->pid = 'new-4'; - $pane->panel = 'middle'; - $pane->type = 'simplecontext_content_type'; - $pane->subtype = 'simplecontext_content_type'; - $pane->shown = TRUE; - $pane->access = array(); - $pane->configuration = array( - 'buttons' => NULL, - '#validate' => NULL, - '#submit' => NULL, - '#action' => NULL, - 'context' => 'argument_simplecontext_arg_2', - 'aligner_start' => NULL, - 'override_title' => 1, - 'override_title_text' => 'Simplecontext (with an arg)', - 'aligner_stop' => NULL, - 'override_title_markup' => NULL, - 'config_item_1' => 'Config item 1 contents', - '#build_id' => NULL, - '#type' => NULL, - '#programmed' => NULL, - 'form_build_id' => 'form-19c4ae6cb54fad8f096da46e95694e5a', - '#token' => NULL, - 'form_token' => '17141d3531eaa7b609da78afa6f3b560', - 'form_id' => 'simplecontext_content_type_edit_form', - '#id' => NULL, - '#description' => NULL, - '#attributes' => NULL, - '#required' => NULL, - '#tree' => NULL, - '#parents' => NULL, - '#method' => NULL, - '#post' => NULL, - '#processed' => NULL, - '#defaults_loaded' => NULL, - ); - $pane->cache = array(); - $pane->style = array(); - $pane->css = array(); - $pane->extras = array(); - $pane->position = 0; - $display->content['new-4'] = $pane; - $display->panels['middle'][0] = 'new-4'; - $pane = new stdClass(); - $pane->pid = 'new-5'; - $pane->panel = 'middle'; - $pane->type = 'simplecontext_content_type'; - $pane->subtype = 'simplecontext_content_type'; - $pane->shown = TRUE; - $pane->access = array(); - $pane->configuration = array( - 'buttons' => NULL, - '#validate' => NULL, - '#submit' => NULL, - '#action' => NULL, - 'context' => 'context_simplecontext_1', - 'aligner_start' => NULL, - 'override_title' => 1, - 'override_title_text' => 'Configured simplecontext content type (not from arg)', - 'aligner_stop' => NULL, - 'override_title_markup' => NULL, - 'config_item_1' => '(configuration for simplecontext)', - '#build_id' => NULL, - '#type' => NULL, - '#programmed' => NULL, - 'form_build_id' => 'form-d016200490abd015dc5b8a7e366d76ea', - '#token' => NULL, - 'form_token' => '17141d3531eaa7b609da78afa6f3b560', - 'form_id' => 'simplecontext_content_type_edit_form', - '#id' => NULL, - '#description' => NULL, - '#attributes' => NULL, - '#required' => NULL, - '#tree' => NULL, - '#parents' => NULL, - '#method' => NULL, - '#post' => NULL, - '#processed' => NULL, - '#defaults_loaded' => NULL, - ); - $pane->cache = array(); - $pane->style = array(); - $pane->css = array(); - $pane->extras = array(); - $pane->position = 1; - $display->content['new-5'] = $pane; - $display->panels['middle'][1] = 'new-5'; - $pane = new stdClass(); - $pane->pid = 'new-6'; - $pane->panel = 'middle'; - $pane->type = 'custom'; - $pane->subtype = 'custom'; - $pane->shown = TRUE; - $pane->access = array(); - $pane->configuration = array( - 'admin_title' => 'Simplecontext keyword usage', - 'title' => 'Simplecontext keyword usage', - 'body' => 'Demonstrating context keyword usage: - item1 is %sc:item1 - item2 is %sc:item2 - description is %sc:description', - 'format' => 'filtered_html', - 'substitute' => 1, - ); - $pane->cache = array(); - $pane->style = array(); - $pane->css = array(); - $pane->extras = array(); - $pane->position = 2; - $display->content['new-6'] = $pane; - $display->panels['middle'][2] = 'new-6'; - $pane = new stdClass(); - $pane->pid = 'new-7'; - $pane->panel = 'right'; - $pane->type = 'relcontext_content_type'; - $pane->subtype = 'relcontext_content_type'; - $pane->shown = TRUE; - $pane->access = array(); - $pane->configuration = array( - 'buttons' => NULL, - '#validate' => NULL, - '#submit' => NULL, - '#action' => NULL, - 'context' => 'relationship_relcontext_from_simplecontext_1', - 'aligner_start' => NULL, - 'override_title' => 0, - 'override_title_text' => '', - 'aligner_stop' => NULL, - 'override_title_markup' => NULL, - 'config_item_1' => 'some stuff in this one', - '#build_id' => NULL, - '#type' => NULL, - '#programmed' => NULL, - 'form_build_id' => 'form-8485f84511bd06e51b4a48e998448054', - '#token' => NULL, - 'form_token' => '1c3356396374d51d7d2531a10fd25310', - 'form_id' => 'relcontext_edit_form', - '#id' => NULL, - '#description' => NULL, - '#attributes' => NULL, - '#required' => NULL, - '#tree' => NULL, - '#parents' => NULL, - '#method' => NULL, - '#post' => NULL, - '#processed' => NULL, - '#defaults_loaded' => NULL, - ); - $pane->cache = array(); - $pane->style = array(); - $pane->css = array(); - $pane->extras = array(); - $pane->position = 0; - $display->content['new-7'] = $pane; - $display->panels['right'][0] = 'new-7'; - $pane = new stdClass(); - $pane->pid = 'new-8'; - $pane->panel = 'top'; - $pane->type = 'custom'; - $pane->subtype = 'custom'; - $pane->shown = TRUE; - $pane->access = array(); - $pane->configuration = array( - 'title' => 'Demonstrating ctools plugins', - 'body' => 'The CTools Plugin Example module (and this panel page) are just here to demonstrate how to build CTools plugins. - - ', - 'format' => 'full_html', - 'substitute' => 1, - ); - $pane->cache = array(); - $pane->style = array(); - $pane->css = array(); - $pane->extras = array(); - $pane->position = 0; - $display->content['new-8'] = $pane; - $display->panels['top'][0] = 'new-8'; - $handler->conf['display'] = $display; - $page->default_handlers[$handler->name] = $handler; - - // End of exported panel. - $pages['ctools_plugin_example_demo_page'] = $page; - - // Begin exported panel. - $page = new stdClass(); - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ - $page->api_version = 1; - $page->name = 'ctools_plugin_example_base'; - $page->task = 'page'; - $page->admin_title = 'CTools Plugin Example base page'; - $page->admin_description = 'This panel is for when people hit /ctools_plugin_example without an argument. We can use it to tell people to move on.'; - $page->path = 'ctools_plugin_example'; - $page->access = array(); - $page->menu = array(); - $page->arguments = array(); - $page->conf = array(); - $page->default_handlers = array(); - $handler = new stdClass(); - $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ - $handler->api_version = 1; - $handler->name = 'page_ctools_plugin_example_base_panel_context'; - $handler->task = 'page'; - $handler->subtask = 'ctools_plugin_example_base'; - $handler->handler = 'panel_context'; - $handler->weight = 0; - $handler->conf = array( - 'title' => 'Panel', - 'no_blocks' => FALSE, - 'css_id' => '', - 'css' => '', - 'contexts' => array(), - 'relationships' => array(), - 'pipeline' => 'standard', - ); - $display = new panels_display(); - $display->layout = 'onecol'; - $display->layout_settings = array(); - $display->panel_settings = array(); - $display->cache = array(); - $display->title = ''; - $display->hide_title = FALSE; - $display->content = array(); - $display->panels = array(); - $pane = new stdClass(); - $pane->pid = 'new-1'; - $pane->panel = 'middle'; - $pane->type = 'custom'; - $pane->subtype = 'custom'; - $pane->shown = TRUE; - $pane->access = array(); - $pane->configuration = array( - 'title' => 'Use this page with an argument', - 'body' => 'This demo page works if you use an argument, like ctools_plugin_example/xxxxx.', - 'format' => 'filtered_html', - 'substitute' => NULL, - ); - $pane->cache = array(); - $pane->style = array(); - $pane->css = array(); - $pane->extras = array(); - $pane->position = 0; - $display->content['new-1'] = $pane; - $display->panels['middle'][0] = 'new-1'; - $handler->conf['display'] = $display; - $page->default_handlers[$handler->name] = $handler; - // End exported panel. - $pages['base_page'] = $page; - - return $pages; -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Access-Plugins--Determining-access-and-visibility.html b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Access-Plugins--Determining-access-and-visibility.html deleted file mode 100644 index 781260ed1..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Access-Plugins--Determining-access-and-visibility.html +++ /dev/null @@ -1,17 +0,0 @@ -
- - - - -
-

We can use access plugins to determine access to a page or visibility of the panes in a page. Basically, we just determine access based on configuration settings and the various contexts that are available to us.

-

The arbitrary example in plugins/access/arg_length.inc determines access based on the length of the simplecontext argument. You can configure whether access should be granted if the simplecontext argument is greater or less than some number.

-
- -
-
-
- -
- -
diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Argument-Plugins--Starting-at-the-beginning.html b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Argument-Plugins--Starting-at-the-beginning.html deleted file mode 100644 index 4dd569d71..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Argument-Plugins--Starting-at-the-beginning.html +++ /dev/null @@ -1,20 +0,0 @@ -
- - - - -
-

Contexts are fundamental to CTools, and they almost always start with an argument to a panels page, so we'll start there too.

-

We first need to process an argument.

-

We're going to work with a "Simplecontext" context type and argument, and then with a content type that displays it. So we'll start by with the Simplecontext argument plugin in plugins/arguments/simplecontext_arg.inc.

-

Note that the name of the file (simplecontext_arg.inc) is built from the machine name of our plugin (simplecontext_arg). And note also that the primary function that we use to provide our argument (ctools_plugin_example_simplecontext_arg_ctools_arguments()) is also built from the machine name. This magic is most of the naming magic that you have to know.

-

You can browse plugins/arguments/simplecontext_arg.inc and see the little that it does.

-
- -
-
-
- -
- -
diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Chaos-Tools--CTools--Plugin-Examples.html b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Chaos-Tools--CTools--Plugin-Examples.html deleted file mode 100644 index 7576c80bc..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Chaos-Tools--CTools--Plugin-Examples.html +++ /dev/null @@ -1,19 +0,0 @@ -
- - - - -
-

This demonstration module is intended for developers to look at and play with. CTools plugins are not terribly difficult to do, but it can be hard to sort through the various arguments and required functions. The idea here is that you should have a starting point for most anything you want to do. Just work through the example, and then start experimenting with changing it.

-

There are two parts to this demo:

-

First, there is a sample panel provided that uses all the various plugins. It's at ctools_example/12345. You can edit the panel and configure all the panes on it.

-

Second, the code is there for you to experiment with and change as you see fit. Sometimes starting with simple code and working with it can take you places that it's hard to go when you're looking at more complex examples.

-
- -
-
-
- -
- -
diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Content-Type-Plugins--Displaying-content-using-a-context.html b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Content-Type-Plugins--Displaying-content-using-a-context.html deleted file mode 100644 index 918a13cb8..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Content-Type-Plugins--Displaying-content-using-a-context.html +++ /dev/null @@ -1,17 +0,0 @@ -
- - - - -
-

Now we get to the heart of the matter: Building a content type plugin. A content type plugin uses the contexts available to it to display something. plugins/content_types/simplecontext_content_type.inc does this work for us.

-

Note that our content type also has an edit form which can be used to configure its behavior. This settings form is accessed through the panels interface, and it's up to you what the settings mean to the code and the generation of content in the display rendering.

-
- -
-
-
- -
- -
diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Context-plugins--Creating-a--context--from-an-argument.html b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Context-plugins--Creating-a--context--from-an-argument.html deleted file mode 100644 index e8efbb390..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Context-plugins--Creating-a--context--from-an-argument.html +++ /dev/null @@ -1,21 +0,0 @@ -
- - - - -
-

Now that we have a plugin for a simplecontext argument, we can create a plugin for a simplecontext context.

-

Normally, a context would take an argument which is a key like a node ID (nid) and retrieve a more complex object from a database or whatever. In our example, we'll artificially transform the argument into an arbitrary "context" data object.

-

plugins/contexts/simplecontext.inc implements our context.

-

Note that there are actually two ways to create a context. The normal one, which we've been referring to, is to create a context from an argument. However, it is also possible to configure a context in a panel using the panels interface. This is quite inflexible, but might be useful for configuring single page. However, it means that we have a settings form for exactly that purpose. Our context would have to know how to create itself from a settings form as well as from an argument. Simplecontext can do that.

-

A context plugin can also provide keywords that expose parts of its context using keywords like masterkeyword:dataitem. The node plugin for ctools has node:nid and node:title, for example. The simplecontext plugin here provides the simplest of keywords.

- -
- -
-
-
- -
- -
diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Module-setup-and-hooks.html b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Module-setup-and-hooks.html deleted file mode 100644 index f816917dd..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Module-setup-and-hooks.html +++ /dev/null @@ -1,20 +0,0 @@ -
- - - - -
-

Your module must provide a few things so that your plugins can be found.

-

First, you need to implement hook_ctools_plugin_directory(). Here we're telling CTools that our plugins will be found in the module's directory in the plugins/<plugintype> directory. Context plugins will be in ctools_plugin_example/plugins/contexts, Content-type plugins will be in ctools_plugin_example/plugins/content_types.

-

<?php
function ctools_plugin_example_ctools_plugin_directory($module, $plugin) {
  if (
$module == 'ctools' && !empty($plugin)) {
    return
"plugins/$plugin";
  }
}
?>

-

Second, if you module wants to provide default panels pages, you can implement hook_ctools_plugin_api(). CTools will then pick up your panels pages in the file named <modulename>.pages_default.inc.

-

<?php
function ctools_plugin_example_ctools_plugin_api($module, $api) {
  if (
$module == 'panels_mini' && $api == 'panels_default') {
    return array(
'version' => 1);
  }
  if (
$module == 'page_manager' && $api == 'pages_default') {
    return array(
'version' => 1);
  }
}
?>

-
- -
-
-
- -
- -
diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Relationships--Letting-one-context-take-us-to-another.html b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Relationships--Letting-one-context-take-us-to-another.html deleted file mode 100644 index 7691245ad..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/Relationships--Letting-one-context-take-us-to-another.html +++ /dev/null @@ -1,18 +0,0 @@ -
- - - - -
-

Often a single data type can lead us to other data types. For example, a node has a user (the author) and the user has data associated with it.

-

A relationship plugin allows this kind of data to be accessed.

-

An example relationship plugin is provided in plugins/relationships/relcontext_from_simplecontext.inc. It looks at a simplecontext (which we got from an argument) and builds an (artificial) "relcontext" from that.

-
- -
-
-
- -
- -
diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/ctools_plugin_example.help.ini b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/ctools_plugin_example.help.ini deleted file mode 100644 index 6fb3d4c08..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/help/ctools_plugin_example.help.ini +++ /dev/null @@ -1,42 +0,0 @@ -[Chaos-Tools--CTools--Plugin-Examples] -title = CTools Plugin Examples -file = Chaos-Tools--CTools--Plugin-Examples -weight = 0 -parent = - -[Module-setup-and-hooks] -title = Module setup and hooks -file = Module-setup-and-hooks -weight = -15 -parent = Chaos-Tools--CTools--Plugin-Examples - -[Argument-Plugins--Starting-at-the-beginning] -title = Argument Plugins: Starting at the beginning -file = Argument-Plugins--Starting-at-the-beginning -weight = -14 -parent = Chaos-Tools--CTools--Plugin-Examples - -[Context-plugins--Creating-a--context--from-an-argument] -title = Context plugins: Creating a context from an argument -file = Context-plugins--Creating-a--context--from-an-argument -weight = -13 -parent = Chaos-Tools--CTools--Plugin-Examples - -[Content-Type-Plugins--Displaying-content-using-a-context] -title = Content Type Plugins: Displaying content using a context -file = Content-Type-Plugins--Displaying-content-using-a-context -weight = -12 -parent = Chaos-Tools--CTools--Plugin-Examples - -[Access-Plugins--Determining-access-and-visibility] -title = Access Plugins: Determining access and visibility -file = Access-Plugins--Determining-access-and-visibility -weight = -11 -parent = Chaos-Tools--CTools--Plugin-Examples - -[Relationships--Letting-one-context-take-us-to-another] -title = Relationships: Letting one context take us to another -file = Relationships--Letting-one-context-take-us-to-another -weight = -10 -parent = Chaos-Tools--CTools--Plugin-Examples - diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/access/arg_length.inc b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/access/arg_length.inc deleted file mode 100644 index 3b5d86362..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/access/arg_length.inc +++ /dev/null @@ -1,66 +0,0 @@ - t("Arg length"), - 'description' => t('Control access by length of simplecontext argument.'), - 'callback' => 'ctools_plugin_example_arg_length_ctools_access_check', - 'settings form' => 'ctools_plugin_example_arg_length_ctools_access_settings', - 'summary' => 'ctools_plugin_example_arg_length_ctools_access_summary', - 'required context' => new ctools_context_required(t('Simplecontext'), 'simplecontext'), -); - -/** - * Settings form for the 'by role' access plugin. - */ -function ctools_plugin_example_arg_length_ctools_access_settings(&$form, &$form_state, $conf) { - $form['settings']['greater_than'] = array( - '#type' => 'radios', - '#title' => t('Grant access if simplecontext argument length is'), - '#options' => array(1 => t('Greater than'), 0 => t('Less than or equal to')), - '#default_value' => $conf['greater_than'], - ); - $form['settings']['arg_length'] = array( - '#type' => 'textfield', - '#title' => t('Length of simplecontext argument'), - '#size' => 3, - '#default_value' => $conf['arg_length'], - '#description' => t('Access/visibility will be granted based on arg length.'), - ); -} - -/** - * Check for access. - */ -function ctools_plugin_example_arg_length_ctools_access_check($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data)) { - return FALSE; - } - $compare = ($context->arg_length > $conf['arg_length']); - if (($compare && $conf['greater_than']) || (!$compare && !$conf['greater_than'])) { - return TRUE; - } - return FALSE; -} - -/** - * Provide a summary description based upon the checked roles. - */ -function ctools_plugin_example_arg_length_ctools_access_summary($conf, $context) { - return t('Simpletext argument must be !comp @length characters', - array( - '!comp' => $conf['greater_than'] ? 'greater than' : 'less than or equal to', - '@length' => $conf['arg_length'], - )); -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/access/example_role.inc b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/access/example_role.inc deleted file mode 100644 index 75721e8b8..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/access/example_role.inc +++ /dev/null @@ -1,75 +0,0 @@ - t("CTools example: role"), - 'description' => t('Control access by role.'), - 'callback' => 'ctools_plugin_example_example_role_ctools_access_check', - 'default' => array('rids' => array()), - 'settings form' => 'ctools_plugin_example_example_role_ctools_access_settings', - 'summary' => 'ctools_plugin_example_example_role_ctools_access_summary', - 'required context' => new ctools_context_required(t('User'), 'user'), -); - -/** - * Settings form for the 'by role' access plugin. - */ -function ctools_plugin_example_example_role_ctools_access_settings(&$form, &$form_state, $conf) { - $form['settings']['rids'] = array( - '#type' => 'checkboxes', - '#title' => t('Role'), - '#default_value' => $conf['rids'], - '#options' => ctools_get_roles(), - '#description' => t('Only the checked roles will be granted access.'), - ); -} - -/** - * Compress the roles allowed to the minimum. - */ -function ctools_plugin_example_example_role_ctools_access_settings_submit(&$form, &$form_state) { - $form_state['values']['settings']['rids'] = array_keys(array_filter($form_state['values']['settings']['rids'])); -} - -/** - * Check for access. - */ -function ctools_plugin_example_example_role_ctools_access_check($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data) || !isset($context->data->roles)) { - return FALSE; - } - - $roles = array_keys($context->data->roles); - $roles[] = $context->data->uid ? DRUPAL_AUTHENTICATED_RID : DRUPAL_ANONYMOUS_RID; - return (bool) array_intersect($conf['rids'], $roles); -} - -/** - * Provide a summary description based upon the checked roles. - */ -function ctools_plugin_example_example_role_ctools_access_summary($conf, $context) { - if (!isset($conf['rids'])) { - $conf['rids'] = array(); - } - $roles = ctools_get_roles(); - $names = array(); - foreach (array_filter($conf['rids']) as $rid) { - $names[] = check_plain($roles[$rid]); - } - if (empty($names)) { - return t('@identifier can have any role', array('@identifier' => $context->identifier)); - } - return format_plural(count($names), '@identifier must have role "@roles"', '@identifier can be one of "@roles"', array('@roles' => implode(', ', $names), '@identifier' => $context->identifier)); -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc deleted file mode 100644 index 7fb732c60..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc +++ /dev/null @@ -1,49 +0,0 @@ - t("Simplecontext arg"), - // Keyword to use for %substitution. - 'keyword' => 'simplecontext', - 'description' => t('Creates a "simplecontext" from the arg.'), - 'context' => 'simplecontext_arg_context', - // placeholder_form is used in panels preview, for example, so we can - // preview without getting the arg from a URL. - 'placeholder form' => array( - '#type' => 'textfield', - '#description' => t('Enter the simplecontext arg'), - ), -); - -/** - * Get the simplecontext context using the arg. In this case we're just going - * to manufacture the context from the data in the arg, but normally it would - * be an API call, db lookup, etc. - */ -function simplecontext_arg_context($arg = NULL, $conf = NULL, $empty = FALSE) { - // If $empty == TRUE it wants a generic, unfilled context. - if ($empty) { - return ctools_context_create_empty('simplecontext'); - } - // Do whatever error checking is required, returning FALSE if it fails the test - // Normally you'd check - // for a missing object, one you couldn't create, etc. - if (empty($arg)) { - return FALSE; - } - return ctools_context_create('simplecontext', $arg); -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/content_types/icon_example.png b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/content_types/icon_example.png deleted file mode 100644 index 58c6bee4f..000000000 Binary files a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/content_types/icon_example.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/content_types/no_context_content_type.inc b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/content_types/no_context_content_type.inc deleted file mode 100644 index 48ce0f5cc..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/content_types/no_context_content_type.inc +++ /dev/null @@ -1,114 +0,0 @@ - t('CTools example no context content type'), - 'description' => t('No context content type - requires and uses no context.'), - - // 'single' => TRUE means has no subtypes. - 'single' => TRUE, - // Constructor. - 'content_types' => array('no_context_content_type'), - // Name of a function which will render the block. - 'render callback' => 'no_context_content_type_render', - // The default context. - 'defaults' => array(), - - // This explicitly declares the config form. Without this line, the func would be - // ctools_plugin_example_no_context_content_type_edit_form. - 'edit form' => 'no_context_content_type_edit_form', - - // Icon goes in the directory with the content type. - 'icon' => 'icon_example.png', - 'category' => array(t('CTools Examples'), -9), - - // This example does not provide 'admin info', which would populate the - // panels builder page preview. -); - -/** - * Run-time rendering of the body of the block. - * - * @param $subtype - * @param $conf - * Configuration as done at admin time. - * @param $args - * @param $context - * Context - in this case we don't have any. - * - * @return - * An object with at least title and content members. - */ -function no_context_content_type_render($subtype, $conf, $args, $context) { - $block = new stdClass(); - - $ctools_help = theme('advanced_help_topic', array('module' => 'ctools', 'topic' => 'plugins', 'type' => 'title')); - $ctools_plugin_example_help = theme('advanced_help_topic', array('module' => 'ctools_plugin_example', 'topic' => 'Chaos-Tools--CTools--Plugin-Examples', 'type' => 'title')); - - // The title actually used in rendering. - $block->title = check_plain("No-context content type"); - $block->content = t(" -
Welcome to the CTools Plugin Example demonstration content type. - - This block is a content type which requires no context at all. It's like a custom block, - but not even that sophisticated. - - For more information on the example plugins, please see the advanced help for - - {$ctools_help} and {$ctools_plugin_example_help} -
- "); - if (!empty($conf)) { - $block->content .= '
The only information that can be displayed in this block comes from the code and its settings form:
'; - $block->content .= '
' . var_export($conf, TRUE) . '
'; - } - - return $block; - -} - -/** - * 'Edit form' callback for the content type. - * This example just returns a form; validation and submission are standard drupal - * Note that if we had not provided an entry for this in hook_content_types, - * this could have had the default name - * ctools_plugin_example_no_context_content_type_edit_form. - */ -function no_context_content_type_edit_form($form, &$form_state) { - $conf = $form_state['conf']; - $form['item1'] = array( - '#type' => 'textfield', - '#title' => t('Item1'), - '#size' => 50, - '#description' => t('The setting for item 1.'), - '#default_value' => !empty($conf['item1']) ? $conf['item1'] : '', - '#prefix' => '
', - '#suffix' => '
', - ); - $form['item2'] = array( - '#type' => 'textfield', - '#title' => t('Item2'), - '#size' => 50, - '#description' => t('The setting for item 2'), - '#default_value' => !empty($conf['item2']) ? $conf['item2'] : '', - '#prefix' => '
', - '#suffix' => '
', - ); - return $form; -} - -function no_context_content_type_edit_form_submit($form, &$form_state) { - foreach (array('item1', 'item2') as $key) { - $form_state['conf'][$key] = $form_state['values'][$key]; - } -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc deleted file mode 100644 index ced641171..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc +++ /dev/null @@ -1,100 +0,0 @@ - t('CTools example relcontext content type'), - 'admin info' => 'ctools_plugin_example_relcontext_content_type_admin_info', - 'content_types' => 'relcontext_content_type', - 'single' => TRUE, - 'render callback' => 'relcontext_content_type_render', - // Icon goes in the directory with the content type. Here, in plugins/content_types. - 'icon' => 'icon_example.png', - 'description' => t('Relcontext content type - works with relcontext context.'), - 'required context' => new ctools_context_required(t('Relcontext'), 'relcontext'), - 'category' => array(t('CTools Examples'), -9), - 'edit form' => 'relcontext_edit_form', - - // This example does not provide 'admin info', which would populate the - // panels builder page preview. -); - -/** - * Run-time rendering of the body of the block. - * - * @param $subtype - * @param $conf - * Configuration as done at admin time - * @param $args - * @param $context - * Context - in this case we don't have any - * - * @return - * An object with at least title and content members - */ -function relcontext_content_type_render($subtype, $conf, $args, $context) { - $data = $context->data; - $block = new stdClass(); - - // Don't forget to check this data if it's untrusted. - // The title actually used in rendering. - $block->title = "Relcontext content type"; - $block->content = t(" - This is a block of data created by the Relcontent content type. - Data in the block may be assembled from static text (like this) or from the - content type settings form (\$conf) for the content type, or from the context - that is passed in.
- In our case, the configuration form (\$conf) has just one field, 'config_item_1; - and it's configured with: - "); - if (!empty($conf)) { - $block->content .= '
' . var_export($conf['config_item_1'], TRUE) . '
'; - } - if (!empty($context)) { - $block->content .= '
The args ($args) were
' . - var_export($args, TRUE) . '
'; - } - $block->content .= '
And the relcontext context ($context->data->description) - (which was created from a - simplecontext context) was
' . - print_r($context->data->description, TRUE) . '
'; - return $block; -} - -/** - * 'Edit' callback for the content type. - * This example just returns a form. - */ -function relcontext_edit_form($form, &$form_state) { - $conf = $form_state['conf']; - - $form['config_item_1'] = array( - '#type' => 'textfield', - '#title' => t('Config Item 1 (relcontext)'), - '#size' => 50, - '#description' => t('Setting for relcontext.'), - '#default_value' => !empty($conf['config_item_1']) ? $conf['config_item_1'] : '', - '#prefix' => '
', - '#suffix' => '
', - ); - return $form; -} - -function relcontext_edit_form_submit($form, &$form_state) { - foreach (element_children($form) as $key) { - if (!empty($form_state['values'][$key])) { - $form_state['conf'][$key] = $form_state['values'][$key]; - } - } -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc deleted file mode 100644 index e34fa18e0..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc +++ /dev/null @@ -1,126 +0,0 @@ - t('Simplecontext content type'), - 'content_types' => 'simplecontext_content_type', - // 'single' means not to be subtyped. - 'single' => TRUE, - // Name of a function which will render the block. - 'render callback' => 'simplecontext_content_type_render', - - // Icon goes in the directory with the content type. - 'icon' => 'icon_example.png', - 'description' => t('Simplecontext content type - works with a simplecontext context.'), - 'required context' => new ctools_context_required(t('Simplecontext'), 'simplecontext'), - 'edit form' => 'simplecontext_content_type_edit_form', - 'admin title' => 'ctools_plugin_example_simplecontext_content_type_admin_title', - - // Presents a block which is used in the preview of the data. - // Pn Panels this is the preview pane shown on the panels building page. - 'admin info' => 'ctools_plugin_example_simplecontext_content_type_admin_info', - 'category' => array(t('CTools Examples'), -9), -); - -function ctools_plugin_example_simplecontext_content_type_admin_title($subtype, $conf, $context = NULL) { - $output = t('Simplecontext'); - if ($conf['override_title'] && !empty($conf['override_title_text'])) { - $output = filter_xss_admin($conf['override_title_text']); - } - return $output; -} - -/** - * Callback to provide administrative info (the preview in panels when building - * a panel). - * - * In this case we'll render the content with a dummy argument and - * a dummy context. - */ -function ctools_plugin_example_simplecontext_content_type_admin_info($subtype, $conf, $context = NULL) { - $context = new stdClass(); - $context->data = new stdClass(); - $context->data->description = t("no real context"); - $block = simplecontext_content_type_render($subtype, $conf, array("Example"), $context); - return $block; -} - -/** - * Run-time rendering of the body of the block (content type) - * - * @param $subtype - * @param $conf - * Configuration as done at admin time - * @param $args - * @param $context - * Context - in this case we don't have any - * - * @return - * An object with at least title and content members - */ -function simplecontext_content_type_render($subtype, $conf, $args, $context) { - $data = $context->data; - $block = new stdClass(); - - // Don't forget to check this data if it's untrusted. - // The title actually used in rendering. - $block->title = "Simplecontext content type"; - $block->content = t(" - This is a block of data created by the Simplecontext content type. - Data in the block may be assembled from static text (like this) or from the - content type settings form (\$conf) for the content type, or from the context - that is passed in.
- In our case, the configuration form (\$conf) has just one field, 'config_item_1; - and it's configured with: - "); - if (!empty($conf)) { - $block->content .= '
' . print_r(filter_xss_admin($conf['config_item_1']), TRUE) . '
'; - } - if (!empty($context)) { - $block->content .= '
The args ($args) were
' . - var_export($args, TRUE) . '
'; - } - $block->content .= '
And the simplecontext context ($context->data->description) was
' . - print_r($context->data->description, TRUE) . '
'; - return $block; -} - -/** - * 'Edit' callback for the content type. - * This example just returns a form. - */ -function simplecontext_content_type_edit_form($form, &$form_state) { - $conf = $form_state['conf']; - $form['config_item_1'] = array( - '#type' => 'textfield', - '#title' => t('Config Item 1 for simplecontext content type'), - '#size' => 50, - '#description' => t('The stuff for item 1.'), - '#default_value' => !empty($conf['config_item_1']) ? $conf['config_item_1'] : '', - '#prefix' => '
', - '#suffix' => '
', - ); - - return $form; -} - -function simplecontext_content_type_edit_form_submit($form, &$form_state) { - foreach (element_children($form) as $key) { - if (!empty($form_state['values'][$key])) { - $form_state['conf'][$key] = $form_state['values'][$key]; - } - } -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/contexts/relcontext.inc b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/contexts/relcontext.inc deleted file mode 100644 index 61e25db03..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/contexts/relcontext.inc +++ /dev/null @@ -1,82 +0,0 @@ - t("Relcontext"), - 'description' => t('A relcontext object.'), - // Function to create the relcontext. - 'context' => 'ctools_plugin_example_context_create_relcontext', - // Function that does the settings. - 'settings form' => 'relcontext_settings_form', - 'keyword' => 'relcontext', - 'context name' => 'relcontext', -); - -/** - * Create a context, either from manual configuration (form) or from an argument on the URL. - * - * @param $empty - * If true, just return an empty context. - * @param $data - * If from settings form, an array as from a form. If from argument, a string. - * @param $conf - * TRUE if the $data is coming from admin configuration, FALSE if it's from a URL arg. - * - * @return - * a Context object. - */ -function ctools_plugin_example_context_create_relcontext($empty, $data = NULL, $conf = FALSE) { - $context = new ctools_context('relcontext'); - $context->plugin = 'relcontext'; - if ($empty) { - return $context; - } - if ($conf) { - if (!empty($data)) { - $context->data = new stdClass(); - // For this simple item we'll just create our data by stripping non-alpha and - // adding 'sample_relcontext_setting' to it. - $context->data->description = 'relcontext_from__' . preg_replace('/[^a-z]/i', '', $data['sample_relcontext_setting']); - $context->data->description .= '_from_configuration_sample_simplecontext_setting'; - $context->title = t("Relcontext context from simplecontext"); - return $context; - } - } - else { - // $data is coming from an arg - it's just a string. - // This is used for keyword. - $context->title = "relcontext_" . $data->data->description; - $context->argument = $data->argument; - // Make up a bogus context. - $context->data = new stdClass(); - // For this simple item we'll just create our data by stripping non-alpha and - // prepend 'relcontext_' and adding '_created_from_from_simplecontext' to it. - $context->data->description = 'relcontext_' . preg_replace('/[^a-z]/i', '', $data->data->description); - $context->data->description .= '_created_from_simplecontext'; - return $context; - } -} - -function relcontext_settings_form($conf, $external = FALSE) { - $form = array(); - - $form['sample_relcontext_setting'] = array( - '#type' => 'textfield', - '#title' => t('Relcontext setting'), - '#size' => 50, - '#description' => t('Just an example setting.'), - '#default_value' => !empty($conf['sample_relcontext_setting']) ? $conf['sample_relcontext_setting'] : '', - '#prefix' => '
', - '#suffix' => '
', - ); - return $form; -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/contexts/simplecontext.inc b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/contexts/simplecontext.inc deleted file mode 100644 index 0ee4658d0..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/contexts/simplecontext.inc +++ /dev/null @@ -1,132 +0,0 @@ - t("Simplecontext"), - 'description' => t('A single "simplecontext" context, or data element.'), -// Func to create context. - 'context' => 'ctools_plugin_example_context_create_simplecontext', - 'context name' => 'simplecontext', - 'settings form' => 'simplecontext_settings_form', - 'keyword' => 'simplecontext', - - // Provides a list of items which are exposed as keywords. - 'convert list' => 'simplecontext_convert_list', - // Convert keywords into data. - 'convert' => 'simplecontext_convert', - - 'placeholder form' => array( - '#type' => 'textfield', - '#description' => t('Enter some data to represent this "simplecontext".'), - ), -); - -/** - * Create a context, either from manual configuration or from an argument on the URL. - * - * @param $empty - * If true, just return an empty context. - * @param $data - * If from settings form, an array as from a form. If from argument, a string. - * @param $conf - * TRUE if the $data is coming from admin configuration, FALSE if it's from a URL arg. - * - * @return - * a Context object/ - */ -function ctools_plugin_example_context_create_simplecontext($empty, $data = NULL, $conf = FALSE) { - $context = new ctools_context('simplecontext'); - $context->plugin = 'simplecontext'; - - if ($empty) { - return $context; - } - - if ($conf) { - if (!empty($data)) { - $context->data = new stdClass(); - // For this simple item we'll just create our data by stripping non-alpha and - // adding '_from_configuration_item_1' to it. - $context->data->item1 = t("Item1"); - $context->data->item2 = t("Item2"); - $context->data->description = preg_replace('/[^a-z]/i', '', $data['sample_simplecontext_setting']); - $context->data->description .= '_from_configuration_sample_simplecontext_setting'; - $context->title = t("Simplecontext context from config"); - return $context; - } - } - else { - // $data is coming from an arg - it's just a string. - // This is used for keyword. - $context->title = $data; - $context->argument = $data; - // Make up a bogus context. - $context->data = new stdClass(); - $context->data->item1 = t("Item1"); - $context->data->item2 = t("Item2"); - - // For this simple item we'll just create our data by stripping non-alpha and - // adding '_from_simplecontext_argument' to it. - $context->data->description = preg_replace('/[^a-z]/i', '', $data); - $context->data->description .= '_from_simplecontext_argument'; - $context->arg_length = strlen($context->argument); - return $context; - } -} - -function simplecontext_settings_form($conf, $external = FALSE) { - if (empty($conf)) { - $conf = array( - 'sample_simplecontext_setting' => 'default simplecontext setting', - ); - } - $form = array(); - $form['sample_simplecontext_setting'] = array( - '#type' => 'textfield', - '#title' => t('Setting for simplecontext'), - '#size' => 50, - '#description' => t('An example setting that could be used to configure a context'), - '#default_value' => $conf['sample_simplecontext_setting'], - '#prefix' => '
', - '#suffix' => '
', - ); - return $form; -} - -/** - * Provide a list of sub-keywords. - * - * This is used to provide keywords from the context for use in a content type, - * pane, etc. - */ -function simplecontext_convert_list() { - return array( - 'item1' => t('Item1'), - 'item2' => t('Item2'), - 'description' => t('Description'), - ); -} - -/** - * Convert a context into a string to be used as a keyword by content types, etc. - */ -function simplecontext_convert($context, $type) { - switch ($type) { - case 'item1': - return $context->data->item1; - - case 'item2': - return $context->data->item2; - - case 'description': - return $context->data->description; - } -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/panels.pages.inc b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/panels.pages.inc deleted file mode 100644 index 25422cfa6..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/panels.pages.inc +++ /dev/null @@ -1,213 +0,0 @@ -pid = 'new'; - $page->did = 'new'; - $page->name = 'ctools_plugin_example_demo_panel'; - $page->title = 'Panels Plugin Example Demo Panel'; - $page->access = array(); - $page->path = 'demo_panel'; - $page->load_flags = 1; - $page->css_id = ''; - $page->arguments = array( - 0 => - array( - 'name' => 'simplecontext_arg', - 'id' => 1, - 'default' => '404', - 'title' => '', - 'identifier' => 'Simplecontext arg', - 'keyword' => 'simplecontext', - ), - ); - $page->relationships = array( - 0 => - array( - 'context' => 'argument_simplecontext_arg_1', - 'name' => 'relcontext_from_simplecontext', - 'id' => 1, - 'identifier' => 'Relcontext from Simplecontext', - 'keyword' => 'relcontext', - ), - ); - $page->no_blocks = '0'; - $page->switcher_options = array(); - $page->menu = '0'; - $page->contexts = array(); - $display = new ctools_display(); - $display->did = 'new'; - $display->layout = 'threecol_33_34_33_stacked'; - $display->layout_settings = array(); - $display->panel_settings = array(); - $display->content = array(); - $display->panels = array(); - $pane = new stdClass(); - $pane->pid = 'new-1'; - $pane->panel = 'left'; - $pane->type = 'custom'; - $pane->shown = '1'; - $pane->subtype = 'custom'; - $pane->access = array(); - $pane->configuration = array( - 'style' => 'default', - 'override_title' => 0, - 'override_title_text' => '', - 'css_id' => '', - 'css_class' => '', - 'title' => '"No Context Item"', - 'body' => 'The "no context item" content type is here to demonstrate that you can create a content_type that does not require a context. This is probably the same as just creating a custom php block on the fly, and might serve the same purpose.', - 'format' => '1', - ); - $pane->cache = array(); - $display->content['new-1'] = $pane; - $display->panels['left'][0] = 'new-1'; - $pane = new stdClass(); - $pane->pid = 'new-2'; - $pane->panel = 'left'; - $pane->type = 'no_context_item'; - $pane->shown = '1'; - $pane->subtype = 'description'; - $pane->access = array(); - $pane->configuration = array( - 'style' => 'default', - 'override_title' => 0, - 'override_title_text' => '', - 'css_id' => '', - 'css_class' => '', - 'item1' => 'one', - 'item2' => 'two', - 'item3' => 'three', - ); - $pane->cache = array(); - $display->content['new-2'] = $pane; - $display->panels['left'][1] = 'new-2'; - $pane = new stdClass(); - $pane->pid = 'new-3'; - $pane->panel = 'middle'; - $pane->type = 'custom'; - $pane->shown = '1'; - $pane->subtype = 'custom'; - $pane->access = array(); - $pane->configuration = array( - 'style' => 'default', - 'override_title' => 0, - 'override_title_text' => '', - 'css_id' => '', - 'css_class' => '', - 'title' => 'Simplecontext', - 'body' => 'The "Simplecontext" content and content type demonstrate a very basic context and how to display it. - - Simplecontext includes configuration, so it can get info from the config. It can also get its information to run from a simplecontext context, generated either from an arg to the panels page or via explicitly adding a context to the page.', - 'format' => '1', - ); - $pane->cache = array(); - $display->content['new-3'] = $pane; - $display->panels['middle'][0] = 'new-3'; - $pane = new stdClass(); - $pane->pid = 'new-4'; - $pane->panel = 'middle'; - $pane->type = 'simplecontext_item'; - $pane->shown = '1'; - $pane->subtype = 'description'; - $pane->access = array( - 0 => '2', - 1 => '4', - ); - $pane->configuration = array( - 'context' => 'argument_simplecontext_arg_1', - 'style' => 'default', - 'override_title' => 0, - 'override_title_text' => '', - 'css_id' => '', - 'css_class' => '', - 'config_item_1' => 'simplecontext called from arg', - ); - $pane->cache = array(); - $display->content['new-4'] = $pane; - $display->panels['middle'][1] = 'new-4'; - $pane = new stdClass(); - $pane->pid = 'new-5'; - $pane->panel = 'right'; - $pane->type = 'custom'; - $pane->shown = '1'; - $pane->subtype = 'custom'; - $pane->access = array(); - $pane->configuration = array( - 'style' => 'default', - 'override_title' => 0, - 'override_title_text' => '', - 'css_id' => '', - 'css_class' => '', - 'title' => 'Relcontext', - 'body' => 'The relcontext content_type gets its data from a relcontext, which is an example of a relationship. This panel should be run with an argument like "/xxx", which allows the simplecontext to get its context, and then the relcontext is configured in this panel to get (create) its data from the simplecontext.', - 'format' => '1', - ); - $pane->cache = array(); - $display->content['new-5'] = $pane; - $display->panels['right'][0] = 'new-5'; - $pane = new stdClass(); - $pane->pid = 'new-6'; - $pane->panel = 'right'; - $pane->type = 'relcontext_item'; - $pane->shown = '1'; - $pane->subtype = 'description'; - $pane->access = array(); - $pane->configuration = array( - 'context' => 'relationship_relcontext_from_simplecontext_1', - 'style' => 'default', - 'override_title' => 0, - 'override_title_text' => '', - 'css_id' => '', - 'css_class' => '', - 'config_item_1' => 'default1', - ); - $pane->cache = array(); - $display->content['new-6'] = $pane; - $display->panels['right'][1] = 'new-6'; - $pane = new stdClass(); - $pane->pid = 'new-7'; - $pane->panel = 'top'; - $pane->type = 'custom_php'; - $pane->shown = '1'; - $pane->subtype = 'custom_php'; - $pane->access = array(); - $pane->configuration = array( - 'style' => 'default', - 'override_title' => 0, - 'override_title_text' => '', - 'css_id' => '', - 'css_class' => '', - 'title' => '', - 'body' => '$arg = arg(1); - $arg0 = arg(0); - if (!$arg) { - $block->content = <<This page is intended to run with an arg and you don\'t have one. -
- Without an arg, the page doesn\'t have any context. -
Please try something like "/$arg0/xxx" -END; - - $block->title = "This is intended to run with an argument"; - } else { - $block->content = "The arg for this page is \'$arg\'"; - }', - ); - $pane->cache = array(); - $display->content['new-7'] = $pane; - $display->panels['top'][0] = 'new-7'; - $page->display = $display; - $page->displays = array(); - $pages['ctools_plugin_example'] = $page; - - return $pages; -} diff --git a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc b/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc deleted file mode 100644 index 31d7b00b3..000000000 --- a/html/sites/all/modules/contrib/ctools/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc +++ /dev/null @@ -1,46 +0,0 @@ - t("Relcontext from simplecontext"), - 'keyword' => 'relcontext', - 'description' => t('Adds a relcontext from existing simplecontext.'), - 'required context' => new ctools_context_required(t('Simplecontext'), 'simplecontext'), - 'context' => 'ctools_relcontext_from_simplecontext_context', - 'settings form' => 'ctools_relcontext_from_simplecontext_settings_form', -); - -/** - * Return a new context based on an existing context. - */ -function ctools_relcontext_from_simplecontext_context($context, $conf) { - // If unset it wants a generic, unfilled context, which is just NULL. - if (empty($context->data)) { - return ctools_context_create_empty('relcontext', NULL); - } - - // You should do error-checking here. - // Create the new context from some element of the parent context. - // In this case, we'll pass in the whole context so it can be used to - // create the relcontext. - return ctools_context_create('relcontext', $context); -} - -/** - * Settings form for the relationship. - */ -function ctools_relcontext_from_simplecontext_settings_form($conf) { - // We won't configure it in this case. - return array(); -} diff --git a/html/sites/all/modules/contrib/ctools/drush/ctools.drush.inc b/html/sites/all/modules/contrib/ctools/drush/ctools.drush.inc deleted file mode 100644 index 34fd4d3a5..000000000 --- a/html/sites/all/modules/contrib/ctools/drush/ctools.drush.inc +++ /dev/null @@ -1,1036 +0,0 @@ - array('ctex'), - 'callback' => 'ctools_drush_export', - 'description' => 'Export multiple CTools exportable objects directly to code.', - 'arguments' => array( - 'module' => 'Name of your module.', - ), - 'options' => array( - 'subdir' => 'The name of the sub directory to create the module in. Defaults to ctools_export which will be placed into sites/all/modules.', - 'remove' => 'Remove existing files before writing, except the .module file.', - 'filter' => 'Filter the list of exportables by status. Available options are enabled, disabled, overridden, database, code and all. Defaults to enabled.', - 'tables' => 'Comma separated list of exportable table names to filter by.', - ), - 'examples' => array( - 'drush ctex export_module' => 'Export CTools exportables to a module called "export_module".', - 'drush ctex export_module --subdir=exports' => 'Same as above, but into the sites/all/modules/exports directory.', - 'drush ctex export_module --subdir=exports --remove' => 'Same as above, but automatically removing all files, except for the .module file.', - 'drush ctex --filter="views_view"' => 'Filter export selection to the views_view table only.', - ), - ); - - $items['ctools-export-info'] = array( - 'aliases' => array('ctei'), - 'callback' => 'ctools_drush_export_info', - 'description' => 'Show available CTools exportable objects.', - 'arguments' => array(), - 'options' => array( - 'format' => 'Display exportables info in a different format such as print_r, json, export. The default is to show in a tabular format.', - 'tables-only' => 'Only show list of exportable types/table names and not available objects.', - 'filter' => 'Filter the list of exportables by status. Available options are enabled, disabled, overridden, database, and code.', - 'module' => $module_text, - ), - 'examples' => array( - 'drush ctools-export-info' => 'View export info on all exportables.', - 'drush ctools-export-info views_view variable' => 'View export info for views_view and variable exportable types only.', - 'drush ctei --filter=enabled' => 'Show all enabled exportables.', - 'drush ctei views_view --filter=disabled' => 'Show all enabled exportables.', - 'drush ctei views_view --module=node' => 'Show all exportables provided by/on behalf of the node module.', - ), - ); - - $items['ctools-export-view'] = array( - 'aliases' => array('ctev'), - 'callback' => 'ctools_drush_export_op_command', - 'description' => 'View CTools exportable object code output.', - 'arguments' => array( - 'table name' => 'Base table of the exportable you want to view.', - 'machine names' => 'Space separated list of exportables you want to view.', - ), - 'options' => array( - 'indent' => 'The string to use for indentation when displaying the exportable export code. Defaults to \'\'.', - 'no-colour' => 'Remove any colour formatting from export string output. Ideal if you are sending the output of this command to a file.', - 'module' => $module_text, - 'all' => $all_text, - ), - 'examples' => array( - 'drush ctools-export-view views_view' => 'View all views exportable objects.', - 'drush ctools-export-view views_view archive' => 'View default views archive view.', - ), - ); - - $items['ctools-export-revert'] = array( - 'aliases' => array('cter'), - 'callback' => 'ctools_drush_export_op_command', - 'description' => 'Revert CTools exportables from changes overridden in the database.', - 'arguments' => array( - 'table name' => 'Base table of the exportable you want to revert.', - 'machine names' => 'Space separated list of exportables you want to revert.', - ), - 'options' => array( - 'module' => $module_text, - 'all' => $all_text, - ), - 'examples' => array( - 'drush ctools-export-revert views_view' => 'Revert all overridden views exportable objects.', - 'drush ctools-export-revert views_view archive' => 'Revert overridden default views archive view.', - 'drush ctools-export-revert --all' => 'Revert all exportables on the system.', - ), - ); - - $items['ctools-export-enable'] = array( - 'aliases' => array('ctee'), - 'callback' => 'ctools_drush_export_op_command', - 'description' => 'Enable CTools exportables.', - 'arguments' => array( - 'table name' => 'Base table of the exportable you want to enable.', - 'machine names' => 'Space separated list of exportables you want to enable.', - ), - 'options' => array( - 'module' => $module_text, - 'all' => $all_text, - ), - 'examples' => array( - 'drush ctools-export-enable views_view' => 'Enable all overridden views exportable objects.', - 'drush ctools-export-enable views_view archive' => 'Enable overridden default views archive view.', - ), - ); - - $items['ctools-export-disable'] = array( - 'aliases' => array('cted'), - 'callback' => 'ctools_drush_export_op_command', - 'description' => 'Disable CTools exportables.', - 'arguments' => array( - 'table name' => 'Base table of the exportable you want to disable.', - 'machine names' => 'Space separated list of exportables you want to disable.', - ), - 'options' => array( - 'module' => $module_text, - 'all' => $all_text, - ), - 'examples' => array( - 'drush ctools-export-disable views_view' => 'Disable all overridden views exportable objects.', - 'drush ctools-export-disable views_view archive' => 'Disable overridden default views archive view.', - ), - ); - - return $items; -} - -/** - * Implementation of hook_drush_help(). - */ -function ctools_drush_help($section) { - switch ($section) { - case 'meta:ctools:title': - return dt('CTools commands'); - - case 'meta:entity:summary': - return dt('CTools drush commands.'); - } -} - -/** - * Drush callback: export. - */ -function ctools_drush_export($module = 'foo') { - $error = FALSE; - if (preg_match('@[^a-z_]+@', $module)) { - $error = dt('The name of the module must contain only lowercase letters and underscores') . '.'; - drush_log($error, 'error'); - return; - } - - // Filter by tables. - $tables = _ctools_drush_explode_options('tables'); - - // Check status. - $filter = drush_get_option('filter', FALSE); - if (empty($filter)) { - drush_set_option('filter', 'enabled'); - } - - // Selection. - $options = array('all' => dt('Export everything'), 'select' => dt('Make selection')); - $selection = drush_choice($options, dt('Select to proceed')); - - if (!$selection) { - return; - } - - // Present the selection screens. - if ($selection == 'select') { - $selections = _ctools_drush_selection_screen($tables); - } - else { - $info = _ctools_drush_export_info($tables, TRUE); - $selections = $info['exportables']; - } - - // Subdirectory. - $dest_exists = FALSE; - $subdir = drush_get_option('subdir', 'ctools_export'); - $dest = 'sites/all/modules/' . $subdir . '/' . $module; - - // Overwriting files can be set with 'remove' argument. - $remove = drush_get_option('remove', FALSE); - - // Check if folder exists. - if (file_exists($dest)) { - $dest_exists = TRUE; - if ($remove) { - if (drush_confirm(dt('All files except for the .info and .module files in !module will be removed. You can choose later if you want to overwrite these files as well. Are you sure you want to proceed ?', array('!module' => $module)))) { - $remove = TRUE; - drush_log(dt('Files will be removed'), 'success'); - } - else { - drush_log(dt('Export aborted.'), 'success'); - return; - } - } - } - - // Remove files (except for the .module file) if the destination folder exists. - if ($remove && $dest_exists) { - _ctools_drush_file_delete($dest); - } - - // Create new dir if needed. - if (!$dest_exists) { - if (!file_exists('sites/all/modules/' . $subdir)) { - drush_mkdir('sites/all/modules/' . $subdir); - } - } - - // Create destination directory. - drush_mkdir($dest); - - // Load bulk export module. - module_load_include('module', 'bulk_export'); - - // Create options and call Bulk export function. - // We create an array, because maybe in the future we can pass in more - // options to the export function (pre-selected modules and/or exportables). - $options = array( - 'name' => $module, - 'selections' => $selections, - ); - $files = bulk_export_export(TRUE, $options); - - $alter = array( - 'module' => $module, - 'files' => $files, - ); - // Let other drush commands alter the files. - drush_command_invoke_all_ref('drush_ctex_files_alter', $alter); - $files = $alter['files']; - - // Start writing. - if (is_array($files)) { - foreach ($files as $base_file => $data) { - $filename = $dest . '/' . $base_file; - // Extra check for .module file. - if ($base_file == ($module . '.module' || $module . '.info') && file_exists($filename)) { - if (!drush_confirm(dt('Do you want to overwrite !module_file', array('!module_file' => $base_file)))) { - drush_log(dt('Writing of !filename skipped. This is the code that was supposed to be written:', array('!filename' => $filename)), 'success'); - drush_print('---------'); - drush_print(shellColours::getColouredOutput("\n$data", 'light_green')); - drush_print('---------'); - continue; - } - } - if (file_put_contents($filename, $data)) { - drush_log(dt('Succesfully written !filename', array('!filename' => $filename)), 'success'); - } - else { - drush_log(dt('Error writing !filename', array('!filename' => $filename)), 'error'); - } - } - } - else { - drush_log(dt('No files were found to be written.'), 'error'); - } -} - -/** - * Helper function to select the exportables. By default, all exportables - * will be selected, so it will be easier to deselect them. - * - * @param $tables - */ -function _ctools_drush_selection_screen(array $tables = array()) { - $selections = $build = array(); - $files = system_rebuild_module_data(); - - $selection_number = 0; - - $info = _ctools_drush_export_info($tables, TRUE); - $exportables = $info['exportables']; - $schemas = $info['schemas']; - - $export_tables = array(); - - foreach (array_keys($exportables) as $table) { - natcasesort($exportables[$table]); - $export_tables[$table] = $files[$schemas[$table]['module']]->info['name'] . ' (' . $table . ')'; - } - - foreach ($export_tables as $table => $table_title) { - if (!empty($exportables[$table])) { - $table_count = count($exportables[$table]); - $selection_number += $table_count; - foreach ($exportables[$table] as $key => $title) { - $build[$table]['title'] = $table_title; - $build[$table]['items'][$key] = $title; - $build[$table]['count'] = $table_count; - $selections[$table][$key] = $key; - } - } - } - - drush_print(dt('Number of exportables selected: !number', array('!number' => $selection_number))); - drush_print(dt('By default all exportables are selected. Select a table to deselect exportables. Select "cancel" to start writing the files.')); - - // Let's go into a loop. - $return = FALSE; - while (!$return) { - - // Present the tables choice. - $table_rows = array(); - foreach ($build as $table => $info) { - $table_rows[$table] = $info['title'] . ' (' . $info['count'] . ')'; - } - $table_choice = drush_choice($table_rows, dt('Select a table. Select cancel to start writing files.')); - - // Bail out. - if (!$table_choice) { - drush_log(dt('Selection mode done, starting to write the files.'), 'notice'); - $return = TRUE; - return $selections; - } - - // Present the exportables choice, using the drush_choice_multiple. - $max = count($build[$table_choice]['items']); - $exportable_rows = array(); - foreach ($build[$table_choice]['items'] as $key => $title) { - $exportable_rows[$key] = $title; - } - drush_print(dt('Exportables from !table', array('!table' => $build[$table_choice]['title']))); - $multi_select = drush_choice_multiple($exportable_rows, $selections[$table_choice], dt('Select exportables.'), '!value', '!value (selected)', 0, $max); - - // Update selections. - if (is_array($multi_select)) { - $build[$table_choice]['count'] = count($multi_select); - $selections[$table_choice] = array(); - foreach ($multi_select as $key) { - $selections[$table_choice][$key] = $key; - } - } - } -} - -/** - * Delete files in a directory, keeping the .module and .info files. - * - * @param $path - * Path to directory in which to remove files. - */ -function _ctools_drush_file_delete($path) { - if (is_dir($path)) { - $files = new DirectoryIterator($path); - foreach ($files as $fileInfo) { - if (!$fileInfo->isDot() && !in_array($fileInfo->getExtension(), array('module', 'info'))) { - unlink($fileInfo->getPathname()); - } - } - } -} - -/** - * Drush callback: Export info. - * - * @params $table_names - * Each argument will be taken as a CTools exportable table name. - */ -function ctools_drush_export_info() { - // Collect array of table names from args. - $table_names = func_get_args(); - - // Get format option to allow for alternative output. - $format = drush_get_option('format', FALSE); - $tables_only = drush_get_option('tables-only', FALSE); - $filter = drush_get_option('filter', FALSE); - $export_module = drush_get_option('module', FALSE); - - $load = (bool) $filter || $export_module; - - // Get info on these tables, or all tables if none specified. - $info = _ctools_drush_export_info($table_names, $load); - $schemas = $info['schemas']; - $exportables = $info['exportables']; - - if (empty($exportables)) { - drush_log(dt('There are no exportables available.'), 'warning'); - return; - } - - // Filter by export module. - if (is_string($export_module)) { - $exportables = _ctools_drush_export_module_filter($exportables, $export_module); - } - - if (empty($exportables)) { - drush_log(dt('There are no exportables matching this criteria.'), 'notice'); - return; - } - - $exportable_counts = _ctools_drush_count_exportables($exportables); - - // Only use array keys if --tables-only option is set. - if ($tables_only) { - $exportables = array_keys($exportables); - } - - // Use format from --format option if it's present, and send to drush_format. - if ($format) { - // Create array with all exportable info and counts in one. - $output = array( - 'exportables' => $exportables, - 'count' => $exportable_counts, - ); - drush_print(drush_format($output, NULL, $format)); - } - // Build a tabular output as default. - else { - $header = $tables_only ? array() : array(dt('Module'), dt('Base table'), dt('Exportables')); - $rows = array(); - foreach ($exportables as $table => $info) { - if (is_array($info)) { - $row = array( - $schemas[$table]['module'], - $table, - // Machine name is better for this? - shellColours::getColouredOutput(implode("\n", array_keys($info)), 'light_green') . "\n", - ); - $rows[] = $row; - } - else { - $rows[] = array($info); - } - } - if (!empty($rows)) { - drush_print("\n"); - array_unshift($rows, $header); - drush_print_table($rows, TRUE, array(20, 20)); - drush_print(dt('Total exportables found: !total', array('!total' => $exportable_counts['total']))); - foreach ($exportable_counts['exportables'] as $table_name => $count) { - drush_print(dt('!table_name (!count)', array('!table_name' => $table_name, '!count' => $count)), 2); - } - drush_print("\n"); - } - } -} - -/** - * Drush callback: Acts as the hub for all op commands to keep - * all arg handling etc in one place. - */ -function ctools_drush_export_op_command() { - $args = func_get_args(); - // Get all info for the current drush command. - $command = drush_get_command(); - $op = ''; - - switch ($command['command']) { - case 'ctools-export-view': - $op = 'view'; - break; - - case 'ctools-export-revert': - // Revert is same as deleting. As any objects in the db are deleted. - $op = 'delete'; - break; - - case 'ctools-export-enable': - $op = 'enable'; - break; - - case 'ctools-export-disable': - $op = 'disable'; - break; - } - - if (!$op) { - return; - } - - if (drush_get_option('all', FALSE)) { - $info = _ctools_drush_export_info(array(), TRUE); - $exportable_info = $info['exportables']; - - $all = drush_confirm(dt('Are you sure you would like to !op all exportables on the system?', - array('!op' => _ctools_drush_export_op_alias($op)))); - - if ($all && $exportable_info) { - foreach ($exportable_info as $table => $exportables) { - if (!empty($exportables)) { - ctools_drush_export_op($op, $table, $exportables); - } - } - } - } - else { - // Table name should always be first arg... - $table_name = array_shift($args); - // Any additional args are assumed to be exportable names. - $object_names = $args; - - // Return any exportables based on table name, object names, options. - $exportables = _ctools_drush_export_op_command_logic($op, $table_name, $object_names); - - if ($exportables) { - ctools_drush_export_op($op, $table_name, $exportables); - } - } -} - -/** - * Iterate through exportable object names, load them, and pass each - * object to the correct op function. - * - * @param $op - * @param $table_name - * @param $exportables - */ -function ctools_drush_export_op($op = '', $table_name = '', $exportables = NULL) { - $objects = ctools_export_crud_load_multiple($table_name, array_keys($exportables)); - - $function = '_ctools_drush_export_' . $op; - if (function_exists($function)) { - foreach ($objects as $object) { - $function($table_name, $object); - } - } - else { - drush_log(dt('CTools CRUD function !function doesn\'t exist.', - array('!function' => $function)), 'error'); - } -} - -/** - * Helper function to abstract logic for selecting exportable types/objects - * from individual commands as they will all share this same error - * handling/arguments for returning list of exportables. - * - * @param $table_name - * @param $object_names - * - * @return - * Array of exportable objects (filtered if necessary, by name etc..) or FALSE if not. - */ -function _ctools_drush_export_op_command_logic($op = '', $table_name = NULL, array $object_names = array()) { - if (!$table_name) { - drush_log(dt('Exportable table name empty. Use the --all command if you want to perform this operation on all tables.'), 'error'); - return FALSE; - } - - // Get export info based on table name. - $info = _ctools_drush_export_info(array($table_name), TRUE); - - if (!isset($info['exportables'][$table_name])) { - drush_log(dt('Exportable table name not found.'), 'error'); - return FALSE; - } - - $exportables = &$info['exportables']; - - if (empty($object_names)) { - $all = drush_confirm(dt('No object names entered. Would you like to try and !op all exportables of type !type', - array('!op' => _ctools_drush_export_op_alias($op), '!type' => $table_name))); - if (!$all) { - drush_log(dt('Command cancelled'), 'success'); - return FALSE; - } - } - else { - // Iterate through object names and check they exist in exportables array. - // Log error and unset them if they don't. - foreach ($object_names as $object_name) { - if (!isset($exportables[$table_name][$object_name])) { - drush_log(dt('Invalid exportable: !exportable', array('!exportable' => $object_name)), 'error'); - unset($object_names[$table_name][$object_name]); - } - } - // Iterate through exportables to get just a list of selected ones. - foreach (array_keys($exportables[$table_name]) as $exportable) { - if (!in_array($exportable, $object_names)) { - unset($exportables[$table_name][$exportable]); - } - } - } - - $export_module = drush_get_option('module', FALSE); - - if (is_string($export_module)) { - $exportables = _ctools_drush_export_module_filter($exportables, $export_module); - } - - return $exportables[$table_name]; -} - -/** - * Return array of CTools exportable info based on available tables returned from - * ctools_export_get_schemas(). - * - * @param $table_names - * Array of table names to return. - * @param $load - * (bool) should ctools exportable objects be loaded for each type. - * The default behaviour will load just a list of exportable names. - * - * @return - * Nested arrays of available exportables, keyed by table name. - */ -function _ctools_drush_export_info(array $table_names = array(), $load = FALSE) { - ctools_include('export'); - // Get available schemas that declare exports. - $schemas = ctools_export_get_schemas(TRUE); - $exportables = array(); - - if (!empty($schemas)) { - // Remove types we don't want, if any. - if (!empty($table_names)) { - foreach (array_keys($schemas) as $table_name) { - if (!in_array($table_name, $table_names)) { - unset($schemas[$table_name]); - } - } - } - // Load array of available exportables for each schema. - foreach ($schemas as $table_name => $schema) { - // Load all objects. - if ($load) { - $exportables[$table_name] = ctools_export_crud_load_all($table_name); - } - // Get a list of exportable names. - else { - if (!empty($schema['export']['list callback']) && function_exists($schema['export']['list callback'])) { - $exportables[$table_name] = $schema['export']['list callback'](); - } - else { - $exportables[$table_name] = ctools_export_default_list($table_name, $schema); - } - } - } - } - - if ($load) { - $filter = drush_get_option('filter', FALSE); - $exportables = _ctools_drush_filter_exportables($exportables, $filter); - } - - return array('exportables' => $exportables, 'schemas' => $schemas); -} - -/** - * View a single object. - * - * @param $table_name - * @param $object - */ -function _ctools_drush_export_view($table_name, $object) { - $indent = drush_get_option('indent', ''); - $no_colour = drush_get_option('no-colour', FALSE); - $export = ctools_export_crud_export($table_name, $object, $indent); - if ($no_colour) { - drush_print("\n$export"); - } - else { - drush_print(shellColours::getColouredOutput("\n$export", 'light_green')); - } -} - -/** - * Revert a single object. - * - * @param $table_name - * @param $object - */ -function _ctools_drush_export_delete($table_name, $object) { - $name = _ctools_drush_get_export_name($table_name, $object); - - if (_ctools_drush_object_is_overridden($object)) { - // Remove from db. - ctools_export_crud_delete($table_name, $object); - drush_log("Reverted object: $name", 'success'); - } - else { - drush_log("Nothing to revert for: $name", 'notice'); - } -} - -/** - * Enable a single object. - * - * @param $table_name - * @param $object - */ -function _ctools_drush_export_enable($table_name, $object) { - $name = _ctools_drush_get_export_name($table_name, $object); - - if (_ctools_drush_object_is_disabled($object)) { - - // Enable object. - ctools_export_crud_enable($table_name, $object); - drush_log("Enabled object: $name", 'success'); - } - else { - drush_log("$name is already Enabled", 'notice'); - } -} - -/** - * Disable a single object. - * - * @param $table_name - * @param $object - */ -function _ctools_drush_export_disable($table_name, $object) { - $name = _ctools_drush_get_export_name($table_name, $object); - - if (!_ctools_drush_object_is_disabled($object)) { - // Disable object. - ctools_export_crud_disable($table_name, $object); - drush_log("Disabled object: $name", 'success'); - } - else { - drush_log("$name is already disabled", 'notice'); - } -} - -/** - * Filter a nested array of exportables by export module. - * - * @param array $exportables - * Passed by reference. A nested array of exportables, keyed by table name. - * @param string $export_module - * The name of the export module providing the exportable. - */ -function _ctools_drush_export_module_filter($exportables, $export_module) { - $module_list = module_list(); - - if (!isset($module_list[$export_module])) { - drush_log(dt('Invalid export module: !export_module', array('!export_module' => $export_module)), 'error'); - } - - foreach ($exportables as $table => $objects) { - foreach ($objects as $key => $object) { - if (empty($object->export_module) || ($object->export_module !== $export_module)) { - unset($exportables[$table][$key]); - } - } - } - - return array_filter($exportables); -} - -/** - * Gets the key for an exportable type. - * - * @param $table_name - * The exportable table name. - * @param $object - * The exportable object. - * - * @return string - * The key defined in the export schema data. - */ -function _ctools_drush_get_export_name($table_name, $object) { - $info = _ctools_drush_export_info(array($table_name)); - $key = $info['schemas'][$table_name]['export']['key']; - return $object->{$key}; -} - -/** - * Determine if an object is disabled. - * - * @param $object - * Loaded CTools exportable object. - * - * @return TRUE or FALSE - */ -function _ctools_drush_object_is_disabled($object) { - return (isset($object->disabled) && ($object->disabled == TRUE)) ? TRUE : FALSE; -} - -/** - * Determine if an object is enabled. - * - * @see _ctools_drush_object_is_disabled() - */ -function _ctools_drush_object_is_enabled($object) { - return (empty($object->disabled)) ? TRUE : FALSE; -} - -/** - * Determine if an object is overridden. - */ -function _ctools_drush_object_is_overridden($object) { - $status = EXPORT_IN_CODE + EXPORT_IN_DATABASE; - return ($object->export_type == $status) ? TRUE : FALSE; -} - -/** - * Determine if an object is not overridden. - */ -function _ctools_drush_object_is_not_overridden($object) { - $status = EXPORT_IN_CODE + EXPORT_IN_DATABASE; - return ($object->export_type == $status) ? FALSE : TRUE; -} - -/** - * Determine if an object is only in the db. - */ -function _ctools_drush_object_is_db_only($object) { - return ($object->export_type == EXPORT_IN_DATABASE) ? TRUE : FALSE; -} - -/** - * Determine if an object is not in the db. - */ -function _ctools_drush_object_is_not_db_only($object) { - return ($object->export_type == EXPORT_IN_DATABASE) ? FALSE : TRUE; -} - -/** - * Determine if an object is a code only default. - */ -function _ctools_drush_object_is_code_only($object) { - return ($object->export_type == EXPORT_IN_CODE) ? TRUE : FALSE; -} - -/** - * Determine if an object is not a code only default. - */ -function _ctools_drush_object_is_not_code_only($object) { - return ($object->export_type == EXPORT_IN_CODE) ? FALSE : TRUE; -} - -/** - * Return an array of count information based on exportables array. - * - * @param $exportables - * Array of exportables to count. - * - * @return - * Array of count data containing the following: - * 'total' - A total count of all exportables. - * 'exportables' - An array of exportable counts per table. - */ -function _ctools_drush_count_exportables($exportables) { - $count = array('exportables' => array()); - - foreach ($exportables as $table => $objects) { - // Add the object count for each table. - $count['exportables'][$table] = count($objects); - } - - // Once all tables have been counted, total these up. - $count['total'] = array_sum($count['exportables']); - - return $count; -} - -/** - * Filters a collection of exportables based on filters. - * - * @param $exportables - * @param $filter - */ -function _ctools_drush_filter_exportables($exportables, $filter) { - $eval = FALSE; - - if (is_string($filter)) { - switch ($filter) { - // Show enabled exportables only. - case 'enabled': - $eval = '_ctools_drush_object_is_disabled'; - break; - - // Show disabled exportables only. - case 'disabled': - $eval = '_ctools_drush_object_is_enabled'; - break; - - // Show overridden exportables only. - case 'overridden': - $eval = '_ctools_drush_object_is_not_overridden'; - break; - - // Show database only exportables. - case 'database': - $eval = '_ctools_drush_object_is_not_db_only'; - break; - - // Show code only exportables. - case 'code': - $eval = '_ctools_drush_object_is_not_code_only'; - break; - - // Do nothing. - case 'all': - break; - - default: - drush_log(dt('Invalid filter option. Available options are: enabled, disabled, overridden, database, and code.'), 'error'); - return; - } - - if ($eval) { - foreach ($exportables as $table => $objects) { - foreach ($objects as $key => $object) { - if ($eval($object)) { - unset($exportables[$table][$key]); - } - } - } - } - } - - return array_filter($exportables); -} - -/** - * Return an alias for an op, that will be used to show as output. - * For now, this is mainly necessary for delete => revert alias. - * - * @param $op - * The op name. Such as 'enable', 'disable', or 'delete'. - * - * @return - * The matched alias value or the original $op passed in if not found. - */ -function _ctools_drush_export_op_alias($op) { - $aliases = array( - 'delete' => 'revert', - ); - - if (isset($aliases[$op])) { - return $aliases[$op]; - } - - return $op; -} - -/** - * Convert the drush options from a csv list into an array. - * - * @param $drush_option - * The drush option name to invoke. - * - * @return - * Exploded array of options. - */ -function _ctools_drush_explode_options($drush_option) { - $options = drush_get_option($drush_option, array()); - if (!empty($options)) { - $options = explode(',', $options); - return array_map('trim', $options); - } - - return $options; -} - -/** - * Class to deal with wrapping output strings with - * colour formatting for the shell. - */ -class shellColours { - - private static $foreground_colours = array( - 'black' => '0;30', - 'dark_gray' => '1;30', - 'blue' => '0;34', - 'light_blue' => '1;34', - 'green' => '0;32', - 'light_green' => '1;32', - 'cyan' => '0;36', - 'light_cyan' => '1;36', - 'red' => '0;31', - 'light_red' => '1;31', - 'purple' => '0;35', - 'light_purple' => '1;35', - 'brown' => '0;33', - 'yellow' => '1;33', - 'light_gray' => '0;37', - 'white' => '1;37', - ); - - private static $background_colours = array( - 'black' => '40', - 'red' => '41', - 'green' => '42', - 'yellow' => '43', - 'blue' => '44', - 'magenta' => '45', - 'cyan' => '46', - 'light_gray' => '47', - ); - - /** - * shellColours constructor. - */ - private function __construct() {} - - /** - * Returns coloured string. - */ - public static function getColouredOutput($string, $foreground_colour = NULL, $background_colour = NULL) { - $coloured_string = ""; - - // Check if given foreground colour found. - if ($foreground_colour) { - $coloured_string .= "\033[" . self::$foreground_colours[$foreground_colour] . "m"; - } - // Check if given background colour found. - if ($background_colour) { - $coloured_string .= "\033[" . self::$background_colours[$background_colour] . "m"; - } - - // Add string and end colouring. - $coloured_string .= $string . "\033[0m"; - - return $coloured_string; - } - - /** - * Returns all foreground colour names. - */ - public static function getForegroundColours() { - return array_keys(self::$foreground_colours); - } - - /** - * Returns all background colour names. - */ - public static function getBackgroundColours() { - return array_keys(self::$background_colours); - } - -} // shellColours diff --git a/html/sites/all/modules/contrib/ctools/help/about.html b/html/sites/all/modules/contrib/ctools/help/about.html deleted file mode 100644 index 30b64c2d3..000000000 --- a/html/sites/all/modules/contrib/ctools/help/about.html +++ /dev/null @@ -1,29 +0,0 @@ -

The Chaos Tool Suite is a series of tools for developers to make code that I've found to be very useful to Views and Panels more readily available. Certain methods of doing things, particularly with AJAX, exportable objects and a plugin system, are proving to be ideas that are useful outside of just Views and Panels. This module does not offer much directly to the end user, but instead, creates a library for other modules to use. If you are an end user and some module asked you to install the CTools suite, then this is far as you really need to go. If you're a developer and are interested in these tools, read on!

- -

Tools provided by CTools

- -
-
Plugins
-
The plugins tool allows a module to allow other modules (and themes!) to provide plugins which provide some kind of functionality or some kind of task. For example, in Panels there are several types of plugins: Content types (which are like blocks), layouts (which are page layouts) and styles (which can be used to style a panel). Each plugin is represented by a .inc file, and the functionality they offer can differ wildly.
- -
Context
-
Context is the idea that the objects that are used in page generation have more value than simply creating a single piece of output. Instead, contexts can be used to create multiple pieces of content that can all be put onto the page. Additionally, contexts can be used to derive other contexts via relationships, such as determining the node author and displaying data about the new context.
- -
AJAX Tools
-
AJAX (also known as AHAH) is a method of allowing the browser and the server to communicate without requiring a page refresh. It can be used to create complicated interactive forms, but it is somewhat difficult to integrate into Drupal's Form API. These tools make it easier to accomplish this goal. In addition, CTools provides a few other javascript helpers, such as a modal dialog, a collapsible div, a simple dropdown and dependent checkboxes.
- -
CSS scrubbing and caching
-
Drupal comes with a fantastic array of tools to ensure HTML is safe to output but does not contain any similar tools for CSS. CTools provides a small tool to sanitize CSS, so user-input CSS code can still be safely used. It also provides a method for caching CSS for better performance.
- -
Exportable objects
-
Views and Panels both use objects that can either be in code or in the database, and the objects can be exported into a piece of PHP code, so they can be moved from site to site or out of the database entirely. This library abstracts that functionality, so other modules can use this same concept for their data.
- -
Form tools
-
Drupal 6's FAPI really improved over Drupal 5, and made a lot of things possible. Still, it missed a few items that were needed to make form wizards and truly dynamic AJAX forms possible. CTools includes a replacement for drupal_get_form() that has a few more options and allows the caller to examine the $form_state once the form has completed.
- -
Form wizards
-
Finally! An easy way to have form wizards, which is any 'form' that is actually a string of forms that build up to a final conclusion. The form wizard supports a single entry point, the ability to choose whether or not the user can go forward/back/up on the form and easy callbacks to handle the difficult job of dealing with data in between forms.
- -
Temporary object cache
-
For normal forms, all of the data needed for an object is stored in the form so that the browser handles a lot of the work. For multi-step and ajax forms, however, this is impractical, and letting the browser store data can be insecure. The object cache provides a non-volatile location to store temporary data while the form is being worked on. This is much safer than the standard Drupal caching mechanism, which is volatile, meaning it can be cleared at any time and any system using it must be capable of recreating the data that was there. This system also allows for object locking, since any object which has an item in the cache from another person can be assumed to be 'locked for editing'.
-
diff --git a/html/sites/all/modules/contrib/ctools/help/ajax.html b/html/sites/all/modules/contrib/ctools/help/ajax.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/html/sites/all/modules/contrib/ctools/help/collapsible-div.html b/html/sites/all/modules/contrib/ctools/help/collapsible-div.html deleted file mode 100644 index b9b6d9c63..000000000 --- a/html/sites/all/modules/contrib/ctools/help/collapsible-div.html +++ /dev/null @@ -1 +0,0 @@ -

To be written.

diff --git a/html/sites/all/modules/contrib/ctools/help/context-access.html b/html/sites/all/modules/contrib/ctools/help/context-access.html deleted file mode 100644 index 95a8d7fbe..000000000 --- a/html/sites/all/modules/contrib/ctools/help/context-access.html +++ /dev/null @@ -1,12 +0,0 @@ -

Access plugins allow context based access control to pages.

-
    'title' => Title of the plugin
-    'description' => Description of the plugin
-    'callback' => callback to see if there is access is available. params: $conf, $contexts, $account
-    'required context' => zero or more required contexts for this access plugin
-    'default' => an array of defaults or a callback giving defaults
-    'settings form' => settings form. params: &$form, &$form_state, $conf
-    settings form validate
-    settings form submit
-
- -

Warning: your settings array will be stored in the meny system to reduce loads, so be trim.

\ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/help/context-arguments.html b/html/sites/all/modules/contrib/ctools/help/context-arguments.html deleted file mode 100644 index 5c479ae65..000000000 --- a/html/sites/all/modules/contrib/ctools/help/context-arguments.html +++ /dev/null @@ -1,14 +0,0 @@ -

Arguments create a context from external input, which is assumed to be a string as though it came from a URL element.

- -
'title' => title
-    'description' => Description
-    'keyword' => Default keyword for the context
-    'context' => Callback to create the context. Params: $arg = NULL, $conf = NULL, $empty = FALSE
-    'default' => either an array of default settings or a string which is a callback or null to not use.
-    'settings form' => params: $form, $form_state, $conf -- gets the whole form. Should put anything it wants to keep automatically in $form['settings']
-    'settings form validate' => params: $form, $form_state
-    'settings form submit' => params: $form, $form_state
-    'criteria form' => params: $form, &$form_state, $conf, $argument, $id -- gets the whole argument. It should only put form widgets in $form[$id]. $conf may not be properly initialized so always guard against this due to arguments being changed and handlers not being updated to match.
-    + submit + validate
-    'criteria select' => returns true if the selected criteria matches the context. params: $context, $conf
-
diff --git a/html/sites/all/modules/contrib/ctools/help/context-content.html b/html/sites/all/modules/contrib/ctools/help/context-content.html deleted file mode 100644 index c1c6a356d..000000000 --- a/html/sites/all/modules/contrib/ctools/help/context-content.html +++ /dev/null @@ -1,157 +0,0 @@ -

The CTools pluggable content system provides various pieces of content as discrete bits of data that can be added to other applications, such as Panels or Dashboard via the UI. Whatever the content is added to stores the configuration for that individual piece of content, and provides this to the content.

- -

Each content type plugin will be contained in a .inc file, with subsidiary files, if necessary, in or near the same directory. Each content type consists of some information and one or more subtypes, which all use the same renderer. Subtypes are considered to be instances of the type. For example, the 'views' content type would have each view in the system as a subtype. Many content types will have exactly one subtype.

- -

Because the content and forms can be provided via ajax, the plugin also provides a list of CSS and JavaScript information that should be available on whatever page the content or forms may be AJAXed onto.

- -

For the purposes of selecting content from the UI, each content subtype will have the following information:

- -
    -
  • A title
  • -
  • A short description
  • -
  • A category [Do we want to add hierarchy categories? Do we want category to be more than just a string?]
  • -
  • An icon [do we want multiple icons? This becomes a hefty requirement]
  • -
- -

Each piece of content provides one or more configuration forms, if necessary, and the system that includes the content will handle the data storage. These forms can be provided in sequence as wizards or as extra forms that can be accessed through advanced administration.

- -

The plugin for a content type should contain:

- -
-
title
-
For use on the content permissions screen.
-
content types
-
Either an array of content type definitions, or a callback that will return content type definitions. This callback will get the plugin definition as an argument.
- -
content type
-
[Optional] Provide a single content type definition. This is only necessary if content types might be intensive.
- -
render callback
-
The callback to render the content. Parameters: -
-
$subtype
-
The name of the subtype being rendered. NOT the loaded subtype data.
- -
$conf
-
The stored configuration for the content.
- -
$args
-
Any arguments passed.
- -
$context
-
An array of contexts requested by the required contexts and assigned by the configuration step.
- -
$incoming_content
-
Any 'incoming content' if this is a wrapper.
-
-
- -
admin title
-
A callback to provide the administrative title. If it is not a function, then it will be counted as a string to use as the admin title.
- -
admin info
-
A callback to provide administrative information about the content, to be displayed when manipulating the content. It should contain a summary of configuration.
- -
edit form
-
Either a single form ID or an array of forms *keyed* by form ID with the value to be used as the title of the form. %title me be used as a placeholder for the administrative title if necessary. - Example: -
array(
-  'ctools_example_content_form_second' => t('Configure first form'),
-  'ctools_example_content_form_first' => t('Configure second form'),
-),
-
-The first form will always have required configuration added to it. These forms are normal FAPI forms, but you do not need to provide buttons, these will be added by the form wizard. -
- -
add form
-
[Optional] If different from the edit forms, provide them here in the same manner. Also may be set to FALSE to not have an add form.
- -
css
-
A file or array of CSS files that are necessary for the content.
- -
js
-
A file or array of javascript files that are necessary for the content to be displayed.
- -
admin css
-
A file or array of CSS files that are necessary for the forms.
- -
admin js
-
A file or array of JavaScript files that are necessary for the forms.
- -
extra forms
-
An array of form information to handle extra administrative forms.
- -
no title override
-
Set to TRUE if the title cannot be overridden.
- -
single
-
Set to TRUE if this content provides exactly one subtype.
- -
render last
-
Set to true if for some reason this content needs to render after other content. This is primarily used for forms to ensure that render order is correct.
-
- -

TODO: many of the above callbacks can be assumed based upon patterns: modulename + '_' + name + '_' + function. i.e, render, admin_title, admin_info, etc.

- -

TODO: Some kind of simple access control to easily filter out content.

- -

The subtype definition should contain:

- -
-
title
-
The title of the subtype.
- -
icon
-
The icon to display for the subtype.
- -
path
-
The path for the icon if it is not in the same directory as the plugin.
- -
description
-
The short description of the subtype, to be used when selecting it in the UI.
- -
category
-
Either a text string for the category, or an array of the text string followed by the category weight.
- -
required context [Optional]
- -
Either a ctools_context_required or ctools_context_optional or array of contexts for this content. If omitted, no contexts are used.
- -
create content access [Optional]
- -
An optional callback to determine if a user can access this subtype. The callback will receive two arguments, the type and subtype.
-
- -

Rendered content

- -

Rendered content is a little more than just HTML.

- -
-
title
-
The safe to render title of the content.
- -
content
-
The safe to render HTML content.
- -
links
-
An array of links associated with the content suitable for theme('links').
- -
more
-
An optional 'more' link (destination only)
- -
admin_links
-
Administrative links associated with the content, suitable for theme('links').
- -
feeds
-
An array of feed icons or links associated with the content. Each member of the array is rendered HTML.
- -
type
-
The content type.
- -
subtype
-
The content subtype. These two may be used together as module-delta for block style rendering.
-
- -

Todo: example

- -

Todo after implementations are updated to new version.

diff --git a/html/sites/all/modules/contrib/ctools/help/context-context.html b/html/sites/all/modules/contrib/ctools/help/context-context.html deleted file mode 100644 index 2314bd5ff..000000000 --- a/html/sites/all/modules/contrib/ctools/help/context-context.html +++ /dev/null @@ -1,13 +0,0 @@ -

Context plugin data:

- -
-    'title' => Visible title
-    'description' => Description of context
-    'context' => Callback to create a context. Params: $empty, $data = NULL, $conf = FALSE
-    'settings form' => Callback to show a context setting form. Params: ($conf, $external = FALSE)
-    'settings form validate' => params: ($form, &$form_values, &$form_state)
-    'settings form submit' => params: 'ctools_context_node_settings_form_submit',
-    'keyword' => The default keyword to use.
-    'context name' => The unique identifier for this context for use by required context checks.
-    'no ui' => if TRUE this context cannot be selected.
-
\ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/help/context-relationships.html b/html/sites/all/modules/contrib/ctools/help/context-relationships.html deleted file mode 100644 index cc9969e1f..000000000 --- a/html/sites/all/modules/contrib/ctools/help/context-relationships.html +++ /dev/null @@ -1,13 +0,0 @@ -

Relationship plugin data:

- -
-    'title' => The title to display.
-    'description' => Description to display.
-    'keyword' => Default keyword for the context created by this relationship.
-    'required context' => One or more ctools_context_required/optional objects 
-      describing the context input.
-      new panels_required_context(t('Node'), 'node'),
-    'context' => The callback to create the context. Params: ($context = NULL, $conf)
-    'settings form' => Settings form. Params: $conf
-    'settings form validate' => Validate. 
-
diff --git a/html/sites/all/modules/contrib/ctools/help/context.html b/html/sites/all/modules/contrib/ctools/help/context.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/html/sites/all/modules/contrib/ctools/help/css.html b/html/sites/all/modules/contrib/ctools/help/css.html deleted file mode 100644 index b9b6d9c63..000000000 --- a/html/sites/all/modules/contrib/ctools/help/css.html +++ /dev/null @@ -1 +0,0 @@ -

To be written.

diff --git a/html/sites/all/modules/contrib/ctools/help/ctools.help.ini b/html/sites/all/modules/contrib/ctools/help/ctools.help.ini deleted file mode 100644 index fcb121b8d..000000000 --- a/html/sites/all/modules/contrib/ctools/help/ctools.help.ini +++ /dev/null @@ -1,97 +0,0 @@ -[advanced help settings] -line break = TRUE - -[about] -title = About Chaos Tool Suite -weight = -100 - -[context] -title = Context tool -weight = -40 - -[context-access] -title = Context based access control plugins -parent = context - -[context-context] -title = Context plugins -parent = context - -[context-arguments] -title = Argument plugins -parent = context - -[context-relationships] -title = Relationship plugins -parent = context - -[context-content] -title = Content plugins -parent = context - -[css] -title = CSS scrubbing and caching tool - -[menu] -title = Miscellaneous menu helper tool - -[plugins] -title = Plugins and APIs tool -weight = -50 - -[plugins-api] -title = Implementing APIs -parent = plugins - -[plugins-creating] -title = Creating plugins -parent = plugins - -[plugins-implementing] -title = Implementing plugins -parent = plugins - -[export] -title = Exportable objects tool - -[export-ui] -title = Exportable objects UI creator - -[form] -title = Form tools - -[wizard] -title = Form wizard tool - -[ajax] -title = AJAX and Javascript helper tools -weight = -30 - -[modal] -title = Javascript modal tool -parent = ajax - -[collapsible-div] -title = Javascript collapsible DIV -parent = ajax - -[dropdown] -title = Javascript dropdown -parent = ajax - -[dropbutton] -title = Javascript dropbutton -parent = ajax - -[dependent] -title = Dependent checkboxes and radio buttons -parent = ajax - -[object-cache] -title = Temporary object caching - -; A bunch of this stuff we'll put in panels. - -[plugins-content] -title = Creating content type plugins -parent = panels%api diff --git a/html/sites/all/modules/contrib/ctools/help/dependent.html b/html/sites/all/modules/contrib/ctools/help/dependent.html deleted file mode 100644 index b9b6d9c63..000000000 --- a/html/sites/all/modules/contrib/ctools/help/dependent.html +++ /dev/null @@ -1 +0,0 @@ -

To be written.

diff --git a/html/sites/all/modules/contrib/ctools/help/dropbutton.html b/html/sites/all/modules/contrib/ctools/help/dropbutton.html deleted file mode 100644 index b9b6d9c63..000000000 --- a/html/sites/all/modules/contrib/ctools/help/dropbutton.html +++ /dev/null @@ -1 +0,0 @@ -

To be written.

diff --git a/html/sites/all/modules/contrib/ctools/help/dropdown.html b/html/sites/all/modules/contrib/ctools/help/dropdown.html deleted file mode 100644 index b9b6d9c63..000000000 --- a/html/sites/all/modules/contrib/ctools/help/dropdown.html +++ /dev/null @@ -1 +0,0 @@ -

To be written.

diff --git a/html/sites/all/modules/contrib/ctools/help/export-ui.html b/html/sites/all/modules/contrib/ctools/help/export-ui.html deleted file mode 100644 index e6b1086e0..000000000 --- a/html/sites/all/modules/contrib/ctools/help/export-ui.html +++ /dev/null @@ -1,85 +0,0 @@ -

Most user interfaces for exportables are very similar, so CTools includes a tool to provide the framework for the most common UI. This tool is a plugin of the 'export_ui' type. In order to create a UI for your exportable object with this tool, you first need to ensure that your module supports the plugin:

- -
-function HOOK_ctools_plugin_directory($module, $plugin) {
-  if ($module == 'ctools' && $plugin == 'export_ui') {
-    return 'plugins/' . $plugin;
-  }
-}
-
- -

Then, you need to create a plugin .inc file describing your UI. Most of the UI runs with sane but simple defaults, so for the very simplest UI you don't need to do very much. This is a very simple example plugin for the 'example' export type:

- -
-$plugin = array(
-  // The name of the table as found in the schema in hook_install. This
-  // must be an exportable type with the 'export' section defined.
-  'schema' => 'example',
-
-  // The access permission to use. If not provided it will default to
-  // 'administer site configuration'
-  'access' => 'administer example',
-
-  // You can actually define large chunks of the menu system here. Nothing
-  // is required here. If you leave out the values, the prefix will default
-  // to admin/structure and the item will default to the plugin name.
-  'menu' => array(
-    'menu prefix' => 'admin/structure',
-    'menu item' => 'example',
-    // Title of the top level menu. Note this should not be translated,
-    // as the menu system will translate it.
-    'menu title' => 'Example', 
-    // Description of the top level menu, which is usually needed for
-    // menu items in an administration list. Will be translated
-    // by the menu system.
-    'menu description' => 'Administer site example objects.',
-  ),
-
-  // These are required to provide proper strings for referring to the
-  // actual type of exportable. "proper" means it will appear at the
-  // beginning of a sentence.
-  'title singular' => t('example'),
-  'title singular proper' => t('Example'),
-  'title plural' => t('examples'),
-  'title plural proper' => t('Examples'),
-
-  // This will provide you with a form for editing the properties on your
-  // exportable, with validate and submit handler.
-  //
-  // The item being edited will be in $form_state['item'].
-  //
-  // The submit handler is only responsible for moving data from
-  // $form_state['values'] to $form_state['item'].
-  //
-  // All callbacks will accept &$form and &$form_state as arguments.
-  'form' => array(
-    'settings' => 'example_ctools_export_ui_form',
-    'validate' => 'example_ctools_export_ui_form_validate',
-    'submit' => 'example_ctools_export_ui_form_submit',
-  ),
-
-);
-
- -

For a more complete list of what you can set in your plugin, please see ctools_export_ui_defaults() in includes/export-ui.inc to see what the defaults are.

- -

More advanced UIs

- -

The bulk of this UI is built on an class called ctools_export_ui, which is itself stored in ctools/plugins/export_ui as the default plugin. Many UIs will have more complex needs than the defaults provide. Using OO and overriding methods can allow an implementation to use the basics and still provide more where it is needed. To utilize this, first add a 'handler' directive to your plugin .inc file:

- -
-   'handler' => array(
-     'class' => 'ctools_export_ui_example',
-     'parent' => 'ctools_export_ui',
-   ),
-
- -Then create your class in ctools_export_ui_example.class.php in your plugins directory: - -
-class ctools_export_ui_example extends ctools_export_ui {
-
-}
-
- -

You can override any method found in the class (see the source file for details). In particular, there are several list methods that are good candidates for overriding if you need to provide richer data for listing, sorting or filtering. If you need multi-step add/edit forms, you can override edit_page(), add_page(), clone_page(), and import_page() to put your wizard in place of the basic editing system. For an example of how to use multi-step wizards, see the import_page() method.

diff --git a/html/sites/all/modules/contrib/ctools/help/export.html b/html/sites/all/modules/contrib/ctools/help/export.html deleted file mode 100644 index 573c98a68..000000000 --- a/html/sites/all/modules/contrib/ctools/help/export.html +++ /dev/null @@ -1,294 +0,0 @@ -

Exportable objects are objects that can live either in the database or in code, or in both. If they live in both, then the object in code is considered to be "overridden", meaning that the version in code is ignored in favor of the version in the database.

- -

The main benefit to this is that you can move objects that are intended to be structure or feature-related into code, thus removing them entirely from the database. This is a very important part of the deployment path, since in an ideal world, the database is primarily user generated content, whereas site structure and site features should be in code. However, many many features in Drupal rely on objects being in the database and provide UIs to create them.

- -

Using this system, you can give your objects dual life. They can be created in the UI, exported into code and put in revision control. Views and Panels both use this system heavily. Plus, any object that properly implements this system can be utilized by the Features module to be used as part of a bundle of objects that can be turned into feature modules.

- -

Typically, exportable objects have two identifiers. One identifier is a simple serial used for database identification. It is a primary key in the database and can be used locally. It also has a name which is an easy way to uniquely identify it. This makes it much less likely that importing and exporting these objects across systems will have collisions. They still can, of course, but with good name selection, these problems can be worked around.

- -

Making your objects exportable

- -

To make your objects exportable, you do have to do a medium amount of work.

- -
    -
  1. Create a chunk of code in your object's schema definition in the .install file to introduce the object to CTools' export system.
  2. -
  3. Create a load function for your object that utilizes ctools_export_load_object().
  4. -
  5. Create a save function for your object that utilizes drupal_write_record() or any method you desire.
  6. -
  7. Create an import and export mechanism from the UI.
  8. -
- -

The export section of the schema file

- -

Exportable objects are created by adding definition to the schema in an 'export' section. For example:

- -
-function mymodule_schema() {
-  $schema['mymodule_myobj'] = array(
-    'description' => t('Table storing myobj definitions.'),
-    'export' => array(
-      'key' => 'name',
-      'key name' => 'Name',
-      'primary key' => 'oid',
-      'identifier' => 'myobj', // Exports will be as $myobj
-      'default hook' => 'default_mymodule_myobj',  // Function hook name.
-      'api' => array(
-        'owner' => 'mymodule',
-        'api' => 'default_mymodule_myobjs',  // Base name for api include files.
-        'minimum_version' => 1,
-        'current_version' => 1,
-      ),
-      // If the key is stored in a table that is joined in, specify it:
-      'key in table' => 'my_join_table',
-
-    ),
-
-    // If your object's data is split up across multiple tables, you can
-    // specify additional tables to join. This is very useful when working
-    // with modules like exportables.module that has a special table for
-    // translating keys to local database IDs.
-    //
-    // The joined table must have its own schema definition.
-    //
-    // If using joins, you should implement a 'delete callback' (see below)
-    // to ensure that deletes happen properly. export.inc does not do this
-    // automatically!
-    'join' => array(
-      'exportables' => array(
-        // The following parameters will be used in this way:
-        // SELECT ... FROM {mymodule_myobj} t__0 INNER JOIN {my_join_table} t__1 ON t__0.id = t__1.id AND extras
-        'table' => 'my_join_table',
-        'left_key' => 'format',
-        'right_key' => 'id',
-        // Optionally you can define a callback to add custom conditions or
-        // alter the query as necessary. The callback function takes 3 args:
-        //
-        //   myjoincallback(&$query, $schema, $join_schema);
-        //
-        // where $query is the database query object, $schema is the schema for
-        // the export base table and $join_schema is the schema for the current
-        // join table.
-        'callback' => 'myjoincallback',
-
-        // You must specify which fields will be loaded. These fields must
-        // exist in the schema definition of the joined table.
-        'load' => array(
-          'machine',
-        ),
-
-        // And finally you can define other tables to perform INNER JOINS
-        //'other_joins' => array(
-        //   'table' => ...
-        //),
-      ),
-    )
-    'fields' => array(
-      'name' => array(
-        'type' => 'varchar',
-        'length' => '255',
-        'description' => 'Unique ID for this object. Used to identify it programmatically.',
-      ),
-      'oid' => array(
-        'type' => 'serial',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-        'description' => 'Primary ID field for the table. Not used for anything except internal lookups.',
-        'no export' => TRUE, // Do not export database-only keys.
-      ),
-    // ......
-    'primary key' => array('oid'),
-    'unique keys' => array(
-      'name' => array('name'),
-    ),
-  );
-  return $schema;
-}
-
- -
-
key
-
This is the primary key of the exportable object and should be a string as names are more portable across systems. It is possible to use numbers here, but be aware that export collisions are very likely. Defaults to 'name'.
- -
key name
-
Human readable title of the export key. Defaults to 'Name'. Because the schema is cached, do not translate this. It must instead be translated when used.
- -
primary key
-
A single field within the table that is to be used as the main identifier to discern whether or not the object has been written. As the schema definition's primary key value will be used by default, it is not usually necessary to define this.
- -
object
-
The class the object should be created as, if 'object factory' is not set. If this is not set either, defaults as stdClass.
- -
object factory
-
Function used to create the object. The function receives the schema and the loaded data as a parameters: your_factory_function($schema, $data). If this is set, 'object' has no effect since you can use your function to create whatever class you wish.
- -
admin_title
-
A convenience field that may contain the field which represents the human readable administrative title for use in export UI. If a field "admin_title" exists, it will automatically be used.
- -
admin_description
-
A convenience field that may contain the field which represents the human readable administrative title for use in export UI. If a field "admin_title" exists, it will automatically be used.
- -
can disable
-
Control whether or not the exportable objects can be disabled. All this does is cause the 'disabled' field on the object to always be set appropriately, and a variable is kept to record the state. Changes made to this state must be handled by the owner of the object. Defaults to TRUE.
- -
status
-
Exportable objects can be enabled or disabled, and this status is stored in a variable. This defines what variable that is. Defaults to: 'default_' . $table.
- -
default hook
-
What hook to invoke to find exportable objects that are currently defined. These will all be gathered into a giant array. Defaults to 'default_' . $table.
- -
cache defaults
-
If true, default objects will be cached so that the processing of the hook does not need to be called often. Defaults to FALSE. Recommended if you will potentially have a lot of objects in code. Not recommended if code will be the exception.
- -
default cache bin
-
If default object caching is enabled, what cache bin to use. This defaults to the basic "cache". It is highly recommended that you use a different cache bin if possible.
- -
identifier
-
When exporting the object, the identifier is the variable that the exported object will be placed in. Defaults to $table.
- -
bulk export
-
Declares whether or not the exportable will be available for bulk exporting.
- -
export type string
-
The export type string (Local, Overridden, Database) is normally stored as $item->type. Since type is a very common keyword, it's possible to specify what key to actually use.
- -
list callback
-
Bulk export callback to provide a list of exportable objects to be chosen for bulk exporting. Defaults to $module . '_' . $table . '_list' if the function exists. If it is not, a default listing function will be provided that will make a best effort to list the titles. See ctools_export_default_list().
- -
to hook code callback
-
Function used to generate an export for the bulk export process. This is only necessary if the export is more complicated than simply listing the fields. Defaults to $module . '_' . $table . '_to_hook_code'.
- -
boolean
-
Explicitly indicate if a table field contains a boolean or not. The Schema API does not model the -difference between a tinyint and a boolean type. Boolean values are stored in tinyint fields. This may cause mismatch errors when exporting a non-boolean value from a tinyint field. Add this to a tinyint field if it contains boolean data and can be exported. Defaults to TRUE. - -
create callback
-
CRUD callback to use to create a new exportable item in memory. If not provided, the default function will be used. The single argument is a boolean used to determine if defaults should be set on the object. This object will not be written to the database by this callback.
- -
load callback
-
CRUD callback to use to load a single item. If not provided, the default load function will be used. The callback will accept a single argument which should be an identifier of the export key.
- -
load multiple callback
-
CRUD callback to use to load multiple items. If not provided, the default multiple load function will be used. The callback will accept an array which should be the identifiers of the export key.
- -
load all callback
-
CRUD callback to use to load all items, usually for administrative purposes. If not provided, the default load function will be used. The callback will accept a single argument to determine if the load cache should be reset or not.
- -
save callback
-
CRUD callback to use to save a single item. If not provided, the default save function will be used. The callback will accept a single argument which should be the complete exportable object to save.
- -
delete callback
-
CRUD callback to use to delete a single item. If not provided, the default delete function will be used. The callback will accept a single argument which can be *either* the object or just the export key to delete. The callback MUST be able to accept either.
- -
export callback
-
CRUD callback to use for exporting. If not provided, the default export function will be used. The callback will accept two arguments, the first is the item to export, the second is the indent to place on the export, if any.
- -
import callback
-
CRUD callback to use for importing. If not provided, the default export function will be used. This function will accept the code as a single argument and, if the code evaluates, return an object represented by that code. In the case of failure, this will return a string with human readable errors.
- -
status callback
-
CRUD callback to use for updating the status of an object. If the status is TRUE the object will be disabled. If the status is FALSE the object will be enabled.
- -
api
-
The 'api' key can optionally contain some information for the plugin API definition. This means that the imports can be tied to an API name which is used to have automatic inclusion of files, and can be used to prevent dangerous objects from older versions from being loaded, causing a loss of functionality rather than site crashes or security loopholes. - -

If not present, no additional files will be loaded and the default hook will always be a simple hook that must be either part of the .module file or loaded during normal operations.

- -

api supports these subkeys:

- -
-
owner
-
The module that owns the API. Typically this is the name of the module that owns the schema. This will be one of the two keys used by hook_ctools_plugin_api() to determine version compatibility. Note that the name of this hook can be tailored via the use of hook_ctools_plugin_api_hook_name(). See ctools_plugin_api_get_hook() for details.
-
api
-
This is the name of the API, and will be the second parameter to the above mentioned hook. It will also be used as part of the name of the file that the hook containing default objects will be in, which comes in the form of MODULENAME.API.inc.
-
minimum_version
-
The minimum version supported. Any module reporting an API less than this will not have its default objects used. This should be updated only when API changes can cause older objects to crash or otherwise break badly.
-
current_version
-
The current version of the API. Any module reporting a required API higher than this will not have its default objects used.
-
-
- -
-

In addition, each field can contain the following:

-
-
no export
-
Set to TRUE to prevent that field from being exported.
- -
export callback
-
A function to override the export behavior. It will receive ($myobject, $field, $value, $indent) as arguments. By default, fields are exported through ctools_var_export().
-
- -

Reserved keys on exportable objects

- -

Exportable objects have several reserved keys that are used by the CTools export API. Each key can be found at $myobj->{$key} on an object loaded through ctools_export_load_object(). Implementing modules should not use these keys as they will be overwritten by the CTools export API.

-
-
api_version
-
The API version that this object implements.
- -
disabled
-
A boolean for whether the object is disabled.
- -
export_module
-
For objects that live in code, the module which provides the default object.
- -
export_type
-
A bitmask representation of an object current storage. You can use this bitmask in combination with the EXPORT_IN_CODE and EXPORT_IN_DATABASE constants to test for an object's storage in your code. -
- -
in_code_only
-
A boolean for whether the object lives only in code.
- -
table
-
The schema API table that this object belongs to.
- -
type
-
A string representing the storage type of this object. Can be one of the following: -
    -
  • Normal is an object that lives only in the database.
  • -
  • Overridden is an object that lives in the database and is overriding the exported configuration of a corresponding object in code.
  • -
  • Default is an object that lives only in code.
  • -
-Note: This key can be changed by setting 'export type string' to something else, to try and prevent "type" from conflicting. -
-
- -

The load callback

-

Calling ctools_export_crud_load($table, $name) will invoke your load callback, calling ctools_export_crud_load_multiple($table, $names) will invoke your load multiple callback, and calling ctools_export_crud_load_all($table, $reset) will invoke your load all callback. The default handlers should be sufficient for most uses.

- -

Typically, there will be three load functions. A 'single' load, to load just one object, a 'multiple' load to load multiple objects, and an 'all' load, to load all of the objects for use in administrating the objects or utilizing the objects when you need all of them. Using ctools_export_load_object() you can easily do both, as well as quite a bit in between. This example duplicates the default functionality for loading one myobj.

- -
-/**
- * Implements 'load callback' for myobj exportables.
- */
-function mymodule_myobj_load($name) {
-  ctools_include('export');
-  $result = ctools_export_load_object('mymodule_myobjs', 'names', array($name));
-  if (isset($result[$name])) {
-    return $result[$name];
-  }
-}
-
-/**
- * Implements 'load multiple callback' for myobj exportables.
- */
-function mymodule_myobj_load_multiple(array $names) {
-  ctools_include('export')
-  $results = ctools_export_load_object('mymodule_myobjs', 'names', $names);
-  return array_filter($results);
-}
-
- -

The save callback

-Calling ctools_export_crud_save($table, $object) will invoke your save callback. The default handlers should be sufficient for most uses. For the default save mechanism to work, you must define a 'primary key' in the 'export' section of your schema. The following example duplicates the default functionality for the myobj. - -
-/**
-* Save a single myobj.
-*/
-function mymodule_myobj_save(&$myobj) {
-  $update = (isset($myobj->oid) && is_numeric($myobj->oid)) ? array('oid') : array();
-  return drupal_write_record('myobj', $myobj, $update);
-}
-
- -

Default hooks for your exports

-

All exportables come with a 'default' hook, which can be used to put your exportable into code. The easiest way to actually use this hook is to set up your exportable for bulk exporting, enable the bulk export module and export an object.

diff --git a/html/sites/all/modules/contrib/ctools/help/form.html b/html/sites/all/modules/contrib/ctools/help/form.html deleted file mode 100644 index b9b6d9c63..000000000 --- a/html/sites/all/modules/contrib/ctools/help/form.html +++ /dev/null @@ -1 +0,0 @@ -

To be written.

diff --git a/html/sites/all/modules/contrib/ctools/help/modal.html b/html/sites/all/modules/contrib/ctools/help/modal.html deleted file mode 100644 index 761fd2e32..000000000 --- a/html/sites/all/modules/contrib/ctools/help/modal.html +++ /dev/null @@ -1,215 +0,0 @@ -

CTools provides a simple modal that can be used as a popup to place forms. It differs from the normal modal frameworks in that it does not do its work via an iframe. This is both an advantage and a disadvantage. The iframe simply renders normal pages in a sub-browser and they can do their thing. That makes it much easier to put arbitrary pages and forms in a modal. However, the iframe is not very good at actually communicating changes to the main page, so you cannot open the modal, have it do some work, and then modify the page.

- -

Invoking the modal

- -

The basic form of the modal can be set up just by including the javascript and adding the proper class to a link or form that will open the modal. To include the proper javascript, simply include the library and call the add_js function:

- -ctools_include('modal'); -ctools_modal_add_js(); - - -

You can have links and buttons bound to use the modal by adding the class ctools-use-modal. For convenience, there is a helper function to try and do this, though it's not great at doing all links so using this is optional:

- -/** - * Render an image as a button link. This will automatically apply an AJAX class - * to the link and add the appropriate javascript to make this happen. - * - * @param $image - * The path to an image to use that will be sent to theme('image') for rendering. - * @param $dest - * The destination of the link. - * @param $alt - * The alt text of the link. - * @param $class - * Any class to apply to the link. @todo this should be a options array. - */ -function ctools_modal_image_button($image, $dest, $alt, $class = '') { - return ctools_ajax_text_button(theme('image', array('path' => $image), $dest, $alt, $class, 'ctools-use-modal'); -} - -/** - * Render text as a link. This will automatically apply an AJAX class - * to the link and add the appropriate javascript to make this happen. - * - * Note: 'html' => true so be sure any text is vetted! Chances are these kinds of buttons will - * not use user input so this is a very minor concern. - * - * @param $text - * The text to display as the link. - * @param $dest - * The destination of the link. - * @param $alt - * The alt text of the link. - * @param $class - * Any class to apply to the link. @todo this should be a options array. - */ -function ctools_modal_text_button($text, $dest, $alt, $class = '') { - return ctools_ajax_text_button($text, $dest, $alt, $class, 'ctools-use-modal'); -} - - -

Like with all CTools' AJAX functionality, the href of the link will be the destination, with any appearance of /nojs/ converted to /ajax/.

- -

For submit buttons, however, the URL may be found a different, slightly more complex way. If you do not wish to simply submit the form to the modal, you can create a URL using hidden form fields. The ID of the item is taken and -url is appended to it to derive a class name. Then, all form elements that contain that class name are founded and their values put together to form a URL.

- -

For example, let's say you have an 'add' button, and it has a select form item that tells your system what widget it is adding. If the id of the add button is edit-add, you would place a hidden input with the base of your URL in the form and give it a class of 'edit-add-url'. You would then add 'edit-add-url' as a class to the select widget allowing you to convert this value to the form without posting. If no URL is found, the action of the form will be used and the entire form posted to it.

- -

Customizing the modal

- -

If you do not wish to use the default modal, the modal can be customized by creating an array of data to define a customized modal. To do this, you add an array of info to the javascript settings to define the customizations for the modal and add an additional class to your modal link or button to tell it which modal to use.

- -

First, you need to create a settings array. You can do this most easily with a bit of PHP:

- -
drupal_add_js(array(
-    'my-modal-style' => array(
-      'modalSize' => array(
-        'type' => 'fixed',
-        'width' => 250,
-        'height' => 250,
-      ),
-    ),
-  ), 'setting');
-
- -

The key to the array above (in this case, my-modal-style) is the identifier to your modal theme. You can have multiple modal themes on a page, so be sure to use an ID that will not collide with some other module's use. Using your module or theme as a prefix is a good idea.

- -

Then, when adding the ctools-use-modal class to your link or button, also add the following class: ctools-modal-ID (in the example case, that would be ctools-modal-my-modal-style).

- -

modalSize can be 'fixed' or 'scale'. If fixed it will be a raw pixel value; if 'scale' it will be a percentage of the screen.

- -

You can set:

-
    -
  • modalSize: an array of data to control the sizing of the modal. It can contain: -
      -
    • type: Either fixed or scale. If fixed, the modal will always be a fixed size. If scale the modal will scale to a percentage of the browser window. Default: scale. -
    • width: If fixed the width in pixels. If scale the percentage of the screen expressed as a number less than zero. (For 80 percent, use .8, for example). Default: .8
    • -
    • height: If fixed the height in pixels. If scale the percentage of the screen expressed as a number less than zero. (For 80 percent, use .8, for example). Default: .8
    • -
    • addWidth: Any additional width to add to the modal in pixels. Only useful if the type is scale. Default: 0
    • -
    • addHeight: Any additional height to add to the modal in pixels. Only useful if the type is scale. Default: 0
    • -
    • contentRight: The number of pixels to remove from the content inside the modal to make room for scroll bar and decorations. Default: 25
    • -
    • contentBottom: The number of pixels to remove from the content inside the modal to make room for scroll bar and decorations. Default: 45
    • -
    -
  • -
  • modalTheme: The Drupal javascript themable function which controls how the modal will be rendered. This function must be in the Drupal.theme.prototype namespace. If you set this value, you must include a corresponding function in a javascript file and use drupal_add_js() to add that file. Default: CToolsModalDialog -
    -  Drupal.theme.prototype.CToolsModalDialog = function () {
    -    var html = ''
    -    html += '  <div id="ctools-modal">'
    -    html += '    <div class="ctools-modal-content">' // panels-modal-content
    -    html += '      <div class="modal-header">';
    -    html += '        <a class="close" href="#">';
    -    html +=            Drupal.CTools.Modal.currentSettings.closeText + Drupal.CTools.Modal.currentSettings.closeImage;
    -    html += '        </a>';
    -    html += '        <span id="modal-title" class="modal-title"> </span>';
    -    html += '      </div>';
    -    html += '      <div id="modal-content" class="modal-content">';
    -    html += '      </div>';
    -    html += '    </div>';
    -    html += '  </div>';
    -
    -    return html;
    -  }
    -
  • -
  • throbberTheme: The Drupal javascript themable function which controls how the modal throbber will be rendered. This function must be in the Drupal.theme.prototype namespace. If you set this value, you must include a corresponding function in a javascript file and use drupal_add_js() to add that file. Default: CToolsModalThrobber -
    -  Drupal.theme.prototype.CToolsModalThrobber = function () {
    -    var html = '';
    -    html += '  <div id="modal-throbber">';
    -    html += '    <div class="modal-throbber-wrapper">';
    -    html +=        Drupal.CTools.Modal.currentSettings.throbber;
    -    html += '    </div>';
    -    html += '  </div>';
    -
    -    return html;
    -  };
    -
    -
  • -
  • modalOptions: The options object that's sent to Drupal.CTools.Modal.modalContent. Can contain any CSS settings that will be applied to the modal backdrop, in particular settings such as opacity and background. Default: array('opacity' => .55, 'background' => '#fff');
  • -
  • animation: Controls how the modal is animated when it is first drawn. Either show, fadeIn or slideDown. Default: show
  • -
  • animationSpeed: The speed of the animation, expressed either as a word jQuery understands (slow, medium or fast) or a number of milliseconds for the animation to run. Defaults: fast
  • -
  • closeText: The text to display for the close button. Be sure to wrap this in t() for translatability. Default: t('Close window')
  • -
  • closeImage: The image to use for the close button of the modal. Default: theme('image', array('path' => ctools_image_path('icon-close-window.png'), 'alt' => t('Close window'), 'title' => t('Close window')))
  • -
  • loadingText: The text to display for the modal title during loading, along with the throbber. Be sure to wrap this in t() for translatability. Default: t('Close window')
  • -
  • throbber: The HTML to display for the throbber image. You can use this instead of CToolsModalThrobber theme if you just want to change the image but not the throbber HTML. Default: theme('image', array('path' => ctools_image_path('throbber.gif'), 'alt' => t('Loading...'), 'title' => t('Loading')))
  • -
- -

Rendering within the modal

-

To render your data inside the modal, you need to provide a page callback in your module that responds more or less like a normal page.

- -

In order to handle degradability, it's nice to allow your page to work both inside and outside of the modal so that users whose javascript is turned off can still use your page. There are two ways to accomplish this. First, you can embed 'nojs' as a portion of the URL and then watch to see if that turns into 'ajax' when the link is clicked. Second, if you do not wish to modify the URLs, you can check $_POST['js'] or $_POST['ctools_js'] to see if that flag was set. The URL method is the most flexible because it is easy to send the two links along completely different paths if necessary, and it is also much easier to manually test your module's output by manually visiting the nojs URL. It's actually quite difficult to do this if you have to set $_POST['js'] to test.

- -

In your hook_menu, you can use the a CTools' AJAX convenience loader to help:

- -
-  $items['ctools_ajax_sample/%ctools_js/login'] = array(
-      'title' => 'Login',
-      'page callback' => 'ctools_ajax_sample_login',
-      'page arguments' => array(1),
-      'access callback' => TRUE,
-      'type' => MENU_CALLBACK,
-  );
-
- -

The first argument to the page callback will be the result of ctools_js_load() which will return TRUE if 'ajax' was the string, and FALSE if anything else (i.e, nojs) is the string. Which means you can then declare your function like this:

- -
-function ctools_ajax_sample_login($js) {
-  if ($js) {
-    // react with the modal
-  }
-  else {
-    // react without the modal
-  }
-}
-
- -

If your modal does not include a form, rendering the output you wish to give the user is just a matter of calling the modal renderer with your data:

- -
-function ctools_ajax_hello_world($js) {
-  $title = t('Greetings');
-  $output = '<p>' . t('Hello world') . '</p>';
-  if ($js) {
-    ctools_modal_render($title, $output);
-  }
-  else {
-    drupal_set_title($title);
-    return $output;
-  }
-}
-
- -

If you need to do more than just render your modal, you can use a CTools $commands array. See the function ctools_modal_render() for more information on what you need to do here.

- -

If you are displaying a form -- and the vast majority of modals display forms -- then you need to do just slightly more. Fortunately there is the ctools_modal_form_wrapper() function:

- -
-  ctools_include('modal');
-  ctools_include('ajax');
-  $form_state = array(
-    'title' => t('Title of my form'),
-    'ajax' => $js,
-  );
-  $output = ctools_modal_form_wrapper('my_form', $form_state);
-  // There are some possible states after calling the form wrapper:
-  // 1) We are not using $js and the form has been executed.
-  // 2) We are using $js and the form was successfully submitted and
-  //    we need to dismiss the modal.
-  // Most other states are handled automatically unless you set flags in
-  // $form_state to avoid handling them, so we only deal with those two
-  // states.
-  if ($form_state['executed'] && $js) {
-    $commands = array();
-    $commands[] = ctools_modal_command_dismiss(t('Login Success'));
-    // In typical usage you will do something else here, such as update a
-    // div with HTML or redirect the page based upon the results of the modal
-    // form.
-    print ajax_render($commands);
-    exit;
-  }
-
-  // Otherwise, just return the output.
-  return $output;
-
- -

You can also use CTools' form wizard inside the modal. You do not need to do much special beyond setting $form_state['modal'] = TRUE in the wizard form; it already knows how to handle the rest.

diff --git a/html/sites/all/modules/contrib/ctools/help/object-cache.html b/html/sites/all/modules/contrib/ctools/help/object-cache.html deleted file mode 100644 index 801a83672..000000000 --- a/html/sites/all/modules/contrib/ctools/help/object-cache.html +++ /dev/null @@ -1,132 +0,0 @@ -

The CTools Object Cache is a specialized cache for storing data that is non-volatile. This differs from the standard Drupal cache mechanism, which is volatile, meaning that the data can be cleared at any time and it is expected that any cached data can easily be reconstructed. In contrast, data stored in this cache is not expected to be reconstructable. It is primarily used for storing user input which is retrieved in stages, allowing for more complex user interface interactions.

- -

The object cache consists of 3 normal functions for cache maintenance, and 2 additional functions to facilitate locking.

- -

To use any of these functions, you must first use ctools_include:

- -
-ctools_include('object-cache');
-
- -
-/**
- * Get an object from the non-volatile ctools cache.
- *
- * This function caches in memory as well, so that multiple calls to this
- * will not result in multiple database reads.
- *
- * @param $obj
- *   A 128 character or less string to define what kind of object is being
- *   stored; primarily this is used to prevent collisions.
- * @param $name
- *   The name of the object being stored.
- * @param $skip_cache
- *   Skip the memory cache, meaning this must be read from the db again.
- *
- * @return
- *   The data that was cached.
- */
-function ctools_object_cache_get($obj, $name, $skip_cache = FALSE) {
-
- -
-/**
- * Store an object in the non-volatile ctools cache.
- *
- * @param $obj
- *   A 128 character or less string to define what kind of object is being
- *   stored; primarily this is used to prevent collisions.
- * @param $name
- *   The name of the object being stored.
- * @param $cache
- *   The object to be cached. This will be serialized prior to writing.
- */
-function ctools_object_cache_set($obj, $name, $cache) {
-
- -
-/**
- * Remove an object from the non-volatile ctools cache
- *
- * @param $obj
- *   A 128 character or less string to define what kind of object is being
- *   stored; primarily this is used to prevent collisions.
- * @param $name
- *   The name of the object being removed.
- */
-function ctools_object_cache_clear($obj, $name) {
-
- -

To facilitate locking, which is the ability to prohibit updates by other users while one user has an object cached, this system provides two functions:

- -
-/**
- * Determine if another user has a given object cached.
- *
- * This is very useful for 'locking' objects so that only one user can
- * modify them.
- *
- * @param $obj
- *   A 128 character or less string to define what kind of object is being
- *   stored; primarily this is used to prevent collisions.
- * @param $name
- *   The name of the object being removed.
- *
- * @return
- *   An object containing the UID and updated date if found; NULL if not.
- */
-function ctools_object_cache_test($obj, $name) {
-
- -

The object returned by ctools_object_cache_test can be directly used to determine whether a user should be allowed to cache their own version of an object.

- -

To allow the concept of breaking a lock, that is, clearing another users changes:

- -
-/**
- * Remove an object from the non-volatile ctools cache for all session IDs.
- *
- * This is useful for clearing a lock.
- *
- * @param $obj
- *   A 128 character or less string to define what kind of object is being
- *   stored; primarily this is used to prevent collisions.
- * @param $name
- *   The name of the object being removed.
- */
-function ctools_object_cache_clear_all($obj, $name) {
-
- -

Typical best practice is to use wrapper functions such as these:

- -
-/**
- * Get the cached changes to a given task handler.
- */
-function delegator_page_get_page_cache($name) {
-  ctools_include('object-cache');
-  $cache = ctools_object_cache_get('delegator_page', $name);
-  if (!$cache) {
-    $cache = delegator_page_load($name);
-    $cache->locked = ctools_object_cache_test('delegator_page', $name);
-  }
-
-  return $cache;
-}
-
-/**
- * Store changes to a task handler in the object cache.
- */
-function delegator_page_set_page_cache($name, $page) {
-  ctools_include('object-cache');
-  $cache = ctools_object_cache_set('delegator_page', $name, $page);
-}
-
-/**
- * Remove an item from the object cache.
- */
-function delegator_page_clear_page_cache($name) {
-  ctools_include('object-cache');
-  ctools_object_cache_clear('delegator_page', $name);
-}
-
diff --git a/html/sites/all/modules/contrib/ctools/help/plugins-api.html b/html/sites/all/modules/contrib/ctools/help/plugins-api.html deleted file mode 100644 index 548f17b51..000000000 --- a/html/sites/all/modules/contrib/ctools/help/plugins-api.html +++ /dev/null @@ -1,55 +0,0 @@ -

APIs are a form of plugins that are tightly associated with a module. Instead of a module providing any number of plugins, each module provides only one file for an API and this file can contain hooks that the module should invoke.

- -

Modules support this API by implementing hook_ctools_plugin_api($module, $api). If they support the API, they return a packet of data:

- -
-function mymodule_ctools_plugin_api($module, $api) {
-  if ($module == 'some module' && $api = 'some api') {
-    return array(
-      'version' => The minimum API version this system supports. If this API version is incompatible then the .inc file will not be loaded.
-      'path' => Where to find the file. Optional; if not specified it will be the module's directory.
-      'file' => an alternative version of the filename. If not specified it will be $module.$api.inc
-    );
-  }
-}
-
- -

This implementation must be in the .module file.

- -

Modules utilizing this can invole ctools_plugin_api_include() in order to ensure all modules that support the API will have their files loaded as necessary. It's usually easiest to create a small helper function like this:

- -
-define('MYMODULE_MINIMUM_VERSION', 1);
-define('MYMODULE_VERSION', 1);
-
-function mymodule_include_api() {
-  ctools_include('plugins');
-  return ctools_plugin_api_include('mymodule', 'myapi', MYMODULE_MINIMUM_VERSION, MYMODULE_VERSION);
-}
-
- -

Using a define will ensure your use of version numbers is consistent and easy to update when you make API changes. You can then use the usual module_invoke type commands:

- -
-mymodule_include_api();
-module_invoke('myhook', $data);
-
- -

If you need to pass references, this construct is standard:

- -
-foreach (mymodule_include_api() as $module => $info) {
-  $function = $module . '_hookname';
-  // Just because they implement the API and include a file does not guarantee they implemented
-  // a hook function!
-  if (!function_exists($function)) {
-    continue;
-  }
-
-  // Typically array_merge() is used below if data is returned.
-  $result = $function($data1, $data2, $data3);
-}
-
- -

TODO: There needs to be a way to check API version without including anything, as a module may simply -provide normal plugins and versioning could still matter.

diff --git a/html/sites/all/modules/contrib/ctools/help/plugins-creating.html b/html/sites/all/modules/contrib/ctools/help/plugins-creating.html deleted file mode 100644 index 6d5b35f61..000000000 --- a/html/sites/all/modules/contrib/ctools/help/plugins-creating.html +++ /dev/null @@ -1,204 +0,0 @@ -There are two primary pieces to using plugins. The first is getting the data, and the second is using the data. - -

Defining a plugin

-To define that you offer a plugin that modules can implement, you first must implement hook_ctools_plugin_type() to tell the plugin system about your plugin. - -
-/**
- * Implements hook_ctools_plugin_type() to inform CTools about the layout plugin.
- */
-function panels_ctools_plugin_type() {
-  $plugins['layouts'] = array(
-    'load themes' => TRUE,
-  );
-
-  return $plugins;
-}
-
- -The following information can be specified for each plugin type: -
-
cache
-
Defaults to: FALSE
-
If set to TRUE, the results of ctools_get_plugins will be cached in the 'cache' table (by default), thus preventing .inc files from being loaded. ctools_get_plugins looking for a specific plugin will always load the appropriate .inc file.
-
cache table
-
Defaults to: 'cache'
-
If 'cache' is TRUE, then this value specifies the cache table where the cached plugin information will be stored.
-
classes
-
Defaults to: array()
-
An array of class identifiers(i.e. plugin array keys) which a plugin of this type uses to provide classes to the CTools autoloader. For example, if classes is set to array('class'), then CTools will search each $plugin['class'] for a class to autoload. Depending of the plugin structure, a class identifier may be either: -
-
- a file name:
-
the file which holds the class with the name structure as: [filename].[class].php
-
in this case the class name can be different than the class identifier
-
- the class name:
-
if the class is in the same file as the $plugin
-
the plugin .inc file can have a different name than the class identifier
-
-
-
defaults
-
Defaults to: array()
-
An array of defaults that should be added to each plugin; this can be used to ensure that every plugin has the basic data necessary. These defaults will not ovewrite data supplied by the plugin. This could also be a function name, in which case the callback will be used to provide defaults. NOTE, however, that the callback-based approach is deprecated as it is redundant with the 'process' callback, and as such will be removed in later versions. Consequently, you should only use the array form for maximum cross-version compatibility.
-
load themes
-
Defaults to: FALSE
-
If set to TRUE, then plugins of this type can be supplied by themes as well as modules. If this is the case, all themes that are currently enabled will provide a plugin: NOTE: Due to a slight UI bug in Drupal, it is possible for the default theme to be active but not enabled. If this is the case, that theme will NOT provide plugins, so if you are using this feature, be sure to document that issue. Also, themes set via $custom_theme do not necessarily need to be enabled, but the system has no way of knowing what those themes are, so the enabled flag is the only true method of identifying which themes can provide layouts.
-
hook
-
Defaults to: (dynamic value)
-
The name of the hook used to collect data for this plugin. Normally this is $module . '_' . $type -- but this can be changed here. If you change this, you MUST be sure to document this for your plugin implementors as it will change the format of the specially named hook. -
process
-
Defaults to: ''
-
An optional function callback to use for processing a plugin. This can be used to provide automated settings that must be calculated per-plugin instance (i.e., it is not enough to simply append an array via 'defaults'). The parameters on this callback are: callback(&$plugin, $info) where $plugin is a reference to the plugin as processed and $info is the fully processed result of hook_ctools_plugin_api_info(). -
extension
-
Defaults to: 'inc'
-
Can be used to change the extension on files containing plugins of this type. By default the extension will be "inc", though it will default to "info" if "info files" is set to true. Do not include the dot in the extension if changing it, that will be added automatically.
-
info file
-
Defaults to: FALSE
-
If set to TRUE, then the plugin will look for a .info file instead of a .inc. Internally, this will look exactly the same, though obviously a .info file cannot contain functions. This can be good for styles that may not need to contain code.
-
use hooks
-
Defaults to: TRUE*
-
Use to enable support for plugin definition hooks instead of plugin definition files. NOTE: using a central plugin definition hook is less optimal for the plugins system, and as such this will default to FALSE in later versions.
-
child plugins
-
Defaults to: FALSE
-
If set to TRUE, the plugin type can automatically have 'child plugins' meaning each plugin can actually provide multiple plugins. This is mostly used for plugins that store some of their information in the database, such as views, blocks or exportable custom versions of plugins.
-
To implement, each plugin can have a 'get child' and 'get children' callback. Both of these should be implemented for performance reasons, since it is best to avoid getting all children if necessary, but if 'get child' is not implemented, it will fall back to 'get children' if it has to.
-
Child plugins should be named parent:child, with the : being the separator, so that it knows which parent plugin to ask for the child. The 'get children' method should at least return the parent plugin as part of the list, unless it wants the parent plugin itself to not be a choosable option, which is not unheard of.
-
'get children' arguments are ($plugin, $parent) and 'get child' arguments are ($plugin, $parent, $child). -
- -In addition, there is a 'module' and 'type' settings; these are for internal use of the plugin system and you should not change these. -

Getting the data

-To create a plugin, a module only has to execute ctools_get_plugins with the right data: - -
-  ctools_include('plugins');
-  ctools_get_plugins($module, $type, [$id])
-
- -In the above example, $module should be your module's name and $type is the type of the plugin. It is typically best practice to provide some kind of wrapper function to make this easier. For example, Panels provides the following functions to implement the 'content_types' plugin: - -
-/**
- * Fetch metadata on a specific content_type plugin.
- *
- * @param $content type
- *   Name of a panel content type.
- *
- * @return
- *   An array with information about the requested panel content type.
- */
-function panels_get_content_type($content_type) {
-  ctools_include('context');
-  ctools_include('plugins');
-  return ctools_get_plugins('panels', 'content_types', $content_type);
-}
-
-/**
- * Fetch metadata for all content_type plugins.
- *
- * @return
- *   An array of arrays with information about all available panel content types.
- */
-function panels_get_content_types() {
-  ctools_include('context');
-  ctools_include('plugins');
-  return ctools_get_plugins('panels', 'content_types');
-}
-
- -

Using the data

- -Each plugin returns a packet of data, which is added to with a few defaults. Each plugin is guaranteed to always have the following data: -
-
name
-
The name of the plugin. This is also the key in the array, of the full list of plugins, and is placed here since that is not always available.
-
module
-
The module that supplied the plugin.
-
file
-
The actual file containing the plugin.
-
path
-
The path to the file containing the plugin. This is useful for using secondary files, such as templates, css files, images, etc, that may come with a plugin.
-
- -

Any of the above items can be overridden by the plugin itself, though the most likely one to be modified is the 'path'.

- -

The most likely data (beyond simple printable data) for a plugin to provide is a callback. The plugin system provides a pair of functions to make it easy and consistent for these callbacks to be used. The first is ctools_plugin_get_function, which requires the full $plugin object.

- -
-/**
- * Get a function from a plugin, if it exists. If the plugin is not already
- * loaded, try ctools_plugin_load_function() instead.
- *
- * @param $plugin
- *   The loaded plugin type.
- * @param $callback_name
- *   The identifier of the function. For example, 'settings form'.
- *
- * @return
- *   The actual name of the function to call, or NULL if the function
- *   does not exist.
- */
-function ctools_plugin_get_function($plugin, $callback_name)
-
- -

The second does not require the full $plugin object, and will load it:

- -
-/**
- * Load a plugin and get a function name from it, returning success only
- * if the function exists.
- *
- * @param $module
- *   The module that owns the plugin type.
- * @param $type
- *   The type of plugin.
- * @param $id
- *   The id of the specific plugin to load.
- * @param $callback_name
- *   The identifier of the function. For example, 'settings form'.
- *
- * @return
- *   The actual name of the function to call, or NULL if the function
- *   does not exist.
- */
-function ctools_plugin_load_function($module, $type, $id, $callback_name) {
-
- -

Both of these functions will ensure any needed files are included. In fact, it allows each callback to specify alternative include files. The plugin implementation could include code like this:

- -
-  'callback_name' => 'actual_name_of_function_here',
-
- -

Or like this:

-
-  'callback_name' => array(
-    'file' => 'filename',
-    'path' => 'filepath', // optional, will use plugin path if absent
-    'function' => 'actual_name_of_function_here',
-  ),
-
- -

An example, for 'plugin_example' type

- -
-$plugin = array(
-  'name' => 'my_plugin',
-  'module' => 'my_module',
-  'example_callback' => array(
-    'file' => 'my_plugin.extrafile.inc',
-    'function' => 'my_module_my_plugin_example_callback',
-  ),
-);
-
- -

To utilize this callback on this plugin:

- -
-if ($function = ctools_plugin_get_function($plugin, 'example_callback')) {
-  $function($arg1, $arg2, $etc);
-}
-
- -

Document your plugins!

- -

Since the data provided by your plugin tends to be specific to your plugin type, you really need to document what the data returned in the hook in the .inc file will be or nobody will figure it out. Use advanced help and document it there. If every system that utilizes plugins does this, then plugin implementors will quickly learn to expect the documentation to be in the advanced help.

diff --git a/html/sites/all/modules/contrib/ctools/help/plugins-implementing.html b/html/sites/all/modules/contrib/ctools/help/plugins-implementing.html deleted file mode 100644 index c95e72d42..000000000 --- a/html/sites/all/modules/contrib/ctools/help/plugins-implementing.html +++ /dev/null @@ -1,62 +0,0 @@ -

There are two parts to implementing a plugin: telling the system where it is, and implementing one or more .inc files that contain the plugin data.

- -

Telling the system where your plugins live

-

How a module implements plugins

-

To implement any plugins at all, you must implement a single function for all plugins: hook_ctools_plugin_directory. Every time a module loads plugins, this hook will be called to see which modules implement those plugins and in what directory those plugins will live.

- -
-function hook_ctools_plugin_directory($module, $plugin) {
-  if ($module == 'panels' && $plugin == 'content_types') {
-    return 'plugins/content_types';
-  }
-}
-
- -

The directory returned should be relative to your module. Another common usage is to simply return that you implement all plugins owned by a given module (or modules):

- -
-function hook_ctools_plugin_directory($module, $plugin) {
-  if ($module == 'panels') {
-    return 'plugins/' . $plugin;
-  }
-}
-
- -

Typically, it is recommended that all plugins be placed into the 'plugins' directory for clarity and maintainability. Inside the directory, any number of subdirectories can be used. For plugins that require extra files, such as templates, css, javascript or image files, this is highly recommended:

-
-mymodule.module
-mymodule.info
-plugins/
-    content_types/
-        my_content_type.inc
-    layouts/
-        my_layout.inc
-        my_layout.css
-        my_layout.tpl.php
-        my_layout_image.png
-
- -

How a theme implements plugins

-

Themes can implement plugins if the plugin owner specified that it's possible in its hook_ctools_plugin_type() call. If so, it is generally exactly the same as modules, except for one important difference: themes don't get hook_ctools_plugin_directory(). Instead, themes add a line to their .info file:

- -
-plugins[module][type] = directory
-
- -

How to structure the .inc file

- -

The top of the .inc file should contain an array that defines the plugin. This array is simply defined in the global namespace of the file and does not need a function. Note that previous versions of this plugin system required a specially named function. While this function will still work, its use is now discouraged, as it is annoying to name properly.

- -

This array should look something like this:

- -
-$plugin = array(
-  'key' => 'value',
-);
-
- -

Several values will be filled in for you automatically, but you can override them if necessary. They include 'name', 'path', 'file' and 'module'. Additionally, the plugin owner can provide other defaults as well.

- -

There are no required keys by the plugin system itself. The only requirements in the $plugin array will be defined by the plugin type.

- -

After this array, if your plugin needs functions, they can be declared. Different plugin types have different needs here, so exactly what else will be needed will change from type to type.

diff --git a/html/sites/all/modules/contrib/ctools/help/plugins.html b/html/sites/all/modules/contrib/ctools/help/plugins.html deleted file mode 100644 index 1e64da095..000000000 --- a/html/sites/all/modules/contrib/ctools/help/plugins.html +++ /dev/null @@ -1,5 +0,0 @@ -

The plugins tool allows a module to allow other modules (and themes!) to provide plugins which provide some kind of functionality or some kind of task. For example, in Panels there are several types of plugins: Content types (which are like blocks), layouts (which are page layouts) and styles (which can be used to style a panel). Each plugin is represented by a .inc file, and the functionality they offer can differ wildly.

- -

A module which uses plugins can implement a hook describing the plugin (which is not necessary, as defaults will be filled in) and then calls a ctools function which loads either all the known plugins (used for listing/choosing) or a specific plugin (used when it's known which plugin is needed). From the perspective of the plugin system, a plugin is a packet of data, usually some printable info and a list of callbacks. It is up to the module implementing plugins to determine what that info means and what the callbacks do.

- -

A module which implements plugins must first implement the hook_ctools_plugin_directory function, which simply tells the system which plugins are supported and what directory to look in. Each plugin will then be in a separate .inc file in the directory supplied. The .inc file will contain a specially named hook which returns the data necessary to implement the plugin.

diff --git a/html/sites/all/modules/contrib/ctools/help/wizard.html b/html/sites/all/modules/contrib/ctools/help/wizard.html deleted file mode 100644 index 33fc45622..000000000 --- a/html/sites/all/modules/contrib/ctools/help/wizard.html +++ /dev/null @@ -1,311 +0,0 @@ -

Form wizards, or multi-step forms, are a process by which the user goes through or can use an arbitrary number of different forms to create a single object or perform a single task. Traditionally the multi-step form is difficult in Drupal because there is no easy place to put data in between forms. No longer! The form wizard tool allows a single entry point to easily set up a wizard of multiple forms, provide callbacks to handle data storage and updates between forms and when forms are completed. This tool pairs well with the object cache tool for storage.

- -

The form info array

-

The wizard starts with an array of data that describes all of the forms available to the wizard and sets options for how the wizard will present and control the flow. Here is an example of the $form_info array as used in the delegator module:

- -
-  $form_info = array(
-    'id' => 'delegator_page',
-    'path' => "admin/structure/pages/edit/$page_name/%step",
-    'show trail' => TRUE,
-    'show back' => TRUE,
-    'show return' => FALSE,
-    'next callback' => 'delegator_page_add_subtask_next',
-    'finish callback' => 'delegator_page_add_subtask_finish',
-    'return callback' => 'delegator_page_add_subtask_finish',
-    'cancel callback' => 'delegator_page_add_subtask_cancel',
-    'order' => array(
-      'basic' => t('Basic settings'),
-      'argument' => t('Argument settings'),
-      'access' => t('Access control'),
-      'menu' => t('Menu settings'),
-      'multiple' => t('Task handlers'),
-    ),
-    'forms' => array(
-      'basic' => array(
-        'form id' => 'delegator_page_form_basic'
-      ),
-      'access' => array(
-        'form id' => 'delegator_page_form_access'
-      ),
-      'menu' => array(
-        'form id' => 'delegator_page_form_menu'
-      ),
-      'argument' => array(
-        'form id' => 'delegator_page_form_argument'
-      ),
-      'multiple' => array(
-        'form id' => 'delegator_page_argument_form_multiple'
-      ),
-    ),
-  );
-
- -

The above array starts with an id which is used to identify the wizard in various places and a path which is needed to redirect to the next step between forms. It then creates some settings which control which pieces are displayed. In this case, it displays a form trail and a 'back' button, but not the 'return' button. Then there are the wizard callbacks which allow the wizard to act appropriately when forms are submitted. Finally it contains a list of forms and their order so that it knows which forms to use and what order to use them by default. Note that the keys in the order and list of forms match; that key is called the step and is used to identify each individual step of the wizard.

- -

Here is a full list of every item that can be in the form info array:

- -
-
id
-
An id for wizard. This is used like a hook to automatically name callbacks, as well as a form step's form building function. It is also used in trail theming.
- -
path
-
The path to use when redirecting between forms. %step will be replaced with the key for the form.
- -
return path
-
When a form is complete, this is the path to go to. This is required if the 'return' button is shown and not using AJAX. It is also used for the 'Finish' button. If it is not present and needed, the cancel path will also be checked.
- -
cancel path
-
When a form is canceled, this is the path to go to. This is required if the 'cancel' is shown and not using AJAX.
- -
show trail
-
If set to TRUE, the form trail will be shown like a breadcrumb at the top of each form. Defaults to FALSE.
- -
show back
-
If set to TRUE, show a back button on each form. Defaults to FALSE.
- -
show return
-
If set to TRUE, show a return button. Defaults to FALSE.
- -
show cancel
-
If set to TRUE, show a cancel button. Defaults to FALSE.
- -
back text
-
Set the text of the 'back' button. Defaults to t('Back').
- -
next text
-
Set the text of the 'next' button. Defaults to t('Continue').
- -
return text
-
Set the text of the 'return' button. Defaults to t('Update and return').
- -
finish text
-
Set the text of the 'finish' button. Defaults to t('Finish').
- -
cancel text
-
Set the text of the 'cancel' button. Defaults to t('Cancel').
- -
ajax
-
Turn on AJAX capabilities, using CTools' ajax.inc. Defaults to FALSE.
- -
modal
-
Put the wizard in the modal tool. The modal must already be open and called from an ajax button for this to work, which is easily accomplished using functions provided by the modal tool.
- -
ajax render
-
A callback to display the rendered form via ajax. This is not required if using the modal tool, but is required otherwise since ajax by itself does not know how to render the results. Params: &$form_state, $output.
- -
finish callback
-
The function to call when a form is complete and the finish button has been clicked. This function should finalize all data. Params: &$form_state. -Defaults to $form_info['id']._finish if function exists. -
- -
cancel callback
-
The function to call when a form is canceled by the user. This function should clean up any data that is cached. Params: &$form_state. -Defaults to $form_info['id']._cancel if function exists.
- -
return callback
-
The function to call when a form is complete and the return button has been clicked. This is often the same as the finish callback. Params: &$form_state. -Defaults to $form_info['id']._return if function exists.
- -
next callback
-
The function to call when the next button has been clicked. This function should take the submitted data and cache it for later use by the finish callback. Params: &$form_state. -Defaults to $form_info['id']._next if function exists.
- -
order
-
An optional array of forms, keyed by the step, which represents the default order the forms will be displayed in. If not set, the forms array will control the order. Note that submit callbacks can override the order so that branching logic can be used.
- -
forms
-
An array of form info arrays, keyed by step, describing every form available to the wizard. If order array isn't set, the wizard will use this to set the default order. Each array contains: -
-
form id
-
- The id of the form, as used in the Drupal form system. This is also the name of the function that represents the form builder. - Defaults to $form_info['id']._.$step._form. -
- -
include
-
The name of a file to include which contains the code for this form. This makes it easy to include the form wizard in another file or set of files. This must be the full path of the file, so be sure to use drupal_get_path() when setting this. This can also be an array of files if multiple files need to be included.
- -
title
-
The title of the form, to be optionally set via drupal_get_title. This is required when using the modal if $form_state['title'] is not set.
-
-
-
- -

Invoking the form wizard

-

Your module should create a page callback via hook_menu, and this callback should contain an argument for the step. The path that leads to this page callback should be the same as the 'path' set in the $form_info array.

- -

The page callback should set up the $form_info, and figure out what the default step should be if no step is provided (note that the wizard does not do this for you; you MUST specify a step). Then invoke the form wizard:

- -
-  $form_state = array();
-  ctools_include('wizard');
-  $output = ctools_wizard_multistep_form($form_info, $step, $form_state);
-
- -

If using AJAX or the modal, This part is actually done! If not, you have one more small step:

- -
-  return $output;
-
- -

Forms and their callbacks

-

Each form within the wizard is a complete, independent form using Drupal's Form API system. It has a form builder callback as well as submit and validate callbacks and can be form altered. The primary difference between these forms and a normal Drupal form is that the submit handler should not save any data. Instead, it should make any changes to a cached object (usually placed on the $form_state) and only the _finish or _return handler should actually save any real data.

- -

How you handle this is completely up to you. The recommended best practice is to use the CTools Object cache, and a good way to do this is to write a couple of wrapper functions around the cache that look like these example functions:

- -
-/**
- * Get the cached changes to a given task handler.
- */
-function delegator_page_get_page_cache($name) {
-  ctools_include('object-cache');
-  $cache = ctools_object_cache_get('delegator_page', $name);
-  if (!$cache) {
-    $cache = delegator_page_load($name);
-    $cache->locked = ctools_object_cache_test('delegator_page', $name);
-  }
-
-  return $cache;
-}
-
-/**
- * Store changes to a task handler in the object cache.
- */
-function delegator_page_set_page_cache($name, $page) {
-  ctools_include('object-cache');
-  $cache = ctools_object_cache_set('delegator_page', $name, $page);
-}
-
-/**
- * Remove an item from the object cache.
- */
-function delegator_page_clear_page_cache($name) {
-  ctools_include('object-cache');
-  ctools_object_cache_clear('delegator_page', $name);
-}
-
- -

Using these wrappers, when performing a get_cache operation, it defaults to loading the real object. It then checks to see if another user has this object cached using the ctools_object_cache_test() function, which automatically sets a lock (which can be used to prevent writes later on).

- -

With this set up, the _next, _finish and _cancel callbacks are quite simple:

- -
-/**
- * Callback generated when the add page process is finished.
- */
-function delegator_page_add_subtask_finish(&$form_state) {
-  $page = &$form_state['page'];
-
-  // Create a real object from the cache
-  delegator_page_save($page);
-
-  // Clear the cache
-  delegator_page_clear_page_cache($form_state['cache name']);
-}
-
-/**
- * Callback generated when the 'next' button is clicked.
- *
- * All we do here is store the cache.
- */
-function delegator_page_add_subtask_next(&$form_state) {
-  // Update the cache with changes.
-  delegator_page_set_page_cache($form_state['cache name'], $form_state['page']);
-}
-
-/**
- * Callback generated when the 'cancel' button is clicked.
- *
- * All we do here is clear the cache.
- */
-function delegator_page_add_subtask_cancel(&$form_state) {
-  // Update the cache with changes.
-  delegator_page_clear_page_cache($form_state['cache name']);
-}
-
- -

All that's needed to tie this together is to understand how the changes made it into the cache in the first place. This happened in the various form _submit handlers, which made changes to $form_state['page'] based upon the values set in the form:

- -
-/**
- * Store the values from the basic settings form.
- */
-function delegator_page_form_basic_submit($form, &$form_state) {
-  if (!isset($form_state['page']->pid) && empty($form_state['page']->import)) {
-    $form_state['page']->name = $form_state['values']['name'];
-  }
-
-  $form_state['page']->admin_title = $form_state['values']['admin_title'];
-  $form_state['page']->path = $form_state['values']['path'];
-
-  return $form;
-}
-
- -

No database operations were made during this _submit, and that's a very important distinction about this system.

- -

Proper handling of back button

-

When using 'show back' => TRUE the cached data should be assigned to the #default_value form property. Otherwise when the user goes back to the previous step the forms default values instead of his (cached) input is used.

- -
-/**
- * Form builder function for wizard.
- */
-function wizardid_step2_form($form, &$form_state) {
-  $form_state['my data'] = my_module_get_cache($form_state['cache name']);
-  $form['example'] = array(
-    '#type' => 'radios',
-    '#title' => t('Title'),
-    '#default_value' => $form_state['my data']->example ? $form_state['my data']->example : default,
-    '#options' => array(
-      'default' => t('Default'),
-      'setting1' => t('Setting1'),
-    ),
-  );
-
-  return $form;
-}
-
-/**
- * Submit handler to prepare needed values for storing in cache.
- */
-function wizardid_step2_form_submit($form, &$form_state) {
-  $form_state['my data']->example = $form_state['values']['example'];
-}
-
- -

The data is stored in the my data object on submitting. If the user goes back to this step the cached my data is used as the default form value. The function my_module_get_cache() is like the cache functions explained above.

- -

Required fields, cancel and back buttons

-

If you have required fields in your forms, the back and cancel buttons will not work as expected since validation of the form will fail. You can add the following code to the top of your form validation to avoid this problem:

-
-/**
- * Validation handler for step2 form
- */
-function wizardid_step2_form_validate(&$form, &$form_state) {
-  // if the clicked button is anything but the normal flow
-  if ($form_state['clicked_button']['#next'] != $form_state['next']) {
-    drupal_get_messages('error');
-    form_set_error(NULL, '', TRUE);
-    return;
-  }
-  // you form validation goes here
-  // ...
-}
-
- -

Wizard for anonymous users

-

If you are creating a wizard which is be used by anonymous users, you might run into some issues with drupal's caching for anonymous users. You can circumvent this by using hook_init and telling drupal to not cache your wizard pages:

-
-/**
- * Implementation of hook init
- */
-function mymodule_init() {
-  // if the path leads to the wizard
-  if (drupal_match_path($_GET['q'], 'path/to/your/wizard/*')) {
-    // set cache to false
-    $GLOBALS['conf']['cache'] = FALSE;   
-  }
-}
-
diff --git a/html/sites/all/modules/contrib/ctools/images/arrow-active.png b/html/sites/all/modules/contrib/ctools/images/arrow-active.png deleted file mode 100644 index 3bbd3c27f..000000000 Binary files a/html/sites/all/modules/contrib/ctools/images/arrow-active.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/images/collapsible-collapsed.png b/html/sites/all/modules/contrib/ctools/images/collapsible-collapsed.png deleted file mode 100644 index 95a214a6e..000000000 Binary files a/html/sites/all/modules/contrib/ctools/images/collapsible-collapsed.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/images/collapsible-expanded.png b/html/sites/all/modules/contrib/ctools/images/collapsible-expanded.png deleted file mode 100644 index 46f39ecb3..000000000 Binary files a/html/sites/all/modules/contrib/ctools/images/collapsible-expanded.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/images/expanded-options.png b/html/sites/all/modules/contrib/ctools/images/expanded-options.png deleted file mode 100644 index b7b755c0a..000000000 Binary files a/html/sites/all/modules/contrib/ctools/images/expanded-options.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/images/icon-close-window.png b/html/sites/all/modules/contrib/ctools/images/icon-close-window.png deleted file mode 100644 index 5f0cf695b..000000000 Binary files a/html/sites/all/modules/contrib/ctools/images/icon-close-window.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/images/icon-configure.png b/html/sites/all/modules/contrib/ctools/images/icon-configure.png deleted file mode 100644 index e23d67cc0..000000000 Binary files a/html/sites/all/modules/contrib/ctools/images/icon-configure.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/images/icon-delete.png b/html/sites/all/modules/contrib/ctools/images/icon-delete.png deleted file mode 100644 index 5f0cf695b..000000000 Binary files a/html/sites/all/modules/contrib/ctools/images/icon-delete.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/images/no-icon.png b/html/sites/all/modules/contrib/ctools/images/no-icon.png deleted file mode 100644 index fa78ec179..000000000 Binary files a/html/sites/all/modules/contrib/ctools/images/no-icon.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/images/status-active.gif b/html/sites/all/modules/contrib/ctools/images/status-active.gif deleted file mode 100644 index 207e95c3f..000000000 Binary files a/html/sites/all/modules/contrib/ctools/images/status-active.gif and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/images/throbber.gif b/html/sites/all/modules/contrib/ctools/images/throbber.gif deleted file mode 100644 index 8a084b844..000000000 Binary files a/html/sites/all/modules/contrib/ctools/images/throbber.gif and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/includes/action-links.theme.inc b/html/sites/all/modules/contrib/ctools/includes/action-links.theme.inc deleted file mode 100644 index f53f59c84..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/action-links.theme.inc +++ /dev/null @@ -1,34 +0,0 @@ - 'links', - 'file' => 'includes/action-links.theme.inc', - ); -} - -/** - * Render a menu local actions wrapper. - * - * @param $links - * Local actions links. - * @param $attributes - * An array of attributes to append to the wrapper. - */ -function theme_ctools_menu_local_actions_wrapper($variables) { - $links = drupal_render($variables['links']); - - if (empty($links)) { - return; - } - - return ''; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/ajax.inc b/html/sites/all/modules/contrib/ctools/includes/ajax.inc deleted file mode 100644 index 12f62ffb6..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/ajax.inc +++ /dev/null @@ -1,163 +0,0 @@ - $image)), $dest, $alt, $class); -} - -/** - * Render text as a link. This will automatically apply an AJAX class - * to the link and add the appropriate javascript to make this happen. - * - * Note: 'html' => true so be sure any text is vetted! Chances are these kinds of buttons will - * not use user input so this is a very minor concern. - * - * @param $text - * The text that will be displayed as the link. - * @param $dest - * The destination of the link. - * @param $alt - * The alt text of the link. - * @param $class - * Any class to apply to the link. @todo this should be a options array. - * @param $type - * A type to use, in case a different behavior should be attached. Defaults - * to ctools-use-ajax. - */ -function ctools_ajax_text_button($text, $dest, $alt, $class = '', $type = 'use-ajax') { - drupal_add_library('system', 'drupal.ajax'); - return l($text, $dest, array('html' => TRUE, 'attributes' => array('class' => array($type, $class), 'title' => $alt))); -} - -/** - * Render an icon and related text as a link. This will automatically apply an AJAX class - * to the link and add the appropriate javascript to make this happen. - * - * Note: 'html' => true so be sure any text is vetted! Chances are these kinds of buttons will - * not use user input so this is a very minor concern. - * - * @param $text - * The text that will be displayed as the link. - * @param $image - * The icon image to include in the link. - * @param $dest - * The destination of the link. - * @param $alt - * The title text of the link. - * @param $class - * Any class to apply to the link. @todo this should be a options array. - * @param $type - * A type to use, in case a different behavior should be attached. Defaults - * to ctools-use-ajax. - */ -function ctools_ajax_icon_text_button($text, $image, $dest, $alt, $class = '', $type = 'use-ajax') { - drupal_add_library('system', 'drupal.ajax'); - $rendered_image = theme('image', array('path' => $image)); - $link_content = $rendered_image . "" . $text . ""; - return l($link_content, $dest, array('html' => TRUE, 'attributes' => array('class' => array($type, $class), 'title' => $alt))); -} - -/** - * Set a single property to a value, on all matched elements. - * - * @param $selector - * The CSS selector. This can be any selector jquery uses in $(). - * @param $name - * The name or key: of the data attached to this selector. - * @param $value - * The value of the data. - */ -function ctools_ajax_command_attr($selector, $name, $value) { - ctools_add_js('ajax-responder'); - return array( - 'command' => 'attr', - 'selector' => $selector, - 'name' => $name, - 'value' => $value, - ); -} - -/** - * Force a client-side redirect. - * - * @param $url - * The url to be redirected to. This can be an absolute URL or a - * Drupal path. - * @param $delay - * A delay before applying the redirection, in milliseconds. - * @param $options - * An array of options to pass to the url() function. - */ -function ctools_ajax_command_redirect($url, $delay = 0, $options = array()) { - ctools_add_js('ajax-responder'); - return array( - 'command' => 'redirect', - 'url' => url($url, $options), - 'delay' => $delay, - ); -} - -/** - * Force a reload of the current page. - */ -function ctools_ajax_command_reload() { - ctools_add_js('ajax-responder'); - return array( - 'command' => 'reload', - ); -} - -/** - * Submit a form. - * - * This is useful for submitting a parent form after a child form has finished - * processing in a modal overlay. - * - * @param $selector - * The CSS selector to identify the form for submission. This can be any - * selector jquery uses in $(). - */ -function ctools_ajax_command_submit($selector) { - ctools_add_js('ajax-responder'); - return array( - 'command' => 'submit', - 'selector' => $selector, - ); -} - -/** - * Send an error response back via AJAX and immediately exit. - */ -function ctools_ajax_render_error($error = '') { - if (!$error) { - $error = t('An error occurred while handling the request: The server received invalid input.'); - } - $commands = array(); - $commands[] = ajax_command_alert($error); - print ajax_render($commands); - exit; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/cache.inc b/html/sites/all/modules/contrib/ctools/includes/cache.inc deleted file mode 100644 index cace8002e..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/cache.inc +++ /dev/null @@ -1,162 +0,0 @@ - TRUE, - 'ignore words' => array(), - 'separator' => '-', - 'replacements' => array(), - 'transliterate' => FALSE, - 'reduce ascii' => TRUE, - 'max length' => FALSE, - 'lower case' => FALSE, - ); - - // Allow modules to make other changes to the settings. - if (isset($settings['clean id'])) { - drupal_alter('ctools_cleanstring_' . $settings['clean id'], $settings); - } - - drupal_alter('ctools_cleanstring', $settings); - - $output = $string; - - // Do any replacements the user selected up front. - if (!empty($settings['replacements'])) { - $output = strtr($output, $settings['replacements']); - } - - // Remove slashes if instructed to do so. - if ($settings['clean slash']) { - $output = str_replace('/', '', $output); - } - - if (!empty($settings['transliterate']) && module_exists('transliteration')) { - $output = transliteration_get($output); - } - - // Reduce to the subset of ASCII96 letters and numbers. - if ($settings['reduce ascii']) { - $pattern = '/[^a-zA-Z0-9\/]+/'; - $output = preg_replace($pattern, $settings['separator'], $output); - } - - // Get rid of words that are on the ignore list. - if (!empty($settings['ignore words'])) { - $ignore_re = '\b' . preg_replace('/,/', '\b|\b', $settings['ignore words']) . '\b'; - - if (function_exists('mb_eregi_replace')) { - $output = mb_eregi_replace($ignore_re, '', $output); - } - else { - $output = preg_replace("/$ignore_re/i", '', $output); - } - } - - // Always replace whitespace with the separator. - $output = preg_replace('/\s+/', $settings['separator'], $output); - - // In preparation for pattern matching, - // escape the separator if and only if it is not alphanumeric. - if (isset($settings['separator'])) { - if (preg_match('/^[^' . CTOOLS_PREG_CLASS_ALNUM . ']+$/uD', $settings['separator'])) { - $seppattern = $settings['separator']; - } - else { - $seppattern = '\\' . $settings['separator']; - } - // Trim any leading or trailing separators (note the need to. - $output = preg_replace("/^$seppattern+|$seppattern+$/", '', $output); - - // Replace multiple separators with a single one. - $output = preg_replace("/$seppattern+/", $settings['separator'], $output); - } - - // Enforce the maximum component length. - if (!empty($settings['max length'])) { - $output = ctools_cleanstring_truncate($output, $settings['max length'], $settings['separator']); - } - - if (!empty($settings['lower case'])) { - $output = drupal_strtolower($output); - } - return $output; -} - -/** - * A friendly version of truncate_utf8. - * - * @param $string - * The string to be truncated. - * @param $length - * An integer for the maximum desired length. - * @param $separator - * A string which contains the word boundary such as - or _. - * - * @return - * The string truncated below the maxlength. - */ -function ctools_cleanstring_truncate($string, $length, $separator) { - if (drupal_strlen($string) > $length) { - // Leave one more character. - $string = drupal_substr($string, 0, $length + 1); - // Space exists AND is not on position 0. - if ($last_break = strrpos($string, $separator)) { - $string = substr($string, 0, $last_break); - } - else { - $string = drupal_substr($string, 0, $length); - } - } - return $string; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/collapsible.theme.inc b/html/sites/all/modules/contrib/ctools/includes/collapsible.theme.inc deleted file mode 100644 index 81df4bccd..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/collapsible.theme.inc +++ /dev/null @@ -1,78 +0,0 @@ - array('handle' => NULL, 'content' => NULL, 'collapsed' => FALSE), - 'file' => 'includes/collapsible.theme.inc', - ); - $items['ctools_collapsible_remembered'] = array( - 'variables' => array('id' => NULL, 'handle' => NULL, 'content' => NULL, 'collapsed' => FALSE), - 'file' => 'includes/collapsible.theme.inc', - ); -} - -/** - * Render a collapsible div. - * - * @param $handle - * Text to put in the handle/title area of the div. - * @param $content - * Text to put in the content area of the div, this is what will get - * collapsed. - * @param $collapsed - * If true, this div will start out collapsed. - */ -function theme_ctools_collapsible($vars) { - ctools_add_js('collapsible-div'); - ctools_add_css('collapsible-div'); - - $class = $vars['collapsed'] ? ' ctools-collapsed' : ''; - $output = '
'; - $output .= '
' . $vars['handle'] . '
'; - $output .= '
' . $vars['content'] . '
'; - $output .= '
'; - - return $output; -} - -/** - * Render a collapsible div whose state will be remembered. - * - * @param $id - * The CSS id of the container. This is required. - * @param $handle - * Text to put in the handle/title area of the div. - * @param $content - * Text to put in the content area of the div, this is what will get - * collapsed. - * @param $collapsed - * If true, this div will start out collapsed. - */ -function theme_ctools_collapsible_remembered($vars) { - $id = $vars['id']; - $handle = $vars['handle']; - $content = $vars['content']; - $collapsed = $vars['collapsed']; - ctools_add_js('collapsible-div'); - ctools_add_css('collapsible-div'); - - $class = $collapsed ? ' ctools-collapsed' : ''; - $output = '
'; - $output .= '
' . $handle . '
'; - $output .= '
' . $content . '
'; - $output .= '
'; - - return $output; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/content.inc b/html/sites/all/modules/contrib/ctools/includes/content.inc deleted file mode 100644 index dfc16e691..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/content.inc +++ /dev/null @@ -1,865 +0,0 @@ - $plugin['title'], - 'description' => $plugin['description'], - 'icon' => ctools_content_admin_icon($plugin), - 'category' => $plugin['category'], - ); - - if (isset($plugin['required context'])) { - $type['required context'] = $plugin['required context']; - } - if (isset($plugin['top level'])) { - $type['top level'] = $plugin['top level']; - } - $plugin['content types'] = array($plugin['name'] => $type); - if (!isset($plugin['single'])) { - $plugin['single'] = TRUE; - } - } - } -} - -/** - * Fetch metadata on a specific content_type plugin. - * - * @param mixed $content - * Name of a panel content type. - * - * @return - * An array with information about the requested panel content type. - */ -function ctools_get_content_type($content_type) { - ctools_include('context'); - ctools_include('plugins'); - return ctools_get_plugins('ctools', 'content_types', $content_type); -} - -/** - * Fetch metadata for all content_type plugins. - * - * @return - * An array of arrays with information about all available panel content types. - */ -function ctools_get_content_types() { - ctools_include('context'); - ctools_include('plugins'); - return ctools_get_plugins('ctools', 'content_types'); -} - -/** - * Get all of the individual subtypes provided by a given content type. This - * would be all of the blocks for the block type, or all of the views for - * the view type. - * - * @param $type - * The content type to load. - * - * @return - * An array of all subtypes available. - */ -function ctools_content_get_subtypes($type) { - static $cache = array(); - - $subtypes = array(); - - if (is_array($type)) { - $plugin = $type; - } - else { - $plugin = ctools_get_content_type($type); - } - - if (empty($plugin) || empty($plugin['name'])) { - return; - } - - if (isset($cache[$plugin['name']])) { - return $cache[$plugin['name']]; - } - - if (isset($plugin['content types'])) { - $function = $plugin['content types']; - if (is_array($function)) { - $subtypes = $function; - } - elseif (function_exists($function)) { - // Cast to array to prevent errors from non-array returns. - $subtypes = (array) $function($plugin); - } - } - - // Walk through the subtypes and ensure minimal settings are - // retained. - foreach ($subtypes as $id => $subtype) { - // Ensure that the 'subtype_id' value exists. - if (!isset($subtype['subtype_id'])) { - $subtypes[$id]['subtype_id'] = $id; - } - - // Use exact name since this is a modify by reference. - ctools_content_prepare_subtype($subtypes[$id], $plugin); - } - - $cache[$plugin['name']] = $subtypes; - - return $subtypes; -} - -/** - * Given a content type and a subtype id, return the information about that - * content subtype. - * - * @param $type - * The content type being fetched. - * @param $subtype_id - * The id of the subtype being fetched. - * - * @return - * An array of information describing the content subtype. - */ -function ctools_content_get_subtype($type, $subtype_id) { - $subtype = array(); - if (is_array($type)) { - $plugin = $type; - } - else { - $plugin = ctools_get_content_type($type); - } - - $function = ctools_plugin_get_function($plugin, 'content type'); - if ($function) { - $subtype = $function($subtype_id, $plugin); - } - else { - $subtypes = ctools_content_get_subtypes($type); - if (isset($subtypes[$subtype_id])) { - $subtype = $subtypes[$subtype_id]; - } - // If there's only 1 and we somehow have the wrong subtype ID, do not - // care. Return the proper subtype anyway. - if (empty($subtype) && !empty($plugin['single'])) { - $subtype = current($subtypes); - } - } - - if ($subtype) { - // Ensure that the 'subtype_id' value exists. This is also done in - // ctools_content_get_subtypes(), but it wouldn't be called if the plugin - // provides the subtype through its own function. - if (!isset($subtype['subtype_id'])) { - $subtype['subtype_id'] = $subtype_id; - } - - ctools_content_prepare_subtype($subtype, $plugin); - } - return $subtype; -} - -/** - * Ensure minimal required settings on a content subtype exist. - */ -function ctools_content_prepare_subtype(&$subtype, $plugin) { - foreach (array('path', 'js', 'css') as $key) { - if (!isset($subtype[$key]) && isset($plugin[$key])) { - $subtype[$key] = $plugin[$key]; - } - } - - // Trigger hook_ctools_content_subtype_alter(). - drupal_alter('ctools_content_subtype', $subtype, $plugin); -} - -/** - * Get the content from a given content type. - * - * @param $type - * The content type. May be the name or an already loaded content type plugin. - * @param $subtype - * The name of the subtype being rendered. - * @param $conf - * The configuration for the content type. - * @param $keywords - * An array of replacement keywords that come from outside contexts. - * @param $args - * The arguments provided to the owner of the content type. Some content may - * wish to configure itself based on the arguments the panel or dashboard - * received. - * @param $context - * An array of context objects available for use. - * @param $incoming_content - * Any incoming content, if this display is a wrapper. - * - * @return - * The content as rendered by the plugin, or NULL. - * This content should be an object with the following possible properties: - * - title: The safe to render title of the content. - * - title_heading: The title heading. - * - content: The safe to render HTML content. - * - links: An array of links associated with the content suitable for - * theme('links'). - * - more: An optional 'more' link (destination only) - * - admin_links: Administrative links associated with the content, suitable - * for theme('links'). - * - feeds: An array of feed icons or links associated with the content. - * Each member of the array is rendered HTML. - * - type: The content type. - * - subtype: The content subtype. These two may be used together as - * module-delta for block style rendering. - */ -function ctools_content_render($type, $subtype, $conf, $keywords = array(), $args = array(), $context = array(), $incoming_content = '') { - if (is_array($type)) { - $plugin = $type; - } - else { - $plugin = ctools_get_content_type($type); - } - - $subtype_info = ctools_content_get_subtype($plugin, $subtype); - - $function = ctools_plugin_get_function($subtype_info, 'render callback'); - if (!$function) { - $function = ctools_plugin_get_function($plugin, 'render callback'); - } - - if ($function) { - $pane_context = ctools_content_select_context($plugin, $subtype, $conf, $context); - if ($pane_context === FALSE) { - return; - } - - $content = $function($subtype, $conf, $args, $pane_context, $incoming_content); - - if (empty($content)) { - return; - } - - // Set up some defaults and other massaging on the content before we hand - // it back to the caller. - if (!isset($content->type)) { - $content->type = $plugin['name']; - } - - if (!isset($content->subtype)) { - $content->subtype = $subtype; - } - - // Override the title if configured to. - if (!empty($conf['override_title'])) { - // Give previous title as an available substitution here. - $keywords['%title'] = empty($content->title) ? '' : $content->title; - $content->original_title = $keywords['%title']; - $content->title = $conf['override_title_text']; - $content->title_heading = isset($conf['override_title_heading']) ? $conf['override_title_heading'] : 'h2'; - } - - if (!empty($content->title)) { - // Perform substitutions. - if (!empty($keywords) || !empty($context)) { - $content->title = ctools_context_keyword_substitute($content->title, $keywords, $context); - } - - // Sterilize the title. - $content->title = filter_xss_admin($content->title); - - // If a link is specified, populate. - if (!empty($content->title_link)) { - if (!is_array($content->title_link)) { - $url = array('href' => $content->title_link); - } - else { - $url = $content->title_link; - } - // Set defaults so we don't bring up notices. - $url += array('href' => '', 'attributes' => array(), 'query' => array(), 'fragment' => '', 'absolute' => NULL, 'html' => TRUE); - $content->title = l($content->title, $url['href'], $url); - } - } - - return $content; - } -} - -/** - * Determine if a content type can be edited or not. - * - * Some content types simply have their content and no options. This function - * lets a UI determine if it should display an edit link or not. - */ -function ctools_content_editable($type, $subtype, $conf) { - if (empty($type['edit form']) && empty($subtype['edit form'])) { - return FALSE; - } - - $function = FALSE; - - if (!empty($subtype['check editable'])) { - $function = ctools_plugin_get_function($subtype, 'check editable'); - } - elseif (!empty($type['check editable'])) { - $function = ctools_plugin_get_function($type, 'check editable'); - } - - if ($function) { - return $function($type, $subtype, $conf); - } - - return TRUE; -} - -/** - * Get the administrative title from a given content type. - * - * @param $type - * The content type. May be the name or an already loaded content type object. - * @param $subtype - * The subtype being rendered. - * @param $conf - * The configuration for the content type. - * @param $context - * An array of context objects available for use. These may be placeholders. - */ -function ctools_content_admin_title($type, $subtype, $conf, $context = NULL) { - if (is_array($type)) { - $plugin = $type; - } - elseif (is_string($type)) { - $plugin = ctools_get_content_type($type); - } - else { - return; - } - - if ($function = ctools_plugin_get_function($plugin, 'admin title')) { - $pane_context = ctools_content_select_context($plugin, $subtype, $conf, $context); - if ($pane_context === FALSE) { - if ($plugin['name'] == $subtype) { - return t('@type will not display due to missing context', array('@type' => $plugin['name'])); - } - return t('@type:@subtype will not display due to missing context', array('@type' => $plugin['name'], '@subtype' => $subtype)); - } - - return $function($subtype, $conf, $pane_context); - } - elseif (isset($plugin['admin title'])) { - return $plugin['admin title']; - } - elseif (isset($plugin['title'])) { - return $plugin['title']; - } -} - -/** - * Get the proper icon path to use, falling back to default icons if no icon exists. - * - * $subtype - * The loaded subtype info. - */ -function ctools_content_admin_icon($subtype) { - $icon = ''; - - if (isset($subtype['icon'])) { - $icon = $subtype['icon']; - if (!file_exists($icon)) { - $icon = $subtype['path'] . '/' . $icon; - } - } - - if (empty($icon) || !file_exists($icon)) { - $icon = ctools_image_path('no-icon.png'); - } - - return $icon; -} - -/** - * Set up the default $conf for a new instance of a content type. - */ -function ctools_content_get_defaults($plugin, $subtype) { - if (isset($plugin['defaults'])) { - $defaults = $plugin['defaults']; - } - elseif (isset($subtype['defaults'])) { - $defaults = $subtype['defaults']; - } - if (isset($defaults)) { - if (is_string($defaults) && function_exists($defaults)) { - if ($return = $defaults($pane)) { - return $return; - } - } - elseif (is_array($defaults)) { - return $defaults; - } - } - - return array(); -} - -/** - * Get the administrative title from a given content type. - * - * @param $type - * The content type. May be the name or an already loaded content type object. - * @param $subtype - * The subtype being rendered. - * @param $conf - * The configuration for the content type. - * @param $context - * An array of context objects available for use. These may be placeholders. - */ -function ctools_content_admin_info($type, $subtype, $conf, $context = NULL) { - if (is_array($type)) { - $plugin = $type; - } - else { - $plugin = ctools_get_content_type($type); - } - - if ($function = ctools_plugin_get_function($plugin, 'admin info')) { - $output = $function($subtype, $conf, $context); - } - - if (empty($output) || !is_object($output)) { - $output = new stdClass(); - // Replace the _ with " " for a better output. - $subtype = check_plain(str_replace("_", " ", $subtype)); - $output->title = $subtype; - $output->content = t('No info available.'); - } - return $output; -} - -/** - * Add the default FAPI elements to the content type configuration form. - */ -function ctools_content_configure_form_defaults($form, &$form_state) { - $plugin = $form_state['plugin']; - $subtype = $form_state['subtype']; - $contexts = isset($form_state['contexts']) ? $form_state['contexts'] : NULL; - $conf = $form_state['conf']; - - $add_submit = FALSE; - if (!empty($subtype['required context']) && is_array($contexts)) { - $form['context'] = ctools_context_selector($contexts, $subtype['required context'], isset($conf['context']) ? $conf['context'] : array()); - $add_submit = TRUE; - } - - ctools_include('dependent'); - - // Unless we're not allowed to override the title on this content type, add this - // gadget to all panes. - if (empty($plugin['no title override']) && empty($subtype['no title override'])) { - $form['aligner_start'] = array( - '#markup' => '
', - ); - $form['override_title'] = array( - '#type' => 'checkbox', - '#default_value' => isset($conf['override_title']) ? $conf['override_title'] : '', - '#title' => t('Override title'), - '#id' => 'override-title-checkbox', - ); - $form['override_title_text'] = array( - '#type' => 'textfield', - '#default_value' => isset($conf['override_title_text']) ? $conf['override_title_text'] : '', - '#size' => 35, - '#id' => 'override-title-textfield', - '#dependency' => array('override-title-checkbox' => array(1)), - '#dependency_type' => 'hidden', - ); - $form['override_title_heading'] = array( - '#type' => 'select', - '#default_value' => isset($conf['override_title_heading']) ? $conf['override_title_heading'] : 'h2', - '#options' => array( - 'h1' => t('h1'), - 'h2' => t('h2'), - 'h3' => t('h3'), - 'h4' => t('h4'), - 'h5' => t('h5'), - 'h6' => t('h6'), - 'div' => t('div'), - 'span' => t('span'), - ), - '#id' => 'override-title-heading', - '#dependency' => array('override-title-checkbox' => array(1)), - '#dependency_type' => 'hidden', - ); - - $form['aligner_stop'] = array( - '#markup' => '
', - ); - if (is_array($contexts)) { - $form['override_title_markup'] = array( - '#prefix' => '
', - '#suffix' => '
', - '#markup' => t('You may use %keywords from contexts, as well as %title to contain the original title.'), - ); - } - $add_submit = TRUE; - } - - if ($add_submit) { - // '#submit' is already set up due to the wizard. - $form['#submit'][] = 'ctools_content_configure_form_defaults_submit'; - } - return $form; -} - -/** - * Submit handler to store context/title override info. - */ -function ctools_content_configure_form_defaults_submit(&$form, &$form_state) { - if (isset($form_state['values']['context'])) { - $form_state['conf']['context'] = $form_state['values']['context']; - } - if (isset($form_state['values']['override_title'])) { - $form_state['conf']['override_title'] = $form_state['values']['override_title']; - $form_state['conf']['override_title_text'] = $form_state['values']['override_title_text']; - $form_state['conf']['override_title_heading'] = $form_state['values']['override_title_heading']; - } -} - -/** - * Get the config form. - * - * The $form_info and $form_state need to be preconfigured with data you'll need - * such as whether or not you're using ajax, or the modal. $form_info will need - * your next/submit callbacks so that you can cache your data appropriately. - * - * @return - * If this function returns false, no form exists. - */ -function ctools_content_form($op, $form_info, &$form_state, $plugin, $subtype_name, $subtype, &$conf, $step = NULL) { - $form_state += array( - 'plugin' => $plugin, - 'subtype' => $subtype, - 'subtype_name' => $subtype_name, - 'conf' => &$conf, - 'op' => $op, - ); - - $form_info += array( - 'id' => 'ctools_content_form', - 'show back' => TRUE, - ); - - // Turn the forms defined in the plugin into the format the wizard needs. - if ($op == 'add') { - if (!empty($subtype['add form'])) { - _ctools_content_create_form_info($form_info, $subtype['add form'], $subtype, $subtype, $op); - } - elseif (!empty($plugin['add form'])) { - _ctools_content_create_form_info($form_info, $plugin['add form'], $plugin, $subtype, $op); - } - } - - if (empty($form_info['order'])) { - // Use the edit form for the add form if add form was completely left off. - if (!empty($subtype['edit form'])) { - _ctools_content_create_form_info($form_info, $subtype['edit form'], $subtype, $subtype, $op); - } - elseif (!empty($plugin['edit form'])) { - _ctools_content_create_form_info($form_info, $plugin['edit form'], $plugin, $subtype, $op); - } - } - - if (empty($form_info['order'])) { - return FALSE; - } - - ctools_include('wizard'); - return ctools_wizard_multistep_form($form_info, $step, $form_state); - -} - -function _ctools_content_create_form_info(&$form_info, $info, $plugin, $subtype, $op) { - if (is_string($info)) { - if (empty($subtype['title'])) { - $title = t('Configure'); - } - elseif ($op == 'add') { - $title = t('Configure new !subtype_title', array('!subtype_title' => t($subtype['title']))); - } - else { - $title = t('Configure !subtype_title', array('!subtype_title' => t($subtype['title']))); - } - $form_info['order'] = array('form' => $title); - $form_info['forms'] = array( - 'form' => array( - 'title' => $title, - 'form id' => $info, - 'wrapper' => 'ctools_content_configure_form_defaults', - ), - ); - } - elseif (is_array($info)) { - $form_info['order'] = array(); - $form_info['forms'] = array(); - $count = 0; - $base = 'step'; - $wrapper = NULL; - foreach ($info as $form_id => $title) { - // @todo -- docs say %title can be used to sub for the admin title. - $step = $base . ++$count; - if (empty($wrapper)) { - $wrapper = $step; - } - - if (is_array($title)) { - if (!empty($title['default'])) { - $wrapper = $step; - } - $title = $title['title']; - } - - $form_info['order'][$step] = $title; - $form_info['forms'][$step] = array( - 'title' => $title, - 'form id' => $form_id, - ); - } - if ($wrapper) { - $form_info['forms'][$wrapper]['wrapper'] = 'ctools_content_configure_form_defaults'; - } - } -} - -/** - * Get an array of all available content types that can be fed into the - * display editor for the add content list. - * - * @param $context - * If a context is provided, content that requires that context can apepar. - * @param $has_content - * Whether or not the display will have incoming content - * @param $allowed_types - * An array of allowed content types (pane types) keyed by content_type . '-' . sub_type - * @param $default_types - * A default allowed/denied status for content that isn't known about - */ -function ctools_content_get_available_types($contexts = NULL, $has_content = FALSE, $allowed_types = NULL, $default_types = NULL) { - $plugins = ctools_get_content_types(); - $available = array(); - - foreach ($plugins as $id => $plugin) { - foreach (ctools_content_get_subtypes($plugin) as $subtype_id => $subtype) { - // Exclude items that require content if we're saying we don't - // provide it. - if (!empty($subtype['requires content']) && !$has_content) { - continue; - } - - // Check to see if the content type can be used in this context. - if (!empty($subtype['required context'])) { - if (!ctools_context_match_requirements($contexts, $subtype['required context'])) { - continue; - } - } - - // Check to see if the passed-in allowed types allows this content. - if ($allowed_types) { - $key = $id . '-' . $subtype_id; - if (!isset($allowed_types[$key])) { - $allowed_types[$key] = isset($default_types[$id]) ? $default_types[$id] : $default_types['other']; - } - if (!$allowed_types[$key]) { - continue; - } - } - - // Check if the content type provides an access callback. - if (isset($subtype['create content access']) && function_exists($subtype['create content access']) && !$subtype['create content access']($plugin, $subtype)) { - continue; - } - - // If we made it through all the tests, then we can use this content. - $available[$id][$subtype_id] = $subtype; - } - } - return $available; -} - -/** - * Get an array of all content types that can be fed into the - * display editor for the add content list, regardless of - * availability. - */ -function ctools_content_get_all_types() { - $plugins = ctools_get_content_types(); - $available = array(); - - foreach ($plugins as $id => $plugin) { - foreach (ctools_content_get_subtypes($plugin) as $subtype_id => $subtype) { - // If we made it through all the tests, then we can use this content. - $available[$id][$subtype_id] = $subtype; - } - } - return $available; -} - -/** - * Select the context to be used for a piece of content, based upon config. - * - * @param $plugin - * The content plugin - * @param $subtype - * The subtype of the content. - * @param $conf - * The configuration array that should contain the context. - * @param $contexts - * A keyed array of available contexts. - * - * @return - * The matching contexts or NULL if none or necessary, or FALSE if - * requirements can't be met. - */ -function ctools_content_select_context($plugin, $subtype, $conf, $contexts) { - // Identify which of our possible contexts apply. - if (empty($subtype)) { - return; - } - - $subtype_info = ctools_content_get_subtype($plugin, $subtype); - if (empty($subtype_info)) { - return; - } - - if (!empty($subtype_info['all contexts']) || !empty($plugin['all contexts'])) { - return $contexts; - } - - // If the content requires a context, fetch it; if no context is returned, - // do not display the pane. - if (empty($subtype_info['required context'])) { - return; - } - - // Deal with dynamic required contexts not getting updated in the panes. - // For example, Views let you dynamically change context info. While - // we cannot be perfect, one thing we can do is if no context at all - // was asked for, and then was later added but none is selected, make - // a best guess as to what context should be used. THis is right more - // than it's wrong. - if (is_array($subtype_info['required context'])) { - if (empty($conf['context']) || count($subtype_info['required context']) != count($conf['context'])) { - foreach ($subtype_info['required context'] as $index => $required) { - if (!isset($conf['context'][$index])) { - $filtered = ctools_context_filter($contexts, $required); - if ($filtered) { - $keys = array_keys($filtered); - $conf['context'][$index] = array_shift($keys); - } - } - } - } - } - else { - if (empty($conf['context'])) { - $filtered = ctools_context_filter($contexts, $subtype_info['required context']); - if ($filtered) { - $keys = array_keys($filtered); - $conf['context'] = array_shift($keys); - } - } - } - - if (empty($conf['context'])) { - return; - } - - $context = ctools_context_select($contexts, $subtype_info['required context'], $conf['context']); - - return $context; -} - -/** - * Fetch a piece of content from the addressable content system. - * - * @param $address - * A string or an array representing the address of the content. - * @param $type - * The type of content to return. The type is dependent on what - * the content actually is. The default, 'content' means a simple - * string representing the content. However, richer systems may - * offer more options. For example, Panels might allow the - * fetching of 'display' and 'pane' objects. Page Manager - * might allow for the fetching of 'task_handler' objects - * (AKA variants). - */ -function ctools_get_addressable_content($address, $type = 'content') { - if (!is_array($address)) { - $address = explode('::', $address); - } - - if (!$address) { - return; - } - - // This removes the module from the address so the - // implementor is not responsible for that part. - $module = array_shift($address); - return module_invoke($module, 'addressable_content', $address, $type); -} diff --git a/html/sites/all/modules/contrib/ctools/includes/content.menu.inc b/html/sites/all/modules/contrib/ctools/includes/content.menu.inc deleted file mode 100644 index 64d44b0bf..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/content.menu.inc +++ /dev/null @@ -1,178 +0,0 @@ - array('access content'), - 'type' => MENU_CALLBACK, - 'file' => 'includes/content.menu.inc', - ); - $items['ctools/autocomplete/%'] = array( - 'page callback' => 'ctools_content_autocomplete_entity', - 'page arguments' => array(2), - ) + $base; -} - -/** - * Helper function for autocompletion of entity titles. - */ -function ctools_content_autocomplete_entity($entity_type, $string = '') { - if ($string != '') { - $entity_info = entity_get_info($entity_type); - - if (!module_exists('entity')) { - module_load_include('inc', 'ctools', 'includes/entity-access'); - _ctools_entity_access($entity_info, $entity_type); - } - - // We must query all ids, because if every one of the 10 don't have access - // the user may never be able to autocomplete a node title. - $preg_matches = array(); - $matches = array(); - $match = preg_match('/\[id: (\d+)\]/', $string, $preg_matches); - if (!$match) { - $match = preg_match('/^id: (\d+)/', $string, $preg_matches); - } - // If an ID match was found, use that ID rather than the whole string. - if ($match) { - $entity_id = $preg_matches[1]; - $results = _ctools_getReferencableEntities($entity_type, $entity_info, $entity_id, '=', 1); - } - else { - // We cannot find results if the entity doesn't have a label to search. - if (!isset($entity_info['entity keys']['label'])) { - drupal_json_output(array("[id: NULL]" => '' . t('Entity Type !entity_type does not support autocomplete search.', array('!entity_type' => $entity_type)) . '')); - return; - } - $results = _ctools_getReferencableEntities($entity_type, $entity_info, $string, 'LIKE', 10); - } - foreach ($results as $entity_id => $result) { - $matches[$result['label'] . " [id: $entity_id]"] = '' . check_plain($result['label']) . ''; - $matches[$result['label'] . " [id: $entity_id]"] .= isset($result['bundle']) ? ' (' . check_plain($result['bundle']) . ')' : ''; - } - - drupal_json_output($matches); - } -} - -/** - * Use EntityReference_SelectionHandler_Generic class to build our search query. - */ -function _ctools_buildQuery($entity_type, $entity_info, $match = NULL, $match_operator = 'CONTAINS') { - $base_table = $entity_info['base table']; - $label_key = $entity_info['entity keys']['label']; - $query = db_select($base_table) - ->fields($base_table, array($entity_info['entity keys']['id'])); - - if (isset($match)) { - if (isset($label_key)) { - $query->condition($base_table . '.' . $label_key, '%' . $match . '%', $match_operator); - } - // This should never happen, but double check just in case. - else { - return array(); - } - } - // Add a generic entity access tag to the query. - $query->addTag('ctools'); - - // We have to perform two checks. First check is a query alter (with tags) - // in an attempt to only return results that have access. However, this is - // not full-proof since entities many not implement hook_access query tag. - // This is why we have a second check after entity load, before we display - // the label of an entity. - if ($entity_type == 'comment') { - // Adding the 'comment_access' tag is sadly insufficient for comments: core
 - // requires us to also know about the concept of 'published' and
 - // 'unpublished'. - if (!user_access('administer comments')) { - $query->condition('comment.status', COMMENT_PUBLISHED); - } - - // Join to a node if the user does not have node access bypass permissions
 - // to obey node published permissions. - if (!user_access('bypass node access')) { - $node_alias = $query->innerJoin('node', 'n', '%alias.nid = comment.nid'); - $query->condition($node_alias . '.status', NODE_PUBLISHED); - } - $query->addTag('node_access'); - } - else { - $query->addTag($entity_type . '_access'); - } - - // Add the sort option. - if (isset($label_key)) { - $query->orderBy($base_table . '.' . $label_key, 'ASC'); - } - - return $query; -} - -/** - * Private function to get referencable entities. Based on code from the - * Entity Reference module. - */ -function _ctools_getReferencableEntities($entity_type, $entity_info, $match = NULL, $match_operator = 'LIKE', $limit = 0) { - global $user; - $account = $user; - $options = array(); - // We're an entity ID, return the id. - if (is_numeric($match) && $match_operator == '=') { - if ($entity = array_shift(entity_load($entity_type, array($match)))) { - if (isset($entity_info['access callback']) && function_exists($entity_info['access callback'])) { - if ($entity_info['access callback']('view', $entity, $account, $entity_type)) { - $label = entity_label($entity_type, $entity); - return array( - $match => array( - 'label' => !empty($label) ? $label : $entity->{$entity_info['entity keys']['id']}, - 'bundle' => !empty($entity_info['entity keys']['bundle']) ? check_plain($entity->{$entity_info['entity keys']['bundle']}) : NULL, - ), - ); - } - } - } - // If you don't have access, or an access callback or a valid entity, just - // Return back the Entity ID. - return array( - $match => array( - 'label' => $match, - 'bundle' => NULL, - ), - ); - } - - // We have matches, build a query to fetch the result. - if ($query = _ctools_buildQuery($entity_type, $entity_info, $match, $match_operator)) { - if ($limit > 0) { - $query->range(0, $limit); - } - - $results = $query->execute(); - - if (!empty($results)) { - foreach ($results as $record) { - $entities = entity_load($entity_type, array($record->{$entity_info['entity keys']['id']})); - $entity = array_shift($entities); - if (isset($entity_info['access callback']) && function_exists($entity_info['access callback'])) { - if ($entity_info['access callback']('view', $entity, $account, $entity_type)) { - $label = entity_label($entity_type, $entity); - $options[$record->{$entity_info['entity keys']['id']}] = array( - 'label' => !empty($label) ? $label : $entity->{$entity_info['entity keys']['id']}, - 'bundle' => !empty($entity_info['entity keys']['bundle']) ? check_plain($entity->{$entity_info['entity keys']['bundle']}) : NULL, - ); - } - } - } - } - return $options; - } - return array(); -} diff --git a/html/sites/all/modules/contrib/ctools/includes/content.plugin-type.inc b/html/sites/all/modules/contrib/ctools/includes/content.plugin-type.inc deleted file mode 100644 index 0364a927a..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/content.plugin-type.inc +++ /dev/null @@ -1,17 +0,0 @@ - FALSE, - 'process' => array( - 'function' => 'ctools_content_process', - 'file' => 'content.inc', - 'path' => drupal_get_path('module', 'ctools') . '/includes', - ), - ); -} diff --git a/html/sites/all/modules/contrib/ctools/includes/content.theme.inc b/html/sites/all/modules/contrib/ctools/includes/content.theme.inc deleted file mode 100644 index ae4456aa7..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/content.theme.inc +++ /dev/null @@ -1,21 +0,0 @@ - array( - * 0 => array( - * 'name' => 'name of access plugin', - * 'settings' => array(), // These will be set by the form - * ), - * // ... as many as needed - * ), - * 'logic' => 'AND', // or 'OR', - * ), - * @endcode - * - * To add this widget to your UI, you need to do a little bit of setup. - * - * The form will utilize two callbacks, one to get the cached version - * of the access settings, and one to store the cached version of the - * access settings. These will be used from AJAX forms, so they will - * be completely out of the context of this page load and will not have - * knowledge of anything sent to this form (the 'module' and 'argument' - * will be preserved through the URL only). - * - * The 'module' is used to determine the location of the callback. It - * does not strictly need to be a module, so that if your module defines - * multiple systems that use this callback, it can use anything within the - * module's namespace it likes. - * - * When retrieving the cache, the cache may not have already been set up; - * In order to efficiently use cache space, we want to cache the stored - * settings *only* when they have changed. Therefore, the get access cache - * callback should first look for cache, and if it finds nothing, return - * the original settings. - * - * The callbacks: - * - $module . _ctools_access_get($argument) -- get the 'access' settings - * from cache. Must return array($access, $contexts); This callback can - * perform access checking to make sure this URL is not being gamed. - * - $module . _ctools_access_set($argument, $access) -- set the 'access' - * settings in cache. - * - $module . _ctools_access_clear($argument) -- clear the cache. - * - * The ctools_object_cache is recommended for this purpose, but you can use - * any caching mechanism you like. An example: - * - * @code{ - * ctools_include('object-cache'); - * ctools_object_cache_set("$module:argument", $access); - * } - * @endcode - * - * To utilize this form: - * @code - * ctools_include('context-access-admin'); - * $form_state = array( - * 'access' => $access, - * 'module' => 'module name', - * 'callback argument' => 'some string', - * 'contexts' => $contexts, // an array of contexts. Optional if no contexts. - * // 'logged-in-user' will be added if not present as the access system - * // requires this context. - * ), - * $output = drupal_build_form('ctools_access_admin_form', $form_state); - * if (!empty($form_state['executed'])) { - * // save $form_state['access'] however you like. - * } - * @endcode - * - * Additionally, you may add 'no buttons' => TRUE if you wish to embed this - * form into your own, and instead call - * - * @code{ - * $form = ctools_access_admin_form($form, $form_state); - * } - * @endcode - * - * You'll be responsible for adding a submit button. - * - * You may use ctools_access($access, $contexts) which will return - * TRUE if access is passed or FALSE if access is not passed. - */ - -/** - * Administrative form for access control. - */ -function ctools_access_admin_form($form, &$form_state) { - ctools_include('context'); - $argument = isset($form_state['callback argument']) ? $form_state['callback argument'] : ''; - $fragment = $form_state['module']; - if ($argument) { - $fragment .= '-' . $argument; - } - - $contexts = isset($form_state['contexts']) ? $form_state['contexts'] : array(); - - $form['access_table'] = array( - '#markup' => ctools_access_admin_render_table($form_state['access'], $fragment, $contexts), - ); - - $form['add-button'] = array( - '#theme' => 'ctools_access_admin_add', - ); - // This sets up the URL for the add access modal. - $form['add-button']['add-url'] = array( - '#attributes' => array('class' => array("ctools-access-add-url")), - '#type' => 'hidden', - '#value' => url("ctools/context/ajax/access/add/$fragment", array('absolute' => TRUE)), - ); - - $plugins = ctools_get_relevant_access_plugins($contexts); - $options = array(); - foreach ($plugins as $id => $plugin) { - $options[$id] = $plugin['title']; - } - - asort($options); - - $form['add-button']['type'] = array( - // This ensures that the form item is added to the URL. - '#attributes' => array('class' => array("ctools-access-add-url")), - '#type' => 'select', - '#options' => $options, - '#required' => FALSE, - ); - - $form['add-button']['add'] = array( - '#type' => 'submit', - '#attributes' => array('class' => array('ctools-use-modal')), - '#id' => "ctools-access-add", - '#value' => t('Add'), - ); - - $form['logic'] = array( - '#type' => 'radios', - '#options' => array( - 'and' => t('All criteria must pass.'), - 'or' => t('Only one criteria must pass.'), - ), - '#default_value' => isset($form_state['access']['logic']) ? $form_state['access']['logic'] : 'and', - ); - - if (empty($form_state['no buttons'])) { - $form['buttons']['save'] = array( - '#type' => 'submit', - '#value' => t('Save'), - '#submit' => array('ctools_access_admin_form_submit'), - ); - } - - return $form; -} - -/** - * Render the table. This is used both to render it initially and to rerender - * it upon ajax response. - */ -function ctools_access_admin_render_table($access, $fragment, $contexts) { - ctools_include('ajax'); - ctools_include('modal'); - $rows = array(); - - if (empty($access['plugins'])) { - $access['plugins'] = array(); - } - - foreach ($access['plugins'] as $id => $test) { - $row = array(); - $plugin = ctools_get_access_plugin($test['name']); - $title = isset($plugin['title']) ? $plugin['title'] : t('Broken/missing access plugin %plugin', array('%plugin' => $test['name'])); - - $row[] = array('data' => $title, 'class' => array('ctools-access-title')); - - $description = ctools_access_summary($plugin, $contexts, $test); - $row[] = array('data' => $description, 'class' => array('ctools-access-description')); - - $operations = ctools_modal_image_button(ctools_image_path('icon-configure.png'), "ctools/context/ajax/access/configure/$fragment/$id", t('Configure settings for this item.')); - $operations .= ctools_ajax_image_button(ctools_image_path('icon-delete.png'), "ctools/context/ajax/access/delete/$fragment/$id", t('Remove this item.')); - - $row[] = array('data' => $operations, 'class' => array('ctools-access-operations'), 'align' => 'right'); - - $rows[] = $row; - } - - $header = array( - array('data' => t('Title'), 'class' => array('ctools-access-title')), - array('data' => t('Description'), 'class' => array('ctools-access-description')), - array('data' => '', 'class' => array('ctools-access-operations'), 'align' => 'right'), - ); - - if (empty($rows)) { - $rows[] = array(array('data' => t('No criteria selected, this test will pass.'), 'colspan' => count($header))); - } - - ctools_modal_add_js(); - return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'ctools-access-table'))); -} - -/** - * Theme the 'add' portion of the access form into a table. - */ -function theme_ctools_access_admin_add($vars) { - $rows = array(array(drupal_render_children($vars['form']))); - $output = '
'; - $output .= theme('table', array('rows' => $rows)); - $output .= '
'; - return $output; -} - -function ctools_access_admin_form_submit($form, &$form_state) { - $form_state['access']['logic'] = $form_state['values']['logic']; - - $function = $form_state['module'] . '_ctools_access_clear'; - if (function_exists($function)) { - $function($form_state['callback argument']); - } -} - -// -------------------------------------------------------------------------- -// AJAX menu entry points. -/** - * AJAX callback to add a new access test to the list. - */ - -function ctools_access_ajax_add($fragment = NULL, $name = NULL) { - ctools_include('ajax'); - ctools_include('modal'); - ctools_include('context'); - - if (empty($fragment) || empty($name)) { - ctools_ajax_render_error(); - } - - $plugin = ctools_get_access_plugin($name); - if (empty($plugin)) { - ctools_ajax_render_error(); - } - - // Separate the fragment into 'module' and 'argument'. - if (strpos($fragment, '-') === FALSE) { - $module = $fragment; - $argument = NULL; - } - else { - list($module, $argument) = explode('-', $fragment, 2); - } - - $function = $module . '_ctools_access_get'; - if (!function_exists($function)) { - ctools_ajax_render_error(t('Missing callback hooks.')); - } - - list($access, $contexts) = $function($argument); - - // Make sure we have the logged in user context. - if (!isset($contexts['logged-in-user'])) { - $contexts['logged-in-user'] = ctools_access_get_loggedin_context(); - } - - if (empty($access['plugins'])) { - $access['plugins'] = array(); - } - - $test = ctools_access_new_test($plugin); - - $id = $access['plugins'] ? max(array_keys($access['plugins'])) + 1 : 0; - $access['plugins'][$id] = $test; - - $form_state = array( - 'plugin' => $plugin, - 'id' => $id, - 'test' => &$access['plugins'][$id], - 'access' => &$access, - 'contexts' => $contexts, - 'title' => t('Add criteria'), - 'ajax' => TRUE, - 'modal' => TRUE, - 'modal return' => TRUE, - ); - - $output = ctools_modal_form_wrapper('ctools_access_ajax_edit_item', $form_state); - $access = $form_state['access']; - $access['plugins'][$id] = $form_state['test']; - - if (!isset($output[0])) { - $function = $module . '_ctools_access_set'; - if (function_exists($function)) { - $function($argument, $access); - } - - $table = ctools_access_admin_render_table($access, $fragment, $contexts); - $output = array(); - $output[] = ajax_command_replace('table#ctools-access-table', $table); - $output[] = ctools_modal_command_dismiss(); - } - - print ajax_render($output); -} - -/** - * AJAX callback to edit an access test in the list. - */ -function ctools_access_ajax_edit($fragment = NULL, $id = NULL) { - ctools_include('ajax'); - ctools_include('modal'); - ctools_include('context'); - - if (empty($fragment) || !isset($id)) { - ctools_ajax_render_error(); - } - - // Separate the fragment into 'module' and 'argument'. - if (strpos($fragment, '-') === FALSE) { - $module = $fragment; - $argument = NULL; - } - else { - list($module, $argument) = explode('-', $fragment, 2); - } - - $function = $module . '_ctools_access_get'; - if (!function_exists($function)) { - ctools_ajax_render_error(t('Missing callback hooks.')); - } - - list($access, $contexts) = $function($argument); - - if (empty($access['plugins'][$id])) { - ctools_ajax_render_error(); - } - - // Make sure we have the logged in user context. - if (!isset($contexts['logged-in-user'])) { - $contexts['logged-in-user'] = ctools_access_get_loggedin_context(); - } - - $plugin = ctools_get_access_plugin($access['plugins'][$id]['name']); - $form_state = array( - 'plugin' => $plugin, - 'id' => $id, - 'test' => &$access['plugins'][$id], - 'access' => &$access, - 'contexts' => $contexts, - 'title' => t('Edit criteria'), - 'ajax' => TRUE, - 'modal' => TRUE, - 'modal return' => TRUE, - ); - - $output = ctools_modal_form_wrapper('ctools_access_ajax_edit_item', $form_state); - $access = $form_state['access']; - $access['plugins'][$id] = $form_state['test']; - - if (!isset($output[0])) { - $function = $module . '_ctools_access_set'; - if (function_exists($function)) { - $function($argument, $access); - } - - $table = ctools_access_admin_render_table($access, $fragment, $contexts); - $output = array(); - $output[] = ajax_command_replace('table#ctools-access-table', $table); - $output[] = ctools_modal_command_dismiss(); - } - - print ajax_render($output); -} - -/** - * Form to edit the settings of an access test. - */ -function ctools_access_ajax_edit_item($form, &$form_state) { - $test = &$form_state['test']; - $plugin = &$form_state['plugin']; - if (isset($plugin['required context'])) { - $form['context'] = ctools_context_selector($form_state['contexts'], $plugin['required context'], $test['context']); - } - $form['settings'] = array('#tree' => TRUE); - if ($function = ctools_plugin_get_function($plugin, 'settings form')) { - $form = $function($form, $form_state, $test['settings']); - } - - $form['not'] = array( - '#type' => 'checkbox', - '#title' => t('Reverse (NOT)'), - '#default_value' => !empty($test['not']), - ); - - $form['save'] = array( - '#type' => 'submit', - '#value' => t('Save'), - ); - - return $form; -} - -/** - * Validate handler for argument settings. - */ -function ctools_access_ajax_edit_item_validate($form, &$form_state) { - if ($function = ctools_plugin_get_function($form_state['plugin'], 'settings form validate')) { - $function($form, $form_state); - } -} - -/** - * Submit handler for argument settings. - */ -function ctools_access_ajax_edit_item_submit($form, &$form_state) { - if ($function = ctools_plugin_get_function($form_state['plugin'], 'settings form submit')) { - $function($form, $form_state); - } - - $form_state['test']['settings'] = $form_state['values']['settings']; - if (isset($form_state['values']['context'])) { - $form_state['test']['context'] = $form_state['values']['context']; - } - $form_state['test']['not'] = !empty($form_state['values']['not']); -} - -/** - * AJAX command to remove an access control item. - */ -function ctools_access_ajax_delete($fragment = NULL, $id = NULL) { - ctools_include('ajax'); - ctools_include('modal'); - ctools_include('context'); - - if (empty($fragment) || !isset($id)) { - ctools_ajax_render_error(); - } - - // Separate the fragment into 'module' and 'argument'. - if (strpos($fragment, '-') === FALSE) { - $module = $fragment; - $argument = NULL; - } - else { - list($module, $argument) = explode('-', $fragment, 2); - } - - $function = $module . '_ctools_access_get'; - if (!function_exists($function)) { - ctools_ajax_render_error(t('Missing callback hooks.')); - } - - list($access, $contexts) = $function($argument); - - if (isset($access['plugins'][$id])) { - unset($access['plugins'][$id]); - } - - // re-cache. - $function = $module . '_ctools_access_set'; - if (function_exists($function)) { - $function($argument, $access); - } - - $table = ctools_access_admin_render_table($access, $fragment, $contexts); - $output = array(); - $output[] = ajax_command_replace('table#ctools-access-table', $table); - - print ajax_render($output); -} diff --git a/html/sites/all/modules/contrib/ctools/includes/context-admin.inc b/html/sites/all/modules/contrib/ctools/includes/context-admin.inc deleted file mode 100644 index 533c89f55..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/context-admin.inc +++ /dev/null @@ -1,849 +0,0 @@ - array( - 'title' => t('Arguments'), - 'singular title' => t('argument'), - 'description' => '', // t("Arguments are parsed from the URL and translated into contexts that may be added to the display via the 'content' tab. These arguments are parsed in the order received, and you may use % in your URL to hold the place of an object; the rest of the arguments will come after the URL. For example, if the URL is node/%/panel and your user visits node/1/panel/foo, the first argument will be 1, and the second argument will be foo."), - 'add button' => t('Add argument'), - 'context function' => 'ctools_get_argument', - 'key' => 'arguments', // the key that data will be stored on an object, eg $panel_page - 'sortable' => TRUE, - 'settings' => 'argument_settings', - ), - 'relationship' => array( - 'title' => t('Relationships'), - 'singular title' => t('relationship'), - 'description' => '', // t('Relationships are contexts that are created from already existing contexts; the add relationship button will only appear once there is another context available. Relationships can load objects based upon how they are related to each other; for example, the author of a node, or a taxonomy term attached to a node, or the vocabulary of a taxonomy term.'), - 'add button' => t('Add relationship'), - 'context function' => 'ctools_get_relationship', - 'key' => 'relationships', - 'sortable' => FALSE, - 'settings' => 'relationship_settings', - ), - 'context' => array( - 'title' => t('Contexts'), - 'singular title' => t('context'), - 'description' => '', // t('Contexts are embedded directly into the panel; you generally must select an object in the panel. For example, you could select node 5, or the term "animals" or the user "administrator"'), - 'add button' => t('Add context'), - 'context function' => 'ctools_get_context', - 'key' => 'contexts', - 'sortable' => FALSE, - 'settings' => 'context_settings', - ), - 'requiredcontext' => array( - 'title' => t('Required contexts'), - 'singular title' => t('required context'), - 'description' => '', // t('Required contexts are passed in from some external source, such as a containing panel. If a mini panel has required contexts, it can only appear when that context is available, and therefore will not show up as a standard Drupal block.'), - 'add button' => t('Add required context'), - 'context function' => 'ctools_get_context', - 'key' => 'requiredcontexts', - 'sortable' => FALSE, - ), - ); - } - - if ($type === NULL) { - return $info; - } - - return $info[$type]; -} - - -/** - * Get the data belonging to a particular context. - */ -function ctools_context_get_plugin($type, $name) { - $info = ctools_context_info($type); - if (function_exists($info['context function'])) { - return $info['context function']($name); - } -} - -/** - * Add the argument table plus gadget plus javascript to the form. - */ -function ctools_context_add_argument_form($module, &$form, &$form_state, &$form_location, $object, $cache_key = NULL) { - if (empty($cache_key)) { - $cache_key = $object->name; - } - - $form_location = array( - '#prefix' => '
', - '#suffix' => '
', - '#theme' => 'ctools_context_item_form', - '#cache_key' => $cache_key, - '#ctools_context_type' => 'argument', - '#ctools_context_module' => $module, - ); - - $args = ctools_get_arguments(); - $choices = array(); - foreach ($args as $name => $arg) { - if (empty($arg['no ui'])) { - $choices[$name] = $arg['title']; - } - } - - asort($choices); - - if (!empty($choices) || !empty($object->arguments)) { - ctools_context_add_item_table('argument', $form_location, $choices, $object->arguments); - } -} - -function ctools_context_add_context_form($module, &$form, &$form_state, &$form_location, $object, $cache_key = NULL) { - if (empty($cache_key)) { - $cache_key = $object->name; - } - - $form_location = array( - '#prefix' => '
', - '#suffix' => '
', - '#theme' => 'ctools_context_item_form', - '#cache_key' => $cache_key, - '#ctools_context_type' => 'context', - '#ctools_context_module' => $module, - ); - - // Store the order the choices are in so javascript can manipulate it. - $form_location['markup'] = array( - '#markup' => ' ', - ); - - $choices = array(); - foreach (ctools_get_contexts() as $name => $arg) { - if (empty($arg['no ui'])) { - $choices[$name] = $arg['title']; - } - } - - asort($choices); - - if (!empty($choices) || !empty($object->contexts)) { - ctools_context_add_item_table('context', $form_location, $choices, $object->contexts); - } - -} - -function ctools_context_add_required_context_form($module, &$form, &$form_state, &$form_location, $object, $cache_key = NULL) { - if (empty($cache_key)) { - $cache_key = $object->name; - } - - $form_location = array( - '#prefix' => '
', - '#suffix' => '
', - '#theme' => 'ctools_context_item_form', - '#cache_key' => $cache_key, - '#ctools_context_type' => 'requiredcontext', - '#ctools_context_module' => $module, - ); - - // Store the order the choices are in so javascript can manipulate it. - $form_location['markup'] = array( - '#value' => ' ', - ); - - $choices = array(); - foreach (ctools_get_contexts() as $name => $arg) { - if (empty($arg['no required context ui'])) { - $choices[$name] = $arg['title']; - } - } - - asort($choices); - - if (!empty($choices) || !empty($object->contexts)) { - ctools_context_add_item_table('requiredcontext', $form_location, $choices, $object->requiredcontexts); - } -} - -function ctools_context_add_relationship_form($module, &$form, &$form_state, &$form_location, $object, $cache_key = NULL) { - if (empty($cache_key)) { - $cache_key = $object->name; - } - - $form_location = array( - '#prefix' => '
', - '#suffix' => '
', - '#theme' => 'ctools_context_item_form', - '#cache_key' => $cache_key, - '#ctools_context_type' => 'relationship', - '#ctools_context_module' => $module, - ); - - // Store the order the choices are in so javascript can manipulate it. - $form_location['markup'] = array( - '#value' => ' ', - ); - - $base_contexts = isset($object->base_contexts) ? $object->base_contexts : array(); - $available_relationships = ctools_context_get_relevant_relationships(ctools_context_load_contexts($object, TRUE, $base_contexts)); - - ctools_context_add_item_table('relationship', $form_location, $available_relationships, $object->relationships); -} - -/** - * Include all context administrative include files, css, javascript. - */ -function ctools_context_admin_includes() { - ctools_include('context'); - ctools_include('modal'); - ctools_include('ajax'); - ctools_include('object-cache'); - ctools_modal_add_js(); - ctools_modal_add_plugin_js(ctools_get_contexts()); - ctools_modal_add_plugin_js(ctools_get_relationships()); -} - -/** - * Add the context table to the page. - */ -function ctools_context_add_item_table($type, &$form, $available_contexts, $items) { - $form[$type] = array( - '#tree' => TRUE, - ); - - $module = $form['#ctools_context_module']; - $cache_key = $form['#cache_key']; - - if (isset($items) && is_array($items)) { - foreach ($items as $position => $context) { - ctools_context_add_item_to_form($module, $type, $cache_key, $form[$type][$position], $position, $context); - } - } - - $type_info = ctools_context_info($type); - $form['description'] = array( - '#prefix' => '
', - '#suffix' => '
', - '#markup' => $type_info['description'], - ); - - ctools_context_add_item_table_buttons($type, $module, $form, $available_contexts); -} - -function ctools_context_add_item_table_buttons($type, $module, &$form, $available_contexts) { - drupal_add_library('system', 'drupal.ajax'); - $form['buttons'] = array( - '#tree' => TRUE, - ); - - if (!empty($available_contexts)) { - $type_info = ctools_context_info($type); - - $module = $form['#ctools_context_module']; - $cache_key = $form['#cache_key']; - - // The URL for this ajax button - $form['buttons'][$type]['add-url'] = array( - '#attributes' => array('class' => array("ctools-$type-add-url")), - '#type' => 'hidden', - '#value' => url("ctools/context/ajax/add/$module/$type/$cache_key", array('absolute' => TRUE)), - ); - - asort($available_contexts); - // This also will be in the URL. - $form['buttons'][$type]['item'] = array( - '#attributes' => array('class' => array("ctools-$type-add-url")), - '#type' => 'select', - '#options' => $available_contexts, - '#required' => FALSE, - ); - - $form['buttons'][$type]['add'] = array( - '#type' => 'submit', - '#attributes' => array('class' => array('ctools-use-modal')), - '#id' => "ctools-$type-add", - '#value' => $type_info['add button'], - ); - } -} - -/** - * Add a row to the form. Used both in the main form and by - * the ajax to add an item. - */ -function ctools_context_add_item_to_form($module, $type, $cache_key, &$form, $position, $item) { - // This is the single function way to load any plugin by variable type. - $info = ctools_context_get_plugin($type, $item['name']); - $form['title'] = array( - '#markup' => check_plain($item['identifier']), - ); - - // Relationships not sortable. - $type_info = ctools_context_info($type); - - if (!empty($type_info['sortable'])) { - $form['position'] = array( - '#type' => 'weight', - '#default_value' => $position, - '#attributes' => array('class' => array('drag-position')), - ); - } - - $form['remove'] = array( - '#markup' => ctools_ajax_image_button(ctools_image_path('icon-delete.png'), "ctools/context/ajax/delete/$module/$type/$cache_key/$position", t('Remove this item.')), - ); - - $form['settings'] = array( - '#markup' => ctools_modal_image_button(ctools_image_path('icon-configure.png'), "ctools/context/ajax/configure/$module/$type/$cache_key/$position", t('Configure settings for this item.')), - ); -} - - -// --------------------------------------------------------------------------- -// AJAX forms and stuff. - -/** - * Ajax entry point to add an context - */ -function ctools_context_ajax_item_add($mechanism = NULL, $type = NULL, $cache_key = NULL, $name = NULL, $step = NULL) { - ctools_include('ajax'); - ctools_include('modal'); - ctools_include('context'); - ctools_include('cache'); - ctools_include('plugins-admin'); - - if (!$name) { - return ctools_ajax_render_error(); - } - - // Load stored object from cache. - if (!($object = ctools_cache_get($mechanism, $cache_key))) { - ctools_ajax_render_error(t('Invalid object name.')); - } - - // Get info about what we're adding, i.e, relationship, context, argument, etc. - $plugin_definition = ctools_context_get_plugin($type, $name); - if (empty($plugin_definition)) { - ctools_ajax_render_error(t('Invalid context type')); - } - - // Set up the $conf array for this plugin - if (empty($step) || empty($object->temporary)) { - // Create the basis for our new context. - $conf = ctools_context_get_defaults($plugin_definition, $object, $type); - $object->temporary = &$conf; - } - else { - $conf = &$object->temporary; - } - - // Load the contexts that may be used. - $base_contexts = isset($object->base_contexts) ? $object->base_contexts : array(); - $contexts = ctools_context_load_contexts($object, TRUE, $base_contexts); - - $type_info = ctools_context_info($type); - $form_state = array( - 'ajax' => TRUE, - 'modal' => TRUE, - 'modal return' => TRUE, - 'object' => &$object, - 'conf' => &$conf, - 'plugin' => $plugin_definition, - 'type' => $type, - 'contexts' => $contexts, - 'title' => t('Add @type "@context"', array('@type' => $type_info['singular title'], '@context' => $plugin_definition['title'])), - 'type info' => $type_info, - 'op' => 'add', - 'step' => $step, - ); - - $form_info = array( - 'path' => "ctools/context/ajax/add/$mechanism/$type/$cache_key/$name/%step", - 'show cancel' => TRUE, - 'default form' => 'ctools_edit_context_form_defaults', - 'auto cache' => TRUE, - 'cache mechanism' => $mechanism, - 'cache key' => $cache_key, - // This is stating what the cache will be referred to in $form_state - 'cache location' => 'object', - ); - - if ($type == 'requiredcontext') { - $form_info += array( - 'add form name' => 'required context add form', - 'edit form name' => 'required context edit form', - ); - } - - $output = ctools_plugin_configure_form($form_info, $form_state); - - if (!empty($form_state['cancel'])) { - $output = array(ctools_modal_command_dismiss()); - } - elseif (!empty($form_state['complete'])) { - // Successful submit -- move temporary data to location. - - // Create a reference to the place our context lives. Since this is fairly - // generic, this is the easiest way to get right to the place of the - // object without knowing precisely what data we're poking at. - $ref = &$object->{$type_info['key']}; - - // Figure out the position for our new context. - $position = empty($ref) ? 0 : max(array_keys($ref)) + 1; - - $conf['id'] = ctools_context_next_id($ref, $name); - $ref[$position] = $conf; - - if (isset($object->temporary)) { - unset($object->temporary); - } - - ctools_cache_operation($mechanism, $cache_key, 'finalize', $object); - - // Very irritating way to update the form for our contexts. - $arg_form_state = form_state_defaults() + array( - 'values' => array(), - 'process_input' => FALSE, - 'complete form' => array(), - ); - - $rel_form_state = $arg_form_state; - - $arg_form = array( - '#post' => array(), - '#programmed' => FALSE, - '#tree' => FALSE, - '#parents' => array(), - '#array_parents' => array(), - ); - - // Build a chunk of the form to merge into the displayed form - $arg_form[$type] = array( - '#tree' => TRUE, - ); - $arg_form[$type][$position] = array( - '#tree' => TRUE, - ); - - ctools_context_add_item_to_form($mechanism, $type, $cache_key, $arg_form[$type][$position], $position, $ref[$position]); - $arg_form = form_builder('ctools_context_form', $arg_form, $arg_form_state); - - // Build the relationships table so we can ajax it in. - // This is an additional thing that goes in here. - $rel_form = array( - '#theme' => 'ctools_context_item_form', - '#cache_key' => $cache_key, - '#ctools_context_type' => 'relationship', - '#ctools_context_module' => $mechanism, - '#only_buttons' => TRUE, - '#post' => array(), - '#programmed' => FALSE, - '#tree' => FALSE, - '#parents' => array(), - '#array_parents' => array(), - ); - - $rel_form['relationship'] = array( - '#tree' => TRUE, - ); - - // Allow an object to set some 'base' contexts that come from elsewhere. - $rel_contexts = isset($object->base_contexts) ? $object->base_contexts : array(); - $all_contexts = ctools_context_load_contexts($object, TRUE, $rel_contexts); - $available_relationships = ctools_context_get_relevant_relationships($all_contexts); - - $output = array(); - if (!empty($available_relationships)) { - ctools_context_add_item_table_buttons('relationship', $mechanism, $rel_form, $available_relationships); - $rel_form = form_builder('dummy_form_id', $rel_form, $rel_form_state); - $output[] = ajax_command_replace('div#ctools-relationships-table div.buttons', drupal_render($rel_form)); - } - - $theme_vars = array(); - $theme_vars['type'] = $type; - $theme_vars['form'] = $arg_form[$type][$position]; - $theme_vars['position'] = $position; - $theme_vars['count'] = $position; - $text = theme('ctools_context_item_row', $theme_vars); - $output[] = ajax_command_append('#' . $type . '-table tbody', $text); - $output[] = ajax_command_changed('#' . $type . '-row-' . $position, '.title'); - $output[] = ctools_modal_command_dismiss(); - } - else { - $output = ctools_modal_form_render($form_state, $output); - } - print ajax_render($output); - exit; -} - -/** - * Ajax entry point to edit an item - */ -function ctools_context_ajax_item_edit($mechanism = NULL, $type = NULL, $cache_key = NULL, $position = NULL, $step = NULL) { - ctools_include('ajax'); - ctools_include('modal'); - ctools_include('context'); - ctools_include('cache'); - ctools_include('plugins-admin'); - - if (!isset($position)) { - return ctools_ajax_render_error(); - } - - // Load stored object from cache. - if (!($object = ctools_cache_get($mechanism, $cache_key))) { - ctools_ajax_render_error(t('Invalid object name.')); - } - - $type_info = ctools_context_info($type); - - // Create a reference to the place our context lives. Since this is fairly - // generic, this is the easiest way to get right to the place of the - // object without knowing precisely what data we're poking at. - $ref = &$object->{$type_info['key']}; - - if (empty($step) || empty($object->temporary)) { - // Create the basis for our new context. - $conf = $object->{$type_info['key']}[$position]; - $object->temporary = &$conf; - } - else { - $conf = &$object->temporary; - } - - $name = $ref[$position]['name']; - if (empty($name)) { - ctools_ajax_render_error(); - } - - // load the plugin definition - $plugin_definition = ctools_context_get_plugin($type, $name); - if (empty($plugin_definition)) { - ctools_ajax_render_error(t('Invalid context type')); - } - - // Load the contexts - $base_contexts = isset($object->base_contexts) ? $object->base_contexts : array(); - $contexts = ctools_context_load_contexts($object, TRUE, $base_contexts); - - $form_state = array( - 'ajax' => TRUE, - 'modal' => TRUE, - 'modal return' => TRUE, - 'object' => &$object, - 'conf' => &$conf, - 'position' => $position, - 'plugin' => $plugin_definition, - 'type' => $type, - 'contexts' => $contexts, - 'title' => t('Edit @type "@context"', array('@type' => $type_info['singular title'], '@context' => $plugin_definition['title'])), - 'type info' => $type_info, - 'op' => 'add', - 'step' => $step, - ); - - $form_info = array( - 'path' => "ctools/context/ajax/configure/$mechanism/$type/$cache_key/$position/%step", - 'show cancel' => TRUE, - 'default form' => 'ctools_edit_context_form_defaults', - 'auto cache' => TRUE, - 'cache mechanism' => $mechanism, - 'cache key' => $cache_key, - // This is stating what the cache will be referred to in $form_state - 'cache location' => 'object', - ); - - if ($type == 'requiredcontext') { - $form_info += array( - 'add form name' => 'required context add form', - 'edit form name' => 'required context edit form', - ); - } - - $output = ctools_plugin_configure_form($form_info, $form_state); - - if (!empty($form_state['cancel'])) { - $output = array(ctools_modal_command_dismiss()); - } - elseif (!empty($form_state['complete'])) { - // successful submit - $ref[$position] = $conf; - if (isset($object->temporary)) { - unset($object->temporary); - } - - ctools_cache_operation($mechanism, $cache_key, 'finalize', $object); - - $output = array(); - $output[] = ctools_modal_command_dismiss(); - - $arg_form_state = form_state_defaults() + array( - 'values' => array(), - 'process_input' => FALSE, - 'complete form' => array(), - ); - - $arg_form = array( - '#post' => array(), - '#parents' => array(), - '#array_parents' => array(), - '#programmed' => FALSE, - '#tree' => FALSE, - ); - - // Build a chunk of the form to merge into the displayed form - $arg_form[$type] = array( - '#tree' => TRUE, - ); - $arg_form[$type][$position] = array( - '#tree' => TRUE, - ); - - ctools_context_add_item_to_form($mechanism, $type, $cache_key, $arg_form[$type][$position], $position, $ref[$position]); - $arg_form = form_builder('ctools_context_form', $arg_form, $arg_form_state); - - $theme_vars = array(); - $theme_vars['type'] = $type; - $theme_vars['form'] = $arg_form[$type][$position]; - $theme_vars['position'] = $position; - $theme_vars['count'] = $position; - $output[] = ajax_command_replace('#' . $type . '-row-' . $position, theme('ctools_context_item_row', $theme_vars)); - $output[] = ajax_command_changed('#' . $type . '-row-' . $position, '.title'); - } - else { - $output = ctools_modal_form_render($form_state, $output); - } - print ajax_render($output); - exit; -} - -/** - * Get the defaults for a new instance of a context plugin. - * - * @param $plugin_definition - * The metadata definition of the plugin from ctools_get_plugins(). - * @param $object - * The object the context plugin will be added to. - * @param $type - * The type of context plugin. i.e, context, requiredcontext, relationship - */ -function ctools_context_get_defaults($plugin_definition, $object, $type) { - // Fetch the potential id of the plugin so we can append - // title and keyword information for new ones. - $type_info = ctools_context_info($type); - $id = ctools_context_next_id($object->{$type_info['key']}, $plugin_definition['name']); - - $conf = array( - 'identifier' => $plugin_definition['title'] . ($id > 1 ? ' ' . $id : ''), - 'keyword' => ctools_get_keyword($object, $plugin_definition['keyword']), - 'name' => $plugin_definition['name'], - ); - - if (isset($plugin_definition['defaults'])) { - $defaults = $plugin_definition['defaults']; - } - elseif (isset($subtype['defaults'])) { - $defaults = $subtype['defaults']; - } - - if (isset($defaults)) { - if (is_string($defaults) && function_exists($defaults)) { - if ($settings = $defaults($plugin_definition)) { - $conf += $settings; - } - } - elseif (is_array($defaults)) { - $conf += $defaults; - } - } - - return $conf; -} - -/** - * Form wrapper for the edit context form. - * - * @todo: We should uncombine these. - */ -function ctools_edit_context_form_defaults($form, &$form_state) { - // Basic values required to orient ourselves - $object = $form_state['object']; - $plugin_definition = $form_state['plugin']; - $type_info = $form_state['type info']; - $contexts = $form_state['contexts']; - $conf = $form_state['conf']; - - if ($type_info['key'] == 'arguments' && !isset($conf['default'])) { - $conf['default'] = 'ignore'; - $conf['title'] = ''; - } - - $form['description'] = array( - '#prefix' => '
', - '#suffix' => '
', - '#markup' => check_plain($plugin_definition['description']), - ); - - if ($type_info['key'] == 'relationships') { - $form['context'] = ctools_context_selector($contexts, $plugin_definition['required context'], isset($conf['context']) ? $conf['context'] : ''); - } - if ($type_info['key'] == 'arguments') { - $form['default'] = array( - '#type' => 'select', - '#title' => t('Default'), - '#options' => array( - 'ignore' => t('Ignore it; content that requires this context will not be available.'), - '404' => t('Display page not found or display nothing at all.'), - ), - '#default_value' => $conf['default'], - '#description' => t('If the argument is missing or is not valid, select how this should behave.'), - ); - - $form['title'] = array( - '#type' => 'textfield', - '#title' => t('Title'), - '#default_value' => $conf['title'], - '#description' => t('Enter a title to use when this argument is present. You may use %KEYWORD substitution, where the keyword is specified below.'), - ); - } - - $form['identifier'] = array( - '#type' => 'textfield', - '#title' => t('Identifier'), - '#description' => t('Enter a name to identify this !type on administrative screens.', array('!type' => t('context'))), - '#default_value' => $conf['identifier'], - ); - - $form['keyword'] = array( - '#type' => 'textfield', - '#title' => t('Keyword'), - '#description' => t('Enter a keyword to use for substitution in titles.'), - '#default_value' => $conf['keyword'], - ); - - if ($type_info['key'] == 'requiredcontexts') { - $form['optional'] = array( - '#type' => 'checkbox', - '#title' => t('Context is optional'), - '#default_value' => !empty($form_state['conf']['optional']), - '#description' => t('This context need not be present for the component to function.'), - ); - } - - $form['#submit'][] = 'ctools_edit_context_form_defaults_submit'; - - return $form; -} - -/** - * Submit handler to store context identifier and keyword info. - */ -function ctools_edit_context_form_defaults_submit(&$form, &$form_state) { - if ($form_state['type info']['key'] == 'relationships') { - $form_state['conf']['context'] = $form_state['values']['context']; - } - if ($form_state['type info']['key'] == 'arguments') { - $form_state['conf']['default'] = $form_state['values']['default']; - $form_state['conf']['title'] = $form_state['values']['title']; - } - if ($form_state['type info']['key'] == 'requiredcontexts') { - $form_state['conf']['optional'] = $form_state['values']['optional']; - } - - $form_state['conf']['identifier'] = $form_state['values']['identifier']; - $form_state['conf']['keyword'] = $form_state['values']['keyword']; -} - -/** - * Ajax entry point to edit an item - */ -function ctools_context_ajax_item_delete($mechanism = NULL, $type = NULL, $cache_key = NULL, $position = NULL) { - ctools_include('ajax'); - ctools_include('context'); - ctools_include('cache'); - - if (!isset($position)) { - return ctools_ajax_render_error(); - } - - // Load stored object from cache. - if (!($object = ctools_cache_get($mechanism, $cache_key))) { - ctools_ajax_render_error(t('Invalid object name.')); - } - - $type_info = ctools_context_info($type); - - // Create a reference to the place our context lives. Since this is fairly - // generic, this is the easiest way to get right to the place of the - // object without knowing precisely what data we're poking at. - $ref = &$object->{$type_info['key']}; - - if (!array_key_exists($position, $ref)) { - ctools_ajax_render_error(t('Unable to delete missing item!')); - } - - unset($ref[$position]); - ctools_cache_operation($mechanism, $cache_key, 'finalize', $object); - - $output = array(); - $output[] = ajax_command_replace('#' . $type . '-row-' . $position, ''); - $output[] = ajax_command_restripe("#$type-table"); - print ajax_render($output); - exit; -} - -// --- End of contexts - -function ctools_save_context($type, &$ref, $form_values) { - $type_info = ctools_context_info($type); - - // Organize arguments - $new = array(); - $order = array(); - - foreach ($ref as $id => $context) { - $position = $form_values[$type][$id]['position']; - $order[$position] = $id; - } - - ksort($order); - foreach ($order as $id) { - $new[] = $ref[$id]; - } - $ref = $new; -} - -function ctools_get_keyword($page, $word) { - // Create a complete set of keywords - $keywords = array(); - foreach (array('arguments', 'relationships', 'contexts', 'requiredcontexts') as $type) { - if (!empty($page->$type) && is_array($page->$type)) { - foreach ($page->$type as $info) { - $keywords[$info['keyword']] = TRUE; - } - } - } - - $keyword = $word; - $count = 1; - while (!empty($keywords[$keyword])) { - $keyword = $word . '_' . ++$count; - } - return $keyword; -} - diff --git a/html/sites/all/modules/contrib/ctools/includes/context-task-handler.inc b/html/sites/all/modules/contrib/ctools/includes/context-task-handler.inc deleted file mode 100644 index ed4acad08..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/context-task-handler.inc +++ /dev/null @@ -1,551 +0,0 @@ - $handler) { - $plugin = page_manager_get_task_handler($handler->handler); - // First, see if the handler has a tester. - $function = ctools_plugin_get_function($plugin, 'test'); - if ($function) { - $test = $function($handler, $contexts, $args); - if ($test) { - return $id; - } - } - else { - // If not, if it's a 'context' type handler, use the default tester. - if ($plugin['handler type'] == 'context') { - $test = ctools_context_handler_default_test($handler, $contexts, $args); - if ($test) { - return $id; - } - } - } - } - - return FALSE; -} - -/** - * Default test function to see if a task handler should be rendered. - * - * This tests against the standard selection criteria that most task - * handlers should be implementing. - */ -function ctools_context_handler_default_test($handler, $base_contexts, $args) { - ctools_include('context'); - // Add my contexts. - $contexts = ctools_context_handler_get_handler_contexts($base_contexts, $handler); - - // Test. - return ctools_context_handler_select($handler, $contexts); -} - -/** - * Render a task handler. - */ -function ctools_context_handler_render_handler($task, $subtask, $handler, $contexts, $args, $page = TRUE) { - $function = page_manager_get_renderer($handler); - if (!$function) { - return NULL; - } - - if ($page) { - if ($subtask) { - $task_name = page_manager_make_task_name($task['name'], $subtask['name']); - } - else { - $task_name = $task['name']; - } - - page_manager_get_current_page(array( - 'name' => $task_name, - 'task' => $task, - 'subtask' => $subtask, - 'contexts' => $contexts, - 'arguments' => $args, - 'handler' => $handler, - )); - } - - $info = $function($handler, $contexts, $args); - if (!$info) { - return NULL; - } - - $context = array( - 'args' => $args, - 'contexts' => $contexts, - 'task' => $task, - 'subtask' => $subtask, - 'handler' => $handler, - ); - drupal_alter('ctools_render', $info, $page, $context); - - // If we don't own the page, let the caller deal with rendering. - if (!$page) { - return $info; - } - - if (!empty($info['response code']) && $info['response code'] != 200) { - switch ($info['response code']) { - case 403: - return MENU_ACCESS_DENIED; - - case 404: - return MENU_NOT_FOUND; - - case 410: - drupal_add_http_header('Status', '410 Gone'); - drupal_exit(); - break; - - case 301: - case 302: - case 303: - case 304: - case 305: - case 307: - $info += array( - 'query' => array(), - 'fragment' => '', - ); - $options = array( - 'query' => $info['query'], - 'fragment' => $info['fragment'], - ); - drupal_goto($info['destination'], $options, $info['response code']); - // @todo -- should other response codes be supported here? - } - } - - $plugin = page_manager_get_task_handler($handler->handler); - - if (module_exists('contextual') && user_access('access contextual links') && isset($handler->task)) { - // Provide a contextual link to edit this, if we can: - $callback = isset($plugin['contextual link']) ? $plugin['contextual link'] : 'ctools_task_handler_default_contextual_link'; - if ($callback && function_exists($callback)) { - $links = $callback($handler, $plugin, $contexts, $args); - } - - if (!empty($links) && is_array($links)) { - $build = array( - '#theme_wrappers' => array('container'), - '#attributes' => array('class' => array('contextual-links-region')), - ); - - if (!is_array($info['content'])) { - $build['content']['#markup'] = $info['content']; - } - else { - $build['content'] = $info['content']; - } - - $build['contextual_links'] = array( - '#prefix' => '', - '#theme' => 'links__contextual', - '#links' => $links, - '#attributes' => array('class' => array('contextual-links')), - '#attached' => array( - 'library' => array(array('contextual', 'contextual-links')), - ), - ); - $info['content'] = $build; - } - } - - foreach (ctools_context_handler_get_task_arguments($task, $subtask) as $id => $argument) { - $plugin = ctools_get_argument($argument['name']); - $cid = ctools_context_id($argument, 'argument'); - if (!empty($contexts[$cid]) && ($function = ctools_plugin_get_function($plugin, 'breadcrumb'))) { - $function($argument['settings'], $contexts[$cid]); - } - } - - if (isset($info['title'])) { - drupal_set_title($info['title'], PASS_THROUGH); - } - - // Only directly output if $page was set to true. - if (!empty($info['no_blocks'])) { - ctools_set_no_blocks(FALSE); - } - return $info['content']; -} - -/** - * Provides contextual link for a task as defined by the handler. - * - * This provides a simple link to th main content operation and is suitable - * for most normal handlers. Setting 'contextual link' to a function overrides - * this and setting it to FALSE will prevent a contextual link from appearing. - */ -function ctools_task_handler_default_contextual_link($handler, $plugin, $contexts, $args) { - if (!user_access('administer page manager')) { - return; - } - - $task = page_manager_get_task($handler->task); - - $title = !empty($task['tab title']) ? $task['tab title'] : t('Edit @type', array('@type' => $plugin['title'])); - $trail = array(); - if (!empty($plugin['tab operation'])) { - if (is_array($plugin['tab operation'])) { - $trail = $plugin['tab operation']; - } - elseif (function_exists($plugin['tab operation'])) { - $trail = $plugin['tab operation']($handler, $contexts, $args); - } - } - $path = page_manager_edit_url(page_manager_make_task_name($handler->task, $handler->subtask), $trail); - - $links = array(array( - 'href' => $path, - 'title' => $title, - 'query' => drupal_get_destination(), - ), - ); - - return $links; -} - -/** - * Called to execute actions that should happen before a handler is rendered. - */ -function ctools_context_handler_pre_render($handler, $contexts, $args) { - foreach (module_implements('ctools_context_handler_pre_render') as $module) { - $function = $module . '_ctools_context_handler_pre_render'; - $function($handler, $contexts, $args); - } -} - -/** - * Compare arguments to contexts for selection purposes. - * - * @param object $handler - * The handler in question. - * @param object $contexts - * The context objects provided by the task. - * - * @return bool - * TRUE if these contexts match the selection rules. NULL or FALSE - * otherwise. - */ -function ctools_context_handler_select($handler, $contexts) { - if (empty($handler->conf['access'])) { - return TRUE; - } - - ctools_include('context'); - return ctools_access($handler->conf['access'], $contexts); -} - -/** - * Get the array of summary strings for the arguments. - * - * These summary strings are used to communicate to the user what - * arguments the task handlers are selecting. - * - * @param object $task - * The loaded task plugin. - * @param object $subtask - * The subtask id. - * @param object $handler - * The handler to be checked. - * - * @return array - * Returns array of summary strings for arguments selected by task handlers. - */ -function ctools_context_handler_summary($task, $subtask, $handler) { - if (empty($handler->conf['access']['plugins'])) { - return array(); - } - - ctools_include('context'); - $strings = array(); - $contexts = ctools_context_handler_get_all_contexts($task, $subtask, $handler); - - foreach ($handler->conf['access']['plugins'] as $test) { - $plugin = ctools_get_access_plugin($test['name']); - if ($string = ctools_access_summary($plugin, $contexts, $test)) { - $strings[] = $string; - } - } - - return $strings; -} - -// -------------------------------------------------------------------------- -// Tasks and Task handlers can both have their own sources of contexts. -// Sometimes we need all of these contexts at once (when editing -// the task handler, for example) but sometimes we need them separately -// (when a task has contexts loaded and is trying out the task handlers, -// for example). Therefore there are two paths we can take to getting contexts. -/** - * Load the contexts for a task, using arguments. - * - * This creates the base array of contexts, loaded from arguments, suitable - * for use in rendering. - */ -function ctools_context_handler_get_task_contexts($task, $subtask, $args) { - $contexts = ctools_context_handler_get_base_contexts($task, $subtask); - $arguments = ctools_context_handler_get_task_arguments($task, $subtask); - ctools_context_get_context_from_arguments($arguments, $contexts, $args); - - return $contexts; -} - -/** - * Load the contexts for a task handler. - * - * This expands a base set of contexts passed in from a task with the - * contexts defined on the task handler. The contexts from the task - * must already have been loaded. - */ -function ctools_context_handler_get_handler_contexts($contexts, $handler) { - $object = ctools_context_handler_get_handler_object($handler); - return ctools_context_load_contexts($object, FALSE, $contexts); -} - -/** - * Load the contexts for a task and task handler together. - * - * This pulls the arguments from a task and everything else from a task - * handler and loads them as a group. Since there is no data, this loads - * the contexts as placeholders. - */ -function ctools_context_handler_get_all_contexts($task, $subtask, $handler) { - $contexts = array(); - - $object = ctools_context_handler_get_task_object($task, $subtask, $handler); - $contexts = ctools_context_load_contexts($object, TRUE, $contexts); - ctools_context_handler_set_access_restrictions($task, $subtask, $handler, $contexts); - return $contexts; -} - -/** - * Create an object suitable for use with the context system that kind of - * expects things in a certain, kind of clunky format. - */ -function ctools_context_handler_get_handler_object($handler) { - $object = new stdClass(); - $object->name = $handler->name; - $object->contexts = isset($handler->conf['contexts']) ? $handler->conf['contexts'] : array(); - $object->relationships = isset($handler->conf['relationships']) ? $handler->conf['relationships'] : array(); - - return $object; -} - -/** - * Create an object suitable for use with the context system that kind of - * expects things in a certain, kind of clunky format. This one adds in - * arguments from the task. - */ -function ctools_context_handler_get_task_object($task, $subtask, $handler) { - $object = new stdClass(); - $object->name = !empty($handler->name) ? $handler->name : 'temp'; - $object->base_contexts = ctools_context_handler_get_base_contexts($task, $subtask, TRUE); - $object->arguments = ctools_context_handler_get_task_arguments($task, $subtask); - $object->contexts = isset($handler->conf['contexts']) ? $handler->conf['contexts'] : array(); - $object->relationships = isset($handler->conf['relationships']) ? $handler->conf['relationships'] : array(); - - return $object; -} - -/** - * Get base contexts from a task, if it has any. - * - * Tasks can get their contexts either from base contexts or arguments; base - * contexts extract their information from the environment. - */ -function ctools_context_handler_get_base_contexts($task, $subtask, $placeholders = FALSE) { - if ($function = ctools_plugin_get_function($task, 'get base contexts')) { - return $function($task, $subtask, $placeholders); - } - - return array(); -} - -/** - * Get the arguments from a task that are used to load contexts. - */ -function ctools_context_handler_get_task_arguments($task, $subtask) { - if ($function = ctools_plugin_get_function($task, 'get arguments')) { - return $function($task, $subtask); - } - - return array(); -} - -/** - * Set any access restrictions on the contexts for a handler. - * - * Both the task and the handler could add restrictions to the contexts - * based upon the access control. These restrictions might be useful - * to limit what kind of content appears in the add content dialog; - * for example, if we have an access item that limits a node context - * to only 'story' and 'page' types, there is no need for content that - * only applies to the 'poll' type to appear. - */ -function ctools_context_handler_set_access_restrictions($task, $subtask, $handler, &$contexts) { - // First, for the task: - if ($function = ctools_plugin_get_function($task, 'access restrictions')) { - $function($task, $subtask, $contexts); - } - - // Then for the handler: - if (isset($handler->conf['access'])) { - ctools_access_add_restrictions($handler->conf['access'], $contexts); - } -} - -/** - * Form to choose context based selection rules for a task handler. - * - * The configuration will be assumed to go simply in $handler->conf and - * will be keyed by the argument ID. - */ -function ctools_context_handler_edit_criteria($form, &$form_state) { - if (!isset($form_state['handler']->conf['access'])) { - $form_state['handler']->conf['access'] = array(); - } - - ctools_include('context'); - ctools_include('modal'); - ctools_include('ajax'); - ctools_modal_add_plugin_js(ctools_get_access_plugins()); - ctools_include('context-access-admin'); - $form_state['module'] = (isset($form_state['module'])) ? $form_state['module'] : 'page_manager_task_handler'; - // Encode a bunch of info into the argument so we can get our cache later. - $form_state['callback argument'] = $form_state['task_name'] . '*' . $form_state['handler']->name; - $form_state['access'] = $form_state['handler']->conf['access']; - $form_state['no buttons'] = TRUE; - $form_state['contexts'] = ctools_context_handler_get_all_contexts($form_state['task'], $form_state['subtask'], $form_state['handler']); - - $form['markup'] = array( - '#markup' => '
' . - t('If there is more than one variant on a page, when the page is visited each variant is given an opportunity to be displayed. Starting from the first variant and working to the last, each one tests to see if its selection rules will pass. The first variant that meets its criteria (as specified below) will be used.') . - '
', - ); - $form = ctools_access_admin_form($form, $form_state); - return $form; -} - -/** - * Submit handler for rules selection. - */ -function ctools_context_handler_edit_criteria_submit(&$form, &$form_state) { - $form_state['handler']->conf['access']['logic'] = $form_state['values']['logic']; -} - -/** - * Edit contexts that go with this panel. - */ -function ctools_context_handler_edit_context($form, &$form_state) { - ctools_include('context-admin'); - ctools_context_admin_includes(); - - $handler = $form_state['handler']; - $page = $form_state['page']; - $cache_name = $handler->name ? $handler->name : 'temp'; - if (isset($page->context_cache[$cache_name])) { - $cache = $page->context_cache[$cache_name]; - } - else { - $cache = ctools_context_handler_get_task_object($form_state['task'], $form_state['subtask'], $form_state['handler']); - $form_state['page']->context_cache[$cache_name] = $cache; - } - - $form['right'] = array( - '#prefix' => '
', - '#suffix' => '
', - ); - - $form['left'] = array( - '#prefix' => '
', - '#suffix' => '
', - ); - - $module = 'page_manager_context::' . $page->task_name; - ctools_context_add_context_form($module, $form, $form_state, $form['right']['contexts_table'], $cache); - ctools_context_add_relationship_form($module, $form, $form_state, $form['right']['relationships_table'], $cache); - - $theme_vars = array(); - $theme_vars['object'] = $cache; - $theme_vars['header'] = t('Summary of contexts'); - $form['left']['summary'] = array( - '#prefix' => '
', - '#suffix' => '
', - '#markup' => theme('ctools_context_list', $theme_vars), - ); - - $form_state['context_object'] = &$cache; - return $form; -} - -/** - * Process submission of the context edit form. - */ -function ctools_context_handler_edit_context_submit(&$form, &$form_state) { - $handler = &$form_state['handler']; - - $cache_name = $handler->name ? $handler->name : 'temp'; - - $handler->conf['contexts'] = $form_state['context_object']->contexts; - $handler->conf['relationships'] = $form_state['context_object']->relationships; - if (isset($form_state['page']->context_cache[$cache_name])) { - unset($form_state['page']->context_cache[$cache_name]); - } -} diff --git a/html/sites/all/modules/contrib/ctools/includes/context.inc b/html/sites/all/modules/contrib/ctools/includes/context.inc deleted file mode 100644 index 7cb3ae7ac..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/context.inc +++ /dev/null @@ -1,2106 +0,0 @@ -type = $type; - $this->data = $data; - $this->title = t('Unknown context'); - $this->page_title = ''; - $this->identifier = ''; - $this->keyword = ''; - $this->restrictions = array(); - $this->empty = FALSE; - // Other vars are NULL. - } - - /** - * Determine whether this object is of type @var $type . - * - * Both the internal value ($this->type) and the supplied value ($type) can - * be a string or an array of strings, and if one or both are arrays the match - * succeeds if at least one common element is found. - * - * Type names - * - * @param string|array $type - * 'type' can be: - * - 'any' to match all types (this is true of the internal value too). - * - an array of type name strings, when more than one type is acceptable. - * - * @return bool - * True if the type matches, False otherwise. - */ - public function is_type($type) { - if ($type === 'any' || $this->type === 'any') { - return TRUE; - } - - $a = is_array($type) ? $type : array($type); - $b = is_array($this->type) ? $this->type : array($this->type); - return (bool) array_intersect($a, $b); - } - - /** - * Return the argument. - * - * @return mixed - * The value of $argument. - */ - public function get_argument() { - return $this->argument; - } - - /** - * Return the value of argument (or arg) variable as it was passed in. - * - * For example see ctools_plugin_load_function() and ctools_terms_context(). - * - * @return mixed - * The original arg value. - */ - public function get_original_argument() { - if (!is_null($this->original_argument)) { - return $this->original_argument; - } - return $this->argument; - } - - /** - * Return the keyword. - * - * @return mixed - * The value of $keyword. - */ - public function get_keyword() { - return $this->keyword; - } - - /** - * Return the identifier. - * - * @return mixed - * The value of $identifier. - */ - public function get_identifier() { - return $this->identifier; - } - - /** - * Return the title. - * - * @return mixed - * The value of $title. - */ - public function get_title() { - return $this->title; - } - - /** - * Return the page title. - * - * @return mixed - * The value of $page_title. - */ - public function get_page_title() { - return $this->page_title; - } - -} - -/** - * Used to create a method of comparing if a list of contexts - * match a required context type. - */ -#[\AllowDynamicProperties] -class ctools_context_required { - /** - * @var array - * Keyword strings associated with the context. - */ - public $keywords; - - /** - * If set, the title will be used in the selector to identify - * the context. This is very useful when multiple contexts - * are required to inform the user will be used for what. - */ - public $title; - - /** - * Test to see if this context is required. - */ - public $required = TRUE; - - /** - * If TRUE, skip the check in ctools_context_required::select() - * for contexts whose names may have changed. - */ - public $skip_name_check = FALSE; - - /** - * The ctools_context_required constructor. - * - * Note: Constructor accepts a variable number of arguments, with optional - * type-dependent args at the end of the list and one required argument, - * the title. Note in particular that skip_name_check MUST be passed in as - * a boolean (and not, for example, as an integer). - * - * @param string $title - * The title of the context for use in UI selectors when multiple contexts - * qualify. - * @param string $keywords - * One or more keywords to use for matching which contexts are allowed. - * @param array $restrictions - * Array of context restrictions. - * @param bool $skip_name_check - * If True, skip the check in select() for contexts whose names may have - * changed. - */ - public function __construct($title) { - // If it was possible, using variadic syntax this should be: - // __construct($title, string ...$keywords, array $restrictions = NULL, bool $skip = NULL) - // but that form isn't allowed. - $args = func_get_args(); - $this->title = array_shift($args); - - // If we have a boolean value at the end for $skip_name_check, store it. - if (is_bool(end($args))) { - $this->skip_name_check = array_pop($args); - } - - // If we were given restrictions at the end, store them. - if (count($args) > 1 && is_array(end($args))) { - $this->restrictions = array_pop($args); - } - - if (count($args) === 1) { - $args = array_shift($args); - } - $this->keywords = $args; - } - - /** - * Filter the contexts to determine which apply in the current environment. - * - * A context passes the filter if: - * - the context matches 'type' of the required keywords (uses - * ctools_context::is_type(), so includes 'any' matches, etc). - * - AND if restrictions are present, there are some common elements between - * the requirement and the context. - * - * @param array $contexts - * An array of ctools_context objects (or something which will cast to an - * array of them). The contexts to apply the filter on. - * - * @return array - * An array of context objects, keyed with the same keys used for $contexts, - * which pass the filter. - * - * @see ctools_context::is_type() - */ - public function filter($contexts) { - $result = array(); - - /** - * See which of these contexts are valid. - * @var ctools_context $context - */ - foreach ((array) $contexts as $cid => $context) { - if ($context->is_type($this->keywords)) { - - // Compare to see if our contexts were met. - if (!empty($this->restrictions) && !empty($context->restrictions)) { - - foreach ($this->restrictions as $key => $values) { - // If we have a restriction, the context must either not have that - // restriction listed, which means we simply don't know what it is, - // or there must be an intersection of the restricted values on - // both sides. - if (!is_array($values)) { - $values = array($values); - } - - if (!empty($context->restrictions[$key]) - && !array_intersect($values, $context->restrictions[$key]) - ) { - // Break out to check next context; this one fails the filter. - continue 2; - } - } - } - // This context passes the filter. - $result[$cid] = $context; - } - } - - return $result; - } - - /** - * Select one context from the list of contexts, accounting for changed IDs. - * - * Fundamentally, this returns $contexts[$context] or FALSE if that does not - * exist. Additional logic accounts for changes in context names and dealing - * with a $contexts parameter that is not an array. - * - * If we had requested a $context but that $context doesn't exist in our - * context list, there is a good chance that what happened is the context - * IDs changed. Look for another context that satisfies our requirements, - * unless $skip_name_check is set. - * - * @param ctools_context|array $contexts - * A context, or an array of ctools_context. - * @param string $context - * A context ID. - * - * @return bool|ctools_context - * The matching ctools_context, or False if no such context was found. - */ - public function select($contexts, $context) { - // Easier to deal with a standalone object as a 1-element array of objects. - if (!is_array($contexts)) { - if (is_object($contexts) && $contexts instanceof ctools_context) { - $contexts = array($contexts->id => $contexts); - } - else { - $contexts = array($contexts); - } - } - - // If we had requested a $context but that $context doesn't exist in our - // context list, there is a good chance that what happened is the context - // IDs changed. Check for another context that satisfies our requirements. - if (!$this->skip_name_check - && !empty($context) && !isset($contexts[$context]) - ) { - $choices = $this->filter($contexts); - - // If we got a hit, take the first one that matches. - if ($choices) { - $keys = array_keys($choices); - $context = reset($keys); - } - } - - if (empty($context) || empty($contexts[$context])) { - return FALSE; - } - return $contexts[$context]; - } - -} - -/** - * Used to compare to see if a list of contexts match an optional context. This - * can produce empty contexts to use as placeholders. - */ -#[\AllowDynamicProperties] -class ctools_context_optional extends ctools_context_required { - - /** - * {@inheritdoc} - */ - public $required = FALSE; - - /** - * Add the 'empty' context to the existing set. - * - * @param array &$contexts - * An array of ctools_context objects. - */ - public function add_empty(&$contexts) { - $context = new ctools_context('any'); - $context->title = t('No context'); - $context->identifier = t('No context'); - $contexts['empty'] = $context; - } - - /** - * Filter the contexts to determine which apply in the current environment. - * - * As for ctools_context_required, but we add the empty context to those - * passed in so the check is optional (i.e. if nothing else matches, the - * empty context will, and so there will always be at least one matched). - * - * @param array $contexts - * An array of ctools_context objects (or something which will cast to an - * array of them). The contexts to apply the filter on. - * - * @return array - * An array of context objects, keyed with the same keys used for $contexts, - * which pass the filter. - * - * @see ctools_context::is_type() - */ - public function filter($contexts) { - /** - * @todo We are assuming here that $contexts is actually an array, whereas - * ctools_context_required::filter only requires $contexts is convertible - * to an array. - */ - $this->add_empty($contexts); - return parent::filter($contexts); - } - - /** - * Select and return one context from the list of applicable contexts. - * - * Fundamentally, this returns $contexts[$context] or the empty context if - * that does not exist. - * - * @param array $contexts - * The applicable contexts to check. - * @param string $context - * The context id to check for. - * - * @return bool|ctools_context - * The matching ctools_context, or False if no such context was found. - * - * @see ctools_context_required::select() - */ - public function select($contexts, $context) { - /** - * @todo We are assuming here that $contexts is actually an array, whereas - * ctools_context_required::select permits ctools_context objects as well. - */ - $this->add_empty($contexts); - if (empty($context)) { - return $contexts['empty']; - } - - $result = parent::select($contexts, $context); - - // Don't flip out if it can't find the context; this is optional, put - // in an empty. - if ($result === FALSE) { - $result = $contexts['empty']; - } - return $result; - } - -} - -/** - * Return a keyed array of context that match the given 'required context' - * filters. - * - * Functions or systems that require contexts of a particular type provide a - * ctools_context_required or ctools_context_optional object. This function - * examines that object and an array of contexts to determine which contexts - * match the filter. - * - * Since multiple contexts can be required, this function will accept either - * an array of all required contexts, or just a single required context object. - * - * @param array $contexts - * A keyed array of all available contexts. - * @param array|ctools_context_required|ctools_context_optional $required - * A *_required or *_optional object, or an array of such objects, which - * define the selection condition. - * - * @return array - * A keyed array of contexts that match the filter. - */ -function ctools_context_filter($contexts, $required) { - if (is_array($required)) { - $result = array(); - foreach ($required as $item) { - $result = array_merge($result, _ctools_context_filter($contexts, $item)); - } - return $result; - } - - return _ctools_context_filter($contexts, $required); -} - -/** - * Helper function for ctools_context_filter(). - * - * Used to transform the required context during the merge into the final array. - * - * @internal This function DOES NOT form part of the CTools API. - * - * @param array $contexts - * A keyed array of all available contexts. - * @param ctools_context_required|ctools_context_optional $required - * A ctools_context_required or ctools_context_optional object, although if - * given something else will return an empty array. - * - * @return array - */ -function _ctools_context_filter($contexts, $required) { - $result = array(); - - if (is_object($required)) { - $result = $required->filter($contexts); - } - - return $result; -} - -/** - * Create a select box to choose possible contexts. - * - * This only creates a selector if there is actually a choice; if there - * is only one possible context, that one is silently assigned. - * - * If an array of required contexts is provided, one selector will be - * provided for each context. - * - * @param array $contexts - * A keyed array of all available contexts. - * @param array|ctools_context_required|ctools_context_optional $required - * The required context object or array of objects. - * @param array|string $default - * The default value for the select object, suitable for a #default_value - * render key. Where $required is an array, this is an array keyed by the - * same key values as $required for all keys where an empty string is not a - * suitable default. Otherwise it is just the default value. - * - * @return array - * A form element, or NULL if there are no contexts that satisfy the - * requirements. - */ -function ctools_context_selector($contexts, $required, $default) { - if (is_array($required)) { - $result = array('#tree' => TRUE); - $count = 1; - foreach ($required as $id => $item) { - $result[] = _ctools_context_selector( - $contexts, $item, isset($default[$id]) ? $default[$id] : '', $count++ - ); - } - return $result; - } - - return _ctools_context_selector($contexts, $required, $default); -} - -/** - * Helper function for ctools_context_selector(). - * - * @internal This function DOES NOT form part of the CTools API. Use the API - * function ctools_context_selector() instead. - * - * @param array $contexts - * A keyed array of all available contexts. - * @param ctools_context_required|ctools_context_optional $required - * The required context object. - * @param $default - * The default value for the select object, suitable for a #default_value - * render key. - * @param int $num - * If supplied and non-zero, the title of the select form element will be - * "Context $num", otherwise it will be "Context". - * - * @return array - * A form element, or NULL if there are no contexts that satisfy the - * requirements. - */ -function _ctools_context_selector($contexts, $required, $default, $num = 0) { - $filtered = ctools_context_filter($contexts, $required); - $count = count($filtered); - - $form = array(); - - if ($count >= 1) { - // If there's more than one to choose from, create a select widget. - foreach ($filtered as $cid => $context) { - $options[$cid] = $context->get_identifier(); - } - if (!empty($required->title)) { - $title = $required->title; - } - else { - $title = $num ? t('Context %count', array('%count' => $num)) : t('Context'); - } - - $form = array( - '#type' => 'select', - '#options' => $options, - '#title' => $title, - '#default_value' => $default, - ); - } - - return $form; -} - -/** - * Are there enough contexts for a plugin? - * - * Some plugins can have a 'required contexts' item which can either - * be a context requirement object or an array of them. When contexts - * are required, items that do not have enough contexts should not - * appear. This tests an item to see if it has enough contexts - * to actually appear. - * - * @param $contexts - * A keyed array of all available contexts. - * @param $required - * The required context object or array of objects. - * - * @return bool - * True if there are enough contexts, otherwise False. - */ -function ctools_context_match_requirements($contexts, $required) { - if (!is_array($required)) { - $required = array($required); - } - - // Get the keys to avoid bugs in PHP 5.0.8 with keys and loops. - // And use it to remove optional contexts. - $keys = array_keys($required); - foreach ($keys as $key) { - if (empty($required[$key]->required)) { - unset($required[$key]); - } - } - - $count = count($required); - return (count(ctools_context_filter($contexts, $required)) >= $count); -} - -/** - * Create a select box to choose possible contexts. - * - * This only creates a selector if there is actually a choice; if there - * is only one possible context, that one is silently assigned. - * - * If an array of required contexts is provided, one selector will be - * provided for each context. - * - * @param $contexts - * A keyed array of all available contexts. - * @param $required - * The required context object or array of objects. - * @param array|string $default - * The default value for the select object, suitable for a #default_value - * render key. Where $required is an array, this is an array keyed by the - * same key values as $required for all keys where an empty string is not a - * suitable default. Otherwise it is just the default value. - * - * @return array - * A form element, or NULL if there are no contexts that satisfy the - * requirements. - */ -function ctools_context_converter_selector($contexts, $required, $default) { - if (is_array($required)) { - $result = array('#tree' => TRUE); - $count = 1; - foreach ($required as $id => $dependency) { - $default_id = isset($default[$id]) ? $default[$id] : ''; - $result[] = _ctools_context_converter_selector( - $contexts, $dependency, $default_id, $count++ - ); - } - return $result; - } - - return _ctools_context_converter_selector($contexts, $required, $default); -} - -/** - * Helper function for ctools_context_converter_selector(). - * - * @internal This function DOES NOT form part of the CTools API. Use the API - * function ctools_context_converter_selector() instead. - * - * @param array $contexts - * A keyed array of all available contexts. - * @param ctools_context $required - * The required context object. - * @param $default - * The default value for the select object, suitable for a #default_value - * render key. - * @param int $num - * If supplied and non-zero, the title of the select form element will be - * "Context $num", otherwise it will be "Context". - * - * @return array|null - * A form element, or NULL if there are no contexts that satisfy the - * requirements. - */ -function _ctools_context_converter_selector($contexts, $required, $default, $num = 0) { - $filtered = ctools_context_filter($contexts, $required); - $count = count($filtered); - - if ($count > 1) { - // If there's more than one to choose from, create a select widget. - $options = array(); - foreach ($filtered as $cid => $context) { - if ($context->type === 'any') { - $options[''] = t('No context'); - continue; - } - $key = $context->get_identifier(); - if ($converters = ctools_context_get_converters($cid . '.', $context)) { - $options[$key] = $converters; - } - } - if (empty($options)) { - return array( - '#type' => 'value', - '#value' => 'any', - ); - } - if (!empty($required->title)) { - $title = $required->title; - } - else { - $title = $num ? t('Context %count', array('%count' => $num)) : t('Context'); - } - - return array( - '#type' => 'select', - '#options' => $options, - '#title' => $title, - '#description' => t('Please choose which context and how you would like it converted.'), - '#default_value' => $default, - ); - } - else { - // Not enough choices to need a selector, so don't make one. - return NULL; - } -} - -/** - * Get a list of converters available for a given context. - * - * @param string $cid - * A context ID. - * @param ctools_context $context - * The context for which converters are needed. - * - * @return array - * A list of context converters. - */ -function ctools_context_get_converters($cid, $context) { - if (empty($context->plugin)) { - return array(); - } - - return _ctools_context_get_converters($cid, $context->plugin); -} - -/** - * Get a list of converters available for a given context. - * - * @internal This function DOES NOT form part of the CTools API. Use the API - * function ctools_context_get_converters() instead. - * - * @param string $id - * A context ID. - * @param string $plugin_name - * The name of the context plugin. - * - * @return array - * A list of context converters. - */ -function _ctools_context_get_converters($id, $plugin_name) { - $plugin = ctools_get_context($plugin_name); - if (empty($plugin['convert list'])) { - return array(); - } - - $converters = array(); - if (is_array($plugin['convert list'])) { - $converters = $plugin['convert list']; - } - elseif ($function = ctools_plugin_get_function($plugin, 'convert list')) { - $converters = (array) $function($plugin); - } - - foreach (module_implements('ctools_context_convert_list_alter') as $module) { - $function = $module . '_ctools_context_convert_list_alter'; - $function($plugin, $converters); - } - - // Now, change them all to include the plugin: - $return = array(); - foreach ($converters as $key => $title) { - $return[$id . $key] = $title; - } - - natcasesort($return); - return $return; -} - -/** - * Get a list of all contexts converters available. - * - * For all contexts returned by ctools_get_contexts(), return the converter - * for all contexts that have one. - * - * @return array - * A list of context converters, keyed by the title of the converter. - */ -function ctools_context_get_all_converters() { - $contexts = ctools_get_contexts(); - $converters = array(); - foreach ($contexts as $name => $context) { - if (empty($context['no required context ui'])) { - $context_converters = _ctools_context_get_converters($name . '.', $name); - if ($context_converters) { - $converters[$context['title']] = $context_converters; - } - } - } - - return $converters; -} - -/** - * Let the context convert an argument based upon the converter that was given. - * - * @param ctools_context $context - * The context object. - * @param string $converter - * The type of converter to use, which should be a string provided by the - * converter list function. - * @param array $converter_options - * An array of options to pass on to the generation function. For contexts - * that use token module, of particular use is 'sanitize' => FALSE which can - * get raw tokens. This should ONLY be used in values that will later be - * treated as unsafe user input since these values are by themselves unsafe. - * It is particularly useful to get raw values from Field API. - * - * @return string|null - */ -function ctools_context_convert_context($context, $converter, $converter_options = array()) { - // Contexts without plugins might be optional placeholders. - if (empty($context->plugin)) { - return NULL; - } - - $value = $context->argument; - $plugin = ctools_get_context($context->plugin); - if ($function = ctools_plugin_get_function($plugin, 'convert')) { - $value = $function($context, $converter, $converter_options); - } - - foreach (module_implements('ctools_context_converter_alter') as $module) { - $function = $module . '_ctools_context_converter_alter'; - $function($context, $converter, $value, $converter_options); - } - - return $value; -} - -/** - * Choose a context or contexts based upon the selection made via - * ctools_context_filter. - * - * @param array $contexts - * A keyed array of all available contexts. - * @param array|ctools_context_required $required - * The required context object(s) provided by the plugin. - * @param $context - * The selection made using ctools_context_selector(). - * - * @return ctools_context|array|false - * Returns FALSE if $required is not an object, or array of objects, or - * the value of $required->select() for the context, or an array of those (if - * passed an array in $required). - */ -function ctools_context_select($contexts, $required, $context) { - if (is_array($required)) { - - /** - * @var array $required - * Array of required context objects. - * @var ctools_context_required $item - * A required context object. - */ - $result = array(); - foreach ($required as $id => $item) { - // @todo What's the difference between the following and "empty($item)" ? - if (empty($required[$id])) { - continue; - } - - if (($result[] = _ctools_context_select($contexts, $item, $context[$id])) === FALSE) { - return FALSE; - } - } - return $result; - } - - return _ctools_context_select($contexts, $required, $context); -} - -/** - * Helper function for calling the required context object's selection function. - * - * This function DOES NOT form part of the CTools API. - * - * @param array $contexts - * A keyed array of all available contexts. - * @param ctools_context_required $required - * The required context object provided by the plugin. - * @param $context - * The selection made using ctools_context_selector(). - * - * @return ctools_context|bool - * FALSE if the $required is not an object. A ctools_context object if one - * matched. - */ -function _ctools_context_select($contexts, $required, $context) { - if (!is_object($required)) { - return FALSE; - } - - return $required->select($contexts, $context); -} - -/** - * Create a new context object. - * - * @param string $type - * The type of context to create; this loads a plugin. - * @param mixed $data - * The data to put into the context. - * @param $conf - * A configuration structure if this context was created via UI. - * - * @return ctools_context - * A $context or NULL if one could not be created. - */ -function ctools_context_create($type, $data = NULL, $conf = FALSE) { - ctools_include('plugins'); - $plugin = ctools_get_context($type); - - if ($function = ctools_plugin_get_function($plugin, 'context')) { - return $function(FALSE, $data, $conf, $plugin); - } -} - -/** - * Create an empty context object. - * - * Empty context objects are primarily used as placeholders in the UI where - * the actual contents of a context object may not be known. It may have - * additional text embedded to give the user clues as to how the context - * is used. - * - * @param $type - * The type of context to create; this loads a plugin. - * - * @return ctools_context - * A $context or NULL if one could not be created. - */ -function ctools_context_create_empty($type) { - $plugin = ctools_get_context($type); - if ($function = ctools_plugin_get_function($plugin, 'context')) { - $context = $function(TRUE, NULL, FALSE, $plugin); - if (is_object($context)) { - $context->empty = TRUE; - } - - return $context; - } -} - -/** - * Perform keyword and context substitutions. - * - * @param string $string - * The string in which to replace keywords. - * @param array $keywords - * Array of keyword-replacement pairs. - * @param array $contexts - * - * @param array $converter_options - * Options to pass on to ctools_context_convert_context(), defaults to an - * empty array. - * - * @return string - * The returned string, with substitutions performed. - */ -function ctools_context_keyword_substitute($string, $keywords, $contexts, array $converter_options = array()) { - // Ensure a default keyword exists: - $keywords['%%'] = '%'; - - // Match contexts to the base keywords: - $context_keywords = array(); - foreach ($contexts as $context) { - if (isset($context->keyword)) { - $context_keywords[$context->keyword] = $context; - } - } - - // Look for context matches we we only have to convert known matches. - $matches = array(); - if (preg_match_all('/%(%|[a-zA-Z0-9_-]+(?:\:[a-zA-Z0-9_-]+)*)/us', $string, $matches)) { - foreach ($matches[1] as $keyword) { - // Ignore anything it finds with %%. - if ($keyword[0] == '%') { - continue; - } - - // If the keyword is already set by something passed in, don't try to - // overwrite it. - if (array_key_exists('%' . $keyword, $keywords)) { - continue; - } - - // Figure out our keyword and converter, if specified. - if (strpos($keyword, ':')) { - list($context, $converter) = explode(':', $keyword, 2); - } - else { - $context = $keyword; - if (isset($context_keywords[$keyword])) { - $plugin = ctools_get_context($context_keywords[$context]->plugin); - - // Fall back to a default converter, if specified. - if ($plugin && !empty($plugin['convert default'])) { - $converter = $plugin['convert default']; - } - } - } - - if (!isset($context_keywords[$context])) { - $keywords['%' . $keyword] = '%' . $keyword; - } - else { - if (empty($context_keywords[$context]) || !empty($context_keywords[$context]->empty)) { - $keywords['%' . $keyword] = ''; - } - else { - if (!empty($converter)) { - $keywords['%' . $keyword] = ctools_context_convert_context($context_keywords[$context], $converter, $converter_options); - } - else { - $keywords['%' . $keyword] = $context_keywords[$keyword]->title; - } - } - } - } - } - return strtr($string, $keywords); -} - -/** - * Determine a unique context ID for a context. - * - * Often contexts of many different types will be placed into a list. This - * ensures that even though contexts of multiple types may share IDs, they - * are unique in the final list. - */ -function ctools_context_id($context, $type = 'context') { - // If not set, FALSE or empty. - if (!isset($context['id']) || !$context['id']) { - $context['id'] = 1; - } - - // @todo is '' the appropriate default value? - $name = isset($context['name']) ? $context['name'] : ''; - - return $type . '_' . $name . '_' . $context['id']; -} - -/** - * Get the next id available given a list of already existing objects. - * - * This finds the next id available for the named object. - * - * @param array $objects - * A list of context descriptor objects, i.e, arguments, relationships, - * contexts, etc. - * @param string $name - * The name being used. - * - * @return int - * The next integer id available. - */ -function ctools_context_next_id($objects, $name) { - $id = 0; - // Figure out which instance of this argument we're creating. - if (!$objects) { - return $id + 1; - } - - foreach ($objects as $object) { - if (isset($object['name']) && $object['name'] === $name) { - if (isset($object['id']) && $object['id'] > $id) { - $id = (int) $object['id']; - } - // @todo If obj has no 'id', should we increment local id? $id = $id + 1; - } - } - - return $id + 1; -} - -// --------------------------------------------------------------------------- -// Functions related to contexts from arguments. -/** - * Fetch metadata for a specific argument plugin. - * - * @param $argument - * Name of an argument plugin. - * - * @return array - * An array with information about the requested argument plugin. - */ - -function ctools_get_argument($argument) { - ctools_include('plugins'); - return ctools_get_plugins('ctools', 'arguments', $argument); -} - -/** - * Fetch metadata for all argument plugins. - * - * @return array - * An array of arrays with information about all available argument plugins. - */ -function ctools_get_arguments() { - ctools_include('plugins'); - return ctools_get_plugins('ctools', 'arguments'); -} - -/** - * Get a context from an argument. - * - * @param $argument - * The configuration of an argument. It must contain the following data: - * - name: The name of the argument plugin being used. - * - argument_settings: The configuration based upon the plugin forms. - * - identifier: The human readable identifier for this argument, usually - * defined by the UI. - * - keyword: The keyword used for this argument for substitutions. - * - * @param $arg - * The actual argument received. This is expected to be a string from a URL - * but this does not have to be the only source of arguments. - * @param $empty - * If true, the $arg will not be used to load the context. Instead, an empty - * placeholder context will be loaded. - * - * @return ctools_context - * A context object if one can be loaded. - */ -function ctools_context_get_context_from_argument($argument, $arg, $empty = FALSE) { - ctools_include('plugins'); - if (empty($argument['name'])) { - return NULL; - } - - $function = ctools_plugin_load_function('ctools', 'arguments', $argument['name'], 'context'); - if ($function) { - // Backward compatibility: Merge old style settings into new style: - if (!empty($argument['settings'])) { - $argument += $argument['settings']; - unset($argument['settings']); - } - - $context = $function($arg, $argument, $empty); - - if (is_object($context)) { - $context->identifier = $argument['identifier']; - $context->page_title = isset($argument['title']) ? $argument['title'] : ''; - $context->keyword = $argument['keyword']; - $context->id = ctools_context_id($argument, 'argument'); - $context->original_argument = $arg; - - if (!empty($context->empty)) { - $context->placeholder = array( - 'type' => 'argument', - 'conf' => $argument, - ); - } - } - return $context; - } -} - -/** - * Retrieve a list of empty contexts for all arguments. - * - * @param array $arguments - * - * @return array - * - * @see ctools_context_get_context_from_arguments() - */ -function ctools_context_get_placeholders_from_argument($arguments) { - $contexts = array(); - foreach ($arguments as $argument) { - $context = ctools_context_get_context_from_argument($argument, NULL, TRUE); - if ($context) { - $contexts[ctools_context_id($argument, 'argument')] = $context; - } - } - return $contexts; -} - -/** - * Load the contexts for a given list of arguments. - * - * @param array $arguments - * The array of argument definitions. - * @param array &$contexts - * The array of existing contexts. New contexts will be added to this array. - * @param array $args - * The arguments to load. - * - * @return bool - * TRUE if all is well, FALSE if an argument wants to 404. - * - * @see ctools_context_get_context_from_argument() - */ -function ctools_context_get_context_from_arguments($arguments, &$contexts, $args) { - foreach ($arguments as $argument) { - // Pull the argument off the list. - $arg = array_shift($args); - $id = ctools_context_id($argument, 'argument'); - - // For % arguments embedded in the URL, our context is already loaded. - // There is no need to go and load it again. - if (empty($contexts[$id])) { - if ($context = ctools_context_get_context_from_argument($argument, $arg)) { - $contexts[$id] = $context; - } - } - else { - $context = $contexts[$id]; - } - - if ((empty($context) || empty($context->data)) - && !empty($argument['default']) - && $argument['default'] === '404' - ) { - return FALSE; - } - } - return TRUE; -} - -// --------------------------------------------------------------------------- -// Functions related to contexts from relationships. -/** - * Fetch plugin metadata for a specific relationship plugin. - * - * @param $relationship - * Name of a panel content type. - * - * @return array - * An array with information about the requested relationship. - * - * @see ctools_get_relationships() - */ - -function ctools_get_relationship($relationship) { - ctools_include('plugins'); - return ctools_get_plugins('ctools', 'relationships', $relationship); -} - -/** - * Fetch metadata for all relationship plugins. - * - * @return array - * An array of arrays with information about all available relationships. - * - * @see ctools_get_relationship() - */ -function ctools_get_relationships() { - ctools_include('plugins'); - return ctools_get_plugins('ctools', 'relationships'); -} - -/** - * Return a context from a relationship. - * - * @param array $relationship - * The configuration of a relationship. It must contain the following data: - * - name: The name of the relationship plugin being used. - * - relationship_settings: The configuration based upon the plugin forms. - * - identifier: The human readable identifier for this relationship, usually - * defined by the UI. - * - keyword: The keyword used for this relationship for substitutions. - * - * @param ctools_context $source_context - * The context this relationship is based upon. - * @param bool $placeholders - * If TRUE, placeholders are acceptable. - * - * @return ctools_context|null - * A context object if one can be loaded, otherwise NULL. - * - * @see ctools_context_get_relevant_relationships() - * @see ctools_context_get_context_from_relationships() - */ -function ctools_context_get_context_from_relationship($relationship, $source_context, $placeholders = FALSE) { - ctools_include('plugins'); - $function = ctools_plugin_load_function('ctools', 'relationships', $relationship['name'], 'context'); - if ($function) { - // Backward compatibility: Merge old style settings into new style: - if (!empty($relationship['relationship_settings'])) { - $relationship += $relationship['relationship_settings']; - unset($relationship['relationship_settings']); - } - - $context = $function($source_context, $relationship, $placeholders); - if ($context) { - $context->identifier = $relationship['identifier']; - $context->page_title = isset($relationship['title']) ? $relationship['title'] : ''; - $context->keyword = $relationship['keyword']; - if (!empty($context->empty)) { - $context->placeholder = array( - 'type' => 'relationship', - 'conf' => $relationship, - ); - } - return $context; - } - } - return NULL; -} - -/** - * Fetch all relevant relationships. - * - * Relevant relationships are any relationship that can be created based upon - * the list of existing contexts. For example, the 'node author' relationship - * is relevant if there is a 'node' context, but makes no sense if there is - * not one. - * - * @param $contexts - * An array of contexts used to figure out which relationships are relevant. - * - * @return array - * An array of relationship keys that are relevant for the given set of - * contexts. - * - * @see ctools_context_filter() - * @see ctools_context_get_context_from_relationship() - * @see ctools_context_get_context_from_relationships() - */ -function ctools_context_get_relevant_relationships($contexts) { - $relevant = array(); - $relationships = ctools_get_relationships(); - - // Go through each relationship. - foreach ($relationships as $rid => $relationship) { - // For each relationship, see if there is a context that satisfies it. - if (empty($relationship['no ui']) - && ctools_context_filter($contexts, $relationship['required context']) - ) { - $relevant[$rid] = $relationship['title']; - } - } - - return $relevant; -} - -/** - * Fetch all active relationships. - * - * @param $relationships - * An keyed array of relationship data including: - * - name: name of relationship - * - context: context id relationship belongs to. This will be used to - * identify which context in the $contexts array to use to create the - * relationship context. - * - * @param $contexts - * A keyed array of contexts used to figure out which relationships - * are relevant. New contexts will be added to this. - * - * @param $placeholders - * If TRUE, placeholders are acceptable. - * - * @see ctools_context_get_context_from_relationship() - * @see ctools_context_get_relevant_relationships() - */ -function ctools_context_get_context_from_relationships($relationships, &$contexts, $placeholders = FALSE) { - foreach ($relationships as $rdata) { - if (!isset($rdata['context'])) { - continue; - } - - if (is_array($rdata['context'])) { - $rcontexts = array(); - foreach ($rdata['context'] as $cid) { - if (!empty($contexts[$cid])) { - $rcontexts[] = $contexts[$cid]; - } - } - } - elseif (!empty($contexts[$rdata['context']])) { - $rcontexts = $contexts[$rdata['context']]; - } - - $cid = ctools_context_id($rdata, 'relationship'); - if ($context = ctools_context_get_context_from_relationship($rdata, $rcontexts)) { - $contexts[$cid] = $context; - } - } -} - -// --------------------------------------------------------------------------- -// Functions related to loading contexts from simple context definitions. -/** - * Fetch metadata on a specific context plugin. - * - * @param string $context - * Name of a context. - * - * @return array - * An array with information about the requested panel context. - */ - -function ctools_get_context($context) { - static $gate = array(); - ctools_include('plugins'); - $plugin = ctools_get_plugins('ctools', 'contexts', $context); - if (empty($gate['context']) && !empty($plugin['superceded by'])) { - // This gate prevents infinite loops. - $gate[$context] = TRUE; - $new_plugin = ctools_get_plugins('ctools', 'contexts', $plugin['superceded by']); - $gate[$context] = FALSE; - - // If a new plugin was returned, return it. Otherwise fall through and - // return the original we fetched. - if ($new_plugin) { - return $new_plugin; - } - } - - return $plugin; -} - -/** - * Fetch metadata for all context plugins. - * - * @return array - * An array of arrays with information about all available panel contexts. - */ -function ctools_get_contexts() { - ctools_include('plugins'); - return ctools_get_plugins('ctools', 'contexts'); -} - -/** - * Return a context object from a context definition array. - * - * The input $context contains the information needed to identify and invoke - * the context plugin and create the plugin context from that. - * - * @param array $context - * The configuration of a context. It must contain the following data: - * - name: The name of the context plugin being used. - * - context_settings: The configuration based upon the plugin forms. - * - identifier: The human readable identifier for this context, usually - * defined by the UI. - * - keyword: The keyword used for this context for substitutions. - * @param string $type - * This is either 'context' which indicates the context will be loaded - * from data in the settings, or 'requiredcontext' which means the - * context must be acquired from an external source. This is the method - * used to pass pure contexts from one system to another. - * @param mixed $argument - * Optional information passed to the plugin context via the arg defined in - * the plugin's "placeholder name" field. - * - * @return ctools_context|null - * A context object if one can be loaded. - * - * @see ctools_get_context() - * @see ctools_plugin_get_function() - */ -function ctools_context_get_context_from_context($context, $type = 'context', $argument = NULL) { - ctools_include('plugins'); - $plugin = ctools_get_context($context['name']); - $function = ctools_plugin_get_function($plugin, 'context'); - if ($function) { - // Backward compatibility: Merge old style settings into new style: - if (!empty($context['context_settings'])) { - $context += $context['context_settings']; - unset($context['context_settings']); - } - - if (isset($argument) && isset($plugin['placeholder name'])) { - $context[$plugin['placeholder name']] = $argument; - } - - $return = $function($type == 'requiredcontext', $context, TRUE, $plugin); - if ($return) { - $return->identifier = $context['identifier']; - $return->page_title = isset($context['title']) ? $context['title'] : ''; - $return->keyword = $context['keyword']; - - if (!empty($context->empty)) { - $context->placeholder = array( - 'type' => 'context', - 'conf' => $context, - ); - } - - return $return; - } - } - - return NULL; -} - -/** - * Retrieve a list of base contexts based upon a simple 'contexts' definition. - * - * For required contexts this will always retrieve placeholders. - * - * @param $contexts - * The list of contexts defined in the UI. - * @param $type - * Either 'context' or 'requiredcontext', which indicates whether the contexts - * are loaded from internal data or copied from an external source. - * @param $placeholders - * If True, placeholders are acceptable. - * - * @return array - * Array of contexts, keyed by context ID. - */ -function ctools_context_get_context_from_contexts($contexts, $type = 'context', $placeholders = FALSE) { - $return = array(); - foreach ($contexts as $context) { - $ctext = ctools_context_get_context_from_context($context, $type); - if ($ctext) { - if ($placeholders) { - $ctext->placeholder = TRUE; - } - $return[ctools_context_id($context, $type)] = $ctext; - } - } - return $return; -} - -/** - * Match up external contexts to our required contexts. - * - * This function is used to create a list of contexts with proper IDs based - * upon a list of required contexts. - * - * These contexts passed in should match the numeric positions of the required - * contexts. The caller must ensure this has already happened correctly as this - * function will not detect errors here. - * - * @param $required - * A list of required contexts as defined by the UI. - * @param $contexts - * A list of matching contexts as passed in from the calling system. - * - * @return array - * Array of contexts, keyed by context ID. - */ -function ctools_context_match_required_contexts($required, $contexts) { - $return = array(); - if (!is_array($required)) { - return $return; - } - - foreach ($required as $r) { - $context = clone array_shift($contexts); - $context->identifier = $r['identifier']; - $context->page_title = isset($r['title']) ? $r['title'] : ''; - $context->keyword = $r['keyword']; - $return[ctools_context_id($r, 'requiredcontext')] = $context; - } - - return $return; -} - -/** - * Load a full array of contexts for an object. - * - * Not all of the types need to be supported by this object. - * - * This function is not used to load contexts from external data, but may be - * used to load internal contexts and relationships. Otherwise it can also be - * used to generate a full set of placeholders for UI purposes. - * - * @param object $object - * An object that contains some or all of the following variables: - * - * - requiredcontexts: A list of UI configured contexts that are required - * from an external source. Since these require external data, they will - * only be added if $placeholders is set to TRUE, and empty contexts will - * be created. - * - arguments: A list of UI configured arguments that will create contexts. - * As these require external data, they will only be added if $placeholders - * is set to TRUE. - * - contexts: A list of UI configured contexts that have no external source, - * and are essentially hardcoded. For example, these might configure a - * particular node or a particular taxonomy term. - * - relationships: A list of UI configured contexts to be derived from other - * contexts that already exist from other sources. For example, these might - * be used to get a user object from a node via the node author - * relationship. - * @param bool $placeholders - * If True, this will generate placeholder objects for any types this function - * cannot load. - * @param array $contexts - * An array of pre-existing contexts that will be part of the return value. - * - * @return array - * Merged output of all results of ctools_context_get_context_from_contexts(). - */ -function ctools_context_load_contexts($object, $placeholders = TRUE, $contexts = array()) { - if (!empty($object->base_contexts)) { - $contexts += $object->base_contexts; - } - - if ($placeholders) { - // This will load empty contexts as placeholders for arguments that come - // from external sources. If this isn't set, it's assumed these context - // will already have been matched up and loaded. - if (!empty($object->requiredcontexts) && is_array($object->requiredcontexts)) { - $contexts += ctools_context_get_context_from_contexts($object->requiredcontexts, 'requiredcontext', $placeholders); - } - - if (!empty($object->arguments) && is_array($object->arguments)) { - $contexts += ctools_context_get_placeholders_from_argument($object->arguments); - } - } - - if (!empty($object->contexts) && is_array($object->contexts)) { - $contexts += ctools_context_get_context_from_contexts($object->contexts, 'context', $placeholders); - } - - // Add contexts from relationships. - if (!empty($object->relationships) && is_array($object->relationships)) { - ctools_context_get_context_from_relationships($object->relationships, $contexts, $placeholders); - } - - return $contexts; -} - -/** - * Return the first context with a form id from a list of contexts. - * - * This function is used to figure out which contexts represents 'the form' - * from a list of contexts. Only one contexts can actually be 'the form' for - * a given page, since the @code - * {
} - * @endcode tag can not be embedded within - * itself. - */ -function ctools_context_get_form($contexts) { - if (!empty($contexts)) { - foreach ($contexts as $id => $context) { - // If a form shows its id as being a 'required context' that means the - // the context is external to this display and does not count. - if (!empty($context->form_id) && substr($id, 0, 15) != 'requiredcontext') { - return $context; - } - } - } -} - -/** - * Replace placeholders with real contexts using data extracted from a form - * for the purposes of previews. - * - * @param $contexts - * All of the contexts, including the placeholders. - * @param $arguments - * The arguments. These will be acquired from $form_state['values'] and the - * keys must match the context IDs. - * - * @return array - * A new $contexts array containing the replaced contexts. Not all contexts - * may be replaced if, for example, an argument was unable to be converted - * into a context. - */ -function ctools_context_replace_placeholders($contexts, $arguments) { - foreach ($contexts as $cid => $context) { - if (empty($context->empty)) { - continue; - } - - $new_context = NULL; - switch ($context->placeholder['type']) { - case 'relationship': - $relationship = $context->placeholder['conf']; - if (isset($contexts[$relationship['context']])) { - $new_context = ctools_context_get_context_from_relationship($relationship, $contexts[$relationship['context']]); - } - break; - - case 'argument': - if (isset($arguments[$cid]) && $arguments[$cid] !== '') { - $argument = $context->placeholder['conf']; - $new_context = ctools_context_get_context_from_argument($argument, $arguments[$cid]); - } - break; - - case 'context': - if (!empty($arguments[$cid])) { - $context_info = $context->placeholder['conf']; - $new_context = ctools_context_get_context_from_context($context_info, 'requiredcontext', $arguments[$cid]); - } - break; - } - - if ($new_context && empty($new_context->empty)) { - $contexts[$cid] = $new_context; - } - } - - return $contexts; -} - -/** - * Provide a form array for getting data to replace placeholder contexts - * with real data. - */ -function ctools_context_replace_form(&$form, $contexts) { - foreach ($contexts as $cid => $context) { - if (empty($context->empty)) { - continue; - } - - // Get plugin info from the context which should have been set when the - // empty context was created. - $info = NULL; - $plugin = NULL; - $settings = NULL; - switch ($context->placeholder['type']) { - case 'argument': - $info = $context->placeholder['conf']; - $plugin = ctools_get_argument($info['name']); - break; - - case 'context': - $info = $context->placeholder['conf']; - $plugin = ctools_get_context($info['name']); - break; - } - - // Ask the plugin where the form is. - if ($plugin && isset($plugin['placeholder form'])) { - if (is_array($plugin['placeholder form'])) { - $form[$cid] = $plugin['placeholder form']; - } - else { - if (function_exists($plugin['placeholder form'])) { - $widget = $plugin['placeholder form']($info); - if ($widget) { - $form[$cid] = $widget; - } - } - } - - if (!empty($form[$cid])) { - $form[$cid]['#title'] = t('@identifier (@keyword)', array( - '@keyword' => '%' . $context->keyword, - '@identifier' => $context->identifier, - )); - } - } - } -} - -// --------------------------------------------------------------------------- -// Functions related to loading access control plugins. -/** - * Fetch metadata on a specific access control plugin. - * - * @param $name - * Name of a plugin. - * - * @return array - * An array with information about the requested access control plugin. - */ - -function ctools_get_access_plugin($name) { - ctools_include('plugins'); - return ctools_get_plugins('ctools', 'access', $name); -} - -/** - * Fetch metadata for all access control plugins. - * - * @return array - * An array of arrays with information about all available access control plugins. - */ -function ctools_get_access_plugins() { - ctools_include('plugins'); - return ctools_get_plugins('ctools', 'access'); -} - -/** - * Fetch a list of access plugins that are available for a given list of - * contexts. - * - * If 'logged-in-user' is not in the list of contexts, it will be added as - * this is required. - * - * @param array $contexts - * Array of ctools_context objects with which to select access plugins. - * - * @return array - * Array of applicable access plugins. Can be empty. - */ -function ctools_get_relevant_access_plugins($contexts) { - if (!isset($contexts['logged-in-user'])) { - $contexts['logged-in-user'] = ctools_access_get_loggedin_context(); - } - - $all_plugins = ctools_get_access_plugins(); - $plugins = array(); - foreach ($all_plugins as $id => $plugin) { - if (!empty($plugin['required context']) - && !ctools_context_match_requirements($contexts, $plugin['required context']) - ) { - continue; - } - $plugins[$id] = $plugin; - } - - return $plugins; -} - -/** - * Create a context for the logged in user. - */ -function ctools_access_get_loggedin_context() { - $context = ctools_context_create('entity:user', array('type' => 'current'), TRUE); - $context->identifier = t('Logged in user'); - $context->keyword = 'viewer'; - $context->id = 0; - - return $context; -} - -/** - * Get a summary of an access plugin's settings. - * - * @return string - * The summary text. - */ -function ctools_access_summary($plugin, $contexts, $test) { - if (!isset($contexts['logged-in-user'])) { - $contexts['logged-in-user'] = ctools_access_get_loggedin_context(); - } - - $description = ''; - if ($function = ctools_plugin_get_function($plugin, 'summary')) { - $required_context = isset($plugin['required context']) ? $plugin['required context'] : array(); - $context = isset($test['context']) ? $test['context'] : array(); - $selected_context = ctools_context_select($contexts, $required_context, $context); - $description = $function($test['settings'], $selected_context, $plugin); - } - - if (!empty($test['not'])) { - $description = "NOT ($description)"; - } - - return $description; -} - -/** - * Get a summary of a group of access plugin's settings. - * - * @param $access - * An array of settings theoretically set by the user, including the array - * of plugins to check: - * - 'plugins': the array of plugin metadata info to check - * - 'logic': (optional) either 'and' or 'or', indicating how to combine - * restrictions. Defaults to 'or'. - * @param array $contexts - * An array of zero or more contexts that may be used to determine if - * the user has access. - * - * @return string - * The summary text. Can be NULL if there are no plugins defined. - */ -function ctools_access_group_summary($access, $contexts) { - if (empty($access['plugins']) || !is_array($access['plugins'])) { - return NULL; - } - - $descriptions = array(); - foreach ($access['plugins'] as $id => $test) { - $plugin = ctools_get_access_plugin($test['name']); - $descriptions[] = ctools_access_summary($plugin, $contexts, $test); - } - - $separator = - (isset($access['logic']) && $access['logic'] === 'and') - ? t(', and ') : t(', or '); - return implode($separator, $descriptions); -} - -/** - * Determine if the current user has access via a plugin. - * - * @param array $settings - * An array of settings theoretically set by the user, including the array - * of plugins to check: - * - 'plugins': the array of plugin metadata info to check - * - 'logic': (optional) either 'and' or 'or', indicating how to combine - * restrictions. The 'or' case is not fully implemented and returns the - * input contexts unchanged. - * - * @param array $contexts - * An array of zero or more contexts that may be used to determine if - * the user has access. - * - * @return bool - * TRUE if access is granted, FALSE if otherwise. - */ -function ctools_access($settings, $contexts = array()) { - if (empty($settings['plugins'])) { - return TRUE; - } - - if (!isset($settings['logic'])) { - $settings['logic'] = 'and'; - } - - if (!isset($contexts['logged-in-user'])) { - $contexts['logged-in-user'] = ctools_access_get_loggedin_context(); - } - - foreach ($settings['plugins'] as $test) { - $pass = FALSE; - $plugin = ctools_get_access_plugin($test['name']); - if ($plugin && $function = ctools_plugin_get_function($plugin, 'callback')) { - // Do we need just some contexts or all of them? - if (!empty($plugin['all contexts'])) { - $test_contexts = $contexts; - } - else { - $required_context = isset($plugin['required context']) ? $plugin['required context'] : array(); - $context = isset($test['context']) ? $test['context'] : array(); - $test_contexts = ctools_context_select($contexts, $required_context, $context); - } - - $pass = $function($test['settings'], $test_contexts, $plugin); - if (!empty($test['not'])) { - $pass = !$pass; - } - } - - if ($pass && $settings['logic'] == 'or') { - // Pass if 'or' and this rule passed. - return TRUE; - } - elseif (!$pass && $settings['logic'] == 'and') { - // Fail if 'and' and this rule failed. - return FALSE; - } - } - - // Return TRUE if logic was and, meaning all rules passed. - // Return FALSE if logic was or, meaning no rule passed. - return ($settings['logic'] === 'and'); -} - -/** - * Create default settings for a new access plugin. - * - * @param $plugin - * The access plugin being used. - * - * @return array - * A default configured test that should be placed in $access['plugins']; - */ -function ctools_access_new_test($plugin) { - $test = array( - 'name' => $plugin['name'], - 'settings' => array(), - ); - - // Set up required context defaults. - if (isset($plugin['required context'])) { - if (is_object($plugin['required context'])) { - $test['context'] = ''; - } - else { - $test['context'] = array(); - foreach ($plugin['required context'] as $required) { - $test['context'][] = ''; - } - } - } - - $default = NULL; - if (isset($plugin['default'])) { - $default = $plugin['default']; - } - elseif (isset($plugin['defaults'])) { - $default = $plugin['defaults']; - } - - // Setup plugin defaults. - if (isset($default)) { - if (is_array($default)) { - $test['settings'] = $default; - } - elseif (function_exists($default)) { - $test['settings'] = $default(); - } - else { - $test['settings'] = array(); - } - } - - return $test; -} - -/** - * Apply restrictions to contexts based upon the access control configured. - * - * These restrictions allow the UI to not show content that may not be relevant - * to all types of a particular context. - * - * @param array $settings - * Array of keys specifying the settings: - * - 'plugins': the array of plugin metadata info to check. If not set, or - * not an array, the function returns with no action. - * - 'logic': (optional) either 'and' or 'or', indicating how to combine - * restrictions. Defaults to 'and'. - * The 'or' case is not fully implemented and returns with no action if - * there is more than one plugin. - * - * @param array $contexts - * Array of available contexts. - */ -function ctools_access_add_restrictions($settings, $contexts) { - if (empty($settings['plugins']) || !is_array($settings['plugins'])) { - return; - } - - if (!isset($settings['logic'])) { - $settings['logic'] = 'and'; - } - - // We're not going to try to figure out restrictions on the or. - if ($settings['logic'] === 'or' && count($settings['plugins']) > 1) { - return; - } - - foreach ($settings['plugins'] as $test) { - $plugin = ctools_get_access_plugin($test['name']); - // $plugin is 'array()' on error. - if ($plugin - && $function = ctools_plugin_get_function($plugin, 'restrictions') - ) { - $required_context = isset($plugin['required context']) ? $plugin['required context'] : array(); - $context = isset($test['context']) ? $test['context'] : array(); - $contexts = ctools_context_select($contexts, $required_context, $context); - - if ($contexts !== FALSE) { - $function($test['settings'], $contexts); - } - } - } -} diff --git a/html/sites/all/modules/contrib/ctools/includes/context.menu.inc b/html/sites/all/modules/contrib/ctools/includes/context.menu.inc deleted file mode 100644 index 798d167ce..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/context.menu.inc +++ /dev/null @@ -1,40 +0,0 @@ - array('access content'), - 'type' => MENU_CALLBACK, - 'file' => 'includes/context-admin.inc', - 'theme callback' => 'ajax_base_page_theme', - ); - $items['ctools/context/ajax/add'] = array( - 'page callback' => 'ctools_context_ajax_item_add', - ) + $base; - $items['ctools/context/ajax/configure'] = array( - 'page callback' => 'ctools_context_ajax_item_edit', - ) + $base; - $items['ctools/context/ajax/delete'] = array( - 'page callback' => 'ctools_context_ajax_item_delete', - ) + $base; - - // For the access system. - $base['file'] = 'includes/context-access-admin.inc'; - $items['ctools/context/ajax/access/add'] = array( - 'page callback' => 'ctools_access_ajax_add', - ) + $base; - $items['ctools/context/ajax/access/configure'] = array( - 'page callback' => 'ctools_access_ajax_edit', - ) + $base; - $items['ctools/context/ajax/access/delete'] = array( - 'page callback' => 'ctools_access_ajax_delete', - ) + $base; - -} diff --git a/html/sites/all/modules/contrib/ctools/includes/context.plugin-type.inc b/html/sites/all/modules/contrib/ctools/includes/context.plugin-type.inc deleted file mode 100644 index 866def2e0..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/context.plugin-type.inc +++ /dev/null @@ -1,24 +0,0 @@ - TRUE, - ); - $items['arguments'] = array( - 'child plugins' => TRUE, - ); - $items['relationships'] = array( - 'child plugins' => TRUE, - ); - $items['access'] = array( - 'child plugins' => TRUE, - ); -} diff --git a/html/sites/all/modules/contrib/ctools/includes/context.theme.inc b/html/sites/all/modules/contrib/ctools/includes/context.theme.inc deleted file mode 100644 index d0d866f78..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/context.theme.inc +++ /dev/null @@ -1,342 +0,0 @@ - array('object' => NULL), - 'file' => 'includes/context.theme.inc', - ); - $theme['ctools_context_list_no_table'] = array( - 'variables' => array('object' => NULL), - 'file' => 'includes/context.theme.inc', - ); - $theme['ctools_context_item_form'] = array( - 'render element' => 'form', - 'file' => 'includes/context.theme.inc', - ); - $theme['ctools_context_item_row'] = array( - 'variables' => array('type' => NULL, 'form' => NULL, 'position' => NULL, 'count' => NULL, 'with_tr' => TRUE), - 'file' => 'includes/context.theme.inc', - ); - - // For the access plugin. - $theme['ctools_access_admin_add'] = array( - 'render element' => 'form', - 'file' => 'includes/context-access-admin.inc', - ); -} - -/** - * Theme the form item for the context entry. - */ -function theme_ctools_context_item_row($vars) { - $type = $vars['type']; - $form = $vars['form']; - $position = $vars['position']; - $count = $vars['count']; - $with_tr = $vars['with_tr']; - $output = ' ' . render($form['title']) . ''; - if (!empty($form['position'])) { - $output .= ' ' . render($form['position']) . ''; - } - $output .= '' . render($form['settings']); - $output .= render($form['remove']) . ''; - - if ($with_tr) { - $output = '' . $output . ''; - } - return $output; -} - -/** - * Display the context item. - */ -function theme_ctools_context_item_form($vars) { - $form = $vars['form']; - - $output = ''; - $type = $form['#ctools_context_type']; - $module = $form['#ctools_context_module']; - $cache_key = $form['#cache_key']; - - $type_info = ctools_context_info($type); - - if (!empty($form[$type]) && empty($form['#only_buttons'])) { - $count = 0; - $rows = ''; - foreach (array_keys($form[$type]) as $id) { - if (!is_numeric($id)) { - continue; - } - $theme_vars = array(); - $theme_vars['type'] = $type; - $theme_vars['form'] = $form[$type][$id]; - $theme_vars['position'] = $id; - $theme_vars['count'] = $count++; - $rows .= theme('ctools_context_item_row', $theme_vars); - } - - $output .= ''; - $output .= ''; - $output .= ''; - $output .= ''; - if (!empty($type_info['sortable']) && $count) { - $output .= ''; - } - $output .= ''; - $output .= ''; - $output .= ''; - $output .= ''; - - $output .= $rows; - - $output .= ''; - $output .= '
' . $type_info['title'] . '' . t('Weight') . '' . t('Operation') . '
'; - } - - if (!empty($form['buttons'])) { - // Display the add context item. - $row = array(); - $row[] = array('data' => render($form['buttons'][$type]['item']), 'class' => array('title')); - $row[] = array('data' => render($form['buttons'][$type]['add']), 'class' => array('add'), 'width' => "60%"); - $output .= '
'; - $output .= render($form['buttons'][$type]); - $theme_vars = array(); - $theme_vars['header'] = array(); - $theme_vars['rows'] = array($row); - $theme_vars['attributes'] = array('id' => $type . '-add-table'); - $output .= theme('table', $theme_vars); - $output .= '
'; - } - if (!empty($form['description'])) { - $output .= render($form['description']); - } - - if (!empty($type_info['sortable'])) { - drupal_add_tabledrag($type . '-table', 'order', 'sibling', 'drag-position'); - } - - return $output; -} - -/** - * Create a visible list of all the contexts available on an object. - * Assumes arguments, relationships and context objects. - * - * Contexts must be preloaded. - */ -function theme_ctools_context_list($vars) { - $object = $vars['object']; - $header = $vars['header']; - $description = (!empty($vars['description'])) ? $vars['description'] : NULL; - $titles = array(); - $output = ''; - $count = 1; - - $contexts = ctools_context_load_contexts($object); - - // Describe 'built in' contexts. - if (!empty($object->base_contexts)) { - foreach ($object->base_contexts as $id => $context) { - $output .= ''; - $output .= '' . t('Built in context') . ''; - $desc = check_plain($context->identifier); - if (isset($context->keyword)) { - $desc .= '
' . t('Keyword: %@keyword', array('@keyword' => $context->keyword)); - foreach (ctools_context_get_converters('%' . $context->keyword . ':', $context) as $keyword => $title) { - $desc .= '
' . t('@keyword --> @title', array('@keyword' => $keyword, '@title' => $title)); - } - $desc .= '
'; - - } - if (isset($context->description)) { - $desc .= '
' . filter_xss_admin($context->description) . '
'; - } - $output .= '' . $desc . ''; - $output .= ''; - $titles[$id] = $context->identifier; - } - } - - // First, make a list of arguments. Arguments are pretty simple. - if (!empty($object->arguments)) { - foreach ($object->arguments as $argument) { - $output .= ''; - $output .= '' . t('Argument @count', array('@count' => $count)) . ''; - $desc = check_plain($argument['identifier']); - if (isset($argument['keyword'])) { - $desc .= '
' . t('Keyword: %@keyword', array('@keyword' => $argument['keyword'])); - if (isset($contexts[ctools_context_id($argument, 'argument')])) { - foreach (ctools_context_get_converters('%' . $argument['keyword'] . ':', $contexts[ctools_context_id($argument, 'argument')]) as $keyword => $title) { - $desc .= '
' . t('@keyword --> @title', array('@keyword' => $keyword, '@title' => $title)); - } - } - $desc .= '
'; - } - $output .= '' . $desc . ''; - $output .= ''; - $titles[ctools_context_id($argument, 'argument')] = $argument['identifier']; - $count++; - } - } - - $count = 1; - // Then, make a nice list of contexts. - if (!empty($object->contexts)) { - foreach ($object->contexts as $context) { - $output .= ''; - $output .= '' . t('Context @count', array('@count' => $count)) . ''; - $desc = check_plain($context['identifier']); - if (isset($context['keyword'])) { - $desc .= '
' . t('Keyword: %@keyword', array('@keyword' => $context['keyword'])); - foreach (ctools_context_get_converters('%' . $context['keyword'] . ':', $contexts[ctools_context_id($context, 'context')]) as $keyword => $title) { - $desc .= '
' . t('@keyword --> @title', array('@keyword' => $keyword, '@title' => $title)); - } - $desc .= '
'; - } - $output .= '' . $desc . ''; - $output .= ''; - $titles[ctools_context_id($context)] = $context['identifier']; - $count++; - } - } - - // And relationships. - if (!empty($object->relationships)) { - foreach ($object->relationships as $relationship) { - $output .= ''; - if (is_array($relationship['context'])) { - $rtitles = array(); - foreach ($relationship['context'] as $cid) { - $rtitles[$cid] = $titles[$cid]; - } - $title = implode(' + ', $rtitles); - } - else { - $title = $titles[$relationship['context']]; - } - $output .= '' . t('From "@title"', array('@title' => $title)) . ''; - $desc = check_plain($relationship['identifier']); - if (isset($relationship['keyword'])) { - $desc .= '
' . t('Keyword: %@keyword', array('@keyword' => $relationship['keyword'])); - foreach (ctools_context_get_converters('%' . $relationship['keyword'] . ':', $contexts[ctools_context_id($relationship, 'relationship')]) as $keyword => $title) { - $desc .= '
' . t('@keyword --> @title', array('@keyword' => $keyword, '@title' => $title)); - } - $desc .= '
'; - } - $output .= '' . $desc . ''; - $output .= ''; - $titles[ctools_context_id($relationship, 'relationship')] = $relationship['identifier']; - $count++; - } - } - - $head = ''; - if ($header) { - if ($description) { - $header .= '
' . $description . '
'; - } - $head .= ''; - $head .= '' . $header . ''; - $head .= ''; - } - - return $output ? "$head$output
\n" : "$head
\n"; -} - -/** - * The ctools_context_list() function but not in a table format because - * tabledrag won't let us have tables within tables and still drag. - */ -function theme_ctools_context_list_no_table($vars) { - $object = $vars['object']; - ctools_add_css('context'); - $titles = array(); - $output = ''; - $count = 1; - // Describe 'built in' contexts. - if (!empty($object->base_contexts)) { - foreach ($object->base_contexts as $id => $context) { - $output .= '
'; - $output .= '
' . t('Built in context') . '
'; - $desc = check_plain($context->identifier); - if (isset($context->keyword)) { - $desc .= '
' . t('Keyword: %@keyword', array('@keyword' => $context->keyword)) . '
'; - } - if (isset($context->description)) { - $desc .= '
' . filter_xss_admin($context->description) . '
'; - } - $output .= '
' . $desc . '
'; - $output .= '
'; - $titles[$id] = $context->identifier; - $count++; - } - } - - // First, make a list of arguments. Arguments are pretty simple. - if (!empty($object->arguments)) { - foreach ($object->arguments as $argument) { - $output .= '
'; - $output .= '
' . t('Argument @count', array('@count' => $count)) . '
'; - $desc = check_plain($argument['identifier']); - if (isset($argument['keyword'])) { - $desc .= '
' . t('Keyword: %@keyword', array('@keyword' => $argument['keyword'])) . '
'; - } - $output .= '
' . $desc . '
'; - $output .= '
'; - $titles[ctools_context_id($argument, 'argument')] = $argument['identifier']; - $count++; - } - } - $count = 1; - // Then, make a nice list of contexts. - if (!empty($object->contexts)) { - foreach ($object->contexts as $context) { - $output .= '
'; - $output .= '
' . t('Context @count', array('@count' => $count)) . '
'; - $desc = check_plain($context['identifier']); - if (isset($context['keyword'])) { - $desc .= '
' . t('Keyword: %@keyword', array('@keyword' => $context['keyword'])) . '
'; - } - $output .= '
' . $desc . '
'; - $output .= '
'; - $titles[ctools_context_id($context)] = $context['identifier']; - $count++; - } - } - // And relationships. - if (!empty($object->relationships)) { - foreach ($object->relationships as $relationship) { - $output .= '
'; - if (is_array($relationship['context'])) { - $rtitles = array(); - foreach ($relationship['context'] as $cid) { - $rtitles[$cid] = $titles[$cid]; - } - $title = implode(' + ', $rtitles); - } - else { - $title = $titles[$relationship['context']]; - } - - $output .= '
' . t('From "@title"', array('@title' => $title)) . '
'; - $desc = check_plain($relationship['identifier']); - if (isset($relationship['keyword'])) { - $desc .= '
' . t('Keyword: %@keyword', array('@keyword' => $relationship['keyword'])) . '
'; - } - $output .= '
' . $desc . '
'; - $output .= '
'; - $titles[ctools_context_id($relationship, 'relationship')] = $relationship['identifier']; - $count++; - } - } - - return $output; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/css-cache.inc b/html/sites/all/modules/contrib/ctools/includes/css-cache.inc deleted file mode 100644 index d88160b5b..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/css-cache.inc +++ /dev/null @@ -1,52 +0,0 @@ - $id))->fetchField(); - if ($filename && file_exists($filename)) { - file_unmanaged_delete($filename); - } - // Remove any previous records. - db_delete('ctools_css_cache') - ->condition('cid', $id) - ->execute(); - - $filename = ctools_css_cache($css, $filter); - - db_merge('ctools_css_cache') - ->key(array('cid' => $id)) - ->fields(array( - 'filename' => $filename, - 'css' => $css, - 'filter' => intval($filter), - )) - ->execute(); - - return $filename; -} - -/** - * Retrieve a filename associated with an id of previously cached CSS. - * - * This will ensure the file still exists and, if not, create it. - */ -function ctools_css_retrieve($id) { - $cache = db_query('SELECT * FROM {ctools_css_cache} WHERE cid = :cid', array(':cid' => $id))->fetchObject(); - if (!$cache) { - return; - } - - if (!file_exists($cache->filename)) { - $filename = ctools_css_cache($cache->css, $cache->filter); - if ($filename != $cache->filename) { - db_update('ctools_css_cache') - ->fields(array('filename' => $filename)) - ->condition('cid', $id) - ->execute(); - $cache->filename = $filename; - } - } - - return $cache->filename; -} - -/** - * Remove stored CSS and any associated file. - */ -function ctools_css_clear($id) { - $cache = db_query('SELECT * FROM {ctools_css_cache} WHERE cid = :cid', array(':cid' => $id))->fetchObject(); - if (!$cache) { - return; - } - - if (file_exists($cache->filename)) { - file_unmanaged_delete($cache->filename); - // If we remove an existing file, there may be cached pages that refer - // to it. We must get rid of them: FIXME same format in D7? - cache_clear_all(); - } - - db_delete('ctools_css_cache') - ->condition('cid', $id) - ->execute(); -} - -/** - * Write a chunk of CSS to a temporary cache file and return the file name. - * - * This function optionally filters the CSS (always compressed, if so) and - * generates a unique filename based upon md5. It returns that filename that - * can be used with drupal_add_css(). Note that as a cache file, technically - * this file is volatile so it should be checked before it is used to ensure - * that it exists. - * - * You can use file_exists() to test for the file and file_delete() to remove - * it if it needs to be cleared. - * - * @param $css - * A chunk of well-formed CSS text to cache. - * @param bool $filter - * If TRUE the css will be filtered. If FALSE the text will be cached - * as-is. - * - * @return string - * The filename the CSS will be cached in. - */ -function ctools_css_cache($css, $filter = TRUE) { - if ($filter) { - $css = ctools_css_filter($css); - } - - // Create the css/ within the files folder. - $path = 'public://ctools/css'; - if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) { - drupal_set_message(t('Unable to create CTools CSS cache directory. Check the permissions on your files directory.'), 'error'); - return; - } - - // @todo Is this slow? Does it matter if it is? - $filename = $path . '/' . md5($css) . '.css'; - - // Generally md5 is considered unique enough to sign file downloads. - // So this replaces already existing files based on the assumption that two - // files with the same hash are identical content wise. - // If we rename, the cache folder can potentially fill up with thousands of - // files with the same content. - $filename = file_unmanaged_save_data($css, $filename, FILE_EXISTS_REPLACE); - - return $filename; -} - -/** - * Filter a chunk of CSS text. - * - * This function disassembles the CSS into a raw format that makes it easier - * for our tool to work, then runs it through the filter and reassembles it. - * If you find that you want the raw data for some reason or another, you - * can use the disassemble/assemble functions yourself. - * - * @param $css - * The CSS text to filter. - * @param $compressed - * If true, generate compressed output; if false, generate pretty output. - * Defaults to TRUE. - */ -function ctools_css_filter($css, $compressed = TRUE) { - $css_data = ctools_css_disassemble($css); - - // Note: By using this function yourself you can control the allowed - // properties and values list. - $filtered = ctools_css_filter_css_data($css_data); - - return $compressed ? ctools_css_compress($filtered) : ctools_css_assemble($filtered); -} - -/** - * Re-assemble a css string and format it nicely. - * - * @param array $css_data - * An array of css data, as produced by @see ctools_css_disassemble() - * disassembler and the @see ctools_css_filter_css_data() filter. - * - * @return string - * css optimized for human viewing. - */ -function ctools_css_assemble($css_data) { - // Initialize the output. - $css = ''; - // Iterate through all the statements. - foreach ($css_data as $selector_str => $declaration) { - // Add the selectors, separating them with commas and line feeds. - $css .= strpos($selector_str, ',') === FALSE ? $selector_str : str_replace(", ", ",\n", $selector_str); - // Add the opening curly brace. - $css .= " {\n"; - // Iterate through all the declarations. - foreach ($declaration as $property => $value) { - $css .= " " . $property . ": " . $value . ";\n"; - } - // Add the closing curly brace. - $css .= "}\n\n"; - } - // Return the output. - return $css; -} - -/** - * Compress css data (filter it first!) to optimize for use on view. - * - * @param array $css_data - * An array of css data, as produced by @see ctools_css_disassemble() - * disassembler and the @see ctools_css_filter_css_data() filter. - * - * @return string - * css optimized for use. - */ -function ctools_css_compress($css_data) { - // Initialize the output. - $css = ''; - // Iterate through all the statements. - foreach ($css_data as $selector_str => $declaration) { - if (empty($declaration)) { - // Skip this statement if filtering removed all parts of the declaration. - continue; - } - // Add the selectors, separating them with commas. - $css .= $selector_str; - // And, the opening curly brace. - $css .= "{"; - // Iterate through all the statement properties. - foreach ($declaration as $property => $value) { - $css .= $property . ':' . $value . ';'; - } - // Add the closing curly brace. - $css .= "}"; - } - // Return the output. - return $css; -} - -/** - * Disassemble the css string. - * - * Strip the css of irrelevant characters, invalid/malformed selectors and - * declarations, and otherwise prepare it for processing. - * - * @param string $css - * A string containing the css to be disassembled. - * - * @return array - * An array of disassembled, slightly cleaned-up/formatted css statements. - */ -function ctools_css_disassemble($css) { - $disassembled_css = array(); - // Remove comments. - $css = preg_replace("/\/\*(.*)?\*\//Usi", "", $css); - // Split out each statement. Match either a right curly brace or a semi-colon - // that precedes a left curly brace with no right curly brace separating them. - $statements = preg_split('/}|;(?=[^}]*{)/', $css); - - // If we have any statements, parse them. - if (!empty($statements)) { - // Iterate through all of the statements. - foreach ($statements as $statement) { - // Get the selector(s) and declaration. - if (empty($statement) || !strpos($statement, '{')) { - continue; - } - - list($selector_str, $declaration) = explode('{', $statement); - - // If the selector exists, then disassemble it, check it, and regenerate - // the selector string. - $selector_str = empty($selector_str) ? FALSE : _ctools_css_disassemble_selector($selector_str); - if (empty($selector_str)) { - // No valid selectors. Bomb out and start the next item. - continue; - } - - // Disassemble the declaration, check it and tuck it into an array. - if (!isset($disassembled_css[$selector_str])) { - $disassembled_css[$selector_str] = array(); - } - $disassembled_css[$selector_str] += _ctools_css_disassemble_declaration($declaration); - } - } - return $disassembled_css; -} - -function _ctools_css_disassemble_selector($selector_str) { - // Get all selectors individually. - $selectors = explode(",", trim($selector_str)); - // Iterate through all the selectors, sanity check them and return if they - // pass. Note that this handles 0, 1, or more valid selectors gracefully. - foreach ($selectors as $key => $selector) { - // Replace un-needed characters and do a little cleanup. - $selector = preg_replace("/[\n|\t|\\|\s]+/", ' ', trim($selector)); - // Make sure this is still a real selector after cleanup. - if (!empty($selector)) { - $selectors[$key] = $selector; - } - else { - // Selector is no good, so we scrap it. - unset($selectors[$key]); - } - } - // Check for malformed selectors; if found, we skip this declaration. - if (empty($selectors)) { - return FALSE; - } - return implode(', ', $selectors); -} - -function _ctools_css_disassemble_declaration($declaration) { - $formatted_statement = array(); - $propval_pairs = explode(";", $declaration); - // Make sure we actually have some properties to work with. - if (!empty($propval_pairs)) { - // Iterate through the remains and parse them. - foreach ($propval_pairs as $key => $propval_pair) { - // Check that we have a ':', otherwise it's an invalid pair. - if (strpos($propval_pair, ':') === FALSE) { - continue; - } - // Clean up the current property-value pair. - $propval_pair = preg_replace("/[\n|\t|\\|\s]+/", ' ', trim($propval_pair)); - // Explode the remaining fragements some more, but clean them up first. - list($property, $value) = explode(':', $propval_pair, 2); - // If the property survived, toss it onto the stack. - if (!empty($property)) { - $formatted_statement[trim($property)] = trim($value); - } - } - } - return $formatted_statement; -} - -/** - * Run disassembled $css through the filter. - * - * @param $css - * CSS code disassembled by ctools_dss_disassemble(). - * @param $allowed_properties - * A list of properties that are allowed by the filter. If empty - * ctools_css_filter_default_allowed_properties() will provide the - * list. - * @param $allowed_values - * A list of values that are allowed by the filter. If empty - * ctools_css_filter_default_allowed_values() will provide the - * list. - * - * @return - * An array of disassembled, filtered CSS. - */ -function ctools_css_filter_css_data($css, $allowed_properties = array(), $allowed_values = array(), $allowed_values_regex = '', $disallowed_values_regex = '') { - // Retrieve the default list of allowed properties if none is provided. - $allowed_properties = !empty($allowed_properties) ? $allowed_properties : ctools_css_filter_default_allowed_properties(); - // Retrieve the default list of allowed values if none is provided. - $allowed_values = !empty($allowed_values) ? $allowed_values : ctools_css_filter_default_allowed_values(); - // Define allowed values regex if none is provided. - $allowed_values_regex = !empty($allowed_values_regex) ? $allowed_values_regex : '/(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)/'; - // Define disallowed url() value contents, if none is provided. - $disallowed_values_regex = !empty($disallowed_values_regex) ? $disallowed_values_regex : '/(url|expression)/'; - - foreach ($css as $selector_str => $declaration) { - foreach ($declaration as $property => $value) { - if (!in_array($property, $allowed_properties)) { - // $filtered['properties'][$selector_str][$property] = $value;. - unset($css[$selector_str][$property]); - continue; - } - $value = str_replace('!important', '', $value); - if (preg_match($disallowed_values_regex, $value) || !(in_array($value, $allowed_values) || preg_match($allowed_values_regex, $value))) { - // $filtered['values'][$selector_str][$property] = $value;. - unset($css[$selector_str][$property]); - continue; - } - } - } - return $css; -} - -/** - * Provide a deafult list of allowed properties by the filter. - */ -function ctools_css_filter_default_allowed_properties() { - return array( - 'azimuth', - 'background', - 'background-color', - 'background-image', - 'background-repeat', - 'background-attachment', - 'background-position', - 'border', - 'border-top-width', - 'border-right-width', - 'border-bottom-width', - 'border-left-width', - 'border-width', - 'border-top-color', - 'border-right-color', - 'border-bottom-color', - 'border-left-color', - 'border-color', - 'border-top-style', - 'border-right-style', - 'border-bottom-style', - 'border-left-style', - 'border-style', - 'border-top', - 'border-right', - 'border-bottom', - 'border-left', - 'clear', - 'color', - 'cursor', - 'direction', - 'display', - 'elevation', - 'float', - 'font', - 'font-family', - 'font-size', - 'font-style', - 'font-variant', - 'font-weight', - 'height', - 'letter-spacing', - 'line-height', - 'margin', - 'margin-top', - 'margin-right', - 'margin-bottom', - 'margin-left', - 'overflow', - 'padding', - 'padding-top', - 'padding-right', - 'padding-bottom', - 'padding-left', - 'pause', - 'pause-after', - 'pause-before', - 'pitch', - 'pitch-range', - 'richness', - 'speak', - 'speak-header', - 'speak-numeral', - 'speak-punctuation', - 'speech-rate', - 'stress', - 'text-align', - 'text-decoration', - 'text-indent', - 'text-transform', - 'unicode-bidi', - 'vertical-align', - 'voice-family', - 'volume', - 'white-space', - 'width', - 'fill', - 'fill-opacity', - 'fill-rule', - 'stroke', - 'stroke-width', - 'stroke-linecap', - 'stroke-linejoin', - 'stroke-opacity', - ); -} - -/** - * Provide a default list of allowed values by the filter. - */ -function ctools_css_filter_default_allowed_values() { - return array( - 'auto', - 'aqua', - 'black', - 'block', - 'blue', - 'bold', - 'both', - 'bottom', - 'brown', - 'capitalize', - 'center', - 'collapse', - 'dashed', - 'dotted', - 'fuchsia', - 'gray', - 'green', - 'italic', - 'inherit', - 'left', - 'lime', - 'lowercase', - 'maroon', - 'medium', - 'navy', - 'normal', - 'nowrap', - 'olive', - 'pointer', - 'purple', - 'red', - 'right', - 'solid', - 'silver', - 'teal', - 'top', - 'transparent', - 'underline', - 'uppercase', - 'white', - 'yellow', - ); -} - -/** - * Delegated implementation of hook_flush_caches() - */ -function ctools_css_flush_caches() { - // Remove all generated files. - // @see http://drupal.org/node/573292 - // file_unmanaged_delete_recursive('public://render'); - $filedir = file_default_scheme() . '://ctools/css'; - if (drupal_realpath($filedir) && file_exists($filedir)) { - // We use the @ because it's possible that files created by the webserver - // cannot be deleted while using drush to clear the cache. We don't really - // care that much about that, to be honest, so we use the @ to suppress - // the error message. - @file_unmanaged_delete_recursive($filedir); - } - - db_delete('ctools_css_cache')->execute(); -} diff --git a/html/sites/all/modules/contrib/ctools/includes/dependent.inc b/html/sites/all/modules/contrib/ctools/includes/dependent.inc deleted file mode 100644 index 51b2f2a40..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/dependent.inc +++ /dev/null @@ -1,184 +0,0 @@ - TRUE to the - * fieldset works around that. - * - * For radios, because they are selected a little bit differently, instead of - * using the CSS id, use: radio:NAME where NAME is the #name of the property. - * This can be quickly found by looking at the HTML of the generated form, but - * it is usually derived from the array which contains the item. For example, - * $form['menu']['type'] would have a name of menu[type]. This name is the same - * field that is used to determine where in $form_state['values'] you will find - * the value of the form. - * - * The item that is dependent on, should be set to #tree = TRUE. - * - * Usage: - * - * First, ensure this tool is loaded: - * @code - * { ctools_include('dependent'); } - * @endcode - * - * On any form item, add - * @code - * '#dependency' => array('id-of-form-without-the-#' => array(list, of, values, that, make, this, gadget, visible)), - * @endcode - * - * A fuller example, that hides the menu title when no menu is selected: - * @code - * function ctools_dependent_example() { - * $form = array(); - * $form['menu'] = array( - * '#type' => 'fieldset', - * '#title' => t('Menu settings'), - * '#tree' => TRUE, - * ); - * $form['menu']['type'] = array( - * '#title' => t('Menu type'), - * '#type' => 'radios', - * '#options' => array( - * 'none' => t('No menu entry'), - * 'normal' => t('Normal menu entry'), - * 'tab' => t('Menu tab'), - * 'default tab' => t('Default menu tab'), - * ), - * '#default_value' => 'none', - * ); - * - * $form['menu']['title'] = array( - * '#title' => t('Title'), - * '#type' => 'textfield', - * '#default_value' => '', - * '#description' => t('If set to normal or tab, enter the text to use for the menu item.'), - * '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), - * ); - * - * return system_settings_form($form); - * } - * @endcode - * - * An example for hiding checkboxes using #prefix and #suffix: - * @code - * function ctools_dependent_example_checkbox() { - * $form = array(); - * $form['object'] = array( - * '#type' => 'fieldset', - * '#title' => t('Select object type'), - * '#tree' => TRUE, - * ); - * $form['object']['type'] = array( - * '#title' => t('Object type'), - * '#type' => 'radios', - * '#options' => array( - * 'view' => t('View'), - * 'node' => t('Node'), - * 'field' => t('Field'), - * 'term' => t('Term'), - * ), - * '#default_value' => 'view', - * ); - * - * $form['object']['elements'] = array( - * '#title' => t('Select the elements to load from the node.'), - * '#type' => 'checkboxes', - * '#prefix' => '
', - * '#suffix' => '
', - * '#dependency' => array('radio:menu[type]' => array('node')), - * '#options' => array( - * 'body' => t('Body'), - * 'fields' => t('Fields'), - * 'taxonomy' => t('Taxonomy'), - * ), - * '#default_value' => array('body', 'fields'), - * ); - * - * return system_settings_form($form); - * } - * @endcode - * - * Deprecated: - * - * You no longer use ctools_dependent_process(), and it should be removed - * completely. - * - * If you have a form element which isn't listed in ctools_dependent_element_info_alter - * you have to add [#pre_render'][] => 'ctools_dependent_pre_render' to your form. - */ - -/** - * Process callback to add dependency to form items. - */ -function ctools_dependent_process($element, &$form_state, &$form) { - return $element; -} - -function ctools_dependent_pre_render($element) { - // Preprocess only items with #dependency set. - if (isset($element['#dependency'])) { - if (!isset($element['#dependency_count'])) { - $element['#dependency_count'] = 1; - } - if (!isset($element['#dependency_type'])) { - $element['#dependency_type'] = 'hide'; - } - - $js = array( - 'values' => $element['#dependency'], - 'num' => $element['#dependency_count'], - 'type' => $element['#dependency_type'], - ); - - // Add a additional wrapper id around fieldsets, textareas to support depedency on it. - if (in_array($element['#type'], array('textarea', 'fieldset', 'text_format'))) { - $element['#theme_wrappers'][] = 'container'; - $element['#attributes']['id'] = $element['#id'] . '-wrapper'; - } - - // Text formats need to unset the dependency on the textarea - // or it gets applied twice. - if ($element['#type'] == 'text_format') { - unset($element['value']['#dependency']); - } - - $element['#attached']['js'][] = ctools_attach_js('dependent'); - $options['CTools']['dependent'][$element['#id']] = $js; - $element['#attached']['js'][] = array('type' => 'setting', 'data' => $options); - - } - - return $element; -} - -/** - * CTools alters the element_info to be able to add #process functions to - * every major form element to make it much more handy to use #dependency, - * because you don't have to add #process. - */ -function ctools_dependent_element_info_alter(&$type) { - $form_elements = array('checkbox', 'checkboxes', 'date', 'fieldset', 'item', 'machine_name', 'markup', 'radio', 'radios', 'select', 'textarea', 'textfield', 'text_format'); - foreach ($form_elements as $element) { - $type[$element]['#pre_render'][] = 'ctools_dependent_pre_render'; - } -} diff --git a/html/sites/all/modules/contrib/ctools/includes/dropbutton.theme.inc b/html/sites/all/modules/contrib/ctools/includes/dropbutton.theme.inc deleted file mode 100644 index 4b95ef0df..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/dropbutton.theme.inc +++ /dev/null @@ -1,143 +0,0 @@ - .5 seconds, or can be immediately closed by - * clicking the twisty again. The code is smart enough that if the mouse - * moves away and then back within the .5 second window, it will not - * re-close. - * - * Multiple dropbuttons can be placed per page. - * - * If only one link is passed to the theme function, the function will render - * a ctools-button with no twisty. The twisty is only rendered when 2 or more - * links are provided. The wrapping element will be classed with both - * ctools-button and ctools-dropbutton when a dropbutton is rendered. - * - * If the user does not have javascript enabled, the link will not appear, - * and instead by default the list of links will appear as a normal inline - * list. - * - * The menu is minimally styled by default, and to make it look different - * will require your own CSS. You can apply your own class to the - * dropbutton to help style it. - * - * The twisty is rendered as a border on a widthless and heightless element. - * There is no image for the twisty. - * The color of the twisty is the color of the link by default. To adjust the - * size of the twisty, adjust the border widths on .ctools-twisty. The adjust - * the color of the twisty, assign a new color to the .ctools-button class or - * assign a color to .ctools-twisty. You shouldn't need to adjust border-color. - * - * Use the theme() function to render dropbutton e.g. - * theme('links__ctools_dropbutton', array()) where array contains a renderable - * array of links. - */ - -/** - * Delegated implementation of hook_theme() - */ -function ctools_dropbutton_theme(&$items) { - $items['links__ctools_dropbutton'] = array( - 'variables' => array('title' => NULL, 'links' => NULL, 'image' => FALSE, 'class' => NULL), - 'file' => 'includes/dropbutton.theme.inc', - ); -} - -/** - * Create a dropbutton menu. - * - * @param $title - * The text to place in the clickable area to activate the dropbutton. This - * text is indented to -9999px by default. - * @param $links - * A list of links to provide within the dropbutton, suitable for use - * in via Drupal's theme('links'). - * @param $image - * If true, the dropbutton link is an image and will not get extra decorations - * that a text dropbutton link will. - * @param $class - * An optional class to add to the dropbutton's container div to allow you - * to style a single dropbutton however you like without interfering with - * other dropbuttons. - */ -function theme_links__ctools_dropbutton($vars) { - // Check to see if the number of links is greater than 1; - // otherwise just treat this like a button. - if (!empty($vars['links'])) { - $is_drop_button = (count($vars['links']) > 1); - - // Add needed files. - if ($is_drop_button) { - ctools_add_js('dropbutton'); - ctools_add_css('dropbutton'); - } - ctools_add_css('button'); - - // Provide a unique identifier for every button on the page. - static $id = 0; - $id++; - - // Wrapping div. - $class = 'ctools-no-js'; - $class .= ($is_drop_button) ? ' ctools-dropbutton' : ''; - $class .= ' ctools-button'; - if (!empty($vars['class'])) { - $class .= ($vars['class']) ? (' ' . implode(' ', $vars['class'])) : ''; - } - - $output = ''; - - $output .= '
'; - - // Add a twisty if this is a dropbutton. - if ($is_drop_button) { - $vars['title'] = ($vars['title'] ? check_plain($vars['title']) : t('open')); - - $output .= ''; - } - - // The button content. - $output .= '
'; - - // Check for attributes. theme_links expects an array(). - $vars['attributes'] = (!empty($vars['attributes'])) ? $vars['attributes'] : array(); - - // Remove the inline and links classes from links if they exist. - // These classes are added and styled by Drupal core and mess up the default - // styling of any link list. - if (!empty($vars['attributes']['class'])) { - $classes = $vars['attributes']['class']; - foreach ($classes as $key => $class) { - if ($class === 'inline' || $class === 'links') { - unset($vars['attributes']['class'][$key]); - } - } - } - - // Call theme_links to render the list of links. - $output .= theme_links(array('links' => $vars['links'], 'attributes' => $vars['attributes'], 'heading' => '')); - $output .= '
'; // ctools-content. - $output .= '
'; // ctools-dropbutton. - return $output; - } - else { - return ''; - } -} diff --git a/html/sites/all/modules/contrib/ctools/includes/dropdown.theme.inc b/html/sites/all/modules/contrib/ctools/includes/dropdown.theme.inc deleted file mode 100644 index b7636874f..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/dropdown.theme.inc +++ /dev/null @@ -1,88 +0,0 @@ - .5 seconds, or can be immediately closed by - * clicking the link again. The code is smart enough that if the mouse - * moves away and then back within the .5 second window, it will not - * re-close. - * - * Multiple dropdowns can be placed per page. - * - * If the user does not have javascript enabled, the link will not appear, - * and instead by default the list of links will appear as a normal inline - * list. - * - * The menu is heavily styled by default, and to make it look different - * will require a little bit of CSS. You can apply your own class to the - * dropdown to help ensure that your CSS can override the dropdown's CSS. - * - * In particular, the text, link, background and border colors may need to - * be changed. Please see dropdown.css for information about the existing - * styling. - */ - -/** - * Delegated implementation of hook_theme() - */ -function ctools_dropdown_theme(&$items) { - $items['ctools_dropdown'] = array( - 'variables' => array('title' => NULL, 'links' => NULL, 'image' => FALSE, 'class' => ''), - 'file' => 'includes/dropdown.theme.inc', - ); -} - -/** - * Create a dropdown menu. - * - * @param array $variables - * An associative array containing: - * - title: The text to place in the clickable area to activate the dropdown. - * - links: A list of links to provide within the dropdown, suitable for use - * in via Drupal's theme('links'). - * - image: If true, the dropdown link is an image and will not get extra - * decorations that a text dropdown link will. - * - class: An optional class to add to the dropdown's container div to allow - * you to style a single dropdown however you like without interfering with - * other dropdowns. - * - * @return string - * Returns HTML for a language configuration form. - */ -function theme_ctools_dropdown($vars) { - // Provide a unique identifier for every dropdown on the page. - static $id = 0; - $id++; - - $class = 'ctools-dropdown-no-js ctools-dropdown' . ($vars['class'] ? (' ' . $vars['class']) : ''); - - ctools_add_js('dropdown'); - ctools_add_css('dropdown'); - - $output = '
'; - $output .= ''; - $output .= '
'; - $output .= '
'; - $output .= theme_links(array('links' => $vars['links'], 'attributes' => array(), 'heading' => '')); - $output .= '
'; - $output .= '
'; - $output .= '
'; - - return $output; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/entity-access.inc b/html/sites/all/modules/contrib/ctools/includes/entity-access.inc deleted file mode 100644 index 8140f51a6..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/entity-access.inc +++ /dev/null @@ -1,155 +0,0 @@ -nid); - if ($node->vid !== $default_revision->vid) { - return _node_revision_access($node, $op, $account); - } - else { - return node_access($op, $node, $account); - } - } - // No node is provided. Check for access to all nodes. - if (user_access('bypass node access', $account)) { - return TRUE; - } - if (!user_access('access content', $account)) { - return FALSE; - } - if ($op == 'view' && node_access_view_all_nodes($account)) { - return TRUE; - } - return FALSE; -} - -/** - * Access callback for the user entity. - */ -function ctools_metadata_user_access($op, $entity, $account , $entity_type) { - $account = isset($account) ? $account : $GLOBALS['user']; - // Grant access to the users own user account and to the anonymous one. - if (isset($entity) && $op != 'delete' && (($entity->uid == $account->uid && $entity->uid) || (!$entity->uid && $op == 'view'))) { - return TRUE; - } - if (user_access('administer users', $account) || user_access('access user profiles', $account) && $op == 'view' && $entity->status) { - return TRUE; - } - return FALSE; -} - -/** - * Access callback for the comment entity. - */ -function ctools_metadata_comment_access($op, $entity = NULL, $account = NULL) { - // When determining access to a comment, if comment has an associated node, - // the user must be able to view the node in order to access the comment. - if (isset($entity->nid)) { - if (!node_access('view', node_load($entity->nid), $account)) { - return FALSE; - } - } - - // Comment administrators are allowed to perform all operations on all - // comments. - if (user_access('administer comments', $account)) { - return TRUE; - } - - // Unpublished comments can never be accessed by non-admins. - if (isset($entity->status) && $entity->status == COMMENT_NOT_PUBLISHED) { - return FALSE; - } - - if (user_access('access comments', $account) && $op == 'view') { - return TRUE; - } - return FALSE; -} - -/** - * Access callback for the taxonomy entities. - */ -function ctools_metadata_taxonomy_access($op, $entity, $account, $entity_type) { - - if ($entity_type == 'taxonomy_vocabulary') { - return user_access('administer taxonomy', $account); - } - if (user_access('administer taxonomy', $account) || user_access('access content', $account) && $op == 'view') { - return TRUE; - } - return FALSE; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/export-ui.inc b/html/sites/all/modules/contrib/ctools/includes/export-ui.inc deleted file mode 100644 index 1158ac8f6..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/export-ui.inc +++ /dev/null @@ -1,475 +0,0 @@ - TRUE, - 'title' => $plugin['name'], - 'export' => array(), - 'allowed operations' => array(), - 'menu' => array(), - 'redirect' => array(), - 'form' => array(), - 'strings' => array(), - 'list' => NULL, - 'access' => 'administer site configuration', - ); - - // Provide CRUD access defaults based on the base 'access' setting: - $plugin += array( - 'create access' => $plugin['access'], - 'delete access' => $plugin['access'], - ); - - if (empty($plugin['has menu'])) { - return; - } - - // The following keys are required and the plugin cannot be processed - // without them. - $keys = array( - 'title singular', - 'title plural', - 'title singular proper', - 'title plural proper', - 'schema', - ); - - foreach ($keys as $key) { - if (empty($plugin[$key])) { - drupal_set_message(t('The plugin definition of @plugin is missing the %key key.', array('%key' => $key, '@plugin' => $plugin['name'])), 'error'); - } - } - - // If we're on the modules page and building a menu, there is a design flaw - // in Drupal core that causes modules to be installed but the schema does - // not become available until AFTER menu rebuild. This helps smooth that - // out. This is a HACK but it should work: - $schema = ctools_export_get_schema($plugin['schema']); - - if (empty($schema)) { - // If we're updating the schema may not have been read yet, so don't report this error in that case. - if (!defined('MAINTENANCE_MODE')) { - drupal_set_message(t('The plugin definition of @plugin cannot locate schema %schema.', array('%schema' => $plugin['schema'], '@plugin' => $plugin['name'])), 'error'); - } - return; - } - - if (empty($schema['export'])) { - drupal_set_message(t('The plugin definition of @plugin uses %schema, but it has no export section.', array('%schema' => $plugin['schema'], '@plugin' => $plugin['name'])), 'error'); - return; - } - $plugin['export'] += $schema['export']; - - $plugin['export'] += array( - // Add the identifier key from the schema so we don't have to call - // ctools_export_get_schema() just for that. - 'key' => $schema['export']['key'], - ); - - // Add some default fields that appear often in exports - // If these use different keys they can easily be specified in the - // $plugin. - if (empty($plugin['export']['admin_title']) && !empty($schema['fields']['admin_title'])) { - $plugin['export']['admin_title'] = 'admin_title'; - } - if (empty($plugin['export']['admin_description']) && !empty($schema['fields']['admin_description'])) { - $plugin['export']['admin_description'] = 'admin_description'; - } - - // Define allowed operations, and the name of the operations. - $plugin['allowed operations'] += array( - 'edit' => array('title' => t('Edit')), - 'enable' => array('title' => t('Enable'), 'ajax' => TRUE, 'token' => TRUE), - 'disable' => array('title' => t('Disable'), 'ajax' => TRUE, 'token' => TRUE), - 'revert' => array('title' => t('Revert')), - 'delete' => array('title' => t('Delete')), - 'clone' => array('title' => t('Clone')), - 'import' => array('title' => t('Import')), - 'export' => array('title' => t('Export')), - ); - - $plugin['menu'] += array( - 'menu item' => str_replace(' ', '-', $plugin['name']), - 'menu prefix' => 'admin/structure', - 'menu title' => $plugin['title'], - 'menu description' => '', - ); - $base_path = ctools_export_ui_plugin_base_path($plugin); - $prefix_count = count(explode('/', $plugin['menu']['menu prefix'])); - - $plugin['menu'] += array( - // Default menu items that should be declared. - 'items' => array(), - ); - - $plugin['menu']['items'] += array( - 'list callback' => array(), - 'list' => array(), - 'add' => array(), - 'edit callback' => array(), - 'edit' => array(), - ); - - $plugin['menu']['items']['list callback'] += array( - 'path' => '', - // Menu items are translated by the menu system. - // TODO: We need more flexibility in title. The title of the admin page - // is not necessarily the title of the object, plus we need - // plural, singular, proper, not proper, etc. - 'title' => $plugin['menu']['menu title'], - 'description' => $plugin['menu']['menu description'], - 'page callback' => 'ctools_export_ui_switcher_page', - 'page arguments' => array($plugin['name'], 'list'), - 'access callback' => 'ctools_export_ui_task_access', - 'access arguments' => array($plugin['name'], 'list'), - 'type' => MENU_NORMAL_ITEM, - ); - - $plugin['menu']['items']['list'] += array( - 'path' => 'list', - 'title' => 'List', - 'page callback' => 'ctools_export_ui_switcher_page', - 'page arguments' => array($plugin['name'], 'list'), - 'access callback' => 'ctools_export_ui_task_access', - 'access arguments' => array($plugin['name'], 'list'), - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, - ); - - $plugin['menu']['items']['add'] += array( - 'path' => 'add', - 'title' => 'Add', - 'page callback' => 'ctools_export_ui_switcher_page', - 'page arguments' => array($plugin['name'], 'add'), - 'access callback' => 'ctools_export_ui_task_access', - 'access arguments' => array($plugin['name'], 'add'), - 'type' => MENU_LOCAL_ACTION, - ); - - $plugin['menu']['items']['edit callback'] += array( - 'path' => 'list/%ctools_export_ui', - 'page callback' => 'ctools_export_ui_switcher_page', - 'page arguments' => array($plugin['name'], 'edit', $prefix_count + 2), - 'load arguments' => array($plugin['name']), - 'access callback' => 'ctools_export_ui_task_access', - 'access arguments' => array($plugin['name'], 'edit', $prefix_count + 2), - 'type' => MENU_CALLBACK, - ); - - $plugin['menu']['items']['edit'] += array( - 'path' => 'list/%ctools_export_ui/edit', - 'title' => 'Edit', - 'page callback' => 'ctools_export_ui_switcher_page', - 'page arguments' => array($plugin['name'], 'edit', $prefix_count + 2), - 'load arguments' => array($plugin['name']), - 'access callback' => 'ctools_export_ui_task_access', - 'access arguments' => array($plugin['name'], 'edit', $prefix_count + 2), - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, - ); - - if ($plugin['allowed operations']['import']) { - $plugin['menu']['items'] += array('import' => array()); - $plugin['menu']['items']['import'] += array( - 'path' => 'import', - 'title' => 'Import', - 'page callback' => 'ctools_export_ui_switcher_page', - 'page arguments' => array($plugin['name'], 'import'), - 'access callback' => 'ctools_export_ui_task_access', - 'access arguments' => array($plugin['name'], 'import'), - 'type' => MENU_LOCAL_ACTION, - ); - } - - if ($plugin['allowed operations']['export']) { - $plugin['menu']['items'] += array('export' => array()); - $plugin['menu']['items']['export'] += array( - 'path' => 'list/%ctools_export_ui/export', - 'title' => 'Export', - 'page callback' => 'ctools_export_ui_switcher_page', - 'page arguments' => array($plugin['name'], 'export', $prefix_count + 2), - 'load arguments' => array($plugin['name']), - 'access callback' => 'ctools_export_ui_task_access', - 'access arguments' => array($plugin['name'], 'export', $prefix_count + 2), - 'type' => MENU_LOCAL_TASK, - ); - } - - if ($plugin['allowed operations']['revert']) { - $plugin['menu']['items'] += array('revert' => array()); - $plugin['menu']['items']['revert'] += array( - 'path' => 'list/%ctools_export_ui/revert', - 'title' => 'Revert', - 'page callback' => 'ctools_export_ui_switcher_page', - // Note: Yes, 'delete' op is correct. - 'page arguments' => array($plugin['name'], 'delete', $prefix_count + 2), - 'load arguments' => array($plugin['name']), - 'access callback' => 'ctools_export_ui_task_access', - 'access arguments' => array($plugin['name'], 'revert', $prefix_count + 2), - 'type' => MENU_CALLBACK, - ); - } - - if ($plugin['allowed operations']['delete']) { - $plugin['menu']['items'] += array('delete' => array()); - $plugin['menu']['items']['delete'] += array( - 'path' => 'list/%ctools_export_ui/delete', - 'title' => 'Delete', - 'page callback' => 'ctools_export_ui_switcher_page', - 'page arguments' => array($plugin['name'], 'delete', $prefix_count + 2), - 'load arguments' => array($plugin['name']), - 'access callback' => 'ctools_export_ui_task_access', - 'access arguments' => array($plugin['name'], 'delete', $prefix_count + 2), - 'type' => MENU_CALLBACK, - ); - } - - if ($plugin['allowed operations']['clone']) { - $plugin['menu']['items'] += array('clone' => array()); - $plugin['menu']['items']['clone'] += array( - 'path' => 'list/%ctools_export_ui/clone', - 'title' => 'Clone', - 'page callback' => 'ctools_export_ui_switcher_page', - 'page arguments' => array($plugin['name'], 'clone', $prefix_count + 2), - 'load arguments' => array($plugin['name']), - 'access callback' => 'ctools_export_ui_task_access', - 'access arguments' => array($plugin['name'], 'clone', $prefix_count + 2), - 'type' => MENU_CALLBACK, - ); - } - - if ($plugin['allowed operations']['enable']) { - $plugin['menu']['items'] += array('enable' => array()); - $plugin['menu']['items']['enable'] += array( - 'path' => 'list/%ctools_export_ui/enable', - 'title' => 'Enable', - 'page callback' => 'ctools_export_ui_switcher_page', - 'page arguments' => array($plugin['name'], 'enable', $prefix_count + 2), - 'load arguments' => array($plugin['name']), - 'access callback' => 'ctools_export_ui_task_access', - 'access arguments' => array($plugin['name'], 'enable', $prefix_count + 2), - 'type' => MENU_CALLBACK, - ); - } - - if ($plugin['allowed operations']['disable']) { - $plugin['menu']['items'] += array('disable' => array()); - $plugin['menu']['items']['disable'] += array( - 'path' => 'list/%ctools_export_ui/disable', - 'title' => 'Disable', - 'page callback' => 'ctools_export_ui_switcher_page', - 'page arguments' => array($plugin['name'], 'disable', $prefix_count + 2), - 'load arguments' => array($plugin['name']), - 'access callback' => 'ctools_export_ui_task_access', - 'access arguments' => array($plugin['name'], 'disable', $prefix_count + 2), - 'type' => MENU_CALLBACK, - ); - } - - // Define some redirects that should happen after edit/add/clone/delete operations. - $plugin['redirect'] += array( - 'add' => $base_path, - 'clone' => $base_path, - 'edit' => $base_path, - 'delete' => $base_path, - 'revert' => $base_path, - 'import' => $base_path, - ); - - // Define form elements. - $plugin['form'] += array( - 'settings' => function_exists($plugin['name'] . '_form') ? $plugin['name'] . '_form' : '', - 'validate' => function_exists($plugin['name'] . '_form_validate') ? $plugin['name'] . '_form_validate' : '', - 'submit' => function_exists($plugin['name'] . '_form_submit') ? $plugin['name'] . '_form_submit' : '', - ); - - // Define strings. - // For all strings, %title may be filled in at a later time via str_replace - // since we do not know the title now. - $plugin['strings'] += array( - 'title' => array(), - 'confirmation' => array(), - 'help' => array(), - 'message' => array(), - ); - - // Strings used in drupal_set_title(). - $plugin['strings']['title'] += array( - 'add' => t('Add a new @plugin', array('@plugin' => $plugin['title singular'])), - // The "%title" will be replaced in ctools_export_ui_form(), as in this - // stage we dont have the specific exportable object. - 'edit' => t('Edit @plugin %title', array('@plugin' => $plugin['title singular'])), - 'clone' => t('Clone @plugin %title', array('@plugin' => $plugin['title singular'])), - - 'import' => t('Import @plugin', array('@plugin' => $plugin['title singular'])), - 'export' => t('Export @plugin %title', array('@plugin' => $plugin['title singular'])), - ); - - // Strings used in confirmation pages. - $plugin['strings']['confirmation'] += array( - 'revert' => array(), - 'delete' => array(), - 'add' => array(), - 'edit' => array(), - ); - - $plugin['strings']['confirmation']['revert'] += array( - 'question' => t('Are you sure you want to revert %title?'), - 'information' => t('This action will permanently remove any customizations made to this item.'), - 'success' => t('The item has been reverted.'), - ); - - $plugin['strings']['confirmation']['delete'] += array( - 'question' => t('Are you sure you want to delete %title?'), - 'information' => t('This action will permanently remove this item from your database.'), - 'success' => t('The item has been deleted.'), - ); - - $plugin['strings']['confirmation']['add'] += array( - 'success' => t('%title has been created.'), - 'fail' => t('%title could not be created.'), - ); - - $plugin['strings']['confirmation']['edit'] += array( - 'success' => t('%title has been updated.'), - 'fail' => t('%title could not be updated.'), - ); - - // Strings used in $forms. - $plugin['strings']['help'] += array( - 'import' => t('You can import an exported definition by pasting the exported object code into the field below.'), - ); - - // Strings used in drupal_set_message(). - $plugin['strings']['message'] += array( - 'enable' => t('@plugin %title was enabled.', array('@plugin' => $plugin['title singular proper'])), - 'disable' => t('@plugin %title was disabled.', array('@plugin' => $plugin['title singular proper'])), - 'no items' => t('There are no @titles to display.', array('@titles' => $plugin['title plural'])), - ); -} - -/** - * Get the class to handle creating a list of exportable items. - * - * If a plugin does not define a lister class at all, then the default - * lister class will be used. - * - * @return - * Either the lister class or FALSE if one could not be had. - */ -function ctools_export_ui_get_handler($plugin) { - $cache = &drupal_static(__FUNCTION__, array()); - if (empty($cache[$plugin['name']])) { - // If a list class is not specified by the plugin, fall back to the - // default ctools_export_ui plugin instead. - if (empty($plugin['handler'])) { - $default = ctools_get_export_ui('ctools_export_ui'); - $class = ctools_plugin_get_class($default, 'handler'); - } - else { - $class = ctools_plugin_get_class($plugin, 'handler'); - } - - if ($class) { - $cache[$plugin['name']] = new $class(); - $cache[$plugin['name']]->init($plugin); - } - } - return !empty($cache[$plugin['name']]) ? $cache[$plugin['name']] : FALSE; -} - -/** - * Get the base path from a plugin. - * - * @param $plugin - * The plugin. - * - * @return - * The menu path to the plugin's list. - */ -function ctools_export_ui_plugin_base_path($plugin) { - return $plugin['menu']['menu prefix'] . '/' . $plugin['menu']['menu item']; -} - -/** - * Get the path to a specific menu item from a plugin. - * - * @param $plugin - * The plugin name. - * @param $item_id - * The id in the menu items from the plugin. - * @param $export_key - * The export key of the item being edited, if it exists. - * - * @return - * The menu path to the plugin's list. - */ -function ctools_export_ui_plugin_menu_path($plugin, $item_id, $export_key = NULL) { - $path = $plugin['menu']['items'][$item_id]['path']; - if ($export_key) { - $path = str_replace('%ctools_export_ui', $export_key, $path); - } - return ctools_export_ui_plugin_base_path($plugin) . '/' . $path; -} - -/** - * Helper function to include CTools plugins and get an export-ui exportable. - * - * @param $plugin_name - * The plugin that should be loaded. - */ -function ctools_get_export_ui($plugin_name) { - ctools_include('plugins'); - return ctools_get_plugins('ctools', 'export_ui', $plugin_name); -} - -/** - * Helper function to include CTools plugins and get all export-ui exportables. - */ -function ctools_get_export_uis() { - ctools_include('plugins'); - return ctools_get_plugins('ctools', 'export_ui'); -} - -/** - * Main page callback to manipulate exportables. - * - * This simply loads the object defined in the plugin and hands it off to - * a method based upon the name of the operation in use. This can easily - * be used to add more ops. - */ -function ctools_export_ui_switcher_page($plugin_name, $op) { - $args = func_get_args(); - $js = !empty($_REQUEST['js']); - - // Load the $plugin information. - $plugin = ctools_get_export_ui($plugin_name); - if (!$plugin) { - return t('Configuration error. No plugin found: %plugin_name.', array('%plugin_name' => $plugin_name)); - } - - $handler = ctools_export_ui_get_handler($plugin); - if (!$handler) { - return t('Configuration error. No handler found.'); - } - - $method = $op . '_page'; - if (method_exists($handler, $method)) { - // Replace the first two arguments: - $args[0] = $js; - $args[1] = $_POST; - return call_user_func_array(array($handler, $method), $args); - } -} diff --git a/html/sites/all/modules/contrib/ctools/includes/export-ui.menu.inc b/html/sites/all/modules/contrib/ctools/includes/export-ui.menu.inc deleted file mode 100644 index 0fda8c256..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/export-ui.menu.inc +++ /dev/null @@ -1,28 +0,0 @@ -hook_menu($items); - } - } - } -} diff --git a/html/sites/all/modules/contrib/ctools/includes/export-ui.plugin-type.inc b/html/sites/all/modules/contrib/ctools/includes/export-ui.plugin-type.inc deleted file mode 100644 index baa79f374..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/export-ui.plugin-type.inc +++ /dev/null @@ -1,20 +0,0 @@ - array( - 'function' => 'ctools_export_ui_process', - 'file' => 'export-ui.inc', - 'path' => drupal_get_path('module', 'ctools') . '/includes', - ), - 'classes' => array('handler'), - ); -} diff --git a/html/sites/all/modules/contrib/ctools/includes/export.inc b/html/sites/all/modules/contrib/ctools/includes/export.inc deleted file mode 100644 index efc356efb..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/export.inc +++ /dev/null @@ -1,1278 +0,0 @@ -export_type & EXPORT_IN_DATABASE) { - // Existing record. - $update = array($key); - } - else { - // New record. - $update = array(); - $object->export_type = EXPORT_IN_DATABASE; - } - return drupal_write_record($table, $object, $update); - } -} - -/** - * Delete a single exportable object. - * - * This only deletes from the database, which means that if an item is in - * code, then this is actually a revert. - * - * @param $table - * The name of the table to use to retrieve $schema values. This table - * must have an 'export' section containing data or this function - * will fail. - * @param $object - * The fully populated object to delete, or the export key. - */ -function ctools_export_crud_delete($table, $object) { - $schema = ctools_export_get_schema($table); - $export = $schema['export']; - - if (!empty($export['delete callback']) && function_exists($export['delete callback'])) { - return $export['delete callback']($object); - } - else { - // If we were sent an object, get the export key from it. Otherwise - // assume we were sent the export key. - $value = is_object($object) ? $object->{$export['key']} : $object; - db_delete($table) - ->condition($export['key'], $value) - ->execute(); - } -} - -/** - * Get the exported code of a single exportable object. - * - * @param $table - * The name of the table to use to retrieve $schema values. This table - * must have an 'export' section containing data or this function - * will fail. - * @param $object - * The fully populated object to delete, or the export key. - * @param $indent - * Any indentation to apply to the code, in case this object is embedded - * into another, for example. - * - * @return - * A string containing the executable export of the object. - */ -function ctools_export_crud_export($table, $object, $indent = '') { - $schema = ctools_export_get_schema($table); - $export = $schema['export']; - - if (!empty($export['export callback']) && function_exists($export['export callback'])) { - return $export['export callback']($object, $indent); - } - else { - return ctools_export_object($table, $object, $indent); - } -} - -/** - * Turn exported code into an object. - * - * Note: If the code is poorly formed, this could crash and there is no - * way to prevent this. - * - * @param $table - * The name of the table to use to retrieve $schema values. This table - * must have an 'export' section containing data or this function - * will fail. - * @param $code - * The code to eval to create the object. - * - * @return - * An object created from the export. This object will NOT have been saved - * to the database. In the case of failure, a string containing all errors - * that the system was able to determine. - */ -function ctools_export_crud_import($table, $code) { - $schema = ctools_export_get_schema($table); - $export = $schema['export']; - - if (!empty($export['import callback']) && function_exists($export['import callback'])) { - return $export['import callback']($code); - } - else { - ob_start(); - eval($code); - ob_end_clean(); - - if (empty(${$export['identifier']})) { - $errors = ob_get_contents(); - if (empty($errors)) { - $errors = t('No item found.'); - } - return $errors; - } - - $item = ${$export['identifier']}; - - // Set these defaults just the same way that ctools_export_new_object sets - // them. - $item->export_type = NULL; - $item->{$export['export type string']} = t('Local'); - - return $item; - } -} - -/** - * Change the status of a certain object. - * - * @param $table - * The name of the table to use to enable a certain object. This table - * must have an 'export' section containing data or this function - * will fail. - * @param $object - * The fully populated object to enable, or the machine readable name. - * @param $status - * The status, in this case, is whether or not it is 'disabled'. - */ -function ctools_export_crud_set_status($table, $object, $status) { - $schema = ctools_export_get_schema($table); - $export = $schema['export']; - - if (!empty($export['status callback']) && function_exists($export['status callback'])) { - $export['status callback']($object, $status); - } - else { - if (is_object($object)) { - ctools_export_set_object_status($object, $status); - } - else { - ctools_export_set_status($table, $object, $status); - } - } - -} - -/** - * Enable a certain object. - * - * @param $table - * The name of the table to use to enable a certain object. This table - * must have an 'export' section containing data or this function - * will fail. - * @param $object - * The fully populated object to enable, or the machine readable name. - */ -function ctools_export_crud_enable($table, $object) { - return ctools_export_crud_set_status($table, $object, FALSE); -} - -/** - * Disable a certain object. - * - * @param $table - * The name of the table to use to disable a certain object. This table - * must have an 'export' section containing data or this function - * will fail. - * @param $object - * The fully populated object to disable, or the machine readable name. - */ -function ctools_export_crud_disable($table, $object) { - return ctools_export_crud_set_status($table, $object, TRUE); -} - -/** - * @} - */ - -/** - * Load some number of exportable objects. - * - * This function will cache the objects, load subsidiary objects if necessary, - * check default objects in code and properly set them up. It will cache - * the results so that multiple calls to load the same objects - * will not cause problems. - * - * It attempts to reduce, as much as possible, the number of queries - * involved. - * - * @param $table - * The name of the table to be loaded from. Data is expected to be in the - * schema to make all this work. - * @param $type - * A string to notify the loader what the argument is - * - all: load all items. This is the default. $args is unused. - * - names: $args will be an array of specific named objects to load. - * - conditions: $args will be a keyed array of conditions. The conditions - * must be in the schema for this table or errors will result. - * @param $args - * An array of arguments whose actual use is defined by the $type argument. - */ -function ctools_export_load_object($table, $type = 'all', $args = array()) { - $cache = &drupal_static(__FUNCTION__); - $cache_table_exists = &drupal_static(__FUNCTION__ . '_table_exists', array()); - $cached_database = &drupal_static('ctools_export_load_object_all'); - - if (!array_key_exists($table, $cache_table_exists)) { - $cache_table_exists[$table] = db_table_exists($table); - } - - $schema = ctools_export_get_schema($table); - if (empty($schema) || !$cache_table_exists[$table]) { - return array(); - } - - $export = $schema['export']; - - if (!isset($cache[$table])) { - $cache[$table] = array(); - } - - // If fetching all and cached all, we've done so and we are finished. - if ($type == 'all' && !empty($cached_database[$table])) { - return $cache[$table]; - } - - $return = array(); - - // Don't load anything we've already cached. - if ($type == 'names' && !empty($args)) { - foreach ($args as $id => $name) { - if (isset($cache[$table][$name])) { - $return[$name] = $cache[$table][$name]; - unset($args[$id]); - } - } - - // If nothing left to load, return the result. - if (empty($args)) { - return $return; - } - } - - // Build the query. - $query = db_select($table, 't__0')->fields('t__0'); - $alias_count = 1; - if (!empty($schema['join'])) { - foreach ($schema['join'] as $join_key => $join) { - if ($join_schema = drupal_get_schema($join['table'])) { - $query->join($join['table'], 't__' . $alias_count, 't__0.' . $join['left_key'] . ' = ' . 't__' . $alias_count . '.' . $join['right_key']); - $query->fields('t__' . $alias_count); - $alias_count++; - - // Allow joining tables to alter the query through a callback. - if (isset($join['callback']) && function_exists($join['callback'])) { - $join['callback']($query, $schema, $join_schema); - } - } - } - } - - $conditions = array(); - $query_args = array(); - - // If they passed in names, add them to the query. - if ($type == 'names') { - $query->condition($export['key'], $args, 'IN'); - } - elseif ($type == 'conditions') { - foreach ($args as $key => $value) { - if (isset($schema['fields'][$key])) { - $query->condition($key, $value); - } - } - } - - $result = $query->execute(); - - $status = variable_get($export['status'], array()); - // Unpack the results of the query onto objects and cache them. - foreach ($result as $data) { - if (isset($schema['export']['object factory']) && function_exists($schema['export']['object factory'])) { - $object = $schema['export']['object factory']($schema, $data); - } - else { - $object = _ctools_export_unpack_object($schema, $data, $export['object']); - } - $object->table = $table; - $object->{$export['export type string']} = t('Normal'); - $object->export_type = EXPORT_IN_DATABASE; - // Determine if default object is enabled or disabled. - if (isset($status[$object->{$export['key']}])) { - $object->disabled = $status[$object->{$export['key']}]; - } - - $cache[$table][$object->{$export['key']}] = $object; - if ($type == 'conditions') { - $return[$object->{$export['key']}] = $object; - } - } - - // Load subrecords. - if (isset($export['subrecords callback']) && function_exists($export['subrecords callback'])) { - $export['subrecords callback']($cache[$table]); - } - - if ($type == 'names' && !empty($args) && !empty($export['cache defaults'])) { - $defaults = _ctools_export_get_some_defaults($table, $export, $args); - } - else { - $defaults = _ctools_export_get_defaults($table, $export); - } - - if ($defaults) { - foreach ($defaults as $object) { - if ($type == 'conditions') { - // If this does not match all of our conditions, skip it. - foreach ($args as $key => $value) { - if (!isset($object->$key)) { - continue 2; - } - if (is_array($value)) { - if (!in_array($object->$key, $value)) { - continue 2; - } - } - elseif ($object->$key != $value) { - continue 2; - } - } - } - elseif ($type == 'names') { - if (!in_array($object->{$export['key']}, $args)) { - continue; - } - } - - // Determine if default object is enabled or disabled. - if (isset($status[$object->{$export['key']}])) { - $object->disabled = $status[$object->{$export['key']}]; - } - - if (!empty($cache[$table][$object->{$export['key']}])) { - $cache[$table][$object->{$export['key']}]->{$export['export type string']} = t('Overridden'); - $cache[$table][$object->{$export['key']}]->export_type |= EXPORT_IN_CODE; - $cache[$table][$object->{$export['key']}]->export_module = isset($object->export_module) ? $object->export_module : NULL; - if ($type == 'conditions') { - $return[$object->{$export['key']}] = $cache[$table][$object->{$export['key']}]; - } - } - else { - $object->{$export['export type string']} = t('Default'); - $object->export_type = EXPORT_IN_CODE; - $object->in_code_only = TRUE; - $object->table = $table; - - $cache[$table][$object->{$export['key']}] = $object; - if ($type == 'conditions') { - $return[$object->{$export['key']}] = $object; - } - } - } - } - - // If fetching all, we've done so and we are finished. - if ($type == 'all') { - $cached_database[$table] = TRUE; - return $cache[$table]; - } - - if ($type == 'names') { - foreach ($args as $name) { - if (isset($cache[$table][$name])) { - $return[$name] = $cache[$table][$name]; - } - } - } - - return $return; -} - -/** - * Reset all static caches in ctools_export_load_object() or static caches for - * a given table in ctools_export_load_object(). - * - * @param $table - * String that is the name of a table. If not defined, all static caches in - * ctools_export_load_object() will be reset. - */ -function ctools_export_load_object_reset($table = NULL) { - // Reset plugin cache to make sure new include files are picked up. - ctools_include('plugins'); - ctools_get_plugins_reset(); - if (empty($table)) { - drupal_static_reset('ctools_export_load_object'); - drupal_static_reset('ctools_export_load_object_all'); - drupal_static_reset('_ctools_export_get_defaults'); - } - else { - $cache = &drupal_static('ctools_export_load_object'); - $cached_database = &drupal_static('ctools_export_load_object_all'); - $cached_defaults = &drupal_static('_ctools_export_get_defaults'); - unset($cache[$table]); - unset($cached_database[$table]); - unset($cached_defaults[$table]); - } -} - -/** - * Get the default version of an object, if it exists. - * - * This function doesn't care if an object is in the database or not and - * does not check. This means that export_type could appear to be incorrect, - * because a version could exist in the database. However, it's not - * incorrect for this function as it is *only* used for the default - * in code version. - */ -function ctools_get_default_object($table, $name) { - $schema = ctools_export_get_schema($table); - $export = $schema['export']; - - if (!$export['default hook']) { - return; - } - - // Try to load individually from cache if this cache is enabled. - if (!empty($export['cache defaults'])) { - $defaults = _ctools_export_get_some_defaults($table, $export, array($name)); - } - else { - $defaults = _ctools_export_get_defaults($table, $export); - } - - $status = variable_get($export['status'], array()); - - if (!isset($defaults[$name])) { - return; - } - - $object = $defaults[$name]; - - // Determine if default object is enabled or disabled. - if (isset($status[$object->{$export['key']}])) { - $object->disabled = $status[$object->{$export['key']}]; - } - - $object->{$export['export type string']} = t('Default'); - $object->export_type = EXPORT_IN_CODE; - $object->in_code_only = TRUE; - - return $object; -} - -/** - * Get export object defaults. - * - * Call the hook to get all default objects of the given type from the - * export. If configured properly, this could include loading up an API - * to get default objects. - * - * @param string $table - * The name of the table to be loaded. Data is expected to be in the - * schema to make all this work. - * @param array $export - * The export definition from the table's hook_schema() definition. - */ -function _ctools_export_get_defaults($table, array $export) { - $cache = &drupal_static(__FUNCTION__, array()); - - // If defaults may be cached, first see if we can load from cache. - if (!isset($cache[$table]) && !empty($export['cache defaults'])) { - $cache[$table] = _ctools_export_get_defaults_from_cache($table, $export); - } - - if (!isset($cache[$table])) { - // If we're caching, attempt to get a lock. We will wait a short time - // on the lock, but not too long, because it's better to just rebuild - // and throw away results than wait too long on a lock. - if (!empty($export['cache defaults'])) { - for ($counter = 0; !($lock = lock_acquire('ctools_export:' . $table)) && $counter > 5; $counter++) { - lock_wait('ctools_export:' . $table, 1); - ++$counter; - } - } - - $cache[$table] = array(); - - if ($export['default hook']) { - if (!empty($export['api'])) { - ctools_include('plugins'); - $info = ctools_plugin_api_include($export['api']['owner'], $export['api']['api'], - $export['api']['minimum_version'], $export['api']['current_version']); - $modules = array_keys($info); - } - else { - $modules = module_implements($export['default hook']); - } - - foreach ($modules as $module) { - $function = $module . '_' . $export['default hook']; - if (function_exists($function)) { - foreach ((array) $function($export) as $name => $object) { - // Record the module that provides this exportable. - $object->export_module = $module; - - if (empty($export['api'])) { - $cache[$table][$name] = $object; - } - else { - // If version checking is enabled, ensure that the object can be - // used. - if (isset($object->api_version) && - version_compare($object->api_version, $export['api']['minimum_version']) >= 0 && - version_compare($object->api_version, $export['api']['current_version']) <= 0) { - $cache[$table][$name] = $object; - } - } - } - } - } - - drupal_alter($export['default hook'], $cache[$table]); - - // If we acquired a lock earlier, cache the results and release the - // lock. - if (!empty($lock)) { - // Cache the index. - $index = array_keys($cache[$table]); - cache_set('ctools_export_index:' . $table, $index, $export['default cache bin']); - - // Cache each object. - foreach ($cache[$table] as $name => $object) { - cache_set('ctools_export:' . $table . ':' . $name, $object, $export['default cache bin']); - } - lock_release('ctools_export:' . $table); - } - } - } - - return $cache[$table]; -} - -/** - * Attempt to load default objects from cache. - * - * We can be instructed to cache default objects by the schema. If so - * we cache them as an index which is a list of all default objects, and - * then each default object is cached individually. - * - * @return Either an array of cached objects, or NULL indicating a cache - * rebuild is necessary. - */ -function _ctools_export_get_defaults_from_cache($table, $export) { - $data = cache_get('ctools_export_index:' . $table, $export['default cache bin']); - if (!$data || !is_array($data->data)) { - return; - } - - // This is the perfectly valid case where there are no default objects, - // and we have cached this state. - if (empty($data->data)) { - return array(); - } - - $keys = array(); - foreach ($data->data as $name) { - $keys[] = 'ctools_export:' . $table . ':' . $name; - } - - $data = cache_get_multiple($keys, $export['default cache bin']); - - // If any of our indexed keys missed, then we have a fail and we need to - // rebuild. - if (!empty($keys)) { - return; - } - - // Now, translate the returned cache objects to actual objects. - $cache = array(); - foreach ($data as $cached_object) { - $cache[$cached_object->data->{$export['key']}] = $cached_object->data; - } - - return $cache; -} - -/** - * Get a limited number of default objects. - * - * This attempts to load the objects directly from cache. If it cannot, - * the cache is rebuilt. This does not disturb the general get defaults - * from cache object. - * - * This function should ONLY be called if default caching is enabled. - * It does not check, it is assumed the caller has already done so. - */ -function _ctools_export_get_some_defaults($table, $export, $names) { - foreach ($names as $name) { - $keys[] = 'ctools_export:' . $table . ':' . $name; - } - - $data = cache_get_multiple($keys, $export['default cache bin']); - - // Cache hits remove the $key from $keys by reference. Cache - // misses do not. A cache miss indicates we may have to rebuild. - if (!empty($keys)) { - return _ctools_export_get_defaults($table, $export); - } - - // Now, translate the returned cache objects to actual objects. - $cache = array(); - foreach ($data as $cached_object) { - $cache[$cached_object->data->{$export['key']}] = $cached_object->data; - } - - return $cache; -} - -/** - * Unpack data loaded from the database onto an object. - * - * @param $schema - * The schema from drupal_get_schema(). - * @param $data - * The data as loaded from the database. - * @param $object - * If an object, data will be unpacked onto it. If a string - * an object of that type will be created. - */ -function _ctools_export_unpack_object($schema, $data, $object = 'stdClass') { - if (is_string($object)) { - if (class_exists($object)) { - $object = new $object(); - } - else { - $object = new stdClass(); - } - } - - // Go through our schema and build correlations. - foreach ($schema['fields'] as $field => $info) { - if (isset($data->$field)) { - $object->$field = empty($info['serialize']) ? $data->$field : unserialize($data->$field); - } - else { - $object->$field = NULL; - } - } - - if (isset($schema['join'])) { - foreach ($schema['join'] as $join_key => $join) { - $join_schema = ctools_export_get_schema($join['table']); - if (!empty($join['load'])) { - foreach ($join['load'] as $field) { - $info = $join_schema['fields'][$field]; - $object->$field = empty($info['serialize']) ? $data->$field : unserialize($data->$field); - } - } - } - } - - return $object; -} - -/** - * Unpack data loaded from the database onto an object. - * - * @param $table - * The name of the table this object represents. - * @param $data - * The data as loaded from the database. - */ -function ctools_export_unpack_object($table, $data) { - $schema = ctools_export_get_schema($table); - return _ctools_export_unpack_object($schema, $data, $schema['export']['object']); -} - -/** - * Export a field. - * - * This is a replacement for var_export(), allowing us to more nicely - * format exports. It will recurse down into arrays and will try to - * properly export bools when it can, though PHP has a hard time with - * this since they often end up as strings or ints. - */ -function ctools_var_export($var, $prefix = '') { - if (is_array($var)) { - if (empty($var)) { - $output = 'array()'; - } - else { - $output = "array(\n"; - ksort($var); - foreach ($var as $key => $value) { - $output .= $prefix . " " . ctools_var_export($key) . " => " . ctools_var_export($value, $prefix . ' ') . ",\n"; - } - $output .= $prefix . ')'; - } - } - elseif (is_object($var) && get_class($var) === 'stdClass') { - // var_export() will export stdClass objects using an undefined - // magic method __set_state() leaving the export broken. This - // workaround avoids this by casting the object as an array for - // export and casting it back to an object when evaluated. - $output = '(object) ' . ctools_var_export((array) $var, $prefix); - } - elseif (is_bool($var)) { - $output = $var ? 'TRUE' : 'FALSE'; - } - else { - $output = var_export($var, TRUE); - } - - return $output; -} - -/** - * Export an object into code. - */ -function ctools_export_object($table, $object, $indent = '', $identifier = NULL, $additions = array(), $additions2 = array()) { - $schema = ctools_export_get_schema($table); - if (!isset($identifier)) { - $identifier = $schema['export']['identifier']; - } - - $output = $indent . '$' . $identifier . ' = new ' . get_class($object) . "();\n"; - - if ($schema['export']['can disable']) { - $disabled = !isset($object->disabled) || $object->disabled != TRUE ? 'FALSE' : 'TRUE'; - $output .= $indent . '$' . $identifier . '->disabled = ' . $disabled . '; /* Edit this to true to make a default ' . $identifier . ' disabled initially */' . "\n"; - } - if (!empty($schema['export']['api']['current_version'])) { - $output .= $indent . '$' . $identifier . '->api_version = ' . $schema['export']['api']['current_version'] . ";\n"; - } - - // Put top additions here: - foreach ($additions as $field => $value) { - $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ";\n"; - } - - $fields = $schema['fields']; - if (!empty($schema['join'])) { - foreach ($schema['join'] as $join) { - if (!empty($join['load'])) { - foreach ($join['load'] as $join_field) { - $fields[$join_field] = $join['fields'][$join_field]; - } - } - } - } - - // Go through our schema and joined tables and build correlations. - foreach ($fields as $field => $info) { - if (!empty($info['no export'])) { - continue; - } - if (!isset($object->$field)) { - if (isset($info['default'])) { - $object->$field = $info['default']; - } - else { - $object->$field = ''; - } - } - - // Note: This is the *field* export callback, not the table one! - if (!empty($info['export callback']) && function_exists($info['export callback'])) { - $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . $info['export callback']($object, $field, $object->$field, $indent) . ";\n"; - } - else { - $value = $object->$field; - if ($info['type'] == 'int') { - if (isset($info['size']) && $info['size'] == 'tiny') { - $info['boolean'] = (!isset($info['boolean'])) ? $schema['export']['boolean'] : $info['boolean']; - $value = ($info['boolean']) ? (bool) $value : (int) $value; - } - else { - $value = (int) $value; - } - } - - $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ";\n"; - } - } - - // And bottom additions here. - foreach ($additions2 as $field => $value) { - $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ";\n"; - } - - return $output; -} - -/** - * Get the schema for a given table. - * - * This looks for data the export subsystem needs and applies defaults so - * that it's easily available. - */ -function ctools_export_get_schema($table) { - static $drupal_static_fast; - if (!isset($drupal_static_fast)) { - $drupal_static_fast['cache'] = &drupal_static(__FUNCTION__); - } - $cache = &$drupal_static_fast['cache']; - - if (empty($cache[$table])) { - $schema = drupal_get_schema($table); - - // If our schema isn't loaded, it's possible we're in a state where it - // simply hasn't been cached. If we've been asked, let's force the - // issue. - if (!$schema || empty($schema['export'])) { - // Force a schema reset: - $schema = drupal_get_schema($table, TRUE); - } - - if (!isset($schema['export'])) { - return array(); - } - - if (empty($schema['module'])) { - return array(); - } - - // Add some defaults. - $schema['export'] += array( - 'key' => 'name', - 'key name' => 'Name', - 'object' => 'stdClass', - 'status' => 'default_' . $table, - 'default hook' => 'default_' . $table, - 'can disable' => TRUE, - 'identifier' => $table, - 'primary key' => !empty($schema['primary key']) ? $schema['primary key'][0] : '', - 'bulk export' => TRUE, - 'list callback' => "$schema[module]_{$table}_list", - 'to hook code callback' => "$schema[module]_{$table}_to_hook_code", - 'cache defaults' => FALSE, - 'default cache bin' => 'cache', - 'export type string' => 'type', - 'boolean' => TRUE, - ); - - // If the export definition doesn't have the "primary key" then the CRUD - // save callback won't work. - if (empty($schema['export']['primary key']) && user_access('administer site configuration')) { - drupal_set_message(t('The export definition of @table is missing the "primary key" property.', array('@table' => $table)), 'error'); - } - - // Notes: - // The following callbacks may be defined to override default behavior - // when using CRUD functions: - // - // create callback - // load callback - // load multiple callback - // load all callback - // save callback - // delete callback - // export callback - // import callback - // - // See the appropriate ctools_export_crud function for details on what - // arguments these callbacks should accept. Please do not call these - // directly, always use the ctools_export_crud_* wrappers to ensure - // that default implementations are honored. - $cache[$table] = $schema; - } - - return $cache[$table]; -} - -/** - * Gets the schemas for all tables with ctools object metadata. - */ -function ctools_export_get_schemas($for_export = FALSE) { - $export_tables = &drupal_static(__FUNCTION__); - if (is_null($export_tables)) { - $export_tables = array(); - $schemas = drupal_get_schema(); - foreach ($schemas as $table => $schema) { - if (!isset($schema['export'])) { - unset($schemas[$table]); - continue; - } - $export_tables[$table] = ctools_export_get_schema($table); - } - } - return $for_export ? array_filter($export_tables, '_ctools_export_filter_export_tables') : $export_tables; -} - -function _ctools_export_filter_export_tables($schema) { - return !empty($schema['export']['bulk export']); -} - -function ctools_export_get_schemas_by_module($modules = array(), $for_export = FALSE) { - $export_tables = array(); - $list = ctools_export_get_schemas($for_export); - foreach ($list as $table => $schema) { - $export_tables[$schema['module']][$table] = $schema; - } - return empty($modules) ? $export_tables : array_keys($export_tables, $modules); -} - -/** - * Set the status of a default $object as a variable. - * - * The status, in this case, is whether or not it is 'disabled'. - * This function does not check to make sure $object actually - * exists. - */ -function ctools_export_set_status($table, $name, $new_status = TRUE) { - $schema = ctools_export_get_schema($table); - $status = variable_get($schema['export']['status'], array()); - - $status[$name] = $new_status; - variable_set($schema['export']['status'], $status); -} - -/** - * Set the status of a default $object as a variable. - * - * This is more efficient than ctools_export_set_status because it - * will actually unset the variable entirely if it's not necessary, - * this saving a bit of space. - */ -function ctools_export_set_object_status($object, $new_status = TRUE) { - $table = $object->table; - $schema = ctools_export_get_schema($table); - $export = $schema['export']; - $status = variable_get($export['status'], array()); - - // Compare. - if (!$new_status && $object->export_type & EXPORT_IN_DATABASE) { - unset($status[$object->{$export['key']}]); - } - else { - $status[$object->{$export['key']}] = $new_status; - } - - variable_set($export['status'], $status); -} - -/** - * Provide a form for displaying an export. - * - * This is a simple form that should be invoked like this: - * @code - * $output = drupal_get_form('ctools_export_form', $code, $object_title); - * @endcode - */ -function ctools_export_form($form, &$form_state, $code, $title = '') { - $lines = substr_count($code, "\n"); - $form['code'] = array( - '#type' => 'textarea', - '#title' => $title, - '#default_value' => $code, - '#rows' => $lines, - ); - - return $form; -} - -/** - * Create a new object based upon schema values. - * - * Because 'default' has ambiguous meaning on some fields, we will actually - * use 'object default' to fill in default values if default is not set - * That's a little safer to use as it won't cause weird database default - * situations. - */ -function ctools_export_new_object($table, $set_defaults = TRUE) { - $schema = ctools_export_get_schema($table); - $export = $schema['export']; - - $object = new $export['object'](); - foreach ($schema['fields'] as $field => $info) { - if (isset($info['object default'])) { - $object->$field = $info['object default']; - } - elseif (isset($info['default'])) { - $object->$field = $info['default']; - } - else { - $object->$field = NULL; - } - } - - if ($set_defaults) { - // Set some defaults so this data always exists. - // We don't set the export_type property here, as this object is not saved - // yet. We do give it NULL so we don't generate notices trying to read it. - $object->export_type = NULL; - $object->{$export['export type string']} = t('Local'); - } - return $object; -} - -/** - * Convert a group of objects to code based upon input and return this as a larger - * export. - */ -function ctools_export_to_hook_code(&$code, $table, $names = array(), $name = 'foo') { - $schema = ctools_export_get_schema($table); - $export = $schema['export']; - // Use the schema-specified function for generating hook code, if one exists. - if (function_exists($export['to hook code callback'])) { - $output = $export['to hook code callback']($names, $name); - } - // Otherwise, the following code generates basic hook code. - else { - $output = ctools_export_default_to_hook_code($schema, $table, $names, $name); - } - - if (!empty($output)) { - if (isset($export['api'])) { - if (isset($code[$export['api']['owner']][$export['api']['api']]['version'])) { - $code[$export['api']['owner']][$export['api']['api']]['version'] = max($code[$export['api']['owner']][$export['api']['api']]['version'], $export['api']['minimum_version']); - } - else { - $code[$export['api']['owner']][$export['api']['api']]['version'] = $export['api']['minimum_version']; - $code[$export['api']['owner']][$export['api']['api']]['code'] = ''; - } - $code[$export['api']['owner']][$export['api']['api']]['code'] .= $output; - } - else { - if (empty($code['general'])) { - $code['general'] = ''; - } - $code['general'] .= $output; - } - } -} - -/** - * Default function to export objects to code. - * - * Note that if your module provides a 'to hook code callback' then it will - * receive only $names and $name as arguments. Your module is presumed to - * already know the rest. - */ -function ctools_export_default_to_hook_code($schema, $table, $names, $name) { - $export = $schema['export']; - $output = ''; - $objects = ctools_export_crud_load_multiple($table, $names); - if ($objects) { - $output = "/**\n"; - $output .= " * Implements hook_{$export['default hook']}().\n"; - $output .= " */\n"; - $output .= "function " . $name . "_{$export['default hook']}() {\n"; - $output .= " \${$export['identifier']}s = array();\n\n"; - foreach ($objects as $object) { - $output .= ctools_export_crud_export($table, $object, ' '); - $output .= " \${$export['identifier']}s['" . check_plain($object->{$export['key']}) . "'] = \${$export['identifier']};\n\n"; - } - $output .= " return \${$export['identifier']}s;\n"; - $output .= "}\n"; - } - - return $output; -} - -/** - * Default function for listing bulk exportable objects. - */ -function ctools_export_default_list($table, $schema) { - $list = array(); - - $items = ctools_export_crud_load_all($table); - $export_key = $schema['export']['key']; - foreach ($items as $item) { - // Try a couple of possible obvious title keys: - $keys = array('admin_title', 'title'); - if (isset($schema['export']['admin_title'])) { - array_unshift($keys, $schema['export']['admin_title']); - } - - $string = ''; - foreach ($keys as $key) { - if (!empty($item->$key)) { - $string = $item->$key . " (" . $item->$export_key . ")"; - break; - } - } - - if (empty($string)) { - $string = $item->$export_key; - } - $list[$item->$export_key] = check_plain($string); - } - return $list; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/fields.inc b/html/sites/all/modules/contrib/ctools/includes/fields.inc deleted file mode 100644 index aa10ad917..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/fields.inc +++ /dev/null @@ -1,362 +0,0 @@ - $field_name, - 'entity_type' => 'ctools', - 'bundle' => 'ctools', - - // Use the default field settings for settings and widget. - 'settings' => field_info_instance_settings($field['type']), - 'widget' => array( - 'type' => $field_type['default_widget'], - 'settings' => array(), - ), - - // Build a dummy display mode. - 'display' => array( - $view_mode => array( - 'type' => $formatter, - 'settings' => $formatter_settings, - ), - ), - - // Set the other fields to their default values. - // @see _field_write_instance(). - 'required' => FALSE, - 'label' => $field_name, - 'description' => '', - 'deleted' => 0, - ); -} - -/** - * Helper function for calling hook_field_formatter_settings_form() without needing to load an instance of the field. - * - * @param $field - * A fully loaded field. - * @param $formatter_type - * The formatter key selected from the options provided by field_ui_formatter_options(). - * @param $form - * The full form from the function that's calling this function. - * @param $form_state - * The full form_state from the function that's calling this function. - * @param $view_mode - * We're passing a view mode from this function to the fake instance we're creating. Defaults to ctools, but we expect developers to actually name this something meaningful. - */ -function ctools_fields_get_field_formatter_settings_form($field, $formatter_type, &$form, $form_state, $view_mode = 'ctools') { - $conf = $form_state['conf']; - $formatter = field_info_formatter_types($formatter_type); - if (isset($formatter['settings'])) { - $conf['formatter_settings'] += $formatter['settings']; - } - $function = $formatter['module'] . '_field_formatter_settings_form'; - - $instance = ctools_fields_fake_field_instance($field['field_name'], $view_mode, $formatter_type, $conf['formatter_settings']); - if (function_exists($function)) { - $settings_form = $function($field, $instance, $view_mode, $form, $form_state); - } - if (empty($settings_form)) { - $settings_form = array(); - } - - // Allow other modules to alter the formatter settings form. - $context = array( - 'module' => $formatter['module'], - 'formatter' => $formatter, - 'field' => $field, - 'instance' => $instance, - 'view_mode' => $view_mode, - 'form' => $form, - 'form_state' => $form_state, - ); - drupal_alter('field_formatter_settings_form', $settings_form, $context); - - $settings_form['#tree'] = TRUE; - $form['ctools_field_list']['#value'][] = $field; - $form += $settings_form; - - if (isset($field['cardinality']) && $field['cardinality'] != 1) { - list($prefix, $suffix) = explode('@count', t('Skip the first @count item(s)')); - $form['delta_offset'] = array( - '#type' => 'textfield', - '#size' => 5, - '#field_prefix' => $prefix, - '#field_suffix' => $suffix, - '#default_value' => isset($conf['delta_offset']) ? $conf['delta_offset'] : 0, - ); - - list($prefix, $suffix) = explode('@count', t('Then display at most @count item(s)')); - $form['delta_limit'] = array( - '#type' => 'textfield', - '#size' => 5, - '#field_prefix' => $prefix, - '#field_suffix' => $suffix, - '#description' => t('Enter 0 to display all items.'), - '#default_value' => isset($conf['delta_limit']) ? $conf['delta_limit'] : 0, - ); - - $form['delta_reversed'] = array( - '#title' => t('Display in reverse order'), - '#type' => 'checkbox', - '#default_value' => !empty($conf['delta_reversed']), - '#description' => t('(start from last values)'), - ); - } -} - -/** - * Helper function for generating all the formatter information associated with - * any fields. - * Especially useful for determining the fields that will be added to form that - * executes hook_field_formatter_settings_form(). - * - * @param $fields - * An array of fully loaded fields. - */ -function ctools_fields_get_field_formatter_info($fields) { - $info = array(); - $field_info = field_info_formatter_types(); - foreach ($fields as $field) { - foreach ($field_info as $format_name => $formatter_info) { - if (in_array($field['type'], $formatter_info['field types'])) { - $info += array($format_name => $formatter_info); - } - } - } - return $info; -} - -/** - * Returns the label of a certain field. - * - * Cribbed from Views. - */ -function ctools_field_label($field_name) { - $label_counter = array(); - // Count the amount of instances per label per field. - $instances = field_info_instances(); - foreach ($instances as $entity_type) { - foreach ($entity_type as $bundle) { - if (isset($bundle[$field_name])) { - $label_counter[$bundle[$field_name]['label']] = isset($label_counter[$bundle[$field_name]['label']]) ? ++$label_counter[$bundle[$field_name]['label']] : 1; - } - } - } - if (empty($label_counter)) { - return $field_name; - } - // Sort the field lables by it most used label and return the most used one. - arsort($label_counter); - $label_counter = array_keys($label_counter); - return $label_counter[0]; -} - -/** - * Replacement for core _field_invoke() to invoke on a single field. - * - * Core only allows invoking field hooks via a private function for all fields - * on an entire entity. However, we very often need to invoke our hooks on - * a single field as we take things apart and only use little bits. - * - * @param $field_name - * Either a field instance object or the name of the field. - * If the 'field' key is populated it will be used as the field - * settings. - * @param $op - * Possible operations include: - * - form - * - validate - * - presave - * - insert - * - update - * - delete - * - delete revision - * - view - * - prepare translation - * @param $entity_type - * The type of $entity; e.g. 'node' or 'user'. - * @param $entity - * The fully formed $entity_type entity. - * @param $a - * - The $form in the 'form' operation. - * - The value of $view_mode in the 'view' operation. - * - Otherwise NULL. - * @param $b - * - The $form_state in the 'submit' operation. - * - Otherwise NULL. - * @param $options - * An associative array of additional options, with the following keys: - * - 'field_name': The name of the field whose operation should be - * invoked. By default, the operation is invoked on all the fields - * in the entity's bundle. NOTE: This option is not compatible with - * the 'deleted' option; the 'field_id' option should be used - * instead. - * - 'field_id': The id of the field whose operation should be - * invoked. By default, the operation is invoked on all the fields - * in the entity's' bundles. - * - 'default': A boolean value, specifying which implementation of - * the operation should be invoked. - * - if FALSE (default), the field types implementation of the operation - * will be invoked (hook_field_[op]) - * - If TRUE, the default field implementation of the field operation - * will be invoked (field_default_[op]) - * Internal use only. Do not explicitely set to TRUE, but use - * _field_invoke_default() instead. - * - 'deleted': If TRUE, the function will operate on deleted fields - * as well as non-deleted fields. If unset or FALSE, only - * non-deleted fields are operated on. - * - 'language': A language code or an array of language codes keyed by field - * name. It will be used to narrow down to a single value the available - * languages to act on. - * - * @see _field_invoke() - */ -function ctools_field_invoke_field($field_name, $op, $entity_type, $entity, &$a = NULL, &$b = NULL, $options = array()) { - if (is_array($field_name)) { - $instance = $field_name; - } - else { - list(, , $bundle) = entity_extract_ids($entity_type, $entity); - $instance = field_info_instance($entity_type, $field_name, $bundle); - } - - if (empty($instance)) { - return; - } - - // Keep the variables consistent regardless if we retrieve the field instance - // ourself, or if one is provided to us via the $field_name variable. - $field = field_info_field($instance['field_name']); - $field_name = $instance['field_name']; - - // Merge default options. - $default_options = array( - 'default' => FALSE, - 'deleted' => FALSE, - 'language' => NULL, - ); - $options += $default_options; - - $return = array(); - - // Everything from here is unmodified code from _field_invoke() formerly - // inside a foreach loop over the instances. - $function = $options['default'] ? 'field_default_' . $op : $field['module'] . '_field_' . $op; - if (function_exists($function)) { - // Determine the list of languages to iterate on. - $available_languages = field_available_languages($entity_type, $field); - $languages = _field_language_suggestion($available_languages, $options['language'], $field_name); - - foreach ($languages as $langcode) { - $items = isset($entity->{$field_name}[$langcode]) ? $entity->{$field_name}[$langcode] : array(); - $result = $function($entity_type, $entity, $field, $instance, $langcode, $items, $a, $b); - if (isset($result)) { - // For hooks with array results, we merge results together. - // For hooks with scalar results, we collect results in an array. - if (is_array($result)) { - $return = array_merge($return, $result); - } - else { - $return[] = $result; - } - } - - // Populate $items back in the field values, but avoid replacing missing - // fields with an empty array (those are not equivalent on update). - if ($items !== array() || isset($entity->{$field_name}[$langcode])) { - $entity->{$field_name}[$langcode] = $items; - } - } - } - - return $return; -} - -/** - * Replacement for core _field_invoke_default() to invoke on a single field. - * - * @see ctools_field_invoke_field() - * @see _field_invoke_default() - */ -function ctools_field_invoke_field_default($field_name, $op, $entity_type, $entity, &$a = NULL, &$b = NULL, $options = array()) { - $options['default'] = TRUE; - return ctools_field_invoke_field($field_name, $op, $entity_type, $entity, $a, $b, $options); -} - -/** - * Returns a list of field definitions of a specified type. - * - * @param string $field_type - * A field type name; e.g. 'text' or 'date'. - * - * @return array - * An array of field definitions of the specified type, keyed by field name. - */ -function ctools_fields_get_fields_by_type($field_type) { - $fields = array(); - foreach (field_info_fields() as $field_name => $field_info) { - if ($field_info['type'] == $field_type) { - $fields[$field_name] = $field_info; - } - } - return $fields; -} - -/** - * Derive the foreign keys that a field provides. - * - * @param $field_name - * The name of the field. - * - * @return - * An array of foreign keys according to Schema API. - */ -function ctools_field_foreign_keys($field_name) { - $foreign_keys = &drupal_static(__FUNCTION__, array()); - if (!isset($foreign_keys[$field_name])) { - $foreign_keys[$field_name] = array(); - $field = field_info_field($field_name); - - if (!empty($field['foreign keys'])) { - $foreign_keys[$field_name] = $field['foreign keys']; - } - else { - // Try to fetch foreign keys from schema, as not everything - // stores foreign keys properly in the field info. - $module = $field['module']; - - module_load_install($module); - $schema = module_invoke($module, 'field_schema', $field); - if (!empty($schema['foreign keys'])) { - $foreign_keys[$field_name] = $schema['foreign keys']; - } - } - } - - return $foreign_keys[$field_name]; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/jump-menu.inc b/html/sites/all/modules/contrib/ctools/includes/jump-menu.inc deleted file mode 100644 index e2ae1cfcd..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/jump-menu.inc +++ /dev/null @@ -1,149 +0,0 @@ - t('Go'), - 'choose' => t('- Choose -'), - 'inline' => TRUE, - 'hide' => TRUE, - ); - - $form['#attached']['js'][] = ctools_attach_js('jump-menu'); - - if (!empty($options['choose'])) { - $select = array('' => $options['choose']) + $select; - } - - $form['jump'] = array( - '#type' => 'select', - '#options' => $select, - '#attributes' => array( - 'class' => array('ctools-jump-menu-select'), - ), - ); - - if (!empty($options['title'])) { - $form['jump']['#title'] = $options['title']; - } - - if (!empty($options['description'])) { - $form['jump']['#description'] = $options['description']; - } - - if (!empty($options['default_value'])) { - $form['jump']['#default_value'] = $options['default_value']; - } - - if (isset($options['image'])) { - $form['go'] = array( - '#type' => 'image_button', - '#src' => $options['image'], - '#submit' => array('ctools_jump_menu_submit'), - '#attributes' => array( - 'class' => array('ctools-jump-menu-button'), - ), - ); - } - else { - $form['go'] = array( - '#type' => 'submit', - '#value' => $options['button'], - '#submit' => array('ctools_jump_menu_submit'), - '#attributes' => array( - 'class' => array('ctools-jump-menu-button'), - ), - ); - } - - if ($options['inline']) { - $form['jump']['#prefix'] = '
'; - $form['go']['#suffix'] = '
'; - } - - if ($options['hide']) { - $form['jump']['#attributes']['class'][] = 'ctools-jump-menu-change'; - $form['go']['#attributes']['class'][] = 'ctools-jump-menu-hide'; - } - - return $form; -} - -/** - * Submit handler for the jump menu. - * - * This is normally only invoked upon submit without javascript enabled. - */ -function ctools_jump_menu_submit($form, &$form_state) { - if ($form_state['values']['jump'] === '') { - // We have nothing to do when the user has not selected any value. - return; - } - - // If the path we are redirecting to contains the string :: then treat the - // the string after the double colon as the path to redirect to. - // This allows duplicate paths to be used in jump menus for multiple options. - $redirect_array = explode("::", $form_state['values']['jump']); - - if (isset($redirect_array[1]) && !empty($redirect_array[1])) { - $redirect = $redirect_array[1]; - } - else { - $redirect = $form_state['values']['jump']; - } - - // If the path we are redirecting to starts with the base path (for example, - // "/somepath/node/1"), we need to strip the base path off before passing it - // to $form_state['redirect']. - $base_path = base_path(); - if (strpos($redirect, $base_path) === 0) { - $redirect = substr($redirect, strlen($base_path)); - } - - // Parse the URL so that query strings and fragments are preserved in the - // redirect. - $redirect = drupal_parse_url($redirect); - $redirect['path'] = urldecode($redirect['path']); - $form_state['redirect'] = array($redirect['path'], $redirect); -} diff --git a/html/sites/all/modules/contrib/ctools/includes/language.inc b/html/sites/all/modules/contrib/ctools/includes/language.inc deleted file mode 100644 index a850670ec..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/language.inc +++ /dev/null @@ -1,47 +0,0 @@ - names in current language, localized - * 'native' => native names - * @param $all - * Boolean to return all languages or only enabled ones - * - * @see locale_language_list - */ -function ctools_language_list($field = 'name', $all = FALSE) { - if ($all) { - $languages = language_list(); - } - else { - $languages = language_list('enabled'); - $languages = $languages[1]; - } - $list = array(); - foreach ($languages as $language) { - $list[$language->language] = ($field == 'name') ? t($language->name) : $language->$field; - } - return $list; -} - -/** - * Returns an array of language names similar to ctools_language_list() except - * that additional choices have been added for ease of use. - */ -function ctools_language_list_all() { - $languages = array( - '***CURRENT_LANGUAGE***' => t("Current user's language"), - '***DEFAULT_LANGUAGE***' => t("Default site language"), - LANGUAGE_NONE => t('Language neutral'), - ); - $languages = array_merge($languages, ctools_language_list()); - return $languages; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/math-expr.inc b/html/sites/all/modules/contrib/ctools/includes/math-expr.inc deleted file mode 100644 index 44ba015f9..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/math-expr.inc +++ /dev/null @@ -1,933 +0,0 @@ - - * - * ============================================================================= - * - * NAME - * ctools_math_expr - safely evaluate math expressions - * - * SYNOPSIS - * $m = new ctools_math_expr(); - * // basic evaluation: - * $result = $m->evaluate('2+2'); - * // supports: order of operation; parentheses; negation; built-in - * // functions. - * $result = $m->evaluate('-8(5/2)^2*(1-sqrt(4))-8'); - * // create your own variables - * $m->evaluate('a = e^(ln(pi))'); - * // or functions - * $m->evaluate('f(x,y) = x^2 + y^2 - 2x*y + 1'); - * // and then use them - * $result = $m->evaluate('3*f(42,a)'); - * - * DESCRIPTION - * Use the ctools_math_expr class when you want to evaluate mathematical - * expressions from untrusted sources. You can define your own variables - * and functions, which are stored in the object. Try it, it's fun! - * - * AUTHOR INFORMATION - * Copyright 2005, Miles Kaufmann. - * Enhancements, 2005 onwards, Drupal Community. - * - * LICENSE - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1 Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * ctools_math_expr Class. - */ -class ctools_math_expr { - - /** - * If TRUE do not call trigger_error on error other wise do. - * - * @var bool - */ - public $suppress_errors = FALSE; - - /** - * The last error message reported. - * - * @var string - */ - public $last_error = NULL; - - /** - * List of all errors reported. - * - * @var array - */ - public $errors = array(); - - /** - * Variable and constant values. - * - * @var array - */ - protected $vars; - - /** - * User defined functions. - * - * @var array - */ - protected $userfuncs; - - /** - * The names of constants, used to make constants read-only. - * - * @var array - */ - protected $constvars; - - /** - * Built in simple (one arg) functions. - * Merged into $this->funcs in constructor. - * - * @var array - */ - protected $simplefuncs; - - /** - * Definitions of all built-in functions. - * - * @var array - */ - protected $funcs; - - /** - * Operators and their precedence. - * - * @var array - */ - protected $ops; - - /** - * The set of operators using two arguments. - * - * @var array - */ - protected $binaryops; - - /** - * Public constructor. - */ - public function __construct() { - $this->userfuncs = array(); - $this->simplefuncs = array( - 'sin', - 'sinh', - 'asin', - 'asinh', - 'cos', - 'cosh', - 'acos', - 'acosh', - 'tan', - 'tanh', - 'atan', - 'atanh', - 'exp', - 'sqrt', - 'abs', - 'log', - 'ceil', - 'floor', - 'round', - ); - - $this->ops = array( - '+' => array('precedence' => 0), - '-' => array('precedence' => 0), - '*' => array('precedence' => 1), - '/' => array('precedence' => 1), - '^' => array('precedence' => 2, 'right' => TRUE), - '_' => array('precedence' => 1), - '==' => array('precedence' => -1), - '!=' => array('precedence' => -1), - '>=' => array('precedence' => -1), - '<=' => array('precedence' => -1), - '>' => array('precedence' => -1), - '<' => array('precedence' => -1), - ); - - $this->binaryops = array( - '+', '-', '*', '/', '^', '==', '!=', '<', '<=', '>=', '>', - ); - - $this->funcs = array( - 'ln' => array( - 'function' => 'log', - 'arguments' => 1, - ), - 'arcsin' => array( - 'function' => 'asin', - 'arguments' => 1, - ), - 'arcsinh' => array( - 'function' => 'asinh', - 'arguments' => 1, - ), - 'arccos' => array( - 'function' => 'acos', - 'arguments' => 1, - ), - 'arccosh' => array( - 'function' => 'acosh', - 'arguments' => 1, - ), - 'arctan' => array( - 'function' => 'atan', - 'arguments' => 1, - ), - 'arctanh' => array( - 'function' => 'atanh', - 'arguments' => 1, - ), - 'min' => array( - 'function' => 'min', - 'arguments' => 2, - 'max arguments' => 99, - ), - 'max' => array( - 'function' => 'max', - 'arguments' => 2, - 'max arguments' => 99, - ), - 'pow' => array( - 'function' => 'pow', - 'arguments' => 2, - ), - 'if' => array( - 'function' => 'ctools_math_expr_if', - 'arguments' => 2, - 'max arguments' => 3, - ), - 'number' => array( - 'function' => 'ctools_math_expr_number', - 'arguments' => 1, - ), - 'time' => array( - 'function' => 'time', - 'arguments' => 0, - ), - ); - - // Allow modules to add custom functions. - $context = array('final' => &$this->funcs); - drupal_alter('ctools_math_expression_functions', $this->simplefuncs, $context); - - // Set up the initial constants and mark them read-only. - $this->vars = array('e' => exp(1), 'pi' => pi()); - drupal_alter('ctools_math_expression_constants', $this->vars); - $this->constvars = array_keys($this->vars); - - // Translate the older, simpler style into the newer, richer style. - foreach ($this->simplefuncs as $function) { - $this->funcs[$function] = array( - 'function' => $function, - 'arguments' => 1, - ); - } - } - - /** - * Change the suppress errors flag. - * - * When errors are not suppressed, trigger_error is used to cause a PHP error - * when an evaluation error occurs, as a result of calling trigger(). With - * errors suppressed this doesn't happen. - * - * @param bool $enable - * If FALSE, enable triggering of php errors when expression errors occurs. - * otherwise, suppress triggering the errors. - * - * @return bool - * The new (current) state of the flag. - * - * @see ctools_math_expr::trigger() - */ - public function set_suppress_errors($enable) { - return $this->suppress_errors = (bool) $enable; - } - - /** - * Backwards compatible wrapper for evaluate(). - * - * @see ctools_math_expr::evaluate() - */ - public function e($expr) { - return $this->evaluate($expr); - } - - /** - * Evaluate the expression. - * - * @param string $expr - * The expression to evaluate. - * - * @return string|bool - * The result of the expression, or FALSE if an error occurred, or TRUE if - * an user-defined function was created. - */ - public function evaluate($expr) { - $this->last_error = NULL; - $expr = trim($expr); - - // Strip possible semicolons at the end. - if (substr($expr, -1, 1) == ';') { - $expr = (string) substr($expr, 0, -1); - } - - // Is it a variable assignment? - if (preg_match('/^\s*([a-z]\w*)\s*=\s*(.+)$/', $expr, $matches)) { - - // Make sure we're not assigning to a constant. - if (in_array($matches[1], $this->constvars)) { - return $this->trigger("cannot assign to constant '$matches[1]'"); - } - - // Get the result and make sure it's good: - if (($tmp = $this->pfx($this->nfx($matches[2]))) === FALSE) { - return FALSE; - } - // If so, stick it in the variable array... - $this->vars[$matches[1]] = $tmp; - // ...and return the resulting value: - return $this->vars[$matches[1]]; - - } - // Is it a function assignment? - elseif (preg_match('/^\s*([a-z]\w*)\s*\(\s*([a-z]\w*(?:\s*,\s*[a-z]\w*)*)\s*\)\s*=\s*(.+)$/', $expr, $matches)) { - // Get the function name. - $fnn = $matches[1]; - // Make sure it isn't built in: - if (isset($this->funcs[$matches[1]])) { - return $this->trigger("cannot redefine built-in function '$matches[1]()'"); - } - - // Get the arguments. - $args = explode(",", preg_replace("/\s+/", "", $matches[2])); - // See if it can be converted to postfix. - $stack = $this->nfx($matches[3]); - if ($stack === FALSE) { - return FALSE; - } - - // Freeze the state of the non-argument variables. - for ($i = 0; $i < count($stack); $i++) { - $token = (string) $stack[$i]; - if (preg_match('/^[a-z]\w*$/', $token) and !in_array($token, $args)) { - if (array_key_exists($token, $this->vars)) { - $stack[$i] = $this->vars[$token]; - } - else { - return $this->trigger("undefined variable '$token' in function definition"); - } - } - } - $this->userfuncs[$fnn] = array('args' => $args, 'func' => $stack); - - return TRUE; - } - else { - // Straight up evaluation. - return trim($this->pfx($this->nfx($expr)), '"'); - } - } - - /** - * Fetch an array of variables used in the expression. - * - * @return array - * Array of name : value pairs, one for each variable defined. - */ - public function vars() { - $output = $this->vars; - - // @todo: Is this supposed to remove all constants? we should remove all - // those in $this->constvars! - unset($output['pi']); - unset($output['e']); - - return $output; - } - - /** - * Fetch all user defined functions in the expression. - * - * @return array - * Array of name : string pairs, one for each function defined. The string - * will be of the form fname(arg1,arg2). The function body is not returned. - */ - public function funcs() { - $output = array(); - foreach ($this->userfuncs as $fnn => $dat) { - $output[] = $fnn . '(' . implode(',', $dat['args']) . ')'; - } - - return $output; - } - - /** - * Convert infix to postfix notation. - * - * @param string $expr - * The expression to convert. - * - * @return array|bool - * The expression as an ordered list of postfix action tokens. - */ - private function nfx($expr) { - - $index = 0; - $stack = new ctools_math_expr_stack(); - // Postfix form of expression, to be passed to pfx(). - $output = array(); - - // @todo: Because the expr can contain string operands, using strtolower here is a bug. - $expr = trim(strtolower($expr)); - - // We use this in syntax-checking the expression and determining when - // '-' is a negation. - $expecting_op = FALSE; - - while (TRUE) { - $op = substr($expr, $index, 1); - // Get the first character at the current index, and if the second - // character is an =, add it to our op as well (accounts for <=). - if (substr($expr, $index + 1, 1) === '=') { - $op = substr($expr, $index, 2); - $index++; - } - - // Find out if we're currently at the beginning of a number/variable/ - // function/parenthesis/operand. - $ex = preg_match('/^([a-z]\w*\(?|\d+(?:\.\d*)?|\.\d+|\()/', (string) substr($expr, $index), $match); - - // Is it a negation instead of a minus? - if ($op === '-' and !$expecting_op) { - // Put a negation on the stack. - $stack->push('_'); - $index++; - } - // We have to explicitly deny this, because it's legal on the stack but - // not in the input expression. - elseif ($op == '_') { - return $this->trigger("illegal character '_'"); - - } - // Are we putting an operator on the stack? - elseif ((isset($this->ops[$op]) || $ex) && $expecting_op) { - // Are we expecting an operator but have a num, var, func, or - // open-paren? - if ($ex) { - $op = '*'; - // It's an implicit multiplication. - $index--; - } - // Heart of the algorithm: - while ($stack->count() > 0 && - ($o2 = $stack->last()) && - isset($this->ops[$o2]) && - (!empty($this->ops[$op]['right']) ? - $this->ops[$op]['precedence'] < $this->ops[$o2]['precedence'] : - $this->ops[$op]['precedence'] <= $this->ops[$o2]['precedence'])) { - - // Pop stuff off the stack into the output. - $output[] = $stack->pop(); - } - // Many thanks: http://en.wikipedia.org/wiki/Reverse_Polish_notation#The_algorithm_in_detail - // finally put OUR operator onto the stack. - $stack->push($op); - $index++; - $expecting_op = FALSE; - - } - // Ready to close a parenthesis? - elseif ($op === ')') { - - // Pop off the stack back to the last '('. - while (($o2 = $stack->pop()) !== '(') { - if (is_null($o2)) { - return $this->trigger("unexpected ')'"); - } - else { - $output[] = $o2; - } - } - - // Did we just close a function? - if (preg_match("/^([a-z]\w*)\($/", (string) $stack->last(2), $matches)) { - - // Get the function name. - $fnn = $matches[1]; - // See how many arguments there were (cleverly stored on the stack, - // thank you). - $arg_count = $stack->pop(); - // Pop the function and push onto the output. - $output[] = $stack->pop(); - - // Check the argument count: - if (isset($this->funcs[$fnn])) { - $fdef = $this->funcs[$fnn]; - $max_arguments = isset($fdef['max arguments']) ? $fdef['max arguments'] : $fdef['arguments']; - if ($arg_count > $max_arguments) { - return $this->trigger("too many arguments ($arg_count given, $max_arguments expected)"); - } - } - elseif (array_key_exists($fnn, $this->userfuncs)) { - $fdef = $this->userfuncs[$fnn]; - if ($arg_count !== count($fdef['args'])) { - return $this->trigger("wrong number of arguments ($arg_count given, " . count($fdef['args']) . ' expected)'); - } - } - else { - // Did we somehow push a non-function on the stack? this should - // never happen. - return $this->trigger('internal error'); - } - } - $index++; - - } - // Did we just finish a function argument? - elseif ($op === ',' && $expecting_op) { - $index++; - $expecting_op = FALSE; - } - elseif ($op === '(' && !$expecting_op) { - $stack->push('('); - $index++; - - } - elseif ($ex && !$expecting_op) { - // Make sure there was a function. - if (preg_match("/^([a-z]\w*)\($/", (string) $stack->last(3), $matches)) { - // Pop the argument expression stuff and push onto the output: - while (($o2 = $stack->pop()) !== '(') { - // Oops, never had a '('. - if (is_null($o2)) { - return $this->trigger("unexpected argument in $expr $o2"); - } - else { - $output[] = $o2; - } - } - - // Increment the argument count. - $stack->push($stack->pop() + 1); - // Put the ( back on, we'll need to pop back to it again. - $stack->push('('); - } - - // Do we now have a function/variable/number? - $expecting_op = TRUE; - $val = (string) $match[1]; - if (preg_match("/^([a-z]\w*)\($/", $val, $matches)) { - // May be func, or variable w/ implicit multiplication against - // parentheses... - if (isset($this->funcs[$matches[1]]) or array_key_exists($matches[1], $this->userfuncs)) { - $stack->push($val); - $stack->push(0); - $stack->push('('); - $expecting_op = FALSE; - } - // it's a var w/ implicit multiplication. - else { - $val = $matches[1]; - $output[] = $val; - } - } - // it's a plain old var or num. - else { - $output[] = $val; - } - $index += strlen($val); - - } - elseif ($op === ')') { - // Miscellaneous error checking. - return $this->trigger("unexpected ')'"); - } - elseif (isset($this->ops[$op]) and !$expecting_op) { - return $this->trigger("unexpected operator '$op'"); - } - elseif ($op === '"') { - // Fetch a quoted string. - $string = (string) substr($expr, $index); - if (preg_match('/"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"/s', $string, $matches)) { - $string = $matches[0]; - // Trim the quotes off: - $output[] = $string; - $index += strlen($string); - $expecting_op = TRUE; - } - else { - return $this->trigger('open quote without close quote.'); - } - } - else { - // I don't even want to know what you did to get here. - return $this->trigger("an unexpected error occurred at $op"); - } - if ($index === strlen($expr)) { - if (isset($this->ops[$op])) { - // Did we end with an operator? bad. - return $this->trigger("operator '$op' lacks operand"); - } - else { - break; - } - } - - // Step the index past whitespace (pretty much turns whitespace into - // implicit multiplication if no operator is there). - while (substr($expr, $index, 1) === ' ') { - $index++; - } - } - - // Pop everything off the stack and push onto output: - while (!is_null($op = $stack->pop())) { - - // If there are (s on the stack, ()s were unbalanced. - if ($op === '(') { - return $this->trigger("expecting ')'"); - } - $output[] = $op; - } - - return $output; - } - - /** - * Evaluate a prefix-operator stack expression. - * - * @param array $tokens - * The array of token values to evaluate. A token is a string value - * representing either an operation to perform, a variable, or a value. - * Literal values are checked using is_numeric(), or a value that starts - * with a double-quote; functions and variables by existence in the - * appropriate tables. - * If FALSE is passed in the function terminates immediately, returning - * FALSE. - * @param array $vars - * Additional variable values to use when evaluating the expression. These - * variables do not override internal variables with the same name. - * - * @return bool|mixed - * The expression's value, otherwise FALSE is returned if there is an error - * detected unless php error handling intervenes: see suppress_error. - */ - public function pfx(array $tokens, array $vars = array()) { - - if ($tokens == FALSE) { - return FALSE; - } - - $stack = new ctools_math_expr_stack(); - - foreach ($tokens as $token) { - // If the token is a binary operator, pop two values off the stack, do - // the operation, and push the result back on again. - if (in_array($token, $this->binaryops)) { - if (is_null($op2 = $stack->pop())) { - return $this->trigger('internal error'); - } - if (is_null($op1 = $stack->pop())) { - return $this->trigger('internal error'); - } - switch ($token) { - case '+': - $stack->push($op1 + $op2); - break; - - case '-': - $stack->push($op1 - $op2); - break; - - case '*': - $stack->push($op1 * $op2); - break; - - case '/': - if ($op2 == 0) { - return $this->trigger('division by zero'); - } - $stack->push($op1 / $op2); - break; - - case '^': - $stack->push(pow($op1, $op2)); - break; - - case '==': - $stack->push((int) ($op1 == $op2)); - break; - - case '!=': - $stack->push((int) ($op1 != $op2)); - break; - - case '<=': - $stack->push((int) ($op1 <= $op2)); - break; - - case '<': - $stack->push((int) ($op1 < $op2)); - break; - - case '>=': - $stack->push((int) ($op1 >= $op2)); - break; - - case '>': - $stack->push((int) ($op1 > $op2)); - break; - } - } - // If the token is a unary operator, pop one value off the stack, do the - // operation, and push it back on again. - elseif ($token === "_") { - $stack->push(-1 * $stack->pop()); - } - // If the token is a function, pop arguments off the stack, hand them to - // the function, and push the result back on again. - elseif (preg_match("/^([a-z]\w*)\($/", (string) $token, $matches)) { - $fnn = $matches[1]; - - // Check for a built-in function. - if (isset($this->funcs[$fnn])) { - $args = array(); - // Collect all required args from the stack. - for ($i = 0; $i < $this->funcs[$fnn]['arguments']; $i++) { - if (is_null($op1 = $stack->pop())) { - return $this->trigger("function $fnn missing argument $i"); - } - $args[] = $op1; - } - // If func allows additional args, collect them too, stopping on a - // NULL arg. - if (!empty($this->funcs[$fnn]['max arguments'])) { - for (; $i < $this->funcs[$fnn]['max arguments']; $i++) { - $arg = $stack->pop(); - if (!isset($arg)) { - break; - } - $args[] = $arg; - } - } - $stack->push( - call_user_func_array($this->funcs[$fnn]['function'], array_reverse($args)) - ); - } - - // Check for a user function. - elseif (isset($fnn, $this->userfuncs)) { - $args = array(); - for ($i = count($this->userfuncs[$fnn]['args']) - 1; $i >= 0; $i--) { - $value = $stack->pop(); - $args[$this->userfuncs[$fnn]['args'][$i]] = $value; - if (is_null($value)) { - return $this->trigger('internal error'); - } - } - // yay... recursion!!!! - $stack->push($this->pfx($this->userfuncs[$fnn]['func'], $args)); - } - } - // If the token is a number or variable, push it on the stack. - else { - if (is_numeric($token) || $token[0] == '"') { - $stack->push($token); - } - elseif (array_key_exists($token, $this->vars)) { - $stack->push($this->vars[$token]); - } - elseif (array_key_exists($token, $vars)) { - $stack->push($vars[$token]); - } - else { - return $this->trigger("undefined variable '$token'"); - } - } - } - // When we're out of tokens, the stack should have a single element, the - // final result: - if ($stack->count() !== 1) { - return $this->trigger('internal error'); - } - - return $stack->pop(); - } - - /** - * Trigger an error, but nicely, if need be. - * - * @param string $msg - * Message to add to trigger error. - * - * @return bool - * Can trigger error, then returns FALSE. - */ - protected function trigger($msg) { - $this->errors[] = $msg; - $this->last_error = $msg; - if (!$this->suppress_errors) { - trigger_error($msg, E_USER_WARNING); - } - - return FALSE; - } - -} - -/** - * Class implementing a simple stack structure, used by ctools_math_expr. - */ -class ctools_math_expr_stack { - - /** - * The stack. - * - * @var array - */ - private $stack; - /** - * The stack pointer, points at the first empty space. - * - * @var int - */ - private $count; - - /** - * Ctools_math_expr_stack constructor. - */ - public function __construct() { - $this->stack = array(); - $this->count = 0; - } - - /** - * Push the value onto the stack. - * - * @param mixed $val - */ - public function push($val) { - $this->stack[$this->count] = $val; - $this->count++; - } - - /** - * Remove the most recently pushed value and return it. - * - * @return mixed|null - * The most recently pushed value, or NULL if the stack was empty. - */ - public function pop() { - if ($this->count > 0) { - $this->count--; - - return $this->stack[$this->count]; - } - return NULL; - } - - /** - * "Peek" the stack, or Return a value from the stack without removing it. - * - * @param int $n - * Integer indicating which value to return. 1 is the topmost (i.e. the - * value that pop() would return), 2 indicates the next, 3 the third, etc. - * - * @return mixed|null - * A value pushed onto the stack at the nth position, or NULL if the stack - * was empty. - */ - public function last($n = 1) { - return !empty($this->stack[$this->count - $n]) ? $this->stack[$this->count - $n] : NULL; - } - - /** - * Return the number of items on the stack. - * - * @return int - * The number of items. - */ - public function count() { - return $this->count; - } - -} - -/** - * Helper function for evaluating 'if' condition. - * - * @param int $expr - * The expression to test: if <> 0 then the $if expression is returned. - * @param mixed $if - * The expression returned if the condition is true. - * @param mixed $else - * Optional. The expression returned if the expression is false. - * - * @return mixed|null - * The result. NULL is returned when an If condition is False and no Else - * expression is provided. - */ -function ctools_math_expr_if($expr, $if, $else = NULL) { - return $expr ? $if : $else; -} - -/** - * Remove any non-digits so that numbers like $4,511.23 still work. - * - * It might be good for those using the 12,345.67 format, but is awful for - * those using other conventions. - * Use of the php 'intl' module might work here, if the correct locale can be - * derived, but that seems unlikely to be true in all cases. - * - * @todo: locale could break this since in some locales that's $4.512,33 so - * there needs to be a way to detect that and make it work properly. - * - * @param mixed $arg - * A number string with possible leading chars. - * - * @return mixed - * Returns a number string. - */ -function ctools_math_expr_number($arg) { - // @todo: A really bad idea: It might be good for those using the 12,345.67 - // format, but is awful for those using other conventions. - // $arg = preg_replace("/[^0-9\.]/", '', $arg);. - return $arg; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/menu.inc b/html/sites/all/modules/contrib/ctools/includes/menu.inc deleted file mode 100644 index e725ea407..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/menu.inc +++ /dev/null @@ -1,98 +0,0 @@ - 'menu_local_action', - '#link' => $addition, - ); - } - else { - $data['tabs'][0]['output'][] = array( - '#theme' => 'menu_local_task', - '#link' => $addition, - '#active' => (!$has_active && $root_path === $addition['href']), - ); - } - } - if (!empty($data['tabs'][0]['output'])) { - uasort($data['tabs'][0]['output'], 'ctools_menu_sort'); - $data['tabs'][0]['count'] = count($data['tabs'][0]['output']); - } - - if (!empty($data['actions']['output'])) { - uasort($data['actions']['output'], 'ctools_menu_sort'); - $data['actions']['count'] = count($data['actions']['output']); - } - } -} diff --git a/html/sites/all/modules/contrib/ctools/includes/modal.inc b/html/sites/all/modules/contrib/ctools/includes/modal.inc deleted file mode 100644 index ea88d932a..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/modal.inc +++ /dev/null @@ -1,263 +0,0 @@ - array( - 'loadingText' => t('Loading...'), - 'closeText' => t('Close Window'), - 'closeImage' => theme('image', array( - 'path' => ctools_image_path('icon-close-window.png'), - 'title' => t('Close window'), - 'alt' => t('Close window'), - )), - 'throbber' => theme('image', array( - 'path' => ctools_image_path('throbber.gif'), - 'title' => t('Loading...'), - 'alt' => t('Loading'), - )), - ), - ); - - drupal_add_js($settings, 'setting'); - drupal_add_library('system', 'jquery.form'); - drupal_add_library('system', 'drupal.progress'); - drupal_add_library('system', 'drupal.ajax'); - drupal_add_library('system', 'ui'); - ctools_add_js('modal'); - - ctools_add_css('modal'); - $done = TRUE; -} - -/** - * @todo Deprecated this. - */ -function ctools_modal_add_plugin_js($plugins) { - $css = array(); - $js = array(drupal_get_path('module', 'ctools') . '/js/dependent.js' => TRUE); - foreach ($plugins as $subtype) { - if (isset($subtype['js'])) { - foreach ($subtype['js'] as $file) { - if (file_exists($file)) { - $js[$file] = TRUE; - } - elseif (file_exists($subtype['path'] . '/' . $file)) { - $js[$subtype['path'] . '/' . $file] = TRUE; - } - } - } - if (isset($subtype['css'])) { - foreach ($subtype['css'] as $file) { - if (file_exists($file)) { - $css[$file] = TRUE; - } - elseif (file_exists($subtype['path'] . '/' . $file)) { - $css[$subtype['path'] . '/' . $file] = TRUE; - } - } - } - } - - foreach (array_keys($js) as $file) { - drupal_add_js($file); - } - foreach (array_keys($css) as $file) { - drupal_add_css($file); - } -} - -/** - * Place HTML within the modal. - * - * @param $title - * The title of the modal. - * @param $html - * The html to place within the modal. - */ -function ctools_modal_command_display($title, $html) { - if (is_array($html)) { - $html = drupal_render($html); - } - - return array( - 'command' => 'modal_display', - 'title' => $title, - 'output' => $html, - ); -} - -/** - * Dismiss the modal. - */ -function ctools_modal_command_dismiss() { - return array( - 'command' => 'modal_dismiss', - ); -} - -/** - * Display loading screen in the modal. - */ -function ctools_modal_command_loading() { - return array( - 'command' => 'modal_loading', - ); -} - -/** - * Render an image as a button link. This will automatically apply an AJAX class - * to the link and add the appropriate javascript to make this happen. - * - * @param $image - * The path to an image to use that will be sent to theme('image') for rendering. - * @param $dest - * The destination of the link. - * @param $alt - * The alt text of the link. - * @param $class - * Any class to apply to the link. @todo this should be a options array. - */ -function ctools_modal_image_button($image, $dest, $alt, $class = '') { - return ctools_ajax_text_button(theme('image', array('path' => $image)), $dest, $alt, $class, 'ctools-use-modal'); -} - -/** - * Render text as a link. This will automatically apply an AJAX class - * to the link and add the appropriate javascript to make this happen. - * - * Note: 'html' => true so be sure any text is vetted! Chances are these kinds of buttons will - * not use user input so this is a very minor concern. - * - * @param $text - * The text that will be displayed as the link. - * @param $dest - * The destination of the link. - * @param $alt - * The alt text of the link. - * @param $class - * Any class to apply to the link. @todo this should be a options array. - */ -function ctools_modal_text_button($text, $dest, $alt, $class = '') { - return ctools_ajax_text_button($text, $dest, $alt, $class, 'ctools-use-modal'); -} - -/** - * Wrap a form so that we can use it properly with AJAX. Essentially if the - * form wishes to render, it automatically does that, otherwise it returns - * the render array so we can see submission results. - * - * @param array $form - * An associative array containing the structure of the form. - * @param array $form_state - * An associative array containing the current state of the form. - * If the 'reset_html_ids' key is set to TRUE, it will prevent HTML IDs in - * forms from being incremented. - * - * @return mixed - * The output of the form, if it was rendered. If $form_state['ajax'] - * is set, this will use ctools_modal_form_render so it will be - * a $command object suitable for ajax_render already. - * - * If the form was not rendered, the raw render array will be returned. - * - * If ajax is set the form will never be redirected. - */ -function ctools_modal_form_wrapper($form_id, &$form_state) { - // Since this will run again on form rebuild while still in the modal, prevent - // form IDs from being incremented. - // @todo https://drupal.org/node/1305882 - if (!empty($form_state['reset_html_ids']) && !empty($_POST['ajax_html_ids'])) { - unset($_POST['ajax_html_ids']); - } - - // This won't override settings already in. - $form_state += array( - 're_render' => FALSE, - 'no_redirect' => !empty($form_state['ajax']), - ); - - $output = drupal_build_form($form_id, $form_state); - if (!empty($form_state['ajax']) && (!$form_state['executed'] || $form_state['rebuild'])) { - return ctools_modal_form_render($form_state, $output); - } - - return $output; -} - -/** - * Render a form into an AJAX display. - */ -function ctools_modal_form_render($form_state, $output) { - if (is_array($output)) { - $output = drupal_render($output); - } - - $title = empty($form_state['title']) ? drupal_get_title() : $form_state['title']; - - // If there are messages for the form, render them. - if ($messages = theme('status_messages')) { - $output = $messages . $output; - } - - $commands = array(); - // If the form has not yet been rendered, render it. - $commands[] = ctools_modal_command_display($title, $output); - return $commands; -} - -/** - * Perform a simple modal render and immediately exit. - * - * This is primarily used for error displays, since usually modals will - * contain forms. - */ -function ctools_modal_render($title, $output) { - $commands = array(); - $commands[] = ctools_modal_command_display($title, $output); - print ajax_render($commands); -} diff --git a/html/sites/all/modules/contrib/ctools/includes/object-cache.cron.inc b/html/sites/all/modules/contrib/ctools/includes/object-cache.cron.inc deleted file mode 100644 index 99f2276ca..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/object-cache.cron.inc +++ /dev/null @@ -1,16 +0,0 @@ - $sid, - ':object' => $obj, - ':name' => md5($name), - ))->fetchObject(); - if ($data) { - $cache[$key] = unserialize($data->data); - } - } - return isset($cache[$key]) ? $cache[$key] : NULL; -} - -/** - * Store an object in the non-volatile ctools cache. - * - * @param $obj - * A 128 character or less string to define what kind of object is being - * stored; primarily this is used to prevent collisions. - * @param $name - * The name of the object being stored. - * @param $cache - * The object to be cached. This will be serialized prior to writing. - * @param $sid - * The session id, allowing someone to use Session API or their own solution; - * defaults to session_id(). - */ -function ctools_object_cache_set($obj, $name, $cache, $sid = NULL) { - // Store the CTools session id in the user session to force a - // session for anonymous users in Drupal 7 and Drupal 6 Pressflow. - // see http://drupal.org/node/562374, http://drupal.org/node/861778 - if (empty($GLOBALS['user']->uid) && empty($_SESSION['ctools_session_id'])) { - $_SESSION['ctools_hold_session'] = TRUE; - } - - ctools_object_cache_clear($obj, $name, $sid); - - if (!$sid) { - $sid = session_id(); - } - - db_insert('ctools_object_cache') - ->fields(array( - 'sid' => $sid, - 'obj' => $obj, - 'name' => md5($name), - 'data' => serialize($cache), - 'updated' => REQUEST_TIME, - )) - ->execute(); -} - -/** - * Remove an object from the non-volatile ctools cache. - * - * @param $obj - * A 128 character or less string to define what kind of object is being - * stored; primarily this is used to prevent collisions. - * @param $name - * The name of the object being removed. - * @param $sid - * The session id, allowing someone to use Session API or their own solution; - * defaults to session_id(). - */ -function ctools_object_cache_clear($obj, $name, $sid = NULL) { - if (!$sid) { - $sid = session_id(); - } - - db_delete('ctools_object_cache') - ->condition('sid', $sid) - ->condition('obj', $obj) - ->condition('name', md5($name)) - ->execute(); - // Ensure the static cache is emptied of this obj:name set. - drupal_static_reset('ctools_object_cache_get'); -} - -/** - * Determine if another user has a given object cached. - * - * This is very useful for 'locking' objects so that only one user can - * modify them. - * - * @param $obj - * A 128 character or less string to define what kind of object is being - * stored; primarily this is used to prevent collisions. - * @param $name - * The name of the object being removed. - * @param $sid - * The session id, allowing someone to use Session API or their own solution; - * defaults to session_id(). - * - * @return - * An object containing the UID and updated date if found; NULL if not. - */ -function ctools_object_cache_test($obj, $name, $sid = NULL) { - - if (!$sid) { - $sid = session_id(); - } - - return db_query('SELECT s.uid, c.updated FROM {ctools_object_cache} c INNER JOIN {sessions} s ON c.sid = s.sid WHERE s.sid <> :session_id AND c.obj = :obj AND c.name = :name ORDER BY c.updated ASC', array( - ':session_id' => $sid, - ':obj' => $obj, - ':name' => md5($name), - ))->fetchObject(); -} - -/** - * Get the cache status of a group of objects. - * - * This is useful for displaying lock status when listing a number of objects - * an an administration UI. - * - * @param $obj - * A 128 character or less string to define what kind of object is being - * stored; primarily this is used to prevent collisions. - * @param $names - * An array of names of objects - * - * @return - * An array of objects containing the UID and updated date for each name found. - */ -function ctools_object_cache_test_objects($obj, $names) { - array_walk($names, 'md5'); - return db_query("SELECT c.name, s.uid, c.updated FROM {ctools_object_cache} c INNER JOIN {sessions} s ON c.sid = s.sid WHERE c.obj = :obj AND c.name IN (:names) ORDER BY c.updated ASC", array(':obj' => $obj, ':names' => $names)) - ->fetchAllAssoc('name'); -} - -/** - * Remove an object from the non-volatile ctools cache for all session IDs. - * - * This is useful for clearing a lock. - * - * @param $obj - * A 128 character or less string to define what kind of object is being - * stored; primarily this is used to prevent collisions. - * @param $name - * The name of the object being removed. - */ -function ctools_object_cache_clear_all($obj, $name) { - db_delete('ctools_object_cache') - ->condition('obj', $obj) - ->condition('name', md5($name)) - ->execute(); - // Ensure the static cache is emptied of this obj:name set. - $cache = &drupal_static('ctools_object_cache_get', array()); - unset($cache["$obj:$name"]); -} - -/** - * Remove all objects in the object cache that are older than the - * specified age. - * - * @param $age - * The minimum age of objects to remove, in seconds. For example, 86400 is - * one day. Defaults to 7 days. - */ -function ctools_object_cache_clean($age = NULL) { - if (empty($age)) { - // 7 days. - $age = 86400 * 7; - } - db_delete('ctools_object_cache') - ->condition('updated', REQUEST_TIME - $age, '<') - ->execute(); -} diff --git a/html/sites/all/modules/contrib/ctools/includes/page-wizard.inc b/html/sites/all/modules/contrib/ctools/includes/page-wizard.inc deleted file mode 100644 index d45d80421..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/page-wizard.inc +++ /dev/null @@ -1,198 +0,0 @@ -plugin = $plugin; - if ($function = ctools_plugin_get_function($plugin, 'default cache')) { - $function($cache); - } - - return $cache; -} - -/** - * Store changes to a task handler in the object cache. - */ -function page_manager_set_wizard_cache($cache) { - ctools_include('object-cache'); - ctools_object_cache_set('page_manager_page_wizard', $cache->plugin['name'], $cache); -} - -/** - * Remove an item from the object cache. - */ -function page_manager_clear_wizard_cache($name) { - ctools_include('object-cache'); - ctools_object_cache_clear('page_manager_page_wizard', $name); -} - -/** - * Menu callback for the page wizard. - */ -function page_manager_page_wizard($name, $step = NULL) { - $plugin = page_manager_get_page_wizard($name); - if (!$plugin) { - return MENU_NOT_FOUND; - } - - // Check for simple access string on plugin. - if (!empty($plugin['access']) && !user_access($plugin['access'])) { - return MENU_ACCESS_DENIED; - } - - // Check for possibly more complex access callback on plugin. - if (($function = ctools_plugin_get_function($plugin, 'access callback')) && !$function($plugin)) { - return MENU_ACCESS_DENIED; - } - - // Create a basic wizard.in form info array and merge it with the - // plugin's. - $form_info = array( - 'id' => 'page_manager_page_wizard', - 'show trail' => TRUE, - 'show back' => TRUE, - 'show return' => FALSE, - 'show cancel' => FALSE, - 'next callback' => 'page_manager_page_wizard_next', - 'finish callback' => 'page_manager_page_wizard_finish', - - 'path' => "admin/structure/pages/wizard/$name/%step", - ); - - $form_info = array_merge_recursive($form_info, $plugin['form info']); - - // If step is unset, go with the basic step. - if (!isset($step)) { - $step = current(array_keys($form_info['order'])); - $cache = page_manager_make_wizard_cache($plugin); - } - else { - $cache = page_manager_get_wizard_cache($plugin); - } - - ctools_include('wizard'); - $form_state = array( - 'plugin' => $plugin, - 'wizard cache' => $cache, - 'type' => 'edit', - 'rerender' => TRUE, - 'step' => $step, - ); - - if (isset($plugin['page title'])) { - drupal_set_title($plugin['page title']); - } - - if ($function = ctools_plugin_get_function($form_state['plugin'], 'start')) { - $function($form_info, $step, $form_state); - } - - $output = ctools_wizard_multistep_form($form_info, $step, $form_state); - return $output; -} - -/** - * Callback generated when the add page process is finished. - */ -function page_manager_page_wizard_finish(&$form_state) { - if ($function = ctools_plugin_get_function($form_state['plugin'], 'finish')) { - $function($form_state); - } - - page_manager_clear_wizard_cache($form_state['wizard cache']->plugin['name']); -} - -/** - * Callback generated when the 'next' button is clicked. - * - * All we do here is store the cache. - */ -function page_manager_page_wizard_next(&$form_state) { - if ($function = ctools_plugin_get_function($form_state['plugin'], 'next')) { - $function($form_state); - } - - page_manager_set_wizard_cache($form_state['wizard cache']); -} - -/** - * Provide a simple administrative list of all wizards. - * - * This is called as a page callback, but can also be used by any module - * that wants to get a list of wizards for its type. - */ -function page_manager_page_wizard_list($type = NULL) { - $plugins = page_manager_get_page_wizards(); - if (empty($plugins)) { - return '

' . t('There are no wizards available at this time.') . '

'; - } - - uasort($plugins, 'ctools_plugin_sort'); - - $output = '
'; - foreach ($plugins as $id => $plugin) { - if (!$type || (isset($plugin['type']) && $plugin['type'] == $type)) { - $output .= '
' . l($plugin['title'], 'admin/structure/pages/wizard/' . $id) . '
'; - $output .= '
' . $plugin['description'] . '
'; - } - } - $output .= '
'; - - return $output; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/page-wizard.menu.inc b/html/sites/all/modules/contrib/ctools/includes/page-wizard.menu.inc deleted file mode 100644 index 7ed932ed1..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/page-wizard.menu.inc +++ /dev/null @@ -1,32 +0,0 @@ - array('use page manager'), - 'file' => 'includes/page-wizard.inc', - 'type' => MENU_CALLBACK, - ); - - $items['admin/structure/pages/wizard'] = array( - 'title' => 'Wizards', - 'page callback' => 'page_manager_page_wizard_list', - 'page arguments' => array(4), - 'weight' => -5, - 'type' => MENU_LOCAL_TASK, - ) + $base; - - $items['admin/structure/pages/wizard/%'] = array( - 'title' => 'Wizard', - 'page callback' => 'page_manager_page_wizard', - 'page arguments' => array(4), - ) + $base; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/plugins-admin.inc b/html/sites/all/modules/contrib/ctools/includes/plugins-admin.inc deleted file mode 100644 index c11fcfd68..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/plugins-admin.inc +++ /dev/null @@ -1,209 +0,0 @@ - TRUE and - * 'modal return' => TRUE should make this system work well in the modal. - * - * In addition to standard wizard fields, this supports one extra field: - * - 'default form': A callback to a 'wrapper' that will be applied to either - * the first or a marked form. This is useful for adding global features that - * are applicable to all instances of a plugin, such as identifiers, or - * contexts, or the like. - * - * @param array &$form_state - * This is a standard form state array. This system imposes some requirements - * on what will be in the form state: - * - * - 'plugin': The plugin definition being edited. - * - 'conf': The configuration that is being edited, presumed to be an array. - * Ultimately at the end, this is where the modified config will be - * found. - * - 'op': The operation, either 'add' or 'edit'. This is used to derive form - * names and can also be used to derive default values from the plugin. - * - 'step': The current step. May be null if it is the 'first' step, but - * generally needs to be defined in the path. - * - * @param string $default_form - * An optional default form that can be added. - * - * @return - * If this function returns false, no form exists. - */ -function ctools_plugin_configure_form($form_info, &$form_state) { - // Turn the forms defined in the plugin into the format the wizard needs. - _ctools_plugin_configure_create_form_info($form_info, $form_state['plugin'], $form_state['op']); - - if (empty($form_info['order'])) { - return FALSE; - } - - ctools_include('wizard'); - return ctools_wizard_multistep_form($form_info, $form_state['step'], $form_state); -} - -function _ctools_plugin_configure_create_form_info(&$form_info, $plugin_definition, $op) { - // Provide a few extra defaults. - $form_info += array( - 'id' => 'ctools_plugin_configure_form', - 'show back' => TRUE, - ); - - $add_form = isset($form_info['add form name']) ? $form_info['add form name'] : 'add form'; - $edit_form = isset($form_info['edit form name']) ? $form_info['edit form name'] : 'edit form'; - - // Figure out what the forms should actually be. Since they can be specified - // in a couple of different ways (in order to support simple declarations for - // the minimal forms but more complex declarations for powerful wizards). - if ($op == 'add') { - if (!empty($plugin_definition[$add_form])) { - $info = $plugin_definition[$add_form]; - } - } - if (!isset($info) || $op == 'edit') { - // Use the edit form for the add form if add form was completely left off. - if (!empty($plugin_definition[$edit_form])) { - $info = $plugin_definition[$edit_form]; - } - } - - // If there is a default form wrapper, but no form is supplied, - // use the wrapper as the form. - if (empty($info) && !empty($form_info['default form'])) { - $info = $form_info['default form']; - } - - // @todo we may want to make these titles more settable? - if (is_string($info)) { - if (empty($plugin_definition['title'])) { - $title = t('Configure'); - } - elseif ($op == 'add') { - $title = t('Configure new !plugin_title', array('!plugin_title' => $plugin_definition['title'])); - } - else { - $title = t('Configure !plugin_title', array('!plugin_title' => $plugin_definition['title'])); - } - if (empty($form_info['order'])) { - $form_info['order'] = array(); - } - $form_info['order']['form'] = $title; - - if (empty($form_info['forms'])) { - $form_info['forms'] = array(); - } - $form_info['forms']['form'] = array( - 'title' => $title, - 'form id' => $info, - ); - - // Add the default form if one is specified. - if (!empty($form_info['default form']) && $form_info['forms']['form']['form id'] != $form_info['default form']) { - $form_info['forms']['form']['wrapper'] = $form_info['default form']; - } - - // If no submit is supplied, supply the default submit which will do the - // most obvious task. - if (!function_exists($form_info['forms']['form']['form id'] . '_submit')) { - // Store the original wrapper so we can chain it. - if (!empty($form_info['forms']['form']['wrapper'])) { - $form_info['forms']['form']['original wrapper'] = $form_info['forms']['form']['wrapper']; - } - $form_info['forms']['form']['wrapper'] = 'ctools_plugins_default_form_wrapper'; - } - } - elseif (is_array($info)) { - if (empty($form_info['order'])) { - $form_info['order'] = array(); - } - if (empty($form_info['forms'])) { - $form_info['forms'] = array(); - } - $count = 0; - $base = 'step'; - $wrapper = NULL; - foreach ($info as $form_id => $title) { - $step = $base . ++$count; - if (empty($wrapper)) { - $wrapper = $step; - } - - if (is_array($title)) { - if (!empty($title['default'])) { - $wrapper = $step; - } - $title = $title['title']; - } - - $form_info['order'][$step] = $title; - $form_info['forms'][$step] = array( - 'title' => $title, - 'form id' => $form_id, - ); - } - if ($wrapper && !empty($form_info['default form'])) { - $form_info['forms'][$wrapper]['wrapper'] = $form_info['default form']; - } - } -} - -/** - * A wrapper to provide a default submit so that plugins don't have to duplicate - * a whole bunch of code to do what most of them want to do anyway. - */ -function ctools_plugins_default_form_wrapper($form, &$form_state) { - $form_info = &$form_state['form_info']; - $info = $form_info['forms'][$form_state['step']]; - - if (isset($info['original wrapper']) && function_exists($info['original wrapper'])) { - $form = $info['original wrapper']($form, $form_state); - } - - if (isset($form['buttons']['next'])) { - if (empty($form['buttons']['next']['#submit'])) { - $form['buttons']['next']['#submit'] = $form['#submit']; - } - $form['buttons']['next']['#submit'][] = 'ctools_plugins_default_form_wrapper_submit'; - } - if (isset($form['buttons']['return'])) { - if (empty($form['buttons']['return']['#submit'])) { - $form['buttons']['return']['#submit'] = $form['#submit']; - } - $form['buttons']['return']['#submit'][] = 'ctools_plugins_default_form_wrapper_submit'; - } - return $form; -} - -/** - * Provide a default storage mechanism. - */ -function ctools_plugins_default_form_wrapper_submit(&$form, &$form_state) { - foreach (array_keys($form_state['plugin']['defaults']) as $key) { - if (isset($form_state['values'][$key])) { - $form_state['conf'][$key] = $form_state['values'][$key]; - } - } -} diff --git a/html/sites/all/modules/contrib/ctools/includes/plugins.inc b/html/sites/all/modules/contrib/ctools/includes/plugins.inc deleted file mode 100644 index ba4721b93..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/plugins.inc +++ /dev/null @@ -1,945 +0,0 @@ -=') - && version_compare($version, $current_version, '<='))) { - if (!isset($info['path'])) { - $info['path'] = drupal_get_path('module', $module); - } - $cache[$owner][$api][$module] = $info; - } - } - - // And allow themes to implement these as well. - $themes = _ctools_list_themes(); - foreach ($themes as $name => $theme) { - if (!empty($theme->info['api'][$owner][$api])) { - $info = $theme->info['api'][$owner][$api]; - if (!isset($info['version'])) { - continue; - } - - // Only process if version is between minimum and current, inclusive. - if (version_compare($info['version'], $minimum_version, '>=') && version_compare($info['version'], $current_version, '<=')) { - if (!isset($info['path'])) { - $info['path'] = ''; - } - // Because themes can't easily specify full path, we add it here - // even though we do not for modules: - $info['path'] = drupal_get_path('theme', $name) . '/' . $info['path']; - $cache[$owner][$api][$name] = $info; - } - } - } - - // Allow other modules to hook in. - drupal_alter($hook, $cache[$owner][$api], $owner, $api); - } - - return $cache[$owner][$api]; -} - -/** - * Load a group of API files. - * - * This will ask each module if they support the given API, and if they do - * it will load the specified file name. The API and the file name - * coincide by design. - * - * @param $owner - * The name of the module that controls the API. - * @param $api - * The name of the api. The api name forms the file name: - * $module.$api.inc, though this can be overridden by the module's response. - * @param $minimum_version - * The lowest version API that is compatible with this one. If a module - * reports its API as older than this, its files will not be loaded. This - * should never change during operation. - * @param $current_version - * The current version of the api. If a module reports its minimum API as - * higher than this, its files will not be loaded. This should never change - * during operation. - * - * @return - * The API information, in case you need it. - */ -function ctools_plugin_api_include($owner, $api, $minimum_version, $current_version) { - static $already_done = array(); - - $info = ctools_plugin_api_info($owner, $api, $minimum_version, $current_version); - foreach ($info as $module => $plugin_info) { - if (!isset($already_done[$owner][$api][$module])) { - if (isset($plugin_info["$api file"])) { - $file = $plugin_info["$api file"]; - } - elseif (isset($plugin_info['file'])) { - $file = $plugin_info['file']; - } - else { - $file = "$module.$api.inc"; - } - - if (file_exists(DRUPAL_ROOT . "/$plugin_info[path]/$file")) { - require_once DRUPAL_ROOT . "/$plugin_info[path]/$file"; - } - elseif (file_exists(DRUPAL_ROOT . "/$file")) { - require_once DRUPAL_ROOT . "/$file"; - } - $already_done[$owner][$api][$module] = TRUE; - } - } - - return $info; -} - -/** - * Find out what hook to use to determine if modules support an API. - * - * By default, most APIs will use hook_ctools_plugin_api, but some modules - * want sole ownership. This technique lets modules define what hook - * to use. - */ -function ctools_plugin_api_get_hook($owner, $api) { - // Allow modules to use their own hook for this. The only easy way to do - // this right now is with a magically named function. - if (function_exists($function = $owner . '_' . $api . '_hook_name')) { - $hook = $function(); - } - elseif (function_exists($function = $owner . '_ctools_plugin_api_hook_name')) { - $hook = $function(); - } - - // Do this last so that if the $function above failed to return, we have a - // sane default. - if (empty($hook)) { - $hook = 'ctools_plugin_api'; - } - - return $hook; -} - -/** - * Fetch a group of plugins by name. - * - * @param string $module - * The name of the module that utilizes this plugin system. It will be used to - * get more data about the plugin as defined on hook_ctools_plugin_type(). - * @param string $type - * The type identifier of the plugin. - * @param string $id - * If specified, return only information about plugin with this identifier. - * The system will do its utmost to load only plugins with this id. - * - * @return array - * An array of information arrays about the plugins received. The contents of - * the array are specific to the plugin. - */ -function ctools_get_plugins($module, $type, $id = NULL) { - // Store local caches of plugins and plugin info so we don't have to do full - // lookups every time. - static $drupal_static_fast; - if (!isset($drupal_static_fast)) { - $drupal_static_fast['plugins'] = &drupal_static('ctools_plugins', array()); - } - $plugins = &$drupal_static_fast['plugins']; - - $info = ctools_plugin_get_plugin_type_info(); - - if (!isset($info[$module][$type])) { - // If we don't find the plugin we attempt a cache rebuild before bailing out. - $info = ctools_plugin_get_plugin_type_info(TRUE); - // Bail out noisily if an invalid module/type combination is requested. - if (!isset($info[$module][$type])) { - watchdog('ctools', 'Invalid plugin module/type combination requested: module @module and type @type', array('@module' => $module, '@type' => $type), WATCHDOG_ERROR); - return array(); - } - } - - // Make sure our plugins array is populated. - if (!isset($plugins[$module][$type])) { - $plugins[$module][$type] = array(); - } - - // Attempt to shortcut this whole piece of code if we already have the - // requested plugin: - if ($id && array_key_exists($id, $plugins[$module][$type])) { - return $plugins[$module][$type][$id]; - } - - // Store the status of plugin loading. If a module plugin type pair is true, - // then it is fully loaded and no searching or setup needs to be done. - $setup = &drupal_static('ctools_plugin_setup', array()); - - // We assume we don't need to build a cache. - $build_cache = FALSE; - - // If the plugin info says this can be cached, check cache first. - if ($info[$module][$type]['cache'] && empty($setup[$module][$type])) { - $cache = cache_get("plugins:$module:$type", $info[$module][$type]['cache table']); - - if (!empty($cache->data)) { - // Cache load succeeded so use the cached plugin list. - $plugins[$module][$type] = $cache->data; - // Set $setup to true so we know things where loaded. - $setup[$module][$type] = TRUE; - } - else { - // Cache load failed so store that we need to build and write the cache. - $build_cache = TRUE; - } - } - - // Always load all hooks if we need them. Note we only need them now if the - // plugin asks for them. We can assume that if we have plugins we've already - // called the global hook. - if (!empty($info[$module][$type]['use hooks']) && empty($plugins[$module][$type])) { - $plugins[$module][$type] = ctools_plugin_load_hooks($info[$module][$type]); - } - - // Then see if we should load all files. We only do this if we want a list of - // all plugins or there was a cache miss. - if (empty($setup[$module][$type]) && ($build_cache || !$id)) { - $setup[$module][$type] = TRUE; - $plugins[$module][$type] = array_merge($plugins[$module][$type], ctools_plugin_load_includes($info[$module][$type])); - // If the plugin can have child plugins, and we're loading all plugins, - // go through the list of plugins we have and find child plugins. - if (!$id && !empty($info[$module][$type]['child plugins'])) { - // If a plugin supports children, go through each plugin and ask. - $temp = array(); - foreach ($plugins[$module][$type] as $name => $plugin) { - // The strpos ensures that we don't try to find children for plugins - // that are already children. - if (!empty($plugin['get children']) && function_exists($plugin['get children']) && strpos($name, ':') === FALSE) { - $temp = array_merge($plugin['get children']($plugin, $name), $temp); - } - else { - $temp[$name] = $plugin; - } - } - $plugins[$module][$type] = $temp; - } - } - - // If we were told earlier that this is cacheable and the cache was empty, - // give something back. - if ($build_cache) { - cache_set("plugins:$module:$type", $plugins[$module][$type], $info[$module][$type]['cache table']); - } - - // If no id was requested, we are finished here: - if (!$id) { - // Use array_filter because looking for unknown plugins could cause NULL - // entries to appear in the list later. - return array_filter($plugins[$module][$type]); - } - - // Check to see if we need to look for the file. - if (!array_key_exists($id, $plugins[$module][$type])) { - // If we can have child plugins, check to see if the plugin name is in the - // format of parent:child and break it up if it is. - if (!empty($info[$module][$type]['child plugins']) && strpos($id, ':') !== FALSE) { - list($parent, $child) = explode(':', $id, 2); - } - else { - $parent = $id; - } - - if (!array_key_exists($parent, $plugins[$module][$type])) { - $result = ctools_plugin_load_includes($info[$module][$type], $parent); - // Set to either what was returned or NULL. - $plugins[$module][$type][$parent] = isset($result[$parent]) ? $result[$parent] : NULL; - } - - // If we are looking for a child, and have the parent, ask the parent for the child. - if (!empty($child) && !empty($plugins[$module][$type][$parent]) && function_exists($plugins[$module][$type][$parent]['get child'])) { - $plugins[$module][$type][$id] = $plugins[$module][$type][$parent]['get child']($plugins[$module][$type][$parent], $parent, $child); - } - } - - // At this point we should either have the plugin, or a NULL. - return $plugins[$module][$type][$id]; -} - -/** - * Return the full list of plugin type info for all plugin types registered in - * the current system. - * - * This function manages its own cache getting/setting, and should always be - * used as the way to initially populate the list of plugin types. Make sure you - * call this function to properly populate the ctools_plugin_type_info static - * variable. - * - * @return array - * A multilevel array of plugin type info, the outer array keyed on module - * name and each inner array keyed on plugin type name. - */ -function ctools_plugin_get_plugin_type_info($flush = FALSE) { - static $drupal_static_fast; - if (!isset($drupal_static_fast)) { - $drupal_static_fast['info_loaded'] = &drupal_static('ctools_plugin_type_info_loaded', FALSE); - $drupal_static_fast['all_type_info'] = &drupal_static('ctools_plugin_type_info', array()); - } - $info_loaded = &$drupal_static_fast['info_loaded']; - $all_type_info = &$drupal_static_fast['all_type_info']; - - // Only trigger info loading once. - if ($info_loaded && !$flush) { - return $all_type_info; - } - $info_loaded = TRUE; - - $cache = cache_get('ctools_plugin_type_info'); - if (!empty($cache->data) && !$flush) { - // Plugin type info cache is warm, use it. - $all_type_info = $cache->data; - } - else { - // Cache expired, refill it. - foreach (module_implements('ctools_plugin_type') as $module) { - $module_infos = array(); - $function = $module . '_ctools_plugin_type'; - $module_infos = $function(); - - foreach ($module_infos as $plugin_type_name => $plugin_type_info) { - // Apply defaults. Array addition will not overwrite pre-existing keys. - $plugin_type_info += array( - 'module' => $module, - 'type' => $plugin_type_name, - 'cache' => FALSE, - 'cache table' => 'cache', - 'classes' => array(), - 'use hooks' => FALSE, - 'defaults' => array(), - 'process' => '', - 'alterable' => TRUE, - 'extension' => 'inc', - 'info file' => FALSE, - 'hook' => $module . '_' . $plugin_type_name, - 'load themes' => FALSE, - ); - $all_type_info[$module][$plugin_type_name] = $plugin_type_info; - } - } - cache_set('ctools_plugin_type_info', $all_type_info); - } - - return $all_type_info; -} - -/** - * Reset all static caches that affect the result of ctools_get_plugins(). - */ -function ctools_get_plugins_reset() { - drupal_static_reset('ctools_plugins'); - drupal_static_reset('ctools_plugin_setup'); - drupal_static_reset('ctools_plugin_load_includes'); - drupal_static_reset('ctools_plugin_api_info'); -} - -/** - * Load plugins from a directory. - * - * @param array $info - * The plugin info as returned by ctools_plugin_get_info() - * @param string $filename - * The file to load if we're looking for just one particular plugin. - * - * @return array - * A (possibly empty) array of information created for this plugin. - */ -function ctools_plugin_load_includes($info, $filename = NULL) { - // Keep a static array so we don't hit file_scan_directory more than necessary. - $all_files = &drupal_static(__FUNCTION__, array()); - - // Store static of plugin arrays for reference because they can't be - // reincluded, so there is no point in using drupal_static(). - static $plugin_arrays = array(); - - if (!isset($all_files[$info['module']][$info['type']])) { - $cache = cache_get("ctools_plugin_files:$info[module]:$info[type]"); - if ($cache) { - $all_files[$info['module']][$info['type']] = $cache->data; - } - // Do not attempt any file scan even if the cached entry was empty. - // A NULL entry here would mean the plugin just does not exists, and we - // cannot afford to run file scan on production sites normal run. - elseif (!isset($all_files[$info['module']][$info['type']])) { - $all_files[$info['module']][$info['type']] = array(); - // Load all our plugins. - $directories = ctools_plugin_get_directories($info); - $extension = (empty($info['info file']) || ($info['extension'] != 'inc')) ? $info['extension'] : 'info'; - - foreach ($directories as $module => $path) { - $all_files[$info['module']][$info['type']][$module] = file_scan_directory($path, '/\.' . $extension . '$/', array('key' => 'name')); - } - - cache_set("ctools_plugin_files:$info[module]:$info[type]", $all_files[$info['module']][$info['type']]); - } - } - $file_list = $all_files[$info['module']][$info['type']]; - $plugins = array(); - - // Iterate through all the plugin .inc files, load them and process the hook - // that should now be available. - foreach (array_filter($file_list) as $module => $files) { - if ($filename) { - $files = isset($files[$filename]) ? array($filename => $files[$filename]) : array(); - } - foreach ($files as $file) { - if (!empty($info['info file'])) { - // Parse a .info file. - $result = ctools_plugin_process_info($info, $module, $file); - } - else { - // Parse a hook. - // Ensure that we don't have something leftover from earlier. - $plugin = NULL; - - if (isset($plugin_arrays[$file->uri])) { - $identifier = $plugin_arrays[$file->uri]; - } - else { - include_once DRUPAL_ROOT . '/' . $file->uri; - // .inc files have a special format for the hook identifier. - // For example, 'foo.inc' in the module 'mogul' using the plugin - // whose hook is named 'borg_type' should have a function named - // (deep breath) mogul_foo_borg_type(). - // If, however, the .inc file set the quasi-global $plugin array, we - // can use that and not even call a function. Set the $identifier - // appropriately and ctools_plugin_process() will handle it. - if (isset($plugin)) { - $plugin_arrays[$file->uri] = $plugin; - $identifier = $plugin; - } - else { - $identifier = $module . '_' . $file->name; - } - } - - $result = ctools_plugin_process($info, $module, $identifier, - dirname($file->uri), basename($file->uri), $file->name); - } - if (is_array($result)) { - $plugins = array_merge($plugins, $result); - } - } - } - return $plugins; -} - -/** - * Get a list of directories to search for plugins of the given type. - * - * This utilizes hook_ctools_plugin_directory() to determine a complete list of - * directories. Only modules that implement this hook and return a string - * value will have their directories included. - * - * @param $info - * The $info array for the plugin as returned by ctools_plugin_get_info(). - * - * @return array - * An array of directories to search. - */ -function ctools_plugin_get_directories($info) { - $directories = array(); - - foreach (module_implements('ctools_plugin_directory') as $module) { - $function = $module . '_ctools_plugin_directory'; - $result = $function($info['module'], $info['type']); - if ($result && is_string($result)) { - $directories[$module] = drupal_get_path('module', $module) . '/' . $result; - } - } - - if (!empty($info['load themes'])) { - $themes = _ctools_list_themes(); - foreach ($themes as $name => $theme) { - if (!empty($theme->info['plugins'][$info['module']][$info['type']])) { - $directories[$name] = drupal_get_path('theme', $name) . '/' . $theme->info['plugins'][$info['module']][$info['type']]; - } - } - } - return $directories; -} - -/** - * Helper to build a ctools-friendly list of themes capable of providing plugins. - * - * @return array - * A list of themes that can act as plugin providers, sorted parent-first with - * the active theme placed last. - */ -function _ctools_list_themes() { - static $themes; - if (is_null($themes)) { - $current = variable_get('theme_default', FALSE); - $themes = $active = array(); - $all_themes = list_themes(); - foreach ($all_themes as $name => $theme) { - // Only search from active themes. - if (empty($theme->status) && $theme->name != $current) { - continue; - } - $active[$name] = $theme; - // Prior to drupal 6.14, $theme->base_themes does not exist. Build it. - if (!isset($theme->base_themes) && !empty($theme->base_theme)) { - $active[$name]->base_themes = ctools_find_base_themes($all_themes, $name); - } - } - - // Construct a parent-first list of all themes. - foreach ($active as $name => $theme) { - $base_themes = isset($theme->base_themes) ? $theme->base_themes : array(); - $themes = array_merge($themes, $base_themes, array($name => $theme->info['name'])); - } - // Put the actual theme info objects into the array. - foreach (array_keys($themes) as $name) { - if (isset($all_themes[$name])) { - $themes[$name] = $all_themes[$name]; - } - } - - // Make sure the current default theme always gets the last word. - if ($current_key = array_search($current, array_keys($themes))) { - $themes += array_splice($themes, $current_key, 1); - } - } - return $themes; -} - -/** - * Find all the base themes for the specified theme. - * - * Themes can inherit templates and function implementations from earlier themes. - * - * NOTE: this is a verbatim copy of system_find_base_themes(), which was not - * implemented until 6.14. It is included here only as a fallback for outdated - * versions of drupal core. - * - * @param $themes - * An array of available themes. - * @param $key - * The name of the theme whose base we are looking for. - * @param $used_keys - * A recursion parameter preventing endless loops. - * - * @return array - * Returns an array of all of the theme's ancestors; the first element's value - * will be NULL if an error occurred. (Note: this is NOT $arr[0]). - */ -function ctools_find_base_themes($themes, $key, $used_keys = array()) { - $base_key = $themes[$key]->info['base theme']; - // Does the base theme exist? - if (!isset($themes[$base_key])) { - return array($base_key => NULL); - } - - $current_base_theme = array($base_key => $themes[$base_key]->info['name']); - - // Is the base theme itself a child of another theme? - if (isset($themes[$base_key]->info['base theme'])) { - // Do we already know the base themes of this theme? - if (isset($themes[$base_key]->base_themes)) { - return $themes[$base_key]->base_themes + $current_base_theme; - } - // Prevent loops. - if (!empty($used_keys[$base_key])) { - return array($base_key => NULL); - } - $used_keys[$base_key] = TRUE; - return ctools_find_base_themes($themes, $base_key, $used_keys) + $current_base_theme; - } - // If we get here, then this is our parent theme. - return $current_base_theme; -} - -/** - * Load plugin info for the provided hook; this is handled separately from - * plugins from files. - * - * @param $info - * The info array about the plugin as created by ctools_plugin_get_info() - * - * @return - * An array of info supplied by any hook implementations. - */ -function ctools_plugin_load_hooks($info) { - $hooks = array(); - foreach (module_implements($info['hook']) as $module) { - $result = ctools_plugin_process($info, $module, $module, drupal_get_path('module', $module)); - if (is_array($result)) { - $hooks = array_merge($hooks, $result); - } - } - return $hooks; -} - -/** - * Process a single hook implementation of a ctools plugin. - * - * @param array $info - * The $info array about the plugin as returned by ctools_plugin_get_info() - * @param string $module - * The module that implements the plugin being processed. - * @param string|array $identifier - * Used to create the base setting of return value. If: - * - $identifier is a string, a hook name is created from this and the 'hook' - * key of the $info array, and the return value of that hook function is - * used. The hook is called like this: $identifier_$hook($info); - * - $identifier is an array, this array is used directly. - * @param string $path - * The path where files utilized by this plugin will be found. - * @param string $file - * The file that was loaded for this plugin, if it exists. - * @param string $base - * The base plugin name to use. If a file was loaded for the plugin, this - * is the plugin to assume must be present. This is used to automatically - * translate the array to make the syntax more friendly to plugin - * implementors. - * - * @return null|array - * NULL on failure, otherwise an array containing the results keyed by name. - */ -function ctools_plugin_process($info, $module, $identifier, $path, $file = NULL, $base = NULL) { - if (is_array($identifier)) { - $result = $identifier; - } - else { - $function = $identifier . '_' . $info['hook']; - if (!function_exists($function)) { - return NULL; - } - $result = $function($info); - if (!isset($result) || !is_array($result)) { - return NULL; - } - } - - // Automatically convert to the proper format that lets plugin implementations - // not nest arrays as deeply as they used to, but still support the older - // format where they do: - if ($base && (!isset($result[$base]) || !is_array($result[$base]))) { - $result = array($base => $result); - } - - return _ctools_process_data($result, $info, $module, $path, $file); -} - -/** - * Fill in default values and run hooks for data loaded for one or - * more plugins. - */ -function _ctools_process_data($result, $plugin_type_info, $module, $path, $file) { - // Fill in global defaults. - foreach ($result as $name => $plugin) { - $result[$name] += array( - 'module' => $module, - 'name' => $name, - 'path' => $path, - 'file' => $file, - 'plugin module' => $plugin_type_info['module'], - 'plugin type' => $plugin_type_info['type'], - ); - - // Fill in plugin-specific defaults, if they exist. - if (!empty($plugin_type_info['defaults'])) { - if (is_array($plugin_type_info['defaults'])) { - $result[$name] += $plugin_type_info['defaults']; - } - } - - // Allow the plugin to be altered before processing. - if (!empty($plugin_type_info['alterable']) && $plugin_type_info['alterable']) { - drupal_alter('ctools_plugin_pre', $result[$name], $plugin_type_info); - } - - // Allow the plugin owner to do additional processing. - if (!empty($plugin_type_info['process']) && $function = ctools_plugin_get_function($plugin_type_info, 'process')) { - $function($result[$name], $plugin_type_info); - } - - // Allow the plugin to be altered after processing. - if (!empty($plugin_type_info['alterable']) && $plugin_type_info['alterable']) { - drupal_alter('ctools_plugin_post', $result[$name], $plugin_type_info); - } - } - return $result; -} - -/** - * Process an info file for plugin information, rather than a hook. - * - * @param array $info - * The $info array about the plugin as returned by ctools_plugin_get_info() - * @param string $module - * The module that implements the plugin being processed. - * @param object $file - * An object containing 'uri' and 'name' properties. 'uri' is the name of the - * 'info' file to process. 'name' is the plugin key-name. - * - * @return null|array - * NULL on failure, otherwise an array containing the results keyed by name. - */ -function ctools_plugin_process_info($info, $module, $file) { - $result = drupal_parse_info_file($file->uri); - if ($result) { - $result = array($file->name => $result); - return _ctools_process_data($result, $info, $module, dirname($file->uri), basename($file->uri)); - } -} - -/** - * Ask a module for info about a particular plugin type. - */ -function ctools_plugin_get_info($module, $type) { - $all_info = ctools_plugin_get_plugin_type_info(); - return isset($all_info[$module][$type]) ? $all_info[$module][$type] : array(); -} - -/** - * Get a function from a plugin, if it exists. If the plugin is not already - * loaded, try ctools_plugin_load_function() instead. - * - * @param $plugin_definition - * The loaded plugin type. - * @param $function_name - * The identifier of the function. For example, 'settings form'. - * - * @return string - * The actual name of the function to call, or NULL if the function - * does not exist. - */ -function ctools_plugin_get_function($plugin_definition, $function_name) { - // If cached the .inc file may not have been loaded. require_once is quite safe - // and fast so it's okay to keep calling it. - if (isset($plugin_definition['file'])) { - // Plugins that are loaded from info files have the info file as - // $plugin['file']. Don't try to run those. - $info = ctools_plugin_get_info($plugin_definition['plugin module'], $plugin_definition['plugin type']); - if (empty($info['info file'])) { - require_once DRUPAL_ROOT . '/' . $plugin_definition['path'] . '/' . $plugin_definition['file']; - } - } - - if (!isset($plugin_definition[$function_name])) { - return NULL; - } - - if (is_array($plugin_definition[$function_name]) && isset($plugin_definition[$function_name]['function'])) { - $function = $plugin_definition[$function_name]['function']; - if (isset($plugin_definition[$function_name]['file'])) { - $file = $plugin_definition[$function_name]['file']; - if (isset($plugin_definition[$function_name]['path'])) { - $file = $plugin_definition[$function_name]['path'] . '/' . $file; - } - require_once DRUPAL_ROOT . '/' . $file; - } - } - else { - $function = $plugin_definition[$function_name]; - } - - if (function_exists($function)) { - return $function; - } -} - -/** - * Load a plugin and get a function name from it, returning success only - * if the function exists. - * - * @param $module - * The module that owns the plugin type. - * @param $type - * The type of plugin. - * @param $id - * The id of the specific plugin to load. - * @param $function_name - * The identifier of the function. For example, 'settings form'. - * - * @return string - * The actual name of the function to call, or NULL if the function - * does not exist. - */ -function ctools_plugin_load_function($module, $type, $id, $function_name) { - $plugin = ctools_get_plugins($module, $type, $id); - return ctools_plugin_get_function($plugin, $function_name); -} - -/** - * Get a class from a plugin, if it exists. If the plugin is not already - * loaded, try ctools_plugin_load_class() instead. - * - * @param $plugin_definition - * The loaded plugin type. - * @param $class_name - * The identifier of the class. For example, 'handler'. - * - * @return string - * The actual name of the class to call, or NULL if the class does not exist. - */ -function ctools_plugin_get_class($plugin_definition, $class_name) { - // If cached the .inc file may not have been loaded. require_once is quite safe - // and fast so it's okay to keep calling it. - if (isset($plugin_definition['file'])) { - // Plugins that are loaded from info files have the info file as - // $plugin['file']. Don't try to run those. - $info = ctools_plugin_get_info($plugin_definition['plugin module'], $plugin_definition['plugin type']); - if (empty($info['info file'])) { - require_once DRUPAL_ROOT . '/' . $plugin_definition['path'] . '/' . $plugin_definition['file']; - } - } - - $return = FALSE; - if (!isset($plugin_definition[$class_name])) { - return; - } - elseif (is_string($plugin_definition[$class_name])) { - // Plugin uses the string form shorthand. - $return = $plugin_definition[$class_name]; - } - elseif (isset($plugin_definition[$class_name]['class'])) { - // Plugin uses the verbose array form. - $return = $plugin_definition[$class_name]['class']; - } - // @todo consider adding an else {watchdog(...)} here - - if ($return && !class_exists($return)) { - // The class might not have been registered yet by the registry. This can - // happen for example in edge cases such as testing installation profiles - // in simpleTest, where the static caching of ctools_get_plugins() might - // not be cleared properly. - $filename = isset($plugin_definition[$class_name]['file']) ? $plugin_definition[$class_name]['file'] : $return . '.class.php'; - $base_path = isset($plugin_definition[$class_name]['path']) ? $plugin_definition[$class_name]['path'] : $plugin_definition['path']; - $path = "$base_path/$filename"; - require_once DRUPAL_ROOT . '/' . $path; - } - - return ($return && class_exists($return)) ? $return : NULL; -} - -/** - * Load a plugin and get a class name from it, returning success only if the - * class exists. - * - * @param $module - * The module that owns the plugin type. - * @param $type - * The type of plugin. - * @param $id - * The id of the specific plugin to load. - * @param $class_name - * The identifier of the class. For example, 'handler'. - * - * @return string - * The actual name of the class to call, or NULL if the class does not exist. - */ -function ctools_plugin_load_class($module, $type, $id, $class_name) { - $plugin = ctools_get_plugins($module, $type, $id); - return ctools_plugin_get_class($plugin, $class_name); -} - -/** - * Sort callback for sorting plugins naturally. - * - * Sort first by weight, then by title. - */ -function ctools_plugin_sort($a, $b) { - if (is_object($a)) { - $a = (array) $a; - } - if (is_object($b)) { - $b = (array) $b; - } - - if (empty($a['weight'])) { - $a['weight'] = 0; - } - - if (empty($b['weight'])) { - $b['weight'] = 0; - } - - if ($a['weight'] == $b['weight']) { - return strnatcmp(strtolower($a['title']), strtolower($b['title'])); - } - return ($a['weight'] < $b['weight']) ? -1 : 1; -} diff --git a/html/sites/all/modules/contrib/ctools/includes/registry.inc b/html/sites/all/modules/contrib/ctools/includes/registry.inc deleted file mode 100644 index 7e517bb98..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/registry.inc +++ /dev/null @@ -1,76 +0,0 @@ -name] = $module_object; - } - - $all_type_info = ctools_plugin_get_plugin_type_info(TRUE); - foreach ($all_type_info as $module => $plugin_types) { - foreach ($plugin_types as $plugin_type_name => $plugin_type_info) { - if (empty($plugin_type_info['classes'])) { - // This plugin type does not use classes, so skip it. - continue; - } - - // Retrieve the full list of plugins of this type. - $plugins = ctools_get_plugins($module, $plugin_type_name); - foreach ($plugins as $plugin_name => $plugin_definition) { - foreach ($plugin_type_info['classes'] as $class_key) { - if (empty($plugin_definition[$class_key])) { - // Plugin doesn't provide a class for this class key, so skip it. - continue; - } - - if (is_string($plugin_definition[$class_key])) { - // Plugin definition uses the shorthand for defining a class name - // and location; look for the containing file by following naming - // convention. - $path = $plugin_definition['path'] . '/' . $plugin_definition[$class_key] . '.class.php'; - } - else { - // Plugin uses the verbose definition to indicate where its class - // files are. - $class = $plugin_definition[$class_key]['class']; - // Use the filename if it's explicitly set, else follow the naming - // conventions. - $filename = isset($plugin_definition[$class_key]['file']) ? $plugin_definition[$class_key]['file'] : $class . '.class.php'; - $base_path = isset($plugin_definition[$class_key]['path']) ? $plugin_definition[$class_key]['path'] : $plugin_definition['path']; - $path = "$base_path/$filename"; - } - - if (file_exists($path)) { - // If the file exists, add it to the files for registry building. - $files[$path] = array('module' => $plugin_definition['module'], 'weight' => $modules[$plugin_definition['module']]->weight); - } - else { - // Else, watchdog that we've got some erroneous plugin info. - $args = array( - '@plugin' => $plugin_definition['name'], - '@owner' => $module, - '@type' => $plugin_type_name, - '@file' => $path, - '@class' => $class_key, - ); - watchdog('ctools', 'Plugin @plugin of plugin type @owner:@type points to nonexistent file @file for class handler @class.', $args); - } - } - } - } - } -} diff --git a/html/sites/all/modules/contrib/ctools/includes/stylizer.inc b/html/sites/all/modules/contrib/ctools/includes/stylizer.inc deleted file mode 100644 index 488a7f3ef..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/stylizer.inc +++ /dev/null @@ -1,1654 +0,0 @@ - theme('image', array('path' => $file)), 'title' => $title)); -} - -/** - * Theme the style icon image - */ -function theme_ctools_style_icon($vars) { - $image = $vars['image']; - ctools_add_css('stylizer'); - ctools_add_js('stylizer'); - $output = '
'; - $output .= $vars['image']; - if ($vars['title']) { - $output .= '
' . $vars['title'] . '
'; - } - $output .= '
'; - return $output; -} - -/** - * Add the necessary CSS for a stylizer plugin to the page. - * - * This will check to see if the images directory and the cached CSS - * exists and, if not, will regenerate everything needed. - */ -function ctools_stylizer_add_css($plugin, $settings) { - if (!file_exists(ctools_stylizer_get_image_path($plugin, $settings, FALSE))) { - ctools_stylizer_build_style($plugin, $settings, TRUE); - return; - } - - ctools_include('css'); - $filename = ctools_css_retrieve(ctools_stylizer_get_css_id($plugin, $settings)); - if (!$filename) { - ctools_stylizer_build_style($plugin, $settings, TRUE); - } - else { - drupal_add_css($filename); - } -} - -/** - * Build the files for a stylizer given the proper settings. - */ -function ctools_stylizer_build_style($plugin, $settings, $add_css = FALSE) { - $path = ctools_stylizer_get_image_path($plugin, $settings); - if (!$path) { - return; - } - - $replacements = array(); - - // Set up palette conversions - foreach ($settings['palette'] as $key => $color) { - $replacements['%' . $key ] = $color; - } - - // Process image actions: - if (!empty($plugin['actions'])) { - $processor = new ctools_stylizer_image_processor; - $processor->execute($path, $plugin, $settings); - -// @todo -- there needs to be an easier way to get at this. -// dsm($processor->message_log); - // Add filenames to our conversions. - } - - // Convert and write the CSS file. - $css = file_get_contents($plugin['path'] . '/' . $plugin['css']); - - // Replace %style keyword with our generated class name. - // @todo We need one more unique identifier I think. - $class = ctools_stylizer_get_css_class($plugin, $settings); - $replacements['%style'] = '.' . $class; - - if (!empty($processor) && !empty($processor->paths)) { - foreach ($processor->paths as $file => $image) { - $replacements[$file] = file_create_url($image); - } - } - - if (!empty($plugin['build']) && function_exists($plugin['build'])) { - $plugin['build']($plugin, $settings, $css, $replacements); - } - - $css = strtr($css, $replacements); - ctools_include('css'); - $filename = ctools_css_store(ctools_stylizer_get_css_id($plugin, $settings), $css, FALSE); - - if ($add_css) { - drupal_add_css($filename); - } -} - -/** - * Clean up no longer used files. - * - * To prevent excess clutter in the files directory, this should be called - * whenever a style is going out of use. When being deleted, but also when - * the palette is being changed. - */ -function ctools_stylizer_cleanup_style($plugin, $settings) { - ctools_include('css'); - $path = ctools_stylizer_get_image_path($plugin, $settings, FALSE); - if ($path) { - ctools_stylizer_recursive_delete($path); - } - - ctools_css_clear(ctools_stylizer_get_css_id($plugin, $settings)); -} - -/** - * Recursively delete all files and folders in the specified filepath, then - * delete the containing folder. - * - * Note that this only deletes visible files with write permission. - * - * @param string $path - * A filepath relative to file_directory_path. - */ -function ctools_stylizer_recursive_delete($path) { - if (empty($path)) { - return; - } - - $listing = $path . '/*'; - - foreach (glob($listing) as $file) { - if (is_file($file) === TRUE) { - @unlink($file); - } - elseif (is_dir($file) === TRUE) { - ctools_stylizer_recursive_delete($file); - } - } - - @rmdir($path); -} - -/** - * Get a safe name for the settings. - * - * This uses an md5 of the palette if the name is temporary so - * that multiple temporary styles on the same page can coexist - * safely. - */ -function ctools_stylizer_get_settings_name($settings) { - if ($settings['name'] != '_temporary') { - return $settings['name']; - } - - return $settings['name'] . '-' . md5(serialize($settings['palette'])); -} - -/** - * Get the path where images will be stored for a style plugin and settings. - * - * This function will make sure the path exists. - */ -function ctools_stylizer_get_image_path($plugin, $settings, $check = TRUE) { - $path = 'public://ctools/style/' . $settings['name'] . '/' . md5(serialize($settings['palette'])); - if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) { - drupal_set_message(t('Unable to create CTools styles cache directory @path. Check the permissions on your files directory.', array('@path' => $path)), 'error'); - return; - } - - return $path; -} - -/** - * Get the id used to cache CSS for a given style plugin and settings. - */ -function ctools_stylizer_get_css_id($plugin, $settings) { - return 'ctools-stylizer:' . $settings['name'] . ':' . md5(serialize($settings['palette'])); -} - -/** - * Get the class to use for a stylizer plugin. - */ -function ctools_stylizer_get_css_class($plugin, $settings) { - ctools_include('cleanstring'); - return ctools_cleanstring($plugin['name'] . '-' . ctools_stylizer_get_settings_name($settings)); -} - -class ctools_stylizer_image_processor { - var $workspace = NULL; - var $name = NULL; - - var $workspaces = array(); - - var $message_log = array(); - var $error_log = array(); - - function execute($path, $plugin, $settings) { - $this->path = $path; - $this->plugin = $plugin; - $this->settings = $settings; - $this->palette = $settings['palette']; - - if (is_string($plugin['actions']) && function_exists($plugin['actions'])) { - $actions = $plugin['actions']($plugin, $settings); - } - elseif (is_array($plugin['actions'])) { - $actions = $plugin['actions']; - } - - if (!empty($actions) && is_array($actions)) { - foreach ($plugin['actions'] as $action) { - $command = 'command_' . array_shift($action); - if (method_exists($this, $command)) { - call_user_func_array(array($this, $command), $action); - } - } - } - - // Clean up buffers. - foreach ($this->workspaces as $name => $workspace) { - imagedestroy($this->workspaces[$name]); - } - } - - function log($message, $type = 'normal') { - $this->message_log[] = $message; - if ($type == 'error') { - $this->error_log[] = $message; - } - } - - function set_current_workspace($workspace) { - $this->log("Set current workspace: $workspace"); - $this->workspace = &$this->workspaces[$workspace]; - $this->name = $workspace; - } - - /** - * Create a new workspace. - */ - function command_new($name, $width, $height) { - $this->log("New workspace: $name ($width x $height)"); - // Clean up if there was already a workspace there. - if (isset($this->workspaces[$name])) { - imagedestroy($this->workspaces[$name]); - } - - $this->workspaces[$name] = imagecreatetruecolor($width, $height); - $this->set_current_workspace($name); - - // Make sure the new workspace has a transparent color. - - // Turn off transparency blending (temporarily) - imagealphablending($this->workspace, FALSE); - - // Create a new transparent color for image - $color = imagecolorallocatealpha($this->workspace, 0, 0, 0, 127); - - // Completely fill the background of the new image with allocated color. - imagefill($this->workspace, 0, 0, $color); - - // Restore transparency blending - imagesavealpha($this->workspace, TRUE); - - } - - /** - * Create a new workspace a file. - * - * This will make the new workspace the current workspace. - */ - function command_load($name, $file) { - $this->log("New workspace: $name (from $file)"); - if (!file_exists($file)) { - // Try it relative to the plugin. - $file = $this->plugin['path'] . '/' . $file; - if (!file_exists($file)) { - $this->log("Unable to open $file"); - return; - } - } - - // Clean up if there was already a workspace there. - if (isset($this->workspaces[$name])) { - imagedestroy($this->workspaces[$name]); - } - - $this->workspaces[$name] = imagecreatefrompng($file); - $this->set_current_workspace($name); - } - - /** - * Create a new workspace using the properties of an existing workspace. - */ - function command_new_from($name, $workspace) { - $this->log("New workspace: $name from existing $workspace"); - if (empty($this->workspaces[$workspace])) { - $this->log("Workspace $name does not exist.", 'error'); - return; - } - - // Clean up if there was already a workspace there. - if (isset($this->workspaces[$name])) { - imagedestroy($this->workspaces[$name]); - } - - $this->workspaces[$name] = $this->new_image($this->workspace[$workspace]); - $this->set_current_workspace($name); - } - - /** - * Set the current workspace. - */ - function command_workspace($name) { - $this->log("Set workspace: $name"); - if (empty($this->workspaces[$name])) { - $this->log("Workspace $name does not exist.", 'error'); - return; - } - $this->set_current_workspace($name); - } - - /** - * Copy the contents of one workspace into the current workspace. - */ - function command_merge_from($workspace, $x = 0, $y = 0) { - $this->log("Merge from: $workspace ($x, $y)"); - if (empty($this->workspaces[$workspace])) { - $this->log("Workspace $workspace does not exist.", 'error'); - return; - } - - $this->merge($this->workspaces[$workspace], $this->workspace, $x, $y); - } - - function command_merge_to($workspace, $x = 0, $y = 0) { - $this->log("Merge to: $workspace ($x, $y)"); - if (empty($this->workspaces[$workspace])) { - $this->log("Workspace $workspace does not exist.", 'error'); - return; - } - - $this->merge($this->workspace, $this->workspaces[$workspace], $x, $y); - $this->set_current_workspace($workspace); - } - - /** - * Blend an image into the current workspace. - */ - function command_merge_from_file($file, $x = 0, $y = 0) { - $this->log("Merge from file: $file ($x, $y)"); - if (!file_exists($file)) { - // Try it relative to the plugin - $file = $this->plugin['path'] . '/' . $file; - if (!file_exists($file)) { - $this->log("Unable to open $file"); - return; - } - } - - $source = imagecreatefrompng($file); - - $this->merge($source, $this->workspace, $x, $y); - - imagedestroy($source); - } - - function command_fill($color, $x, $y, $width, $height) { - $this->log("Fill: $color ($x, $y, $width, $height)"); - imagefilledrectangle($this->workspace, $x, $y, $x + $width, $y + $height, _color_gd($this->workspace, $this->palette[$color])); - } - - function command_gradient($from, $to, $x, $y, $width, $height, $direction = 'down') { - $this->log("Gradient: $from to $to ($x, $y, $width, $height) $direction"); - - if ($direction == 'down') { - for ($i = 0; $i < $height; ++$i) { - $color = _color_blend($this->workspace, $this->palette[$from], $this->palette[$to], $i / ($height - 1)); - imagefilledrectangle($this->workspace, $x, $y + $i, $x + $width, $y + $i + 1, $color); - } - } - else { - for ($i = 0; $i < $width; ++$i) { - $color = _color_blend($this->workspace, $this->palette[$from], $this->palette[$to], $i / ($width - 1)); - imagefilledrectangle($this->workspace, $x + $i, $y, $x + $i + 1, $y + $height, $color); - } - } - } - - /** - * Colorize the current workspace with the given location. - * - * This uses simple color blending to colorize the image. - * - * @todo it is possible that this colorize could allow different methods for - * determining how to blend colors? - */ - function command_colorize($color, $x = NULL, $y = NULL, $width = NULL, $height = NULL) { - if (!isset($x)) { - $whole_image = TRUE; - $x = $y = 0; - $width = imagesx($this->workspace); - $height = imagesy($this->workspace); - } - $this->log("Colorize: $color ($x, $y, $width, $height)"); - - $c = _color_unpack($this->palette[$color]); - - imagealphablending($this->workspace, FALSE); - imagesavealpha($this->workspace, TRUE); - - // If PHP 5 use the nice imagefilter which is faster. - if (!empty($whole_image) && version_compare(phpversion(), '5.2.5', '>=') && function_exists('imagefilter')) { - imagefilter($this->workspace, IMG_FILTER_COLORIZE, $c[0], $c[1], $c[2]); - } - else { - // Otherwise we can do it the brute force way. - for ($j = 0; $j < $height; $j++) { - for ($i = 0; $i < $width; $i++) { - $current = imagecolorsforindex($this->workspace, imagecolorat($this->workspace, $i, $j)); - $new_index = imagecolorallocatealpha($this->workspace, $c[0], $c[1], $c[2], $current['alpha']); - imagesetpixel($this->workspace, $i, $j, $new_index); - } - } - } - } - - /** - * Colorize the current workspace with the given location. - * - * This uses a color replacement algorithm that retains luminosity but - * turns replaces all color with the specified color. - */ - function command_hue($color, $x = NULL, $y = NULL, $width = NULL, $height = NULL) { - if (!isset($x)) { - $whole_image = TRUE; - $x = $y = 0; - $width = imagesx($this->workspace); - $height = imagesy($this->workspace); - } - $this->log("Hue: $color ($x, $y, $width, $height)"); - - list($red, $green, $blue) = _color_unpack($this->palette[$color]); - - // We will create a monochromatic palette based on the input color - // which will go from black to white. - - // Input color luminosity: this is equivalent to the position of the - // input color in the monochromatic palette - $luminosity_input = round(255 * ($red + $green + $blue) / 765); // 765 = 255 * 3 - - // We fill the palette entry with the input color at itscorresponding position - $palette[$luminosity_input]['red'] = $red; - $palette[$luminosity_input]['green'] = $green; - $palette[$luminosity_input]['blue'] = $blue; - - // Now we complete the palette, first we'll do it to the black, and then to - // the white. - - // From input to black - $steps_to_black = $luminosity_input; - - // The step size for each component - if ($steps_to_black) { - $step_size_red = $red / $steps_to_black; - $step_size_green = $green / $steps_to_black; - $step_size_blue = $blue / $steps_to_black; - - for ($i = $steps_to_black; $i >= 0; $i--) { - $palette[$steps_to_black-$i]['red'] = $red - round($step_size_red * $i); - $palette[$steps_to_black-$i]['green'] = $green - round($step_size_green * $i); - $palette[$steps_to_black-$i]['blue'] = $blue - round($step_size_blue * $i); - } - } - - // From input to white - $steps_to_white = 255 - $luminosity_input; - - if ($steps_to_white) { - $step_size_red = (255 - $red) / $steps_to_white; - $step_size_green = (255 - $green) / $steps_to_white; - $step_size_blue = (255 - $blue) / $steps_to_white; - } - else { - $step_size_red=$step_size_green=$step_size_blue=0; - } - - // The step size for each component - for ($i = ($luminosity_input + 1); $i <= 255; $i++) { - $palette[$i]['red'] = $red + round($step_size_red * ($i - $luminosity_input)); - $palette[$i]['green'] = $green + round($step_size_green * ($i - $luminosity_input)); - $palette[$i]['blue']= $blue + round($step_size_blue * ($i - $luminosity_input)); - } - - // Go over the specified area of the image and update the colors. - for ($j = $x; $j < $height; $j++) { - for ($i = $y; $i < $width; $i++) { - $color = imagecolorsforindex($this->workspace, imagecolorat($this->workspace, $i, $j)); - $luminosity = round(255 * ($color['red'] + $color['green'] + $color['blue']) / 765); - $new_color = imagecolorallocatealpha($this->workspace, $palette[$luminosity]['red'], $palette[$luminosity]['green'], $palette[$luminosity]['blue'], $color['alpha']); - imagesetpixel($this->workspace, $i, $j, $new_color); - } - } - } - - /** - * Take a slice out of the current workspace and save it as an image. - */ - function command_slice($file, $x = NULL, $y = NULL, $width = NULL, $height = NULL) { - if (!isset($x)) { - $x = $y = 0; - $width = imagesx($this->workspace); - $height = imagesy($this->workspace); - } - - $this->log("Slice: $file ($x, $y, $width, $height)"); - - $base = basename($file); - $image = $this->path . '/' . $base; - - $slice = $this->new_image($this->workspace, $width, $height); - imagecopy($slice, $this->workspace, 0, 0, $x, $y, $width, $height); - - // Make sure alphas are saved: - imagealphablending($slice, FALSE); - imagesavealpha($slice, TRUE); - - // Save image. - $temp_name = drupal_tempnam('temporary://', 'file'); - - imagepng($slice, drupal_realpath($temp_name)); - file_unmanaged_move($temp_name, $image); - imagedestroy($slice); - - // Set standard file permissions for webserver-generated files - @chmod(realpath($image), 0664); - - $this->paths[$file] = $image; - } - - /** - * Prepare a new image for being copied or worked on, preserving transparency. - */ - function &new_image(&$source, $width = NULL, $height = NULL) { - if (!isset($width)) { - $width = imagesx($source); - } - - if (!isset($height)) { - $height = imagesy($source); - } - - $target = imagecreatetruecolor($width, $height); - imagealphablending($target, FALSE); - imagesavealpha($target, TRUE); - - $transparency_index = imagecolortransparent($source); - - // If we have a specific transparent color - if ($transparency_index >= 0) { - // Get the original image's transparent color's RGB values - $transparent_color = imagecolorsforindex($source, $transparency_index); - - // Allocate the same color in the new image resource - $transparency_index = imagecolorallocate($target, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']); - - // Completely fill the background of the new image with allocated color. - imagefill($target, 0, 0, $transparency_index); - - // Set the background color for new image to transparent - imagecolortransparent($target, $transparency_index); - } - // Always make a transparent background color for PNGs that don't have one allocated already - else { - // Create a new transparent color for image - $color = imagecolorallocatealpha($target, 0, 0, 0, 127); - - // Completely fill the background of the new image with allocated color. - imagefill($target, 0, 0, $color); - } - - return $target; - } - - /** - * Merge two images together, preserving alpha transparency. - */ - function merge(&$from, &$to, $x, $y) { - // Blend over template. - $width = imagesx($from); - $height = imagesy($from); - - // Re-enable alpha blending to make sure transparency merges. - imagealphablending($to, TRUE); - imagecopy($to, $from, $x, $y, 0, 0, $width, $height); - imagealphablending($to, FALSE); - } -} - -/** - * Get the cached changes to a given task handler. - */ -function ctools_stylizer_get_settings_cache($name) { - ctools_include('object-cache'); - return ctools_object_cache_get('ctools_stylizer_settings', $name); -} - -/** - * Store changes to a task handler in the object cache. - */ -function ctools_stylizer_set_settings_cache($name, $settings) { - ctools_include('object-cache'); - ctools_object_cache_set('ctools_stylizer_settings', $name, $settings); -} - -/** - * Remove an item from the object cache. - */ -function ctools_stylizer_clear_settings_cache($name) { - ctools_include('object-cache'); - ctools_object_cache_clear('ctools_stylizer_settings', $name); -} - -/** - * Add a new style of the specified type. - */ -function ctools_stylizer_edit_style(&$info, $js, $step = NULL) { - $name = '::new'; - $form_info = array( - 'id' => 'ctools_stylizer_edit_style', - 'path' => $info['path'], - 'show trail' => TRUE, - 'show back' => TRUE, - 'show return' => FALSE, - 'next callback' => 'ctools_stylizer_edit_style_next', - 'finish callback' => 'ctools_stylizer_edit_style_finish', - 'return callback' => 'ctools_stylizer_edit_style_finish', - 'cancel callback' => 'ctools_stylizer_edit_style_cancel', - 'forms' => array( - 'choose' => array( - 'form id' => 'ctools_stylizer_edit_style_form_choose', - ), - ), - ); - - if (empty($info['settings'])) { - $form_info['order'] = array( - 'choose' => t('Select base style'), - ); - if (empty($step)) { - $step = 'choose'; - } - - if ($step != 'choose') { - $cache = ctools_stylizer_get_settings_cache($name); - if (!$cache) { - $output = t('Missing settings cache.'); - if ($js) { - return ctools_modal_form_render($form_state, $output); - } - else { - return $output; - } - } - - if (!empty($cache['owner settings'])) { - $info['owner settings'] = $cache['owner settings']; - } - $settings = $cache['settings']; - } - else { - $settings = array( - 'name' => '_temporary', - 'style_base' => NULL, - 'palette' => array(), - ); - ctools_stylizer_clear_settings_cache($name); - } - $op = 'add'; - } - else { - $cache = ctools_stylizer_get_settings_cache($info['settings']['name']); - - if (!empty($cache)) { - if (!empty($cache['owner settings'])) { - $info['owner settings'] = $cache['owner settings']; - } - $settings = $cache['settings']; - } - else { - $settings = $info['settings']; - } - $op = 'edit'; - } - - if (!empty($info['op'])) { - // Allow this to override. Necessary to allow cloning properly. - $op = $info['op']; - } - - $plugin = NULL; - if (!empty($settings['style_base'])) { - $plugin = ctools_get_style_base($settings['style_base']); - $info['type'] = $plugin['type']; - ctools_stylizer_add_plugin_forms($form_info, $plugin, $op); - } - else { - // This is here so the 'finish' button does not show up, and because - // we don't have the selected style we don't know what the next form(s) - // will be. - $form_info['order']['next'] = t('Configure style'); - } - - if (count($form_info['order']) < 2 || $step == 'choose') { - $form_info['show trail'] = FALSE; - } - - $form_state = array( - 'module' => $info['module'], - 'type' => $info['type'], - 'owner info' => &$info, - 'base_style_plugin' => $plugin, - 'name' => $name, - 'step' => $step, - 'settings' => $settings, - 'ajax' => $js, - 'op' => $op, - ); - - if (!empty($info['modal'])) { - $form_state['modal'] = TRUE; - $form_state['title'] = $info['modal']; - $form_state['modal return'] = TRUE; - } - - ctools_include('wizard'); - $output = ctools_wizard_multistep_form($form_info, $step, $form_state); - - if (!empty($form_state['complete'])) { - $info['complete'] = TRUE; - $info['settings'] = $form_state['settings']; - } - - if ($js && !$output && !empty($form_state['clicked_button']['#next'])) { - // We have to do a separate redirect here because the formula that adds - // stuff to the wizard after being chosen hasn't happened. The wizard - // tried to go to the next step which did not exist. - return ctools_stylizer_edit_style($info, $js, $form_state['clicked_button']['#next']); - } - - if ($js) { - return ctools_modal_form_render($form_state, $output); - } - else { - return $output; - } -} - -/** - * Add wizard forms specific to a style base plugin. - * - * The plugin can store forms either as a simple 'edit form' - * => 'form callback' or if it needs the more complicated wizard - * functionality, it can set 'forms' and 'order' with values suitable - * for the wizard $form_info array. - * - * @param &$form_info - * The form info to modify. - * @param $plugin - * The plugin to use. - * @param $op - * Either 'add' or 'edit' so we can get the right forms. - */ -function ctools_stylizer_add_plugin_forms(&$form_info, $plugin, $op) { - if (empty($plugin['forms'])) { - if ($op == 'add' && isset($plugin['add form'])) { - $id = $plugin['add form']; - } - elseif (isset($plugin['edit form'])) { - $id = $plugin['edit form']; - } - else { - $id = 'ctools_stylizer_edit_style_form_default'; - } - - $form_info['forms']['settings'] = array( - 'form id' => $id, - ); - $form_info['order']['settings'] = t('Settings'); - } - else { - $form_info['forms'] += $plugin['forms']; - $form_info['order'] += $plugin['order']; - } -} - -/** - * Callback generated when the add style process is finished. - */ -function ctools_stylizer_edit_style_finish(&$form_state) { - $form_state['complete'] = TRUE; - ctools_stylizer_clear_settings_cache($form_state['name']); - - if (isset($form_state['settings']['old_settings'])) { - unset($form_state['settings']['old_settings']); - } -} - -/** - * Callback generated when the 'next' button is clicked. - */ -function ctools_stylizer_edit_style_next(&$form_state) { - $form_state['form_info']['path'] = str_replace('%name', $form_state['name'], $form_state['form_info']['path']); - $form_state['redirect'] = ctools_wizard_get_path($form_state['form_info'], $form_state['clicked_button']['#next']); - - // Update the cache with changes. - $cache = array('settings' => $form_state['settings']); - if (!empty($form_state['owner info']['owner settings'])) { - $cache['owner settings'] = $form_state['owner info']['owner settings']; - } - ctools_stylizer_set_settings_cache($form_state['name'], $cache); -} - -/** - * Callback generated when the 'cancel' button is clicked. - * - * We might have some temporary data lying around. We must remove it. - */ -function ctools_stylizer_edit_style_cancel(&$form_state) { - if (!empty($form_state['name'])) { - ctools_stylizer_clear_settings_cache($form_state['name']); - } -} - -/** - * Choose which plugin to use to create a new style. - */ -function ctools_stylizer_edit_style_form_choose($form, &$form_state) { - $plugins = ctools_get_style_bases(); - $options = array(); - - $categories = array(); - foreach ($plugins as $name => $plugin) { - if ($form_state['module'] == $plugin['module'] && $form_state['type'] == $plugin['type']) { - $categories[$plugin['category']] = $plugin['category']; - $unsorted_options[$plugin['category']][$name] = ctools_stylizer_print_style_icon($plugin, TRUE); - } - } - - asort($categories); - - foreach ($categories as $category) { - $options[$category] = $unsorted_options[$category]; - } - - $form['style_base'] = array( - '#prefix' => '
', - '#suffix' => '
', - ); - - ctools_include('cleanstring'); - foreach ($options as $category => $radios) { - $cat = ctools_cleanstring($category); - $form['style_base'][$cat] = array( - '#prefix' => '
', - '#suffix' => '
', - ); - - foreach ($radios as $key => $choice) { - // Generate the parents as the autogenerator does, so we will have a - // unique id for each radio button. - $form['style_base'][$cat][$key] = array( - '#type' => 'radio', - '#title' => $choice, - '#parents' => array('style_base'), - '#id' => drupal_clean_css_identifier('edit-style-base-' . $key), - '#return_value' => check_plain($key), - ); - } - } - - return $form; -} - -function ctools_stylizer_edit_style_form_choose_submit($form, &$form_state) { - $form_state['settings']['style_base'] = $form_state['values']['style_base']; - - // The 'next' form will show up as 'next' but that's not accurate now that - // we have a style. Figure out what next really is and update. - $plugin = ctools_get_style_base($form_state['settings']['style_base']); - if (empty($plugin['forms'])) { - $form_state['clicked_button']['#next'] = 'settings'; - } - else { - $forms = array_keys($form_info['forms']); - $form_state['clicked_button']['#next'] = array_shift($forms); - } - - // Fill in the defaults for the settings. - if (!empty($plugin['defaults'])) { - // @todo allow a callback - $form_state['settings'] += $plugin['defaults']; - } - - return $form; -} - -/** - * The default stylizer style editing form. - * - * Even when not using this, styles should call through to this form in - * their own edit forms. - */ -function ctools_stylizer_edit_style_form_default($form, &$form_state) { - ctools_add_js('stylizer'); - ctools_add_css('stylizer'); - drupal_add_library('system', 'farbtastic'); - - $plugin = &$form_state['base_style_plugin']; - $settings = &$form_state['settings']; - - $form['top box'] = array( - '#prefix' => '
', - '#suffix' => '
', - ); - $form['top box']['left'] = array( - '#prefix' => '
', - '#suffix' => '
', - ); - $form['top box']['preview'] = array( - // We have a copy of the $form_state on $form because form theme functions - // do not get $form_state. - '#theme' => 'ctools_stylizer_preview_form', - '#form_state' => &$form_state, - ); - - $form['top box']['preview']['submit'] = array( - '#type' => 'submit', - '#value' => t('Preview'), - ); - - if (!empty($plugin['palette'])) { - $form['top box']['color'] = array( - '#type' => 'fieldset', - '#title' => t('Color scheme'), - '#attributes' => array('id' => 'ctools_stylizer_color_scheme_form', 'class' => array('ctools-stylizer-color-edit')), - '#theme' => 'ctools_stylizer_color_scheme_form', - ); - - $form['top box']['color']['palette']['#tree'] = TRUE; - - foreach ($plugin['palette'] as $key => $color) { - if (empty($settings['palette'][$key])) { - $settings['palette'][$key] = $color['default_value']; - } - - $form['top box']['color']['palette'][$key] = array( - '#type' => 'textfield', - '#title' => $color['label'], - '#default_value' => $settings['palette'][$key], - '#size' => 8, - ); - } - } - - if (!empty($plugin['settings form']) && function_exists($plugin['settings form'])) { - $plugin['settings form']($form, $form_state); - } - - if (!empty($form_state['owner info']['owner form']) && function_exists($form_state['owner info']['owner form'])) { - $form_state['owner info']['owner form']($form, $form_state); - } - - return $form; -} - -/** - * Theme the stylizer color scheme form. - */ -function theme_ctools_stylizer_color_scheme_form($vars) { - $form = &$vars['form']; - $output = ''; - - // Wrapper - $output .= '
'; - - // Color schemes -// $output .= drupal_render($form['scheme']); - - // Palette - $output .= '
'; - foreach (element_children($form['palette']) as $name) { - $output .= render($form['palette'][$name]); - } - $output .= '
'; // palette - - $output .= '
'; // color form - - return $output; -} - -/** - * Theme the stylizer preview form. - */ -function theme_ctools_stylizer_preview_form($vars) { - $form = &$vars['form']; - - $plugin = $form['#form_state']['base_style_plugin']; - $settings = $form['#form_state']['settings']; - - if (!empty($form['#form_state']['settings']['old_settings'])) { - ctools_stylizer_cleanup_style($plugin, $form['#form_state']['settings']['old_settings']); - } - $preview = ''; - if (!empty($plugin['preview'])) { - $preview = $plugin['preview']; - } - else { - $base_types = ctools_get_style_base_types(); - if (!empty($base_types[$plugin['module']][$plugin['type']]['preview'])) { - $preview = $base_types[$plugin['module']][$plugin['type']]['preview']; - } - } - - if (!empty($preview) && function_exists($preview)) { - $output = '
' . t('Preview') . ''; - $output .= $preview($plugin, $settings); - $output .= drupal_render_children($form); - $output .= '
'; - - return $output; - } -} - -function ctools_stylizer_edit_style_form_default_validate($form, &$form_state) { - if (!empty($form_state['owner info']['owner form validate']) && function_exists($form_state['owner info']['owner form validate'])) { - $form_state['owner info']['owner form validate']($form, $form_state); - } - - if (!empty($form_state['base_style_plugin']['settings form validate']) && function_exists($form_state['base_style_plugin']['settings form validate'])) { - $form_state['base_style_plugin']['settings form validate']($form, $form_state); - } -} - -function ctools_stylizer_edit_style_form_default_submit($form, &$form_state) { - // Store old settings for the purposes of cleaning up. - $form_state['settings']['old_settings'] = $form_state['settings']; - $form_state['settings']['palette'] = $form_state['values']['palette']; - - if (!empty($form_state['owner info']['owner form submit']) && function_exists($form_state['owner info']['owner form submit'])) { - $form_state['owner info']['owner form submit']($form, $form_state); - } - - if (!empty($form_state['base_style_plugin']['settings form submit']) && function_exists($form_state['base_style_plugin']['settings form submit'])) { - $form_state['base_style_plugin']['settings form submit']($form, $form_state); - } - - if ($form_state['clicked_button']['#value'] == t('Preview')) { - $form_state['rerender'] = TRUE; - // Update the cache with changes. - if (!empty($form_state['name'])) { - $cache = array('settings' => $form_state['settings']); - if (!empty($form_state['owner info']['owner settings'])) { - $cache['owner settings'] = $form_state['owner info']['owner settings']; - } - ctools_stylizer_set_settings_cache($form_state['name'], $cache); - } - } -} - -// -------------------------------------------------------------------------- -// CSS forms and tools that plugins can use. - -/** - * Font selector form - */ -function ctools_stylizer_font_selector_form(&$form, &$form_state, $label, $settings) { - // Family - $form['#prefix'] = '
'; - $form['#type'] = 'fieldset'; - $form['#title'] = $label; - $form['#suffix'] = '
'; - $form['#tree'] = TRUE; - - $form['font'] = array( - '#title' => t('Font family'), - '#type' => 'select', - '#default_value' => isset($settings['font']) ? $settings['font'] : '', - '#options' => array( - '' => '', - 'Arial, Helvetica, sans-serif' => t('Arial, Helvetica, sans-serif'), - 'Times New Roman, Times, serif' => t('Times New Roman, Times, serif'), - 'Courier New, Courier, monospace' => t('Courier New, Courier, monospace'), - 'Georgia, Times New Roman, Times, serif' => t('Georgia, Times New Roman, Times, serif'), - 'Verdana, Arial, Helvetica, sans-serif' => t('Verdana, Arial, Helvetica, sans-serif'), - 'Geneva, Arial, Helvetica, sans-serif' => t('Geneva, Arial, Helvetica, sans-serif'), - 'Trebuchet MS, Trebuchet, Verdana, sans-serif' => t('Trebuchet MS, Trebuchet, Verdana, sans-serif'), - ), - ); - - // size - $form['size'] = array( - '#title' => t('Size'), - '#type' => 'select', - '#default_value' => isset($settings['size']) ? $settings['size'] : '', - '#options' => array( - '' => '', - 'xx-small' => t('XX-Small'), - 'x-small' => t('X-Small'), - 'small' => t('Small'), - 'medium' => t('Medium'), - 'large' => t('Large'), - 'x-large' => t('X-Large'), - 'xx-large' => t('XX-Large'), - ), - ); - - // letter spacing - $form['letter_spacing'] = array( - '#title' => t('Letter spacing'), - '#type' => 'select', - '#default_value' => isset($settings['letter_spacing']) ? $settings['letter_spacing'] : '', - '#options' => array( - '' => '', - "-10px" => '10px', - "-9px" => '9px', - "-8px" => '8px', - "-7px" => '7px', - "-6px" => '6px', - "-5px" => '5px', - "-4px" => '4px', - "-3px" => '3px', - "-2px" => '2px', - "-1px" => '1px', - "0" => '0', - "1px" => '1px', - "2px" => '2px', - "3px" => '3px', - "4px" => '4px', - "5px" => '5px', - "6px" => '6px', - "7px" => '7px', - "8px" => '8px', - "9px" => '9px', - "10px" => '10px', - "11px" => '11px', - "12px" => '12px', - "13px" => '13px', - "14px" => '14px', - "15px" => '15px', - "16px" => '16px', - "17px" => '17px', - "18px" => '18px', - "19px" => '19px', - "20px" => '20px', - "21px" => '21px', - "22px" => '22px', - "23px" => '23px', - "24px" => '24px', - "25px" => '25px', - "26px" => '26px', - "27px" => '27px', - "28px" => '28px', - "29px" => '29px', - "30px" => '30px', - "31px" => '31px', - "32px" => '32px', - "33px" => '33px', - "34px" => '34px', - "35px" => '35px', - "36px" => '36px', - "37px" => '37px', - "38px" => '38px', - "39px" => '39px', - "40px" => '40px', - "41px" => '41px', - "42px" => '42px', - "43px" => '43px', - "44px" => '44px', - "45px" => '45px', - "46px" => '46px', - "47px" => '47px', - "48px" => '48px', - "49px" => '49px', - "50px" => '50px', - ), - ); - - // word space - $form['word_spacing'] = array( - '#title' => t('Word spacing'), - '#type' => 'select', - '#default_value' => isset($settings['word_spacing']) ? $settings['word_spacing'] : '', - '#options' => array( - '' => '', - "-1em" => '-1em', - "-0.95em" => '-0.95em', - "-0.9em" => '-0.9em', - "-0.85em" => '-0.85em', - "-0.8em" => '-0.8em', - "-0.75em" => '-0.75em', - "-0.7em" => '-0.7em', - "-0.65em" => '-0.65em', - "-0.6em" => '-0.6em', - "-0.55em" => '-0.55em', - "-0.5em" => '-0.5em', - "-0.45em" => '-0.45em', - "-0.4em" => '-0.4em', - "-0.35em" => '-0.35em', - "-0.3em" => '-0.3em', - "-0.25em" => '-0.25em', - "-0.2em" => '-0.2em', - "-0.15em" => '-0.15em', - "-0.1em" => '-0.1em', - "-0.05em" => '-0.05em', - "normal" => 'normal', - "0.05em" => '0.05em', - "0.1em" => '0.1em', - "0.15em" => '0.15em', - "0.2em" => '0.2em', - "0.25em" => '0.25em', - "0.3em" => '0.3em', - "0.35em" => '0.35em', - "0.4em" => '0.4em', - "0.45em" => '0.45em', - "0.5em" => '0.5em', - "0.55em" => '0.55em', - "0.6em" => '0.6em', - "0.65em" => '0.65em', - "0.7em" => '0.7em', - "0.75em" => '0.75em', - "0.8em" => '0.8em', - "0.85em" => '0.85em', - "0.9em" => '0.9em', - "0.95em" => '0.95em', - "1em" => '1em', - ), - ); - - // decoration - $form['decoration'] = array( - '#title' => t('Decoration'), - '#type' => 'select', - '#default_value' => isset($settings['decoration']) ? $settings['decoration'] : '', - '#options' => array( - '' => '', - 'none' => t('None'), - 'underline' => t('Underline'), - 'overline' => t('Overline'), - 'line-through' => t('Line-through'), - ), - ); - - // weight - $form['weight'] = array( - '#title' => t('Weight'), - '#type' => 'select', - '#default_value' => isset($settings['weight']) ? $settings['weight'] : '', - '#options' => array( - '' => '', - 'normal' => t('Normal'), - 'bold' => t('Bold'), - 'bolder' => t('Bolder'), - 'lighter' => t('Lighter'), - ), - ); - - // style - $form['style'] = array( - '#title' => t('Style'), - '#type' => 'select', - '#default_value' => isset($settings['style']) ? $settings['style'] : '', - '#options' => array( - '' => '', - 'normal' => t('Normal'), - 'italic' => t('Italic'), - 'oblique' => t('Oblique'), - ), - ); - - // variant - $form['variant'] = array( - '#title' => t('Variant'), - '#type' => 'select', - '#default_value' => isset($settings['variant']) ? $settings['variant'] : '', - '#options' => array( - '' => '', - 'normal' => t('Normal'), - 'small-caps' => t('Small-caps'), - ), - ); - - // case - $form['case'] = array( - '#title' => t('Case'), - '#type' => 'select', - '#default_value' => isset($settings['case']) ? $settings['case'] : '', - '#options' => array( - '' => '', - 'capitalize' => t('Capitalize'), - 'uppercase' => t('Uppercase'), - 'lowercase' => t('Lowercase'), - 'none' => t('None'), - ), - ); - - // alignment - $form['alignment'] = array( - '#title' => t('Align'), - '#type' => 'select', - '#default_value' => isset($settings['alignment']) ? $settings['alignment'] : '', - '#options' => array( - '' => '', - 'justify' => t('Justify'), - 'left' => t('Left'), - 'right' => t('Right'), - 'center' => t('Center'), - ), - ); -} - -/** - * Copy font selector information into the settings - */ -function ctools_stylizer_font_selector_form_submit(&$form, &$form_state, &$values, &$settings) { - $settings = $values; -} - -function ctools_stylizer_font_apply_style(&$stylesheet, $selector, $settings) { - $css = ''; - if (isset($settings['font']) && $settings['font'] !== '') { - $css .= ' font-family: ' . $settings['font'] . ";\n"; - } - - if (isset($settings['size']) && $settings['size'] !== '') { - $css .= ' font-size: ' . $settings['size'] . ";\n"; - } - - if (isset($settings['weight']) && $settings['weight'] !== '') { - $css .= ' font-weight: ' . $settings['weight'] . ";\n"; - } - - if (isset($settings['style']) && $settings['style'] !== '') { - $css .= ' font-style: ' . $settings['style'] . ";\n"; - } - - if (isset($settings['variant']) && $settings['variant'] !== '') { - $css .= ' font-variant: ' . $settings['variant'] . ";\n"; - } - - if (isset($settings['case']) && $settings['case'] !== '') { - $css .= ' text-transform: ' . $settings['case'] . ";\n"; - } - - if (isset($settings['decoration']) && $settings['decoration'] !== '') { - $css .= ' text-decoration: ' . $settings['decoration'] . ";\n"; - } - - if (isset($settings['alignment']) && $settings['alignment'] !== '') { - $css .= ' text-align: ' . $settings['alignment'] . ";\n"; - } - - if (isset($settings['letter_spacing']) && $settings['letter_spacing'] !== '') { - $css .= ' letter-spacing: ' . $settings['letter_spacing'] . ";\n"; - } - - if (isset($settings['word_spacing']) && $settings['word_spacing'] !== '') { - $css .= ' word-spacing: ' . $settings['word_spacing'] . ";\n"; - } - - if ($css) { - $stylesheet .= $selector . " {\n" . $css . "}\n"; - } -} - -/** - * Border selector form - */ -function ctools_stylizer_border_selector_form(&$form, &$form_state, $label, $settings) { - // Family - $form['#prefix'] = '
'; - $form['#type'] = 'fieldset'; - $form['#title'] = $label; - $form['#suffix'] = '
'; - $form['#tree'] = TRUE; - - $form['thickness'] = array( - '#title' => t('Thickness'), - '#type' => 'select', - '#default_value' => isset($settings['thickness']) ? $settings['thickness'] : '', - '#options' => array( - '' => '', - "none" => t('None'), - "1px" => '1px', - "2px" => '2px', - "3px" => '3px', - "4px" => '4px', - "5px" => '5px', - ), - ); - - $form['style'] = array( - '#title' => t('style'), - '#type' => 'select', - '#default_value' => isset($settings['style']) ? $settings['style'] : '', - '#options' => array( - '' => '', - 'solid' => t('Solid'), - 'dotted' => t('Dotted'), - 'dashed' => t('Dashed'), - 'double' => t('Double'), - 'groove' => t('Groove'), - 'ridge' => t('Ridge'), - 'inset' => t('Inset'), - 'outset' => t('Outset'), - ), - ); -} - -/** - * Copy border selector information into the settings - */ -function ctools_stylizer_border_selector_form_submit(&$form, &$form_state, &$values, &$settings) { - $settings = $values; -} - -function ctools_stylizer_border_apply_style(&$stylesheet, $selector, $settings, $color, $which = NULL) { - $border = 'border'; - if ($which) { - $border .= '-' . $which; - } - - $css = ''; - if (isset($settings['thickness']) && $settings['thickness'] !== '') { - if ($settings['thickness'] == 'none') { - $css .= ' ' . $border . ': none'; - } - else { - $css .= ' ' . $border . '-width: ' . $settings['thickness'] . ";\n"; - - if (isset($settings['style']) && $settings['style'] !== '') { - $css .= ' ' . $border . '-style: ' . $settings['style'] . ";\n"; - } - - $css .= ' ' . $border . '-color: ' . $color . ";\n"; - } - } - - if ($css) { - $stylesheet .= $selector . " {\n" . $css . "}\n"; - } - -} - -/** - * padding selector form - */ -function ctools_stylizer_padding_selector_form(&$form, &$form_state, $label, $settings) { - // Family - $form['#prefix'] = '
'; - $form['#type'] = 'fieldset'; - $form['#title'] = $label; - $form['#suffix'] = '
'; - $form['#tree'] = TRUE; - - $options = array( - '' => '', - "0.05em" => '0.05em', - "0.1em" => '0.1em', - "0.15em" => '0.15em', - "0.2em" => '0.2em', - "0.25em" => '0.25em', - "0.3em" => '0.3em', - "0.35em" => '0.35em', - "0.4em" => '0.4em', - "0.45em" => '0.45em', - "0.5em" => '0.5em', - "0.55em" => '0.55em', - "0.6em" => '0.6em', - "0.65em" => '0.65em', - "0.7em" => '0.7em', - "0.75em" => '0.75em', - "0.8em" => '0.8em', - "0.85em" => '0.85em', - "0.9em" => '0.9em', - "0.95em" => '0.95em', - "1.0em" => '1.0em', - "1.05em" => '1.05em', - "1.1em" => '1.1em', - "1.15em" => '1.15em', - "1.2em" => '1.2em', - "1.25em" => '1.25em', - "1.3em" => '1.3em', - "1.35em" => '1.35em', - "1.4em" => '1.4em', - "1.45em" => '1.45em', - "1.5em" => '1.5em', - "1.55em" => '1.55em', - "1.6em" => '1.6em', - "1.65em" => '1.65em', - "1.7em" => '1.7em', - "1.75em" => '1.75em', - "1.8em" => '1.8em', - "1.85em" => '1.85em', - "1.9em" => '1.9em', - "1.95em" => '1.95em', - "2.0em" => '2.0em', - "2.05em" => '2.05em', - "2.1em" => '2.1em', - "2.15em" => '2.15em', - "2.2em" => '2.2em', - "2.25em" => '2.25em', - "2.3em" => '2.3em', - "2.35em" => '2.35em', - "2.4em" => '2.4em', - "2.45em" => '2.45em', - "2.5em" => '2.5em', - "2.55em" => '2.55em', - "2.6em" => '2.6em', - "2.65em" => '2.65em', - "2.7em" => '2.7em', - "2.75em" => '2.75em', - "2.8em" => '2.8em', - "2.85em" => '2.85em', - "2.9em" => '2.9em', - "2.95em" => '2.95em', - "3.0em" => '3.0em', - "3.05em" => '3.05em', - "3.1em" => '3.1em', - "3.15em" => '3.15em', - "3.2em" => '3.2em', - "3.25em" => '3.25em', - "3.3em" => '3.3em', - "3.35em" => '3.35em', - "3.4em" => '3.4em', - "3.45em" => '3.45em', - "3.5em" => '3.5em', - "3.55em" => '3.55em', - "3.6em" => '3.6em', - "3.65em" => '3.65em', - "3.7em" => '3.7em', - "3.75em" => '3.75em', - "3.8em" => '3.8em', - "3.85em" => '3.85em', - "3.9em" => '3.9em', - "3.95em" => '3.95em', - ); - - $form['top'] = array( - '#title' => t('Top'), - '#type' => 'select', - '#default_value' => isset($settings['top']) ? $settings['top'] : '', - '#options' => $options, - ); - - $form['right'] = array( - '#title' => t('Right'), - '#type' => 'select', - '#default_value' => isset($settings['right']) ? $settings['right'] : '', - '#options' => $options, - ); - - $form['bottom'] = array( - '#title' => t('Bottom'), - '#type' => 'select', - '#default_value' => isset($settings['bottom']) ? $settings['bottom'] : '', - '#options' => $options, - ); - - $form['left'] = array( - '#title' => t('Left'), - '#type' => 'select', - '#default_value' => isset($settings['left']) ? $settings['left'] : '', - '#options' => $options, - ); -} - -/** - * Copy padding selector information into the settings - */ -function ctools_stylizer_padding_selector_form_submit(&$form, &$form_state, &$values, &$settings) { - $settings = $values; -} - -function ctools_stylizer_padding_apply_style(&$stylesheet, $selector, $settings) { - $css = ''; - - if (isset($settings['top']) && $settings['top'] !== '') { - $css .= ' padding-top: ' . $settings['top'] . ";\n"; - } - - if (isset($settings['right']) && $settings['right'] !== '') { - $css .= ' padding-right: ' . $settings['right'] . ";\n"; - } - - if (isset($settings['bottom']) && $settings['bottom'] !== '') { - $css .= ' padding-bottom: ' . $settings['bottom'] . ";\n"; - } - - if (isset($settings['left']) && $settings['left'] !== '') { - $css .= ' padding-left: ' . $settings['left'] . ";\n"; - } - - if ($css) { - $stylesheet .= $selector . " {\n" . $css . "}\n"; - } - -} diff --git a/html/sites/all/modules/contrib/ctools/includes/stylizer.theme.inc b/html/sites/all/modules/contrib/ctools/includes/stylizer.theme.inc deleted file mode 100644 index 0ceedffc7..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/stylizer.theme.inc +++ /dev/null @@ -1,27 +0,0 @@ - 'form', - 'file' => 'includes/stylizer.inc', - ); - - $theme['ctools_stylizer_preview_form'] = array( - 'render element' => 'form', - 'file' => 'includes/stylizer.inc', - ); - - $theme['ctools_style_icon'] = array( - 'variables' => array('image' => NULL, 'title' => NULL), - 'file' => 'includes/stylizer.inc', - ); -} diff --git a/html/sites/all/modules/contrib/ctools/includes/utility.inc b/html/sites/all/modules/contrib/ctools/includes/utility.inc deleted file mode 100644 index 3c939a441..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/utility.inc +++ /dev/null @@ -1,31 +0,0 @@ - 'name')); - foreach ($files as $file) { - require_once DRUPAL_ROOT . '/' . $file->uri; - list($tool) = explode('.', $file->name, 2); - - $function = $module . '_' . str_replace('-', '_', $tool) . '_' . str_replace('-', '_', $type); - if (function_exists($function)) { - $function($items); - } - } -} diff --git a/html/sites/all/modules/contrib/ctools/includes/uuid.inc b/html/sites/all/modules/contrib/ctools/includes/uuid.inc deleted file mode 100644 index f51838be0..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/uuid.inc +++ /dev/null @@ -1,71 +0,0 @@ - $params) { - $form_info['order'][$step_id] = $params['title']; - } - } - - if (!isset($step)) { - $keys = array_keys($form_info['order']); - $step = array_shift($keys); - } - - ctools_wizard_defaults($form_info); - - // If automated caching is enabled, ensure that everything is as it - // should be. - if (!empty($form_info['auto cache'])) { - // If the cache mechanism hasn't been set, default to the simple - // mechanism and use the wizard ID to ensure uniqueness so cache - // objects don't stomp on each other. - if (!isset($form_info['cache mechanism'])) { - $form_info['cache mechanism'] = 'simple::wizard::' . $form_info['id']; - } - - // If not set, default the cache key to the wizard ID. This is often - // a unique ID of the object being edited or similar. - if (!isset($form_info['cache key'])) { - $form_info['cache key'] = $form_info['id']; - } - - // If not set, default the cache location to storage. This is often - // somnething like 'conf'. - if (!isset($form_info['cache location'])) { - $form_info['cache location'] = 'storage'; - } - - // If absolutely nothing was set for the cache area to work on. - if (!isset($form_state[$form_info['cache location']])) { - ctools_include('cache'); - $form_state[$form_info['cache location']] = ctools_cache_get($form_info['cache mechanism'], $form_info['cache key']); - } - } - - $form_state['step'] = $step; - $form_state['form_info'] = $form_info; - - // Ensure we have form information for the current step. - if (!isset($form_info['forms'][$step])) { - return; - } - - // Ensure that whatever include file(s) were requested by the form info are - // actually included. - $info = $form_info['forms'][$step]; - - if (!empty($info['include'])) { - if (is_array($info['include'])) { - foreach ($info['include'] as $file) { - ctools_form_include_file($form_state, $file); - } - } - else { - ctools_form_include_file($form_state, $info['include']); - } - } - - // This tells drupal_build_form to apply our wrapper to the form. It - // will give it buttons and the like. - $form_state['wrapper_callback'] = 'ctools_wizard_wrapper'; - if (!isset($form_state['rerender'])) { - $form_state['rerender'] = FALSE; - } - - $form_state['no_redirect'] = TRUE; - - $output = drupal_build_form($info['form id'], $form_state); - - if (empty($form_state['executed']) || !empty($form_state['rerender'])) { - if (empty($form_state['title']) && !empty($info['title'])) { - $form_state['title'] = $info['title']; - } - - if (!empty($form_state['ajax render'])) { - // Any include files should already be included by this point: - return $form_state['ajax render']($form_state, $output); - } - - // Automatically use the modal tool if set to true. - if (!empty($form_state['modal']) && empty($form_state['modal return'])) { - ctools_include('modal'); - - // This overwrites any previous commands. - $form_state['commands'] = ctools_modal_form_render($form_state, $output); - } - } - - if (!empty($form_state['executed'])) { - // We use the plugins get_function format because it's powerful and - // not limited to just functions. - ctools_include('plugins'); - - if (isset($form_state['clicked_button']['#wizard type'])) { - $type = $form_state['clicked_button']['#wizard type']; - // If we have a callback depending upon the type of button that was - // clicked, call it. - if ($function = ctools_plugin_get_function($form_info, "$type callback")) { - $function($form_state); - } - - // If auto-caching is on, we need to write the cache on next and - // clear the cache on finish. - if (!empty($form_info['auto cache'])) { - if ($type == 'next') { - ctools_include('cache'); - ctools_cache_set($form_info['cache mechanism'], $form_info['cache key'], $form_state[$form_info['cache location']]); - } - elseif ($type == 'finish') { - ctools_include('cache'); - ctools_cache_clear($form_info['cache mechanism'], $form_info['cache key']); - } - } - - // Set a couple of niceties: - if ($type == 'finish') { - $form_state['complete'] = TRUE; - } - - if ($type == 'cancel') { - $form_state['cancel'] = TRUE; - } - - // If the modal is in use, some special code for it: - if (!empty($form_state['modal']) && empty($form_state['modal return'])) { - if ($type != 'next') { - // Automatically dismiss the modal if we're not going to another form. - ctools_include('modal'); - $form_state['commands'][] = ctools_modal_command_dismiss(); - } - } - } - - if (empty($form_state['ajax'])) { - // redirect, if one is set. - if ($form_state['redirect']) { - if (is_array($form_state['redirect'])) { - call_user_func_array('drupal_goto', $form_state['redirect']); - } - else { - drupal_goto($form_state['redirect']); - } - } - } - elseif (isset($form_state['ajax next'])) { - // Clear a few items off the form state so we don't double post: - $next = $form_state['ajax next']; - unset($form_state['ajax next']); - unset($form_state['executed']); - unset($form_state['post']); - unset($form_state['next']); - return ctools_wizard_multistep_form($form_info, $next, $form_state); - } - - // If the callbacks wanted to do something besides go to the next form, - // it needs to have set $form_state['commands'] with something that can - // be rendered. - } - - // Render ajax commands if we have any. - if (isset($form_state['ajax']) && isset($form_state['commands']) && empty($form_state['modal return'])) { - return ajax_render($form_state['commands']); - } - - // Otherwise, return the output. - return $output; -} - -/** - * Provide a wrapper around another form for adding multi-step information. - */ -function ctools_wizard_wrapper($form, &$form_state) { - $form_info = &$form_state['form_info']; - $info = $form_info['forms'][$form_state['step']]; - - // Determine the next form from this step. - // Create a form trail if we're supposed to have one. - $trail = array(); - $previous = TRUE; - foreach ($form_info['order'] as $id => $title) { - if ($id == $form_state['step']) { - $previous = FALSE; - $class = 'wizard-trail-current'; - } - elseif ($previous) { - $not_first = TRUE; - $class = 'wizard-trail-previous'; - $form_state['previous'] = $id; - } - else { - $class = 'wizard-trail-next'; - if (!isset($form_state['next'])) { - $form_state['next'] = $id; - } - if (empty($form_info['show trail'])) { - break; - } - } - - if (!empty($form_info['show trail'])) { - if (!empty($form_info['free trail'])) { - // ctools_wizard_get_path() returns results suitable for - // $form_state['redirect] which can only be directly used in - // drupal_goto. We have to futz a bit with it. - $path = ctools_wizard_get_path($form_info, $id); - $options = array(); - if (!empty($path[1])) { - $options = $path[1]; - } - $title = l($title, $path[0], $options); - } - $trail[] = '' . $title . ''; - } - } - - // Display the trail if instructed to do so. - if (!empty($form_info['show trail'])) { - ctools_add_css('wizard'); - $form['ctools_trail'] = array( - '#markup' => theme(array('ctools_wizard_trail__' . $form_info['id'], 'ctools_wizard_trail'), array('trail' => $trail, 'form_info' => $form_info)), - '#weight' => -1000, - ); - } - - if (empty($form_info['no buttons'])) { - // Ensure buttons stay on the bottom. - $form['buttons'] = array( - '#type' => 'actions', - '#weight' => 1000, - ); - - $button_attributes = array(); - if (!empty($form_state['ajax']) && empty($form_state['modal'])) { - $button_attributes = array('class' => array('ctools-use-ajax')); - } - - if (!empty($form_info['show back']) && isset($form_state['previous'])) { - $form['buttons']['previous'] = array( - '#type' => 'submit', - '#value' => $form_info['back text'], - '#next' => $form_state['previous'], - '#wizard type' => 'next', - '#weight' => -2000, - '#limit_validation_errors' => array(), - // Hardcode the submit so that it doesn't try to save data. - '#submit' => array('ctools_wizard_submit'), - '#attributes' => $button_attributes, - ); - - if (isset($form_info['no back validate']) || isset($info['no back validate'])) { - $form['buttons']['previous']['#validate'] = array(); - } - } - - // If there is a next form, place the next button. - if (isset($form_state['next']) || !empty($form_info['free trail'])) { - $form['buttons']['next'] = array( - '#type' => 'submit', - '#value' => $form_info['next text'], - '#next' => !empty($form_info['free trail']) ? $form_state['step'] : $form_state['next'], - '#wizard type' => 'next', - '#weight' => -1000, - '#attributes' => $button_attributes, - ); - } - - // There are two ways the return button can appear. If this is not the - // end of the form list (i.e, there is a next) then it's "update and return" - // to be clear. If this is the end of the path and there is no next, we - // call it 'Finish'. - // Even if there is no direct return path (some forms may not want you - // leaving in the middle) the final button is always a Finish and it does - // whatever the return action is. - if (!empty($form_info['show return']) && !empty($form_state['next'])) { - $form['buttons']['return'] = array( - '#type' => 'submit', - '#value' => $form_info['return text'], - '#wizard type' => 'return', - '#attributes' => $button_attributes, - ); - } - elseif (empty($form_state['next']) || !empty($form_info['free trail'])) { - $form['buttons']['return'] = array( - '#type' => 'submit', - '#value' => $form_info['finish text'], - '#wizard type' => 'finish', - '#attributes' => $button_attributes, - ); - } - - // If we are allowed to cancel, place a cancel button. - if ((isset($form_info['cancel path']) && !isset($form_info['show cancel'])) || !empty($form_info['show cancel'])) { - $form['buttons']['cancel'] = array( - '#type' => 'submit', - '#value' => $form_info['cancel text'], - '#wizard type' => 'cancel', - // Hardcode the submit so that it doesn't try to save data. - '#limit_validation_errors' => array(), - '#submit' => array('ctools_wizard_submit'), - '#attributes' => $button_attributes, - ); - } - - // Set up optional validate handlers. - $form['#validate'] = array(); - if (function_exists($info['form id'] . '_validate')) { - $form['#validate'][] = $info['form id'] . '_validate'; - } - if (isset($info['validate']) && function_exists($info['validate'])) { - $form['#validate'][] = $info['validate']; - } - - // Set up our submit handler after theirs. Since putting something here will - // skip Drupal's autodetect, we autodetect for it. - // We make sure ours is after theirs so that they get to change #next if - // the want to. - $form['#submit'] = array(); - if (function_exists($info['form id'] . '_submit')) { - $form['#submit'][] = $info['form id'] . '_submit'; - } - if (isset($info['submit']) && function_exists($info['submit'])) { - $form['#submit'][] = $info['submit']; - } - $form['#submit'][] = 'ctools_wizard_submit'; - } - - if (!empty($form_state['ajax'])) { - $params = ctools_wizard_get_path($form_state['form_info'], $form_state['step']); - if (count($params) > 1) { - $url = array_shift($params); - $options = array(); - - $keys = array(0 => 'query', 1 => 'fragment'); - foreach ($params as $key => $value) { - if (isset($keys[$key]) && isset($value)) { - $options[$keys[$key]] = $value; - } - } - - $params = array($url, $options); - } - $form['#action'] = call_user_func_array('url', $params); - } - - if (isset($info['wrapper']) && function_exists($info['wrapper'])) { - $form = $info['wrapper']($form, $form_state); - } - - if (isset($form_info['wrapper']) && function_exists($form_info['wrapper'])) { - $form = $form_info['wrapper']($form, $form_state); - } - return $form; -} - -/** - * On a submit, go to the next form. - */ -function ctools_wizard_submit(&$form, &$form_state) { - if (isset($form_state['clicked_button']['#wizard type'])) { - $type = $form_state['clicked_button']['#wizard type']; - - // If AJAX enabled, we proceed slightly differently here. - if (!empty($form_state['ajax'])) { - if ($type == 'next') { - $form_state['ajax next'] = $form_state['clicked_button']['#next']; - } - } - else { - if ($type == 'cancel' && isset($form_state['form_info']['cancel path'])) { - $form_state['redirect'] = $form_state['form_info']['cancel path']; - } - elseif ($type == 'next') { - $form_state['redirect'] = ctools_wizard_get_path($form_state['form_info'], $form_state['clicked_button']['#next']); - if (!empty($_GET['destination'])) { - // We don't want drupal_goto redirect this request - // back. ctools_wizard_get_path ensures that the destination is - // carried over on subsequent pages. - unset($_GET['destination']); - } - } - elseif (isset($form_state['form_info']['return path'])) { - $form_state['redirect'] = $form_state['form_info']['return path']; - } - elseif ($type == 'finish' && isset($form_state['form_info']['cancel path'])) { - $form_state['redirect'] = $form_state['form_info']['cancel path']; - } - } - } -} - -/** - * Create a path from the form info and a given step. - */ -function ctools_wizard_get_path($form_info, $step) { - if (is_array($form_info['path'])) { - foreach ($form_info['path'] as $id => $part) { - $form_info['path'][$id] = str_replace('%step', $step, $form_info['path'][$id]); - } - $path = $form_info['path']; - } - else { - $path = array(str_replace('%step', $step, $form_info['path'])); - } - - // If destination is set, carry it over so it'll take effect when - // saving. The submit handler will unset destination to avoid drupal_goto - // redirecting us. - if (!empty($_GET['destination'])) { - // Ensure that options is an array. - if (!isset($path[1]) || !is_array($path[1])) { - $path[1] = array(); - } - // Add the destination parameter, if not set already. - $path[1] += drupal_get_destination(); - } - - return $path; -} - -/** - * Set default parameters and callbacks if none are given. - * Callbacks follows pattern: - * $form_info['id']_$hook - * $form_info['id']_$form_info['forms'][$step_key]_$hook - */ -function ctools_wizard_defaults(&$form_info) { - $hook = $form_info['id']; - $defaults = array( - 'show trail' => FALSE, - 'free trail' => FALSE, - 'show back' => FALSE, - 'show cancel' => FALSE, - 'show return' => FALSE, - 'next text' => t('Continue'), - 'back text' => t('Back'), - 'return text' => t('Update and return'), - 'finish text' => t('Finish'), - 'cancel text' => t('Cancel'), - ); - - if (!empty($form_info['free trail'])) { - $defaults['next text'] = t('Update'); - $defaults['finish text'] = t('Save'); - } - - $form_info = $form_info + $defaults; - // Set form callbacks if they aren't defined. - foreach ($form_info['forms'] as $step => $params) { - if (empty($params['form id'])) { - $form_callback = $hook . '_' . $step . '_form'; - $form_info['forms'][$step]['form id'] = $form_callback; - } - } - - // Set button callbacks. - $callbacks = array( - 'back callback' => '_back', - 'next callback' => '_next', - 'return callback' => '_return', - 'cancel callback' => '_cancel', - 'finish callback' => '_finish', - ); - - foreach ($callbacks as $key => $callback) { - // Never overwrite if explicity defined. - if (empty($form_info[$key])) { - $wizard_callback = $hook . $callback; - if (function_exists($wizard_callback)) { - $form_info[$key] = $wizard_callback; - } - } - } -} diff --git a/html/sites/all/modules/contrib/ctools/includes/wizard.theme.inc b/html/sites/all/modules/contrib/ctools/includes/wizard.theme.inc deleted file mode 100644 index c1a26468d..000000000 --- a/html/sites/all/modules/contrib/ctools/includes/wizard.theme.inc +++ /dev/null @@ -1,22 +0,0 @@ - array('trail' => NULL, 'form_info' => NULL, 'divider' => ' » '), - 'file' => 'includes/wizard.theme.inc', - ); -} - -/** - * Themable display of the 'breadcrumb' trail to show the order of the forms. - */ -function theme_ctools_wizard_trail($vars) { - if (!empty($vars['trail'])) { - return '
' . implode($vars['divider'], $vars['trail']) . '
'; - } -} diff --git a/html/sites/all/modules/contrib/ctools/js/ajax-responder.js b/html/sites/all/modules/contrib/ctools/js/ajax-responder.js deleted file mode 100644 index 116d4744f..000000000 --- a/html/sites/all/modules/contrib/ctools/js/ajax-responder.js +++ /dev/null @@ -1,127 +0,0 @@ -/** - * @file - * - * CTools flexible AJAX responder object. - */ - -(function ($) { - Drupal.CTools = Drupal.CTools || {}; - Drupal.CTools.AJAX = Drupal.CTools.AJAX || {}; - /** - * Grab the response from the server and store it. - * - * @todo restore the warm cache functionality - */ - Drupal.CTools.AJAX.warmCache = function () { - // Store this expression for a minor speed improvement. - $this = $(this); - var old_url = $this.attr('href'); - // If we are currently fetching, or if we have fetched this already which is - // ideal for things like pagers, where the previous page might already have - // been seen in the cache. - if ($this.hasClass('ctools-fetching') || Drupal.CTools.AJAX.commandCache[old_url]) { - return false; - } - - // Grab all the links that match this url and add the fetching class. - // This allows the caching system to grab each url once and only once - // instead of grabbing the url once per . - var $objects = $('a[href="' + old_url + '"]'); - $objects.addClass('ctools-fetching'); - try { - url = old_url.replace(/\/nojs(\/|$)/g, '/ajax$1'); - $.ajax({ - type: "POST", - url: url, - data: { 'js': 1, 'ctools_ajax': 1}, - global: true, - success: function (data) { - Drupal.CTools.AJAX.commandCache[old_url] = data; - $objects.addClass('ctools-cache-warmed').trigger('ctools-cache-warm', [data]); - }, - complete: function() { - $objects.removeClass('ctools-fetching'); - }, - dataType: 'json' - }); - } - catch (err) { - $objects.removeClass('ctools-fetching'); - return false; - } - - return false; - }; - - /** - * Cachable click handler to fetch the commands out of the cache or from url. - */ - Drupal.CTools.AJAX.clickAJAXCacheLink = function () { - $this = $(this); - if ($this.hasClass('ctools-fetching')) { - $this.bind('ctools-cache-warm', function (event, data) { - Drupal.CTools.AJAX.respond(data); - }); - return false; - } - else { - if ($this.hasClass('ctools-cache-warmed') && Drupal.CTools.AJAX.commandCache[$this.attr('href')]) { - Drupal.CTools.AJAX.respond(Drupal.CTools.AJAX.commandCache[$this.attr('href')]); - return false; - } - else { - return Drupal.CTools.AJAX.clickAJAXLink.apply(this); - } - } - }; - - /** - * Find a URL for an AJAX button. - * - * The URL for this gadget will be composed of the values of items by - * taking the ID of this item and adding -url and looking for that - * class. They need to be in the form in order since we will - * concat them all together using '/'. - */ - Drupal.CTools.AJAX.findURL = function(item) { - var url = ''; - var url_class = '.' + $(item).attr('id') + '-url'; - $(url_class).each( - function() { - var $this = $(this); - if (url && $this.val()) { - url += '/'; - } - url += $this.val(); - }); - return url; - }; - - // Hide these in a ready to ensure that Drupal.ajax is set up first. - Drupal.behaviors.ctools_add_ajax_responder_commands = { - attach: function () { - Drupal.ajax.prototype.commands.attr = function (ajax, data, status) { - $(data.selector).attr(data.name, data.value); - }; - - Drupal.ajax.prototype.commands.redirect = function (ajax, data, status) { - if (data.delay > 0) { - setTimeout(function () { - location.href = data.url; - }, data.delay); - } - else { - location.href = data.url; - } - }; - - Drupal.ajax.prototype.commands.reload = function (ajax, data, status) { - location.reload(); - }; - - Drupal.ajax.prototype.commands.submit = function (ajax, data, status) { - $(data.selector).submit(); - } - } - }; -})(jQuery); diff --git a/html/sites/all/modules/contrib/ctools/js/auto-submit.js b/html/sites/all/modules/contrib/ctools/js/auto-submit.js deleted file mode 100644 index 0e97e2eb5..000000000 --- a/html/sites/all/modules/contrib/ctools/js/auto-submit.js +++ /dev/null @@ -1,102 +0,0 @@ -(function($){ -/** - * To make a form auto submit, all you have to do is 3 things: - * - * ctools_add_js('auto-submit'); - * - * On gadgets you want to auto-submit when changed, add the ctools-auto-submit - * class. With FAPI, add: - * @code - * '#attributes' => array('class' => array('ctools-auto-submit')), - * @endcode - * - * If you want to have auto-submit for every form element, - * add the ctools-auto-submit-full-form to the form. With FAPI, add: - * @code - * '#attributes' => array('class' => array('ctools-auto-submit-full-form')), - * @endcode - * - * If you want to exclude a field from the ctool-auto-submit-full-form auto submission, - * add the class ctools-auto-submit-exclude to the form element. With FAPI, add: - * @code - * '#attributes' => array('class' => array('ctools-auto-submit-exclude')), - * @endcode - * - * Finally, you have to identify which button you want clicked for autosubmit. - * The behavior of this button will be honored if it's ajaxy or not: - * @code - * '#attributes' => array('class' => array('ctools-use-ajax', 'ctools-auto-submit-click')), - * @endcode - * - * Currently only 'select', 'radio', 'checkbox' and 'textfield' types are supported. We probably - * could use additional support for HTML5 input types. - */ - -Drupal.behaviors.CToolsAutoSubmit = { - attach: function(context) { - // 'this' references the form element - function triggerSubmit (e) { - if ($.contains(document.body, this)) { - var $this = $(this); - if (!$this.hasClass('ctools-ajaxing')) { - $this.find('.ctools-auto-submit-click').click(); - } - } - } - - // the change event bubbles so we only need to bind it to the outer form - $('form.ctools-auto-submit-full-form', context) - .add('.ctools-auto-submit', context) - .filter('form, select, input:not(:text, :submit)') - .once('ctools-auto-submit') - .change(function (e) { - // don't trigger on text change for full-form - if ($(e.target).is(':not(:text, :submit, .ctools-auto-submit-exclude)')) { - triggerSubmit.call(e.target.form); - } - }); - - // e.keyCode: key - var discardKeyCode = [ - 16, // shift - 17, // ctrl - 18, // alt - 20, // caps lock - 33, // page up - 34, // page down - 35, // end - 36, // home - 37, // left arrow - 38, // up arrow - 39, // right arrow - 40, // down arrow - 9, // tab - 13, // enter - 27 // esc - ]; - // Don't wait for change event on textfields - $('.ctools-auto-submit-full-form input:text, input:text.ctools-auto-submit', context) - .filter(':not(.ctools-auto-submit-exclude)') - .once('ctools-auto-submit', function () { - // each textinput element has his own timeout - var timeoutID = 0; - $(this) - .bind('keydown keyup', function (e) { - if ($.inArray(e.keyCode, discardKeyCode) === -1) { - timeoutID && clearTimeout(timeoutID); - } - }) - .keyup(function(e) { - if ($.inArray(e.keyCode, discardKeyCode) === -1) { - timeoutID = setTimeout($.proxy(triggerSubmit, this.form), 500); - } - }) - .bind('change', function (e) { - if ($.inArray(e.keyCode, discardKeyCode) === -1) { - timeoutID = setTimeout($.proxy(triggerSubmit, this.form), 500); - } - }); - }); - } -}; -})(jQuery); diff --git a/html/sites/all/modules/contrib/ctools/js/collapsible-div.js b/html/sites/all/modules/contrib/ctools/js/collapsible-div.js deleted file mode 100644 index 4719d7cc4..000000000 --- a/html/sites/all/modules/contrib/ctools/js/collapsible-div.js +++ /dev/null @@ -1,241 +0,0 @@ -/** - * @file - * Javascript required for a simple collapsible div. - * - * Creating a collapsible div with this doesn't take too much. There are - * three classes necessary: - * - * - ctools-collapsible-container: This is the overall container that will be - * collapsible. This must be a div. - * - ctools-collapsible-handle: This is the title area, and is what will be - * visible when it is collapsed. This can be any block element, such as div - * or h2. - * - ctools-collapsible-content: This is the ocntent area and will only be - * visible when expanded. This must be a div. - * - * Adding 'ctools-collapsible-remember' to the container class will cause the - * state of the container to be stored in a cookie, and remembered from page - * load to page load. This will only work if the container has a unique ID, so - * very carefully add IDs to your containers. - * - * If the class 'ctools-no-container' is placed on the container, the container - * will be the handle. The content will be found by appending '-content' to the - * id of the handle. The ctools-collapsible-handle and - * ctools-collapsible-content classes will not be required in that case, and no - * restrictions on what of data the container is are placed. Like - * ctools-collapsible-remember this requires an id to eist. - * - * The content will be 'open' unless the container class has 'ctools-collapsed' - * as a class, which will cause the container to draw collapsed. - */ - -(function ($) { - // All CTools tools begin with this if they need to use the CTools namespace. - if (!Drupal.CTools) { - Drupal.CTools = {}; - } - - /** - * Object to store state. - * - * This object will remember the state of collapsible containers. The first - * time a state is requested, it will check the cookie and set up the variable. - * If a state has been changed, when the window is unloaded the state will be - * saved. - */ - Drupal.CTools.Collapsible = { - state: {}, - stateLoaded: false, - stateChanged: false, - cookieString: 'ctools-collapsible-state=', - - /** - * Get the current collapsed state of a container. - * - * If set to 1, the container is open. If set to -1, the container is - * collapsed. If unset the state is unknown, and the default state should - * be used. - */ - getState: function (id) { - if (!this.stateLoaded) { - this.loadCookie(); - } - - return this.state[id]; - }, - - /** - * Set the collapsed state of a container for subsequent page loads. - * - * Set the state to 1 for open, -1 for collapsed. - */ - setState: function (id, state) { - if (!this.stateLoaded) { - this.loadCookie(); - } - - this.state[id] = state; - - if (!this.stateChanged) { - this.stateChanged = true; - $(window).unload(this.unload); - } - }, - - /** - * Check the cookie and load the state variable. - */ - loadCookie: function () { - // If there is a previous instance of this cookie - if (document.cookie.length > 0) { - // Get the number of characters that have the list of values - // from our string index. - offset = document.cookie.indexOf(this.cookieString); - - // If its positive, there is a list! - if (offset != -1) { - offset += this.cookieString.length; - var end = document.cookie.indexOf(';', offset); - if (end == -1) { - end = document.cookie.length; - } - - // Get a list of all values that are saved on our string - var cookie = unescape(document.cookie.substring(offset, end)); - - if (cookie != '') { - var cookieList = cookie.split(','); - for (var i = 0; i < cookieList.length; i++) { - var info = cookieList[i].split(':'); - this.state[info[0]] = info[1]; - } - } - } - } - - this.stateLoaded = true; - }, - - /** - * Turn the state variable into a string and store it in the cookie. - */ - storeCookie: function () { - var cookie = ''; - - // Get a list of IDs, saparated by comma - for (var i in this.state) { - if (cookie != '') { - cookie += ','; - } - cookie += i + ':' + this.state[i]; - } - - // Save this values on the cookie - document.cookie = this.cookieString + escape(cookie) + ';path=/'; - }, - - /** - * Respond to the unload event by storing the current state. - */ - unload: function() { - Drupal.CTools.Collapsible.storeCookie(); - } - }; - - // Set up an array for callbacks. - Drupal.CTools.CollapsibleCallbacks = []; - Drupal.CTools.CollapsibleCallbacksAfterToggle = []; - - /** - * Bind collapsible behavior to a given container. - */ - Drupal.CTools.bindCollapsible = function () { - var $container = $(this); - - // Allow the specification of the 'no container' class, which means the - // handle and the container can be completely independent. - if ($container.hasClass('ctools-no-container') && $container.attr('id')) { - // In this case, the container *is* the handle and the content is found - // by adding '-content' to the id. Obviously, an id is required. - var handle = $container; - var content = $('#' + $container.attr('id') + '-content'); - } - else { - var handle = $container.children('.ctools-collapsible-handle'); - var content = $container.children('div.ctools-collapsible-content'); - } - - if (content.length) { - // Create the toggle item and place it in front of the toggle. - var toggle = $(''); - handle.before(toggle); - - // If the remember class is set, check to see if we have a remembered - // state stored. - if ($container.hasClass('ctools-collapsible-remember') && $container.attr('id')) { - var state = Drupal.CTools.Collapsible.getState($container.attr('id')); - if (state == 1) { - $container.removeClass('ctools-collapsed'); - } - else if (state == -1) { - $container.addClass('ctools-collapsed'); - } - } - - // If we should start collapsed, do so: - if ($container.hasClass('ctools-collapsed')) { - toggle.toggleClass('ctools-toggle-collapsed'); - content.hide(); - } - - var afterToggle = function () { - if (Drupal.CTools.CollapsibleCallbacksAfterToggle) { - for (var i in Drupal.CTools.CollapsibleCallbacksAfterToggle) { - Drupal.CTools.CollapsibleCallbacksAfterToggle[i]($container, handle, content, toggle); - } - } - }; - - var clickMe = function () { - if (Drupal.CTools.CollapsibleCallbacks) { - for (var i in Drupal.CTools.CollapsibleCallbacks) { - Drupal.CTools.CollapsibleCallbacks[i]($container, handle, content, toggle); - } - } - - // If the container is a table element slideToggle does not do what - // we want, so use toggle() instead. - if ($container.is('table')) { - content.toggle(0, afterToggle); - } - else { - content.slideToggle(100, afterToggle); - } - - $container.toggleClass('ctools-collapsed'); - toggle.toggleClass('ctools-toggle-collapsed'); - - // If we're supposed to remember the state of this class, do so. - if ($container.hasClass('ctools-collapsible-remember') && $container.attr('id')) { - var state = toggle.hasClass('ctools-toggle-collapsed') ? -1 : 1; - Drupal.CTools.Collapsible.setState($container.attr('id'), state); - } - - return false; - }; - - // Let both the toggle and the handle be clickable. - toggle.click(clickMe); - handle.click(clickMe); - } - }; - - /** - * Support Drupal's 'behaviors' system for binding. - */ - Drupal.behaviors.CToolsCollapsible = { - attach: function(context) { - $('.ctools-collapsible-container', context).once('ctools-collapsible', Drupal.CTools.bindCollapsible); - } - }; -})(jQuery); diff --git a/html/sites/all/modules/contrib/ctools/js/dependent.js b/html/sites/all/modules/contrib/ctools/js/dependent.js deleted file mode 100644 index 6e4b79670..000000000 --- a/html/sites/all/modules/contrib/ctools/js/dependent.js +++ /dev/null @@ -1,244 +0,0 @@ -/** - * @file - * Provides dependent visibility for form items in CTools' ajax forms. - * - * To your $form item definition add: - * - '#process' => array('ctools_process_dependency'), - * - '#dependency' => array('id-of-form-item' => array(list, of, values, that, - * make, this, item, show), - * - * Special considerations: - * - Radios are harder. Because Drupal doesn't give radio groups individual IDs, - * use 'radio:name-of-radio'. - * - * - Checkboxes don't have their own id, so you need to add one in a div - * around the checkboxes via #prefix and #suffix. You actually need to add TWO - * divs because it's the parent that gets hidden. Also be sure to retain the - * 'form_process_checkboxes' in the #process array, because the CTools process will - * override it. - */ - -(function ($) { - Drupal.CTools = Drupal.CTools || {}; - Drupal.CTools.dependent = {}; - - Drupal.CTools.dependent.bindings = {}; - Drupal.CTools.dependent.activeBindings = {}; - Drupal.CTools.dependent.activeTriggers = []; - - Drupal.CTools.dependent.inArray = function(array, search_term) { - var i = array.length; - while (i--) { - if (array[i] == search_term) { - return true; - } - } - return false; - }; - - - Drupal.CTools.dependent.autoAttach = function() { - // Clear active bindings and triggers. - for (var i in Drupal.CTools.dependent.activeTriggers) { - $(Drupal.CTools.dependent.activeTriggers[i]).unbind('change.ctools-dependent'); - } - Drupal.CTools.dependent.activeTriggers = []; - Drupal.CTools.dependent.activeBindings = {}; - Drupal.CTools.dependent.bindings = {}; - - if (!Drupal.settings.CTools) { - return; - } - - // Iterate through all relationships - for (var id in Drupal.settings.CTools.dependent) { - // Test to make sure the id even exists; this helps clean up multiple - // AJAX calls with multiple forms. - - // Drupal.CTools.dependent.activeBindings[id] is a boolean, - // whether the binding is active or not. Defaults to no. - Drupal.CTools.dependent.activeBindings[id] = 0; - // Iterate through all possible values - for (var bind_id in Drupal.settings.CTools.dependent[id].values) { - // This creates a backward relationship. The bind_id is the ID - // of the element which needs to change in order for the id to hide or become shown. - // The id is the ID of the item which will be conditionally hidden or shown. - // Here we're setting the bindings for the bind - // id to be an empty array if it doesn't already have bindings to it - if (!Drupal.CTools.dependent.bindings[bind_id]) { - Drupal.CTools.dependent.bindings[bind_id] = []; - } - // Add this ID - Drupal.CTools.dependent.bindings[bind_id].push(id); - // Big long if statement. - // Drupal.settings.CTools.dependent[id].values[bind_id] holds the possible values - - if (bind_id.substring(0, 6) == 'radio:') { - var trigger_id = "input[name='" + bind_id.substring(6) + "']"; - } - else { - var trigger_id = '#' + bind_id; - } - - Drupal.CTools.dependent.activeTriggers.push(trigger_id); - - if ($(trigger_id).attr('type') == 'checkbox') { - $(trigger_id).siblings('label').addClass('hidden-options'); - } - - var getValue = function(item, trigger) { - if ($(trigger).length == 0) { - return null; - } - - if (item.substring(0, 6) == 'radio:') { - var val = $(trigger + ':checked').val(); - } - else { - switch ($(trigger).attr('type')) { - case 'checkbox': - // **This check determines if using a jQuery version 1.7 or newer which requires the use of the prop function instead of the attr function when not called on an attribute - if ($().prop) { - var val = $(trigger).prop('checked') ? true : false; - } - else { - var val = $(trigger).attr('checked') ? true : false; - } - - if (val) { - $(trigger).siblings('label').removeClass('hidden-options').addClass('expanded-options'); - } - else { - $(trigger).siblings('label').removeClass('expanded-options').addClass('hidden-options'); - } - - break; - default: - var val = $(trigger).val(); - } - } - return val; - }; - - var setChangeTrigger = function(trigger_id, bind_id) { - // Triggered when change() is clicked. - var changeTrigger = function() { - var val = getValue(bind_id, trigger_id); - - if (val == null) { - return; - } - - for (var i in Drupal.CTools.dependent.bindings[bind_id]) { - var id = Drupal.CTools.dependent.bindings[bind_id][i]; - // Fix numerous errors - if (typeof id != 'string') { - continue; - } - - // This bit had to be rewritten a bit because two properties on the - // same set caused the counter to go up and up and up. - if (!Drupal.CTools.dependent.activeBindings[id]) { - Drupal.CTools.dependent.activeBindings[id] = {}; - } - - if (val != null && Drupal.CTools.dependent.inArray(Drupal.settings.CTools.dependent[id].values[bind_id], val)) { - Drupal.CTools.dependent.activeBindings[id][bind_id] = 'bind'; - } - else { - delete Drupal.CTools.dependent.activeBindings[id][bind_id]; - } - - var len = 0; - for (var i in Drupal.CTools.dependent.activeBindings[id]) { - len++; - } - - var $original = $('#' + id); - if ($original.is('fieldset') || $original.is('textarea')) { - continue; - } - - var object = $original.parent(); - - if (Drupal.settings.CTools.dependent[id].type == 'disable') { - if (Drupal.settings.CTools.dependent[id].num <= len) { - // Show if the element if criteria is matched - // **This check determines if using a jQuery version 1.7 or newer which requires the use of the prop function instead of the attr function when not called on an attribute - if (typeof $().prop == 'function') { - object.prop('disabled', false); - object.addClass('dependent-options'); - object.children().prop('disabled', false); - } - else { - object.attr('disabled', false); - object.addClass('dependent-options'); - object.children().attr('disabled', false); - } - } - else { - // Otherwise hide. Use css rather than hide() because hide() - // does not work if the item is already hidden, for example, - // in a collapsed fieldset. - // **This check determines if using a jQuery version 1.7 or newer which requires the use of the prop function instead of the attr function when not called on an attribute - if (typeof $().prop == 'function') { - object.prop('disabled', true); - object.children().prop('disabled', true); - } - else { - object.attr('disabled', true); - object.children().attr('disabled', true); - } - } - } - else { - if (Drupal.settings.CTools.dependent[id].num <= len) { - // Show if the element if criteria is matched - object.show(0); - object.addClass('dependent-options'); - } - else { - // Otherwise hide. Use css rather than hide() because hide() - // does not work if the item is already hidden, for example, - // in a collapsed fieldset. - object.css('display', 'none'); - } - } - } - }; - - $(trigger_id).bind('change.ctools-dependent', function() { - // Trigger the internal change function - // the attr('id') is used because closures are more confusing - changeTrigger(trigger_id, bind_id); - }); - // Trigger initial reaction - changeTrigger(trigger_id, bind_id); - }; - setChangeTrigger(trigger_id, bind_id); - } - } - }; - - Drupal.behaviors.CToolsDependent = { - attach: function (context) { - Drupal.CTools.dependent.autoAttach(); - - // Really large sets of fields are too slow with the above method, so this - // is a sort of hacked one that's faster but much less flexible. - $("select.ctools-master-dependent") - .once('ctools-dependent') - .bind('change.ctools-dependent', function() { - var val = $(this).val(); - if (val == 'all') { - $('.ctools-dependent-all').show(0); - } - else { - $('.ctools-dependent-all').hide(0); - $('.ctools-dependent-' + val).show(0); - } - }) - .trigger('change.ctools-dependent'); - } - }; -})(jQuery); diff --git a/html/sites/all/modules/contrib/ctools/js/dropbutton.js b/html/sites/all/modules/contrib/ctools/js/dropbutton.js deleted file mode 100644 index 6d08d05a5..000000000 --- a/html/sites/all/modules/contrib/ctools/js/dropbutton.js +++ /dev/null @@ -1,94 +0,0 @@ -/** - * @file - * Implement a simple, clickable dropbutton menu. - * - * See dropbutton.theme.inc for primary documentation. - * - * The javascript relies on four classes: - * - The dropbutton must be fully contained in a div with the class - * ctools-dropbutton. It must also contain the class ctools-no-js - * which will be immediately removed by the javascript; this allows for - * graceful degradation. - * - The trigger that opens the dropbutton must be an a tag wit hthe class - * ctools-dropbutton-link. The href should just be '#' as this will never - * be allowed to complete. - * - The part of the dropbutton that will appear when the link is clicked must - * be a div with class ctools-dropbutton-container. - * - Finally, ctools-dropbutton-hover will be placed on any link that is being - * hovered over, so that the browser can restyle the links. - * - * This tool isn't meant to replace click-tips or anything, it is specifically - * meant to work well presenting menus. - */ - -(function ($) { - Drupal.behaviors.CToolsDropbutton = { - attach: function() { - // Process buttons. All dropbuttons are buttons. - $('.ctools-button') - .once('ctools-button') - .removeClass('ctools-no-js'); - - // Process dropbuttons. Not all buttons are dropbuttons. - $('.ctools-dropbutton').once('ctools-dropbutton', function() { - var $dropbutton = $(this); - var $button = $('.ctools-content', $dropbutton); - var $secondaryActions = $('li', $button).not(':first'); - var $twisty = $(".ctools-link", $dropbutton); - var open = false; - var hovering = false; - var timerID = 0; - - var toggle = function(close) { - // if it's open or we're told to close it, close it. - if (open || close) { - // If we're just toggling it, close it immediately. - if (!close) { - open = false; - $secondaryActions.slideUp(100); - $dropbutton.removeClass('open'); - } - else { - // If we were told to close it, wait half a second to make - // sure that's what the user wanted. - // Clear any previous timer we were using. - if (timerID) { - clearTimeout(timerID); - } - timerID = setTimeout(function() { - if (!hovering) { - open = false; - $secondaryActions.slideUp(100); - $dropbutton.removeClass('open'); - }}, 500); - } - } - else { - // open it. - open = true; - $secondaryActions.animate({height: "show", opacity: "show"}, 100); - $dropbutton.addClass('open'); - } - }; - // Hide the secondary actions initially. - $secondaryActions.hide(); - - $twisty.click(function() { - toggle(); - return false; - }); - - $dropbutton.hover( - function() { - hovering = true; - }, // hover in - function() { // hover out - hovering = false; - toggle(true); - return false; - } - ); - }); - } - }; -})(jQuery); diff --git a/html/sites/all/modules/contrib/ctools/js/dropdown.js b/html/sites/all/modules/contrib/ctools/js/dropdown.js deleted file mode 100644 index e2488b1ea..000000000 --- a/html/sites/all/modules/contrib/ctools/js/dropdown.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @file - * Implement a simple, clickable dropdown menu. - * - * See dropdown.theme.inc for primary documentation. - * - * The javascript relies on four classes: - * - The dropdown must be fully contained in a div with the class - * ctools-dropdown. It must also contain the class ctools-dropdown-no-js - * which will be immediately removed by the javascript; this allows for - * graceful degradation. - * - The trigger that opens the dropdown must be an a tag wit hthe class - * ctools-dropdown-link. The href should just be '#' as this will never - * be allowed to complete. - * - The part of the dropdown that will appear when the link is clicked must - * be a div with class ctools-dropdown-container. - * - Finally, ctools-dropdown-hover will be placed on any link that is being - * hovered over, so that the browser can restyle the links. - * - * This tool isn't meant to replace click-tips or anything, it is specifically - * meant to work well presenting menus. - */ - -(function ($) { - Drupal.behaviors.CToolsDropdown = { - attach: function() { - $('div.ctools-dropdown').once('ctools-dropdown', function() { - var $dropdown = $(this); - var open = false; - var hovering = false; - var timerID = 0; - - $dropdown.removeClass('ctools-dropdown-no-js'); - - var toggle = function(close) { - // if it's open or we're told to close it, close it. - if (open || close) { - // If we're just toggling it, close it immediately. - if (!close) { - open = false; - $("div.ctools-dropdown-container", $dropdown).slideUp(100); - } - else { - // If we were told to close it, wait half a second to make - // sure that's what the user wanted. - // Clear any previous timer we were using. - if (timerID) { - clearTimeout(timerID); - } - timerID = setTimeout(function() { - if (!hovering) { - open = false; - $("div.ctools-dropdown-container", $dropdown).slideUp(100); - } - }, 500); - } - } - else { - // open it. - open = true; - $("div.ctools-dropdown-container", $dropdown) - .animate({height: "show", opacity: "show"}, 100); - } - }; - $("a.ctools-dropdown-link", $dropdown).click(function() { - toggle(); - return false; - }); - - $dropdown.hover( - function() { - hovering = true; - }, // hover in - function() { // hover out - hovering = false; - toggle(true); - return false; - }); - // @todo -- just use CSS for this noise. - $("div.ctools-dropdown-container a").hover( - function() { $(this).addClass('ctools-dropdown-hover'); }, - function() { $(this).removeClass('ctools-dropdown-hover'); } - ); - }); - } - }; -})(jQuery); diff --git a/html/sites/all/modules/contrib/ctools/js/jump-menu.js b/html/sites/all/modules/contrib/ctools/js/jump-menu.js deleted file mode 100644 index 14852d5ad..000000000 --- a/html/sites/all/modules/contrib/ctools/js/jump-menu.js +++ /dev/null @@ -1,42 +0,0 @@ - -(function($) { - Drupal.behaviors.CToolsJumpMenu = { - attach: function(context) { - $('.ctools-jump-menu-hide') - .once('ctools-jump-menu') - .hide(); - - $('.ctools-jump-menu-change') - .once('ctools-jump-menu') - .change(function() { - var loc = $(this).val(); - var urlArray = loc.split('::'); - if (urlArray[1]) { - location.href = urlArray[1]; - } - else { - location.href = loc; - } - return false; - }); - - $('.ctools-jump-menu-button') - .once('ctools-jump-menu') - .click(function() { - // Instead of submitting the form, just perform the redirect. - - // Find our sibling value. - var $select = $(this).parents('form').find('.ctools-jump-menu-select'); - var loc = $select.val(); - var urlArray = loc.split('::'); - if (urlArray[1]) { - location.href = urlArray[1]; - } - else { - location.href = loc; - } - return false; - }); - } - }; -})(jQuery); diff --git a/html/sites/all/modules/contrib/ctools/js/modal.js b/html/sites/all/modules/contrib/ctools/js/modal.js deleted file mode 100644 index 92f8d7860..000000000 --- a/html/sites/all/modules/contrib/ctools/js/modal.js +++ /dev/null @@ -1,717 +0,0 @@ -/** - * @file - * - * Implement a modal form. - * - * @see modal.inc for documentation. - * - * This javascript relies on the CTools ajax responder. - */ - -(function ($) { - // Make sure our objects are defined. - Drupal.CTools = Drupal.CTools || {}; - Drupal.CTools.Modal = Drupal.CTools.Modal || {}; - - /** - * Display the modal - * - * @todo -- document the settings. - */ - Drupal.CTools.Modal.show = function(choice) { - var opts = {}; - - if (choice && typeof choice == 'string' && Drupal.settings[choice]) { - // This notation guarantees we are actually copying it. - $.extend(true, opts, Drupal.settings[choice]); - } - else if (choice) { - $.extend(true, opts, choice); - } - - var defaults = { - modalTheme: 'CToolsModalDialog', - throbberTheme: 'CToolsModalThrobber', - animation: 'show', - animationSpeed: 'fast', - modalSize: { - type: 'scale', - width: .8, - height: .8, - addWidth: 0, - addHeight: 0, - // How much to remove from the inner content to make space for the - // theming. - contentRight: 25, - contentBottom: 45 - }, - modalOptions: { - opacity: .55, - background: '#fff' - }, - modalClass: 'default' - }; - - var settings = {}; - $.extend(true, settings, defaults, Drupal.settings.CToolsModal, opts); - - if (Drupal.CTools.Modal.currentSettings && Drupal.CTools.Modal.currentSettings != settings) { - Drupal.CTools.Modal.modal.remove(); - Drupal.CTools.Modal.modal = null; - } - - Drupal.CTools.Modal.currentSettings = settings; - - var resize = function(e) { - // When creating the modal, it actually exists only in a theoretical - // place that is not in the DOM. But once the modal exists, it is in the - // DOM so the context must be set appropriately. - var context = e ? document : Drupal.CTools.Modal.modal; - - if (Drupal.CTools.Modal.currentSettings.modalSize.type == 'scale') { - var width = $(window).width() * Drupal.CTools.Modal.currentSettings.modalSize.width; - var height = $(window).height() * Drupal.CTools.Modal.currentSettings.modalSize.height; - } - else { - var width = Drupal.CTools.Modal.currentSettings.modalSize.width; - var height = Drupal.CTools.Modal.currentSettings.modalSize.height; - } - - // Use the additionol pixels for creating the width and height. - $('div.ctools-modal-content', context).css({ - 'width': width + Drupal.CTools.Modal.currentSettings.modalSize.addWidth + 'px', - 'height': height + Drupal.CTools.Modal.currentSettings.modalSize.addHeight + 'px' - }); - $('div.ctools-modal-content .modal-content', context).css({ - 'width': (width - Drupal.CTools.Modal.currentSettings.modalSize.contentRight) + 'px', - 'height': (height - Drupal.CTools.Modal.currentSettings.modalSize.contentBottom) + 'px' - }); - }; - - if (!Drupal.CTools.Modal.modal) { - Drupal.CTools.Modal.modal = $(Drupal.theme(settings.modalTheme)); - if (settings.modalSize.type == 'scale') { - $(window).bind('resize', resize); - } - } - - resize(); - - $('span.modal-title', Drupal.CTools.Modal.modal).html(Drupal.CTools.Modal.currentSettings.loadingText); - Drupal.CTools.Modal.modalContent(Drupal.CTools.Modal.modal, settings.modalOptions, settings.animation, settings.animationSpeed, settings.modalClass); - $('#modalContent .modal-content').html(Drupal.theme(settings.throbberTheme)).addClass('ctools-modal-loading'); - - // Position autocomplete results based on the scroll position of the modal. - $('#modalContent .modal-content').delegate('input.form-autocomplete', 'keyup', function() { - $('#autocomplete').css('top', $(this).position().top + $(this).outerHeight() + $(this).offsetParent().filter('#modal-content').scrollTop()); - }); - }; - - /** - * Hide the modal - */ - Drupal.CTools.Modal.dismiss = function() { - if (Drupal.CTools.Modal.modal) { - Drupal.CTools.Modal.unmodalContent(Drupal.CTools.Modal.modal); - } - }; - - /** - * Provide the HTML to create the modal dialog. - */ - Drupal.theme.prototype.CToolsModalDialog = function () { - var html = ''; - html += ''; - - return html; - }; - - /** - * Provide the HTML to create the throbber. - */ - Drupal.theme.prototype.CToolsModalThrobber = function () { - var html = ''; - html += ''; - - return html; - }; - - /** - * Figure out what settings string to use to display a modal. - */ - Drupal.CTools.Modal.getSettings = function (object) { - var match = $(object).attr('class').match(/ctools-modal-(\S+)/); - if (match) { - return match[1]; - } - }; - - /** - * Click function for modals that can be cached. - */ - Drupal.CTools.Modal.clickAjaxCacheLink = function () { - Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this)); - return Drupal.CTools.AJAX.clickAJAXCacheLink.apply(this); - }; - - /** - * Handler to prepare the modal for the response - */ - Drupal.CTools.Modal.clickAjaxLink = function () { - Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this)); - return false; - }; - - /** - * Submit responder to do an AJAX submit on all modal forms. - */ - Drupal.CTools.Modal.submitAjaxForm = function(e) { - var $form = $(this); - var url = $form.attr('action'); - - setTimeout(function() { Drupal.CTools.AJAX.ajaxSubmit($form, url); }, 1); - return false; - }; - - /** - * Bind links that will open modals to the appropriate function. - */ - Drupal.behaviors.ZZCToolsModal = { - attach: function(context) { - // Bind links - // Note that doing so in this order means that the two classes can be - // used together safely. - /* - * @todo remimplement the warm caching feature - $('a.ctools-use-modal-cache', context).once('ctools-use-modal', function() { - $(this).click(Drupal.CTools.Modal.clickAjaxCacheLink); - Drupal.CTools.AJAX.warmCache.apply(this); - }); - */ - - $('area.ctools-use-modal, a.ctools-use-modal', context).once('ctools-use-modal', function() { - var $this = $(this); - $this.click(Drupal.CTools.Modal.clickAjaxLink); - // Create a drupal ajax object - var element_settings = {}; - if ($this.attr('href')) { - element_settings.url = $this.attr('href'); - element_settings.event = 'click'; - element_settings.progress = { type: 'throbber' }; - } - var base = $this.attr('href'); - Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); - }); - - // Bind buttons - $('input.ctools-use-modal, button.ctools-use-modal', context).once('ctools-use-modal', function() { - var $this = $(this); - $this.click(Drupal.CTools.Modal.clickAjaxLink); - var button = this; - var element_settings = {}; - - // AJAX submits specified in this manner automatically submit to the - // normal form action. - element_settings.url = Drupal.CTools.Modal.findURL(this); - if (element_settings.url == '') { - element_settings.url = $(this).closest('form').attr('action'); - } - element_settings.event = 'click'; - element_settings.setClick = true; - - var base = $this.attr('id'); - Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); - - // Make sure changes to settings are reflected in the URL. - $('.' + $(button).attr('id') + '-url').change(function() { - Drupal.ajax[base].options.url = Drupal.CTools.Modal.findURL(button); - }); - }); - - // Bind our custom event to the form submit - $('#modal-content form', context).once('ctools-use-modal', function() { - var $this = $(this); - var element_settings = {}; - - element_settings.url = $this.attr('action'); - element_settings.event = 'submit'; - element_settings.progress = { 'type': 'throbber' }; - var base = $this.attr('id'); - - Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); - Drupal.ajax[base].form = $this; - - $('input[type=submit], button', this).click(function(event) { - Drupal.ajax[base].element = this; - this.form.clk = this; - // Stop autocomplete from submitting. - if (Drupal.autocompleteSubmit && !Drupal.autocompleteSubmit()) { - return false; - } - // An empty event means we were triggered via .click() and - // in jquery 1.4 this won't trigger a submit. - // We also have to check jQuery version to prevent - // IE8 + jQuery 1.4.4 to break on other events - // bound to the submit button. - if (jQuery.fn.jquery.substr(0, 3) === '1.4' && typeof event.bubbles === "undefined") { - $(this.form).trigger('submit'); - return false; - } - }); - }); - - // Bind a click handler to allow elements with the 'ctools-close-modal' - // class to close the modal. - $('.ctools-close-modal', context).once('ctools-close-modal') - .click(function() { - Drupal.CTools.Modal.dismiss(); - return false; - }); - } - }; - - // The following are implementations of AJAX responder commands. - - /** - * AJAX responder command to place HTML within the modal. - */ - Drupal.CTools.Modal.modal_display = function(ajax, response, status) { - var settings = response.settings || ajax.settings || Drupal.settings; - // If the modal does not exist yet, create it. - if ($('#modalContent').length == 0) { - Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(ajax.element)); - } - // If the modal exists run detachBehaviors before removing existing content. - else { - Drupal.detachBehaviors($('#modalContent'), settings, 'unload'); - } - $('#modal-title').html(response.title); - // Simulate an actual page load by scrolling to the top after adding the - // content. This is helpful for allowing users to see error messages at the - // top of a form, etc. - $('#modal-content').html(response.output).scrollTop(0); - $(document).trigger('CToolsAttachBehaviors', $('#modalContent')); - - // Attach behaviors within a modal dialog. - Drupal.attachBehaviors($('#modalContent'), settings); - - if ($('#modal-content').hasClass('ctools-modal-loading')) { - $('#modal-content').removeClass('ctools-modal-loading'); - } - else { - // If the modal was already shown, and we are simply replacing its - // content, then focus on the first focusable element in the modal. - // (When first showing the modal, focus will be placed on the close - // button by the show() function called above.) - $('#modal-content :focusable:first').focus(); - } - }; - - /** - * AJAX responder command to dismiss the modal. - */ - Drupal.CTools.Modal.modal_dismiss = function(command) { - Drupal.CTools.Modal.dismiss(); - $('link.ctools-temporary-css').remove(); - }; - - /** - * Display loading - */ - //Drupal.CTools.AJAX.commands.modal_loading = function(command) { - Drupal.CTools.Modal.modal_loading = function(command) { - Drupal.CTools.Modal.modal_display({ - output: Drupal.theme(Drupal.CTools.Modal.currentSettings.throbberTheme), - title: Drupal.CTools.Modal.currentSettings.loadingText - }); - }; - - /** - * Find a URL for an AJAX button. - * - * The URL for this gadget will be composed of the values of items by - * taking the ID of this item and adding -url and looking for that - * class. They need to be in the form in order since we will - * concat them all together using '/'. - */ - Drupal.CTools.Modal.findURL = function(item) { - var url = ''; - var url_class = '.' + $(item).attr('id') + '-url'; - $(url_class).each( - function() { - var $this = $(this); - if (url && $this.val()) { - url += '/'; - } - url += $this.val(); - }); - return url; - }; - - - /** - * modalContent - * @param content string to display in the content box - * @param css obj of css attributes - * @param animation (fadeIn, slideDown, show) - * @param speed (valid animation speeds slow, medium, fast or # in ms) - * @param modalClass class added to div#modalContent - */ - Drupal.CTools.Modal.modalContent = function(content, css, animation, speed, modalClass) { - // If our animation isn't set, make it just show/pop - if (!animation) { - animation = 'show'; - } - else { - // If our animation isn't "fadeIn" or "slideDown" then it always is show - if (animation != 'fadeIn' && animation != 'slideDown') { - animation = 'show'; - } - } - - if (!speed && 0 !== speed) { - speed = 'fast'; - } - - // Build our base attributes and allow them to be overriden - css = jQuery.extend({ - position: 'absolute', - left: '0px', - margin: '0px', - background: '#000', - opacity: '.55' - }, css); - - // Add opacity handling for IE. - css.filter = 'alpha(opacity=' + (100 * css.opacity) + ')'; - content.hide(); - - // If we already have modalContent, remove it. - if ($('#modalBackdrop').length) $('#modalBackdrop').remove(); - if ($('#modalContent').length) $('#modalContent').remove(); - - // position code lifted from http://www.quirksmode.org/viewport/compatibility.html - if (self.pageYOffset) { // all except Explorer - var wt = self.pageYOffset; - } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict - var wt = document.documentElement.scrollTop; - } else if (document.body) { // all other Explorers - var wt = document.body.scrollTop; - } - - // Get our dimensions - - // Get the docHeight and (ugly hack) add 50 pixels to make sure we dont have a *visible* border below our div - var docHeight = $(document).height() + 50; - var docWidth = $(document).width(); - var winHeight = $(window).height(); - var winWidth = $(window).width(); - if( docHeight < winHeight ) docHeight = winHeight; - - // Create our divs - $('body').append(''); - - // Get a list of the tabbable elements in the modal content. - var getTabbableElements = function () { - var tabbableElements = $('#modalContent :tabbable'), - radioButtons = tabbableElements.filter('input[type="radio"]'); - - // The list of tabbable elements from jQuery is *almost* right. The - // exception is with groups of radio buttons. The list from jQuery will - // include all radio buttons, when in fact, only the selected radio button - // is tabbable, and if no radio buttons in a group are selected, then only - // the first is tabbable. - if (radioButtons.length > 0) { - // First, build up an index of which groups have an item selected or not. - var anySelected = {}; - radioButtons.each(function () { - var name = this.name; - - if (typeof anySelected[name] === 'undefined') { - anySelected[name] = radioButtons.filter('input[name="' + name + '"]:checked').length !== 0; - } - }); - - // Next filter out the radio buttons that aren't really tabbable. - var found = {}; - tabbableElements = tabbableElements.filter(function () { - var keep = true; - - if (this.type == 'radio') { - if (anySelected[this.name]) { - // Only keep the selected one. - keep = this.checked; - } - else { - // Only keep the first one. - if (found[this.name]) { - keep = false; - } - found[this.name] = true; - } - } - - return keep; - }); - } - - return tabbableElements.get(); - }; - - // Keyboard and focus event handler ensures only modal elements gain focus. - modalEventHandler = function( event ) { - target = null; - if ( event ) { //Mozilla - target = event.target; - } else { //IE - event = window.event; - target = event.srcElement; - } - - var parents = $(target).parents().get(); - for (var i = 0; i < parents.length; ++i) { - var position = $(parents[i]).css('position'); - if (position == 'absolute' || position == 'fixed') { - return true; - } - } - - if ($(target).is('#modalContent, body') || $(target).filter('*:visible').parents('#modalContent').length) { - // Allow the event only if target is a visible child node - // of #modalContent. - return true; - } - else { - getTabbableElements()[0].focus(); - } - - event.preventDefault(); - }; - $('body').bind( 'focus', modalEventHandler ); - $('body').bind( 'keypress', modalEventHandler ); - - // Keypress handler Ensures you can only TAB to elements within the modal. - // Based on the psuedo-code from WAI-ARIA 1.0 Authoring Practices section - // 3.3.1 "Trapping Focus". - modalTabTrapHandler = function (evt) { - // We only care about the TAB key. - if (evt.which != 9) { - return true; - } - - var tabbableElements = getTabbableElements(), - firstTabbableElement = tabbableElements[0], - lastTabbableElement = tabbableElements[tabbableElements.length - 1], - singleTabbableElement = firstTabbableElement == lastTabbableElement, - node = evt.target; - - // If this is the first element and the user wants to go backwards, then - // jump to the last element. - if (node == firstTabbableElement && evt.shiftKey) { - if (!singleTabbableElement) { - lastTabbableElement.focus(); - } - return false; - } - // If this is the last element and the user wants to go forwards, then - // jump to the first element. - else if (node == lastTabbableElement && !evt.shiftKey) { - if (!singleTabbableElement) { - firstTabbableElement.focus(); - } - return false; - } - // If this element isn't in the dialog at all, then jump to the first - // or last element to get the user into the game. - else if ($.inArray(node, tabbableElements) == -1) { - // Make sure the node isn't in another modal (ie. WYSIWYG modal). - var parents = $(node).parents().get(); - for (var i = 0; i < parents.length; ++i) { - var position = $(parents[i]).css('position'); - if (position == 'absolute' || position == 'fixed') { - return true; - } - } - - if (evt.shiftKey) { - lastTabbableElement.focus(); - } - else { - firstTabbableElement.focus(); - } - } - }; - $('body').bind('keydown', modalTabTrapHandler); - - // Create our content div, get the dimensions, and hide it - var modalContent = $('#modalContent').css('top','-1000px'); - var $modalHeader = modalContent.find('.modal-header'); - var mdcTop = wt + Math.max((winHeight / 2) - (modalContent.outerHeight() / 2), 0); - var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); - $('#modalBackdrop').css(css).css('top', 0).css('height', docHeight + 'px').css('width', docWidth + 'px').show(); - modalContent.css({top: mdcTop + 'px', left: mdcLeft + 'px'}).hide()[animation](speed); - - // Bind a click for closing the modalContent - modalContentClose = function(){close(); return false;}; - $('.close', $modalHeader).bind('click', modalContentClose); - - // Bind a keypress on escape for closing the modalContent - modalEventEscapeCloseHandler = function(event) { - if (event.keyCode == 27) { - close(); - return false; - } - }; - - $(document).bind('keydown', modalEventEscapeCloseHandler); - - // Per WAI-ARIA 1.0 Authoring Practices, initial focus should be on the - // close button, but we should save the original focus to restore it after - // the dialog is closed. - var oldFocus = document.activeElement; - $('.close', $modalHeader).focus(); - - // Close the open modal content and backdrop - function close() { - // Unbind the events - $(window).unbind('resize', modalContentResize); - $('body').unbind( 'focus', modalEventHandler); - $('body').unbind( 'keypress', modalEventHandler ); - $('body').unbind( 'keydown', modalTabTrapHandler ); - $('.close', $modalHeader).unbind('click', modalContentClose); - $(document).unbind('keydown', modalEventEscapeCloseHandler); - $(document).trigger('CToolsCloseModalBehaviors', $('#modalContent')); - $(document).trigger('CToolsDetachBehaviors', $('#modalContent')); - - // Closing animation. - switch (animation) { - case 'fadeIn': - modalContent.fadeOut(speed, modalContentRemove); - break; - - case 'slideDown': - modalContent.slideUp(speed, modalContentRemove); - break; - - case 'show': - modalContent.hide(speed, modalContentRemove); - break; - } - } - - // Remove the content. - modalContentRemove = function () { - $('#modalContent').remove(); - $('#modalBackdrop').remove(); - - // Restore focus to where it was before opening the dialog. - $(oldFocus).focus(); - }; - - // Move and resize the modalBackdrop and modalContent on window resize. - modalContentResize = function () { - // Reset the backdrop height/width to get accurate document size. - $('#modalBackdrop').css('height', '').css('width', ''); - - // Position code lifted from: - // http://www.quirksmode.org/viewport/compatibility.html - if (self.pageYOffset) { // all except Explorer - var wt = self.pageYOffset; - } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict - var wt = document.documentElement.scrollTop; - } else if (document.body) { // all other Explorers - var wt = document.body.scrollTop; - } - - // Get our heights - var docHeight = $(document).height(); - var docWidth = $(document).width(); - var winHeight = $(window).height(); - var winWidth = $(window).width(); - if( docHeight < winHeight ) docHeight = winHeight; - - // Get where we should move content to - var modalContent = $('#modalContent'); - var mdcTop = wt + Math.max((winHeight / 2) - (modalContent.outerHeight() / 2), 0); - var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); - - // Apply the changes - $('#modalBackdrop').css('height', docHeight + 'px').css('width', docWidth + 'px').show(); - modalContent.css('top', mdcTop + 'px').css('left', mdcLeft + 'px').show(); - }; - $(window).bind('resize', modalContentResize); - }; - - /** - * unmodalContent - * @param content (The jQuery object to remove) - * @param animation (fadeOut, slideUp, show) - * @param speed (valid animation speeds slow, medium, fast or # in ms) - */ - Drupal.CTools.Modal.unmodalContent = function(content, animation, speed) - { - // If our animation isn't set, make it just show/pop - if (!animation) { var animation = 'show'; } else { - // If our animation isn't "fade" then it always is show - if (( animation != 'fadeOut' ) && ( animation != 'slideUp')) animation = 'show'; - } - // Set a speed if we dont have one - if ( !speed ) var speed = 'fast'; - - // Unbind the events we bound - $(window).unbind('resize', modalContentResize); - $('body').unbind('focus', modalEventHandler); - $('body').unbind('keypress', modalEventHandler); - $('body').unbind( 'keydown', modalTabTrapHandler ); - var $modalContent = $('#modalContent'); - var $modalHeader = $modalContent.find('.modal-header'); - $('.close', $modalHeader).unbind('click', modalContentClose); - $(document).unbind('keydown', modalEventEscapeCloseHandler); - $(document).trigger('CToolsDetachBehaviors', $modalContent); - - // jQuery magic loop through the instances and run the animations or removal. - content.each(function(){ - if ( animation == 'fade' ) { - $('#modalContent').fadeOut(speed, function() { - $('#modalBackdrop').fadeOut(speed, function() { - $(this).remove(); - }); - $(this).remove(); - }); - } else { - if ( animation == 'slide' ) { - $('#modalContent').slideUp(speed,function() { - $('#modalBackdrop').slideUp(speed, function() { - $(this).remove(); - }); - $(this).remove(); - }); - } else { - $('#modalContent').remove(); - $('#modalBackdrop').remove(); - } - } - }); - }; - -$(function() { - Drupal.ajax.prototype.commands.modal_display = Drupal.CTools.Modal.modal_display; - Drupal.ajax.prototype.commands.modal_dismiss = Drupal.CTools.Modal.modal_dismiss; -}); - -})(jQuery); diff --git a/html/sites/all/modules/contrib/ctools/js/states-show.js b/html/sites/all/modules/contrib/ctools/js/states-show.js deleted file mode 100644 index 88df58419..000000000 --- a/html/sites/all/modules/contrib/ctools/js/states-show.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @file - * Custom state for handling visibility - */ - -/** - * Add a new state to Drupal #states. We use this to toggle element-invisible - * to show/hidden #states elements. This allows elements to be visible to - * screen readers. - * - * To use: - * $form['my_form_field'] = array( - * .. - * // Only show this field if 'some_other_field' is checked. - * '#states => array( - * 'show' => array( - * 'some-other-field' => array('checked' => TRUE), - * ), - * ), - * .. - * // Required to load the 'show' state handler. - * '#attached' => array( - * 'js' => array(ctools_attach_js('states-show')), - * ), - * ); - */ - -(function ($) { - 'use strict'; - - Drupal.states.State.aliases.hidden = '!show'; - - // Show/hide form items by toggling the 'element-invisible' class. This is a - // more accessible option than the core 'visible' state. - $(document).bind('state:show', function(e) { - if (e.trigger) { - var element = $(e.target).closest('.form-item, .form-submit, .form-wrapper'); - element.toggle(e.value); - e.value === true ? element.removeClass('element-invisible') : element.addClass('element-invisible'); - } - }); - -})(jQuery); diff --git a/html/sites/all/modules/contrib/ctools/js/stylizer.js b/html/sites/all/modules/contrib/ctools/js/stylizer.js deleted file mode 100644 index 227d4f4be..000000000 --- a/html/sites/all/modules/contrib/ctools/js/stylizer.js +++ /dev/null @@ -1,220 +0,0 @@ - -(function ($) { - Drupal.CTools = Drupal.CTools || {}; - Drupal.CTools.Stylizer = {}; - - Drupal.CTools.Stylizer.addFarbtastic = function(context) { - // This behavior attaches by ID, so is only valid once on a page. - if ($('#ctools_stylizer_color_scheme_form .color-form.Stylizer-processed').length) { - return; - } - - var form = $('.color-form', context); - var inputs = []; - var hooks = []; - var locks = []; - var focused = null; - - // Add Farbtastic - $(form).prepend('
').addClass('color-processed'); - var farb = $.farbtastic('#placeholder'); - - // Decode reference colors to HSL - /*var reference = Drupal.settings.Stylizer.reference.clone(); - for (var i in reference) { - reference[i] = farb.RGBToHSL(farb.unpack(reference[i])); - } */ - - // Set up colorscheme selector - $('#edit-scheme', form).change(function () { - var colors = this.options[this.selectedIndex].value; - if (colors != '') { - colors = colors.split(','); - for (var i in colors) { - callback(inputs[i], colors[i], false, true); - } - } - }); - - /** - * Shift a given color, using a reference pair (ref in HSL). - * - * This algorithm ensures relative ordering on the saturation and luminance - * axes is preserved, and performs a simple hue shift. - * - * It is also symmetrical. If: shift_color(c, a, b) == d, - * then shift_color(d, b, a) == c. - */ - function shift_color(given, ref1, ref2) { - // Convert to HSL - given = farb.RGBToHSL(farb.unpack(given)); - - // Hue: apply delta - given[0] += ref2[0] - ref1[0]; - - // Saturation: interpolate - if (ref1[1] == 0 || ref2[1] == 0) { - given[1] = ref2[1]; - } - else { - var d = ref1[1] / ref2[1]; - if (d > 1) { - given[1] /= d; - } - else { - given[1] = 1 - (1 - given[1]) * d; - } - } - - // Luminance: interpolate - if (ref1[2] == 0 || ref2[2] == 0) { - given[2] = ref2[2]; - } - else { - var d = ref1[2] / ref2[2]; - if (d > 1) { - given[2] /= d; - } - else { - given[2] = 1 - (1 - given[2]) * d; - } - } - - return farb.pack(farb.HSLToRGB(given)); - } - - /** - * Callback for Farbtastic when a new color is chosen. - */ - function callback(input, color, propagate, colorscheme) { - // Set background/foreground color - $(input).css({ - backgroundColor: color, - 'color': farb.RGBToHSL(farb.unpack(color))[2] > 0.5 ? '#000' : '#fff' - }); - - // Change input value - if (input.value && input.value != color) { - input.value = color; - - // Update locked values - if (propagate) { - var i = input.i; - for (j = i + 1; ; ++j) { - if (!locks[j - 1] || $(locks[j - 1]).is('.unlocked')) break; - var matched = shift_color(color, reference[input.key], reference[inputs[j].key]); - callback(inputs[j], matched, false); - } - for (j = i - 1; ; --j) { - if (!locks[j] || $(locks[j]).is('.unlocked')) break; - var matched = shift_color(color, reference[input.key], reference[inputs[j].key]); - callback(inputs[j], matched, false); - } - - } - - // Reset colorscheme selector - if (!colorscheme) { - resetScheme(); - } - } - - } - - /** - * Reset the color scheme selector. - */ - function resetScheme() { - $('#edit-scheme', form).each(function () { - this.selectedIndex = this.options.length - 1; - }); - } - - // Focus the Farbtastic on a particular field. - function focus() { - var input = this; - // Remove old bindings - focused && $(focused).unbind('keyup', farb.updateValue) - .unbind('keyup', resetScheme) - .parent().removeClass('item-selected'); - - // Add new bindings - focused = this; - farb.linkTo(function (color) { callback(input, color, true, false); }); - farb.setColor(this.value); - $(focused).keyup(farb.updateValue).keyup(resetScheme) - .parent().addClass('item-selected'); - } - - // Initialize color fields - $('#palette input.form-text', form) - .each(function () { - // Extract palette field name - this.key = this.id.substring(13); - - // Link to color picker temporarily to initialize. - farb.linkTo(function () {}).setColor('#000').linkTo(this); - - // Add lock - var i = inputs.length; - if (inputs.length) { - var lock = $('
').toggle( - function () { - $(this).addClass('unlocked'); - $(hooks[i - 1]).attr('class', - locks[i - 2] && $(locks[i - 2]).is(':not(.unlocked)') ? 'hook up' : 'hook' - ); - $(hooks[i]).attr('class', - locks[i] && $(locks[i]).is(':not(.unlocked)') ? 'hook down' : 'hook' - ); - }, - function () { - $(this).removeClass('unlocked'); - $(hooks[i - 1]).attr('class', - locks[i - 2] && $(locks[i - 2]).is(':not(.unlocked)') ? 'hook both' : 'hook down' - ); - $(hooks[i]).attr('class', - locks[i] && $(locks[i]).is(':not(.unlocked)') ? 'hook both' : 'hook up' - ); - } - ); - $(this).after(lock); - locks.push(lock); - } - - // Add hook - var $this = $(this); - var hook = $('
'); - $this.after(hook); - hooks.push(hook); - - $this.parent().find('.lock').click(); - this.i = i; - inputs.push(this); - }) - .focus(focus); - - $('#palette label', form); - - // Focus first color - focus.call(inputs[0]); - }; - - Drupal.behaviors.CToolsColorSettings = { - attach: function() { - $('.ctools-stylizer-color-edit:not(.ctools-color-processed)') - .addClass('ctools-color-processed') - .each(function() { - Drupal.CTools.Stylizer.addFarbtastic('#' + $(this).attr('id')); - }); - - $('div.form-item div.ctools-style-icon:not(.ctools-color-processed)') - .addClass('ctools-color-processed') - .click(function() { - $widget = $('input', $(this).parent()); - // Toggle if a checkbox, turn on if a radio. - $widget.attr('checked', !$widget.attr('checked') || $widget.is('input[type=radio]')); - }); - } - }; -})(jQuery); diff --git a/html/sites/all/modules/contrib/ctools/page_manager/css/page-manager.css b/html/sites/all/modules/contrib/ctools/page_manager/css/page-manager.css deleted file mode 100644 index 5abe39e24..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/css/page-manager.css +++ /dev/null @@ -1,372 +0,0 @@ -body form#page-manager-list-pages-form { - margin: 0 0 20px 0; -} - -#page-manager-list-pages-form .form-item { - padding-right: 1em; /* LTR */ - float: left; /* LTR */ - margin-top: 0; - margin-bottom: 0; -} - -#page-manager-list-pages { - width: 100%; -} - -#edit-order-wrapper { - clear: left; /* LTR */ -} - -#edit-pages-apply, -#edit-pages-reset { - margin-top: 1.65em; - float: left; /* LTR */ -} - -#page-manager-edit { - margin-top: 1em; -} - -#page-manager-edit table { - width: 100%; -} - -#page-manager-edit table tr.even { - background-color: #fafafa; -} - -#page-manager-list-pages tr.page-manager-disabled td { - color: #999; -} - -#page-manager-list-pages tr.page-manager-locked td.page-manager-page-name { - font-style: italic; - color: green; - padding-left: 22px; /* LTR */ - background: url(../images/locked.png) no-repeat scroll left center; /* LTR */ -} - -#page-manager-list-pages tr.page-manager-locked-other td.page-manager-page-name { - font-style: italic; - color: red; - padding-left: 22px; /* LTR */ - background: url(../images/locked-other.png) no-repeat scroll left center; /* LTR */ -} - -/* Force the background color to inherit so that the dropbuttons do not need - a specific background color. */ -#page-manager-list-pages td.page-manager-page-operations { - vertical-align: top; - position: relative; - text-align: right; -} - -#page-manager-list-pages td.page-manager-page-operations .ctools-dropbutton { - text-align: left; /* LTR */ -} - - - -#page-manager-edit .page-manager-wrapper { - margin: 0; - padding: 0 0 0 149px; - color: #494949; -} - -#page-manager-edit .page-manager-tabs { - border: 1px solid #aaa; -} - -#page-manager-edit .page-manager-edit-operations { - float: left; /* LTR */ - width: 150px; - margin-left: -150px; - margin-top: -1px; - height: 100%; - font-size: 90%; -} - -#page-manager-edit .page-manager-edit-operations .inside { - border-top: 1px solid #aaa; - border-bottom: 1px solid #aaa; -} - -#page-manager-edit .page-manager-edit-operations ul { - margin-top: 0; - margin-bottom: 0; - padding: 0; - margin-left: 0; -} - -#page-manager-edit .page-manager-edit-operations li { - list-style: none; - background: #f6f6f6; - border-top: 1px solid #aaa; - border-left: 1px solid #aaa; - border-right: 1px solid #aaa; - padding: 0 0 0 0; - margin: 0; - line-height: 2em; -} - -#page-manager-edit .page-manager-edit-operations li.active, -#page-manager-edit .page-manager-edit-operations li.active-group .page-manager-group-title { - background: #ffffff url(../images/arrow-active.png) no-repeat scroll right center; -} - -#page-manager-edit .page-manager-edit-operations li.changed, -#page-manager-edit .page-manager-edit-operations li.changed-group .page-manager-group-title { - background-color: #ffe; - font-weight: bold; -} - -/** provide a reset for non active stray paths */ -#page-manager-edit .page-manager-edit-operations li.active-group li.not-active .page-manager-group-title, -#page-manager-edit .page-manager-edit-operations li.changed-group li.not-changed .page-manager-group-title { - background: #f6f6f6; -} - -#page-manager-edit .page-manager-edit-operations li.active { - border-right: 1px solid white; -} - -#page-manager-edit .page-manager-edit-operations li.active a, -#page-manager-edit .page-manager-edit-operations li.active a:hover { - background: #ffffff url(../images/arrow-active.png) no-repeat scroll right center; - color: #000000; - font-weight: bold; -} - -#page-manager-edit .page-manager-edit-operations li.operation-first { - border-top: none; -} - -#page-manager-edit .page-manager-edit-operations li li.operation-first { - border-top: 1px solid #aaa; -} - -#page-manager-edit .page-manager-edit-operations li a { - display: block; - padding: 0 0 0 .5em; - color: #494949; -} - -#page-manager-edit .page-manager-edit-operations li a:hover { - background-color: #eee; - text-decoration: none; -} - -#page-manager-edit .ctools-collapsible-container { - display: inline-block; - position: relative; - *float: left; /* LTR */ - width: 100%; -} - -#page-manager-edit .page-manager-edit-operations li .ctools-collapsible-handle:hover { - background-color: #eee; -} - -#page-manager-edit .page-manager-edit-operations li li { - border-right: none; - border-left: none; - margin-left: 1em; -} - -#page-manager-edit .page-manager-edit-operations li ul { -} - -#page-manager-edit .page-manager-group-title { - line-height: 2em; - font-weight: bold; - padding: 0 0 0 .5em; -} - -/* Change the position of the arrow on the dropdown to look nicer with our defaults. */ -#page-manager-edit .page-manager-edit-operations .ctools-toggle { - background-position: 0 9px; - width: 10px; -} - -#page-manager-edit .page-manager-ajax-pad { - float: left; /* LTR */ - width: 100%; - border-left: none; - height: 100%; - background: white; -} - -/** A riser to force the ajax pad to a minimum height. **/ -#page-manager-edit .page-manager-ajax-pad .page-manager-riser { - width: 1px; - float: right; /* LTR */ - height: 400px; -} - -#page-manager-edit .page-manager-ajax-pad .page-manager-riser span { - display: none; -} - -#page-manager-edit .page-manager-ajax-pad .content-title { - font-weight: bold; - font-size: 120%; - background-color: #fafafa; - border-bottom: 1px solid #aaa; - border-left: 1px solid #aaa; - margin-left: -1px; - padding: 2px 5px 2px 20px; -} - -#page-manager-edit .actions { - padding: 0 0 0 20px; -} - -#page-manager-edit .primary-actions li { - border-top: 1px solid #aaa; -} - -#page-manager-edit .secondary-actions { - border-bottom: 1px solid #aaa; -} - -#page-manager-edit .handler-actions { - float: right; /* LTR */ -} - -#page-manager-edit .actions .page-manager-group-title { - float: left; /* LTR */ - padding-left: 0; -} - -#page-manager-edit .actions ul { - float: right; /* LTR */ - text-align: right; /* LTR */ - padding: 0; - margin: 0; - border-right: 1px solid #aaa; -} - -#page-manager-edit .handler-title .actions ul { - border-right: none; -} - -#page-manager-edit .actions li { - float: left; /* LTR */ - background: none; - list-style: none; - border-left: 1px solid #aaa; - margin: 0; - padding: 0; -} - -#page-manager-edit .actions ul li.operation-last { - border-right: none; -} - -#page-manager-edit .actions li a:hover { - background-color: #eee; - text-decoration: none; -} - -#page-manager-edit .actions li a { - display: block; - padding: 0.2em 0.5em; - color: #0062a0; - background-color: #f6f6f6; -} - -#page-manager-edit .page-manager-changed { - float: right; /* LTR */ - font-style: italic; - color: #f93; - padding-left: 1em; - padding-right: 22px; - background: url(../images/locked.png) no-repeat scroll right center; -} - -#page-manager-edit .page-manager-ajax-pad .content-content { - padding: .5em 20px; -} - -#page-manager-edit .page-manager-ajax-pad textarea { - width: 100%; -} - -#page-manager-edit .changed-notification { - border: 1px solid #aaa; - background-color: #ffe; - color: #494949; - padding: 1em; - margin-top: 1em; -} - -#page-manager-edit .ctools-locked { - margin-bottom: 2em; -} - -#page-manager-page-summary .title { - font-weight: bold; - font-size: 160%; -} - -#page-manager-page-summary .handler-summary { -} - -#page-manager-page-summary .page-summary-operation { - text-align: right; -} - -#page-manager-page-summary .page-summary-label { - width: 8em; - font-weight: bold; -} - - -.handler-summary dl { - margin: 0; -} - -.handler-summary dt { - margin: 0; - padding: 0; -} - -.handler-summary dd { - margin: 0; -} - -.handler-summary ol { - margin: 0; -} - -.handler-summary .handler-title { - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - background: #fafafa; - padding: 0 0 0 5px; - margin-top: .5em; -} - -.handler-summary .handler-title .title-label { - font-weight: bold; - font-size: 120%; - line-height: 1.75em; -} - - -/** Override that obnoxious float on throbber. **/ -#page-manager-edit .progress-disabled { - float: none; -} - -#page-manager-edit .progress-disabled + .ajax-progress { - float: right; - position: relative; - top: -2em; -} - -#page-manager-list-pages-form .progress-disabled + .ajax-progress { - position: relative; - top: 2em; - left: -.5em; -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/about.html b/html/sites/all/modules/contrib/ctools/page_manager/help/about.html deleted file mode 100644 index fa58acafb..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/about.html +++ /dev/null @@ -1,11 +0,0 @@ -The Page Manager module creates and manages pages in your Drupal site. Pages are defined as items that have a path and provide output to the user. It is a complete round trip from getting user input to providing user output. - -There are two types of pages that the Page Manager currently supports: -
-
Custom pages
-
Custom pages are defined completely by the administrator. Their path, access control and visible menu characteristics are completely arbitrary.
-
System pages
-
System pages are defined by Drupal and Drupal modules. They primarily override pre-existing pages to provide different functionality. They often do not allow such features as access control in favor of what already exists, and they will usually 'fall back' to default Drupal behavior. -
- -Both types of pages figure out what to show the user by using Variants. Variants are output handlers, and every page should have at least one. Most pages will simply have only one. Pages with multiple variants will choose one and only one Variant to display content to the user and will use the Selection Rules to figure out which Variant to display. \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/api-task-handler.html b/html/sites/all/modules/contrib/ctools/page_manager/help/api-task-handler.html deleted file mode 100644 index 4544a2a86..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/api-task-handler.html +++ /dev/null @@ -1,43 +0,0 @@ -task handler definition: - title -- visible title of the task handler. - description -- description of the task handler. - task type -- The type of the task this handler can service. - render -- callback of the function to render the handler. The arguments to this callback are specific to the task type. - admin title -- callback to render the admin title as this handler is listed. - params: $handler, $task, $subtask_id - admin summary -- callback to render what's in the collapsible info as the handler is listed. Optional. - params: $handler, $task, $subtask_id - default conf -- either an array() of default conf data or a callback that returns an array. - params: $handler, $task, $subtask_id - save -- callback to call just prior to the task handler being saved so it can adjust its data. - params: &$handler, $update (as drupal_write_record would receive) - export -- callback to call just prior to the task being exported. It should return text to append to the export if necessary. - params: &$handler, $indent - - forms => array( - 'id' => array( - 'form' => form callback (receives $form, $form_state) - 'submit' => submit callback - 'validate' => validate callback - 'include' => an optional file to include to get functionality for this form. Must include full path. - 'no return' => hide the 'return' button, meaning that the form requires extra steps if submitted - 'alternate next' => an alternate next form. Used for hidden edit forms that don't have tabs. - 'no blocks' => if TRUE, use Drupal's mechanism to not render blocks for this form. - ) - ) - ), - - 'add forms' => array( - 'form1', => t('form title'), - 'form2', => t('form title'), - // ...etc.../ -), - 'edit forms' => array( - 'id' => t('tab name'), - 'id2' => t('tab name'), - ), - - If a form name is blank it is a 'hidden' form -- it has no tab but can still be reached. - - -Notes: Because #required validation cannot be skipped when clicking cancel, please don't use it. \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/api-task-type.html b/html/sites/all/modules/contrib/ctools/page_manager/help/api-task-type.html deleted file mode 100644 index eb87265f6..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/api-task-type.html +++ /dev/null @@ -1,2 +0,0 @@ - -defines a task type, grouping tasks together and providing a common UI for them. \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/api-task.html b/html/sites/all/modules/contrib/ctools/page_manager/help/api-task.html deleted file mode 100644 index cd6e3d0cb..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/api-task.html +++ /dev/null @@ -1,38 +0,0 @@ -task definition: - title -- visible title of the task. - description -- description of the task. - hook menu -- function to delegate from hook_menu. Params: &$items, $task - hook menu alter -- function to delegate from hook_menu_alter. Params: &$items, $task - hook theme -- function to delegate from hook_theme. Params: &$items, $task - - admin name -- if set an admin menu will appear in the delegator UI - admin description -- to describe the admin menu - - admin access callback -- if set, the callback to use to determine administrative - access to this task. Defaults to user_access. Note that this is required even - if delegator isn't handling administration, since this gets used to on handler - edit forms. - admin access arguments -- If set, the arguments to use to determine administrative - access to this task. Defaults to array('administer delegator'); - - type -- The type of the task, used to determine which handlers can service it. - - subtasks -- can be TRUE in which case it supports subtasks with the default - configuration or a string (array?) with callbacks to fetch subtask data. - subtask callback -- A callback which returns just one subtask. Param: $task, $subtask_id - subtasks callback -- A callback which returns an array of all subtasks. - This MUST return an array, even if it's empty.Param: $task - - default handlers -- If the task contains any default handlers, they can be included here. - -task names must not contain a - as that is used to separate the task name from the subtask ID. - -subtasks implement data very similar to their parent task. In particular, they -implement the following items exactly like their task: - hook menu - hook menu alter - description - admin name - admin description - admin access callback - admin access arguments diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/custom-pages-access.html b/html/sites/all/modules/contrib/ctools/page_manager/help/custom-pages-access.html deleted file mode 100644 index a2643c28c..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/custom-pages-access.html +++ /dev/null @@ -1,2 +0,0 @@ - -Please visit http://drupal.org/node/528072 to help provide this documentation page. \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/custom-pages-arguments.html b/html/sites/all/modules/contrib/ctools/page_manager/help/custom-pages-arguments.html deleted file mode 100644 index 516a4292b..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/custom-pages-arguments.html +++ /dev/null @@ -1,2 +0,0 @@ - -Please visit http://drupal.org/node/528058 to help provide this documentation page. \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/custom-pages-menu.html b/html/sites/all/modules/contrib/ctools/page_manager/help/custom-pages-menu.html deleted file mode 100644 index 48cf9c397..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/custom-pages-menu.html +++ /dev/null @@ -1,2 +0,0 @@ - -Please visit http://drupal.org/node/528078 to help provide this documentation page. \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/custom-pages.html b/html/sites/all/modules/contrib/ctools/page_manager/help/custom-pages.html deleted file mode 100644 index 18e66d4be..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/custom-pages.html +++ /dev/null @@ -1,2 +0,0 @@ - -Please visit http://drupal.org/node/528050 to help provide this documentation page. \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-create.html b/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-create.html deleted file mode 100644 index a3d295e38..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-create.html +++ /dev/null @@ -1,2 +0,0 @@ - -Please visit http://drupal.org/node/528038 to help provide this documentation page. \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-custom-nodes.html b/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-custom-nodes.html deleted file mode 100644 index d62eb0f32..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-custom-nodes.html +++ /dev/null @@ -1,2 +0,0 @@ - -Please visit http://drupal.org/node/528044 to help provide this documentation page. \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-custom-vocabulary.html b/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-custom-vocabulary.html deleted file mode 100644 index 7148cd96a..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-custom-vocabulary.html +++ /dev/null @@ -1,2 +0,0 @@ - -Please visit http://drupal.org/node/528046 to help provide this documentation page. \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-members.html b/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-members.html deleted file mode 100644 index 87b21227c..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-members.html +++ /dev/null @@ -1,2 +0,0 @@ - -Please visit http://drupal.org/node/528040 to help provide this documentation page. \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-page-list.html b/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-page-list.html deleted file mode 100644 index d60bea4ad..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started-page-list.html +++ /dev/null @@ -1,2 +0,0 @@ - -Please visit http://drupal.org/node/528036 to help provide this documentation page. \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started.html b/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started.html deleted file mode 100644 index 6a75a3706..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/getting-started.html +++ /dev/null @@ -1,15 +0,0 @@ - -Note: this page is currently very preliminary. Please visit http://drupal.org/node/528034 to help provide this documentation page! - -This is a quick summary: - -
    -
  • Visit administer >> structure >> pages to get to the primary page manager interface.
  • -
  • You can add custom pages for your basic landing pages, front pages, whatever you like for normal content display.
  • -
  • You can use the system pages to create finer control of how taxonomy vocabularies, nodes and user profiles are displayed.
  • -
  • When you add your first custom page, do not bother with the optional features. You will not need these until you get to more advanced tasks.
  • -
  • The selection rules are the key to creating node displays for just one node type.
  • -
  • Everything in this system is pluggable. A little PHP knowledge and exploration of the plugins directories can take you a long way.
  • -
- - diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/page-task-type.html b/html/sites/all/modules/contrib/ctools/page_manager/help/page-task-type.html deleted file mode 100644 index c382c76ff..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/page-task-type.html +++ /dev/null @@ -1,4 +0,0 @@ - -Additional 'task' keys support: - -operations -- a list of operations suitable for theme('links') \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/page_manager.help.ini b/html/sites/all/modules/contrib/ctools/page_manager/help/page_manager.help.ini deleted file mode 100644 index 05cadb482..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/page_manager.help.ini +++ /dev/null @@ -1,59 +0,0 @@ -[advanced help settings] -line break = TRUE - -[about] -title = About Page Manager -weight = -100 - -[getting-started] -title = Getting Started -weight = -80 - -[getting-started-page-list] -title = The page list -weight = -90 -parent = getting-started - -[getting-started-create] -title = Creating a page -weight = -80 -parent = getting-started - -[getting-started-members] -title = Tutorial: Make a page that looks different for members -weight = -70 -parent = getting-started - -[getting-started-custom-nodes] -title = Tutorial: Customize the look of a single node type -weight = -60 -parent = getting-started - -[getting-started-custom-vocabulary] -title = Tutorial: Customize the look of a single taxonomy vocabulary -weight = -50 -parent = getting-started - -[custom-pages] -title = Custom pages -weight = -50 - -[custom-pages-arguments] -title = Arguments -weight = -100 -parent = custom-pages - -[custom-pages-access] -title = Access control -weight = -90 -parent = custom-pages - -[custom-pages-menu] -title = Menu items -weight = -80 -parent = custom-pages - -[variants] -title = Variants -weight = -40 - diff --git a/html/sites/all/modules/contrib/ctools/page_manager/help/variants.html b/html/sites/all/modules/contrib/ctools/page_manager/help/variants.html deleted file mode 100644 index 48cf9c397..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/help/variants.html +++ /dev/null @@ -1,2 +0,0 @@ - -Please visit http://drupal.org/node/528078 to help provide this documentation page. \ No newline at end of file diff --git a/html/sites/all/modules/contrib/ctools/page_manager/images/arrow-active.png b/html/sites/all/modules/contrib/ctools/page_manager/images/arrow-active.png deleted file mode 100644 index 3bbd3c27f..000000000 Binary files a/html/sites/all/modules/contrib/ctools/page_manager/images/arrow-active.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/page_manager/images/locked-other.png b/html/sites/all/modules/contrib/ctools/page_manager/images/locked-other.png deleted file mode 100644 index b84a154e8..000000000 Binary files a/html/sites/all/modules/contrib/ctools/page_manager/images/locked-other.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/page_manager/images/locked.png b/html/sites/all/modules/contrib/ctools/page_manager/images/locked.png deleted file mode 100644 index 2116eb1c8..000000000 Binary files a/html/sites/all/modules/contrib/ctools/page_manager/images/locked.png and /dev/null differ diff --git a/html/sites/all/modules/contrib/ctools/page_manager/js/page-list.js b/html/sites/all/modules/contrib/ctools/page_manager/js/page-list.js deleted file mode 100644 index 16b52911d..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/js/page-list.js +++ /dev/null @@ -1,44 +0,0 @@ - -/** - * Provide some extra responses for the page list so we can have automatic - * on change. - */ - -Drupal.behaviors.PageManagerList = function() { - var timeoutID = 0; - $('form#page-manager-list-pages-form select:not(.pm-processed)') - .addClass('pm-processed') - .change(function() { - $('#edit-pages-apply').click(); - }); - $('form#page-manager-list-pages-form input[type=text]:not(.pm-processed)') - .addClass('pm-processed') - .keyup(function(e) { - switch (e.keyCode) { - case 16: // shift - case 17: // ctrl - case 18: // alt - case 20: // caps lock - case 33: // page up - case 34: // page down - case 35: // end - case 36: // home - case 37: // left arrow - case 38: // up arrow - case 39: // right arrow - case 40: // down arrow - case 9: // tab - case 13: // enter - case 27: // esc - return false; - default: - if (!$('#edit-pages-apply').hasClass('ctools-ajaxing')) { - if ((timeoutID)) { - clearTimeout(timeoutID); - } - - timeoutID = setTimeout(function() { $('#edit-pages-apply').click(); }, 300); - } - } - }); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/page_manager.admin.inc b/html/sites/all/modules/contrib/ctools/page_manager/page_manager.admin.inc deleted file mode 100644 index f4acb78a1..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/page_manager.admin.inc +++ /dev/null @@ -1,1927 +0,0 @@ - 'page_manager', - 'topic' => 'getting-started', - 'type' => t('See the getting started guide for more information.'), - ))); - } - - $tasks = page_manager_get_tasks_by_type('page'); - $pages = array('operations' => array(), 'tasks' => array()); - - page_manager_get_pages($tasks, $pages); - - // Add lock icon to all locked tasks. - global $user; - - ctools_include('object-cache'); - $locks = ctools_object_cache_test_objects('page_manager_page', $pages['tasks']); - foreach ($locks as $task_name => $lock) { - if ($lock->uid == $user->uid) { - $pages['rows'][$task_name]['class'][] = ' page-manager-locked'; - $pages['rows'][$task_name]['title'] = t('This page is currently locked for editing by you. Nobody else may edit this page until these changes are saved or canceled.'); - } - else { - $pages['rows'][$task_name]['class'][] = ' page-manager-locked-other'; - $pages['rows'][$task_name]['title'] = t('This page is currently locked for editing by another user. You may not edit this page without breaking the lock.'); - } - } - - $input = $_POST; - - // Respond to a reset command by clearing session and doing a drupal goto - // back to the base URL. - if (isset($input['op']) && $input['op'] == t('Reset')) { - unset($_SESSION['page_manager']['#admin']); - if (!$js) { - drupal_goto($_GET['q']); - } - // clear everything but form id, form build id and form token: - $keys = array_keys($input); - foreach ($keys as $id) { - if ($id != 'form_id' && $id != 'form_build_id' && $id != 'form_token') { - unset($input[$id]); - } - } - $replace_form = TRUE; - } - if (count($input) <= 1) { - if (isset($_SESSION['page_manager']['#admin']) && is_array($_SESSION['page_manager']['#admin'])) { - $input = $_SESSION['page_manager']['#admin']; - } - } - else { - $_SESSION['page_manager']['#admin'] = $input; - unset($_SESSION['page_manager']['#admin']['q']); - } - - $form_state = array( - 'pages' => &$pages, - 'input' => $input, - 'rerender' => TRUE, - 'no_redirect' => TRUE, - ); - - // This form will sort and filter the pages. - $form = drupal_build_form('page_manager_list_pages_form', $form_state); - - $header = array( - array('data' => t('Type'), 'class' => array('page-manager-page-type')), - array('data' => t('Module'), 'class' => array('page-manager-page-module')), - array('data' => t('Name'), 'class' => array('page-manager-page-name')), - array('data' => t('Title'), 'class' => array('page-manager-page-title')), - array('data' => t('Path'), 'class' => array('page-manager-page-path')), - array('data' => t('Storage'), 'class' => array('page-manager-page-storage')), - ); - - $header[] = array('data' => t('Operations'), 'class' => array('page-manager-page-operations')); - $table = theme('table', array('header' => $header, 'rows' => $pages['rows'], 'attributes' => array('id' => 'page-manager-list-pages'))); - - $operations = ''; - - drupal_add_css(drupal_get_path('module', 'page_manager') . '/css/page-manager.css'); - - - if (!$js) { - return array('#markup' => drupal_render($form) . $table . $operations); - } - - ctools_include('ajax'); - $commands = array(); - $commands[] = ajax_command_replace('#page-manager-list-pages', $table); - if (!empty($replace_form)) { - $commands[] = ajax_command_replace('#page-manager-list-pages-form', drupal_render($form)); - } - print ajax_render($commands); - ajax_footer(); -} - -/** - * Sort tasks into buckets based upon whether or not they have subtasks. - */ -function page_manager_get_pages($tasks, &$pages, $task_id = NULL) { - foreach ($tasks as $id => $task) { - if (empty($task_id) && !empty($task['page operations'])) { - $pages['operations'] = array_merge($pages['operations'], $task['page operations']); - } - - // If a type has subtasks, add its subtasks in its own table. - if (!empty($task['subtasks'])) { - page_manager_get_pages(page_manager_get_task_subtasks($task), $pages, $task['name']); - continue; - } - - if (isset($task_id)) { - $task_name = page_manager_make_task_name($task_id, $task['name']); - } - else { - $task_name = $task['name']; - } - - $class = array('page-task-' . $id); - if (isset($task['row class'])) { - $class[] = $task['row class']; - } - - if (!empty($task['disabled'])) { - $class[] = 'page-manager-disabled'; - } - - $path = array(); - $visible_path = ''; - if (!empty($task['admin path'])) { - foreach (explode('/', $task['admin path']) as $bit) { - if (isset($bit[0]) && $bit[0] != '!') { - $path[] = $bit; - } - } - - $path = implode('/', $path); - if (empty($task['disabled']) && strpos($path, '%') === FALSE) { - $visible_path = l('/' . $task['admin path'], $path); - } - else { - $visible_path = '/' . $task['admin path']; - } - } - - $row = array('data' => array(), 'class' => $class, 'title' => strip_tags($task['admin description'])); - - $type = isset($task['admin type']) ? $task['admin type'] : t('System'); - if (isset($task['module'])) { - $module = $task['module']; - } - elseif (isset($task['subtask']->export_module)) { - $module = $task['subtask']->export_module; - } - else { - $module = ''; - } - $pages['types'][$type] = $type; - $row['data']['type'] = array('data' => $type, 'class' => array('page-manager-page-type')); - $row['data']['module'] = array('data' => $module, 'class' => array('page-manager-page-module')); - $row['data']['name'] = array('data' => $task_name, 'class' => array('page-manager-page-name')); - $row['data']['title'] = array('data' => $task['admin title'], 'class' => array('page-manager-page-title')); - $row['data']['path'] = array('data' => $visible_path, 'class' => array('page-manager-page-path')); - - $storage = isset($task['storage']) ? $task['storage'] : t('In code'); - $pages['storages'][$storage] = $storage; - $row['data']['storage'] = array('data' => $storage, 'class' => array('page-manager-page-storage')); - - -/* - if (empty($task['disabled'])) { - $item = menu_get_item($path); - if (empty($item)) { - dsm($path); - } - else { - dsm($item); - } - } -*/ - $operations = array( - array( - 'title' => t('Edit'), - 'href' => page_manager_edit_url($task_name), - ), - ); - - if (!empty($task['enable callback'])) { - if (!empty($task['disabled'])) { - array_unshift($operations, array( - 'title' => t('Enable'), - 'href' => 'admin/structure/pages/nojs/enable/' . $task_name, - 'query' => array('token' => drupal_get_token($task_name)), - )); - } - else { - $operations[] = array( - 'title' => t('Disable'), - 'href' => 'admin/structure/pages/nojs/disable/' . $task_name, - 'query' => array('token' => drupal_get_token($task_name)), - ); - } - } - - $ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline')))); - - $row['data']['operations'] = array('data' => $ops, 'class' => array('page-manager-page-operations')); - - $pages['disabled'][$task_name] = !empty($task['disabled']); - $pages['tasks'][] = $task_name; - $pages['rows'][$task_name] = $row; - } -} - -/** - * Provide a form for sorting and filtering the list of pages. - */ -function page_manager_list_pages_form($form, &$form_state) { - // This forces the form to *always* treat as submitted which is - // necessary to make it work. - if (empty($_POST)) { - $form["#programmed"] = TRUE; - } - $form['#action'] = url('admin/structure/pages/nojs/', array('absolute' => TRUE)); - if (!variable_get('clean_url', FALSE)) { - $form['q'] = array( - '#type' => 'hidden', - '#value' => $_GET['q'], - ); - } - - $all = array('all' => t('')); - - $form['type'] = array( - '#type' => 'select', - '#title' => t('Type'), - '#options' => $all + $form_state['pages']['types'], - '#default_value' => 'all', - ); - - $form['storage'] = array( - '#type' => 'select', - '#title' => t('Storage'), - '#options' => $all + $form_state['pages']['storages'], - '#default_value' => 'all', - ); - - $form['disabled'] = array( - '#type' => 'select', - '#title' => t('Enabled'), - '#options' => $all + array('0' => t('Enabled'), '1' => t('Disabled')), - '#default_value' => 'all', - ); - - $form['search'] = array( - '#type' => 'textfield', - '#title' => t('Search'), - ); - - $form['order'] = array( - '#type' => 'select', - '#title' => t('Sort by'), - '#options' => array( - 'disabled' => t('Enabled, title'), - 'title' => t('Title'), - 'name' => t('Name'), - 'path' => t('Path'), - 'type' => t('Type'), - 'storage' => t('Storage'), - ), - '#default_value' => 'disabled', - ); - - $form['sort'] = array( - '#type' => 'select', - '#title' => t('Order'), - '#options' => array( - 'asc' => t('Up'), - 'desc' => t('Down'), - ), - '#default_value' => 'asc', - ); - - $form['submit'] = array( - '#name' => '', // so it won't in the $_GET args - '#type' => 'submit', - '#id' => 'edit-pages-apply', - '#value' => t('Apply'), - '#attributes' => array('class' => array('use-ajax-submit ctools-auto-submit-click')), - ); - - $form['reset'] = array( - '#type' => 'submit', - '#id' => 'edit-pages-reset', - '#value' => t('Reset'), - '#attributes' => array('class' => array('use-ajax-submit')), - ); - - $form['#attached']['js'] = array(ctools_attach_js('auto-submit'), ctools_attach_js('page-list', 'page_manager')); - $form['#attached']['library'][] = array('system', 'drupal.ajax'); - $form['#attached']['library'][] = array('system', 'jquery.form'); - $form['#prefix'] = '
'; - $form['#suffix'] = '
'; - $form['#attributes'] = array('class' => array('ctools-auto-submit-full-form')); - - return $form; -} - -/** - * Accept submission from the page manager sort/filter form and apply it - * to the list of pages. - */ -function page_manager_list_pages_form_submit(&$form, &$form_state) { - // Filter and re-sort the pages. - - // This is a copy. - $rows = $form_state['pages']['rows']; - - $sorts = array(); - foreach ($rows as $name => $data) { - // Filter - if ($form_state['values']['type'] != 'all' && $form_state['values']['type'] != $data['data']['type']['data']) { - continue; - } - - if ($form_state['values']['storage'] != 'all' && $form_state['values']['storage'] != $data['data']['storage']['data']) { - continue; - } - - if ($form_state['values']['disabled'] != 'all' && $form_state['values']['disabled'] != $form_state['pages']['disabled'][$name]) { - continue; - } - - if ($form_state['values']['search'] && - strpos($data['data']['name']['data'], $form_state['values']['search']) === FALSE && - strpos($data['data']['path']['data'], $form_state['values']['search']) === FALSE && - strpos($data['data']['title']['data'], $form_state['values']['search']) === FALSE) { - continue; - } - // Set up sorting - switch ($form_state['values']['order']) { - case 'disabled': - $sorts[$name] = !$form_state['pages']['disabled'][$name] . $data['data']['title']['data']; - break; - case 'title': - $sorts[$name] = $data['data']['title']['data']; - break; - case 'name': - $sorts[$name] = $data['data']['name']['data']; - break; - case 'path': - $sorts[$name] = $data['data']['path']['data']; - break; - case 'type': - $sorts[$name] = $data['data']['type']['data']; - break; - case 'storage': - $sorts[$name] = $data['data']['storage']['data']; - break; - } - } - - // Now actually sort - if ($form_state['values']['sort'] == 'desc') { - arsort($sorts); - } - else { - asort($sorts); - } - - // Nuke the original. - $form_state['pages']['rows'] = array(); - // And restore. - foreach ($sorts as $name => $title) { - $form_state['pages']['rows'][$name] = $rows[$name]; - } - -} - -/** - * Render the edit page for a a page, custom or system. - */ -function page_manager_edit_page($page) { - drupal_set_title($page->subtask['admin title'], PASS_THROUGH); - // Provide and process the save page form before anything else. - $form_state = array('page' => &$page); - $built_form = drupal_build_form('page_manager_save_page_form', $form_state); - $form = drupal_render($built_form); - - $operations = page_manager_get_operations($page); - $args = array('summary'); - $rendered_operations = page_manager_render_operations($page, $operations, $args, array('class' => array('operations-main')), 'nav'); - $content = page_manager_get_operation_content(FALSE, $page, $args, $operations); - $output = theme('page_manager_edit_page', array('page' => $page, 'save' => $form, 'operations' => $rendered_operations, 'content' => $content)); - return array('#markup' => $output); -} - -/** - * Entry point to edit a single operation for a page. - * - * @param $js - * Whether or not the page was called via javascript. - * @param $page - * The cached page that is being edited. - * @param ... - * A number of items used to drill down into the actual operation called. - */ -function page_manager_edit_page_operation() { - $args = func_get_args(); - $js = array_shift($args); - $page = array_shift($args); - - $operations = page_manager_get_operations($page); - $content = page_manager_get_operation_content($js, $page, $args, $operations); - - // If the operation requested we go somewhere else afterward, oblige it. - if (isset($content['new trail'])) { - $args = $content['new trail']; - // Get operations again, for the operation may have changed their availability. - $operations = page_manager_get_operations($page); - $content = page_manager_get_operation_content($js, $page, $args, $operations); - } - - // Rendering the content may have been a form submission that changed the - // operations, such as renaming or adding a handler. Thus we get a new set - // of operations. - $operations = page_manager_get_operations($page); - $rendered_operations = page_manager_render_operations($page, $operations, $args, array('class' => array('operations-main')), 'nav'); - - // Since this form should never be submitted to this page, process it late so - // that we can be sure it notices changes. - $form_state = array('page' => &$page); - $built_form = drupal_build_form('page_manager_save_page_form', $form_state); - $form = drupal_render($built_form); - - $output = theme('page_manager_edit_page', array('page' => $page, 'save' => $form, 'operations' => $rendered_operations, 'content' => $content)); - - if ($js) { - $commands = array(); - $commands[] = ajax_command_replace('#page-manager-edit', $output); - - print ajax_render($commands); - ajax_footer(); - return; - } - - drupal_set_title($page->subtask['admin title'], PASS_THROUGH); - return $output; -} - -/** - * Take the operations array from a task and expand it. - * - * This allows some of the operations to be dynamic, based upon settings - * on the task or the task's handlers. Each operation should have a type. In - * addition to all the types allowed in page_manager_render_operations, these - * types will be dynamically replaced with something else: - * - 'handlers': An automatically created group that contains all the task's - * handlers and appropriate links. - * - 'function': A callback (which will be placed in the 'function' parameter - * that should return an array of operations. This can be used to provide - * additional, dynamic links if needed. - */ -function page_manager_get_operations($page, $operations = NULL) { - if (!isset($operations)) { - // All tasks have at least these 2 ops: - $operations = array( - 'summary' => array( - 'title' => t('Summary'), - 'description' => t('Get a summary of the information about this page.'), - 'path' => 'admin/structure/pages/edit', - 'ajax' => FALSE, - 'no operations' => TRUE, - 'form info' => array( - 'no buttons' => TRUE, - ), - 'form' => 'page_manager_page_summary', - ), - 'actions' => array( - 'type' => 'group', - 'title' => '', - 'class' => array('operations-actions'), - 'location' => 'primary', - 'children' => array(), - ), - ); - - if (isset($page->subtask['operations'])) { - $operations += $page->subtask['operations']; - // add actions separately. - if (!empty($page->subtask['operations']['actions'])) { - $operations['actions']['children'] += $page->subtask['operations']['actions']['children']; - } - } - $operations['handlers'] = array('type' => 'handlers'); - } - - $result = array(); - foreach ($operations as $id => $operation) { - if (empty($operation['type'])) { - $operation['type'] = 'operation'; - } - switch ($operation['type']) { - case 'handlers': - $result[$id] = page_manager_get_handler_operations($page); - break; - case 'function': - if (function_exists($operation['function'])) { - $retval = $function($page, $operation); - if (is_array($retval)) { - $result[$id] = $retval; - } - } - break; - default: - $result[$id] = $operation; - } - } - - if (!empty($page->subtask['enable callback']) && !empty($page->subtask['disabled']) && empty($result['actions']['children']['enable'])) { - $result['actions']['children']['enable'] = array( - 'title' => t('Enable'), - 'description' => t('Activate this page so that it will be in use in your system.'), - 'form' => 'page_manager_enable_form', - 'ajax' => FALSE, - 'silent' => TRUE, - 'no update and save' => TRUE, - 'form info' => array( - 'finish text' => t('Enable'), - ), - ); - } - - if (!empty($page->subtask['enable callback']) && empty($page->subtask['disabled']) && empty($result['actions']['children']['disable'])) { - $result['actions']['children']['disable'] = array( - 'title' => t('Disable'), - 'description' => t('De-activate this page. The data will remain but the page will not be in use on your system.'), - 'form' => 'page_manager_disable_form', - 'ajax' => FALSE, - 'silent' => TRUE, - 'no update and save' => TRUE, - 'form info' => array( - 'finish text' => t('Disable'), - ), - ); - } - - $result['actions']['children']['add'] = array( - 'title' => t('Add variant'), - 'description' => t('Add a new variant to this page.'), - 'form' => 'page_manager_handler_add', - 'ajax' => FALSE, - 'silent' => TRUE, // prevents a message about updating and prevents this item from showing as changed. - 'no update and save' => TRUE, // get rid of update and save button which is bad here. - 'form info' => array( - 'finish text' => t('Create variant'), - ), - ); - - // Restrict variant import due to security implications. - if (user_access('use ctools import')) { - $result['actions']['children']['import'] = array( - 'title' => t('Import variant'), - 'description' => t('Add a new variant to this page from code exported from another page.'), - 'form' => 'page_manager_handler_import', - ); - } - - if (count($page->handlers) > 1) { - $result['actions']['children']['rearrange'] = array( - 'title' => t('Reorder variants'), - 'ajax' => FALSE, - 'description' => t('Change the priority of the variants to ensure that the right one gets selected.'), - 'form' => 'page_manager_handler_rearrange', - ); - } - - // This is a special operation used to configure a new task handler before - // it is added. - if (isset($page->new_handler)) { - $plugin = page_manager_get_task_handler($page->new_handler->handler); - $result['actions']['children']['configure'] = array( - 'title' => t('Configure'), - 'description' => t('Configure a newly created variant prior to actually adding it to the page.'), - 'ajax' => FALSE, - 'no update and save' => TRUE, // get rid of update and save button which is bad here. - 'form info' => array( - // We use our own cancel and finish callback to handle the fun stuff. - 'finish callback' => 'page_manager_handler_add_finish', - 'cancel callback' => 'page_manager_handler_add_cancel', - 'show trail' => TRUE, - 'show back' => TRUE, - 'finish text' => t('Create variant'), - ), - 'form' => array( - 'forms' => $plugin['forms'], - ), - ); - - foreach ($page->forms as $id) { - if (isset($plugin['add features'][$id])) { - $result['actions']['children']['configure']['form']['order'][$id] = $plugin['add features'][$id]; - } - elseif (isset($plugin['required forms'][$id])) { - $result['actions']['children']['configure']['form']['order'][$id] = $plugin['required forms'][$id]; - } - } - } - - if ($page->locked) { - $result['actions']['children']['break-lock'] = array( - 'title' => t('Break lock'), - 'description' => t('Break the lock on this page so that you can edit it.'), - 'form' => 'page_manager_break_lock', - 'ajax' => FALSE, - 'no update and save' => TRUE, // get rid of update and save button which is bad here. - 'form info' => array( - 'finish text' => t('Break lock'), - ), - 'even locked' => TRUE, // show button even if locked - 'silent' => TRUE, - ); - } - - drupal_alter('page_manager_operations', $result, $page); - return $result; -} - -/** - * Collect all the operations related to task handlers (variants) and - * build a menu. - */ -function page_manager_get_handler_operations(&$page) { - ctools_include('export'); - $group = array( - 'type' => 'group', - 'class' => array('operations-handlers'), - 'title' => t('Variants'), - ); - - $operations = array(); - - // If there is only one variant, let's not have it collapsible. - $collapsible = count($page->handler_info) != 1; - foreach ($page->handler_info as $id => $info) { - if ($info['changed'] & PAGE_MANAGER_CHANGED_DELETED) { - continue; - } - $handler = $page->handlers[$id]; - $plugin = page_manager_get_task_handler($handler->handler); - - $operations[$id] = array( - 'type' => 'group', - 'class' => array('operations-handlers-' . $id), - 'title' => page_manager_get_handler_title($plugin, $handler, $page->task, $page->subtask_id), - 'collapsible' => $collapsible, - 'children' => array(), - ); - - $operations[$id]['children']['actions'] = array( - 'type' => 'group', - 'class' => array('operations-handlers-actions-' . $id), - 'title' => t('Variant operations'), - 'children' => array(), - 'location' => $id, - ); - - // There needs to be a 'summary' item here for variants. - $operations[$id]['children']['summary'] = array( - 'title' => t('Summary'), - 'description' => t('Get a summary of the information about this variant.'), - 'form info' => array( - 'no buttons' => TRUE, - ), - 'form' => 'page_manager_handler_summary', - ); - - if ($plugin && isset($plugin['operations'])) { - $operations[$id]['children'] += $plugin['operations']; - } - - $actions = &$operations[$id]['children']['actions']['children']; - - $actions['clone'] = array( - 'title' => t('Clone'), - 'description' => t('Make an exact copy of this variant.'), - 'form' => 'page_manager_handler_clone', - ); - $actions['export'] = array( - 'title' => t('Export'), - 'description' => t('Export this variant into code to import into another page.'), - 'form' => 'page_manager_handler_export', - ); - if ($handler->export_type == (EXPORT_IN_CODE | EXPORT_IN_DATABASE)) { - $actions['delete'] = array( - 'title' => t('Revert'), - 'description' => t('Remove all changes to this variant and revert to the version in code.'), - 'form' => 'page_manager_handler_delete', - 'no update and save' => TRUE, - 'form info' => array( - 'finish text' => t('Revert'), - ), - ); - } - elseif ($handler->export_type != EXPORT_IN_CODE) { - $actions['delete'] = array( - 'title' => t('Delete'), - 'description' => t('Remove this variant from the page completely.'), - 'form' => 'page_manager_handler_delete', - 'form info' => array( - 'finish text' => t('Delete'), - 'save text' => t('Delete and save'), - ), - ); - } - if (!empty($handler->disabled)) { - $actions['enable'] = array( - 'title' => t('Enable'), - 'description' => t('Activate this variant so that it will be in use in your system.'), - 'form' => 'page_manager_handler_enable', - 'silent' => TRUE, - 'form info' => array( - 'finish text' => t('Enable'), - 'save text' => t('Enable and save'), - ), - ); - } - else { - $actions['disable'] = array( - 'title' => t('Disable'), - 'description' => t('De-activate this variant. The data will remain but the variant will not be in use on your system.'), - 'form' => 'page_manager_handler_disable', - 'silent' => TRUE, - 'form info' => array( - 'finish text' => t('Disable'), - 'save text' => t('Disable and save'), - ), - ); - } - - drupal_alter('page_manager_variant_operations', $operations[$id], $handler); - } - if (empty($operations)) { - $operations['empty'] = array( - 'type' => 'text', - 'title' => t('No variants'), - ); - } - - $group['children'] = $operations; - return $group; -} - -/** - * Get an operation from a trail. - * - * @return array($operation, $active, $args) - */ -function page_manager_get_operation($operations, $trail) { - $args = $trail; - $stop = FALSE; - $active = array(); - $titles = array(); - // Drill down into operations array: - while (!$stop) { - $check = reset($args); - $stop = TRUE; - if (is_array($operations)) { - if (isset($operations[$check])) { - $active[] = $check; - $operation = array_shift($args); - // check to see if this operation has children. If so, we continue. - if (!isset($operations[$check]['children'])) { - $operations = $operations[$check]; - } - else { - $titles[] = $operations[$check]['title']; - $operations = $operations[$check]['children']; - // continue only if the operation hs children. - $stop = FALSE; - } - } - } - } - - return array($operations, $active, $args, $titles); -} - -/** - * Fetch the content for an operation. - * - * First, this drills down through the arguments to find the operation, and - * turns whatever it finds into the active trail which is then used to - * hilite where we are when rendering the operation list. - * - * The arguments are discovered from the URL, and are an exact match for where - * the operation is in the hierarchy. For example, handlers/foo/settings will - * be the operation to edit the settings for the handler named foo. This comes - * in as an array ('handlers', 'foo', 'settings') and is used to find where the - * data for that operation is in the array. - */ -function page_manager_get_operation_content($js, &$page, $trail, $operations) { - list($operation, $active, $args, $titles) = page_manager_get_operation($operations, $trail); - // Once we've found the operation, send it off to render. - if ($operation) { - $content = _page_manager_get_operation_content($js, $page, $active, $operation, $titles, $args); - } - - if (empty($content)) { - $content = _page_manager_get_operation_content($js, $page, array('summary'), $operations['summary']); - } - - return $content; -} - -/** - * Fetch the content for an operation, after it's been discovered from arguments. - * - * This system runs through the CTools form wizard. Each operation specifies a form - * or set of forms that it may use. Operations may also specify wrappers and can - * set their own next/finish handlers so that they can make additional things happen - * at the end. - */ -function _page_manager_get_operation_content($js, &$page, $active, $operation, $titles = array(), $args = array()) { - if (isset($operation['form'])) { - $form_info = array( - 'id' => 'page_manager_page', - 'finish text' => t('Update'), - 'show trail' => FALSE, - 'show back' => FALSE, - 'show return' => FALSE, - 'show cancel' => FALSE, - 'next callback' => 'page_manager_edit_page_next', - 'finish callback' => 'page_manager_edit_page_finish', - // Items specific to the 'edit' routines that will get moved over: - 'path' => page_manager_edit_url($page->task_name, $active) . "/%step", - // wrapper function to add an extra finish button. - 'wrapper' => 'page_manager_operation_wrapper', - ); - - // If $operation['form'] is simply a string, then it is the function - // name of the form. - if (!is_array($operation['form'])) { - $form_info['order'] = array( - 'form' => $operation['title'], - ); - $form_info['forms'] = array( - 'form' => array('form id' => $operation['form']), - ); - if (isset($operation['wrapper'])) { - $form_info['forms']['form']['wrapper'] = $operation['wrapper']; - } - } - // Otherwise it's the order and forms arrays directly. - else { - $form_info['order'] = $operation['form']['order']; - $form_info['forms'] = $operation['form']['forms']; - } - - // Allow the operation to override any form info settings: - if (isset($operation['form info'])) { - foreach ($operation['form info'] as $key => $setting) { - $form_info[$key] = $setting; - } - } - - if (!empty($page->subtask['operations include'])) { - // Quickly load any files necessary to display the forms. - $page->subtask['operations include']['function'] = 'nop'; - ctools_plugin_get_function($page->subtask, 'operations include'); - } - - $step = array_shift($args); - // If step is unset, go with the basic step. - if (!isset($step)) { - $step = current(array_keys($form_info['order'])); - } - - // If it is locked, hide the buttonzzz! - if ($page->locked && empty($operation['even locked'])) { - $form_info['no buttons'] = TRUE; - } - - ctools_include('wizard'); - $form_state = array( - 'page' => $page, - 'type' => 'edit', - 'ajax' => $js && (!isset($operation['ajax']) || !empty($operation['ajax'])), - 'rerender' => TRUE, - 'trail' => $active, - 'task_name' => $page->task_name, - 'task_id' => $page->task_id, - 'task' => $page->task, - 'subtask_id' => $page->subtask_id, - 'subtask' => $page->subtask, - 'operation' => $operation, - ); - - if ($active && $active[0] == 'handlers' && isset($form_state['page']->handlers[$form_state['trail'][1]])) { - $form_state['handler_id'] = $form_state['trail'][1]; - $form_state['handler'] = &$form_state['page']->handlers[$form_state['handler_id']]; - } - - if ($active && $active[0] == 'actions' && $active[1] == 'configure' && isset($form_state['page']->new_handler)) { - $form_state['handler_id'] = $form_state['page']->new_handler->name; - $form_state['handler'] = &$form_state['page']->new_handler; - } - - $built_form = ctools_wizard_multistep_form($form_info, $step, $form_state); - $output = drupal_render($built_form); - $title = empty($form_state['title']) ? $operation['title'] : $form_state['title']; - $titles[] = $title; - $title = implode(' » ', array_filter($titles)); - - // If there are messages for the form, render them. - if ($messages = theme('status_messages')) { - $output = $messages . $output; - } - - $description = isset($operation['admin description']) ? $operation['admin description'] : (isset($operation['description']) ? $operation['description'] : ''); - $return = array( - 'title' => $title, - 'content' => $output, - 'description' => $description, - ); - - // Append any extra content, used for the preview which is submitted then - // rendered. - if (isset($form_state['content'])) { - $return['content'] .= $form_state['content']; - } - - // If the form wanted us to go somewhere else next, pass that along. - if (isset($form_state['new trail'])) { - $return['new trail'] = $form_state['new trail']; - } - } - else { - $return = array( - 'title' => t('Error'), - 'content' => t('This operation trail does not exist.'), - ); - } - - $return['active'] = $active; - return $return; -} - -function page_manager_operation_wrapper($form, &$form_state) { - if (empty($form_state['operation']['no update and save']) && !empty($form['buttons']['return']['#wizard type']) && $form['buttons']['return']['#wizard type']) { - $form['buttons']['save'] = array( - '#type' => 'submit', - '#value' => !empty($form_state['form_info']['save text']) ? $form_state['form_info']['save text'] : t('Update and save'), - '#wizard type' => 'finish', - '#attributes' => $form['buttons']['return']['#attributes'], - '#save' => TRUE, - ); - } - - return $form; -} - -/** - * Callback generated when the an operation edit finished. - */ -function page_manager_edit_page_finish(&$form_state) { - if (empty($form_state['operation']['silent'])) { - if (empty($form_state['clicked_button']['#save'])) { - drupal_set_message(t('The page has been updated. Changes will not be permanent until you save.')); - } - else { - drupal_set_message(t('The page has been updated and saved.')); - } - $path = array(); - foreach ($form_state['trail'] as $operation) { - $path[] = $operation; - $form_state['page']->changes[implode('/', $path)] = TRUE; - } - } - - // If a handler was modified, set it to changed so we know to overwrite it. - if (isset($form_state['handler_id'])) { - $form_state['page']->handler_info[$form_state['handler_id']]['changed'] |= PAGE_MANAGER_CHANGED_CACHED; - } - - // While we make buttons go away on locked pages, it is still possible to - // have a lock a appear while you were editing, and have your changes - // disappear. This at least warns the user that this has happened. - if (!empty($page->locked)) { - drupal_set_message(t('Unable to update changes due to lock.')); - } - - // If the 'Update and Save' button was selected, write our cache out. - if (!empty($form_state['clicked_button']['#save'])) { - page_manager_save_page_cache($form_state['page']); - page_manager_clear_page_cache($form_state['page']->task_name); - $form_state['page'] = page_manager_get_page_cache($form_state['page']->task_name); - } - else { - if (empty($form_state['do not cache'])) { - page_manager_set_page_cache($form_state['page']); - } - } - - // We basically always want to force a rerender when the forms - // are finished, so make sure there is a new trail. - if (empty($form_state['new trail'])) { - // force a rerender to get rid of old form items that may have changed - // during save. - $form_state['new trail'] = $form_state['trail']; - } - - if (isset($form_state['new trail']) && empty($form_state['ajax'])) { - $form_state['redirect'] = page_manager_edit_url($form_state['page']->task_name, $form_state['new trail']); - } - - $form_state['complete'] = TRUE; -} - -/** - * Callback generated when the 'next' button is clicked. - * - * All we do here is store the cache. - */ -function page_manager_edit_page_next(&$form_state) { - page_manager_set_page_cache($form_state['page']); -} - -/** - * Callback generated when the 'cancel' button is clicked. - * - * All we do here is clear the cache. - */ -function page_manager_edit_page_cancel(&$form_state) { - $page = $form_state['page']; -} - -/** - * Render an operations array. - * - * This renders an array of operations into a series of nested UL statements, - * with ajax automatically on unless specified otherwise. Operations will - * automatically have the URLs generated nested. - * - * Each operation should have a 'type', which tells the renderer how to deal - * with it: - * - 'operation': An AJAX link to render. This is the default and is - * assumed if a type is not specified. Other fields for the operation: - * - - 'title': The text to display. Can be an image. Must be pre-sanitized. - * - - 'description': Text to place in the hover box over the link using the - * title attribute. - * - - 'arguments': Anything optional to put at the end of the URL. - * - - 'path': If set, overrides the default path. - * - - 'no operations': If set, the path will not have operations appended. - * - - 'no task': If set, the path will not have the task id. - * - - 'no link': If set, this item will just be text, not a link. - * - - 'ajax': If set to TRUE, ajax will be used. The default is TRUE. - * - - 'class': An optional class to specify for the link. - * - - 'form': The form to display for this operation, if using a single form. - * - - 'forms': An array of forms that must be paired with 'order' of this - * operation uses multiple forms. See wizard tool for details. - * - - 'order': The form order to use for multiple forms. See wizard tool for - * details. - * - - 'form info': Form info overrides for the wizard. See the wizard tool - * for available settings - * - 'group': - * - - 'title': The title of the link. May be HTML. - * - - 'title class': A class to apply to the title. - * - - 'children': An array of more operations that this group represents. - * All operations within this group will have this group's ID as part - * of the AJAX url to make it easier to find. - * - - 'class': A class to apply to the UL of the children. - * - - 'collapsible': If TRUE the collapsible tool will be used. - */ -function page_manager_render_operations(&$page, $operations, $active_trail, $attributes, $location, $parents = array()) { - drupal_add_library('system', 'drupal.ajax'); - - if (!isset($output[$location])) { - $output[$location] = ''; - } - - $keys = array_keys($operations); - $first = array_shift($keys); - $last = array_pop($keys); - - // Make sure the 'first' and 'last' operations are part of THIS nav tree: - while ($keys && isset($operations[$first]['location']) && $operations[$first]['location'] != $location) { - $first = array_shift($keys); - } - while ($keys && isset($operations[$last]['location']) && $operations[$last]['location'] != $location) { - $last = array_pop($keys); - } - - $active = reset($active_trail); - foreach ($operations as $id => $operation) { - $current_path = ''; - if ($parents) { - $current_path .= implode('/', $parents) . '/'; - } - $current_path .= $id; - - if (empty($operation['type'])) { - $operation['type'] = 'operation'; - } - - // We only render an li for things in the same nav tree. - if (empty($operation['location']) || $operation['location'] == $location) { - if (!is_array($attributes['class'])) { - $attributes['class'] = array($attributes['class']); - } - - $class = empty($attributes['class']) || !is_array($attributes['class']) ? array() : $attributes['class']; - - if ($id == $first) { - $class[] = 'operation-first'; - } - elseif ($id == $last) { - $class[] = 'operation-last'; - } - - if (empty($operation['silent']) && !empty($page->changes[$current_path])) { - $class[] = $operation['type'] == 'group' ? 'changed-group' : 'changed'; - } - else { - $class[] = 'not-changed'; - } - - if ($active == $id) { - $class[] = $operation['type'] == 'group' ? 'active-group' : 'active'; - } - else { - $class[] = 'not-active'; - } - - $output[$location] .= '
  • '; - } - - switch ($operation['type']) { - case 'text': - $output[$location] .= $operation['title']; - break; - case 'operation': - $path = isset($operation['path']) ? $operation['path'] : 'admin/structure/pages/nojs/operation'; - if (!isset($operation['no task'])) { - $path .= '/' . $page->task_name; - } - - if (!isset($operation['no operations'])) { - $path .= '/' . $current_path; - if (isset($operation['arguments'])) { - $path .= '/' . $arguments; - } - } - - $class = array('page-manager-operation'); - if (!isset($operation['ajax']) || !empty($operation['ajax'])) { - $class[] = 'use-ajax'; - } - if (!empty($operation['class'])) { - $class[] = $operation['class']; - } - - $description = isset($operation['description']) ? $operation['description'] : ''; - if (empty($operation['silent']) && !empty($page->changes[$current_path])) { - $description .= ' ' . t('This setting contains unsaved changes.'); - } - - $output[$location] .= l($operation['title'], $path, array('attributes' => array('id' => 'page-manager-operation-' . $id, 'class' => $class, 'title' => $description), 'html' => TRUE)); - break; - case 'group': - if ($active == $id) { - $trail = $active_trail; - array_shift($trail); - } - else { - $trail = array(); - } - $group_location = isset($operation['location']) ? $operation['location'] : $location; - $temp = page_manager_render_operations($page, $operation['children'], $trail, $operation, $group_location, array_merge($parents, array($id))); - if ($temp) { - foreach ($temp as $id => $text) { - if (empty($output[$id])) { - $output[$id] = ''; - } - $output[$id] .= $text; - } - } - break; - } - - if (empty($operation['location']) || $operation['location'] == $location) { - $output[$location] .= '
  • '; - } - } - - if ($output[$location]) { - $classes = isset($attributes['class']) && is_array($attributes['class']) ? $attributes['class'] : array(); - $classes[] = 'page-manager-operations'; - - $output[$location] = '
      ' . $output[$location] . '
    '; - - if (!empty($attributes['title'])) { - $class = ''; - if (isset($attributes['title class'])) { - $class = $attributes['title class']; - } - $title = '
    ' . $attributes['title'] . '
    '; - - if (!empty($attributes['collapsible'])) { - $output[$location] = theme('ctools_collapsible', array('handle' => $title, 'content' => $output[$location], 'collapsed' => empty($active_trail))); - } - else { - $output[$location] = $title . $output[$location]; - } - } - return $output; - } -} - -/** - * Provide a simple form for saving the page manager info out of the cache. - */ -function page_manager_save_page_form($form, &$form_state) { - if (!empty($form_state['page']->changed)) { - $form['markup'] = array( - '#markup' => '
    ' . t('You have unsaved changes to this page. You must select Save to write them to the database, or Cancel to discard these changes. Please note that if you have changed any form, you must submit that form before saving.') . '
    ', - ); - - // Always make sure we submit back to the proper page. - $form['#action'] = url('admin/structure/pages/edit/' . $form_state['page']->task_name); - $form['save'] = array( - '#type' => 'submit', - '#value' => t('Save'), - '#submit' => array('page_manager_save_page_form_submit'), - ); - - $form['cancel'] = array( - '#type' => 'submit', - '#value' => t('Cancel'), - '#submit' => array('page_manager_save_page_form_cancel'), - ); - return $form; - } -} - -/** - * Save the page. - */ -function page_manager_save_page_form_submit(&$form, &$form_state) { - page_manager_save_page_cache($form_state['page']); -} - -/** - * Discard changes to the page. - */ -function page_manager_save_page_form_cancel($form, &$form_state) { - drupal_set_message(t('All pending changes have been discarded, and the page is now unlocked.')); - page_manager_clear_page_cache($form_state['page']->task_name); - - if (!empty($form_state['page']->new)) { - $form_state['redirect'] = 'admin/structure/pages'; - } -} - -// -------------------------------------------------------------------------- -// Handler (variant) related forms. - -/** - * Add a new task handler. - */ -function page_manager_handler_add($form, &$form_state) { - // Get a list of possible task handlers for this task. - return page_manager_handler_add_form($form, $form_state); -} - -/** - * Handler related forms. - */ -function page_manager_handler_add_submit(&$form, &$form_state) { - $cache = $form_state['page']; - $plugin = page_manager_get_task_handler($form_state['values']['handler']); - - // Create a new handler. - $handler = page_manager_new_task_handler($plugin); - if (!empty($form_state['values']['title'])) { - $handler->conf['title'] = $form_state['values']['title']; - } - else { - $handler->conf['title'] = $plugin['title']; - } - $handler->conf['name'] = $form_state['values']['name']; - $cache->new_handler = $handler; - - // Figure out which forms to present them with - $cache->forms = array(); - - $features = $form_state['values']['features']; - if (isset($features[$form_state['values']['handler']])) { - $cache->forms = array_merge($cache->forms, array_keys(array_filter($features[$form_state['values']['handler']]))); - } - - if (isset($plugin['required forms'])) { - $cache->forms = array_merge($cache->forms, array_keys($plugin['required forms'])); - } - - $form_state['no_rerender'] = TRUE; - if (!empty($cache->forms)) { - // Tell the form to go to the config page. - drupal_set_message(t('Before this variant can be added, it must be configured. When you are finished, click "Create variant" at the end of this wizard to add this to your page.')); - $form_state['new trail'] = array('actions', 'configure'); - } - else { - // It has no forms at all. Add the variant and go to its first operation. - page_manager_handler_add_finish($form_state); - } -} - -/** - * Finish the add process and make the new handler official. - */ -function page_manager_handler_add_finish(&$form_state) { - $page = &$form_state['page']; - $handler = $page->new_handler; - page_manager_handler_add_to_page($page, $handler); - - // Remove the temporary page. - unset($page->new_handler); - unset($page->forms); - - // Set the new destination - $plugin = page_manager_get_task_handler($handler->handler); - if (!empty($plugin['add finish'])) { - $location = $plugin['add finish']; - } - else { - $keys = array_keys($plugin['operations']); - $location = reset($keys); - } - - $form_state['new trail'] = array('handlers', $handler->name, $location); - - // Pass through. - page_manager_edit_page_finish($form_state); -} - -/** - * Throw away a new handler and return to the add form - */ -function page_manager_handler_add_cancel(&$form_state) { - $form_state['new trail'] = array('handlers', 'add'); - - // Remove the temporary page. - unset($page->new_handler); - unset($page->forms); -} - -/** - * Provide a consistent UI for adding handlers. - */ -function page_manager_handler_add_form($form, $form_state, $features = array()) { - $task = $form_state['task']; - $task_handler_plugins = page_manager_get_task_handler_plugins($task); - if (empty($task_handler_plugins)) { - drupal_set_message(t('There are currently no variants available and a page may not be added. Perhaps you need to install the Panels module to get a variant?'), 'error'); - $form['buttons']['return']['#disabled'] = TRUE; - return; - } - - foreach ($task_handler_plugins as $id => $plugin) { - $options[$id] = $plugin['title']; - if (isset($plugin['add features'])) { - $features[$id] = $plugin['add features']; - } - } - - if (!isset($form_state['type']) || $form_state['type'] != 'add') { - $form['title'] = array( - '#type' => 'textfield', - '#title' => t('Title'), - '#description' => t('Administrative title of this variant. If you leave blank it will be automatically assigned.'), - ); - - $form['name'] = array( - '#type' => 'machine_name', - '#title' => t('Machine name'), - '#required' => FALSE, - '#description' => t("A unique machine-readable name for this variant. It must only contain lowercase letters, numbers, and underscores. This name will be used when exporting the variant. If left empty the variant's name will be used instead."), - '#size' => 32, - '#maxlength' => 32, - '#machine_name' => array( - 'exists' => 'page_manager_handler_check_machine_name', - 'source' => array('title'), - ), - '#field_prefix' => '' . $form_state['task_name'] . '__', - '#field_suffix' => '‎', - ); - } - - $form['handler'] = array( - '#title' => t('Variant type'), - '#type' => 'select', - '#options' => $options, - ); - - // This set of checkboxes is not dangerous at all. - $form['features'] = array( - '#type' => 'item', - '#title' => t('Optional features'), - '#description' => t('Check any optional features you need to be presented with forms for configuring them. If you do not check them here you will still be able to utilize these features once the new page is created. If you are not sure, leave these unchecked.'), - '#tree' => TRUE, - ); - - ctools_include('dependent'); - foreach ($features as $plugin => $feature_list) { - foreach ($feature_list as $feature_id => $feature) { - $form['features'][$plugin][$feature_id] = array( - '#type' => 'checkbox', - '#title' => $feature, - ); - if (!empty($form_state['page']->forms) && in_array($feature_id, $form_state['page']->forms)) { - $form['features'][$plugin][$feature_id]['#default_value'] = TRUE; - } - - if ($plugin != 'default') { - $form['features'][$plugin][$feature_id] += array( - '#dependency' => array('edit-handler' => array($plugin)), - ); - } - } - } - - return $form; -} - -/* - * Check if handler's machine-name is unique - */ -function page_manager_handler_check_machine_name($name, $element, $form_state) { - $name = $form_state['task_name'] . '__' . $name; - - return count(ctools_export_load_object('page_manager_handlers', 'names', array($name))); -} - -/** - * Rearrange the order of variants. - */ -function page_manager_handler_import($form, &$form_state) { - $form['title'] = array( - '#type' => 'textfield', - '#title' => t('Variant name'), - '#description' => t('Enter the name of the new variant.'), - ); - - if (user_access('use ctools import')) { - $form['object'] = array( - '#type' => 'textarea', - '#title' => t('Paste variant code here'), - '#rows' => 15, - ); - } - // Users ordinarily can't get here without the 'import' permission, due to - // security implications. In case they somehow do, though, disable the form - // widget for extra safety. - else { - $form['shoveoff'] = array( - '#markup' => '
    ' . t('You do not have sufficient permissions to perform this action.') . '
    ', - ); - } - - return $form; -} - -/** - * Make sure that an import actually provides a handler. - */ -function page_manager_handler_import_validate($form, &$form_state) { - if (!user_access('use ctools import')) { - form_error($form['shoveoff'], t('You account permissions do not permit you to import.')); - return; - } - ob_start(); - eval($form_state['values']['object']); - ob_end_clean(); - - if (empty($handler)) { - $errors = ob_get_contents(); - if (empty($errors)) { - $errors = t('No variant found.'); - } - - form_error($form['object'], t('Unable to get a variant from the import. Errors reported: @errors', array('@errors' => $errors))); - } - - $form_state['handler'] = $handler; -} - -/** - * Clone an existing task handler into a new handler. - */ -function page_manager_handler_import_submit(&$form, &$form_state) { - $handler = $form_state['handler']; - - page_manager_handler_add_to_page($form_state['page'], $handler, $form_state['values']['title']); - - $plugin = page_manager_get_task_handler($handler->handler); - // It has no forms at all. Add the variant and go to its first operation. - $keys = array_keys($plugin['operations']); - $form_state['new trail'] = array('handlers', $handler->name, reset($keys)); -} - -/** - * Rearrange the order of variants. - */ -function page_manager_handler_rearrange($form, &$form_state) { - ctools_include('context-task-handler'); - $page = $form_state['page']; - - $form['handlers'] = array('#tree' => TRUE); - - // Get the number of variants to be displayed in order to set the delta - // to the proper value. This fixes problems in previous versions with sorting - // large numbers of variants. - $delta = count($page->handler_info)/2 + 1; - - foreach ($page->handler_info as $id => $info) { - if ($info['changed'] & PAGE_MANAGER_CHANGED_DELETED) { - continue; - } - $handler = $page->handlers[$id]; - $plugin = page_manager_get_task_handler($handler->handler); - $object = ctools_context_handler_get_task_object($page->task, $page->subtask, $handler); - $display = new stdClass(); - $display->context = ctools_context_load_contexts($object, TRUE); - $content = page_manager_get_handler_title($plugin, $handler, $page->task, $page->subtask_id); - $access = ctools_access_group_summary(!empty($handler->conf['access']) ? $handler->conf['access'] : array(), $display->context); - if ($access) { - $access = t('This panel will be selected if @conditions.', array('@conditions' => $access)); - } - else { - $access = t('This panel will always be selected.'); - } - $content .= '
    ' . $access . '
    '; - $form['handlers'][$id]['title'] = array( - '#markup' => $content, - ); - - $form['handlers'][$id]['weight'] = array( - '#type' => 'weight', - '#default_value' => $info['weight'], - '#delta' => $delta, - ); - } - - return $form; -} - -function page_manager_handler_rearrange_submit(&$form, &$form_state) { - $handler_info = &$form_state['page']->handler_info; - - foreach ($form_state['values']['handlers'] as $id => $info) { - if ($handler_info[$id]['weight'] = $info['weight']) { - $handler_info[$id]['weight'] = $info['weight']; - $handler_info[$id]['changed'] |= PAGE_MANAGER_CHANGED_MOVED; - } - } - - // Sort the new cache. - uasort($handler_info, '_page_manager_handler_sort'); - -} - -/** - * Used as a callback to uasort to sort the task cache by weight. - * - * The 'name' field is used as a backup when weights are the same, which - * can happen when multiple modules put items out there at the same - * weight. - */ -function _page_manager_handler_sort($a, $b) { - if ($a['weight'] < $b['weight']) { - return -1; - } - elseif ($a['weight'] > $b['weight']) { - return 1; - } - elseif ($a['name'] < $b['name']) { - return -1; - } - elseif ($a['name'] > $b['name']) { - return 1; - } -} - -/** - * Rearrange the order of variants. - */ -function page_manager_handler_delete($form, &$form_state) { - if ($form_state['handler']->type == t('Overridden')) { - $text = t('Reverting the variant will delete the variant that is in the database, reverting it to the original default variant. This deletion will not be made permanent until you click Save.'); - } - else { - $text = t('Are you sure you want to delete this variant? This deletion will not be made permanent until you click Save.'); - } - $form['markup'] = array( - '#markup' => '

    ' . $text . '

    ', - ); - - return $form; -} - -/** - * Submit handler to delete a view. - */ -function page_manager_handler_delete_submit(&$form, &$form_state) { - $form_state['page']->handler_info[$form_state['handler_id']]['changed'] |= PAGE_MANAGER_CHANGED_DELETED; - $form_state['new trail'] = array('summary'); -} - -/** - * Entry point to export a page. - */ -function page_manager_handler_export($form, &$form_state) { - $export = page_manager_export_task_handler($form_state['handler']); - - $lines = substr_count($export, "\n"); - $form['code'] = array( - '#type' => 'textarea', - '#default_value' => $export, - '#rows' => $lines, - ); - - unset($form['buttons']); - return $form; -} - -/** - * Rearrange the order of variants. - */ -function page_manager_handler_clone($form, &$form_state) { - // This provides its own button because it does something totally different. - $form['title'] = array( - '#type' => 'textfield', - '#title' => t('Variant name'), - '#description' => t('Enter the name of the new variant.'), - ); - - return $form; -} - -/** - * Clone an existing task handler into a new handler. - */ -function page_manager_handler_clone_submit(&$form, &$form_state) { - $export = page_manager_export_task_handler($form_state['handler']); - ob_start(); - eval($export); - ob_end_clean(); - - page_manager_handler_add_to_page($form_state['page'], $handler, $form_state['values']['title']); - - // Variant is cloned and added to the Page. Ensure the uuids are re-generated. - panels_panel_context_get_display($handler); - if (isset($handler->conf['display']) && method_exists($handler->conf['display'], 'clone_display')) { - $handler->conf['display'] = $handler->conf['display']->clone_display(); - } - - $plugin = page_manager_get_task_handler($handler->handler); - // It has no forms at all. Add the variant and go to its first operation. - $keys = array_keys($plugin['operations']); - $form_state['new trail'] = array('handlers', $handler->name, reset($keys)); -} - -/** - * Form to enable a handler. - */ -function page_manager_handler_enable($form, &$form_state) { - $form['markup'] = array( - '#markup' => t('This variant is currently disabled. Enabling it will make it available in your system. This will not take effect until you save this page.'), - ); - - return $form; -} - -/** - * Enable the page after it has been confirmed. - */ -function page_manager_handler_enable_submit(&$form, &$form_state) { - $form_state['handler']->disabled = FALSE; - $form_state['page']->handler_info[$form_state['handler_id']]['disabled'] = FALSE; - $form_state['page']->handler_info[$form_state['handler_id']]['changed'] |= PAGE_MANAGER_CHANGED_STATUS; - $form_state['new trail'] = array('handlers', $form_state['handler_id'], 'actions', 'disable'); -} - -/** - * Form to disable a page. - */ -function page_manager_handler_disable($form, &$form_state) { - $form['markup'] = array( - '#markup' => t('This variant is currently enabled. Disabling it will make it unavailable in your system, and it will not be used. This will not take effect until you save this page.'), - ); - - return $form; -} - -/** - * Form to disable a page. - */ -function page_manager_handler_summary($form, &$form_state) { - $handler = $form_state['handler']; - $page = $form_state['page']; - $plugin = page_manager_get_task_handler($handler->handler); - - $form['markup'] = array( - '#markup' => page_manager_get_handler_summary($plugin, $handler, $page, FALSE), - ); - - return $form; -} - -/** - * Disable the page after it has been confirmed. - */ -function page_manager_handler_disable_submit(&$form, &$form_state) { - $form_state['handler']->disabled = TRUE; - $form_state['page']->handler_info[$form_state['handler_id']]['disabled'] = TRUE; - $form_state['page']->handler_info[$form_state['handler_id']]['changed'] |= PAGE_MANAGER_CHANGED_STATUS; - $form_state['new trail'] = array('handlers', $form_state['handler_id'], 'actions', 'enable'); -} - -/** - * Break the lock on a page so that it can be edited. - */ -function page_manager_break_lock($form, &$form_state) { - $form['markup'] = array( - '#markup' => t('Breaking the lock on this page will discard any pending changes made by the locking user. Are you REALLY sure you want to do this?') - ); - - return $form; -} - -/** - * Submit to break the lock on a page. - */ -function page_manager_break_lock_submit(&$form, &$form_state) { - $page = &$form_state['page']; - $form_state['page']->locked = FALSE; - ctools_object_cache_clear_all('page_manager_page', $page->task_name); - $form_state['do not cache'] = TRUE; - drupal_set_message(t('The lock has been cleared and all changes discarded. You may now make changes to this page.')); - - $form_state['new trail'] = array('summary'); -} - -/** - * Form to enable a page. - */ -function page_manager_enable_form($form, &$form_state) { - $form['markup'] = array( - '#markup' => t('Enabling this page will immediately make it available in your system (there is no need to wait for a save.)'), - ); - - return $form; -} - -/** - * Enable the page after it has been confirmed. - */ -function page_manager_enable_form_submit(&$form, &$form_state) { - $page = &$form_state['page']; - if ($function = ctools_plugin_get_function($page->subtask, 'enable callback')) { - $result = $function($page, FALSE); - menu_rebuild(); - } - $form_state['new trail'] = array('actions', 'disable'); - - // We don't want to cause this to cache if it wasn't already. If it was - // cached, however, we want to update the enabled state. - if (empty($form_state['page']->changed)) { - $form_state['do not cache'] = TRUE; - } -} - -/** - * Form to disable a page. - */ -function page_manager_disable_form($form, &$form_state) { - $form['markup'] = array( - '#markup' => t('Disabling this page will immediately make it unavailable in your system (there is no need to wait for a save.)'), - ); - - return $form; -} - -/** - * Disable the page after it has been confirmed. - */ -function page_manager_disable_form_submit(&$form, &$form_state) { - $page = &$form_state['page']; - if ($function = ctools_plugin_get_function($page->subtask, 'enable callback')) { - $result = $function($page, TRUE); - menu_rebuild(); - $form_state['new trail'] = array('actions', 'enable'); - - // We don't want to cause this to cache if it wasn't already. If it was - // cached, however, we want to update the enabled state. - if (empty($form_state['page']->changed)) { - $form_state['do not cache'] = TRUE; - } - } -} - -/** - * Print the summary information for a page. - */ -function page_manager_page_summary($form, &$form_state) { - $page = $form_state['page']; - - $output = ''; - -/* - if (isset($form_state['subtask']['admin title'])) { - $form_state['title'] = $form_state['subtask']['admin title']; - } -*/ - - if (isset($form_state['subtask']['admin description'])) { - $output .= '
    ' . $form_state['subtask']['admin description'] . '
    '; - } - - $output .= page_manager_get_page_summary($page->task, $page->subtask); - - if (!empty($page->handlers)) { - foreach ($page->handler_info as $id => $info) { - if ($info['changed'] & PAGE_MANAGER_CHANGED_DELETED) { - continue; - } - - $handler = $page->handlers[$id]; - $plugin = page_manager_get_task_handler($handler->handler); - - $output .= '
    '; - $output .= page_manager_get_handler_summary($plugin, $handler, $page); - $output .= '
    '; - - } - } - else { - $output .= '

    ' . t('This page has no variants and thus no output of its own.') . '

    '; - } - - $links = array( - array( - 'title' => ' » ' . t('Add a new variant'), - 'href' => page_manager_edit_url($page->task_name, array('actions', 'add')), - 'html' => TRUE, - ), - ); - - $output .= ''; - $form['markup'] = array( - '#markup' => $output, - ); - - return $form; -} - -/** - * Menu callback to enable or disable a page - */ -function page_manager_enable_page($disable, $js, $page) { - if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], $page->task_name)) { - return MENU_ACCESS_DENIED; - } - if ($page->locked) { - if ($disable) { - drupal_set_message(t('Unable to disable due to lock.')); - } - else { - drupal_set_message(t('Unable to enable due to lock.')); - } - } - else { - if ($function = ctools_plugin_get_function($page->subtask, 'enable callback')) { - $result = $function($page, $disable); - menu_rebuild(); - - // We want to re-cache this if it's changed so that status is properly - // updated on the changed form. - if (!empty($page->changed)) { - page_manager_set_page_cache($page); - } - } - } - - // For now $js is not actually in use on this. - drupal_goto('admin/structure/pages'); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/page_manager.api.php b/html/sites/all/modules/contrib/ctools/page_manager/page_manager.api.php deleted file mode 100644 index 03e2e75f6..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/page_manager.api.php +++ /dev/null @@ -1,39 +0,0 @@ - array( - 'identifier' => 'handler', - 'bulk export' => TRUE, - 'export callback' => 'page_manager_export_task_handler', - 'load callback' => 'page_manager_export_task_handler_load', - 'delete callback' => 'page_manager_delete_task_handler', - 'primary key' => 'did', - 'api' => array( - 'owner' => 'page_manager', - 'api' => 'pages_default', - 'minimum_version' => 1, - 'current_version' => 1, - ), - ), - 'fields' => array( - 'did' => array( - 'type' => 'serial', - 'not null' => TRUE, - 'description' => 'Primary ID field for the table. Not used for anything except internal lookups.', - 'no export' => TRUE, - ), - 'name' => array( - 'type' => 'varchar', - 'length' => '255', - 'description' => 'Unique ID for this task handler. Used to identify it programmatically.', - ), - 'task' => array( - 'type' => 'varchar', - 'length' => '64', - 'description' => 'ID of the task this handler is for.', - ), - 'subtask' => array( - 'type' => 'varchar', - 'length' => '64', - 'description' => 'ID of the subtask this handler is for.', - 'not null' => TRUE, - 'default' => '', - ), - 'handler' => array( - 'type' => 'varchar', - 'length' => '64', - 'description' => 'ID of the task handler being used.', - ), - 'weight' => array( - 'type' => 'int', - 'description' => 'The order in which this handler appears. Lower numbers go first.', - ), - 'conf' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'Serialized configuration of the handler, if needed.', - 'not null' => TRUE, - 'serialize' => TRUE, - 'object default' => array(), - ), - ), - 'primary key' => array('did'), - 'unique keys' => array( - 'name' => array('name'), - ), - 'indexes' => array('fulltask' => array('task', 'subtask', 'weight')), - ); - - $schema['page_manager_weights'] = array( - 'description' => 'Contains override weights for page_manager handlers that are in code.', - 'fields' => array( - 'name' => array( - 'type' => 'varchar', - 'length' => '255', - 'description' => 'Unique ID for this task handler. Used to identify it programmatically.', - 'not null' => TRUE, - 'default' => '', - ), - 'weight' => array( - 'type' => 'int', - 'description' => 'The order in which this handler appears. Lower numbers go first.', - ), - ), - 'primary key' => array('name'), - 'indexes' => array( - 'weights' => array('name', 'weight'), - ), - ); - - $schema['page_manager_pages'] = array( - 'description' => 'Contains page subtasks for implementing pages with arbitrary tasks.', - 'export' => array( - 'identifier' => 'page', - 'bulk export' => TRUE, - 'export callback' => 'page_manager_page_export', - 'api' => array( - 'owner' => 'page_manager', - 'api' => 'pages_default', - 'minimum_version' => 1, - 'current_version' => 1, - ), - ), - 'fields' => array( - 'pid' => array( - 'type' => 'serial', - 'not null' => TRUE, - 'description' => 'Primary ID field for the table. Not used for anything except internal lookups.', - 'no export' => TRUE, - ), - 'name' => array( - 'type' => 'varchar', - 'length' => '255', - 'description' => 'Unique ID for this subtask. Used to identify it programmatically.', - ), - 'task' => array( - 'type' => 'varchar', - 'length' => '64', - 'description' => 'What type of page this is, so that we can use the same mechanism for creating tighter UIs for targeted pages.', - 'default' => 'page', - ), - 'admin_title' => array( - 'type' => 'varchar', - 'length' => '255', - 'description' => 'Human readable title for this page subtask.', - ), - 'admin_description' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'Administrative description of this item.', - 'object default' => '', - ), - 'path' => array( - 'type' => 'varchar', - 'length' => '255', - 'description' => 'The menu path that will invoke this task.', - ), - 'access' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'Access configuration for this path.', - 'not null' => TRUE, - 'serialize' => TRUE, - 'object default' => array(), - ), - 'menu' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'Serialized configuration of Drupal menu visibility settings for this item.', - 'not null' => TRUE, - 'serialize' => TRUE, - 'object default' => array(), - ), - 'arguments' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'Configuration of arguments for this menu item.', - 'not null' => TRUE, - 'serialize' => TRUE, - 'object default' => array(), - ), - 'conf' => array( - 'type' => 'text', - 'size' => 'big', - 'description' => 'Serialized configuration of the page, if needed.', - 'not null' => TRUE, - 'serialize' => TRUE, - 'object default' => array(), - ), - ), - 'primary key' => array('pid'), - 'unique keys' => array( - 'name' => array('name'), - ), - 'indexes' => array('task' => array('task')), - ); - - return $schema; -} - -/** - * Implements hook_install(). - */ -function page_manager_install() { - db_update('system') - ->fields(array('weight' => 99)) - ->condition('name', 'page_manager') - ->execute(); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/page_manager.module b/html/sites/all/modules/contrib/ctools/page_manager/page_manager.module deleted file mode 100644 index ed2066b46..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/page_manager.module +++ /dev/null @@ -1,1346 +0,0 @@ - array( - 'title' => t('Use Page Manager'), - 'description' => t("Allows users to use most of Page Manager's features, though restricts some of the most powerful, potentially site-damaging features. Note that even the reduced featureset still allows for enormous control over your website."), - 'restrict access' => TRUE, - ), - 'administer page manager' => array( - 'title' => t('Administer Page Manager'), - 'description' => t('Allows complete control over Page Manager, i.e., complete control over your site. Grant with extreme caution.'), - 'restrict access' => TRUE, - ), - ); - -} - -/** - * Implements hook_ctools_plugin_directory() to let the system know - * where our task and task_handler plugins are. - */ -function page_manager_ctools_plugin_directory($owner, $plugin_type) { - if ($owner == 'page_manager') { - return 'plugins/' . $plugin_type; - } - if ($owner == 'ctools' && $plugin_type == 'cache') { - return 'plugins/' . $plugin_type; - } -} - -/** - * Implements hook_ctools_plugin_type() to inform the plugin system that Page - * Manager owns task, task_handler, and page_wizard plugin types. - * - * All of these are empty because the defaults all work. - */ -function page_manager_ctools_plugin_type() { - return array( - 'tasks' => array(), - 'task_handlers' => array(), - 'page_wizards' => array(), - ); -} - -/** - * Delegated implementation of hook_menu(). - */ -function page_manager_menu() { - // For some reason, some things can activate modules without satisfying - // dependencies. I don't know how, but this helps prevent things from - // whitescreening when this happens. - if (!module_exists('ctools')) { - return; - } - - $items = array(); - $base = array( - 'access arguments' => array('use page manager'), - 'file' => 'page_manager.admin.inc', - 'theme callback' => 'ajax_base_page_theme', - ); - - $items['admin/structure/pages'] = array( - 'title' => 'Pages', - 'description' => 'Add, edit and remove overridden system pages and user defined pages from the system.', - 'page callback' => 'page_manager_list_page', - ) + $base; - - $items['admin/structure/pages/list'] = array( - 'title' => 'List', - 'page callback' => 'page_manager_list_page', - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, - ) + $base; - - $items['admin/structure/pages/edit/%page_manager_cache'] = array( - 'title' => 'Edit', - 'page callback' => 'page_manager_edit_page', - 'page arguments' => array(4), - 'type' => MENU_NORMAL_ITEM, - ) + $base; - - $items['admin/structure/pages/%ctools_js/operation/%page_manager_cache'] = array( - 'page callback' => 'page_manager_edit_page_operation', - 'page arguments' => array(3, 5), - 'type' => MENU_NORMAL_ITEM, - ) + $base; - - $items['admin/structure/pages/%ctools_js/enable/%page_manager_cache'] = array( - 'page callback' => 'page_manager_enable_page', - 'page arguments' => array(FALSE, 3, 5), - 'type' => MENU_CALLBACK, - ) + $base; - - $items['admin/structure/pages/%ctools_js/disable/%page_manager_cache'] = array( - 'page callback' => 'page_manager_enable_page', - 'page arguments' => array(TRUE, 3, 5), - 'type' => MENU_CALLBACK, - ) + $base; - - $tasks = page_manager_get_tasks(); - - // Provide menu items for each task. - foreach ($tasks as $task_id => $task) { - // Allow the task to add its own menu items. - if ($function = ctools_plugin_get_function($task, 'hook menu')) { - $function($items, $task); - } - - // And for those that provide subtasks, provide menu items for them, as well. - foreach (page_manager_get_task_subtasks($task) as $subtask_id => $subtask) { - // Allow the task to add its own menu items. - if ($function = ctools_plugin_get_function($task, 'hook menu')) { - $function($items, $subtask); - } - } - } - - return $items; -} - -function page_manager_admin_paths() { - /* @todo FIX ME this is a major resource suck. */ - return; - - $items = array(); - ctools_include('page', 'page_manager', 'plugins/tasks'); - $pages = page_manager_page_load_all(); - foreach ($pages as $page) { - // Make sure the page we're on is set to be an administrative path and that - // it is not set to be a frontpage path. - if ((isset($page->conf['admin_paths']) && $page->conf['admin_paths']) && (!isset($page->make_frontpage) || !$page->make_frontpage)) { - $path_parts = explode('/', $page->path); - foreach ($path_parts as $key => $part) { - if (strpos($part, '%') !== FALSE || strpos($part, '!') !== FALSE) { - $path_parts[$key] = '*'; - } - } - $path = implode('/', $path_parts); - if ($page->menu['type'] == 'default tab') { - array_pop($path_parts); - $parent_path = implode('/', $path_parts); - $items[$parent_path] = TRUE; - } - $items[$path] = TRUE; - } - } - return $items; -} - -/** - * Implements hook_menu_alter. - * - * Get a list of all tasks and delegate to them. - */ -function page_manager_menu_alter(&$items) { - // For some reason, some things can activate modules without satisfying - // dependencies. I don't know how, but this helps prevent things from - // whitescreening when this happens. - if (!module_exists('ctools')) { - return; - } - - $tasks = page_manager_get_tasks(); - - foreach ($tasks as $task) { - if ($function = ctools_plugin_get_function($task, 'hook menu alter')) { - $function($items, $task); - } - // Let the subtasks alter the menu items too. - foreach (page_manager_get_task_subtasks($task) as $subtask_id => $subtask) { - if ($function = ctools_plugin_get_function($subtask, 'hook menu alter')) { - $function($items, $subtask); - } - } - } - - // Override the core node revisions display to use the configured Page - // display handler. - if (!variable_get('page_manager_node_view_disabled', TRUE) && isset($items['node/%node/revisions/%/view'])) { - // Abstract the basic settings. - $item = array( - // Handle the page arguments. - 'load arguments' => array(3), - 'page arguments' => array(1, TRUE), - - // Replace the normal node_show call with Page Manager's node view. - 'page callback' => 'page_manager_node_view_page', - - // Provide the correct path to the Page Manager file. - 'file' => 'node_view.inc', - 'file path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks', - ); - // Re-build the menu item using the normal values from node.module. - $items['node/%node/revisions/%/view'] = array( - 'title' => 'Revisions', - 'access callback' => '_node_revision_access', - 'access arguments' => array(1), - ) + $item; - } - - return $items; -} - -/** - * Implements hook_theme() - */ -function page_manager_theme() { - // For some reason, some things can activate modules without satisfying - // dependencies. I don't know how, but this helps prevent things from - // whitescreening when this happens. - if (!module_exists('ctools')) { - return; - } - - $base = array( - 'path' => drupal_get_path('module', 'page_manager') . '/theme', - 'file' => 'page_manager.theme.inc', - ); - - $items = array( - 'page_manager_handler_rearrange' => array( - 'render element' => 'form', - ) + $base, - 'page_manager_edit_page' => array( - 'template' => 'page-manager-edit-page', - 'variables' => array('page' => NULL, 'save' => NULL, 'operations' => array(), 'content' => array()), - ) + $base, - 'page_manager_lock' => array( - 'variables' => array('page' => array()), - ) + $base, - 'page_manager_changed' => array( - 'variables' => array('text' => NULL, 'description' => NULL), - ) + $base, - ); - - // Allow task plugins to have theme registrations by passing through: - $tasks = page_manager_get_tasks(); - - // Provide menu items for each task. - foreach ($tasks as $task_id => $task) { - if ($function = ctools_plugin_get_function($task, 'hook theme')) { - $function($items, $task); - } - } - - return $items; -} - -// -------------------------------------------------------------------------- -// Page caching -// -// The page cache is used to store a page temporarily, using the ctools object -// cache. When loading from the page cache, it will either load the cached -// version, or if there is not one, load the real thing and create a cache -// object which can then be easily stored. - -/** - * Get the cached changes to a given task handler. - */ -function page_manager_get_page_cache($task_name) { - $caches = &drupal_static(__FUNCTION__, array()); - if (!isset($caches[$task_name])) { - ctools_include('object-cache'); - $cache = ctools_object_cache_get('page_manager_page', $task_name); - if (!$cache) { - $cache = new stdClass(); - $cache->task_name = $task_name; - list($cache->task_id, $cache->subtask_id) = page_manager_get_task_id($cache->task_name); - - $cache->task = page_manager_get_task($cache->task_id); - if (empty($cache->task)) { - return FALSE; - } - - if ($cache->subtask_id) { - $cache->subtask = page_manager_get_task_subtask($cache->task, $cache->subtask_id); - if (empty($cache->subtask)) { - return FALSE; - } - } - else { - $cache->subtask = $cache->task; - $cache->subtask['name'] = ''; - } - - $cache->handlers = page_manager_load_sorted_handlers($cache->task, $cache->subtask_id); - $cache->handler_info = array(); - foreach ($cache->handlers as $id => $handler) { - $cache->handler_info[$id] = array( - 'weight' => $handler->weight, - 'changed' => FALSE, - 'name' => $id, - ); - } - } - else { - // Ensure the task is loaded. - page_manager_get_task($cache->task_id); - } - - if ($task_name != '::new') { - $cache->locked = ctools_object_cache_test('page_manager_page', $task_name); - } - else { - $cache->locked = FALSE; - } - - $caches[$task_name] = $cache; - } - - return $caches[$task_name]; -} - -/** - * Store changes to a task handler in the object cache. - */ -function page_manager_set_page_cache($page) { - if (!empty($page->locked)) { - return; - } - - if (empty($page->task_name)) { - return; - } - - ctools_include('object-cache'); - $page->changed = TRUE; - $cache = ctools_object_cache_set('page_manager_page', $page->task_name, $page); -} - -/** - * Remove an item from the object cache. - */ -function page_manager_clear_page_cache($name) { - ctools_include('object-cache'); - ctools_object_cache_clear('page_manager_page', $name); -} - -/** - * Write all changes from the page cache and clear it out. - */ -function page_manager_save_page_cache($cache) { - // Save the subtask: - if ($function = ctools_plugin_get_function($cache->task, 'save subtask callback')) { - $function($cache->subtask, $cache); - } - - // Iterate through handlers and save/delete/update as necessary. - // Go through each of the task handlers, check to see if it needs updating, - // and update it if so. - foreach ($cache->handler_info as $id => $info) { - $handler = &$cache->handlers[$id]; - // If it has been marked for deletion, delete it. - if ($info['changed'] & PAGE_MANAGER_CHANGED_DELETED) { - page_manager_delete_task_handler($handler); - } - // If it has been somehow edited (or added), write the cached version. - elseif ($info['changed'] & PAGE_MANAGER_CHANGED_CACHED) { - // Make sure we get updated weight from the form for this. - $handler->weight = $info['weight']; - page_manager_save_task_handler($handler); - } - // Otherwise, check to see if it has moved and, if so, update the weight. - elseif ($info['weight'] != $handler->weight) { - // Theoretically we could only do this for in code objects, but since our - // load mechanism checks for all, this is less database work. - page_manager_update_task_handler_weight($handler, $info['weight']); - } - - // Set enable/disabled status. - if ($info['changed'] & PAGE_MANAGER_CHANGED_STATUS) { - ctools_include('export'); - ctools_export_set_object_status($cache->handlers[$id], $info['disabled']); - } - } - - page_manager_clear_page_cache($cache->task_name); - - if (!empty($cache->path_changed) || !empty($cache->new)) { - // Force a menu rebuild to make sure the menu entries are set. - menu_rebuild(); - } - cache_clear_all(); -} - -/** - * Menu callback to load a page manager cache object for menu callbacks. - */ -function page_manager_cache_load($task_name) { - // Load context plugin as there may be contexts cached here. - ctools_include('context'); - return page_manager_get_page_cache($task_name); -} - -/** - * Generate a unique name for a task handler. - * - * Task handlers need to be named but they aren't allowed to set their own - * names. Instead, they are named based upon their parent task and type. - */ -function page_manager_handler_get_name($task_name, $handlers, $handler) { - $base = str_replace('-', '_', $task_name); - $name = ''; - - // Optional machine name. - if (!empty($handler->conf['name'])) { - $name = $base . '__' . $handler->conf['name']; - if (count(ctools_export_load_object('page_manager_handlers', 'names', array($name)))) { - $name = ''; - } - } - - // If no machine name was provided or the name is in use, generate a unique name. - if (empty($name)) { - $base .= '__' . $handler->handler; - - // Use the ctools uuid generator to generate a unique id. - $name = $base . '_' . ctools_uuid_generate(); - } - - return $name; -} - -/** - * Import a handler into a page. - * - * This is used by both import and clone, since clone just exports the - * handler and immediately imports it. - */ -function page_manager_handler_add_to_page(&$page, &$handler, $title = NULL) { - $last = end($page->handler_info); - $handler->weight = $last ? $last['weight'] + 1 : 0; - $handler->task = $page->task_id; - $handler->subtask = $page->subtask_id; - $handler->export_type = EXPORT_IN_DATABASE; - $handler->type = t('Normal'); - - if ($title) { - $handler->conf['title'] = $title; - $handler->conf['name'] = trim(preg_replace('/[^a-z0-9_]+/', '-', strtolower($title)), '-'); - } - else { - $handler->conf['name'] = ''; - } - - $name = page_manager_handler_get_name($page->task_name, $page->handlers, $handler); - - $handler->name = $name; - - $page->handlers[$name] = $handler; - $page->handler_info[$name] = array( - 'weight' => $handler->weight, - 'name' => $handler->name, - 'changed' => PAGE_MANAGER_CHANGED_CACHED, - ); -} - -// -------------------------------------------------------------------------- -// Database routines -// -// This includes fetching plugins and plugin info as well as specialized -// fetch methods to get groups of task handlers per task. -/** - * Load a single task handler by name. - * - * Handlers can come from multiple sources; either the database or by normal - * export method, which is handled by the ctools library, but handlers can - * also be bundled with task/subtask. We have to check there and perform - * overrides as appropriate. - * - * Handlers bundled with the task are of a higher priority than default - * handlers provided by normal code, and are of a lower priority than - * the database, so we have to check the source of handlers when we have - * multiple to choose from. - */ -function page_manager_load_task_handler($task, $subtask_id, $name) { - ctools_include('export'); - $result = ctools_export_load_object('page_manager_handlers', 'names', array($name)); - $handlers = page_manager_get_default_task_handlers($task, $subtask_id); - return page_manager_compare_task_handlers($result, $handlers, $name); -} - -/** - * Load all task handlers for a given task/subtask. - */ -function page_manager_load_task_handlers($task, $subtask_id = NULL, $default_handlers = NULL) { - ctools_include('export'); - $conditions = array( - 'task' => $task['name'], - ); - - if (isset($subtask_id)) { - $conditions['subtask'] = $subtask_id; - } - - $handlers = ctools_export_load_object('page_manager_handlers', 'conditions', $conditions); - $defaults = isset($default_handlers) ? $default_handlers : page_manager_get_default_task_handlers($task, $subtask_id); - foreach ($defaults as $name => $default) { - $result = page_manager_compare_task_handlers($handlers, $defaults, $name); - - if ($result) { - $handlers[$name] = $result; - // Ensure task and subtask are correct, because it's easy to change task - // names when editing a default and fail to do it on the associated handlers. - $result->task = $task['name']; - $result->subtask = $subtask_id; - } - } - - // Override weights from the weight table. - if ($handlers) { - $names = array(); - $placeholders = array(); - foreach ($handlers as $handler) { - $names[] = $handler->name; - $placeholders[] = "'%s'"; - } - - $result = db_query('SELECT name, weight FROM {page_manager_weights} WHERE name IN (:names)', array(':names' => $names)); - foreach ($result as $weight) { - $handlers[$weight->name]->weight = $weight->weight; - } - } - - return $handlers; -} - -/** - * Get the default task handlers from a task, if they exist. - * - * Tasks can contain 'default' task handlers which are provided by the - * default task. Because these can come from either the task or the - * subtask, the logic is abstracted to reduce code duplication. - */ -function page_manager_get_default_task_handlers($task, $subtask_id) { - // Load default handlers that are provied by the task/subtask itself. - $handlers = array(); - if ($subtask_id) { - $subtask = page_manager_get_task_subtask($task, $subtask_id); - if (isset($subtask['default handlers'])) { - $handlers = $subtask['default handlers']; - } - } - elseif (isset($task['default handlers'])) { - $handlers = $task['default handlers']; - } - - return $handlers; -} - -/** - * Compare a single task handler from two lists and provide the correct one. - * - * Task handlers can be gotten from multiple sources. As exportable objects, - * they can be provided by default hooks and the database. But also, because - * they are tightly bound to tasks, they can also be provided by default - * tasks. This function reconciles where to pick up a task handler between - * the exportables list and the defaults provided by the task itself. - * - * @param $result - * A list of handlers provided by export.inc - * @param $handlers - * A list of handlers provided by the default task. - * @param $name - * Which handler to compare. - * - * @return - * Which handler to use, if any. May be NULL. - */ -function page_manager_compare_task_handlers($result, $handlers, $name) { - // Compare our special default handler against the actual result, if - // any, and do the right thing. - if (!isset($result[$name]) && isset($handlers[$name])) { - $handlers[$name]->type = t('Default'); - $handlers[$name]->export_type = EXPORT_IN_CODE; - return $handlers[$name]; - } - elseif (isset($result[$name]) && !isset($handlers[$name])) { - return $result[$name]; - } - elseif (isset($result[$name]) && isset($handlers[$name])) { - if ($result[$name]->export_type & EXPORT_IN_DATABASE) { - $result[$name]->type = t('Overridden'); - $result[$name]->export_type = $result[$name]->export_type | EXPORT_IN_CODE; - return $result[$name]; - } - else { - // In this case, our default is a higher priority than the standard default. - $handlers[$name]->type = t('Default'); - $handlers[$name]->export_type = EXPORT_IN_CODE; - return $handlers[$name]; - } - } -} - -/** - * Load all task handlers for a given task and subtask and sort them. - */ -function page_manager_load_sorted_handlers($task, $subtask_id = NULL, $enabled = FALSE) { - $handlers = page_manager_load_task_handlers($task, $subtask_id); - if ($enabled) { - foreach ($handlers as $id => $handler) { - if (!empty($handler->disabled)) { - unset($handlers[$id]); - } - } - } - uasort($handlers, 'page_manager_sort_task_handlers'); - return $handlers; -} - -/** - * Callback for uasort to sort task handlers. - * - * Task handlers are sorted by weight then by name. - */ -function page_manager_sort_task_handlers($a, $b) { - if ($a->weight < $b->weight) { - return -1; - } - elseif ($a->weight > $b->weight) { - return 1; - } - elseif ($a->name < $b->name) { - return -1; - } - elseif ($a->name > $b->name) { - return 1; - } - - return 0; -} - -/** - * Write a task handler to the database. - */ -function page_manager_save_task_handler(&$handler) { - $update = (isset($handler->did)) ? array('did') : array(); - // Let the task handler respond to saves: - if ($function = ctools_plugin_load_function('page_manager', 'task_handlers', $handler->handler, 'save')) { - $function($handler, $update); - } - - drupal_write_record('page_manager_handlers', $handler, $update); - db_delete('page_manager_weights') - ->condition('name', $handler->name) - ->execute(); - - // If this was previously a default handler, we may have to write task handlers. - if (!$update) { - // @todo wtf was I going to do here? - } - return $handler; -} - -/** - * Remove a task handler. - */ -function page_manager_delete_task_handler($handler) { - // Let the task handler respond to saves: - if ($function = ctools_plugin_load_function('page_manager', 'task_handlers', $handler->handler, 'delete')) { - $function($handler); - } - db_delete('page_manager_handlers') - ->condition('name', $handler->name) - ->execute(); - db_delete('page_manager_weights') - ->condition('name', $handler->name) - ->execute(); -} - -/** - * Export a task handler into code suitable for import or use as a default - * task handler. - */ -function page_manager_export_task_handler($handler, $indent = '') { - ctools_include('export'); - ctools_include('plugins'); - $handler = clone $handler; - - $append = ''; - if ($function = ctools_plugin_load_function('page_manager', 'task_handlers', $handler->handler, 'export')) { - $append = $function($handler, $indent); - } - - $output = ctools_export_object('page_manager_handlers', $handler, $indent); - $output .= $append; - - return $output; -} - -/** - * Loads page manager handler for export. - * - * Callback to load page manager handler within ctools_export_crud_load(). - * - * @param string $name - * The name of the handler to load. - * - * @return - * Loaded page manager handler object, extended with external properties. - */ -function page_manager_export_task_handler_load($name) { - $table = 'page_manager_handlers'; - $schema = ctools_export_get_schema($table); - $export = $schema['export']; - - $result = ctools_export_load_object($table, 'names', array($name)); - if (isset($result[$name])) { - $handler = $result[$name]; - - // Weight is stored in additional table so that in-code task handlers - // don't need to get written to the database just because they have their - // weight changed. Therefore, handler could have no correspondent database - // entry. Revert will not be performed for this handler and the weight - // will not be reverted. To make possible revert of the weight field - // export_type must simulate that the handler is stored in the database. - $handler->export_type = EXPORT_IN_DATABASE; - - // Also, page manager handler weight should be overriden with correspondent - // weight from page_manager_weights table, if there is one. - $result = db_query('SELECT weight FROM {page_manager_weights} WHERE name = (:names)', array(':names' => $handler->name))->fetchField(); - if (is_numeric($result)) { - $handler->weight = $result; - } - return $handler; - } -} - -/** - * Create a new task handler object. - * - * @param $plugin - * The plugin this task handler is created from. - */ -function page_manager_new_task_handler($plugin) { - // Generate a unique name. Unlike most named objects, we don't let people choose - // names for task handlers because they mostly don't make sense. - // Create a new, empty handler object. - $handler = new stdClass(); - $handler->title = $plugin['title']; - $handler->task = NULL; - $handler->subtask = NULL; - $handler->name = NULL; - $handler->handler = $plugin['name']; - $handler->weight = 0; - $handler->conf = array(); - - // These are provided by the core export API provided by ctools and we - // set defaults here so that we don't cause notices. Perhaps ctools should - // provide a way to do this for us so we don't have to muck with it. - $handler->export_type = EXPORT_IN_DATABASE; - $handler->type = t('Local'); - - if (isset($plugin['default conf'])) { - if (is_array($plugin['default conf'])) { - $handler->conf = $plugin['default conf']; - } - elseif (function_exists($plugin['default conf'])) { - $handler->conf = $plugin['default conf']($handler); - } - } - - return $handler; -} - -/** - * Set an overidden weight for a task handler. - * - * We do this so that in-code task handlers don't need to get written - * to the database just because they have their weight changed. - */ -function page_manager_update_task_handler_weight($handler, $weight) { - db_delete('page_manager_weights') - ->condition('name', $handler->name) - ->execute(); - db_insert('page_manager_weights') - ->fields(array( - 'name' => $handler->name, - 'weight' => $weight, - )) - ->execute(); -} - -/** - * Shortcut function to get task plugins. - */ -function page_manager_get_tasks() { - ctools_include('plugins'); - return ctools_get_plugins('page_manager', 'tasks'); -} - -/** - * Shortcut function to get a task plugin. - */ -function page_manager_get_task($id) { - ctools_include('plugins'); - return ctools_get_plugins('page_manager', 'tasks', $id); -} - -/** - * Get all tasks for a given type. - */ -function page_manager_get_tasks_by_type($type) { - ctools_include('plugins'); - $all_tasks = ctools_get_plugins('page_manager', 'tasks'); - $tasks = array(); - foreach ($all_tasks as $id => $task) { - if (isset($task['task type']) && $task['task type'] == $type) { - $tasks[$id] = $task; - } - } - - return $tasks; -} - -/** - * Fetch all subtasks for a page managertask. - * - * @param $task - * A loaded $task plugin object. - */ -function page_manager_get_task_subtasks($task) { - if (empty($task['subtasks'])) { - return array(); - } - - if ($function = ctools_plugin_get_function($task, 'subtasks callback')) { - $retval = $function($task); - if (is_array($retval)) { - return $retval; - } - } - - return array(); -} - -/** - * Fetch all subtasks for a page managertask. - * - * @param $task - * A loaded $task plugin object. - * @param $subtask_id - * The subtask ID to load. - */ -function page_manager_get_task_subtask($task, $subtask_id) { - if (empty($task['subtasks'])) { - return; - } - - if ($function = ctools_plugin_get_function($task, 'subtask callback')) { - return $function($task, $subtask_id); - } -} - -/** - * Shortcut function to get task handler plugins. - */ -function page_manager_get_task_handlers() { - ctools_include('plugins'); - return ctools_get_plugins('page_manager', 'task_handlers'); -} - -/** - * Shortcut function to get a task handler plugin. - */ -function page_manager_get_task_handler($id) { - ctools_include('plugins'); - return ctools_get_plugins('page_manager', 'task_handlers', $id); -} - -/** - * Retrieve a list of all applicable task handlers for a given task. - * - * This looks at the $task['handler type'] and compares that to $task_handler['handler type']. - * If the task has no type, the id of the task is used instead. - */ -function page_manager_get_task_handler_plugins($task, $all = FALSE) { - $type = isset($task['handler type']) ? $task['handler type'] : $task['name']; - $name = $task['name']; - - $handlers = array(); - $task_handlers = page_manager_get_task_handlers(); - foreach ($task_handlers as $id => $handler) { - $task_type = is_array($handler['handler type']) ? $handler['handler type'] : array($handler['handler type']); - if (in_array($type, $task_type) || in_array($name, $task_type)) { - if ($all || !empty($handler['visible'])) { - $handlers[$id] = $handler; - } - } - } - - return $handlers; -} - -/** - * Get the title for a given handler. - * - * If the plugin has no 'admin title' function, the generic title of the - * plugin is used instead. - */ -function page_manager_get_handler_title($plugin, $handler, $task, $subtask_id) { - $function = ctools_plugin_get_function($plugin, 'admin title'); - if ($function) { - return $function($handler, $task, $subtask_id); - } - else { - return $plugin['title']; - } -} - -/** - * Get the admin summary (additional info) for a given handler. - */ -function page_manager_get_handler_summary($plugin, $handler, $page, $title = TRUE) { - if ($function = ctools_plugin_get_function($plugin, 'admin summary')) { - return $function($handler, $page->task, $page->subtask, $page, $title); - } -} - -/** - * Get the admin summary (additional info) for a given page. - */ -function page_manager_get_page_summary($task, $subtask) { - if ($function = ctools_plugin_get_function($subtask, 'admin summary')) { - return $function($task, $subtask); - } -} - -/** - * Split a task name into a task id and subtask id, if applicable. - */ -function page_manager_get_task_id($task_name) { - if (strpos($task_name, '-') !== FALSE) { - return explode('-', $task_name, 2); - } - else { - return array($task_name, NULL); - } -} - -/** - * Turn a task id + subtask_id into a task name. - */ -function page_manager_make_task_name($task_id, $subtask_id) { - if ($subtask_id) { - return $task_id . '-' . $subtask_id; - } - else { - return $task_id; - } -} - -/** - * Get the render function for a handler. - */ -function page_manager_get_renderer($handler) { - return ctools_plugin_load_function('page_manager', 'task_handlers', $handler->handler, 'render'); -} - -// -------------------------------------------------------------------------- -// Functions existing on behalf of tasks and task handlers - - -/** - * Page manager arg load function because menu system will not load extra - * files for these; they must be in a .module. - */ -function pm_arg_load($value, $subtask, $argument) { - page_manager_get_task('page'); - return _pm_arg_load($value, $subtask, $argument); -} - -/** - * Special arg_load function to use %menu_tail like functionality to - * get everything after the arg together as a single value. - */ -function pm_arg_tail_load($value, $subtask, $argument, $map) { - $value = implode('/', array_slice($map, $argument)); - page_manager_get_task('page'); - return _pm_arg_load($value, $subtask, $argument); -} - -/** - * Special menu _load() function for the user:uid argument. - * - * This is just the normal page manager argument. It only exists so that - * the to_arg can exist. - */ -function pm_uid_arg_load($value, $subtask, $argument) { - page_manager_get_task('page'); - return _pm_arg_load($value, $subtask, $argument); -} - -/** - * to_arg function for the user:uid argument to provide the arg for the - * current global user. - */ -function pm_uid_arg_to_arg($arg) { - return user_uid_optional_to_arg($arg); -} - -/** - * Callback for access control ajax form on behalf of page.inc task. - * - * Returns the cached access config and contexts used. - */ -function page_manager_page_ctools_access_get($argument) { - $page = page_manager_get_page_cache($argument); - - $contexts = array(); - - // Load contexts based on argument data: - if ($arguments = _page_manager_page_get_arguments($page->subtask['subtask'])) { - $contexts = ctools_context_get_placeholders_from_argument($arguments); - } - - return array($page->subtask['subtask']->access, $contexts); -} - -/** - * Callback for access control ajax form on behalf of page.inc task. - * - * Writes the changed access to the cache. - */ -function page_manager_page_ctools_access_set($argument, $access) { - $page = page_manager_get_page_cache($argument); - $page->subtask['subtask']->access = $access; - page_manager_set_page_cache($page); -} - -/** - * Callback for access control ajax form on behalf of context task handler. - * - * Returns the cached access config and contexts used. - */ -function page_manager_task_handler_ctools_access_get($argument) { - list($task_name, $name) = explode('*', $argument); - $page = page_manager_get_page_cache($task_name); - if (empty($name)) { - $handler = &$page->new_handler; - } - else { - $handler = &$page->handlers[$name]; - } - - if (!isset($handler->conf['access'])) { - $handler->conf['access'] = array(); - } - - ctools_include('context-task-handler'); - - $contexts = ctools_context_handler_get_all_contexts($page->task, $page->subtask, $handler); - - return array($handler->conf['access'], $contexts); -} - -/** - * Callback for access control ajax form on behalf of context task handler. - * - * Writes the changed access to the cache. - */ -function page_manager_task_handler_ctools_access_set($argument, $access) { - list($task_name, $name) = explode('*', $argument); - $page = page_manager_get_page_cache($task_name); - if (empty($name)) { - $handler = &$page->new_handler; - } - else { - $handler = &$page->handlers[$name]; - } - - $handler->conf['access'] = $access; - page_manager_set_page_cache($page); -} - -/** - * Form a URL to edit a given page given the trail. - */ -function page_manager_edit_url($task_name, $trail = array()) { - if (!is_array($trail)) { - $trail = array($trail); - } - - if (empty($trail) || $trail == array('summary')) { - return "admin/structure/pages/edit/$task_name"; - } - - return 'admin/structure/pages/nojs/operation/' . $task_name . '/' . implode('/', $trail); -} - -/** - * Watch menu links during the menu rebuild, and re-parent things if we need to. - */ -function page_manager_menu_link_alter(&$item) { - return; -/** -- disabled, concept code -- - static $mlids = array(); - // Keep an array of mlids as links are saved that we can use later. - if (isset($item['mlid'])) { - $mlids[$item['path']] = $item['mlid']; - } - - if (isset($item['parent_path'])) { - if (isset($mlids[$item['parent_path']])) { - $item['plid'] = $mlids[$item['parent_path']]; - } - else { - // Since we didn't already see an mlid, let's check the database for one. - $mlid = db_query('SELECT mlid FROM {menu_links} WHERE router_path = :path', array('path' => $item['parent_path']))->fetchField(); - if ($mlid) { - $item['plid'] = $mlid; - } - } - } - */ -} - -/** - * Callback to list handlers available for export. - */ -function page_manager_page_manager_handlers_list() { - $list = $types = array(); - $tasks = page_manager_get_tasks(); - foreach ($tasks as $type => $info) { - if (empty($info['non-exportable'])) { - $types[] = $type; - } - } - - $handlers = ctools_export_load_object('page_manager_handlers'); - foreach ($handlers as $handler) { - if (in_array($handler->task, $types)) { - $plugin = page_manager_get_task_handler($handler->handler); - $title = page_manager_get_handler_title($plugin, $handler, $tasks[$handler->task], $handler->subtask); - - if ($title) { - $list[$handler->name] = check_plain("$handler->task: $title ($handler->name)"); - } - else { - $list[$handler->name] = check_plain("$handler->task: ($handler->name)"); - } - } - } - return $list; -} - -/** - * Callback to bulk export page manager pages. - */ -function page_manager_page_manager_pages_to_hook_code($names = array(), $name = 'foo') { - $schema = ctools_export_get_schema('page_manager_pages'); - $export = $schema['export']; - $objects = ctools_export_load_object('page_manager_pages', 'names', array_values($names)); - if ($objects) { - $code = "/**\n"; - $code .= " * Implements hook_{$export['default hook']}()\n"; - $code .= " */\n"; - $code .= "function " . $name . "_{$export['default hook']}() {\n"; - foreach ($objects as $object) { - // Have to implement our own because this export func sig requires it. - $code .= $export['export callback']($object, TRUE, ' '); - $code .= " \${$export['identifier']}s['" . check_plain($object->{$export['key']}) . "'] = \${$export['identifier']};\n\n"; - } - $code .= " return \${$export['identifier']}s;\n"; - $code .= "}\n"; - return $code; - } -} - -/** - * Get the current page information. - * - * @return $page - * An array containing the following information. - * - * - 'name': The name of the page as used in the page manager admin UI. - * - 'task': The plugin for the task in use. If this is a system page it - * will contain information about that page, such as what functions - * it uses. - * - 'subtask': The plugin for the subtask. If this is a custom page, this - * will contain information about that custom page. See 'subtask' in this - * array to get the actual page object. - * - 'handler': The actual handler object used. If using panels, see - * $page['handler']->conf['display'] for the actual panels display - * used to render. - * - 'contexts': The context objects used to render this page. - * - 'arguments': The raw arguments from the URL used on this page. - */ -function page_manager_get_current_page($page = NULL) { - static $current = array(); - if (isset($page)) { - $current = $page; - } - - return $current; -} - -/** - * Implementation of hook_panels_dashboard_blocks(). - * - * Adds page information to the Panels dashboard. - */ -function page_manager_panels_dashboard_blocks(&$vars) { - $vars['links']['page_manager'] = array( - 'weight' => -100, - 'title' => l(t('Panel page'), 'admin/structure/pages/add'), - 'description' => t('Panel pages can be used as landing pages. They have a URL path, accept arguments and can have menu entries.'), - ); - - module_load_include('inc', 'page_manager', 'page_manager.admin'); - $tasks = page_manager_get_tasks_by_type('page'); - $pages = array('operations' => array()); - - page_manager_get_pages($tasks, $pages); - $count = 0; - $rows = array(); - foreach ($pages['rows'] as $id => $info) { - $rows[] = array( - 'data' => array( - $info['data']['title'], - $info['data']['operations'], - ), - 'class' => $info['class'], - ); - - // Only show 10. - if (++$count >= 10) { - break; - } - } - - $vars['blocks']['page_manager'] = array( - 'weight' => -100, - 'title' => t('Manage pages'), - 'link' => l(t('Go to list'), 'admin/structure/pages'), - 'content' => theme('table', array('header' => array(), 'rows' => $rows, 'attributes' => array('class' => 'panels-manage'))), - 'class' => 'dashboard-pages', - 'section' => 'right', - ); -} - -/** - * Implement pseudo-hook to fetch addressable content. - * - * For Page Manager, the address will be an array. The first - * element will be the $task and the second element will be the - * $task_handler. The third elements will be the arguments - * provided. - */ -function page_manager_addressable_content($address, $type) { - if (count($address) < 3) { - return; - } - - $task_name = array_shift($address); - $subtask_name = array_shift($address); - $handler_name = array_shift($address); - if ($address) { - $arguments = array_shift($address); - } - - // Since $arguments is an array of arbitrary size, we need to implode it: - if (!empty($arguments)) { - // The only choices we have for separators since :: is already - // used involve ., - or _. Since - and _ are more common than . - // in URLs, let's try .. as an argument separator. - $arguments = explode('..', $arguments); - } - else { - // Implode does not return an empty array on an empty - // string so do it specifically. - $arguments = array(); - } - - $task = page_manager_get_task($task_name); - if (!$task) { - return; - } - - $handler = page_manager_load_task_handler($task, $subtask_name, $handler_name); - if (!$handler) { - return; - } - - $handler_plugin = page_manager_get_task_handler($handler->handler); - if (!$handler_plugin) { - return; - } - - // Load the contexts for the task. - ctools_include('context'); - ctools_include('context-task-handler'); - $contexts = ctools_context_handler_get_task_contexts($task, $subtask_name, $arguments); - - // With contexts loaded, ensure the task is accessible. Tasks without a callback - // are automatically accessible. - $function = ctools_plugin_get_function($task, 'access callback'); - if ($function && !$function($task, $subtask_name, $contexts)) { - return; - } - - $function = ctools_plugin_get_function($handler_plugin, 'addressable callback'); - if ($function) { - return $function($task, $subtask_name, $handler, $address, $contexts, $arguments, $type); - } -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/cache/page_manager_context.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/cache/page_manager_context.inc deleted file mode 100644 index a60b9e6bd..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/cache/page_manager_context.inc +++ /dev/null @@ -1,70 +0,0 @@ - t('Page manager context'), - 'cache get' => 'page_manager_cache_page_manager_context_cache_get', - 'cache set' => 'page_manager_cache_page_manager_context_cache_set', - 'cache finalize' => 'page_manager_cache_page_manager_context_cache_finalize', - - // We don't support a clear because the general uses of clear have no effect - // on us. -); - -function page_manager_cache_page_manager_context_cache_get($data, $key) { - $page = page_manager_get_page_cache($data); - if ($page) { - if (!empty($page->context_cache[$key])) { - return $page->context_cache[$key]; - } - else { - ctools_include('context-task-handler'); - if ($key == 'temp') { - $handler = $page->new_handler; - } - else { - $handler = $page->handlers[$key]; - } - return ctools_context_handler_get_task_object($page->task, $page->subtask, $handler); - } - } -} - -function page_manager_cache_page_manager_context_cache_set($data, $key, $object) { - $page = page_manager_get_page_cache($data); - if ($page) { - $page->context_cache[$key] = $object; - return page_manager_set_page_cache($page); - } -} - -/** - * Copy temporary data from the page manager cache. - */ -function page_manager_cache_page_manager_context_cache_finalize($data, $key, $object) { - // Statically cached so there shouldn't be any worries. It's an object so - // referencing ensures that we'll get the right one. - $page = page_manager_get_page_cache($data); - if ($page) { - if ($key == 'temp') { - $handler = $page->new_handler; - } - else { - $handler = $page->handlers[$key]; - } - $handler->conf['contexts'] = $object->contexts; - $handler->conf['relationships'] = $object->relationships; - - if (isset($page->context_cache[$key])) { - unset($page->context_cache[$key]); - } - return page_manager_set_page_cache($page); - } -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/task_handlers/http_response.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/task_handlers/http_response.inc deleted file mode 100644 index 9c53f3467..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/task_handlers/http_response.inc +++ /dev/null @@ -1,333 +0,0 @@ - 'context', - 'visible' => TRUE, // may be added up front. - - // Administrative fields. - 'title' => t('HTTP response code'), - 'admin summary' => 'page_manager_http_response_admin_summary', - 'admin title' => 'page_manager_http_response_title', - 'operations' => array( - 'settings' => array( - 'title' => t('General'), - 'description' => t('Change general settings for this variant.'), - 'form' => 'page_manager_http_response_edit_settings', - ), - 'criteria' => array( - 'title' => t('Selection rules'), - 'description' => t('Control the criteria used to decide whether or not this variant is used.'), - 'ajax' => FALSE, - 'form' => array( - 'order' => array( - 'form' => t('Selection rules'), - ), - 'forms' => array( - 'form' => array( - 'include' => drupal_get_path('module', 'ctools') . '/includes/context-task-handler.inc', - 'form id' => 'ctools_context_handler_edit_criteria', - ), - ), - ), - ), - 'context' => array( - 'title' => t('Contexts'), - 'ajax' => FALSE, - 'description' => t('Add additional context objects to this variant that can be used by the content.'), - 'form' => array( - 'order' => array( - 'form' => t('Context'), - ), - 'forms' => array( - 'form' => array( - 'include' => drupal_get_path('module', 'ctools') . '/includes/context-task-handler.inc', - 'form id' => 'ctools_context_handler_edit_context', - ), - ), - ), - ), - ), - - // Callback to render the data. - 'render' => 'page_manager_http_response_render', - - 'add features' => array( - 'criteria' => t('Selection rules'), - 'context' => t('Contexts'), - ), - // Where to go when finished. - 'add finish' => 'settings', - - 'required forms' => array( - 'settings' => t('Panel settings'), - ), - - 'edit forms' => array( - 'criteria' => t('Selection rules'), - 'settings' => t('General'), - 'context' => t('Contexts'), - ), - 'forms' => array( - 'settings' => array( - 'form id' => 'page_manager_http_response_edit_settings', - ), - 'context' => array( - 'include' => drupal_get_path('module', 'ctools') . '/includes/context-task-handler.inc', - 'form id' => 'ctools_context_handler_edit_context', - ), - 'criteria' => array( - 'include' => drupal_get_path('module', 'ctools') . '/includes/context-task-handler.inc', - 'form id' => 'ctools_context_handler_edit_criteria', - ), - ), - 'default conf' => array( - 'title' => t('HTTP response code'), - 'contexts' => array(), - 'relationships' => array(), - 'code' => '404', - 'destination' => '', - ), -); - -/** - * Provide a list of the response codes we support. - * - * Abstracted so it can be more readily used both on input and output. - */ -function page_manager_http_response_codes() { - return array( - 403 => t('403 Access denied'), - 404 => t('404 Page not found'), - 410 => t('410 Gone'), - 301 => t('301 Permanent redirect'), - 302 => t('302 Temporary redirect'), - ); -} - -function page_manager_http_response_admin_summary($handler, $task, $subtask, $page, $show_title = TRUE) { - $task_name = page_manager_make_task_name($task['name'], $subtask['name']); - $output = ''; - - ctools_include('context'); - ctools_include('context-task-handler'); - - // Get the operations. - $operations = page_manager_get_operations($page); - - // Get operations for just this handler. - $operations = $operations['handlers']['children'][$handler->name]['children']['actions']['children']; - $args = array('handlers', $handler->name, 'actions'); - $rendered_operations = page_manager_render_operations($page, $operations, array(), array('class' => array('actions')), 'actions', $args); - - $plugin = page_manager_get_task_handler($handler->handler); - - $object = ctools_context_handler_get_task_object($task, $subtask, $handler); - $context = ctools_context_load_contexts($object, TRUE); - - $access = ctools_access_group_summary(!empty($handler->conf['access']) ? $handler->conf['access'] : array(), $context); - if ($access) { - $access = t('This panel will be selected if @conditions.', array('@conditions' => $access)); - } - else { - $access = t('This panel will always be selected.'); - } - - $rows = array(); - - $type = $handler->type == t('Default') ? t('In code') : $handler->type; - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('Storage')), - array('class' => array('page-summary-data'), 'data' => $type), - array('class' => array('page-summary-operation'), 'data' => ''), - ); - - if (!empty($handler->disabled)) { - $link = l(t('Enable'), page_manager_edit_url($task_name, array('handlers', $handler->name, 'actions', 'enable'))); - $text = t('Disabled'); - } - else { - $link = l(t('Disable'), page_manager_edit_url($task_name, array('handlers', $handler->name, 'actions', 'disable'))); - $text = t('Enabled'); - } - - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('Status')), - array('class' => array('page-summary-data'), 'data' => $text), - array('class' => array('page-summary-operation'), 'data' => $link), - ); - - $link = l(t('Edit'), page_manager_edit_url($task_name, array('handlers', $handler->name, 'criteria'))); - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('Selection rule')), - array('class' => array('page-summary-data'), 'data' => $access), - array('class' => array('page-summary-operation'), 'data' => $link), - ); - - $link = l(t('Edit'), page_manager_edit_url($task_name, array('handlers', $handler->name, 'settings'))); - $codes = page_manager_http_response_codes(); - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('Response code')), - array('class' => array('page-summary-data'), 'data' => $codes[$handler->conf['code']]), - array('class' => array('page-summary-operation'), 'data' => $link), - ); - - $info = theme('table', array('header' => array(), 'rows' => $rows, 'attributes' => array('class' => array('page-manager-handler-summary')))); - - $title = $handler->conf['title']; - if ($title != t('Panel')) { - $title = t('Panel: @title', array('@title' => $title)); - } - - $output .= '
    '; - if ($show_title) { - $output .= '
    '; - $output .= '
    ' . $rendered_operations['actions'] . '
    '; - $output .= '' . $title . ''; - } - - $output .= '
    '; - $output .= $info; - $output .= '
    '; - - return $output; -} - -/** - * Set up a title for the panel based upon the selection rules. - */ -function page_manager_http_response_title($handler, $task, $subtask) { - if (isset($handler->conf['title'])) { - return check_plain($handler->conf['title']); - } - else { - return t('HTTP response code'); - } -} - -/** - * General settings for the panel. - */ -function page_manager_http_response_edit_settings($form, &$form_state) { - ctools_include('page_manager.admin', 'page_manager', ''); - ctools_include('export', 'ctools'); - - $conf = $form_state['handler']->conf; - $form['title'] = array( - '#type' => 'textfield', - '#default_value' => $conf['title'], - '#title' => t('Administrative title'), - '#description' => t('Administrative title of this variant.'), - ); - - $name = isset($conf['name']) ? $conf['name'] : FALSE; - $form['name'] = array( - '#type' => 'machine_name', - '#title' => t('Machine name'), - '#required' => FALSE, - '#default_value' => $name, - '#description' => t("A unique machine-readable name for this variant. It must only contain lowercase letters, numbers, and underscores. This name will be used when exporting the variant. If left empty the variant's name will be used instead."), - '#size' => 32, - '#maxlength' => 32, - '#machine_name' => array( - 'exists' => 'page_manager_handler_check_machine_name', - 'source' => array('title'), - ), - '#field_prefix' => '' . $form_state['task_name'] . '__', - '#field_suffix' => '‎', - ); - - $form['code'] = array( - '#title' => t('Response code'), - '#type' => 'select', - '#options' => page_manager_http_response_codes(), - '#default_value' => $conf['code'], - ); - - ctools_include('dependent'); - $form['destination'] = array( - '#type' => 'textfield', - '#title' => t('Redirect destination'), - '#default_value' => $conf['destination'], - '#dependency' => array('edit-code' => array(301, 302)), - '#description' => t('Enter the path to redirect to. You may use keyword substitutions from contexts. You can use external urls (http://www.example.com/foo) or internal urls (node/1).'), - ); - - return $form; -} - -function page_manager_http_response_edit_settings_submit($form, &$form_state) { - $machine_name = $form_state['handler']->name; - $name = $form_state['task_name'] . '__' . $form_state['values']['name']; - - // If new name doesn't equal machine name, we need to update and redirect. - if ($machine_name !== $name) { - $form_state['handler']->name = $name; - // If there's a trail, we need to replace it for redirection. - if (isset($form_state['trail'])) { - $form_state['new trail'] = $form_state['trail']; - $delta = array_search($machine_name, $form_state['new trail']); - $form_state['new trail'][$delta] = $name; - } - // If handler id is set, replace it. - if ($form_state['handler_id']) { - $form_state['handler_id'] = $name; - } - // If we're defining a new custom handler, move page handler to new name. - if (isset($form_state['page']->handlers[$machine_name]) && isset($form_state['page']->handler_info[$machine_name])) { - $form_state['page']->handlers[$name] = $form_state['page']->handlers[$machine_name]; - unset($form_state['page']->handlers[$machine_name]); - $form_state['page']->handler_info[$name] = $form_state['page']->handler_info[$machine_name]; - unset($form_state['page']->handler_info[$machine_name]); - } - } - - $form_state['handler']->conf['title'] = $form_state['values']['title']; - $form_state['handler']->conf['name'] = $form_state['values']['name']; - $form_state['handler']->conf['code'] = $form_state['values']['code']; - $form_state['handler']->conf['destination'] = $form_state['values']['destination']; -} - -function page_manager_http_response_render($handler, $base_contexts, $args, $test = TRUE) { - // Go through arguments and see if they match. - ctools_include('context'); - ctools_include('context-task-handler'); - - // Add my contexts. - $contexts = ctools_context_handler_get_handler_contexts($base_contexts, $handler); - - // Test. - if ($test && !ctools_context_handler_select($handler, $contexts)) { - return; - } - - if (isset($handler->handler)) { - ctools_context_handler_pre_render($handler, $contexts, $args); - } - - $info['response code'] = $handler->conf['code']; - if ($info['response code'] == 301 || $info['response code'] == 302) { - $path = ctools_context_keyword_substitute($handler->conf['destination'], array(), $contexts); - $url = parse_url($path); - if (isset($url['query'])) { - $path = strtr($path, array('?' . $url['query'] => '')); - $info['query'] = drupal_get_query_array($url['query']); - } - if (isset($url['fragment'])) { - $path = strtr($path, array('#' . $url['fragment'] => '')); - $info['fragment'] = $url['fragment']; - } - - $info['destination'] = rtrim($path, '?'); - } - - return $info; -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/blog.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/blog.inc deleted file mode 100644 index f20da0be6..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/blog.inc +++ /dev/null @@ -1,126 +0,0 @@ - 'page', - - 'title' => t('All blogs'), - 'admin title' => t('All blogs'), - 'admin description' => t('When enabled, this overrides the default Drupal behavior for the all blogs at /blog. If no variant is selected, the default Drupal most recent blog posts will be shown.'), - 'admin path' => 'blog', - - // Menu hooks so that we can alter the node/%node menu entry to point to us. - 'hook menu alter' => 'page_manager_blog_menu_alter', - - // This is task uses 'context' handlers and must implement these to give the - // handler data it needs. - 'handler type' => 'context', - - // Allow this to be enabled or disabled: - 'disabled' => variable_get('page_manager_blog_disabled', TRUE), - 'enable callback' => 'page_manager_blog_enable', - 'access callback' => 'page_manager_blog_access_check', - ); -} - -/** - * Callback defined by page_manager_blog_page_manager_tasks(). - * - * Alter the node edit input so that node edit comes to us rather than the - * normal node edit process. - */ -function page_manager_blog_menu_alter(&$items, $task) { - if (variable_get('page_manager_blog_disabled', TRUE)) { - return; - } - - $callback = $items['blog']['page callback']; - // Override the node edit handler for our purpose. - if ($callback == 'blog_page_last' || variable_get('page_manager_override_anyway', FALSE)) { - $items['blog']['page callback'] = 'page_manager_blog'; - $items['blog']['file path'] = $task['path']; - $items['blog']['file'] = $task['file']; - } - else { - variable_set('page_manager_blog_disabled', TRUE); - if (!empty($GLOBALS['page_manager_enabling_blog'])) { - drupal_set_message(t('Page manager module is unable to enable blog because some other module already has overridden with %callback.', array('%callback' => $callback)), 'warning'); - } - return; - } - -} - -/** - * Entry point for our overridden node edit. - * - * This function asks its assigned handlers who, if anyone, would like - * to run with it. If no one does, it passes through to Drupal core's - * node edit, which is node_page_edit(). - */ -function page_manager_blog() { - // Load my task plugin. - $task = page_manager_get_task('blog'); - - ctools_include('context'); - ctools_include('context-task-handler'); - $output = ctools_context_handler_render($task, '', array(), array()); - if ($output !== FALSE) { - return $output; - } - - module_load_include('inc', 'blog', 'blog.pages'); - $function = 'blog_page_last'; - foreach (module_implements('page_manager_override') as $module) { - $call = $module . '_page_manager_override'; - if (($rc = $call('blog')) && function_exists($rc)) { - $function = $rc; - break; - } - } - - // Otherwise, fall back. - return $function(); -} - -/** - * Callback to enable/disable the page from the UI. - */ -function page_manager_blog_enable($cache, $status) { - variable_set('page_manager_blog_disabled', $status); - // Set a global flag so that the menu routine knows it needs - // to set a message if enabling cannot be done. - if (!$status) { - $GLOBALS['page_manager_enabling_blog'] = TRUE; - } -} - -/** - * Callback to determine if a page is accessible. - * - * @param $task - * The task plugin. - * @param $subtask_id - * The subtask id - * @param $contexts - * The contexts loaded for the task. - * - * @return - * TRUE if the current user can access the page. - */ -function page_manager_blog_access_check($task, $subtask_id, $contexts) { - return user_access('access content'); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/blog_user.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/blog_user.inc deleted file mode 100644 index e75629821..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/blog_user.inc +++ /dev/null @@ -1,157 +0,0 @@ - 'page', - 'title' => t('User blog'), - 'admin title' => t('User blog'), - 'admin description' => t('When enabled, this overrides the default Drupal behavior for displaying user blogs at blog/%user. If no variant is selected, the default Drupal user blog will be used.'), - 'admin path' => 'blog/%user', - - // Callback to add items to the page managertask administration form: - 'task admin' => 'page_manager_blog_user_task_admin', - - 'hook menu alter' => 'page_manager_blog_user_menu_alter', - - // This is task uses 'context' handlers and must implement these to give the - // handler data it needs. - 'handler type' => 'context', // handler type -- misnamed - 'get arguments' => 'page_manager_blog_user_get_arguments', - 'get context placeholders' => 'page_manager_blog_user_get_contexts', - - // Allow this to be enabled or disabled: - 'disabled' => variable_get('page_manager_blog_user_disabled', TRUE), - 'enable callback' => 'page_manager_blog_user_enable', - 'access callback' => 'page_manager_blog_user_access_check', - ); -} - -/** - * Callback defined by page_manager_blog_user_page_manager_tasks(). - * - * Alter the user view input so that user view comes to us rather than the - * normal user view process. - */ -function page_manager_blog_user_menu_alter(&$items, $task) { - if (variable_get('page_manager_blog_user_disabled', TRUE)) { - return; - } - - // Override the user view handler for our purpose. - if ($items['blog/%user_uid_optional']['page callback'] == 'blog_page_user' || variable_get('page_manager_override_anyway', FALSE)) { - $items['blog/%user_uid_optional']['page callback'] = 'page_manager_blog_user'; - $items['blog/%user_uid_optional']['file path'] = $task['path']; - $items['blog/%user_uid_optional']['file'] = $task['file']; - } - else { - // Automatically disable this task if it cannot be enabled. - variable_set('page_manager_blog_user_disabled', TRUE); - if (!empty($GLOBALS['page_manager_enabling_blog_user'])) { - drupal_set_message(t('Page manager module is unable to enable blog/%user because some other module already has overridden with %callback.', array('%callback' => $items['blog/%user']['page callback'])), 'error'); - } - } -} - -/** - * Entry point for our overridden user view. - * - * This function asks its assigned handlers who, if anyone, would like - * to run with it. If no one does, it passes through to Drupal core's - * user view, which is user_page_view(). - */ -function page_manager_blog_user($account) { - // Load my task plugin: - $task = page_manager_get_task('blog_user'); - - // Load the account into a context. - ctools_include('context'); - ctools_include('context-task-handler'); - $contexts = ctools_context_handler_get_task_contexts($task, '', array($account)); - - $output = ctools_context_handler_render($task, '', $contexts, array($account->uid)); - if ($output !== FALSE) { - return $output; - } - - module_load_include('inc', 'blog', 'blog.pages'); - $function = 'blog_page_user'; - foreach (module_implements('page_manager_override') as $module) { - $call = $module . '_page_manager_override'; - if (($rc = $call('blog_user')) && function_exists($rc)) { - $function = $rc; - break; - } - } - - // Otherwise, fall back. - return $function($account); -} - -/** - * Callback to get arguments provided by this task handler. - * - * Since this is the node view and there is no UI on the arguments, we - * create dummy arguments that contain the needed data. - */ -function page_manager_blog_user_get_arguments($task, $subtask_id) { - return array( - array( - 'keyword' => 'user', - 'identifier' => t('User being viewed'), - 'id' => 1, - 'name' => 'uid', - 'settings' => array(), - ), - ); -} - -/** - * Callback to get context placeholders provided by this handler. - */ -function page_manager_blog_user_get_contexts($task, $subtask_id) { - return ctools_context_get_placeholders_from_argument(page_manager_blog_user_get_arguments($task, $subtask_id)); -} - -/** - * Callback to enable/disable the page from the UI. - */ -function page_manager_blog_user_enable($cache, $status) { - variable_set('page_manager_blog_user_disabled', $status); - - // Set a global flag so that the menu routine knows it needs - // to set a message if enabling cannot be done. - if (!$status) { - $GLOBALS['page_manager_enabling_blog_user'] = TRUE; - } -} - -/** - * Callback to determine if a page is accessible. - * - * @param $task - * The task plugin. - * @param $subtask_id - * The subtask id - * @param $contexts - * The contexts loaded for the task. - * - * @return - * TRUE if the current user can access the page. - */ -function page_manager_blog_user_access_check($task, $subtask_id, $contexts) { - $context = reset($contexts); - return blog_page_user_access($context->data); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/comment_reply.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/comment_reply.inc deleted file mode 100644 index c25042350..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/comment_reply.inc +++ /dev/null @@ -1,166 +0,0 @@ - 'page', - - 'title' => t('Comment Reply page'), - 'admin title' => t('Comment Reply page'), - 'admin description' => t('When enabled, this overrides the default Drupal behavior for the site contact page at /contact. If no variant is selected, the default Drupal contact form will be used.'), - 'admin path' => 'comment/reply/%node', - - // Menu hooks so that we can alter the node/%node menu entry to point to us. - 'hook menu alter' => 'page_manager_comment_reply_menu_alter', - - // This is task uses 'context' handlers and must implement these to give the - // handler data it needs. - 'handler type' => 'context', - 'get arguments' => 'page_manager_comment_reply_get_arguments', - 'get context placeholders' => 'page_manager_comment_reply_get_contexts', - - // Allow this to be enabled or disabled: - 'disabled' => variable_get('page_manager_comment_reply_disabled', TRUE), - 'enable callback' => 'page_manager_comment_reply_enable', - 'access callback' => 'page_manager_comment_reply_check', - ); -} - -/** - * Callback to enable/disable the page from the UI. - */ -function page_manager_comment_reply_enable($cache, $status) { - variable_set('page_manager_comment_reply_disabled', $status); - // Set a global flag so that the menu routine knows it needs - // to set a message if enabling cannot be done. - if (!$status) { - $GLOBALS['page_manager_enabling_comment_reply'] = TRUE; - } -} - -/** - * Entry point for our overridden comment. - */ -function page_manager_comment_reply_page($node, $pid = NULL) { - // Load my task plugin. - $task = page_manager_get_task('comment_reply'); - - // Load the node into a context. - ctools_include('context'); - ctools_include('context-task-handler'); - - $contexts = ctools_context_handler_get_task_contexts($task, '', array($node, $pid)); - - if (array_key_exists('argument_cid_3', $contexts) && $contexts['argument_cid_3']->data->nid != $node->nid) { - // Attempting to reply to a comment not belonging to the current nid. - drupal_set_message(t('The comment you are replying to does not exist.'), 'error'); - drupal_goto("node/$node->nid"); - } - - $output = ctools_context_handler_render($task, '', $contexts, array($node, $pid)); - if ($output !== FALSE) { - return $output; - } - - $function = 'comment_reply'; - foreach (module_implements('page_manager_override') as $module) { - $call = $module . '_page_manager_override'; - if (($rc = $call('comment_reply')) && function_exists($rc)) { - $function = $rc; - break; - } - } - - module_load_include('inc', 'comment', 'comment.pages'); - return $function($node, $pid); -} - -/** - * Callback to get arguments provided by this task handler. - * - * Since this is the node view and there is no UI on the arguments, we - * create dummy arguments that contain the needed data. - */ -function page_manager_comment_reply_get_arguments($task, $subtask_id) { - return array( - array( - 'keyword' => 'node', - 'identifier' => t('Node being commented on'), - 'id' => 2, - 'name' => 'entity_id:node', - 'settings' => array(), - ), - array( - 'keyword' => 'comment', - 'identifier' => t('Comment being replied to'), - 'id' => 3, - 'name' => 'entity_id:comment', - 'settings' => array(), - ), - ); -} - -/** - * Callback to get context placeholders provided by this handler. - */ -function page_manager_comment_reply_get_contexts($task, $subtask_id) { - return ctools_context_get_placeholders_from_argument(page_manager_comment_reply_get_arguments($task, $subtask_id)); -} - -/** - * Callback defined by page_manager_node_view_page_manager_tasks(). - * - * Alter the node view input so that node view comes to us rather than the - * normal node view process. - */ -function page_manager_comment_reply_menu_alter(&$items, $task) { - if (variable_get('page_manager_comment_reply_disabled', TRUE)) { - return; - } - // Override the node view handler for our purpose. - $callback = $items['comment/reply/%node']['page callback']; - if ($callback == 'comment_reply' || variable_get('page_manager_override_anyway', FALSE)) { - $items['comment/reply/%node']['page callback'] = 'page_manager_comment_reply_page'; - $items['comment/reply/%node']['file path'] = $task['path']; - $items['comment/reply/%node']['file'] = $task['file']; - } - else { - // Automatically disable this task if it cannot be enabled. - variable_set('page_manager_comment_reply_disabled', TRUE); - if (!empty($GLOBALS['page_manager_enabling_comment_reply'])) { - drupal_set_message(t('Page manager module is unable to enable comment/reply/%node because some other module already has overridden with %callback.', array('%callback' => $callback)), 'error'); - } - } - - // @todo override node revision handler as well? -} - -/** - * Callback to determine if a page is accessible. - * - * @param $task - * The task plugin. - * @param $subtask_id - * The subtask id - * @param $contexts - * The contexts loaded for the task. - * - * @return - * TRUE if the current user can access the page. - */ -function page_manager_comment_reply_access_check($task, $subtask_id, $contexts) { - $context = reset($contexts); - return TRUE; -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/contact_site.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/contact_site.inc deleted file mode 100644 index e9716c493..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/contact_site.inc +++ /dev/null @@ -1,134 +0,0 @@ - 'page', - - 'title' => t('Site contact page'), - 'admin title' => t('Site contact page'), - 'admin description' => t('When enabled, this overrides the default Drupal behavior for the site contact page at /contact. If no variant is selected, the default Drupal contact form will be used.'), - 'admin path' => 'contact', - - // Menu hooks so that we can alter the node/%node menu entry to point to us. - 'hook menu alter' => 'page_manager_contact_site_menu_alter', - - // This is task uses 'context' handlers and must implement these to give the - // handler data it needs. - 'handler type' => 'context', - - // Allow this to be enabled or disabled: - 'disabled' => variable_get('page_manager_contact_site_disabled', TRUE), - 'enable callback' => 'page_manager_contact_site_enable', - 'access callback' => 'page_manager_contact_access_check', - ); -} - -/** - * Callback defined by page_manager_contact_site_page_manager_tasks(). - * - * Alter the node edit input so that node edit comes to us rather than the - * normal node edit process. - */ -function page_manager_contact_site_menu_alter(&$items, $task) { - if (variable_get('page_manager_contact_site_disabled', TRUE)) { - return; - } - - $callback = $items['contact']['page callback']; - if ($callback == 'drupal_get_form') { - $callback = $items['contact']['page arguments'][0]; - } - - // Override the node edit handler for our purpose. - if ($callback == 'contact_site_form' || variable_get('page_manager_override_anyway', FALSE)) { - $items['contact']['page callback'] = 'page_manager_contact_site'; - $items['contact']['file path'] = $task['path']; - $items['contact']['file'] = $task['file']; - } - else { - variable_set('page_manager_contact_site_disabled', TRUE); - if (!empty($GLOBALS['page_manager_enabling_contact_site'])) { - drupal_set_message(t('Page manager module is unable to enable contact because some other module already has overridden with %callback.', array('%callback' => $callback)), 'warning'); - } - return; - } - -} - -/** - * Entry point for our overridden site contact. - * - * This function asks its assigned handlers who, if anyone, would like - * to run with it. If no one does, it passes through to Drupal core's - * node edit, which is node_page_edit(). - */ -function page_manager_contact_site() { - // Load my task plugin. - $task = page_manager_get_task('contact_site'); - - ctools_include('context'); - ctools_include('context-task-handler'); - $output = ctools_context_handler_render($task, '', array(), array()); - if ($output !== FALSE) { - return $output; - } - - module_load_include('inc', 'contact', 'contact.pages'); - $function = 'contact_site_form'; - foreach (module_implements('page_manager_override') as $module) { - $call = $module . '_page_manager_override'; - if (($rc = $call('contact_site')) && function_exists($rc)) { - $function = $rc; - break; - } - } - - // Otherwise, fall back. - if ($function == 'contact_site_form') { - return drupal_get_form($function); - } - - return $function(); -} - -/** - * Callback to enable/disable the page from the UI. - */ -function page_manager_contact_site_enable($cache, $status) { - variable_set('page_manager_contact_site_disabled', $status); - // Set a global flag so that the menu routine knows it needs - // to set a message if enabling cannot be done. - if (!$status) { - $GLOBALS['page_manager_enabling_contact_site'] = TRUE; - } -} - -/** - * Callback to determine if a page is accessible. - * - * @param $task - * The task plugin. - * @param $subtask_id - * The subtask id - * @param $contexts - * The contexts loaded for the task. - * - * @return - * TRUE if the current user can access the page. - */ -function page_manager_contact_access_check($task, $subtask_id, $contexts) { - return user_access('access site-wide contact form'); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/contact_user.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/contact_user.inc deleted file mode 100644 index 96daec8b5..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/contact_user.inc +++ /dev/null @@ -1,160 +0,0 @@ - 'page', - 'title' => t('User contact'), - 'admin title' => t('User contact'), - 'admin description' => t('When enabled, this overrides the default Drupal behavior for displaying the user contact form at user/%user/contact. If no variant is selected, the default Drupal user contact form will be used.'), - 'admin path' => 'user/%user/contact', - - // Callback to add items to the page managertask administration form: - 'task admin' => 'page_manager_contact_user_task_admin', - - 'hook menu alter' => 'page_manager_contact_user_menu_alter', - - // This is task uses 'context' handlers and must implement these to give the - // handler data it needs. - 'handler type' => 'context', // handler type -- misnamed - 'get arguments' => 'page_manager_contact_user_get_arguments', - 'get context placeholders' => 'page_manager_contact_user_get_contexts', - - // Allow this to be enabled or disabled: - 'disabled' => variable_get('page_manager_contact_user_disabled', TRUE), - 'enable callback' => 'page_manager_contact_user_enable', - 'access callback' => 'page_manager_contact_user_access_check', - ); -} - -/** - * Callback defined by page_manager_contact_user_page_manager_tasks(). - * - * Alter the user view input so that user view comes to us rather than the - * normal user view process. - */ -function page_manager_contact_user_menu_alter(&$items, $task) { - if (variable_get('page_manager_contact_user_disabled', TRUE)) { - return; - } - $callback = $items['user/%user/contact']['page callback']; - if ($callback == 'drupal_get_form') { - $callback = $items['user/%user/contact']['page arguments'][0]; - } - - // Override the user view handler for our purpose. - if ($callback == 'contact_personal_form' || variable_get('page_manager_override_anyway', FALSE)) { - $items['user/%user/contact']['page callback'] = 'page_manager_contact_user'; - $items['user/%user/contact']['file path'] = $task['path']; - $items['user/%user/contact']['file'] = $task['file']; - } - else { - // Automatically disable this task if it cannot be enabled. - variable_set('page_manager_contact_user_disabled', TRUE); - if (!empty($GLOBALS['page_manager_enabling_contact_user'])) { - drupal_set_message(t('Page manager module is unable to enable user/%user/contact because some other module already has overridden with %callback.', array('%callback' => $callback)), 'error'); - } - } -} - -/** - * Entry point for our overridden user view. - * - * This function asks its assigned handlers who, if anyone, would like - * to run with it. If no one does, it passes through to Drupal core's - * user view, which is user_page_view(). - */ -function page_manager_contact_user($form_id, $account) { - // Load my task plugin: - $task = page_manager_get_task('contact_user'); - - // Load the account into a context. - ctools_include('context'); - ctools_include('context-task-handler'); - $contexts = ctools_context_handler_get_task_contexts($task, '', array($account)); - - $output = ctools_context_handler_render($task, '', $contexts, array($account->uid)); - if ($output !== FALSE) { - return $output; - } - - module_load_include('inc', 'contact', 'contact.pages'); - $function = 'contact_personal_form'; - foreach (module_implements('page_manager_override') as $module) { - $call = $module . '_page_manager_override'; - if (($rc = $call('contact_user')) && function_exists($rc)) { - $function = $rc; - break; - } - } - - // Otherwise, fall back. - return drupal_get_form($function, $account); -} - -/** - * Callback to get arguments provided by this task handler. - * - * Since this is the node view and there is no UI on the arguments, we - * create dummy arguments that contain the needed data. - */ -function page_manager_contact_user_get_arguments($task, $subtask_id) { - return array( - array( - 'keyword' => 'user', - 'identifier' => t('User being viewed'), - 'id' => 1, - 'name' => 'uid', - 'settings' => array(), - ), - ); -} - -/** - * Callback to get context placeholders provided by this handler. - */ -function page_manager_contact_user_get_contexts($task, $subtask_id) { - return ctools_context_get_placeholders_from_argument(page_manager_contact_user_get_arguments($task, $subtask_id)); -} - -/** - * Callback to enable/disable the page from the UI. - */ -function page_manager_contact_user_enable($cache, $status) { - variable_set('page_manager_contact_user_disabled', $status); - - // Set a global flag so that the menu routine knows it needs - // to set a message if enabling cannot be done. - if (!$status) { - $GLOBALS['page_manager_enabling_contact_user'] = TRUE; - } -} - -/** - * Callback to determine if a page is accessible. - * - * @param $task - * The task plugin. - * @param $subtask_id - * The subtask id - * @param $contexts - * The contexts loaded for the task. - * - * @return - * TRUE if the current user can access the page. - */ -function page_manager_blog_contact_user_access_check($task, $subtask_id, $contexts) { - $context = reset($contexts); - return _contact_personal_tab_access($context->data); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/node_edit.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/node_edit.inc deleted file mode 100644 index 2d2744918..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/node_edit.inc +++ /dev/null @@ -1,205 +0,0 @@ - 'page', - - 'title' => t('Node add/edit form'), - 'admin title' => t('Node add/edit form'), - 'admin description' => t('When enabled, this overrides the default Drupal behavior for adding or edit nodes at node/%node/edit and node/add/%node_type. If you add variants, you may use selection criteria such as node type or language or user access to provide different edit forms for nodes. If no variant is selected, the default Drupal node edit will be used.'), - 'admin path' => 'node/%node/edit', - - // Menu hooks so that we can alter the node/%node menu entry to point to us. - 'hook menu' => 'page_manager_node_edit_menu', - 'hook menu alter' => 'page_manager_node_edit_menu_alter', - - // This is task uses 'context' handlers and must implement these to give the - // handler data it needs. - 'handler type' => 'context', - 'get arguments' => 'page_manager_node_edit_get_arguments', - 'get context placeholders' => 'page_manager_node_edit_get_contexts', - - // Allow this to be enabled or disabled: - 'disabled' => variable_get('page_manager_node_edit_disabled', TRUE), - 'enable callback' => 'page_manager_node_edit_enable', - 'access callback' => 'page_manager_node_edit_access_check', - ); -} - -/** - * Callback defined by page_manager_node_edit_page_manager_tasks(). - * - * Alter the node edit input so that node edit comes to us rather than the - * normal node edit process. - */ -function page_manager_node_edit_menu_alter(&$items, $task) { - if (variable_get('page_manager_node_edit_disabled', TRUE)) { - return; - } - - $callback = $items['node/%node/edit']['page callback']; - // Override the node edit handler for our purpose. - if ($callback == 'node_page_edit' || variable_get('page_manager_override_anyway', FALSE)) { - $items['node/%node/edit']['page callback'] = 'page_manager_node_edit'; - $items['node/%node/edit']['file path'] = $task['path']; - $items['node/%node/edit']['file'] = $task['file']; - } - else { - variable_set('page_manager_node_edit_disabled', TRUE); - if (!empty($GLOBALS['page_manager_enabling_node_edit'])) { - drupal_set_message(t('Page manager module is unable to enable node/%node/edit because some other module already has overridden with %callback.', array('%callback' => $callback)), 'warning'); - } - return; - } - - // Also catch node/add handling: - foreach (node_type_get_types() as $type) { - $path = 'node/add/' . str_replace('_', '-', $type->type); - if ($items[$path]['page callback'] != 'node_add') { - if (!empty($GLOBALS['page_manager_enabling_node_edit'])) { - drupal_set_message(t('Page manager module is unable to override @path because some other module already has overridden with %callback. Node edit will be enabled but that edit path will not be overridden.', array('@path' => $path, '%callback' => $items[$path]['page callback'])), 'warning'); - } - continue; - } - - $items[$path]['page callback'] = 'page_manager_node_add'; - $items[$path]['file path'] = $task['path']; - $items[$path]['file'] = $task['file']; - // Why str_replace things back? - $items[$path]['page arguments'] = array($type->type); - } -} - -/** - * Entry point for our overridden node edit. - * - * This function asks its assigned handlers who, if anyone, would like - * to run with it. If no one does, it passes through to Drupal core's - * node edit, which is node_page_edit(). - */ -function page_manager_node_edit($node) { - // Load my task plugin. - $task = page_manager_get_task('node_edit'); - - // Load the node into a context. - ctools_include('context'); - ctools_include('context-task-handler'); - $contexts = ctools_context_handler_get_task_contexts($task, '', array($node)); - - // Set the default title for the node add/edit form. If the page has a custom - // title it'll override this. - $types = node_type_get_types(); - $context = reset($contexts); - if (empty($context->data->nid)) { - drupal_set_title(t('Create @name', array( - '@name' => $types[$context->data->type]->name - )), PASS_THROUGH); - } - else { - drupal_set_title(t('Edit @type @title', array( - '@type' => $types[$context->node_type]->name, - '@title' => $context->data->title - )), PASS_THROUGH); - } - - $arg = array(isset($node->nid) ? $node->nid : $node->type); - $output = ctools_context_handler_render($task, '', $contexts, $arg); - if ($output === FALSE) { - // Fall back! - // We've already built the form with the context, so we can't build it again, or - // form_clean_id will mess up our ids. But we don't really need to, either: - $output = $context->form; - } - - return $output; -} - -/** - * Callback to handle the process of adding a node. - * - * This creates a basic $node and passes that off to page_manager_node_edit(). - * It is modelled after Drupal's node_add() function. - * - * Unlike node_add() we do not need to check node_access because that was - * already checked by the menu system. - */ -function page_manager_node_add($type) { - global $user; - - $types = node_type_get_types(); - - // Initialize settings: - $node = (object) array( - 'uid' => $user->uid, - 'name' => (isset($user->name) ? $user->name : ''), - 'type' => $type, - 'language' => LANGUAGE_NONE, - ); - - drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)), PASS_THROUGH); - return page_manager_node_edit($node); -} - -/** - * Callback to get arguments provided by this task handler. - * - * Since this is the node edit and there is no UI on the arguments, we - * create dummy arguments that contain the needed data. - */ -function page_manager_node_edit_get_arguments($task, $subtask_id) { - return array( - array( - 'keyword' => 'node', - 'identifier' => t('Node being edited'), - 'id' => 1, - 'name' => 'node_edit', - 'settings' => array(), - ), - ); -} - -/** - * Callback to get context placeholders provided by this handler. - */ -function page_manager_node_edit_get_contexts($task, $subtask_id) { - return ctools_context_get_placeholders_from_argument(page_manager_node_edit_get_arguments($task, $subtask_id)); -} - -/** - * Callback to enable/disable the page from the UI. - */ -function page_manager_node_edit_enable($cache, $status) { - variable_set('page_manager_node_edit_disabled', $status); - // Set a global flag so that the menu routine knows it needs - // to set a message if enabling cannot be done. - if (!$status) { - $GLOBALS['page_manager_enabling_node_edit'] = TRUE; - } -} - -/** - * Callback to determine if a page is accessible. - * - * @param $task - * The task plugin. - * @param $subtask_id - * The subtask id - * @param $contexts - * The contexts loaded for the task. - * - * @return - * TRUE if the current user can access the page. - */ -function page_manager_node_edit_access_check($task, $subtask_id, $contexts) { - $context = reset($contexts); - return node_access('update', $context->data); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/node_view.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/node_view.inc deleted file mode 100644 index 6de28ad5b..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/node_view.inc +++ /dev/null @@ -1,184 +0,0 @@ - 'page', - - 'title' => t('Node template'), - - 'admin title' => t('Node template'), - 'admin description' => t('When enabled, this overrides the default Drupal behavior for displaying nodes at node/%node. If you add variants, you may use selection criteria such as node type or language or user access to provide different views of nodes. If no variant is selected, the default Drupal node view will be used. This page only affects nodes viewed as pages, it will not affect nodes viewed in lists or at other locations. Also please note that if you are using pathauto, aliases may make a node to be somewhere else, but as far as Drupal is concerned, they are still at node/%node.'), - 'admin path' => 'node/%node', - - // Menu hooks so that we can alter the node/%node menu entry to point to us. - 'hook menu' => 'page_manager_node_view_menu', - 'hook menu alter' => 'page_manager_node_view_menu_alter', - - // This is task uses 'context' handlers and must implement these to give the - // handler data it needs. - 'handler type' => 'context', - 'get arguments' => 'page_manager_node_view_get_arguments', - 'get context placeholders' => 'page_manager_node_view_get_contexts', - - // Allow this to be enabled or disabled: - 'disabled' => variable_get('page_manager_node_view_disabled', TRUE), - 'enable callback' => 'page_manager_node_view_enable', - 'access callback' => 'page_manager_node_view_access_check', - ); -} - -/** - * Callback defined by page_manager_node_view_page_manager_tasks(). - * - * Alter the node view input so that node view comes to us rather than the - * normal node view process. - */ -function page_manager_node_view_menu_alter(&$items, $task) { - if (variable_get('page_manager_node_view_disabled', TRUE)) { - return; - } - - // Override the node view handler for our purpose. - $callback = $items['node/%node']['page callback']; - if ($callback == 'node_page_view' || variable_get('page_manager_override_anyway', FALSE)) { - $items['node/%node']['page callback'] = 'page_manager_node_view_page'; - $items['node/%node']['file path'] = $task['path']; - $items['node/%node']['file'] = $task['file']; - } - else { - // Automatically disable this task if it cannot be enabled. - variable_set('page_manager_node_view_disabled', TRUE); - if (!empty($GLOBALS['page_manager_enabling_node_view'])) { - drupal_set_message(t('Page manager module is unable to enable node/%node because some other module already has overridden with %callback.', array('%callback' => $callback)), 'error'); - } - } - - // @todo override node revision handler as well? -} - -/** - * Entry point for our overridden node view. - * - * This function asks its assigned handlers who, if anyone, would like - * to run with it. If no one does, it passes through to Drupal core's - * node view, which is node_page_view(). - */ -function page_manager_node_view_page($node) { - // Load my task plugin. - $task = page_manager_get_task('node_view'); - - // Load the node into a context. - ctools_include('context'); - ctools_include('context-task-handler'); - - $uri = entity_uri('node', $node); - if (isset($uri['path'])) { - // Set the node path as the canonical URL to prevent duplicate content. - $meta_canon = array( - 'rel' => 'canonical', - 'href' => url($uri['path'], $uri['options']), - ); - drupal_add_html_head_link($meta_canon, TRUE); - - // Set the non-aliased path as a default shortlink. - $meta_short = array( - 'rel' => 'shortlink', - 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE))), - ); - drupal_add_html_head_link($meta_short, TRUE); - } - - // Load all contexts. - $contexts = ctools_context_handler_get_task_contexts($task, '', array($node)); - - // Build the full output using the configured CTools plugin. - $output = ctools_context_handler_render($task, '', $contexts, array($node->nid)); - if ($output !== FALSE) { - node_tag_new($node); - return $output; - } - - // Try loading an override plugin. - foreach (module_implements('page_manager_override') as $module) { - $call = $module . '_page_manager_override'; - if (($rc = $call('node_view')) && function_exists($rc)) { - return $rc($node); - } - } - - // Prepare the node to be displayed so all of the regular hooks are triggered. - $default_output = node_page_view($node); - - // Otherwise, fall back to the default output generated by node_page_view(). - return $default_output; -} - -/** - * Callback to get arguments provided by this task handler. - * - * Since this is the node view and there is no UI on the arguments, we - * create dummy arguments that contain the needed data. - */ -function page_manager_node_view_get_arguments($task, $subtask_id) { - return array( - array( - 'keyword' => 'node', - 'identifier' => t('Node being viewed'), - 'id' => 1, - 'name' => 'entity_id:node', - 'settings' => array(), - ), - ); -} - -/** - * Callback to get context placeholders provided by this handler. - */ -function page_manager_node_view_get_contexts($task, $subtask_id) { - return ctools_context_get_placeholders_from_argument(page_manager_node_view_get_arguments($task, $subtask_id)); -} - -/** - * Callback to enable/disable the page from the UI. - */ -function page_manager_node_view_enable($cache, $status) { - variable_set('page_manager_node_view_disabled', $status); - - // Set a global flag so that the menu routine knows it needs - // to set a message if enabling cannot be done. - if (!$status) { - $GLOBALS['page_manager_enabling_node_view'] = TRUE; - } -} - -/** - * Callback to determine if a page is accessible. - * - * @param $task - * The task plugin. - * @param $subtask_id - * The subtask id - * @param $contexts - * The contexts loaded for the task. - * - * @return - * TRUE if the current user can access the page. - */ -function page_manager_node_view_access_check($task, $subtask_id, $contexts) { - $context = reset($contexts); - return node_access('view', $context->data); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/page.admin.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/page.admin.inc deleted file mode 100644 index 13cc63228..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/page.admin.inc +++ /dev/null @@ -1,1529 +0,0 @@ - $access_callback, - 'access arguments' => $access_arguments, - 'file' => 'plugins/tasks/page.admin.inc', - ); - - $items['admin/structure/pages/add'] = array( - 'title' => 'Add custom page', - 'page callback' => 'page_manager_page_add_subtask', - 'page arguments' => array(), - 'type' => MENU_LOCAL_ACTION, - ) + $base; - - $items['admin/structure/pages/import'] = array( - 'title' => 'Import page', - 'page callback' => 'drupal_get_form', - 'page arguments' => array('page_manager_page_import_subtask', 'page'), - 'type' => MENU_LOCAL_ACTION, - ) + $base; - if ($access_callback == 'user_access') { - $items['admin/structure/pages/import']['access callback'] = 'ctools_access_multiperm'; - $items['admin/structure/pages/import']['access arguments'][] = 'use ctools import'; - } - - // AJAX callbacks for argument modal. - $items['admin/structure/pages/argument'] = array( - 'page callback' => 'page_manager_page_subtask_argument_ajax', - 'type' => MENU_CALLBACK, - ) + $base; - - // Add menu entries for each subtask. - foreach (page_manager_page_load_all() as $subtask_id => $subtask) { - if (!empty($subtask->disabled)) { - continue; - } - - if (!isset($subtask->access['type'])) { - $subtask->access['type'] = 'none'; - } - if (!isset($subtask->access['settings'])) { - $subtask->access['settings'] = NULL; - } - - $path = array(); - $page_arguments = array((string) $subtask_id); - $access_arguments = array($subtask->access); - $load_arguments = array($subtask_id, '%index', '%map'); - - // Replace named placeholders with our own placeholder to load contexts. - $position = 0; - - foreach (explode('/', $subtask->path) as $bit) { - // Remove things like double slashes completely. - if (!isset($bit) || $bit === '') { - continue; - } - - if ($bit[0] == '%' && $bit != '%') { - $placeholder = '%pm_arg'; - - // Chop off that %. - $name = substr($bit, 1); - - // Check to see if the argument plugin wants to use a different - // placholder. This will allow to_args. - if (!empty($subtask->arguments[$name])) { - ctools_include('context'); - if (!empty($subtask->arguments[$name]['name'])) { - $plugin = ctools_get_argument($subtask->arguments[$name]['name']); - if (isset($plugin['path placeholder'])) { - if (function_exists($plugin['path placeholder'])) { - $placeholder = $plugin['path placeholder']($subtask->arguments[$name]); - } - else { - $placeholder = $plugin['path placeholder']; - } - } - } - } - // If an argument, swap it out with our argument loader and make sure - // the argument gets passed through to the page callback. - $path[] = $placeholder; - $page_arguments[] = $position; - $access_arguments[] = $position; - } - elseif ($bit[0] != '!') { - $path[] = $bit; - } - - // Increment position. We do it like this to skip empty items that - // could happen from erroneous paths like: this///that. - $position++; - } - - $menu_path = implode('/', $path); - - $items[$menu_path] = page_manager_page_menu_item($task, $subtask->menu, $access_arguments, $page_arguments, $load_arguments); - - // Add a parent menu item if one is configured. - if (isset($subtask->menu['type']) && $subtask->menu['type'] == 'default tab') { - array_pop($path); - $parent_path = implode('/', $path); - $items[$parent_path] = page_manager_page_menu_item($task, $subtask->menu['parent'], $access_arguments, $page_arguments, $load_arguments); - } - } -} - -/** - * Create a menu item for page manager pages. - * - * @param $menu - * The configuration to use. It will contain a type, and depending on the - * type may also contain weight, title and name. These are presumed to have - * been configured from the UI. - * @param $access_arguments - * Arguments that go with ctools_access_menu; it should be loaded with - * the access plugin type, settings, and positions of any arguments that - * may produce contexts. - * @param $page_arguments - * This should be seeded with the subtask name for easy loading and like - * the access arguments above should contain positions of arguments so - * that the menu system passes contexts through. - * @param $load_arguments - * Arguments to send to the arg loader; should be the subtask id and '%index'. - */ -function page_manager_page_menu_item($task, $menu, $access_arguments, $page_arguments, $load_arguments) { - $item = array( - 'access callback' => 'ctools_access_menu', - 'access arguments' => $access_arguments, - 'page callback' => 'page_manager_page_execute', - 'page arguments' => $page_arguments, - 'load arguments' => $load_arguments, - 'file' => 'plugins/tasks/page.inc', - ); - - if (isset($menu['title'])) { - $item['title'] = $menu['title']; - } - if (isset($menu['weight'])) { - $item['weight'] = $menu['weight']; - } - - if (empty($menu['type'])) { - $menu['type'] = 'none'; - } - - switch ($menu['type']) { - case 'none': - default: - $item['type'] = MENU_CALLBACK; - break; - - case 'normal': - $item['type'] = MENU_NORMAL_ITEM; - // Insert item into the proper menu. - $item['menu_name'] = $menu['name']; - break; - - case 'tab': - $item['type'] = MENU_LOCAL_TASK; - break; - - case 'action': - $item['type'] = MENU_LOCAL_ACTION; - break; - - case 'default tab': - $item['type'] = MENU_DEFAULT_LOCAL_TASK; - break; - } - - return $item; -} - -/** - * Page callback to add a subtask. - */ -function page_manager_page_add_subtask($task_name = NULL, $step = NULL) { - ctools_include('context'); - $task = page_manager_get_task('page'); - $task_handler_plugins = page_manager_get_task_handler_plugins($task); - if (empty($task_handler_plugins)) { - drupal_set_message(t('There are currently no variants available and a page may not be added. Perhaps you need to install the Panels module to get a variant?'), 'error'); - return ' '; - } - - $form_info = array( - 'id' => 'page_manager_add_page', - 'show trail' => TRUE, - 'show back' => TRUE, - 'show return' => FALSE, - 'next callback' => 'page_manager_page_add_subtask_next', - 'finish callback' => 'page_manager_page_add_subtask_finish', - 'return callback' => 'page_manager_page_add_subtask_finish', - 'cancel callback' => 'page_manager_page_add_subtask_cancel', - 'add order' => array( - 'basic' => t('Basic settings'), - 'argument' => t('Argument settings'), - 'access' => t('Access control'), - 'menu' => t('Menu settings'), - ), - 'forms' => array( - 'basic' => array( - 'form id' => 'page_manager_page_form_basic', - ), - 'access' => array( - 'form id' => 'page_manager_page_form_access', - ), - 'menu' => array( - 'form id' => 'page_manager_page_form_menu', - ), - 'argument' => array( - 'form id' => 'page_manager_page_form_argument', - ), - ), - ); - - if ($task_name) { - $page = page_manager_get_page_cache($task_name); - if (empty($page)) { - return MENU_NOT_FOUND; - } - - $form_info['path'] = "admin/structure/pages/add/$task_name/%step"; - } - else { - $new_page = page_manager_page_new(); - $new_page->name = NULL; - - $page = new stdClass(); - page_manager_page_new_page_cache($new_page, $page); - $form_info['path'] = 'admin/structure/pages/add/%task_name/%step'; - } - - if ($step && $step != 'basic') { - $handler_plugin = page_manager_get_task_handler($page->handler); - - $form_info['forms'] += $handler_plugin['forms']; - - if (isset($page->forms)) { - foreach ($page->forms as $id) { - if (isset($form_info['add order'][$id])) { - $form_info['order'][$id] = $form_info['add order'][$id]; - } - elseif (isset($handler_plugin['add features'][$id])) { - $form_info['order'][$id] = $handler_plugin['add features'][$id]; - } - elseif (isset($handler_plugin['required forms'][$id])) { - $form_info['order'][$id] = $handler_plugin['required forms'][$id]; - } - } - } - else { - $form_info['order'] = $form_info['add order']; - } - - // This means we just submitted our form from the default list - // of steps, which we've traded in for a newly generated list of - // steps above. We need to translate this 'next' step into what - // our questions determined would be next. - if ($step == 'next') { - $keys = array_keys($form_info['order']); - // Get rid of 'basic' from the list of forms. - array_shift($keys); - $step = array_shift($keys); - - // If $step == 'basic' at this point, we were not presented with any - // additional forms at all. Let's just save and go! - if ($step == 'basic') { - page_manager_save_page_cache($page); - // Redirect to the new page's task handler editor. - drupal_goto(page_manager_edit_url($page->task_name)); - } - } - } - else { - $form_info['show trail'] = FALSE; - $form_info['order'] = array( - 'basic' => t('Basic settings'), - 'next' => t('A meaningless second page'), - ); - } - - ctools_include('wizard'); - $form_state = array( - 'task' => $task, - 'subtask' => $page->subtask, - 'page' => &$page, - 'type' => 'add', - 'task_id' => 'page', - 'task_name' => $page->task_name, - 'creating' => TRUE, - ); - - if (!empty($page->handlers)) { - $keys = array_keys($page->handlers); - $key = array_shift($keys); - $form_state['handler'] = &$page->handlers[$key]; - $form_state['handler_id'] = $key; - } - - $output = ctools_wizard_multistep_form($form_info, $step, $form_state); - - if (!$output) { - // redirect. - drupal_redirect_form(array(), $form_state['redirect']); - } - - return $output; -} - -/** - * Callback generated when the add page process is finished. - */ -function page_manager_page_add_subtask_finish(&$form_state) { - $page = &$form_state['page']; - // Update the cache with changes. - page_manager_set_page_cache($page); - - $handler = $form_state['handler']; - $handler_plugin = page_manager_get_task_handler($handler->handler); - - // Redirect to the new page's task handler editor. - if (isset($handler_plugin['add finish'])) { - $form_state['redirect'] = page_manager_edit_url($page->task_name, array('handlers', $handler->name, $handler_plugin['add finish'])); - } - else { - $form_state['redirect'] = page_manager_edit_url($page->task_name); - } - return; -} - -/** - * Callback generated when the 'next' button is clicked. - * - * All we do here is store the cache. - */ -function page_manager_page_add_subtask_next(&$form_state) { - if (empty($form_state['task_name']) || $form_state['task_name'] == 'page') { - // We may not have known the path to go next, because we didn't yet know the - // task name. This fixes that. - $form_state['form_info']['path'] = str_replace('%task_name', $form_state['page']->task_name, $form_state['form_info']['path']); - - $form_state['redirect'] = ctools_wizard_get_path($form_state['form_info'], $form_state['clicked_button']['#next']); - } - - // Update the cache with changes. - page_manager_set_page_cache($form_state['page']); -} - -/** - * Callback generated when the 'cancel' button is clicked. - * - * All we do here is clear the cache. - */ -function page_manager_page_add_subtask_cancel(&$form_state) { - // Wipe all our stored changes. - if (isset($form_state['page']->task_name)) { - page_manager_clear_page_cache($form_state['page']->task_name); - } -} - -/** - * Basic settings form for a page manager page. - */ -function page_manager_page_form_basic($form, &$form_state) { - $page = &$form_state['page']->subtask['subtask']; - $task = $form_state['task']; - - $form['admin_title'] = array( - '#type' => 'textfield', - '#title' => t('Administrative title'), - '#description' => t('The name of this page. This will appear in the administrative interface to easily identify it.'), - '#default_value' => $page->admin_title, - ); - - $form['name'] = array( - '#type' => 'machine_name', - '#title' => t('Machine name'), - '#machine_name' => array( - 'exists' => 'page_manager_page_load', - 'source' => array('admin_title'), - ), - '#description' => t('The machine readable name of this page. It must be unique, and it must contain only alphanumeric characters and underscores. Once created, you will not be able to change this value!'), - '#default_value' => $page->name, - ); - - if (isset($page->pid) || empty($form_state['creating'])) { - $form['name']['#disabled'] = TRUE; - $form['name']['#value'] = $page->name; - } - - $form['admin_description'] = array( - '#type' => 'textarea', - '#title' => t('Administrative description'), - '#description' => t('A description of what this page is, does or is for, for administrative use.'), - '#default_value' => $page->admin_description, - ); - - // Path. - $form['path'] = array( - '#type' => 'textfield', - '#title' => t('Path'), - '#description' => t('The URL path to get to this page. You may create named placeholders for variable parts of the path by using %name for required elements and !name for optional elements. For example: "node/%node/foo", "forum/%forum" or "dashboard/!input". These named placeholders can be turned into contexts on the arguments form.'), - '#default_value' => $page->path, - '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), - ); - - $frontpage = variable_get('site_frontpage', 'node'); - - $path = array(); - if ($page->path) { - foreach (explode('/', $page->path) as $bit) { - if ($bit[0] != '!') { - $path[] = $bit; - } - } - } - - $path = implode('/', $path); - - if (empty($path) || $path != $frontpage) { - $form['frontpage'] = array( - '#type' => 'checkbox', - '#default_value' => !empty($page->make_frontpage), - '#title' => t('Make this your site home page.'), - '#description' => t('To set this panel as your home page you must create a unique path name with no % placeholders in the path. The site home page is currently set to %homepage on the !siteinfo configuration form.', array('!siteinfo' => l(t('Site Information'), 'admin/config/system/site-information'), '%homepage' => '/' . $frontpage)), - ); - $form['admin_paths'] = array( - '#type' => 'checkbox', - '#default_value' => !empty($page->conf['admin_paths']), - '#title' => t('Use this page in an admin overlay.'), - '#description' => t('Admin overlays are used in many places in Drupal 7 and administrative custom pages should probably utilize this feature.'), - ); - } - elseif ($path == $frontpage) { - $form['frontpage_markup'] = array( - '#value' => '' . t('This page is currently set to be your site home page. This can be modified on the !siteinfo configuration form.', array('!siteinfo' => l(t('Site Information'), 'admin/settings/site-information'))) . '', - ); - - $form['frontpage'] = array( - '#type' => 'value', - '#value' => TRUE, - ); - } - - if (!isset($page->pid) && !empty($form_state['creating'])) { - $features['default'] = array( - 'access' => t('Access control'), - 'menu' => t('Visible menu item'), - ); - - module_load_include('inc', 'page_manager', 'page_manager.admin'); - $form = page_manager_handler_add_form($form, $form_state, $features); - } - - return $form; -} - -function page_manager_page_form_basic_validate_filter($value) { - return $value === -1; -} - -/** - * Validate the basic form. - */ -function page_manager_page_form_basic_validate(&$form, &$form_state) { - // Ensure path is unused by other pages. - $page = $form_state['page']->subtask['subtask']; - $name = !empty($form_state['values']['name']) ? $form_state['values']['name'] : $page->name; - if (empty($name)) { - form_error($form['name'], t('Name is required.')); - } - - // If this is new, make sure the name is unique: - if (empty($page->name)) { - $test = page_manager_page_load($name); - if ($test) { - form_error($form['name'], t('That name is used by another page: @page', array('@page' => $test->admin_title))); - } - - // Ensure name fits the rules: - if (preg_match('/[^a-zA-Z0-9_]/', $form_state['values']['name'])) { - form_error($form['name'], t('Page name must be alphanumeric or underscores only.')); - } - } - - $pages = page_manager_page_load_all(); - foreach ($pages as $test) { - if ($test->name != $name && $test->path == $form_state['values']['path'] && empty($test->disabled)) { - form_error($form['path'], t('That path is used by another page: @page', array('@page' => $test->admin_title))); - } - } - - // Ensure path is unused by things NOT pages. We do the double check because - // we're checking against our page callback. - $path = array(); - if (empty($form_state['values']['path'])) { - form_error($form['path'], t('Path is required.')); - // Stop processing here if there is no path. - return; - } - - $found = FALSE; - $error = FALSE; - foreach (explode('/', $form_state['values']['path']) as $position => $bit) { - if (!isset($bit) || $bit === '') { - continue; - } - - if ($bit == '%' || $bit == '!') { - form_error($form['path'], t('You cannot have an unnamed placeholder (% or ! by itself). Please name your placeholder by adding a short piece of descriptive text to the % or !, such as %user or %node.')); - } - - if ($bit[0] == '%') { - if ($found) { - form_error($form['path'], t('You cannot have a dynamic path element after an optional path element.')); - } - - if ($position == 0) { - form_error($form['path'], t('The first element in a path may not be dynamic.')); - } - - $path[] = '%'; - } - elseif ($bit[0] == '!') { - $found = TRUE; - } - else { - if ($found) { - form_error($form['path'], t('You cannot have a static path element after an optional path element.')); - } - $path[] = $bit; - } - } - - // Check to see if something that isn't a page manager page is using the path. - $path = implode('/', $path); - $result = db_query('SELECT * FROM {menu_router} WHERE path = :path', array(':path' => $path)); - foreach ($result as $router) { - if ($router->page_callback != 'page_manager_page_execute') { - form_error($form['path'], t('That path is already in use. This system cannot override existing paths.')); - } - } - - // Ensure the path is not already an alias to something else. - if (strpos($path, '%') === FALSE) { - $alias = db_query('SELECT alias, source FROM {url_alias} WHERE alias = :path', array(':path' => $path))->fetchObject(); - if ($alias) { - form_error($form['path'], t('That path is currently assigned to be an alias for @alias. This system cannot override existing aliases.', array('@alias' => $alias->source))); - } - } - else { - if (!empty($form_state['values']['frontpage'])) { - form_error($form['path'], t('You cannot make this page your site home page if it uses % placeholders.')); - } - } - - // Ensure path is properly formed. - $args = page_manager_page_get_named_arguments($form_state['values']['path']); - if ($invalid_args = array_filter($args, 'page_manager_page_form_basic_validate_filter')) { - foreach ($invalid_args as $arg => $position) { - form_error($form['path'], t('Duplicated argument %arg', array('%arg' => $arg))); - } - } - - if (isset($args['%'])) { - form_error($form['path'], t('Invalid arg %. All arguments must be named with keywords.')); - } - - $form_state['arguments'] = $args; -} - -/** - * Store the values from the basic settings form. - */ -function page_manager_page_form_basic_submit(&$form, &$form_state) { - $page = &$form_state['page']->subtask['subtask']; - $cache = &$form_state['page']; - - // If this is a new thing, then we have to do a bunch of setup to create - // the cache record with the right ID and some basic data that we could - // not know until we asked the user some questions. - if (!isset($page->pid) && !empty($form_state['creating'])) { - // Update the data with our new name. - $page->name = $form_state['values']['name']; - $form_state['page']->task_name = page_manager_make_task_name($form_state['task_id'], $page->name); - $cache->handler = $form_state['values']['handler']; - $cache->subtask_id = $page->name; - $plugin = page_manager_get_task_handler($cache->handler); - - // If they created and went back, there might be old, dead handlers - // that are not going to be added. - // - // Remove them: - $cache->handlers = array(); - $cache->handler_info = array(); - - // Create a new handler. - $handler = page_manager_new_task_handler($plugin); - $title = !empty($form_state['values']['title']) ? $form_state['values']['title'] : $plugin['title']; - page_manager_handler_add_to_page($cache, $handler, $title); - - // Figure out which forms to present them with. - $cache->forms = array(); - // This one is always there. - $cache->forms[] = 'basic'; - if (!empty($form_state['arguments'])) { - $cache->forms[] = 'argument'; - } - - $features = $form_state['values']['features']; - $cache->forms = array_merge($cache->forms, array_keys(array_filter($features['default']))); - if (isset($features[$form_state['values']['handler']])) { - $cache->forms = array_merge($cache->forms, array_keys(array_filter($features[$form_state['values']['handler']]))); - } - - if (isset($plugin['required forms'])) { - $cache->forms = array_merge($cache->forms, array_keys($plugin['required forms'])); - } - } - - $page->admin_title = $form_state['values']['admin_title']; - $cache->subtask['admin title'] = check_plain($form_state['values']['admin_title']); - - $page->admin_description = $form_state['values']['admin_description']; - $cache->subtask['admin description'] = filter_xss_admin($form_state['values']['admin_description']); - - if ($page->path != $form_state['values']['path']) { - $page->path = $form_state['values']['path']; - page_manager_page_recalculate_arguments($page); - $cache->path_changed = TRUE; - } - - $page->make_frontpage = !empty($form_state['values']['frontpage']); - $page->conf['admin_paths'] = !empty($form_state['values']['admin_paths']); -} - -/** - * Form to handle menu item controls. - */ -function page_manager_page_form_menu($form, &$form_state) { - ctools_include('dependent'); - $form['menu'] = array( - '#prefix' => '
    ', - '#suffix' => '
    ', - '#tree' => TRUE, - ); - - $menu = $form_state['page']->subtask['subtask']->menu; - if (empty($menu)) { - $menu = array( - 'type' => 'none', - 'title' => '', - 'weight' => 0, - 'name' => 'navigation', - 'parent' => array( - 'type' => 'none', - 'title' => '', - 'weight' => 0, - 'name' => 'navigation', - ), - ); - } - - $form['menu']['type'] = array( - '#title' => t('Type'), - '#type' => 'radios', - '#options' => array( - 'none' => t('No menu entry'), - 'normal' => t('Normal menu entry'), - 'tab' => t('Menu tab'), - 'default tab' => t('Default menu tab'), - 'action' => t('Local action'), - ), - '#default_value' => $menu['type'], - ); - - $form['menu']['title'] = array( - '#title' => t('Title'), - '#type' => 'textfield', - '#default_value' => $menu['title'], - '#description' => t('If set to normal or tab, enter the text to use for the menu item. Renaming the menu item using the Drupal menu system (admin/structure/menu) will override this, even if it is renamed again here.'), - '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab', 'action')), - ); - - list($major, $minor) = explode('.', VERSION, 2); - - // Only display the menu selector if menu module is enabled. - if (module_exists('menu')) { - $form['menu']['name'] = array( - '#title' => t('Menu'), - '#type' => 'select', - '#options' => menu_get_menus(), - '#default_value' => $menu['name'], - '#description' => t('Insert item into an available menu.'), - '#dependency' => array('radio:menu[type]' => array('normal')), - ); - } - else { - $form['menu']['name'] = array( - '#type' => 'value', - '#value' => $menu['name'], - ); - $form['menu']['markup'] = array( - '#value' => t('Menu selection requires the activation of menu module.'), - ); - } - $form['menu']['weight'] = array( - '#title' => t('Weight'), - '#type' => 'textfield', - '#default_value' => isset($menu['weight']) ? $menu['weight'] : 0, - '#description' => t('The lower the weight the higher/further left it will appear.'), - '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab', 'action')), - ); - - $form['menu']['parent']['type'] = array( - '#prefix' => '
    ', - '#suffix' => '
    ', - '#title' => t('Parent menu item'), - '#type' => 'radios', - '#options' => array('none' => t('No menu entry'), 'normal' => t('Normal menu item'), 'tab' => t('Menu tab')), - '#default_value' => $menu['parent']['type'], - '#description' => t('When providing a menu item as a default tab, Drupal needs to know what the parent menu item of that tab will be. Sometimes the parent will already exist, but other times you will need to have one created. The path of a parent item will always be the same path with the last part left off. i.e, if the path to this view is foo/bar/baz, the parent path would be foo/bar.'), - '#dependency' => array('radio:menu[type]' => array('default tab')), - ); - $form['menu']['parent']['title'] = array( - '#title' => t('Parent item title'), - '#type' => 'textfield', - '#default_value' => $menu['parent']['title'], - '#description' => t('If creating a parent menu item, enter the title of the item.'), - '#dependency' => array('radio:menu[type]' => array('default tab'), 'radio:menu[parent][type]' => array('normal', 'tab')), - '#dependency_count' => 2, - ); - // Only display the menu selector if menu module is enabled. - if (module_exists('menu')) { - $form['menu']['parent']['name'] = array( - '#title' => t('Parent item menu'), - '#type' => 'select', - '#options' => menu_get_menus(), - '#default_value' => $menu['parent']['name'], - '#description' => t('Insert item into an available menu.'), - '#dependency' => array('radio:menu[type]' => array('default tab'), 'radio:menu[parent][type]' => array('normal')), - '#dependency_count' => 2, - ); - } - else { - $form['menu']['parent']['name'] = array( - '#type' => 'value', - '#value' => $menu['parent']['name'], - ); - } - $form['menu']['parent']['weight'] = array( - '#title' => t('Parent weight'), - '#type' => 'textfield', - '#default_value' => $menu['parent']['weight'], - '#size' => 5, - '#description' => t('Enter the weight of the parent item. The lower the number, the more to the left it will be.'), - '#dependency' => array('radio:menu[type]' => array('default tab'), 'radio:menu[parent][type]' => array('tab', 'normal')), - '#dependency_count' => 2, - ); - - return $form; -} - -/** - * Validate handler for the menu form for add/edit page task. - */ -function page_manager_page_form_menu_validate(&$form, &$form_state) { - // If setting a 'normal' menu entry, make sure that any placeholders - // support the to_arg stuff. - if ($form_state['values']['menu']['type'] == 'normal') { - $page = $form_state['page']->subtask['subtask']; - - foreach (explode('/', $page->path) as $bit) { - if (!isset($bit) || $bit === '') { - continue; - } - - if ($bit[0] == '%') { - // Chop off that %. - $name = substr($bit, 1); - - // Check to see if the argument plugin allows to arg: - if (!empty($page->arguments[$name])) { - ctools_include('context'); - $plugin = ctools_get_argument($page->arguments[$name]['name']); - if (!empty($plugin['path placeholder to_arg'])) { - continue; - } - } - - form_error($form['menu']['type'], t('Paths with non optional placeholders cannot be used as normal menu items unless the selected argument handler provides a default argument to use for the menu item.')); - return; - } - } - } -} - -/** - * Submit handler for the menu form for add/edit page task. - */ -function page_manager_page_form_menu_submit(&$form, &$form_state) { - $form_state['page']->subtask['subtask']->menu = $form_state['values']['menu']; - $form_state['page']->path_changed = TRUE; -} - -/** - * Form to handle menu item controls. - */ -function page_manager_page_form_access($form, &$form_state) { - ctools_include('context'); - $form_state['module'] = 'page_manager_page'; - $form_state['callback argument'] = $form_state['page']->task_name; - $form_state['access'] = $form_state['page']->subtask['subtask']->access; - $form_state['no buttons'] = TRUE; - $form_state['contexts'] = array(); - - // Load contexts based on argument data: - if ($arguments = _page_manager_page_get_arguments($form_state['page']->subtask['subtask'])) { - $form_state['contexts'] = ctools_context_get_placeholders_from_argument($arguments); - } - - ctools_include('context-access-admin'); - $form = ctools_access_admin_form($form, $form_state); - - return $form; -} - -/** - * Submit handler to deal with access control changes. - */ -function page_manager_page_form_access_submit(&$form, &$form_state) { - $form_state['page']->subtask['subtask']->access['logic'] = $form_state['values']['logic']; - $form_state['page']->path_changed = TRUE; -} - -/** - * Form to handle assigning argument handlers to named arguments. - */ -function page_manager_page_form_argument($form, &$form_state) { - $page = &$form_state['page']->subtask['subtask']; - $path = $page->path; - - $arguments = page_manager_page_get_named_arguments($path); - - $form['table'] = array( - '#theme' => 'page_manager_page_form_argument_table', - '#page-manager-path' => $path, - 'argument' => array(), - ); - - $task_name = $form_state['page']->task_name; - foreach ($arguments as $keyword => $position) { - $conf = array(); - - if (isset($page->temporary_arguments[$keyword]) && !empty($form_state['allow temp'])) { - $conf = $page->temporary_arguments[$keyword]; - } - elseif (isset($page->arguments[$keyword])) { - $conf = $page->arguments[$keyword]; - } - - $context = t('No context assigned'); - - $plugin = array(); - if ($conf && isset($conf['name'])) { - ctools_include('context'); - $plugin = ctools_get_argument($conf['name']); - - if (isset($plugin['title'])) { - $context = $plugin['title']; - } - } - - $form['table']['argument'][$keyword]['#keyword'] = $keyword; - $form['table']['argument'][$keyword]['#position'] = $position; - $form['table']['argument'][$keyword]['#context'] = $context; - - // The URL for this ajax button. - $form['table']['argument'][$keyword]['change-url'] = array( - '#attributes' => array('class' => array("page-manager-context-$keyword-change-url")), - '#type' => 'hidden', - '#value' => url("admin/structure/pages/argument/change/$task_name/$keyword", array('absolute' => TRUE)), - ); - $form['table']['argument'][$keyword]['change'] = array( - '#type' => 'submit', - '#value' => t('Change'), - '#attributes' => array('class' => array('ctools-use-modal')), - '#id' => "page-manager-context-$keyword-change", - ); - - $form['table']['argument'][$keyword]['settings'] = array(); - - // Only show the button if this has a settings form available: - if (!empty($plugin)) { - // The URL for this ajax button. - $form['table']['argument'][$keyword]['settings-url'] = array( - '#attributes' => array('class' => array("page-manager-context-$keyword-settings-url")), - '#type' => 'hidden', - '#value' => url("admin/structure/pages/argument/settings/$task_name/$keyword", array('absolute' => TRUE)), - ); - $form['table']['argument'][$keyword]['settings'] = array( - '#type' => 'submit', - '#value' => t('Settings'), - '#attributes' => array('class' => array('ctools-use-modal')), - '#id' => "page-manager-context-$keyword-settings", - ); - } - } - - return $form; -} - -/** - * Theme the table for this form. - */ -function theme_page_manager_page_form_argument_table($vars) { - $form = $vars['form']; - $header = array( - array('data' => t('Argument'), 'class' => array('page-manager-argument')), - array('data' => t('Position in path'), 'class' => array('page-manager-position')), - array('data' => t('Context assigned'), 'class' => array('page-manager-context')), - array('data' => t('Operations'), 'class' => array('page-manager-operations')), - ); - - $rows = array(); - - ctools_include('modal'); - ctools_modal_add_js(); - foreach (element_children($form['argument']) as $key) { - $row = array(); - $row[] = '%' . check_plain($form['argument'][$key]['#keyword']); - $row[] = check_plain($form['argument'][$key]['#position']); - $row[] = $form['argument'][$key]['#context'] . '   ' . drupal_render($form['argument'][$key]['change']);; - $row[] = drupal_render($form['argument'][$key]['settings']) . drupal_render($form['argument'][$key]); - - $rows[] = array('data' => $row); - } - - if (!$rows) { - $rows[] = array(array('data' => t('The path %path has no arguments to configure.', array('%path' => $form['#page-manager-path'])), 'colspan' => 4)); - } - - $attributes = array( - 'id' => 'page-manager-argument-table', - ); - - $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes)); - return $output; -} - -/** - * Ajax entry point to edit an item. - */ -function page_manager_page_subtask_argument_ajax($step = NULL, $task_name = NULL, $keyword = NULL) { - ctools_include('ajax'); - ctools_include('modal'); - ctools_include('context'); - ctools_include('wizard'); - - if (!$step) { - return ctools_ajax_render_error(); - } - - if (!$cache = page_manager_get_page_cache($task_name)) { - return ctools_ajax_render_error(t('Invalid object name.')); - } - - $page = &$cache->subtask['subtask']; - $path = $page->path; - $arguments = page_manager_page_get_named_arguments($path); - - // Load stored object from cache. - if (!isset($arguments[$keyword])) { - return ctools_ajax_render_error(t('Invalid keyword.')); - } - - // Set up wizard info. - $form_info = array( - 'id' => 'page_manager_page_argument', - 'path' => "admin/structure/pages/argument/%step/$task_name/$keyword", - 'show cancel' => TRUE, - 'next callback' => 'page_manager_page_argument_next', - 'finish callback' => 'page_manager_page_argument_finish', - 'cancel callback' => 'page_manager_page_argument_cancel', - 'order' => array( - 'change' => t('Change context type'), - 'settings' => t('Argument settings'), - ), - 'forms' => array( - 'change' => array( - 'title' => t('Change argument'), - 'form id' => 'page_manager_page_argument_form_change', - ), - 'settings' => array( - 'title' => t('Argument settings'), - 'form id' => 'page_manager_page_argument_form_settings', - ), - ), - ); - - $form_state = array( - 'page' => $cache, - 'keyword' => $keyword, - 'ajax' => TRUE, - 'modal' => TRUE, - 'modal return' => TRUE, - 'commands' => array(), - ); - - $output = ctools_wizard_multistep_form($form_info, $step, $form_state); - if (!empty($form_state['cancel'])) { - $commands = array(ctools_modal_command_dismiss()); - } - elseif (!empty($form_state['complete'])) { - if (isset($page->temporary_arguments[$keyword])) { - $page->arguments[$keyword] = $page->temporary_arguments[$keyword]; - } - - if (isset($page->temporary_arguments)) { - unset($page->temporary_arguments); - } - - // Update the cache with changes. - page_manager_set_page_cache($cache); - - // Rerender the table so we can ajax it back in. - // Go directly to the form and retrieve it using a blank form and - // a clone of our current form state. This is an abbreviated - // drupal_get_form that is halted prior to render and is never - // fully processed, but is guaranteed to produce the same form we - // started with so we don't have to do crazy stuff to rerender - // just part of it. - // @todo should there be a tool to do this? - - $clone_state = $form_state; - $clone_state['allow temp'] = TRUE; - $form = drupal_build_form('page_manager_page_form_argument', $form_state); - - // Render just the table portion. - $output = drupal_render($form['table']); - $commands = array( - ajax_command_replace('#page-manager-argument-table', $output), - ctools_modal_command_dismiss(), - ); - } - else { - $commands = ctools_modal_form_render($form_state, $output); - } - print ajax_render($commands); - ajax_footer(); - exit; -} - -/** - * Callback generated when the add page process is finished. - */ -function page_manager_page_argument_finish(&$form_state) { -} - -/** - * Callback generated when the 'next' button is clicked. - * - * All we do here is store the cache. - */ -function page_manager_page_argument_next(&$form_state) { - // Update the cache with changes. - page_manager_set_page_cache($form_state['page']); -} - -/** - * Callback generated when the 'cancel' button is clicked. - * - * We might have some temporary data lying around. We must remove it. - */ -function page_manager_page_argument_cancel(&$form_state) { - $page = &$form_state['page']->subtask['subtask']; - if (isset($page->temporary_arguments)) { - unset($page->temporary_arguments); - // Update the cache with changes. - page_manager_set_page_cache($page); - } -} - -/** - * Basic settings form for a page manager page. - */ -function page_manager_page_argument_form_change($form, &$form_state) { - $page = &$form_state['page']->subtask['subtask']; - $keyword = &$form_state['keyword']; - - ctools_include('context'); - $plugins = ctools_get_arguments(); - - $options = array(); - foreach ($plugins as $id => $plugin) { - if (empty($plugin['no ui'])) { - $options[$id] = $plugin['title']; - } - } - - asort($options); - - $options = array('' => t('No context selected')) + $options; - - $argument = ''; - if (isset($page->arguments[$keyword]) && isset($page->arguments[$keyword]['name'])) { - $argument = $page->arguments[$keyword]['name']; - } - - $form['argument'] = array( - '#type' => 'radios', - '#options' => $options, - '#default_value' => $argument, - ); - - return $form; -} - -/** - * Submit handler to change an argument. - */ -function page_manager_page_argument_form_change_submit(&$form, &$form_state) { - $page = &$form_state['page']->subtask['subtask']; - $keyword = &$form_state['keyword']; - $argument = $form_state['values']['argument']; - - // If the argument is not changing, we do not need to do anything. - if (isset($page->arguments[$keyword]['name']) && $page->arguments[$keyword]['name'] == $argument) { - // Set the task to cancel since no change means do nothing: - $form_state['clicked_button']['#wizard type'] = 'cancel'; - return; - } - - ctools_include('context'); - - // If switching to the no context, just wipe out the old data. - if (empty($argument)) { - $form_state['clicked_button']['#wizard type'] = 'finish'; - $page->temporary_arguments[$keyword] = array( - 'settings' => array(), - 'identifier' => t('No context'), - ); - return; - } - - $plugin = ctools_get_argument($argument); - - // Acquire defaults. - $settings = array(); - - if (isset($plugin['default'])) { - if (is_array($plugin['default'])) { - $settings = $plugin['default']; - } - elseif (function_exists($plugin['default'])) { - $settings = $plugin['default'](); - } - } - - $id = ctools_context_next_id($page->arguments, $argument); - $title = isset($plugin['title']) ? $plugin['title'] : t('No context'); - - // Set the new argument in a temporary location. - $page->temporary_arguments[$keyword] = array( - 'id' => $id, - 'identifier' => $title . ($id > 1 ? ' ' . $id : ''), - 'name' => $argument, - 'settings' => $settings, - ); -} - -/** - * Basic settings form for a page manager page. - */ -function page_manager_page_argument_form_settings($form, &$form_state) { - $page = &$form_state['page']->subtask['subtask']; - $keyword = &$form_state['keyword']; - - if (isset($page->temporary_arguments[$keyword])) { - $conf = $page->temporary_arguments[$keyword]; - } - elseif (isset($page->arguments[$keyword])) { - $conf = $page->temporary_arguments[$keyword] = $page->arguments[$keyword]; - } - - if (!isset($conf)) { - // This should be impossible and thus never seen. - $form['error'] = array('#value' => t('Error: missing argument.')); - return; - } - - ctools_include('context'); - $plugin = ctools_get_argument($conf['name']); - - $form['settings'] = array( - '#tree' => TRUE, - ); - - $form['identifier'] = array( - '#type' => 'textfield', - '#title' => t('Context identifier'), - '#description' => t('This is the title of the context used to identify it later in the administrative process. This will never be shown to a user.'), - '#default_value' => $conf['identifier'], - ); - - if (!$plugin) { - // This should be impossible and thus never seen. - $form['error'] = array('#value' => t('Error: missing or invalid argument plugin %argument.', array('%argument', $argument))); - return; - } - - if ($function = ctools_plugin_get_function($plugin, 'settings form')) { - $function($form, $form_state, $conf['settings']); - } - - $form_state['plugin'] = $plugin; - return $form; -} - -/** - * Validate handler for argument settings. - */ -function page_manager_page_argument_form_settings_validate(&$form, &$form_state) { - if ($function = ctools_plugin_get_function($form_state['plugin'], 'settings form validate')) { - $function($form, $form_state); - } -} - -/** - * Submit handler for argument settings. - */ -function page_manager_page_argument_form_settings_submit(&$form, &$form_state) { - if ($function = ctools_plugin_get_function($form_state['plugin'], 'settings form submit')) { - $function($form, $form_state); - } - - $page = &$form_state['page']->subtask['subtask']; - $keyword = &$form_state['keyword']; - // Copy the form to our temporary location which will get moved again when - // finished. Yes, finished is always next but finish can happen from other - // locations so we funnel through that path rather than duplicate. - $page->temporary_arguments[$keyword]['identifier'] = $form_state['values']['identifier']; - if (isset($form_state['values']['settings'])) { - $page->temporary_arguments[$keyword]['settings'] = $form_state['values']['settings']; - } - else { - $page->temporary_arguments[$keyword]['settings'] = array(); - } -} - -/** - * Import a task handler from cut & paste. - */ -function page_manager_page_import_subtask($form, &$form_state, $task_name) { - $form_state['task'] = page_manager_get_task($task_name); - - drupal_set_title(t('Import page')); - $form['name'] = array( - '#type' => 'textfield', - '#title' => t('Page name'), - '#description' => t('Enter the name to use for this page if it is different from the source page. Leave blank to use the original name of the page.'), - ); - - $form['path'] = array( - '#type' => 'textfield', - '#title' => t('Path'), - '#description' => t('Enter the path to use for this page if it is different from the source page. Leave blank to use the original path of the page.'), - ); - - $form['overwrite'] = array( - '#type' => 'checkbox', - '#title' => t('Allow overwrite of an existing page'), - '#description' => t('If the name you selected already exists in the database, this page will be allowed to overwrite the existing page.'), - ); - - $form['object'] = array( - '#type' => 'textarea', - '#title' => t('Paste page code here'), - '#rows' => 15, - ); - - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('Import'), - ); - return $form; -} - -/** - * Ensure we got a valid page. - */ -function page_manager_page_import_subtask_validate(&$form, &$form_state) { - ob_start(); - eval($form_state['values']['object']); - ob_end_clean(); - - if (!isset($page) || !is_object($page)) { - $errors = ob_get_contents(); - if (empty($errors)) { - $errors = t('No handler found.'); - } - form_error($form['object'], t('Unable to get a page from the import. Errors reported: @errors', array('@errors' => $errors))); - } - - if (empty($form_state['values']['name'])) { - $form_state['values']['name'] = $page->name; - } - - $task_name = page_manager_make_task_name('page', $form_state['values']['name']); - $form_state['cache'] = page_manager_get_page_cache($task_name); - - if ($form_state['cache'] && $form_state['cache']->locked) { - form_error($form['name'], t('That page name is in use and locked by another user. You must break the lock on that page before proceeding, or choose a different name.', array('!break' => url(page_manager_edit_url($task_name, array('actions', 'break-lock')))))); - return; - } - - if (empty($form_state['values']['path'])) { - $form_state['values']['path'] = $page->path; - } - - if (empty($form_state['values']['overwrite'])) { - $page->name = NULL; - } - - $form_state['page'] = new stdClass(); - $form_state['page']->subtask['subtask'] = $page; - page_manager_page_form_basic_validate($form, $form_state); -} - -/** - * Submit the import page to create the new page and redirect. - */ -function page_manager_page_import_subtask_submit($form, &$form_state) { - $page = &$form_state['page']->subtask['subtask']; - $page->name = $form_state['values']['name']; - $page->path = $form_state['values']['path']; - - $task_name = page_manager_make_task_name('page', $page->name); - $cache = page_manager_get_page_cache($task_name); - if (!$cache) { - $cache = new stdClass(); - } - - page_manager_page_new_page_cache($page, $cache); - page_manager_set_page_cache($cache); - - $form_state['redirect'] = page_manager_edit_url($task_name); -} - -/** - * Entry point to export a page. - */ -function page_manager_page_form_export($form, &$form_state) { - $page = $form_state['page']->subtask['subtask']; - - $export = page_manager_page_export($page, $form_state['page']->handlers); - - $lines = substr_count($export, "\n"); - $form['code'] = array( - '#type' => 'textarea', - '#default_value' => $export, - '#rows' => $lines, - ); - - unset($form['buttons']); - return $form; -} - -/** - * Entry point to clone a page. - */ -function page_manager_page_form_clone($form, &$form_state) { - $page = &$form_state['page']->subtask['subtask']; - - // This provides its own button because it does something totally different. - unset($form['buttons']); - - $form['admin_title'] = array( - '#type' => 'textfield', - '#title' => t('Administrative title'), - '#description' => t('The name of this page. This will appear in the administrative interface to easily identify it.'), - '#default_value' => $page->admin_title, - ); - - $form['name'] = array( - '#type' => 'machine_name', - '#title' => t('Page name'), - '#machine_name' => array( - 'exists' => 'page_manager_page_load', - 'source' => array('admin_title'), - ), - '#description' => t('Enter the name to the new page It must be unique and contain only alphanumeric characters and underscores.'), - ); - - // Path. - $form['path'] = array( - '#type' => 'textfield', - '#title' => t('Path'), - '#description' => t('The URL path to get to this page. You may create named placeholders for variable parts of the path by using %name for required elements and !name for optional elements. For example: "node/%node/foo", "forum/%forum" or "dashboard/!input". These named placeholders can be turned into contexts on the arguments form. You cannot use the same path as the original page.'), - '#default_value' => $page->path, - ); - - $form['handlers'] = array( - '#type' => 'checkbox', - '#title' => t('Clone variants'), - '#description' => t('If checked all variants associated with the page will be cloned as well. If not checked the page will be cloned without variants.'), - '#default_value' => TRUE, - ); - - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('Clone'), - ); - - return $form; -} - -/** - * Validate clone page form. - */ -function page_manager_page_form_clone_validate(&$form, &$form_state) { - $page = &$form_state['page']->subtask['subtask']; - - $page->old_name = $page->name; - $page->name = NULL; - page_manager_page_form_basic_validate($form, $form_state); -} - -/** - * Submit clone page form. - * - * Load the page, change the name(s) to protect the innocent, and if - * requested, load all the task handlers so that they get saved properly too. - */ -function page_manager_page_form_clone_submit(&$form, &$form_state) { - $original = $form_state['page']->subtask['subtask']; - - $original->name = $form_state['values']['name']; - $original->admin_title = $form_state['values']['admin_title']; - $original->path = $form_state['values']['path']; - - $handlers = !empty($form_state['values']['handlers']) ? $form_state['page']->handlers : FALSE; - // Ensure the handler uuids are re-generated. - if ($handlers) { - foreach ($handlers as &$handler) { - if (isset($handler->conf['display']) && method_exists($handler->conf['display'], 'clone_display')) { - $handler->conf['display'] = $handler->conf['display']->clone_display(); - } - } - } - - // Export the handler, which is a fantastic way to clean database IDs out of it. - $export = page_manager_page_export($original, $handlers); - ob_start(); - eval($export); - ob_end_clean(); - - $task_name = page_manager_make_task_name('page', $page->name); - $cache = new stdClass(); - - page_manager_page_new_page_cache($page, $cache); - page_manager_set_page_cache($cache); - - $form_state['redirect'] = page_manager_edit_url($task_name); -} - -/** - * Entry point to export a page. - */ -function page_manager_page_form_delete($form, &$form_state) { - $page = &$form_state['page']->subtask['subtask']; - - if ($page->type == t('Overridden')) { - $text = t('Reverting the page will delete the page that is in the database, reverting it to the original default page. Any changes you have made will be lost and cannot be recovered.'); - } - else { - $text = t('Are you sure you want to delete this page? Deleting a page cannot be undone.'); - } - $form['markup'] = array( - '#value' => '

    ' . $text . '

    ', - ); - - if (empty($form_state['page']->locked)) { - unset($form['buttons']); - $form['delete'] = array( - '#type' => 'submit', - '#value' => $page->type == t('Overridden') ? t('Revert') : t('Delete'), - ); - } - - return $form; -} - -/** - * Submit handler to delete a view. - */ -function page_manager_page_form_delete_submit(&$form, &$form_state) { - $page = $form_state['page']->subtask['subtask']; - page_manager_page_delete($page); - if ($page->type != t('Overridden')) { - $form_state['redirect'] = 'admin/structure/pages'; - drupal_set_message(t('The page has been deleted.')); - } - else { - $form_state['redirect'] = page_manager_edit_url($form_state['page']->task_name, array('summary')); - drupal_set_message(t('The page has been reverted.')); - } -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/page.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/page.inc deleted file mode 100644 index 100dfd817..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/page.inc +++ /dev/null @@ -1,791 +0,0 @@ - t('Custom pages'), - 'description' => t('Administrator created pages that have a URL path, access control and entries in the Drupal menu system.'), - 'non-exportable' => TRUE, - 'subtasks' => TRUE, - 'subtask callback' => 'page_manager_page_subtask', - 'subtasks callback' => 'page_manager_page_subtasks', - 'save subtask callback' => 'page_manager_page_save_subtask', - 'access callback' => 'page_manager_page_access_check', - 'hook menu' => array( - 'file' => 'page.admin.inc', - 'path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks', - 'function' => 'page_manager_page_menu', - ), - 'hook theme' => 'page_manager_page_theme', - // Page only items. - 'task type' => 'page', - 'page operations' => array( - array( - 'title' => ' » ' . t('Create a new page'), - 'href' => 'admin/structure/pages/add', - 'html' => TRUE, - ), - ), - 'columns' => array( - 'storage' => array( - 'label' => t('Storage'), - 'class' => 'page-manager-page-storage', - ), - ), - 'page type' => 'custom', - - // Context only items. - 'handler type' => 'context', - 'get arguments' => array( - 'file' => 'page.admin.inc', - 'path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks', - 'function' => 'page_manager_page_get_arguments', - ), - 'get context placeholders' => 'page_manager_page_get_contexts', - 'access restrictions' => 'page_manager_page_access_restrictions', - 'uses handlers' => TRUE, - ); -} - -/** - * Task callback to get all subtasks. - * - * Return a list of all subtasks. - */ -function page_manager_page_subtasks($task) { - $pages = page_manager_page_load_all($task['name']); - $return = array(); - foreach ($pages as $name => $page) { - $return[$name] = page_manager_page_build_subtask($task, $page); - } - - return $return; -} - -/** - * Callback to return a single subtask. - */ -function page_manager_page_subtask($task, $subtask_id) { - $page = page_manager_page_load($subtask_id); - if ($page) { - return page_manager_page_build_subtask($task, $page); - } -} - -/** - * Call back from the administrative system to save a page. - * - * We get the $subtask as created by page_manager_page_build_subtask. - */ -function page_manager_page_save_subtask($subtask) { - $page = &$subtask['subtask']; - - // Ensure $page->arguments contains only real arguments: - $arguments = page_manager_page_get_named_arguments($page->path); - $args = array(); - foreach ($arguments as $keyword => $position) { - if (isset($page->arguments[$keyword])) { - $args[$keyword] = $page->arguments[$keyword]; - } - else { - $args[$keyword] = array( - 'id' => '', - 'identifier' => '', - 'argument' => '', - 'settings' => array(), - ); - } - } - page_manager_page_recalculate_arguments($page); - // Create a real object from the cache. - page_manager_page_save($page); - - // Check to see if we should make this the site frontpage. - if (!empty($page->make_frontpage)) { - $path = array(); - foreach (explode('/', $page->path) as $bit) { - if ($bit[0] != '!') { - $path[] = $bit; - } - } - - $path = implode('/', $path); - $front = variable_get('site_frontpage', 'node'); - if ($path != $front) { - variable_set('site_frontpage', $path); - } - } -} - -/** - * Build a subtask array for a given page. - */ -function page_manager_page_build_subtask($task, $page) { - $operations = array(); - $operations['settings'] = array( - 'type' => 'group', - 'class' => array('operations-settings'), - 'title' => t('Settings'), - 'children' => array(), - ); - - $settings = &$operations['settings']['children']; - - $settings['basic'] = array( - 'title' => t('Basic'), - 'description' => t('Edit name, path and other basic settings for the page.'), - 'form' => 'page_manager_page_form_basic', - ); - - $arguments = page_manager_page_get_named_arguments($page->path); - if ($arguments) { - $settings['argument'] = array( - 'title' => t('Arguments'), - 'description' => t('Set up contexts for the arguments on this page.'), - 'form' => 'page_manager_page_form_argument', - ); - } - - $settings['access'] = array( - 'title' => t('Access'), - 'description' => t('Control what users can access this page.'), - 'admin description' => t('Access rules are used to test if the page is accessible and any menu items associated with it are visible.'), - 'form' => 'page_manager_page_form_access', - ); - - $settings['menu'] = array( - 'title' => t('Menu'), - 'description' => t('Provide this page a visible menu or a menu tab.'), - 'form' => 'page_manager_page_form_menu', - ); - - $operations['actions']['children']['clone'] = array( - 'title' => t('Clone'), - 'description' => t('Make a copy of this page'), - 'form' => 'page_manager_page_form_clone', - ); - $operations['actions']['children']['export'] = array( - 'title' => t('Export'), - 'description' => t('Export this page as code that can be imported or embedded into a module.'), - 'form' => 'page_manager_page_form_export', - ); - if ($page->export_type == (EXPORT_IN_CODE | EXPORT_IN_DATABASE)) { - $operations['actions']['children']['delete'] = array( - 'title' => t('Revert'), - 'description' => t('Remove all changes to this page and revert to the version in code.'), - 'form' => 'page_manager_page_form_delete', - ); - } - elseif ($page->export_type != EXPORT_IN_CODE) { - $operations['actions']['children']['delete'] = array( - 'title' => t('Delete'), - 'description' => t('Remove this page from your system completely.'), - 'form' => 'page_manager_page_form_delete', - ); - } - - $subtask = array( - 'name' => $page->name, - 'admin title' => check_plain($page->admin_title), - 'admin description' => filter_xss_admin($page->admin_description), - 'admin summary' => 'page_manager_page_admin_summary', - 'admin path' => $page->path, - 'admin type' => t('Custom'), - 'subtask' => $page, - 'operations' => $operations, - 'operations include' => array( - 'file' => 'page.admin.inc', - 'path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks', - ), - 'single task' => empty($page->multiple), - 'row class' => empty($page->disabled) ? 'page-manager-enabled' : 'page-manager-disabled', - 'storage' => $page->type == t('Default') ? t('In code') : $page->type, - 'disabled' => !empty($page->disabled), - // This works for both enable AND disable. - 'enable callback' => 'page_manager_page_enable', - ); - - // Default handlers may appear from a default subtask. - if (isset($page->default_handlers)) { - $subtask['default handlers'] = $page->default_handlers; - } - return $subtask; -} - -/** - * Delegated implementation of hook_theme(). - */ -function page_manager_page_theme(&$items, $task) { - $base = array( - 'file' => 'page.admin.inc', - 'path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks', - ); - $items['page_manager_page_form_argument_table'] = $base + array( - 'render element' => 'form', - ); - $items['page_manager_page_lock'] = $base + array( - 'variables' => array('lock' => array(), 'task_name' => NULL), - ); - $items['page_manager_page_changed'] = $base + array( - 'variables' => array(), - ); -} - -// -------------------------------------------------------------------------- -// Page execution functions. -/** - * Execute a page task. - * - * This is the callback to entries in the Drupal menu system created by the - * page task. - * - * @param $subtask_id - * The name of the page task used. - * @param ... - * A number of context objects as specified by the user when - * creating named arguments in the path. - */ -function page_manager_page_execute($subtask_id) { - $func_args = func_get_args(); - $page = page_manager_page_load($subtask_id); - $task = page_manager_get_task($page->task); - $subtask = page_manager_get_task_subtask($task, $subtask_id); - - // Turn the contexts into a properly keyed array. - $contexts = array(); - $args = array(); - foreach ($func_args as $count => $arg) { - if (is_object($arg) && get_class($arg) == 'ctools_context') { - $contexts[$arg->id] = $arg; - $args[] = $arg->original_argument; - } - elseif ($count) { - $args[] = $arg; - } - } - - $count = 0; - $names = page_manager_page_get_named_arguments($page->path); - $bits = explode('/', $page->path); - - if ($page->arguments) { - foreach ($page->arguments as $name => $argument) { - // Optional arguments must be converted to contexts too, if they exist. - if ($bits[$names[$name]][0] == '!') { - ctools_include('context'); - $argument['keyword'] = $name; - if (isset($args[$count])) { - // Hack: use a special argument config variable to learn if we need - // to use menu_tail style behavior: - if (empty($argument['settings']['use_tail'])) { - $value = $args[$count]; - } - else { - $value = implode('/', array_slice($args, $count)); - } - - $context = ctools_context_get_context_from_argument($argument, $value); - } - else { - // Make sure there is a placeholder context for missing optional contexts. - $context = ctools_context_get_context_from_argument($argument, NULL, TRUE); - // Force the title to blank for replacements. - } - if ($context) { - $contexts[$context->id] = $context; - } - } - $count++; - } - } - - if ($function = ctools_plugin_get_function($task, 'page callback')) { - return call_user_func_array($function, array($page, $contexts, $args)); - } - - ctools_include('context-task-handler'); - $output = ctools_context_handler_render($task, $subtask, $contexts, $args); - if ($output === FALSE) { - return MENU_NOT_FOUND; - } - - return $output; -} - -// -------------------------------------------------------------------------- -// Context type callbacks. -/** - * Return a list of arguments used by this task. - */ -function page_manager_page_get_arguments($task, $subtask) { - return _page_manager_page_get_arguments($subtask['subtask']); -} - -function _page_manager_page_get_arguments($page) { - $arguments = array(); - if (!empty($page->arguments)) { - foreach ($page->arguments as $keyword => $argument) { - if (isset($argument['name'])) { - $argument['keyword'] = $keyword; - $arguments[$keyword] = $argument; - } - } - } - return $arguments; -} - -/** - * Get a group of context placeholders for the arguments. - */ -function page_manager_page_get_contexts($task, $subtask) { - ctools_include('context'); - return ctools_context_get_placeholders_from_argument(page_manager_page_get_arguments($task, $subtask)); -} - -/** - * Return a list of arguments used by this task. - */ -function page_manager_page_access_restrictions($task, $subtask, $contexts) { - $page = $subtask['subtask']; - return ctools_access_add_restrictions($page->access, $contexts); -} - -// -------------------------------------------------------------------------- -// Page task database info. - -/** - * Create a new page with defaults appropriately set from schema. - */ -function page_manager_page_new() { - ctools_include('export'); - return ctools_export_new_object('page_manager_pages'); -} - -/** - * Load a single page subtask. - */ -function page_manager_page_load($name) { - ctools_include('export'); - $result = ctools_export_load_object('page_manager_pages', 'names', array($name)); - if (isset($result[$name])) { - return $result[$name]; - } -} - -/** - * Load all page subtasks. - */ -function page_manager_page_load_all($task = NULL) { - ctools_include('export'); - - if (empty($task)) { - return ctools_export_load_object('page_manager_pages'); - } - else { - return ctools_export_load_object('page_manager_pages', 'conditions', array('task' => $task)); - } -} - -/** - * Write a page subtask to the database. - */ -function page_manager_page_save(&$page) { - $update = (isset($page->pid)) ? array('pid') : array(); - $task = page_manager_get_task($page->task); - - if ($function = ctools_plugin_get_function($task, 'save')) { - $function($page, $update); - } - drupal_write_record('page_manager_pages', $page, $update); - - // If this was a default page we may need to write default task - // handlers that we provided as well. - if (!$update && isset($page->default_handlers)) { - $handlers = page_manager_load_task_handlers(page_manager_get_task('page'), $page->name); - foreach ($page->default_handlers as $name => $handler) { - if (!isset($handlers[$name]) || !($handlers[$name]->export_type & EXPORT_IN_DATABASE)) { - // Make sure this is right, as exports can wander a bit. - $handler->subtask = $page->name; - page_manager_save_task_handler($handler); - } - } - } - return $page; -} - -/** - * Remove a page subtask. - */ -function page_manager_page_delete($page, $skip_menu_rebuild = FALSE) { - $task = page_manager_get_task($page->task); - if ($function = ctools_plugin_get_function($task, 'delete')) { - $function($page); - } - if (!empty($task['uses handlers'])) { - $handlers = page_manager_load_task_handlers($task, $page->name); - foreach ($handlers as $handler) { - page_manager_delete_task_handler($handler); - } - } - db_delete('page_manager_pages') - ->condition('name', $page->name) - ->execute(); - // Make sure that the cache is reset so that the menu rebuild does not - // rebuild this page again. - ctools_include('export'); - ctools_export_load_object_reset('page_manager_pages'); - // Allow menu rebuild to be skipped when calling code is deleting multiple - // pages. - if (!$skip_menu_rebuild) { - menu_rebuild(); - } -} - -/** - * Export a page subtask. - */ -function page_manager_page_export($page, $with_handlers = FALSE, $indent = '') { - $task = page_manager_get_task($page->task); - $append = ''; - - if ($function = ctools_plugin_get_function($task, 'export')) { - $append = $function($page, $indent); - } - - ctools_include('export'); - $output = ctools_export_object('page_manager_pages', $page, $indent); - $output .= $append; - - if ($with_handlers) { - if (is_array($with_handlers)) { - $handlers = $with_handlers; - } - else { - $handlers = page_manager_load_task_handlers(page_manager_get_task('page'), $page->name); - } - $output .= $indent . '$page->default_handlers = array();' . "\n"; - foreach ($handlers as $handler) { - $output .= page_manager_export_task_handler($handler, $indent); - $output .= $indent . '$page->default_handlers[$handler->name] = $handler;' . "\n"; - } - } - return $output; -} - -/** - * Get a list of named arguments in a page manager path. - * - * @param $path - * A normal Drupal path. - * - * @return - * An array of % marked variable arguments, keyed by the argument's name. - * The value will be the position of the argument so that it can easily - * be found. Items with a position of -1 have multiple positions. - */ -function page_manager_page_get_named_arguments($path) { - $arguments = array(); - $bits = explode('/', $path); - foreach ($bits as $position => $bit) { - if ($bit && ($bit[0] == '%' || $bit[0] == '!')) { - // Special handling for duplicate path items and substr to remove the %. - $arguments[substr($bit, 1)] = isset($arguments[$bit]) ? -1 : $position; - } - } - - return $arguments; -} - -/** - * Load a context from an argument for a given page task. - * - * Helper function for pm_arg_load(), which is in page_manager.module because - * drupal's menu system does not allow loader functions to reside in separate - * files. - * - * @param $value - * The incoming argument value. - * @param $subtask - * The subtask id. - * @param $argument - * The numeric position of the argument in the path, counting from 0. - * - * @return - * A context item if one is configured, the argument if one is not, or - * FALSE if restricted or invalid. - */ -function _pm_arg_load($value, $subtask, $argument) { - $page = page_manager_page_load($subtask); - if (!$page) { - return FALSE; - } - - $path = explode('/', $page->path); - if (empty($path[$argument])) { - return FALSE; - } - - $keyword = substr($path[$argument], 1); - if (empty($page->arguments[$keyword])) { - return $value; - } - - $page->arguments[$keyword]['keyword'] = $keyword; - - ctools_include('context'); - $context = ctools_context_get_context_from_argument($page->arguments[$keyword], $value); - - // Convert false equivalents to false. - return $context ? $context : FALSE; -} - -/** - * Provide a nice administrative summary of the page so an admin can see at a - * glance what this page does and how it is configured. - */ -function page_manager_page_admin_summary($task, $subtask) { - $task_name = page_manager_make_task_name($task['name'], $subtask['name']); - $page = $subtask['subtask']; - $output = ''; - - $rows = array(); - - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('Storage')), - array('class' => array('page-summary-data'), 'data' => $subtask['storage']), - array('class' => array('page-summary-operation'), 'data' => ''), - ); - - if (!empty($page->disabled)) { - $link = l(t('Enable'), page_manager_edit_url($task_name, array('handlers', $page->name, 'actions', 'enable'))); - $text = t('Disabled'); - } - else { - $link = l(t('Disable'), page_manager_edit_url($task_name, array('handlers', $page->name, 'actions', 'disable'))); - $text = t('Enabled'); - } - - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('Status')), - array('class' => array('page-summary-data'), 'data' => $text), - array('class' => array('page-summary-operation'), 'data' => $link), - ); - - $path = array(); - foreach (explode('/', $page->path) as $bit) { - if ($bit[0] != '!') { - $path[] = $bit; - } - } - - $path = implode('/', $path); - $front = variable_get('site_frontpage', 'node'); - - $link = l(t('Edit'), page_manager_edit_url($task_name, array('settings', 'basic'))); - $message = ''; - if ($path == $front) { - $message = t('This is your site home page.'); - } - elseif (!empty($page->make_frontpage)) { - $message = t('This page is set to become your site home page.'); - } - - if ($message) { - $rows[] = array( - array('class' => array('page-summary-data'), 'data' => $message, 'colspan' => 2), - array('class' => array('page-summary-operation'), 'data' => $link), - ); - } - - if (strpos($path, '%') === FALSE) { - $path = l('/' . $page->path, $path); - } - else { - $path = '/' . $page->path; - } - - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('Path')), - array('class' => array('page-summary-data'), 'data' => $path), - array('class' => array('page-summary-operation'), 'data' => $link), - ); - - if (empty($access['plugins'])) { - $access['plugins'] = array(); - } - - $contexts = page_manager_page_get_contexts($task, $subtask); - $access = ctools_access_group_summary($page->access, $contexts); - if ($access) { - $access = t('Accessible only if @conditions.', array('@conditions' => $access)); - } - else { - $access = t('This page is publicly accessible.'); - } - - $link = l(t('Edit'), page_manager_edit_url($task_name, array('settings', 'access'))); - - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('Access')), - array('class' => array('page-summary-data'), 'data' => $access), - array('class' => array('page-summary-operation'), 'data' => $link), - ); - - $menu_options = array( - 'none' => t('No menu entry.'), - 'normal' => t('Normal menu entry.'), - 'tab' => t('Menu tab.'), - 'default tab' => t('Default menu tab.'), - 'action' => t('Local action'), - ); - - if (!empty($page->menu)) { - $menu = $menu_options[$page->menu['type']]; - if ($page->menu['type'] != 'none') { - $menu .= ' ' . t('Title: %title.', array('%title' => $page->menu['title'])); - switch ($page->menu['type']) { - case 'default tab': - $menu .= ' ' . t('Parent title: %title.', array('%title' => $page->menu['parent']['title'])); - break; - - case 'normal': - if (module_exists('menu')) { - $menus = menu_get_menus(); - $menu .= ' ' . t('Menu block: %title.', array('%title' => $menus[$page->menu['name']])); - } - break; - } - } - } - else { - $menu = t('No menu entry'); - } - - $link = l(t('Edit'), page_manager_edit_url($task_name, array('settings', 'menu'))); - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('Menu')), - array('class' => array('page-summary-data'), 'data' => $menu), - array('class' => array('page-summary-operation'), 'data' => $link), - ); - - $output .= theme('table', array('rows' => $rows, 'attributes' => array('id' => 'page-manager-page-summary'))); - return $output; -} - -/** - * Callback to enable/disable the page from the UI. - */ -function page_manager_page_enable(&$cache, $status) { - $page = &$cache->subtask['subtask']; - ctools_include('export'); - ctools_export_set_object_status($page, $status); - - $page->disabled = FALSE; -} - -/** - * Recalculate the arguments when something like the path changes. - */ -function page_manager_page_recalculate_arguments(&$page) { - // Ensure $page->arguments contains only real arguments: - $arguments = page_manager_page_get_named_arguments($page->path); - $args = array(); - foreach ($arguments as $keyword => $position) { - if (isset($page->arguments[$keyword])) { - $args[$keyword] = $page->arguments[$keyword]; - } - else { - $args[$keyword] = array( - 'id' => '', - 'identifier' => '', - 'argument' => '', - 'settings' => array(), - ); - } - } - $page->arguments = $args; -} - -/** - * When adding or cloning a new page, this creates a new page cache - * and adds our page to it. - * - * This does not check to see if the existing cache is already locked. - * This must be done beforehand. - * - * @param &$page - * The page to create. - * @param &$cache - * The cache to use. If the cache has any existing task handlers, - * they will be marked for deletion. This may be a blank object. - */ -function page_manager_page_new_page_cache(&$page, &$cache) { - // Does a page already exist? If so, we are overwriting it so - // take its pid. - if (!empty($cache->subtask) && !empty($cache->subtask['subtask']) && !empty($cache->subtask['subtask']->pid)) { - $page->pid = $cache->subtask['subtask']->pid; - } - else { - $cache->new = TRUE; - } - - $cache->task_name = page_manager_make_task_name('page', $page->name); - $cache->task_id = 'page'; - $cache->task = page_manager_get_task('page'); - $cache->subtask_id = $page->name; - $page->export_type = EXPORT_IN_DATABASE; - $page->type = t('Normal'); - $cache->subtask = page_manager_page_build_subtask($cache->task, $page); - - if (isset($cache->handlers)) { - foreach ($cache->handlers as $id => $handler) { - $cache->handler_info[$id]['changed'] = PAGE_MANAGER_CHANGED_DELETED; - } - } - else { - $cache->handlers = array(); - $cache->handler_info = array(); - } - - if (!empty($page->default_handlers)) { - foreach ($page->default_handlers as $id => $handler) { - page_manager_handler_add_to_page($cache, $handler); - } - } - - $cache->locked = FALSE; - $cache->changed = TRUE; -} - -/** - * Callback to determine if a page is accessible. - * - * @param $task - * The task plugin. - * @param $subtask_id - * The subtask id - * @param $contexts - * The contexts loaded for the task. - * - * @return - * TRUE if the current user can access the page. - */ -function page_manager_page_access_check($task, $subtask_id, $contexts) { - $page = page_manager_page_load($subtask_id); - return ctools_access($page->access, $contexts); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/poll.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/poll.inc deleted file mode 100644 index 926c7671e..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/poll.inc +++ /dev/null @@ -1,126 +0,0 @@ - 'page', - - 'title' => t('All polls'), - 'admin title' => t('All polls'), - 'admin description' => t('When enabled, this overrides the default Drupal behavior for the polls at /poll. If no variant is selected, the default Drupal most recent polls will be shown.'), - 'admin path' => 'poll', - - // Menu hooks so that we can alter the node/%node menu entry to point to us. - 'hook menu alter' => 'page_manager_poll_menu_alter', - - // This is task uses 'context' handlers and must implement these to give the - // handler data it needs. - 'handler type' => 'context', - - // Allow this to be enabled or disabled: - 'disabled' => variable_get('page_manager_poll_disabled', TRUE), - 'enable callback' => 'page_manager_poll_enable', - 'access callback' => 'page_manager_poll_access_check', - ); -} - -/** - * Callback defined by page_manager_poll_page_manager_tasks(). - * - * Alter the node edit input so that node edit comes to us rather than the - * normal node edit process. - */ -function page_manager_poll_menu_alter(&$items, $task) { - if (variable_get('page_manager_poll_disabled', TRUE)) { - return; - } - - $callback = $items['poll']['page callback']; - // Override the node edit handler for our purpose. - if ($callback == 'poll_page' || variable_get('page_manager_override_anyway', FALSE)) { - $items['poll']['page callback'] = 'page_manager_poll'; - $items['poll']['file path'] = $task['path']; - $items['poll']['file'] = $task['file']; - } - else { - variable_set('page_manager_poll_disabled', TRUE); - if (!empty($GLOBALS['page_manager_enabling_poll'])) { - drupal_set_message(t('Page manager module is unable to enable poll because some other module already has overridden with %callback.', array('%callback' => $callback)), 'warning'); - } - return; - } - -} - -/** - * Entry point for our overridden node edit. - * - * This function asks its assigned handlers who, if anyone, would like - * to run with it. If no one does, it passes through to Drupal core's - * node edit, which is node_page_edit(). - */ -function page_manager_poll() { - // Load my task plugin. - $task = page_manager_get_task('poll'); - - ctools_include('context'); - ctools_include('context-task-handler'); - $output = ctools_context_handler_render($task, '', array(), array()); - if ($output !== FALSE) { - return $output; - } - - module_load_include('inc', 'poll', 'poll.pages'); - $function = 'poll_page'; - foreach (module_implements('page_manager_override') as $module) { - $call = $module . '_page_manager_override'; - if (($rc = $call('poll')) && function_exists($rc)) { - $function = $rc; - break; - } - } - - // Otherwise, fall back. - return $function(); -} - -/** - * Callback to enable/disable the page from the UI. - */ -function page_manager_poll_enable($cache, $status) { - variable_set('page_manager_poll_disabled', $status); - // Set a global flag so that the menu routine knows it needs - // to set a message if enabling cannot be done. - if (!$status) { - $GLOBALS['page_manager_enabling_poll'] = TRUE; - } -} - -/** - * Callback to determine if a page is accessible. - * - * @param $task - * The task plugin. - * @param $subtask_id - * The subtask id - * @param $contexts - * The contexts loaded for the task. - * - * @return - * TRUE if the current user can access the page. - */ -function page_manager_poll_access_check($task, $subtask_id, $contexts) { - return user_access('access content'); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/search.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/search.inc deleted file mode 100644 index e561c7179..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/search.inc +++ /dev/null @@ -1,245 +0,0 @@ - 'page', - 'title' => t('Search'), - - // There are multiple search pages, let's override each of them - // separately. - 'subtasks' => TRUE, - 'subtask callback' => 'page_manager_search_subtask', - 'subtasks callback' => 'page_manager_search_subtasks', - - // Menu hooks so that we can alter the node/%node menu entry to point to us. - 'hook menu alter' => 'page_manager_search_menu_alter', - - // This is task uses 'context' handlers and must implement these to give the - // handler data it needs. - 'handler type' => 'context', - 'get arguments' => 'page_manager_search_get_arguments', - 'get context placeholders' => 'page_manager_search_get_contexts', - 'access callback' => 'page_manager_search_access_check', - ); -} - -/** - * Callback defined by page_manager_search_page_manager_tasks(). - * - * Alter the search tabs to work with page manager. The search flow is - * quite odd, and tracing through the code takes hours to realize - * that the tab you click on does not normally actually handle - * the search. This tries to account for that. - * - * Note to module authors: This tends to work a lot better with modules - * that override their own search pages if their _alter runs *before* - * this one. - */ -function page_manager_search_menu_alter(&$items, $task) { - // We are creating two sets of tabs. One set is for searching without - // keywords. A second set is for searching *with* keywords. This - // is necessary because search/node/% and search/node need to be - // different due to the way the search menu items function. - $default_info = search_get_default_module_info(); - if (empty($default_info)) { - // Nothing to do. - return; - } - - // Go through each search module item. - foreach (search_get_info() as $module => $info) { - if (variable_get('page_manager_search_disabled_' . $module, TRUE)) { - continue; - } - - $path = 'search/' . $info['path']; - $callback = $items["$path/%menu_tail"]['page callback']; - - if ($callback == 'search_view' || variable_get('page_manager_override_anyway', FALSE)) { - $items["$path"]['page callback'] = 'page_manager_search_page'; - $items["$path"]['file path'] = $task['path']; - $items["$path"]['file'] = $task['file']; - - $items["$path/%menu_tail"]['page callback'] = 'page_manager_search_page'; - $items["$path/%menu_tail"]['file path'] = $task['path']; - $items["$path/%menu_tail"]['file'] = $task['file']; - } - else { - // Automatically disable this task if it cannot be enabled. - variable_set('page_manager_search_disabled_' . $module, TRUE); - if (!empty($GLOBALS['page_manager_enabling_search'])) { - drupal_set_message(t('Page manager module is unable to enable @path because some other module already has overridden with %callback.', array('%callback' => $callback, '@path' => $path)), 'error'); - } - } - } -} - -/** - * Entry point for our overridden search page. - */ -function page_manager_search_page($type) { - // Get the arguments and construct a keys string out of them. - $args = func_get_args(); - ctools_include('menu'); - - // We have to remove the $type. - array_shift($args); - - // And implode() it all back together. - $keys = $args ? implode('/', $args) : ''; - - // Allow other modules to alter the search keys. - drupal_alter(array('search_keys', 'search_' . $type . '_keys'), $keys); - - // Load my task plugin. - $task = page_manager_get_task('search'); - $subtask = page_manager_get_task_subtask($task, $type); - - // Load the node into a context. - ctools_include('context'); - ctools_include('context-task-handler'); - $contexts = ctools_context_handler_get_task_contexts($task, $subtask, array($keys)); - - $output = ctools_context_handler_render($task, $subtask, $contexts, array($keys)); - if ($output !== FALSE) { - return $output; - } - - $function = 'search_view'; - foreach (module_implements('page_manager_override') as $module) { - $call = $module . '_page_manager_override'; - if (($rc = $call('search')) && function_exists($rc)) { - $function = $rc; - break; - } - } - - // Otherwise, fall back. - // Put the $type back on the arguments. - module_load_include('inc', 'search', 'search.pages'); - array_unshift($args, $type); - return call_user_func_array($function, $args); -} - -/** - * Callback to get arguments provided by this task handler. - * - * Since this is the node view and there is no UI on the arguments, we - * create dummy arguments that contain the needed data. - */ -function page_manager_search_get_arguments($task, $subtask_id) { - return array( - array( - 'keyword' => 'keywords', - 'identifier' => t('Keywords'), - 'id' => 1, - 'name' => 'string', - 'settings' => array('use_tail' => TRUE), - ), - ); -} - -/** - * Callback to get context placeholders provided by this handler. - */ -function page_manager_search_get_contexts($task, $subtask_id) { - return ctools_context_get_placeholders_from_argument(page_manager_search_get_arguments($task, $subtask_id)); -} - -/** - * Callback to enable/disable the page from the UI. - */ -function page_manager_search_enable($cache, $status) { - variable_set('page_manager_search_disabled_' . $cache->subtask_id, $status); - - // Set a global flag so that the menu routine knows it needs - // to set a message if enabling cannot be done. - if (!$status) { - $GLOBALS['page_manager_enabling_search'] = TRUE; - } -} - -/** - * Task callback to get all subtasks. - * - * Return a list of all subtasks. - */ -function page_manager_search_subtasks($task) { - $return = array(); - foreach (search_get_info() as $module => $info) { - if ($info['path']) { - // We don't pass the $info because the subtask build could be called - // singly without the $info when just the subtask needs to be built. - $return[$module] = page_manager_search_build_subtask($task, $module); - } - } - - return $return; -} - -/** - * Callback to return a single subtask. - */ -function page_manager_search_subtask($task, $subtask_id) { - return page_manager_search_build_subtask($task, $subtask_id); -} - -/** - * Build a subtask array for a given page. - */ -function page_manager_search_build_subtask($task, $module) { - $search_info = search_get_info(); - $info = $search_info[$module]; - $path = 'search/' . $info['path']; - $subtask = array( - 'name' => $module, - 'admin title' => $info['title'], - 'admin path' => "$path/!keywords", - 'admin description' => t('Search @type', array('@type' => $info['title'])), - 'admin type' => t('System'), - 'row class' => empty($page->disabled) ? 'page-manager-enabled' : 'page-manager-disabled', - 'storage' => t('In code'), - 'disabled' => variable_get('page_manager_search_disabled_' . $module, TRUE), - // This works for both enable AND disable. - 'enable callback' => 'page_manager_search_enable', - ); - - return $subtask; -} - -/** - * Callback to determine if a page is accessible. - * - * @param $task - * The task plugin. - * @param $subtask_id - * The subtask id - * @param $contexts - * The contexts loaded for the task. - * - * @return - * TRUE if the current user can access the page. - */ -function page_manager_search_access_check($task, $subtask_id, $contexts) { - $context = reset($contexts); - return _search_menu_access($context->data); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/term_view.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/term_view.inc deleted file mode 100644 index 101b67442..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/term_view.inc +++ /dev/null @@ -1,375 +0,0 @@ - 'page', - - 'title' => t('Taxonomy term template'), - 'admin title' => t('Taxonomy term template'), - 'admin description' => t('When enabled, this overrides the default Drupal behavior for displaying taxonomy terms at taxonomy/term/%term. If you add variants, you may use selection criteria such as vocabulary or user access to provide different displays of the taxonomy term and associated nodes. If no variant is selected, the default Drupal taxonomy term display will be used. This page only affects items actually displayed at taxonomy/term/%term. Some taxonomy terms, such as forums, have their displays moved elsewhere. Also please note that if you are using pathauto, aliases may make a taxonomy terms appear somewhere else, but as far as Drupal is concerned, they are still at taxonomy/term/%term.'), - 'admin path' => 'taxonomy/term/%taxonomy_term', - 'admin summary' => 'page_manager_term_view_admin_summary', - - // Menu hooks so that we can alter the term/%term menu entry to point to us. - 'hook menu' => 'page_manager_term_view_menu', - 'hook menu alter' => 'page_manager_term_view_menu_alter', - - // Provide a setting to the primary settings UI for Panels. - 'admin settings' => 'page_manager_term_view_admin_settings', - // Even though we don't have subtasks, this allows us to save our settings. - 'save subtask callback' => 'page_manager_term_view_save', - - // Callback to add items to the page manager task administration form: - 'task admin' => 'page_manager_term_view_task_admin', - - // This is task uses 'context' handlers and must implement these to give the - // handler data it needs. - 'handler type' => 'context', - 'get arguments' => 'page_manager_term_view_get_arguments', - 'get context placeholders' => 'page_manager_term_view_get_contexts', - - // Allow this to be enabled or disabled: - 'disabled' => variable_get('page_manager_term_view_disabled', TRUE), - 'enable callback' => 'page_manager_term_view_enable', - 'access callback' => 'page_manager_term_view_access_check', - - // Allow additional operations. - 'operations' => array( - 'settings' => array( - 'title' => t('Settings'), - 'description' => t('Edit name, path and other basic settings for the page.'), - 'form' => 'page_manager_term_view_settings', - ), - ), - ); - } -} - -/** - * Callback defined by page_manager_term_view_page_manager_tasks(). - * - * Alter the term view input so that term view comes to us rather than the - * normal term view process. - */ -function page_manager_term_view_menu_alter(&$items, $task) { - if (variable_get('page_manager_term_view_disabled', TRUE)) { - return; - } - - // Override the term view handler for our purpose, but only if someone else - // has not already done so. - if (isset($items['taxonomy/term/%taxonomy_term']) && $items['taxonomy/term/%taxonomy_term']['page callback'] == 'taxonomy_term_page' || variable_get('page_manager_override_anyway', FALSE)) { - $items['taxonomy/term/%taxonomy_term']['page callback'] = 'page_manager_term_view_page'; - $items['taxonomy/term/%taxonomy_term']['file path'] = $task['path']; - $items['taxonomy/term/%taxonomy_term']['file'] = $task['file']; - } - else { - // Automatically disable this task if it cannot be enabled. - variable_set('page_manager_term_view_disabled', TRUE); - - if (isset($items['taxonomy/term/%taxonomy_term']['page callback'])) { - $callback = $items['taxonomy/term/%taxonomy_term']['page callback']; - } - // Because Views changes %taxonomy_term to %views_arg, check to see if that - // is why we can't enable: - elseif (isset($items['taxonomy/term/%views_arg']['page callback'])) { - $callback = $items['taxonomy/term/%views_arg']['page callback']; - } - else { - $callback = t('an unknown callback'); - } - if (!empty($GLOBALS['page_manager_enabling_term_view'])) { - drupal_set_message(t('Page manager module is unable to enable taxonomy/term/%taxonomy_term because some other module already has overridden with %callback.', array('%callback' => $callback)), 'error'); - } - } -} - -/** - * Entry point for our overridden term view. - * - * This function asks its assigned handlers who, if anyone, would like - * to run with it. If no one does, it passes through to Drupal core's - * term view, which is term_page_view(). - */ -function page_manager_term_view_page($term, $depth = NULL) { - // Prep the term to be displayed so all of the regular hooks are triggered. - // Rather than calling taxonomy_term_page() directly, as it that would - // potentially load nodes that were not necessary, execute some of the code - // prior to identifying the correct CTools or Page Manager task handler and - // only proceed with the rest of the code if necessary. - // Assign the term name as the page title. - drupal_set_title($term->name); - - // If there is a menu link to this term, the link becomes the last part - // of the active trail, and the link name becomes the page title. - // Thus, we must explicitly set the page title to be the node title. - $uri = entity_uri('taxonomy_term', $term); - - // Set the term path as the canonical URL to prevent duplicate content. - drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE); - // Set the non-aliased path as a default shortlink. - drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE); - - // Trigger the main. - $build = taxonomy_term_show($term); - - // Load my task plugin. - $task = page_manager_get_task('term_view'); - - // Load the term into a context. - ctools_include('context'); - ctools_include('context-task-handler'); - $contexts = ctools_context_handler_get_task_contexts($task, '', array($term, $depth)); - - if (empty($contexts)) { - return MENU_NOT_FOUND; - } - - // Build the full output using the configured CTools plugin. - $output = ctools_context_handler_render($task, '', $contexts, array($term->tid)); - if ($output !== FALSE) { - return $output; - } - - // Try loading an override plugin. - foreach (module_implements('page_manager_override') as $module) { - $call = $module . '_page_manager_override'; - if (($rc = $call('term_view')) && function_exists($rc)) { - return $rc($term, $depth); - } - } - - // Otherwise, fall back to replicating the output normally generated by - // taxonomy_term_page(). - // Build breadcrumb based on the hierarchy of the term. - $current = (object) array( - 'tid' => $term->tid, - ); - // @todo This overrides any other possible breadcrumb and is a pure hard-coded - // presumption. Make this behavior configurable per vocabulary or term. - $breadcrumb = array(); - while ($parents = taxonomy_get_parents($current->tid)) { - $current = array_shift($parents); - $breadcrumb[] = l($current->name, 'taxonomy/term/' . $current->tid); - } - $breadcrumb[] = l(t('Home'), NULL); - $breadcrumb = array_reverse($breadcrumb); - drupal_set_breadcrumb($breadcrumb); - drupal_add_feed('taxonomy/term/' . $term->tid . '/feed', 'RSS - ' . $term->name); - - if ($nids = taxonomy_select_nodes($term->tid, TRUE, variable_get('default_nodes_main', 10))) { - $nodes = node_load_multiple($nids); - $build += node_view_multiple($nodes); - $build['pager'] = array( - '#theme' => 'pager', - '#weight' => 5, - ); - } - else { - $build['no_content'] = array( - '#prefix' => '

    ', - '#markup' => t('There is currently no content classified with this term.'), - '#suffix' => '

    ', - ); - } - return $build; -} - -/** - * Callback to get arguments provided by this task handler. - * - * Since this is the term view and there is no UI on the arguments, we - * create dummy arguments that contain the needed data. - */ -function page_manager_term_view_get_arguments($task, $subtask_id) { - return array( - array( - 'keyword' => 'term', - 'identifier' => page_manager_term_view_get_type() == 'multiple' ? t('Term(s) being viewed') : t('Term being viewed'), - 'id' => 1, - 'name' => page_manager_term_view_get_type() == 'multiple' ? 'terms' : 'term', - 'settings' => array('input_form' => 'tid', 'breadcrumb' => variable_get('page_manager_taxonomy_breadcrumb', TRUE)), - 'default' => '404', - ), - array( - 'keyword' => 'depth', - 'identifier' => t('Depth'), - 'id' => 1, - 'name' => 'string', - 'settings' => array(), - ), - ); -} - -/** - * Callback to get context placeholders provided by this handler. - */ -function page_manager_term_view_get_contexts($task, $subtask_id) { - return ctools_context_get_placeholders_from_argument(page_manager_term_view_get_arguments($task, $subtask_id)); -} - -/** - * Settings page for this item. - */ -function page_manager_term_view_settings($form, &$form_state) { - // This passes thru because the setting can also appear on the main Panels - // settings form. If $settings is an array it will just pick up the default. - $settings = isset($form_state->update_values) ? $form_state->update_values : array(); - return page_manager_term_view_admin_settings($form, $settings); -} - -/** - * Copy form values into the page cache. - */ -function page_manager_term_view_settings_submit(&$form, &$form_state) { - $form_state['page']->update_values = $form_state['values']; -} - -/** - * Save when the page cache is saved. - */ -function page_manager_term_view_save($subtask, $cache) { - if (isset($cache->update_values)) { - variable_set('page_manager_term_view_type', $cache->update_values['page_manager_term_view_type']); - variable_set('page_manager_taxonomy_breadcrumb', $cache->update_values['page_manager_taxonomy_breadcrumb']); - } -} - -/** - * Provide a setting to the Panels administrative form. - */ -function page_manager_term_view_admin_settings($form, $settings = array()) { - if (empty($settings)) { - $settings = array( - 'page_manager_term_view_type' => page_manager_term_view_get_type(), - 'page_manager_taxonomy_breadcrumb' => variable_get('page_manager_taxonomy_breadcrumb', TRUE), - ); - } - - $form['page_manager_term_view_type'] = array( - '#type' => 'radios', - '#title' => t('Allow multiple terms on taxonomy/term/%term'), - '#options' => array('single' => t('Single term'), 'multiple' => t('Multiple terms')), - '#description' => t('By default, Drupal allows multiple terms as an argument by separating them with commas or plus signs. If you set this to single, that feature will be disabled.') . ' ' . t('This feature does not currently work and is disabled.'), - '#default_value' => $settings['page_manager_term_view_type'], - // @todo -- fix this - '#disabled' => TRUE, - ); - $form['page_manager_taxonomy_breadcrumb'] = array( - '#title' => t('Inject hierarchy of first term into breadcrumb trail'), - '#type' => 'checkbox', - '#default_value' => $settings['page_manager_taxonomy_breadcrumb'], - '#description' => t('If checked, taxonomy term parents will appear in the breadcrumb trail.'), - ); - - return $form; -} - -/** - * Callback to enable/disable the page from the UI. - */ -function page_manager_term_view_enable($cache, $status) { - variable_set('page_manager_term_view_disabled', $status); - - // Set a global flag so that the menu routine knows it needs - // to set a message if enabling cannot be done. - if (!$status) { - $GLOBALS['page_manager_enabling_term_view'] = TRUE; - } -} - -function page_manager_term_view_get_type() { - // Revert to just allowing single. - $view_type = 'single'; - - return $view_type; -} - -/** - * Provide a nice administrative summary of the page so an admin can see at a - * glance what this page does and how it is configured. - */ -function page_manager_term_view_admin_summary($task, $subtask) { - $task_name = page_manager_make_task_name($task['name'], $subtask['name']); - - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('Path')), - array('class' => array('page-summary-data'), 'data' => 'taxonomy/term/%term'), - array('class' => array('page-summary-operation'), 'data' => ''), - ); - - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('Access')), - array('class' => array('page-summary-data'), 'data' => t('This page is publicly accessible.')), - array('class' => array('page-summary-operation'), 'data' => ''), - ); - - $menu = t('No menu entry'); - - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('Menu')), - array('class' => array('page-summary-data'), 'data' => $menu), - array('class' => array('page-summary-operation'), 'data' => ''), - ); - - if (page_manager_term_view_get_type() == 'multiple') { - $message = t('Multiple terms may be used, separated by , or +.'); - } - else { - $message = t('Only a single term may be used.'); - } - - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('%term')), - array('class' => array('page-summary-data'), 'data' => $message), - array('class' => array('page-summary-operation'), 'data' => ''), - ); - - if (variable_get('page_manager_taxonomy_breadcrumb', TRUE)) { - $message = t('Breadcrumb trail will contain taxonomy term hierarchy'); - } - else { - $message = t('Breadcrumb trail will not contain taxonomy term hiearchy.'); - } - - $rows[] = array( - array('class' => array('page-summary-label'), 'data' => t('Breadcrumb')), - array('class' => array('page-summary-data'), 'data' => $message), - array('class' => array('page-summary-operation'), 'data' => ''), - ); - - $output = theme('table', array(), $rows, array('id' => 'page-manager-page-summary')); - return $output; -} - -/** - * Callback to determine if a page is accessible. - * - * @param $task - * The task plugin. - * @param $subtask_id - * The subtask id - * @param $contexts - * The contexts loaded for the task. - * - * @return bool - * TRUE if the current user can access the page. - */ -function page_manager_term_view_access_check($task, $subtask_id, $contexts) { - return user_access('access content'); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/user_edit.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/user_edit.inc deleted file mode 100644 index 3054056f1..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/user_edit.inc +++ /dev/null @@ -1,187 +0,0 @@ - 'page', - 'title' => t('User Edit Template'), - 'admin title' => t('User edit template'), - 'admin description' => t('When enabled, this overrides the default Drupal behavior for displaying user edit form at user/%user/edit.'), - 'admin path' => 'user/%user/edit', - - // Callback to add items to the page managertask administration form: - 'task admin' => 'page_manager_user_edit_task_admin', - - 'hook menu' => 'page_manager_user_edit_menu', - 'hook menu alter' => 'page_manager_user_edit_menu_alter', - - // This is task uses 'context' handlers and must implement these to give the - // handler data it needs. - 'handler type' => 'context', // handler type -- misnamed - 'get arguments' => 'page_manager_user_edit_get_arguments', - 'get context placeholders' => 'page_manager_user_edit_get_contexts', - - // Allow this to be enabled or disabled: - 'disabled' => variable_get('page_manager_user_edit_disabled', TRUE), - 'enable callback' => 'page_manager_user_edit_enable', - 'access callback' => 'page_manager_user_edit_access_check', - ); -} - -/** - * Callback defined by page_manager_user_view_page_manager_tasks(). - * - * Alter the user view input so that user view comes to us rather than the - * normal user view process. - */ -function page_manager_user_edit_menu_alter(&$items, $task) { - if (variable_get('page_manager_user_edit_disabled', TRUE)) { - return; - } - - // Override the user view handler for our purpose. - if ($items['user/%user/edit']['page callback'] == 'drupal_get_form' || variable_get('page_manager_override_anyway', FALSE)) { - $items['user/%user/edit']['page callback'] = 'page_manager_user_edit_page'; - $items['user/%user/edit']['page arguments'] = array(1); - $items['user/%user/edit']['file path'] = $task['path']; - $items['user/%user/edit']['file'] = $task['file']; - if (($categories = _user_categories()) && (count($categories) > 1)) { - foreach ($categories as $key => $category) { - // 'account' is already handled by the MENU_DEFAULT_LOCAL_TASK. - if ($category['name'] != 'account') { - $items['user/%user_category/edit/' . $category['name']]['page callback'] = 'page_manager_user_edit_page'; - $items['user/%user_category/edit/' . $category['name']]['page arguments'] = array(1, 3); - $items['user/%user_category/edit/' . $category['name']]['file path'] = $task['path']; - $items['user/%user_category/edit/' . $category['name']]['file'] = $task['file']; - } - } - } - } - else { - // Automatically disable this task if it cannot be enabled. - variable_set('page_manager_user_edit_disabled', TRUE); - if (!empty($GLOBALS['page_manager_enabling_user_edit'])) { - drupal_set_message(t('Page manager module is unable to enable user/%user/edit because some other module already has overridden with %callback.', array('%callback' => $items['user/%user']['page callback'])), 'error'); - } - } -} - -/** - * Entry point for our overridden user view. - * - * This function asks its assigned handlers who, if anyone, would like - * to run with it. If no one does, it passes through to Drupal core's - * user edit, which is drupal_get_form('user_profile_form',$account). - */ -function page_manager_user_edit_page($account, $category = 'account') { - // Store the category on the user for later usage. - $account->user_category = $category; - - // Load my task plugin: - $task = page_manager_get_task('user_edit'); - - // Load the account into a context. - ctools_include('context'); - ctools_include('context-task-handler'); - $contexts = ctools_context_handler_get_task_contexts($task, '', array($account)); - // Build content. @todo -- this may not be right. - user_build_content($account); - - $output = ctools_context_handler_render($task, '', $contexts, array($account->uid)); - if (is_array($output)) { - $output = drupal_render($output); - } - if ($output !== FALSE) { - return $output; - } - - $function = 'drupal_get_form'; - foreach (module_implements('page_manager_override') as $module) { - $call = $module . '_page_manager_override'; - if (($rc = $call('user_edit')) && function_exists($rc)) { - $function = $rc; - break; - } - } - - // Otherwise, fall back. - if ($function == 'drupal_get_form') { - - // In order to ajax fields to work we need to run form_load_include. - // Hence we eschew drupal_get_form and manually build the info and - // call drupal_build_form. - $form_state = array(); - $form_id = 'user_profile_form'; - $args = array($account, $category); - $form_state['build_info']['args'] = $args; - form_load_include($form_state, 'inc', 'user', 'user.pages'); - $output = drupal_build_form($form_id, $form_state); - return $output; - } - // Fire off "view" op so that triggers still work. - // @todo -- this doesn't work anymore, and the alternatives seem bad. - // will have to figure out how to fix this. - return $function($account); -} - -/** - * Callback to get arguments provided by this task handler. - * - * Since this is the node view and there is no UI on the arguments, we - * create dummy arguments that contain the needed data. - */ -function page_manager_user_edit_get_arguments($task, $subtask_id) { - return array( - array( - 'keyword' => 'user', - 'identifier' => t('User being edited'), - 'id' => 1, - 'name' => 'user_edit', - 'settings' => array(), - ), - ); -} - -/** - * Callback to get context placeholders provided by this handler. - */ -function page_manager_user_edit_get_contexts($task, $subtask_id) { - return ctools_context_get_placeholders_from_argument(page_manager_user_edit_get_arguments($task, $subtask_id)); -} - -/** - * Callback to enable/disable the page from the UI. - */ -function page_manager_user_edit_enable($cache, $status) { - variable_set('page_manager_user_edit_disabled', $status); - // Set a global flag so that the menu routine knows it needs - // to set a message if enabling cannot be done. - if (!$status) { - $GLOBALS['page_manager_enabling_user_edit'] = TRUE; - } -} - -/** - * Callback to determine if a page is accessible. - * - * @param $task - * The task plugin. - * @param $subtask_id - * The subtask id - * @param $contexts - * The contexts loaded for the task. - * - * @return - * TRUE if the current user can access the page. - */ -function page_manager_user_edit_access_check($task, $subtask_id, $contexts) { - $context = reset($contexts); - return user_edit_access($context->data); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/user_view.inc b/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/user_view.inc deleted file mode 100644 index 3a531c7b4..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/plugins/tasks/user_view.inc +++ /dev/null @@ -1,161 +0,0 @@ - 'page', - 'title' => t('User profile template'), - 'admin title' => t('User profile template'), - 'admin description' => t('When enabled, this overrides the default Drupal behavior for displaying user profiles at user/%user. If you add variants, you may use selection criteria such as roles or user access to provide different views of user profiles. If no variant is selected, the default Drupal user view will be used. Please note that if you are using pathauto, aliases may make a node to be somewhere else, but as far as Drupal is concerned, they are still at user/%user.'), - 'admin path' => 'user/%user', - - // Callback to add items to the page managertask administration form: - 'task admin' => 'page_manager_user_view_task_admin', - - 'hook menu' => 'page_manager_user_view_menu', - 'hook menu alter' => 'page_manager_user_view_menu_alter', - - // This is task uses 'context' handlers and must implement these to give the - // handler data it needs. - 'handler type' => 'context', // handler type -- misnamed - 'get arguments' => 'page_manager_user_view_get_arguments', - 'get context placeholders' => 'page_manager_user_view_get_contexts', - - // Allow this to be enabled or disabled: - 'disabled' => variable_get('page_manager_user_view_disabled', TRUE), - 'enable callback' => 'page_manager_user_view_enable', - 'access callback' => 'page_manager_user_view_access_check', - ); -} - -/** - * Callback defined by page_manager_user_view_page_manager_tasks(). - * - * Alter the user view input so that user view comes to us rather than the - * normal user view process. - */ -function page_manager_user_view_menu_alter(&$items, $task) { - if (variable_get('page_manager_user_view_disabled', TRUE)) { - return; - } - - // Override the user view handler for our purpose. - if ($items['user/%user']['page callback'] == 'user_view_page' || variable_get('page_manager_override_anyway', FALSE)) { - $items['user/%user']['page callback'] = 'page_manager_user_view_page'; - $items['user/%user']['file path'] = $task['path']; - $items['user/%user']['file'] = $task['file']; - } - else { - // Automatically disable this task if it cannot be enabled. - variable_set('page_manager_user_view_disabled', TRUE); - if (!empty($GLOBALS['page_manager_enabling_user_view'])) { - drupal_set_message(t('Page manager module is unable to enable user/%user because some other module already has overridden with %callback.', array('%callback' => $items['user/%user']['page callback'])), 'error'); - } - } -} - -/** - * Entry point for our overridden user view. - * - * This function asks its assigned handlers who, if anyone, would like - * to run with it. If no one does, it passes through to Drupal core's - * user view, which is user_page_view(). - */ -function page_manager_user_view_page($account) { - // Load my task plugin: - $task = page_manager_get_task('user_view'); - - // Load the account into a context. - ctools_include('context'); - ctools_include('context-task-handler'); - $contexts = ctools_context_handler_get_task_contexts($task, '', array($account)); - - // Build content. @todo -- this may not be right. - user_build_content($account); - - $output = ctools_context_handler_render($task, '', $contexts, array($account->uid)); - if ($output !== FALSE) { - return $output; - } - - $function = 'user_view'; - foreach (module_implements('page_manager_override') as $module) { - $call = $module . '_page_manager_override'; - if (($rc = $call('user_view')) && function_exists($rc)) { - $function = $rc; - break; - } - } - - // Otherwise, fall back. - if ($function == 'user_view') { - module_load_include('inc', 'user', 'user.pages'); - } - // Fire off "view" op so that triggers still work. - // @todo -- this doesn't work anymore, and the alternatives seem bad. - // will have to figure out how to fix this. - return $function($account); -} - -/** - * Callback to get arguments provided by this task handler. - * - * Since this is the node view and there is no UI on the arguments, we - * create dummy arguments that contain the needed data. - */ -function page_manager_user_view_get_arguments($task, $subtask_id) { - return array( - array( - 'keyword' => 'user', - 'identifier' => t('User being viewed'), - 'id' => 1, - 'name' => 'entity_id:user', - 'settings' => array(), - ), - ); -} - -/** - * Callback to get context placeholders provided by this handler. - */ -function page_manager_user_view_get_contexts($task, $subtask_id) { - return ctools_context_get_placeholders_from_argument(page_manager_user_view_get_arguments($task, $subtask_id)); -} - -/** - * Callback to enable/disable the page from the UI. - */ -function page_manager_user_view_enable($cache, $status) { - variable_set('page_manager_user_view_disabled', $status); - - // Set a global flag so that the menu routine knows it needs - // to set a message if enabling cannot be done. - if (!$status) { - $GLOBALS['page_manager_enabling_user_view'] = TRUE; - } -} - -/** - * Callback to determine if a page is accessible. - * - * @param $task - * The task plugin. - * @param $subtask_id - * The subtask id - * @param $contexts - * The contexts loaded for the task. - * - * @return - * TRUE if the current user can access the page. - */ -function page_manager_user_view_access_check($task, $subtask_id, $contexts) { - $context = reset($contexts); - return user_view_access($context->data); -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/tests/head_links.test b/html/sites/all/modules/contrib/ctools/page_manager/tests/head_links.test deleted file mode 100644 index 3a88e295b..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/tests/head_links.test +++ /dev/null @@ -1,77 +0,0 @@ - 'Head links test', - 'description' => 'Checks that the shortlink and canonical links are present on a node page overriden by Page manager', - 'group' => 'ctools', - ); - } - - /** - * {@inheritdoc} - */ - public function setUp() { - parent::setUp('page_manager'); - - // First add an override for "node/%node". - variable_set('page_manager_node_view_disabled', FALSE); - - $record = (object) array( - 'name' => 'node_view__http_response_707659df-062d-4252-8c2a-22a8e0289cd4', - 'task' => 'node_view', - 'subtask' => '', - 'handler' => 'http_response', - 'weight' => '1', - 'conf' => array( - 'title' => 'Test', - 'contexts' => array( - 0 => array( - 'identifier' => 'String', - 'keyword' => 'string', - 'name' => 'string', - 'string' => 'Test', - 'id' => 1, - ), - ), - 'relationships' => array(), - 'code' => '404', - 'destination' => '', - 'name' => '', - ), - ); - - page_manager_save_task_handler($record); - - menu_rebuild(); - } - - /** - * Test the presence of the head links. - */ - public function testHeadLinks() { - $node = $this->drupalCreateNode(); - $url = 'node/' . $node->nid; - $this->drupalGet($url); - - $shortlink = $this->xpath('//head//link[@rel="shortlink"]'); - $this->assertEqual(url($url), (string) $shortlink[0]['href'], 'shortlink url found'); - - $canonical = $this->xpath('//head//link[@rel="canonical"]'); - $this->assertEqual(url($url), (string) $canonical[0]['href'], 'canonical url found'); - } - -} diff --git a/html/sites/all/modules/contrib/ctools/page_manager/theme/page-manager-edit-page.tpl.php b/html/sites/all/modules/contrib/ctools/page_manager/theme/page-manager-edit-page.tpl.php deleted file mode 100644 index 2ea065c8a..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/theme/page-manager-edit-page.tpl.php +++ /dev/null @@ -1,54 +0,0 @@ - -
    - -
    - -
    - -
    - -
    -
    -
    - -
    -
    -
    -
    -
    -
    - - -
    - -
    - -
    - -
    - -
    - -
    - -
    - - -
    -
    -
    -
    -
    - -
    diff --git a/html/sites/all/modules/contrib/ctools/page_manager/theme/page_manager.theme.inc b/html/sites/all/modules/contrib/ctools/page_manager/theme/page_manager.theme.inc deleted file mode 100644 index 3df55a89b..000000000 --- a/html/sites/all/modules/contrib/ctools/page_manager/theme/page_manager.theme.inc +++ /dev/null @@ -1,118 +0,0 @@ -task; - - $page = &$vars['page']; - - $vars['locked'] = ''; - $vars['changed'] = ''; - if (!empty($page->locked)) { - $vars['locked'] = theme('page_manager_lock', array('page' => $page)); - $vars['changed'] = theme('page_manager_changed', array('text' => t('Locked'), 'description' => t('This page is being edited by another user and you cannot make changes to it.'))); - } - elseif (!empty($page->new)) { - $vars['changed'] = theme('page_manager_changed', array('text' => t('New'), 'description' => t('This page is newly created and has not yet been saved to the database. It will not be available until you save it.'))); - } - elseif (!empty($page->changed)) { - $vars['changed'] = theme('page_manager_changed', array('text' => t('Changed'), 'description' => t('This page has been modified, but these modifications are not yet live. While modifying this page, it is locked from modification by other users.'))); - } - - $form_state = array( - 'page' => &$vars['page'], - ); - - $active = $vars['content']['active']; - if ($active[0] == 'handlers' && isset($vars['operations'][$active[1]])) { - $vars['operations']['secondary'] = $vars['operations'][$active[1]]; - } -} - -/** - * Turn the rearrange form into a table with tablesorting on. - */ -function theme_page_manager_handler_rearrange($vars) { - $form = &$vars['form']; - // Assemble the data for a table from everything in $form['handlers']. - foreach (element_children($form['handlers']) as $id) { - // Provide a reference shortcut. - $element = &$form['handlers'][$id]; - if (isset($element['title'])) { - $row = array(); - - $row[] = array( - 'data' => render($element['title']), - 'class' => array('page-manager-handler'), - ); - - $element['weight']['#attributes']['class'][] = 'weight'; - $row[] = render($element['weight']); - - $rows[] = array('data' => $row, 'class' => array('draggable'), 'id' => 'page-manager-row-' . $id); - } - } - - if (empty($rows)) { - $rows[] = array(array('data' => t('No task handlers are defined for this task.'), 'colspan' => '5')); - } - - $header = array( - array('data' => t('Variant'), 'class' => array('page-manager-handler')), - t('Weight'), - ); - - drupal_add_tabledrag('page-manager-arrange-handlers', 'order', 'sibling', 'weight'); - - $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'page-manager-arrange-handlers'))); - $output .= drupal_render_children($form); - return $output; -} - -/** - * Draw the "this task is locked from editing" box. - */ -function theme_page_manager_lock($vars) { - $page = $vars['page']; - - $account = user_load($page->locked->uid); - $name = theme('username', array('account' => $account)); - $lock_age = format_interval(REQUEST_TIME - $page->locked->updated); - $break = url(page_manager_edit_url($page->task_name, array('actions', 'break-lock'))); - - ctools_add_css('ctools'); - $output = '
    '; - $output .= t('This page is being edited by user !user, and is therefore locked from editing by others. This lock is !age old. Click here to break this lock.', array('!user' => $name, '!age' => $lock_age, '!break' => $break)); - $output .= '
    '; - return $output; -} - -/** - * Draw the "you have unsaved changes and this task is locked." message. - */ -function theme_page_manager_changed($vars) { - $text = $vars['text']; - $description = $vars['description']; - - ctools_add_css('ctools'); - $output = '
    '; - $output .= $text; - $output .= '
    '; - - return $output; -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/book.inc b/html/sites/all/modules/contrib/ctools/plugins/access/book.inc deleted file mode 100644 index 4b4f7eaae..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/book.inc +++ /dev/null @@ -1,94 +0,0 @@ - t("Book: node is in a book"), - 'description' => t('Control access based upon a node belonging to a book.'), - 'callback' => 'ctools_book_node_ctools_access_check', - 'default' => array('book' => array()), - 'settings form' => 'ctools_book_node_ctools_access_settings', - 'settings form submit' => 'ctools_book_node_ctools_access_settings_submit', - 'summary' => 'ctools_book_node_ctools_access_summary', - 'required context' => new ctools_context_required(t('Node'), 'node'), - ); -} - -/** - * Settings form for the 'by book_node' access plugin. - */ -function ctools_book_node_ctools_access_settings($form, &$form_state, $conf) { - $options = array( - 'any' => t('In any book'), - ); - $books = book_get_books(); - foreach ($books as $bid => $book) { - $options[$bid] = $book['title']; - } - $form['settings']['book'] = array( - '#title' => t('Book'), - '#type' => 'checkboxes', - '#options' => $options, - '#description' => t('Pass only if the node belongs to one of the selected books'), - '#default_value' => $conf['book'], - '#required' => TRUE, - ); - return $form; -} - -/** - * Check for access. - */ -function ctools_book_node_ctools_access_check($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data) || empty($context->data->book)) { - return FALSE; - } - - if ($conf['book']['any']) { - return !empty($context->data->book); - } - - foreach ($conf['book'] as $bid => $value) { - if ($bid == 'any') { - continue; - } - if ($value && ($bid == $context->data->book['bid'])) { - return TRUE; - } - } - - return FALSE; -} - -/** - * Provide a summary description based upon the checked node_languages. - */ -function ctools_book_node_ctools_access_summary($conf, $context) { - if ($conf['book']['any']) { - return t('@identifier belongs to a book', array('@identifier' => $context->identifier)); - } - - $books = array(); - foreach ($conf['book'] as $bid => $value) { - if ($value) { - $node = node_load($bid); - $books[] = $node->title; - } - } - - if (count($books) == 1) { - return t('@identifier belongs to the book "@book"', array('@book' => $books[0], '@identifier' => $context->identifier)); - } - - return t('@identifier belongs in multiple books', array('@identifier' => $context->identifier)); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/compare_users.inc b/html/sites/all/modules/contrib/ctools/plugins/access/compare_users.inc deleted file mode 100644 index e0a7f1b45..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/compare_users.inc +++ /dev/null @@ -1,70 +0,0 @@ - t("User: compare"), - 'description' => t('Compare two users (logged-in user and user being viewed, for example)'), - 'callback' => 'ctools_compare_users_access_check', - 'default' => array( - 'equality' => 1, - ), - 'settings form' => 'ctools_compare_users_settings', - 'summary' => 'ctools_compare_users_ctools_access_summary', - 'required context' => array( - new ctools_context_required(t('First User'), 'user'), - new ctools_context_required(t("Second User"), 'user'), - ), -); - -/** - * Settings form for the 'by perm' access plugin. - */ -function ctools_compare_users_settings($form, &$form_state, $conf) { - - $form['settings']['helptext'] = array( - '#type' => 'markup', - '#value' => '
    ' . t('Grant access based on comparison of the two user contexts. For example, to grant access to a user to view their own profile, choose "logged in user" and "user being viewed" and say "grant access if equal". When they\'re the same, access will be granted.') . '
    ', - ); - - $form['settings']['equality'] = array( - '#type' => 'radios', - '#title' => t('Grant access if user contexts are'), - '#options' => array(1 => t('Equal'), 0 => t('Not equal')), - '#default_value' => $conf['equality'], - ); - return $form; -} - -/** - * Check for access. - */ -function ctools_compare_users_access_check($conf, $context) { - - if (empty($context) || count($context) != 2 || empty($context[0]->data) || empty($context[1]->data)) { - return FALSE; - } - $account1 = $context[0]->data; - $account2 = $context[1]->data; - - // xor returns false if the two bools are the same, and true if they are not. - // i.e, if we asked for equality and they are equal, return true. - // If we asked for inequality and they are equal, return false. - return ($account1->uid == $account2->uid) xor empty($conf['equality']); -} - -/** - * Describe an instance of this plugin. - */ -function ctools_compare_users_ctools_access_summary($conf, $context) { - $comparison = !empty($conf['equality']) ? "is" : 'is not'; - - return t('@id1 @comp @id2', array('@comp' => $comparison, '@id1' => $context[0]->identifier, '@id2' => $context[1]->identifier)); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/context_exists.inc b/html/sites/all/modules/contrib/ctools/plugins/access/context_exists.inc deleted file mode 100644 index e5d2b5e27..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/context_exists.inc +++ /dev/null @@ -1,51 +0,0 @@ - t("Context exists"), - 'description' => t('Control access by whether or not a context exists and contains data.'), - 'callback' => 'ctools_context_exists_ctools_access_check', - 'settings form' => 'ctools_context_exists_ctools_access_settings', - 'summary' => 'ctools_context_exists_ctools_access_summary', - 'required context' => new ctools_context_required(t('Context'), 'any', TRUE), - 'defaults' => array('exists' => TRUE), -); - -/** - * Settings form. - */ -function ctools_context_exists_ctools_access_settings($form, &$form_state, $conf) { - $form['settings']['exists'] = array( - '#type' => 'radios', - '#description' => t("Check to see if the context exists (contains data) or does not exist (contains no data). For example, if a context is optional and the path does not contain an argument for that context, it will not exist."), - '#options' => array(TRUE => t('Exists'), FALSE => t("Doesn't exist")), - '#default_value' => $conf['exists'], - ); - return $form; -} - -/** - * Check for access. - */ -function ctools_context_exists_ctools_access_check($conf, $context) { - // Xor returns false if the two bools are the same, and true if they are not. - // i.e, if we asked for context_exists and it does, return true. - // If we asked for context does not exist and it does, return false. - return (empty($context->data) xor !empty($conf['exists'])); -} - -/** - * Provide a summary description based upon the specified context. - */ -function ctools_context_exists_ctools_access_summary($conf, $context) { - if (!empty($conf['exists'])) { - return t('@identifier exists', array('@identifier' => $context->identifier)); - } - else { - return t('@identifier does not exist', array('@identifier' => $context->identifier)); - } -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/entity_bundle.inc b/html/sites/all/modules/contrib/ctools/plugins/access/entity_bundle.inc deleted file mode 100644 index fce34197d..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/entity_bundle.inc +++ /dev/null @@ -1,135 +0,0 @@ - t("Entity: bundle"), - 'description' => t('Control access by entity bundle.'), - 'callback' => 'ctools_entity_bundle_ctools_access_check', - 'default' => array('type' => array()), - 'settings form' => 'ctools_entity_bundle_ctools_access_settings', - 'settings form submit' => 'ctools_entity_bundle_ctools_access_settings_submit', - 'summary' => 'ctools_entity_bundle_ctools_access_summary', - 'restrictions' => 'ctools_entity_bundle_ctools_access_restrictions', - 'get child' => 'ctools_entity_bundle_ctools_access_get_child', - 'get children' => 'ctools_entity_bundle_ctools_access_get_children', -); - -function ctools_entity_bundle_ctools_access_get_child($plugin, $parent, $child) { - $plugins = ctools_entity_bundle_ctools_access_get_children($plugin, $parent); - return $plugins[$parent . ':' . $child]; -} - -function ctools_entity_bundle_ctools_access_get_children($plugin, $parent) { - $entities = entity_get_info(); - $plugins = array(); - foreach ($entities as $entity_type => $entity) { - $plugin['title'] = t('@entity: Bundle', array('@entity' => $entity['label'])); - $plugin['keyword'] = $entity_type; - $plugin['description'] = t('Control access by @entity entity bundle.', array('@entity' => $entity_type)); - $plugin['name'] = $parent . ':' . $entity_type; - $plugin['required context'] = new ctools_context_required(t(ucfirst($entity_type)), $entity_type); - $plugins[$parent . ':' . $entity_type] = $plugin; - } - - return $plugins; -} - -/** - * Settings form for the 'by entity_bundle' access plugin. - */ -function ctools_entity_bundle_ctools_access_settings($form, &$form_state, $conf) { - $plugin = $form_state['plugin']; - $entity_type = explode(':', $plugin['name']); - $entity_type = $entity_type[1]; - $entity = entity_get_info($entity_type); - foreach ($entity['bundles'] as $type => $info) { - $options[$type] = check_plain($info['label']); - } - - $form['settings']['type'] = array( - '#title' => t('Entity Bundle'), - '#type' => 'checkboxes', - '#options' => $options, - '#description' => t('Only the checked entity bundles will be valid.'), - '#default_value' => $conf['type'], - ); - return $form; -} - -/** - * Compress the entity bundles allowed to the minimum. - */ -function ctools_entity_bundle_ctools_access_settings_submit($form, &$form_state) { - $form_state['values']['settings']['type'] = array_filter($form_state['values']['settings']['type']); -} - -/** - * Check for access. - */ -function ctools_entity_bundle_ctools_access_check($conf, $context, $plugin) { - list($plugin_name, $entity_type) = explode(':', $plugin['name']); - if (!$entity_type) { - return FALSE; - }; - - $entity = entity_get_info($entity_type); - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data) || empty($context->data->{$entity['entity keys']['bundle']})) { - return FALSE; - } - - if (array_filter($conf['type']) && empty($conf['type'][$context->data->{$entity['entity keys']['bundle']}])) { - return FALSE; - } - - return TRUE; -} - -/** - * Inform the UI that we've eliminated a bunch of possibilities for this - * context. - */ -function ctools_entity_bundle_ctools_access_restrictions($conf, &$context) { - if (isset($context->restrictions['type'])) { - $context->restrictions['type'] = array_unique(array_merge($context->restrictions['type'], array_keys(array_filter($conf['type'])))); - } - else { - $context->restrictions['type'] = array_keys(array_filter($conf['type'])); - } -} - -/** - * Provide a summary description based upon the checked entity_bundle. - */ -function ctools_entity_bundle_ctools_access_summary($conf, $context, $plugin) { - if (!isset($conf['type'])) { - $conf['type'] = array(); - } - - list($plugin_name, $entity_type) = explode(':', $plugin['name']); - if (!$entity_type) { - return t('Error, misconfigured entity_bundle access plugin'); - }; - - $entity = entity_get_info($entity_type); - - $names = array(); - foreach (array_filter($conf['type']) as $type) { - $names[] = check_plain($entity['bundles'][$type]['label']); - } - - if (empty($names)) { - return t('@identifier is any bundle', array('@identifier' => $context->identifier)); - } - - return format_plural(count($names), '@identifier is bundle "@types"', '@identifier bundle is one of "@types"', array('@types' => implode(', ', $names), '@identifier' => $context->identifier)); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/entity_field_value.inc b/html/sites/all/modules/contrib/ctools/plugins/access/entity_field_value.inc deleted file mode 100644 index 60d2c2e02..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/entity_field_value.inc +++ /dev/null @@ -1,411 +0,0 @@ - t("(Custom) Entity: Field Value"), - 'description' => t('Control access by entity field value.'), - 'callback' => 'ctools_entity_field_value_ctools_access_check', - 'default' => array('type' => array()), - 'settings form' => 'ctools_entity_field_value_ctools_access_settings', - 'settings form submit' => 'ctools_entity_field_value_ctools_access_settings_submit', - 'summary' => 'ctools_entity_field_value_ctools_access_summary', - 'get child' => 'ctools_entity_field_value_ctools_access_get_child', - 'get children' => 'ctools_entity_field_value_ctools_access_get_children', -); - -function ctools_entity_field_value_ctools_access_get_child($plugin, $parent, $child) { - $plugins = &drupal_static(__FUNCTION__, array()); - if (empty($plugins[$parent . ':' . $child])) { - list($entity_type, $bundle_type, $field_name) = explode(':', $child); - $plugins[$parent . ':' . $child] = _ctools_entity_field_value_ctools_access_get_child($plugin, $parent, $entity_type, $bundle_type, $field_name); - } - - return $plugins[$parent . ':' . $child]; -} - -function ctools_entity_field_value_ctools_access_get_children($plugin, $parent) { - $plugins = &drupal_static(__FUNCTION__, array()); - if (!empty($plugins)) { - return $plugins; - } - $entities = entity_get_info(); - foreach ($entities as $entity_type => $entity) { - foreach ($entity['bundles'] as $bundle_type => $bundle) { - foreach (field_info_instances($entity_type, $bundle_type) as $field_name => $field) { - if (!isset($plugins[$parent . ':' . $entity_type . ':' . $bundle_type . ':' . $field_name])) { - $plugin = _ctools_entity_field_value_ctools_access_get_child($plugin, $parent, $entity_type, $bundle_type, $field_name, $entity, $bundle, $field); - $plugins[$parent . ':' . $entity_type . ':' . $bundle_type . ':' . $field_name] = $plugin; - } - } - } - } - - return $plugins; -} - -function _ctools_entity_field_value_ctools_access_get_child($plugin, $parent, $entity_type, $bundle_type, $field_name, $entity = NULL, $bundle = NULL, $field = NULL) { - // Check that the entity, bundle and field arrays have a value. - // If not, load theme using machine names. - if (empty($entity)) { - $entity = entity_get_info($entity_type); - } - - if (empty($bundle)) { - $bundle = $entity['bundles'][$bundle_type]; - } - - if (empty($field)) { - $field_instances = field_info_instances($entity_type, $bundle_type); - $field = $field_instances[$field_name]; - } - - $plugin['title'] = t('@entity @type: @field Field', array('@entity' => $entity['label'], '@type' => $bundle_type, '@field' => $field['label'])); - $plugin['keyword'] = $entity_type; - $plugin['description'] = t('Control access by @entity entity bundle.', array('@entity' => $entity_type)); - $plugin['name'] = $parent . ':' . $entity_type . ':' . $bundle_type . ':' . $field_name; - $plugin['required context'] = new ctools_context_required(t(ucfirst($entity_type)), $entity_type, array( - 'type' => $bundle_type, - )); - - return $plugin; -} - -/** - * Settings form for the 'by entity_bundle' access plugin. - */ -function ctools_entity_field_value_ctools_access_settings($form, &$form_state, $conf) { - $plugin = $form_state['plugin']; - list($parent, $entity_type, $bundle_type, $field_name) = explode(':', $plugin['name']); - $entity_info = entity_get_info($entity_type); - $instances = field_info_instances($entity_type, $bundle_type); - $instance = $instances[$field_name]; - $field = field_info_field_by_id($instance['field_id']); - foreach ($field['columns'] as $column => $attributes) { - $columns[$column] = _field_sql_storage_columnname($field_name, $column); - } - ctools_include('fields'); - $entity = (object) array( - $entity_info['entity keys']['bundle'] => $bundle_type, - ); - - foreach ($columns as $column => $sql_column) { - if (isset($conf[$sql_column])) { - if (is_array($conf[$sql_column])) { - foreach ($conf[$sql_column] as $delta => $conf_value) { - if (is_numeric($delta)) { - if (is_array($conf_value)) { - $entity->{$field_name}[LANGUAGE_NONE][$delta][$column] = $conf_value[$column]; - } - else { - $entity->{$field_name}[LANGUAGE_NONE][$delta][$column] = $conf_value; - } - } - } - } - else { - $entity->{$field_name}[LANGUAGE_NONE][0][$column] = $conf[$sql_column]; - } - } - } - - $form['#parents'] = array('settings'); - $langcode = field_valid_language(NULL); - $form['settings'] += (array) ctools_field_invoke_field($instance, 'form', $entity_type, $entity, $form, $form_state, array('default' => TRUE, 'language' => $langcode)); - // Weight is really not important once this is populated and will only interfere with the form layout. - foreach (element_children($form['settings']) as $element) { - unset($form['settings'][$element]['#weight']); - } - - return $form; -} - -function ctools_entity_field_value_ctools_access_settings_submit($form, &$form_state) { - $plugin = $form_state['plugin']; - list($parent, $entity_type, $bundle_type, $field_name) = explode(':', $plugin['name']); - $langcode = field_valid_language(NULL); - $langcode = isset($form_state['input']['settings'][$field_name][$langcode]) ? $langcode : LANGUAGE_NONE; - $instances = field_info_instances($entity_type, $bundle_type); - $instance = $instances[$field_name]; - $field = field_info_field_by_id($instance['field_id']); - foreach ($field['columns'] as $column => $attributes) { - $columns[$column] = _field_sql_storage_columnname($field_name, $column); - } - $items = _ctools_entity_field_value_get_proper_form_items($field, $form_state['values']['settings'][$field_name][$langcode], array_keys($columns)); - foreach ($columns as $column => $sql_column) { - $column_items = _ctools_entity_field_value_filter_items_by_column($items, $column); - $form_state['values']['settings'][$sql_column] = $column_items; - } - $form_state['values']['settings'][$field_name][$langcode] = $items; -} - -function _ctools_entity_field_value_get_proper_form_items($field, $form_items, $columns) { - $items = array(); - - // Single value item. - if (!is_array($form_items)) { - foreach ($columns as $column) { - $items[0][$column] = $form_items; - } - return $items; - } - - foreach ($form_items as $delta => $value) { - $item = array(); - if (is_numeric($delta)) { // Array of field values. - if (!is_array($value)) { // Single value in array. - foreach ($columns as $column) { - $item[$column] = $value; - } - } - else { // Value has colums. - foreach ($columns as $column) { - $item[$column] = isset($value[$column]) ? $value[$column] : ''; - } - } - } - $items[] = $item; - } - - // Check if $form_items is an array of columns. - $item = array(); - $has_columns = FALSE; - foreach ($columns as $column) { - if (isset($form_items[$column])) { - $has_columns = TRUE; - $item[$column] = $form_items[$column]; - } - else { - $item[$column] = ''; - } - } - if ($has_columns) { - $items[] = $item; - } - - // Remove empty values. - $items = _field_filter_items($field, $items); - return $items; -} - -function _ctools_entity_field_value_filter_items_by_column($items, $column) { - $column_items = array(); - foreach ($items as $delta => $values) { - $column_items[$delta] = isset($values[$column]) ? $values[$column] : ''; - } - return $column_items; -} - -/** - * Check for access. - */ -function ctools_entity_field_value_ctools_access_check($conf, $context, $plugin) { - if ((!is_object($context)) || (empty($context->data))) { - // If the context doesn't exist -- for example, a newly added entity - // reference is used as a pane visibility criteria -- we deny access. - return FALSE; - } - - list($parent, $entity_type, $bundle_type, $field_name) = explode(':', $plugin['name']); - - if ($field_items = field_get_items($entity_type, $context->data, $field_name)) { - $langcode = field_language($entity_type, $context->data, $field_name); - // Get field storage columns. - $instance = field_info_instance($entity_type, $field_name, $bundle_type); - $field = field_info_field_by_id($instance['field_id']); - $columns = array(); - foreach ($field['columns'] as $column => $attributes) { - $columns[$column] = _field_sql_storage_columnname($field_name, $column); - } - - if (isset($conf[$field_name])) { - // We have settings for this field. - $conf_value_array = _ctools_entity_field_value_ctools_access_get_conf_field_values($conf[$field_name], $langcode); - if (empty($conf_value_array)) { - return FALSE; - } - - // Check field value. - foreach ($field_items as $field_value) { - // Iterate through config values. - foreach ($conf_value_array as $conf_value) { - $match = FALSE; - foreach ($field_value as $field_column => $value) { - // Check access only for stored in config column values. - if (isset($conf_value[$field_column])) { - if ($value == $conf_value[$field_column]) { - $match = TRUE; - } - else { - $match = FALSE; - break; - } - } - } - if ($match) { - return TRUE; - } - } - } - return FALSE; - } - } - - return FALSE; -} - -function _ctools_entity_field_value_ctools_access_get_conf_field_values($values, $langcode = LANGUAGE_NONE) { - if (!is_array($values) || !isset($values[$langcode])) { - return NULL; - } - $conf_values = array(); - - foreach ($values[$langcode] as $delta => $value) { - $conf_values[$delta] = $value; - } - - return $conf_values; -} - -/** - * Provide a summary description based upon the checked entity_bundle. - */ -function ctools_entity_field_value_ctools_access_summary($conf, $context, $plugin) { - list($parent, $entity_type, $bundle_type, $field_name) = explode(':', $plugin['name']); - $instances = field_info_instances($entity_type, $bundle_type); - $instance = $instances[$field_name]; - $field = field_info_field_by_id($instance['field_id']); - $entity_info = entity_get_info($entity_type); - $entity = (object)array( - $entity_info['entity keys']['bundle'] => $bundle_type, - ); - $keys = array(); - $value_keys = array(); - $keyed_elements = array(); - foreach ($field['columns'] as $column => $attributes) { - $conf_key = _field_sql_storage_columnname($field_name, $column); - $keyed_elements["@{$column}_value"] = array(); - - if (isset($conf[$conf_key])) { - if (is_array($conf[$conf_key])) { - $i = 0; - foreach ($conf[$conf_key] as $conf_value) { - if (!is_array($conf_value)) { - $entity->{$field_name}[LANGUAGE_NONE][$i][$column] = $conf_value; - $keyed_elements["@{$column}_value"][$i] = array('#markup' => $conf_value); - } - elseif (isset($conf_value[$column])) { - $entity->{$field_name}[LANGUAGE_NONE][$i][$column] = $conf_value[$column]; - $keyed_elements["@{$column}_value"][$i] = array('#markup' => $conf_value[$column]); - } - $i++; - } - } - else { - $entity->{$field_name}[LANGUAGE_NONE][0][$column] = $conf[$conf_key]; - $keyed_elements["@{$column}_value"][0] = array('#markup' => $conf[$conf_key]); - } - } - - $keys['@' . $column] = $column; - $value_keys[] = "@{$column}_value"; - } - $elements = array(); - $items = isset($entity->{$field_name}[LANGUAGE_NONE]) ? $entity->{$field_name}[LANGUAGE_NONE] : array(); - $view_mode = 'full'; - ctools_include('fields'); - $display = field_get_display($instance, $view_mode, $entity); - if (!isset($display['module'])) { - $display['module'] = $field['module']; - } - if (isset($display['module'])) { - // Choose simple formatter for well known cases. - switch ($display['module']) { - case 'text': - $display['type'] = 'text_default'; - break; - - case 'list': - $display['type'] = 'list_default'; - if ($field['type'] == 'list_boolean') { - $allowed_values = list_allowed_values($field, $instance, $entity_type, $entity); - foreach ($items as $item) { - if (isset($allowed_values[$item['value']])) { - if ($allowed_values[$item['value']] == '') { - $display['type'] = 'list_key'; - break; - } - } - else { - $display['type'] = 'list_key'; - } - } - } - break; - - case 'taxonomy': - $display['type'] = 'taxonomy_term_reference_plain'; - break; - - case 'entityreference': - $display['type'] = 'entityreference_label'; - break; - - default: - // Use field instance formatter setting. - break; - } - - $function = $display['module'] . '_field_formatter_view'; - if (function_exists($function)) { - $entity_group = array(0 => $entity); - $item_group = array(0 => $items); - $instance_group = array(0 => $instance); - field_default_prepare_view($entity_type, $entity_group, $field, $instance_group, LANGUAGE_NONE, $item_group, $display); - $elements = $function($entity_type, $entity, $field, $instance, LANGUAGE_NONE, $item_group[0], $display); - } - } - if (count($elements) > 0) { - foreach ($field['columns'] as $column => $attributes) { - if (count($field['columns']) == 1) { - $keyed_elements["@{$column}_value"] = $elements; - } - } - } - $values = array(); - foreach ($value_keys as $key) { - $output = array(); - $elements = $keyed_elements[$key]; - if (is_array($elements)) { - foreach ($elements as $element_key => $element) { - if (is_numeric($element_key)) { - $value_str = strip_tags(drupal_render($element)); - if (strlen($value_str) > 0) { - $output[] = $value_str; - } - } - } - } - else { - $value_str = strip_tags(drupal_render($elements)); - if (strlen($value_str) > 0) { - $output[] = $value_str; - } - } - $value = implode(', ', $output); - if ($value !== '') { - $values[$key] = implode(', ', $output); - } - } - $string = ''; - $value_count = count($values); - foreach ($keys as $key_name => $column) { - if (isset($values[$key_name . '_value'])) { - $string .= ($value_count > 1) ? " @{$column} = @{$column}_value" : "@{$column}_value"; - } - } - return t('@field is set to "!value"', array('@field' => $instance['label'], '!value' => format_string($string, array_merge($keys, $values)))); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/front.inc b/html/sites/all/modules/contrib/ctools/plugins/access/front.inc deleted file mode 100644 index 8718a143c..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/front.inc +++ /dev/null @@ -1,46 +0,0 @@ - t('Front page'), - 'description' => t('Is this the front page.'), - 'callback' => 'ctools_front_ctools_access_check', - 'default' => array('negate' => 0), - 'settings form' => 'ctools_front_ctools_access_settings', - 'summary' => 'ctools_front_ctools_access_summary', -); - -/** - * Settings form for the 'by parent term' access plugin. - */ -function ctools_front_ctools_access_settings($form, &$form_state, $conf) { - // No additional configuration necessary. - return $form; -} - -/** - * Check for access. - */ -function ctools_front_ctools_access_check($conf, $context) { - if (drupal_is_front_page()) { - return TRUE; - } - else { - return FALSE; - } -} - -/** - * Provide a summary description based upon the checked terms. - */ -function ctools_front_ctools_access_summary($conf, $context) { - return t('The front page'); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/node_access.inc b/html/sites/all/modules/contrib/ctools/plugins/access/node_access.inc deleted file mode 100644 index c153cc5a9..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/node_access.inc +++ /dev/null @@ -1,88 +0,0 @@ - t("Node: accessible"), - 'description' => t('Control access with built in Drupal node access test.'), - 'callback' => 'ctools_node_access_ctools_access_check', - 'default' => array('type' => 'view'), - 'settings form' => 'ctools_node_access_ctools_access_settings', - 'settings form submit' => 'ctools_node_access_ctools_access_settings_submit', - 'summary' => 'ctools_node_access_ctools_access_summary', - 'required context' => array( - new ctools_context_required(t('User'), 'user'), - new ctools_context_required(t('Node'), 'node'), - ), -); - -/** - * Settings form for the 'by node_access' access plugin. - */ -function ctools_node_access_ctools_access_settings($form, &$form_state, $conf) { - $form['settings']['type'] = array( - '#title' => t('Operation'), - '#type' => 'radios', - '#options' => array( - 'view' => t('View'), - 'update' => t('Update'), - 'delete' => t('Delete'), - 'create' => t('Create nodes of the same type'), - ), - '#description' => t('Using built in Drupal node access rules, determine if the user can perform the selected operation on the node.'), - '#default_value' => $conf['type'], - ); - return $form; -} - -/** - * Check for access. - */ -function ctools_node_access_ctools_access_check($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - list($user_context, $node_context) = $context; - if (empty($node_context) || empty($node_context->data) || empty($node_context->data->type)) { - return FALSE; - } - - if (empty($user_context) || empty($user_context->data)) { - return FALSE; - } - - if ($conf['type'] == 'create') { - return node_access('create', $node_context->data->type, $user_context->data); - } - else { - return node_access($conf['type'], $node_context->data, $user_context->data); - } -} - -/** - * Provide a summary description based upon the checked node_accesss. - */ -function ctools_node_access_ctools_access_summary($conf, $context) { - list($user_context, $node_context) = $context; - $replacement = array('@user' => $user_context->identifier, '@node' => $node_context->identifier); - - switch ($conf['type']) { - case 'view': - return t('@user can view @node.', $replacement); - - case 'update': - return t('@user can edit @node.', $replacement); - - case 'delete': - return t('@user can delete @node.', $replacement); - - case 'create': - return t('@user can create nodes of the same type as @node.', $replacement); - } -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/node_comment.inc b/html/sites/all/modules/contrib/ctools/plugins/access/node_comment.inc deleted file mode 100644 index 6cebdaf8e..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/node_comment.inc +++ /dev/null @@ -1,32 +0,0 @@ - t("Node: comments are open"), - 'description' => t('Control access by the nodes comment status.'), - 'callback' => 'ctools_node_comment_ctools_access_check', - 'summary' => 'ctools_node_comment_ctools_access_summary', - 'required context' => new ctools_context_required(t('Node'), 'node'), -); - -/** - * Checks for access. - */ -function ctools_node_comment_ctools_access_check($conf, $context) { - return (!empty($context->data) && $context->data->comment == 2); -} - -/** - * Provides a summary description based upon the checked node_status. - */ -function ctools_node_comment_ctools_access_summary($conf, $context) { - return t('Returns true if the nodes comment status is "open".'); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/node_language.inc b/html/sites/all/modules/contrib/ctools/plugins/access/node_language.inc deleted file mode 100644 index b82433186..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/node_language.inc +++ /dev/null @@ -1,113 +0,0 @@ - t("Node: language"), - 'description' => t('Control access by node language.'), - 'callback' => 'ctools_node_language_ctools_access_check', - 'default' => array('language' => array()), - 'settings form' => 'ctools_node_language_ctools_access_settings', - 'settings form submit' => 'ctools_node_language_ctools_access_settings_submit', - 'summary' => 'ctools_node_language_ctools_access_summary', - 'required context' => new ctools_context_required(t('Node'), 'node'), - ); -} - -/** - * Settings form for the 'by node_language' access plugin. - */ -function ctools_node_language_ctools_access_settings($form, &$form_state, $conf) { - $options = array( - 'current' => t('Current site language'), - 'default' => t('Default site language'), - 'no_language' => t('No language'), - ); - $options = array_merge($options, locale_language_list()); - $form['settings']['language'] = array( - '#title' => t('Language'), - '#type' => 'checkboxes', - '#options' => $options, - '#description' => t('Pass only if the node is in one of the selected languages.'), - '#default_value' => $conf['language'], - ); - return $form; -} - -/** - * Check for access. - */ -function ctools_node_language_ctools_access_check($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data) || !isset($context->data->language)) { - return FALSE; - } - - global $language; - - // Specialcase: if 'no language' is checked, return TRUE if the language field is - // empty. - if (!empty($conf['language']['no_language'])) { - if (empty($context->data->language)) { - return TRUE; - } - } - - // Specialcase: if 'current' is checked, return TRUE if the current site language - // matches the node language. - if (!empty($conf['language']['current'])) { - if ($context->data->language == $language->language) { - return TRUE; - } - } - - // Specialcase: If 'default' is checked, return TRUE if the default site language - // matches the node language. - if (!empty($conf['language']['default'])) { - if ($context->data->language == language_default('language')) { - return TRUE; - } - } - - if (array_filter($conf['language']) && empty($conf['language'][$context->data->language])) { - return FALSE; - } - - return TRUE; -} - -/** - * Provide a summary description based upon the checked node_languages. - */ -function ctools_node_language_ctools_access_summary($conf, $context) { - $languages = array( - 'current' => t('Current site language'), - 'default' => t('Default site language'), - 'no_language' => t('No language'), - ); - $languages = array_merge($languages, locale_language_list()); - - if (!isset($conf['language'])) { - $conf['language'] = array(); - } - - $names = array(); - foreach (array_filter($conf['language']) as $language) { - $names[] = $languages[$language]; - } - - if (empty($names)) { - return t('@identifier is in any language', array('@identifier' => $context->identifier)); - } - - return format_plural(count($names), '@identifier language is "@languages"', '@identifier language is one of "@languages"', array('@languages' => implode(', ', $names), '@identifier' => $context->identifier)); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/node_status.inc b/html/sites/all/modules/contrib/ctools/plugins/access/node_status.inc deleted file mode 100644 index 519619bec..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/node_status.inc +++ /dev/null @@ -1,32 +0,0 @@ - t("Node: (un)published"), - 'description' => t('Control access by the nodes published status.'), - 'callback' => 'ctools_node_status_ctools_access_check', - 'summary' => 'ctools_node_status_ctools_access_summary', - 'required context' => new ctools_context_required(t('Node'), 'node'), -); - -/** - * Check for access. - */ -function ctools_node_status_ctools_access_check($conf, $context) { - return (!empty($context->data->status) && $context->data->status); -} - -/** - * Provide a summary description based upon the checked node_statuss. - */ -function ctools_node_status_ctools_access_summary($conf, $context) { - return t('Returns true if the nodes status is "published".'); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/node_type.inc b/html/sites/all/modules/contrib/ctools/plugins/access/node_type.inc deleted file mode 100644 index d89532aea..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/node_type.inc +++ /dev/null @@ -1,116 +0,0 @@ - t("Node: type"), - 'description' => t('Control access by node_type.'), - 'callback' => 'ctools_node_type_ctools_access_check', - 'default' => array('type' => array()), - 'settings form' => 'ctools_node_type_ctools_access_settings', - 'settings form submit' => 'ctools_node_type_ctools_access_settings_submit', - 'summary' => 'ctools_node_type_ctools_access_summary', - 'required context' => new ctools_context_required(t('Node'), 'node'), - 'restrictions' => 'ctools_node_type_ctools_access_restrictions', -); - -/** - * Settings form for the 'by node_type' access plugin. - */ -function ctools_node_type_ctools_access_settings($form, &$form_state, $conf) { - $types = node_type_get_types(); - foreach ($types as $type => $info) { - $options[$type] = check_plain($info->name); - } - - $form['settings']['type'] = array( - '#title' => t('Node type'), - '#type' => 'checkboxes', - '#options' => $options, - '#description' => t('Only the checked node types will be valid.'), - '#default_value' => $conf['type'], - ); - return $form; -} - -/** - * Compress the node_types allowed to the minimum. - */ -function ctools_node_type_ctools_access_settings_submit($form, &$form_state) { - $form_state['values']['settings']['type'] = array_filter($form_state['values']['settings']['type']); -} - -/** - * Check for access. - */ -function ctools_node_type_ctools_access_check($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data) || empty($context->data->type)) { - return FALSE; - } - - if (array_filter($conf['type']) && empty($conf['type'][$context->data->type])) { - return FALSE; - } - - return TRUE; -} - -/** - * Inform the UI that we've eliminated a bunch of possibilities for this - * context. - */ -function ctools_node_type_ctools_access_restrictions($conf, &$context) { - if (isset($context->restrictions['type'])) { - $context->restrictions['type'] = array_unique(array_merge($context->restrictions['type'], array_keys(array_filter($conf['type'])))); - } - else { - $context->restrictions['type'] = array_keys(array_filter($conf['type'])); - } -} - -/** - * Provide a summary description based upon the checked node_types. - */ -function ctools_node_type_ctools_access_summary($conf, $context) { - if (!isset($conf['type'])) { - $conf['type'] = array(); - } - $types = node_type_get_types(); - - $names = array(); - // If a node type doesn't exist, let the user know, but prevent a notice. - $missing_types = array(); - - foreach (array_filter($conf['type']) as $type) { - if (!empty($types[$type])) { - $names[] = check_plain($types[$type]->name); - } - else { - $missing_types[] = check_plain($type); - } - } - - if (empty($names) && empty($missing_types)) { - return t('@identifier is any node type', array('@identifier' => $context->identifier)); - } - - if (!empty($missing_types)) { - $output = array(); - if (!empty($names)) { - $output[] = format_plural(count($names), '@identifier is type "@types"', '@identifier type is one of "@types"', array('@types' => implode(', ', $names), '@identifier' => $context->identifier)); - } - $output[] = format_plural(count($missing_types), 'Missing/ deleted type "@types"', 'Missing/ deleted type is one of "@types"', array('@types' => implode(', ', $missing_types))); - return implode(' | ', $output); - } - - return format_plural(count($names), '@identifier is type "@types"', '@identifier type is one of "@types"', array('@types' => implode(', ', $names), '@identifier' => $context->identifier)); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/path_visibility.inc b/html/sites/all/modules/contrib/ctools/plugins/access/path_visibility.inc deleted file mode 100644 index 1612e1c3e..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/path_visibility.inc +++ /dev/null @@ -1,88 +0,0 @@ - t('String: URL path'), - 'description' => t('Control access by the current path.'), - 'callback' => 'ctools_path_visibility_ctools_access_check', - 'settings form' => 'ctools_path_visibility_ctools_access_settings', - 'summary' => 'ctools_path_visibility_ctools_access_summary', - 'required context' => new ctools_context_optional(t('Path'), 'string'), - 'default' => array('visibility_setting' => 1, 'paths' => ''), -); - -/** - * Settings form. - */ -function ctools_path_visibility_ctools_access_settings($form, &$form_state, $conf) { - $form['settings']['note'] = array( - '#value' => '
    ' . t('Note: if no context is chosen, the current page path will be used.') . '
    ', - ); - - $form['settings']['visibility_setting'] = array( - '#type' => 'radios', - '#options' => array( - 1 => t('Allow access on the following pages'), - 0 => t('Allow access on all pages except the following pages'), - ), - '#default_value' => $conf['visibility_setting'], - ); - - $form['settings']['paths'] = array( - '#type' => 'textarea', - '#title' => t('Paths'), - '#default_value' => $conf['paths'], - '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '')), - ); - return $form; -} - -/** - * Check for access. - */ -function ctools_path_visibility_ctools_access_check($conf, $context) { - if (isset($context->data)) { - $base_path = $context->data; - } - else { - $base_path = $_GET['q']; - } - - $path = drupal_get_path_alias($base_path); - $page_match = drupal_match_path($path, $conf['paths']); - - // If there's a path alias, we may still be at the un-aliased path - // so check that as well. - if (!isset($context->data) && $path != $base_path) { - $page_match = $page_match || drupal_match_path($base_path, $conf['paths']); - } - - // When $conf['visibility_setting'] has a value of 0, the block is displayed - // on all pages except those listed in $block->pages. When set to 1, it - // is displayed only on those pages listed in $block->pages. - $page_match = !($conf['visibility_setting'] xor $page_match); - - return $page_match; -} - -/** - * Provide a summary description. - */ -function ctools_path_visibility_ctools_access_summary($conf, $context) { - $paths = array(); - foreach (explode("\n", $conf['paths']) as $path) { - $paths[] = check_plain($path); - } - - $identifier = $context->type == 'any' ? t('Current path') : $context->identifier; - if ($conf['visibility_setting']) { - return format_plural(count($paths), '@identifier is "@paths"', '@identifier type is one of "@paths"', array('@paths' => implode(', ', $paths), '@identifier' => $identifier)); - } - else { - return format_plural(count($paths), '@identifier is not "@paths"', '@identifier type is not one of "@paths"', array('@paths' => implode(', ', $paths), '@identifier' => $identifier)); - } -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/perm.inc b/html/sites/all/modules/contrib/ctools/plugins/access/perm.inc deleted file mode 100644 index cb2bb81e9..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/perm.inc +++ /dev/null @@ -1,72 +0,0 @@ - t("User: permission"), - 'description' => t('Control access by permission string.'), - 'callback' => 'ctools_perm_ctools_access_check', - 'default' => array('perm' => 'access content'), - 'settings form' => 'ctools_perm_ctools_access_settings', - 'summary' => 'ctools_perm_ctools_access_summary', - 'required context' => new ctools_context_required(t('User'), 'user'), -); - -/** - * Settings form for the 'by perm' access plugin. - */ -function ctools_perm_ctools_access_settings($form, &$form_state, $conf) { - $perms = array(); - // Get list of permissions. - foreach (module_list(FALSE, FALSE, TRUE) as $module) { - // By keeping them keyed by module we can use optgroups with the - // 'select' type. - if ($permissions = module_invoke($module, 'permission')) { - foreach ($permissions as $id => $permission) { - $perms[$module][$id] = $permission['title']; - } - } - } - - $form['settings']['perm'] = array( - '#type' => 'select', - '#options' => $perms, - '#title' => t('Permission'), - '#default_value' => $conf['perm'], - '#description' => t('Only users with the selected permission flag will be able to access this.'), - ); - - return $form; -} - -/** - * Check for access. - */ -function ctools_perm_ctools_access_check($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data)) { - return FALSE; - } - - return user_access($conf['perm'], $context->data); -} - -/** - * Provide a summary description based upon the checked roles. - */ -function ctools_perm_ctools_access_summary($conf, $context) { - if (!isset($conf['perm'])) { - return t('Error, unset permission'); - } - - $permissions = module_invoke_all('permission'); - return t('@identifier has "@perm"', array('@identifier' => $context->identifier, '@perm' => $permissions[$conf['perm']]['title'])); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/php.inc b/html/sites/all/modules/contrib/ctools/plugins/access/php.inc deleted file mode 100644 index 4e9d05656..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/php.inc +++ /dev/null @@ -1,64 +0,0 @@ - t("PHP Code"), - 'description' => t('Control access through arbitrary PHP code.'), - 'callback' => 'ctools_php_ctools_access_check', - 'default' => array('description' => '', 'php' => ''), - 'settings form' => 'ctools_php_ctools_access_settings', - 'summary' => 'ctools_php_ctools_access_summary', - 'all contexts' => TRUE, -); - -/** - * Settings form for the 'by perm' access plugin. - * - * @todo Need a way to provide a list of all available contexts to be used by - * the eval-ed PHP. - */ -function ctools_php_ctools_access_settings($form, &$form_state, $conf) { - $perms = array(); - - $form['settings']['description'] = array( - '#type' => 'textfield', - '#title' => t('Administrative desc'), - '#default_value' => $conf['description'], - '#description' => t('A description for this test for administrative purposes.'), - ); - $form['settings']['php'] = array( - '#type' => 'textarea', - '#title' => t('PHP Code'), - '#default_value' => $conf['php'], - '#description' => t('Access will be granted if the following PHP code returns TRUE. Do not include <?php ?>. Note that executing incorrect PHP-code can break your Drupal site. All contexts will be available in the $contexts variable.'), - ); - if (!user_access('use PHP for settings')) { - $form['settings']['php']['#disabled'] = TRUE; - $form['settings']['php']['#value'] = $conf['php']; - $form['settings']['php']['#description'] .= ' ' . t('You do not have sufficient permissions to edit PHP code.'); - } - return $form; -} - -/** - * Check for access. - */ -function ctools_php_ctools_access_check($__conf, $contexts) { - $access = eval($__conf['php']); - return $access; -} - -/** - * Provide a summary description based upon the checked roles. - */ -function ctools_php_ctools_access_summary($conf, $contexts) { - return !empty($conf['description']) ? check_plain($conf['description']) : t('No description'); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/query_string_exists.inc b/html/sites/all/modules/contrib/ctools/plugins/access/query_string_exists.inc deleted file mode 100644 index fb3b4334c..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/query_string_exists.inc +++ /dev/null @@ -1,44 +0,0 @@ - t('Query string exists'), - 'description' => t('Control access by whether or not a query string exists.'), - 'callback' => 'ctools_query_string_exists_ctools_access_check', - 'settings form' => 'ctools_query_string_exists_ctools_access_settings', - 'summary' => 'ctools_query_string_exists_ctools_access_summary', - 'defaults' => array('key' => ''), -); - -/** - * Settings form. - */ -function ctools_query_string_exists_ctools_access_settings($form, &$form_state, $config) { - $form['settings']['key'] = array( - '#title' => t('Query string key'), - '#description' => t('Enter the key of the query string.'), - '#type' => 'textfield', - '#required' => TRUE, - '#default_value' => $config['key'], - ); - - return $form; -} - -/** - * Check for access. - */ -function ctools_query_string_exists_ctools_access_check($config, $context) { - return isset($_GET[$config['key']]); -} - -/** - * Provide a summary description. - */ -function ctools_query_string_exists_ctools_access_summary($config, $context) { - return t('@identifier exists', array('@identifier' => $config['key'])); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/role.inc b/html/sites/all/modules/contrib/ctools/plugins/access/role.inc deleted file mode 100644 index 4d8cbae12..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/role.inc +++ /dev/null @@ -1,78 +0,0 @@ - t("User: role"), - 'description' => t('Control access by role.'), - 'callback' => 'ctools_role_ctools_access_check', - 'default' => array('rids' => array()), - 'settings form' => 'ctools_role_ctools_access_settings', - 'settings form submit' => 'ctools_role_ctools_access_settings_submit', - 'summary' => 'ctools_role_ctools_access_summary', - 'required context' => new ctools_context_required(t('User'), 'user'), -); - -/** - * Settings form for the 'by role' access plugin. - */ -function ctools_role_ctools_access_settings($form, &$form_state, $conf) { - $form['settings']['rids'] = array( - '#type' => 'checkboxes', - '#title' => t('Role'), - '#default_value' => $conf['rids'], - '#options' => ctools_get_roles(), - '#description' => t('Only the checked roles will be granted access.'), - ); - return $form; -} - -/** - * Compress the roles allowed to the minimum. - */ -function ctools_role_ctools_access_settings_submit($form, &$form_state) { - $form_state['values']['settings']['rids'] = array_keys(array_filter($form_state['values']['settings']['rids'])); -} - -/** - * Check for access. - */ -function ctools_role_ctools_access_check($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data) || !isset($context->data->roles)) { - return FALSE; - } - - $roles = array_keys($context->data->roles); - $roles[] = $context->data->uid ? DRUPAL_AUTHENTICATED_RID : DRUPAL_ANONYMOUS_RID; - return (bool) array_intersect($conf['rids'], $roles); -} - -/** - * Provide a summary description based upon the checked roles. - */ -function ctools_role_ctools_access_summary($conf, $context) { - if (!isset($conf['rids'])) { - $conf['rids'] = array(); - } - $roles = ctools_get_roles(); - - $names = array(); - foreach (array_filter($conf['rids']) as $rid) { - $names[] = check_plain($roles[$rid]); - } - - if (empty($names)) { - return t('@identifier can have any role', array('@identifier' => $context->identifier)); - } - - return format_plural(count($names), '@identifier has role "@roles"', '@identifier has one of "@roles"', array('@roles' => implode(', ', $names), '@identifier' => $context->identifier)); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/site_language.inc b/html/sites/all/modules/contrib/ctools/plugins/access/site_language.inc deleted file mode 100644 index 5b7b724ca..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/site_language.inc +++ /dev/null @@ -1,86 +0,0 @@ - t("User: language"), - 'description' => t('Control access by the language the user or site currently uses.'), - 'callback' => 'ctools_site_language_ctools_access_check', - 'default' => array('language' => array()), - 'settings form' => 'ctools_site_language_ctools_access_settings', - 'settings form submit' => 'ctools_site_language_ctools_access_settings_submit', - 'summary' => 'ctools_site_language_ctools_access_summary', - ); -} - -/** - * Settings form for the 'by site_language' access plugin. - */ -function ctools_site_language_ctools_access_settings($form, &$form_state, $conf) { - $options = array( - 'default' => t('Default site language'), - ); - $options = array_merge($options, locale_language_list()); - $form['settings']['language'] = array( - '#title' => t('Language'), - '#type' => 'checkboxes', - '#options' => $options, - '#description' => t('Pass only if the current site language is one of the selected languages.'), - '#default_value' => $conf['language'], - ); - return $form; -} - -/** - * Check for access. - */ -function ctools_site_language_ctools_access_check($conf, $context) { - global $language; - - // Specialcase: If 'default' is checked, return TRUE if the default site language - // matches the node language. - if (!empty($conf['language']['default'])) { - if ($language->language == language_default('language')) { - return TRUE; - } - } - - if (array_filter($conf['language']) && empty($conf['language'][$language->language])) { - return FALSE; - } - - return TRUE; -} - -/** - * Provide a summary description based upon the checked site_languages. - */ -function ctools_site_language_ctools_access_summary($conf, $context) { - $languages = array( - 'default' => t('Default site language'), - ); - $languages = array_merge($languages, locale_language_list()); - - if (!isset($conf['language'])) { - $conf['language'] = array(); - } - - $names = array(); - foreach (array_filter($conf['language']) as $language) { - $names[] = $languages[$language]; - } - - if (empty($names)) { - return t('Site language is any language'); - } - - return format_plural(count($names), 'Site language is "@languages"', 'Site language is one of "@languages"', array('@languages' => implode(', ', $names))); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/string_equal.inc b/html/sites/all/modules/contrib/ctools/plugins/access/string_equal.inc deleted file mode 100644 index feb48e9c3..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/string_equal.inc +++ /dev/null @@ -1,99 +0,0 @@ - t("String: comparison"), - 'description' => t('Control access by string match.'), - 'callback' => 'ctools_string_equal_ctools_access_check', - 'settings form' => 'ctools_string_equal_ctools_access_settings', - 'summary' => 'ctools_string_equal_ctools_access_summary', - 'required context' => new ctools_context_required(t('String'), 'string'), - 'defaults' => array('operator' => '=', 'value' => '', 'case' => FALSE), -); - -/** - * Settings form. - */ -function ctools_string_equal_ctools_access_settings($form, &$form_state, $conf) { - $form['settings']['operator'] = array( - '#type' => 'radios', - '#title' => t('Operator'), - '#options' => array( - '=' => t('Equal'), - '!=' => t('Not equal'), - 'regex' => t('Regular expression'), - '!regex' => t('Not equal to regular expression'), - ), - '#default_value' => $conf['operator'], - '#description' => t('If using a regular expression, you should enclose the pattern in slashes like so: /foo/. If you need to compare against slashes you can use another character to enclose the pattern, such as @. See PHP regex documentation for more.'), - ); - - $form['settings']['value'] = array( - '#type' => 'textfield', - '#title' => t('String'), - '#default_value' => $conf['value'], - ); - - $form['settings']['case'] = array( - '#type' => 'checkbox', - '#title' => t('Case sensitive'), - '#default_value' => $conf['case'], - ); - return $form; -} - -/** - * Check for access. - */ -function ctools_string_equal_ctools_access_check($conf, $context) { - if (empty($context) || empty($context->data)) { - $string = ''; - } - else { - $string = $context->data; - } - - $value = $conf['value']; - if (empty($conf['case'])) { - $string = drupal_strtolower($string); - $value = drupal_strtolower($value); - } - - switch ($conf['operator']) { - case '=': - return $string === $value; - - case '!=': - return $string !== $value; - - case 'regex': - return preg_match($value, $string); - - case '!regex': - return !preg_match($value, $string); - } -} - -/** - * Provide a summary description based upon the specified context. - */ -function ctools_string_equal_ctools_access_summary($conf, $context) { - $values = array('@identifier' => $context->identifier, '@value' => $conf['value']); - switch ($conf['operator']) { - case '=': - return t('@identifier is "@value"', $values); - - case '!=': - return t('@identifier is not "@value"', $values); - - case 'regex': - return t('@identifier matches "@value"', $values); - - case '!regex': - return t('@identifier does not match "@value"', $values); - } -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/string_length.inc b/html/sites/all/modules/contrib/ctools/plugins/access/string_length.inc deleted file mode 100644 index 3af504b9e..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/string_length.inc +++ /dev/null @@ -1,85 +0,0 @@ - t("String: length"), - 'description' => t('Control access by length of string context.'), - 'callback' => 'ctools_string_length_ctools_access_check', - 'settings form' => 'ctools_string_length_ctools_access_settings', - 'summary' => 'ctools_string_length_ctools_access_summary', - 'required context' => new ctools_context_required(t('String'), 'string'), - 'defaults' => array('operator' => '=', 'length' => 0), -); - -/** - * Settings form for the 'by role' access plugin. - */ -function ctools_string_length_ctools_access_settings($form, &$form_state, $conf) { - $form['settings']['operator'] = array( - '#type' => 'radios', - '#title' => t('Operator'), - '#options' => array( - '>' => t('Greater than'), - '>=' => t('Greater than or equal to'), - '=' => t('Equal to'), - '!=' => t('Not equal to'), - '<' => t('Less than'), - '<=' => t('Less than or equal to'), - ), - '#default_value' => $conf['operator'], - ); - $form['settings']['length'] = array( - '#type' => 'textfield', - '#title' => t('Length of string'), - '#size' => 3, - '#default_value' => $conf['length'], - '#description' => t('Access/visibility will be granted based on string context length.'), - ); - return $form; -} - -/** - * Check for access. - */ -function ctools_string_length_ctools_access_check($conf, $context) { - if (empty($context) || empty($context->data)) { - $length = 0; - } - else { - $length = drupal_strlen($context->data); - } - - switch ($conf['operator']) { - case '<': - return $length < $conf['length']; - - case '<=': - return $length <= $conf['length']; - - case '=': - return $length == $conf['length']; - - case '!=': - return $length != $conf['length']; - - case '>': - return $length > $conf['length']; - - case '>=': - return $length >= $conf['length']; - } - // Invalid Operator sent, return FALSE. - return FALSE; -} - -/** - * Provide a summary description based upon the checked roles. - */ -function ctools_string_length_ctools_access_summary($conf, $context) { - return t('@identifier must be @comp @length characters', array('@identifier' => $context->identifier, '@comp' => $conf['operator'], '@length' => $conf['length'])); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/term.inc b/html/sites/all/modules/contrib/ctools/plugins/access/term.inc deleted file mode 100644 index 224a00c6f..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/term.inc +++ /dev/null @@ -1,130 +0,0 @@ - t("Taxonomy: term"), - 'description' => t('Control access by a specific term.'), - 'callback' => 'ctools_term_ctools_access_check', - 'default' => array('vids' => array()), - 'settings form' => 'ctools_term_ctools_access_settings', - 'settings form validate' => 'ctools_term_ctools_access_settings_validate', - 'settings form submit' => 'ctools_term_ctools_access_settings_submit', - 'summary' => 'ctools_term_ctools_access_summary', - 'required context' => new ctools_context_required(t('Term'), array('taxonomy_term', 'terms')), -); - -/** - * Settings form for the 'by term' access plugin. - */ -function ctools_term_ctools_access_settings($form, &$form_state, $conf) { - // If no configuration was saved before, set some defaults. - if (empty($conf)) { - $conf = array( - 'vid' => 0, - ); - } - if (!isset($conf['vid'])) { - $conf['vid'] = 0; - } - - $form['settings']['vid'] = array( - '#title' => t('Vocabulary'), - '#type' => 'select', - '#options' => array(), - '#description' => t('Select the vocabulary for this form.'), - '#id' => 'ctools-select-vid', - '#default_value' => $conf['vid'], - '#required' => TRUE, - ); - - ctools_include('dependent'); - $options = array(); - - // A note: Dependency works strangely on these forms as they have never been - // updated to a more modern system so they are not individual forms of their - // own like the content types. - $form['settings']['#tree'] = TRUE; - - // Loop over each of the configured vocabularies. - foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) { - $options[$vid] = $vocabulary->name; - $form['settings'][$vocabulary->vid] = array( - '#title' => t('Terms'), - '#description' => t('Select a term or terms from @vocabulary.', array('@vocabulary' => $vocabulary->name)), //. $description, - '#dependency' => array('ctools-select-vid' => array($vocabulary->vid)), - '#default_value' => !empty($conf[$vid]) ? $conf[$vid] : '', - '#multiple' => TRUE, - ); - - $terms = array(); - foreach (taxonomy_get_tree($vocabulary->vid) as $tid => $term) { - $terms[$term->tid] = str_repeat('-', $term->depth) . ($term->depth ? ' ' : '') . $term->name; - } - $form['settings'][$vocabulary->vid]['#type'] = 'select'; - $form['settings'][$vocabulary->vid]['#options'] = $terms; - unset($terms); - } - $form['settings']['vid']['#options'] = $options; - return $form; -} - -/** - * Check for access. - */ -function ctools_term_ctools_access_check($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data) || empty($context->data->vid) || empty($context->data->tid)) { - return FALSE; - } - - // Get the $vid. - if (!isset($conf['vid'])) { - return FALSE; - } - $vid = $conf['vid']; - - // Get the terms. - if (!isset($conf[$vid])) { - return FALSE; - } - - $return = FALSE; - - $terms = array_filter($conf[$vid]); - // For multi-term if any terms coincide, let's call that good enough: - if (isset($context->tids)) { - return (bool) array_intersect($terms, $context->tids); - } - else { - return in_array($context->data->tid, $terms); - } -} - -/** - * Provide a summary description based upon the checked terms. - */ -function ctools_term_ctools_access_summary($conf, $context) { - $vid = $conf['vid']; - $terms = array(); - foreach ($conf[$vid] as $tid) { - $term = taxonomy_term_load($tid); - $terms[] = $term->name; - } - - return format_plural(count($terms), - '@term can be the term "@terms"', - '@term can be one of these terms: @terms', - array( - '@terms' => implode(', ', $terms), - '@term' => $context->identifier, - )); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/term_has_parent.inc b/html/sites/all/modules/contrib/ctools/plugins/access/term_has_parent.inc deleted file mode 100644 index fd9351d9c..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/term_has_parent.inc +++ /dev/null @@ -1,172 +0,0 @@ - t("Taxonomy: term has parent(s)"), - 'description' => t('Control access if a term belongs to a specific parent term.'), - 'callback' => 'ctools_term_has_parent_ctools_access_check', - 'default' => array('vid' => array(), 'negate' => 0), - 'settings form' => 'ctools_term_has_parent_ctools_access_settings', - 'settings form submit' => 'ctools_term_has_parent_ctools_access_settings_submit', - 'summary' => 'ctools_term_has_parent_ctools_access_summary', - 'required context' => new ctools_context_required(t('Term'), array('taxonomy_term', 'terms')), -); - -/** - * Settings form for the 'by parent term' access plugin. - */ -function ctools_term_has_parent_ctools_access_settings($form, &$form_state, $conf) { - // If no configuration was saved before, set some defaults. - if (empty($conf)) { - $conf = array( - 'vid' => 0, - ); - } - if (!isset($conf['vid'])) { - $conf['vid'] = 0; - } - - $form['settings']['vid'] = array( - '#title' => t('Vocabulary'), - '#type' => 'select', - '#options' => array(), - '#description' => t('Select the vocabulary your parent term belongs to.'), - '#id' => 'ctools-select-vid', - '#default_value' => $conf['vid'], - '#required' => TRUE, - ); - - ctools_include('dependent'); - $options = array(); - - // A note: Dependency works strangely on these forms as they have never been - // updated to a more modern system so they are not individual forms of their - // own like the content types. - $form['settings']['#tree'] = TRUE; - - // Loop over each of the configured vocabularies. - foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) { - $options[$vid] = $vocabulary->name; - $form['settings']['vid_' . $vid] = array( - '#title' => t('Terms'), - '#description' => t('Select a parent term (or terms) from the @vocabulary vocabulary.', array('@vocabulary' => $vocabulary->name)), - '#dependency' => array('ctools-select-vid' => array($vocabulary->vid)), - '#default_value' => !empty($conf['vid_' . $vid]) ? $conf['vid_' . $vid] : '', - '#size' => 10, - '#multiple' => TRUE, - // @todo: Remove the following workaround when the following patch is in core. {@see:http://drupal.org/node/1117526} - '#name' => sprintf("settings[%u][]", $vid), - '#attributes' => array('multiple' => 'multiple'), - ); - - $terms = array(); - foreach (taxonomy_get_tree($vocabulary->vid) as $term) { - $terms[$term->tid] = str_repeat('-', $term->depth) . ($term->depth ? ' ' : '') . $term->name; - } - $form['settings']['vid_' . $vid]['#type'] = 'checkboxes'; - $form['settings']['vid_' . $vid]['#options'] = $terms; - unset($terms); - } - $form['settings']['vid']['#options'] = $options; - $form['settings']['include_self'] = array( - '#title' => t('Include these parent term(s)?'), - '#description' => t('Should the term(s) you selected above be included in addition to their children?'), - '#default_value' => !empty($conf['include_self']) ? $conf['include_self'] : FALSE, - '#type' => 'checkbox', - ); - return $form; -} - -/** - * Filters values to store less. - */ -function ctools_term_has_parent_ctools_access_settings_submit($form, &$form_state) { - foreach ($form_state['values']['settings'] as $key => $value) { - if (strpos($key, 'vid_') === 0) { - $form_state['values']['settings'][$key] = array_filter($form_state['values']['settings'][$key]); - } - } -} - -/** - * Check for access. - */ -function ctools_term_has_parent_ctools_access_check($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data) || empty($context->data->vid) || empty($context->data->tid)) { - return FALSE; - } - - // Get the $vid. - if (!isset($conf['vid'])) { - return FALSE; - } - $vid = $conf['vid']; - - // we'll start looking up the hierarchy from our context term id. - $current_term = $context->data->tid; - - $term = ''; - - // Scan up the tree. - while (TRUE) { - // Select parent as term_parent to avoid PHP5 complications with the parent keyword. - // @todo: Find a way to reduce the number of queries required for really deep hierarchies. - $term = db_query("SELECT parent AS term_parent, tid AS tid FROM {taxonomy_term_hierarchy} th WHERE th.tid = :tid", array(':tid' => $current_term))->fetchObject(); - - // If no term is found, get out of the loop. - if (!$term || empty($term->tid)) { - break; - } - - // Check the term selected, if the user asked it to. - if (!empty($conf['include_self']) && isset($conf['vid_' . $vid][$term->tid])) { - return TRUE; - } - - // Did we find the parent TID we were looking for? - if (isset($conf['vid_' . $vid][$term->tid])) { - // YES, we're done! - return TRUE; - } - // Nope, we didn't find it. - // If this is the top of the hierarchy, stop scanning. - if ($term->term_parent == 0) { - break; - } - - // Update the parent, and keep scanning. - $current_term = $term->term_parent; - } - - return FALSE; -} - -/** - * Provide a summary description based upon the checked terms. - */ -function ctools_term_has_parent_ctools_access_summary($conf, $context) { - $vid = (int) $conf['vid']; - $terms = array(); - foreach ($conf['vid_' . $vid] as $tid) { - $term = taxonomy_term_load($tid); - $terms[] = $term->name; - } - - return format_plural(count($terms), - '@term can have the parent "@terms"', - '@term can have one of these parents: @terms', - array( - '@terms' => implode(', ', $terms), - '@term' => $context->identifier, - )); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/term_parent.inc b/html/sites/all/modules/contrib/ctools/plugins/access/term_parent.inc deleted file mode 100644 index 0fddc020d..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/term_parent.inc +++ /dev/null @@ -1,86 +0,0 @@ - t("Taxonomy: parent term"), - 'description' => t('Control access by existence of a parent term.'), - 'callback' => 'ctools_term_parent_ctools_access_check', - 'default' => array('vid' => array(), 'negate' => 0), - 'settings form' => 'ctools_term_parent_ctools_access_settings', - 'settings form validate' => 'ctools_term_parent_ctools_access_settings_validate', - 'settings form submit' => 'ctools_term_parent_ctools_access_settings_submit', - 'summary' => 'ctools_term_parent_ctools_access_summary', - 'required context' => new ctools_context_required(t('Term'), array('taxonomy_term', 'terms')), -); - -/** - * Settings form for the 'by parent term' access plugin. - */ -function ctools_term_parent_ctools_access_settings($form, &$form_state, $conf) { - // If no configuration was saved before, set some defaults. - if (empty($conf)) { - $conf = array( - 'vid' => 0, - ); - } - if (!isset($conf['vid'])) { - $conf['vid'] = 0; - } - - $form['settings']['vid'] = array( - '#title' => t('Vocabulary'), - '#type' => 'select', - '#options' => array(), - '#description' => t('Select the vocabulary for this form. If there exists a parent term in that vocabulary, this access check will succeed.'), - '#id' => 'ctools-select-vid', - '#default_value' => $conf['vid'], - '#required' => TRUE, - ); - - $options = array(); - - // Loop over each of the configured vocabularies. - foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) { - $options[$vid] = $vocabulary->name; - } - $form['settings']['vid']['#options'] = $options; - return $form; -} - -/** - * Check for access. - */ -function ctools_term_parent_ctools_access_check($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data) || empty($context->data->vid) || empty($context->data->tid)) { - return FALSE; - } - - // Get the $vid. - if (!isset($conf['vid'])) { - return FALSE; - } - $vid = $conf['vid']; - - $count = db_query('SELECT COUNT(*) FROM {taxonomy_term_hierarchy} th INNER JOIN {taxonomy_term_data} td ON th.parent = td.tid WHERE th.tid = :tid AND td.vid = :vid', array(':tid' => $context->data->tid, ':vid' => $vid))->fetchField(); - - return $count ? TRUE : FALSE; -} - -/** - * Provide a summary description based upon the checked terms. - */ -function ctools_term_parent_ctools_access_summary($conf, $context) { - $vocab = taxonomy_vocabulary_load($conf['vid']); - - return t('"@term" has parent in vocabulary "@vocab"', array('@term' => $context->identifier, '@vocab' => $vocab->name)); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/term_vocabulary.inc b/html/sites/all/modules/contrib/ctools/plugins/access/term_vocabulary.inc deleted file mode 100644 index 8e9a0cafb..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/term_vocabulary.inc +++ /dev/null @@ -1,125 +0,0 @@ - t("Taxonomy: vocabulary"), - 'description' => t('Control access by vocabulary.'), - 'callback' => 'ctools_term_vocabulary_ctools_access_check', - 'default' => array('vids' => array()), - 'settings form' => 'ctools_term_vocabulary_ctools_access_settings', - 'settings form submit' => 'ctools_term_vocabulary_ctools_access_settings_submit', - 'summary' => 'ctools_term_vocabulary_ctools_access_summary', - 'required context' => new ctools_context_required(t('Vocabulary'), array( - 'taxonomy_term', - 'terms', - 'taxonomy_vocabulary', - )), -); - -/** - * Settings form for the 'by term_vocabulary' access plugin. - */ -function ctools_term_vocabulary_ctools_access_settings($form, &$form_state, $conf) { - $options = array(); - $vocabularies = taxonomy_get_vocabularies(); - foreach ($vocabularies as $voc) { - $options[$voc->machine_name] = check_plain($voc->name); - } - - _ctools_term_vocabulary_ctools_access_map_vids($conf); - - $form['settings']['machine_name'] = array( - '#type' => 'checkboxes', - '#title' => t('Vocabularies'), - '#options' => $options, - '#description' => t('Only the checked vocabularies will be valid.'), - '#default_value' => $conf['machine_name'], - ); - return $form; -} - -/** - * Compress the term_vocabularys allowed to the minimum. - */ -function ctools_term_vocabulary_ctools_access_settings_submit($form, &$form_state) { - $form_state['values']['settings']['machine_name'] = array_filter($form_state['values']['settings']['machine_name']); -} - -/** - * Check for access. - */ -function ctools_term_vocabulary_ctools_access_check($conf, $context) { - // As far as I know there should always be a context at this point, but this - // is safe. - if (empty($context) || empty($context->data) || empty($context->data->vocabulary_machine_name)) { - return FALSE; - } - - _ctools_term_vocabulary_ctools_access_map_vids($conf); - - if (array_filter($conf['machine_name']) && empty($conf['machine_name'][$context->data->vocabulary_machine_name])) { - return FALSE; - } - - return TRUE; -} - -/** - * Provide a summary description based upon the checked term_vocabularys. - */ -function ctools_term_vocabulary_ctools_access_summary($conf, $context) { - if (!isset($conf['type'])) { - $conf['type'] = array(); - } - $vocabularies = taxonomy_get_vocabularies(); - - _ctools_term_vocabulary_ctools_access_map_vids($conf); - - $names = array(); - if (!empty($conf['machine_name'])) { - foreach (array_filter($conf['machine_name']) as $machine_name) { - foreach ($vocabularies as $vocabulary) { - if ($vocabulary->machine_name === $machine_name) { - $names[] = check_plain($vocabulary->name); - continue; - } - } - } - } - - if (empty($names)) { - return t('@identifier is any vocabulary', array('@identifier' => $context->identifier)); - } - - return format_plural(count($names), '@identifier vocabulary is "@machine_names"', '@identifier vocabulary is one of "@machine_names"', array( - '@machine_names' => implode(', ', $names), - '@identifier' => $context->identifier, - )); -} - -/** - * Helper function to map the vids from old features to the new machine_name. - * - * Add the machine_name key to $conf if the vids key exist. - * - * @param array $conf - * The configuration of this plugin. - */ -function _ctools_term_vocabulary_ctools_access_map_vids(&$conf) { - if (!empty($conf['vids'])) { - $conf['machine_name'] = array(); - $vocabularies = taxonomy_get_vocabularies(); - foreach ($conf['vids'] as $vid) { - $machine_name = $vocabularies[$vid]->machine_name; - $conf['machine_name'][$machine_name] = $vocabularies[$vid]->machine_name; - } - } -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/access/theme.inc b/html/sites/all/modules/contrib/ctools/plugins/access/theme.inc deleted file mode 100644 index 67e3e6f07..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/access/theme.inc +++ /dev/null @@ -1,70 +0,0 @@ - t("Current theme"), - 'description' => t('Control access by checking which theme is in use.'), - 'callback' => 'ctools_theme_ctools_access_check', - 'default' => array('theme' => variable_get('theme_default', 'garland')), - 'settings form' => 'ctools_theme_ctools_access_settings', - 'summary' => 'ctools_theme_ctools_access_summary', -); - -/** - * Settings form for the 'by theme' access plugin. - */ -function ctools_theme_ctools_access_settings($form, &$form_state, $conf) { - $themes = array(); - foreach (list_themes() as $key => $theme) { - $themes[$key] = $theme->info['name']; - } - - $form['settings']['theme'] = array( - '#type' => 'select', - '#options' => $themes, - '#title' => t('Themes'), - '#default_value' => $conf['theme'], - '#description' => t('This will only be accessed if the current theme is the selected theme.'), - ); - return $form; -} - -/** - * Check for access. - */ -function ctools_theme_ctools_access_check($conf, $context) { - if (!empty($GLOBALS['theme'])) { - $theme = $GLOBALS['theme']; - } - elseif (!empty($GLOBALS['custom_theme'])) { - $theme = $GLOBALS['custom_theme']; - } - elseif (!empty($GLOBALS['user']->theme)) { - $theme = $GLOBALS['user']->theme; - } - else { - $theme = variable_get('theme_default', 'garland'); - } - - return $conf['theme'] == $theme; -} - -/** - * Provide a summary description based upon the checked roles. - */ -function ctools_theme_ctools_access_summary($conf, $context) { - if (!isset($conf['theme'])) { - return t('Error, unset theme'); - } - $themes = list_themes(); - - return t('Current theme is "@theme"', array('@theme' => $themes[$conf['theme']]->info['name'])); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/arguments/entity_id.inc b/html/sites/all/modules/contrib/ctools/plugins/arguments/entity_id.inc deleted file mode 100644 index 73bfe1e1b..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/arguments/entity_id.inc +++ /dev/null @@ -1,146 +0,0 @@ - t("Entity: ID"), - 'description' => t('Creates an entity context from an entity ID argument.'), - 'context' => 'ctools_argument_entity_id_context', - 'get child' => 'ctools_argument_entity_id_get_child', - 'get children' => 'ctools_argument_entity_id_get_children', - 'default' => array( - 'entity_id' => '', - ), - 'placeholder form' => 'ctools_argument_entity_id_ctools_argument_placeholder', -); - -function ctools_argument_entity_id_get_child($plugin, $parent, $child) { - $plugins = ctools_argument_entity_id_get_children($plugin, $parent); - return $plugins[$parent . ':' . $child]; -} - -function ctools_argument_entity_id_get_children($original_plugin, $parent) { - $entities = entity_get_info(); - $plugins = array(); - foreach ($entities as $entity_type => $entity) { - $plugin = $original_plugin; - $plugin['title'] = t('@entity: ID', array('@entity' => $entity['label'])); - $plugin['keyword'] = $entity_type; - $plugin['description'] = t('Creates @entity context from an ID argument.', array('@entity' => $entity_type)); - $plugin['name'] = $parent . ':' . $entity_type; - $plugin_id = $parent . ':' . $entity_type; - drupal_alter('ctools_entity_context', $plugin, $entity, $plugin_id); - $plugins[$plugin_id] = $plugin; - } - drupal_alter('ctools_entity_contexts', $plugins); - - return $plugins; -} - -/** - * Discover if this argument gives us the entity we crave. - */ -function ctools_argument_entity_id_context($arg = NULL, $conf = NULL, $empty = FALSE) { - $entity_type = explode(':', $conf['name']); - $entity_type = $entity_type[1]; - // If unset it wants a generic, unfilled context. - if ($empty) { - return ctools_context_create_empty('entity:' . $entity_type); - } - - // We can accept either an entity object or a pure id. - if (is_object($arg)) { - return ctools_context_create('entity:' . $entity_type, $arg); - } - - // Trim spaces and other garbage. - $arg = trim($arg); - - if (!is_numeric($arg)) { - $preg_matches = array(); - $match = preg_match('/\[id: (\d+)\]/', $arg, $preg_matches); - if (!$match) { - $match = preg_match('/^id: (\d+)/', $arg, $preg_matches); - } - - if ($match) { - $id = $preg_matches[1]; - } - if (isset($id) && is_numeric($id)) { - return ctools_context_create('entity:' . $entity_type, $id); - } - return FALSE; - } - - $entities = entity_load($entity_type, array($arg)); - if (empty($entities)) { - return FALSE; - } - - return ctools_context_create('entity:' . $entity_type, reset($entities)); -} - -function ctools_argument_entity_id_settings_form(&$form, &$form_state, $conf) { - $plugin = &$form_state['plugin']; - - $form['settings']['entity'] = array( - '#title' => t('Enter the title or ID of a @entity entity', array('@entity' => $plugin['keyword'])), - '#type' => 'textfield', - '#maxlength' => 512, - '#autocomplete_path' => 'ctools/autocomplete/' . $plugin['keyword'], - '#weight' => -10, - ); - - if (!empty($conf['entity_id'])) { - $info = entity_load($plugin['keyword'], array($conf['entity_id'])); - $info = $info[$conf['entity_id']]; - if ($info) { - $entity = entity_get_info($plugin['keyword']); - $uri = entity_uri($plugin['keyword'], $info); - if (is_array($uri) && $entity['entity keys']['label']) { - $link = l(t("'%title' [%type id %id]", array('%title' => $info->{$entity['entity keys']['label']}, '%type' => $plugin['keyword'], '%id' => $conf['entity_id'])), $uri['path'], array('attributes' => array('target' => '_blank', 'title' => t('Open in new window')), 'html' => TRUE)); - } - elseif (is_array($uri)) { - $link = l(t("[%type id %id]", array('%type' => $plugin['keyword'], '%id' => $conf['entity_id'])), $uri['path'], array('attributes' => array('target' => '_blank', 'title' => t('Open in new window')), 'html' => TRUE)); - } - elseif ($entity['entity keys']['label']) { - $link = l(t("'%title' [%type id %id]", array('%title' => $info->{$entity['entity keys']['label']}, '%type' => $plugin['keyword'], '%id' => $conf['entity_id'])), file_create_url($uri), array('attributes' => array('target' => '_blank', 'title' => t('Open in new window')), 'html' => TRUE)); - } - else { - $link = t("[%type id %id]", array('%type' => $plugin['keyword'], '%id' => $conf['entity_id'])); - } - $form['settings']['entity']['#description'] = t('Currently set to !link', array('!link' => $link)); - } - } - - $form['settings']['entity_id'] = array( - '#type' => 'value', - '#value' => isset($conf['entity_id']) ? $conf['entity_id'] : '', - ); - - $form['settings']['entity_type'] = array( - '#type' => 'value', - '#value' => $plugin['keyword'], - ); - - return $form; -} - -function ctools_argument_entity_id_ctools_argument_placeholder($conf) { - $conf = array( - '#title' => t('Enter the title or ID of a @entity entity', array('@entity' => $conf['keyword'])), - '#type' => 'textfield', - '#maxlength' => 512, - '#autocomplete_path' => 'ctools/autocomplete/' . $conf['keyword'], - '#weight' => -10, - ); - - return $conf; -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/arguments/nid.inc b/html/sites/all/modules/contrib/ctools/plugins/arguments/nid.inc deleted file mode 100644 index cbb56d3eb..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/arguments/nid.inc +++ /dev/null @@ -1,48 +0,0 @@ - t("Node: ID"), - 'keyword' => 'node', - 'description' => t('Creates a node context from a node ID argument.'), - 'context' => 'ctools_argument_nid_context', - 'placeholder form' => array( - '#type' => 'textfield', - '#description' => t('Enter the node ID of a node for this argument'), - ), - 'no ui' => TRUE, -); - -/** - * Discover if this argument gives us the node we crave. - */ -function ctools_argument_nid_context($arg = NULL, $conf = NULL, $empty = FALSE) { - // If unset it wants a generic, unfilled context. - if ($empty) { - return ctools_context_create_empty('node'); - } - - // We can accept either a node object or a pure nid. - if (is_object($arg)) { - return ctools_context_create('node', $arg); - } - - if (!is_numeric($arg)) { - return FALSE; - } - - $node = node_load($arg); - if (!$node) { - return FALSE; - } - - return ctools_context_create('node', $node); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/arguments/node_add.inc b/html/sites/all/modules/contrib/ctools/plugins/arguments/node_add.inc deleted file mode 100644 index f249a945c..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/arguments/node_add.inc +++ /dev/null @@ -1,30 +0,0 @@ - t("Node add form: node type"), - // Keyword to use for %substitution. - 'keyword' => 'node_type', - 'description' => t('Creates a node add form context from a node type argument.'), - 'context' => 'ctools_node_add_context', -); - -/** - * Discover if this argument gives us the node we crave. - */ -function ctools_node_add_context($arg = NULL, $conf = NULL, $empty = FALSE) { - // If unset it wants a generic, unfilled context. - if (!isset($arg)) { - return ctools_context_create_empty('node_add_form'); - } - - return ctools_context_create('node_add_form', $arg); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/arguments/node_edit.inc b/html/sites/all/modules/contrib/ctools/plugins/arguments/node_edit.inc deleted file mode 100644 index 8bd076895..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/arguments/node_edit.inc +++ /dev/null @@ -1,49 +0,0 @@ - t("Node edit form: node ID"), - // Keyword to use for %substitution. - 'keyword' => 'node', - 'description' => t('Creates a node edit form context from a node ID argument.'), - 'context' => 'ctools_node_edit_context', - 'placeholder form' => array( - '#type' => 'textfield', - '#description' => t('Enter the node ID of a node for this argument'), - ), -); - -/** - * Discover if this argument gives us the node we crave. - */ -function ctools_node_edit_context($arg = NULL, $conf = NULL, $empty = FALSE) { - // If unset it wants a generic, unfilled context. - if ($empty) { - return ctools_context_create_empty('node_edit_form'); - } - - // We can accept either a node object or a pure nid. - if (is_object($arg)) { - return ctools_context_create('node_edit_form', $arg); - } - - if (!is_numeric($arg)) { - return FALSE; - } - - $node = node_load($arg); - if (!$node) { - return NULL; - } - - // This will perform a node_access check, so we don't have to. - return ctools_context_create('node_edit_form', $node); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/arguments/rid.inc b/html/sites/all/modules/contrib/ctools/plugins/arguments/rid.inc deleted file mode 100644 index d0cc30c40..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/arguments/rid.inc +++ /dev/null @@ -1,48 +0,0 @@ - t("Revision: ID"), - 'keyword' => 'revision', - 'description' => t('Creates a node context from a revision ID argument.'), - 'context' => 'ctools_argument_rid_context', - 'placeholder form' => array( - '#type' => 'textfield', - '#description' => t('Enter the revision ID of a node for this argument'), - ), -); - -/** - * Discover if this argument gives us the node we crave. - */ -function ctools_argument_rid_context($arg = NULL, $conf = NULL, $empty = FALSE) { - // If unset it wants a generic, unfilled context. - if ($empty) { - return ctools_context_create_empty('node'); - } - - // We can accept either a node object or a pure nid. - if (is_object($arg)) { - return ctools_context_create('node', $arg); - } - - if (!is_numeric($arg)) { - return FALSE; - } - - $nid = db_query('SELECT nid FROM {node_revision} WHERE vid = :vid', array(':vid' => $arg))->fetchField(); - $node = node_load($nid, $arg); - if (!$node) { - return FALSE; - } - - return ctools_context_create('node', $node); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/arguments/string.inc b/html/sites/all/modules/contrib/ctools/plugins/arguments/string.inc deleted file mode 100644 index 005e40eab..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/arguments/string.inc +++ /dev/null @@ -1,64 +0,0 @@ - t("String"), - // Keyword to use for %substitution. - 'keyword' => 'string', - 'description' => t('A string is a minimal context that simply holds a string that can be used for some other purpose.'), - 'settings form' => 'ctools_string_settings_form', - 'context' => 'ctools_string_context', - 'placeholder form' => array( - '#type' => 'textfield', - '#description' => t('Enter a value for this argument'), - ), -// This is in pagemanager. - 'path placeholder' => 'ctools_string_path_placeholder', -); - -/** - * Discover if this argument gives us the term we crave. - */ -function ctools_string_context($arg = NULL, $conf = NULL, $empty = FALSE) { - // If unset it wants a generic, unfilled context. - if ($empty) { - return ctools_context_create_empty('string'); - } - - $context = ctools_context_create('string', $arg); - $context->original_argument = $arg; - - return $context; -} - -/** - * Settings form for the argument. - */ -function ctools_string_settings_form(&$form, &$form_state, $conf) { - $form['settings']['use_tail'] = array( - '#title' => t('Get all arguments after this one'), - '#type' => 'checkbox', - '#default_value' => !empty($conf['use_tail']), - '#description' => t('If checked, this string will include all arguments. For example, if the path is "path/%" and the user visits "path/foo/bar", if this is not checked the string will be "foo". If it is checked the string will be "foo/bar".'), - ); -} - -/** - * Switch the placeholder based upon user settings. - */ -function ctools_string_path_placeholder($argument) { - if (empty($argument['settings']['use_tail'])) { - return '%pm_arg'; - } - else { - return '%pm_arg_tail'; - } -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/arguments/term.inc b/html/sites/all/modules/contrib/ctools/plugins/arguments/term.inc deleted file mode 100644 index f72e93da6..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/arguments/term.inc +++ /dev/null @@ -1,203 +0,0 @@ - t("Taxonomy term: ID"), - // Keyword to use for %substitution. - 'keyword' => 'term', - 'description' => t('Creates a single taxonomy term from a taxonomy ID or taxonomy term name.'), - 'context' => 'ctools_term_context', - 'default' => array('input_form' => 'tid', 'breadcrumb' => TRUE, 'transform' => FALSE), - 'settings form' => 'ctools_term_settings_form', - 'settings form validate' => 'ctools_term_settings_form_validate', - 'placeholder form' => 'ctools_term_ctools_argument_placeholder', - 'breadcrumb' => 'ctools_term_breadcrumb', -); - -/** - * Discover if this argument gives us the term we crave. - */ -function ctools_term_context($arg = NULL, $conf = NULL, $empty = FALSE) { - // If unset it wants a generic, unfilled context. - if ($empty) { - return ctools_context_create_empty('entity:taxonomy_term'); - } - - if (isset($conf['vocabularies'])) { - $vocabularies = $conf['vocabularies']; - } - else { - $vids = isset($conf['vids']) ? $conf['vids'] : array(); - - // Convert legacy use of vids to machine names. - $vocabularies = _ctools_term_vocabulary_machine_name_convert($vids); - } - - if (is_object($arg)) { - $term = $arg; - } - else { - switch ($conf['input_form']) { - case 'tid': - default: - if (!is_numeric($arg)) { - return FALSE; - } - $term = taxonomy_term_load($arg); - break; - - case 'term': - if (!empty($conf['transform'])) { - $arg = strtr($arg, '-', ' '); - } - - $terms = taxonomy_get_term_by_name($arg); - // If only one term is found, fall through to vocabulary check below. - if ((count($terms) > 1) && $vocabularies) { - foreach ($terms as $potential) { - foreach ($vocabularies as $machine_name) { - if ($potential->vocabulary_machine_name == $machine_name) { - $term = $potential; - // Break out of the foreaches AND the case. - break 3; - } - } - } - } - $term = array_shift($terms); - break; - } - - if (empty($term)) { - return NULL; - } - } - - if ($vocabularies && !isset($vocabularies[$term->vocabulary_machine_name])) { - return NULL; - } - - $context = ctools_context_create('entity:taxonomy_term', $term); - $context->original_argument = $arg; - return $context; -} - -/** - * Settings form for the argument. - */ -function ctools_term_settings_form(&$form, &$form_state, $conf) { - // @todo allow synonym use like Views does. - $form['settings']['input_form'] = array( - '#title' => t('Argument type'), - '#type' => 'radios', - '#options' => array('tid' => t('Term ID'), 'term' => t('Term name')), - '#default_value' => $conf['input_form'], - '#prefix' => '
    ', - '#suffix' => '
    ', - ); - - $vocabularies = taxonomy_get_vocabularies(); - $options = array(); - foreach ($vocabularies as $vid => $vocab) { - $options[$vocab->machine_name] = $vocab->name; - } - - // Fallback on legacy 'vids', when no vocabularies are available. - if (empty($conf['vocabularies']) && !empty($conf['vids'])) { - $conf['vocabularies'] = _ctools_term_vocabulary_machine_name_convert(array_filter($conf['vids'])); - unset($conf['vids']); - } - - $form['settings']['vocabularies'] = array( - '#title' => t('Limit to these vocabularies'), - '#type' => 'checkboxes', - '#options' => $options, - '#default_value' => !empty($conf['vocabularies']) ? $conf['vocabularies'] : array(), - '#description' => t('If no vocabularies are checked, terms from all vocabularies will be accepted.'), - ); - - $form['settings']['breadcrumb'] = array( - '#title' => t('Inject hierarchy into breadcrumb trail'), - '#type' => 'checkbox', - '#default_value' => !empty($conf['breadcrumb']), - '#description' => t('If checked, taxonomy term parents will appear in the breadcrumb trail.'), - ); - - $form['settings']['transform'] = array( - '#title' => t('Transform dashes in URL to spaces in term name filter values'), - '#type' => 'checkbox', - '#default_value' => !empty($conf['transform']), - ); -} - -function ctools_term_settings_form_validate(&$form, &$form_state) { - // Filter the selected vocabularies to avoid storing redundant data. - $vocabularies = array_filter($form_state['values']['settings']['vocabularies']); - form_set_value($form['settings']['vocabularies'], $vocabularies, $form_state); -} - -/** - * Form fragment to get an argument to convert a placeholder for preview. - */ -function ctools_term_ctools_argument_placeholder($conf) { - switch ($conf['input_form']) { - case 'tid': - default: - return array( - '#type' => 'textfield', - '#description' => t('Enter a taxonomy term ID.'), - ); - - case 'term': - return array( - '#type' => 'textfield', - '#description' => t('Enter a taxonomy term name.'), - ); - } -} - -/** - * Inject the breadcrumb trail if necessary. - */ -function ctools_term_breadcrumb($conf, $context) { - if (empty($conf['breadcrumb']) || empty($context->data) || empty($context->data->tid)) { - return; - } - - $breadcrumb = array(); - $current = new stdClass(); - $current->tid = $context->data->tid; - while ($parents = taxonomy_get_parents($current->tid)) { - $current = array_shift($parents); - $breadcrumb[] = l($current->name, 'taxonomy/term/' . $current->tid); - } - - $breadcrumb = array_merge(drupal_get_breadcrumb(), array_reverse($breadcrumb)); - drupal_set_breadcrumb($breadcrumb); -} - -/** - * Helper function to convert convert legacy vocabulary ids into machine names. - * - * @param array $vids - * Array of either vids. - * - * @return array - * A keyed array of machine names. - */ -function _ctools_term_vocabulary_machine_name_convert($vids) { - $vocabularies = taxonomy_vocabulary_load_multiple($vids); - $return = array(); - foreach ($vocabularies as $vocabulary) { - $return[$vocabulary->machine_name] = $vocabulary->machine_name; - } - return $return; -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/arguments/terms.inc b/html/sites/all/modules/contrib/ctools/plugins/arguments/terms.inc deleted file mode 100644 index b816e1cbe..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/arguments/terms.inc +++ /dev/null @@ -1,76 +0,0 @@ - t("Taxonomy term (multiple): ID"), - // Keyword to use for %substitution. - 'keyword' => 'term', - 'description' => t('Creates a group of taxonomy terms from a list of tids separated by a comma or a plus sign. In general the first term of the list will be used for panes.'), - 'context' => 'ctools_terms_context', - 'default' => array('breadcrumb' => TRUE), - 'settings form' => 'ctools_terms_settings_form', - 'placeholder form' => array( - '#type' => 'textfield', - '#description' => t('Enter a term ID or a list of term IDs separated by a + or a ,'), - ), - 'breadcrumb' => 'ctools_terms_breadcrumb', -); - -/** - * Discover if this argument gives us the term we crave. - */ -function ctools_terms_context($arg = NULL, $conf = NULL, $empty = FALSE) { - // If unset it wants a generic, unfilled context. - if ($empty) { - return ctools_context_create_empty('terms'); - } - - $terms = ctools_break_phrase($arg); - if (empty($terms->value) || !empty($terms->invalid_input)) { - return FALSE; - } - - $context = ctools_context_create('terms', $terms); - $context->original_argument = $arg; - return $context; -} - -/** - * Settings form for the argument. - */ -function ctools_terms_settings_form(&$form, &$form_state, $conf) { - $form['settings']['breadcrumb'] = array( - '#title' => t('Inject hierarchy of first term into breadcrumb trail'), - '#type' => 'checkbox', - '#default_value' => !empty($conf['breadcrumb']), - '#description' => t('If checked, taxonomy term parents will appear in the breadcrumb trail.'), - ); -} - -/** - * Inject the breadcrumb trail if necessary. - */ -function ctools_terms_breadcrumb($conf, $context) { - if (empty($conf['breadcrumb'])) { - return; - } - - $current = new stdClass(); - $current->tid = $context->tids[0]; - $breadcrumb = array(); - while ($parents = taxonomy_get_parents($current->tid)) { - $current = array_shift($parents); - $breadcrumb[] = l($current->name, 'taxonomy/term/' . $current->tid); - } - - $breadcrumb = array_merge(drupal_get_breadcrumb(), array_reverse($breadcrumb)); - drupal_set_breadcrumb($breadcrumb); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/arguments/uid.inc b/html/sites/all/modules/contrib/ctools/plugins/arguments/uid.inc deleted file mode 100644 index c6ca3cccb..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/arguments/uid.inc +++ /dev/null @@ -1,53 +0,0 @@ - t("User: ID"), - // Keyword to use for %substitution. - 'keyword' => 'user', - 'description' => t('Creates a user context from a user ID argument.'), - 'context' => 'ctools_argument_uid_context', - 'placeholder form' => array( - '#type' => 'textfield', - '#description' => t('Enter the user ID of a user for this argument'), - ), - 'default' => array('to_arg' => TRUE), -// This is in pagemanager. - 'path placeholder' => '%pm_uid_arg', - 'path placeholder to_arg' => TRUE, - 'no ui' => TRUE, -); - -/** - * Discover if this argument gives us the user we crave. - */ -function ctools_argument_uid_context($arg = NULL, $conf = NULL, $empty = FALSE) { - // If unset it wants a generic, unfilled context. - if ($empty) { - return ctools_context_create_empty('user'); - } - - // We can accept either a node object or a pure nid. - if (is_object($arg)) { - return ctools_context_create('user', $arg); - } - - if (!is_numeric($arg)) { - return NULL; - } - - $account = user_load($arg); - if (!$account) { - return NULL; - } - - return ctools_context_create('user', $account); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/arguments/user_edit.inc b/html/sites/all/modules/contrib/ctools/plugins/arguments/user_edit.inc deleted file mode 100644 index 9c52b589c..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/arguments/user_edit.inc +++ /dev/null @@ -1,46 +0,0 @@ - t("User edit form: User ID"), - // Keyword to use for %substitution. - 'keyword' => 'user', - 'description' => t('Creates a user edit form context from a user ID argument.'), - 'context' => 'ctools_user_edit_context', - 'placeholder form' => array( - '#type' => 'textfield', - '#description' => t('Enter the user ID for this argument.'), - ), -); - -/** - * Discover if this argument gives us the term we crave. - */ -function ctools_user_edit_context($arg = NULL, $conf = NULL, $empty = FALSE) { - // If unset it wants a generic, unfilled context. - if ($empty) { - return ctools_context_create_empty('user_edit_form'); - } - if (is_object($arg)) { - return ctools_context_create('user_edit_form', $arg); - } - if (!is_numeric($arg)) { - return FALSE; - } - - $account = user_load($arg); - if (!$account) { - return NULL; - } - - // This will perform a node_access check, so we don't have to. - return ctools_context_create('user_edit_form', $account); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/arguments/user_name.inc b/html/sites/all/modules/contrib/ctools/plugins/arguments/user_name.inc deleted file mode 100644 index ed74d9d84..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/arguments/user_name.inc +++ /dev/null @@ -1,43 +0,0 @@ - t("User: name"), - // Keyword to use for %substitution. - 'keyword' => 'user', - 'description' => t('Creates a user context from a user name.'), - 'context' => 'ctools_argument_user_name_context', - 'placeholder form' => array( - '#type' => 'textfield', - '#description' => t('Enter the username of a user for this argument'), - ), -); - -/** - * Discover if this argument gives us the user we crave. - */ -function ctools_argument_user_name_context($arg = NULL, $conf = NULL, $empty = FALSE) { - // If unset it wants a generic, unfilled context. - if ($empty) { - return ctools_context_create_empty('user'); - } - - // We can accept either a node object or a pure nid. - if (is_object($arg)) { - return ctools_context_create('user', $arg); - } - - $account = user_load_by_name($arg); - if (!$account) { - return NULL; - } - return ctools_context_create('user', $account); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/arguments/vid.inc b/html/sites/all/modules/contrib/ctools/plugins/arguments/vid.inc deleted file mode 100644 index db68acd78..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/arguments/vid.inc +++ /dev/null @@ -1,44 +0,0 @@ - t("Vocabulary: ID"), - // Keyword to use for %substitution. - 'keyword' => 'vocabulary', - 'description' => t('Creates a vocabulary context from a vocabulary ID argument.'), - 'context' => 'ctools_vid_context', - 'placeholder form' => array( - '#type' => 'textfield', - '#description' => t('Enter the vocabulary ID for this argument'), - ), - 'no ui' => TRUE, -); - -/** - * Discover if this argument gives us the vocabulary we crave. - */ -function ctools_vid_context($arg = NULL, $conf = NULL, $empty = FALSE) { - // If unset it wants a generic, unfilled context. - if ($empty) { - return ctools_context_create_empty('entity:taxonomy_vocabulary'); - } - - if (!is_numeric($arg)) { - return NULL; - } - - $vocabulary = taxonomy_vocabulary_load($arg); - if (!$vocabulary) { - return NULL; - } - - return ctools_context_create('vocabulary', $vocabulary); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/cache/export_ui.inc b/html/sites/all/modules/contrib/ctools/plugins/cache/export_ui.inc deleted file mode 100644 index f21af1009..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/cache/export_ui.inc +++ /dev/null @@ -1,39 +0,0 @@ - t('Export UI wizard cache'), - 'cache get' => 'ctools_cache_export_ui_cache_get', - 'cache set' => 'ctools_cache_export_ui_cache_set', - // Some operations use a 'finalize' but that really just means set - // for us, since we're not using temporary storage for subsystems. - 'cache finalize' => 'ctools_cache_export_ui_cache_set', -); - -function ctools_cache_export_ui_cache_get($plugin_name, $key) { - ctools_include('export-ui'); - $plugin = ctools_get_export_ui($plugin_name); - $handler = ctools_export_ui_get_handler($plugin); - if ($handler) { - $item = $handler->edit_cache_get($key); - if (!$item) { - $item = ctools_export_crud_load($handler->plugin['schema'], $key); - } - return $item; - } -} - -function ctools_cache_export_ui_cache_set($plugin_name, $key, $item) { - ctools_include('export-ui'); - $plugin = ctools_get_export_ui($plugin_name); - $handler = ctools_export_ui_get_handler($plugin); - if ($handler) { - return $handler->edit_cache_set_key($item, $key); - } -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/cache/simple.inc b/html/sites/all/modules/contrib/ctools/plugins/cache/simple.inc deleted file mode 100644 index c44d7983c..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/cache/simple.inc +++ /dev/null @@ -1,51 +0,0 @@ - t('Simple'), - 'cache get' => 'ctools_cache_simple_cache_get', - 'cache set' => 'ctools_cache_simple_cache_set', - 'cache clear' => 'ctools_cache_simple_cache_clear', -); - -function ctools_cache_simple_cache_get($data, $key) { - ctools_include('object-cache'); - - // Ensure that if there is somehow no data, we at least don't stomp on other - // people's caches. - if (empty($data)) { - $data = 'simple_cache_plugin'; - } - - return ctools_object_cache_get($data, $key); -} - -function ctools_cache_simple_cache_set($data, $key, $object) { - ctools_include('object-cache'); - - // Ensure that if there is somehow no data, we at least don't stomp on other - // people's caches. - if (empty($data)) { - $data = 'simple_cache_plugin'; - } - - return ctools_object_cache_set($data, $key, $object); -} - -function ctools_cache_simple_cache_clear($data, $key) { - ctools_include('object-cache'); - - // Ensure that if there is somehow no data, we at least don't stomp on other - // people's caches. - if (empty($data)) { - $data = 'simple_cache_plugin'; - } - - return ctools_object_cache_clear($data, $key); -} diff --git a/html/sites/all/modules/contrib/ctools/plugins/content_types/block/block.inc b/html/sites/all/modules/contrib/ctools/plugins/content_types/block/block.inc deleted file mode 100644 index ee5ce5764..000000000 --- a/html/sites/all/modules/contrib/ctools/plugins/content_types/block/block.inc +++ /dev/null @@ -1,503 +0,0 @@ - t('Block'), - 'content type' => 'ctools_block_content_type_content_type', -); - -/** - * Return the block content types with the specified $subtype_id. - */ -function ctools_block_content_type_content_type($subtype_id) { - list($module, $delta) = explode('-', $subtype_id, 2); - $module_blocks = module_invoke($module, 'block_info'); - if (isset($module_blocks[$delta])) { - return _ctools_block_content_type_content_type($module, $delta, $module_blocks[$delta]); - } -} - -/** - * Return all block content types available. - * - * Modules wanting to make special adjustments the way that CTools handles their blocks - * can implement an extension to the hook_block() family, where the function name is - * of the form "$module . '_ctools_block_info'". - */ -function ctools_block_content_type_content_types() { - $types = &drupal_static(__FUNCTION__); - if (isset($types)) { - return $types; - } - - $types = array(); - foreach (module_implements('block_info') as $module) { - $module_blocks = module_invoke($module, 'block_info'); - if ($module_blocks) { - foreach ($module_blocks as $delta => $block) { - $info = _ctools_block_content_type_content_type($module, $delta, $block); - // This check means modules can remove their blocks; particularly useful - // if they offer the block some other way (like we do for views) - if ($info) { - $types["$module-$delta"] = $info; - } - } - } - } - return $types; -} - -/** - * Return an info array for a specific block. - */ -function _ctools_block_content_type_content_type($module, $delta, $block) { - // strip_tags used because it goes through check_plain and that - // just looks bad. - $info = array( - 'title' => strip_tags($block['info']), - ); - - // Ask around for further information by invoking the hook_block() extension. - $function = $module . '_ctools_block_info'; - if (!function_exists($function)) { - $function = 'ctools_default_block_info'; - } - $function($module, $delta, $info); - - return $info; -} - -/** - * Load block info from the database. - * - * This is copied from _block_load_blocks(). It doesn't use that - * function because _block_load_blocks sorts by region, and it - * doesn't cache its results anyway. - */ -function _ctools_block_load_blocks() { - if (!module_exists('block')) { - return array(); - } - - $blocks = &drupal_static(__FUNCTION__, NULL); - if (!isset($blocks)) { - global $theme_key; - - $query = db_select('block', 'b'); - $result = $query - ->fields('b') - ->condition('b.theme', $theme_key) - ->orderBy('b.region') - ->orderBy('b.weight') - ->orderBy('b.module') - ->addTag('block_load') - ->addTag('translatable') - ->execute(); - - $block_info = $result->fetchAllAssoc('bid'); - // Allow modules to modify the block list. - drupal_alter('block_list', $block_info); - - $blocks = array(); - foreach ($block_info as $block) { - $blocks["{$block->module}_{$block->delta}"] = $block; - } - } - - return $blocks; -} - -/** - * Fetch the stored info for a block. - * - * The primary reason to use this is so that modules which perform alters - * can have their alters make it to the block. - */ -function _ctools_get_block_info($module, $delta) { - $blocks = _ctools_block_load_blocks(); - - $key = $module . '_' . $delta; - if (isset($blocks[$key])) { - return $blocks[$key]; - } -} - -/** - * Output function for the 'block' content type. Outputs a block - * based on the module and delta supplied in the configuration. - */ -function ctools_block_content_type_render($subtype, $conf) { - list($module, $delta) = _ctools_block_get_module_delta($subtype, $conf); - - $info = _ctools_get_block_info($module, $delta); - $block = module_invoke($module, 'block_view', $delta); - - if (!empty($info)) { - // Valid PHP function names cannot contain hyphens. - $block_delta = str_replace('-', '_', $delta); - - // Allow modules to modify the block before it is viewed, via either - // hook_block_view_alter() or hook_block_view_MODULE_DELTA_alter(). - drupal_alter(array('block_view', "block_view_{$module}_{$block_delta}"), $block, $info); - } - - if (empty($block)) { - return; - } - - $block = (object) $block; - $block->module = $module; - $block->delta = $delta; - - if (!isset($block->title)) { - if ($module == 'block' && !empty($info) && isset($info->title)) { - $block->title = $info->title; - } - elseif (isset($block->subject)) { - $block->title = $block->subject; - } - else { - $block->title = NULL; - } - } - - if (module_exists('block') && user_access('administer blocks')) { - $block->admin_links = array( - array( - 'title' => t('Configure block'), - 'href' => "admin/structure/block/manage/$module/$delta/configure", - 'query' => drupal_get_destination(), - ), - ); - } - - return $block; -} - -/** - * Empty form so we can have the default override title. - */ -function ctools_block_content_type_edit_form($form, &$form_state) { - // Does nothing! - return $form; -} - -/** - * Submit function to fix the subtype for really old panel panes. - */ -function ctools_block_content_type_edit_form_submit($form, &$form_state) { - if (empty($form_state['subtype']) && isset($form_state['pane'])) { - $form_state['pane']->subtype = $form_state['conf']['module'] . '-' . $form_state['conf']['delta']; - unset($form_state['conf']['module']); - unset($form_state['conf']['delta']); - } -} - -/** - * Returns the administrative title for a type. - */ -function ctools_block_content_type_admin_title($subtype, $conf) { - list($module, $delta) = _ctools_block_get_module_delta($subtype, $conf); - $block = module_invoke($module, 'block_info'); - if (empty($block) || empty($block[$delta])) { - return t('Deleted/missing block @module-@delta', array('@module' => $module, '@delta' => $delta)); - } - - // The block description reported by hook_block() is plain text, but the title - // reported by this hook should be HTML. - $title = check_plain($block[$delta]['info']); - return $title; -} - -/** - * Output function for the 'block' content type. Outputs a block - * based on the module and delta supplied in the configuration. - */ -function ctools_block_content_type_admin_info($subtype, $conf) { - list($module, $delta) = _ctools_block_get_module_delta($subtype, $conf); - $block = (object) module_invoke($module, 'block_view', $delta); - - if (!empty($block)) { - // Sanitize the block because \n"; -} - -/** - * Returns whether query logging is enabled. - * - * @return boolean - * TRUE if the query log is enabled, FALSE otherwise. - */ -function devel_query_enabled() { - return method_exists('Database', 'getLog') && variable_get('devel_query_display', FALSE); -} - -/** - * Returns the query summary. - * - * @return array - * An index array containing: - * 0: The an associative array where the keys are the queries and the values - * are number of times that query was executes. - * 1: The summary. - * 2: An associative array of substitution variables to be applied in the - * previous element. - */ -function devel_query_summary($queries) { - if (variable_get('devel_query_display', FALSE) && is_array($queries)) { - $sum = 0; - foreach ($queries as $query) { - $text[] = $query['query']; - $sum += $query['time']; - } - $counts = array_count_values($text); - return array( - $counts, - t_safe('Executed @queries queries in @time ms.', - array('@queries' => count($queries), '@time' => round($sum * 1000, 2))), - ); - } -} - -/** - * Gets the t() function if available, uses strtr() as a fallback. - */ -function t_safe($string, $args) { - // get_t() caused problems here with the theme registry after changing on - // admin/build/modules. The theme_get_registry() call is needed! - if (function_exists('t') && function_exists('theme_get_registry')) { - theme_get_registry(); - return t($string, $args); - } - else { - return strtr($string, $args); - } -} - -/** - * Returns the core version. - * - * @param string - * The version string to parse. - * - * @return string - * MAJOR.MINOR for versions before 5, MAJOR for subsequent versions. - */ -function devel_get_core_version($version) { - $version_parts = explode('.', $version); - // Map from 4.7.10 -> 4.7 - if ($version_parts[0] < 5) { - return $version_parts[0] . '.' . $version_parts[1]; - } - // Map from 5.5 -> 5 or 6.0-beta2 -> 6 - else { - return $version_parts[0]; - } -} - -/** - * Returns whether the optimizer is compatible. - * - * @return boolean - * TRUE if compatible, FALSE otherwise. - */ -function devel_is_compatible_optimizer() { - // See http://drupal.org/node/126098. - ob_start(); - phpinfo(); - $info = ob_get_contents(); - ob_end_clean(); - - // Match the Zend Optimizer version in the phpinfo information. - $found = preg_match('/Zend Optimizer v([0-9])\.([0-9])\.([0-9])/', $info, $matches); - - if ($matches) { - $major = $matches[1]; - $minor = $matches[2]; - $build = $matches[3]; - - if ($major >= 3) { - if ($minor >= 3) { - return TRUE; - } - elseif ($minor == 2 && $build >= 8) { - return TRUE; - } - else { - return FALSE; - } - } - else { - return FALSE; - } - } - else { - return TRUE; - } -} - -/** - * Generates the execute block form. - */ -function devel_execute_block_form() { - $form['execute'] = array( - '#type' => 'fieldset', - '#title' => t('Execute PHP Code'), - '#collapsible' => TRUE, - '#collapsed' => (!isset($_SESSION['devel_execute_code'])), - ); - $form['#submit'] = array('devel_execute_form_submit'); - return array_merge_recursive($form, devel_execute_form()); -} - -/** - * Generates the execute form. - */ -function devel_execute_form() { - $form['execute']['code'] = array( - '#type' => 'textarea', - '#title' => t('PHP code to execute'), - '#description' => t('Enter some code. Do not use <?php ?> tags.'), - '#default_value' => (isset($_SESSION['devel_execute_code']) ? $_SESSION['devel_execute_code'] : ''), - '#rows' => 20, - ); - $form['execute']['actions'] = array('#type' => 'actions'); - $form['execute']['actions']['op'] = array( - '#type' => 'submit', - '#value' => t('Execute'), - ); - $form['#redirect'] = FALSE; - if (isset($_SESSION['devel_execute_code'])) { - unset($_SESSION['devel_execute_code']); - } - return $form; -} - -/** - * Processes PHP execute form submissions. - */ -function devel_execute_form_submit($form, &$form_state) { - ob_start(); - print eval($form_state['values']['code']); - $_SESSION['devel_execute_code'] = $form_state['values']['code']; - dsm(ob_get_clean()); -} - -/** - * Switches to a different user. - * - * We don't call session_save_session() because we really want to change users. - * Usually unsafe! - * - * @param string $name - * The username to switch to, or NULL to log out. - */ -function devel_switch_user($name = NULL) { - global $user; - - if ($user->uid) { - module_invoke_all('user_logout', $user); - } - if (isset($name) && $account = user_load_by_name($name)) { - $old_uid = $user->uid; - $user = $account; - $user->timestamp = time() - 9999; - if (!$old_uid) { - // Switch from anonymous to authorized. - drupal_session_regenerate(); - } - $edit = array(); - user_module_invoke('login', $edit, $user); - } - elseif ($user->uid) { - session_destroy(); - } - drupal_goto(); -} - -/** - * Prints an object using either Krumo (if installed) or devel_print_object(). - * - * @param array|object $object - * An array or object to print. - * @param string $prefix - * Prefix for output items. - * - * @return - * The results from krumo_ob() or devel_print_object(). - */ -function kdevel_print_object($object, $prefix = NULL) { - return has_krumo() ? krumo_ob($object) : devel_print_object($object, $prefix); -} - -/** - * Saves krumo html using output buffering. - */ -function krumo_ob($object) { - ob_start(); - krumo($object); - $output = ob_get_contents(); - ob_end_clean(); - return $output; -} - -/** - * Displays an object or array. - * - * @param array|object $object - * The object or array to display. - * @param string $prefix - * Prefix for the output items (example "$node->", "$user->", "$"). - * @param boolean $header - * Set to FALSE to suppress the output of the h3 tag. - * - * @return string - */ -function devel_print_object($object, $prefix = NULL, $header = TRUE) { - drupal_add_css(drupal_get_path('module', 'devel') . '/devel.css'); - $output = '
    '; - if ($header) { - $output .= '

    ' . t('Display of !type !obj', array( - '!type' => str_replace(array('$', '->'), '', $prefix), - '!obj' => gettype($object), - ) - ) . '

    '; - } - $output .= _devel_print_object($object, $prefix); - $output .= '
    '; - return $output; -} - -/** - * Returns formatted listing for an array or object. - * - * Recursive (and therefore magical) function goes through an array or object - * and returns a nicely formatted listing of its contents. - * - * @param array|object $obj - * Array or object to recurse through. - * @param string $prefix - * Prefix for the output items (example "$node->", "$user->", "$"). - * @param string $parents - * Used by recursion. - * @param boolean $object - * Used by recursion. - * - * @return string - * Formatted html. - * - * @todo - * Currently there are problems sending an array with a varname. - */ -function _devel_print_object($obj, $prefix = NULL, $parents = NULL, $object = FALSE) { - static $root_type, $out_format; - - // TODO: support objects with references. See http://drupal.org/node/234581. - if (isset($obj->view)) { - return; - } - - if (!isset($root_type)) { - $root_type = gettype($obj); - if ($root_type == 'object') { - $object = TRUE; - } - } - - if (is_object($obj)) { - $obj = (array) $obj; - } - if (is_array($obj)) { - $output = "
    \n"; - foreach ($obj as $field => $value) { - if ($field === 'devel_flag_reference') { - continue; - } - if (!is_null($parents)) { - if ($object) { - $field = $parents . '->' . $field; - } - else { - if (is_int($field)) { - $field = $parents . '[' . $field . ']'; - } - else { - $field = $parents . '[\'' . $field . '\']'; - } - } - } - - $type = gettype($value); - - $show_summary = TRUE; - $summary = NULL; - if ($show_summary) { - switch ($type) { - case 'string': - case 'float': - case 'integer': - if (strlen($value) == 0) { - $summary = t("{empty}"); - } - elseif (strlen($value) < 40) { - $summary = htmlspecialchars($value); - } - else { - $summary = format_plural(drupal_strlen($value), '1 character', '@count characters'); - } - break; - case 'array': - case 'object': - $summary = format_plural(count((array) $value), '1 element', '@count elements'); - break; - case 'boolean': - $summary = $value ? t('TRUE') : t('FALSE'); - break; - } - } - if (!is_null($summary)) { - $typesum = '(' . $type . ', ' . $summary . ')'; - } - else { - $typesum = '(' . $type . ')'; - } - - $output .= ''; - $output .= "
    {$prefix}{$field} $typesum
    \n"; - $output .= "
    \n"; - // Check for references. - if (is_array($value) && isset($value['devel_flag_reference'])) { - $value['devel_flag_reference'] = TRUE; - } - // Check for references to prevent errors from recursions. - if (is_array($value) && isset($value['devel_flag_reference']) && !$value['devel_flag_reference']) { - $value['devel_flag_reference'] = FALSE; - $output .= _devel_print_object($value, $prefix, $field); - } - elseif (is_object($value)) { - $value->devel_flag_reference = FALSE; - $output .= _devel_print_object((array) $value, $prefix, $field, TRUE); - } - else { - $value = is_bool($value) ? ($value ? 'TRUE' : 'FALSE') : $value; - $output .= htmlspecialchars(print_r($value, TRUE)) . "\n"; - } - $output .= "
    \n"; - } - $output .= "
    \n"; - } - return $output; -} - -/** - * Shows all the queries for the page. - * - * Adds a table at the bottom of the page cataloguing data on all the database - * queries that were made to generate the page. - * - * @return string - * Queries themed using devel_querylog. - */ -function devel_query_table($queries, $counts) { - $version = devel_get_core_version(VERSION); - $header = array('ms', '#', 'where', 'ops', 'query', 'target'); - $i = 0; - $api = variable_get('devel_api_url', 'api.drupal.org'); - $conn = Database::getconnection(); - foreach ($queries as $query) { - $function = !empty($query['caller']['class']) ? $query['caller']['class'] . '::' : ''; - $function .= $query['caller']['function']; - $count = isset($counts[$query['query']]) ? $counts[$query['query']] : 0; - - $diff = round($query['time'] * 1000, 2); - if ($diff > variable_get('devel_execution', 5)) { - $cell[$i][] = array('data' => $diff, 'class' => 'marker'); - } - else { - $cell[$i][] = $diff; - } - $cell[$i][] = $count; - $cell[$i][] = l($function, "http://$api/api/function/$function/$version"); - $ops[] = l(t('P'), '', array( - 'attributes' => array( - 'title' => 'Show placeholders', - 'class' => array('dev-placeholders'), - 'qid' => $i, - ))); - $ops[] = l(t('A'), '', array( - 'attributes' => array( - 'title' => 'Show arguments', - 'class' => array('dev-arguments'), - 'qid' => $i, - ))); - // EXPLAIN only valid for select queries. - if (strpos($query['query'], 'UPDATE') === FALSE && strpos($query['query'], 'INSERT') === FALSE && strpos($query['query'], 'DELETE') === FALSE) { - $ops[] = l(t('E'), '', array( - 'attributes' => array( - 'title' => 'Show EXPLAIN', - 'class' => array('dev-explain'), - 'qid' => $i, - ))); - } - $cell[$i][] = implode(' ', $ops); - // 3 divs for each variation of the query. Last 2 are hidden by default. - if (variable_get('devel_show_query_args_first', FALSE)) { - $placeholders = '\n"; - $quoted = array(); - foreach ($query['args'] as $key => $val) { - $quoted[$key] = $conn->quote($val); - } - $output = strtr($query['query'], $quoted); - $args = '
    ' . $output . '
    ' . "\n"; - } - else { - $placeholders = '
    ' . check_plain($query['query']) . "
    \n"; - $args = '' . "\n"; - } - $explain = '' . "\n"; - $cell[$i][] = array( - 'id' => "devel-query-$i", - 'data' => $placeholders . $args . $explain, - ); - $cell[$i][] = $query['target']; - $i++; - unset($diff, $count, $ops); - } - if (variable_get('devel_query_sort', DEVEL_QUERY_SORT_BY_SOURCE)) { - usort($cell, '_devel_table_sort'); - } - return theme('devel_querylog', array('header' => $header, 'rows' => $cell)); -} - -/** - * Returns HTML for a Devel querylog row. - * - * @param array $variables - * An associative array containing: - * - row: An array of cells in which each cell is either a string or an - * associative array containing: - * - data: The data to render. - * - Any attributes to be applied to the cell. - * - * @ingroup themeable - */ -function theme_devel_querylog_row($variables) { - $row = $variables['row']; - $i = 0; - $output = ''; - foreach ($row as $cell) { - $i++; - - if (is_array($cell)) { - $data = !empty($cell['data']) ? $cell['data'] : ''; - unset($cell['data']); - $attr = $cell; - } - else { - $data = $cell; - $attr = array(); - } - - if (!empty($attr['class'])) { - $attr['class'] .= " cell cell-$i"; - } - else { - $attr['class'] = "cell cell-$i"; - } - $attr = drupal_attributes($attr); - - $output .= "
    $data
    "; - } - return $output; -} - -/** - * Returns HTML for the Devel querylog. - * - * @param array $variables - * An associative array containing: - * - header: An array suitable for rendering with devel_querylog_row. - * - rows: An array of rows suitable for rendering with devel_querylog_row. - * - * @ingroup themeable - */ -function theme_devel_querylog($variables) { - $header = $variables['header']; - $rows = $variables['rows']; - $output = ''; - if (!empty($header)) { - $output .= "
    "; - $output .= theme('devel_querylog_row', array('row' => $header)); - $output .= "
    "; - } - if (!empty($rows)) { - $i = 0; - foreach ($rows as $row) { - $i++; - $zebra = ($i % 2) == 0 ? 'even' : 'odd'; - $output .= "
    "; - $output .= theme('devel_querylog_row', array('row' => $row)); - $output .= "
    "; - } - } - return $output; -} - -/** - * Devel's table sort. - */ -function _devel_table_sort($a, $b) { - $a = is_array($a[0]) ? $a[0]['data'] : $a[0]; - $b = is_array($b[0]) ? $b[0]['data'] : $b[0]; - if ($a < $b) { - return 1; - } - if ($a > $b) { - return -1; - } - return 0; -} - -/** - * Displays page execution time at the bottom of the page. - * - * @return string - * A message indicating how long it took to execute the page. - */ -function devel_timer() { - $time = timer_read('page'); - return t_safe(' Page execution time was @time ms.', array('@time' => $time)); -} - -if (!function_exists('dd')) { - /** - * An alias for drupal_debug(). - * - * @see drupal_debug() - */ - function dd($data, $label = NULL) { - return drupal_debug($data, $label); - } -} - -/** - * Logs a variable to a drupal_debug.txt in the site's temp directory. - * - * @param mixed $data - * The variable to log to the drupal_debug.txt log file. - * @param string $label - * (optional) If set, a label to output before $data in the log file. - * - * @return void|false - * Empty if successful, FALSE if the log file could not be written. - * - * @see dd() - * @see http://drupal.org/node/314112 - */ -function drupal_debug($data, $label = NULL) { - $out = ($label ? $label . ': ' : '') . print_r($data, TRUE) . "\n"; - - // The temp directory does vary across multiple simpletest instances. - $file = file_directory_temp() . '/drupal_debug.txt'; - if (file_put_contents($file, $out, FILE_APPEND) === FALSE) { - drupal_set_message(t('Devel was unable to write to %file.', array('%file' => $file)), 'error'); - return FALSE; - } -} - -/** - * Prints the arguments passed into the current function. - */ -function dargs($always = TRUE) { - static $printed; - if ($always || !$printed) { - $bt = debug_backtrace(); - print kdevel_print_object($bt[1]['args']); - $printed = TRUE; - } -} - -/** - * Prints a SQL string from a DBTNG Select object. - * - * Includes quoted arguments. - * - * @param object $query - * An object that implements the SelectQueryInterface interface. - * @param string $return - * Whether to return the string. Default is FALSE, meaning to print it - * and return $query instead. - * @param string $name - * Optional name for identifying the output. - * - * @return object|string - * The $query object, or the query string if $return was TRUE. - */ -function dpq($query, $return = FALSE, $name = NULL) { - if (user_access('access devel information')) { - if (method_exists($query, 'preExecute')) { - $query->preExecute(); - } - $sql = (string) $query; - $quoted = array(); - $connection = Database::getConnection(); - foreach ((array) $query->arguments() as $key => $val) { - $quoted[$key] = $connection->quote($val); - } - $sql = strtr($sql, $quoted); - if ($return) { - return $sql; - } - dpm($sql, $name); - } - return ($return ? NULL : $query); -} - -/** - * Prints a variable to the 'message' area of the page. - * - * Uses drupal_set_message(). - * - * @param $input - * An arbitrary value to output. - * @param string $name - * Optional name for identifying the output. - * @param string $type - * Optional message type for drupal_set_message(), defaults to 'status'. - * - * @return input - * The unaltered input value. - * - * @see drupal_set_message() - */ -function dpm($input, $name = NULL, $type = 'status') { - if (user_access('access devel information')) { - $export = kprint_r($input, TRUE, $name); - drupal_set_message($export, $type); - } - return $input; -} - -/** - * Displays a drupal_var_export() variable to the 'message' area of the page. - * - * Uses drupal_set_message(). - * - * @param $input - * An arbitrary value to output. - * @param string $name - * Optional name for identifying the output. - * - * @return input - * The unaltered input value. - * - * @see drupal_set_message() - * @see drupal_var_export() - */ -function dvm($input, $name = NULL) { - if (user_access('access devel information')) { - $export = dprint_r($input, TRUE, $name, 'drupal_var_export', FALSE); - drupal_set_message($export); - } - return $input; -} - -/** - * Legacy function that was poorly named. - * - * @deprecated Use dpm() instead, since the 'p' maps to 'print_r'. - * - * @see dpm() - */ -function dsm($input, $name = NULL) { - return dpm($input, $name); -} - -/** - * An alias for dprint_r(). - * - * Saves carpal tunnel syndrome. - * - * @see dprint_r() - */ -function dpr($input, $return = FALSE, $name = NULL) { - return dprint_r($input, $return, $name); -} - -/** - * An alias for kprint_r(). - * - * Saves carpal tunnel syndrome. - * - * @see kprint_r() - */ -function kpr($input, $return = FALSE, $name = NULL) { - return kprint_r($input, $return, $name); -} - -/** - * Like dpr(), but uses drupal_var_export() instead. - * - * @see dprint_r() - * @see drupal_var_export() - */ -function dvr($input, $return = FALSE, $name = NULL) { - return dprint_r($input, $return, $name, 'drupal_var_export', FALSE); -} - -/** - * Returns a message using Krumo. - * - * Uses dprint_r() as a fallback. - * - * @param mixed $input - * The thing to print. - * @param boolean $return - * (optional) Indicates if the output should be returned. The default is - * FALSE. - * @param string $name - * (optional) The label to apply. - * @param string $function - * (optional) The function to use for output in the case where dprint_r() is - * used. The defualt is print_r(). - * - * @return - * The output if $return is TRUE. - */ -function kprint_r($input, $return = FALSE, $name = NULL, $function = 'print_r') { - // We do not want to krumo() strings and integers and such. - if (merits_krumo($input)) { - if (user_access('access devel information')) { - return $return ? (isset($name) ? $name . ' => ' : '') . krumo_ob($input) : krumo($input); - } - } - else { - return dprint_r($input, $return, $name, $function); - } -} - -/** - * Pretty-print a variable to the browser (no krumo). - * - * Displays only for users with proper permissions. If you want a string - * returned instead of a print, use the 2nd param. - * - * @param mixed $input - * The input that should be printed or returned. - * @param boolean $return - * (optional) Indicates of the result should be returned instead of printed. - * The default is to print it. - * @param string $name - * (optional) The label to apply. - * @param string $function - * (optional) The function to use for output. The defualt is print_r(). - * @param boolean $check - * (optional) Indicates if the output should be run through check_plain(). - * The default is TRUE. - * - * @return - * The formatted output if $return is TRUE. - */ -function dprint_r($input, $return = FALSE, $name = NULL, $function = 'print_r', $check = TRUE) { - if (user_access('access devel information')) { - if ($name) { - $name .= ' => '; - } - if ($function == 'drupal_var_export') { - include_once DRUPAL_ROOT . '/includes/utility.inc'; - $output = drupal_var_export($input); - } - else { - ob_start(); - $function($input); - $output = ob_get_clean(); - } - - if ($check) { - $output = check_plain($output); - } - if (is_array($input) && count($input, COUNT_RECURSIVE) > DEVEL_MIN_TEXTAREA) { - // Don't use fapi here because sometimes fapi will not be loaded. - $printed_value = "'; - } - else { - $printed_value = '
    ' . $name . $output . '
    '; - } - - if ($return) { - return $printed_value; - } - else { - print $printed_value; - } - } -} - -/** - * Prints a renderable array element to the screen using kprint_r(). - * - * #pre_render and/or #post_render pass-through callback for kprint_r(). - * - * @todo Investigate appending to #suffix. - * @todo Investigate label derived from #id, #title, #name, and #theme. - */ -function devel_render() { - $args = func_get_args(); - // #pre_render and #post_render pass the rendered $element as last argument. - kprint_r(end($args)); - // #pre_render and #post_render expect the first argument to be returned. - return reset($args); -} - -/** - * Prints the function call stack. - * - * @param $return - * Pass TRUE to return the formatted backtrace rather than displaying it in - * the browser via kprint_r(). - * @param $pop - * How many items to pop from the top of the stack; useful when calling from - * an error handler. - * @param $options - * Options to pass on to PHP's debug_backtrace(), depending on your PHP - * version. - * - * @return string|NULL - * The formatted backtrace, if requested, or NULL. - * - * @see http://php.net/manual/en/function.debug-backtrace.php - */ -function ddebug_backtrace($return = FALSE, $pop = 0, $options = TRUE) { - if (user_access('access devel information')) { - $backtrace = debug_backtrace($options); - while ($pop-- > 0) { - array_shift($backtrace); - } - $counter = count($backtrace); - if (!empty($backtrace[$counter - 1]['file'])) { - $path = $backtrace[$counter - 1]['file']; - $path = substr($path, 0, strlen($path) - 10); - $paths[$path] = strlen($path) + 1; - } - $paths[DRUPAL_ROOT] = strlen(DRUPAL_ROOT) + 1; - $nbsp = "\xC2\xA0"; - - // Show message if error_level is ERROR_REPORTING_DISPLAY_SOME or higher. - // (This is Drupal's error_level, which is different from $error_level, - // and we purposely ignore the difference between _SOME and _ALL, - // see #970688!) - if (variable_get('error_level', 1) >= 1) { - while (!empty($backtrace)) { - $call = array(); - if (isset($backtrace[0]['file'])) { - $call['file'] = $backtrace[0]['file']; - foreach ($paths as $path => $len) { - if (strpos($backtrace[0]['file'], $path) === 0) { - $call['file'] = substr($backtrace[0]['file'], $len); - } - } - $call['file'] .= ':' . $backtrace[0]['line']; - } - if (isset($backtrace[1])) { - if (isset($backtrace[1]['class'])) { - $function = $backtrace[1]['class'] . $backtrace[1]['type'] . $backtrace[1]['function'] . '()'; - } - else { - $function = $backtrace[1]['function'] . '()'; - } - $backtrace[1] += array('args' => array()); - $call['args'] = $backtrace[1]['args']; - } - else { - $function = 'main()'; - $call['args'] = $_GET; - } - $nicetrace[($counter <= 10 ? $nbsp : '') . --$counter . ': ' . $function] = $call; - array_shift($backtrace); - } - if ($return) { - return $nicetrace; - } - kprint_r($nicetrace); - } - } -} - -/** - * Deletes all files in a dir. - */ -function devel_empty_dir($dir) { - foreach (new DirectoryIterator($dir) as $file_info) { - if ($file_info->isFile()) { - unlink($file_info->getPathname()); - } - } -} - -/* - * Migration-related functions. - */ - -/** - * Regenerates the data in node_comment_statistics table. - * - * Technique - http://www.artfulsoftware.com/infotree/queries.php?&bw=1280#101 - */ -function devel_rebuild_node_comment_statistics() { - // Empty table. - db_truncate('node_comment_statistics')->execute(); - - // TODO: DBTNG. Ignore keyword is Mysql only? Is only used in the rare case - // when two comments on the same node share same timestamp. - $sql = " - INSERT IGNORE INTO {node_comment_statistics} (nid, cid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) ( - SELECT c.nid, c.cid, c.created, c.name, c.uid, c2.comment_count FROM {comment} c - JOIN ( - SELECT c.nid, MAX(c.created) AS created, COUNT(*) AS comment_count FROM {comment} c WHERE status = 1 GROUP BY c.nid - ) AS c2 ON c.nid = c2.nid AND c.created = c2.created - )"; - db_query($sql, array(':published' => COMMENT_PUBLISHED)); - - // Insert records into the node_comment_statistics for nodes that are missing. - $query = db_select('node', 'n'); - $query->leftJoin('node_comment_statistics', 'ncs', 'ncs.nid = n.nid'); - $query->addField('n', 'changed', 'last_comment_timestamp'); - $query->addField('n', 'uid', 'last_comment_uid'); - $query->addField('n', 'nid'); - $query->addExpression('0', 'comment_count'); - $query->addExpression('NULL', 'last_comment_name'); - $query->isNull('ncs.comment_count'); - - db_insert('node_comment_statistics', array('return' => Database::RETURN_NULL)) - ->from($query) - ->execute(); -} - -/** - * Implements hook_form_alter(). - * - * Adds mouse-over hints on the Permissions page to display language-independent - * machine names and module base names. - */ -function devel_form_user_admin_permissions_alter(&$form, &$form_state) { - if (user_access('access devel information') && variable_get('devel_raw_names', FALSE)) { - foreach ($form['permission'] as $perm => $data) { - if (is_numeric($perm)) { - $form['permission'][$perm]['#markup'] = '' . $form['permission'][$perm]['#markup'] . ''; - } - else { - $form['permission'][$perm]['#markup'] = '' . $form['permission'][$perm]['#markup'] . ''; - } - } - } -} - -/** - * Implements hook_form_alter(). - * - * Adds mouse-over hints on the Modules page to display module base names. - */ -function devel_form_system_modules_alter(&$form, &$form_state) { - if (user_access('access devel information') && variable_get('devel_raw_names', FALSE) && isset($form['modules']) && is_array($form['modules'])) { - foreach (element_children($form['modules']) as $key) { - if (isset($form['modules'][$key]['name']['#markup'])) { - $form['modules'][$key]['name']['#markup'] = '' . $form['modules'][$key]['name']['#markup'] . ''; - } - elseif (is_array($form['modules'][$key])) { - foreach (element_children($form['modules'][$key]) as $key2) { - if (isset($form['modules'][$key][$key2]['name']['#markup'])) { - $form['modules'][$key][$key2]['name']['#markup'] = '' . $form['modules'][$key][$key2]['name']['#markup'] . ''; - } - } - } - } - } -} - -/** - * Implements hook_query_TAG_alter() for the devel tag. - * - * Makes debugging EntityFieldQuery much easier. - * - * Example usage: - * @code - * $q = new EntityFieldQuery; - * $q->entityCondition('entity_type', 'node') - * ->addTag('debug') - * ->execute(); - * @endcode - * - * @param QueryAlterableInterface $query - */ -function devel_query_debug_alter(QueryAlterableInterface $query) { - if (!$query->hasTag('debug-semaphore')) { - $query->addTag('debug-semaphore'); - dpq($query); - } -} diff --git a/html/sites/all/modules/contrib/devel/devel.pages.inc b/html/sites/all/modules/contrib/devel/devel.pages.inc deleted file mode 100644 index c93eda53b..000000000 --- a/html/sites/all/modules/contrib/devel/devel.pages.inc +++ /dev/null @@ -1,417 +0,0 @@ - $links)); -} - -/** - * Page callback: Clears all caches, then redirects to the previous page. - */ -function devel_cache_clear() { - if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], 'devel-cache-clear')) { - return MENU_ACCESS_DENIED; - } - - drupal_flush_all_caches(); - - drupal_set_message('Cache cleared.'); - - drupal_goto(); -} - -/** - * Page callback: Called by the AJAX link in query log. - */ -function devel_querylog_explain($request_id, $qid) { - if (!is_numeric($request_id)) { - return MENU_ACCESS_DENIED; - } - - $path = "temporary://devel_querylog/$request_id.txt"; - $path = file_stream_wrapper_uri_normalize($path); - - $output = t('No explain log found.'); - - if (file_exists($path)) { - $queries = json_decode(file_get_contents($path)); - - if ($queries !== FALSE && isset($queries[$qid])) { - $header = $rows = array(); - - $query = $queries[$qid]; - $result = db_query('EXPLAIN ' . $query->query, (array)$query->args)->fetchAllAssoc('table'); - $i = 1; - foreach ($result as $row) { - $row = (array)$row; - if ($i == 1) { - $header = array_keys($row); - } - $rows[] = array_values($row); - $i++; - } - - $output = theme('table', array('header' => $header, 'rows' => $rows)); - } - } - - // Print and return nothing thus avoiding page wrapper. - print $output; - $GLOBALS['devel_shutdown'] = FALSE; -} - -/** - * Page callback: Called by the AJAX link in query log. - */ -function devel_querylog_arguments($request_id, $qid) { - if (!is_numeric($request_id)) { - return MENU_ACCESS_DENIED; - } - - $path = "temporary://devel_querylog/$request_id.txt"; - $path = file_stream_wrapper_uri_normalize($path); - - $output = t('No arguments log found.'); - - if (file_exists($path)) { - $queries = json_decode(file_get_contents($path)); - - if ($queries !== FALSE && isset($queries[$qid])) { - $query = $queries[$qid]; - $conn = Database::getConnection(); - $quoted = array(); - foreach ((array)$query->args as $key => $val) { - $quoted[$key] = $conn->quote($val); - } - $output = strtr($query->query, $quoted); - } - } - - // Print and return nothing thus avoiding page wrapper. - print $output; - $GLOBALS['devel_shutdown'] = FALSE; -} - -/** - * Page callback: Clears the database, resetting the menu to factory defaults. - */ -function devel_menu_rebuild() { - menu_rebuild(); - drupal_set_message(t('The menu router has been rebuilt.')); - drupal_goto(); -} - -/** - * Form constructor for reinstalling any module from a dropdown. - * - * @see devel_reinstall_submit() - * - * @ingroup forms - */ -function devel_reinstall($form, &$form_state) { - $output = ''; - $modules = module_list(); - sort($modules); - $options = drupal_map_assoc($modules); - $form['list'] = array( - '#type' => 'checkboxes', - '#options' => $options, - '#description' => t('Uninstall and then install the selected modules. hook_uninstall() and hook_install() will be executed and the schema version number will be set to the most recent update number. You may have to manually clear out any existing tables first if the module doesn\'t implement hook_uninstall().'), - ); - $form['actions'] = array('#type' => 'actions'); - $form['actions']['submit'] = array( - '#value' => t('Reinstall'), - '#type' => 'submit', - ); - return $form; -} - -/** - * Form submission callback for devel_reinstall(). - */ -function devel_reinstall_submit($form, &$form_state) { - // require_once './includes/install.inc'; - $modules = array_filter($form_state['values']['list']); - module_disable($modules, FALSE); - drupal_uninstall_modules($modules, FALSE); - module_enable($modules, FALSE); - drupal_set_message(t('Uninstalled and installed: %names.', array('%names' => implode(', ', $modules)))); -} - -/** - * Page callback: Rebuilds the theme registry. - */ -function devel_theme_registry() { - drupal_theme_initialize(); - $hooks = theme_get_registry(); - ksort($hooks); - return kprint_r($hooks, TRUE); -} - -/** - * Page callback: Returns information from hook_entity_info(). - * - * @param string $entity_type - * (optional) Limit results to the specified entity type. The default is to - * return information about all entity types. The $entity_type argument is not - * currently used in the UI. - * - * @return - * The results from kprint_r(). - */ -function devel_entity_info_page($entity_type = NULL) { - $info = entity_get_info($entity_type); - ksort($info); - return kprint_r($info, TRUE); -} - -/** - * Page callback: Returns information about fields. - */ -function devel_field_info_page() { - $info = field_info_fields(); - $output = kprint_r($info, TRUE, t('Fields')); - $info = field_info_instances(); - $output .= kprint_r($info, TRUE, t('Instances')); - $info = field_info_bundles(); - $output .= kprint_r($info, TRUE, t('Bundles')); - $info = field_info_field_types(); - $output .= kprint_r($info, TRUE, t('Field types')); - $info = field_info_formatter_types(); - $output .= kprint_r($info, TRUE, t('Formatter types')); - $info = field_info_storage_types(); - $output .= kprint_r($info, TRUE, t('Storage types')); - $info = field_info_widget_types(); - $output .= kprint_r($info, TRUE, t('Widget types')); - return $output; -} - -/** - * Form constructor for displaying and editing variables. - * - * @see devel_variable_form_submit() - * - * @ingroup forms. - */ -function devel_variable_form() { - $header = array( - 'name' => array('data' => t('Name'), 'field' => 'name', 'sort' => 'asc'), - 'value' => array('data' => t('Value'), 'field' => 'value'), - 'length' => array('data' => t('Length'), 'field' => 'length'), - 'edit' => array('data' => t('Operations')), - ); - // @todo: We could get variables out of $conf but that would include - // hard-coded ones too. Ideally I would highlight overridden/hard-coded - // variables. - $query = db_select('variable', 'v')->extend('TableSort'); - $query->fields('v', array('name', 'value')); - switch (db_driver()) { - case 'mssql': - $query->addExpression("LEN(v.value)", 'length'); - break; - default: - $query->addExpression("LENGTH(v.value)", 'length'); - break; - } - $result = $query - ->orderByHeader($header) - ->execute(); - - foreach ($result as $row) { - // $variables[$row->name] = ''; - $options[$row->name]['name'] = check_plain($row->name); - if (merits_krumo($row->value)) { - $value = krumo_ob(variable_get($row->name, NULL)); - } - else { - if (drupal_strlen($row->value) > 70) { - $value = check_plain(drupal_substr($row->value, 0, 65)) .'...'; - } - else { - $value = check_plain($row->value); - } - } - $options[$row->name]['value'] = $value; - $options[$row->name]['length'] = $row->length; - $options[$row->name]['edit'] = l(t('Edit'), "devel/variable/edit/$row->name"); - } - $form['variables'] = array( - '#type' => 'tableselect', - '#header' => $header, - '#options' => $options, - '#empty' => t('No variables.'), - ); - $form['actions'] = array('#type' => 'actions'); - $form['actions']['submit'] = array( - '#type' => 'submit', - '#value' => t('Delete'), - ); - $form['#after_build'][] = 'devel_variable_form_after_build'; - - // krumo($form); - return $form; -} - -/** - * Form submission handler for devel_variable_form(). - */ -function devel_variable_form_submit($form, &$form_state) { - $deletes = array_filter($form_state['values']['variables']); - array_walk($deletes, 'variable_del'); - if (count($deletes)) { - drupal_set_message(format_plural(count($deletes), 'One variable deleted.', '@count variables deleted.')); - } -} - -/** - * After build callback for devel_variable_form(). - * - * Wrap each variable name in a