From 514f3bd89e7ddd348ca974850eb57c8870b739e8 Mon Sep 17 00:00:00 2001 From: Bachir Soussi Chiadmi Date: Wed, 24 Apr 2019 16:39:12 +0200 Subject: [PATCH] security update link,module_filters,search_api_solr,ubercart,views --- PATCH_LIST.txt | 4 +- .../contrib/admin/context/context.core.inc | 26 +- .../contrib/admin/context/context.info | 7 +- .../contrib/admin/context/context.module | 5 + .../context_layouts/context_layouts.info | 7 +- .../admin/context/context_ui/context_ui.info | 7 +- .../context_condition_query_string.inc | 2 +- .../plugins/context_reaction_block.inc | 21 +- .../context/plugins/context_reaction_block.js | 2 +- .../plugins/context_reaction_region.inc | 6 +- .../contrib/admin/module_filter/CHANGELOG.txt | 37 +- .../contrib/admin/module_filter/README.txt | 4 +- .../admin/module_filter/css/module_filter.css | 6 + .../module_filter/css/module_filter_tab.css | 3 - .../admin/module_filter/css/modules.css | 10 +- .../admin/module_filter/images/collapsed.png | Bin 0 -> 105 bytes .../admin/module_filter/images/expanded.png | Bin 0 -> 106 bytes .../admin/module_filter/js/module_filter.js | 3 + .../module_filter/js/module_filter_tab.js | 21 +- .../contrib/admin/module_filter/js/modules.js | 9 +- .../module_filter/module_filter.admin.inc | 26 +- .../admin/module_filter/module_filter.info | 8 +- .../admin/module_filter/module_filter.install | 2 + .../admin/module_filter/module_filter.module | 84 +- .../module_filter/module_filter.pages.inc | 17 +- .../module_filter/module_filter.theme.inc | 54 +- .../payment/uc_2checkout/uc_2checkout.info | 7 +- .../payment/uc_2checkout/uc_2checkout.module | 7 +- .../uc_2checkout/uc_2checkout.pages.inc | 1 - .../uc_authorizenet/uc_authorizenet.info | 7 +- .../uc_authorizenet/uc_authorizenet.module | 49 +- .../uc_authorizenet/uc_authorizenet.pages.inc | 3 +- .../payment/uc_credit/tests/test_gateway.info | 7 +- .../uc_credit/tests/test_gateway.module | 2 +- .../payment/uc_credit/tests/uc_credit.test | 4 +- .../ubercart/payment/uc_credit/uc_credit.info | 7 +- .../payment/uc_credit/uc_credit.install | 1 - .../payment/uc_credit/uc_credit.module | 110 +- .../uc_cybersource/uc_cybersource.info | 7 +- .../uc_cybersource/uc_cybersource.module | 80 +- .../uc_cybersource/uc_cybersource.soap.inc | 2 + .../uc_google_checkout.info | 7 +- .../payment/uc_payment/tests/uc_payment.test | 9 +- .../payment/uc_payment/uc_payment.admin.inc | 1 - .../payment/uc_payment/uc_payment.info | 7 +- .../payment/uc_payment/uc_payment.module | 1 - .../payment/uc_payment/uc_payment.rules.inc | 3 + .../uc_payment/uc_payment_order_pane.inc | 1 + .../uc_payment_pack/uc_payment_pack.info | 7 +- .../uc_payment_pack/uc_payment_pack.module | 1 - .../uc_payment_pack.variable.inc | 1 - .../ubercart/payment/uc_paypal/uc_paypal.info | 7 +- .../payment/uc_paypal/uc_paypal.module | 57 +- .../payment/uc_paypal/uc_paypal.pages.inc | 38 +- .../shipping/uc_flatrate/uc_flatrate.info | 7 +- .../shipping/uc_flatrate/uc_flatrate.module | 1 - .../shipping/uc_quote/tests/uc_quote.test | 31 +- .../ubercart/shipping/uc_quote/uc_quote.info | 7 +- .../shipping/uc_quote/uc_quote.module | 3 +- .../shipping/uc_quote/uc_quote.variable.inc | 1 - .../uc_shipping/uc-packing-slip.tpl.php | 2 +- .../uc_shipping/uc_shipping.admin.inc | 28 +- .../shipping/uc_shipping/uc_shipping.api.php | 5 +- .../shipping/uc_shipping/uc_shipping.info | 7 +- .../shipping/uc_shipping/uc_shipping.module | 6 +- .../uc_shipping/uc_shipping.rules.inc | 2 +- .../uc_shipping/uc_shipping.tokens.inc | 1 - ..._shipping_handler_field_package_weight.inc | 2 + .../ubercart/shipping/uc_ups/uc_ups.admin.inc | 20 +- .../ubercart/shipping/uc_ups/uc_ups.info | 7 +- .../ubercart/shipping/uc_ups/uc_ups.module | 24 +- .../ubercart/shipping/uc_ups/uc_ups.ship.inc | 26 +- .../shipping/uc_usps/uc_usps.admin.inc | 18 +- .../ubercart/shipping/uc_usps/uc_usps.info | 7 +- .../ubercart/shipping/uc_usps/uc_usps.module | 27 +- .../uc_usps/uc_usps.rules_defaults.inc | 4 +- .../uc_weightquote/uc_weightquote.info | 7 +- .../uc_weightquote/uc_weightquote.module | 1 - .../ubercart/uc_ajax_admin/uc_ajax_admin.info | 7 +- .../uc_ajax_admin/uc_ajax_admin.module | 3 +- .../uc_attribute/tests/uc_attribute.test | 3 +- .../tests/uc_attribute_checkout.test | 5 +- .../uc_attribute/uc_attribute.admin.inc | 19 +- .../ubercart/uc_attribute/uc_attribute.info | 7 +- .../ubercart/uc_attribute/uc_attribute.module | 181 +- .../ubercart/uc_cart/tests/uc_cart.test | 125 +- .../uc_cart/tests/uc_cart_entity_test.info | 7 +- .../ubercart/uc_cart/uc_cart.admin.inc | 9 +- .../ubercart/uc_cart/uc_cart.api.php | 3 +- .../ubercart/uc_cart/uc_cart.controller.inc | 6 +- .../ecommerce/ubercart/uc_cart/uc_cart.info | 7 +- .../ubercart/uc_cart/uc_cart.info.inc | 1 - .../ubercart/uc_cart/uc_cart.install | 2 +- .../ecommerce/ubercart/uc_cart/uc_cart.module | 22 +- .../ubercart/uc_cart/uc_cart.rules.inc | 3 +- .../uc_cart/uc_cart.rules_defaults.inc | 2 +- .../ubercart/uc_cart/uc_cart.variable.inc | 1 - .../uc_cart/uc_cart_checkout_pane.inc | 2 +- .../uc_cart_links/tests/uc_cart_links.test | 211 +- .../ubercart/uc_cart_links/uc_cart_links.info | 7 +- .../uc_cart_links/uc_cart_links.install | 4 +- .../uc_cart_links/uc_cart_links.module | 1 - .../uc_cart_links/uc_cart_links.pages.inc | 11 +- .../ubercart/uc_catalog/classes/treenode.inc | 7 +- .../ubercart/uc_catalog/tests/uc_catalog.test | 13 +- .../ubercart/uc_catalog/uc_catalog.admin.inc | 1 - .../ubercart/uc_catalog/uc_catalog.info | 7 +- .../ubercart/uc_catalog/uc_catalog.module | 4 +- .../uc_catalog/uc_catalog.pathauto.inc | 2 +- .../ubercart/uc_catalog/uc_catalog.theme.inc | 1 + .../views/uc_catalog.views_default.inc | 4 +- .../ubercart/uc_file/tests/uc_file.test | 5 +- .../ubercart/uc_file/uc_file.admin.inc | 32 +- .../ubercart/uc_file/uc_file.api.php | 16 +- .../ecommerce/ubercart/uc_file/uc_file.css | 2 +- .../ecommerce/ubercart/uc_file/uc_file.info | 7 +- .../ecommerce/ubercart/uc_file/uc_file.module | 21 +- .../ubercart/uc_file/uc_file.pages.inc | 21 +- .../ubercart/uc_file/uc_file.rules.inc | 11 +- .../uc_googleanalytics.info | 9 +- .../uc_googleanalytics.install | 21 + .../uc_googleanalytics.module | 21 +- .../templates/uc-order--admin.tpl.php | 2 +- .../ubercart/uc_order/tests/uc_order.test | 27 +- .../ubercart/uc_order/uc_order.admin.inc | 21 +- .../ubercart/uc_order/uc_order.api.php | 1 - .../ubercart/uc_order/uc_order.controller.inc | 2 + .../ubercart/uc_order/uc_order.i18n.inc | 1 - .../ecommerce/ubercart/uc_order/uc_order.info | 7 +- .../ubercart/uc_order/uc_order.info.inc | 4 +- .../ubercart/uc_order/uc_order.install | 1 - .../ubercart/uc_order/uc_order.line_item.inc | 2 +- .../ubercart/uc_order/uc_order.module | 30 +- .../ubercart/uc_order/uc_order.order_pane.inc | 13 +- .../ubercart/uc_order/uc_order.rules.inc | 27 +- .../uc_order_handler_field_order_fullname.inc | 4 +- .../uc_order_handler_field_payment_method.inc | 1 + .../uc_order_handler_filter_order_status.inc | 1 + .../views/uc_order_handler_filter_total.inc | 2 + .../views/uc_order_handler_sort_total.inc | 2 + ...der_plugin_argument_validate_user_perm.inc | 4 +- .../ubercart/uc_product/tests/uc_product.test | 1 + .../ubercart/uc_product/uc_product.api.php | 10 +- .../ubercart/uc_product/uc_product.info | 7 +- .../ubercart/uc_product/uc_product.module | 8 +- .../ubercart/uc_product/uc_product.rules.inc | 2 +- .../ubercart/uc_product/uc_product.theme.inc | 18 +- .../uc_product_handler_field_addtocart.inc | 1 + .../uc_product_handler_field_buyitnow.inc | 1 + ...uc_product_handler_field_display_price.inc | 1 + .../views/uc_product_handler_field_length.inc | 1 + .../views/uc_product_handler_field_price.inc | 1 + .../views/uc_product_handler_field_weight.inc | 1 + .../uc_product_handler_filter_product.inc | 1 + .../uc_product_kit/tests/uc_product_kit.test | 14 +- .../uc_product_kit/uc_product_kit.info | 7 +- .../uc_product_kit/uc_product_kit.module | 17 +- ...product_kit_handler_filter_product_kit.inc | 2 + ...ct_kit_handler_filter_product_kit_item.inc | 3 +- .../ubercart/uc_reports/uc_reports.admin.inc | 5 +- .../ubercart/uc_reports/uc_reports.info | 7 +- .../ubercart/uc_reports/uc_reports.module | 16 +- .../ubercart/uc_roles/tests/uc_roles.test | 7 +- .../ecommerce/ubercart/uc_roles/uc_roles.info | 7 +- .../ubercart/uc_roles/uc_roles.install | 2 +- .../ubercart/uc_roles/uc_roles.module | 63 +- .../ubercart/uc_roles/uc_roles.rules.inc | 18 +- .../uc_roles/uc_roles.rules_defaults.inc | 2 +- .../ubercart/uc_roles/uc_roles.theme.inc | 14 +- .../ubercart/uc_roles/uc_roles.tokens.inc | 1 + .../ubercart/uc_stock/tests/uc_stock.test | 5 +- .../ubercart/uc_stock/uc_stock.admin.inc | 1 - .../ecommerce/ubercart/uc_stock/uc_stock.info | 7 +- .../ubercart/uc_stock/uc_stock.module | 6 +- .../ubercart/uc_stock/uc_stock.variable.inc | 1 - ...c_stock_handler_filter_below_threshold.inc | 1 + .../ubercart/uc_store/classes/address.inc | 1 - .../ubercart/uc_store/classes/encrypt.inc | 2 +- .../uc_store/countries/afghanistan_4_1.cif | 10 +- .../countries/aland_islands_248_1.cif | 14 +- .../uc_store/countries/albania_8_1.cif | 14 +- .../uc_store/countries/algeria_12_1.cif | 12 +- .../countries/american_samoa_16_1.cif | 14 +- .../uc_store/countries/andorra_20_1.cif | 10 +- .../uc_store/countries/angola_24_1.cif | 14 +- .../uc_store/countries/anguilla_660_1.cif | 14 +- .../uc_store/countries/antarctica_10_1.cif | 14 +- .../countries/antigua_barbuda_28_1.cif | 14 +- .../uc_store/countries/argentina_32_1.cif | 14 +- .../uc_store/countries/armenia_51_1.cif | 10 +- .../uc_store/countries/aruba_533_1.cif | 10 +- .../uc_store/countries/australia_36_2.cif | 10 +- .../uc_store/countries/austria_40_1.cif | 10 +- .../uc_store/countries/azerbaijan_31_1.cif | 14 +- .../uc_store/countries/bahamas_44_1.cif | 10 +- .../uc_store/countries/bahrain_48_3.cif | 13 +- .../uc_store/countries/bangladesh_50_1.cif | 14 +- .../uc_store/countries/barbados_52_1.cif | 10 +- .../uc_store/countries/belarus_112_1.cif | 14 +- .../uc_store/countries/belgium_56_3.cif | 19 +- .../uc_store/countries/belize_84_1.cif | 10 +- .../uc_store/countries/benin_204_1.cif | 14 +- .../uc_store/countries/bermuda_60_1.cif | 12 +- .../uc_store/countries/bhutan_64_1.cif | 14 +- .../uc_store/countries/bolivia_68_1.cif | 14 +- .../uc_store/countries/bonaire_535_1.cif | 14 +- .../countries/bosnia_herzegovina_70_2.cif | 15 +- .../uc_store/countries/botswana_72_1.cif | 10 +- .../uc_store/countries/bouvet_island_74_1.cif | 14 +- .../uc_store/countries/brazil_76_1.cif | 14 +- .../british_indian_ocean_territory_86_1.cif | 14 +- .../countries/brunei_darussalam_96_3.cif | 33 +- .../uc_store/countries/bulgaria_100_1.cif | 28 - .../uc_store/countries/bulgaria_100_2.cif | 118 ++ .../uc_store/countries/burkina_faso_854_1.cif | 14 +- .../uc_store/countries/burundi_108_1.cif | 14 +- .../uc_store/countries/cambodia_116_1.cif | 10 +- .../uc_store/countries/cameroon_120_1.cif | 14 +- .../uc_store/countries/canada_124_2.cif | 19 +- .../uc_store/countries/cape_verde_132_1.cif | 14 +- .../countries/cayman_islands_136_1.cif | 14 +- .../central_african_republic_140_1.cif | 14 +- .../uc_store/countries/chad_148_1.cif | 14 +- .../uc_store/countries/chile_152_1.cif | 14 +- .../uc_store/countries/china_156_1.cif | 16 +- .../countries/christmas_island_162_1.cif | 14 +- .../countries/cocos_islands_166_1.cif | 14 +- .../uc_store/countries/colombia_170_1.cif | 72 - .../uc_store/countries/colombia_170_2.cif | 164 ++ .../uc_store/countries/comoros_174_1.cif | 14 +- .../uc_store/countries/congo_178_1.cif | 14 +- .../congo_democratic_republic_of_180_1.cif | 14 +- .../uc_store/countries/cook_islands_184_1.cif | 14 +- .../uc_store/countries/costa_rica_188_2.cif | 15 +- .../countries/cote_d_ivoire_384_1.cif | 14 +- .../uc_store/countries/croatia_191_1.cif | 12 +- .../uc_store/countries/cuba_192_1.cif | 14 +- .../uc_store/countries/curacao_531_1.cif | 14 +- .../uc_store/countries/cyprus_196_1.cif | 4 + .../uc_store/countries/czech_203_1.cif | 14 +- .../uc_store/countries/denmark_208_2.cif | 10 +- .../uc_store/countries/djibouti_262_1.cif | 14 +- .../uc_store/countries/dominica_212_1.cif | 14 +- .../countries/dominican_republic_214_1.cif | 10 +- .../uc_store/countries/ecuador_218_1.cif | 10 +- .../uc_store/countries/egypt_818_1.cif | 10 +- .../uc_store/countries/el_salvador_222_1.cif | 10 +- .../countries/equatorial_guinea_226_1.cif | 14 +- .../uc_store/countries/eritrea_232_1.cif | 14 +- .../uc_store/countries/estonia_233_1.cif | 12 +- .../uc_store/countries/ethiopia_231_1.cif | 14 +- .../countries/falkland_islands_238_2.cif | 19 +- .../countries/faroe_islands_234_1.cif | 14 +- .../uc_store/countries/fiji_242_1.cif | 14 +- .../uc_store/countries/finland_246_2.cif | 19 +- .../uc_store/countries/france_250_1.cif | 14 +- .../countries/french_guiana_254_1.cif | 14 +- .../countries/french_polynesia_258_1.cif | 14 +- .../french_southern_territories_260_1.cif | 14 +- .../uc_store/countries/gabon_266_1.cif | 14 +- .../uc_store/countries/gambia_270_1.cif | 14 +- .../uc_store/countries/georgia_268_1.cif | 10 +- .../uc_store/countries/germany_276_1.cif | 14 +- .../uc_store/countries/ghana_288_1.cif | 14 +- .../uc_store/countries/gibraltar_292_1.cif | 10 +- .../uc_store/countries/greece_300_1.cif | 16 +- .../uc_store/countries/greenland_304_1.cif | 10 +- .../uc_store/countries/grenada_308_1.cif | 14 +- .../uc_store/countries/guadeloupe_312_1.cif | 14 +- .../uc_store/countries/guam_316_1.cif | 10 +- .../uc_store/countries/guatemala_320_1.cif | 14 +- .../uc_store/countries/guernsey_831_1.cif | 14 +- .../uc_store/countries/guinea_324_1.cif | 14 +- .../countries/guinea_bissau_624_1.cif | 14 +- .../uc_store/countries/guyana_328_1.cif | 14 +- .../uc_store/countries/haiti_332_1.cif | 14 +- .../uc_store/countries/heard_island_334_1.cif | 14 +- .../uc_store/countries/holy_see_336_1.cif | 14 +- .../uc_store/countries/honduras_340_1.cif | 14 +- .../uc_store/countries/hong_kong_344_1.cif | 12 +- .../uc_store/countries/hungary_348_1.cif | 10 +- .../uc_store/countries/iceland_352_1.cif | 14 +- .../uc_store/countries/india_356_3.cif | 17 +- .../uc_store/countries/indonesia_360_1.cif | 14 +- .../uc_store/countries/iran_364_3.cif | 16 +- .../uc_store/countries/iraq_368_1.cif | 14 +- .../uc_store/countries/ireland_372_2.cif | 29 +- .../uc_store/countries/isle_of_man_833_1.cif | 10 +- .../uc_store/countries/israel_376_1.cif | 10 +- .../uc_store/countries/italy_380_3.cif | 27 +- .../uc_store/countries/jamaica_388_2.cif | 14 +- .../uc_store/countries/japan_392_1.cif | 18 +- .../uc_store/countries/jersey_832_1.cif | 14 +- .../uc_store/countries/jordan_400_1.cif | 14 +- .../uc_store/countries/kazakhstan_398_1.cif | 14 +- .../uc_store/countries/kenya_404_1.cif | 10 +- .../uc_store/countries/kiribati_296_1.cif | 14 +- ...a_democratic_peoples_republic_of_408_2.cif | 19 +- .../countries/korea_republic_of_410_1.cif | 10 +- .../uc_store/countries/kuwait_414_1.cif | 14 +- .../uc_store/countries/kyrgyzstan_417_1.cif | 14 +- .../uc_store/countries/laos_418_1.cif | 14 +- .../uc_store/countries/latvia_428_1.cif | 16 +- .../uc_store/countries/lebanon_422_1.cif | 14 +- .../uc_store/countries/lesotho_426_1.cif | 14 +- .../uc_store/countries/liberia_430_1.cif | 14 +- .../uc_store/countries/libya_434_2.cif | 19 +- .../countries/liechtenstein_438_1.cif | 14 +- .../uc_store/countries/lithuania_440_1.cif | 16 +- .../uc_store/countries/luxembourg_442_1.cif | 10 +- .../uc_store/countries/macao_446_1.cif | 10 +- .../uc_store/countries/macedonia_807_1.cif | 10 +- .../uc_store/countries/madagascar_450_1.cif | 14 +- .../uc_store/countries/malawi_454_1.cif | 14 +- .../uc_store/countries/malaysia_458_1.cif | 14 +- .../uc_store/countries/maldives_462_1.cif | 14 +- .../uc_store/countries/mali_466_1.cif | 14 +- .../uc_store/countries/malta_470_1.cif | 10 +- .../countries/marshall_islands_584_1.cif | 14 +- .../uc_store/countries/martinique_474_1.cif | 14 +- .../uc_store/countries/mauritania_478_1.cif | 14 +- .../uc_store/countries/mauritius_480_1.cif | 10 +- .../uc_store/countries/mayotte_175_1.cif | 14 +- .../uc_store/countries/mexico_484_1.cif | 16 +- .../uc_store/countries/micronesia_583_1.cif | 14 +- .../uc_store/countries/moldova_498_1.cif | 4 + .../uc_store/countries/monaco_492_1.cif | 10 +- .../uc_store/countries/mongolia_496_1.cif | 14 +- .../uc_store/countries/montenegro_499_1.cif | 10 +- .../uc_store/countries/montserrat_500_1.cif | 14 +- .../uc_store/countries/morocco_504_1.cif | 10 +- .../uc_store/countries/mozambique_508_1.cif | 14 +- .../uc_store/countries/myanmar_104_1.cif | 10 +- .../uc_store/countries/namibia_516_1.cif | 14 +- .../uc_store/countries/nauru_520_1.cif | 14 +- .../uc_store/countries/nepal_524_1.cif | 10 +- .../uc_store/countries/netherlands_528_1.cif | 14 +- .../countries/new_caledonia_540_1.cif | 10 +- .../uc_store/countries/new_zealand_554_3.cif | 19 +- .../uc_store/countries/nicaragua_558_1.cif | 10 +- .../uc_store/countries/niger_562_1.cif | 14 +- .../uc_store/countries/nigeria_566_1.cif | 16 +- .../uc_store/countries/niue_570_1.cif | 14 +- .../countries/norfolk_island_574_1.cif | 14 +- .../northern_mariana_islands_580_1.cif | 14 +- .../uc_store/countries/norway_578_1.cif | 16 +- .../uc_store/countries/oman_512_1.cif | 14 +- .../uc_store/countries/pakistan_586_1.cif | 14 +- .../uc_store/countries/palau_585_1.cif | 14 +- .../uc_store/countries/palestine_275_1.cif | 14 +- .../uc_store/countries/panama_591_1.cif | 10 +- .../countries/papua_new_guinea_598_1.cif | 16 +- .../uc_store/countries/paraguay_600_1.cif | 14 +- .../uc_store/countries/peru_604_1.cif | 14 +- .../uc_store/countries/philippines_608_2.cif | 14 +- .../uc_store/countries/pitcairn_612_1.cif | 14 +- .../uc_store/countries/poland_616_1.cif | 14 +- .../uc_store/countries/portugal_620_1.cif | 14 +- .../uc_store/countries/puerto_rico_630_1.cif | 10 +- .../uc_store/countries/qatar_634_1.cif | 14 +- .../uc_store/countries/reunion_638_2.cif | 15 +- .../uc_store/countries/romania_642_2.cif | 19 +- .../uc_store/countries/russia_643_2.cif | 19 +- .../uc_store/countries/rwanda_646_1.cif | 14 +- .../countries/saint_barthelemy_652_2.cif | 19 +- .../uc_store/countries/saint_helena_654_1.cif | 14 +- .../countries/saint_kitts_nevis_659_1.cif | 14 +- .../uc_store/countries/saint_lucia_662_1.cif | 10 +- .../uc_store/countries/saint_martin_663_1.cif | 14 +- .../countries/saint_pierre_miquelon_666_1.cif | 14 +- .../saint_vincent_grenadines_670_1.cif | 14 +- .../uc_store/countries/samoa_882_1.cif | 14 +- .../uc_store/countries/san_marino_674_1.cif | 14 +- .../countries/sao_tome_principe_678_1.cif | 14 +- .../uc_store/countries/saudi_arabia_682_2.cif | 10 +- .../uc_store/countries/senegal_686_1.cif | 10 +- .../uc_store/countries/serbia_688_1.cif | 10 +- .../uc_store/countries/seychelles_690_1.cif | 10 +- .../uc_store/countries/sierra_leone_694_1.cif | 14 +- .../uc_store/countries/singapore_702_2.cif | 11 +- .../uc_store/countries/sint_maarten_534_1.cif | 14 +- .../uc_store/countries/slovakia_703_1.cif | 10 +- .../uc_store/countries/slovenia_705_1.cif | 10 +- .../countries/solomon_islands_90_1.cif | 14 +- .../uc_store/countries/somalia_706_1.cif | 14 +- .../uc_store/countries/south_africa_710_1.cif | 12 +- ...h_georgia_south_sandwich_islands_239_1.cif | 14 +- .../uc_store/countries/spain_724_1.cif | 16 +- .../uc_store/countries/sri_lanka_144_1.cif | 10 +- .../uc_store/countries/sudan_736_1.cif | 14 +- .../uc_store/countries/suriname_740_1.cif | 10 +- .../countries/svalbard_jan_mayen_744_1.cif | 14 +- .../uc_store/countries/swaziland_748_1.cif | 14 +- .../uc_store/countries/sweden_752_1.cif | 10 +- .../uc_store/countries/switzerland_756_1.cif | 10 +- .../uc_store/countries/syria_760_1.cif | 14 +- .../uc_store/countries/taiwan_158_2.cif | 21 +- .../uc_store/countries/tajikistan_762_1.cif | 14 +- .../uc_store/countries/tanzania_834_2.cif | 15 +- .../uc_store/countries/thailand_764_3.cif | 17 +- .../uc_store/countries/timor_leste_626_1.cif | 14 +- .../uc_store/countries/togo_768_1.cif | 14 +- .../uc_store/countries/tokelau_772_1.cif | 14 +- .../uc_store/countries/tonga_776_1.cif | 14 +- .../countries/trinidad_tobago_780_1.cif | 14 +- .../uc_store/countries/tunisia_788_1.cif | 10 +- .../uc_store/countries/turkey_792_3.cif | 24 +- .../uc_store/countries/turkmenistan_795_1.cif | 14 +- .../countries/turks_caicos_islands_796_1.cif | 14 +- .../uc_store/countries/tuvalu_798_1.cif | 14 +- .../uc_store/countries/uganda_800_1.cif | 14 +- .../uc_store/countries/ukraine_804_1.cif | 18 +- .../countries/united_arab_emirates_784_1.cif | 14 +- .../countries/united_kingdom_826_2.cif | 24 +- .../countries/united_states_840_1.cif | 14 +- ...ed_states_minor_outlying_islands_581_1.cif | 14 +- .../uc_store/countries/uruguay_858_1.cif | 10 +- .../uc_store/countries/uzbekistan_860_1.cif | 14 +- .../uc_store/countries/vanuatu_548_1.cif | 14 +- .../uc_store/countries/venezuela_862_2.cif | 15 +- .../uc_store/countries/vietnam_704_2.cif | 19 +- .../countries/virgin_islands_british_92_1.cif | 10 +- .../countries/virgin_islands_us_850_1.cif | 10 +- .../countries/wallis_futuna_876_1.cif | 14 +- .../countries/western_sahara_732_1.cif | 14 +- .../uc_store/countries/yemen_887_1.cif | 14 +- .../uc_store/countries/zambia_894_1.cif | 14 +- .../uc_store/countries/zimbabwe_716_1.cif | 10 +- .../ubercart/uc_store/includes/ca.inc | 13 + .../ubercart/uc_store/includes/tapir.inc | 6 +- .../uc_store/includes/uc_ajax_attach.inc | 2 + .../ubercart/uc_store/tests/uc_address.test | 3 +- .../ubercart/uc_store/tests/uc_ajax.test | 7 +- .../ubercart/uc_store/tests/uc_store.test | 32 +- .../ubercart/uc_store/uc_store.admin.inc | 13 +- .../ecommerce/ubercart/uc_store/uc_store.info | 7 +- .../ubercart/uc_store/uc_store.module | 149 +- .../ubercart/uc_store/uc_store.theme.inc | 1 - .../ubercart/uc_store/uc_store.variable.inc | 1 - .../uc_tax_report/uc_tax_report.admin.inc | 12 +- .../ubercart/uc_tax_report/uc_tax_report.info | 7 +- .../ubercart/uc_taxes/tests/uc_taxes.test | 10 +- .../ubercart/uc_taxes/uc_taxes.admin.inc | 7 +- .../ubercart/uc_taxes/uc_taxes.api.php | 4 +- .../ecommerce/ubercart/uc_taxes/uc_taxes.info | 7 +- .../ubercart/uc_taxes/uc_taxes.module | 13 +- .../uc_taxes/uc_taxes.rules_defaults.inc | 3 +- .../modules/contrib/fields/link/README.txt | 103 +- .../contrib/fields/link/{ => css}/link.css | 1 - .../modules/contrib/fields/link/link-rtl.css | 8 - .../link/link-validate_url-2299657-46.patch | 370 ---- .../fields/link/link.devel_generate.inc | 3 +- .../modules/contrib/fields/link/link.diff.inc | 4 +- .../all/modules/contrib/fields/link/link.info | 9 +- .../modules/contrib/fields/link/link.install | 79 +- .../contrib/fields/link/link.migrate.inc | 48 +- .../modules/contrib/fields/link/link.module | 590 ++++-- .../fields/link/tests/link.attribute.test | 166 +- .../contrib/fields/link/tests/link.crud.test | 38 +- .../fields/link/tests/link.crud_browser.test | 238 ++- .../fields/link/tests/link.entity_token.test | 67 +- .../fields/link/tests/link.multilingual.test | 191 ++ .../contrib/fields/link/tests/link.test | 20 +- .../contrib/fields/link/tests/link.token.test | 233 ++- .../fields/link/tests/link.validate.test | 447 +++- .../contrib/fields/link/views/link.views.inc | 113 -- .../link_views_handler_argument_target.inc | 21 +- .../link_views_handler_filter_protocol.inc | 67 +- .../search/search_api_solr/CHANGELOG.txt | 20 + .../search_api_solr/includes/document.inc | 118 +- .../search_api_solr/includes/service.inc | 294 ++- .../search_api_solr/search_api_solr.info | 7 +- .../search_api_solr/search_api_solr.module | 2 +- .../solr-conf/5.x/solrconfig.xml | 2 +- .../search_api_solr/solr-conf/7.x/elevate.xml | 31 + .../solr-conf/7.x/mapping-ISOLatin1Accent.txt | 14 + .../solr-conf/7.x/protwords.txt | 7 + .../search_api_solr/solr-conf/7.x/schema.xml | 693 +++++++ .../solr-conf/7.x/schema_extra_fields.xml | 23 + .../solr-conf/7.x/schema_extra_types.xml | 34 + .../solr-conf/7.x/solrconfig.xml | 1793 +++++++++++++++++ .../solr-conf/7.x/solrconfig_extra.xml | 80 + .../solr-conf/7.x/solrcore.properties | 20 + .../solr-conf/7.x/stopwords.txt | 4 + .../solr-conf/7.x/synonyms.txt | 3 + .../handlers/views_handler_argument_null.inc | 2 +- .../views/handlers/views_handler_field.inc | 3 +- .../views_handler_field_serialized.inc | 2 +- .../contrib/views/views/includes/handlers.inc | 77 +- .../contrib/views/views/includes/view.inc | 2 +- .../plugins/views_plugin_display_feed.inc | 3 + .../views/tests/views_argument_validator.test | 83 +- .../views/tests/views_handler_filter.test | 161 ++ .../views/views/tests/views_query.test | 35 + .../contrib/views/views/tests/views_test.info | 6 +- .../modules/contrib/views/views/views.info | 7 +- .../modules/contrib/views/views/views_ui.info | 6 +- 497 files changed, 9038 insertions(+), 3662 deletions(-) create mode 100644 sites/all/modules/contrib/admin/module_filter/images/collapsed.png create mode 100644 sites/all/modules/contrib/admin/module_filter/images/expanded.png create mode 100644 sites/all/modules/contrib/ecommerce/ubercart/uc_googleanalytics/uc_googleanalytics.install delete mode 100644 sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/bulgaria_100_1.cif create mode 100644 sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/bulgaria_100_2.cif delete mode 100644 sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/colombia_170_1.cif create mode 100644 sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/colombia_170_2.cif rename sites/all/modules/contrib/fields/link/{ => css}/link.css (99%) delete mode 100644 sites/all/modules/contrib/fields/link/link-rtl.css delete mode 100644 sites/all/modules/contrib/fields/link/link-validate_url-2299657-46.patch create mode 100644 sites/all/modules/contrib/fields/link/tests/link.multilingual.test delete mode 100644 sites/all/modules/contrib/fields/link/views/link.views.inc create mode 100644 sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/elevate.xml create mode 100644 sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/mapping-ISOLatin1Accent.txt create mode 100644 sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/protwords.txt create mode 100644 sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/schema.xml create mode 100644 sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/schema_extra_fields.xml create mode 100644 sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/schema_extra_types.xml create mode 100644 sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/solrconfig.xml create mode 100644 sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/solrconfig_extra.xml create mode 100644 sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/solrcore.properties create mode 100644 sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/stopwords.txt create mode 100644 sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/synonyms.txt create mode 100644 sites/all/modules/contrib/views/views/tests/views_handler_filter.test diff --git a/PATCH_LIST.txt b/PATCH_LIST.txt index 40ea7a6d..5ec3a180 100644 --- a/PATCH_LIST.txt +++ b/PATCH_LIST.txt @@ -9,7 +9,7 @@ https://www.drupal.org/node/1754162 # Modules : -link : allow any tld (https://www.drupal.org/node/2299657#comment-11414075) +// link : allow any tld (https://www.drupal.org/node/2299657#comment-11414075) commited in dev cer contentadminrelink // entity_translation_search_api @@ -23,7 +23,7 @@ filter_path_alias // search_api_page // search_api_solr termreferencetree -views +?? views wysiwyg views_rss_media node_export : diff --git a/sites/all/modules/contrib/admin/context/context.core.inc b/sites/all/modules/contrib/admin/context/context.core.inc index 41ed93a5..9e198314 100644 --- a/sites/all/modules/contrib/admin/context/context.core.inc +++ b/sites/all/modules/contrib/admin/context/context.core.inc @@ -94,11 +94,27 @@ function context_theme_registry_alter(&$theme_registry) { */ function context_ctools_render_alter($info, $page, $data) { extract($data); - if ($page && in_array($task['name'], array('node_view', 'node_edit'), TRUE)) { - foreach ($contexts as $ctools_context) { - if (in_array('node', $ctools_context->type) && !empty($ctools_context->data)) { - context_node_condition($ctools_context->data, $task['name'] === 'node_view' ? 'view' : 'form'); - break; + + // Check for page handlers. + if ($page) { + // Check for node page handler. + if (in_array($task['name'], array('node_view', 'node_edit'), TRUE)) { + foreach ($contexts as $ctools_context) { + if (in_array('node', $ctools_context->type) && !empty($ctools_context->data)) { + context_node_condition($ctools_context->data, $task['name'] === 'node_view' ? 'view' : 'form'); + break; + } + } + } + // Check for taxonomy term page handler. + elseif (in_array($task['name'], array('term_view', 'term_edit'), TRUE)) { + foreach ($contexts as $ctools_context) { + if (in_array('taxonomy_term', $ctools_context->type) && !empty($ctools_context->data)) { + if ($plugin = context_get_plugin('condition', 'taxonomy_term')) { + $plugin->execute($ctools_context->data, $task['name'] === 'term_view' ? 'view' : 'form'); + } + break; + } } } } diff --git a/sites/all/modules/contrib/admin/context/context.info b/sites/all/modules/contrib/admin/context/context.info index 159f142a..eef3a9c1 100644 --- a/sites/all/modules/contrib/admin/context/context.info +++ b/sites/all/modules/contrib/admin/context/context.info @@ -8,9 +8,8 @@ files[] = tests/context.test files[] = tests/context.conditions.test files[] = tests/context.reactions.test -; Information added by Drupal.org packaging script on 2016-05-18 -version = "7.x-3.7" +; Information added by Drupal.org packaging script on 2019-02-26 +version = "7.x-3.10" core = "7.x" project = "context" -datestamp = "1463605446" - +datestamp = "1551220089" diff --git a/sites/all/modules/contrib/admin/context/context.module b/sites/all/modules/contrib/admin/context/context.module index 5c0bd5c8..c83b15ef 100644 --- a/sites/all/modules/contrib/admin/context/context.module +++ b/sites/all/modules/contrib/admin/context/context.module @@ -243,6 +243,11 @@ function context_preprocess_menu_link(&$variables) { // css class to the link of this menu. // - Do not add class twice on current page. if (in_array($variables['element']['#href'], $reaction_menu_paths) && $variables['element']['#href'] != $_GET['q']) { + // Initialize classes array if not set. + if (!isset($variables['element']['#localized_options']['attributes']['class'])) { + $variables['element']['#localized_options']['attributes']['class'] = array(); + } + // Do not add the 'active' class twice in views tabs. if (!in_array('active', $variables['element']['#localized_options']['attributes']['class'])) { $variables['element']['#localized_options']['attributes']['class'][] = 'active'; diff --git a/sites/all/modules/contrib/admin/context/context_layouts/context_layouts.info b/sites/all/modules/contrib/admin/context/context_layouts/context_layouts.info index 129c4cdb..65880e38 100644 --- a/sites/all/modules/contrib/admin/context/context_layouts/context_layouts.info +++ b/sites/all/modules/contrib/admin/context/context_layouts/context_layouts.info @@ -6,9 +6,8 @@ core = 7.x files[] = plugins/context_layouts_reaction_block.inc -; Information added by Drupal.org packaging script on 2016-05-18 -version = "7.x-3.7" +; Information added by Drupal.org packaging script on 2019-02-26 +version = "7.x-3.10" core = "7.x" project = "context" -datestamp = "1463605446" - +datestamp = "1551220089" diff --git a/sites/all/modules/contrib/admin/context/context_ui/context_ui.info b/sites/all/modules/contrib/admin/context/context_ui/context_ui.info index e6c51051..e5d17f8f 100644 --- a/sites/all/modules/contrib/admin/context/context_ui/context_ui.info +++ b/sites/all/modules/contrib/admin/context/context_ui/context_ui.info @@ -8,9 +8,8 @@ configure = admin/structure/context files[] = context.module files[] = tests/context_ui.test -; Information added by Drupal.org packaging script on 2016-05-18 -version = "7.x-3.7" +; Information added by Drupal.org packaging script on 2019-02-26 +version = "7.x-3.10" core = "7.x" project = "context" -datestamp = "1463605446" - +datestamp = "1551220089" diff --git a/sites/all/modules/contrib/admin/context/plugins/context_condition_query_string.inc b/sites/all/modules/contrib/admin/context/plugins/context_condition_query_string.inc index 781d4cbb..b7bf5d51 100644 --- a/sites/all/modules/contrib/admin/context/plugins/context_condition_query_string.inc +++ b/sites/all/modules/contrib/admin/context/plugins/context_condition_query_string.inc @@ -16,7 +16,7 @@ class context_condition_query_string extends context_condition_path { */ function execute() { if ($this->condition_used()) { - $current_query_string = $_SERVER["QUERY_STRING"]; + $current_query_string = empty($_SERVER["QUERY_STRING"]) ? '' : $_SERVER["QUERY_STRING"]; foreach ($this->get_contexts() as $context) { $query_strings = $this->fetch_from_context($context, 'values'); if ($this->match($current_query_string, $query_strings, TRUE)) { diff --git a/sites/all/modules/contrib/admin/context/plugins/context_reaction_block.inc b/sites/all/modules/contrib/admin/context/plugins/context_reaction_block.inc index abcafd87..90c005c6 100644 --- a/sites/all/modules/contrib/admin/context/plugins/context_reaction_block.inc +++ b/sites/all/modules/contrib/admin/context/plugins/context_reaction_block.inc @@ -400,13 +400,17 @@ class context_reaction_block extends context_reaction { unset($_context_blocks); foreach ($context_blocks as $r => $blocks) { - //only render blocks in an active region + // Only render blocks in an active region. if (array_key_exists($r, $active_regions)) { $context_blocks[$r] = _block_render_blocks($blocks); - // Make blocks editable if allowed. - if ($this->is_editable_region($r)) { - foreach ($context_blocks[$r] as $key => $block) { + $editable = $this->is_editable_region($r); + foreach ($context_blocks[$r] as $key => $block) { + // Add the region property to each block. + $context_blocks[$r][$key]->region = $r; + + // Make blocks editable if allowed. + if ($editable) { $context_blocks[$r][$key] = $this->editable_block($block); } } @@ -450,12 +454,9 @@ class context_reaction_block extends context_reaction { */ protected function max_block_weight() { $blocks = $this->get_blocks(); - $block_count = 0; - foreach ($blocks as $region => $block_list) { - $block_count += count($block_list); - } - // Add 2 to make sure there's space at either end of the block list - return round(($block_count + 2) / 2); + + // Add 2 to make sure there's space at either end of the block list. + return round((count($blocks) + 2) / 2); } /** diff --git a/sites/all/modules/contrib/admin/context/plugins/context_reaction_block.js b/sites/all/modules/contrib/admin/context/plugins/context_reaction_block.js index fb0f3f16..192b956f 100644 --- a/sites/all/modules/contrib/admin/context/plugins/context_reaction_block.js +++ b/sites/all/modules/contrib/admin/context/plugins/context_reaction_block.js @@ -68,7 +68,7 @@ DrupalContextBlockForm = function(blockForm) { // Hide enabled blocks from selector that are used $('table.context-blockform-region tr').each(function() { - var bid = $(this).attr('id'); + var bid = Drupal.checkPlain($(this).attr('id')); $('div.context-blockform-selector input[value="'+bid+'"]').parents('div.form-item').eq(0).hide(); }); // Show blocks in selector that are unused diff --git a/sites/all/modules/contrib/admin/context/plugins/context_reaction_region.inc b/sites/all/modules/contrib/admin/context/plugins/context_reaction_region.inc index c4f0fd7c..d9c0a8ed 100644 --- a/sites/all/modules/contrib/admin/context/plugins/context_reaction_region.inc +++ b/sites/all/modules/contrib/admin/context/plugins/context_reaction_region.inc @@ -17,7 +17,7 @@ class context_reaction_region extends context_reaction { '#type' => 'fieldset', '#title' => "Disable Regions in {$theme->name} Theme", '#collapsible' => TRUE, - '#collapsed' => !array_reduce($default, create_function('$a, $b', 'return $a || $b;')), + '#collapsed' => !array_reduce($default, 'context_reaction_region::collapseRegion'), ); $form[$theme->name]['disable'] = array( '#type' => 'checkboxes', @@ -29,6 +29,10 @@ class context_reaction_region extends context_reaction { } return $form; } + + function collapseRegion($a, $b) { + return $a || $b; + } function execute(&$page) { global $theme; diff --git a/sites/all/modules/contrib/admin/module_filter/CHANGELOG.txt b/sites/all/modules/contrib/admin/module_filter/CHANGELOG.txt index c5c66703..5513831c 100644 --- a/sites/all/modules/contrib/admin/module_filter/CHANGELOG.txt +++ b/sites/all/modules/contrib/admin/module_filter/CHANGELOG.txt @@ -1,27 +1,38 @@ -Module Filter 7.x-2.x, 2015-02-20 +Module Filter 7.x-2.1, 2017-06-09 +--------------------------------- +Issue #2437439 by mikhail.krainiuk, greenSkin, jayhawkfan75: Module Filter does + not care about anchors in permission links. +Issue #2866236 by Munavijayalakshmi, dhruveshdtripathi: Typo error in + README.TXT file. +Issue #2452067 by Madis: Option to show description expanded as default + not working. +Issue #2580791 by makbul_khan8: Coding standards and few function without + help comments. +Issue #2153697 by annya: Disabling option "Number of enabled modules" breaks + tabs functionality. +Issue #1710230 by willvincent: On | Off buttons does not change state with + jquery_update module active. +Added option to show description as expanded by default. +Improved description field so when it is open, interacting with it's contents + does not make it collapse. +Placed collapsed/expanded images inside of module for easier, more reliable + access. +Added option to place version in own column. +Issue #2113191 by joelpittet: Category tabs not working. + + +Module Filter 7.x-2.0, 2015-02-22 --------------------------------- Simplifying the table rows by hiding version and requirements until a particular description is clicked. - - -Module Filter 7.x-2.x, 2014-09-01 ---------------------------------- #2235553 by greenSkin: Fixed latest jquery_update breaks module filter. #2304687 by mpdonadio: Fixed Remove hardcoded operations. #2293029 by topsitemakers: Fixed Take header offset into account when selecting a tab. #2290213 by topsitemakers: Minor typo in description - "has no affect" -> "has no effect". - - -Module Filter 7.x-2.0-alpha2, 2013-12-06 ----------------------------------------- #2141743, #2141743 by greenSkin: Fixed issues related to the new dynamically positioned tabs and using the dynamically positioned save button. - - -Module Filter 7.x-2.0-alpha1, 2013-11-18 ----------------------------------------- by greenSkin: Tabs now should always be visible while scrolling large lists of modules. #1854348 by alexweber, greenSkin: Make filter textfield wider on modules page diff --git a/sites/all/modules/contrib/admin/module_filter/README.txt b/sites/all/modules/contrib/admin/module_filter/README.txt index 0bc967ab..b03d9702 100644 --- a/sites/all/modules/contrib/admin/module_filter/README.txt +++ b/sites/all/modules/contrib/admin/module_filter/README.txt @@ -17,8 +17,8 @@ visibility of modules that are disabled and depend on module(s) that are missing. The update status report filter also contains four checkboxes: Up-to-Date, -Update availabe, Security update, and Unknown. These directly affect the -visibilty of each project; whether it is up-to-date, there is an update +Update available, Security update, and Unknown. These directly affect the +visibility of each project; whether it is up-to-date, there is an update available, a security update is available, or the status is unknown. Installation diff --git a/sites/all/modules/contrib/admin/module_filter/css/module_filter.css b/sites/all/modules/contrib/admin/module_filter/css/module_filter.css index 19d113fb..b03bbb75 100644 --- a/sites/all/modules/contrib/admin/module_filter/css/module_filter.css +++ b/sites/all/modules/contrib/admin/module_filter/css/module_filter.css @@ -18,3 +18,9 @@ text-transform: uppercase; color: #888; } +#module-filter-modules { + position: relative; +} +#module-filter-modules table { + position: absolute; +} diff --git a/sites/all/modules/contrib/admin/module_filter/css/module_filter_tab.css b/sites/all/modules/contrib/admin/module_filter/css/module_filter_tab.css index 2607a617..fd7d0f0c 100644 --- a/sites/all/modules/contrib/admin/module_filter/css/module_filter_tab.css +++ b/sites/all/modules/contrib/admin/module_filter/css/module_filter_tab.css @@ -167,9 +167,6 @@ html.js #module-filter-modules table td { .admin-version { white-space: nowrap; } -.admin-operations { - float: right; -} .admin-operations a.module-link { display: inline; } diff --git a/sites/all/modules/contrib/admin/module_filter/css/modules.css b/sites/all/modules/contrib/admin/module_filter/css/modules.css index 91fa7418..06598257 100644 --- a/sites/all/modules/contrib/admin/module_filter/css/modules.css +++ b/sites/all/modules/contrib/admin/module_filter/css/modules.css @@ -7,6 +7,9 @@ #system-modules th.name { width: 25%; } +#system-modules th.version { + width: 10%; +} #system-modules th.links { width: 15%; } @@ -14,12 +17,12 @@ vertical-align: top; } #system-modules .expand.inner { - background: transparent url(/misc/menu-collapsed.png) left 0.6em no-repeat; + background: transparent url(../images/collapsed.png) left 0.6em no-repeat; margin-left: -12px; padding-left: 12px; } #system-modules .expanded.expand.inner { - background: transparent url(/misc/menu-expanded.png) left 0.6em no-repeat; + background: transparent url(../images/expanded.png) left 0.6em no-repeat; } #system-modules .description { cursor: pointer; @@ -29,6 +32,9 @@ text-overflow: ellipsis; white-space: nowrap; } +#system-modules .description .inner.expanded > * { + cursor: auto; +} #system-modules .description .requirements, #system-modules .description .links { display: none; diff --git a/sites/all/modules/contrib/admin/module_filter/images/collapsed.png b/sites/all/modules/contrib/admin/module_filter/images/collapsed.png new file mode 100644 index 0000000000000000000000000000000000000000..91f3fd40ede024798b6de5ea2675bb692a3cfa95 GIT binary patch literal 105 zcmeAS@N?(olHy`uVBq!ia0vp^>>$j@3?%=}IXVGIu?6^qxc>kDAIJlF_r}R y1v5B2yO9Ru2zt6WhH%Ixhb6Q*Xr>9K@iDN~Fr3*g^XWQJlEKr}&t;ucLK6T5e;aZD literal 0 HcmV?d00001 diff --git a/sites/all/modules/contrib/admin/module_filter/images/expanded.png b/sites/all/modules/contrib/admin/module_filter/images/expanded.png new file mode 100644 index 0000000000000000000000000000000000000000..46f39ecb351cff65243fa9a614a69d039e1302a5 GIT binary patch literal 106 zcmeAS@N?(olHy`uVBq!ia0vp^>>$j@3?%=}IXVGIu?6^qxc>kDAIJlF_r}R z1v5B2yO9Ru2zk0VhE&W+{&76uaKb@_0}N~oA{!VF-#vS9IZ&3t)78&qol`;+0EMF; ATL1t6 literal 0 HcmV?d00001 diff --git a/sites/all/modules/contrib/admin/module_filter/js/module_filter.js b/sites/all/modules/contrib/admin/module_filter/js/module_filter.js index d5f53287..4fcf6e65 100644 --- a/sites/all/modules/contrib/admin/module_filter/js/module_filter.js +++ b/sites/all/modules/contrib/admin/module_filter/js/module_filter.js @@ -265,6 +265,9 @@ $.fn.moduleFilter = function(selector, options) { if (Drupal.settings.moduleFilter.setFocus) { filterInput.focus(); } + if (Drupal.settings.moduleFilter.expandedDescription) { + $('#system-modules td.description .inner.expand').addClass('expanded'); + } filterInput.data('moduleFilter', new Drupal.ModuleFilter.Filter(this, selector, options)); }; diff --git a/sites/all/modules/contrib/admin/module_filter/js/module_filter_tab.js b/sites/all/modules/contrib/admin/module_filter/js/module_filter_tab.js index aa54b983..c62b9ef6 100644 --- a/sites/all/modules/contrib/admin/module_filter/js/module_filter_tab.js +++ b/sites/all/modules/contrib/admin/module_filter/js/module_filter_tab.js @@ -57,7 +57,7 @@ Drupal.behaviors.moduleFilterTabs = { // Build tabs from package title rows. var tabs = '
    '; for (var i in Drupal.settings.moduleFilter.packageIDs) { - var id = Drupal.settings.moduleFilter.packageIDs[i]; + var id = Drupal.checkPlain(Drupal.settings.moduleFilter.packageIDs[i]); var name = id; var tabClass = 'project-tab'; @@ -84,9 +84,9 @@ Drupal.behaviors.moduleFilterTabs = { summary += '' + Drupal.t('No modules were enabled or disabled within the last week.') + ''; } break; - default: - var $row = $('#' + id + '-package'); - name = $.trim($row.text()); + default: + var $row = $('#' + id + '-package', this); + name = Drupal.checkPlain($.trim($row.text())); $row.remove(); break; } @@ -233,8 +233,8 @@ Drupal.behaviors.moduleFilterTabs = { } if (Drupal.settings.moduleFilter.useSwitch) { - $('td.checkbox div.form-item').hide(); - $('td.checkbox').each(function(i) { + $('td.checkbox div.form-item', table).hide(); + $('td.checkbox', table).each(function(i) { var $cell = $(this); var $checkbox = $(':checkbox', $cell); var $switch = $('.toggle-enable', $cell); @@ -242,17 +242,14 @@ Drupal.behaviors.moduleFilterTabs = { if (!$(this).hasClass('disabled')) { if (Drupal.ModuleFilter.jQueryIsNewer()) { $checkbox.click(); + $switch.toggleClass('off'); } else { $checkbox.click().change(); + $switch.toggleClass('off'); } } }); - $checkbox.click(function() { - if (!$switch.hasClass('disabled')) { - $switch.toggleClass('off'); - } - }); }); } @@ -520,7 +517,7 @@ Drupal.ModuleFilter.updateVisualAid = function(type, $row) { } var tab = Drupal.ModuleFilter.tabs[id]; - var name = $('td:nth(1) strong', $row).text(); + var name = Drupal.checkPlain($('td:nth(1) strong', $row).text()); switch (type) { case 'enable': if (Drupal.ModuleFilter.disabling[id + name] != undefined) { diff --git a/sites/all/modules/contrib/admin/module_filter/js/modules.js b/sites/all/modules/contrib/admin/module_filter/js/modules.js index 7df5f87f..b0b49391 100644 --- a/sites/all/modules/contrib/admin/module_filter/js/modules.js +++ b/sites/all/modules/contrib/admin/module_filter/js/modules.js @@ -3,8 +3,13 @@ Drupal.behaviors.moduleFilter = { attach: function(context) { $('#system-modules td.description').once('description', function() { - $('.inner.expand', $(this)).click(function() { - $(this).toggleClass('expanded'); + $(this).click(function() { + $('.inner.expand', $(this)).toggleClass('expanded'); + }); + $('.inner.expand', $(this)).children().click(function(e) { + if ($(this).parent().hasClass('expanded')) { + e.stopPropagation(); + } }); }); diff --git a/sites/all/modules/contrib/admin/module_filter/module_filter.admin.inc b/sites/all/modules/contrib/admin/module_filter/module_filter.admin.inc index 2345d8de..cdb3f49f 100644 --- a/sites/all/modules/contrib/admin/module_filter/module_filter.admin.inc +++ b/sites/all/modules/contrib/admin/module_filter/module_filter.admin.inc @@ -25,44 +25,44 @@ function module_filter_settings() { '#type' => 'checkbox', '#title' => t('Enhance the modules page with tabs'), '#description' => t('Alternate tabbed theme that restructures packages into tabs.'), - '#default_value' => variable_get('module_filter_tabs', 1) + '#default_value' => variable_get('module_filter_tabs', 1), ); $form['tabs'] = array( '#type' => 'fieldset', '#title' => t('Tabs'), '#description' => t('Settings used with the tabs view of the modules page.'), '#collapsible' => TRUE, - '#collapsed' => FALSE + '#collapsed' => FALSE, ); $form['tabs']['module_filter_count_enabled'] = array( '#type' => 'checkbox', '#title' => t('Number of enabled modules'), '#description' => t('Display the number of enabled modules in the active tab along with the total number of modules.'), - '#default_value' => variable_get('module_filter_count_enabled', 1) + '#default_value' => variable_get('module_filter_count_enabled', 1), ); $form['tabs']['module_filter_visual_aid'] = array( '#type' => 'checkbox', '#title' => t('Visual aids'), '#description' => t('When enabling/disabling modules, the module name will display in the tab summary.
    When filtering, a count of results for each tab will be presented.'), - '#default_value' => variable_get('module_filter_visual_aid', 1) + '#default_value' => variable_get('module_filter_visual_aid', 1), ); $form['tabs']['module_filter_hide_empty_tabs'] = array( '#type' => 'checkbox', '#title' => t('Hide tabs with no results'), '#description' => t('When a filter returns no results for a tab, the tab is hidden. This is dependent on visual aids being enabled.'), - '#default_value' => variable_get('module_filter_hide_empty_tabs', 0) + '#default_value' => variable_get('module_filter_hide_empty_tabs', 0), ); $form['tabs']['module_filter_dynamic_save_position'] = array( '#type' => 'checkbox', '#title' => t('Dynamically position Save button'), '#description' => t("For sites with lots of tabs, enable to help keep the 'Save configuration' button more accessible."), - '#default_value' => variable_get('module_filter_dynamic_save_position', 1) + '#default_value' => variable_get('module_filter_dynamic_save_position', 1), ); $form['tabs']['module_filter_use_url_fragment'] = array( '#type' => 'checkbox', '#title' => t('Use URL fragment'), '#description' => t('Use URL fragment when navigating between tabs. This lets you use the browsers back/forward buttons to navigate through the tabs you selected.') . '
    ' . t('When the Overlay module is enabled this functionality will not be used since overlay relies on the URL fragment.'), - '#default_value' => variable_get('module_filter_use_url_fragment', 1) + '#default_value' => variable_get('module_filter_use_url_fragment', 1), ); $form['tabs']['module_filter_use_switch'] = array( '#type' => 'checkbox', @@ -82,6 +82,18 @@ function module_filter_settings() { '#description' => t('When enabled, the active tab will be remembered.'), '#default_value' => variable_get('module_filter_remember_active_tab', 1), ); + $form['tabs']['module_filter_version_column'] = array( + '#type' => 'checkbox', + '#title' => t('Place version in own column'), + '#description' => t("Moves the version out of the description and into it's own column"), + '#default_value' => variable_get('module_filter_version_column', 0), + ); + $form['tabs']['module_filter_expanded_description'] = array( + '#type' => 'checkbox', + '#title' => t('Expand description by default'), + '#description' => t('When enabled, the description will be expanded by default.'), + '#default_value' => variable_get('module_filter_expanded_description', 0), + ); $form['update'] = array( '#type' => 'fieldset', diff --git a/sites/all/modules/contrib/admin/module_filter/module_filter.info b/sites/all/modules/contrib/admin/module_filter/module_filter.info index a48b58f3..e21267d6 100644 --- a/sites/all/modules/contrib/admin/module_filter/module_filter.info +++ b/sites/all/modules/contrib/admin/module_filter/module_filter.info @@ -4,7 +4,6 @@ core = 7.x package = Administration files[] = module_filter.install -files[] = module_filter.js files[] = module_filter.module files[] = module_filter.admin.inc files[] = module_filter.theme.inc @@ -17,9 +16,8 @@ files[] = js/module_filter_tab.js configure = admin/config/user-interface/modulefilter -; Information added by Drupal.org packaging script on 2015-02-22 -version = "7.x-2.0" +; Information added by Drupal.org packaging script on 2019-03-27 +version = "7.x-2.2" core = "7.x" project = "module_filter" -datestamp = "1424631189" - +datestamp = "1553698385" diff --git a/sites/all/modules/contrib/admin/module_filter/module_filter.install b/sites/all/modules/contrib/admin/module_filter/module_filter.install index c39b3d12..529d8360 100644 --- a/sites/all/modules/contrib/admin/module_filter/module_filter.install +++ b/sites/all/modules/contrib/admin/module_filter/module_filter.install @@ -19,6 +19,8 @@ function module_filter_uninstall() { variable_del('module_filter_track_recent_modules'); variable_del('module_filter_remember_active_tab'); variable_del('module_filter_remember_update_state'); + variable_del('module_filter_version_column'); + variable_del('module_filter_expanded_description'); } /** diff --git a/sites/all/modules/contrib/admin/module_filter/module_filter.module b/sites/all/modules/contrib/admin/module_filter/module_filter.module index 42b39135..17059ece 100644 --- a/sites/all/modules/contrib/admin/module_filter/module_filter.module +++ b/sites/all/modules/contrib/admin/module_filter/module_filter.module @@ -18,8 +18,8 @@ function module_filter_permission() { return array( 'administer module filter' => array( 'title' => t('Administer Module Filter'), - 'description' => t('Configure how Module Filter performs.') - ) + 'description' => t('Configure how Module Filter performs.'), + ), ); } @@ -33,7 +33,7 @@ function module_filter_menu() { 'access arguments' => array('administer module filter'), 'page callback' => 'drupal_get_form', 'page arguments' => array('module_filter_settings'), - 'file' => 'module_filter.admin.inc' + 'file' => 'module_filter.admin.inc', ); return $items; } @@ -63,32 +63,32 @@ function module_filter_form_system_modules_alter(&$form, &$form_state, $form_id) '#type' => 'module_filter', '#attached' => array( 'js' => array( - drupal_get_path('module', 'module_filter') . '/js/modules.js' - ) - ) + drupal_get_path('module', 'module_filter') . '/js/modules.js' => array('weight' => 1), + ), + ), ); $checkbox_defaults = array( ((isset($_GET['enabled'])) ? $_GET['enabled'] : 1) ? 'enabled' : '', ((isset($_GET['disabled'])) ? $_GET['disabled'] : 1) ? 'disabled' : '', ((isset($_GET['required'])) ? $_GET['required'] : 1) ? 'required' : '', - ((isset($_GET['unavailable'])) ? $_GET['unavailable'] : 1) ? 'unavailable' : '' + ((isset($_GET['unavailable'])) ? $_GET['unavailable'] : 1) ? 'unavailable' : '', ); $form['module_filter']['show'] = array( '#type' => 'checkboxes', '#default_value' => array_filter($checkbox_defaults), '#options' => array('enabled' => t('Enabled'), 'disabled' => t('Disabled'), 'required' => t('Required'), 'unavailable' => t('Unavailable')), '#prefix' => '
    ', - '#suffix' => '
    ' + '#suffix' => '', ); if (variable_get('module_filter_tabs', 1)) { - $form['module_filter']['#attached']['css'][] = drupal_get_path('module', 'module_filter') .'/css/module_filter_tab.css'; + $form['module_filter']['#attached']['css'][] = drupal_get_path('module', 'module_filter') . '/css/module_filter_tab.css'; $form['module_filter']['#attached']['library'][] = array('system', 'jquery.bbq'); - $form['module_filter']['#attached']['js'][] = drupal_get_path('module', 'module_filter') .'/js/module_filter_tab.js'; + $form['module_filter']['#attached']['js'][drupal_get_path('module', 'module_filter') . '/js/module_filter_tab.js'] = array('weight' => 2); if (!module_exists('page_actions') && variable_get('module_filter_dynamic_save_position', 1)) { - $form['module_filter']['#attached']['css'][] = drupal_get_path('module', 'module_filter') .'/css/dynamic_position.css'; - $form['module_filter']['#attached']['js'][] = drupal_get_path('module', 'module_filter') .'/js/dynamic_position.js'; + $form['module_filter']['#attached']['css'][] = drupal_get_path('module', 'module_filter') . '/css/dynamic_position.css'; + $form['module_filter']['#attached']['js'][drupal_get_path('module', 'module_filter') . '/js/dynamic_position.js'] = array('weight' => 3); } $form['#attached']['css'][] = drupal_get_path('module', 'module_filter') . '/css/modules.css'; @@ -128,7 +128,7 @@ function module_filter_element_info() { '#process' => array('form_process_module_filter', 'ajax_process_form'), '#weight' => -1, '#tree' => TRUE, - '#theme' => 'module_filter' + '#theme' => 'module_filter', ); return $types; } @@ -153,6 +153,18 @@ function module_filter_theme() { ); } +/** + * Create and add new textfield element. + * + * @param $element + * An associative array containing the properties and children of the + * form actions container. + * @param $form_state + * The $form_state array for the form this element belongs to. + * + * @return + * The processed element. + */ function form_process_module_filter($element, &$form_state) { $element['name'] = array( '#type' => 'textfield', @@ -163,7 +175,7 @@ function form_process_module_filter($element, &$form_state) { '#attributes' => ((isset($element['#attributes'])) ? $element['#attributes'] : array()) + array('autocomplete' => 'off'), '#attached' => array( 'css' => array( - drupal_get_path('module', 'module_filter') . '/css/module_filter.css' + drupal_get_path('module', 'module_filter') . '/css/module_filter.css', ), 'js' => array( 'misc/jquery.cookie.js', @@ -182,12 +194,13 @@ function form_process_module_filter($element, &$form_state) { 'trackRecent' => variable_get('module_filter_track_recent_modules', 1), 'rememberActiveTab' => variable_get('module_filter_remember_active_tab', 1), 'rememberUpdateState' => variable_get('module_filter_remember_update_state', 0), - ) + 'expandedDescription' => variable_get('module_filter_expanded_description', 0), + ), ), - 'type' => 'setting' - ) - ) - ) + 'type' => 'setting', + ), + ), + ), ); if (isset($element['#description'])) { $element['name']['#description'] = $element['#description']; @@ -195,15 +208,18 @@ function form_process_module_filter($element, &$form_state) { return $element; } +/** + * Form submission handler to filters module list. + */ function module_filter_system_modules_submit_redirect($form, &$form_state) { $query = array(); if (!empty($form_state['values']['module_filter']['name'])) { $query['filter'] = $form_state['values']['module_filter']['name']; } - $query['enabled'] = (int)(!empty($form_state['values']['module_filter']['show']['enabled'])); - $query['disabled'] = (int)(!empty($form_state['values']['module_filter']['show']['disabled'])); - $query['required'] = (int)(!empty($form_state['values']['module_filter']['show']['required'])); - $query['unavailable'] = (int)(!empty($form_state['values']['module_filter']['show']['unavailable'])); + $query['enabled'] = (int) (!empty($form_state['values']['module_filter']['show']['enabled'])); + $query['disabled'] = (int) (!empty($form_state['values']['module_filter']['show']['disabled'])); + $query['required'] = (int) (!empty($form_state['values']['module_filter']['show']['required'])); + $query['unavailable'] = (int) (!empty($form_state['values']['module_filter']['show']['unavailable'])); $form_state['redirect'] = array( 'admin/modules', @@ -211,6 +227,9 @@ function module_filter_system_modules_submit_redirect($form, &$form_state) { ); } +/** + * Form submission handler to track recently enabled/disabled modules + */ function module_filter_system_modules_submit_recent($form, &$form_state) { $recent_modules = variable_get('module_filter_recent_modules', array()); @@ -225,6 +244,11 @@ function module_filter_system_modules_submit_recent($form, &$form_state) { variable_set('module_filter_recent_modules', $recent_modules); } +/** + * Create list of newly added modules (within a week) + * @return + * An array of newly added modules. + */ function module_filter_new_modules() { // Get current list of modules. $files = system_rebuild_module_data(); @@ -249,12 +273,24 @@ function module_filter_new_modules() { return $new_modules; } +/** + * Function to replace special characters with hyphen. + * @param string $text + * @return + * String + */ function module_filter_get_id($text) { $id = strtolower($text); $id = preg_replace('/([^a-z0-9]+)/', '-', $id); return trim($id, '-'); } +/** + * Function to return true/false depending on module changed time and a week timestamp + * @param integer $var + * @return + * Boolean indicating + */ function module_filter_recent_filter($var) { - return (!($var < REQUEST_TIME - 60*60*24*7)); + return (!($var < REQUEST_TIME - 60 * 60 * 24 * 7)); } diff --git a/sites/all/modules/contrib/admin/module_filter/module_filter.pages.inc b/sites/all/modules/contrib/admin/module_filter/module_filter.pages.inc index a4c23495..a18fbc5f 100644 --- a/sites/all/modules/contrib/admin/module_filter/module_filter.pages.inc +++ b/sites/all/modules/contrib/admin/module_filter/module_filter.pages.inc @@ -1,5 +1,9 @@ drupal_get_form('module_filter_update_status_form'), 'update_report' => array( - '#markup' => $update_report - ) + '#markup' => $update_report, + ), ); } +/** + * Form builder for the module filter form. + */ function module_filter_update_status_form($form, &$form_state) { $form['module_filter'] = array( '#type' => 'module_filter', '#attached' => array( 'css' => array( - drupal_get_path('module', 'module_filter') . '/css/update_status.css' + drupal_get_path('module', 'module_filter') . '/css/update_status.css', ), 'js' => array( - drupal_get_path('module', 'module_filter') . '/js/update_status.js' + drupal_get_path('module', 'module_filter') . '/js/update_status.js', ), ), ); @@ -34,7 +41,7 @@ function module_filter_update_status_form($form, &$form_state) { '#default_value' => (isset($_GET['show']) && in_array($_GET['show'], array('all', 'updates', 'security', 'unknown'))) ? $_GET['show'] : 'all', '#options' => array('all' => t('All'), 'updates' => t('Update available'), 'security' => t('Security update'), 'unknown' => t('Unknown')), '#prefix' => '
    ', - '#suffix' => '
    ' + '#suffix' => '', ); if (module_exists('update_advanced')) { $options = $form['module_filter']['show']['#options']; diff --git a/sites/all/modules/contrib/admin/module_filter/module_filter.theme.inc b/sites/all/modules/contrib/admin/module_filter/module_filter.theme.inc index b199bedf..2d00ab78 100644 --- a/sites/all/modules/contrib/admin/module_filter/module_filter.theme.inc +++ b/sites/all/modules/contrib/admin/module_filter/module_filter.theme.inc @@ -37,6 +37,9 @@ function theme_module_filter_system_modules_tabs($variables) { array('data' => t('Description'), 'class' => array('description')), array('data' => t('Links'), 'class' => array('links')), ); + if (variable_get('module_filter_version_column', 0)) { + array_splice($header, 2, 0, array(array('data' => t('Version'), 'class' => array('version')))); + } $package_ids = array('all'); $enabled['all'] = array(); @@ -101,11 +104,18 @@ function theme_module_filter_system_modules_tabs($variables) { } $row[] = array('class' => array('name'), 'data' => $label . '>' . drupal_render($module['name']) . ' (' . $key . ')'); + if (variable_get('module_filter_version_column', 0) && $version) { + $row[] = array('class' => array('version'), 'data' => drupal_render($module['version'])); + } + // Add the description, along with any modules it requires. + if (empty($module['description']['#markup'])) { + $module['description']['#markup'] = '' . t('No description available.') . ''; + } $description = '' . drupal_render($module['description']) . ''; - if ($version || $requires || $required_by) { + if ($requires || $required_by || (!variable_get('module_filter_version_column', 0) && $version)) { $description .= '
    '; - if ($version) { + if (!variable_get('module_filter_version_column', 0) && $version) { $description .= '
    ' . t('Version: !module-version', array('!module-version' => drupal_render($module['version']))) . '
    '; } if ($requires) { @@ -136,21 +146,20 @@ function theme_module_filter_system_modules_tabs($variables) { $form['modules'][$package]['#printed'] = TRUE; } - if (variable_get('module_filter_count_enabled', 1)) { - $enabled_counts = array(); - foreach ($enabled as $package_id => $value) { - $enabled_counts[$package_id] = array( - 'enabled' => count(array_filter($value)), - 'total' => count($value), - ); - } - drupal_add_js(array( - 'moduleFilter' => array( - 'packageIDs' => $package_ids, - 'enabledCounts' => $enabled_counts, - ) - ), 'setting'); + //Get packages and count number of modules + $enabled_counts = array(); + foreach ($enabled as $package_id => $value) { + $enabled_counts[$package_id] = array( + 'enabled' => count(array_filter($value)), + 'total' => count($value), + ); } + drupal_add_js(array( + 'moduleFilter' => array( + 'packageIDs' => $package_ids, + 'enabledCounts' => $enabled_counts, + ) + ), 'setting'); // Add first and last class to rows. $rows[0]['class'][] = 'first'; @@ -165,6 +174,12 @@ function theme_module_filter_system_modules_tabs($variables) { return $output; } +/** + * Theme function for module filter operations. + * @param $variables + * @return + * HTML for admin status operations. + */ function theme_module_filter_operations(&$vars) { $links = &$vars['links']; $dropbutton = $vars['dropbutton']; @@ -174,16 +189,19 @@ function theme_module_filter_operations(&$vars) { if ($dropbutton) { hide($links[$key]); if (!empty($links[$key]['#href'])) { - $operations[] = array( + $operations[$key] = array( 'title' => $links[$key]['#title'], 'href' => $links[$key]['#href'], ); + if (isset($links[$key]['#options'])) { + $operations[$key] += $links[$key]['#options']; + } } } else { $data = drupal_render($links[$key]); if (!empty($data)) { - $operations[] = array('data' => $data); + $operations[$key] = array('data' => $data); } } } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_2checkout/uc_2checkout.info b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_2checkout/uc_2checkout.info index ac858f2b..b5f5d6d2 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_2checkout/uc_2checkout.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_2checkout/uc_2checkout.info @@ -4,9 +4,8 @@ dependencies[] = uc_payment package = Ubercart - payment core = 7.x -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_2checkout/uc_2checkout.module b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_2checkout/uc_2checkout.module index a5f63160..0177b3d0 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_2checkout/uc_2checkout.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_2checkout/uc_2checkout.module @@ -5,7 +5,6 @@ * Integrates 2Checkout.com's redirected payment service. */ - /** * Implements hook_help(). */ @@ -153,7 +152,7 @@ function uc_payment_method_2checkout($op, &$order, $form = NULL, &$form_state = '#title' => t('Currency for the sale'), '#options' => array( '' => t('Auto detected by 2CO'), - 'USD', 'EUR', 'ARS', 'AUD', 'BRL', 'GBP', 'CAD', 'DKK', 'HKD', 'INR', 'ILS', 'JPY', 'LTL', 'MYR', 'MXN', 'NZD', 'NOK', 'PHP', 'RON', 'RUB', 'SGD', 'ZAR', 'SEK', 'CHF', 'TRY', 'AED' + 'USD', 'EUR', 'ARS', 'AUD', 'BRL', 'GBP', 'CAD', 'DKK', 'HKD', 'INR', 'ILS', 'JPY', 'LTL', 'MYR', 'MXN', 'NZD', 'NOK', 'PHP', 'RON', 'RUB', 'SGD', 'ZAR', 'SEK', 'CHF', 'TRY', 'AED', ), '#default_value' => variable_get('uc_2checkout_currency_code', ''), ); @@ -227,8 +226,8 @@ function uc_2checkout_form($form, &$form_state, $order) { $i = 0; foreach ($order->products as $product) { $i++; - $data['li_' . $i . '_name'] = $product->title; - $data['li_' . $i . '_price'] = uc_currency_format($product->price, FALSE, FALSE, '.'); + $data['li_' . $i . '_name'] = $product->title; + $data['li_' . $i . '_price'] = uc_currency_format($product->price, FALSE, FALSE, '.'); } if (variable_get('uc_2checkout_checkout_type', 'dynamic') == 'direct') { diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_2checkout/uc_2checkout.pages.inc b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_2checkout/uc_2checkout.pages.inc index c4eeb242..fbbd7af1 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_2checkout/uc_2checkout.pages.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_2checkout/uc_2checkout.pages.inc @@ -113,7 +113,6 @@ function uc_2checkout_process_notification() { uc_order_update_status($order_id, uc_order_state_default('canceled')); uc_order_comment_save($order_id, 0, t('Order have not passed 2Checkout fraud review.')); die('fraud'); - break; } } elseif ($values['message_type'] == 'REFUND_ISSUED') { diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_authorizenet/uc_authorizenet.info b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_authorizenet/uc_authorizenet.info index 896b599d..1d6dbb69 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_authorizenet/uc_authorizenet.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_authorizenet/uc_authorizenet.info @@ -5,9 +5,8 @@ dependencies[] = uc_credit package = Ubercart - payment core = 7.x -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_authorizenet/uc_authorizenet.module b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_authorizenet/uc_authorizenet.module index b36d7500..45eafdd1 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_authorizenet/uc_authorizenet.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_authorizenet/uc_authorizenet.module @@ -3,8 +3,6 @@ /** * @file * Processes payments using Authorize.net. Supports AIM and ARB. - * - * Development sponsored by Digital Dollhouse - http://www.digitaldollhouse.com */ define('UC_AUTHORIZENET_TEST_GATEWAY_URL', 'https://test.authorize.net/gateway/transact.dll'); @@ -110,11 +108,10 @@ function uc_authorizenet_settings_form($form, &$form_state) { '#default_value' => variable_get('uc_authnet_response_debug', FALSE), ); - $form['arb_settings'] = array( '#type' => 'fieldset', '#title' => t('ARB settings'), - '#description' => t('These settings pertain to the Authorize.Net Automated Recurring Billing service.') + '#description' => t('These settings pertain to the Authorize.Net Automated Recurring Billing service.'), ); $form['arb_settings']['uc_authnet_arb_mode'] = array( '#type' => 'radios', @@ -144,7 +141,7 @@ function uc_authorizenet_settings_form($form, &$form_state) { $form['cim_settings'] = array( '#type' => 'fieldset', '#title' => t('CIM settings'), - '#description' => t('These settings pertain to the Authorize.Net Customer Information Management service.') + '#description' => t('These settings pertain to the Authorize.Net Customer Information Management service.'), ); $form['cim_settings']['uc_authnet_cim_profile'] = array( '#type' => 'checkbox', @@ -163,7 +160,6 @@ function uc_authorizenet_settings_form($form, &$form_state) { '#default_value' => variable_get('uc_authnet_cim_mode', 'disabled'), ); - return $form; } @@ -602,14 +598,14 @@ function _uc_authorizenet_charge($order, $amount, $data) { /** * Sends an XML API Request to Authorize.Net. * - * @param $server + * @param string $server * The name of the server to send a request to - 'production' or 'developer'. - * @param $xml + * @param string $xml * The XML to send to Authorize.Net. * @param $callback * The name of the function that should process the response. * - * @return + * @return bool * TRUE or FALSE indicating the success of the API request. */ function uc_authorizenet_xml_api($server, $xml) { @@ -626,7 +622,7 @@ function uc_authorizenet_xml_api($server, $xml) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $post_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); + curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml")); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); curl_setopt($ch, CURLOPT_POST, 1); @@ -649,12 +645,12 @@ function uc_authorizenet_xml_api($server, $xml) { * * @param $subscription_id * The ID of the subscription at Authorize.Net. - * @param $updates + * @param array $updates * An array of data to update using key/value pairs from the XML API for ARB; * keys should be children of the subscription element in the XML. * See the ARB_guide.pdf from Authorize.Net for ARBCreateSubscriptionRequests. * - * @return + * @return bool * TRUE or FALSE indicating the success of the cancellation. */ function uc_authorizenet_arb_update($subscription_id, $updates, $order_id = NULL) { @@ -666,7 +662,7 @@ function uc_authorizenet_arb_update($subscription_id, $updates, $order_id = NULL $data = array( 'refId' => substr($order_id . '-' . REQUEST_TIME, 0, 20), 'subscriptionId' => $subscription_id, - 'subscription' => $updates + 'subscription' => $updates, ); // Build the XML string. @@ -696,6 +692,8 @@ function uc_authorizenet_arb_update($subscription_id, $updates, $order_id = NULL } /** + * Helper function for XML API requests. + * * Wraps XML API request child elements in the request element and includes * the merchant authentication information. */ @@ -738,39 +736,51 @@ function _uc_authorizenet_avs($code) { case 'A': $text .= t('Address (Street) matches, ZIP does not'); break; + case 'B': $text .= t('Address information not provided for AVS check'); break; + case 'E': $text .= t('AVS error'); break; + case 'G': $text .= t('Non-U.S. Card Issuing Bank'); break; + case 'N': $text .= t('No Match on Address (Street) or ZIP'); break; + case 'P': $text .= t('AVS not applicable for this transaction'); break; + case 'R': $text .= t('Retry – System unavailable or timed out'); break; + case 'S': $text .= t('Service not supported by issuer'); break; + case 'U': $text .= t('Address information is unavailable'); break; + case 'W': $text .= t('Nine digit ZIP matches, Address (Street) does not'); break; + case 'X': $text .= t('Address (Street) and nine digit ZIP match'); break; + case 'Y': $text .= t('Address (Street) and five digit ZIP match'); break; + case 'Z': $text .= t('Five digit ZIP matches, Address (Street) does not'); break; @@ -789,15 +799,19 @@ function _uc_authorizenet_cvv($code) { case 'M': $text .= t('Match'); break; + case 'N': $text .= t('No Match'); break; + case 'P': $text .= t('Not Processed'); break; + case 'S': $text .= t('Should have been present'); break; + case 'U': $text .= t('Issuer unable to process request'); break; @@ -813,14 +827,19 @@ function _uc_authorizenet_txn_type($type) { switch (strtoupper($type)) { case 'AUTH_CAPTURE': return t('Authorization and capture'); + case 'AUTH_ONLY': return t('Authorization only'); + case 'PRIOR_AUTH_CAPTURE': return t('Prior authorization capture'); + case 'CAPTURE_ONLY': return t('Capture only'); + case 'CREDIT': return t('Credit'); + case 'VOID': return t('Void'); } @@ -833,12 +852,16 @@ function _uc_authorizenet_txn_map($type) { switch ($type) { case UC_CREDIT_AUTH_ONLY: return 'AUTH_ONLY'; + case UC_CREDIT_PRIOR_AUTH_CAPTURE: return 'PRIOR_AUTH_CAPTURE'; + case UC_CREDIT_AUTH_CAPTURE: return 'AUTH_CAPTURE'; + case UC_CREDIT_CREDIT: return 'CREDIT'; + case UC_CREDIT_VOID: return 'VOID'; } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_authorizenet/uc_authorizenet.pages.inc b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_authorizenet/uc_authorizenet.pages.inc index 6c272ac0..9a7fe556 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_authorizenet/uc_authorizenet.pages.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_authorizenet/uc_authorizenet.pages.inc @@ -5,12 +5,11 @@ * Page callback for Authorize.Net's Silent POST feature. */ - /** * Receives a payment notification and handles it appropriately. */ function uc_authorizenet_silent_post() { - // Determine if this is an ARB notification or not + // Determine if this is an ARB notification or not. $arb = (isset($_POST['x_subscription_id']) and isset($_POST['x_subscription_paynum'])); // Log ARB payment notification, if enabled. diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/tests/test_gateway.info b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/tests/test_gateway.info index 7b1b29c7..80441b84 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/tests/test_gateway.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/tests/test_gateway.info @@ -5,9 +5,8 @@ dependencies[] = uc_credit package = Ubercart - payment core = 7.x -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/tests/test_gateway.module b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/tests/test_gateway.module index 0650ae73..e33a6e80 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/tests/test_gateway.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/tests/test_gateway.module @@ -52,7 +52,7 @@ function test_gateway_charge($order_id, $amount, $data) { // cc_exp_month and cc_exp_year are also validated by // _uc_credit_valid_card_expiration() on the checkout form. $month = $order->payment_details['cc_exp_month']; - $year = $order->payment_details['cc_exp_year']; + $year = $order->payment_details['cc_exp_year']; if ($year < 100) { $year = $year + 2000; } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/tests/uc_credit.test b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/tests/uc_credit.test index bd9a14a8..1fb2486a 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/tests/uc_credit.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/tests/uc_credit.test @@ -47,7 +47,6 @@ class UbercartCreditCardTestCase extends UbercartTestHelper { '4012888818888', ); - /** * Describes this test case. */ @@ -141,7 +140,7 @@ class UbercartCreditCardTestCase extends UbercartTestHelper { /** * Implements DrupalWebTestCase::tearDown(). */ - public function tearDown() { + protected function tearDown() { // Cleanup keys directory after test. drupal_unlink('sites/default/files/simpletest.keys/' . UC_CREDIT_KEYFILE_NAME); drupal_rmdir('sites/default/files/simpletest.keys'); @@ -318,4 +317,5 @@ class UbercartCreditCardTestCase extends UbercartTestHelper { } } } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/uc_credit.info b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/uc_credit.info index 479ccd64..97bab4c9 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/uc_credit.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/uc_credit.info @@ -8,9 +8,8 @@ core = 7.x ; Test cases files[] = tests/uc_credit.test -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/uc_credit.install b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/uc_credit.install index ab3edf82..5ca61795 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/uc_credit.install +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/uc_credit.install @@ -69,7 +69,6 @@ function uc_credit_update_7000(&$sandbox) { $sandbox['message'] = $t('Scrubbed credit card data from order @order_id', array('@order_id' => $order->order_id)); } - if ($sandbox['progress'] < $sandbox['max']) { $sandbox['#finished'] = min(0.99, $sandbox['progress'] / $sandbox['max']); } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/uc_credit.module b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/uc_credit.module index f5293070..ef910a7d 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/uc_credit.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_credit/uc_credit.module @@ -5,39 +5,56 @@ * Defines the credit card payment method and hooks in payment gateways. */ - -/** Just authorize an amount on a credit card account. */ +/** + * Just authorize an amount on a credit card account. + */ define('UC_CREDIT_AUTH_ONLY', 'authorize'); -/** Capture funds from a prior authorization. */ +/** + * Capture funds from a prior authorization. + */ define('UC_CREDIT_PRIOR_AUTH_CAPTURE', 'prior_auth_capture'); -/** Authorize and capture money all at once. */ +/** + * Authorize and capture money all at once. + */ define('UC_CREDIT_AUTH_CAPTURE', 'auth_capture'); -/** Set up a credit card reference through the payment gateway. */ +/** + * Set up a credit card reference through the payment gateway. + */ define('UC_CREDIT_REFERENCE_SET', 'reference_set'); -/** Capture funds using a credit card reference. */ +/** + * Capture funds using a credit card reference. + */ define('UC_CREDIT_REFERENCE_TXN', 'reference_txn'); -/** Remove a reference from the payment gateway. */ +/** + * Remove a reference from the payment gateway. + */ define('UC_CREDIT_REFERENCE_REMOVE', 'reference_remove'); -/** Credit funds to a reference at the payment gateway. */ +/** + * Credit funds to a reference at the payment gateway. + */ define('UC_CREDIT_REFERENCE_CREDIT', 'reference_credit'); -/** Credit funds to a credit card account. */ +/** + * Credit funds to a credit card account. + */ define('UC_CREDIT_CREDIT', 'credit'); -/** Void a transaction before the transaction clears. */ +/** + * Void a transaction before the transaction clears. + */ define('UC_CREDIT_VOID', 'void'); - -/** Name of encryption key file. */ +/** + * Name of encryption key file. + */ define('UC_CREDIT_KEYFILE_NAME', 'uc_credit.key'); - /** * Implements hook_help(). */ @@ -547,7 +564,9 @@ function uc_payment_method_credit_form($form, &$form_state, $order) { } $form['cc_policy'] = array( - '#markup' => '

    ' . variable_get('uc_credit_policy', t('Your billing information must match the billing address for the credit card entered below or we will be unable to process your payment.')) . '

    ' + '#prefix' => '

    ', + '#markup' => variable_get('uc_credit_policy', t('Your billing information must match the billing address for the credit card entered below or we will be unable to process your payment.')), + '#suffix' => '

    ', ); $types = variable_get('uc_credit_accepted_types', implode("\r\n", array(t('Visa'), t('Mastercard'), t('Discover'), t('American Express')))); @@ -714,12 +733,12 @@ function uc_credit_display_number($number) { /** * Caches CC details on a pageload for use in various functions. * - * @param $op + * @param string $op * The cache operation to perform; either 'save', 'load', or 'clear'. - * @param $data + * @param string $data * The encrypted, serialized string containing the CC data. * - * @return + * @return array * An array of credit card details. */ function uc_credit_cache($op, $data = NULL, $encrypted = TRUE) { @@ -809,7 +828,13 @@ function _uc_credit_valid_cvv($cvv) { /** * Validates a credit card number during checkout. * - * Luhn algorithm. See: http://www.merriampark.com/anatomycc.htm + * @param string $number + * Credit card number as a string. + * + * @return bool + * TRUE if card number is valid according to the Luhn algorithm. + * + * @see https://en.wikipedia.org/wiki/Luhn_algorithm */ function _uc_credit_valid_card_number($number) { $id = substr($number, 0, 1); @@ -843,12 +868,12 @@ function _uc_credit_valid_card_number($number) { /** * Validates a start date on a card. * - * @param $month + * @param int $month * The 1 or 2-digit numeric representation of the month, i.e. 1, 6, 12. - * @param $year + * @param int $year * The 4-digit numeric representation of the year, i.e. 2008. * - * @return + * @return bool * TRUE for cards whose start date is blank (both month and year) or in the * past, FALSE otherwise. */ @@ -876,12 +901,12 @@ function _uc_credit_valid_card_start($month, $year) { /** * Validates an expiration date on a card. * - * @param $month + * @param int $month * The 1 or 2-digit numeric representation of the month, i.e. 1, 6, 12. - * @param $year + * @param int $year * The 4-digit numeric representation of the year, i.e. 2008. * - * @return + * @return bool * TRUE for non-expired cards, FALSE for expired. */ function _uc_credit_valid_card_expiration($month, $year) { @@ -899,6 +924,12 @@ function _uc_credit_valid_card_expiration($month, $year) { /** * Validates an issue number on a card; returns TRUE or FALSE. + * + * @param string $issue + * The issue number. + * + * @return bool + * TRUE if the issue number if valid, FALSE otherwise. */ function _uc_credit_valid_card_issue($issue) { if (empty($issue) || (is_numeric($issue) && $issue > 0)) { @@ -914,8 +945,8 @@ function _uc_credit_valid_card_issue($issue) { * Path to key file is stored in system variable 'uc_credit_encryption_path'. * Key file name is stored in constant UC_CREDIT_KEYFILE_NAME. * - * @return - * FALSE if no encryption key is found. + * @return string|false + * Key, or FALSE if no encryption key is found. */ function uc_credit_encryption_key() { static $key = FALSE; @@ -957,6 +988,9 @@ function _uc_credit_save_cc_data_to_order($cc_data, $order_id) { /** * Returns an array of default credit card transaction types. + * + * @return array + * Associative array of transaction types, keyed by defined constant value. */ function uc_credit_transaction_types() { $types = array( @@ -972,7 +1006,7 @@ function uc_credit_transaction_types() { /** * Retrieves the ID of the default credit card gateway. * - * @return + * @return string|false * A string containing the ID of the default gateway or FALSE if none exists * or none have valid credit callbacks. */ @@ -996,14 +1030,14 @@ function uc_credit_default_gateway() { /** * Stores a credit card authorization to an order's data array. * - * @param $order_id + * @param int $order_id * The order associated with the credit card authorization. - * @param $auth_id + * @param string $auth_id * The payment service's ID for the authorization. - * @param $amount + * @param float $amount * The amount that was authorized on the card. * - * @return + * @return array * The entire updated data array for the order. */ function uc_credit_log_authorization($order_id, $auth_id, $amount) { @@ -1029,12 +1063,12 @@ function uc_credit_log_authorization($order_id, $auth_id, $amount) { /** * Logs the capture of a prior authorization to an order's data array. * - * @param $order_id + * @param int $order_id * The order associated with the credit card capture. - * @param $auth_id + * @param string $auth_id * The payment service's ID for the authorization that was captured. * - * @return + * @return array|false * The entire updated data array for the order or FALSE to indicate the * specified authorization was not found. */ @@ -1063,16 +1097,16 @@ function uc_credit_log_prior_auth_capture($order_id, $auth_id) { /** * Logs a credit card reference to an order's data array. * - * @param $order_id + * @param int $order_id * The order associated with the credit card details. - * @param $ref_id + * @param string $ref_id * The payment service's ID for the reference that may be used to charge the * same credit card at a later date. - * @param $cc_number + * @param string $cc_number * The credit card number associated with this reference. Only the last 4 * digits will be stored. * - * @return + * @return array * The entire updated data array for the order. */ function uc_credit_log_reference($order_id, $ref_id, $cc_number) { diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_cybersource/uc_cybersource.info b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_cybersource/uc_cybersource.info index c696e486..2e9297b2 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_cybersource/uc_cybersource.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_cybersource/uc_cybersource.info @@ -7,9 +7,8 @@ core = 7.x ; Class definitions files[] = uc_cybersource.soap.inc -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_cybersource/uc_cybersource.module b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_cybersource/uc_cybersource.module index 36c546f3..cbf61fc2 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_cybersource/uc_cybersource.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_cybersource/uc_cybersource.module @@ -13,7 +13,6 @@ * http://growingventuresolutions.com */ - /** * Implements hook_menu(). */ @@ -179,12 +178,15 @@ function uc_cybersource_hop_post() { uc_cart_complete_sale($order); uc_order_comment_save($order_id, 0, t('Payment of @amount @currency submitted through CyberSource with request ID @rid.', array('@amount' => $payment_amount, '@currency' => $payment_currency, '@rid' => $request_id)), 'order', 'payment_received'); break; + case 'ERROR': uc_order_comment_save($order_id, 0, t("Payment error:@reason with request ID @rid", array('@reason' => $reason, '@rid' => '@request_id')), 'admin'); break; + case 'REJECT': uc_order_comment_save($order_id, 0, t("Payment is rejected:@reason with request ID @rid", array('@reason' => $reason, '@rid' => '@request_id')), 'admin'); break; + case 'REVIEW': uc_order_update_status($order_id, 'review'); uc_order_comment_save($order_id, 0, t('Payment is in review & not complete: @reason. Request ID @rid', array('@reason' => $reason, '@rid' => '@request_id')), 'admin'); @@ -533,13 +535,16 @@ function uc_cybersource_charge($order_id, $amount, $data) { case 'american express': $cc_type = '003'; break; + case 'visa': $cc_type = '001'; break; + case 'mastercard': case 'master card': $cc_type = '002'; break; + case 'discover': $cc_type = '004'; break; @@ -1170,7 +1175,7 @@ function uc_cybersource_uc_calculate_tax($order) { if ($reply->reasonCode == '100') { // Add a city tax if applicable. if (floatval($reply->taxReply->totalCityTaxAmount) > 0) { - $result['city'] = (object)array( + $result['city'] = (object) array( 'id' => 'city', 'name' => t('@city city tax', array('@city' => floatval($reply->taxReply->city))), 'amount' => floatval($reply->taxReply->totalCityTaxAmount), @@ -1179,7 +1184,7 @@ function uc_cybersource_uc_calculate_tax($order) { // Add a county tax if applicable. if (floatval($reply->taxReply->totalCountyTaxAmount) > 0) { - $result['county'] = (object)array( + $result['county'] = (object) array( 'id' => 'county', 'name' => t('County tax'), 'amount' => floatval($reply->taxReply->totalCountryTaxAmount), @@ -1188,7 +1193,7 @@ function uc_cybersource_uc_calculate_tax($order) { // Add a district tax if applicable. if (floatval($reply->taxReply->totalDistrictTaxAmount) > 0) { - $result['district'] = (object)array( + $result['district'] = (object) array( 'id' => 'district', 'name' => t('District tax'), 'amount' => floatval($reply->taxReply->totalDistrictTaxAmount), @@ -1197,7 +1202,7 @@ function uc_cybersource_uc_calculate_tax($order) { // Add a state tax if applicable. if (floatval($reply->taxReply->totalStateTaxAmount) > 0) { - $result['state'] = (object)array( + $result['state'] = (object) array( 'id' => 'state', 'name' => t('@state state tax', array('@state' => $reply->taxReply->state)), 'amount' => floatval($reply->taxReply->totalStateTaxAmount), @@ -1215,7 +1220,7 @@ function uc_cybersource_uc_calculate_tax($order) { watchdog('uc_cybersource', 'Tax calculation produced uneven results. Expected a total of @total, received the following: @dump', array('@total' => uc_currency_format($reply->taxReply->totalTaxAmount), '@dump' => '
    ' . print_r($result, TRUE) . '
    '), WATCHDOG_ERROR); $result = array( - 'total' => (object)array( + 'total' => (object) array( 'id' => 'total', 'name' => t('Tax'), 'amount' => floatval($reply->taxReply->totalTaxAmount), @@ -1310,10 +1315,13 @@ function _uc_cybersource_card_type($cc_number) { else { return '007'; // JCB } + case '4': return '001'; // Visa + case '5': return '002'; // MasterCard + case '6': return '004'; // Discover } @@ -1328,58 +1336,85 @@ function _uc_cybersource_parse_reason_code($code) { switch ($code) { case '100': return t('Successful transaction.'); + case '102': return t('One or more fields in the request are missing or invalid.
    Possible action: Resend the request with the correct information.'); + case '150': return t('Error: General system failure.
    Possible action: Wait a few minutes and resend the request.'); + case '151': return t('Error: The request was received, but a server time-out occurred. This error does not include time-outs between the client and the server.
    Possible action: To avoid duplicating the order, do not resend the request until you have reviewed the order status in the Business Center.'); + case '152': return t('Error: The request was received, but a service did not finish running in time.
    Possible action: To avoid duplicating the order, do not resend the request until you have reviewed the order status in the Business Center.'); + case '200': return t('The authorization request was approved by the issuing bank but declined by CyberSource because it did not pass the Address Verification Service (AVS) check.
    Possible action: You can capture the authorization, but consider reviewing the order for the possibility of fraud.'); + case '202': return t('Expired card.
    Possible action: Request a different card or other form of payment.'); + case '203': return t('General decline of the card. No other information provided by the issuing bank.
    Possible action: Request a different card or other form of payment.'); + case '204': return t('Insufficient funds in the account.
    Possible action: Request a different card or other form of payment.'); + case '205': return t("Stolen or lost card.
    Possible action: Review the customer's information and determine if you want to request a different card from the customer."); + case '207': return t('Issuing bank unavailable.
    Possible action: Wait a few minutes and resend the request.'); + case '208': return t('Inactive card or card not authorized for card-not-present transactions.
    Possible action: Request a different card or other form of payment.'); + case '210': return t('The card has reached the credit limit.
    Possible action: Request a different card or other form of payment.'); + case '211': return t('The card verification number is invalid.
    Possible action: Request a different card or other form of payment.'); + case '220': return t("The processor declined the request based on a general issue with the customer's account.
    Possible action: Request a different form of payment."); + case '221': return t('The customer matched an entry on the processor’s negative file.
    Possible action: Review the order and contact the payment processor.'); + case '222': return t("The customer's bank account is frozen.
    Possible action: Review the order or request a different form of payment."); + case '230': return t('The authorization request was approved by the issuing bank but declined by CyberSource because it did not pass the card verification number check.
    Possible action: You can capture the authorization, but consider reviewing the order for the possibility of fraud.'); + case '231': return t('Invalid account number.
    Possible action: Request a different card or other form of payment.'); + case '232': return t('The card type is not accepted by the payment processor.
    Possible action: Request a different card or other form of payment. Also, check with CyberSource Customer Support to make sure that your account is configured correctly.'); + case '233': return t('The processor declined the request based on an issue with the request itself.
    Possible action: Request a different form of payment.'); + case '234': return t('There is a problem with your CyberSource merchant configuration.
    Possible action: Do not resend the request. Contact Customer Support to correct the configuration problem.'); + case '236': return t('Processor failure.
    Possible action: Possible action: Wait a few minutes and resend the request.'); + case '240': return t('The card type sent is invalid or does not correlate with the credit card number.
    Possible action: Ask your customer to verify that the card is really the type indicated in your Web store, then resend the request.'); + case '250': return t('Error: The request was received, but a time-out occurred with the payment processor.
    Possible action: To avoid duplicating the transaction, do not resend the request until you have reviewed the transaction status in the Business Center.'); + case '475': return t('The customer is enrolled in payer authentication.
    Possible action: Authenticate the cardholder before continuing with the transaction.'); + case '476': return t("The customer cannot be authenticated.
    Possible action: Review the customer's order."); + case '520': return t('The authorization request was approved by the issuing bank but declined by CyberSource based on your Smart Authorization settings.
    Possible action: Do not capture the authorization without further review. Review the avsCode, cvResult, and factorCode fields to determine why CyberSource rejected the request.'); } @@ -1392,50 +1427,73 @@ function _uc_cybersource_parse_avs_code($code) { switch ($code) { case 'A': return t('Street address matches, but 5- and 9-digit postal codes do not match.'); + case 'B': return t('Street address matches, but postal code not verified. Returned only for non U.S.-issued Visa cards.'); + case 'C': return t('Street address and postal code do not match. Returned only for non U.S.-issued Visa cards.'); + case 'D': return t('Street address and postal code match. Returned only for non U.S.-issued Visa cards.'); + case 'E': return t('AVS data is invalid, or AVS is not allowed for this card type.'); + case 'F': return t("Card member's name does not match, but postal code matches. Returned only for the American Express card type."); + case 'G': return t('Non-U.S. issuing bank does not support AVS.'); + case 'H': return t("Card member's name does not match. Street address and postal code match. Returned only for the American Express card type."); + case 'I': return t('Address not verified. Returned only for non U.S.-issued Visa cards.'); + case 'K': return t("Card member's name matches but billing address and billing postal code do not match. Returned only for the American Express card type."); + case 'L': return t("Card member's name and billing postal code match, but billing address does not match. Returned only for the American Express card type"); + case 'N': return t("Street address and postal code do not match. - or - Card member's name, street address and postal code do not match. Returned only for the American Express card type."); + case 'O': return t("Card member's name and billing address match, but billing postal code does not match. Returned only for the American Express card type."); + case 'P': return t('Postal code matches, but street address not verified. Returned only for non-U.S.-issued Visa cards.'); + case 'R': return t('System unavailable.'); + case 'S': return t('U.S.-issuing bank does not support AVS.'); + case 'T': return t("Card member's name does not match, but street address matches. Returned only for the American Express card type."); + case 'U': return t('Address information unavailable. Returned if non-U.S. AVS is not available or if the AVS in a U.S. bank is not functioning properly.'); + case 'W': return t('Street address does not match, but 9-digit postal code matches.'); + case 'X': return t('Exact match. Street address and 9-digit postal code match.'); + case 'Y': return t('Exact match. Street address and 5-digit postal code match.'); + case 'Z': return t('Street address does not match, but 5-digit postal code matches.'); + case '1': return t('AVS is not supported for this processor or card type.'); + case '2': return t('The processor returned an unrecognized value for the AVS response.'); } @@ -1448,24 +1506,34 @@ function _uc_cybersource_parse_cvv_code($code) { switch ($code) { case 'D': return t('Transaction determined suspicious by issuing bank.'); + case 'I': return t("Card verification number failed processor's data validation check."); + case 'M': return t('Card verification number matched.'); + case 'N': return t('Card verification number not matched.'); + case 'P': return t('Card verification number not processed by processor for unspecified reason.'); + case 'S': return t('Card verification number is on the card but was not included in the request.'); + case 'U': return t('Card verification is not supported by the issuing bank.'); + case 'X': return t('Card verification is not supported by the card association.'); + case '1': return t('Card verification is not supported for this processor or card type.'); + case '2': return t('Unrecognized result code returned by processor for card verification response.'); + case '3': return t('No result code returned by processor.'); } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_cybersource/uc_cybersource.soap.inc b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_cybersource/uc_cybersource.soap.inc index adf77715..bfae58ad 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_cybersource/uc_cybersource.soap.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_cybersource/uc_cybersource.soap.inc @@ -8,6 +8,7 @@ */ class CyberSourceSoapClient extends SoapClient { + function __construct($wsdl, $options = NULL) { parent::__construct($wsdl, $options); } @@ -36,4 +37,5 @@ class CyberSourceSoapClient extends SoapClient { return parent::__doRequest($request, $location, $action, $version); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_google_checkout/uc_google_checkout.info b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_google_checkout/uc_google_checkout.info index 0d2618f8..6cb846ef 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_google_checkout/uc_google_checkout.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_google_checkout/uc_google_checkout.info @@ -6,9 +6,8 @@ dependencies[] = uc_quote package = Ubercart - payment core = 7.x -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/tests/uc_payment.test b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/tests/uc_payment.test index dce32746..e7079c89 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/tests/uc_payment.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/tests/uc_payment.test @@ -2,9 +2,12 @@ /** * @file - * Ubercart payment related tests + * Ubercart payment related tests. */ +/** + * Tests the checkout payment pane. + */ class UbercartPaymentPaneTestCase extends UbercartTestHelper { public static function getInfo() { @@ -72,7 +75,8 @@ class UbercartPaymentPaneTestCase extends UbercartTestHelper { $this->assertNoText('No payment required'); $this->assertNoText('Subtotal: $0.00'); - // Check that a mixture of free and paid products cannot be purchased for free. + // Check that a mixture of free and paid products + // cannot be purchased for free. $this->drupalPost('node/' . $free_product->nid, array(), t('Add to cart')); $this->drupalGet('cart/checkout'); $this->assertText('Check or money order'); @@ -92,4 +96,5 @@ class UbercartPaymentPaneTestCase extends UbercartTestHelper { $this->assertNoText('Select a payment method from the following options.'); $this->assertFieldByXPath("//input[@name='panes[payment][payment_method]' and @disabled='disabled']"); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.admin.inc index c918fd4d..6de6fdd6 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.admin.inc @@ -5,7 +5,6 @@ * Payment administration menu items. */ - /** * Displays an overview of the available payment methods. * diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.info b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.info index fe5359dd..cb54ec8d 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.info @@ -10,9 +10,8 @@ files[] = tests/uc_payment.test configure = admin/store/settings/payment -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.module b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.module index 8ac96b1e..de86d94b 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.module @@ -13,7 +13,6 @@ require_once dirname(__FILE__) . '/uc_payment_checkout_pane.inc'; require_once dirname(__FILE__) . '/uc_payment_order_pane.inc'; - /** * Implements hook_menu(). */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.rules.inc b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.rules.inc index 8938bfc3..3455523b 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.rules.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment.rules.inc @@ -75,10 +75,13 @@ function uc_payment_condition_order_balance($order, $balance_comparison, $includ switch ($balance_comparison) { case 'less': return $balance < 0; + case 'less_equal': return $balance <= 0.01; + case 'equal': return $balance < 0.01 && $balance > -0.01; + case 'greater': return $balance >= 0.01; } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment_order_pane.inc b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment_order_pane.inc index bdfa60bd..4cfa9246 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment_order_pane.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment/uc_payment_order_pane.inc @@ -104,6 +104,7 @@ function uc_order_pane_payment($op, $order, &$form = NULL, &$form_state = NULL) return drupal_render($form['payment']); case 'edit-process': + $changes = array(); $changes['payment_method'] = $form_state['values']['payment_method']; $changes['payment_details'] = isset($form_state['values']['payment_details']) ? $form_state['values']['payment_details'] : array(); $func = _uc_payment_method_data($form_state['values']['payment_method'], 'callback'); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment_pack/uc_payment_pack.info b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment_pack/uc_payment_pack.info index 2ee0532c..7a3cfedc 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment_pack/uc_payment_pack.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment_pack/uc_payment_pack.info @@ -5,9 +5,8 @@ dependencies[] = uc_payment package = Ubercart - payment core = 7.x -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment_pack/uc_payment_pack.module b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment_pack/uc_payment_pack.module index a1e8bd71..22bd904f 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment_pack/uc_payment_pack.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment_pack/uc_payment_pack.module @@ -5,7 +5,6 @@ * Provides the Check/Money Order, COD, and "Other" payment methods. */ - /** * Implements hook_menu(). */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment_pack/uc_payment_pack.variable.inc b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment_pack/uc_payment_pack.variable.inc index 8c31aa59..80ca6dbe 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment_pack/uc_payment_pack.variable.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_payment_pack/uc_payment_pack.variable.inc @@ -5,7 +5,6 @@ * Variable module hook implementations. */ - /** * Implements hook_variable_group_info(). */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_paypal/uc_paypal.info b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_paypal/uc_paypal.info index 91363c50..21397115 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_paypal/uc_paypal.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_paypal/uc_paypal.info @@ -4,9 +4,8 @@ dependencies[] = uc_payment package = Ubercart - payment core = 7.x -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_paypal/uc_paypal.module b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_paypal/uc_paypal.module index c10796ad..d8f27b90 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_paypal/uc_paypal.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_paypal/uc_paypal.module @@ -8,14 +8,8 @@ * You should turn on Instant Payment Notifications in your PayPal profile and * set the IPN URL to http://{yoursite.com}/uc_paypal/ipn. See * https://drupal.org/node/1311198 for further information. - * - * If you have not yet signed up for your PayPal account, please support - * Ubercart by using the following link. Thank you! - * - * https://www.paypal.com/us/mrb/pal=6NXAPNGSS6DFJ */ - /** * Implements hook_menu(). */ @@ -208,13 +202,16 @@ function uc_paypal_wpp_charge($order_id, $amount, $data) { case 'american express': $cc_type = 'Amex'; break; + case 'visa': $cc_type = 'Visa'; break; + case 'mastercard': case 'master card': $cc_type = 'MasterCard'; break; + case 'discover': $cc_type = 'Discover'; break; @@ -247,7 +244,7 @@ function uc_paypal_wpp_charge($order_id, $amount, $data) { 'IPADDRESS' => $ip_address, 'AMT' => uc_currency_format($amount, FALSE, FALSE, '.'), 'CREDITCARDTYPE' => $cc_type, - 'ACCT' => $order->payment_details['cc_number'], + 'ACCT' => $order->payment_details['cc_number'], 'EXPDATE' => $expdate, 'CVV2' => $order->payment_details['cc_cvv'], 'FIRSTNAME' => substr($order->billing_first_name, 0, 25), @@ -338,6 +335,7 @@ function uc_paypal_wpp_charge($order_id, $amount, $data) { ->execute(); break; + case 'FailureWithWarning': // Fall through. case 'Failure': @@ -348,6 +346,7 @@ function uc_paypal_wpp_charge($order_id, $amount, $data) { 'uid' => $user->uid, ); break; + default: $message = t('Unexpected acknowledgement status: @status', array('@status' => $nvp_response['ACK'])); $result = array( @@ -921,7 +920,7 @@ function uc_paypal_wps_form($form, &$form_state, $order) { $o = 0; foreach ($item->data['attributes'] as $name => $setting) { $data['on' . $o . '_' . $i] = $name; - $data['os' . $o . '_' . $i] = implode(', ', (array)$setting); + $data['os' . $o . '_' . $i] = implode(', ', (array) $setting); $o++; } } @@ -1031,10 +1030,13 @@ function _uc_paypal_card_type($cc_number) { switch (substr(strval($cc_number), 0, 1)) { case '3': return 'Amex'; + case '4': return 'Visa'; + case '5': return 'MasterCard'; + case '6': return 'Discover'; } @@ -1062,14 +1064,19 @@ function _uc_paypal_avscode_message($code) { switch ($code) { case '0': return t('All the address information matched.'); + case '1': return t('None of the address information matched; transaction declined.'); + case '2': return t('Part of the address information matched.'); + case '3': return t('The merchant did not provide AVS information. Not processed.'); + case '4': return t('Address not checked, or acquirer had no response. Service not available.'); + default: return t('No AVS response was obtained.'); } @@ -1079,32 +1086,43 @@ function _uc_paypal_avscode_message($code) { case 'A': case 'B': return t('Address matched; postal code did not'); + case 'C': case 'N': return t('Nothing matched; transaction declined'); + case 'D': case 'F': case 'X': case 'Y': return t('Address and postal code matched'); + case 'E': return t('Not allowed for MOTO transactions; transaction declined'); + case 'G': return t('Global unavailable'); + case 'I': return t('International unavailable'); + case 'P': case 'W': case 'Z': return t('Postal code matched; address did not'); + case 'R': return t('Retry for validation'); + case 'S': return t('Service not supported'); + case 'U': return t('Unavailable'); + case 'Null': return t('No AVS response was obtained.'); + default: return t('An unknown error occurred.'); } @@ -1118,14 +1136,19 @@ function _uc_paypal_cvvmatch_message($code) { switch ($code) { case '0': return t('Matched'); + case '1': return t('No match'); + case '2': return t('The merchant has not implemented CVV2 code handling.'); + case '3': return t('Merchant has indicated that CVV2 is not present on card.'); + case '4': return t('Service not available'); + default: return t('Unkown error'); } @@ -1134,16 +1157,22 @@ function _uc_paypal_cvvmatch_message($code) { switch ($code) { case 'M': return t('Match'); + case 'N': return t('No match'); + case 'P': return t('Not processed'); + case 'S': return t('Service not supported'); + case 'U': return t('Service not available'); + case 'X': return t('No response'); + default: return t('Not checked'); } @@ -1156,21 +1185,29 @@ function _uc_paypal_pending_message($reason) { switch ($reason) { case 'address': return t('Customer did not include a confirmed shipping address per your address settings.'); + case 'authorization': return t('Waiting on you to capture the funds per your authorization settings.'); + case 'echeck': return t('eCheck has not yet cleared.'); + case 'intl': return t('You must manually accept or deny this international payment from your Account Overview.'); + case 'multi-currency': case 'multi_currency': return t('You must manually accept or deny a payment of this currency from your Account Overview.'); + case 'unilateral': return t('Your e-mail address is not yet registered or confirmed.'); + case 'upgrade': return t('You must upgrade your account to Business or Premier status to receive credit card payments.'); + case 'verify': return t('You must verify your account before you can accept this payment.'); + case 'other': default: return t('Reason "@reason" unknown; contact PayPal Customer Service for more information.', array('@reason' => $reason)); @@ -1184,12 +1221,16 @@ function _uc_paypal_reversal_message($reason) { switch ($reason) { case 'chargeback': return t('The customer has initiated a chargeback.'); + case 'guarantee': return t('The customer triggered a money-back guarantee.'); + case 'buyer-complaint': return t('The customer filed a complaint about the transaction.'); + case 'refund': return t('You gave the customer a refund.'); + case 'other': default: return t('Reason "@reason" unknown; contact PayPal Customer Service for more information.', array('@reason' => $reason)); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_paypal/uc_paypal.pages.inc b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_paypal/uc_paypal.pages.inc index a548d7bd..30837c58 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_paypal/uc_paypal.pages.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/payment/uc_paypal/uc_paypal.pages.inc @@ -59,34 +59,40 @@ function uc_paypal_ipn() { return; } - $req = ''; - foreach ($_POST as $key => $value) { - $value = urlencode(stripslashes($value)); - $req .= $key . '=' . $value . '&'; + $post_fields[] = $key . '=' . urlencode(stripslashes($value)); } - $req .= 'cmd=_notify-validate'; + $post_fields[] = 'cmd=_notify-validate'; if (variable_get('uc_paypal_wpp_server', '') == 'https://api-3t.paypal.com/nvp') { - $host = 'https://www.paypal.com/cgi-bin/webscr'; + $host = 'https://ipnpb.paypal.com/cgi-bin/webscr'; } else { - $host = variable_get('uc_paypal_wps_server', 'https://www.sandbox.paypal.com/cgi-bin/webscr'); + $host = variable_get('uc_paypal_wps_server', 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr'); } - $response = drupal_http_request($host, array( - 'method' => 'POST', - 'data' => $req, - )); + // Setup the cURL request. + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $host); + curl_setopt($ch, CURLOPT_VERBOSE, 0); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $post_fields)); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); + curl_setopt($ch, CURLOPT_NOPROGRESS, 1); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); + $response = curl_exec($ch); - // TODO: Change this to property_exists when we have a PHP requirement >= 5.1. - if (array_key_exists('error', $response)) { - watchdog('uc_paypal', 'IPN failed with HTTP error @error, code @code.', array('@error' => $response->error, '@code' => $response->code), WATCHDOG_ERROR); + // Log any errors to the watchdog. + if ($error = curl_error($ch)) { + watchdog('uc_paypal', 'IPN failed with cURL error: @error', array('@error' => $error), WATCHDOG_ERROR); return; } - if (strcmp($response->data, 'VERIFIED') == 0) { + curl_close($ch); + + if (strcmp($response, 'VERIFIED') == 0) { watchdog('uc_paypal', 'IPN transaction verified.'); $duplicate = (bool) db_query_range('SELECT 1 FROM {uc_payment_paypal_ipn} WHERE txn_id = :id AND status <> :status', 0, 1, array(':id' => $txn_id, ':status' => 'Pending'))->fetchField(); @@ -162,7 +168,7 @@ function uc_paypal_ipn() { break; } } - elseif (strcmp($response->data, 'INVALID') == 0) { + elseif (strcmp($response, 'INVALID') == 0) { watchdog('uc_paypal', 'IPN transaction failed verification.', array(), WATCHDOG_ERROR); uc_order_comment_save($order_id, 0, t('An IPN transaction failed verification for this order.'), 'admin'); } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_flatrate/uc_flatrate.info b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_flatrate/uc_flatrate.info index 57fd80e4..f977ab7d 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_flatrate/uc_flatrate.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_flatrate/uc_flatrate.info @@ -6,9 +6,8 @@ core = 7.x configure = admin/store/settings/quotes/methods -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_flatrate/uc_flatrate.module b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_flatrate/uc_flatrate.module index 8a586209..669c28ce 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_flatrate/uc_flatrate.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_flatrate/uc_flatrate.module @@ -5,7 +5,6 @@ * Shipping quote module that defines a flat shipping rate for each product. */ - /** * Implements hook_menu(). */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/tests/uc_quote.test b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/tests/uc_quote.test index f7796683..9a344a09 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/tests/uc_quote.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/tests/uc_quote.test @@ -22,7 +22,13 @@ class UbercartQuoteTestCase extends UbercartTestHelper { * Overrides DrupalWebTestCase::setUp(). */ protected function setUp($modules = array(), $permissions = array()) { - $modules = array('rules_admin', 'uc_payment', 'uc_payment_pack', 'uc_quote', 'uc_flatrate'); + $modules = array( + 'rules_admin', + 'uc_payment', + 'uc_payment_pack', + 'uc_quote', + 'uc_flatrate', + ); $permissions = array('administer rules', 'bypass rules access'); parent::setUp($modules, $permissions); module_load_include('inc', 'uc_flatrate', 'uc_flatrate.admin'); @@ -32,14 +38,14 @@ class UbercartQuoteTestCase extends UbercartTestHelper { /** * Creates a flat rate shipping quote with optional conditions. * - * @param $edit + * @param array $edit * Data to use to create shipping quote, same format as the values * submitted from the add flatrate method form. - * @param $condition + * @param bool $condition * If specified, a RulesAnd component defining the conditions to apply * for this method. */ - function createQuote($edit = array(), $condition = FALSE) { + protected function createQuote(array $edit = array(), $condition = FALSE) { $edit += array( 'title' => $this->randomName(8), 'label' => $this->randomName(8), @@ -67,7 +73,7 @@ class UbercartQuoteTestCase extends UbercartTestHelper { /** * Simulates selection of a delivery country on the checkout page. * - * @param $country + * @param string $country * The text version of the country name to select, e.g. "Canada" or * "United States". */ @@ -91,7 +97,7 @@ class UbercartQuoteTestCase extends UbercartTestHelper { /** * Simulates selection of a quote on the checkout page. * - * @param $n + * @param int $n * The index of the quote to select. */ protected function selectQuote($n) { @@ -150,10 +156,10 @@ class UbercartQuoteTestCase extends UbercartTestHelper { 'USES VARIABLES' => array( 'order' => array( 'type' => 'uc_order', - 'label' => 'Order' + 'label' => 'Order', ), ), - 'AND' => array( array( + 'AND' => array(array( 'data_is' => array( 'data' => array('order:delivery-address:country'), 'value' => '840', @@ -175,9 +181,11 @@ class UbercartQuoteTestCase extends UbercartTestHelper { $this->assertText($quote2->option_text, 'The second quote option is available'); $this->assertText($quote1->total, 'Order total includes the default quote.'); - // Select a different quote and ensure the total updates correctly. Currently, we have to do this - // by examining the ajax return value directly (rather than the page contents) because drupalPostAjax() can - // only handle replacements via the 'wrapper' property, and the ajax callback may use a command with a selector. + // Select a different quote and ensure the total updates correctly. + // Currently, we have to do this by examining the ajax return value + // directly (rather than the page contents) because drupalPostAjax() + // can only handle replacements via the 'wrapper' property, and the ajax + // callback may use a command with a selector. $edit = array('panes[quotes][quotes][quote_option]' => 'flatrate_2---0'); $result = $this->ucPostAjax(NULL, $edit, $edit); $this->assertText($quote2->total, 'The order total includes the selected quote.'); @@ -229,4 +237,5 @@ class UbercartQuoteTestCase extends UbercartTestHelper { } } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/uc_quote.info b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/uc_quote.info index 1e2e8733..2dbfdfdb 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/uc_quote.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/uc_quote.info @@ -9,9 +9,8 @@ configure = admin/store/settings/quotes ; Test cases files[] = tests/uc_quote.test -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/uc_quote.module b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/uc_quote.module index a930b4b1..6086f9dd 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/uc_quote.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/uc_quote.module @@ -9,7 +9,6 @@ * their specific information so that a shipment may be quoted and requested. */ - /** * Implements hook_permission(). */ @@ -690,7 +689,7 @@ function uc_order_pane_quotes($op, $order, &$form = NULL, &$form_state = NULL) { if (isset($form_state['values']['products']) && is_array($form_state['values']['products'])) { foreach ($form_state['values']['products'] as $product) { $product['data'] = unserialize($product['data']); - $product = (object)$product; + $product = (object) $product; $order->products[] = $product; } } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/uc_quote.variable.inc b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/uc_quote.variable.inc index 95a50dfc..76c095e8 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/uc_quote.variable.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_quote/uc_quote.variable.inc @@ -5,7 +5,6 @@ * Variable module hook implementations. */ - /** * Implements hook_variable_group_info(). */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc-packing-slip.tpl.php b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc-packing-slip.tpl.php index 02b5dd81..1c345b1b 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc-packing-slip.tpl.php +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc-packing-slip.tpl.php @@ -132,7 +132,7 @@ model; ?>
    data['attributes']) && is_array($product->data['attributes']) && count($product->data['attributes']) > 0) { foreach ($product->data['attributes'] as $attribute => $option) { - echo '
  • ' . t('@attribute: @options', array('@attribute' => $attribute, '@options' => implode(', ', (array)$option))) . '
  • '; + echo '
  • ' . t('@attribute: @options', array('@attribute' => $attribute, '@options' => implode(', ', (array) $option))) . '
  • '; } } ?>
    diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.admin.inc index f97ac415..66df6bde 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.admin.inc @@ -88,6 +88,7 @@ function uc_shipping_order_packages($order) { * @see uc_shipping_new_package_validate() * @see uc_shipping_new_package_submit() * @see theme_uc_shipping_new_package_fieldset() + * * @ingroup forms */ function uc_shipping_new_package($form, &$form_state, $order) { @@ -131,10 +132,10 @@ function uc_shipping_new_package($form, &$form_state, $order) { '#default_value' => 0, ); $product_row['model'] = array( - '#markup' => check_plain($product->model) + '#markup' => check_plain($product->model), ); $product_row['name'] = array( - '#markup' => filter_xss_admin($product->title) + '#markup' => filter_xss_admin($product->title), ); $product_row['qty'] = array( '#type' => 'select', @@ -263,14 +264,14 @@ function uc_shipping_new_package_submit($form, &$form_state) { } if ($product['package'] != 0) { - $packages[$product['package']]['products'][$id] = (object)$product; + $packages[$product['package']]['products'][$id] = (object) $product; if (!isset($packages[$product['package']]['shipping_type'])) { $packages[$product['package']]['shipping_type'] = $shipping_type; } } else { - $packages[0][$shipping_type][$id] = (object)$product; + $packages[0][$shipping_type][$id] = (object) $product; } } } @@ -305,6 +306,7 @@ function uc_shipping_new_package_submit($form, &$form_state) { * * @see uc_shipping_package_edit_submit() * @see theme_uc_shipping_edit_package_fieldset() + * * @ingroup forms */ function uc_shipping_package_edit($form, &$form_state, $order, $package) { @@ -401,7 +403,7 @@ function uc_shipping_package_edit_submit($form, &$form_state) { $package = uc_shipping_package_load($form_state['values']['package_id']); foreach ($form_state['values']['products'] as $id => $product) { if ($product['checked']) { - $package->products[$id] = (object)$product; + $package->products[$id] = (object) $product; } else { unset($package->products[$id]); @@ -417,6 +419,7 @@ function uc_shipping_package_edit_submit($form, &$form_state) { * Confirms cancellation of a package's shipment. * * @see uc_shipping_package_cancel_confirm_submit() + * * @ingroup forms */ function uc_shipping_package_cancel_confirm($form, &$form_state, $order, $package) { @@ -468,6 +471,7 @@ function uc_shipping_package_cancel_confirm_submit($form, &$form_state) { * Decides to unpackage products. * * @see uc_shipping_package_delete_confirm_submit() + * * @ingroup forms */ function uc_shipping_package_delete_confirm($form, &$form_state, $order, $package) { @@ -541,6 +545,7 @@ function uc_shipping_order_shipments($order) { * * @see uc_shipping_new_shipment_submit() * @see theme_uc_shipping_new_shipment() + * * @ingroup forms */ function uc_shipping_new_shipment($form, &$form_state, $order) { @@ -622,6 +627,7 @@ function uc_shipping_new_shipment($form, &$form_state, $order) { * Formats and displays the new shipment form. * * @see uc_shipping_new_shipment() + * * @ingroup themeable */ function theme_uc_shipping_new_shipment($variables) { @@ -741,6 +747,7 @@ function uc_shipping_shipment_view($order, $shipment) { * * @see uc_shipping_shipment_edit_validate() * @see uc_shipping_shipment_edit_submit() + * * @ingroup forms */ function uc_shipping_shipment_edit($form, &$form_state, $order, $shipment) { @@ -776,7 +783,7 @@ function uc_shipping_shipment_edit($form, &$form_state, $order, $shipment) { } // Create list of products and get a representative product (last one in - // the loop) to use for some default values + // the loop) to use for some default values. $product_list = array(); $declared_value = 0; foreach ($package->products as $product) { @@ -968,7 +975,7 @@ function uc_shipping_shipment_edit($form, &$form_state, $order, $shipment) { '#default_value' => array( 'year' => $ship_date['year'], 'month' => $ship_date['mon'], - 'day' => $ship_date['mday'] + 'day' => $ship_date['mday'], ), ); $form['shipment']['expected_delivery'] = array( @@ -977,7 +984,7 @@ function uc_shipping_shipment_edit($form, &$form_state, $order, $shipment) { '#default_value' => array( 'year' => $exp_delivery['year'], 'month' => $exp_delivery['mon'], - 'day' => $exp_delivery['mday'] + 'day' => $exp_delivery['mday'], ), ); $form['shipment']['cost'] = array( @@ -987,12 +994,12 @@ function uc_shipping_shipment_edit($form, &$form_state, $order, $shipment) { ); $form['actions'] = array( - '#type' => 'actions' + '#type' => 'actions', ); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save shipment'), - '#weight' => 10 + '#weight' => 10, ); return $form; @@ -1113,6 +1120,7 @@ function theme_uc_shipping_shipment_print($variables) { * Decides to release packages to be put on another shipment. * * @see uc_shipping_shipment_delete_confirm_submit() + * * @ingroup forms */ function uc_shipping_shipment_delete_confirm($form, &$form_state, $order, $shipment) { diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.api.php b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.api.php index bcc0aabc..8faec764 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.api.php +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.api.php @@ -78,7 +78,8 @@ function hook_uc_shipment($op, $shipment) { $response = uc_google_checkout_send_request('request', $request); } } - break; + break; + case 'delete': $google_order_number = uc_google_checkout_get_google_number($shipment->order_id); if ($google_order_number) { @@ -100,7 +101,7 @@ function hook_uc_shipment($op, $shipment) { $request .= ''; } $response = uc_google_checkout_send_request('request', $request); - break; + break; } } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.info b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.info index 862578f9..51bccfee 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.info @@ -8,9 +8,8 @@ core = 7.x files[] = views/uc_shipping_handler_field_shipment_id.inc files[] = views/uc_shipping_handler_field_package_weight.inc -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.module b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.module index 1372d385..27063dec 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.module @@ -7,7 +7,6 @@ * and tracking numbers. */ - /** * Implements hook_help(). */ @@ -15,7 +14,6 @@ function uc_shipping_help($path, $arg) { switch ($path) { case 'admin/store/orders/%/packages/new': return '

    ' . t('Organize products into packages. Package numbers in multiple shipping types are of the first shipping type they appear in. All packages are given a unique ID when they are saved. Choose the default package "Sep." to automatically create a package for each of the selected quantity of products in that row.') . '

    '; - break; } } @@ -445,7 +443,7 @@ function uc_shipping_package_load($package_id) { * Saves a package. */ function uc_shipping_package_save($package) { - $package = (object)$package; + $package = (object) $package; if (!isset($package->package_id)) { $package->package_id = db_insert('uc_packages') @@ -853,9 +851,7 @@ function uc_shipping_uc_order($op, $order, $arg2) { if ($package_count > 0) { return FALSE; } - return TRUE; - break; case 'delete': // Find and delete the shipments. diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.rules.inc b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.rules.inc index 830dfd65..02a23d75 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.rules.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.rules.inc @@ -55,7 +55,7 @@ function uc_shipping_rules_data_info() { 'carrier' => array( 'type' => 'text', 'label' => t('Carrier'), - 'description' > t('The company making the delivery.'), + 'description' => t('The company making the delivery.'), ), 'transaction_id' => array( 'type' => 'text', diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.tokens.inc b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.tokens.inc index eaeec562..01cf7b8d 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.tokens.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/uc_shipping.tokens.inc @@ -5,7 +5,6 @@ * Token hooks for the uc_shipping module. */ - /** * Implements hook_token_info(). */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/views/uc_shipping_handler_field_package_weight.inc b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/views/uc_shipping_handler_field_package_weight.inc index f414cd08..ac73bc7e 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/views/uc_shipping_handler_field_package_weight.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_shipping/views/uc_shipping_handler_field_package_weight.inc @@ -12,6 +12,7 @@ * in packages have the same weight unit. */ class uc_shipping_handler_field_package_weight extends uc_product_handler_field_weight { + /** * Overrides views_handler::use_group_by(). * @@ -43,4 +44,5 @@ class uc_shipping_handler_field_package_weight extends uc_product_handler_field_ return uc_weight_format($package->weight, $package->weight_units); } } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.admin.inc index 20878772..12596f19 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.admin.inc @@ -88,7 +88,7 @@ function uc_ups_admin_settings($form, &$form_state) { '#description' => t('Select the UPS services that are available to customers.'), ); - // Container for quote options + // Container for quote options. $form['uc_ups_quote_options'] = array( '#type' => 'fieldset', '#title' => t('Quote options'), @@ -109,7 +109,7 @@ function uc_ups_admin_settings($form, &$form_state) { '#description' => t('Indicate whether each product is quoted as shipping separately or all in one package. Orders with one kind of product will still use the package quantity to determine the number of packages needed, however.'), ); - // Form to select package types + // Form to select package types. $form['uc_ups_quote_options']['uc_ups_pkg_type'] = array( '#type' => 'select', '#title' => t('Default Package Type'), @@ -137,7 +137,7 @@ function uc_ups_admin_settings($form, &$form_state) { '#description' => t('Is your UPS account receiving negotiated rates on shipments?'), ); - // Form to select pickup type + // Form to select pickup type. $form['uc_ups_quote_options']['uc_ups_pickup_type'] = array( '#type' => 'select', '#title' => t('Pickup type'), @@ -181,7 +181,7 @@ function uc_ups_admin_settings($form, &$form_state) { '#description' => t('When enabled, the quotes presented to the customer will include the cost of insurance for the full sales price of all products in the order.'), ); - // Container for markup forms + // Container for markup forms. $form['uc_ups_markups'] = array( '#type' => 'fieldset', '#title' => t('Markups'), @@ -191,7 +191,7 @@ function uc_ups_admin_settings($form, &$form_state) { '#group' => 'ups-settings', ); - // Form to select type of rate markup + // Form to select type of rate markup. $form['uc_ups_markups']['uc_ups_rate_markup_type'] = array( '#type' => 'select', '#title' => t('Rate markup type'), @@ -203,7 +203,7 @@ function uc_ups_admin_settings($form, &$form_state) { ), ); - // Form to select rate markup amount + // Form to select rate markup amount. $form['uc_ups_markups']['uc_ups_rate_markup'] = array( '#type' => 'textfield', '#title' => t('Shipping rate markup'), @@ -211,7 +211,7 @@ function uc_ups_admin_settings($form, &$form_state) { '#description' => t('Markup shipping rate quote by currency amount, percentage, or multiplier.'), ); - // Form to select type of weight markup + // Form to select type of weight markup. $form['uc_ups_markups']['uc_ups_weight_markup_type'] = array( '#type' => 'select', '#title' => t('Weight markup type'), @@ -224,7 +224,7 @@ function uc_ups_admin_settings($form, &$form_state) { '#disabled' => TRUE, ); - // Form to select weight markup amount + // Form to select weight markup amount. $form['uc_ups_markups']['uc_ups_weight_markup'] = array( '#type' => 'textfield', '#title' => t('Shipping weight markup'), @@ -233,7 +233,7 @@ function uc_ups_admin_settings($form, &$form_state) { '#disabled' => TRUE, ); - // Container for label printing + // Container for label printing. $form['uc_ups_labels'] = array( '#type' => 'fieldset', '#title' => t('Label Printing'), @@ -246,7 +246,7 @@ function uc_ups_admin_settings($form, &$form_state) { $period = drupal_map_assoc(array(86400, 302400, 604800, 1209600, 2419200, 0), 'format_interval'); $period[0] = t('Forever'); - // Form to select how long labels stay on server + // Form to select how long labels stay on server. $form['uc_ups_labels']['uc_ups_label_lifetime'] = array( '#type' => 'select', '#title' => t('Label lifetime'), diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.info b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.info index fbf7c10c..0d205a06 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.info @@ -6,9 +6,8 @@ core = 7.x configure = admin/store/settings/quotes/settings/ups -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.module b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.module index 9d39bbda..b694a953 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.module @@ -387,6 +387,7 @@ function uc_ups_shipping_quote($packages, $origin, $destination, $ups_service) { $units = 'LBS'; $unit_name = 'Pounds'; break; + case 'cm': $units = 'KGS'; $unit_name = 'Kilograms'; @@ -404,6 +405,7 @@ function uc_ups_shipping_quote($packages, $origin, $destination, $ups_service) { case 'in': $weight_factor = uc_weight_conversion($package->weight_units, 'lb'); break; + case 'cm': $weight_factor = uc_weight_conversion($package->weight_units, 'kg'); break; @@ -663,7 +665,7 @@ function uc_ups_quote($products, $details, $method) { if (!isset($product->pkg_qty) || !$product->pkg_qty) { $product->pkg_qty = 1; } - $num_of_pkgs = (int)($product->qty / $product->pkg_qty); + $num_of_pkgs = (int) ($product->qty / $product->pkg_qty); // Grab some product properties directly from the (cached) product // data. They are not normally available here because the $product @@ -706,7 +708,7 @@ function uc_ups_quote($products, $details, $method) { return array(); } - $dest = (object)$details; + $dest = (object) $details; foreach ($packages as $key => $ship_packages) { $orig = $addresses[$key]; @@ -727,9 +729,9 @@ function uc_ups_quote($products, $details, $method) { if (isset($response->Response->Error)) { foreach ($response->Response->Error as $error) { if (user_access('configure quotes') && variable_get('uc_quote_display_debug', FALSE)) { - $debug_data[$ups_service]['error'][] = (string)$error->ErrorSeverity . ' ' . (string)$error->ErrorCode . ': ' . (string)$error->ErrorDescription; + $debug_data[$ups_service]['error'][] = (string) $error->ErrorSeverity . ' ' . (string) $error->ErrorCode . ': ' . (string) $error->ErrorDescription; } - if (strpos((string)$error->ErrorSeverity, 'Hard') !== FALSE) { + if (strpos((string) $error->ErrorSeverity, 'Hard') !== FALSE) { // All or nothing quote. If some products can't be shipped by // a certain service, no quote is given for that service. If // that means no quotes are given at all, they'd better call in. @@ -744,12 +746,12 @@ function uc_ups_quote($products, $details, $method) { if (isset($response->RatedShipment->NegotiatedRates)) { $charge = $response->RatedShipment->NegotiatedRates->NetSummaryCharges->GrandTotal; } - if (!isset($charge->CurrencyCode) || (string)$charge->CurrencyCode == variable_get('uc_currency_code', "USD")) { + if (!isset($charge->CurrencyCode) || (string) $charge->CurrencyCode == variable_get('uc_currency_code', "USD")) { // Markup rate before customer sees it. if (!isset($quotes[$ups_service]['rate'])) { $quotes[$ups_service]['rate'] = 0; } - $rate = uc_ups_rate_markup((string)$charge->MonetaryValue); + $rate = uc_ups_rate_markup((string) $charge->MonetaryValue); $quotes[$ups_service]['rate'] += $rate; } } @@ -847,20 +849,20 @@ function uc_ups_void_shipment($shipment_number, $tracking_numbers = array()) { $response = new SimpleXMLElement($resp->data); if (isset($response->Response)) { if (isset($response->Response->ResponseStatusCode)) { - $success = (string)$response->Response->ResponseStatusCode; + $success = (string) $response->Response->ResponseStatusCode; } if (isset($response->Response->Error)) { foreach ($response->Response->Error as $error) { - drupal_set_message((string)$error->ErrorSeverity . ' ' . (string)$error->ErrorCode . ': ' . (string)$error->ErrorDescription, 'error'); + drupal_set_message((string) $error->ErrorSeverity . ' ' . (string) $error->ErrorCode . ': ' . (string) $error->ErrorDescription, 'error'); } } } if (isset($response->Status)) { if (isset($response->Status->StatusType)) { - $success = (string)$response->Status->StatusType->Code; + $success = (string) $response->Status->StatusType->Code; } } - return (bool)$success; + return (bool) $success; } /** @@ -880,8 +882,10 @@ function uc_ups_rate_markup($rate) { switch ($type) { case 'percentage': return $rate + $rate * floatval($markup) / 100; + case 'multiplier': return $rate * floatval($markup); + case 'currency': return $rate + floatval($markup); } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.ship.inc b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.ship.inc index 06a4bece..fd1f6f2c 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.ship.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_ups/uc_ups.ship.inc @@ -5,7 +5,6 @@ * UPS functions for label generation. */ - /** * Shipment creation callback. * @@ -31,7 +30,7 @@ function uc_ups_fulfill_order($form, &$form_state, $order, $package_ids) { '#type' => 'fieldset', '#title' => t('Packages'), '#collapsible' => TRUE, - '#tree' => TRUE + '#tree' => TRUE, ); foreach ($package_ids as $id) { $package = uc_shipping_package_load($id); @@ -42,14 +41,14 @@ function uc_ups_fulfill_order($form, &$form_state, $order, $package_ids) { } } // Create list of products and get a representative product (last one in - // the loop) to use for some default values + // the loop) to use for some default values. $product_list = array(); $declared_value = 0; foreach ($package->products as $product) { $product_list[] = $product->qty . ' x ' . $product->model; $declared_value += $product->qty * $product->price; } - // Use last product in package to determine package type + // Use last product in package to determine package type. $ups_data = db_query("SELECT pkg_type FROM {uc_ups_products} WHERE nid = :nid", array(':nid' => $product->nid))->fetchAssoc(); $product->ups = $ups_data; $pkg_form = array( @@ -151,7 +150,7 @@ function uc_ups_fulfill_order($form, &$form_state, $order, $package_ids) { $form['destination'][$field]['#required'] = TRUE; } - // Determine shipping option chosen by the customer + // Determine shipping option chosen by the customer. $method = $order->quote['method']; $methods = module_invoke_all('uc_shipping_method'); if (isset($methods[$method])) { @@ -159,14 +158,14 @@ function uc_ups_fulfill_order($form, &$form_state, $order, $package_ids) { $method = $services[$order->quote['accessorials']]; } - // Container for shipment data + // Container for shipment data. $form['shipment'] = array( '#type' => 'fieldset', '#title' => t('Shipment data'), '#collapsible' => TRUE, ); - // Inform user of customer's shipping choice + // Inform user of customer's shipping choice. $form['shipment']['shipping_choice'] = array( '#type' => 'markup', '#prefix' => '
    ', @@ -175,7 +174,7 @@ function uc_ups_fulfill_order($form, &$form_state, $order, $package_ids) { ); // Pass shipping charge paid information on to validation function so it - // can be displayed alongside actual costs + // can be displayed alongside actual costs. $form['shipment']['paid'] = array( '#type' => 'value', '#value' => uc_currency_format($order->quote['rate']), @@ -402,6 +401,7 @@ function uc_ups_shipment_request($packages, $origin, $destination, $ups_service) $units = 'LBS'; $unit_name = 'Pounds'; break; + case 'cm': $weight_factor = uc_weight_conversion($package->weight_units, 'kg'); $units = 'KGS'; @@ -709,18 +709,18 @@ function uc_ups_confirm_shipment_submit($form, &$form_state) { /** * Constructs an XML label and pickup request. * - * @param $digest + * @param string $digest * Base-64 encoded shipment request. - * @param $order_id + * @param int $order_id * The order id of the shipment. - * @param $packages + * @param array $packages * An array of package ids to be shipped. * - * @return + * @return string * ShipmentAcceptRequest XML document to send to UPS. */ function uc_ups_request_pickup($digest, $order_id = 0, $packages = array()) { - $packages = (array)$packages; + $packages = (array) $packages; $schema = uc_ups_access_request(); $schema .= " diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.admin.inc index 2d2b57e2..57ff0e92 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.admin.inc @@ -14,7 +14,7 @@ */ function uc_usps_admin_settings($form, &$form_state) { - // Put fieldsets into vertical tabs + // Put fieldsets into vertical tabs. $form['usps-settings'] = array( '#type' => 'vertical_tabs', '#attached' => array( @@ -24,7 +24,7 @@ function uc_usps_admin_settings($form, &$form_state) { ), ); - // Container for credential forms + // Container for credential forms. $form['uc_usps_credentials'] = array( '#type' => 'fieldset', '#title' => t('Credentials'), @@ -98,7 +98,7 @@ function uc_usps_admin_settings($form, &$form_state) { '#description' => t('Select the USPS services that are available to customers. Be sure to include the services that the Postal Service agrees are available to you.'), ); - // Container for quote options + // Container for quote options. $form['uc_usps_quote_options'] = array( '#type' => 'fieldset', '#title' => t('Quote options'), @@ -119,7 +119,7 @@ function uc_usps_admin_settings($form, &$form_state) { '#description' => t('Indicate whether each product is quoted as shipping separately or all in one package. Orders with one kind of product will still use the package quantity to determine the number of packages needed, however.'), ); - // Insurance + // Insurance. $form['uc_usps_quote_options']['uc_usps_insurance'] = array( '#type' => 'checkbox', '#title' => t('Package insurance'), @@ -128,7 +128,7 @@ function uc_usps_admin_settings($form, &$form_state) { '#disabled' => TRUE, ); - // Delivery Confirmation + // Delivery Confirmation. $form['uc_usps_quote_options']['uc_usps_delivery_confirmation'] = array( '#type' => 'checkbox', '#title' => t('Delivery confirmation'), @@ -137,7 +137,7 @@ function uc_usps_admin_settings($form, &$form_state) { '#disabled' => TRUE, ); - // Signature Confirmation + // Signature Confirmation. $form['uc_usps_quote_options']['uc_usps_signature_confirmation'] = array( '#type' => 'checkbox', '#title' => t('Signature confirmation'), @@ -146,7 +146,7 @@ function uc_usps_admin_settings($form, &$form_state) { '#disabled' => TRUE, ); - // Container for markup forms + // Container for markup forms. $form['uc_usps_markups'] = array( '#type' => 'fieldset', '#title' => t('Markups'), @@ -173,7 +173,7 @@ function uc_usps_admin_settings($form, &$form_state) { '#description' => t('Markup shipping rate quote by dollar amount, percentage, or multiplier.'), ); - // Form to select type of weight markup + // Form to select type of weight markup. $form['uc_usps_markups']['uc_usps_weight_markup_type'] = array( '#type' => 'select', '#title' => t('Weight markup type'), @@ -186,7 +186,7 @@ function uc_usps_admin_settings($form, &$form_state) { '#disabled' => TRUE, ); - // Form to select weight markup amount + // Form to select weight markup amount. $form['uc_usps_markups']['uc_usps_weight_markup'] = array( '#type' => 'textfield', '#title' => t('Shipping weight markup'), diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.info b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.info index 9123873a..39e34aaa 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.info @@ -6,9 +6,8 @@ core = 7.x configure = admin/store/settings/quotes/settings/usps -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.module b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.module index 8a18b1b9..4a56a683 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.module @@ -348,32 +348,31 @@ function uc_usps_quote($products, $details, $method) { } } - if (isset($response->Package)) { foreach ($response->Package as $package) { if (isset($package->Error)) { - $debug_data['error'][] = (string)$package->Error[0]->Description . '
    '; + $debug_data['error'][] = (string) $package->Error[0]->Description . '
    '; } else { if (strpos($method['id'], 'intl')) { foreach ($package->Service as $service) { - $id = (string)$service['ID']; - $services[$id]['label'] = t('U.S.P.S. @service', array('@service' => (string)$service->SvcDescription)); + $id = (string) $service['ID']; + $services[$id]['label'] = t('U.S.P.S. @service', array('@service' => (string) $service->SvcDescription)); // Markup rate before customer sees it. if (!isset($services[$id]['rate'])) { $services[$id]['rate'] = 0; } - $services[$id]['rate'] += uc_usps_rate_markup((string)$service->Postage); + $services[$id]['rate'] += uc_usps_rate_markup((string) $service->Postage); } } else { foreach ($package->Postage as $postage) { - $classid = (string)$postage['CLASSID']; + $classid = (string) $postage['CLASSID']; if ($classid === '0') { - if ((string)$postage->MailService == "First-Class Mail® Parcel") { + if ((string) $postage->MailService == "First-Class Mail® Parcel") { $classid = 'zeroParcel'; } - elseif ((string)$postage->MailService == "First-Class Mail® Letter") { + elseif ((string) $postage->MailService == "First-Class Mail® Letter") { $classid = 'zeroFlat'; } else { @@ -383,16 +382,16 @@ function uc_usps_quote($products, $details, $method) { if (!isset($services[$classid]['rate'])) { $services[$classid]['rate'] = 0; } - $services[$classid]['label'] = t('U.S.P.S. @service', array('@service' => (string)$postage->MailService)); + $services[$classid]['label'] = t('U.S.P.S. @service', array('@service' => (string) $postage->MailService)); // Markup rate before customer sees it. // Rates are stored differently if ONLINE $rate_type is requested. // First Class doesn't have online rates, so if CommercialRate // is missing use Rate instead. if ($rate_type && !empty($postage->CommercialRate)) { - $services[$classid]['rate'] += uc_usps_rate_markup((string)$postage->CommercialRate); + $services[$classid]['rate'] += uc_usps_rate_markup((string) $postage->CommercialRate); } else { - $services[$classid]['rate'] += uc_usps_rate_markup((string)$postage->Rate); + $services[$classid]['rate'] += uc_usps_rate_markup((string) $postage->Rate); } } } @@ -573,8 +572,10 @@ function uc_usps_rate_markup($rate) { switch ($type) { case 'percentage': return $rate + $rate * floatval($markup) / 100; + case 'multiplier': return $rate * floatval($markup); + case 'currency': return $rate + floatval($markup); } @@ -714,7 +715,7 @@ function _uc_usps_package_products($products, &$addresses) { if (!isset($product->pkg_qty) || !$product->pkg_qty) { $product->pkg_qty = 1; } - $num_of_pkgs = (int)($product->qty / $product->pkg_qty); + $num_of_pkgs = (int) ($product->qty / $product->pkg_qty); if ($num_of_pkgs) { $package = clone $product; $package->description = $product->model; @@ -730,6 +731,7 @@ function _uc_usps_package_products($products, &$addresses) { $package->pounds = floor($weight); $package->ounces = LB_TO_OZ * ($weight - $package->pounds); break; + case 'oz': $package->pounds = floor($weight * OZ_TO_LB); $package->ounces = $weight - $package->pounds * LB_TO_OZ; @@ -786,6 +788,7 @@ function _uc_usps_package_products($products, &$addresses) { $package->pounds = floor($weight); $package->ounces = LB_TO_OZ * ($weight - $package->pounds); break; + case 'oz': $package->pounds = floor($weight * OZ_TO_LB); $package->ounces = $weight - $package->pounds * LB_TO_OZ; diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.rules_defaults.inc b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.rules_defaults.inc index e9837a97..4a36beda 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.rules_defaults.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_usps/uc_usps.rules_defaults.inc @@ -13,7 +13,8 @@ function uc_usps_default_rules_configuration_alter(&$configs) { return; } - // Domestic areas include U.S., American Samoa, Guam, Puerto Rico, and the Virgin Islands + // Domestic areas include U.S., American Samoa, Guam, Puerto Rico, + // and the US Virgin Islands. $countries = array( 16 => t('American Samoa'), 316 => t('Guam'), @@ -41,7 +42,6 @@ function uc_usps_default_rules_configuration_alter(&$configs) { $foreign_env->condition($condition); } - $configs['get_quote_from_usps']->condition($domestic); $configs['get_quote_from_usps_env']->condition($domestic_env); $configs['get_quote_from_usps_intl']->condition($foreign); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_weightquote/uc_weightquote.info b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_weightquote/uc_weightquote.info index a16ce8e6..3e519e3d 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_weightquote/uc_weightquote.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_weightquote/uc_weightquote.info @@ -6,9 +6,8 @@ core = 7.x configure = admin/store/settings/quotes/methods -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_weightquote/uc_weightquote.module b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_weightquote/uc_weightquote.module index fa02674f..9779aa33 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_weightquote/uc_weightquote.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/shipping/uc_weightquote/uc_weightquote.module @@ -6,7 +6,6 @@ * product. */ - /** * Implements hook_menu(). */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_ajax_admin/uc_ajax_admin.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_ajax_admin/uc_ajax_admin.info index 9399e9a4..e023ed2f 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_ajax_admin/uc_ajax_admin.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_ajax_admin/uc_ajax_admin.info @@ -4,9 +4,8 @@ dependencies[] = uc_cart package = Ubercart - extra core = 7.x -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_ajax_admin/uc_ajax_admin.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_ajax_admin/uc_ajax_admin.module index 14de5667..e4f27a62 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_ajax_admin/uc_ajax_admin.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_ajax_admin/uc_ajax_admin.module @@ -182,6 +182,7 @@ function _uc_ajax_admin_list_triggers($element, &$list) { case 'button': case 'submit': $title = empty($element['#value']) ? $key : $element['#value']; break; + default: $title = empty($element['#title']) ? $key : $element['#title']; } @@ -233,7 +234,7 @@ function _uc_ajax_admin_build_checkout_form() { 'price' => 1, 'data' => array('shippable' => TRUE), 'model' => 0, - 'weight' => 0 + 'weight' => 0, )); } return drupal_get_form('uc_cart_checkout_form', $order); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/tests/uc_attribute.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/tests/uc_attribute.test index 6a096b96..5b4176ce 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/tests/uc_attribute.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/tests/uc_attribute.test @@ -879,7 +879,8 @@ class UbercartAttributeTestCase extends UbercartTestHelper { * * @param $var */ - function showVar($var) { + protected function showVar($var) { $this->pass('
    ' . print_r($var, TRUE) . '
    '); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/tests/uc_attribute_checkout.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/tests/uc_attribute_checkout.test index 6efdcb3a..5ee1d3d7 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/tests/uc_attribute_checkout.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/tests/uc_attribute_checkout.test @@ -5,6 +5,9 @@ * Ubercart attribute checkout tests. */ +/** + * Tests the product attribute API. + */ class UbercartAttributeCheckoutTestCase extends UbercartTestHelper { public static function getInfo() { @@ -26,7 +29,7 @@ class UbercartAttributeCheckoutTestCase extends UbercartTestHelper { /** * Tests that product in cart has the selected attribute option. */ - function testAttributeAddToCart() { + public function testAttributeAddToCart() { for ($display = 0; $display <= 3; ++$display) { // Set up an attribute. $data = array( diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/uc_attribute.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/uc_attribute.admin.inc index f5b8ce69..8c60466a 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/uc_attribute.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/uc_attribute.admin.inc @@ -64,6 +64,7 @@ function uc_attribute_admin() { * Form builder for product attributes. * * @see uc_attribute_form_submit() + * * @ingroup forms */ function uc_attribute_form($form, &$form_state, $attribute = NULL) { @@ -234,6 +235,7 @@ function uc_attribute_delete_confirm_submit($form, &$form_state) { * * @see uc_attribute_options_form_validate() * @see uc_attribute_options_form_submit() + * * @ingroup forms */ function uc_attribute_options_form($form, &$form_state, $attribute) { @@ -263,7 +265,7 @@ function uc_attribute_options_form($form, &$form_state, $attribute) { '#price' => $data->price, ), 'weight' => array( - '#markup' => (string)$data->weight, + '#markup' => (string) $data->weight, ), 'ordering' => array( '#type' => 'weight', @@ -358,6 +360,7 @@ function theme_uc_attribute_options_form($variables) { * * @see uc_attribute_option_form_validate() * @see uc_attribute_option_form_submit() + * * @ingroup forms */ function uc_attribute_option_form($form, &$form_state, $attribute, $option = NULL) { @@ -538,6 +541,7 @@ function uc_attribute_option_delete_confirm_submit($form, &$form_state) { * * @see uc_object_attributes_form_submit() * @see theme_uc_object_attributes_form() + * * @ingroup forms */ function uc_object_attributes_form($form, &$form_state, $object, $type, $view = 'overview') { @@ -551,6 +555,7 @@ function uc_object_attributes_form($form, &$form_state, $object, $type, $view = drupal_set_title($class->name); $attributes = uc_class_get_attributes($id); break; + case 'product': default: $product = $object; @@ -595,7 +600,7 @@ function uc_object_attributes_form($form, &$form_state, $object, $type, $view = '#maxlength' => 255, ), 'option' => array( - '#markup' => $option ? (check_plain($option->name) . ' (' . theme('uc_price', array('price' => $option->price)) . ')' ) : t('n/a'), + '#markup' => $option ? (check_plain($option->name) . ' (' . theme('uc_price', array('price' => $option->price)) . ')') : t('n/a'), ), 'required' => array( '#type' => 'checkbox', @@ -644,7 +649,7 @@ function uc_object_attributes_form($form, &$form_state, $object, $type, $view = '#title' => t('Attributes'), '#options' => count($unused_attributes) > 0 ? $unused_attributes : array(t('No attributes left to add.')), '#disabled' => count($unused_attributes) == 0 ? TRUE : FALSE, - '#weight' => -1 + '#weight' => -1, ); $form['actions'] = array('#type' => 'actions'); $form['actions']['add'] = array( @@ -679,6 +684,7 @@ function uc_object_attributes_form($form, &$form_state, $object, $type, $view = * - form: A render element representing the form. * * @see uc_object_attributes_form() + * * @ingroup themeable */ function theme_uc_object_attributes_form($variables) { @@ -852,6 +858,7 @@ function uc_object_attributes_form_submit($form, &$form_state) { * @see uc_object_options_form_validate() * @see uc_object_options_form_submit() * @see theme_uc_object_options_form() + * * @ingroup forms */ function uc_object_options_form($form, &$form_state, $object, $type) { @@ -1003,6 +1010,7 @@ function uc_object_options_form($form, &$form_state, $object, $type) { * - form: A render element representing the form. * * @see uc_object_options_form() + * * @ingroup themeable */ function theme_uc_object_options_form($variables) { @@ -1084,7 +1092,7 @@ function theme_uc_product_attributes($variables) { foreach (element_children($attributes) as $key) { $optionstr = ''; - foreach ((array)$attributes[$key]['#options'] as $option) { + foreach ((array) $attributes[$key]['#options'] as $option) { // We only need to allow translation from the second option onward if (empty($optionstr)) { $optionstr .= $option; @@ -1203,6 +1211,7 @@ function uc_object_options_form_submit($form, &$form_state) { * Form builder: associate option combinations with a product variant's SKU. * * @see uc_product_adjustments_form_submit() + * * @ingroup forms */ function uc_product_adjustments_form($form, &$form_state, $node) { @@ -1260,7 +1269,7 @@ function uc_product_adjustments_form($form, &$form_state, $node) { $num_prod_attr = count($attribute_ids); if ($num_prod_attr) { - // Get previous values + // Get previous values. $old_vals = db_query("SELECT * FROM {uc_product_adjustments} WHERE nid = :nid", array(':nid' => $nid))->fetchAll(); $result = $query->execute(); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/uc_attribute.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/uc_attribute.info index f69b2ad6..4fb83d12 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/uc_attribute.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/uc_attribute.info @@ -8,9 +8,8 @@ core = 7.x files[] = tests/uc_attribute.test files[] = tests/uc_attribute_checkout.test -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/uc_attribute.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/uc_attribute.module index fd63d644..00cd2071 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/uc_attribute.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_attribute/uc_attribute.module @@ -11,7 +11,6 @@ * instead of listing each combination separately. */ - /** * Implements hook_help(). */ @@ -20,6 +19,7 @@ function uc_attribute_help($path, $arg) { // Help messages for the attributes overview on products and classes. case 'node/%/edit/attributes': return '

    ' . t('Add attributes to this product using the add attributes form. You may then adjust the settings for these attributes on this page and go on to configure their options in the Options tab.', array('!url' => url('node/' . $arg[1] . '/edit/attributes/add'))) . '

    '; + case 'admin/store/products/classes/%/attributes': return '

    ' . t('Add attributes to the product class using the add attributes form. You may then adjust the settings for these attributes on this page and go on to configure their options in the Options tab.', array('!url' => url('admin/store/products/classes/' . $arg[4] . '/attributes/add'))) . '

    '; @@ -287,7 +287,8 @@ function uc_attribute_form_uc_product_settings_form_alter(&$form, &$form_state) '#type' => 'radios', '#title' => t('Option price format'), '#default_value' => variable_get('uc_attribute_option_price_format', 'adjustment'), - '#options' => array('none' => t('Do not display'), + '#options' => array( + 'none' => t('Do not display'), 'adjustment' => t('Display price adjustment'), 'total' => t('Display total price'), ), @@ -385,7 +386,7 @@ function uc_attribute_node_insert($node) { 'default_option', )) ->condition('pcid', $node->type); - // SELECT $node->nid AS nid + // SELECT $node->nid AS nid. $select->addExpression(':nid', 'nid', array(':nid' => $node->nid)); db_insert('uc_product_attributes') @@ -453,6 +454,12 @@ function uc_attribute_node_update_index($node) { /** * Implements hook_uc_product_models(). + * + * @param int $nid + * Node number for product type node. + * + * @return array + * Array of SKUs (model numbers) for this $nid. */ function uc_attribute_uc_product_models($nid) { // Get all the SKUs for all the attributes on this node. @@ -594,18 +601,18 @@ function uc_attribute_uc_product_description($product) { * logic; that is, we could make uc_attribute load call this function and allow * this function to minimize the number of queries necessary. -cha0s * - * @param $aids + * @param array $aids * Attribute IDs to load. - * @param $type + * @param string $type * The type of attribute. 'product', or 'class'. Any other type will fetch * a base attribute. - * @param $id + * @param int $id * The ID of the product/class this attribute belongs to. * - * @return + * @return array * An array of loaded attributes. */ -function uc_attribute_load_multiple($aids = array(), $type = '', $id = NULL) { +function uc_attribute_load_multiple(array $aids = array(), $type = '', $id = NULL) { $sql = uc_attribute_type_info($type); // Product/class attributes. @@ -652,15 +659,15 @@ function uc_attribute_load_multiple($aids = array(), $type = '', $id = NULL) { /** * Loads an attribute from the database. * - * @param $aid + * @param int $aid * The ID of the attribute. - * @param $type + * @param int $id + * The ID of the product/class this attribute belongs to. + * @param string $type * The type of attribute. 'product', or 'class'. Any other type will fetch * a base attribute. - * @param $id - * The ID of the product/class this attribute belongs to. * - * @return + * @return object|false * The attribute object, or FALSE if it doesn't exist. */ function uc_attribute_load($aid, $id = NULL, $type = '') { @@ -669,7 +676,6 @@ function uc_attribute_load($aid, $id = NULL, $type = '') { switch ($type) { case 'product': case 'class': - // Read attribute data. $query = db_select('uc_attributes', 'a') ->fields('a', array('aid', 'name', 'description')) @@ -685,7 +691,9 @@ function uc_attribute_load($aid, $id = NULL, $type = '') { $attribute = $query->execute()->fetchObject(); // Don't try to build it further if it failed already. - if (!$attribute) return FALSE; + if (!$attribute) { + return FALSE; + } // Set any missing defaults. foreach (array('ordering', 'required', 'display', 'label') as $field) { @@ -707,10 +715,9 @@ function uc_attribute_load($aid, $id = NULL, $type = '') { ->orderBy('ao.name'); $result = $query->execute(); - break; + break; default: - // Read attribute and option data. $attribute = db_query("SELECT * FROM {uc_attributes} WHERE aid = :aid", array(':aid' => $aid))->fetchObject(); $result = db_query("SELECT * FROM {uc_attribute_options} WHERE aid = :aid ORDER BY ordering, name", array(':aid' => $aid)); @@ -719,8 +726,7 @@ function uc_attribute_load($aid, $id = NULL, $type = '') { if (!$attribute) { return FALSE; } - - break; + break; } // Got an attribute? @@ -739,10 +745,10 @@ function uc_attribute_load($aid, $id = NULL, $type = '') { /** * Fetches an array of attribute objects that belong to a product. * - * @param $nid + * @param int $nid * Product whose attributes to load. * - * @return + * @return object[] * The array of attribute objects. */ function uc_attribute_load_product_attributes($nid) { @@ -752,10 +758,10 @@ function uc_attribute_load_product_attributes($nid) { /** * Saves an attribute object to the database. * - * @param $attribute + * @param object $attribute * The attribute object to save. * - * @return + * @return int * The integer result from drupal_write_record(). */ function uc_attribute_save(&$attribute) { @@ -767,10 +773,10 @@ function uc_attribute_save(&$attribute) { /** * Deletes an attribute from the database. * - * @param $aid + * @param int $aid * Attribute ID to delete. * - * @return + * @return int * The Drupal SAVED_DELETED flag. */ function uc_attribute_delete($aid) { @@ -794,10 +800,10 @@ function uc_attribute_delete($aid) { /** * Loads an attribute option from the database. * - * @param $oid + * @param int $oid * Option ID to load. * - * @return + * @return object * The attribute option object. */ function uc_attribute_option_load($oid) { @@ -807,10 +813,10 @@ function uc_attribute_option_load($oid) { /** * Saves an attribute object to the database. * - * @param $option + * @param object $option * The attribute option object to save. * - * @return + * @return int * The integer result from drupal_write_record(). */ function uc_attribute_option_save(&$option) { @@ -822,10 +828,10 @@ function uc_attribute_option_save(&$option) { /** * Deletes an attribute option from the database. * - * @param $oid + * @param int $oid * Option ID to delete. * - * @return + * @return int * The Drupal SAVED_DELETED flag. */ function uc_attribute_option_delete($oid) { @@ -848,14 +854,14 @@ function uc_attribute_option_delete($oid) { * * @param &$attribute * The product/class attribute. - * @param $type + * @param string $type * Is this a product or a class? - * @param $id + * @param string $id * The product/class ID. - * @param $save_options + * @param bool $save_options * Save the product/class attribute's options, too? * - * @return + * @return int * The integer result from drupal_write_record(). */ function uc_attribute_subject_save(&$attribute, $type, $id, $save_options = FALSE) { @@ -895,14 +901,14 @@ function uc_attribute_subject_save(&$attribute, $type, $id, $save_options = FALS /** * Deletes an attribute and all options associated with it. * - * @param $aid + * @param int $aid * The base attribute ID. - * @param $type + * @param string $type * Is this a product or a class? * @param $id * The product/class ID. * - * @return + * @return int * The Drupal SAVED_DELETED flag. */ function uc_attribute_subject_delete($aid, $type, $id = NULL) { @@ -944,14 +950,14 @@ function uc_attribute_subject_delete($aid, $type, $id = NULL) { /** * Loads a product/class attribute option. * - * @param $oid + * @param int $oid * The product/class attribute option ID. - * @param $type + * @param string $type * Is this a product or a class? - * @param $id + * @param int $id * The product/class ID. * - * @return + * @return object * An object containing the product/class attribute option. */ function uc_attribute_subject_option_load($oid, $type, $id) { @@ -974,12 +980,12 @@ function uc_attribute_subject_option_load($oid, $type, $id) { * * @param &$option * The product/class attribute option. - * @param $type + * @param string $type * Is this a product or a class? - * @param $id + * @param int $id * The product/class ID. * - * @return + * @return int * The integer result from drupal_write_record(). */ function uc_attribute_subject_option_save(&$option, $type, $id) { @@ -1000,12 +1006,12 @@ function uc_attribute_subject_option_save(&$option, $type, $id) { * * @param $oid * The base attribute's option ID. - * @param $type + * @param string $type * Is this a product or a class? - * @param $id + * @param int $id * The product/class ID. * - * @return + * @return int * The Drupal SAVED_DELETED flag. */ function uc_attribute_subject_option_delete($oid, $type, $id = NULL, $adjustments = TRUE) { @@ -1037,14 +1043,14 @@ function uc_attribute_subject_option_delete($oid, $type, $id = NULL, $adjustment /** * Deletes an attribute adjustment. * - * @param $fields + * @param array $fields * Fields used to build a condition to delete adjustments against. Fields * currently handled are 'aid', 'oid', and 'nid'. * - * @return + * @return int * The Drupal SAVED_DELETED flag. */ -function uc_attribute_adjustments_delete($fields) { +function uc_attribute_adjustments_delete(array $fields) { // Build the serialized string to match against adjustments. $match = ''; if (!empty($fields['aid'])) { @@ -1067,7 +1073,7 @@ function uc_attribute_adjustments_delete($fields) { $query->condition('nid', $fields['nid']); } - // Delete what's necessary, + // Delete what's necessary. if ($query->conditions()) { $query->execute(); } @@ -1078,14 +1084,14 @@ function uc_attribute_adjustments_delete($fields) { /** * Checks if a product/class attribute exists. * - * @param $aid + * @param int $aid * The base attribute ID. - * @param $id - * The product/class attribute's ID. - * @param $type + * @param string $type * Is this a product or a class? + * @param int $id + * The product/class attribute's ID. * - * @return + * @return bool * TRUE if the attribute exists. */ function uc_attribute_subject_exists($aid, $type, $id) { @@ -1100,14 +1106,14 @@ function uc_attribute_subject_exists($aid, $type, $id) { /** * Checks if a product/class attribute option exists. * - * @param $oid + * @param int $oid * The base attribute option ID. - * @param $id + * @param int $id * The product/class attribute option's ID. - * @param $type + * @param string $type * Is this a product or a class? * - * @return + * @return bool * TRUE if the attribute option exists. */ function uc_attribute_subject_option_exists($oid, $type, $id) { @@ -1122,10 +1128,10 @@ function uc_attribute_subject_option_exists($oid, $type, $id) { /** * Returns a list of names to abstract queries between products and classes. * - * @param $type + * @param string $type * Is this a product or a class? * - * @return + * @return array * Array of information helpful for creating SQL queries dealing * with attributes. */ @@ -1137,7 +1143,6 @@ function uc_attribute_type_info($type) { 'opt_table' => 'uc_product_options', 'id' => 'nid', ); - break; case 'class': return array( @@ -1145,12 +1150,17 @@ function uc_attribute_type_info($type) { 'opt_table' => 'uc_class_attribute_options', 'id' => 'pcid', ); - break; } } /** * Loads all attributes associated with a product node. + * + * @param int $nid + * The product node id. + * + * @return array + * The attributes. */ function uc_product_get_attributes($nid) { $attributes = array(); @@ -1165,6 +1175,12 @@ function uc_product_get_attributes($nid) { /** * Loads all attributes associated with a product class. + * + * @param int $pcid + * The product class id. + * + * @return array + * The attributes. */ function uc_class_get_attributes($pcid) { $attributes = array(); @@ -1180,10 +1196,10 @@ function uc_class_get_attributes($pcid) { /** * Gets the options chosen for a product that is in the cart. * - * @param $item + * @param mixed $item * An element of the array returned by uc_cart_get_contents. * - * @return + * @return array * Array of options chosen by a customer, indexed by attribute ids. Each * element stores the attribute name and the option object chosen. */ @@ -1204,9 +1220,9 @@ function _uc_cart_product_get_options($item) { // Only discrete options can affect the price of an item. if ($attribute->display && count($attribute->options)) { // There may be many selected options, or just one. - foreach ((array)$selected as $oid) { + foreach ((array) $selected as $oid) { if ($oid > 0) { - $options[$index] = (array)$attribute->options[$oid]; + $options[$index] = (array) $attribute->options[$oid]; $options[$index]['attribute'] = $name; $index++; } @@ -1262,18 +1278,21 @@ function uc_attribute_option_ajax($form, $form_state) { * The unique id to use to wrap these form elements. * @param &$product * The product node for which the attribute form elements are to be attached. - * @param $use_ajax + * @param bool $use_ajax * TRUE to add ajax to the form. Note that ajax may be added even if this is * FALSE, if there are multiple attributes and one or more of them is set to * display total price. * + * @return array + * Form API array with attribute elements to add to the product form. + * * @see theme_uc_attribute_add_to_cart() * @see uc_attribute_option_ajax() */ function _uc_attribute_alter_form($id, &$product, $use_ajax) { // If the product doesn't have attributes, return the form as it is. if (empty($product->attributes) || !is_array($product->attributes)) { - return NULL; + return array(); } $nid = $product->nid; @@ -1286,7 +1305,8 @@ function _uc_attribute_alter_form($id, &$product, $use_ajax) { $product->data = array(); } - // If the form is being built for the first time, populate attributes with their default values. + // If the form is being built for the first time, populate attributes + // with their default values. if (!isset($product->data['attributes'])) { $values = array(); foreach ($priced_attributes as $aid) { @@ -1386,9 +1406,11 @@ function _uc_attribute_alter_form($id, &$product, $use_ajax) { case 1: $attr_type = 'select'; break; + case 2: $attr_type = 'radios'; break; + case 3: $attr_type = 'checkboxes'; $attribute->default_option = array(); @@ -1436,6 +1458,9 @@ function _uc_attribute_alter_form($id, &$product, $use_ajax) { /** * Returns an array of display types used as options when creating attributes. + * + * @return array + * Array of display types used as options when creating attributes. */ function _uc_attribute_display_types() { return array( @@ -1449,10 +1474,10 @@ function _uc_attribute_display_types() { /** * Gets the price affecting attributes for a product. * - * @param $nid + * @param int $nid * The nid of a product. * - * @return + * @return array * Array of attribute ids that have price affecting options. */ function uc_attribute_priced_attributes($nid) { @@ -1472,13 +1497,13 @@ function uc_attribute_priced_attributes($nid) { * The NULL return value is typically used by forms so they know to hide the * #title property of the element. * - * @param $attribute + * @param object $attribute * Attribute object. - * @param $title + * @param bool $title * TRUE indicates the function is to return the attribute name when its label * is set to ''. * - * @return + * @return string|null * When the attribute label is set and not '', it is returned. * Otherwise, the attribute name is returned when $title is TRUE and NULL is * returned when $title is FALSE. @@ -1517,7 +1542,7 @@ function uc_attribute_i18n_string_refresh() { $options = db_query("SELECT oid, name FROM {uc_attribute_options} WHERE aid = :aid", array(':aid' => $attribute->aid)); foreach ($options as $option) { - i18n_string_update('uc_attribute:option:' . $option->oid .':name', $option->name); + i18n_string_update('uc_attribute:option:' . $option->oid . ':name', $option->name); } } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/tests/uc_cart.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/tests/uc_cart.test index 3460baf5..dd9b0339 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/tests/uc_cart.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/tests/uc_cart.test @@ -30,7 +30,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { /** * Creates a new order. */ - function createOrder($fields = array()) { + protected function createOrder($fields = array()) { $order = uc_order_new(); foreach ($fields as $key => $value) { $order->$key = $value; @@ -55,7 +55,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { return $order; } - function testCartAPI() { + /** + * Tests cart API. + */ + public function testCartApi() { // Test the empty cart. $items = uc_cart_get_contents(); $this->assertEqual($items, array(), 'Cart is an empty array.'); @@ -99,7 +102,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { foreach ($items as $item) { uc_cart_remove_item($item->nid, NULL, $item->data); } - // @TODO: remove the need for this + // @todo Remove the need for this. uc_cart_get_contents(NULL, 'rebuild'); $items = uc_cart_get_contents(); @@ -113,7 +116,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $this->assertEqual($items, array(), 'Cart is emptied correctly.'); } - function testCart() { + /** + * Tests basic cart functionality. + */ + public function testCart() { module_enable(array('uc_cart_entity_test')); // Test the empty cart. @@ -160,7 +166,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $this->assertText('hook_uc_cart_item_delete fired'); } - function testCartMerge() { + /** + * Tests that anonymous cart is merged into authenticated cart upon login. + */ + public function testCartMerge() { // Add an item to the cart as an anonymous user. $this->drupalLogin($this->customer); $this->drupalPost('node/' . $this->product->nid, array(), t('Add to cart')); @@ -178,7 +187,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $this->assertFieldByName('items[0][qty]', 2, t('The product quantity is 2.')); } - function testDeletedCartItem() { + /** + * Tests that cart automatically removes products that have been deleted. + */ + public function testDeletedCartItem() { // Add a product to the cart, then delete the node. $this->drupalPost('node/' . $this->product->nid, array(), t('Add to cart')); node_delete($this->product->nid); @@ -189,7 +201,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $this->assertEqual(uc_cart_get_total_qty(), 0, 'There are no items in the cart.'); } - function testMaximumQuantityRule() { + /** + * Tests Rule integration for uc_cart_maximum_product_qty reaction rule. + */ + public function testMaximumQuantityRule() { // Enable the example maximum quantity rule. $rule = rules_config_load('uc_cart_maximum_product_qty'); $rule->active = TRUE; @@ -204,8 +219,12 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $this->assertFieldByName('items[0][qty]', 10); } - function testCheckout() { - // Allow customer to specify username and password, but don't log in after checkout. + /** + * Tests the checkout process. + */ + public function testCheckout() { + // Allow customer to specify username and password, + // but don't log in after checkout. $settings = array( 'uc_cart_new_account_name' => TRUE, 'uc_cart_new_account_password' => TRUE, @@ -285,7 +304,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $this->drupalLogout(); $this->drupalLogin($new_user); - // Test again with an existing email address + // Test again with an existing email address. $this->drupalLogout(); $this->drupalPost('node/' . $this->product->nid, array(), t('Add to cart')); $this->checkout(array('panes[customer][primary_email]' => $this->customer->mail)); @@ -293,7 +312,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $this->assertRaw('order has been attached to the account we found'); } - function testCheckoutNewUsername() { + /** + * Tests generating a new account at checkout. + */ + public function testCheckoutNewUsername() { // Configure the checkout for this test. $this->drupalLogin($this->adminUser); $settings = array( @@ -326,7 +348,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $this->assertText('A new account has been created'); } - function testCheckoutBlockedUser() { + /** + * Tests blocked user checkout. + */ + public function testCheckoutBlockedUser() { // Block user after checkout. $settings = array( 'uc_new_customer_status_active' => FALSE, @@ -347,7 +372,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $this->assertTrue(empty($mail), 'No unblocked user email found.'); } - function testCheckoutLogin() { + /** + * Tests logging in the customer after checkout. + */ + public function testCheckoutLogin() { // Log in after checkout. variable_set('uc_new_customer_login', TRUE); @@ -371,7 +399,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $this->assertText('There are no products in your shopping cart.'); } - function testCheckoutComplete() { + /** + * Tests checkout complete functioning. + */ + public function testCheckoutComplete() { // Payment notification is received first. $order_data = array('primary_email' => 'simpletest@ubercart.org'); $order = $this->createOrder($order_data); @@ -381,7 +412,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { // Check that a new account was created. $this->assertTrue(strpos($output['#message'], 'new account has been created') !== FALSE, 'Checkout message mentions new account.'); - // 2 e-mails: new account, customer invoice + // 2 e-mails: new account, customer invoice. $mails = $this->drupalGetMails(); $this->assertEqual(count($mails), 2, '2 e-mails were sent.'); variable_del('drupal_test_email_collector'); @@ -397,7 +428,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $output = uc_cart_complete_sale($order, TRUE); uc_payment_enter($order->order_id, 'SimpleTest', $order->order_total); - // 2 e-mails: new account, customer invoice + // 2 e-mails: new account, customer invoice. $mails = $this->drupalGetMails(); $this->assertEqual(count($mails), 2, '2 e-mails were sent.'); variable_del('drupal_test_email_collector'); @@ -415,13 +446,13 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { // Check that no new account was created. $this->assertTrue(strpos($output['#message'], 'order has been attached to the account') !== FALSE, 'Checkout message mentions existing account.'); - // 1 e-mail: customer invoice + // 1 e-mail: customer invoice. $mails = $this->drupalGetMails(); $this->assertEqual(count($mails), 1, '1 e-mail was sent.'); variable_del('drupal_test_email_collector'); } - function testCheckoutRoleAssignment() { + public function testCheckoutRoleAssignment() { // Add role assignment to the test product. $rid = $this->drupalCreateRole(array('access content')); $this->drupalLogin($this->adminUser); @@ -445,7 +476,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $order = uc_order_load($order->order_id); $this->assertEqual($order->order_status, 'payment_received', 'Shippable order was set to payment received.'); - // 3 e-mails: new account, customer invoice, role assignment + // 3 e-mails: new account, customer invoice, role assignment. $mails = $this->drupalGetMails(); $this->assertEqual(count($mails), 3, '3 e-mails were sent.'); variable_del('drupal_test_email_collector'); @@ -462,7 +493,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $order = uc_order_load($order->order_id); $this->assertEqual($order->order_status, 'completed', 'Non-shippable order was set to completed.'); - // 2 e-mails: customer invoice, role assignment + // 2 e-mails: customer invoice, role assignment. $mails = $this->drupalGetMails(); $this->assertEqual(count($mails), 2, '2 e-mails were sent.'); variable_del('drupal_test_email_collector'); @@ -471,7 +502,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { /** * Tests that cart orders are marked abandoned after a timeout. */ - function testCartOrderTimeout() { + public function testCartOrderTimeout() { $this->drupalPost('node/' . $this->product->nid, array(), t('Add to cart')); $this->drupalPost('cart', array(), 'Checkout'); $this->assertText( @@ -509,7 +540,8 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { $order_id = db_query("SELECT order_id FROM {uc_orders} WHERE delivery_first_name = :name", array(':name' => $oldname))->fetchField(); if ($order_id) { - // Go to a different page, then back to order - make sure order_id is the same. + // Go to a different page, then back to order to make sure + // order_id is the same. $this->drupalGet(''); $this->drupalPost('node/' . $this->product->nid, array(), t('Add to cart')); $this->drupalPost('cart', array(), 'Checkout'); @@ -527,7 +559,8 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { ->execute(); $old_order = uc_order_load($order_id); - // Go to a different page, then back to order - verify that we are using a new order. + // Go to a different page, then back to order to verify that we are + // using a new order. $this->drupalGet(''); $this->drupalPost('cart', array(), 'Checkout'); $this->assertNoRaw($oldname, 'Customer name was cleared after timeout.'); @@ -546,7 +579,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper { } } - function testCustomerInformationCheckoutPane() { + /** + * Tests functioning of customer information pane on checkout page. + */ + public function testCustomerInformationCheckoutPane() { // Log in as a customer and add an item to the cart. $this->drupalLogin($this->customer); $this->drupalPost('node/' . $this->product->nid, array(), t('Add to cart')); @@ -588,7 +624,10 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper { ); } - function testAddToCartRedirect() { + /** + * Tests add-to-cart redirection. + */ + public function testAddToCartRedirect() { $this->drupalLogin($this->adminUser); $this->drupalGet('admin/store/settings/cart'); $this->assertField( @@ -625,7 +664,10 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper { $this->assertTrue($this->getUrl() == $url, 'Add to cart no-redirect works with a query string.'); } - function testMinimumSubtotal() { + /** + * Tests minimum subtotal for checkout. + */ + public function testMinimumSubtotal() { $this->drupalLogin($this->adminUser); $this->drupalGet('admin/store/settings/cart'); $this->assertField( @@ -640,12 +682,12 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper { t('Save configuration') ); - // Create two products, one below the minimum price, and one above the minimum price. + // Create two products, one below the minimum price and one above. $product_below_limit = $this->createProduct(array('sell_price' => $minimum_subtotal - 1)); $product_above_limit = $this->createProduct(array('sell_price' => $minimum_subtotal + 1)); $this->drupalLogout(); - // Check to see if the lower priced product triggers the minimum price logic. + // Checks if the lower priced product triggers the minimum price logic. $this->drupalPost( 'node/' . $product_below_limit->nid, array(), @@ -660,7 +702,8 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper { t('Prevented checkout below the minimum order total.') ); - // Add another product to the cart, and verify that we land on the checkout page. + // Add another product to the cart, and verify that we land on + // the checkout page. $this->drupalPost( 'node/' . $product_above_limit->nid, array(), @@ -674,7 +717,7 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper { $this->assertText('Enter your billing address and information here.'); } - function testEmptyCart() { + public function testEmptyCart() { // Test that the feature is not enabled by default. $this->drupalPost('node/' . $this->product->nid, array(), 'Add to cart'); $this->assertNoRaw('Empty cart'); @@ -693,7 +736,10 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper { $this->assertText('There are no products in your shopping cart.'); } - function testContinueShopping() { + /** + * Tests that continue shopping link returns customer to the correct place. + */ + public function testContinueShopping() { // Continue shopping link should take you back to the product page. $this->drupalPost( 'node/' . $this->product->nid, @@ -747,7 +793,10 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper { ); } - function testCartBreadcrumb() { + /** + * Tests the shopping cart page breadcrumb. + */ + public function testCartBreadcrumb() { $this->drupalLogin($this->adminUser); $this->drupalGet('admin/store/settings/cart'); $this->assertField( @@ -785,6 +834,7 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper { t('The breadcrumb link is set correctly.') ); } + } /** @@ -800,7 +850,10 @@ class UbercartCheckoutSettingsTestCase extends UbercartTestHelper { ); } - function testEnableCheckout() { + /** + * Tests enabling checkout functionality. + */ + public function testEnableCheckout() { $this->drupalLogin($this->adminUser); $this->drupalGet('admin/store/settings/checkout'); $this->assertField( @@ -827,7 +880,10 @@ class UbercartCheckoutSettingsTestCase extends UbercartTestHelper { ); } - function testAnonymousCheckout() { + /** + * Tests anonymous checkout functionality. + */ + public function testAnonymousCheckout() { $this->drupalLogin($this->adminUser); $this->drupalGet('admin/store/settings/checkout'); $this->assertField( @@ -855,4 +911,5 @@ class UbercartCheckoutSettingsTestCase extends UbercartTestHelper { t('The checkout page is not displayed.') ); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/tests/uc_cart_entity_test.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/tests/uc_cart_entity_test.info index 160c26f9..e4ef914f 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/tests/uc_cart_entity_test.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/tests/uc_cart_entity_test.info @@ -3,9 +3,8 @@ core = 7.x dependencies[] = uc_cart hidden = TRUE -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.admin.inc index 78589d31..6795a349 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.admin.inc @@ -9,11 +9,12 @@ * General settings for the shopping cart. * * @see uc_cart_cart_settings_form_validate() + * * @ingroup forms */ function uc_cart_cart_settings_form($form, &$form_state) { - // Put fieldsets into vertical tabs + // Put fieldsets into vertical tabs. $form['cart-settings'] = array( '#type' => 'vertical_tabs', '#attached' => array( @@ -39,12 +40,12 @@ function uc_cart_cart_settings_form($form, &$form_state) { $form['general']['panes'][$id]['uc_cap_' . $id . '_enabled'] = array( '#type' => 'checkbox', '#title' => check_plain($pane['title']), - '#default_value' => variable_get('uc_cap_'. $pane['id'] .'_enabled', $pane['enabled']), + '#default_value' => variable_get('uc_cap_' . $pane['id'] . '_enabled', $pane['enabled']), ); $form['general']['panes'][$id]['uc_cap_' . $id . '_weight'] = array( '#type' => 'weight', '#delta' => 10, - '#default_value' => variable_get('uc_cap_'. $pane['id'] .'_weight', $pane['weight']), + '#default_value' => variable_get('uc_cap_' . $pane['id'] . '_weight', $pane['weight']), '#attributes' => array('class' => array('uc-cart-pane-weight')), ); } @@ -218,7 +219,7 @@ function uc_cart_cart_settings_form_validate($form, &$form_state) { */ function uc_cart_checkout_settings_form($form, &$form_state) { - // Put fieldsets into vertical tabs + // Put fieldsets into vertical tabs. $form['checkout-settings'] = array( '#type' => 'vertical_tabs', '#attached' => array( diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.api.php b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.api.php index 092aa13c..37b89605 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.api.php +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.api.php @@ -128,14 +128,13 @@ function hook_uc_cart_display($item) { '#markup' => node_access('view', $node) ? l($item->title, 'node/' . $node->nid) : check_plain($item->title), ); - $element['#total'] = $item->price * $item->qty; $element['data'] = array('#type' => 'hidden', '#value' => serialize($item->data)); $element['qty'] = array( '#type' => 'textfield', '#default_value' => $item->qty, '#size' => 5, - '#maxlength' => 6 + '#maxlength' => 6, ); if ($description = uc_product_get_description($item)) { diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.controller.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.controller.inc index a0100222..24be91d2 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.controller.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.controller.inc @@ -1,9 +1,10 @@ 'Unique identifier for cart item.', 'type' => 'serial', 'unsigned' => TRUE, - 'not null' => TRUE + 'not null' => TRUE, ), 'cart_id' => array( 'description' => 'A user-specific cart ID. For authenticated users, their {users}.uid. For anonymous users, a token.', diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.module index c89420ce..214c77e0 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.module @@ -22,7 +22,6 @@ define('UC_CART_ORDER_TIMEOUT', 86400); // 24 hours */ define('UC_CART_CHECKOUT_TIMEOUT', 1800); // 30 minutes - /** * Implements hook_menu(). */ @@ -378,7 +377,7 @@ function uc_cart_block_view($delta = '') { 'item_text' => $item_text, 'total' => $total, 'summary_links' => $summary_links, - 'collapsed' => variable_get('uc_cart_block_collapsed', TRUE) + 'collapsed' => variable_get('uc_cart_block_collapsed', TRUE), )); return $block; @@ -597,6 +596,7 @@ function uc_cart_login_update($uid) { * @see uc_cart_view_form_checkout() * @see theme_uc_cart_view_form() * @see uc_cart_view_table() + * * @ingroup forms */ function uc_cart_view_form($form, &$form_state, $items = NULL) { @@ -608,7 +608,7 @@ function uc_cart_view_form($form, &$form_state, $items = NULL) { ); $i = 0; - $display_items = entity_view('uc_cart_item', $items, 'cart'); + $display_items = entity_view('uc_cart_item', $items, 'cart', NULL, TRUE); foreach (element_children($display_items['uc_cart_item']) as $key) { $display_item = $display_items['uc_cart_item'][$key]; if (count(element_children($display_item))) { @@ -716,7 +716,7 @@ function uc_cart_view_form_submit($form, &$form_state) { // if a qty has changed. foreach ($form['items'] as $key => $item) { if (isset($item['qty']['#default_value']) && $item['qty']['#default_value'] != $form_state['values']['items'][$key]['qty']) { - uc_cart_update_item_object((object)$form_state['values']); + uc_cart_update_item_object((object) $form_state['values']); } } } @@ -813,10 +813,10 @@ function uc_cart_view_table($table) { /** * Returns the URL redirect for the continue shopping element on the cart page. * - * @param $unset + * @param bool $unset * TRUE or FALSE indicating whether or not to unset the last URL variable. * - * @return + * @return string * The URL or Drupal path that will be used for the continue shopping element. */ function uc_cart_continue_shopping_url($unset = TRUE) { @@ -979,13 +979,13 @@ function uc_cart_complete_sale_account($order) { $order->uid = $account->uid; $order->data['new_user']['name'] = $fields['name']; - $order->data['complete_sale'] = 'new_user'; + $order->data['complete_sale'] = 'new_user'; } /** * Returns the unique cart_id of the user. * - * @param $create + * @param bool $create * Toggle auto creation of cart id. * * @return @@ -1013,7 +1013,7 @@ function uc_cart_get_id($create = TRUE) { * (optional) Carts are statically cached by default. If set to "rebuild", * the cache will be ignored and the cart reloaded from the database. * - * @return + * @return array * An array of cart items. */ function uc_cart_get_contents($cid = NULL, $action = NULL) { @@ -1086,7 +1086,7 @@ function uc_cart_get_contents($cid = NULL, $action = NULL) { * The cart ID of the shopping cart whose items we're totalling; defaults to * the current user's cart. * - * @return + * @return int * An integer representing the total number of items in the cart. */ function uc_cart_get_total_qty($cid = NULL) { @@ -1349,7 +1349,7 @@ function uc_cart_is_shippable($cart_id = NULL) { /** * Removes panes from the list that match the given conditions. * - * @return + * @return array * A checkout pane array with panes filtered out that have key values * matching the combinations in the $remove array. */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.rules.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.rules.inc index 133d8a7f..86bfe66f 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.rules.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.rules.inc @@ -2,8 +2,7 @@ /** * @file - * This file contains the Rules hooks and functions necessary to - * make the cart related entity, conditions, events, and actions work. + * Hooks and functions for uc_cart Rules integration. */ /** diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.rules_defaults.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.rules_defaults.inc index bb3f5b16..44cb0130 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.rules_defaults.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.rules_defaults.inc @@ -48,7 +48,7 @@ function uc_cart_default_rules_configuration() { // Setup a default predicate for admin checkout notifications. $rule = rules_reaction_rule(); - $rule ->label = t('E-mail admin checkout notification'); + $rule->label = t('E-mail admin checkout notification'); $rule->active = TRUE; $rule->event('uc_checkout_complete') ->action('uc_order_email_invoice', array( diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.variable.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.variable.inc index 063ee4cd..fbec3f09 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.variable.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart.variable.inc @@ -5,7 +5,6 @@ * Variable module hook implementations. */ - /** * Implements hook_variable_group_info(). */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart_checkout_pane.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart_checkout_pane.inc index d24b7bd0..053e730b 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart_checkout_pane.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart/uc_cart_checkout_pane.inc @@ -271,7 +271,7 @@ function uc_checkout_pane_address($pane, $op, $order, &$form_state, $description } } - if ($element['#name'] == "panes[$pane][select_address]") { + if ($element['#name'] == "panes[$pane][select_address]" && isset($addresses[$element['#value']])) { $address = $addresses[$element['#value']]; foreach ($address as $field => $value) { $form_state['input']['panes'][$pane][$pane . '_' . $field] = $value; diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/tests/uc_cart_links.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/tests/uc_cart_links.test index 56b12c70..fce1820e 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/tests/uc_cart_links.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/tests/uc_cart_links.test @@ -28,13 +28,13 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { /** * Tests access to admin settings page and tests default values. */ - function testCartLinksUISettingsPage() { - // Access settings page by anonymous user + public function testCartLinksUISettingsPage() { + // Access settings page by anonymous user. $this->drupalGet('admin/store/settings/cart-links'); $this->assertText(t('Access denied')); $this->assertText(t('You are not authorized to access this page.')); - // Access settings page by privileged user + // Access settings page by privileged user. $this->drupalLogin($this->adminUser); $this->drupalGet('admin/store/settings/cart-links'); $this->assertText( @@ -67,7 +67,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { t('Cart Links restrictions is empty.') ); - // Test presence of and contents of Help page + // Test presence of and contents of Help page. $this->clickLink(t('View the help page')); $this->assertText( 'http://www.example.com/cart/add/<cart_link_content>', @@ -78,32 +78,32 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { /** * Tests Cart Links on a page under a variety of conditions. */ - function testCartLinksBasicFunctionality() { - // Create product + public function testCartLinksBasicFunctionality() { + // Create product. $products[] = $this->createCartLinksProduct(FALSE); - // Create a product class + // Create a product class. $products[] = $this->createCartLinksProduct(FALSE); // later ... - // Create some valid Cart Links for these products + // Create some valid Cart Links for these products. $link_array = $this->createValidCartLinks($products); $cart_links = $link_array['links']; $link_data = $link_array['data']; // Need to test incorrect links as well: - // links which add invalid attributes - // links which omit required attributes + // - links which add invalid attributes. + // - links which omit required attributes. - // Create a page containing these links + // Create a page containing these links. $page = $this->createCartLinksPage($cart_links); // - // Test clicking on links + // Test clicking on links. // foreach ($cart_links as $key => $test_link) { $this->drupalGet('node/' . $page->nid); - // Look for link on page + // Look for link on page. $this->assertLink( t('Cart Link #@link', array('@link' => $key)), 0, @@ -116,16 +116,16 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { t('Cart Link @link found on page.', array('@link' => $test_link)) ); - // Click on link + // Click on link. $this->clickLink(t('Cart Link #@link', array('@link' => $key))); // Check for notice that item was added (this notice is set ON - // by default, see admin/store/settings/cart) + // by default, see admin/store/settings/cart). $this->assertText( t('@title added to your shopping cart.', array('@title' => $link_data[$key]['title'])), t('Product @title added to cart.', array('@title' => $link_data[$key]['title'])) ); - // Check contents of cart + // Check contents of cart. $this->drupalGet('cart'); $this->assertText( $link_data[$key]['title'], @@ -137,14 +137,14 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { t('Product quantity correct in cart.') ); - // Check for correct attribute name(s) in cart + // Check for correct attribute name(s) in cart. foreach ($link_data[$key]['attributes'] as $label => $attribute) { $this->assertText( $label . ':', t('Attribute @label correct in cart.', array('@label' => $label)) ); foreach ($attribute as $option) { - // Check for correct option name(s) in cart + // Check for correct option name(s) in cart. $this->assertText( $option, t('Option @name correct in cart.', array('@name' => $option)) @@ -153,15 +153,15 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { } // Use the same link, but this time append an '_s' to turn - // off message display for this product + // off message display for this product. $this->drupalGet($test_link . '_s'); - // Default add-to-cart message is different when adding a duplicate item + // Default add-to-cart message is different when adding a duplicate item. $this->assertNoText( t('Your item(s) have been updated.'), t('Default add-to-cart message suppressed.') ); - // Empty cart (press remove button) + // Empty cart (press remove button). $this->drupalPost('cart', array(), t('Remove')); $this->assertText('There are no products in your shopping cart.'); } @@ -171,32 +171,32 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { /** * Tests Cart Links product action messages. */ - function testCartLinksProductActionMessage() { - // Create product + public function testCartLinksProductActionMessage() { + // Create product. $products[] = $this->createCartLinksProduct(FALSE); - // Create a product class + // Create a product class. $products[] = $this->createCartLinksProduct(FALSE); // later ... - // Create some valid Cart Links for these products + // Create some valid Cart Links for these products. $link_array = $this->createValidCartLinks($products); $cart_links = $link_array['links']; $link_data = $link_array['data']; - // Create a page containing these links + // Create a page containing these links. $page = $this->createCartLinksPage($cart_links); $this->drupalLogin($this->adminUser); // - // Test product action message display + // Test product action message display. // - // Turn on display of product action message + // Turn on display of product action message. $this->setCartLinksUIProductActionMessage(TRUE); - // Go to page with Cart Links + // Go to page with Cart Links. $this->drupalGet('node/' . $page->nid); - // Pick one of the links at random + // Pick one of the links at random. $test_link = array_rand($cart_links); $this->clickLink(t('Cart Link #@link', array('@link' => $test_link))); $this->assertText( @@ -204,15 +204,15 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { t('Cart Link product action message found.') ); - // Empty cart (press remove button) + // Empty cart (press remove button). $this->drupalPost('cart', array(), t('Remove')); $this->assertText('There are no products in your shopping cart.'); - // Turn off display of product action message + // Turn off display of product action message. $this->setCartLinksUIProductActionMessage(FALSE); - // Go to page with Cart Links + // Go to page with Cart Links. $this->drupalGet('node/' . $page->nid); - // Pick one of the links at random + // Pick one of the links at random. $test_link = array_rand($cart_links); $this->clickLink(t('Cart Link #@link', array('@link' => $test_link))); $this->assertNoText( @@ -226,36 +226,36 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { /** * Tests Cart Links cart empty action. */ - function testCartLinksAllowEmptying() { - // Create product + public function testCartLinksAllowEmptying() { + // Create product. $products[] = $this->createCartLinksProduct(FALSE); - // Create a product class + // Create a product class. $products[] = $this->createCartLinksProduct(FALSE); // later ... - // Create some valid Cart Links for these products + // Create some valid Cart Links for these products. $link_array = $this->createValidCartLinks($products); $cart_links = $link_array['links']; $link_data = $link_array['data']; - // Create a page containing these links + // Create a page containing these links. $page = $this->createCartLinksPage($cart_links); $this->drupalLogin($this->adminUser); // - // Test empty cart action + // Test empty cart action. // - // Allow links to empty cart + // Allow links to empty cart. $this->setCartLinksUIAllowEmptying(TRUE); - // Go to page with Cart Links + // Go to page with Cart Links. $this->drupalGet('node/' . $page->nid); - // Pick one of the links at random and add it to the cart + // Pick one of the links at random and add it to the cart. $test_link_0 = array_rand($cart_links); $this->clickLink(t('Cart Link #@link', array('@link' => $test_link_0))); - // Pick another link at random and prepend an 'e-' so it will empty cart + // Pick another link at random and prepend an 'e-' so it will empty cart. $in_cart = $cart_links[$test_link_0]; // (Don't want to use the same link.) unset($cart_links[$test_link_0]); @@ -265,10 +265,10 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { t('The current contents of your shopping cart will be lost. Are you sure you want to continue?'), t('Empty cart confirmation page found.') ); - // Allow + // Allow. $this->drupalPost(NULL, array(), t('Confirm')); - // Verify the cart doesn't have the first item and does have the second item + // Verify the cart doesn't have the first item and does have the second item. $this->drupalGet('cart'); $this->assertText( $link_data[$test_link]['title'], @@ -279,13 +279,13 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { t('Cart was emptied by Cart Link.') ); - // Still have something ($test_link) in the cart + // Still have something ($test_link) in the cart. - // Forbid links to empty cart + // Forbid links to empty cart. $this->setCartLinksUIAllowEmptying(FALSE); - // Re-use $test_link_0 and prepend an 'e-' so it will (try to) empty cart + // Re-use $test_link_0 and prepend an 'e-' so it will (try to) empty cart. $this->drupalGet(str_replace('add/p', 'add/e-p', $in_cart)); - // Verify the cart has both items - cart wasn't emptied + // Verify the cart has both items - cart wasn't emptied. $this->drupalGet('cart'); $this->assertText( $link_data[$test_link_0]['title'], @@ -302,52 +302,52 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { /** * Tests Cart Links restrictions. */ - function testCartLinksRestrictions() { - // Create product + public function testCartLinksRestrictions() { + // Create product. $products[] = $this->createCartLinksProduct(FALSE); - // Create a product class + // Create a product class. $products[] = $this->createCartLinksProduct(FALSE); // later ... - // Create some valid Cart Links for these products + // Create some valid Cart Links for these products. $link_array = $this->createValidCartLinks($products); $cart_links = $link_array['links']; $link_data = $link_array['data']; - // Create a page containing these links + // Create a page containing these links. $page = $this->createCartLinksPage($cart_links); $this->drupalLogin($this->adminUser); // - // Test Cart Links restrictions + // Test Cart Links restrictions. // - // Go to page with Cart Links + // Go to page with Cart Links. $this->drupalGet('node/' . $page->nid); - // Pick one of the links at random and restrict it + // Pick one of the links at random and restrict it. $test_link_0 = array_rand($cart_links); // Only this link is allowed - strip '/cart/add/' from beginning $this->setCartLinksUIRestrictions(substr($cart_links[$test_link_0], 10)); - // Attempt to click link - should pass + // Attempt to click link - should pass. $this->drupalGet('node/' . $page->nid); $this->clickLink(t('Cart Link #@link', array('@link' => $test_link_0))); // Check for notice that item was added (this notice is set ON - // by default, see admin/store/settings/cart) + // by default, see admin/store/settings/cart). $this->assertText( t('@title added to your shopping cart.', array('@title' => $link_data[$test_link_0]['title'])), t('Product @title added to cart.', array('@title' => $link_data[$test_link_0]['title'])) ); - // Pick another link at random, as long as it is different from first + // Pick another link at random, as long as it is different from first. $in_cart = $cart_links[$test_link_0]; unset($cart_links[$test_link_0]); $test_link = array_rand($cart_links); - // Attempt to click it - // It should fail and redirect to the home page (default) + // Attempt to click it. + // It should fail and redirect to the home page (default). $this->drupalGet('node/' . $page->nid); $this->clickLink(t('Cart Link #@link', array('@link' => $test_link))); $this->assertText( @@ -358,7 +358,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { t('Redirected to front page for link not in restrictions.') ); - // Now create a special redirect page for bad links + // Now create a special redirect page for bad links. $redirect_page = $this->drupalCreateNode( array( 'body' => array( @@ -369,7 +369,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { ) ); - // Set redirect link + // Set redirect link. $this->setCartLinksUIRedirect('node/' . $redirect_page->nid); // Attempt to click same restricted link as above. @@ -381,7 +381,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { t('Redirected to error page for link not in restrictions.') ); - // Remove restrictions, try to add again - it should pass + // Remove restrictions, try to add again - it should pass. $this->setCartLinksUIRestrictions(''); $this->drupalGet('node/' . $page->nid); $this->clickLink(t('Cart Link #@link', array('@link' => $test_link))); @@ -413,26 +413,26 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { * * For additional messages, add additional actions, e.g. "-m99-m1337". */ - function testCartLinksMessages() { + public function testCartLinksMessages() { - // Create product + // Create product. $products[] = $this->createCartLinksProduct(FALSE); - // Create a product class + // Create a product class. $products[] = $this->createCartLinksProduct(FALSE); // later ... - // Create some valid Cart Links for these products + // Create some valid Cart Links for these products. $link_array = $this->createValidCartLinks($products); $cart_links = $link_array['links']; $link_data = $link_array['data']; - // Create a page containing these links + // Create a page containing these links. $page = $this->createCartLinksPage($cart_links); - // Need to be admin to define messages + // Need to be admin to define messages. $this->drupalLogin($this->adminUser); - // Define some messages + // Define some messages. $messages = array(); for ($i = 0; $i < 15; $i++) { $key = mt_rand(1, 999); @@ -441,13 +441,13 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { $this->setCartLinksUIMessages($messages); // - // Test message display + // Test message display. // - // Go to page with Cart Links + // Go to page with Cart Links. $this->drupalGet('node/' . $page->nid); - // Pick one link at random and append an '-m<#>' to display a message + // Pick one link at random and append an '-m<#>' to display a message. $test_link = array_rand($cart_links); $message_key = array_rand($messages); $message_text = explode('|', $messages[$message_key]); @@ -457,7 +457,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { t('Message @key displayed.', array('@key' => $message_key)) ); - // Empty cart (press remove button) + // Empty cart (press remove button). $this->drupalPost('cart', array(), t('Remove')); $this->assertText('There are no products in your shopping cart.'); @@ -467,50 +467,50 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { /** * Tests Cart Links tracking. */ - function testCartLinksTracking() { + public function testCartLinksTracking() { - // Create product + // Create product. $products[] = $this->createCartLinksProduct(FALSE); - // Create a product class + // Create a product class. $products[] = $this->createCartLinksProduct(FALSE); // later ... - // Create some valid Cart Links for these products + // Create some valid Cart Links for these products. $link_array = $this->createValidCartLinks($products); $cart_links = $link_array['links']; $link_data = $link_array['data']; - // Create a page containing these links + // Create a page containing these links. $page = $this->createCartLinksPage($cart_links); $this->drupalLogin($this->adminUser); // - // Test Cart Links tracking + // Test Cart Links tracking. // - // Go to page with Cart Links + // Go to page with Cart Links. $this->drupalGet('node/' . $page->nid); - // Create three tracking IDs + // Create three tracking IDs. $tracking = array(); for ($i = 0; $i < 3; $i++) { $tracking[$this->randomName(16)] = 0; } - // Click a number of links to create some statistics + // Click a number of links to create some statistics. for ($i = 0; $i < 50; $i++) { - // Pick one link at random and append an '-i' + // Pick one link at random and append an '-i'. $test_link = array_rand($cart_links); - // Assign one of the tracking IDs + // Assign one of the tracking IDs. $tracking_id = array_rand($tracking); $this->drupalGet($cart_links[$test_link] . '-i' . $tracking_id); - // Keep a record of how many links were assigned this key + // Keep a record of how many links were assigned this key. $tracking[$tracking_id] += 1; } - // Check report to see these clicks have been recorded correctly + // Check report to see these clicks have been recorded correctly. $this->drupalGet('admin/store/reports/cart-links'); $total = 0; foreach ($tracking as $id => $clicks) { @@ -538,7 +538,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { * TRUE to display product action messages, FALSE to not display. * Defaults to FALSE. */ - function setCartLinksUIProductActionMessage($state = FALSE) { + protected function setCartLinksUIProductActionMessage($state = FALSE) { $this->drupalPost( 'admin/store/settings/cart-links', array('uc_cart_links_add_show' => $state), @@ -560,7 +560,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { * TRUE to display product action messages, FALSE to not display. * Defaults to TRUE. */ - function setCartLinksUITrackClicks($state = TRUE) { + protected function setCartLinksUITrackClicks($state = TRUE) { $this->drupalPost( 'admin/store/settings/cart-links', array('uc_cart_links_track' => 0), @@ -582,7 +582,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { * TRUE to display product action messages, FALSE to not display. * Defaults to TRUE. */ - function setCartLinksUIAllowEmptying($state = TRUE) { + protected function setCartLinksUIAllowEmptying($state = TRUE) { $this->drupalPost( 'admin/store/settings/cart-links', array('uc_cart_links_empty' => $state), @@ -604,7 +604,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { * String containing user input from a textarea, one message per line. * Messages have numeric key and text value, separated by '|'. */ - function setCartLinksUIMessages($messages = '') { + protected function setCartLinksUIMessages($messages = '') { $message_string = implode("\n", $messages); $this->drupalPost( 'admin/store/settings/cart-links', @@ -627,7 +627,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { * String containing user input from a textarea, one restriction per line. * Restrictions are valid Cart Links - i.e. relative URLs. */ - function setCartLinksUIRestrictions($restrictions = '') { + protected function setCartLinksUIRestrictions($restrictions = '') { $this->drupalPost( 'admin/store/settings/cart-links', array('uc_cart_links_restrictions' => $restrictions), @@ -648,7 +648,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { * @param $url * Relative URL of the destination page for the redirect. Omit leading '/'. */ - function setCartLinksUIRedirect($url = '') { + protected function setCartLinksUIRedirect($url = '') { $this->drupalPost( 'admin/store/settings/cart-links', array('uc_cart_links_invalid_page' => $url), @@ -667,7 +667,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { * @param $links * Array of Cart Links to appear on page. */ - public function createCartLinksPage($links = array()) { + protected function createCartLinksPage($links = array()) { if (!empty($links)) { $i = 0; foreach ($links as $link) { @@ -698,9 +698,9 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { * Defaults to FALSE to create a normal product, set to TRUE to * create a product class instead. */ - public function createCartLinksProduct($product_class = FALSE) { + protected function createCartLinksProduct($product_class = FALSE) { - // Create a product + // Create a product. if ($product_class) { $product = $this->createProductClass(); } @@ -708,7 +708,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { $product = $this->createProduct(); } - // Create some attributes + // Create some attributes. for ($i = 0; $i < 5; $i++) { $attribute = UbercartAttributeTestCase::createAttribute(); $attributes[$attribute->aid] = $attribute; @@ -739,8 +739,8 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { // Load the attributes back. $loaded_attributes = uc_attribute_load_multiple($aids); - // TODO: add attributes of all 4 types - // TODO: create both required and not required attributes + // TODO: add attributes of all 4 types. + // TODO: create both required and not required attributes. // Add the selected attributes to the product. foreach ($loaded_attributes as $loaded_attribute) { @@ -750,7 +750,6 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { return $product; } - /** * Creates Cart Links pointing to the given product(s). * @@ -770,7 +769,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { * @return * Array containing Cart Links and link metadata. */ - function createValidCartLinks($products = array()) { + protected function createValidCartLinks($products = array()) { foreach ($products as $key => $product) { $nid = $product->nid; $title = $product->title; @@ -789,7 +788,7 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { // $cart_links and $link_data share the same keys. $cart_links[$key] = '/cart/add/p' . $nid . '_q' . $qty; - // Loop over attributes, append all attribute/option combos to links + // Loop over attributes, append all attribute/option combos to links. $attributes = uc_product_get_attributes($nid); foreach ($attributes as $attribute) { // If this is textfield, radio, or select option, then @@ -800,12 +799,14 @@ class UbercartCartLinksTestCase extends UbercartTestHelper { $link_data[$key]['attributes'][$attribute->label][] = $value; $cart_links[$key] .= '_a' . $attribute->aid . 'o' . $value; break; + case 1: // select case 2: // radios $option = $attribute->options[array_rand($attribute->options)]; $link_data[$key]['attributes'][$attribute->label][] = $option->name; $cart_links[$key] .= '_a' . $attribute->aid . 'o' . $option->oid; break; + case 3: // checkboxes foreach ($attribute->options as $option) { $link_data[$key]['attributes'][$attribute->label][] = $option->name; diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.info index 24904caa..bcdae15b 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.info @@ -9,9 +9,8 @@ files[] = tests/uc_cart_links.test configure = admin/store/settings/cart-links -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.install b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.install index 6562a2da..1fb17169 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.install +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.install @@ -33,7 +33,7 @@ function uc_cart_links_schema() { ), ), 'primary key' => array( - 'cart_link_id' + 'cart_link_id', ), ); @@ -47,7 +47,7 @@ function uc_cart_links_uninstall() { db_delete('variable') ->condition('name', 'uc_cart_links_%', 'LIKE') ->execute(); - cache_clear_all('variables', 'cache'); + cache_clear_all('variables', 'cache_bootstrap'); } /** diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.module index 9fcc41b6..e0f34828 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.module @@ -6,7 +6,6 @@ * customers on to checkout. */ - /** * Implements hook_help(). */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.pages.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.pages.inc index 9d24d716..9717796e 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.pages.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_cart_links/uc_cart_links.pages.inc @@ -8,7 +8,7 @@ /** * Preprocesses a Cart Link, confirming with the user for destructive actions. * - * @param $cart_actions + * @param string $cart_actions * A Cart Link URL is structured like "/cart/add/$cart_actions". * * @see uc_cart_links_form_submit() @@ -58,7 +58,7 @@ function uc_cart_links_form_submit($form, &$form_state) { /** * Processes a Cart Link to fiddle with the cart and redirect the user. * - * @param $cart_actions + * @param string $cart_actions * A Cart Link URL is structured like "/cart/add/$cart_actions". */ function uc_cart_links_process($cart_actions) { @@ -91,11 +91,13 @@ function uc_cart_links_process($cart_actions) { case 'P': $p['nid'] = intval(drupal_substr($part, 1)); break; + // Set the quantity to add to cart: _q2 case 'q': case 'Q': $p['qty'] = intval(drupal_substr($part, 1)); break; + // Set an attribute/option for the product: _a3o6 case 'a': case 'A': @@ -116,11 +118,12 @@ function uc_cart_links_process($cart_actions) { // option, so put that into an array with this new option $p['attributes'][$attribute] = array( $p['attributes'][$attribute] => $p['attributes'][$attribute], - $option => $option + $option => $option, ); } } break; + // Suppress the add to cart message: _s case 's': case 'S': @@ -169,7 +172,7 @@ function uc_cart_links_process($cart_actions) { foreach ($data as $message) { // Skip blank lines. if (preg_match('/^\s*$/', $message)) { - continue; + continue; } list($mkey, $mdata) = explode('|', $message, 2); $messages[trim($mkey)] = trim($mdata); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/classes/treenode.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/classes/treenode.inc index 7477338e..bbbebe4d 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/classes/treenode.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/classes/treenode.inc @@ -18,7 +18,7 @@ class UcTreeNode { /** * Constructor. */ - function __construct($term = NULL) { + public function __construct($term = NULL) { if ($term) { $this->tid = $term->tid; $this->name = $term->name; @@ -36,13 +36,14 @@ class UcTreeNode { * tree structure. Therefore, if the parameter is more than one level * deeper than $this, it should be passed to the last child of $this. */ - function add_child(&$child) { + public function add_child(&$child) { if ($child->depth - $this->depth == 1) { $this->children[] = $child; } else { - $last_child =&$this->children[count($this->children)-1]; + $last_child =&$this->children[count($this->children) - 1]; $last_child->add_child($child); } } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/tests/uc_catalog.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/tests/uc_catalog.test index d4046137..da611f9f 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/tests/uc_catalog.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/tests/uc_catalog.test @@ -5,6 +5,9 @@ * Tests for the Ubercart catalog. */ +/** + * Tests for the Ubercart catalog. + */ class UbercartCatalogTestCase extends UbercartTestHelper { public static function getInfo() { @@ -20,10 +23,17 @@ class UbercartCatalogTestCase extends UbercartTestHelper { */ protected function setUp($modules = array(), $permissions = array()) { $modules = array('uc_catalog', 'field_ui'); - $permissions = array('administer catalog', 'administer content types', 'administer fields'); + $permissions = array( + 'administer catalog', + 'administer content types', + 'administer fields', + ); parent::setUp($modules, $permissions); } + /** + * Tests the catalog repair function. + */ public function testCatalogRepair() { $this->drupalLogin($this->adminUser); @@ -45,4 +55,5 @@ class UbercartCatalogTestCase extends UbercartTestHelper { $this->drupalGet('admin/structure/types/manage/product/fields'); $this->assertText('taxonomy_catalog', 'Catalog taxonomy term reference field exists.'); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.admin.inc index 4060a8dc..7d03fdc0 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.admin.inc @@ -5,7 +5,6 @@ * Catalog administration menu items. */ - /** * Catalog settings form. * diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.info index b999e3eb..4ea16c7d 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.info @@ -15,9 +15,8 @@ files[] = tests/uc_catalog.test configure = admin/store/settings/catalog -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.module index f2073555..ad97445c 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.module @@ -11,7 +11,6 @@ * not listed in it. */ - /** * Implements hook_help(). */ @@ -467,13 +466,12 @@ function _uc_catalog_navigation($branch) { ->count(); $num = $query->execute(); - $branch_path = uc_catalog_path($branch); if (!isset($breadcrumb)) { $breadcrumb = drupal_get_breadcrumb(); } $vid = variable_get('uc_catalog_vid', 0); - if ($_GET['q'] == $branch_path) { + if ($_GET['q'] == $branch_path) { // The URL points to this term. $here = TRUE; } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.pathauto.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.pathauto.inc index fa31ea1a..bd46b383 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.pathauto.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.pathauto.inc @@ -21,7 +21,7 @@ function uc_catalog_pathauto($op) { $settings['batch_update_callback'] = 'uc_catalog_pathauto_bulkupdate'; $settings['batch_file'] = drupal_get_path('module', 'uc_catalog') . '/uc_catalog.pathauto.inc'; - return (object) $settings; + return (object) $settings; } } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.theme.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.theme.inc index 7fcaa1d2..c465bc9a 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.theme.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/uc_catalog.theme.inc @@ -9,6 +9,7 @@ * Themes the catalog block. * * @see theme_uc_catalog_item() + * * @ingroup themeable */ function theme_uc_catalog_block($variables) { diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/views/uc_catalog.views_default.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/views/uc_catalog.views_default.inc index f418a358..eb413304 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/views/uc_catalog.views_default.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_catalog/views/uc_catalog.views_default.inc @@ -9,7 +9,7 @@ * Implements hook_views_default_views(). */ function uc_catalog_views_default_views() { - $view = new view; + $view = new view(); $view->name = 'uc_catalog'; $view->description = t('Catalog'); $view->tag = ''; @@ -191,7 +191,7 @@ function uc_catalog_views_default_views() { $views[$view->name] = $view; - $view = new view; + $view = new view(); $view->name = 'uc_catalog_terms'; $view->description = 'Catalog categories'; $view->tag = ''; diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/tests/uc_file.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/tests/uc_file.test index 1c66fbb8..37a9b1d6 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/tests/uc_file.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/tests/uc_file.test @@ -33,7 +33,7 @@ class UbercartFileTestCase extends UbercartTestHelper { $this->configureDownloadDirectory(); } - function testFilePurchaseCheckout() { + public function testFilePurchaseCheckout() { // Add file download feature to the test product. $filename = $this->uploadTestFile(); $this->drupalLogin($this->adminUser); @@ -89,7 +89,6 @@ class UbercartFileTestCase extends UbercartTestHelper { ); } - /** * Helper function to upload test file for downloading. */ @@ -106,7 +105,7 @@ class UbercartFileTestCase extends UbercartTestHelper { /** * {@inheritdoc} */ - public function tearDown() { + protected function tearDown() { // Cleanup file download directory after test. drupal_unlink('sites/default/files/file-downloads/README.txt'); drupal_rmdir('sites/default/files/file-downloads'); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.admin.inc index 8693ee4c..1d97d73e 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.admin.inc @@ -16,6 +16,7 @@ define('UC_FILE_FORM_ACTION', 1 ); * * @see uc_file_admin_files_form_show_files() * @see uc_file_admin_files_form_action() + * * @ingroup forms */ function uc_file_admin_files_form($form, &$form_state) { @@ -45,6 +46,7 @@ function uc_file_admin_files_form($form, &$form_state) { * @see uc_file_admin_files_form_show_validate() * @see uc_file_admin_files_form_show_submit() * @see theme_uc_file_admin_files_form_show() + * * @ingroup forms */ function uc_file_admin_files_form_show_files($form, &$form_state) { @@ -53,7 +55,7 @@ function uc_file_admin_files_form_show_files($form, &$form_state) { $header = array( 'filename' => array('data' => t('File'), 'field' => 'f.filename', 'sort' => 'asc'), 'title' => array('data' => t('Product'), 'field' => 'n.title'), - 'model' => array('data' => t('SKU'), 'field' => 'fp.model') + 'model' => array('data' => t('SKU'), 'field' => 'fp.model'), ); // Create pager. @@ -109,7 +111,7 @@ function uc_file_admin_files_form_show_files($form, &$form_state) { 'uc_file_delete' => t('Delete file(s)'), ); - // Check if any hook_uc_file_action('info', $args) are implemented + // Check if any hook_uc_file_action('info', $args) are implemented. foreach (module_implements('uc_file_action') as $module) { $name = $module . '_uc_file_action'; $result = $name('info', NULL); @@ -190,6 +192,7 @@ function uc_file_admin_files_form_show_submit($form, &$form_state) { * - form: A render element representing the form. * * @see uc_file_admin_files_form_show_files() + * * @ingroup themeable */ function theme_uc_file_admin_files_form_show($variables) { @@ -211,6 +214,7 @@ function theme_uc_file_admin_files_form_show($variables) { * @see uc_file_admin_files_form() * @see uc_file_admin_files_form_action_validate() * @see uc_file_admin_files_form_action_submit() + * * @ingroup forms */ function uc_file_admin_files_form_action($form, &$form_state) { @@ -258,7 +262,7 @@ function uc_file_admin_files_form_action($form, &$form_state) { ); // Don't even show the recursion checkbox unless we have any directories. - if ($has_directory && $affected_list[TRUE] !== FALSE ) { + if ($has_directory && $affected_list[TRUE] !== FALSE) { $form['recurse_directories'] = array( '#type' => 'checkbox', '#title' => t('Delete selected directories and their sub directories'), @@ -276,14 +280,12 @@ function uc_file_admin_files_form_action($form, &$form_state) { ), ); } - break; case 'uc_file_upload': - // Calculate the max size of uploaded files, in bytes. $max_bytes = trim(ini_get('post_max_size')); - switch (strtolower($max_bytes{strlen($max_bytes)-1})) { + switch (strtolower($max_bytes{strlen($max_bytes) - 1})) { case 'g': $max_bytes *= 1024; case 'm': @@ -323,13 +325,11 @@ function uc_file_admin_files_form_action($form, &$form_state) { ); // Must add this after confirm_form, as it runs over $form['#attributes']. - // Issue logged at d#319723 + // Issue logged at https://www.drupal.org/node/319723. $form['#attributes']['enctype'] = 'multipart/form-data'; - break; default: - // This action isn't handled by us, so check if any // hook_uc_file_action('form', $args) are implemented. foreach (module_implements('uc_file_action') as $module) { @@ -337,7 +337,6 @@ function uc_file_admin_files_form_action($form, &$form_state) { $result = $name('form', array('action' => $form_state['values']['uc_file_action']['action'], 'file_ids' => $file_ids)); $form = (is_array($result)) ? array_merge($form, $result) : $form; } - break; } @@ -378,7 +377,7 @@ function uc_file_admin_files_form_action_validate($form, &$form_state) { default: // This action isn't handled by us, so check if any - // hook_uc_file_action('validate', $args) are implemented + // hook_uc_file_action('validate', $args) are implemented. foreach (module_implements('uc_file_action') as $module) { $name = $module . '_uc_file_action'; $result = $name('validate', array('form_id' => $form_id, 'form_state' => $form_state)); @@ -398,7 +397,6 @@ function uc_file_admin_files_form_action_submit($form, &$form_state) { switch ($form_state['values']['action']) { case 'uc_file_delete': - // File deletion status. $status = TRUE; @@ -411,11 +409,9 @@ function uc_file_admin_files_form_action_submit($form, &$form_state) { else { drupal_set_message(t('One or more files could not be deleted.'), 'warning'); } - break; case 'uc_file_upload': - // Build the destination location. We start with the base directory, // then add any directory which was explicitly selected. $dir = variable_get('uc_file_base_dir', NULL) . '/'; @@ -428,13 +424,13 @@ function uc_file_admin_files_form_action_submit($form, &$form_state) { // Copy the file to its final location. if (copy($file_object->uri, $dir . '/' . $file_object->filename)) { - // Check if any hook_uc_file_action('upload', $args) are implemented + // Check if any hook_uc_file_action('upload', $args) are implemented. foreach (module_implements('uc_file_action') as $module) { $name = $module . '_uc_file_action'; $result = $name('upload', array('file_object' => $file_object, 'form_id' => $form_id, 'form_state' => $form_state)); } - // Update the file list + // Update the file list. uc_file_refresh(); drupal_set_message(t('The file %file has been uploaded to %dir', array('%file' => $file_object->filename, '%dir' => $dir))); @@ -446,13 +442,11 @@ function uc_file_admin_files_form_action_submit($form, &$form_state) { else { drupal_set_message(t('Can not move file to %dir', array('%dir' => $dir)), 'error'); } - break; default: - // This action isn't handled by us, so check if any - // hook_uc_file_action('submit', $args) are implemented + // hook_uc_file_action('submit', $args) are implemented. foreach (module_implements('uc_file_action') as $module) { $name = $module . '_uc_file_action'; $result = $name('submit', array('form_id' => $form_id, 'form_state' => $form_state)); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.api.php b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.api.php index 19ea8b89..088bc3cc 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.api.php +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.api.php @@ -122,11 +122,13 @@ function hook_uc_file_action($op, $args) { switch ($op) { case 'info': return array('uc_image_watermark_add_mark' => 'Add Watermark'); + case 'insert': // Automatically adds watermarks to any new files that are uploaded to // the file download directory. _add_watermark($args['file_object']->uri); - break; + break; + case 'form': if ($args['action'] == 'uc_image_watermark_add_mark') { $form['watermark_text'] = array( @@ -139,23 +141,27 @@ function hook_uc_file_action($op, $args) { '#value' => t('Add watermark'), ); } - return $form; + return $form; + case 'upload': _add_watermark($args['file_object']->uri); break; + case 'upload_validate': // Given a file path, function checks if file is valid JPEG. if (!_check_image($args['file_object']->uri)) { form_set_error('upload', t('Uploaded file is not a valid JPEG')); } - break; + break; + case 'validate': if ($args['form_values']['action'] == 'uc_image_watermark_add_mark') { if (empty($args['form_values']['watermark_text'])) { form_set_error('watermar_text', t('Must fill in text')); } } - break; + break; + case 'submit': if ($args['form_values']['action'] == 'uc_image_watermark_add_mark') { foreach ($args['form_values']['file_ids'] as $file_id) { @@ -164,7 +170,7 @@ function hook_uc_file_action($op, $args) { _add_watermark($filename); } } - break; + break; } } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.css b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.css index d8da71d7..ba85a9d0 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.css +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.css @@ -15,7 +15,7 @@ display: inline; } -.duration { +.duration { display: inline; white-space: nowrap; } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.info index 133bffdf..dbdc399c 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.info @@ -11,9 +11,8 @@ files[] = tests/uc_file.test stylesheets[all][] = uc_file.css scripts[] = uc_file.js -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.module index 890c3dc2..41c8df80 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.module @@ -9,8 +9,6 @@ * download link via email. Additionally, after logging on a customer can * download files via their account page. Optionally, an admininstrator can set * restrictions on how and when files are downloaded. - * - * Development sponsored by the Ubercart project. http://www.ubercart.org */ /** @@ -267,7 +265,7 @@ function uc_file_user_form_validate($form, &$form_state) { // Determine if any downloads were modified. if (isset($edit['file_download'])) { - foreach ((array)$edit['file_download'] as $key => $download_modification) { + foreach ((array) $edit['file_download'] as $key => $download_modification) { // We don't care... it's about to be deleted. if ($download_modification['remove']) { continue; @@ -313,7 +311,7 @@ function uc_file_user_form_submit($form, &$form_state) { // Check out if any downloads were modified. if (isset($edit['file_download'])) { - foreach ((array)$edit['file_download'] as $fid => $download_modification) { + foreach ((array) $edit['file_download'] as $fid => $download_modification) { // Remove this user download? if ($download_modification['remove']) { uc_file_remove_user_file_by_id($account, $fid); @@ -340,7 +338,7 @@ function uc_file_user_form_submit($form, &$form_state) { // Check out if any downloads were added. We pass NULL to file_user_renew, // because this shouldn't be associated with a random product. if (isset($edit['file_add'])) { - foreach ((array)$edit['file_add'] as $fid => $data) { + foreach ((array) $edit['file_add'] as $fid => $data) { $download_modification['download_limit'] = variable_get('uc_file_download_limit_number', NULL); $download_modification['address_limit'] = variable_get('uc_file_download_limit_addresses', NULL); @@ -427,7 +425,7 @@ function uc_file_uc_add_to_cart($nid, $qty, $data) { // Get the current limits, and calculate the new limits to show the user. if ($file_user = _uc_file_user_get($user, $product_feature->fid)) { - $file_user = (array)$file_user; + $file_user = (array) $file_user; $old_limits = $file_user; @@ -556,7 +554,7 @@ function uc_file_feature_form($form, &$form_state, $node, $feature) { // Rescan the file directory to populate {uc_files} with the current list // because files uploaded via any method other than the Upload button - // (e.g. by FTP) won'b be in {uc_files} yet. + // (e.g. by FTP) won't be in {uc_files} yet. uc_file_refresh(); @@ -809,7 +807,8 @@ function uc_file_feature_form_submit($form, &$form_state) { $form_state['redirect'] = uc_product_feature_save($data); - $file_product['pfid'] = $data['pfid']; + // Updating the 'pfid' on $file_product and on $form_state for future use. + $form_state['values']['pfid'] = $file_product['pfid'] = $data['pfid']; // Insert or update uc_file_product table. $key = array(); @@ -1629,12 +1628,12 @@ function uc_file_user_renew($fid, $user, $pfid, $file_limits, $force_overwrite) $force_overwrite = TRUE; } else { - $file_user = (array)$file_user; + $file_user = (array) $file_user; $key = 'fuid'; } // Add file data in as well. - $file_info = (array)uc_file_get_by_id($fid); + $file_info = (array) uc_file_get_by_id($fid); $file_user += $user_file_global + $file_info; @@ -1658,7 +1657,7 @@ function uc_file_user_renew($fid, $user, $pfid, $file_limits, $force_overwrite) watchdog('uc_file', '%user has been allowed to download %file.', array('%user' => format_username($user), '%file' => $file_user['filename'])); } - $result[] = (object)$file_user; + $result[] = (object) $file_user; } return $result; } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.pages.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.pages.inc index 5b4a9f70..2ccb8112 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.pages.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.pages.inc @@ -43,6 +43,7 @@ define('UC_FILE_ERROR_HOOK_ERROR' , 7); * - address_limit: Integer limit on IP addresses. * * @see theme_table() + * * @ingroup themeable */ function theme_uc_file_user_downloads($variables) { @@ -134,7 +135,7 @@ function uc_file_user_downloads($account) { ), ); - // Expiration set to 'never' + // Expiration set to 'never'. if ($file->expiration == FALSE) { $file_link = l(basename($file->filename), 'download/' . $file->fid, $onclick); } @@ -338,7 +339,7 @@ function _uc_file_download_transfer($file_user, $ip) { $filename = preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1); } - // Check if HTTP_RANGE is sent by browser (or download manager) + // Check if HTTP_RANGE is sent by browser (or download manager). $range = NULL; if (isset($_SERVER['HTTP_RANGE'])) { if (substr($_SERVER['HTTP_RANGE'], 0, 6) == 'bytes=') { @@ -354,7 +355,7 @@ function _uc_file_download_transfer($file_user, $ip) { } } - // Figure out download piece from range (if set) + // Figure out download piece from range (if set). if (isset($range)) { list($seek_start, $seek_end) = explode('-', $range, 2); } @@ -370,7 +371,7 @@ function _uc_file_download_transfer($file_user, $ip) { drupal_add_http_header('Status', '206 Partial Content'); } - // Standard headers, including content-range and length + // Standard headers, including content-range and length. drupal_add_http_header('Pragma', 'public'); drupal_add_http_header('Cache-Control', 'cache, must-revalidate'); drupal_add_http_header('Accept-Ranges', 'bytes'); @@ -379,20 +380,20 @@ function _uc_file_download_transfer($file_user, $ip) { drupal_add_http_header('Content-Disposition', 'attachment; filename="' . $filename . '"'); drupal_add_http_header('Content-Length', $seek_end - $seek_start + 1); - // Last-Modified is required for content served dynamically + // Last-Modified is required for content served dynamically. drupal_add_http_header('Last-Modified', gmdate("D, d M Y H:i:s", filemtime($file_user->full_path)) . " GMT"); - // Etag header is required for Firefox3 and other managers + // Etag header is required for Firefox3 and other managers. drupal_add_http_header('ETag', md5($file_user->full_path)); - // Open the file and seek to starting byte + // Open the file and seek to starting byte. $fp = fopen($file_user->full_path, 'rb'); fseek($fp, $seek_start); - // Start buffered download + // Start buffered download. while (!feof($fp)) { - // Reset time limit for large files + // Reset time limit for large files. drupal_set_time_limit(0); // Push the data to the client. @@ -429,7 +430,7 @@ function _uc_file_log_download($file_user, $ip) { // Accessed again. $file_user->accessed++; - // Calculate hash + // Calculate hash. $file_user->file_key = drupal_get_token(serialize($file_user)); drupal_write_record('uc_file_users', $file_user, 'fuid'); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.rules.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.rules.inc index de747ec3..995994bc 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.rules.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_file/uc_file.rules.inc @@ -102,6 +102,7 @@ function uc_file_get_expiration_properties($expiration, array $options, $name, $ switch ($name) { case 'user': return $expiration->uid; + case 'file': return $expiration->fid; } @@ -138,7 +139,7 @@ function uc_file_rules_action_info() { ), ); - // Send an email to an order with a file expiration + // Send an email to an order with a file expiration. $actions['uc_file_order_email'] = array( 'label' => t('Send an order email regarding files.'), 'group' => t('Notification'), @@ -230,7 +231,7 @@ function uc_file_action_order_email($order, $file_expiration, $from, $addresses, 'format' => $format, ); - // Token replacements for the subject and body + // Token replacements for the subject and body. $settings['replacements'] = array( 'uc_order' => $order, 'uc_file' => $file_expiration, @@ -262,7 +263,7 @@ function uc_file_action_order_email($order, $file_expiration, $from, $addresses, * user is notified in Drupal, as well as through the email address associated * with the order. * - * @param $order + * @param object $order * An Ubercart order object. */ function uc_file_action_order_renew($order) { @@ -292,14 +293,14 @@ function uc_file_action_order_renew($order) { // as an offset of the previous. $file_user = _uc_file_user_get($order_user, $file->fid); - // Get the limit info from the product feature + // Get the limit info from the product feature. $file_modification = array( 'download_limit' => uc_file_get_download_limit($file), 'address_limit' => uc_file_get_address_limit($file), 'expiration' => _uc_file_expiration_date(uc_file_get_time_limit($file), ($file_user ? max($file_user->expiration, REQUEST_TIME) : NULL)), ); - // Add file_user(s) for this file/directory. (No overwrite) + // Add file_user(s) for this file/directory. (No overwrite). $new_files = uc_file_user_renew($file->fid, $order_user, $file->pfid, $file_modification, FALSE); // Save for notification. diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_googleanalytics/uc_googleanalytics.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_googleanalytics/uc_googleanalytics.info index ab22849d..d83b47d1 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_googleanalytics/uc_googleanalytics.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_googleanalytics/uc_googleanalytics.info @@ -1,15 +1,14 @@ name = Google Analytics for Ubercart description = Adds e-commerce tracking to the Google Analytics module. -dependencies[] = googleanalytics +dependencies[] = googleanalytics (!=7.x-2.4) dependencies[] = uc_cart dependencies[] = uc_order dependencies[] = uc_store package = Ubercart - extra core = 7.x -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_googleanalytics/uc_googleanalytics.install b/sites/all/modules/contrib/ecommerce/ubercart/uc_googleanalytics/uc_googleanalytics.install new file mode 100644 index 00000000..5e1ce22c --- /dev/null +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_googleanalytics/uc_googleanalytics.install @@ -0,0 +1,21 @@ + 'googleanalytics'))->fetchField(); + + // Update the weight of the UC Google Analytics module so its hooks get called + // after the actual Google Analytics module. + db_update('system') + ->fields(array('weight' => max(1000, $weight + 1))) + ->condition('name', 'uc_googleanalytics') + ->execute(); +} diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_googleanalytics/uc_googleanalytics.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_googleanalytics/uc_googleanalytics.module index ae3629b5..806d519f 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_googleanalytics/uc_googleanalytics.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_googleanalytics/uc_googleanalytics.module @@ -2,6 +2,8 @@ /** * @file + * Adds Google Analytics Javascript to the checkout completion page. + * * Adds the required Javascript to the checkout completion page to allow * e-commerce statistics tracking through Google Analytics. * @@ -10,21 +12,6 @@ * Google Analytics. */ -/** - * Implements hook_enable(). - */ -function uc_googleanalytics_enable() { - // Get the weight of the Google Analytics module. - $weight = db_query("SELECT weight FROM {system} WHERE name = :module", array(':module' => 'googleanalytics'))->fetchField(); - - // Update the weight of the UC Google Analytics module so its hooks get called - // after the actual Google Analytics module. - db_update('system') - ->fields(array('weight' => max(1000, $weight + 1))) - ->condition('name', 'uc_googleanalytics') - ->execute(); -} - /** * Check which version of google analytics code is used on the site. */ @@ -74,7 +61,7 @@ function uc_googleanalytics_uc_order($op, $order, $arg2) { /** * Determine whether or not to display the e-commerce related JS through GA. * - * @return + * @return bool * TRUE or FALSE indicating whether or not to display the GA e-commerce JS. */ function uc_googleanalytics_display() { @@ -107,7 +94,7 @@ function uc_googleanalytics_display() { * @param $order * The fully loaded order object to convert into GA JS. * - * @return + * @return string * The JS that should be added to the page footer. */ function uc_googleanalytics_ecommerce_js($order) { diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/templates/uc-order--admin.tpl.php b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/templates/uc-order--admin.tpl.php index 620801d6..a1271baf 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/templates/uc-order--admin.tpl.php +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/templates/uc-order--admin.tpl.php @@ -20,7 +20,7 @@   : model; ?>
    data['attributes'])): ?> data['attributes'] as $attribute => $option): ?> -    $attribute, '@options' => implode(', ', (array)$option))); ?>
    +    $attribute, '@options' => implode(', ', (array) $option))); ?>

    diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/tests/uc_order.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/tests/uc_order.test index 46ce871e..98ece912 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/tests/uc_order.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/tests/uc_order.test @@ -5,6 +5,9 @@ * Tests for Ubercart orders. */ +/** + * Tests for Ubercart orders. + */ class UbercartOrderTestCase extends UbercartTestHelper { public static function getInfo() { @@ -15,7 +18,10 @@ class UbercartOrderTestCase extends UbercartTestHelper { ); } - public function testOrderAPI() { + /** + * Tests order entity API functions. + */ + public function testOrderApi() { // Test defaults. $order = uc_order_new(); $this->assertEqual($order->uid, 0, 'New order is anonymous.'); @@ -31,6 +37,9 @@ class UbercartOrderTestCase extends UbercartTestHelper { $this->assertFalse($deleted_order, 'Order was successfully deleted'); } + /** + * Tests order CRUD operations. + */ public function testOrderEntity() { $order = entity_create('uc_order', array()); $this->assertEqual($order->uid, 0, 'New order is anonymous.'); @@ -54,6 +63,9 @@ class UbercartOrderTestCase extends UbercartTestHelper { $this->assertFalse($deleted_order, 'Order was successfully deleted'); } + /** + * Tests order entity CRUD hooks. + */ public function testEntityHooks() { module_enable(array('entity_crud_hook_test')); @@ -80,6 +92,9 @@ class UbercartOrderTestCase extends UbercartTestHelper { $this->assertHookMessage('entity_crud_hook_test_entity_delete called for type uc_order'); } + /** + * Tests admin order creation. + */ public function testOrderCreation() { $this->drupalLogin($this->adminUser); @@ -102,6 +117,9 @@ class UbercartOrderTestCase extends UbercartTestHelper { $this->assertText('Pending', 'New order is "Pending".'); } + /** + * Tests admin editing of orders. + */ public function testOrderEditing() { $order = $this->ucCreateOrder($this->customer); @@ -129,6 +147,9 @@ class UbercartOrderTestCase extends UbercartTestHelper { $this->assertFieldByName('billing_last_name', $edit['billing_last_name'], 'Billing last name changed.'); } + /** + * Helper function for creating an order programmatically. + */ protected function ucCreateOrder($customer) { $order = uc_order_new($customer->uid); uc_order_comment_save($order->order_id, 0, t('Order created programmatically.'), 'admin'); @@ -182,10 +203,14 @@ class UbercartOrderTestCase extends UbercartTestHelper { return $order; } + /** + * Helper function for testing order entity CRUD hooks. + */ protected function assertHookMessage($text, $message = NULL, $group = 'Other') { if (!isset($message)) { $message = $text; } return $this->assertTrue(array_search($text, $_SESSION['entity_crud_hook_test']) !== FALSE, $message, $group); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.admin.inc index b217815d..feb17907 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.admin.inc @@ -45,6 +45,7 @@ function uc_order_settings_form($form, &$form_state) { * @see uc_order_workflow_form_submit() * @see theme_uc_order_state_table() * @see theme_uc_order_status_table() + * * @ingroup forms */ function uc_order_workflow_form($form, &$form_state) { @@ -187,6 +188,7 @@ function uc_order_workflow_form_submit($form, &$form_state) { * Themes the order state table in the order workflow settings. * * @see uc_order_workflow_form() + * * @ingroup themeable */ function theme_uc_order_state_table($variables) { @@ -208,6 +210,7 @@ function theme_uc_order_state_table($variables) { * Themes the order status table in the order workflow settings. * * @see uc_order_workflow_form() + * * @ingroup themeable */ function theme_uc_order_status_table($variables) { @@ -233,6 +236,7 @@ function theme_uc_order_status_table($variables) { * * @see uc_order_status_create_form_validate() * @see uc_order_status_create_form_submit() + * * @ingroup forms */ function uc_order_status_create_form($form, &$form_state) { @@ -333,6 +337,7 @@ function uc_order_status_create_form_submit($form, &$form_state) { * * @see uc_order_create_form_create_validate() * @see uc_order_create_form_create_submit() + * * @ingroup forms */ function uc_order_create_form($form, &$form_state) { @@ -521,6 +526,7 @@ function uc_order_create_form_customer_search($form, &$form_state) { * Form validation handler for customer search. * * @see uc_order_create_form() + * * @ingroup forms */ function uc_order_create_form_create_validate($form, &$form_state) { @@ -549,6 +555,7 @@ function uc_order_create_form_create_validate($form, &$form_state) { * Form submission handler for customer search. * * @see uc_order_create_form() + * * @ingroup forms */ function uc_order_create_form_create_submit($form, &$form_state) { @@ -620,6 +627,7 @@ function uc_order_address_book() { * Presents previously entered addresses as selectable options. * * @see uc_order_address_book() + * * @ingroup forms */ function uc_order_address_book_form($form, &$form_state, $uid = 0, $type = 'billing', $func = '') { @@ -759,6 +767,7 @@ function uc_order_select_customer($email = NULL) { * Form to choose a customer from a list. * * @see uc_order_select_customer() + * * @ingroup forms */ function uc_order_select_customer_form($form, &$form_state, $options = NULL) { @@ -873,7 +882,7 @@ function uc_order_history($user) { array('data' => t('Order #'), 'field' => 'o.order_id'), array('data' => t('Status'), 'field' => 'os.title'), array('data' => t('Products'), 'field' => 'products'), - array('data' => t('Total'), 'field' => 'o.order_total') + array('data' => t('Total'), 'field' => 'o.order_total'), ); $rows = array(); @@ -950,6 +959,7 @@ function uc_order_history($user) { * @see uc_order_edit_form_submit() * @see theme_uc_order_edit_form() * @see uc_order_edit_form_delete() + * * @ingroup forms */ function uc_order_edit_form($form, &$form_state, $order) { @@ -1062,7 +1072,7 @@ function uc_order_edit_form_submit($form, &$form_state) { foreach ($form_state['values']['products'] as $product) { if (!isset($product['remove']) && intval($product['qty']) > 0) { $product['data'] = unserialize($product['data']); - $product = (object)$product; + $product = (object) $product; $order->products[] = $product; if (module_exists('uc_stock')) { @@ -1096,6 +1106,7 @@ function uc_order_edit_form_submit($form, &$form_state) { * @see uc_order_edit_form() * @see uc_order_edit_form_validate() * @see uc_order_edit_form_submit() + * * @ingroup themeable */ function theme_uc_order_edit_form($variables) { @@ -1215,6 +1226,7 @@ function uc_order_add_line_item_form_submit($form, &$form_state) { * * @see uc_order_mail_invoice_form_validate() * @see uc_order_mail_invoice_form_submit() + * * @ingroup forms */ function uc_order_mail_invoice_form($form, &$form_state, $order) { @@ -1228,7 +1240,7 @@ function uc_order_mail_invoice_form($form, &$form_state, $order) { '#default_value' => $order->primary_email, ); $form['actions'] = array('#type' => 'actions'); - $form['actions']['submit' ] = array( + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Mail invoice'), ); @@ -1300,6 +1312,7 @@ function uc_order_log($order) { * Confirmation form to delete an order. * * @see uc_order_delete_confirm_form_submit() + * * @ingroup forms */ function uc_order_delete_confirm_form($form, &$form_state, $order) { @@ -1310,7 +1323,7 @@ function uc_order_delete_confirm_form($form, &$form_state, $order) { $form['order_id'] = array( '#type' => 'value', - '#value' => $order->order_id + '#value' => $order->order_id, ); return confirm_form($form, t('Are you sure you want to delete order @order_id?', array('@order_id' => $order->order_id)), 'admin/store/orders', NULL, t('Delete')); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.api.php b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.api.php index 08bfc1ab..4d40eb2a 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.api.php +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.api.php @@ -121,7 +121,6 @@ function hook_uc_line_item_data_alter(&$items) { $items['tax_subtotal']['callback'] = NULL; } - /** * Performs actions on orders. * diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.controller.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.controller.inc index a064d962..2b86ad75 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.controller.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.controller.inc @@ -1,4 +1,5 @@ 0 && $action !== 'rebuild') { return $items; diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.module index 5947cf8b..f09cdc97 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.module @@ -65,7 +65,7 @@ class UcOrder { * @param $state * The initial order state. */ - function __construct($uid = 0, $state = 'in_checkout') { + public function __construct($uid = 0, $state = 'in_checkout') { if (strlen($uid) < 22 && $uid > 0) { $this->uid = $uid; if ($account = user_load($uid)) { @@ -230,7 +230,7 @@ function uc_order_menu() { $items['admin/store/orders/%uc_order/view'] = array( 'title' => 'View', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10 + 'weight' => -10, ); $items['admin/store/orders/%uc_order/edit'] = array( 'title' => 'Edit', @@ -306,7 +306,8 @@ function uc_order_menu_alter(&$items) { // Adjust the Field UI tabs on admin/store/settings/orders. $items['admin/store/settings/orders/products/fields']['title'] = 'Ordered product fields'; $items['admin/store/settings/orders/products/fields']['weight'] = 3; - // Disable field display settings for ordered products, as we don't use this anywhere (yet). + // Disable field display settings for ordered products, + // as we don't use this anywhere (yet). $items['admin/store/settings/orders/products/display']['access callback'] = FALSE; } @@ -460,7 +461,8 @@ function uc_order_can_view_order($account, $order, $view_invoice = FALSE) { // Users with 'view all orders' are straightforward. $access = user_access('view all orders'); - // If the user is the current user and is not anonymous, also allow the "own" permissions. + // If the user is the current user and is not anonymous, + // also allow the "own" permissions. if ($user->uid && $user->uid == $account->uid) { if ($view_invoice) { $access = $access || user_access('view own invoices'); @@ -518,7 +520,6 @@ function uc_order_entity_info() { 'fieldable' => TRUE, 'entity keys' => array( 'id' => 'order_id', - 'label' => t('Order'), ), 'bundles' => array( 'uc_order' => array( @@ -553,7 +554,6 @@ function uc_order_entity_info() { 'module' => 'uc_order', 'entity keys' => array( 'id' => 'order_product_id', - 'label' => t('Order product'), ), 'bundles' => array( 'uc_order_product' => array( @@ -1108,7 +1108,7 @@ function uc_order_product_entity_save($product) { /** * Remove a single product line from an order. * - * @param integer $order_product_id + * @param int $order_product_id * Ordered product ID of product to remove. */ function uc_order_product_delete($order_product_id) { @@ -1128,9 +1128,9 @@ function uc_order_product_delete_multiple($order_product_ids) { /** * Load a single ordered product entity. * - * @param integer $opid + * @param int $opid * The ID of the ordered product entity. - * @param boolean $reset + * @param bool $reset * Whether to reset the internal cache for ordered product IDs. Defaults to * FALSE. * @@ -1148,7 +1148,7 @@ function uc_order_product_load($opid, $reset = FALSE) { * @param array $opids * Array of ordered product IDs of products to load. Default is the empty * array, which loads all ordered products. - * @param boolean $reset + * @param bool $reset * Whether to reset the internal cache for ordered product IDs. Defaults to * FALSE. * @@ -1321,11 +1321,11 @@ function uc_order_load($order_id, $reset = FALSE) { * * @param $ids * An array of order IDs. - * @param $conditions + * @param array $conditions * An array of conditions on the {uc_orders} table in the form - * 'field' => $value. + * 'field' => $value. * - * @return + * @return array * An array of order objects indexed by order_id. */ function uc_order_load_multiple($ids, $conditions = array(), $reset = FALSE) { @@ -1788,7 +1788,7 @@ function template_preprocess_uc_order(&$variables) { if (!empty($product->data['attributes'])) { $attributes = array(); foreach ($product->data['attributes'] as $attribute => $option) { - $attributes[] = t('@attribute: @options', array('@attribute' => $attribute, '@options' => implode(', ', (array)$option))); + $attributes[] = t('@attribute: @options', array('@attribute' => $attribute, '@options' => implode(', ', (array) $option))); } $product->details .= theme('item_list', array('items' => $attributes)); } @@ -1994,10 +1994,12 @@ function uc_order_status_list($scope = 'all', $sql = FALSE, $action = '') { case 'all': $result = db_query("SELECT * FROM {uc_order_statuses}"); break; + case 'general': case 'specific': $result = db_query("SELECT * FROM {uc_order_statuses} WHERE state IN (:states)", array(':states' => uc_order_state_list($scope, TRUE))); break; + default: $result = db_query("SELECT * FROM {uc_order_statuses} WHERE state = :scope", array(':scope' => $scope)); break; diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.order_pane.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.order_pane.inc index 2e89509e..235fdb36 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.order_pane.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.order_pane.inc @@ -67,6 +67,7 @@ function uc_order_pane_ship_to($op, $order, &$form = NULL, &$form_state = NULL) return $output . drupal_render($form['ship_to']); case 'edit-process': + $changes = array(); foreach ($form_state['values'] as $key => $value) { if (substr($key, 0, 9) == 'delivery_') { if (uc_address_field_enabled(substr($key, 9))) { @@ -111,6 +112,7 @@ function uc_order_pane_bill_to($op, $order, &$form = NULL, &$form_state = NULL) return $output . drupal_render($form['bill_to']); case 'edit-process': + $changes = array(); foreach ($form_state['values'] as $key => $value) { if (substr($key, 0, 8) == 'billing_') { if (uc_address_field_enabled(substr($key, 8))) { @@ -169,6 +171,7 @@ function uc_order_pane_customer($op, $order, &$form = NULL, &$form_state = NULL) return $output; case 'edit-process': + $changes = array(); $changes['uid'] = $form_state['values']['uid']; $changes['primary_email'] = $form_state['values']['primary_email']; return $changes; @@ -219,6 +222,7 @@ function uc_order_pane_products($op, $order, &$form = NULL, &$form_state = NULL) case 'select': $controls = uc_order_product_select_form($form['product_controls'], $form_state, $order); break; + case 'add_product': $controls = uc_order_add_product_form($form['product_controls'], $form_state, $order, $form_state['node']); break; @@ -348,7 +352,7 @@ function uc_order_add_product_form($form, &$form_state, $order, $node) { '#type' => 'submit', '#value' => t('Add to order'), '#submit' => array('uc_order_edit_products_add'), - '#ajax' => array( + '#ajax' => array( 'callback' => 'uc_order_pane_products_ajax_callback', 'wrapper' => 'product-controls', ), @@ -357,7 +361,7 @@ function uc_order_add_product_form($form, &$form_state, $order, $node) { '#type' => 'submit', '#value' => t('Cancel'), '#submit' => array('uc_order_pane_products_select'), - '#ajax' => array( + '#ajax' => array( 'callback' => 'uc_order_pane_products_ajax_callback', 'wrapper' => 'product-controls', ), @@ -382,7 +386,7 @@ function uc_order_add_product_form($form, &$form_state, $order, $node) { function uc_order_edit_products_form($form, &$form_state, $products) { if (($product_count = count($products)) > 0) { $form['products'] = tapir_get_table('uc_op_products_edit_table'); - for ($i=0, $product = reset($products); $i < $product_count; $i++, $product = next($products)) { + for ($i = 0, $product = reset($products); $i < $product_count; $i++, $product = next($products)) { $form['products'][$i]['remove'] = array( '#type' => 'image_button', '#title' => t('Remove this product.'), @@ -540,6 +544,7 @@ function uc_order_edit_products_add_blank($form, &$form_state) { $product = new stdClass(); $product->qty = 1; $product->order_id = $order->order_id; + $product->data = NULL; uc_order_product_save($order->order_id, $product); $order->products[] = $product; @@ -637,7 +642,7 @@ function uc_order_pane_line_items($op, $order, &$form = NULL, &$form_state = NUL $line_items[] = array( 'title' => $line['title'], 'amount' => $line['amount'], - 'weight' => $item['weight'] + 'weight' => $item['weight'], ); } } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.rules.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.rules.inc index f282c380..65cbe072 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.rules.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/uc_order.rules.inc @@ -2,8 +2,7 @@ /** * @file - * This file contains the Rules hooks and functions necessary to make the order - * related entity, conditions, events, and actions work. + * Hooks and functions for uc_order Rules integration. */ /** @@ -467,14 +466,14 @@ function uc_order_condition_billing_country($order, $countries) { * @param array $product_classes * An array of strings containing the product classes (node content * types) to check against. - * @param boolean $required + * @param bool $required * TRUE to require all product classes be present in the order. FALSE * to require at least one be present. - * @param boolean $forbidden + * @param bool $forbidden * TRUE to require that only the listed product classes be present. FALSE * to allow products with other classes. * - * @return boolean + * @return bool * Whether the order meets the specified conditions. */ function uc_order_condition_has_product_class($order, $product_classes, $required, $forbidden) { @@ -543,11 +542,11 @@ function uc_order_condition_has_products($order, $products, $required, $forbidde $required_check = $required_products == $products; } else { - $required_check = (bool)count($required_products); + $required_check = (bool) count($required_products); } if ($forbidden) { $forbidden_products = array_diff($order_products, $products); - $forbidden_check = (bool)count($forbidden_products); + $forbidden_check = (bool) count($forbidden_products); } else { $forbidden_check = FALSE; @@ -681,6 +680,8 @@ function uc_order_action_update_status($order, $status) { } /** + * Order status update context options. + * * @see uc_order_action_update_status() */ function uc_order_action_update_status_options() { @@ -709,6 +710,8 @@ function uc_order_action_add_comment($order, $comment, $comment_type) { } /** + * Order comment types context options. + * * @see uc_order_action_add_comment() */ function uc_order_action_order_comment_types() { @@ -736,7 +739,7 @@ function uc_order_action_email($order, $from, $addresses, $subject, $message, $f 'format' => $format, ); - // Token replacements for the subject and body + // Token replacements for the subject and body. $settings['replacements'] = array( 'uc_order' => $order, ); @@ -753,7 +756,7 @@ function uc_order_action_email($order, $from, $addresses, $subject, $message, $f $recipients = array(); foreach (explode("\n", $addresses) as $address) { $address = trim($address); - // Remove blank lines + // Remove blank lines. if (!empty($address)) { $recipients[] = $address; } @@ -796,7 +799,7 @@ function uc_order_action_email_invoice($order, $from, $addresses, $subject, $tem 'template' => $template, 'view' => $view, ); - // Token replacements for the from, subject and body + // Token replacements for the from, subject and body. $settings['replacements'] = array( 'uc_order' => $order, ); @@ -813,7 +816,7 @@ function uc_order_action_email_invoice($order, $from, $addresses, $subject, $tem $recipients = array(); foreach (explode("\n", $addresses) as $address) { $address = trim($address); - // Remove blank lines + // Remove blank lines. if (!empty($address)) { $recipients[] = $address; } @@ -831,6 +834,8 @@ function uc_order_action_email_invoice($order, $from, $addresses, $subject, $tem } /** + * Email invoice context options. + * * @see uc_order_action_email_invoice() */ function uc_order_action_email_invoice_view_options() { diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_field_order_fullname.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_field_order_fullname.inc index 1d8a30d7..cf721aa5 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_field_order_fullname.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_field_order_fullname.inc @@ -25,7 +25,7 @@ class uc_order_handler_field_order_fullname extends views_handler_field { function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); - $form['format'] = array( + $form['format'] = array( '#title' => t('Format'), '#type' => 'select', '#options' => array( @@ -55,8 +55,10 @@ class uc_order_handler_field_order_fullname extends views_handler_field { switch ($this->options['format']) { case 'last_first': return "$last $first"; + case 'last_c_first': return "$last, $first"; + case 'first_last': return "$first $last"; } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_field_payment_method.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_field_payment_method.inc index 83d87249..bb7599e0 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_field_payment_method.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_field_payment_method.inc @@ -16,4 +16,5 @@ class uc_order_handler_field_payment_method extends views_handler_field { function render($values) { return _uc_payment_method_data($values->{$this->field_alias}, 'name'); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_filter_order_status.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_filter_order_status.inc index f2b82abe..48d226e4 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_filter_order_status.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_filter_order_status.inc @@ -35,4 +35,5 @@ class uc_order_handler_filter_order_status extends views_handler_filter_in_opera parent::query(); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_filter_total.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_filter_total.inc index 9513aa79..e935a0a6 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_filter_total.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_filter_total.inc @@ -16,6 +16,7 @@ * in the query with an alias like "table_field". */ class uc_order_handler_filter_total extends views_handler_filter_group_by_numeric { + /** * Overrides views_handler_filter_group_by_numeric::query(). */ @@ -28,4 +29,5 @@ class uc_order_handler_filter_total extends views_handler_filter_group_by_numeri $this->{$info[$this->operator]['method']}($field); } } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_sort_total.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_sort_total.inc index 554e542d..4ac81876 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_sort_total.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_handler_sort_total.inc @@ -13,6 +13,7 @@ * in the query with an alias like "table_field". */ class uc_order_handler_sort_total extends views_handler_sort { + /** * Overrides views_handler_sort::query(). */ @@ -21,4 +22,5 @@ class uc_order_handler_sort_total extends views_handler_sort { // Add the field. $this->query->add_orderby(NULL, NULL, $this->options['order'], $this->table . '_' . $this->field); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_plugin_argument_validate_user_perm.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_plugin_argument_validate_user_perm.inc index 7967d699..685f7425 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_plugin_argument_validate_user_perm.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_order/views/uc_order_plugin_argument_validate_user_perm.inc @@ -8,6 +8,7 @@ * argument's title to the username. */ class uc_order_plugin_argument_validate_user_perm extends views_plugin_argument_validate_user { + function option_definition() { $options = parent::option_definition(); @@ -48,7 +49,7 @@ class uc_order_plugin_argument_validate_user_perm extends views_plugin_argument_ $type = $this->options['type']; // is_numeric() can return false positives, so we ensure it's an integer. // However, is_integer() will always fail, since $argument is a string. - if (is_numeric($argument) && $argument == (int)$argument) { + if (is_numeric($argument) && $argument == (int) $argument) { if ($type == 'uid' || $type == 'either') { if ($argument == $GLOBALS['user']->uid) { // If you assign an object to a variable in PHP, the variable @@ -94,4 +95,5 @@ class uc_order_plugin_argument_validate_user_perm extends views_plugin_argument_ $this->argument->validated_title = isset($account->name) ? check_plain($account->name) : check_plain(variable_get('anonymous', t('Anonymous'))); return TRUE; } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/tests/uc_product.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/tests/uc_product.test index ce692584..fd06be26 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/tests/uc_product.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/tests/uc_product.test @@ -182,4 +182,5 @@ class UbercartProductTestCase extends UbercartTestHelper { $this->drupalPost('node/' . $this->product->nid, array('qty' => '1'), 'Add to cart'); $this->assertText('Your item(s) have been updated.'); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.api.php b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.api.php index 67f9bfbd..f41a1778 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.api.php +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.api.php @@ -49,7 +49,7 @@ function hook_uc_product_alter(&$node) { * * @param $type * The node type of the product class. - * @param $op + * @param string $op * The action being performed on the product class: * - insert: A new node type is created, or an existing node type is being * converted into a product type. @@ -102,7 +102,7 @@ function hook_uc_product_default_classes() { * Product. Usually one of the values of the array returned by * uc_cart_get_contents(). * - * @return + * @return array * A structured array that can be fed into drupal_render(). */ function hook_uc_product_description($product) { @@ -120,7 +120,7 @@ function hook_uc_product_description($product) { $desc =& $description['attributes']; // Cart version of the product has numeric attribute => option values so we - // need to retrieve the right ones + // need to retrieve the right ones. $weight = 0; if (empty($product->order_id)) { foreach (_uc_cart_product_get_options($product) as $option) { @@ -135,7 +135,7 @@ function hook_uc_product_description($product) { } } else { - foreach ((array)$product->data['attributes'] as $attribute => $option) { + foreach ((array) $product->data['attributes'] as $attribute => $option) { $desc[] = array( '#attribute_name' => $attribute, '#options' => $option, @@ -183,7 +183,7 @@ function hook_uc_product_models($nid) { * Products are nodes with prices, SKUs, and everything else Ubercart expects * them to have. * - * @return + * @return array * Array of node type ids. */ function hook_uc_product_types() { diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.info index 8f6147bc..4e6792db 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.info @@ -20,9 +20,8 @@ files[] = views/uc_product_handler_filter_product.inc configure = admin/store/settings/products stylesheets[all][] = uc_product.css -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.module index e0fd1a01..c0e0b1bd 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.module @@ -8,7 +8,6 @@ * classes for more specification. */ - /** * Implements hook_menu(). */ @@ -1136,7 +1135,7 @@ function uc_product_uc_product_class($pcid, $op) { $node->shippable = 1; uc_product_insert($node); } - break; + break; } } @@ -1188,7 +1187,7 @@ function uc_catalog_buy_it_now_form_validate($form, &$form_state) { * @see uc_catalog_buy_it_now_form_validate() */ function uc_catalog_buy_it_now_form_submit($form, &$form_state) { - $form_state['redirect'] = uc_cart_add_item($form_state['values']['nid'], 1, module_invoke_all('uc_add_to_cart_data', $form_state['values']), NULL, variable_get('uc_cart_add_item_msg', TRUE)); + $form_state['redirect'] = uc_cart_add_item($form_state['values']['nid'], 1, module_invoke_all('uc_add_to_cart_data', $form_state['values']), NULL, variable_get('uc_cart_add_item_msg', TRUE)); } /** @@ -1254,7 +1253,7 @@ function uc_product_add_to_cart_form_validate($form, &$form_state) { * @see uc_product_add_to_cart_form() */ function uc_product_add_to_cart_form_submit($form, &$form_state) { - $form_state['redirect'] = uc_cart_add_item($form_state['values']['nid'], $form_state['values']['qty'], module_invoke_all('uc_add_to_cart_data', $form_state['values']), NULL, variable_get('uc_cart_add_item_msg', TRUE)); + $form_state['redirect'] = uc_cart_add_item($form_state['values']['nid'], $form_state['values']['qty'], module_invoke_all('uc_add_to_cart_data', $form_state['values']), NULL, variable_get('uc_cart_add_item_msg', TRUE)); } /** @@ -1830,7 +1829,6 @@ function uc_product_views_api() { ); } - /** * Implements hook_features_api(). */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.rules.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.rules.inc index c3d0c2e2..d9d5afab 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.rules.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.rules.inc @@ -42,7 +42,7 @@ function uc_product_rules_condition_info() { } /** - * Condition: Check for product content types + * Condition: Check for product content types. */ function uc_product_rules_condition_node_is_product($node) { return in_array($node->type, uc_product_types()); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.theme.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.theme.inc index 813da407..cabab07e 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.theme.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/uc_product.theme.inc @@ -1,4 +1,5 @@ . * - * @param $variables + * @param array $variables * An associative array containing: * - form: A render element representing the add-to-cart form. * @@ -53,7 +54,7 @@ function theme_uc_product_add_to_cart($variables) { /** * Formats a product's price. * - * @param $variables + * @param array $variables * An associative array containing: * - element: An associative array render element containing: * - #value: Price to be formatted. @@ -93,13 +94,14 @@ function theme_uc_product_price($variables) { /** * Formats a product's weight. * - * @param $variables + * @param array $variables * An associative array containing: * - amount: A numerical weight value. * - units: String abbreviation representing the units of measure. * - attributes: (optional) Array of attributes to apply to enclosing DIV. * * @see uc_weight_format() + * * @ingroup themeable */ function theme_uc_product_weight($variables) { @@ -123,7 +125,7 @@ function theme_uc_product_weight($variables) { /** * Formats a product's length, width, and height. * - * @param $variables + * @param array $variables * An associative array containing: * - length: A numerical length value. * - width: A numerical width value. @@ -132,6 +134,7 @@ function theme_uc_product_weight($variables) { * - attributes: (optional) Array of attributes to apply to enclosing DIV. * * @see uc_length_format() + * * @ingroup themeable */ function theme_uc_product_dimensions($variables) { @@ -147,7 +150,7 @@ function theme_uc_product_dimensions($variables) { if ($length || $width || $height) { $output = '
    '; $output .= '' . t('Dimensions') . ': '; - $output .= '' ; + $output .= ''; $output .= uc_length_format($length, $units) . ' × '; $output .= uc_length_format($width, $units) . ' × '; $output .= uc_length_format($height, $units) . ''; @@ -160,13 +163,14 @@ function theme_uc_product_dimensions($variables) { /** * Formats a product's images. * - * @param $variables + * @param array $variables * - images: An array of image render elements, each containing: * - uri: URI of image. * - alt: Alternate text to display for image. * - title: Title for image. * * @see theme_image_style() + * * @ingroup themeable */ function theme_uc_product_image($variables) { diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_addtocart.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_addtocart.inc index ceb456ad..9d88014c 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_addtocart.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_addtocart.inc @@ -32,4 +32,5 @@ class uc_product_handler_field_addtocart extends views_handler_field { } } } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_buyitnow.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_buyitnow.inc index de26cc5e..22dd3c73 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_buyitnow.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_buyitnow.inc @@ -28,4 +28,5 @@ class uc_product_handler_field_buyitnow extends views_handler_field { return drupal_render($form); } } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_display_price.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_display_price.inc index 558a94f2..5b52a4f9 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_display_price.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_display_price.inc @@ -38,4 +38,5 @@ class uc_product_handler_field_display_price extends uc_product_handler_field_pr $params = $this->options['group_type'] != 'group' ? array('function' => $this->options['group_type']) : array(); $this->query->add_orderby(NULL, NULL, $order, 'sell_price', $params); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_length.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_length.inc index 4682d4af..8ccea6e7 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_length.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_length.inc @@ -16,4 +16,5 @@ class uc_product_handler_field_length extends views_handler_field_numeric { function render($values) { return uc_length_format($values->{$this->field_alias}, $values->{$this->aliases['length_units']}); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_price.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_price.inc index f09b521f..165493c0 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_price.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_price.inc @@ -73,4 +73,5 @@ class uc_product_handler_field_price extends views_handler_field_numeric { return theme('uc_price', array('price' => $value)); } } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_weight.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_weight.inc index 9335eb60..3ed28cd1 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_weight.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_field_weight.inc @@ -67,4 +67,5 @@ class uc_product_handler_field_weight extends views_handler_field_numeric { return uc_weight_format($values->{$this->field_alias}, $values->{$this->aliases['weight_units']}); } } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_filter_product.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_filter_product.inc index 2c641226..d065d37c 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_filter_product.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product/views/uc_product_handler_filter_product.inc @@ -18,4 +18,5 @@ class uc_product_handler_filter_product extends views_handler_filter_boolean_ope $this->query->add_field('node', 'type'); $this->query->add_where($this->options['group'], 'node.type', $types, empty($this->value) ? 'NOT IN' : 'IN'); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/tests/uc_product_kit.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/tests/uc_product_kit.test index 49c6536e..7b5e21a9 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/tests/uc_product_kit.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/tests/uc_product_kit.test @@ -2,9 +2,12 @@ /** * @file - * Ubercart product kit tests + * Ubercart product kit tests. */ +/** + * Tests product kit functionality. + */ class UbercartProductKitTestCase extends UbercartTestHelper { public static function getInfo() { @@ -22,6 +25,9 @@ class UbercartProductKitTestCase extends UbercartTestHelper { parent::setUp(array('uc_product_kit'), array('create product_kit content', 'edit any product_kit content')); } + /** + * Tests creating product kits through the node form. + */ public function testProductKitNodeForm() { $this->drupalLogin($this->adminUser); @@ -63,6 +69,9 @@ class UbercartProductKitTestCase extends UbercartTestHelper { $this->assertFieldByName('qty', $edit['default_qty']); } + /** + * Tests product kit discounting. + */ public function testProductKitDiscounts() { $this->drupalLogin($this->adminUser); @@ -133,6 +142,9 @@ class UbercartProductKitTestCase extends UbercartTestHelper { $this->assertFieldByName('items[' . $products[2]->nid . '][discount]', $products[2]->sell_price); } + /** + * Tests product kit mutability. + */ public function testProductKitMutability() { $this->drupalLogin($this->adminUser); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/uc_product_kit.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/uc_product_kit.info index 556d01c9..ecc1cef7 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/uc_product_kit.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/uc_product_kit.info @@ -10,9 +10,8 @@ files[] = tests/uc_product_kit.test files[] = views/uc_product_kit_handler_filter_product_kit.inc files[] = views/uc_product_kit_handler_filter_product_kit_item.inc -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/uc_product_kit.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/uc_product_kit.module index 76f9e21f..bd972f84 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/uc_product_kit.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/uc_product_kit.module @@ -11,7 +11,6 @@ define('UC_PRODUCT_KIT_UNMUTABLE_NO_LIST', -1); define('UC_PRODUCT_KIT_UNMUTABLE_WITH_LIST', 0); define('UC_PRODUCT_KIT_MUTABLE', 1); - /** * Implements hook_form_FORM_ID_alter() for uc_product_settings_form(). */ @@ -38,7 +37,7 @@ function uc_product_kit_form_uc_product_settings_form_alter(&$form, &$form_state * Implements hook_form_FORM_ID_alter() for node_delete_confirm(). */ function uc_product_kit_form_node_delete_confirm_alter(&$form, &$form_state) { - if (uc_product_is_product((integer)$form['nid']['#value'])) { + if (uc_product_is_product((integer) $form['nid']['#value'])) { $kits = db_query("SELECT COUNT(k.nid) FROM {node} n JOIN {uc_product_kits} k ON n.vid = k.vid WHERE k.vid IN (SELECT DISTINCT vid FROM {uc_product_kits} WHERE product_id = :nid) GROUP BY k.nid HAVING COUNT(product_id) = 1", array(':nid' => $form['nid']['#value']))->fetchField(); if ($kits) { @@ -222,7 +221,7 @@ function uc_product_kit_update(&$node) { else { $product = $nid; $nid = $product->nid; - $node->items[$nid] = (array)$product; + $node->items[$nid] = (array) $product; } $base_price += $product->sell_price * $node->items[$nid]['qty']; } @@ -398,7 +397,7 @@ function uc_product_kit_module_implements_alter(&$implementations, $hook) { if ($hook == 'uc_product_alter') { $group = $implementations['uc_product_kit']; unset($implementations['uc_product_kit']); - $implementations = array('uc_product_kit' => $group) + $implementations; + $implementations = array('uc_product_kit' => $group) + $implementations; } } @@ -495,7 +494,7 @@ function uc_product_kit_form(&$node, $form_state) { '#required' => TRUE, '#weight' => -5, '#default_value' => $node->title, - '#description' => t('Name of the product kit') + '#description' => t('Name of the product kit'), ); // Create an array of products on the site for use in the product selector. @@ -754,6 +753,7 @@ function uc_product_kit_view($node, $view_mode) { * * @see uc_product_kit_add_to_cart_form_validate() * @see uc_product_kit_add_to_cart_form_submit() + * * @ingroup forms */ function uc_product_kit_add_to_cart_form($form, &$form_state, $node) { @@ -830,13 +830,14 @@ function uc_product_kit_add_to_cart_form_submit($form, &$form_state) { * * @see uc_product_kit_buy_it_now_form_validate() * @see uc_product_kit_buy_it_now_form_submit() + * * @ingroup forms */ function uc_product_kit_buy_it_now_form($form, &$form_state, $node) { $form['nid'] = array( '#type' => 'hidden', '#value' => $node->nid, - ); + ); if ($node->type == 'product_kit') { $form['products'] = array('#tree' => TRUE); foreach ($node->products as $i => $product) { @@ -1142,7 +1143,9 @@ function uc_product_kit_uc_cart_display($item) { * Handles individual products or entire kits. */ function uc_product_kit_uc_update_cart_item($nid, $data = array(), $qty, $cid = NULL) { - if (!$nid) return NULL; + if (!$nid) { + return NULL; + } $cid = !(is_null($cid) || empty($cid)) ? $cid : uc_cart_get_id(); if (isset($data['kit_id'])) { diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/views/uc_product_kit_handler_filter_product_kit.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/views/uc_product_kit_handler_filter_product_kit.inc index 1e739fa8..f81a8894 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/views/uc_product_kit_handler_filter_product_kit.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/views/uc_product_kit_handler_filter_product_kit.inc @@ -1,4 +1,5 @@ query->add_field('node', 'type'); $this->query->add_where($this->options['group'], "node.type " . (empty($this->value) ? "NOT " : "") . "IN ('product_kit')"); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/views/uc_product_kit_handler_filter_product_kit_item.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/views/uc_product_kit_handler_filter_product_kit_item.inc index 28b87182..2e352137 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/views/uc_product_kit_handler_filter_product_kit_item.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_product_kit/views/uc_product_kit_handler_filter_product_kit_item.inc @@ -1,4 +1,5 @@ query->add_field('node', 'nid'); $this->query->add_where($this->options['group'], "node.nid " . (empty($this->value) ? "NOT " : "") . "IN (SELECT product_id FROM {uc_product_kits})"); } -} +} diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_reports/uc_reports.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_reports/uc_reports.admin.inc index 6a60c527..f129237a 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_reports/uc_reports.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_reports/uc_reports.admin.inc @@ -475,14 +475,15 @@ function uc_reports_products_custom() { '#markup' => l(t('Export to CSV file.'), 'admin/store/reports/getcsv/' . $csv_data['report'] . '/' . $csv_data['user']), '#suffix' => '   ', ); + $filters = str_replace('admin/store/reports/products/custom', '', current_path()); if (isset($_GET['nopage'])) { $build['links']['toggle_pager'] = array( - '#markup' => l(t('Show paged records'), 'admin/store/reports/products/custom'), + '#markup' => l(t('Show paged records'), 'admin/store/reports/products/custom' . $filters), ); } else { $build['links']['toggle_pager'] = array( - '#markup' => l(t('Show all records'), 'admin/store/reports/products/custom', array('query' => array('nopage' => '1'))), + '#markup' => l(t('Show all records'), 'admin/store/reports/products/custom' . $filters, array('query' => array('nopage' => '1'))), ); } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_reports/uc_reports.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_reports/uc_reports.info index 39139c56..ba0b477d 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_reports/uc_reports.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_reports/uc_reports.info @@ -7,9 +7,8 @@ core = 7.x configure = admin/store/settings/store -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_reports/uc_reports.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_reports/uc_reports.module index 1cb207f6..79ecd891 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_reports/uc_reports.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_reports/uc_reports.module @@ -15,12 +15,11 @@ */ define('UC_REPORTS_MAX_RECORDS', PHP_INT_MAX); - /** * Implements hook_help(). */ function uc_reports_help($path, $arg) { - $output = ''; + $output = ''; if (strncmp($path, 'admin/store/reports/', 20) === 0) { $include_statuses = $include_offset = FALSE; @@ -50,12 +49,15 @@ function uc_reports_help($path, $arg) { case 'admin/store/reports/customers': $output .= t("The following are total orders, products, sales, and average order totals for each store customer. Clicking on the header links will toggle a descending or ascending order for that column. Clicking on a customer's name will take you to a detailed list of orders that customer has made. Clicking on a customers username will take you to their account page."); break; + case 'admin/store/reports/products': $output .= t('The table lists each product listed in the store, its amount sold, how many times it has been viewed, revenue it has produced, and gross profit it has generated. If you do not see the number of views you must enable the Statistics module on the module administration page.', array('!url' => url('admin/modules'))); break; + case 'admin/store/reports/sales': $output .= t('These are the sales for the last two days, average sales for the month, and the projected sales for the rest of the month. Further down the list you will see other sales statistics.'); break; + case 'admin/store/reports/sales/custom': $output .= t('Expand the fieldset below to customize the date range of this report, the statuses of orders displayed, and product display options.'); break; @@ -170,7 +172,15 @@ function uc_reports_menu() { function uc_reports_theme() { return array( 'uc_reports_product_table' => array( - 'variables' => array('header' => NULL, 'rows' => NULL, 'attributes' => array(), 'caption' => NULL, 'colgroups' => array(), 'sticky' => TRUE, 'empty' => ''), + 'variables' => array( + 'header' => NULL, + 'rows' => NULL, + 'attributes' => array(), + 'caption' => NULL, + 'colgroups' => array(), + 'sticky' => TRUE, + 'empty' => '', + ), 'file' => 'uc_reports.admin.inc', ), ); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/tests/uc_roles.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/tests/uc_roles.test index f79ad950..89f8dba3 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/tests/uc_roles.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/tests/uc_roles.test @@ -23,12 +23,12 @@ class UbercartRolesTestCase extends UbercartTestHelper { */ protected function setUp($modules = array(), $permissions = array()) { $modules = array('uc_payment', 'uc_payment_pack', 'uc_roles'); - // Needed to see/modify roles on the /user/%/edit page + // Needed to see/modify roles on the /user/%/edit page. $permissions = array('administer permissions', 'administer users', 'view all role expirations'); parent::setUp($modules, $permissions); } - function testRolePurchaseCheckout() { + public function testRolePurchaseCheckout() { // Add role assignment to the test product. $rid = $this->drupalCreateRole(array('access content')); $this->drupalLogin($this->adminUser); @@ -61,7 +61,7 @@ class UbercartRolesTestCase extends UbercartTestHelper { $this->cronRun(); } - function testRoleAdminDelete() { + public function testRoleAdminDelete() { // Add role assignment to the test product. $rid = $this->drupalCreateRole(array('access content')); $this->drupalLogin($this->adminUser); @@ -104,4 +104,5 @@ class UbercartRolesTestCase extends UbercartTestHelper { $this->assertText('There are no pending expirations for roles this user.', 'User has no role expirations.'); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.info index aede25e2..0d23935d 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.info @@ -11,9 +11,8 @@ files[] = tests/uc_roles.test ; Views handlers files[] = views/uc_roles_handler_field_rid.inc -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.install b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.install index 1a73612d..bed511ef 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.install +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.install @@ -62,7 +62,7 @@ function uc_roles_schema() { 'default' => 0, ), - // End of expiration period + // End of expiration period. 'end_override' => array( 'description' => 'Override the default end time? 1 => Yes. 0 => No.', 'type' => 'int', diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.module index b85a3e72..38b28a6c 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.module @@ -10,7 +10,6 @@ * expire/need to be renewed/etc. */ - /** * Implements hook_help(). */ @@ -268,7 +267,7 @@ function uc_roles_user_validate($form, &$form_state) { // Validate adjusted expirations. if (isset($edit['table'])) { - foreach ((array)$edit['table'] as $rid => $value) { + foreach ((array) $edit['table'] as $rid => $value) { // We don't validate if nothing was actually selected, the role, or the // expiration is removed. if ($value['qty'] == 0 || $value['remove'] == 1 || !$edit['roles'][$rid]) { @@ -315,7 +314,7 @@ function uc_roles_user_presave(&$edit, $account, $category) { // Check if any temporary role actions were taken. if (isset($edit['table'])) { - foreach ((array)$edit['table'] as $rid => $value) { + foreach ((array) $edit['table'] as $rid => $value) { // Remove this expiration. if ($value['remove']) { uc_roles_delete($account, $rid); @@ -396,7 +395,7 @@ function uc_roles_user_view($account, $view_mode) { function uc_roles_uc_order_product_can_ship($item) { $roles = db_query("SELECT * FROM {uc_roles_products} WHERE nid = :nid", array(':nid' => $item->nid)); foreach ($roles as $role) { - // If the model is empty, keep looking. (Everyone needs a role model...) + // If the model is empty, keep looking. (Everyone needs a role model...). if (empty($role->model)) { continue; } @@ -472,6 +471,7 @@ function uc_roles_uc_message() { * * @see uc_roles_feature_form_validate() * @see uc_roles_feature_form_submit() + * * @ingroup forms */ function uc_roles_feature_form($form, &$form_state, $node, $feature) { @@ -612,7 +612,7 @@ function uc_roles_feature_form($form, &$form_state, $node, $feature) { 'day' => t('day(s)'), 'week' => t('week(s)'), 'month' => t('month(s)'), - 'year' => t('year(s)') + 'year' => t('year(s)'), ), '#default_value' => $default_granularity, '#description' => t('From the time the role was purchased.'), @@ -718,11 +718,11 @@ function uc_roles_feature_form_submit($form, &$form_state) { // We should be setting NULL, but drupal_write_record() ... 'end_override' => $form_state['values']['end_override'], - 'end_time' => $form_state['values']['expiration' ] === 'abs' ? $form_state['values']['uc_roles_expire_absolute'] : NULL, + 'end_time' => $form_state['values']['expiration'] === 'abs' ? $form_state['values']['uc_roles_expire_absolute'] : NULL, ); $description = empty($product_role['model']) ? t('SKU: Any
    ') : t('SKU: !sku
    ', array('!sku' => $product_role['model'])); - $description .= t('Role: @role_name
    ', array('@role_name' => _uc_roles_get_name($product_role['rid']))); + $description .= t('Role: @role_name
    ', array('@role_name' => _uc_roles_get_name($product_role['rid']))); if ($product_role['end_override']) { if ($product_role['end_time']) { @@ -733,18 +733,23 @@ function uc_roles_feature_form_submit($form, &$form_state) { case 'never': $description .= t('Expiration: never
    '); break; + case 'day': $description .= t('Expiration: !qty day(s)
    ', array('!qty' => $product_role['duration'])); break; + case 'week': $description .= t('Expiration: !qty week(s)
    ', array('!qty' => $product_role['duration'])); break; + case 'month': $description .= t('Expiration: !qty month(s)
    ', array('!qty' => $product_role['duration'])); break; + case 'year': $description .= t('Expiration: !qty year(s)
    ', array('!qty' => $product_role['duration'])); break; + default: break; } @@ -765,7 +770,8 @@ function uc_roles_feature_form_submit($form, &$form_state) { $form_state['redirect'] = uc_product_feature_save($data); - $product_role['pfid'] = $data['pfid']; + // Updating the 'pfid' on $product_role and on $form_state for future use. + $form_state['values']['pfid'] = $product_role['pfid'] = $data['pfid']; // Insert or update uc_file_product table. uc_roles_product_write_record($product_role); @@ -844,7 +850,7 @@ function uc_roles_feature_settings($form, &$form_state) { 'day' => t('day(s)'), 'week' => t('week(s)'), 'month' => t('month(s)'), - 'year' => t('year(s)') + 'year' => t('year(s)'), ), '#description' => t('From the time the role was purchased.'), '#prefix' => '
    ', @@ -894,7 +900,7 @@ function uc_roles_feature_settings($form, &$form_state) { 'day' => t('day(s)'), 'week' => t('week(s)'), 'month' => t('month(s)'), - 'year' => t('year(s)') + 'year' => t('year(s)'), ), '#description' => t('The amount of time before a role expiration takes place that a customer is notified of its expiration.'), '#prefix' => '
    ', @@ -912,10 +918,10 @@ function uc_roles_feature_settings($form, &$form_state) { /** * Gets role name. * - * @param $rid + * @param int $rid * The Drupal role id number. * - * @return + * @return string|false * A string containing the name of the role, returns FALSE if rid is invalid. */ function _uc_roles_get_name($rid) { @@ -926,10 +932,10 @@ function _uc_roles_get_name($rid) { /** * Gets available roles for granting on product purchase. * - * @param $exclude + * @param array $exclude * A list of role ids to exclude from the list. * - * @return + * @return array * An assoc array with key = rid and value = role name. */ function _uc_roles_get_choices($exclude = array()) { @@ -956,7 +962,7 @@ function _uc_roles_get_choices($exclude = array()) { /** * Deletes all role data associated with a given product feature. * - * @param $pfid + * @param int $pfid * An Ubercart product feature ID. */ function uc_roles_feature_delete($pfid) { @@ -977,9 +983,9 @@ function uc_roles_feature_delete($pfid) { * * @param $account * A Drupal user object. - * @param $rid + * @param int $rid * A Drupal role ID. - * @param $silent + * @param bool $silent * When set to TRUE will suppress any Drupal messages from this function. */ function uc_roles_delete($account, $rid = NULL, $silent = FALSE) { @@ -1014,7 +1020,7 @@ function uc_roles_delete($account, $rid = NULL, $silent = FALSE) { } /** - * Revokes a role on a given user + * Revokes a role on a given user. * * This function deletes a given role from a user's list of roles, as * well as removing any expiration data associated with the user/role. @@ -1022,9 +1028,9 @@ function uc_roles_delete($account, $rid = NULL, $silent = FALSE) { * * @param $account * A Drupal user object. - * @param $rid + * @param int $rid * A Drupal role ID. - * @param $silent + * @param bool $silent * When set to TRUE will suppress any Drupal messages from this function. */ function uc_roles_revoke(&$account, $rid, $silent = FALSE) { @@ -1059,7 +1065,7 @@ function uc_roles_revoke(&$account, $rid, $silent = FALSE) { } /** - * Grants a role to a given user + * Grants a role to a given user. * * This function grants a given role to a user's list of roles. If there * is a previous record of this user/role combination, it is first removed. @@ -1070,14 +1076,14 @@ function uc_roles_revoke(&$account, $rid, $silent = FALSE) { * * @param $account * A Drupal user object. - * @param $rid + * @param int $rid * A Drupal role ID. - * @param $timestamp + * @param int $timestamp * When this role will expire. * @param $save_user * Optimization to prevent unnecessary user saving when calling from * uc_roles_user_presave(). - * @param $silent + * @param bool $silent * When set to TRUE will suppress any Drupal messages from this function. */ function uc_roles_grant(&$account, $rid, $timestamp, $save_user = TRUE, $silent = FALSE) { @@ -1092,7 +1098,6 @@ function uc_roles_grant(&$account, $rid, $timestamp, $save_user = TRUE, $silent $account = user_save($account, array('roles' => $roles_list)); } - // If the role expires, keep a record. if (!is_null($timestamp)) { db_insert('uc_roles_expirations') @@ -1144,11 +1149,11 @@ function uc_roles_grant(&$account, $rid, $timestamp, $save_user = TRUE, $silent * * @param $account * A Drupal user object. - * @param $rid + * @param int $rid * A Drupal role ID. - * @param $timestamp + * @param int $timestamp * When this role will expire. - * @param $silent + * @param bool $silent * When set to TRUE will suppress any Drupal messages from this function. */ function uc_roles_renew($account, $rid, $timestamp, $silent = FALSE) { @@ -1264,7 +1269,7 @@ function _uc_roles_product_get_expiration($role_product, $quantity, $time) { * (optional) The starting date for when the role will last. Defaults to * the current time. * - * @return + * @return int|null * A UNIX timestamp representing the second that expiration takes place, * or NULL if the expiration should never occur. */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.rules.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.rules.inc index bccbab27..ffe575be 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.rules.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.rules.inc @@ -127,7 +127,7 @@ function uc_roles_rules_action_info() { ), ); - // Send an email to an order with a role expiration + // Send an email to an order with a role expiration. $actions['uc_roles_order_email'] = array( 'label' => t('Send an order email regarding roles.'), 'group' => t('Notification'), @@ -140,7 +140,7 @@ function uc_roles_rules_action_info() { ) + $email_args, ); - // Send an email to a user with a role expiration + // Send an email to a user with a role expiration. $actions['uc_roles_user_email'] = array( 'label' => t('Send a user an email regarding roles.'), 'group' => t('Notification'), @@ -242,7 +242,7 @@ function uc_roles_action_order_email($order, $role_expiration, $from, $addresses 'message' => $message, 'format' => $format, ); - // Token replacements for the subject and body + // Token replacements for the subject and body. $settings['replacements'] = array( 'uc_order' => $order, 'uc_role' => $role_expiration, @@ -253,7 +253,7 @@ function uc_roles_action_order_email($order, $role_expiration, $from, $addresses $addresses = token_replace($settings['addresses'], $settings['replacements']); foreach (explode("\n", $addresses) as $address) { $address = trim($address); - // Remove blank lines + // Remove blank lines. if (!empty($address)) { $recipients[] = $address; } @@ -284,7 +284,7 @@ function uc_roles_action_user_email($account, $role_expiration, $from, $addresse 'message' => $message, 'format' => $format, ); - // Token replacements for the subject and body + // Token replacements for the subject and body. $settings['replacements'] = array( 'user' => $account, 'uc_role' => $role_expiration, @@ -295,7 +295,7 @@ function uc_roles_action_user_email($account, $role_expiration, $from, $addresse $addresses = token_replace($settings['addresses'], $settings['replacements']); foreach (explode("\n", $addresses) as $address) { $address = trim($address); - // Remove blank lines + // Remove blank lines. if (!empty($address)) { $recipients[] = $address; } @@ -322,9 +322,9 @@ function uc_roles_action_user_email($account, $role_expiration, $from, $addresse * is notified in Drupal, as well as through the email address associated with * the order. * - * @param $order + * @param object $order * An Ubercart order object. - * @param $message + * @param bool $message * If TRUE, messages will be displayed to the user about the renewal. */ function uc_roles_action_order_renew($order, $message) { @@ -365,7 +365,7 @@ function uc_roles_action_order_renew($order, $message) { uc_roles_grant($account, $role->rid, $expiration, TRUE, !$message); } - // Get the new expiration (if applicable) + // Get the new expiration (if applicable). $new_expiration = db_query("SELECT * FROM {uc_roles_expirations} WHERE uid = :uid AND rid = :rid", array(':uid' => $account->uid, ':rid' => $role->rid))->fetchObject(); if (!$new_expiration) { $new_expiration = new stdClass(); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.rules_defaults.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.rules_defaults.inc index a08932b1..4174e85c 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.rules_defaults.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.rules_defaults.inc @@ -6,7 +6,7 @@ */ /** - * Implements hook_defualt_rules_configuration(). + * Implements hook_default_rules_configuration(). */ function uc_roles_default_rules_configuration() { $configs = array(); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.theme.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.theme.inc index 4e54b487..3cc1c20b 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.theme.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.theme.inc @@ -21,11 +21,11 @@ function theme_uc_roles_user_new($variables) { $output = drupal_render($form['expirations']); $output .= '
    '; - $output .= drupal_render($form['new_role']); - $output .= drupal_render($form['new_role_add']); - $output .= drupal_render($form['new_role_add_for']); - $output .= drupal_render($form['new_role_add_qty']); - $output .= drupal_render($form['new_role_add_granularity']); + $output .= drupal_render($form['new_role']); + $output .= drupal_render($form['new_role_add']); + $output .= drupal_render($form['new_role_add_for']); + $output .= drupal_render($form['new_role_add_qty']); + $output .= drupal_render($form['new_role_add_granularity']); $output .= '
    '; return $output; @@ -52,8 +52,8 @@ function theme_uc_roles_user_expiration($variables) { $rows = array(); // The expiration table. - foreach ((array)$form['table'] as $rid => $expiration) { - // We only want numeric rid's + foreach ((array) $form['table'] as $rid => $expiration) { + // We only want numeric rids. if (!is_numeric($rid)) { continue; } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.tokens.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.tokens.inc index 0c06404c..357a00af 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.tokens.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_roles/uc_roles.tokens.inc @@ -51,6 +51,7 @@ function uc_roles_tokens($type, $tokens, $data = array(), $options = array()) { case 'expiration': $replacements[$original] = format_date($object->expiration, 'medium'); break; + case 'name': $replacements[$original] = $sanitize ? check_plain(_uc_roles_get_name($object->rid)) : _uc_roles_get_name($object->rid); break; diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/tests/uc_stock.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/tests/uc_stock.test index 47fa7a10..0e9e5b24 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/tests/uc_stock.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/tests/uc_stock.test @@ -2,7 +2,7 @@ /** * @file - * Ubercart stock related tests + * Ubercart stock related tests. */ class UbercartStockTestCase extends UbercartTestHelper { @@ -46,7 +46,7 @@ class UbercartStockTestCase extends UbercartTestHelper { $stock = rand(1, 1000); uc_stock_set($this->product->model, $stock); $this->drupalGet('node/' . $this->product->nid . '/edit/stock'); - $this->assertFieldByName('stock[0][stock]', (string)$stock, 'Set stock level found.'); + $this->assertFieldByName('stock[0][stock]', (string) $stock, 'Set stock level found.'); } public function testStockDecrement() { @@ -92,4 +92,5 @@ class UbercartStockTestCase extends UbercartTestHelper { $this->assertTrue(strpos($mail['body'], $this->product->model) !== FALSE, 'Mail body contains SKU.'); $this->assertTrue(strpos($mail['body'], 'has reached ' . $qty) !== FALSE, 'Mail body contains quantity.'); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.admin.inc index da74ca19..2ff0c166 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.admin.inc @@ -80,7 +80,6 @@ function uc_stock_report() { $query->condition('active', 1) ->condition('title', '', '<>'); - if (arg(4) == 'threshold') { $query->where('threshold >= stock'); } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.info index ba926e5f..a974cc28 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.info @@ -12,9 +12,8 @@ files[] = views/uc_stock_handler_filter_below_threshold.inc configure = admin/store/settings/stock -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.module index df4ce7cd..c7f8ae01 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.module @@ -9,11 +9,8 @@ * When that threshold is reached admins can be optionally notified about the * current stock level. Store admins can view all stock levels in the reports * section of Ubercart. - * - * Development sponsored by the Ubercart project. http://www.ubercart.org */ - /** * Implements hook_help(). */ @@ -21,6 +18,7 @@ function uc_stock_help($path, $arg) { switch ($path) { case 'node/%/edit/stock': return '

    ' . t('To keep track of stock for a particular product SKU, make sure it is marked as active and enter a stock value. When the stock level drops below the threshold value, you can be notified based on your stock settings.') . '

    '; + case 'admin/store/reports/stock': case 'admin/store/reports/stock/threshold': return '

    ' . t('This is the list of product SKUs that are currently active. Stock levels below their threshold have highlighted rows. Toggle the checkbox below to alter which stock levels are shown.') . '

    '; @@ -92,7 +90,7 @@ function uc_stock_permission() { return array( 'administer product stock' => array( 'title' => t('Administer product stock'), - ) + ), ); } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.variable.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.variable.inc index 3692bdd4..bc997aba 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.variable.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/uc_stock.variable.inc @@ -5,7 +5,6 @@ * Variable module hook implementations. */ - /** * Implements hook_variable_group_info(). */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/views/uc_stock_handler_filter_below_threshold.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/views/uc_stock_handler_filter_below_threshold.inc index 9e75178b..82510375 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/views/uc_stock_handler_filter_below_threshold.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_stock/views/uc_stock_handler_filter_below_threshold.inc @@ -17,4 +17,5 @@ class uc_stock_handler_filter_below_threshold extends views_handler_filter_boole $this->ensure_my_table(); $this->query->add_where_expression($this->options['group'], "$this->table_alias.stock " . (empty($this->value) ? '>=' : '<') . " $this->table_alias.threshold"); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/classes/address.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/classes/address.inc index 09bb42ab..d5c651b8 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/classes/address.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/classes/address.inc @@ -43,7 +43,6 @@ class UcAddress { /** Email address. */ public $email = ''; - /** * Constructor. * diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/classes/encrypt.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/classes/encrypt.inc index 54c0dde0..88a4522f 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/classes/encrypt.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/classes/encrypt.inc @@ -30,7 +30,6 @@ class UbercartEncryption { protected $adj = 1.75; protected $mod = 3; - /** * Decrypts cyphertext. * @@ -269,4 +268,5 @@ class UbercartEncryption { return $array; } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/afghanistan_4_1.cif b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/afghanistan_4_1.cif index f3a51dc4..9e25d30b 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/afghanistan_4_1.cif +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/afghanistan_4_1.cif @@ -63,11 +63,11 @@ function afghanistan_install() { // Set address format uc_set_address_format( 4, - "!company\r\n". - "!first_name !last_name\r\n". - "!street1\r\n". - "!street2\r\n". - "!city, !zone_code !postal_code\r\n". + "!company\r\n" . + "!first_name !last_name\r\n" . + "!street1\r\n" . + "!street2\r\n" . + "!city, !zone_code !postal_code\r\n" . "!country_name_if" ); } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/aland_islands_248_1.cif b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/aland_islands_248_1.cif index 936c0d82..de6d6736 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/aland_islands_248_1.cif +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/aland_islands_248_1.cif @@ -1,5 +1,9 @@ fields(array( - 'country_id' => 100, - 'country_name' => 'Bulgaria', - 'country_iso_code_2' => 'BG', - 'country_iso_code_3' => 'BGR', - 'version' => 1, - )) - ->execute(); - - // BG has no postal zones in the Ubercart sense - - // Set address format - uc_set_address_format( - 100, - "!first_name !last_name\r\n". - "!company\r\n". - "!street1\r\n". - "!street2\r\n". - "!zone_name\r\n". - "!postal_code !city !country_name_if" - ); -} diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/bulgaria_100_2.cif b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/bulgaria_100_2.cif new file mode 100644 index 00000000..9e98a65a --- /dev/null +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/bulgaria_100_2.cif @@ -0,0 +1,118 @@ +fields(array( + 'country_id' => 100, + 'country_name' => 'Bulgaria', + 'country_iso_code_2' => 'BG', + 'country_iso_code_3' => 'BGR', + 'version' => 2, + )) + ->execute(); + + // Insert zone codes and names. + $zones = array( + array(100, 'BL', 'Blagoevgrad'), + array(100, 'BR', 'Burgas'), + array(100, 'VN', 'Varna'), + array(100, 'VT', 'Veliko Tarnovo'), + array(100, 'VD', 'Vidin'), + array(100, 'VR', 'Vratsa'), + array(100, 'GB', 'Gabrovo'), + array(100, 'DO', 'Dobrich'), + array(100, 'KZ', 'Kardzhali'), + array(100, 'KY', 'Kyustendil'), + array(100, 'LV', 'Lovech'), + array(100, 'MT', 'Montana'), + array(100, 'PZ', 'Pazardzhik'), + array(100, 'PN', 'Pernik'), + array(100, 'PV', 'Pleven'), + array(100, 'PD', 'Plovdiv'), + array(100, 'RG', 'Razgrad'), + array(100, 'RS', 'Ruse'), + array(100, 'SI', 'Silistra'), + array(100, 'SL', 'Sliven'), + array(100, 'SM', 'Smolyan'), + array(100, 'SG', 'Sofia (stolitsa)'), + array(100, 'SF', 'Sofia'), + array(100, 'SZ', 'Stara Zagora'), + array(100, 'TU', 'Targovishte'), + array(100, 'KK', 'Haskovo'), + array(100, 'SH', 'Shumen'), + array(100, 'YA', 'Yambol'), + ); + + $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name')); + foreach ($zones as $zone) { + $query->values($zone); + } + $query->execute(); + + // Set address format + uc_set_address_format( + 100, + "!first_name !last_name\r\n" . + "!company\r\n" . + "!street1\r\n" . + "!street2\r\n" . + "!zone_name\r\n" . + "!postal_code !city !country_name_if" + ); +} + +/** + * Implements hook_update() with $version being the only argument. + * Add a new case for each version update, and be sure to always include the + * latest changes in the install function. + */ +function bulgaria_update($version) { + switch ($version) { + case '2': + // Update zone codes and names. + $zones = array( + array(100, 'BL', 'Blagoevgrad'), + array(100, 'BR', 'Burgas'), + array(100, 'VN', 'Varna'), + array(100, 'VT', 'Veliko Tarnovo'), + array(100, 'VD', 'Vidin'), + array(100, 'VR', 'Vratsa'), + array(100, 'GB', 'Gabrovo'), + array(100, 'DO', 'Dobrich'), + array(100, 'KZ', 'Kardzhali'), + array(100, 'KY', 'Kyustendil'), + array(100, 'LV', 'Lovech'), + array(100, 'MT', 'Montana'), + array(100, 'PZ', 'Pazardzhik'), + array(100, 'PN', 'Pernik'), + array(100, 'PV', 'Pleven'), + array(100, 'PD', 'Plovdiv'), + array(100, 'RG', 'Razgrad'), + array(100, 'RS', 'Ruse'), + array(100, 'SI', 'Silistra'), + array(100, 'SL', 'Sliven'), + array(100, 'SM', 'Smolyan'), + array(100, 'SG', 'Sofia (stolitsa)'), + array(100, 'SF', 'Sofia'), + array(100, 'SZ', 'Stara Zagora'), + array(100, 'TU', 'Targovishte'), + array(100, 'KK', 'Haskovo'), + array(100, 'SH', 'Shumen'), + array(100, 'YA', 'Yambol'), + ); + + $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name')); + foreach ($zones as $zone) { + $query->values($zone); + } + $query->execute(); + + break; + } +} diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/burkina_faso_854_1.cif b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/burkina_faso_854_1.cif index e9cc306d..2b754273 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/burkina_faso_854_1.cif +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/burkina_faso_854_1.cif @@ -1,5 +1,9 @@ fields(array( - 'country_id' => 170, - 'country_name' => 'Colombia', - 'country_iso_code_2' => 'CO', - 'country_iso_code_3' => 'COL', - 'version' => 1, - )) - ->execute(); - - // Make the entries in the zones table. - $zones = array( - array(170, 'AMA', 'Amazonas'), - array(170, 'ANT', 'Antioquia'), - array(170, 'ARA', 'Arauca'), - array(170, 'ATL', 'Atlantico'), - array(170, 'BOL', 'Bolivar'), - array(170, 'CAL', 'Caldas'), - array(170, 'CAQ', 'Caqueta'), - array(170, 'CAS', 'Casanare'), - array(170, 'CAU', 'Cauca'), - array(170, 'CES', 'Cesar'), - array(170, 'CHO', 'Choco'), - array(170, 'COR', 'Cordoba'), - array(170, 'CUN', 'Cundinamarca'), - array(170, 'DC', 'Distrito Capital de Bogota'), - array(170, 'GUA', 'Guainia'), - array(170, 'GUV', 'Guaviare'), - array(170, 'HUI', 'Huila'), - array(170, 'LAG', 'La Guajira'), - array(170, 'MAG', 'Magdalena'), - array(170, 'MET', 'Meta'), - array(170, 'NAR', 'Narino'), - array(170, 'NSA', 'Norte de Santander'), - array(170, 'PUT', 'Putumayo'), - array(170, 'QUI', 'Quindio'), - array(170, 'RIS', 'Risaralda'), - array(170, 'SAP', 'San Andres, Providencia y Santa Catalina'), - array(170, 'SAN', 'Santander'), - array(170, 'SUC', 'Sucre'), - array(170, 'TOL', 'Tolima'), - array(170, 'VAC', 'Valle del Cauca'), - array(170, 'VAU', 'Vaupes'), - array(170, 'VID', 'Vichada'), - ); - - $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name')); - foreach ($zones as $zone) { - $query->values($zone); - } - $query->execute(); - - // Set address format - uc_set_address_format( - 170, - "!company\r\n". - "!first_name !last_name\r\n". - "!street1\r\n". - "!street2\r\n". - "!city !zone_code !postal_code\r\n". - "!country_name_if" - ); -} diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/colombia_170_2.cif b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/colombia_170_2.cif new file mode 100644 index 00000000..42a38186 --- /dev/null +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/colombia_170_2.cif @@ -0,0 +1,164 @@ +fields(array( + 'country_id' => 170, + 'country_name' => 'Colombia', + 'country_iso_code_2' => 'CO', + 'country_iso_code_3' => 'COL', + 'version' => 2, + )) + ->execute(); + + // Make the entries in the zones table. + $zones = array( + array(170, 'DC', 'Distrito Capital de Bogotá'), + array(170, 'AMA', 'Amazonas'), + array(170, 'ANT', 'Antioquia'), + array(170, 'ARA', 'Arauca'), + array(170, 'ATL', 'Atlántico'), + array(170, 'BOL', 'Bolívar'), + array(170, 'BOY', 'Boyacá'), + array(170, 'CAL', 'Caldas'), + array(170, 'CAQ', 'Caquetá'), + array(170, 'CAS', 'Casanare'), + array(170, 'CAU', 'Cauca'), + array(170, 'CES', 'Cesar'), + array(170, 'COR', 'Córdoba'), + array(170, 'CUN', 'Cundinamarca'), + array(170, 'CHO', 'Chocó'), + array(170, 'GUA', 'Guainía'), + array(170, 'GUV', 'Guaviare'), + array(170, 'HUI', 'Huila'), + array(170, 'LAG', 'La Guajira'), + array(170, 'MAG', 'Magdalena'), + array(170, 'MET', 'Meta'), + array(170, 'NAR', 'Nariño'), + array(170, 'NSA', 'Norte de Santander'), + array(170, 'PUT', 'Putumayo'), + array(170, 'QUI', 'Quindío'), + array(170, 'RIS', 'Risaralda'), + array(170, 'SAP', 'San Andrés, Providencia y Santa Catalina'), + array(170, 'SAN', 'Santander'), + array(170, 'SUC', 'Sucre'), + array(170, 'TOL', 'Tolima'), + array(170, 'VAC', 'Valle del Cauca'), + array(170, 'VAU', 'Vaupés'), + array(170, 'VID', 'Vichada'), + ); + + $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name')); + foreach ($zones as $zone) { + $query->values($zone); + } + $query->execute(); + + // Set address format. + uc_set_address_format( + 170, + "!company\r\n" . + "!first_name !last_name\r\n" . + "!street1\r\n" . + "!street2\r\n" . + "!city !zone_code !postal_code\r\n" . + "!country_name_if" + ); +} + +/** + * Implements hook_update() with $version being the only argument. + * Add a new case for each version update, and be sure to always include the + * latest changes in the install function. + */ +function colombia_update($version) { + switch ($version) { + case 2: + // Add missing zone. + $zones = array( + array(170, 'BOY', 'Boyacá'), + ); + + $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name')); + foreach ($zones as $zone) { + $query->values($zone); + } + $query->execute(); + + // Rename zones. + db_update('uc_zones') + ->fields(array('zone_name' => 'Distrito Capital de Bogotá')) + ->condition('zone_country_id', 170) + ->condition('zone_code', 'DC') + ->execute(); + + db_update('uc_zones') + ->fields(array('zone_name' => 'Atlántico')) + ->condition('zone_country_id', 170) + ->condition('zone_code', 'ATL') + ->execute(); + + db_update('uc_zones') + ->fields(array('zone_name' => 'Bolívar')) + ->condition('zone_country_id', 170) + ->condition('zone_code', 'BOL') + ->execute(); + + db_update('uc_zones') + ->fields(array('zone_name' => 'Caquetá')) + ->condition('zone_country_id', 170) + ->condition('zone_code', 'CAQ') + ->execute(); + + db_update('uc_zones') + ->fields(array('zone_name' => 'Córdoba')) + ->condition('zone_country_id', 170) + ->condition('zone_code', 'COR') + ->execute(); + + db_update('uc_zones') + ->fields(array('zone_name' => 'Chocó')) + ->condition('zone_country_id', 170) + ->condition('zone_code', 'CHO') + ->execute(); + + db_update('uc_zones') + ->fields(array('zone_name' => 'Guainía')) + ->condition('zone_country_id', 170) + ->condition('zone_code', 'GUA') + ->execute(); + + db_update('uc_zones') + ->fields(array('zone_name' => 'Nariño')) + ->condition('zone_country_id', 170) + ->condition('zone_code', 'NAR') + ->execute(); + + db_update('uc_zones') + ->fields(array('zone_name' => 'Quindío')) + ->condition('zone_country_id', 170) + ->condition('zone_code', 'QUI') + ->execute(); + + db_update('uc_zones') + ->fields(array('zone_name' => 'San Andrés, Providencia y Santa Catalina')) + ->condition('zone_country_id', 170) + ->condition('zone_code', 'SAP') + ->execute(); + + db_update('uc_zones') + ->fields(array('zone_name' => 'Vaupés')) + ->condition('zone_country_id', 170) + ->condition('zone_code', 'VAU') + ->execute(); + + break; + } + +} diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/comoros_174_1.cif b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/comoros_174_1.cif index e8a22d0b..b563f354 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/comoros_174_1.cif +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/comoros_174_1.cif @@ -1,5 +1,9 @@ fields(array( diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/czech_203_1.cif b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/czech_203_1.cif index 786de789..5d5a8c17 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/czech_203_1.cif +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/czech_203_1.cif @@ -1,5 +1,9 @@ fields(array( @@ -107,15 +111,20 @@ function russia_install() { // Set address format uc_set_address_format( 643, - "!company\r\n". - "!first_name !last_name\r\n". - "!street1\r\n". - "!street2\r\n". - "!postal_code !city\r\n". + "!company\r\n" . + "!first_name !last_name\r\n" . + "!street1\r\n" . + "!street2\r\n" . + "!postal_code !city\r\n" . "!country_name_if" ); } +/** + * Implements hook_update() with $version being the only argument. + * Add a new case for each version update, and be sure to always include the + * latest changes in the install function. + */ function russia_update($version) { switch ($version) { case 2: diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/rwanda_646_1.cif b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/rwanda_646_1.cif index 646e9b6d..b6e984fe 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/rwanda_646_1.cif +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/rwanda_646_1.cif @@ -1,5 +1,9 @@ 'Thailand', 'country_iso_code_2' => 'TH', 'country_iso_code_3' => 'THA', - 'version' => 2, + 'version' => 3, )) ->execute(); @@ -108,15 +108,20 @@ function thailand_install() { // Set address format uc_set_address_format( 764, - "!first_name !last_name\r\n". - "!company\r\n". - "!street1\r\n". - "!street2\r\n". - "!city, !zone_name !postal_code\r\n". + "!first_name !last_name\r\n" . + "!company\r\n" . + "!street1\r\n" . + "!street2\r\n" . + "!city, !zone_name !postal_code\r\n" . "!country_name" ); } +/** + * Implements hook_update() with $version being the only argument. + * Add a new case for each version update, and be sure to always include the + * latest changes in the install function. + */ function thailand_update($version) { switch ($version) { case 3: diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/timor_leste_626_1.cif b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/timor_leste_626_1.cif index 0c5f864d..2afdf37c 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/timor_leste_626_1.cif +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/countries/timor_leste_626_1.cif @@ -1,5 +1,9 @@ '; break; + case 'greater_equal': $ops = array('>', '=='); break; + case 'begins': case 'contains': case 'ends': $settings['operator'] = 'contains'; break; + case 'yes': $settings['operator'] = '=='; $settings['value'] = TRUE; break; + case 'no': $settings['operator'] = '=='; $settings['value'] = FALSE; @@ -191,10 +200,12 @@ function ca_add_conditions(&$component, $conditions) { case 'uid': $type = 'integer'; break; + case 'type': case 'title': $type = 'text'; break; + case 'status': case 'promote': case 'sticky': @@ -283,10 +294,12 @@ function ca_add_actions(&$rule, $actions) { 'error' => $settings['message_type'] == 'error', ); break; + case 'ca_action_custom_php': $name = 'php_eval'; $settings = array('code' => $settings['php']); break; + default: $name = $action['#name']; break; diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/includes/tapir.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/includes/tapir.inc index 2f74cccd..517d201d 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/includes/tapir.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/includes/tapir.inc @@ -64,7 +64,7 @@ function tapir_gather_rows($element) { * @param $form * The array of form information needing to be rendered into the table. * - * @return + * @return string * The table output rendered in HTML. * * @ingroup themeable @@ -117,7 +117,7 @@ function theme_tapir_table($variables) { // Merge the row data into a single row array along with the attributes. if (isset($data['#attributes'])) { - $row = array_merge(array('data' => $row), (array)$data['#attributes']); + $row = array_merge(array('data' => $row), (array) $data['#attributes']); } // Add the current row to the table rows array. @@ -130,7 +130,7 @@ function theme_tapir_table($variables) { 'rows' => $rows, ); if (isset($element['#attributes'])) { - $options['attributes'] = (array)$element['#attributes']; + $options['attributes'] = (array) $element['#attributes']; } if (isset($element['#title'])) { $options['caption'] = $element['#title']; diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/includes/uc_ajax_attach.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/includes/uc_ajax_attach.inc index 973721a1..84906add 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/includes/uc_ajax_attach.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/includes/uc_ajax_attach.inc @@ -1,4 +1,5 @@ $quotes_defaults, 'panes][billing][address][billing_country' => array('payment-pane' => 'payment-pane'), ); + default: return array(); } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/tests/uc_address.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/tests/uc_address.test index 2cbc110c..551f4b70 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/tests/uc_address.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/tests/uc_address.test @@ -21,7 +21,6 @@ class UbercartAddressTestCase extends UbercartTestHelper { ); } - /** * Overrides DrupalWebTestCase::setUp(). */ @@ -50,7 +49,7 @@ class UbercartAddressTestCase extends UbercartTestHelper { /** * Tests comparison of address objects. */ - function testAddressComparison() { + public function testAddressComparison() { $address1 = $this->test_address[0]; $address2 = $this->test_address[1]; diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/tests/uc_ajax.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/tests/uc_ajax.test index 208b7fc2..72467df9 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/tests/uc_ajax.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/tests/uc_ajax.test @@ -4,10 +4,12 @@ * @file * Tests for the UcAddress class. */ + /** * Tests for the Ubercart Ajax Attach. */ class UbercartAjaxTestCase extends UbercartTestHelper { + public static function getInfo() { return array( 'name' => 'Ajax functionality', @@ -37,7 +39,7 @@ class UbercartAjaxTestCase extends UbercartTestHelper { * @param $negate * TRUE to negate the condition. */ - function addPaymentZoneCondition($method, $zone, $negate = FALSE) { + protected function addPaymentZoneCondition($method, $zone, $negate = FALSE) { $not = $negate ? 'NOT ' : ''; $name = 'uc_payment_method_' . $method; $label = ucfirst($method) . ' conditions'; @@ -72,7 +74,7 @@ class UbercartAjaxTestCase extends UbercartTestHelper { //$this->drupalGet('admin/config/workflow/rules/components/manage/' . $newconfig->id); } - function testCheckoutAjax() { + public function testCheckoutAjax() { // Enable two payment methods and set a condition on one. variable_set('uc_payment_method_check_checkout', TRUE); variable_set('uc_payment_method_other_checkout', TRUE); @@ -100,4 +102,5 @@ class UbercartAjaxTestCase extends UbercartTestHelper { // Not in Kansas any more... $this->assertNoText("Other"); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/tests/uc_store.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/tests/uc_store.test index 709974bf..91031513 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/tests/uc_store.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/tests/uc_store.test @@ -19,7 +19,6 @@ class UbercartTestHelper extends DrupalWebTestCase { /** Test product. */ protected $product; - /** * Overrides DrupalWebTestCase::setUp(). * @@ -62,7 +61,7 @@ class UbercartTestHelper extends DrupalWebTestCase { /** * Creates a new product. */ - function createProduct($product = array()) { + protected function createProduct($product = array()) { // Set the default required fields. $weight_units = array('lb', 'kg', 'oz', 'g'); $length_units = array('in', 'ft', 'cm', 'mm'); @@ -92,7 +91,7 @@ class UbercartTestHelper extends DrupalWebTestCase { * * Fix this after adding a proper API call for saving a product class. */ - function createProductClass($data = array()) { + protected function createProductClass($data = array()) { $product_class = $data + array( 'pcid' => $this->randomName(8), 'name' => $this->randomName(8), @@ -111,10 +110,10 @@ class UbercartTestHelper extends DrupalWebTestCase { * @param $edit * The form-values array to which to add required fields. */ - function populateCheckoutForm($edit = array()) { + protected function populateCheckoutForm($edit = array()) { foreach (array('billing', 'delivery') as $pane) { $prefix = 'panes[' . $pane . '][' . $pane; - $key = $prefix . '_country]'; + $key = $prefix . '_country]'; $country = empty($edit[$key]) ? variable_get('uc_store_country', 840) : $edit[$key]; $zone_id = db_query_range('SELECT zone_id FROM {uc_zones} WHERE zone_country_id = :country ORDER BY rand()', 0, 1, array('country' => $country))->fetchField(); $edit += array( @@ -139,7 +138,7 @@ class UbercartTestHelper extends DrupalWebTestCase { /** * Executes the checkout process. */ - function checkout($edit = array()) { + protected function checkout($edit = array()) { $this->drupalPost('cart', array(), 'Checkout'); $this->assertText( t('Enter your billing address and information here.'), @@ -180,7 +179,7 @@ class UbercartTestHelper extends DrupalWebTestCase { * An array containing the most recently sent matching email, * or FALSE if the subject line did not match anything. */ - function findMail($pattern) { + protected function findMail($pattern) { foreach (array_reverse($this->drupalGetMails()) as $mail) { if (preg_match($pattern, $mail['subject'])) { $this->pass(t('E-mail found with subject matching %pattern.', array('%pattern' => $pattern))); @@ -207,7 +206,7 @@ class UbercartTestHelper extends DrupalWebTestCase { * TRUE to check only the plain-text contents of the 'data' keys of each 'insert' command (i.e. what would * be inserted into the page). FALSE to check the complete, json-encoded ajax response. */ - function assertAjaxHelper($ajax, $text, $message = FALSE, $not_exists = FALSE, $plain = TRUE) { + protected function assertAjaxHelper($ajax, $text, $message = FALSE, $not_exists = FALSE, $plain = TRUE) { $content = ''; if ($plain) { foreach ($ajax as $command) { @@ -237,7 +236,7 @@ class UbercartTestHelper extends DrupalWebTestCase { * @param $message * The assertion message. */ - function assertAjaxText($ajax, $text, $message = FALSE) { + protected function assertAjaxText($ajax, $text, $message = FALSE) { $this->assertAjaxHelper($ajax, $text, $message, FALSE, TRUE); } @@ -252,7 +251,7 @@ class UbercartTestHelper extends DrupalWebTestCase { * @param $message * The assertion message. */ - function assertNoAjaxText($ajax, $text, $message = FALSE) { + protected function assertNoAjaxText($ajax, $text, $message = FALSE) { $this->assertAjaxHelper($ajax, $text, $message, TRUE, TRUE); } @@ -266,7 +265,7 @@ class UbercartTestHelper extends DrupalWebTestCase { * @param $message * The assertion message. */ - function assertAjaxRaw($ajax, $text, $message = FALSE) { + protected function assertAjaxRaw($ajax, $text, $message = FALSE) { $this>assertAjaxHelper($ajax, $text, $message, FALSE, FALSE); } @@ -280,7 +279,7 @@ class UbercartTestHelper extends DrupalWebTestCase { * @param $message * The assertion message. */ - function assertNoAjaxRaw($ajax, $text, $message = FALSE) { + protected function assertNoAjaxRaw($ajax, $text, $message = FALSE) { $this>assertAjaxHelper($ajax, $text, $message, TRUE, FALSE); } @@ -314,22 +313,27 @@ class UbercartTestHelper extends DrupalWebTestCase { case 'replaceWith': $wrapperNode->parentNode->replaceChild($newNode, $wrapperNode); break; + case 'append': $wrapperNode->appendChild($newNode); break; + case 'prepend': // If no firstChild, insertBefore() falls back to // appendChild(). $wrapperNode->insertBefore($newNode, $wrapperNode->firstChild); break; + case 'before': $wrapperNode->parentNode->insertBefore($newNode, $wrapperNode); break; + case 'after': // If no nextSibling, insertBefore() falls back to // appendChild(). $wrapperNode->parentNode->insertBefore($newNode, $wrapperNode->nextSibling); break; + case 'html': foreach ($wrapperNode->childNodes as $childNode) { $wrapperNode->removeChild($childNode); @@ -345,6 +349,7 @@ class UbercartTestHelper extends DrupalWebTestCase { $this->verbose('Page content after ajax submission:
    ' . $this->content); return $commands; } + } /** @@ -363,7 +368,7 @@ class UbercartCountryTestCase extends UbercartTestHelper { /** * Test import/enable/disable/remove of Country information files. */ - function testCountries() { + public function testCountries() { $import_file = 'belgium_56_3.cif'; $country_name = 'Belgium'; $country_code = 'BEL'; @@ -434,4 +439,5 @@ class UbercartCountryTestCase extends UbercartTestHelper { t('Country does not appear in imported countries table.') ); } + } diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.admin.inc index 6bbf0ee9..027b07e0 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.admin.inc @@ -52,9 +52,16 @@ function uc_store_admin() { if ($results = module_invoke_all('uc_store_status')) { foreach ($results as $message) { switch ($message['status']) { - case 'warning': $icon = 'alert.gif'; break; - case 'error': $icon = 'error.gif'; break; - default: $icon = 'info.gif'; + case 'warning': + $icon = 'alert.gif'; + break; + + case 'error': + $icon = 'error.gif'; + break; + + default: + $icon = 'info.gif'; } $icon = theme('image', array('path' => drupal_get_path('module', 'uc_store') . '/images/' . $icon)); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.info index 89f9192b..7c95bff9 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.info @@ -16,9 +16,8 @@ files[] = tests/uc_ajax.test configure = admin/store/settings/store stylesheets[all][] = uc_store.css -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.module index 60ab42ff..7bec6321 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.module @@ -13,84 +13,147 @@ * Weight unit conversion constants, used by uc_weight_conversion(). */ -/** Converts kilograms to kilograms. */ +/** + * Converts kilograms to kilograms. + */ define('KG_TO_KG', 1); -/** Converts kilograms to grams. */ -define('KG_TO_G', 1000); -/** Converts kilograms to pounds. */ +/** + * Converts kilograms to grams. + */ +define('KG_TO_G', 1000); +/** + * Converts kilograms to pounds. + */ define('KG_TO_LB', 2.204622621849); -/** Converts kilograms to ounces. */ +/** + * Converts kilograms to ounces. + */ define('KG_TO_OZ', 35.27396194958); -/** Converts grams to grams. */ -define('G_TO_G', 1); -/** Converts grams to kilograms. */ -define('G_TO_KG', 0.001); -/** Converts grams to pounds. */ -define('G_TO_LB', 0.002204622622); -/** Converts grams to ounces. */ -define('G_TO_OZ', 0.03527396195); +/** + * Converts grams to grams. + */ +define('G_TO_G', 1); +/** + * Converts grams to kilograms. + */ +define('G_TO_KG', 0.001); +/** + * Converts grams to pounds. + */ +define('G_TO_LB', 0.002204622622); +/** + * Converts grams to ounces. + */ +define('G_TO_OZ', 0.03527396195); -/** Converts pounds to pounds. */ +/** + * Converts pounds to pounds. + */ define('LB_TO_LB', 1); -/** Converts pounds to ounces. */ +/** + * Converts pounds to ounces. + */ define('LB_TO_OZ', 16); -/** Converts pounds to kilograms. */ +/** + * Converts pounds to kilograms. + */ define('LB_TO_KG', 0.45359237); -/** Converts pounds to grams. */ -define('LB_TO_G', 453.59237); +/** + * Converts pounds to grams. + */ +define('LB_TO_G', 453.59237); -/** Converts ounces to ounces. */ +/** + * Converts ounces to ounces. + */ define('OZ_TO_OZ', 1); -/** Converts ounces to pounds. */ +/** + * Converts ounces to pounds. + */ define('OZ_TO_LB', 0.0625); -/** Converts ounces to kilograms. */ +/** + * Converts ounces to kilograms. + */ define('OZ_TO_KG', 0.028349523); -/** Converts ounces to grams. */ -define('OZ_TO_G', 28.349523125); +/** + * Converts ounces to grams. + */ +define('OZ_TO_G', 28.349523125); /** * Length unit conversion constants, used by uc_length_conversion(). */ -/** Converts inches to inches. */ +/** + * Converts inches to inches. + */ define('IN_TO_IN', 1); -/** Converts inches to feet. */ +/** + * Converts inches to feet. + */ define('IN_TO_FT', 0.083333333333); -/** Converts inches to centimeters. */ +/** + * Converts inches to centimeters. + */ define('IN_TO_CM', 2.54); -/** Converts inches to millimeters. */ +/** + * Converts inches to millimeters. + */ define('IN_TO_MM', 25.4); -/** Converts feet to feet. */ +/** + * Converts feet to feet. + */ define('FT_TO_FT', 1); -/** Converts feet to inches. */ +/** + * Converts feet to inches. + */ define('FT_TO_IN', 12); -/** Converts feet to centimeters. */ +/** + * Converts feet to centimeters. + */ define('FT_TO_CM', 30.48); -/** Converts feet to millimeters. */ +/** + * Converts feet to millimeters. + */ define('FT_TO_MM', 304.8); -/** Converts centimeters to centimeters. */ +/** + * Converts centimeters to centimeters. + */ define('CM_TO_CM', 1); -/** Converts centimeters to inches. */ +/** + * Converts centimeters to inches. + */ define('CM_TO_IN', 0.393700787402); -/** Converts centimeters to feet. */ +/** + * Converts centimeters to feet. + */ define('CM_TO_FT', 0.03280839895); -/** Converts centimeters to millimeters. */ +/** + * Converts centimeters to millimeters. + */ define('CM_TO_MM', 10); -/** Converts millimeters to millimeters. */ +/** + * Converts millimeters to millimeters. + */ define('MM_TO_MM', 1); -/** Converts millimeters to inches. */ +/** + * Converts millimeters to inches. + */ define('MM_TO_IN', 0.03937007874); -/** Converts millimeters to feet. */ +/** + * Converts millimeters to feet. + */ define('MM_TO_FT', 0.003280839895); -/** Converts millimeters to centimeters. */ +/** + * Converts millimeters to centimeters. + */ define('MM_TO_CM', 0.1); - /** * Implements hook_menu(). */ @@ -791,21 +854,27 @@ function uc_store_get_icon($path, $small = FALSE, $class = 'uc-store-icon', $alt case 'admin/store': $file = 'store_monitor'; break; + case 'admin/store/orders': $file = 'menu_orders'; break; + case 'admin/store/customers': $file = 'menu_customers'; break; + case 'admin/store/products': $file = 'menu_products'; break; + case 'admin/store/reports': $file = 'menu_reports'; break; + case 'admin/store/settings': $file = 'menu_store_settings'; break; + case 'admin/store/help': $file = 'menu_help'; break; diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.theme.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.theme.inc index 77bff64a..c6bc5147 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.theme.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.theme.inc @@ -109,4 +109,3 @@ function theme_uc_pane_sort_table($variables) { return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes)) . '
    '; } - diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.variable.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.variable.inc index 8eaec096..704d78db 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.variable.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_store/uc_store.variable.inc @@ -5,7 +5,6 @@ * Variable module hook implementations. */ - /** * Implements hook_variable_group_info(). */ diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_tax_report/uc_tax_report.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_tax_report/uc_tax_report.admin.inc index febe98cf..eedf2c56 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_tax_report/uc_tax_report.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_tax_report/uc_tax_report.admin.inc @@ -39,11 +39,11 @@ function uc_tax_report_report_page($start_date = NULL, $end_date = NULL, $status $csv_rows = array(); $csv_rows[] = $header; - // Query to get the tax line items in this date range + // Query to get the tax line items in this date range. $result = db_query("SELECT ucoli.amount, ucoli.title, ucoli.data FROM {uc_orders} ucord LEFT JOIN {uc_order_statuses} ON order_status_id = order_status LEFT JOIN {uc_order_line_items} ucoli ON ucord.order_id = ucoli.order_id WHERE :start <= created AND created <= :end AND order_status IN (:statuses) AND ucoli.type = :type", array(':start' => $args['start_date'], ':end' => $args['end_date'], ':statuses' => $order_statuses, ':type' => 'tax')); - // add up the amounts by jurisdiction + // Add up the amounts by jurisdiction. $totals = array(); $no_meta_totals = array(); @@ -51,17 +51,17 @@ function uc_tax_report_report_page($start_date = NULL, $end_date = NULL, $status $name = trim($item->title); $amount = floatval($item->amount); - // get the meta-data out of the serialized array + // Get the meta-data out of the serialized array. $data = unserialize($item->data); $jurisdiction = trim($data['tax_jurisdiction']); $taxable_amount = floatval($data['taxable_amount']); $rate = floatval($data['tax_rate']); - // make a line item in the report for each name/jurisdiction/rate + // Make a line item in the report for each name/jurisdiction/rate. $key = strtolower($name) . strtolower($jurisdiction) . number_format($rate, 5); if (!empty($jurisdiction) && $amount && $taxable_amount) { - // we have meta-data + // We have meta-data. if (empty($totals[$key])) { $totals[$key] = array( 'name' => $name, @@ -90,7 +90,7 @@ function uc_tax_report_report_page($start_date = NULL, $end_date = NULL, $status } } - // sort and make this into a report + // Sort and make this into a report. ksort($totals); ksort($no_meta_totals); diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_tax_report/uc_tax_report.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_tax_report/uc_tax_report.info index 7d5dbd6a..11b00e1c 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_tax_report/uc_tax_report.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_tax_report/uc_tax_report.info @@ -5,9 +5,8 @@ dependencies[] = uc_taxes package = Ubercart - core (optional) core = 7.x -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/tests/uc_taxes.test b/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/tests/uc_taxes.test index 4eb926cc..0a36a459 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/tests/uc_taxes.test +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/tests/uc_taxes.test @@ -27,7 +27,7 @@ class UbercartTaxesTestCase extends UbercartTestHelper { parent::setUp($modules, $permissions); } - function testInclusiveTaxes() { + public function testInclusiveTaxes() { $this->drupalLogin($this->adminUser); // Create a 20% inclusive tax rate. @@ -149,7 +149,7 @@ class UbercartTaxesTestCase extends UbercartTestHelper { $this->assertText('$16.80' . $rate->inclusion_text, 'Tax inclusive price appears on the printable invoice.'); } - function loadTaxLine($order_id) { + protected function loadTaxLine($order_id) { $order = uc_order_load($order_id, TRUE); foreach ($order->line_items as $line) { if ($line['type'] == 'tax') { @@ -159,7 +159,7 @@ class UbercartTaxesTestCase extends UbercartTestHelper { return FALSE; } - function assertTaxLineCorrect($line, $rate, $when) { + protected function assertTaxLineCorrect($line, $rate, $when) { $this->assertTrue($line, t('The tax line item was saved to the order ' . $when)); $this->assertTrue(number_format($rate * $this->product->sell_price, 2) == number_format($line['amount'], 2), t('Stored tax line item has the correct amount ' . $when)); $this->assertFieldByName('line_items[' . $line['line_item_id'] . '][li_id]', $line['line_item_id'], t('Found the tax line item ID ' . $when)); @@ -167,7 +167,7 @@ class UbercartTaxesTestCase extends UbercartTestHelper { $this->assertText(uc_currency_format($line['amount']), t('Tax display has the correct amount ' . $when)); } - function testStoredTaxDisplay() { + public function testStoredTaxDisplay() { $this->drupalLogin($this->adminUser); // Enable a payment method for the payment preview checkout pane. @@ -281,7 +281,7 @@ class UbercartTaxesTestCase extends UbercartTestHelper { } } - function testTaxProductClassUpdate() { + public function testTaxProductClassUpdate() { $this->drupalLogin($this->adminUser); // Create a new product class. diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.admin.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.admin.inc index 579d5a4b..15af136a 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.admin.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.admin.inc @@ -12,6 +12,7 @@ function uc_taxes_admin_settings() { $header = array(t('Name'), t('Rate'), t('Taxed products'), t('Taxed product types'), t('Taxed line items'), t('Weight'), array('data' => t('Operations'), 'colspan' => 4)); $rows = array(); + $options = array('query' => array('token' => drupal_get_token('uc_taxes_clone'))); foreach (uc_taxes_rate_load() as $rate_id => $rate) { $rows[] = array( check_plain($rate->name), @@ -22,7 +23,7 @@ function uc_taxes_admin_settings() { $rate->weight, l(t('edit'), 'admin/store/settings/taxes/' . $rate_id . '/edit'), l(t('conditions'), 'admin/store/settings/taxes/manage/uc_taxes_' . $rate_id), - l(t('clone'), 'admin/store/settings/taxes/' . $rate_id . '/clone'), + l(t('clone'), 'admin/store/settings/taxes/' . $rate_id . '/clone', $options), l(t('delete'), 'admin/store/settings/taxes/' . $rate_id . '/delete'), ); } @@ -211,6 +212,10 @@ function uc_taxes_form_submit($form, &$form_state) { * Clones a tax rate. */ function uc_taxes_clone($rate_id) { + if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], 'uc_taxes_clone')) { + return MENU_ACCESS_DENIED; + } + // Load the source rate object. $rate = uc_taxes_rate_load($rate_id); $name = $rate->name; diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.api.php b/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.api.php index 47240fd2..1e47e978 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.api.php +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.api.php @@ -16,7 +16,7 @@ * @param $order * An order object or an order id. * - * @return + * @return array * An array of tax line item objects keyed by a module-specific id. */ function hook_uc_calculate_tax($order) { @@ -45,7 +45,7 @@ function hook_uc_calculate_tax($order) { foreach (uc_taxes_rate_load() as $tax) { if ($use_same_rates) { - foreach ((array)$order->line_items as $old_line) { + foreach ((array) $order->line_items as $old_line) { if ($old_line['type'] == 'tax' && $old_line['data']['tax_id'] == $tax->id) { $tax->rate = $old_line['data']['tax_rate']; break; diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.info b/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.info index 56360490..1ef1b0ba 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.info +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.info @@ -11,9 +11,8 @@ files[] = tests/uc_taxes.test configure = admin/store/settings/taxes -; Information added by Drupal.org packaging script on 2016-07-16 -version = "7.x-3.10" +; Information added by Drupal.org packaging script on 2019-03-06 +version = "7.x-3.12" core = "7.x" project = "ubercart" -datestamp = "1468644909" - +datestamp = "1551862392" diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.module b/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.module index d5b998a7..9088bfe3 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.module +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.module @@ -7,7 +7,6 @@ * Allows tax rules to be set up and applied to orders. */ - /** * Implements hook_permission(). */ @@ -15,7 +14,7 @@ function uc_taxes_permission() { return array( 'configure taxes' => array( 'title' => t('Configure taxes'), - ) + ), ); } @@ -230,7 +229,7 @@ function uc_taxes_uc_order($op, $order, $arg2) { uc_order_log_changes($order->order_id, $changes); usort($order->line_items, 'uc_weight_sort'); } - break; + break; } } @@ -275,7 +274,8 @@ function uc_line_item_tax_display($op, $order) { * * @param $tax * A tax object as returned by hook_uc_taxes_calculate(). - * @return + * + * @return array * A line item array suitable for returning from line item callbacks. */ function _uc_taxes_to_line_item($tax) { @@ -341,7 +341,7 @@ function uc_line_item_tax_subtotal($op, $order) { * * @param $rate * The tax rate object to be saved. - * @param $reset + * @param bool $reset * If TRUE, resets the Rules cache after saving. Defaults to TRUE. * * @return @@ -392,7 +392,6 @@ function uc_taxes_rate_save($rate, $reset = TRUE) { return $rate; } - /** * List all the taxes that can apply to an order. * @@ -644,7 +643,7 @@ function uc_taxes_apply_tax($order, $tax) { } $amount = $taxable_amount * $tax->rate; if ($amount) { - $line_item = (object)array( + $line_item = (object) array( 'id' => $tax->id, 'name' => $tax->name, 'amount' => $amount, diff --git a/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.rules_defaults.inc b/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.rules_defaults.inc index 6bae3c92..c52ec214 100644 --- a/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.rules_defaults.inc +++ b/sites/all/modules/contrib/ecommerce/ubercart/uc_taxes/uc_taxes.rules_defaults.inc @@ -2,8 +2,7 @@ /** * @file - * This file contains the default Rules configurations that allow conditions to - * be applied to taxes. + * Default Rules configurations for uc_taxes. */ /** diff --git a/sites/all/modules/contrib/fields/link/README.txt b/sites/all/modules/contrib/fields/link/README.txt index 387cc594..c62e24ff 100644 --- a/sites/all/modules/contrib/fields/link/README.txt +++ b/sites/all/modules/contrib/fields/link/README.txt @@ -1,33 +1,92 @@ -Module description ------------------- -The link module can be count to the top 50 modules in Drupal installations and provides a standard custom content field for links. With this module links can be added easily to any content types and profiles and include advanced validating and different ways of storing internal or external links and URLs. It also supports additional link text title, site wide tokens for titles and title attributes, target attributes, css class attribution, static repeating values, input conversion, and many more. +CONTENTS OF THIS FILE +--------------------- + + * Introduction + * Requirements + * Installation + * Configuration + * Example + * Theming and Output + * Maintainers -Requirements / Dependencies ---------------------------- -1. Drupal 6: Custom content module (CCK) -2. Drupal 7: Fields API is provided already by core [no dependencies]. -3. Drupal 8: Link module is in core now. No module installation needed. Yay! Don't forget to activate it. It's deactivated by default. -INFO Since some misleading user reports we need to clarify here - Link module is NOT about to add links to any menus or the navigation nor primary/secondary menu. This can be done with default menu module (part of Drupal core). The Link module provides an additional custom field for storing and validating links to be added with any content type, which means another input block additional to your text-body, title, image and any other input you can make on new content creation. - -Installation +INTRODUCTION ------------ -1. Drop the entire link module directory into your 'sites/all/modules' folder -2. Enable the module from the Administration area modules page (admin/build/modules) -3. Create or Edit a content-type and add a new field of type link (admin/content/types in D6, admin/structure/types in D7) -Configuration +The link can be count to the top 50 projects in Drupal installations and +provides a standard custom content field for links. With this module links can +be added easily to any content types and profiles and include advanced +validating and different ways of storing internal or external links and URLs. It +also supports additional link text title, site wide tokens for titles and title +attributes, target attributes, css class attribution, static repeating values, +input conversion, and many more. + + +REQUIREMENTS +------------ + +No special requirements + + +INSTALLATION +------------ + +Install as you would normally install a contributed Drupal module. See: +https://drupal.org/documentation/install/modules-themes/modules-7 for further +information. + + +CONFIGURATION ------------- -Configuration is only slightly more complicated than a text field. Link text titles for URLs can be made required, set as instead of URL, optional (default), or left out entirely. If no link text title is provided, the trimmed version of the complete URL will be displayed. The target attribute should be set to "_blank", "top", or left out completely (checkboxes provide info). The rel=nofollow attribute prevents the link from being followed by certain search engines. More info at Wikipedia (http://en.wikipedia.org/wiki/Spam_in_blogs#rel.3D.22nofollow.22). -Example + * Configuration is only slightly more complicated than a text field. Link text + titles for URLs can be made required, set as instead of URL, optional + (default), or left out entirely. If no link text title is provided, the + trimmed version of the complete URL will be displayed. The target attribute + should be set to "_blank", "top", or left out completely (checkboxes provide + info). The rel=nofollow attribute prevents the link from being followed by + certain search engines. More info at Wikipedia + (http://en.wikipedia.org/wiki/Spam_in_blogs#rel.3D.22nofollow.22). + + +EXAMPLE ------- -If you were to create a field named 'My New Link', the default display of the link would be: where items between [] characters would be customized based on the user input. +If you were to create a field named 'My New Link', the default display of the +link would be: + where items between [] characters would be customized +based on the user input. -The link module supports both, internal and external URLs. URLs are validated on input. Here are some examples of data input and the default view of a link: http://drupal.org results in http://drupal.org, but drupal.org results in http://drupal.org, while will convert into http://drupal.org and node/74971 into http://drupal.org/project/link +The link project supports both, internal and external URLs. URLs are validated +on input. Here are some examples of data input and the default view of a link: +http://drupal.org results in http://drupal.org, but drupal.org results in +http://drupal.org, while will convert into http://drupal.org and +node/74971 into http://drupal.org/project/link -Anchors and query strings may also be used in any of these cases, including: node/74971/edit?destination=node/74972#pager +Anchors and query strings may also be used in any of these cases, including: +node/74971/edit?destination=node/74972#pager -Theming and Output + +THEMING AND OUTPUT ------------------ -Since link module is mainly a data storage field in a modular framework, the theming and output is up to the site builder and other additional modules. There are many modules in the Drupal repository, which control the output of fields perfectly and can handle rules, user actions, markup dependencies, and can vary the output under many different conditions, with much more efficience and flexibility for different scenarios. Please check out modules like views, display suite, panels, etc for such needs. \ No newline at end of file +Since link module is mainly a data storage field in a modular framework, the +theming and output is up to the site builder and other additional modules. There +are many modules in the Drupal repository, which control the output of fields +perfectly and can handle rules, user actions, markup dependencies, and can vary +the output under many different conditions, with much more efficience and +flexibility for different scenarios. Please check out modules like views, +display suite, panels, etc for such needs + + +MAINTAINERS +----------- + +Current maintainers: + * John C Fiala (jcfiala) - https://www.drupal.org/user/163643 + * Renato Gonçalves (RenatoG) - https://www.drupal.org/user/3326031 + * Clemens Tolboom (clemens.tolboom) - https://www.drupal.org/user/125814 + * diqidoq - https://www.drupal.org/user/1001934 + * dropcube - https://www.drupal.org/user/37031 + * Tom Kirkpatrick (mrfelton) - https://www.drupal.org/user/305669 + * Sumit Madan (sumitmadan) - https://www.drupal.org/user/1538790 + * Daniel Kudwien (sun) - https://www.drupal.org/user/54136 diff --git a/sites/all/modules/contrib/fields/link/link.css b/sites/all/modules/contrib/fields/link/css/link.css similarity index 99% rename from sites/all/modules/contrib/fields/link/link.css rename to sites/all/modules/contrib/fields/link/css/link.css index 1590e7ad..6250df7f 100644 --- a/sites/all/modules/contrib/fields/link/link.css +++ b/sites/all/modules/contrib/fields/link/css/link.css @@ -2,7 +2,6 @@ float: left; width: 48%; } - .link-field-column .form-text { width: 95%; } diff --git a/sites/all/modules/contrib/fields/link/link-rtl.css b/sites/all/modules/contrib/fields/link/link-rtl.css deleted file mode 100644 index 0359487e..00000000 --- a/sites/all/modules/contrib/fields/link/link-rtl.css +++ /dev/null @@ -1,8 +0,0 @@ -.link-field-column { - float: right; -} - -.link-field-column.link-field-url .form-text { - direction: ltr; - text-align: left; -} diff --git a/sites/all/modules/contrib/fields/link/link-validate_url-2299657-46.patch b/sites/all/modules/contrib/fields/link/link-validate_url-2299657-46.patch deleted file mode 100644 index 0bda3d31..00000000 --- a/sites/all/modules/contrib/fields/link/link-validate_url-2299657-46.patch +++ /dev/null @@ -1,370 +0,0 @@ -From f8ea05469f22005733e7d030f45ff85771924f14 Mon Sep 17 00:00:00 2001 -From: Jaleel Carter -Date: Thu, 14 Jul 2016 13:29:03 -0400 -Subject: [PATCH] 2299657-45 - -2299657-45-1 ---- - link.install | 14 +++++++++++ - link.module | 16 +++++++----- - tests/link.attribute.test | 6 +++-- - tests/link.crud.test | 6 +++-- - tests/link.crud_browser.test | 46 ++++++++++++++++++++--------------- - tests/link.test | 8 +++--- - tests/link.validate.test | 58 ++++++++++++++++++-------------------------- - 7 files changed, 87 insertions(+), 67 deletions(-) - -diff --git a/link.install b/link.install -index 14e745d..e1820f7 100644 ---- a/link.install -+++ b/link.install -@@ -115,3 +115,17 @@ function link_update_7001() { - } - } - } -+ -+/** -+ * Removes unused link_extra_domains variable. -+ */ -+function link_update_7002() { -+ variable_del('link_extra_domains'); -+} -+ -+/** -+ * Implements hook_uninstall(). -+ */ -+function link_uninstall() { -+ variable_del('link_allowed_domains'); -+} -diff --git a/link.module b/link.module -index 1e9d088..aece66d 100644 ---- a/link.module -+++ b/link.module -@@ -10,7 +10,6 @@ define('LINK_INTERNAL', 'internal'); - define('LINK_FRONT', 'front'); - define('LINK_EMAIL', 'email'); - define('LINK_NEWS', 'news'); --define('LINK_DOMAINS', 'aero|arpa|asia|biz|build|com|cat|ceo|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|post|pro|tel|travel|mobi|local|xxx'); - - define('LINK_TARGET_DEFAULT', 'default'); - define('LINK_TARGET_NEW_WINDOW', '_blank'); -@@ -1261,7 +1260,7 @@ function link_validate_url($text, $langcode = NULL) { - * - * @param string $text - * Url to be checked. -- * -+ * - * @return mixed - * Returns boolean FALSE if the URL is not valid. On success, returns one of - * the LINK_(linktype) constants. -@@ -1383,11 +1382,16 @@ function link_url_type($text) { - } - - /** -- * Returns the list of allowed domains, including domains added by admins via variable_set/$config. -+ * Returns the list of allowed domains. -+ * -+ * If the variable link_allowed_domains is set, restrict allowed domains to the -+ * strings in that array. If the variable link_allowed_domains is not set, allow -+ * all domains between 2 and 63 characters in length. -+ * See https://tools.ietf.org/html/rfc1034. - */ - function _link_domains() { -- $link_extra_domains = variable_get('link_extra_domains', array()); -- return empty($link_extra_domains) ? LINK_DOMAINS : LINK_DOMAINS . '|' . implode('|', $link_extra_domains); -+ $link_allowed_domains = variable_get('link_allowed_domains', array()); -+ return empty($link_allowed_domains) ? '[a-z][a-z0-9-]{1,62}' : implode('|', $link_allowed_domains); - } - - /** -@@ -1439,7 +1443,7 @@ function link_field_settings_form() { - - /** - * Additional callback to adapt the property info of link fields. -- * -+ * - * @see entity_metadata_field_entity_property_info() - */ - function link_field_property_info_callback(&$info, $entity_type, $field, $instance, $field_type) { -diff --git a/tests/link.attribute.test b/tests/link.attribute.test -index 36e6be5..4765814 100644 ---- a/tests/link.attribute.test -+++ b/tests/link.attribute.test -@@ -31,8 +31,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { - parent::setup('field_ui', 'link'); - $this->zebra = 0; - // Create and login user. -- $this->web_user = $this->drupalCreateUser(array('administer content types')); -- $this->drupalLogin($this->web_user); -+ $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); -+ $perms = array_keys($perms[array_search('administrator', user_roles())]); -+ $admin = $this->drupalCreateUser($perms); -+ $this->drupalLogin($admin); - } - - protected function createLink($url, $title, $attributes = array()) { -diff --git a/tests/link.crud.test b/tests/link.crud.test -index e9b7db4..5f12840 100644 ---- a/tests/link.crud.test -+++ b/tests/link.crud.test -@@ -29,8 +29,10 @@ class LinkContentCrudTest extends DrupalWebTestCase { - $title = $this->randomName(20); - - // Create and login user. -- $this->web_user = $this->drupalCreateUser(array('administer content types')); -- $this->drupalLogin($this->web_user); -+ $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); -+ $perms = array_keys($perms[array_search('administrator', user_roles())]); -+ $admin = $this->drupalCreateUser($perms); -+ $this->drupalLogin($admin); - - $this->drupalGet('admin/structure/types'); - -diff --git a/tests/link.crud_browser.test b/tests/link.crud_browser.test -index be04260..803169b 100644 ---- a/tests/link.crud_browser.test -+++ b/tests/link.crud_browser.test -@@ -42,15 +42,11 @@ class LinkUITest extends DrupalWebTestcase { - */ - function testLinkCreate() { - //libxml_use_internal_errors(true); -- $this->web_user = $this->drupalCreateUser(array( -- 'administer content types', -- 'administer nodes', -- 'administer filters', -- 'access content', -- 'create page content', -- 'access administration pages' -- )); -- $this->drupalLogin($this->web_user); -+ $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); -+ $perms = array_keys($perms[array_search('administrator', user_roles())]); -+ $admin = $this->drupalCreateUser($perms); -+ $this->drupalLogin($admin); -+ - - // create field - $name = strtolower($this->randomName()); -@@ -133,7 +129,7 @@ class LinkUITest extends DrupalWebTestcase { - $input_test_cases[] = $test_case; - - foreach ($input_test_cases as $input) { -- $this->drupalLogin($this->web_user); -+ $this->drupalLogin($admin); - $this->drupalGet('node/add/page'); - - $edit = array( -@@ -179,8 +175,10 @@ class LinkUITest extends DrupalWebTestcase { - * title actually displays . - */ - function testStaticLinkCreate() { -- $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content')); -- $this->drupalLogin($this->web_user); -+ $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); -+ $perms = array_keys($perms[array_search('administrator', user_roles())]); -+ $admin = $this->drupalCreateUser($perms); -+ $this->drupalLogin($admin); - - // create field - $name = strtolower($this->randomName()); -@@ -227,8 +225,10 @@ class LinkUITest extends DrupalWebTestcase { - * Testing that if you have the title but no url, the title is not sanitized twice. - */ - function testCRUDTitleOnlyTitleNoLink() { -- $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content')); -- $this->drupalLogin($this->web_user); -+ $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); -+ $perms = array_keys($perms[array_search('administrator', user_roles())]); -+ $admin = $this->drupalCreateUser($perms); -+ $this->drupalLogin($admin); - - // create field - $name = strtolower($this->randomName()); -@@ -278,8 +278,10 @@ class LinkUITest extends DrupalWebTestcase { - * sure they are set to the expected results. - */ - function testCRUDCreateFieldDefaults() { -- $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content')); -- $this->drupalLogin($this->web_user); -+ $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); -+ $perms = array_keys($perms[array_search('administrator', user_roles())]); -+ $admin = $this->drupalCreateUser($perms); -+ $this->drupalLogin($admin); - - // create field - $name = strtolower($this->randomName()); -@@ -318,8 +320,10 @@ class LinkUITest extends DrupalWebTestcase { - * sure they are set to the expected results. - */ - function testCRUDCreateFieldWithClass() { -- $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content')); -- $this->drupalLogin($this->web_user); -+ $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); -+ $perms = array_keys($perms[array_search('administrator', user_roles())]); -+ $admin = $this->drupalCreateUser($perms); -+ $this->drupalLogin($admin); - - // create field - $name = strtolower($this->randomName()); -@@ -390,8 +394,10 @@ class LinkUITest extends DrupalWebTestcase { - * sure they are set to the expected results. - */ - function testCRUDCreateFieldWithTwoClasses() { -- $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content')); -- $this->drupalLogin($this->web_user); -+ $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); -+ $perms = array_keys($perms[array_search('administrator', user_roles())]); -+ $admin = $this->drupalCreateUser($perms); -+ $this->drupalLogin($admin); - - // create field - $name = strtolower($this->randomName()); -diff --git a/tests/link.test b/tests/link.test -index 962197f..b030153 100644 ---- a/tests/link.test -+++ b/tests/link.test -@@ -23,9 +23,11 @@ class LinkBaseTestClass extends DrupalWebTestCase { - $modules[] = 'field_ui'; - $modules[] = 'link'; - parent::setUp($modules); -- -- $this->web_user = $this->drupalCreateUser($this->permissions); -- $this->drupalLogin($this->web_user); -+ -+ $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); -+ $perms = array_keys($perms[array_search('administrator', user_roles())]); -+ $admin = $this->drupalCreateUser($perms); -+ $this->drupalLogin($admin); - } - - protected function createLinkField($node_type = 'page', $settings = array()) { -diff --git a/tests/link.validate.test b/tests/link.validate.test -index a9ac116..f03a64c 100644 ---- a/tests/link.validate.test -+++ b/tests/link.validate.test -@@ -61,13 +61,10 @@ class LinkValidateTest extends LinkValidateTestCase { - * Test if we're stopped from posting a bad url on default validation. - */ - function test_link_validate_bad_url_validate_default() { -- $this->web_user = $this->drupalCreateUser(array('administer content types', -- 'administer nodes', -- 'administer filters', -- 'access content', -- 'create page content', -- 'access administration pages')); -- $this->drupalLogin($this->web_user); -+ $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); -+ $perms = array_keys($perms[array_search('administrator', user_roles())]); -+ $admin = $this->drupalCreateUser($perms); -+ $this->drupalLogin($admin); - - // create field - $name = strtolower($this->randomName()); -@@ -106,13 +103,10 @@ class LinkValidateTest extends LinkValidateTestCase { - * Test if we're stopped from posting a bad url with validation on. - */ - function test_link_validate_bad_url_validate_on() { -- $this->web_user = $this->drupalCreateUser(array('administer content types', -- 'administer nodes', -- 'administer filters', -- 'access content', -- 'create page content', -- 'access administration pages')); -- $this->drupalLogin($this->web_user); -+ $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); -+ $perms = array_keys($perms[array_search('administrator', user_roles())]); -+ $admin = $this->drupalCreateUser($perms); -+ $this->drupalLogin($admin); - - // create field - $name = strtolower($this->randomName()); -@@ -152,13 +146,10 @@ class LinkValidateTest extends LinkValidateTestCase { - * Test if we can post a bad url if the validation is expressly turned off. - */ - function test_link_validate_bad_url_validate_off() { -- $this->web_user = $this->drupalCreateUser(array('administer content types', -- 'administer nodes', -- 'administer filters', -- 'access content', -- 'create page content', -- 'access administration pages')); -- $this->drupalLogin($this->web_user); -+ $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); -+ $perms = array_keys($perms[array_search('administrator', user_roles())]); -+ $admin = $this->drupalCreateUser($perms); -+ $this->drupalLogin($admin); - - // create field - $name = strtolower($this->randomName()); -@@ -202,13 +193,10 @@ class LinkValidateTest extends LinkValidateTestCase { - */ - function x_test_link_validate_switching_between_validation_status() { - $this->acquireContentTypes(1); -- $this->web_user = $this->drupalCreateUser(array('administer content types', -- 'administer nodes', -- 'access administration pages', -- 'access content', -- 'create ' . $this->content_types[0]->type . ' content', -- 'edit any ' . $this->content_types[0]->type . ' content')); -- $this->drupalLogin($this->web_user); -+ $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); -+ $perms = array_keys($perms[array_search('administrator', user_roles())]); -+ $admin = $this->drupalCreateUser($perms); -+ $this->drupalLogin($admin); - variable_set('node_options_' . $this->content_types[0]->name, array('status', 'promote')); - $field_settings = array( - 'type' => 'link', -@@ -368,7 +356,7 @@ class LinkValidateUrlLight extends DrupalWebTestCase { - 'group' => 'Link', - ); - } -- -+ - function setUp() { - parent::setUp('link'); - } -@@ -429,11 +417,10 @@ class LinkValidateUrlLight extends DrupalWebTestCase { - function testValidateInternalLinks() { - $tempfile = drupal_tempnam('public://files', 'test'); - $links = array( -- 'rss.xml', - file_uri_target($tempfile), - drupal_realpath($tempfile), - ); -- -+ - foreach ($links as $link) { - $type = link_url_type($link); - $this->assertEqual(LINK_INTERNAL, $type, 'Test ' . $link . ' is an internal link.'); -@@ -482,8 +469,8 @@ class LinkValidateUrlLight extends DrupalWebTestCase { - //$valid2 = valid_url($link, TRUE); - //$this->assertEqual(TRUE, $valid2, "Using valid_url() on $link."); - } -- // Test if we can make a tld valid: -- variable_set('link_extra_domains', array('frog')); -+ // Test if we can make a tld allowable: -+ variable_set('link_allowed_domains', array('frog')); - $valid = link_validate_url('http://www.example.frog'); - $this->assertEqual(LINK_EXTERNAL, $valid, "Testing that http://www.example.frog is a valid external link if we've added 'frog' to the list of valid domains."); - } -@@ -495,7 +482,6 @@ class LinkValidateUrlLight extends DrupalWebTestCase { - 'http://4827.0.0.2/', - '//www.example.com/', - 'http://www.testß.com/', // ß not allowed in domain names! -- 'http://www.example.frog/', // Bad TLD - //'http://www.-fudge.com/', // domains can't have sections starting with a dash. - 'http://example.com/index.php?page=this\that', - 'example@example.com', -@@ -504,5 +490,9 @@ class LinkValidateUrlLight extends DrupalWebTestCase { - $valid = link_validate_url($link); - $this->assertEqual(FALSE, $valid, 'Testing that ' . $link . ' is not a valid link.'); - } -+ // Test if we can make a tld disallowed: -+ variable_set('link_allowed_domains', array('toad')); -+ $valid = link_validate_url('http://www.example.frog'); -+ $this->assertEqual(FALSE, $valid, "Testing that http://www.example.frog is an invalid external link if we've not added 'frog' to the list of valid domains."); - } - } --- -2.7.4 (Apple Git-66) - diff --git a/sites/all/modules/contrib/fields/link/link.devel_generate.inc b/sites/all/modules/contrib/fields/link/link.devel_generate.inc index af0e2d5d..edc10c13 100644 --- a/sites/all/modules/contrib/fields/link/link.devel_generate.inc +++ b/sites/all/modules/contrib/fields/link/link.devel_generate.inc @@ -21,8 +21,9 @@ function link_devel_generate($object, $field, $instance, $bundle) { * Callback for hook_devel_generate(). */ function _link_devel_generate($object, $field, $instance, $bundle) { + $url = 'http://example.com/' . devel_generate_word(mt_rand(6, 12)); $link = array( - 'url' => url('', array('absolute' => TRUE)), + 'url' => url($url, array('absolute' => TRUE)), 'attributes' => _link_default_attributes(), ); if ($instance['settings']['title'] != 'none') { diff --git a/sites/all/modules/contrib/fields/link/link.diff.inc b/sites/all/modules/contrib/fields/link/link.diff.inc index 9e34123a..b01ba6e7 100644 --- a/sites/all/modules/contrib/fields/link/link.diff.inc +++ b/sites/all/modules/contrib/fields/link/link.diff.inc @@ -11,11 +11,11 @@ function link_field_diff_view($items, $context) { $diff_items = array(); foreach ($items as $delta => $item) { - if ($item['url'] && $item['title']) { + if ($item['url'] && isset($item['title'])) { $diff_items[$delta] = $item['title'] . ' (' . $item['url'] . ')'; } else { - $diff_items[$delta] = $item['title'] . $item['url']; + $diff_items[$delta] = $item['url']; } } return $diff_items; diff --git a/sites/all/modules/contrib/fields/link/link.info b/sites/all/modules/contrib/fields/link/link.info index 4ff71e25..de253254 100644 --- a/sites/all/modules/contrib/fields/link/link.info +++ b/sites/all/modules/contrib/fields/link/link.info @@ -3,7 +3,6 @@ description = Defines simple link field types. core = 7.x package = Fields -files[] = link.module files[] = link.migrate.inc ; Tests @@ -14,14 +13,14 @@ files[] = tests/link.crud_browser.test files[] = tests/link.token.test files[] = tests/link.entity_token.test files[] = tests/link.validate.test +files[] = tests/link.multilingual.test ; Views Handlers files[] = views/link_views_handler_argument_target.inc files[] = views/link_views_handler_filter_protocol.inc -; Information added by Drupal.org packaging script on 2016-01-15 -version = "7.x-1.4" +; Information added by Drupal.org packaging script on 2019-02-20 +version = "7.x-1.5-beta3+25-dev" core = "7.x" project = "link" -datestamp = "1452830642" - +datestamp = "1550680992" diff --git a/sites/all/modules/contrib/fields/link/link.install b/sites/all/modules/contrib/fields/link/link.install index e1820f75..75a5d72f 100644 --- a/sites/all/modules/contrib/fields/link/link.install +++ b/sites/all/modules/contrib/fields/link/link.install @@ -6,10 +6,38 @@ */ /** - * Upgrade notes: - * Things we need to make sure work when upgrading from Drupal 6 to Drupal 7: + * Upgrade notes. + * + * Things we need to make sure work when upgrading from Drupal 6 to Drupal 7:. */ +/** + * Implements hook_install(). + */ +function link_install() { + // Notify the user they may want to install token. + if (!module_exists('token')) { + $t = get_t(); + drupal_set_message($t('If you install the Token, static title can use any other entity field as its value.', array( + '!url' => 'http://drupal.org/project/token', + ))); + } +} + +/** + * Removes unused link_extra_domains variable. + */ +function link_update_7002() { + variable_del('link_extra_domains'); +} + +/** + * Implements hook_uninstall(). + */ +function link_uninstall() { + variable_del('link_allowed_domains'); +} + /** * Implements hook_field_schema(). */ @@ -46,19 +74,21 @@ function link_update_last_removed() { } /** - * Handles moving settings data from field_config.data to field_config_instance.data. + * Implements hook_update_N(). + * + * Handles moving settings data from field_config.data to + * field_config_instance.data. */ function link_update_7000() { - - // For each field that is a link field, we need to copy the settings from the general field level down to the instance. - //$field_data = array(); + + // For each field that is a link field, we need to copy the settings from the + // general field level down to the instance. $result = db_query("SELECT id, field_name, data FROM {field_config} WHERE module = 'link' AND type = 'link_field'"); foreach ($result as $field) { - $field_id = $field->id; - $name = $field->field_name; + $field_data = unserialize($field->data); - - $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field_id)); + + $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field->id)); foreach ($instances as $instance) { // If this field has been updated already, we want to skip it. $instance_data = unserialize($instance->data); @@ -71,8 +101,8 @@ function link_update_7000() { } } if ($update_instance) { - // update the database. - $num_updated = db_update('field_config_instance') + // Update the database. + db_update('field_config_instance') ->fields(array('data' => serialize($instance_data))) ->condition('id', $instance->id) ->execute(); @@ -80,22 +110,19 @@ function link_update_7000() { } } } - + return t("Instance settings have been set with the data from the field settings."); } /** - * Renames all displays from foobar to link_foobar + * Renames all displays from foobar to link_foobar. */ function link_update_7001() { // Update the display type for each link field type. $result = db_query("SELECT id, field_name, data FROM {field_config} WHERE module = 'link' AND type = 'link_field'"); foreach ($result as $field) { - $field_id = $field->id; - $name = $field->field_name; - $field_data = unserialize($field->data); - - $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field_id)); + + $instances = db_query("SELECT id, data FROM {field_config_instance} WHERE field_id = :field_id", array(':field_id' => $field->id)); foreach ($instances as $instance) { // If this field has been updated already, we want to skip it. $instance_data = unserialize($instance->data); @@ -115,17 +142,3 @@ function link_update_7001() { } } } - -/** - * Removes unused link_extra_domains variable. - */ -function link_update_7002() { - variable_del('link_extra_domains'); -} - -/** - * Implements hook_uninstall(). - */ -function link_uninstall() { - variable_del('link_allowed_domains'); -} diff --git a/sites/all/modules/contrib/fields/link/link.migrate.inc b/sites/all/modules/contrib/fields/link/link.migrate.inc index fc8363f6..49000510 100644 --- a/sites/all/modules/contrib/fields/link/link.migrate.inc +++ b/sites/all/modules/contrib/fields/link/link.migrate.inc @@ -11,11 +11,9 @@ * $this->addFieldMapping('field_my_link', 'source_url'); * $this->addFieldMapping('field_my_link:title', 'source_title'); * $this->addFieldMapping('field_my_link:attributes', 'source_attributes'); - * @endcode * - * With earlier versions of Migrate, you must pass an arguments array: + * # With earlier versions of Migrate, you must pass an arguments array: * - * @code * $link_args = array( * 'title' => array('source_field' => 'source_title'), * 'attributes' => array('source_field' => 'source_attributes'), @@ -25,6 +23,10 @@ * @endcode */ +if (!class_exists('MigrateFieldHandler')) { + return; +} + /** * Implements hook_migrate_api(). */ @@ -35,12 +37,20 @@ function link_migrate_api() { ); } +// @codingStandardsIgnoreLine class MigrateLinkFieldHandler extends MigrateFieldHandler { + + /** + * Construct. + */ public function __construct() { $this->registerTypes(array('link_field')); } - static function arguments($title = NULL, $attributes = NULL, $language = NULL) { + /** + * Arguments. + */ + public static function arguments($title = NULL, $attributes = NULL, $language = NULL) { $arguments = array(); if (!is_null($title)) { $arguments['title'] = $title; @@ -57,16 +67,21 @@ class MigrateLinkFieldHandler extends MigrateFieldHandler { /** * Implementation of MigrateFieldHandler::fields(). * - * @param $type - * The field type. - * @param $instance - * Instance info for the field. + * @param array $type + * The field type. + * @param array $instance + * Instance info for the field. * @param Migration $migration - * The migration context for the parent field. We can look at the mappings - * and determine which subfields are relevant. + * The migration context for the parent field. We can look at the mappings + * and determine which subfields are relevant. + * * @return array + * Array with values. + * + * @codingStandardsIgnoreStart */ public function fields($type, $instance, $migration = NULL) { + // @codingStandardsIgnoreEnd return array( 'title' => t('Subfield: The link title attribute'), 'attributes' => t('Subfield: The attributes for this link'), @@ -74,6 +89,9 @@ class MigrateLinkFieldHandler extends MigrateFieldHandler { ); } + /** + * Prepare. + */ public function prepare($entity, array $field_info, array $instance, array $values) { if (isset($values['arguments'])) { $arguments = $values['arguments']; @@ -105,9 +123,17 @@ class MigrateLinkFieldHandler extends MigrateFieldHandler { } } $item['url'] = $value; - $return[$language][$delta] = $item; + + if (is_array($language)) { + $current_language = $language[$delta]; + } + else { + $current_language = $language; + } + $return[$current_language][$delta] = $item; } return isset($return) ? $return : NULL; } + } diff --git a/sites/all/modules/contrib/fields/link/link.module b/sites/all/modules/contrib/fields/link/link.module index aece66d1..a57535d6 100644 --- a/sites/all/modules/contrib/fields/link/link.module +++ b/sites/all/modules/contrib/fields/link/link.module @@ -8,9 +8,12 @@ define('LINK_EXTERNAL', 'external'); define('LINK_INTERNAL', 'internal'); define('LINK_FRONT', 'front'); +define('LINK_FRAGMENT', 'fragment'); +define('LINK_QUERY', 'query'); define('LINK_EMAIL', 'email'); +define('LINK_TEL', 'tel'); define('LINK_NEWS', 'news'); - +define('LINK_FILE', 'file'); define('LINK_TARGET_DEFAULT', 'default'); define('LINK_TARGET_NEW_WINDOW', '_blank'); define('LINK_TARGET_TOP', '_top'); @@ -21,6 +24,22 @@ define('LINK_TARGET_USER', 'user'); */ define('LINK_URL_MAX_LENGTH', 2048); +/** + * Implements hook_help(). + */ +function link_help($path, $arg) { + switch ($path) { + case 'admin/help#link': + $output = '

    ' . t('About') . '

    '; + $output .= '

    ' . t('The link provides a standard custom content field for links. Links can be easily added to any content types and profiles and include advanced validating and different ways of storing internal or external links and URLs. It also supports additional link text title, site wide tokens for titles and title attributes, target attributes, css class attribution, static repeating values, input conversion, and many more.') . '

    '; + $output .= '

    ' . t('Requirements / Dependencies') . '

    '; + $output .= '

    ' . 'Fields API is provided already by core [no dependencies].' . '

    '; + $output .= '

    Configuration

    '; + $output .= '

    ' . 'Configuration is only slightly more complicated than a text field. Link text titles for URLs can be made required, set as instead of URL, optional (default), or left out entirely. If no link text title is provided, the trimmed version of the complete URL will be displayed. The target attribute should be set to "_blank", "top", or left out completely (checkboxes provide info). The rel=nofollow attribute prevents the link from being followed by certain search engines.' . '

    '; + return $output; + } +} + /** * Implements hook_field_info(). */ @@ -97,6 +116,7 @@ function link_field_instance_settings_form($field, $instance) { 'optional' => t('Optional Title'), 'required' => t('Required Title'), 'value' => t('Static Title'), + 'select' => t('Selected Title'), 'none' => t('No Title'), ); @@ -110,9 +130,26 @@ function link_field_instance_settings_form($field, $instance) { $form['title_value'] = array( '#type' => 'textfield', - '#title' => t('Static title'), + '#title' => t('Static or default title'), '#default_value' => isset($instance['settings']['title_value']) ? $instance['settings']['title_value'] : '', - '#description' => t('This title will always be used if “Static Title” is selected above.'), + '#description' => t('This title will 1) always be used if "Static Title" is selected above, or 2) used if "Optional title" is selected above and no title is entered when creating content.'), + '#states' => array( + 'visible' => array( + ':input[name="instance[settings][title]"]' => array('value' => 'value'), + ), + ), + ); + + $form['title_allowed_values'] = array( + '#type' => 'textarea', + '#title' => t('Title allowed values'), + '#default_value' => isset($instance['settings']['title_allowed_values']) ? $instance['settings']['title_allowed_values'] : '', + '#description' => t('When using "Selected Title", you can allow users to select the title from a limited set of values (eg. Home, Office, Other). Enter here all possible values that title can take, one value per line.'), + '#states' => array( + 'visible' => array( + ':input[name="instance[settings][title]"]' => array('value' => 'select'), + ), + ), ); $form['title_label_use_field_label'] = array( @@ -162,15 +199,18 @@ function link_field_instance_settings_form($field, $instance) { '#size' => 3, ); + // Target options. E.g. New window = target="_blank". $target_options = array( LINK_TARGET_DEFAULT => t('Default (no target attribute)'), LINK_TARGET_TOP => t('Open link in window root'), LINK_TARGET_NEW_WINDOW => t('Open link in new window'), LINK_TARGET_USER => t('Allow the user to choose'), ); + $form['attributes'] = array( '#tree' => TRUE, ); + $form['attributes']['target'] = array( '#type' => 'radios', '#title' => t('Link Target'), @@ -180,7 +220,7 @@ function link_field_instance_settings_form($field, $instance) { $form['attributes']['rel'] = array( '#type' => 'textfield', '#title' => t('Rel Attribute'), - '#description' => t('When output, this link will have this rel attribute. The most common usage is rel="nofollow" which prevents some search engines from spidering entered links.'), + '#description' => t('When output, this link will have this rel attribute. The most common usage is rel="nofollow" which prevents some search engines from spidering entered links.'), '#default_value' => empty($instance['settings']['attributes']['rel']) ? '' : $instance['settings']['attributes']['rel'], '#field_prefix' => 'rel = "', '#field_suffix' => '"', @@ -217,7 +257,7 @@ function link_field_instance_settings_form($field, $instance) { $form['attributes']['title'] = array( '#title' => t("Default link 'title' Attribute"), '#type' => 'textfield', - '#description' => t('When output, links will use this "title" attribute if the user does not provide one and when different from the link text. Read WCAG 1.0 Guidelines for links comformances. Tokens values will be evaluated.'), + '#description' => t('When output, links will use this "title" attribute if the user does not provide one and when different from the link text. Read WCAG 1.0 Guidelines for links comformances. Tokens values will be evaluated.'), '#default_value' => empty($instance['settings']['attributes']['title']) ? '' : $instance['settings']['attributes']['title'], '#field_prefix' => 'title = "', '#field_suffix' => '"', @@ -227,11 +267,17 @@ function link_field_instance_settings_form($field, $instance) { } /** + * Form validate. + * * #element_validate handler for link_field_instance_settings_form(). */ function link_field_settings_form_validate($element, &$form_state, $complete_form) { if ($form_state['values']['instance']['settings']['title'] === 'value' && empty($form_state['values']['instance']['settings']['title_value'])) { - form_set_error('title_value', t('A default title must be provided if the title is a static value.')); + form_set_error('instance][settings][title_value', t('A default title must be provided if the title is a static value.')); + } + if ($form_state['values']['instance']['settings']['title'] === 'select' + && empty($form_state['values']['instance']['settings']['title_allowed_values'])) { + form_set_error('instance][settings][title_allowed_values', t('You must enter one or more allowed values for link Title, the title is a selected value.')); } if (!empty($form_state['values']['instance']['settings']['display']['url_cutoff']) && !is_numeric($form_state['values']['instance']['settings']['display']['url_cutoff'])) { form_set_error('display', t('URL Display Cutoff value must be numeric.')); @@ -261,6 +307,8 @@ function link_field_load($entity_type, $entities, $field, $instances, $langcode, foreach ($entities as $id => $entity) { foreach ($items[$id] as $delta => $item) { $items[$id][$delta]['attributes'] = _link_load($field, $item, $instances[$id]); + $items[$id][$delta]['original_title'] = $item['title']; + $items[$id][$delta]['original_url'] = $item['url']; } } } @@ -276,6 +324,16 @@ function link_field_validate($entity_type, $entity, $field, $instance, $langcode } } + foreach ($items as $delta => $value) { + if (isset($value['attributes']) && is_string($value['attributes'])) { + $errors[$field['field_name']][$langcode][$delta][] = array( + 'error' => 'link_required', + 'message' => t('String values are not acceptable for attributes.'), + 'error_element' => array('url' => TRUE, 'title' => FALSE), + ); + } + } + if ($instance['settings']['url'] === 'optional' && $instance['settings']['title'] === 'optional' && $instance['required'] && !$optional_field_found) { $errors[$field['field_name']][$langcode][0][] = array( 'error' => 'link_required', @@ -308,8 +366,19 @@ function link_field_update($entity_type, $entity, $field, $instance, $langcode, */ function link_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items) { foreach ($items as $entity_id => $entity_items) { - foreach ($entity_items as $delta => $value) { - _link_sanitize($items[$entity_id][$delta], $delta, $field, $instances[$entity_id], $entities[$entity_id]); + $settings = $instances[$entity_id]['settings']; + $trimTitle = trim($settings['title_value']); + if (empty($entity_items) && !empty($trimTitle) && $settings['title'] == 'value' && $settings['url'] === 'optional') { + $token_value = token_replace($settings['title_value'], array($entity_type => $entities[$entity_id])); + $display_title = htmlspecialchars_decode($token_value, ENT_QUOTES); + $items[$entity_id][0]['url'] = NULL; + $items[$entity_id][0]['title'] = $display_title; + $items[$entity_id][0]['attributes'] = array(); + } + else { + foreach ($entity_items as $delta => $value) { + _link_sanitize($items[$entity_id][$delta], $delta, $field, $instances[$entity_id], $entities[$entity_id]); + } } } } @@ -342,10 +411,10 @@ function link_field_widget_form(&$form, &$form_state, $field, $instance, $langco * Implements hook_field_widget_error(). */ function link_field_widget_error($element, $error, $form, &$form_state) { - if ($error['error_element']['title']) { + if (!empty($error['error_element']['title'])) { form_error($element['title'], $error['message']); } - elseif ($error['error_element']['url']) { + elseif (!empty($error['error_element']['url'])) { form_error($element['url'], $error['message']); } } @@ -371,23 +440,21 @@ function _link_load($field, $item, $instance) { /** * Prepares the item attributes and url for storage. * - * @param $item - * Link field values. - * - * @param $delta - * The sequence number for current values. - * - * @param $field - * The field structure array. - * - * @param $entity - * Entity object. - * - * @param $instance - * The instance structure for $field on $entity's bundle. + * @param array $item + * Link field values. + * @param array $delta + * The sequence number for current values. + * @param array $field + * The field structure array. + * @param object $entity + * Entity object. + * @param array $instance + * The instance structure for $field on $entity's bundle. * + * @codingStandardsIgnoreStart */ function _link_process(&$item, $delta, $field, $entity, $instance) { + // @codingStandardsIgnoreEnd // Trim whitespace from URL. if (!empty($item['url'])) { $item['url'] = trim($item['url']); @@ -446,9 +513,10 @@ function _link_validate(&$item, $delta, $field, $entity, $instance, $langcode, & 'error_element' => array('url' => TRUE, 'title' => FALSE), ); } - // In a totally bizzaro case, where URLs and titles are optional but the field is required, ensure there is at least one link. + // In a totally bizzaro case, where URLs and titles are optional but the field + // is required, ensure there is at least one link. if ($instance['settings']['url'] === 'optional' && $instance['settings']['title'] === 'optional' - && (strlen(trim($item['url'])) !== 0 || strlen(trim($item['title'])) !== 0)) { + && (strlen(trim($item['url'])) !== 0 || strlen(trim($item['title'])) !== 0)) { $optional_field_found = TRUE; } // Require entire field. @@ -464,16 +532,30 @@ function _link_validate(&$item, $delta, $field, $entity, $instance, $langcode, & /** * Clean up user-entered values for a link field according to field settings. * - * @param array $item + * @param array $item * A single link item, usually containing url, title, and attributes. - * @param int $delta + * @param int $delta * The delta value if this field is one of multiple fields. - * @param array $field + * @param array $field * The CCK field definition. - * @param object $entity + * @param object $entity * The entity containing this link. + * + * @codingStandardsIgnoreStart */ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { + // @codingStandardsIgnoreEnd + // As this function can be called multiple times and the item is changed by + // reference we need to ensure that there's always the original data to + // process otherwise processed data are processed again which might leads to + // unexpected results. + if (isset($item['_link_sanitized'])) { + return; + } + + // Store a flag to check in case of a second call. + $item['_link_sanitized'] = TRUE; + // Don't try to process empty links. if (empty($item['url']) && empty($item['title'])) { return; @@ -487,7 +569,7 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { $entity_info = entity_get_info($entity_type); $property_id = $entity_info['entity keys']['id']; $entity_token_type = isset($entity_info['token type']) ? $entity_info['token type'] : ( - $entity_type == 'taxonomy_term' || $entity_type == 'taxonomy_vocabulary' ? str_replace('taxonomy_', '', $entity_type) : $entity_type + $entity_type == 'taxonomy_term' || $entity_type == 'taxonomy_vocabulary' ? str_replace('taxonomy_', '', $entity_type) : $entity_type ); if (isset($instance['settings']['enable_tokens']) && $instance['settings']['enable_tokens']) { $text_tokens = token_scan($item['url']); @@ -510,23 +592,33 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { if ($type == FALSE && $instance['settings']['validate_url'] === 0) { $type = LINK_EXTERNAL; } + elseif ($type == LINK_FRAGMENT || $type == LINK_QUERY) { + // If type is a fragment or query, then use the current URL. + $item['url'] = $_GET['q'] . $item['url']; + } $url = link_cleanup_url($item['url']); $url_parts = _link_parse_url($url); if (!empty($url_parts['url'])) { - $item['url'] = url($url_parts['url'], - array('query' => isset($url_parts['query']) ? $url_parts['query'] : NULL, + $item = array( + 'url' => $url_parts['url'], + 'query' => isset($url_parts['query']) ? $url_parts['query'] : NULL, 'fragment' => isset($url_parts['fragment']) ? $url_parts['fragment'] : NULL, 'absolute' => !empty($instance['settings']['absolute_url']), 'html' => TRUE, - ) - ); + ) + $item; } // Create a shortened URL for display. if ($type == LINK_EMAIL) { $display_url = str_replace('mailto:', '', $url); } + elseif ($type === LINK_EXTERNAL) { + $display_url = $item['url']; + } + elseif ($type == LINK_TEL) { + $display_url = str_replace('tel:', '', $url); + } else { $display_url = url($url_parts['url'], array( @@ -537,7 +629,7 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { ); } if ($instance['settings']['display']['url_cutoff'] && strlen($display_url) > $instance['settings']['display']['url_cutoff']) { - $display_url = substr($display_url, 0, $instance['settings']['display']['url_cutoff']) . "..."; + $display_url = substr($display_url, 0, $instance['settings']['display']['url_cutoff']) . "…"; } $item['display_url'] = $display_url; @@ -550,15 +642,20 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { } } // Use the title defined by the user at the widget level. - elseif (isset($item['title'])) { + elseif (isset($item['title']) && drupal_strlen(trim($item['title']))) { $title = $item['title']; } + // Use the static title if a user-defined title is optional and a static title + // has been defined. + elseif ($instance['settings']['title'] == 'optional' && drupal_strlen(trim($instance['settings']['title_value']))) { + $title = $instance['settings']['title_value']; + } else { $title = ''; } // Replace title tokens. - if ($title && ($instance['settings']['title'] == 'value' || $instance['settings']['enable_tokens'])) { + if ($title && $instance['settings']['enable_tokens']) { $text_tokens = token_scan($title); if (!empty($text_tokens)) { // Load the entity if necessary for entities in views. @@ -571,10 +668,25 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { } $title = token_replace($title, array($entity_token_type => $entity_loaded)); } - $title = filter_xss($title, array('b', 'br', 'code', 'em', 'i', 'img', 'span', 'strong', 'sub', 'sup', 'tt', 'u')); + } + if ($title && ($instance['settings']['title'] == 'value' || $instance['settings']['enable_tokens'])) { + $title = filter_xss($title, array( + 'b', + 'br', + 'code', + 'em', + 'i', + 'img', + 'span', + 'strong', + 'sub', + 'sup', + 'tt', + 'u', + )); $item['html'] = TRUE; } - $item['title'] = empty($title) ? $item['display_url'] : $title; + $item['title'] = empty($title) && $title !== '0' ? $item['display_url'] : $title; if (!isset($item['attributes'])) { $item['attributes'] = array(); @@ -621,7 +733,7 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { // Handle "title" link attribute. if (!empty($item['attributes']['title']) && module_exists('token')) { $text_tokens = token_scan($item['attributes']['title']); - if (!empty($text_tokens)) { + if (!empty($text_tokens)) { // Load the entity (necessary for entities in views). if (isset($entity->{$property_id})) { $entity_loaded = entity_load($entity_type, array($entity->{$property_id})); @@ -630,9 +742,22 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) { else { $entity_loaded = $entity; } - $item['attributes']['title'] = token_replace($item['attributes']['title'], array($entity_token_type => $entity_loaded)); + $item['attributes']['title'] = token_replace($item['attributes']['title'], array($entity_token_type => $entity_loaded), array('clear' => TRUE)); } - $item['attributes']['title'] = filter_xss($item['attributes']['title'], array('b', 'br', 'code', 'em', 'i', 'img', 'span', 'strong', 'sub', 'sup', 'tt', 'u')); + $item['attributes']['title'] = filter_xss($item['attributes']['title'], array( + 'b', + 'br', + 'code', + 'em', + 'i', + 'img', + 'span', + 'strong', + 'sub', + 'sup', + 'tt', + 'u', + )); } // Handle attribute classes. if (!empty($item['attributes']['class'])) { @@ -684,7 +809,8 @@ function _link_parse_url($url) { * Replaces the PHP parse_str() function. * * Because parse_str replaces the following characters in query parameters name - * in order to maintain compatibility with deprecated register_globals directive: + * in order to maintain compatibility with deprecated register_globals + * directive: * * - chr(32) ( ) (space) * - chr(46) (.) (dot) @@ -731,7 +857,14 @@ function link_theme() { 'variables' => array('element' => NULL, 'field' => NULL), ), 'link_formatter_link_domain' => array( - 'variables' => array('element' => NULL, 'display' => NULL, 'field' => NULL), + 'variables' => array( + 'element' => NULL, + 'display' => NULL, + 'field' => NULL, + ), + ), + 'link_formatter_link_no_protocol' => array( + 'variables' => array('element' => NULL, 'field' => NULL), ), 'link_formatter_link_title_plain' => array( 'variables' => array('element' => NULL, 'field' => NULL), @@ -758,7 +891,7 @@ function link_theme() { * Formats a link field widget. */ function theme_link_field($vars) { - drupal_add_css(drupal_get_path('module', 'link') . '/link.css'); + drupal_add_css(drupal_get_path('module', 'link') . '/css/link.css'); $element = $vars['element']; // Prefix single value link fields with the name of the field. if (empty($element['#field']['multiple'])) { @@ -818,10 +951,24 @@ function _link_default_attributes() { * Build the form element. When creating a form using FAPI #process, * note that $element['#value'] is already set. * - * The $fields array is in $complete_form['#field_info'][$element['#field_name']]. + * The $fields array is in + * $complete_form['#field_info'][$element['#field_name']]. */ function link_field_process($element, $form_state, $complete_form) { $instance = field_widget_instance($element, $form_state); + if (!$instance) { + // The element comes from a custom form, we have to manually create the + // $instance settings. + $instance['settings'] = array ( + 'title_maxlength' => isset($element['#title_maxlength']) ? $element['#title_maxlength'] : 128, + 'title' => isset($element['#title_mode']) ? $element['#title_mode'] : 'optional', + 'title_label_use_field_label' => isset($element['#title_label_use_field_label']) ? $element['#title_label_use_field_label'] : FALSE, + 'url' => isset($element['#url']) ? $element['#url'] : 'optional', + ); + if (isset($element['#attributes'])) { + $instance['settings']['attributes'] = $element['#attributes']; + } + } $settings = $instance['settings']; $element['url'] = array( '#type' => 'textfield', @@ -830,7 +977,7 @@ function link_field_process($element, $form_state, $complete_form) { '#required' => ($element['#delta'] == 0 && $settings['url'] !== 'optional') ? $element['#required'] : FALSE, '#default_value' => isset($element['#value']['url']) ? $element['#value']['url'] : NULL, ); - if ($settings['title'] !== 'none' && $settings['title'] !== 'value') { + if (in_array($settings['title'], array('optional', 'required'))) { // Figure out the label of the title field. if (!empty($settings['title_label_use_field_label'])) { // Use the element label as the title field label. @@ -842,15 +989,31 @@ function link_field_process($element, $form_state, $complete_form) { $title_label = t('Title'); } + // Default value. + $title_maxlength = 128; + if (!empty($settings['title_maxlength'])) { + $title_maxlength = $settings['title_maxlength']; + } + $element['title'] = array( '#type' => 'textfield', - '#maxlength' => $settings['title_maxlength'], + '#maxlength' => $title_maxlength, '#title' => $title_label, - '#description' => t('The link title is limited to @maxlength characters maximum.', array('@maxlength' => $settings['title_maxlength'])), + '#description' => t('The link title is limited to @maxlength characters maximum.', array('@maxlength' => $title_maxlength)), '#required' => ($settings['title'] == 'required' && (($element['#delta'] == 0 && $element['#required']) || !empty($element['#value']['url']))) ? TRUE : FALSE, '#default_value' => isset($element['#value']['title']) ? $element['#value']['title'] : NULL, ); } + elseif ($settings['title'] == 'select') { + $options = drupal_map_assoc(array_filter(explode("\n", str_replace("\r", "\n", trim($settings['title_allowed_values']))))); + $element['title'] = array( + '#type' => 'select', + '#title' => t('Title'), + '#description' => t('Select the a title for this link.'), + '#default_value' => isset($element['#value']['title']) ? $element['#value']['title'] : NULL, + '#options' => $options, + ); + } // Initialize field attributes as an array if it is not an array yet. if (!is_array($settings['attributes'])) { @@ -887,7 +1050,8 @@ function link_field_process($element, $form_state, $complete_form) { } // If the title field is available or there are field accepts multiple values - // then allow the individual field items display the required asterisk if needed. + // then allow the individual field items display the required asterisk if + // needed. if (isset($element['title']) || isset($element['_weight'])) { // To prevent an extra required indicator, disable the required flag on the // base element since all the sub-fields are already required if desired. @@ -906,6 +1070,9 @@ function link_field_formatter_info() { 'label' => t('Title, as link (default)'), 'field types' => array('link_field'), 'multiple values' => FIELD_BEHAVIOR_DEFAULT, + 'settings' => array( + 'custom_title' => '', + ), ), 'link_title_plain' => array( 'label' => t('Title, as plain text'), @@ -940,6 +1107,11 @@ function link_field_formatter_info() { 'strip_www' => FALSE, ), ), + 'link_no_protocol' => array( + 'label' => t('URL with the protocol removed'), + 'field types' => array('link_field'), + 'multiple values' => FIELD_BEHAVIOR_DEFAULT, + ), 'link_short' => array( 'label' => t('Short, as link with title "Link"'), 'field types' => array('link_field'), @@ -972,6 +1144,14 @@ function link_field_formatter_settings_form($field, $instance, $view_mode, $form '#default_value' => $settings['strip_www'], ); } + if ($display['type'] == 'link_default') { + $element['custom_title'] = array( + '#title' => t('Override title'), + '#description' => t('Optionally override the title for the link(s).'), + '#type' => 'textfield', + '#default_value' => $settings['custom_title'], + ); + } return $element; } @@ -979,8 +1159,9 @@ function link_field_formatter_settings_form($field, $instance, $view_mode, $form * Implements hook_field_formatter_settings_summary(). */ function link_field_formatter_settings_summary($field, $instance, $view_mode) { + $display = $instance['display'][$view_mode]; - $settings = $display['settings']; + if ($display['type'] == 'link_domain') { if ($display['settings']['strip_www']) { return t('Strip www. from domain'); @@ -989,6 +1170,11 @@ function link_field_formatter_settings_summary($field, $instance, $view_mode) { return t('Leave www. in domain'); } } + if ($display['type'] == 'link_default') { + if ($display['settings']['custom_title']) { + return t('Title: %title', array('%title' => $display['settings']['custom_title'])); + } + } return ''; } @@ -998,11 +1184,16 @@ function link_field_formatter_settings_summary($field, $instance, $view_mode) { function link_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { $elements = array(); foreach ($items as $delta => $item) { + if (!empty($display['settings']['custom_title'])) { + $item['title'] = $display['settings']['custom_title']; + } $elements[$delta] = array( '#theme' => 'link_formatter_' . $display['type'], '#element' => $item, '#field' => $instance, - '#display' => $display, + '#display' => array( + 'settings' => $display['settings'], + ), ); } return $elements; @@ -1021,14 +1212,14 @@ function theme_link_formatter_link_default($vars) { } // Display a normal link if both title and URL are available. if (!empty($vars['element']['title']) && !empty($vars['element']['url'])) { - return l($vars['element']['title'], $vars['element']['url'], $link_options); + return l($vars['element']['title'], rawurldecode($vars['element']['url']), $link_options); } // If only a title, display the title. elseif (!empty($vars['element']['title'])) { - return $link_options['html'] ? $vars['element']['title'] : check_plain($vars['element']['title']); + return !empty($link_options['html']) ? $vars['element']['title'] : check_plain($vars['element']['title']); } elseif (!empty($vars['element']['url'])) { - return l($vars['element']['title'], $vars['element']['url'], $link_options); + return l($vars['element']['title'], rawurldecode($vars['element']['url']), $link_options); } } @@ -1077,11 +1268,27 @@ function theme_link_formatter_link_domain($vars) { return $vars['element']['url'] ? l($domain, $vars['element']['url'], $link_options) : ''; } +/** + * Formats a link without the http:// or https://. + */ +function theme_link_formatter_link_no_protocol($vars) { + $link_options = $vars['element']; + unset($link_options['title']); + unset($link_options['url']); + // We drop any scheme of the url. + $scheme = parse_url($vars['element']['url']); + $search = '/' . preg_quote($scheme['scheme'] . '://', '/') . '/'; + $replace = ''; + $display_url = preg_replace($search, $replace, $vars['element']['url'], 1); + + return $vars['element']['url'] ? l($display_url, $vars['element']['url'], $link_options) : ''; +} + /** * Formats a link's title as plain text. */ function theme_link_formatter_link_title_plain($vars) { - return empty($vars['element']['title']) ? '' : check_plain($vars['element']['title']); + return empty($vars['element']['title']) ? '' : check_plain(decode_entities($vars['element']['title'])); } /** @@ -1089,6 +1296,9 @@ function theme_link_formatter_link_title_plain($vars) { */ function theme_link_formatter_link_url($vars) { $link_options = $vars['element']; + if (isset($link_options['attributes']['class'])) { + $link_options['attributes']['class'] = array($link_options['attributes']['class']); + } unset($link_options['title']); unset($link_options['url']); return $vars['element']['url'] ? l($vars['element']['display_url'], $vars['element']['url'], $link_options) : ''; @@ -1111,7 +1321,12 @@ function theme_link_formatter_link_label($vars) { $link_options = $vars['element']; unset($link_options['title']); unset($link_options['url']); - return $vars['element']['url'] ? l($vars['field']['label'], $vars['element']['url'], $link_options) : ''; + $label = $vars['field']['label']; + if (function_exists('i18n_string_translate')) { + $i18n_string_name = "field:{$vars['field']['field_name']}:{$vars['field']['bundle']}:label"; + $label = i18n_string_translate($i18n_string_name, $label); + } + return $vars['element']['url'] ? l($label, $vars['element']['url'], $link_options) : ''; } /** @@ -1141,7 +1356,8 @@ function theme_link_formatter_link_separate($vars) { /** * Implements hook_token_list(). * - * @TODO: hook_token_list no longer exists - this should change to hook_token_info(). + * @TODO: hook_token_list no longer exists - this should change to + * hook_token_info(). */ function link_token_list($type = 'all') { if ($type === 'field' || $type === 'all') { @@ -1156,7 +1372,8 @@ function link_token_list($type = 'all') { /** * Implements hook_token_values(). * - * @TODO: hook_token_values no longer exists - this should change to hook_tokens(). + * @TODO: hook_token_values no longer exists - this should change to + * hook_tokens(). */ function link_token_values($type, $object = NULL) { if ($type === 'field') { @@ -1184,12 +1401,12 @@ function link_views_api() { * Forms a valid URL if possible from an entered address. * * Trims whitespace and automatically adds an http:// to addresses without a - * protocol specified + * protocol specified. * * @param string $url * The url entered by the user. * @param string $protocol - * The protocol to be prepended to the url if one is not specified + * The protocol to be prepended to the url if one is not specified. */ function link_cleanup_url($url, $protocol = 'http') { $url = trim($url); @@ -1199,9 +1416,10 @@ function link_cleanup_url($url, $protocol = 'http') { // Check if there is no protocol specified. $protocol_match = preg_match("/^([a-z0-9][a-z0-9\.\-_]*:\/\/)/i", $url); if (empty($protocol_match)) { - // But should there be? Add an automatic http:// if it starts with a domain name. - $LINK_DOMAINS = _link_domains(); - $domain_match = preg_match('/^(([a-z0-9]([a-z0-9\-_]*\.)+)(' . $LINK_DOMAINS . '|[a-z]{2}))/i', $url); + // But should there be? Add an automatic http:// if it starts with a + // domain name. + $link_domains = _link_domains(); + $domain_match = preg_match('/^(([a-z0-9]([a-z0-9\-_]*\.)+)(' . $link_domains . '|[a-z]{2}))/i', $url); if (!empty($domain_match)) { $url = $protocol . "://" . $url; } @@ -1214,16 +1432,17 @@ function link_cleanup_url($url, $protocol = 'http') { /** * Validates a URL. * - * @param $text + * @param string $text * Url to be validated. - * - * @param $langcode + * @param string $langcode * An optional language code to look up the path in. * - * @return boolean + * @return bool * True if a valid link, FALSE otherwise. */ function link_validate_url($text, $langcode = NULL) { + + $text = _link_clean_relative($text); $text = link_cleanup_url($text); $type = link_url_type($text); @@ -1252,6 +1471,31 @@ function link_validate_url($text, $langcode = NULL) { return $flag; } +/** + * Cleaner of relatives urls. + * + * @param string $url + * The url to clean up the relative protocol. + */ +function _link_clean_relative($url) { + $check = substr($url, 0, 2); + if (isset($_SERVER['HTTPS']) && + ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || + isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && + $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { + $protocol = 'https://'; + } + else { + $protocol = 'http://'; + } + + if ($check == '//') { + $url = str_replace('//', $protocol, $url); + } + + return $url; +} + /** * Type check a URL. * @@ -1267,97 +1511,133 @@ function link_validate_url($text, $langcode = NULL) { */ function link_url_type($text) { // @TODO Complete letters. - $LINK_ICHARS_DOMAIN = (string) html_entity_decode(implode("", array( - "æ", // æ - "Æ", // Æ + // @codingStandardsIgnoreStart + $link_ichars_domain = (string) html_entity_decode(implode("", array( + "¿", // ¿ "À", // À - "à", // à "Á", // Á - "á", // á "Â", //  - "â", // â - "å", // å - "Å", // Å - "ä", // ä + "Ã", // à "Ä", // Ä + "Å", // Å + "Æ", // Æ "Ç", // Ç - "ç", // ç - "Ð", // Ð - "ð", // ð "È", // È - "è", // è "É", // É - "é", // é "Ê", // Ê - "ê", // ê "Ë", // Ë - "ë", // ë + "Ì", // Ì + "Í", // Í "Î", // Î - "î", // î "Ï", // Ï - "ï", // ï - "ø", // ø - "Ø", // Ø - "ö", // ö - "Ö", // Ö + "Ð", // Ð + "Ñ", // Ñ + "Ò", // Ò + "Ó", // Ó "Ô", // Ô - "ô", // ô "Õ", // Õ + "Ö", // Ö + // × + "Ø", // Ø + "Ù", // Ù + "Ú", // Ú + "Û", // Û + "Ü", // Ü + "Ý", // Ý + "Þ", // Þ + // ß (see LINK_ICHARS) + "à", // à + "á", // á + "â", // â + "ã", // ã + "ä", // ä + "å", // å + "æ", // æ + "ç", // ç + "è", // è + "é", // é + "ê", // ê + "ë", // ë + "ì", // ì + "í", // í + "î", // î + "ï", // ï + "ð", // ð + "ñ", // ñ + "ò", // ò + "ó", // ó + "ô", // ô "õ", // õ + "ö", // ö + // ÷ + "ø", // ø + "ù", // ù + "ú", // ú + "û", // û + "ü", // ü + "ý", // ý + "þ", // þ + "ÿ", // ÿ "Œ", // Œ "œ", // œ - "ü", // ü - "Ü", // Ü - "Ù", // Ù - "ù", // ù - "Û", // Û - "û", // û "Ÿ", // Ÿ - "ÿ", // ÿ - "Ñ", // Ñ - "ñ", // ñ - "þ", // þ - "Þ", // Þ - "ý", // ý - "Ý", // Ý - "¿", // ¿ )), ENT_QUOTES, 'UTF-8'); + // @codingStandardsIgnoreEnd - $LINK_ICHARS = $LINK_ICHARS_DOMAIN . (string) html_entity_decode(implode("", array( - "ß", // ß + $link_ichars = $link_ichars_domain . (string) html_entity_decode(implode("", array( + // ß. + "ß", )), ENT_QUOTES, 'UTF-8'); - $allowed_protocols = variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal')); - $LINK_DOMAINS = _link_domains(); + $allowed_protocols = variable_get('filter_allowed_protocols', array( + 'http', + 'https', + 'ftp', + 'file', + 'news', + 'nntp', + 'telnet', + 'mailto', + 'irc', + 'ssh', + 'sftp', + 'webcal', + 'tel', + )); + $link_domains = _link_domains(); - // Starting a parenthesis group with (?: means that it is grouped, but is not captured. + // Starting a parenthesis group with (?: means that it is grouped, but is not + // captured. $protocol = '((?:' . implode("|", $allowed_protocols) . '):\/\/)'; - $authentication = "(?:(?:(?:[\w\.\-\+!$&'\(\)*\+,;=" . $LINK_ICHARS . "]|%[0-9a-f]{2})+(?::(?:[\w" . $LINK_ICHARS . "\.\-\+%!$&'\(\)*\+,;=]|%[0-9a-f]{2})*)?)?@)"; - $domain = '(?:(?:[a-z0-9' . $LINK_ICHARS_DOMAIN . ']([a-z0-9' . $LINK_ICHARS_DOMAIN . '\-_\[\]])*)(\.(([a-z0-9' . $LINK_ICHARS_DOMAIN . '\-_\[\]])+\.)*(' . $LINK_DOMAINS . '|[a-z]{2}))?)'; + $authentication = "(?:(?:(?:[\w\.\-\+!$&'\(\)*\+,;=" . $link_ichars . "]|%[0-9a-f]{2})+(?::(?:[\w" . $link_ichars . "\.\-\+%!$&'\(\)*\+,;=]|%[0-9a-f]{2})*)?)?@)"; + $domain = '(?:(?:[a-z0-9' . $link_ichars_domain . ']([a-z0-9' . $link_ichars_domain . '\-_\[\]])*)(\.(([a-z0-9' . $link_ichars_domain . '\-_\[\]])+\.)*(' . $link_domains . '|[a-z]{2}))?)'; $ipv4 = '(?:[0-9]{1,3}(\.[0-9]{1,3}){3})'; $ipv6 = '(?:[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7})'; $port = '(?::([0-9]{1,5}))'; - // Pattern specific to external links. $external_pattern = '/^' . $protocol . '?' . $authentication . '?(' . $domain . '|' . $ipv4 . '|' . $ipv6 . ' |localhost)' . $port . '?'; // Pattern specific to internal links. - $internal_pattern = "/^(?:[a-z0-9" . $LINK_ICHARS . "_\-+\[\] ]+)"; - $internal_pattern_file = "/^(?:[a-z0-9" . $LINK_ICHARS . "_\-+\[\]\. \/\(\)][a-z0-9" . $LINK_ICHARS . "_\-+\[\]\. \(\)][a-z0-9" . $LINK_ICHARS . "_\-+\[\]\. \/\(\)]+)$/i"; + $internal_pattern = "/^(?:[a-z0-9" . $link_ichars . "_\-+\[\] ]+)"; + $internal_pattern_file = "/^(?:[a-z0-9" . $link_ichars . "_\-+\[\]\. \/\(\)][a-z0-9" . $link_ichars . "_\-+\[\]\. \(\)][a-z0-9" . $link_ichars . "_\-+\[\]\. \/\(\)]+)$/i"; - $directories = "(?:\/[a-z0-9" . $LINK_ICHARS . "_\-\.~+%=&,$'#!():;*@\[\]]*)*"; + $directories = "(?:\/[a-z0-9" . $link_ichars . "_\-\.~+%=&,$'#!():;*@\[\]]*)*"; // Yes, four backslashes == a single backslash. - $query = "(?:\/?\?([?a-z0-9" . $LINK_ICHARS . "+_|\-\.~\/\\\\%=&,$'!():;*@\[\]{} ]*))"; - $anchor = "(?:#[a-z0-9" . $LINK_ICHARS . "_\-\.~+%=&,$'():;*@\[\]\/\?]*)"; + $query = "(?:\/?\?([?a-zA-Z0-9" . $link_ichars . "+_|\-\.~\/\\\\%=&,$'!():;*@\[\]{} ]*))"; + $anchor = "(?:#[a-zA-Z0-9" . $link_ichars . "_\-\.~+%=&,$'():;*@\[\]\/\?]*)"; // The rest of the path for a standard URL. + // @codingStandardsIgnoreLine $end = $directories . '?' . $query . '?' . $anchor . '?' . '$/i'; $message_id = '[^@].*@' . $domain; $newsgroup_name = '(?:[0-9a-z+-]*\.)*[0-9a-z+-]*'; $news_pattern = '/^news:(' . $newsgroup_name . '|' . $message_id . ')$/i'; - $user = '[a-zA-Z0-9' . $LINK_ICHARS . '_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\'\[\]]+'; + $user = '[a-zA-Z0-9' . $link_ichars . '_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\'\[\]]+'; $email_pattern = '/^mailto:' . $user . '@' . '(?:' . $domain . '|' . $ipv4 . '|' . $ipv6 . '|localhost)' . $query . '?$/'; + $tel_pattern = '/^tel:(?:\+[1-9]\d{1,14}|\d{2,15})$/'; + + $file_pattern = "/^(?:file:\/\/)" . "(?:\/?[a-z0-9" . $link_ichars . "_\-\.\\\~+%=&,$'#!():;*@\[\]]*)*" . '$/i'; if (strpos($text, '') === 0) { return LINK_FRONT; @@ -1365,12 +1645,37 @@ function link_url_type($text) { if (in_array('mailto', $allowed_protocols) && preg_match($email_pattern, $text)) { return LINK_EMAIL; } + if (strpos($text, '#') === 0) { + return LINK_FRAGMENT; + } + if (strpos($text, '?') === 0) { + return LINK_QUERY; + } + if (in_array('tel', $allowed_protocols) && strpos($text, 'tel:') === 0) { + if (preg_match($tel_pattern, $text)) { + // Based on our tel pattern this is a 'valid' phone number so return tel + // type. + return LINK_TEL; + } + else { + // Based on our tel pattern this is using the tel protocol, but is not a + // 'valid' phone number. If we don't return false here $text will match + // LINK_EXTERNAL which is incorrect. + return FALSE; + } + } if (in_array('news', $allowed_protocols) && preg_match($news_pattern, $text)) { return LINK_NEWS; } + if (in_array('file', $allowed_protocols) && preg_match($file_pattern, $text, $as)) { + return LINK_FILE; + } if (preg_match($internal_pattern . $end, $text)) { return LINK_INTERNAL; } + if (drupal_valid_path($text) && url_is_external($text) == FALSE) { + return LINK_INTERNAL; + } if (preg_match($external_pattern . $end, $text)) { return LINK_EXTERNAL; } @@ -1402,7 +1707,15 @@ function link_content_migrate_field_alter(&$field_value, $instance_value) { // Adjust the field type. $field_value['type'] = 'link_field'; // Remove settings that are now on the instance. - foreach (array('attributes', 'display', 'url', 'title', 'title_value', 'enable_tokens', 'validate_url') as $setting) { + foreach (array( + 'attributes', + 'display', + 'url', + 'title', + 'title_value', + 'enable_tokens', + 'validate_url', + ) as $setting) { unset($field_value['settings'][$setting]); } } @@ -1416,7 +1729,15 @@ function link_content_migrate_field_alter(&$field_value, $instance_value) { function link_content_migrate_instance_alter(&$instance_value, $field_value) { if ($field_value['type'] == 'link') { // Grab settings that were previously on the field. - foreach (array('attributes', 'display', 'url', 'title', 'title_value', 'enable_tokens', 'validate_url') as $setting) { + foreach (array( + 'attributes', + 'display', + 'url', + 'title', + 'title_value', + 'enable_tokens', + 'validate_url', + ) as $setting) { if (isset($field_value['settings'][$setting])) { $instance_value['settings'][$setting] = $field_value['settings'][$setting]; } @@ -1427,7 +1748,15 @@ function link_content_migrate_instance_alter(&$instance_value, $field_value) { } // Adjust formatter types. foreach ($instance_value['display'] as $context => $settings) { - if (in_array($settings['type'], array('default', 'title_plain', 'url', 'plain', 'short', 'label', 'separate'))) { + if (in_array($settings['type'], array( + 'default', + 'title_plain', + 'url', + 'plain', + 'short', + 'label', + 'separate', + ))) { $instance_value['display'][$context]['type'] = 'link_' . $settings['type']; } } @@ -1457,8 +1786,8 @@ function link_field_property_info_callback(&$info, $entity_type, $field, $instan $property['auto creation'] = 'link_field_item_create'; $property['property info'] = link_field_item_property_info(); - $property['property info']['url']['required'] = !$instance['settings']['url']; - $property['property info']['title']['required'] = ($instance['settings']['title'] == 'required'); + $property['property info']['url']['required'] = $instance['required'] && !$instance['settings']['url']; + $property['property info']['title']['required'] = $instance['required'] && ($instance['settings']['title'] == 'required'); if ($instance['settings']['title'] == 'none') { unset($property['property info']['title']); } @@ -1471,7 +1800,7 @@ function link_field_property_info_callback(&$info, $entity_type, $field, $instan * @see link_field_property_info_callback() */ function link_field_item_create() { - return array('title' => NULL, 'url' => NULL); + return array('title' => NULL, 'url' => NULL, 'display_url' => NULL); } /** @@ -1484,7 +1813,7 @@ function link_field_item_property_info() { 'setter callback' => 'entity_property_verbatim_set', ); $properties['url'] = array( - 'type' => 'uri', + 'type' => 'text', 'label' => t('The URL of the link.'), 'setter callback' => 'entity_property_verbatim_set', ); @@ -1494,6 +1823,11 @@ function link_field_item_property_info() { 'setter callback' => 'entity_property_verbatim_set', 'getter callback' => 'link_attribute_property_get', ); + $properties['display_url'] = array( + 'type' => 'uri', + 'label' => t('The full URL of the link.'), + 'setter callback' => 'entity_property_verbatim_set', + ); return $properties; } @@ -1508,7 +1842,7 @@ function link_attribute_property_get($data, array $options, $name, $type, $info) * Implements hook_field_update_instance(). */ function link_field_update_instance($instance, $prior_instance) { - if (function_exists('i18n_string_update') && $instance['widget']['type'] == 'link_field' && $prior_instance['settings']['title_value'] != $instance['settings']['title_value']) { + if (function_exists('i18n_string_update') && isset($instance['widget']) && $instance['widget']['type'] == 'link_field' && $prior_instance['settings']['title_value'] != $instance['settings']['title_value']) { $i18n_string_name = "field:{$instance['field_name']}:{$instance['bundle']}:title_value"; i18n_string_update($i18n_string_name, $instance['settings']['title_value']); } diff --git a/sites/all/modules/contrib/fields/link/tests/link.attribute.test b/sites/all/modules/contrib/fields/link/tests/link.attribute.test index 47658144..f66a0e6e 100644 --- a/sites/all/modules/contrib/fields/link/tests/link.attribute.test +++ b/sites/all/modules/contrib/fields/link/tests/link.attribute.test @@ -5,7 +5,11 @@ * Basic simpletests to test options on link module. */ +/** + * Attribute Crud Test. + */ class LinkAttributeCrudTest extends DrupalWebTestCase { + private $zebra; protected $permissions = array( @@ -19,6 +23,9 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { 'access administration pages', ); + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link Attribute Tests', @@ -27,16 +34,23 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ); } - function setup() { + /** + * Setup. + */ + public function setup() { parent::setup('field_ui', 'link'); $this->zebra = 0; // Create and login user. - $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); - $perms = array_keys($perms[array_search('administrator', user_roles())]); - $admin = $this->drupalCreateUser($perms); - $this->drupalLogin($admin); + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + )); + $this->drupalLogin($this->web_user); } + /** + * Create Link. + */ protected function createLink($url, $title, $attributes = array()) { return array( 'url' => $url, @@ -45,20 +59,26 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ); } + /** + * Assert Link On Node. + */ protected function assertLinkOnNode($field_name, $link_value, $message = '', $group = 'Other') { $this->zebra++; $zebra_string = ($this->zebra % 2 == 0) ? 'even' : 'odd'; $cssFieldLocator = 'field-' . str_replace('_', '-', $field_name); $this->assertPattern('@@is', - $message, - $group); + $message, + $group); } /** - * A simple test that just creates a new node type, adds a link field to it, creates a new node of that type, and makes sure - * that the node is being displayed. + * Test Basic. + * + * A simple test that just creates a new node type, adds a link field to it, + * creates a new node of that type, and makes sure that the node is being + * displayed. */ - function testBasic() { + public function testBasic() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); $title = $this->randomName(20); @@ -78,7 +98,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - $single_field_name = 'field_' . $single_field_name_machine; + $edit = array( 'fields[_add_new_field][label]' => $single_field_name_friendly, 'fields[_add_new_field][field_name]' => $single_field_name_machine, @@ -103,7 +123,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { $this->assertTrue($type_exists, 'The new content type has been created in the database.'); $permission = 'create ' . $content_type_machine . ' content'; - $permission_edit = 'edit ' . $content_type_machine . ' content'; + // Reset the permissions cache. $this->checkPermissions(array($permission), TRUE); @@ -124,7 +144,10 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ); $this->drupalPost(NULL, $edit, t('Save')); - $this->assertText(t('@content_type_friendly @title has been created', array('@content_type_friendly' => $content_type_friendly, '@title' => $title))); + $this->assertText(t('@content_type_friendly @title has been created', array( + '@content_type_friendly' => $content_type_friendly, + '@title' => $title, + ))); $this->drupalGet('node/add/' . $content_type_machine); @@ -137,12 +160,18 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now we can fill in the second item in the multivalue field and save. $this->drupalPost(NULL, $edit, t('Save')); - $this->assertText(t('@content_type_friendly @title has been created', array('@content_type_friendly' => $content_type_friendly, '@title' => $title))); + $this->assertText(t('@content_type_friendly @title has been created', array( + '@content_type_friendly' => $content_type_friendly, + '@title' => $title, + ))); $this->assertText('Display'); $this->assertLinkByHref('http://www.example.com'); } + /** + * Create Simple Link Field. + */ protected function createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine) { $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/fields'); $edit = array( @@ -168,9 +197,11 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { $this->assertTrue($type_exists, 'The new content type has been created in the database.'); } + /** + * Create Node Type User. + */ protected function createNodeTypeUser($content_type_machine) { $permission = 'create ' . $content_type_machine . ' content'; - $permission_edit = 'edit ' . $content_type_machine . ' content'; // Reset the permissions cache. $this->checkPermissions(array($permission), TRUE); @@ -181,6 +212,9 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { $this->drupalLogin($this->web_user); } + /** + * Create Node For Testing. + */ protected function createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $title, $url, $node_title = '') { $this->drupalGet('node/add/' . $content_type_machine); @@ -198,14 +232,17 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { } $this->drupalPost(NULL, $edit, t('Save')); - $this->assertText(t('@content_type_friendly @title has been created', array('@content_type_friendly' => $content_type_friendly, '@title' => $node_title))); + $this->assertText(t('@content_type_friendly @title has been created', array( + '@content_type_friendly' => $content_type_friendly, + '@title' => $node_title, + ))); } /** * Test the link_plain formatter and it's output. */ - function testFormatterPlain() { + public function testFormatterPlain() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); @@ -217,7 +254,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); // Okay, now we want to make sure this display is changed: @@ -229,7 +266,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { $this->drupalPost(NULL, $edit, t('Save')); $this->createNodeTypeUser($content_type_machine); - + $link_tests = array( 'plain' => array( 'text' => 'Display', @@ -245,18 +282,21 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ), ); - foreach ($link_tests as $key => $link_test) { + foreach ($link_tests as $link_test) { $link_text = $link_test['text']; $link_url = $link_test['url']; $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url); - + $this->assertText($link_url); $this->assertNoText($link_text); $this->assertNoLinkByHref($link_url); } } - function testFormatterHost() { + /** + * Formatter Host. + */ + public function testFormatterHost() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); @@ -265,18 +305,17 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { 'name' => $content_type_friendly, )); - // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); // Okay, now we want to make sure this display is changed: - $this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display'); + $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display'); $edit = array( - 'fields[field_'. $single_field_name_machine .'][label]' => 'above', - 'fields[field_'. $single_field_name_machine .'][type]' => 'link_host', + 'fields[field_' . $single_field_name_machine . '][label]' => 'above', + 'fields[field_' . $single_field_name_machine . '][type]' => 'link_host', ); $this->drupalPost(NULL, $edit, t('Save')); @@ -291,7 +330,13 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { $this->assertNoLinkByHref($link_url); } - function testFormatterURL() { + /** + * Formatter URL. + * + * @codingStandardsIgnoreStart + */ + public function testFormatterURL() { + // @codingStandardsIgnoreEnd $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); @@ -303,7 +348,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); // Okay, now we want to make sure this display is changed: @@ -315,7 +360,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { $this->drupalPost(NULL, $edit, t('Save')); $this->createNodeTypeUser($content_type_machine); - + $link_tests = array( 'plain' => array( 'text' => 'Display', @@ -331,17 +376,20 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ), ); - foreach ($link_tests as $key => $link_test) { + foreach ($link_tests as $link_test) { $link_text = $link_test['text']; $link_url = $link_test['url']; $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url); - + $this->assertNoText($link_text); $this->assertLinkByHref($link_url); } } - function testFormatterShort() { + /** + * Formatter Short. + */ + public function testFormatterShort() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); @@ -353,7 +401,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); // Okay, now we want to make sure this display is changed: @@ -381,18 +429,21 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ), ); - foreach ($link_tests as $key => $link_test) { + foreach ($link_tests as $link_test) { $link_text = $link_test['text']; $link_url = $link_test['url']; $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url); - + $this->assertText('Link'); $this->assertNoText($link_text); $this->assertLinkByHref($link_url); } } - function testFormatterLabel() { + /** + * Formatter Label. + */ + public function testFormatterLabel() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); @@ -404,7 +455,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); // Okay, now we want to make sure this display is changed: @@ -432,18 +483,21 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ), ); - foreach ($link_tests as $key => $link_test) { + foreach ($link_tests as $link_test) { $link_text = $link_test['text']; - $link_url = $link_test['url']; + $link_url = $link_test['url']; $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url); - + $this->assertNoText($link_text); $this->assertText($single_field_name_friendly); $this->assertLinkByHref($link_url); } } - function testFormatterSeparate() { + /** + * Formatter Separate. + */ + public function testFormatterSeparate() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); @@ -455,7 +509,7 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); // Okay, now we want to make sure this display is changed: @@ -484,32 +538,35 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { ), ); - foreach ($link_tests as $key => $link_test) { + foreach ($link_tests as $link_test) { $link_text = $link_test['text']; $link_url = $link_test['url']; $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url); - + $this->assertText($link_text); $this->assertLink($plain_url); $this->assertLinkByHref($link_url); } } - - function testFormatterPlainTitle() { + + /** + * Formatter Plain Title. + */ + public function testFormatterPlainTitle() { $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); - + $this->drupalCreateContentType(array( 'type' => $content_type_machine, 'name' => $content_type_friendly, )); - + // Now add a singleton field. $single_field_name_friendly = $this->randomName(20); $single_field_name_machine = strtolower($this->randomName(10)); - //$single_field_name = 'field_'. $single_field_name_machine; + // $single_field_name = 'field_'. $single_field_name_machine;. $this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); - + // Okay, now we want to make sure this display is changed: $this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display'); $edit = array( @@ -517,15 +574,16 @@ class LinkAttributeCrudTest extends DrupalWebTestCase { 'fields[field_' . $single_field_name_machine . '][type]' => 'link_title_plain', ); $this->drupalPost(NULL, $edit, t('Save')); - + $this->createNodeTypeUser($content_type_machine); - + $link_text = 'Display'; $link_url = 'http://www.example.com/'; $this->createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $link_text, $link_url); - + $this->assertText($link_text); $this->assertNoText($link_url); $this->assertNoLinkByHref($link_url); } + } diff --git a/sites/all/modules/contrib/fields/link/tests/link.crud.test b/sites/all/modules/contrib/fields/link/tests/link.crud.test index 5f12840a..6bc38674 100644 --- a/sites/all/modules/contrib/fields/link/tests/link.crud.test +++ b/sites/all/modules/contrib/fields/link/tests/link.crud.test @@ -2,11 +2,20 @@ /** * @file - * Basic CRUD simpletests for the link module, based off of content.crud.test in CCK. + * File for Crud Tests. + * + * Basic CRUD simpletests for the link module, based off of content.crud.test in + * CCK. */ +/** + * Content Crud. + */ class LinkContentCrudTest extends DrupalWebTestCase { + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link CRUD - Basic API tests', @@ -15,24 +24,32 @@ class LinkContentCrudTest extends DrupalWebTestCase { ); } - function setUp() { + /** + * Setup. + */ + public function setUp() { parent::setUp('field_ui', 'link'); } /** - * All we're doing here is creating a content type, creating a simple link field - * on that content type. + * Create Field API. + * + * All we're doing here is creating a content type, creating a simple link + * field on that content type. + * + * @codingStandardsIgnoreStart */ - function testLinkCreateFieldAPI() { + public function testLinkCreateFieldAPI() { + // @codingStandardsIgnoreEnd $content_type_friendly = $this->randomName(20); $content_type_machine = strtolower($this->randomName(10)); - $title = $this->randomName(20); // Create and login user. - $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); - $perms = array_keys($perms[array_search('administrator', user_roles())]); - $admin = $this->drupalCreateUser($perms); - $this->drupalLogin($admin); + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + )); + $this->drupalLogin($this->web_user); $this->drupalGet('admin/structure/types'); @@ -71,4 +88,5 @@ class LinkContentCrudTest extends DrupalWebTestCase { $type_exists = db_query('SELECT 1 FROM {node_type} WHERE type = :type', array(':type' => $content_type_machine))->fetchField(); $this->assertTrue($type_exists, 'The new content type has been created in the database.'); } + } diff --git a/sites/all/modules/contrib/fields/link/tests/link.crud_browser.test b/sites/all/modules/contrib/fields/link/tests/link.crud_browser.test index 803169b9..dc218573 100644 --- a/sites/all/modules/contrib/fields/link/tests/link.crud_browser.test +++ b/sites/all/modules/contrib/fields/link/tests/link.crud_browser.test @@ -6,25 +6,28 @@ */ /** - * Testing that users can not input bad URLs or labels + * Testing that users can not input bad URLs or labels. */ class LinkUITest extends DrupalWebTestcase { /** - * Link supposed to be good + * Link supposed to be good. */ const LINK_INPUT_TYPE_GOOD = 0; /** - * Link supposed to have a bad title + * Link supposed to have a bad title. */ const LINK_INPUT_TYPE_BAD_TITLE = 1; /** - * Link supposed to have a bad URL + * Link supposed to have a bad URL. */ const LINK_INPUT_TYPE_BAD_URL = 2; + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link CRUD - browser test', @@ -33,22 +36,30 @@ class LinkUITest extends DrupalWebTestcase { ); } - function setUp() { + /** + * Setup. + */ + public function setUp() { parent::setUp('field_ui', 'link'); } /** * Creates a link field for the "page" type and creates a page with a link. */ - function testLinkCreate() { - //libxml_use_internal_errors(true); - $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); - $perms = array_keys($perms[array_search('administrator', user_roles())]); - $admin = $this->drupalCreateUser($perms); - $this->drupalLogin($admin); + public function testLinkCreate() { + // libxml_use_internal_errors(true); + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'administer nodes', + 'administer filters', + 'access content', + 'create page content', + 'access administration pages', + )); + $this->drupalLogin($this->web_user); - - // create field + // Create field. $name = strtolower($this->randomName()); $edit = array( 'fields[_add_new_field][label]' => $name, @@ -68,8 +79,8 @@ class LinkUITest extends DrupalWebTestcase { $permission = 'create page content'; $this->checkPermissions(array($permission), TRUE); - // create page form - //$this->drupalGet('node/add'); + // Create page form + // $this->drupalGet('node/add');. $this->drupalGet('node/add/page'); $field_name = 'field_' . $name; $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found'); @@ -80,37 +91,37 @@ class LinkUITest extends DrupalWebTestcase { 'href' => 'http://example.com/' . $this->randomName(), 'label' => $this->randomName(), 'msg' => 'Link found', - 'type' => self::LINK_INPUT_TYPE_GOOD + 'type' => self::LINK_INPUT_TYPE_GOOD, ), array( 'href' => 'http://example.com/' . $this->randomName(), 'label' => $this->randomName() . '', 'msg' => 'js label', - 'type' => self::LINK_INPUT_TYPE_BAD_TITLE + 'type' => self::LINK_INPUT_TYPE_BAD_TITLE, ), array( 'href' => 'http://example.com/' . $this->randomName(), 'label' => $this->randomName() . '', 'msg' => 'js label', - 'type' => self::LINK_INPUT_TYPE_BAD_TITLE + 'type' => self::LINK_INPUT_TYPE_BAD_TITLE, ), array( 'href' => 'http://example.com/' . $this->randomName(), 'label' => $this->randomName() . '" onmouseover="alert(\'hi\')', 'msg' => 'js label', - 'type' => self::LINK_INPUT_TYPE_BAD_TITLE + 'type' => self::LINK_INPUT_TYPE_BAD_TITLE, ), array( 'href' => 'http://example.com/' . $this->randomName(), 'label' => $this->randomName() . '\' onmouseover="alert(\'hi\')', 'msg' => 'js label', - 'type' => self::LINK_INPUT_TYPE_BAD_TITLE + 'type' => self::LINK_INPUT_TYPE_BAD_TITLE, ), array( 'href' => 'javascript:alert("http://example.com/' . $this->randomName() . '")', 'label' => $this->randomName(), 'msg' => 'js url', - 'type' => self::LINK_INPUT_TYPE_BAD_URL + 'type' => self::LINK_INPUT_TYPE_BAD_URL, ), array( 'href' => 'http://ecs-es.kelkoo.es/ctl/go/sitesearchGo?.ts=1338833010331&.sig=qP9GXeEFH6syBzwmzYkxmsvp1EI-', @@ -129,7 +140,7 @@ class LinkUITest extends DrupalWebTestcase { $input_test_cases[] = $test_case; foreach ($input_test_cases as $input) { - $this->drupalLogin($admin); + $this->drupalLogin($this->web_user); $this->drupalGet('node/add/page'); $edit = array( @@ -139,23 +150,26 @@ class LinkUITest extends DrupalWebTestcase { ); $this->drupalPost(NULL, $edit, t('Save')); if ($input['type'] == self::LINK_INPUT_TYPE_BAD_URL) { - $this->assertRaw(t('The value %value provided for %field is not a valid URL.', array('%field' => $name, '%value' => trim($input['href']))), 'Not a valid URL: ' . $input['href']); + $this->assertRaw(t('The value %value provided for %field is not a valid URL.', array( + '%field' => $name, + '%value' => trim($input['href']), + )), 'Not a valid URL: ' . $input['href']); continue; } else { $this->assertRaw(' ' . t('has been created.', - array('@type' => 'Basic Page', '%title' => $edit['title'])), - 'Page created: ' . $input['href']); + array('@type' => 'Basic Page', '%title' => $edit['title'])), + 'Page created: ' . $input['href']); } $url = $this->getUrl(); - // change to Anonymous user. + // Change to Anonymous user. $this->drupalLogout(); $this->drupalGet($url); - //debug($this); - // If simpletest starts using something to override the error system, this will flag - // us and let us know it's broken. + // debug($this); + // If simpletest starts using something to override the error system, this + // will flag us and let us know it's broken. $this->assertFalse(libxml_use_internal_errors(TRUE)); if (isset($input['expected_href'])) { $path = '//a[@href="' . $input['expected_href'] . '" and text()="' . $input['label'] . '"]'; @@ -167,20 +181,27 @@ class LinkUITest extends DrupalWebTestcase { libxml_use_internal_errors(FALSE); $this->assertIdentical(isset($elements[0]), $input['type'] == self::LINK_INPUT_TYPE_GOOD, $input['msg']); } - //libxml_use_internal_errors(FALSE); + // libxml_use_internal_errors(FALSE); } /** + * Static Link Create. + * * Testing that if you use in a static title for your link, that the * title actually displays . */ - function testStaticLinkCreate() { - $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); - $perms = array_keys($perms[array_search('administrator', user_roles())]); - $admin = $this->drupalCreateUser($perms); - $this->drupalLogin($admin); + public function testStaticLinkCreate() { - // create field + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'access content', + 'create page content', + )); + + $this->drupalLogin($this->web_user); + + // Create field. $name = strtolower($this->randomName()); $field_name = 'field_' . $name; $edit = array( @@ -193,17 +214,18 @@ class LinkUITest extends DrupalWebTestcase { $this->drupalPost(NULL, array(), t('Save field settings')); $this->drupalPost(NULL, array( 'instance[settings][title]' => 'value', - 'instance[settings][title_value]' => '' . $name . ''), t('Save settings')); + 'instance[settings][title_value]' => '' . $name . '', + ), t('Save settings')); // Is field created? $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added'); - // create page form + // Create page form. $this->drupalGet('node/add/page'); $this->assertField($field_name . '[und][0][url]', 'URL found'); $input = array( - 'href' => 'http://example.com/' . $this->randomName() + 'href' => 'http://example.com/' . $this->randomName(), ); $edit = array( @@ -214,23 +236,32 @@ class LinkUITest extends DrupalWebTestcase { $url = $this->getUrl(); - // change to anonymous user + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); $this->assertRaw(l('' . $name . '', $input['href'], array('html' => TRUE))); } - - /** - * Testing that if you have the title but no url, the title is not sanitized twice. - */ - function testCRUDTitleOnlyTitleNoLink() { - $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); - $perms = array_keys($perms[array_search('administrator', user_roles())]); - $admin = $this->drupalCreateUser($perms); - $this->drupalLogin($admin); - // create field + /** + * CRUD Title Only Title No Link. + * + * Testing that if you have the title but no url, the title is not sanitized + * twice. + * + * @codingStandardsIgnoreStart + */ + public function testCRUDTitleOnlyTitleNoLink() { + // @codingStandardsIgnoreEnd + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'access content', + 'create page content', + )); + $this->drupalLogin($this->web_user); + + // Create field. $name = strtolower($this->randomName()); $field_name = 'field_' . $name; $edit = array( @@ -247,8 +278,8 @@ class LinkUITest extends DrupalWebTestcase { // Is field created? $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added'); - - // create page form + + // Create page form. $this->drupalGet('node/add/page'); $this->assertField($field_name . '[und][0][url]', 'URL found'); @@ -265,8 +296,8 @@ class LinkUITest extends DrupalWebTestcase { $this->drupalPost(NULL, $edit, t('Save')); $url = $this->getUrl(); - - // change to anonymous user + + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); @@ -274,16 +305,26 @@ class LinkUITest extends DrupalWebTestcase { } /** - * If we're creating a new field and just hit 'save' on the default options, we want to make - * sure they are set to the expected results. + * CRUD Create Field Defaults. + * + * If we're creating a new field and just hit 'save' on the default options, + * we want to make sure they are set to the expected results. + * + * @codingStandardsIgnoreStart */ - function testCRUDCreateFieldDefaults() { - $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); - $perms = array_keys($perms[array_search('administrator', user_roles())]); - $admin = $this->drupalCreateUser($perms); - $this->drupalLogin($admin); + public function testCRUDCreateFieldDefaults() { + // @codingStandardsIgnoreEnd - // create field + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'access content', + 'create page content', + )); + + $this->drupalLogin($this->web_user); + + // Create field. $name = strtolower($this->randomName()); $edit = array( 'fields[_add_new_field][label]' => $name, @@ -314,18 +355,26 @@ class LinkUITest extends DrupalWebTestcase { $this->assertFalse($instance['settings']['attributes']['class'], 'By default, no class should be set.'); $this->assertFalse($instance['settings']['title_value'], 'By default, no title should be set.'); } - - /** - * If we're creating a new field and just hit 'save' on the default options, we want to make - * sure they are set to the expected results. - */ - function testCRUDCreateFieldWithClass() { - $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); - $perms = array_keys($perms[array_search('administrator', user_roles())]); - $admin = $this->drupalCreateUser($perms); - $this->drupalLogin($admin); - // create field + /** + * CRUD Create Field With Class. + * + * If we're creating a new field and just hit 'save' on the default options, + * we want to make sure they are set to the expected results. + * + * @codingStandardsIgnoreStart + */ + public function testCRUDCreateFieldWithClass() { + // @codingStandardsIgnoreEnd + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'access content', + 'create page content', + )); + $this->drupalLogin($this->web_user); + + // Create field. $name = strtolower($this->randomName()); $edit = array( 'fields[_add_new_field][label]' => $name, @@ -360,9 +409,9 @@ class LinkUITest extends DrupalWebTestcase { $this->assertFalse($instance['settings']['attributes']['rel'], 'Rel should be blank by default.'); $this->assertEqual($instance['settings']['attributes']['class'], $link_class_name, 'One class should be set.'); $this->assertFalse($instance['settings']['title_value'], 'By default, no title should be set.'); - + // Now, let's create a node with this field and make sure the link shows up: - // create page form + // create page form. $field_name = 'field_' . $name; $this->drupalGet('node/add/page'); $this->assertField($field_name . '[und][0][url]', 'URL found'); @@ -380,8 +429,8 @@ class LinkUITest extends DrupalWebTestcase { $this->drupalPost(NULL, $edit, t('Save')); $url = $this->getUrl(); - - // change to anonymous user + + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); @@ -389,17 +438,25 @@ class LinkUITest extends DrupalWebTestcase { $this->assertPattern('|class\s?=\s?"' . $link_class_name . '"|', "Class $link_class_name exists on page."); } -/** - * If we're creating a new field and just hit 'save' on the default options, we want to make - * sure they are set to the expected results. + /** + * CRUD Create Field With Two Classes. + * + * If we're creating a new field and just hit 'save' on the default options, + * we want to make sure they are set to the expected results. + * + * @codingStandardsIgnoreStart */ - function testCRUDCreateFieldWithTwoClasses() { - $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); - $perms = array_keys($perms[array_search('administrator', user_roles())]); - $admin = $this->drupalCreateUser($perms); - $this->drupalLogin($admin); + public function testCRUDCreateFieldWithTwoClasses() { + // @codingStandardsIgnoreEnd + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'access content', + 'create page content', + )); + $this->drupalLogin($this->web_user); - // create field + // Create field. $name = strtolower($this->randomName()); $edit = array( 'fields[_add_new_field][label]' => $name, @@ -434,9 +491,9 @@ class LinkUITest extends DrupalWebTestcase { $this->assertFalse($instance['settings']['attributes']['rel'], 'Rel should be blank by default.'); $this->assertEqual($instance['settings']['attributes']['class'], $link_class_name, 'Two classes should be set.'); $this->assertFalse($instance['settings']['title_value'], 'By default, no title should be set.'); - + // Now, let's create a node with this field and make sure the link shows up: - // create page form + // create page form. $field_name = 'field_' . $name; $this->drupalGet('node/add/page'); $this->assertField($field_name . '[und][0][url]', 'URL found'); @@ -454,12 +511,13 @@ class LinkUITest extends DrupalWebTestcase { $this->drupalPost(NULL, $edit, t('Save')); $url = $this->getUrl(); - - // change to anonymous user + + // Change to anonymous user. $this->drupalLogout(); $this->drupalGet($url); $this->assertRaw('This & That'); $this->assertPattern('|class\s?=\s?"' . $link_class_name . '"|', "Classes $link_class_name exist on page."); } + } diff --git a/sites/all/modules/contrib/fields/link/tests/link.entity_token.test b/sites/all/modules/contrib/fields/link/tests/link.entity_token.test index 1f51fab4..6c42655f 100644 --- a/sites/all/modules/contrib/fields/link/tests/link.entity_token.test +++ b/sites/all/modules/contrib/fields/link/tests/link.entity_token.test @@ -6,10 +6,13 @@ */ /** - * Testing that tokens can be used in link titles + * Testing that tokens can be used in link titles. */ class LinkEntityTokenTest extends LinkBaseTestClass { + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link entity tokens test', @@ -19,24 +22,27 @@ class LinkEntityTokenTest extends LinkBaseTestClass { ); } - function setUp($modules = array()) { + /** + * Setup. + */ + public function setUp($modules = array()) { parent::setUp(array('token', 'entity', 'entity_token')); } - + /** * Creates a link field, fills it, then uses a loaded node to test tokens. */ - function testFieldTokenNodeLoaded() { - // create field + public function testFieldTokenNodeLoaded() { + // Create field. $settings = array( 'instance[settings][enable_tokens]' => 0, ); $field_name = $this->createLinkField('page', - $settings); + $settings); - // create page form + // Create page form. $this->drupalGet('node/add/page'); - //$field_name = 'field_' . $name; + // $field_name = 'field_' . $name;. $this->assertField($field_name . '[und][0][title]', 'Title found'); $this->assertField($field_name . '[und][0][url]', 'URL found'); @@ -58,11 +64,11 @@ class LinkEntityTokenTest extends LinkBaseTestClass { 'label' => $this->randomName(), ), ); - //$this->assert('pass', '
    ' . print_r($token_url_tests, TRUE) . '
    ');
    -
    +    // @codingStandardsIgnoreLine
    +    // $this->assert('pass', '
    ' . print_r($token_url_tests, TRUE) . '
    ');.
         foreach ($token_url_tests as &$input) {
           $this->drupalGet('node/add/page');
    -  
    +
           $edit = array(
             'title' => $input['label'],
             $field_name . '[und][0][title]' => $input['label'],
    @@ -73,34 +79,37 @@ class LinkEntityTokenTest extends LinkBaseTestClass {
           $input['url'] = $url;
         }
     
    -    // change to anonymous user
    +    // Change to anonymous user.
         $this->drupalLogout();
    -    
    +
         foreach ($token_url_tests as $index => $input2) {
           $node = node_load($index);
           $this->assertNotEqual(NULL, $node, "Do we have a node?");
           $this->assertEqual($node->nid, $index, "Test that we have a node.");
           $token_name = '[node:' . str_replace('_', '-', $field_name) . ':url]';
           $assert_data = token_replace($token_name,
    -                      array('node' => $node));
    +        array('node' => $node));
           $this->assertEqual($input2['href'], $assert_data, "Test that the url token has been set to " . $input2['href'] . ' - ' . $assert_data);
         }
       }
    -  
    +
       /**
    -   * Creates a link field, fills it, then uses a loaded and node_view'd node to test tokens.
    +   * Field Token Node Viewed.
    +   *
    +   * Creates a link field, fills it, then uses a loaded and node_view'd node to
    +   * test tokens.
        */
    -  function testFieldTokenNodeViewed() {
    -    // create field
    +  public function testFieldTokenNodeViewed() {
    +    // Create field.
         $settings = array(
           'instance[settings][enable_tokens]' => 0,
         );
         $field_name = $this->createLinkField('page',
    -                                        $settings);
    +      $settings);
     
    -    // create page form
    +    // Create page form.
         $this->drupalGet('node/add/page');
    -    //$field_name = 'field_' . $name;
    +    // $field_name = 'field_' . $name;.
         $this->assertField($field_name . '[und][0][title]', 'Title found');
         $this->assertField($field_name . '[und][0][url]', 'URL found');
     
    @@ -122,11 +131,12 @@ class LinkEntityTokenTest extends LinkBaseTestClass {
             'label' => $this->randomName(),
           ),
         );
    -    //$this->assert('pass', '
    ' . print_r($token_url_tests, TRUE) . '
    ');
     
    +    //@codingStandardsIgnoreLine
    +    // $this->assert('pass', '
    ' . print_r($token_url_tests, TRUE) . '
    ');.
         foreach ($token_url_tests as &$input) {
           $this->drupalGet('node/add/page');
    -  
    +
           $edit = array(
             'title' => $input['label'],
             $field_name . '[und][0][title]' => $input['label'],
    @@ -137,19 +147,18 @@ class LinkEntityTokenTest extends LinkBaseTestClass {
           $input['url'] = $url;
         }
     
    -    // change to anonymous user
    +    // Change to anonymous user.
         $this->drupalLogout();
    -    
    +
         foreach ($token_url_tests as $index => $input2) {
           $node = node_load($index);
    -      $node_array = node_view($node, 'full');
           $this->assertNotEqual(NULL, $node, "Do we have a node?");
           $this->assertEqual($node->nid, $index, "Test that we have a node.");
           $token_name = '[node:' . str_replace('_', '-', $field_name) . ':url]';
           $assert_data = token_replace($token_name,
    -                      array('node' => $node));
    +        array('node' => $node));
           $this->assertEqual($input2['href'], $assert_data, "Test that the url token has been set to " . $input2['href'] . ' - ' . $assert_data);
         }
       }
    -  
    -}
    \ No newline at end of file
    +
    +}
    diff --git a/sites/all/modules/contrib/fields/link/tests/link.multilingual.test b/sites/all/modules/contrib/fields/link/tests/link.multilingual.test
    new file mode 100644
    index 00000000..75350722
    --- /dev/null
    +++ b/sites/all/modules/contrib/fields/link/tests/link.multilingual.test
    @@ -0,0 +1,191 @@
    +permissions = array_merge($this->permissions, array(
    +      'administer site configuration',
    +      'administer languages',
    +    ));
    +    parent::setUp($modules);
    +  }
    +
    +  /**
    +   * Enables and configured language related stuff.
    +   */
    +  public function setUpLanguage() {
    +    global $language_url;
    +    $this->drupalGet('admin/config/regional/language');
    +    // Enable the path prefix for the default language: this way any un-prefixed
    +    // URL must have a valid fallback value.
    +    $edit = array('prefix' => 'en');
    +    $this->drupalPost('admin/config/regional/language/edit/en', $edit, t('Save language'));
    +    $language_url->prefix = $language_url->language;
    +
    +    // Add custom language - as we need more than 1 language to be multilingual.
    +    // Code for the language.
    +    $langcode = 'xx';
    +    // The English name for the language.
    +    $name = $this->randomName(16);
    +    // The native name for the language.
    +    $native = $this->randomName(16);
    +    $edit = array(
    +      'langcode' => $langcode,
    +      'name' => $name,
    +      'native' => $native,
    +      'prefix' => $langcode,
    +      'direction' => '0',
    +    );
    +    $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
    +    variable_set('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX);
    +
    +    // Enable URL language detection and selection.
    +    $edit = array('language[enabled][locale-url]' => 1);
    +    $this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
    +    language_negotiation_set(LANGUAGE_TYPE_INTERFACE, array(LOCALE_LANGUAGE_NEGOTIATION_URL));
    +
    +    // Reset static caching.
    +    drupal_static_reset('language_list');
    +    drupal_static_reset('locale_url_outbound_alter');
    +    drupal_static_reset('locale_language_url_rewrite_url');
    +  }
    +}
    +
    +class LinkMultilingualPathTest extends LinkMultilingualTestCase {
    +
    +  public static function getInfo() {
    +    return array(
    +      'name' => 'Link language path prefix',
    +      'description' => 'Tests that path properly work with language path prefixes.',
    +      'group' => 'Link',
    +    );
    +  }
    +
    +  /**
    +   * Creates a link field, fills it, then uses a loaded node to test paths.
    +   */
    +  public function testLanguagePrefixedPaths() {
    +    $this->setUpLanguage();
    +
    +    // Create fields.
    +    // Field for absolute urls.
    +    $field_name_absolute = $this->createLinkField('page');
    +
    +    // Field for relative urls.
    +    $settings = array(
    +      'instance[settings][absolute_url]' => FALSE,
    +    );
    +    $field_name_relative = $this->createLinkField('page', $settings);
    +
    +    // Check the node edit form.
    +    $this->drupalGet('node/add/page');
    +    $this->assertField($field_name_absolute . '[und][0][title]', 'Title absolute found');
    +    $this->assertField($field_name_absolute . '[und][0][url]', 'URL absolute found');
    +    $this->assertField($field_name_relative . '[und][0][title]', 'Title relative found');
    +    $this->assertField($field_name_relative . '[und][0][url]', 'URL relative found');
    +
    +    // Create test content.
    +    $url_tests = array(
    +      1 => array(
    +          'href' => 'http://dummy.com/' . $this->randomName(),
    +          'label' => $this->randomName(),
    +        ),
    +      2 => array(
    +          'href' => 'node/1',
    +          'label' => $this->randomName(),
    +        ),
    +      3 => array(
    +          'href' => 'node/1?property=value',
    +          'label' => $this->randomName(),
    +          'query' => array('property' => 'value'),
    +        ),
    +      4 => array(
    +          'href' => 'node/1#position',
    +          'label' => $this->randomName(),
    +          'fragment' => 'position',
    +        ),
    +      5 => array(
    +          'href' => 'node/1?property=value2#lower',
    +          'label' => $this->randomName(),
    +          'fragment' => 'lower',
    +          'query' => array('property' => 'value2'),
    +        ),
    +    );
    +    foreach ($url_tests as $index => &$input) {
    +      $this->drupalGet('node/add/page');
    +
    +      $edit = array(
    +          'title' => $input['label'],
    +          $field_name_absolute . '[und][0][title]' => $input['label'],
    +          $field_name_absolute . '[und][0][url]' => $input['href'],
    +          $field_name_relative . '[und][0][title]' => $input['label'],
    +          $field_name_relative . '[und][0][url]' => $input['href'],
    +        );
    +      $this->drupalPost(NULL, $edit, t('Save'));
    +      $url = $this->getUrl();
    +      $input['url'] = $url;
    +    }
    +
    +    // Change to anonymous user.
    +    $this->drupalLogout();
    +
    +    foreach (array_slice($url_tests, 1, NULL, TRUE) as $index => $input2) {
    +      $node = node_load($index);
    +      $this->assertNotEqual(NULL, $node, "Do we have a node?");
    +      $this->assertEqual($node->nid, $index, "Test that we have a node.");
    +      $this->drupalGet('node/' . $index);
    +
    +      $relative_expected = url('node/1', array('absolute' => FALSE) + $input2);
    +      $absolute_expected = url('node/1', array('absolute' => TRUE) + $input2);
    +
    +      $absolute_result = $this->xpath('//*[contains(@class, "field-name-' . drupal_clean_css_identifier($field_name_absolute) . '")]/div/div/a/@href');
    +      $absolute_result = (string) reset($absolute_result);
    +      $this->assertEqual($absolute_result, $absolute_expected, "Absolute url output ('" . $absolute_result . "') looks as expected ('" . $absolute_expected . "')");
    +
    +      $relative_result = $this->xpath('//*[contains(@class, "field-name-' . drupal_clean_css_identifier($field_name_relative) . '")]/div/div/a/@href');
    +      $relative_result = (string) reset($relative_result);
    +      $this->assertEqual($relative_result, $relative_expected, "Relative url output ('" . $relative_result . "') looks as expected ('" . $relative_expected . "')");
    +    }
    +
    +    // Check if this works with the alias too.
    +    // Add a path alias for node 1.
    +    $path = array(
    +      'source' => 'node/1',
    +      'alias' => $url_tests[1]['label'],
    +    );
    +    path_save($path);
    +    // Another iteration over the same nodes - this time they should use the
    +    // path alias.
    +    foreach (array_slice($url_tests, 1, NULL, TRUE) as $index => $input2) {
    +      $node = node_load($index);
    +      $this->assertNotEqual(NULL, $node, "Do we have a node?");
    +      $this->assertEqual($node->nid, $index, "Test that we have a node.");
    +      $this->drupalGet('node/' . $index);
    +
    +      $relative_expected = url('node/1', array('absolute' => FALSE) + $input2);
    +      $absolute_expected = url('node/1', array('absolute' => TRUE) + $input2);
    +
    +      $absolute_result = $this->xpath('//*[contains(@class, "field-name-' . drupal_clean_css_identifier($field_name_absolute) . '")]/div/div/a/@href');
    +      $absolute_result = (string) reset($absolute_result);
    +      $this->assertEqual($absolute_result, $absolute_expected, "Absolute alias-url output ('" . $absolute_result . "') looks as expected ('" . $absolute_expected . "')");
    +
    +      $relative_result = $this->xpath('//*[contains(@class, "field-name-' . drupal_clean_css_identifier($field_name_relative) . '")]/div/div/a/@href');
    +      $relative_result = (string) reset($relative_result);
    +      $this->assertEqual($relative_result, $relative_expected, "Relative alias-url output ('" . $relative_result . "') looks as expected ('" . $relative_expected . "')");
    +    }
    +  }
    +}
    diff --git a/sites/all/modules/contrib/fields/link/tests/link.test b/sites/all/modules/contrib/fields/link/tests/link.test
    index b0301530..dd9adb49 100644
    --- a/sites/all/modules/contrib/fields/link/tests/link.test
    +++ b/sites/all/modules/contrib/fields/link/tests/link.test
    @@ -5,10 +5,15 @@
      * Link base test file - contains common functions for testing links.
      */
     
    +/**
    + * Base Test Class.
    + */
     class LinkBaseTestClass extends DrupalWebTestCase {
    +
       protected $permissions = array(
         'access content',
         'administer content types',
    +    'administer fields',
         'administer nodes',
         'administer filters',
         'access comments',
    @@ -17,19 +22,23 @@ class LinkBaseTestClass extends DrupalWebTestCase {
         'create page content',
       );
     
    -  function setUp() {
    +  /**
    +   * Setup.
    +   */
    +  public function setUp() {
         $modules = func_get_args();
         $modules = (isset($modules[0]) && is_array($modules[0]) ? $modules[0] : $modules);
         $modules[] = 'field_ui';
         $modules[] = 'link';
         parent::setUp($modules);
     
    -    $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator'));
    -    $perms = array_keys($perms[array_search('administrator', user_roles())]);
    -    $admin = $this->drupalCreateUser($perms);
    -    $this->drupalLogin($admin);
    +    $this->web_user = $this->drupalCreateUser($this->permissions);
    +    $this->drupalLogin($this->web_user);
       }
     
    +  /**
    +   * Create Link Field.
    +   */
       protected function createLinkField($node_type = 'page', $settings = array()) {
         $name = strtolower($this->randomName());
         $edit = array(
    @@ -50,4 +59,5 @@ class LinkBaseTestClass extends DrupalWebTestCase {
     
         return $field_name;
       }
    +
     }
    diff --git a/sites/all/modules/contrib/fields/link/tests/link.token.test b/sites/all/modules/contrib/fields/link/tests/link.token.test
    index 617260e6..edbb1df5 100644
    --- a/sites/all/modules/contrib/fields/link/tests/link.token.test
    +++ b/sites/all/modules/contrib/fields/link/tests/link.token.test
    @@ -6,10 +6,13 @@
      */
     
     /**
    - * Testing that tokens can be used in link titles
    + * Testing that tokens can be used in link titles.
      */
     class LinkTokenTest extends LinkBaseTestClass {
     
    +  /**
    +   * Get Info.
    +   */
       public static function getInfo() {
         return array(
           'name' => 'Link tokens - browser test',
    @@ -19,34 +22,38 @@ class LinkTokenTest extends LinkBaseTestClass {
         );
       }
     
    -  function setUp($modules = array()) {
    +  /**
    +   * Setup.
    +   */
    +  public function setUp($modules = array()) {
         parent::setUp(array('token'));
       }
     
       /**
        * Creates a link field with a required title enabled for user-entered tokens.
    +   *
        * Creates a node with a token in the link title and checks the value.
        */
    -  function testUserTokenLinkCreate() {
    -    // create field
    +  public function testUserTokenLinkCreate() {
    +    // Create field.
         $settings = array(
           'instance[settings][enable_tokens]' => 1,
         );
         $field_name = $this->createLinkField('page',
    -                                        $settings);
    +      $settings);
     
    -    // create page form
    +    // Create page form.
         $this->drupalGet('node/add/page');
    -    //$field_name = 'field_' . $name;
    +    // $field_name = 'field_' . $name;.
         $this->assertField($field_name . '[und][0][title]', 'Title found');
         $this->assertField($field_name . '[und][0][url]', 'URL found');
     
         $input = array(
    -        'href' => 'http://example.com/' . $this->randomName(),
    -        'label' => $this->randomName(),
    +      'href' => 'http://example.com/' . $this->randomName(),
    +      'label' => $this->randomName(),
         );
     
    -    //$this->drupalLogin($this->web_user);
    +    // $this->drupalLogin($this->web_user);.
         $this->drupalGet('node/add/page');
     
         $edit = array(
    @@ -57,36 +64,37 @@ class LinkTokenTest extends LinkBaseTestClass {
         $this->drupalPost(NULL, $edit, t('Save'));
         $url = $this->getUrl();
     
    -    // change to anonymous user
    +    // Change to anonymous user.
         $this->drupalLogout();
         $this->drupalGet($url);
     
         $this->assertRaw(l($input['label'] . ' page', $input['href']));
       }
     
    -
       /**
        * Creates a link field with a static title and an admin-entered token.
    +   *
        * Creates a node with a link and checks the title value.
        */
    -  function testStaticTokenLinkCreate() {
    +  public function testStaticTokenLinkCreate() {
     
    -    // create field
    +    // Create field.
         $name = $this->randomName();
         $settings = array(
           'instance[settings][title]' => 'value',
    -      'instance[settings][title_value]' => $name . ' [node:content-type:machine-name]');
    +      'instance[settings][title_value]' => $name . ' [node:content-type:machine-name]',
    +    );
         $field_name = $this->createLinkField('page', $settings);
     
    -    // create page form
    +    // Create page form.
         $this->drupalGet('node/add/page');
         $this->assertField($field_name . '[und][0][url]', 'URL found');
     
         $input = array(
    -      'href' => 'http://example.com/' . $this->randomName()
    +      'href' => 'http://example.com/' . $this->randomName(),
         );
     
    -    //$this->drupalLogin($this->web_user);
    +    // $this->drupalLogin($this->web_user);.
         $this->drupalGet('node/add/page');
     
         $edit = array(
    @@ -97,7 +105,7 @@ class LinkTokenTest extends LinkBaseTestClass {
     
         $url = $this->getUrl();
     
    -    // change to anonymous user
    +    // Change to anonymous user.
         $this->drupalLogout();
         $this->drupalGet($url);
     
    @@ -106,30 +114,32 @@ class LinkTokenTest extends LinkBaseTestClass {
     
       /**
        * Creates a link field with a static title and an admin-entered token.
    +   *
        * Creates a node with a link and checks the title value.
        *
        * Basically, I want to make sure the [title-raw] token works, because it's a
        * token that changes from node to node, where [type]'s always going to be the
        * same.
        */
    -  function testStaticTokenLinkCreate2() {
    +  public function testStaticTokenLinkCreate2() {
     
    -    // create field
    +    // Create field.
         $name = $this->randomName();
         $settings = array(
           'instance[settings][title]' => 'value',
    -      'instance[settings][title_value]' => $name . ' [node:title]');
    +      'instance[settings][title_value]' => $name . ' [node:title]',
    +    );
         $field_name = $this->createLinkField('page', $settings);
     
    -    // create page form
    +    // Create page form.
         $this->drupalGet('node/add/page');
         $this->assertField($field_name . '[und][0][url]', 'URL found');
     
         $input = array(
    -      'href' => 'http://example.com/' . $this->randomName()
    +      'href' => 'http://example.com/' . $this->randomName(),
         );
     
    -    //$this->drupalLogin($this->web_user);
    +    // $this->drupalLogin($this->web_user);.
         $this->drupalGet('node/add/page');
     
         $edit = array(
    @@ -140,27 +150,32 @@ class LinkTokenTest extends LinkBaseTestClass {
     
         $url = $this->getUrl();
     
    -    // change to anonymous user
    +    // Change to anonymous user.
         $this->drupalLogout();
         $this->drupalGet($url);
     
         $this->assertRaw(l($name . ' ' . $name, $input['href']));
       }
     
    -  // This test doesn't seem to actually work, due to lack of 'title' in url.
    -  function _test_Link_With_Title_Attribute_token_url_form() {
    -   /* $this->loginWithPermissions($this->permissions);
    +  /**
    +   * This test doesn't seem to actually work, due to lack of 'title' in url.
    +   *
    +   * @codingStandardsIgnoreStart
    +   */
    +  public function _test_Link_With_Title_Attribute_token_url_form() {
    +    // @codingStandardsIgnoreEnd
    +    /* $this->loginWithPermissions($this->permissions);
         $this->acquireContentTypes(1);
         $field_settings = array(
    -      'type' => 'link',
    -      'widget_type' => 'link',
    -      'type_name' => $this->content_types[0]->name,
    -      'attributes' => array(
    -        'class' => '',
    -        'target' => 'default',
    -        'rel' => 'nofollow',
    -        'title' => '',
    -      ),
    +    'type' => 'link',
    +    'widget_type' => 'link',
    +    'type_name' => $this->content_types[0]->name,
    +    'attributes' => array(
    +    'class' => '',
    +    'target' => 'default',
    +    'rel' => 'nofollow',
    +    'title' => '',
    +    ),
         );
     
         $field = $this->createField($field_settings, 0);
    @@ -170,10 +185,10 @@ class LinkTokenTest extends LinkBaseTestClass {
         $url_type = str_replace('_', '-', $this->content_types[0]->type);
     
         $edit = array('attributes[title]' => '['. $field_name .'-url]',
    -                  'enable_tokens' => TRUE);
    -
    +    'enable_tokens' => TRUE);
    +    // @codingStandardsIgnoreLine
         $this->drupalPost('admin/content/node-type/'. $url_type .'/fields/'. $field['field_name'],
    -                      $edit, t('Save field settings'));
    +    $edit, t('Save field settings'));
         $this->assertText(t('Saved field @field_name', array('@field_name' => $field['field_name'])));*/
         $name = $this->randomName();
         $settings = array(
    @@ -183,12 +198,9 @@ class LinkTokenTest extends LinkBaseTestClass {
         $field_name = $this->createLinkField('page', $settings);
     
         // So, having saved this field_name, let's see if it works...
    -    //$this->acquireNodes(1);
    -
    -    //$node = node_load($this->nodes[0]->nid);
    -
    -    //$this->drupalGet('node/'. $this->nodes[0]->nid);
    -
    +    // $this->acquireNodes(1);
    +    // $node = node_load($this->nodes[0]->nid);
    +    // $this->drupalGet('node/'. $this->nodes[0]->nid);.
         $edit = array();
         $test_link_url = 'http://www.example.com/test';
         $edit[$field_name . '[und][0][url]'] = $test_link_url;
    @@ -200,23 +212,28 @@ class LinkTokenTest extends LinkBaseTestClass {
         $this->drupalPost(NULL, $edit, t('Save'));
     
         // Make sure we get a new version!
    -    //$node = node_load($this->nodes[0]->nid, NULL, TRUE);
    +    // $node = node_load($this->nodes[0]->nid, NULL, TRUE);.
         $this->assertText(t('Basic page @title has been updated.',
    -                        array('@title' => $name)));
    +      array('@title' => $name)));
     
    -    //$this->drupalGet('node/'. $node->nid);
    +    // $this->drupalGet('node/'. $node->nid);.
         $this->assertText($title, 'Make sure the link title/text shows');
         $this->assertRaw(' title="' . $test_link_url . '"', "Do we show the link url as the title attribute?");
         $this->assertNoRaw(' title="[' . $field_name . '-url]"');
         $this->assertTrue(module_exists('token'), t('Assure that Token Module is enabled.'));
    -    //$this->fail($this->content);
    +    // $this->fail($this->content);.
       }
     
       /**
    +   * Link With Title Attribute token title form.
    +   *
        * If the title of the link is set to the title attribute, then the title
        * attribute isn't supposed to show.
    +   *
    +   * @codingStandardsIgnoreStart
        */
    -  function _test_Link_With_Title_Attribute_token_title_form() {
    +  public function _test_Link_With_Title_Attribute_token_title_form() {
    +    // @codingStandardsIgnoreEnd
         $this->loginWithPermissions($this->permissions);
         $this->acquireContentTypes(1);
         $field_settings = array(
    @@ -233,21 +250,20 @@ class LinkTokenTest extends LinkBaseTestClass {
     
         $field = $this->createField($field_settings, 0);
         $field_name = $field['field_name'];
    -    $field_db_info = content_database_info($field);
         $url_type = str_replace('_', '-', $this->content_types[0]->type);
     
    -    $edit = array('attributes[title]' => '[' . $field_name . '-title]',
    -                  'enable_tokens' => TRUE);
    +    $edit = array(
    +      'attributes[title]' => '[' . $field_name . '-title]',
    +      'enable_tokens' => TRUE,
    +    );
     
         $this->drupalPost('admin/content/node-type/' . $url_type . '/fields/' . $field['field_name'],
    -                      $edit, t('Save field settings'));
    +      $edit, t('Save field settings'));
         $this->assertText(t('Saved field @field_name', array('@field_name' => $field['field_name'])));
     
         // So, having saved this field_name, let's see if it works...
         $this->acquireNodes(1);
     
    -    $node = node_load($this->nodes[0]->nid);
    -
         $this->drupalGet('node/' . $this->nodes[0]->nid);
     
         $edit = array();
    @@ -260,24 +276,35 @@ class LinkTokenTest extends LinkBaseTestClass {
         // Make sure we get a new version!
         $node = node_load($this->nodes[0]->nid, NULL, TRUE);
         $this->assertText(t('@type @title has been updated.',
    -                        array('@title' => $node->title,
    -                              '@type' => $this->content_types[0]->name)));
    +      array(
    +        '@title' => $node->title,
    +        '@type' => $this->content_types[0]->name,
    +      )));
     
         $this->drupalGet('node/' . $node->nid);
         $this->assertText($title, 'Make sure the link title/text shows');
         $this->assertNoRaw(' title="' . $title . '"', "We should not show the link title as the title attribute?");
         $this->assertNoRaw(' title="[' . $field_name . '-title]"');
    -    //$this->fail($this->content);
    +    // $this->fail($this->content);.
       }
     
       /**
    -   *  Trying to set the url to contain a token.
    +   * Trying to set the url to contain a token.
    +   *
    +   * @codingStandardsIgnoreStart
        */
    -  function _testUserTokenLinkCreateInURL() {
    -    $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
    +  public function _testUserTokenLinkCreateInURL() {
    +    //@codingStandardsIgnoreEnd
    +
    +    $this->web_user = $this->drupalCreateUser(array(
    +      'administer content types',
    +      'administer fields',
    +      'access content',
    +      'create page content',
    +    ));
         $this->drupalLogin($this->web_user);
     
    -    // create field
    +    // Create field.
         $name = strtolower($this->randomName());
         $edit = array(
           '_add_new_field[label]' => $name,
    @@ -288,20 +315,21 @@ class LinkTokenTest extends LinkBaseTestClass {
         $this->drupalPost('admin/content/node-type/page/fields', $edit, t('Save'));
         $this->drupalPost(NULL, array(
           'title' => 'required',
    -      'enable_tokens' => 1), t('Save field settings'));
    +      'enable_tokens' => 1,
    +    ), t('Save field settings'));
     
         // Is field created?
         $this->assertRaw(t('Added field %label.', array('%label' => $name)), 'Field added');
     
    -    // create page form
    +    // Create page form.
         $this->drupalGet('node/add/page');
         $field_name = 'field_' . $name;
         $this->assertField($field_name . '[0][title]', 'Title found');
         $this->assertField($field_name . '[0][url]', 'URL found');
     
         $input = array(
    -        'href' => 'http://example.com/' . $this->randomName(),
    -        'label' => $this->randomName(),
    +      'href' => 'http://example.com/' . $this->randomName(),
    +      'label' => $this->randomName(),
         );
     
         $this->drupalLogin($this->web_user);
    @@ -315,22 +343,31 @@ class LinkTokenTest extends LinkBaseTestClass {
         $this->drupalPost(NULL, $edit, t('Save'));
         $url = $this->getUrl();
     
    -    // change to anonymous user
    +    // Change to anonymous user.
         $this->drupalLogout();
         $this->drupalGet($url);
     
         $this->assertRaw(l($input['label'], $input['href'] . '/page'));
    -    //$this->fail($this->content);
    +    // $this->fail($this->content);.
       }
     
       /**
    -   *  Trying to set the url to contain a token.
    +   * Trying to set the url to contain a token.
    +   *
    +   * @codingStandardsIgnoreStart
        */
    -  function _testUserTokenLinkCreateInURL2() {
    -    $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
    +  public function _testUserTokenLinkCreateInURL2() {
    +    // @codingStandardsIgnoreEnd
    +
    +    $this->web_user = $this->drupalCreateUser(array(
    +      'administer content types',
    +      'administer fields',
    +      'access content',
    +      'create page content',
    +    ));
         $this->drupalLogin($this->web_user);
     
    -    // create field
    +    // Create field.
         $name = strtolower($this->randomName());
         $edit = array(
           '_add_new_field[label]' => $name,
    @@ -341,20 +378,21 @@ class LinkTokenTest extends LinkBaseTestClass {
         $this->drupalPost('admin/content/node-type/page/fields', $edit, t('Save'));
         $this->drupalPost(NULL, array(
           'title' => 'required',
    -      'enable_tokens' => 1), t('Save field settings'));
    +      'enable_tokens' => 1,
    +    ), t('Save field settings'));
     
         // Is field created?
         $this->assertRaw(t('Added field %label.', array('%label' => $name)), 'Field added');
     
    -    // create page form
    +    // Create page form.
         $this->drupalGet('node/add/page');
         $field_name = 'field_' . $name;
         $this->assertField($field_name . '[0][title]', 'Title found');
         $this->assertField($field_name . '[0][url]', 'URL found');
     
         $input = array(
    -        'href' => 'http://example.com/' . $this->randomName(),
    -        'label' => $this->randomName(),
    +      'href' => 'http://example.com/' . $this->randomName(),
    +      'label' => $this->randomName(),
         );
     
         $this->drupalLogin($this->web_user);
    @@ -368,22 +406,34 @@ class LinkTokenTest extends LinkBaseTestClass {
         $this->drupalPost(NULL, $edit, t('Save'));
         $url = $this->getUrl();
     
    -    // change to anonymous user
    +    // Change to anonymous user.
         $this->drupalLogout();
         $this->drupalGet($url);
     
         $this->assertRaw(l($input['label'], $input['href'] . '/' . $this->web_user->uid));
       }
    -  
    +
       /**
    -   *  Test that if you have a title and no url on a field which does not have tokens enabled,
    -   *  that the title is sanitized once.
    +   * CRUD Title Only Title No Link.
    +   *
    +   * Test that if you have a title and no url on a field which does not have
    +   * tokens enabled, that the title is sanitized once.
    +   *
    +   * @codingStandardsIgnoreStart
        */
    -  function testCRUDTitleOnlyTitleNoLink2() {
    -    $this->web_user = $this->drupalCreateUser(array('administer content types', 'access content', 'create page content'));
    +  public function testCRUDTitleOnlyTitleNoLink2() {
    +    //@codingStandardsIgnoreEnd
    +
    +    $this->web_user = $this->drupalCreateUser(array(
    +      'administer content types',
    +      'administer fields',
    +      'access content',
    +      'create page content',
    +    ));
    +
         $this->drupalLogin($this->web_user);
     
    -    // create field
    +    // Create field.
         $name = strtolower($this->randomName());
         $field_name = 'field_' . $name;
         $edit = array(
    @@ -401,8 +451,8 @@ class LinkTokenTest extends LinkBaseTestClass {
     
         // Is field created?
         $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');
    -    
    -    // create page form
    +
    +    // Create page form.
         $this->drupalGet('node/add/page');
         $this->assertField($field_name . '[und][0][url]', 'URL found');
     
    @@ -419,13 +469,12 @@ class LinkTokenTest extends LinkBaseTestClass {
         $this->drupalPost(NULL, $edit, t('Save'));
     
         $url = $this->getUrl();
    -    
    -    // change to anonymous user
    +
    +    // Change to anonymous user.
         $this->drupalLogout();
         $this->drupalGet($url);
     
         $this->assertRaw('This & That');
       }
    -  
    -  
    +
     }
    diff --git a/sites/all/modules/contrib/fields/link/tests/link.validate.test b/sites/all/modules/contrib/fields/link/tests/link.validate.test
    index f03a64cc..6338840f 100644
    --- a/sites/all/modules/contrib/fields/link/tests/link.validate.test
    +++ b/sites/all/modules/contrib/fields/link/tests/link.validate.test
    @@ -5,8 +5,14 @@
      * Tests that exercise the validation functions in the link module.
      */
     
    +/**
    + * Validate Test Case.
    + */
     class LinkValidateTestCase extends LinkBaseTestClass {
     
    +  /**
    +   * Create Link.
    +   */
       protected function createLink($url, $title, $attributes = array()) {
         return array(
           'url' => $url,
    @@ -17,8 +23,11 @@ class LinkValidateTestCase extends LinkBaseTestClass {
     
       /**
        * Takes a url, and sees if it can validate that the url is valid.
    +   *
    +   * @codingStandardsIgnoreStart
        */
       protected function link_test_validate_url($url) {
    +    // @codingStandardsIgnoreEnd
     
         $field_name = $this->createLinkField();
     
    @@ -26,11 +35,11 @@ class LinkValidateTestCase extends LinkBaseTestClass {
         $settings = array(
           'title' => $label,
           $field_name => array(
    -        LANGUAGE_NONE=> array(
    +        LANGUAGE_NONE => array(
               array(
                 'title' => $label,
                 'url' => $url,
    -          )
    +          ),
             ),
           ),
         );
    @@ -41,10 +50,17 @@ class LinkValidateTestCase extends LinkBaseTestClass {
     
         $this->assertEqual($url, $node->{$field_name}[LANGUAGE_NONE][0]['url']);
       }
    +
     }
     
    +/**
    + * Class for Validate Test.
    + */
     class LinkValidateTest extends LinkValidateTestCase {
     
    +  /**
    +   * Get Info.
    +   */
       public static function getInfo() {
         return array(
           'name' => 'Link Validation Tests',
    @@ -53,20 +69,35 @@ class LinkValidateTest extends LinkValidateTestCase {
         );
       }
     
    -  function test_link_validate_basic_url() {
    +  /**
    +   * Validate basic URL.
    +   *
    +   * @codingStandardsIgnoreStart
    +   */
    +  public function test_link_validate_basic_url() {
    +    // @codingStandardsIgnoreEnd
         $this->link_test_validate_url('http://www.example.com');
       }
     
       /**
        * Test if we're stopped from posting a bad url on default validation.
    +   *
    +   * @codingStandardsIgnoreStart
        */
    -  function test_link_validate_bad_url_validate_default() {
    -    $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator'));
    -    $perms = array_keys($perms[array_search('administrator', user_roles())]);
    -    $admin = $this->drupalCreateUser($perms);
    -    $this->drupalLogin($admin);
    +  public function test_link_validate_bad_url_validate_default() {
    +    // @codingStandardsIgnoreEnd
    +    $this->web_user = $this->drupalCreateUser(array(
    +      'administer content types',
    +      'administer fields',
    +      'administer nodes',
    +      'administer filters',
    +      'access content',
    +      'create page content',
    +      'access administration pages',
    +    ));
    +    $this->drupalLogin($this->web_user);
     
    -    // create field
    +    // Create field.
         $name = strtolower($this->randomName());
         $edit = array(
           'fields[_add_new_field][label]' => $name,
    @@ -83,32 +114,43 @@ class LinkValidateTest extends LinkValidateTestCase {
         node_types_rebuild();
         menu_rebuild();
     
    -    // create page form
    +    // Create page form.
         $this->drupalGet('node/add/page');
         $field_name = 'field_' . $name;
         $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
         $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
     
    -
         $edit = array(
           'title' => 'Simple Title',
           $field_name . '[und][0][url]' => 'edik:naw',
         );
     
         $this->drupalPost(NULL, $edit, t('Save'));
    -    $this->assertText(t('The value @value provided for @field is not a valid URL.', array('@value' => 'edik:naw', '@field' => $name)));
    +    $this->assertText(t('The value @value provided for @field is not a valid URL.', array(
    +      '@value' => 'edik:naw',
    +      '@field' => $name,
    +    )));
       }
     
       /**
        * Test if we're stopped from posting a bad url with validation on.
    +   *
    +   * @codingStandardsIgnoreStart
        */
    -  function test_link_validate_bad_url_validate_on() {
    -    $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator'));
    -    $perms = array_keys($perms[array_search('administrator', user_roles())]);
    -    $admin = $this->drupalCreateUser($perms);
    -    $this->drupalLogin($admin);
    +  public function test_link_validate_bad_url_validate_on() {
    +    // @codingStandardsIgnoreEnd
    +    $this->web_user = $this->drupalCreateUser(array(
    +      'administer content types',
    +      'administer fields',
    +      'administer nodes',
    +      'administer filters',
    +      'access content',
    +      'create page content',
    +      'access administration pages',
    +    ));
    +    $this->drupalLogin($this->web_user);
     
    -    // create field
    +    // Create field.
         $name = strtolower($this->randomName());
         $edit = array(
           'fields[_add_new_field][label]' => $name,
    @@ -125,33 +167,44 @@ class LinkValidateTest extends LinkValidateTestCase {
         node_types_rebuild();
         menu_rebuild();
     
    -    // create page form
    +    // Create page form.
         $this->drupalGet('node/add/page');
         $field_name = 'field_' . $name;
         $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found');
         $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found');
     
    -
         $edit = array(
           'title' => 'Simple Title',
           $field_name . '[und][0][url]' => 'edik:naw',
         );
     
         $this->drupalPost(NULL, $edit, t('Save'));
    -    $this->assertText(t('The value @value provided for @field is not a valid URL.', array('@field' => $name, '@value' => 'edik:naw')));
    +    $this->assertText(t('The value @value provided for @field is not a valid URL.', array(
    +      '@field' => $name,
    +      '@value' => 'edik:naw',
    +    )));
     
       }
     
       /**
        * Test if we can post a bad url if the validation is expressly turned off.
    +   *
    +   * @codingStandardsIgnoreStart
        */
    -  function test_link_validate_bad_url_validate_off() {
    -    $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator'));
    -    $perms = array_keys($perms[array_search('administrator', user_roles())]);
    -    $admin = $this->drupalCreateUser($perms);
    -    $this->drupalLogin($admin);
    +  public function test_link_validate_bad_url_validate_off() {
    +    // @codingStandardsIgnoreEnd
    +    $this->web_user = $this->drupalCreateUser(array(
    +      'administer content types',
    +      'administer fields',
    +      'administer nodes',
    +      'administer filters',
    +      'access content',
    +      'create page content',
    +      'access administration pages',
    +    ));
    +    $this->drupalLogin($this->web_user);
     
    -    // create field
    +    // Create field.
         $name = strtolower($this->randomName());
         $edit = array(
           'fields[_add_new_field][label]' => $name,
    @@ -163,6 +216,7 @@ class LinkValidateTest extends LinkValidateTestCase {
         $this->drupalPost(NULL, array(), t('Save field settings'));
         $this->drupalPost(NULL, array('instance[settings][validate_url]' => FALSE), t('Save settings'));
     
    +    // @codingStandardsIgnoreLine
         /*$instance_details = db_query("SELECT * FROM {field_config_instance} WHERE field_name = :field_name AND bundle = 'page'", array(':field_name' => 'field_'. $name))->fetchObject();
         $this->fail('
    '. print_r($instance_details, TRUE) .'
    '); $this->fail('
    '. print_r(unserialize($instance_details->data), TRUE) .'
    ');*/ @@ -172,48 +226,62 @@ class LinkValidateTest extends LinkValidateTestCase { node_types_rebuild(); menu_rebuild(); - // create page form + // Create page form. $this->drupalGet('node/add/page'); $field_name = 'field_' . $name; $this->assertField('edit-field-' . $name . '-und-0-title', 'Title found'); $this->assertField('edit-field-' . $name . '-und-0-url', 'URL found'); - $edit = array( 'title' => 'Simple Title', $field_name . '[und][0][url]' => 'edik:naw', ); $this->drupalPost(NULL, $edit, t('Save')); - $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array('%field' => $name, '%value' => 'edik:naw'))); + $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array( + '%field' => $name, + '%value' => 'edik:naw', + ))); } /** - * Test if a bad url can sneak through un-filtered if we play with the validation... + * Validate switching between validation status. + * + * Test if a bad url can sneak through un-filtered if we play with the + * validation... + * + * @codingStandardsIgnoreStart */ - function x_test_link_validate_switching_between_validation_status() { + public function x_test_link_validate_switching_between_validation_status() { + // @codingStandardsIgnoreEnd $this->acquireContentTypes(1); - $perms = user_role_permissions(array(array_search('administrator', user_roles()) => 'administrator')); - $perms = array_keys($perms[array_search('administrator', user_roles())]); - $admin = $this->drupalCreateUser($perms); - $this->drupalLogin($admin); - variable_set('node_options_' . $this->content_types[0]->name, array('status', 'promote')); + $this->web_user = $this->drupalCreateUser(array( + 'administer content types', + 'administer fields', + 'administer nodes', + 'access administration pages', + 'access content', + 'create ' . $this->content_types[0]->type . ' content', + 'edit any ' . $this->content_types[0]->type . ' content', + )); + $this->drupalLogin($this->web_user); + variable_set('node_options_' . $this->content_types[0]->name, array( + 'status', + 'promote', + )); $field_settings = array( 'type' => 'link', 'widget_type' => 'link', 'type_name' => $this->content_types[0]->name, - 'attributes' => array(), // <-- This is needed or we have an error + // <-- This is needed or we have an error. + 'attributes' => array(), 'validate_url' => 0, ); $field = $this->createField($field_settings, 0); - //$this->fail('
    '. print_r($field, TRUE) .'
    '); - $field_db_info = content_database_info($field); $this->acquireNodes(2); - $node = node_load($this->nodes[0]->nid); - $this->drupalGet('node/' . $this->nodes[0]->nid); $edit = array(); @@ -223,8 +291,13 @@ class LinkValidateTest extends LinkValidateTestCase { $edit[$field['field_name'] . '[0][title]'] = $title; $this->drupalPost('node/' . $this->nodes[0]->nid . '/edit', $edit, t('Save')); - //$this->pass($this->content); - $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array('%field' => $name, '%value' => trim($url)))); + // $this->pass($this->content);. + // @codingStandardsIgnoreLine + $this->assertNoText(t('The value %value provided for %field is not a valid URL.', array( + // @codingStandardsIgnoreLine + '%field' => $name, + '%value' => trim($url), + ))); // Make sure we get a new version! $node = node_load($this->nodes[0]->nid, NULL, TRUE); @@ -236,8 +309,9 @@ class LinkValidateTest extends LinkValidateTestCase { // Turn the array validation back _on_. $edit = array('validate_url' => TRUE); $node_type_link = str_replace('_', '-', $node->type); - //$this->drupalGet('admin/content/node-type/'. $node_type_link .'/fields'); ///'. $field['field_name']); - //$this->fail($this->content); + // @codingStandardsIgnoreLine + // $this->drupalGet('admin/content/node-type/'. $node_type_link .'/fields'); ///'. $field['field_name']); + // $this->fail($this->content);. $this->drupalPost('admin/content/node-type/' . $node_type_link . '/fields/' . $field['field_name'], $edit, t('Save field settings')); $this->drupalGet('node/' . $node->nid); @@ -245,17 +319,26 @@ class LinkValidateTest extends LinkValidateTestCase { // url() function. But we should have a test that makes sure it continues // to work. $this->assertNoRaw($url, 'Make sure Javascript does not display.'); - //$this->fail($this->content); - + // $this->fail($this->content);. } - // Validate that '' is a valid url. - function test_link_front_url() { + /** + * Validate that '' is a valid url. + * + * @codingStandardsIgnoreStart + */ + public function test_link_front_url() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url(''); } - // Validate that an internal url would be accepted. - function test_link_internal_url() { + /** + * Validate that an internal url would be accepted. + * + * @codingStandardsIgnoreStart + */ + public function test_link_internal_url() { + // @codingStandardsIgnoreEnd // Create the content first. $node = $this->drupalCreateNode(); @@ -265,22 +348,46 @@ class LinkValidateTest extends LinkValidateTestCase { $this->assertEqual(LINK_INTERNAL, $type, 'Test ' . $link . ' is an internal link.'); } - // Validate a simple mailto. - function test_link_mailto() { + /** + * Validate a simple mailto. + * + * @codingStandardsIgnoreStart + */ + public function test_link_mailto() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('mailto:jcfiala@gmail.com'); } - function test_link_external_https() { + /** + * Check link external https. + * + * @codingStandardsIgnoreStart + */ + public function test_link_external_https() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('https://www.example.com/'); } - function test_link_ftp() { + /** + * Check link FTP. + * + * @codingStandardsIgnoreStart + */ + public function test_link_ftp() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('ftp://www.example.com/'); } + } +/** + * Validate Test News. + */ class LinkValidateTestNews extends LinkValidateTestCase { + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link News Validation Tests', @@ -289,18 +396,36 @@ class LinkValidateTestNews extends LinkValidateTestCase { ); } - // Validate a news link to a message group - function test_link_news() { + /** + * Validate a news link to a message group. + * + * @codingStandardsIgnoreStart + */ + public function test_link_news() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('news:comp.infosystems.www.misc'); } - // Validate a news link to a message id. Said ID copied off of google groups. - function test_link_news_message() { + /** + * Validate a news link to a message id. Said ID copied off of google groups. + * + * @codingStandardsIgnoreStart + */ + public function test_link_news_message() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('news:hj0db8$vrm$1@news.eternal-september.org'); } + } +/** + * Validate Specific URL. + */ class LinkValidateSpecificURL extends LinkValidateTestCase { + + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link Specific URL Validation Tests', @@ -309,24 +434,53 @@ class LinkValidateSpecificURL extends LinkValidateTestCase { ); } - // Lets throw in a lot of umlouts for testing! - function test_umlout_url() { + /** + * Lets throw in a lot of umlouts for testing! + * + * @codingStandardsIgnoreStart + */ + public function test_umlout_url() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('http://üÜü.exämple.com/nöde'); } - function test_umlout_mailto() { + /** + * Check umlout mailto. + * + * @codingStandardsIgnoreStart + */ + public function test_umlout_mailto() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('mailto:Üser@exÅmple.com'); } - function test_german_b_url() { + /** + * Check german b in url. + * + * @codingStandardsIgnoreStart + */ + public function test_german_b_url() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('http://www.test.com/ßstuff'); } - function test_special_n_url() { + /** + * Check Special in url. + * + * @codingStandardsIgnoreStart + */ + public function test_special_n_url() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('http://www.testÑñ.com/'); } - function test_curly_brackets_in_query() { + /** + * Curly Brackets in query. + * + * @codingStandardsIgnoreStart + */ + public function test_curly_brackets_in_query() { + // @codingStandardsIgnoreEnd $this->link_test_validate_url('http://www.healthyteennetwork.org/index.asp?Type=B_PR&SEC={2AE1D600-4FC6-4B4D-8822-F1D5F072ED7B}&DE={235FD1E7-208D-4363-9854-4E6775EB8A4C}'); } @@ -334,8 +488,11 @@ class LinkValidateSpecificURL extends LinkValidateTestCase { * Here, we're testing that a very long url is stored properly in the db. * * Basically, trying to test http://drupal.org/node/376818 + * + * @codingStandardsIgnoreStart */ - function testLinkURLFieldIsBig() { + public function testLinkURLFieldIsBig() { + // @codingStandardsIgnoreEnd $long_url = 'http://th.wikipedia.org/wiki/%E0%B9%82%E0%B8%A3%E0%B8%87%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B9%80%E0%B8%9A%E0%B8%8D%E0%B8%88%E0%B8%A1%E0%B8%A3%E0%B8%B2%E0%B8%8A%E0%B8%B9%E0%B8%97%E0%B8%B4%E0%B8%A8_%E0%B8%99%E0%B8%84%E0%B8%A3%E0%B8%A8%E0%B8%A3%E0%B8%B5%E0%B8%98%E0%B8%A3%E0%B8%A3%E0%B8%A1%E0%B8%A3%E0%B8%B2%E0%B8%8A'; $this->link_test_validate_url($long_url); } @@ -343,12 +500,18 @@ class LinkValidateSpecificURL extends LinkValidateTestCase { } /** - * A series of tests of links, only going against the link_validate_url function in link.module. + * Validate Url Light. + * + * A series of tests of links, only going against the link_validate_url function + * in link.module. * * Validation is guided by the rules in http://tools.ietf.org/html/rfc1738 ! */ class LinkValidateUrlLight extends DrupalWebTestCase { + /** + * Get Info. + */ public static function getInfo() { return array( 'name' => 'Link Light Validation Tests', @@ -357,66 +520,136 @@ class LinkValidateUrlLight extends DrupalWebTestCase { ); } - function setUp() { + /** + * Setup. + */ + public function setUp() { parent::setUp('link'); } /** - * Translates the LINK type constants to english for display and debugging of tests + * Name Link Type. + * + * Translates the LINK type constants to english for display and debugging of + * tests. + * + * @codingStandardsIgnoreStart */ - function name_Link_Type($type) { + public function name_Link_Type($type) { + // @codingStandardsIgnoreEnd switch ($type) { case LINK_FRONT: return "Front"; + case LINK_EMAIL: return "Email"; + + case LINK_TEL: + return "Telephone"; + case LINK_NEWS: return "Newsgroup"; + case LINK_INTERNAL: return "Internal Link"; + case LINK_EXTERNAL: return "External Link"; + case FALSE: return "Invalid Link"; + default: return "Bad Value:" . $type; } } - // Make sure that a link labeled works. - function testValidateFrontLink() { + /** + * Make sure that a link labeled works. + */ + public function testValidateFrontLink() { $valid = link_validate_url(''); $this->assertEqual(LINK_FRONT, $valid, 'Make sure that front link is verified and identified'); } - function testValidateEmailLink() { + /** + * Validate Email Link. + */ + public function testValidateEmailLink() { $valid = link_validate_url('mailto:bob@example.com'); $this->assertEqual(LINK_EMAIL, $valid, "Make sure a basic mailto is verified and identified"); } - function testValidateEmailLinkBad() { + /** + * Validate Email Link Bad. + */ + public function testValidateEmailLinkBad() { $valid = link_validate_url(':bob@example.com'); $this->assertEqual(FALSE, $valid, 'Make sure just a bad address is correctly failed'); } - function testValidateNewsgroupLink() { + function testValidateTelLinks() { + $links = array( + 'tel:01', + 'tel:123456789012345', + 'tel:+123456789012345', + ); + foreach ($links as $link) { + $type = link_url_type($link); + $this->assertEqual(LINK_TEL, $type, 'Test ' . $link . ' is a tel link.'); + $valid = link_validate_url($link); + $this->assertTrue($valid, 'Test ' . $link . ' is valid tel link.'); + } + } + + function testValidateTelLinksBad() { + $links = array( + 'tel:0', + 'tel:1234567890123456', + 'tel:+1', + 'tel:+0123456789', + 'tel:+1234567890123456', + ':12345678', + ); + foreach ($links as $link) { + $type = link_url_type($link); + $this->assertFalse($type, 'Test ' . $link . ' is not a tel link.'); + $valid = link_validate_url($link); + $this->assertFalse($valid, 'Test ' . $link . ' is not a valid tel link.'); + } + } + + /** + * Validate Newsgroup Link. + */ + public function testValidateNewsgroupLink() { $valid = link_validate_url('news:comp.infosystems.www.misc'); $this->assertEqual(LINK_NEWS, $valid, 'Make sure link to newsgroup validates as news.'); } - function testValidateNewsArticleLink() { + /** + * Validate News Article Link. + */ + public function testValidateNewsArticleLink() { $valid = link_validate_url('news:hj0db8$vrm$1@news.eternal-september.org'); $this->assertEqual(LINK_NEWS, $valid, 'Make sure link to specific article validates as news.'); } - function testValidateBadNewsgroupLink() { + /** + * Validate Bad Newsgroup Link. + */ + public function testValidateBadNewsgroupLink() { $valid = link_validate_url('news:comp.bad_name.misc'); $this->assertEqual(FALSE, $valid, 'newsgroup names can\'t contain underscores, so it should come back as invalid.'); } - function testValidateInternalLinks() { + /** + * Validate Internal Links. + */ + public function testValidateInternalLinks() { $tempfile = drupal_tempnam('public://files', 'test'); $links = array( + 'rss.xml', file_uri_target($tempfile), drupal_realpath($tempfile), ); @@ -429,7 +662,10 @@ class LinkValidateUrlLight extends DrupalWebTestCase { } } - function testValidateExternalLinks() { + /** + * Validate External Links. + */ + public function testValidateExternalLinks() { $links = array( 'http://localhost:8080/', 'www.example.com', @@ -445,7 +681,7 @@ class LinkValidateUrlLight extends DrupalWebTestCase { 'www.test-site.com', 'http://example.com/index.php?q=node/123', 'http://example.com/?first_name=Joe Bob&last_name=Smith', - // Anchors + // Anchors. 'http://www.example.com/index.php#test', 'http://www.example.com/index.php#this@that.', 'http://www.example.com/index.php#', @@ -453,8 +689,22 @@ class LinkValidateUrlLight extends DrupalWebTestCase { 'http://www.archive.org/stream/aesopsfables00aesorich#page/n7/mode/2up', 'http://www.example.com/blah/#this@that?', ); + // Test all of the protocols. - $allowed_protocols = variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal')); + $allowed_protocols = variable_get('filter_allowed_protocols', array( + 'http', + 'https', + 'ftp', + 'news', + 'nntp', + 'telnet', + 'mailto', + 'irc', + 'ssh', + 'sftp', + 'webcal', + )); + foreach ($allowed_protocols as $protocol) { if ($protocol !== 'news' && $protocol !== 'mailto') { $links[] = $protocol . '://www.example.com'; @@ -465,24 +715,28 @@ class LinkValidateUrlLight extends DrupalWebTestCase { $this->assertEqual(LINK_EXTERNAL, $type, 'Testing that ' . $link . ' is an external link.'); $valid = link_validate_url($link); $this->assertTrue($valid, 'Test ' . $link . ' is valid external link.'); - // The following two lines are commented out and only used for comparisons. - //$valid2 = valid_url($link, TRUE); - //$this->assertEqual(TRUE, $valid2, "Using valid_url() on $link."); + // The following two lines are commented out and only used for + // comparisons. + // $valid2 = valid_url($link, TRUE); + // $this->assertEqual(TRUE, $valid2, "Using valid_url() on $link.");. } - // Test if we can make a tld allowable: - variable_set('link_allowed_domains', array('frog')); - $valid = link_validate_url('http://www.example.frog'); - $this->assertEqual(LINK_EXTERNAL, $valid, "Testing that http://www.example.frog is a valid external link if we've added 'frog' to the list of valid domains."); } - function testInvalidExternalLinks() { + /** + * Check Invalid External Links. + */ + public function testInvalidExternalLinks() { $links = array( 'http://www.ex ample.com/', - 'http://25.0.0/', // bad ip! + // Bad ip! + 'http://25.0.0/', 'http://4827.0.0.2/', - '//www.example.com/', - 'http://www.testß.com/', // ß not allowed in domain names! - //'http://www.-fudge.com/', // domains can't have sections starting with a dash. + // ß not allowed in domain names! + 'http://www.testß.com/', + // Bad TLD. + 'http://.www.foo.bar./', + // Domains can't have sections starting with a dash. + // 'http://www.-fudge.com/', 'http://example.com/index.php?page=this\that', 'example@example.com', ); @@ -490,9 +744,6 @@ class LinkValidateUrlLight extends DrupalWebTestCase { $valid = link_validate_url($link); $this->assertEqual(FALSE, $valid, 'Testing that ' . $link . ' is not a valid link.'); } - // Test if we can make a tld disallowed: - variable_set('link_allowed_domains', array('toad')); - $valid = link_validate_url('http://www.example.frog'); - $this->assertEqual(FALSE, $valid, "Testing that http://www.example.frog is an invalid external link if we've not added 'frog' to the list of valid domains."); } + } diff --git a/sites/all/modules/contrib/fields/link/views/link.views.inc b/sites/all/modules/contrib/fields/link/views/link.views.inc deleted file mode 100644 index 27d5182f..00000000 --- a/sites/all/modules/contrib/fields/link/views/link.views.inc +++ /dev/null @@ -1,113 +0,0 @@ - array( - 'path' => drupal_get_path('module', 'link') .'/views', - ), - 'handlers' => array( - 'link_views_handler_argument_target' => array( - 'parent' => 'views_handler_argument', - ), - 'link_views_handler_filter_protocol' => array( - 'parent' => 'views_handler_filter_string', - ), - ), - ); -}*/ - -/** - * Return CCK Views data for the link_field_settings($op == 'views data'). - * - * @TODO: Is there some way to tell views I have formatters for it? - */ -/*function link_views_content_field_data($field) { - // Build the automatic views data provided for us by CCK. - // This creates all the information necessary for the "url" field. - $data = content_views_field_views_data($field); - - $db_info = content_database_info($field); - $table_alias = content_views_tablename($field); - $field_types = _content_field_types(); - - // Tweak the automatic views data for the link "url" field. - // Set the filter title to "@label URL" - $data[$table_alias][$field['field_name'] .'_url']['filter']['title'] = t('@label URL', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']); - // Remove the argument handling for URLs. - unset($data[$table_alias][$field['field_name'] .'_url']['argument']); - - // Build out additional views data for the link "title" field. - $data[$table_alias][$field['field_name'] .'_title'] = array( - 'group' => t('Content'), - 'title' => t('@label title', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')', - 'help' => $data[$table_alias][$field['field_name'] .'_url']['help'], - 'argument' => array( - 'field' => $db_info['columns']['title']['column'], - 'tablename' => $db_info['table'], - 'handler' => 'content_handler_argument_string', - 'click sortable' => TRUE, - 'name field' => '', // TODO, mimic content.views.inc :) - 'content_field_name' => $field['field_name'], - 'allow_empty' => TRUE, - ), - 'filter' => array( - 'field' => $db_info['columns']['title']['column'], - 'title' => t('@label title', array('@label' => t($field_types[$field['type']]['label']))), - 'tablename' => $db_info['table'], - 'handler' => 'content_handler_filter_string', - 'additional fields' => array(), - 'content_field_name' => $field['field_name'], - 'allow_empty' => TRUE, - ), - 'sort' => array( - 'field' => $db_info['columns']['title']['column'], - 'tablename' => $db_info['table'], - 'handler' => 'content_handler_sort', - 'content_field_name' => $field['field_name'], - 'allow_empty' => TRUE, - ), - ); - - // Build out additional Views filter for the link "protocol" pseudo field. - // TODO: Add a protocol argument. - $data[$table_alias][$field['field_name'] .'_protocol'] = array( - 'group' => t('Content'), - 'title' => t('@label protocol', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')', - 'help' => $data[$table_alias][$field['field_name'] .'_url']['help'], - 'filter' => array( - 'field' => $db_info['columns']['url']['column'], - 'title' => t('@label protocol', array('@label' => t($field_types[$field['type']]['label']))), - 'tablename' => $db_info['table'], - 'handler' => 'link_views_handler_filter_protocol', - 'additional fields' => array(), - 'content_field_name' => $field['field_name'], - 'allow_empty' => TRUE, - ), - ); - - // Build out additional Views argument for the link "target" pseudo field. - // TODO: Add a target filter. - $data[$table_alias][$field['field_name'] .'_target'] = array( - 'group' => t('Content'), - 'title' => t('@label target', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')', - 'help' => $data[$table_alias][$field['field_name'] .'_url']['help'], - 'argument' => array( - 'field' => $db_info['columns']['attributes']['column'], - 'title' => t('@label target', array('@label' => t($field_types[$field['type']]['label']))) .': '. t($field['widget']['label']) .' ('. $field['field_name'] .')', - 'tablename' => $db_info['table'], - 'handler' => 'link_views_handler_argument_target', - 'additional fields' => array(), - 'content_field_name' => $field['field_name'], - 'allow_empty' => TRUE, - ), - ); - - return $data; -}*/ diff --git a/sites/all/modules/contrib/fields/link/views/link_views_handler_argument_target.inc b/sites/all/modules/contrib/fields/link/views/link_views_handler_argument_target.inc index f0622d05..2fa1715a 100644 --- a/sites/all/modules/contrib/fields/link/views/link_views_handler_argument_target.inc +++ b/sites/all/modules/contrib/fields/link/views/link_views_handler_argument_target.inc @@ -7,20 +7,26 @@ /** * Argument handler to filter results by target. + * + * @codingStandardsIgnoreStart */ class link_views_handler_argument_target extends views_handler_argument { /** * Provide defaults for the argument when a new one is created. */ - function options(&$options) { - parent::options($options); - } + function option_definition() { + $options = parent::option_definition(); + return $options; + } /** * Provide a default options form for the argument. + * + * @codingStandardsIgnoreStart */ - function options_form(&$form, &$form_state) { + public function options_form(&$form, &$form_state) { + // @codingStandardsIgnoreEnd $defaults = $this->default_actions(); $form['title'] = array( @@ -52,7 +58,7 @@ class link_views_handler_argument_target extends views_handler_argument { $form['wildcard'] = array( '#prefix' => '
    ', - // prefix and no suffix means these two items will be grouped together. + // Prefix and no suffix means these two items will be grouped together. '#type' => 'textfield', '#title' => t('Wildcard'), '#size' => 20, @@ -125,8 +131,8 @@ class link_views_handler_argument_target extends views_handler_argument { asort($validate_types); $form['validate_type']['#options'] = $validate_types; - // Show this gadget if *anything* but 'none' is selected + // Show this gadget if *anything* but 'none' is selected. $form['validate_fail'] = array( '#type' => 'select', '#title' => t('Action to take if argument does not validate'), @@ -140,10 +146,11 @@ class link_views_handler_argument_target extends views_handler_argument { * * The argument sent may be found at $this->argument. */ - function query($group_by = FALSE) { + public function query($group_by = FALSE) { $this->ensure_my_table(); // Because attributes are stored serialized, our only option is to also // serialize the data we're searching for and use LIKE to find similar data. $this->query->add_where(0, $this->table_alias . ' . ' . $this->real_field . " LIKE '%%%s%'", serialize(array('target' => $this->argument))); } + } diff --git a/sites/all/modules/contrib/fields/link/views/link_views_handler_filter_protocol.inc b/sites/all/modules/contrib/fields/link/views/link_views_handler_filter_protocol.inc index a020b4e0..677fee58 100644 --- a/sites/all/modules/contrib/fields/link/views/link_views_handler_filter_protocol.inc +++ b/sites/all/modules/contrib/fields/link/views/link_views_handler_filter_protocol.inc @@ -7,22 +7,29 @@ /** * Filter handler for limiting a view to URLs of a certain protocol. + * + * @codingStandardsIgnoreStart */ class link_views_handler_filter_protocol extends views_handler_filter_string { + /** * Set defaults for the filter options. */ - function options(&$options) { - parent::options($options); + public function option_definition() { + // @codingStandardsIgnoreEnd + $options = parent::option_definition(); + $options['operator'] = 'OR'; $options['value'] = 'http'; $options['case'] = 0; + + return $options; } /** * Define the operators supported for protocols. */ - function operators() { + public function operators() { $operators = array( 'OR' => array( 'title' => t('Is one of'), @@ -35,7 +42,13 @@ class link_views_handler_filter_protocol extends views_handler_filter_string { return $operators; } - function options_form(&$form, &$form_state) { + /** + * Options form. + * + * @codingStandardsIgnoreStart + */ + public function options_form(&$form, &$form_state) { + //@codingStandardsIgnoreEnd parent::options_form($form, $form_state); $form['case'] = array( '#type' => 'value', @@ -45,8 +58,11 @@ class link_views_handler_filter_protocol extends views_handler_filter_string { /** * Provide a select list to choose the desired protocols. + * + * @codingStandardsIgnoreStart */ - function value_form(&$form, &$form_state) { + public function value_form(&$form, &$form_state) { + // @codingStandardsIgnoreEnd // We have to make some choices when creating this as an exposed // filter form. For example, if the operator is locked and thus // not rendered, we can't render dependencies; instead we only @@ -61,7 +77,19 @@ class link_views_handler_filter_protocol extends views_handler_filter_string { '#type' => 'select', '#title' => t('Protocol'), '#default_value' => $this->value, - '#options' => drupal_map_assoc(variable_get('filter_allowed_protocols', array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal'))), + '#options' => drupal_map_assoc(variable_get('filter_allowed_protocols', array( + 'http', + 'https', + 'ftp', + 'news', + 'nntp', + 'telnet', + 'mailto', + 'irc', + 'ssh', + 'sftp', + 'webcal', + ))), '#multiple' => 1, '#size' => 4, '#description' => t('The protocols displayed here are those globally available. You may add more protocols by modifying the filter_allowed_protocols variable in your installation.'), @@ -71,8 +99,11 @@ class link_views_handler_filter_protocol extends views_handler_filter_string { /** * Filter down the query to include only the selected protocols. + * + * @codingStandardsIgnoreStart */ - function op_protocol($field, $upper) { + public function op_protocol($field, $upper) { + // @codingStandardsIgnoreEnd $db_type = db_driver(); $protocols = $this->value; @@ -82,20 +113,25 @@ class link_views_handler_filter_protocol extends views_handler_filter_string { // Simple case, the URL begins with the specified protocol. $condition = $field . ' LIKE \'' . $protocol . '%\''; - // More complex case, no protocol specified but is automatically cleaned up - // by link_cleanup_url(). RegEx is required for this search operation. + // More complex case, no protocol specified but is automatically cleaned + // up by link_cleanup_url(). RegEx is required for this search operation. if ($protocol == 'http') { - $LINK_DOMAINS = _link_domains(); + $link_domains = _link_domains(); if ($db_type == 'pgsql') { - // PostGreSQL code has NOT been tested. Please report any problems to the link issue queue. - // pgSQL requires all slashes to be double escaped in regular expressions. + // PostGreSQL code has NOT been tested. Please report any problems to + // the link issue queue. + // pgSQL requires all slashes to be double escaped in regular + // expressions. + // @codingStandardsIgnoreLine // See http://www.postgresql.org/docs/8.1/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP - $condition .= ' OR ' . $field . ' ~* \'' . '^(([a-z0-9]([a-z0-9\\-_]*\\.)+)(' . $LINK_DOMAINS . '|[a-z][a-z]))' . '\''; + $condition .= ' OR ' . $field . ' ~* \'' . '^(([a-z0-9]([a-z0-9\\-_]*\\.)+)(' . $link_domains . '|[a-z][a-z]))' . '\''; } else { - // mySQL requires backslashes to be double (triple?) escaped within character classes. + // mySQL requires backslashes to be double (triple?) escaped within + // character classes. + // @codingStandardsIgnoreLine // See http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_regexp - $condition .= ' OR ' . $field . ' REGEXP \'' . '^(([a-z0-9]([a-z0-9\\\-_]*\.)+)(' . $LINK_DOMAINS . '|[a-z][a-z]))' . '\''; + $condition .= ' OR ' . $field . ' REGEXP \'' . '^(([a-z0-9]([a-z0-9\\\-_]*\.)+)(' . $link_domains . '|[a-z][a-z]))' . '\''; } } @@ -104,4 +140,5 @@ class link_views_handler_filter_protocol extends views_handler_filter_string { $this->query->add_where($this->options['group'], implode(' ' . $this->operator . ' ', $where_conditions)); } + } diff --git a/sites/all/modules/contrib/search/search_api_solr/CHANGELOG.txt b/sites/all/modules/contrib/search/search_api_solr/CHANGELOG.txt index 68fe9882..a730632d 100644 --- a/sites/all/modules/contrib/search/search_api_solr/CHANGELOG.txt +++ b/sites/all/modules/contrib/search/search_api_solr/CHANGELOG.txt @@ -1,3 +1,23 @@ +Search API Solr Search 1.x, dev (xxxx-xx-xx): +--------------------------------------------- +- #3003819 by mandclu, drunken monkey: Added support for indexing nested + documents. + +Search API Solr Search 1.13 (2018-09-17): +----------------------------------------- +- #2998931 by drunken monkey, mahipal46: Fixed warning during excerpt creation. +- #2459457 by das-peter, drunken monkey, ruloweb, SpadXIII, mkalkbrenner: Added + support for the "(not) between" operator. +- #2970829 by donquixote, drunken monkey: Fixed "missing" facet in PHP 7. +- #2916951 by drunken monkey, mkalkbrenner, osopolar, jcnventura, arcadLemon, + Siridivi: Added support for Solr 7.x. +- #2949293 by Novitsh: Fixed path to README.txt on multilingual sites. +- #2900308 by cgoffin, drunken monkey: Fixed retrieval of multi-valued date + fields in results. +- #2824956 by lex0r, drunken monkey: Added support for atomic updates on API + level. +- #2867076 by Sardis: Fixed Solr config name for Solr 5.x. + Search API Solr Search 1.12 (2017-02-23): ----------------------------------------- - #2612770 by Temoor, drunken monkey: Fixed conjunction in complex filter diff --git a/sites/all/modules/contrib/search/search_api_solr/includes/document.inc b/sites/all/modules/contrib/search/search_api_solr/includes/document.inc index 010744f5..735488e7 100644 --- a/sites/all/modules/contrib/search/search_api_solr/includes/document.inc +++ b/sites/all/modules/contrib/search/search_api_solr/includes/document.inc @@ -96,6 +96,20 @@ class SearchApiSolrDocument implements IteratorAggregate { */ protected $fieldBoosts = array(); + /** + * Document field update values, indexed by name. + * + * @var array + */ + protected $fieldUpdates = array(); + + /** + * Document nested objects. + * + * @var SearchApiSolrDocument[] + */ + protected $nestedObjects = array(); + /** * Clears all boosts and fields from this document. */ @@ -104,6 +118,8 @@ class SearchApiSolrDocument implements IteratorAggregate { $this->fields = array(); $this->fieldBoosts = array(); + $this->fieldUpdates = array(); + $this->nestedObjects = array(); } /** @@ -262,6 +278,42 @@ class SearchApiSolrDocument implements IteratorAggregate { return $this->fieldBoosts; } + /** + * Gets the currently set field's 'update' attribute for a document field. + * + * @param string $key + * The name of the field. + * + * @return string|false + * The currently set field's update attribute, or FALSE if none was set. + */ + public function getFieldUpdate($key) { + return isset($this->fieldUpdates[$key]) ? $this->fieldUpdates[$key] : FALSE; + } + + /** + * Sets the field's 'update' attribute for a document field. + * + * @param string $key + * The name of the field. + * @param string|false $update + * One of the allowed update values ('add', 'set', 'inc'). + */ + public function setFieldUpdate($key, $update) { + $this->fieldUpdates[$key] = $update; + } + + /** + * Retrieves all currently set field updates. + * + * @return string[] + * Associative array of field's "update" attributes that were set, keyed by + * field name. + */ + public function getFieldUpdates() { + return $this->fieldUpdates; + } + /** * Gets the names of all fields in this document. * @@ -282,6 +334,29 @@ class SearchApiSolrDocument implements IteratorAggregate { return array_values($this->fields); } + /** + * Retrieves the nested documents set on this document. + * + * @return \SearchApiSolrDocument[] + * The nested documents. + */ + public function getNestedObjects() { + return $this->nestedObjects; + } + + /** + * Sets an array of nested documents. + * + * Populate nested documents for use with block join queries. Note that this + * will lead to errors when used with Solr versions older than 4.5. + * + * @param SearchApiSolrDocument[] $nested_documents + * An array of SearchApiSolrDocument objects. + */ + public function setNestedDocuments(array $nested_documents) { + $this->nestedObjects = $nested_documents; + } + /** * Implements IteratorAggregate::getIterator(). * @@ -380,35 +455,45 @@ class SearchApiSolrDocument implements IteratorAggregate { $xml .= '>'; - foreach ($this->fields as $key => $value) { + foreach ($this->fields as $key => $values) { $fieldBoost = $this->getFieldBoost($key); + $fieldUpdate = $this->getFieldUpdate($key); $key = htmlspecialchars($key, ENT_COMPAT, 'UTF-8'); - if (is_array($value)) { - foreach ($value as $multivalue) { - $xml .= ''; - } + if (!is_array($values)) { + $values = array($values); } - else { + + foreach ($values as $value) { $xml .= ''; } } + // If nested objects have been added, include them in the XML to be indexed. + foreach ($this->nestedObjects as $object) { + // Skip any documents that aren't of the correct type. + if (!($object instanceof SearchApiSolrDocument)) { + $vars['@type'] = is_object($object) ? get_class($object) : gettype($object); + watchdog('search_api_solr', 'Attempt to add an invalid nested Solr document of type @type.', $vars, WATCHDOG_ERROR); + continue; + } + // Generate the markup for each nested document. + $xml .= $object->toXml(); + } + $xml .= ''; // Remove any control characters to avoid Solr XML parser exception. @@ -432,4 +517,5 @@ class SearchApiSolrDocument implements IteratorAggregate { // Printable utf-8 does not include any of these chars below x7F return preg_replace('@[\x00-\x08\x0B\x0C\x0E-\x1F]@', ' ', $string); } -} \ No newline at end of file + +} diff --git a/sites/all/modules/contrib/search/search_api_solr/includes/service.inc b/sites/all/modules/contrib/search/search_api_solr/includes/service.inc index e80b35fa..6c9765b9 100644 --- a/sites/all/modules/contrib/search/search_api_solr/includes/service.inc +++ b/sites/all/modules/contrib/search/search_api_solr/includes/service.inc @@ -336,6 +336,7 @@ class SearchApiSolrService extends SearchApiAbstractService { // First, check the features we always support. $supported = drupal_map_assoc(array( 'search_api_autocomplete', + 'search_api_between', 'search_api_facets', 'search_api_facets_operator_or', 'search_api_grouping', @@ -646,9 +647,17 @@ class SearchApiSolrService extends SearchApiAbstractService { * This has to consist of both index and item ID. Optionally, the site hash is * also included. * + * @param string $index_id + * The search index's machine name. + * @param mixed $item_id + * The Search API item ID of the item. + * + * @return string + * The Solr ID to use for this item. + * * @see search_api_solr_site_hash() */ - protected function createId($index_id, $item_id) { + public function createId($index_id, $item_id) { $site_hash = !empty($this->options['site_hash']) ? search_api_solr_site_hash() . '-' : ''; return "$site_hash$index_id-$item_id"; } @@ -1303,14 +1312,15 @@ class SearchApiSolrService extends SearchApiAbstractService { // SearchApiSolrService::getFieldNames(). foreach ($fields as $search_api_property => $solr_property) { if (isset($doc->{$solr_property})) { - $result['fields'][$search_api_property] = $doc->{$solr_property}; + $value = $doc->{$solr_property}; // Date fields need some special treatment to become valid date values // (i.e., timestamps) again. if (isset($field_options[$search_api_property]['type']) - && $field_options[$search_api_property]['type'] == 'date' - && preg_match('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/', $result['fields'][$search_api_property])) { - $result['fields'][$search_api_property] = strtotime($result['fields'][$search_api_property]); + && search_api_extract_inner_type($field_options[$search_api_property]['type']) === 'date' + && preg_match('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/', $value)) { + $value = is_array($value) ? array_map('strtotime', $value) : strtotime($value); } + $result['fields'][$search_api_property] = $value; } } @@ -1338,7 +1348,7 @@ class SearchApiSolrService extends SearchApiAbstractService { $index_id = $this->getIndexId($index->machine_name); $solr_id = $this->createId($index_id, $result['id']); - $excerpt = $this->getExcerpt($response, $solr_id, $result['fields'], $fields); + $excerpt = $this->getExcerpt($response, $solr_id, $result['fields'], $fields, $query->getFields()); if ($excerpt) { $result['excerpt'] = $excerpt; } @@ -1364,53 +1374,87 @@ class SearchApiSolrService extends SearchApiAbstractService { * Will also use highlighted fields to replace retrieved field data, if the * corresponding option is set. */ - protected function getExcerpt($response, $id, array &$fields, array $field_mapping) { + protected function getExcerpt($response, $id, array &$fields, array $field_mapping, array $fulltext_fields) { if (!isset($response->highlighting->$id)) { return FALSE; } $output = ''; + $highlighting = $response->highlighting->$id; - if (!empty($this->options['excerpt']) && !empty($response->highlighting->$id->content)) { - foreach ($response->highlighting->$id->content as $snippet) { - $snippet = strip_tags($snippet); - $snippet = preg_replace('/^.*>|<.*$/', '', $snippet); - $snippet = check_plain($snippet); - $snippet = $this->formatHighlighting($snippet); - // The created fragments sometimes have leading or trailing punctuation. - // We remove that here for all common cases, but take care not to remove - // < or > (so HTML tags stay valid). - $snippet = trim($snippet, "\00..\x2F:;=\x3F..\x40\x5B..\x60"); - $output .= $snippet . ' … '; - } + $highlight_fields = !empty($this->options['highlight_data']); + $create_excerpt = !empty($this->options['excerpt']); + if (!$highlight_fields && !$create_excerpt) { + return FALSE; } - if (!empty($this->options['highlight_data'])) { - $prefix = variable_get('search_api_solr_highlight_prefix', 'tm_'); - $prefix_length = strlen($prefix); - foreach ($field_mapping as $search_api_property => $solr_property) { - if (substr($solr_property, 0, $prefix_length) == $prefix && !empty($response->highlighting->$id->$solr_property)) { - $value = $response->highlighting->$id->$solr_property; - $value = $this->sanitizeHighlightValue($value, $search_api_property); - // Remove highlight prefixes and suffixes so we could compare values - // in order to replace the correspond items. - $orig_value = preg_replace('#\[(/?)HIGHLIGHT\]#', '', $value); - $field_values = $this->sanitizeHighlightValue($fields[$search_api_property]); - foreach ($field_values as $delta => $field_value) { - foreach ($orig_value as $num => $item) { - if ($item === $field_value) { - $field_values[$delta] = $this->formatHighlighting($value[$num]); - $change = TRUE; - continue 2; - } - } - } - if (!empty($change)) { - $fields[$search_api_property] = array( - '#value' => $field_values, - '#sanitize_callback' => FALSE, - ); + + // Collect highlighted field values for the excerpt and set them in the + // field values, if requested. + $excerpt_parts = array(); + $field_mapping = array_flip($field_mapping); + $fulltext_fields = drupal_map_assoc($fulltext_fields); + foreach ($highlighting as $solr_property => $values) { + $values = (array) $values; + if (empty($field_mapping[$solr_property])) { + continue; + } + $search_api_property = $field_mapping[$solr_property]; + + // Only use fields that were actually searched for the excerpt. + if (isset($fulltext_fields[$search_api_property])) { + // Remember the highlighted value so we can use it for the excerpt, if + // requested. + $excerpt_parts = array_merge($excerpt_parts, $values); + } + + if (!$highlight_fields) { + continue; + } + + $values = $this->sanitizeHighlightValue($values, $search_api_property); + // Remove highlight prefixes and suffixes so we can compare values in + // order to replace the corresponding items. + $orig_values = preg_replace('#\[(/?)HIGHLIGHT\]#', '', $values); + $field_values = array(); + if (!empty($fields[$search_api_property])) { + $field_values = $this->sanitizeHighlightValue($fields[$search_api_property]); + } + foreach ($field_values as $delta => $field_value) { + foreach ($orig_values as $num => $item) { + if ($item === $field_value) { + $field_values[$delta] = $this->formatHighlighting($values[$num]); + $change = TRUE; + continue 2; } } } + if (!empty($change)) { + $fields[$search_api_property] = array( + '#value' => $field_values, + '#sanitize_callback' => FALSE, + ); + } + } + + // Create an excerpt, if requested. + if ($create_excerpt && $excerpt_parts) { + $excerpt = array(); + $excerpt_length = 0; + foreach ($excerpt_parts as $value) { + // Excerpts don't have HTML (except for the highlighting tags, of + // course). + $value = strip_tags($value); + foreach ($this->extractHighlightingSnippets($value) as $snippet) { + $excerpt[] = $snippet; + $excerpt_length += drupal_strlen($snippet); + // Restrict ourselves to three snippets or 300 characters. + if (count($excerpt) >= 3 || $excerpt_length >= 300) { + break 2; + } + } + } + if ($excerpt) { + $output = implode(' … ', $excerpt) . ' …'; + } } return $output; @@ -1450,6 +1494,84 @@ class SearchApiSolrService extends SearchApiAbstractService { return preg_replace('#\[(/?)HIGHLIGHT\]#', '<$1strong>', $snippet); } + /** + * Extracts short snippets with highlighting from highlighted field values. + * + * @param string $value + * A highlighted field value. + * + * @return string[] + * An array of short, highlighted snippets extracted from the field value. + */ + protected function extractHighlightingSnippets($value) { + $snippets = array(); + $parts = preg_split('#\[/?HIGHLIGHT\]#', $value); + $i = 0; + $combined_length = 0; + while (isset($parts[$i + 2])) { + $prefix = $parts[$i]; + $short_prefix = FALSE; + $key = $parts[++$i]; + $suffix = $parts[++$i]; + + // Make sure prefix and suffix are not too long. + $length = drupal_strlen($prefix); + if ($length > 30) { + $space = strrpos(substr($prefix, 0, -25), ' '); + // Fall back to just cutting at an arbitrary position, space or no. + if ($space === FALSE) { + $space = $length - 30; + } + $prefix = substr($prefix, $space + 1); + } + else { + $short_prefix = TRUE; + } + + $length = drupal_strlen($suffix); + if ($length > 30) { + $space = strpos($suffix, ' ', 25); + // Fall back to just cutting at an arbitrary position, space or no. + if ($space === FALSE) { + $space = 30; + } + $suffix = substr($suffix, 0, $space); + } + + // Fuse two snippets if they are separated by less than 30 characters. + $previous = NULL; + if ($short_prefix) { + $previous = array_pop($snippets); + if ($previous) { + $prefix = ''; + } + } + $snippet = $prefix . '[HIGHLIGHT]' . $key . '[/HIGHLIGHT]' . $suffix; + + // Sanitize and format the snippet. + $snippet = check_plain($snippet); + $snippet = $this->formatHighlighting($snippet); + // The created fragments sometimes have leading or trailing punctuation. + // We remove that here for all common cases, but take care not to remove + // < or > (so HTML tags stay valid). + $snippet = trim($snippet, "\00..\x2F:;=\x3F..\x40\x5B..\x60"); + + // Prepend the previous snippet if we're fusing. + if ($previous) { + $snippet = $previous . $snippet; + } + + $snippets[] = $snippet; + $combined_length += drupal_strlen($snippet); + + // Restrict ourselves to three snippets or 300 characters. + if (count($snippets) >= 3 || $combined_length >= 300) { + break; + } + } + return $snippets; + } + /** * Extract facets from a Solr response. * @@ -1474,18 +1596,21 @@ class SearchApiSolrService extends SearchApiAbstractService { if (isset($response->facet_counts->facet_fields)) { $facet_fields = $response->facet_counts->facet_fields; + // The key for the "missing" facet (empty string in the JSON). This will + // be either "" or "_empty_", depending on the PHP version. + $empty_key = key((array) json_decode('{"":5}')); foreach ($extract_facets as $delta => $info) { $field = $fields[$info['field']]; if (!empty($facet_fields->$field)) { $min_count = $info['min_count']; $terms = $facet_fields->$field; if ($info['missing']) { - // We have to correctly incorporate the "_empty_" term. + // We have to correctly incorporate the "missing" term ($empty_key). // This will ensure that the term with the least results is dropped, // if the limit would be exceeded. - if (isset($terms->_empty_)) { - if ($terms->_empty_ < $min_count) { - unset($terms->_empty_); + if (isset($terms->$empty_key)) { + if ($terms->$empty_key < $min_count) { + unset($terms->$empty_key); } else { $terms = (array) $terms; @@ -1496,14 +1621,14 @@ class SearchApiSolrService extends SearchApiAbstractService { } } } - elseif (isset($terms->_empty_)) { + elseif (isset($terms->$empty_key)) { $terms = clone $terms; - unset($terms->_empty_); + unset($terms->$empty_key); } $type = isset($index->options['fields'][$info['field']]['type']) ? search_api_extract_inner_type($index->options['fields'][$info['field']]['type']) : 'string'; foreach ($terms as $term => $count) { if ($count >= $min_count) { - if ($term === '_empty_') { + if ($term === $empty_key) { $term = '!'; } elseif ($type == 'boolean') { @@ -1691,8 +1816,19 @@ class SearchApiSolrService extends SearchApiAbstractService { if ($value === NULL) { return ($operator == '=' ? '*:* AND -' : '') . "$field:[* TO *]"; } - $value = $this->formatFilterValue($value, search_api_extract_inner_type($field_info['type'])); - switch ($operator) { + + $type = search_api_extract_inner_type($field_info['type']); + if (!is_array($value)) { + $value = $this->formatFilterValue($value, $type); + } + else { + foreach($value as &$val) { + $val = $this->formatFilterValue($val, $type); + } + unset($val); + } + + switch (strtoupper($operator)) { case '<>': return "*:* AND -($field:$value)"; case '<': @@ -1703,6 +1839,10 @@ class SearchApiSolrService extends SearchApiAbstractService { return "$field:[$value TO *]"; case '>': return "$field:{{$value} TO *}"; + case 'BETWEEN': + return "$field:[{$value[0]} TO {$value[1]}]"; + case 'NOT BETWEEN': + return "*:* AND -$field:[{$value[0]} TO {$value[1]}]"; default: return "$field:$value"; @@ -1794,29 +1934,11 @@ class SearchApiSolrService extends SearchApiAbstractService { if (!empty($this->options['excerpt']) || !empty($this->options['highlight_data'])) { $highlight_params['hl'] = 'true'; - $highlight_params['hl.fl'] = 'content'; + $highlight_params['hl.fl'] = variable_get('search_api_solr_highlight_prefix', 'tm_') . '*'; $highlight_params['hl.simple.pre'] = '[HIGHLIGHT]'; $highlight_params['hl.simple.post'] = '[/HIGHLIGHT]'; - $highlight_params['hl.snippets'] = 3; - $highlight_params['hl.fragsize'] = 70; - $highlight_params['hl.mergeContiguous'] = 'true'; - } - - if (!empty($this->options['highlight_data'])) { - $highlight_params['hl.fl'] = variable_get('search_api_solr_highlight_prefix', 'tm_') . '*'; $highlight_params['hl.snippets'] = 1; $highlight_params['hl.fragsize'] = 0; - if (!empty($this->options['excerpt'])) { - // If we also generate a "normal" excerpt, set the settings for the - // "content" field (which we use to generate the excerpt) back to the - // above values. - $highlight_params['f.content.hl.snippets'] = 3; - $highlight_params['f.content.hl.fragsize'] = 70; - // It regrettably doesn't seem to be possible to set hl.fl to several - // values, if one contains wild cards (i.e., "t_*,content" wouldn't - // work). - $highlight_params['hl.fl'] = '*'; - } } return $highlight_params; @@ -2252,18 +2374,19 @@ class SearchApiSolrService extends SearchApiAbstractService { $solr_id = $this->createId($doc->index_id, $doc->item_id); foreach ($fields as $search_api_property => $solr_property) { if (isset($doc->{$solr_property})) { - $result['fields'][$search_api_property] = $doc->{$solr_property}; + $value = $doc->{$solr_property}; // Date fields need some special treatment to become valid date values // (i.e., timestamps) again. if (isset($field_options[$search_api_property]['type']) - && $field_options[$search_api_property]['type'] == 'date' - && preg_match('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/', $result['fields'][$search_api_property])) { - $result['fields'][$search_api_property] = strtotime($result['fields'][$search_api_property]); + && search_api_extract_inner_type($field_options[$search_api_property]['type']) === 'date' + && preg_match('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/', $value)) { + $value = is_array($value) ? array_map('strtotime', $value) : strtotime($value); } + $result['fields'][$search_api_property] = $value; } } - $excerpt = $this->getExcerpt($response, $solr_id, $result['fields'], $fields); + $excerpt = $this->getExcerpt($response, $solr_id, $result['fields'], $fields, $search_fields); if ($excerpt) { $result['excerpt'] = $excerpt; } @@ -2280,18 +2403,21 @@ class SearchApiSolrService extends SearchApiAbstractService { if (isset($response->facet_counts->facet_fields)) { $results['search_api_facets'] = array(); $facet_fields = $response->facet_counts->facet_fields; + // The key for the "missing" facet (empty string in the JSON). This will + // be either "" or "_empty_", depending on the PHP version. + $empty_key = key((array) json_decode('{"":5}')); foreach ($facets as $delta => $info) { $field = $solr_fields[$info['field']]; if (!empty($facet_fields->$field)) { $min_count = $info['min_count']; $terms = $facet_fields->$field; if ($info['missing']) { - // We have to correctly incorporate the "_empty_" term. + // We have to correctly incorporate the "missing" term ($empty_key). // This will ensure that the term with the least results is dropped, // if the limit would be exceeded. - if (isset($terms->_empty_)) { - if ($terms->_empty_ < $min_count) { - unset($terms->_empty_); + if (isset($terms->$empty_key)) { + if ($terms->$empty_key < $min_count) { + unset($terms->$empty_key); } else { $terms = (array) $terms; @@ -2302,14 +2428,14 @@ class SearchApiSolrService extends SearchApiAbstractService { } } } - elseif (isset($terms->_empty_)) { + elseif (isset($terms->$empty_key)) { $terms = clone $terms; - unset($terms->_empty_); + unset($terms->$empty_key); } $type = isset($fields[$info['field']]['type']) ? search_api_extract_inner_type($fields[$info['field']]['type']) : 'string'; foreach ($terms as $term => $count) { if ($count >= $min_count) { - if ($term === '_empty_') { + if ($term === $empty_key) { $term = '!'; } elseif ($type == 'boolean') { diff --git a/sites/all/modules/contrib/search/search_api_solr/search_api_solr.info b/sites/all/modules/contrib/search/search_api_solr/search_api_solr.info index 0ea0d30c..102b9bf2 100644 --- a/sites/all/modules/contrib/search/search_api_solr/search_api_solr.info +++ b/sites/all/modules/contrib/search/search_api_solr/search_api_solr.info @@ -11,9 +11,8 @@ files[] = includes/solr_connection.interface.inc files[] = includes/solr_field.inc files[] = includes/spellcheck.inc -; Information added by Drupal.org packaging script on 2017-02-23 -version = "7.x-1.12" +; Information added by Drupal.org packaging script on 2018-10-10 +version = "7.x-1.14" core = "7.x" project = "search_api_solr" -datestamp = "1487844794" - +datestamp = "1539161895" diff --git a/sites/all/modules/contrib/search/search_api_solr/search_api_solr.module b/sites/all/modules/contrib/search/search_api_solr/search_api_solr.module index f3d943f9..ba2a24e4 100644 --- a/sites/all/modules/contrib/search/search_api_solr/search_api_solr.module +++ b/sites/all/modules/contrib/search/search_api_solr/search_api_solr.module @@ -31,7 +31,7 @@ function search_api_solr_menu() { function search_api_solr_search_api_service_info() { $variables = array( '@solr_wiki_url' => url('http://wiki.apache.org/solr/SolrQuerySyntax'), - '@readme_url' => url(drupal_get_path('module', 'search_api_solr') . '/README.txt'), + '@readme_url' => file_create_url(drupal_get_path('module', 'search_api_solr') . '/README.txt'), ); $services['search_api_solr_service'] = array( 'name' => t('Solr service'), diff --git a/sites/all/modules/contrib/search/search_api_solr/solr-conf/5.x/solrconfig.xml b/sites/all/modules/contrib/search/search_api_solr/solr-conf/5.x/solrconfig.xml index c378343a..61b898b3 100644 --- a/sites/all/modules/contrib/search/search_api_solr/solr-conf/5.x/solrconfig.xml +++ b/sites/all/modules/contrib/search/search_api_solr/solr-conf/5.x/solrconfig.xml @@ -20,7 +20,7 @@ For more details about configurations options that may appear in this file, see http://wiki.apache.org/solr/SolrConfigXml. --> - + + + + + + + + diff --git a/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/mapping-ISOLatin1Accent.txt b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/mapping-ISOLatin1Accent.txt new file mode 100644 index 00000000..b92d03c5 --- /dev/null +++ b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/mapping-ISOLatin1Accent.txt @@ -0,0 +1,14 @@ +# This file contains character mappings for the default fulltext field type. +# The source characters (on the left) will be replaced by the respective target +# characters before any other processing takes place. +# Lines starting with a pound character # are ignored. +# +# For sensible defaults, use the mapping-ISOLatin1Accent.txt file distributed +# with the example application of your Solr version. +# +# Examples: +# "À" => "A" +# "\u00c4" => "A" +# "\u00c4" => "\u0041" +# "æ" => "ae" +# "\n" => " " diff --git a/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/protwords.txt b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/protwords.txt new file mode 100644 index 00000000..cda85814 --- /dev/null +++ b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/protwords.txt @@ -0,0 +1,7 @@ +#----------------------------------------------------------------------- +# This file blocks words from being operated on by the stemmer and word delimiter. +& +< +> +' +" diff --git a/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/schema.xml b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/schema.xml new file mode 100644 index 00000000..de61b0eb --- /dev/null +++ b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/schema.xml @@ -0,0 +1,693 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + + + + + + + + + diff --git a/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/schema_extra_fields.xml b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/schema_extra_fields.xml new file mode 100644 index 00000000..02b36555 --- /dev/null +++ b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/schema_extra_fields.xml @@ -0,0 +1,23 @@ + + + + diff --git a/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/schema_extra_types.xml b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/schema_extra_types.xml new file mode 100644 index 00000000..bd716b82 --- /dev/null +++ b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/schema_extra_types.xml @@ -0,0 +1,34 @@ + + + + diff --git a/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/solrconfig.xml b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/solrconfig.xml new file mode 100644 index 00000000..36e6fa14 --- /dev/null +++ b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/solrconfig.xml @@ -0,0 +1,1793 @@ + + + + + + + + + ${solr.abortOnConfigurationError:true} + + + ${solr.luceneMatchVersion:LUCENE_60} + + + + + + + + + + + + + + + + + + + + + + + + + + ${solr.data.dir:} + + + + + + + + + + + + + + + + + + + + + + + + 32 + + + + + + + 4 + + + + + + + ${solr.lock.type:native} + + + + + + true + + + + + 1 + + 0 + + + + + + true + + + + + + + + + + + + + + + + ${solr.autoCommit.MaxDocs:10000} + ${solr.autoCommit.MaxTime:120000} + + + + + ${solr.autoSoftCommit.MaxDocs:2000} + ${solr.autoSoftCommit.MaxTime:10000} + + + + + + + + + ${solr.data.dir:} + + + + + + + + + + + 1024 + + + -1 + + + + + + + + + + + + + + + + + + + + true + + + + + + 20 + + + 200 + + + + + + + + + + + + solr rocks010 + + + + + + false + + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + explicit + json + true + text + + + + + + + + {!xport} + xsort + false + + + + query + + + + + + + + + + + + + + + + + edismax + content + explicit + true + 0.01 + + ${solr.pinkPony.timeAllowed:-1} + *:* + + + false + + true + false + + 1 + + + spellcheck + elevator + + + + + + + content + 1 + 1 + 3 + 15 + 20 + false + + ${solr.mlt.timeAllowed:2000} + + + + + + + content + explicit + true + + + + + + + + text + + + + + + + _src_ + + true + + + + + + + + + + + + + + + text + true + ignored_ + + + true + links + ignored_ + + + + + + + + + + + + + + + + + + + + + + + + + + + explicit + true + + + + + + + ${solr.replication.master:false} + commit + startup + ${solr.replication.confFiles:schema.xml,mapping-ISOLatin1Accent.txt,protwords.txt,stopwords.txt,synonyms.txt,elevate.xml} + + + ${solr.replication.slave:false} + ${solr.replication.masterUrl:http://localhost:8983/solr}/replication + ${solr.replication.pollInterval:00:00:60} + + + + + + + true + json + true + + + + + + + + + + default + wordbreak + false + false + 1 + 5 + 5 + true + true + 10 + 5 + + + spellcheck + + + + + + + mySuggester + FuzzyLookupFactory + DocumentDictionaryFactory + cat + price + string + + + + + + true + 10 + + + suggest + + + + + + + + + + true + + + tvComponent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + terms + + + + + + + string + elevate.xml + + + + + + explicit + + + elevator + + + + + + + + + + + 100 + + + + + + + + 70 + + 0.5 + + [-\w ,/\n\"']{20,200} + + + + + + + ]]> + ]]> + + + + + + + + + + + + + + + + + + + + + ,, + ,, + ,, + ,, + ,]]> + ]]> + + + + + + 10 + .,!? + + + + + + + WORD + + + en + US + + + + + + + + + + + + + + + + + + + text/plain; charset=UTF-8 + + + + + + + + + 5 + + + + + + + + + + + + + *:* + + + + + + + + + + + + textSpell + + + + default + spell + spellchecker + true + + + + + + diff --git a/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/solrconfig_extra.xml b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/solrconfig_extra.xml new file mode 100644 index 00000000..c5bc3acf --- /dev/null +++ b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/solrconfig_extra.xml @@ -0,0 +1,80 @@ + + + +textSpell + + + + + + default + spell + spellchecker + true + + + + + + + + + + + + + + + diff --git a/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/solrcore.properties b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/solrcore.properties new file mode 100644 index 00000000..fb8d7d05 --- /dev/null +++ b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/solrcore.properties @@ -0,0 +1,20 @@ +# Defines Solr properties for this specific core. +solr.replication.master=false +solr.replication.slave=false +solr.replication.pollInterval=00:00:60 +solr.replication.masterUrl=http://localhost:8983/solr +solr.replication.confFiles=schema.xml,mapping-ISOLatin1Accent.txt,protwords.txt,stopwords.txt,synonyms.txt,elevate.xml +solr.mlt.timeAllowed=2000 +# You should not set your luceneMatchVersion to anything lower than your Solr +# Version. +solr.luceneMatchVersion=6.0 +solr.pinkPony.timeAllowed=-1 +# autoCommit after 10000 docs +solr.autoCommit.MaxDocs=10000 +# autoCommit after 2 minutes +solr.autoCommit.MaxTime=120000 +# autoSoftCommit after 2000 docs +solr.autoSoftCommit.MaxDocs=2000 +# autoSoftCommit after 10 seconds +solr.autoSoftCommit.MaxTime=10000 +solr.contrib.dir=../../../contrib diff --git a/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/stopwords.txt b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/stopwords.txt new file mode 100644 index 00000000..d7f243e4 --- /dev/null +++ b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/stopwords.txt @@ -0,0 +1,4 @@ +# Contains words which shouldn't be indexed for fulltext fields, e.g., because +# they're too common. For documentation of the format, see +# http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.StopFilterFactory +# (Lines starting with a pound character # are ignored.) diff --git a/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/synonyms.txt b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/synonyms.txt new file mode 100644 index 00000000..7d22eea6 --- /dev/null +++ b/sites/all/modules/contrib/search/search_api_solr/solr-conf/7.x/synonyms.txt @@ -0,0 +1,3 @@ +# Contains synonyms to use for your index. For the format used, see +# http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory +# (Lines starting with a pound character # are ignored.) diff --git a/sites/all/modules/contrib/views/views/handlers/views_handler_argument_null.inc b/sites/all/modules/contrib/views/views/handlers/views_handler_argument_null.inc index ac668fbb..afe0c606 100644 --- a/sites/all/modules/contrib/views/views/handlers/views_handler_argument_null.inc +++ b/sites/all/modules/contrib/views/views/handlers/views_handler_argument_null.inc @@ -44,7 +44,7 @@ class views_handler_argument_null extends views_handler_argument { */ public function default_actions($which = NULL) { if ($which) { - if (in_array($which, array('ignore', 'not found', 'empty', 'default'))) { + if (in_array($which, array('ignore', 'not found', 'empty', 'default', 'access denied'))) { return parent::default_actions($which); } return; diff --git a/sites/all/modules/contrib/views/views/handlers/views_handler_field.inc b/sites/all/modules/contrib/views/views/handlers/views_handler_field.inc index 15057f13..f33cf884 100644 --- a/sites/all/modules/contrib/views/views/handlers/views_handler_field.inc +++ b/sites/all/modules/contrib/views/views/handlers/views_handler_field.inc @@ -390,8 +390,7 @@ class views_handler_field extends views_handler { * Optional name of the field where the value is stored. */ public function get_value($values, $field = NULL) { - // $alias = isset($field) ? $this->aliases[$field] : $this->field_alias; - $alias = isset($field) && isset($this->aliases[$field]) ? $this->aliases[$field] : $this->field_alias; + $alias = isset($field) ? $this->aliases[$field] : $this->field_alias; if (isset($values->{$alias})) { return $values->{$alias}; } diff --git a/sites/all/modules/contrib/views/views/handlers/views_handler_field_serialized.inc b/sites/all/modules/contrib/views/views/handlers/views_handler_field_serialized.inc index ae18712b..d0242b71 100644 --- a/sites/all/modules/contrib/views/views/handlers/views_handler_field_serialized.inc +++ b/sites/all/modules/contrib/views/views/handlers/views_handler_field_serialized.inc @@ -71,7 +71,7 @@ class views_handler_field_serialized extends views_handler_field { return check_plain($value[$this->options['key']]); } - return $value; + return check_plain($value); } } diff --git a/sites/all/modules/contrib/views/views/includes/handlers.inc b/sites/all/modules/contrib/views/views/includes/handlers.inc index 0e7af4ae..d631c052 100644 --- a/sites/all/modules/contrib/views/views/includes/handlers.inc +++ b/sites/all/modules/contrib/views/views/includes/handlers.inc @@ -996,58 +996,39 @@ class views_many_to_one_helper { return $this->handler->table_alias; } - // Case 2: it's an 'and' or an 'or'. + // Case 2: it's anything but an 'or'. // We do one join per selected value. - if ($this->handler->operator != 'not') { - // Clone the join for each table. - $this->handler->table_aliases = array(); - foreach ($this->handler->value as $value) { - $join = $this->get_join(); - if ($this->handler->operator == 'and') { - $join->type = 'INNER'; - } - $join->extra = array( - array( - 'field' => $this->handler->real_field, - 'value' => $value, - 'numeric' => !empty($this->handler->definition['numeric']), - ), - ); - // The table alias needs to be unique to this value across the - // multiple times the filter or argument is called by the view. - if (!isset($this->handler->view->many_to_one_aliases[$field][$value])) { - if (!isset($this->handler->view->many_to_one_count[$this->handler->table])) { - $this->handler->view->many_to_one_count[$this->handler->table] = 0; - } - $this->handler->view->many_to_one_aliases[$field][$value] = $this->handler->table . '_value_' . ($this->handler->view->many_to_one_count[$this->handler->table]++); + // Clone the join for each table: + $this->handler->table_aliases = array(); + foreach ($this->handler->value as $value) { + $join = $this->get_join(); + if ($this->handler->operator == 'and') { + $join->type = 'INNER'; + } + if (empty($join->extra)) { + $join->extra = array(); + } + $join->extra[] = array( + 'field' => $this->handler->real_field, + 'value' => $value, + 'numeric' => !empty($this->handler->definition['numeric']), + ); + // The table alias needs to be unique to this value across the + // multiple times the filter or argument is called by the view. + if (!isset($this->handler->view->many_to_one_aliases[$field][$value])) { + if (!isset($this->handler->view->many_to_one_count[$this->handler->table])) { + $this->handler->view->many_to_one_count[$this->handler->table] = 0; } - $alias = $this->handler->table_aliases[$value] = $this->add_table($join, $this->handler->view->many_to_one_aliases[$field][$value]); - + $this->handler->view->many_to_one_aliases[$field][$value] = $this->handler->table . '_value_' . ($this->handler->view->many_to_one_count[$this->handler->table]++); + $alias = $this->handler->table_aliases[$value] = $this->add_table($join, + $this->handler->view->many_to_one_aliases[$field][$value]); // and set table_alias to the first of these. if (empty($this->handler->table_alias)) { $this->handler->table_alias = $alias; } } } - // Case 3: it's a 'not'. - // We just do one join. We'll add a where clause during the query phase - // to ensure that $table.$field IS NULL. - else { - $join = $this->get_join(); - $join->type = 'LEFT'; - $join->extra = array(); - $join->extra_type = 'OR'; - foreach ($this->handler->value as $value) { - $join->extra[] = array( - 'field' => $this->handler->real_field, - 'value' => $value, - 'numeric' => !empty($this->handler->definition['numeric']), - ); - } - - $this->handler->table_alias = $this->add_table($join); - } } return $this->handler->table_alias; } @@ -1081,12 +1062,7 @@ class views_many_to_one_helper { // Determine whether a single expression is enough(FALSE) or the conditions // should be added via an db_or()/db_and() (TRUE). $add_condition = TRUE; - if ($operator == 'not') { - $value = NULL; - $operator = 'IS NULL'; - $add_condition = FALSE; - } - elseif ($operator == 'or' && empty($options['reduce_duplicates'])) { + if ($operator == 'or' && empty($options['reduce_duplicates'])) { if (count($value) > 1) { $operator = 'IN'; } @@ -1120,6 +1096,9 @@ class views_many_to_one_helper { $field = $this->handler->real_field; $clause = $operator == 'or' ? db_or() : db_and(); foreach ($this->handler->table_aliases as $value => $alias) { + if ($operator == 'not') { + $value = NULL; + } $clause->condition("$alias.$field", $value); } diff --git a/sites/all/modules/contrib/views/views/includes/view.inc b/sites/all/modules/contrib/views/views/includes/view.inc index 13e4987f..ae6df4c6 100644 --- a/sites/all/modules/contrib/views/views/includes/view.inc +++ b/sites/all/modules/contrib/views/views/includes/view.inc @@ -1236,7 +1236,7 @@ class view extends views_db_object { if (!empty($this->build_info['fail'])) { return; } - if (!empty($this->view->build_info['denied'])) { + if (!empty($this->build_info['denied'])) { return; } diff --git a/sites/all/modules/contrib/views/views/plugins/views_plugin_display_feed.inc b/sites/all/modules/contrib/views/views/plugins/views_plugin_display_feed.inc index 07e5bc2f..a3c2333c 100644 --- a/sites/all/modules/contrib/views/views/plugins/views_plugin_display_feed.inc +++ b/sites/all/modules/contrib/views/views/plugins/views_plugin_display_feed.inc @@ -51,6 +51,9 @@ class views_plugin_display_feed extends views_plugin_display_page { */ public function execute() { $output = $this->view->render(); + if (!empty($this->view->build_info['denied'])) { + return MENU_ACCESS_DENIED; + } if (empty($output)) { return MENU_NOT_FOUND; } diff --git a/sites/all/modules/contrib/views/views/tests/views_argument_validator.test b/sites/all/modules/contrib/views/views/tests/views_argument_validator.test index 6e2eedba..6927584d 100644 --- a/sites/all/modules/contrib/views/views/tests/views_argument_validator.test +++ b/sites/all/modules/contrib/views/views/tests/views_argument_validator.test @@ -40,10 +40,27 @@ class ViewsArgumentValidatorTest extends ViewsSqlTest { $this->assertTrue($view->argument['null']->validate_arg(12)); } + /** + * Make sure argument validation works properly. + */ + function testArgumentValidatePhpFailure() { + $view = $this->view_test_argument_validate_php_failure(); + $view->save(); + $this->drupalGet('test-php-failure'); + + // This should return a 403, indicating that the arguments validation fails. + $this->assertResponse(403); + + $this->drupalGet('test-php-failure-feed'); + + // This should return a 403, indicating that the arguments validation fails. + $this->assertResponse(403); + } + function view_test_argument_validate_php($string) { $code = 'return $argument == \'' . $string . '\';'; $view = new view(); - $view->name = 'view_argument_validate_numeric'; + $view->name = 'view_argument_validate_php'; $view->description = ''; $view->tag = ''; $view->view_php = ''; @@ -104,4 +121,68 @@ class ViewsArgumentValidatorTest extends ViewsSqlTest { return $view; } + /** + * + * + * @return view $view + * The required view object. + */ + function view_test_argument_validate_php_failure() { + $view = new view(); + $view->name = 'view_argument_validate_php_failure'; + $view->description = ''; + $view->tag = ''; + $view->base_table = 'node'; + $view->human_name = ''; + $view->core = 0; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['access']['type'] = 'none'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'none'; + $handler->display->display_options['style_plugin'] = 'default'; + $handler->display->display_options['row_plugin'] = 'fields'; + /* Field: Content: Title */ + $handler->display->display_options['fields']['title']['id'] = 'title'; + $handler->display->display_options['fields']['title']['table'] = 'node'; + $handler->display->display_options['fields']['title']['field'] = 'title'; + $handler->display->display_options['fields']['title']['label'] = ''; + $handler->display->display_options['fields']['title']['element_label_colon'] = FALSE; + $handler->display->display_options['fields']['title']['link_to_node'] = FALSE; + /* Contextual filter: Global: Null */ + $handler->display->display_options['arguments']['null']['id'] = 'null'; + $handler->display->display_options['arguments']['null']['table'] = 'views'; + $handler->display->display_options['arguments']['null']['field'] = 'null'; + $handler->display->display_options['arguments']['null']['default_action'] = 'default'; + $handler->display->display_options['arguments']['null']['default_argument_type'] = 'fixed'; + $handler->display->display_options['arguments']['null']['default_argument_options']['argument'] = 'No filter'; + $handler->display->display_options['arguments']['null']['summary']['number_of_records'] = '0'; + $handler->display->display_options['arguments']['null']['summary']['format'] = 'default_summary'; + $handler->display->display_options['arguments']['null']['summary_options']['items_per_page'] = '25'; + $handler->display->display_options['arguments']['null']['specify_validation'] = TRUE; + $handler->display->display_options['arguments']['null']['validate']['type'] = 'php'; + $handler->display->display_options['arguments']['null']['validate_options']['code'] = 'return FALSE;'; + $handler->display->display_options['arguments']['null']['validate']['fail'] = 'access denied'; + + /* Display: Page */ + $handler = $view->new_display('page', 'Page', 'page_1'); + $handler->display->display_options['path'] = 'test-php-failure'; + + /* Display: Feed */ + $handler = $view->new_display('feed', 'Feed', 'feed_1'); + $handler->display->display_options['path'] = 'test-php-failure-feed'; + $handler->display->display_options['pager']['type'] = 'none'; + $handler->display->display_options['pager']['options']['offset'] = '0'; + $handler->display->display_options['style_plugin'] = 'rss'; + $handler->display->display_options['row_plugin'] = 'node_rss'; + + return $view; + } + } diff --git a/sites/all/modules/contrib/views/views/tests/views_handler_filter.test b/sites/all/modules/contrib/views/views/tests/views_handler_filter.test new file mode 100644 index 00000000..e41b35a3 --- /dev/null +++ b/sites/all/modules/contrib/views/views/tests/views_handler_filter.test @@ -0,0 +1,161 @@ + 'Handler filter test', + 'description' => 'test filter handler definitions', + 'group' => 'Views', + ); + } + + /** + * {@inheritdoc} + */ + protected function setUp() { + // The Views and Views UI modules will be enabled with this. + parent::setUp(); + + // Assign vocabulary 'tag' to user entity. + $field_definition = field_read_field('field_tags'); + $instance_definition = array( + 'field_name' => $field_definition['field_name'], + 'entity_type' => 'user', + 'bundle' => 'user', + 'widget' => array( + 'type' => 'taxonomy_autocomplete', + ), + 'display' => array( + 'default' => array( + 'type' => 'taxonomy_term_reference_link', + 'weight' => 10, + ), + 'teaser' => array( + 'type' => 'taxonomy_term_reference_link', + 'weight' => 10, + ), + ), + ); + field_create_instance($instance_definition); + } + + /** + * Tests "is all of" of filter operation. + */ + function testFilterInOperatorUi() { + $term = $this->drupalCreateTerm(1); + + $node1 = $this->drupalCreateNode(array('type' => 'article','field_tags_tid' => $term->tid, 'created' => REQUEST_TIME)); + $node2 = $this->drupalCreateNode(array('type' => 'article', 'created' => REQUEST_TIME + 1)); + $user2 = $this->drupalCreateUser(array('access content')); + // $this->drupalLogin($this->drupalCreateUser(array('administer users')); + $this->drupalLogin($this->drupalCreateUser(array('administer users', 'access administration pages', 'administer site configuration', 'administer nodes', 'bypass node access'))); + + $this->drupalGet('node/1/edit'); + $edit['field_tags' . '[' . LANGUAGE_NONE . ']'] = $term->name; + $this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Save')); + + $edit['field_tags' . '[' . LANGUAGE_NONE . ']'] = $term->name; + $this->drupalPost('user/' . $user2->uid . '/edit', $edit, t('Save')); + + $result[] = array('nid' => $node1->nid); + $view = $this->get_sample_view(); + $this->executeView($view); + $this->assertIdenticalResultset($view, $result); + } + + /** + * Sample view. + * + * @return \view + */ + protected function get_sample_view() { + $view = new view(); + $view->name = 'article'; + $view->description = ''; + $view->tag = 'default'; + $view->base_table = 'node'; + $view->human_name = 'Article'; + $view->core = 7; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['title'] = 'Article'; + $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['access']['type'] = 'perm'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'full'; + $handler->display->display_options['pager']['options']['items_per_page'] = '10'; + $handler->display->display_options['style_plugin'] = 'table'; + $handler->display->display_options['style_options']['columns'] = array( + 'title' => 'title', + ); + $handler->display->display_options['style_options']['default'] = '-1'; + $handler->display->display_options['style_options']['info'] = array( + 'title' => array( + 'sortable' => 0, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + ); + /* Field: Content: Nid */ + $handler->display->display_options['fields']['nid']['id'] = 'nid'; + $handler->display->display_options['fields']['nid']['table'] = 'node'; + $handler->display->display_options['fields']['nid']['field'] = 'nid'; + $handler->display->display_options['fields']['nid']['label'] = ''; + $handler->display->display_options['fields']['nid']['element_label_colon'] = FALSE; + /* Sort criterion: Content: Post date */ + $handler->display->display_options['sorts']['created']['id'] = 'created'; + $handler->display->display_options['sorts']['created']['table'] = 'node'; + $handler->display->display_options['sorts']['created']['field'] = 'created'; + $handler->display->display_options['sorts']['created']['order'] = 'DESC'; + /* Filter criterion: Content: Published */ + $handler->display->display_options['filters']['status']['id'] = 'status'; + $handler->display->display_options['filters']['status']['table'] = 'node'; + $handler->display->display_options['filters']['status']['field'] = 'status'; + $handler->display->display_options['filters']['status']['value'] = 1; + $handler->display->display_options['filters']['status']['group'] = 1; + $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; + /* Filter criterion: Field: Tags (field_tags) */ + $handler->display->display_options['filters']['field_tags_tid']['id'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['table'] = 'field_data_field_tags'; + $handler->display->display_options['filters']['field_tags_tid']['field'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['operator'] = 'and'; + $handler->display->display_options['filters']['field_tags_tid']['value'] = array( + 0 => '1', + ); + $handler->display->display_options['filters']['field_tags_tid']['expose']['operator_id'] = 'field_tags_tid_op'; + $handler->display->display_options['filters']['field_tags_tid']['expose']['label'] = 'Tags (field_tags)'; + $handler->display->display_options['filters']['field_tags_tid']['expose']['operator'] = 'field_tags_tid_op'; + $handler->display->display_options['filters']['field_tags_tid']['expose']['identifier'] = 'field_tags_tid'; + $handler->display->display_options['filters']['field_tags_tid']['expose']['remember_roles'] = array( + 2 => '2', + ); + $handler->display->display_options['filters']['field_tags_tid']['vocabulary'] = 'tags'; + + /* Display: Page */ + $handler = $view->new_display('page', 'Page', 'page'); + $handler->display->display_options['path'] = 'article'; + + return $view; + } + +} diff --git a/sites/all/modules/contrib/views/views/tests/views_query.test b/sites/all/modules/contrib/views/views/tests/views_query.test index 1146cc05..5acf01e9 100644 --- a/sites/all/modules/contrib/views/views/tests/views_query.test +++ b/sites/all/modules/contrib/views/views/tests/views_query.test @@ -135,6 +135,23 @@ abstract class ViewsTestCase extends DrupalWebTestCase { $this->verbose('
    Executed view: ' . ((string) $view->build_info['query']) . '
    '); } + /** + * Log in as user 1. + */ + protected function loginUser1() { + $password = user_password(); + // Reset the user 1 password. + $account = user_load(1); + $edit = array( + 'pass' => $password, + ); + $account = user_save($account, $edit); + $account->pass_raw = $password; + + // Log in as user 1. + $this->drupalLogin($account); + } + } /** @@ -167,6 +184,24 @@ abstract class ViewsSqlTest extends ViewsTestCase { $this->checkPermissions(array(), TRUE); } + /** + * Create a term. + * + * @param int $vid + * The vocabulary ID that the term is to be added to. + * + * @return object + * A full term object with a random name. + */ + protected function drupalCreateTerm($vid) { + $term = new stdClass(); + $term->name = $this->randomName(); + $term->description = $this->randomName(); + $term->vid = $vid; + taxonomy_term_save($term); + return $term; + } + /** * This function allows to enable views ui from a higher class which can't * change the setup function anymore. diff --git a/sites/all/modules/contrib/views/views/tests/views_test.info b/sites/all/modules/contrib/views/views/tests/views_test.info index 1b0e8c01..5095b7f2 100644 --- a/sites/all/modules/contrib/views/views/tests/views_test.info +++ b/sites/all/modules/contrib/views/views/tests/views_test.info @@ -5,8 +5,8 @@ core = 7.x dependencies[] = views hidden = TRUE -; Information added by Drupal.org packaging script on 2018-04-14 -version = "7.x-3.20" +; Information added by Drupal.org packaging script on 2019-04-03 +version = "7.x-3.22" core = "7.x" project = "views" -datestamp = "1523668093" +datestamp = "1554307093" diff --git a/sites/all/modules/contrib/views/views/views.info b/sites/all/modules/contrib/views/views/views.info index 1dd74a50..d9d1c116 100644 --- a/sites/all/modules/contrib/views/views/views.info +++ b/sites/all/modules/contrib/views/views/views.info @@ -308,6 +308,7 @@ files[] = tests/views_exposed_form.test files[] = tests/field/views_fieldapi.test files[] = tests/views_glossary.test files[] = tests/views_groupby.test +files[] = tests/views_handler_filter.test files[] = tests/views_handlers.test files[] = tests/views_module.test files[] = tests/views_pager.test @@ -328,8 +329,8 @@ files[] = tests/views_cache.test files[] = tests/views_view.test files[] = tests/views_ui.test -; Information added by Drupal.org packaging script on 2018-04-14 -version = "7.x-3.20" +; Information added by Drupal.org packaging script on 2019-04-03 +version = "7.x-3.22" core = "7.x" project = "views" -datestamp = "1523668093" +datestamp = "1554307093" diff --git a/sites/all/modules/contrib/views/views/views_ui.info b/sites/all/modules/contrib/views/views/views_ui.info index addebb2b..3053db91 100644 --- a/sites/all/modules/contrib/views/views/views_ui.info +++ b/sites/all/modules/contrib/views/views/views_ui.info @@ -8,8 +8,8 @@ dependencies[] = views files[] = views_ui.module files[] = plugins/views_wizard/views_ui_base_views_wizard.class.php -; Information added by Drupal.org packaging script on 2018-04-14 -version = "7.x-3.20" +; Information added by Drupal.org packaging script on 2019-04-03 +version = "7.x-3.22" core = "7.x" project = "views" -datestamp = "1523668093" +datestamp = "1554307093"