From 2ffad149392dfb74b639d63b1b55d277a5e52de7 Mon Sep 17 00:00:00 2001 From: Bachir Soussi Chiadmi Date: Mon, 13 May 2019 17:51:14 +0200 Subject: [PATCH] updated etxlink, ctools, colorbox, computed_field --- PATCH_LIST.txt => PATCH_LIST.md | 10 - .../modules/contrib/dev/ctools/CHANGELOG.txt | 82 -- .../modules/contrib/dev/ctools/UPGRADE.txt | 2 +- .../dev/ctools/bulk_export/bulk_export.info | 9 +- .../dev/ctools/bulk_export/bulk_export.module | 5 +- .../modules/contrib/dev/ctools/css/button.css | 4 +- .../dev/ctools/css/collapsible-div.css | 5 +- .../modules/contrib/dev/ctools/css/ctools.css | 4 +- .../contrib/dev/ctools/css/dropbutton.css | 3 +- .../contrib/dev/ctools/css/dropdown.css | 6 +- .../modules/contrib/dev/ctools/css/modal.css | 2 +- .../contrib/dev/ctools/css/stylizer.css | 6 +- .../modules/contrib/dev/ctools/css/wizard.css | 1 - .../modules/contrib/dev/ctools/ctools.api.php | 54 +- .../modules/contrib/dev/ctools/ctools.info | 10 +- .../modules/contrib/dev/ctools/ctools.install | 78 +- .../modules/contrib/dev/ctools/ctools.module | 215 +++- .../ctools_access_ruleset.info | 8 +- .../ctools_access_ruleset.install | 4 + .../ctools_access_ruleset.module | 6 +- .../plugins/access/ruleset.inc | 5 +- .../export_ui/ctools_access_ruleset.inc | 5 +- .../ctools_access_ruleset_ui.class.php | 9 +- .../css/ctools-ajax-sample.css | 151 +-- .../ctools_ajax_sample.info | 8 +- .../ctools_ajax_sample.install | 6 +- .../ctools_ajax_sample.module | 136 +-- .../ctools_custom_content.info | 8 +- .../ctools_custom_content.install | 4 + .../ctools_custom_content.module | 8 +- .../export_ui/ctools_custom_content.inc | 5 +- .../ctools_custom_content_ui.class.php | 20 +- .../ctools/ctools_plugin_example/README.txt | 2 +- .../ctools_plugin_example.info | 8 +- .../ctools_plugin_example.module | 12 +- .../ctools_plugin_example.pages_default.inc | 178 ++-- .../plugins/access/arg_length.inc | 7 +- .../plugins/access/example_role.inc | 3 +- .../plugins/arguments/simplecontext_arg.inc | 7 +- .../content_types/no_context_content_type.inc | 6 +- .../content_types/relcontext_content_type.inc | 7 +- .../simplecontext_content_type.inc | 5 +- .../plugins/contexts/relcontext.inc | 1 - .../plugins/contexts/simplecontext.inc | 12 +- .../plugins/panels.pages.inc | 137 ++- .../relcontext_from_simplecontext.inc | 4 - .../contrib/dev/ctools/drush/ctools.drush.inc | 79 +- .../contrib/dev/ctools/help/export.html | 2 +- .../contrib/dev/ctools/help/modal.html | 4 +- .../dev/ctools/help/plugins-creating.html | 3 +- .../ctools/includes/action-links.theme.inc | 3 +- .../contrib/dev/ctools/includes/ajax.inc | 21 +- .../contrib/dev/ctools/includes/cache.inc | 9 +- .../dev/ctools/includes/cleanstring.inc | 21 +- .../dev/ctools/includes/collapsible.theme.inc | 9 +- .../contrib/dev/ctools/includes/content.inc | 48 +- .../dev/ctools/includes/content.menu.inc | 15 +- .../ctools/includes/content.plugin-type.inc | 2 +- .../ctools/includes/context-access-admin.inc | 20 +- .../dev/ctools/includes/context-admin.inc | 8 +- .../ctools/includes/context-task-handler.inc | 55 +- .../contrib/dev/ctools/includes/context.inc | 934 +++++++++++++----- .../dev/ctools/includes/context.menu.inc | 2 +- .../dev/ctools/includes/context.theme.inc | 44 +- .../contrib/dev/ctools/includes/css.inc | 19 +- .../contrib/dev/ctools/includes/dependent.inc | 9 +- .../dev/ctools/includes/dropbutton.theme.inc | 20 +- .../dev/ctools/includes/dropdown.theme.inc | 42 +- .../dev/ctools/includes/entity-access.inc | 6 +- .../contrib/dev/ctools/includes/export-ui.inc | 12 +- .../dev/ctools/includes/export-ui.menu.inc | 4 + .../ctools/includes/export-ui.plugin-type.inc | 2 +- .../contrib/dev/ctools/includes/export.inc | 40 +- .../contrib/dev/ctools/includes/fields.inc | 54 +- .../contrib/dev/ctools/includes/jump-menu.inc | 3 +- .../contrib/dev/ctools/includes/language.inc | 7 +- .../contrib/dev/ctools/includes/math-expr.inc | 5 +- .../contrib/dev/ctools/includes/modal.inc | 16 +- .../dev/ctools/includes/object-cache.inc | 29 +- .../dev/ctools/includes/page-wizard.inc | 6 +- .../dev/ctools/includes/plugins-admin.inc | 11 +- .../contrib/dev/ctools/includes/plugins.inc | 115 ++- .../contrib/dev/ctools/includes/registry.inc | 1 - .../contrib/dev/ctools/includes/stylizer.inc | 14 +- .../dev/ctools/includes/stylizer.theme.inc | 1 - .../contrib/dev/ctools/includes/utility.inc | 2 +- .../contrib/dev/ctools/includes/uuid.inc | 1 + .../contrib/dev/ctools/includes/views.inc | 4 + .../contrib/dev/ctools/includes/wizard.inc | 44 +- .../modules/contrib/dev/ctools/js/modal.js | 55 +- .../ctools/page_manager/css/page-manager.css | 12 +- .../page_manager/page_manager.admin.inc | 6 +- .../dev/ctools/page_manager/page_manager.info | 10 +- .../ctools/page_manager/page_manager.module | 29 +- .../plugins/cache/page_manager_context.inc | 4 +- .../plugins/task_handlers/http_response.inc | 13 +- .../page_manager/plugins/tasks/blog.inc | 9 +- .../page_manager/plugins/tasks/blog_user.inc | 9 +- .../plugins/tasks/comment_reply.inc | 16 +- .../plugins/tasks/contact_site.inc | 9 +- .../plugins/tasks/contact_user.inc | 9 +- .../page_manager/plugins/tasks/node_edit.inc | 9 +- .../page_manager/plugins/tasks/node_view.inc | 24 +- .../page_manager/plugins/tasks/page.admin.inc | 51 +- .../page_manager/plugins/tasks/page.inc | 46 +- .../page_manager/plugins/tasks/poll.inc | 9 +- .../page_manager/plugins/tasks/search.inc | 24 +- .../page_manager/plugins/tasks/term_view.inc | 20 +- .../page_manager/plugins/tasks/user_edit.inc | 14 +- .../page_manager/plugins/tasks/user_view.inc | 8 +- .../ctools/page_manager/tests/head_links.test | 77 ++ .../theme/page-manager-edit-page.tpl.php | 5 +- .../page_manager/theme/page_manager.theme.inc | 8 +- .../ctools/plugins/access/compare_users.inc | 6 +- .../ctools/plugins/access/context_exists.inc | 10 +- .../ctools/plugins/access/entity_bundle.inc | 3 +- .../plugins/access/entity_field_value.inc | 21 +- .../dev/ctools/plugins/access/front.inc | 2 +- .../dev/ctools/plugins/access/node_access.inc | 3 +- .../ctools/plugins/access/node_comment.inc | 1 + .../ctools/plugins/access/node_language.inc | 3 +- .../dev/ctools/plugins/access/node_status.inc | 1 - .../dev/ctools/plugins/access/node_type.inc | 3 +- .../ctools/plugins/access/path_visibility.inc | 4 +- .../dev/ctools/plugins/access/perm.inc | 5 +- .../contrib/dev/ctools/plugins/access/php.inc | 4 +- .../plugins/access/query_string_exists.inc | 2 +- .../dev/ctools/plugins/access/role.inc | 3 +- .../ctools/plugins/access/site_language.inc | 3 +- .../ctools/plugins/access/string_equal.inc | 15 +- .../ctools/plugins/access/string_length.inc | 5 + .../dev/ctools/plugins/access/term.inc | 9 +- .../ctools/plugins/access/term_has_parent.inc | 38 +- .../dev/ctools/plugins/access/term_parent.inc | 2 +- .../ctools/plugins/access/term_vocabulary.inc | 10 +- .../dev/ctools/plugins/access/theme.inc | 6 +- .../ctools/plugins/arguments/entity_id.inc | 1 - .../dev/ctools/plugins/arguments/nid.inc | 4 +- .../dev/ctools/plugins/arguments/node_add.inc | 6 +- .../ctools/plugins/arguments/node_edit.inc | 6 +- .../dev/ctools/plugins/arguments/rid.inc | 4 +- .../dev/ctools/plugins/arguments/string.inc | 14 +- .../dev/ctools/plugins/arguments/term.inc | 16 +- .../dev/ctools/plugins/arguments/terms.inc | 8 +- .../dev/ctools/plugins/arguments/uid.inc | 8 +- .../ctools/plugins/arguments/user_edit.inc | 11 +- .../ctools/plugins/arguments/user_name.inc | 8 +- .../dev/ctools/plugins/arguments/vid.inc | 6 +- .../dev/ctools/plugins/cache/export_ui.inc | 2 +- .../dev/ctools/plugins/cache/simple.inc | 2 +- .../plugins/content_types/block/block.inc | 82 +- .../content_types/comment/comment_created.inc | 4 +- .../content_types/comment/comment_links.inc | 4 +- .../comment/comment_reply_form.inc | 14 +- .../plugins/content_types/contact/contact.inc | 17 +- .../content_types/contact/user_contact.inc | 17 +- .../plugins/content_types/custom/custom.inc | 19 +- .../entity_context/entity_field.inc | 30 +- .../entity_context/entity_field_extra.inc | 6 +- .../content_types/form/entity_form_field.inc | 19 +- .../plugins/content_types/form/form.inc | 8 +- .../plugins/content_types/node/node.inc | 9 +- .../node_context/node_attachments.inc | 5 +- .../node_context/node_author.inc | 4 +- .../content_types/node_context/node_body.inc | 4 +- .../node_context/node_book_children.inc | 6 +- .../node_context/node_book_menu.inc | 18 +- .../node_context/node_book_nav.inc | 8 +- .../node_context/node_comment_form.inc | 20 +- .../node_context/node_comment_wrapper.inc | 11 +- .../node_context/node_comments.inc | 23 +- .../node_context/node_content.inc | 11 +- .../node_context/node_created.inc | 6 +- .../content_types/node_context/node_links.inc | 5 +- .../content_types/node_context/node_terms.inc | 14 +- .../content_types/node_context/node_title.inc | 10 +- .../node_context/node_type_desc.inc | 10 +- .../node_context/node_updated.inc | 4 +- .../node_form/node_form_attachments.inc | 8 +- .../node_form/node_form_author.inc | 6 +- .../node_form/node_form_book.inc | 8 +- .../node_form/node_form_buttons.inc | 6 +- .../node_form/node_form_comment.inc | 8 +- .../node_form/node_form_language.inc | 8 +- .../content_types/node_form/node_form_log.inc | 6 +- .../node_form/node_form_menu.inc | 8 +- .../node_form/node_form_path.inc | 8 +- .../node_form/node_form_publishing.inc | 4 +- .../node_form/node_form_title.inc | 6 +- .../plugins/content_types/page/page_help.inc | 1 - .../plugins/content_types/page/page_logo.inc | 2 +- .../content_types/page/page_messages.inc | 1 - .../content_types/page/page_site_name.inc | 2 +- .../plugins/content_types/page/page_tabs.inc | 2 +- .../plugins/content_types/page/page_title.inc | 5 +- .../content_types/search/search_form.inc | 13 +- .../content_types/search/search_result.inc | 13 +- .../term_context/term_description.inc | 4 +- .../content_types/term_context/term_list.inc | 7 +- .../content_types/term_context/term_name.inc | 9 +- .../plugins/content_types/token/token.inc | 15 +- .../user_context/profile_fields.inc | 15 +- .../user_context/profile_fields_pane.tpl.php | 1 + .../content_types/user_context/user_links.inc | 4 +- .../user_context/user_picture.inc | 9 +- .../user_context/user_profile.inc | 3 +- .../user_context/user_signature.inc | 6 +- .../vocabulary_context/vocabulary_terms.inc | 11 +- .../dev/ctools/plugins/contexts/entity.inc | 11 +- .../dev/ctools/plugins/contexts/language.inc | 169 ++++ .../dev/ctools/plugins/contexts/node.inc | 5 +- .../ctools/plugins/contexts/node_add_form.inc | 15 +- .../plugins/contexts/node_edit_form.inc | 11 +- .../ctools/plugins/contexts/query_string.inc | 5 +- .../dev/ctools/plugins/contexts/string.inc | 8 +- .../dev/ctools/plugins/contexts/term.inc | 9 +- .../dev/ctools/plugins/contexts/terms.inc | 11 +- .../dev/ctools/plugins/contexts/token.inc | 30 +- .../dev/ctools/plugins/contexts/user.inc | 6 +- .../plugins/contexts/user_edit_form.inc | 9 +- .../ctools/plugins/contexts/vocabulary.inc | 3 +- .../export_ui/ctools_export_ui.class.php | 127 +-- .../plugins/export_ui/ctools_export_ui.inc | 2 + .../relationships/entity_from_field.inc | 2 +- .../entity_from_query_string.inc | 2 +- .../relationships/entity_from_schema.inc | 2 +- .../plugins/relationships/term_parent.inc | 2 +- .../plugins/relationships/terms_from_node.inc | 20 +- .../user_category_edit_form_from_user.inc | 4 +- .../stylizer/plugins/export_ui/stylizer.inc | 5 +- .../plugins/export_ui/stylizer_ui.class.php | 53 +- .../contrib/dev/ctools/stylizer/stylizer.info | 8 +- .../dev/ctools/stylizer/stylizer.install | 4 + .../dev/ctools/stylizer/stylizer.module | 12 +- .../term_depth/plugins/access/term_depth.inc | 6 +- .../dev/ctools/term_depth/term_depth.info | 8 +- .../dev/ctools/term_depth/term_depth.module | 4 + .../contrib/dev/ctools/tests/context.test | 322 +++++- .../modules/contrib/dev/ctools/tests/css.test | 80 +- .../contrib/dev/ctools/tests/css_cache.test | 14 +- .../contrib/dev/ctools/tests/ctools.drush.sh | 0 .../dev/ctools/tests/ctools.plugins.test | 74 +- .../contrib/dev/ctools/tests/ctools.test | 239 +++++ .../ctools_export_test/ctools_export.test | 42 +- ...xport_test.default_ctools_export_tests.inc | 4 + .../ctools_export_test.info | 8 +- .../ctools_export_test.install | 12 +- .../ctools_export_test.module | 4 + .../dev/ctools/tests/ctools_plugin_test.info | 14 +- .../ctools/tests/ctools_plugin_test.module | 38 +- .../dev/ctools/tests/math_expression.test | 36 +- .../ctools/tests/math_expression_stack.test | 32 +- .../dev/ctools/tests/object_cache.test | 25 +- .../dev/ctools/tests/object_cache_unit.test | 141 +++ .../contrib/dev/ctools/tests/page_tokens.test | 136 +++ .../cached/ctoolsCachedPluginArray.class.php | 1 + .../cached/ctoolsCachedPluginArray2.class.php | 1 + .../tests/plugins/cached/plugin_array.inc | 4 +- .../tests/plugins/cached/plugin_array2.inc | 4 +- .../tests/plugins/cached/plugin_array_dne.inc | 1 + .../ctoolsNotCachedPluginArray.class.php | 1 + .../ctoolsNotCachedPluginArray2.class.php | 1 + .../tests/plugins/not_cached/plugin_array.inc | 4 +- .../plugins/not_cached/plugin_array2.inc | 4 +- .../plugins/not_cached/plugin_array_dne.inc | 1 + .../plugins/content_types/views.inc | 19 +- .../content_types/views_attachments.inc | 3 +- .../plugins/content_types/views_empty.inc | 2 +- .../plugins/content_types/views_exposed.inc | 2 +- .../plugins/content_types/views_feed.inc | 2 +- .../plugins/content_types/views_footer.inc | 2 +- .../plugins/content_types/views_header.inc | 2 +- .../plugins/content_types/views_pager.inc | 2 +- .../plugins/content_types/views_panes.inc | 149 ++- .../plugins/content_types/views_row.inc | 4 +- .../plugins/content_types/views_view.inc | 2 +- .../views_content/plugins/contexts/view.inc | 9 +- .../plugins/relationships/node_from_view.inc | 2 +- .../relationships/view_from_argument.inc | 4 +- .../plugins/views/views_content.views.inc | 2 +- ..._content_plugin_display_ctools_context.inc | 40 +- ...iews_content_plugin_display_panel_pane.inc | 191 +--- ...ws_content_plugin_style_ctools_context.inc | 5 +- .../ctools/views_content/views_content.info | 8 +- .../ctools/views_content/views_content.module | 29 +- .../fields/computed_field/computed_field.info | 9 +- .../computed_field/computed_field.install | 31 +- .../computed_field/computed_field.module | 197 ++-- .../theming/colorbox/colorbox.admin.inc | 10 +- .../contrib/theming/colorbox/colorbox.info | 6 +- .../contrib/theming/colorbox/colorbox.module | 14 +- .../theming/colorbox/colorbox.theme.inc | 14 +- .../theming/colorbox/drush/colorbox.drush.inc | 58 +- .../contrib/theming/colorbox/js/colorbox.js | 5 + .../colorbox/js/colorbox_admin_settings.js | 5 + .../theming/colorbox/js/colorbox_inline.js | 5 + .../theming/colorbox/js/colorbox_load.js | 6 +- .../colorbox/styles/default/colorbox_style.js | 5 + .../colorbox/styles/plain/colorbox_style.js | 5 + .../stockholmsyndrome/colorbox_style.js | 5 + .../theming/colorbox/views/colorbox.views.inc | 2 +- .../views/colorbox_handler_field_colorbox.inc | 6 +- .../contrib/theming/extlink/README.txt | 26 +- .../contrib/theming/extlink/extlink.css | 3 +- .../contrib/theming/extlink/extlink.info | 7 +- .../contrib/theming/extlink/extlink.install | 26 +- .../contrib/theming/extlink/extlink.js | 337 ++++--- .../contrib/theming/extlink/extlink.module | 112 ++- .../contrib/theming/extlink/extlink.test | 84 +- 309 files changed, 4930 insertions(+), 2655 deletions(-) rename PATCH_LIST.txt => PATCH_LIST.md (78%) delete mode 100644 sites/all/modules/contrib/dev/ctools/CHANGELOG.txt create mode 100644 sites/all/modules/contrib/dev/ctools/page_manager/tests/head_links.test create mode 100644 sites/all/modules/contrib/dev/ctools/plugins/contexts/language.inc mode change 100644 => 100755 sites/all/modules/contrib/dev/ctools/tests/ctools.drush.sh create mode 100644 sites/all/modules/contrib/dev/ctools/tests/ctools.test create mode 100644 sites/all/modules/contrib/dev/ctools/tests/object_cache_unit.test create mode 100644 sites/all/modules/contrib/dev/ctools/tests/page_tokens.test diff --git a/PATCH_LIST.txt b/PATCH_LIST.md similarity index 78% rename from PATCH_LIST.txt rename to PATCH_LIST.md index fdf87e58..0dde4cca 100644 --- a/PATCH_LIST.txt +++ b/PATCH_LIST.md @@ -6,22 +6,12 @@ https://www.drupal.org/node/1754162 //includes/entity.inc //see https://www.drupal.org/node/1003788 - # Modules : - -// link : allow any tld (https://www.drupal.org/node/2299657#comment-11414075) commited in dev cer contentadminrelink -// entity_translation_search_api entityreference feedback -// field_group filter_path_alias -// flag_lists -// nodeformcols -// search_api -// search_api_page -// search_api_solr termreferencetree ?? views wysiwyg diff --git a/sites/all/modules/contrib/dev/ctools/CHANGELOG.txt b/sites/all/modules/contrib/dev/ctools/CHANGELOG.txt deleted file mode 100644 index c5bd5e6d..00000000 --- a/sites/all/modules/contrib/dev/ctools/CHANGELOG.txt +++ /dev/null @@ -1,82 +0,0 @@ -Current API VERSION: 2.0. See API.txt for more information. - -ctools 7.x-1.x-dev -================== -#1008120: "New custom content" shows empty form if custom content panes module is not enabled. -#999302 by troky: Fix jump menu. Apparently this wasn't actually committed the last time it was committed. -#1065976 by tekante and David_Rothstein: Reset plugin static cache during module enable to prevent stale data from harming export ui. -#1016510 by EclipseGC: Make the taxonomy system page functional. - -ctools 7.x-1.x-alpha2 (05-Jan-2011) -=================================== - -#911396 by alex_b: Prevent notices in export UI. -#919768 by mikey_p: Allow url options to be sent to ctools_ajax_command_url(). -#358953 by cedarm: Allow term context to return lowercase, spaces to dashes versions of terms. -#931434 by EclipseGc: Argument plugin for node revision ID. -#910656: CTools AJAX sample wizard demo "domesticated" checkbox value not stored. -#922442 by EugenMayer, neclimdul and voxpelli: Make sure ctools_include can handle '' or NULL directory. -#919956 by traviss359: Correct example in wizard advanced help. -#942968: Fix taxonomy term access rule with tag term vocabs. -#840344: node add argument had crufty code causing notices. -#944462 by longhairedgit: Invalid character in regex causes rare notice. -#938778 by dereine: Fix profile content type for D7 updates. -Add detach event to modal close so that wysiwyg can detach the editor. -Variant titles showing up as blank if more than one variant on a page. -#940016: token support was not yet updated for D7. -#940446: Skip validation on back and cancel buttons in all wizards. -#954492: Redirect not always working in wizard.inc -#955348: Lack of redirect on "Update" button in Page Manager causing data loss sometimes. -#941778: Update and save button should not appear in the "Add variant" path. -#955070 by EclipseGc: Update ctools internal page tokens to work properly on content all content. -#956890 by EclipseGc: Update views_content to not use views dependency since that is gone. -#954728 by EclipseGc: Update node template page function name to not collide with new hook_node_view(). -#946534 by EclipseGc: Add support for field content on all entitities. -#952586 by EclipseGc: Fix node_author content type. -#959206: If a context is not set when rendering content, attempt to guess the context (fixes Views panes where "From context" was added but pane was never edited.) -#961654 by benshell: drupal_alter() only supports 4 arguments. -#911362 by alex_b: Facilitate plugin cache resets for tests. -#945360 by naxoc: node_tag_new() not updated to D7. -#953804 by EclipseGc: Fix node comment rendering. -#953542 by EclipseGc: Fix node rendering. -#953776 by EclipseGc: Fix node link rendering. -#954772 by EclipseGc: Fix node build mode selection in node content type. -#954762 by EclipseGc: Fix comment forbidden theme call. -#954894 by EclipseGc: Fix breadcrumb content type. -#955180 by EclipseGc: Fix page primary navigation type. -#957190 by EclipseGc: Fix page secondary navigation type. -#957194 by EclipseGc: Remove mission content type, since D7 no longer has a site mission. -#957348 by EclipseGc: Fix search form URL path. -#952586 by andypost: Use format_username for displaying unlinked usernames. -#963800 by benshell: Fix query to fetch custom block title. -#983496 by Amitaibu: Fix term argument to use proper load function. -#989484 by Amitaibu: Fix notice in views plugin. -#982496: Fix token context. -#995026: Fix export UI during enable/disable which would throw notices and not properly set/unset menu items. -#998870 by Amitaibu: Fix notice when content has no icon by using function already designed for that. -#983576 by Amitaibu: Node view fallback task showed white screen. -#1004644 by pillarsdotnet: Update a missed theme() call to D7. -#1006162 by aspilicious: .info file cleanup. -#998312 by dereine: Support the expanded/hidden options that Views did for dependent.js -#955030: Remove no longer supported footer message content type. -Fix broken query in term context config. -#992022 by pcambra: Fix node autocomplete. -#946302 by BerdArt and arywyr: Fix PHP 5.3 reference error. -#980528 by das-peter: Notice fix with entity settings. -#999302 by troky: ctools_jump_menu() needed updating to new form parameters. -#964174: stylizer plugin theme delegation was in the wrong place, causing errors. -#991658 by burlap: Fully load the "user" context for the logged in user because not all fields are in $user. -#1014866 by das-peter: Smarter title panes, notice fix on access plugin descriptions. -#1015662 by troky: plugin .info files were not using correct filepaths. -#941780 by EclipseGc: Restore the "No blocks" functionality. -#951048 by EclipseGc: Tighter entity integration so that new entities are automatic contexts and relationships. -#941800 by me and aspilicious: Use Drupal 7 #machine_name automation on page manager pages and all export_ui defaults. -Disabled exportables and pages not properly greyed out. -#969208 by me and benshell: Get user_view and user profile working. -#941796: Recategorize blocks - -ctools 7.x-1.x-alpha1 -===================== - -Changelog reset for 7.x -Basic conversion done during sprint. diff --git a/sites/all/modules/contrib/dev/ctools/UPGRADE.txt b/sites/all/modules/contrib/dev/ctools/UPGRADE.txt index 844ecce4..2fbfa4f7 100644 --- a/sites/all/modules/contrib/dev/ctools/UPGRADE.txt +++ b/sites/all/modules/contrib/dev/ctools/UPGRADE.txt @@ -60,4 +60,4 @@ Upgrading from ctools-6.x-1.x to ctools-7.x-2.x: 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. \ No newline at end of file + using CTools form wizard instead of fake subforms as previously. diff --git a/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.info b/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.info index 22dc566a..9bb33944 100644 --- a/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.info +++ b/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.info @@ -3,12 +3,9 @@ description = Performs bulk exporting of data objects known about by Chaos tools core = 7.x dependencies[] = ctools package = Chaos tool suite -version = CTOOLS_MODULE_VERSION - -; Information added by Drupal.org packaging script on 2016-11-22 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.module b/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.module index afb15b9e..1050caa6 100644 --- a/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.module +++ b/sites/all/modules/contrib/dev/ctools/bulk_export/bulk_export.module @@ -137,7 +137,7 @@ function bulk_export_export($cli = FALSE, $options = array()) { // 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 = "\n/**\n"; $api .= " * Implements hook_$api_hook().\n"; $api .= " */\n"; $api .= "function {$module_name}_$api_hook(\$module, \$api) {\n"; @@ -148,7 +148,7 @@ function bulk_export_export($cli = FALSE, $options = array()) { } if ($module_code) { - $module = "conf['css_id'] = 'my-id'; +} + /** * @} End of "addtogroup hooks". */ diff --git a/sites/all/modules/contrib/dev/ctools/ctools.info b/sites/all/modules/contrib/dev/ctools/ctools.info index 3a2d031e..188b55dd 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools.info +++ b/sites/all/modules/contrib/dev/ctools/ctools.info @@ -12,13 +12,15 @@ 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 2016-11-22 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/ctools.install b/sites/all/modules/contrib/dev/ctools/ctools.install index e96c7432..d50bc9f8 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools.install +++ b/sites/all/modules/contrib/dev/ctools/ctools.install @@ -12,24 +12,25 @@ function ctools_requirements($phase) { $requirements = array(); if ($phase == 'runtime') { + $t = get_t(); $requirements['ctools_css_cache'] = array( - 'title' => t('CTools CSS Cache'), + 'title' => $t('CTools CSS Cache'), 'severity' => REQUIREMENT_OK, - 'value' => t('Exists'), + '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']['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'); + $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']['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())); + $requirements['ctools_php_52']['value'] = $t('PHP !version', array('!version' => phpversion())); } } @@ -40,7 +41,19 @@ function ctools_requirements($phase) { * Implements hook_schema(). */ function ctools_schema() { - return ctools_schema_3(); + 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; } /** @@ -49,7 +62,7 @@ function ctools_schema() { function ctools_schema_3() { $schema = ctools_schema_2(); - // update the 'obj' field to be 128 bytes long: + // Update the 'obj' field to be 128 bytes long: $schema['ctools_object_cache']['fields']['obj']['length'] = 128; return $schema; @@ -61,7 +74,7 @@ function ctools_schema_3() { function ctools_schema_2() { $schema = ctools_schema_1(); - // update the 'name' field to be 128 bytes long: + // 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'. @@ -95,10 +108,10 @@ function ctools_schema_2() { 'serialize' => TRUE, ), 'filter' => array( - 'type' => 'int', - 'size' => 'tiny', - 'description' => 'Whether or not this CSS needs to be filtered.', - ), + 'type' => 'int', + 'size' => 'tiny', + 'description' => 'Whether or not this CSS needs to be filtered.', + ), ), 'primary key' => array('cid'), ); @@ -197,7 +210,7 @@ function ctools_update_6003() { if ($result) { db_delete('system')->condition('name', 'panels_views')->execute(); module_enable(array('views_content'), TRUE); - } + } } /** @@ -216,7 +229,7 @@ function ctools_update_6005() { } /** - * ctools_custom_content table was originally here, but is now moved to + * The ctools_custom_content table was originally here, but is now moved to * its own module. */ function ctools_update_6007() { @@ -230,18 +243,18 @@ function ctools_update_6007() { } /** - * ctools_object_cache needs to be defined as a blob. + * 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, - ) + 'type' => 'blob', + 'size' => 'big', + 'description' => 'Serialized data being stored.', + 'serialize' => TRUE, + ) ); } @@ -263,3 +276,24 @@ function ctools_update_7001() { '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/sites/all/modules/contrib/dev/ctools/ctools.module b/sites/all/modules/contrib/dev/ctools/ctools.module index 78ac26bc..62f29192 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools.module +++ b/sites/all/modules/contrib/dev/ctools/ctools.module @@ -22,8 +22,11 @@ define('CTOOLS_API_VERSION', '2.0.9'); * 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.11'); +define('CTOOLS_MODULE_VERSION', '7.x-1.13'); /** * Test the CTools API version. @@ -75,6 +78,9 @@ define('CTOOLS_MODULE_VERSION', '7.x-1.11'); * 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, '<')) { @@ -89,8 +95,7 @@ function ctools_api_version($minimum, $maximum = NULL) { } // ----------------------------------------------------------------------- -// General utility functions - +// General utility functions. /** * Include .inc files as necessary. * @@ -118,6 +123,7 @@ function ctools_api_version($minimum, $maximum = NULL) { * @param $dir * Optional subdirectory containing the include file. */ + function ctools_include($file, $module = 'ctools', $dir = 'includes') { static $used = array(); @@ -147,8 +153,8 @@ function ctools_form_include(&$form_state, $file, $module = 'ctools', $dir = 'in /** * Add an arbitrary path to the $form_state so it can work with form cache. * - * module_load_include uses an unfortunately annoying syntax to work, making it - * difficult to translate the more simple $path + $file syntax. + * 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'])) { @@ -172,6 +178,9 @@ function ctools_form_include_file(&$form_state, $filename) { * 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; @@ -211,6 +220,9 @@ function ctools_add_css($file, $module = 'ctools', $dir = 'css') { * 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"; @@ -249,6 +261,9 @@ function ctools_add_js($file, $module = 'ctools', $dir = 'js') { * 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"; @@ -267,16 +282,29 @@ function ctools_get_roles() { return user_roles(); } -/* - * Break x,y,z and x+y+z into an array. Numeric only. +/** + * 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 - * - operator: Either 'and' or 'or' - * - value: An array of numeric values. + * @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(); @@ -286,7 +314,7 @@ function ctools_break_phrase($str) { $object->operator = 'or'; $object->value = preg_split('/[+ ]/', $str); } - else if (preg_match('/^([0-9]+,)*[0-9]+$/', $str)) { + elseif (preg_match('/^([0-9]+,)*[0-9]+$/', $str)) { $object->operator = 'and'; $object->value = explode(',', $str); } @@ -304,7 +332,7 @@ function ctools_break_phrase($str) { // Doubly ensure that all values are numeric only. foreach ($object->value as $id => $value) { - $object->value[$id] = intval($value); + $object->value[$id] = (int) $value; } return $object; @@ -314,23 +342,29 @@ function ctools_break_phrase($str) { * Set a token/value pair to be replaced later in the request, specifically in * ctools_page_token_processing(). * - * @param $token + * @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. - * @param $type + * 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 - * @param $argument - * If $type == 'variable' then argument should be the key to fetch from - * the $variables. If $type == 'callback' then it should either be the - * callback, or an array that will be sent to call_user_func_array(). + * 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 + * @return array * A array of token/variable names to be replaced. */ function ctools_set_page_token($token = NULL, $type = NULL, $argument = NULL) { - static $tokens = array(); + $tokens = &drupal_static('ctools_set_page_token', array()); if (isset($token)) { $tokens[$token] = array($type, $argument); @@ -339,13 +373,32 @@ function ctools_set_page_token($token = NULL, $type = NULL, $argument = NULL) { } /** - * Easily set a token from the page variables. + * 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'); + * $token = ctools_set_variable_token('tabs'); * - * $token will then be a simple replacement for the 'tabs' about of the - * variables available in the page template. + * 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 = ''; @@ -354,10 +407,45 @@ function ctools_set_variable_token($token) { } /** - * Easily set a token from the page variables. + * Set a replacement token from the value of a function during #post_render. * * This function can be used like this: - * $token = ctools_set_variable_token('id', 'mymodule_myfunction'); + * $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. @@ -384,9 +472,9 @@ function ctools_set_no_blocks($blocks = FALSE) { /** * 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'); @@ -413,6 +501,7 @@ function ctools_uuid_generate() { /** * Check that a string appears to be in the format of a UUID. + * * @see http://drupal.org/project/uuid * * @param $uuid @@ -468,6 +557,8 @@ function ctools_class_add($classes, $hook = 'html') { */ 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); } @@ -480,12 +571,35 @@ function ctools_class_remove($classes, $hook = 'html') { } } -// ----------------------------------------------------------------------- -// Drupal core hooks +/** + * 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. @@ -504,7 +618,7 @@ function ctools_init() { * Shutdown handler used during ajax operations to help catch fatal errors. */ function ctools_shutdown_handler() { - if (function_exists('error_get_last') AND ($error = error_get_last())) { + if (function_exists('error_get_last') && ($error = error_get_last())) { switch ($error['type']) { case E_ERROR: case E_CORE_ERROR: @@ -583,7 +697,6 @@ function ctools_flush_caches() { /** * Implements hook_element_info_alter(). - * */ function ctools_element_info_alter(&$type) { ctools_include('dependent'); @@ -619,10 +732,10 @@ function 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. @@ -640,11 +753,11 @@ function ctools_node_comment_form_submit(&$form, &$form_state) { // ----------------------------------------------------------------------- // 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; @@ -665,11 +778,11 @@ function ctools_ctools_plugin_type() { // ----------------------------------------------------------------------- // 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. @@ -679,14 +792,13 @@ function ctools_preprocess_node(&$vars) { } } - /** * Implements hook_page_alter(). * * Last ditch attempt to remove sidebar regions if the "no blocks" * functionality has been activated. * - * @see ctools_block_list_alter(). + * @see ctools_block_list_alter() */ function ctools_page_alter(&$page) { $check = drupal_static('ctools_set_no_blocks', TRUE); @@ -716,6 +828,7 @@ function ctools_page_token_processing($children, $elements) { case 'variable': $tokens[$token] = isset($elements[$argument]) ? $elements[$argument] : ''; break; + case 'callback': if (is_string($argument) && function_exists($argument)) { $tokens[$token] = $argument($elements); @@ -744,7 +857,7 @@ function ctools_process(&$variables, $hook) { return; } - $classes = drupal_static('ctools_process_classes', array()); + $classes = ctools_get_classes(); // Process the classses to add. if (!empty($classes[$hook]['add'])) { @@ -758,12 +871,6 @@ function ctools_process(&$variables, $hook) { $variables['classes_array'] = array_diff($variables['classes_array'], $remove_classes); } - // Update the classes within the attributes array to match the classes array - if (isset($variables['attributes_array']['class'])) { - $variables['attributes_array']['class'] = array_unique(array_merge($variables['classes_array'], $variables['attributes_array']['class'])); - $variables['attributes'] = $variables['attributes_array'] ? drupal_attributes($variables['attributes_array']) : ''; - } - // Since this runs after template_process(), we need to re-implode the // classes array. $variables['classes'] = implode(' ', $variables['classes_array']); @@ -771,7 +878,6 @@ function ctools_process(&$variables, $hook) { // ----------------------------------------------------------------------- // Menu callbacks that must be in the .module file. - /** * Determine if the current user has access via a plugin. * @@ -795,6 +901,7 @@ function ctools_process(&$variables, $hook) { * @return * TRUE if access is granted, false if otherwise. */ + function ctools_access_menu($access) { // Short circuit everything if there are no access tests. if (empty($access['plugins'])) { @@ -823,7 +930,7 @@ function ctools_access_menu($access) { * An indexed array of zero or more permission strings to be checked by * user_access(). * - * @return + * @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. @@ -885,7 +992,6 @@ function ctools_export_ui_load($item_name, $plugin_name) { // ----------------------------------------------------------------------- // Caching callbacks on behalf of export-ui. - /** * Menu access callback for various tasks of export-ui. */ @@ -929,7 +1035,7 @@ function ctools_export_ui_ctools_access_get($argument) { } /** - * Callback for access control ajax form on behalf of export ui + * 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 @@ -962,8 +1068,9 @@ function ctools_menu_local_tasks_alter(&$data, $router_item, $root_path) { } /** - * Implement hook_block_list_alter() to potentially remove blocks. + * 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) { @@ -1026,6 +1133,7 @@ function ctools_ctools_entity_context_alter(&$plugin, &$entity, $plugin_id) { case 'entity_id:taxonomy_term': $plugin['no ui'] = TRUE; break; + case 'entity:user': $plugin = ctools_get_context('user'); unset($plugin['no ui']); @@ -1059,18 +1167,21 @@ function ctools_field_create_field($field) { 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(). */ diff --git a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.info b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.info index bfa17834..3fc35564 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.info +++ b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.info @@ -2,12 +2,10 @@ name = Custom rulesets description = Create custom, exportable, reusable access rulesets for applications like Panels. core = 7.x package = Chaos tool suite -version = CTOOLS_MODULE_VERSION dependencies[] = ctools -; Information added by Drupal.org packaging script on 2016-11-22 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.install b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.install index 3f008772..70afb3c6 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.install +++ b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/ctools_access_ruleset.install @@ -1,5 +1,9 @@ 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. + // Load all mini panels and their displays. ctools_include('export'); $items = ctools_export_crud_load_all('ctools_access_ruleset'); $count = 0; diff --git a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/access/ruleset.inc b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/access/ruleset.inc index f8abea6d..95f32c37 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/access/ruleset.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/access/ruleset.inc @@ -35,7 +35,7 @@ function ctools_ruleset_ctools_access_merge_plugin($plugin, $parent, $item) { $plugin['required context'] = array(); foreach ($item->requiredcontexts as $context) { $info = ctools_get_context($context['name']); - // TODO: allow an optional setting + // TODO: allow an optional setting. $plugin['required context'][] = new ctools_context_required($context['identifier'], $info['context name']); } } @@ -72,7 +72,7 @@ function ctools_ruleset_ctools_access_get_children($plugin, $parent) { } /** - * Settings form for the 'by ruleset' access plugin + * 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)) { @@ -106,4 +106,3 @@ function ctools_ruleset_ctools_access_summary($conf, $context, $plugin) { return check_plain($plugin['ruleset']->admin_title); } } - diff --git a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc index d2a1c605..2589ac38 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset.inc @@ -1,5 +1,9 @@ 'ctools_access_ruleset', 'access' => 'administer ctools access ruleset', @@ -26,4 +30,3 @@ $plugin = array( ), ), ); - diff --git a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php index b1814645..c9f8c20f 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php +++ b/sites/all/modules/contrib/dev/ctools/ctools_access_ruleset/plugins/export_ui/ctools_access_ruleset_ui.class.php @@ -2,7 +2,7 @@ class ctools_access_ruleset_ui extends ctools_export_ui { - function edit_form_context(&$form, &$form_state) { + public function edit_form_context(&$form, &$form_state) { ctools_include('context-admin'); ctools_context_admin_includes(); ctools_add_css('ruleset'); @@ -27,7 +27,7 @@ class ctools_access_ruleset_ui extends ctools_export_ui { ctools_context_add_relationship_form($module, $form, $form_state, $form['right']['relationships_table'], $form_state['item'], $name); } - function edit_form_rules(&$form, &$form_state) { + 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'); @@ -43,11 +43,12 @@ class ctools_access_ruleset_ui extends ctools_export_ui { $form = ctools_access_admin_form($form, $form_state); } - function edit_form_rules_submit(&$form, &$form_state) { + public function edit_form_rules_submit(&$form, &$form_state) { $form_state['item']->access['logic'] = $form_state['values']['logic']; } - function edit_form_submit(&$form, &$form_state) { + public function edit_form_submit(&$form, &$form_state) { parent::edit_form_submit($form, $form_state); } + } diff --git a/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css b/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css index 8df17de5..c312e991 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css +++ b/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/css/ctools-ajax-sample.css @@ -1,52 +1,52 @@ div.ctools-sample-modal-content { - background:none; - border:0; - color:#000000; - margin:0; - padding:0; - text-align:left; + 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 .modal-scroll { + overflow: hidden; + overflow-y: auto; } div.ctools-sample-modal-content #popups-overlay { - background-color:transparent; + background-color: transparent; } div.ctools-sample-modal-content #popups-loading { - width:248px; - position:absolute; - display:none; - opacity:1; + width: 248px; + position: absolute; + display: none; + opacity: 1; -moz-border-radius: 8px; -webkit-border-radius: 8px; - z-index:99; + 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:#444444; - font-family:Arial; - font-size:22px; - font-weight:bold; - height:36px; - line-height:36px; - padding:0 40px; + 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:0px; + margin: 0; } div.ctools-sample-modal-content #popups-loading tbody, div.ctools-sample-modal-content .popups-box tbody { - border:none; + border: none; } div.ctools-sample-modal-content .popups-box tr { - background-color:transparent; + background-color: transparent; } div.ctools-sample-modal-content td.popups-border { background: url(../images/popups-border.png); - background-color:transparent; + background-color: transparent; border: none; } div.ctools-sample-modal-content td.popups-tl, @@ -54,79 +54,94 @@ 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:0px; + height: 10px; + padding: 0; +} +div.ctools-sample-modal-content td.popups-tl { + background-position: 0 0; } -div.ctools-sample-modal-content td.popups-tl { background-position: 0px 0px; } div.ctools-sample-modal-content td.popups-t, div.ctools-sample-modal-content td.popups-b { - background-position: 0px -40px; + background-position: 0 -40px; background-repeat: repeat-x; } -div.ctools-sample-modal-content td.popups-tr { background-position: 0px -10px; width: 10px; } +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; + 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: 0px -20px; } -div.ctools-sample-modal-content td.popups-br { background-position: 0px -30px; width: 10px; } +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: 0px solid #454545; - opacity:1; - overflow:hidden; - padding:0; - background-color:transparent; + 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; + overflow: hidden; + height: 100%; + background-color: #fff; } div.ctools-sample-modal-content div.popups-title { - -moz-border-radius-topleft: 0px; - -webkit-border-radius-topleft: 0px; - margin-bottom:0px; - background-color:#ff7200; - border:1px solid #ce5c00; - padding:4px 10px 5px; - color:white; - font-size:1em; - font-weight:bold; + -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; + 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; + background-color: #fff; } div.ctools-sample-modal-content .popups-title a.close { color: #fff; - text-decoration:none; + text-decoration: none; } div.ctools-sample-modal-content .popups-close { - font-size:120%; - float:right; - text-align:right; + 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%; + width: 220px; + height: 19px; + margin: 0 auto; + margin-top: 2%; } -div.ctools-sample-modal-content tbody{ - border:none; +div.ctools-sample-modal-content tbody { + border: none; } div.ctools-sample-modal-content .modal-content .modal-throbber-wrapper img { diff --git a/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.info b/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.info index 52126d51..c2a52df4 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.info +++ b/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.info @@ -1,13 +1,11 @@ name = Chaos Tools (CTools) AJAX Example description = Shows how to use the power of Chaos AJAX. package = Chaos tool suite -version = CTOOLS_MODULE_VERSION dependencies[] = ctools core = 7.x -; Information added by Drupal.org packaging script on 2016-11-22 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.install b/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.install index 04325dbf..e0fdfc6f 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.install +++ b/sites/all/modules/contrib/dev/ctools/ctools_ajax_sample/ctools_ajax_sample.install @@ -1,18 +1,18 @@ 'Chaos Tools AJAX Demo', - 'page callback' => 'ctools_ajax_sample_page', - 'access callback' => TRUE, - 'type' => MENU_NORMAL_ITEM, + 'title' => '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', @@ -26,39 +26,39 @@ function ctools_ajax_sample_menu() { '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, + '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, + '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, + '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, + '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, + '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', @@ -104,11 +104,11 @@ function ctools_ajax_sample_theme() { } // --------------------------------------------------------------------------- -// Page callbacks - +// Page callbacks. /** * Page callback to display links and render a container for AJAX stuff. */ + function ctools_ajax_sample_page() { global $user; @@ -156,14 +156,14 @@ function ctools_ajax_sample_page() { // 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'); + $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[] = 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"')); @@ -176,9 +176,9 @@ function ctools_ajax_sample_page() { // 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++) { + for ($i = 1; $i < 11; $i++) { $rows[] = array( - 'class' => array('ajax-sample-row-'. $i), + 'class' => array('ajax-sample-row-' . $i), 'data' => array( $i, md5($i), @@ -189,10 +189,10 @@ function ctools_ajax_sample_page() { $output .= theme('table', array('header' => $header, 'rows' => $rows, array('class' => array('ajax-sample-table')))); - // Show examples of ctools javascript widgets - $output .= '

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

'; + // Show examples of ctools javascript widgets. + $output .= '

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

'; - // Create a drop down menu + // 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']); @@ -201,16 +201,16 @@ function ctools_ajax_sample_page() { $output .= '

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

'; $output .= theme('ctools_dropdown', array('title' => t('Click to Drop Down'), 'links' => $links)); - // Create a collapsible div + // 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 .= '

' . t('Collapsible Div') . '

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

'. t('Jump Menu') .'

'; + $output .= '

' . t('Jump Menu') . '

'; $output .= drupal_render($form); return array('markup' => array('#markup' => $output)); @@ -225,7 +225,8 @@ function ctools_ajax_sample_hello($js = NULL) { ctools_include('ajax'); $commands = array(); $commands[] = ajax_command_html('#ctools-sample', $output); - print ajax_render($commands); // this function exits. + // This function exits. + print ajax_render($commands); exit; } else { @@ -234,7 +235,7 @@ function ctools_ajax_sample_hello($js = NULL) { } /** - * Nix a row from a table and restripe. + * Nix a row from a table and restripe. */ function ctools_ajax_sample_tablenix($js, $row) { if (!$js) { @@ -272,7 +273,7 @@ function ctools_ajax_sample_login($js = NULL) { $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'), ''); + $output[] = ctools_modal_command_display(t('Login Success'), ''); } print ajax_render($output); exit; @@ -283,7 +284,7 @@ function ctools_ajax_sample_login($js = NULL) { */ function ctools_ajax_sample_login_success($js, $action) { if (!$js) { - // we should never be here out of ajax context + // We should never be here out of ajax context. return MENU_NOT_FOUND; } @@ -291,11 +292,11 @@ function ctools_ajax_sample_login_success($js, $action) { ctools_add_js('ajax-responder'); $commands = array(); if ($action == 'inplace') { - // stay here + // Stay here. $commands[] = ctools_ajax_command_reload(); } else { - // bounce bounce + // Bounce bounce. $commands[] = ctools_ajax_command_redirect('user'); } print ajax_render($commands); @@ -318,18 +319,18 @@ function ctools_ajax_sample_animal($js = NULL, $step = NULL) { 'show back' => TRUE, 'show cancel' => TRUE, 'show return' => FALSE, - 'next callback' => 'ctools_ajax_sample_wizard_next', + '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 + // This controls order, as well as form labels. 'order' => array( 'start' => t('Choose animal'), ), - // here we map a step to a form id. + // Here we map a step to a form id. 'forms' => array( - // e.g. this for the step at wombat/create + // e.g. this for the step at wombat/create. 'start' => array( - 'form id' => 'ctools_ajax_sample_start' + 'form id' => 'ctools_ajax_sample_start', ), ), ); @@ -341,7 +342,6 @@ function ctools_ajax_sample_animal($js = NULL, $step = NULL) { // in creation. // // We skip all this here by just using an id of 1. - $object_id = 1; if (empty($step)) { @@ -406,7 +406,7 @@ function ctools_ajax_sample_animal($js = NULL, $step = NULL) { $commands[] = ajax_command_html('#ctools-sample', $animal); $commands[] = ctools_modal_command_dismiss(); } - else if (!empty($form_state['cancel'])) { + elseif (!empty($form_state['cancel'])) { // If cancelling, return to the activity. $commands[] = ctools_modal_command_dismiss(); } @@ -420,7 +420,7 @@ function ctools_ajax_sample_animal($js = NULL, $step = NULL) { if ($output === FALSE || !empty($form_state['complete'])) { return $animal; } - else if (!empty($form_state['cancel'])) { + elseif (!empty($form_state['cancel'])) { drupal_goto('ctools_ajax_sample'); } else { @@ -430,11 +430,11 @@ function ctools_ajax_sample_animal($js = NULL, $step = NULL) { } // --------------------------------------------------------------------------- -// Themes - +// Themes. /** * Theme function for main rendered output. */ + function theme_ctools_ajax_sample_container($vars) { $output = '
'; $output .= $vars['content']; @@ -445,7 +445,6 @@ function theme_ctools_ajax_sample_container($vars) { // --------------------------------------------------------------------------- // Stuff needed for our little wizard. - /** * Get a list of our animals and associated forms. * @@ -453,6 +452,7 @@ function theme_ctools_ajax_sample_container($vars) { * 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( @@ -478,10 +478,10 @@ function ctools_ajax_sample_animals() { // --------------------------------------------------------------------------- // 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); @@ -495,7 +495,7 @@ function ctools_ajax_sample_cache_get($id) { $object = ctools_object_cache_get('ctools_ajax_sample', $id); if (!$object) { // Create a default object. - $object = new stdClass; + $object = new stdClass(); $object->type = 'unknown'; $object->name = ''; } @@ -513,12 +513,12 @@ function ctools_ajax_sample_cache_clear($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']); } @@ -542,10 +542,10 @@ function ctools_ajax_sample_wizard_cancel(&$form_state) { // --------------------------------------------------------------------------- // 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'); @@ -713,7 +713,7 @@ function ctools_ajax_sample_show_raptor($object) { } /** - * Helper function to provide a sample jump menu form + * Helper function to provide a sample jump menu form. */ function ctools_ajax_sample_jump_menu_form() { $url = url('ctools_ajax_sample/jumped'); @@ -723,7 +723,7 @@ function ctools_ajax_sample_jump_menu_form() { } /** - * Provide a message to the user that the jump menu worked + * 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'); @@ -732,7 +732,7 @@ function ctools_ajax_sample_jump_menu_page() { } /** - * Provide a form for an example ajax modal button + * Provide a form for an example ajax modal button. */ function ctools_ajax_sample_ajax_button_form() { $form = array(); diff --git a/sites/all/modules/contrib/dev/ctools/ctools_custom_content/ctools_custom_content.info b/sites/all/modules/contrib/dev/ctools/ctools_custom_content/ctools_custom_content.info index ee2d2d1e..2bc73489 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_custom_content/ctools_custom_content.info +++ b/sites/all/modules/contrib/dev/ctools/ctools_custom_content/ctools_custom_content.info @@ -2,12 +2,10 @@ name = Custom content panes description = Create custom, exportable, reusable content panes for applications like Panels. core = 7.x package = Chaos tool suite -version = CTOOLS_MODULE_VERSION dependencies[] = ctools -; Information added by Drupal.org packaging script on 2016-11-22 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/ctools_custom_content/ctools_custom_content.install b/sites/all/modules/contrib/dev/ctools/ctools_custom_content/ctools_custom_content.install index b4512f2a..dcf87e73 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_custom_content/ctools_custom_content.install +++ b/sites/all/modules/contrib/dev/ctools/ctools_custom_content/ctools_custom_content.install @@ -1,5 +1,9 @@ type == 'custom') { - if(!isset($pane->configuration['name'])) { + if (!isset($pane->configuration['name'])) { $name_of_pane = $pane->subtype; } else { @@ -80,7 +80,7 @@ function ctools_custom_content_panels_dashboard_blocks(&$vars) { '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. + // Load all mini panels and their displays. ctools_include('export'); $items = ctools_export_crud_load_all('ctools_custom_content'); $count = 0; diff --git a/sites/all/modules/contrib/dev/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc b/sites/all/modules/contrib/dev/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc index 467dc580..c7933bcb 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content.inc @@ -1,5 +1,9 @@ 'ctools_custom_content', 'access' => 'administer custom content', @@ -17,4 +21,3 @@ $plugin = array( 'handler' => 'ctools_custom_content_ui', ); - diff --git a/sites/all/modules/contrib/dev/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php b/sites/all/modules/contrib/dev/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php index b22b0610..e56f7a7e 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php +++ b/sites/all/modules/contrib/dev/ctools/ctools_custom_content/plugins/export_ui/ctools_custom_content_ui.class.php @@ -2,7 +2,7 @@ class ctools_custom_content_ui extends ctools_export_ui { - function edit_form(&$form, &$form_state) { + public function edit_form(&$form, &$form_state) { // Correct for an error that came in because filter format changed. if (is_array($form_state['item']->settings['body'])) { $form_state['item']->settings['format'] = $form_state['item']->settings['body']['format']; @@ -54,7 +54,7 @@ class ctools_custom_content_ui extends ctools_export_ui { ); } - function edit_form_submit(&$form, &$form_state) { + 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: @@ -65,7 +65,7 @@ class ctools_custom_content_ui extends ctools_export_ui { $form_state['item']->settings['substitute'] = $form_state['values']['substitute']; } - function list_form(&$form, &$form_state) { + public function list_form(&$form, &$form_state) { parent::list_form($form, $form_state); $options = array('all' => t('- All -')); @@ -82,7 +82,7 @@ class ctools_custom_content_ui extends ctools_export_ui { ); } - function list_filter($form_state, $item) { + public function list_filter($form_state, $item) { if ($form_state['values']['category'] != 'all' && $form_state['values']['category'] != $item->category) { return TRUE; } @@ -90,7 +90,7 @@ class ctools_custom_content_ui extends ctools_export_ui { return parent::list_filter($form_state, $item); } - function list_sort_options() { + public function list_sort_options() { return array( 'disabled' => t('Enabled, title'), 'title' => t('Title'), @@ -100,21 +100,25 @@ class ctools_custom_content_ui extends ctools_export_ui { ); } - function list_build_row($item, &$form_state, $operations) { - // Set up sorting + 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; @@ -134,7 +138,7 @@ class ctools_custom_content_ui extends ctools_export_ui { ); } - function list_table_header() { + 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')), diff --git a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/README.txt b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/README.txt index 42edcdc9..2f9b0fff 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/README.txt +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/README.txt @@ -11,4 +11,4 @@ There are a number of ways to profit from this: 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. \ No newline at end of file +3. There is Advanced Help at admin/advanced_help/ctools_plugin_example. diff --git a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/ctools_plugin_example.info b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/ctools_plugin_example.info index 337e699d..3f268dbc 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/ctools_plugin_example.info +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/ctools_plugin_example.info @@ -1,16 +1,14 @@ name = Chaos Tools (CTools) Plugin Example description = Shows how an external module can provide ctools plugins (for Panels, etc.). package = Chaos tool suite -version = CTOOLS_MODULE_VERSION dependencies[] = ctools dependencies[] = panels dependencies[] = page_manager dependencies[] = advanced_help core = 7.x -; Information added by Drupal.org packaging script on 2016-11-22 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/ctools_plugin_example.module b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/ctools_plugin_example.module index 01d53382..a9a6080b 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/ctools_plugin_example.module +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/ctools_plugin_example.module @@ -1,9 +1,8 @@ .pages_default.inc + * .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. @@ -71,7 +70,8 @@ function ctools_plugin_example_ctools_plugin_api($module, $api) { } /** - * Just provide an explanation page for the admin section + * Just provide an explanation page for the admin section. + * * @return unknown_type */ function ctools_plugin_example_explanation_page() { diff --git a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc index 10a76193..ed3ffd77 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/ctools_plugin_example.pages_default.inc @@ -6,7 +6,7 @@ */ /** - * Default panels pages for CTools Plugin Example + * Default panels pages for CTools Plugin Example. * * To pick up this file, your module needs to implement * hook_ctools_plugin_api() - See ctools_plugin_example_ctools_plugin_api() in @@ -23,12 +23,10 @@ * @return * Array of pages, normally exported from Panels. */ - function ctools_plugin_example_default_page_manager_pages() { - // begin exported panel. - - $page = new stdClass; + // 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'; @@ -37,31 +35,31 @@ function ctools_plugin_example_default_page_manager_pages() { $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', + 'logic' => 'and', ); $page->menu = array( - 'type' => 'normal', - 'title' => 'CTools plugin example', - 'name' => 'navigation', - 'weight' => '0', - 'parent' => array( - 'type' => 'none', - 'title' => '', + '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(), - ), + 'sc' => array( + 'id' => 2, + 'identifier' => 'simplecontext-arg', + 'name' => 'simplecontext_arg', + 'settings' => array(), + ), ); $page->conf = array(); $page->default_handlers = array(); - $handler = new stdClass; + $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'; @@ -70,44 +68,45 @@ function ctools_plugin_example_default_page_manager_pages() { $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', - ), + '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 = 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', - ), - ), + 'style' => 'rounded_corners', + 'style_settings' => array( + 'default' => array( + 'corner_location' => 'pane', + ), + ), ); $display->cache = array(); $display->title = 'CTools plugin example panel'; @@ -115,7 +114,7 @@ function ctools_plugin_example_default_page_manager_pages() { $display->title_pane = 1; $display->content = array(); $display->panels = array(); - $pane = new stdClass; + $pane = new stdClass(); $pane->pid = 'new-1'; $pane->panel = 'left'; $pane->type = 'no_context_content_type'; @@ -135,7 +134,7 @@ function ctools_plugin_example_default_page_manager_pages() { $pane->position = 0; $display->content['new-1'] = $pane; $display->panels['left'][0] = 'new-1'; - $pane = new stdClass; + $pane = new stdClass(); $pane->pid = 'new-2'; $pane->panel = 'left'; $pane->type = 'custom'; @@ -148,15 +147,15 @@ function ctools_plugin_example_default_page_manager_pages() { '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' => '1', + 'format' => 'filtered_html', 'substitute' => 1, ); $pane->cache = array(); @@ -166,7 +165,7 @@ function ctools_plugin_example_default_page_manager_pages() { $pane->position = 1; $display->content['new-2'] = $pane; $display->panels['left'][1] = 'new-2'; - $pane = new stdClass; + $pane = new stdClass(); $pane->pid = 'new-3'; $pane->panel = 'left'; $pane->type = 'custom'; @@ -179,15 +178,15 @@ function ctools_plugin_example_default_page_manager_pages() { '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' => '1', + 'format' => 'filtered_html', 'substitute' => 1, ); $pane->cache = array(); @@ -197,7 +196,7 @@ function ctools_plugin_example_default_page_manager_pages() { $pane->position = 2; $display->content['new-3'] = $pane; $display->panels['left'][2] = 'new-3'; - $pane = new stdClass; + $pane = new stdClass(); $pane->pid = 'new-4'; $pane->panel = 'middle'; $pane->type = 'simplecontext_content_type'; @@ -241,7 +240,7 @@ function ctools_plugin_example_default_page_manager_pages() { $pane->position = 0; $display->content['new-4'] = $pane; $display->panels['middle'][0] = 'new-4'; - $pane = new stdClass; + $pane = new stdClass(); $pane->pid = 'new-5'; $pane->panel = 'middle'; $pane->type = 'simplecontext_content_type'; @@ -285,7 +284,7 @@ function ctools_plugin_example_default_page_manager_pages() { $pane->position = 1; $display->content['new-5'] = $pane; $display->panels['middle'][1] = 'new-5'; - $pane = new stdClass; + $pane = new stdClass(); $pane->pid = 'new-6'; $pane->panel = 'middle'; $pane->type = 'custom'; @@ -299,7 +298,7 @@ function ctools_plugin_example_default_page_manager_pages() { item1 is %sc:item1 item2 is %sc:item2 description is %sc:description', - 'format' => '1', + 'format' => 'filtered_html', 'substitute' => 1, ); $pane->cache = array(); @@ -309,7 +308,7 @@ function ctools_plugin_example_default_page_manager_pages() { $pane->position = 2; $display->content['new-6'] = $pane; $display->panels['middle'][2] = 'new-6'; - $pane = new stdClass; + $pane = new stdClass(); $pane->pid = 'new-7'; $pane->panel = 'right'; $pane->type = 'relcontext_content_type'; @@ -353,7 +352,7 @@ function ctools_plugin_example_default_page_manager_pages() { $pane->position = 0; $display->content['new-7'] = $pane; $display->panels['right'][0] = 'new-7'; - $pane = new stdClass; + $pane = new stdClass(); $pane->pid = 'new-8'; $pane->panel = 'top'; $pane->type = 'custom'; @@ -365,7 +364,7 @@ function ctools_plugin_example_default_page_manager_pages() { 'body' => 'The CTools Plugin Example module (and this panel page) are just here to demonstrate how to build CTools plugins. ', - 'format' => '2', + 'format' => 'full_html', 'substitute' => 1, ); $pane->cache = array(); @@ -378,12 +377,11 @@ function ctools_plugin_example_default_page_manager_pages() { $handler->conf['display'] = $display; $page->default_handlers[$handler->name] = $handler; - // end of exported panel. + // End of exported panel. $pages['ctools_plugin_example_demo_page'] = $page; - // begin exported panel - - $page = new stdClass; + // 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'; @@ -396,7 +394,7 @@ function ctools_plugin_example_default_page_manager_pages() { $page->arguments = array(); $page->conf = array(); $page->default_handlers = array(); - $handler = new stdClass; + $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'; @@ -405,14 +403,15 @@ function ctools_plugin_example_default_page_manager_pages() { $handler->handler = 'panel_context'; $handler->weight = 0; $handler->conf = array( - 'title' => 'Panel', - 'no_blocks' => FALSE, - 'css_id' => '', - 'css' => '', - 'contexts' => array(), - 'relationships' => array(), + 'title' => 'Panel', + 'no_blocks' => FALSE, + 'css_id' => '', + 'css' => '', + 'contexts' => array(), + 'relationships' => array(), + 'pipeline' => 'standard', ); - $display = new panels_display; + $display = new panels_display(); $display->layout = 'onecol'; $display->layout_settings = array(); $display->panel_settings = array(); @@ -421,7 +420,7 @@ function ctools_plugin_example_default_page_manager_pages() { $display->hide_title = FALSE; $display->content = array(); $display->panels = array(); - $pane = new stdClass; + $pane = new stdClass(); $pane->pid = 'new-1'; $pane->panel = 'middle'; $pane->type = 'custom'; @@ -431,7 +430,7 @@ function ctools_plugin_example_default_page_manager_pages() { $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' => '1', + 'format' => 'filtered_html', 'substitute' => NULL, ); $pane->cache = array(); @@ -443,9 +442,8 @@ function ctools_plugin_example_default_page_manager_pages() { $display->panels['middle'][0] = 'new-1'; $handler->conf['display'] = $display; $page->default_handlers[$handler->name] = $handler; - // end exported panel. - + // End exported panel. $pages['base_page'] = $page; return $pages; -} \ No newline at end of file +} diff --git a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/access/arg_length.inc b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/access/arg_length.inc index 2a09eea1..3b5d8636 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/access/arg_length.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/access/arg_length.inc @@ -59,7 +59,8 @@ function ctools_plugin_example_arg_length_ctools_access_check($conf, $context) { */ 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'])); + array( + '!comp' => $conf['greater_than'] ? 'greater than' : 'less than or equal to', + '@length' => $conf['arg_length'], + )); } - diff --git a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/access/example_role.inc b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/access/example_role.inc index bbe364c1..75721e8b 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/access/example_role.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/access/example_role.inc @@ -4,7 +4,7 @@ * @file * Plugin to provide access control based upon role membership. * This is directly from the ctools module, but serves as a good - * example of an access plugin + * example of an access plugin. */ /** @@ -73,4 +73,3 @@ function ctools_plugin_example_example_role_ctools_access_summary($conf, $contex } 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/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc index 51c7c601..7fb732c6 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/arguments/simplecontext_arg.inc @@ -2,7 +2,6 @@ /** * @file - * * Sample plugin to provide an argument handler for a simplecontext. * * Given any argument to the page, simplecontext will get it @@ -18,14 +17,12 @@ */ $plugin = array( 'title' => t("Simplecontext arg"), - // keyword to use for %substitution + // Keyword to use for %substitution. 'keyword' => 'simplecontext', 'description' => t('Creates a "simplecontext" from the arg.'), 'context' => 'simplecontext_arg_context', - // 'settings form' => 'simplecontext_arg_settings_form', - // placeholder_form is used in panels preview, for example, so we can - // preview without getting the arg from a URL + // preview without getting the arg from a URL. 'placeholder form' => array( '#type' => 'textfield', '#description' => t('Enter the simplecontext arg'), diff --git a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/content_types/no_context_content_type.inc b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/content_types/no_context_content_type.inc index 3c02ab84..48ce0f5c 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/content_types/no_context_content_type.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/content_types/no_context_content_type.inc @@ -5,7 +5,6 @@ * "No context" sample content type. It operates with no context at all. It would * be basically the same as a 'custom content' block, but it's not even that * sophisticated. - * */ /** @@ -33,7 +32,7 @@ $plugin = array( 'icon' => 'icon_example.png', 'category' => array(t('CTools Examples'), -9), - // this example does not provide 'admin info', which would populate the + // This example does not provide 'admin info', which would populate the // panels builder page preview. ); @@ -56,7 +55,7 @@ function no_context_content_type_render($subtype, $conf, $args, $context) { $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 + // 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. @@ -84,7 +83,6 @@ function no_context_content_type_render($subtype, $conf, $args, $context) { * 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']; diff --git a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc index bf54dce6..ced64117 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/content_types/relcontext_content_type.inc @@ -1,6 +1,5 @@ array(t('CTools Examples'), -9), 'edit form' => 'relcontext_edit_form', - // this example does not provide 'admin info', which would populate the + // This example does not provide 'admin info', which would populate the // panels builder page preview. - ); /** @@ -60,7 +58,7 @@ function relcontext_content_type_render($subtype, $conf, $args, $context) { In our case, the configuration form (\$conf) has just one field, 'config_item_1; and it's configured with: "); - if (!empty($conf)) { + if (!empty($conf)) { $block->content .= '
' . var_export($conf['config_item_1'], TRUE) . '
'; } if (!empty($context)) { @@ -77,7 +75,6 @@ function relcontext_content_type_render($subtype, $conf, $args, $context) { /** * 'Edit' callback for the content type. * This example just returns a form. - * */ function relcontext_edit_form($form, &$form_state) { $conf = $form_state['conf']; diff --git a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc index a308683c..e34fa18e 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/content_types/simplecontext_content_type.inc @@ -1,6 +1,5 @@ '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. + // 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), @@ -103,7 +101,6 @@ function simplecontext_content_type_render($subtype, $conf, $args, $context) { /** * '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']; diff --git a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/contexts/relcontext.inc b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/contexts/relcontext.inc index 0c7ef113..61e25db0 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/contexts/relcontext.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/contexts/relcontext.inc @@ -80,4 +80,3 @@ function relcontext_settings_form($conf, $external = FALSE) { ); return $form; } - diff --git a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/contexts/simplecontext.inc b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/contexts/simplecontext.inc index e19a8422..0ee4658d 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/contexts/simplecontext.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/contexts/simplecontext.inc @@ -1,10 +1,8 @@ t("Simplecontext"), 'description' => t('A single "simplecontext" context, or data element.'), - 'context' => 'ctools_plugin_example_context_create_simplecontext', // func to create context +// Func to create context. + 'context' => 'ctools_plugin_example_context_create_simplecontext', 'context name' => 'simplecontext', 'settings form' => 'simplecontext_settings_form', 'keyword' => 'simplecontext', @@ -69,7 +68,7 @@ function ctools_plugin_example_context_create_simplecontext($empty, $data = NULL // This is used for keyword. $context->title = $data; $context->argument = $data; - // Make up a bogus context + // Make up a bogus context. $context->data = new stdClass(); $context->data->item1 = t("Item1"); $context->data->item2 = t("Item2"); @@ -102,8 +101,6 @@ function simplecontext_settings_form($conf, $external = FALSE) { return $form; } - - /** * Provide a list of sub-keywords. * @@ -125,10 +122,11 @@ 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/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/panels.pages.inc b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/panels.pages.inc index d3022af7..25422cfa 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/panels.pages.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/panels.pages.inc @@ -19,24 +19,24 @@ function ctools_plugin_example_default_panel_pages() { $page->load_flags = 1; $page->css_id = ''; $page->arguments = array( - 0 => + 0 => array( - 'name' => 'simplecontext_arg', - 'id' => 1, - 'default' => '404', - 'title' => '', - 'identifier' => 'Simplecontext arg', - 'keyword' => 'simplecontext', + 'name' => 'simplecontext_arg', + 'id' => 1, + 'default' => '404', + 'title' => '', + 'identifier' => 'Simplecontext arg', + 'keyword' => 'simplecontext', ), ); $page->relationships = array( - 0 => + 0 => array( - 'context' => 'argument_simplecontext_arg_1', - 'name' => 'relcontext_from_simplecontext', - 'id' => 1, - 'identifier' => 'Relcontext from Simplecontext', - 'keyword' => 'relcontext', + 'context' => 'argument_simplecontext_arg_1', + 'name' => 'relcontext_from_simplecontext', + 'id' => 1, + 'identifier' => 'Relcontext from Simplecontext', + 'keyword' => 'relcontext', ), ); $page->no_blocks = '0'; @@ -58,14 +58,14 @@ function ctools_plugin_example_default_panel_pages() { $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', + '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; @@ -78,14 +78,14 @@ function ctools_plugin_example_default_panel_pages() { $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', + '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; @@ -98,16 +98,16 @@ function ctools_plugin_example_default_panel_pages() { $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. + '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', + 'format' => '1', ); $pane->cache = array(); $display->content['new-3'] = $pane; @@ -119,17 +119,17 @@ function ctools_plugin_example_default_panel_pages() { $pane->shown = '1'; $pane->subtype = 'description'; $pane->access = array( - 0 => '2', - 1 => '4', + 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', + '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; @@ -142,14 +142,14 @@ function ctools_plugin_example_default_panel_pages() { $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', + '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; @@ -162,13 +162,13 @@ function ctools_plugin_example_default_panel_pages() { $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', + '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; @@ -181,13 +181,13 @@ function ctools_plugin_example_default_panel_pages() { $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); + 'style' => 'default', + 'override_title' => 0, + 'override_title_text' => '', + 'css_id' => '', + 'css_class' => '', + 'title' => '', + 'body' => '$arg = arg(1); $arg0 = arg(0); if (!$arg) { $block->content = <<displays = array(); $pages['ctools_plugin_example'] = $page; - return $pages; } diff --git a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc index 62246210..087d5ecf 100644 --- a/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc +++ b/sites/all/modules/contrib/dev/ctools/ctools_plugin_example/plugins/relationships/relcontext_from_simplecontext.inc @@ -1,9 +1,7 @@ $exportables, 'schemas' => $schemas); } -/* +/** * View a single object. * * @param $table_name @@ -662,7 +666,7 @@ function _ctools_drush_export_view($table_name, $object) { } } -/* +/** * Revert a single object. * * @param $table_name @@ -681,7 +685,7 @@ function _ctools_drush_export_delete($table_name, $object) { } } -/* +/** * Enable a single object. * * @param $table_name @@ -701,7 +705,7 @@ function _ctools_drush_export_enable($table_name, $object) { } } -/* +/** * Disable a single object. * * @param $table_name @@ -723,9 +727,9 @@ function _ctools_drush_export_disable($table_name, $object) { /** * Filter a nested array of exportables by export module. * - * @param $exportables array + * @param array $exportables * Passed by reference. A nested array of exportables, keyed by table name. - * @param $export_module string + * @param string $export_module * The name of the export module providing the exportable. */ function _ctools_drush_export_module_filter($exportables, $export_module) { @@ -778,7 +782,7 @@ function _ctools_drush_object_is_disabled($object) { /** * Determine if an object is enabled. * - * @see _ctools_drush_object_is_disabled. + * @see _ctools_drush_object_is_disabled() */ function _ctools_drush_object_is_enabled($object) { return (empty($object->disabled)) ? TRUE : FALSE; @@ -835,7 +839,7 @@ function _ctools_drush_object_is_not_code_only($object) { * Array of exportables to count. * * @return - * Array of count data containing the following: + * Array of count data containing the following: * 'total' - A total count of all exportables. * 'exportables' - An array of exportable counts per table. */ @@ -867,26 +871,32 @@ function _ctools_drush_filter_exportables($exportables, $filter) { // Show enabled exportables only. case 'enabled': $eval = '_ctools_drush_object_is_disabled'; - break; + break; + // Show disabled exportables only. case 'disabled': $eval = '_ctools_drush_object_is_enabled'; - break; + break; + // Show overridden exportables only. case 'overridden': $eval = '_ctools_drush_object_is_not_overridden'; - break; + break; + // Show database only exportables. case 'database': $eval = '_ctools_drush_object_is_not_db_only'; - break; + break; + // Show code only exportables. case 'code': $eval = '_ctools_drush_object_is_not_code_only'; - break; + break; + // Do nothing. case 'all': break; + default: drush_log(dt('Invalid filter option. Available options are: enabled, disabled, overridden, database, and code.'), 'error'); return; @@ -983,33 +993,42 @@ class shellColours { 'light_gray' => '47', ); + /** + * shellColours constructor. + */ private function __construct() {} - // Returns coloured string + /** + * Returns coloured string. + */ public static function getColouredOutput($string, $foreground_colour = NULL, $background_colour = NULL) { $coloured_string = ""; - // Check if given foreground colour found + // Check if given foreground colour found. if ($foreground_colour) { $coloured_string .= "\033[" . self::$foreground_colours[$foreground_colour] . "m"; } - // Check if given background colour found + // 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"; + // Add string and end colouring. + $coloured_string .= $string . "\033[0m"; return $coloured_string; } - // Returns all foreground colour names + /** + * Returns all foreground colour names. + */ public static function getForegroundColours() { return array_keys(self::$foreground_colours); } - // Returns all background colour names + /** + * Returns all background colour names. + */ public static function getBackgroundColours() { return array_keys(self::$background_colours); } diff --git a/sites/all/modules/contrib/dev/ctools/help/export.html b/sites/all/modules/contrib/dev/ctools/help/export.html index ce24cad9..573c98a6 100644 --- a/sites/all/modules/contrib/dev/ctools/help/export.html +++ b/sites/all/modules/contrib/dev/ctools/help/export.html @@ -154,7 +154,7 @@ function mymodule_schema() {
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'. +
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 diff --git a/sites/all/modules/contrib/dev/ctools/help/modal.html b/sites/all/modules/contrib/dev/ctools/help/modal.html index ea823a0d..761fd2e3 100644 --- a/sites/all/modules/contrib/dev/ctools/help/modal.html +++ b/sites/all/modules/contrib/dev/ctools/help/modal.html @@ -82,7 +82,7 @@ function ctools_modal_text_button($text, $dest, $alt, $class = '') {
  • 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
    • +
    • 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
    • @@ -168,7 +168,7 @@ function ctools_ajax_sample_login($js) {
       function ctools_ajax_hello_world($js) {
         $title = t('Greetings');
      -  $output = '<p>' . t('Hello world') . ''</p>';
      +  $output = '<p>' . t('Hello world') . '</p>';
         if ($js) {
           ctools_modal_render($title, $output);
         }
      diff --git a/sites/all/modules/contrib/dev/ctools/help/plugins-creating.html b/sites/all/modules/contrib/dev/ctools/help/plugins-creating.html
      index 23237058..6d5b35f6 100644
      --- a/sites/all/modules/contrib/dev/ctools/help/plugins-creating.html
      +++ b/sites/all/modules/contrib/dev/ctools/help/plugins-creating.html
      @@ -26,7 +26,7 @@ The following information can be specified for each plugin type:
       
      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:
      +
      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
      @@ -35,6 +35,7 @@ The following information can be specified for each plugin type:
      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.
      diff --git a/sites/all/modules/contrib/dev/ctools/includes/action-links.theme.inc b/sites/all/modules/contrib/dev/ctools/includes/action-links.theme.inc index 3a2398a1..f53f59c8 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/action-links.theme.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/action-links.theme.inc @@ -1,4 +1,5 @@ ' . $links . '
    '; -} \ No newline at end of file +} diff --git a/sites/all/modules/contrib/dev/ctools/includes/ajax.inc b/sites/all/modules/contrib/dev/ctools/includes/ajax.inc index 96f5068f..4d72d0c6 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/ajax.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/ajax.inc @@ -1,6 +1,10 @@ 'attr', - 'selector' => $selector, - 'name' => $name, - 'value' => $value, - ); - } + 'command' => 'attr', + 'selector' => $selector, + 'name' => $name, + 'value' => $value, + ); +} /** * Force a client-side redirect. @@ -154,4 +158,3 @@ function ctools_ajax_render_error($error = '') { print ajax_render($commands); exit; } - diff --git a/sites/all/modules/contrib/dev/ctools/includes/cache.inc b/sites/all/modules/contrib/dev/ctools/includes/cache.inc index 3918683b..cace8002 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/cache.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/cache.inc @@ -2,7 +2,6 @@ /** * @file - * * Plugins to handle cache-indirection. * * Simple plugin management to allow clients to more tightly control where @@ -52,7 +51,6 @@ * @param string $mechanism * A string containing the plugin name, and an optional data element to * send to the plugin separated by two colons. - * * @param string $key * The key used to identify the cache. * @@ -70,7 +68,6 @@ function ctools_cache_get($mechanism, $key) { * @param string $mechanism * A string containing the plugin name, and an optional data element to * send to the plugin separated by two colons. - * * @param string $key * The key used to identify the cache. * @@ -88,7 +85,6 @@ function ctools_cache_set($mechanism, $key, $object) { * @param string $mechanism * A string containing the plugin name, and an optional data element to * send to the plugin separated by two colons. - * * @param string $key * The key used to identify the cache. */ @@ -108,13 +104,10 @@ function ctools_cache_clear($mechanism, $key) { * @param string $mechanism * A string containing the plugin name, and an optional data element to * send to the plugin separated by two colons. - * * @param string $key * The key used to identify the cache. - * * @param string $op * The operation to call, such as 'break' or 'finalize'. - * * @param mixed $object * The cache data being operated on, in case it is necessary. This is * optional so no references should be used. @@ -150,7 +143,7 @@ function ctools_cache_operation($mechanism, $key, $op, $object = NULL) { */ function ctools_cache_find_plugin($mechanism) { if (strpos($mechanism, '::') !== FALSE) { - // use explode(2) to ensure that the data can contain double + // Use explode(2) to ensure that the data can contain double // colons, just in case. list($name, $data) = explode('::', $mechanism, 2); } diff --git a/sites/all/modules/contrib/dev/ctools/includes/cleanstring.inc b/sites/all/modules/contrib/dev/ctools/includes/cleanstring.inc index 56b3e36f..11ffceff 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/cleanstring.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/cleanstring.inc @@ -1,5 +1,4 @@ $length) { - $string = drupal_substr($string, 0, $length + 1); // leave one more character - if ($last_break = strrpos($string, $separator)) { // space exists AND is not on position 0 + // 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 { diff --git a/sites/all/modules/contrib/dev/ctools/includes/collapsible.theme.inc b/sites/all/modules/contrib/dev/ctools/includes/collapsible.theme.inc index f7bbbb37..81df4bcc 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/collapsible.theme.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/collapsible.theme.inc @@ -30,8 +30,8 @@ function ctools_collapsible_theme(&$items) { * 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 = FALSE + * collapsed. + * @param $collapsed * If true, this div will start out collapsed. */ function theme_ctools_collapsible($vars) { @@ -56,8 +56,8 @@ function theme_ctools_collapsible($vars) { * 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 = FALSE + * collapsed. + * @param $collapsed * If true, this div will start out collapsed. */ function theme_ctools_collapsible_remembered($vars) { @@ -76,4 +76,3 @@ function theme_ctools_collapsible_remembered($vars) { return $output; } - diff --git a/sites/all/modules/contrib/dev/ctools/includes/content.inc b/sites/all/modules/contrib/dev/ctools/includes/content.inc index 6490d8d5..49c35650 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/content.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/content.inc @@ -86,7 +86,7 @@ function ctools_content_process(&$plugin, $info) { /** * Fetch metadata on a specific content_type plugin. * - * @param $content type + * @param mixed $content * Name of a panel content type. * * @return @@ -146,7 +146,7 @@ function ctools_content_get_subtypes($type) { if (is_array($function)) { $subtypes = $function; } - else if (function_exists($function)) { + elseif (function_exists($function)) { // Cast to array to prevent errors from non-array returns. $subtypes = (array) $function($plugin); } @@ -157,7 +157,7 @@ function ctools_content_get_subtypes($type) { foreach ($subtypes as $id => $subtype) { // Ensure that the 'subtype_id' value exists. if (!isset($subtype['subtype_id'])) { - $subtype['subtype_id'] = $id; + $subtypes[$id]['subtype_id'] = $id; } // Use exact name since this is a modify by reference. @@ -207,6 +207,13 @@ function ctools_content_get_subtype($type, $subtype_id) { } 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; @@ -300,7 +307,7 @@ function ctools_content_render($type, $subtype, $conf, $keywords = array(), $arg $content->subtype = $subtype; } - // Override the title if configured to + // 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; @@ -310,12 +317,12 @@ function ctools_content_render($type, $subtype, $conf, $keywords = array(), $arg } if (!empty($content->title)) { - // Perform substitutions + // Perform substitutions. if (!empty($keywords) || !empty($context)) { $content->title = ctools_context_keyword_substitute($content->title, $keywords, $context); } - // Sterilize the title + // Sterilize the title. $content->title = filter_xss_admin($content->title); // If a link is specified, populate. @@ -326,7 +333,7 @@ function ctools_content_render($type, $subtype, $conf, $keywords = array(), $arg else { $url = $content->title_link; } - // set defaults so we don't bring up notices + // 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); } @@ -348,7 +355,7 @@ function ctools_content_editable($type, $subtype, $conf) { } $function = FALSE; - + if (!empty($subtype['check editable'])) { $function = ctools_plugin_get_function($subtype, 'check editable'); } @@ -379,7 +386,7 @@ function ctools_content_admin_title($type, $subtype, $conf, $context = NULL) { if (is_array($type)) { $plugin = $type; } - else if (is_string($type)) { + elseif (is_string($type)) { $plugin = ctools_get_content_type($type); } else { @@ -397,10 +404,10 @@ function ctools_content_admin_title($type, $subtype, $conf, $context = NULL) { return $function($subtype, $conf, $pane_context); } - else if (isset($plugin['admin title'])) { + elseif (isset($plugin['admin title'])) { return $plugin['admin title']; } - else if (isset($plugin['title'])) { + elseif (isset($plugin['title'])) { return $plugin['title']; } } @@ -435,7 +442,7 @@ function ctools_content_get_defaults($plugin, $subtype) { if (isset($plugin['defaults'])) { $defaults = $plugin['defaults']; } - else if (isset($subtype['defaults'])) { + elseif (isset($subtype['defaults'])) { $defaults = $subtype['defaults']; } if (isset($defaults)) { @@ -444,7 +451,7 @@ function ctools_content_get_defaults($plugin, $subtype) { return $return; } } - else if (is_array($defaults)) { + elseif (is_array($defaults)) { return $defaults; } } @@ -478,7 +485,7 @@ function ctools_content_admin_info($type, $subtype, $conf, $context = NULL) { if (empty($output) || !is_object($output)) { $output = new stdClass(); - // replace the _ with " " for a better output + // Replace the _ with " " for a better output. $subtype = check_plain(str_replace("_", " ", $subtype)); $output->title = $subtype; $output->content = t('No info available.'); @@ -487,7 +494,7 @@ function ctools_content_admin_info($type, $subtype, $conf, $context = NULL) { } /** - * Add the default FAPI elements to the content type configuration form + * Add the default FAPI elements to the content type configuration form. */ function ctools_content_configure_form_defaults($form, &$form_state) { $plugin = $form_state['plugin']; @@ -604,7 +611,7 @@ function ctools_content_form($op, $form_info, &$form_state, $plugin, $subtype_na if (!empty($subtype['add form'])) { _ctools_content_create_form_info($form_info, $subtype['add form'], $subtype, $subtype, $op); } - else if (!empty($plugin['add form'])) { + elseif (!empty($plugin['add form'])) { _ctools_content_create_form_info($form_info, $plugin['add form'], $plugin, $subtype, $op); } } @@ -614,7 +621,7 @@ function ctools_content_form($op, $form_info, &$form_state, $plugin, $subtype_na if (!empty($subtype['edit form'])) { _ctools_content_create_form_info($form_info, $subtype['edit form'], $subtype, $subtype, $op); } - else if (!empty($plugin['edit form'])) { + elseif (!empty($plugin['edit form'])) { _ctools_content_create_form_info($form_info, $plugin['edit form'], $plugin, $subtype, $op); } } @@ -633,7 +640,7 @@ function _ctools_content_create_form_info(&$form_info, $info, $plugin, $subtype, if (empty($subtype['title'])) { $title = t('Configure'); } - else if ($op == 'add') { + elseif ($op == 'add') { $title = t('Configure new !subtype_title', array('!subtype_title' => $subtype['title'])); } else { @@ -648,7 +655,7 @@ function _ctools_content_create_form_info(&$form_info, $info, $plugin, $subtype, ), ); } - else if (is_array($info)) { + elseif (is_array($info)) { $form_info['order'] = array(); $form_info['forms'] = array(); $count = 0; @@ -699,7 +706,7 @@ function ctools_content_get_available_types($contexts = NULL, $has_content = FAL 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 + // Exclude items that require content if we're saying we don't // provide it. if (!empty($subtype['requires content']) && !$has_content) { continue; @@ -739,7 +746,6 @@ function ctools_content_get_available_types($contexts = NULL, $has_content = FAL * 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(); diff --git a/sites/all/modules/contrib/dev/ctools/includes/content.menu.inc b/sites/all/modules/contrib/dev/ctools/includes/content.menu.inc index f7f93406..64d44b0b 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/content.menu.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/content.menu.inc @@ -62,9 +62,8 @@ function ctools_content_autocomplete_entity($entity_type, $string = '') { } } -/* - * Use well known/tested entity reference code to build our search query - * From EntityReference_SelectionHandler_Generic class +/** + * 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']; @@ -92,13 +91,13 @@ function _ctools_buildQuery($entity_type, $entity_info, $match = NULL, $match_op 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'.โ€จ + // '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โ€จ + // 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); @@ -125,7 +124,7 @@ function _ctools_getReferencableEntities($entity_type, $entity_info, $match = NU global $user; $account = $user; $options = array(); - // We're an entity ID, return the id + // 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'])) { @@ -143,10 +142,10 @@ function _ctools_getReferencableEntities($entity_type, $entity_info, $match = NU // If you don't have access, or an access callback or a valid entity, just // Return back the Entity ID. return array( - $match => array( + $match => array( 'label' => $match, 'bundle' => NULL, - ), + ), ); } diff --git a/sites/all/modules/contrib/dev/ctools/includes/content.plugin-type.inc b/sites/all/modules/contrib/dev/ctools/includes/content.plugin-type.inc index a0debc3e..0364a927 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/content.plugin-type.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/content.plugin-type.inc @@ -14,4 +14,4 @@ function ctools_content_plugin_type(&$items) { 'path' => drupal_get_path('module', 'ctools') . '/includes', ), ); -} \ No newline at end of file +} diff --git a/sites/all/modules/contrib/dev/ctools/includes/context-access-admin.inc b/sites/all/modules/contrib/dev/ctools/includes/context-access-admin.inc index ea2a7c81..d8c4f3b1 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/context-access-admin.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/context-access-admin.inc @@ -245,10 +245,10 @@ function ctools_access_admin_form_submit($form, &$form_state) { // -------------------------------------------------------------------------- // 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'); @@ -263,7 +263,7 @@ function ctools_access_ajax_add($fragment = NULL, $name = NULL) { ctools_ajax_render_error(); } - // Separate the fragment into 'module' and 'argument' + // Separate the fragment into 'module' and 'argument'. if (strpos($fragment, '-') === FALSE) { $module = $fragment; $argument = NULL; @@ -279,7 +279,7 @@ function ctools_access_ajax_add($fragment = NULL, $name = NULL) { list($access, $contexts) = $function($argument); - // Make sure we have the logged in user context + // Make sure we have the logged in user context. if (!isset($contexts['logged-in-user'])) { $contexts['logged-in-user'] = ctools_access_get_loggedin_context(); } @@ -306,6 +306,9 @@ function ctools_access_ajax_add($fragment = NULL, $name = NULL) { ); $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)) { @@ -333,7 +336,7 @@ function ctools_access_ajax_edit($fragment = NULL, $id = NULL) { ctools_ajax_render_error(); } - // Separate the fragment into 'module' and 'argument' + // Separate the fragment into 'module' and 'argument'. if (strpos($fragment, '-') === FALSE) { $module = $fragment; $argument = NULL; @@ -353,7 +356,7 @@ function ctools_access_ajax_edit($fragment = NULL, $id = NULL) { ctools_ajax_render_error(); } - // Make sure we have the logged in user context + // Make sure we have the logged in user context. if (!isset($contexts['logged-in-user'])) { $contexts['logged-in-user'] = ctools_access_get_loggedin_context(); } @@ -372,6 +375,9 @@ function ctools_access_ajax_edit($fragment = NULL, $id = NULL) { ); $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)) { @@ -451,7 +457,7 @@ function ctools_access_ajax_delete($fragment = NULL, $id = NULL) { ajax_render_error(); } - // Separate the fragment into 'module' and 'argument' + // Separate the fragment into 'module' and 'argument'. if (strpos($fragment, '-') === FALSE) { $module = $fragment; $argument = NULL; @@ -471,7 +477,7 @@ function ctools_access_ajax_delete($fragment = NULL, $id = NULL) { unset($access['plugins'][$id]); } - // re-cache + // re-cache. $function = $module . '_ctools_access_set'; if (function_exists($function)) { $function($argument, $access); diff --git a/sites/all/modules/contrib/dev/ctools/includes/context-admin.inc b/sites/all/modules/contrib/dev/ctools/includes/context-admin.inc index 821a5b32..533c89f5 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/context-admin.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/context-admin.inc @@ -395,7 +395,7 @@ function ctools_context_ajax_item_add($mechanism = NULL, $type = NULL, $cache_ke if (!empty($form_state['cancel'])) { $output = array(ctools_modal_command_dismiss()); } - else if (!empty($form_state['complete'])) { + 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 @@ -580,7 +580,7 @@ function ctools_context_ajax_item_edit($mechanism = NULL, $type = NULL, $cache_k if (!empty($form_state['cancel'])) { $output = array(ctools_modal_command_dismiss()); } - else if (!empty($form_state['complete'])) { + elseif (!empty($form_state['complete'])) { // successful submit $ref[$position] = $conf; if (isset($object->temporary)) { @@ -657,7 +657,7 @@ function ctools_context_get_defaults($plugin_definition, $object, $type) { if (isset($plugin_definition['defaults'])) { $defaults = $plugin_definition['defaults']; } - else if (isset($subtype['defaults'])) { + elseif (isset($subtype['defaults'])) { $defaults = $subtype['defaults']; } @@ -667,7 +667,7 @@ function ctools_context_get_defaults($plugin_definition, $object, $type) { $conf += $settings; } } - else if (is_array($defaults)) { + elseif (is_array($defaults)) { $conf += $defaults; } } diff --git a/sites/all/modules/contrib/dev/ctools/includes/context-task-handler.inc b/sites/all/modules/contrib/dev/ctools/includes/context-task-handler.inc index 21ceea5d..ed4acad0 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/context-task-handler.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/context-task-handler.inc @@ -4,9 +4,9 @@ * @file * Support for creating 'context' type task handlers. * - * Context task handlers expect the task to provide 0 or more contexts. The - * task handler should use those contexts as selection rules, as well as - * rendering with them. + * Context task handlers expect the task to provide 0 or more contexts. The task + * handler should use those contexts as selection rules, as well as rendering + * with them. * * The functions and forms in this file should be common to every context type * task handler made. @@ -31,6 +31,7 @@ * 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. + * * @return * Either the output or NULL if there was output, FALSE if no handler * accepted the task. If $page is FALSE then the $info block is returned instead. @@ -84,7 +85,7 @@ function ctools_context_handler_get_render_handler($task, $subtask, $handlers, $ */ function ctools_context_handler_default_test($handler, $base_contexts, $args) { ctools_include('context'); - // Add my contexts + // Add my contexts. $contexts = ctools_context_handler_get_handler_contexts($base_contexts, $handler); // Test. @@ -128,7 +129,7 @@ function ctools_context_handler_render_handler($task, $subtask, $handler, $conte 'contexts' => $contexts, 'task' => $task, 'subtask' => $subtask, - 'handler' => $handler + 'handler' => $handler, ); drupal_alter('ctools_render', $info, $page, $context); @@ -141,12 +142,15 @@ function ctools_context_handler_render_handler($task, $subtask, $handler, $conte 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: @@ -162,7 +166,7 @@ function ctools_context_handler_render_handler($task, $subtask, $handler, $conte 'fragment' => $info['fragment'], ); drupal_goto($info['destination'], $options, $info['response code']); - // @todo -- should other response codes be supported here? + // @todo -- should other response codes be supported here? } } @@ -222,7 +226,7 @@ function ctools_context_handler_render_handler($task, $subtask, $handler, $conte } /** - * Default function to provide contextual link for a task as defined by the handler. + * 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 @@ -241,7 +245,7 @@ function ctools_task_handler_default_contextual_link($handler, $plugin, $context if (is_array($plugin['tab operation'])) { $trail = $plugin['tab operation']; } - else if (function_exists($plugin['tab operation'])) { + elseif (function_exists($plugin['tab operation'])) { $trail = $plugin['tab operation']($handler, $contexts, $args); } } @@ -251,7 +255,8 @@ function ctools_task_handler_default_contextual_link($handler, $plugin, $context 'href' => $path, 'title' => $title, 'query' => drupal_get_destination(), - )); + ), + ); return $links; } @@ -259,17 +264,22 @@ function ctools_task_handler_default_contextual_link($handler, $plugin, $context /** * Called to execute actions that should happen before a handler is rendered. */ -function ctools_context_handler_pre_render($handler, $contexts, $args) { } +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 $handler + * @param object $handler * The handler in question. - * @param $contexts + * @param object $contexts * The context objects provided by the task. * - * @return + * @return bool * TRUE if these contexts match the selection rules. NULL or FALSE * otherwise. */ @@ -288,12 +298,15 @@ function ctools_context_handler_select($handler, $contexts) { * These summary strings are used to communicate to the user what * arguments the task handlers are selecting. * - * @param $task + * @param object $task * The loaded task plugin. - * @param $subtask + * @param object $subtask * The subtask id. - * @param $handler + * @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'])) { @@ -320,7 +333,6 @@ function ctools_context_handler_summary($task, $subtask, $handler) { // 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. * @@ -368,7 +380,7 @@ function ctools_context_handler_get_all_contexts($task, $subtask, $handler) { * expects things in a certain, kind of clunky format. */ function ctools_context_handler_get_handler_object($handler) { - $object = new stdClass; + $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(); @@ -382,7 +394,7 @@ function ctools_context_handler_get_handler_object($handler) { * arguments from the task. */ function ctools_context_handler_get_task_object($task, $subtask, $handler) { - $object = new stdClass; + $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); @@ -456,7 +468,7 @@ function ctools_context_handler_edit_criteria($form, &$form_state) { 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 + // 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; @@ -472,7 +484,7 @@ function ctools_context_handler_edit_criteria($form, &$form_state) { } /** - * Submit handler for rules selection + * 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']; @@ -537,4 +549,3 @@ function ctools_context_handler_edit_context_submit(&$form, &$form_state) { unset($form_state['page']->context_cache[$cache_name]); } } - diff --git a/sites/all/modules/contrib/dev/ctools/includes/context.inc b/sites/all/modules/contrib/dev/ctools/includes/context.inc index a532f657..0fc62080 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/context.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/context.inc @@ -2,7 +2,6 @@ /** * @file - * * Contains code related to the ctools system of 'context'. * * Context, originally from Panels, is a method of packaging objects into @@ -28,28 +27,104 @@ * of the context is important. */ class ctools_context { - var $type = NULL; - var $data = NULL; - // The title of this object. - var $title = ''; - // The title of the page if this object exists - var $page_title = ''; - // The identifier (in the UI) of this object - var $identifier = ''; - var $argument = NULL; - var $keyword = ''; - var $original_argument = NULL; - var $restrictions = array(); - var $empty = FALSE; + /** + * @var string|array + * A string naming this specific context type. The values 'any' and 'none' + * are special: + * - 'any': used in is_type() to match any other type. + * - 'none': used to signal the type is not defined. + */ + public $type; - function __construct($type = 'none', $data = NULL) { - $this->type = $type; - $this->data = $data; + /** + * @var mixed + * The data payload for this context object. + */ + public $data; + + /** + * @var string + * The title of this object. + */ + public $title; + + /** + * @var string + * The title of the page if this object exists + */ + public $page_title; + + /** + * @var string + * The identifier (in the UI) of this object. + */ + public $identifier; + + /** + * @var + */ + public $argument; + + /** + * @var string + */ + public $keyword; + + /** + * @var + */ + public $original_argument; + + /** + * @var array + */ + public $restrictions; + + /** + * @var bool + */ + public $empty; + + /** + * The ctools_context constructor. + * + * @param string $type + * The type name of this context. Should be unique. Use the machine_name + * conventions: lowercase, short, underscores and no spaces. + * @param mixed $data + * The data payload, if required for this context. + */ + public function __construct($type = 'none', $data = NULL) { + $this->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. } - function is_type($type) { - if ($type == 'any' || $this->type == 'any') { + /** + * 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; } @@ -58,32 +133,71 @@ class ctools_context { return (bool) array_intersect($a, $b); } - function get_argument() { + /** + * Return the argument. + * + * @return mixed + * The value of $argument. + */ + public function get_argument() { return $this->argument; } - function get_original_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; } - function get_keyword() { + /** + * Return the keyword. + * + * @return mixed + * The value of $keyword. + */ + public function get_keyword() { return $this->keyword; } - function get_identifier() { + /** + * Return the identifier. + * + * @return mixed + * The value of $identifier. + */ + public function get_identifier() { return $this->identifier; } - function get_title() { + /** + * Return the title. + * + * @return mixed + * The value of $title. + */ + public function get_title() { return $this->title; } - function get_page_title() { + /** + * Return the page title. + * + * @return mixed + * The value of $page_title. + */ + public function get_page_title() { return $this->page_title; } + } /** @@ -91,39 +205,57 @@ class ctools_context { * match a required context type. */ class ctools_context_required { - var $keywords = ''; + /** + * @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. */ - var $title = NULL; + public $title; /** * Test to see if this context is required. */ - var $required = TRUE; + public $required = TRUE; /** * If TRUE, skip the check in ctools_context_required::select() * for contexts whose names may have changed. */ - var $skip_name_check = FALSE; + public $skip_name_check = FALSE; /** + * The ctools_context_required constructor. * - * @param $title - * The first parameter should be the 'title' of the context for use - * in UYI selectors when multiple contexts qualify. - * @param ... + * 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. */ - function __construct($title) { + 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 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); } @@ -133,20 +265,44 @@ class ctools_context_required { $this->restrictions = array_pop($args); } - if (count($args) == 1) { + if (count($args) === 1) { $args = array_shift($args); } $this->keywords = $args; } - function filter($contexts) { + /** + * 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 + /** + * 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, @@ -155,11 +311,16 @@ class ctools_context_required { if (!is_array($values)) { $values = array($values); } - if (!empty($context->restrictions[$key]) && !array_intersect($values, $context->restrictions[$key])) { + + 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; } } @@ -167,7 +328,28 @@ class ctools_context_required { return $result; } - function select($contexts, $context) { + /** + * 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); @@ -177,11 +359,12 @@ class ctools_context_required { } } - // 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 our context IDs changed. See if there's another context - // that satisfies our requirements. - if (!$this->skip_name_check && !empty($context) && !isset($contexts[$context])) { + // 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. @@ -196,6 +379,7 @@ class ctools_context_required { } return $contexts[$context]; } + } /** @@ -203,24 +387,73 @@ class ctools_context_required { * can produce empty contexts to use as placeholders. */ class ctools_context_optional extends ctools_context_required { - var $required = FALSE; /** - * Add the 'empty' context which is possible for optional + * {@inheritdoc} */ - function add_empty(&$contexts) { + 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->title = t('No context'); $context->identifier = t('No context'); $contexts['empty'] = $context; } - function filter($contexts) { + /** + * 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); } - function select($contexts, $context) { + /** + * 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']; @@ -230,11 +463,12 @@ class ctools_context_optional extends ctools_context_required { // Don't flip out if it can't find the context; this is optional, put // in an empty. - if ($result == FALSE) { + if ($result === FALSE) { $result = $contexts['empty']; } return $result; } + } /** @@ -249,20 +483,20 @@ class ctools_context_optional extends ctools_context_required { * 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 $contexts + * @param array $contexts * A keyed array of all available contexts. - * @param $required - * A ctools_context_required or ctools_context_optional object, or an array - * of such objects. + * @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 + * @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 $r) { - $result = array_merge($result, _ctools_context_filter($contexts, $r)); + foreach ($required as $item) { + $result = array_merge($result, _ctools_context_filter($contexts, $item)); } return $result; } @@ -270,6 +504,21 @@ function ctools_context_filter($contexts, $required) { 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(); @@ -289,12 +538,17 @@ function _ctools_context_filter($contexts, $required) { * If an array of required contexts is provided, one selector will be * provided for each context. * - * @param $contexts + * @param array $contexts * A keyed array of all available contexts. - * @param $required + * @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 + * @return array * A form element, or NULL if there are no contexts that satisfy the * requirements. */ @@ -302,8 +556,10 @@ function ctools_context_selector($contexts, $required, $default) { if (is_array($required)) { $result = array('#tree' => TRUE); $count = 1; - foreach ($required as $id => $r) { - $result[] = _ctools_context_selector($contexts, $r, isset($default[$id]) ? $default[$id] : '', $count++); + foreach ($required as $id => $item) { + $result[] = _ctools_context_selector( + $contexts, $item, isset($default[$id]) ? $default[$id] : '', $count++ + ); } return $result; } @@ -311,6 +567,27 @@ function ctools_context_selector($contexts, $required, $default) { 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); @@ -354,8 +631,8 @@ function _ctools_context_selector($contexts, $required, $default, $num = 0) { * @param $required * The required context object or array of objects. * - * @return - * TRUE if there are enough contexts, FALSE if there are not. + * @return bool + * True if there are enough contexts, otherwise False. */ function ctools_context_match_requirements($contexts, $required) { if (!is_array($required)) { @@ -388,8 +665,13 @@ function ctools_context_match_requirements($contexts, $required) { * 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 + * @return array * A form element, or NULL if there are no contexts that satisfy the * requirements. */ @@ -397,8 +679,11 @@ function ctools_context_converter_selector($contexts, $required, $default) { if (is_array($required)) { $result = array('#tree' => TRUE); $count = 1; - foreach ($required as $id => $r) { - $result[] = _ctools_context_converter_selector($contexts, $r, isset($default[$id]) ? $default[$id] : '', $count++); + foreach ($required as $id => $dependency) { + $default_id = isset($default[$id]) ? $default[$id] : ''; + $result[] = _ctools_context_converter_selector( + $contexts, $dependency, $default_id, $count++ + ); } return $result; } @@ -406,17 +691,36 @@ function ctools_context_converter_selector($contexts, $required, $default) { 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); - $form = array(); - 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') { + if ($context->type === 'any') { $options[''] = t('No context'); continue; } @@ -446,10 +750,22 @@ function _ctools_context_converter_selector($contexts, $required, $default, $num '#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)) { @@ -461,6 +777,17 @@ function ctools_context_get_converters($cid, $context) { /** * 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); @@ -472,7 +799,7 @@ function _ctools_context_get_converters($id, $plugin_name) { if (is_array($plugin['convert list'])) { $converters = $plugin['convert list']; } - else if ($function = ctools_plugin_get_function($plugin, 'convert list')) { + elseif ($function = ctools_plugin_get_function($plugin, 'convert list')) { $converters = (array) $function($plugin); } @@ -492,7 +819,13 @@ function _ctools_context_get_converters($id, $plugin_name) { } /** - * Get a list of all contexts + converters available. + * 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(); @@ -512,21 +845,24 @@ function ctools_context_get_all_converters() { /** * Let the context convert an argument based upon the converter that was given. * - * @param $context - * The context object - * @param $converter - * The converter to use, which should be a string provided by the converter list. - * @param $converter_options - * A n array of options to pass on to the generation function. For contexts + * @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; + return NULL; } $value = $context->argument; @@ -547,22 +883,35 @@ function ctools_context_convert_context($context, $converter, $converter_options * Choose a context or contexts based upon the selection made via * ctools_context_filter. * - * @param $contexts - * A keyed array of all available contexts - * @param $required - * The required context object provided by the plugin + * @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 + * 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 => $r) { + 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, $r, $context[$id])) === FALSE) { + if (($result[] = _ctools_context_select($contexts, $item, $context[$id])) === FALSE) { return FALSE; } } @@ -572,6 +921,22 @@ function ctools_context_select($contexts, $required, $context) { 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; @@ -583,16 +948,14 @@ function _ctools_context_select($contexts, $required, $context) { /** * Create a new context object. * - * @param $type + * @param string $type * The type of context to create; this loads a plugin. - * @param $data + * @param mixed $data * The data to put into the context. - * @param $empty - * Whether or not this context is specifically empty. * @param $conf * A configuration structure if this context was created via UI. * - * @return + * @return ctools_context * A $context or NULL if one could not be created. */ function ctools_context_create($type, $data = NULL, $conf = FALSE) { @@ -615,7 +978,7 @@ function ctools_context_create($type, $data = NULL, $conf = FALSE) { * @param $type * The type of context to create; this loads a plugin. * - * @return + * @return ctools_context * A $context or NULL if one could not be created. */ function ctools_context_create_empty($type) { @@ -632,8 +995,21 @@ function ctools_context_create_empty($type) { /** * 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, $converter_options = array()) { +function ctools_context_keyword_substitute($string, $keywords, $contexts, array $converter_options = array()) { // Ensure a default keyword exists: $keywords['%%'] = '%'; @@ -656,7 +1032,7 @@ function ctools_context_keyword_substitute($string, $keywords, $contexts, $conve // If the keyword is already set by something passed in, don't try to // overwrite it. - if (!empty($keywords['%' . $keyword])) { + if (array_key_exists('%' . $keyword, $keywords)) { continue; } @@ -683,11 +1059,13 @@ function ctools_context_keyword_substitute($string, $keywords, $contexts, $conve 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; + if (!empty($converter)) { + $keywords['%' . $keyword] = ctools_context_convert_context($context_keywords[$context], $converter, $converter_options); + } + else { + $keywords['%' . $keyword] = $context_keywords[$keyword]->title; + } } } } @@ -696,18 +1074,22 @@ function ctools_context_keyword_substitute($string, $keywords, $contexts, $conve } /** - * Determine a unique context ID for a context + * 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 (!$context['id']) { + // If not set, FALSE or empty. + if (!isset($context['id']) || !$context['id']) { $context['id'] = 1; } - return $type . '_' . $context['name'] . '_' . $context['id']; + // @todo is '' the appropriate default value? + $name = isset($context['name']) ? $context['name'] : ''; + + return $type . '_' . $name . '_' . $context['id']; } /** @@ -715,42 +1097,46 @@ function ctools_context_id($context, $type = 'context') { * * This finds the next id available for the named object. * - * @param $objects - * A list of context descriptor objects, i.e, arguments, relationships, contexts, etc. - * @param $name + * @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 + // 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 ($object['id'] > $id) { + if (isset($object['name']) && $object['name'] === $name) { + if (isset($object['id']) && $object['id'] > $id) { $id = $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 on a specific argument plugin. + * Fetch metadata for a specific argument plugin. * * @param $argument * Name of an argument plugin. * - * @return + * @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); @@ -759,7 +1145,7 @@ function ctools_get_argument($argument) { /** * Fetch metadata for all argument plugins. * - * @return + * @return array * An array of arrays with information about all available argument plugins. */ function ctools_get_arguments() { @@ -779,22 +1165,23 @@ function ctools_get_arguments() { * - 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. + * 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 + * @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; + return NULL; } - if ($function = ctools_plugin_load_function('ctools', 'arguments', $argument['name'], 'context')) { + $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']; @@ -806,8 +1193,8 @@ function ctools_context_get_context_from_argument($argument, $arg, $empty = FALS 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->keyword = $argument['keyword']; + $context->id = ctools_context_id($argument, 'argument'); $context->original_argument = $arg; if (!empty($context->empty)) { @@ -823,6 +1210,12 @@ function ctools_context_get_context_from_argument($argument, $arg, $empty = FALS /** * 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(); @@ -838,19 +1231,21 @@ function ctools_context_get_placeholders_from_argument($arguments) { /** * Load the contexts for a given list of arguments. * - * @param $arguments + * @param array $arguments * The array of argument definitions. - * @param &$contexts + * @param array &$contexts * The array of existing contexts. New contexts will be added to this array. - * @param $args + * @param array $args * The arguments to load. * - * @return - * FALSE if an argument wants to 404. + * @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. + // Pull the argument off the list. $arg = array_shift($args); $id = ctools_context_id($argument, 'argument'); @@ -865,7 +1260,10 @@ function ctools_context_get_context_from_arguments($arguments, &$contexts, $args $context = $contexts[$id]; } - if ((empty($context) || empty($context->data)) && !empty($argument['default']) && $argument['default'] == '404') { + if ((empty($context) || empty($context->data)) + && !empty($argument['default']) + && $argument['default'] === '404' + ) { return FALSE; } } @@ -874,16 +1272,18 @@ function ctools_context_get_context_from_arguments($arguments, &$contexts, $args // --------------------------------------------------------------------------- // Functions related to contexts from relationships. - /** - * Fetch metadata on a specific relationship plugin. + * Fetch plugin metadata for a specific relationship plugin. * - * @param $content type + * @param $relationship * Name of a panel content type. * - * @return + * @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); @@ -892,8 +1292,10 @@ function ctools_get_relationship($relationship) { /** * Fetch metadata for all relationship plugins. * - * @return + * @return array * An array of arrays with information about all available relationships. + * + * @see ctools_get_relationship() */ function ctools_get_relationships() { ctools_include('plugins'); @@ -901,8 +1303,9 @@ function ctools_get_relationships() { } /** + * Return a context from a relationship. * - * @param $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. @@ -910,18 +1313,21 @@ function ctools_get_relationships() { * defined by the UI. * - keyword: The keyword used for this relationship for substitutions. * - * @param $source_context + * @param ctools_context $source_context * The context this relationship is based upon. - * - * @param $placeholders + * @param bool $placeholders * If TRUE, placeholders are acceptable. * - * @return - * A context object if one can be loaded. + * @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'); - if ($function = ctools_plugin_load_function('ctools', 'relationships', $relationship['name'], 'context')) { + $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']; @@ -932,7 +1338,7 @@ function ctools_context_get_context_from_relationship($relationship, $source_con if ($context) { $context->identifier = $relationship['identifier']; $context->page_title = isset($relationship['title']) ? $relationship['title'] : ''; - $context->keyword = $relationship['keyword']; + $context->keyword = $relationship['keyword']; if (!empty($context->empty)) { $context->placeholder = array( 'type' => 'relationship', @@ -942,6 +1348,7 @@ function ctools_context_get_context_from_relationship($relationship, $source_con return $context; } } + return NULL; } /** @@ -955,18 +1362,24 @@ function ctools_context_get_context_from_relationship($relationship, $source_con * @param $contexts * An array of contexts used to figure out which relationships are relevant. * - * @return + * @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 + // 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'])) { + if (empty($relationship['no ui']) + && ctools_context_filter($contexts, $relationship['required context']) + ) { $relevant[$rid] = $relationship['title']; } } @@ -975,7 +1388,7 @@ function ctools_context_get_relevant_relationships($contexts) { } /** - * Fetch all active relationships + * Fetch all active relationships. * * @param $relationships * An keyed array of relationship data including: @@ -990,10 +1403,11 @@ function ctools_context_get_relevant_relationships($contexts) { * * @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) { - $return = array(); - foreach ($relationships as $rdata) { if (!isset($rdata['context'])) { continue; @@ -1024,16 +1438,16 @@ function ctools_context_get_context_from_relationships($relationships, &$context // --------------------------------------------------------------------------- // Functions related to loading contexts from simple context definitions. - /** * Fetch metadata on a specific context plugin. * - * @param $context + * @param string $context * Name of a context. * - * @return + * @return array * An array with information about the requested panel context. */ + function ctools_get_context($context) { static $gate = array(); ctools_include('plugins'); @@ -1057,7 +1471,7 @@ function ctools_get_context($context) { /** * Fetch metadata for all context plugins. * - * @return + * @return array * An array of arrays with information about all available panel contexts. */ function ctools_get_contexts() { @@ -1066,27 +1480,38 @@ function ctools_get_contexts() { } /** + * Return a context object from a context definition array. * - * @param $context + * 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 $type + * @param string $type * This is either 'context' which indicates the context will be loaded - * from data in the settings, or 'required_context' which means the + * 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 + * @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']); - if ($function = ctools_plugin_get_function($plugin, 'context')) { + $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']; @@ -1101,7 +1526,7 @@ function ctools_context_get_context_from_context($context, $type = 'context', $a if ($return) { $return->identifier = $context['identifier']; $return->page_title = isset($context['title']) ? $context['title'] : ''; - $return->keyword = $context['keyword']; + $return->keyword = $context['keyword']; if (!empty($context->empty)) { $context->placeholder = array( @@ -1113,6 +1538,8 @@ function ctools_context_get_context_from_context($context, $type = 'context', $a return $return; } } + + return NULL; } /** @@ -1126,7 +1553,10 @@ function ctools_context_get_context_from_context($context, $type = 'context', $a * 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. + * 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(); @@ -1145,17 +1575,20 @@ function ctools_context_get_context_from_contexts($contexts, $type = 'context', /** * 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. + * 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. + * 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(); @@ -1167,7 +1600,7 @@ function ctools_context_match_required_contexts($required, $contexts) { $context = clone array_shift($contexts); $context->identifier = $r['identifier']; $context->page_title = isset($r['title']) ? $r['title'] : ''; - $context->keyword = $r['keyword']; + $context->keyword = $r['keyword']; $return[ctools_context_id($r, 'requiredcontext')] = $context; } @@ -1179,31 +1612,35 @@ function ctools_context_match_required_contexts($required, $contexts) { * * 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. + * 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 + * @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. - * Since 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 $placeholders - * If TRUE, this will generate placeholder objects for types this function + * - 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 $contexts + * @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)) { @@ -1227,7 +1664,7 @@ function ctools_context_load_contexts($object, $placeholders = TRUE, $contexts = $contexts += ctools_context_get_context_from_contexts($object->contexts, 'context', $placeholders); } - // add contexts from relationships + // Add contexts from relationships. if (!empty($object->relationships) && is_array($object->relationships)) { ctools_context_get_context_from_relationships($object->relationships, $contexts, $placeholders); } @@ -1246,7 +1683,7 @@ function ctools_context_load_contexts($object, $placeholders = TRUE, $contexts = 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 + // 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; @@ -1265,7 +1702,7 @@ function ctools_context_get_form($contexts) { * The arguments. These will be acquired from $form_state['values'] and the * keys must match the context IDs. * - * @return + * @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. @@ -1284,12 +1721,14 @@ function ctools_context_replace_placeholders($contexts, $arguments) { $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']; @@ -1338,32 +1777,37 @@ function ctools_context_replace_form(&$form, $contexts) { 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; + 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)); + $form[$cid]['#title'] = t('@identifier (@keyword)', array( + '@keyword' => '%' . $context->keyword, + '@identifier' => $context->identifier, + )); } } } } // --------------------------------------------------------------------------- -// Functions related to loading access control plugins - +// Functions related to loading access control plugins. /** * Fetch metadata on a specific access control plugin. * * @param $name * Name of a plugin. * - * @return + * @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); @@ -1372,7 +1816,7 @@ function ctools_get_access_plugin($name) { /** * Fetch metadata for all access control plugins. * - * @return + * @return array * An array of arrays with information about all available access control plugins. */ function ctools_get_access_plugins() { @@ -1384,8 +1828,14 @@ function ctools_get_access_plugins() { * 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 + * 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'])) { @@ -1395,7 +1845,9 @@ function ctools_get_relevant_access_plugins($contexts) { $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'])) { + if (!empty($plugin['required context']) + && !ctools_context_match_requirements($contexts, $plugin['required context']) + ) { continue; } $plugins[$id] = $plugin; @@ -1410,14 +1862,17 @@ function ctools_get_relevant_access_plugins($contexts) { 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; + $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'])) { @@ -1427,8 +1882,9 @@ function ctools_access_summary($plugin, $contexts, $test) { $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(); - $description = $function($test['settings'], ctools_context_select($contexts, $required_context, $context), $plugin); + $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'])) { @@ -1440,10 +1896,23 @@ function ctools_access_summary($plugin, $contexts, $test) { /** * 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'])) { - return; + if (empty($access['plugins']) || !is_array($access['plugins'])) { + return NULL; } $descriptions = array(); @@ -1452,21 +1921,29 @@ function ctools_access_group_summary($access, $contexts) { $descriptions[] = ctools_access_summary($plugin, $contexts, $test); } - $separator = (isset($access['logic']) && $access['logic'] == 'and') ? t(', and ') : t(', or '); + $separator = + (isset($access['logic']) && $access['logic'] === 'and') + ? t(', and ') : t(', or '); return implode($separator, $descriptions); } /** - * Determine if the current user has access via plugin. + * Determine if the current user has access via a plugin. * - * @param $settings - * An array of settings theoretically set by the user. - * @param $contexts + * @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 - * TRUE if access is granted, false if otherwise. + * @return bool + * TRUE if access is granted, FALSE if otherwise. */ function ctools_access($settings, $contexts = array()) { if (empty($settings['plugins'])) { @@ -1505,7 +1982,7 @@ function ctools_access($settings, $contexts = array()) { // Pass if 'or' and this rule passed. return TRUE; } - else if (!$pass && $settings['logic'] == 'and') { + elseif (!$pass && $settings['logic'] == 'and') { // Fail if 'and' and this rule failed. return FALSE; } @@ -1513,7 +1990,7 @@ function ctools_access($settings, $contexts = array()) { // Return TRUE if logic was and, meaning all rules passed. // Return FALSE if logic was or, meaning no rule passed. - return $settings['logic'] == 'and'; + return ($settings['logic'] === 'and'); } /** @@ -1522,7 +1999,7 @@ function ctools_access($settings, $contexts = array()) { * @param $plugin * The access plugin being used. * - * @return + * @return array * A default configured test that should be placed in $access['plugins']; */ function ctools_access_new_test($plugin) { @@ -1544,7 +2021,6 @@ function ctools_access_new_test($plugin) { } } - $default = NULL; if (isset($plugin['default'])) { $default = $plugin['default']; @@ -1558,7 +2034,7 @@ function ctools_access_new_test($plugin) { if (is_array($default)) { $test['settings'] = $default; } - else if (function_exists($default)) { + elseif (function_exists($default)) { $test['settings'] = $default(); } else { @@ -1572,11 +2048,23 @@ function ctools_access_new_test($plugin) { /** * 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. + * 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'])) { + if (empty($settings['plugins']) || !is_array($settings['plugins'])) { return; } @@ -1585,16 +2073,20 @@ function ctools_access_add_restrictions($settings, $contexts) { } // We're not going to try to figure out restrictions on the or. - if ($settings['logic'] == 'or' && count($settings['plugins']) > 1) { + if ($settings['logic'] === 'or' && count($settings['plugins']) > 1) { return; } foreach ($settings['plugins'] as $test) { $plugin = ctools_get_access_plugin($test['name']); - if ($plugin && $function = ctools_plugin_get_function($plugin, 'restrictions')) { + // $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/sites/all/modules/contrib/dev/ctools/includes/context.menu.inc b/sites/all/modules/contrib/dev/ctools/includes/context.menu.inc index ee227cb7..798d167c 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/context.menu.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/context.menu.inc @@ -25,7 +25,7 @@ function ctools_context_menu(&$items) { 'page callback' => 'ctools_context_ajax_item_delete', ) + $base; - // For the access system + // For the access system. $base['file'] = 'includes/context-access-admin.inc'; $items['ctools/context/ajax/access/add'] = array( 'page callback' => 'ctools_access_ajax_add', diff --git a/sites/all/modules/contrib/dev/ctools/includes/context.theme.inc b/sites/all/modules/contrib/dev/ctools/includes/context.theme.inc index 8f660b8c..d0d866f7 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/context.theme.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/context.theme.inc @@ -19,7 +19,6 @@ function ctools_context_theme(&$theme) { ); $theme['ctools_context_item_form'] = array( 'render element' => 'form', -// 'variables' => array('form' => NULL), 'file' => 'includes/context.theme.inc', ); $theme['ctools_context_item_row'] = array( @@ -27,7 +26,7 @@ function ctools_context_theme(&$theme) { 'file' => 'includes/context.theme.inc', ); - // For the access plugin + // For the access plugin. $theme['ctools_access_admin_add'] = array( 'render element' => 'form', 'file' => 'includes/context-access-admin.inc', @@ -62,10 +61,10 @@ function theme_ctools_context_item_row($vars) { 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']; + $output = ''; + $type = $form['#ctools_context_type']; + $module = $form['#ctools_context_module']; + $cache_key = $form['#cache_key']; $type_info = ctools_context_info($type); @@ -104,17 +103,17 @@ function theme_ctools_context_item_form($vars) { 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); + $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 .= '
    '; + $output .= theme('table', $theme_vars); + $output .= '
    '; } if (!empty($form['description'])) { $output .= render($form['description']); @@ -139,7 +138,7 @@ function theme_ctools_context_list($vars) { $description = (!empty($vars['description'])) ? $vars['description'] : NULL; $titles = array(); $output = ''; - $count = 1; + $count = 1; $contexts = ctools_context_load_contexts($object); @@ -209,7 +208,7 @@ function theme_ctools_context_list($vars) { } } - // And relationships + // And relationships. if (!empty($object->relationships)) { foreach ($object->relationships as $relationship) { $output .= ''; @@ -253,15 +252,15 @@ function theme_ctools_context_list($vars) { } /** - * ctools_context_list() but not in a table format because tabledrag - * won't let us have tables within tables and still drag. + * 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; + $count = 1; // Describe 'built in' contexts. if (!empty($object->base_contexts)) { foreach ($object->base_contexts as $id => $context) { @@ -312,7 +311,7 @@ function theme_ctools_context_list_no_table($vars) { $count++; } } - // And relationships + // And relationships. if (!empty($object->relationships)) { foreach ($object->relationships as $relationship) { $output .= '
    '; @@ -341,4 +340,3 @@ function theme_ctools_context_list_no_table($vars) { return $output; } - diff --git a/sites/all/modules/contrib/dev/ctools/includes/css.inc b/sites/all/modules/contrib/dev/ctools/includes/css.inc index 8cf5ed40..83fe1c34 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/css.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/css.inc @@ -1,6 +1,6 @@ $declaration) { foreach ($declaration as $property => $value) { if (!in_array($property, $allowed_properties)) { - // $filtered['properties'][$selector_str][$property] = $value; + // $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; + // $filtered['values'][$selector_str][$property] = $value;. unset($css[$selector_str][$property]); continue; } diff --git a/sites/all/modules/contrib/dev/ctools/includes/dependent.inc b/sites/all/modules/contrib/dev/ctools/includes/dependent.inc index 74de9197..20c25ded 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/dependent.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/dependent.inc @@ -44,7 +44,7 @@ * * A fuller example, that hides the menu title when no menu is selected: * @code - *function ctools_dependent_example() { + * function ctools_dependent_example() { * $form = array(); * $form['menu'] = array( * '#type' => 'fieldset', @@ -72,12 +72,12 @@ * ); * * return system_settings_form($form); - *} + * } * @endcode * * An example for hiding checkboxes using #prefix and #suffix: * @code - *function ctools_dependent_example_checkbox() { + * function ctools_dependent_example_checkbox() { * $form = array(); * $form['object'] = array( * '#type' => 'fieldset', @@ -111,7 +111,7 @@ * ); * * return system_settings_form($form); - *} + * } * @endcode * * Deprecated: @@ -125,7 +125,6 @@ /** * Process callback to add dependency to form items. - * */ function ctools_dependent_process($element, &$form_state, &$form) { return $element; diff --git a/sites/all/modules/contrib/dev/ctools/includes/dropbutton.theme.inc b/sites/all/modules/contrib/dev/ctools/includes/dropbutton.theme.inc index fcdd5a37..4b95ef0d 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/dropbutton.theme.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/dropbutton.theme.inc @@ -75,7 +75,7 @@ function theme_links__ctools_dropbutton($vars) { if (!empty($vars['links'])) { $is_drop_button = (count($vars['links']) > 1); - // Add needed files + // Add needed files. if ($is_drop_button) { ctools_add_js('dropbutton'); ctools_add_css('dropbutton'); @@ -86,7 +86,7 @@ function theme_links__ctools_dropbutton($vars) { static $id = 0; $id++; - // Wrapping div + // Wrapping div. $class = 'ctools-no-js'; $class .= ($is_drop_button) ? ' ctools-dropbutton' : ''; $class .= ' ctools-button'; @@ -98,21 +98,22 @@ function theme_links__ctools_dropbutton($vars) { $output .= '
    '; - // Add a twisty if this is a dropbutton + // Add a twisty if this is a dropbutton. if ($is_drop_button) { $vars['title'] = ($vars['title'] ? check_plain($vars['title']) : t('open')); $output .= ''; // ctools-link + // ctools-link. + $output .= '
    '; } - // The button content + // The button content. $output .= '
    '; // Check for attributes. theme_links expects an array(). @@ -132,12 +133,11 @@ function theme_links__ctools_dropbutton($vars) { // 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 + $output .= '
  • '; // ctools-content. + $output .= '
    '; // ctools-dropbutton. return $output; } else { return ''; } } - diff --git a/sites/all/modules/contrib/dev/ctools/includes/dropdown.theme.inc b/sites/all/modules/contrib/dev/ctools/includes/dropdown.theme.inc index 7e748f5e..b7636874 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/dropdown.theme.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/dropdown.theme.inc @@ -44,20 +44,21 @@ function ctools_dropdown_theme(&$items) { /** * Create a dropdown menu. * - * @param $title - * The text to place in the clickable area to activate the dropdown. - * @param $links - * A list of links to provide within the dropdown, suitable for use - * in via Drupal's theme('links'). - * @param $image - * If true, the dropdown link is an image and will not get extra decorations - * that a text dropdown link will. - * @param $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. + * @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) { +function theme_ctools_dropdown($vars) { // Provide a unique identifier for every dropdown on the page. static $id = 0; $id++; @@ -67,9 +68,7 @@ function theme_ctools_dropdown($vars) { ctools_add_js('dropdown'); ctools_add_css('dropdown'); - $output = ''; - - $output .= '
    '; + $output = '
    '; $output .= ''; // wrapper + $output .= '
    '; $output .= '
    '; $output .= '
    '; $output .= theme_links(array('links' => $vars['links'], 'attributes' => array(), 'heading' => '')); - $output .= '
    '; // container - $output .= '
    '; // container wrapper - $output .= '
    '; // dropdown + $output .= ''; + $output .= ''; + $output .= ''; + return $output; } - diff --git a/sites/all/modules/contrib/dev/ctools/includes/entity-access.inc b/sites/all/modules/contrib/dev/ctools/includes/entity-access.inc index 972cf13b..69f2c335 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/entity-access.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/entity-access.inc @@ -24,19 +24,23 @@ function _ctools_entity_access(&$entity_info, $entity_type) { // Sad panda, we don't use Entity API, lets manually add access callbacks. $entity_info['access callback'] = 'ctools_metadata_no_hook_node_access'; break; + case 'user': $entity_info['access callback'] = 'ctools_metadata_user_access'; break; + case 'comment': if (module_exists('comment')) { $entity_info['access callback'] = 'ctools_metadata_comment_access'; } break; + case 'taxonomy_term': if (module_exists('taxonomy')) { $entity_info['access callback'] = 'ctools_metadata_taxonomy_access'; } break; + case 'taxonomy_vocabulary': if (module_exists('taxonomy')) { $entity_info['access callback'] = 'ctools_metadata_taxonomy_access'; @@ -64,7 +68,7 @@ function _ctools_entity_access(&$entity_info, $entity_type) { * * @throws EntityMalformedException * - * @return boolean + * @return bool * TRUE if access is allowed, FALSE otherwise. */ function ctools_metadata_no_hook_node_access($op, $node = NULL, $account = NULL) { diff --git a/sites/all/modules/contrib/dev/ctools/includes/export-ui.inc b/sites/all/modules/contrib/dev/ctools/includes/export-ui.inc index 16e57d6e..72e5a2fd 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/export-ui.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/export-ui.inc @@ -81,7 +81,6 @@ function ctools_export_ui_process(&$plugin, $info) { // 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'; } @@ -297,7 +296,6 @@ function ctools_export_ui_process(&$plugin, $info) { ); // 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( @@ -335,7 +333,7 @@ function ctools_export_ui_process(&$plugin, $info) { $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..'), + 'information' => t('This action will permanently remove this item from your database.'), 'success' => t('The item has been deleted.'), ); @@ -414,6 +412,7 @@ function ctools_export_ui_plugin_base_path($plugin) { * 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. */ @@ -429,12 +428,11 @@ function ctools_export_ui_plugin_menu_path($plugin, $item_id, $export_key = NULL * Helper function to include CTools plugins and get an export-ui exportable. * * @param $plugin_name - * The plugin that should be laoded. + * 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); - } /** @@ -456,14 +454,14 @@ function ctools_export_ui_switcher_page($plugin_name, $op) { $args = func_get_args(); $js = !empty($_REQUEST['js']); - // Load the $plugin information + // Load the $plugin information. $plugin = ctools_get_export_ui($plugin_name); $handler = ctools_export_ui_get_handler($plugin); if ($handler) { $method = $op . '_page'; if (method_exists($handler, $method)) { - // replace the first two arguments: + // Replace the first two arguments: $args[0] = $js; $args[1] = $_POST; return call_user_func_array(array($handler, $method), $args); diff --git a/sites/all/modules/contrib/dev/ctools/includes/export-ui.menu.inc b/sites/all/modules/contrib/dev/ctools/includes/export-ui.menu.inc index d27bf157..0fda8c25 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/export-ui.menu.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/export-ui.menu.inc @@ -1,5 +1,9 @@ array('handler'), ); -} \ No newline at end of file +} diff --git a/sites/all/modules/contrib/dev/ctools/includes/export.inc b/sites/all/modules/contrib/dev/ctools/includes/export.inc index a64ce672..d2fff2fd 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/export.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/export.inc @@ -4,7 +4,7 @@ * @file * Contains code to make it easier to have exportable objects. * - * Documentation for exportable objects is contained in help/export.html + * Documentation for exportable objects is contained in help/export.html. */ /** @@ -126,6 +126,7 @@ function ctools_export_crud_load_multiple($table, array $names) { * If TRUE, the static cache of all objects will be flushed prior to * loading all. This can be important on listing pages where items * might have changed on the page load. + * * @return * An array of all loaded objects, keyed by the unique IDs of the export key. */ @@ -328,7 +329,6 @@ function ctools_export_crud_set_status($table, $object, $status) { } - /** * Enable a certain object. * @@ -426,7 +426,7 @@ function ctools_export_load_object($table, $type = 'all', $args = array()) { } } - // Build the query + // Build the query. $query = db_select($table, 't__0')->fields('t__0'); $alias_count = 1; if (!empty($schema['join'])) { @@ -451,7 +451,7 @@ function ctools_export_load_object($table, $type = 'all', $args = array()) { if ($type == 'names') { $query->condition($export['key'], $args, 'IN'); } - else if ($type == 'conditions') { + elseif ($type == 'conditions') { foreach ($args as $key => $value) { if (isset($schema['fields'][$key])) { $query->condition($key, $value); @@ -499,7 +499,7 @@ function ctools_export_load_object($table, $type = 'all', $args = array()) { if ($defaults) { foreach ($defaults as $object) { if ($type == 'conditions') { - // if this does not match all of our conditions, skip it. + // If this does not match all of our conditions, skip it. foreach ($args as $key => $value) { if (!isset($object->$key)) { continue 2; @@ -509,12 +509,12 @@ function ctools_export_load_object($table, $type = 'all', $args = array()) { continue 2; } } - else if ($object->$key != $value) { + elseif ($object->$key != $value) { continue 2; } } } - else if ($type == 'names') { + elseif ($type == 'names') { if (!in_array($object->{$export['key']}, $args)) { continue; } @@ -561,7 +561,6 @@ function ctools_export_load_object($table, $type = 'all', $args = array()) { } } - // For conditions, return $return; } @@ -807,10 +806,10 @@ function _ctools_export_get_some_defaults($table, $export, $names) { function _ctools_export_unpack_object($schema, $data, $object = 'stdClass') { if (is_string($object)) { if (class_exists($object)) { - $object = new $object; + $object = new $object(); } else { - $object = new stdClass; + $object = new stdClass(); } } @@ -873,14 +872,14 @@ function ctools_var_export($var, $prefix = '') { $output .= $prefix . ')'; } } - else if (is_object($var) && get_class($var) === 'stdClass') { + 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); } - else if (is_bool($var)) { + elseif (is_bool($var)) { $output = $var ? 'TRUE' : 'FALSE'; } else { @@ -959,7 +958,7 @@ function ctools_export_object($table, $object, $indent = '', $identifier = NULL, } } - // And bottom additions here + // And bottom additions here. foreach ($additions2 as $field => $value) { $output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ";\n"; } @@ -987,7 +986,7 @@ function ctools_export_get_schema($table) { // simply hasn't been cached. If we've been asked, let's force the // issue. if (!$schema || empty($schema['export'])) { - // force a schema reset: + // Force a schema reset: $schema = drupal_get_schema($table, TRUE); } @@ -999,7 +998,7 @@ function ctools_export_get_schema($table) { return array(); } - // Add some defaults + // Add some defaults. $schema['export'] += array( 'key' => 'name', 'key name' => 'Name', @@ -1107,7 +1106,7 @@ function ctools_export_set_object_status($object, $new_status = TRUE) { $export = $schema['export']; $status = variable_get($export['status'], array()); - // Compare + // Compare. if (!$new_status && $object->export_type & EXPORT_IN_DATABASE) { unset($status[$object->{$export['key']}]); } @@ -1150,12 +1149,12 @@ function ctools_export_new_object($table, $set_defaults = TRUE) { $schema = ctools_export_get_schema($table); $export = $schema['export']; - $object = new $export['object']; + $object = new $export['object'](); foreach ($schema['fields'] as $field => $info) { if (isset($info['object default'])) { $object->$field = $info['object default']; } - else if (isset($info['default'])) { + elseif (isset($info['default'])) { $object->$field = $info['default']; } else { @@ -1180,11 +1179,11 @@ function ctools_export_new_object($table, $set_defaults = TRUE) { 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 + // 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 + // Otherwise, the following code generates basic hook code. else { $output = ctools_export_default_to_hook_code($schema, $table, $names, $name); } @@ -1236,6 +1235,7 @@ function ctools_export_default_to_hook_code($schema, $table, $names, $name) { return $output; } + /** * Default function for listing bulk exportable objects. */ diff --git a/sites/all/modules/contrib/dev/ctools/includes/fields.inc b/sites/all/modules/contrib/dev/ctools/includes/fields.inc index cbc2dac2..0d3256f2 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/fields.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/fields.inc @@ -5,7 +5,6 @@ * Extend core fields with some helper functions to reduce code complexity within views and ctools plugins. */ - /** * Fake an instance of a field. * @@ -75,27 +74,30 @@ function ctools_fields_get_field_formatter_settings_form($field, $formatter_type $conf['formatter_settings'] += $formatter['settings']; } $function = $formatter['module'] . '_field_formatter_settings_form'; - if (function_exists($function)) { - $instance = ctools_fields_fake_field_instance($field['field_name'], $view_mode, $formatter_type, $conf['formatter_settings']); - $settings_form = $function($field, $instance, $view_mode, $form, $form_state); - if ($settings_form) { - // 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; - } + $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)')); @@ -208,15 +210,15 @@ function ctools_field_label($field_name) { * - 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 + * - '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 + * - '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 + * - '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]) @@ -224,10 +226,10 @@ function ctools_field_label($field_name) { * 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 + * - '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 + * - '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. * @@ -340,7 +342,7 @@ function ctools_field_foreign_keys($field_name) { $foreign_keys[$field_name] = $field['foreign keys']; } else { - // try to fetch foreign keys from schema, as not everything + // Try to fetch foreign keys from schema, as not everything // stores foreign keys properly in the field info. $module = $field['module']; diff --git a/sites/all/modules/contrib/dev/ctools/includes/jump-menu.inc b/sites/all/modules/contrib/dev/ctools/includes/jump-menu.inc index 51f45982..e2ae1cfc 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/jump-menu.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/jump-menu.inc @@ -8,7 +8,6 @@ * if javascript is in use. Each item is keyed to the href that the button * should go to. With javascript, the page is immediately redirected. Without * javascript, the form is submitted and a drupal_goto() is given. - * */ /** @@ -127,7 +126,7 @@ function ctools_jump_menu_submit($form, &$form_state) { // 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])){ + if (isset($redirect_array[1]) && !empty($redirect_array[1])) { $redirect = $redirect_array[1]; } else { diff --git a/sites/all/modules/contrib/dev/ctools/includes/language.inc b/sites/all/modules/contrib/dev/ctools/includes/language.inc index 9a7850b7..a850670e 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/language.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/language.inc @@ -1,5 +1,9 @@ t("Current user's language"), @@ -41,4 +44,4 @@ function ctools_language_list_all() { ); $languages = array_merge($languages, ctools_language_list()); return $languages; -} \ No newline at end of file +} diff --git a/sites/all/modules/contrib/dev/ctools/includes/math-expr.inc b/sites/all/modules/contrib/dev/ctools/includes/math-expr.inc index 3105ec52..d82281e9 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/math-expr.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/math-expr.inc @@ -99,7 +99,10 @@ class ctools_math_expr { 'sqrt','abs','ln','log', 'time', 'ceil', 'floor', 'min', 'max', 'round'); - function __construct() { + /** + * ctools_math_expr constructor. + */ + function __construct() { // make the variables a little more accurate $this->v['pi'] = pi(); $this->v['e'] = exp(1); diff --git a/sites/all/modules/contrib/dev/ctools/includes/modal.inc b/sites/all/modules/contrib/dev/ctools/includes/modal.inc index fc990159..18b216fc 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/modal.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/modal.inc @@ -55,9 +55,9 @@ function ctools_modal_add_js() { 'alt' => t('Close window'), )), 'throbber' => theme('image', array( - 'path' => ctools_image_path('throbber.gif'), - 'title' => t('Loading...'), - 'alt' => t('Loading'), + 'path' => ctools_image_path('throbber.gif'), + 'title' => t('Loading...'), + 'alt' => t('Loading'), )), ), ); @@ -85,7 +85,7 @@ function ctools_modal_add_plugin_js($plugins) { if (file_exists($file)) { $js[$file] = TRUE; } - else if (file(exists($subtype['path'] . '/' . $file))) { + elseif (file(exists($subtype['path'] . '/' . $file))) { $js[$subtype['path'] . '/' . $file] = TRUE; } } @@ -95,7 +95,7 @@ function ctools_modal_add_plugin_js($plugins) { if (file_exists($file)) { $css[$file] = TRUE; } - else if (file(exists($subtype['path'] . '/' . $file))) { + elseif (file(exists($subtype['path'] . '/' . $file))) { $css[$subtype['path'] . '/' . $file] = TRUE; } } @@ -140,7 +140,7 @@ function ctools_modal_command_dismiss() { } /** - * Display loading screen in the modal + * Display loading screen in the modal. */ function ctools_modal_command_loading() { return array( @@ -189,7 +189,7 @@ function ctools_modal_text_button($text, $dest, $alt, $class = '') { * 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 @@ -222,7 +222,7 @@ function ctools_modal_form_wrapper($form_id, &$form_state) { $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 ctools_modal_form_render($form_state, $output); } return $output; diff --git a/sites/all/modules/contrib/dev/ctools/includes/object-cache.inc b/sites/all/modules/contrib/dev/ctools/includes/object-cache.inc index 29225b05..ef52f9ad 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/object-cache.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/object-cache.inc @@ -27,6 +27,7 @@ * defaults to session_id(). * * @deprecated $skip_cache is deprecated in favor of drupal_static* + * * @return * The data that was cached. */ @@ -42,8 +43,11 @@ function ctools_object_cache_get($obj, $name, $skip_cache = FALSE, $sid = NULL) } if (!array_key_exists($key, $cache)) { - $data = db_query('SELECT * FROM {ctools_object_cache} WHERE sid = :session_id AND obj = :object AND name = :name', array(':session_id' => $sid, ':object' => $obj, ':name' => $name)) - ->fetchObject(); + $data = db_query('SELECT * FROM {ctools_object_cache} WHERE sid = :session_id AND obj = :object AND name = :name', array( + ':session_id' => $sid, + ':object' => $obj, + ':name' => md5($name), + ))->fetchObject(); if ($data) { $cache[$key] = unserialize($data->data); } @@ -83,7 +87,7 @@ function ctools_object_cache_set($obj, $name, $cache, $sid = NULL) { ->fields(array( 'sid' => $sid, 'obj' => $obj, - 'name' => $name, + 'name' => md5($name), 'data' => serialize($cache), 'updated' => REQUEST_TIME, )) @@ -91,7 +95,7 @@ function ctools_object_cache_set($obj, $name, $cache, $sid = NULL) { } /** - * Remove an object from the non-volatile ctools 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 @@ -103,7 +107,6 @@ function ctools_object_cache_set($obj, $name, $cache, $sid = NULL) { * defaults to session_id(). */ function ctools_object_cache_clear($obj, $name, $sid = NULL) { - if (!$sid) { $sid = session_id(); } @@ -111,13 +114,12 @@ function ctools_object_cache_clear($obj, $name, $sid = NULL) { db_delete('ctools_object_cache') ->condition('sid', $sid) ->condition('obj', $obj) - ->condition('name', $name) + ->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. * @@ -142,8 +144,11 @@ function ctools_object_cache_test($obj, $name, $sid = NULL) { $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' => $name)) - ->fetchObject(); + 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(); } /** @@ -162,6 +167,7 @@ function ctools_object_cache_test($obj, $name, $sid = NULL) { * 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'); } @@ -180,7 +186,7 @@ function ctools_object_cache_test_objects($obj, $names) { function ctools_object_cache_clear_all($obj, $name) { db_delete('ctools_object_cache') ->condition('obj', $obj) - ->condition('name', $name) + ->condition('name', md5($name)) ->execute(); // Ensure the static cache is emptied of this obj:name set. $cache = &drupal_static('ctools_object_cache_get', array()); @@ -197,7 +203,8 @@ function ctools_object_cache_clear_all($obj, $name) { */ function ctools_object_cache_clean($age = NULL) { if (empty($age)) { - $age = 86400 * 7; // 7 days + // 7 days. + $age = 86400 * 7; } db_delete('ctools_object_cache') ->condition('updated', REQUEST_TIME - $age, '<') diff --git a/sites/all/modules/contrib/dev/ctools/includes/page-wizard.inc b/sites/all/modules/contrib/dev/ctools/includes/page-wizard.inc index a211361b..9690aae0 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/page-wizard.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/page-wizard.inc @@ -1,5 +1,9 @@ plugin = $plugin; if ($function = ctools_plugin_get_function($plugin, 'default cache')) { $function($cache); diff --git a/sites/all/modules/contrib/dev/ctools/includes/plugins-admin.inc b/sites/all/modules/contrib/dev/ctools/includes/plugins-admin.inc index d4ead0a4..c11fcfd6 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/plugins-admin.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/plugins-admin.inc @@ -10,6 +10,7 @@ * * Implementing this */ + /** * Get a plugin configuration form. * @@ -100,7 +101,7 @@ function _ctools_plugin_configure_create_form_info(&$form_info, $plugin_definiti if (empty($plugin_definition['title'])) { $title = t('Configure'); } - else if ($op == 'add') { + elseif ($op == 'add') { $title = t('Configure new !plugin_title', array('!plugin_title' => $plugin_definition['title'])); } else { @@ -134,10 +135,10 @@ function _ctools_plugin_configure_create_form_info(&$form_info, $plugin_definiti $form_info['forms']['form']['wrapper'] = 'ctools_plugins_default_form_wrapper'; } } - else if (is_array($info)) { - if (empty($form_info['order'])) { - $form_info['order'] = array(); - } + elseif (is_array($info)) { + if (empty($form_info['order'])) { + $form_info['order'] = array(); + } if (empty($form_info['forms'])) { $form_info['forms'] = array(); } diff --git a/sites/all/modules/contrib/dev/ctools/includes/plugins.inc b/sites/all/modules/contrib/dev/ctools/includes/plugins.inc index d524f746..7b53ae19 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/plugins.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/plugins.inc @@ -2,7 +2,6 @@ /** * @file - * * Contains routines to organize and load plugins. It allows a special * variation of the hook system so that plugins can be kept in separate * .inc files, and can be either loaded all at once or loaded only when @@ -70,7 +69,7 @@ function ctools_plugin_api_info($owner, $api, $minimum_version, $current_version if (isset($info['version'])) { $version = $info['version']; } - else if (isset($info['api'])) { + elseif (isset($info['api'])) { $version = $info['api']; } @@ -99,7 +98,7 @@ function ctools_plugin_api_info($owner, $api, $minimum_version, $current_version } // Only process if version is between minimum and current, inclusive. - if (version_compare($info['version'], $minimum_version, '>=') && version_compare($info['version'], $current_version, '<=')) { + if (version_compare($info['version'], $minimum_version, '>=') && version_compare($info['version'], $current_version, '<=')) { if (!isset($info['path'])) { $info['path'] = ''; } @@ -151,7 +150,7 @@ function ctools_plugin_api_include($owner, $api, $minimum_version, $current_vers if (isset($plugin_info["$api file"])) { $file = $plugin_info["$api file"]; } - else if (isset($plugin_info['file'])) { + elseif (isset($plugin_info['file'])) { $file = $plugin_info['file']; } else { @@ -161,7 +160,7 @@ function ctools_plugin_api_include($owner, $api, $minimum_version, $current_vers if (file_exists(DRUPAL_ROOT . "/$plugin_info[path]/$file")) { require_once DRUPAL_ROOT . "/$plugin_info[path]/$file"; } - else if (file_exists(DRUPAL_ROOT . "/$file")) { + elseif (file_exists(DRUPAL_ROOT . "/$file")) { require_once DRUPAL_ROOT . "/$file"; } $already_done[$owner][$api][$module] = TRUE; @@ -184,7 +183,7 @@ function ctools_plugin_api_get_hook($owner, $api) { if (function_exists($function = $owner . '_' . $api . '_hook_name')) { $hook = $function(); } - else if (function_exists($function = $owner . '_ctools_plugin_api_hook_name')) { + elseif (function_exists($function = $owner . '_ctools_plugin_api_hook_name')) { $hook = $function(); } @@ -225,7 +224,7 @@ function ctools_get_plugins($module, $type, $id = NULL) { $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 + // 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])) { @@ -258,9 +257,9 @@ function ctools_get_plugins($module, $type, $id = NULL) { if (!empty($cache->data)) { // Cache load succeeded so use the cached plugin list. - $plugins[$module][$type] = $cache->data; + $plugins[$module][$type] = $cache->data; // Set $setup to true so we know things where loaded. - $setup[$module][$type] = TRUE; + $setup[$module][$type] = TRUE; } else { // Cache load failed so store that we need to build and write the cache. @@ -299,7 +298,6 @@ function ctools_get_plugins($module, $type, $id = NULL) { } } - // If we were told earlier that this is cacheable and the cache was empty, // give something back. if ($build_cache) { @@ -313,7 +311,7 @@ function ctools_get_plugins($module, $type, $id = NULL) { return array_filter($plugins[$module][$type]); } - // Check to see if we need to look for the file + // 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. @@ -419,19 +417,20 @@ function ctools_get_plugins_reset() { /** * Load plugins from a directory. * - * @param $info + * @param array $info * The plugin info as returned by ctools_plugin_get_info() - * @param $file + * @param string $filename * The file to load if we're looking for just one particular plugin. * - * @return - * An array of information created for this 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. + // 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']])) { @@ -466,24 +465,23 @@ function ctools_plugin_load_includes($info, $filename = NULL) { } foreach ($files as $file) { if (!empty($info['info file'])) { - // Parse a .info file + // Parse a .info file. $result = ctools_plugin_process_info($info, $module, $file); } else { // Parse a hook. - $plugin = NULL; // ensure that we don't have something leftover from earlier. + // 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() - + // 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. @@ -496,7 +494,8 @@ function ctools_plugin_load_includes($info, $filename = NULL) { } } - $result = ctools_plugin_process($info, $module, $identifier, dirname($file->uri), basename($file->uri), $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); @@ -516,7 +515,7 @@ function ctools_plugin_load_includes($info, $filename = NULL) { * @param $info * The $info array for the plugin as returned by ctools_plugin_get_info(). * - * @return array $directories + * @return array * An array of directories to search. */ function ctools_plugin_get_directories($info) { @@ -542,10 +541,9 @@ function ctools_plugin_get_directories($info) { } /** - * Helper function to build a ctools-friendly list of themes capable of - * providing plugins. + * Helper to build a ctools-friendly list of themes capable of providing plugins. * - * @return array $themes + * @return array * A list of themes that can act as plugin providers, sorted parent-first with * the active theme placed last. */ @@ -556,7 +554,7 @@ function _ctools_list_themes() { $themes = $active = array(); $all_themes = list_themes(); foreach ($all_themes as $name => $theme) { - // Only search from active themes + // Only search from active themes. if (empty($theme->status) && $theme->name != $current) { continue; } @@ -567,19 +565,19 @@ function _ctools_list_themes() { } } - // Construct a parent-first list of all themes + // 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 + // 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 + // 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); } @@ -587,7 +585,6 @@ function _ctools_list_themes() { return $themes; } - /** * Find all the base themes for the specified theme. * @@ -603,9 +600,10 @@ function _ctools_list_themes() { * The name of the theme whose base we are looking for. * @param $used_keys * A recursion parameter preventing endless loops. - * @return + * + * @return array * Returns an array of all of the theme's ancestors; the first element's value - * will be NULL if an error occurred. + * 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']; @@ -633,7 +631,6 @@ function ctools_find_base_themes($themes, $key, $used_keys = array()) { return $current_base_theme; } - /** * Load plugin info for the provided hook; this is handled separately from * plugins from files. @@ -658,22 +655,28 @@ function ctools_plugin_load_hooks($info) { /** * Process a single hook implementation of a ctools plugin. * - * @param $info + * @param array $info * The $info array about the plugin as returned by ctools_plugin_get_info() - * @param $module + * @param string $module * The module that implements the plugin being processed. - * @param $identifier - * The plugin identifier, which is used to create the name of the hook - * function being called. - * @param $path + * @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 $file + * @param string $file * The file that was loaded for this plugin, if it exists. - * @param $base + * @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)) { @@ -741,9 +744,19 @@ function _ctools_process_data($result, $plugin_type_info, $module, $path, $file) 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); @@ -770,7 +783,7 @@ function ctools_plugin_get_info($module, $type) { * @param $function_name * The identifier of the function. For example, 'settings form'. * - * @return + * @return string * The actual name of the function to call, or NULL if the function * does not exist. */ @@ -787,7 +800,7 @@ function ctools_plugin_get_function($plugin_definition, $function_name) { } if (!isset($plugin_definition[$function_name])) { - return; + return NULL; } if (is_array($plugin_definition[$function_name]) && isset($plugin_definition[$function_name]['function'])) { @@ -822,7 +835,7 @@ function ctools_plugin_get_function($plugin_definition, $function_name) { * @param $function_name * The identifier of the function. For example, 'settings form'. * - * @return + * @return string * The actual name of the function to call, or NULL if the function * does not exist. */ @@ -840,7 +853,7 @@ function ctools_plugin_load_function($module, $type, $id, $function_name) { * @param $class_name * The identifier of the class. For example, 'handler'. * - * @return + * @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) { @@ -859,11 +872,11 @@ function ctools_plugin_get_class($plugin_definition, $class_name) { if (!isset($plugin_definition[$class_name])) { return; } - else if (is_string($plugin_definition[$class_name])) { + elseif (is_string($plugin_definition[$class_name])) { // Plugin uses the string form shorthand. $return = $plugin_definition[$class_name]; } - else if (isset($plugin_definition[$class_name]['class'])) { + elseif (isset($plugin_definition[$class_name]['class'])) { // Plugin uses the verbose array form. $return = $plugin_definition[$class_name]['class']; } @@ -885,7 +898,7 @@ function ctools_plugin_get_class($plugin_definition, $class_name) { * @param $class_name * The identifier of the class. For example, 'handler'. * - * @return + * @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) { diff --git a/sites/all/modules/contrib/dev/ctools/includes/registry.inc b/sites/all/modules/contrib/dev/ctools/includes/registry.inc index 9d4328e6..7e517bb9 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/registry.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/registry.inc @@ -2,7 +2,6 @@ /** * @file - * * Registry magic. In a separate file to minimize unnecessary code loading. */ diff --git a/sites/all/modules/contrib/dev/ctools/includes/stylizer.inc b/sites/all/modules/contrib/dev/ctools/includes/stylizer.inc index 5bc8450c..488a7f3e 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/stylizer.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/stylizer.inc @@ -202,7 +202,7 @@ function ctools_stylizer_get_settings_name($settings) { } /** - * Get the path where images will be stored for a given style plugin and settings. + * Get the path where images will be stored for a style plugin and settings. * * This function will make sure the path exists. */ @@ -249,7 +249,7 @@ class ctools_stylizer_image_processor { if (is_string($plugin['actions']) && function_exists($plugin['actions'])) { $actions = $plugin['actions']($plugin, $settings); } - else if (is_array($plugin['actions'])) { + elseif (is_array($plugin['actions'])) { $actions = $plugin['actions']; } @@ -318,7 +318,7 @@ class ctools_stylizer_image_processor { function command_load($name, $file) { $this->log("New workspace: $name (from $file)"); if (!file_exists($file)) { - // Try it relative to the plugin + // Try it relative to the plugin. $file = $this->plugin['path'] . '/' . $file; if (!file_exists($file)) { $this->log("Unable to open $file"); @@ -336,7 +336,7 @@ class ctools_stylizer_image_processor { } /** - * Create a new workspace using the properties of an existing workspace + * 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"); @@ -372,7 +372,7 @@ class ctools_stylizer_image_processor { function command_merge_from($workspace, $x = 0, $y = 0) { $this->log("Merge from: $workspace ($x, $y)"); if (empty($this->workspaces[$workspace])) { - $this->log("Workspace $name does not exist.", 'error'); + $this->log("Workspace $workspace does not exist.", 'error'); return; } @@ -382,7 +382,7 @@ class ctools_stylizer_image_processor { function command_merge_to($workspace, $x = 0, $y = 0) { $this->log("Merge to: $workspace ($x, $y)"); if (empty($this->workspaces[$workspace])) { - $this->log("Workspace $name does not exist.", 'error'); + $this->log("Workspace $workspace does not exist.", 'error'); return; } @@ -822,7 +822,7 @@ function ctools_stylizer_add_plugin_forms(&$form_info, $plugin, $op) { if ($op == 'add' && isset($plugin['add form'])) { $id = $plugin['add form']; } - else if (isset($plugin['edit form'])) { + elseif (isset($plugin['edit form'])) { $id = $plugin['edit form']; } else { diff --git a/sites/all/modules/contrib/dev/ctools/includes/stylizer.theme.inc b/sites/all/modules/contrib/dev/ctools/includes/stylizer.theme.inc index 85346c15..0ceedffc 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/stylizer.theme.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/stylizer.theme.inc @@ -25,4 +25,3 @@ function ctools_stylizer_theme(&$theme) { 'file' => 'includes/stylizer.inc', ); } - diff --git a/sites/all/modules/contrib/dev/ctools/includes/utility.inc b/sites/all/modules/contrib/dev/ctools/includes/utility.inc index 82fc1471..3c939a44 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/utility.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/utility.inc @@ -23,7 +23,7 @@ function ctools_passthrough($module, $type, &$items) { require_once DRUPAL_ROOT . '/' . $file->uri; list($tool) = explode('.', $file->name, 2); - $function = $module . '_' . str_replace ('-', '_', $tool) . '_' . str_replace('-', '_', $type); + $function = $module . '_' . str_replace('-', '_', $tool) . '_' . str_replace('-', '_', $type); if (function_exists($function)) { $function($items); } diff --git a/sites/all/modules/contrib/dev/ctools/includes/uuid.inc b/sites/all/modules/contrib/dev/ctools/includes/uuid.inc index 13897f1f..f51838be 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/uuid.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/uuid.inc @@ -67,4 +67,5 @@ if (!function_exists('uuid_is_valid')) { function uuid_is_valid($uuid) { return preg_match('/^' . UUID_PATTERN . '$/', $uuid); } + } diff --git a/sites/all/modules/contrib/dev/ctools/includes/views.inc b/sites/all/modules/contrib/dev/ctools/includes/views.inc index 4ef6439e..9c1ee6c3 100644 --- a/sites/all/modules/contrib/dev/ctools/includes/views.inc +++ b/sites/all/modules/contrib/dev/ctools/includes/views.inc @@ -1,5 +1,9 @@ $params) { $form_info['order'][$step_id] = $params['title']; @@ -83,7 +83,7 @@ function ctools_wizard_multistep_form($form_info, $step, &$form_state) { $form_info['cache location'] = 'storage'; } - // If absolutely nothing was set for the cache area to work on + // 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']); @@ -199,7 +199,7 @@ function ctools_wizard_multistep_form($form_info, $step, &$form_state) { } } } - else if (isset($form_state['ajax next'])) { + 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']); @@ -299,7 +299,7 @@ function ctools_wizard_wrapper($form, &$form_state) { '#wizard type' => 'next', '#weight' => -2000, '#limit_validation_errors' => array(), - // hardcode the submit so that it doesn't try to save data. + // Hardcode the submit so that it doesn't try to save data. '#submit' => array('ctools_wizard_submit'), '#attributes' => $button_attributes, ); @@ -325,19 +325,18 @@ function ctools_wizard_wrapper($form, &$form_state) { // 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'], + '#value' => $form_info['return text'], '#wizard type' => 'return', '#attributes' => $button_attributes, ); } - else if (empty($form_state['next']) || !empty($form_info['free trail'])) { + elseif (empty($form_state['next']) || !empty($form_info['free trail'])) { $form['buttons']['return'] = array( '#type' => 'submit', '#value' => $form_info['finish text'], @@ -352,7 +351,7 @@ function ctools_wizard_wrapper($form, &$form_state) { '#type' => 'submit', '#value' => $form_info['cancel text'], '#wizard type' => 'cancel', - // hardcode the submit so that it doesn't try to save data. + // Hardcode the submit so that it doesn't try to save data. '#limit_validation_errors' => array(), '#submit' => array('ctools_wizard_submit'), '#attributes' => $button_attributes, @@ -370,7 +369,6 @@ function ctools_wizard_wrapper($form, &$form_state) { // 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(); @@ -398,7 +396,7 @@ function ctools_wizard_wrapper($form, &$form_state) { $params = array($url, $options); } - $form['#action'] = call_user_func_array('url', $params); + $form['#action'] = call_user_func_array('url', $params); } if (isset($info['wrapper']) && function_exists($info['wrapper'])) { @@ -418,7 +416,7 @@ 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 AJAX enabled, we proceed slightly differently here. if (!empty($form_state['ajax'])) { if ($type == 'next') { $form_state['ajax next'] = $form_state['clicked_button']['#next']; @@ -428,7 +426,7 @@ function ctools_wizard_submit(&$form, &$form_state) { if ($type == 'cancel' && isset($form_state['form_info']['cancel path'])) { $form_state['redirect'] = $form_state['form_info']['cancel path']; } - else if ($type == 'next') { + 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 @@ -437,10 +435,10 @@ function ctools_wizard_submit(&$form, &$form_state) { unset($_GET['destination']); } } - else if (isset($form_state['form_info']['return path'])) { + elseif (isset($form_state['form_info']['return path'])) { $form_state['redirect'] = $form_state['form_info']['return path']; } - else if ($type == 'finish' && isset($form_state['form_info']['cancel path'])) { + elseif ($type == 'finish' && isset($form_state['form_info']['cancel path'])) { $form_state['redirect'] = $form_state['form_info']['cancel path']; } } @@ -469,10 +467,8 @@ function ctools_wizard_get_path($form_info, $step) { if (!isset($path[1]) || !is_array($path[1])) { $path[1] = array(); } - // Ensure that the query part of options is an array. - $path[1] += array('query' => array()); // Add the destination parameter, if not set already. - $path[1]['query'] += drupal_get_destination(); + $path[1] += drupal_get_destination(); } return $path; @@ -505,15 +501,15 @@ function ctools_wizard_defaults(&$form_info) { } $form_info = $form_info + $defaults; - // set form callbacks if they aren't defined + // Set form callbacks if they aren't defined. foreach ($form_info['forms'] as $step => $params) { - if (!$params['form id']) { - $form_callback = $hook . '_' . $step . '_form'; - $form_info['forms'][$step]['form id'] = $form_callback; + if (empty($params['form id'])) { + $form_callback = $hook . '_' . $step . '_form'; + $form_info['forms'][$step]['form id'] = $form_callback; } } - // set button callbacks + // Set button callbacks. $callbacks = array( 'back callback' => '_back', 'next callback' => '_next', @@ -523,10 +519,10 @@ function ctools_wizard_defaults(&$form_info) { ); foreach ($callbacks as $key => $callback) { - // never overwrite if explicity defined + // Never overwrite if explicity defined. if (empty($form_info[$key])) { $wizard_callback = $hook . $callback; - if (function_exists($wizard_callback)) { + if (function_exists($wizard_callback)) { $form_info[$key] = $wizard_callback; } } diff --git a/sites/all/modules/contrib/dev/ctools/js/modal.js b/sites/all/modules/contrib/dev/ctools/js/modal.js index 634595f8..ec7b02ae 100644 --- a/sites/all/modules/contrib/dev/ctools/js/modal.js +++ b/sites/all/modules/contrib/dev/ctools/js/modal.js @@ -268,7 +268,7 @@ // 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 === '1.4' && typeof event.bubbles === "undefined") { + if (jQuery.fn.jquery.substr(0, 3) === '1.4' && typeof event.bubbles === "undefined") { $(this.form).trigger('submit'); return false; } @@ -302,7 +302,7 @@ // Attach behaviors within a modal dialog. var settings = response.settings || ajax.settings || Drupal.settings; - Drupal.attachBehaviors('#modalContent', settings); + Drupal.attachBehaviors($('#modalContent'), settings); if ($('#modal-content').hasClass('ctools-modal-loading')) { $('#modal-content').removeClass('ctools-modal-loading'); @@ -378,7 +378,7 @@ } } - if (!speed) { + if (!speed && 0 !== speed) { speed = 'fast'; } @@ -554,14 +554,15 @@ // Create our content div, get the dimensions, and hide it var modalContent = $('#modalContent').css('top','-1000px'); - var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2); + 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').bind('click', modalContentClose); + $('.close', $modalHeader).bind('click', modalContentClose); // Bind a keypress on escape for closing the modalContent modalEventEscapeCloseHandler = function(event) { @@ -577,7 +578,7 @@ // close button, but we should save the original focus to restore it after // the dialog is closed. var oldFocus = document.activeElement; - $('.close').focus(); + $('.close', $modalHeader).focus(); // Close the open modal content and backdrop function close() { @@ -586,36 +587,44 @@ $('body').unbind( 'focus', modalEventHandler); $('body').unbind( 'keypress', modalEventHandler ); $('body').unbind( 'keydown', modalTabTrapHandler ); - $('.close').unbind('click', modalContentClose); - $('body').unbind('keypress', modalEventEscapeCloseHandler); + $('.close', $modalHeader).unbind('click', modalContentClose); + $(document).unbind('keydown', modalEventEscapeCloseHandler); $(document).trigger('CToolsDetachBehaviors', $('#modalContent')); - // Set our animation parameters and use them - if ( animation == 'fadeIn' ) animation = 'fadeOut'; - if ( animation == 'slideDown' ) animation = 'slideUp'; - if ( animation == 'show' ) animation = 'hide'; + // Closing animation. + switch (animation) { + case 'fadeIn': + modalContent.fadeOut(speed, modalContentRemove); + break; - // Close the content - modalContent.hide()[animation](speed); + case 'slideDown': + modalContent.slideUp(speed, modalContentRemove); + break; - // Remove the content + 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 + // Restore focus to where it was before opening the dialog. $(oldFocus).focus(); }; // Move and resize the modalBackdrop and modalContent on window resize. - modalContentResize = function(){ - + 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; + 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 @@ -631,7 +640,7 @@ // Get where we should move content to var modalContent = $('#modalContent'); - var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2); + var mdcTop = wt + Math.max((winHeight / 2) - (modalContent.outerHeight() / 2), 0); var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); // Apply the changes @@ -662,9 +671,11 @@ $('body').unbind('focus', modalEventHandler); $('body').unbind('keypress', modalEventHandler); $('body').unbind( 'keydown', modalTabTrapHandler ); - $('.close').unbind('click', modalContentClose); + var $modalContent = $('#modalContent'); + var $modalHeader = $modalContent.find('.modal-header'); + $('.close', $modalHeader).unbind('click', modalContentClose); $('body').unbind('keypress', modalEventEscapeCloseHandler); - $(document).trigger('CToolsDetachBehaviors', $('#modalContent')); + $(document).trigger('CToolsDetachBehaviors', $modalContent); // jQuery magic loop through the instances and run the animations or removal. content.each(function(){ diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/css/page-manager.css b/sites/all/modules/contrib/dev/ctools/page_manager/css/page-manager.css index 1a7dd5e4..5abe39e2 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/css/page-manager.css +++ b/sites/all/modules/contrib/dev/ctools/page_manager/css/page-manager.css @@ -100,7 +100,7 @@ body form#page-manager-list-pages-form { #page-manager-edit .page-manager-edit-operations li { list-style: none; - background: #F6F6F6; + background: #f6f6f6; border-top: 1px solid #aaa; border-left: 1px solid #aaa; border-right: 1px solid #aaa; @@ -111,7 +111,7 @@ body form#page-manager-list-pages-form { #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; + background: #ffffff url(../images/arrow-active.png) no-repeat scroll right center; } #page-manager-edit .page-manager-edit-operations li.changed, @@ -123,7 +123,7 @@ body form#page-manager-list-pages-form { /** 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; + background: #f6f6f6; } #page-manager-edit .page-manager-edit-operations li.active { @@ -132,7 +132,7 @@ body form#page-manager-list-pages-form { #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; + background: #ffffff url(../images/arrow-active.png) no-repeat scroll right center; color: #000000; font-weight: bold; } @@ -271,8 +271,8 @@ body form#page-manager-list-pages-form { #page-manager-edit .actions li a { display: block; padding: 0.2em 0.5em; - color:#0062A0; - background-color: #F6F6F6; + color: #0062a0; + background-color: #f6f6f6; } #page-manager-edit .page-manager-changed { diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/page_manager.admin.inc b/sites/all/modules/contrib/dev/ctools/page_manager/page_manager.admin.inc index 95d12255..f4acb78a 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/page_manager.admin.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/page_manager.admin.inc @@ -631,7 +631,7 @@ function page_manager_get_operations($page, $operations = NULL) { if (isset($plugin['add features'][$id])) { $result['actions']['children']['configure']['form']['order'][$id] = $plugin['add features'][$id]; } - else if (isset($plugin['required forms'][$id])) { + elseif (isset($plugin['required forms'][$id])) { $result['actions']['children']['configure']['form']['order'][$id] = $plugin['required forms'][$id]; } } @@ -732,7 +732,7 @@ function page_manager_get_handler_operations(&$page) { ), ); } - else if ($handler->export_type != EXPORT_IN_CODE) { + elseif ($handler->export_type != EXPORT_IN_CODE) { $actions['delete'] = array( 'title' => t('Delete'), 'description' => t('Remove this variant from the page completely.'), @@ -1144,7 +1144,7 @@ function page_manager_render_operations(&$page, $operations, $active_trail, $att if ($id == $first) { $class[] = 'operation-first'; } - else if ($id == $last) { + elseif ($id == $last) { $class[] = 'operation-last'; } diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/page_manager.info b/sites/all/modules/contrib/dev/ctools/page_manager/page_manager.info index 9fe2b2f4..a56663b8 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/page_manager.info +++ b/sites/all/modules/contrib/dev/ctools/page_manager/page_manager.info @@ -3,11 +3,11 @@ description = Provides a UI and API to manage pages within the site. core = 7.x dependencies[] = ctools package = Chaos tool suite -version = CTOOLS_MODULE_VERSION -; Information added by Drupal.org packaging script on 2016-11-22 -version = "7.x-1.12" +files[] = tests/head_links.test + +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/page_manager.module b/sites/all/modules/contrib/dev/ctools/page_manager/page_manager.module index a498f7fb..c614eff7 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/page_manager.module +++ b/sites/all/modules/contrib/dev/ctools/page_manager/page_manager.module @@ -205,7 +205,7 @@ function page_manager_menu_alter(&$items) { if ($function = ctools_plugin_get_function($task, 'hook menu alter')) { $function($items, $task); } - // let the subtasks alter the menu items too. + // 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); @@ -240,7 +240,7 @@ function page_manager_menu_alter(&$items) { return $items; } -/* +/** * Implements hook_theme() */ function page_manager_theme() { @@ -333,7 +333,7 @@ function page_manager_get_page_cache($task_name) { } } else { - // ensure the task is loaded. + // Ensure the task is loaded. page_manager_get_task($cache->task_id); } @@ -390,11 +390,10 @@ function page_manager_save_page_cache($cache) { 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 + // 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']; @@ -427,7 +426,7 @@ function page_manager_save_page_cache($cache) { * 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. + // Load context plugin as there may be contexts cached here. ctools_include('context'); return page_manager_get_page_cache($task_name); } @@ -500,7 +499,6 @@ function page_manager_handler_add_to_page(&$page, &$handler, $title = NULL) { // // 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. * @@ -582,7 +580,7 @@ function page_manager_get_default_task_handlers($task, $subtask_id) { $handlers = $subtask['default handlers']; } } - else if (isset($task['default handlers'])) { + elseif (isset($task['default handlers'])) { $handlers = $task['default handlers']; } @@ -604,6 +602,7 @@ function page_manager_get_default_task_handlers($task, $subtask_id) { * 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. */ @@ -615,10 +614,10 @@ function page_manager_compare_task_handlers($result, $handlers, $name) { $handlers[$name]->export_type = EXPORT_IN_CODE; return $handlers[$name]; } - else if (isset($result[$name]) && !isset($handlers[$name])) { + elseif (isset($result[$name]) && !isset($handlers[$name])) { return $result[$name]; } - else if (isset($result[$name]) && isset($handlers[$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; @@ -776,9 +775,8 @@ function page_manager_export_task_handler_load($name) { 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 = new stdClass(); $handler->title = $plugin['title']; $handler->task = NULL; $handler->subtask = NULL; @@ -797,7 +795,7 @@ function page_manager_new_task_handler($plugin) { if (is_array($plugin['default conf'])) { $handler->conf = $plugin['default conf']; } - else if (function_exists($plugin['default conf'])) { + elseif (function_exists($plugin['default conf'])) { $handler->conf = $plugin['default conf']($handler); } } @@ -823,7 +821,6 @@ function page_manager_update_task_handler_weight($handler, $weight) { ->execute(); } - /** * Shortcut function to get task plugins. */ @@ -1200,7 +1197,7 @@ function page_manager_page_manager_pages_to_hook_code($names = array(), $name = $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 + // 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"; } @@ -1310,7 +1307,7 @@ function page_manager_addressable_content($address, $type) { $arguments = explode('..', $arguments); } else { - // implode does not return an empty array on an empty + // Implode does not return an empty array on an empty // string so do it specifically. $arguments = array(); } diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/cache/page_manager_context.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/cache/page_manager_context.inc index 2f01b560..a60b9e6b 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/cache/page_manager_context.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/cache/page_manager_context.inc @@ -7,7 +7,7 @@ */ $plugin = array( - // cache plugins are the rare plugin types that have no real UI but + // Cache plugins are the rare plugin types that have no real UI but // we're providing a title just in case. 'title' => t('Page manager context'), 'cache get' => 'page_manager_cache_page_manager_context_cache_get', @@ -46,7 +46,7 @@ function page_manager_cache_page_manager_context_cache_set($data, $key, $object) } /** - * Copy temporary data from the page manager cache + * 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 diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/task_handlers/http_response.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/task_handlers/http_response.inc index 8fc0f256..9c53f346 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/task_handlers/http_response.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/task_handlers/http_response.inc @@ -2,14 +2,13 @@ /** * @file - * * This is the task handler plugin to handle generating 403, 404, 301 and 302 * response codes. */ -// Plugin definition +// Plugin definition. $plugin = array( - // is a 'context' handler type, meaning it supports the API of the + // Is a 'context' handler type, meaning it supports the API of the // context handlers provided by ctools context plugins. 'handler type' => 'context', 'visible' => TRUE, // may be added up front. @@ -121,7 +120,7 @@ function page_manager_http_response_admin_summary($handler, $task, $subtask, $pa ctools_include('context'); ctools_include('context-task-handler'); - // Get the operations + // Get the operations. $operations = page_manager_get_operations($page); // Get operations for just this handler. @@ -190,7 +189,7 @@ function page_manager_http_response_admin_summary($handler, $task, $subtask, $pa $output .= '
    '; if ($show_title) { - $output .= '
    '; + $output .= '
    '; $output .= '
    ' . $rendered_operations['actions'] . '
    '; $output .= '' . $title . ''; } @@ -215,7 +214,7 @@ function page_manager_http_response_title($handler, $task, $subtask) { } /** - * General settings for the panel + * General settings for the panel. */ function page_manager_http_response_edit_settings($form, &$form_state) { ctools_include('page_manager.admin', 'page_manager', ''); @@ -302,7 +301,7 @@ function page_manager_http_response_render($handler, $base_contexts, $args, $tes ctools_include('context'); ctools_include('context-task-handler'); - // Add my contexts + // Add my contexts. $contexts = ctools_context_handler_get_handler_contexts($base_contexts, $handler); // Test. diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/blog.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/blog.inc index bab2dd28..f20da0be 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/blog.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/blog.inc @@ -1,5 +1,9 @@ 'page', 'title' => t('All blogs'), @@ -68,7 +72,7 @@ function page_manager_blog_menu_alter(&$items, $task) { * node edit, which is node_page_edit(). */ function page_manager_blog() { - // Load my task plugin + // Load my task plugin. $task = page_manager_get_task('blog'); ctools_include('context'); @@ -113,6 +117,7 @@ function page_manager_blog_enable($cache, $status) { * The subtask id * @param $contexts * The contexts loaded for the task. + * * @return * TRUE if the current user can access the page. */ diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/blog_user.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/blog_user.inc index 351e4de0..e7562982 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/blog_user.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/blog_user.inc @@ -1,5 +1,9 @@ 'page', 'title' => t('User blog'), 'admin title' => t('User blog'), @@ -53,7 +57,7 @@ function page_manager_blog_user_menu_alter(&$items, $task) { $items['blog/%user_uid_optional']['file'] = $task['file']; } else { - // automatically disable this task if it cannot be enabled. + // 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'); @@ -143,6 +147,7 @@ function page_manager_blog_user_enable($cache, $status) { * The subtask id * @param $contexts * The contexts loaded for the task. + * * @return * TRUE if the current user can access the page. */ diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/comment_reply.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/comment_reply.inc index ffbafe46..c2504235 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/comment_reply.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/comment_reply.inc @@ -1,4 +1,9 @@ 'page', 'title' => t('Comment Reply page'), @@ -45,13 +50,11 @@ function page_manager_comment_reply_enable($cache, $status) { } } - /** * Entry point for our overridden comment. - * */ -function page_manager_comment_reply_page($node, $pid = NULL){ - // Load my task plugin +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. @@ -134,7 +137,7 @@ function page_manager_comment_reply_menu_alter(&$items, $task) { $items['comment/reply/%node']['file'] = $task['file']; } else { - // automatically disable this task if it cannot be enabled. + // 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'); @@ -153,6 +156,7 @@ function page_manager_comment_reply_menu_alter(&$items, $task) { * The subtask id * @param $contexts * The contexts loaded for the task. + * * @return * TRUE if the current user can access the page. */ diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/contact_site.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/contact_site.inc index f8718697..e9716c49 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/contact_site.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/contact_site.inc @@ -1,5 +1,9 @@ 'page', 'title' => t('Site contact page'), @@ -72,7 +76,7 @@ function page_manager_contact_site_menu_alter(&$items, $task) { * node edit, which is node_page_edit(). */ function page_manager_contact_site() { - // Load my task plugin + // Load my task plugin. $task = page_manager_get_task('contact_site'); ctools_include('context'); @@ -121,6 +125,7 @@ function page_manager_contact_site_enable($cache, $status) { * The subtask id * @param $contexts * The contexts loaded for the task. + * * @return * TRUE if the current user can access the page. */ diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/contact_user.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/contact_user.inc index 5c868161..96daec8b 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/contact_user.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/contact_user.inc @@ -1,5 +1,9 @@ 'page', 'title' => t('User contact'), 'admin title' => t('User contact'), @@ -56,7 +60,7 @@ function page_manager_contact_user_menu_alter(&$items, $task) { $items['user/%user/contact']['file'] = $task['file']; } else { - // automatically disable this task if it cannot be enabled. + // 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'); @@ -146,6 +150,7 @@ function page_manager_contact_user_enable($cache, $status) { * The subtask id * @param $contexts * The contexts loaded for the task. + * * @return * TRUE if the current user can access the page. */ diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/node_edit.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/node_edit.inc index 61ef13ac..66bf00da 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/node_edit.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/node_edit.inc @@ -1,12 +1,16 @@ 'page', 'title' => t('Node add/edit form'), @@ -83,7 +87,7 @@ function page_manager_node_edit_menu_alter(&$items, $task) { * node edit, which is node_page_edit(). */ function page_manager_node_edit($node) { - // Load my task plugin + // Load my task plugin. $task = page_manager_get_task('node_edit'); // Load the node into a context. @@ -176,6 +180,7 @@ function page_manager_node_edit_enable($cache, $status) { * The subtask id * @param $contexts * The contexts loaded for the task. + * * @return * TRUE if the current user can access the page. */ diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/node_view.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/node_view.inc index 89a29128..6de28ad5 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/node_view.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/node_view.inc @@ -15,7 +15,7 @@ */ function page_manager_node_view_page_manager_tasks() { return array( - // This is a 'page' task and will fall under the page admin UI + // This is a 'page' task and will fall under the page admin UI. 'task type' => 'page', 'title' => t('Node template'), @@ -60,7 +60,7 @@ function page_manager_node_view_menu_alter(&$items, $task) { $items['node/%node']['file'] = $task['file']; } else { - // automatically disable this task if it cannot be enabled. + // 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'); @@ -78,13 +78,30 @@ function page_manager_node_view_menu_alter(&$items, $task) { * node view, which is node_page_view(). */ function page_manager_node_view_page($node) { - // Load my task plugin + // 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)); @@ -157,6 +174,7 @@ function page_manager_node_view_enable($cache, $status) { * The subtask id * @param $contexts * The contexts loaded for the task. + * * @return * TRUE if the current user can access the page. */ diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/page.admin.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/page.admin.inc index b2ae8cbe..13cc6322 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/page.admin.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/page.admin.inc @@ -47,7 +47,7 @@ function page_manager_page_menu(&$items, $task) { 'type' => MENU_CALLBACK, ) + $base; - // Add menu entries for each subtask + // Add menu entries for each subtask. foreach (page_manager_page_load_all() as $subtask_id => $subtask) { if (!empty($subtask->disabled)) { continue; @@ -102,12 +102,12 @@ function page_manager_page_menu(&$items, $task) { $page_arguments[] = $position; $access_arguments[] = $position; } - else if ($bit[0] != '!') { + 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 + // could happen from erroneous paths like: this///that. $position++; } @@ -171,7 +171,7 @@ function page_manager_page_menu_item($task, $menu, $access_arguments, $page_argu case 'normal': $item['type'] = MENU_NORMAL_ITEM; - // Insert item into the proper menu + // Insert item into the proper menu. $item['menu_name'] = $menu['name']; break; @@ -261,10 +261,10 @@ function page_manager_page_add_subtask($task_name = NULL, $step = NULL) { if (isset($form_info['add order'][$id])) { $form_info['order'][$id] = $form_info['add order'][$id]; } - else if (isset($handler_plugin['add features'][$id])) { + elseif (isset($handler_plugin['add features'][$id])) { $form_info['order'][$id] = $handler_plugin['add features'][$id]; } - else if (isset($handler_plugin['required forms'][$id])) { + elseif (isset($handler_plugin['required forms'][$id])) { $form_info['order'][$id] = $handler_plugin['required forms'][$id]; } } @@ -279,7 +279,7 @@ function page_manager_page_add_subtask($task_name = NULL, $step = NULL) { // our questions determined would be next. if ($step == 'next') { $keys = array_keys($form_info['order']); - // get rid of 'basic' from the list of forms. + // Get rid of 'basic' from the list of forms. array_shift($keys); $step = array_shift($keys); @@ -416,7 +416,7 @@ function page_manager_page_form_basic($form, &$form_state) { '#default_value' => $page->admin_description, ); - // path + // Path. $form['path'] = array( '#type' => 'textfield', '#title' => t('Path'), @@ -452,7 +452,7 @@ function page_manager_page_form_basic($form, &$form_state) { '#description' => t('Admin overlays are used in many places in Drupal 7 and administrative custom pages should probably utilize this feature.'), ); } - else if ($path == $frontpage) { + 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'))) . '', ); @@ -516,7 +516,7 @@ function page_manager_page_form_basic_validate(&$form, &$form_state) { $path = array(); if (empty($form_state['values']['path'])) { form_error($form['path'], t('Path is required.')); - // stop processing here if there is no path. + // Stop processing here if there is no path. return; } @@ -542,7 +542,7 @@ function page_manager_page_form_basic_validate(&$form, &$form_state) { $path[] = '%'; } - else if ($bit[0] == '!') { + elseif ($bit[0] == '!') { $found = TRUE; } else { @@ -620,9 +620,10 @@ function page_manager_page_form_basic_submit(&$form, &$form_state) { $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 + // Figure out which forms to present them with. $cache->forms = array(); - $cache->forms[] = 'basic'; // This one is always there. + // This one is always there. + $cache->forms[] = 'basic'; if (!empty($form_state['arguments'])) { $cache->forms[] = 'argument'; } @@ -787,7 +788,6 @@ function page_manager_page_form_menu($form, &$form_state) { 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']; @@ -876,7 +876,7 @@ function page_manager_page_form_argument($form, &$form_state) { if (isset($page->temporary_arguments[$keyword]) && !empty($form_state['allow temp'])) { $conf = $page->temporary_arguments[$keyword]; } - else if (isset($page->arguments[$keyword])) { + elseif (isset($page->arguments[$keyword])) { $conf = $page->arguments[$keyword]; } @@ -896,7 +896,7 @@ function page_manager_page_form_argument($form, &$form_state) { $form['table']['argument'][$keyword]['#position'] = $position; $form['table']['argument'][$keyword]['#context'] = $context; - // The URL for this ajax button + // 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', @@ -913,7 +913,7 @@ function page_manager_page_form_argument($form, &$form_state) { // Only show the button if this has a settings form available: if (!empty($plugin)) { - // The URL for this ajax button + // 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', @@ -970,7 +970,7 @@ function theme_page_manager_page_form_argument_table($vars) { } /** - * Ajax entry point to edit an item + * Ajax entry point to edit an item. */ function page_manager_page_subtask_argument_ajax($step = NULL, $task_name = NULL, $keyword = NULL) { ctools_include('ajax'); @@ -995,7 +995,7 @@ function page_manager_page_subtask_argument_ajax($step = NULL, $task_name = NULL return ctools_ajax_render_error(t('Invalid keyword.')); } - // Set up wizard info + // Set up wizard info. $form_info = array( 'id' => 'page_manager_page_argument', 'path' => "admin/structure/pages/argument/%step/$task_name/$keyword", @@ -1032,7 +1032,7 @@ function page_manager_page_subtask_argument_ajax($step = NULL, $task_name = NULL if (!empty($form_state['cancel'])) { $commands = array(ctools_modal_command_dismiss()); } - else if (!empty($form_state['complete'])) { + elseif (!empty($form_state['complete'])) { if (isset($page->temporary_arguments[$keyword])) { $page->arguments[$keyword] = $page->temporary_arguments[$keyword]; } @@ -1051,7 +1051,6 @@ function page_manager_page_subtask_argument_ajax($step = NULL, $task_name = NULL // 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; @@ -1174,7 +1173,7 @@ function page_manager_page_argument_form_change_submit(&$form, &$form_state) { if (is_array($plugin['default'])) { $settings = $plugin['default']; } - else if (function_exists($plugin['default'])) { + elseif (function_exists($plugin['default'])) { $settings = $plugin['default'](); } } @@ -1201,7 +1200,7 @@ function page_manager_page_argument_form_settings($form, &$form_state) { if (isset($page->temporary_arguments[$keyword])) { $conf = $page->temporary_arguments[$keyword]; } - else if (isset($page->arguments[$keyword])) { + elseif (isset($page->arguments[$keyword])) { $conf = $page->temporary_arguments[$keyword] = $page->arguments[$keyword]; } @@ -1271,7 +1270,7 @@ function page_manager_page_argument_form_settings_submit(&$form, &$form_state) { } /** - * Import a task handler from cut & paste + * 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); @@ -1414,7 +1413,7 @@ function page_manager_page_form_clone($form, &$form_state) { '#description' => t('Enter the name to the new page It must be unique and contain only alphanumeric characters and underscores.'), ); - // path + // Path. $form['path'] = array( '#type' => 'textfield', '#title' => t('Path'), @@ -1449,7 +1448,7 @@ function page_manager_page_form_clone_validate(&$form, &$form_state) { } /** - * submit clone page form. + * 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. diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/page.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/page.inc index 6a8545d1..100dfd81 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/page.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/page.inc @@ -32,7 +32,7 @@ function page_manager_page_page_manager_tasks() { 'function' => 'page_manager_page_menu', ), 'hook theme' => 'page_manager_page_theme', - // page only items + // Page only items. 'task type' => 'page', 'page operations' => array( array( @@ -49,7 +49,7 @@ function page_manager_page_page_manager_tasks() { ), 'page type' => 'custom', - // context only items + // Context only items. 'handler type' => 'context', 'get arguments' => array( 'file' => 'page.admin.inc', @@ -112,7 +112,7 @@ function page_manager_page_save_subtask($subtask) { } } page_manager_page_recalculate_arguments($page); - // Create a real object from the cache + // Create a real object from the cache. page_manager_page_save($page); // Check to see if we should make this the site frontpage. @@ -191,7 +191,7 @@ function page_manager_page_build_subtask($task, $page) { 'form' => 'page_manager_page_form_delete', ); } - else if ($page->export_type != EXPORT_IN_CODE) { + elseif ($page->export_type != EXPORT_IN_CODE) { $operations['actions']['children']['delete'] = array( 'title' => t('Delete'), 'description' => t('Remove this page from your system completely.'), @@ -216,11 +216,11 @@ function page_manager_page_build_subtask($task, $page) { '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 + // This works for both enable AND disable. 'enable callback' => 'page_manager_page_enable', ); - // default handlers may appear from a default subtask. + // Default handlers may appear from a default subtask. if (isset($page->default_handlers)) { $subtask['default handlers'] = $page->default_handlers; } @@ -247,8 +247,7 @@ function page_manager_page_theme(&$items, $task) { } // -------------------------------------------------------------------------- -// Page execution functions - +// Page execution functions. /** * Execute a page task. * @@ -262,6 +261,7 @@ function page_manager_page_theme(&$items, $task) { * 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); @@ -269,12 +269,12 @@ function page_manager_page_execute($subtask_id) { // Turn the contexts into a properly keyed array. $contexts = array(); $args = array(); - foreach (func_get_args() as $count => $arg) { + foreach ($func_args as $count => $arg) { if (is_object($arg) && get_class($arg) == 'ctools_context') { $contexts[$arg->id] = $arg; $args[] = $arg->original_argument; } - else if ($count) { + elseif ($count) { $args[] = $arg; } } @@ -302,9 +302,9 @@ function page_manager_page_execute($subtask_id) { $context = ctools_context_get_context_from_argument($argument, $value); } else { - // make sure there is a placeholder context for missing optional contexts. + // 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 + // Force the title to blank for replacements. } if ($context) { $contexts[$context->id] = $context; @@ -328,8 +328,7 @@ function page_manager_page_execute($subtask_id) { } // -------------------------------------------------------------------------- -// Context type callbacks - +// Context type callbacks. /** * Return a list of arguments used by this task. */ @@ -432,7 +431,7 @@ function page_manager_page_save(&$page) { /** * Remove a page subtask. */ -function page_manager_page_delete($page) { +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); @@ -450,7 +449,11 @@ function page_manager_page_delete($page) { // rebuild this page again. ctools_include('export'); ctools_export_load_object_reset('page_manager_pages'); - menu_rebuild(); + // Allow menu rebuild to be skipped when calling code is deleting multiple + // pages. + if (!$skip_menu_rebuild) { + menu_rebuild(); + } } /** @@ -500,7 +503,7 @@ function page_manager_page_get_named_arguments($path) { $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 % + // Special handling for duplicate path items and substr to remove the %. $arguments[substr($bit, 1)] = isset($arguments[$bit]) ? -1 : $position; } } @@ -547,7 +550,7 @@ function _pm_arg_load($value, $subtask, $argument) { ctools_include('context'); $context = ctools_context_get_context_from_argument($page->arguments[$keyword], $value); - // convert false equivalents to false. + // Convert false equivalents to false. return $context ? $context : FALSE; } @@ -583,7 +586,6 @@ function page_manager_page_admin_summary($task, $subtask) { array('class' => array('page-summary-operation'), 'data' => $link), ); - $path = array(); foreach (explode('/', $page->path) as $bit) { if ($bit[0] != '!') { @@ -599,7 +601,7 @@ function page_manager_page_admin_summary($task, $subtask) { if ($path == $front) { $message = t('This is your site home page.'); } - else if (!empty($page->make_frontpage)) { + elseif (!empty($page->make_frontpage)) { $message = t('This page is set to become your site home page.'); } @@ -660,6 +662,7 @@ function page_manager_page_admin_summary($task, $subtask) { 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(); @@ -750,7 +753,7 @@ function page_manager_page_new_page_cache(&$page, &$cache) { $cache->subtask = page_manager_page_build_subtask($cache->task, $page); if (isset($cache->handlers)) { - foreach($cache->handlers as $id => $handler) { + foreach ($cache->handlers as $id => $handler) { $cache->handler_info[$id]['changed'] = PAGE_MANAGER_CHANGED_DELETED; } } @@ -778,6 +781,7 @@ function page_manager_page_new_page_cache(&$page, &$cache) { * The subtask id * @param $contexts * The contexts loaded for the task. + * * @return * TRUE if the current user can access the page. */ diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/poll.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/poll.inc index 073ee0c6..926c7671 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/poll.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/poll.inc @@ -1,5 +1,9 @@ 'page', 'title' => t('All polls'), @@ -68,7 +72,7 @@ function page_manager_poll_menu_alter(&$items, $task) { * node edit, which is node_page_edit(). */ function page_manager_poll() { - // Load my task plugin + // Load my task plugin. $task = page_manager_get_task('poll'); ctools_include('context'); @@ -113,6 +117,7 @@ function page_manager_poll_enable($cache, $status) { * The subtask id * @param $contexts * The contexts loaded for the task. + * * @return * TRUE if the current user can access the page. */ diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/search.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/search.inc index efd7415c..172d963a 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/search.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/search.inc @@ -10,8 +10,9 @@ */ /** - * Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for - * more information. + * Specialized implementation of hook_page_manager_task_tasks(). + * + * See api-task.html for more information. */ function page_manager_search_page_manager_tasks() { if (!module_exists('search')) { @@ -19,7 +20,7 @@ function page_manager_search_page_manager_tasks() { } return array( - // This is a 'page' task and will fall under the page admin UI + // This is a 'page' task and will fall under the page admin UI. 'task type' => 'page', 'title' => t('Search'), @@ -38,7 +39,6 @@ function page_manager_search_page_manager_tasks() { 'get arguments' => 'page_manager_search_get_arguments', 'get context placeholders' => 'page_manager_search_get_contexts', 'access callback' => 'page_manager_search_access_check', - ); } @@ -59,7 +59,6 @@ function page_manager_search_menu_alter(&$items, $task) { // 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. @@ -85,7 +84,7 @@ function page_manager_search_menu_alter(&$items, $task) { $items["$path/%menu_tail"]['file'] = $task['file']; } else { - // automatically disable this task if it cannot be enabled. + // 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'); @@ -96,12 +95,9 @@ function page_manager_search_menu_alter(&$items, $task) { /** * Entry point for our overridden search page. - * */ function page_manager_search_page($type) { ctools_include('menu'); -// menu_set_active_trail(ctools_get_menu_trail('search/' . $type)); - // Get the arguments and construct a keys string out of them. $args = func_get_args(); @@ -111,10 +107,10 @@ function page_manager_search_page($type) { // 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); + // Allow other modules to alter the search keys. + drupal_alter(array('search_keys', 'search_' . $type . '_keys'), $keys); - // Load my task plugin + // Load my task plugin. $task = page_manager_get_task('search'); $subtask = page_manager_get_task_subtask($task, $type); @@ -138,7 +134,6 @@ function page_manager_search_page($type) { } // Otherwise, fall back. - // Put the $type back on the arguments. module_load_include('inc', 'search', 'search.pages'); array_unshift($args, $type); @@ -224,7 +219,7 @@ function page_manager_search_build_subtask($task, $module) { '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 + // This works for both enable AND disable. 'enable callback' => 'page_manager_search_enable', ); @@ -240,6 +235,7 @@ function page_manager_search_build_subtask($task, $module) { * The subtask id * @param $contexts * The contexts loaded for the task. + * * @return * TRUE if the current user can access the page. */ diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/term_view.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/term_view.inc index 37259b95..72fb7dbc 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/term_view.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/term_view.inc @@ -16,7 +16,7 @@ function page_manager_term_view_page_manager_tasks() { if (module_exists('taxonomy')) { return array( - // This is a 'page' task and will fall under the page admin UI + // This is a 'page' task and will fall under the page admin UI. 'task type' => 'page', 'title' => t('Taxonomy term template'), @@ -29,7 +29,7 @@ function page_manager_term_view_page_manager_tasks() { '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 + // 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', @@ -48,7 +48,7 @@ function page_manager_term_view_page_manager_tasks() { 'enable callback' => 'page_manager_term_view_enable', 'access callback' => 'page_manager_term_view_access_check', - // Allow additional operations + // Allow additional operations. 'operations' => array( 'settings' => array( 'title' => t('Settings'), @@ -79,7 +79,7 @@ function page_manager_term_view_menu_alter(&$items, $task) { $items['taxonomy/term/%taxonomy_term']['file'] = $task['file']; } else { - // automatically disable this task if it cannot be enabled. + // 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'])) { @@ -87,7 +87,7 @@ function page_manager_term_view_menu_alter(&$items, $task) { } // Because Views changes %taxonomy_term to %views_arg, check to see if that // is why we can't enable: - else if (isset($items['taxonomy/term/%views_arg']['page callback'])) { + elseif (isset($items['taxonomy/term/%views_arg']['page callback'])) { $callback = $items['taxonomy/term/%views_arg']['page callback']; } else { @@ -112,7 +112,6 @@ function page_manager_term_view_page($term, $depth = NULL) { // 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); @@ -126,10 +125,10 @@ function page_manager_term_view_page($term, $depth = NULL) { // 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 + // Trigger the main. $build = taxonomy_term_show($term); - // Load my task plugin + // Load my task plugin. $task = page_manager_get_task('term_view'); // Load the term into a context. @@ -157,7 +156,6 @@ function page_manager_term_view_page($term, $depth = NULL) { // 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, @@ -296,7 +294,6 @@ function page_manager_term_view_enable($cache, $status) { } function page_manager_term_view_get_type() { -// $view_type = variable_get('page_manager_term_view_type', 'multiple'); // Revert to just allowing single. $view_type = 'single'; @@ -369,7 +366,8 @@ function page_manager_term_view_admin_summary($task, $subtask) { * The subtask id * @param $contexts * The contexts loaded for the task. - * @return + * + * @return bool * TRUE if the current user can access the page. */ function page_manager_term_view_access_check($task, $subtask_id, $contexts) { diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/user_edit.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/user_edit.inc index 0b11bf01..3054056f 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/user_edit.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/user_edit.inc @@ -9,7 +9,7 @@ */ function page_manager_user_edit_page_manager_tasks() { return array( - // This is a 'page' task and will fall under the page admin UI + // This is a 'page' task and will fall under the page admin UI. 'task type' => 'page', 'title' => t('User Edit Template'), 'admin title' => t('User edit template'), @@ -65,7 +65,7 @@ function page_manager_user_edit_menu_alter(&$items, $task) { } } else { - // automatically disable this task if it cannot be enabled. + // 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'); @@ -114,9 +114,9 @@ function page_manager_user_edit_page($account, $category = 'account') { // 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. + // 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); @@ -125,10 +125,9 @@ function page_manager_user_edit_page($account, $category = 'account') { $output = drupal_build_form($form_id, $form_state); return $output; } - //fire off "view" op so that triggers still work + // 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. - // user_module_invoke('view', $array = array(), $account); return $function($account); } @@ -178,6 +177,7 @@ function page_manager_user_edit_enable($cache, $status) { * The subtask id * @param $contexts * The contexts loaded for the task. + * * @return * TRUE if the current user can access the page. */ diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/user_view.inc b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/user_view.inc index c428384a..3a531c7b 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/user_view.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/plugins/tasks/user_view.inc @@ -9,7 +9,7 @@ */ function page_manager_user_view_page_manager_tasks() { return array( - // This is a 'page' task and will fall under the page admin UI + // This is a 'page' task and will fall under the page admin UI. 'task type' => 'page', 'title' => t('User profile template'), 'admin title' => t('User profile template'), @@ -53,7 +53,7 @@ function page_manager_user_view_menu_alter(&$items, $task) { $items['user/%user']['file'] = $task['file']; } else { - // automatically disable this task if it cannot be enabled. + // 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'); @@ -98,10 +98,9 @@ function page_manager_user_view_page($account) { if ($function == 'user_view') { module_load_include('inc', 'user', 'user.pages'); } - //fire off "view" op so that triggers still work + // 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. -// user_module_invoke('view', $array = array(), $account); return $function($account); } @@ -152,6 +151,7 @@ function page_manager_user_view_enable($cache, $status) { * The subtask id * @param $contexts * The contexts loaded for the task. + * * @return * TRUE if the current user can access the page. */ diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/tests/head_links.test b/sites/all/modules/contrib/dev/ctools/page_manager/tests/head_links.test new file mode 100644 index 00000000..3a88e295 --- /dev/null +++ b/sites/all/modules/contrib/dev/ctools/page_manager/tests/head_links.test @@ -0,0 +1,77 @@ + '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/sites/all/modules/contrib/dev/ctools/page_manager/theme/page-manager-edit-page.tpl.php b/sites/all/modules/contrib/dev/ctools/page_manager/theme/page-manager-edit-page.tpl.php index 85510cd9..2ea065c8 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/theme/page-manager-edit-page.tpl.php +++ b/sites/all/modules/contrib/dev/ctools/page_manager/theme/page-manager-edit-page.tpl.php @@ -1,4 +1,5 @@
    - +
    @@ -50,4 +51,4 @@ - \ No newline at end of file + diff --git a/sites/all/modules/contrib/dev/ctools/page_manager/theme/page_manager.theme.inc b/sites/all/modules/contrib/dev/ctools/page_manager/theme/page_manager.theme.inc index 6435d1ce..3df55a89 100644 --- a/sites/all/modules/contrib/dev/ctools/page_manager/theme/page_manager.theme.inc +++ b/sites/all/modules/contrib/dev/ctools/page_manager/theme/page_manager.theme.inc @@ -27,10 +27,10 @@ function template_preprocess_page_manager_edit_page(&$vars) { $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.'))); } - else if (!empty($page->new)) { + 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.'))); } - else if (!empty($page->changed)) { + 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.'))); } @@ -49,9 +49,9 @@ function template_preprocess_page_manager_edit_page(&$vars) { */ function theme_page_manager_handler_rearrange($vars) { $form = &$vars['form']; - // Assemble the data for a table from everything in $form['handlers'] + // Assemble the data for a table from everything in $form['handlers']. foreach (element_children($form['handlers']) as $id) { - // provide a reference shortcut. + // Provide a reference shortcut. $element = &$form['handlers'][$id]; if (isset($element['title'])) { $row = array(); diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/compare_users.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/compare_users.inc index c271ff4e..e0a7f1b4 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/compare_users.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/compare_users.inc @@ -2,7 +2,7 @@ /** * @file - * Ctools access plugin to provide access/visiblity if two user contexts are equal. + * CTools access plugin to provide access/visiblity if two user contexts are equal. */ /** @@ -20,12 +20,12 @@ $plugin = array( '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') + new ctools_context_required(t("Second User"), 'user'), ), ); /** - * Settings form for the 'by perm' access plugin + * Settings form for the 'by perm' access plugin. */ function ctools_compare_users_settings($form, &$form_state, $conf) { diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/context_exists.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/context_exists.inc index aabc62dd..e5d2b5e2 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/context_exists.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/context_exists.inc @@ -2,7 +2,7 @@ /** * @file - * Plugin to provide access control/visibility based on existence of a specified context + * Plugin to provide access control/visibility based on existence of a specified context. */ $plugin = array( @@ -16,7 +16,7 @@ $plugin = array( ); /** - * Settings form + * Settings form. */ function ctools_context_exists_ctools_access_settings($form, &$form_state, $conf) { $form['settings']['exists'] = array( @@ -29,17 +29,17 @@ function ctools_context_exists_ctools_access_settings($form, &$form_state, $conf } /** - * Check for access + * 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. + // 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 + * Provide a summary description based upon the specified context. */ function ctools_context_exists_ctools_access_summary($conf, $context) { if (!empty($conf['exists'])) { diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/entity_bundle.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/entity_bundle.inc index e07a048d..fce34197 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/entity_bundle.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/entity_bundle.inc @@ -43,7 +43,7 @@ function ctools_entity_bundle_ctools_access_get_children($plugin, $parent) { } /** - * Settings form for the 'by entity_bundle' access plugin + * Settings form for the 'by entity_bundle' access plugin. */ function ctools_entity_bundle_ctools_access_settings($form, &$form_state, $conf) { $plugin = $form_state['plugin']; @@ -133,4 +133,3 @@ function ctools_entity_bundle_ctools_access_summary($conf, $context, $plugin) { 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/sites/all/modules/contrib/dev/ctools/plugins/access/entity_field_value.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/entity_field_value.inc index fa94a481..60d2c2e0 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/entity_field_value.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/entity_field_value.inc @@ -48,7 +48,7 @@ function ctools_entity_field_value_ctools_access_get_children($plugin, $parent) } 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. + // 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); @@ -68,14 +68,14 @@ function _ctools_entity_field_value_ctools_access_get_child($plugin, $parent, $e $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, - )); + 'type' => $bundle_type, + )); return $plugin; } /** - * Settings form for the 'by entity_bundle' access 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']; @@ -88,7 +88,7 @@ function ctools_entity_field_value_ctools_access_settings($form, &$form_state, $ $columns[$column] = _field_sql_storage_columnname($field_name, $column); } ctools_include('fields'); - $entity = (object)array( + $entity = (object) array( $entity_info['entity keys']['bundle'] => $bundle_type, ); @@ -115,7 +115,7 @@ function ctools_entity_field_value_ctools_access_settings($form, &$form_state, $ $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. + // 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']); } @@ -145,7 +145,8 @@ function ctools_entity_field_value_ctools_access_settings_submit($form, &$form_s function _ctools_entity_field_value_get_proper_form_items($field, $form_items, $columns) { $items = array(); - if (!is_array($form_items)) { // Single value item. + // Single value item. + if (!is_array($form_items)) { foreach ($columns as $column) { $items[0][$column] = $form_items; } @@ -175,7 +176,7 @@ function _ctools_entity_field_value_get_proper_form_items($field, $form_items, $ foreach ($columns as $column) { if (isset($form_items[$column])) { $has_columns = TRUE; - $item[$column] = $form_items[$column]; + $item[$column] = $form_items[$column]; } else { $item[$column] = ''; @@ -353,7 +354,7 @@ function ctools_entity_field_value_ctools_access_summary($conf, $context, $plugi $display['type'] = 'entityreference_label'; break; - default : + default: // Use field instance formatter setting. break; } @@ -381,7 +382,7 @@ function ctools_entity_field_value_ctools_access_summary($conf, $context, $plugi if (is_array($elements)) { foreach ($elements as $element_key => $element) { if (is_numeric($element_key)) { - $value_str= strip_tags(drupal_render($element)); + $value_str = strip_tags(drupal_render($element)); if (strlen($value_str) > 0) { $output[] = $value_str; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/front.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/front.inc index 1bbc6e05..8718a143 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/front.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/front.inc @@ -19,7 +19,7 @@ $plugin = array( ); /** - * Settings form for the 'by parent term' access plugin + * Settings form for the 'by parent term' access plugin. */ function ctools_front_ctools_access_settings($form, &$form_state, $conf) { // No additional configuration necessary. diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/node_access.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/node_access.inc index fcd275d9..c153cc5a 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/node_access.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/node_access.inc @@ -24,7 +24,7 @@ $plugin = array( ); /** - * Settings form for the 'by node_access' access plugin + * Settings form for the 'by node_access' access plugin. */ function ctools_node_access_ctools_access_settings($form, &$form_state, $conf) { $form['settings']['type'] = array( @@ -86,4 +86,3 @@ function ctools_node_access_ctools_access_summary($conf, $context) { return t('@user can create nodes of the same type as @node.', $replacement); } } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/node_comment.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/node_comment.inc index 915ee20e..6cebdaf8 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/node_comment.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/node_comment.inc @@ -1,4 +1,5 @@ implode(', ', $names), '@identifier' => $context->identifier)); } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/node_status.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/node_status.inc index ad5ba400..137f2826 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/node_status.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/node_status.inc @@ -30,4 +30,3 @@ function ctools_node_status_ctools_access_check($conf, $context) { function ctools_node_status_ctools_access_summary($conf, $context) { return t('Returns true if the nodes status is "published".'); } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/node_type.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/node_type.inc index 23a38453..d89532ae 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/node_type.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/node_type.inc @@ -22,7 +22,7 @@ $plugin = array( ); /** - * Settings form for the 'by node_type' access plugin + * 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(); @@ -114,4 +114,3 @@ function ctools_node_type_ctools_access_summary($conf, $context) { 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/sites/all/modules/contrib/dev/ctools/plugins/access/path_visibility.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/path_visibility.inc index 60b86124..1612e1c3 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/path_visibility.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/path_visibility.inc @@ -11,12 +11,12 @@ $plugin = array( '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'), + 'required context' => new ctools_context_optional(t('Path'), 'string'), 'default' => array('visibility_setting' => 1, 'paths' => ''), ); /** - * Settings form + * Settings form. */ function ctools_path_visibility_ctools_access_settings($form, &$form_state, $conf) { $form['settings']['note'] = array( diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/perm.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/perm.inc index 67516faf..cb2bb81e 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/perm.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/perm.inc @@ -20,11 +20,11 @@ $plugin = array( ); /** - * Settings form for the 'by perm' access plugin + * Settings form for the 'by perm' access plugin. */ function ctools_perm_ctools_access_settings($form, &$form_state, $conf) { $perms = array(); - // Get list of permissions + // 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. @@ -70,4 +70,3 @@ function ctools_perm_ctools_access_summary($conf, $context) { $permissions = module_invoke_all('permission'); return t('@identifier has "@perm"', array('@identifier' => $context->identifier, '@perm' => $permissions[$conf['perm']]['title'])); } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/php.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/php.inc index 35da86d9..4e9d0565 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/php.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/php.inc @@ -20,7 +20,7 @@ $plugin = array( ); /** - * Settings form for the 'by perm' access plugin + * 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. @@ -38,7 +38,7 @@ function ctools_php_ctools_access_settings($form, &$form_state, $conf) { '#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.'), + '#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; diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/query_string_exists.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/query_string_exists.inc index abec5f7a..fb3b4334 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/query_string_exists.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/query_string_exists.inc @@ -23,7 +23,7 @@ function ctools_query_string_exists_ctools_access_settings($form, &$form_state, '#description' => t('Enter the key of the query string.'), '#type' => 'textfield', '#required' => TRUE, - '#default_value' => $config['key'] + '#default_value' => $config['key'], ); return $form; diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/role.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/role.inc index b6332544..4d8cbae1 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/role.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/role.inc @@ -21,7 +21,7 @@ $plugin = array( ); /** - * Settings form for the 'by role' access plugin + * Settings form for the 'by role' access plugin. */ function ctools_role_ctools_access_settings($form, &$form_state, $conf) { $form['settings']['rids'] = array( @@ -76,4 +76,3 @@ function ctools_role_ctools_access_summary($conf, $context) { return format_plural(count($names), '@identifier has role "@roles"', '@identifier has one of "@roles"', array('@roles' => implode(', ', $names), '@identifier' => $context->identifier)); } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/site_language.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/site_language.inc index 9ff2f70c..5b7b724c 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/site_language.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/site_language.inc @@ -22,7 +22,7 @@ if (module_exists('locale')) { } /** - * Settings form for the 'by site_language' access plugin + * Settings form for the 'by site_language' access plugin. */ function ctools_site_language_ctools_access_settings($form, &$form_state, $conf) { $options = array( @@ -84,4 +84,3 @@ function ctools_site_language_ctools_access_summary($conf, $context) { return format_plural(count($names), 'Site language is "@languages"', 'Site language is one of "@languages"', array('@languages' => implode(', ', $names))); } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/string_equal.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/string_equal.inc index ad1c88d8..feb48e9c 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/string_equal.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/string_equal.inc @@ -2,7 +2,7 @@ /** * @file - * Plugin to provide access control/visibility based on specified context string matching user-specified string + * Plugin to provide access control/visibility based on specified context string matching user-specified string. */ $plugin = array( @@ -16,7 +16,7 @@ $plugin = array( ); /** - * Settings form + * Settings form. */ function ctools_string_equal_ctools_access_settings($form, &$form_state, $conf) { $form['settings']['operator'] = array( @@ -47,7 +47,7 @@ function ctools_string_equal_ctools_access_settings($form, &$form_state, $conf) } /** - * Check for access + * Check for access. */ function ctools_string_equal_ctools_access_check($conf, $context) { if (empty($context) || empty($context->data)) { @@ -66,29 +66,34 @@ function ctools_string_equal_ctools_access_check($conf, $context) { 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 + * 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/sites/all/modules/contrib/dev/ctools/plugins/access/string_length.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/string_length.inc index 91abf227..3af504b9 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/string_length.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/string_length.inc @@ -57,14 +57,19 @@ function ctools_string_length_ctools_access_check($conf, $context) { 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']; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/term.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/term.inc index 36e70de4..50ec0d90 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/term.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/term.inc @@ -22,7 +22,7 @@ $plugin = array( ); /** - * Settings form for the 'by term' access plugin + * 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. @@ -51,7 +51,6 @@ function ctools_term_ctools_access_settings($form, &$form_state, $conf) { // 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. @@ -124,6 +123,8 @@ function ctools_term_ctools_access_summary($conf, $context) { 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)); + array( + '@terms' => implode(', ', $terms), + '@term' => $context->identifier, + )); } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/term_has_parent.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/term_has_parent.inc index a079e92a..16f4fbf6 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/term_has_parent.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/term_has_parent.inc @@ -1,4 +1,5 @@ !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} + // @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'), ); @@ -71,7 +71,6 @@ function ctools_term_has_parent_ctools_access_settings($form, &$form_state, $con foreach (taxonomy_get_tree($vocabulary->vid) as $term) { $terms[$term->tid] = str_repeat('-', $term->depth) . ($term->depth ? ' ' : '') . $term->name; } - //$form['settings']['vid_' . $vid]['#type'] = 'select'; $form['settings']['vid_' . $vid]['#type'] = 'checkboxes'; $form['settings']['vid_' . $vid]['#options'] = $terms; unset($terms); @@ -116,37 +115,36 @@ function ctools_term_has_parent_ctools_access_check($conf, $context) { // we'll start looking up the hierarchy from our context term id. $current_term = $context->data->tid; - $term=''; + $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(); + // 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 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. + // 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? + // 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) { + if ($term->term_parent == 0) { break; } - // update the parent, and keep scanning. + // Update the parent, and keep scanning. $current_term = $term->term_parent; } @@ -157,7 +155,7 @@ function ctools_term_has_parent_ctools_access_check($conf, $context) { * Provide a summary description based upon the checked terms. */ function ctools_term_has_parent_ctools_access_summary($conf, $context) { - $vid = (int)$conf['vid']; + $vid = (int) $conf['vid']; $terms = array(); foreach ($conf['vid_' . $vid] as $tid) { $term = taxonomy_term_load($tid); @@ -167,6 +165,8 @@ function ctools_term_has_parent_ctools_access_summary($conf, $context) { 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)); + array( + '@terms' => implode(', ', $terms), + '@term' => $context->identifier, + )); } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/term_parent.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/term_parent.inc index acbaf872..27375dfa 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/term_parent.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/term_parent.inc @@ -22,7 +22,7 @@ $plugin = array( ); /** - * Settings form for the 'by parent term' access plugin + * 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. diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/term_vocabulary.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/term_vocabulary.inc index b003138d..8e9a0caf 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/term_vocabulary.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/term_vocabulary.inc @@ -2,7 +2,7 @@ /** * @file - * Plugin to provide access control based upon term vocabulary + * Plugin to provide access control based upon term vocabulary. */ /** @@ -20,12 +20,12 @@ $plugin = array( 'required context' => new ctools_context_required(t('Vocabulary'), array( 'taxonomy_term', 'terms', - 'taxonomy_vocabulary' + 'taxonomy_vocabulary', )), ); /** - * Settings form for the 'by term_vocabulary' access plugin + * Settings form for the 'by term_vocabulary' access plugin. */ function ctools_term_vocabulary_ctools_access_settings($form, &$form_state, $conf) { $options = array(); @@ -101,7 +101,7 @@ function ctools_term_vocabulary_ctools_access_summary($conf, $context) { 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 + '@identifier' => $context->identifier, )); } @@ -123,5 +123,3 @@ function _ctools_term_vocabulary_ctools_access_map_vids(&$conf) { } } } - - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/access/theme.inc b/sites/all/modules/contrib/dev/ctools/plugins/access/theme.inc index 4f4be6de..67e3e6f0 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/access/theme.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/access/theme.inc @@ -19,7 +19,7 @@ $plugin = array( ); /** - * Settings form for the 'by theme' access plugin + * Settings form for the 'by theme' access plugin. */ function ctools_theme_ctools_access_settings($form, &$form_state, $conf) { $themes = array(); @@ -44,10 +44,10 @@ function ctools_theme_ctools_access_check($conf, $context) { if (!empty($GLOBALS['theme'])) { $theme = $GLOBALS['theme']; } - else if (!empty($GLOBALS['custom_theme'])) { + elseif (!empty($GLOBALS['custom_theme'])) { $theme = $GLOBALS['custom_theme']; } - else if (!empty($GLOBALS['user']->theme)) { + elseif (!empty($GLOBALS['user']->theme)) { $theme = $GLOBALS['user']->theme; } else { diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/entity_id.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/entity_id.inc index 3063fefd..73bfe1e1 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/entity_id.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/entity_id.inc @@ -2,7 +2,6 @@ /** * @file - * * Plugin to provide an argument handler for all entity ids. */ diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/nid.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/nid.inc index 9aaec0e1..cbb56d3e 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/nid.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/nid.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide an argument handler for a node id + * Plugin to provide an argument handler for a node id. */ /** @@ -47,4 +46,3 @@ function ctools_argument_nid_context($arg = NULL, $conf = NULL, $empty = FALSE) return ctools_context_create('node', $node); } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_add.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_add.inc index c811311b..f249a945 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_add.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_add.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide an argument handler for a Node add form + * Plugin to provide an argument handler for a Node add form. */ /** @@ -12,7 +11,7 @@ */ $plugin = array( 'title' => t("Node add form: node type"), - // keyword to use for %substitution + // 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', @@ -29,4 +28,3 @@ function ctools_node_add_context($arg = NULL, $conf = NULL, $empty = FALSE) { return ctools_context_create('node_add_form', $arg); } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_edit.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_edit.inc index c7cdf29e..8bd07689 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_edit.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/node_edit.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide an argument handler for a Node edit form + * Plugin to provide an argument handler for a Node edit form. */ /** @@ -12,7 +11,7 @@ */ $plugin = array( 'title' => t("Node edit form: node ID"), - // keyword to use for %substitution + // 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', @@ -48,4 +47,3 @@ function ctools_node_edit_context($arg = NULL, $conf = NULL, $empty = FALSE) { // This will perform a node_access check, so we don't have to. return ctools_context_create('node_edit_form', $node); } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/rid.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/rid.inc index 2661153b..d0cc30c4 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/rid.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/rid.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide an argument handler for a node revision id + * Plugin to provide an argument handler for a node revision id. */ /** @@ -47,4 +46,3 @@ function ctools_argument_rid_context($arg = NULL, $conf = NULL, $empty = FALSE) return ctools_context_create('node', $node); } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/string.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/string.inc index ed4ffbb6..005e40ea 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/string.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/string.inc @@ -2,16 +2,16 @@ /** * @file - * - * Plugin to provide an argument handler for a raw string + * Plugin to provide an argument handler for a raw string. */ + /** * Plugins are described by creating a $plugin array which will be used * by the system that includes this file. */ $plugin = array( 'title' => t("String"), - // keyword to use for %substitution + // 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', @@ -20,7 +20,8 @@ $plugin = array( '#type' => 'textfield', '#description' => t('Enter a value for this argument'), ), - 'path placeholder' => 'ctools_string_path_placeholder', // This is in pagemanager. +// This is in pagemanager. + 'path placeholder' => 'ctools_string_path_placeholder', ); /** @@ -39,7 +40,7 @@ function ctools_string_context($arg = NULL, $conf = NULL, $empty = FALSE) { } /** - * Settings form for the argument + * Settings form for the argument. */ function ctools_string_settings_form(&$form, &$form_state, $conf) { $form['settings']['use_tail'] = array( @@ -48,7 +49,6 @@ function ctools_string_settings_form(&$form, &$form_state, $conf) { '#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".'), ); -// return $form; } /** @@ -61,4 +61,4 @@ function ctools_string_path_placeholder($argument) { else { return '%pm_arg_tail'; } -} \ No newline at end of file +} diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/term.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/term.inc index 65c87ac7..f72e93da 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/term.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/term.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide an argument handler for a Taxonomy term + * Plugin to provide an argument handler for a Taxonomy term. */ /** @@ -12,7 +11,7 @@ */ $plugin = array( 'title' => t("Taxonomy term: ID"), - // keyword to use for %substitution + // 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', @@ -67,7 +66,7 @@ function ctools_term_context($arg = NULL, $conf = NULL, $empty = FALSE) { foreach ($vocabularies as $machine_name) { if ($potential->vocabulary_machine_name == $machine_name) { $term = $potential; - // break out of the foreaches AND the case + // Break out of the foreaches AND the case. break 3; } } @@ -92,7 +91,7 @@ function ctools_term_context($arg = NULL, $conf = NULL, $empty = FALSE) { } /** - * Settings form for the argument + * Settings form for the argument. */ function ctools_term_settings_form(&$form, &$form_state, $conf) { // @todo allow synonym use like Views does. @@ -137,10 +136,9 @@ function ctools_term_settings_form(&$form, &$form_state, $conf) { '#type' => 'checkbox', '#default_value' => !empty($conf['transform']), ); -// return $form; } -function ctools_term_settings_form_validate (&$form, &$form_state) { +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); @@ -157,6 +155,7 @@ function ctools_term_ctools_argument_placeholder($conf) { '#type' => 'textfield', '#description' => t('Enter a taxonomy term ID.'), ); + case 'term': return array( '#type' => 'textfield', @@ -190,13 +189,14 @@ function ctools_term_breadcrumb($conf, $context) { * * @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) { + foreach ($vocabularies as $vocabulary) { $return[$vocabulary->machine_name] = $vocabulary->machine_name; } return $return; diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/terms.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/terms.inc index d31f28de..b816e1cb 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/terms.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/terms.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide an argument handler for a Taxonomy term + * Plugin to provide an argument handler for a Taxonomy term. */ /** @@ -12,7 +11,7 @@ */ $plugin = array( 'title' => t("Taxonomy term (multiple): ID"), - // keyword to use for %substitution + // 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', @@ -45,7 +44,7 @@ function ctools_terms_context($arg = NULL, $conf = NULL, $empty = FALSE) { } /** - * Settings form for the argument + * Settings form for the argument. */ function ctools_terms_settings_form(&$form, &$form_state, $conf) { $form['settings']['breadcrumb'] = array( @@ -54,7 +53,6 @@ function ctools_terms_settings_form(&$form, &$form_state, $conf) { '#default_value' => !empty($conf['breadcrumb']), '#description' => t('If checked, taxonomy term parents will appear in the breadcrumb trail.'), ); -// return $form; } /** diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/uid.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/uid.inc index f9d5315c..c6ca3ccc 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/uid.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/uid.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide an argument handler for a user id + * Plugin to provide an argument handler for a user id. */ /** @@ -12,7 +11,7 @@ */ $plugin = array( 'title' => t("User: ID"), - // keyword to use for %substitution + // Keyword to use for %substitution. 'keyword' => 'user', 'description' => t('Creates a user context from a user ID argument.'), 'context' => 'ctools_argument_uid_context', @@ -21,7 +20,8 @@ $plugin = array( '#description' => t('Enter the user ID of a user for this argument'), ), 'default' => array('to_arg' => TRUE), - 'path placeholder' => '%pm_uid_arg', // This is in pagemanager. +// This is in pagemanager. + 'path placeholder' => '%pm_uid_arg', 'path placeholder to_arg' => TRUE, 'no ui' => TRUE, ); diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_edit.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_edit.inc index 32b2b812..9c52b589 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_edit.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_edit.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide an argument handler for a Taxonomy term + * Plugin to provide an argument handler for a Taxonomy term. */ /** @@ -12,7 +11,7 @@ */ $plugin = array( 'title' => t("User edit form: User ID"), - // keyword to use for %substitution + // 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', @@ -30,18 +29,18 @@ function ctools_user_edit_context($arg = NULL, $conf = NULL, $empty = FALSE) { if ($empty) { return ctools_context_create_empty('user_edit_form'); } - if(is_object($arg)){ + if (is_object($arg)) { return ctools_context_create('user_edit_form', $arg); } if (!is_numeric($arg)) { return FALSE; } - $account= user_load($arg); + $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); -} \ No newline at end of file +} diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_name.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_name.inc index f6f3b463..ed74d9d8 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_name.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/user_name.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide an argument handler for a username + * Plugin to provide an argument handler for a username. */ /** @@ -12,7 +11,7 @@ */ $plugin = array( 'title' => t("User: name"), - // keyword to use for %substitution + // Keyword to use for %substitution. 'keyword' => 'user', 'description' => t('Creates a user context from a user name.'), 'context' => 'ctools_argument_user_name_context', @@ -42,6 +41,3 @@ function ctools_argument_user_name_context($arg = NULL, $conf = NULL, $empty = F } return ctools_context_create('user', $account); } - - - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/arguments/vid.inc b/sites/all/modules/contrib/dev/ctools/plugins/arguments/vid.inc index 064b22d0..db68acd7 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/arguments/vid.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/arguments/vid.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide an argument handler for a vocabulary id + * Plugin to provide an argument handler for a vocabulary id. */ /** @@ -12,7 +11,7 @@ */ $plugin = array( 'title' => t("Vocabulary: ID"), - // keyword to use for %substitution + // Keyword to use for %substitution. 'keyword' => 'vocabulary', 'description' => t('Creates a vocabulary context from a vocabulary ID argument.'), 'context' => 'ctools_vid_context', @@ -43,4 +42,3 @@ function ctools_vid_context($arg = NULL, $conf = NULL, $empty = FALSE) { return ctools_context_create('vocabulary', $vocabulary); } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/cache/export_ui.inc b/sites/all/modules/contrib/dev/ctools/plugins/cache/export_ui.inc index 53483a53..f21af100 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/cache/export_ui.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/cache/export_ui.inc @@ -6,7 +6,7 @@ */ $plugin = array( - // cache plugins are the rare plugin types that have no real UI but + // Cache plugins are the rare plugin types that have no real UI but // we're providing a title just in case. 'title' => t('Export UI wizard cache'), 'cache get' => 'ctools_cache_export_ui_cache_get', diff --git a/sites/all/modules/contrib/dev/ctools/plugins/cache/simple.inc b/sites/all/modules/contrib/dev/ctools/plugins/cache/simple.inc index 570398ba..c44d7983 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/cache/simple.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/cache/simple.inc @@ -6,7 +6,7 @@ */ $plugin = array( - // cache plugins are the rare plugin types that have no real UI but + // Cache plugins are the rare plugin types that have no real UI but // we're providing a title just in case. 'title' => t('Simple'), 'cache get' => 'ctools_cache_simple_cache_get', diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/block/block.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/block/block.inc index 46b02e9e..ff75c750 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/block/block.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/block/block.inc @@ -51,7 +51,7 @@ function ctools_block_content_type_content_types() { 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 + // 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; @@ -168,7 +168,7 @@ function ctools_block_content_type_render($subtype, $conf) { if ($module == 'block' && !empty($info) && isset($info->title)) { $block->title = $info->title; } - else if (isset($block->subject)) { + elseif (isset($block->subject)) { $block->title = $block->subject; } else { @@ -208,70 +208,6 @@ function ctools_block_content_type_edit_form_submit($form, &$form_state) { } } -/** - * Returns an edit form for a block. - */ -//function ctools_block_content_type_edit_form($id, $parents, $conf) { -// if (user_access('administer advanced pane settings')) { -// $form['block_visibility'] = array( -// '#type' => 'checkbox', -// '#title' => t('Use block visibility settings (see block config)'), -// '#default_value' => !empty($conf['block_visibility']), -// '#description' => t('If checked, the block visibility settings for this block will apply to this block.'), -// ); -// // Module-specific block configurations. -// if ($settings = module_invoke($module, 'block', 'configure', $delta)) { -// // Specifically modify a couple of core block forms. -// if ($module == 'block') { -// unset($settings['submit']); -// $settings['info']['#type'] = 'value'; -// $settings['info']['#value'] = $settings['info']['#default_value']; -// } -// ctools_admin_fix_block_tree($settings); -// $form['block_settings'] = array( -// '#type' => 'fieldset', -// '#title' => t('Block settings'), -// '#description' => t('Settings in this section are global and are for all blocks of this type, anywhere in the system.'), -// '#tree' => FALSE, -// ); -// -// -// $form['block_settings'] += $settings; -// } -// } -// -// return $form; -//} - -//function ctools_admin_submit_block(&$form_values) { -// if (!empty($form_values['block_settings'])) { -// module_invoke($form_values['module'], 'block', 'save', $form_values['delta'], $form_values['block_settings']); -// } -//} -// -///** -// * Because form api cannot collapse just part of a tree, and the block settings -// * assume no tree, we have to collapse the tree ourselves. -// */ -//function ctools_admin_fix_block_tree(&$form, $key = NULL) { -// if ($key) { -// if (!empty($form['#parents'])) { -// $form['#parents'] = array_merge(array('configuration', 'block_settings'), $form['#parents']); -// } -// else if (empty($form['#tree'])) { -// $form['#parents'] = array('configuration', 'block_settings', $key); -// } -// } -// -// if (isset($form['#type']) && $form['#type'] == 'textarea' && !empty($form['#rows']) && $form['#rows'] > 10) { -// $form['#rows'] = 10; -// } -// -// foreach (element_children($form) as $key) { -// ctools_admin_fix_block_tree($form[$key], $key); -// } -//} - /** * Returns the administrative title for a type. */ @@ -338,8 +274,10 @@ function ctools_default_block_info($module, $delta, &$info) { } } -// These are all on behalf of modules that don't implement ctools but that -// we care about. +/** + * These are all on behalf of modules that don't implement ctools but that + * we care about. + */ function menu_ctools_block_info($module, $delta, &$info) { $info['icon'] = 'icon_core_block_menu.png'; $info['category'] = t('Menus'); @@ -360,7 +298,7 @@ function forum_ctools_block_info($module, $delta, &$info) { break; default: - // safety net + // Safety net. ctools_default_block_info($module, $delta, $info); } } @@ -455,7 +393,7 @@ function user_ctools_block_info($module, $delta, &$info) { break; default: - // safety net + // Safety net. ctools_default_block_info($module, $delta, $info); } } @@ -508,7 +446,7 @@ function ctools_user_login_pane_render($subtype, $conf, $panel_args, $contexts) return; } - $info = new stdClass; + $info = new stdClass(); $info->module = $module; $info->delta = $delta; @@ -537,7 +475,7 @@ function ctools_user_login_pane_render($subtype, $conf, $panel_args, $contexts) if ($module == 'block') { $block->title = $info->title; } - else if (isset($block->subject)) { + elseif (isset($block->subject)) { $block->title = $block->subject; } else { diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_created.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_created.inc index 62944e71..b3f454a6 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_created.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_created.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Comment created date'), @@ -28,7 +30,7 @@ function ctools_comment_created_content_type_render($subtype, $conf, $panel_args $comment = $context->data; // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'comment_created'; $block->title = t('Created date'); $block->content = format_date($comment->created, $conf['format']); diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_links.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_links.inc index fcca9703..ed454f94 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_links.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_links.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Comment links'), @@ -29,7 +31,7 @@ function ctools_comment_links_content_type_render($subtype, $conf, $panel_args, $comment = isset($context->data) ? clone $context->data : NULL; $block = new stdClass(); $block->module = 'comment'; - $block->delta = $comment->cid; + $block->delta = $comment->cid; if (empty($comment)) { $block->delta = 'placeholder'; diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_reply_form.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_reply_form.inc index bccba9a2..a18ece9a 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_reply_form.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/comment/comment_reply_form.inc @@ -2,7 +2,7 @@ /** * @file - * Ctools content-type plugin to provide a comment-reply form (replying either + * CTools content-type plugin to provide a comment-reply form (replying either * to a node or to another comment). */ @@ -14,12 +14,12 @@ if (module_exists('comment')) { 'icon' => 'icon_comment.png', 'description' => t('A form to add a new comment reply.'), 'required context' => array( - new ctools_context_required(t('Node'), 'node'), - new ctools_context_optional(t('Comment'), 'comment'), - ), + new ctools_context_required(t('Node'), 'node'), + new ctools_context_optional(t('Comment'), 'comment'), + ), 'category' => t('Comment'), 'render callback' => 'ctools_comment_reply_form_content_type_render', - 'defaults' => array('anon_links' => false), + 'defaults' => array('anon_links' => FALSE), ); } @@ -28,7 +28,9 @@ function ctools_comment_reply_form_content_type_render($subtype, $conf, $panel_a $comment = ($context[1]->identifier == t('No context')) ? NULL : clone $context[1]->data; $block = new stdClass(); $block->module = 'comments'; - if ($comment) $block->delta = $comment->cid; + if ($comment) { + $block->delta = $comment->cid; + } $block->title = t('Add comment'); $node = $context[0]->data; diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/contact.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/contact.inc index 63283f59..bac30c47 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/contact.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/contact.inc @@ -1,5 +1,9 @@ module = 'contact'; - $block->delta = 'form'; - $block->title = t('Contact'); + $block = new stdClass(); + $block->module = 'contact'; + $block->delta = 'form'; + $block->title = t('Contact'); module_load_include('inc', 'contact', 'contact.pages'); $block->content = drupal_get_form('contact_site_form'); @@ -45,11 +49,6 @@ function ctools_contact_content_type_edit_form($form, &$form_state) { */ function ctools_contact_content_type_edit_form_submit($form, &$form_state) { // Copy everything from our defaults. -/* - foreach (array_keys($form_state['plugin']['defaults']) as $key) { - $form_state['conf'][$key] = $form_state['values'][$key]; - } -*/ } /** diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/user_contact.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/user_contact.inc index 9b3726ab..5bd36572 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/user_contact.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/contact/user_contact.inc @@ -1,5 +1,9 @@ module = 'contact'; - $block->delta = 'form'; - $block->title = t('Contact @name', array('@name' => $context->data->name)); + $block = new stdClass(); + $block->module = 'contact'; + $block->delta = 'form'; + $block->title = t('Contact @name', array('@name' => $context->data->name)); module_load_include('inc', 'contact', 'contact.pages'); $block->content = drupal_get_form('contact_personal_form', $context->data); @@ -51,11 +55,6 @@ function ctools_user_contact_content_type_edit_form($form, &$form_state) { */ function ctools_user_contact_content_type_edit_form_submit(&$form, &$form_state) { // Copy everything from our defaults. -/* - foreach (array_keys($form_state['plugin']['defaults']) as $key) { - $form_state['conf'][$key] = $form_state['values'][$key]; - } -*/ } /** diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/custom/custom.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/custom/custom.inc index d9ac79f5..84fe3c55 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/custom/custom.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/custom/custom.inc @@ -178,12 +178,11 @@ function ctools_custom_content_type_render($subtype, $conf, $args, $contexts) { static $delta = 0; - $block = new stdClass(); - $block->subtype = ++$delta; - $block->title = filter_xss_admin($settings['title']); + $block = new stdClass(); + $block->subtype = ++$delta; + $block->title = filter_xss_admin($settings['title']); $block->title_heading = isset($settings['title_heading']) ? $settings['title_heading'] : 'h2'; - // Add keyword substitutions if we were configured to do so. $content = $settings['body']; if (!empty($contexts) && !empty($settings['substitute'])) { @@ -270,7 +269,8 @@ function ctools_custom_content_type_edit_form($form, &$form_state) { $form_state['settings'] = $settings; if ($settings['custom_type'] == 'fixed') { - return $form; // no form for this case. + // No form for this case. + return $form; } $form['admin_title'] = array( @@ -320,7 +320,7 @@ function ctools_custom_content_type_edit_form($form, &$form_state) { ); if (!empty($form_state['contexts'])) { - // Set extended description if both CCK and Token modules are enabled, notifying of unlisted keywords + // Set extended description if both CCK and Token modules are enabled, notifying of unlisted keywords. if (module_exists('content') && module_exists('token')) { $description = t('If checked, context keywords will be substituted in this content. Note that CCK fields may be used as keywords using patterns like %node:field_name-formatted.'); } @@ -417,7 +417,7 @@ function ctools_custom_content_type_edit_form_validate(&$form, &$form_state) { form_error($form['name'], t('Name is required.')); } - // Check for string identifier sanity + // Check for string identifier sanity. if (!preg_match('!^[a-z0-9_]+$!', $form_state['values']['name'])) { form_error($form['name'], t('The name can only consist of lowercase letters, underscores, and numbers.')); return; @@ -427,7 +427,7 @@ function ctools_custom_content_type_edit_form_validate(&$form, &$form_state) { return; } - // Check for name collision + // Check for name collision. if ($form_state['values']['name'] == 'custom' || (ctools_export_crud_load('ctools_custom_content', $form_state['values']['name']))) { form_error($form['name'], t('Content with this name already exists. Please choose another name or delete the existing item before creating a new one.')); } @@ -447,7 +447,7 @@ function ctools_custom_content_type_edit_form_submit($form, &$form_state) { } // If the 'reusable' checkbox was checked, we will create a new // custom content and give it the proper values. - else if (!empty($form_state['values']['reusable'])) { + elseif (!empty($form_state['values']['reusable'])) { $content = ctools_export_crud_new('ctools_custom_content'); $content->name = $form_state['values']['name']; _ctools_custom_content_type_edit_save($content, $form_state); @@ -455,7 +455,6 @@ function ctools_custom_content_type_edit_form_submit($form, &$form_state) { } else { // Otherwise, just save values into $conf normally. - foreach (array_keys($form_state['plugin']['defaults']) as $key) { $form_state['conf'][$key] = isset($form_state['values'][$key]) ? $form_state['values'][$key] : $form_state['plugin']['defaults'][$key]; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field.inc index a70a8d9e..80d24ef1 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field.inc @@ -96,8 +96,8 @@ function ctools_entity_field_content_type_content_types() { } /** -* Render the custom content type. -*/ + * Render the custom content type. + */ function ctools_entity_field_content_type_render($subtype, $conf, $panel_args, $context) { if (empty($context) || empty($context->data)) { return; @@ -157,13 +157,17 @@ function ctools_entity_field_content_type_render($subtype, $conf, $panel_args, $ $field_output = field_view_field($entity_type, $clone, $field_name, $field_settings, $language); - if (!empty($field_output) && !empty($conf['override_title'])) { - $field_output['#title'] = filter_xss_admin($conf['override_title_text']); + if (!empty($field_output)) { + if (!empty($conf['override_title'])) { + $field_output['#title'] = filter_xss_admin($conf['override_title_text']); + } + $field_output['#ctools_context'] = $context; + $field_output['#post_render'][] = 'ctools_entity_field_content_type_substitute_keywords'; } // Build the content type block. $block = new stdClass(); - $block->module = 'entity_field'; + $block->module = 'entity_field'; if ($conf['label'] == 'title' && isset($field_output['#title'])) { $block->title = $field_output['#title']; } @@ -175,8 +179,15 @@ function ctools_entity_field_content_type_render($subtype, $conf, $panel_args, $ } /** -* Returns an edit form for custom type settings. -*/ + * Replace context keywords. + */ +function ctools_entity_field_content_type_substitute_keywords($markup, array $element) { + return ctools_context_keyword_substitute($markup, array(), array($element['#ctools_context'])); +} + +/** + * Returns an edit form for custom type settings. + */ function ctools_entity_field_content_type_formatter_options($form, &$form_state) { if (empty($form_state['conf']['formatter_settings'])) { $form_state['conf']['formatter_settings'] = array(); @@ -230,6 +241,11 @@ function ctools_entity_field_content_type_formatter_styles($form, &$form_state) ctools_form_include($form_state, 'field_ui.admin', 'field_ui', ''); ctools_form_include($form_state, 'fields'); + $form['ctools_keywords'] = array( + '#type' => 'item', + '#description' => t('You may use keywords for substitutions.'), + ); + $form['ctools_field_list'] = array( '#type' => 'value', '#value' => array(), diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field_extra.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field_extra.inc index 6a59ed4c..efc7f4ff 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field_extra.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/entity_context/entity_field_extra.inc @@ -1,5 +1,9 @@ t('Entity extra field'), 'defaults' => array('view_mode' => NULL), @@ -119,7 +123,7 @@ function ctools_entity_field_extra_content_type_render($subtype, $conf, $panel_a if (isset($entity->content[$field_name])) { // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'entity_field_extra'; $block->content = $entity->content[$field_name]; $block->delta = $id; diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/entity_form_field.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/entity_form_field.inc index 582bd785..b4d83381 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/entity_form_field.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/entity_form_field.inc @@ -38,10 +38,13 @@ function ctools_entity_form_field_content_type_content_types() { $types = array(); $content_types = array(); $entities = entity_get_info(); - + $field_instances = field_info_instances(); foreach ($entities as $entity_type => $entity) { foreach ($entity['bundles'] as $type => $bundle) { - foreach (field_info_instances($entity_type, $type) as $field_name => $field) { + if (!isset($field_instances[$entity_type][$type])) { + continue; + } + foreach ($field_instances[$entity_type][$type] as $field_name => $field) { if (!isset($types[$entity_type . ':' . $field_name])) { $types[$entity_type . ':' . $field_name] = array( 'category' => t('Form'), @@ -72,7 +75,7 @@ function ctools_entity_form_field_content_type_content_types() { } $content_types[$entity_type . ':' . $group_name]['types'][$type] = $bundle['label']; } - } + } } } } @@ -90,8 +93,8 @@ function ctools_entity_form_field_content_type_content_types() { } /** -* Render the custom content type. -*/ + * Render the custom content type. + */ function ctools_entity_form_field_content_type_render($subtype, $conf, $panel_args, $context) { if (empty($context) || empty($context->data)) { return; @@ -146,8 +149,8 @@ function ctools_entity_form_field_content_type_render($subtype, $conf, $panel_ar } /** -* Returns the administrative title for a type. -*/ + * Returns the administrative title for a type. + */ function ctools_entity_form_field_content_type_admin_title($subtype, $conf, $context) { list($entity_type, $field_name) = explode(':', $subtype, 2); @@ -162,6 +165,6 @@ function ctools_entity_form_field_content_type_admin_title($subtype, $conf, $con } function ctools_entity_form_field_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/form.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/form.inc index 73f7c780..ef8cc65a 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/form.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/form/form.inc @@ -1,11 +1,13 @@ TRUE, 'render last' => TRUE, 'title' => t('General form'), @@ -43,7 +45,7 @@ function ctools_form_content_type_render($subtype, $conf, $panel_args, &$context $block->delta = $context->form_id; } else { - $block->title = t('Form'); + $block->title = t('Form'); $block->content = t('Form goes here.'); $block->delta = 'unknown'; } @@ -56,7 +58,7 @@ function ctools_form_content_type_admin_title($subtype, $conf, $context) { } function ctools_form_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to override title + // Provide a blank form so we have a place to override title // and stuff. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node/node.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node/node.inc index c49a71a6..a1141201 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node/node.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node/node.inc @@ -46,10 +46,10 @@ function ctools_node_content_type_render($subtype, $conf, $panel_args) { } } - // Support node translation + // Support node translation. if (module_exists('translation')) { if ($translations = module_invoke('translation', 'node_get_translations', $nid)) { - if (isset($translations[$GLOBALS['language']->language])) { + if (isset($translations[$GLOBALS['language']->language])) { $nid = $translations[$GLOBALS['language']->language]->nid; } } @@ -121,7 +121,6 @@ function ctools_node_content_type_edit_form($form, &$form_state) { '#description' => t('Check this box if you would like your pane title to link to the node.'), ); - if ($form_state['op'] == 'add') { $form['nid'] = array( '#prefix' => '
    ', @@ -179,7 +178,7 @@ function ctools_node_content_type_edit_form($form, &$form_state) { /** * Validate the node selection. */ -function ctools_node_content_type_edit_form_validate(&$form, &$form_state) { +function ctools_node_content_type_edit_form_validate(&$form, &$form_state) { if ($form_state['op'] != 'add') { return; } @@ -205,7 +204,7 @@ function ctools_node_content_type_edit_form_validate(&$form, &$form_state) { } if (!($node || preg_match('/^[@%]\d+$/', $nid)) || - // Do not allow unpublished nodes to be selected by unprivileged users + // Do not allow unpublished nodes to be selected by unprivileged users. (empty($node->status) && !user_access('administer nodes'))) { form_error($form['nid'], t('Invalid node')); } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_attachments.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_attachments.inc index 7142584a..2878e16d 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_attachments.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_attachments.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Attached files'), @@ -38,7 +40,6 @@ function ctools_node_attachments_content_type_admin_title($subtype, $conf, $cont } function ctools_node_attachments_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_author.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_author.inc index e98ce5ac..04b387d6 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_author.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_author.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Node author'), @@ -29,7 +31,7 @@ function ctools_node_author_content_type_render($subtype, $conf, $panel_args, $c $user = user_load($node->uid); // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'node_author'; $block->title = t('Author'); $block->content = !empty($conf['link']) ? theme('username', array('account' => $user, 'link_path' => 'user/' . $node->uid)) : check_plain(format_username($node)); diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_body.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_body.inc index 3e69560a..032bc8e1 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_body.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_body.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Node body'), @@ -28,7 +30,7 @@ function ctools_node_body_content_type_render($subtype, $conf, $panel_args, $con * Returns an edit form for custom type settings. */ function ctools_node_body_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_book_children.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_book_children.inc index a44ae2ba..21f65428 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_book_children.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_book_children.inc @@ -1,5 +1,9 @@ TRUE, 'title' => t('Book navigation menu'), - 'icon' => '../block/icon_core_block_menu.png', + 'icon' => drupal_get_path('module', 'ctools') . '/plugins/content_types/block/icon_core_block_menu.png', 'description' => t('The book menu belonging to the current book node.'), 'required context' => new ctools_context_required(t('Node'), 'node'), 'category' => t('Node'), @@ -16,7 +20,7 @@ if (module_exists('book')) { } function ctools_node_book_menu_content_type_render($subtype, $conf, $panel_args, $context) { - $node = isset($context->data) ? clone($context->data) : NULL; + $node = isset($context->data) ? clone $context->data : NULL; $block = new stdClass(); $block->module = 'book_menu'; @@ -61,16 +65,16 @@ function ctools_node_book_menu_content_type_render($subtype, $conf, $panel_args, elseif ($current_bid) { // Only display this block when the user is browsing a book. $select = db_select('node', 'n') - ->fields('n', array('title')) - ->condition('n.nid', $node->book['bid']) - ->addTag('node_access'); + ->fields('n', array('title')) + ->condition('n.nid', $node->book['bid']) + ->addTag('node_access'); $title = $select->execute()->fetchField(); // Only show the block if the user has view access for the top-level node. if ($title) { $tree = menu_tree_all_data($node->book['menu_name'], $node->book); // There should only be one element at the top level. $data = array_shift($tree); - // TODO: subject is not rendered + // TODO: subject is not rendered. $block->subject = theme('book_title_link', array('link' => $data['link'])); $block->content = ($data['below']) ? menu_tree_output($data['below']) : ''; } @@ -92,7 +96,7 @@ function ctools_node_book_menu_content_type_edit_form($form, &$form_state) { // Grab block form from the book module. $block_form = book_block_configure($delta = ''); // TODO: this does not work yet. - // See TODO in: ctools_node_book_menu_content_type_render + // See TODO in: ctools_node_book_menu_content_type_render. if (isset($form_state['input']['book_block_mode'])) { $block_form['book_block_mode']['#default_value'] = $form_state['input']['book_block_mode']; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_book_nav.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_book_nav.inc index f0529b43..d7a284b6 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_book_nav.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_book_nav.inc @@ -1,5 +1,9 @@ TRUE, 'title' => t('Book navigation pager'), - 'icon' => '../block/icon_core_booknavigation.png', + 'icon' => drupal_get_path('module', 'ctools') . '/plugins/content_types/block/icon_core_booknavigation.png', 'description' => t('The navigational pager and sub pages of the current book node.'), 'required context' => new ctools_context_required(t('Node'), 'node'), 'category' => t('Node'), @@ -38,6 +42,6 @@ function ctools_node_book_nav_content_type_admin_title($subtype, $conf, $context } function ctools_node_book_nav_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_comment_form.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_comment_form.inc index 5558a64b..ff34e4b5 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_comment_form.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_comment_form.inc @@ -1,5 +1,9 @@ data) ? clone $context->data : NULL; + if (empty($context->data->nid)) { + return; + } + $node = clone $context->data; $block = new stdClass(); $block->module = 'comments'; - $block->delta = $node->nid; - + $block->delta = $node->nid; $block->title = t('Add comment'); - if (empty($node)) { - $block->content = t('Comment form here.'); - } - else if ($node->comment == COMMENT_NODE_OPEN) { + if ($node->comment == COMMENT_NODE_OPEN) { if (user_access('post comments')) { $comment = new stdClass(); $comment->nid = $node->nid; @@ -43,7 +46,7 @@ function ctools_node_comment_form_content_type_render($subtype, $conf, $panel_ar ); $block->content = drupal_build_form('comment_node_' . $node->type . '_form', $form_state); } - else if (!empty($conf['anon_links'])) { + elseif (!empty($conf['anon_links'])) { $block->content = theme('comment_post_forbidden', array('node' => $node)); } } @@ -76,4 +79,3 @@ function ctools_node_comment_form_content_type_edit_form_submit($form, &$form_st $form_state['conf'][$key] = $form_state['values'][$key]; } } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_comment_wrapper.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_comment_wrapper.inc index 657a9e75..4bdb3fc4 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_comment_wrapper.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_comment_wrapper.inc @@ -1,5 +1,9 @@ data) ? clone $context->data : NULL; $block = new stdClass(); $block->module = 'comments'; - $block->delta = $node->nid; + $block->delta = $node->nid; $renderable = array( '#theme' => 'comment_wrapper__node_' . $node->type, @@ -65,7 +69,7 @@ function ctools_node_comment_wrapper_content_type_render($subtype, $conf, $panel ); $renderable['comment_form'] = drupal_build_form('comment_node_' . $node->type . '_form', $form_state); } - else if (!empty($conf['anon_links'])) { + elseif (!empty($conf['anon_links'])) { $renderable['comment_form'] = theme('comment_post_forbidden', array('node' => $node)); } } @@ -90,7 +94,8 @@ function ctools_node_comment_wrapper_content_type_edit_form($form, &$form_state) foreach (_comment_per_page() as $i) { $options[$i] = t('!a comments per page', array('!a' => $i)); } - $form['comments_per_page'] = array('#type' => 'select', + $form['comments_per_page'] = array( + '#type' => 'select', '#title' => t('Pager'), '#default_value' => $conf['comments_per_page'], '#options' => $options, diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_comments.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_comments.inc index 8c17dc00..7453e796 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_comments.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_comments.inc @@ -1,5 +1,9 @@ data) ? clone $context->data : NULL; + if (empty($context->data->nid)) { + return; + } + $node = clone $context->data; $block = new stdClass(); $block->module = 'comments'; - $block->delta = $node->nid; - + $block->delta = $node->nid; $block->title = t('Comments'); - if (empty($node)) { - $block->content = t('Node comments go here.'); - } - else if ($node->comment) { + + if ($node->comment) { $block->content = ctools_comment_render($node, $conf); - // Update the history table, stating that this user viewed this node. - node_tag_new($node); } return $block; @@ -50,7 +52,8 @@ function ctools_node_comments_content_type_edit_form($form, &$form_state) { foreach (_comment_per_page() as $i) { $options[$i] = t('!a comments per page', array('!a' => $i)); } - $form['comments_per_page'] = array('#type' => 'select', + $form['comments_per_page'] = array( + '#type' => 'select', '#title' => t('Pager'), '#default_value' => $conf['comments_per_page'], '#options' => $options, diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_content.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_content.inc index 03bedc66..ba873ed7 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_content.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_content.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Node content'), @@ -27,18 +29,18 @@ $plugin = array( * Render the node content. */ function ctools_node_content_content_type_render($subtype, $conf, $panel_args, $context) { - if (!empty($context) && empty($context->data)) { + if (!empty($context) && (empty($context->data) || empty($context->data->nid))) { return; } $node = isset($context->data) ? clone $context->data : NULL; $block = new stdClass(); $block->module = 'node'; - $block->delta = $node->nid; + $block->delta = $node->nid; if (empty($node)) { $block->delta = 'placeholder'; - $block->title = t('Node title.'); + $block->title = t('Node title.'); $block->content = t('Node content goes here.'); } else { @@ -86,7 +88,7 @@ function ctools_node_content_render_node($node, $conf) { $links['node-readmore'] = array( 'title' => t('Read more'), 'href' => 'node/' . $node->nid, - 'attributes' => array('rel' => 'tag', 'title' => strip_tags($node->title)) + 'attributes' => array('rel' => 'tag', 'title' => strip_tags($node->title)), ); } @@ -201,4 +203,3 @@ function ctools_node_content_content_type_edit_form_submit($form, &$form_state) function ctools_node_content_content_type_admin_title($subtype, $conf, $context) { return t('"@s" content', array('@s' => $context->identifier)); } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_created.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_created.inc index 06d14427..da3fbf8b 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_created.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_created.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Node created date'), @@ -20,7 +22,7 @@ $plugin = array( * Render the custom content type. */ function ctools_node_created_content_type_render($subtype, $conf, $panel_args, $context) { - if (empty($context) || empty($context->data)) { + if (!empty($context) && (empty($context->data) || empty($context->data->nid))) { return; } @@ -28,7 +30,7 @@ function ctools_node_created_content_type_render($subtype, $conf, $panel_args, $ $node = $context->data; // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'node_created'; $block->title = t('Created date'); $block->content = format_date($node->created, $conf['format']); diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_links.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_links.inc index 96d7a5a9..384fb639 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_links.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_links.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Node links'), @@ -32,7 +34,7 @@ function ctools_node_links_content_type_render($subtype, $conf, $panel_args, $co $node = isset($context->data) ? clone $context->data : NULL; $block = new stdClass(); $block->module = 'node'; - $block->delta = $node->nid; + $block->delta = $node->nid; if (empty($node)) { $block->delta = 'placeholder'; @@ -102,4 +104,3 @@ function ctools_node_links_content_type_edit_form_submit($form, &$form_state) { function ctools_node_links_content_type_admin_title($subtype, $conf, $context) { return t('"@s" links', array('@s' => $context->identifier)); } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_terms.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_terms.inc index f6e7aec3..e910e4c7 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_terms.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_terms.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Node terms'), @@ -30,7 +32,7 @@ function ctools_node_terms_content_type_render($subtype, $conf, $panel_args, $co // Get a shortcut to the node. $node = $context->data; - // Load all terms for this node from all vocabularies + // Load all terms for this node from all vocabularies. $query = db_select('taxonomy_index', 't'); $result = $query ->fields('t') @@ -38,22 +40,22 @@ function ctools_node_terms_content_type_render($subtype, $conf, $panel_args, $co ->execute(); $tids = array(); - foreach ($result AS $term) { + foreach ($result as $term) { $tids[] = $term->tid; } - // Get the real term objects + // Get the real term objects. $term_objects = taxonomy_term_load_multiple($tids); $terms = array(); if (empty($conf['vid'])) { // All terms. - foreach ($term_objects AS $term) { + foreach ($term_objects as $term) { $terms['taxonomy_term_' . $term->tid] = array( 'title' => check_plain($term->name), 'href' => 'taxonomy/term/' . $term->tid, - 'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)) + 'attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)), ); } } @@ -106,7 +108,7 @@ function ctools_node_terms_content_type_render($subtype, $conf, $panel_args, $co } // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'node_terms'; $block->delta = $node->nid; $block->title = t('Terms'); diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_title.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_title.inc index bec89825..6956c2f2 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_title.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_title.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Node title'), @@ -23,7 +25,7 @@ $plugin = array( * Render the custom content type. */ function ctools_node_title_content_type_render($subtype, $conf, $panel_args, $context) { - if (empty($context) || empty($context->data)) { + if (!empty($context) && (empty($context->data) || empty($context->data->nid))) { return; } @@ -33,10 +35,10 @@ function ctools_node_title_content_type_render($subtype, $conf, $panel_args, $co // Load information about the node type. $type = node_type_get_type($node); - // Generate the title + // Generate the title. $content = !empty($conf['link']) ? l($node->title, 'node/' . $node->nid) : check_plain($node->title); - // Build any surrounding markup if so configured + // Build any surrounding markup if so configured. if (isset($conf['markup']) && $conf['markup'] != 'none') { $markup = '<' . $conf['markup']; if (!empty($conf['id'])) { @@ -50,7 +52,7 @@ function ctools_node_title_content_type_render($subtype, $conf, $panel_args, $co } // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'node_title'; $block->title = $type->title_label; $block->content = $content; diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_type_desc.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_type_desc.inc index b432c55a..0694c539 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_type_desc.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_type_desc.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Node type description'), @@ -23,13 +25,13 @@ function ctools_node_type_desc_content_type_render($subtype, $conf, $panel_args, $block->module = 'node_type'; if ($node) { - $type = node_type_get_type($node); - $block->title = $type->name; + $type = node_type_get_type($node); + $block->title = $type->name; $block->content = filter_xss_admin($type->description); $block->delta = $node->type; } else { - $block->title = t('Node type description'); + $block->title = t('Node type description'); $block->content = t('Node type description goes here.'); $block->delta = 'unknown'; } @@ -42,6 +44,6 @@ function ctools_node_type_desc_content_type_admin_title($subtype, $conf, $contex } function ctools_node_type_desc_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_updated.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_updated.inc index 60ac4b54..eb506691 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_updated.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_context/node_updated.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Node last updated date'), @@ -28,7 +30,7 @@ function ctools_node_updated_content_type_render($subtype, $conf, $panel_args, $ $node = $context->data; // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'node_updated'; $block->title = t('Last updated date'); $block->content = format_date(!empty($node->changed) ? $node->changed : $node->created, $conf['format']); diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_attachments.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_attachments.inc index 1e248f50..51c95a5e 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_attachments.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_attachments.inc @@ -1,5 +1,9 @@ module = t('node_form'); + $block->module = 'node_form'; $block->title = t('Attach files'); $block->delta = 'url-path-options'; @@ -46,6 +50,6 @@ function ctools_node_form_attachments_content_type_admin_title($subtype, $conf, } function ctools_node_form_attachments_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_author.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_author.inc index 350df40a..86f3d731 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_author.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_author.inc @@ -1,9 +1,11 @@ TRUE, 'icon' => 'icon_node_form.png', @@ -15,7 +17,7 @@ $plugin = array( function ctools_node_form_author_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->title = t('Authoring information'); $block->delta = 'author-options'; @@ -47,6 +49,6 @@ function ctools_node_form_author_content_type_admin_title($subtype, $conf, $cont } function ctools_node_form_author_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_book.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_book.inc index ad19590f..b7ad36bd 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_book.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_book.inc @@ -1,5 +1,9 @@ module = t('node_form'); + $block->module = 'node_form'; $block->title = t('Book outline'); $block->delta = 'book-outline'; @@ -45,6 +49,6 @@ function ctools_node_form_book_content_type_admin_title($subtype, $conf, $contex } function ctools_node_form_book_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_buttons.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_buttons.inc index b7ac9841..ed553a67 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_buttons.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_buttons.inc @@ -1,9 +1,11 @@ TRUE, 'icon' => 'icon_node_form.png', @@ -15,7 +17,7 @@ $plugin = array( function ctools_node_form_buttons_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->title = ''; $block->delta = 'buttons'; @@ -38,6 +40,6 @@ function ctools_node_form_buttons_content_type_admin_title($subtype, $conf, $con } function ctools_node_form_buttons_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_comment.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_comment.inc index d0f137ae..eaf5c954 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_comment.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_comment.inc @@ -1,5 +1,9 @@ module = t('node_form'); + $block->module = 'node_form'; $block->title = t('Comment options'); $block->delta = 'comment-options'; @@ -45,6 +49,6 @@ function ctools_node_form_comment_content_type_admin_title($subtype, $conf, $con } function ctools_node_form_comment_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_language.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_language.inc index 2043c1c5..dfef295f 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_language.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_language.inc @@ -1,9 +1,11 @@ TRUE, 'icon' => 'icon_node_form.png', @@ -15,7 +17,7 @@ $plugin = array( function ctools_node_form_language_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->delta = 'language-options'; @@ -36,6 +38,6 @@ function ctools_node_form_language_content_type_admin_title($subtype, $conf, $co } function ctools_node_form_language_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; -} \ No newline at end of file +} diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_log.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_log.inc index 334ff540..aac42a64 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_log.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_log.inc @@ -1,9 +1,11 @@ TRUE, 'icon' => 'icon_node_form.png', @@ -15,7 +17,7 @@ $plugin = array( function ctools_node_form_log_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->title = t('Revision information'); if (isset($context->form)) { @@ -42,6 +44,6 @@ function ctools_node_form_log_content_type_admin_title($subtype, $conf, $context } function ctools_node_form_log_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_menu.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_menu.inc index 906ade4d..9b4df434 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_menu.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_menu.inc @@ -1,5 +1,9 @@ module = t('node_form'); + $block->module = 'node_form'; $block->title = t('Menu options'); $block->delta = 'menu-options'; @@ -45,6 +49,6 @@ function ctools_node_form_menu_content_type_admin_title($subtype, $conf, $contex } function ctools_node_form_menu_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_path.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_path.inc index a1e3cba0..262851f0 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_path.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_path.inc @@ -1,5 +1,9 @@ module = t('node_form'); + $block->module = 'node_form'; $block->title = t('URL path options'); $block->delta = 'url-path-options'; @@ -46,6 +50,6 @@ function ctools_node_form_path_content_type_admin_title($subtype, $conf, $contex } function ctools_node_form_path_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_publishing.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_publishing.inc index e73cff21..53b584f9 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_publishing.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_publishing.inc @@ -23,7 +23,7 @@ function ctools_node_form_publishing_content_type_render($subtype, $conf, $panel $block = new stdClass(); $block->title = t('Publishing options'); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->delta = 'publishing-options'; if (isset($context->form)) { @@ -49,6 +49,6 @@ function ctools_node_form_publishing_content_type_admin_title($subtype, $conf, $ } function ctools_node_form_publishing_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_title.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_title.inc index f40d274d..14e79aba 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_title.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/node_form/node_form_title.inc @@ -1,9 +1,11 @@ TRUE, 'icon' => 'icon_node_form.png', @@ -15,7 +17,7 @@ $plugin = array( function ctools_node_form_title_content_type_render($subtype, $conf, $panel_args, &$context) { $block = new stdClass(); - $block->module = t('node_form'); + $block->module = 'node_form'; $block->delta = 'title-options'; @@ -36,6 +38,6 @@ function ctools_node_form_title_content_type_admin_title($subtype, $conf, $conte } function ctools_node_form_title_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_help.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_help.inc index da1abe69..dcba97d4 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_help.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_help.inc @@ -30,4 +30,3 @@ function ctools_page_help_content_type_render($subtype, $conf, $panel_args) { return $block; } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_logo.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_logo.inc index c00ca5e8..fa7cdaea 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_logo.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_logo.inc @@ -29,7 +29,7 @@ function ctools_page_logo_content_type_render($subtype, $conf, $panel_args) { $block = new stdClass(); if (!empty($logo)) { - $image = '' . t('Home') . ''; + $image = theme('image', array('path' => $logo, 'alt' => t('Home'))); $block->content = l($image, '', array('html' => TRUE, 'attributes' => array('rel' => 'home', 'id' => 'logo', 'title' => t('Home')))); } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_messages.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_messages.inc index e2fe37b3..9a8bc74b 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_messages.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_messages.inc @@ -30,4 +30,3 @@ function ctools_page_messages_content_type_render($subtype, $conf, $panel_args) return $block; } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_site_name.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_site_name.inc index 3053d451..cb834316 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_site_name.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_site_name.inc @@ -61,7 +61,7 @@ function ctools_page_site_name_content_type_render($subtype, $conf, $panel_args) // Optionally link the site name to the homepage. if (!empty($conf['linked'])) { - $block->content = l($block->content, ''); + $block->content = l($block->content, '', array('html' => TRUE)); } return $block; diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_tabs.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_tabs.inc index e88acd54..6a2e9a7d 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_tabs.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_tabs.inc @@ -40,6 +40,7 @@ function ctools_page_tabs_content_type_render($subtype, $conf, $panel_args) { case 'primary': unset($menus['#secondary']); break; + case 'secondary': unset($menus['#primary']); break; @@ -54,7 +55,6 @@ function ctools_page_tabs_content_type_render($subtype, $conf, $panel_args) { return $block; } - function ctools_page_tabs_content_type_edit_form($form, &$form_state) { $conf = $form_state['conf']; diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_title.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_title.inc index cc091ab2..c32ef7e1 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_title.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/page/page_title.inc @@ -29,7 +29,10 @@ $plugin = array( * Outputs the page title of the current page. */ function ctools_page_title_content_type_render($subtype, $conf, $panel_args) { - if (!drupal_get_title()) { + // $conf['override_title'] can have one of these three values. + // 0 i.e. hide the title, 1 i.e. no title, and 2 i.e. pane title if it's a + // panels page. + if (!drupal_get_title() && isset($conf['override_title']) && $conf['override_title'] === 1) { return; } // TODO: This should have a setting or something for the markup. diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/search/search_form.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/search/search_form.inc index 2b6a322b..01671007 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/search/search_form.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/search/search_form.inc @@ -1,5 +1,9 @@ module = 'search'; - $block->delta = 'form'; - $block->title = ''; + $block = new stdClass(); + $block->module = 'search'; + $block->delta = 'form'; + $block->title = ''; switch ($conf['path_type']) { default: @@ -49,6 +53,7 @@ function ctools_search_form_content_type_render($subtype, $conf, $panel_args, $c $path = $_GET['q']; $path = str_replace($keys, '', $path); break; + case 'custom': $path = $conf['path']; break; diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/search/search_result.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/search/search_result.inc index 32037bdf..fb88a0fe 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/search/search_result.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/search/search_result.inc @@ -1,5 +1,9 @@ data; } - $conditions = NULL; + $conditions = NULL; if (isset($info['conditions_callback']) && function_exists($info['conditions_callback'])) { // Build an optional array of more search conditions. $conditions = $info['conditions_callback']($keys); @@ -59,9 +63,9 @@ function ctools_search_result_content_type_render($subtype, $conf, $panel_args, } // Build the content type block. - $block = new stdClass(); - $block->module = 'search'; - $block->delta = 'result'; + $block = new stdClass(); + $block->module = 'search'; + $block->delta = 'result'; $results = ''; @@ -160,7 +164,6 @@ function ctools_search_result_content_type_edit_form($form, &$form_state) { '#title' => t('Display text if no search keywords were submitted'), ); - $form['no_key_title'] = array( '#title' => t('Title'), '#type' => 'textfield', diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/term_context/term_description.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/term_context/term_description.inc index b1a231c1..6367075b 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/term_context/term_description.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/term_context/term_description.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Term description'), @@ -46,6 +48,6 @@ function ctools_term_description_content_type_admin_title($subtype, $conf, $cont } function ctools_term_description_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/term_context/term_list.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/term_context/term_list.inc index b76ca1c9..a5330749 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/term_context/term_list.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/term_context/term_list.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('List of related terms'), @@ -40,7 +42,7 @@ function ctools_term_list_content_type_render($subtype, $conf, $panel_args, $con $block->delta = $conf['type']; switch ($conf['type']) { case 'related': - // FIXME this no longer exists, must be done with Field API + // @todo this no longer exists, must be done with Field API. // $terms = taxonomy_get_related($term->tid); break; @@ -78,7 +80,7 @@ function ctools_term_list_content_type_render($subtype, $conf, $panel_args, $con case 'synonyms': // FIXME this no longer exists, must be done with Field API -// $terms = taxonomy_get_synonyms($term->tid); + // $terms = taxonomy_get_synonyms($term->tid);. break; } @@ -169,4 +171,3 @@ function ctools_term_list_content_type_edit_form_submit($form, &$form_state) { $form_state['conf'][$key] = $form_state['values'][$key]; } } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/term_context/term_name.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/term_context/term_name.inc index a9a88764..ec30be4d 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/term_context/term_name.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/term_context/term_name.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('Term name'), @@ -19,7 +21,6 @@ $plugin = array( ), ); - /** * Render the custom content type. */ @@ -34,10 +35,10 @@ function ctools_term_name_content_type_render($subtype, $conf, $panel_args, $con // Load the vocabulary. $vocab = taxonomy_vocabulary_load($term->vid); - // Generate the title + // Generate the title. $content = !empty($conf['link']) ? l($term->name, 'taxonomy/term/' . $term->tid) : check_plain($term->name); - // Build any surrounding markup if so configured + // Build any surrounding markup if so configured. if (isset($conf['markup']) && $conf['markup'] != 'none') { $markup = '<' . $conf['markup']; if (!empty($conf['id'])) { @@ -51,7 +52,7 @@ function ctools_term_name_content_type_render($subtype, $conf, $panel_args, $con } // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'term_name'; $block->title = t('Name'); $block->content = $content; diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/token/token.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/token/token.inc index 7b6f7fcd..32026d85 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/token/token.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/token/token.inc @@ -62,8 +62,8 @@ function ctools_token_content_type_content_types() { } /** -* Render the custom content type. -*/ + * Render the custom content type. + */ function ctools_token_content_type_render($subtype, $conf, $panel_args, $context) { if (empty($context) || empty($context->data)) { return FALSE; @@ -81,7 +81,7 @@ function ctools_token_content_type_render($subtype, $conf, $panel_args, $context } // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'ctools'; $block->title = $info['tokens'][$entity_type][$name]['name']; $block->content = $values[$name]; @@ -91,8 +91,8 @@ function ctools_token_content_type_render($subtype, $conf, $panel_args, $context } /** -* Returns an edit form for custom type settings. -*/ + * Returns an edit form for custom type settings. + */ function ctools_token_content_type_edit_form($form, &$form_state) { $conf = $form_state['conf']; @@ -113,10 +113,9 @@ function ctools_token_content_type_edit_form_submit($form, &$form_state) { $form_state['conf']['sanitize'] = $form_state['values']['sanitize']; } - /** -* Returns the administrative title for a type. -*/ + * Returns the administrative title for a type. + */ function ctools_token_content_type_admin_title($subtype, $conf, $context) { return t('"@s" @name', array('@s' => $context->identifier, '@name' => $subtype)); } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/profile_fields.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/profile_fields.inc index 1132bb73..019715fb 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/profile_fields.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/profile_fields.inc @@ -1,5 +1,9 @@ module = 'profile fields'; if ($account) { - // Get the category from the options + // Get the category from the options. $category = str_replace("_", " ", $conf['category']); - // Set the subject to the name of the category + // Set the subject to the name of the category. $block->subject = $category; - // Put all the fields in the category into an array + // Put all the fields in the category into an array. profile_view_profile($account); if (is_array($account->content[$category])) { @@ -46,11 +50,11 @@ function ctools_profile_fields_content_type_render($subtype, $conf, $panel_args, } if (count($vars) == 0) { - // Output the given empty text + // Output the given empty text. $output = $conf['empty']; } else { - // Call the theme function with the field vars + // Call the theme function with the field vars. $output = theme('profile_fields_pane', $category, $vars); } @@ -65,6 +69,7 @@ function ctools_profile_fields_content_type_render($subtype, $conf, $panel_args, return $block; } + /** * Helper function : build the list of categories for the 'edit' form. */ diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/profile_fields_pane.tpl.php b/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/profile_fields_pane.tpl.php index 37368121..bac10ce9 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/profile_fields_pane.tpl.php +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/profile_fields_pane.tpl.php @@ -1,4 +1,5 @@ TRUE, 'title' => t('User links'), @@ -29,7 +31,7 @@ function ctools_user_links_content_type_render($subtype, $conf, $panel_args, $co $account = clone $context->data; $block = new stdClass(); $block->module = 'user'; - $block->delta = $account->uid; + $block->delta = $account->uid; if (empty($account)) { $block->delta = 'placeholder'; diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/user_picture.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/user_picture.inc index 0934c20a..2d4d31bf 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/user_picture.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/user_picture.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('User picture'), @@ -22,7 +24,7 @@ function ctools_user_picture_content_type_render($subtype, $conf, $panel_args, $ $account = clone $context->data; - // Check if user has permissions to access the user + // Check if user has permissions to access the user. if ($user->uid != $account->uid && (!user_access('access user profiles') && !user_access('administer users'))) { return; } @@ -36,19 +38,18 @@ function ctools_user_picture_content_type_render($subtype, $conf, $panel_args, $ '#account' => $account, ); - $block->content = $element; return $block; } /** - * Display the administrative title for a panel pane in the drag & drop UI + * Display the administrative title for a panel pane in the drag & drop UI. */ function ctools_user_picture_content_type_admin_title($subtype, $conf, $context) { return t('"@s" user picture', array('@s' => $context->identifier)); } function ctools_user_picture_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/user_profile.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/user_profile.inc index ad8e1e0a..3a28ca39 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/user_profile.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/user_profile.inc @@ -1,9 +1,11 @@ TRUE, 'title' => t('User profile'), @@ -84,4 +86,3 @@ function ctools_user_profile_content_type_edit_form($form, &$form_state) { function ctools_user_profile_content_type_edit_form_submit($form, &$form_state) { $form_state['conf']['view_mode'] = $form_state['values']['view_mode']; } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/user_signature.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/user_signature.inc index accb58e4..6a8e7f63 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/user_signature.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/user_context/user_signature.inc @@ -1,9 +1,11 @@ t('User signature'), 'icon' => 'icon_user.png', @@ -31,13 +33,13 @@ function ctools_user_signature_content_type_render($subtype, $conf, $panel_args, } /** - * Display the administrative title for a panel pane in the drag & drop UI + * Display the administrative title for a panel pane in the drag & drop UI. */ function ctools_user_signature_content_type_admin_title($subtype, $conf, $context) { return t('"@s" user signature', array('@s' => $context->identifier)); } function ctools_user_signature_content_type_edit_form($form, &$form_state) { - // provide a blank form so we have a place to have context setting. + // Provide a blank form so we have a place to have context setting. return $form; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/content_types/vocabulary_context/vocabulary_terms.inc b/sites/all/modules/contrib/dev/ctools/plugins/content_types/vocabulary_context/vocabulary_terms.inc index 171eddd8..6a7f8ef8 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/content_types/vocabulary_context/vocabulary_terms.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/content_types/vocabulary_context/vocabulary_terms.inc @@ -1,5 +1,9 @@ data) ? clone $context->data : NULL; - $max_depth = (!empty($conf['max_depth']) ? (int)$conf['max_depth'] : NULL); + $max_depth = (!empty($conf['max_depth']) ? (int) $conf['max_depth'] : NULL); if ($conf['tree'] == FALSE) { $terms = taxonomy_get_tree($vocab->vid, 0, $max_depth); $items = array(); @@ -35,9 +39,9 @@ function ctools_vocabulary_terms_content_type_render($subtype, $conf, $panel_arg $output = theme('item_list', array('items' => _ctools_content_vocabulary_terms($vocab->vid, $max_depth))); } - $block = new stdClass(); + $block = new stdClass(); $block->module = 'node_type'; - $block->title = check_plain($vocab->name); + $block->title = check_plain($vocab->name); $block->content = $output; $block->delta = $vocab->vid; @@ -97,4 +101,3 @@ function ctools_vocabulary_terms_content_type_edit_form_submit($form, &$form_sta $form_state['conf'][$key] = $form_state['values'][$key]; } } - diff --git a/sites/all/modules/contrib/dev/ctools/plugins/contexts/entity.inc b/sites/all/modules/contrib/dev/ctools/plugins/contexts/entity.inc index b214aa06..7a2b0241 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/contexts/entity.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/contexts/entity.inc @@ -2,7 +2,6 @@ /** * @file - * * Plugin to provide a node context. A node context is a node wrapped in a * context object that can be utilized by anything that accepts contexts. */ @@ -23,6 +22,8 @@ $plugin = array( '#type' => 'textfield', '#description' => t('Enter the ID of an entity for this context.'), ), + // Tell ctools_context_get_context_from_context() how to interpret its $argument. + 'placeholder name' => 'entity_id', 'get child' => 'ctools_context_entity_get_child', 'get children' => 'ctools_context_entity_get_children', ); @@ -88,9 +89,9 @@ function ctools_context_create_entity($empty, $data = NULL, $conf = FALSE, $plug } if (!empty($data)) { - $context->data = $data; + $context->data = $data; if (!empty($entity['entity keys']['label'])) { - $context->title = $data->{$entity['entity keys']['label']}; + $context->title = $data->{$entity['entity keys']['label']}; } $context->argument = $id; @@ -159,7 +160,7 @@ function ctools_context_entity_settings_form($form, &$form_state) { * Validate a node. */ function ctools_context_entity_settings_form_validate($form, &$form_state) { - // Validate the autocomplete + // Validate the autocomplete. if (empty($form_state['values']['entity_id']) && empty($form_state['values']['entity'])) { form_error($form['entity'], t('You must select an entity.')); return; @@ -169,7 +170,7 @@ function ctools_context_entity_settings_form_validate($form, &$form_state) { return; } - $id = $form_state['values']['entity']; + $id = $form_state['values']['entity']; $preg_matches = array(); $match = preg_match('/\[id: (\d+)\]/', $id, $preg_matches); if (!$match) { diff --git a/sites/all/modules/contrib/dev/ctools/plugins/contexts/language.inc b/sites/all/modules/contrib/dev/ctools/plugins/contexts/language.inc new file mode 100644 index 00000000..e66f02a1 --- /dev/null +++ b/sites/all/modules/contrib/dev/ctools/plugins/contexts/language.inc @@ -0,0 +1,169 @@ + t('Language'), + 'description' => t('Language object.'), + 'context' => 'ctools_context_language_create', + 'context name' => 'language', + 'keyword' => 'language', + + // Provides a list of items which are exposed as keywords. + 'convert list' => 'ctools_language_context_convert_list', + // Convert keywords into data. + 'convert' => 'ctools_language_context_convert', + + 'placeholder form' => array( + '#type' => 'textfield', + '#description' => t('Enter a valid langcode.'), + '#value' => $GLOBALS['language']->language, + ), + + // Provide settings for the context. + 'edit form' => 'ctools_context_language_settings_form', + 'settings' => ctools_context_language_conf_defaults(), +); + +/** + * Ensures a full populated settings array with sane defaults. + * + * @param mixed $conf + * Array with the user defined settings, or a string identifying a language. + * + * @return array + * Array with all available settings. + */ +function ctools_context_language_conf_defaults($conf = array()) { + if (!is_array($conf)) { + $conf = array( + 'preset_langcode' => (string) $conf, + ); + } + + return $conf + array( + 'enable_cache_argument' => TRUE, + 'language_type' => 'language', + 'preset_langcode' => $GLOBALS['language']->language, + ); +} + +/** + * Create a context, either from manual configuration or the current language. + */ +function ctools_context_language_create($empty, $data = NULL, $conf = FALSE) { + $context = new ctools_context('language'); + $context->plugin = 'language'; + if ($empty) { + return $context; + } + $context->title = t('Language'); + + $settings = ctools_context_language_conf_defaults($data); + if ($settings['language_type'] != 'preset') { + $language_object = $GLOBALS[$settings['language_type']]; + } + else { + // Fetch the enabled language objects. + $languages = language_list('enabled'); + $languages = $languages[1]; + + // Set the custom language, but fallback to the interface language. + $language_object = $GLOBALS['language']; + if (isset($languages[$settings['preset_langcode']])) { + $language_object = $languages[$settings['preset_langcode']]; + } + } + // If enabled set the argument ot use in the cid. + if ($settings['enable_cache_argument']) { + $context->argument = $language_object->language; + } + $context->data = $language_object; + return $context; +} + +/** + * Provide a list of sub-keywords. + * + * This is used to provide keywords from the context for use in a content type, + * pane, etc. + */ +function ctools_language_context_convert_list() { + $context = new stdClass(); + $context->data = $GLOBALS['language']; + return array( + 'language' => t('Langcode. E.g. !example', array('!example' => ctools_language_context_convert($context, 'language'))), + 'name' => t('Name. E.g. !example', array('!example' => ctools_language_context_convert($context, 'name'))), + 'native' => t('Native name of the language. E.g. !example', array('!example' => ctools_language_context_convert($context, 'native'))), + 'direction' => t('Text direction 0=LRT, 1=RTL. E.g. !example', array('!example' => ctools_language_context_convert($context, 'direction'))), + 'enabled' => t('Status. E.g. !example', array('!example' => ctools_language_context_convert($context, 'enabled'))), + 'plurals' => t('Number of plural forms. E.g. !example', array('!example' => ctools_language_context_convert($context, 'plurals'))), + 'formula' => t('Plural formula. E.g. !example', array('!example' => ctools_language_context_convert($context, 'formula'))), + 'domain' => t('Domain prefix. E.g. !example', array('!example' => ctools_language_context_convert($context, 'domain'))), + 'prefix' => t('Url prefix . E.g. !example', array('!example' => ctools_language_context_convert($context, 'prefix'))), + 'weight' => t('The weight. E.g. !example', array('!example' => ctools_language_context_convert($context, 'weight'))), + 'javascript' => t('Key of the javascript file with the translations. E.g. !example', array('!example' => ctools_language_context_convert($context, 'javascript'))), + 'provider' => t('Negotiation method that defined the language. E.g. !example', array('!example' => ctools_language_context_convert($context, 'provider'))), + ); +} + +/** + * Convert a context property into a string to be used as a keyword. + */ +function ctools_language_context_convert($context, $type) { + if (isset($context->data->$type)) { + return $context->data->$type; + } +} + +/** + * Settings form. + */ +function ctools_context_language_settings_form($form, &$form_state) { + $conf = ctools_context_language_conf_defaults($form_state['conf']); + + $form['enable_cache_argument'] = array( + '#title' => t('Add language to cache id'), + '#description' => t('If enabled the langcode will be part of context aware caches.'), + '#type' => 'checkbox', + '#default_value' => $conf['enable_cache_argument'], + ); + + // Prepare language type options. + $language_type_options = drupal_map_assoc(language_types()); + $language_type_options['preset'] = t('Custom'); + + $form['language_type'] = array( + '#title' => t('The language type to use'), + '#type' => 'radios', + '#required' => TRUE, + '#options' => $language_type_options, + '#default_value' => $conf['language_type'], + ); + + ctools_include('language'); + $language_options = ctools_language_list(); + $form['preset_langcode'] = array( + '#title' => t('Language'), + '#type' => 'select', + '#options' => $language_options, + '#default_value' => $conf['preset_langcode'], + '#states' => array( + 'visible' => array( + ':input[name="language_type"]' => array('value' => 'preset'), + ), + ), + ); + + if (!empty($conf['preset_langcode']) && !isset($language_options[$conf['preset_langcode']])) { + drupal_set_message(t('The currently selected language %langcode is no longer available.', array('%langcode' => $conf['preset_langcode'])), 'error', FALSE); + } + return $form; +} diff --git a/sites/all/modules/contrib/dev/ctools/plugins/contexts/node.inc b/sites/all/modules/contrib/dev/ctools/plugins/contexts/node.inc index 997cd136..156f7f83 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/contexts/node.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/contexts/node.inc @@ -2,7 +2,6 @@ /** * @file - * * Plugin to provide a node context. A node context is a node wrapped in a * context object that can be utilized by anything that accepts contexts. */ @@ -106,7 +105,7 @@ function ctools_context_node_settings_form($form, &$form_state) { * Validate a node. */ function ctools_context_node_settings_form_validate($form, &$form_state) { - // Validate the autocomplete + // Validate the autocomplete. if (empty($form_state['values']['nid']) && empty($form_state['values']['node'])) { form_error($form['node'], t('You must select a node.')); return; @@ -133,7 +132,7 @@ function ctools_context_node_settings_form_validate($form, &$form_state) { $node = db_query('SELECT nid, status FROM {node} WHERE LOWER(title) = LOWER(:title)', array(':title' => $nid))->fetchObject(); } - // Do not allow unpublished nodes to be selected by unprivileged users + // Do not allow unpublished nodes to be selected by unprivileged users. if (!$node || (empty($node->status) && !(user_access('administer nodes')))) { form_error($form['node'], t('Invalid node selected.')); } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/contexts/node_add_form.inc b/sites/all/modules/contrib/dev/ctools/plugins/contexts/node_add_form.inc index f10944c2..98640e25 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/contexts/node_add_form.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/contexts/node_add_form.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide a node_add_form context + * Plugin to provide a node_add_form context. */ /** @@ -65,8 +64,8 @@ function ctools_context_create_node_add_form($empty, $data = NULL, $conf = FALSE $form_state = array( 'want form' => TRUE, 'build_info' => array( - 'args' => array($node) - ) + 'args' => array($node), + ), ); // Use module_load_include so that caches and stuff can know to load this. @@ -81,10 +80,10 @@ function ctools_context_create_node_add_form($empty, $data = NULL, $conf = FALSE // These are specific pieces of data to this form. // All forms should place the form here. - $context->form = $form; - $context->form_id = $form_id; - $context->form_title = t('Submit @name', array('@name' => $types[$type]->name)); - $context->node_type = $type; + $context->form = $form; + $context->form_id = $form_id; + $context->form_title = t('Submit @name', array('@name' => $types[$type]->name)); + $context->node_type = $type; $context->restrictions['type'] = array($type); $context->restrictions['form'] = array('form'); diff --git a/sites/all/modules/contrib/dev/ctools/plugins/contexts/node_edit_form.inc b/sites/all/modules/contrib/dev/ctools/plugins/contexts/node_edit_form.inc index 7565f5c8..5401ef6f 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/contexts/node_edit_form.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/contexts/node_edit_form.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide a node_edit_form context + * Plugin to provide a node_edit_form context. */ /** @@ -32,7 +31,7 @@ $plugin = array( */ function ctools_context_create_node_edit_form($empty, $node = NULL, $conf = FALSE) { static $creating = FALSE; - $context = new ctools_context(array('form', 'node_edit', 'node_form', 'node_edit_form', 'node', 'entity:node')); + $context = new ctools_context(array('form', 'node_edit', 'node_form', 'node_edit_form', 'node', 'entity:node')); $context->plugin = 'node_edit_form'; if ($empty || ($creating)) { @@ -69,7 +68,7 @@ function ctools_context_create_node_edit_form($empty, $node = NULL, $conf = FALS $form = drupal_build_form($form_id, $form_state); - // Fill in the 'node' portion of the context + // Fill in the 'node' portion of the context. $context->data = $node; $context->title = isset($node->title) ? $node->title : ''; $context->argument = isset($node->nid) ? $node->nid : $node->type; @@ -126,7 +125,7 @@ function ctools_context_node_edit_form_settings_form($form, &$form_state) { * Validate a node. */ function ctools_context_node_edit_form_settings_form_validate($form, &$form_state) { - // Validate the autocomplete + // Validate the autocomplete. if (empty($form_state['values']['nid']) && empty($form_state['values']['node'])) { form_error($form['node'], t('You must select a node.')); return; @@ -153,7 +152,7 @@ function ctools_context_node_edit_form_settings_form_validate($form, &$form_stat $node = db_query('SELECT nid, status FROM {node} WHERE LOWER(title) = LOWER(:title)', array(':title' => $nid))->fetchObject(); } - // Do not allow unpublished nodes to be selected by unprivileged users + // Do not allow unpublished nodes to be selected by unprivileged users. if (!$node || (empty($node->status) && !(user_access('administer nodes')))) { form_error($form['node'], t('Invalid node selected.')); } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/contexts/query_string.inc b/sites/all/modules/contrib/dev/ctools/plugins/contexts/query_string.inc index e77c55fb..23ade918 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/contexts/query_string.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/contexts/query_string.inc @@ -1,7 +1,7 @@ t('Query string key'), '#description' => t('Enter the key of the value that must be returned from the query string.'), '#type' => 'textfield', - '#required' => TRUE + '#required' => TRUE, ); if (isset($form_state['conf']['key'])) { $form['key']['#default_value'] = $form_state['conf']['key']; @@ -83,6 +83,7 @@ function ctools_context_query_string_convert($context, $type) { switch ($type) { case 'raw': return $context->data; + case 'html_safe': return check_plain($context->data); } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/contexts/string.inc b/sites/all/modules/contrib/dev/ctools/plugins/contexts/string.inc index e731ab74..981b9f7c 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/contexts/string.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/contexts/string.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide a string context + * Plugin to provide a string context. */ /** @@ -38,7 +37,6 @@ $plugin = array( function ctools_context_create_string($empty, $data = NULL, $conf = FALSE) { // The input is expected to be an object as created by ctools_break_phrase // which contains a group of string. - $context = new ctools_context('string'); $context->plugin = 'string'; @@ -46,7 +44,7 @@ function ctools_context_create_string($empty, $data = NULL, $conf = FALSE) { return $context; } - if ($data !== FALSE ) { + if ($data !== FALSE) { // Support the array storage from the settings form but also handle direct input from arguments. $context->data = is_array($data) ? $data['string'] : $data; $context->title = ($conf) ? check_plain($data['identifier']) : check_plain($data); @@ -61,8 +59,10 @@ function ctools_context_string_convert($context, $type) { switch ($type) { case 'raw': return $context->data; + case 'html_safe': return check_plain($context->data); + case 'uppercase_words_html_safe': return ucwords(str_replace('-', ' ', check_plain($context->data))); } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/contexts/term.inc b/sites/all/modules/contrib/dev/ctools/plugins/contexts/term.inc index 1d6d48e6..56fe06c2 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/contexts/term.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/contexts/term.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide a term context + * Plugin to provide a term context. */ /** @@ -116,7 +115,7 @@ function ctools_context_term_settings_form($form, &$form_state) { * Validate a term. */ function ctools_context_term_settings_form_validate($form, &$form_state) { - // Validate the autocomplete + // Validate the autocomplete. $vid = $form_state['values']['vid']; if (empty($form_state['values']['tid']) && empty($form_state['values']['taxonomy'][$vid])) { form_error($form['taxonomy'][$vid], t('You must select a term.')); @@ -154,12 +153,16 @@ function ctools_context_term_convert($context, $type) { switch ($type) { case 'tid': return $context->data->tid; + case 'name': return $context->data->name; + case 'name_dashed': return drupal_strtolower(str_replace(' ', '-', $context->data->name)); + case 'vid': return $context->data->vid; + case 'description': return $context->data->description; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/contexts/terms.inc b/sites/all/modules/contrib/dev/ctools/plugins/contexts/terms.inc index 6c3ab361..1161ded6 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/contexts/terms.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/contexts/terms.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide a terms context + * Plugin to provide a terms context. */ /** @@ -37,7 +36,6 @@ $plugin = array( function ctools_context_create_terms($empty, $data = NULL, $conf = FALSE) { // The input is expected to be an object as created by ctools_break_phrase // which contains a group of terms. - $context = new ctools_context(array('terms', 'entity:taxonomy_term')); $context->plugin = 'terms'; @@ -49,7 +47,7 @@ function ctools_context_create_terms($empty, $data = NULL, $conf = FALSE) { $context->operator = $data->operator; $context->tids = $data->value; if (!isset($data->term)) { - // load the first term: + // Load the first term: reset($context->tids); $data->term = taxonomy_term_load(current($context->tids)); } @@ -67,12 +65,16 @@ function ctools_context_terms_convert($context, $type) { switch ($type) { case 'tid': return $context->data->tid; + case 'tids': return $context->argument; + case 'name': return $context->data->name; + case 'name_dashed': return drupal_strtolower(str_replace(' ', '-', $context->data->name)); + case 'names': case 'names_dashed': // We only run this query if this item was requested: @@ -92,6 +94,7 @@ function ctools_context_terms_convert($context, $type) { } } return $context->names; + case 'vid': return $context->data->vid; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/contexts/token.inc b/sites/all/modules/contrib/dev/ctools/plugins/contexts/token.inc index 04455769..6286a697 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/contexts/token.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/contexts/token.inc @@ -2,7 +2,7 @@ /** * @file - * Provide a global context to allow for token support. + * Provide a global context to allow for token support. */ $plugin = array( @@ -17,6 +17,16 @@ $plugin = array( /** * Create a context from manual configuration. + * + * @param $empty + * Unused. + * @param $data + * Unused. + * @param $conf + * Unused. + * + * @return ctools_context + * A context of type token, with the plugin set appropriately. */ function ctools_context_create_token($empty, $data = NULL, $conf = FALSE) { $context = new ctools_context('token'); @@ -27,9 +37,14 @@ function ctools_context_create_token($empty, $data = NULL, $conf = FALSE) { /** * Implementation of hook_ctools_context_convert_list(). + * + * @return array|null + * An array of token type information, keyed by 'type:id', or NULL if + * none found. */ function ctools_context_token_convert_list() { $tokens = token_info(); + // Initialise $list here? foreach ($tokens['types'] as $type => $type_info) { if (empty($type_info['needs-data'])) { $real_type = isset($type_info['type']) ? $type_info['type'] : $type; @@ -46,7 +61,17 @@ function ctools_context_token_convert_list() { } /** - * Implementation of hook_ctools_context_converter_alter(). + * Token conversion function: look up the token and return it's value. + * + * @param $context + * Unused. + * @param string $token + * The name of the token. + * + * @return array|null + * The token value, or NULL if not found. + * + * @see ctools_context_convert_context() */ function ctools_context_token_convert($context, $token) { $tokens = token_info(); @@ -59,4 +84,5 @@ function ctools_context_token_convert($context, $token) { return $values[$token]; } } + return NULL; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/contexts/user.inc b/sites/all/modules/contrib/dev/ctools/plugins/contexts/user.inc index 18781c76..bbdbd1a2 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/contexts/user.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/contexts/user.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide a user context + * Plugin to provide a user context. */ /** @@ -118,7 +117,7 @@ function ctools_context_user_settings_form_validate($form, &$form_state) { return; } - // Validate the autocomplete + // Validate the autocomplete. if (empty($form_state['values']['uid']) && empty($form_state['values']['user'])) { form_error($form['user'], t('You must select a user.')); return; @@ -153,6 +152,7 @@ function ctools_context_user_settings_form_submit($form, &$form_state) { */ function ctools_context_user_convert_list() { $tokens = token_info(); + $list = array(); foreach ($tokens['tokens']['user'] as $id => $info) { if (!isset($list[$id])) { $list[$id] = $info['name']; diff --git a/sites/all/modules/contrib/dev/ctools/plugins/contexts/user_edit_form.inc b/sites/all/modules/contrib/dev/ctools/plugins/contexts/user_edit_form.inc index a28c5990..61f234a4 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/contexts/user_edit_form.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/contexts/user_edit_form.inc @@ -1,8 +1,8 @@ data = $user; $context->title = isset($user->name) ? $user->name : ''; $context->argument = $user->uid; @@ -133,7 +133,7 @@ function ctools_context_user_edit_form_settings_form($form, &$form_state) { * Validate a node. */ function ctools_context_user_edit_form_settings_form_validate($form, &$form_state) { - // Validate the autocomplete + // Validate the autocomplete. if (empty($form_state['values']['uid']) && empty($form_state['values']['user'])) { form_error($form['user'], t('You must select a user.')); return; @@ -162,6 +162,7 @@ function ctools_context_user_edit_form_settings_form_validate($form, &$form_stat form_set_value($form['uid'], $user->uid, $form_state); } + function ctools_context_user_edit_form_settings_form_submit($form, &$form_state) { if ($form_state['values']['set_identifier']) { $user = user_load($form_state['values']['uid']); diff --git a/sites/all/modules/contrib/dev/ctools/plugins/contexts/vocabulary.inc b/sites/all/modules/contrib/dev/ctools/plugins/contexts/vocabulary.inc index 9c5d4cf7..e5b0b9c6 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/contexts/vocabulary.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/contexts/vocabulary.inc @@ -2,8 +2,7 @@ /** * @file - * - * Plugin to provide a vocabulary context + * Plugin to provide a vocabulary context. */ /** diff --git a/sites/all/modules/contrib/dev/ctools/plugins/export_ui/ctools_export_ui.class.php b/sites/all/modules/contrib/dev/ctools/plugins/export_ui/ctools_export_ui.class.php index 60c1dc28..0c8145e4 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/export_ui/ctools_export_ui.class.php +++ b/sites/all/modules/contrib/dev/ctools/plugins/export_ui/ctools_export_ui.class.php @@ -13,7 +13,7 @@ class ctools_export_ui { * constructor because we are retaining PHP4 compatibility, which * would require all child classes to implement their own constructor. */ - function init($plugin) { + public function init($plugin) { ctools_include('export'); $this->plugin = $plugin; @@ -22,7 +22,7 @@ class ctools_export_ui { /** * Get a page title for the current page from our plugin strings. */ - function get_page_title($op, $item = NULL) { + public function get_page_title($op, $item = NULL) { if (empty($this->plugin['strings']['title'][$op])) { return; } @@ -43,13 +43,13 @@ class ctools_export_ui { * This can be overridden for modules that want to be able to export * items currently being edited, for example. */ - function load_item($item_name) { + public function load_item($item_name) { $item = ctools_export_crud_load($this->plugin['schema'], $item_name); return empty($item) ? FALSE : $item; } // ------------------------------------------------------------------------ - // Menu item manipulation + // Menu item manipulation. /** * hook_menu() entry point. @@ -57,7 +57,7 @@ class ctools_export_ui { * Child implementations that need to add or modify menu items should * probably call parent::hook_menu($items) and then modify as needed. */ - function hook_menu(&$items) { + public function hook_menu(&$items) { // During upgrades, the schema can be empty as this is called prior to // actual update functions being run. Ensure that we can cope with this // situation. @@ -99,7 +99,7 @@ class ctools_export_ui { * @return * TRUE if the current user has access, FALSE if not. */ - function access($op, $item) { + public function access($op, $item) { if (!user_access($this->plugin['access'])) { return FALSE; } @@ -122,14 +122,19 @@ class ctools_export_ui { switch ($op) { case 'import': return user_access('use ctools import'); + case 'revert': return ($item->export_type & EXPORT_IN_DATABASE) && ($item->export_type & EXPORT_IN_CODE); + case 'delete': return ($item->export_type & EXPORT_IN_DATABASE) && !($item->export_type & EXPORT_IN_CODE); + case 'disable': return empty($item->disabled); + case 'enable': return !empty($item->disabled); + default: return TRUE; } @@ -144,7 +149,7 @@ class ctools_export_ui { * It is unlikely that a child object will need to override this method, * unless the listing mechanism is going to be highly specialized. */ - function list_page($js, $input) { + public function list_page($js, $input) { $this->items = ctools_export_crud_load_all($this->plugin['schema'], $js); // Respond to a reset command by clearing session and doing a drupal goto @@ -154,7 +159,7 @@ class ctools_export_ui { if (!$js) { drupal_goto($_GET['q']); } - // clear everything but form id, form build id and form token: + // Clear everything but form id, form build id and form token. $keys = array_keys($input); foreach ($keys as $id) { if (!in_array($id, array('form_id', 'form_build_id', 'form_token'))) { @@ -224,7 +229,7 @@ class ctools_export_ui { * get the base form and then modify it as necessary to add search * gadgets for custom fields. */ - function list_form(&$form, &$form_state) { + public function list_form(&$form, &$form_state) { // This forces the form to *always* treat as submitted which is // necessary to make it work. $form['#token'] = FALSE; @@ -269,7 +274,7 @@ class ctools_export_ui { '#title' => t('Enabled'), '#options' => $all + array( '0' => t('Enabled'), - '1' => t('Disabled') + '1' => t('Disabled'), ), '#default_value' => 'all', ); @@ -324,7 +329,7 @@ class ctools_export_ui { * It is very rare that a filter form needs validation, but if it is * needed, override this. */ - function list_form_validate(&$form, &$form_state) { } + public function list_form_validate(&$form, &$form_state) { } /** * Submit the filter/sort form. @@ -336,7 +341,7 @@ class ctools_export_ui { * For the most part, you should not need to override this method, as the * fiddly bits call through to other functions. */ - function list_form_submit(&$form, &$form_state) { + public function list_form_submit(&$form, &$form_state) { // Filter and re-sort the pages. $plugin = $this->plugin; @@ -381,7 +386,7 @@ class ctools_export_ui { * @return * TRUE if the item should be excluded. */ - function list_filter($form_state, $item) { + public function list_filter($form_state, $item) { $schema = ctools_export_get_schema($this->plugin['schema']); if ($form_state['values']['storage'] != 'all' && $form_state['values']['storage'] != $item->{$schema['export']['export type string']}) { return TRUE; @@ -411,7 +416,7 @@ class ctools_export_ui { * This widget will search against whatever fields are configured here. By * default it will attempt to search against the name, title and description fields. */ - function list_search_fields() { + public function list_search_fields() { $fields = array( $this->plugin['export']['key'], ); @@ -432,7 +437,7 @@ class ctools_export_ui { * Override this if you wish to provide more or change how these work. * The actual handling of the sorting will happen in build_row(). */ - function list_sort_options() { + public function list_sort_options() { if (!empty($this->plugin['export']['admin_title'])) { $options = array( 'disabled' => t('Enabled, title'), @@ -458,14 +463,14 @@ class ctools_export_ui { * * Override this if you need custom CSS for your list. */ - function list_css() { + public function list_css() { ctools_add_css('export-ui-list'); } /** * Builds the operation links for a specific exportable item. */ - function build_operations($item) { + public function build_operations($item) { $plugin = $this->plugin; $schema = ctools_export_get_schema($plugin['schema']); $operations = $plugin['allowed operations']; @@ -515,7 +520,7 @@ class ctools_export_ui { * method, so this is building up a row suitable for theme('table'). * This doesn't have to be true if you override both. */ - function list_build_row($item, &$form_state, $operations) { + public function list_build_row($item, &$form_state, $operations) { // Set up sorting $name = $item->{$this->plugin['export']['key']}; $schema = ctools_export_get_schema($this->plugin['schema']); @@ -563,7 +568,7 @@ class ctools_export_ui { * If you've added columns via list_build_row() but are still using a * table, override this method to set up the table header. */ - function list_table_header() { + public function list_table_header() { $header = array(); if (!empty($this->plugin['export']['admin_title'])) { $header[] = array('data' => t('Title'), 'class' => array('ctools-export-ui-title')); @@ -585,7 +590,7 @@ class ctools_export_ui { * Whatever you do if this method is overridden, the ID is important for AJAX * so be sure it exists. */ - function list_render(&$form_state) { + public function list_render(&$form_state) { $table = array( 'header' => $this->list_table_header(), 'rows' => $this->rows, @@ -600,14 +605,14 @@ class ctools_export_ui { * * This will appear after the filter/sort widgets. */ - function list_header($form_state) { } + public function list_header($form_state) { } /** * Render a footer to go after thie list. * * This is a good place to add additional links. */ - function list_footer($form_state) { } + public function list_footer($form_state) { } // ------------------------------------------------------------------------ // These methods are the API for adding/editing exportable items @@ -623,7 +628,7 @@ class ctools_export_ui { * The item in use; this may be necessary as item IDs are often embedded in * redirects. */ - function redirect($op, $item = NULL) { + public function redirect($op, $item = NULL) { if (isset($this->plugin['redirect'][$op])) { $destination = (array) $this->plugin['redirect'][$op]; if ($item) { @@ -638,7 +643,8 @@ class ctools_export_ui { } } - function add_page($js, $input, $step = NULL) { + public function add_page($js, $input, $step = NULL) { + $args = func_get_args(); drupal_set_title($this->get_page_title('add'), PASS_THROUGH); // If a step not set, they are trying to create a new item. If a step @@ -661,7 +667,7 @@ class ctools_export_ui { 'no_redirect' => TRUE, 'step' => $step, // Store these in case additional args are needed. - 'function args' => func_get_args(), + 'function args' => $args, ); $output = $this->edit_execute_form($form_state); @@ -675,7 +681,8 @@ class ctools_export_ui { /** * Main entry point to edit an item. */ - function edit_page($js, $input, $item, $step = NULL) { + public function edit_page($js, $input, $item, $step = NULL) { + $args = func_get_args(); drupal_set_title($this->get_page_title('edit', $item), PASS_THROUGH); // Check to see if there is a cached item to get if we're using the wizard. @@ -697,7 +704,7 @@ class ctools_export_ui { 'no_redirect' => TRUE, 'step' => $step, // Store these in case additional args are needed. - 'function args' => func_get_args(), + 'function args' => $args, ); $output = $this->edit_execute_form($form_state); @@ -711,7 +718,8 @@ class ctools_export_ui { /** * Main entry point to clone an item. */ - function clone_page($js, $input, $original, $step = NULL) { + public function clone_page($js, $input, $original, $step = NULL) { + $args = func_get_args(); drupal_set_title($this->get_page_title('clone', $original), PASS_THROUGH); // If a step not set, they are trying to create a new clone. If a step @@ -751,7 +759,7 @@ class ctools_export_ui { 'no_redirect' => TRUE, 'step' => $step, // Store these in case additional args are needed. - 'function args' => func_get_args(), + 'function args' => $args, ); $output = $this->edit_execute_form($form_state); @@ -768,7 +776,7 @@ class ctools_export_ui { * Add and Edit both funnel into this, but they have a few different * settings. */ - function edit_execute_form(&$form_state) { + public function edit_execute_form(&$form_state) { if (!empty($this->plugin['use wizard'])) { return $this->edit_execute_form_wizard($form_state); } @@ -782,7 +790,7 @@ class ctools_export_ui { * * By default, export UI will provide a single form for editing an object. */ - function edit_execute_form_standard(&$form_state) { + public function edit_execute_form_standard(&$form_state) { $output = drupal_build_form('ctools_export_ui_edit_item_form', $form_state); if (!empty($form_state['executed']) && empty($form_state['rebuild'])) { $this->edit_save_form($form_state); @@ -803,7 +811,7 @@ class ctools_export_ui { * @param array $form_state * The already created form state. */ - function get_wizard_info(&$form_state) { + public function get_wizard_info(&$form_state) { if (!isset($form_state['step'])) { $form_state['step'] = NULL; } @@ -878,7 +886,7 @@ class ctools_export_ui { * Using 'add order' or 'edit order' can be used to ensure that add/edit order * is different. */ - function edit_execute_form_wizard(&$form_state) { + public function edit_execute_form_wizard(&$form_state) { $form_info = $this->get_wizard_info($form_state); // If there aren't any forms set, fail. @@ -901,7 +909,7 @@ class ctools_export_ui { if (!empty($form_state['complete'])) { $this->edit_save_form($form_state); } - else if ($output && !empty($form_state['item']->export_ui_item_is_cached)) { + elseif ($output && !empty($form_state['item']->export_ui_item_is_cached)) { // @todo this should be in the plugin strings drupal_set_message(t('You have unsaved changes. These changes will not be made permanent until you click Save.'), 'warning'); } @@ -919,7 +927,7 @@ class ctools_export_ui { * * The wizard callback delegates this back to the object. */ - function edit_wizard_back(&$form_state) { + public function edit_wizard_back(&$form_state) { // This only exists so child implementations can use it. } @@ -928,7 +936,7 @@ class ctools_export_ui { * * The wizard callback delegates this back to the object. */ - function edit_wizard_next(&$form_state) { + public function edit_wizard_next(&$form_state) { $this->edit_cache_set($form_state['item'], $form_state['form type']); } @@ -937,7 +945,7 @@ class ctools_export_ui { * * The wizard callback delegates this back to the object. */ - function edit_wizard_cancel(&$form_state) { + public function edit_wizard_cancel(&$form_state) { $this->edit_cache_clear($form_state['item'], $form_state['form type']); } @@ -946,7 +954,7 @@ class ctools_export_ui { * * The wizard callback delegates this back to the object. */ - function edit_wizard_finish(&$form_state) { + public function edit_wizard_finish(&$form_state) { $form_state['complete'] = TRUE; // If we are importing, and overwrite was selected, delete the original so @@ -961,7 +969,7 @@ class ctools_export_ui { /** * Retrieve the item currently being edited from the object cache. */ - function edit_cache_get($item, $op = 'edit') { + public function edit_cache_get($item, $op = 'edit') { ctools_include('object-cache'); if (is_string($item)) { $name = $item; @@ -980,20 +988,20 @@ class ctools_export_ui { /** * Cache the item currently currently being edited. */ - function edit_cache_set($item, $op = 'edit') { + public function edit_cache_set($item, $op = 'edit') { ctools_include('object-cache'); $name = $this->edit_cache_get_key($item, $op); return $this->edit_cache_set_key($item, $name); } - function edit_cache_set_key($item, $name) { + public function edit_cache_set_key($item, $name) { return ctools_object_cache_set('ctui_' . $this->plugin['name'], $name, $item); } /** * Clear the object cache for the currently edited item. */ - function edit_cache_clear($item, $op = 'edit') { + public function edit_cache_clear($item, $op = 'edit') { ctools_include('object-cache'); $name = $this->edit_cache_get_key($item, $op); return ctools_object_cache_clear('ctui_' . $this->plugin['name'], $name); @@ -1002,7 +1010,7 @@ class ctools_export_ui { /** * Figure out what the cache key is for this object. */ - function edit_cache_get_key($item, $op) { + public function edit_cache_get_key($item, $op) { $export_key = $this->plugin['export']['key']; return $op == 'edit' ? $item->{$this->plugin['export']['key']} : "::$op"; } @@ -1010,7 +1018,7 @@ class ctools_export_ui { /** * Called to save the final product from the edit form. */ - function edit_save_form($form_state) { + public function edit_save_form($form_state) { $item = &$form_state['item']; $export_key = $this->plugin['export']['key']; @@ -1029,7 +1037,7 @@ class ctools_export_ui { /** * Provide the actual editing form. */ - function edit_form(&$form, &$form_state) { + public function edit_form(&$form, &$form_state) { $export_key = $this->plugin['export']['key']; $item = $form_state['item']; $schema = ctools_export_get_schema($this->plugin['schema']); @@ -1102,7 +1110,7 @@ class ctools_export_ui { /** * Validate callback for the edit form. */ - function edit_form_validate(&$form, &$form_state) { + public function edit_form_validate(&$form, &$form_state) { if (!empty($this->plugin['form']['validate'])) { // Pass $form by reference. $this->plugin['form']['validate']($form, $form_state); @@ -1113,7 +1121,7 @@ class ctools_export_ui { * Perform a final validation check before allowing the form to be * finished. */ - function edit_finish_validate(&$form, &$form_state) { + public function edit_finish_validate(&$form, &$form_state) { if ($form_state['op'] != 'edit') { // Validate the export key. Fake an element for form_error(). $export_key = $this->plugin['export']['key']; @@ -1135,7 +1143,7 @@ class ctools_export_ui { * If the keys all match up to the schema, this method will not need to be * overridden. */ - function edit_form_submit(&$form, &$form_state) { + public function edit_form_submit(&$form, &$form_state) { if (!empty($this->plugin['form']['submit'])) { // Pass $form by reference. $this->plugin['form']['submit']($form, $form_state); @@ -1157,14 +1165,14 @@ class ctools_export_ui { /** * Callback to enable a page. */ - function enable_page($js, $input, $item) { + public function enable_page($js, $input, $item) { return $this->set_item_state(FALSE, $js, $input, $item); } /** * Callback to disable a page. */ - function disable_page($js, $input, $item) { + public function disable_page($js, $input, $item) { return $this->set_item_state(TRUE, $js, $input, $item); } @@ -1174,7 +1182,7 @@ class ctools_export_ui { * If javascript is in use, this will rebuild the list and send that back * as though the filter form had been executed. */ - function set_item_state($state, $js, $input, $item) { + public function set_item_state($state, $js, $input, $item) { ctools_export_crud_set_status($this->plugin['schema'], $item, $state); if (!$js) { @@ -1188,7 +1196,7 @@ class ctools_export_ui { /** * Page callback to delete an exportable item. */ - function delete_page($js, $input, $item) { + public function delete_page($js, $input, $item) { $form_state = array( 'plugin' => $this->plugin, 'object' => &$this, @@ -1211,7 +1219,7 @@ class ctools_export_ui { /** * Deletes exportable items from the database. */ - function delete_form_submit(&$form_state) { + public function delete_form_submit(&$form_state) { $item = $form_state['item']; ctools_export_crud_delete($this->plugin['schema'], $item); @@ -1223,7 +1231,7 @@ class ctools_export_ui { /** * Page callback to display export information for an exportable item. */ - function export_page($js, $input, $item) { + public function export_page($js, $input, $item) { drupal_set_title($this->get_page_title('export', $item), PASS_THROUGH); return drupal_get_form('ctools_export_form', ctools_export_crud_export($this->plugin['schema'], $item), t('Export')); } @@ -1231,7 +1239,8 @@ class ctools_export_ui { /** * Page callback to import information for an exportable item. */ - function import_page($js, $input, $step = NULL) { + public function import_page($js, $input, $step = NULL) { + $args = func_get_args(); drupal_set_title($this->get_page_title('import'), PASS_THROUGH); // Import is basically a multi step wizard form, so let's go ahead and // use CTools' wizard.inc for it. @@ -1256,7 +1265,7 @@ class ctools_export_ui { 'no_redirect' => TRUE, 'step' => $step, // Store these in case additional args are needed. - 'function args' => func_get_args(), + 'function args' => $args, ); // import always uses the wizard. @@ -1272,7 +1281,7 @@ class ctools_export_ui { * Import form. Provides simple helptext instructions and textarea for * pasting a export definition. */ - function edit_form_import(&$form, &$form_state) { + public function edit_form_import(&$form, &$form_state) { $form['help'] = array( '#type' => 'item', '#value' => $this->plugin['strings']['help']['import'], @@ -1298,7 +1307,7 @@ class ctools_export_ui { * * Evaluates code and make sure it creates an object before we continue. */ - function edit_form_import_validate($form, &$form_state) { + public function edit_form_import_validate($form, &$form_state) { $item = ctools_export_crud_import($this->plugin['schema'], $form_state['values']['import']); if (is_string($item)) { form_error($form['import'], t('Unable to get an import from the code. Errors reported: @errors', array('@errors' => $item))); @@ -1315,7 +1324,7 @@ class ctools_export_ui { * * Stores the item in the session. */ - function edit_form_import_submit($form, &$form_state) { + public function edit_form_import_submit($form, &$form_state) { // The validate function already imported and stored the item. This // function exists simply to prevent it from going to the default // edit_form_submit() method. diff --git a/sites/all/modules/contrib/dev/ctools/plugins/export_ui/ctools_export_ui.inc b/sites/all/modules/contrib/dev/ctools/plugins/export_ui/ctools_export_ui.inc index 4e0a8497..3087ccae 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/export_ui/ctools_export_ui.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/export_ui/ctools_export_ui.inc @@ -1,6 +1,7 @@ FALSE, diff --git a/sites/all/modules/contrib/dev/ctools/plugins/relationships/entity_from_field.inc b/sites/all/modules/contrib/dev/ctools/plugins/relationships/entity_from_field.inc index a7f65919..2589efd6 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/relationships/entity_from_field.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/relationships/entity_from_field.inc @@ -140,7 +140,7 @@ function ctools_entity_from_field_get_children($parent_plugin, $parent) { $plugin_entities = array( 'to' => array($to_entity => $to_entity_info), - 'from' => array($from_entity => $from_entity_info) + 'from' => array($from_entity => $from_entity_info), ); drupal_alter('ctools_entity_context', $plugins[$key], $plugin_entities, $key); } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/relationships/entity_from_query_string.inc b/sites/all/modules/contrib/dev/ctools/plugins/relationships/entity_from_query_string.inc index 8be3ceb3..80c40fc3 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/relationships/entity_from_query_string.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/relationships/entity_from_query_string.inc @@ -44,7 +44,7 @@ function ctools_entity_from_query_string_context($context, $conf) { */ function ctools_entity_from_query_string_settings_form($form, &$form_state) { - //Get all avalible enity types + // Get all avalible enity types. foreach (entity_get_info() as $key => $value) { $entity_types[$key] = $value['label']; } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/relationships/entity_from_schema.inc b/sites/all/modules/contrib/dev/ctools/plugins/relationships/entity_from_schema.inc index 809473eb..edf6abe7 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/relationships/entity_from_schema.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/relationships/entity_from_schema.inc @@ -88,7 +88,7 @@ function ctools_entity_from_schema_get_children($parent_plugin, $parent) { $plugin_entities = array('to' => $from_entity_info, 'from' => $to_entity_info); $plugin_entities = array('to' => array($from_entity => $from_entity_info), 'from' => array($to_entity => $to_entity_info)); drupal_alter('ctools_entity_context', $plugin, $plugin_entities, $plugin_id); - $plugins[$plugin_id] = $plugin; + $plugins[$plugin_id] = $plugin; } } diff --git a/sites/all/modules/contrib/dev/ctools/plugins/relationships/term_parent.inc b/sites/all/modules/contrib/dev/ctools/plugins/relationships/term_parent.inc index f084cca8..c884e0aa 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/relationships/term_parent.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/relationships/term_parent.inc @@ -1,7 +1,7 @@ data; $terms = array(); - + $fields = field_info_instances('node', $node->type); foreach ($fields as $name => $info) { $field_info = field_info_field($name); @@ -43,8 +43,24 @@ function ctools_terms_from_node_context($context, $conf) { } } } + elseif ($field_info['type'] == 'entityreference' && $field_info['settings']['target_type'] == 'taxonomy_term') { + $items = field_get_items('node', $node, $name); + if (is_array($items)) { + $tids = array(); + foreach ($items as $item) { + $tids[] = $item['target_id']; + } + + $term_objects = taxonomy_term_load_multiple($tids); + foreach ($term_objects as $term) { + if (empty($conf['vocabulary']) || in_array($term->vocabulary_machine_name, $conf['vocabulary'])) { + $terms[] = $term->tid; + } + } + } + } } - + if (!empty($terms)) { $all_terms = ctools_break_phrase(implode($conf['concatenator'], $terms)); return ctools_context_create('terms', $all_terms); diff --git a/sites/all/modules/contrib/dev/ctools/plugins/relationships/user_category_edit_form_from_user.inc b/sites/all/modules/contrib/dev/ctools/plugins/relationships/user_category_edit_form_from_user.inc index 44b56b9d..07eb3827 100644 --- a/sites/all/modules/contrib/dev/ctools/plugins/relationships/user_category_edit_form_from_user.inc +++ b/sites/all/modules/contrib/dev/ctools/plugins/relationships/user_category_edit_form_from_user.inc @@ -27,7 +27,7 @@ function ctools_user_category_edit_form_from_user_context($context, $conf) { return ctools_context_create_empty('user_edit_form', NULL); } - if(!empty($conf['category'])) { + if (!empty($conf['category'])) { return ctools_context_create('user_edit_form', $context->data, array('category' => $conf['category'])); } @@ -46,7 +46,7 @@ function ctools_user_category_edit_form_from_user_settings_form($form, &$form_st $categories = _user_categories(); $options = array(); - foreach($categories as $category) { + foreach ($categories as $category) { $options[$category['name']] = $category['title']; } $form['category'] = array( diff --git a/sites/all/modules/contrib/dev/ctools/stylizer/plugins/export_ui/stylizer.inc b/sites/all/modules/contrib/dev/ctools/stylizer/plugins/export_ui/stylizer.inc index a1fc1d8c..8192efe1 100644 --- a/sites/all/modules/contrib/dev/ctools/stylizer/plugins/export_ui/stylizer.inc +++ b/sites/all/modules/contrib/dev/ctools/stylizer/plugins/export_ui/stylizer.inc @@ -1,5 +1,9 @@ 'stylizer', 'access' => 'administer stylizer', @@ -42,4 +46,3 @@ $plugin = array( ), ), ); - diff --git a/sites/all/modules/contrib/dev/ctools/stylizer/plugins/export_ui/stylizer_ui.class.php b/sites/all/modules/contrib/dev/ctools/stylizer/plugins/export_ui/stylizer_ui.class.php index 14d62939..d4db36cc 100644 --- a/sites/all/modules/contrib/dev/ctools/stylizer/plugins/export_ui/stylizer_ui.class.php +++ b/sites/all/modules/contrib/dev/ctools/stylizer/plugins/export_ui/stylizer_ui.class.php @@ -5,16 +5,18 @@ */ class stylizer_ui extends ctools_export_ui { - function access($op, $item) { + + public function access($op, $item) { $access = parent::access($op, $item); if ($op == 'add' && $access && empty($this->base_types)) { - // Make sure there are base styles defined. - $access = FALSE; + // Make sure there are base styles defined. + $access = FALSE; } return $access; } - function list_form(&$form, &$form_state) { + + public function list_form(&$form, &$form_state) { ctools_include('stylizer'); parent::list_form($form, $form_state); @@ -60,7 +62,8 @@ class stylizer_ui extends ctools_export_ui { ); } - function list_sort_options() { + + public function list_sort_options() { return array( 'disabled' => t('Enabled, title'), 'title' => t('Title'), @@ -71,7 +74,8 @@ class stylizer_ui extends ctools_export_ui { ); } - function list_filter($form_state, $item) { + + public function list_filter($form_state, $item) { if (empty($form_state['style_plugins'][$item->settings['style_base']])) { $this->style_plugin = array( 'name' => 'broken', @@ -102,30 +106,37 @@ class stylizer_ui extends ctools_export_ui { return parent::list_filter($form_state, $item); } - function list_search_fields() { + + public function list_search_fields() { $fields = parent::list_search_fields(); $fields[] = 'plugin_title'; return $fields; } - function list_build_row($item, &$form_state, $operations) { - // Set up sorting + + 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 'type': $this->sorts[$item->name] = $this->style_plugin['type'] . $item->admin_title; break; + case 'base': $this->sorts[$item->name] = $this->style_plugin['title'] . $item->admin_title; break; + case 'storage': $this->sorts[$item->name] = $item->type . $item->admin_title; break; @@ -154,7 +165,8 @@ class stylizer_ui extends ctools_export_ui { ); } - function list_table_header() { + + public function list_table_header() { return array( array('data' => t('Type'), 'class' => array('ctools-export-ui-type')), array('data' => t('Name'), 'class' => array('ctools-export-ui-name')), @@ -165,14 +177,16 @@ class stylizer_ui extends ctools_export_ui { ); } - function init($plugin) { + + public function init($plugin) { ctools_include('stylizer'); $this->base_types = ctools_get_style_base_types(); parent::init($plugin); } - function get_wizard_info(&$form_state) { + + public function get_wizard_info(&$form_state) { $form_info = parent::get_wizard_info($form_state); ctools_include('stylizer'); @@ -219,7 +233,7 @@ class stylizer_ui extends ctools_export_ui { * The stylizer wizard stores its stuff in slightly different places, so * we have to find it and move it to the right place. */ - function store_stylizer_info(&$form_state) { + public function store_stylizer_info(&$form_state) { /* foreach (array('name', 'admin_title', 'admin_description') as $key) { if (!empty($form_state['values'][$key])) { @@ -235,12 +249,14 @@ class stylizer_ui extends ctools_export_ui { $form_state['item']->settings['name'] = $form_state['item']->name; } - function edit_wizard_next(&$form_state) { + + public function edit_wizard_next(&$form_state) { $this->store_stylizer_info($form_state); parent::edit_wizard_next($form_state); } - function edit_wizard_finish(&$form_state) { + + public function edit_wizard_finish(&$form_state) { // These might be stored by the stylizer wizard, so we should clear them. if (isset($form_state['settings']['old_settings'])) { unset($form_state['settings']['old_settings']); @@ -249,7 +265,8 @@ class stylizer_ui extends ctools_export_ui { parent::edit_wizard_finish($form_state); } - function edit_form_type(&$form, &$form_state) { + + public function edit_form_type(&$form, &$form_state) { foreach ($this->base_types as $module => $info) { foreach ($info as $key => $base_type) { $types[$module . '-' . $key] = $base_type['title']; @@ -266,7 +283,9 @@ class stylizer_ui extends ctools_export_ui { ); } - function edit_form_type_submit(&$form, &$form_state) { + + public function edit_form_type_submit(&$form, &$form_state) { list($form_state['item']->style_module, $form_state['item']->style_type) = explode('-', $form_state['values']['type']); } + } diff --git a/sites/all/modules/contrib/dev/ctools/stylizer/stylizer.info b/sites/all/modules/contrib/dev/ctools/stylizer/stylizer.info index 79dc8929..90204a3d 100644 --- a/sites/all/modules/contrib/dev/ctools/stylizer/stylizer.info +++ b/sites/all/modules/contrib/dev/ctools/stylizer/stylizer.info @@ -2,13 +2,11 @@ name = Stylizer description = Create custom styles for applications such as Panels. core = 7.x package = Chaos tool suite -version = CTOOLS_MODULE_VERSION dependencies[] = ctools dependencies[] = color -; Information added by Drupal.org packaging script on 2016-11-22 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/stylizer/stylizer.install b/sites/all/modules/contrib/dev/ctools/stylizer/stylizer.install index 5cefb0dd..321ba8e1 100644 --- a/sites/all/modules/contrib/dev/ctools/stylizer/stylizer.install +++ b/sites/all/modules/contrib/dev/ctools/stylizer/stylizer.install @@ -1,5 +1,9 @@ t('Custom styles can be applied to Panel regions and Panel panes.'), ); - // Load all mini panels and their displays. + // Load all mini panels and their displays. ctools_include('export'); ctools_include('stylizer'); $items = ctools_export_crud_load_all('stylizer'); @@ -122,14 +122,14 @@ function stylizer_theme() { 'path' => $plugin['path'], ); - // if no theme function exists, assume template. + // If no theme function exists, assume template. if (!function_exists("theme_$plugin[theme]")) { $theme[$plugin['theme']]['template'] = str_replace('_', '-', $plugin['theme']); - $theme[$plugin['theme']]['file'] = $plugin['file']; // for preprocess. + // For preprocess. + $theme[$plugin['theme']]['file'] = $plugin['file']; } } } return $theme; } - diff --git a/sites/all/modules/contrib/dev/ctools/term_depth/plugins/access/term_depth.inc b/sites/all/modules/contrib/dev/ctools/term_depth/plugins/access/term_depth.inc index 7f714afa..d63183f3 100644 --- a/sites/all/modules/contrib/dev/ctools/term_depth/plugins/access/term_depth.inc +++ b/sites/all/modules/contrib/dev/ctools/term_depth/plugins/access/term_depth.inc @@ -61,14 +61,14 @@ function term_depth_term_depth_ctools_access_settings($form, &$form_state, $conf function _term_depth_convert_config_vid_to_vocabulary_name(&$conf) { // Fallback on legacy 'vid', when no vocabularies are available. if (empty($conf['vocabulary']) && !empty($conf['vid'])) { - $conf['vocabulary'] = reset(_ctools_term_vocabulary_machine_name_convert(array($conf['vid']))); - unset($conf['vid']); + $vocabulary = _ctools_term_vocabulary_machine_name_convert(array($conf['vid'])); + $conf['vocabulary'] = reset($vocabulary); + unset($conf['vid'], $vocabulary); } } /** * Submit function for the access plugins settings. - * */ function term_depth_term_depth_ctools_access_settings_submit($form, $form_state) { $form_state['conf']['depth'] = (integer) $form_state['values']['settings']['depth']; diff --git a/sites/all/modules/contrib/dev/ctools/term_depth/term_depth.info b/sites/all/modules/contrib/dev/ctools/term_depth/term_depth.info index 885a5d0d..4baee51d 100644 --- a/sites/all/modules/contrib/dev/ctools/term_depth/term_depth.info +++ b/sites/all/modules/contrib/dev/ctools/term_depth/term_depth.info @@ -3,11 +3,9 @@ description = Controls access to context based upon term depth core = 7.x dependencies[] = ctools package = Chaos tool suite -version = CTOOLS_MODULE_VERSION -; Information added by Drupal.org packaging script on 2016-11-22 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/term_depth/term_depth.module b/sites/all/modules/contrib/dev/ctools/term_depth/term_depth.module index 10f9e319..f9f4ce7c 100644 --- a/sites/all/modules/contrib/dev/ctools/term_depth/term_depth.module +++ b/sites/all/modules/contrib/dev/ctools/term_depth/term_depth.module @@ -1,5 +1,9 @@ 'Context IDs', + 'description' => 'Verify that Context IDs work properly.', + 'group' => 'ctools', + 'dependencies' => array('ctools'), + ); + } + + /** + * {@inheritdoc} + */ + protected function setUp(array $modules = array()) { + $modules[] = 'ctools'; + parent::setUp($modules); + ctools_include('context'); + } + + private function getTestContexts() { + $test_objects = array( + array(), + array( + 'name' => 'foo_bar', + ), + array( + 'id' => 25, + ), + array( + 'id' => 5, + 'name' => NULL, + ), + array( + 'id' => 'a', + 'name' => 'foo_bar', + ), + array( + 'id' => 'z', + 'name' => 'baz', + ), + array( + 'id' => 15, + 'name' => 'baz', + ), + array( + 'id' => 'z', + 'name' => 'foo', + ), + array( + 'id' => 1, + 'name' => 'foo', + ), + array( + 'id' => 47, + 'name' => 'bar', + ), + array( + 'id' => 99, + 'name' => 'bar', + ), + ); + return $test_objects; + } + + /** + * Test ctools_context_id where the context only has an id. + */ + public function testContextId() { + $context = array(); + $expected = 'context__1'; + $actual = ctools_context_id($context); + $this->assertEqual($actual, $expected, 'Empty context has id ' . $expected); + + $context = array('id' => 4); + $expected = 'context__4'; + $actual = ctools_context_id($context); + $this->assertEqual($actual, $expected, 'Context 4 has id ' . $expected); + + $context = array('id' => 'a'); + $expected = 'context__a'; + $actual = ctools_context_id($context); + $this->assertEqual($actual, $expected, 'Context "a" has id ' . $expected); + } + + /** + * Test ctools_context_id where the context has an id and a name. + */ + public function testContextIdName() { + $context = array('id' => '512', 'name' => 'foo'); + $expected = 'context_foo_512'; + $this->assertEqual(ctools_context_id($context), $expected, 'Context "512"/"foo" has id ' . $expected); + + $context = array('id' => '512', 'name' => 'foo_bar'); + $expected = 'context_foo_bar_512'; + $this->assertEqual(ctools_context_id($context), $expected, 'Context "512"/"foo_bar" has id ' . $expected); + } + + /** + * Test ctools_context_id where the context has an id & name, and a type is specified. + */ + public function testContextIdNameType() { + $type = 'sort'; + $context = array('id' => '512', 'name' => 'foo'); + $expected = 'sort_foo_512'; + $this->assertEqual(ctools_context_id($context, $type), $expected, 'Context "512" has id ' . $expected); + + $type = NULL; + $context = array('id' => '512', 'name' => 'foo'); + $expected = '_foo_512'; + $this->assertEqual(ctools_context_id($context, $type), $expected, 'Context "512" has id ' . $expected); + } + + /** + * Test ctools_context_next_id in various scenarios. + */ + public function testNextContextId() { + $test_objects = $this->getTestContexts(); + + // If no object list or name is given? + $value = ctools_context_next_id(NULL, NULL); + $expected = 1; + $this->assertEqual($value, $expected, 'NULL objects have next id ' . $expected); + + // If no object list is given? + $value = ctools_context_next_id(NULL, 'bar'); + $expected = 1; + $this->assertEqual($value, $expected, 'NULL objects have next id ' . $expected); + + // If no object list is given (another way)? + $value = ctools_context_next_id(array(), 'bar'); + $expected = 1; + $this->assertEqual($value, $expected, 'Empty objects have next id ' . $expected); + + // The name is empty... which is just another name. + $value = ctools_context_next_id($test_objects, ''); + $expected = 1; + $this->assertEqual($value, $expected, 'Unnamed objects have next id ' . $expected . ' (got ' . $value . ')'); + + // The value of the id key is not a number. + $value = ctools_context_next_id($test_objects, 'foo_bar'); + $expected = 1; + $this->assertEqual($value, $expected, 'Objects with non-integer ids are ignored ' . $expected); + + // One object's id is not a number (ignore) but another is valid. + $value = ctools_context_next_id($test_objects, 'baz'); + $expected = 16; + $this->assertEqual($value, $expected, 'Baz\'s objects have next id ' . $expected); + + // An expected case: there is one match and the id is numeric. + $value = ctools_context_next_id($test_objects, 'foo'); + $expected = 2; + $this->assertEqual($value, $expected, 'Foo\'s objects have next id ' . $expected); + + // Another expected case: there are multiple numeric IDs. + $value = ctools_context_next_id($test_objects, 'bar'); + $expected = 100; + $this->assertEqual($value, $expected, 'Bar\'s objects have next id ' . $expected); + } + +} + + +/** + * Test the keyword substitution functionality. + */ class CtoolsContextKeywordsSubstitutionTestCase extends DrupalWebTestCase { + + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Keywords substitution', 'description' => 'Verify that keywords are properly replaced with data.', 'group' => 'ctools', + 'dependencies' => array('ctools'), ); } - public function setUp() { - parent::setUp('ctools'); + /** + * {@inheritdoc} + */ + protected function setUp(array $modules = array()) { + $modules[] = 'ctools'; + parent::setUp($modules); ctools_include('context'); } + /** + * Test the keyword substitution. + */ public function testKeywordsSubstitution() { // Create node context for substitution. $node = $this->drupalCreateNode(); @@ -23,64 +209,164 @@ class CtoolsContextKeywordsSubstitutionTestCase extends DrupalWebTestCase { // Run tests on some edge cases. $checks = array( - '%node:changed:raw:' => array( + array( + '%node:changed:raw:', + array('%title' => ''), "{$node->changed}:", t('Multi-level token has been replaced. Colon left untouched.'), ), - '%node:title' => array( + array( + '%node:title', + array('%title' => ''), "{$node->title}", t('Keyword and converter have been replaced.'), ), - '%%node:title' => array( + array( + '%%node:title', + array('%title' => ''), "%node:title", t('Keyword after escaped percent sign left untouched.'), ), - '%node:title%node:nid' => array( + array( + '%node:title%node:nid', + array('%title' => ''), "{$node->title}{$node->nid}", t('Multiple substitutions have been replaced.'), ), - '%node:title:' => array( + array( + '%node:title:', + array('%title' => ''), "{$node->title}:", t('Colon after keyword and converter left untouched.'), ), - '%node:title%%' => array( + array( + '%node:title%%', + array('%title' => ''), "{$node->title}%", t('Escaped percent sign after keyword and converter left untouched.'), ), - '%%%node:title' => array( + array( + '%%%node:title', + array('%title' => ''), "%{$node->title}", t('Keyword after escaped and unescaped percent sign has been replaced.'), ), - '%%foo:bar' => array( + array( + '%%foo:bar', + array('%title' => ''), "%foo:bar", t('Non-existant context ignored.'), ), - 'There was about 20%-30% difference in price.' => array( + array( + 'There was about 20%-30% difference in price.', + array('%title' => ''), 'There was about 20%-30% difference in price.', t('Non-keyword percent sign left untouched.'), ), - 'href="my%20file%2dname.pdf"' => array( + array( + 'href="my%20file%2dname.pdf"', + array('%title' => ''), 'href="my%20file%2dname.pdf"', t('HTTP URL escape left untouched.'), ), - 'href="my%a0file%fdname.pdf"' => array( + array( + 'href="my%a0file%fdname.pdf"', + array('%title' => ''), 'href="my%a0file%fdname.pdf"', t('HTTP URL escape (high-chars) left untouched.'), ), - 'Click here!' => array( + array( + 'Click here!', + array('%title' => ''), 'Click here!', t('HTTP URL escape percent sign left untouched in HTML.'), ), - 'SELECT * FROM {table} WHERE field = "%s"' => array( + array( + 'SELECT * FROM {table} WHERE field = "%s"', + array('%title' => ''), 'SELECT * FROM {table} WHERE field = "%s"', t('SQL percent sign left untouched.'), ), + array( + '%title', + array('%title' => 'foobar'), + 'foobar', + t('String value in $keywords array is returned.'), + ), + array( + '%title', + array('%title' => ''), + '', + t('Empty string value in $keywords array returns empty string.'), + ), + array( + '%title', + array('%title' => NULL), + '', + t('NULL value in $keywords array returns empty string.'), + ), + array( + '%title', + array('%title' => FALSE), + '', + t('FALSE value in $keywords array returns empty string.'), + ), + array( + '%title', + array('%title' => 11), + '11', + t('Integer value in $keywords array returns string representation of the integer.'), + ), + array( + '%title', + array('%title' => 'substring %title'), + 'substring %title', + t('Input value as substring in $keywords array left untouched.'), + ), ); - foreach ($checks as $string => $expectations) { - list($expected_result, $message) = $expectations; - $actual_result = ctools_context_keyword_substitute($string, array(), $contexts); + foreach ($checks as $check) { + list($string, $keywords, $expected_result, $message) = $check; + $actual_result = ctools_context_keyword_substitute($string, $keywords, $contexts); $this->assertEqual($actual_result, $expected_result, $message); } } } + +/** + * Test the context classes. + */ +class CtoolsContextUnitTestCase extends DrupalUnitTestCase { + + /** + * {@inheritdoc} + */ + public static function getInfo() { + return array( + 'name' => 'Context unit tests', + 'description' => 'Verifies that context classes behave correctly', + 'group' => 'ctools', + 'dependencies' => array('ctools'), + ); + } + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + require_once __DIR__ . '/../includes/context.inc'; + } + + /** + * Tests that contexts have the correct required property value. + */ + public function testOptionalRequiredContext() { + $required_context = new ctools_context_required('test1'); + $this->assertTrue($required_context->required); + + $optional_context = new ctools_context_optional('test2'); + $this->assertFalse($optional_context->required); + } + +} diff --git a/sites/all/modules/contrib/dev/ctools/tests/css.test b/sites/all/modules/contrib/dev/ctools/tests/css.test index 3ffd42a5..6c03730a 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/css.test +++ b/sites/all/modules/contrib/dev/ctools/tests/css.test @@ -1,65 +1,98 @@ 'CSS Tools tests', - 'description' => '...', + 'description' => 'Confirm the custom CSS handling works.', 'group' => 'ctools', + 'dependencies' => array('ctools'), ); } - function setUp() { - // Additionally enable contact module. - parent::setUp('ctools'); + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + parent::setUp($modules); + ctools_include('css'); } /** - * Test that cached plugins are loaded correctly. + * Test that Stored CSS snippets can be retrieved, filtered or otherwise. */ - function testCssStuff() { + public function testCssStoreFilterRetrieve() { $css = "#some-id .some-class {\n color: black;\n illegal-key: foo;\n}"; $filtered_css = '#some-id .some-class{color:black;}'; - ctools_include('css'); + $this->assertNull(ctools_css_retrieve('missing-css-test'), 'Missing css snippet is not found'); + $filename1 = ctools_css_store('unfiltered-css-test', $css, FALSE); $filename2 = ctools_css_store('filtered-css-test', $css, TRUE); + $file_contents = file_get_contents($filename1); + $this->assertEqual($css, $file_contents, 'Unfiltered css file contents are correct'); + $this->assertEqual($filename1, ctools_css_retrieve('unfiltered-css-test'), 'Unfiltered css file successfully fetched'); $file_contents = file_get_contents($filename1); $this->assertEqual($css, $file_contents, 'Unfiltered css file contents are correct'); -// $match = $filename1 == ctools_css_retrieve('unfiltered-css-test') ? 'Match' : 'No match'; -// $output .= '
    Unfiltered: ' . $filename1 . ' ' . $match . '
    '; -// $output .= '
    ' . file_get_contents($filename1) . '
    '; $this->assertEqual($filename2, ctools_css_retrieve('filtered-css-test'), 'Filtered css file succcesfully fetched'); $file_contents = file_get_contents($filename2); $this->assertEqual($filtered_css, $file_contents, 'Filtered css file contents are correct'); - // $match = $filename2 == ctools_css_retrieve('filtered-css-test') ? 'Match' : 'No match'; -// $output .= '
    Filtered: ' . $filename2 . ' ' . $match . '
    '; -// $output .= '
    ' . file_get_contents($filename2) . '
    '; -// -// drupal_add_css($filename2, array('type' => 'file')); -// return array('#markup' => $output); + } + /** + * Test that Stored CSS snippets can be correctly overwritten. + */ + public function testCssStoreOverwrite() { + $css1 = "#some-id .some-class {\n color: black;\n illegal-key: foo;\n}"; - // Test that in case that url can be used, the value surives when a colon is in it. + $css2 = "#other-id .other-class {\n color: blue;\n illegal-key: foo;\n}"; + $filtered_css2 = '#other-id .other-class{color:blue;}'; + + ctools_css_store('unfiltered-css-test', $css1, FALSE); + ctools_css_store('filtered-css-test', $css1, TRUE); + + // Now overwrite the first css with the second version. + $filename3 = ctools_css_store('unfiltered-css-test', $css2, FALSE); + $filename4 = ctools_css_store('filtered-css-test', $css2, TRUE); + + $file_contents3 = file_get_contents($filename3); + $file_contents4 = file_get_contents($filename4); + + $this->assertEqual($css2, $file_contents3, 'Unfiltered CSS has overwritten earlier contents.'); + $this->assertEqual($filtered_css2, $file_contents4, 'Filtered CSS has overwritten earlier contents.'); + } + + /** + * Test that in case that url is used, the colons survives filtering. + */ + public function testCssFilterURLHandling() { $css = "#some-id {\n background-image: url(http://example.com/example.gif);\n}"; $css_data = ctools_css_disassemble($css); $empty_array = array(); $disallowed_values_regex = '/(expression)/'; - $filtered = ctools_css_assemble(ctools_css_filter_css_data($css_data, $empty_array, $empty_array, '', $disallowed_values_regex)); + + $intermediate = ctools_css_filter_css_data($css_data, $empty_array, $empty_array, '', $disallowed_values_regex); + $filtered = ctools_css_assemble($intermediate); + $url = (strpos($filtered, 'http://example.com/example.gif') !== FALSE); $this->assertTrue($url, 'CSS with multiple colons can survive.'); + } - // Test that in case the CSS has two properties defined are merged. + /** + * Test that when the CSS has two properties defined they are merged. + */ + public function testCssFilterMergeProperties() { $css = "#some-id {\n font-size: 12px;\n}\n#some-id {\n color: blue;\n}"; $filtered = ctools_css_filter($css); $font_size = (strpos($filtered, 'font-size:12px;') !== FALSE); @@ -78,4 +111,5 @@ class CtoolsCssTestCase extends DrupalWebTestCase { $color = (strpos($filtered, 'color:red') !== FALSE); $this->assertTrue($font_size && $color, 'Multiple properties are retained.'); } + } diff --git a/sites/all/modules/contrib/dev/ctools/tests/css_cache.test b/sites/all/modules/contrib/dev/ctools/tests/css_cache.test index 0b3528da..2aaa304d 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/css_cache.test +++ b/sites/all/modules/contrib/dev/ctools/tests/css_cache.test @@ -1,30 +1,28 @@ 'Ctools CSS cache', + 'name' => 'CSS cache', 'description' => 'Tests the custom CSS cache handler.', 'group' => 'ctools', + 'dependencies' => array('ctools'), ); } /** * {@inheritdoc} */ - public function setUp() { - parent::setUp('ctools'); + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + parent::setUp($modules); } /** diff --git a/sites/all/modules/contrib/dev/ctools/tests/ctools.drush.sh b/sites/all/modules/contrib/dev/ctools/tests/ctools.drush.sh old mode 100644 new mode 100755 diff --git a/sites/all/modules/contrib/dev/ctools/tests/ctools.plugins.test b/sites/all/modules/contrib/dev/ctools/tests/ctools.plugins.test index 7e866b16..a12d06af 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/ctools.plugins.test +++ b/sites/all/modules/contrib/dev/ctools/tests/ctools.plugins.test @@ -1,26 +1,43 @@ 'Get plugin info', 'description' => 'Verify that plugin type definitions can properly set and overide values.', 'group' => 'ctools', + 'dependencies' => array('ctools'), ); } - function setUp() { - // Additionally enable contact module. - parent::setUp('ctools', 'ctools_plugin_test'); + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + $modules[] = 'ctools_plugin_test'; + parent::setUp($modules); } + /** + * Assert helper to check that a specific plugin function exists. + * + * @param $module + * The module that owns the plugin. + * @param $type + * The type of plugin. + * @param $id + * The id of the specific plugin to load. + * @param $function + * The identifier of the function. For example, 'settings form'. + */ protected function assertPluginFunction($module, $type, $id, $function = 'function') { $func = ctools_plugin_load_function($module, $type, $id, $function); $this->assertTrue(function_exists($func), t('Plugin @plugin of plugin type @module:@type successfully retrieved @retrieved for @function.', array( @@ -32,6 +49,18 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase { ))); } + /** + * Assert helper to check that a specific plugin function does NOT exist. + * + * @param $module + * The module that owns the plugin. + * @param $type + * The type of plugin. + * @param $id + * The id of the specific plugin to load. + * @param $function + * The identifier of the function. For example, 'settings form'. + */ protected function assertPluginMissingFunction($module, $type, $id, $function = 'function') { $func = ctools_plugin_load_function($module, $type, $id, $function); $this->assertEqual($func, NULL, t('Plugin @plugin of plugin type @module:@type for @function with missing function successfully failed.', array( @@ -42,6 +71,18 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase { ))); } + /** + * Assert helper to check that a plugin can be loaded using a named class. + * + * @param $module + * The module that owns the plugin. + * @param $type + * The type of plugin. + * @param $id + * The id of the specific plugin to load. + * @param string $class + * The name of the PHP class to load. + */ protected function assertPluginClass($module, $type, $id, $class = 'handler') { $class_name = ctools_plugin_load_class($module, $type, $id, $class); $this->assertTrue(class_exists($class_name), t('Plugin @plugin of plugin type @module:@type successfully retrieved @retrieved for @class.', array( @@ -53,6 +94,18 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase { ))); } + /** + * Assert helper to check that a plugin DOES NOT contain the named class. + * + * @param $module + * The module that owns the plugin. + * @param $type + * The type of plugin. + * @param $id + * The id of the specific plugin to load. + * @param string $class + * The name of the PHP class to load. + */ protected function assertPluginMissingClass($module, $type, $id, $class = 'handler') { $class_name = ctools_plugin_load_class($module, $type, $id, $class); $this->assertEqual($class_name, NULL, t('Plugin @plugin of plugin type @module:@type for @class with missing class successfully failed.', array( @@ -66,7 +119,7 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase { /** * Test that plugins are loaded correctly. */ - function testPluginLoading() { + public function testPluginLoading() { ctools_include('plugins'); $module = 'ctools_plugin_test'; $type = 'not_cached'; @@ -81,7 +134,7 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase { $this->assertPluginClass($module, $type, 'plugin_array', 'handler'); $this->assertPluginClass($module, $type, 'plugin_array2', 'handler'); $this->assertPluginMissingClass($module, $type, 'plugin_array_dne', 'handler'); - // TODO Test big hook plugins. + // @todo Test big hook plugins. $type = 'cached'; @@ -95,6 +148,7 @@ class CtoolsPluginsGetInfoTestCase extends DrupalWebTestCase { $this->assertPluginClass($module, $type, 'plugin_array', 'handler'); $this->assertPluginClass($module, $type, 'plugin_array2', 'handler'); $this->assertPluginMissingClass($module, $type, 'plugin_array_dne', 'handler'); - // TODO Test big hook plugins. + // @todo Test big hook plugins. } + } diff --git a/sites/all/modules/contrib/dev/ctools/tests/ctools.test b/sites/all/modules/contrib/dev/ctools/tests/ctools.test new file mode 100644 index 00000000..4d748c09 --- /dev/null +++ b/sites/all/modules/contrib/dev/ctools/tests/ctools.test @@ -0,0 +1,239 @@ + 'Ctools module functions tests', + 'description' => 'Check functions in the ctools.module not otherwise tested.', + 'group' => 'ctools', + 'dependencies' => array('ctools'), + ); + } + + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + parent::setUp($modules); + } + + /** + * Test that the break phrase function behaves as expected. + */ + public function testBreakPhrase() { + $tests = array( + NULL => array('value' => array()), + '' => array('value' => array()), + '1' => array('operator' => 'and', 'value' => array(1)), + '99' => array('operator' => 'and', 'value' => array(99)), + '+1' => array('invalid_input' => TRUE, 'value' => array(-1)), + ' 1' => array('invalid_input' => TRUE, 'value' => array(-1)), + '1 ' => array('invalid_input' => TRUE, 'value' => array(-1)), + '-1' => array('invalid_input' => TRUE, 'value' => array(-1)), + '-99' => array('invalid_input' => TRUE, 'value' => array(-1)), + '1,2' => array('operator' => 'and', 'value' => array(1, 2)), + '1 2' => array('operator' => 'or', 'value' => array(1, 2)), + '1+2' => array('operator' => 'or', 'value' => array(1, 2)), + '1,2,3' => array('operator' => 'and', 'value' => array(1, 2, 3)), + '1 2 3' => array('operator' => 'or', 'value' => array(1, 2, 3)), + '1+2+3' => array('operator' => 'or', 'value' => array(1, 2, 3)), + '1 , 2 , 3' => array('invalid_input' => TRUE, 'value' => array(-1)), + '1 + 2 + 3' => array('invalid_input' => TRUE, 'value' => array(-1)), + '1,2,3,4,5,6,7,8,9' => array( + 'operator' => 'and', + 'value' => array(1, 2, 3, 4, 5, 6, 7, 8, 9), + ), + '1 2,3,4 5 6 7 8 9' => array('invalid_input' => TRUE, 'value' => array(-1)), + ); + + foreach ($tests as $string => $expected) { + $result = ctools_break_phrase($string); + $expected = (object) $expected; + $this->assertEqual($result, $expected, 'Break Phrase test patterns: ' . $string); + } + } + + /** + * Test that the (deprecated) getuserroles returns expected array. + */ + public function testGetUserRoles() { + $result = ctools_get_roles(); + $this->assertTrue(is_array($result), 'get_roles returns an array'); + + // A key-value array of integers. + foreach ($result as $k => $v) { + $this->assertTrue(is_numeric($k), 'Role key is numeric; ' . $k); + $this->assertTrue(is_string($v), 'Role id is string; ' . $v); + } + } + + /** + * Test the ctools_attach_js function returns the expected paths. + */ + public function testAttachJs() { + $taxonomy_path = drupal_get_path('module', 'taxonomy'); + $ctools_path = drupal_get_path('module', 'ctools'); + + // Func should probably do a different thing but this is current behaviour. + $path = ctools_attach_js(''); + $this->assertEqual($path, $ctools_path . '/js/.js', 'Attach an empty string'); + + $path = ctools_attach_js('foo'); + $this->assertEqual($path, $ctools_path . '/js/foo.js', 'Attach simple string'); + + $path = ctools_attach_js('foo', 'ctools', ''); + $this->assertEqual($path, $ctools_path . '//foo.js', 'Attach string with empty subdir'); + + $path = ctools_attach_js('foo', 'ctools', 'javascript'); + $this->assertEqual($path, $ctools_path . '/javascript/foo.js', 'Attach string with alternate subdir'); + + $path = ctools_attach_js('foo', 'taxonomy', 'javascript'); + $this->assertEqual($path, $taxonomy_path . '/javascript/foo.js', 'Attach string from different module'); + } + + /** + * Test the ctools_attach_css function returns the expected paths. + */ + public function testAttachCss() { + $taxonomy_path = drupal_get_path('module', 'taxonomy'); + $ctools_path = drupal_get_path('module', 'ctools'); + + // Func should probably do a different thing but this is current behaviour. + $path = ctools_attach_css(''); + $this->assertEqual($path, $ctools_path . '/css/.css', 'Attach empty string'); + + $path = ctools_attach_css('foo'); + $this->assertEqual($path, $ctools_path . '/css/foo.css', 'Attach simple string'); + + $path = ctools_attach_css('foo', 'ctools', ''); + $this->assertEqual($path, $ctools_path . '//foo.css', 'Attach string with empty subdir'); + + $path = ctools_attach_css('foo', 'ctools', 'theme'); + $this->assertEqual($path, $ctools_path . '/theme/foo.css', 'Attach string with alternate subdir'); + + $path = ctools_attach_css('foo', 'taxonomy', 'theme'); + $this->assertEqual($path, $taxonomy_path . '/theme/foo.css', 'Attach string from different module'); + } + + /** + * Test the ctools version compare function. + */ + public function testApiVersionCompare() { + // We're beyond version 1. + $ok = ctools_api_version('1.0'); + $this->assertTrue($ok, 'Check API version 1.0 is ok'); + + // We're beyond version 1.0.1 too. + $ok = ctools_api_version('1.0.1'); + $this->assertTrue($ok, 'Check API version 1.0.1 is ok'); + + // Not (yet) on api version 10. + $ok = ctools_api_version('10.0'); + $this->assertFalse($ok, 'Check API version 10.0 is not ok'); + + // We are (currently) between version 1.1 and version 4.0. + $ok = ctools_api_version('1.1', '4.0'); + $this->assertTrue($ok, 'Check API is between 1 and 4'); + } + + /** + * Test that the ctools_classs_add works. + */ + public function testClassesAdd() { + ctools_class_reset(); + + ctools_class_add('testclass'); + + $classes = ctools_get_classes(); + $this->assertEqual(is_array($classes), 1, 'Classes should be an array'); + $this->assertEqual(count($classes), 1, 'Classes array has one element'); + $this->assertEqual(count($classes['html']), 1, 'Classes array has element: html'); + $this->assertTrue(isset($classes['html']['add']), 'Classes array has element: html/add'); + $this->assertEqual($classes['html']['add'], array('testclass'), 'Classes array has expected value'); + + ctools_class_add('class2 class3'); + + $classes = ctools_get_classes(); + $this->assertEqual(is_array($classes), 1, 'Classes should be an array'); + $this->assertEqual(count($classes['html']), 1, 'Classes array has element: html'); + // TODO: An undesirable result: array('testclass', 'class2', 'class3') is better. + $this->assertEqual($classes['html']['add'], array( + 'testclass', + 'class2 class3', + ), 'Classes array has expected value'); + } + + /** + * Test that the ctools_classs_remove works. + */ + public function testClassesRemove() { + ctools_class_reset(); + + ctools_class_remove('testclass'); + + $classes = ctools_get_classes(); + $this->assertEqual(is_array($classes), 1, 'Classes should be an array'); + $this->assertEqual(count($classes), 1, 'Classes array has one element'); + $this->assertEqual(count($classes['html']), 1, 'Classes array has element: html'); + $this->assertTrue(isset($classes['html']['remove']), 'Classes array has element: html/remove'); + $this->assertEqual($classes['html']['remove'], array('testclass'), 'Classes array has expected value'); + + ctools_class_remove('class2 class3'); + + $classes = ctools_get_classes(); + $this->assertEqual(count($classes), 1, 'Classes array has one element'); + $this->assertEqual(count($classes['html']), 1, 'Classes array has element: html'); + // This is an undesirable result, is array('testclass', 'class2', 'class3') better. + $this->assertEqual($classes['html']['remove'], array( + 'testclass', + 'class2 class3', + ), 'Classes array has expected value'); + } + + /** + * Test that the ctools_classs_add and ctools_classs_remove interact well. + */ + public function testClassesAddRemove() { + ctools_class_reset(); + + ctools_class_add('testclass'); + ctools_class_remove('testclass'); + + $classes = ctools_get_classes(); + $this->assertTrue(isset($classes['html']['add']), 'Classes array has an add set'); + $this->assertEqual($classes['html']['add'], array('testclass'), 'testclass is in the add set'); + $this->assertTrue(isset($classes['html']['remove']), 'Classes array has a remove set'); + // TODO: Is it really good to let this happen? + $this->assertEqual($classes['html']['remove'], array('testclass'), 'testclass is in the remove set'); + } + + /** + * Test that the ctools_classs_add and ctools_classs_remove interact well .. 2. + */ + public function testClassesAddRemove2() { + ctools_class_reset(); + + ctools_class_add('class2 class3'); + ctools_class_remove('class3'); + + $classes = ctools_get_classes(); + $this->assertTrue(isset($classes['html']['add']), 'Classes array has an add set'); + $this->assertEqual($classes['html']['add'], array('class2 class3'), 'Added class2 class3 is in add set'); + $this->assertTrue(isset($classes['html']['remove']), 'Classes array has a remove set'); + // TODO: Is it really good to let this happen? + $this->assertEqual($classes['html']['remove'], array('class3'), 'class3 in remove set'); + } + +} diff --git a/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export.test b/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export.test index 6a062de7..ebeee496 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export.test +++ b/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export.test @@ -1,32 +1,34 @@ 'CTools export CRUD tests', + 'name' => 'Export CRUD', 'description' => 'Test the CRUD functionality for the ctools export system.', 'group' => 'ctools', ); } - protected function setUp() { - parent::setUp('ctools_export_test'); - $this->resetAll(); + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + $modules[] = 'ctools_export_test'; + parent::setUp($modules); } /** * Tests CRUD operation: Load. */ - function testCrudExportLoad() { + public function testCrudExportLoad() { $loaded_export = ctools_export_crud_load('ctools_export_test', 'database_test'); $expected_export = new stdClass(); @@ -47,7 +49,7 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { /** * Tests CRUD operation: Load multiple. */ - function testCrudExportLoadMultiple() { + public function testCrudExportLoadMultiple() { $exportable_names = array('database_test', 'overridden_test', 'default_test'); $loaded_exports = ctools_export_crud_load_multiple('ctools_export_test', $exportable_names); @@ -57,7 +59,7 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { /** * Tests CRUD operation: Load all. */ - function testCrudExportLoadAll() { + public function testCrudExportLoadAll() { $loaded_exports = ctools_export_crud_load_all('ctools_export_test'); $this->assertEqual(count($loaded_exports), 3, 'All exportables have been loaded.'); @@ -66,10 +68,10 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { /** * Tests CRUD operation: Save. */ - function testCrudExportSave() { + public function testCrudExportSave() { $default_export = ctools_export_crud_load('ctools_export_test', 'default_test'); - $this->assertTrue($default_export->in_code_only,'The loaded exportable is in code only.'); + $this->assertTrue($default_export->in_code_only, 'The loaded exportable is in code only.'); ctools_export_crud_save('ctools_export_test', $default_export); @@ -84,7 +86,7 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { /** * Tests CRUD operation: New. */ - function testCrudExportNew() { + public function testCrudExportNew() { // Default exportable with defualt values. $new_export = ctools_export_crud_new('ctools_export_test'); @@ -113,7 +115,7 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { /** * Tests CRUD operation: Revert. */ - function testCrudExportRevert() { + public function testCrudExportRevert() { // Load exportable, will come from database. $original_export = ctools_export_crud_load('ctools_export_test', 'overridden_test'); @@ -135,14 +137,15 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { // Check the exportable is now in_code_only. $this->assertTrue($default_export->in_code_only, 'The loaded exportable is in the database only.'); - // Make sure the default object loaded matches the same overridden one in the database. + // Make sure the default object loaded matches the same overridden one in + // the database. $this->assertEqual($original_export->machine, $default_export->machine, 'The default exportable has been loaded and matches the overridden exportable.'); } /** * Tests CRUD operation: Delete. */ - function testCrudExportDelete() { + public function testCrudExportDelete() { // Create a stub entry save it and delete it from the database. $new_export = ctools_export_crud_new('ctools_export_test'); ctools_export_crud_save('ctools_export_test', $new_export); @@ -158,6 +161,7 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { $machine = $database_export->machine; ctools_export_crud_delete('ctools_export_test', $database_export); + // Clear the exportable caches as it's been loaded above. ctools_export_load_object_reset('ctools_export_test'); $result = ctools_export_crud_load('ctools_export_test', $machine); @@ -168,7 +172,7 @@ class CtoolsExportCrudTestCase extends DrupalWebTestCase { /** * Tests CRUD operation: Set status. */ - function testCrudExportSetStatus() { + public function testCrudExportSetStatus() { // Database only object. $database_export = ctools_export_crud_load('ctools_export_test', 'database_test'); ctools_export_crud_disable('ctools_export_test', $database_export); diff --git a/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.default_ctools_export_tests.inc b/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.default_ctools_export_tests.inc index 9f2dd6c6..2f5ca584 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.default_ctools_export_tests.inc +++ b/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.default_ctools_export_tests.inc @@ -1,5 +1,9 @@ 'CTools export test data table', - 'export' => array( + 'description' => 'CTools export test data table', + 'export' => array( 'key' => 'machine', 'identifier' => 'ctools_export_test', 'default hook' => 'default_ctools_export_tests', @@ -53,7 +57,7 @@ function ctools_export_test_schema() { } /** - * Implments hook_install(); + * Implements hook_install(). */ function ctools_export_test_install() { $ctools_export_tests = array(); diff --git a/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.module b/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.module index 80f1adbb..9cd803ce 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.module +++ b/sites/all/modules/contrib/dev/ctools/tests/ctools_export_test/ctools_export_test.module @@ -1,5 +1,9 @@ array( 'defaults' => array( - 'bool' => true, + 'bool' => TRUE, 'string' => 'string', 'array' => array('some value'), ), @@ -50,6 +55,11 @@ function ctools_plugin_test_ctools_plugin_type() { ); } +/** + * Plugin callback. + * + * @see ctools_plugin_test_ctools_plugin_type() + */ function ctools_plugin_test_ctools_plugin_test_big_hook_cached() { return array( 'test1' => array( @@ -59,6 +69,11 @@ function ctools_plugin_test_ctools_plugin_test_big_hook_cached() { ); } +/** + * Plugin callback. + * + * @see ctools_plugin_test_ctools_plugin_type() + */ function ctools_plugin_test_ctools_plugin_test_big_hook_not_cached() { return array( 'test1' => array( @@ -68,5 +83,18 @@ function ctools_plugin_test_ctools_plugin_test_big_hook_not_cached() { ); } -function ctools_plugin_test_hook_cached_test() {} -function ctools_plugin_test_hook_not_cached_test() {} +/** + * Callback for the big_hook_cached plugin. + * + * @see ctools_plugin_test_ctools_plugin_test_big_hook_cached + */ +function ctools_plugin_test_hook_cached_test() { +} + +/** + * Callback for the big_hook_not_cached plugin. + * + * @see ctools_plugin_test_ctools_plugin_test_big_hook_not_cached() + */ +function ctools_plugin_test_hook_not_cached_test() { +} diff --git a/sites/all/modules/contrib/dev/ctools/tests/math_expression.test b/sites/all/modules/contrib/dev/ctools/tests/math_expression.test index 8810e8c4..b34fafb9 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/math_expression.test +++ b/sites/all/modules/contrib/dev/ctools/tests/math_expression.test @@ -1,24 +1,29 @@ 'CTools math expression tests', + 'name' => 'Math expressions', 'description' => 'Test the math expression library of ctools.', 'group' => 'ctools', + 'dependencies' => array('ctools'), ); } - public function setUp() { - parent::setUp('ctools', 'ctools_plugin_test'); + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + $modules[] = 'ctools_plugin_test'; + parent::setUp($modules); } /** @@ -35,6 +40,9 @@ class CtoolsMathExpressionTestCase extends DrupalWebTestCase { return $this->assert(abs($first - $second) <= $delta, $message ? $message : t('Value @first is equal to value @second.', array('@first' => var_export($first, TRUE), '@second' => var_export($second, TRUE))), $group); } + /** + * Test some arithmetic handling. + */ public function testArithmetic() { $math_expression = new ctools_math_expr(); @@ -66,10 +74,13 @@ class CtoolsMathExpressionTestCase extends DrupalWebTestCase { $this->assertEqual(pow($random_number_a, $random_number_b), $math_expression->e("$random_number_a ^ $random_number_b")); } + /** + * Test the basic built-in functions in the math expression library. + */ public function testBuildInFunctions() { $math_expression = new ctools_math_expr(); - // @todo: maybe run this code multiple times to test different values. + // @todo Maybe run this code multiple times to test different values. $random_double = $this->rand01(); $random_int = rand(5, 10); $this->assertFloat(sin($random_double), $math_expression->e("sin($random_double)")); @@ -94,6 +105,9 @@ class CtoolsMathExpressionTestCase extends DrupalWebTestCase { // $this->assertFloat(min($random_double_a, $random_double_b), $math_expression->e("min($random_double_a, $random_double_b)")); } + /** + * Test variable handling. + */ public function testVariables() { $math_expression = new ctools_math_expr(); @@ -108,6 +122,9 @@ class CtoolsMathExpressionTestCase extends DrupalWebTestCase { $this->assertEqual($random_number_a / $random_number_b, $math_expression->e("var / $random_number_b")); } + /** + * Test custom function handling. + */ public function testCustomFunctions() { $math_expression = new ctools_math_expr(); @@ -126,4 +143,5 @@ class CtoolsMathExpressionTestCase extends DrupalWebTestCase { // Use a custom function in another function. $this->assertEqual(($random_number_a * 2 + $random_number_b) * 2, $math_expression->e("f(g($random_number_a, $random_number_b))")); } + } diff --git a/sites/all/modules/contrib/dev/ctools/tests/math_expression_stack.test b/sites/all/modules/contrib/dev/ctools/tests/math_expression_stack.test index bdd46959..e1e587a2 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/math_expression_stack.test +++ b/sites/all/modules/contrib/dev/ctools/tests/math_expression_stack.test @@ -1,26 +1,34 @@ 'CTools math expression stack tests', + 'name' => 'Math expressions stack', 'description' => 'Test the stack class of the math expression library.', 'group' => 'ctools', + 'dependencies' => array('ctools'), ); } - public function setUp() { - parent::setUp('ctools', 'ctools_plugin_test'); + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + $modules[] = 'ctools_plugin_test'; + parent::setUp($modules); } + /** + * Test the math expression stack system. + */ public function testStack() { $stack = new ctools_math_expr_stack(); @@ -35,13 +43,15 @@ class CtoolsMathExpressionStackTestCase extends DrupalWebTestCase { $this->assertIdentical($value, $stack->pop()); $this->assertNull($stack->pop()); - // Add multiple elements and see whether they are returned in the right order. + // Add multiple elements and see whether they are returned in the right + // order. $values = array($this->randomName(), $this->randomName(), $this->randomName()); foreach ($values as $value) { $stack->push($value); } - // Test the different elements at different positions with the last() method. + // Test the different elements at different positions with the last() + // method. $count = count($values); foreach ($values as $key => $value) { $this->assertEqual($value, $stack->last($count - $key)); @@ -58,6 +68,6 @@ class CtoolsMathExpressionStackTestCase extends DrupalWebTestCase { $this->assertEqual($stack->pop(), $value); } $this->assertNull($stack->pop()); - } + } diff --git a/sites/all/modules/contrib/dev/ctools/tests/object_cache.test b/sites/all/modules/contrib/dev/ctools/tests/object_cache.test index 2e714d6b..87fa4153 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/object_cache.test +++ b/sites/all/modules/contrib/dev/ctools/tests/object_cache.test @@ -1,27 +1,34 @@ 'Ctools object cache storage', + 'name' => 'Object cache storage (UI tests)', 'description' => 'Verify that objects are written, readable and lockable.', 'group' => 'ctools', + 'dependencies' => array('ctools'), ); } - public function setUp() { - // Additionally enable ctools module. - parent::setUp('ctools'); + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + parent::setUp($modules); } + public function testObjectStorage() { + ctools_include('cache'); + $account1 = $this->drupalCreateUser(array()); $this->drupalLogin($account1); @@ -36,11 +43,11 @@ class CtoolsObjectCache extends DrupalWebTestCase { // TODO Test object locking somehow. // Object locking/testing works on session_id but simpletest uses // $this->session_id so can't be tested ATM. - ctools_object_cache_clear('testdata', 'one'); $this->assertFalse(ctools_object_cache_get('testdata', 'one'), 'Object cache data successfully cleared'); // TODO Test ctools_object_cache_clear_all somehow... // ctools_object_cache_clear_all requires session_id funtionality as well. } + } diff --git a/sites/all/modules/contrib/dev/ctools/tests/object_cache_unit.test b/sites/all/modules/contrib/dev/ctools/tests/object_cache_unit.test new file mode 100644 index 00000000..68b73503 --- /dev/null +++ b/sites/all/modules/contrib/dev/ctools/tests/object_cache_unit.test @@ -0,0 +1,141 @@ + 'Object cache storage (unit tests)', + 'description' => 'Verify that objects are written, readable and lockable.', + 'group' => 'ctools', + 'dependencies' => array('ctools'), + ); + } + + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + parent::setUp($modules); + } + + /** + * Check that the supplied array looks like a ctools cache plugin. + * + * @param mixed $p + * The value to check. + * @param string $msg + * Prefix of the assertion message. + */ + public function assertValidCachePlugin($p, $msg) { + $this->assertTrue(is_array($p), $msg . ': plugin is an array'); + + $this->assertEqual($p['plugin type'], 'cache', $msg . ': type is cache'); + + $this->assertTrue(array_key_exists('title', $p), $msg . ': title element exists'); + $this->assertTrue(!empty($p['title']) && is_string($p['title']), $msg . ': title is a string'); + + $this->assertTrue(array_key_exists('cache get', $p), $msg . ': has a get function'); + $this->assertTrue(!empty($p['cache get']) && is_callable($p['cache get']), $msg . ': get is executable'); + + $this->assertTrue(array_key_exists('cache set', $p), $msg . ': has a set function'); + $this->assertTrue(!empty($p['cache set']) && is_callable($p['cache set']), $msg . ': set is executable'); + + // @todo Clear is required by the spec (cache.inc:40..48): but export_ui + // cache doesn't implement it. Enable the assertions when that problem is + // solved. + // $this->assertTrue(array_key_exists('cache clear', $p), $msg . ': has a clear function'); + // $this->assertTrue(is_callable($p['cache clear']), $msg . ': clear is executable'); + // @todo Break is optional acc'd to spec but does anything implement it? + $this->assertTrue(!array_key_exists('cache break', $p) || is_callable($p['cache break']), $msg . ': break is executable'); + + // @todo Finalize is optional so don't fail if not there?? + $this->assertTrue(!array_key_exists('cache finalize', $p) || is_callable($p['cache finalize']), $msg . ': finalize is executable'); + } + + /** + * Check the return value of the ctools_cache_find_plugin function. + * + * @param mixed $p + * The value to check. + * @param string $msg + * Prefix of the assertion message. + */ + public function assertPluginNotFound($p, $msg) { + $this->assertTrue(is_array($p), $msg . ': is an array'); + $plugin = array_shift($p); + $this->assertNull($plugin, $msg . ': no plugin info'); + $data = array_shift($p); + $this->assertTrue(empty($data) || is_string($data), $msg . ': data string-like'); + $this->assertTrue(empty($p), $msg . ': just two elements'); + } + + /** + * Check the return value of the ctools_cache_find_plugin function. + * + * @param mixed $p + * The value to check. + * @param string $msg + * Prefix of the assertion message. + */ + public function assertPluginFound($p, $msg) { + $this->assertTrue(is_array($p), $msg . ': is an array'); + $plugin = array_shift($p); + $this->assertTrue(is_array($plugin), $msg . ': has plugin data'); + $data = array_shift($p); + $this->assertTrue(empty($data) || is_string($data), $msg . ': data is string-like'); + $this->assertTrue(empty($p), $msg . ': just two elements'); + } + + /** + * Test to see that we can find the standard simple plugin. + */ + public function testFindSimpleCachePlugin() { + ctools_include('cache'); + + // The simple plugin. + $plugin = ctools_cache_find_plugin('simple'); + $this->assertPluginFound($plugin, 'The Simple Cache plugin is present'); + $this->assertValidCachePlugin($plugin[0], 'The Simple Cache plugin'); + + // The simple plugin, with ::. + $plugin = ctools_cache_find_plugin('simple::data'); + $this->assertPluginFound($plugin, 'The Simple Cache plugin is present, with data'); + } + + /** + * Test to see that we can find the standard export_ui plugin. + */ + public function testFindExportUICachePlugin() { + ctools_include('cache'); + + // The export plugin. + $plugin = ctools_cache_find_plugin('export_ui'); + $this->assertPluginFound($plugin, 'The Export UI Cache plugin is present'); + $this->assertValidCachePlugin($plugin[0], 'The Export Cache plugin'); + + // The export plugin, with ::. + $plugin = ctools_cache_find_plugin('export_ui::data'); + $this->assertTrue(is_array($plugin), 'The Export UI Cache plugin is present, with data'); + } + + /** + * Test to see that we don't find plugins that aren't there. + */ + public function testFindFoobarbazCachePlugin() { + ctools_include('cache'); + + // An imaginary foobarbaz plugin. + $plugin = ctools_cache_find_plugin('foobarbaz'); + $this->assertPluginNotFound($plugin, 'The Foobarbaz Cache plugin is absent'); + $plugin = ctools_cache_find_plugin('foobarbaz::data'); + $this->assertPluginNotFound($plugin, 'The Foobarbaz Cache plugin is absent, with data'); + } + +} diff --git a/sites/all/modules/contrib/dev/ctools/tests/page_tokens.test b/sites/all/modules/contrib/dev/ctools/tests/page_tokens.test new file mode 100644 index 00000000..7d95d9ae --- /dev/null +++ b/sites/all/modules/contrib/dev/ctools/tests/page_tokens.test @@ -0,0 +1,136 @@ + 'Page token processing', + 'description' => 'Verify that page tokens can be set and read.', + 'group' => 'ctools', + 'dependencies' => array('ctools'), + ); + } + + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + $modules[] = 'ctools'; + parent::setUp($modules); + + // Start each test anew. + ctools_reset_page_tokens(); + } + + /** + * Test that we can set page tokens. + */ + public function testSetPageToken() { + ctools_set_page_token('id', 'variable', 'test'); + + $tokens = ctools_set_page_token(); + $this->assertTrue(is_array($tokens) && count($tokens) === 1, 'Page tokens no longer empty.'); + $this->assertEqual($tokens['id'], array('variable', 'test'), 'Page token has correct value.'); + } + + /** + * Test that we can set page tokens. + */ + public function testSetVariableToken() { + $string = ctools_set_variable_token('title'); + $tokens = ctools_set_page_token(); + + $this->assertTrue(is_array($tokens) && count($tokens) === 1, 'Page tokens no longer empty'); + $this->assertEqual($tokens[$string], array('variable', 'title'), 'Page tokens no longer empty'); + } + + /** + * Test that we can set page tokens. + */ + public function testReplaceVariableToken() { + $string = ctools_set_variable_token('title'); + $this->assertEqual($string, '', 'Expected form of token was found'); + + $elements = array( + '#type' => 'container', + '#attributes' => array('class' => array('test')), + 'title' => '

    Title

    ', + 'content' => array( + '#type' => 'markup', + '#markup' => t('This is my test markup'), + '#prefix' => $string, + ), + 'link' => array( + '#type' => 'link', + '#title' => t('My link'), + '#href' => 'node/1', + ), + ); + $markup = '
    This is my test markupMy link
    '; + + $new_markup = ctools_page_token_processing($markup, $elements); + + $this->assertTrue(is_string($new_markup) && strlen($new_markup) > 1, 'Should return string'); + + $this->assertTrue(strstr($new_markup, '

    '), 'Variable Token Markup should contain h2 element'); + $this->assertFalse(strstr($new_markup, 'ctools-page-title'), 'Variable Token Markup should not contain comment element'); + } + + /** + * Test that we can set page tokens. + */ + public function testReplaceCallbackToken() { + $string = ctools_set_callback_token('title', 'test_ctools_page_callback_token'); + $this->assertEqual($string, '', 'Expected form of token was found'); + + $elements = array( + '#type' => 'container', + '#attributes' => array('class' => array('test')), + 'content' => array( + '#type' => 'markup', + '#markup' => t('This is my test markup'), + '#prefix' => $string, + ), + 'link' => array( + '#type' => 'link', + '#title' => t('My link'), + '#href' => 'node/1', + ), + ); + $markup = '
    This is my test markupMy link
    '; + + $new_markup = ctools_page_token_processing($markup, $elements); + + $this->assertTrue(is_string($new_markup) && strlen($new_markup) > 1, 'Should return a non-empty string'); + + $this->assertTrue(strstr($new_markup, '

    '), 'Callback Token Markup should contain h2 element'); + $this->assertFalse(strstr($new_markup, 'ctools-page-title'), 'Callback Token Markup should not contain comment element'); + } + +} + +/** + * + * @param $elements + * + * @return string + */ +function test_ctools_page_callback_token($elements) { + // Check that 'elements' array looks good. + if (isset($elements['content'])) { + return '

    Title

    '; + } + else { + return ''; + } +} diff --git a/sites/all/modules/contrib/dev/ctools/tests/plugins/cached/ctoolsCachedPluginArray.class.php b/sites/all/modules/contrib/dev/ctools/tests/plugins/cached/ctoolsCachedPluginArray.class.php index ea087fa6..c6753adc 100644 --- a/sites/all/modules/contrib/dev/ctools/tests/plugins/cached/ctoolsCachedPluginArray.class.php +++ b/sites/all/modules/contrib/dev/ctools/tests/plugins/cached/ctoolsCachedPluginArray.class.php @@ -1,4 +1,5 @@ $context_info) { if (!strpos($context_info, '.')) { - // old skool: support pre-converter contexts as well. + // Old skool: support pre-converter contexts as well. $cid = $context_info; $converter = ''; } @@ -150,7 +150,7 @@ function views_content_views_content_type_render($subtype, $conf, $panel_args, $ $block = new stdClass(); $block->module = 'views'; - $block->delta = $view->name . '-' . $view->current_display; + $block->delta = $view->name . '-' . $view->current_display; if (!empty($conf['link_to_view'])) { $block->title_link = $view->get_url(); @@ -165,7 +165,7 @@ function views_content_views_content_type_render($subtype, $conf, $panel_args, $ // pager type that Views uses. if ($conf['override_pager_settings']) { if (method_exists($view, 'init_pager')) { - // Views 3 version + // Views 3 version. $view->set_items_per_page($conf['nodes_per_page']); $view->set_offset($conf['offset']); @@ -237,7 +237,7 @@ function views_content_views_select_display($form, &$form_state) { '#type' => 'select', '#title' => t('Display'), '#options' => $displays, - '#description' => t('Choose which display of this view you wish to use.') + '#description' => t('Choose which display of this view you wish to use.'), ); return $form; @@ -271,7 +271,6 @@ function views_content_views_content_type_edit_form($form, &$form_state) { // and check for that and forcibly set them to the right converter so that // it doesn't get changed to some whacky default. Oooor just let it get changed // to 'no context', I suppose. - $required = array(); if (isset($view->display_handler) && $arguments = $view->display_handler->get_handlers('argument')) { foreach ($arguments as $arg) { @@ -434,7 +433,7 @@ function views_content_views_content_type_admin_info($subtype, $conf, $contexts) } if (!strpos($context_info, '.')) { - // old skool: support pre-converter contexts as well. + // Old skool: support pre-converter contexts as well. $cid = $context_info; $converter = ''; } @@ -446,8 +445,10 @@ function views_content_views_content_type_admin_info($subtype, $conf, $contexts) $converters = ctools_context_get_converters($cid . '.', $contexts[$cid]); $converter = !empty($converters[$context_info]) ? $converters[$context_info] : t('Default'); $block->content .= '
  • ' . t('Argument @arg using context @context converted into @converter', array( - '@arg' => $argument->ui_name(), '@context' => $contexts[$cid]->get_identifier(), - '@converter' => $converter)) . '
  • '; + '@arg' => $argument->ui_name(), + '@context' => $contexts[$cid]->get_identifier(), + '@converter' => $converter, + )) . ''; } $argument = next($arguments); } @@ -494,6 +495,7 @@ function views_content_views_content_type_admin_info($subtype, $conf, $contexts) * versions it was the view name with a dash and the display ID. * If this is the case, we can use it to correct the 'display' setting * in the $conf. + * * @return * The $view with the initialized display. If the $view could not be * loaded, the name attempted will be loaded for use in errors. @@ -534,7 +536,6 @@ function _views_content_views_update_conf(&$conf, $subtype) { $view->set_display($display); // $view->current_display will now reflect this value. - // If set NOT to override, go ahead and refresh from the view. if (empty($conf['override_pager_settings'])) { if (method_exists($view, 'init_pager')) { diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_attachments.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_attachments.inc index e938f539..f399feaa 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_attachments.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_attachments.inc @@ -25,7 +25,7 @@ function views_content_views_attachments_content_type_render($subtype, $conf, $p } // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'views_attachments'; $block->delta = $context->argument; $block->title = ''; @@ -41,7 +41,6 @@ function views_content_views_attachments_content_type_render($subtype, $conf, $p return $block; } - function views_content_views_attachments_content_type_edit_form($form, &$form_state) { $conf = $form_state['conf']; diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_empty.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_empty.inc index 4664d65d..01e95c32 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_empty.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_empty.inc @@ -22,7 +22,7 @@ function views_content_views_empty_content_type_render($subtype, $conf, $panel_a } // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'views_empty'; $block->delta = $context->argument; $block->title = ''; diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_exposed.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_exposed.inc index 93371e21..f6d019fb 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_exposed.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_exposed.inc @@ -22,7 +22,7 @@ function views_content_views_exposed_content_type_render($subtype, $conf, $panel } // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'views_exposed'; $block->delta = $context->argument; $block->title = ''; diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_feed.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_feed.inc index f2fdb8af..774d593f 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_feed.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_feed.inc @@ -22,7 +22,7 @@ function views_content_views_feed_content_type_render($subtype, $conf, $panel_ar } // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'views_feed'; $block->delta = $context->argument; $block->title = ''; diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_footer.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_footer.inc index 81c87a3a..fc3d01b8 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_footer.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_footer.inc @@ -22,7 +22,7 @@ function views_content_views_footer_content_type_render($subtype, $conf, $panel_ } // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'views_footer'; $block->delta = $context->argument; $block->title = ''; diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_header.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_header.inc index f144d29f..b42806fd 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_header.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_header.inc @@ -22,7 +22,7 @@ function views_content_views_header_content_type_render($subtype, $conf, $panel_ } // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'views_header'; $block->delta = $context->argument; $block->title = ''; diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_pager.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_pager.inc index faa65692..f5b380e0 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_pager.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_pager.inc @@ -22,7 +22,7 @@ function views_content_views_pager_content_type_render($subtype, $conf, $panel_a } // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'views_pager'; $block->delta = $context->argument; $block->title = ''; diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_panes.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_panes.inc index 1147d26c..07e93f7a 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_panes.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_panes.inc @@ -143,27 +143,150 @@ function views_content_views_panes_content_type_render($subtype, $conf, $panel_a return; } - $conf['pane_contexts'] = $contexts; - $conf['panel_args'] = $panel_args; $view->display_handler->set_pane_conf($conf); + $args = array(); + $arguments = $view->display_handler->get_option('arguments'); + + $context_keys = isset($conf['context']) ? $conf['context'] : array(); + foreach ($view->display_handler->get_argument_input() as $id => $argument) { + switch ($argument['type']) { + case 'context': + $key = array_shift($context_keys); + if (isset($contexts[$key])) { + if (strpos($argument['context'], '.')) { + list($context, $converter) = explode('.', $argument['context'], 2); + $args[] = ctools_context_convert_context($contexts[$key], $converter, array('sanitize' => FALSE)); + } + else { + $args[] = $contexts[$key]->argument; + } + } + else { + $args[] = isset($arguments[$id]['exception']['value']) ? $arguments[$id]['exception']['value'] : 'all'; + } + break; + + case 'fixed': + $args[] = $argument['fixed']; + break; + + case 'panel': + $args[] = isset($panel_args[$argument['panel']]) ? $panel_args[$argument['panel']] : NULL; + break; + + case 'user': + $args[] = (isset($conf['arguments'][$id]) && $conf['arguments'][$id] !== '') ? ctools_context_keyword_substitute($conf['arguments'][$id], array(), $contexts) : NULL; + break; + + case 'wildcard': + // Put in the wildcard. + $args[] = isset($arguments[$id]['wildcard']) ? $arguments[$id]['wildcard'] : '*'; + break; + + case 'none': + default: + // Put in NULL. + // views.module knows what to do with NULL (or missing) arguments. + $args[] = NULL; + break; + } + } + + // Remove any trailing NULL arguments as these are non-args: + while (count($args) && end($args) === NULL) { + array_pop($args); + } + + $view->set_arguments($args); + $allow = $view->display_handler->get_option('allow'); + + if (!empty($conf['path'])) { + $conf['path'] = ctools_context_keyword_substitute($conf['path'], array(), $contexts); + } if ($allow['path_override'] && !empty($conf['path'])) { $view->override_path = $conf['path']; } - else if ($path = $view->display_handler->get_option('inherit_panels_path')) { - $view->override_path = $_GET['q']; + elseif ($path = $view->display_handler->get_option('inherit_panels_path')) { + if (drupal_is_front_page()) { + $view->override_path = ''; + } + else { + $view->override_path = $_GET['q']; + } } $block = new stdClass(); $block->module = 'views'; - $block->delta = $view->name . '-' . $display; + $block->delta = $view->name . '-' . $display; if (($allow['link_to_view'] && !empty($conf['link_to_view'])) || (!$allow['link_to_view'] && $view->display_handler->get_option('link_to_view'))) { $block->title_link = $view->get_url(); } + // More link. + if ($allow['more_link']) { + if (empty($conf['more_link'])) { + $view->display_handler->set_option('use_more', FALSE); + } + else { + $view->display_handler->set_option('use_more', TRUE); + // Make sure the view runs the count query so we know whether or not the + // more link applies. + $view->get_total_rows = TRUE; + } + } + + if ($allow['items_per_page'] && isset($conf['items_per_page'])) { + $view->set_items_per_page($conf['items_per_page']); + } + + if ($allow['offset']) { + $view->set_offset($conf['offset']); + } + + if ($allow['use_pager']) { + // Only set use_pager if they differ, this way we can avoid overwriting the + // pager type that Views uses. + $pager = $view->display_handler->get_option('pager'); + if ($conf['use_pager'] && ($pager['type'] == 'none' || $pager['type'] == 'some')) { + $pager['type'] = 'full'; + } + elseif (!$conf['use_pager'] && $pager['type'] != 'none' && $pager['type'] != 'some') { + $pager['type'] = $view->get_items_per_page() || !empty($pager['options']['items_per_page']) ? 'some' : 'none'; + } + + if ($conf['use_pager']) { + if (!isset($pager['options']['id']) || (isset($conf['pager_id']) && $pager['options']['id'] != $conf['pager_id'])) { + $pager['options']['id'] = (int) $conf['pager_id']; + } + } + + $view->display_handler->set_option('pager', $pager); + } + + if ($allow['fields_override']) { + if ($conf['fields_override']) { + $fields = $view->get_items('field'); + foreach ($fields as $field => $field_display) { + $fields[$field]['exclude'] = empty($conf['fields_override'][$field]); + } + $view->display_handler->set_option('fields', $fields); + + } + } + + if ($allow['exposed_form'] && !empty($conf['exposed'])) { + foreach ($conf['exposed'] as $filter_name => $filter_value) { + if (!is_array($filter_value)) { + $conf['exposed'][$filter_name] = ctools_context_keyword_substitute($filter_value, array(), $contexts); + } + } + $view->set_exposed_input($conf['exposed']); + } + $stored_feeds = drupal_add_feed(); $block->content = $view->preview(); @@ -263,7 +386,7 @@ function views_content_views_panes_content_type_edit_form($form, &$form_state) { ); } } - if ($allow['link_to_view'] ) { + if ($allow['link_to_view']) { $form['link_to_view'] = array( '#type' => 'checkbox', '#default_value' => isset($conf['link_to_view']) ? $conf['link_to_view'] : $view->display_handler->get_option('link_to_view'), @@ -314,7 +437,7 @@ function views_content_views_panes_content_type_edit_form($form, &$form_state) { $form['use_pager'] = array( '#type' => 'checkbox', '#title' => t('Use pager'), - '#default_value' => $conf['use_pager'], + '#default_value' => $conf['use_pager'], '#id' => 'use-pager-checkbox', '#prefix' => '
    ', ); @@ -435,7 +558,7 @@ function views_content_views_panes_content_type_edit_form($form, &$form_state) { $form['exposed']['sort_order'] = $exposed_form['sort_order']; } - // Add the view object to the form to allow additional customization + // Add the view object to the form to allow additional customization. $form_state['view'] = $view; return $form; @@ -447,7 +570,8 @@ function views_content_views_panes_content_type_edit_form($form, &$form_state) { function views_content_views_panes_content_type_edit_form_submit(&$form, &$form_state) { // Copy everything from our defaults. $keys = array('link_to_view', 'more_link', 'feed_icons', 'use_pager', - 'pager_id', 'items_per_page', 'offset', 'path_override', 'path', 'arguments', 'fields_override', 'exposed'); + 'pager_id', 'items_per_page', 'offset', 'path_override', 'path', 'arguments', 'fields_override', 'exposed', + ); foreach ($keys as $key) { if (isset($form_state['values'][$key])) { @@ -456,7 +580,6 @@ function views_content_views_panes_content_type_edit_form_submit(&$form, &$form_ } } - /** * Returns the administrative title for a type. */ @@ -491,21 +614,21 @@ function views_content_views_panes_content_type_admin_info($subtype, $conf, $con $view->set_display($display_name); views_content_views_panes_add_defaults($conf, $view); - // Add arguments first + // Add arguments first. if (!empty($conf['arguments'])) { $keys = array_keys($conf['arguments']); $values = array_values($conf['arguments']); $argument_input = $view->display_handler->get_option('argument_input'); foreach ($conf['arguments'] as $key => $value) { - if (!empty($value)){ + if (!empty($value)) { $label = $argument_input[$key]['label']; $info[] = $label . ': ' . $value; } } } - $block = new stdClass; + $block = new stdClass(); if ($info) { $block->title = array_shift($info); diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_row.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_row.inc index 9672d020..16b97dc7 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_row.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_row.inc @@ -35,7 +35,7 @@ function views_content_views_row_content_type_render($subtype, $conf, $panel_arg } // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'views_row'; $block->delta = $context->argument; $block->title = ''; @@ -91,7 +91,7 @@ function views_content_views_row_content_type_render($subtype, $conf, $panel_arg 'view' => $view, 'options' => $plugin->options, 'rows' => $rows, - 'title' => $title + 'title' => $title, ) ); } diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_view.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_view.inc index dfb1175c..54eec085 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_view.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/content_types/views_view.inc @@ -22,7 +22,7 @@ function views_content_views_view_content_type_render($subtype, $conf, $panel_ar } // Build the content type block. - $block = new stdClass(); + $block = new stdClass(); $block->module = 'views_view'; $block->delta = $context->argument; $block->title = ''; diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/contexts/view.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/contexts/view.inc index 1e926e45..6380478a 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/contexts/view.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/contexts/view.inc @@ -2,7 +2,6 @@ /** * @file - * * Plugin to provide a node context. A node context is a node wrapped in a * context object that can be utilized by anything that accepts contexts. */ @@ -88,7 +87,7 @@ function views_content_context_view_create($empty, $data = NULL, $conf = FALSE, $data->set_display($display_id); } } - else if (!empty($plugin['view name'])) { + elseif (!empty($plugin['view name'])) { $data = views_get_view($plugin['view name']); $data->set_display($plugin['view display id']); } @@ -101,7 +100,7 @@ function views_content_context_view_create($empty, $data = NULL, $conf = FALSE, // $output = views_content_context_get_output($context); // $view = $output['view']; // @endcode - $context->data = array( + $context->data = array( 'name' => $data->name, 'display' => $data->current_display, 'args' => $data->args, @@ -158,8 +157,7 @@ function views_content_context_view_settings_form_validate($form, &$form_state) * Provide a list of ways that this context can be converted to a string. */ function views_content_context_view_convert_list() { - $list = array( - ); + $list = array(); return $list; } @@ -171,4 +169,3 @@ function views_content_context_view_convert($context, $type) { switch ($type) { } } - diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/relationships/node_from_view.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/relationships/node_from_view.inc index 0f3fa8e0..f54cbc6b 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/relationships/node_from_view.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/relationships/node_from_view.inc @@ -33,7 +33,7 @@ function views_content_node_from_view_context($context, $conf, $placeholder = FA views_content_context_get_output($context); $row = intval($conf['row']) - 1; - if (isset($view->result[$row])) { + if (isset($view->result[$row]) && isset($view->base_field) && isset($view->result[$row]->{$view->base_field})) { $nid = $view->result[$row]->{$view->base_field}; if ($nid) { $node = node_load($nid); diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/relationships/view_from_argument.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/relationships/view_from_argument.inc index cefc6dba..cabd329b 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/relationships/view_from_argument.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/relationships/view_from_argument.inc @@ -73,7 +73,7 @@ function views_content_view_from_argument_context($contexts, $conf) { foreach ($data->display_handler->get_argument_input() as $id => $argument) { if ($argument['type'] == 'context') { $key = array_shift($context_keys); - if (isset($contexts [$key])) { + if (isset($contexts[$key])) { if (strpos($argument['context'], '.')) { list($context, $converter) = explode('.', $argument['context'], 2); $args[] = ctools_context_convert_context($contexts[$key], $converter, array('sanitize' => FALSE)); @@ -84,7 +84,7 @@ function views_content_view_from_argument_context($contexts, $conf) { } } } - // remove any trailing NULL arguments as these are non-args: + // Remove any trailing NULL arguments as these are non-args: while (count($args) && end($args) === NULL) { array_pop($args); } diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content.views.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content.views.inc index 186ef4f7..20b65a26 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content.views.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content.views.inc @@ -6,7 +6,7 @@ */ /** - * Implements hook_views_plugins + * Implements hook_views_plugins(). */ function views_content_views_plugins() { return array( diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content_plugin_display_ctools_context.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content_plugin_display_ctools_context.inc index 967f2fa8..87ee291a 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content_plugin_display_ctools_context.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content_plugin_display_ctools_context.inc @@ -1,4 +1,5 @@ '', 'translatable' => TRUE); @@ -47,12 +53,13 @@ class views_content_plugin_display_ctools_context extends views_plugin_display { /** * The display block handler returns the structure necessary for a block. */ - function execute() { + public function execute() { $this->executing = TRUE; return $this->view->render(); } - function preview() { + + public function preview() { $this->previewing = TRUE; return $this->view->render(); } @@ -60,7 +67,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display { /** * Render this display. */ - function render() { + public function render() { if (!empty($this->previewing)) { return theme($this->theme_functions(), array('view' => $this->view)); } @@ -71,7 +78,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display { $hooks = theme_get_registry(); $info = $hooks[$this->definition['theme']]; if (!empty($info['file'])) { - @include_once('./' . $info['path'] . '/' . $info['file']); + @include_once './' . $info['path'] . '/' . $info['file']; } $this->variables = array('view' => &$this->view); @@ -92,7 +99,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display { * * This output is returned as an array. */ - function options_summary(&$categories, &$options) { + public function options_summary(&$categories, &$options) { // It is very important to call the parent function here: parent::options_summary($categories, $options); @@ -135,7 +142,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display { /** * Provide the default form for setting options. */ - function options_form(&$form, &$form_state) { + public function options_form(&$form, &$form_state) { // It is very important to call the parent function here: parent::options_form($form, $form_state); switch ($form_state['section']) { @@ -143,6 +150,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display { // This just overwrites the existing row_plugin which is using the wrong options. $form['row_plugin']['#options'] = views_fetch_plugin_names('row', 'normal', array($this->view->base_table)); break; + case 'admin_title': $form['#title'] .= t('Administrative title'); @@ -152,6 +160,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display { '#description' => t('This is the title that will appear for this view context in the configure context dialog. If left blank, the view name will be used.'), ); break; + case 'inherit_panels_path': $form['#title'] .= t('Inherit path from panel display'); @@ -162,6 +171,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display { '#description' => t('If yes, all links generated by Views, such as more links, summary links, and exposed input links will go to the panels display path, not the view, if the display has a path.'), ); break; + case 'argument_input': $form['#title'] .= t('Choose the data source for view arguments'); $argument_input = $this->get_argument_input(); @@ -216,7 +226,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display { * Perform any necessary changes to the form values prior to storage. * There is no need for this function to actually store the data. */ - function options_submit(&$form, &$form_state) { + public function options_submit(&$form, &$form_state) { // It is very important to call the parent function here: parent::options_submit($form, $form_state); switch ($form_state['section']) { @@ -234,7 +244,7 @@ class views_content_plugin_display_ctools_context extends views_plugin_display { * the arguments doesn't cause the argument input field to just * break. */ - function get_argument_input() { + public function get_argument_input() { $arguments = $this->get_option('argument_input'); $handlers = $this->get_handlers('argument'); @@ -260,7 +270,8 @@ class views_content_plugin_display_ctools_context extends views_plugin_display { return $output; } - function get_path() { + + public function get_path() { if ($this->get_option('link_display') == 'custom_url' && $override_path = $this->get_option('link_url')) { return $override_path; } @@ -269,4 +280,5 @@ class views_content_plugin_display_ctools_context extends views_plugin_display { } return parent::get_path(); } + } diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content_plugin_display_panel_pane.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content_plugin_display_panel_pane.inc index bfc77e03..05d3478f 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content_plugin_display_panel_pane.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content_plugin_display_panel_pane.inc @@ -8,10 +8,11 @@ class views_content_plugin_display_panel_pane extends views_plugin_display { * If this variable is true, this display counts as a panel pane. We use * this variable so that other modules can create alternate pane displays. */ - var $panel_pane_display = TRUE; - var $has_pane_conf = NULL; + public $panel_pane_display = TRUE; + public $has_pane_conf = NULL; - function option_definition() { + + public function option_definition() { $options = parent::option_definition(); $options['pane_title'] = array('default' => '', 'translatable' => TRUE); @@ -34,7 +35,7 @@ class views_content_plugin_display_panel_pane extends views_plugin_display { 'title_override' => array('default' => FALSE), 'exposed_form' => array('default' => FALSE), 'fields_override' => array('default' => FALSE), - ), + ), ); $options['argument_input'] = array('default' => array()); @@ -44,16 +45,14 @@ class views_content_plugin_display_panel_pane extends views_plugin_display { return $options; } - function has_pane_conf() { + + public function has_pane_conf() { return isset($this->has_pane_conf); } - function set_pane_conf($conf = array(), $set_cache = TRUE) { + + public function set_pane_conf($conf = array()) { $this->set_option('pane_conf', $conf); - $this->view->dom_id = !empty($this->view->dom_id) ? $this->view->dom_id : md5($this->view->name . REQUEST_TIME . rand()); - if ($set_cache) { - cache_set('view_panel_pane_' . $this->view->dom_id, $conf); - } $this->has_pane_conf = TRUE; } @@ -62,7 +61,7 @@ class views_content_plugin_display_panel_pane extends views_plugin_display { * * This output is returned as an array. */ - function options_summary(&$categories, &$options) { + public function options_summary(&$categories, &$options) { // It is very important to call the parent function here: parent::options_summary($categories, $options); @@ -151,7 +150,7 @@ class views_content_plugin_display_panel_pane extends views_plugin_display { /** * Provide the default form for setting options. */ - function options_form(&$form, &$form_state) { + public function options_form(&$form, &$form_state) { // It is very important to call the parent function here: parent::options_form($form, $form_state); @@ -181,6 +180,7 @@ class views_content_plugin_display_panel_pane extends views_plugin_display { '#options' => $options, ); break; + case 'pane_title': $form['#title'] .= t('Administrative title'); @@ -322,7 +322,7 @@ class views_content_plugin_display_panel_pane extends views_plugin_display { * Perform any necessary changes to the form values prior to storage. * There is no need for this function to actually store the data. */ - function options_submit(&$form, &$form_state) { + public function options_submit(&$form, &$form_state) { // It is very important to call the parent function here: parent::options_submit($form, $form_state); switch ($form_state['section']) { @@ -344,7 +344,7 @@ class views_content_plugin_display_panel_pane extends views_plugin_display { * the arguments doesn't cause the argument input field to just * break. */ - function get_argument_input() { + public function get_argument_input() { $arguments = $this->get_option('argument_input'); $handlers = $this->get_handlers('argument'); @@ -372,7 +372,8 @@ class views_content_plugin_display_panel_pane extends views_plugin_display { return $output; } - function use_more() { + + public function use_more() { $allow = $this->get_option('allow'); if (!$allow['more_link'] || !$this->has_pane_conf()) { return parent::use_more(); @@ -381,21 +382,24 @@ class views_content_plugin_display_panel_pane extends views_plugin_display { return (bool) $conf['more_link']; } - function get_path() { + + public function get_path() { if (empty($this->view->override_path)) { return parent::get_path(); } return $this->view->override_path; } - function get_url() { + + public function get_url() { if ($this->get_option('inherit_panels_path')) { return $this->get_path(); } return parent::get_url(); } - function uses_exposed_form_in_block() { + + public function uses_exposed_form_in_block() { // We'll always allow the exposed form in a block, regardless of path. return TRUE; } @@ -409,160 +413,11 @@ class views_content_plugin_display_panel_pane extends views_plugin_display { * returns, exposed filters will not be used nor * displayed unless uses_exposed() returns TRUE. */ - function displays_exposed() { + public function displays_exposed() { $conf = $this->get_option('allow'); // If this is set, the exposed form is part of pane configuration, not // rendered normally. return empty($conf['exposed_form']); } - /** - * Set the pane configuration options - * Done here in handler for reuse between views_content_views_panes_content_type_render - * and views_content_views_pre_view - */ - function pane_process_conf() { - ctools_include('context'); - $conf = $this->get_option('pane_conf'); - if (!$conf) { - // See if dom id has been cached and get conf from there. - if (!empty($this->view->dom_id) && ($cache = cache_get('view_panel_pane_' . $this->view->dom_id))) { - $conf = $cache->data; - } - if (!$conf) { - return; - } - $this->set_pane_conf($conf); - } - $contexts = $conf['pane_contexts']; - $panel_args = $conf['panel_args']; - $args = array(); - $arguments = $this->get_option('arguments'); - - $context_keys = isset($conf['context']) ? $conf['context'] : array(); - foreach ($this->get_argument_input() as $id => $argument) { - switch ($argument['type']) { - case 'context': - $key = array_shift($context_keys); - if (isset($contexts[$key])) { - if (strpos($argument['context'], '.')) { - list($context, $converter) = explode('.', $argument['context'], 2); - $args[] = ctools_context_convert_context($contexts[$key], $converter, array('sanitize' => FALSE)); - } - else { - $args[] = $contexts[$key]->argument; - } - } - else { - $args[] = isset($arguments[$id]['exception']['value']) ? $arguments[$id]['exception']['value'] : 'all'; - } - break; - - case 'fixed': - $args[] = $argument['fixed']; - break; - - case 'panel': - $args[] = isset($panel_args[$argument['panel']]) ? $panel_args[$argument['panel']] : NULL; - break; - - case 'user': - $args[] = (isset($conf['arguments'][$id]) && $conf['arguments'][$id] !== '') ? ctools_context_keyword_substitute($conf['arguments'][$id], array(), $contexts) : NULL; - break; - - case 'wildcard': - // Put in the wildcard. - $args[] = isset($arguments[$id]['wildcard']) ? $arguments[$id]['wildcard'] : '*'; - break; - - case 'none': - default: - // Put in NULL. - // views.module knows what to do with NULL (or missing) arguments - $args[] = NULL; - break; - } - } - - // remove any trailing NULL arguments as these are non-args: - while (count($args) && end($args) === NULL) { - array_pop($args); - } - - $this->view->set_arguments($args); - $allow = $this->get_option('allow'); - - if (!empty($conf['path'])) { - $conf['path'] = ctools_context_keyword_substitute($conf['path'], array(), $contexts); - } - if ($allow['path_override'] && !empty($conf['path'])) { - $this->view->override_path = $conf['path']; - } - else if ($path = $this->get_option('inherit_panels_path')) { - $this->view->override_path = $_GET['q']; - } - - // more link - if ($allow['more_link']) { - if (empty($conf['more_link'])) { - $this->set_option('use_more', FALSE); - } - else { - $this->set_option('use_more', TRUE); - // make sure the view runs the count query so we know whether or not the - // more link applies. - $this->view->get_total_rows = TRUE; - } - } - - if ($allow['items_per_page'] && isset($conf['items_per_page'])) { - $this->view->set_items_per_page($conf['items_per_page']); - } - - if ($allow['offset']) { - $this->view->set_offset($conf['offset']); - } - - if ($allow['use_pager']) { - // Only set use_pager if they differ, this way we can avoid overwriting the - // pager type that Views uses. - $pager = $this->get_option('pager'); - if ($conf['use_pager'] && ($pager['type'] == 'none' || $pager['type'] == 'some')) { - $pager['type'] = 'full'; - } - elseif (!$conf['use_pager'] && $pager['type'] != 'none' && $pager['type'] != 'some') { - $pager['type'] = $this->view->get_items_per_page() || !empty($pager['options']['items_per_page']) ? 'some' : 'none'; - } - - if ($conf['use_pager']) { - if (!isset($pager['options']['id']) || (isset($conf['pager_id']) && $pager['options']['id'] != $conf['pager_id'])) { - $pager['options']['id'] = (int) $conf['pager_id']; - } - } - - $this->set_option('pager', $pager); - } - - if ($allow['fields_override']) { - if ($conf['fields_override']) { - $fields = $this->view->get_items('field'); - foreach ($fields as $field => $field_display) { - $fields[$field]['exclude'] = empty($conf['fields_override'][$field]); - } - $this->set_option('fields', $fields); - - } - } - - if ($allow['exposed_form'] && !empty($conf['exposed'])) { - foreach ($conf['exposed'] as $filter_name => $filter_value) { - if (!is_array($filter_value)) { - $conf['exposed'][$filter_name] = ctools_context_keyword_substitute($filter_value, array(), $contexts); - } - } - $this->view->set_exposed_input($conf['exposed']); - } - } - } - diff --git a/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content_plugin_style_ctools_context.inc b/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content_plugin_style_ctools_context.inc index aafbebc1..ea5323c6 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content_plugin_style_ctools_context.inc +++ b/sites/all/modules/contrib/dev/ctools/views_content/plugins/views/views_content_plugin_style_ctools_context.inc @@ -1,4 +1,5 @@ view->display_handler->previewing)) { return parent::render(); } diff --git a/sites/all/modules/contrib/dev/ctools/views_content/views_content.info b/sites/all/modules/contrib/dev/ctools/views_content/views_content.info index 4f78dbdd..68f4d875 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/views_content.info +++ b/sites/all/modules/contrib/dev/ctools/views_content/views_content.info @@ -5,14 +5,12 @@ dependencies[] = ctools dependencies[] = views core = 7.x package = Chaos tool suite -version = CTOOLS_MODULE_VERSION files[] = plugins/views/views_content_plugin_display_ctools_context.inc files[] = plugins/views/views_content_plugin_display_panel_pane.inc files[] = plugins/views/views_content_plugin_style_ctools_context.inc -; Information added by Drupal.org packaging script on 2016-11-22 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2019-02-08 +version = "7.x-1.15" core = "7.x" project = "ctools" -datestamp = "1479787162" - +datestamp = "1549603691" diff --git a/sites/all/modules/contrib/dev/ctools/views_content/views_content.module b/sites/all/modules/contrib/dev/ctools/views_content/views_content.module index 8d231464..264408ac 100644 --- a/sites/all/modules/contrib/dev/ctools/views_content/views_content.module +++ b/sites/all/modules/contrib/dev/ctools/views_content/views_content.module @@ -1,8 +1,7 @@ $group) + $implementations; - } -} - -/** - * Implements hook_views_pre_view() - */ -function views_content_views_pre_view(&$view) { - if (method_exists($view->display_handler, 'pane_process_conf')) { - // process the pane configuration to prevent loss when using ajax - $view->display_handler->pane_process_conf(); - } -} diff --git a/sites/all/modules/contrib/fields/computed_field/computed_field.info b/sites/all/modules/contrib/fields/computed_field/computed_field.info index cc62655d..872906c9 100644 --- a/sites/all/modules/contrib/fields/computed_field/computed_field.info +++ b/sites/all/modules/contrib/fields/computed_field/computed_field.info @@ -3,11 +3,10 @@ description = Defines a field type that allows values to be "computed" via PHP c core = 7.x dependencies[] = field package = Fields -files[]=computed_field.install -files[]=computed_field.module -; Information added by packaging script on 2013-12-03 -version = "7.x-1.0" + +; Information added by Drupal.org packaging script on 2016-01-21 +version = "7.x-1.1" core = "7.x" project = "computed_field" -datestamp = "1386094705" +datestamp = "1453389259" diff --git a/sites/all/modules/contrib/fields/computed_field/computed_field.install b/sites/all/modules/contrib/fields/computed_field/computed_field.install index f67b037f..f52c96f9 100644 --- a/sites/all/modules/contrib/fields/computed_field/computed_field.install +++ b/sites/all/modules/contrib/fields/computed_field/computed_field.install @@ -1,21 +1,20 @@ array()); - - // Hardcoded 'longtext' settings + + // Hardcoded 'longtext' settings. if ($settings['database']['data_type'] == 'longtext') { $columns['value']['type'] = 'text'; $columns['value']['size'] = 'big'; @@ -23,32 +22,32 @@ function computed_field_field_schema($field) { else { $columns['value']['type'] = isset($settings['database']['data_type']) ? $settings['database']['data_type'] : 'varchar'; } - // 'text' and 'varchar' fields get length settings + // 'text' and 'varchar' fields get length settings. if ($settings['database']['data_type'] == 'text' || $settings['database']['data_type'] == 'varchar') { $columns['value']['length'] = isset($settings['database']['data_length']) ? $settings['database']['data_length'] : 32; } - // 'int' and 'float' fields get size settings + // 'int' and 'float' fields get size settings. if ($settings['database']['data_type'] == 'int' || $settings['database']['data_type'] == 'float') { $columns['value']['size'] = isset($settings['database']['data_size']) ? $settings['database']['data_size'] : 'normal'; } - // 'decimal' fields get precision and scale settings + // 'decimal' fields get precision and scale settings. if ($settings['database']['data_type'] == 'numeric') { $columns['value']['precision'] = isset($settings['database']['data_precision']) ? $settings['database']['data_precision'] : 10; $columns['value']['scale'] = isset($settings['database']['data_scale']) ? $settings['database']['data_scale'] : 2; } - // Add 'not null' settings + // Add 'not null' settings. $columns['value']['not null'] = isset($settings['database']['data_not_NULL']) ? $settings['database']['data_not_NULL'] : TRUE; - // Add default values if set - if ($settings['database']['data_default'] != '') { + // Add default values if set. + if ($settings['database']['data_default'] !== '') { $columns['value']['default'] = $settings['database']['data_default']; } - // Add a simple index on the data if requested (except 'text' fields) - if ($settings['database']['data_index'] && $columns['value']['type'] != 'text') { - $indexes = array('value' => array('value')); + // Add a simple index on the data if requested (except 'text' fields). + if ($settings['database']['data_index'] && $columns['value']['type'] != 'text') { + $indexes = array('value' => array('value')); } } } - + if (isset($columns) && isset($indexes)) { return array( 'columns' => $columns, @@ -60,5 +59,5 @@ function computed_field_field_schema($field) { 'columns' => $columns, ); } - else return; + return; } diff --git a/sites/all/modules/contrib/fields/computed_field/computed_field.module b/sites/all/modules/contrib/fields/computed_field/computed_field.module index 2236be1b..5bfbabde 100644 --- a/sites/all/modules/contrib/fields/computed_field/computed_field.module +++ b/sites/all/modules/contrib/fields/computed_field/computed_field.module @@ -1,7 +1,12 @@ '$entity_field[0][\'value\'] = "";', 'display_format' => '$display_output = $entity_field_item[\'value\'];', 'store' => 1, + 'recalculate' => FALSE, 'database' => array( 'data_type' => 'varchar', 'data_length' => 32, @@ -40,12 +46,14 @@ function computed_field_field_info() { function computed_field_entity_property_callback(&$info, $entity_type, $field, $instance, $field_type) { $property_types = array( 'int' => 'integer', - 'float' => 'decimal', 'numeric' => 'decimal', - 'varchar' => 'text', 'text' => 'text', 'longtext' => 'text', + 'float' => 'decimal', + 'numeric' => 'decimal', + 'varchar' => 'text', + 'text' => 'text', + 'longtext' => 'text', ); if (isset($field['columns']['value']) && isset($property_types[$field['columns']['value']['type']])) { - // Entity API's defaults are pretty good so set the property_type and let - // them do the work for us. + // Entity API's defaults are pretty good so set the property_type and let them do the work for us. $field_type['property_type'] = $property_types[$field['columns']['value']['type']]; entity_metadata_field_default_property_callback($info, $entity_type, $field, $instance, $field_type); // The only thing is that a setter doesn't make sense, so let's disable it. @@ -55,7 +63,7 @@ function computed_field_entity_property_callback(&$info, $entity_type, $field, $ } /** - * Implements of hook_field_settings_form(). + * Implements hook_field_settings_form(). */ function computed_field_field_settings_form($field, $instance, $has_data) { $form = array(); @@ -69,14 +77,18 @@ function computed_field_field_settings_form($field, $instance, $has_data) { '#type' => 'textarea', '#rows' => 15, '#title' => t('Computed Code (PHP)'), - '#description' => t('The variables available to your code include: @fields. To set the value of the field, set @entity_field. For multi-value computed fields continue with @entity_field_multi. Here\'s a simple example which sets the computed field\'s value to the value of the sum of the number fields (@field_a and @field_b) in a node entity:

    @example The first pop fetches the last (or only) item from the field while the second pop fetches its [\'value\'] contents (assuming it\'s the only key that\'s set).

    Alternately, this code can be supplied by your own custom function named: @compute_func(&$entity_field, $entity_type, $entity, $field, $instance, $langcode, $items)', - array('@fields' => '&$entity_field, $entity_type, $entity, $field, $instance, $langcode, and $items', - '@entity_field' => '$entity_field[0][\'value\']', - '@entity_field_multi' => '$entity_field[1][\'value\']', - '@field_a' => 'field_a', - '@field_b' => 'field_b', - '@example' => '$entity_field[0][\'value\'] = array_pop(array_pop(field_get_items($entity_type, $entity, \'field_a\'))) + array_pop(array_pop(field_get_items($entity_type, $entity, \'field_b\')));', - '@compute_func' => $compute_func)), + '#description' => t('

    The variables available to your code include: @fields. To set the value of the field, set @entity_field. For multi-value computed fields continue with @entity_field_multi. Here\'s a simple example which sets the computed field\'s value to the value of the sum of the number fields (@field_a and @field_b) in a node entity:

    !example

    Alternately, this code can be supplied by your own custom function named: @compute_func(&$entity_field, $entity_type, $entity, $field, $instance, $langcode, $items).

    ', array( + '@fields' => '&$entity_field, $entity_type, $entity, $field, $instance, $langcode, and $items', + '@entity_field' => '$entity_field[0][\'value\']', + '@entity_field_multi' => '$entity_field[1][\'value\']', + '@field_a' => 'field_a', + '@field_b' => 'field_b', + '!example' => '

    $field_a = field_get_items($entity_type, $entity, "field_a");
    + $field_b = field_get_items($entity_type, $entity, "field_b");
    + $entity_field[0]["value"] = $field_a[0]["value"] + $field_b[0]["value"];

    + ', + '@compute_func' => $compute_func, + )), '#default_value' => !empty($settings['code']) ? $settings['code'] : '$entity_field[0][\'value\'] = "";', '#access' => !function_exists($compute_func), ); @@ -89,10 +101,11 @@ function computed_field_field_settings_form($field, $instance, $has_data) { $form['display_format'] = array( '#type' => 'textarea', '#title' => t('Display Code (PHP)'), - '#description' => t('This code should assign a string to the @display_output variable, which will be printed when the field is displayed. The raw computed value of the field is in @value. Note: this code has no effect if you use the "Raw computed value" display formatter.

    Alternately, this code can be supplied by your own custom function named: @display_func($field, $entity_field_item, $entity_lang, $langcode, $entity). Return the value to be displayed. Original value is in $entity_field_item[\'value\'].', - array('@display_output' => '$display_output', - '@value' => '$entity_field_item[\'value\']', - '@display_func' => $display_func)), + '#description' => t('This code should assign a string to the @display_output variable, which will be printed when the field is displayed. The raw computed value of the field is in @value. Note: this code has no effect if you use the "Raw computed value" display formatter.

    Alternately, this code can be supplied by your own custom function named: @display_func($field, $entity_field_item, $entity_lang, $langcode, $entity). Return the value to be displayed. Original value is in $entity_field_item[\'value\'].', array( + '@display_output' => '$display_output', + '@value' => '$entity_field_item[\'value\']', + '@display_func' => $display_func, + )), '#default_value' => !empty($settings['display_format']) ? $settings['display_format'] : '$display_output = $entity_field_item[\'value\'];', '#access' => !function_exists($display_func), ); @@ -100,8 +113,14 @@ function computed_field_field_settings_form($field, $instance, $has_data) { $form['display_func'] = array( '#type' => 'item', '#markup' => t('This field is DISPLAYED using @display_func().', array('@display_func' => $display_func)), - ); + ); } + $form['recalculate'] = array( + '#type' => 'checkbox', + '#title' => t('Recalculate the field value every time.'), + '#description' => t('By default, Drupal will cache the value of this field even if it is not stored in the database (and even if Page Caching is disabled). This option will cause computed_field to recalculate the value every time this field is displayed. For example, a time-based calculated value may change more often than field cache is cleared. (Note that Drupal page caching will still cache the field value.)'), + '#default_value' => is_numeric($settings['recalculate']) ? $settings['recalculate'] : FALSE, + ); $form['store'] = array( '#type' => 'checkbox', '#title' => t('Store value in the database'), @@ -122,7 +141,14 @@ function computed_field_field_settings_form($field, $instance, $has_data) { '#title' => t('Data Type'), '#description' => t('The SQL datatype to store this field in.'), '#default_value' => !empty($settings['database']['data_type']) ? $settings['database']['data_type'] : 'varchar', - '#options' => array('varchar' => 'varchar', 'text' => 'text', 'longtext' => 'longtext', 'int' => 'int', 'float' => 'float', 'numeric' => 'decimal'), + '#options' => array( + 'varchar' => 'varchar', + 'text' => 'text', + 'longtext' => 'longtext', + 'int' => 'int', + 'float' => 'float', + 'numeric' => 'decimal', + ), '#required' => FALSE, '#disabled' => $has_data, ); @@ -139,7 +165,13 @@ function computed_field_field_settings_form($field, $instance, $has_data) { '#title' => t('Data Size (int/float)'), '#description' => t('Only valid for int or float fields. The size of the field stored in the database.'), '#default_value' => !empty($settings['database']['data_size']) ? $settings['database']['data_size'] : 'normal', - '#options' => array('tiny' => 'tiny', 'small' => 'small', 'medium' => 'medium', 'normal' => 'normal', 'big' => 'big'), + '#options' => array( + 'tiny' => 'tiny', + 'small' => 'small', + 'medium' => 'medium', + 'normal' => 'normal', + 'big' => 'big', + ), '#required' => FALSE, '#disabled' => $has_data, ); @@ -184,8 +216,8 @@ function computed_field_field_settings_form($field, $instance, $has_data) { } /** -* Implements the #element_validate callback for computed_field_field_settings_form(). -*/ + * #element_validate callback for computed_field_field_settings_form(). + */ function computed_field_field_settings_form_validate($element, &$form_state) { $settings = $form_state['values']['field']['settings']; if ($settings['store']) { @@ -202,11 +234,11 @@ function computed_field_field_settings_form_validate($element, &$form_state) { } /** - * Implements field hook_field_load(). + * Implements hook_field_load(). */ function computed_field_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) { $settings = $field['settings']; - // Compute field values on load if they aren't stored in the database + // Compute field values on load if they aren't stored in the database. if (!$settings['store']) { foreach ($entities as $etid => $entity) { _computed_field_compute_value($entity_type, $entity, $field, $instances, $langcode, $items[$etid]); @@ -215,33 +247,34 @@ function computed_field_field_load($entity_type, $entities, $field, $instances, } /** - * Implements field hook_field_prepare_view(). + * Implements hook_field_prepare_view(). */ function computed_field_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items) { - // Compute field values in case user is "previewing" an entity + $settings = $field['settings']; + // Compute field values in case user is "previewing" an entity. foreach ($entities as $etid => $entity) { - if (isset($entity->op) && $entity->op == 'Preview') { + if ((isset($entity->op) && $entity->op == 'Preview') || $settings['recalculate']) { _computed_field_compute_value($entity_type, $entity, $field, $instances, $langcode, $items[$etid]); } } } /** - * Implements field hook_field_insert(). + * Implements hook_field_insert(). */ function computed_field_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items) { _computed_field_compute_value($entity_type, $entity, $field, $instance, $langcode, $items); } /** - * Implements field hook_field_update(). + * Implements hook_field_update(). */ function computed_field_field_update($entity_type, $entity, $field, $instance, $langcode, &$items) { _computed_field_compute_value($entity_type, $entity, $field, $instance, $langcode, $items); } /** - * Implements field hook_field_widget_info(). + * Implements hook_field_widget_info(). */ function computed_field_field_widget_info() { return array( @@ -257,14 +290,15 @@ function computed_field_field_widget_info() { } /** - * Implements field hook_field_widget_form(). + * Implements hook_field_widget_form(). */ - function computed_field_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) { // If there are no items yet, add a null item value to avoid - // preview errors when selecting a different language - if (empty($items)) $items[0]['value'] = NULL; + // preview errors when selecting a different language. + if (empty($items)) { + $items[0]['value'] = NULL; + } foreach ($items as $item_delta => $item) { $element[$item_delta]['value'] = array( @@ -305,37 +339,45 @@ function computed_field_field_formatter_info() { */ function computed_field_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { $element = array(); + $data_to_display = FALSE; - // Special case formatter that returns the raw computed values without any display code processing + // Special case formatter that returns the raw computed values without any display code processing. if ($display['type'] == "computed_field_computed_value") { foreach ($items as $delta => $item) { - if (!isset($entity_field_item['value'])) $entity_field_item['value'] = NULL; + if (!isset($entity_field_item['value'])) { + $entity_field_item['value'] = NULL; + } $element[$delta] = array('#markup' => $item['value']); } return $element; } - // Other display formatters which run through display code processing - // Check if the value is to be formatted by a display function outside the DB + // Other display formatters which run through display code processing. + // Check if the value is to be formatted by a display function outside the DB. $display_func = 'computed_field_' . $field['field_name'] . '_display'; - if (function_exists($display_func)) $display_in_code = TRUE; - else $display_in_code = FALSE; + $display_in_code = function_exists($display_func) ? TRUE : FALSE; - // Loop the items to display + // Loop the items to display. foreach ($items as $delta => $item) { - // For "some" backwards compatibility + // For "some" backwards compatibility. $entity_field_item = $item; - // Setup a variable with the entity language if available - if (isset($entity->language)) $entity_lang = $entity->language; - else $entity_lang = LANGUAGE_NONE; + // Setup a variable with the entity language if available. + if (isset($entity->language)) { + $entity_lang = $entity->language; + } + else { + $entity_lang = LANGUAGE_NONE; + } - // If there are value "holes" in the field array let's set the value to NULL - // to avoid undefined index errors in typical PHP display code - if (!isset($entity_field_item['value'])) $entity_field_item['value'] = NULL; + // If there are value "holes" in the field array let's set the value to NULL. + // to avoid undefined index errors in typical PHP display code. + if (!isset($entity_field_item['value'])) { + $entity_field_item['value'] = NULL; + } - // Execute the display code + // Execute the display code. $display_output = NULL; if ($display_in_code) { $display_output = $display_func($field, $entity_field_item, $entity_lang, $langcode, $entity); @@ -344,31 +386,59 @@ function computed_field_field_formatter_view($entity_type, $entity, $field, $ins eval($field['settings']['display_format']); } - // Output the formatted display item + // Track if any of our items produce non-empty output. + if (!empty($display_output) || is_numeric($display_output)) { + $data_to_display = TRUE; + } + + // Output the formatted display item. switch ($display['type']) { case 'computed_field_unsanitized': $element[$delta] = array('#markup' => $display_output); break; + case 'computed_field_plain': $element[$delta] = array('#markup' => check_plain($display_output)); break; + case 'computed_field_markup': $element[$delta] = array('#markup' => check_markup($display_output)); break; } } + // If all items are empty then we should not return anything. This helps + // ensure that empty fields are not displayed at all. This check does not + // apply to fields stored in the DB as those are instead checked on save. + if (isset($field['settings']['store']) && !$field['settings']['store'] && !$data_to_display) { + return; + } return $element; } /** - * Implements field hook_field_is_empty(). + * Implements hook_field_is_empty(). */ function computed_field_field_is_empty($item, $field) { - $data_type = $field['settings']['database']['data_type']; - if ($data_type == 'int' || $data_type == 'float') { - return !is_numeric($item['value']); + unset($empty); + + // This will depend on the class of data type. + switch ($field['settings']['database']['data_type']) { + + case 'int': + case 'float': + case 'numeric': + // For numbers, the field is empty if the value isn't numeric. + $empty = !is_numeric($item['value']); + break; + + case 'varchar': + case 'text': + case 'longtext': + // For strings, the field is empty if it doesn't match the empty string. + $empty = ($item['value'] === ""); + break; } - return empty($item['value']); + return $empty; } /** @@ -377,14 +447,18 @@ function computed_field_field_is_empty($item, $field) { function _computed_field_compute_value($entity_type, $entity, $field, $instance, $langcode, &$items) { $settings = $field['settings']; - // Setup a variable with the field values + // Setup a variable with the field values. $entity_field =& $items; - // Setup a variable with the entity language if available - if (isset($entity->language)) $entity_lang = $entity->language; - else $entity_lang = LANGUAGE_NONE; + // Setup a variable with the entity language if available. + if (isset($entity->language)) { + $entity_lang = $entity->language; + } + else { + $entity_lang = LANGUAGE_NONE; + } - // Allow the value to be computed from code not stored in DB + // Allow the value to be computed from code not stored in DB. $compute_func = 'computed_field_' . $field['field_name'] . '_compute'; if (function_exists($compute_func)) { $compute_func($entity_field, $entity_type, $entity, $field, $instance, $langcode, $items); @@ -395,4 +469,3 @@ function _computed_field_compute_value($entity_type, $entity, $field, $instance, } } } - diff --git a/sites/all/modules/contrib/theming/colorbox/colorbox.admin.inc b/sites/all/modules/contrib/theming/colorbox/colorbox.admin.inc index 44b030a2..2122650f 100644 --- a/sites/all/modules/contrib/theming/colorbox/colorbox.admin.inc +++ b/sites/all/modules/contrib/theming/colorbox/colorbox.admin.inc @@ -145,6 +145,12 @@ function colorbox_admin_settings() { '#default_value' => variable_get('colorbox_overlayclose', 1), '#description' => t('Enable closing Colorbox by clicking on the background overlay.'), ); + $form['colorbox_custom_settings']['colorbox_returnfocus'] = array( + '#type' => 'checkbox', + '#title' => t('Return focus'), + '#default_value' => variable_get('colorbox_returnfocus', 1), + '#description' => t('Return focus when Colorbox exits to the element it was launched from.'), + ); $form['colorbox_custom_settings']['colorbox_maxwidth'] = array( '#type' => 'textfield', '#title' => t('Max width'), @@ -266,10 +272,10 @@ function colorbox_admin_settings() { ); $form['colorbox_advanced_settings']['colorbox_mobile_device_width'] = array( '#type' => 'textfield', - '#title' => t('Device with'), + '#title' => t('Device width'), '#default_value' => variable_get('colorbox_mobile_device_width', '480px'), '#size' => 30, - '#description' => t('Set the mobile device max with. Default: 480px.'), + '#description' => t('Set the mobile device max width. Default: 480px.'), '#states' => array( 'visible' => array( ':input[name="colorbox_mobile_detect"]' => array('value' => '1'), diff --git a/sites/all/modules/contrib/theming/colorbox/colorbox.info b/sites/all/modules/contrib/theming/colorbox/colorbox.info index 23b153d3..e72aad31 100644 --- a/sites/all/modules/contrib/theming/colorbox/colorbox.info +++ b/sites/all/modules/contrib/theming/colorbox/colorbox.info @@ -6,9 +6,9 @@ configure = admin/config/media/colorbox files[] = views/colorbox_handler_field_colorbox.inc -; Information added by Drupal.org packaging script on 2016-06-06 -version = "7.x-2.12" +; Information added by Drupal.org packaging script on 2017-04-04 +version = "7.x-2.13" core = "7.x" project = "colorbox" -datestamp = "1465255741" +datestamp = "1491291489" diff --git a/sites/all/modules/contrib/theming/colorbox/colorbox.module b/sites/all/modules/contrib/theming/colorbox/colorbox.module index 23e2a037..4d16400d 100644 --- a/sites/all/modules/contrib/theming/colorbox/colorbox.module +++ b/sites/all/modules/contrib/theming/colorbox/colorbox.module @@ -44,7 +44,7 @@ function colorbox_theme() { 'node' => NULL, // Left for legacy support. 'field' => array(), 'display_settings' => array(), - 'delta' => null, + 'delta' => NULL, ), 'file' => 'colorbox.theme.inc', ), @@ -167,7 +167,7 @@ function _colorbox_doheader() { return; // Don't add the JavaScript and CSS multiple times. } - // Insert options and translated strings as javascript settings. + // Insert options and translated strings as JavaScript settings. if (variable_get('colorbox_custom_settings_activate', 0)) { $js_settings = array( 'transition' => variable_get('colorbox_transition_type', 'elastic'), @@ -183,6 +183,7 @@ function _colorbox_doheader() { 'next' => strip_tags(variable_get('colorbox_text_next', 'Next ยป')), 'close' => strip_tags(variable_get('colorbox_text_close', 'Close')), 'overlayClose' => variable_get('colorbox_overlayclose', 1) ? TRUE : FALSE, + 'returnFocus' => variable_get('colorbox_returnfocus', 1) ? TRUE : FALSE, 'maxWidth' => variable_get('colorbox_maxwidth', '98%'), 'maxHeight' => variable_get('colorbox_maxheight', '98%'), 'initialWidth' => variable_get('colorbox_initialwidth', '300'), @@ -364,11 +365,18 @@ function colorbox_field_formatter_settings_form($field, $instance, $view_mode, $ // Allow users to hide or set a custom recursion limit. // The module token_tweaks sets a global recursion limit that can not be bypassed. if (module_exists('token') && $recursion_limit = min(variable_get('token_tree_recursion_limit', 3), variable_get('colorbox_token_recursion_limit', 3))) { + // File entities do not have $field, only $instance. + if (!empty($field)) { + $token_types = array_merge(array_keys($field['bundles']), array('file')); + } + else { + $token_types = array($instance['entity_type'], 'file'); + } $element['colorbox_token'] = array( '#type' => 'fieldset', '#title' => t('Replacement patterns'), '#theme' => 'token_tree', - '#token_types' => array_merge(array_keys($field['bundles']),array('file')), + '#token_types' => $token_types, '#recursion_limit' => $recursion_limit, '#dialog' => TRUE, '#states' => array( diff --git a/sites/all/modules/contrib/theming/colorbox/colorbox.theme.inc b/sites/all/modules/contrib/theming/colorbox/colorbox.theme.inc index 76c4c0c3..cd4a2375 100644 --- a/sites/all/modules/contrib/theming/colorbox/colorbox.theme.inc +++ b/sites/all/modules/contrib/theming/colorbox/colorbox.theme.inc @@ -66,7 +66,7 @@ function theme_colorbox_image_formatter($variables) { $entity_title = entity_label($entity_type, $entity); switch ($settings['colorbox_caption']) { - case 'auto': + case 'auto': // If the title is empty use alt or the entity title in that order. if (!empty($image['title'])) { $caption = $image['title']; @@ -81,18 +81,23 @@ function theme_colorbox_image_formatter($variables) { $caption = ''; } break; + case 'title': $caption = $image['title']; break; + case 'alt': $caption = $image['alt']; break; + case 'node_title': $caption = $entity_title; break; + case 'custom': $caption = token_replace($settings['colorbox_caption_custom'], array($entity_type => $entity, 'file' => (object) $item), array('clear' => TRUE)); break; + default: $caption = ''; } @@ -111,18 +116,23 @@ function theme_colorbox_image_formatter($variables) { case 'post': $gallery_id = 'gallery-' . $entity_id; break; + case 'page': $gallery_id = 'gallery-all'; break; + case 'field_post': $gallery_id = 'gallery-' . $entity_id . '-' . $field['field_name']; break; + case 'field_page': $gallery_id = 'gallery-' . $field['field_name']; break; + case 'custom': $gallery_id = $settings['colorbox_gallery_custom']; break; + default: $gallery_id = ''; } @@ -183,6 +193,7 @@ function theme_colorbox_imagefield($variables) { 'title' => $variables['title'], 'class' => $class, 'data-colorbox-gallery' => $variables['gid'], + 'data-cbox-img-attrs' => '{"title": "' . $variables['image']['title'] . '", "alt": "' . $variables['image']['alt'] . '"}', ), ); @@ -240,6 +251,7 @@ function template_preprocess_colorbox_insert_image(&$variables) { case 2: $variables['gallery_id'] = 'gallery-all'; break; + case 3: $variables['gallery_id'] = ''; break; diff --git a/sites/all/modules/contrib/theming/colorbox/drush/colorbox.drush.inc b/sites/all/modules/contrib/theming/colorbox/drush/colorbox.drush.inc index 2ff34424..56df55c5 100644 --- a/sites/all/modules/contrib/theming/colorbox/drush/colorbox.drush.inc +++ b/sites/all/modules/contrib/theming/colorbox/drush/colorbox.drush.inc @@ -90,39 +90,45 @@ function drush_colorbox_plugin() { drush_log(dt('Directory @path was created', array('@path' => $path)), 'notice'); } - // Set the directory to the download location. - $olddir = getcwd(); - chdir($path); + // Download colorbox plugin only if path is writable. + if (is_writable($path)) { + // Set the directory to the download location. + $olddir = getcwd(); + chdir($path); - // Download the zip archive - if ($filepath = drush_download_file(COLORBOX_DOWNLOAD_URI)) { - $filename = basename($filepath); - $dirname = COLORBOX_DOWNLOAD_PREFIX . basename($filepath, '.zip'); + // Download the zip archive + if ($filepath = drush_download_file(COLORBOX_DOWNLOAD_URI)) { + $filename = basename($filepath); + $dirname = COLORBOX_DOWNLOAD_PREFIX . basename($filepath, '.zip'); - // Remove any existing Colorbox plugin directory - if (is_dir($dirname) || is_dir('colorbox')) { - drush_delete_dir($dirname, TRUE); - drush_delete_dir('colorbox', TRUE); - drush_log(dt('A existing Colorbox plugin was deleted from @path', array('@path' => $path)), 'notice'); + // Remove any existing Colorbox plugin directory. + if (is_dir($dirname) || is_dir('colorbox')) { + drush_delete_dir($dirname, TRUE); + drush_delete_dir('colorbox', TRUE); + drush_log(dt('A existing Colorbox plugin was deleted from @path', array('@path' => $path)), 'notice'); + } + + // Decompress the zip archive + drush_tarball_extract($filename); + + // Change the directory name to "colorbox" if needed. + if ($dirname != 'colorbox') { + drush_move_dir($dirname, 'colorbox', TRUE); + $dirname = 'colorbox'; + } } - // Decompress the zip archive - drush_tarball_extract($filename); - - // Change the directory name to "colorbox" if needed. - if ($dirname != 'colorbox') { - drush_move_dir($dirname, 'colorbox', TRUE); - $dirname = 'colorbox'; + if (is_dir($dirname)) { + drush_log(dt('Colorbox plugin has been installed in @path', array('@path' => $path)), 'success'); + } + else { + drush_log(dt('Drush was unable to install the Colorbox plugin to @path', array('@path' => $path)), 'error'); } - } - if (is_dir($dirname)) { - drush_log(dt('Colorbox plugin has been installed in @path', array('@path' => $path)), 'success'); + // Set working directory back to the previous working directory. + chdir($olddir); } else { - drush_log(dt('Drush was unable to install the Colorbox plugin to @path', array('@path' => $path)), 'error'); + drush_log(dt('Drush was unable to install the Colorbox plugin because @path is not writable. If you enable the colorbox module before you install the plugin library, you may find that colorbox does not work until you reinstall the colorbox module.', array('@path' => $path)), 'warning'); } - - // Set working directory back to the previous working directory. - chdir($olddir); } diff --git a/sites/all/modules/contrib/theming/colorbox/js/colorbox.js b/sites/all/modules/contrib/theming/colorbox/js/colorbox.js index d17133b4..567ad381 100644 --- a/sites/all/modules/contrib/theming/colorbox/js/colorbox.js +++ b/sites/all/modules/contrib/theming/colorbox/js/colorbox.js @@ -1,3 +1,8 @@ +/** + * @file + * Colorbox module init js. + */ + (function ($) { Drupal.behaviors.initColorbox = { diff --git a/sites/all/modules/contrib/theming/colorbox/js/colorbox_admin_settings.js b/sites/all/modules/contrib/theming/colorbox/js/colorbox_admin_settings.js index 46608f81..79de0833 100644 --- a/sites/all/modules/contrib/theming/colorbox/js/colorbox_admin_settings.js +++ b/sites/all/modules/contrib/theming/colorbox/js/colorbox_admin_settings.js @@ -1,3 +1,8 @@ +/** + * @file + * Colorbox module admin settings js. + */ + (function ($) { Drupal.behaviors.initColorboxAdminSettings = { diff --git a/sites/all/modules/contrib/theming/colorbox/js/colorbox_inline.js b/sites/all/modules/contrib/theming/colorbox/js/colorbox_inline.js index 2354ef87..c06c588a 100644 --- a/sites/all/modules/contrib/theming/colorbox/js/colorbox_inline.js +++ b/sites/all/modules/contrib/theming/colorbox/js/colorbox_inline.js @@ -1,3 +1,8 @@ +/** + * @file + * Colorbox module inline js. + */ + (function ($) { Drupal.behaviors.initColorboxInline = { diff --git a/sites/all/modules/contrib/theming/colorbox/js/colorbox_load.js b/sites/all/modules/contrib/theming/colorbox/js/colorbox_load.js index 6d3c6767..bf2e924b 100644 --- a/sites/all/modules/contrib/theming/colorbox/js/colorbox_load.js +++ b/sites/all/modules/contrib/theming/colorbox/js/colorbox_load.js @@ -1,3 +1,7 @@ +/** + * @file + * Colorbox module load js. + */ (function ($) { Drupal.behaviors.initColorboxLoad = { @@ -17,7 +21,7 @@ Drupal.behaviors.initColorboxLoad = { $.urlParams = function (url) { var p = {}, e, - a = /\+/g, // Regex for replacing addition symbol with a space + a = /\+/g, // Regex for replacing addition symbol with a space. r = /([^&=]+)=?([^&]*)/g, d = function (s) { return decodeURIComponent(s.replace(a, ' ')); }, q = url.split('?'); diff --git a/sites/all/modules/contrib/theming/colorbox/styles/default/colorbox_style.js b/sites/all/modules/contrib/theming/colorbox/styles/default/colorbox_style.js index 47875ffd..d3e3c56f 100644 --- a/sites/all/modules/contrib/theming/colorbox/styles/default/colorbox_style.js +++ b/sites/all/modules/contrib/theming/colorbox/styles/default/colorbox_style.js @@ -1,3 +1,8 @@ +/** + * @file + * Colorbox module style js. + */ + (function ($) { Drupal.behaviors.initColorboxDefaultStyle = { diff --git a/sites/all/modules/contrib/theming/colorbox/styles/plain/colorbox_style.js b/sites/all/modules/contrib/theming/colorbox/styles/plain/colorbox_style.js index 19d8e66e..df6b5d6c 100644 --- a/sites/all/modules/contrib/theming/colorbox/styles/plain/colorbox_style.js +++ b/sites/all/modules/contrib/theming/colorbox/styles/plain/colorbox_style.js @@ -1,3 +1,8 @@ +/** + * @file + * Colorbox module style js. + */ + (function ($) { Drupal.behaviors.initColorboxPlainStyle = { diff --git a/sites/all/modules/contrib/theming/colorbox/styles/stockholmsyndrome/colorbox_style.js b/sites/all/modules/contrib/theming/colorbox/styles/stockholmsyndrome/colorbox_style.js index db3ab3ef..450c3536 100644 --- a/sites/all/modules/contrib/theming/colorbox/styles/stockholmsyndrome/colorbox_style.js +++ b/sites/all/modules/contrib/theming/colorbox/styles/stockholmsyndrome/colorbox_style.js @@ -1,3 +1,8 @@ +/** + * @file + * Colorbox module style js. + */ + (function ($) { Drupal.behaviors.initColorboxStockholmsyndromeStyle = { diff --git a/sites/all/modules/contrib/theming/colorbox/views/colorbox.views.inc b/sites/all/modules/contrib/theming/colorbox/views/colorbox.views.inc index 40f90a51..2731d7b8 100644 --- a/sites/all/modules/contrib/theming/colorbox/views/colorbox.views.inc +++ b/sites/all/modules/contrib/theming/colorbox/views/colorbox.views.inc @@ -6,7 +6,7 @@ */ /** - * Implementation of hook_views_data() + * Implements hook_views_data() */ function colorbox_views_data() { diff --git a/sites/all/modules/contrib/theming/colorbox/views/colorbox_handler_field_colorbox.inc b/sites/all/modules/contrib/theming/colorbox/views/colorbox_handler_field_colorbox.inc index 205d0995..49b6af78 100644 --- a/sites/all/modules/contrib/theming/colorbox/views/colorbox_handler_field_colorbox.inc +++ b/sites/all/modules/contrib/theming/colorbox/views/colorbox_handler_field_colorbox.inc @@ -67,7 +67,7 @@ If you would like to have the characters %5B and %5D please use the html entity $patterns .= theme('item_list', array( 'items' => $items, - 'type' => $type + 'type' => $type, )); } } @@ -183,11 +183,11 @@ If you would like to have the characters %5B and %5D please use the html entity 'width' => $width, 'height' => $height, 'title' => $caption, - 'inline' => 'true' + 'inline' => 'true', ), 'attributes' => array( 'class' => array('colorbox-inline'), - 'rel' => $gallery_id + 'rel' => $gallery_id, ) ); // Remove any parameters that aren't set. diff --git a/sites/all/modules/contrib/theming/extlink/README.txt b/sites/all/modules/contrib/theming/extlink/README.txt index db8bc097..c75b887e 100644 --- a/sites/all/modules/contrib/theming/extlink/README.txt +++ b/sites/all/modules/contrib/theming/extlink/README.txt @@ -1,4 +1,5 @@ - +INTRODUCTION +------------ The External Links module is a very simple approach to adding icons to links to external websites or e-mail addresses. It is a purely JavaScript implementation, so the icons are only shown to users that have JavaScript @@ -7,8 +8,12 @@ enabled. External Links was written by Nathan Haug. Built by Robots: http://www.lullabot.com -Install -------- +REQUIREMENTS +------------ +No special requirements. + +INSTALLATION +------------ Simply install External Links like you would any other module. 1) Copy the extlink folder to the modules folder in your installation. @@ -18,7 +23,13 @@ Simply install External Links like you would any other module. 3) No additional configuration is necessary though you may fine-tune settings at Administer -> Site configuration -> External Links (/admin/settings/extlink). -A note about the CSS +CONFIGURATION +------------- +No additional configuration is necessary though you may fine-tune settings at +Manage -> Configuration -> External Links +(/admin/config/user-interface/extlink). + +A NOTE ABOUT THE CSS -------------------- This module adds a CSS file that is only a few lines in length. You may choose to move this CSS to your theme to prevent the file from needing to be loaded @@ -33,3 +44,10 @@ separately. To do this: Note that you DO NOT need to make a extlink.css file. Specifying the file in the info file is enough to tell Drupal not to load the original file. + +MAINTAINERS +----------- +Current maintainers: + +- Lachlan Ennis (elachlan) - https://www.drupal.org/u/elachlan +- Nate Haug (quicksketch) - https://www.drupal.org/u/quicksketch diff --git a/sites/all/modules/contrib/theming/extlink/extlink.css b/sites/all/modules/contrib/theming/extlink/extlink.css index f912d8b8..90820648 100644 --- a/sites/all/modules/contrib/theming/extlink/extlink.css +++ b/sites/all/modules/contrib/theming/extlink/extlink.css @@ -15,7 +15,8 @@ span.mailto { /* Hide the extra spans when printing. */ @media print { - span.ext, span.mailto { + span.ext, + span.mailto { display: none; padding: 0; } diff --git a/sites/all/modules/contrib/theming/extlink/extlink.info b/sites/all/modules/contrib/theming/extlink/extlink.info index 00d732fe..034b8bb9 100644 --- a/sites/all/modules/contrib/theming/extlink/extlink.info +++ b/sites/all/modules/contrib/theming/extlink/extlink.info @@ -6,9 +6,8 @@ configure = admin/config/user-interface/extlink stylesheets[all][] = extlink.css files[] = extlink.test -; Information added by Drupal.org packaging script on 2014-07-25 -version = "7.x-1.18" +; Information added by Drupal.org packaging script on 2018-04-20 +version = "7.x-1.20" core = "7.x" project = "extlink" -datestamp = "1406278728" - +datestamp = "1524215285" diff --git a/sites/all/modules/contrib/theming/extlink/extlink.install b/sites/all/modules/contrib/theming/extlink/extlink.install index eb7662be..4c8146cd 100644 --- a/sites/all/modules/contrib/theming/extlink/extlink.install +++ b/sites/all/modules/contrib/theming/extlink/extlink.install @@ -1,18 +1,40 @@ fields(array('weight' => 1)) + ->condition('name', 'extlink', '=') + ->execute(); } /** * Implements hook_uninstall(). */ function extlink_uninstall() { - db_query("DELETE FROM {variable} WHERE name LIKE 'extlink_%'"); + variable_del('extlink_alert'); + variable_del('extlink_alert_text'); + variable_del('extlink_class'); + variable_del('extlink_css_exclude'); + variable_del('extlink_css_explicit'); + variable_del('extlink_exclude'); + variable_del('extlink_icon_placement'); + variable_del('extlink_img_class'); + variable_del('extlink_include'); + variable_del('extlink_label'); + variable_del('extlink_mailto_class'); + variable_del('extlink_mailto_label'); + variable_del('extlink_subdomains'); + variable_del('extlink_target'); + cache_clear_all('variables', 'cache'); } diff --git a/sites/all/modules/contrib/theming/extlink/extlink.js b/sites/all/modules/contrib/theming/extlink/extlink.js index dadcf381..77716d7f 100644 --- a/sites/all/modules/contrib/theming/extlink/extlink.js +++ b/sites/all/modules/contrib/theming/extlink/extlink.js @@ -1,161 +1,204 @@ +/** + * @file + */ + (function ($) { -Drupal.extlink = Drupal.extlink || {}; - -Drupal.extlink.attach = function (context, settings) { - if (!settings.hasOwnProperty('extlink')) { - return; - } - - // Strip the host name down, removing ports, subdomains, or www. - var pattern = /^(([^\/:]+?\.)*)([^\.:]{4,})((\.[a-z]{1,4})*)(:[0-9]{1,5})?$/; - var host = window.location.host.replace(pattern, '$3$4'); - var subdomain = window.location.host.replace(pattern, '$1'); - - // Determine what subdomains are considered internal. - var subdomains; - if (settings.extlink.extSubdomains) { - subdomains = "([^/]*\\.)?"; - } - else if (subdomain == 'www.' || subdomain == '') { - subdomains = "(www\\.)?"; - } - else { - subdomains = subdomain.replace(".", "\\."); - } - - // Build regular expressions that define an internal link. - var internal_link = new RegExp("^https?://" + subdomains + host, "i"); - - // Extra internal link matching. - var extInclude = false; - if (settings.extlink.extInclude) { - extInclude = new RegExp(settings.extlink.extInclude.replace(/\\/, '\\'), "i"); - } - - // Extra external link matching. - var extExclude = false; - if (settings.extlink.extExclude) { - extExclude = new RegExp(settings.extlink.extExclude.replace(/\\/, '\\'), "i"); - } - - // Extra external link CSS selector exclusion. - var extCssExclude = false; - if (settings.extlink.extCssExclude) { - extCssExclude = settings.extlink.extCssExclude; - } - - // Extra external link CSS selector explicit. - var extCssExplicit = false; - if (settings.extlink.extCssExplicit) { - extCssExplicit = settings.extlink.extCssExplicit; - } - - // Find all links which are NOT internal and begin with http as opposed - // to ftp://, javascript:, etc. other kinds of links. - // When operating on the 'this' variable, the host has been appended to - // all links by the browser, even local ones. - // In jQuery 1.1 and higher, we'd use a filter method here, but it is not - // available in jQuery 1.0 (Drupal 5 default). - var external_links = new Array(); - var mailto_links = new Array(); - $("a:not(." + settings.extlink.extClass + ", ." + settings.extlink.mailtoClass + "), area:not(." + settings.extlink.extClass + ", ." + settings.extlink.mailtoClass + ")", context).each(function(el) { - try { - var url = this.href.toLowerCase(); - if (url.indexOf('http') == 0 - && ((!url.match(internal_link) && !(extExclude && url.match(extExclude))) || (extInclude && url.match(extInclude))) - && !(extCssExclude && $(this).parents(extCssExclude).length > 0) - && !(extCssExplicit && $(this).parents(extCssExplicit).length < 1)) { - external_links.push(this); - } - // Do not include area tags with begin with mailto: (this prohibits - // icons from being added to image-maps). - else if (this.tagName != 'AREA' - && url.indexOf('mailto:') == 0 - && !(extCssExclude && $(this).parents(extCssExclude).length > 0) - && !(extCssExplicit && $(this).parents(extCssExplicit).length < 1)) { - mailto_links.push(this); - } - } - // IE7 throws errors often when dealing with irregular links, such as: - // Empty tags. - // example User:pass syntax. - catch (error) { - return false; - } - }); - - if (settings.extlink.extClass) { - Drupal.extlink.applyClassAndSpan(external_links, settings.extlink.extClass); - } - - if (settings.extlink.mailtoClass) { - Drupal.extlink.applyClassAndSpan(mailto_links, settings.extlink.mailtoClass); - } - - if (settings.extlink.extTarget) { - // Apply the target attribute to all links. - $(external_links).attr('target', settings.extlink.extTarget); - } + 'use strict'; Drupal.extlink = Drupal.extlink || {}; - // Set up default click function for the external links popup. This should be - // overridden by modules wanting to alter the popup. - Drupal.extlink.popupClickHandler = Drupal.extlink.popupClickHandler || function() { - if (settings.extlink.extAlert) { - return confirm(settings.extlink.extAlertText); + Drupal.extlink.attach = function (context, settings) { + if (!settings.hasOwnProperty('extlink')) { + return; } - } - $(external_links).click(function(e) { - return Drupal.extlink.popupClickHandler(e); - }); -}; + // Strip the host name down, removing ports, subdomains, or www. + var pattern = /^(([^\/:]+?\.)*)([^\.:]{1,})((\.[a-z0-9]{1,253})*)(:[0-9]{1,5})?$/; + var host = window.location.host.replace(pattern, '$2$3'); + var subdomain = window.location.host.replace(host, ''); -/** - * Apply a class and a trailing to all links not containing images. - * - * @param links - * An array of DOM elements representing the links. - * @param class_name - * The class to apply to the links. - */ -Drupal.extlink.applyClassAndSpan = function (links, class_name) { - var $links_to_process; - if (Drupal.settings.extlink.extImgClass){ - $links_to_process = $(links); - } - else { - var links_with_images = $(links).find('img').parents('a'); - $links_to_process = $(links).not(links_with_images); - } - $links_to_process.addClass(class_name); - var i; - var length = $links_to_process.length; - for (i = 0; i < length; i++) { - var $link = $($links_to_process[i]); - if ($link.css('display') == 'inline' || $link.css('display') == 'inline-block') { - if (class_name == Drupal.settings.extlink.mailtoClass) { - $link.append(' ' + Drupal.settings.extlink.mailtoLabel + ''); + // Determine what subdomains are considered internal. + var subdomains; + if (settings.extlink.extSubdomains) { + subdomains = '([^/]*\\.)?'; + } + else if (subdomain === 'www.' || subdomain === '') { + subdomains = '(www\\.)?'; + } + else { + subdomains = subdomain.replace('.', '\\.'); + } + + // Build regular expressions that define an internal link. + var internal_link = new RegExp('^https?://([^@]*@)?' + subdomains + host, 'i'); + + // Extra internal link matching. + var extInclude = false; + if (settings.extlink.extInclude) { + extInclude = new RegExp(settings.extlink.extInclude.replace(/\\/, '\\'), 'i'); + } + + // Extra external link matching. + var extExclude = false; + if (settings.extlink.extExclude) { + extExclude = new RegExp(settings.extlink.extExclude.replace(/\\/, '\\'), 'i'); + } + + // Extra external link CSS selector exclusion. + var extCssExclude = false; + if (settings.extlink.extCssExclude) { + extCssExclude = settings.extlink.extCssExclude; + } + + // Extra external link CSS selector explicit. + var extCssExplicit = false; + if (settings.extlink.extCssExplicit) { + extCssExplicit = settings.extlink.extCssExplicit; + } + + // Define the jQuery method (either 'append' or 'prepend') of placing the icon, defaults to 'append'. + var extIconPlacement = settings.extlink.extIconPlacement || 'append'; + + // Find all links which are NOT internal and begin with http as opposed + // to ftp://, javascript:, etc. other kinds of links. + // When operating on the 'this' variable, the host has been appended to + // all links by the browser, even local ones. + // In jQuery 1.1 and higher, we'd use a filter method here, but it is not + // available in jQuery 1.0 (Drupal 5 default). + var external_links = []; + var mailto_links = []; + $('a:not(.' + settings.extlink.extClass + ', .' + settings.extlink.mailtoClass + '), area:not(.' + settings.extlink.extClass + ', .' + settings.extlink.mailtoClass + ')', context).each(function (el) { + try { + var url = ''; + if (typeof this.href == 'string') { + url = this.href.toLowerCase(); + } + // Handle SVG links (xlink:href). + else if (typeof this.href == 'object') { + url = this.href.baseVal; + } + if (url.indexOf('http') === 0 + && ((!url.match(internal_link) && !(extExclude && url.match(extExclude))) || (extInclude && url.match(extInclude))) + && !(extCssExclude && $(this).is(extCssExclude)) + && !(extCssExclude && $(this).parents(extCssExclude).length > 0) + && !(extCssExplicit && $(this).parents(extCssExplicit).length < 1)) { + external_links.push(this); + } + // Do not include area tags with begin with mailto: (this prohibits + // icons from being added to image-maps). + else if (this.tagName !== 'AREA' + && url.indexOf('mailto:') === 0 + && !(extCssExclude && $(this).parents(extCssExclude).length > 0) + && !(extCssExplicit && $(this).parents(extCssExplicit).length < 1)) { + mailto_links.push(this); + } } - else { - $link.append(' ' + Drupal.settings.extlink.extLabel + ''); + // IE7 throws errors often when dealing with irregular links, such as: + // Empty tags. + // example User:pass syntax. + catch (error) { + return false; + } + }); + + if (settings.extlink.extClass) { + Drupal.extlink.applyClassAndSpan(external_links, settings.extlink.extClass, extIconPlacement); + } + + if (settings.extlink.mailtoClass) { + Drupal.extlink.applyClassAndSpan(mailto_links, settings.extlink.mailtoClass, extIconPlacement); + } + + if (settings.extlink.extTarget) { + // Apply the target attribute to all links. + $(external_links).attr('target', settings.extlink.extTarget); + // Add rel attributes noopener and noreferrer. + $(external_links).attr('rel', function (i, val) { + // If no rel attribute is present, create one with the values noopener and noreferrer. + if (val == null) { + return 'noopener noreferrer'; + } + // Check to see if rel contains noopener or noreferrer. Add what doesn't exist. + if (val.indexOf('noopener') > -1 || val.indexOf('noreferrer') > -1) { + if (val.indexOf('noopener') === -1) { + return val + ' noopener'; + } + if (val.indexOf('noreferrer') === -1) { + return val + ' noreferrer'; + } + // Both noopener and noreferrer exist. Nothing needs to be added. + else { + return val; + } + } + // Else, append noopener and noreferrer to val. + else { + return val + ' noopener noreferrer'; + } + }); + } + + Drupal.extlink = Drupal.extlink || {}; + + // Set up default click function for the external links popup. This should be + // overridden by modules wanting to alter the popup. + Drupal.extlink.popupClickHandler = Drupal.extlink.popupClickHandler || function () { + if (settings.extlink.extAlert) { + return confirm(settings.extlink.extAlertText); + } + }; + + $(external_links).click(function (e) { + return Drupal.extlink.popupClickHandler(e, this); + }); + }; + + /** + * Apply a class and a trailing to all links not containing images. + * + * @param {object[]} links + * An array of DOM elements representing the links. + * @param {string} class_name + * The class to apply to the links. + * @param {string} icon_placement + * 'append' or 'prepend' the icon to the link. + */ + Drupal.extlink.applyClassAndSpan = function (links, class_name, icon_placement) { + var $links_to_process; + if (Drupal.settings.extlink.extImgClass) { + $links_to_process = $(links); + } + else { + var links_with_images = $(links).find('img').parents('a'); + $links_to_process = $(links).not(links_with_images); + } + $links_to_process.addClass(class_name); + var i; + var length = $links_to_process.length; + for (i = 0; i < length; i++) { + var $link = $($links_to_process[i]); + if ($link.css('display') === 'inline' || $link.css('display') === 'inline-block') { + if (class_name === Drupal.settings.extlink.mailtoClass) { + $link[icon_placement](''); + } + else { + $link[icon_placement](''); + } } } - } -}; + }; -Drupal.behaviors.extlink = Drupal.behaviors.extlink || {}; -Drupal.behaviors.extlink.attach = function (context, settings) { - // Backwards compatibility, for the benefit of modules overriding extlink - // functionality by defining an "extlinkAttach" global function. - if (typeof extlinkAttach === 'function') { - extlinkAttach(context); - } - else { - Drupal.extlink.attach(context, settings); - } -}; + Drupal.behaviors.extlink = Drupal.behaviors.extlink || {}; + Drupal.behaviors.extlink.attach = function (context, settings) { + // Backwards compatibility, for the benefit of modules overriding extlink + // functionality by defining an "extlinkAttach" global function. + if (typeof extlinkAttach === 'function') { + extlinkAttach(context); + } + else { + Drupal.extlink.attach(context, settings); + } + }; })(jQuery); diff --git a/sites/all/modules/contrib/theming/extlink/extlink.module b/sites/all/modules/contrib/theming/extlink/extlink.module index fcaae5b5..6d933f8a 100644 --- a/sites/all/modules/contrib/theming/extlink/extlink.module +++ b/sites/all/modules/contrib/theming/extlink/extlink.module @@ -1,4 +1,22 @@ ' . t('External Links is used to differentiate between internal and external links. Using jQuery, it will find all external links on a page and add an external icon indicating it will take you offsite or a mail icon for mailto links.') . '

    '; + return $output; + } +} + /** * Implements hook_menu(). */ @@ -20,24 +38,30 @@ function extlink_menu() { */ function extlink_page_build() { $path = drupal_get_path('module', 'extlink'); - drupal_add_js($path .'/extlink.js', array('every_page' => TRUE)); - drupal_add_js(array('extlink' => array( - 'extTarget' => variable_get('extlink_target', 0), - 'extClass' => variable_get('extlink_class', 'ext'), - 'extLabel' => check_plain(variable_get('extlink_label', t('(link is external)'))), - 'extImgClass' => variable_get('extlink_img_class', 0), - 'extSubdomains' => variable_get('extlink_subdomains', 1), - 'extExclude' => variable_get('extlink_exclude', ''), - 'extInclude' => variable_get('extlink_include', ''), - 'extCssExclude' => variable_get('extlink_css_exclude', ''), - 'extCssExplicit' => variable_get('extlink_css_explicit', ''), - 'extAlert' => variable_get('extlink_alert', 0), - 'extAlertText' => variable_get('extlink_alert_text', 'This link will take you to an external web site. We are not responsible for their content.'), - 'mailtoClass' => variable_get('extlink_mailto_class', 'mailto'), - 'mailtoLabel' => check_plain(variable_get('extlink_mailto_label', t('(link sends e-mail)'))), - )), 'setting'); + drupal_add_js($path . '/extlink.js', array('every_page' => TRUE)); + drupal_add_js(array( + 'extlink' => array( + 'extTarget' => variable_get('extlink_target', 0), + 'extClass' => variable_get('extlink_class', 'ext'), + 'extLabel' => check_plain(variable_get('extlink_label', t('(link is external)'))), + 'extImgClass' => variable_get('extlink_img_class', 0), + 'extIconPlacement' => variable_get('extlink_icon_placement', 'append'), + 'extSubdomains' => variable_get('extlink_subdomains', 1), + 'extExclude' => variable_get('extlink_exclude', ''), + 'extInclude' => variable_get('extlink_include', ''), + 'extCssExclude' => variable_get('extlink_css_exclude', ''), + 'extCssExplicit' => variable_get('extlink_css_explicit', ''), + 'extAlert' => variable_get('extlink_alert', 0), + 'extAlertText' => variable_get('extlink_alert_text', 'This link will take you to an external web site. We are not responsible for their content.'), + 'mailtoClass' => variable_get('extlink_mailto_class', 'mailto'), + 'mailtoLabel' => check_plain(variable_get('extlink_mailto_label', t('(link sends e-mail)'))), + ), + ), 'setting'); } +/** + * Administrative settings. + */ function extlink_admin_settings() { $form = array(); @@ -46,7 +70,15 @@ function extlink_admin_settings() { '#title' => t('Place an icon next to external links.'), '#return_value' => 'ext', '#default_value' => variable_get('extlink_class', 'ext'), - '#description' => t('Places an !icon icon next to external links.', array('!icon' => theme('image', array('path' => drupal_get_path('module', 'extlink') . '/extlink.png', 'alt' => t('External Links icon'))))), + '#description' => t('Places an !icon icon next to external links.', + array( + '!icon' => theme('image', + array( + 'path' => drupal_get_path('module', 'extlink') . '/extlink.png', + 'alt' => t('External Links icon'), + ) + ), + )), ); $form['extlink_mailto_class'] = array( @@ -54,7 +86,15 @@ function extlink_admin_settings() { '#title' => t('Place an icon next to mailto links.'), '#return_value' => 'mailto', '#default_value' => variable_get('extlink_mailto_class', 'mailto'), - '#description' => t('Places an !icon icon next to mailto links.', array('!icon' => theme('image',array('path' => drupal_get_path('module', 'extlink') . '/mailto.png', 'alt' => t('Email links icon'))))), + '#description' => t('Places an !icon icon next to mailto links.', + array( + '!icon' => theme('image', + array( + 'path' => drupal_get_path('module', 'extlink') . '/mailto.png', + 'alt' => t('Email links icon'), + ) + ), + )), ); $form['extlink_img_class'] = array( @@ -65,6 +105,14 @@ function extlink_admin_settings() { '#description' => t('If checked, images wrapped in an anchor tag will be treated as external links.'), ); + $form['extlink_icon_placement'] = array( + '#type' => 'checkbox', + '#title' => t('Add icon in front of any processed link'), + '#return_value' => 'prepend', + '#default_value' => variable_get('extlink_icon_placement', 'append'), + '#description' => t('If checked, the icon will be placed in front of any external link, otherwise it will be placed behind it.'), + ); + $form['extlink_subdomains'] = array( '#type' => 'checkbox', '#title' => t('Exclude links with the same primary domain.'), @@ -120,12 +168,9 @@ function extlink_admin_settings() { '#collapsible' => TRUE, '#collapsed' => TRUE, '#description' => - '

    ' . t('External links uses patterns (regular expressions) to match the "href" property of links.') . '

    ' . - t('Here are some common patterns.') . - theme('item_list', array('items' => $patterns)) . - t('Common special characters:') . - theme('item_list', array('items' => $wildcards)) . - '

    ' . t('All special characters (!characters) must also be escaped with backslashes. Patterns are not case-sensitive. Any pattern supported by JavaScript may be used.', array('!characters' => '^ $ . ? ( ) | * +')) . '

    ', + '

    ' . t('External links uses patterns (regular expressions) to match the "href" property of links.') . '

    ' . t('Here are some common patterns.') . + theme('item_list', array('items' => $patterns)) . t('Common special characters:') . + theme('item_list', array('items' => $wildcards)) . '

    ' . t('All special characters (!characters) must also be escaped with backslashes. Patterns are not case-sensitive. Any pattern supported by JavaScript may be used.', array('!characters' => '^ $ . ? ( ) | * +')) . '

    ', ); $form['patterns']['extlink_exclude'] = array( @@ -151,7 +196,7 @@ function extlink_admin_settings() { '#collapsible' => TRUE, '#collapsed' => TRUE, '#description' => - '

    ' . t('Use CSS selectors to exclude entirely or only look inside explicitly specified classes and IDs for external links. These will be passed straight to jQuery for matching.') . '

    ', + '

    ' . t('Use CSS selectors to exclude entirely or only look inside explicitly specified classes and IDs for external links. These will be passed straight to jQuery for matching.') . '

    ', ); $form['css_matching']['extlink_css_exclude'] = array( @@ -173,22 +218,25 @@ function extlink_admin_settings() { return system_settings_form($form); } +/** + * Validation handler for admin settings form. + */ function extlink_admin_settings_validate($form, &$form_state) { - // Check if the exclude pattern is a valid regular expression + // Check if the exclude pattern is a valid regular expression. if ($exclude = $form_state['values']['extlink_exclude']) { - // Testing the regex via replace + // Testing the regex via replace. $regexeval = @preg_replace('/' . $exclude . '/', '', 'Lorem ipsum'); - // If the regex returns NULL, then throw an error and reset the variable + // If the regex returns NULL, then throw an error and reset the variable. if ($regexeval === NULL) { form_set_error('extlink_exclude', t('Invalid regular expression.')); variable_set('extlink_exclude', ''); } } - // Check if the include pattern is a valid regular expression + // Check if the include pattern is a valid regular expression. if ($include = $form_state['values']['extlink_include']) { - // Testing the regex via replace - $regexeval = @preg_replace('/' . $include . '/', '', 'Lorem ipsum'); - // If the regex returns NULL, then throw an error and reset the variable + // Testing the regex via replace. + $regexeval = @preg_replace('/' . $include . '/', '', 'Lorem ipsum'); + // If the regex returns NULL, then throw an error and reset the variable. if ($regexeval === NULL) { form_set_error('extlink_include', t('Invalid regular expression.')); variable_set('extlink_include', ''); diff --git a/sites/all/modules/contrib/theming/extlink/extlink.test b/sites/all/modules/contrib/theming/extlink/extlink.test index 2459125b..16a5c299 100644 --- a/sites/all/modules/contrib/theming/extlink/extlink.test +++ b/sites/all/modules/contrib/theming/extlink/extlink.test @@ -1,28 +1,39 @@ normal_user = $this->drupalCreateUser($permissions); + $this->normalUser = $this->drupalCreateUser($permissions); // Create an admin user. $permissions[] = 'administer site configuration'; $permissions[] = 'administer permissions'; $permissions[] = 'administer content types'; - $this->admin_user = $this->drupalCreateUser($permissions); - } - - protected function getNodeFormValues() { - $edit = array( - 'title' => 'node_title ' . $this->randomName(32), - 'body[' . LANGUAGE_NONE . '][0][value]' => 'node_body ' . $this->randomName(256) . ' Google!', - ); - return $edit; - } - - /** - * Test if External Link is present - */ - protected function assertExternalLinkPresence() { - $elements = $this->xpath('//span[@class="ext"]'); - if (count($elements) > 0) - $this->pass('There should be an External Link on the form.', 'External Links'); - else - $this->fail('There should be an External Link on the form.', 'External Links'); - } -} - -class ExtlinkTestCase extends ExtlinkBaseWebTestCase { - public static function getInfo() { - return array( - 'name' => t('General External Links functionality'), - 'description' => t('Testing the basic functionality of External Links'), - 'group' => t('External Links'), - ); + $this->adminUser = $this->drupalCreateUser($permissions); } + } +/** + * Test Case for External Links administration functionality. + */ class ExtlinkAdminTestCase extends ExtlinkBaseWebTestCase { + + /** + * Get test info. + */ public static function getInfo() { return array( 'name' => t('External Links administration functionality'), @@ -82,16 +72,14 @@ class ExtlinkAdminTestCase extends ExtlinkBaseWebTestCase { /** * Test access to the admin pages. */ - function testAdminAccess() { - $this->drupalLogin($this->normal_user); + public function testAdminAccess() { + $this->drupalLogin($this->normalUser); $this->drupalGet(self::EXTLINK_ADMIN_PATH); - file_put_contents('tmp.simpletest.html', $this->drupalGetContent()); $this->assertText(t('Access denied'), 'Normal users should not be able to access the External Links admin pages', 'External Links'); - $this->drupalLogin($this->admin_user); + $this->drupalLogin($this->adminUser); $this->drupalGet(self::EXTLINK_ADMIN_PATH); - file_put_contents('tmp.simpletest.html', $this->drupalGetContent()); $this->assertNoText(t('Access denied'), 'Admin users should be able to access the External Links admin pages', 'External Links'); } + } -?> \ No newline at end of file