Version Description
- Added Support for Australia (AU) marketplace and minor bug-fixes.
Download this release
Release Info
Developer | amazonlinkbuilder |
Plugin | Amazon Associates Link Builder |
Version | 1.8.0 |
Comparing to | |
See all releases |
Code changes from version 1.7.0 to 1.8.0
- aalb_config.php +0 -319
- admin/{aalb_admin.php → plugin_admin.php} +46 -34
- admin/{sidebar/aalb_sidebar.php → sidebar.php} +19 -15
- amazon-associates-link-builder.php +15 -87
- bin/install-wp-tests.sh +0 -118
- includes/aalb_cache_loader.php → cache/cache_loader.php +12 -7
- includes/aalb_cache_template_loader.php → cache/cache_template_loader.php +3 -3
- configuration/config_helper.php +105 -0
- includes/aalb_config_loader.php → configuration/config_loader.php +15 -8
- configuration/marketplace_config.json +227 -0
- constants/db_constants.php +51 -0
- constants/http_constants.php +35 -0
- constants/library_endpoints.php +45 -0
- constants/paapi_constants.php +41 -0
- constants/plugin_constants.php +73 -0
- constants/plugin_urls.php +35 -0
- constants/xml_constants.php +65 -0
- {admin/css → css}/aalb_admin.css +0 -0
- {admin/css → css}/aalb_credentials.css +0 -0
- exceptions/invalid_marketplace_exception.php +30 -0
- exceptions/network_call_failure_exception.php +3 -2
- exceptions/unexpected_network_response_exception.php +3 -2
- {includes → helper}/aalb_compatibility_helper.php +9 -6
- admin/sidebar/partials/helper/aalb_credentials_helper.php → helper/credentials_helper.php +25 -14
- lib/php/Paapi/aalb_paapi_helper.php → helper/paapi_helper.php +32 -25
- includes/aalb_helper.php → helper/plugin_helper.php +19 -14
- includes/aalb_settings_page_migration_helper.php → helper/settings_page_migration_helper.php +12 -7
- helper/tracking_api_helper.php +142 -0
- lib/php/aalb_validation_helper.php → helper/validation_helper.php +12 -6
- helper/xml_helper.php +321 -0
- includes/aalb_admin_notice_manager.php +0 -85
- includes/aalb_initializer.php +76 -0
- includes/{aalb_activator.php → activator.php} +8 -28
- includes/{aalb_autoloader.php → autoloader.php} +21 -2
- includes/{aalb_deactivator.php → deactivator.php} +12 -33
- includes/{aalb_hook_loader.php → hook_loader.php} +11 -11
- includes/{aalb_manager.php → plugin_manager.php} +30 -17
- includes/{aalb_remote_loader.php → remote_loader.php} +14 -9
- io/{aalb_curl_request.php → curl_request.php} +6 -1
- io/{aalb_file_system_helper.php → file_system_helper.php} +2 -1
- ip2country/{aalb_customer_country.php → customer_country.php} +15 -10
- ip2country/{aalb_customer_ip_address.php → customer_ip_address.php} +4 -1
- ip2country/{aalb_maxmind_db_manager.php → maxmind_db_manager.php} +33 -23
- {admin/js → js}/aalb_admin.js +3 -3
- {admin/sidebar/js → js}/aalb_credentials.js +3 -0
- {admin/sidebar/js → js}/aalb_template.js +0 -0
- languages/amazon-associates-link-builder-es_ES.mo +0 -0
- languages/amazon-associates-link-builder-es_ES.po +208 -214
- languages/amazon-associates-link-builder-fr_FR.mo +0 -0
- languages/amazon-associates-link-builder-fr_FR.po +208 -214
- languages/amazon-associates-link-builder-it_IT.mo +0 -0
- languages/amazon-associates-link-builder-it_IT.po +208 -214
- lib/php/aalb_impression_recorder_service_config.php +0 -76
- lib/php/aalb_internationalization_helper.php +0 -88
- lib/php/aalb_tracking_api_helper.php +0 -135
- lib/php/aalb_xml_helper.php +0 -321
- plugin_config.php +108 -0
- readme.txt +15 -6
- includes/aalb_content_filter.php → rendering/content_filter.php +40 -20
- lib/php/aalb_impression_generator.php → rendering/impression_generator.php +18 -50
- includes/aalb_template_engine.php → rendering/template_engine.php +33 -73
- rendering/xml_manipulator.php +189 -0
- shortcode/{aalb_shortcode_helper.php → shortcode_helper.php} +17 -10
- shortcode/{aalb_shortcode_loader.php → shortcode_loader.php} +9 -5
- shortcode/{aalb_shortcode_manager.php → shortcode_manager.php} +34 -23
- template/ProductAd.mustache +2 -2
- template/ProductCarousel.mustache +3 -3
- template/ProductGrid.mustache +3 -3
- uninstall.php +84 -0
- vendor/autoload.php +1 -1
- vendor/composer/autoload_namespaces.php +1 -0
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_static.php +14 -3
- vendor/composer/ca-bundle/composer.json +1 -1
- vendor/composer/ca-bundle/res/cacert.pem +211 -519
- vendor/composer/installed.json +75 -28
- vendor/geoip2/geoip2/.php_cs +1 -0
- vendor/geoip2/geoip2/CHANGELOG.md +12 -0
- vendor/geoip2/geoip2/README.md +3 -3
- vendor/geoip2/geoip2/composer.json +2 -3
- vendor/geoip2/geoip2/src/Record/Country.php +5 -1
- vendor/geoip2/geoip2/src/Record/RepresentedCountry.php +4 -0
- vendor/geoip2/geoip2/src/WebService/Client.php +8 -8
- vendor/maxmind-db/reader/CHANGELOG.md +14 -1
- vendor/maxmind-db/reader/README.md +18 -1
- vendor/maxmind-db/reader/autoload.php +44 -0
- vendor/maxmind-db/reader/composer.json +1 -1
- vendor/maxmind-db/reader/ext/maxminddb.c +4 -4
- vendor/maxmind-db/reader/ext/php_maxminddb.h +1 -1
- vendor/maxmind-db/reader/ext/tests/003-open-basedir.phpt +12 -0
- vendor/maxmind/web-service-common/CHANGELOG.md +6 -1
- vendor/maxmind/web-service-common/README.md +3 -3
- vendor/maxmind/web-service-common/dev-bin/release.sh +60 -0
- vendor/maxmind/web-service-common/src/WebService/Client.php +7 -5
- vendor/mustache/mustache/.gitignore +4 -0
- vendor/mustache/mustache/.gitmodules +6 -0
- vendor/mustache/mustache/.php_cs +26 -0
- vendor/mustache/mustache/.styleci.yml +13 -0
- vendor/mustache/mustache/.travis.yml +21 -0
- vendor/mustache/mustache/CONTRIBUTING.md +35 -0
- {lib/php/Mustache → vendor/mustache/mustache}/LICENSE +0 -0
- vendor/mustache/mustache/README.md +72 -0
- vendor/mustache/mustache/bin/build_bootstrap.php +178 -0
- vendor/mustache/mustache/composer.json +25 -0
- vendor/mustache/mustache/phpunit.xml.dist +17 -0
- {lib/php → vendor/mustache/mustache/src}/Mustache/Autoloader.php +16 -2
- {lib/php → vendor/mustache/mustache/src}/Mustache/Cache.php +1 -1
- {lib/php → vendor/mustache/mustache/src}/Mustache/Cache/AbstractCache.php +1 -1
- {lib/php → vendor/mustache/mustache/src}/Mustache/Cache/FilesystemCache.php +9 -3
- {lib/php → vendor/mustache/mustache/src}/Mustache/Cache/NoopCache.php +1 -1
- {lib/php → vendor/mustache/mustache/src}/Mustache/Compiler.php +35 -27
- {lib/php → vendor/mustache/mustache/src}/Mustache/Context.php +3 -3
- {lib/php → vendor/mustache/mustache/src}/Mustache/Engine.php +62 -20
- {lib/php → vendor/mustache/mustache/src}/Mustache/Exception.php +1 -1
- {lib/php → vendor/mustache/mustache/src}/Mustache/Exception/InvalidArgumentException.php +1 -1
- {lib/php → vendor/mustache/mustache/src}/Mustache/Exception/LogicException.php +1 -1
- {lib/php → vendor/mustache/mustache/src}/Mustache/Exception/RuntimeException.php +1 -1
- {lib/php → vendor/mustache/mustache/src}/Mustache/Exception/SyntaxException.php +10 -5
- {lib/php → vendor/mustache/mustache/src}/Mustache/Exception/UnknownFilterException.php +10 -4
- {lib/php → vendor/mustache/mustache/src}/Mustache/Exception/UnknownHelperException.php +10 -4
- {lib/php → vendor/mustache/mustache/src}/Mustache/Exception/UnknownTemplateException.php +10 -4
- {lib/php → vendor/mustache/mustache/src}/Mustache/HelperCollection.php +3 -3
- {lib/php → vendor/mustache/mustache/src}/Mustache/LambdaHelper.php +5 -5
- {lib/php → vendor/mustache/mustache/src}/Mustache/Loader.php +3 -3
- {lib/php → vendor/mustache/mustache/src}/Mustache/Loader/ArrayLoader.php +2 -2
- {lib/php → vendor/mustache/mustache/src}/Mustache/Loader/CascadingLoader.php +2 -2
- {lib/php → vendor/mustache/mustache/src}/Mustache/Loader/FilesystemLoader.php +17 -6
- {lib/php → vendor/mustache/mustache/src}/Mustache/Loader/InlineLoader.php +3 -3
- {lib/php → vendor/mustache/mustache/src}/Mustache/Loader/MutableLoader.php +1 -1
- vendor/mustache/mustache/src/Mustache/Loader/ProductionFilesystemLoader.php +86 -0
- {lib/php → vendor/mustache/mustache/src}/Mustache/Loader/StringLoader.php +1 -1
- {lib/php → vendor/mustache/mustache/src}/Mustache/Logger.php +1 -1
- {lib/php → vendor/mustache/mustache/src}/Mustache/Logger/AbstractLogger.php +1 -1
- {lib/php → vendor/mustache/mustache/src}/Mustache/Logger/StreamLogger.php +7 -7
- {lib/php → vendor/mustache/mustache/src}/Mustache/Parser.php +6 -6
- vendor/mustache/mustache/src/Mustache/Source.php +40 -0
- vendor/mustache/mustache/src/Mustache/Source/FilesystemSource.php +77 -0
- {lib/php → vendor/mustache/mustache/src}/Mustache/Template.php +1 -1
- {lib/php → vendor/mustache/mustache/src}/Mustache/Tokenizer.php +7 -2
- vendor/mustache/mustache/test/Mustache/Test/AutoloaderTest.php +51 -0
- vendor/mustache/mustache/test/Mustache/Test/Cache/AbstractCacheTest.php +44 -0
- vendor/mustache/mustache/test/Mustache/Test/Cache/FilesystemCacheTest.php +36 -0
- vendor/mustache/mustache/test/Mustache/Test/CompilerTest.php +154 -0
- vendor/mustache/mustache/test/Mustache/Test/ContextTest.php +282 -0
- vendor/mustache/mustache/test/Mustache/Test/EngineTest.php +397 -0
- vendor/mustache/mustache/test/Mustache/Test/Exception/SyntaxExceptionTest.php +39 -0
- vendor/mustache/mustache/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php +44 -0
- vendor/mustache/mustache/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php +43 -0
- vendor/mustache/mustache/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php +43 -0
- vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php +32 -0
- vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/EngineTest.php +50 -0
- vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/FiltersTest.php +187 -0
- vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php +77 -0
- vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php +67 -0
- vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php +68 -0
- vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php +94 -0
- vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php +135 -0
- vendor/mustache/mustache/test/Mustache/Test/Functional/CallTest.php +40 -0
- vendor/mustache/mustache/test/Mustache/Test/Functional/ExamplesTest.php +142 -0
- vendor/mustache/mustache/test/Mustache/Test/Functional/HigherOrderSectionsTest.php +177 -0
- vendor/mustache/mustache/test/Mustache/Test/Functional/InheritanceTest.php +543 -0
- vendor/mustache/mustache/test/Mustache/Test/Functional/MustacheInjectionTest.php +83 -0
- vendor/mustache/mustache/test/Mustache/Test/Functional/MustacheSpecTest.php +121 -0
- vendor/mustache/mustache/test/Mustache/Test/Functional/NestedPartialIndentTest.php +45 -0
- vendor/mustache/mustache/test/Mustache/Test/Functional/ObjectSectionTest.php +110 -0
- vendor/mustache/mustache/test/Mustache/Test/FunctionalTestCase.php +47 -0
- vendor/mustache/mustache/test/Mustache/Test/HelperCollectionTest.php +163 -0
- vendor/mustache/mustache/test/Mustache/Test/Loader/ArrayLoaderTest.php +52 -0
- vendor/mustache/mustache/test/Mustache/Test/Loader/CascadingLoaderTest.php +40 -0
- vendor/mustache/mustache/test/Mustache/Test/Loader/FilesystemLoaderTest.php +80 -0
- vendor/mustache/mustache/test/Mustache/Test/Loader/InlineLoaderTest.php +56 -0
- vendor/mustache/mustache/test/Mustache/Test/Loader/ProductionFilesystemLoaderTest.php +103 -0
- vendor/mustache/mustache/test/Mustache/Test/Loader/StringLoaderTest.php +25 -0
- vendor/mustache/mustache/test/Mustache/Test/Logger/AbstractLoggerTest.php +60 -0
- vendor/mustache/mustache/test/Mustache/Test/Logger/StreamLoggerTest.php +209 -0
- vendor/mustache/mustache/test/Mustache/Test/ParserTest.php +425 -0
- vendor/mustache/mustache/test/Mustache/Test/Source/FilesystemSourceTest.php +25 -0
- vendor/mustache/mustache/test/Mustache/Test/SpecTestCase.php +67 -0
- vendor/mustache/mustache/test/Mustache/Test/TemplateTest.php +55 -0
- vendor/mustache/mustache/test/Mustache/Test/TokenizerTest.php +306 -0
- vendor/mustache/mustache/test/bootstrap.php +91 -0
- vendor/mustache/mustache/test/fixtures/autoloader/Mustache/Bar.php +15 -0
- vendor/mustache/mustache/test/fixtures/autoloader/Mustache/Foo.php +15 -0
- vendor/mustache/mustache/test/fixtures/autoloader/NonMustacheClass.php +15 -0
- vendor/mustache/mustache/test/fixtures/examples/anchored_dot_notation/AnchoredDotNotation.php +55 -0
- vendor/mustache/mustache/test/fixtures/examples/anchored_dot_notation/anchored_dot_notation.mustache +4 -0
- vendor/mustache/mustache/test/fixtures/examples/anchored_dot_notation/anchored_dot_notation.txt +11 -0
- vendor/mustache/mustache/test/fixtures/examples/anchored_dot_notation/partials/genre.mustache +5 -0
- vendor/mustache/mustache/test/fixtures/examples/blocks/Blocks.php +15 -0
- vendor/mustache/mustache/test/fixtures/examples/blocks/blocks.mustache +4 -0
- vendor/mustache/mustache/test/fixtures/examples/blocks/blocks.txt +3 -0
- vendor/mustache/mustache/test/fixtures/examples/blocks/partials/parent.mustache +4 -0
- vendor/mustache/mustache/test/fixtures/examples/child_context/ChildContext.php +23 -0
- vendor/mustache/mustache/test/fixtures/examples/child_context/child_context.mustache +2 -0
- vendor/mustache/mustache/test/fixtures/examples/child_context/child_context.txt +2 -0
- vendor/mustache/mustache/test/fixtures/examples/comments/Comments.php +18 -0
- vendor/mustache/mustache/test/fixtures/examples/comments/comments.mustache +1 -0
- vendor/mustache/mustache/test/fixtures/examples/comments/comments.txt +1 -0
- vendor/mustache/mustache/test/fixtures/examples/complex/complex.mustache +16 -0
- vendor/mustache/mustache/test/fixtures/examples/complex/complex.php +31 -0
- vendor/mustache/mustache/test/fixtures/examples/complex/complex.txt +6 -0
- vendor/mustache/mustache/test/fixtures/examples/delimiters/Delimiters.php +25 -0
- vendor/mustache/mustache/test/fixtures/examples/delimiters/delimiters.mustache +8 -0
- vendor/mustache/mustache/test/fixtures/examples/delimiters/delimiters.txt +4 -0
- vendor/mustache/mustache/test/fixtures/examples/dot_notation/DotNotation.php +24 -0
- vendor/mustache/mustache/test/fixtures/examples/dot_notation/dot_notation.mustache +4 -0
- vendor/mustache/mustache/test/fixtures/examples/dot_notation/dot_notation.txt +4 -0
- vendor/mustache/mustache/test/fixtures/examples/double_section/DoubleSection.php +20 -0
- vendor/mustache/mustache/test/fixtures/examples/double_section/double_section.mustache +7 -0
- vendor/mustache/mustache/test/fixtures/examples/double_section/double_section.txt +3 -0
- vendor/mustache/mustache/test/fixtures/examples/escaped/Escaped.php +15 -0
- vendor/mustache/mustache/test/fixtures/examples/escaped/escaped.mustache +1 -0
- vendor/mustache/mustache/test/fixtures/examples/escaped/escaped.txt +1 -0
- vendor/mustache/mustache/test/fixtures/examples/filters/Filters.php +97 -0
- vendor/mustache/mustache/test/fixtures/examples/filters/filters.mustache +4 -0
- vendor/mustache/mustache/test/fixtures/examples/filters/filters.txt +50 -0
- vendor/mustache/mustache/test/fixtures/examples/grand_parent_context/GrandParentContext.php +33 -0
- vendor/mustache/mustache/test/fixtures/examples/grand_parent_context/grand_parent_context.mustache +7 -0
- vendor/mustache/mustache/test/fixtures/examples/grand_parent_context/grand_parent_context.txt +7 -0
- vendor/mustache/mustache/test/fixtures/examples/i18n/I18n.php +30 -0
- vendor/mustache/mustache/test/fixtures/examples/i18n/i18n.mustache +1 -0
- vendor/mustache/mustache/test/fixtures/examples/i18n/i18n.txt +1 -0
- vendor/mustache/mustache/test/fixtures/examples/implicit_iterator/ImplicitIterator.php +15 -0
- vendor/mustache/mustache/test/fixtures/examples/implicit_iterator/implicit_iterator.mustache +3 -0
- vendor/mustache/mustache/test/fixtures/examples/implicit_iterator/implicit_iterator.txt +5 -0
- vendor/mustache/mustache/test/fixtures/examples/inverted_double_section/InvertedDoubleSection.php +16 -0
- vendor/mustache/mustache/test/fixtures/examples/inverted_double_section/inverted_double_section.mustache +7 -0
- vendor/mustache/mustache/test/fixtures/examples/inverted_double_section/inverted_double_section.txt +3 -0
- vendor/mustache/mustache/test/fixtures/examples/inverted_section/InvertedSection.php +15 -0
- vendor/mustache/mustache/test/fixtures/examples/inverted_section/inverted_section.mustache +6 -0
- vendor/mustache/mustache/test/fixtures/examples/inverted_section/inverted_section.txt +1 -0
- vendor/mustache/mustache/test/fixtures/examples/nested_partials/NestedPartials.php +15 -0
- vendor/mustache/mustache/test/fixtures/examples/nested_partials/nested_partials.mustache +3 -0
- vendor/mustache/mustache/test/fixtures/examples/nested_partials/nested_partials.txt +7 -0
- vendor/mustache/mustache/test/fixtures/examples/nested_partials/partials/fourth.mustache +1 -0
- vendor/mustache/mustache/test/fixtures/examples/nested_partials/partials/second.mustache +3 -0
- vendor/mustache/mustache/test/fixtures/examples/nested_partials/partials/third.mustache +3 -0
- vendor/mustache/mustache/test/fixtures/examples/partials/Partials.php +19 -0
- vendor/mustache/mustache/test/fixtures/examples/partials/partials.mustache +7 -0
- vendor/mustache/mustache/test/fixtures/examples/partials/partials.txt +8 -0
- vendor/mustache/mustache/test/fixtures/examples/partials/partials/header.mustache +4 -0
- vendor/mustache/mustache/test/fixtures/examples/recursive_partials/RecursivePartials.php +22 -0
- vendor/mustache/mustache/test/fixtures/examples/recursive_partials/partials/child.mustache +1 -0
- vendor/mustache/mustache/test/fixtures/examples/recursive_partials/recursive_partials.mustache +1 -0
- vendor/mustache/mustache/test/fixtures/examples/recursive_partials/recursive_partials.txt +1 -0
- vendor/mustache/mustache/test/fixtures/examples/section_iterator_objects/SectionIteratorObjects.php +27 -0
- vendor/mustache/mustache/test/fixtures/examples/section_iterator_objects/section_iterator_objects.mustache +5 -0
- vendor/mustache/mustache/test/fixtures/examples/section_iterator_objects/section_iterator_objects.txt +4 -0
- vendor/mustache/mustache/test/fixtures/examples/section_magic_objects/SectionMagicObjects.php +40 -0
- vendor/mustache/mustache/test/fixtures/examples/section_magic_objects/section_magic_objects.mustache +6 -0
- vendor/mustache/mustache/test/fixtures/examples/section_magic_objects/section_magic_objects.txt +4 -0
- vendor/mustache/mustache/test/fixtures/examples/section_objects/SectionObjects.php +28 -0
- vendor/mustache/mustache/test/fixtures/examples/section_objects/section_objects.mustache +6 -0
- vendor/mustache/mustache/test/fixtures/examples/section_objects/section_objects.txt +4 -0
- vendor/mustache/mustache/test/fixtures/examples/sections/Sections.php +25 -0
- vendor/mustache/mustache/test/fixtures/examples/sections/sections.mustache +5 -0
- vendor/mustache/mustache/test/fixtures/examples/sections/sections.txt +4 -0
- vendor/mustache/mustache/test/fixtures/examples/sections_nested/SectionsNested.php +44 -0
- vendor/mustache/mustache/test/fixtures/examples/sections_nested/sections_nested.mustache +7 -0
- vendor/mustache/mustache/test/fixtures/examples/sections_nested/sections_nested.txt +12 -0
- vendor/mustache/mustache/test/fixtures/examples/simple/Simple.php +23 -0
- vendor/mustache/mustache/test/fixtures/examples/simple/simple.mustache +5 -0
- vendor/mustache/mustache/test/fixtures/examples/simple/simple.txt +3 -0
- vendor/mustache/mustache/test/fixtures/examples/unescaped/Unescaped.php +15 -0
- vendor/mustache/mustache/test/fixtures/examples/unescaped/unescaped.mustache +1 -0
- vendor/mustache/mustache/test/fixtures/examples/unescaped/unescaped.txt +1 -0
- vendor/mustache/mustache/test/fixtures/examples/utf8/UTF8.php +15 -0
- vendor/mustache/mustache/test/fixtures/examples/utf8/utf8.mustache +1 -0
- vendor/mustache/mustache/test/fixtures/examples/utf8/utf8.txt +1 -0
- vendor/mustache/mustache/test/fixtures/examples/utf8_unescaped/UTF8Unescaped.php +15 -0
- vendor/mustache/mustache/test/fixtures/examples/utf8_unescaped/utf8_unescaped.mustache +1 -0
- vendor/mustache/mustache/test/fixtures/examples/utf8_unescaped/utf8_unescaped.txt +1 -0
- vendor/mustache/mustache/test/fixtures/examples/whitespace/Whitespace.php +43 -0
- vendor/mustache/mustache/test/fixtures/examples/whitespace/partials/alphabet.mustache +1 -0
- vendor/mustache/mustache/test/fixtures/examples/whitespace/whitespace.mustache +10 -0
- vendor/mustache/mustache/test/fixtures/examples/whitespace/whitespace.txt +12 -0
- vendor/mustache/mustache/test/fixtures/templates/alpha.ms +1 -0
- vendor/mustache/mustache/test/fixtures/templates/beta.ms +1 -0
- vendor/mustache/mustache/test/fixtures/templates/one.mustache +1 -0
- vendor/mustache/mustache/test/fixtures/templates/two.mustache +1 -0
- aalb_admin_item_search_items.php → view/partials/admin_item_search_items.php +4 -3
- admin/partials/aalb_editor_search_box.php → view/partials/editor_search_box.php +6 -4
- admin/partials/aalb_meta_box.php → view/partials/meta_box.php +40 -38
- admin/partials/aalb_meta_box_tab_content.php → view/partials/meta_box_tab_content.php +5 -3
- admin/partials/aalb_admin_pop_up_content_hbs.php → view/partials/pop_up_content_hbs.php +5 -3
- admin/sidebar/partials/aalb_about.php → view/sidebar_partials/about.php +17 -7
- admin/sidebar/partials/aalb_admin_ui_common.php → view/sidebar_partials/admin_ui_common.php +6 -3
- admin/sidebar/partials/aalb_credentials.php → view/sidebar_partials/credentials.php +28 -20
- admin/sidebar/partials/aalb_credentials_locale_row.php → view/sidebar_partials/credentials_locale_row.php +6 -3
- admin/sidebar/partials/aalb_templates.php → view/sidebar_partials/templates.php +36 -30
- admin/sidebar/partials/aalb_ui_common.php → view/sidebar_partials/ui_common.php +1 -0
aalb_config.php
DELETED
@@ -1,319 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
-
|
6 |
-
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
-
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
8 |
-
A copy of the License is located in the "license" file accompanying this file.
|
9 |
-
|
10 |
-
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
11 |
-
either express or implied. See the License for the specific language governing permissions
|
12 |
-
and limitations under the License.
|
13 |
-
*/
|
14 |
-
|
15 |
-
//version
|
16 |
-
define( 'AALB_PLUGIN_CURRENT_VERSION', '1.7.0' );
|
17 |
-
|
18 |
-
//Version no. with multi locale settings page
|
19 |
-
define( 'AALB_MULTI_LOCALE_SETTINGS_PLUGIN_VERSION', '1.4.12' );
|
20 |
-
|
21 |
-
//PHP version compatible for AALB plugin
|
22 |
-
define( 'AALB_PLUGIN_MINIMUM_SUPPORTED_PHP_VERSION', '5.4.0' );
|
23 |
-
|
24 |
-
//Plugin Name
|
25 |
-
define( 'AALB_PLUGIN_NAME', 'Amazon Associates Link Builder' );
|
26 |
-
//paths
|
27 |
-
define( 'AALB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
28 |
-
define( 'AALB_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
29 |
-
|
30 |
-
//Project Title
|
31 |
-
define( 'AALB_PROJECT_TITLE', 'Associates Link Builder' );
|
32 |
-
|
33 |
-
/**
|
34 |
-
* File paths
|
35 |
-
*/
|
36 |
-
|
37 |
-
//Library
|
38 |
-
define( 'MUSTACHE_AUTOLOADER_PHP', AALB_PLUGIN_DIR . 'lib/php/Mustache/Autoloader.php' );
|
39 |
-
define( 'AALB_PAAPI_HELPER_PHP', AALB_PLUGIN_DIR . 'lib/php/Paapi/aalb_paapi_helper.php' );
|
40 |
-
define( 'AALB_VALIDATION_HELPER_PHP', AALB_PLUGIN_DIR . 'lib/php/aalb_validation_helper.php' );
|
41 |
-
define( 'AALB_XML_HELPER_PHP', AALB_PLUGIN_DIR . 'lib/php/aalb_xml_helper.php' );
|
42 |
-
define( 'AALB_TRACKING_API_HELPER_PHP', AALB_PLUGIN_DIR . 'lib/php/aalb_tracking_api_helper.php' );
|
43 |
-
define( 'AALB_MAXMIND_DATA_FILENAME', 'GeoLite2-Country.mmdb' );
|
44 |
-
|
45 |
-
//Shortcodes supported
|
46 |
-
define( 'AALB_SHORTCODE_AMAZON_LINK', 'amazon_link' );
|
47 |
-
define( 'AALB_SHORTCODE_AMAZON_TEXT', 'amazon_textlink' );
|
48 |
-
|
49 |
-
//Admin
|
50 |
-
define( 'AALB_SIDEBAR_PHP', AALB_PLUGIN_DIR . 'admin/sidebar/aalb_sidebar.php' );
|
51 |
-
define( 'AALB_ADMIN_PHP', AALB_PLUGIN_DIR . 'admin/aalb_admin.php' );
|
52 |
-
define( 'AALB_ABOUT_PHP', AALB_PLUGIN_DIR . 'admin/sidebar/partials/aalb_about.php' );
|
53 |
-
define( 'AALB_CREDENTIALS_PHP', AALB_PLUGIN_DIR . 'admin/sidebar/partials/aalb_credentials.php' );
|
54 |
-
define( 'AALB_TEMPLATE_PHP', AALB_PLUGIN_DIR . 'admin/sidebar/partials/aalb_templates.php' );
|
55 |
-
|
56 |
-
//Directories
|
57 |
-
define( 'AALB_TEMPLATE_DIR', AALB_PLUGIN_DIR . 'template/' );
|
58 |
-
define( 'AALB_ADMIN_DIR', AALB_PLUGIN_DIR . 'admin/' );
|
59 |
-
define( 'AALB_SIDEBAR_DIR', AALB_PLUGIN_DIR . 'admin/sidebar/' );
|
60 |
-
define( 'AALB_INCLUDES_DIR', AALB_PLUGIN_DIR . 'includes/' );
|
61 |
-
define( 'AALB_PAAPI_DIR', AALB_PLUGIN_DIR . 'lib/php/Paapi/' );
|
62 |
-
define( 'AALB_SHORTCODE_DIR', AALB_PLUGIN_DIR . 'shortcode/' );
|
63 |
-
define( 'AALB_LIBRARY_DIR', AALB_PLUGIN_DIR . 'lib/php/' );
|
64 |
-
define( 'AALB_SIDEBAR_HELPER_DIR', AALB_PLUGIN_DIR . 'admin/sidebar/partials/helper/' );
|
65 |
-
define( 'AALB_IP_2_COUNTRY_DIR', AALB_PLUGIN_DIR . 'ip2country/' );
|
66 |
-
define( 'AALB_EXCEPTIONS_DIR', AALB_PLUGIN_DIR . 'exceptions/' );
|
67 |
-
define( 'AALB_IO_DIR', AALB_PLUGIN_DIR . 'io/' );
|
68 |
-
|
69 |
-
//Includes
|
70 |
-
define( 'AALB_ACTIVATOR_PHP', AALB_PLUGIN_DIR . 'includes/aalb_activator.php' );
|
71 |
-
define( 'AALB_DEACTIVATOR_PHP', AALB_PLUGIN_DIR . 'includes/aalb_deactivator.php' );
|
72 |
-
define( 'AALB_MANAGER', AALB_PLUGIN_DIR . 'includes/aalb_manager.php' );
|
73 |
-
define( 'AALB_HOOK_LOADER', AALB_PLUGIN_DIR . 'includes/aalb_hook_loader.php' );
|
74 |
-
define( 'AALB_CACHE_LOADER', AALB_PLUGIN_DIR . 'includes/aalb_cache_loader.php' );
|
75 |
-
define( 'AALB_REMOTE_LOADER', AALB_PLUGIN_DIR . 'includes/aalb_remote_loader.php' );
|
76 |
-
define( 'AALB_AUTOLOADER', AALB_PLUGIN_DIR . 'includes/aalb_autoloader.php' );
|
77 |
-
|
78 |
-
//Templates Directory
|
79 |
-
define( 'AALB_TEMPLATE_URL', AALB_PLUGIN_URL . 'template/' );
|
80 |
-
define( 'AALB_TEMPLATE_UPLOADS_FOLDER', 'amazon-associates-link-builder/template/' );
|
81 |
-
define( 'AALB_UPLOADS_FOLDER', 'amazon-associates-link-builder/' );
|
82 |
-
|
83 |
-
//Partials
|
84 |
-
define( 'AALB_META_BOX_PARTIAL', AALB_PLUGIN_DIR . 'admin/partials/aalb_meta_box.php' );
|
85 |
-
define( 'AALB_EDITOR_SEARCH_BOX', AALB_PLUGIN_DIR . 'admin/partials/aalb_editor_search_box.php' );
|
86 |
-
|
87 |
-
//Proxy
|
88 |
-
define( 'AALB_PROXY_URL', AALB_PLUGIN_URL . 'lib/php/Paapi/aalb_paapi_proxy.php' );
|
89 |
-
|
90 |
-
//Tracking API Endpoint
|
91 |
-
define( 'AALB_TRACKING_API_ENDPOINT', 'https://rx5hfxbp45.execute-api.us-east-1.amazonaws.com/aalb/' );
|
92 |
-
define( 'AALB_TRACKING_API_SOURCE_TOOL_QUERY_PARAM', 'source-tool=aalb' );
|
93 |
-
define( 'AALB_TRACKING_API_ACCESS_KEY_QUERY_PARAM', 'aws-access-key-id=' );
|
94 |
-
|
95 |
-
//Wordpress Pages
|
96 |
-
define( 'WP_POST', 'post.php' );
|
97 |
-
define( 'WP_POST_NEW', 'post-new.php' );
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Styles and scripts
|
101 |
-
*/
|
102 |
-
|
103 |
-
//Local Styles
|
104 |
-
define( 'AALB_ADMIN_CSS', AALB_PLUGIN_URL . 'admin/css/aalb_admin.css' );
|
105 |
-
define( 'AALB_CREDENTIALS_CSS', AALB_PLUGIN_URL . 'admin/css/aalb_credentials.css' );
|
106 |
-
define( 'AALB_BASICS_CSS', AALB_PLUGIN_URL . 'css/aalb_basics.css' );
|
107 |
-
|
108 |
-
//Local Scripts
|
109 |
-
define( 'AALB_SHA2_JS', AALB_PLUGIN_URL . 'lib/js/jssha2/sha2.js' );
|
110 |
-
define( 'AALB_ADMIN_JS', AALB_PLUGIN_URL . 'admin/js/aalb_admin.js' );
|
111 |
-
define( 'AALB_TEMPLATE_JS', AALB_PLUGIN_URL . 'admin/sidebar/js/aalb_template.js' );
|
112 |
-
define( 'AALB_CREDENTIALS_JS', AALB_PLUGIN_URL . 'admin/sidebar/js/aalb_credentials.js' );
|
113 |
-
|
114 |
-
//Templates
|
115 |
-
define( 'AALB_ADMIN_ITEM_SEARCH_ITEMS_PATH', AALB_PLUGIN_DIR . 'aalb_admin_item_search_items.php' );
|
116 |
-
|
117 |
-
//External Scripts
|
118 |
-
define( 'HANDLEBARS_JS', 'https://d8fd03967nrad.cloudfront.net/libs/handlebars.js/4.0.5/handlebars.min.js' );
|
119 |
-
define( 'CODEMIRROR_JS', 'https://d8fd03967nrad.cloudfront.net/libs/codemirror/5.13.2/codemirror.min.js' );
|
120 |
-
define( 'CODEMIRROR_MODE_XML_JS', 'https://d8fd03967nrad.cloudfront.net/libs/codemirror/5.13.2/mode/xml/xml.min.js' );
|
121 |
-
define( 'CODEMIRROR_MODE_CSS_JS', 'https://d8fd03967nrad.cloudfront.net/libs/codemirror/5.13.2/mode/css/css.min.js' );
|
122 |
-
define( 'AALB_JQUERY_UI_CSS', 'https://d8fd03967nrad.cloudfront.net/libs/jQueryUI/1.12.1/themes/ui-lightness/jquery-ui.css' );
|
123 |
-
|
124 |
-
//External Styles
|
125 |
-
define( 'FONT_AWESOME_CSS', 'https://d8fd03967nrad.cloudfront.net/libs/font-awesome/4.5.0/css/font-awesome.min.css' );
|
126 |
-
define( 'CODEMIRROR_CSS', 'https://d8fd03967nrad.cloudfront.net/libs/codemirror/5.13.2/codemirror.min.css' );
|
127 |
-
|
128 |
-
/**
|
129 |
-
* Icons
|
130 |
-
*/
|
131 |
-
define( 'AALB_SECURE_HOSTNAME', 'https://images-na.ssl-images-amazon.com/' );
|
132 |
-
define( 'AALB_NORMAL_HOSTNAME', 'http://g-ecx.images-amazon.com/' );
|
133 |
-
define( 'AALB_ICON_LOCATION', 'images/G/01/PAAPI/AmazonAssociatesLinkBuilder/icon-2._V276841048_.png' );
|
134 |
-
define( 'AALB_ADMIN_ICON_LOCATION', 'images/G/01/PAAPI/AmazonAssociatesLinkBuilder/amazon_icon._V506839993_.png' );
|
135 |
-
//AALB_ICON URL is generated by wordpress at run-time by checking the remotehost's encryption. Image source has different URLs depending upon the encryption used.
|
136 |
-
if ( is_ssl() ) {
|
137 |
-
define( 'AALB_ICON', AALB_SECURE_HOSTNAME . AALB_ICON_LOCATION );
|
138 |
-
} else {
|
139 |
-
define( 'AALB_ICON', AALB_NORMAL_HOSTNAME . AALB_ICON_LOCATION );
|
140 |
-
}
|
141 |
-
define( 'AALB_ADMIN_ICON', AALB_SECURE_HOSTNAME . AALB_ADMIN_ICON_LOCATION );
|
142 |
-
|
143 |
-
|
144 |
-
/**
|
145 |
-
* Constants
|
146 |
-
*/
|
147 |
-
|
148 |
-
//Search result items. Paapi returns 10 items by default.
|
149 |
-
define( 'AALB_MAX_SEARCH_RESULT_ITEMS', 9 );
|
150 |
-
//List of Default Amazon Template names
|
151 |
-
define( 'AALB_AMAZON_TEMPLATE_NAMES', 'ProductCarousel,ProductGrid,ProductAd,PriceLink,ProductLink' );
|
152 |
-
|
153 |
-
//Database keys
|
154 |
-
define( 'AALB_TEMPLATE_NAMES', 'aalb_template_names' );
|
155 |
-
define( 'AALB_MARKETPLACE_NAMES', 'aalb_marketplace_names' );
|
156 |
-
define( 'AALB_DEFAULT_TEMPLATE', 'aalb_default_template' );
|
157 |
-
define( 'AALB_DEFAULT_STORE_ID', 'aalb_default_store_id' );
|
158 |
-
define( 'AALB_DEFAULT_MARKETPLACE', 'aalb_default_marketplace' );
|
159 |
-
define( 'AALB_AWS_ACCESS_KEY', 'aalb_aws_access_key' );
|
160 |
-
define( 'AALB_AWS_SECRET_KEY', 'aalb_aws_secret_key' );
|
161 |
-
define( 'AALB_CRED_CONFIG_GROUP', 'aalb_cred_config_group' );
|
162 |
-
define( 'AALB_STORE_ID_NAMES', 'aalb_store_id_names' );
|
163 |
-
define( 'AALB_STORE_IDS', 'aalb_store_ids' );
|
164 |
-
define( 'AALB_CUSTOM_UPLOAD_PATH', 'aalb_custom_upload_path' );
|
165 |
-
define( 'AALB_MAXMIND_DB_LAST_UPLOAD_PATH', 'aalb_maxmind_db_last_upload_path' );
|
166 |
-
define( 'AALB_SHOW_HTTP_WARNING_ONCE', 'aalb_show_http_warning_once' );
|
167 |
-
define( 'AALB_PLUGIN_VERSION', 'aalb_plugin_version' );
|
168 |
-
define( 'AALB_NO_REFERRER_DISABLED', 'aalb_no_referrer_disabled' );
|
169 |
-
define( 'AALB_GEOLITE_DB_DOWNLOAD_NEXT_RETRY_TIME', 'aalb_geolite_db_download_next_retry_time' );
|
170 |
-
define( 'AALB_GEOLITE_DB_DOWNLOAD_RETRY_ON_FAILURE_DURATION', 'aalb_geolite_db_download_retry_on_failure_duration' );
|
171 |
-
define( 'AALB_GEOLITE_DB_DOWNLOAD_FAILED_ATTEMPTS', 'aalb_geolite_db_download_failed_attempts' );
|
172 |
-
|
173 |
-
//Geolite DB Retry Durations
|
174 |
-
define( 'AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_MIN', 30 * MINUTE_IN_SECONDS );
|
175 |
-
define( 'AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_MAX', 2 * DAY_IN_SECONDS );
|
176 |
-
define( 'AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_ON_SUCCESS', 3 * DAY_IN_SECONDS );
|
177 |
-
define( 'AALB_GEOLITE_DB_MAX_ALLOWED_AGE', 60 * DAY_IN_SECONDS );
|
178 |
-
|
179 |
-
define( 'AALB_SUCCESS', "SUCCESS" );
|
180 |
-
define( 'AALB_FAIL', "FAIL" );
|
181 |
-
|
182 |
-
//Masking constant
|
183 |
-
define( 'AALB_AWS_SECRET_KEY_MASK', '••••••••••••••••••••••••••••••••••••••••' );
|
184 |
-
|
185 |
-
|
186 |
-
//Defaults in case DB doesn't contain them.
|
187 |
-
define( 'AALB_DEFAULT_TEMPLATE_NAME', 'ProductCarousel' );
|
188 |
-
define( 'AALB_DEFAULT_MARKETPLACE_NAME', 'US' );
|
189 |
-
define( 'AALB_DEFAULT_STORE_ID_NAME', 'not-specified' );
|
190 |
-
|
191 |
-
//Marketplaces
|
192 |
-
define( 'MARKETPLACES_URL', 'https://webservices.amazon.com/scratchpad/assets/config/config.json' );
|
193 |
-
|
194 |
-
//PAAPI
|
195 |
-
define( 'PAAPI_URI', '/onca/xml' );
|
196 |
-
define( 'PAAPI_TRANSFER_PROTOCOL', 'https://' );
|
197 |
-
define( 'PAAPI_URL_QUERY_SEPARATOR', '?' );
|
198 |
-
define( 'PAAPI_SERVICE', 'AWSECommerceService' );
|
199 |
-
define( 'PAAPI_VERSION', '2013-08-01' );
|
200 |
-
define( 'PAAPI_URL_REGEX', '^https:\\/\\/(.*)\\/onca\\/xml\\?(.*)$' );
|
201 |
-
|
202 |
-
define( 'PAAPI_INVALID_PARAMETER_VALUE_ERROR', 'AWS.InvalidParameterValue' );
|
203 |
-
|
204 |
-
// PAAPI Request Timeout in seconds
|
205 |
-
define( "PAAPI_REQUEST_TIMEOUT", 35 );
|
206 |
-
|
207 |
-
//HTTP Status Codes
|
208 |
-
define( 'HTTP_SUCCESS', '200' );
|
209 |
-
define( 'HTTP_BAD_REQUEST', '400' );
|
210 |
-
define( 'HTTP_REQUEST_URI_TOO_LONG', '414' );
|
211 |
-
define( 'HTTP_FORBIDDEN', '403' );
|
212 |
-
define( 'HTTP_INTERNAL_SERVER_ERROR', '500' );
|
213 |
-
define( 'HTTP_THROTTLE', '503' );
|
214 |
-
define( 'HTTP_TIME_OUT', '504' );
|
215 |
-
|
216 |
-
/**
|
217 |
-
* Cipher
|
218 |
-
*/
|
219 |
-
//Make a key of length 32 byte.
|
220 |
-
//Specify your unique encryption key here.
|
221 |
-
define( 'AALB_ENCRYPTION_KEY', 'put your unique phrase here' );
|
222 |
-
//Default Encryption Key. Do NOT change this.
|
223 |
-
define( 'AALB_ENCRYPTION_KEY_DEFAULT', 'put your unique phrase here' );
|
224 |
-
|
225 |
-
//Make IV of 16 bytes
|
226 |
-
define( 'AALB_ENCRYPTION_IV', '0123456789ABCDEF' );
|
227 |
-
|
228 |
-
//Algorithm to use
|
229 |
-
define( 'AALB_ENCRYPTION_ALGORITHM', 'aes-256-cbc' );
|
230 |
-
|
231 |
-
//Caching Requirements
|
232 |
-
//====================
|
233 |
-
//As defined by the Product Advertising API License Agreement at https://affiliate-program.amazon.com/gp/advertising/api/detail/agreement.html,
|
234 |
-
//Dated Jul 22, 2016, Section 4(n) and 4(o), caching of product information is permitted upto a maximum of 24-hours.
|
235 |
-
//Further, if the product price is not refreshed every one hour, the displayed price should be accompanied with a timestamp when the price was read.
|
236 |
-
//Note that the plugin uses a two tier cache. It caches the ASINs as well as the rendered templates.
|
237 |
-
//At any given time the sum of ASIN cache TTL and Rendered AdUnit cache TTL should be less than or equal to one hour.
|
238 |
-
//The below configuration is compliant with the License Agreement. Any modification may result in the violation of the license agreement.
|
239 |
-
define( 'AALB_CACHE_FOR_ASIN_RAWINFO_TTL', 30 * MINUTE_IN_SECONDS );
|
240 |
-
define( 'AALB_CACHE_FOR_ASIN_ADUNIT_TTL', 30 * MINUTE_IN_SECONDS );
|
241 |
-
|
242 |
-
//Translation keys
|
243 |
-
define( 'CHECK_ON_AMAZON', 'Check on Amazon' );
|
244 |
-
define( 'OUT_OF_STOCK', 'Out of stock' );
|
245 |
-
|
246 |
-
//Marketplaces supported for translations
|
247 |
-
define( 'US', 'US' );
|
248 |
-
define( 'FR', 'FR' );
|
249 |
-
define( 'IT', 'IT' );
|
250 |
-
define( 'DE', 'DE' );
|
251 |
-
define( 'ES', 'ES' );
|
252 |
-
define( 'BR', 'BR' );
|
253 |
-
define( 'CA', 'CA' );
|
254 |
-
define( 'CN', 'CN' );
|
255 |
-
define( 'IN', 'IN' );
|
256 |
-
define( 'JP', 'JP' );
|
257 |
-
define( 'MX', 'MX' );
|
258 |
-
define( 'UK', 'UK' );
|
259 |
-
|
260 |
-
//Amazon URLs To be used in Aalb_Content_Filter.
|
261 |
-
$AALB_AMAZON_DOMAINS = array(
|
262 |
-
'amazon\.com',
|
263 |
-
'amazon\.fr',
|
264 |
-
'amazon\.it',
|
265 |
-
'amazon\.de',
|
266 |
-
'amazon\.es',
|
267 |
-
'amazon\.com\.br',
|
268 |
-
'amazon\.ca',
|
269 |
-
'amazon\.cn',
|
270 |
-
'amazon\.in',
|
271 |
-
'amazon\.co\.jp',
|
272 |
-
'amazon\.com\.mx',
|
273 |
-
'amazon\.co\.uk',
|
274 |
-
'amzn\.to'
|
275 |
-
);
|
276 |
-
|
277 |
-
//Wordpress Server Timeout in milliseconds
|
278 |
-
define( "AALB_WORDPRESS_REQUEST_TIMEOUT", 40000 );
|
279 |
-
|
280 |
-
//Curl Timeout Error String
|
281 |
-
define( 'CURL_ERROR_TIMEOUT_STRING', 'cURL error 28' );
|
282 |
-
|
283 |
-
//Support Email-Id
|
284 |
-
define( 'AALB_SUPPORT_EMAIL_ID', 'link-builder@amazon.com' );
|
285 |
-
|
286 |
-
//Plugin Specific URLs
|
287 |
-
define( 'AALB_CONDITIONS_OF_USE_URL', 'https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-ConditionsOfUse-2017-01-17.pdf' );
|
288 |
-
define( 'AALB_USER_GUIDE_URL', 'https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-UserGuide.pdf' );
|
289 |
-
define( 'AALB_SUPPORT_FORUM_URL', 'https://wordpress.org/support/plugin/amazon-associates-link-builder' );
|
290 |
-
|
291 |
-
//Associate URLs
|
292 |
-
define( 'AALB_GETTING_STARTED_URL', 'http://docs.aws.amazon.com/AWSECommerceService/latest/DG/CHAP_GettingStarted.html' );
|
293 |
-
define( 'AALB_AFFILIATE_WEBSITE_URL', 'https://affiliate-program.amazon.com' );
|
294 |
-
define( 'AALB_ADDING_SECONDARY_USER_AC_URL', 'https://affiliate-program.amazon.com/help/node/topic/202049770' );
|
295 |
-
define( 'AALB_ASSOCIATE_SIGN_UP_URL', 'http://docs.aws.amazon.com/AWSECommerceService/latest/DG/becomingAssociate.html' );
|
296 |
-
|
297 |
-
//PAAPI URLs
|
298 |
-
define( 'AALB_PAAPI_SIGN_UP_URL', 'http://docs.aws.amazon.com/AWSECommerceService/latest/DG/becomingDev.html' );
|
299 |
-
define( 'AALB_MANAGE_PAAPI_US_ACCOUNT_URL', 'https://affiliate-program.amazon.com/gp/advertising/api/detail/your-account.html' );
|
300 |
-
define( 'AALB_PAAPI_EFFICIENCY_GUIDELINES_URL', 'http://docs.aws.amazon.com/AWSECommerceService/latest/DG/TroubleshootingApplications.html#efficiency-guidelines' );
|
301 |
-
|
302 |
-
//Plugin specific URLS
|
303 |
-
define( 'AALB_SETTINGS_PAGE_URL', admin_url( 'admin.php?page=associates-link-builder-settings' ) );
|
304 |
-
|
305 |
-
//Maxmind GeoLite2Country DB Download URL
|
306 |
-
define( 'AALB_GEOLITE_COUNTRY_DB_DOWNLOAD_URL', 'https://d8fd03967nrad.cloudfront.net/libs/geoip/database/GeoLite2-Country.mmdb.gz' );
|
307 |
-
define( 'AALB_GEOLITE_DB_DOWNLOAD_URL_FROM_MAXMIND_SERVER', 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz' );
|
308 |
-
define( 'AALB_GEOLITE_COUNTRY_DB_DETAILS_URL', 'https://dev.maxmind.com/geoip/geoip2/geolite2/' );
|
309 |
-
define( 'AALB_NEW_PAGE_TARGET', "_blank" );
|
310 |
-
|
311 |
-
define( 'AALB_NEWLINE_SEPARATOR', "\r\n" );
|
312 |
-
define( 'GEO_TARGETED_LINKS_DELIMITER', "|" );
|
313 |
-
|
314 |
-
//Pugin Link Codes
|
315 |
-
define( 'AALB_DEFAULT_LINK_CODE', "alb" );
|
316 |
-
define( 'AALB_GEO_TARGETED_LINKS_DEFAULT_COUNTRY_LINK_CODE', "al0" );
|
317 |
-
define( 'AALB_GEO_TARGETED_LINKS_REDIRECTED_COUNTRY_LINK_CODE', "al1" );
|
318 |
-
|
319 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin/{aalb_admin.php → plugin_admin.php}
RENAMED
@@ -12,6 +12,18 @@ either express or implied. See the License for the specific language governing p
|
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
/**
|
16 |
* The class responsible for handling all the functionalities in the admin area.
|
17 |
* Enqueues the styles and scripts for post.php and post-new.php.
|
@@ -22,22 +34,22 @@ and limitations under the License.
|
|
22 |
* @package AmazonAssociatesLinkBuilder
|
23 |
* @subpackage AmazonAssociatesLinkBuilder/admin
|
24 |
*/
|
25 |
-
class
|
26 |
|
27 |
private $paapi_helper;
|
28 |
private $remote_loader;
|
29 |
private $tracking_api_helper;
|
30 |
private $helper;
|
31 |
-
private $
|
32 |
private $config_loader;
|
33 |
|
34 |
public function __construct() {
|
35 |
-
$this->paapi_helper = new
|
36 |
-
$this->remote_loader = new
|
37 |
-
$this->tracking_api_helper = new
|
38 |
-
$this->helper = new
|
39 |
-
$this->
|
40 |
-
$this->config_loader = new
|
41 |
}
|
42 |
|
43 |
/**
|
@@ -47,7 +59,7 @@ class Aalb_Admin {
|
|
47 |
* @return boolean true if PA-API credentials are set
|
48 |
*/
|
49 |
public function is_paapi_credentials_not_set() {
|
50 |
-
return ( get_option(
|
51 |
}
|
52 |
|
53 |
/**
|
@@ -58,7 +70,7 @@ class Aalb_Admin {
|
|
58 |
* @return boolean true if store-id credentials are set
|
59 |
*/
|
60 |
public function is_store_id_credentials_not_set() {
|
61 |
-
return ( get_option(
|
62 |
}
|
63 |
|
64 |
/**
|
@@ -68,11 +80,11 @@ class Aalb_Admin {
|
|
68 |
*
|
69 |
*/
|
70 |
public function aalb_enqueue_styles() {
|
71 |
-
wp_enqueue_style( 'jquery_ui_css',
|
72 |
-
wp_enqueue_style( 'aalb_basics_css', AALB_BASICS_CSS, array( 'jquery_ui_css' ),
|
73 |
-
wp_enqueue_style( 'aalb_admin_css', AALB_ADMIN_CSS, array( 'jquery_ui_css' ),
|
74 |
|
75 |
-
wp_enqueue_style( 'font_awesome_css', FONT_AWESOME_CSS );
|
76 |
wp_enqueue_style( 'thickbox' );
|
77 |
}
|
78 |
|
@@ -84,10 +96,10 @@ class Aalb_Admin {
|
|
84 |
*/
|
85 |
public function aalb_enqueue_scripts() {
|
86 |
wp_enqueue_script( 'jquery' );
|
87 |
-
wp_enqueue_script( 'handlebars_js', HANDLEBARS_JS );
|
88 |
-
wp_enqueue_script( 'aalb_sha2_js', AALB_SHA2_JS, array(),
|
89 |
wp_enqueue_script( 'jquery-ui-tabs' );
|
90 |
-
wp_enqueue_script( 'aalb_admin_js', AALB_ADMIN_JS, array( 'handlebars_js', 'jquery', 'jquery-ui-tabs', 'aalb_sha2_js' ),
|
91 |
wp_localize_script( 'aalb_admin_js', 'api_pref', $this->get_paapi_pref() );
|
92 |
wp_localize_script( 'aalb_admin_js', 'aalb_strings', $this->get_aalb_strings() );
|
93 |
}
|
@@ -101,19 +113,19 @@ class Aalb_Admin {
|
|
101 |
*/
|
102 |
private function get_paapi_pref() {
|
103 |
return array(
|
104 |
-
'max_search_result_items' =>
|
105 |
-
'default_marketplace' => get_option(
|
106 |
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
107 |
'action' => 'get_item_search_result',
|
108 |
'item_search_nonce' => wp_create_nonce( 'aalb-item-search-nonce' ),
|
109 |
-
'AALB_SHORTCODE_AMAZON_LINK' =>
|
110 |
-
'AALB_SHORTCODE_AMAZON_TEXT' =>
|
111 |
'IS_PAAPI_CREDENTIALS_NOT_SET' => $this->is_paapi_credentials_not_set(),
|
112 |
'IS_STORE_ID_CREDENTIALS_NOT_SET' => $this->is_store_id_credentials_not_set(),
|
113 |
-
'WORDPRESS_REQUEST_TIMEOUT' =>
|
114 |
-
'templates_list' => json_encode( get_option(
|
115 |
-
'default_template' => get_option(
|
116 |
-
'marketplace_store_id_map' => get_option(
|
117 |
);
|
118 |
}
|
119 |
|
@@ -131,7 +143,7 @@ class Aalb_Admin {
|
|
131 |
"empty_product_search_bar" => esc_html__( "Please Enter a Product Name ", 'amazon-associates-link-builder' ),
|
132 |
"short_code_create_failure" => esc_html__( "Failed to create Text Link shortcode. Editor has some text selected. Only one item can be selected while adding text links", 'amazon-associates-link-builder' ),
|
133 |
/* translators: %s: Email-id of the support */
|
134 |
-
"paapi_request_timeout_error" => sprintf( esc_html__( "Request timed out. Try again after some time. Please check your network and firewall settings. If the error still persists, write to us at %s.", 'amazon-associates-link-builder' ),
|
135 |
"add_aalb_shortcode" => esc_html__( "Add Amazon Associates Link Builder Shortcode", 'amazon-associates-link-builder' ),
|
136 |
/* translators: %s: URL of settings page */
|
137 |
"paapi_credentials_not_set" => sprintf( __( "Please configure your PA-API credentials in the <a href=%s>Settings Page</a> to use the Link Builder features.", 'amazon-associates-link-builder' ), AALB_SETTINGS_PAGE_URL ),
|
@@ -166,7 +178,7 @@ class Aalb_Admin {
|
|
166 |
* @since 1.3
|
167 |
*/
|
168 |
public function check_update() {
|
169 |
-
if (
|
170 |
$this->handle_plugin_update();
|
171 |
}
|
172 |
}
|
@@ -186,13 +198,13 @@ class Aalb_Admin {
|
|
186 |
global $wp_filesystem;
|
187 |
$this->helper->aalb_initialize_wp_filesystem_api();
|
188 |
$this->helper->refresh_template_list();
|
189 |
-
$this->
|
190 |
-
update_option(
|
191 |
}
|
192 |
|
193 |
/**
|
194 |
-
* Prints Search box to be displayed in Editor where user can type in keywords for search. @see
|
195 |
-
* This callback is attached with "media_buttons" hook of wordpress. @see
|
196 |
*
|
197 |
* @since 1.4.3 Only prints search box displayed in editor.
|
198 |
* @since 1.0.0 Prints the aalb-admin sidebar search box.
|
@@ -202,8 +214,8 @@ class Aalb_Admin {
|
|
202 |
}
|
203 |
|
204 |
/**
|
205 |
-
* Prints Popup box of the plugin used to create shortcode. @see
|
206 |
-
* This callback is attached with "admin_footer" hook of wordpress. @see
|
207 |
*
|
208 |
* @since 1.4.3
|
209 |
*
|
@@ -245,7 +257,7 @@ class Aalb_Admin {
|
|
245 |
$url = $this->paapi_helper->get_item_search_url( $_GET['keywords'], array_search( $_GET['marketplace'], $this->config_loader->fetch_marketplaces() ), $_GET['store_id'] );
|
246 |
try {
|
247 |
echo $this->remote_loader->load( $url );
|
248 |
-
} catch ( Exception $e ) {
|
249 |
echo $this->paapi_helper->get_error_message( $e->getMessage() );
|
250 |
}
|
251 |
}
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
15 |
+
namespace AmazonAssociatesLinkBuilder\admin;
|
16 |
+
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
18 |
+
use AmazonAssociatesLinkBuilder\includes\Remote_Loader;
|
19 |
+
use AmazonAssociatesLinkBuilder\helper\Paapi_Helper;
|
20 |
+
use AmazonAssociatesLinkBuilder\helper\Tracking_Api_Helper;
|
21 |
+
use AmazonAssociatesLinkBuilder\helper\Settings_Page_Migration_Helper;
|
22 |
+
use AmazonAssociatesLinkBuilder\configuration\Config_Loader;
|
23 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
24 |
+
use AmazonAssociatesLinkBuilder\constants\Library_Endpoints;
|
25 |
+
use AmazonAssociatesLinkBuilder\helper\Plugin_Helper;
|
26 |
+
|
27 |
/**
|
28 |
* The class responsible for handling all the functionalities in the admin area.
|
29 |
* Enqueues the styles and scripts for post.php and post-new.php.
|
34 |
* @package AmazonAssociatesLinkBuilder
|
35 |
* @subpackage AmazonAssociatesLinkBuilder/admin
|
36 |
*/
|
37 |
+
class Plugin_Admin {
|
38 |
|
39 |
private $paapi_helper;
|
40 |
private $remote_loader;
|
41 |
private $tracking_api_helper;
|
42 |
private $helper;
|
43 |
+
private $migration_helper;
|
44 |
private $config_loader;
|
45 |
|
46 |
public function __construct() {
|
47 |
+
$this->paapi_helper = new Paapi_Helper();
|
48 |
+
$this->remote_loader = new Remote_Loader();
|
49 |
+
$this->tracking_api_helper = new Tracking_Api_Helper();
|
50 |
+
$this->helper = new Plugin_Helper();
|
51 |
+
$this->migration_helper = new Settings_Page_Migration_Helper();
|
52 |
+
$this->config_loader = new Config_Loader();
|
53 |
}
|
54 |
|
55 |
/**
|
59 |
* @return boolean true if PA-API credentials are set
|
60 |
*/
|
61 |
public function is_paapi_credentials_not_set() {
|
62 |
+
return ( get_option( Db_Constants::AWS_ACCESS_KEY ) == '' or get_option( Db_Constants::AWS_SECRET_KEY ) == '' );
|
63 |
}
|
64 |
|
65 |
/**
|
70 |
* @return boolean true if store-id credentials are set
|
71 |
*/
|
72 |
public function is_store_id_credentials_not_set() {
|
73 |
+
return ( get_option( Db_Constants::STORE_IDS ) == '' );
|
74 |
}
|
75 |
|
76 |
/**
|
80 |
*
|
81 |
*/
|
82 |
public function aalb_enqueue_styles() {
|
83 |
+
wp_enqueue_style( 'jquery_ui_css', Library_Endpoints::JQUERY_UI_CSS );
|
84 |
+
wp_enqueue_style( 'aalb_basics_css', AALB_BASICS_CSS, array( 'jquery_ui_css' ), Plugin_Constants::PLUGIN_CURRENT_VERSION );
|
85 |
+
wp_enqueue_style( 'aalb_admin_css', AALB_ADMIN_CSS, array( 'jquery_ui_css' ), Plugin_Constants::PLUGIN_CURRENT_VERSION );
|
86 |
|
87 |
+
wp_enqueue_style( 'font_awesome_css', Library_Endpoints::FONT_AWESOME_CSS );
|
88 |
wp_enqueue_style( 'thickbox' );
|
89 |
}
|
90 |
|
96 |
*/
|
97 |
public function aalb_enqueue_scripts() {
|
98 |
wp_enqueue_script( 'jquery' );
|
99 |
+
wp_enqueue_script( 'handlebars_js', Library_Endpoints::HANDLEBARS_JS );
|
100 |
+
wp_enqueue_script( 'aalb_sha2_js', AALB_SHA2_JS, array(), Plugin_Constants::PLUGIN_CURRENT_VERSION );
|
101 |
wp_enqueue_script( 'jquery-ui-tabs' );
|
102 |
+
wp_enqueue_script( 'aalb_admin_js', AALB_ADMIN_JS, array( 'handlebars_js', 'jquery', 'jquery-ui-tabs', 'aalb_sha2_js' ), Plugin_Constants::PLUGIN_CURRENT_VERSION );
|
103 |
wp_localize_script( 'aalb_admin_js', 'api_pref', $this->get_paapi_pref() );
|
104 |
wp_localize_script( 'aalb_admin_js', 'aalb_strings', $this->get_aalb_strings() );
|
105 |
}
|
113 |
*/
|
114 |
private function get_paapi_pref() {
|
115 |
return array(
|
116 |
+
'max_search_result_items' => Plugin_Constants::MAX_SEARCH_RESULT_ITEMS,
|
117 |
+
'default_marketplace' => get_option( Db_Constants::DEFAULT_MARKETPLACE, Db_Constants::DEFAULT_MARKETPLACE_NAME ),
|
118 |
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
119 |
'action' => 'get_item_search_result',
|
120 |
'item_search_nonce' => wp_create_nonce( 'aalb-item-search-nonce' ),
|
121 |
+
'AALB_SHORTCODE_AMAZON_LINK' => Plugin_Constants::SHORTCODE_AMAZON_LINK,
|
122 |
+
'AALB_SHORTCODE_AMAZON_TEXT' => Plugin_Constants::SHORTCODE_AMAZON_TEXT,
|
123 |
'IS_PAAPI_CREDENTIALS_NOT_SET' => $this->is_paapi_credentials_not_set(),
|
124 |
'IS_STORE_ID_CREDENTIALS_NOT_SET' => $this->is_store_id_credentials_not_set(),
|
125 |
+
'WORDPRESS_REQUEST_TIMEOUT' => Plugin_Constants::WORDPRESS_REQUEST_TIMEOUT_IN_MS,
|
126 |
+
'templates_list' => json_encode( get_option( Db_Constants::TEMPLATE_NAMES ) ),
|
127 |
+
'default_template' => get_option( Db_Constants::DEFAULT_TEMPLATE, Db_Constants::DEFAULT_TEMPLATE_NAME ),
|
128 |
+
'marketplace_store_id_map' => get_option( Db_Constants::STORE_IDS )
|
129 |
);
|
130 |
}
|
131 |
|
143 |
"empty_product_search_bar" => esc_html__( "Please Enter a Product Name ", 'amazon-associates-link-builder' ),
|
144 |
"short_code_create_failure" => esc_html__( "Failed to create Text Link shortcode. Editor has some text selected. Only one item can be selected while adding text links", 'amazon-associates-link-builder' ),
|
145 |
/* translators: %s: Email-id of the support */
|
146 |
+
"paapi_request_timeout_error" => sprintf( esc_html__( "Request timed out. Try again after some time. Please check your network and firewall settings. If the error still persists, write to us at %s.", 'amazon-associates-link-builder' ), Plugin_Constants::SUPPORT_EMAIL_ID ),
|
147 |
"add_aalb_shortcode" => esc_html__( "Add Amazon Associates Link Builder Shortcode", 'amazon-associates-link-builder' ),
|
148 |
/* translators: %s: URL of settings page */
|
149 |
"paapi_credentials_not_set" => sprintf( __( "Please configure your PA-API credentials in the <a href=%s>Settings Page</a> to use the Link Builder features.", 'amazon-associates-link-builder' ), AALB_SETTINGS_PAGE_URL ),
|
178 |
* @since 1.3
|
179 |
*/
|
180 |
public function check_update() {
|
181 |
+
if ( Plugin_Constants::PLUGIN_CURRENT_VERSION !== get_option( Db_Constants::PLUGIN_VERSION ) ) {
|
182 |
$this->handle_plugin_update();
|
183 |
}
|
184 |
}
|
198 |
global $wp_filesystem;
|
199 |
$this->helper->aalb_initialize_wp_filesystem_api();
|
200 |
$this->helper->refresh_template_list();
|
201 |
+
$this->migration_helper->run_migration_logic();
|
202 |
+
update_option( Db_Constants::PLUGIN_VERSION, Plugin_Constants::PLUGIN_CURRENT_VERSION );
|
203 |
}
|
204 |
|
205 |
/**
|
206 |
+
* Prints Search box to be displayed in Editor where user can type in keywords for search. @see editor_search_box.php
|
207 |
+
* This callback is attached with "media_buttons" hook of wordpress. @see Plugin_Manager::add_admin_hooks()
|
208 |
*
|
209 |
* @since 1.4.3 Only prints search box displayed in editor.
|
210 |
* @since 1.0.0 Prints the aalb-admin sidebar search box.
|
214 |
}
|
215 |
|
216 |
/**
|
217 |
+
* Prints Popup box of the plugin used to create shortcode. @see meta_box.php
|
218 |
+
* This callback is attached with "admin_footer" hook of wordpress. @see Plugin_Manager::add_admin_hooks()
|
219 |
*
|
220 |
* @since 1.4.3
|
221 |
*
|
257 |
$url = $this->paapi_helper->get_item_search_url( $_GET['keywords'], array_search( $_GET['marketplace'], $this->config_loader->fetch_marketplaces() ), $_GET['store_id'] );
|
258 |
try {
|
259 |
echo $this->remote_loader->load( $url );
|
260 |
+
} catch ( \Exception $e ) {
|
261 |
echo $this->paapi_helper->get_error_message( $e->getMessage() );
|
262 |
}
|
263 |
}
|
admin/{sidebar/aalb_sidebar.php → sidebar.php}
RENAMED
@@ -11,6 +11,10 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* The class for adding menu and submenu pages on the sidebar.
|
@@ -20,7 +24,7 @@ and limitations under the License.
|
|
20 |
* @package AmazonAssociatesLinkBuilder
|
21 |
* @subpackage AmazonAssociatesLinkBuilder/admin/sidebar
|
22 |
*/
|
23 |
-
class
|
24 |
|
25 |
/**
|
26 |
* Adds categories to the menu page
|
@@ -46,15 +50,15 @@ class Aalb_Sidebar {
|
|
46 |
*/
|
47 |
public function register_cred_config_group() {
|
48 |
// Register Credentials
|
49 |
-
register_setting(
|
50 |
-
register_setting(
|
51 |
-
register_setting(
|
52 |
-
register_setting(
|
53 |
-
register_setting(
|
54 |
-
register_setting(
|
55 |
-
register_setting(
|
56 |
-
register_setting(
|
57 |
-
register_setting(
|
58 |
}
|
59 |
|
60 |
/**
|
@@ -96,7 +100,7 @@ class Aalb_Sidebar {
|
|
96 |
* @param string $input Access key input by the user.
|
97 |
*/
|
98 |
public function validate_access_key( $input ) {
|
99 |
-
$old_data = get_option(
|
100 |
|
101 |
return $this->encrypt_keys( $input, $old_data );
|
102 |
}
|
@@ -110,7 +114,7 @@ class Aalb_Sidebar {
|
|
110 |
* @param string $input Secret key input by the user.
|
111 |
*/
|
112 |
public function validate_secret_key( $input ) {
|
113 |
-
$old_data = get_option(
|
114 |
|
115 |
return $this->encrypt_keys( $input, $old_data );
|
116 |
}
|
@@ -122,17 +126,17 @@ class Aalb_Sidebar {
|
|
122 |
*
|
123 |
* @since 1.0.0
|
124 |
*
|
125 |
-
* @param string $input
|
126 |
* @param string $old_data The data if already stored in the database.
|
127 |
*/
|
128 |
private function encrypt_keys( $input, $old_data ) {
|
129 |
if ( ! isset( $input ) || trim( $input ) === '' ) {
|
130 |
return $input;
|
131 |
-
} elseif ( $input ==
|
132 |
return $old_data;
|
133 |
}
|
134 |
|
135 |
-
$output = base64_encode( openssl_encrypt( $input,
|
136 |
|
137 |
return $output;
|
138 |
}
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\admin\sidebar;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
18 |
|
19 |
/**
|
20 |
* The class for adding menu and submenu pages on the sidebar.
|
24 |
* @package AmazonAssociatesLinkBuilder
|
25 |
* @subpackage AmazonAssociatesLinkBuilder/admin/sidebar
|
26 |
*/
|
27 |
+
class Sidebar {
|
28 |
|
29 |
/**
|
30 |
* Adds categories to the menu page
|
50 |
*/
|
51 |
public function register_cred_config_group() {
|
52 |
// Register Credentials
|
53 |
+
register_setting( Db_Constants::CRED_CONFIG_GROUP, Db_Constants::AWS_ACCESS_KEY, array( $this, 'validate_access_key' ) );
|
54 |
+
register_setting( Db_Constants::CRED_CONFIG_GROUP, Db_Constants::AWS_SECRET_KEY, array( $this, 'validate_secret_key' ) );
|
55 |
+
register_setting( Db_Constants::CRED_CONFIG_GROUP, Db_Constants::DEFAULT_STORE_ID );
|
56 |
+
register_setting( Db_Constants::CRED_CONFIG_GROUP, Db_Constants::DEFAULT_MARKETPLACE );
|
57 |
+
register_setting( Db_Constants::CRED_CONFIG_GROUP, Db_Constants::DEFAULT_TEMPLATE );
|
58 |
+
register_setting( Db_Constants::CRED_CONFIG_GROUP, Db_Constants::STORE_ID_NAMES );
|
59 |
+
register_setting( Db_Constants::CRED_CONFIG_GROUP, Db_Constants::STORE_IDS );
|
60 |
+
register_setting( Db_Constants::CRED_CONFIG_GROUP, Db_Constants::NO_REFERRER_DISABLED );
|
61 |
+
register_setting( Db_Constants::CRED_CONFIG_GROUP, Db_Constants::CUSTOM_UPLOAD_PATH );
|
62 |
}
|
63 |
|
64 |
/**
|
100 |
* @param string $input Access key input by the user.
|
101 |
*/
|
102 |
public function validate_access_key( $input ) {
|
103 |
+
$old_data = get_option( Db_Constants::AWS_ACCESS_KEY );
|
104 |
|
105 |
return $this->encrypt_keys( $input, $old_data );
|
106 |
}
|
114 |
* @param string $input Secret key input by the user.
|
115 |
*/
|
116 |
public function validate_secret_key( $input ) {
|
117 |
+
$old_data = get_option( Db_Constants::AWS_SECRET_KEY );
|
118 |
|
119 |
return $this->encrypt_keys( $input, $old_data );
|
120 |
}
|
126 |
*
|
127 |
* @since 1.0.0
|
128 |
*
|
129 |
+
* @param string $input Key input by the user to encrypt.
|
130 |
* @param string $old_data The data if already stored in the database.
|
131 |
*/
|
132 |
private function encrypt_keys( $input, $old_data ) {
|
133 |
if ( ! isset( $input ) || trim( $input ) === '' ) {
|
134 |
return $input;
|
135 |
+
} elseif ( $input == Plugin_Constants::AWS_SECRET_KEY_MASK ) {
|
136 |
return $old_data;
|
137 |
}
|
138 |
|
139 |
+
$output = base64_encode( openssl_encrypt( $input, Plugin_Constants::ENCRYPTION_ALGORITHM, Plugin_Constants::ENCRYPTION_KEY, 0, Plugin_Constants::ENCRYPTION_IV ) );
|
140 |
|
141 |
return $output;
|
142 |
}
|
amazon-associates-link-builder.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* @package AmazonAssociatesLinkBuilder
|
4 |
*
|
@@ -7,7 +8,7 @@
|
|
7 |
/*
|
8 |
Plugin Name: Amazon Associates Link Builder
|
9 |
Description: Amazon Associates Link Builder is the official free Amazon Associates Program plugin for WordPress. The plugin enables you to search for products in the Amazon catalog, access real-time price and availability information, and easily create links in your posts to products on Amazon.com. You will be able to generate text links, create custom ad units, or take advantage of out-of-the-box widgets that we’ve designed and included with the plugin.
|
10 |
-
Version: 1.
|
11 |
Author: Amazon Associates Program
|
12 |
Author URI: https://affiliate-program.amazon.com/
|
13 |
License: GPLv2
|
@@ -30,79 +31,23 @@ and limitations under the License.
|
|
30 |
if ( ! defined( 'WPINC' ) ) {
|
31 |
die;
|
32 |
}
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'aalb_add_action_links' );
|
37 |
-
function aalb_add_action_links( $links ) {
|
38 |
-
$mylinks = array(
|
39 |
-
'<a href="' . admin_url( 'admin.php?page=associates-link-builder-about' ) . '">' . esc_html__( "About", 'amazon-associates-link-builder' ) . '</a>',
|
40 |
-
'<a href="' . admin_url( 'admin.php?page=associates-link-builder-settings' ) . '">' . esc_html__( "Settings", 'amazon-associates-link-builder' ) . '</a>',
|
41 |
-
'<a href="' . admin_url( 'admin.php?page=associates-link-builder-templates' ) . '">' . esc_html__( "Templates", 'amazon-associates-link-builder' ) . '</a>',
|
42 |
-
);
|
43 |
-
|
44 |
-
return array_merge( $links, $mylinks );
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Autoload the files required for the plugin.
|
49 |
-
*
|
50 |
-
* @since 1.0.0
|
51 |
-
*/
|
52 |
-
function aalb_autoload() {
|
53 |
-
//Load the autoloader for mustache.
|
54 |
-
require_once( MUSTACHE_AUTOLOADER_PHP );
|
55 |
-
Mustache_Autoloader::register();
|
56 |
-
|
57 |
-
require_once( AALB_PLUGIN_DIR . 'vendor/autoload.php' );
|
58 |
-
|
59 |
-
//Load the autoloader for plugin files.
|
60 |
-
require_once( AALB_AUTOLOADER );
|
61 |
-
Aalb_Autoloader::register();
|
62 |
-
}
|
63 |
-
|
64 |
-
aalb_autoload();
|
65 |
-
|
66 |
-
register_activation_hook( __FILE__, array( new Aalb_Activator(), 'activate' ) );
|
67 |
-
|
68 |
-
/**
|
69 |
-
* The code to run on deactivation
|
70 |
-
*
|
71 |
-
* CAUTION: Any function present here should contain code that is compatible with at least PHP 5.3(even lower if possible) so
|
72 |
-
* that anyone not meeting compatibility requirements for min php versions gets deactivated successfully.
|
73 |
-
*
|
74 |
-
* @since 1.0.0
|
75 |
-
*/
|
76 |
-
function aalb_deactivate() {
|
77 |
-
$aalb_deactivator = new Aalb_Deactivator();
|
78 |
-
$aalb_deactivator->remove_cache();
|
79 |
-
}
|
80 |
-
|
81 |
-
register_deactivation_hook( __FILE__, 'aalb_deactivate' );
|
82 |
-
|
83 |
-
/**
|
84 |
-
* The code to run on uninstalltion
|
85 |
-
*
|
86 |
-
* @since 1.0.0
|
87 |
*/
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
92 |
}
|
93 |
|
94 |
-
register_uninstall_hook( __FILE__, 'aalb_uninstall' );
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Execute the plugin
|
98 |
-
*
|
99 |
-
* @since 1.0.0
|
100 |
-
*/
|
101 |
-
function aalb_execute() {
|
102 |
-
$aalb_manager = new Aalb_Manager();
|
103 |
-
$aalb_manager->execute();
|
104 |
-
}
|
105 |
|
|
|
106 |
add_action( 'plugins_loaded', 'aalb_plugin_load_textdomain' );
|
107 |
|
108 |
/**
|
@@ -113,21 +58,4 @@ function aalb_plugin_load_textdomain() {
|
|
113 |
load_plugin_textdomain( 'amazon-associates-link-builder', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
114 |
}
|
115 |
|
116 |
-
//To use the function is_plugin_active()
|
117 |
-
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
118 |
-
|
119 |
-
/*
|
120 |
-
* Minimum WP version supported in these activation, deactivation and updates check: 2.8.0
|
121 |
-
* Minimum PHP version supported in these activation, deactivation and updates check: 5.3
|
122 |
-
*/
|
123 |
-
if ( is_plugin_active( plugin_basename( AALB_PLUGIN_DIR . 'amazon-associates-link-builder.php' ) ) ) {
|
124 |
-
$compatibility_helper = new Aalb_Compatibility_Helper();
|
125 |
-
if ( $compatibility_helper->is_plugin_compatible() ) {
|
126 |
-
//All functions to be called from main file should be put inside this check
|
127 |
-
aalb_execute();
|
128 |
-
} else {
|
129 |
-
$compatibility_helper->aalb_deactivate();
|
130 |
-
}
|
131 |
-
}
|
132 |
-
|
133 |
?>
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* @package AmazonAssociatesLinkBuilder
|
5 |
*
|
8 |
/*
|
9 |
Plugin Name: Amazon Associates Link Builder
|
10 |
Description: Amazon Associates Link Builder is the official free Amazon Associates Program plugin for WordPress. The plugin enables you to search for products in the Amazon catalog, access real-time price and availability information, and easily create links in your posts to products on Amazon.com. You will be able to generate text links, create custom ad units, or take advantage of out-of-the-box widgets that we’ve designed and included with the plugin.
|
11 |
+
Version: 1.8.0
|
12 |
Author: Amazon Associates Program
|
13 |
Author URI: https://affiliate-program.amazon.com/
|
14 |
License: GPLv2
|
31 |
if ( ! defined( 'WPINC' ) ) {
|
32 |
die;
|
33 |
}
|
34 |
+
/*
|
35 |
+
* Minimum WP version supported in these activation, deactivation and updates check: 2.8.0
|
36 |
+
* Minimum PHP version supported in these activation, deactivation and updates check: 5.2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
*/
|
38 |
+
require_once( plugin_dir_path( __FILE__ ) . 'plugin_config.php' );
|
39 |
+
require_once( AALB_COMPATIBILITY_HELPER );
|
40 |
+
$aalb_compatibility_helper = new Aalb_Compatibility_Helper();
|
41 |
+
if ( ! $aalb_compatibility_helper->is_plugin_compatible() ) {
|
42 |
+
$aalb_compatibility_helper->deactivate();
|
43 |
+
} else {
|
44 |
+
require_once( AALB_INITIALIZER );
|
45 |
+
$aalb_initializer = new Aalb_Initializer();
|
46 |
+
$aalb_initializer->initialize( plugin_basename( __FILE__ ), __FILE__ );
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
+
//This will show Plugin in local language even if plugin is not activated or does not meet compatibilty requirements.
|
51 |
add_action( 'plugins_loaded', 'aalb_plugin_load_textdomain' );
|
52 |
|
53 |
/**
|
58 |
load_plugin_textdomain( 'amazon-associates-link-builder', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
59 |
}
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
?>
|
bin/install-wp-tests.sh
DELETED
@@ -1,118 +0,0 @@
|
|
1 |
-
#!/usr/bin/env bash
|
2 |
-
|
3 |
-
if [ $# -lt 3 ]; then
|
4 |
-
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version]"
|
5 |
-
exit 1
|
6 |
-
fi
|
7 |
-
|
8 |
-
DB_NAME=$1
|
9 |
-
DB_USER=$2
|
10 |
-
DB_PASS=$3
|
11 |
-
DB_HOST=${4-localhost}
|
12 |
-
WP_VERSION=${5-latest}
|
13 |
-
|
14 |
-
WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
|
15 |
-
WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}
|
16 |
-
|
17 |
-
download() {
|
18 |
-
if [ `which curl` ]; then
|
19 |
-
curl -s "$1" > "$2";
|
20 |
-
elif [ `which wget` ]; then
|
21 |
-
wget -nv -O "$2" "$1"
|
22 |
-
fi
|
23 |
-
}
|
24 |
-
|
25 |
-
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then
|
26 |
-
WP_TESTS_TAG="tags/$WP_VERSION"
|
27 |
-
elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
|
28 |
-
WP_TESTS_TAG="trunk"
|
29 |
-
else
|
30 |
-
# http serves a single offer, whereas https serves multiple. we only want one
|
31 |
-
download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
|
32 |
-
grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
|
33 |
-
LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
|
34 |
-
if [[ -z "$LATEST_VERSION" ]]; then
|
35 |
-
echo "Latest WordPress version could not be found"
|
36 |
-
exit 1
|
37 |
-
fi
|
38 |
-
WP_TESTS_TAG="tags/$LATEST_VERSION"
|
39 |
-
fi
|
40 |
-
|
41 |
-
set -ex
|
42 |
-
|
43 |
-
install_wp() {
|
44 |
-
|
45 |
-
if [ -d $WP_CORE_DIR ]; then
|
46 |
-
return;
|
47 |
-
fi
|
48 |
-
|
49 |
-
mkdir -p $WP_CORE_DIR
|
50 |
-
|
51 |
-
if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
|
52 |
-
mkdir -p /tmp/wordpress-nightly
|
53 |
-
download https://wordpress.org/nightly-builds/wordpress-latest.zip /tmp/wordpress-nightly/wordpress-nightly.zip
|
54 |
-
unzip -q /tmp/wordpress-nightly/wordpress-nightly.zip -d /tmp/wordpress-nightly/
|
55 |
-
mv /tmp/wordpress-nightly/wordpress/* $WP_CORE_DIR
|
56 |
-
else
|
57 |
-
if [ $WP_VERSION == 'latest' ]; then
|
58 |
-
local ARCHIVE_NAME='latest'
|
59 |
-
else
|
60 |
-
local ARCHIVE_NAME="wordpress-$WP_VERSION"
|
61 |
-
fi
|
62 |
-
download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz
|
63 |
-
tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
|
64 |
-
fi
|
65 |
-
|
66 |
-
download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
|
67 |
-
}
|
68 |
-
|
69 |
-
install_test_suite() {
|
70 |
-
# portable in-place argument for both GNU sed and Mac OSX sed
|
71 |
-
if [[ $(uname -s) == 'Darwin' ]]; then
|
72 |
-
local ioption='-i .bak'
|
73 |
-
else
|
74 |
-
local ioption='-i'
|
75 |
-
fi
|
76 |
-
|
77 |
-
# set up testing suite if it doesn't yet exist
|
78 |
-
if [ ! -d $WP_TESTS_DIR ]; then
|
79 |
-
# set up testing suite
|
80 |
-
mkdir -p $WP_TESTS_DIR
|
81 |
-
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
|
82 |
-
fi
|
83 |
-
|
84 |
-
if [ ! -f wp-tests-config.php ]; then
|
85 |
-
download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
|
86 |
-
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" "$WP_TESTS_DIR"/wp-tests-config.php
|
87 |
-
sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
|
88 |
-
sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
|
89 |
-
sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
|
90 |
-
sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
|
91 |
-
fi
|
92 |
-
|
93 |
-
}
|
94 |
-
|
95 |
-
install_db() {
|
96 |
-
# parse DB_HOST for port or socket references
|
97 |
-
local PARTS=(${DB_HOST//\:/ })
|
98 |
-
local DB_HOSTNAME=${PARTS[0]};
|
99 |
-
local DB_SOCK_OR_PORT=${PARTS[1]};
|
100 |
-
local EXTRA=""
|
101 |
-
|
102 |
-
if ! [ -z $DB_HOSTNAME ] ; then
|
103 |
-
if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
|
104 |
-
EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
|
105 |
-
elif ! [ -z $DB_SOCK_OR_PORT ] ; then
|
106 |
-
EXTRA=" --socket=$DB_SOCK_OR_PORT"
|
107 |
-
elif ! [ -z $DB_HOSTNAME ] ; then
|
108 |
-
EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
|
109 |
-
fi
|
110 |
-
fi
|
111 |
-
|
112 |
-
# create database
|
113 |
-
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
|
114 |
-
}
|
115 |
-
|
116 |
-
install_wp
|
117 |
-
install_test_suite
|
118 |
-
install_db
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/aalb_cache_loader.php → cache/cache_loader.php
RENAMED
@@ -11,6 +11,10 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* Fired while making a GET request.
|
@@ -22,27 +26,27 @@ and limitations under the License.
|
|
22 |
* @package AmazonAssociatesLinkBuilder
|
23 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
24 |
*/
|
25 |
-
class
|
26 |
|
27 |
public $loader;
|
28 |
protected $helper;
|
29 |
|
30 |
public function __construct( $loader ) {
|
31 |
$this->loader = $loader;
|
32 |
-
$this->helper = new
|
33 |
}
|
34 |
|
35 |
/**
|
36 |
* If the information is in the cache, then retrieve the information from the cache.
|
37 |
* Else get the information by making a GET request.
|
38 |
*
|
39 |
-
* @param string $key
|
40 |
-
* @param string $url
|
41 |
* @param string $link_code Link Code to be entered in URLS for attribution purposes.
|
42 |
*
|
43 |
* @return string GET Response.
|
44 |
*/
|
45 |
-
public function load( $key, $url, $link_code =
|
46 |
$info = $this->lookup( $key );
|
47 |
if ( $info !== false ) {
|
48 |
return $info;
|
@@ -67,8 +71,8 @@ class Aalb_Cache_Loader {
|
|
67 |
/**
|
68 |
* Load the information with a GET request and save it in the cache. Return the loaded information.
|
69 |
*
|
70 |
-
* @param string $key
|
71 |
-
* @param string $url
|
72 |
* @param string $link_code Link Code to be entered in URLS for attribution purposes.
|
73 |
*
|
74 |
* @return string GET Response.
|
@@ -81,6 +85,7 @@ class Aalb_Cache_Loader {
|
|
81 |
|
82 |
$this->helper->clear_expired_transients_at_intervals();
|
83 |
set_transient( $key, $info, AALB_CACHE_FOR_ASIN_RAWINFO_TTL );
|
|
|
84 |
return $info;
|
85 |
}
|
86 |
}
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\cache;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
17 |
+
use AmazonAssociatesLinkBuilder\helper\Plugin_Helper;
|
18 |
|
19 |
/**
|
20 |
* Fired while making a GET request.
|
26 |
* @package AmazonAssociatesLinkBuilder
|
27 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
28 |
*/
|
29 |
+
class Cache_Loader {
|
30 |
|
31 |
public $loader;
|
32 |
protected $helper;
|
33 |
|
34 |
public function __construct( $loader ) {
|
35 |
$this->loader = $loader;
|
36 |
+
$this->helper = new Plugin_Helper();
|
37 |
}
|
38 |
|
39 |
/**
|
40 |
* If the information is in the cache, then retrieve the information from the cache.
|
41 |
* Else get the information by making a GET request.
|
42 |
*
|
43 |
+
* @param string $key Unique identification of the information.
|
44 |
+
* @param string $url URL for making a request.
|
45 |
* @param string $link_code Link Code to be entered in URLS for attribution purposes.
|
46 |
*
|
47 |
* @return string GET Response.
|
48 |
*/
|
49 |
+
public function load( $key, $url, $link_code = Plugin_Constants::DEFAULT_LINK_CODE ) {
|
50 |
$info = $this->lookup( $key );
|
51 |
if ( $info !== false ) {
|
52 |
return $info;
|
71 |
/**
|
72 |
* Load the information with a GET request and save it in the cache. Return the loaded information.
|
73 |
*
|
74 |
+
* @param string $key Unique identification of the information.
|
75 |
+
* @param string $url URL for making a request.
|
76 |
* @param string $link_code Link Code to be entered in URLS for attribution purposes.
|
77 |
*
|
78 |
* @return string GET Response.
|
85 |
|
86 |
$this->helper->clear_expired_transients_at_intervals();
|
87 |
set_transient( $key, $info, AALB_CACHE_FOR_ASIN_RAWINFO_TTL );
|
88 |
+
|
89 |
return $info;
|
90 |
}
|
91 |
}
|
includes/aalb_cache_template_loader.php → cache/cache_template_loader.php
RENAMED
@@ -11,6 +11,7 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
14 |
|
15 |
/**
|
16 |
* Cache Loader for rendered templates.
|
@@ -21,8 +22,7 @@ and limitations under the License.
|
|
21 |
* @package AmazonAssociatesLinkBuilder
|
22 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
23 |
*/
|
24 |
-
class
|
25 |
-
|
26 |
/**
|
27 |
* Get the html of the display unit from the cache
|
28 |
*
|
@@ -41,7 +41,7 @@ class Aalb_Cache_Template_Loader {
|
|
41 |
*
|
42 |
* @since 1.0.0
|
43 |
*
|
44 |
-
* @param string $key
|
45 |
* @param string $display_unit HTML of the display unit to save in the cache.
|
46 |
*/
|
47 |
public function save_display_unit( $key, $display_unit ) {
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\cache;
|
15 |
|
16 |
/**
|
17 |
* Cache Loader for rendered templates.
|
22 |
* @package AmazonAssociatesLinkBuilder
|
23 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
24 |
*/
|
25 |
+
class Cache_Template_Loader {
|
|
|
26 |
/**
|
27 |
* Get the html of the display unit from the cache
|
28 |
*
|
41 |
*
|
42 |
* @since 1.0.0
|
43 |
*
|
44 |
+
* @param string $key Unique identification of the product.
|
45 |
* @param string $display_unit HTML of the display unit to save in the cache.
|
46 |
*/
|
47 |
public function save_display_unit( $key, $display_unit ) {
|
configuration/config_helper.php
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
|
5 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
7 |
+
A copy of the License is located in the "license" file accompanying this file.
|
8 |
+
|
9 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
+
either express or implied. See the License for the specific language governing permissions
|
11 |
+
and limitations under the License.
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace AmazonAssociatesLinkBuilder\configuration;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
17 |
+
use AmazonAssociatesLinkBuilder\exceptions\Invalid_Marketplace_Exception;
|
18 |
+
use AmazonAssociatesLinkBuilder\constants\XML_Constants;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Helper class for dealing with configuration
|
22 |
+
*
|
23 |
+
* @since 1.8.0
|
24 |
+
* @package AmazonAssociatesLinkBuilder
|
25 |
+
* @subpackage AmazonAssociatesLinkBuilder/configuration
|
26 |
+
*/
|
27 |
+
class Config_Helper {
|
28 |
+
private $configuration;
|
29 |
+
|
30 |
+
public function __construct() {
|
31 |
+
$this->configuration = $this->get_configuration();
|
32 |
+
}
|
33 |
+
|
34 |
+
/*
|
35 |
+
* Parse the JSON from File and returns Marketplace Array from that.
|
36 |
+
*
|
37 |
+
* @return JSONObject
|
38 |
+
*
|
39 |
+
* @since 1.8.0
|
40 |
+
*
|
41 |
+
*/
|
42 |
+
private function get_configuration() {
|
43 |
+
$body = json_decode( file_get_contents( AALB_MARKETPLACE_CONFIG_JSON ), true );
|
44 |
+
if ( json_last_error() !== \JSON_ERROR_NONE ) {
|
45 |
+
error_log( 'Invalid Json read from file' . json_last_error() );
|
46 |
+
$body = null;
|
47 |
+
} else {
|
48 |
+
$body = $body['Local']['Marketplace'];
|
49 |
+
}
|
50 |
+
|
51 |
+
return $body;
|
52 |
+
}
|
53 |
+
|
54 |
+
/*
|
55 |
+
* Return the configuration value for the key & marketplace
|
56 |
+
*
|
57 |
+
* @param String $marketplace
|
58 |
+
* @param String $key
|
59 |
+
*
|
60 |
+
* @return Object Value for the key
|
61 |
+
*
|
62 |
+
* @throws \InvalidArgumentException for non-existent keys
|
63 |
+
*
|
64 |
+
* @since 1.8.0
|
65 |
+
*
|
66 |
+
*/
|
67 |
+
public function get( $marketplace, $key ) {
|
68 |
+
if ( ! isset( $this->configuration ) ) {
|
69 |
+
throw new \Exception( "Marketplace Configuration is not set" );
|
70 |
+
} else if ( ! isset( $this->configuration[$marketplace] ) ) {
|
71 |
+
throw new Invalid_Marketplace_Exception( "Invalid marketplace " . $marketplace . " passed" );
|
72 |
+
} else if ( ! isset( $this->configuration[$marketplace][$key] ) ) {
|
73 |
+
throw new \InvalidArgumentException( "Invalid key " . $key . " passed" );
|
74 |
+
} else {
|
75 |
+
return $this->configuration[$marketplace][$key];
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Return strings for a marketplace
|
81 |
+
*
|
82 |
+
* @since 1.8.0
|
83 |
+
*
|
84 |
+
* @param string $key Identifier of string to be translated
|
85 |
+
* @param string $marketplace The target marketplace name
|
86 |
+
*
|
87 |
+
* @return string
|
88 |
+
*/
|
89 |
+
public function get_string( $key, $marketplace ) {
|
90 |
+
try {
|
91 |
+
$string_array = $this->get( $marketplace, XML_Constants::STRINGS );
|
92 |
+
} catch ( Invalid_Marketplace_Exception $e ) {
|
93 |
+
//Sending EN_US strings. Case when a new marketplace is added
|
94 |
+
$string_array = $this->get( Db_Constants::DEFAULT_MARKETPLACE_NAME, XML_Constants::STRINGS );
|
95 |
+
} catch ( \Exception $e ) {
|
96 |
+
error_log( "Aalb_Config_Helper::get_string::" . $e->getMessage() );
|
97 |
+
$string_array = null;
|
98 |
+
}
|
99 |
+
|
100 |
+
return ( isset( $string_array ) && isset( $string_array[$key] ) ) ? $string_array[$key] : $key;
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
?>
|
includes/aalb_config_loader.php → configuration/config_loader.php
RENAMED
@@ -11,6 +11,13 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* The class responsible for getting all the configuration
|
@@ -21,12 +28,12 @@ and limitations under the License.
|
|
21 |
* @package AmazonAssociatesLinkBuilder
|
22 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
23 |
*/
|
24 |
-
class
|
25 |
|
26 |
private $cache_loader;
|
27 |
|
28 |
public function __construct() {
|
29 |
-
$this->cache_loader = new
|
30 |
}
|
31 |
|
32 |
/**
|
@@ -39,13 +46,13 @@ class Aalb_Config_Loader {
|
|
39 |
*/
|
40 |
public function fetch_marketplaces() {
|
41 |
try {
|
42 |
-
$body = $this->cache_loader->load(
|
43 |
|
44 |
return $this->parse_json( $body );
|
45 |
-
} catch ( Exception $e ) {
|
46 |
error_log( $e->getMessage() );
|
47 |
|
48 |
-
return get_option(
|
49 |
}
|
50 |
}
|
51 |
|
@@ -62,14 +69,14 @@ class Aalb_Config_Loader {
|
|
62 |
$body = json_decode( $json_body, true );
|
63 |
if ( json_last_error() !== JSON_ERROR_NONE ) {
|
64 |
//Don't translate as this is also dumped in error logs and will facilitate AALB team to debug
|
65 |
-
throw new Exception( 'Invalid Json returned by server' . json_last_error() );
|
66 |
}
|
67 |
$marketplaces_info = $body['Local']['Marketplace'];
|
68 |
$updated_marketplace = array();
|
69 |
foreach ( $marketplaces_info as $key => $value ) {
|
70 |
-
$updated_marketplace[
|
71 |
}
|
72 |
-
update_option(
|
73 |
|
74 |
return $updated_marketplace;
|
75 |
}
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\configuration;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\cache\Cache_Loader;
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
18 |
+
use AmazonAssociatesLinkBuilder\constants\Paapi_Constants;
|
19 |
+
use AmazonAssociatesLinkBuilder\includes\Remote_Loader;
|
20 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
21 |
|
22 |
/**
|
23 |
* The class responsible for getting all the configuration
|
28 |
* @package AmazonAssociatesLinkBuilder
|
29 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
30 |
*/
|
31 |
+
class Config_Loader {
|
32 |
|
33 |
private $cache_loader;
|
34 |
|
35 |
public function __construct() {
|
36 |
+
$this->cache_loader = new Cache_Loader( new Remote_Loader() );
|
37 |
}
|
38 |
|
39 |
/**
|
46 |
*/
|
47 |
public function fetch_marketplaces() {
|
48 |
try {
|
49 |
+
$body = $this->cache_loader->load( Db_Constants::MARKETPLACE_NAMES, Paapi_Constants::MARKETPLACES_URL );
|
50 |
|
51 |
return $this->parse_json( $body );
|
52 |
+
} catch ( \Exception $e ) {
|
53 |
error_log( $e->getMessage() );
|
54 |
|
55 |
+
return get_option( Db_Constants::MARKETPLACE_NAMES );
|
56 |
}
|
57 |
}
|
58 |
|
69 |
$body = json_decode( $json_body, true );
|
70 |
if ( json_last_error() !== JSON_ERROR_NONE ) {
|
71 |
//Don't translate as this is also dumped in error logs and will facilitate AALB team to debug
|
72 |
+
throw new \Exception( 'Invalid Json returned by server' . json_last_error() );
|
73 |
}
|
74 |
$marketplaces_info = $body['Local']['Marketplace'];
|
75 |
$updated_marketplace = array();
|
76 |
foreach ( $marketplaces_info as $key => $value ) {
|
77 |
+
$updated_marketplace[substr( $value['Endpoint'], 0, strpos( $value['Endpoint'], '/' ) )] = $key;
|
78 |
}
|
79 |
+
update_option( Db_Constants::MARKETPLACE_NAMES, $updated_marketplace );
|
80 |
|
81 |
return $updated_marketplace;
|
82 |
}
|
configuration/marketplace_config.json
ADDED
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"Local": {
|
3 |
+
"Marketplace": {
|
4 |
+
"AU": {
|
5 |
+
"impression_recorder_service": {
|
6 |
+
"endpoint": "ir-jp.amazon-adsystem.com",
|
7 |
+
"org_unit_id": 36
|
8 |
+
},
|
9 |
+
"about_page": {
|
10 |
+
"display_name": "Australia",
|
11 |
+
"associates_page_url": "https://affiliate-program.amazon.com.au/"
|
12 |
+
},
|
13 |
+
"strings": {
|
14 |
+
"price": "Price",
|
15 |
+
"strike_price_string": "Was",
|
16 |
+
"products_from_amazon": "Products from Amazon.com.au",
|
17 |
+
"check_on_amazon": "Check on Amazon",
|
18 |
+
"out_of_stock": "Out of stock"
|
19 |
+
}
|
20 |
+
},
|
21 |
+
"BR": {
|
22 |
+
"impression_recorder_service": {
|
23 |
+
"endpoint": "ir-br.amazon-adsystem.com",
|
24 |
+
"org_unit_id": 33
|
25 |
+
},
|
26 |
+
"about_page": {
|
27 |
+
"display_name": "Brazil",
|
28 |
+
"associates_page_url": "https://associados.amazon.com.br/"
|
29 |
+
},
|
30 |
+
"strings": {
|
31 |
+
"price": "Price",
|
32 |
+
"strike_price_string": "Was",
|
33 |
+
"products_from_amazon": "Products from Amazon.com.br",
|
34 |
+
"check_on_amazon": "Check on Amazon",
|
35 |
+
"out_of_stock": "Out of stock"
|
36 |
+
}
|
37 |
+
},
|
38 |
+
"CA": {
|
39 |
+
"impression_recorder_service": {
|
40 |
+
"endpoint": "ir-ca.amazon-adsystem.com",
|
41 |
+
"org_unit_id": 15
|
42 |
+
},
|
43 |
+
"about_page": {
|
44 |
+
"display_name": "Canada",
|
45 |
+
"associates_page_url": "https://associates.amazon.ca/"
|
46 |
+
},
|
47 |
+
"strings": {
|
48 |
+
"price": "Price",
|
49 |
+
"strike_price_string": "Was",
|
50 |
+
"products_from_amazon": "Products from Amazon.ca",
|
51 |
+
"check_on_amazon": "Check on Amazon",
|
52 |
+
"out_of_stock": "Out of stock"
|
53 |
+
}
|
54 |
+
},
|
55 |
+
"CN": {
|
56 |
+
"impression_recorder_service": {
|
57 |
+
"endpoint": "ir-cn.amazon-adsystem.com",
|
58 |
+
"org_unit_id": 28
|
59 |
+
},
|
60 |
+
"about_page": {
|
61 |
+
"display_name": "China",
|
62 |
+
"associates_page_url": "https://associates.amazon.cn/"
|
63 |
+
},
|
64 |
+
"strings": {
|
65 |
+
"price": "Price",
|
66 |
+
"strike_price_string": "Was",
|
67 |
+
"products_from_amazon": "Products from Amazon.cn",
|
68 |
+
"check_on_amazon": "Check on Amazon",
|
69 |
+
"out_of_stock": "Out of stock"
|
70 |
+
}
|
71 |
+
},
|
72 |
+
"DE": {
|
73 |
+
"impression_recorder_service": {
|
74 |
+
"endpoint": "ir-de.amazon-adsystem.com",
|
75 |
+
"org_unit_id": 3
|
76 |
+
},
|
77 |
+
"about_page": {
|
78 |
+
"display_name": "Germany",
|
79 |
+
"associates_page_url": "https://partnernet.amazon.de/"
|
80 |
+
},
|
81 |
+
"strings": {
|
82 |
+
"price": "Preis",
|
83 |
+
"strike_price_string": "statt",
|
84 |
+
"products_from_amazon": "Produkte von Amazon.de",
|
85 |
+
"check_on_amazon": "Hier auf Amazon.de",
|
86 |
+
"out_of_stock": "Derzeit nicht verfügbar"
|
87 |
+
}
|
88 |
+
},
|
89 |
+
"ES": {
|
90 |
+
"impression_recorder_service": {
|
91 |
+
"endpoint": "ir-es.amazon-adsystem.com",
|
92 |
+
"org_unit_id": 30
|
93 |
+
},
|
94 |
+
"about_page": {
|
95 |
+
"display_name": "Spain",
|
96 |
+
"associates_page_url": "https://afiliados.amazon.es/"
|
97 |
+
},
|
98 |
+
"strings": {
|
99 |
+
"price": "Precio",
|
100 |
+
"strike_price_string": "Precio recomendado",
|
101 |
+
"products_from_amazon": "Producto disponible en Amazon.es",
|
102 |
+
"check_on_amazon": "Consultar en Amazon.es",
|
103 |
+
"out_of_stock": "Producto no disponible"
|
104 |
+
}
|
105 |
+
},
|
106 |
+
"FR": {
|
107 |
+
"impression_recorder_service": {
|
108 |
+
"endpoint": "ir-fr.amazon-adsystem.com",
|
109 |
+
"org_unit_id": 8
|
110 |
+
},
|
111 |
+
"about_page": {
|
112 |
+
"display_name": "France",
|
113 |
+
"associates_page_url": "http://partenaires.amazon.fr/"
|
114 |
+
},
|
115 |
+
"strings": {
|
116 |
+
"price": "Prix",
|
117 |
+
"strike_price_string": "Ancien prix",
|
118 |
+
"products_from_amazon": "Produits disponibles sur Amazon.fr",
|
119 |
+
"check_on_amazon": "Consulter sur Amazon.fr",
|
120 |
+
"out_of_stock": "Rupture de stock"
|
121 |
+
}
|
122 |
+
},
|
123 |
+
"IN": {
|
124 |
+
"impression_recorder_service": {
|
125 |
+
"endpoint": "ir-in.amazon-adsystem.com",
|
126 |
+
"org_unit_id": 31
|
127 |
+
},
|
128 |
+
"about_page": {
|
129 |
+
"display_name": "India",
|
130 |
+
"associates_page_url": "http://affiliate-program.amazon.in/"
|
131 |
+
},
|
132 |
+
"strings": {
|
133 |
+
"price": "Price",
|
134 |
+
"strike_price_string": "Was",
|
135 |
+
"products_from_amazon": "Products from Amazon.in",
|
136 |
+
"check_on_amazon": "Check on Amazon",
|
137 |
+
"out_of_stock": "Out of stock"
|
138 |
+
}
|
139 |
+
},
|
140 |
+
"IT": {
|
141 |
+
"impression_recorder_service": {
|
142 |
+
"endpoint": "ir-it.amazon-adsystem.com",
|
143 |
+
"org_unit_id": 29
|
144 |
+
},
|
145 |
+
"about_page": {
|
146 |
+
"display_name": "Italy",
|
147 |
+
"associates_page_url": "https://programma-affiliazione.amazon.it/"
|
148 |
+
},
|
149 |
+
"strings": {
|
150 |
+
"price": "Prezzo",
|
151 |
+
"strike_price_string": "Da",
|
152 |
+
"products_from_amazon": "Acquista su Amazon.it",
|
153 |
+
"check_on_amazon": "Vedi su Amazon.it",
|
154 |
+
"out_of_stock": "Non disponibile"
|
155 |
+
}
|
156 |
+
},
|
157 |
+
"JP": {
|
158 |
+
"impression_recorder_service": {
|
159 |
+
"endpoint": "ir-jp.amazon-adsystem.com",
|
160 |
+
"org_unit_id": 9
|
161 |
+
},
|
162 |
+
"about_page": {
|
163 |
+
"display_name": "Japan",
|
164 |
+
"associates_page_url": "https://affiliate.amazon.co.jp/"
|
165 |
+
},
|
166 |
+
"strings": {
|
167 |
+
"price": "Price",
|
168 |
+
"strike_price_string": "Was",
|
169 |
+
"products_from_amazon": "Products from Amazon.co.jp",
|
170 |
+
"check_on_amazon": "Check on Amazon",
|
171 |
+
"out_of_stock": "Out of stock"
|
172 |
+
}
|
173 |
+
},
|
174 |
+
"MX": {
|
175 |
+
"impression_recorder_service": {
|
176 |
+
"endpoint": "ir-mx.amazon-adsystem.com",
|
177 |
+
"org_unit_id": 34
|
178 |
+
},
|
179 |
+
"about_page": {
|
180 |
+
"display_name": "Mexico",
|
181 |
+
"associates_page_url": "https://afiliados.amazon.com.mx/"
|
182 |
+
},
|
183 |
+
"strings": {
|
184 |
+
"price": "Price",
|
185 |
+
"strike_price_string": "Was",
|
186 |
+
"products_from_amazon": "Products from Amazon.com.mx",
|
187 |
+
"check_on_amazon": "Check on Amazon",
|
188 |
+
"out_of_stock": "Out of stock"
|
189 |
+
}
|
190 |
+
},
|
191 |
+
"UK": {
|
192 |
+
"impression_recorder_service": {
|
193 |
+
"endpoint": "ir-uk.amazon-adsystem.com",
|
194 |
+
"org_unit_id": 2
|
195 |
+
},
|
196 |
+
"about_page": {
|
197 |
+
"display_name": "United Kingdom",
|
198 |
+
"associates_page_url": "https://affiliate-program.amazon.co.uk/"
|
199 |
+
},
|
200 |
+
"strings": {
|
201 |
+
"price": "Price",
|
202 |
+
"strike_price_string": "Was",
|
203 |
+
"products_from_amazon": "Products from Amazon.co.uk",
|
204 |
+
"check_on_amazon": "Check on Amazon",
|
205 |
+
"out_of_stock": "Out of stock"
|
206 |
+
}
|
207 |
+
},
|
208 |
+
"US": {
|
209 |
+
"impression_recorder_service": {
|
210 |
+
"endpoint": "ir-na.amazon-adsystem.com",
|
211 |
+
"org_unit_id": 1
|
212 |
+
},
|
213 |
+
"about_page": {
|
214 |
+
"display_name": "United States",
|
215 |
+
"associates_page_url": "https://affiliate-program.amazon.com/"
|
216 |
+
},
|
217 |
+
"strings": {
|
218 |
+
"price": "Price",
|
219 |
+
"strike_price_string": "Was",
|
220 |
+
"products_from_amazon": "Products from Amazon.com",
|
221 |
+
"check_on_amazon": "Check on Amazon",
|
222 |
+
"out_of_stock": "Out of stock"
|
223 |
+
}
|
224 |
+
}
|
225 |
+
}
|
226 |
+
}
|
227 |
+
}
|
constants/db_constants.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
|
5 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
7 |
+
A copy of the License is located in the "license" file accompanying this file.
|
8 |
+
|
9 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
+
either express or implied. See the License for the specific language governing permissions
|
11 |
+
and limitations under the License.
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace AmazonAssociatesLinkBuilder\constants;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Class for Holding Database key names. All key names have aalb_ as prefix to avoid name-conflict in common MySQL table
|
18 |
+
* ToDo: Replace get_option by a db wrapper which also appends 'aalb_' to the key name so that we need not to maintain it here.
|
19 |
+
*
|
20 |
+
* @since 1.8.0
|
21 |
+
* @package AmazonAssociatesLinkBuilder
|
22 |
+
* @subpackage AmazonAssociatesLinkBuilder/constants
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Db_Constants {
|
26 |
+
const TEMPLATE_NAMES = 'aalb_template_names';
|
27 |
+
const MARKETPLACE_NAMES = 'aalb_marketplace_names';
|
28 |
+
const DEFAULT_TEMPLATE = 'aalb_default_template';
|
29 |
+
const DEFAULT_STORE_ID = 'aalb_default_store_id';
|
30 |
+
const DEFAULT_MARKETPLACE = 'aalb_default_marketplace';
|
31 |
+
const AWS_ACCESS_KEY = 'aalb_aws_access_key';
|
32 |
+
const AWS_SECRET_KEY = 'aalb_aws_secret_key';
|
33 |
+
const CRED_CONFIG_GROUP = 'aalb_cred_config_group';
|
34 |
+
const STORE_ID_NAMES = 'aalb_store_id_names';
|
35 |
+
const STORE_IDS = 'aalb_store_ids';
|
36 |
+
const CUSTOM_UPLOAD_PATH = 'aalb_custom_upload_path';
|
37 |
+
const MAXMIND_DB_LAST_UPLOAD_PATH = 'aalb_maxmind_db_last_upload_path';
|
38 |
+
const SHOW_HTTP_WARNING_ONCE = 'aalb_show_http_warning_once';
|
39 |
+
const PLUGIN_VERSION = 'aalb_plugin_version';
|
40 |
+
const NO_REFERRER_DISABLED = 'aalb_no_referrer_disabled';
|
41 |
+
const GEOLITE_DB_DOWNLOAD_NEXT_RETRY_TIME = 'aalb_geolite_db_download_next_retry_time';
|
42 |
+
const GEOLITE_DB_DOWNLOAD_RETRY_ON_FAILURE_DURATION = 'aalb_geolite_db_download_retry_on_failure_duration';
|
43 |
+
const GEOLITE_DB_DOWNLOAD_FAILED_ATTEMPTS = 'aalb_geolite_db_download_failed_attempts';
|
44 |
+
|
45 |
+
//Defaults in case DB doesn't contain them.
|
46 |
+
const DEFAULT_TEMPLATE_NAME = 'ProductCarousel';
|
47 |
+
const DEFAULT_MARKETPLACE_NAME = 'US';
|
48 |
+
const DEFAULT_STORE_ID_NAME = 'not-specified';
|
49 |
+
}
|
50 |
+
|
51 |
+
?>
|
constants/http_constants.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
|
5 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
7 |
+
A copy of the License is located in the "license" file accompanying this file.
|
8 |
+
|
9 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
+
either express or implied. See the License for the specific language governing permissions
|
11 |
+
and limitations under the License.
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace AmazonAssociatesLinkBuilder\constants;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Class for Holding HTTP Constants
|
18 |
+
*
|
19 |
+
* @since 1.8.0
|
20 |
+
* @package AmazonAssociatesLinkBuilder
|
21 |
+
* @subpackage AmazonAssociatesLinkBuilder/constants
|
22 |
+
*/
|
23 |
+
|
24 |
+
class HTTP_Constants {
|
25 |
+
//HTTP Status Codes
|
26 |
+
const SUCCESS = '200';
|
27 |
+
const BAD_REQUEST = '400';
|
28 |
+
const REQUEST_URI_TOO_LONG = '414';
|
29 |
+
const FORBIDDEN = '403';
|
30 |
+
const INTERNAL_SERVER_ERROR = '500';
|
31 |
+
const THROTTLE = '503';
|
32 |
+
const TIME_OUT = '504';
|
33 |
+
|
34 |
+
const CURL_ERROR_TIMEOUT_STRING = 'cURL error 28';
|
35 |
+
}
|
constants/library_endpoints.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
|
5 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
7 |
+
A copy of the License is located in the "license" file accompanying this file.
|
8 |
+
|
9 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
+
either express or implied. See the License for the specific language governing permissions
|
11 |
+
and limitations under the License.
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace AmazonAssociatesLinkBuilder\constants;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Class for Holding Endpoints for third-party libraries hosted at our CDN or third-party URLs.
|
18 |
+
*
|
19 |
+
* @since 1.8.0
|
20 |
+
* @package AmazonAssociatesLinkBuilder
|
21 |
+
* @subpackage AmazonAssociatesLinkBuilder/constants
|
22 |
+
*/
|
23 |
+
|
24 |
+
class Library_Endpoints {
|
25 |
+
//External Scripts
|
26 |
+
const HANDLEBARS_JS = 'https://d8fd03967nrad.cloudfront.net/libs/handlebars.js/4.0.5/handlebars.min.js';
|
27 |
+
const CODEMIRROR_JS = 'https://d8fd03967nrad.cloudfront.net/libs/codemirror/5.13.2/codemirror.min.js';
|
28 |
+
const CODEMIRROR_MODE_XML_JS = 'https://d8fd03967nrad.cloudfront.net/libs/codemirror/5.13.2/mode/xml/xml.min.js';
|
29 |
+
const CODEMIRROR_MODE_CSS_JS = 'https://d8fd03967nrad.cloudfront.net/libs/codemirror/5.13.2/mode/css/css.min.js';
|
30 |
+
|
31 |
+
//External Styles
|
32 |
+
const CODEMIRROR_CSS = 'https://d8fd03967nrad.cloudfront.net/libs/codemirror/5.13.2/codemirror.min.css';
|
33 |
+
const FONT_AWESOME_CSS = 'https://d8fd03967nrad.cloudfront.net/libs/font-awesome/4.5.0/css/font-awesome.min.css';
|
34 |
+
const JQUERY_UI_CSS = 'https://d8fd03967nrad.cloudfront.net/libs/jQueryUI/1.12.1/themes/ui-lightness/jquery-ui.css';
|
35 |
+
|
36 |
+
//Maxmind GeoLite2Country DB Download URL
|
37 |
+
const GEOLITE_COUNTRY_DB_DOWNLOAD_URL = 'https://d8fd03967nrad.cloudfront.net/libs/geoip/database/GeoLite2-Country.mmdb.gz';
|
38 |
+
const GEOLITE_DB_DOWNLOAD_URL_FROM_MAXMIND_SERVER = 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz';
|
39 |
+
const GEOLITE_COUNTRY_DB_DETAILS_URL = 'https://dev.maxmind.com/geoip/geoip2/geolite2/';
|
40 |
+
|
41 |
+
//Tracking API Endpoint
|
42 |
+
const TRACKING_API_ENDPOINT = 'https://rx5hfxbp45.execute-api.us-east-1.amazonaws.com/aalb/';
|
43 |
+
const TRACKING_API_SOURCE_TOOL_QUERY_PARAM = 'source-tool=aalb';
|
44 |
+
const TRACKING_API_ACCESS_KEY_QUERY_PARAM = 'aws-access-key-id=';
|
45 |
+
}
|
constants/paapi_constants.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
|
5 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
7 |
+
A copy of the License is located in the "license" file accompanying this file.
|
8 |
+
|
9 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
+
either express or implied. See the License for the specific language governing permissions
|
11 |
+
and limitations under the License.
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace AmazonAssociatesLinkBuilder\constants;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Class for Holding Paapi Constants
|
18 |
+
*
|
19 |
+
* @since 1.8.0
|
20 |
+
* @package AmazonAssociatesLinkBuilder
|
21 |
+
* @subpackage AmazonAssociatesLinkBuilder/constants
|
22 |
+
*/
|
23 |
+
|
24 |
+
class Paapi_Constants {
|
25 |
+
const URI = '/onca/xml';
|
26 |
+
const TRANSFER_PROTOCOL = 'https://';
|
27 |
+
const URL_QUERY_SEPARATOR = '?';
|
28 |
+
const SERVICE = 'AWSECommerceService';
|
29 |
+
const VERSION = '2013-08-01';
|
30 |
+
const INVALID_PARAMETER_VALUE_ERROR = 'AWS.InvalidParameterValue';
|
31 |
+
|
32 |
+
// PAAPI Request Timeout in seconds
|
33 |
+
const REQUEST_TIMEOUT = 35;
|
34 |
+
|
35 |
+
const MARKETPLACES_URL = 'https://webservices.amazon.com/scratchpad/assets/config/config.json';
|
36 |
+
const SIGN_UP_URL = 'http://docs.aws.amazon.com/AWSECommerceService/latest/DG/becomingDev.html';
|
37 |
+
const MANAGE_US_ACCOUNT_URL = 'https://affiliate-program.amazon.com/gp/advertising/api/detail/your-account.html';
|
38 |
+
const EFFICIENCY_GUIDELINES_URL = 'http://docs.aws.amazon.com/AWSECommerceService/latest/DG/TroubleshootingApplications.html#efficiency-guidelines';
|
39 |
+
}
|
40 |
+
|
41 |
+
?>
|
constants/plugin_constants.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
+
|
6 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
8 |
+
A copy of the License is located in the "license" file accompanying this file.
|
9 |
+
|
10 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
11 |
+
either express or implied. See the License for the specific language governing permissions
|
12 |
+
and limitations under the License.
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace AmazonAssociatesLinkBuilder\constants;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Class for Holding Plugin Constants
|
19 |
+
*
|
20 |
+
* @since 1.8.0
|
21 |
+
* @package AmazonAssociatesLinkBuilder
|
22 |
+
* @subpackage AmazonAssociatesLinkBuilder/constants
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Plugin_Constants {
|
26 |
+
const PLUGIN_CURRENT_VERSION = '1.8.0';
|
27 |
+
//Version no. with multi locale settings page
|
28 |
+
const MULTI_LOCALE_SETTINGS_PLUGIN_VERSION = '1.4.12';
|
29 |
+
const WORDPRESS_REQUEST_TIMEOUT_IN_MS = 40000;
|
30 |
+
|
31 |
+
//Support Email-Id
|
32 |
+
const SUPPORT_EMAIL_ID = 'link-builder@amazon.com';
|
33 |
+
|
34 |
+
const NEWLINE_SEPARATOR = "\r\n";
|
35 |
+
const GEO_TARGETED_LINKS_DELIMITER = "|";
|
36 |
+
|
37 |
+
//LinkCodes
|
38 |
+
const DEFAULT_LINK_CODE = "alb";
|
39 |
+
const GEO_TARGETED_LINKS_DEFAULT_COUNTRY_LINK_CODE = "al0";
|
40 |
+
const GEO_TARGETED_LINKS_REDIRECTED_COUNTRY_LINK_CODE = "al1";
|
41 |
+
const MAXMIND_DATA_FILENAME = 'GeoLite2-Country.mmdb';
|
42 |
+
|
43 |
+
//Cipher
|
44 |
+
//Make a key of length 32 byte.
|
45 |
+
//Specify your unique encryption key here.
|
46 |
+
const ENCRYPTION_KEY = 'put your unique phrase here';
|
47 |
+
//Make IV of 16 bytes
|
48 |
+
const ENCRYPTION_IV = "0123456789ABCDEF";
|
49 |
+
//Algorithm to use
|
50 |
+
const ENCRYPTION_ALGORITHM = "aes-256-cbc";
|
51 |
+
//Masking constant
|
52 |
+
const AWS_SECRET_KEY_MASK = '••••••••••••••••••••••••••••••••••••••••';
|
53 |
+
|
54 |
+
const SUCCESS = "SUCCESS";
|
55 |
+
const FAIL = "FAIL";
|
56 |
+
|
57 |
+
const UPLOADS_FOLDER = 'amazon-associates-link-builder/';
|
58 |
+
|
59 |
+
//Search result items. Paapi returns 10 items by default.
|
60 |
+
const MAX_SEARCH_RESULT_ITEMS = 9;
|
61 |
+
|
62 |
+
//Shortcodes supported
|
63 |
+
const SHORTCODE_AMAZON_LINK = 'amazon_link';
|
64 |
+
const SHORTCODE_AMAZON_TEXT = 'amazon_textlink';
|
65 |
+
|
66 |
+
//List of Default Amazon Template names
|
67 |
+
const AMAZON_TEMPLATE_NAMES = 'ProductCarousel,ProductGrid,ProductAd,PriceLink,ProductLink';
|
68 |
+
|
69 |
+
//Impression Recording Keys
|
70 |
+
const IMPRESSION_RECORDER_SERVICE_KEY = 'impression_recorder_service';
|
71 |
+
const ENDPOINT_KEY = 'endpoint';
|
72 |
+
const ORG_UNIT_ID_KEY = 'org_unit_id';
|
73 |
+
}
|
constants/plugin_urls.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
|
5 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
7 |
+
A copy of the License is located in the "license" file accompanying this file.
|
8 |
+
|
9 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
+
either express or implied. See the License for the specific language governing permissions
|
11 |
+
and limitations under the License.
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace AmazonAssociatesLinkBuilder\constants;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Class for Holding Plugin URLs
|
18 |
+
*
|
19 |
+
* @since 1.8.0
|
20 |
+
* @package AmazonAssociatesLinkBuilder
|
21 |
+
* @subpackage AmazonAssociatesLinkBuilder/constants
|
22 |
+
*/
|
23 |
+
class Plugin_Urls {
|
24 |
+
//Plugin Specific URLs
|
25 |
+
const CONDITIONS_OF_USE_URL = 'https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-ConditionsOfUse-2017-01-17.pdf';
|
26 |
+
const USER_GUIDE_URL = 'https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-UserGuide.pdf';
|
27 |
+
const SUPPORT_FORUM_URL = 'https://wordpress.org/support/plugin/amazon-associates-link-builder';
|
28 |
+
|
29 |
+
//Associate URLs
|
30 |
+
const GETTING_STARTED_URL = 'http://docs.aws.amazon.com/AWSECommerceService/latest/DG/CHAP_GettingStarted.html';
|
31 |
+
const AFFILIATE_WEBSITE_URL = 'https://affiliate-program.amazon.com';
|
32 |
+
const ADDING_SECONDARY_USER_AC_URL = 'https://affiliate-program.amazon.com/help/node/topic/202049770';
|
33 |
+
const ASSOCIATE_SIGN_UP_URL = 'http://docs.aws.amazon.com/AWSECommerceService/latest/DG/becomingAssociate.html';
|
34 |
+
const NEW_PAGE_TARGET = "_blank";
|
35 |
+
}
|
constants/xml_constants.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
|
5 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
7 |
+
A copy of the License is located in the "license" file accompanying this file.
|
8 |
+
|
9 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
+
either express or implied. See the License for the specific language governing permissions
|
11 |
+
and limitations under the License.
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace AmazonAssociatesLinkBuilder\constants;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Class for Holding XML Constants
|
18 |
+
*
|
19 |
+
* @since 1.8.0
|
20 |
+
* @package AmazonAssociatesLinkBuilder
|
21 |
+
* @subpackage AmazonAssociatesLinkBuilder/constants
|
22 |
+
*/
|
23 |
+
class XML_Constants {
|
24 |
+
const ASIN = 'ASIN';
|
25 |
+
const TITLE = 'Title';
|
26 |
+
const DETAIL_PAGE_URL = 'DetailPageURL';
|
27 |
+
const BY = 'By';
|
28 |
+
const PRIME = 'Prime';
|
29 |
+
const MERCHANT = 'Merchant';
|
30 |
+
const LARGE_IMAGE_URL = 'LargeImageURL';
|
31 |
+
const MEDIUM_IMAGE_URL = 'MediumImageURL';
|
32 |
+
const SMALL_IMAGE_URL = 'SmallImageURL';
|
33 |
+
|
34 |
+
//Price Realted Keys
|
35 |
+
const SAVING = 'Saving';
|
36 |
+
const SAVING_VALUE = 'SavingValue';
|
37 |
+
const SAVING_PERCENT = 'SavingPercent';
|
38 |
+
const MINIMUM_PRICE = 'MinimumPrice';
|
39 |
+
const MINIMUM_PRICE_VALUE = 'MinimumPriceValue';
|
40 |
+
const CURRENT_PRICE = 'CurrentPrice';
|
41 |
+
const CURRENT_PRICE_VALUE = 'CurrentPriceValue';
|
42 |
+
const STRIKE_PRICE = 'StrikePrice';
|
43 |
+
const STRIKE_PRICE_VALUE = 'StrikePriceValue';
|
44 |
+
const IN_STOCK = 'InStock';
|
45 |
+
//Labels
|
46 |
+
const PRICE_LABEL = 'PriceLabel';
|
47 |
+
const STRIKE_PRICE_LABEL = 'StrikePriceLabel';
|
48 |
+
const PRODUCTS_FROM_AMAZON_LABEL = 'ProductsFromAmazonLabel';
|
49 |
+
//Translation keys
|
50 |
+
const CHECK_ON_AMAZON = 'check_on_amazon';
|
51 |
+
const OUT_OF_STOCK = 'out_of_stock';
|
52 |
+
const PRICE = 'price';
|
53 |
+
const STRIKE_PRICE_STRING = 'strike_price_string';
|
54 |
+
const PRODUCTS_FROM_AMAZON = 'products_from_amazon';
|
55 |
+
//Array Keys
|
56 |
+
const SAVINGS_INFO = 'savings_info';
|
57 |
+
const MIN_PRICE_INFO = 'min_price_info';
|
58 |
+
const STRINGS = 'strings';
|
59 |
+
|
60 |
+
const PA_API_LOW_PRICE = 'too low to display';
|
61 |
+
const IN_STOCK_KEY_VALUE = 'Yes True';
|
62 |
+
const OUT_OF_STOCK_VALUE = 'Out of Stock';
|
63 |
+
}
|
64 |
+
|
65 |
+
?>
|
{admin/css → css}/aalb_admin.css
RENAMED
File without changes
|
{admin/css → css}/aalb_credentials.css
RENAMED
File without changes
|
exceptions/invalid_marketplace_exception.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace AmazonAssociatesLinkBuilder\exceptions;
|
4 |
+
/*
|
5 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
6 |
+
|
7 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
8 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
9 |
+
A copy of the License is located in the "license" file accompanying this file.
|
10 |
+
|
11 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
12 |
+
either express or implied. See the License for the specific language governing permissions
|
13 |
+
and limitations under the License.
|
14 |
+
*/
|
15 |
+
|
16 |
+
/**
|
17 |
+
*
|
18 |
+
* Exception for Invalid Marketplace passed
|
19 |
+
*
|
20 |
+
* @since 1.8.0
|
21 |
+
* @package AmazonAssociatesLinkBuilder
|
22 |
+
* @subpackage AmazonAssociatesLinkBuilder/exceptions
|
23 |
+
*/
|
24 |
+
class Invalid_Marketplace_Exception extends \Exception {
|
25 |
+
public function errorMessage() {
|
26 |
+
return 'Error on line ' . $this->getLine() . ' in ' . $this->getFile() . ':' . $this->getMessage();
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
?>
|
exceptions/network_call_failure_exception.php
CHANGED
@@ -12,6 +12,7 @@ either express or implied. See the License for the specific language governing p
|
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
|
|
15 |
/**
|
16 |
*
|
17 |
* Custom Exception for Network Call failures
|
@@ -20,8 +21,8 @@ and limitations under the License.
|
|
20 |
* @package AmazonAssociatesLinkBuilder
|
21 |
* @subpackage AmazonAssociatesLinkBuilder/exceptions
|
22 |
*/
|
23 |
-
class Network_Call_Failure_Exception extends Exception {
|
24 |
public function errorMessage() {
|
25 |
-
return 'Network call Error on line '
|
26 |
}
|
27 |
}
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
15 |
+
namespace AmazonAssociatesLinkBuilder\exceptions;
|
16 |
/**
|
17 |
*
|
18 |
* Custom Exception for Network Call failures
|
21 |
* @package AmazonAssociatesLinkBuilder
|
22 |
* @subpackage AmazonAssociatesLinkBuilder/exceptions
|
23 |
*/
|
24 |
+
class Network_Call_Failure_Exception extends \Exception {
|
25 |
public function errorMessage() {
|
26 |
+
return 'Network call Error on line ' . $this->getLine() . ' in ' . $this->getFile() . ':' . $this->getMessage();
|
27 |
}
|
28 |
}
|
exceptions/unexpected_network_response_exception.php
CHANGED
@@ -12,6 +12,7 @@ either express or implied. See the License for the specific language governing p
|
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
|
|
15 |
/**
|
16 |
*
|
17 |
* Custom Exception for Unexpected Network Response
|
@@ -20,8 +21,8 @@ and limitations under the License.
|
|
20 |
* @package AmazonAssociatesLinkBuilder
|
21 |
* @subpackage AmazonAssociatesLinkBuilder/exceptions
|
22 |
*/
|
23 |
-
class Unexpected_Network_Response_Exception extends Exception {
|
24 |
public function errorMessage() {
|
25 |
-
return 'Unxpected Response Error on line '
|
26 |
}
|
27 |
}
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
15 |
+
namespace AmazonAssociatesLinkBuilder\exceptions;
|
16 |
/**
|
17 |
*
|
18 |
* Custom Exception for Unexpected Network Response
|
21 |
* @package AmazonAssociatesLinkBuilder
|
22 |
* @subpackage AmazonAssociatesLinkBuilder/exceptions
|
23 |
*/
|
24 |
+
class Unexpected_Network_Response_Exception extends \Exception {
|
25 |
public function errorMessage() {
|
26 |
+
return 'Unxpected Response Error on line ' . $this->getLine() . ' in ' . $this->getFile() . ':' . $this->getMessage();
|
27 |
}
|
28 |
}
|
{includes → helper}/aalb_compatibility_helper.php
RENAMED
@@ -55,7 +55,7 @@ class Aalb_Compatibility_Helper {
|
|
55 |
*/
|
56 |
public function incompatible_environment_message() {
|
57 |
printf( "<div class=\"notice notice-error\">
|
58 |
-
<h3>Amazon Associates Link Builder Plugin
|
59 |
<p><span style=\"color:red;\">%s plugin requires PHP Version %s or higher. You’re still on %s.</span>
|
60 |
</p></div>", AALB_PLUGIN_NAME, AALB_PLUGIN_MINIMUM_SUPPORTED_PHP_VERSION, phpversion() );
|
61 |
}
|
@@ -65,15 +65,18 @@ class Aalb_Compatibility_Helper {
|
|
65 |
*
|
66 |
* @since 1.4.3
|
67 |
*/
|
68 |
-
public function
|
|
|
|
|
|
|
|
|
69 |
$plugin = plugin_basename( AALB_PLUGIN_DIR . 'amazon-associates-link-builder.php' );
|
70 |
deactivate_plugins( $plugin );
|
71 |
//Remove action_links from admin page present below the plugin
|
72 |
-
remove_filter( 'plugin_action_links_' . $plugin, '
|
73 |
-
$
|
74 |
-
$aalb_admin_notice_manager->remove_all_notices();
|
75 |
-
$aalb_admin_notice_manager->add_notice( $this, 'incompatible_environment_message' );
|
76 |
}
|
|
|
77 |
}
|
78 |
|
79 |
?>
|
55 |
*/
|
56 |
public function incompatible_environment_message() {
|
57 |
printf( "<div class=\"notice notice-error\">
|
58 |
+
<h3>Amazon Associates Link Builder Plugin Not Activated!</h3>
|
59 |
<p><span style=\"color:red;\">%s plugin requires PHP Version %s or higher. You’re still on %s.</span>
|
60 |
</p></div>", AALB_PLUGIN_NAME, AALB_PLUGIN_MINIMUM_SUPPORTED_PHP_VERSION, phpversion() );
|
61 |
}
|
65 |
*
|
66 |
* @since 1.4.3
|
67 |
*/
|
68 |
+
public function deactivate() {
|
69 |
+
//To remove the "Plugin Activated" Admin Notice
|
70 |
+
unset( $_GET['activate'] );
|
71 |
+
|
72 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
73 |
$plugin = plugin_basename( AALB_PLUGIN_DIR . 'amazon-associates-link-builder.php' );
|
74 |
deactivate_plugins( $plugin );
|
75 |
//Remove action_links from admin page present below the plugin
|
76 |
+
remove_filter( 'plugin_action_links_' . $plugin, 'add_action_links' );
|
77 |
+
add_action( 'all_admin_notices', array( $this, 'incompatible_environment_message' ) );
|
|
|
|
|
78 |
}
|
79 |
+
|
80 |
}
|
81 |
|
82 |
?>
|
admin/sidebar/partials/helper/aalb_credentials_helper.php → helper/credentials_helper.php
RENAMED
@@ -12,6 +12,16 @@ either express or implied. See the License for the specific language governing p
|
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
/**
|
16 |
* Helper class for commonly used functions in the credentials page of plugin.
|
17 |
*
|
@@ -19,7 +29,7 @@ and limitations under the License.
|
|
19 |
* @package AmazonAssociatesLinkBuilder
|
20 |
* @subpackage AmazonAssociatesLinkBuilder/admin/sidebar/partials/helper
|
21 |
*/
|
22 |
-
class
|
23 |
|
24 |
/**
|
25 |
* Returns data to be localized in the script.
|
@@ -30,13 +40,13 @@ class Aalb_Credentials_Helper {
|
|
30 |
*/
|
31 |
private function credentials_data() {
|
32 |
return array(
|
33 |
-
'old_store_id_db_key' =>
|
34 |
-
'new_store_id_db_key' =>
|
35 |
-
'new_store_ids' => get_option(
|
36 |
-
'default_marketplace_db_key' =>
|
37 |
-
'default_marketplace_value' => get_option(
|
38 |
'marketplace_list' => $this->get_marketplace_list(),
|
39 |
-
'default_store_id_db_key' =>
|
40 |
|
41 |
);
|
42 |
}
|
@@ -64,6 +74,7 @@ class Aalb_Credentials_Helper {
|
|
64 |
"marketplace_not_set_error" => esc_html__( "ERROR: A marketplace is present that has not been set. Please set that first.", 'amazon-associates-link-builder' ),
|
65 |
"remove_last_marketplace_error" => esc_html__( "ERROR: You need to maintain at least one marketplace entry for tracking ids ", 'amazon-associates-link-builder' ),
|
66 |
"no_marketplace_row_error" => esc_html__( "ERROR: You need to add at least one marketplace entry for tracking ids ", 'amazon-associates-link-builder' ),
|
|
|
67 |
"marketplace_settings_info_message" => esc_html__( "Add a Marketplace that you want to create Amazon links to.", 'amazon-associates-link-builder' ),
|
68 |
"tracking_id_settings_info_message" => esc_html__( "For each marketplace you can add multiple tracking ids, separated by commas. The first tracking id will be considered as default tracking id for that marketplace.", 'amazon-associates-link-builder' )
|
69 |
);
|
@@ -77,7 +88,7 @@ class Aalb_Credentials_Helper {
|
|
77 |
*/
|
78 |
public function aalb_credentials_enqueue_style() {
|
79 |
wp_enqueue_style( 'thickbox' );
|
80 |
-
wp_enqueue_style( 'aalb_credentials_css', AALB_CREDENTIALS_CSS, array(),
|
81 |
}
|
82 |
|
83 |
/**
|
@@ -89,8 +100,8 @@ class Aalb_Credentials_Helper {
|
|
89 |
public function aalb_credentials_enqueue_script() {
|
90 |
wp_enqueue_script( 'jquery' );
|
91 |
wp_enqueue_script( 'thickbox' );
|
92 |
-
wp_enqueue_script( 'handlebars_js', HANDLEBARS_JS );
|
93 |
-
wp_enqueue_script( 'aalb_credentials_js', AALB_CREDENTIALS_JS, array( 'jquery', 'thickbox', 'handlebars_js' ),
|
94 |
wp_localize_script( 'aalb_credentials_js', 'aalb_cred_data', $this->credentials_data() );
|
95 |
wp_localize_script( 'aalb_credentials_js', 'aalb_cred_strings', $this->credentials_strings() );
|
96 |
}
|
@@ -103,7 +114,7 @@ class Aalb_Credentials_Helper {
|
|
103 |
* @return array marketplaces list
|
104 |
*/
|
105 |
private function get_marketplace_list() {
|
106 |
-
$config_loader = new
|
107 |
$aalb_marketplace_names = $config_loader->fetch_marketplaces();
|
108 |
|
109 |
return json_encode( array_values( $aalb_marketplace_names ) );
|
@@ -117,13 +128,13 @@ class Aalb_Credentials_Helper {
|
|
117 |
public function handle_error_notices() {
|
118 |
try {
|
119 |
if ( $this->is_more_than_one_marketplaces_configured() ) {
|
120 |
-
$maxmind_db_manager = new
|
121 |
$error_msg = $maxmind_db_manager->get_error_message();
|
122 |
if ( ! empty( $error_msg ) ) {
|
123 |
aalb_error_notice( $error_msg );
|
124 |
}
|
125 |
}
|
126 |
-
} catch ( Exception $e ) {
|
127 |
error_log( "Aalb_credentials_Helper::handle_error_notices:Unknown error:" . $e->getMessage() );
|
128 |
}
|
129 |
}
|
@@ -136,7 +147,7 @@ class Aalb_Credentials_Helper {
|
|
136 |
* @return bool True if more than one marketplaces configured in settings
|
137 |
*/
|
138 |
private function is_more_than_one_marketplaces_configured() {
|
139 |
-
return count( json_decode( get_option(
|
140 |
}
|
141 |
}
|
142 |
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
15 |
+
namespace AmazonAssociatesLinkBuilder\helper;
|
16 |
+
|
17 |
+
use AmazonAssociatesLinkBuilder\configuration\Config_Loader;
|
18 |
+
use AmazonAssociatesLinkBuilder\constants\Library_Endpoints;
|
19 |
+
use AmazonAssociatesLinkBuilder\ip2Country\Maxmind_Db_Manager;
|
20 |
+
use AmazonAssociatesLinkBuilder\io\Curl_Request;
|
21 |
+
use AmazonAssociatesLinkBuilder\io\File_System_Helper;
|
22 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
23 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
24 |
+
|
25 |
/**
|
26 |
* Helper class for commonly used functions in the credentials page of plugin.
|
27 |
*
|
29 |
* @package AmazonAssociatesLinkBuilder
|
30 |
* @subpackage AmazonAssociatesLinkBuilder/admin/sidebar/partials/helper
|
31 |
*/
|
32 |
+
class Credentials_Helper {
|
33 |
|
34 |
/**
|
35 |
* Returns data to be localized in the script.
|
40 |
*/
|
41 |
private function credentials_data() {
|
42 |
return array(
|
43 |
+
'old_store_id_db_key' => Db_Constants::STORE_ID_NAMES,
|
44 |
+
'new_store_id_db_key' => Db_Constants::STORE_IDS,
|
45 |
+
'new_store_ids' => get_option( Db_Constants::STORE_IDS ),
|
46 |
+
'default_marketplace_db_key' => Db_Constants::DEFAULT_MARKETPLACE,
|
47 |
+
'default_marketplace_value' => get_option( Db_Constants::DEFAULT_MARKETPLACE ),
|
48 |
'marketplace_list' => $this->get_marketplace_list(),
|
49 |
+
'default_store_id_db_key' => Db_Constants::DEFAULT_STORE_ID
|
50 |
|
51 |
);
|
52 |
}
|
74 |
"marketplace_not_set_error" => esc_html__( "ERROR: A marketplace is present that has not been set. Please set that first.", 'amazon-associates-link-builder' ),
|
75 |
"remove_last_marketplace_error" => esc_html__( "ERROR: You need to maintain at least one marketplace entry for tracking ids ", 'amazon-associates-link-builder' ),
|
76 |
"no_marketplace_row_error" => esc_html__( "ERROR: You need to add at least one marketplace entry for tracking ids ", 'amazon-associates-link-builder' ),
|
77 |
+
"marketplace_list_empty_error" => esc_html__( "ERROR: No marketplace is available for selection. This may be due to blocked call by your hosting provider or firewall settings to fetch marketplace details from webservices.amazon.com", 'amazon-associates-link-builder' ),
|
78 |
"marketplace_settings_info_message" => esc_html__( "Add a Marketplace that you want to create Amazon links to.", 'amazon-associates-link-builder' ),
|
79 |
"tracking_id_settings_info_message" => esc_html__( "For each marketplace you can add multiple tracking ids, separated by commas. The first tracking id will be considered as default tracking id for that marketplace.", 'amazon-associates-link-builder' )
|
80 |
);
|
88 |
*/
|
89 |
public function aalb_credentials_enqueue_style() {
|
90 |
wp_enqueue_style( 'thickbox' );
|
91 |
+
wp_enqueue_style( 'aalb_credentials_css', AALB_CREDENTIALS_CSS, array(), Plugin_Constants::PLUGIN_CURRENT_VERSION );
|
92 |
}
|
93 |
|
94 |
/**
|
100 |
public function aalb_credentials_enqueue_script() {
|
101 |
wp_enqueue_script( 'jquery' );
|
102 |
wp_enqueue_script( 'thickbox' );
|
103 |
+
wp_enqueue_script( 'handlebars_js', Library_Endpoints::HANDLEBARS_JS );
|
104 |
+
wp_enqueue_script( 'aalb_credentials_js', AALB_CREDENTIALS_JS, array( 'jquery', 'thickbox', 'handlebars_js' ), Plugin_Constants::PLUGIN_CURRENT_VERSION );
|
105 |
wp_localize_script( 'aalb_credentials_js', 'aalb_cred_data', $this->credentials_data() );
|
106 |
wp_localize_script( 'aalb_credentials_js', 'aalb_cred_strings', $this->credentials_strings() );
|
107 |
}
|
114 |
* @return array marketplaces list
|
115 |
*/
|
116 |
private function get_marketplace_list() {
|
117 |
+
$config_loader = new Config_Loader();
|
118 |
$aalb_marketplace_names = $config_loader->fetch_marketplaces();
|
119 |
|
120 |
return json_encode( array_values( $aalb_marketplace_names ) );
|
128 |
public function handle_error_notices() {
|
129 |
try {
|
130 |
if ( $this->is_more_than_one_marketplaces_configured() ) {
|
131 |
+
$maxmind_db_manager = new Maxmind_Db_Manager( get_option( Db_Constants::CUSTOM_UPLOAD_PATH ), new Curl_Request(), new File_System_Helper() );
|
132 |
$error_msg = $maxmind_db_manager->get_error_message();
|
133 |
if ( ! empty( $error_msg ) ) {
|
134 |
aalb_error_notice( $error_msg );
|
135 |
}
|
136 |
}
|
137 |
+
} catch ( \Exception $e ) {
|
138 |
error_log( "Aalb_credentials_Helper::handle_error_notices:Unknown error:" . $e->getMessage() );
|
139 |
}
|
140 |
}
|
147 |
* @return bool True if more than one marketplaces configured in settings
|
148 |
*/
|
149 |
private function is_more_than_one_marketplaces_configured() {
|
150 |
+
return count( json_decode( get_option( Db_Constants::STORE_IDS ), true ) ) > 1;
|
151 |
}
|
152 |
}
|
153 |
|
lib/php/Paapi/aalb_paapi_helper.php → helper/paapi_helper.php
RENAMED
@@ -11,6 +11,13 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* Helper class for Paapi
|
@@ -19,14 +26,14 @@ and limitations under the License.
|
|
19 |
* @package AmazonAssociatesLinkBuilder
|
20 |
* @subpackage AmazonAssociatesLinkBuilder/lib/php/Paapi
|
21 |
*/
|
22 |
-
class
|
23 |
|
24 |
/**
|
25 |
* Returns the item lookup URL for asins
|
26 |
*
|
27 |
-
* @param string $asin
|
28 |
* @param string $marketplaces Marketplace to search the products.
|
29 |
-
* @param string $tracking_id
|
30 |
*
|
31 |
* @return string Signed URL for item lookup.
|
32 |
*/
|
@@ -44,23 +51,23 @@ class Aalb_Paapi_Helper {
|
|
44 |
*
|
45 |
* @since 1.0.0
|
46 |
*
|
47 |
-
* @param array $params
|
48 |
* @param string $marketplace Marketplace to search the product.
|
49 |
*
|
50 |
* @return string Signed URL.
|
51 |
*/
|
52 |
function aws_signed_url( $params, $marketplace ) {
|
53 |
-
$access_key_id = openssl_decrypt( base64_decode( get_option(
|
54 |
-
$secret_key = openssl_decrypt( base64_decode( get_option(
|
55 |
$host = $marketplace;
|
56 |
|
57 |
$method = 'GET';
|
58 |
-
$uri =
|
59 |
|
60 |
-
$params["Service"] =
|
61 |
$params["AWSAccessKeyId"] = $access_key_id;
|
62 |
$params["Timestamp"] = gmdate( 'Y-m-d\TH:i:s\Z' );
|
63 |
-
$params["Version"] =
|
64 |
|
65 |
ksort( $params );
|
66 |
|
@@ -77,7 +84,7 @@ class Aalb_Paapi_Helper {
|
|
77 |
$signature = base64_encode( hash_hmac( "sha256", $string_to_sign, $secret_key, true ) );
|
78 |
$signature = str_replace( "%7E", "~", rawurlencode( $signature ) );
|
79 |
|
80 |
-
$signed_url =
|
81 |
|
82 |
return $signed_url;
|
83 |
}
|
@@ -86,8 +93,8 @@ class Aalb_Paapi_Helper {
|
|
86 |
* Returns the item search URL for search keywords
|
87 |
*
|
88 |
* @param string $search_keywords Search keywords of the products.
|
89 |
-
* @param string $marketplaces
|
90 |
-
* @param string $tracking_id
|
91 |
*
|
92 |
* @return string Signed URL for item search.
|
93 |
*/
|
@@ -109,29 +116,29 @@ class Aalb_Paapi_Helper {
|
|
109 |
*/
|
110 |
function get_error_message( $error ) {
|
111 |
switch ( $error ) {
|
112 |
-
case
|
113 |
/* translators: 1: URL of Associate sign-up page 2: _blank 3:URL of adding secondary user page 4: _blank */
|
114 |
-
return '<h4>' . sprintf( __( "Your AWS Access Key Id is not registered as an Amazon Associate. Please verify that you are <a href=%1s target=%2s>registered as an Amazon Associate</a> in respective locale and you added the email address registered for the Product Advertising API as a <a href=%3s target=%4s>secondary email address in your Amazon Associates account</a>.", 'amazon-associates-link-builder' ),
|
115 |
-
case
|
116 |
/* translators: 1: URL of PA-API sign-up page 2: _blank */
|
117 |
-
return '<h4>' . sprintf( __( "Your AccessKey Id is not registered for Product Advertising API. Please sign up for Product Advertising API by <a href=%1s target=%2s>following these guidelines</a>.", 'amazon-associates-link-builder' ),
|
118 |
-
case
|
119 |
-
return '<h4>' . sprintf( __( "Your AccessKey Id is not registered for Product Advertising API. Please sign up for Product Advertising API by <a href=%1s target=%2s>following these guidelines</a>.", 'amazon-associates-link-builder' ),
|
120 |
-
case
|
121 |
return '<h4>' . esc_html__( "Internal server error", 'amazon-associates-link-builder' ) . '</h4>';
|
122 |
-
case
|
123 |
/* translators: 1: URL of PA-API efficiency guidelines page 2: _blank */
|
124 |
-
return '<h4>' . sprintf( __( "You are submitting requests too quickly. Please retry your requests at a slower rate. For more information, see <a href=%1s target=%2s>Efficiency Guidelines</a>.", 'amazon-associates-link-builder' ),
|
125 |
-
case
|
126 |
/* translators: %s: Email-id of the support */
|
127 |
-
return '<h4>' . sprintf( __( "Request timed out. Try again after some time. Please check you network and firewall settings. If the error still persists, write to us at %s.", 'amazon-associates-link-builder' ),
|
128 |
default:
|
129 |
/**
|
130 |
* <h4> tag ensures that the message is treated as HTML element in jQuery.find in aalb_admin.js.
|
131 |
* Otherwise due to the error message string's characters like "!,:,etc", string is parsed as
|
132 |
* if it contains partial css classes and later given syntax error
|
133 |
-
|
134 |
-
return '<h4>'
|
135 |
}
|
136 |
}
|
137 |
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\helper;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
18 |
+
use AmazonAssociatesLinkBuilder\constants\Paapi_Constants;
|
19 |
+
use AmazonAssociatesLinkBuilder\constants\HTTP_Constants;
|
20 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Urls;
|
21 |
|
22 |
/**
|
23 |
* Helper class for Paapi
|
26 |
* @package AmazonAssociatesLinkBuilder
|
27 |
* @subpackage AmazonAssociatesLinkBuilder/lib/php/Paapi
|
28 |
*/
|
29 |
+
class Paapi_Helper {
|
30 |
|
31 |
/**
|
32 |
* Returns the item lookup URL for asins
|
33 |
*
|
34 |
+
* @param string $asin Asin value.
|
35 |
* @param string $marketplaces Marketplace to search the products.
|
36 |
+
* @param string $tracking_id Associate tag.
|
37 |
*
|
38 |
* @return string Signed URL for item lookup.
|
39 |
*/
|
51 |
*
|
52 |
* @since 1.0.0
|
53 |
*
|
54 |
+
* @param array $params Paapi parameters.
|
55 |
* @param string $marketplace Marketplace to search the product.
|
56 |
*
|
57 |
* @return string Signed URL.
|
58 |
*/
|
59 |
function aws_signed_url( $params, $marketplace ) {
|
60 |
+
$access_key_id = openssl_decrypt( base64_decode( get_option( Db_Constants::AWS_ACCESS_KEY ) ), Plugin_Constants::ENCRYPTION_ALGORITHM, Plugin_Constants::ENCRYPTION_KEY, 0, Plugin_Constants::ENCRYPTION_IV );
|
61 |
+
$secret_key = openssl_decrypt( base64_decode( get_option( Db_Constants::AWS_SECRET_KEY ) ), Plugin_Constants::ENCRYPTION_ALGORITHM, Plugin_Constants::ENCRYPTION_KEY, 0, Plugin_Constants::ENCRYPTION_IV );
|
62 |
$host = $marketplace;
|
63 |
|
64 |
$method = 'GET';
|
65 |
+
$uri = Paapi_Constants::URI;
|
66 |
|
67 |
+
$params["Service"] = Paapi_Constants::SERVICE;
|
68 |
$params["AWSAccessKeyId"] = $access_key_id;
|
69 |
$params["Timestamp"] = gmdate( 'Y-m-d\TH:i:s\Z' );
|
70 |
+
$params["Version"] = Paapi_Constants::VERSION;
|
71 |
|
72 |
ksort( $params );
|
73 |
|
84 |
$signature = base64_encode( hash_hmac( "sha256", $string_to_sign, $secret_key, true ) );
|
85 |
$signature = str_replace( "%7E", "~", rawurlencode( $signature ) );
|
86 |
|
87 |
+
$signed_url = Paapi_Constants::TRANSFER_PROTOCOL . $host . $uri . Paapi_Constants::URL_QUERY_SEPARATOR . $canonicalized_query . "&Signature=" . $signature;
|
88 |
|
89 |
return $signed_url;
|
90 |
}
|
93 |
* Returns the item search URL for search keywords
|
94 |
*
|
95 |
* @param string $search_keywords Search keywords of the products.
|
96 |
+
* @param string $marketplaces Marketplace to search the products.
|
97 |
+
* @param string $tracking_id Associate tag.
|
98 |
*
|
99 |
* @return string Signed URL for item search.
|
100 |
*/
|
116 |
*/
|
117 |
function get_error_message( $error ) {
|
118 |
switch ( $error ) {
|
119 |
+
case HTTP_Constants::BAD_REQUEST:
|
120 |
/* translators: 1: URL of Associate sign-up page 2: _blank 3:URL of adding secondary user page 4: _blank */
|
121 |
+
return '<h4>' . sprintf( __( "Your AWS Access Key Id is not registered as an Amazon Associate. Please verify that you are <a href=%1s target=%2s>registered as an Amazon Associate</a> in respective locale and you added the email address registered for the Product Advertising API as a <a href=%3s target=%4s>secondary email address in your Amazon Associates account</a>.", 'amazon-associates-link-builder' ), Plugin_Urls::ASSOCIATE_SIGN_UP_URL, Plugin_Urls::NEW_PAGE_TARGET, Plugin_Urls::ADDING_SECONDARY_USER_AC_URL, Plugin_Urls::NEW_PAGE_TARGET ) . '</h4>';
|
122 |
+
case HTTP_Constants::FORBIDDEN:
|
123 |
/* translators: 1: URL of PA-API sign-up page 2: _blank */
|
124 |
+
return '<h4>' . sprintf( __( "Your AccessKey Id is not registered for Product Advertising API. Please sign up for Product Advertising API by <a href=%1s target=%2s>following these guidelines</a>.", 'amazon-associates-link-builder' ), Paapi_Constants::SIGN_UP_URL, Plugin_Urls::NEW_PAGE_TARGET ) . '</h4>';
|
125 |
+
case HTTP_Constants::REQUEST_URI_TOO_LONG:
|
126 |
+
return '<h4>' . sprintf( __( "Your AccessKey Id is not registered for Product Advertising API. Please sign up for Product Advertising API by <a href=%1s target=%2s>following these guidelines</a>.", 'amazon-associates-link-builder' ), Paapi_Constants::SIGN_UP_URL, Plugin_Urls::NEW_PAGE_TARGET ) . '</h4>';
|
127 |
+
case HTTP_Constants::INTERNAL_SERVER_ERROR:
|
128 |
return '<h4>' . esc_html__( "Internal server error", 'amazon-associates-link-builder' ) . '</h4>';
|
129 |
+
case HTTP_Constants::THROTTLE:
|
130 |
/* translators: 1: URL of PA-API efficiency guidelines page 2: _blank */
|
131 |
+
return '<h4>' . sprintf( __( "You are submitting requests too quickly. Please retry your requests at a slower rate. For more information, see <a href=%1s target=%2s>Efficiency Guidelines</a>.", 'amazon-associates-link-builder' ), Paapi_Constants::EFFICIENCY_GUIDELINES_URL, Plugin_Urls::NEW_PAGE_TARGET ) . '</h4>';
|
132 |
+
case HTTP_Constants::TIME_OUT:
|
133 |
/* translators: %s: Email-id of the support */
|
134 |
+
return '<h4>' . sprintf( __( "Request timed out. Try again after some time. Please check you network and firewall settings. If the error still persists, write to us at %s.", 'amazon-associates-link-builder' ), Plugin_Constants::SUPPORT_EMAIL_ID ) . '</h4>';
|
135 |
default:
|
136 |
/**
|
137 |
* <h4> tag ensures that the message is treated as HTML element in jQuery.find in aalb_admin.js.
|
138 |
* Otherwise due to the error message string's characters like "!,:,etc", string is parsed as
|
139 |
* if it contains partial css classes and later given syntax error
|
140 |
+
*/
|
141 |
+
return '<h4>' . $error . '</h4>';
|
142 |
}
|
143 |
}
|
144 |
|
includes/aalb_helper.php → helper/plugin_helper.php
RENAMED
@@ -11,15 +11,19 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
-
*
|
17 |
*
|
18 |
* @since 1.0.0
|
19 |
* @package AmazonAssociatesLinkBuilder
|
20 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
21 |
*/
|
22 |
-
class
|
23 |
|
24 |
/**
|
25 |
* Build key for storing rendered template in cache.
|
@@ -81,7 +85,7 @@ class Aalb_Helper {
|
|
81 |
|
82 |
try {
|
83 |
$wpdb->query( $prepared_statement );
|
84 |
-
} catch ( Exception $e ) {
|
85 |
error_log( 'Unable to clear cache. Query to clear cache for substring ' . $substring . ' failed with the Exception ' . $e->getMessage() );
|
86 |
}
|
87 |
}
|
@@ -152,7 +156,7 @@ class Aalb_Helper {
|
|
152 |
* Gets the template uploads dir URL.
|
153 |
*
|
154 |
* @since 1.3.2
|
155 |
-
* @return full URL of the template uploads directory
|
156 |
*/
|
157 |
public function get_template_upload_directory_url() {
|
158 |
$upload_dir = wp_upload_dir();
|
@@ -195,7 +199,7 @@ class Aalb_Helper {
|
|
195 |
}
|
196 |
}
|
197 |
}
|
198 |
-
update_option(
|
199 |
}
|
200 |
|
201 |
/**
|
@@ -230,7 +234,7 @@ class Aalb_Helper {
|
|
230 |
* Gets the template uploads dir name.
|
231 |
*
|
232 |
* @since 1.3
|
233 |
-
* @return
|
234 |
*/
|
235 |
private function aalb_get_template_upload_path() {
|
236 |
return $this->aalb_get_uploads_dir_path() . AALB_TEMPLATE_UPLOADS_FOLDER;
|
@@ -240,7 +244,7 @@ class Aalb_Helper {
|
|
240 |
* Gets the uploads dir name of AALB plugin.
|
241 |
*
|
242 |
* @since 1.4.6
|
243 |
-
* @return full path of the uploads directory of AALB
|
244 |
*/
|
245 |
public function aalb_get_uploads_dir_path() {
|
246 |
global $wp_filesystem;
|
@@ -315,13 +319,14 @@ class Aalb_Helper {
|
|
315 |
$upload_dir = wp_upload_dir();
|
316 |
|
317 |
return array(
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
|
|
325 |
);
|
326 |
}
|
327 |
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\helper;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
18 |
|
19 |
/**
|
20 |
+
* Helper class for commonly used functions in the plugin.
|
21 |
*
|
22 |
* @since 1.0.0
|
23 |
* @package AmazonAssociatesLinkBuilder
|
24 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
25 |
*/
|
26 |
+
class Plugin_Helper {
|
27 |
|
28 |
/**
|
29 |
* Build key for storing rendered template in cache.
|
85 |
|
86 |
try {
|
87 |
$wpdb->query( $prepared_statement );
|
88 |
+
} catch ( \Exception $e ) {
|
89 |
error_log( 'Unable to clear cache. Query to clear cache for substring ' . $substring . ' failed with the Exception ' . $e->getMessage() );
|
90 |
}
|
91 |
}
|
156 |
* Gets the template uploads dir URL.
|
157 |
*
|
158 |
* @since 1.3.2
|
159 |
+
* @return String full URL of the template uploads directory
|
160 |
*/
|
161 |
public function get_template_upload_directory_url() {
|
162 |
$upload_dir = wp_upload_dir();
|
199 |
}
|
200 |
}
|
201 |
}
|
202 |
+
update_option( Db_Constants::TEMPLATE_NAMES, $aalb_templates );
|
203 |
}
|
204 |
|
205 |
/**
|
234 |
* Gets the template uploads dir name.
|
235 |
*
|
236 |
* @since 1.3
|
237 |
+
* @return \String path of the template uploads directory
|
238 |
*/
|
239 |
private function aalb_get_template_upload_path() {
|
240 |
return $this->aalb_get_uploads_dir_path() . AALB_TEMPLATE_UPLOADS_FOLDER;
|
244 |
* Gets the uploads dir name of AALB plugin.
|
245 |
*
|
246 |
* @since 1.4.6
|
247 |
+
* @return String full path of the uploads directory of AALB
|
248 |
*/
|
249 |
public function aalb_get_uploads_dir_path() {
|
250 |
global $wp_filesystem;
|
319 |
$upload_dir = wp_upload_dir();
|
320 |
|
321 |
return array(
|
322 |
+
Db_Constants::CUSTOM_UPLOAD_PATH => $upload_dir['basedir'] . '/' . Plugin_Constants::UPLOADS_FOLDER,
|
323 |
+
Db_Constants::AWS_ACCESS_KEY => '',
|
324 |
+
Db_Constants::AWS_SECRET_KEY => '',
|
325 |
+
Db_Constants::STORE_IDS => '',
|
326 |
+
Db_Constants::MAXMIND_DB_LAST_UPLOAD_PATH => get_option( Db_Constants::CUSTOM_UPLOAD_PATH ),
|
327 |
+
Db_Constants::GEOLITE_DB_DOWNLOAD_RETRY_ON_FAILURE_DURATION => AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_MIN,
|
328 |
+
Db_Constants::GEOLITE_DB_DOWNLOAD_FAILED_ATTEMPTS => 0,
|
329 |
+
Db_Constants::MARKETPLACE_NAMES => array()
|
330 |
);
|
331 |
}
|
332 |
|
includes/aalb_settings_page_migration_helper.php → helper/settings_page_migration_helper.php
RENAMED
@@ -11,6 +11,11 @@ either express or implied. See the License for the specific language governing p
|
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
/**
|
15 |
* Fired during the plugin activation
|
16 |
*
|
@@ -24,15 +29,15 @@ and limitations under the License.
|
|
24 |
* @package AmazonAssociatesLinkBuilder
|
25 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
26 |
*/
|
27 |
-
class
|
28 |
/**
|
29 |
* Runs the migrations logic to new settings page
|
30 |
*
|
31 |
* @since 1.4.12
|
32 |
*/
|
33 |
public function run_migration_logic() {
|
34 |
-
if ( version_compare(
|
35 |
-
delete_option(
|
36 |
$this->migrate_storeids();
|
37 |
}
|
38 |
}
|
@@ -43,11 +48,11 @@ class Aalb_Settings_Page_Migration_Helper {
|
|
43 |
* @since 1.4.12
|
44 |
*/
|
45 |
private function migrate_storeids() {
|
46 |
-
$default_marketplace_name = get_option(
|
47 |
-
$store_id_list = get_option(
|
48 |
if ( $store_id_list ) {
|
49 |
-
$marketplace_store_id_mapping = array( $default_marketplace_name => explode(
|
50 |
-
update_option(
|
51 |
}
|
52 |
}
|
53 |
}
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
14 |
+
namespace AmazonAssociatesLinkBuilder\helper;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
18 |
+
|
19 |
/**
|
20 |
* Fired during the plugin activation
|
21 |
*
|
29 |
* @package AmazonAssociatesLinkBuilder
|
30 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
31 |
*/
|
32 |
+
class Settings_Page_Migration_Helper {
|
33 |
/**
|
34 |
* Runs the migrations logic to new settings page
|
35 |
*
|
36 |
* @since 1.4.12
|
37 |
*/
|
38 |
public function run_migration_logic() {
|
39 |
+
if ( version_compare( Plugin_Constants::MULTI_LOCALE_SETTINGS_PLUGIN_VERSION, get_option( Db_Constants::PLUGIN_VERSION ), ">" ) ) {
|
40 |
+
delete_option( Db_Constants::STORE_IDS );
|
41 |
$this->migrate_storeids();
|
42 |
}
|
43 |
}
|
48 |
* @since 1.4.12
|
49 |
*/
|
50 |
private function migrate_storeids() {
|
51 |
+
$default_marketplace_name = get_option( Db_Constants::DEFAULT_MARKETPLACE, Db_Constants::DEFAULT_MARKETPLACE_NAME );
|
52 |
+
$store_id_list = get_option( Db_Constants::STORE_ID_NAMES );
|
53 |
if ( $store_id_list ) {
|
54 |
+
$marketplace_store_id_mapping = array( $default_marketplace_name => explode( Plugin_Constants::NEWLINE_SEPARATOR, $store_id_list ) );
|
55 |
+
update_option( Db_Constants::STORE_IDS, json_encode( $marketplace_store_id_mapping ) );
|
56 |
}
|
57 |
}
|
58 |
}
|
helper/tracking_api_helper.php
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
+
|
6 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
8 |
+
A copy of the License is located in the "license" file accompanying this file.
|
9 |
+
|
10 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
11 |
+
either express or implied. See the License for the specific language governing permissions
|
12 |
+
and limitations under the License.
|
13 |
+
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\helper;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\constants\Library_Endpoints;
|
17 |
+
use AmazonAssociatesLinkBuilder\includes\Remote_Loader;
|
18 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
19 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
20 |
+
use AmazonAssociatesLinkBuilder\helper\Plugin_Helper;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Helper class for APIs used for impression and clicks tracking
|
24 |
+
*
|
25 |
+
* @since 1.0.0
|
26 |
+
* @package AmazonAssociatesLinkBuilder
|
27 |
+
* @subpackage AmazonAssociatesLinkBuilder/lib/php
|
28 |
+
*/
|
29 |
+
class Tracking_Api_Helper {
|
30 |
+
|
31 |
+
protected $remote_loader;
|
32 |
+
protected $helper;
|
33 |
+
protected $version_info;
|
34 |
+
|
35 |
+
public function __construct() {
|
36 |
+
$this->remote_loader = new Remote_Loader();
|
37 |
+
$this->helper = new Plugin_Helper();
|
38 |
+
|
39 |
+
//Initializes the version information once.
|
40 |
+
$plugin_version = Plugin_Constants::PLUGIN_CURRENT_VERSION;
|
41 |
+
$wordpress_version = $this->helper->get_wordpress_version();
|
42 |
+
$this->version_info = array(
|
43 |
+
'wordpress' => $wordpress_version,
|
44 |
+
'plugin' => $plugin_version
|
45 |
+
);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Returns the response of the link-id API.
|
50 |
+
* The GET request returns a unique link-id everytime a shortcode is added
|
51 |
+
*
|
52 |
+
* @since 1.0.0
|
53 |
+
*
|
54 |
+
* @param string $shortcode_name Name of the shortcode used
|
55 |
+
* @param string $shortcode_params Array of all shortcode parameter key-value pairs
|
56 |
+
*
|
57 |
+
* @return string Response of the get link-id API for the given link-id
|
58 |
+
*/
|
59 |
+
public function get_link_id( $shortcode_name, $shortcode_params ) {
|
60 |
+
$link_info = array(
|
61 |
+
'shortcode_name' => $shortcode_name, 'shortcode_params' => $shortcode_params, 'version' => $this->version_info
|
62 |
+
);
|
63 |
+
$request_body = wp_json_encode( $link_info );
|
64 |
+
$base_url = $this->get_base_url( 'link-id' );
|
65 |
+
$response = $this->remote_loader->post( $base_url, $request_body );
|
66 |
+
$response_body = json_decode( $response, true );
|
67 |
+
|
68 |
+
return $response_body["link-id"];
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Builds the base url for each tracking api request. Adds common parameters
|
73 |
+
*
|
74 |
+
* @since 1.0.0
|
75 |
+
*
|
76 |
+
* @param string $method_path Relative path of the api method to be called.
|
77 |
+
*
|
78 |
+
* @return string The base url with common query parameters
|
79 |
+
*/
|
80 |
+
private function get_base_url( $method_path ) {
|
81 |
+
$access_key_id = openssl_decrypt( base64_decode( get_option( Db_Constants::AWS_ACCESS_KEY ) ), Plugin_Constants::ENCRYPTION_ALGORITHM, Plugin_Constants::ENCRYPTION_KEY, 0, Plugin_Constants::ENCRYPTION_IV );
|
82 |
+
|
83 |
+
return ( Library_Endpoints::TRACKING_API_ENDPOINT . $method_path . '?' . Library_Endpoints::TRACKING_API_SOURCE_TOOL_QUERY_PARAM . '&' . Library_Endpoints::TRACKING_API_ACCESS_KEY_QUERY_PARAM . $access_key_id );
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Returns the response of the impressions API for a given link-id
|
88 |
+
* TODO: Not used post v1.4. Impression tracking plugged out for re-vamping purposes.
|
89 |
+
*
|
90 |
+
* @since 1.0.0
|
91 |
+
*
|
92 |
+
* @param string $link_id Link ID for which impression parameters are required
|
93 |
+
* @param string $shortcode_name Name of the shortcode used
|
94 |
+
* @param string $shortcode_params Array of all shortcode parameter key-value pairs
|
95 |
+
*
|
96 |
+
* @return string Response of the get impression API for the given link-id
|
97 |
+
*/
|
98 |
+
public function get_impression_params( $link_id, $shortcode_name, $shortcode_params ) {
|
99 |
+
$link_info = array(
|
100 |
+
'shortcode_name' => $shortcode_name, 'shortcode_params' => $shortcode_params, 'version' => $this->version_info
|
101 |
+
);
|
102 |
+
$request_body = wp_json_encode( $link_info );
|
103 |
+
$base_url = $this->get_base_url( 'impression' );
|
104 |
+
$url = $base_url . '&link-id=' . $link_id;
|
105 |
+
|
106 |
+
return $this->remote_loader->post( $url, $request_body );
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Returns the click URL by parsing the recieved getImpressions API Response
|
111 |
+
* TODO: Not used post v1.4. Impression Tracking plugged out for re-vamping purposes.
|
112 |
+
*
|
113 |
+
* @since 1.0.0
|
114 |
+
*
|
115 |
+
* @param string $impression_params JSON Response from the get impressions API for a link-id
|
116 |
+
*
|
117 |
+
* @return string $click_url Click URL for an impression ID
|
118 |
+
*/
|
119 |
+
public function get_click_url( $impression_params ) {
|
120 |
+
$body = json_decode( $impression_params, true );
|
121 |
+
|
122 |
+
return $body["click-url"];
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Echoes an invisible img with src=pixel-url to fire the pixels
|
127 |
+
* TODO: Not used post v1.4. Impression Tracking plugged out for re-vamping purposes.
|
128 |
+
*
|
129 |
+
* @since 1.0.0
|
130 |
+
*
|
131 |
+
* @param string $impression_params JSON Response from the get impressions API for a link-id
|
132 |
+
*/
|
133 |
+
public function insert_pixel( $impression_params ) {
|
134 |
+
$body = json_decode( $impression_params, true );
|
135 |
+
$pixel_url = $body["pixel-url"];
|
136 |
+
if ( ! is_amp_endpoint() ) {
|
137 |
+
echo '<img src="' . $pixel_url . '" style="display:none"></img>';
|
138 |
+
}
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
?>
|
lib/php/aalb_validation_helper.php → helper/validation_helper.php
RENAMED
@@ -11,6 +11,11 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* Hepler class for validations used in the plugin.
|
@@ -19,14 +24,14 @@ and limitations under the License.
|
|
19 |
* @package AmazonAssociatesLinkBuilder
|
20 |
* @subpackage AmazonAssociatesLinkBuilder/lib/php
|
21 |
*/
|
22 |
-
class
|
23 |
|
24 |
protected $config_loader;
|
25 |
protected $helper;
|
26 |
|
27 |
public function __construct() {
|
28 |
-
$this->config_loader = new
|
29 |
-
$this->helper = new
|
30 |
}
|
31 |
|
32 |
/**
|
@@ -52,7 +57,7 @@ class Aalb_Validation_Helper {
|
|
52 |
* @return bool TRUE if the template name is valid, FALSE otherwise
|
53 |
*/
|
54 |
public function validate_template_name( $template ) {
|
55 |
-
$aalb_template_names = get_option(
|
56 |
|
57 |
return in_array( $template, $aalb_template_names );
|
58 |
}
|
@@ -96,10 +101,11 @@ class Aalb_Validation_Helper {
|
|
96 |
* @return bool TRUE if the Associate Tag is valid, FALSE otherwise
|
97 |
*/
|
98 |
public function validate_store_id( $store_id ) {
|
99 |
-
$aalb_store_id_names = explode( "\r\n", get_option(
|
100 |
//If the store id used is "not-specified".
|
101 |
-
if ( $store_id ===
|
102 |
$this->helper->show_error_in_preview( esc_html__( "Associate Tag was not found. The sales will not be attributed to any store and you will not earn the associate fees for it. Please provide a valid Associate Tag if you wish to earn the referral fees. Assocaite Tags can be configured from the 'Settings' tab in the WordPress administration panel", 'amazon-associates-link-builder' ) );
|
|
|
103 |
return true;
|
104 |
}
|
105 |
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\helper;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\configuration\Config_Loader;
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
18 |
+
use AmazonAssociatesLinkBuilder\helper\Plugin_Helper;
|
19 |
|
20 |
/**
|
21 |
* Hepler class for validations used in the plugin.
|
24 |
* @package AmazonAssociatesLinkBuilder
|
25 |
* @subpackage AmazonAssociatesLinkBuilder/lib/php
|
26 |
*/
|
27 |
+
class Validation_Helper {
|
28 |
|
29 |
protected $config_loader;
|
30 |
protected $helper;
|
31 |
|
32 |
public function __construct() {
|
33 |
+
$this->config_loader = new Config_Loader();
|
34 |
+
$this->helper = new Plugin_Helper();
|
35 |
}
|
36 |
|
37 |
/**
|
57 |
* @return bool TRUE if the template name is valid, FALSE otherwise
|
58 |
*/
|
59 |
public function validate_template_name( $template ) {
|
60 |
+
$aalb_template_names = get_option( Db_Constants::TEMPLATE_NAMES );
|
61 |
|
62 |
return in_array( $template, $aalb_template_names );
|
63 |
}
|
101 |
* @return bool TRUE if the Associate Tag is valid, FALSE otherwise
|
102 |
*/
|
103 |
public function validate_store_id( $store_id ) {
|
104 |
+
$aalb_store_id_names = explode( "\r\n", get_option( Db_Constants::STORE_ID_NAMES ) );
|
105 |
//If the store id used is "not-specified".
|
106 |
+
if ( $store_id === Db_Constants::DEFAULT_STORE_ID_NAME ) {
|
107 |
$this->helper->show_error_in_preview( esc_html__( "Associate Tag was not found. The sales will not be attributed to any store and you will not earn the associate fees for it. Please provide a valid Associate Tag if you wish to earn the referral fees. Assocaite Tags can be configured from the 'Settings' tab in the WordPress administration panel", 'amazon-associates-link-builder' ) );
|
108 |
+
|
109 |
return true;
|
110 |
}
|
111 |
|
helper/xml_helper.php
ADDED
@@ -0,0 +1,321 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace AmazonAssociatesLinkBuilder\helper;
|
4 |
+
|
5 |
+
use AmazonAssociatesLinkBuilder\configuration\Config_Helper;
|
6 |
+
use AmazonAssociatesLinkBuilder\constants\XML_Constants;
|
7 |
+
|
8 |
+
/*
|
9 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
10 |
+
|
11 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
12 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
13 |
+
A copy of the License is located in the "license" file accompanying this file.
|
14 |
+
|
15 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
16 |
+
either express or implied. See the License for the specific language governing permissions
|
17 |
+
and limitations under the License.
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Helper class for customizations to the xml response
|
22 |
+
*
|
23 |
+
* @since 1.0.0
|
24 |
+
* @package AmazonAssociatesLinkBuilder
|
25 |
+
* @subpackage AmazonAssociatesLinkBuilder/lib/php
|
26 |
+
*/
|
27 |
+
class Xml_Helper {
|
28 |
+
private $config_helper;
|
29 |
+
|
30 |
+
public function __construct( Config_Helper $config_helper ) {
|
31 |
+
$this->config_helper = $config_helper;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Gets Basic Labels object object containing price label, strike-price label & products from amazon label
|
36 |
+
*
|
37 |
+
* @since 1.8.0
|
38 |
+
*
|
39 |
+
* @param String $marketplace Marketplace according to which labels will be localized
|
40 |
+
*
|
41 |
+
* @return array Basic Labels
|
42 |
+
*/
|
43 |
+
public function get_basic_labels( $marketplace ) {
|
44 |
+
return array(
|
45 |
+
XML_Constants::PRICE_LABEL => $this->config_helper->get_string( XML_Constants::PRICE, $marketplace ),
|
46 |
+
XML_Constants::STRIKE_PRICE_LABEL => $this->config_helper->get_string( XML_Constants::STRIKE_PRICE_STRING, $marketplace ),
|
47 |
+
XML_Constants::PRODUCTS_FROM_AMAZON_LABEL => $this->config_helper->get_string( XML_Constants::PRODUCTS_FROM_AMAZON, $marketplace )
|
48 |
+
);
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Gets Basic info object containing ASIN, Title, Detail Page URL
|
53 |
+
*
|
54 |
+
* @since 1.8.0
|
55 |
+
*
|
56 |
+
* @param \SimpleXMLElement $item Well formed XML String: The Parent item node
|
57 |
+
*
|
58 |
+
* @return array $basic_info
|
59 |
+
*/
|
60 |
+
public function get_basic_info( $item ) {
|
61 |
+
return array(
|
62 |
+
XML_Constants::ASIN => ! empty( $item->ASIN ) ? $item->ASIN : null,
|
63 |
+
XML_Constants::TITLE => ! empty( $item->ItemAttributes->Title ) ? $item->ItemAttributes->Title : null,
|
64 |
+
XML_Constants::DETAIL_PAGE_URL => ! empty( $item->DetailPageURL ) ? $item->DetailPageURL : null
|
65 |
+
);
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Gets Image URL object containing LargeImage, MediumImage & SmallImage URLs.
|
71 |
+
*
|
72 |
+
* @since 1.8.0
|
73 |
+
*
|
74 |
+
* @param \SimpleXMLElement $items Well formed XML String: The Parent item node
|
75 |
+
*
|
76 |
+
* @return array $image_urls
|
77 |
+
*/
|
78 |
+
public function get_image_urls( $item ) {
|
79 |
+
return array(
|
80 |
+
XML_Constants::LARGE_IMAGE_URL => ! empty( $item->LargeImage->URL ) ? $item->LargeImage->URL : null,
|
81 |
+
XML_Constants::MEDIUM_IMAGE_URL => ! empty( $item->MediumImage->URL ) ? $item->MediumImage->URL : null,
|
82 |
+
XML_Constants::SMALL_IMAGE_URL => ! empty( $item->SmallImage->URL ) ? $item->SmallImage->URL : null,
|
83 |
+
);
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Gets By Information String containing ' and 'separated strings of all artists, brands and authors
|
88 |
+
* Sample Request:
|
89 |
+
*
|
90 |
+
* [Author] => Array
|
91 |
+
* (
|
92 |
+
* [0] => Author1
|
93 |
+
* [1] => Author2
|
94 |
+
* )
|
95 |
+
*
|
96 |
+
* [Artist] => Array
|
97 |
+
* (
|
98 |
+
* [0] => Artist1
|
99 |
+
* )
|
100 |
+
*
|
101 |
+
* [Brand] => Array
|
102 |
+
* (
|
103 |
+
* [0] => Brand1
|
104 |
+
* )
|
105 |
+
*
|
106 |
+
* Sample Response: "Author1, Author2 and Brand1 and Artist1"
|
107 |
+
*
|
108 |
+
* @since 1.0.0
|
109 |
+
*
|
110 |
+
* @param \SimpleXMLElement $item Well formed XML String: The Parent item node
|
111 |
+
*
|
112 |
+
* @return String By Node Information
|
113 |
+
*/
|
114 |
+
public function get_by_information( $item ) {
|
115 |
+
$author_array = array();
|
116 |
+
$brand_array = array();
|
117 |
+
$artist_array = array();
|
118 |
+
$by_information = array();
|
119 |
+
foreach ( $item->ItemAttributes->Author as $author ) {
|
120 |
+
array_push( $author_array, $author );
|
121 |
+
}
|
122 |
+
foreach ( $item->ItemAttributes->Brand as $brand ) {
|
123 |
+
array_push( $brand_array, $brand );
|
124 |
+
}
|
125 |
+
foreach ( $item->ItemAttributes->Artist as $artist ) {
|
126 |
+
array_push( $artist_array, $artist );
|
127 |
+
}
|
128 |
+
if ( ! empty( $author_array ) ) {
|
129 |
+
array_push( $by_information, implode( ', ', $author_array ) );
|
130 |
+
}
|
131 |
+
if ( ! empty( $brand_array ) ) {
|
132 |
+
array_push( $by_information, implode( ', ', $brand_array ) );
|
133 |
+
}
|
134 |
+
if ( ! empty( $artist_array ) ) {
|
135 |
+
array_push( $by_information, implode( ', ', $artist_array ) );
|
136 |
+
}
|
137 |
+
|
138 |
+
return implode( ' and ', $by_information );
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Gets Price Information String containing SavingsInfo, CurrentPrice, Strike Price, InStock and Minimum Price.
|
143 |
+
*
|
144 |
+
* @since 1.8.0
|
145 |
+
*
|
146 |
+
* @param \SimpleXMLElement $item Well formed XML String: The Parent item node
|
147 |
+
*
|
148 |
+
* @return array $price_related_info
|
149 |
+
*/
|
150 |
+
public function get_price_related_information( $item, $marketplace ) {
|
151 |
+
$savings_info = $this->get_savings_info( $item );
|
152 |
+
$min_price_info = $this->get_min_price_info( $item );
|
153 |
+
$strike_price_and_current_price_info = $this->get_current_and_strike_price( $item, $savings_info[XML_Constants::SAVING_PERCENT] );
|
154 |
+
$current_price = $strike_price_and_current_price_info[XML_Constants::CURRENT_PRICE];
|
155 |
+
$current_price_value = $strike_price_and_current_price_info[XML_Constants::CURRENT_PRICE_VALUE];
|
156 |
+
$strike_price = $strike_price_and_current_price_info[XML_Constants::STRIKE_PRICE];
|
157 |
+
$strike_price_value = $strike_price_and_current_price_info[XML_Constants::STRIKE_PRICE_VALUE];
|
158 |
+
|
159 |
+
if ( $this->is_out_of_stock( $item ) ) {
|
160 |
+
$current_price = $this->config_helper->get_string( XML_Constants::OUT_OF_STOCK, $marketplace );
|
161 |
+
$in_stock = null;
|
162 |
+
} else {
|
163 |
+
$in_stock = XML_Constants::IN_STOCK_KEY_VALUE;
|
164 |
+
}
|
165 |
+
|
166 |
+
if ( $this->is_price_too_low_to_display( $current_price ) ) {
|
167 |
+
$current_price = $this->config_helper->get_string( XML_Constants::CHECK_ON_AMAZON, $marketplace );
|
168 |
+
}
|
169 |
+
|
170 |
+
return array(
|
171 |
+
XML_Constants::SAVINGS_INFO => $savings_info,
|
172 |
+
XML_Constants::MIN_PRICE_INFO => $min_price_info,
|
173 |
+
XML_Constants::CURRENT_PRICE => $current_price,
|
174 |
+
XML_Constants::CURRENT_PRICE_VALUE => $current_price_value,
|
175 |
+
XML_Constants::STRIKE_PRICE => $strike_price,
|
176 |
+
XML_Constants::STRIKE_PRICE_VALUE => $strike_price_value,
|
177 |
+
XML_Constants::IN_STOCK => $in_stock
|
178 |
+
);
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Gets Savings related nodes
|
183 |
+
* Adds Amount saved in both raw and formatted way and the percentage saved.
|
184 |
+
*
|
185 |
+
* @since 1.8.0
|
186 |
+
*
|
187 |
+
* @param \SimpleXMLElement $item Well formed XML String: The Parent item node
|
188 |
+
*
|
189 |
+
* @return array Node to which values are added
|
190 |
+
*/
|
191 |
+
private function get_savings_info( $item ) {
|
192 |
+
return array(
|
193 |
+
XML_Constants::SAVING => ! empty( $item->Offers->Offer->OfferListing->AmountSaved->FormattedPrice ) ? $item->Offers->Offer->OfferListing->AmountSaved->FormattedPrice : null,
|
194 |
+
XML_Constants::SAVING_VALUE => ! empty( $item->Offers->Offer->OfferListing->AmountSaved->Amount ) ? $item->Offers->Offer->OfferListing->AmountSaved->Amount : null,
|
195 |
+
XML_Constants::SAVING_PERCENT => ! empty( $item->Offers->Offer->OfferListing->PercentageSaved ) ? $item->Offers->Offer->OfferListing->PercentageSaved : null
|
196 |
+
);
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Get Minimum Price related information
|
201 |
+
* Adds raw and formatted values of minimum price
|
202 |
+
*
|
203 |
+
* @since 1.8.0
|
204 |
+
*
|
205 |
+
* @param \SimpleXMLElement $item Well formed XML String: The Parent item node
|
206 |
+
*
|
207 |
+
* @return array $min_price_info
|
208 |
+
*/
|
209 |
+
private function get_min_price_info( $item ) {
|
210 |
+
return array(
|
211 |
+
XML_Constants::MINIMUM_PRICE => ! empty( $item->OfferSummary->LowestNewPrice->FormattedPrice ) ? $item->OfferSummary->LowestNewPrice->FormattedPrice : null,
|
212 |
+
XML_Constants::MINIMUM_PRICE_VALUE => ! empty( $item->OfferSummary->LowestNewPrice->Amount ) ? $item->OfferSummary->LowestNewPrice->Amount : null
|
213 |
+
);
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Tells if the item is eligible for Prime
|
218 |
+
*
|
219 |
+
* @since 1.8.0
|
220 |
+
*
|
221 |
+
* @param \SimpleXMLElement $item Well formed XML String: The Parent item node
|
222 |
+
*
|
223 |
+
* @return boolean is_prime_eligible
|
224 |
+
*/
|
225 |
+
public function get_prime_eligibility( $item ) {
|
226 |
+
return ! empty( $item->Offers->Offer->OfferListing->IsEligibleForPrime ) ? $item->Offers->Offer->OfferListing->IsEligibleForPrime : null;
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Get Merchant Name
|
231 |
+
*
|
232 |
+
* @since 1.8.0
|
233 |
+
*
|
234 |
+
* @param \SimpleXMLElement $item Well formed XML String: The Parent item node
|
235 |
+
*
|
236 |
+
* @return String Merchant name if exists else null.
|
237 |
+
*/
|
238 |
+
public function get_merchant_name( $item ) {
|
239 |
+
return ! empty ( $item->Offers->Offer->Merchant->Name ) ? $item->Offers->Offer->Merchant->Name : null;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Gets Current Price and Strike Price Info after applying logic
|
244 |
+
* Logic for Current Price and Strike Price
|
245 |
+
*
|
246 |
+
* @since 1.8.0
|
247 |
+
*
|
248 |
+
* @param \SimpleXMLElement $item Well formed XML String: The Parent item node
|
249 |
+
* @param String $saving_percent
|
250 |
+
*
|
251 |
+
* @return array $strike_price_and_current_price_info
|
252 |
+
*/
|
253 |
+
private function get_current_and_strike_price( $item, $saving_percent ) {
|
254 |
+
$list_price = ! empty( $item->ItemAttributes->ListPrice->FormattedPrice ) ? $item->ItemAttributes->ListPrice->FormattedPrice : null;
|
255 |
+
$price = ! empty( $item->Offers->Offer->OfferListing->Price->FormattedPrice ) ? $item->Offers->Offer->OfferListing->Price->FormattedPrice : null;
|
256 |
+
$sale_price = ! empty( $item->Offers->Offer->OfferListing->SalePrice->FormattedPrice ) ? $item->Offers->Offer->OfferListing->SalePrice->FormattedPrice : null;
|
257 |
+
$list_price_amount = ! empty( $item->ItemAttributes->ListPrice->Amount ) ? $item->ItemAttributes->ListPrice->Amount : null;
|
258 |
+
$price_amount = ! empty( $item->Offers->Offer->OfferListing->Price->Amount ) ? $item->Offers->Offer->OfferListing->Price->Amount : null;
|
259 |
+
$sale_price_amount = ! empty( $item->Offers->Offer->OfferListing->SalePrice->Amount ) ? $item->Offers->Offer->OfferListing->SalePrice->Amount : null;
|
260 |
+
|
261 |
+
//Null is set to Zero on Typecasting
|
262 |
+
$saving_percent = ! empty( $saving_percent ) ? (int) $saving_percent : 0;
|
263 |
+
$strike_price = null;
|
264 |
+
$strike_price_value = null;
|
265 |
+
|
266 |
+
if ( ! empty( $sale_price_amount ) ) {
|
267 |
+
//If Sale Price is returned
|
268 |
+
$current_price = $sale_price;
|
269 |
+
$current_price_value = $sale_price_amount;
|
270 |
+
if ( $saving_percent > 1 ) {
|
271 |
+
$strike_price = $price;
|
272 |
+
$strike_price_value = $price_amount;
|
273 |
+
}
|
274 |
+
} else {
|
275 |
+
$current_price = $price;
|
276 |
+
$current_price_value = $price_amount;
|
277 |
+
if ( $saving_percent > 1 ) {
|
278 |
+
$strike_price = $list_price;
|
279 |
+
$strike_price_value = $list_price_amount;
|
280 |
+
}
|
281 |
+
}
|
282 |
+
|
283 |
+
return array(
|
284 |
+
XML_Constants::STRIKE_PRICE => $strike_price,
|
285 |
+
XML_Constants::STRIKE_PRICE_VALUE => $strike_price_value,
|
286 |
+
XML_Constants::CURRENT_PRICE => $current_price,
|
287 |
+
XML_Constants::CURRENT_PRICE_VALUE => $current_price_value
|
288 |
+
);
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Checks if an item is out of stock
|
293 |
+
*
|
294 |
+
* @since 1.8.0
|
295 |
+
*
|
296 |
+
* @param \SimpleXMLElement $item Well formed XML String: The Parent item node
|
297 |
+
*
|
298 |
+
* @return boolean is_out_of_stock
|
299 |
+
*/
|
300 |
+
private function is_out_of_stock( $item ) {
|
301 |
+
$total_new = isset( $item->OfferSummary->TotalNew ) ? $item->OfferSummary->TotalNew : null;
|
302 |
+
$availability = isset( $item->Offers->Offer->OfferListing->Availability ) ? $item->Offers->Offer->OfferListing->Availability : null;
|
303 |
+
|
304 |
+
return $total_new == '0' or $availability == XML_Constants::OUT_OF_STOCK_VALUE;
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Checks if Price of item is not present or Too low to display
|
309 |
+
*
|
310 |
+
* @since 1.8.0
|
311 |
+
*
|
312 |
+
* @param String $current_price
|
313 |
+
*
|
314 |
+
* @return boolean is_price_too_low_to_display
|
315 |
+
*/
|
316 |
+
private function is_price_too_low_to_display( $current_price ) {
|
317 |
+
return empty( $current_price ) or strtolower( $current_price ) == XML_Constants::PA_API_LOW_PRICE;
|
318 |
+
}
|
319 |
+
}
|
320 |
+
|
321 |
+
?>
|
includes/aalb_admin_notice_manager.php
DELETED
@@ -1,85 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
-
|
6 |
-
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
-
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
8 |
-
A copy of the License is located in the "license" file accompanying this file.
|
9 |
-
|
10 |
-
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
11 |
-
either express or implied. See the License for the specific language governing permissions
|
12 |
-
and limitations under the License.
|
13 |
-
*/
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Manager class for Admin notice action
|
17 |
-
* Uses singleton pattern to maintain single copy of function_list all over
|
18 |
-
*
|
19 |
-
* @since 1.4.3
|
20 |
-
* @package AmazonAssociatesLinkBuilder
|
21 |
-
* @subpackage AmazonAssociatesLinkBuilder/includes
|
22 |
-
*/
|
23 |
-
class Aalb_Admin_Notice_Manager {
|
24 |
-
private static $instance = null;
|
25 |
-
|
26 |
-
private function __construct() {
|
27 |
-
}
|
28 |
-
|
29 |
-
private function __clone() {
|
30 |
-
}
|
31 |
-
|
32 |
-
public static function getInstance() {
|
33 |
-
if ( self::$instance == null ) {
|
34 |
-
self::$instance = new Aalb_Admin_Notice_Manager();
|
35 |
-
}
|
36 |
-
|
37 |
-
return self::$instance;
|
38 |
-
}
|
39 |
-
|
40 |
-
//Array to hold all admin notice action hooks in the plugin
|
41 |
-
private $functions_list = array();
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Add action for admin notice and also make an entry in function_list
|
45 |
-
*
|
46 |
-
* @since 1.4.3
|
47 |
-
*
|
48 |
-
* @param string $obj Reference of the object
|
49 |
-
* @param callable $callback_function The name of the function you wish to be called.
|
50 |
-
* @param int $priority Optional. Used to specify the order in which the functions
|
51 |
-
* associated with a particular action are executed. Default 10.
|
52 |
-
* Lower numbers correspond with earlier execution,
|
53 |
-
* and functions with the same priority are executed
|
54 |
-
* in the order in which they were added to the action.
|
55 |
-
* @param int $accepted_args Optional. The number of arguments the function accepts. Default 1.
|
56 |
-
*
|
57 |
-
*/
|
58 |
-
public function add_notice( $obj, $callback_function, $priority = 10, $accepted_args = 1 ) {
|
59 |
-
$function_to_add = array( $obj, $callback_function );
|
60 |
-
add_action( 'admin_notices', $function_to_add, $priority, $accepted_args );
|
61 |
-
$key = get_class( $obj ) . "::" . $callback_function;
|
62 |
-
//Overrides the value of key if already present to prevent multiple entries in case object is instantiated again
|
63 |
-
$this->functions_list[$key] = array(
|
64 |
-
"function_to_add" => $function_to_add,
|
65 |
-
"priority" => $priority,
|
66 |
-
"accepted_args" => $accepted_args
|
67 |
-
);
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Remove all functions for admin notice action that are added by plugin and
|
72 |
-
* also remove entry from the function_list
|
73 |
-
*
|
74 |
-
* @since 1.4.3
|
75 |
-
*/
|
76 |
-
public function remove_all_notices() {
|
77 |
-
foreach ( $this->functions_list as $key => $value ) {
|
78 |
-
remove_action( 'admin_notices', $value["function_to_add"], $value["priority"],
|
79 |
-
$value["accepted_args"] );
|
80 |
-
unset( $this->functions_list[$key] );
|
81 |
-
}
|
82 |
-
}
|
83 |
-
}
|
84 |
-
|
85 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/aalb_initializer.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
+
|
5 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
7 |
+
A copy of the License is located in the "license" file accompanying this file.
|
8 |
+
|
9 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
+
either express or implied. See the License for the specific language governing permissions
|
11 |
+
and limitations under the License.
|
12 |
+
*/
|
13 |
+
|
14 |
+
//Not namespaced intentionally for graceful deactivation on non-namespaced supporting PHP version
|
15 |
+
use AmazonAssociatesLinkBuilder\includes\Plugin_Manager;
|
16 |
+
use AmazonAssociatesLinkBuilder\includes\Deactivator;
|
17 |
+
use AmazonAssociatesLinkBuilder\includes\Activator;
|
18 |
+
use AmazonAssociatesLinkBuilder\includes\Autoloader;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* The class does all the initialisation of the plugin
|
22 |
+
*
|
23 |
+
* @since 1.8.0
|
24 |
+
* @package AmazonAssociatesLinkBuilder
|
25 |
+
* @subpackage AmazonAssociatesLinkBuilder/includes
|
26 |
+
*/
|
27 |
+
class Aalb_Initializer {
|
28 |
+
/**
|
29 |
+
* Initial bindings, autolaoding classes and execution
|
30 |
+
*
|
31 |
+
* @param String $plugin_base_name
|
32 |
+
* @param String $plugin_file_name
|
33 |
+
*
|
34 |
+
* @since 1.8.0
|
35 |
+
*/
|
36 |
+
function initialize( $plugin_base_name, $plugin_file_name ) {
|
37 |
+
$this->autoload();
|
38 |
+
add_filter( 'plugin_action_links_' . $plugin_base_name, array( $this, 'add_action_links' ) );
|
39 |
+
register_activation_hook( $plugin_file_name, array( new Activator(), 'activate' ) );
|
40 |
+
register_deactivation_hook( $plugin_file_name, array( new Deactivator(), 'deactivate' ) );
|
41 |
+
$this->execute();
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Autoload the files required for the plugin.
|
46 |
+
*
|
47 |
+
* @since 1.8.0
|
48 |
+
*/
|
49 |
+
function autoload() {
|
50 |
+
require_once( AALB_PLUGIN_DIR . 'vendor/autoload.php' );
|
51 |
+
|
52 |
+
//Load the autoloader for plugin files.
|
53 |
+
require_once( AALB_AUTOLOADER );
|
54 |
+
Autoloader::register();
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Execute the plugin
|
59 |
+
*
|
60 |
+
* @since 1.8.0
|
61 |
+
*/
|
62 |
+
function execute() {
|
63 |
+
$plugin_manager = new Plugin_Manager();
|
64 |
+
$plugin_manager->execute();
|
65 |
+
}
|
66 |
+
|
67 |
+
function add_action_links( $links ) {
|
68 |
+
$mylinks = array(
|
69 |
+
'<a href="' . admin_url( 'admin.php?page=associates-link-builder-about' ) . '">' . esc_html__( "About", 'amazon-associates-link-builder' ) . '</a>',
|
70 |
+
'<a href="' . admin_url( 'admin.php?page=associates-link-builder-settings' ) . '">' . esc_html__( "Settings", 'amazon-associates-link-builder' ) . '</a>',
|
71 |
+
'<a href="' . admin_url( 'admin.php?page=associates-link-builder-templates' ) . '">' . esc_html__( "Templates", 'amazon-associates-link-builder' ) . '</a>',
|
72 |
+
);
|
73 |
+
|
74 |
+
return array_merge( $links, $mylinks );
|
75 |
+
}
|
76 |
+
}
|
includes/{aalb_activator.php → activator.php}
RENAMED
@@ -12,6 +12,10 @@ either express or implied. See the License for the specific language governing p
|
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
|
|
|
|
|
|
|
|
15 |
/**
|
16 |
* Fired during the plugin activation
|
17 |
*
|
@@ -21,35 +25,15 @@ and limitations under the License.
|
|
21 |
* @package AmazonAssociatesLinkBuilder
|
22 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
23 |
*/
|
24 |
-
class
|
25 |
-
|
26 |
-
protected $helper;
|
27 |
-
private $aalb_compatibility_helper;
|
28 |
-
|
29 |
-
public function __construct() {
|
30 |
-
$this->helper = new Aalb_Helper();
|
31 |
-
$this->aalb_compatibility_helper = new Aalb_Compatibility_Helper();
|
32 |
-
}
|
33 |
-
|
34 |
/**
|
35 |
* Add the template names to the database from the filesystem.
|
36 |
*
|
37 |
* @since 1.0.0
|
38 |
*/
|
39 |
private function load_templates() {
|
40 |
-
$
|
41 |
-
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Halts activation process if the plugin is not compatible with the user environment
|
45 |
-
*
|
46 |
-
* @since 1.4.3
|
47 |
-
*/
|
48 |
-
private function halt_activation() {
|
49 |
-
/* This string runs when plugin is not activated & so translation function will not translate it.
|
50 |
-
** So skipping it to put under translator function.
|
51 |
-
*/
|
52 |
-
exit(sprintf('<span style="color:red;">%s plugin requires PHP Version %s or higher. You’re still on %s.</span>', AALB_PLUGIN_NAME, AALB_PLUGIN_MINIMUM_SUPPORTED_PHP_VERSION, phpversion()));
|
53 |
}
|
54 |
|
55 |
/**
|
@@ -58,11 +42,7 @@ class Aalb_Activator {
|
|
58 |
* @since 1.4.3
|
59 |
*/
|
60 |
function activate() {
|
61 |
-
|
62 |
-
$this->load_templates();
|
63 |
-
} else {
|
64 |
-
$this->halt_activation();
|
65 |
-
}
|
66 |
}
|
67 |
}
|
68 |
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
15 |
+
namespace AmazonAssociatesLinkBuilder\includes;
|
16 |
+
|
17 |
+
use AmazonAssociatesLinkBuilder\helper\Plugin_Helper;
|
18 |
+
|
19 |
/**
|
20 |
* Fired during the plugin activation
|
21 |
*
|
25 |
* @package AmazonAssociatesLinkBuilder
|
26 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
27 |
*/
|
28 |
+
class Activator {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
/**
|
30 |
* Add the template names to the database from the filesystem.
|
31 |
*
|
32 |
* @since 1.0.0
|
33 |
*/
|
34 |
private function load_templates() {
|
35 |
+
$plugin_helper = new Plugin_Helper();
|
36 |
+
$plugin_helper->refresh_template_list();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
|
39 |
/**
|
42 |
* @since 1.4.3
|
43 |
*/
|
44 |
function activate() {
|
45 |
+
$this->load_templates();
|
|
|
|
|
|
|
|
|
46 |
}
|
47 |
}
|
48 |
|
includes/{aalb_autoloader.php → autoloader.php}
RENAMED
@@ -11,7 +11,7 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
-
|
15 |
/**
|
16 |
* The class reponsible for auto-loading files.
|
17 |
*
|
@@ -21,7 +21,7 @@ and limitations under the License.
|
|
21 |
* @package AmazonAssociatesLinkBuilder
|
22 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
23 |
*/
|
24 |
-
class
|
25 |
|
26 |
private $dir;
|
27 |
|
@@ -56,6 +56,11 @@ class Aalb_Autoloader {
|
|
56 |
new self( AALB_IP_2_COUNTRY_DIR );
|
57 |
new self( AALB_EXCEPTIONS_DIR );
|
58 |
new self( AALB_IO_DIR );
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
|
61 |
/**
|
@@ -66,11 +71,25 @@ class Aalb_Autoloader {
|
|
66 |
* @param string $class Name of the class to autoload.
|
67 |
*/
|
68 |
public function autoload( $class ) {
|
|
|
69 |
$path = $this->dir . strtolower( $class ) . '.php';
|
70 |
if ( file_exists( $path ) ) {
|
71 |
require_once( $path );
|
72 |
}
|
73 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
?>
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\includes;
|
15 |
/**
|
16 |
* The class reponsible for auto-loading files.
|
17 |
*
|
21 |
* @package AmazonAssociatesLinkBuilder
|
22 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
23 |
*/
|
24 |
+
class Autoloader {
|
25 |
|
26 |
private $dir;
|
27 |
|
56 |
new self( AALB_IP_2_COUNTRY_DIR );
|
57 |
new self( AALB_EXCEPTIONS_DIR );
|
58 |
new self( AALB_IO_DIR );
|
59 |
+
new self( AALB_HELPER_DIR );
|
60 |
+
new self( AALB_CONFIGURATION_DIR );
|
61 |
+
new self( AALB_RENDERING_DIR );
|
62 |
+
new self( AALB_CACHE_DIR );
|
63 |
+
new self( AALB_CONSTANTS_DIR );
|
64 |
}
|
65 |
|
66 |
/**
|
71 |
* @param string $class Name of the class to autoload.
|
72 |
*/
|
73 |
public function autoload( $class ) {
|
74 |
+
$class = $this->get_non_namespaced_class_name( $class );
|
75 |
$path = $this->dir . strtolower( $class ) . '.php';
|
76 |
if ( file_exists( $path ) ) {
|
77 |
require_once( $path );
|
78 |
}
|
79 |
}
|
80 |
+
|
81 |
+
/** Remove the namespace from the class name as the file_name does not contain namespace.
|
82 |
+
*
|
83 |
+
* @since 1.8.0
|
84 |
+
*
|
85 |
+
* @param string $class Name of the class.
|
86 |
+
*/
|
87 |
+
private function get_non_namespaced_class_name( $class ) {
|
88 |
+
$pos = strrpos( $class, '\\' );
|
89 |
+
|
90 |
+
return $pos === false ? $class : substr( $class, $pos + 1 );
|
91 |
+
|
92 |
+
}
|
93 |
}
|
94 |
|
95 |
?>
|
includes/{aalb_deactivator.php → deactivator.php}
RENAMED
@@ -11,6 +11,9 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* Fired during the plugin deactivation
|
@@ -22,32 +25,11 @@ and limitations under the License.
|
|
22 |
* CAUTION: Any function present here should contain code that is compatible with at least PHP 5.3(even lower if possible) so
|
23 |
* that anyone not meeting compatibility requirements for min php versions gets deactivated successfully.
|
24 |
*/
|
25 |
-
class
|
26 |
-
|
27 |
-
protected $helper;
|
28 |
|
29 |
public function __construct() {
|
30 |
-
$this->
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Remove the settings stored by the admin in the database
|
35 |
-
*
|
36 |
-
* @since 1.0.0
|
37 |
-
*/
|
38 |
-
public function remove_settings() {
|
39 |
-
global $wpdb;
|
40 |
-
$table_prefix = $wpdb->prefix;
|
41 |
-
$statement = 'DELETE from ' . $table_prefix . 'options
|
42 |
-
WHERE option_name like %s';
|
43 |
-
$settings = "aalb%";
|
44 |
-
$prepared_statement = $wpdb->prepare( $statement, $settings );
|
45 |
-
|
46 |
-
try {
|
47 |
-
$wpdb->query( $prepared_statement );
|
48 |
-
} catch ( Exception $e ) {
|
49 |
-
error_log( 'Unable to clear settings. Query failed with the Exception ' . $e->getMessage() );
|
50 |
-
}
|
51 |
}
|
52 |
|
53 |
/**
|
@@ -55,20 +37,17 @@ class Aalb_Deactivator {
|
|
55 |
*
|
56 |
* @since 1.0.0
|
57 |
*/
|
58 |
-
|
59 |
-
$this->
|
60 |
}
|
61 |
|
62 |
/**
|
63 |
-
*
|
64 |
*
|
65 |
-
* @since 1.
|
66 |
*/
|
67 |
-
public function
|
68 |
-
|
69 |
-
$this->helper->aalb_initialize_wp_filesystem_api();
|
70 |
-
$upload_dir = $this->helper->get_template_upload_directory();
|
71 |
-
$wp_filesystem->rmdir( $upload_dir, true );
|
72 |
}
|
73 |
}
|
74 |
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\includes;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\helper\Plugin_Helper;
|
17 |
|
18 |
/**
|
19 |
* Fired during the plugin deactivation
|
25 |
* CAUTION: Any function present here should contain code that is compatible with at least PHP 5.3(even lower if possible) so
|
26 |
* that anyone not meeting compatibility requirements for min php versions gets deactivated successfully.
|
27 |
*/
|
28 |
+
class Deactivator {
|
29 |
+
private $plugin_helper;
|
|
|
30 |
|
31 |
public function __construct() {
|
32 |
+
$this->plugin_helper = new Plugin_Helper();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
|
35 |
/**
|
37 |
*
|
38 |
* @since 1.0.0
|
39 |
*/
|
40 |
+
private function remove_cache() {
|
41 |
+
$this->plugin_helper->clear_cache_for_substring( '' );
|
42 |
}
|
43 |
|
44 |
/**
|
45 |
+
* The code to run on deactivation
|
46 |
*
|
47 |
+
* @since 1.8.0
|
48 |
*/
|
49 |
+
public function deactivate() {
|
50 |
+
$this->remove_cache();
|
|
|
|
|
|
|
51 |
}
|
52 |
}
|
53 |
|
includes/{aalb_hook_loader.php → hook_loader.php}
RENAMED
@@ -11,7 +11,7 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
-
|
15 |
/**
|
16 |
* The class that loads all the hooks.
|
17 |
*
|
@@ -19,7 +19,7 @@ and limitations under the License.
|
|
19 |
* @package AmazonAssociatesLinkBuilder
|
20 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
21 |
*/
|
22 |
-
class
|
23 |
|
24 |
protected $actions;
|
25 |
|
@@ -32,10 +32,10 @@ class Aalb_Hook_Loader {
|
|
32 |
*
|
33 |
* @since 1.0.0
|
34 |
*
|
35 |
-
* @param string $hook
|
36 |
-
* @param object $component
|
37 |
-
* @param string $callback
|
38 |
-
* @param int $priority
|
39 |
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
|
40 |
*/
|
41 |
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
@@ -49,11 +49,11 @@ class Aalb_Hook_Loader {
|
|
49 |
* @since 1.0.0
|
50 |
* @access private
|
51 |
*
|
52 |
-
* @param array $hooks
|
53 |
-
* @param string $hook
|
54 |
-
* @param object $component
|
55 |
-
* @param string $callback
|
56 |
-
* @param int $priority
|
57 |
* @param int $accepted_args The number of arguments that should be passed to the $callback.
|
58 |
*
|
59 |
* @return array The collection of actions and filters registered with WordPress.
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\includes;
|
15 |
/**
|
16 |
* The class that loads all the hooks.
|
17 |
*
|
19 |
* @package AmazonAssociatesLinkBuilder
|
20 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
21 |
*/
|
22 |
+
class Hook_Loader {
|
23 |
|
24 |
protected $actions;
|
25 |
|
32 |
*
|
33 |
* @since 1.0.0
|
34 |
*
|
35 |
+
* @param string $hook The name of the WordPress action that is being registered.
|
36 |
+
* @param object $component A reference to the instance of the object on which the action is defined.
|
37 |
+
* @param string $callback The name of the function definition on the $component.
|
38 |
+
* @param int $priority Optional. he priority at which the function should be fired. Default is 10.
|
39 |
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
|
40 |
*/
|
41 |
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
|
49 |
* @since 1.0.0
|
50 |
* @access private
|
51 |
*
|
52 |
+
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
|
53 |
+
* @param string $hook The name of the WordPress filter that is being registered.
|
54 |
+
* @param object $component A reference to the instance of the object on which the filter is defined.
|
55 |
+
* @param string $callback The name of the function definition on the $component.
|
56 |
+
* @param int $priority The priority at which the function should be fired.
|
57 |
* @param int $accepted_args The number of arguments that should be passed to the $callback.
|
58 |
*
|
59 |
* @return array The collection of actions and filters registered with WordPress.
|
includes/{aalb_manager.php → plugin_manager.php}
RENAMED
@@ -11,6 +11,19 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* The class that manages all the events of the wordpress.
|
@@ -19,16 +32,16 @@ and limitations under the License.
|
|
19 |
* @package AmazonAssociatesLinkBuilder
|
20 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
21 |
*/
|
22 |
-
class
|
23 |
|
24 |
protected $hook_loader;
|
25 |
protected $shortcode_loader;
|
26 |
protected $shortcode_manager;
|
27 |
|
28 |
public function __construct() {
|
29 |
-
$this->hook_loader = new
|
30 |
-
$this->shortcode_loader = new
|
31 |
-
$this->shortcode_manager = new
|
32 |
|
33 |
//add the hooks specific to admin.
|
34 |
$this->add_admin_hooks();
|
@@ -46,20 +59,20 @@ class Aalb_Manager {
|
|
46 |
* @since 1.0.0
|
47 |
*/
|
48 |
private function add_admin_hooks() {
|
49 |
-
$
|
50 |
-
$this->hook_loader->add_action( 'admin_print_footer_scripts', $
|
51 |
-
$this->hook_loader->add_action( 'wp_ajax_get_item_search_result', $
|
52 |
-
$this->hook_loader->add_action( 'wp_ajax_get_link_code', $
|
53 |
-
$this->hook_loader->add_action( 'wp_ajax_get_custom_template_content', $
|
54 |
-
$this->hook_loader->add_action( 'media_buttons', $
|
55 |
-
$this->hook_loader->add_action( 'admin_footer', $
|
56 |
-
$this->hook_loader->add_action( 'plugins_loaded', $
|
57 |
-
|
58 |
-
$aalb_sidebar = new
|
59 |
$this->hook_loader->add_action( 'admin_init', $aalb_sidebar, 'register_cred_config_group' );
|
60 |
$this->hook_loader->add_action( 'admin_menu', $aalb_sidebar, 'register_sidebar_config_page' );
|
61 |
|
62 |
-
$maxmind_db_manager = new
|
63 |
$this->hook_loader->add_action( 'plugins_loaded', $maxmind_db_manager, 'update_db_if_required' );
|
64 |
}
|
65 |
|
@@ -78,7 +91,7 @@ class Aalb_Manager {
|
|
78 |
* @since 1.4.12
|
79 |
*/
|
80 |
private function add_credentials_hooks() {
|
81 |
-
$credentials_helper = new
|
82 |
$this->hook_loader->add_action( 'admin_enqueue_scripts', $credentials_helper, 'aalb_credentials_enqueue_style' );
|
83 |
$this->hook_loader->add_action( 'admin_enqueue_scripts', $credentials_helper, 'aalb_credentials_enqueue_script' );
|
84 |
}
|
@@ -91,7 +104,7 @@ class Aalb_Manager {
|
|
91 |
public function execute() {
|
92 |
$this->hook_loader->execute();
|
93 |
$this->shortcode_loader->add_shortcode();
|
94 |
-
|
95 |
}
|
96 |
|
97 |
}
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\includes;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\shortcode\Shortcode_Manager;
|
17 |
+
use AmazonAssociatesLinkBuilder\shortcode\Shortcode_Loader;
|
18 |
+
use AmazonAssociatesLinkBuilder\includes\Hook_Loader;
|
19 |
+
use AmazonAssociatesLinkBuilder\io\Curl_Request;
|
20 |
+
use AmazonAssociatesLinkBuilder\io\File_System_Helper;
|
21 |
+
use AmazonAssociatesLinkBuilder\helper\Credentials_Helper;
|
22 |
+
use AmazonAssociatesLinkBuilder\ip2Country\Maxmind_Db_Manager;
|
23 |
+
use AmazonAssociatesLinkBuilder\admin\Plugin_Admin;
|
24 |
+
use AmazonAssociatesLinkBuilder\admin\sidebar\Sidebar;
|
25 |
+
use AmazonAssociatesLinkBuilder\rendering\Content_Filter;
|
26 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
27 |
|
28 |
/**
|
29 |
* The class that manages all the events of the wordpress.
|
32 |
* @package AmazonAssociatesLinkBuilder
|
33 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
34 |
*/
|
35 |
+
class Plugin_Manager {
|
36 |
|
37 |
protected $hook_loader;
|
38 |
protected $shortcode_loader;
|
39 |
protected $shortcode_manager;
|
40 |
|
41 |
public function __construct() {
|
42 |
+
$this->hook_loader = new Hook_Loader();
|
43 |
+
$this->shortcode_loader = new Shortcode_Loader();
|
44 |
+
$this->shortcode_manager = new Shortcode_Manager();
|
45 |
|
46 |
//add the hooks specific to admin.
|
47 |
$this->add_admin_hooks();
|
59 |
* @since 1.0.0
|
60 |
*/
|
61 |
private function add_admin_hooks() {
|
62 |
+
$plugin_admin = new Plugin_Admin();
|
63 |
+
$this->hook_loader->add_action( 'admin_print_footer_scripts', $plugin_admin, 'add_quicktags' );
|
64 |
+
$this->hook_loader->add_action( 'wp_ajax_get_item_search_result', $plugin_admin, 'get_item_search_result' );
|
65 |
+
$this->hook_loader->add_action( 'wp_ajax_get_link_code', $plugin_admin, 'get_link_code' );
|
66 |
+
$this->hook_loader->add_action( 'wp_ajax_get_custom_template_content', $plugin_admin, 'get_custom_template_content' );
|
67 |
+
$this->hook_loader->add_action( 'media_buttons', $plugin_admin, 'admin_display_callback' );
|
68 |
+
$this->hook_loader->add_action( 'admin_footer', $plugin_admin, 'admin_footer_callback' );
|
69 |
+
$this->hook_loader->add_action( 'plugins_loaded', $plugin_admin, 'check_update' );
|
70 |
+
|
71 |
+
$aalb_sidebar = new Sidebar();
|
72 |
$this->hook_loader->add_action( 'admin_init', $aalb_sidebar, 'register_cred_config_group' );
|
73 |
$this->hook_loader->add_action( 'admin_menu', $aalb_sidebar, 'register_sidebar_config_page' );
|
74 |
|
75 |
+
$maxmind_db_manager = new Maxmind_Db_Manager( get_option( Db_Constants::CUSTOM_UPLOAD_PATH ), new Curl_Request(), new File_System_Helper() );
|
76 |
$this->hook_loader->add_action( 'plugins_loaded', $maxmind_db_manager, 'update_db_if_required' );
|
77 |
}
|
78 |
|
91 |
* @since 1.4.12
|
92 |
*/
|
93 |
private function add_credentials_hooks() {
|
94 |
+
$credentials_helper = new Credentials_Helper();
|
95 |
$this->hook_loader->add_action( 'admin_enqueue_scripts', $credentials_helper, 'aalb_credentials_enqueue_style' );
|
96 |
$this->hook_loader->add_action( 'admin_enqueue_scripts', $credentials_helper, 'aalb_credentials_enqueue_script' );
|
97 |
}
|
104 |
public function execute() {
|
105 |
$this->hook_loader->execute();
|
106 |
$this->shortcode_loader->add_shortcode();
|
107 |
+
Content_Filter::attach();
|
108 |
}
|
109 |
|
110 |
}
|
includes/{aalb_remote_loader.php → remote_loader.php}
RENAMED
@@ -11,6 +11,11 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* Fired while making a GET request.
|
@@ -21,7 +26,7 @@ and limitations under the License.
|
|
21 |
* @package AmazonAssociatesLinkBuilder
|
22 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
23 |
*/
|
24 |
-
class
|
25 |
|
26 |
/**
|
27 |
* Load the information by making a GET request.
|
@@ -48,7 +53,7 @@ class Aalb_Remote_Loader {
|
|
48 |
* @return string GET Response.
|
49 |
*/
|
50 |
private function fetch( $url ) {
|
51 |
-
return wp_remote_get( $url, array( 'timeout' =>
|
52 |
}
|
53 |
|
54 |
/**
|
@@ -64,18 +69,18 @@ class Aalb_Remote_Loader {
|
|
64 |
private function verify( $response ) {
|
65 |
if ( is_wp_error( $response ) ) {
|
66 |
$error_message = $response->get_error_message();
|
67 |
-
if( strpos
|
68 |
-
throw new Exception(
|
69 |
}
|
70 |
-
throw new Exception( 'HTTP Request failed!' . $error_message );
|
71 |
}
|
72 |
$code = $response['response']['code'];
|
73 |
-
if ( $code !=
|
74 |
-
throw new Exception( $code );
|
75 |
}
|
76 |
$response_body = wp_remote_retrieve_body( $response );
|
77 |
if ( ! isset( $response_body ) || trim( $response_body ) === '' ) {
|
78 |
-
throw new Exception( 'Response body is empty' );
|
79 |
}
|
80 |
|
81 |
return $response_body;
|
@@ -86,7 +91,7 @@ class Aalb_Remote_Loader {
|
|
86 |
*
|
87 |
* @since 1.0.0
|
88 |
*
|
89 |
-
* @param string $url
|
90 |
* @param string $body Body of the POST request.
|
91 |
*
|
92 |
* @return string POST response body.
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\includes;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\constants\Paapi_Constants;
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
18 |
+
use AmazonAssociatesLinkBuilder\constants\HTTP_Constants;
|
19 |
|
20 |
/**
|
21 |
* Fired while making a GET request.
|
26 |
* @package AmazonAssociatesLinkBuilder
|
27 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
28 |
*/
|
29 |
+
class Remote_Loader {
|
30 |
|
31 |
/**
|
32 |
* Load the information by making a GET request.
|
53 |
* @return string GET Response.
|
54 |
*/
|
55 |
private function fetch( $url ) {
|
56 |
+
return wp_remote_get( $url, array( 'timeout' => Paapi_Constants::REQUEST_TIMEOUT ) );
|
57 |
}
|
58 |
|
59 |
/**
|
69 |
private function verify( $response ) {
|
70 |
if ( is_wp_error( $response ) ) {
|
71 |
$error_message = $response->get_error_message();
|
72 |
+
if ( strpos( $error_message, HTTP_Constants::CURL_ERROR_TIMEOUT_STRING ) !== false ) {
|
73 |
+
throw new \Exception( HTTP_Constants::TIME_OUT );
|
74 |
}
|
75 |
+
throw new \Exception( 'HTTP Request failed!' . $error_message );
|
76 |
}
|
77 |
$code = $response['response']['code'];
|
78 |
+
if ( $code != HTTP_Constants::SUCCESS ) {
|
79 |
+
throw new \Exception( $code );
|
80 |
}
|
81 |
$response_body = wp_remote_retrieve_body( $response );
|
82 |
if ( ! isset( $response_body ) || trim( $response_body ) === '' ) {
|
83 |
+
throw new \Exception( 'Response body is empty' );
|
84 |
}
|
85 |
|
86 |
return $response_body;
|
91 |
*
|
92 |
* @since 1.0.0
|
93 |
*
|
94 |
+
* @param string $url URL for making a request.
|
95 |
* @param string $body Body of the POST request.
|
96 |
*
|
97 |
* @return string POST response body.
|
io/{aalb_curl_request.php → curl_request.php}
RENAMED
@@ -11,6 +11,11 @@ either express or implied. See the License for the specific language governing p
|
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
/**
|
15 |
*
|
16 |
* Wrapper class over PHP curl Request
|
@@ -19,7 +24,7 @@ and limitations under the License.
|
|
19 |
* @package AmazonAssociatesLinkBuilder
|
20 |
* @subpackage AmazonAssociatesLinkBuilder/io
|
21 |
*/
|
22 |
-
class
|
23 |
|
24 |
/*
|
25 |
* Get last modified time of a file from a remote url
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
14 |
+
namespace AmazonAssociatesLinkBuilder\io;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\exceptions\Unexpected_Network_Response_Exception;
|
17 |
+
use AmazonAssociatesLinkBuilder\exceptions\Network_Call_Failure_Exception;
|
18 |
+
|
19 |
/**
|
20 |
*
|
21 |
* Wrapper class over PHP curl Request
|
24 |
* @package AmazonAssociatesLinkBuilder
|
25 |
* @subpackage AmazonAssociatesLinkBuilder/io
|
26 |
*/
|
27 |
+
class Curl_Request {
|
28 |
|
29 |
/*
|
30 |
* Get last modified time of a file from a remote url
|
io/{aalb_file_system_helper.php → file_system_helper.php}
RENAMED
@@ -11,6 +11,7 @@ either express or implied. See the License for the specific language governing p
|
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
|
|
14 |
/**
|
15 |
*
|
16 |
* I/O operation related to File System
|
@@ -20,7 +21,7 @@ and limitations under the License.
|
|
20 |
* @subpackage AmazonAssociatesLinkBuilder/io
|
21 |
*/
|
22 |
|
23 |
-
class
|
24 |
/*
|
25 |
* Write file to disk
|
26 |
*/
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
14 |
+
namespace AmazonAssociatesLinkBuilder\io;
|
15 |
/**
|
16 |
*
|
17 |
* I/O operation related to File System
|
21 |
* @subpackage AmazonAssociatesLinkBuilder/io
|
22 |
*/
|
23 |
|
24 |
+
class File_System_Helper {
|
25 |
/*
|
26 |
* Write file to disk
|
27 |
*/
|
ip2country/{aalb_customer_country.php → customer_country.php}
RENAMED
@@ -11,6 +11,13 @@ either express or implied. See the License for the specific language governing p
|
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
/**
|
15 |
*
|
16 |
* Gets the Country from which customer is coming using his IP Address
|
@@ -20,15 +27,13 @@ and limitations under the License.
|
|
20 |
* @subpackage AmazonAssociatesLinkBuilder/ip2country
|
21 |
*/
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
class Aalb_Customer_Country {
|
26 |
private $customer_ip_address;
|
27 |
private $helper;
|
28 |
|
29 |
public function __construct() {
|
30 |
-
$this->customer_ip_address = new
|
31 |
-
$this->helper = new
|
32 |
}
|
33 |
|
34 |
/**
|
@@ -48,8 +53,8 @@ class Aalb_Customer_Country {
|
|
48 |
$country_code = $record->country->isoCode;
|
49 |
//In the ISO code list, "GB" is used to refer to "UK" but since in Amazon we call it UK, so override that
|
50 |
$country_code = $country_code === "GB" ? "UK" : $country_code;
|
51 |
-
} catch ( Exception $e ) {
|
52 |
-
error_log( "
|
53 |
}
|
54 |
$reader->close();
|
55 |
}
|
@@ -71,8 +76,8 @@ class Aalb_Customer_Country {
|
|
71 |
if ( ! empty( $maxmind_db_file_path ) ) {
|
72 |
$reader = new Reader( $maxmind_db_file_path );
|
73 |
}
|
74 |
-
} catch ( Exception $e ) {
|
75 |
-
error_log( "
|
76 |
}
|
77 |
|
78 |
return $reader;
|
@@ -86,7 +91,7 @@ class Aalb_Customer_Country {
|
|
86 |
* @return String Maxmind db file name with complete path if file is readable else null
|
87 |
*/
|
88 |
private function get_maxmind_db_file_path() {
|
89 |
-
$maxmind_db_file_path = get_option(
|
90 |
|
91 |
return ( file_exists( $maxmind_db_file_path ) && is_readable( $maxmind_db_file_path ) ) ? $maxmind_db_file_path : null;
|
92 |
}
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
14 |
+
namespace AmazonAssociatesLinkBuilder\ip2Country;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\ip2Country\Customer_Ip_Address;
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
18 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
19 |
+
use AmazonAssociatesLinkBuilder\helper\Plugin_Helper;
|
20 |
+
use GeoIp2\Database\Reader;
|
21 |
/**
|
22 |
*
|
23 |
* Gets the Country from which customer is coming using his IP Address
|
27 |
* @subpackage AmazonAssociatesLinkBuilder/ip2country
|
28 |
*/
|
29 |
|
30 |
+
class Customer_Country {
|
|
|
|
|
31 |
private $customer_ip_address;
|
32 |
private $helper;
|
33 |
|
34 |
public function __construct() {
|
35 |
+
$this->customer_ip_address = new Customer_Ip_Address();
|
36 |
+
$this->helper = new Plugin_Helper();
|
37 |
}
|
38 |
|
39 |
/**
|
53 |
$country_code = $record->country->isoCode;
|
54 |
//In the ISO code list, "GB" is used to refer to "UK" but since in Amazon we call it UK, so override that
|
55 |
$country_code = $country_code === "GB" ? "UK" : $country_code;
|
56 |
+
} catch ( \Exception $e ) {
|
57 |
+
error_log( "Customer_Country:get_country_iso_code failed." . $e->getMessage() );
|
58 |
}
|
59 |
$reader->close();
|
60 |
}
|
76 |
if ( ! empty( $maxmind_db_file_path ) ) {
|
77 |
$reader = new Reader( $maxmind_db_file_path );
|
78 |
}
|
79 |
+
} catch ( \Exception $e ) {
|
80 |
+
error_log( "Customer_Country:get_reader failed." . $e->getMessage() );
|
81 |
}
|
82 |
|
83 |
return $reader;
|
91 |
* @return String Maxmind db file name with complete path if file is readable else null
|
92 |
*/
|
93 |
private function get_maxmind_db_file_path() {
|
94 |
+
$maxmind_db_file_path = get_option( Db_Constants::CUSTOM_UPLOAD_PATH ) . Plugin_Constants::MAXMIND_DATA_FILENAME;
|
95 |
|
96 |
return ( file_exists( $maxmind_db_file_path ) && is_readable( $maxmind_db_file_path ) ) ? $maxmind_db_file_path : null;
|
97 |
}
|
ip2country/{aalb_customer_ip_address.php → customer_ip_address.php}
RENAMED
@@ -11,6 +11,7 @@ either express or implied. See the License for the specific language governing p
|
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
|
|
14 |
/**
|
15 |
*
|
16 |
* Gets the IP Address of the customer
|
@@ -19,7 +20,7 @@ and limitations under the License.
|
|
19 |
* @package AmazonAssociatesLinkBuilder
|
20 |
* @subpackage AmazonAssociatesLinkBuilder/ip2country
|
21 |
*/
|
22 |
-
class
|
23 |
/**
|
24 |
* Gets the IP Address of the customer
|
25 |
*
|
@@ -63,8 +64,10 @@ class Aalb_Customer_Ip_Address {
|
|
63 |
private function standardize_ip_address( $ip_address ) {
|
64 |
$ip_address = trim( $ip_address );
|
65 |
$binary_representation = @inet_pton( $ip_address );
|
|
|
66 |
return empty( $binary_representation ) ? $ip_address : inet_ntop( $binary_representation );
|
67 |
}
|
68 |
|
69 |
}
|
|
|
70 |
?>
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
14 |
+
namespace AmazonAssociatesLinkBuilder\ip2Country;
|
15 |
/**
|
16 |
*
|
17 |
* Gets the IP Address of the customer
|
20 |
* @package AmazonAssociatesLinkBuilder
|
21 |
* @subpackage AmazonAssociatesLinkBuilder/ip2country
|
22 |
*/
|
23 |
+
class Customer_Ip_Address {
|
24 |
/**
|
25 |
* Gets the IP Address of the customer
|
26 |
*
|
64 |
private function standardize_ip_address( $ip_address ) {
|
65 |
$ip_address = trim( $ip_address );
|
66 |
$binary_representation = @inet_pton( $ip_address );
|
67 |
+
|
68 |
return empty( $binary_representation ) ? $ip_address : inet_ntop( $binary_representation );
|
69 |
}
|
70 |
|
71 |
}
|
72 |
+
|
73 |
?>
|
ip2country/{aalb_maxmind_db_manager.php → maxmind_db_manager.php}
RENAMED
@@ -12,6 +12,16 @@ either express or implied. See the License for the specific language governing p
|
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
/**
|
16 |
*
|
17 |
* Manages the operations related to maxmind GeoLite2Country database & maintains regular updates for the same
|
@@ -20,17 +30,17 @@ and limitations under the License.
|
|
20 |
* @package AmazonAssociatesLinkBuilder
|
21 |
* @subpackage AmazonAssociatesLinkBuilder/ip2country
|
22 |
*/
|
23 |
-
class
|
24 |
private $db_upload_dir;
|
25 |
private $db_file_path;
|
26 |
private $curl_request_obj;
|
27 |
private $file_system_helper;
|
28 |
|
29 |
-
public function __construct( $db_upload_dir,
|
30 |
$this->curl_request_obj = $curl_request_obj;
|
31 |
$this->file_system_helper = $file_system_helper;
|
32 |
$this->db_upload_dir = $db_upload_dir;
|
33 |
-
$this->db_file_path = $this->db_upload_dir .
|
34 |
clearstatcache( true, $this->db_file_path );
|
35 |
}
|
36 |
|
@@ -47,7 +57,7 @@ class Aalb_Maxmind_Db_Manager {
|
|
47 |
if ( ! is_writable( $this->db_upload_dir ) ) {
|
48 |
$error_msg = sprintf( esc_html__( "WordPress does not have permissions to write to the \"Downloads Folder\" (%s). Please grant permissions or pick a different folder from the Amazon Associates Link Builder plugin's settings page, otherwise your links to Amazon might not display correctly.", 'amazon-associates-link-builder' ), $this->db_upload_dir );
|
49 |
} else {
|
50 |
-
$error_msg = sprintf( __( "WordPress could not find file %1s at \"DownloadsFolder\"(%2s), so geo-targeted links will not work correctly. This file can be downloaded from <a href=%2s>here</a>", 'amazon-associates-link-builder' ),
|
51 |
}
|
52 |
} else {
|
53 |
if ( ! is_readable( $this->db_file_path ) ) {
|
@@ -56,7 +66,7 @@ class Aalb_Maxmind_Db_Manager {
|
|
56 |
if ( ! is_writable( $this->db_file_path ) ) {
|
57 |
$error_msg = sprintf( __( "WordPress does not have write permissions to update the file(%s). Please grant write permissions, otherwise geo-targeted links may not work correctly.", 'amazon-associates-link-builder' ), $this->db_file_path );
|
58 |
} else {
|
59 |
-
$error_msg = sprintf( __( "WordPress could not update file(%1s) for geo-targeted links feature, so these links may not work correctly. This file can be downloaded from <a href=%2s>here</a>", 'amazon-associates-link-builder' ), $this->db_file_path,
|
60 |
}
|
61 |
}
|
62 |
}
|
@@ -87,11 +97,11 @@ class Aalb_Maxmind_Db_Manager {
|
|
87 |
try {
|
88 |
if ( $this->is_file_update_permissible() ) {
|
89 |
$this->reset_db_keys_if_required();
|
90 |
-
if ( time() >= get_option(
|
91 |
if ( $this->should_update_db() ) {
|
92 |
$this->update_db();
|
93 |
}
|
94 |
-
$this->update_next_retry_time(
|
95 |
|
96 |
}
|
97 |
}
|
@@ -99,7 +109,7 @@ class Aalb_Maxmind_Db_Manager {
|
|
99 |
$this->action_on_update_db_failure( $e->errorMessage() );
|
100 |
} catch ( Unexpected_Network_Response_Exception $e ) {
|
101 |
$this->action_on_update_db_failure( $e->errorMessage() );
|
102 |
-
} catch ( Exception $e ) {
|
103 |
$this->action_on_update_db_failure( "Unexpected Exception Ocurred" . $e->getMessage() );
|
104 |
}
|
105 |
}
|
@@ -115,7 +125,7 @@ class Aalb_Maxmind_Db_Manager {
|
|
115 |
*
|
116 |
*/
|
117 |
private function update_db() {
|
118 |
-
$tmp_file = $this->curl_request_obj->download_file_to_temporary_file(
|
119 |
$this->file_system_helper->write_a_gzipped_file_to_disk( $this->db_file_path, $tmp_file );
|
120 |
}
|
121 |
|
@@ -123,7 +133,7 @@ class Aalb_Maxmind_Db_Manager {
|
|
123 |
/**
|
124 |
* It logs the error message and updates next retry time
|
125 |
*
|
126 |
-
* @param String Error message
|
127 |
*
|
128 |
*
|
129 |
* @since 1.5.3
|
@@ -131,7 +141,7 @@ class Aalb_Maxmind_Db_Manager {
|
|
131 |
**/
|
132 |
private function action_on_update_db_failure( $error_msg ) {
|
133 |
$this->log_error( $error_msg );
|
134 |
-
$this->update_next_retry_time(
|
135 |
}
|
136 |
|
137 |
/*
|
@@ -142,8 +152,8 @@ class Aalb_Maxmind_Db_Manager {
|
|
142 |
*/
|
143 |
private function reset_db_keys_if_required() {
|
144 |
if ( $this->is_upload_path_changed() ) {
|
145 |
-
update_option(
|
146 |
-
update_option(
|
147 |
$this->reset_failure_counters();
|
148 |
}
|
149 |
}
|
@@ -171,7 +181,7 @@ class Aalb_Maxmind_Db_Manager {
|
|
171 |
*
|
172 |
*/
|
173 |
private function is_upload_path_changed() {
|
174 |
-
return $this->db_upload_dir !== get_option(
|
175 |
}
|
176 |
|
177 |
/*
|
@@ -193,7 +203,7 @@ class Aalb_Maxmind_Db_Manager {
|
|
193 |
* @return bool True if geolite db's newer version is available
|
194 |
*/
|
195 |
private function is_updated_version_available() {
|
196 |
-
return strtotime( $this->curl_request_obj->get_last_modified_date_of_remote_file(
|
197 |
}
|
198 |
|
199 |
/**
|
@@ -205,11 +215,11 @@ class Aalb_Maxmind_Db_Manager {
|
|
205 |
*
|
206 |
*/
|
207 |
private function update_next_retry_time( $status ) {
|
208 |
-
if ( $status ==
|
209 |
-
update_option(
|
210 |
$this->reset_failure_counters();
|
211 |
} else {
|
212 |
-
update_option(
|
213 |
}
|
214 |
}
|
215 |
|
@@ -220,13 +230,13 @@ class Aalb_Maxmind_Db_Manager {
|
|
220 |
*
|
221 |
*/
|
222 |
private function get_next_retry_duration() {
|
223 |
-
$number_of_failed_attempts = get_option(
|
224 |
$new_retry_duration = AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_MIN * pow( 2, $number_of_failed_attempts );
|
225 |
if ( $new_retry_duration > AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_MAX ) {
|
226 |
$new_retry_duration = AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_MAX;
|
227 |
}
|
228 |
-
update_option(
|
229 |
-
update_option(
|
230 |
|
231 |
return $new_retry_duration;
|
232 |
}
|
@@ -238,8 +248,8 @@ class Aalb_Maxmind_Db_Manager {
|
|
238 |
*
|
239 |
*/
|
240 |
private function reset_failure_counters() {
|
241 |
-
update_option(
|
242 |
-
update_option(
|
243 |
}
|
244 |
|
245 |
/*
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
15 |
+
namespace AmazonAssociatesLinkBuilder\ip2Country;
|
16 |
+
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Library_Endpoints;
|
18 |
+
use AmazonAssociatesLinkBuilder\io\Curl_Request;
|
19 |
+
use AmazonAssociatesLinkBuilder\io\File_System_Helper;
|
20 |
+
use AmazonAssociatesLinkBuilder\exceptions\Unexpected_Network_Response_Exception;
|
21 |
+
use AmazonAssociatesLinkBuilder\exceptions\Network_Call_Failure_Exception;
|
22 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
23 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
24 |
+
|
25 |
/**
|
26 |
*
|
27 |
* Manages the operations related to maxmind GeoLite2Country database & maintains regular updates for the same
|
30 |
* @package AmazonAssociatesLinkBuilder
|
31 |
* @subpackage AmazonAssociatesLinkBuilder/ip2country
|
32 |
*/
|
33 |
+
class Maxmind_Db_Manager {
|
34 |
private $db_upload_dir;
|
35 |
private $db_file_path;
|
36 |
private $curl_request_obj;
|
37 |
private $file_system_helper;
|
38 |
|
39 |
+
public function __construct( $db_upload_dir, Curl_Request $curl_request_obj, File_System_Helper $file_system_helper ) {
|
40 |
$this->curl_request_obj = $curl_request_obj;
|
41 |
$this->file_system_helper = $file_system_helper;
|
42 |
$this->db_upload_dir = $db_upload_dir;
|
43 |
+
$this->db_file_path = $this->db_upload_dir . Plugin_Constants::MAXMIND_DATA_FILENAME;
|
44 |
clearstatcache( true, $this->db_file_path );
|
45 |
}
|
46 |
|
57 |
if ( ! is_writable( $this->db_upload_dir ) ) {
|
58 |
$error_msg = sprintf( esc_html__( "WordPress does not have permissions to write to the \"Downloads Folder\" (%s). Please grant permissions or pick a different folder from the Amazon Associates Link Builder plugin's settings page, otherwise your links to Amazon might not display correctly.", 'amazon-associates-link-builder' ), $this->db_upload_dir );
|
59 |
} else {
|
60 |
+
$error_msg = sprintf( __( "WordPress could not find file %1s at \"DownloadsFolder\"(%2s), so geo-targeted links will not work correctly. This file can be downloaded from <a href=%2s>here</a>", 'amazon-associates-link-builder' ), Plugin_Constants::MAXMIND_DATA_FILENAME, $this->db_upload_dir, Library_Endpoints::GEOLITE_DB_DOWNLOAD_URL_FROM_MAXMIND_SERVER );
|
61 |
}
|
62 |
} else {
|
63 |
if ( ! is_readable( $this->db_file_path ) ) {
|
66 |
if ( ! is_writable( $this->db_file_path ) ) {
|
67 |
$error_msg = sprintf( __( "WordPress does not have write permissions to update the file(%s). Please grant write permissions, otherwise geo-targeted links may not work correctly.", 'amazon-associates-link-builder' ), $this->db_file_path );
|
68 |
} else {
|
69 |
+
$error_msg = sprintf( __( "WordPress could not update file(%1s) for geo-targeted links feature, so these links may not work correctly. This file can be downloaded from <a href=%2s>here</a>", 'amazon-associates-link-builder' ), $this->db_file_path, Library_Endpoints::GEOLITE_DB_DOWNLOAD_URL_FROM_MAXMIND_SERVER );
|
70 |
}
|
71 |
}
|
72 |
}
|
97 |
try {
|
98 |
if ( $this->is_file_update_permissible() ) {
|
99 |
$this->reset_db_keys_if_required();
|
100 |
+
if ( time() >= get_option( Db_Constants::GEOLITE_DB_DOWNLOAD_NEXT_RETRY_TIME ) ) {
|
101 |
if ( $this->should_update_db() ) {
|
102 |
$this->update_db();
|
103 |
}
|
104 |
+
$this->update_next_retry_time( Plugin_Constants::SUCCESS );
|
105 |
|
106 |
}
|
107 |
}
|
109 |
$this->action_on_update_db_failure( $e->errorMessage() );
|
110 |
} catch ( Unexpected_Network_Response_Exception $e ) {
|
111 |
$this->action_on_update_db_failure( $e->errorMessage() );
|
112 |
+
} catch ( \Exception $e ) {
|
113 |
$this->action_on_update_db_failure( "Unexpected Exception Ocurred" . $e->getMessage() );
|
114 |
}
|
115 |
}
|
125 |
*
|
126 |
*/
|
127 |
private function update_db() {
|
128 |
+
$tmp_file = $this->curl_request_obj->download_file_to_temporary_file( Library_Endpoints::GEOLITE_COUNTRY_DB_DOWNLOAD_URL );
|
129 |
$this->file_system_helper->write_a_gzipped_file_to_disk( $this->db_file_path, $tmp_file );
|
130 |
}
|
131 |
|
133 |
/**
|
134 |
* It logs the error message and updates next retry time
|
135 |
*
|
136 |
+
* @param \String Error message
|
137 |
*
|
138 |
*
|
139 |
* @since 1.5.3
|
141 |
**/
|
142 |
private function action_on_update_db_failure( $error_msg ) {
|
143 |
$this->log_error( $error_msg );
|
144 |
+
$this->update_next_retry_time( Plugin_Constants::FAIL );
|
145 |
}
|
146 |
|
147 |
/*
|
152 |
*/
|
153 |
private function reset_db_keys_if_required() {
|
154 |
if ( $this->is_upload_path_changed() ) {
|
155 |
+
update_option( Db_Constants::MAXMIND_DB_LAST_UPLOAD_PATH, $this->db_upload_dir );
|
156 |
+
update_option( Db_Constants::GEOLITE_DB_DOWNLOAD_NEXT_RETRY_TIME, 0 );
|
157 |
$this->reset_failure_counters();
|
158 |
}
|
159 |
}
|
181 |
*
|
182 |
*/
|
183 |
private function is_upload_path_changed() {
|
184 |
+
return $this->db_upload_dir !== get_option( Db_Constants::MAXMIND_DB_LAST_UPLOAD_PATH );
|
185 |
}
|
186 |
|
187 |
/*
|
203 |
* @return bool True if geolite db's newer version is available
|
204 |
*/
|
205 |
private function is_updated_version_available() {
|
206 |
+
return strtotime( $this->curl_request_obj->get_last_modified_date_of_remote_file( Library_Endpoints::GEOLITE_COUNTRY_DB_DOWNLOAD_URL ) ) > filemtime( $this->db_file_path );
|
207 |
}
|
208 |
|
209 |
/**
|
215 |
*
|
216 |
*/
|
217 |
private function update_next_retry_time( $status ) {
|
218 |
+
if ( $status == Plugin_Constants::SUCCESS ) {
|
219 |
+
update_option( Db_Constants::GEOLITE_DB_DOWNLOAD_NEXT_RETRY_TIME, time() + AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_ON_SUCCESS );
|
220 |
$this->reset_failure_counters();
|
221 |
} else {
|
222 |
+
update_option( Db_Constants::GEOLITE_DB_DOWNLOAD_NEXT_RETRY_TIME, time() + $this->get_next_retry_duration() );
|
223 |
}
|
224 |
}
|
225 |
|
230 |
*
|
231 |
*/
|
232 |
private function get_next_retry_duration() {
|
233 |
+
$number_of_failed_attempts = get_option( Db_Constants::GEOLITE_DB_DOWNLOAD_FAILED_ATTEMPTS );
|
234 |
$new_retry_duration = AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_MIN * pow( 2, $number_of_failed_attempts );
|
235 |
if ( $new_retry_duration > AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_MAX ) {
|
236 |
$new_retry_duration = AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_MAX;
|
237 |
}
|
238 |
+
update_option( Db_Constants::GEOLITE_DB_DOWNLOAD_FAILED_ATTEMPTS, $number_of_failed_attempts + 1 );
|
239 |
+
update_option( Db_Constants::GEOLITE_DB_DOWNLOAD_RETRY_ON_FAILURE_DURATION, $new_retry_duration );
|
240 |
|
241 |
return $new_retry_duration;
|
242 |
}
|
248 |
*
|
249 |
*/
|
250 |
private function reset_failure_counters() {
|
251 |
+
update_option( Db_Constants::GEOLITE_DB_DOWNLOAD_RETRY_ON_FAILURE_DURATION, AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_MIN );
|
252 |
+
update_option( Db_Constants::GEOLITE_DB_DOWNLOAD_FAILED_ATTEMPTS, 0 );
|
253 |
}
|
254 |
|
255 |
/*
|
{admin/js → js}/aalb_admin.js
RENAMED
@@ -31,10 +31,10 @@ var aalb_admin_object = (function( $ ) {
|
|
31 |
var link_id = "";
|
32 |
var marketplace_store_id_mapping = $.parseJSON( api_pref.marketplace_store_id_map );
|
33 |
var default_marketplace = api_pref.default_marketplace;
|
34 |
-
var default_store_id_list = marketplace_store_id_mapping[ default_marketplace ]
|
35 |
-
var default_store_id = default_store_id_list[ 0 ]
|
36 |
var tabs = "";
|
37 |
-
//tab_counter will be appended to the new tab's id(#aalb_tab2) and will be incremented in code on every new tab addition. 1 is already assigned to
|
38 |
var tab_counter = 2;
|
39 |
var marketplace_pop_up_json = [];
|
40 |
var keyword_for_search = "";
|
31 |
var link_id = "";
|
32 |
var marketplace_store_id_mapping = $.parseJSON( api_pref.marketplace_store_id_map );
|
33 |
var default_marketplace = api_pref.default_marketplace;
|
34 |
+
var default_store_id_list = (marketplace_store_id_mapping && marketplace_store_id_mapping[ default_marketplace ]) ? marketplace_store_id_mapping[ default_marketplace ] : [];
|
35 |
+
var default_store_id = (default_store_id_list.length !== 0) ? default_store_id_list[ 0 ] : "";
|
36 |
var tabs = "";
|
37 |
+
//tab_counter will be appended to the new tab's id(#aalb_tab2) and will be incremented in code on every new tab addition. 1 is already assigned to defaxlt marketplace tab
|
38 |
var tab_counter = 2;
|
39 |
var marketplace_pop_up_json = [];
|
40 |
var keyword_for_search = "";
|
{admin/sidebar/js → js}/aalb_credentials.js
RENAMED
@@ -44,6 +44,9 @@ var aalb_credentials_object = (function( $ ) {
|
|
44 |
"add_a_marketplace_label" : aalb_cred_strings.add_a_marketplace_label
|
45 |
};
|
46 |
$( function() {
|
|
|
|
|
|
|
47 |
load_store_id_settings_section();
|
48 |
|
49 |
$( '#aalb-terms-checkbox' ).click( function() {
|
44 |
"add_a_marketplace_label" : aalb_cred_strings.add_a_marketplace_label
|
45 |
};
|
46 |
$( function() {
|
47 |
+
if( marketplace_list == "" ) {
|
48 |
+
show_dismissable_error_message( aalb_cred_strings.marketplace_list_empty_error );
|
49 |
+
}
|
50 |
load_store_id_settings_section();
|
51 |
|
52 |
$( '#aalb-terms-checkbox' ).click( function() {
|
{admin/sidebar/js → js}/aalb_template.js
RENAMED
File without changes
|
languages/amazon-associates-link-builder-es_ES.mo
CHANGED
Binary file
|
languages/amazon-associates-link-builder-es_ES.po
CHANGED
@@ -1,203 +1,19 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
-
"PO-Revision-Date:
|
4 |
"MIME-Version: 1.0\n"
|
5 |
"Content-Type: text/plain; charset=UTF-8\n"
|
6 |
"Content-Transfer-Encoding: 8bit\n"
|
7 |
-
"Plural-Forms: nplurals=2; plural=n != 1
|
8 |
-
"X-Generator: Loco
|
9 |
-
"Language:
|
10 |
"Project-Id-Version: Plugins - Amazon Associates Link Builder - Development "
|
11 |
"(trunk)\n"
|
12 |
-
"POT-Creation-Date:
|
13 |
-
"Last-Translator:
|
14 |
"Language-Team: Spanish (Spain)\n"
|
15 |
"Report-Msgid-Bugs-To: "
|
16 |
|
17 |
-
#: admin/aalb_admin.php:132
|
18 |
-
msgid "Please select at least one product for these marketplaces:"
|
19 |
-
msgstr ""
|
20 |
-
|
21 |
-
#. %s: URL of settings page
|
22 |
-
#: admin/aalb_admin.php:141
|
23 |
-
#, php-format
|
24 |
-
msgid ""
|
25 |
-
"Please configure your Store-Id credentials in the <a href=%s>Settings "
|
26 |
-
"Page</a> to use the Link Builder features."
|
27 |
-
msgstr ""
|
28 |
-
|
29 |
-
#: admin/aalb_admin.php:145
|
30 |
-
msgid "Tracking IDs"
|
31 |
-
msgstr ""
|
32 |
-
|
33 |
-
#: admin/aalb_admin.php:146
|
34 |
-
msgid "Search Phrase"
|
35 |
-
msgstr ""
|
36 |
-
|
37 |
-
#: admin/aalb_admin.php:147
|
38 |
-
msgid "Select Tracking Id"
|
39 |
-
msgstr ""
|
40 |
-
|
41 |
-
#: admin/aalb_admin.php:149
|
42 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:56
|
43 |
-
msgid "Select Marketplace"
|
44 |
-
msgstr ""
|
45 |
-
|
46 |
-
#: admin/aalb_admin.php:153
|
47 |
-
msgid "List of Selected Products(Maximum: 10)"
|
48 |
-
msgstr ""
|
49 |
-
|
50 |
-
#: admin/aalb_admin.php:156
|
51 |
-
msgid ""
|
52 |
-
"To configure templates, go to Associates Link Builder plugin's Templates page"
|
53 |
-
msgstr ""
|
54 |
-
|
55 |
-
#: admin/aalb_admin.php:157
|
56 |
-
msgid ""
|
57 |
-
"To configure marketplaces, go to Associates Link Builder plugin's Settings "
|
58 |
-
"page"
|
59 |
-
msgstr ""
|
60 |
-
|
61 |
-
#: admin/aalb_admin.php:158
|
62 |
-
msgid ""
|
63 |
-
"To configure tracking ids, go to Associates Link Builder plugin's Settings "
|
64 |
-
"page"
|
65 |
-
msgstr ""
|
66 |
-
|
67 |
-
#: admin/aalb_admin.php:159
|
68 |
-
msgid "Please select marketplace from above to show products."
|
69 |
-
msgstr ""
|
70 |
-
|
71 |
-
#: admin/aalb_admin.php:160
|
72 |
-
msgid "Please select some products from above."
|
73 |
-
msgstr ""
|
74 |
-
|
75 |
-
#: admin/aalb_admin.php:161
|
76 |
-
msgid "Add ProductSet for Country"
|
77 |
-
msgstr ""
|
78 |
-
|
79 |
-
#: ip2country/aalb_customer_country.php:98
|
80 |
-
#, php-format
|
81 |
-
msgid ""
|
82 |
-
"Maxmind DB file doesn't exist or is not readable. Please check & give "
|
83 |
-
"appropriate read & write permissions to:%s. Go to plugin's Settings page for "
|
84 |
-
"more details."
|
85 |
-
msgstr ""
|
86 |
-
|
87 |
-
#: shortcode/aalb_shortcode_manager.php:83
|
88 |
-
msgid ""
|
89 |
-
"There is an error in the count of configured marketplaces, asins and stores "
|
90 |
-
"in this shortcode. Please fix the parameters for marketplace, asin and store-"
|
91 |
-
"id."
|
92 |
-
msgstr ""
|
93 |
-
|
94 |
-
#: admin/sidebar/partials/aalb_credentials.php:26
|
95 |
-
msgid "Are you sure you want to remove this marketplace?"
|
96 |
-
msgstr ""
|
97 |
-
|
98 |
-
#: admin/sidebar/partials/aalb_credentials.php:29
|
99 |
-
msgid "YES"
|
100 |
-
msgstr ""
|
101 |
-
|
102 |
-
#: admin/sidebar/partials/aalb_credentials.php:30
|
103 |
-
msgid "NO"
|
104 |
-
msgstr ""
|
105 |
-
|
106 |
-
#: admin/sidebar/partials/aalb_credentials.php:91
|
107 |
-
msgid "Downloads Folder"
|
108 |
-
msgstr ""
|
109 |
-
|
110 |
-
#: admin/sidebar/partials/aalb_credentials.php:97
|
111 |
-
#, php-format
|
112 |
-
msgid ""
|
113 |
-
"This folder will be used to save files downloaded by the plugin (e.g. <a "
|
114 |
-
"href=%1s target=%2s>The MaxMind IP2Country Database</a>) for local use. "
|
115 |
-
"Absolute path required. <br><span class=\"aalb-bold\"> Default value:</span> "
|
116 |
-
"*blank*, defaults to <code>wp_upload_dir()['basedir'] + '%3s'</code>"
|
117 |
-
msgstr ""
|
118 |
-
|
119 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:54
|
120 |
-
msgid "Enter Tracking Id(s)"
|
121 |
-
msgstr ""
|
122 |
-
|
123 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:55
|
124 |
-
msgid "Remove Marketplace"
|
125 |
-
msgstr ""
|
126 |
-
|
127 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:58
|
128 |
-
msgid "Set As Default Marketplace"
|
129 |
-
msgstr ""
|
130 |
-
|
131 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:60
|
132 |
-
msgid "Add a Marketplace"
|
133 |
-
msgstr ""
|
134 |
-
|
135 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:61
|
136 |
-
msgid "Remove Marketplace Confirmation"
|
137 |
-
msgstr ""
|
138 |
-
|
139 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:62
|
140 |
-
msgid "ERROR: No store id has been entered for one or more marketplaces."
|
141 |
-
msgstr ""
|
142 |
-
|
143 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:63
|
144 |
-
msgid ""
|
145 |
-
"ERROR: A marketplace already exists with this value. Please set a new "
|
146 |
-
"marketplace."
|
147 |
-
msgstr ""
|
148 |
-
|
149 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:64
|
150 |
-
msgid ""
|
151 |
-
"ERROR: A marketplace is present that has not been set. Please set that first."
|
152 |
-
msgstr ""
|
153 |
-
|
154 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:65
|
155 |
-
msgid ""
|
156 |
-
"ERROR: You need to maintain at least one marketplace entry for tracking ids "
|
157 |
-
msgstr ""
|
158 |
-
|
159 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:66
|
160 |
-
msgid "ERROR: You need to add at least one marketplace entry for tracking ids "
|
161 |
-
msgstr ""
|
162 |
-
|
163 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:67
|
164 |
-
msgid "Add a Marketplace that you want to create Amazon links to."
|
165 |
-
msgstr ""
|
166 |
-
|
167 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:68
|
168 |
-
msgid ""
|
169 |
-
"For each marketplace you can add multiple tracking ids, separated by commas. "
|
170 |
-
"The first tracking id will be considered as default tracking id for that "
|
171 |
-
"marketplace."
|
172 |
-
msgstr ""
|
173 |
-
|
174 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:121
|
175 |
-
#, php-format
|
176 |
-
msgid ""
|
177 |
-
"The file used to fetch country details to enable geo-targetted links doesn't "
|
178 |
-
"have read permissions. Please give recursive read/write permissons to:%s. In "
|
179 |
-
"case you are still facing the issue, please change download folder in Site "
|
180 |
-
"Wide Settings section on this page."
|
181 |
-
msgstr ""
|
182 |
-
|
183 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:123
|
184 |
-
#, php-format
|
185 |
-
msgid ""
|
186 |
-
"The file used to fetch country details to enable geo-targetted links doesn't "
|
187 |
-
"have write permissions. Please give recursive read/write permissons to:%s. "
|
188 |
-
"In case you are still facing the issue, please change download folder in "
|
189 |
-
"Site Wide Settings section on this page"
|
190 |
-
msgstr ""
|
191 |
-
|
192 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:125
|
193 |
-
#, php-format
|
194 |
-
msgid ""
|
195 |
-
"The directory where the file used to fetch country details to enable geo-"
|
196 |
-
"targetted links doesn't have write permissions. Please give recursive "
|
197 |
-
"read/write permissons to:%s. In case you are still facing the issue, please "
|
198 |
-
"change download folder in Site Wide Settings section on this page"
|
199 |
-
msgstr ""
|
200 |
-
|
201 |
#: amazon-associates-link-builder.php:39 admin/sidebar/aalb_sidebar.php:35
|
202 |
msgid "About"
|
203 |
msgstr "Acerca de"
|
@@ -210,15 +26,19 @@ msgstr "Ajustes"
|
|
210 |
msgid "Templates"
|
211 |
msgstr "Plantillas"
|
212 |
|
213 |
-
#: admin/aalb_admin.php:
|
214 |
msgid "Only one product can be selected for this template"
|
215 |
msgstr "En esta plantilla solo se permite seleccionar un producto"
|
216 |
|
217 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
218 |
msgid "Please Enter a Product Name "
|
219 |
msgstr "Por favor, introduce un nombre de producto "
|
220 |
|
221 |
-
#: admin/aalb_admin.php:
|
222 |
msgid ""
|
223 |
"Failed to create Text Link shortcode. Editor has some text selected. Only "
|
224 |
"one item can be selected while adding text links"
|
@@ -228,7 +48,7 @@ msgstr ""
|
|
228 |
"de texto"
|
229 |
|
230 |
#. translators: %s: Email-id of the support
|
231 |
-
#: admin/aalb_admin.php:
|
232 |
#, php-format
|
233 |
msgid ""
|
234 |
"Request timed out. Try again after some time. Please check your network and "
|
@@ -238,12 +58,12 @@ msgstr ""
|
|
238 |
"minutos. Te rogamos que compruebes tu conexión y la configuración de tu "
|
239 |
"firewall. Si el problema persiste, escríbenos a %s."
|
240 |
|
241 |
-
#: admin/aalb_admin.php:
|
242 |
msgid "Add Amazon Associates Link Builder Shortcode"
|
243 |
msgstr "Añadir ‘shortcode’ del Creador de enlaces para Afiliados de Amazon"
|
244 |
|
245 |
#. translators: %s: URL of settings page
|
246 |
-
#: admin/aalb_admin.php:
|
247 |
#, php-format
|
248 |
msgid ""
|
249 |
"Please configure your PA-API credentials in the <a href=%s>Settings Page</a>"
|
@@ -252,43 +72,101 @@ msgstr ""
|
|
252 |
"Por favor, configura tus credenciales de la PA-API en la <a href=%s>Página "
|
253 |
"de Ajustes</a> para usar las funciones del Creador de enlaces."
|
254 |
|
255 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
msgid "Ad Template"
|
257 |
msgstr "Plantilla de anuncio"
|
258 |
|
259 |
-
#: admin/aalb_admin.php:
|
260 |
msgid "Enter keyword(s)"
|
261 |
msgstr "Introduce palabra(s) clave"
|
262 |
|
263 |
-
#: admin/aalb_admin.php:
|
264 |
msgid "Search"
|
265 |
msgstr "Buscar"
|
266 |
|
267 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
msgid "Marketplace"
|
269 |
msgstr "Mercado"
|
270 |
|
271 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
|
|
272 |
msgid "Searching relevant products from Amazon"
|
273 |
msgstr "Buscando productos adecuados en Amazon"
|
274 |
|
275 |
-
#: admin/aalb_admin.php:
|
276 |
msgid "Click to select product(s) to advertise"
|
277 |
msgstr "Haz clic para seleccionar los productos a anunciar"
|
278 |
|
279 |
-
#: admin/aalb_admin.php:
|
280 |
msgid "Check more search results on Amazon"
|
281 |
msgstr "Encuentra más resultados de búsqueda en Amazon"
|
282 |
|
283 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
284 |
msgid "Creating shortcode. Please wait...."
|
285 |
msgstr "Creando ‘shortcode’. Por favor, espera…"
|
286 |
|
287 |
-
#: admin/aalb_admin.php:
|
288 |
msgid "Add Shortcode"
|
289 |
msgstr "Añadir ‘shortcode’"
|
290 |
|
291 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
msgid ""
|
293 |
"Not authorised to make request template content or Directory Traversal "
|
294 |
"Attempted."
|
@@ -296,19 +174,48 @@ msgstr ""
|
|
296 |
"No estás autorizado para hacer una petición plantilla contenido o Directory "
|
297 |
"Traversal Attempted."
|
298 |
|
299 |
-
#: admin/aalb_admin.php:
|
300 |
msgid "Not authorised to make request"
|
301 |
msgstr "Falta autorización para realizar esta petición"
|
302 |
|
303 |
-
|
304 |
-
#: includes/aalb_remote_loader.php:71
|
305 |
#, php-format
|
306 |
-
msgid "
|
307 |
-
|
|
|
|
|
|
|
|
|
308 |
|
309 |
-
#:
|
310 |
-
|
311 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
|
313 |
#. translators: %s: Invalid ASIN name
|
314 |
#: shortcode/aalb_shortcode_helper.php:144
|
@@ -335,6 +242,13 @@ msgstr ""
|
|
335 |
"Afiliado se ha actualizado a %2s. Por favor, comprueba tu selección de tags "
|
336 |
"o contacta con el administrador para añadir uno nuevo."
|
337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
#: admin/sidebar/aalb_sidebar.php:31 admin/sidebar/partials/aalb_about.php:17
|
339 |
msgid "Associates Link Builder"
|
340 |
msgstr "Associates Link Builder"
|
@@ -627,6 +541,18 @@ msgid "We <b>recommend</b> using HTTPs connection for improved security."
|
|
627 |
msgstr ""
|
628 |
"Te <b>recomendamos</b> usar una conexión HTTPs para una mayor seguridad."
|
629 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
630 |
#: admin/sidebar/partials/aalb_credentials.php:36
|
631 |
msgid "Settings for Associates Link Builder"
|
632 |
msgstr "Ajustes para el Creador de enlaces para Afiliados"
|
@@ -647,6 +573,19 @@ msgstr ""
|
|
647 |
"Es la plantilla publicitaria que se utilizará para representar el anuncio si "
|
648 |
"en el ‘shortcode’ no se especifica una plantilla concreta."
|
649 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
650 |
#. translators: %s: rel="noreferrer" attribute
|
651 |
#: admin/sidebar/partials/aalb_credentials.php:106
|
652 |
#, php-format
|
@@ -938,14 +877,69 @@ msgstr ""
|
|
938 |
"conexión y la configuración de tu firewall. Si el problema persiste, "
|
939 |
"escríbenos a %s."
|
940 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
941 |
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:57
|
942 |
msgid "Default Marketplace"
|
943 |
msgstr "Mercado por defecto"
|
944 |
|
|
|
|
|
|
|
|
|
945 |
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:59
|
946 |
msgid "Tracking Id(s)"
|
947 |
msgstr "ID de seguimiento"
|
948 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
949 |
#. Plugin Name of the plugin/theme
|
950 |
msgid "Amazon Associates Link Builder"
|
951 |
msgstr "Amazon Associates Link Builder"
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
+
"PO-Revision-Date: 2018-02-27 07:06+0000\n"
|
4 |
"MIME-Version: 1.0\n"
|
5 |
"Content-Type: text/plain; charset=UTF-8\n"
|
6 |
"Content-Transfer-Encoding: 8bit\n"
|
7 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
8 |
+
"X-Generator: Loco https://localise.biz/\n"
|
9 |
+
"Language: es_ES\n"
|
10 |
"Project-Id-Version: Plugins - Amazon Associates Link Builder - Development "
|
11 |
"(trunk)\n"
|
12 |
+
"POT-Creation-Date: 2018-02-27 07:04+0000\n"
|
13 |
+
"Last-Translator: root <nishgarg@amazon.com>\n"
|
14 |
"Language-Team: Spanish (Spain)\n"
|
15 |
"Report-Msgid-Bugs-To: "
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
#: amazon-associates-link-builder.php:39 admin/sidebar/aalb_sidebar.php:35
|
18 |
msgid "About"
|
19 |
msgstr "Acerca de"
|
26 |
msgid "Templates"
|
27 |
msgstr "Plantillas"
|
28 |
|
29 |
+
#: admin/aalb_admin.php:129
|
30 |
msgid "Only one product can be selected for this template"
|
31 |
msgstr "En esta plantilla solo se permite seleccionar un producto"
|
32 |
|
33 |
+
#: admin/aalb_admin.php:130
|
34 |
+
msgid "Please select at least one product for these marketplaces:"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: admin/aalb_admin.php:131
|
38 |
msgid "Please Enter a Product Name "
|
39 |
msgstr "Por favor, introduce un nombre de producto "
|
40 |
|
41 |
+
#: admin/aalb_admin.php:132
|
42 |
msgid ""
|
43 |
"Failed to create Text Link shortcode. Editor has some text selected. Only "
|
44 |
"one item can be selected while adding text links"
|
48 |
"de texto"
|
49 |
|
50 |
#. translators: %s: Email-id of the support
|
51 |
+
#: admin/aalb_admin.php:134
|
52 |
#, php-format
|
53 |
msgid ""
|
54 |
"Request timed out. Try again after some time. Please check your network and "
|
58 |
"minutos. Te rogamos que compruebes tu conexión y la configuración de tu "
|
59 |
"firewall. Si el problema persiste, escríbenos a %s."
|
60 |
|
61 |
+
#: admin/aalb_admin.php:135 admin/partials/aalb_editor_search_box.php:32
|
62 |
msgid "Add Amazon Associates Link Builder Shortcode"
|
63 |
msgstr "Añadir ‘shortcode’ del Creador de enlaces para Afiliados de Amazon"
|
64 |
|
65 |
#. translators: %s: URL of settings page
|
66 |
+
#: admin/aalb_admin.php:137
|
67 |
#, php-format
|
68 |
msgid ""
|
69 |
"Please configure your PA-API credentials in the <a href=%s>Settings Page</a>"
|
72 |
"Por favor, configura tus credenciales de la PA-API en la <a href=%s>Página "
|
73 |
"de Ajustes</a> para usar las funciones del Creador de enlaces."
|
74 |
|
75 |
+
#. %s: URL of settings page
|
76 |
+
#: admin/aalb_admin.php:139
|
77 |
+
#, php-format
|
78 |
+
msgid ""
|
79 |
+
"Please configure your Store-Id credentials in the <a href=%s>Settings "
|
80 |
+
"Page</a> to use the Link Builder features."
|
81 |
+
msgstr ""
|
82 |
+
|
83 |
+
#: admin/aalb_admin.php:140
|
84 |
msgid "Ad Template"
|
85 |
msgstr "Plantilla de anuncio"
|
86 |
|
87 |
+
#: admin/aalb_admin.php:141 admin/partials/aalb_editor_search_box.php:30
|
88 |
msgid "Enter keyword(s)"
|
89 |
msgstr "Introduce palabra(s) clave"
|
90 |
|
91 |
+
#: admin/aalb_admin.php:142 admin/partials/aalb_editor_search_box.php:33
|
92 |
msgid "Search"
|
93 |
msgstr "Buscar"
|
94 |
|
95 |
+
#: admin/aalb_admin.php:143
|
96 |
+
msgid "Tracking IDs"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: admin/aalb_admin.php:144
|
100 |
+
msgid "Search Phrase"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#: admin/aalb_admin.php:145
|
104 |
+
msgid "Select Tracking Id"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#: admin/aalb_admin.php:146
|
108 |
msgid "Marketplace"
|
109 |
msgstr "Mercado"
|
110 |
|
111 |
+
#: admin/aalb_admin.php:147
|
112 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:56
|
113 |
+
msgid "Select Marketplace"
|
114 |
+
msgstr ""
|
115 |
+
|
116 |
+
#: admin/aalb_admin.php:148
|
117 |
msgid "Searching relevant products from Amazon"
|
118 |
msgstr "Buscando productos adecuados en Amazon"
|
119 |
|
120 |
+
#: admin/aalb_admin.php:149
|
121 |
msgid "Click to select product(s) to advertise"
|
122 |
msgstr "Haz clic para seleccionar los productos a anunciar"
|
123 |
|
124 |
+
#: admin/aalb_admin.php:150
|
125 |
msgid "Check more search results on Amazon"
|
126 |
msgstr "Encuentra más resultados de búsqueda en Amazon"
|
127 |
|
128 |
+
#: admin/aalb_admin.php:151
|
129 |
+
msgid "List of Selected Products(Maximum: 10)"
|
130 |
+
msgstr ""
|
131 |
+
|
132 |
+
#: admin/aalb_admin.php:152
|
133 |
msgid "Creating shortcode. Please wait...."
|
134 |
msgstr "Creando ‘shortcode’. Por favor, espera…"
|
135 |
|
136 |
+
#: admin/aalb_admin.php:153
|
137 |
msgid "Add Shortcode"
|
138 |
msgstr "Añadir ‘shortcode’"
|
139 |
|
140 |
+
#: admin/aalb_admin.php:154
|
141 |
+
msgid ""
|
142 |
+
"To configure templates, go to Associates Link Builder plugin's Templates page"
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
#: admin/aalb_admin.php:155
|
146 |
+
msgid ""
|
147 |
+
"To configure marketplaces, go to Associates Link Builder plugin's Settings "
|
148 |
+
"page"
|
149 |
+
msgstr ""
|
150 |
+
|
151 |
+
#: admin/aalb_admin.php:156
|
152 |
+
msgid ""
|
153 |
+
"To configure tracking ids, go to Associates Link Builder plugin's Settings "
|
154 |
+
"page"
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#: admin/aalb_admin.php:157
|
158 |
+
msgid "Please select marketplace from above to show products."
|
159 |
+
msgstr ""
|
160 |
+
|
161 |
+
#: admin/aalb_admin.php:158
|
162 |
+
msgid "Please select some products from above."
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: admin/aalb_admin.php:159
|
166 |
+
msgid "Add ProductSet for Country"
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
#: admin/aalb_admin.php:286
|
170 |
msgid ""
|
171 |
"Not authorised to make request template content or Directory Traversal "
|
172 |
"Attempted."
|
174 |
"No estás autorizado para hacer una petición plantilla contenido o Directory "
|
175 |
"Traversal Attempted."
|
176 |
|
177 |
+
#: admin/aalb_admin.php:296
|
178 |
msgid "Not authorised to make request"
|
179 |
msgstr "Falta autorización para realizar esta petición"
|
180 |
|
181 |
+
#: ip2country/aalb_maxmind_db_manager.php:48
|
|
|
182 |
#, php-format
|
183 |
+
msgid ""
|
184 |
+
"WordPress does not have permissions to write to the \"Downloads Folder\" (%s)"
|
185 |
+
". Please grant permissions or pick a different folder from the Amazon "
|
186 |
+
"Associates Link Builder plugin's settings page, otherwise your links to "
|
187 |
+
"Amazon might not display correctly."
|
188 |
+
msgstr ""
|
189 |
|
190 |
+
#: ip2country/aalb_maxmind_db_manager.php:50
|
191 |
+
#, php-format
|
192 |
+
msgid ""
|
193 |
+
"WordPress could not find file %1s at \"DownloadsFolder\"(%2s), so geo-"
|
194 |
+
"targeted links will not work correctly. This file can be downloaded from <a "
|
195 |
+
"href=%2s>here</a>"
|
196 |
+
msgstr ""
|
197 |
+
|
198 |
+
#: ip2country/aalb_maxmind_db_manager.php:54
|
199 |
+
#, php-format
|
200 |
+
msgid ""
|
201 |
+
"WordPress could not read %s. Please grant read permissions, otherwise your "
|
202 |
+
"links to Amazon might not display correctly."
|
203 |
+
msgstr ""
|
204 |
+
|
205 |
+
#: ip2country/aalb_maxmind_db_manager.php:57
|
206 |
+
#, php-format
|
207 |
+
msgid ""
|
208 |
+
"WordPress does not have write permissions to update the file(%s). Please "
|
209 |
+
"grant write permissions, otherwise geo-targeted links may not work correctly."
|
210 |
+
msgstr ""
|
211 |
+
|
212 |
+
#: ip2country/aalb_maxmind_db_manager.php:59
|
213 |
+
#, php-format
|
214 |
+
msgid ""
|
215 |
+
"WordPress could not update file(%1s) for geo-targeted links feature, so "
|
216 |
+
"these links may not work correctly. This file can be downloaded from <a "
|
217 |
+
"href=%2s>here</a>"
|
218 |
+
msgstr ""
|
219 |
|
220 |
#. translators: %s: Invalid ASIN name
|
221 |
#: shortcode/aalb_shortcode_helper.php:144
|
242 |
"Afiliado se ha actualizado a %2s. Por favor, comprueba tu selección de tags "
|
243 |
"o contacta con el administrador para añadir uno nuevo."
|
244 |
|
245 |
+
#: shortcode/aalb_shortcode_manager.php:85
|
246 |
+
msgid ""
|
247 |
+
"There is an error in the count of configured marketplaces, asins and stores "
|
248 |
+
"in this shortcode. Please fix the parameters for marketplace, asin and store-"
|
249 |
+
"id."
|
250 |
+
msgstr ""
|
251 |
+
|
252 |
#: admin/sidebar/aalb_sidebar.php:31 admin/sidebar/partials/aalb_about.php:17
|
253 |
msgid "Associates Link Builder"
|
254 |
msgstr "Associates Link Builder"
|
541 |
msgstr ""
|
542 |
"Te <b>recomendamos</b> usar una conexión HTTPs para una mayor seguridad."
|
543 |
|
544 |
+
#: admin/sidebar/partials/aalb_credentials.php:26
|
545 |
+
msgid "Are you sure you want to remove this marketplace?"
|
546 |
+
msgstr ""
|
547 |
+
|
548 |
+
#: admin/sidebar/partials/aalb_credentials.php:29
|
549 |
+
msgid "YES"
|
550 |
+
msgstr ""
|
551 |
+
|
552 |
+
#: admin/sidebar/partials/aalb_credentials.php:30
|
553 |
+
msgid "NO"
|
554 |
+
msgstr ""
|
555 |
+
|
556 |
#: admin/sidebar/partials/aalb_credentials.php:36
|
557 |
msgid "Settings for Associates Link Builder"
|
558 |
msgstr "Ajustes para el Creador de enlaces para Afiliados"
|
573 |
"Es la plantilla publicitaria que se utilizará para representar el anuncio si "
|
574 |
"en el ‘shortcode’ no se especifica una plantilla concreta."
|
575 |
|
576 |
+
#: admin/sidebar/partials/aalb_credentials.php:91
|
577 |
+
msgid "Downloads Folder"
|
578 |
+
msgstr ""
|
579 |
+
|
580 |
+
#: admin/sidebar/partials/aalb_credentials.php:97
|
581 |
+
#, php-format
|
582 |
+
msgid ""
|
583 |
+
"This folder will be used to save files downloaded by the plugin (e.g. <a "
|
584 |
+
"href=%1s target=%2s>The MaxMind IP2Country Database</a>) for local use. "
|
585 |
+
"Absolute path required. <br><span class=\"aalb-bold\"> Default value:</span> "
|
586 |
+
"<code>wp_upload_dir()['basedir'] + '%3s'</code>"
|
587 |
+
msgstr ""
|
588 |
+
|
589 |
#. translators: %s: rel="noreferrer" attribute
|
590 |
#: admin/sidebar/partials/aalb_credentials.php:106
|
591 |
#, php-format
|
877 |
"conexión y la configuración de tu firewall. Si el problema persiste, "
|
878 |
"escríbenos a %s."
|
879 |
|
880 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:54
|
881 |
+
msgid "Enter Tracking Id(s)"
|
882 |
+
msgstr ""
|
883 |
+
|
884 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:55
|
885 |
+
msgid "Remove Marketplace"
|
886 |
+
msgstr ""
|
887 |
+
|
888 |
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:57
|
889 |
msgid "Default Marketplace"
|
890 |
msgstr "Mercado por defecto"
|
891 |
|
892 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:58
|
893 |
+
msgid "Set As Default Marketplace"
|
894 |
+
msgstr ""
|
895 |
+
|
896 |
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:59
|
897 |
msgid "Tracking Id(s)"
|
898 |
msgstr "ID de seguimiento"
|
899 |
|
900 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:60
|
901 |
+
msgid "Add a Marketplace"
|
902 |
+
msgstr ""
|
903 |
+
|
904 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:61
|
905 |
+
msgid "Remove Marketplace Confirmation"
|
906 |
+
msgstr ""
|
907 |
+
|
908 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:62
|
909 |
+
msgid "ERROR: No store id has been entered for one or more marketplaces."
|
910 |
+
msgstr ""
|
911 |
+
|
912 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:63
|
913 |
+
msgid ""
|
914 |
+
"ERROR: A marketplace already exists with this value. Please set a new "
|
915 |
+
"marketplace."
|
916 |
+
msgstr ""
|
917 |
+
|
918 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:64
|
919 |
+
msgid ""
|
920 |
+
"ERROR: A marketplace is present that has not been set. Please set that first."
|
921 |
+
msgstr ""
|
922 |
+
|
923 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:65
|
924 |
+
msgid ""
|
925 |
+
"ERROR: You need to maintain at least one marketplace entry for tracking ids "
|
926 |
+
msgstr ""
|
927 |
+
|
928 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:66
|
929 |
+
msgid "ERROR: You need to add at least one marketplace entry for tracking ids "
|
930 |
+
msgstr ""
|
931 |
+
|
932 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:67
|
933 |
+
msgid "Add a Marketplace that you want to create Amazon links to."
|
934 |
+
msgstr ""
|
935 |
+
|
936 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:68
|
937 |
+
msgid ""
|
938 |
+
"For each marketplace you can add multiple tracking ids, separated by commas. "
|
939 |
+
"The first tracking id will be considered as default tracking id for that "
|
940 |
+
"marketplace."
|
941 |
+
msgstr ""
|
942 |
+
|
943 |
#. Plugin Name of the plugin/theme
|
944 |
msgid "Amazon Associates Link Builder"
|
945 |
msgstr "Amazon Associates Link Builder"
|
languages/amazon-associates-link-builder-fr_FR.mo
CHANGED
Binary file
|
languages/amazon-associates-link-builder-fr_FR.po
CHANGED
@@ -1,203 +1,19 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
-
"PO-Revision-Date:
|
4 |
"MIME-Version: 1.0\n"
|
5 |
"Content-Type: text/plain; charset=UTF-8\n"
|
6 |
"Content-Transfer-Encoding: 8bit\n"
|
7 |
-
"Plural-Forms: nplurals=2; plural=n > 1
|
8 |
-
"X-Generator: Loco
|
9 |
-
"Language:
|
10 |
"Project-Id-Version: Plugins - Amazon Associates Link Builder - Development "
|
11 |
"(trunk)\n"
|
12 |
-
"POT-Creation-Date:
|
13 |
-
"Last-Translator:
|
14 |
"Language-Team: French (France)\n"
|
15 |
"Report-Msgid-Bugs-To: "
|
16 |
|
17 |
-
#: admin/aalb_admin.php:132
|
18 |
-
msgid "Please select at least one product for these marketplaces:"
|
19 |
-
msgstr ""
|
20 |
-
|
21 |
-
#. %s: URL of settings page
|
22 |
-
#: admin/aalb_admin.php:141
|
23 |
-
#, php-format
|
24 |
-
msgid ""
|
25 |
-
"Please configure your Store-Id credentials in the <a href=%s>Settings "
|
26 |
-
"Page</a> to use the Link Builder features."
|
27 |
-
msgstr ""
|
28 |
-
|
29 |
-
#: admin/aalb_admin.php:145
|
30 |
-
msgid "Tracking IDs"
|
31 |
-
msgstr ""
|
32 |
-
|
33 |
-
#: admin/aalb_admin.php:146
|
34 |
-
msgid "Search Phrase"
|
35 |
-
msgstr ""
|
36 |
-
|
37 |
-
#: admin/aalb_admin.php:147
|
38 |
-
msgid "Select Tracking Id"
|
39 |
-
msgstr ""
|
40 |
-
|
41 |
-
#: admin/aalb_admin.php:149
|
42 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:56
|
43 |
-
msgid "Select Marketplace"
|
44 |
-
msgstr ""
|
45 |
-
|
46 |
-
#: admin/aalb_admin.php:153
|
47 |
-
msgid "List of Selected Products(Maximum: 10)"
|
48 |
-
msgstr ""
|
49 |
-
|
50 |
-
#: admin/aalb_admin.php:156
|
51 |
-
msgid ""
|
52 |
-
"To configure templates, go to Associates Link Builder plugin's Templates page"
|
53 |
-
msgstr ""
|
54 |
-
|
55 |
-
#: admin/aalb_admin.php:157
|
56 |
-
msgid ""
|
57 |
-
"To configure marketplaces, go to Associates Link Builder plugin's Settings "
|
58 |
-
"page"
|
59 |
-
msgstr ""
|
60 |
-
|
61 |
-
#: admin/aalb_admin.php:158
|
62 |
-
msgid ""
|
63 |
-
"To configure tracking ids, go to Associates Link Builder plugin's Settings "
|
64 |
-
"page"
|
65 |
-
msgstr ""
|
66 |
-
|
67 |
-
#: admin/aalb_admin.php:159
|
68 |
-
msgid "Please select marketplace from above to show products."
|
69 |
-
msgstr ""
|
70 |
-
|
71 |
-
#: admin/aalb_admin.php:160
|
72 |
-
msgid "Please select some products from above."
|
73 |
-
msgstr ""
|
74 |
-
|
75 |
-
#: admin/aalb_admin.php:161
|
76 |
-
msgid "Add ProductSet for Country"
|
77 |
-
msgstr ""
|
78 |
-
|
79 |
-
#: ip2country/aalb_customer_country.php:98
|
80 |
-
#, php-format
|
81 |
-
msgid ""
|
82 |
-
"Maxmind DB file doesn't exist or is not readable. Please check & give "
|
83 |
-
"appropriate read & write permissions to:%s. Go to plugin's Settings page for "
|
84 |
-
"more details."
|
85 |
-
msgstr ""
|
86 |
-
|
87 |
-
#: shortcode/aalb_shortcode_manager.php:83
|
88 |
-
msgid ""
|
89 |
-
"There is an error in the count of configured marketplaces, asins and stores "
|
90 |
-
"in this shortcode. Please fix the parameters for marketplace, asin and store-"
|
91 |
-
"id."
|
92 |
-
msgstr ""
|
93 |
-
|
94 |
-
#: admin/sidebar/partials/aalb_credentials.php:26
|
95 |
-
msgid "Are you sure you want to remove this marketplace?"
|
96 |
-
msgstr ""
|
97 |
-
|
98 |
-
#: admin/sidebar/partials/aalb_credentials.php:29
|
99 |
-
msgid "YES"
|
100 |
-
msgstr ""
|
101 |
-
|
102 |
-
#: admin/sidebar/partials/aalb_credentials.php:30
|
103 |
-
msgid "NO"
|
104 |
-
msgstr ""
|
105 |
-
|
106 |
-
#: admin/sidebar/partials/aalb_credentials.php:91
|
107 |
-
msgid "Downloads Folder"
|
108 |
-
msgstr ""
|
109 |
-
|
110 |
-
#: admin/sidebar/partials/aalb_credentials.php:97
|
111 |
-
#, php-format
|
112 |
-
msgid ""
|
113 |
-
"This folder will be used to save files downloaded by the plugin (e.g. <a "
|
114 |
-
"href=%1s target=%2s>The MaxMind IP2Country Database</a>) for local use. "
|
115 |
-
"Absolute path required. <br><span class=\"aalb-bold\"> Default value:</span> "
|
116 |
-
"*blank*, defaults to <code>wp_upload_dir()['basedir'] + '%3s'</code>"
|
117 |
-
msgstr ""
|
118 |
-
|
119 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:54
|
120 |
-
msgid "Enter Tracking Id(s)"
|
121 |
-
msgstr ""
|
122 |
-
|
123 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:55
|
124 |
-
msgid "Remove Marketplace"
|
125 |
-
msgstr ""
|
126 |
-
|
127 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:58
|
128 |
-
msgid "Set As Default Marketplace"
|
129 |
-
msgstr ""
|
130 |
-
|
131 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:60
|
132 |
-
msgid "Add a Marketplace"
|
133 |
-
msgstr ""
|
134 |
-
|
135 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:61
|
136 |
-
msgid "Remove Marketplace Confirmation"
|
137 |
-
msgstr ""
|
138 |
-
|
139 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:62
|
140 |
-
msgid "ERROR: No store id has been entered for one or more marketplaces."
|
141 |
-
msgstr ""
|
142 |
-
|
143 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:63
|
144 |
-
msgid ""
|
145 |
-
"ERROR: A marketplace already exists with this value. Please set a new "
|
146 |
-
"marketplace."
|
147 |
-
msgstr ""
|
148 |
-
|
149 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:64
|
150 |
-
msgid ""
|
151 |
-
"ERROR: A marketplace is present that has not been set. Please set that first."
|
152 |
-
msgstr ""
|
153 |
-
|
154 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:65
|
155 |
-
msgid ""
|
156 |
-
"ERROR: You need to maintain at least one marketplace entry for tracking ids "
|
157 |
-
msgstr ""
|
158 |
-
|
159 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:66
|
160 |
-
msgid "ERROR: You need to add at least one marketplace entry for tracking ids "
|
161 |
-
msgstr ""
|
162 |
-
|
163 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:67
|
164 |
-
msgid "Add a Marketplace that you want to create Amazon links to."
|
165 |
-
msgstr ""
|
166 |
-
|
167 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:68
|
168 |
-
msgid ""
|
169 |
-
"For each marketplace you can add multiple tracking ids, separated by commas. "
|
170 |
-
"The first tracking id will be considered as default tracking id for that "
|
171 |
-
"marketplace."
|
172 |
-
msgstr ""
|
173 |
-
|
174 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:121
|
175 |
-
#, php-format
|
176 |
-
msgid ""
|
177 |
-
"The file used to fetch country details to enable geo-targetted links doesn't "
|
178 |
-
"have read permissions. Please give recursive read/write permissons to:%s. In "
|
179 |
-
"case you are still facing the issue, please change download folder in Site "
|
180 |
-
"Wide Settings section on this page."
|
181 |
-
msgstr ""
|
182 |
-
|
183 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:123
|
184 |
-
#, php-format
|
185 |
-
msgid ""
|
186 |
-
"The file used to fetch country details to enable geo-targetted links doesn't "
|
187 |
-
"have write permissions. Please give recursive read/write permissons to:%s. "
|
188 |
-
"In case you are still facing the issue, please change download folder in "
|
189 |
-
"Site Wide Settings section on this page"
|
190 |
-
msgstr ""
|
191 |
-
|
192 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:125
|
193 |
-
#, php-format
|
194 |
-
msgid ""
|
195 |
-
"The directory where the file used to fetch country details to enable geo-"
|
196 |
-
"targetted links doesn't have write permissions. Please give recursive "
|
197 |
-
"read/write permissons to:%s. In case you are still facing the issue, please "
|
198 |
-
"change download folder in Site Wide Settings section on this page"
|
199 |
-
msgstr ""
|
200 |
-
|
201 |
#: amazon-associates-link-builder.php:39 admin/sidebar/aalb_sidebar.php:35
|
202 |
msgid "About"
|
203 |
msgstr "À propos"
|
@@ -210,15 +26,19 @@ msgstr "Paramètres"
|
|
210 |
msgid "Templates"
|
211 |
msgstr "Modèles"
|
212 |
|
213 |
-
#: admin/aalb_admin.php:
|
214 |
msgid "Only one product can be selected for this template"
|
215 |
msgstr "Un produit seulement peut être sélectionné pour ce modèle"
|
216 |
|
217 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
218 |
msgid "Please Enter a Product Name "
|
219 |
msgstr "Veuillez entrer un nom de produit "
|
220 |
|
221 |
-
#: admin/aalb_admin.php:
|
222 |
msgid ""
|
223 |
"Failed to create Text Link shortcode. Editor has some text selected. Only "
|
224 |
"one item can be selected while adding text links"
|
@@ -228,7 +48,7 @@ msgstr ""
|
|
228 |
"liens texte"
|
229 |
|
230 |
#. translators: %s: Email-id of the support
|
231 |
-
#: admin/aalb_admin.php:
|
232 |
#, php-format
|
233 |
msgid ""
|
234 |
"Request timed out. Try again after some time. Please check your network and "
|
@@ -238,12 +58,12 @@ msgstr ""
|
|
238 |
"Prière de vérifier les paramètres de votre réseau et de votre pare-feu. Si "
|
239 |
"l’erreur persiste, écrivez-nous à %s."
|
240 |
|
241 |
-
#: admin/aalb_admin.php:
|
242 |
msgid "Add Amazon Associates Link Builder Shortcode"
|
243 |
msgstr "Ajouter le code court du plugin Amazon Associates Link Builder"
|
244 |
|
245 |
#. translators: %s: URL of settings page
|
246 |
-
#: admin/aalb_admin.php:
|
247 |
#, php-format
|
248 |
msgid ""
|
249 |
"Please configure your PA-API credentials in the <a href=%s>Settings Page</a>"
|
@@ -252,43 +72,101 @@ msgstr ""
|
|
252 |
"Veuillez configurer vos identifiants PA-API sur la <a href=%s>page "
|
253 |
"Paramètres</a> pour utiliser le créateur de lien."
|
254 |
|
255 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
msgid "Ad Template"
|
257 |
msgstr "Modèle d’annonce"
|
258 |
|
259 |
-
#: admin/aalb_admin.php:
|
260 |
msgid "Enter keyword(s)"
|
261 |
msgstr "Entrer mot(s) clé(s)"
|
262 |
|
263 |
-
#: admin/aalb_admin.php:
|
264 |
msgid "Search"
|
265 |
msgstr "Recherche"
|
266 |
|
267 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
msgid "Marketplace"
|
269 |
msgstr "Marché"
|
270 |
|
271 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
|
|
272 |
msgid "Searching relevant products from Amazon"
|
273 |
msgstr "Recherche de produits pertinents sur Amazon"
|
274 |
|
275 |
-
#: admin/aalb_admin.php:
|
276 |
msgid "Click to select product(s) to advertise"
|
277 |
msgstr "Cliquez pour sélectionner un ou plusieurs produit(s) à mettre en avant"
|
278 |
|
279 |
-
#: admin/aalb_admin.php:
|
280 |
msgid "Check more search results on Amazon"
|
281 |
msgstr "Autres résultats de recherche sur Amazon"
|
282 |
|
283 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
284 |
msgid "Creating shortcode. Please wait...."
|
285 |
msgstr "Code court en cours de création. Veuillez patienter..."
|
286 |
|
287 |
-
#: admin/aalb_admin.php:
|
288 |
msgid "Add Shortcode"
|
289 |
msgstr "Ajouter code court"
|
290 |
|
291 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
msgid ""
|
293 |
"Not authorised to make request template content or Directory Traversal "
|
294 |
"Attempted."
|
@@ -296,19 +174,48 @@ msgstr ""
|
|
296 |
"Vous n’avez pas l’autorisation de faire une requête de contenu de modèle ou "
|
297 |
"Tentative de traversée de répertoires."
|
298 |
|
299 |
-
#: admin/aalb_admin.php:
|
300 |
msgid "Not authorised to make request"
|
301 |
msgstr "Vous n’avez pas l’autorisation de faire cette requête"
|
302 |
|
303 |
-
|
304 |
-
#: includes/aalb_remote_loader.php:71
|
305 |
#, php-format
|
306 |
-
msgid "
|
307 |
-
|
|
|
|
|
|
|
|
|
308 |
|
309 |
-
#:
|
310 |
-
|
311 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
|
313 |
#. translators: %s: Invalid ASIN name
|
314 |
#: shortcode/aalb_shortcode_helper.php:144
|
@@ -334,6 +241,13 @@ msgstr ""
|
|
334 |
"balise Partenaire est à présent %2s. Veuillez vérifier votre choix de balise "
|
335 |
"Partenaire ou contactez l’administrateur pour ajouter une nouvelle balise."
|
336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
#: admin/sidebar/aalb_sidebar.php:31 admin/sidebar/partials/aalb_about.php:17
|
338 |
msgid "Associates Link Builder"
|
339 |
msgstr "Associates Link Builder"
|
@@ -629,6 +543,18 @@ msgstr ""
|
|
629 |
"Nous <b>recommandons</b> d’utiliser la connexion HTTPs pour améliorer la "
|
630 |
"sécurité."
|
631 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
632 |
#: admin/sidebar/partials/aalb_credentials.php:36
|
633 |
msgid "Settings for Associates Link Builder"
|
634 |
msgstr "Paramètres pour le créateur de lien Partenaire"
|
@@ -649,6 +575,19 @@ msgstr ""
|
|
649 |
"Le modèle d’annonce qui sera utilisé pour afficher l’annonce si aucun modèle "
|
650 |
"n’est spécifié dans le code court."
|
651 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
652 |
#. translators: %s: rel="noreferrer" attribute
|
653 |
#: admin/sidebar/partials/aalb_credentials.php:106
|
654 |
#, php-format
|
@@ -941,14 +880,69 @@ msgstr ""
|
|
941 |
"Prière de vérifier les paramètres de votre réseau et de votre pare-feu. Si "
|
942 |
"l’erreur persiste, écrivez-nous à %s."
|
943 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
944 |
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:57
|
945 |
msgid "Default Marketplace"
|
946 |
msgstr "Marché par défaut"
|
947 |
|
|
|
|
|
|
|
|
|
948 |
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:59
|
949 |
msgid "Tracking Id(s)"
|
950 |
msgstr "ID de suivi"
|
951 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
952 |
#. Plugin Name of the plugin/theme
|
953 |
msgid "Amazon Associates Link Builder"
|
954 |
msgstr "Amazon Associates Link Builder"
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
+
"PO-Revision-Date: 2018-02-27 07:06+0000\n"
|
4 |
"MIME-Version: 1.0\n"
|
5 |
"Content-Type: text/plain; charset=UTF-8\n"
|
6 |
"Content-Transfer-Encoding: 8bit\n"
|
7 |
+
"Plural-Forms: nplurals=2; plural=n > 1;\n"
|
8 |
+
"X-Generator: Loco https://localise.biz/\n"
|
9 |
+
"Language: fr_FR\n"
|
10 |
"Project-Id-Version: Plugins - Amazon Associates Link Builder - Development "
|
11 |
"(trunk)\n"
|
12 |
+
"POT-Creation-Date: 2018-02-27 07:04+0000\n"
|
13 |
+
"Last-Translator: root <nishgarg@amazon.com>\n"
|
14 |
"Language-Team: French (France)\n"
|
15 |
"Report-Msgid-Bugs-To: "
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
#: amazon-associates-link-builder.php:39 admin/sidebar/aalb_sidebar.php:35
|
18 |
msgid "About"
|
19 |
msgstr "À propos"
|
26 |
msgid "Templates"
|
27 |
msgstr "Modèles"
|
28 |
|
29 |
+
#: admin/aalb_admin.php:129
|
30 |
msgid "Only one product can be selected for this template"
|
31 |
msgstr "Un produit seulement peut être sélectionné pour ce modèle"
|
32 |
|
33 |
+
#: admin/aalb_admin.php:130
|
34 |
+
msgid "Please select at least one product for these marketplaces:"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: admin/aalb_admin.php:131
|
38 |
msgid "Please Enter a Product Name "
|
39 |
msgstr "Veuillez entrer un nom de produit "
|
40 |
|
41 |
+
#: admin/aalb_admin.php:132
|
42 |
msgid ""
|
43 |
"Failed to create Text Link shortcode. Editor has some text selected. Only "
|
44 |
"one item can be selected while adding text links"
|
48 |
"liens texte"
|
49 |
|
50 |
#. translators: %s: Email-id of the support
|
51 |
+
#: admin/aalb_admin.php:134
|
52 |
#, php-format
|
53 |
msgid ""
|
54 |
"Request timed out. Try again after some time. Please check your network and "
|
58 |
"Prière de vérifier les paramètres de votre réseau et de votre pare-feu. Si "
|
59 |
"l’erreur persiste, écrivez-nous à %s."
|
60 |
|
61 |
+
#: admin/aalb_admin.php:135 admin/partials/aalb_editor_search_box.php:32
|
62 |
msgid "Add Amazon Associates Link Builder Shortcode"
|
63 |
msgstr "Ajouter le code court du plugin Amazon Associates Link Builder"
|
64 |
|
65 |
#. translators: %s: URL of settings page
|
66 |
+
#: admin/aalb_admin.php:137
|
67 |
#, php-format
|
68 |
msgid ""
|
69 |
"Please configure your PA-API credentials in the <a href=%s>Settings Page</a>"
|
72 |
"Veuillez configurer vos identifiants PA-API sur la <a href=%s>page "
|
73 |
"Paramètres</a> pour utiliser le créateur de lien."
|
74 |
|
75 |
+
#. %s: URL of settings page
|
76 |
+
#: admin/aalb_admin.php:139
|
77 |
+
#, php-format
|
78 |
+
msgid ""
|
79 |
+
"Please configure your Store-Id credentials in the <a href=%s>Settings "
|
80 |
+
"Page</a> to use the Link Builder features."
|
81 |
+
msgstr ""
|
82 |
+
|
83 |
+
#: admin/aalb_admin.php:140
|
84 |
msgid "Ad Template"
|
85 |
msgstr "Modèle d’annonce"
|
86 |
|
87 |
+
#: admin/aalb_admin.php:141 admin/partials/aalb_editor_search_box.php:30
|
88 |
msgid "Enter keyword(s)"
|
89 |
msgstr "Entrer mot(s) clé(s)"
|
90 |
|
91 |
+
#: admin/aalb_admin.php:142 admin/partials/aalb_editor_search_box.php:33
|
92 |
msgid "Search"
|
93 |
msgstr "Recherche"
|
94 |
|
95 |
+
#: admin/aalb_admin.php:143
|
96 |
+
msgid "Tracking IDs"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: admin/aalb_admin.php:144
|
100 |
+
msgid "Search Phrase"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#: admin/aalb_admin.php:145
|
104 |
+
msgid "Select Tracking Id"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#: admin/aalb_admin.php:146
|
108 |
msgid "Marketplace"
|
109 |
msgstr "Marché"
|
110 |
|
111 |
+
#: admin/aalb_admin.php:147
|
112 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:56
|
113 |
+
msgid "Select Marketplace"
|
114 |
+
msgstr ""
|
115 |
+
|
116 |
+
#: admin/aalb_admin.php:148
|
117 |
msgid "Searching relevant products from Amazon"
|
118 |
msgstr "Recherche de produits pertinents sur Amazon"
|
119 |
|
120 |
+
#: admin/aalb_admin.php:149
|
121 |
msgid "Click to select product(s) to advertise"
|
122 |
msgstr "Cliquez pour sélectionner un ou plusieurs produit(s) à mettre en avant"
|
123 |
|
124 |
+
#: admin/aalb_admin.php:150
|
125 |
msgid "Check more search results on Amazon"
|
126 |
msgstr "Autres résultats de recherche sur Amazon"
|
127 |
|
128 |
+
#: admin/aalb_admin.php:151
|
129 |
+
msgid "List of Selected Products(Maximum: 10)"
|
130 |
+
msgstr ""
|
131 |
+
|
132 |
+
#: admin/aalb_admin.php:152
|
133 |
msgid "Creating shortcode. Please wait...."
|
134 |
msgstr "Code court en cours de création. Veuillez patienter..."
|
135 |
|
136 |
+
#: admin/aalb_admin.php:153
|
137 |
msgid "Add Shortcode"
|
138 |
msgstr "Ajouter code court"
|
139 |
|
140 |
+
#: admin/aalb_admin.php:154
|
141 |
+
msgid ""
|
142 |
+
"To configure templates, go to Associates Link Builder plugin's Templates page"
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
#: admin/aalb_admin.php:155
|
146 |
+
msgid ""
|
147 |
+
"To configure marketplaces, go to Associates Link Builder plugin's Settings "
|
148 |
+
"page"
|
149 |
+
msgstr ""
|
150 |
+
|
151 |
+
#: admin/aalb_admin.php:156
|
152 |
+
msgid ""
|
153 |
+
"To configure tracking ids, go to Associates Link Builder plugin's Settings "
|
154 |
+
"page"
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#: admin/aalb_admin.php:157
|
158 |
+
msgid "Please select marketplace from above to show products."
|
159 |
+
msgstr ""
|
160 |
+
|
161 |
+
#: admin/aalb_admin.php:158
|
162 |
+
msgid "Please select some products from above."
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: admin/aalb_admin.php:159
|
166 |
+
msgid "Add ProductSet for Country"
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
#: admin/aalb_admin.php:286
|
170 |
msgid ""
|
171 |
"Not authorised to make request template content or Directory Traversal "
|
172 |
"Attempted."
|
174 |
"Vous n’avez pas l’autorisation de faire une requête de contenu de modèle ou "
|
175 |
"Tentative de traversée de répertoires."
|
176 |
|
177 |
+
#: admin/aalb_admin.php:296
|
178 |
msgid "Not authorised to make request"
|
179 |
msgstr "Vous n’avez pas l’autorisation de faire cette requête"
|
180 |
|
181 |
+
#: ip2country/aalb_maxmind_db_manager.php:48
|
|
|
182 |
#, php-format
|
183 |
+
msgid ""
|
184 |
+
"WordPress does not have permissions to write to the \"Downloads Folder\" (%s)"
|
185 |
+
". Please grant permissions or pick a different folder from the Amazon "
|
186 |
+
"Associates Link Builder plugin's settings page, otherwise your links to "
|
187 |
+
"Amazon might not display correctly."
|
188 |
+
msgstr ""
|
189 |
|
190 |
+
#: ip2country/aalb_maxmind_db_manager.php:50
|
191 |
+
#, php-format
|
192 |
+
msgid ""
|
193 |
+
"WordPress could not find file %1s at \"DownloadsFolder\"(%2s), so geo-"
|
194 |
+
"targeted links will not work correctly. This file can be downloaded from <a "
|
195 |
+
"href=%2s>here</a>"
|
196 |
+
msgstr ""
|
197 |
+
|
198 |
+
#: ip2country/aalb_maxmind_db_manager.php:54
|
199 |
+
#, php-format
|
200 |
+
msgid ""
|
201 |
+
"WordPress could not read %s. Please grant read permissions, otherwise your "
|
202 |
+
"links to Amazon might not display correctly."
|
203 |
+
msgstr ""
|
204 |
+
|
205 |
+
#: ip2country/aalb_maxmind_db_manager.php:57
|
206 |
+
#, php-format
|
207 |
+
msgid ""
|
208 |
+
"WordPress does not have write permissions to update the file(%s). Please "
|
209 |
+
"grant write permissions, otherwise geo-targeted links may not work correctly."
|
210 |
+
msgstr ""
|
211 |
+
|
212 |
+
#: ip2country/aalb_maxmind_db_manager.php:59
|
213 |
+
#, php-format
|
214 |
+
msgid ""
|
215 |
+
"WordPress could not update file(%1s) for geo-targeted links feature, so "
|
216 |
+
"these links may not work correctly. This file can be downloaded from <a "
|
217 |
+
"href=%2s>here</a>"
|
218 |
+
msgstr ""
|
219 |
|
220 |
#. translators: %s: Invalid ASIN name
|
221 |
#: shortcode/aalb_shortcode_helper.php:144
|
241 |
"balise Partenaire est à présent %2s. Veuillez vérifier votre choix de balise "
|
242 |
"Partenaire ou contactez l’administrateur pour ajouter une nouvelle balise."
|
243 |
|
244 |
+
#: shortcode/aalb_shortcode_manager.php:85
|
245 |
+
msgid ""
|
246 |
+
"There is an error in the count of configured marketplaces, asins and stores "
|
247 |
+
"in this shortcode. Please fix the parameters for marketplace, asin and store-"
|
248 |
+
"id."
|
249 |
+
msgstr ""
|
250 |
+
|
251 |
#: admin/sidebar/aalb_sidebar.php:31 admin/sidebar/partials/aalb_about.php:17
|
252 |
msgid "Associates Link Builder"
|
253 |
msgstr "Associates Link Builder"
|
543 |
"Nous <b>recommandons</b> d’utiliser la connexion HTTPs pour améliorer la "
|
544 |
"sécurité."
|
545 |
|
546 |
+
#: admin/sidebar/partials/aalb_credentials.php:26
|
547 |
+
msgid "Are you sure you want to remove this marketplace?"
|
548 |
+
msgstr ""
|
549 |
+
|
550 |
+
#: admin/sidebar/partials/aalb_credentials.php:29
|
551 |
+
msgid "YES"
|
552 |
+
msgstr ""
|
553 |
+
|
554 |
+
#: admin/sidebar/partials/aalb_credentials.php:30
|
555 |
+
msgid "NO"
|
556 |
+
msgstr ""
|
557 |
+
|
558 |
#: admin/sidebar/partials/aalb_credentials.php:36
|
559 |
msgid "Settings for Associates Link Builder"
|
560 |
msgstr "Paramètres pour le créateur de lien Partenaire"
|
575 |
"Le modèle d’annonce qui sera utilisé pour afficher l’annonce si aucun modèle "
|
576 |
"n’est spécifié dans le code court."
|
577 |
|
578 |
+
#: admin/sidebar/partials/aalb_credentials.php:91
|
579 |
+
msgid "Downloads Folder"
|
580 |
+
msgstr ""
|
581 |
+
|
582 |
+
#: admin/sidebar/partials/aalb_credentials.php:97
|
583 |
+
#, php-format
|
584 |
+
msgid ""
|
585 |
+
"This folder will be used to save files downloaded by the plugin (e.g. <a "
|
586 |
+
"href=%1s target=%2s>The MaxMind IP2Country Database</a>) for local use. "
|
587 |
+
"Absolute path required. <br><span class=\"aalb-bold\"> Default value:</span> "
|
588 |
+
"<code>wp_upload_dir()['basedir'] + '%3s'</code>"
|
589 |
+
msgstr ""
|
590 |
+
|
591 |
#. translators: %s: rel="noreferrer" attribute
|
592 |
#: admin/sidebar/partials/aalb_credentials.php:106
|
593 |
#, php-format
|
880 |
"Prière de vérifier les paramètres de votre réseau et de votre pare-feu. Si "
|
881 |
"l’erreur persiste, écrivez-nous à %s."
|
882 |
|
883 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:54
|
884 |
+
msgid "Enter Tracking Id(s)"
|
885 |
+
msgstr ""
|
886 |
+
|
887 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:55
|
888 |
+
msgid "Remove Marketplace"
|
889 |
+
msgstr ""
|
890 |
+
|
891 |
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:57
|
892 |
msgid "Default Marketplace"
|
893 |
msgstr "Marché par défaut"
|
894 |
|
895 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:58
|
896 |
+
msgid "Set As Default Marketplace"
|
897 |
+
msgstr ""
|
898 |
+
|
899 |
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:59
|
900 |
msgid "Tracking Id(s)"
|
901 |
msgstr "ID de suivi"
|
902 |
|
903 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:60
|
904 |
+
msgid "Add a Marketplace"
|
905 |
+
msgstr ""
|
906 |
+
|
907 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:61
|
908 |
+
msgid "Remove Marketplace Confirmation"
|
909 |
+
msgstr ""
|
910 |
+
|
911 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:62
|
912 |
+
msgid "ERROR: No store id has been entered for one or more marketplaces."
|
913 |
+
msgstr ""
|
914 |
+
|
915 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:63
|
916 |
+
msgid ""
|
917 |
+
"ERROR: A marketplace already exists with this value. Please set a new "
|
918 |
+
"marketplace."
|
919 |
+
msgstr ""
|
920 |
+
|
921 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:64
|
922 |
+
msgid ""
|
923 |
+
"ERROR: A marketplace is present that has not been set. Please set that first."
|
924 |
+
msgstr ""
|
925 |
+
|
926 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:65
|
927 |
+
msgid ""
|
928 |
+
"ERROR: You need to maintain at least one marketplace entry for tracking ids "
|
929 |
+
msgstr ""
|
930 |
+
|
931 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:66
|
932 |
+
msgid "ERROR: You need to add at least one marketplace entry for tracking ids "
|
933 |
+
msgstr ""
|
934 |
+
|
935 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:67
|
936 |
+
msgid "Add a Marketplace that you want to create Amazon links to."
|
937 |
+
msgstr ""
|
938 |
+
|
939 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:68
|
940 |
+
msgid ""
|
941 |
+
"For each marketplace you can add multiple tracking ids, separated by commas. "
|
942 |
+
"The first tracking id will be considered as default tracking id for that "
|
943 |
+
"marketplace."
|
944 |
+
msgstr ""
|
945 |
+
|
946 |
#. Plugin Name of the plugin/theme
|
947 |
msgid "Amazon Associates Link Builder"
|
948 |
msgstr "Amazon Associates Link Builder"
|
languages/amazon-associates-link-builder-it_IT.mo
CHANGED
Binary file
|
languages/amazon-associates-link-builder-it_IT.po
CHANGED
@@ -1,203 +1,19 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
-
"PO-Revision-Date:
|
4 |
"MIME-Version: 1.0\n"
|
5 |
"Content-Type: text/plain; charset=UTF-8\n"
|
6 |
"Content-Transfer-Encoding: 8bit\n"
|
7 |
-
"Plural-Forms: nplurals=2; plural=n != 1
|
8 |
-
"X-Generator: Loco
|
9 |
-
"Language:
|
10 |
"Project-Id-Version: Plugins - Amazon Associates Link Builder - Development "
|
11 |
"(trunk)\n"
|
12 |
-
"POT-Creation-Date:
|
13 |
-
"Last-Translator:
|
14 |
"Language-Team: Italian\n"
|
15 |
"Report-Msgid-Bugs-To: "
|
16 |
|
17 |
-
#: admin/aalb_admin.php:132
|
18 |
-
msgid "Please select at least one product for these marketplaces:"
|
19 |
-
msgstr ""
|
20 |
-
|
21 |
-
#. %s: URL of settings page
|
22 |
-
#: admin/aalb_admin.php:141
|
23 |
-
#, php-format
|
24 |
-
msgid ""
|
25 |
-
"Please configure your Store-Id credentials in the <a href=%s>Settings "
|
26 |
-
"Page</a> to use the Link Builder features."
|
27 |
-
msgstr ""
|
28 |
-
|
29 |
-
#: admin/aalb_admin.php:145
|
30 |
-
msgid "Tracking IDs"
|
31 |
-
msgstr ""
|
32 |
-
|
33 |
-
#: admin/aalb_admin.php:146
|
34 |
-
msgid "Search Phrase"
|
35 |
-
msgstr ""
|
36 |
-
|
37 |
-
#: admin/aalb_admin.php:147
|
38 |
-
msgid "Select Tracking Id"
|
39 |
-
msgstr ""
|
40 |
-
|
41 |
-
#: admin/aalb_admin.php:149
|
42 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:56
|
43 |
-
msgid "Select Marketplace"
|
44 |
-
msgstr ""
|
45 |
-
|
46 |
-
#: admin/aalb_admin.php:153
|
47 |
-
msgid "List of Selected Products(Maximum: 10)"
|
48 |
-
msgstr ""
|
49 |
-
|
50 |
-
#: admin/aalb_admin.php:156
|
51 |
-
msgid ""
|
52 |
-
"To configure templates, go to Associates Link Builder plugin's Templates page"
|
53 |
-
msgstr ""
|
54 |
-
|
55 |
-
#: admin/aalb_admin.php:157
|
56 |
-
msgid ""
|
57 |
-
"To configure marketplaces, go to Associates Link Builder plugin's Settings "
|
58 |
-
"page"
|
59 |
-
msgstr ""
|
60 |
-
|
61 |
-
#: admin/aalb_admin.php:158
|
62 |
-
msgid ""
|
63 |
-
"To configure tracking ids, go to Associates Link Builder plugin's Settings "
|
64 |
-
"page"
|
65 |
-
msgstr ""
|
66 |
-
|
67 |
-
#: admin/aalb_admin.php:159
|
68 |
-
msgid "Please select marketplace from above to show products."
|
69 |
-
msgstr ""
|
70 |
-
|
71 |
-
#: admin/aalb_admin.php:160
|
72 |
-
msgid "Please select some products from above."
|
73 |
-
msgstr ""
|
74 |
-
|
75 |
-
#: admin/aalb_admin.php:161
|
76 |
-
msgid "Add ProductSet for Country"
|
77 |
-
msgstr ""
|
78 |
-
|
79 |
-
#: ip2country/aalb_customer_country.php:98
|
80 |
-
#, php-format
|
81 |
-
msgid ""
|
82 |
-
"Maxmind DB file doesn't exist or is not readable. Please check & give "
|
83 |
-
"appropriate read & write permissions to:%s. Go to plugin's Settings page for "
|
84 |
-
"more details."
|
85 |
-
msgstr ""
|
86 |
-
|
87 |
-
#: shortcode/aalb_shortcode_manager.php:83
|
88 |
-
msgid ""
|
89 |
-
"There is an error in the count of configured marketplaces, asins and stores "
|
90 |
-
"in this shortcode. Please fix the parameters for marketplace, asin and store-"
|
91 |
-
"id."
|
92 |
-
msgstr ""
|
93 |
-
|
94 |
-
#: admin/sidebar/partials/aalb_credentials.php:26
|
95 |
-
msgid "Are you sure you want to remove this marketplace?"
|
96 |
-
msgstr ""
|
97 |
-
|
98 |
-
#: admin/sidebar/partials/aalb_credentials.php:29
|
99 |
-
msgid "YES"
|
100 |
-
msgstr ""
|
101 |
-
|
102 |
-
#: admin/sidebar/partials/aalb_credentials.php:30
|
103 |
-
msgid "NO"
|
104 |
-
msgstr ""
|
105 |
-
|
106 |
-
#: admin/sidebar/partials/aalb_credentials.php:91
|
107 |
-
msgid "Downloads Folder"
|
108 |
-
msgstr ""
|
109 |
-
|
110 |
-
#: admin/sidebar/partials/aalb_credentials.php:97
|
111 |
-
#, php-format
|
112 |
-
msgid ""
|
113 |
-
"This folder will be used to save files downloaded by the plugin (e.g. <a "
|
114 |
-
"href=%1s target=%2s>The MaxMind IP2Country Database</a>) for local use. "
|
115 |
-
"Absolute path required. <br><span class=\"aalb-bold\"> Default value:</span> "
|
116 |
-
"*blank*, defaults to <code>wp_upload_dir()['basedir'] + '%3s'</code>"
|
117 |
-
msgstr ""
|
118 |
-
|
119 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:54
|
120 |
-
msgid "Enter Tracking Id(s)"
|
121 |
-
msgstr ""
|
122 |
-
|
123 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:55
|
124 |
-
msgid "Remove Marketplace"
|
125 |
-
msgstr ""
|
126 |
-
|
127 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:58
|
128 |
-
msgid "Set As Default Marketplace"
|
129 |
-
msgstr ""
|
130 |
-
|
131 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:60
|
132 |
-
msgid "Add a Marketplace"
|
133 |
-
msgstr ""
|
134 |
-
|
135 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:61
|
136 |
-
msgid "Remove Marketplace Confirmation"
|
137 |
-
msgstr ""
|
138 |
-
|
139 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:62
|
140 |
-
msgid "ERROR: No store id has been entered for one or more marketplaces."
|
141 |
-
msgstr ""
|
142 |
-
|
143 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:63
|
144 |
-
msgid ""
|
145 |
-
"ERROR: A marketplace already exists with this value. Please set a new "
|
146 |
-
"marketplace."
|
147 |
-
msgstr ""
|
148 |
-
|
149 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:64
|
150 |
-
msgid ""
|
151 |
-
"ERROR: A marketplace is present that has not been set. Please set that first."
|
152 |
-
msgstr ""
|
153 |
-
|
154 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:65
|
155 |
-
msgid ""
|
156 |
-
"ERROR: You need to maintain at least one marketplace entry for tracking ids "
|
157 |
-
msgstr ""
|
158 |
-
|
159 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:66
|
160 |
-
msgid "ERROR: You need to add at least one marketplace entry for tracking ids "
|
161 |
-
msgstr ""
|
162 |
-
|
163 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:67
|
164 |
-
msgid "Add a Marketplace that you want to create Amazon links to."
|
165 |
-
msgstr ""
|
166 |
-
|
167 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:68
|
168 |
-
msgid ""
|
169 |
-
"For each marketplace you can add multiple tracking ids, separated by commas. "
|
170 |
-
"The first tracking id will be considered as default tracking id for that "
|
171 |
-
"marketplace."
|
172 |
-
msgstr ""
|
173 |
-
|
174 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:121
|
175 |
-
#, php-format
|
176 |
-
msgid ""
|
177 |
-
"The file used to fetch country details to enable geo-targetted links doesn't "
|
178 |
-
"have read permissions. Please give recursive read/write permissons to:%s. In "
|
179 |
-
"case you are still facing the issue, please change download folder in Site "
|
180 |
-
"Wide Settings section on this page."
|
181 |
-
msgstr ""
|
182 |
-
|
183 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:123
|
184 |
-
#, php-format
|
185 |
-
msgid ""
|
186 |
-
"The file used to fetch country details to enable geo-targetted links doesn't "
|
187 |
-
"have write permissions. Please give recursive read/write permissons to:%s. "
|
188 |
-
"In case you are still facing the issue, please change download folder in "
|
189 |
-
"Site Wide Settings section on this page"
|
190 |
-
msgstr ""
|
191 |
-
|
192 |
-
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:125
|
193 |
-
#, php-format
|
194 |
-
msgid ""
|
195 |
-
"The directory where the file used to fetch country details to enable geo-"
|
196 |
-
"targetted links doesn't have write permissions. Please give recursive "
|
197 |
-
"read/write permissons to:%s. In case you are still facing the issue, please "
|
198 |
-
"change download folder in Site Wide Settings section on this page"
|
199 |
-
msgstr ""
|
200 |
-
|
201 |
#: amazon-associates-link-builder.php:39 admin/sidebar/aalb_sidebar.php:35
|
202 |
msgid "About"
|
203 |
msgstr "Chi siamo"
|
@@ -210,15 +26,19 @@ msgstr "Impostazioni"
|
|
210 |
msgid "Templates"
|
211 |
msgstr "Template"
|
212 |
|
213 |
-
#: admin/aalb_admin.php:
|
214 |
msgid "Only one product can be selected for this template"
|
215 |
msgstr "Per questo template è possibile selezionare solo un prodotto"
|
216 |
|
217 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
218 |
msgid "Please Enter a Product Name "
|
219 |
msgstr "Inserisci un nome di prodotto"
|
220 |
|
221 |
-
#: admin/aalb_admin.php:
|
222 |
msgid ""
|
223 |
"Failed to create Text Link shortcode. Editor has some text selected. Only "
|
224 |
"one item can be selected while adding text links"
|
@@ -228,7 +48,7 @@ msgstr ""
|
|
228 |
"aggiungere solo un articolo"
|
229 |
|
230 |
#. translators: %s: Email-id of the support
|
231 |
-
#: admin/aalb_admin.php:
|
232 |
#, php-format
|
233 |
msgid ""
|
234 |
"Request timed out. Try again after some time. Please check your network and "
|
@@ -237,12 +57,12 @@ msgstr ""
|
|
237 |
"Richiesta scaduta. Riprova più tardi. Controlla le impostazioni di rete e "
|
238 |
"del firewall. Se l’errore persiste, scrivi a %s."
|
239 |
|
240 |
-
#: admin/aalb_admin.php:
|
241 |
msgid "Add Amazon Associates Link Builder Shortcode"
|
242 |
msgstr "Aggiungi codice breve Amazon Associates Link Builder"
|
243 |
|
244 |
#. translators: %s: URL of settings page
|
245 |
-
#: admin/aalb_admin.php:
|
246 |
#, php-format
|
247 |
msgid ""
|
248 |
"Please configure your PA-API credentials in the <a href=%s>Settings Page</a>"
|
@@ -251,43 +71,101 @@ msgstr ""
|
|
251 |
"Configura le tue credenziali PA-API nella pagina <a href=%s>Impostazioni</a> "
|
252 |
"per utilizzare le funzionalità Link Builder."
|
253 |
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
msgid "Ad Template"
|
256 |
msgstr "Template annuncio"
|
257 |
|
258 |
-
#: admin/aalb_admin.php:
|
259 |
msgid "Enter keyword(s)"
|
260 |
msgstr "Inserisci parole chiave"
|
261 |
|
262 |
-
#: admin/aalb_admin.php:
|
263 |
msgid "Search"
|
264 |
msgstr "Cerca"
|
265 |
|
266 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
msgid "Marketplace"
|
268 |
msgstr "Marketplace"
|
269 |
|
270 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
|
|
271 |
msgid "Searching relevant products from Amazon"
|
272 |
msgstr "Ricerca prodotti rilevanti su Amazon"
|
273 |
|
274 |
-
#: admin/aalb_admin.php:
|
275 |
msgid "Click to select product(s) to advertise"
|
276 |
msgstr "Clicca per selezionare i prodotti da pubblicizzare"
|
277 |
|
278 |
-
#: admin/aalb_admin.php:
|
279 |
msgid "Check more search results on Amazon"
|
280 |
msgstr "Controlla gli altri risultati di ricerca su Amazon"
|
281 |
|
282 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
283 |
msgid "Creating shortcode. Please wait...."
|
284 |
msgstr "Creazione codice breve. Attendi..."
|
285 |
|
286 |
-
#: admin/aalb_admin.php:
|
287 |
msgid "Add Shortcode"
|
288 |
msgstr "Aggiungi codice breve"
|
289 |
|
290 |
-
#: admin/aalb_admin.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
msgid ""
|
292 |
"Not authorised to make request template content or Directory Traversal "
|
293 |
"Attempted."
|
@@ -295,19 +173,48 @@ msgstr ""
|
|
295 |
"Non autorizzato a effettuare la richiesta del contenuto del template o "
|
296 |
"Directory Traversal Attempted."
|
297 |
|
298 |
-
#: admin/aalb_admin.php:
|
299 |
msgid "Not authorised to make request"
|
300 |
msgstr "Non autorizzato a effettuare la richiesta"
|
301 |
|
302 |
-
|
303 |
-
#: includes/aalb_remote_loader.php:71
|
304 |
#, php-format
|
305 |
-
msgid "
|
306 |
-
|
|
|
|
|
|
|
|
|
307 |
|
308 |
-
#:
|
309 |
-
|
310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
|
312 |
#. translators: %s: Invalid ASIN name
|
313 |
#: shortcode/aalb_shortcode_helper.php:144
|
@@ -334,6 +241,13 @@ msgstr ""
|
|
334 |
"affiliato è stato aggiornato a %2s. Controlla la tua selezione di tag "
|
335 |
"affiliato o contatta l’amministratore per aggiungere un nuovo tag."
|
336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
#: admin/sidebar/aalb_sidebar.php:31 admin/sidebar/partials/aalb_about.php:17
|
338 |
msgid "Associates Link Builder"
|
339 |
msgstr "Associates Link Builder"
|
@@ -626,6 +540,18 @@ msgstr ""
|
|
626 |
"<b>Consigliamo</b> di utilizzare il collegamento HTTPs per una maggiore "
|
627 |
"sicurezza."
|
628 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
629 |
#: admin/sidebar/partials/aalb_credentials.php:36
|
630 |
msgid "Settings for Associates Link Builder"
|
631 |
msgstr "Impostazioni per l’Associates Link Builder"
|
@@ -646,6 +572,19 @@ msgstr ""
|
|
646 |
"Il template dell’annuncio utilizzato per il rendering dell’annuncio, se nel "
|
647 |
"codice breve non è specificato alcun template."
|
648 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
649 |
#. translators: %s: rel="noreferrer" attribute
|
650 |
#: admin/sidebar/partials/aalb_credentials.php:106
|
651 |
#, php-format
|
@@ -929,14 +868,69 @@ msgstr ""
|
|
929 |
"Richiesta scaduta. Prova ancora più tardi. Controlla le impostazioni di rete "
|
930 |
"e del firewall. Se l’errore persiste, scrivi a %s."
|
931 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
932 |
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:57
|
933 |
msgid "Default Marketplace"
|
934 |
msgstr "Marketplace predefinito"
|
935 |
|
|
|
|
|
|
|
|
|
936 |
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:59
|
937 |
msgid "Tracking Id(s)"
|
938 |
msgstr "Tracking Id(s)"
|
939 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
940 |
#. Plugin Name of the plugin/theme
|
941 |
msgid "Amazon Associates Link Builder"
|
942 |
msgstr "Amazon Associates Link Builder"
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
+
"PO-Revision-Date: 2018-02-27 07:06+0000\n"
|
4 |
"MIME-Version: 1.0\n"
|
5 |
"Content-Type: text/plain; charset=UTF-8\n"
|
6 |
"Content-Transfer-Encoding: 8bit\n"
|
7 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
8 |
+
"X-Generator: Loco https://localise.biz/\n"
|
9 |
+
"Language: it_IT\n"
|
10 |
"Project-Id-Version: Plugins - Amazon Associates Link Builder - Development "
|
11 |
"(trunk)\n"
|
12 |
+
"POT-Creation-Date: 2018-02-27 07:04+0000\n"
|
13 |
+
"Last-Translator: root <nishgarg@amazon.com>\n"
|
14 |
"Language-Team: Italian\n"
|
15 |
"Report-Msgid-Bugs-To: "
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
#: amazon-associates-link-builder.php:39 admin/sidebar/aalb_sidebar.php:35
|
18 |
msgid "About"
|
19 |
msgstr "Chi siamo"
|
26 |
msgid "Templates"
|
27 |
msgstr "Template"
|
28 |
|
29 |
+
#: admin/aalb_admin.php:129
|
30 |
msgid "Only one product can be selected for this template"
|
31 |
msgstr "Per questo template è possibile selezionare solo un prodotto"
|
32 |
|
33 |
+
#: admin/aalb_admin.php:130
|
34 |
+
msgid "Please select at least one product for these marketplaces:"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: admin/aalb_admin.php:131
|
38 |
msgid "Please Enter a Product Name "
|
39 |
msgstr "Inserisci un nome di prodotto"
|
40 |
|
41 |
+
#: admin/aalb_admin.php:132
|
42 |
msgid ""
|
43 |
"Failed to create Text Link shortcode. Editor has some text selected. Only "
|
44 |
"one item can be selected while adding text links"
|
48 |
"aggiungere solo un articolo"
|
49 |
|
50 |
#. translators: %s: Email-id of the support
|
51 |
+
#: admin/aalb_admin.php:134
|
52 |
#, php-format
|
53 |
msgid ""
|
54 |
"Request timed out. Try again after some time. Please check your network and "
|
57 |
"Richiesta scaduta. Riprova più tardi. Controlla le impostazioni di rete e "
|
58 |
"del firewall. Se l’errore persiste, scrivi a %s."
|
59 |
|
60 |
+
#: admin/aalb_admin.php:135 admin/partials/aalb_editor_search_box.php:32
|
61 |
msgid "Add Amazon Associates Link Builder Shortcode"
|
62 |
msgstr "Aggiungi codice breve Amazon Associates Link Builder"
|
63 |
|
64 |
#. translators: %s: URL of settings page
|
65 |
+
#: admin/aalb_admin.php:137
|
66 |
#, php-format
|
67 |
msgid ""
|
68 |
"Please configure your PA-API credentials in the <a href=%s>Settings Page</a>"
|
71 |
"Configura le tue credenziali PA-API nella pagina <a href=%s>Impostazioni</a> "
|
72 |
"per utilizzare le funzionalità Link Builder."
|
73 |
|
74 |
+
#. %s: URL of settings page
|
75 |
+
#: admin/aalb_admin.php:139
|
76 |
+
#, php-format
|
77 |
+
msgid ""
|
78 |
+
"Please configure your Store-Id credentials in the <a href=%s>Settings "
|
79 |
+
"Page</a> to use the Link Builder features."
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: admin/aalb_admin.php:140
|
83 |
msgid "Ad Template"
|
84 |
msgstr "Template annuncio"
|
85 |
|
86 |
+
#: admin/aalb_admin.php:141 admin/partials/aalb_editor_search_box.php:30
|
87 |
msgid "Enter keyword(s)"
|
88 |
msgstr "Inserisci parole chiave"
|
89 |
|
90 |
+
#: admin/aalb_admin.php:142 admin/partials/aalb_editor_search_box.php:33
|
91 |
msgid "Search"
|
92 |
msgstr "Cerca"
|
93 |
|
94 |
+
#: admin/aalb_admin.php:143
|
95 |
+
msgid "Tracking IDs"
|
96 |
+
msgstr ""
|
97 |
+
|
98 |
+
#: admin/aalb_admin.php:144
|
99 |
+
msgid "Search Phrase"
|
100 |
+
msgstr ""
|
101 |
+
|
102 |
+
#: admin/aalb_admin.php:145
|
103 |
+
msgid "Select Tracking Id"
|
104 |
+
msgstr ""
|
105 |
+
|
106 |
+
#: admin/aalb_admin.php:146
|
107 |
msgid "Marketplace"
|
108 |
msgstr "Marketplace"
|
109 |
|
110 |
+
#: admin/aalb_admin.php:147
|
111 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:56
|
112 |
+
msgid "Select Marketplace"
|
113 |
+
msgstr ""
|
114 |
+
|
115 |
+
#: admin/aalb_admin.php:148
|
116 |
msgid "Searching relevant products from Amazon"
|
117 |
msgstr "Ricerca prodotti rilevanti su Amazon"
|
118 |
|
119 |
+
#: admin/aalb_admin.php:149
|
120 |
msgid "Click to select product(s) to advertise"
|
121 |
msgstr "Clicca per selezionare i prodotti da pubblicizzare"
|
122 |
|
123 |
+
#: admin/aalb_admin.php:150
|
124 |
msgid "Check more search results on Amazon"
|
125 |
msgstr "Controlla gli altri risultati di ricerca su Amazon"
|
126 |
|
127 |
+
#: admin/aalb_admin.php:151
|
128 |
+
msgid "List of Selected Products(Maximum: 10)"
|
129 |
+
msgstr ""
|
130 |
+
|
131 |
+
#: admin/aalb_admin.php:152
|
132 |
msgid "Creating shortcode. Please wait...."
|
133 |
msgstr "Creazione codice breve. Attendi..."
|
134 |
|
135 |
+
#: admin/aalb_admin.php:153
|
136 |
msgid "Add Shortcode"
|
137 |
msgstr "Aggiungi codice breve"
|
138 |
|
139 |
+
#: admin/aalb_admin.php:154
|
140 |
+
msgid ""
|
141 |
+
"To configure templates, go to Associates Link Builder plugin's Templates page"
|
142 |
+
msgstr ""
|
143 |
+
|
144 |
+
#: admin/aalb_admin.php:155
|
145 |
+
msgid ""
|
146 |
+
"To configure marketplaces, go to Associates Link Builder plugin's Settings "
|
147 |
+
"page"
|
148 |
+
msgstr ""
|
149 |
+
|
150 |
+
#: admin/aalb_admin.php:156
|
151 |
+
msgid ""
|
152 |
+
"To configure tracking ids, go to Associates Link Builder plugin's Settings "
|
153 |
+
"page"
|
154 |
+
msgstr ""
|
155 |
+
|
156 |
+
#: admin/aalb_admin.php:157
|
157 |
+
msgid "Please select marketplace from above to show products."
|
158 |
+
msgstr ""
|
159 |
+
|
160 |
+
#: admin/aalb_admin.php:158
|
161 |
+
msgid "Please select some products from above."
|
162 |
+
msgstr ""
|
163 |
+
|
164 |
+
#: admin/aalb_admin.php:159
|
165 |
+
msgid "Add ProductSet for Country"
|
166 |
+
msgstr ""
|
167 |
+
|
168 |
+
#: admin/aalb_admin.php:286
|
169 |
msgid ""
|
170 |
"Not authorised to make request template content or Directory Traversal "
|
171 |
"Attempted."
|
173 |
"Non autorizzato a effettuare la richiesta del contenuto del template o "
|
174 |
"Directory Traversal Attempted."
|
175 |
|
176 |
+
#: admin/aalb_admin.php:296
|
177 |
msgid "Not authorised to make request"
|
178 |
msgstr "Non autorizzato a effettuare la richiesta"
|
179 |
|
180 |
+
#: ip2country/aalb_maxmind_db_manager.php:48
|
|
|
181 |
#, php-format
|
182 |
+
msgid ""
|
183 |
+
"WordPress does not have permissions to write to the \"Downloads Folder\" (%s)"
|
184 |
+
". Please grant permissions or pick a different folder from the Amazon "
|
185 |
+
"Associates Link Builder plugin's settings page, otherwise your links to "
|
186 |
+
"Amazon might not display correctly."
|
187 |
+
msgstr ""
|
188 |
|
189 |
+
#: ip2country/aalb_maxmind_db_manager.php:50
|
190 |
+
#, php-format
|
191 |
+
msgid ""
|
192 |
+
"WordPress could not find file %1s at \"DownloadsFolder\"(%2s), so geo-"
|
193 |
+
"targeted links will not work correctly. This file can be downloaded from <a "
|
194 |
+
"href=%2s>here</a>"
|
195 |
+
msgstr ""
|
196 |
+
|
197 |
+
#: ip2country/aalb_maxmind_db_manager.php:54
|
198 |
+
#, php-format
|
199 |
+
msgid ""
|
200 |
+
"WordPress could not read %s. Please grant read permissions, otherwise your "
|
201 |
+
"links to Amazon might not display correctly."
|
202 |
+
msgstr ""
|
203 |
+
|
204 |
+
#: ip2country/aalb_maxmind_db_manager.php:57
|
205 |
+
#, php-format
|
206 |
+
msgid ""
|
207 |
+
"WordPress does not have write permissions to update the file(%s). Please "
|
208 |
+
"grant write permissions, otherwise geo-targeted links may not work correctly."
|
209 |
+
msgstr ""
|
210 |
+
|
211 |
+
#: ip2country/aalb_maxmind_db_manager.php:59
|
212 |
+
#, php-format
|
213 |
+
msgid ""
|
214 |
+
"WordPress could not update file(%1s) for geo-targeted links feature, so "
|
215 |
+
"these links may not work correctly. This file can be downloaded from <a "
|
216 |
+
"href=%2s>here</a>"
|
217 |
+
msgstr ""
|
218 |
|
219 |
#. translators: %s: Invalid ASIN name
|
220 |
#: shortcode/aalb_shortcode_helper.php:144
|
241 |
"affiliato è stato aggiornato a %2s. Controlla la tua selezione di tag "
|
242 |
"affiliato o contatta l’amministratore per aggiungere un nuovo tag."
|
243 |
|
244 |
+
#: shortcode/aalb_shortcode_manager.php:85
|
245 |
+
msgid ""
|
246 |
+
"There is an error in the count of configured marketplaces, asins and stores "
|
247 |
+
"in this shortcode. Please fix the parameters for marketplace, asin and store-"
|
248 |
+
"id."
|
249 |
+
msgstr ""
|
250 |
+
|
251 |
#: admin/sidebar/aalb_sidebar.php:31 admin/sidebar/partials/aalb_about.php:17
|
252 |
msgid "Associates Link Builder"
|
253 |
msgstr "Associates Link Builder"
|
540 |
"<b>Consigliamo</b> di utilizzare il collegamento HTTPs per una maggiore "
|
541 |
"sicurezza."
|
542 |
|
543 |
+
#: admin/sidebar/partials/aalb_credentials.php:26
|
544 |
+
msgid "Are you sure you want to remove this marketplace?"
|
545 |
+
msgstr ""
|
546 |
+
|
547 |
+
#: admin/sidebar/partials/aalb_credentials.php:29
|
548 |
+
msgid "YES"
|
549 |
+
msgstr ""
|
550 |
+
|
551 |
+
#: admin/sidebar/partials/aalb_credentials.php:30
|
552 |
+
msgid "NO"
|
553 |
+
msgstr ""
|
554 |
+
|
555 |
#: admin/sidebar/partials/aalb_credentials.php:36
|
556 |
msgid "Settings for Associates Link Builder"
|
557 |
msgstr "Impostazioni per l’Associates Link Builder"
|
572 |
"Il template dell’annuncio utilizzato per il rendering dell’annuncio, se nel "
|
573 |
"codice breve non è specificato alcun template."
|
574 |
|
575 |
+
#: admin/sidebar/partials/aalb_credentials.php:91
|
576 |
+
msgid "Downloads Folder"
|
577 |
+
msgstr ""
|
578 |
+
|
579 |
+
#: admin/sidebar/partials/aalb_credentials.php:97
|
580 |
+
#, php-format
|
581 |
+
msgid ""
|
582 |
+
"This folder will be used to save files downloaded by the plugin (e.g. <a "
|
583 |
+
"href=%1s target=%2s>The MaxMind IP2Country Database</a>) for local use. "
|
584 |
+
"Absolute path required. <br><span class=\"aalb-bold\"> Default value:</span> "
|
585 |
+
"<code>wp_upload_dir()['basedir'] + '%3s'</code>"
|
586 |
+
msgstr ""
|
587 |
+
|
588 |
#. translators: %s: rel="noreferrer" attribute
|
589 |
#: admin/sidebar/partials/aalb_credentials.php:106
|
590 |
#, php-format
|
868 |
"Richiesta scaduta. Prova ancora più tardi. Controlla le impostazioni di rete "
|
869 |
"e del firewall. Se l’errore persiste, scrivi a %s."
|
870 |
|
871 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:54
|
872 |
+
msgid "Enter Tracking Id(s)"
|
873 |
+
msgstr ""
|
874 |
+
|
875 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:55
|
876 |
+
msgid "Remove Marketplace"
|
877 |
+
msgstr ""
|
878 |
+
|
879 |
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:57
|
880 |
msgid "Default Marketplace"
|
881 |
msgstr "Marketplace predefinito"
|
882 |
|
883 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:58
|
884 |
+
msgid "Set As Default Marketplace"
|
885 |
+
msgstr ""
|
886 |
+
|
887 |
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:59
|
888 |
msgid "Tracking Id(s)"
|
889 |
msgstr "Tracking Id(s)"
|
890 |
|
891 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:60
|
892 |
+
msgid "Add a Marketplace"
|
893 |
+
msgstr ""
|
894 |
+
|
895 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:61
|
896 |
+
msgid "Remove Marketplace Confirmation"
|
897 |
+
msgstr ""
|
898 |
+
|
899 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:62
|
900 |
+
msgid "ERROR: No store id has been entered for one or more marketplaces."
|
901 |
+
msgstr ""
|
902 |
+
|
903 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:63
|
904 |
+
msgid ""
|
905 |
+
"ERROR: A marketplace already exists with this value. Please set a new "
|
906 |
+
"marketplace."
|
907 |
+
msgstr ""
|
908 |
+
|
909 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:64
|
910 |
+
msgid ""
|
911 |
+
"ERROR: A marketplace is present that has not been set. Please set that first."
|
912 |
+
msgstr ""
|
913 |
+
|
914 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:65
|
915 |
+
msgid ""
|
916 |
+
"ERROR: You need to maintain at least one marketplace entry for tracking ids "
|
917 |
+
msgstr ""
|
918 |
+
|
919 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:66
|
920 |
+
msgid "ERROR: You need to add at least one marketplace entry for tracking ids "
|
921 |
+
msgstr ""
|
922 |
+
|
923 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:67
|
924 |
+
msgid "Add a Marketplace that you want to create Amazon links to."
|
925 |
+
msgstr ""
|
926 |
+
|
927 |
+
#: admin/sidebar/partials/helper/aalb_credentials_helper.php:68
|
928 |
+
msgid ""
|
929 |
+
"For each marketplace you can add multiple tracking ids, separated by commas. "
|
930 |
+
"The first tracking id will be considered as default tracking id for that "
|
931 |
+
"marketplace."
|
932 |
+
msgstr ""
|
933 |
+
|
934 |
#. Plugin Name of the plugin/theme
|
935 |
msgid "Amazon Associates Link Builder"
|
936 |
msgstr "Amazon Associates Link Builder"
|
lib/php/aalb_impression_recorder_service_config.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
-
|
5 |
-
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
6 |
-
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
7 |
-
A copy of the License is located in the "license" file accompanying this file.
|
8 |
-
|
9 |
-
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
-
either express or implied. See the License for the specific language governing permissions
|
11 |
-
and limitations under the License.
|
12 |
-
*/
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Class for storing impression recorder Service configuration
|
16 |
-
* Configration been been stored as static to have single config array. Although PHP is single threaded but in one request
|
17 |
-
* there can be multiple shortcodes and so multiple calls to get impression config for every shortcode.
|
18 |
-
*
|
19 |
-
* @since 1.6.0
|
20 |
-
* @package AmazonAssociatesLinkBuilder
|
21 |
-
* @subpackage AmazonAssociatesLinkBuilder/lib/php
|
22 |
-
*/
|
23 |
-
class Aalb_Impression_Recorder_Service_Config {
|
24 |
-
public static $configuration = array(
|
25 |
-
US => array(
|
26 |
-
"service_endpoint" => "ir-na.amazon-adsystem.com",
|
27 |
-
"org_unit_id" => 1,
|
28 |
-
),
|
29 |
-
UK => array(
|
30 |
-
"service_endpoint" => "ir-uk.amazon-adsystem.com",
|
31 |
-
"org_unit_id" => 2,
|
32 |
-
),
|
33 |
-
DE => array(
|
34 |
-
"service_endpoint" => "ir-de.amazon-adsystem.com",
|
35 |
-
"org_unit_id" => 3,
|
36 |
-
),
|
37 |
-
"FR" => array(
|
38 |
-
"service_endpoint" => "ir-fr.amazon-adsystem.com",
|
39 |
-
"org_unit_id" => 8,
|
40 |
-
),
|
41 |
-
"JP" => array(
|
42 |
-
"service_endpoint" => "ir-jp.amazon-adsystem.com",
|
43 |
-
"org_unit_id" => 9,
|
44 |
-
),
|
45 |
-
"CA" => array(
|
46 |
-
"service_endpoint" => "ir-ca.amazon-adsystem.com",
|
47 |
-
"org_unit_id" => 15,
|
48 |
-
),
|
49 |
-
"CN" => array(
|
50 |
-
"service_endpoint" => "ir-cn.amazon-adsystem.com",
|
51 |
-
"org_unit_id" => 28,
|
52 |
-
),
|
53 |
-
"IT" => array(
|
54 |
-
"service_endpoint" => "ir-it.amazon-adsystem.com",
|
55 |
-
"org_unit_id" => 29,
|
56 |
-
),
|
57 |
-
"ES" => array(
|
58 |
-
"service_endpoint" => "ir-es.amazon-adsystem.com",
|
59 |
-
"org_unit_id" => 30,
|
60 |
-
),
|
61 |
-
"IN" => array(
|
62 |
-
"service_endpoint" => "ir-in.amazon-adsystem.com",
|
63 |
-
"org_unit_id" => 31,
|
64 |
-
),
|
65 |
-
"BR" => array(
|
66 |
-
"service_endpoint" => "ir-br.amazon-adsystem.com",
|
67 |
-
"org_unit_id" => 32,
|
68 |
-
),
|
69 |
-
"MX" => array(
|
70 |
-
"service_endpoint" => "ir-mx.amazon-adsystem.com",
|
71 |
-
"org_unit_id" => 33,
|
72 |
-
)
|
73 |
-
);
|
74 |
-
}
|
75 |
-
|
76 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/php/aalb_internationalization_helper.php
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
-
|
6 |
-
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
-
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
8 |
-
A copy of the License is located in the "license" file accompanying this file.
|
9 |
-
|
10 |
-
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
11 |
-
either express or implied. See the License for the specific language governing permissions
|
12 |
-
and limitations under the License.
|
13 |
-
*/
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Helper class for internationalizing the strings
|
17 |
-
*
|
18 |
-
* @since 1.0.0
|
19 |
-
* @package AmazonAssociatesLinkBuilder
|
20 |
-
* @subpackage AmazonAssociatesLinkBuilder/lib/php
|
21 |
-
*/
|
22 |
-
class Aalb_Internationalization_Helper {
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Array that defines the translations for various marketplaces
|
26 |
-
*/
|
27 |
-
protected $translation_array;
|
28 |
-
|
29 |
-
public function __construct() {
|
30 |
-
$this->translation_array = array(
|
31 |
-
CHECK_ON_AMAZON => array(
|
32 |
-
US => "Check on Amazon",
|
33 |
-
FR => "Consulter sur Amazon.fr",
|
34 |
-
IT => "Vedi su Amazon.it",
|
35 |
-
DE => "Hier auf Amazon.de",
|
36 |
-
ES => "Consultar en Amazon.es",
|
37 |
-
BR => "Check on Amazon",
|
38 |
-
CA => "Check on Amazon",
|
39 |
-
CN => "Check on Amazon",
|
40 |
-
IN => "Check on Amazon",
|
41 |
-
JP => "Check on Amazon",
|
42 |
-
MX => "Check on Amazon",
|
43 |
-
UK => "Check on Amazon",
|
44 |
-
),
|
45 |
-
OUT_OF_STOCK => array(
|
46 |
-
US => "Out of stock",
|
47 |
-
FR => "Rupture de stock",
|
48 |
-
IT => "Non disponibile",
|
49 |
-
DE => "Derzeit nicht verfügbar",
|
50 |
-
ES => "Producto no disponible",
|
51 |
-
BR => "Out of stock",
|
52 |
-
CA => "Out of stock",
|
53 |
-
CN => "Out of stock",
|
54 |
-
IN => "Out of stock",
|
55 |
-
JP => "Out of stock",
|
56 |
-
MX => "Out of stock",
|
57 |
-
UK => "Out of stock",
|
58 |
-
),
|
59 |
-
);
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Internationalize stings by marketplace
|
64 |
-
*
|
65 |
-
* @since 1.0.0
|
66 |
-
*
|
67 |
-
* @param string $key Identifier of string to be translated
|
68 |
-
* @param string $marketplace The target marketplace name
|
69 |
-
*
|
70 |
-
* @return string
|
71 |
-
*/
|
72 |
-
public function internationalize_by_marketplace( $key, $marketplace ) {
|
73 |
-
$translated_string = $this->translation_array[ $key ][ $marketplace ];
|
74 |
-
|
75 |
-
if ( $translated_string == null ) {
|
76 |
-
//use english if transation is not available
|
77 |
-
$translated_string = $this->translation_array[ $key ][ AALB_DEFAULT_MARKETPLACE_NAME ];
|
78 |
-
if ( $translated_string == null ) {
|
79 |
-
//use key name if english is also not available
|
80 |
-
$translated_string = $key;
|
81 |
-
}
|
82 |
-
}
|
83 |
-
|
84 |
-
return $translated_string;
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/php/aalb_tracking_api_helper.php
DELETED
@@ -1,135 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
-
|
6 |
-
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
-
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
8 |
-
A copy of the License is located in the "license" file accompanying this file.
|
9 |
-
|
10 |
-
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
11 |
-
either express or implied. See the License for the specific language governing permissions
|
12 |
-
and limitations under the License.
|
13 |
-
*/
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Helper class for APIs used for impression and clicks tracking
|
17 |
-
*
|
18 |
-
* @since 1.0.0
|
19 |
-
* @package AmazonAssociatesLinkBuilder
|
20 |
-
* @subpackage AmazonAssociatesLinkBuilder/lib/php
|
21 |
-
*/
|
22 |
-
class Aalb_Tracking_Api_Helper {
|
23 |
-
|
24 |
-
protected $remote_loader;
|
25 |
-
protected $helper;
|
26 |
-
protected $version_info;
|
27 |
-
|
28 |
-
public function __construct() {
|
29 |
-
$this->remote_loader = new Aalb_Remote_Loader();
|
30 |
-
$this->helper = new Aalb_Helper();
|
31 |
-
|
32 |
-
//Initializes the version information once.
|
33 |
-
$plugin_version = AALB_PLUGIN_CURRENT_VERSION;
|
34 |
-
$wordpress_version = $this->helper->get_wordpress_version();
|
35 |
-
$this->version_info = array(
|
36 |
-
'wordpress' => $wordpress_version,
|
37 |
-
'plugin' => $plugin_version
|
38 |
-
);
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Returns the response of the link-id API.
|
43 |
-
* The GET request returns a unique link-id everytime a shortcode is added
|
44 |
-
*
|
45 |
-
* @since 1.0.0
|
46 |
-
*
|
47 |
-
* @param string $shortcode_name Name of the shortcode used
|
48 |
-
* @param string $shortcode_params Array of all shortcode parameter key-value pairs
|
49 |
-
*
|
50 |
-
* @return string Response of the get link-id API for the given link-id
|
51 |
-
*/
|
52 |
-
public function get_link_id( $shortcode_name, $shortcode_params ) {
|
53 |
-
$link_info = array(
|
54 |
-
'shortcode_name' => $shortcode_name, 'shortcode_params' => $shortcode_params, 'version' => $this->version_info
|
55 |
-
);
|
56 |
-
$request_body = wp_json_encode( $link_info );
|
57 |
-
$base_url = $this->get_base_url( 'link-id' );
|
58 |
-
$response = $this->remote_loader->post( $base_url, $request_body );
|
59 |
-
$response_body = json_decode( $response, true );
|
60 |
-
|
61 |
-
return $response_body["link-id"];
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Builds the base url for each tracking api request. Adds common parameters
|
66 |
-
*
|
67 |
-
* @since 1.0.0
|
68 |
-
*
|
69 |
-
* @param string $method_path Relative path of the api method to be called.
|
70 |
-
*
|
71 |
-
* @return string The base url with common query parameters
|
72 |
-
*/
|
73 |
-
private function get_base_url( $method_path ) {
|
74 |
-
$access_key_id = openssl_decrypt( base64_decode( get_option( AALB_AWS_ACCESS_KEY ) ), AALB_ENCRYPTION_ALGORITHM, AALB_ENCRYPTION_KEY, 0, AALB_ENCRYPTION_IV );
|
75 |
-
|
76 |
-
return ( AALB_TRACKING_API_ENDPOINT . $method_path . '?' . AALB_TRACKING_API_SOURCE_TOOL_QUERY_PARAM . '&' . AALB_TRACKING_API_ACCESS_KEY_QUERY_PARAM . $access_key_id );
|
77 |
-
}
|
78 |
-
|
79 |
-
/**
|
80 |
-
* Returns the response of the impressions API for a given link-id
|
81 |
-
* TODO: Not used post v1.4. Impression tracking plugged out for re-vamping purposes.
|
82 |
-
*
|
83 |
-
* @since 1.0.0
|
84 |
-
*
|
85 |
-
* @param string $link_id Link ID for which impression parameters are required
|
86 |
-
* @param string $shortcode_name Name of the shortcode used
|
87 |
-
* @param string $shortcode_params Array of all shortcode parameter key-value pairs
|
88 |
-
*
|
89 |
-
* @return string Response of the get impression API for the given link-id
|
90 |
-
*/
|
91 |
-
public function get_impression_params( $link_id, $shortcode_name, $shortcode_params ) {
|
92 |
-
$link_info = array(
|
93 |
-
'shortcode_name' => $shortcode_name, 'shortcode_params' => $shortcode_params, 'version' => $this->version_info
|
94 |
-
);
|
95 |
-
$request_body = wp_json_encode( $link_info );
|
96 |
-
$base_url = $this->get_base_url( 'impression' );
|
97 |
-
$url = $base_url . '&link-id=' . $link_id;
|
98 |
-
|
99 |
-
return $this->remote_loader->post( $url, $request_body );
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Returns the click URL by parsing the recieved getImpressions API Response
|
104 |
-
* TODO: Not used post v1.4. Impression Tracking plugged out for re-vamping purposes.
|
105 |
-
*
|
106 |
-
* @since 1.0.0
|
107 |
-
*
|
108 |
-
* @param string $impression_params JSON Response from the get impressions API for a link-id
|
109 |
-
*
|
110 |
-
* @return string $click_url Click URL for an impression ID
|
111 |
-
*/
|
112 |
-
public function get_click_url( $impression_params ) {
|
113 |
-
$body = json_decode( $impression_params, true );
|
114 |
-
|
115 |
-
return $body["click-url"];
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Echoes an invisible img with src=pixel-url to fire the pixels
|
120 |
-
* TODO: Not used post v1.4. Impression Tracking plugged out for re-vamping purposes.
|
121 |
-
*
|
122 |
-
* @since 1.0.0
|
123 |
-
*
|
124 |
-
* @param string $impression_params JSON Response from the get impressions API for a link-id
|
125 |
-
*/
|
126 |
-
public function insert_pixel( $impression_params ) {
|
127 |
-
$body = json_decode( $impression_params, true );
|
128 |
-
$pixel_url = $body["pixel-url"];
|
129 |
-
if ( ! is_amp_endpoint() ) {
|
130 |
-
echo '<img src="' . $pixel_url . '" style="display:none"></img>';
|
131 |
-
}
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/php/aalb_xml_helper.php
DELETED
@@ -1,321 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
-
|
6 |
-
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
-
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
8 |
-
A copy of the License is located in the "license" file accompanying this file.
|
9 |
-
|
10 |
-
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
11 |
-
either express or implied. See the License for the specific language governing permissions
|
12 |
-
and limitations under the License.
|
13 |
-
*/
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Helper class for customizations to the xml response
|
17 |
-
*
|
18 |
-
* @since 1.0.0
|
19 |
-
* @package AmazonAssociatesLinkBuilder
|
20 |
-
* @subpackage AmazonAssociatesLinkBuilder/lib/php
|
21 |
-
*/
|
22 |
-
class Aalb_Xml_Helper {
|
23 |
-
|
24 |
-
protected $internationalization_helper;
|
25 |
-
|
26 |
-
public function __construct() {
|
27 |
-
$this->internationalization_helper = new Aalb_Internationalization_Helper();
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Add custom nodes to xml response
|
32 |
-
*
|
33 |
-
* @since 1.0.0
|
34 |
-
*
|
35 |
-
* @param SimpleXMLElement $items Well-formed XML string
|
36 |
-
*
|
37 |
-
* @return SimpleXMLElement $items XML String with custom nodes added
|
38 |
-
*/
|
39 |
-
public function add_custom_nodes( $items, $marketplace ) {
|
40 |
-
$common_marketplace_node_name = 'Marketplace' . $marketplace;
|
41 |
-
$items->ID = "[[UNIQUE_ID]]";
|
42 |
-
|
43 |
-
//add aalb nodes needed for each item
|
44 |
-
foreach ( $items->Item as $item ) {
|
45 |
-
$aalb_node = $item->addChild( 'aalb' );
|
46 |
-
|
47 |
-
$aalb_node->ASIN = isset( $item->ASIN ) ? $item->ASIN : null;
|
48 |
-
$aalb_node->Title = isset( $item->ItemAttributes->Title ) ? $item->ItemAttributes->Title : null;
|
49 |
-
$aalb_node->DetailPageURL = isset( $item->DetailPageURL ) ? $item->DetailPageURL : null;
|
50 |
-
$aalb_node->LargeImageURL = isset( $item->LargeImage->URL ) ? $item->LargeImage->URL : null;
|
51 |
-
$aalb_node->MediumImageURL = isset( $item->MediumImage->URL ) ? $item->MediumImage->URL : null;
|
52 |
-
$aalb_node->SmallImageURL = isset( $item->SmallImageURL->URL ) ? $item->SmallImage->URL : null;
|
53 |
-
|
54 |
-
//Marketplace
|
55 |
-
$marketplace_node_name = $common_marketplace_node_name;
|
56 |
-
$aalb_node = $this->add_xml_node( $aalb_node, $marketplace_node_name, 'true' );
|
57 |
-
|
58 |
-
//By Information
|
59 |
-
$aalb_node = $this->add_by_information_node( $item, $aalb_node );
|
60 |
-
|
61 |
-
//Savings
|
62 |
-
$aalb_node = $this->add_savings_node( $item, $aalb_node );
|
63 |
-
|
64 |
-
//MinimumPrice
|
65 |
-
$aalb_node = $this->add_min_price_node( $item, $aalb_node );
|
66 |
-
|
67 |
-
//Prime
|
68 |
-
$aalb_node = $this->add_prime_node( $item, $aalb_node );
|
69 |
-
|
70 |
-
//Merchant Name
|
71 |
-
$aalb_node = $this->add_merchant_node( $item, $aalb_node );
|
72 |
-
|
73 |
-
//Current and Strike Price
|
74 |
-
$aalb_node = $this->add_price_nodes( $item, $aalb_node );
|
75 |
-
|
76 |
-
|
77 |
-
//Node to check "out of stock" items
|
78 |
-
$aalb_node = $this->add_out_of_stock_node( $item, $aalb_node, $marketplace );
|
79 |
-
|
80 |
-
|
81 |
-
//If the Buying Price is empty or if is is Too Low to Display
|
82 |
-
if ( empty( $aalb_node->CurrentPrice ) or strtolower( $aalb_node->CurrentPrice ) == 'too low to display' ) {
|
83 |
-
$aalb_node->CurrentPrice = $this->internationalization_helper->internationalize_by_marketplace( CHECK_ON_AMAZON, $marketplace );
|
84 |
-
}
|
85 |
-
}
|
86 |
-
|
87 |
-
//add common aalb nodes
|
88 |
-
$aalb_common_node = $items->addChild( 'AalbHeader' );
|
89 |
-
$aalb_common_node = $this->add_xml_node( $aalb_common_node, $common_marketplace_node_name, 'true' );
|
90 |
-
|
91 |
-
return $items;
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Adds a child xml node to a given parent node if the value is not empty.
|
96 |
-
*
|
97 |
-
* @since 1.0.0
|
98 |
-
*
|
99 |
-
* @param SimpleXMLElement $parent_node PHP XML Object of parent node
|
100 |
-
* @param string $node_name Name of the new node to be added
|
101 |
-
* @param string $node_value Value of the new node to be added
|
102 |
-
*
|
103 |
-
* @return SimpleXMLElement $parent_node Parent node with added child node
|
104 |
-
*/
|
105 |
-
public function add_xml_node( $parent_node, $node_name, $node_value ) {
|
106 |
-
if ( ! empty( $node_value ) ) {
|
107 |
-
$parent_node->$node_name = $node_value;
|
108 |
-
}
|
109 |
-
|
110 |
-
return $parent_node;
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Adds By Information Node
|
115 |
-
* And separated list of all artists, brands and authors
|
116 |
-
*
|
117 |
-
* @since 1.0.0
|
118 |
-
*
|
119 |
-
* @param SimpleXMLElement $item Well formed XML String: The Parent item node
|
120 |
-
* @param SimpleXMLElement $aalb_node Node to which values are to be added
|
121 |
-
*
|
122 |
-
* @return SimpleXMLElement Modified aalb_node
|
123 |
-
*/
|
124 |
-
public function add_by_information_node( $item, $aalb_node ) {
|
125 |
-
$author_array = array();
|
126 |
-
$brand_array = array();
|
127 |
-
$artist_array = array();
|
128 |
-
$by_information = array();
|
129 |
-
foreach ( $item->ItemAttributes->Author as $author ) {
|
130 |
-
array_push( $author_array, $author );
|
131 |
-
}
|
132 |
-
foreach ( $item->ItemAttributes->Brand as $brand ) {
|
133 |
-
array_push( $brand_array, $brand );
|
134 |
-
}
|
135 |
-
foreach ( $item->ItemAttributes->Artist as $artist ) {
|
136 |
-
array_push( $artist_array, $artist );
|
137 |
-
}
|
138 |
-
if ( ! empty( $author_array ) ) {
|
139 |
-
array_push( $by_information, implode( ', ', $author_array ) );
|
140 |
-
}
|
141 |
-
if ( ! empty( $brand_array ) ) {
|
142 |
-
array_push( $by_information, implode( ', ', $brand_array ) );
|
143 |
-
}
|
144 |
-
if ( ! empty( $artist_array ) ) {
|
145 |
-
array_push( $by_information, implode( ', ', $artist_array ) );
|
146 |
-
}
|
147 |
-
$aalb_node->By = implode( ' and ', $by_information );
|
148 |
-
|
149 |
-
return $aalb_node;
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Adds Savings related nodes
|
154 |
-
* Adds Amount saved in both raw and formatted way and the percentage saved.
|
155 |
-
* Savings node are added only if we get saving nodes in the XML response from PAAPI.
|
156 |
-
*
|
157 |
-
* @since 1.0.0
|
158 |
-
*
|
159 |
-
* @param SimpleXMLElement $item Well formed XML String: The Parent item node
|
160 |
-
* @param SimpleXMLElement $aalb_node Node to which values are to be added
|
161 |
-
*
|
162 |
-
* @return SimpleXMLElement Node to which values are added
|
163 |
-
*/
|
164 |
-
public function add_savings_node( $item, $aalb_node ) {
|
165 |
-
if ( ! empty( $item->Offers->Offer->OfferListing->AmountSaved->FormattedPrice ) ) {
|
166 |
-
$aalb_node = $this->add_xml_node( $aalb_node, 'Saving', $item->Offers->Offer->OfferListing->AmountSaved->FormattedPrice );
|
167 |
-
}
|
168 |
-
if ( ! empty( $item->Offers->Offer->OfferListing->AmountSaved->Amount ) ) {
|
169 |
-
$aalb_node = $this->add_xml_node( $aalb_node, 'SavingValue', $item->Offers->Offer->OfferListing->AmountSaved->Amount );
|
170 |
-
}
|
171 |
-
if ( ! empty( $item->Offers->Offer->OfferListing->PercentageSaved ) ) {
|
172 |
-
$aalb_node = $this->add_xml_node( $aalb_node, 'SavingPercent', $item->Offers->Offer->OfferListing->PercentageSaved );
|
173 |
-
}
|
174 |
-
|
175 |
-
return $aalb_node;
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Adds Minimum Price related nodes
|
180 |
-
* Adds raw and formatted values of minimum price
|
181 |
-
*
|
182 |
-
* @since 1.0.0
|
183 |
-
*
|
184 |
-
* @param SimpleXMLElement $item Well formed XML String: The Parent item node
|
185 |
-
* @param SimpleXMLElement $aalb_node Node to which values are to be added
|
186 |
-
*
|
187 |
-
* @return SimpleXMLElement Node to which values are added
|
188 |
-
*/
|
189 |
-
public function add_min_price_node( $item, $aalb_node ) {
|
190 |
-
if ( ! empty( $item->OfferSummary->LowestNewPrice->FormattedPrice ) ) {
|
191 |
-
$aalb_node = $this->add_xml_node( $aalb_node, 'MinimumPrice', $item->OfferSummary->LowestNewPrice->FormattedPrice );
|
192 |
-
}
|
193 |
-
if ( ! empty( $item->OfferSummary->LowestNewPrice->Amount ) ) {
|
194 |
-
$aalb_node = $this->add_xml_node( $aalb_node, 'MinimumPriceValue', $item->OfferSummary->LowestNewPrice->Amount );
|
195 |
-
}
|
196 |
-
|
197 |
-
return $aalb_node;
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* Adds Prime node
|
202 |
-
* Adds Prime node if the item is eligible for prime
|
203 |
-
*
|
204 |
-
* @since 1.4.1
|
205 |
-
*
|
206 |
-
* @param SimpleXMLElement $item Well formed XML String: The Parent item node
|
207 |
-
* @param SimpleXMLElement $aalb_node Node to which values are to be added
|
208 |
-
*
|
209 |
-
* @return SimpleXMLElement Node to which values are added
|
210 |
-
*/
|
211 |
-
public function add_prime_node( $item, $aalb_node ) {
|
212 |
-
if ( ! empty( $item->Offers->Offer->OfferListing->IsEligibleForPrime ) ) {
|
213 |
-
$aalb_node = $this->add_xml_node( $aalb_node, 'Prime', $item->Offers->Offer->OfferListing->IsEligibleForPrime );
|
214 |
-
}
|
215 |
-
|
216 |
-
return $aalb_node;
|
217 |
-
}
|
218 |
-
|
219 |
-
/**
|
220 |
-
* Adds Merchant node
|
221 |
-
* Adds Merchant information inside the Merchant node
|
222 |
-
*
|
223 |
-
* @since 1.4.1
|
224 |
-
*
|
225 |
-
* @param SimpleXMLElement $item Well formed XML String: The Parent item node
|
226 |
-
* @param SimpleXMLElement $aalb_node Node to which values are to be added
|
227 |
-
*
|
228 |
-
* @return SimpleXMLElement Node to which values are added
|
229 |
-
*/
|
230 |
-
public function add_merchant_node( $item, $aalb_node ) {
|
231 |
-
if ( ! empty( $item->Offers->Offer->Merchant->Name ) ) {
|
232 |
-
$aalb_node = $this->add_xml_node( $aalb_node, 'Merchant', $item->Offers->Offer->Merchant->Name );
|
233 |
-
}
|
234 |
-
|
235 |
-
return $aalb_node;
|
236 |
-
}
|
237 |
-
|
238 |
-
/**
|
239 |
-
* Adds Current Price and Strike Price Nodes after applying logic
|
240 |
-
* Logic for Current Price and Strike Price
|
241 |
-
*
|
242 |
-
* @since 1.0.0
|
243 |
-
*
|
244 |
-
* @param SimpleXMLElement $item Well formed XML String: The Parent item node
|
245 |
-
* @param SimpleXMLElement $aalb_node Node to which values are to be added
|
246 |
-
*
|
247 |
-
* @return SimpleXMLElement Node to which values are added
|
248 |
-
*/
|
249 |
-
public function add_price_nodes( $item, $aalb_node ) {
|
250 |
-
$list_price = isset( $item->ItemAttributes->ListPrice->FormattedPrice ) ? $item->ItemAttributes->ListPrice->FormattedPrice : null;
|
251 |
-
$price = isset( $item->Offers->Offer->OfferListing->Price->FormattedPrice ) ? $item->Offers->Offer->OfferListing->Price->FormattedPrice : null;
|
252 |
-
$sale_price = isset( $item->Offers->Offer->OfferListing->SalePrice->FormattedPrice ) ? $item->Offers->Offer->OfferListing->SalePrice->FormattedPrice : null;
|
253 |
-
$list_price_amount = isset( $item->ItemAttributes->ListPrice->Amount ) ? $item->ItemAttributes->ListPrice->Amount : null;
|
254 |
-
$price_amount = isset( $item->Offers->Offer->OfferListing->Price->Amount ) ? $item->Offers->Offer->OfferListing->Price->Amount : null;
|
255 |
-
$sale_price_amount = isset( $item->Offers->Offer->OfferListing->SalePrice->Amount ) ? $item->Offers->Offer->OfferListing->SalePrice->Amount : null;
|
256 |
-
if ( ! empty( $sale_price_amount ) ) {
|
257 |
-
//If Sale Price is returned
|
258 |
-
$aalb_node->CurrentPrice = $sale_price;
|
259 |
-
$aalb_node->CurrentPriceValue = $sale_price_amount;
|
260 |
-
if ( (int) $aalb_node->SavingPercent > 1 ) {
|
261 |
-
$aalb_node->StrikePrice = $price;
|
262 |
-
$aalb_node->StrikePriceValue = $price_amount;
|
263 |
-
}
|
264 |
-
} else {
|
265 |
-
$aalb_node->CurrentPrice = $price;
|
266 |
-
$aalb_node->CurrentPriceValue = $price_amount;
|
267 |
-
if ( (int) $aalb_node->SavingPercent > 1 ) {
|
268 |
-
$aalb_node->StrikePrice = $list_price;
|
269 |
-
$aalb_node->StrikePriceValue = $list_price_amount;
|
270 |
-
}
|
271 |
-
}
|
272 |
-
|
273 |
-
return $aalb_node;
|
274 |
-
}
|
275 |
-
|
276 |
-
/**
|
277 |
-
* Adds InStock node if the item is in stock; Updates Current Price otherwise
|
278 |
-
*
|
279 |
-
* @since 1.0.0
|
280 |
-
*
|
281 |
-
* @param SimpleXMLElement $item Well formed XML String: The Parent item node
|
282 |
-
* @param SimpleXMLElement $aalb_node Node to which values are to be added
|
283 |
-
*
|
284 |
-
* @oaram string $marketplace
|
285 |
-
*
|
286 |
-
* @return SimpleXMLElement Node to which values are added
|
287 |
-
*/
|
288 |
-
public function add_out_of_stock_node( $item, $aalb_node, $marketplace ) {
|
289 |
-
$total_new = isset( $item->OfferSummary->TotalNew ) ? $item->OfferSummary->TotalNew : null;
|
290 |
-
$availability = isset( $item->Offers->Offer->OfferListing->Availability ) ? $item->Offers->Offer->OfferListing->Availability : null;
|
291 |
-
if ( ( $total_new == '0' or $availability == "Out of Stock" ) ) {
|
292 |
-
//If the item is out of stock, update Buying Price
|
293 |
-
$aalb_node->CurrentPrice = $this->internationalization_helper->internationalize_by_marketplace( OUT_OF_STOCK, $marketplace );;
|
294 |
-
} else {
|
295 |
-
//If the item is in stock; add a xml node to identify values in stock
|
296 |
-
$aalb_node->InStock = 'Yes True';
|
297 |
-
}
|
298 |
-
|
299 |
-
return $aalb_node;
|
300 |
-
}
|
301 |
-
|
302 |
-
/**
|
303 |
-
* Adds Click URL Prefix to requierd hyperlinks
|
304 |
-
* TODO: Not used post v1.4. Impression Tracking plugged out for re-vamping purposes.
|
305 |
-
*
|
306 |
-
* @since 1.0.0
|
307 |
-
*
|
308 |
-
* @param SimpleXMLElement $items Well formed XML String
|
309 |
-
*
|
310 |
-
* @return SimpleXMLElement $items XML String with hyperlinks prefixed with click URL
|
311 |
-
*/
|
312 |
-
public function prefix_click_URL( $items ) {
|
313 |
-
foreach ( $items->Item as $item ) {
|
314 |
-
$item->DetailPageURL = '[[CLICK_URL_PREFIX]]' . $item->DetailPageURL;
|
315 |
-
}
|
316 |
-
|
317 |
-
return $items;
|
318 |
-
}
|
319 |
-
}
|
320 |
-
|
321 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin_config.php
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
+
|
6 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
8 |
+
A copy of the License is located in the "license" file accompanying this file.
|
9 |
+
|
10 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
11 |
+
either express or implied. See the License for the specific language governing permissions
|
12 |
+
and limitations under the License.
|
13 |
+
*/
|
14 |
+
|
15 |
+
define( 'AALB_PLUGIN_NAME', 'Amazon Associates Link Builder' );
|
16 |
+
//PHP version compatible for AALB plugin
|
17 |
+
define( 'AALB_PLUGIN_MINIMUM_SUPPORTED_PHP_VERSION', '5.4.0' );
|
18 |
+
|
19 |
+
//paths
|
20 |
+
define( 'AALB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
21 |
+
define( 'AALB_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
22 |
+
|
23 |
+
//Directories
|
24 |
+
define( 'AALB_TEMPLATE_DIR', AALB_PLUGIN_DIR . 'template/' );
|
25 |
+
define( 'AALB_ADMIN_DIR', AALB_PLUGIN_DIR . 'admin/' );
|
26 |
+
define( 'AALB_SIDEBAR_DIR', AALB_PLUGIN_DIR . 'admin/sidebar/' );
|
27 |
+
define( 'AALB_INCLUDES_DIR', AALB_PLUGIN_DIR . 'includes/' );
|
28 |
+
define( 'AALB_PAAPI_DIR', AALB_PLUGIN_DIR . 'lib/php/Paapi/' );
|
29 |
+
define( 'AALB_SHORTCODE_DIR', AALB_PLUGIN_DIR . 'shortcode/' );
|
30 |
+
define( 'AALB_LIBRARY_DIR', AALB_PLUGIN_DIR . 'lib/php/' );
|
31 |
+
define( 'AALB_SIDEBAR_HELPER_DIR', AALB_PLUGIN_DIR . 'admin/sidebar/partials/helper/' );
|
32 |
+
define( 'AALB_IP_2_COUNTRY_DIR', AALB_PLUGIN_DIR . 'ip2country/' );
|
33 |
+
define( 'AALB_EXCEPTIONS_DIR', AALB_PLUGIN_DIR . 'exceptions/' );
|
34 |
+
define( 'AALB_IO_DIR', AALB_PLUGIN_DIR . 'io/' );
|
35 |
+
define( 'AALB_HELPER_DIR', AALB_PLUGIN_DIR . 'helper/' );
|
36 |
+
define( 'AALB_CONFIGURATION_DIR', AALB_PLUGIN_DIR . 'configuration/' );
|
37 |
+
define( 'AALB_RENDERING_DIR', AALB_PLUGIN_DIR . 'rendering/' );
|
38 |
+
define( 'AALB_CACHE_DIR', AALB_PLUGIN_DIR . 'cache/' );
|
39 |
+
define( 'AALB_VIEW_PARTIALS_DIR', AALB_PLUGIN_DIR . 'view/partials/' );
|
40 |
+
define( 'AALB_VIEW_SIDEBAR_PARTIALS_DIR', AALB_PLUGIN_DIR . 'view/sidebar_partials/' );
|
41 |
+
define( 'AALB_JS_DIR', AALB_PLUGIN_DIR . 'js/' );
|
42 |
+
define( 'AALB_CSS_DIR', AALB_PLUGIN_DIR . 'css/' );
|
43 |
+
define( 'AALB_CONSTANTS_DIR', AALB_PLUGIN_DIR . 'constants/' );
|
44 |
+
define( 'AALB_TEMPLATE_UPLOADS_FOLDER', 'amazon-associates-link-builder/template/' );
|
45 |
+
|
46 |
+
//Classes
|
47 |
+
define( 'AALB_ABOUT_PHP', AALB_VIEW_SIDEBAR_PARTIALS_DIR . 'about.php' );
|
48 |
+
define( 'AALB_CREDENTIALS_PHP', AALB_VIEW_SIDEBAR_PARTIALS_DIR . 'credentials.php' );
|
49 |
+
define( 'AALB_TEMPLATE_PHP', AALB_VIEW_SIDEBAR_PARTIALS_DIR . 'templates.php' );
|
50 |
+
define( 'AALB_META_BOX_PARTIAL', AALB_VIEW_PARTIALS_DIR . 'meta_box.php' );
|
51 |
+
define( 'AALB_EDITOR_SEARCH_BOX', AALB_VIEW_PARTIALS_DIR . 'editor_search_box.php' );
|
52 |
+
define( 'AALB_AUTOLOADER', AALB_PLUGIN_DIR . 'includes/autoloader.php' );
|
53 |
+
define( 'AALB_COMPATIBILITY_HELPER', AALB_HELPER_DIR . 'aalb_compatibility_helper.php' );
|
54 |
+
define( 'AALB_INITIALIZER', AALB_INCLUDES_DIR . 'aalb_initializer.php' );
|
55 |
+
//Configuration JSON
|
56 |
+
define( 'AALB_MARKETPLACE_CONFIG_JSON', AALB_CONFIGURATION_DIR . 'marketplace_config.json' );
|
57 |
+
//Mustache Templates
|
58 |
+
define( 'AALB_ADMIN_ITEM_SEARCH_ITEMS_PATH', AALB_VIEW_PARTIALS_DIR . 'admin_item_search_items.php' );
|
59 |
+
|
60 |
+
//Templates Directory
|
61 |
+
define( 'AALB_TEMPLATE_URL', AALB_PLUGIN_URL . 'template/' );
|
62 |
+
|
63 |
+
//Local Styles
|
64 |
+
define( 'AALB_ADMIN_CSS', AALB_PLUGIN_URL . 'css/aalb_admin.css' );
|
65 |
+
define( 'AALB_CREDENTIALS_CSS', AALB_PLUGIN_URL . 'css/aalb_credentials.css' );
|
66 |
+
define( 'AALB_BASICS_CSS', AALB_PLUGIN_URL . 'css/aalb_basics.css' );
|
67 |
+
|
68 |
+
//Local Scripts
|
69 |
+
define( 'AALB_SHA2_JS', AALB_PLUGIN_URL . 'lib/js/jssha2/sha2.js' );
|
70 |
+
define( 'AALB_ADMIN_JS', AALB_PLUGIN_URL . 'js/aalb_admin.js' );
|
71 |
+
define( 'AALB_TEMPLATE_JS', AALB_PLUGIN_URL . 'js/aalb_template.js' );
|
72 |
+
define( 'AALB_CREDENTIALS_JS', AALB_PLUGIN_URL . 'js/aalb_credentials.js' );
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Icons
|
76 |
+
*/
|
77 |
+
define( 'AALB_SECURE_HOSTNAME', 'https://images-na.ssl-images-amazon.com/' );
|
78 |
+
define( 'AALB_NORMAL_HOSTNAME', 'http://g-ecx.images-amazon.com/' );
|
79 |
+
define( 'AALB_ICON_LOCATION', 'images/G/01/PAAPI/AmazonAssociatesLinkBuilder/icon-2._V276841048_.png' );
|
80 |
+
define( 'AALB_ADMIN_ICON_LOCATION', 'images/G/01/PAAPI/AmazonAssociatesLinkBuilder/amazon_icon._V506839993_.png' );
|
81 |
+
//AALB_ICON URL is generated by wordpress at run-time by checking the remotehost's encryption. Image source has different URLs depending upon the encryption used.
|
82 |
+
if ( is_ssl() ) {
|
83 |
+
define( 'AALB_ICON', AALB_SECURE_HOSTNAME . AALB_ICON_LOCATION );
|
84 |
+
} else {
|
85 |
+
define( 'AALB_ICON', AALB_NORMAL_HOSTNAME . AALB_ICON_LOCATION );
|
86 |
+
}
|
87 |
+
define( 'AALB_ADMIN_ICON', AALB_SECURE_HOSTNAME . AALB_ADMIN_ICON_LOCATION );
|
88 |
+
|
89 |
+
//Geolite DB Retry Durations
|
90 |
+
define( 'AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_MIN', 30 * MINUTE_IN_SECONDS );
|
91 |
+
define( 'AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_MAX', 2 * DAY_IN_SECONDS );
|
92 |
+
define( 'AALB_GEOLITE_DB_DOWNLOAD_RETRY_DURATION_ON_SUCCESS', 3 * DAY_IN_SECONDS );
|
93 |
+
define( 'AALB_GEOLITE_DB_MAX_ALLOWED_AGE', 60 * DAY_IN_SECONDS );
|
94 |
+
|
95 |
+
//Caching Requirements
|
96 |
+
//====================
|
97 |
+
//As defined by the Product Advertising API License Agreement at https://affiliate-program.amazon.com/gp/advertising/api/detail/agreement.html,
|
98 |
+
//Dated Jul 22, 2016, Section 4(n) and 4(o), caching of product information is permitted upto a maximum of 24-hours.
|
99 |
+
//Further, if the product price is not refreshed every one hour, the displayed price should be accompanied with a timestamp when the price was read.
|
100 |
+
//Note that the plugin uses a two tier cache. It caches the ASINs as well as the rendered templates.
|
101 |
+
//At any given time the sum of ASIN cache TTL and Rendered AdUnit cache TTL should be less than or equal to one hour.
|
102 |
+
//The below configuration is compliant with the License Agreement. Any modification may result in the violation of the license agreement.
|
103 |
+
define( 'AALB_CACHE_FOR_ASIN_RAWINFO_TTL', 30 * MINUTE_IN_SECONDS );
|
104 |
+
define( 'AALB_CACHE_FOR_ASIN_ADUNIT_TTL', 30 * MINUTE_IN_SECONDS );
|
105 |
+
|
106 |
+
define( 'AALB_SETTINGS_PAGE_URL', admin_url( 'admin.php?page=associates-link-builder-settings' ) );
|
107 |
+
define( 'TRUE', 'true' );
|
108 |
+
?>
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: amazonlinkbuilder
|
3 |
Tags: Amazon, Affiliate, Associates, Amazon Associates, Amazon Associate, Product Advertising API, Amazon API, Amazon Link, Amazon Ad, Amazon Affiliate, eCommerce
|
4 |
Requires at least: 3.0.1
|
5 |
-
Tested up to: 4.9.
|
6 |
-
Stable tag: 1.
|
7 |
Requires PHP: 5.4.0
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -116,6 +116,12 @@ You can see your earnings and other reports from the respective country Associat
|
|
116 |
|
117 |
== Changelog ==
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
= 1.7.0 - April 2, 2018 =
|
120 |
* Added support for wider character set sent by Product Advertising API(PA-API). More details about change on PA-API can be found [here](https://forums.aws.amazon.com/ann.jspa?annID=5543).
|
121 |
|
@@ -239,16 +245,19 @@ You can see your earnings and other reports from the respective country Associat
|
|
239 |
|
240 |
== Upgrade Notice ==
|
241 |
|
242 |
-
= 1.
|
|
|
|
|
|
|
243 |
* Added support for wider character set sent by Product Advertising API(PA-API). More details about change on PA-API can be found [here](https://forums.aws.amazon.com/ann.jspa?annID=5543).
|
244 |
|
245 |
-
= 1.6.0
|
246 |
* Added Impressions data in reports shown on respective associates website for ads rendered after upgrade to this release.
|
247 |
|
248 |
-
= 1.5.4
|
249 |
* Fix: In case of failed call to Product-Advertising API, Fatal error thrown.
|
250 |
|
251 |
-
= 1.5.3
|
252 |
Fixed Fatal error for users on PHP version <5.4.0 along with search-button, multi-tab issues faced by few associates.
|
253 |
|
254 |
= 1.5.2 =
|
2 |
Contributors: amazonlinkbuilder
|
3 |
Tags: Amazon, Affiliate, Associates, Amazon Associates, Amazon Associate, Product Advertising API, Amazon API, Amazon Link, Amazon Ad, Amazon Affiliate, eCommerce
|
4 |
Requires at least: 3.0.1
|
5 |
+
Tested up to: 4.9.7
|
6 |
+
Stable tag: 1.8.0
|
7 |
Requires PHP: 5.4.0
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
116 |
|
117 |
== Changelog ==
|
118 |
|
119 |
+
= 1.8.0 - July 25, 2018 =
|
120 |
+
* Added support for Australia (AU) marketplace.
|
121 |
+
* Fix: SearchBox not disabled in case no tracking-ids have been entered.
|
122 |
+
* Fix: Plugin is not deactivated gracefully for PHP 5.2.
|
123 |
+
* Fix: Wrong error message shown when marketplaces lists is not returned by PA-API.
|
124 |
+
|
125 |
= 1.7.0 - April 2, 2018 =
|
126 |
* Added support for wider character set sent by Product Advertising API(PA-API). More details about change on PA-API can be found [here](https://forums.aws.amazon.com/ann.jspa?annID=5543).
|
127 |
|
245 |
|
246 |
== Upgrade Notice ==
|
247 |
|
248 |
+
= 1.8.0 =
|
249 |
+
* Added Support for Australia (AU) marketplace and minor bug-fixes.
|
250 |
+
|
251 |
+
= 1.7.0 =
|
252 |
* Added support for wider character set sent by Product Advertising API(PA-API). More details about change on PA-API can be found [here](https://forums.aws.amazon.com/ann.jspa?annID=5543).
|
253 |
|
254 |
+
= 1.6.0 =
|
255 |
* Added Impressions data in reports shown on respective associates website for ads rendered after upgrade to this release.
|
256 |
|
257 |
+
= 1.5.4 =
|
258 |
* Fix: In case of failed call to Product-Advertising API, Fatal error thrown.
|
259 |
|
260 |
+
= 1.5.3 =
|
261 |
Fixed Fatal error for users on PHP version <5.4.0 along with search-button, multi-tab issues faced by few associates.
|
262 |
|
263 |
= 1.5.2 =
|
includes/aalb_content_filter.php → rendering/content_filter.php
RENAMED
@@ -11,6 +11,10 @@ either express or implied. See the License for the specific language governing p
|
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
|
|
|
|
|
|
|
|
14 |
/**
|
15 |
* Fired during Content rendering of the post. It Modifies contents of the blog post.
|
16 |
* It is associated with the_content hook of the link builder plugin.
|
@@ -20,17 +24,33 @@ and limitations under the License.
|
|
20 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
21 |
* @author amipara
|
22 |
*/
|
23 |
-
class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
/**
|
26 |
-
* Attaches
|
27 |
* to intercept HTML content while post is being rendered if feature is enabled in settings.
|
28 |
*
|
29 |
* @since 1.4.5
|
30 |
*/
|
31 |
static function attach() {
|
32 |
-
if ( get_option(
|
33 |
-
add_filter( 'the_content', array( new
|
34 |
}
|
35 |
}
|
36 |
|
@@ -49,12 +69,12 @@ class Aalb_Content_Filter {
|
|
49 |
/**
|
50 |
* To avoid "Warning: DOMDocument::loadHTML(): Empty string supplied as input".
|
51 |
* Warning is not shown if content contains only whitespaces or/and newlines.
|
52 |
-
|
53 |
-
if( is_null( $content) || $content === "" ) {
|
54 |
return $content;
|
55 |
}
|
56 |
|
57 |
-
$document = new DomDocument();
|
58 |
|
59 |
//https://stackoverflow.com/questions/1148928/disable-warnings-when-loading-non-well-formed-html-by-domdocument-php
|
60 |
//Disable warnings generated while parsing
|
@@ -66,7 +86,7 @@ class Aalb_Content_Filter {
|
|
66 |
// Restore previous error queue before HTML parse
|
67 |
libxml_use_internal_errors( $libxml_previous_state );
|
68 |
|
69 |
-
$dom_xpath = new DOMXPath( $document );
|
70 |
$anchor_node_list = $dom_xpath->query( "//a[contains(@rel,'noreferrer')]" );
|
71 |
|
72 |
$content_updated = false;
|
@@ -88,7 +108,7 @@ class Aalb_Content_Filter {
|
|
88 |
*
|
89 |
* @since 1.4.5
|
90 |
*
|
91 |
-
* @param DOMElement $node HTML blog content to be rendered.
|
92 |
*
|
93 |
* @return boolean true when $node points to amazon url other wise false.
|
94 |
*/
|
@@ -104,7 +124,7 @@ class Aalb_Content_Filter {
|
|
104 |
*
|
105 |
* @since 1.4.5
|
106 |
*
|
107 |
-
* @param DOMElement $node Anchor link node for which noreferrer needs to removed.
|
108 |
*
|
109 |
*/
|
110 |
private function remove_noreferrer( $node ) {
|
@@ -117,15 +137,15 @@ class Aalb_Content_Filter {
|
|
117 |
}
|
118 |
}
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
|
131 |
}
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
14 |
+
namespace AmazonAssociatesLinkBuilder\rendering;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
17 |
+
|
18 |
/**
|
19 |
* Fired during Content rendering of the post. It Modifies contents of the blog post.
|
20 |
* It is associated with the_content hook of the link builder plugin.
|
24 |
* @subpackage AmazonAssociatesLinkBuilder/includes
|
25 |
* @author amipara
|
26 |
*/
|
27 |
+
class Content_Filter {
|
28 |
+
private static $AMAZON_DOMAINS = array(
|
29 |
+
'amazon\.com',
|
30 |
+
'amazon\.fr',
|
31 |
+
'amazon\.it',
|
32 |
+
'amazon\.de',
|
33 |
+
'amazon\.es',
|
34 |
+
'amazon\.com\.br',
|
35 |
+
'amazon\.ca',
|
36 |
+
'amazon\.cn',
|
37 |
+
'amazon\.in',
|
38 |
+
'amazon\.co\.jp',
|
39 |
+
'amazon\.com\.mx',
|
40 |
+
'amazon\.co\.uk',
|
41 |
+
'amazon\.com\.au',
|
42 |
+
'amzn\.to'
|
43 |
+
);
|
44 |
|
45 |
/**
|
46 |
+
* Attaches Content_Filter to the "the_content" hook of Wordpress
|
47 |
* to intercept HTML content while post is being rendered if feature is enabled in settings.
|
48 |
*
|
49 |
* @since 1.4.5
|
50 |
*/
|
51 |
static function attach() {
|
52 |
+
if ( get_option( Db_Constants::NO_REFERRER_DISABLED ) ) {
|
53 |
+
add_filter( 'the_content', array( new Content_Filter(), 'filter' ) );
|
54 |
}
|
55 |
}
|
56 |
|
69 |
/**
|
70 |
* To avoid "Warning: DOMDocument::loadHTML(): Empty string supplied as input".
|
71 |
* Warning is not shown if content contains only whitespaces or/and newlines.
|
72 |
+
*/
|
73 |
+
if ( is_null( $content ) || $content === "" ) {
|
74 |
return $content;
|
75 |
}
|
76 |
|
77 |
+
$document = new \DomDocument();
|
78 |
|
79 |
//https://stackoverflow.com/questions/1148928/disable-warnings-when-loading-non-well-formed-html-by-domdocument-php
|
80 |
//Disable warnings generated while parsing
|
86 |
// Restore previous error queue before HTML parse
|
87 |
libxml_use_internal_errors( $libxml_previous_state );
|
88 |
|
89 |
+
$dom_xpath = new \DOMXPath( $document );
|
90 |
$anchor_node_list = $dom_xpath->query( "//a[contains(@rel,'noreferrer')]" );
|
91 |
|
92 |
$content_updated = false;
|
108 |
*
|
109 |
* @since 1.4.5
|
110 |
*
|
111 |
+
* @param \DOMElement $node HTML blog content to be rendered.
|
112 |
*
|
113 |
* @return boolean true when $node points to amazon url other wise false.
|
114 |
*/
|
124 |
*
|
125 |
* @since 1.4.5
|
126 |
*
|
127 |
+
* @param \DOMElement $node Anchor link node for which noreferrer needs to removed.
|
128 |
*
|
129 |
*/
|
130 |
private function remove_noreferrer( $node ) {
|
137 |
}
|
138 |
}
|
139 |
|
140 |
+
/**
|
141 |
+
* Generates amazon url regex from list of amazon domain names.
|
142 |
+
*
|
143 |
+
* @since 1.4.5
|
144 |
+
*
|
145 |
+
* @return string amazon url regex
|
146 |
+
*/
|
147 |
+
private function amazon_url_regex() {
|
148 |
+
return '/(' . implode( '$|', Content_Filter::$AMAZON_DOMAINS ) . '$)/i';
|
149 |
+
}
|
150 |
|
151 |
}
|
lib/php/aalb_impression_generator.php → rendering/impression_generator.php
RENAMED
@@ -11,6 +11,11 @@ either express or implied. See the License for the specific language governing p
|
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
/**
|
15 |
* Class to generate HTML element for impressions for impression tracking
|
16 |
*
|
@@ -18,7 +23,13 @@ and limitations under the License.
|
|
18 |
* @package AmazonAssociatesLinkBuilder
|
19 |
* @subpackage AmazonAssociatesLinkBuilder/lib/php
|
20 |
*/
|
21 |
-
class
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
/*
|
23 |
* @since 1.6.0
|
24 |
*
|
@@ -32,12 +43,13 @@ class Aalb_Impression_Generator {
|
|
32 |
* @throws InvalidArgumentException
|
33 |
*
|
34 |
*/
|
35 |
-
public function get_impression( $marketplace_abbreviation, $link_code =
|
36 |
if ( empty( $store_id ) ) {
|
37 |
-
throw new InvalidArgumentException( "Empty Store Id passed" );
|
38 |
}
|
39 |
-
$
|
40 |
-
$
|
|
|
41 |
|
42 |
return $this->get_html_for_pixel_image_of_all_asins( $impression_recorder_service_endpoint, $store_id, $link_code, $org_unit_id, $asins );
|
43 |
}
|
@@ -53,7 +65,7 @@ class Aalb_Impression_Generator {
|
|
53 |
*
|
54 |
* @return String HTML for the pixel image of all asins in $asin_group
|
55 |
*
|
56 |
-
* @throws InvalidArgumentException
|
57 |
*
|
58 |
*/
|
59 |
private function get_html_for_pixel_image_of_all_asins( $impression_recorder_service_endpoint, $store_id, $link_code, $org_unit_id, $asin_group ) {
|
@@ -67,50 +79,6 @@ class Aalb_Impression_Generator {
|
|
67 |
return $pixel_image_for_all_asins;
|
68 |
}
|
69 |
|
70 |
-
/*
|
71 |
-
* Returns service endpoint for a marketplace
|
72 |
-
*
|
73 |
-
* @since 1.6.0
|
74 |
-
*
|
75 |
-
* @param String $marketplace_abbreviation Abbreviation of marketplace
|
76 |
-
*
|
77 |
-
* @return String $impression_recorder_service_endpoint
|
78 |
-
*
|
79 |
-
* @throws InvalidArgumentException
|
80 |
-
*
|
81 |
-
*/
|
82 |
-
private function get_service_endpoint( $marketplace_abbreviation ) {
|
83 |
-
if ( array_key_exists( $marketplace_abbreviation, Aalb_Impression_Recorder_Service_Config::$configuration ) ) {
|
84 |
-
$service_endpoint = Aalb_Impression_Recorder_Service_Config::$configuration[$marketplace_abbreviation]['service_endpoint'];
|
85 |
-
} else {
|
86 |
-
throw new InvalidArgumentException( "Invalid Marketplace value:" . $marketplace_abbreviation . " passed" );
|
87 |
-
}
|
88 |
-
|
89 |
-
return $service_endpoint;
|
90 |
-
}
|
91 |
-
|
92 |
-
/*
|
93 |
-
* Returns Org Unit Id for a marketplace
|
94 |
-
*
|
95 |
-
* @since 1.6.0
|
96 |
-
*
|
97 |
-
* @param String $marketplace_abbreviation Abbreviation of marketplace
|
98 |
-
*
|
99 |
-
* @return Integer $org_unit_id
|
100 |
-
*
|
101 |
-
* @throws InvalidArgumentException
|
102 |
-
*
|
103 |
-
*/
|
104 |
-
private function get_org_unit_id( $marketplace_abbreviation ) {
|
105 |
-
if ( array_key_exists( $marketplace_abbreviation, Aalb_Impression_Recorder_Service_Config::$configuration ) ) {
|
106 |
-
$org_unit_id = Aalb_Impression_Recorder_Service_Config::$configuration[$marketplace_abbreviation]['org_unit_id'];
|
107 |
-
} else {
|
108 |
-
throw new InvalidArgumentException( "Invalid Marketplace value:" . $marketplace_abbreviation . " passed" );
|
109 |
-
}
|
110 |
-
|
111 |
-
return $org_unit_id;
|
112 |
-
}
|
113 |
-
|
114 |
/*
|
115 |
* @since 1.6.0
|
116 |
*
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
14 |
+
namespace AmazonAssociatesLinkBuilder\rendering;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\configuration\Config_Helper;
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
18 |
+
|
19 |
/**
|
20 |
* Class to generate HTML element for impressions for impression tracking
|
21 |
*
|
23 |
* @package AmazonAssociatesLinkBuilder
|
24 |
* @subpackage AmazonAssociatesLinkBuilder/lib/php
|
25 |
*/
|
26 |
+
class Impression_Generator {
|
27 |
+
private $configuration_helper;
|
28 |
+
|
29 |
+
public function __construct( Config_Helper $configuration_helper ) {
|
30 |
+
$this->configuration_helper = $configuration_helper;
|
31 |
+
}
|
32 |
+
|
33 |
/*
|
34 |
* @since 1.6.0
|
35 |
*
|
43 |
* @throws InvalidArgumentException
|
44 |
*
|
45 |
*/
|
46 |
+
public function get_impression( $marketplace_abbreviation, $link_code = Plugin_Constants::DEFAULT_LINK_CODE, $store_id, $asins ) {
|
47 |
if ( empty( $store_id ) ) {
|
48 |
+
throw new \InvalidArgumentException( "Empty Store Id passed" );
|
49 |
}
|
50 |
+
$impression_recorder_service_config = $this->configuration_helper->get( $marketplace_abbreviation, Plugin_Constants::IMPRESSION_RECORDER_SERVICE_KEY );
|
51 |
+
$impression_recorder_service_endpoint = $impression_recorder_service_config[Plugin_Constants::ENDPOINT_KEY];
|
52 |
+
$org_unit_id = $impression_recorder_service_config[Plugin_Constants::ORG_UNIT_ID_KEY];
|
53 |
|
54 |
return $this->get_html_for_pixel_image_of_all_asins( $impression_recorder_service_endpoint, $store_id, $link_code, $org_unit_id, $asins );
|
55 |
}
|
65 |
*
|
66 |
* @return String HTML for the pixel image of all asins in $asin_group
|
67 |
*
|
68 |
+
* @throws \InvalidArgumentException
|
69 |
*
|
70 |
*/
|
71 |
private function get_html_for_pixel_image_of_all_asins( $impression_recorder_service_endpoint, $store_id, $link_code, $org_unit_id, $asin_group ) {
|
79 |
return $pixel_image_for_all_asins;
|
80 |
}
|
81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
/*
|
83 |
* @since 1.6.0
|
84 |
*
|
includes/aalb_template_engine.php → rendering/template_engine.php
RENAMED
@@ -11,32 +11,45 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* Template engine to render the product in the particular display unit.
|
17 |
*
|
18 |
* @since 1.0.0
|
19 |
* @package AmazonAssociatesLinkBuilder
|
20 |
-
* @subpackage AmazonAssociatesLinkBuilder/
|
21 |
*/
|
22 |
-
class
|
23 |
-
|
24 |
protected $xml_loader;
|
25 |
protected $cache_template_loader;
|
26 |
protected $mustache;
|
27 |
protected $xml_helper;
|
28 |
protected $helper;
|
29 |
protected $impression_generator;
|
|
|
30 |
|
31 |
public function __construct() {
|
32 |
-
$this->xml_loader = new
|
33 |
-
$this->helper = new
|
34 |
-
$this->cache_template_loader = new
|
35 |
-
$this->mustache = new Mustache_Engine( array( 'loader' => new Mustache_Loader_FilesystemLoader( AALB_TEMPLATE_DIR ) ) );
|
36 |
-
$this->mustache_custom = new Mustache_Engine( array( 'loader' => new Mustache_Loader_FilesystemLoader( $this->helper->get_template_upload_directory() ) ) );
|
37 |
-
$this->
|
38 |
-
$this->
|
39 |
-
|
40 |
}
|
41 |
|
42 |
/**
|
@@ -61,12 +74,8 @@ class Aalb_Template_Engine {
|
|
61 |
if ( false === ( $display_unit = $this->cache_template_loader->get_display_unit( $display_key ) ) ) {
|
62 |
$products = $this->get_products( $products_key, $url, $link_code );
|
63 |
$products = $this->unescape_numeric_character_references( $products );
|
64 |
-
$xml = $this->parse( $products );
|
65 |
-
$items = $this->get_items( $xml );
|
66 |
-
|
67 |
-
//Add custom nodes to the XML
|
68 |
-
$custom_items = $this->xml_helper->add_custom_nodes( $items, $marketplace );
|
69 |
|
|
|
70 |
$display_unit = $this->render_xml( $custom_items, $template );
|
71 |
$display_unit = $this->add_html_for_impression_tracking( $display_unit, $marketplace, $link_code, $store_id, $asin_group );
|
72 |
|
@@ -113,9 +122,11 @@ class Aalb_Template_Engine {
|
|
113 |
try {
|
114 |
$impression = $this->impression_generator->get_impression( $marketplace, $link_code, $store_id, $asin_group );
|
115 |
$display_unit = $impression . $display_unit;
|
116 |
-
} catch (
|
|
|
|
|
117 |
error_log( "Aalb_Template_Engine::add_html_for_impression_tracking " . $e->getMessage() );
|
118 |
-
} catch ( Exception $e ) {
|
119 |
error_log( "Aalb_Template_Engine::add_html_for_impression_tracking " . $e->getMessage() );
|
120 |
}
|
121 |
|
@@ -137,57 +148,6 @@ class Aalb_Template_Engine {
|
|
137 |
return $this->xml_loader->load( $key, $url, $link_code );
|
138 |
}
|
139 |
|
140 |
-
/**
|
141 |
-
* Convert the well-formed xml string into a SimpleXMLElement object.
|
142 |
-
*
|
143 |
-
* @since 1.0.0
|
144 |
-
*
|
145 |
-
* @param string $xml_string Well-formed XML string
|
146 |
-
*
|
147 |
-
* @return SimpleXMLElement Php xml object.
|
148 |
-
*/
|
149 |
-
private function parse( $xml_string ) {
|
150 |
-
libxml_use_internal_errors( true );
|
151 |
-
$xml = simplexml_load_string( $xml_string );
|
152 |
-
|
153 |
-
if ( $xml === false ) {
|
154 |
-
//Don't translate as this is also dumped in error logs and will facilitate AALB team to debug
|
155 |
-
throw new Exception( 'Failed Loading XML' );
|
156 |
-
}
|
157 |
-
|
158 |
-
if ( $this->should_not_render_xml( $xml ) ) {
|
159 |
-
throw new Exception( $xml->Items->Request->Errors->Error->Code );
|
160 |
-
}
|
161 |
-
|
162 |
-
return $xml;
|
163 |
-
}
|
164 |
-
|
165 |
-
/**
|
166 |
-
* Whether to allow xml to be rendered
|
167 |
-
*
|
168 |
-
* @since 1.4.7
|
169 |
-
*
|
170 |
-
* @param SimpleXMLElement $xml Well-formed XML string
|
171 |
-
*
|
172 |
-
* @return boolean
|
173 |
-
*/
|
174 |
-
private function should_not_render_xml( $xml ) {
|
175 |
-
return isset( $xml->Items->Request->Errors->Error ) && ! ( $xml->Items->Request->Errors->Error->Code == PAAPI_INVALID_PARAMETER_VALUE_ERROR && isset( $xml->Items->Item ) );
|
176 |
-
}
|
177 |
-
|
178 |
-
/**
|
179 |
-
* Return the Item attribute contained in the xml.
|
180 |
-
*
|
181 |
-
* @since 1.0.0
|
182 |
-
*
|
183 |
-
* @param SimpleXMLElement $xml Well-formed XML string
|
184 |
-
*
|
185 |
-
* @return SimpleXMLElement Php xml object of the Items attribute.
|
186 |
-
*/
|
187 |
-
private function get_items( $xml ) {
|
188 |
-
return $xml->Items;
|
189 |
-
}
|
190 |
-
|
191 |
/**
|
192 |
* Render the xml with a specific template.
|
193 |
*
|
@@ -199,18 +159,18 @@ class Aalb_Template_Engine {
|
|
199 |
* @return string HTML of the display unit.
|
200 |
*/
|
201 |
private function render_xml( $items, $template ) {
|
202 |
-
$aalb_default_templates = explode( ",",
|
203 |
try {
|
204 |
if ( in_array( $template, $aalb_default_templates ) ) {
|
205 |
$template = $this->mustache->loadTemplate( $template );
|
206 |
} else {
|
207 |
$template = $this->mustache_custom->loadTemplate( $template );
|
208 |
}
|
209 |
-
} catch ( Mustache_Exception_UnknownTemplateException $e ) {
|
210 |
-
$template = $this->mustache->loadTemplate( get_option(
|
211 |
}
|
212 |
|
213 |
-
return $template->render( array( 'StoreId' => get_option(
|
214 |
}
|
215 |
}
|
216 |
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\rendering;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\configuration\Config_Helper;
|
17 |
+
use AmazonAssociatesLinkBuilder\helper\Xml_Helper;
|
18 |
+
use AmazonAssociatesLinkBuilder\cache\Cache_Loader;
|
19 |
+
use AmazonAssociatesLinkBuilder\cache\Cache_Template_Loader;
|
20 |
+
use AmazonAssociatesLinkBuilder\includes\Remote_Loader;
|
21 |
+
use AmazonAssociatesLinkBuilder\rendering\Xml_Manipulator;
|
22 |
+
use AmazonAssociatesLinkBuilder\rendering\Impression_Generator;
|
23 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
24 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
25 |
+
use AmazonAssociatesLinkBuilder\exceptions\Invalid_Marketplace_Exception;
|
26 |
+
use AmazonAssociatesLinkBuilder\helper\Plugin_Helper;
|
27 |
|
28 |
/**
|
29 |
* Template engine to render the product in the particular display unit.
|
30 |
*
|
31 |
* @since 1.0.0
|
32 |
* @package AmazonAssociatesLinkBuilder
|
33 |
+
* @subpackage AmazonAssociatesLinkBuilder/rendering
|
34 |
*/
|
35 |
+
class Template_Engine {
|
|
|
36 |
protected $xml_loader;
|
37 |
protected $cache_template_loader;
|
38 |
protected $mustache;
|
39 |
protected $xml_helper;
|
40 |
protected $helper;
|
41 |
protected $impression_generator;
|
42 |
+
private $config_helper;
|
43 |
|
44 |
public function __construct() {
|
45 |
+
$this->xml_loader = new Cache_Loader( new Remote_Loader() );
|
46 |
+
$this->helper = new Plugin_Helper();
|
47 |
+
$this->cache_template_loader = new Cache_Template_Loader();
|
48 |
+
$this->mustache = new \Mustache_Engine( array( 'loader' => new \Mustache_Loader_FilesystemLoader( AALB_TEMPLATE_DIR ) ) );
|
49 |
+
$this->mustache_custom = new \Mustache_Engine( array( 'loader' => new \Mustache_Loader_FilesystemLoader( $this->helper->get_template_upload_directory() ) ) );
|
50 |
+
$this->config_helper = new Config_Helper();
|
51 |
+
$this->xml_manipulator = new Xml_Manipulator( new Xml_Helper( $this->config_helper ) );
|
52 |
+
$this->impression_generator = new Impression_Generator( $this->config_helper );
|
53 |
}
|
54 |
|
55 |
/**
|
74 |
if ( false === ( $display_unit = $this->cache_template_loader->get_display_unit( $display_key ) ) ) {
|
75 |
$products = $this->get_products( $products_key, $url, $link_code );
|
76 |
$products = $this->unescape_numeric_character_references( $products );
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
+
$custom_items = $this->xml_manipulator->get_customized_items_object( $products, $marketplace );
|
79 |
$display_unit = $this->render_xml( $custom_items, $template );
|
80 |
$display_unit = $this->add_html_for_impression_tracking( $display_unit, $marketplace, $link_code, $store_id, $asin_group );
|
81 |
|
122 |
try {
|
123 |
$impression = $this->impression_generator->get_impression( $marketplace, $link_code, $store_id, $asin_group );
|
124 |
$display_unit = $impression . $display_unit;
|
125 |
+
} catch ( Invalid_Marketplace_Exception $e ) {
|
126 |
+
//Do Nothing as it is because of a new marketplace added and we are currently not racling impression for this new marketplace.
|
127 |
+
} catch ( \InvalidArgumentException $e ) {
|
128 |
error_log( "Aalb_Template_Engine::add_html_for_impression_tracking " . $e->getMessage() );
|
129 |
+
} catch ( \Exception $e ) {
|
130 |
error_log( "Aalb_Template_Engine::add_html_for_impression_tracking " . $e->getMessage() );
|
131 |
}
|
132 |
|
148 |
return $this->xml_loader->load( $key, $url, $link_code );
|
149 |
}
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
/**
|
152 |
* Render the xml with a specific template.
|
153 |
*
|
159 |
* @return string HTML of the display unit.
|
160 |
*/
|
161 |
private function render_xml( $items, $template ) {
|
162 |
+
$aalb_default_templates = explode( ",", Plugin_Constants::AMAZON_TEMPLATE_NAMES );
|
163 |
try {
|
164 |
if ( in_array( $template, $aalb_default_templates ) ) {
|
165 |
$template = $this->mustache->loadTemplate( $template );
|
166 |
} else {
|
167 |
$template = $this->mustache_custom->loadTemplate( $template );
|
168 |
}
|
169 |
+
} catch ( \Mustache_Exception_UnknownTemplateException $e ) {
|
170 |
+
$template = $this->mustache->loadTemplate( get_option( Db_Constants::DEFAULT_TEMPLATE, Db_Constants::DEFAULT_TEMPLATE_NAME ) );
|
171 |
}
|
172 |
|
173 |
+
return $template->render( array( 'StoreId' => get_option( Db_Constants::DEFAULT_STORE_ID ), 'Items' => $items ) );
|
174 |
}
|
175 |
}
|
176 |
|
rendering/xml_manipulator.php
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
+
|
6 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
8 |
+
A copy of the License is located in the "license" file accompanying this file.
|
9 |
+
|
10 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
11 |
+
either express or implied. See the License for the specific language governing permissions
|
12 |
+
and limitations under the License.
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace AmazonAssociatesLinkBuilder\rendering;
|
16 |
+
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Paapi_Constants;
|
18 |
+
use AmazonAssociatesLinkBuilder\helper\Xml_Helper;
|
19 |
+
use AmazonAssociatesLinkBuilder\constants\XML_Constants;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Helper class for customizations to the xml response
|
23 |
+
*
|
24 |
+
* @since 1.8.0
|
25 |
+
* @package AmazonAssociatesLinkBuilder
|
26 |
+
* @subpackage AmazonAssociatesLinkBuilder/lib/php
|
27 |
+
*/
|
28 |
+
class Xml_Manipulator {
|
29 |
+
private $xml_helper;
|
30 |
+
|
31 |
+
public function __construct( Xml_Helper $xml_helper ) {
|
32 |
+
$this->xml_helper = $xml_helper;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Returns the Customized Items SimpleXML Object which contains Aalb Node and
|
37 |
+
* some other customized values as per business logic.
|
38 |
+
*
|
39 |
+
* @since 1.8.0
|
40 |
+
*
|
41 |
+
* @param string $products_xml Well-formed XML string of Products
|
42 |
+
* @param string $marketplace
|
43 |
+
*
|
44 |
+
* @return \SimpleXMLElement Php xml object.
|
45 |
+
*/
|
46 |
+
public function get_customized_items_object( $products_xml, $marketplace ) {
|
47 |
+
$simple_xml_object = $this->parse( $products_xml );
|
48 |
+
$this->validate( $simple_xml_object );
|
49 |
+
$custom_items = $this->add_custom_nodes( $simple_xml_object->Items, $marketplace );
|
50 |
+
|
51 |
+
return $custom_items;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Convert the well-formed xml string into a\SimpleXMLElement object.
|
56 |
+
*
|
57 |
+
* @since 1.0.0
|
58 |
+
*
|
59 |
+
* @param string $xml_string Well-formed XML string
|
60 |
+
*
|
61 |
+
* @return \SimpleXMLElement Php xml object.
|
62 |
+
*/
|
63 |
+
private function parse( $xml_string ) {
|
64 |
+
libxml_use_internal_errors( true );
|
65 |
+
|
66 |
+
return simplexml_load_string( $xml_string );
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Checks if SIMPLE XML element object is generated successfully and has no error code from PA-API
|
71 |
+
*
|
72 |
+
* @since 1.8.0
|
73 |
+
*
|
74 |
+
* @param \SimpleXMLElement $xml Well-formed XML string
|
75 |
+
*
|
76 |
+
* @throws \Exception if object is not generated successfully or has an error code from PA-API
|
77 |
+
*/
|
78 |
+
private function validate( $xml ) {
|
79 |
+
if ( $xml === false ) {
|
80 |
+
//Don't translate as this is also dumped in error logs and will facilitate AALB team to debug
|
81 |
+
throw new \Exception( 'Xml_Manipulator::validate::Failed Loading XML' );
|
82 |
+
} else if ( ! $this->should_render_xml( $xml ) ) {
|
83 |
+
throw new \Exception( 'Xml_Manipulator::validate::' . $xml->Items->Request->Errors->Error->Code );
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Whether to allow xml to be rendered
|
89 |
+
*
|
90 |
+
* @since 1.4.7
|
91 |
+
*
|
92 |
+
* @param \SimpleXMLElement $xml Well-formed XML string
|
93 |
+
*
|
94 |
+
* @return boolean should_render_xml
|
95 |
+
*/
|
96 |
+
private function should_render_xml( $xml ) {
|
97 |
+
return ! isset( $xml->Items->Request->Errors->Error ) || $this->is_error_acceptable( $xml );
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Whether the error is acceptable. For now, It is acceptable for Invalid Parameter value with at least one item set.
|
102 |
+
* This handles the case when an expired ASIN is present in a list of products and thus unblocks the ad rendering.
|
103 |
+
*
|
104 |
+
* @since 1.8.0
|
105 |
+
*
|
106 |
+
* @param \SimpleXMLElement $xml Well-formed XML string
|
107 |
+
*
|
108 |
+
* @return boolean is_error_acceptable
|
109 |
+
*/
|
110 |
+
private function is_error_acceptable( $xml ) {
|
111 |
+
return $xml->Items->Request->Errors->Error->Code == Paapi_Constants::INVALID_PARAMETER_VALUE_ERROR && isset( $xml->Items->Item );
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Add custom nodes to xml response
|
116 |
+
*
|
117 |
+
* @since 1.0.0
|
118 |
+
*
|
119 |
+
* @param \SimpleXMLElement $items Well-formed XML string
|
120 |
+
*
|
121 |
+
* @return \SimpleXMLElement $items XML String with custom nodes added
|
122 |
+
*/
|
123 |
+
private function add_custom_nodes( $items, $marketplace ) {
|
124 |
+
$common_marketplace_node_name = 'Marketplace' . $marketplace;
|
125 |
+
$items->ID = "[[UNIQUE_ID]]";
|
126 |
+
$basic_labels = $this->xml_helper->get_basic_labels( $marketplace );
|
127 |
+
$items->PriceLabel = $basic_labels[XML_Constants::PRICE_LABEL];
|
128 |
+
$items->StrikePriceLabel = $basic_labels[XML_Constants::STRIKE_PRICE_LABEL];
|
129 |
+
$items->ProductsFromAmazonLabel = $basic_labels[XML_Constants::PRODUCTS_FROM_AMAZON_LABEL];
|
130 |
+
$aalb_header_node = $items->addChild( 'AalbHeader' );
|
131 |
+
$aalb_header_node->$common_marketplace_node_name = 'true';
|
132 |
+
|
133 |
+
foreach ( $items->Item as $item ) {
|
134 |
+
$this->decorate_item( $item, $marketplace, $common_marketplace_node_name );
|
135 |
+
}
|
136 |
+
|
137 |
+
return $items;
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Add the Information for the Item(which is calculated based on business logic) to the Aalb node.
|
142 |
+
*
|
143 |
+
* @since 1.8.0
|
144 |
+
*
|
145 |
+
* @param \SimpleXMLElement $item
|
146 |
+
* @param String $marketplace
|
147 |
+
*
|
148 |
+
*/
|
149 |
+
private function decorate_item( $item, $marketplace, $common_marketplace_node_name ) {
|
150 |
+
$basic_info = $this->xml_helper->get_basic_info( $item );
|
151 |
+
$image_urls = $this->xml_helper->get_image_urls( $item );
|
152 |
+
$price_related_info = $this->xml_helper->get_price_related_information( $item, $marketplace );
|
153 |
+
$savings_info = $price_related_info[XML_Constants::SAVINGS_INFO];
|
154 |
+
$min_price_info = $price_related_info[XML_Constants::MIN_PRICE_INFO];
|
155 |
+
|
156 |
+
$nodes = array(
|
157 |
+
XML_Constants::ASIN => $basic_info[XML_Constants::ASIN],
|
158 |
+
XML_Constants::TITLE => $basic_info[XML_Constants::TITLE],
|
159 |
+
XML_Constants::DETAIL_PAGE_URL => $basic_info[XML_Constants::DETAIL_PAGE_URL],
|
160 |
+
XML_Constants::LARGE_IMAGE_URL => $image_urls[XML_Constants::LARGE_IMAGE_URL],
|
161 |
+
XML_Constants::MEDIUM_IMAGE_URL => $image_urls[XML_Constants::MEDIUM_IMAGE_URL],
|
162 |
+
XML_Constants::SMALL_IMAGE_URL => $image_urls[XML_Constants::SMALL_IMAGE_URL],
|
163 |
+
XML_Constants::BY => $this->xml_helper->get_by_information( $item ),
|
164 |
+
XML_Constants::PRIME => $this->xml_helper->get_prime_eligibility( $item ),
|
165 |
+
XML_Constants::MERCHANT => $this->xml_helper->get_merchant_name( $item ),
|
166 |
+
XML_Constants::SAVING => $savings_info[XML_Constants::SAVING],
|
167 |
+
XML_Constants::SAVING_VALUE => $savings_info[XML_Constants::SAVING_VALUE],
|
168 |
+
XML_Constants::SAVING_PERCENT => $savings_info[XML_Constants::SAVING_PERCENT],
|
169 |
+
XML_Constants::MINIMUM_PRICE => $min_price_info[XML_Constants::MINIMUM_PRICE],
|
170 |
+
XML_Constants::MINIMUM_PRICE_VALUE => $min_price_info[XML_Constants::MINIMUM_PRICE_VALUE],
|
171 |
+
XML_Constants::CURRENT_PRICE => $price_related_info[XML_Constants::CURRENT_PRICE],
|
172 |
+
XML_Constants::CURRENT_PRICE_VALUE => $price_related_info[XML_Constants::CURRENT_PRICE_VALUE],
|
173 |
+
XML_Constants::STRIKE_PRICE => $price_related_info[XML_Constants::STRIKE_PRICE],
|
174 |
+
XML_Constants::STRIKE_PRICE_VALUE => $price_related_info[XML_Constants::STRIKE_PRICE_VALUE],
|
175 |
+
XML_Constants::IN_STOCK => $price_related_info[XML_Constants::IN_STOCK],
|
176 |
+
$common_marketplace_node_name => 'true'
|
177 |
+
);
|
178 |
+
|
179 |
+
$aalb_node = $item->addChild( 'aalb' );
|
180 |
+
foreach ( $nodes as $key => $value ) {
|
181 |
+
if ( ! empty( $value ) ) {
|
182 |
+
$aalb_node->$key = $value;
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
//Below is done as earlier we were maintaining current price value node even if value is null
|
187 |
+
$aalb_node->CurrentPriceValue = $price_related_info[XML_Constants::CURRENT_PRICE_VALUE];
|
188 |
+
}
|
189 |
+
}
|
shortcode/{aalb_shortcode_helper.php → shortcode_helper.php}
RENAMED
@@ -11,6 +11,13 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
* Helper class for AALB shortcodes.
|
@@ -21,16 +28,16 @@ and limitations under the License.
|
|
21 |
* @package AmazonAssociatesLinkBuilder
|
22 |
* @subpackage AmazonAssociatesLinkBuilder/shortcode
|
23 |
*/
|
24 |
-
class
|
25 |
|
26 |
protected $helper;
|
27 |
protected $config_loader;
|
28 |
protected $validation_helper;
|
29 |
|
30 |
public function __construct() {
|
31 |
-
$this->helper = new
|
32 |
-
$this->config_loader = new
|
33 |
-
$this->validation_helper = new
|
34 |
}
|
35 |
|
36 |
/**
|
@@ -39,12 +46,12 @@ class Aalb_Shortcode_Helper {
|
|
39 |
* @since 1.0.0
|
40 |
*/
|
41 |
public function enqueue_template_styles( $template_name ) {
|
42 |
-
$aalb_default_templates = explode( ",",
|
43 |
if ( in_array( $template_name, $aalb_default_templates ) ) {
|
44 |
-
wp_enqueue_style( 'aalb_template' . $template_name . '_css', AALB_TEMPLATE_URL . $template_name . '.css', array(),
|
45 |
} else {
|
46 |
$aalb_template_upload_url = $this->helper->get_template_upload_directory_url();
|
47 |
-
wp_enqueue_style( 'aalb_template' . $template_name . '_css', $aalb_template_upload_url . $template_name . '.css', array(),
|
48 |
}
|
49 |
}
|
50 |
|
@@ -116,7 +123,7 @@ class Aalb_Shortcode_Helper {
|
|
116 |
$validated_marketplace = strtoupper( $marketplace );
|
117 |
if ( ! $this->validation_helper->validate_marketplace( $marketplace ) ) {
|
118 |
//If the marketplace is not valid, return default marketplace
|
119 |
-
$validated_marketplace = get_option(
|
120 |
}
|
121 |
|
122 |
return $validated_marketplace;
|
@@ -162,7 +169,7 @@ class Aalb_Shortcode_Helper {
|
|
162 |
$validated_template = $template;
|
163 |
if ( ! $this->validation_helper->validate_template_name( $template ) ) {
|
164 |
//Return Default template in case of invalid template name
|
165 |
-
$validated_template = get_option(
|
166 |
//Show error message regarding incorrect asin in preview mode only
|
167 |
/* translators: 1: Invalid template name 2: Valid template name */
|
168 |
$this->helper->show_error_in_preview( sprintf( esc_html__( "The template: %1s is invalid. Using default template %2s.", 'amazon-associates-link-builder' ), $template, $validated_template ) );
|
@@ -185,7 +192,7 @@ class Aalb_Shortcode_Helper {
|
|
185 |
$validated_store_id = $store_id;
|
186 |
if ( ! $this->validation_helper->validate_store_id( $store_id ) ) {
|
187 |
//Return Default store id in case of invalid store id
|
188 |
-
$validated_store_id = get_option(
|
189 |
//Show error message regarding incorrect asin in preview mode only
|
190 |
/* translators: 1: Invalid associate id 2: Valid associate id */
|
191 |
$this->helper->show_error_in_preview( sprintf( esc_html__( "The Associate tag %1s is not present in the list of valid tags. Associate tag has been updated to %2s. Please check your Associate tag selection or contact the administrator to add a new tag.", 'amazon-associates-link-builder' ), $store_id, $validated_store_id ) );
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\shortcode;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\configuration\Config_Loader;
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
18 |
+
use AmazonAssociatesLinkBuilder\helper\Validation_Helper;
|
19 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
20 |
+
use AmazonAssociatesLinkBuilder\helper\Plugin_Helper;
|
21 |
|
22 |
/**
|
23 |
* Helper class for AALB shortcodes.
|
28 |
* @package AmazonAssociatesLinkBuilder
|
29 |
* @subpackage AmazonAssociatesLinkBuilder/shortcode
|
30 |
*/
|
31 |
+
class Shortcode_Helper {
|
32 |
|
33 |
protected $helper;
|
34 |
protected $config_loader;
|
35 |
protected $validation_helper;
|
36 |
|
37 |
public function __construct() {
|
38 |
+
$this->helper = new Plugin_Helper();
|
39 |
+
$this->config_loader = new Config_Loader();
|
40 |
+
$this->validation_helper = new Validation_Helper();
|
41 |
}
|
42 |
|
43 |
/**
|
46 |
* @since 1.0.0
|
47 |
*/
|
48 |
public function enqueue_template_styles( $template_name ) {
|
49 |
+
$aalb_default_templates = explode( ",", Plugin_Constants::AMAZON_TEMPLATE_NAMES );
|
50 |
if ( in_array( $template_name, $aalb_default_templates ) ) {
|
51 |
+
wp_enqueue_style( 'aalb_template' . $template_name . '_css', AALB_TEMPLATE_URL . $template_name . '.css', array(), Plugin_Constants::PLUGIN_CURRENT_VERSION );
|
52 |
} else {
|
53 |
$aalb_template_upload_url = $this->helper->get_template_upload_directory_url();
|
54 |
+
wp_enqueue_style( 'aalb_template' . $template_name . '_css', $aalb_template_upload_url . $template_name . '.css', array(), Plugin_Constants::PLUGIN_CURRENT_VERSION );
|
55 |
}
|
56 |
}
|
57 |
|
123 |
$validated_marketplace = strtoupper( $marketplace );
|
124 |
if ( ! $this->validation_helper->validate_marketplace( $marketplace ) ) {
|
125 |
//If the marketplace is not valid, return default marketplace
|
126 |
+
$validated_marketplace = get_option( Db_Constants::DEFAULT_MARKETPLACE );
|
127 |
}
|
128 |
|
129 |
return $validated_marketplace;
|
169 |
$validated_template = $template;
|
170 |
if ( ! $this->validation_helper->validate_template_name( $template ) ) {
|
171 |
//Return Default template in case of invalid template name
|
172 |
+
$validated_template = get_option( Db_Constants::DEFAULT_TEMPLATE );
|
173 |
//Show error message regarding incorrect asin in preview mode only
|
174 |
/* translators: 1: Invalid template name 2: Valid template name */
|
175 |
$this->helper->show_error_in_preview( sprintf( esc_html__( "The template: %1s is invalid. Using default template %2s.", 'amazon-associates-link-builder' ), $template, $validated_template ) );
|
192 |
$validated_store_id = $store_id;
|
193 |
if ( ! $this->validation_helper->validate_store_id( $store_id ) ) {
|
194 |
//Return Default store id in case of invalid store id
|
195 |
+
$validated_store_id = get_option( Db_Constants::DEFAULT_STORE_ID, Db_Constants::DEFAULT_STORE_ID_NAME );
|
196 |
//Show error message regarding incorrect asin in preview mode only
|
197 |
/* translators: 1: Invalid associate id 2: Valid associate id */
|
198 |
$this->helper->show_error_in_preview( sprintf( esc_html__( "The Associate tag %1s is not present in the list of valid tags. Associate tag has been updated to %2s. Please check your Associate tag selection or contact the administrator to add a new tag.", 'amazon-associates-link-builder' ), $store_id, $validated_store_id ) );
|
shortcode/{aalb_shortcode_loader.php → shortcode_loader.php}
RENAMED
@@ -11,6 +11,10 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
|
|
|
|
|
|
14 |
|
15 |
/**
|
16 |
*
|
@@ -21,7 +25,7 @@ and limitations under the License.
|
|
21 |
* @package AmazonAssociatesLinkBuilder
|
22 |
* @subpackage AmazonAssociatesLinkBuilder/shortcode
|
23 |
*/
|
24 |
-
class
|
25 |
public $shortcode_manager = null;
|
26 |
|
27 |
/**
|
@@ -30,8 +34,8 @@ class Aalb_Shortcode_Loader {
|
|
30 |
* @since 1.0.0
|
31 |
*/
|
32 |
public function add_shortcode() {
|
33 |
-
add_shortcode(
|
34 |
-
add_shortcode(
|
35 |
}
|
36 |
|
37 |
/**
|
@@ -67,11 +71,11 @@ class Aalb_Shortcode_Loader {
|
|
67 |
* No need to create an instance for rendering each shortcode.
|
68 |
*
|
69 |
* @since 1.5.0
|
70 |
-
* @return
|
71 |
*/
|
72 |
public function get_shortcode_manager_instance() {
|
73 |
if ( is_null( $this->shortcode_manager ) ) {
|
74 |
-
$this->shortcode_manager = new
|
75 |
}
|
76 |
|
77 |
return $this->shortcode_manager;
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\shortcode;
|
15 |
+
|
16 |
+
use AmazonAssociatesLinkBuilder\shortcode\Shortcode_Manager;
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
18 |
|
19 |
/**
|
20 |
*
|
25 |
* @package AmazonAssociatesLinkBuilder
|
26 |
* @subpackage AmazonAssociatesLinkBuilder/shortcode
|
27 |
*/
|
28 |
+
class Shortcode_Loader {
|
29 |
public $shortcode_manager = null;
|
30 |
|
31 |
/**
|
34 |
* @since 1.0.0
|
35 |
*/
|
36 |
public function add_shortcode() {
|
37 |
+
add_shortcode( Plugin_Constants::SHORTCODE_AMAZON_LINK, array( $this, 'amazon_link_shortcode_callback' ) );
|
38 |
+
add_shortcode( Plugin_Constants::SHORTCODE_AMAZON_TEXT, array( $this, 'amazon_textlink_shortcode_callback' ) );
|
39 |
}
|
40 |
|
41 |
/**
|
71 |
* No need to create an instance for rendering each shortcode.
|
72 |
*
|
73 |
* @since 1.5.0
|
74 |
+
* @return Shortcode_Manager The instance of Aalb_Shortcode.
|
75 |
*/
|
76 |
public function get_shortcode_manager_instance() {
|
77 |
if ( is_null( $this->shortcode_manager ) ) {
|
78 |
+
$this->shortcode_manager = new Shortcode_Manager();
|
79 |
}
|
80 |
|
81 |
return $this->shortcode_manager;
|
shortcode/{aalb_shortcode_manager.php → shortcode_manager.php}
RENAMED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/*
|
3 |
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
|
@@ -11,6 +12,19 @@ either express or implied. See the License for the specific language governing p
|
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
/**
|
15 |
*
|
16 |
* Gets the product information by making a Paapi request and renders the HTML
|
@@ -19,22 +33,19 @@ and limitations under the License.
|
|
19 |
* @package AmazonAssociatesLinkBuilder
|
20 |
* @subpackage AmazonAssociatesLinkBuilder/shortcode
|
21 |
*/
|
22 |
-
class
|
23 |
protected $paapi_helper;
|
24 |
protected $template_engine;
|
25 |
protected $helper;
|
26 |
-
//Below is commented out as it was being used in impression tracking
|
27 |
-
//protected $tracking_api_helper;
|
28 |
protected $shortcode_helper;
|
29 |
protected $customer_country;
|
30 |
|
31 |
public function __construct() {
|
32 |
-
$this->template_engine = new
|
33 |
-
$this->paapi_helper = new
|
34 |
-
$this->helper = new
|
35 |
-
|
36 |
-
$this->
|
37 |
-
$this->customer_country = new Aalb_Customer_Country();
|
38 |
}
|
39 |
|
40 |
/**
|
@@ -43,7 +54,7 @@ class Aalb_Shortcode_Manager {
|
|
43 |
* @since 1.5.0
|
44 |
*/
|
45 |
public function enqueue_styles() {
|
46 |
-
wp_enqueue_style( 'aalb_basics_css', AALB_BASICS_CSS, array(),
|
47 |
}
|
48 |
|
49 |
/**
|
@@ -59,20 +70,20 @@ class Aalb_Shortcode_Manager {
|
|
59 |
public function render( $atts ) {
|
60 |
try {
|
61 |
$shortcode_attributes = $this->get_shortcode_attributes( $atts );
|
62 |
-
$marketplace_list = explode( GEO_TARGETED_LINKS_DELIMITER, $shortcode_attributes['marketplace'] );
|
63 |
//Below contains both asin & asins to support both amazon_text_link & amazon_link
|
64 |
-
$asins_list = explode( GEO_TARGETED_LINKS_DELIMITER, $shortcode_attributes['asins'] ? $shortcode_attributes['asins'] : $shortcode_attributes['asin'] );
|
65 |
-
$store_id_list = explode( GEO_TARGETED_LINKS_DELIMITER, $shortcode_attributes['store'] );
|
66 |
if ( ( count( $marketplace_list ) === count( $asins_list ) ) && ( count( $asins_list ) === count( $store_id_list ) ) ) {
|
67 |
if ( $this->is_shortcode_geo_targeted_links_supported( $marketplace_list ) ) {
|
68 |
$marketplace = $this->find_marketplace_of_customer( $marketplace_list );
|
69 |
$index_to_render = array_search( $marketplace, $marketplace_list );
|
70 |
$index_to_render = $index_to_render === false ? 0 : $index_to_render;
|
71 |
-
$link_code = $index_to_render === 0 ?
|
72 |
$this->show_error_message_for_maxmind_file();
|
73 |
} else {
|
74 |
$index_to_render = 0;
|
75 |
-
$link_code =
|
76 |
}
|
77 |
|
78 |
} else {
|
@@ -81,12 +92,12 @@ class Aalb_Shortcode_Manager {
|
|
81 |
$asins_list = array( null );
|
82 |
}
|
83 |
$index_to_render = 0;
|
84 |
-
$link_code =
|
85 |
$this->helper->show_error_in_preview( esc_html__( "There is an error in the count of configured marketplaces, asins and stores in this shortcode. Please fix the parameters for marketplace, asin and store-id.", 'amazon-associates-link-builder' ) );
|
86 |
}
|
87 |
|
88 |
return $this->render_shortcode( $shortcode_attributes, $marketplace_list[$index_to_render], $asins_list[$index_to_render], $store_id_list[$index_to_render], $link_code );
|
89 |
-
} catch ( Exception $e ) {
|
90 |
error_log( "Aalb_Shortcode_Manager::render::Unknown error:" . $e->getMessage() );
|
91 |
$this->helper->show_error_in_preview( "Aalb_Shortcode_Manager::render::Unknown error:" . $e->getMessage() );
|
92 |
}
|
@@ -137,7 +148,7 @@ class Aalb_Shortcode_Manager {
|
|
137 |
$products_template_key = $this->helper->build_template_cache_key( $formatted_asins, $validated_marketplace, $validated_store_id, $validated_template );
|
138 |
try {
|
139 |
return str_replace( array( '[[UNIQUE_ID]]', '[[Amazon_Link_Text]]' ), array( str_replace( '.', '-', $products_template_key ), $link_text ), $this->template_engine->render( $products_template_key, $products_key, $validated_template, $url, $validated_marketplace, $link_code, $validated_store_id, $validated_asins ) );
|
140 |
-
} catch ( Exception $e ) {
|
141 |
error_log( $this->paapi_helper->get_error_message( $e->getMessage() ) );
|
142 |
}
|
143 |
}
|
@@ -156,9 +167,9 @@ class Aalb_Shortcode_Manager {
|
|
156 |
$shortcode_attributes = shortcode_atts( array(
|
157 |
'asin' => null,
|
158 |
'asins' => null,
|
159 |
-
'marketplace' => get_option(
|
160 |
-
'store' => get_option(
|
161 |
-
'template' => get_option(
|
162 |
'link_id' => null,
|
163 |
'text' => null
|
164 |
), $atts );
|
@@ -171,7 +182,7 @@ class Aalb_Shortcode_Manager {
|
|
171 |
*
|
172 |
* @since 1.5.0
|
173 |
*
|
174 |
-
* @param Array $marketplace_list Array of marketplaces present in shortcode
|
175 |
*
|
176 |
* @return String Marketplace from which customer is coming. Empty in case marketplace not added by user or no e-commerce presence
|
177 |
*/
|
@@ -188,7 +199,7 @@ class Aalb_Shortcode_Manager {
|
|
188 |
*
|
189 |
*/
|
190 |
private function show_error_message_for_maxmind_file() {
|
191 |
-
$maxmind_db_manager = new
|
192 |
$error_msg = $maxmind_db_manager->get_error_message();
|
193 |
if ( ! empty( $error_msg ) ) {
|
194 |
$this->helper->show_error_in_preview( $error_msg );
|
1 |
<?php
|
2 |
+
|
3 |
/*
|
4 |
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
15 |
+
namespace AmazonAssociatesLinkBuilder\shortcode;
|
16 |
+
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
18 |
+
use AmazonAssociatesLinkBuilder\rendering\Template_Engine;
|
19 |
+
use AmazonAssociatesLinkBuilder\ip2Country\Customer_Country;
|
20 |
+
use AmazonAssociatesLinkBuilder\shortcode\Shortcode_Helper;
|
21 |
+
use AmazonAssociatesLinkBuilder\helper\Paapi_Helper;
|
22 |
+
use AmazonAssociatesLinkBuilder\ip2Country\Maxmind_Db_Manager;
|
23 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
24 |
+
use AmazonAssociatesLinkBuilder\io\Curl_Request;
|
25 |
+
use AmazonAssociatesLinkBuilder\io\File_System_Helper;
|
26 |
+
use AmazonAssociatesLinkBuilder\helper\Plugin_Helper;
|
27 |
+
|
28 |
/**
|
29 |
*
|
30 |
* Gets the product information by making a Paapi request and renders the HTML
|
33 |
* @package AmazonAssociatesLinkBuilder
|
34 |
* @subpackage AmazonAssociatesLinkBuilder/shortcode
|
35 |
*/
|
36 |
+
class Shortcode_Manager {
|
37 |
protected $paapi_helper;
|
38 |
protected $template_engine;
|
39 |
protected $helper;
|
|
|
|
|
40 |
protected $shortcode_helper;
|
41 |
protected $customer_country;
|
42 |
|
43 |
public function __construct() {
|
44 |
+
$this->template_engine = new Template_Engine();
|
45 |
+
$this->paapi_helper = new Paapi_Helper();
|
46 |
+
$this->helper = new Plugin_Helper();
|
47 |
+
$this->shortcode_helper = new Shortcode_Helper();
|
48 |
+
$this->customer_country = new Customer_Country();
|
|
|
49 |
}
|
50 |
|
51 |
/**
|
54 |
* @since 1.5.0
|
55 |
*/
|
56 |
public function enqueue_styles() {
|
57 |
+
wp_enqueue_style( 'aalb_basics_css', AALB_BASICS_CSS, array(), Plugin_Constants::PLUGIN_CURRENT_VERSION );
|
58 |
}
|
59 |
|
60 |
/**
|
70 |
public function render( $atts ) {
|
71 |
try {
|
72 |
$shortcode_attributes = $this->get_shortcode_attributes( $atts );
|
73 |
+
$marketplace_list = explode( Plugin_Constants::GEO_TARGETED_LINKS_DELIMITER, $shortcode_attributes['marketplace'] );
|
74 |
//Below contains both asin & asins to support both amazon_text_link & amazon_link
|
75 |
+
$asins_list = explode( Plugin_Constants::GEO_TARGETED_LINKS_DELIMITER, $shortcode_attributes['asins'] ? $shortcode_attributes['asins'] : $shortcode_attributes['asin'] );
|
76 |
+
$store_id_list = explode( Plugin_Constants::GEO_TARGETED_LINKS_DELIMITER, $shortcode_attributes['store'] );
|
77 |
if ( ( count( $marketplace_list ) === count( $asins_list ) ) && ( count( $asins_list ) === count( $store_id_list ) ) ) {
|
78 |
if ( $this->is_shortcode_geo_targeted_links_supported( $marketplace_list ) ) {
|
79 |
$marketplace = $this->find_marketplace_of_customer( $marketplace_list );
|
80 |
$index_to_render = array_search( $marketplace, $marketplace_list );
|
81 |
$index_to_render = $index_to_render === false ? 0 : $index_to_render;
|
82 |
+
$link_code = $index_to_render === 0 ? Plugin_Constants::GEO_TARGETED_LINKS_DEFAULT_COUNTRY_LINK_CODE : Plugin_Constants::GEO_TARGETED_LINKS_REDIRECTED_COUNTRY_LINK_CODE;
|
83 |
$this->show_error_message_for_maxmind_file();
|
84 |
} else {
|
85 |
$index_to_render = 0;
|
86 |
+
$link_code = Plugin_Constants::DEFAULT_LINK_CODE;
|
87 |
}
|
88 |
|
89 |
} else {
|
92 |
$asins_list = array( null );
|
93 |
}
|
94 |
$index_to_render = 0;
|
95 |
+
$link_code = Plugin_Constants::GEO_TARGETED_LINKS_DEFAULT_COUNTRY_LINK_CODE;
|
96 |
$this->helper->show_error_in_preview( esc_html__( "There is an error in the count of configured marketplaces, asins and stores in this shortcode. Please fix the parameters for marketplace, asin and store-id.", 'amazon-associates-link-builder' ) );
|
97 |
}
|
98 |
|
99 |
return $this->render_shortcode( $shortcode_attributes, $marketplace_list[$index_to_render], $asins_list[$index_to_render], $store_id_list[$index_to_render], $link_code );
|
100 |
+
} catch ( \Exception $e ) {
|
101 |
error_log( "Aalb_Shortcode_Manager::render::Unknown error:" . $e->getMessage() );
|
102 |
$this->helper->show_error_in_preview( "Aalb_Shortcode_Manager::render::Unknown error:" . $e->getMessage() );
|
103 |
}
|
148 |
$products_template_key = $this->helper->build_template_cache_key( $formatted_asins, $validated_marketplace, $validated_store_id, $validated_template );
|
149 |
try {
|
150 |
return str_replace( array( '[[UNIQUE_ID]]', '[[Amazon_Link_Text]]' ), array( str_replace( '.', '-', $products_template_key ), $link_text ), $this->template_engine->render( $products_template_key, $products_key, $validated_template, $url, $validated_marketplace, $link_code, $validated_store_id, $validated_asins ) );
|
151 |
+
} catch ( \Exception $e ) {
|
152 |
error_log( $this->paapi_helper->get_error_message( $e->getMessage() ) );
|
153 |
}
|
154 |
}
|
167 |
$shortcode_attributes = shortcode_atts( array(
|
168 |
'asin' => null,
|
169 |
'asins' => null,
|
170 |
+
'marketplace' => get_option( Db_Constants::DEFAULT_MARKETPLACE ),
|
171 |
+
'store' => get_option( Db_Constants::DEFAULT_STORE_ID ),
|
172 |
+
'template' => get_option( Db_Constants::DEFAULT_TEMPLATE ),
|
173 |
'link_id' => null,
|
174 |
'text' => null
|
175 |
), $atts );
|
182 |
*
|
183 |
* @since 1.5.0
|
184 |
*
|
185 |
+
* @param \Array $marketplace_list Array of marketplaces present in shortcode
|
186 |
*
|
187 |
* @return String Marketplace from which customer is coming. Empty in case marketplace not added by user or no e-commerce presence
|
188 |
*/
|
199 |
*
|
200 |
*/
|
201 |
private function show_error_message_for_maxmind_file() {
|
202 |
+
$maxmind_db_manager = new Maxmind_Db_Manager( get_option( Db_Constants::CUSTOM_UPLOAD_PATH ), new Curl_Request(), new File_System_Helper() );
|
203 |
$error_msg = $maxmind_db_manager->get_error_message();
|
204 |
if ( ! empty( $error_msg ) ) {
|
205 |
$this->helper->show_error_in_preview( $error_msg );
|
template/ProductAd.mustache
CHANGED
@@ -24,12 +24,12 @@
|
|
24 |
</div>
|
25 |
<div class="aalb-pa-product-offer-price">
|
26 |
<!-- The section tag for different marketplaces ensures localization of static text. -->
|
27 |
-
{{
|
28 |
</div>
|
29 |
{{#StrikePrice}} <!-- The section tag ensures that strike price is displayed only if it is available -->
|
30 |
<div class="aalb-pa-product-list-price">
|
31 |
<!-- The section tag for different marketplaces ensures localization of static text. -->
|
32 |
-
{{
|
33 |
</div>
|
34 |
{{/StrikePrice}}
|
35 |
{{#Prime}} <!-- The section tag ensures that prime icon is displayed only if it is available -->
|
24 |
</div>
|
25 |
<div class="aalb-pa-product-offer-price">
|
26 |
<!-- The section tag for different marketplaces ensures localization of static text. -->
|
27 |
+
{{PriceLabel}}: <span class="aalb-pa-product-offer-price-value">{{CurrentPrice}}</span>
|
28 |
</div>
|
29 |
{{#StrikePrice}} <!-- The section tag ensures that strike price is displayed only if it is available -->
|
30 |
<div class="aalb-pa-product-list-price">
|
31 |
<!-- The section tag for different marketplaces ensures localization of static text. -->
|
32 |
+
{{StrikePriceLabel}}: <span class="aalb-pa-product-list-price-value">{{StrikePrice}}</span>
|
33 |
</div>
|
34 |
{{/StrikePrice}}
|
35 |
{{#Prime}} <!-- The section tag ensures that prime icon is displayed only if it is available -->
|
template/ProductCarousel.mustache
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<!-- Ad Template with Carousel Layout-->
|
2 |
{{#Items}} <!--Section tag for iterating through the list of items-->
|
3 |
<div class="aalb-product-carousel-unit" id="{{ID}}">
|
4 |
-
<h2 class="aalb-pc-ad-header">{{#AalbHeader}}{{
|
5 |
<div class="aalb-pc-wrapper">
|
6 |
<div class="aalb-pc-product-container">
|
7 |
<ul class="aalb-pc-product-list">
|
@@ -28,12 +28,12 @@
|
|
28 |
</div>
|
29 |
<div class="aalb-pc-product-offer-price">
|
30 |
<!-- The section tag for different marketplaces ensures localization of static text. -->
|
31 |
-
{{
|
32 |
</div>
|
33 |
{{#StrikePrice}} <!-- The section tag ensures that strike price is displayed only if it is available -->
|
34 |
<div class="aalb-pc-product-list-price">
|
35 |
<!-- The section tag for different marketplaces ensures localization of static text. -->
|
36 |
-
{{
|
37 |
</div>
|
38 |
{{/StrikePrice}}
|
39 |
{{#Prime}} <!-- The section tag ensures that prime icon is displayed only if it is available -->
|
1 |
<!-- Ad Template with Carousel Layout-->
|
2 |
{{#Items}} <!--Section tag for iterating through the list of items-->
|
3 |
<div class="aalb-product-carousel-unit" id="{{ID}}">
|
4 |
+
<h2 class="aalb-pc-ad-header">{{#AalbHeader}}{{ProductsFromAmazonLabel}}{{/AalbHeader}}</h2> <!-- Title of the ad localized according to the marketplace picked from the AalbHeader tag-->
|
5 |
<div class="aalb-pc-wrapper">
|
6 |
<div class="aalb-pc-product-container">
|
7 |
<ul class="aalb-pc-product-list">
|
28 |
</div>
|
29 |
<div class="aalb-pc-product-offer-price">
|
30 |
<!-- The section tag for different marketplaces ensures localization of static text. -->
|
31 |
+
{{PriceLabel}}: <span class="aalb-pc-product-offer-price-value">{{CurrentPrice}}</span>
|
32 |
</div>
|
33 |
{{#StrikePrice}} <!-- The section tag ensures that strike price is displayed only if it is available -->
|
34 |
<div class="aalb-pc-product-list-price">
|
35 |
<!-- The section tag for different marketplaces ensures localization of static text. -->
|
36 |
+
{{StrikePriceLabel}}: <span class="aalb-pc-product-list-price-value">{{StrikePrice}}</span>
|
37 |
</div>
|
38 |
{{/StrikePrice}}
|
39 |
{{#Prime}} <!-- The section tag ensures that prime icon is displayed only if it is available -->
|
template/ProductGrid.mustache
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<!-- A 2x5 Grid Template Layout. It can be configured by the two input fields below -->
|
2 |
{{#Items}} <!--Section tag for iterating through the list of items-->
|
3 |
<div class="aalb-pg-ad-unit" id="{{ID}}">
|
4 |
-
<h2 class="aalb-pg-ad-header">{{#AalbHeader}}{{
|
5 |
<div class="aalb-pg-wrapper">
|
6 |
<div class="aalb-pg-product-container">
|
7 |
<ul class="aalb-pg-product-list">
|
@@ -28,12 +28,12 @@
|
|
28 |
</div>
|
29 |
<div class="aalb-pg-product-offer-price">
|
30 |
<!-- The section tag for different marketplaces ensures localization of static text. -->
|
31 |
-
{{
|
32 |
</div>
|
33 |
{{#StrikePrice}} <!-- The section tag ensures that strike price is displayed only if it is available -->
|
34 |
<div class="aalb-pg-product-list-price">
|
35 |
<!-- The section tag for different marketplaces ensures localization of static text. -->
|
36 |
-
{{
|
37 |
</div>
|
38 |
{{/StrikePrice}}
|
39 |
{{#Prime}} <!-- The section tag ensures that prime icon is displayed only if it is available -->
|
1 |
<!-- A 2x5 Grid Template Layout. It can be configured by the two input fields below -->
|
2 |
{{#Items}} <!--Section tag for iterating through the list of items-->
|
3 |
<div class="aalb-pg-ad-unit" id="{{ID}}">
|
4 |
+
<h2 class="aalb-pg-ad-header">{{#AalbHeader}}{{ProductsFromAmazonLabel}}{{/AalbHeader}}</h2> <!-- Title of the ad localized according to the marketplace picked from the AalbHeader tag -->
|
5 |
<div class="aalb-pg-wrapper">
|
6 |
<div class="aalb-pg-product-container">
|
7 |
<ul class="aalb-pg-product-list">
|
28 |
</div>
|
29 |
<div class="aalb-pg-product-offer-price">
|
30 |
<!-- The section tag for different marketplaces ensures localization of static text. -->
|
31 |
+
{{PriceLabel}}: <span class="aalb-pg-product-offer-price-value">{{CurrentPrice}}</span>
|
32 |
</div>
|
33 |
{{#StrikePrice}} <!-- The section tag ensures that strike price is displayed only if it is available -->
|
34 |
<div class="aalb-pg-product-list-price">
|
35 |
<!-- The section tag for different marketplaces ensures localization of static text. -->
|
36 |
+
{{StrikePriceLabel}}: <span class="aalb-pg-product-list-price-value">{{StrikePrice}}</span>
|
37 |
</div>
|
38 |
{{/StrikePrice}}
|
39 |
{{#Prime}} <!-- The section tag ensures that prime icon is displayed only if it is available -->
|
uninstall.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
5 |
+
|
6 |
+
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
7 |
+
Version 2.0 (the "License"). You may not use this file except in compliance with the License.
|
8 |
+
A copy of the License is located in the "license" file accompanying this file.
|
9 |
+
|
10 |
+
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
11 |
+
either express or implied. See the License for the specific language governing permissions
|
12 |
+
and limitations under the License.
|
13 |
+
*/
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Uninstallation Script. This deletes entries from databse and templates uploads folder.
|
17 |
+
*
|
18 |
+
* @since 1.8.0
|
19 |
+
*/
|
20 |
+
|
21 |
+
// if uninstall.php is not called by WordPress, die
|
22 |
+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
23 |
+
exit;
|
24 |
+
}
|
25 |
+
|
26 |
+
//Include hthe Plugin Config file
|
27 |
+
require_once( plugin_dir_path( __FILE__ ) . 'plugin_config.php' );
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Remove the settings stored by the admin in the database
|
31 |
+
*
|
32 |
+
* @since 1.8.0
|
33 |
+
*/
|
34 |
+
function aalb_remove_settings() {
|
35 |
+
try {
|
36 |
+
global $wpdb;
|
37 |
+
$table_prefix = $wpdb->prefix;
|
38 |
+
$statement = 'DELETE from ' . $table_prefix . 'options
|
39 |
+
WHERE option_name like %s';
|
40 |
+
$settings = "aalb%";
|
41 |
+
$prepared_statement = $wpdb->prepare( $statement, $settings );
|
42 |
+
$wpdb->query( $prepared_statement );
|
43 |
+
} catch ( Exception $e ) {
|
44 |
+
error_log( 'Unable to clear settings. Query failed with the Exception ' . $e->getMessage() );
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
function aalb_create_dir( $dir_path ) {
|
49 |
+
if ( ! wp_mkdir_p( $dir_path ) ) {
|
50 |
+
error_log( "Error Creating Dir " . $dir_path . ". Please set the folder permissions correctly." );
|
51 |
+
|
52 |
+
return false;
|
53 |
+
}
|
54 |
+
|
55 |
+
return true;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Recursively remove the template uploads dir
|
60 |
+
*
|
61 |
+
* @since 1.8.0
|
62 |
+
*/
|
63 |
+
function aalb_remove_uploads_dir() {
|
64 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
65 |
+
try {
|
66 |
+
WP_Filesystem();
|
67 |
+
global $wp_filesystem;
|
68 |
+
|
69 |
+
$upload_dir = wp_upload_dir();
|
70 |
+
$upload_dir = $wp_filesystem->find_folder( $upload_dir['basedir'] );
|
71 |
+
|
72 |
+
$template_upload_path = $upload_dir . AALB_TEMPLATE_UPLOADS_FOLDER;
|
73 |
+
|
74 |
+
if ( ! $wp_filesystem->is_dir( $template_upload_path ) && ! aalb_create_dir( $template_upload_path ) ) {
|
75 |
+
return false;
|
76 |
+
}
|
77 |
+
$wp_filesystem->rmdir( $template_upload_path, true );
|
78 |
+
} catch (Exception $e) {
|
79 |
+
error_log( 'Unable to remove templates uploads directory. Failed with the Exception ' . $e->getMessage() );
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
aalb_remove_settings();
|
84 |
+
aalb_remove_uploads_dir();
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit40d46390c117e8cbe149ad058dd0a1b2::getLoader();
|
vendor/composer/autoload_namespaces.php
CHANGED
@@ -6,4 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
|
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
|
|
9 |
);
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
9 |
+
'Mustache' => array($vendorDir . '/mustache/mustache/src'),
|
10 |
);
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit622247985f56ba38f11a91b245c8de8e
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit40d46390c117e8cbe149ad058dd0a1b2
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit40d46390c117e8cbe149ad058dd0a1b2', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit40d46390c117e8cbe149ad058dd0a1b2', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit40d46390c117e8cbe149ad058dd0a1b2::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'M' =>
|
@@ -46,11 +46,22 @@ class ComposerStaticInit622247985f56ba38f11a91b245c8de8e
|
|
46 |
),
|
47 |
);
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
public static function getInitializer(ClassLoader $loader)
|
50 |
{
|
51 |
return \Closure::bind(function () use ($loader) {
|
52 |
-
$loader->prefixLengthsPsr4 =
|
53 |
-
$loader->prefixDirsPsr4 =
|
|
|
54 |
|
55 |
}, null, ClassLoader::class);
|
56 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit40d46390c117e8cbe149ad058dd0a1b2
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'M' =>
|
46 |
),
|
47 |
);
|
48 |
|
49 |
+
public static $prefixesPsr0 = array (
|
50 |
+
'M' =>
|
51 |
+
array (
|
52 |
+
'Mustache' =>
|
53 |
+
array (
|
54 |
+
0 => __DIR__ . '/..' . '/mustache/mustache/src',
|
55 |
+
),
|
56 |
+
),
|
57 |
+
);
|
58 |
+
|
59 |
public static function getInitializer(ClassLoader $loader)
|
60 |
{
|
61 |
return \Closure::bind(function () use ($loader) {
|
62 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit40d46390c117e8cbe149ad058dd0a1b2::$prefixLengthsPsr4;
|
63 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit40d46390c117e8cbe149ad058dd0a1b2::$prefixDirsPsr4;
|
64 |
+
$loader->prefixesPsr0 = ComposerStaticInit40d46390c117e8cbe149ad058dd0a1b2::$prefixesPsr0;
|
65 |
|
66 |
}, null, ClassLoader::class);
|
67 |
}
|
vendor/composer/ca-bundle/composer.json
CHANGED
@@ -27,7 +27,7 @@
|
|
27 |
"php": "^5.3.2 || ^7.0"
|
28 |
},
|
29 |
"require-dev": {
|
30 |
-
"phpunit/phpunit": "^4.8.35",
|
31 |
"psr/log": "^1.0",
|
32 |
"symfony/process": "^2.5 || ^3.0 || ^4.0"
|
33 |
},
|
27 |
"php": "^5.3.2 || ^7.0"
|
28 |
},
|
29 |
"require-dev": {
|
30 |
+
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5",
|
31 |
"psr/log": "^1.0",
|
32 |
"symfony/process": "^2.5 || ^3.0 || ^4.0"
|
33 |
},
|
vendor/composer/ca-bundle/res/cacert.pem
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
##
|
2 |
## Bundle of CA Root Certificates
|
3 |
##
|
4 |
-
## Certificate data from Mozilla as of: Wed
|
5 |
##
|
6 |
## This is a bundle of X.509 certificates of public Certificate Authorities
|
7 |
## (CA). These were automatically extracted from Mozilla's root certificates
|
@@ -14,7 +14,7 @@
|
|
14 |
## Just configure this file as the SSLCACertificateFile.
|
15 |
##
|
16 |
## Conversion done with mk-ca-bundle.pl version 1.27.
|
17 |
-
## SHA256:
|
18 |
##
|
19 |
|
20 |
|
@@ -283,25 +283,6 @@ YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt
|
|
283 |
398znM/jra6O1I7mT1GvFpLgXPYHDw==
|
284 |
-----END CERTIFICATE-----
|
285 |
|
286 |
-
Certum Root CA
|
287 |
-
==============
|
288 |
-
-----BEGIN CERTIFICATE-----
|
289 |
-
MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQK
|
290 |
-
ExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBDQTAeFw0wMjA2MTExMDQ2Mzla
|
291 |
-
Fw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8u
|
292 |
-
by4xEjAQBgNVBAMTCUNlcnR1bSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6x
|
293 |
-
wS7TT3zNJc4YPk/EjG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdL
|
294 |
-
kKWoePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GIULdtlkIJ
|
295 |
-
89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapuOb7kky/ZR6By6/qmW6/K
|
296 |
-
Uz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUgAKpoC6EahQGcxEZjgoi2IrHu/qpGWX7P
|
297 |
-
NSzVttpd90gzFFS269lvzs2I1qsb2pY7HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkq
|
298 |
-
hkiG9w0BAQUFAAOCAQEAuI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+
|
299 |
-
GXYkHAQaTOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTgxSvg
|
300 |
-
GrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1qCjqTE5s7FCMTY5w/
|
301 |
-
0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5xO/fIR/RpbxXyEV6DHpx8Uq79AtoS
|
302 |
-
qFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs6GAqm4VKQPNriiTsBhYscw==
|
303 |
-
-----END CERTIFICATE-----
|
304 |
-
|
305 |
Comodo AAA Services root
|
306 |
========================
|
307 |
-----BEGIN CERTIFICATE-----
|
@@ -465,60 +446,6 @@ EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
|
|
465 |
llpwrN9M
|
466 |
-----END CERTIFICATE-----
|
467 |
|
468 |
-
Camerfirma Chambers of Commerce Root
|
469 |
-
====================================
|
470 |
-
-----BEGIN CERTIFICATE-----
|
471 |
-
MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
|
472 |
-
QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
|
473 |
-
ZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAx
|
474 |
-
NjEzNDNaFw0zNzA5MzAxNjEzNDRaMH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZp
|
475 |
-
cm1hIFNBIENJRiBBODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3Jn
|
476 |
-
MSIwIAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0BAQEFAAOC
|
477 |
-
AQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtbunXF/KGIJPov7coISjlU
|
478 |
-
xFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0dBmpAPrMMhe5cG3nCYsS4No41XQEMIwRH
|
479 |
-
NaqbYE6gZj3LJgqcQKH0XZi/caulAGgq7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jW
|
480 |
-
DA+wWFjbw2Y3npuRVDM30pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFV
|
481 |
-
d9oKDMyXroDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIGA1Ud
|
482 |
-
EwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5jaGFtYmVyc2lnbi5v
|
483 |
-
cmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p26EpW1eLTXYGduHRooowDgYDVR0P
|
484 |
-
AQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hh
|
485 |
-
bWJlcnNpZ24ub3JnMCcGA1UdEgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYD
|
486 |
-
VR0gBFEwTzBNBgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz
|
487 |
-
aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEBAAxBl8IahsAi
|
488 |
-
fJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZdp0AJPaxJRUXcLo0waLIJuvvD
|
489 |
-
L8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wN
|
490 |
-
UPf6s+xCX6ndbcj0dc97wXImsQEcXCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/n
|
491 |
-
ADydb47kMgkdTXg0eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1
|
492 |
-
erfutGWaIZDgqtCYvDi1czyL+Nw=
|
493 |
-
-----END CERTIFICATE-----
|
494 |
-
|
495 |
-
Camerfirma Global Chambersign Root
|
496 |
-
==================================
|
497 |
-
-----BEGIN CERTIFICATE-----
|
498 |
-
MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
|
499 |
-
QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
|
500 |
-
ZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYx
|
501 |
-
NDE4WhcNMzcwOTMwMTYxNDE4WjB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt
|
502 |
-
YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEg
|
503 |
-
MB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAw
|
504 |
-
ggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0Mi+ITaFgCPS3CU6gSS9J
|
505 |
-
1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/sQJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8O
|
506 |
-
by4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpVeAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl
|
507 |
-
6DJWk0aJqCWKZQbua795B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c
|
508 |
-
8lCrEqWhz0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0TAQH/
|
509 |
-
BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1iZXJzaWduLm9yZy9j
|
510 |
-
aGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4wTcbOX60Qq+UDpfqpFDAOBgNVHQ8B
|
511 |
-
Af8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAHMCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBj
|
512 |
-
aGFtYmVyc2lnbi5vcmcwKgYDVR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9y
|
513 |
-
ZzBbBgNVHSAEVDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh
|
514 |
-
bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0BAQUFAAOCAQEA
|
515 |
-
PDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUMbKGKfKX0j//U2K0X1S0E0T9Y
|
516 |
-
gOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXiryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJ
|
517 |
-
PJ7oKXqJ1/6v/2j1pReQvayZzKWGVwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4
|
518 |
-
IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes
|
519 |
-
t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A==
|
520 |
-
-----END CERTIFICATE-----
|
521 |
-
|
522 |
XRamp Global CA Root
|
523 |
====================
|
524 |
-----BEGIN CERTIFICATE-----
|
@@ -591,47 +518,6 @@ KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
|
|
591 |
QBFGmh95DmK/D5fs4C8fF5Q=
|
592 |
-----END CERTIFICATE-----
|
593 |
|
594 |
-
StartCom Certification Authority
|
595 |
-
================================
|
596 |
-
-----BEGIN CERTIFICATE-----
|
597 |
-
MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
|
598 |
-
U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
|
599 |
-
ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
|
600 |
-
NjM2WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
|
601 |
-
LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
|
602 |
-
U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
|
603 |
-
ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
|
604 |
-
o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
|
605 |
-
Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
|
606 |
-
eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
|
607 |
-
2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
|
608 |
-
6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
|
609 |
-
osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
|
610 |
-
untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
|
611 |
-
UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
|
612 |
-
37uMdBNSSwIDAQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE
|
613 |
-
FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9jZXJ0LnN0YXJ0
|
614 |
-
Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3JsLnN0YXJ0Y29tLm9yZy9zZnNj
|
615 |
-
YS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFMBgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUH
|
616 |
-
AgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRw
|
617 |
-
Oi8vY2VydC5zdGFydGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYg
|
618 |
-
U3RhcnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlhYmlsaXR5
|
619 |
-
LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2YgdGhlIFN0YXJ0Q29tIENl
|
620 |
-
cnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFpbGFibGUgYXQgaHR0cDovL2NlcnQuc3Rh
|
621 |
-
cnRjb20ub3JnL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilT
|
622 |
-
dGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOC
|
623 |
-
AgEAFmyZ9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8jhvh
|
624 |
-
3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUWFjgKXlf2Ysd6AgXm
|
625 |
-
vB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJzewT4F+irsfMuXGRuczE6Eri8sxHk
|
626 |
-
fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3
|
627 |
-
fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ
|
628 |
-
EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq
|
629 |
-
yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl
|
630 |
-
1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/
|
631 |
-
lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro
|
632 |
-
g14=
|
633 |
-
-----END CERTIFICATE-----
|
634 |
-
|
635 |
Taiwan GRCA
|
636 |
===========
|
637 |
-----BEGIN CERTIFICATE-----
|
@@ -770,30 +656,6 @@ RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
|
|
770 |
fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
|
771 |
-----END CERTIFICATE-----
|
772 |
|
773 |
-
DST ACES CA X6
|
774 |
-
==============
|
775 |
-
-----BEGIN CERTIFICATE-----
|
776 |
-
MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQG
|
777 |
-
EwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QxETAPBgNVBAsTCERTVCBBQ0VT
|
778 |
-
MRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0wMzExMjAyMTE5NThaFw0xNzExMjAyMTE5NTha
|
779 |
-
MFsxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UE
|
780 |
-
CxMIRFNUIEFDRVMxFzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOC
|
781 |
-
AQ8AMIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPuktKe1jzI
|
782 |
-
DZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7gLFViYsx+tC3dr5BPTCa
|
783 |
-
pCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZHfAjIgrrep4c9oW24MFbCswKBXy314pow
|
784 |
-
GCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4aahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPy
|
785 |
-
MjwmR/onJALJfh1biEITajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1Ud
|
786 |
-
EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rkc3Qu
|
787 |
-
Y29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjtodHRwOi8vd3d3LnRy
|
788 |
-
dXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMtaW5kZXguaHRtbDAdBgNVHQ4EFgQU
|
789 |
-
CXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZIhvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V2
|
790 |
-
5FYrnJmQ6AgwbN99Pe7lv7UkQIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6t
|
791 |
-
Fr8hlxCBPeP/h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq
|
792 |
-
nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpRrscL9yuwNwXs
|
793 |
-
vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO3
|
794 |
-
oKfN5XozNmr6mis=
|
795 |
-
-----END CERTIFICATE-----
|
796 |
-
|
797 |
SwissSign Gold CA - G2
|
798 |
======================
|
799 |
-----BEGIN CERTIFICATE-----
|
@@ -1036,27 +898,6 @@ FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
|
|
1036 |
U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
|
1037 |
-----END CERTIFICATE-----
|
1038 |
|
1039 |
-
Security Communication EV RootCA1
|
1040 |
-
=================================
|
1041 |
-
-----BEGIN CERTIFICATE-----
|
1042 |
-
MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
|
1043 |
-
U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMhU2VjdXJpdHkgQ29tbXVuaWNh
|
1044 |
-
dGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIzMloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UE
|
1045 |
-
BhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNl
|
1046 |
-
Y3VyaXR5IENvbW11bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
|
1047 |
-
AQoCggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSERMqm4miO
|
1048 |
-
/VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gOzXppFodEtZDkBp2uoQSX
|
1049 |
-
WHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4z
|
1050 |
-
ZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDFMxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4
|
1051 |
-
bepJz11sS6/vmsJWXMY1VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK
|
1052 |
-
9U2vP9eCOKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
|
1053 |
-
SIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HWtWS3irO4G8za+6xm
|
1054 |
-
iEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZq51ihPZRwSzJIxXYKLerJRO1RuGG
|
1055 |
-
Av8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDbEJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnW
|
1056 |
-
mHyojf6GPgcWkuF75x3sM3Z+Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEW
|
1057 |
-
T1MKZPlO9L9OVL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490
|
1058 |
-
-----END CERTIFICATE-----
|
1059 |
-
|
1060 |
OISTE WISeKey Global Root GA CA
|
1061 |
===============================
|
1062 |
-----BEGIN CERTIFICATE-----
|
@@ -1177,34 +1018,6 @@ sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
|
|
1177 |
BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
|
1178 |
-----END CERTIFICATE-----
|
1179 |
|
1180 |
-
T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3
|
1181 |
-
=============================================================================================================================
|
1182 |
-
-----BEGIN CERTIFICATE-----
|
1183 |
-
MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRSMRgwFgYDVQQH
|
1184 |
-
DA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJpbGltc2VsIHZlIFRla25vbG9q
|
1185 |
-
aWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSwVEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ry
|
1186 |
-
b25payB2ZSBLcmlwdG9sb2ppIEFyYcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNV
|
1187 |
-
BAsMGkthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUg
|
1188 |
-
S8O2ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAeFw0wNzA4
|
1189 |
-
MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIxGDAWBgNVBAcMD0dlYnpl
|
1190 |
-
IC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmlsaW1zZWwgdmUgVGVrbm9sb2ppayBBcmHF
|
1191 |
-
n3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBUQUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZl
|
1192 |
-
IEtyaXB0b2xvamkgQXJhxZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2Ft
|
1193 |
-
dSBTZXJ0aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7ZrIFNl
|
1194 |
-
cnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIBIjANBgkqhkiG9w0B
|
1195 |
-
AQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4hgb46ezzb8R1Sf1n68yJMlaCQvEhO
|
1196 |
-
Eav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yKO7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1
|
1197 |
-
xnnRFDDtG1hba+818qEhTsXOfJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR
|
1198 |
-
6Oqeyjh1jmKwlZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL
|
1199 |
-
hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQIDAQABo0IwQDAd
|
1200 |
-
BgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
|
1201 |
-
MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmPNOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4
|
1202 |
-
N5EY3ATIZJkrGG2AA1nJrvhY0D7twyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLT
|
1203 |
-
y9LQQfMmNkqblWwM7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYh
|
1204 |
-
LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M
|
1205 |
-
dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI=
|
1206 |
-
-----END CERTIFICATE-----
|
1207 |
-
|
1208 |
certSIGN ROOT CA
|
1209 |
================
|
1210 |
-----BEGIN CERTIFICATE-----
|
@@ -1452,37 +1265,6 @@ y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
|
|
1452 |
lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
|
1453 |
-----END CERTIFICATE-----
|
1454 |
|
1455 |
-
ACEDICOM Root
|
1456 |
-
=============
|
1457 |
-
-----BEGIN CERTIFICATE-----
|
1458 |
-
MIIFtTCCA52gAwIBAgIIYY3HhjsBggUwDQYJKoZIhvcNAQEFBQAwRDEWMBQGA1UEAwwNQUNFRElD
|
1459 |
-
T00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMB4XDTA4
|
1460 |
-
MDQxODE2MjQyMloXDTI4MDQxMzE2MjQyMlowRDEWMBQGA1UEAwwNQUNFRElDT00gUm9vdDEMMAoG
|
1461 |
-
A1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMIICIjANBgkqhkiG9w0BAQEF
|
1462 |
-
AAOCAg8AMIICCgKCAgEA/5KV4WgGdrQsyFhIyv2AVClVYyT/kGWbEHV7w2rbYgIB8hiGtXxaOLHk
|
1463 |
-
WLn709gtn70yN78sFW2+tfQh0hOR2QetAQXW8713zl9CgQr5auODAKgrLlUTY4HKRxx7XBZXehuD
|
1464 |
-
YAQ6PmXDzQHe3qTWDLqO3tkE7hdWIpuPY/1NFgu3e3eM+SW10W2ZEi5PGrjm6gSSrj0RuVFCPYew
|
1465 |
-
MYWveVqc/udOXpJPQ/yrOq2lEiZmueIM15jO1FillUAKt0SdE3QrwqXrIhWYENiLxQSfHY9g5QYb
|
1466 |
-
m8+5eaA9oiM/Qj9r+hwDezCNzmzAv+YbX79nuIQZ1RXve8uQNjFiybwCq0Zfm/4aaJQ0PZCOrfbk
|
1467 |
-
HQl/Sog4P75n/TSW9R28MHTLOO7VbKvU/PQAtwBbhTIWdjPp2KOZnQUAqhbm84F9b32qhm2tFXTT
|
1468 |
-
xKJxqvQUfecyuB+81fFOvW8XAjnXDpVCOscAPukmYxHqC9FK/xidstd7LzrZlvvoHpKuE1XI2Sf2
|
1469 |
-
3EgbsCTBheN3nZqk8wwRHQ3ItBTutYJXCb8gWH8vIiPYcMt5bMlL8qkqyPyHK9caUPgn6C9D4zq9
|
1470 |
-
2Fdx/c6mUlv53U3t5fZvie27k5x2IXXwkkwp9y+cAS7+UEaeZAwUswdbxcJzbPEHXEUkFDWug/Fq
|
1471 |
-
TYl6+rPYLWbwNof1K1MCAwEAAaOBqjCBpzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKaz
|
1472 |
-
4SsrSbbXc6GqlPUB53NlTKxQMA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUprPhKytJttdzoaqU
|
1473 |
-
9QHnc2VMrFAwRAYDVR0gBD0wOzA5BgRVHSAAMDEwLwYIKwYBBQUHAgEWI2h0dHA6Ly9hY2VkaWNv
|
1474 |
-
bS5lZGljb21ncm91cC5jb20vZG9jMA0GCSqGSIb3DQEBBQUAA4ICAQDOLAtSUWImfQwng4/F9tqg
|
1475 |
-
aHtPkl7qpHMyEVNEskTLnewPeUKzEKbHDZ3Ltvo/Onzqv4hTGzz3gvoFNTPhNahXwOf9jU8/kzJP
|
1476 |
-
eGYDdwdY6ZXIfj7QeQCM8htRM5u8lOk6e25SLTKeI6RF+7YuE7CLGLHdztUdp0J/Vb77W7tH1Pwk
|
1477 |
-
zQSulgUV1qzOMPPKC8W64iLgpq0i5ALudBF/TP94HTXa5gI06xgSYXcGCRZj6hitoocf8seACQl1
|
1478 |
-
ThCojz2GuHURwCRiipZ7SkXp7FnFvmuD5uHorLUwHv4FB4D54SMNUI8FmP8sX+g7tq3PgbUhh8oI
|
1479 |
-
KiMnMCArz+2UW6yyetLHKKGKC5tNSixthT8Jcjxn4tncB7rrZXtaAWPWkFtPF2Y9fwsZo5NjEFIq
|
1480 |
-
nxQWWOLcpfShFosOkYuByptZ+thrkQdlVV9SH686+5DdaaVbnG0OLLb6zqylfDJKZ0DcMDQj3dcE
|
1481 |
-
I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp
|
1482 |
-
MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o
|
1483 |
-
tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA==
|
1484 |
-
-----END CERTIFICATE-----
|
1485 |
-
|
1486 |
Microsec e-Szigno Root CA 2009
|
1487 |
==============================
|
1488 |
-----BEGIN CERTIFICATE-----
|
@@ -1843,37 +1625,6 @@ Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
|
|
1843 |
03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
|
1844 |
-----END CERTIFICATE-----
|
1845 |
|
1846 |
-
Certinomis - Autorité Racine
|
1847 |
-
============================
|
1848 |
-
-----BEGIN CERTIFICATE-----
|
1849 |
-
MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
|
1850 |
-
Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAkBgNVBAMMHUNlcnRpbm9taXMg
|
1851 |
-
LSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkG
|
1852 |
-
A1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYw
|
1853 |
-
JAYDVQQDDB1DZXJ0aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQAD
|
1854 |
-
ggIPADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jYF1AMnmHa
|
1855 |
-
wE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N8y4oH3DfVS9O7cdxbwly
|
1856 |
-
Lu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWerP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw
|
1857 |
-
2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92N
|
1858 |
-
jMD2AR5vpTESOH2VwnHu7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9q
|
1859 |
-
c1pkIuVC28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6lSTC
|
1860 |
-
lrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1Enn1So2+WLhl+HPNb
|
1861 |
-
xxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB0iSVL1N6aaLwD4ZFjliCK0wi1F6g
|
1862 |
-
530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql095gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna
|
1863 |
-
4NH4+ej9Uji29YnfAgMBAAGjWzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
|
1864 |
-
A1UdDgQWBBQNjLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ
|
1865 |
-
KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9sov3/4gbIOZ/x
|
1866 |
-
WqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZMOH8oMDX/nyNTt7buFHAAQCva
|
1867 |
-
R6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40
|
1868 |
-
nJ+U8/aGH88bc62UeYdocMMzpXDn2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1B
|
1869 |
-
CxMjidPJC+iKunqjo3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjv
|
1870 |
-
JL1vnxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG5ERQL1TE
|
1871 |
-
qkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWqpdEdnV1j6CTmNhTih60b
|
1872 |
-
WfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZbdsLLO7XSAPCjDuGtbkD326C00EauFddE
|
1873 |
-
wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/
|
1874 |
-
vgt2Fl43N+bYdJeimUV5
|
1875 |
-
-----END CERTIFICATE-----
|
1876 |
-
|
1877 |
TWCA Root Certification Authority
|
1878 |
=================================
|
1879 |
-----BEGIN CERTIFICATE-----
|
@@ -2022,75 +1773,6 @@ l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
|
|
2022 |
iB6XzCGcKQENZetX2fNXlrtIzYE=
|
2023 |
-----END CERTIFICATE-----
|
2024 |
|
2025 |
-
StartCom Certification Authority
|
2026 |
-
================================
|
2027 |
-
-----BEGIN CERTIFICATE-----
|
2028 |
-
MIIHhzCCBW+gAwIBAgIBLTANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
|
2029 |
-
U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
|
2030 |
-
ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
|
2031 |
-
NjM3WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
|
2032 |
-
LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
|
2033 |
-
U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
|
2034 |
-
ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
|
2035 |
-
o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
|
2036 |
-
Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
|
2037 |
-
eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
|
2038 |
-
2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
|
2039 |
-
6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
|
2040 |
-
osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
|
2041 |
-
untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
|
2042 |
-
UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
|
2043 |
-
37uMdBNSSwIDAQABo4ICEDCCAgwwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD
|
2044 |
-
VR0OBBYEFE4L7xqkQFulF2mHMMo0aEPQQa7yMB8GA1UdIwQYMBaAFE4L7xqkQFulF2mHMMo0aEPQ
|
2045 |
-
Qa7yMIIBWgYDVR0gBIIBUTCCAU0wggFJBgsrBgEEAYG1NwEBATCCATgwLgYIKwYBBQUHAgEWImh0
|
2046 |
-
dHA6Ly93d3cuc3RhcnRzc2wuY29tL3BvbGljeS5wZGYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cu
|
2047 |
-
c3RhcnRzc2wuY29tL2ludGVybWVkaWF0ZS5wZGYwgc8GCCsGAQUFBwICMIHCMCcWIFN0YXJ0IENv
|
2048 |
-
bW1lcmNpYWwgKFN0YXJ0Q29tKSBMdGQuMAMCAQEagZZMaW1pdGVkIExpYWJpbGl0eSwgcmVhZCB0
|
2049 |
-
aGUgc2VjdGlvbiAqTGVnYWwgTGltaXRhdGlvbnMqIG9mIHRoZSBTdGFydENvbSBDZXJ0aWZpY2F0
|
2050 |
-
aW9uIEF1dGhvcml0eSBQb2xpY3kgYXZhaWxhYmxlIGF0IGh0dHA6Ly93d3cuc3RhcnRzc2wuY29t
|
2051 |
-
L3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBG
|
2052 |
-
cmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQsFAAOCAgEAjo/n3JR5
|
2053 |
-
fPGFf59Jb2vKXfuM/gTFwWLRfUKKvFO3lANmMD+x5wqnUCBVJX92ehQN6wQOQOY+2IirByeDqXWm
|
2054 |
-
N3PH/UvSTa0XQMhGvjt/UfzDtgUx3M2FIk5xt/JxXrAaxrqTi3iSSoX4eA+D/i+tLPfkpLst0OcN
|
2055 |
-
Org+zvZ49q5HJMqjNTbOx8aHmNrs++myziebiMMEofYLWWivydsQD032ZGNcpRJvkrKTlMeIFw6T
|
2056 |
-
tn5ii5B/q06f/ON1FE8qMt9bDeD1e5MNq6HPh+GlBEXoPBKlCcWw0bdT82AUuoVpaiF8H3VhFyAX
|
2057 |
-
e2w7QSlc4axa0c2Mm+tgHRns9+Ww2vl5GKVFP0lDV9LdJNUso/2RjSe15esUBppMeyG7Oq0wBhjA
|
2058 |
-
2MFrLH9ZXF2RsXAiV+uKa0hK1Q8p7MZAwC+ITGgBF3f0JBlPvfrhsiAhS90a2Cl9qrjeVOwhVYBs
|
2059 |
-
HvUwyKMQ5bLmKhQxw4UtjJixhlpPiVktucf3HMiKf8CdBUrmQk9io20ppB+Fq9vlgcitKj1MXVuE
|
2060 |
-
JnHEhV5xJMqlG2zYYdMa4FTbzrqpMrUi9nNBCV24F10OD5mQ1kfabwo6YigUZ4LZ8dCAWZvLMdib
|
2061 |
-
D4x3TrVoivJs9iQOLWxwxXPR3hTQcY+203sC9uO41Alua551hDnmfyWl8kgAwKQB2j8=
|
2062 |
-
-----END CERTIFICATE-----
|
2063 |
-
|
2064 |
-
StartCom Certification Authority G2
|
2065 |
-
===================================
|
2066 |
-
-----BEGIN CERTIFICATE-----
|
2067 |
-
MIIFYzCCA0ugAwIBAgIBOzANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
|
2068 |
-
U3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg
|
2069 |
-
RzIwHhcNMTAwMTAxMDEwMDAxWhcNMzkxMjMxMjM1OTAxWjBTMQswCQYDVQQGEwJJTDEWMBQGA1UE
|
2070 |
-
ChMNU3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3Jp
|
2071 |
-
dHkgRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2iTZbB7cgNr2Cu+EWIAOVeq8O
|
2072 |
-
o1XJJZlKxdBWQYeQTSFgpBSHO839sj60ZwNq7eEPS8CRhXBF4EKe3ikj1AENoBB5uNsDvfOpL9HG
|
2073 |
-
4A/LnooUCri99lZi8cVytjIl2bLzvWXFDSxu1ZJvGIsAQRSCb0AgJnooD/Uefyf3lLE3PbfHkffi
|
2074 |
-
Aez9lInhzG7TNtYKGXmu1zSCZf98Qru23QumNK9LYP5/Q0kGi4xDuFby2X8hQxfqp0iVAXV16iul
|
2075 |
-
Q5XqFYSdCI0mblWbq9zSOdIxHWDirMxWRST1HFSr7obdljKF+ExP6JV2tgXdNiNnvP8V4so75qbs
|
2076 |
-
O+wmETRIjfaAKxojAuuKHDp2KntWFhxyKrOq42ClAJ8Em+JvHhRYW6Vsi1g8w7pOOlz34ZYrPu8H
|
2077 |
-
vKTlXcxNnw3h3Kq74W4a7I/htkxNeXJdFzULHdfBR9qWJODQcqhaX2YtENwvKhOuJv4KHBnM0D4L
|
2078 |
-
nMgJLvlblnpHnOl68wVQdJVznjAJ85eCXuaPOQgeWeU1FEIT/wCc976qUM/iUUjXuG+v+E5+M5iS
|
2079 |
-
FGI6dWPPe/regjupuznixL0sAA7IF6wT700ljtizkC+p2il9Ha90OrInwMEePnWjFqmveiJdnxMa
|
2080 |
-
z6eg6+OGCtP95paV1yPIN93EfKo2rJgaErHgTuixO/XWb/Ew1wIDAQABo0IwQDAPBgNVHRMBAf8E
|
2081 |
-
BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUS8W0QGutHLOlHGVuRjaJhwUMDrYwDQYJ
|
2082 |
-
KoZIhvcNAQELBQADggIBAHNXPyzVlTJ+N9uWkusZXn5T50HsEbZH77Xe7XRcxfGOSeD8bpkTzZ+K
|
2083 |
-
2s06Ctg6Wgk/XzTQLwPSZh0avZyQN8gMjgdalEVGKua+etqhqaRpEpKwfTbURIfXUfEpY9Z1zRbk
|
2084 |
-
J4kd+MIySP3bmdCPX1R0zKxnNBFi2QwKN4fRoxdIjtIXHfbX/dtl6/2o1PXWT6RbdejF0mCy2wl+
|
2085 |
-
JYt7ulKSnj7oxXehPOBKc2thz4bcQ///If4jXSRK9dNtD2IEBVeC2m6kMyV5Sy5UGYvMLD0w6dEG
|
2086 |
-
/+gyRr61M3Z3qAFdlsHB1b6uJcDJHgoJIIihDsnzb02CVAAgp9KP5DlUFy6NHrgbuxu9mk47EDTc
|
2087 |
-
nIhT76IxW1hPkWLIwpqazRVdOKnWvvgTtZ8SafJQYqz7Fzf07rh1Z2AQ+4NQ+US1dZxAF7L+/Xld
|
2088 |
-
blhYXzD8AK6vM8EOTmy6p6ahfzLbOOCxchcKK5HsamMm7YnUeMx0HgX4a/6ManY5Ka5lIxKVCCIc
|
2089 |
-
l85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoohdVddLHRDiBYmxOlsGOm
|
2090 |
-
7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulrso8uBtjRkcfGEvRM/TAXw8HaOFvjqerm
|
2091 |
-
obp573PYtlNXLfbQ4ddI
|
2092 |
-
-----END CERTIFICATE-----
|
2093 |
-
|
2094 |
Buypass Class 2 Root CA
|
2095 |
=======================
|
2096 |
-----BEGIN CERTIFICATE-----
|
@@ -2197,31 +1879,6 @@ uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
|
|
2197 |
dcGWxZ0=
|
2198 |
-----END CERTIFICATE-----
|
2199 |
|
2200 |
-
TURKTRUST Certificate Services Provider Root 2007
|
2201 |
-
=================================================
|
2202 |
-
-----BEGIN CERTIFICATE-----
|
2203 |
-
MIIEPTCCAyWgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvzE/MD0GA1UEAww2VMOcUktUUlVTVCBF
|
2204 |
-
bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP
|
2205 |
-
MA0GA1UEBwwGQW5rYXJhMV4wXAYDVQQKDFVUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg
|
2206 |
-
QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgQXJhbMSxayAyMDA3MB4X
|
2207 |
-
DTA3MTIyNTE4MzcxOVoXDTE3MTIyMjE4MzcxOVowgb8xPzA9BgNVBAMMNlTDnFJLVFJVU1QgRWxl
|
2208 |
-
a3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTELMAkGA1UEBhMCVFIxDzAN
|
2209 |
-
BgNVBAcMBkFua2FyYTFeMFwGA1UECgxVVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
|
2210 |
-
bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4gKGMpIEFyYWzEsWsgMjAwNzCCASIw
|
2211 |
-
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKu3PgqMyKVYFeaK7yc9SrToJdPNM8Ig3BnuiD9N
|
2212 |
-
YvDdE3ePYakqtdTyuTFYKTsvP2qcb3N2Je40IIDu6rfwxArNK4aUyeNgsURSsloptJGXg9i3phQv
|
2213 |
-
KUmi8wUG+7RP2qFsmmaf8EMJyupyj+sA1zU511YXRxcw9L6/P8JorzZAwan0qafoEGsIiveGHtya
|
2214 |
-
KhUG9qPw9ODHFNRRf8+0222vR5YXm3dx2KdxnSQM9pQ/hTEST7ruToK4uT6PIzdezKKqdfcYbwnT
|
2215 |
-
rqdUKDT74eA7YH2gvnmJhsifLfkKS8RQouf9eRbHegsYz85M733WB2+Y8a+xwXrXgTW4qhe04MsC
|
2216 |
-
AwEAAaNCMEAwHQYDVR0OBBYEFCnFkKslrxHkYb+j/4hhkeYO/pyBMA4GA1UdDwEB/wQEAwIBBjAP
|
2217 |
-
BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAQDdr4Ouwo0RSVgrESLFF6QSU2TJ/s
|
2218 |
-
Px+EnWVUXKgWAkD6bho3hO9ynYYKVZ1WKKxmLNA6VpM0ByWtCLCPyA8JWcqdmBzlVPi5RX9ql2+I
|
2219 |
-
aE1KBiY3iAIOtsbWcpnOa3faYjGkVh+uX4132l32iPwa2Z61gfAyuOOI0JzzaqC5mxRZNTZPz/OO
|
2220 |
-
Xl0XrRWV2N2y1RVuAE6zS89mlOTgzbUF2mNXi+WzqtvALhyQRNsaXRik7r4EW5nVcV9VZWRi1aKb
|
2221 |
-
BFmGyGJ353yCRWo9F7/snXUMrqNvWtMvmDb08PUZqxFdyKbjKlhqQgnDvZImZjINXQhVdP+MmNAK
|
2222 |
-
poRq0Tl9
|
2223 |
-
-----END CERTIFICATE-----
|
2224 |
-
|
2225 |
D-TRUST Root Class 3 CA 2 2009
|
2226 |
==============================
|
2227 |
-----BEGIN CERTIFICATE-----
|
@@ -2271,84 +1928,6 @@ NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
|
|
2271 |
w9y4AyHqnxbxLFS1
|
2272 |
-----END CERTIFICATE-----
|
2273 |
|
2274 |
-
PSCProcert
|
2275 |
-
==========
|
2276 |
-
-----BEGIN CERTIFICATE-----
|
2277 |
-
MIIJhjCCB26gAwIBAgIBCzANBgkqhkiG9w0BAQsFADCCAR4xPjA8BgNVBAMTNUF1dG9yaWRhZCBk
|
2278 |
-
ZSBDZXJ0aWZpY2FjaW9uIFJhaXogZGVsIEVzdGFkbyBWZW5lem9sYW5vMQswCQYDVQQGEwJWRTEQ
|
2279 |
-
MA4GA1UEBxMHQ2FyYWNhczEZMBcGA1UECBMQRGlzdHJpdG8gQ2FwaXRhbDE2MDQGA1UEChMtU2lz
|
2280 |
-
dGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMUMwQQYDVQQLEzpTdXBl
|
2281 |
-
cmludGVuZGVuY2lhIGRlIFNlcnZpY2lvcyBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMSUw
|
2282 |
-
IwYJKoZIhvcNAQkBFhZhY3JhaXpAc3VzY2VydGUuZ29iLnZlMB4XDTEwMTIyODE2NTEwMFoXDTIw
|
2283 |
-
MTIyNTIzNTk1OVowgdExJjAkBgkqhkiG9w0BCQEWF2NvbnRhY3RvQHByb2NlcnQubmV0LnZlMQ8w
|
2284 |
-
DQYDVQQHEwZDaGFjYW8xEDAOBgNVBAgTB01pcmFuZGExKjAoBgNVBAsTIVByb3ZlZWRvciBkZSBD
|
2285 |
-
ZXJ0aWZpY2Fkb3MgUFJPQ0VSVDE2MDQGA1UEChMtU2lzdGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZp
|
2286 |
-
Y2FjaW9uIEVsZWN0cm9uaWNhMQswCQYDVQQGEwJWRTETMBEGA1UEAxMKUFNDUHJvY2VydDCCAiIw
|
2287 |
-
DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANW39KOUM6FGqVVhSQ2oh3NekS1wwQYalNo97BVC
|
2288 |
-
wfWMrmoX8Yqt/ICV6oNEolt6Vc5Pp6XVurgfoCfAUFM+jbnADrgV3NZs+J74BCXfgI8Qhd19L3uA
|
2289 |
-
3VcAZCP4bsm+lU/hdezgfl6VzbHvvnpC2Mks0+saGiKLt38GieU89RLAu9MLmV+QfI4tL3czkkoh
|
2290 |
-
RqipCKzx9hEC2ZUWno0vluYC3XXCFCpa1sl9JcLB/KpnheLsvtF8PPqv1W7/U0HU9TI4seJfxPmO
|
2291 |
-
EO8GqQKJ/+MMbpfg353bIdD0PghpbNjU5Db4g7ayNo+c7zo3Fn2/omnXO1ty0K+qP1xmk6wKImG2
|
2292 |
-
0qCZyFSTXai20b1dCl53lKItwIKOvMoDKjSuc/HUtQy9vmebVOvh+qBa7Dh+PsHMosdEMXXqP+UH
|
2293 |
-
0quhJZb25uSgXTcYOWEAM11G1ADEtMo88aKjPvM6/2kwLkDd9p+cJsmWN63nOaK/6mnbVSKVUyqU
|
2294 |
-
td+tFjiBdWbjxywbk5yqjKPK2Ww8F22c3HxT4CAnQzb5EuE8XL1mv6JpIzi4mWCZDlZTOpx+FIyw
|
2295 |
-
Bm/xhnaQr/2v/pDGj59/i5IjnOcVdo/Vi5QTcmn7K2FjiO/mpF7moxdqWEfLcU8UC17IAggmosvp
|
2296 |
-
r2uKGcfLFFb14dq12fy/czja+eevbqQ34gcnAgMBAAGjggMXMIIDEzASBgNVHRMBAf8ECDAGAQH/
|
2297 |
-
AgEBMDcGA1UdEgQwMC6CD3N1c2NlcnRlLmdvYi52ZaAbBgVghl4CAqASDBBSSUYtRy0yMDAwNDAz
|
2298 |
-
Ni0wMB0GA1UdDgQWBBRBDxk4qpl/Qguk1yeYVKIXTC1RVDCCAVAGA1UdIwSCAUcwggFDgBStuyId
|
2299 |
-
xuDSAaj9dlBSk+2YwU2u06GCASakggEiMIIBHjE+MDwGA1UEAxM1QXV0b3JpZGFkIGRlIENlcnRp
|
2300 |
-
ZmljYWNpb24gUmFpeiBkZWwgRXN0YWRvIFZlbmV6b2xhbm8xCzAJBgNVBAYTAlZFMRAwDgYDVQQH
|
2301 |
-
EwdDYXJhY2FzMRkwFwYDVQQIExBEaXN0cml0byBDYXBpdGFsMTYwNAYDVQQKEy1TaXN0ZW1hIE5h
|
2302 |
-
Y2lvbmFsIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExQzBBBgNVBAsTOlN1cGVyaW50ZW5k
|
2303 |
-
ZW5jaWEgZGUgU2VydmljaW9zIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExJTAjBgkqhkiG
|
2304 |
-
9w0BCQEWFmFjcmFpekBzdXNjZXJ0ZS5nb2IudmWCAQowDgYDVR0PAQH/BAQDAgEGME0GA1UdEQRG
|
2305 |
-
MESCDnByb2NlcnQubmV0LnZloBUGBWCGXgIBoAwMClBTQy0wMDAwMDKgGwYFYIZeAgKgEgwQUklG
|
2306 |
-
LUotMzE2MzUzNzMtNzB2BgNVHR8EbzBtMEagRKBChkBodHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52
|
2307 |
-
ZS9sY3IvQ0VSVElGSUNBRE8tUkFJWi1TSEEzODRDUkxERVIuY3JsMCOgIaAfhh1sZGFwOi8vYWNy
|
2308 |
-
YWl6LnN1c2NlcnRlLmdvYi52ZTA3BggrBgEFBQcBAQQrMCkwJwYIKwYBBQUHMAGGG2h0dHA6Ly9v
|
2309 |
-
Y3NwLnN1c2NlcnRlLmdvYi52ZTBBBgNVHSAEOjA4MDYGBmCGXgMBAjAsMCoGCCsGAQUFBwIBFh5o
|
2310 |
-
dHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52ZS9kcGMwDQYJKoZIhvcNAQELBQADggIBACtZ6yKZu4Sq
|
2311 |
-
T96QxtGGcSOeSwORR3C7wJJg7ODU523G0+1ng3dS1fLld6c2suNUvtm7CpsR72H0xpkzmfWvADmN
|
2312 |
-
g7+mvTV+LFwxNG9s2/NkAZiqlCxB3RWGymspThbASfzXg0gTB1GEMVKIu4YXx2sviiCtxQuPcD4q
|
2313 |
-
uxtxj7mkoP3YldmvWb8lK5jpY5MvYB7Eqvh39YtsL+1+LrVPQA3uvFd359m21D+VJzog1eWuq2w1
|
2314 |
-
n8GhHVnchIHuTQfiSLaeS5UtQbHh6N5+LwUeaO6/u5BlOsju6rEYNxxik6SgMexxbJHmpHmJWhSn
|
2315 |
-
FFAFTKQAVzAswbVhltw+HoSvOULP5dAssSS830DD7X9jSr3hTxJkhpXzsOfIt+FTvZLm8wyWuevo
|
2316 |
-
5pLtp4EJFAv8lXrPj9Y0TzYS3F7RNHXGRoAvlQSMx4bEqCaJqD8Zm4G7UaRKhqsLEQ+xrmNTbSjq
|
2317 |
-
3TNWOByyrYDT13K9mmyZY+gAu0F2BbdbmRiKw7gSXFbPVgx96OLP7bx0R/vu0xdOIk9W/1DzLuY5
|
2318 |
-
poLWccret9W6aAjtmcz9opLLabid+Qqkpj5PkygqYWwHJgD/ll9ohri4zspV4KuxPX+Y1zMOWj3Y
|
2319 |
-
eMLEYC/HYvBhkdI4sPaeVdtAgAUSM84dkpvRabP/v/GSCmE1P93+hvS84Bpxs2Km
|
2320 |
-
-----END CERTIFICATE-----
|
2321 |
-
|
2322 |
-
CA Disig Root R1
|
2323 |
-
================
|
2324 |
-
-----BEGIN CERTIFICATE-----
|
2325 |
-
MIIFaTCCA1GgAwIBAgIJAMMDmu5QkG4oMA0GCSqGSIb3DQEBBQUAMFIxCzAJBgNVBAYTAlNLMRMw
|
2326 |
-
EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
|
2327 |
-
ZyBSb290IFIxMB4XDTEyMDcxOTA5MDY1NloXDTQyMDcxOTA5MDY1NlowUjELMAkGA1UEBhMCU0sx
|
2328 |
-
EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
|
2329 |
-
c2lnIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCqw3j33Jijp1pedxiy
|
2330 |
-
3QRkD2P9m5YJgNXoqqXinCaUOuiZc4yd39ffg/N4T0Dhf9Kn0uXKE5Pn7cZ3Xza1lK/oOI7bm+V8
|
2331 |
-
u8yN63Vz4STN5qctGS7Y1oprFOsIYgrY3LMATcMjfF9DCCMyEtztDK3AfQ+lekLZWnDZv6fXARz2
|
2332 |
-
m6uOt0qGeKAeVjGu74IKgEH3G8muqzIm1Cxr7X1r5OJeIgpFy4QxTaz+29FHuvlglzmxZcfe+5nk
|
2333 |
-
CiKxLU3lSCZpq+Kq8/v8kiky6bM+TR8noc2OuRf7JT7JbvN32g0S9l3HuzYQ1VTW8+DiR0jm3hTa
|
2334 |
-
YVKvJrT1cU/J19IG32PK/yHoWQbgCNWEFVP3Q+V8xaCJmGtzxmjOZd69fwX3se72V6FglcXM6pM6
|
2335 |
-
vpmumwKjrckWtc7dXpl4fho5frLABaTAgqWjR56M6ly2vGfb5ipN0gTco65F97yLnByn1tUD3AjL
|
2336 |
-
LhbKXEAz6GfDLuemROoRRRw1ZS0eRWEkG4IupZ0zXWX4Qfkuy5Q/H6MMMSRE7cderVC6xkGbrPAX
|
2337 |
-
ZcD4XW9boAo0PO7X6oifmPmvTiT6l7Jkdtqr9O3jw2Dv1fkCyC2fg69naQanMVXVz0tv/wQFx1is
|
2338 |
-
XxYb5dKj6zHbHzMVTdDypVP1y+E9Tmgt2BLdqvLmTZtJ5cUoobqwWsagtQIDAQABo0IwQDAPBgNV
|
2339 |
-
HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUiQq0OJMa5qvum5EY+fU8PjXQ
|
2340 |
-
04IwDQYJKoZIhvcNAQEFBQADggIBADKL9p1Kyb4U5YysOMo6CdQbzoaz3evUuii+Eq5FLAR0rBNR
|
2341 |
-
xVgYZk2C2tXck8An4b58n1KeElb21Zyp9HWc+jcSjxyT7Ff+Bw+r1RL3D65hXlaASfX8MPWbTx9B
|
2342 |
-
LxyE04nH4toCdu0Jz2zBuByDHBb6lM19oMgY0sidbvW9adRtPTXoHqJPYNcHKfyyo6SdbhWSVhlM
|
2343 |
-
CrDpfNIZTUJG7L399ldb3Zh+pE3McgODWF3vkzpBemOqfDqo9ayk0d2iLbYq/J8BjuIQscTK5Gfb
|
2344 |
-
VSUZP/3oNn6z4eGBrxEWi1CXYBmCAMBrTXO40RMHPuq2MU/wQppt4hF05ZSsjYSVPCGvxdpHyN85
|
2345 |
-
YmLLW1AL14FABZyb7bq2ix4Eb5YgOe2kfSnbSM6C3NQCjR0EMVrHS/BsYVLXtFHCgWzN4funodKS
|
2346 |
-
ds+xDzdYpPJScWc/DIh4gInByLUfkmO+p3qKViwaqKactV2zY9ATIKHrkWzQjX2v3wvkF7mGnjix
|
2347 |
-
lAxYjOBVqjtjbZqJYLhkKpLGN/R+Q0O3c+gB53+XD9fyexn9GtePyfqFa3qdnom2piiZk4hA9z7N
|
2348 |
-
UaPK6u95RyG1/jLix8NRb76AdPCkwzryT+lf3xkK8jsTQ6wxpLPn6/wY1gGp8yqPNg7rtLG8t0zJ
|
2349 |
-
a7+h89n07eLw4+1knj0vllJPgFOL
|
2350 |
-
-----END CERTIFICATE-----
|
2351 |
-
|
2352 |
CA Disig Root R2
|
2353 |
================
|
2354 |
-----BEGIN CERTIFICATE-----
|
@@ -2752,66 +2331,6 @@ G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
|
|
2752 |
82Z+
|
2753 |
-----END CERTIFICATE-----
|
2754 |
|
2755 |
-
WoSign
|
2756 |
-
======
|
2757 |
-
-----BEGIN CERTIFICATE-----
|
2758 |
-
MIIFdjCCA16gAwIBAgIQXmjWEXGUY1BWAGjzPsnFkTANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQG
|
2759 |
-
EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxKjAoBgNVBAMTIUNlcnRpZmljYXRpb24g
|
2760 |
-
QXV0aG9yaXR5IG9mIFdvU2lnbjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMFUxCzAJ
|
2761 |
-
BgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEqMCgGA1UEAxMhQ2VydGlmaWNh
|
2762 |
-
dGlvbiBBdXRob3JpdHkgb2YgV29TaWduMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA
|
2763 |
-
vcqNrLiRFVaXe2tcesLea9mhsMMQI/qnobLMMfo+2aYpbxY94Gv4uEBf2zmoAHqLoE1UfcIiePyO
|
2764 |
-
CbiohdfMlZdLdNiefvAA5A6JrkkoRBoQmTIPJYhTpA2zDxIIFgsDcSccf+Hb0v1naMQFXQoOXXDX
|
2765 |
-
2JegvFNBmpGN9J42Znp+VsGQX+axaCA2pIwkLCxHC1l2ZjC1vt7tj/id07sBMOby8w7gLJKA84X5
|
2766 |
-
KIq0VC6a7fd2/BVoFutKbOsuEo/Uz/4Mx1wdC34FMr5esAkqQtXJTpCzWQ27en7N1QhatH/YHGkR
|
2767 |
-
+ScPewavVIMYe+HdVHpRaG53/Ma/UkpmRqGyZxq7o093oL5d//xWC0Nyd5DKnvnyOfUNqfTq1+ez
|
2768 |
-
EC8wQjchzDBwyYaYD8xYTYO7feUapTeNtqwylwA6Y3EkHp43xP901DfA4v6IRmAR3Qg/UDaruHqk
|
2769 |
-
lWJqbrDKaiFaafPz+x1wOZXzp26mgYmhiMU7ccqjUu6Du/2gd/Tkb+dC221KmYo0SLwX3OSACCK2
|
2770 |
-
8jHAPwQ+658geda4BmRkAjHXqc1S+4RFaQkAKtxVi8QGRkvASh0JWzko/amrzgD5LkhLJuYwTKVY
|
2771 |
-
yrREgk/nkR4zw7CT/xH8gdLKH3Ep3XZPkiWvHYG3Dy+MwwbMLyejSuQOmbp8HkUff6oZRZb9/D0C
|
2772 |
-
AwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFOFmzw7R
|
2773 |
-
8bNLtwYgFP6HEtX2/vs+MA0GCSqGSIb3DQEBBQUAA4ICAQCoy3JAsnbBfnv8rWTjMnvMPLZdRtP1
|
2774 |
-
LOJwXcgu2AZ9mNELIaCJWSQBnfmvCX0KI4I01fx8cpm5o9dU9OpScA7F9dY74ToJMuYhOZO9sxXq
|
2775 |
-
T2r09Ys/L3yNWC7F4TmgPsc9SnOeQHrAK2GpZ8nzJLmzbVUsWh2eJXLOC62qx1ViC777Y7NhRCOj
|
2776 |
-
y+EaDveaBk3e1CNOIZZbOVtXHS9dCF4Jef98l7VNg64N1uajeeAz0JmWAjCnPv/So0M/BVoG6kQC
|
2777 |
-
2nz4SNAzqfkHx5Xh9T71XXG68pWpdIhhWeO/yloTunK0jF02h+mmxTwTv97QRCbut+wucPrXnbes
|
2778 |
-
5cVAWubXbHssw1abR80LzvobtCHXt2a49CUwi1wNuepnsvRtrtWhnk/Yn+knArAdBtaP4/tIEp9/
|
2779 |
-
EaEQPkxROpaw0RPxx9gmrjrKkcRpnd8BKWRRb2jaFOwIQZeQjdCygPLPwj2/kWjFgGcexGATVdVh
|
2780 |
-
mVd8upUPYUk6ynW8yQqTP2cOEvIo4jEbwFcW3wh8GcF+Dx+FHgo2fFt+J7x6v+Db9NpSvd4MVHAx
|
2781 |
-
kUOVyLzwPt0JfjBkUO1/AaQzZ01oT74V77D2AhGiGxMlOtzCWfHjXEa7ZywCRuoeSKbmW9m1vFGi
|
2782 |
-
kpbbqsY3Iqb+zCB0oy2pLmvLwIIRIbWTee5Ehr7XHuQe+w==
|
2783 |
-
-----END CERTIFICATE-----
|
2784 |
-
|
2785 |
-
WoSign China
|
2786 |
-
============
|
2787 |
-
-----BEGIN CERTIFICATE-----
|
2788 |
-
MIIFWDCCA0CgAwIBAgIQUHBrzdgT/BtOOzNy0hFIjTANBgkqhkiG9w0BAQsFADBGMQswCQYDVQQG
|
2789 |
-
EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMMEkNBIOayg+mAmuagueiv
|
2790 |
-
geS5pjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMEYxCzAJBgNVBAYTAkNOMRowGAYD
|
2791 |
-
VQQKExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAwwSQ0Eg5rKD6YCa5qC56K+B5LmmMIICIjAN
|
2792 |
-
BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0EkhHiX8h8EqwqzbdoYGTufQdDTc7WU1/FDWiD+k
|
2793 |
-
8H/rD195L4mx/bxjWDeTmzj4t1up+thxx7S8gJeNbEvxUNUqKaqoGXqW5pWOdO2XCld19AXbbQs5
|
2794 |
-
uQF/qvbW2mzmBeCkTVL829B0txGMe41P/4eDrv8FAxNXUDf+jJZSEExfv5RxadmWPgxDT74wwJ85
|
2795 |
-
dE8GRV2j1lY5aAfMh09Qd5Nx2UQIsYo06Yms25tO4dnkUkWMLhQfkWsZHWgpLFbE4h4TV2TwYeO5
|
2796 |
-
Ed+w4VegG63XX9Gv2ystP9Bojg/qnw+LNVgbExz03jWhCl3W6t8Sb8D7aQdGctyB9gQjF+BNdeFy
|
2797 |
-
b7Ao65vh4YOhn0pdr8yb+gIgthhid5E7o9Vlrdx8kHccREGkSovrlXLp9glk3Kgtn3R46MGiCWOc
|
2798 |
-
76DbT52VqyBPt7D3h1ymoOQ3OMdc4zUPLK2jgKLsLl3Az+2LBcLmc272idX10kaO6m1jGx6KyX2m
|
2799 |
-
+Jzr5dVjhU1zZmkR/sgO9MHHZklTfuQZa/HpelmjbX7FF+Ynxu8b22/8DU0GAbQOXDBGVWCvOGU6
|
2800 |
-
yke6rCzMRh+yRpY/8+0mBe53oWprfi1tWFxK1I5nuPHa1UaKJ/kR8slC/k7e3x9cxKSGhxYzoacX
|
2801 |
-
GKUN5AXlK8IrC6KVkLn9YDxOiT7nnO4fuwECAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1Ud
|
2802 |
-
EwEB/wQFMAMBAf8wHQYDVR0OBBYEFOBNv9ybQV0T6GTwp+kVpOGBwboxMA0GCSqGSIb3DQEBCwUA
|
2803 |
-
A4ICAQBqinA4WbbaixjIvirTthnVZil6Xc1bL3McJk6jfW+rtylNpumlEYOnOXOvEESS5iVdT2H6
|
2804 |
-
yAa+Tkvv/vMx/sZ8cApBWNromUuWyXi8mHwCKe0JgOYKOoICKuLJL8hWGSbueBwj/feTZU7n85iY
|
2805 |
-
r83d2Z5AiDEoOqsuC7CsDCT6eiaY8xJhEPRdF/d+4niXVOKM6Cm6jBAyvd0zaziGfjk9DgNyp115
|
2806 |
-
j0WKWa5bIW4xRtVZjc8VX90xJc/bYNaBRHIpAlf2ltTW/+op2znFuCyKGo3Oy+dCMYYFaA6eFN0A
|
2807 |
-
kLppRQjbbpCBhqcqBT/mhDn4t/lXX0ykeVoQDF7Va/81XwVRHmyjdanPUIPTfPRm94KNPQx96N97
|
2808 |
-
qA4bLJyuQHCH2u2nFoJavjVsIE4iYdm8UXrNemHcSxH5/mc0zy4EZmFcV5cjjPOGG0jfKq+nwf/Y
|
2809 |
-
jj4Du9gqsPoUJbJRa4ZDhS4HIxaAjUz7tGM7zMN07RujHv41D198HRaG9Q7DlfEvr10lO1Hm13ZB
|
2810 |
-
ONFLAzkopR6RctR9q5czxNM+4Gm2KHmgCY0c0f9BckgG/Jou5yD5m6Leie2uPAmvylezkolwQOQv
|
2811 |
-
T8Jwg0DXJCxr5wkf09XHwQj02w47HAcLQxGEIYbpgNR12KvxAmLBsX5VYc8T1yaw15zLKYs4SgsO
|
2812 |
-
kI26oQ==
|
2813 |
-
-----END CERTIFICATE-----
|
2814 |
-
|
2815 |
COMODO RSA Certification Authority
|
2816 |
==================================
|
2817 |
-----BEGIN CERTIFICATE-----
|
@@ -3193,42 +2712,6 @@ HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
|
|
3193 |
Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
|
3194 |
-----END CERTIFICATE-----
|
3195 |
|
3196 |
-
Certification Authority of WoSign G2
|
3197 |
-
====================================
|
3198 |
-
-----BEGIN CERTIFICATE-----
|
3199 |
-
MIIDfDCCAmSgAwIBAgIQayXaioidfLwPBbOxemFFRDANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQG
|
3200 |
-
EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxLTArBgNVBAMTJENlcnRpZmljYXRpb24g
|
3201 |
-
QXV0aG9yaXR5IG9mIFdvU2lnbiBHMjAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMFgx
|
3202 |
-
CzAJBgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEtMCsGA1UEAxMkQ2VydGlm
|
3203 |
-
aWNhdGlvbiBBdXRob3JpdHkgb2YgV29TaWduIEcyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
|
3204 |
-
CgKCAQEAvsXEoCKASU+/2YcRxlPhuw+9YH+v9oIOH9ywjj2X4FA8jzrvZjtFB5sg+OPXJYY1kBai
|
3205 |
-
XW8wGQiHC38Gsp1ij96vkqVg1CuAmlI/9ZqD6TRay9nVYlzmDuDfBpgOgHzKtB0TiGsOqCR3A9Du
|
3206 |
-
W/PKaZE1OVbFbeP3PU9ekzgkyhjpJMuSA93MHD0JcOQg5PGurLtzaaNjOg9FD6FKmsLRY6zLEPg9
|
3207 |
-
5k4ot+vElbGs/V6r+kHLXZ1L3PR8du9nfwB6jdKgGlxNIuG12t12s9R23164i5jIFFTMaxeSt+BK
|
3208 |
-
v0mUYQs4kI9dJGwlezt52eJ+na2fmKEG/HgUYFf47oB3sQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
|
3209 |
-
AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU+mCp62XF3RYUCE4MD42b4Pdkr2cwDQYJKoZI
|
3210 |
-
hvcNAQELBQADggEBAFfDejaCnI2Y4qtAqkePx6db7XznPWZaOzG73/MWM5H8fHulwqZm46qwtyeY
|
3211 |
-
P0nXYGdnPzZPSsvxFPpahygc7Y9BMsaV+X3avXtbwrAh449G3CE4Q3RM+zD4F3LBMvzIkRfEzFg3
|
3212 |
-
TgvMWvchNSiDbGAtROtSjFA9tWwS1/oJu2yySrHFieT801LYYRf+epSEj3m2M1m6D8QL4nCgS3gu
|
3213 |
-
+sif/a+RZQp4OBXllxcU3fngLDT4ONCEIgDAFFEYKwLcMFrw6AF8NTojrwjkr6qOKEJJLvD1mTS+
|
3214 |
-
7Q9LGOHSJDy7XUe3IfKN0QqZjuNuPq1w4I+5ysxugTH2e5x6eeRncRg=
|
3215 |
-
-----END CERTIFICATE-----
|
3216 |
-
|
3217 |
-
CA WoSign ECC Root
|
3218 |
-
==================
|
3219 |
-
-----BEGIN CERTIFICATE-----
|
3220 |
-
MIICCTCCAY+gAwIBAgIQaEpYcIBr8I8C+vbe6LCQkDAKBggqhkjOPQQDAzBGMQswCQYDVQQGEwJD
|
3221 |
-
TjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMTEkNBIFdvU2lnbiBFQ0MgUm9v
|
3222 |
-
dDAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMEYxCzAJBgNVBAYTAkNOMRowGAYDVQQK
|
3223 |
-
ExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAxMSQ0EgV29TaWduIEVDQyBSb290MHYwEAYHKoZI
|
3224 |
-
zj0CAQYFK4EEACIDYgAE4f2OuEMkq5Z7hcK6C62N4DrjJLnSsb6IOsq/Srj57ywvr1FQPEd1bPiU
|
3225 |
-
t5v8KB7FVMxjnRZLU8HnIKvNrCXSf4/CwVqCXjCLelTOA7WRf6qU0NGKSMyCBSah1VES1ns2o0Iw
|
3226 |
-
QDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUqv3VWqP2h4syhf3R
|
3227 |
-
MluARZPzA7gwCgYIKoZIzj0EAwMDaAAwZQIxAOSkhLCB1T2wdKyUpOgOPQB0TKGXa/kNUTyh2Tv0
|
3228 |
-
Daupn75OcsqF1NnstTJFGG+rrQIwfcf3aWMvoeGY7xMQ0Xk/0f7qO3/eVvSQsRUR2LIiFdAvwyYu
|
3229 |
-
a/GRspBl9JrmkO5K
|
3230 |
-
-----END CERTIFICATE-----
|
3231 |
-
|
3232 |
SZAFIR ROOT CA2
|
3233 |
===============
|
3234 |
-----BEGIN CERTIFICATE-----
|
@@ -3644,3 +3127,212 @@ lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
|
|
3644 |
e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
|
3645 |
q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
|
3646 |
-----END CERTIFICATE-----
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
##
|
2 |
## Bundle of CA Root Certificates
|
3 |
##
|
4 |
+
## Certificate data from Mozilla as of: Wed Mar 7 04:12:06 2018 GMT
|
5 |
##
|
6 |
## This is a bundle of X.509 certificates of public Certificate Authorities
|
7 |
## (CA). These were automatically extracted from Mozilla's root certificates
|
14 |
## Just configure this file as the SSLCACertificateFile.
|
15 |
##
|
16 |
## Conversion done with mk-ca-bundle.pl version 1.27.
|
17 |
+
## SHA256: 704f02707ec6b4c4a7597a8c6039b020def11e64f3ef0605a9c3543d48038a57
|
18 |
##
|
19 |
|
20 |
|
283 |
398znM/jra6O1I7mT1GvFpLgXPYHDw==
|
284 |
-----END CERTIFICATE-----
|
285 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
286 |
Comodo AAA Services root
|
287 |
========================
|
288 |
-----BEGIN CERTIFICATE-----
|
446 |
llpwrN9M
|
447 |
-----END CERTIFICATE-----
|
448 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
XRamp Global CA Root
|
450 |
====================
|
451 |
-----BEGIN CERTIFICATE-----
|
518 |
QBFGmh95DmK/D5fs4C8fF5Q=
|
519 |
-----END CERTIFICATE-----
|
520 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
Taiwan GRCA
|
522 |
===========
|
523 |
-----BEGIN CERTIFICATE-----
|
656 |
fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
|
657 |
-----END CERTIFICATE-----
|
658 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
659 |
SwissSign Gold CA - G2
|
660 |
======================
|
661 |
-----BEGIN CERTIFICATE-----
|
898 |
U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
|
899 |
-----END CERTIFICATE-----
|
900 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
901 |
OISTE WISeKey Global Root GA CA
|
902 |
===============================
|
903 |
-----BEGIN CERTIFICATE-----
|
1018 |
BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
|
1019 |
-----END CERTIFICATE-----
|
1020 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1021 |
certSIGN ROOT CA
|
1022 |
================
|
1023 |
-----BEGIN CERTIFICATE-----
|
1265 |
lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
|
1266 |
-----END CERTIFICATE-----
|
1267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1268 |
Microsec e-Szigno Root CA 2009
|
1269 |
==============================
|
1270 |
-----BEGIN CERTIFICATE-----
|
1625 |
03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
|
1626 |
-----END CERTIFICATE-----
|
1627 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1628 |
TWCA Root Certification Authority
|
1629 |
=================================
|
1630 |
-----BEGIN CERTIFICATE-----
|
1773 |
iB6XzCGcKQENZetX2fNXlrtIzYE=
|
1774 |
-----END CERTIFICATE-----
|
1775 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1776 |
Buypass Class 2 Root CA
|
1777 |
=======================
|
1778 |
-----BEGIN CERTIFICATE-----
|
1879 |
dcGWxZ0=
|
1880 |
-----END CERTIFICATE-----
|
1881 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1882 |
D-TRUST Root Class 3 CA 2 2009
|
1883 |
==============================
|
1884 |
-----BEGIN CERTIFICATE-----
|
1928 |
w9y4AyHqnxbxLFS1
|
1929 |
-----END CERTIFICATE-----
|
1930 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1931 |
CA Disig Root R2
|
1932 |
================
|
1933 |
-----BEGIN CERTIFICATE-----
|
2331 |
82Z+
|
2332 |
-----END CERTIFICATE-----
|
2333 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2334 |
COMODO RSA Certification Authority
|
2335 |
==================================
|
2336 |
-----BEGIN CERTIFICATE-----
|
2712 |
Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
|
2713 |
-----END CERTIFICATE-----
|
2714 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2715 |
SZAFIR ROOT CA2
|
2716 |
===============
|
2717 |
-----BEGIN CERTIFICATE-----
|
3127 |
e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
|
3128 |
q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
|
3129 |
-----END CERTIFICATE-----
|
3130 |
+
|
3131 |
+
GDCA TrustAUTH R5 ROOT
|
3132 |
+
======================
|
3133 |
+
-----BEGIN CERTIFICATE-----
|
3134 |
+
MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
|
3135 |
+
BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
|
3136 |
+
DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
|
3137 |
+
YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
|
3138 |
+
IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
|
3139 |
+
AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
|
3140 |
+
AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
|
3141 |
+
OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
|
3142 |
+
pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
|
3143 |
+
9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
|
3144 |
+
xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
|
3145 |
+
R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
|
3146 |
+
D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
|
3147 |
+
oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
|
3148 |
+
9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
|
3149 |
+
MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
|
3150 |
+
p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
|
3151 |
+
H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
|
3152 |
+
6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
|
3153 |
+
+PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
|
3154 |
+
HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
|
3155 |
+
F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
|
3156 |
+
8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
|
3157 |
+
/EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
|
3158 |
+
aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
|
3159 |
+
-----END CERTIFICATE-----
|
3160 |
+
|
3161 |
+
TrustCor RootCert CA-1
|
3162 |
+
======================
|
3163 |
+
-----BEGIN CERTIFICATE-----
|
3164 |
+
MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
|
3165 |
+
MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
|
3166 |
+
U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
|
3167 |
+
dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
|
3168 |
+
MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
|
3169 |
+
YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
|
3170 |
+
VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
|
3171 |
+
dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
|
3172 |
+
jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
|
3173 |
+
pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
|
3174 |
+
JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
|
3175 |
+
gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
|
3176 |
+
/Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
|
3177 |
+
BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
|
3178 |
+
AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
|
3179 |
+
mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
|
3180 |
+
ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
|
3181 |
+
qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
|
3182 |
+
3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
|
3183 |
+
-----END CERTIFICATE-----
|
3184 |
+
|
3185 |
+
TrustCor RootCert CA-2
|
3186 |
+
======================
|
3187 |
+
-----BEGIN CERTIFICATE-----
|
3188 |
+
MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
|
3189 |
+
DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
|
3190 |
+
eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
|
3191 |
+
eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
|
3192 |
+
MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
|
3193 |
+
bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
|
3194 |
+
cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
|
3195 |
+
IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
|
3196 |
+
ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
|
3197 |
+
RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
|
3198 |
+
oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
|
3199 |
+
XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
|
3200 |
+
/p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
|
3201 |
+
jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
|
3202 |
+
eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
|
3203 |
+
rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
|
3204 |
+
8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
|
3205 |
+
2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
|
3206 |
+
VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
|
3207 |
+
Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
|
3208 |
+
kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
|
3209 |
+
2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
|
3210 |
+
S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
|
3211 |
+
PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
|
3212 |
+
DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
|
3213 |
+
RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
|
3214 |
+
xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
|
3215 |
+
RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
|
3216 |
+
-----END CERTIFICATE-----
|
3217 |
+
|
3218 |
+
TrustCor ECA-1
|
3219 |
+
==============
|
3220 |
+
-----BEGIN CERTIFICATE-----
|
3221 |
+
MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
|
3222 |
+
MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
|
3223 |
+
U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
|
3224 |
+
dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
|
3225 |
+
N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
|
3226 |
+
MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
|
3227 |
+
IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
|
3228 |
+
SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
|
3229 |
+
MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
|
3230 |
+
xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
|
3231 |
+
p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
|
3232 |
+
fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
|
3233 |
+
YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
|
3234 |
+
f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
|
3235 |
+
AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
|
3236 |
+
/ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
|
3237 |
+
hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
|
3238 |
+
J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
|
3239 |
+
jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
|
3240 |
+
-----END CERTIFICATE-----
|
3241 |
+
|
3242 |
+
SSL.com Root Certification Authority RSA
|
3243 |
+
========================================
|
3244 |
+
-----BEGIN CERTIFICATE-----
|
3245 |
+
MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
|
3246 |
+
BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
|
3247 |
+
MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
|
3248 |
+
MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
|
3249 |
+
EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
|
3250 |
+
LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
|
3251 |
+
ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
|
3252 |
+
Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
|
3253 |
+
P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
|
3254 |
+
oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
|
3255 |
+
k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
|
3256 |
+
fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
|
3257 |
+
gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
|
3258 |
+
UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
|
3259 |
+
1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
|
3260 |
+
bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
|
3261 |
+
HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
|
3262 |
+
AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
|
3263 |
+
dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
|
3264 |
+
ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
|
3265 |
+
u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
|
3266 |
+
erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
|
3267 |
+
MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
|
3268 |
+
vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
|
3269 |
+
Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
|
3270 |
+
wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
|
3271 |
+
WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
|
3272 |
+
-----END CERTIFICATE-----
|
3273 |
+
|
3274 |
+
SSL.com Root Certification Authority ECC
|
3275 |
+
========================================
|
3276 |
+
-----BEGIN CERTIFICATE-----
|
3277 |
+
MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
|
3278 |
+
BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
|
3279 |
+
BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
|
3280 |
+
MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
|
3281 |
+
BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
|
3282 |
+
bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
|
3283 |
+
BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
|
3284 |
+
8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
|
3285 |
+
hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
|
3286 |
+
jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
|
3287 |
+
e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
|
3288 |
+
5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
|
3289 |
+
-----END CERTIFICATE-----
|
3290 |
+
|
3291 |
+
SSL.com EV Root Certification Authority RSA R2
|
3292 |
+
==============================================
|
3293 |
+
-----BEGIN CERTIFICATE-----
|
3294 |
+
MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
|
3295 |
+
DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
|
3296 |
+
MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
|
3297 |
+
MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
|
3298 |
+
DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
|
3299 |
+
VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
|
3300 |
+
BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
|
3301 |
+
hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
|
3302 |
+
cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
|
3303 |
+
Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
|
3304 |
+
B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
|
3305 |
+
CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
|
3306 |
+
9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
|
3307 |
+
RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
|
3308 |
+
JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
|
3309 |
+
+qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
|
3310 |
+
HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
|
3311 |
+
qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
|
3312 |
+
++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
|
3313 |
+
Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
|
3314 |
+
guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
|
3315 |
+
OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
|
3316 |
+
CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
|
3317 |
+
lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
|
3318 |
+
rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
|
3319 |
+
hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
|
3320 |
+
9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
|
3321 |
+
-----END CERTIFICATE-----
|
3322 |
+
|
3323 |
+
SSL.com EV Root Certification Authority ECC
|
3324 |
+
===========================================
|
3325 |
+
-----BEGIN CERTIFICATE-----
|
3326 |
+
MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
|
3327 |
+
BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
|
3328 |
+
BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
|
3329 |
+
MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
|
3330 |
+
EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
|
3331 |
+
LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
|
3332 |
+
BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
|
3333 |
+
3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
|
3334 |
+
BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
|
3335 |
+
5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
|
3336 |
+
N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
|
3337 |
+
m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
|
3338 |
+
-----END CERTIFICATE-----
|
vendor/composer/installed.json
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
[
|
2 |
{
|
3 |
"name": "composer/ca-bundle",
|
4 |
-
"version": "1.1.
|
5 |
-
"version_normalized": "1.1.
|
6 |
"source": {
|
7 |
"type": "git",
|
8 |
"url": "https://github.com/composer/ca-bundle.git",
|
9 |
-
"reference": "
|
10 |
},
|
11 |
"dist": {
|
12 |
"type": "zip",
|
13 |
-
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/
|
14 |
-
"reference": "
|
15 |
"shasum": ""
|
16 |
},
|
17 |
"require": {
|
@@ -20,11 +20,11 @@
|
|
20 |
"php": "^5.3.2 || ^7.0"
|
21 |
},
|
22 |
"require-dev": {
|
23 |
-
"phpunit/phpunit": "^4.8.35",
|
24 |
"psr/log": "^1.0",
|
25 |
"symfony/process": "^2.5 || ^3.0 || ^4.0"
|
26 |
},
|
27 |
-
"time": "
|
28 |
"type": "library",
|
29 |
"extra": {
|
30 |
"branch-alias": {
|
@@ -59,17 +59,17 @@
|
|
59 |
},
|
60 |
{
|
61 |
"name": "maxmind/web-service-common",
|
62 |
-
"version": "v0.
|
63 |
-
"version_normalized": "0.
|
64 |
"source": {
|
65 |
"type": "git",
|
66 |
"url": "https://github.com/maxmind/web-service-common-php.git",
|
67 |
-
"reference": "
|
68 |
},
|
69 |
"dist": {
|
70 |
"type": "zip",
|
71 |
-
"url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/
|
72 |
-
"reference": "
|
73 |
"shasum": ""
|
74 |
},
|
75 |
"require": {
|
@@ -83,7 +83,7 @@
|
|
83 |
"phpunit/phpunit": "4.*",
|
84 |
"squizlabs/php_codesniffer": "3.*"
|
85 |
},
|
86 |
-
"time": "
|
87 |
"type": "library",
|
88 |
"installation-source": "dist",
|
89 |
"autoload": {
|
@@ -107,17 +107,17 @@
|
|
107 |
},
|
108 |
{
|
109 |
"name": "maxmind-db/reader",
|
110 |
-
"version": "v1.
|
111 |
-
"version_normalized": "1.
|
112 |
"source": {
|
113 |
"type": "git",
|
114 |
"url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
|
115 |
-
"reference": "
|
116 |
},
|
117 |
"dist": {
|
118 |
"type": "zip",
|
119 |
-
"url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/
|
120 |
-
"reference": "
|
121 |
"shasum": ""
|
122 |
},
|
123 |
"require": {
|
@@ -125,7 +125,7 @@
|
|
125 |
},
|
126 |
"require-dev": {
|
127 |
"friendsofphp/php-cs-fixer": "2.*",
|
128 |
-
"phpunit/phpunit": "4.*",
|
129 |
"satooshi/php-coveralls": "1.0.*",
|
130 |
"squizlabs/php_codesniffer": "3.*"
|
131 |
},
|
@@ -134,7 +134,7 @@
|
|
134 |
"ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
|
135 |
"ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
|
136 |
},
|
137 |
-
"time": "
|
138 |
"type": "library",
|
139 |
"installation-source": "dist",
|
140 |
"autoload": {
|
@@ -165,31 +165,30 @@
|
|
165 |
},
|
166 |
{
|
167 |
"name": "geoip2/geoip2",
|
168 |
-
"version": "v2.
|
169 |
-
"version_normalized": "2.
|
170 |
"source": {
|
171 |
"type": "git",
|
172 |
"url": "https://github.com/maxmind/GeoIP2-php.git",
|
173 |
-
"reference": "
|
174 |
},
|
175 |
"dist": {
|
176 |
"type": "zip",
|
177 |
-
"url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/
|
178 |
-
"reference": "
|
179 |
"shasum": ""
|
180 |
},
|
181 |
"require": {
|
182 |
"maxmind-db/reader": "~1.0",
|
183 |
-
"maxmind/web-service-common": "~0.
|
184 |
"php": ">=5.4"
|
185 |
},
|
186 |
"require-dev": {
|
187 |
-
"apigen/apigen": "*",
|
188 |
"friendsofphp/php-cs-fixer": "2.*",
|
189 |
"phpunit/phpunit": "4.*",
|
190 |
"squizlabs/php_codesniffer": "3.*"
|
191 |
},
|
192 |
-
"time": "
|
193 |
"type": "library",
|
194 |
"installation-source": "dist",
|
195 |
"autoload": {
|
@@ -217,5 +216,53 @@
|
|
217 |
"geolocation",
|
218 |
"maxmind"
|
219 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
}
|
221 |
]
|
1 |
[
|
2 |
{
|
3 |
"name": "composer/ca-bundle",
|
4 |
+
"version": "1.1.1",
|
5 |
+
"version_normalized": "1.1.1.0",
|
6 |
"source": {
|
7 |
"type": "git",
|
8 |
"url": "https://github.com/composer/ca-bundle.git",
|
9 |
+
"reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169"
|
10 |
},
|
11 |
"dist": {
|
12 |
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/d2c0a83b7533d6912e8d516756ebd34f893e9169",
|
14 |
+
"reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169",
|
15 |
"shasum": ""
|
16 |
},
|
17 |
"require": {
|
20 |
"php": "^5.3.2 || ^7.0"
|
21 |
},
|
22 |
"require-dev": {
|
23 |
+
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5",
|
24 |
"psr/log": "^1.0",
|
25 |
"symfony/process": "^2.5 || ^3.0 || ^4.0"
|
26 |
},
|
27 |
+
"time": "2018-03-29T19:57:20+00:00",
|
28 |
"type": "library",
|
29 |
"extra": {
|
30 |
"branch-alias": {
|
59 |
},
|
60 |
{
|
61 |
"name": "maxmind/web-service-common",
|
62 |
+
"version": "v0.5.0",
|
63 |
+
"version_normalized": "0.5.0.0",
|
64 |
"source": {
|
65 |
"type": "git",
|
66 |
"url": "https://github.com/maxmind/web-service-common-php.git",
|
67 |
+
"reference": "61a9836fa3bb1743ab89752bae5005d71e78c73b"
|
68 |
},
|
69 |
"dist": {
|
70 |
"type": "zip",
|
71 |
+
"url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/61a9836fa3bb1743ab89752bae5005d71e78c73b",
|
72 |
+
"reference": "61a9836fa3bb1743ab89752bae5005d71e78c73b",
|
73 |
"shasum": ""
|
74 |
},
|
75 |
"require": {
|
83 |
"phpunit/phpunit": "4.*",
|
84 |
"squizlabs/php_codesniffer": "3.*"
|
85 |
},
|
86 |
+
"time": "2018-02-12T22:31:54+00:00",
|
87 |
"type": "library",
|
88 |
"installation-source": "dist",
|
89 |
"autoload": {
|
107 |
},
|
108 |
{
|
109 |
"name": "maxmind-db/reader",
|
110 |
+
"version": "v1.3.0",
|
111 |
+
"version_normalized": "1.3.0.0",
|
112 |
"source": {
|
113 |
"type": "git",
|
114 |
"url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
|
115 |
+
"reference": "e042b4f8a2dff41e19019faf16427178b07fbd58"
|
116 |
},
|
117 |
"dist": {
|
118 |
"type": "zip",
|
119 |
+
"url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/e042b4f8a2dff41e19019faf16427178b07fbd58",
|
120 |
+
"reference": "e042b4f8a2dff41e19019faf16427178b07fbd58",
|
121 |
"shasum": ""
|
122 |
},
|
123 |
"require": {
|
125 |
},
|
126 |
"require-dev": {
|
127 |
"friendsofphp/php-cs-fixer": "2.*",
|
128 |
+
"phpunit/phpunit": "4.* || 5.*",
|
129 |
"satooshi/php-coveralls": "1.0.*",
|
130 |
"squizlabs/php_codesniffer": "3.*"
|
131 |
},
|
134 |
"ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
|
135 |
"ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
|
136 |
},
|
137 |
+
"time": "2018-02-21T21:23:33+00:00",
|
138 |
"type": "library",
|
139 |
"installation-source": "dist",
|
140 |
"autoload": {
|
165 |
},
|
166 |
{
|
167 |
"name": "geoip2/geoip2",
|
168 |
+
"version": "v2.9.0",
|
169 |
+
"version_normalized": "2.9.0.0",
|
170 |
"source": {
|
171 |
"type": "git",
|
172 |
"url": "https://github.com/maxmind/GeoIP2-php.git",
|
173 |
+
"reference": "a807fbf65212eef5d8d2db1a1b31082b53633d77"
|
174 |
},
|
175 |
"dist": {
|
176 |
"type": "zip",
|
177 |
+
"url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/a807fbf65212eef5d8d2db1a1b31082b53633d77",
|
178 |
+
"reference": "a807fbf65212eef5d8d2db1a1b31082b53633d77",
|
179 |
"shasum": ""
|
180 |
},
|
181 |
"require": {
|
182 |
"maxmind-db/reader": "~1.0",
|
183 |
+
"maxmind/web-service-common": "~0.5",
|
184 |
"php": ">=5.4"
|
185 |
},
|
186 |
"require-dev": {
|
|
|
187 |
"friendsofphp/php-cs-fixer": "2.*",
|
188 |
"phpunit/phpunit": "4.*",
|
189 |
"squizlabs/php_codesniffer": "3.*"
|
190 |
},
|
191 |
+
"time": "2018-04-10T15:32:59+00:00",
|
192 |
"type": "library",
|
193 |
"installation-source": "dist",
|
194 |
"autoload": {
|
216 |
"geolocation",
|
217 |
"maxmind"
|
218 |
]
|
219 |
+
},
|
220 |
+
{
|
221 |
+
"name": "mustache/mustache",
|
222 |
+
"version": "v2.12.0",
|
223 |
+
"version_normalized": "2.12.0.0",
|
224 |
+
"source": {
|
225 |
+
"type": "git",
|
226 |
+
"url": "https://github.com/bobthecow/mustache.php.git",
|
227 |
+
"reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e"
|
228 |
+
},
|
229 |
+
"dist": {
|
230 |
+
"type": "zip",
|
231 |
+
"url": "https://api.github.com/repos/bobthecow/mustache.php/zipball/fe8fe72e9d580591854de404cc59a1b83ca4d19e",
|
232 |
+
"reference": "fe8fe72e9d580591854de404cc59a1b83ca4d19e",
|
233 |
+
"shasum": ""
|
234 |
+
},
|
235 |
+
"require": {
|
236 |
+
"php": ">=5.2.4"
|
237 |
+
},
|
238 |
+
"require-dev": {
|
239 |
+
"friendsofphp/php-cs-fixer": "~1.11",
|
240 |
+
"phpunit/phpunit": "~3.7|~4.0|~5.0"
|
241 |
+
},
|
242 |
+
"time": "2017-07-11T12:54:05+00:00",
|
243 |
+
"type": "library",
|
244 |
+
"installation-source": "dist",
|
245 |
+
"autoload": {
|
246 |
+
"psr-0": {
|
247 |
+
"Mustache": "src/"
|
248 |
+
}
|
249 |
+
},
|
250 |
+
"notification-url": "https://packagist.org/downloads/",
|
251 |
+
"license": [
|
252 |
+
"MIT"
|
253 |
+
],
|
254 |
+
"authors": [
|
255 |
+
{
|
256 |
+
"name": "Justin Hileman",
|
257 |
+
"email": "justin@justinhileman.info",
|
258 |
+
"homepage": "http://justinhileman.com"
|
259 |
+
}
|
260 |
+
],
|
261 |
+
"description": "A Mustache implementation in PHP.",
|
262 |
+
"homepage": "https://github.com/bobthecow/mustache.php",
|
263 |
+
"keywords": [
|
264 |
+
"mustache",
|
265 |
+
"templating"
|
266 |
+
]
|
267 |
}
|
268 |
]
|
vendor/geoip2/geoip2/.php_cs
CHANGED
@@ -9,6 +9,7 @@ return PhpCsFixer\Config::create()
|
|
9 |
'combine_consecutive_unsets' => true,
|
10 |
'concat_space' => [ 'spacing' => 'one'],
|
11 |
'heredoc_to_nowdoc' => true,
|
|
|
12 |
'list_syntax' => ['syntax' => 'long'],
|
13 |
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
|
14 |
'no_short_echo_tag' => true,
|
9 |
'combine_consecutive_unsets' => true,
|
10 |
'concat_space' => [ 'spacing' => 'one'],
|
11 |
'heredoc_to_nowdoc' => true,
|
12 |
+
'increment_style' => false,
|
13 |
'list_syntax' => ['syntax' => 'long'],
|
14 |
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
|
15 |
'no_short_echo_tag' => true,
|
vendor/geoip2/geoip2/CHANGELOG.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1 |
CHANGELOG
|
2 |
=========
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
2.7.0 (2017-10-27)
|
5 |
------------------
|
6 |
|
1 |
CHANGELOG
|
2 |
=========
|
3 |
|
4 |
+
2.9.0 (2018-04-10)
|
5 |
+
------------------
|
6 |
+
|
7 |
+
* Refer to account IDs using the terminology "account" rather than "user".
|
8 |
+
|
9 |
+
2.8.0 (2018-01-18)
|
10 |
+
------------------
|
11 |
+
|
12 |
+
* The `isInEuropeanUnion` property was added to `GeoIp2\Record\Country`
|
13 |
+
and `GeoIp2\Record\RepresentedCountry`. This property is `true` if the
|
14 |
+
country is a member state of the European Union.
|
15 |
+
|
16 |
2.7.0 (2017-10-27)
|
17 |
------------------
|
18 |
|
vendor/geoip2/geoip2/README.md
CHANGED
@@ -257,7 +257,7 @@ print($record->ipAddress . "\n"); // '128.101.101.101'
|
|
257 |
### Usage ###
|
258 |
|
259 |
To use this API, you must create a new `\GeoIp2\WebService\Client`
|
260 |
-
object with your `$
|
261 |
corresponding to a specific end point, passing it the IP address you want to
|
262 |
look up.
|
263 |
|
@@ -277,7 +277,7 @@ require_once 'vendor/autoload.php';
|
|
277 |
use GeoIp2\WebService\Client;
|
278 |
|
279 |
// This creates a Client object that can be reused across requests.
|
280 |
-
// Replace "42" with your
|
281 |
// key.
|
282 |
$client = new Client(42, 'abcdef123456');
|
283 |
|
@@ -395,7 +395,7 @@ The GeoIP2 PHP API uses [Semantic Versioning](http://semver.org/).
|
|
395 |
|
396 |
## Copyright and License ##
|
397 |
|
398 |
-
This software is Copyright (c) 2013-
|
399 |
|
400 |
This is free software, licensed under the Apache License, Version 2.0.
|
401 |
|
257 |
### Usage ###
|
258 |
|
259 |
To use this API, you must create a new `\GeoIp2\WebService\Client`
|
260 |
+
object with your `$accountId` and `$licenseKey`, then you call the method
|
261 |
corresponding to a specific end point, passing it the IP address you want to
|
262 |
look up.
|
263 |
|
277 |
use GeoIp2\WebService\Client;
|
278 |
|
279 |
// This creates a Client object that can be reused across requests.
|
280 |
+
// Replace "42" with your account ID and "license_key" with your license
|
281 |
// key.
|
282 |
$client = new Client(42, 'abcdef123456');
|
283 |
|
395 |
|
396 |
## Copyright and License ##
|
397 |
|
398 |
+
This software is Copyright (c) 2013-2018 by MaxMind, Inc.
|
399 |
|
400 |
This is free software, licensed under the Apache License, Version 2.0.
|
401 |
|
vendor/geoip2/geoip2/composer.json
CHANGED
@@ -14,14 +14,13 @@
|
|
14 |
],
|
15 |
"require": {
|
16 |
"maxmind-db/reader": "~1.0",
|
17 |
-
"maxmind/web-service-common": "~0.
|
18 |
"php": ">=5.4"
|
19 |
},
|
20 |
"require-dev": {
|
21 |
"friendsofphp/php-cs-fixer": "2.*",
|
22 |
"phpunit/phpunit": "4.*",
|
23 |
-
"squizlabs/php_codesniffer": "3.*"
|
24 |
-
"apigen/apigen": "*"
|
25 |
},
|
26 |
"autoload": {
|
27 |
"psr-4": {
|
14 |
],
|
15 |
"require": {
|
16 |
"maxmind-db/reader": "~1.0",
|
17 |
+
"maxmind/web-service-common": "~0.5",
|
18 |
"php": ">=5.4"
|
19 |
},
|
20 |
"require-dev": {
|
21 |
"friendsofphp/php-cs-fixer": "2.*",
|
22 |
"phpunit/phpunit": "4.*",
|
23 |
+
"squizlabs/php_codesniffer": "3.*"
|
|
|
24 |
},
|
25 |
"autoload": {
|
26 |
"psr-4": {
|
vendor/geoip2/geoip2/src/Record/Country.php
CHANGED
@@ -11,7 +11,10 @@ namespace GeoIp2\Record;
|
|
11 |
* confidence that the country is correct. This attribute is only available
|
12 |
* from the Insights service and the GeoIP2 Enterprise database.
|
13 |
* @property-read int|null $geonameId The GeoName ID for the country. This
|
14 |
-
* attribute is returned by location services and databases.
|
|
|
|
|
|
|
15 |
* @property-read string|null $isoCode The
|
16 |
* {@link * http://en.wikipedia.org/wiki/ISO_3166-1 two-character ISO 3166-1 alpha
|
17 |
* code} for the country. This attribute is returned by all location services
|
@@ -31,6 +34,7 @@ class Country extends AbstractPlaceRecord
|
|
31 |
protected $validAttributes = [
|
32 |
'confidence',
|
33 |
'geonameId',
|
|
|
34 |
'isoCode',
|
35 |
'names',
|
36 |
];
|
11 |
* confidence that the country is correct. This attribute is only available
|
12 |
* from the Insights service and the GeoIP2 Enterprise database.
|
13 |
* @property-read int|null $geonameId The GeoName ID for the country. This
|
14 |
+
* attribute is returned by all location services and databases.
|
15 |
+
* @property-read bool $isInEuropeanUnion This is true if the country is a
|
16 |
+
* member state of the European Union. This attribute is returned by all
|
17 |
+
* location services and databases.
|
18 |
* @property-read string|null $isoCode The
|
19 |
* {@link * http://en.wikipedia.org/wiki/ISO_3166-1 two-character ISO 3166-1 alpha
|
20 |
* code} for the country. This attribute is returned by all location services
|
34 |
protected $validAttributes = [
|
35 |
'confidence',
|
36 |
'geonameId',
|
37 |
+
'isInEuropeanUnion',
|
38 |
'isoCode',
|
39 |
'names',
|
40 |
];
|
vendor/geoip2/geoip2/src/Record/RepresentedCountry.php
CHANGED
@@ -13,6 +13,9 @@ namespace GeoIp2\Record;
|
|
13 |
* confidence that the country is correct. This attribute is only available
|
14 |
* from the Insights service and the GeoIP2 Enterprise database.
|
15 |
* @property-read int|null $geonameId The GeoName ID for the country.
|
|
|
|
|
|
|
16 |
* @property-read string|null $isoCode The {@link http://en.wikipedia.org/wiki/ISO_3166-1
|
17 |
* two-character ISO 3166-1 alpha code} for the country.
|
18 |
* @property-read string|null $name The name of the country based on the locales list
|
@@ -28,6 +31,7 @@ class RepresentedCountry extends Country
|
|
28 |
protected $validAttributes = [
|
29 |
'confidence',
|
30 |
'geonameId',
|
|
|
31 |
'isoCode',
|
32 |
'names',
|
33 |
'type',
|
13 |
* confidence that the country is correct. This attribute is only available
|
14 |
* from the Insights service and the GeoIP2 Enterprise database.
|
15 |
* @property-read int|null $geonameId The GeoName ID for the country.
|
16 |
+
* @property-read bool $isInEuropeanUnion This is true if the country is a
|
17 |
+
* member state of the European Union. This attribute is returned by all
|
18 |
+
* location services and databases.
|
19 |
* @property-read string|null $isoCode The {@link http://en.wikipedia.org/wiki/ISO_3166-1
|
20 |
* two-character ISO 3166-1 alpha code} for the country.
|
21 |
* @property-read string|null $name The name of the country based on the locales list
|
31 |
protected $validAttributes = [
|
32 |
'confidence',
|
33 |
'geonameId',
|
34 |
+
'isInEuropeanUnion',
|
35 |
'isoCode',
|
36 |
'names',
|
37 |
'type',
|
vendor/geoip2/geoip2/src/WebService/Client.php
CHANGED
@@ -30,7 +30,7 @@ use MaxMind\WebService\Client as WsClient;
|
|
30 |
* ## Usage ##
|
31 |
*
|
32 |
* The basic API for this class is the same for all of the web service end
|
33 |
-
* points. First you create a web service object with your MaxMind `$
|
34 |
* and `$licenseKey`, then you call the method corresponding to a specific end
|
35 |
* point, passing it the IP address you want to look up.
|
36 |
*
|
@@ -47,12 +47,12 @@ class Client implements ProviderInterface
|
|
47 |
private $client;
|
48 |
private static $basePath = '/geoip/v2.1';
|
49 |
|
50 |
-
const VERSION = 'v2.
|
51 |
|
52 |
/**
|
53 |
* Constructor.
|
54 |
*
|
55 |
-
* @param int $
|
56 |
* @param string $licenseKey your MaxMind license key
|
57 |
* @param array $locales list of locale codes to use in name property
|
58 |
* from most preferred to least preferred
|
@@ -65,7 +65,7 @@ class Client implements ProviderInterface
|
|
65 |
* `http://username:password@127.0.0.1:10`.
|
66 |
*/
|
67 |
public function __construct(
|
68 |
-
$
|
69 |
$licenseKey,
|
70 |
$locales = ['en'],
|
71 |
$options = []
|
@@ -84,7 +84,7 @@ class Client implements ProviderInterface
|
|
84 |
|
85 |
$options['userAgent'] = $this->userAgent();
|
86 |
|
87 |
-
$this->client = new WsClient($
|
88 |
}
|
89 |
|
90 |
private function userAgent()
|
@@ -102,7 +102,7 @@ class Client implements ProviderInterface
|
|
102 |
* @throws \GeoIp2\Exception\AddressNotFoundException if the address you
|
103 |
* provided is not in our database (e.g., a private address).
|
104 |
* @throws \GeoIp2\Exception\AuthenticationException if there is a problem
|
105 |
-
* with the
|
106 |
* @throws \GeoIp2\Exception\OutOfQueriesException if your account is out
|
107 |
* of queries
|
108 |
* @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
|
@@ -133,7 +133,7 @@ class Client implements ProviderInterface
|
|
133 |
* @throws \GeoIp2\Exception\AddressNotFoundException if the address you provided is not in our database (e.g.,
|
134 |
* a private address).
|
135 |
* @throws \GeoIp2\Exception\AuthenticationException if there is a problem
|
136 |
-
* with the
|
137 |
* @throws \GeoIp2\Exception\OutOfQueriesException if your account is out of queries
|
138 |
* @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
|
139 |
* invalid for some other reason. This may indicate an
|
@@ -164,7 +164,7 @@ class Client implements ProviderInterface
|
|
164 |
* @throws \GeoIp2\Exception\AddressNotFoundException if the address you
|
165 |
* provided is not in our database (e.g., a private address).
|
166 |
* @throws \GeoIp2\Exception\AuthenticationException if there is a problem
|
167 |
-
* with the
|
168 |
* @throws \GeoIp2\Exception\OutOfQueriesException if your account is out
|
169 |
* of queries
|
170 |
* @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
|
30 |
* ## Usage ##
|
31 |
*
|
32 |
* The basic API for this class is the same for all of the web service end
|
33 |
+
* points. First you create a web service object with your MaxMind `$accountId`
|
34 |
* and `$licenseKey`, then you call the method corresponding to a specific end
|
35 |
* point, passing it the IP address you want to look up.
|
36 |
*
|
47 |
private $client;
|
48 |
private static $basePath = '/geoip/v2.1';
|
49 |
|
50 |
+
const VERSION = 'v2.9.0';
|
51 |
|
52 |
/**
|
53 |
* Constructor.
|
54 |
*
|
55 |
+
* @param int $accountId your MaxMind account ID
|
56 |
* @param string $licenseKey your MaxMind license key
|
57 |
* @param array $locales list of locale codes to use in name property
|
58 |
* from most preferred to least preferred
|
65 |
* `http://username:password@127.0.0.1:10`.
|
66 |
*/
|
67 |
public function __construct(
|
68 |
+
$accountId,
|
69 |
$licenseKey,
|
70 |
$locales = ['en'],
|
71 |
$options = []
|
84 |
|
85 |
$options['userAgent'] = $this->userAgent();
|
86 |
|
87 |
+
$this->client = new WsClient($accountId, $licenseKey, $options);
|
88 |
}
|
89 |
|
90 |
private function userAgent()
|
102 |
* @throws \GeoIp2\Exception\AddressNotFoundException if the address you
|
103 |
* provided is not in our database (e.g., a private address).
|
104 |
* @throws \GeoIp2\Exception\AuthenticationException if there is a problem
|
105 |
+
* with the account ID or license key that you provided
|
106 |
* @throws \GeoIp2\Exception\OutOfQueriesException if your account is out
|
107 |
* of queries
|
108 |
* @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
|
133 |
* @throws \GeoIp2\Exception\AddressNotFoundException if the address you provided is not in our database (e.g.,
|
134 |
* a private address).
|
135 |
* @throws \GeoIp2\Exception\AuthenticationException if there is a problem
|
136 |
+
* with the account ID or license key that you provided
|
137 |
* @throws \GeoIp2\Exception\OutOfQueriesException if your account is out of queries
|
138 |
* @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
|
139 |
* invalid for some other reason. This may indicate an
|
164 |
* @throws \GeoIp2\Exception\AddressNotFoundException if the address you
|
165 |
* provided is not in our database (e.g., a private address).
|
166 |
* @throws \GeoIp2\Exception\AuthenticationException if there is a problem
|
167 |
+
* with the account ID or license key that you provided
|
168 |
* @throws \GeoIp2\Exception\OutOfQueriesException if your account is out
|
169 |
* of queries
|
170 |
* @throws \GeoIp2\Exception\InvalidRequestException} if your request was received by the web service but is
|
vendor/maxmind-db/reader/CHANGELOG.md
CHANGED
@@ -1,10 +1,23 @@
|
|
1 |
CHANGELOG
|
2 |
=========
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
1.2.0 (2017-10-27)
|
5 |
------------------
|
6 |
|
7 |
-
* PHP 5.4 is now required.
|
8 |
* The `Reader` class for the `maxminddb` extension is no longer final.
|
9 |
This was change to match the behavior of the pure PHP class.
|
10 |
Reported and fixed by venyii. GitHub #52 & #54.
|
1 |
CHANGELOG
|
2 |
=========
|
3 |
|
4 |
+
1.3.0 (2018-02-21)
|
5 |
+
------------------
|
6 |
+
|
7 |
+
* IMPORTANT: The `maxminddb` extension now obeys `open_basedir`. If
|
8 |
+
`open_basedir` is set, you _must_ store the database within the
|
9 |
+
specified directory. Placing the file outside of this directory
|
10 |
+
will result in an exception. Please test your integration before
|
11 |
+
upgrading the extension. This does not affect the pure PHP
|
12 |
+
implementation, which has always had this restriction. Reported
|
13 |
+
by Benoît Burnichon. GitHub #61.
|
14 |
+
* A custom `autoload.php` file is provided for installations without
|
15 |
+
Composer. GitHub #56.
|
16 |
+
|
17 |
1.2.0 (2017-10-27)
|
18 |
------------------
|
19 |
|
20 |
+
* PHP 5.4 or greater is now required.
|
21 |
* The `Reader` class for the `maxminddb` extension is no longer final.
|
22 |
This was change to match the behavior of the pure PHP class.
|
23 |
Reported and fixed by venyii. GitHub #52 & #54.
|
vendor/maxmind-db/reader/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
This is the PHP API for reading MaxMind DB files. MaxMind DB is a binary file
|
6 |
format that stores data indexed by IP address subnets (IPv4 or IPv6).
|
7 |
|
8 |
-
## Installation ##
|
9 |
|
10 |
We recommend installing this package with [Composer](http://getcomposer.org/).
|
11 |
|
@@ -40,6 +40,23 @@ from your code:
|
|
40 |
require 'vendor/autoload.php';
|
41 |
```
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
## Usage ##
|
44 |
|
45 |
## Example ##
|
5 |
This is the PHP API for reading MaxMind DB files. MaxMind DB is a binary file
|
6 |
format that stores data indexed by IP address subnets (IPv4 or IPv6).
|
7 |
|
8 |
+
## Installation (Composer) ##
|
9 |
|
10 |
We recommend installing this package with [Composer](http://getcomposer.org/).
|
11 |
|
40 |
require 'vendor/autoload.php';
|
41 |
```
|
42 |
|
43 |
+
## Installation (Standalone) ##
|
44 |
+
|
45 |
+
If you don't want to use Composer for some reason, a custom
|
46 |
+
`autoload.php` is provided for you in the project root. To use the
|
47 |
+
library, simply include that file,
|
48 |
+
|
49 |
+
```php
|
50 |
+
require('/path/to/MaxMind-DB-Reader-php/autoload.php');
|
51 |
+
```
|
52 |
+
|
53 |
+
and then instantiate the reader class normally:
|
54 |
+
|
55 |
+
```php
|
56 |
+
use MaxMind\Db\Reader;
|
57 |
+
$reader = new Reader('example.mmdb');
|
58 |
+
```
|
59 |
+
|
60 |
## Usage ##
|
61 |
|
62 |
## Example ##
|
vendor/maxmind-db/reader/autoload.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* PSR-4 autoloader implementation for the MaxMind\DB namespace.
|
5 |
+
* First we define the 'mmdb_autoload' function, and then we register
|
6 |
+
* it with 'spl_autoload_register' so that PHP knows to use it.
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Automatically include the file that defines <code>class</code>.
|
11 |
+
*
|
12 |
+
* @param string $class
|
13 |
+
* the name of the class to load
|
14 |
+
*
|
15 |
+
* @return void
|
16 |
+
*/
|
17 |
+
function mmdb_autoload($class)
|
18 |
+
{
|
19 |
+
/*
|
20 |
+
* A project-specific mapping between the namespaces and where
|
21 |
+
* they're located. By convention, we include the trailing
|
22 |
+
* slashes. The one-element array here simply makes things easy
|
23 |
+
* to extend in the future if (for example) the test classes
|
24 |
+
* begin to use one another.
|
25 |
+
*/
|
26 |
+
$namespace_map = array('MaxMind\\Db\\' => __DIR__ . '/src/MaxMind/Db/');
|
27 |
+
|
28 |
+
foreach ($namespace_map as $prefix => $dir)
|
29 |
+
{
|
30 |
+
/* First swap out the namespace prefix with a directory... */
|
31 |
+
$path = str_replace($prefix, $dir, $class);
|
32 |
+
|
33 |
+
/* replace the namespace separator with a directory separator... */
|
34 |
+
$path = str_replace('\\', '/', $path);
|
35 |
+
|
36 |
+
/* and finally, add the PHP file extension to the result. */
|
37 |
+
$path = $path . '.php';
|
38 |
+
|
39 |
+
/* $path should now contain the path to a PHP file defining $class */
|
40 |
+
@include $path;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
spl_autoload_register('mmdb_autoload');
|
vendor/maxmind-db/reader/composer.json
CHANGED
@@ -22,7 +22,7 @@
|
|
22 |
},
|
23 |
"require-dev": {
|
24 |
"friendsofphp/php-cs-fixer": "2.*",
|
25 |
-
"phpunit/phpunit": "4.*",
|
26 |
"satooshi/php-coveralls": "1.0.*",
|
27 |
"squizlabs/php_codesniffer": "3.*"
|
28 |
},
|
22 |
},
|
23 |
"require-dev": {
|
24 |
"friendsofphp/php-cs-fixer": "2.*",
|
25 |
+
"phpunit/phpunit": "4.* || 5.*",
|
26 |
"satooshi/php-coveralls": "1.0.*",
|
27 |
"squizlabs/php_codesniffer": "3.*"
|
28 |
},
|
vendor/maxmind-db/reader/ext/maxminddb.c
CHANGED
@@ -120,14 +120,14 @@ PHP_METHOD(MaxMind_Db_Reader, __construct){
|
|
120 |
strsize_t name_len;
|
121 |
zval * _this_zval = NULL;
|
122 |
|
123 |
-
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os",
|
124 |
&_this_zval, maxminddb_ce, &db_file, &name_len) == FAILURE) {
|
125 |
THROW_EXCEPTION("InvalidArgumentException",
|
126 |
"The constructor takes exactly one argument.");
|
127 |
return;
|
128 |
}
|
129 |
|
130 |
-
if (0 != access(db_file, R_OK)) {
|
131 |
THROW_EXCEPTION("InvalidArgumentException",
|
132 |
"The file \"%s\" does not exist or is not readable.",
|
133 |
db_file);
|
@@ -155,7 +155,7 @@ PHP_METHOD(MaxMind_Db_Reader, get){
|
|
155 |
strsize_t name_len;
|
156 |
zval * _this_zval = NULL;
|
157 |
|
158 |
-
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os",
|
159 |
&_this_zval, maxminddb_ce, &ip_address, &name_len) == FAILURE) {
|
160 |
THROW_EXCEPTION("InvalidArgumentException",
|
161 |
"Method takes exactly one argument.");
|
@@ -284,7 +284,7 @@ PHP_METHOD(MaxMind_Db_Reader, close){
|
|
284 |
return;
|
285 |
}
|
286 |
|
287 |
-
maxminddb_obj *mmdb_obj =
|
288 |
(maxminddb_obj *)Z_MAXMINDDB_P(getThis());
|
289 |
|
290 |
if (NULL == mmdb_obj->mmdb) {
|
120 |
strsize_t name_len;
|
121 |
zval * _this_zval = NULL;
|
122 |
|
123 |
+
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os",
|
124 |
&_this_zval, maxminddb_ce, &db_file, &name_len) == FAILURE) {
|
125 |
THROW_EXCEPTION("InvalidArgumentException",
|
126 |
"The constructor takes exactly one argument.");
|
127 |
return;
|
128 |
}
|
129 |
|
130 |
+
if (0 != php_check_open_basedir(db_file TSRMLS_CC) || 0 != access(db_file, R_OK)) {
|
131 |
THROW_EXCEPTION("InvalidArgumentException",
|
132 |
"The file \"%s\" does not exist or is not readable.",
|
133 |
db_file);
|
155 |
strsize_t name_len;
|
156 |
zval * _this_zval = NULL;
|
157 |
|
158 |
+
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os",
|
159 |
&_this_zval, maxminddb_ce, &ip_address, &name_len) == FAILURE) {
|
160 |
THROW_EXCEPTION("InvalidArgumentException",
|
161 |
"Method takes exactly one argument.");
|
284 |
return;
|
285 |
}
|
286 |
|
287 |
+
maxminddb_obj *mmdb_obj =
|
288 |
(maxminddb_obj *)Z_MAXMINDDB_P(getThis());
|
289 |
|
290 |
if (NULL == mmdb_obj->mmdb) {
|
vendor/maxmind-db/reader/ext/php_maxminddb.h
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
|
16 |
#ifndef PHP_MAXMINDDB_H
|
17 |
#define PHP_MAXMINDDB_H 1
|
18 |
-
#define PHP_MAXMINDDB_VERSION "1.
|
19 |
#define PHP_MAXMINDDB_EXTNAME "maxminddb"
|
20 |
|
21 |
extern zend_module_entry maxminddb_module_entry;
|
15 |
|
16 |
#ifndef PHP_MAXMINDDB_H
|
17 |
#define PHP_MAXMINDDB_H 1
|
18 |
+
#define PHP_MAXMINDDB_VERSION "1.3.0"
|
19 |
#define PHP_MAXMINDDB_EXTNAME "maxminddb"
|
20 |
|
21 |
extern zend_module_entry maxminddb_module_entry;
|
vendor/maxmind-db/reader/ext/tests/003-open-basedir.phpt
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
--TEST--
|
2 |
+
openbase_dir is followed
|
3 |
+
--INI--
|
4 |
+
open_basedir=/--dne--
|
5 |
+
--FILE--
|
6 |
+
<?php
|
7 |
+
use MaxMind\Db\Reader;
|
8 |
+
|
9 |
+
$reader = new Reader('/usr/local/share/GeoIP/GeoIP2-City.mmdb');
|
10 |
+
?>
|
11 |
+
--EXPECTREGEX--
|
12 |
+
.*open_basedir restriction in effect.*
|
vendor/maxmind/web-service-common/CHANGELOG.md
CHANGED
@@ -1,7 +1,12 @@
|
|
1 |
CHANGELOG
|
2 |
=========
|
3 |
|
4 |
-
0.
|
|
|
|
|
|
|
|
|
|
|
5 |
------------------
|
6 |
|
7 |
* PHP 5.4 is now required.
|
1 |
CHANGELOG
|
2 |
=========
|
3 |
|
4 |
+
0.5.0 (2018-02-12)
|
5 |
+
------------------
|
6 |
+
|
7 |
+
* Refer to account IDs using the terminology "account" rather than "user".
|
8 |
+
|
9 |
+
0.4.0 (2017-07-10)
|
10 |
------------------
|
11 |
|
12 |
* PHP 5.4 is now required.
|
vendor/maxmind/web-service-common/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
# MaxMind Web Service
|
2 |
|
3 |
This is _not_ intended for direct use by third parties. Rather, it is for
|
4 |
-
shared code between MaxMind's various web service APIs.
|
5 |
|
6 |
## Requirements ##
|
7 |
|
@@ -21,6 +21,6 @@ This API uses [Semantic Versioning](http://semver.org/).
|
|
21 |
|
22 |
## Copyright and License ##
|
23 |
|
24 |
-
This software is Copyright (c) 2015-
|
25 |
|
26 |
This is free software, licensed under the Apache License, Version 2.0.
|
1 |
+
# Common Code for MaxMind Web Service Clients #
|
2 |
|
3 |
This is _not_ intended for direct use by third parties. Rather, it is for
|
4 |
+
shared code between MaxMind's various web service client APIs.
|
5 |
|
6 |
## Requirements ##
|
7 |
|
21 |
|
22 |
## Copyright and License ##
|
23 |
|
24 |
+
This software is Copyright (c) 2015-2018 by MaxMind, Inc.
|
25 |
|
26 |
This is free software, licensed under the Apache License, Version 2.0.
|
vendor/maxmind/web-service-common/dev-bin/release.sh
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
set -eu -o pipefail
|
4 |
+
|
5 |
+
|
6 |
+
changelog=$(cat CHANGELOG.md)
|
7 |
+
|
8 |
+
regex='
|
9 |
+
([0-9]+\.[0-9]+\.[0-9]+) \(([0-9]{4}-[0-9]{2}-[0-9]{2})\)
|
10 |
+
-*
|
11 |
+
|
12 |
+
((.|
|
13 |
+
)*)
|
14 |
+
'
|
15 |
+
|
16 |
+
if [[ ! $changelog =~ $regex ]]; then
|
17 |
+
echo "Could not find date line in change log!"
|
18 |
+
exit 1
|
19 |
+
fi
|
20 |
+
|
21 |
+
version="${BASH_REMATCH[1]}"
|
22 |
+
date="${BASH_REMATCH[2]}"
|
23 |
+
notes="$(echo "${BASH_REMATCH[3]}" | sed -n -e '/^[0-9]\+\.[0-9]\+\.[0-9]\+/,$!p')"
|
24 |
+
|
25 |
+
if [[ "$date" != $(date +"%Y-%m-%d") ]]; then
|
26 |
+
echo "$date is not today!"
|
27 |
+
exit 1
|
28 |
+
fi
|
29 |
+
|
30 |
+
tag="v$version"
|
31 |
+
|
32 |
+
if [ -n "$(git status --porcelain)" ]; then
|
33 |
+
echo ". is not clean." >&2
|
34 |
+
exit 1
|
35 |
+
fi
|
36 |
+
|
37 |
+
php composer.phar self-update
|
38 |
+
php composer.phar update
|
39 |
+
|
40 |
+
./vendor/bin/phpunit
|
41 |
+
|
42 |
+
echo "Release notes for $tag:"
|
43 |
+
echo "$notes"
|
44 |
+
|
45 |
+
read -e -p "Commit changes and push to origin? " should_push
|
46 |
+
|
47 |
+
if [ "$should_push" != "y" ]; then
|
48 |
+
echo "Aborting"
|
49 |
+
exit 1
|
50 |
+
fi
|
51 |
+
|
52 |
+
git push
|
53 |
+
|
54 |
+
message="$version
|
55 |
+
|
56 |
+
$notes"
|
57 |
+
|
58 |
+
hub release create -m "$message" "$tag"
|
59 |
+
|
60 |
+
git push --tags
|
vendor/maxmind/web-service-common/src/WebService/Client.php
CHANGED
@@ -32,10 +32,10 @@ class Client
|
|
32 |
private $proxy;
|
33 |
private $timeout;
|
34 |
private $userAgentPrefix;
|
35 |
-
private $
|
36 |
|
37 |
/**
|
38 |
-
* @param int $
|
39 |
* @param string $licenseKey your MaxMind license key
|
40 |
* @param array $options an array of options. Possible keys:
|
41 |
* * `host` - The host to use when connecting to the web service.
|
@@ -47,11 +47,11 @@ class Client
|
|
47 |
* username, and password, e.g., `http://username:password@127.0.0.1:10`.
|
48 |
*/
|
49 |
public function __construct(
|
50 |
-
$
|
51 |
$licenseKey,
|
52 |
$options = []
|
53 |
) {
|
54 |
-
$this->
|
55 |
$this->licenseKey = $licenseKey;
|
56 |
|
57 |
$this->httpRequestFactory = isset($options['httpRequestFactory'])
|
@@ -152,7 +152,7 @@ class Client
|
|
152 |
array_push(
|
153 |
$headers,
|
154 |
'Authorization: Basic '
|
155 |
-
. base64_encode($this->
|
156 |
'Accept: application/json'
|
157 |
);
|
158 |
|
@@ -325,6 +325,8 @@ class Client
|
|
325 |
$statusCode,
|
326 |
$this->urlFor($path)
|
327 |
);
|
|
|
|
|
328 |
case 'AUTHORIZATION_INVALID':
|
329 |
case 'LICENSE_KEY_REQUIRED':
|
330 |
case 'USER_ID_REQUIRED':
|
32 |
private $proxy;
|
33 |
private $timeout;
|
34 |
private $userAgentPrefix;
|
35 |
+
private $accountId;
|
36 |
|
37 |
/**
|
38 |
+
* @param int $accountId your MaxMind account ID
|
39 |
* @param string $licenseKey your MaxMind license key
|
40 |
* @param array $options an array of options. Possible keys:
|
41 |
* * `host` - The host to use when connecting to the web service.
|
47 |
* username, and password, e.g., `http://username:password@127.0.0.1:10`.
|
48 |
*/
|
49 |
public function __construct(
|
50 |
+
$accountId,
|
51 |
$licenseKey,
|
52 |
$options = []
|
53 |
) {
|
54 |
+
$this->accountId = $accountId;
|
55 |
$this->licenseKey = $licenseKey;
|
56 |
|
57 |
$this->httpRequestFactory = isset($options['httpRequestFactory'])
|
152 |
array_push(
|
153 |
$headers,
|
154 |
'Authorization: Basic '
|
155 |
+
. base64_encode($this->accountId . ':' . $this->licenseKey),
|
156 |
'Accept: application/json'
|
157 |
);
|
158 |
|
325 |
$statusCode,
|
326 |
$this->urlFor($path)
|
327 |
);
|
328 |
+
case 'ACCOUNT_ID_REQUIRED':
|
329 |
+
case 'ACCOUNT_ID_UNKNOWN':
|
330 |
case 'AUTHORIZATION_INVALID':
|
331 |
case 'LICENSE_KEY_REQUIRED':
|
332 |
case 'USER_ID_REQUIRED':
|
vendor/mustache/mustache/.gitignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
.php_cs.cache
|
2 |
+
composer.lock
|
3 |
+
mustache.php
|
4 |
+
vendor
|
vendor/mustache/mustache/.gitmodules
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[submodule "vendor/spec"]
|
2 |
+
path = vendor/spec
|
3 |
+
url = https://github.com/mustache/spec.git
|
4 |
+
[submodule "vendor/yaml"]
|
5 |
+
path = vendor/yaml
|
6 |
+
url = https://github.com/fabpot/yaml.git
|
vendor/mustache/mustache/.php_cs
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Symfony\CS\Config\Config;
|
4 |
+
use Symfony\CS\FixerInterface;
|
5 |
+
|
6 |
+
$config = Config::create()
|
7 |
+
// use symfony level and extra fixers:
|
8 |
+
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
|
9 |
+
->fixers(array(
|
10 |
+
'-concat_without_spaces',
|
11 |
+
'-pre_increment',
|
12 |
+
'-unalign_double_arrow',
|
13 |
+
'-unalign_equals',
|
14 |
+
'align_double_arrow',
|
15 |
+
'concat_with_spaces',
|
16 |
+
'ordered_use',
|
17 |
+
'strict',
|
18 |
+
))
|
19 |
+
->setUsingLinter(false);
|
20 |
+
|
21 |
+
$finder = $config->getFinder()
|
22 |
+
->in('bin')
|
23 |
+
->in('src')
|
24 |
+
->in('test');
|
25 |
+
|
26 |
+
return $config;
|
vendor/mustache/mustache/.styleci.yml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
preset: symfony
|
2 |
+
|
3 |
+
enabled:
|
4 |
+
- align_double_arrow
|
5 |
+
- concat_with_spaces
|
6 |
+
- ordered_use
|
7 |
+
- strict
|
8 |
+
|
9 |
+
disabled:
|
10 |
+
- concat_without_spaces
|
11 |
+
- pre_increment
|
12 |
+
- unalign_double_arrow
|
13 |
+
- unalign_equals
|
vendor/mustache/mustache/.travis.yml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
language: php
|
2 |
+
|
3 |
+
sudo: false
|
4 |
+
|
5 |
+
matrix:
|
6 |
+
include:
|
7 |
+
- php: 5.2
|
8 |
+
- php: 5.3
|
9 |
+
- php: 5.4
|
10 |
+
- php: 5.5
|
11 |
+
- php: 5.6
|
12 |
+
- php: 7.0
|
13 |
+
- php: 7.1
|
14 |
+
- php: hhvm
|
15 |
+
dist: trusty
|
16 |
+
|
17 |
+
script:
|
18 |
+
- '[[ "$TRAVIS_PHP_VERSION" = 5.2* ]] && phpunit || vendor/bin/phpunit --verbose'
|
19 |
+
|
20 |
+
install:
|
21 |
+
- '[[ "$TRAVIS_PHP_VERSION" = 5.2* ]] || composer install'
|
vendor/mustache/mustache/CONTRIBUTING.md
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Contributions welcome!
|
2 |
+
|
3 |
+
|
4 |
+
### Here's a quick guide:
|
5 |
+
|
6 |
+
1. [Fork the repo on GitHub](https://github.com/bobthecow/mustache.php).
|
7 |
+
|
8 |
+
2. Update submodules: `git submodule update --init`
|
9 |
+
|
10 |
+
3. Run the test suite. We only take pull requests with passing tests, and it's great to know that you have a clean slate. Make sure you have PHPUnit 3.5+, then run `phpunit` from the project directory.
|
11 |
+
|
12 |
+
4. Add tests for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, add a test!
|
13 |
+
|
14 |
+
5. Make the tests pass.
|
15 |
+
|
16 |
+
6. Push your fork to GitHub and submit a pull request against the `dev` branch.
|
17 |
+
|
18 |
+
|
19 |
+
### You can do some things to increase the chance that your pull request is accepted the first time:
|
20 |
+
|
21 |
+
* Submit one pull request per fix or feature.
|
22 |
+
* To help with that, do all your work in a feature branch (e.g. `feature/my-alsome-feature`).
|
23 |
+
* Follow the conventions you see used in the project.
|
24 |
+
* Use `phpcs --standard=PSR2` to check your changes against the coding standard.
|
25 |
+
* Write tests that fail without your code, and pass with it.
|
26 |
+
* Don't bump version numbers. Those will be updated — per [semver](http://semver.org) — once your change is merged into `master`.
|
27 |
+
* Update any documentation: docblocks, README, examples, etc.
|
28 |
+
* ... Don't update the wiki until your change is merged and released, but make a note in your pull request so we don't forget.
|
29 |
+
|
30 |
+
|
31 |
+
### Mustache.php follows the PSR-* coding standards:
|
32 |
+
|
33 |
+
* [PSR-0: Class and file naming conventions](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md)
|
34 |
+
* [PSR-1: Basic coding standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md)
|
35 |
+
* [PSR-2: Coding style guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
|
{lib/php/Mustache → vendor/mustache/mustache}/LICENSE
RENAMED
File without changes
|
vendor/mustache/mustache/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Mustache.php
|
2 |
+
============
|
3 |
+
|
4 |
+
A [Mustache](http://mustache.github.com/) implementation in PHP.
|
5 |
+
|
6 |
+
[![Package version](http://img.shields.io/packagist/v/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache)
|
7 |
+
[![Build status](http://img.shields.io/travis/bobthecow/mustache.php/dev.svg?style=flat-square)](http://travis-ci.org/bobthecow/mustache.php)
|
8 |
+
[![StyleCI](https://styleci.io/repos/569670/shield)](https://styleci.io/repos/569670)
|
9 |
+
[![Monthly downloads](http://img.shields.io/packagist/dm/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache)
|
10 |
+
|
11 |
+
|
12 |
+
Usage
|
13 |
+
-----
|
14 |
+
|
15 |
+
A quick example:
|
16 |
+
|
17 |
+
```php
|
18 |
+
<?php
|
19 |
+
$m = new Mustache_Engine;
|
20 |
+
echo $m->render('Hello {{planet}}', array('planet' => 'World!')); // "Hello World!"
|
21 |
+
```
|
22 |
+
|
23 |
+
|
24 |
+
And a more in-depth example -- this is the canonical Mustache template:
|
25 |
+
|
26 |
+
```html+jinja
|
27 |
+
Hello {{name}}
|
28 |
+
You have just won {{value}} dollars!
|
29 |
+
{{#in_ca}}
|
30 |
+
Well, {{taxed_value}} dollars, after taxes.
|
31 |
+
{{/in_ca}}
|
32 |
+
```
|
33 |
+
|
34 |
+
|
35 |
+
Create a view "context" object -- which could also be an associative array, but those don't do functions quite as well:
|
36 |
+
|
37 |
+
```php
|
38 |
+
<?php
|
39 |
+
class Chris {
|
40 |
+
public $name = "Chris";
|
41 |
+
public $value = 10000;
|
42 |
+
|
43 |
+
public function taxed_value() {
|
44 |
+
return $this->value - ($this->value * 0.4);
|
45 |
+
}
|
46 |
+
|
47 |
+
public $in_ca = true;
|
48 |
+
}
|
49 |
+
```
|
50 |
+
|
51 |
+
|
52 |
+
And render it:
|
53 |
+
|
54 |
+
```php
|
55 |
+
<?php
|
56 |
+
$m = new Mustache_Engine;
|
57 |
+
$chris = new Chris;
|
58 |
+
echo $m->render($template, $chris);
|
59 |
+
```
|
60 |
+
|
61 |
+
|
62 |
+
And That's Not All!
|
63 |
+
-------------------
|
64 |
+
|
65 |
+
Read [the Mustache.php documentation](https://github.com/bobthecow/mustache.php/wiki/Home) for more information.
|
66 |
+
|
67 |
+
|
68 |
+
See Also
|
69 |
+
--------
|
70 |
+
|
71 |
+
* [Readme for the Ruby Mustache implementation](http://github.com/defunkt/mustache/blob/master/README.md).
|
72 |
+
* [mustache(5)](http://mustache.github.com/mustache.5.html) man page.
|
vendor/mustache/mustache/bin/build_bootstrap.php
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env php
|
2 |
+
<?php
|
3 |
+
|
4 |
+
/*
|
5 |
+
* This file is part of Mustache.php.
|
6 |
+
*
|
7 |
+
* (c) 2010-2015 Justin Hileman
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* A shell script to create a single-file class cache of the entire Mustache
|
15 |
+
* library.
|
16 |
+
*
|
17 |
+
* $ bin/build_bootstrap.php
|
18 |
+
*
|
19 |
+
* ... will create a `mustache.php` bootstrap file in the project directory,
|
20 |
+
* containing all Mustache library classes. This file can then be included in
|
21 |
+
* your project, rather than requiring the Mustache Autoloader.
|
22 |
+
*/
|
23 |
+
$baseDir = realpath(dirname(__FILE__) . '/..');
|
24 |
+
|
25 |
+
require $baseDir . '/src/Mustache/Autoloader.php';
|
26 |
+
Mustache_Autoloader::register();
|
27 |
+
|
28 |
+
// delete the old file
|
29 |
+
$file = $baseDir . '/mustache.php';
|
30 |
+
if (file_exists($file)) {
|
31 |
+
unlink($file);
|
32 |
+
}
|
33 |
+
|
34 |
+
// and load the new one
|
35 |
+
SymfonyClassCollectionLoader::load(array(
|
36 |
+
'Mustache_Engine',
|
37 |
+
'Mustache_Cache',
|
38 |
+
'Mustache_Cache_AbstractCache',
|
39 |
+
'Mustache_Cache_FilesystemCache',
|
40 |
+
'Mustache_Cache_NoopCache',
|
41 |
+
'Mustache_Compiler',
|
42 |
+
'Mustache_Context',
|
43 |
+
'Mustache_Exception',
|
44 |
+
'Mustache_Exception_InvalidArgumentException',
|
45 |
+
'Mustache_Exception_LogicException',
|
46 |
+
'Mustache_Exception_RuntimeException',
|
47 |
+
'Mustache_Exception_SyntaxException',
|
48 |
+
'Mustache_Exception_UnknownFilterException',
|
49 |
+
'Mustache_Exception_UnknownHelperException',
|
50 |
+
'Mustache_Exception_UnknownTemplateException',
|
51 |
+
'Mustache_HelperCollection',
|
52 |
+
'Mustache_LambdaHelper',
|
53 |
+
'Mustache_Loader',
|
54 |
+
'Mustache_Loader_ArrayLoader',
|
55 |
+
'Mustache_Loader_CascadingLoader',
|
56 |
+
'Mustache_Loader_FilesystemLoader',
|
57 |
+
'Mustache_Loader_InlineLoader',
|
58 |
+
'Mustache_Loader_MutableLoader',
|
59 |
+
'Mustache_Loader_StringLoader',
|
60 |
+
'Mustache_Logger',
|
61 |
+
'Mustache_Logger_AbstractLogger',
|
62 |
+
'Mustache_Logger_StreamLogger',
|
63 |
+
'Mustache_Parser',
|
64 |
+
'Mustache_Template',
|
65 |
+
'Mustache_Tokenizer',
|
66 |
+
), dirname($file), basename($file, '.php'));
|
67 |
+
|
68 |
+
/**
|
69 |
+
* SymfonyClassCollectionLoader.
|
70 |
+
*
|
71 |
+
* Based heavily on the Symfony ClassCollectionLoader component, with all
|
72 |
+
* the unnecessary bits removed.
|
73 |
+
*
|
74 |
+
* @license http://www.opensource.org/licenses/MIT
|
75 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
76 |
+
*/
|
77 |
+
class SymfonyClassCollectionLoader
|
78 |
+
{
|
79 |
+
private static $loaded;
|
80 |
+
|
81 |
+
const HEADER = <<<'EOS'
|
82 |
+
<?php
|
83 |
+
|
84 |
+
/*
|
85 |
+
* This file is part of Mustache.php.
|
86 |
+
*
|
87 |
+
* (c) 2010-%d Justin Hileman
|
88 |
+
*
|
89 |
+
* For the full copyright and license information, please view the LICENSE
|
90 |
+
* file that was distributed with this source code.
|
91 |
+
*/
|
92 |
+
EOS;
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Loads a list of classes and caches them in one big file.
|
96 |
+
*
|
97 |
+
* @param array $classes An array of classes to load
|
98 |
+
* @param string $cacheDir A cache directory
|
99 |
+
* @param string $name The cache name prefix
|
100 |
+
* @param string $extension File extension of the resulting file
|
101 |
+
*
|
102 |
+
* @throws InvalidArgumentException When class can't be loaded
|
103 |
+
*/
|
104 |
+
public static function load(array $classes, $cacheDir, $name, $extension = '.php')
|
105 |
+
{
|
106 |
+
// each $name can only be loaded once per PHP process
|
107 |
+
if (isset(self::$loaded[$name])) {
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
self::$loaded[$name] = true;
|
112 |
+
|
113 |
+
$content = '';
|
114 |
+
foreach ($classes as $class) {
|
115 |
+
if (!class_exists($class) && !interface_exists($class) && (!function_exists('trait_exists') || !trait_exists($class))) {
|
116 |
+
throw new InvalidArgumentException(sprintf('Unable to load class "%s"', $class));
|
117 |
+
}
|
118 |
+
|
119 |
+
$r = new ReflectionClass($class);
|
120 |
+
$content .= preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($r->getFileName()));
|
121 |
+
}
|
122 |
+
|
123 |
+
$cache = $cacheDir . '/' . $name . $extension;
|
124 |
+
$header = sprintf(self::HEADER, strftime('%Y'));
|
125 |
+
self::writeCacheFile($cache, $header . substr(self::stripComments('<?php ' . $content), 5));
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Writes a cache file.
|
130 |
+
*
|
131 |
+
* @param string $file Filename
|
132 |
+
* @param string $content Temporary file content
|
133 |
+
*
|
134 |
+
* @throws RuntimeException when a cache file cannot be written
|
135 |
+
*/
|
136 |
+
private static function writeCacheFile($file, $content)
|
137 |
+
{
|
138 |
+
$tmpFile = tempnam(dirname($file), basename($file));
|
139 |
+
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
|
140 |
+
chmod($file, 0666 & ~umask());
|
141 |
+
|
142 |
+
return;
|
143 |
+
}
|
144 |
+
|
145 |
+
throw new RuntimeException(sprintf('Failed to write cache file "%s".', $file));
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Removes comments from a PHP source string.
|
150 |
+
*
|
151 |
+
* We don't use the PHP php_strip_whitespace() function
|
152 |
+
* as we want the content to be readable and well-formatted.
|
153 |
+
*
|
154 |
+
* @param string $source A PHP string
|
155 |
+
*
|
156 |
+
* @return string The PHP string with the comments removed
|
157 |
+
*/
|
158 |
+
private static function stripComments($source)
|
159 |
+
{
|
160 |
+
if (!function_exists('token_get_all')) {
|
161 |
+
return $source;
|
162 |
+
}
|
163 |
+
|
164 |
+
$output = '';
|
165 |
+
foreach (token_get_all($source) as $token) {
|
166 |
+
if (is_string($token)) {
|
167 |
+
$output .= $token;
|
168 |
+
} elseif (!in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
|
169 |
+
$output .= $token[1];
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
// replace multiple new lines with a single newline
|
174 |
+
$output = preg_replace(array('/\s+$/Sm', '/\n+/S'), "\n", $output);
|
175 |
+
|
176 |
+
return $output;
|
177 |
+
}
|
178 |
+
}
|
vendor/mustache/mustache/composer.json
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "mustache/mustache",
|
3 |
+
"description": "A Mustache implementation in PHP.",
|
4 |
+
"keywords": ["templating", "mustache"],
|
5 |
+
"homepage": "https://github.com/bobthecow/mustache.php",
|
6 |
+
"type": "library",
|
7 |
+
"license": "MIT",
|
8 |
+
"authors": [
|
9 |
+
{
|
10 |
+
"name": "Justin Hileman",
|
11 |
+
"email": "justin@justinhileman.info",
|
12 |
+
"homepage": "http://justinhileman.com"
|
13 |
+
}
|
14 |
+
],
|
15 |
+
"require": {
|
16 |
+
"php": ">=5.2.4"
|
17 |
+
},
|
18 |
+
"require-dev": {
|
19 |
+
"phpunit/phpunit": "~3.7|~4.0|~5.0",
|
20 |
+
"friendsofphp/php-cs-fixer": "~1.11"
|
21 |
+
},
|
22 |
+
"autoload": {
|
23 |
+
"psr-0": { "Mustache": "src/" }
|
24 |
+
}
|
25 |
+
}
|
vendor/mustache/mustache/phpunit.xml.dist
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<phpunit backupGlobals="false" colors="true" bootstrap="./test/bootstrap.php">
|
3 |
+
<testsuite name="Mustache">
|
4 |
+
<directory suffix="Test.php">./test</directory>
|
5 |
+
<exclude>./test/Mustache/Test/FiveThree</exclude>
|
6 |
+
</testsuite>
|
7 |
+
|
8 |
+
<testsuite name="Mustache FiveThree">
|
9 |
+
<directory suffix="Test.php" phpVersion="5.3.0" phpVersionOperator=">=">./test/Mustache/Test/FiveThree</directory>
|
10 |
+
</testsuite>
|
11 |
+
|
12 |
+
<filter>
|
13 |
+
<whitelist>
|
14 |
+
<directory suffix=".php">./src/Mustache</directory>
|
15 |
+
</whitelist>
|
16 |
+
</filter>
|
17 |
+
</phpunit>
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Autoloader.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -16,6 +16,14 @@ class Mustache_Autoloader
|
|
16 |
{
|
17 |
private $baseDir;
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
/**
|
20 |
* Autoloader constructor.
|
21 |
*
|
@@ -45,7 +53,13 @@ class Mustache_Autoloader
|
|
45 |
*/
|
46 |
public static function register($baseDir = null)
|
47 |
{
|
48 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
spl_autoload_register(array($loader, 'autoload'));
|
50 |
|
51 |
return $loader;
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
16 |
{
|
17 |
private $baseDir;
|
18 |
|
19 |
+
/**
|
20 |
+
* An array where the key is the baseDir and the key is an instance of this
|
21 |
+
* class.
|
22 |
+
*
|
23 |
+
* @var array
|
24 |
+
*/
|
25 |
+
private static $instances;
|
26 |
+
|
27 |
/**
|
28 |
* Autoloader constructor.
|
29 |
*
|
53 |
*/
|
54 |
public static function register($baseDir = null)
|
55 |
{
|
56 |
+
$key = $baseDir ? $baseDir : 0;
|
57 |
+
|
58 |
+
if (!isset(self::$instances[$key])) {
|
59 |
+
self::$instances[$key] = new self($baseDir);
|
60 |
+
}
|
61 |
+
|
62 |
+
$loader = self::$instances[$key];
|
63 |
spl_autoload_register(array($loader, 'autoload'));
|
64 |
|
65 |
return $loader;
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Cache.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Cache/AbstractCache.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Cache/FilesystemCache.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -27,8 +27,8 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
|
|
27 |
/**
|
28 |
* Filesystem cache constructor.
|
29 |
*
|
30 |
-
* @param string $baseDir Directory for compiled templates
|
31 |
-
* @param int $fileMode Override default permissions for cache files. Defaults to using the system-defined umask
|
32 |
*/
|
33 |
public function __construct($baseDir, $fileMode = null)
|
34 |
{
|
@@ -108,9 +108,11 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
|
|
108 |
);
|
109 |
|
110 |
@mkdir($dirName, 0777, true);
|
|
|
111 |
if (!is_dir($dirName)) {
|
112 |
throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName));
|
113 |
}
|
|
|
114 |
}
|
115 |
|
116 |
return $dirName;
|
@@ -143,13 +145,17 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
|
|
143 |
return;
|
144 |
}
|
145 |
|
|
|
146 |
$this->log(
|
147 |
Mustache_Logger::ERROR,
|
148 |
'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"',
|
149 |
array('tempName' => $tempFile, 'fileName' => $fileName)
|
150 |
);
|
|
|
151 |
}
|
152 |
|
|
|
153 |
throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName));
|
|
|
154 |
}
|
155 |
}
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
27 |
/**
|
28 |
* Filesystem cache constructor.
|
29 |
*
|
30 |
+
* @param string $baseDir Directory for compiled templates
|
31 |
+
* @param int $fileMode Override default permissions for cache files. Defaults to using the system-defined umask
|
32 |
*/
|
33 |
public function __construct($baseDir, $fileMode = null)
|
34 |
{
|
108 |
);
|
109 |
|
110 |
@mkdir($dirName, 0777, true);
|
111 |
+
// @codeCoverageIgnoreStart
|
112 |
if (!is_dir($dirName)) {
|
113 |
throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName));
|
114 |
}
|
115 |
+
// @codeCoverageIgnoreEnd
|
116 |
}
|
117 |
|
118 |
return $dirName;
|
145 |
return;
|
146 |
}
|
147 |
|
148 |
+
// @codeCoverageIgnoreStart
|
149 |
$this->log(
|
150 |
Mustache_Logger::ERROR,
|
151 |
'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"',
|
152 |
array('tempName' => $tempFile, 'fileName' => $fileName)
|
153 |
);
|
154 |
+
// @codeCoverageIgnoreEnd
|
155 |
}
|
156 |
|
157 |
+
// @codeCoverageIgnoreStart
|
158 |
throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName));
|
159 |
+
// @codeCoverageIgnoreEnd
|
160 |
}
|
161 |
}
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Cache/NoopCache.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Compiler.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -75,7 +75,7 @@ class Mustache_Compiler
|
|
75 |
/**
|
76 |
* Helper function for walking the Mustache token parse tree.
|
77 |
*
|
78 |
-
* @throws Mustache_Exception_SyntaxException upon encountering unknown token types
|
79 |
*
|
80 |
* @param array $tree Parse tree of Mustache tokens
|
81 |
* @param int $level (default: 0)
|
@@ -191,7 +191,6 @@ class Mustache_Compiler
|
|
191 |
{
|
192 |
$this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context);
|
193 |
$buffer = \'\';
|
194 |
-
$newContext = array();
|
195 |
%s
|
196 |
|
197 |
return $buffer;
|
@@ -207,7 +206,6 @@ class Mustache_Compiler
|
|
207 |
public function renderInternal(Mustache_Context $context, $indent = \'\')
|
208 |
{
|
209 |
$buffer = \'\';
|
210 |
-
$newContext = array();
|
211 |
%s
|
212 |
|
213 |
return $buffer;
|
@@ -240,10 +238,11 @@ class Mustache_Compiler
|
|
240 |
$blockFunction = $context->findInBlock(%s);
|
241 |
if (is_callable($blockFunction)) {
|
242 |
$buffer .= call_user_func($blockFunction, $context);
|
243 |
-
|
244 |
-
}
|
245 |
';
|
246 |
|
|
|
|
|
247 |
/**
|
248 |
* Generate Mustache Template inheritance block variable PHP source.
|
249 |
*
|
@@ -261,10 +260,15 @@ class Mustache_Compiler
|
|
261 |
{
|
262 |
$id = var_export($id, true);
|
263 |
|
264 |
-
|
|
|
|
|
|
|
|
|
|
|
265 |
}
|
266 |
|
267 |
-
const BLOCK_ARG = '
|
268 |
|
269 |
/**
|
270 |
* Generate Mustache Template inheritance block argument PHP source.
|
@@ -285,7 +289,7 @@ class Mustache_Compiler
|
|
285 |
$keystr = var_export($key, true);
|
286 |
$id = var_export($id, true);
|
287 |
|
288 |
-
return sprintf($this->prepare(self::BLOCK_ARG,
|
289 |
}
|
290 |
|
291 |
const BLOCK_FUNCTION = '
|
@@ -326,6 +330,7 @@ class Mustache_Compiler
|
|
326 |
private function section%s(Mustache_Context $context, $indent, $value)
|
327 |
{
|
328 |
$buffer = \'\';
|
|
|
329 |
if (%s) {
|
330 |
$source = %s;
|
331 |
$result = call_user_func($value, $source, %s);
|
@@ -360,11 +365,10 @@ class Mustache_Compiler
|
|
360 |
* @param string $otag Current Mustache opening tag
|
361 |
* @param string $ctag Current Mustache closing tag
|
362 |
* @param int $level
|
363 |
-
* @param bool $arg (default: false)
|
364 |
*
|
365 |
* @return string Generated section PHP source code
|
366 |
*/
|
367 |
-
private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level
|
368 |
{
|
369 |
$source = var_export(substr($this->source, $start, $end - $start), true);
|
370 |
$callable = $this->getCallable();
|
@@ -384,15 +388,11 @@ class Mustache_Compiler
|
|
384 |
$this->sections[$key] = sprintf($this->prepare(self::SECTION), $key, $callable, $source, $helper, $delims, $this->walk($nodes, 2));
|
385 |
}
|
386 |
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
$method = $this->getFindMethod($id);
|
391 |
-
$id = var_export($id, true);
|
392 |
-
$filters = $this->getFilters($filters, $level);
|
393 |
|
394 |
-
|
395 |
-
}
|
396 |
}
|
397 |
|
398 |
const INVERTED_SECTION = '
|
@@ -454,15 +454,20 @@ class Mustache_Compiler
|
|
454 |
}
|
455 |
|
456 |
const PARENT = '
|
457 |
-
%s
|
458 |
-
|
459 |
-
|
460 |
-
$context->pushBlockContext($newContext);
|
461 |
$buffer .= $parent->renderInternal($context, $indent);
|
462 |
$context->popBlockContext();
|
463 |
}
|
464 |
';
|
465 |
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
/**
|
467 |
* Generate Mustache Template inheritance parent call PHP source.
|
468 |
*
|
@@ -477,11 +482,14 @@ class Mustache_Compiler
|
|
477 |
{
|
478 |
$realChildren = array_filter($children, array(__CLASS__, 'onlyBlockArgs'));
|
479 |
|
|
|
|
|
|
|
|
|
480 |
return sprintf(
|
481 |
$this->prepare(self::PARENT, $level),
|
482 |
-
$this->walk($realChildren, $level),
|
483 |
var_export($id, true),
|
484 |
-
|
485 |
);
|
486 |
}
|
487 |
|
@@ -490,7 +498,7 @@ class Mustache_Compiler
|
|
490 |
*
|
491 |
* @param array $node
|
492 |
*
|
493 |
-
* @return bool True if $node is a block arg token
|
494 |
*/
|
495 |
private static function onlyBlockArgs(array $node)
|
496 |
{
|
@@ -618,7 +626,7 @@ class Mustache_Compiler
|
|
618 |
/**
|
619 |
* Select the appropriate Context `find` method for a given $id.
|
620 |
*
|
621 |
-
* The return value will be one of `find`, `findDot` or `last`.
|
622 |
*
|
623 |
* @see Mustache_Context::find
|
624 |
* @see Mustache_Context::findDot
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
75 |
/**
|
76 |
* Helper function for walking the Mustache token parse tree.
|
77 |
*
|
78 |
+
* @throws Mustache_Exception_SyntaxException upon encountering unknown token types
|
79 |
*
|
80 |
* @param array $tree Parse tree of Mustache tokens
|
81 |
* @param int $level (default: 0)
|
191 |
{
|
192 |
$this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context);
|
193 |
$buffer = \'\';
|
|
|
194 |
%s
|
195 |
|
196 |
return $buffer;
|
206 |
public function renderInternal(Mustache_Context $context, $indent = \'\')
|
207 |
{
|
208 |
$buffer = \'\';
|
|
|
209 |
%s
|
210 |
|
211 |
return $buffer;
|
238 |
$blockFunction = $context->findInBlock(%s);
|
239 |
if (is_callable($blockFunction)) {
|
240 |
$buffer .= call_user_func($blockFunction, $context);
|
241 |
+
%s}
|
|
|
242 |
';
|
243 |
|
244 |
+
const BLOCK_VAR_ELSE = '} else {%s';
|
245 |
+
|
246 |
/**
|
247 |
* Generate Mustache Template inheritance block variable PHP source.
|
248 |
*
|
260 |
{
|
261 |
$id = var_export($id, true);
|
262 |
|
263 |
+
$else = $this->walk($nodes, $level);
|
264 |
+
if ($else !== '') {
|
265 |
+
$else = sprintf($this->prepare(self::BLOCK_VAR_ELSE, $level + 1, false, true), $else);
|
266 |
+
}
|
267 |
+
|
268 |
+
return sprintf($this->prepare(self::BLOCK_VAR, $level), $id, $else);
|
269 |
}
|
270 |
|
271 |
+
const BLOCK_ARG = '%s => array($this, \'block%s\'),';
|
272 |
|
273 |
/**
|
274 |
* Generate Mustache Template inheritance block argument PHP source.
|
289 |
$keystr = var_export($key, true);
|
290 |
$id = var_export($id, true);
|
291 |
|
292 |
+
return sprintf($this->prepare(self::BLOCK_ARG, $level), $id, $key);
|
293 |
}
|
294 |
|
295 |
const BLOCK_FUNCTION = '
|
330 |
private function section%s(Mustache_Context $context, $indent, $value)
|
331 |
{
|
332 |
$buffer = \'\';
|
333 |
+
|
334 |
if (%s) {
|
335 |
$source = %s;
|
336 |
$result = call_user_func($value, $source, %s);
|
365 |
* @param string $otag Current Mustache opening tag
|
366 |
* @param string $ctag Current Mustache closing tag
|
367 |
* @param int $level
|
|
|
368 |
*
|
369 |
* @return string Generated section PHP source code
|
370 |
*/
|
371 |
+
private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level)
|
372 |
{
|
373 |
$source = var_export(substr($this->source, $start, $end - $start), true);
|
374 |
$callable = $this->getCallable();
|
388 |
$this->sections[$key] = sprintf($this->prepare(self::SECTION), $key, $callable, $source, $helper, $delims, $this->walk($nodes, 2));
|
389 |
}
|
390 |
|
391 |
+
$method = $this->getFindMethod($id);
|
392 |
+
$id = var_export($id, true);
|
393 |
+
$filters = $this->getFilters($filters, $level);
|
|
|
|
|
|
|
394 |
|
395 |
+
return sprintf($this->prepare(self::SECTION_CALL, $level), $id, $method, $id, $filters, $key);
|
|
|
396 |
}
|
397 |
|
398 |
const INVERTED_SECTION = '
|
454 |
}
|
455 |
|
456 |
const PARENT = '
|
457 |
+
if ($parent = $this->mustache->loadPartial(%s)) {
|
458 |
+
$context->pushBlockContext(array(%s
|
459 |
+
));
|
|
|
460 |
$buffer .= $parent->renderInternal($context, $indent);
|
461 |
$context->popBlockContext();
|
462 |
}
|
463 |
';
|
464 |
|
465 |
+
const PARENT_NO_CONTEXT = '
|
466 |
+
if ($parent = $this->mustache->loadPartial(%s)) {
|
467 |
+
$buffer .= $parent->renderInternal($context, $indent);
|
468 |
+
}
|
469 |
+
';
|
470 |
+
|
471 |
/**
|
472 |
* Generate Mustache Template inheritance parent call PHP source.
|
473 |
*
|
482 |
{
|
483 |
$realChildren = array_filter($children, array(__CLASS__, 'onlyBlockArgs'));
|
484 |
|
485 |
+
if (empty($realChildren)) {
|
486 |
+
return sprintf($this->prepare(self::PARENT_NO_CONTEXT, $level), var_export($id, true));
|
487 |
+
}
|
488 |
+
|
489 |
return sprintf(
|
490 |
$this->prepare(self::PARENT, $level),
|
|
|
491 |
var_export($id, true),
|
492 |
+
$this->walk($realChildren, $level + 1)
|
493 |
);
|
494 |
}
|
495 |
|
498 |
*
|
499 |
* @param array $node
|
500 |
*
|
501 |
+
* @return bool True if $node is a block arg token
|
502 |
*/
|
503 |
private static function onlyBlockArgs(array $node)
|
504 |
{
|
626 |
/**
|
627 |
* Select the appropriate Context `find` method for a given $id.
|
628 |
*
|
629 |
+
* The return value will be one of `find`, `findDot`, `findAnchoredDot` or `last`.
|
630 |
*
|
631 |
* @see Mustache_Context::find
|
632 |
* @see Mustache_Context::findDot
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Context.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -150,7 +150,7 @@ class Mustache_Context
|
|
150 |
*
|
151 |
* @see Mustache_Context::findDot
|
152 |
*
|
153 |
-
* @throws Mustache_Exception_InvalidArgumentException if given an invalid anchored dot $id
|
154 |
*
|
155 |
* @param string $id Dotted variable selector
|
156 |
*
|
@@ -182,7 +182,7 @@ class Mustache_Context
|
|
182 |
*
|
183 |
* @param string $id
|
184 |
*
|
185 |
-
* @return mixed Variable value, or '' if not found
|
186 |
*/
|
187 |
public function findInBlock($id)
|
188 |
{
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
150 |
*
|
151 |
* @see Mustache_Context::findDot
|
152 |
*
|
153 |
+
* @throws Mustache_Exception_InvalidArgumentException if given an invalid anchored dot $id
|
154 |
*
|
155 |
* @param string $id Dotted variable selector
|
156 |
*
|
182 |
*
|
183 |
* @param string $id
|
184 |
*
|
185 |
+
* @return mixed Variable value, or '' if not found
|
186 |
*/
|
187 |
public function findInBlock($id)
|
188 |
{
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Engine.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -23,7 +23,7 @@
|
|
23 |
*/
|
24 |
class Mustache_Engine
|
25 |
{
|
26 |
-
const VERSION = '2.
|
27 |
const SPEC_VERSION = '1.1.2';
|
28 |
|
29 |
const PRAGMA_FILTERS = 'FILTERS';
|
@@ -54,6 +54,7 @@ class Mustache_Engine
|
|
54 |
private $logger;
|
55 |
private $strictCallables = false;
|
56 |
private $pragmas = array();
|
|
|
57 |
|
58 |
// Services
|
59 |
private $tokenizer;
|
@@ -81,6 +82,14 @@ class Mustache_Engine
|
|
81 |
* // sections are often too dynamic to benefit from caching.
|
82 |
* 'cache_lambda_templates' => true,
|
83 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
* // A Mustache template loader instance. Uses a StringLoader if not specified.
|
85 |
* 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'),
|
86 |
*
|
@@ -126,13 +135,17 @@ class Mustache_Engine
|
|
126 |
* 'pragmas' => [Mustache_Engine::PRAGMA_FILTERS],
|
127 |
* );
|
128 |
*
|
129 |
-
* @throws Mustache_Exception_InvalidArgumentException If `escape` option is not callable
|
130 |
*
|
131 |
* @param array $options (default: array())
|
132 |
*/
|
133 |
public function __construct(array $options = array())
|
134 |
{
|
135 |
if (isset($options['template_class_prefix'])) {
|
|
|
|
|
|
|
|
|
136 |
$this->templateClassPrefix = $options['template_class_prefix'];
|
137 |
}
|
138 |
|
@@ -191,6 +204,10 @@ class Mustache_Engine
|
|
191 |
$this->strictCallables = $options['strict_callables'];
|
192 |
}
|
193 |
|
|
|
|
|
|
|
|
|
194 |
if (isset($options['pragmas'])) {
|
195 |
foreach ($options['pragmas'] as $pragma) {
|
196 |
if (!isset(self::$knownPragmas[$pragma])) {
|
@@ -429,7 +446,7 @@ class Mustache_Engine
|
|
429 |
/**
|
430 |
* Set the Mustache Logger instance.
|
431 |
*
|
432 |
-
* @throws Mustache_Exception_InvalidArgumentException If logger is not an instance of Mustache_Logger or Psr\Log\LoggerInterface
|
433 |
*
|
434 |
* @param Mustache_Logger|Psr\Log\LoggerInterface $logger
|
435 |
*/
|
@@ -589,22 +606,43 @@ class Mustache_Engine
|
|
589 |
/**
|
590 |
* Helper method to generate a Mustache template class.
|
591 |
*
|
592 |
-
*
|
|
|
|
|
|
|
593 |
*
|
594 |
* @return string Mustache Template class name
|
595 |
*/
|
596 |
public function getTemplateClassName($source)
|
597 |
{
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
608 |
}
|
609 |
|
610 |
/**
|
@@ -681,8 +719,8 @@ class Mustache_Engine
|
|
681 |
* @see Mustache_Engine::loadPartial
|
682 |
* @see Mustache_Engine::loadLambda
|
683 |
*
|
684 |
-
* @param string
|
685 |
-
* @param Mustache_Cache
|
686 |
*
|
687 |
* @return Mustache_Template
|
688 |
*/
|
@@ -725,7 +763,7 @@ class Mustache_Engine
|
|
725 |
*/
|
726 |
private function tokenize($source)
|
727 |
{
|
728 |
-
return $this->getTokenizer()->scan($source);
|
729 |
}
|
730 |
|
731 |
/**
|
@@ -750,13 +788,12 @@ class Mustache_Engine
|
|
750 |
*
|
751 |
* @see Mustache_Compiler::compile
|
752 |
*
|
753 |
-
* @param string $source
|
754 |
*
|
755 |
* @return string generated Mustache template class code
|
756 |
*/
|
757 |
private function compile($source)
|
758 |
{
|
759 |
-
$tree = $this->parse($source);
|
760 |
$name = $this->getTemplateClassName($source);
|
761 |
|
762 |
$this->log(
|
@@ -765,6 +802,11 @@ class Mustache_Engine
|
|
765 |
array('className' => $name)
|
766 |
);
|
767 |
|
|
|
|
|
|
|
|
|
|
|
768 |
$compiler = $this->getCompiler();
|
769 |
$compiler->setPragmas($this->getPragmas());
|
770 |
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
23 |
*/
|
24 |
class Mustache_Engine
|
25 |
{
|
26 |
+
const VERSION = '2.12.0';
|
27 |
const SPEC_VERSION = '1.1.2';
|
28 |
|
29 |
const PRAGMA_FILTERS = 'FILTERS';
|
54 |
private $logger;
|
55 |
private $strictCallables = false;
|
56 |
private $pragmas = array();
|
57 |
+
private $delimiters;
|
58 |
|
59 |
// Services
|
60 |
private $tokenizer;
|
82 |
* // sections are often too dynamic to benefit from caching.
|
83 |
* 'cache_lambda_templates' => true,
|
84 |
*
|
85 |
+
* // Customize the tag delimiters used by this engine instance. Note that overriding here changes the
|
86 |
+
* // delimiters used to parse all templates and partials loaded by this instance. To override just for a
|
87 |
+
* // single template, use an inline "change delimiters" tag at the start of the template file:
|
88 |
+
* //
|
89 |
+
* // {{=<% %>=}}
|
90 |
+
* //
|
91 |
+
* 'delimiters' => '<% %>',
|
92 |
+
*
|
93 |
* // A Mustache template loader instance. Uses a StringLoader if not specified.
|
94 |
* 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'),
|
95 |
*
|
135 |
* 'pragmas' => [Mustache_Engine::PRAGMA_FILTERS],
|
136 |
* );
|
137 |
*
|
138 |
+
* @throws Mustache_Exception_InvalidArgumentException If `escape` option is not callable
|
139 |
*
|
140 |
* @param array $options (default: array())
|
141 |
*/
|
142 |
public function __construct(array $options = array())
|
143 |
{
|
144 |
if (isset($options['template_class_prefix'])) {
|
145 |
+
if ((string) $options['template_class_prefix'] === '') {
|
146 |
+
throw new Mustache_Exception_InvalidArgumentException('Mustache Constructor "template_class_prefix" must not be empty');
|
147 |
+
}
|
148 |
+
|
149 |
$this->templateClassPrefix = $options['template_class_prefix'];
|
150 |
}
|
151 |
|
204 |
$this->strictCallables = $options['strict_callables'];
|
205 |
}
|
206 |
|
207 |
+
if (isset($options['delimiters'])) {
|
208 |
+
$this->delimiters = $options['delimiters'];
|
209 |
+
}
|
210 |
+
|
211 |
if (isset($options['pragmas'])) {
|
212 |
foreach ($options['pragmas'] as $pragma) {
|
213 |
if (!isset(self::$knownPragmas[$pragma])) {
|
446 |
/**
|
447 |
* Set the Mustache Logger instance.
|
448 |
*
|
449 |
+
* @throws Mustache_Exception_InvalidArgumentException If logger is not an instance of Mustache_Logger or Psr\Log\LoggerInterface
|
450 |
*
|
451 |
* @param Mustache_Logger|Psr\Log\LoggerInterface $logger
|
452 |
*/
|
606 |
/**
|
607 |
* Helper method to generate a Mustache template class.
|
608 |
*
|
609 |
+
* This method must be updated any time options are added which make it so
|
610 |
+
* the same template could be parsed and compiled multiple different ways.
|
611 |
+
*
|
612 |
+
* @param string|Mustache_Source $source
|
613 |
*
|
614 |
* @return string Mustache Template class name
|
615 |
*/
|
616 |
public function getTemplateClassName($source)
|
617 |
{
|
618 |
+
// For the most part, adding a new option here should do the trick.
|
619 |
+
//
|
620 |
+
// Pick a value here which is unique for each possible way the template
|
621 |
+
// could be compiled... but not necessarily unique per option value. See
|
622 |
+
// escape below, which only needs to differentiate between 'custom' and
|
623 |
+
// 'default' escapes.
|
624 |
+
//
|
625 |
+
// Keep this list in alphabetical order :)
|
626 |
+
$chunks = array(
|
627 |
+
'charset' => $this->charset,
|
628 |
+
'delimiters' => $this->delimiters ? $this->delimiters : '{{ }}',
|
629 |
+
'entityFlags' => $this->entityFlags,
|
630 |
+
'escape' => isset($this->escape) ? 'custom' : 'default',
|
631 |
+
'key' => ($source instanceof Mustache_Source) ? $source->getKey() : 'source',
|
632 |
+
'pragmas' => $this->getPragmas(),
|
633 |
+
'strictCallables' => $this->strictCallables,
|
634 |
+
'version' => self::VERSION,
|
635 |
+
);
|
636 |
+
|
637 |
+
$key = json_encode($chunks);
|
638 |
+
|
639 |
+
// Template Source instances have already provided their own source key. For strings, just include the whole
|
640 |
+
// source string in the md5 hash.
|
641 |
+
if (!$source instanceof Mustache_Source) {
|
642 |
+
$key .= "\n" . $source;
|
643 |
+
}
|
644 |
+
|
645 |
+
return $this->templateClassPrefix . md5($key);
|
646 |
}
|
647 |
|
648 |
/**
|
719 |
* @see Mustache_Engine::loadPartial
|
720 |
* @see Mustache_Engine::loadLambda
|
721 |
*
|
722 |
+
* @param string|Mustache_Source $source
|
723 |
+
* @param Mustache_Cache $cache (default: null)
|
724 |
*
|
725 |
* @return Mustache_Template
|
726 |
*/
|
763 |
*/
|
764 |
private function tokenize($source)
|
765 |
{
|
766 |
+
return $this->getTokenizer()->scan($source, $this->delimiters);
|
767 |
}
|
768 |
|
769 |
/**
|
788 |
*
|
789 |
* @see Mustache_Compiler::compile
|
790 |
*
|
791 |
+
* @param string|Mustache_Source $source
|
792 |
*
|
793 |
* @return string generated Mustache template class code
|
794 |
*/
|
795 |
private function compile($source)
|
796 |
{
|
|
|
797 |
$name = $this->getTemplateClassName($source);
|
798 |
|
799 |
$this->log(
|
802 |
array('className' => $name)
|
803 |
);
|
804 |
|
805 |
+
if ($source instanceof Mustache_Source) {
|
806 |
+
$source = $source->getSource();
|
807 |
+
}
|
808 |
+
$tree = $this->parse($source);
|
809 |
+
|
810 |
$compiler = $this->getCompiler();
|
811 |
$compiler->setPragmas($this->getPragmas());
|
812 |
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Exception.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Exception/InvalidArgumentException.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Exception/LogicException.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Exception/RuntimeException.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Exception/SyntaxException.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -17,13 +17,18 @@ class Mustache_Exception_SyntaxException extends LogicException implements Musta
|
|
17 |
protected $token;
|
18 |
|
19 |
/**
|
20 |
-
* @param string
|
21 |
-
* @param array
|
|
|
22 |
*/
|
23 |
-
public function __construct($msg, array $token)
|
24 |
{
|
25 |
$this->token = $token;
|
26 |
-
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
/**
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
17 |
protected $token;
|
18 |
|
19 |
/**
|
20 |
+
* @param string $msg
|
21 |
+
* @param array $token
|
22 |
+
* @param Exception $previous
|
23 |
*/
|
24 |
+
public function __construct($msg, array $token, Exception $previous = null)
|
25 |
{
|
26 |
$this->token = $token;
|
27 |
+
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
28 |
+
parent::__construct($msg, 0, $previous);
|
29 |
+
} else {
|
30 |
+
parent::__construct($msg); // @codeCoverageIgnore
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
/**
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Exception/UnknownFilterException.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -17,12 +17,18 @@ class Mustache_Exception_UnknownFilterException extends UnexpectedValueException
|
|
17 |
protected $filterName;
|
18 |
|
19 |
/**
|
20 |
-
* @param string
|
|
|
21 |
*/
|
22 |
-
public function __construct($filterName)
|
23 |
{
|
24 |
$this->filterName = $filterName;
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
public function getFilterName()
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
17 |
protected $filterName;
|
18 |
|
19 |
/**
|
20 |
+
* @param string $filterName
|
21 |
+
* @param Exception $previous
|
22 |
*/
|
23 |
+
public function __construct($filterName, Exception $previous = null)
|
24 |
{
|
25 |
$this->filterName = $filterName;
|
26 |
+
$message = sprintf('Unknown filter: %s', $filterName);
|
27 |
+
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
28 |
+
parent::__construct($message, 0, $previous);
|
29 |
+
} else {
|
30 |
+
parent::__construct($message); // @codeCoverageIgnore
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
public function getFilterName()
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Exception/UnknownHelperException.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -17,12 +17,18 @@ class Mustache_Exception_UnknownHelperException extends InvalidArgumentException
|
|
17 |
protected $helperName;
|
18 |
|
19 |
/**
|
20 |
-
* @param string
|
|
|
21 |
*/
|
22 |
-
public function __construct($helperName)
|
23 |
{
|
24 |
$this->helperName = $helperName;
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
public function getHelperName()
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
17 |
protected $helperName;
|
18 |
|
19 |
/**
|
20 |
+
* @param string $helperName
|
21 |
+
* @param Exception $previous
|
22 |
*/
|
23 |
+
public function __construct($helperName, Exception $previous = null)
|
24 |
{
|
25 |
$this->helperName = $helperName;
|
26 |
+
$message = sprintf('Unknown helper: %s', $helperName);
|
27 |
+
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
28 |
+
parent::__construct($message, 0, $previous);
|
29 |
+
} else {
|
30 |
+
parent::__construct($message); // @codeCoverageIgnore
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
public function getHelperName()
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Exception/UnknownTemplateException.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -17,12 +17,18 @@ class Mustache_Exception_UnknownTemplateException extends InvalidArgumentExcepti
|
|
17 |
protected $templateName;
|
18 |
|
19 |
/**
|
20 |
-
* @param string
|
|
|
21 |
*/
|
22 |
-
public function __construct($templateName)
|
23 |
{
|
24 |
$this->templateName = $templateName;
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
public function getTemplateName()
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
17 |
protected $templateName;
|
18 |
|
19 |
/**
|
20 |
+
* @param string $templateName
|
21 |
+
* @param Exception $previous
|
22 |
*/
|
23 |
+
public function __construct($templateName, Exception $previous = null)
|
24 |
{
|
25 |
$this->templateName = $templateName;
|
26 |
+
$message = sprintf('Unknown template: %s', $templateName);
|
27 |
+
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
28 |
+
parent::__construct($message, 0, $previous);
|
29 |
+
} else {
|
30 |
+
parent::__construct($message); // @codeCoverageIgnore
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
public function getTemplateName()
|
{lib/php → vendor/mustache/mustache/src}/Mustache/HelperCollection.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -81,7 +81,7 @@ class Mustache_HelperCollection
|
|
81 |
/**
|
82 |
* Get a helper by name.
|
83 |
*
|
84 |
-
* @throws Mustache_Exception_UnknownHelperException If helper does not exist
|
85 |
*
|
86 |
* @param string $name
|
87 |
*
|
@@ -137,7 +137,7 @@ class Mustache_HelperCollection
|
|
137 |
/**
|
138 |
* Check whether a given helper is present in the collection.
|
139 |
*
|
140 |
-
* @throws Mustache_Exception_UnknownHelperException if the requested helper is not present
|
141 |
*
|
142 |
* @param string $name
|
143 |
*/
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
81 |
/**
|
82 |
* Get a helper by name.
|
83 |
*
|
84 |
+
* @throws Mustache_Exception_UnknownHelperException If helper does not exist
|
85 |
*
|
86 |
* @param string $name
|
87 |
*
|
137 |
/**
|
138 |
* Check whether a given helper is present in the collection.
|
139 |
*
|
140 |
+
* @throws Mustache_Exception_UnknownHelperException if the requested helper is not present
|
141 |
*
|
142 |
* @param string $name
|
143 |
*/
|
{lib/php → vendor/mustache/mustache/src}/Mustache/LambdaHelper.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -25,8 +25,8 @@ class Mustache_LambdaHelper
|
|
25 |
/**
|
26 |
* Mustache Lambda Helper constructor.
|
27 |
*
|
28 |
-
* @param Mustache_Engine $mustache Mustache engine instance
|
29 |
-
* @param Mustache_Context $context Rendering context
|
30 |
* @param string $delims Optional custom delimiters, in the format `{{= <% %> =}}`. (default: null)
|
31 |
*/
|
32 |
public function __construct(Mustache_Engine $mustache, Mustache_Context $context, $delims = null)
|
@@ -41,7 +41,7 @@ class Mustache_LambdaHelper
|
|
41 |
*
|
42 |
* @param string $string
|
43 |
*
|
44 |
-
* @return string Rendered template
|
45 |
*/
|
46 |
public function render($string)
|
47 |
{
|
@@ -65,7 +65,7 @@ class Mustache_LambdaHelper
|
|
65 |
/**
|
66 |
* Get a Lambda Helper with custom delimiters.
|
67 |
*
|
68 |
-
* @param string $delims Custom delimiters, in the format `{{= <% %> =}}
|
69 |
*
|
70 |
* @return Mustache_LambdaHelper
|
71 |
*/
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
25 |
/**
|
26 |
* Mustache Lambda Helper constructor.
|
27 |
*
|
28 |
+
* @param Mustache_Engine $mustache Mustache engine instance
|
29 |
+
* @param Mustache_Context $context Rendering context
|
30 |
* @param string $delims Optional custom delimiters, in the format `{{= <% %> =}}`. (default: null)
|
31 |
*/
|
32 |
public function __construct(Mustache_Engine $mustache, Mustache_Context $context, $delims = null)
|
41 |
*
|
42 |
* @param string $string
|
43 |
*
|
44 |
+
* @return string Rendered template
|
45 |
*/
|
46 |
public function render($string)
|
47 |
{
|
65 |
/**
|
66 |
* Get a Lambda Helper with custom delimiters.
|
67 |
*
|
68 |
+
* @param string $delims Custom delimiters, in the format `{{= <% %> =}}`
|
69 |
*
|
70 |
* @return Mustache_LambdaHelper
|
71 |
*/
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Loader.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -17,11 +17,11 @@ interface Mustache_Loader
|
|
17 |
/**
|
18 |
* Load a Template by name.
|
19 |
*
|
20 |
-
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
21 |
*
|
22 |
* @param string $name
|
23 |
*
|
24 |
-
* @return string Mustache Template source
|
25 |
*/
|
26 |
public function load($name);
|
27 |
}
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
17 |
/**
|
18 |
* Load a Template by name.
|
19 |
*
|
20 |
+
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
21 |
*
|
22 |
* @param string $name
|
23 |
*
|
24 |
+
* @return string|Mustache_Source Mustache Template source
|
25 |
*/
|
26 |
public function load($name);
|
27 |
}
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Loader/ArrayLoader.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -41,7 +41,7 @@ class Mustache_Loader_ArrayLoader implements Mustache_Loader, Mustache_Loader_Mu
|
|
41 |
/**
|
42 |
* Load a Template.
|
43 |
*
|
44 |
-
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
45 |
*
|
46 |
* @param string $name
|
47 |
*
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
41 |
/**
|
42 |
* Load a Template.
|
43 |
*
|
44 |
+
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
45 |
*
|
46 |
* @param string $name
|
47 |
*
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Loader/CascadingLoader.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -48,7 +48,7 @@ class Mustache_Loader_CascadingLoader implements Mustache_Loader
|
|
48 |
/**
|
49 |
* Load a Template by name.
|
50 |
*
|
51 |
-
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
52 |
*
|
53 |
* @param string $name
|
54 |
*
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
48 |
/**
|
49 |
* Load a Template by name.
|
50 |
*
|
51 |
+
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
52 |
*
|
53 |
* @param string $name
|
54 |
*
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Loader/FilesystemLoader.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -40,9 +40,9 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
|
|
40 |
* 'extension' => '.ms',
|
41 |
* );
|
42 |
*
|
43 |
-
* @throws Mustache_Exception_RuntimeException if $baseDir does not exist
|
44 |
*
|
45 |
-
* @param string $baseDir Base directory containing Mustache template files
|
46 |
* @param array $options Array of Loader options (default: array())
|
47 |
*/
|
48 |
public function __construct($baseDir, array $options = array())
|
@@ -53,7 +53,7 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
|
|
53 |
$this->baseDir = realpath($this->baseDir);
|
54 |
}
|
55 |
|
56 |
-
if (!is_dir($this->baseDir)) {
|
57 |
throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir));
|
58 |
}
|
59 |
|
@@ -88,7 +88,7 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
|
|
88 |
/**
|
89 |
* Helper function for loading a Mustache file by name.
|
90 |
*
|
91 |
-
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
92 |
*
|
93 |
* @param string $name
|
94 |
*
|
@@ -98,7 +98,7 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
|
|
98 |
{
|
99 |
$fileName = $this->getFileName($name);
|
100 |
|
101 |
-
if (!file_exists($fileName)) {
|
102 |
throw new Mustache_Exception_UnknownTemplateException($name);
|
103 |
}
|
104 |
|
@@ -121,4 +121,15 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
|
|
121 |
|
122 |
return $fileName;
|
123 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
40 |
* 'extension' => '.ms',
|
41 |
* );
|
42 |
*
|
43 |
+
* @throws Mustache_Exception_RuntimeException if $baseDir does not exist
|
44 |
*
|
45 |
+
* @param string $baseDir Base directory containing Mustache template files
|
46 |
* @param array $options Array of Loader options (default: array())
|
47 |
*/
|
48 |
public function __construct($baseDir, array $options = array())
|
53 |
$this->baseDir = realpath($this->baseDir);
|
54 |
}
|
55 |
|
56 |
+
if ($this->shouldCheckPath() && !is_dir($this->baseDir)) {
|
57 |
throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir));
|
58 |
}
|
59 |
|
88 |
/**
|
89 |
* Helper function for loading a Mustache file by name.
|
90 |
*
|
91 |
+
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
92 |
*
|
93 |
* @param string $name
|
94 |
*
|
98 |
{
|
99 |
$fileName = $this->getFileName($name);
|
100 |
|
101 |
+
if ($this->shouldCheckPath() && !file_exists($fileName)) {
|
102 |
throw new Mustache_Exception_UnknownTemplateException($name);
|
103 |
}
|
104 |
|
121 |
|
122 |
return $fileName;
|
123 |
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Only check if baseDir is a directory and requested templates are files if
|
127 |
+
* baseDir is using the filesystem stream wrapper.
|
128 |
+
*
|
129 |
+
* @return bool Whether to check `is_dir` and `file_exists`
|
130 |
+
*/
|
131 |
+
protected function shouldCheckPath()
|
132 |
+
{
|
133 |
+
return strpos($this->baseDir, '://') === false || strpos($this->baseDir, 'file://') === 0;
|
134 |
+
}
|
135 |
}
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Loader/InlineLoader.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -68,7 +68,7 @@ class Mustache_Loader_InlineLoader implements Mustache_Loader
|
|
68 |
* @param string $fileName The file to parse for inline templates
|
69 |
* @param int $offset A string offset for the start of the templates.
|
70 |
* This usually coincides with the `__halt_compiler`
|
71 |
-
* call, and the `__COMPILER_HALT_OFFSET__
|
72 |
*/
|
73 |
public function __construct($fileName, $offset)
|
74 |
{
|
@@ -87,7 +87,7 @@ class Mustache_Loader_InlineLoader implements Mustache_Loader
|
|
87 |
/**
|
88 |
* Load a Template by name.
|
89 |
*
|
90 |
-
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
91 |
*
|
92 |
* @param string $name
|
93 |
*
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
68 |
* @param string $fileName The file to parse for inline templates
|
69 |
* @param int $offset A string offset for the start of the templates.
|
70 |
* This usually coincides with the `__halt_compiler`
|
71 |
+
* call, and the `__COMPILER_HALT_OFFSET__`
|
72 |
*/
|
73 |
public function __construct($fileName, $offset)
|
74 |
{
|
87 |
/**
|
88 |
* Load a Template by name.
|
89 |
*
|
90 |
+
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
91 |
*
|
92 |
* @param string $name
|
93 |
*
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Loader/MutableLoader.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
vendor/mustache/mustache/src/Mustache/Loader/ProductionFilesystemLoader.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Mustache Template production filesystem Loader implementation.
|
14 |
+
*
|
15 |
+
* A production-ready FilesystemLoader, which doesn't require reading a file if it already exists in the template cache.
|
16 |
+
*
|
17 |
+
* {@inheritdoc}
|
18 |
+
*/
|
19 |
+
class Mustache_Loader_ProductionFilesystemLoader extends Mustache_Loader_FilesystemLoader
|
20 |
+
{
|
21 |
+
private $statProps;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Mustache production filesystem Loader constructor.
|
25 |
+
*
|
26 |
+
* Passing an $options array allows overriding certain Loader options during instantiation:
|
27 |
+
*
|
28 |
+
* $options = array(
|
29 |
+
* // The filename extension used for Mustache templates. Defaults to '.mustache'
|
30 |
+
* 'extension' => '.ms',
|
31 |
+
* 'stat_props' => array('size', 'mtime'),
|
32 |
+
* );
|
33 |
+
*
|
34 |
+
* Specifying 'stat_props' overrides the stat properties used to invalidate the template cache. By default, this
|
35 |
+
* uses 'mtime' and 'size', but this can be set to any of the properties supported by stat():
|
36 |
+
*
|
37 |
+
* http://php.net/manual/en/function.stat.php
|
38 |
+
*
|
39 |
+
* You can also disable filesystem stat entirely:
|
40 |
+
*
|
41 |
+
* $options = array('stat_props' => null);
|
42 |
+
*
|
43 |
+
* But with great power comes great responsibility. Namely, if you disable stat-based cache invalidation,
|
44 |
+
* YOU MUST CLEAR THE TEMPLATE CACHE YOURSELF when your templates change. Make it part of your build or deploy
|
45 |
+
* process so you don't forget!
|
46 |
+
*
|
47 |
+
* @throws Mustache_Exception_RuntimeException if $baseDir does not exist.
|
48 |
+
*
|
49 |
+
* @param string $baseDir Base directory containing Mustache template files.
|
50 |
+
* @param array $options Array of Loader options (default: array())
|
51 |
+
*/
|
52 |
+
public function __construct($baseDir, array $options = array())
|
53 |
+
{
|
54 |
+
parent::__construct($baseDir, $options);
|
55 |
+
|
56 |
+
if (array_key_exists('stat_props', $options)) {
|
57 |
+
if (empty($options['stat_props'])) {
|
58 |
+
$this->statProps = array();
|
59 |
+
} else {
|
60 |
+
$this->statProps = $options['stat_props'];
|
61 |
+
}
|
62 |
+
} else {
|
63 |
+
$this->statProps = array('size', 'mtime');
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Helper function for loading a Mustache file by name.
|
69 |
+
*
|
70 |
+
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
|
71 |
+
*
|
72 |
+
* @param string $name
|
73 |
+
*
|
74 |
+
* @return Mustache_Source Mustache Template source
|
75 |
+
*/
|
76 |
+
protected function loadFile($name)
|
77 |
+
{
|
78 |
+
$fileName = $this->getFileName($name);
|
79 |
+
|
80 |
+
if (!file_exists($fileName)) {
|
81 |
+
throw new Mustache_Exception_UnknownTemplateException($name);
|
82 |
+
}
|
83 |
+
|
84 |
+
return new Mustache_Source_FilesystemSource($fileName, $this->statProps);
|
85 |
+
}
|
86 |
+
}
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Loader/StringLoader.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Logger.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Logger/AbstractLogger.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Logger/StreamLogger.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -36,7 +36,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|
36 |
protected $url = null;
|
37 |
|
38 |
/**
|
39 |
-
* @throws InvalidArgumentException if the logging level is unknown
|
40 |
*
|
41 |
* @param resource|string $stream Resource instance or URL
|
42 |
* @param int $level The minimum logging level at which this handler will be triggered
|
@@ -65,7 +65,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|
65 |
/**
|
66 |
* Set the minimum logging level.
|
67 |
*
|
68 |
-
* @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown
|
69 |
*
|
70 |
* @param int $level The minimum logging level which will be written
|
71 |
*/
|
@@ -91,7 +91,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|
91 |
/**
|
92 |
* Logs with an arbitrary level.
|
93 |
*
|
94 |
-
* @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown
|
95 |
*
|
96 |
* @param mixed $level
|
97 |
* @param string $message
|
@@ -111,8 +111,8 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|
111 |
/**
|
112 |
* Write a record to the log.
|
113 |
*
|
114 |
-
* @throws Mustache_Exception_LogicException If neither a stream resource nor url is present
|
115 |
-
* @throws Mustache_Exception_RuntimeException If the stream url cannot be opened
|
116 |
*
|
117 |
* @param int $level The logging level
|
118 |
* @param string $message The log message
|
@@ -139,7 +139,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|
139 |
/**
|
140 |
* Gets the name of the logging level.
|
141 |
*
|
142 |
-
* @throws InvalidArgumentException if the logging level is unknown
|
143 |
*
|
144 |
* @param int $level
|
145 |
*
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
36 |
protected $url = null;
|
37 |
|
38 |
/**
|
39 |
+
* @throws InvalidArgumentException if the logging level is unknown
|
40 |
*
|
41 |
* @param resource|string $stream Resource instance or URL
|
42 |
* @param int $level The minimum logging level at which this handler will be triggered
|
65 |
/**
|
66 |
* Set the minimum logging level.
|
67 |
*
|
68 |
+
* @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown
|
69 |
*
|
70 |
* @param int $level The minimum logging level which will be written
|
71 |
*/
|
91 |
/**
|
92 |
* Logs with an arbitrary level.
|
93 |
*
|
94 |
+
* @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown
|
95 |
*
|
96 |
* @param mixed $level
|
97 |
* @param string $message
|
111 |
/**
|
112 |
* Write a record to the log.
|
113 |
*
|
114 |
+
* @throws Mustache_Exception_LogicException If neither a stream resource nor url is present
|
115 |
+
* @throws Mustache_Exception_RuntimeException If the stream url cannot be opened
|
116 |
*
|
117 |
* @param int $level The logging level
|
118 |
* @param string $message The log message
|
139 |
/**
|
140 |
* Gets the name of the logging level.
|
141 |
*
|
142 |
+
* @throws InvalidArgumentException if the logging level is unknown
|
143 |
*
|
144 |
* @param int $level
|
145 |
*
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Parser.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -63,7 +63,7 @@ class Mustache_Parser
|
|
63 |
/**
|
64 |
* Helper method for recursively building a parse tree.
|
65 |
*
|
66 |
-
* @throws Mustache_Exception_SyntaxException when nesting errors or mismatched section tags are encountered
|
67 |
*
|
68 |
* @param array &$tokens Set of Mustache tokens
|
69 |
* @param array $parent Parent token (default: null)
|
@@ -195,10 +195,10 @@ class Mustache_Parser
|
|
195 |
*
|
196 |
* Returns a whitespace token for indenting partials, if applicable.
|
197 |
*
|
198 |
-
* @param array $nodes Parsed nodes
|
199 |
-
* @param array $tokens Tokens to be parsed
|
200 |
*
|
201 |
-
* @return array|null Resulting indent token, if any
|
202 |
*/
|
203 |
private function clearStandaloneLines(array &$nodes, array &$tokens)
|
204 |
{
|
@@ -268,7 +268,7 @@ class Mustache_Parser
|
|
268 |
/**
|
269 |
* Check whether a token is allowed inside a parent tag.
|
270 |
*
|
271 |
-
* @throws Mustache_Exception_SyntaxException if an invalid token is found inside a parent tag
|
272 |
*
|
273 |
* @param array|null $parent
|
274 |
* @param array $token
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
63 |
/**
|
64 |
* Helper method for recursively building a parse tree.
|
65 |
*
|
66 |
+
* @throws Mustache_Exception_SyntaxException when nesting errors or mismatched section tags are encountered
|
67 |
*
|
68 |
* @param array &$tokens Set of Mustache tokens
|
69 |
* @param array $parent Parent token (default: null)
|
195 |
*
|
196 |
* Returns a whitespace token for indenting partials, if applicable.
|
197 |
*
|
198 |
+
* @param array $nodes Parsed nodes
|
199 |
+
* @param array $tokens Tokens to be parsed
|
200 |
*
|
201 |
+
* @return array|null Resulting indent token, if any
|
202 |
*/
|
203 |
private function clearStandaloneLines(array &$nodes, array &$tokens)
|
204 |
{
|
268 |
/**
|
269 |
* Check whether a token is allowed inside a parent tag.
|
270 |
*
|
271 |
+
* @throws Mustache_Exception_SyntaxException if an invalid token is found inside a parent tag
|
272 |
*
|
273 |
* @param array|null $parent
|
274 |
* @param array $token
|
vendor/mustache/mustache/src/Mustache/Source.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Mustache template Source interface.
|
14 |
+
*/
|
15 |
+
interface Mustache_Source
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* Get the Source key (used to generate the compiled class name).
|
19 |
+
*
|
20 |
+
* This must return a distinct key for each template source. For example, an
|
21 |
+
* MD5 hash of the template contents would probably do the trick. The
|
22 |
+
* ProductionFilesystemLoader uses mtime and file path. If your production
|
23 |
+
* source directory is under version control, you could use the current Git
|
24 |
+
* rev and the file path...
|
25 |
+
*
|
26 |
+
* @throws RuntimeException when a source file cannot be read
|
27 |
+
*
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
public function getKey();
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Get the template Source.
|
34 |
+
*
|
35 |
+
* @throws RuntimeException when a source file cannot be read
|
36 |
+
*
|
37 |
+
* @return string
|
38 |
+
*/
|
39 |
+
public function getSource();
|
40 |
+
}
|
vendor/mustache/mustache/src/Mustache/Source/FilesystemSource.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Mustache template Filesystem Source.
|
14 |
+
*
|
15 |
+
* This template Source uses stat() to generate the Source key, so that using
|
16 |
+
* pre-compiled templates doesn't require hitting the disk to read the source.
|
17 |
+
* It is more suitable for production use, and is used by default in the
|
18 |
+
* ProductionFilesystemLoader.
|
19 |
+
*/
|
20 |
+
class Mustache_Source_FilesystemSource implements Mustache_Source
|
21 |
+
{
|
22 |
+
private $fileName;
|
23 |
+
private $statProps;
|
24 |
+
private $stat;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Filesystem Source constructor.
|
28 |
+
*
|
29 |
+
* @param string $fileName
|
30 |
+
* @param array $statProps
|
31 |
+
*/
|
32 |
+
public function __construct($fileName, array $statProps)
|
33 |
+
{
|
34 |
+
$this->fileName = $fileName;
|
35 |
+
$this->statProps = $statProps;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get the Source key (used to generate the compiled class name).
|
40 |
+
*
|
41 |
+
* @throws RuntimeException when a source file cannot be read
|
42 |
+
*
|
43 |
+
* @return string
|
44 |
+
*/
|
45 |
+
public function getKey()
|
46 |
+
{
|
47 |
+
$chunks = array(
|
48 |
+
'fileName' => $this->fileName,
|
49 |
+
);
|
50 |
+
|
51 |
+
if (!empty($this->statProps)) {
|
52 |
+
if (!isset($this->stat)) {
|
53 |
+
$this->stat = @stat($this->fileName);
|
54 |
+
}
|
55 |
+
|
56 |
+
if ($this->stat === false) {
|
57 |
+
throw new RuntimeException(sprintf('Failed to read source file "%s".', $this->fileName));
|
58 |
+
}
|
59 |
+
|
60 |
+
foreach ($this->statProps as $prop) {
|
61 |
+
$chunks[$prop] = $this->stat[$prop];
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
return json_encode($chunks);
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Get the template Source.
|
70 |
+
*
|
71 |
+
* @return string
|
72 |
+
*/
|
73 |
+
public function getSource()
|
74 |
+
{
|
75 |
+
return file_get_contents($this->fileName);
|
76 |
+
}
|
77 |
+
}
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Template.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
{lib/php → vendor/mustache/mustache/src}/Mustache/Tokenizer.php
RENAMED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -80,7 +80,7 @@ class Mustache_Tokenizer
|
|
80 |
/**
|
81 |
* Scan and tokenize template source.
|
82 |
*
|
83 |
-
* @throws Mustache_Exception_SyntaxException when mismatched section tags are encountered
|
84 |
*
|
85 |
* @param string $text Mustache template source to tokenize
|
86 |
* @param string $delimiters Optionally, pass initial opening and closing delimiters (default: null)
|
@@ -91,11 +91,14 @@ class Mustache_Tokenizer
|
|
91 |
{
|
92 |
// Setting mbstring.func_overload makes things *really* slow.
|
93 |
// Let's do everyone a favor and scan this string as ASCII instead.
|
|
|
|
|
94 |
$encoding = null;
|
95 |
if (function_exists('mb_internal_encoding') && ini_get('mbstring.func_overload') & 2) {
|
96 |
$encoding = mb_internal_encoding();
|
97 |
mb_internal_encoding('ASCII');
|
98 |
}
|
|
|
99 |
|
100 |
$this->reset();
|
101 |
|
@@ -202,9 +205,11 @@ class Mustache_Tokenizer
|
|
202 |
$this->flushBuffer();
|
203 |
|
204 |
// Restore the user's encoding...
|
|
|
205 |
if ($encoding) {
|
206 |
mb_internal_encoding($encoding);
|
207 |
}
|
|
|
208 |
|
209 |
return $this->tokens;
|
210 |
}
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
80 |
/**
|
81 |
* Scan and tokenize template source.
|
82 |
*
|
83 |
+
* @throws Mustache_Exception_SyntaxException when mismatched section tags are encountered
|
84 |
*
|
85 |
* @param string $text Mustache template source to tokenize
|
86 |
* @param string $delimiters Optionally, pass initial opening and closing delimiters (default: null)
|
91 |
{
|
92 |
// Setting mbstring.func_overload makes things *really* slow.
|
93 |
// Let's do everyone a favor and scan this string as ASCII instead.
|
94 |
+
//
|
95 |
+
// @codeCoverageIgnoreStart
|
96 |
$encoding = null;
|
97 |
if (function_exists('mb_internal_encoding') && ini_get('mbstring.func_overload') & 2) {
|
98 |
$encoding = mb_internal_encoding();
|
99 |
mb_internal_encoding('ASCII');
|
100 |
}
|
101 |
+
// @codeCoverageIgnoreEnd
|
102 |
|
103 |
$this->reset();
|
104 |
|
205 |
$this->flushBuffer();
|
206 |
|
207 |
// Restore the user's encoding...
|
208 |
+
// @codeCoverageIgnoreStart
|
209 |
if ($encoding) {
|
210 |
mb_internal_encoding($encoding);
|
211 |
}
|
212 |
+
// @codeCoverageIgnoreEnd
|
213 |
|
214 |
return $this->tokens;
|
215 |
}
|
vendor/mustache/mustache/test/Mustache/Test/AutoloaderTest.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_AutoloaderTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
public function testRegister()
|
18 |
+
{
|
19 |
+
$loader = Mustache_Autoloader::register();
|
20 |
+
$this->assertTrue(spl_autoload_unregister(array($loader, 'autoload')));
|
21 |
+
}
|
22 |
+
|
23 |
+
public function testAutoloader()
|
24 |
+
{
|
25 |
+
$loader = new Mustache_Autoloader(dirname(__FILE__) . '/../../fixtures/autoloader');
|
26 |
+
|
27 |
+
$this->assertNull($loader->autoload('NonMustacheClass'));
|
28 |
+
$this->assertFalse(class_exists('NonMustacheClass'));
|
29 |
+
|
30 |
+
$loader->autoload('Mustache_Foo');
|
31 |
+
$this->assertTrue(class_exists('Mustache_Foo'));
|
32 |
+
|
33 |
+
$loader->autoload('\Mustache_Bar');
|
34 |
+
$this->assertTrue(class_exists('Mustache_Bar'));
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Test that the autoloader won't register multiple times.
|
39 |
+
*/
|
40 |
+
public function testRegisterMultiple()
|
41 |
+
{
|
42 |
+
$numLoaders = count(spl_autoload_functions());
|
43 |
+
|
44 |
+
Mustache_Autoloader::register();
|
45 |
+
Mustache_Autoloader::register();
|
46 |
+
|
47 |
+
$expectedNumLoaders = $numLoaders + 1;
|
48 |
+
|
49 |
+
$this->assertCount($expectedNumLoaders, spl_autoload_functions());
|
50 |
+
}
|
51 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Cache/AbstractCacheTest.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Mustache_Test_Cache_AbstractCacheTest extends PHPUnit_Framework_TestCase
|
13 |
+
{
|
14 |
+
public function testGetSetLogger()
|
15 |
+
{
|
16 |
+
$cache = new CacheStub();
|
17 |
+
$logger = new Mustache_Logger_StreamLogger('php://stdout');
|
18 |
+
$cache->setLogger($logger);
|
19 |
+
$this->assertSame($logger, $cache->getLogger());
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @expectedException Mustache_Exception_InvalidArgumentException
|
24 |
+
*/
|
25 |
+
public function testSetLoggerThrowsExceptions()
|
26 |
+
{
|
27 |
+
$cache = new CacheStub();
|
28 |
+
$logger = new StdClass();
|
29 |
+
$cache->setLogger($logger);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
class CacheStub extends Mustache_Cache_AbstractCache
|
34 |
+
{
|
35 |
+
public function load($key)
|
36 |
+
{
|
37 |
+
// nada
|
38 |
+
}
|
39 |
+
|
40 |
+
public function cache($key, $value)
|
41 |
+
{
|
42 |
+
// nada
|
43 |
+
}
|
44 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Cache/FilesystemCacheTest.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group functional
|
14 |
+
*/
|
15 |
+
class Mustache_Test_Cache_FilesystemCacheTest extends Mustache_Test_FunctionalTestCase
|
16 |
+
{
|
17 |
+
public function testCacheGetNone()
|
18 |
+
{
|
19 |
+
$key = 'some key';
|
20 |
+
$cache = new Mustache_Cache_FilesystemCache(self::$tempDir);
|
21 |
+
$loaded = $cache->load($key);
|
22 |
+
|
23 |
+
$this->assertFalse($loaded);
|
24 |
+
}
|
25 |
+
|
26 |
+
public function testCachePut()
|
27 |
+
{
|
28 |
+
$key = 'some key';
|
29 |
+
$value = '<?php /* some value */';
|
30 |
+
$cache = new Mustache_Cache_FilesystemCache(self::$tempDir);
|
31 |
+
$cache->cache($key, $value);
|
32 |
+
$loaded = $cache->load($key);
|
33 |
+
|
34 |
+
$this->assertTrue($loaded);
|
35 |
+
}
|
36 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/CompilerTest.php
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_CompilerTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* @dataProvider getCompileValues
|
19 |
+
*/
|
20 |
+
public function testCompile($source, array $tree, $name, $customEscaper, $entityFlags, $charset, $expected)
|
21 |
+
{
|
22 |
+
$compiler = new Mustache_Compiler();
|
23 |
+
|
24 |
+
$compiled = $compiler->compile($source, $tree, $name, $customEscaper, $charset, false, $entityFlags);
|
25 |
+
foreach ($expected as $contains) {
|
26 |
+
$this->assertContains($contains, $compiled);
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getCompileValues()
|
31 |
+
{
|
32 |
+
return array(
|
33 |
+
array('', array(), 'Banana', false, ENT_COMPAT, 'ISO-8859-1', array(
|
34 |
+
"\nclass Banana extends Mustache_Template",
|
35 |
+
'return $buffer;',
|
36 |
+
)),
|
37 |
+
|
38 |
+
array('', array($this->createTextToken('TEXT')), 'Monkey', false, ENT_COMPAT, 'UTF-8', array(
|
39 |
+
"\nclass Monkey extends Mustache_Template",
|
40 |
+
'$buffer .= $indent . \'TEXT\';',
|
41 |
+
'return $buffer;',
|
42 |
+
)),
|
43 |
+
|
44 |
+
array(
|
45 |
+
'',
|
46 |
+
array(
|
47 |
+
array(
|
48 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
49 |
+
Mustache_Tokenizer::NAME => 'name',
|
50 |
+
),
|
51 |
+
),
|
52 |
+
'Monkey',
|
53 |
+
true,
|
54 |
+
ENT_COMPAT,
|
55 |
+
'ISO-8859-1',
|
56 |
+
array(
|
57 |
+
"\nclass Monkey extends Mustache_Template",
|
58 |
+
'$value = $this->resolveValue($context->find(\'name\'), $context);',
|
59 |
+
'$buffer .= $indent . call_user_func($this->mustache->getEscape(), $value);',
|
60 |
+
'return $buffer;',
|
61 |
+
),
|
62 |
+
),
|
63 |
+
|
64 |
+
array(
|
65 |
+
'',
|
66 |
+
array(
|
67 |
+
array(
|
68 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
69 |
+
Mustache_Tokenizer::NAME => 'name',
|
70 |
+
),
|
71 |
+
),
|
72 |
+
'Monkey',
|
73 |
+
false,
|
74 |
+
ENT_COMPAT,
|
75 |
+
'ISO-8859-1',
|
76 |
+
array(
|
77 |
+
"\nclass Monkey extends Mustache_Template",
|
78 |
+
'$value = $this->resolveValue($context->find(\'name\'), $context);',
|
79 |
+
'$buffer .= $indent . htmlspecialchars($value, ' . ENT_COMPAT . ', \'ISO-8859-1\');',
|
80 |
+
'return $buffer;',
|
81 |
+
),
|
82 |
+
),
|
83 |
+
|
84 |
+
array(
|
85 |
+
'',
|
86 |
+
array(
|
87 |
+
array(
|
88 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
89 |
+
Mustache_Tokenizer::NAME => 'name',
|
90 |
+
),
|
91 |
+
),
|
92 |
+
'Monkey',
|
93 |
+
false,
|
94 |
+
ENT_QUOTES,
|
95 |
+
'ISO-8859-1',
|
96 |
+
array(
|
97 |
+
"\nclass Monkey extends Mustache_Template",
|
98 |
+
'$value = $this->resolveValue($context->find(\'name\'), $context);',
|
99 |
+
'$buffer .= $indent . htmlspecialchars($value, ' . ENT_QUOTES . ', \'ISO-8859-1\');',
|
100 |
+
'return $buffer;',
|
101 |
+
),
|
102 |
+
),
|
103 |
+
|
104 |
+
array(
|
105 |
+
'',
|
106 |
+
array(
|
107 |
+
$this->createTextToken("foo\n"),
|
108 |
+
array(
|
109 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
110 |
+
Mustache_Tokenizer::NAME => 'name',
|
111 |
+
),
|
112 |
+
array(
|
113 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
114 |
+
Mustache_Tokenizer::NAME => '.',
|
115 |
+
),
|
116 |
+
$this->createTextToken("'bar'"),
|
117 |
+
),
|
118 |
+
'Monkey',
|
119 |
+
false,
|
120 |
+
ENT_COMPAT,
|
121 |
+
'UTF-8',
|
122 |
+
array(
|
123 |
+
"\nclass Monkey extends Mustache_Template",
|
124 |
+
"\$buffer .= \$indent . 'foo\n';",
|
125 |
+
'$value = $this->resolveValue($context->find(\'name\'), $context);',
|
126 |
+
'$buffer .= htmlspecialchars($value, ' . ENT_COMPAT . ', \'UTF-8\');',
|
127 |
+
'$value = $this->resolveValue($context->last(), $context);',
|
128 |
+
'$buffer .= \'\\\'bar\\\'\';',
|
129 |
+
'return $buffer;',
|
130 |
+
),
|
131 |
+
),
|
132 |
+
);
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* @expectedException Mustache_Exception_SyntaxException
|
137 |
+
*/
|
138 |
+
public function testCompilerThrowsSyntaxException()
|
139 |
+
{
|
140 |
+
$compiler = new Mustache_Compiler();
|
141 |
+
$compiler->compile('', array(array(Mustache_Tokenizer::TYPE => 'invalid')), 'SomeClass');
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* @param string $value
|
146 |
+
*/
|
147 |
+
private function createTextToken($value)
|
148 |
+
{
|
149 |
+
return array(
|
150 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
151 |
+
Mustache_Tokenizer::VALUE => $value,
|
152 |
+
);
|
153 |
+
}
|
154 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/ContextTest.php
ADDED
@@ -0,0 +1,282 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_ContextTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
public function testConstructor()
|
18 |
+
{
|
19 |
+
$one = new Mustache_Context();
|
20 |
+
$this->assertSame('', $one->find('foo'));
|
21 |
+
$this->assertSame('', $one->find('bar'));
|
22 |
+
|
23 |
+
$two = new Mustache_Context(array(
|
24 |
+
'foo' => 'FOO',
|
25 |
+
'bar' => '<BAR>',
|
26 |
+
));
|
27 |
+
$this->assertEquals('FOO', $two->find('foo'));
|
28 |
+
$this->assertEquals('<BAR>', $two->find('bar'));
|
29 |
+
|
30 |
+
$obj = new StdClass();
|
31 |
+
$obj->name = 'NAME';
|
32 |
+
$three = new Mustache_Context($obj);
|
33 |
+
$this->assertSame($obj, $three->last());
|
34 |
+
$this->assertEquals('NAME', $three->find('name'));
|
35 |
+
}
|
36 |
+
|
37 |
+
public function testPushPopAndLast()
|
38 |
+
{
|
39 |
+
$context = new Mustache_Context();
|
40 |
+
$this->assertFalse($context->last());
|
41 |
+
|
42 |
+
$dummy = new Mustache_Test_TestDummy();
|
43 |
+
$context->push($dummy);
|
44 |
+
$this->assertSame($dummy, $context->last());
|
45 |
+
$this->assertSame($dummy, $context->pop());
|
46 |
+
$this->assertFalse($context->last());
|
47 |
+
|
48 |
+
$obj = new StdClass();
|
49 |
+
$context->push($dummy);
|
50 |
+
$this->assertSame($dummy, $context->last());
|
51 |
+
$context->push($obj);
|
52 |
+
$this->assertSame($obj, $context->last());
|
53 |
+
$this->assertSame($obj, $context->pop());
|
54 |
+
$this->assertSame($dummy, $context->pop());
|
55 |
+
$this->assertFalse($context->last());
|
56 |
+
}
|
57 |
+
|
58 |
+
public function testFind()
|
59 |
+
{
|
60 |
+
$context = new Mustache_Context();
|
61 |
+
|
62 |
+
$dummy = new Mustache_Test_TestDummy();
|
63 |
+
|
64 |
+
$obj = new StdClass();
|
65 |
+
$obj->name = 'obj';
|
66 |
+
|
67 |
+
$arr = array(
|
68 |
+
'a' => array('b' => array('c' => 'see')),
|
69 |
+
'b' => 'bee',
|
70 |
+
);
|
71 |
+
|
72 |
+
$string = 'some arbitrary string';
|
73 |
+
|
74 |
+
$context->push($dummy);
|
75 |
+
$this->assertEquals('dummy', $context->find('name'));
|
76 |
+
|
77 |
+
$context->push($obj);
|
78 |
+
$this->assertEquals('obj', $context->find('name'));
|
79 |
+
|
80 |
+
$context->pop();
|
81 |
+
$this->assertEquals('dummy', $context->find('name'));
|
82 |
+
|
83 |
+
$dummy->name = 'dummyer';
|
84 |
+
$this->assertEquals('dummyer', $context->find('name'));
|
85 |
+
|
86 |
+
$context->push($arr);
|
87 |
+
$this->assertEquals('bee', $context->find('b'));
|
88 |
+
$this->assertEquals('see', $context->findDot('a.b.c'));
|
89 |
+
|
90 |
+
$dummy->name = 'dummy';
|
91 |
+
|
92 |
+
$context->push($string);
|
93 |
+
$this->assertSame($string, $context->last());
|
94 |
+
$this->assertEquals('dummy', $context->find('name'));
|
95 |
+
$this->assertEquals('see', $context->findDot('a.b.c'));
|
96 |
+
$this->assertEquals('<foo>', $context->find('foo'));
|
97 |
+
$this->assertEquals('<bar>', $context->findDot('bar'));
|
98 |
+
}
|
99 |
+
|
100 |
+
public function testArrayAccessFind()
|
101 |
+
{
|
102 |
+
$access = new Mustache_Test_TestArrayAccess(array(
|
103 |
+
'a' => array('b' => array('c' => 'see')),
|
104 |
+
'b' => 'bee',
|
105 |
+
));
|
106 |
+
|
107 |
+
$context = new Mustache_Context($access);
|
108 |
+
$this->assertEquals('bee', $context->find('b'));
|
109 |
+
$this->assertEquals('see', $context->findDot('a.b.c'));
|
110 |
+
$this->assertEquals(null, $context->findDot('a.b.c.d'));
|
111 |
+
}
|
112 |
+
|
113 |
+
public function testAccessorPriority()
|
114 |
+
{
|
115 |
+
$context = new Mustache_Context(new Mustache_Test_AllTheThings());
|
116 |
+
|
117 |
+
$this->assertEquals('win', $context->find('foo'), 'method beats property');
|
118 |
+
$this->assertEquals('win', $context->find('bar'), 'property beats ArrayAccess');
|
119 |
+
$this->assertEquals('win', $context->find('baz'), 'ArrayAccess stands alone');
|
120 |
+
$this->assertEquals('win', $context->find('qux'), 'ArrayAccess beats private property');
|
121 |
+
}
|
122 |
+
|
123 |
+
public function testAnchoredDotNotation()
|
124 |
+
{
|
125 |
+
$context = new Mustache_Context();
|
126 |
+
|
127 |
+
$a = array(
|
128 |
+
'name' => 'a',
|
129 |
+
'number' => 1,
|
130 |
+
);
|
131 |
+
|
132 |
+
$b = array(
|
133 |
+
'number' => 2,
|
134 |
+
'child' => array(
|
135 |
+
'name' => 'baby bee',
|
136 |
+
),
|
137 |
+
);
|
138 |
+
|
139 |
+
$c = array(
|
140 |
+
'name' => 'cee',
|
141 |
+
);
|
142 |
+
|
143 |
+
$context->push($a);
|
144 |
+
$this->assertEquals('a', $context->find('name'));
|
145 |
+
$this->assertEquals('', $context->findDot('.name'));
|
146 |
+
$this->assertEquals('a', $context->findAnchoredDot('.name'));
|
147 |
+
$this->assertEquals(1, $context->find('number'));
|
148 |
+
$this->assertEquals('', $context->findDot('.number'));
|
149 |
+
$this->assertEquals(1, $context->findAnchoredDot('.number'));
|
150 |
+
|
151 |
+
$context->push($b);
|
152 |
+
$this->assertEquals('a', $context->find('name'));
|
153 |
+
$this->assertEquals(2, $context->find('number'));
|
154 |
+
$this->assertEquals('', $context->findDot('.name'));
|
155 |
+
$this->assertEquals('', $context->findDot('.number'));
|
156 |
+
$this->assertEquals('', $context->findAnchoredDot('.name'));
|
157 |
+
$this->assertEquals(2, $context->findAnchoredDot('.number'));
|
158 |
+
$this->assertEquals('baby bee', $context->findDot('child.name'));
|
159 |
+
$this->assertEquals('', $context->findDot('.child.name'));
|
160 |
+
$this->assertEquals('baby bee', $context->findAnchoredDot('.child.name'));
|
161 |
+
|
162 |
+
$context->push($c);
|
163 |
+
$this->assertEquals('cee', $context->find('name'));
|
164 |
+
$this->assertEquals('', $context->findDot('.name'));
|
165 |
+
$this->assertEquals('cee', $context->findAnchoredDot('.name'));
|
166 |
+
$this->assertEquals(2, $context->find('number'));
|
167 |
+
$this->assertEquals('', $context->findDot('.number'));
|
168 |
+
$this->assertEquals('', $context->findAnchoredDot('.number'));
|
169 |
+
$this->assertEquals('baby bee', $context->findDot('child.name'));
|
170 |
+
$this->assertEquals('', $context->findDot('.child.name'));
|
171 |
+
$this->assertEquals('', $context->findAnchoredDot('.child.name'));
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* @expectedException Mustache_Exception_InvalidArgumentException
|
176 |
+
*/
|
177 |
+
public function testAnchoredDotNotationThrowsExceptions()
|
178 |
+
{
|
179 |
+
$context = new Mustache_Context();
|
180 |
+
$context->push(array('a' => 1));
|
181 |
+
$context->findAnchoredDot('a');
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
class Mustache_Test_TestDummy
|
186 |
+
{
|
187 |
+
public $name = 'dummy';
|
188 |
+
|
189 |
+
public function __invoke()
|
190 |
+
{
|
191 |
+
// nothing
|
192 |
+
}
|
193 |
+
|
194 |
+
public static function foo()
|
195 |
+
{
|
196 |
+
return '<foo>';
|
197 |
+
}
|
198 |
+
|
199 |
+
public function bar()
|
200 |
+
{
|
201 |
+
return '<bar>';
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
class Mustache_Test_TestArrayAccess implements ArrayAccess
|
206 |
+
{
|
207 |
+
private $container = array();
|
208 |
+
|
209 |
+
public function __construct($array)
|
210 |
+
{
|
211 |
+
foreach ($array as $key => $value) {
|
212 |
+
$this->container[$key] = $value;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
public function offsetSet($offset, $value)
|
217 |
+
{
|
218 |
+
if (is_null($offset)) {
|
219 |
+
$this->container[] = $value;
|
220 |
+
} else {
|
221 |
+
$this->container[$offset] = $value;
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
public function offsetExists($offset)
|
226 |
+
{
|
227 |
+
return isset($this->container[$offset]);
|
228 |
+
}
|
229 |
+
|
230 |
+
public function offsetUnset($offset)
|
231 |
+
{
|
232 |
+
unset($this->container[$offset]);
|
233 |
+
}
|
234 |
+
|
235 |
+
public function offsetGet($offset)
|
236 |
+
{
|
237 |
+
return isset($this->container[$offset]) ? $this->container[$offset] : null;
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
class Mustache_Test_AllTheThings implements ArrayAccess
|
242 |
+
{
|
243 |
+
public $foo = 'fail';
|
244 |
+
public $bar = 'win';
|
245 |
+
private $qux = 'fail';
|
246 |
+
|
247 |
+
public function foo()
|
248 |
+
{
|
249 |
+
return 'win';
|
250 |
+
}
|
251 |
+
|
252 |
+
public function offsetExists($offset)
|
253 |
+
{
|
254 |
+
return true;
|
255 |
+
}
|
256 |
+
|
257 |
+
public function offsetGet($offset)
|
258 |
+
{
|
259 |
+
switch ($offset) {
|
260 |
+
case 'foo':
|
261 |
+
case 'bar':
|
262 |
+
return 'fail';
|
263 |
+
|
264 |
+
case 'baz':
|
265 |
+
case 'qux':
|
266 |
+
return 'win';
|
267 |
+
|
268 |
+
default:
|
269 |
+
return 'lolwhut';
|
270 |
+
}
|
271 |
+
}
|
272 |
+
|
273 |
+
public function offsetSet($offset, $value)
|
274 |
+
{
|
275 |
+
// nada
|
276 |
+
}
|
277 |
+
|
278 |
+
public function offsetUnset($offset)
|
279 |
+
{
|
280 |
+
// nada
|
281 |
+
}
|
282 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/EngineTest.php
ADDED
@@ -0,0 +1,397 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_EngineTest extends Mustache_Test_FunctionalTestCase
|
16 |
+
{
|
17 |
+
public function testConstructor()
|
18 |
+
{
|
19 |
+
$logger = new Mustache_Logger_StreamLogger(tmpfile());
|
20 |
+
$loader = new Mustache_Loader_StringLoader();
|
21 |
+
$partialsLoader = new Mustache_Loader_ArrayLoader();
|
22 |
+
$mustache = new Mustache_Engine(array(
|
23 |
+
'template_class_prefix' => '__whot__',
|
24 |
+
'cache' => self::$tempDir,
|
25 |
+
'cache_file_mode' => 777,
|
26 |
+
'logger' => $logger,
|
27 |
+
'loader' => $loader,
|
28 |
+
'partials_loader' => $partialsLoader,
|
29 |
+
'partials' => array(
|
30 |
+
'foo' => '{{ foo }}',
|
31 |
+
),
|
32 |
+
'helpers' => array(
|
33 |
+
'foo' => array($this, 'getFoo'),
|
34 |
+
'bar' => 'BAR',
|
35 |
+
),
|
36 |
+
'escape' => 'strtoupper',
|
37 |
+
'entity_flags' => ENT_QUOTES,
|
38 |
+
'charset' => 'ISO-8859-1',
|
39 |
+
'pragmas' => array(Mustache_Engine::PRAGMA_FILTERS),
|
40 |
+
));
|
41 |
+
|
42 |
+
$this->assertSame($logger, $mustache->getLogger());
|
43 |
+
$this->assertSame($loader, $mustache->getLoader());
|
44 |
+
$this->assertSame($partialsLoader, $mustache->getPartialsLoader());
|
45 |
+
$this->assertEquals('{{ foo }}', $partialsLoader->load('foo'));
|
46 |
+
$this->assertContains('__whot__', $mustache->getTemplateClassName('{{ foo }}'));
|
47 |
+
$this->assertEquals('strtoupper', $mustache->getEscape());
|
48 |
+
$this->assertEquals(ENT_QUOTES, $mustache->getEntityFlags());
|
49 |
+
$this->assertEquals('ISO-8859-1', $mustache->getCharset());
|
50 |
+
$this->assertTrue($mustache->hasHelper('foo'));
|
51 |
+
$this->assertTrue($mustache->hasHelper('bar'));
|
52 |
+
$this->assertFalse($mustache->hasHelper('baz'));
|
53 |
+
$this->assertInstanceOf('Mustache_Cache_FilesystemCache', $mustache->getCache());
|
54 |
+
$this->assertEquals(array(Mustache_Engine::PRAGMA_FILTERS), $mustache->getPragmas());
|
55 |
+
}
|
56 |
+
|
57 |
+
public static function getFoo()
|
58 |
+
{
|
59 |
+
return 'foo';
|
60 |
+
}
|
61 |
+
|
62 |
+
public function testRender()
|
63 |
+
{
|
64 |
+
$source = '{{ foo }}';
|
65 |
+
$data = array('bar' => 'baz');
|
66 |
+
$output = 'TEH OUTPUT';
|
67 |
+
|
68 |
+
$template = $this->getMockBuilder('Mustache_Template')
|
69 |
+
->disableOriginalConstructor()
|
70 |
+
->getMock();
|
71 |
+
|
72 |
+
$mustache = new MustacheStub();
|
73 |
+
$mustache->template = $template;
|
74 |
+
|
75 |
+
$template->expects($this->once())
|
76 |
+
->method('render')
|
77 |
+
->with($data)
|
78 |
+
->will($this->returnValue($output));
|
79 |
+
|
80 |
+
$this->assertEquals($output, $mustache->render($source, $data));
|
81 |
+
$this->assertEquals($source, $mustache->source);
|
82 |
+
}
|
83 |
+
|
84 |
+
public function testSettingServices()
|
85 |
+
{
|
86 |
+
$logger = new Mustache_Logger_StreamLogger(tmpfile());
|
87 |
+
$loader = new Mustache_Loader_StringLoader();
|
88 |
+
$tokenizer = new Mustache_Tokenizer();
|
89 |
+
$parser = new Mustache_Parser();
|
90 |
+
$compiler = new Mustache_Compiler();
|
91 |
+
$mustache = new Mustache_Engine();
|
92 |
+
$cache = new Mustache_Cache_FilesystemCache(self::$tempDir);
|
93 |
+
|
94 |
+
$this->assertNotSame($logger, $mustache->getLogger());
|
95 |
+
$mustache->setLogger($logger);
|
96 |
+
$this->assertSame($logger, $mustache->getLogger());
|
97 |
+
|
98 |
+
$this->assertNotSame($loader, $mustache->getLoader());
|
99 |
+
$mustache->setLoader($loader);
|
100 |
+
$this->assertSame($loader, $mustache->getLoader());
|
101 |
+
|
102 |
+
$this->assertNotSame($loader, $mustache->getPartialsLoader());
|
103 |
+
$mustache->setPartialsLoader($loader);
|
104 |
+
$this->assertSame($loader, $mustache->getPartialsLoader());
|
105 |
+
|
106 |
+
$this->assertNotSame($tokenizer, $mustache->getTokenizer());
|
107 |
+
$mustache->setTokenizer($tokenizer);
|
108 |
+
$this->assertSame($tokenizer, $mustache->getTokenizer());
|
109 |
+
|
110 |
+
$this->assertNotSame($parser, $mustache->getParser());
|
111 |
+
$mustache->setParser($parser);
|
112 |
+
$this->assertSame($parser, $mustache->getParser());
|
113 |
+
|
114 |
+
$this->assertNotSame($compiler, $mustache->getCompiler());
|
115 |
+
$mustache->setCompiler($compiler);
|
116 |
+
$this->assertSame($compiler, $mustache->getCompiler());
|
117 |
+
|
118 |
+
$this->assertNotSame($cache, $mustache->getCache());
|
119 |
+
$mustache->setCache($cache);
|
120 |
+
$this->assertSame($cache, $mustache->getCache());
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* @group functional
|
125 |
+
*/
|
126 |
+
public function testCache()
|
127 |
+
{
|
128 |
+
$mustache = new Mustache_Engine(array(
|
129 |
+
'template_class_prefix' => '__whot__',
|
130 |
+
'cache' => self::$tempDir,
|
131 |
+
));
|
132 |
+
|
133 |
+
$source = '{{ foo }}';
|
134 |
+
$template = $mustache->loadTemplate($source);
|
135 |
+
$className = $mustache->getTemplateClassName($source);
|
136 |
+
|
137 |
+
$this->assertInstanceOf($className, $template);
|
138 |
+
}
|
139 |
+
|
140 |
+
public function testLambdaCache()
|
141 |
+
{
|
142 |
+
$mustache = new MustacheStub(array(
|
143 |
+
'cache' => self::$tempDir,
|
144 |
+
'cache_lambda_templates' => true,
|
145 |
+
));
|
146 |
+
|
147 |
+
$this->assertNotInstanceOf('Mustache_Cache_NoopCache', $mustache->getProtectedLambdaCache());
|
148 |
+
$this->assertSame($mustache->getCache(), $mustache->getProtectedLambdaCache());
|
149 |
+
}
|
150 |
+
|
151 |
+
public function testWithoutLambdaCache()
|
152 |
+
{
|
153 |
+
$mustache = new MustacheStub(array(
|
154 |
+
'cache' => self::$tempDir,
|
155 |
+
));
|
156 |
+
|
157 |
+
$this->assertInstanceOf('Mustache_Cache_NoopCache', $mustache->getProtectedLambdaCache());
|
158 |
+
$this->assertNotSame($mustache->getCache(), $mustache->getProtectedLambdaCache());
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* @expectedException Mustache_Exception_InvalidArgumentException
|
163 |
+
*/
|
164 |
+
public function testEmptyTemplatePrefixThrowsException()
|
165 |
+
{
|
166 |
+
new Mustache_Engine(array(
|
167 |
+
'template_class_prefix' => '',
|
168 |
+
));
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* @expectedException Mustache_Exception_InvalidArgumentException
|
173 |
+
* @dataProvider getBadEscapers
|
174 |
+
*/
|
175 |
+
public function testNonCallableEscapeThrowsException($escape)
|
176 |
+
{
|
177 |
+
new Mustache_Engine(array('escape' => $escape));
|
178 |
+
}
|
179 |
+
|
180 |
+
public function getBadEscapers()
|
181 |
+
{
|
182 |
+
return array(
|
183 |
+
array('nothing'),
|
184 |
+
array('foo', 'bar'),
|
185 |
+
);
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* @expectedException Mustache_Exception_RuntimeException
|
190 |
+
*/
|
191 |
+
public function testImmutablePartialsLoadersThrowException()
|
192 |
+
{
|
193 |
+
$mustache = new Mustache_Engine(array(
|
194 |
+
'partials_loader' => new Mustache_Loader_StringLoader(),
|
195 |
+
));
|
196 |
+
|
197 |
+
$mustache->setPartials(array('foo' => '{{ foo }}'));
|
198 |
+
}
|
199 |
+
|
200 |
+
public function testMissingPartialsTreatedAsEmptyString()
|
201 |
+
{
|
202 |
+
$mustache = new Mustache_Engine(array(
|
203 |
+
'partials_loader' => new Mustache_Loader_ArrayLoader(array(
|
204 |
+
'foo' => 'FOO',
|
205 |
+
'baz' => 'BAZ',
|
206 |
+
)),
|
207 |
+
));
|
208 |
+
|
209 |
+
$this->assertEquals('FOOBAZ', $mustache->render('{{>foo}}{{>bar}}{{>baz}}', array()));
|
210 |
+
}
|
211 |
+
|
212 |
+
public function testHelpers()
|
213 |
+
{
|
214 |
+
$foo = array($this, 'getFoo');
|
215 |
+
$bar = 'BAR';
|
216 |
+
$mustache = new Mustache_Engine(array('helpers' => array(
|
217 |
+
'foo' => $foo,
|
218 |
+
'bar' => $bar,
|
219 |
+
)));
|
220 |
+
|
221 |
+
$helpers = $mustache->getHelpers();
|
222 |
+
$this->assertTrue($mustache->hasHelper('foo'));
|
223 |
+
$this->assertTrue($mustache->hasHelper('bar'));
|
224 |
+
$this->assertTrue($helpers->has('foo'));
|
225 |
+
$this->assertTrue($helpers->has('bar'));
|
226 |
+
$this->assertSame($foo, $mustache->getHelper('foo'));
|
227 |
+
$this->assertSame($bar, $mustache->getHelper('bar'));
|
228 |
+
|
229 |
+
$mustache->removeHelper('bar');
|
230 |
+
$this->assertFalse($mustache->hasHelper('bar'));
|
231 |
+
$mustache->addHelper('bar', $bar);
|
232 |
+
$this->assertSame($bar, $mustache->getHelper('bar'));
|
233 |
+
|
234 |
+
$baz = array($this, 'wrapWithUnderscores');
|
235 |
+
$this->assertFalse($mustache->hasHelper('baz'));
|
236 |
+
$this->assertFalse($helpers->has('baz'));
|
237 |
+
|
238 |
+
$mustache->addHelper('baz', $baz);
|
239 |
+
$this->assertTrue($mustache->hasHelper('baz'));
|
240 |
+
$this->assertTrue($helpers->has('baz'));
|
241 |
+
|
242 |
+
// ... and a functional test
|
243 |
+
$tpl = $mustache->loadTemplate('{{foo}} - {{bar}} - {{#baz}}qux{{/baz}}');
|
244 |
+
$this->assertEquals('foo - BAR - __qux__', $tpl->render());
|
245 |
+
$this->assertEquals('foo - BAR - __qux__', $tpl->render(array('qux' => "won't mess things up")));
|
246 |
+
}
|
247 |
+
|
248 |
+
public static function wrapWithUnderscores($text)
|
249 |
+
{
|
250 |
+
return '__' . $text . '__';
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* @expectedException Mustache_Exception_InvalidArgumentException
|
255 |
+
*/
|
256 |
+
public function testSetHelpersThrowsExceptions()
|
257 |
+
{
|
258 |
+
$mustache = new Mustache_Engine();
|
259 |
+
$mustache->setHelpers('monkeymonkeymonkey');
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* @expectedException Mustache_Exception_InvalidArgumentException
|
264 |
+
*/
|
265 |
+
public function testSetLoggerThrowsExceptions()
|
266 |
+
{
|
267 |
+
$mustache = new Mustache_Engine();
|
268 |
+
$mustache->setLogger(new StdClass());
|
269 |
+
}
|
270 |
+
|
271 |
+
public function testLoadPartialCascading()
|
272 |
+
{
|
273 |
+
$loader = new Mustache_Loader_ArrayLoader(array(
|
274 |
+
'foo' => 'FOO',
|
275 |
+
));
|
276 |
+
|
277 |
+
$mustache = new Mustache_Engine(array('loader' => $loader));
|
278 |
+
|
279 |
+
$tpl = $mustache->loadTemplate('foo');
|
280 |
+
|
281 |
+
$this->assertSame($tpl, $mustache->loadPartial('foo'));
|
282 |
+
|
283 |
+
$mustache->setPartials(array(
|
284 |
+
'foo' => 'f00',
|
285 |
+
));
|
286 |
+
|
287 |
+
// setting partials overrides the default template loading fallback.
|
288 |
+
$this->assertNotSame($tpl, $mustache->loadPartial('foo'));
|
289 |
+
|
290 |
+
// but it didn't overwrite the original template loader templates.
|
291 |
+
$this->assertSame($tpl, $mustache->loadTemplate('foo'));
|
292 |
+
}
|
293 |
+
|
294 |
+
public function testPartialLoadFailLogging()
|
295 |
+
{
|
296 |
+
$name = tempnam(sys_get_temp_dir(), 'mustache-test');
|
297 |
+
$mustache = new Mustache_Engine(array(
|
298 |
+
'logger' => new Mustache_Logger_StreamLogger($name, Mustache_Logger::WARNING),
|
299 |
+
'partials' => array(
|
300 |
+
'foo' => 'FOO',
|
301 |
+
'bar' => 'BAR',
|
302 |
+
),
|
303 |
+
));
|
304 |
+
|
305 |
+
$result = $mustache->render('{{> foo }}{{> bar }}{{> baz }}', array());
|
306 |
+
$this->assertEquals('FOOBAR', $result);
|
307 |
+
|
308 |
+
$this->assertContains('WARNING: Partial not found: "baz"', file_get_contents($name));
|
309 |
+
}
|
310 |
+
|
311 |
+
public function testCacheWarningLogging()
|
312 |
+
{
|
313 |
+
list($name, $mustache) = $this->getLoggedMustache(Mustache_Logger::WARNING);
|
314 |
+
$mustache->render('{{ foo }}', array('foo' => 'FOO'));
|
315 |
+
$this->assertContains('WARNING: Template cache disabled, evaluating', file_get_contents($name));
|
316 |
+
}
|
317 |
+
|
318 |
+
public function testLoggingIsNotTooAnnoying()
|
319 |
+
{
|
320 |
+
list($name, $mustache) = $this->getLoggedMustache();
|
321 |
+
$mustache->render('{{ foo }}{{> bar }}', array('foo' => 'FOO'));
|
322 |
+
$this->assertEmpty(file_get_contents($name));
|
323 |
+
}
|
324 |
+
|
325 |
+
public function testVerboseLoggingIsVerbose()
|
326 |
+
{
|
327 |
+
list($name, $mustache) = $this->getLoggedMustache(Mustache_Logger::DEBUG);
|
328 |
+
$mustache->render('{{ foo }}{{> bar }}', array('foo' => 'FOO'));
|
329 |
+
$log = file_get_contents($name);
|
330 |
+
$this->assertContains('DEBUG: Instantiating template: ', $log);
|
331 |
+
$this->assertContains('WARNING: Partial not found: "bar"', $log);
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* @expectedException Mustache_Exception_InvalidArgumentException
|
336 |
+
*/
|
337 |
+
public function testUnknownPragmaThrowsException()
|
338 |
+
{
|
339 |
+
new Mustache_Engine(array(
|
340 |
+
'pragmas' => array('UNKNOWN'),
|
341 |
+
));
|
342 |
+
}
|
343 |
+
|
344 |
+
public function testCompileFromMustacheSourceInstance()
|
345 |
+
{
|
346 |
+
$baseDir = realpath(dirname(__FILE__) . '/../../fixtures/templates');
|
347 |
+
$mustache = new Mustache_Engine(array(
|
348 |
+
'loader' => new Mustache_Loader_ProductionFilesystemLoader($baseDir),
|
349 |
+
));
|
350 |
+
$this->assertEquals('one contents', $mustache->render('one'));
|
351 |
+
}
|
352 |
+
|
353 |
+
private function getLoggedMustache($level = Mustache_Logger::ERROR)
|
354 |
+
{
|
355 |
+
$name = tempnam(sys_get_temp_dir(), 'mustache-test');
|
356 |
+
$mustache = new Mustache_Engine(array(
|
357 |
+
'logger' => new Mustache_Logger_StreamLogger($name, $level),
|
358 |
+
));
|
359 |
+
|
360 |
+
return array($name, $mustache);
|
361 |
+
}
|
362 |
+
|
363 |
+
public function testCustomDelimiters()
|
364 |
+
{
|
365 |
+
$mustache = new Mustache_Engine(array(
|
366 |
+
'delimiters' => '[[ ]]',
|
367 |
+
'partials' => array(
|
368 |
+
'one' => '[[> two ]]',
|
369 |
+
'two' => '[[ a ]]',
|
370 |
+
),
|
371 |
+
));
|
372 |
+
|
373 |
+
$tpl = $mustache->loadTemplate('[[# a ]][[ b ]][[/a ]]');
|
374 |
+
$this->assertEquals('c', $tpl->render(array('a' => true, 'b' => 'c')));
|
375 |
+
|
376 |
+
$tpl = $mustache->loadTemplate('[[> one ]]');
|
377 |
+
$this->assertEquals('b', $tpl->render(array('a' => 'b')));
|
378 |
+
}
|
379 |
+
}
|
380 |
+
|
381 |
+
class MustacheStub extends Mustache_Engine
|
382 |
+
{
|
383 |
+
public $source;
|
384 |
+
public $template;
|
385 |
+
|
386 |
+
public function loadTemplate($source)
|
387 |
+
{
|
388 |
+
$this->source = $source;
|
389 |
+
|
390 |
+
return $this->template;
|
391 |
+
}
|
392 |
+
|
393 |
+
public function getProtectedLambdaCache()
|
394 |
+
{
|
395 |
+
return $this->getLambdaCache();
|
396 |
+
}
|
397 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Exception/SyntaxExceptionTest.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Mustache_Test_Exception_SyntaxExceptionTest extends PHPUnit_Framework_TestCase
|
13 |
+
{
|
14 |
+
public function testInstance()
|
15 |
+
{
|
16 |
+
$e = new Mustache_Exception_SyntaxException('whot', array('is' => 'this'));
|
17 |
+
$this->assertTrue($e instanceof LogicException);
|
18 |
+
$this->assertTrue($e instanceof Mustache_Exception);
|
19 |
+
}
|
20 |
+
|
21 |
+
public function testGetToken()
|
22 |
+
{
|
23 |
+
$token = array(Mustache_Tokenizer::TYPE => 'whatever');
|
24 |
+
$e = new Mustache_Exception_SyntaxException('ignore this', $token);
|
25 |
+
$this->assertEquals($token, $e->getToken());
|
26 |
+
}
|
27 |
+
|
28 |
+
public function testPrevious()
|
29 |
+
{
|
30 |
+
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
31 |
+
$this->markTestSkipped('Exception chaining requires at least PHP 5.3');
|
32 |
+
}
|
33 |
+
|
34 |
+
$previous = new Exception();
|
35 |
+
$e = new Mustache_Exception_SyntaxException('foo', array(), $previous);
|
36 |
+
|
37 |
+
$this->assertSame($previous, $e->getPrevious());
|
38 |
+
}
|
39 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Mustache_Test_Exception_UnknownFilterExceptionTest extends PHPUnit_Framework_TestCase
|
13 |
+
{
|
14 |
+
public function testInstance()
|
15 |
+
{
|
16 |
+
$e = new Mustache_Exception_UnknownFilterException('bacon');
|
17 |
+
$this->assertTrue($e instanceof UnexpectedValueException);
|
18 |
+
$this->assertTrue($e instanceof Mustache_Exception);
|
19 |
+
}
|
20 |
+
|
21 |
+
public function testMessage()
|
22 |
+
{
|
23 |
+
$e = new Mustache_Exception_UnknownFilterException('sausage');
|
24 |
+
$this->assertEquals('Unknown filter: sausage', $e->getMessage());
|
25 |
+
}
|
26 |
+
|
27 |
+
public function testGetFilterName()
|
28 |
+
{
|
29 |
+
$e = new Mustache_Exception_UnknownFilterException('eggs');
|
30 |
+
$this->assertEquals('eggs', $e->getFilterName());
|
31 |
+
}
|
32 |
+
|
33 |
+
public function testPrevious()
|
34 |
+
{
|
35 |
+
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
36 |
+
$this->markTestSkipped('Exception chaining requires at least PHP 5.3');
|
37 |
+
}
|
38 |
+
|
39 |
+
$previous = new Exception();
|
40 |
+
$e = new Mustache_Exception_UnknownFilterException('foo', $previous);
|
41 |
+
|
42 |
+
$this->assertSame($previous, $e->getPrevious());
|
43 |
+
}
|
44 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Mustache_Test_Exception_UnknownHelperExceptionTest extends PHPUnit_Framework_TestCase
|
13 |
+
{
|
14 |
+
public function testInstance()
|
15 |
+
{
|
16 |
+
$e = new Mustache_Exception_UnknownHelperException('alpha');
|
17 |
+
$this->assertTrue($e instanceof InvalidArgumentException);
|
18 |
+
$this->assertTrue($e instanceof Mustache_Exception);
|
19 |
+
}
|
20 |
+
|
21 |
+
public function testMessage()
|
22 |
+
{
|
23 |
+
$e = new Mustache_Exception_UnknownHelperException('beta');
|
24 |
+
$this->assertEquals('Unknown helper: beta', $e->getMessage());
|
25 |
+
}
|
26 |
+
|
27 |
+
public function testGetHelperName()
|
28 |
+
{
|
29 |
+
$e = new Mustache_Exception_UnknownHelperException('gamma');
|
30 |
+
$this->assertEquals('gamma', $e->getHelperName());
|
31 |
+
}
|
32 |
+
|
33 |
+
public function testPrevious()
|
34 |
+
{
|
35 |
+
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
36 |
+
$this->markTestSkipped('Exception chaining requires at least PHP 5.3');
|
37 |
+
}
|
38 |
+
|
39 |
+
$previous = new Exception();
|
40 |
+
$e = new Mustache_Exception_UnknownHelperException('foo', $previous);
|
41 |
+
$this->assertSame($previous, $e->getPrevious());
|
42 |
+
}
|
43 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Mustache_Test_Exception_UnknownTemplateExceptionTest extends PHPUnit_Framework_TestCase
|
13 |
+
{
|
14 |
+
public function testInstance()
|
15 |
+
{
|
16 |
+
$e = new Mustache_Exception_UnknownTemplateException('mario');
|
17 |
+
$this->assertTrue($e instanceof InvalidArgumentException);
|
18 |
+
$this->assertTrue($e instanceof Mustache_Exception);
|
19 |
+
}
|
20 |
+
|
21 |
+
public function testMessage()
|
22 |
+
{
|
23 |
+
$e = new Mustache_Exception_UnknownTemplateException('luigi');
|
24 |
+
$this->assertEquals('Unknown template: luigi', $e->getMessage());
|
25 |
+
}
|
26 |
+
|
27 |
+
public function testGetTemplateName()
|
28 |
+
{
|
29 |
+
$e = new Mustache_Exception_UnknownTemplateException('yoshi');
|
30 |
+
$this->assertEquals('yoshi', $e->getTemplateName());
|
31 |
+
}
|
32 |
+
|
33 |
+
public function testPrevious()
|
34 |
+
{
|
35 |
+
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
36 |
+
$this->markTestSkipped('Exception chaining requires at least PHP 5.3');
|
37 |
+
}
|
38 |
+
|
39 |
+
$previous = new Exception();
|
40 |
+
$e = new Mustache_Exception_UnknownTemplateException('foo', $previous);
|
41 |
+
$this->assertSame($previous, $e->getPrevious());
|
42 |
+
}
|
43 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group lambdas
|
14 |
+
* @group functional
|
15 |
+
*/
|
16 |
+
class Mustache_Test_FiveThree_Functional_ClosureQuirksTest extends PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
private $mustache;
|
19 |
+
|
20 |
+
public function setUp()
|
21 |
+
{
|
22 |
+
$this->mustache = new Mustache_Engine();
|
23 |
+
}
|
24 |
+
|
25 |
+
public function testClosuresDontLikeItWhenYouTouchTheirProperties()
|
26 |
+
{
|
27 |
+
$tpl = $this->mustache->loadTemplate('{{ foo.bar }}');
|
28 |
+
$this->assertEquals('', $tpl->render(array('foo' => function () {
|
29 |
+
return 'FOO';
|
30 |
+
})));
|
31 |
+
}
|
32 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/EngineTest.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group pragmas
|
14 |
+
* @group functional
|
15 |
+
*/
|
16 |
+
class Mustache_Test_FiveThree_Functional_EngineTest extends PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* @dataProvider pragmaData
|
20 |
+
*/
|
21 |
+
public function testPragmasConstructorOption($pragmas, $helpers, $data, $tpl, $expect)
|
22 |
+
{
|
23 |
+
$mustache = new Mustache_Engine(array(
|
24 |
+
'pragmas' => $pragmas,
|
25 |
+
'helpers' => $helpers,
|
26 |
+
));
|
27 |
+
|
28 |
+
$this->assertEquals($expect, $mustache->render($tpl, $data));
|
29 |
+
}
|
30 |
+
|
31 |
+
public function pragmaData()
|
32 |
+
{
|
33 |
+
$helpers = array(
|
34 |
+
'longdate' => function (\DateTime $value) {
|
35 |
+
return $value->format('Y-m-d h:m:s');
|
36 |
+
},
|
37 |
+
);
|
38 |
+
|
39 |
+
$data = array(
|
40 |
+
'date' => new DateTime('1/1/2000', new DateTimeZone('UTC')),
|
41 |
+
);
|
42 |
+
|
43 |
+
$tpl = '{{ date | longdate }}';
|
44 |
+
|
45 |
+
return array(
|
46 |
+
array(array(Mustache_Engine::PRAGMA_FILTERS), $helpers, $data, $tpl, '2000-01-01 12:01:00'),
|
47 |
+
array(array(), $helpers, $data, $tpl, ''),
|
48 |
+
);
|
49 |
+
}
|
50 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/FiltersTest.php
ADDED
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group filters
|
14 |
+
* @group functional
|
15 |
+
*/
|
16 |
+
class Mustache_Test_FiveThree_Functional_FiltersTest extends PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
private $mustache;
|
19 |
+
|
20 |
+
public function setUp()
|
21 |
+
{
|
22 |
+
$this->mustache = new Mustache_Engine();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @dataProvider singleFilterData
|
27 |
+
*/
|
28 |
+
public function testSingleFilter($tpl, $helpers, $data, $expect)
|
29 |
+
{
|
30 |
+
$this->mustache->setHelpers($helpers);
|
31 |
+
$this->assertEquals($expect, $this->mustache->render($tpl, $data));
|
32 |
+
}
|
33 |
+
|
34 |
+
public function singleFilterData()
|
35 |
+
{
|
36 |
+
$helpers = array(
|
37 |
+
'longdate' => function (\DateTime $value) {
|
38 |
+
return $value->format('Y-m-d h:m:s');
|
39 |
+
},
|
40 |
+
'echo' => function ($value) {
|
41 |
+
return array($value, $value, $value);
|
42 |
+
},
|
43 |
+
);
|
44 |
+
|
45 |
+
return array(
|
46 |
+
array(
|
47 |
+
'{{% FILTERS }}{{ date | longdate }}',
|
48 |
+
$helpers,
|
49 |
+
(object) array('date' => new DateTime('1/1/2000', new DateTimeZone('UTC'))),
|
50 |
+
'2000-01-01 12:01:00',
|
51 |
+
),
|
52 |
+
|
53 |
+
array(
|
54 |
+
'{{% FILTERS }}{{# word | echo }}{{ . }}!{{/ word | echo }}',
|
55 |
+
$helpers,
|
56 |
+
array('word' => 'bacon'),
|
57 |
+
'bacon!bacon!bacon!',
|
58 |
+
),
|
59 |
+
);
|
60 |
+
}
|
61 |
+
|
62 |
+
public function testChainedFilters()
|
63 |
+
{
|
64 |
+
$tpl = $this->mustache->loadTemplate('{{% FILTERS }}{{ date | longdate | withbrackets }}');
|
65 |
+
|
66 |
+
$this->mustache->addHelper('longdate', function (\DateTime $value) {
|
67 |
+
return $value->format('Y-m-d h:m:s');
|
68 |
+
});
|
69 |
+
|
70 |
+
$this->mustache->addHelper('withbrackets', function ($value) {
|
71 |
+
return sprintf('[[%s]]', $value);
|
72 |
+
});
|
73 |
+
|
74 |
+
$foo = new \StdClass();
|
75 |
+
$foo->date = new DateTime('1/1/2000', new DateTimeZone('UTC'));
|
76 |
+
|
77 |
+
$this->assertEquals('[[2000-01-01 12:01:00]]', $tpl->render($foo));
|
78 |
+
}
|
79 |
+
|
80 |
+
const CHAINED_SECTION_FILTERS_TPL = <<<'EOS'
|
81 |
+
{{% FILTERS }}
|
82 |
+
{{# word | echo | with_index }}
|
83 |
+
{{ key }}: {{ value }}
|
84 |
+
{{/ word | echo | with_index }}
|
85 |
+
EOS;
|
86 |
+
|
87 |
+
public function testChainedSectionFilters()
|
88 |
+
{
|
89 |
+
$tpl = $this->mustache->loadTemplate(self::CHAINED_SECTION_FILTERS_TPL);
|
90 |
+
|
91 |
+
$this->mustache->addHelper('echo', function ($value) {
|
92 |
+
return array($value, $value, $value);
|
93 |
+
});
|
94 |
+
|
95 |
+
$this->mustache->addHelper('with_index', function ($value) {
|
96 |
+
return array_map(function ($k, $v) {
|
97 |
+
return array(
|
98 |
+
'key' => $k,
|
99 |
+
'value' => $v,
|
100 |
+
);
|
101 |
+
}, array_keys($value), $value);
|
102 |
+
});
|
103 |
+
|
104 |
+
$this->assertEquals("0: bacon\n1: bacon\n2: bacon\n", $tpl->render(array('word' => 'bacon')));
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* @dataProvider interpolateFirstData
|
109 |
+
*/
|
110 |
+
public function testInterpolateFirst($tpl, $data, $expect)
|
111 |
+
{
|
112 |
+
$this->assertEquals($expect, $this->mustache->render($tpl, $data));
|
113 |
+
}
|
114 |
+
|
115 |
+
public function interpolateFirstData()
|
116 |
+
{
|
117 |
+
$data = array(
|
118 |
+
'foo' => 'FOO',
|
119 |
+
'bar' => function ($value) {
|
120 |
+
return ($value === 'FOO') ? 'win!' : 'fail :(';
|
121 |
+
},
|
122 |
+
);
|
123 |
+
|
124 |
+
return array(
|
125 |
+
array('{{% FILTERS }}{{ foo | bar }}', $data, 'win!'),
|
126 |
+
array('{{% FILTERS }}{{# foo | bar }}{{ . }}{{/ foo | bar }}', $data, 'win!'),
|
127 |
+
);
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @expectedException Mustache_Exception_UnknownFilterException
|
132 |
+
* @dataProvider brokenPipeData
|
133 |
+
*/
|
134 |
+
public function testThrowsExceptionForBrokenPipes($tpl, $data)
|
135 |
+
{
|
136 |
+
$this->mustache->render($tpl, $data);
|
137 |
+
}
|
138 |
+
|
139 |
+
public function brokenPipeData()
|
140 |
+
{
|
141 |
+
return array(
|
142 |
+
array('{{% FILTERS }}{{ foo | bar }}', array()),
|
143 |
+
array('{{% FILTERS }}{{ foo | bar }}', array('foo' => 'FOO')),
|
144 |
+
array('{{% FILTERS }}{{ foo | bar }}', array('foo' => 'FOO', 'bar' => 'BAR')),
|
145 |
+
array('{{% FILTERS }}{{ foo | bar }}', array('foo' => 'FOO', 'bar' => array(1, 2))),
|
146 |
+
array('{{% FILTERS }}{{ foo | bar | baz }}', array('foo' => 'FOO', 'bar' => function () {
|
147 |
+
return 'BAR';
|
148 |
+
})),
|
149 |
+
array('{{% FILTERS }}{{ foo | bar | baz }}', array('foo' => 'FOO', 'baz' => function () {
|
150 |
+
return 'BAZ';
|
151 |
+
})),
|
152 |
+
array('{{% FILTERS }}{{ foo | bar | baz }}', array('bar' => function () {
|
153 |
+
return 'BAR';
|
154 |
+
})),
|
155 |
+
array('{{% FILTERS }}{{ foo | bar | baz }}', array('baz' => function () {
|
156 |
+
return 'BAZ';
|
157 |
+
})),
|
158 |
+
array('{{% FILTERS }}{{ foo | bar.baz }}', array('foo' => 'FOO', 'bar' => function () {
|
159 |
+
return 'BAR';
|
160 |
+
}, 'baz' => function () {
|
161 |
+
return 'BAZ';
|
162 |
+
})),
|
163 |
+
|
164 |
+
array('{{% FILTERS }}{{# foo | bar }}{{ . }}{{/ foo | bar }}', array()),
|
165 |
+
array('{{% FILTERS }}{{# foo | bar }}{{ . }}{{/ foo | bar }}', array('foo' => 'FOO')),
|
166 |
+
array('{{% FILTERS }}{{# foo | bar }}{{ . }}{{/ foo | bar }}', array('foo' => 'FOO', 'bar' => 'BAR')),
|
167 |
+
array('{{% FILTERS }}{{# foo | bar }}{{ . }}{{/ foo | bar }}', array('foo' => 'FOO', 'bar' => array(1, 2))),
|
168 |
+
array('{{% FILTERS }}{{# foo | bar | baz }}{{ . }}{{/ foo | bar | baz }}', array('foo' => 'FOO', 'bar' => function () {
|
169 |
+
return 'BAR';
|
170 |
+
})),
|
171 |
+
array('{{% FILTERS }}{{# foo | bar | baz }}{{ . }}{{/ foo | bar | baz }}', array('foo' => 'FOO', 'baz' => function () {
|
172 |
+
return 'BAZ';
|
173 |
+
})),
|
174 |
+
array('{{% FILTERS }}{{# foo | bar | baz }}{{ . }}{{/ foo | bar | baz }}', array('bar' => function () {
|
175 |
+
return 'BAR';
|
176 |
+
})),
|
177 |
+
array('{{% FILTERS }}{{# foo | bar | baz }}{{ . }}{{/ foo | bar | baz }}', array('baz' => function () {
|
178 |
+
return 'BAZ';
|
179 |
+
})),
|
180 |
+
array('{{% FILTERS }}{{# foo | bar.baz }}{{ . }}{{/ foo | bar.baz }}', array('foo' => 'FOO', 'bar' => function () {
|
181 |
+
return 'BAR';
|
182 |
+
}, 'baz' => function () {
|
183 |
+
return 'BAZ';
|
184 |
+
})),
|
185 |
+
);
|
186 |
+
}
|
187 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group lambdas
|
14 |
+
* @group functional
|
15 |
+
*/
|
16 |
+
class Mustache_Test_FiveThree_Functional_HigherOrderSectionsTest extends PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
private $mustache;
|
19 |
+
|
20 |
+
public function setUp()
|
21 |
+
{
|
22 |
+
$this->mustache = new Mustache_Engine();
|
23 |
+
}
|
24 |
+
|
25 |
+
public function testAnonymousFunctionSectionCallback()
|
26 |
+
{
|
27 |
+
$tpl = $this->mustache->loadTemplate('{{#wrapper}}{{name}}{{/wrapper}}');
|
28 |
+
|
29 |
+
$foo = new Mustache_Test_FiveThree_Functional_Foo();
|
30 |
+
$foo->name = 'Mario';
|
31 |
+
$foo->wrapper = function ($text) {
|
32 |
+
return sprintf('<div class="anonymous">%s</div>', $text);
|
33 |
+
};
|
34 |
+
|
35 |
+
$this->assertEquals(sprintf('<div class="anonymous">%s</div>', $foo->name), $tpl->render($foo));
|
36 |
+
}
|
37 |
+
|
38 |
+
public function testSectionCallback()
|
39 |
+
{
|
40 |
+
$one = $this->mustache->loadTemplate('{{name}}');
|
41 |
+
$two = $this->mustache->loadTemplate('{{#wrap}}{{name}}{{/wrap}}');
|
42 |
+
|
43 |
+
$foo = new Mustache_Test_FiveThree_Functional_Foo();
|
44 |
+
$foo->name = 'Luigi';
|
45 |
+
|
46 |
+
$this->assertEquals($foo->name, $one->render($foo));
|
47 |
+
$this->assertEquals(sprintf('<em>%s</em>', $foo->name), $two->render($foo));
|
48 |
+
}
|
49 |
+
|
50 |
+
public function testViewArrayAnonymousSectionCallback()
|
51 |
+
{
|
52 |
+
$tpl = $this->mustache->loadTemplate('{{#wrap}}{{name}}{{/wrap}}');
|
53 |
+
|
54 |
+
$data = array(
|
55 |
+
'name' => 'Bob',
|
56 |
+
'wrap' => function ($text) {
|
57 |
+
return sprintf('[[%s]]', $text);
|
58 |
+
},
|
59 |
+
);
|
60 |
+
|
61 |
+
$this->assertEquals(sprintf('[[%s]]', $data['name']), $tpl->render($data));
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
class Mustache_Test_FiveThree_Functional_Foo
|
66 |
+
{
|
67 |
+
public $name = 'Justin';
|
68 |
+
public $lorem = 'Lorem ipsum dolor sit amet,';
|
69 |
+
public $wrap;
|
70 |
+
|
71 |
+
public function __construct()
|
72 |
+
{
|
73 |
+
$this->wrap = function ($text) {
|
74 |
+
return sprintf('<em>%s</em>', $text);
|
75 |
+
};
|
76 |
+
}
|
77 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group lambdas
|
14 |
+
* @group functional
|
15 |
+
*/
|
16 |
+
class Mustache_Test_FiveThree_Functional_LambdaHelperTest extends PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
private $mustache;
|
19 |
+
|
20 |
+
public function setUp()
|
21 |
+
{
|
22 |
+
$this->mustache = new Mustache_Engine();
|
23 |
+
}
|
24 |
+
|
25 |
+
public function testSectionLambdaHelper()
|
26 |
+
{
|
27 |
+
$one = $this->mustache->loadTemplate('{{name}}');
|
28 |
+
$two = $this->mustache->loadTemplate('{{#lambda}}{{name}}{{/lambda}}');
|
29 |
+
|
30 |
+
$foo = new StdClass();
|
31 |
+
$foo->name = 'Mario';
|
32 |
+
$foo->lambda = function ($text, $mustache) {
|
33 |
+
return strtoupper($mustache->render($text));
|
34 |
+
};
|
35 |
+
|
36 |
+
$this->assertEquals('Mario', $one->render($foo));
|
37 |
+
$this->assertEquals('MARIO', $two->render($foo));
|
38 |
+
}
|
39 |
+
|
40 |
+
public function testSectionLambdaHelperRespectsDelimiterChanges()
|
41 |
+
{
|
42 |
+
$tpl = $this->mustache->loadTemplate("{{=<% %>=}}\n<%# bang %><% value %><%/ bang %>");
|
43 |
+
|
44 |
+
$data = new StdClass();
|
45 |
+
$data->value = 'hello world';
|
46 |
+
$data->bang = function ($text, $mustache) {
|
47 |
+
return $mustache->render($text) . '!';
|
48 |
+
};
|
49 |
+
|
50 |
+
$this->assertEquals('hello world!', $tpl->render($data));
|
51 |
+
}
|
52 |
+
|
53 |
+
public function testLambdaHelperIsInvokable()
|
54 |
+
{
|
55 |
+
$one = $this->mustache->loadTemplate('{{name}}');
|
56 |
+
$two = $this->mustache->loadTemplate('{{#lambda}}{{name}}{{/lambda}}');
|
57 |
+
|
58 |
+
$foo = new StdClass();
|
59 |
+
$foo->name = 'Mario';
|
60 |
+
$foo->lambda = function ($text, $render) {
|
61 |
+
return strtoupper($render($text));
|
62 |
+
};
|
63 |
+
|
64 |
+
$this->assertEquals('Mario', $one->render($foo));
|
65 |
+
$this->assertEquals('MARIO', $two->render($foo));
|
66 |
+
}
|
67 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* A PHPUnit test case wrapping the Mustache Spec.
|
14 |
+
*
|
15 |
+
* @group mustache-spec
|
16 |
+
* @group functional
|
17 |
+
*/
|
18 |
+
class Mustache_Test_FiveThree_Functional_MustacheSpecTest extends Mustache_Test_SpecTestCase
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* For some reason data providers can't mark tests skipped, so this test exists
|
22 |
+
* simply to provide a 'skipped' test if the `spec` submodule isn't initialized.
|
23 |
+
*/
|
24 |
+
public function testSpecInitialized()
|
25 |
+
{
|
26 |
+
if (!file_exists(dirname(__FILE__) . '/../../../../../vendor/spec/specs/')) {
|
27 |
+
$this->markTestSkipped('Mustache spec submodule not initialized: run "git submodule update --init"');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @group lambdas
|
33 |
+
* @dataProvider loadLambdasSpec
|
34 |
+
*/
|
35 |
+
public function testLambdasSpec($desc, $source, $partials, $data, $expected)
|
36 |
+
{
|
37 |
+
$template = self::loadTemplate($source, $partials);
|
38 |
+
$this->assertEquals($expected, $template($this->prepareLambdasSpec($data)), $desc);
|
39 |
+
}
|
40 |
+
|
41 |
+
public function loadLambdasSpec()
|
42 |
+
{
|
43 |
+
return $this->loadSpec('~lambdas');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Extract and lambdafy any 'lambda' values found in the $data array.
|
48 |
+
*/
|
49 |
+
private function prepareLambdasSpec($data)
|
50 |
+
{
|
51 |
+
foreach ($data as $key => $val) {
|
52 |
+
if ($key === 'lambda') {
|
53 |
+
if (!isset($val['php'])) {
|
54 |
+
$this->markTestSkipped(sprintf('PHP lambda test not implemented for this test.'));
|
55 |
+
}
|
56 |
+
|
57 |
+
$func = $val['php'];
|
58 |
+
$data[$key] = function ($text = null) use ($func) {
|
59 |
+
return eval($func);
|
60 |
+
};
|
61 |
+
} elseif (is_array($val)) {
|
62 |
+
$data[$key] = $this->prepareLambdasSpec($val);
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
return $data;
|
67 |
+
}
|
68 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group lambdas
|
14 |
+
* @group functional
|
15 |
+
*/
|
16 |
+
class Mustache_Test_FiveThree_Functional_PartialLambdaIndentTest extends PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
public function testLambdasInsidePartialsAreIndentedProperly()
|
19 |
+
{
|
20 |
+
$src = <<<'EOS'
|
21 |
+
<fieldset>
|
22 |
+
{{> input }}
|
23 |
+
</fieldset>
|
24 |
+
|
25 |
+
EOS;
|
26 |
+
$partial = <<<'EOS'
|
27 |
+
<input placeholder="{{# _t }}Enter your name{{/ _t }}">
|
28 |
+
|
29 |
+
EOS;
|
30 |
+
|
31 |
+
$expected = <<<'EOS'
|
32 |
+
<fieldset>
|
33 |
+
<input placeholder="ENTER YOUR NAME">
|
34 |
+
</fieldset>
|
35 |
+
|
36 |
+
EOS;
|
37 |
+
|
38 |
+
$m = new Mustache_Engine(array(
|
39 |
+
'partials' => array('input' => $partial),
|
40 |
+
));
|
41 |
+
|
42 |
+
$tpl = $m->loadTemplate($src);
|
43 |
+
|
44 |
+
$data = new Mustache_Test_FiveThree_Functional_ClassWithLambda();
|
45 |
+
$this->assertEquals($expected, $tpl->render($data));
|
46 |
+
}
|
47 |
+
|
48 |
+
public function testLambdaInterpolationsInsidePartialsAreIndentedProperly()
|
49 |
+
{
|
50 |
+
$src = <<<'EOS'
|
51 |
+
<fieldset>
|
52 |
+
{{> input }}
|
53 |
+
</fieldset>
|
54 |
+
|
55 |
+
EOS;
|
56 |
+
$partial = <<<'EOS'
|
57 |
+
<input placeholder="{{ placeholder }}">
|
58 |
+
|
59 |
+
EOS;
|
60 |
+
|
61 |
+
$expected = <<<'EOS'
|
62 |
+
<fieldset>
|
63 |
+
<input placeholder="Enter your name">
|
64 |
+
</fieldset>
|
65 |
+
|
66 |
+
EOS;
|
67 |
+
|
68 |
+
$m = new Mustache_Engine(array(
|
69 |
+
'partials' => array('input' => $partial),
|
70 |
+
));
|
71 |
+
|
72 |
+
$tpl = $m->loadTemplate($src);
|
73 |
+
|
74 |
+
$data = new Mustache_Test_FiveThree_Functional_ClassWithLambda();
|
75 |
+
$this->assertEquals($expected, $tpl->render($data));
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
class Mustache_Test_FiveThree_Functional_ClassWithLambda
|
80 |
+
{
|
81 |
+
public function _t()
|
82 |
+
{
|
83 |
+
return function ($val) {
|
84 |
+
return strtoupper($val);
|
85 |
+
};
|
86 |
+
}
|
87 |
+
|
88 |
+
public function placeholder()
|
89 |
+
{
|
90 |
+
return function () {
|
91 |
+
return 'Enter your name';
|
92 |
+
};
|
93 |
+
}
|
94 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group lambdas
|
14 |
+
* @group functional
|
15 |
+
*/
|
16 |
+
class Mustache_Test_FiveThree_Functional_StrictCallablesTest extends PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* @dataProvider callables
|
20 |
+
*/
|
21 |
+
public function testStrictCallables($strict, $name, $section, $expected)
|
22 |
+
{
|
23 |
+
$mustache = new Mustache_Engine(array('strict_callables' => $strict));
|
24 |
+
$tpl = $mustache->loadTemplate('{{# section }}{{ name }}{{/ section }}');
|
25 |
+
|
26 |
+
$data = new StdClass();
|
27 |
+
$data->name = $name;
|
28 |
+
$data->section = $section;
|
29 |
+
|
30 |
+
$this->assertEquals($expected, $tpl->render($data));
|
31 |
+
}
|
32 |
+
|
33 |
+
public function callables()
|
34 |
+
{
|
35 |
+
$lambda = function ($tpl, $mustache) {
|
36 |
+
return strtoupper($mustache->render($tpl));
|
37 |
+
};
|
38 |
+
|
39 |
+
return array(
|
40 |
+
// Interpolation lambdas
|
41 |
+
array(
|
42 |
+
false,
|
43 |
+
array($this, 'instanceName'),
|
44 |
+
$lambda,
|
45 |
+
'YOSHI',
|
46 |
+
),
|
47 |
+
array(
|
48 |
+
false,
|
49 |
+
array(__CLASS__, 'staticName'),
|
50 |
+
$lambda,
|
51 |
+
'YOSHI',
|
52 |
+
),
|
53 |
+
array(
|
54 |
+
false,
|
55 |
+
function () {
|
56 |
+
return 'Yoshi';
|
57 |
+
},
|
58 |
+
$lambda,
|
59 |
+
'YOSHI',
|
60 |
+
),
|
61 |
+
|
62 |
+
// Section lambdas
|
63 |
+
array(
|
64 |
+
false,
|
65 |
+
'Yoshi',
|
66 |
+
array($this, 'instanceCallable'),
|
67 |
+
'YOSHI',
|
68 |
+
),
|
69 |
+
array(
|
70 |
+
false,
|
71 |
+
'Yoshi',
|
72 |
+
array(__CLASS__, 'staticCallable'),
|
73 |
+
'YOSHI',
|
74 |
+
),
|
75 |
+
array(
|
76 |
+
false,
|
77 |
+
'Yoshi',
|
78 |
+
$lambda,
|
79 |
+
'YOSHI',
|
80 |
+
),
|
81 |
+
|
82 |
+
// Strict interpolation lambdas
|
83 |
+
array(
|
84 |
+
true,
|
85 |
+
function () {
|
86 |
+
return 'Yoshi';
|
87 |
+
},
|
88 |
+
$lambda,
|
89 |
+
'YOSHI',
|
90 |
+
),
|
91 |
+
|
92 |
+
// Strict section lambdas
|
93 |
+
array(
|
94 |
+
true,
|
95 |
+
'Yoshi',
|
96 |
+
array($this, 'instanceCallable'),
|
97 |
+
'YoshiYoshi',
|
98 |
+
),
|
99 |
+
array(
|
100 |
+
true,
|
101 |
+
'Yoshi',
|
102 |
+
array(__CLASS__, 'staticCallable'),
|
103 |
+
'YoshiYoshi',
|
104 |
+
),
|
105 |
+
array(
|
106 |
+
true,
|
107 |
+
'Yoshi',
|
108 |
+
function ($tpl, $mustache) {
|
109 |
+
return strtoupper($mustache->render($tpl));
|
110 |
+
},
|
111 |
+
'YOSHI',
|
112 |
+
),
|
113 |
+
);
|
114 |
+
}
|
115 |
+
|
116 |
+
public function instanceCallable($tpl, $mustache)
|
117 |
+
{
|
118 |
+
return strtoupper($mustache->render($tpl));
|
119 |
+
}
|
120 |
+
|
121 |
+
public static function staticCallable($tpl, $mustache)
|
122 |
+
{
|
123 |
+
return strtoupper($mustache->render($tpl));
|
124 |
+
}
|
125 |
+
|
126 |
+
public function instanceName()
|
127 |
+
{
|
128 |
+
return 'Yoshi';
|
129 |
+
}
|
130 |
+
|
131 |
+
public static function staticName()
|
132 |
+
{
|
133 |
+
return 'Yoshi';
|
134 |
+
}
|
135 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Functional/CallTest.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group magic_methods
|
14 |
+
* @group functional
|
15 |
+
*/
|
16 |
+
class Mustache_Test_Functional_CallTest extends PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
public function testCallEatsContext()
|
19 |
+
{
|
20 |
+
$m = new Mustache_Engine();
|
21 |
+
$tpl = $m->loadTemplate('{{# foo }}{{ label }}: {{ name }}{{/ foo }}');
|
22 |
+
|
23 |
+
$foo = new Mustache_Test_Functional_ClassWithCall();
|
24 |
+
$foo->name = 'Bob';
|
25 |
+
|
26 |
+
$data = array('label' => 'name', 'foo' => $foo);
|
27 |
+
|
28 |
+
$this->assertEquals('name: Bob', $tpl->render($data));
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
class Mustache_Test_Functional_ClassWithCall
|
33 |
+
{
|
34 |
+
public $name;
|
35 |
+
|
36 |
+
public function __call($method, $args)
|
37 |
+
{
|
38 |
+
return 'unknown value';
|
39 |
+
}
|
40 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Functional/ExamplesTest.php
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group examples
|
14 |
+
* @group functional
|
15 |
+
*/
|
16 |
+
class Mustache_Test_Functional_ExamplesTest extends PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* Test everything in the `examples` directory.
|
20 |
+
*
|
21 |
+
* @dataProvider getExamples
|
22 |
+
*
|
23 |
+
* @param string $context
|
24 |
+
* @param string $source
|
25 |
+
* @param array $partials
|
26 |
+
* @param string $expected
|
27 |
+
*/
|
28 |
+
public function testExamples($context, $source, $partials, $expected)
|
29 |
+
{
|
30 |
+
$mustache = new Mustache_Engine(array(
|
31 |
+
'partials' => $partials,
|
32 |
+
));
|
33 |
+
$this->assertEquals($expected, $mustache->loadTemplate($source)->render($context));
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Data provider for testExamples method.
|
38 |
+
*
|
39 |
+
* Loads examples from the test fixtures directory.
|
40 |
+
*
|
41 |
+
* This examples directory should contain any number of subdirectories, each of which contains
|
42 |
+
* three files: one Mustache class (.php), one Mustache template (.mustache), and one output file
|
43 |
+
* (.txt). Optionally, the directory may contain a folder full of partials.
|
44 |
+
*
|
45 |
+
* @return array
|
46 |
+
*/
|
47 |
+
public function getExamples()
|
48 |
+
{
|
49 |
+
$path = realpath(dirname(__FILE__) . '/../../../fixtures/examples');
|
50 |
+
$examples = array();
|
51 |
+
|
52 |
+
$handle = opendir($path);
|
53 |
+
while (($file = readdir($handle)) !== false) {
|
54 |
+
if ($file === '.' || $file === '..') {
|
55 |
+
continue;
|
56 |
+
}
|
57 |
+
|
58 |
+
$fullpath = $path . '/' . $file;
|
59 |
+
if (is_dir($fullpath)) {
|
60 |
+
$examples[$file] = $this->loadExample($fullpath);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
closedir($handle);
|
64 |
+
|
65 |
+
return $examples;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Helper method to load an example given the full path.
|
70 |
+
*
|
71 |
+
* @param string $path
|
72 |
+
*
|
73 |
+
* @return array arguments for testExamples
|
74 |
+
*/
|
75 |
+
private function loadExample($path)
|
76 |
+
{
|
77 |
+
$context = null;
|
78 |
+
$source = null;
|
79 |
+
$partials = array();
|
80 |
+
$expected = null;
|
81 |
+
|
82 |
+
$handle = opendir($path);
|
83 |
+
while (($file = readdir($handle)) !== false) {
|
84 |
+
$fullpath = $path . '/' . $file;
|
85 |
+
$info = pathinfo($fullpath);
|
86 |
+
|
87 |
+
if (is_dir($fullpath) && $info['basename'] === 'partials') {
|
88 |
+
// load partials
|
89 |
+
$partials = $this->loadPartials($fullpath);
|
90 |
+
} elseif (is_file($fullpath)) {
|
91 |
+
// load other files
|
92 |
+
switch ($info['extension']) {
|
93 |
+
case 'php':
|
94 |
+
require_once $fullpath;
|
95 |
+
$className = $info['filename'];
|
96 |
+
$context = new $className();
|
97 |
+
break;
|
98 |
+
|
99 |
+
case 'mustache':
|
100 |
+
$source = file_get_contents($fullpath);
|
101 |
+
break;
|
102 |
+
|
103 |
+
case 'txt':
|
104 |
+
$expected = file_get_contents($fullpath);
|
105 |
+
break;
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
closedir($handle);
|
110 |
+
|
111 |
+
return array($context, $source, $partials, $expected);
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Helper method to load partials given an example directory.
|
116 |
+
*
|
117 |
+
* @param string $path
|
118 |
+
*
|
119 |
+
* @return array $partials
|
120 |
+
*/
|
121 |
+
private function loadPartials($path)
|
122 |
+
{
|
123 |
+
$partials = array();
|
124 |
+
|
125 |
+
$handle = opendir($path);
|
126 |
+
while (($file = readdir($handle)) !== false) {
|
127 |
+
if ($file === '.' || $file === '..') {
|
128 |
+
continue;
|
129 |
+
}
|
130 |
+
|
131 |
+
$fullpath = $path . '/' . $file;
|
132 |
+
$info = pathinfo($fullpath);
|
133 |
+
|
134 |
+
if ($info['extension'] === 'mustache') {
|
135 |
+
$partials[$info['filename']] = file_get_contents($fullpath);
|
136 |
+
}
|
137 |
+
}
|
138 |
+
closedir($handle);
|
139 |
+
|
140 |
+
return $partials;
|
141 |
+
}
|
142 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Functional/HigherOrderSectionsTest.php
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group lambdas
|
14 |
+
* @group functional
|
15 |
+
*/
|
16 |
+
class Mustache_Test_Functional_HigherOrderSectionsTest extends Mustache_Test_FunctionalTestCase
|
17 |
+
{
|
18 |
+
private $mustache;
|
19 |
+
|
20 |
+
public function setUp()
|
21 |
+
{
|
22 |
+
$this->mustache = new Mustache_Engine();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @dataProvider sectionCallbackData
|
27 |
+
*/
|
28 |
+
public function testSectionCallback($data, $tpl, $expect)
|
29 |
+
{
|
30 |
+
$this->assertEquals($expect, $this->mustache->render($tpl, $data));
|
31 |
+
}
|
32 |
+
|
33 |
+
public function sectionCallbackData()
|
34 |
+
{
|
35 |
+
$foo = new Mustache_Test_Functional_Foo();
|
36 |
+
$foo->doublewrap = array($foo, 'wrapWithBoth');
|
37 |
+
|
38 |
+
$bar = new Mustache_Test_Functional_Foo();
|
39 |
+
$bar->trimmer = array(get_class($bar), 'staticTrim');
|
40 |
+
|
41 |
+
return array(
|
42 |
+
array($foo, '{{#doublewrap}}{{name}}{{/doublewrap}}', sprintf('<strong><em>%s</em></strong>', $foo->name)),
|
43 |
+
array($bar, '{{#trimmer}} {{name}} {{/trimmer}}', $bar->name),
|
44 |
+
);
|
45 |
+
}
|
46 |
+
|
47 |
+
public function testViewArraySectionCallback()
|
48 |
+
{
|
49 |
+
$tpl = $this->mustache->loadTemplate('{{#trim}} {{name}} {{/trim}}');
|
50 |
+
|
51 |
+
$foo = new Mustache_Test_Functional_Foo();
|
52 |
+
|
53 |
+
$data = array(
|
54 |
+
'name' => 'Bob',
|
55 |
+
'trim' => array(get_class($foo), 'staticTrim'),
|
56 |
+
);
|
57 |
+
|
58 |
+
$this->assertEquals($data['name'], $tpl->render($data));
|
59 |
+
}
|
60 |
+
|
61 |
+
public function testMonsters()
|
62 |
+
{
|
63 |
+
$tpl = $this->mustache->loadTemplate('{{#title}}{{title}} {{/title}}{{name}}');
|
64 |
+
|
65 |
+
$frank = new Mustache_Test_Functional_Monster();
|
66 |
+
$frank->title = 'Dr.';
|
67 |
+
$frank->name = 'Frankenstein';
|
68 |
+
$this->assertEquals('Dr. Frankenstein', $tpl->render($frank));
|
69 |
+
|
70 |
+
$dracula = new Mustache_Test_Functional_Monster();
|
71 |
+
$dracula->title = 'Count';
|
72 |
+
$dracula->name = 'Dracula';
|
73 |
+
$this->assertEquals('Count Dracula', $tpl->render($dracula));
|
74 |
+
}
|
75 |
+
|
76 |
+
public function testPassthroughOptimization()
|
77 |
+
{
|
78 |
+
$mustache = $this->getMock('Mustache_Engine', array('loadLambda'));
|
79 |
+
$mustache->expects($this->never())
|
80 |
+
->method('loadLambda');
|
81 |
+
|
82 |
+
$tpl = $mustache->loadTemplate('{{#wrap}}NAME{{/wrap}}');
|
83 |
+
|
84 |
+
$foo = new Mustache_Test_Functional_Foo();
|
85 |
+
$foo->wrap = array($foo, 'wrapWithEm');
|
86 |
+
|
87 |
+
$this->assertEquals('<em>NAME</em>', $tpl->render($foo));
|
88 |
+
}
|
89 |
+
|
90 |
+
public function testWithoutPassthroughOptimization()
|
91 |
+
{
|
92 |
+
$mustache = $this->getMock('Mustache_Engine', array('loadLambda'));
|
93 |
+
$mustache->expects($this->once())
|
94 |
+
->method('loadLambda')
|
95 |
+
->will($this->returnValue($mustache->loadTemplate('<em>{{ name }}</em>')));
|
96 |
+
|
97 |
+
$tpl = $mustache->loadTemplate('{{#wrap}}{{name}}{{/wrap}}');
|
98 |
+
|
99 |
+
$foo = new Mustache_Test_Functional_Foo();
|
100 |
+
$foo->wrap = array($foo, 'wrapWithEm');
|
101 |
+
|
102 |
+
$this->assertEquals('<em>' . $foo->name . '</em>', $tpl->render($foo));
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* @dataProvider cacheLambdaTemplatesData
|
107 |
+
*/
|
108 |
+
public function testCacheLambdaTemplatesOptionWorks($dirName, $tplPrefix, $enable, $expect)
|
109 |
+
{
|
110 |
+
$cacheDir = $this->setUpCacheDir($dirName);
|
111 |
+
$mustache = new Mustache_Engine(array(
|
112 |
+
'template_class_prefix' => $tplPrefix,
|
113 |
+
'cache' => $cacheDir,
|
114 |
+
'cache_lambda_templates' => $enable,
|
115 |
+
));
|
116 |
+
|
117 |
+
$tpl = $mustache->loadTemplate('{{#wrap}}{{name}}{{/wrap}}');
|
118 |
+
$foo = new Mustache_Test_Functional_Foo();
|
119 |
+
$foo->wrap = array($foo, 'wrapWithEm');
|
120 |
+
$this->assertEquals('<em>' . $foo->name . '</em>', $tpl->render($foo));
|
121 |
+
$this->assertCount($expect, glob($cacheDir . '/*.php'));
|
122 |
+
}
|
123 |
+
|
124 |
+
public function cacheLambdaTemplatesData()
|
125 |
+
{
|
126 |
+
return array(
|
127 |
+
array('test_enabling_lambda_cache', '_TestEnablingLambdaCache_', true, 2),
|
128 |
+
array('test_disabling_lambda_cache', '_TestDisablingLambdaCache_', false, 1),
|
129 |
+
);
|
130 |
+
}
|
131 |
+
|
132 |
+
protected function setUpCacheDir($name)
|
133 |
+
{
|
134 |
+
$cacheDir = self::$tempDir . '/' . $name;
|
135 |
+
if (file_exists($cacheDir)) {
|
136 |
+
self::rmdir($cacheDir);
|
137 |
+
}
|
138 |
+
mkdir($cacheDir, 0777, true);
|
139 |
+
|
140 |
+
return $cacheDir;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
class Mustache_Test_Functional_Foo
|
145 |
+
{
|
146 |
+
public $name = 'Justin';
|
147 |
+
public $lorem = 'Lorem ipsum dolor sit amet,';
|
148 |
+
|
149 |
+
public function wrapWithEm($text)
|
150 |
+
{
|
151 |
+
return sprintf('<em>%s</em>', $text);
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* @param string $text
|
156 |
+
*/
|
157 |
+
public function wrapWithStrong($text)
|
158 |
+
{
|
159 |
+
return sprintf('<strong>%s</strong>', $text);
|
160 |
+
}
|
161 |
+
|
162 |
+
public function wrapWithBoth($text)
|
163 |
+
{
|
164 |
+
return self::wrapWithStrong(self::wrapWithEm($text));
|
165 |
+
}
|
166 |
+
|
167 |
+
public static function staticTrim($text)
|
168 |
+
{
|
169 |
+
return trim($text);
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
class Mustache_Test_Functional_Monster
|
174 |
+
{
|
175 |
+
public $title;
|
176 |
+
public $name;
|
177 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Functional/InheritanceTest.php
ADDED
@@ -0,0 +1,543 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group inheritance
|
14 |
+
* @group functional
|
15 |
+
*/
|
16 |
+
class Mustache_Test_Functional_InheritanceTest extends PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
private $mustache;
|
19 |
+
|
20 |
+
public function setUp()
|
21 |
+
{
|
22 |
+
$this->mustache = new Mustache_Engine(array(
|
23 |
+
'pragmas' => array(Mustache_Engine::PRAGMA_BLOCKS),
|
24 |
+
));
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getIllegalInheritanceExamples()
|
28 |
+
{
|
29 |
+
return array(
|
30 |
+
array(
|
31 |
+
array(
|
32 |
+
'foo' => '{{$baz}}default content{{/baz}}',
|
33 |
+
),
|
34 |
+
array(
|
35 |
+
'bar' => 'set by user',
|
36 |
+
),
|
37 |
+
'{{< foo }}{{# bar }}{{$ baz }}{{/ baz }}{{/ bar }}{{/ foo }}',
|
38 |
+
),
|
39 |
+
array(
|
40 |
+
array(
|
41 |
+
'foo' => '{{$baz}}default content{{/baz}}',
|
42 |
+
),
|
43 |
+
array(
|
44 |
+
),
|
45 |
+
'{{<foo}}{{^bar}}{{$baz}}set by template{{/baz}}{{/bar}}{{/foo}}',
|
46 |
+
),
|
47 |
+
array(
|
48 |
+
array(
|
49 |
+
'foo' => '{{$baz}}default content{{/baz}}',
|
50 |
+
'qux' => 'I am a partial',
|
51 |
+
),
|
52 |
+
array(
|
53 |
+
),
|
54 |
+
'{{<foo}}{{>qux}}{{$baz}}set by template{{/baz}}{{/foo}}',
|
55 |
+
),
|
56 |
+
array(
|
57 |
+
array(
|
58 |
+
'foo' => '{{$baz}}default content{{/baz}}',
|
59 |
+
),
|
60 |
+
array(),
|
61 |
+
'{{<foo}}{{=<% %>=}}<%={{ }}=%>{{/foo}}',
|
62 |
+
),
|
63 |
+
);
|
64 |
+
}
|
65 |
+
|
66 |
+
public function getLegalInheritanceExamples()
|
67 |
+
{
|
68 |
+
return array(
|
69 |
+
array(
|
70 |
+
array(
|
71 |
+
'foo' => '{{$baz}}default content{{/baz}}',
|
72 |
+
),
|
73 |
+
array(
|
74 |
+
'bar' => 'set by user',
|
75 |
+
),
|
76 |
+
'{{<foo}}{{bar}}{{$baz}}override{{/baz}}{{/foo}}',
|
77 |
+
'override',
|
78 |
+
),
|
79 |
+
array(
|
80 |
+
array(
|
81 |
+
'foo' => '{{$baz}}default content{{/baz}}',
|
82 |
+
),
|
83 |
+
array(
|
84 |
+
),
|
85 |
+
'{{<foo}}{{! ignore me }}{{$baz}}set by template{{/baz}}{{/foo}}',
|
86 |
+
'set by template',
|
87 |
+
),
|
88 |
+
array(
|
89 |
+
array(
|
90 |
+
'foo' => '{{$baz}}defualt content{{/baz}}',
|
91 |
+
),
|
92 |
+
array(),
|
93 |
+
'{{<foo}}set by template{{$baz}}also set by template{{/baz}}{{/foo}}',
|
94 |
+
'also set by template',
|
95 |
+
),
|
96 |
+
array(
|
97 |
+
array(
|
98 |
+
'foo' => '{{$a}}FAIL!{{/a}}',
|
99 |
+
'bar' => 'WIN!!',
|
100 |
+
),
|
101 |
+
array(),
|
102 |
+
'{{<foo}}{{$a}}{{<bar}}FAIL{{/bar}}{{/a}}{{/foo}}',
|
103 |
+
'WIN!!',
|
104 |
+
),
|
105 |
+
);
|
106 |
+
}
|
107 |
+
|
108 |
+
public function testDefaultContent()
|
109 |
+
{
|
110 |
+
$tpl = $this->mustache->loadTemplate('{{$title}}Default title{{/title}}');
|
111 |
+
|
112 |
+
$data = array();
|
113 |
+
|
114 |
+
$this->assertEquals('Default title', $tpl->render($data));
|
115 |
+
}
|
116 |
+
|
117 |
+
public function testDefaultContentRendersVariables()
|
118 |
+
{
|
119 |
+
$tpl = $this->mustache->loadTemplate('{{$foo}}default {{bar}} content{{/foo}}');
|
120 |
+
|
121 |
+
$data = array(
|
122 |
+
'bar' => 'baz',
|
123 |
+
);
|
124 |
+
|
125 |
+
$this->assertEquals('default baz content', $tpl->render($data));
|
126 |
+
}
|
127 |
+
|
128 |
+
public function testDefaultContentRendersTripleMustacheVariables()
|
129 |
+
{
|
130 |
+
$tpl = $this->mustache->loadTemplate('{{$foo}}default {{{bar}}} content{{/foo}}');
|
131 |
+
|
132 |
+
$data = array(
|
133 |
+
'bar' => '<baz>',
|
134 |
+
);
|
135 |
+
|
136 |
+
$this->assertEquals('default <baz> content', $tpl->render($data));
|
137 |
+
}
|
138 |
+
|
139 |
+
public function testDefaultContentRendersSections()
|
140 |
+
{
|
141 |
+
$tpl = $this->mustache->loadTemplate(
|
142 |
+
'{{$foo}}default {{#bar}}{{baz}}{{/bar}} content{{/foo}}'
|
143 |
+
);
|
144 |
+
|
145 |
+
$data = array(
|
146 |
+
'bar' => array('baz' => 'qux'),
|
147 |
+
);
|
148 |
+
|
149 |
+
$this->assertEquals('default qux content', $tpl->render($data));
|
150 |
+
}
|
151 |
+
|
152 |
+
public function testDefaultContentRendersNegativeSections()
|
153 |
+
{
|
154 |
+
$tpl = $this->mustache->loadTemplate(
|
155 |
+
'{{$foo}}default {{^bar}}{{baz}}{{/bar}} content{{/foo}}'
|
156 |
+
);
|
157 |
+
|
158 |
+
$data = array(
|
159 |
+
'foo' => array('bar' => 'qux'),
|
160 |
+
'baz' => 'three',
|
161 |
+
);
|
162 |
+
|
163 |
+
$this->assertEquals('default three content', $tpl->render($data));
|
164 |
+
}
|
165 |
+
|
166 |
+
public function testMustacheInjectionInDefaultContent()
|
167 |
+
{
|
168 |
+
$tpl = $this->mustache->loadTemplate(
|
169 |
+
'{{$foo}}default {{#bar}}{{baz}}{{/bar}} content{{/foo}}'
|
170 |
+
);
|
171 |
+
|
172 |
+
$data = array(
|
173 |
+
'bar' => array('baz' => '{{qux}}'),
|
174 |
+
);
|
175 |
+
|
176 |
+
$this->assertEquals('default {{qux}} content', $tpl->render($data));
|
177 |
+
}
|
178 |
+
|
179 |
+
public function testDefaultContentRenderedInsideIncludedTemplates()
|
180 |
+
{
|
181 |
+
$partials = array(
|
182 |
+
'include' => '{{$foo}}default content{{/foo}}',
|
183 |
+
);
|
184 |
+
|
185 |
+
$this->mustache->setPartials($partials);
|
186 |
+
|
187 |
+
$tpl = $this->mustache->loadTemplate(
|
188 |
+
'{{<include}}{{/include}}'
|
189 |
+
);
|
190 |
+
|
191 |
+
$data = array();
|
192 |
+
|
193 |
+
$this->assertEquals('default content', $tpl->render($data));
|
194 |
+
}
|
195 |
+
|
196 |
+
public function testOverriddenContent()
|
197 |
+
{
|
198 |
+
$partials = array(
|
199 |
+
'super' => '...{{$title}}Default title{{/title}}...',
|
200 |
+
);
|
201 |
+
|
202 |
+
$this->mustache->setPartials($partials);
|
203 |
+
|
204 |
+
$tpl = $this->mustache->loadTemplate(
|
205 |
+
'{{<super}}{{$title}}sub template title{{/title}}{{/super}}'
|
206 |
+
);
|
207 |
+
|
208 |
+
$data = array();
|
209 |
+
|
210 |
+
$this->assertEquals('...sub template title...', $tpl->render($data));
|
211 |
+
}
|
212 |
+
|
213 |
+
public function testOverriddenPartial()
|
214 |
+
{
|
215 |
+
$partials = array(
|
216 |
+
'partial' => '|{{$stuff}}...{{/stuff}}{{$default}} default{{/default}}|',
|
217 |
+
);
|
218 |
+
|
219 |
+
$this->mustache->setPartials($partials);
|
220 |
+
|
221 |
+
$tpl = $this->mustache->loadTemplate(
|
222 |
+
'test {{<partial}}{{$stuff}}override1{{/stuff}}{{/partial}} {{<partial}}{{$stuff}}override2{{/stuff}}{{/partial}}'
|
223 |
+
);
|
224 |
+
|
225 |
+
$data = array();
|
226 |
+
|
227 |
+
$this->assertEquals('test |override1 default| |override2 default|', $tpl->render($data));
|
228 |
+
}
|
229 |
+
|
230 |
+
public function testBlocksDoNotLeakBetweenPartials()
|
231 |
+
{
|
232 |
+
$partials = array(
|
233 |
+
'partial' => '|{{$a}}A{{/a}} {{$b}}B{{/b}}|',
|
234 |
+
);
|
235 |
+
|
236 |
+
$this->mustache->setPartials($partials);
|
237 |
+
|
238 |
+
$tpl = $this->mustache->loadTemplate(
|
239 |
+
'test {{<partial}}{{$a}}C{{/a}}{{/partial}} {{<partial}}{{$b}}D{{/b}}{{/partial}}'
|
240 |
+
);
|
241 |
+
|
242 |
+
$data = array();
|
243 |
+
|
244 |
+
$this->assertEquals('test |C B| |A D|', $tpl->render($data));
|
245 |
+
}
|
246 |
+
|
247 |
+
public function testDataDoesNotOverrideBlock()
|
248 |
+
{
|
249 |
+
$partials = array(
|
250 |
+
'include' => '{{$var}}var in include{{/var}}',
|
251 |
+
);
|
252 |
+
|
253 |
+
$this->mustache->setPartials($partials);
|
254 |
+
|
255 |
+
$tpl = $this->mustache->loadTemplate(
|
256 |
+
'{{<include}}{{$var}}var in template{{/var}}{{/include}}'
|
257 |
+
);
|
258 |
+
|
259 |
+
$data = array(
|
260 |
+
'var' => 'var in data',
|
261 |
+
);
|
262 |
+
|
263 |
+
$this->assertEquals('var in template', $tpl->render($data));
|
264 |
+
}
|
265 |
+
|
266 |
+
public function testDataDoesNotOverrideDefaultBlockValue()
|
267 |
+
{
|
268 |
+
$partials = array(
|
269 |
+
'include' => '{{$var}}var in include{{/var}}',
|
270 |
+
);
|
271 |
+
|
272 |
+
$this->mustache->setPartials($partials);
|
273 |
+
|
274 |
+
$tpl = $this->mustache->loadTemplate(
|
275 |
+
'{{<include}}{{/include}}'
|
276 |
+
);
|
277 |
+
|
278 |
+
$data = array(
|
279 |
+
'var' => 'var in data',
|
280 |
+
);
|
281 |
+
|
282 |
+
$this->assertEquals('var in include', $tpl->render($data));
|
283 |
+
}
|
284 |
+
|
285 |
+
public function testOverridePartialWithNewlines()
|
286 |
+
{
|
287 |
+
$partials = array(
|
288 |
+
'partial' => '{{$ballmer}}peaking{{/ballmer}}',
|
289 |
+
);
|
290 |
+
|
291 |
+
$this->mustache->setPartials($partials);
|
292 |
+
|
293 |
+
$tpl = $this->mustache->loadTemplate(
|
294 |
+
"{{<partial}}{{\$ballmer}}\npeaked\n\n:(\n{{/ballmer}}{{/partial}}"
|
295 |
+
);
|
296 |
+
|
297 |
+
$data = array();
|
298 |
+
|
299 |
+
$this->assertEquals("peaked\n\n:(\n", $tpl->render($data));
|
300 |
+
}
|
301 |
+
|
302 |
+
public function testInheritIndentationWhenOverridingAPartial()
|
303 |
+
{
|
304 |
+
$partials = array(
|
305 |
+
'partial' => 'stop:
|
306 |
+
{{$nineties}}collaborate and listen{{/nineties}}',
|
307 |
+
);
|
308 |
+
|
309 |
+
$this->mustache->setPartials($partials);
|
310 |
+
|
311 |
+
$tpl = $this->mustache->loadTemplate(
|
312 |
+
'{{<partial}}{{$nineties}}hammer time{{/nineties}}{{/partial}}'
|
313 |
+
);
|
314 |
+
|
315 |
+
$data = array();
|
316 |
+
|
317 |
+
$this->assertEquals(
|
318 |
+
'stop:
|
319 |
+
hammer time',
|
320 |
+
$tpl->render($data)
|
321 |
+
);
|
322 |
+
}
|
323 |
+
|
324 |
+
public function testInheritSpacingWhenOverridingAPartial()
|
325 |
+
{
|
326 |
+
$partials = array(
|
327 |
+
'parent' => 'collaborate_and{{$id}}{{/id}}',
|
328 |
+
'child' => '{{<parent}}{{$id}}_listen{{/id}}{{/parent}}',
|
329 |
+
);
|
330 |
+
|
331 |
+
$this->mustache->setPartials($partials);
|
332 |
+
|
333 |
+
$tpl = $this->mustache->loadTemplate(
|
334 |
+
'stop:
|
335 |
+
{{>child}}'
|
336 |
+
);
|
337 |
+
|
338 |
+
$data = array();
|
339 |
+
|
340 |
+
$this->assertEquals(
|
341 |
+
'stop:
|
342 |
+
collaborate_and_listen',
|
343 |
+
$tpl->render($data)
|
344 |
+
);
|
345 |
+
}
|
346 |
+
|
347 |
+
public function testOverrideOneSubstitutionButNotTheOther()
|
348 |
+
{
|
349 |
+
$partials = array(
|
350 |
+
'partial' => '{{$stuff}}default one{{/stuff}}, {{$stuff2}}default two{{/stuff2}}',
|
351 |
+
);
|
352 |
+
|
353 |
+
$this->mustache->setPartials($partials);
|
354 |
+
|
355 |
+
$tpl = $this->mustache->loadTemplate(
|
356 |
+
'{{<partial}}{{$stuff2}}override two{{/stuff2}}{{/partial}}'
|
357 |
+
);
|
358 |
+
|
359 |
+
$data = array();
|
360 |
+
|
361 |
+
$this->assertEquals('default one, override two', $tpl->render($data));
|
362 |
+
}
|
363 |
+
|
364 |
+
public function testSuperTemplatesWithNoParameters()
|
365 |
+
{
|
366 |
+
$partials = array(
|
367 |
+
'include' => '{{$foo}}default content{{/foo}}',
|
368 |
+
);
|
369 |
+
|
370 |
+
$this->mustache->setPartials($partials);
|
371 |
+
|
372 |
+
$tpl = $this->mustache->loadTemplate(
|
373 |
+
'{{>include}}|{{<include}}{{/include}}'
|
374 |
+
);
|
375 |
+
|
376 |
+
$data = array();
|
377 |
+
|
378 |
+
$this->assertEquals('default content|default content', $tpl->render($data));
|
379 |
+
}
|
380 |
+
|
381 |
+
public function testRecursionInInheritedTemplates()
|
382 |
+
{
|
383 |
+
$partials = array(
|
384 |
+
'include' => '{{$foo}}default content{{/foo}} {{$bar}}{{<include2}}{{/include2}}{{/bar}}',
|
385 |
+
'include2' => '{{$foo}}include2 default content{{/foo}} {{<include}}{{$bar}}don\'t recurse{{/bar}}{{/include}}',
|
386 |
+
);
|
387 |
+
|
388 |
+
$this->mustache->setPartials($partials);
|
389 |
+
|
390 |
+
$tpl = $this->mustache->loadTemplate(
|
391 |
+
'{{<include}}{{$foo}}override{{/foo}}{{/include}}'
|
392 |
+
);
|
393 |
+
|
394 |
+
$data = array();
|
395 |
+
|
396 |
+
$this->assertEquals('override override override don\'t recurse', $tpl->render($data));
|
397 |
+
}
|
398 |
+
|
399 |
+
public function testTopLevelSubstitutionsTakePrecedenceInMultilevelInheritance()
|
400 |
+
{
|
401 |
+
$partials = array(
|
402 |
+
'parent' => '{{<older}}{{$a}}p{{/a}}{{/older}}',
|
403 |
+
'older' => '{{<grandParent}}{{$a}}o{{/a}}{{/grandParent}}',
|
404 |
+
'grandParent' => '{{$a}}g{{/a}}',
|
405 |
+
);
|
406 |
+
|
407 |
+
$this->mustache->setPartials($partials);
|
408 |
+
|
409 |
+
$tpl = $this->mustache->loadTemplate(
|
410 |
+
'{{<parent}}{{$a}}c{{/a}}{{/parent}}'
|
411 |
+
);
|
412 |
+
|
413 |
+
$data = array();
|
414 |
+
|
415 |
+
$this->assertEquals('c', $tpl->render($data));
|
416 |
+
}
|
417 |
+
|
418 |
+
public function testMultiLevelInheritanceNoSubChild()
|
419 |
+
{
|
420 |
+
$partials = array(
|
421 |
+
'parent' => '{{<older}}{{$a}}p{{/a}}{{/older}}',
|
422 |
+
'older' => '{{<grandParent}}{{$a}}o{{/a}}{{/grandParent}}',
|
423 |
+
'grandParent' => '{{$a}}g{{/a}}',
|
424 |
+
);
|
425 |
+
|
426 |
+
$this->mustache->setPartials($partials);
|
427 |
+
|
428 |
+
$tpl = $this->mustache->loadTemplate(
|
429 |
+
'{{<parent}}{{/parent}}'
|
430 |
+
);
|
431 |
+
|
432 |
+
$data = array();
|
433 |
+
|
434 |
+
$this->assertEquals('p', $tpl->render($data));
|
435 |
+
}
|
436 |
+
|
437 |
+
public function testIgnoreTextInsideSuperTemplatesButParseArgs()
|
438 |
+
{
|
439 |
+
$partials = array(
|
440 |
+
'include' => '{{$foo}}default content{{/foo}}',
|
441 |
+
);
|
442 |
+
|
443 |
+
$this->mustache->setPartials($partials);
|
444 |
+
|
445 |
+
$tpl = $this->mustache->loadTemplate(
|
446 |
+
'{{<include}} asdfasd {{$foo}}hmm{{/foo}} asdfasdfasdf {{/include}}'
|
447 |
+
);
|
448 |
+
|
449 |
+
$data = array();
|
450 |
+
|
451 |
+
$this->assertEquals('hmm', $tpl->render($data));
|
452 |
+
}
|
453 |
+
|
454 |
+
public function testIgnoreTextInsideSuperTemplates()
|
455 |
+
{
|
456 |
+
$partials = array(
|
457 |
+
'include' => '{{$foo}}default content{{/foo}}',
|
458 |
+
);
|
459 |
+
|
460 |
+
$this->mustache->setPartials($partials);
|
461 |
+
|
462 |
+
$tpl = $this->mustache->loadTemplate(
|
463 |
+
'{{<include}} asdfasd asdfasdfasdf {{/include}}'
|
464 |
+
);
|
465 |
+
|
466 |
+
$data = array();
|
467 |
+
|
468 |
+
$this->assertEquals('default content', $tpl->render($data));
|
469 |
+
}
|
470 |
+
|
471 |
+
public function testInheritanceWithLazyEvaluation()
|
472 |
+
{
|
473 |
+
$partials = array(
|
474 |
+
'parent' => '{{#items}}{{$value}}ignored{{/value}}{{/items}}',
|
475 |
+
);
|
476 |
+
|
477 |
+
$this->mustache->setPartials($partials);
|
478 |
+
|
479 |
+
$tpl = $this->mustache->loadTemplate(
|
480 |
+
'{{<parent}}{{$value}}<{{ . }}>{{/value}}{{/parent}}'
|
481 |
+
);
|
482 |
+
|
483 |
+
$data = array('items' => array(1, 2, 3));
|
484 |
+
|
485 |
+
$this->assertEquals('<1><2><3>', $tpl->render($data));
|
486 |
+
}
|
487 |
+
|
488 |
+
public function testInheritanceWithLazyEvaluationWhitespaceIgnored()
|
489 |
+
{
|
490 |
+
$partials = array(
|
491 |
+
'parent' => '{{#items}}{{$value}}\n\nignored\n\n{{/value}}{{/items}}',
|
492 |
+
);
|
493 |
+
|
494 |
+
$this->mustache->setPartials($partials);
|
495 |
+
|
496 |
+
$tpl = $this->mustache->loadTemplate(
|
497 |
+
'{{<parent}}\n\n\n{{$value}}<{{ . }}>{{/value}}\n\n{{/parent}}'
|
498 |
+
);
|
499 |
+
|
500 |
+
$data = array('items' => array(1, 2, 3));
|
501 |
+
|
502 |
+
$this->assertEquals('<1><2><3>', $tpl->render($data));
|
503 |
+
}
|
504 |
+
|
505 |
+
public function testInheritanceWithLazyEvaluationAndSections()
|
506 |
+
{
|
507 |
+
$partials = array(
|
508 |
+
'parent' => '{{#items}}{{$value}}\n\nignored {{.}} {{#more}} there is more {{/more}}\n\n{{/value}}{{/items}}',
|
509 |
+
);
|
510 |
+
|
511 |
+
$this->mustache->setPartials($partials);
|
512 |
+
|
513 |
+
$tpl = $this->mustache->loadTemplate(
|
514 |
+
'{{<parent}}\n\n\n{{$value}}<{{ . }}>{{#more}} there is less {{/more}}{{/value}}\n\n{{/parent}}'
|
515 |
+
);
|
516 |
+
|
517 |
+
$data = array('items' => array(1, 2, 3), 'more' => 'stuff');
|
518 |
+
|
519 |
+
$this->assertEquals('<1> there is less <2> there is less <3> there is less ', $tpl->render($data));
|
520 |
+
}
|
521 |
+
|
522 |
+
/**
|
523 |
+
* @dataProvider getIllegalInheritanceExamples
|
524 |
+
* @expectedException Mustache_Exception_SyntaxException
|
525 |
+
* @expectedExceptionMessage Illegal content in < parent tag
|
526 |
+
*/
|
527 |
+
public function testIllegalInheritanceExamples($partials, $data, $template)
|
528 |
+
{
|
529 |
+
$this->mustache->setPartials($partials);
|
530 |
+
$tpl = $this->mustache->loadTemplate($template);
|
531 |
+
$tpl->render($data);
|
532 |
+
}
|
533 |
+
|
534 |
+
/**
|
535 |
+
* @dataProvider getLegalInheritanceExamples
|
536 |
+
*/
|
537 |
+
public function testLegalInheritanceExamples($partials, $data, $template, $expect)
|
538 |
+
{
|
539 |
+
$this->mustache->setPartials($partials);
|
540 |
+
$tpl = $this->mustache->loadTemplate($template);
|
541 |
+
$this->assertSame($expect, $tpl->render($data));
|
542 |
+
}
|
543 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Functional/MustacheInjectionTest.php
ADDED
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group mustache_injection
|
14 |
+
* @group functional
|
15 |
+
*/
|
16 |
+
class Mustache_Test_Functional_MustacheInjectionTest extends PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
private $mustache;
|
19 |
+
|
20 |
+
public function setUp()
|
21 |
+
{
|
22 |
+
$this->mustache = new Mustache_Engine();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @dataProvider injectionData
|
27 |
+
*/
|
28 |
+
public function testInjection($tpl, $data, $partials, $expect)
|
29 |
+
{
|
30 |
+
$this->mustache->setPartials($partials);
|
31 |
+
$this->assertEquals($expect, $this->mustache->render($tpl, $data));
|
32 |
+
}
|
33 |
+
|
34 |
+
public function injectionData()
|
35 |
+
{
|
36 |
+
$interpolationData = array(
|
37 |
+
'a' => '{{ b }}',
|
38 |
+
'b' => 'FAIL',
|
39 |
+
);
|
40 |
+
|
41 |
+
$sectionData = array(
|
42 |
+
'a' => true,
|
43 |
+
'b' => '{{ c }}',
|
44 |
+
'c' => 'FAIL',
|
45 |
+
);
|
46 |
+
|
47 |
+
$lambdaInterpolationData = array(
|
48 |
+
'a' => array($this, 'lambdaInterpolationCallback'),
|
49 |
+
'b' => '{{ c }}',
|
50 |
+
'c' => 'FAIL',
|
51 |
+
);
|
52 |
+
|
53 |
+
$lambdaSectionData = array(
|
54 |
+
'a' => array($this, 'lambdaSectionCallback'),
|
55 |
+
'b' => '{{ c }}',
|
56 |
+
'c' => 'FAIL',
|
57 |
+
);
|
58 |
+
|
59 |
+
return array(
|
60 |
+
array('{{ a }}', $interpolationData, array(), '{{ b }}'),
|
61 |
+
array('{{{ a }}}', $interpolationData, array(), '{{ b }}'),
|
62 |
+
|
63 |
+
array('{{# a }}{{ b }}{{/ a }}', $sectionData, array(), '{{ c }}'),
|
64 |
+
array('{{# a }}{{{ b }}}{{/ a }}', $sectionData, array(), '{{ c }}'),
|
65 |
+
|
66 |
+
array('{{> partial }}', $interpolationData, array('partial' => '{{ a }}'), '{{ b }}'),
|
67 |
+
array('{{> partial }}', $interpolationData, array('partial' => '{{{ a }}}'), '{{ b }}'),
|
68 |
+
|
69 |
+
array('{{ a }}', $lambdaInterpolationData, array(), '{{ c }}'),
|
70 |
+
array('{{# a }}b{{/ a }}', $lambdaSectionData, array(), '{{ c }}'),
|
71 |
+
);
|
72 |
+
}
|
73 |
+
|
74 |
+
public static function lambdaInterpolationCallback()
|
75 |
+
{
|
76 |
+
return '{{ b }}';
|
77 |
+
}
|
78 |
+
|
79 |
+
public static function lambdaSectionCallback($text)
|
80 |
+
{
|
81 |
+
return '{{ ' . $text . ' }}';
|
82 |
+
}
|
83 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Functional/MustacheSpecTest.php
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* A PHPUnit test case wrapping the Mustache Spec.
|
14 |
+
*
|
15 |
+
* @group mustache-spec
|
16 |
+
* @group functional
|
17 |
+
*/
|
18 |
+
class Mustache_Test_Functional_MustacheSpecTest extends Mustache_Test_SpecTestCase
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* For some reason data providers can't mark tests skipped, so this test exists
|
22 |
+
* simply to provide a 'skipped' test if the `spec` submodule isn't initialized.
|
23 |
+
*/
|
24 |
+
public function testSpecInitialized()
|
25 |
+
{
|
26 |
+
if (!file_exists(dirname(__FILE__) . '/../../../../vendor/spec/specs/')) {
|
27 |
+
$this->markTestSkipped('Mustache spec submodule not initialized: run "git submodule update --init"');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @group comments
|
33 |
+
* @dataProvider loadCommentSpec
|
34 |
+
*/
|
35 |
+
public function testCommentSpec($desc, $source, $partials, $data, $expected)
|
36 |
+
{
|
37 |
+
$template = self::loadTemplate($source, $partials);
|
38 |
+
$this->assertEquals($expected, $template->render($data), $desc);
|
39 |
+
}
|
40 |
+
|
41 |
+
public function loadCommentSpec()
|
42 |
+
{
|
43 |
+
return $this->loadSpec('comments');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @group delimiters
|
48 |
+
* @dataProvider loadDelimitersSpec
|
49 |
+
*/
|
50 |
+
public function testDelimitersSpec($desc, $source, $partials, $data, $expected)
|
51 |
+
{
|
52 |
+
$template = self::loadTemplate($source, $partials);
|
53 |
+
$this->assertEquals($expected, $template->render($data), $desc);
|
54 |
+
}
|
55 |
+
|
56 |
+
public function loadDelimitersSpec()
|
57 |
+
{
|
58 |
+
return $this->loadSpec('delimiters');
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* @group interpolation
|
63 |
+
* @dataProvider loadInterpolationSpec
|
64 |
+
*/
|
65 |
+
public function testInterpolationSpec($desc, $source, $partials, $data, $expected)
|
66 |
+
{
|
67 |
+
$template = self::loadTemplate($source, $partials);
|
68 |
+
$this->assertEquals($expected, $template->render($data), $desc);
|
69 |
+
}
|
70 |
+
|
71 |
+
public function loadInterpolationSpec()
|
72 |
+
{
|
73 |
+
return $this->loadSpec('interpolation');
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* @group inverted
|
78 |
+
* @group inverted-sections
|
79 |
+
* @dataProvider loadInvertedSpec
|
80 |
+
*/
|
81 |
+
public function testInvertedSpec($desc, $source, $partials, $data, $expected)
|
82 |
+
{
|
83 |
+
$template = self::loadTemplate($source, $partials);
|
84 |
+
$this->assertEquals($expected, $template->render($data), $desc);
|
85 |
+
}
|
86 |
+
|
87 |
+
public function loadInvertedSpec()
|
88 |
+
{
|
89 |
+
return $this->loadSpec('inverted');
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* @group partials
|
94 |
+
* @dataProvider loadPartialsSpec
|
95 |
+
*/
|
96 |
+
public function testPartialsSpec($desc, $source, $partials, $data, $expected)
|
97 |
+
{
|
98 |
+
$template = self::loadTemplate($source, $partials);
|
99 |
+
$this->assertEquals($expected, $template->render($data), $desc);
|
100 |
+
}
|
101 |
+
|
102 |
+
public function loadPartialsSpec()
|
103 |
+
{
|
104 |
+
return $this->loadSpec('partials');
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* @group sections
|
109 |
+
* @dataProvider loadSectionsSpec
|
110 |
+
*/
|
111 |
+
public function testSectionsSpec($desc, $source, $partials, $data, $expected)
|
112 |
+
{
|
113 |
+
$template = self::loadTemplate($source, $partials);
|
114 |
+
$this->assertEquals($expected, $template->render($data), $desc);
|
115 |
+
}
|
116 |
+
|
117 |
+
public function loadSectionsSpec()
|
118 |
+
{
|
119 |
+
return $this->loadSpec('sections');
|
120 |
+
}
|
121 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Functional/NestedPartialIndentTest.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group functional
|
14 |
+
* @group partials
|
15 |
+
*/
|
16 |
+
class Mustache_Test_Functional_NestedPartialIndentTest extends PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* @dataProvider partialsAndStuff
|
20 |
+
*/
|
21 |
+
public function testNestedPartialsAreIndentedProperly($src, array $partials, $expected)
|
22 |
+
{
|
23 |
+
$m = new Mustache_Engine(array(
|
24 |
+
'partials' => $partials,
|
25 |
+
));
|
26 |
+
$tpl = $m->loadTemplate($src);
|
27 |
+
$this->assertEquals($expected, $tpl->render());
|
28 |
+
}
|
29 |
+
|
30 |
+
public function partialsAndStuff()
|
31 |
+
{
|
32 |
+
$partials = array(
|
33 |
+
'a' => ' {{> b }}',
|
34 |
+
'b' => ' {{> d }}',
|
35 |
+
'c' => ' {{> d }}{{> d }}',
|
36 |
+
'd' => 'D!',
|
37 |
+
);
|
38 |
+
|
39 |
+
return array(
|
40 |
+
array(' {{> a }}', $partials, ' D!'),
|
41 |
+
array(' {{> b }}', $partials, ' D!'),
|
42 |
+
array(' {{> c }}', $partials, ' D!D!'),
|
43 |
+
);
|
44 |
+
}
|
45 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Functional/ObjectSectionTest.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group sections
|
14 |
+
* @group functional
|
15 |
+
*/
|
16 |
+
class Mustache_Test_Functional_ObjectSectionTest extends PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
private $mustache;
|
19 |
+
|
20 |
+
public function setUp()
|
21 |
+
{
|
22 |
+
$this->mustache = new Mustache_Engine();
|
23 |
+
}
|
24 |
+
|
25 |
+
public function testBasicObject()
|
26 |
+
{
|
27 |
+
$tpl = $this->mustache->loadTemplate('{{#foo}}{{name}}{{/foo}}');
|
28 |
+
$this->assertEquals('Foo', $tpl->render(new Mustache_Test_Functional_Alpha()));
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @group magic_methods
|
33 |
+
*/
|
34 |
+
public function testObjectWithGet()
|
35 |
+
{
|
36 |
+
$tpl = $this->mustache->loadTemplate('{{#foo}}{{name}}{{/foo}}');
|
37 |
+
$this->assertEquals('Foo', $tpl->render(new Mustache_Test_Functional_Beta()));
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @group magic_methods
|
42 |
+
*/
|
43 |
+
public function testSectionObjectWithGet()
|
44 |
+
{
|
45 |
+
$tpl = $this->mustache->loadTemplate('{{#bar}}{{#foo}}{{name}}{{/foo}}{{/bar}}');
|
46 |
+
$this->assertEquals('Foo', $tpl->render(new Mustache_Test_Functional_Gamma()));
|
47 |
+
}
|
48 |
+
|
49 |
+
public function testSectionObjectWithFunction()
|
50 |
+
{
|
51 |
+
$tpl = $this->mustache->loadTemplate('{{#foo}}{{name}}{{/foo}}');
|
52 |
+
$alpha = new Mustache_Test_Functional_Alpha();
|
53 |
+
$alpha->foo = new Mustache_Test_Functional_Delta();
|
54 |
+
$this->assertEquals('Foo', $tpl->render($alpha));
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
class Mustache_Test_Functional_Alpha
|
59 |
+
{
|
60 |
+
public $foo;
|
61 |
+
|
62 |
+
public function __construct()
|
63 |
+
{
|
64 |
+
$this->foo = new StdClass();
|
65 |
+
$this->foo->name = 'Foo';
|
66 |
+
$this->foo->number = 1;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
class Mustache_Test_Functional_Beta
|
71 |
+
{
|
72 |
+
protected $_data = array();
|
73 |
+
|
74 |
+
public function __construct()
|
75 |
+
{
|
76 |
+
$this->_data['foo'] = new StdClass();
|
77 |
+
$this->_data['foo']->name = 'Foo';
|
78 |
+
$this->_data['foo']->number = 1;
|
79 |
+
}
|
80 |
+
|
81 |
+
public function __isset($name)
|
82 |
+
{
|
83 |
+
return array_key_exists($name, $this->_data);
|
84 |
+
}
|
85 |
+
|
86 |
+
public function __get($name)
|
87 |
+
{
|
88 |
+
return $this->_data[$name];
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
class Mustache_Test_Functional_Gamma
|
93 |
+
{
|
94 |
+
public $bar;
|
95 |
+
|
96 |
+
public function __construct()
|
97 |
+
{
|
98 |
+
$this->bar = new Mustache_Test_Functional_Beta();
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
class Mustache_Test_Functional_Delta
|
103 |
+
{
|
104 |
+
protected $_name = 'Foo';
|
105 |
+
|
106 |
+
public function name()
|
107 |
+
{
|
108 |
+
return $this->_name;
|
109 |
+
}
|
110 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/FunctionalTestCase.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
abstract class Mustache_Test_FunctionalTestCase extends PHPUnit_Framework_TestCase
|
13 |
+
{
|
14 |
+
protected static $tempDir;
|
15 |
+
|
16 |
+
public static function setUpBeforeClass()
|
17 |
+
{
|
18 |
+
self::$tempDir = sys_get_temp_dir() . '/mustache_test';
|
19 |
+
if (file_exists(self::$tempDir)) {
|
20 |
+
self::rmdir(self::$tempDir);
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @param string $path
|
26 |
+
*/
|
27 |
+
protected static function rmdir($path)
|
28 |
+
{
|
29 |
+
$path = rtrim($path, '/') . '/';
|
30 |
+
$handle = opendir($path);
|
31 |
+
while (($file = readdir($handle)) !== false) {
|
32 |
+
if ($file === '.' || $file === '..') {
|
33 |
+
continue;
|
34 |
+
}
|
35 |
+
|
36 |
+
$fullpath = $path . $file;
|
37 |
+
if (is_dir($fullpath)) {
|
38 |
+
self::rmdir($fullpath);
|
39 |
+
} else {
|
40 |
+
unlink($fullpath);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
closedir($handle);
|
45 |
+
rmdir($path);
|
46 |
+
}
|
47 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/HelperCollectionTest.php
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Mustache_Test_HelperCollectionTest extends PHPUnit_Framework_TestCase
|
13 |
+
{
|
14 |
+
public function testConstructor()
|
15 |
+
{
|
16 |
+
$foo = array($this, 'getFoo');
|
17 |
+
$bar = 'BAR';
|
18 |
+
|
19 |
+
$helpers = new Mustache_HelperCollection(array(
|
20 |
+
'foo' => $foo,
|
21 |
+
'bar' => $bar,
|
22 |
+
));
|
23 |
+
|
24 |
+
$this->assertSame($foo, $helpers->get('foo'));
|
25 |
+
$this->assertSame($bar, $helpers->get('bar'));
|
26 |
+
}
|
27 |
+
|
28 |
+
public static function getFoo()
|
29 |
+
{
|
30 |
+
echo 'foo';
|
31 |
+
}
|
32 |
+
|
33 |
+
public function testAccessorsAndMutators()
|
34 |
+
{
|
35 |
+
$foo = array($this, 'getFoo');
|
36 |
+
$bar = 'BAR';
|
37 |
+
|
38 |
+
$helpers = new Mustache_HelperCollection();
|
39 |
+
$this->assertTrue($helpers->isEmpty());
|
40 |
+
$this->assertFalse($helpers->has('foo'));
|
41 |
+
$this->assertFalse($helpers->has('bar'));
|
42 |
+
|
43 |
+
$helpers->add('foo', $foo);
|
44 |
+
$this->assertFalse($helpers->isEmpty());
|
45 |
+
$this->assertTrue($helpers->has('foo'));
|
46 |
+
$this->assertFalse($helpers->has('bar'));
|
47 |
+
|
48 |
+
$helpers->add('bar', $bar);
|
49 |
+
$this->assertFalse($helpers->isEmpty());
|
50 |
+
$this->assertTrue($helpers->has('foo'));
|
51 |
+
$this->assertTrue($helpers->has('bar'));
|
52 |
+
|
53 |
+
$helpers->remove('foo');
|
54 |
+
$this->assertFalse($helpers->isEmpty());
|
55 |
+
$this->assertFalse($helpers->has('foo'));
|
56 |
+
$this->assertTrue($helpers->has('bar'));
|
57 |
+
}
|
58 |
+
|
59 |
+
public function testMagicMethods()
|
60 |
+
{
|
61 |
+
$foo = array($this, 'getFoo');
|
62 |
+
$bar = 'BAR';
|
63 |
+
|
64 |
+
$helpers = new Mustache_HelperCollection();
|
65 |
+
$this->assertTrue($helpers->isEmpty());
|
66 |
+
$this->assertFalse($helpers->has('foo'));
|
67 |
+
$this->assertFalse($helpers->has('bar'));
|
68 |
+
$this->assertFalse(isset($helpers->foo));
|
69 |
+
$this->assertFalse(isset($helpers->bar));
|
70 |
+
|
71 |
+
$helpers->foo = $foo;
|
72 |
+
$this->assertFalse($helpers->isEmpty());
|
73 |
+
$this->assertTrue($helpers->has('foo'));
|
74 |
+
$this->assertFalse($helpers->has('bar'));
|
75 |
+
$this->assertTrue(isset($helpers->foo));
|
76 |
+
$this->assertFalse(isset($helpers->bar));
|
77 |
+
|
78 |
+
$helpers->bar = $bar;
|
79 |
+
$this->assertFalse($helpers->isEmpty());
|
80 |
+
$this->assertTrue($helpers->has('foo'));
|
81 |
+
$this->assertTrue($helpers->has('bar'));
|
82 |
+
$this->assertTrue(isset($helpers->foo));
|
83 |
+
$this->assertTrue(isset($helpers->bar));
|
84 |
+
|
85 |
+
unset($helpers->foo);
|
86 |
+
$this->assertFalse($helpers->isEmpty());
|
87 |
+
$this->assertFalse($helpers->has('foo'));
|
88 |
+
$this->assertTrue($helpers->has('bar'));
|
89 |
+
$this->assertFalse(isset($helpers->foo));
|
90 |
+
$this->assertTrue(isset($helpers->bar));
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* @dataProvider getInvalidHelperArguments
|
95 |
+
*/
|
96 |
+
public function testHelperCollectionIsntAfraidToThrowExceptions($helpers = array(), $actions = array(), $exception = null)
|
97 |
+
{
|
98 |
+
if ($exception) {
|
99 |
+
$this->setExpectedException($exception);
|
100 |
+
}
|
101 |
+
|
102 |
+
$helpers = new Mustache_HelperCollection($helpers);
|
103 |
+
|
104 |
+
foreach ($actions as $method => $args) {
|
105 |
+
call_user_func_array(array($helpers, $method), $args);
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
public function getInvalidHelperArguments()
|
110 |
+
{
|
111 |
+
return array(
|
112 |
+
array(
|
113 |
+
'not helpers',
|
114 |
+
array(),
|
115 |
+
'InvalidArgumentException',
|
116 |
+
),
|
117 |
+
array(
|
118 |
+
array(),
|
119 |
+
array('get' => array('foo')),
|
120 |
+
'InvalidArgumentException',
|
121 |
+
),
|
122 |
+
array(
|
123 |
+
array('foo' => 'FOO'),
|
124 |
+
array('get' => array('foo')),
|
125 |
+
null,
|
126 |
+
),
|
127 |
+
array(
|
128 |
+
array('foo' => 'FOO'),
|
129 |
+
array('get' => array('bar')),
|
130 |
+
'InvalidArgumentException',
|
131 |
+
),
|
132 |
+
array(
|
133 |
+
array('foo' => 'FOO'),
|
134 |
+
array(
|
135 |
+
'add' => array('bar', 'BAR'),
|
136 |
+
'get' => array('bar'),
|
137 |
+
),
|
138 |
+
null,
|
139 |
+
),
|
140 |
+
array(
|
141 |
+
array('foo' => 'FOO'),
|
142 |
+
array(
|
143 |
+
'get' => array('foo'),
|
144 |
+
'remove' => array('foo'),
|
145 |
+
),
|
146 |
+
null,
|
147 |
+
),
|
148 |
+
array(
|
149 |
+
array('foo' => 'FOO'),
|
150 |
+
array(
|
151 |
+
'remove' => array('foo'),
|
152 |
+
'get' => array('foo'),
|
153 |
+
),
|
154 |
+
'InvalidArgumentException',
|
155 |
+
),
|
156 |
+
array(
|
157 |
+
array(),
|
158 |
+
array('remove' => array('foo')),
|
159 |
+
'InvalidArgumentException',
|
160 |
+
),
|
161 |
+
);
|
162 |
+
}
|
163 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Loader/ArrayLoaderTest.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_Loader_ArrayLoaderTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
public function testConstructor()
|
18 |
+
{
|
19 |
+
$loader = new Mustache_Loader_ArrayLoader(array(
|
20 |
+
'foo' => 'bar',
|
21 |
+
));
|
22 |
+
|
23 |
+
$this->assertEquals('bar', $loader->load('foo'));
|
24 |
+
}
|
25 |
+
|
26 |
+
public function testSetAndLoadTemplates()
|
27 |
+
{
|
28 |
+
$loader = new Mustache_Loader_ArrayLoader(array(
|
29 |
+
'foo' => 'bar',
|
30 |
+
));
|
31 |
+
$this->assertEquals('bar', $loader->load('foo'));
|
32 |
+
|
33 |
+
$loader->setTemplate('baz', 'qux');
|
34 |
+
$this->assertEquals('qux', $loader->load('baz'));
|
35 |
+
|
36 |
+
$loader->setTemplates(array(
|
37 |
+
'foo' => 'FOO',
|
38 |
+
'baz' => 'BAZ',
|
39 |
+
));
|
40 |
+
$this->assertEquals('FOO', $loader->load('foo'));
|
41 |
+
$this->assertEquals('BAZ', $loader->load('baz'));
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @expectedException Mustache_Exception_UnknownTemplateException
|
46 |
+
*/
|
47 |
+
public function testMissingTemplatesThrowExceptions()
|
48 |
+
{
|
49 |
+
$loader = new Mustache_Loader_ArrayLoader();
|
50 |
+
$loader->load('not_a_real_template');
|
51 |
+
}
|
52 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Loader/CascadingLoaderTest.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_Loader_CascadingLoaderTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
public function testLoadTemplates()
|
18 |
+
{
|
19 |
+
$loader = new Mustache_Loader_CascadingLoader(array(
|
20 |
+
new Mustache_Loader_ArrayLoader(array('foo' => '{{ foo }}')),
|
21 |
+
new Mustache_Loader_ArrayLoader(array('bar' => '{{#bar}}BAR{{/bar}}')),
|
22 |
+
));
|
23 |
+
|
24 |
+
$this->assertEquals('{{ foo }}', $loader->load('foo'));
|
25 |
+
$this->assertEquals('{{#bar}}BAR{{/bar}}', $loader->load('bar'));
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @expectedException Mustache_Exception_UnknownTemplateException
|
30 |
+
*/
|
31 |
+
public function testMissingTemplatesThrowExceptions()
|
32 |
+
{
|
33 |
+
$loader = new Mustache_Loader_CascadingLoader(array(
|
34 |
+
new Mustache_Loader_ArrayLoader(array('foo' => '{{ foo }}')),
|
35 |
+
new Mustache_Loader_ArrayLoader(array('bar' => '{{#bar}}BAR{{/bar}}')),
|
36 |
+
));
|
37 |
+
|
38 |
+
$loader->load('not_a_real_template');
|
39 |
+
}
|
40 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Loader/FilesystemLoaderTest.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_Loader_FilesystemLoaderTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
public function testConstructor()
|
18 |
+
{
|
19 |
+
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
20 |
+
$loader = new Mustache_Loader_FilesystemLoader($baseDir, array('extension' => '.ms'));
|
21 |
+
$this->assertEquals('alpha contents', $loader->load('alpha'));
|
22 |
+
$this->assertEquals('beta contents', $loader->load('beta.ms'));
|
23 |
+
}
|
24 |
+
|
25 |
+
public function testTrailingSlashes()
|
26 |
+
{
|
27 |
+
$baseDir = dirname(__FILE__) . '/../../../fixtures/templates/';
|
28 |
+
$loader = new Mustache_Loader_FilesystemLoader($baseDir);
|
29 |
+
$this->assertEquals('one contents', $loader->load('one'));
|
30 |
+
}
|
31 |
+
|
32 |
+
public function testConstructorWithProtocol()
|
33 |
+
{
|
34 |
+
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
35 |
+
|
36 |
+
$loader = new Mustache_Loader_FilesystemLoader('test://' . $baseDir, array('extension' => '.ms'));
|
37 |
+
$this->assertEquals('alpha contents', $loader->load('alpha'));
|
38 |
+
$this->assertEquals('beta contents', $loader->load('beta.ms'));
|
39 |
+
}
|
40 |
+
|
41 |
+
public function testLoadTemplates()
|
42 |
+
{
|
43 |
+
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
44 |
+
$loader = new Mustache_Loader_FilesystemLoader($baseDir);
|
45 |
+
$this->assertEquals('one contents', $loader->load('one'));
|
46 |
+
$this->assertEquals('two contents', $loader->load('two.mustache'));
|
47 |
+
}
|
48 |
+
|
49 |
+
public function testEmptyExtensionString()
|
50 |
+
{
|
51 |
+
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
52 |
+
|
53 |
+
$loader = new Mustache_Loader_FilesystemLoader($baseDir, array('extension' => ''));
|
54 |
+
$this->assertEquals('one contents', $loader->load('one.mustache'));
|
55 |
+
$this->assertEquals('alpha contents', $loader->load('alpha.ms'));
|
56 |
+
|
57 |
+
$loader = new Mustache_Loader_FilesystemLoader($baseDir, array('extension' => null));
|
58 |
+
$this->assertEquals('two contents', $loader->load('two.mustache'));
|
59 |
+
$this->assertEquals('beta contents', $loader->load('beta.ms'));
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @expectedException Mustache_Exception_RuntimeException
|
64 |
+
*/
|
65 |
+
public function testMissingBaseDirThrowsException()
|
66 |
+
{
|
67 |
+
new Mustache_Loader_FilesystemLoader(dirname(__FILE__) . '/not_a_directory');
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @expectedException Mustache_Exception_UnknownTemplateException
|
72 |
+
*/
|
73 |
+
public function testMissingTemplateThrowsException()
|
74 |
+
{
|
75 |
+
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
76 |
+
$loader = new Mustache_Loader_FilesystemLoader($baseDir);
|
77 |
+
|
78 |
+
$loader->load('fake');
|
79 |
+
}
|
80 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Loader/InlineLoaderTest.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_Loader_InlineLoaderTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
public function testLoadTemplates()
|
18 |
+
{
|
19 |
+
$loader = new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__);
|
20 |
+
$this->assertEquals('{{ foo }}', $loader->load('foo'));
|
21 |
+
$this->assertEquals('{{#bar}}BAR{{/bar}}', $loader->load('bar'));
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @expectedException Mustache_Exception_UnknownTemplateException
|
26 |
+
*/
|
27 |
+
public function testMissingTemplatesThrowExceptions()
|
28 |
+
{
|
29 |
+
$loader = new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__);
|
30 |
+
$loader->load('not_a_real_template');
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @expectedException Mustache_Exception_InvalidArgumentException
|
35 |
+
*/
|
36 |
+
public function testInvalidOffsetThrowsException()
|
37 |
+
{
|
38 |
+
new Mustache_Loader_InlineLoader(__FILE__, 'notanumber');
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @expectedException Mustache_Exception_InvalidArgumentException
|
43 |
+
*/
|
44 |
+
public function testInvalidFileThrowsException()
|
45 |
+
{
|
46 |
+
new Mustache_Loader_InlineLoader('notarealfile', __COMPILER_HALT_OFFSET__);
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
__halt_compiler();
|
51 |
+
|
52 |
+
@@ foo
|
53 |
+
{{ foo }}
|
54 |
+
|
55 |
+
@@ bar
|
56 |
+
{{#bar}}BAR{{/bar}}
|
vendor/mustache/mustache/test/Mustache/Test/Loader/ProductionFilesystemLoaderTest.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_Loader_ProductionFilesystemLoaderTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
public function testConstructor()
|
18 |
+
{
|
19 |
+
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
20 |
+
$loader = new Mustache_Loader_ProductionFilesystemLoader($baseDir, array('extension' => '.ms'));
|
21 |
+
$this->assertInstanceOf('Mustache_Source', $loader->load('alpha'));
|
22 |
+
$this->assertEquals('alpha contents', $loader->load('alpha')->getSource());
|
23 |
+
$this->assertInstanceOf('Mustache_Source', $loader->load('beta.ms'));
|
24 |
+
$this->assertEquals('beta contents', $loader->load('beta.ms')->getSource());
|
25 |
+
}
|
26 |
+
|
27 |
+
public function testTrailingSlashes()
|
28 |
+
{
|
29 |
+
$baseDir = dirname(__FILE__) . '/../../../fixtures/templates/';
|
30 |
+
$loader = new Mustache_Loader_ProductionFilesystemLoader($baseDir);
|
31 |
+
$this->assertEquals('one contents', $loader->load('one')->getSource());
|
32 |
+
}
|
33 |
+
|
34 |
+
public function testConstructorWithProtocol()
|
35 |
+
{
|
36 |
+
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
37 |
+
|
38 |
+
$loader = new Mustache_Loader_ProductionFilesystemLoader('file://' . $baseDir, array('extension' => '.ms'));
|
39 |
+
$this->assertEquals('alpha contents', $loader->load('alpha')->getSource());
|
40 |
+
$this->assertEquals('beta contents', $loader->load('beta.ms')->getSource());
|
41 |
+
}
|
42 |
+
|
43 |
+
public function testLoadTemplates()
|
44 |
+
{
|
45 |
+
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
46 |
+
$loader = new Mustache_Loader_ProductionFilesystemLoader($baseDir);
|
47 |
+
$this->assertEquals('one contents', $loader->load('one')->getSource());
|
48 |
+
$this->assertEquals('two contents', $loader->load('two.mustache')->getSource());
|
49 |
+
}
|
50 |
+
|
51 |
+
public function testEmptyExtensionString()
|
52 |
+
{
|
53 |
+
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
54 |
+
|
55 |
+
$loader = new Mustache_Loader_ProductionFilesystemLoader($baseDir, array('extension' => ''));
|
56 |
+
$this->assertEquals('one contents', $loader->load('one.mustache')->getSource());
|
57 |
+
$this->assertEquals('alpha contents', $loader->load('alpha.ms')->getSource());
|
58 |
+
|
59 |
+
$loader = new Mustache_Loader_ProductionFilesystemLoader($baseDir, array('extension' => null));
|
60 |
+
$this->assertEquals('two contents', $loader->load('two.mustache')->getSource());
|
61 |
+
$this->assertEquals('beta contents', $loader->load('beta.ms')->getSource());
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @expectedException Mustache_Exception_RuntimeException
|
66 |
+
*/
|
67 |
+
public function testMissingBaseDirThrowsException()
|
68 |
+
{
|
69 |
+
new Mustache_Loader_ProductionFilesystemLoader(dirname(__FILE__) . '/not_a_directory');
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* @expectedException Mustache_Exception_UnknownTemplateException
|
74 |
+
*/
|
75 |
+
public function testMissingTemplateThrowsException()
|
76 |
+
{
|
77 |
+
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
78 |
+
$loader = new Mustache_Loader_ProductionFilesystemLoader($baseDir);
|
79 |
+
|
80 |
+
$loader->load('fake');
|
81 |
+
}
|
82 |
+
|
83 |
+
public function testLoadWithDifferentStatProps()
|
84 |
+
{
|
85 |
+
$baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates');
|
86 |
+
$noStatLoader = new Mustache_Loader_ProductionFilesystemLoader($baseDir, array('stat_props' => null));
|
87 |
+
$mtimeLoader = new Mustache_Loader_ProductionFilesystemLoader($baseDir, array('stat_props' => array('mtime')));
|
88 |
+
$sizeLoader = new Mustache_Loader_ProductionFilesystemLoader($baseDir, array('stat_props' => array('size')));
|
89 |
+
$bothLoader = new Mustache_Loader_ProductionFilesystemLoader($baseDir, array('stat_props' => array('mtime', 'size')));
|
90 |
+
|
91 |
+
$noStatKey = $noStatLoader->load('one.mustache')->getKey();
|
92 |
+
$mtimeKey = $mtimeLoader->load('one.mustache')->getKey();
|
93 |
+
$sizeKey = $sizeLoader->load('one.mustache')->getKey();
|
94 |
+
$bothKey = $bothLoader->load('one.mustache')->getKey();
|
95 |
+
|
96 |
+
$this->assertNotEquals($noStatKey, $mtimeKey);
|
97 |
+
$this->assertNotEquals($noStatKey, $sizeKey);
|
98 |
+
$this->assertNotEquals($noStatKey, $bothKey);
|
99 |
+
$this->assertNotEquals($mtimeKey, $sizeKey);
|
100 |
+
$this->assertNotEquals($mtimeKey, $bothKey);
|
101 |
+
$this->assertNotEquals($sizeKey, $bothKey);
|
102 |
+
}
|
103 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Loader/StringLoaderTest.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_Loader_StringLoaderTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
public function testLoadTemplates()
|
18 |
+
{
|
19 |
+
$loader = new Mustache_Loader_StringLoader();
|
20 |
+
|
21 |
+
$this->assertEquals('foo', $loader->load('foo'));
|
22 |
+
$this->assertEquals('{{ bar }}', $loader->load('{{ bar }}'));
|
23 |
+
$this->assertEquals("\n{{! comment }}\n", $loader->load("\n{{! comment }}\n"));
|
24 |
+
}
|
25 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Logger/AbstractLoggerTest.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_Logger_AbstractLoggerTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
public function testEverything()
|
18 |
+
{
|
19 |
+
$logger = new Mustache_Test_Logger_TestLogger();
|
20 |
+
|
21 |
+
$logger->emergency('emergency message');
|
22 |
+
$logger->alert('alert message');
|
23 |
+
$logger->critical('critical message');
|
24 |
+
$logger->error('error message');
|
25 |
+
$logger->warning('warning message');
|
26 |
+
$logger->notice('notice message');
|
27 |
+
$logger->info('info message');
|
28 |
+
$logger->debug('debug message');
|
29 |
+
|
30 |
+
$expected = array(
|
31 |
+
array(Mustache_Logger::EMERGENCY, 'emergency message', array()),
|
32 |
+
array(Mustache_Logger::ALERT, 'alert message', array()),
|
33 |
+
array(Mustache_Logger::CRITICAL, 'critical message', array()),
|
34 |
+
array(Mustache_Logger::ERROR, 'error message', array()),
|
35 |
+
array(Mustache_Logger::WARNING, 'warning message', array()),
|
36 |
+
array(Mustache_Logger::NOTICE, 'notice message', array()),
|
37 |
+
array(Mustache_Logger::INFO, 'info message', array()),
|
38 |
+
array(Mustache_Logger::DEBUG, 'debug message', array()),
|
39 |
+
);
|
40 |
+
|
41 |
+
$this->assertEquals($expected, $logger->log);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
class Mustache_Test_Logger_TestLogger extends Mustache_Logger_AbstractLogger
|
46 |
+
{
|
47 |
+
public $log = array();
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Logs with an arbitrary level.
|
51 |
+
*
|
52 |
+
* @param mixed $level
|
53 |
+
* @param string $message
|
54 |
+
* @param array $context
|
55 |
+
*/
|
56 |
+
public function log($level, $message, array $context = array())
|
57 |
+
{
|
58 |
+
$this->log[] = array($level, $message, $context);
|
59 |
+
}
|
60 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Logger/StreamLoggerTest.php
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_Logger_StreamLoggerTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* @dataProvider acceptsStreamData
|
19 |
+
*/
|
20 |
+
public function testAcceptsStream($name, $stream)
|
21 |
+
{
|
22 |
+
$logger = new Mustache_Logger_StreamLogger($stream);
|
23 |
+
$logger->log(Mustache_Logger::CRITICAL, 'message');
|
24 |
+
|
25 |
+
$this->assertEquals("CRITICAL: message\n", file_get_contents($name));
|
26 |
+
}
|
27 |
+
|
28 |
+
public function acceptsStreamData()
|
29 |
+
{
|
30 |
+
$one = tempnam(sys_get_temp_dir(), 'mustache-test');
|
31 |
+
$two = tempnam(sys_get_temp_dir(), 'mustache-test');
|
32 |
+
|
33 |
+
return array(
|
34 |
+
array($one, $one),
|
35 |
+
array($two, fopen($two, 'a')),
|
36 |
+
);
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @expectedException Mustache_Exception_LogicException
|
41 |
+
*/
|
42 |
+
public function testPrematurelyClosedStreamThrowsException()
|
43 |
+
{
|
44 |
+
$stream = tmpfile();
|
45 |
+
$logger = new Mustache_Logger_StreamLogger($stream);
|
46 |
+
fclose($stream);
|
47 |
+
|
48 |
+
$logger->log(Mustache_Logger::CRITICAL, 'message');
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @dataProvider getLevels
|
53 |
+
*/
|
54 |
+
public function testLoggingThresholds($logLevel, $level, $shouldLog)
|
55 |
+
{
|
56 |
+
$stream = tmpfile();
|
57 |
+
$logger = new Mustache_Logger_StreamLogger($stream, $logLevel);
|
58 |
+
$logger->log($level, 'logged');
|
59 |
+
|
60 |
+
rewind($stream);
|
61 |
+
$result = fread($stream, 1024);
|
62 |
+
|
63 |
+
if ($shouldLog) {
|
64 |
+
$this->assertContains('logged', $result);
|
65 |
+
} else {
|
66 |
+
$this->assertEmpty($result);
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
public function getLevels()
|
71 |
+
{
|
72 |
+
// $logLevel, $level, $shouldLog
|
73 |
+
return array(
|
74 |
+
// identities
|
75 |
+
array(Mustache_Logger::EMERGENCY, Mustache_Logger::EMERGENCY, true),
|
76 |
+
array(Mustache_Logger::ALERT, Mustache_Logger::ALERT, true),
|
77 |
+
array(Mustache_Logger::CRITICAL, Mustache_Logger::CRITICAL, true),
|
78 |
+
array(Mustache_Logger::ERROR, Mustache_Logger::ERROR, true),
|
79 |
+
array(Mustache_Logger::WARNING, Mustache_Logger::WARNING, true),
|
80 |
+
array(Mustache_Logger::NOTICE, Mustache_Logger::NOTICE, true),
|
81 |
+
array(Mustache_Logger::INFO, Mustache_Logger::INFO, true),
|
82 |
+
array(Mustache_Logger::DEBUG, Mustache_Logger::DEBUG, true),
|
83 |
+
|
84 |
+
// one above
|
85 |
+
array(Mustache_Logger::ALERT, Mustache_Logger::EMERGENCY, true),
|
86 |
+
array(Mustache_Logger::CRITICAL, Mustache_Logger::ALERT, true),
|
87 |
+
array(Mustache_Logger::ERROR, Mustache_Logger::CRITICAL, true),
|
88 |
+
array(Mustache_Logger::WARNING, Mustache_Logger::ERROR, true),
|
89 |
+
array(Mustache_Logger::NOTICE, Mustache_Logger::WARNING, true),
|
90 |
+
array(Mustache_Logger::INFO, Mustache_Logger::NOTICE, true),
|
91 |
+
array(Mustache_Logger::DEBUG, Mustache_Logger::INFO, true),
|
92 |
+
|
93 |
+
// one below
|
94 |
+
array(Mustache_Logger::EMERGENCY, Mustache_Logger::ALERT, false),
|
95 |
+
array(Mustache_Logger::ALERT, Mustache_Logger::CRITICAL, false),
|
96 |
+
array(Mustache_Logger::CRITICAL, Mustache_Logger::ERROR, false),
|
97 |
+
array(Mustache_Logger::ERROR, Mustache_Logger::WARNING, false),
|
98 |
+
array(Mustache_Logger::WARNING, Mustache_Logger::NOTICE, false),
|
99 |
+
array(Mustache_Logger::NOTICE, Mustache_Logger::INFO, false),
|
100 |
+
array(Mustache_Logger::INFO, Mustache_Logger::DEBUG, false),
|
101 |
+
);
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* @dataProvider getLogMessages
|
106 |
+
*/
|
107 |
+
public function testLogging($level, $message, $context, $expected)
|
108 |
+
{
|
109 |
+
$stream = tmpfile();
|
110 |
+
$logger = new Mustache_Logger_StreamLogger($stream, Mustache_Logger::DEBUG);
|
111 |
+
$logger->log($level, $message, $context);
|
112 |
+
|
113 |
+
rewind($stream);
|
114 |
+
$result = fread($stream, 1024);
|
115 |
+
|
116 |
+
$this->assertEquals($expected, $result);
|
117 |
+
}
|
118 |
+
|
119 |
+
public function getLogMessages()
|
120 |
+
{
|
121 |
+
// $level, $message, $context, $expected
|
122 |
+
return array(
|
123 |
+
array(Mustache_Logger::DEBUG, 'debug message', array(), "DEBUG: debug message\n"),
|
124 |
+
array(Mustache_Logger::INFO, 'info message', array(), "INFO: info message\n"),
|
125 |
+
array(Mustache_Logger::NOTICE, 'notice message', array(), "NOTICE: notice message\n"),
|
126 |
+
array(Mustache_Logger::WARNING, 'warning message', array(), "WARNING: warning message\n"),
|
127 |
+
array(Mustache_Logger::ERROR, 'error message', array(), "ERROR: error message\n"),
|
128 |
+
array(Mustache_Logger::CRITICAL, 'critical message', array(), "CRITICAL: critical message\n"),
|
129 |
+
array(Mustache_Logger::ALERT, 'alert message', array(), "ALERT: alert message\n"),
|
130 |
+
array(Mustache_Logger::EMERGENCY, 'emergency message', array(), "EMERGENCY: emergency message\n"),
|
131 |
+
|
132 |
+
// with context
|
133 |
+
array(
|
134 |
+
Mustache_Logger::ERROR,
|
135 |
+
'error message',
|
136 |
+
array('name' => 'foo', 'number' => 42),
|
137 |
+
"ERROR: error message\n",
|
138 |
+
),
|
139 |
+
|
140 |
+
// with interpolation
|
141 |
+
array(
|
142 |
+
Mustache_Logger::ERROR,
|
143 |
+
'error {name}-{number}',
|
144 |
+
array('name' => 'foo', 'number' => 42),
|
145 |
+
"ERROR: error foo-42\n",
|
146 |
+
),
|
147 |
+
|
148 |
+
// with iterpolation false positive
|
149 |
+
array(
|
150 |
+
Mustache_Logger::ERROR,
|
151 |
+
'error {nothing}',
|
152 |
+
array('name' => 'foo', 'number' => 42),
|
153 |
+
"ERROR: error {nothing}\n",
|
154 |
+
),
|
155 |
+
|
156 |
+
// with interpolation injection
|
157 |
+
array(
|
158 |
+
Mustache_Logger::ERROR,
|
159 |
+
'{foo}',
|
160 |
+
array('foo' => '{bar}', 'bar' => 'FAIL'),
|
161 |
+
"ERROR: {bar}\n",
|
162 |
+
),
|
163 |
+
);
|
164 |
+
}
|
165 |
+
|
166 |
+
public function testChangeLoggingLevels()
|
167 |
+
{
|
168 |
+
$stream = tmpfile();
|
169 |
+
$logger = new Mustache_Logger_StreamLogger($stream);
|
170 |
+
|
171 |
+
$logger->setLevel(Mustache_Logger::ERROR);
|
172 |
+
$this->assertEquals(Mustache_Logger::ERROR, $logger->getLevel());
|
173 |
+
|
174 |
+
$logger->log(Mustache_Logger::WARNING, 'ignore this');
|
175 |
+
|
176 |
+
$logger->setLevel(Mustache_Logger::INFO);
|
177 |
+
$this->assertEquals(Mustache_Logger::INFO, $logger->getLevel());
|
178 |
+
|
179 |
+
$logger->log(Mustache_Logger::WARNING, 'log this');
|
180 |
+
|
181 |
+
$logger->setLevel(Mustache_Logger::CRITICAL);
|
182 |
+
$this->assertEquals(Mustache_Logger::CRITICAL, $logger->getLevel());
|
183 |
+
|
184 |
+
$logger->log(Mustache_Logger::ERROR, 'ignore this');
|
185 |
+
|
186 |
+
rewind($stream);
|
187 |
+
$result = fread($stream, 1024);
|
188 |
+
|
189 |
+
$this->assertEquals("WARNING: log this\n", $result);
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* @expectedException Mustache_Exception_InvalidArgumentException
|
194 |
+
*/
|
195 |
+
public function testThrowsInvalidArgumentExceptionWhenSettingUnknownLevels()
|
196 |
+
{
|
197 |
+
$logger = new Mustache_Logger_StreamLogger(tmpfile());
|
198 |
+
$logger->setLevel('bacon');
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* @expectedException Mustache_Exception_InvalidArgumentException
|
203 |
+
*/
|
204 |
+
public function testThrowsInvalidArgumentExceptionWhenLoggingUnknownLevels()
|
205 |
+
{
|
206 |
+
$logger = new Mustache_Logger_StreamLogger(tmpfile());
|
207 |
+
$logger->log('bacon', 'CODE BACON ERROR!');
|
208 |
+
}
|
209 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/ParserTest.php
ADDED
@@ -0,0 +1,425 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_ParserTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* @dataProvider getTokenSets
|
19 |
+
*/
|
20 |
+
public function testParse($tokens, $expected)
|
21 |
+
{
|
22 |
+
$parser = new Mustache_Parser();
|
23 |
+
$this->assertEquals($expected, $parser->parse($tokens));
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getTokenSets()
|
27 |
+
{
|
28 |
+
return array(
|
29 |
+
array(
|
30 |
+
array(),
|
31 |
+
array(),
|
32 |
+
),
|
33 |
+
|
34 |
+
array(
|
35 |
+
array(array(
|
36 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
37 |
+
Mustache_Tokenizer::LINE => 0,
|
38 |
+
Mustache_Tokenizer::VALUE => 'text',
|
39 |
+
)),
|
40 |
+
array(array(
|
41 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
42 |
+
Mustache_Tokenizer::LINE => 0,
|
43 |
+
Mustache_Tokenizer::VALUE => 'text',
|
44 |
+
)),
|
45 |
+
),
|
46 |
+
|
47 |
+
array(
|
48 |
+
array(array(
|
49 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
50 |
+
Mustache_Tokenizer::LINE => 0,
|
51 |
+
Mustache_Tokenizer::NAME => 'name',
|
52 |
+
)),
|
53 |
+
array(array(
|
54 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
55 |
+
Mustache_Tokenizer::LINE => 0,
|
56 |
+
Mustache_Tokenizer::NAME => 'name',
|
57 |
+
)),
|
58 |
+
),
|
59 |
+
|
60 |
+
array(
|
61 |
+
array(
|
62 |
+
array(
|
63 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
64 |
+
Mustache_Tokenizer::LINE => 0,
|
65 |
+
Mustache_Tokenizer::VALUE => 'foo',
|
66 |
+
),
|
67 |
+
array(
|
68 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_INVERTED,
|
69 |
+
Mustache_Tokenizer::LINE => 0,
|
70 |
+
Mustache_Tokenizer::INDEX => 123,
|
71 |
+
Mustache_Tokenizer::NAME => 'parent',
|
72 |
+
),
|
73 |
+
array(
|
74 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
75 |
+
Mustache_Tokenizer::LINE => 0,
|
76 |
+
Mustache_Tokenizer::NAME => 'name',
|
77 |
+
),
|
78 |
+
array(
|
79 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
80 |
+
Mustache_Tokenizer::LINE => 0,
|
81 |
+
Mustache_Tokenizer::INDEX => 456,
|
82 |
+
Mustache_Tokenizer::NAME => 'parent',
|
83 |
+
),
|
84 |
+
array(
|
85 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
86 |
+
Mustache_Tokenizer::LINE => 0,
|
87 |
+
Mustache_Tokenizer::VALUE => 'bar',
|
88 |
+
),
|
89 |
+
),
|
90 |
+
|
91 |
+
array(
|
92 |
+
array(
|
93 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
94 |
+
Mustache_Tokenizer::LINE => 0,
|
95 |
+
Mustache_Tokenizer::VALUE => 'foo',
|
96 |
+
),
|
97 |
+
array(
|
98 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_INVERTED,
|
99 |
+
Mustache_Tokenizer::NAME => 'parent',
|
100 |
+
Mustache_Tokenizer::LINE => 0,
|
101 |
+
Mustache_Tokenizer::INDEX => 123,
|
102 |
+
Mustache_Tokenizer::END => 456,
|
103 |
+
Mustache_Tokenizer::NODES => array(
|
104 |
+
array(
|
105 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
106 |
+
Mustache_Tokenizer::LINE => 0,
|
107 |
+
Mustache_Tokenizer::NAME => 'name',
|
108 |
+
),
|
109 |
+
),
|
110 |
+
),
|
111 |
+
array(
|
112 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
113 |
+
Mustache_Tokenizer::LINE => 0,
|
114 |
+
Mustache_Tokenizer::VALUE => 'bar',
|
115 |
+
),
|
116 |
+
),
|
117 |
+
),
|
118 |
+
|
119 |
+
// This *would* be an invalid inheritance parse tree, but that pragma
|
120 |
+
// isn't enabled so it'll thunk it back into an "escaped" token:
|
121 |
+
array(
|
122 |
+
array(
|
123 |
+
array(
|
124 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_BLOCK_VAR,
|
125 |
+
Mustache_Tokenizer::NAME => 'foo',
|
126 |
+
Mustache_Tokenizer::OTAG => '{{',
|
127 |
+
Mustache_Tokenizer::CTAG => '}}',
|
128 |
+
Mustache_Tokenizer::LINE => 0,
|
129 |
+
),
|
130 |
+
array(
|
131 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
132 |
+
Mustache_Tokenizer::LINE => 0,
|
133 |
+
Mustache_Tokenizer::VALUE => 'bar',
|
134 |
+
),
|
135 |
+
),
|
136 |
+
array(
|
137 |
+
array(
|
138 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
139 |
+
Mustache_Tokenizer::NAME => '$foo',
|
140 |
+
Mustache_Tokenizer::OTAG => '{{',
|
141 |
+
Mustache_Tokenizer::CTAG => '}}',
|
142 |
+
Mustache_Tokenizer::LINE => 0,
|
143 |
+
),
|
144 |
+
array(
|
145 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
146 |
+
Mustache_Tokenizer::LINE => 0,
|
147 |
+
Mustache_Tokenizer::VALUE => 'bar',
|
148 |
+
),
|
149 |
+
),
|
150 |
+
),
|
151 |
+
|
152 |
+
array(
|
153 |
+
array(
|
154 |
+
array(
|
155 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
156 |
+
Mustache_Tokenizer::LINE => 0,
|
157 |
+
Mustache_Tokenizer::VALUE => ' ',
|
158 |
+
),
|
159 |
+
array(
|
160 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_DELIM_CHANGE,
|
161 |
+
Mustache_Tokenizer::LINE => 0,
|
162 |
+
),
|
163 |
+
array(
|
164 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
165 |
+
Mustache_Tokenizer::LINE => 0,
|
166 |
+
Mustache_Tokenizer::VALUE => " \n",
|
167 |
+
),
|
168 |
+
array(
|
169 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
170 |
+
Mustache_Tokenizer::NAME => 'foo',
|
171 |
+
Mustache_Tokenizer::OTAG => '[[',
|
172 |
+
Mustache_Tokenizer::CTAG => ']]',
|
173 |
+
Mustache_Tokenizer::LINE => 1,
|
174 |
+
),
|
175 |
+
),
|
176 |
+
array(
|
177 |
+
array(
|
178 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
179 |
+
Mustache_Tokenizer::NAME => 'foo',
|
180 |
+
Mustache_Tokenizer::OTAG => '[[',
|
181 |
+
Mustache_Tokenizer::CTAG => ']]',
|
182 |
+
Mustache_Tokenizer::LINE => 1,
|
183 |
+
),
|
184 |
+
),
|
185 |
+
),
|
186 |
+
|
187 |
+
);
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* @dataProvider getInheritanceTokenSets
|
192 |
+
*/
|
193 |
+
public function testParseWithInheritance($tokens, $expected)
|
194 |
+
{
|
195 |
+
$parser = new Mustache_Parser();
|
196 |
+
$parser->setPragmas(array(Mustache_Engine::PRAGMA_BLOCKS));
|
197 |
+
$this->assertEquals($expected, $parser->parse($tokens));
|
198 |
+
}
|
199 |
+
|
200 |
+
public function getInheritanceTokenSets()
|
201 |
+
{
|
202 |
+
return array(
|
203 |
+
array(
|
204 |
+
array(
|
205 |
+
array(
|
206 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_PARENT,
|
207 |
+
Mustache_Tokenizer::NAME => 'foo',
|
208 |
+
Mustache_Tokenizer::OTAG => '{{',
|
209 |
+
Mustache_Tokenizer::CTAG => '}}',
|
210 |
+
Mustache_Tokenizer::LINE => 0,
|
211 |
+
Mustache_Tokenizer::INDEX => 8,
|
212 |
+
),
|
213 |
+
array(
|
214 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_BLOCK_VAR,
|
215 |
+
Mustache_Tokenizer::NAME => 'bar',
|
216 |
+
Mustache_Tokenizer::OTAG => '{{',
|
217 |
+
Mustache_Tokenizer::CTAG => '}}',
|
218 |
+
Mustache_Tokenizer::LINE => 0,
|
219 |
+
Mustache_Tokenizer::INDEX => 16,
|
220 |
+
),
|
221 |
+
array(
|
222 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
223 |
+
Mustache_Tokenizer::LINE => 0,
|
224 |
+
Mustache_Tokenizer::VALUE => 'baz',
|
225 |
+
),
|
226 |
+
array(
|
227 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
228 |
+
Mustache_Tokenizer::NAME => 'bar',
|
229 |
+
Mustache_Tokenizer::OTAG => '{{',
|
230 |
+
Mustache_Tokenizer::CTAG => '}}',
|
231 |
+
Mustache_Tokenizer::LINE => 0,
|
232 |
+
Mustache_Tokenizer::INDEX => 19,
|
233 |
+
),
|
234 |
+
array(
|
235 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
236 |
+
Mustache_Tokenizer::NAME => 'foo',
|
237 |
+
Mustache_Tokenizer::OTAG => '{{',
|
238 |
+
Mustache_Tokenizer::CTAG => '}}',
|
239 |
+
Mustache_Tokenizer::LINE => 0,
|
240 |
+
Mustache_Tokenizer::INDEX => 27,
|
241 |
+
),
|
242 |
+
),
|
243 |
+
array(
|
244 |
+
array(
|
245 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_PARENT,
|
246 |
+
Mustache_Tokenizer::NAME => 'foo',
|
247 |
+
Mustache_Tokenizer::OTAG => '{{',
|
248 |
+
Mustache_Tokenizer::CTAG => '}}',
|
249 |
+
Mustache_Tokenizer::LINE => 0,
|
250 |
+
Mustache_Tokenizer::INDEX => 8,
|
251 |
+
Mustache_Tokenizer::END => 27,
|
252 |
+
Mustache_Tokenizer::NODES => array(
|
253 |
+
array(
|
254 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_BLOCK_ARG,
|
255 |
+
Mustache_Tokenizer::NAME => 'bar',
|
256 |
+
Mustache_Tokenizer::OTAG => '{{',
|
257 |
+
Mustache_Tokenizer::CTAG => '}}',
|
258 |
+
Mustache_Tokenizer::LINE => 0,
|
259 |
+
Mustache_Tokenizer::INDEX => 16,
|
260 |
+
Mustache_Tokenizer::END => 19,
|
261 |
+
Mustache_Tokenizer::NODES => array(
|
262 |
+
array(
|
263 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
264 |
+
Mustache_Tokenizer::LINE => 0,
|
265 |
+
Mustache_Tokenizer::VALUE => 'baz',
|
266 |
+
),
|
267 |
+
),
|
268 |
+
),
|
269 |
+
),
|
270 |
+
),
|
271 |
+
),
|
272 |
+
),
|
273 |
+
|
274 |
+
array(
|
275 |
+
array(
|
276 |
+
array(
|
277 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_BLOCK_VAR,
|
278 |
+
Mustache_Tokenizer::NAME => 'foo',
|
279 |
+
Mustache_Tokenizer::OTAG => '{{',
|
280 |
+
Mustache_Tokenizer::CTAG => '}}',
|
281 |
+
Mustache_Tokenizer::LINE => 0,
|
282 |
+
),
|
283 |
+
array(
|
284 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
285 |
+
Mustache_Tokenizer::LINE => 0,
|
286 |
+
Mustache_Tokenizer::VALUE => 'bar',
|
287 |
+
),
|
288 |
+
array(
|
289 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
290 |
+
Mustache_Tokenizer::NAME => 'foo',
|
291 |
+
Mustache_Tokenizer::OTAG => '{{',
|
292 |
+
Mustache_Tokenizer::CTAG => '}}',
|
293 |
+
Mustache_Tokenizer::LINE => 0,
|
294 |
+
Mustache_Tokenizer::INDEX => 11,
|
295 |
+
),
|
296 |
+
),
|
297 |
+
array(
|
298 |
+
array(
|
299 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_BLOCK_VAR,
|
300 |
+
Mustache_Tokenizer::NAME => 'foo',
|
301 |
+
Mustache_Tokenizer::OTAG => '{{',
|
302 |
+
Mustache_Tokenizer::CTAG => '}}',
|
303 |
+
Mustache_Tokenizer::LINE => 0,
|
304 |
+
Mustache_Tokenizer::END => 11,
|
305 |
+
Mustache_Tokenizer::NODES => array(
|
306 |
+
array(
|
307 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
308 |
+
Mustache_Tokenizer::LINE => 0,
|
309 |
+
Mustache_Tokenizer::VALUE => 'bar',
|
310 |
+
),
|
311 |
+
),
|
312 |
+
),
|
313 |
+
),
|
314 |
+
),
|
315 |
+
);
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* @dataProvider getBadParseTrees
|
320 |
+
* @expectedException Mustache_Exception_SyntaxException
|
321 |
+
*/
|
322 |
+
public function testParserThrowsExceptions($tokens)
|
323 |
+
{
|
324 |
+
$parser = new Mustache_Parser();
|
325 |
+
$parser->parse($tokens);
|
326 |
+
}
|
327 |
+
|
328 |
+
public function getBadParseTrees()
|
329 |
+
{
|
330 |
+
return array(
|
331 |
+
// no close
|
332 |
+
array(
|
333 |
+
array(
|
334 |
+
array(
|
335 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_SECTION,
|
336 |
+
Mustache_Tokenizer::NAME => 'parent',
|
337 |
+
Mustache_Tokenizer::LINE => 0,
|
338 |
+
Mustache_Tokenizer::INDEX => 123,
|
339 |
+
),
|
340 |
+
),
|
341 |
+
),
|
342 |
+
|
343 |
+
// no close inverted
|
344 |
+
array(
|
345 |
+
array(
|
346 |
+
array(
|
347 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_INVERTED,
|
348 |
+
Mustache_Tokenizer::NAME => 'parent',
|
349 |
+
Mustache_Tokenizer::LINE => 0,
|
350 |
+
Mustache_Tokenizer::INDEX => 123,
|
351 |
+
),
|
352 |
+
),
|
353 |
+
),
|
354 |
+
|
355 |
+
// no opening inverted
|
356 |
+
array(
|
357 |
+
array(
|
358 |
+
array(
|
359 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
360 |
+
Mustache_Tokenizer::NAME => 'parent',
|
361 |
+
Mustache_Tokenizer::LINE => 0,
|
362 |
+
Mustache_Tokenizer::INDEX => 123,
|
363 |
+
),
|
364 |
+
),
|
365 |
+
),
|
366 |
+
|
367 |
+
// weird nesting
|
368 |
+
array(
|
369 |
+
array(
|
370 |
+
array(
|
371 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_SECTION,
|
372 |
+
Mustache_Tokenizer::NAME => 'parent',
|
373 |
+
Mustache_Tokenizer::LINE => 0,
|
374 |
+
Mustache_Tokenizer::INDEX => 123,
|
375 |
+
),
|
376 |
+
array(
|
377 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_SECTION,
|
378 |
+
Mustache_Tokenizer::NAME => 'child',
|
379 |
+
Mustache_Tokenizer::LINE => 0,
|
380 |
+
Mustache_Tokenizer::INDEX => 123,
|
381 |
+
),
|
382 |
+
array(
|
383 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
384 |
+
Mustache_Tokenizer::NAME => 'parent',
|
385 |
+
Mustache_Tokenizer::LINE => 0,
|
386 |
+
Mustache_Tokenizer::INDEX => 123,
|
387 |
+
),
|
388 |
+
array(
|
389 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
390 |
+
Mustache_Tokenizer::NAME => 'child',
|
391 |
+
Mustache_Tokenizer::LINE => 0,
|
392 |
+
Mustache_Tokenizer::INDEX => 123,
|
393 |
+
),
|
394 |
+
),
|
395 |
+
),
|
396 |
+
|
397 |
+
// This *would* be a valid inheritance parse tree, but that pragma
|
398 |
+
// isn't enabled here so it's going to fail :)
|
399 |
+
array(
|
400 |
+
array(
|
401 |
+
array(
|
402 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_BLOCK_VAR,
|
403 |
+
Mustache_Tokenizer::NAME => 'foo',
|
404 |
+
Mustache_Tokenizer::OTAG => '{{',
|
405 |
+
Mustache_Tokenizer::CTAG => '}}',
|
406 |
+
Mustache_Tokenizer::LINE => 0,
|
407 |
+
),
|
408 |
+
array(
|
409 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
410 |
+
Mustache_Tokenizer::LINE => 0,
|
411 |
+
Mustache_Tokenizer::VALUE => 'bar',
|
412 |
+
),
|
413 |
+
array(
|
414 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
415 |
+
Mustache_Tokenizer::NAME => 'foo',
|
416 |
+
Mustache_Tokenizer::OTAG => '{{',
|
417 |
+
Mustache_Tokenizer::CTAG => '}}',
|
418 |
+
Mustache_Tokenizer::LINE => 0,
|
419 |
+
Mustache_Tokenizer::INDEX => 11,
|
420 |
+
),
|
421 |
+
),
|
422 |
+
),
|
423 |
+
);
|
424 |
+
}
|
425 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/Source/FilesystemSourceTest.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_Source_FilesystemSourceTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* @expectedException RuntimeException
|
19 |
+
*/
|
20 |
+
public function testMissingTemplateThrowsException()
|
21 |
+
{
|
22 |
+
$source = new Mustache_Source_FilesystemSource(dirname(__FILE__) . '/not_a_file.mustache', array('mtime'));
|
23 |
+
$source->getKey();
|
24 |
+
}
|
25 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/SpecTestCase.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
abstract class Mustache_Test_SpecTestCase extends PHPUnit_Framework_TestCase
|
13 |
+
{
|
14 |
+
protected static $mustache;
|
15 |
+
|
16 |
+
public static function setUpBeforeClass()
|
17 |
+
{
|
18 |
+
self::$mustache = new Mustache_Engine();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected static function loadTemplate($source, $partials)
|
22 |
+
{
|
23 |
+
self::$mustache->setPartials($partials);
|
24 |
+
|
25 |
+
return self::$mustache->loadTemplate($source);
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Data provider for the mustache spec test.
|
30 |
+
*
|
31 |
+
* Loads YAML files from the spec and converts them to PHPisms.
|
32 |
+
*
|
33 |
+
* @param string $name
|
34 |
+
*
|
35 |
+
* @return array
|
36 |
+
*/
|
37 |
+
protected function loadSpec($name)
|
38 |
+
{
|
39 |
+
$filename = dirname(__FILE__) . '/../../../vendor/spec/specs/' . $name . '.yml';
|
40 |
+
if (!file_exists($filename)) {
|
41 |
+
return array();
|
42 |
+
}
|
43 |
+
|
44 |
+
$data = array();
|
45 |
+
$yaml = new sfYamlParser();
|
46 |
+
$file = file_get_contents($filename);
|
47 |
+
|
48 |
+
// @hack: pre-process the 'lambdas' spec so the Symfony YAML parser doesn't complain.
|
49 |
+
if ($name === '~lambdas') {
|
50 |
+
$file = str_replace(" !code\n", "\n", $file);
|
51 |
+
}
|
52 |
+
|
53 |
+
$spec = $yaml->parse($file);
|
54 |
+
|
55 |
+
foreach ($spec['tests'] as $test) {
|
56 |
+
$data[] = array(
|
57 |
+
$test['name'] . ': ' . $test['desc'],
|
58 |
+
$test['template'],
|
59 |
+
isset($test['partials']) ? $test['partials'] : array(),
|
60 |
+
$test['data'],
|
61 |
+
$test['expected'],
|
62 |
+
);
|
63 |
+
}
|
64 |
+
|
65 |
+
return $data;
|
66 |
+
}
|
67 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/TemplateTest.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_TemplateTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
public function testConstructor()
|
18 |
+
{
|
19 |
+
$mustache = new Mustache_Engine();
|
20 |
+
$template = new Mustache_Test_TemplateStub($mustache);
|
21 |
+
$this->assertSame($mustache, $template->getMustache());
|
22 |
+
}
|
23 |
+
|
24 |
+
public function testRendering()
|
25 |
+
{
|
26 |
+
$rendered = '<< wheee >>';
|
27 |
+
$mustache = new Mustache_Engine();
|
28 |
+
$template = new Mustache_Test_TemplateStub($mustache);
|
29 |
+
$template->rendered = $rendered;
|
30 |
+
$context = new Mustache_Context();
|
31 |
+
|
32 |
+
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
33 |
+
$this->assertEquals($rendered, $template());
|
34 |
+
}
|
35 |
+
|
36 |
+
$this->assertEquals($rendered, $template->render());
|
37 |
+
$this->assertEquals($rendered, $template->renderInternal($context));
|
38 |
+
$this->assertEquals($rendered, $template->render(array('foo' => 'bar')));
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
class Mustache_Test_TemplateStub extends Mustache_Template
|
43 |
+
{
|
44 |
+
public $rendered;
|
45 |
+
|
46 |
+
public function getMustache()
|
47 |
+
{
|
48 |
+
return $this->mustache;
|
49 |
+
}
|
50 |
+
|
51 |
+
public function renderInternal(Mustache_Context $context, $indent = '', $escape = false)
|
52 |
+
{
|
53 |
+
return $this->rendered;
|
54 |
+
}
|
55 |
+
}
|
vendor/mustache/mustache/test/Mustache/Test/TokenizerTest.php
ADDED
@@ -0,0 +1,306 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @group unit
|
14 |
+
*/
|
15 |
+
class Mustache_Test_TokenizerTest extends PHPUnit_Framework_TestCase
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* @dataProvider getTokens
|
19 |
+
*/
|
20 |
+
public function testScan($text, $delimiters, $expected)
|
21 |
+
{
|
22 |
+
$tokenizer = new Mustache_Tokenizer();
|
23 |
+
$this->assertSame($expected, $tokenizer->scan($text, $delimiters));
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @expectedException Mustache_Exception_SyntaxException
|
28 |
+
*/
|
29 |
+
public function testUnevenBracesThrowExceptions()
|
30 |
+
{
|
31 |
+
$tokenizer = new Mustache_Tokenizer();
|
32 |
+
|
33 |
+
$text = '{{{ name }}';
|
34 |
+
$tokenizer->scan($text, null);
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @expectedException Mustache_Exception_SyntaxException
|
39 |
+
*/
|
40 |
+
public function testUnevenBracesWithCustomDelimiterThrowExceptions()
|
41 |
+
{
|
42 |
+
$tokenizer = new Mustache_Tokenizer();
|
43 |
+
|
44 |
+
$text = '<%{ name %>';
|
45 |
+
$tokenizer->scan($text, '<% %>');
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getTokens()
|
49 |
+
{
|
50 |
+
return array(
|
51 |
+
array(
|
52 |
+
'text',
|
53 |
+
null,
|
54 |
+
array(
|
55 |
+
array(
|
56 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
57 |
+
Mustache_Tokenizer::LINE => 0,
|
58 |
+
Mustache_Tokenizer::VALUE => 'text',
|
59 |
+
),
|
60 |
+
),
|
61 |
+
),
|
62 |
+
|
63 |
+
array(
|
64 |
+
'text',
|
65 |
+
'<<< >>>',
|
66 |
+
array(
|
67 |
+
array(
|
68 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
69 |
+
Mustache_Tokenizer::LINE => 0,
|
70 |
+
Mustache_Tokenizer::VALUE => 'text',
|
71 |
+
),
|
72 |
+
),
|
73 |
+
),
|
74 |
+
|
75 |
+
array(
|
76 |
+
'{{ name }}',
|
77 |
+
null,
|
78 |
+
array(
|
79 |
+
array(
|
80 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
81 |
+
Mustache_Tokenizer::NAME => 'name',
|
82 |
+
Mustache_Tokenizer::OTAG => '{{',
|
83 |
+
Mustache_Tokenizer::CTAG => '}}',
|
84 |
+
Mustache_Tokenizer::LINE => 0,
|
85 |
+
Mustache_Tokenizer::INDEX => 10,
|
86 |
+
),
|
87 |
+
),
|
88 |
+
),
|
89 |
+
|
90 |
+
array(
|
91 |
+
'{{ name }}',
|
92 |
+
'<<< >>>',
|
93 |
+
array(
|
94 |
+
array(
|
95 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
96 |
+
Mustache_Tokenizer::LINE => 0,
|
97 |
+
Mustache_Tokenizer::VALUE => '{{ name }}',
|
98 |
+
),
|
99 |
+
),
|
100 |
+
),
|
101 |
+
|
102 |
+
array(
|
103 |
+
'<<< name >>>',
|
104 |
+
'<<< >>>',
|
105 |
+
array(
|
106 |
+
array(
|
107 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
108 |
+
Mustache_Tokenizer::NAME => 'name',
|
109 |
+
Mustache_Tokenizer::OTAG => '<<<',
|
110 |
+
Mustache_Tokenizer::CTAG => '>>>',
|
111 |
+
Mustache_Tokenizer::LINE => 0,
|
112 |
+
Mustache_Tokenizer::INDEX => 12,
|
113 |
+
),
|
114 |
+
),
|
115 |
+
),
|
116 |
+
|
117 |
+
array(
|
118 |
+
"{{{ a }}}\n{{# b }} \n{{= | | =}}| c ||/ b |\n|{ d }|",
|
119 |
+
null,
|
120 |
+
array(
|
121 |
+
array(
|
122 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_UNESCAPED,
|
123 |
+
Mustache_Tokenizer::NAME => 'a',
|
124 |
+
Mustache_Tokenizer::OTAG => '{{',
|
125 |
+
Mustache_Tokenizer::CTAG => '}}',
|
126 |
+
Mustache_Tokenizer::LINE => 0,
|
127 |
+
Mustache_Tokenizer::INDEX => 8,
|
128 |
+
),
|
129 |
+
array(
|
130 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
131 |
+
Mustache_Tokenizer::LINE => 0,
|
132 |
+
Mustache_Tokenizer::VALUE => "\n",
|
133 |
+
),
|
134 |
+
array(
|
135 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_SECTION,
|
136 |
+
Mustache_Tokenizer::NAME => 'b',
|
137 |
+
Mustache_Tokenizer::OTAG => '{{',
|
138 |
+
Mustache_Tokenizer::CTAG => '}}',
|
139 |
+
Mustache_Tokenizer::LINE => 1,
|
140 |
+
Mustache_Tokenizer::INDEX => 18,
|
141 |
+
),
|
142 |
+
array(
|
143 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
144 |
+
Mustache_Tokenizer::LINE => 1,
|
145 |
+
Mustache_Tokenizer::VALUE => " \n",
|
146 |
+
),
|
147 |
+
array(
|
148 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_DELIM_CHANGE,
|
149 |
+
Mustache_Tokenizer::LINE => 2,
|
150 |
+
),
|
151 |
+
array(
|
152 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
153 |
+
Mustache_Tokenizer::NAME => 'c',
|
154 |
+
Mustache_Tokenizer::OTAG => '|',
|
155 |
+
Mustache_Tokenizer::CTAG => '|',
|
156 |
+
Mustache_Tokenizer::LINE => 2,
|
157 |
+
Mustache_Tokenizer::INDEX => 37,
|
158 |
+
),
|
159 |
+
array(
|
160 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
161 |
+
Mustache_Tokenizer::NAME => 'b',
|
162 |
+
Mustache_Tokenizer::OTAG => '|',
|
163 |
+
Mustache_Tokenizer::CTAG => '|',
|
164 |
+
Mustache_Tokenizer::LINE => 2,
|
165 |
+
Mustache_Tokenizer::INDEX => 37,
|
166 |
+
),
|
167 |
+
array(
|
168 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
169 |
+
Mustache_Tokenizer::LINE => 2,
|
170 |
+
Mustache_Tokenizer::VALUE => "\n",
|
171 |
+
),
|
172 |
+
array(
|
173 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_UNESCAPED,
|
174 |
+
Mustache_Tokenizer::NAME => 'd',
|
175 |
+
Mustache_Tokenizer::OTAG => '|',
|
176 |
+
Mustache_Tokenizer::CTAG => '|',
|
177 |
+
Mustache_Tokenizer::LINE => 3,
|
178 |
+
Mustache_Tokenizer::INDEX => 51,
|
179 |
+
),
|
180 |
+
|
181 |
+
),
|
182 |
+
),
|
183 |
+
|
184 |
+
// See https://github.com/bobthecow/mustache.php/issues/183
|
185 |
+
array(
|
186 |
+
'{{# a }}0{{/ a }}',
|
187 |
+
null,
|
188 |
+
array(
|
189 |
+
array(
|
190 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_SECTION,
|
191 |
+
Mustache_Tokenizer::NAME => 'a',
|
192 |
+
Mustache_Tokenizer::OTAG => '{{',
|
193 |
+
Mustache_Tokenizer::CTAG => '}}',
|
194 |
+
Mustache_Tokenizer::LINE => 0,
|
195 |
+
Mustache_Tokenizer::INDEX => 8,
|
196 |
+
),
|
197 |
+
array(
|
198 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
199 |
+
Mustache_Tokenizer::LINE => 0,
|
200 |
+
Mustache_Tokenizer::VALUE => '0',
|
201 |
+
),
|
202 |
+
array(
|
203 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
204 |
+
Mustache_Tokenizer::NAME => 'a',
|
205 |
+
Mustache_Tokenizer::OTAG => '{{',
|
206 |
+
Mustache_Tokenizer::CTAG => '}}',
|
207 |
+
Mustache_Tokenizer::LINE => 0,
|
208 |
+
Mustache_Tokenizer::INDEX => 9,
|
209 |
+
),
|
210 |
+
),
|
211 |
+
),
|
212 |
+
|
213 |
+
// custom delimiters don't swallow the next character, even if it is a }, }}}, or the same delimiter
|
214 |
+
array(
|
215 |
+
'<% a %>} <% b %>%> <% c %>}}}',
|
216 |
+
'<% %>',
|
217 |
+
array(
|
218 |
+
array(
|
219 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
220 |
+
Mustache_Tokenizer::NAME => 'a',
|
221 |
+
Mustache_Tokenizer::OTAG => '<%',
|
222 |
+
Mustache_Tokenizer::CTAG => '%>',
|
223 |
+
Mustache_Tokenizer::LINE => 0,
|
224 |
+
Mustache_Tokenizer::INDEX => 7,
|
225 |
+
),
|
226 |
+
array(
|
227 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
228 |
+
Mustache_Tokenizer::LINE => 0,
|
229 |
+
Mustache_Tokenizer::VALUE => '} ',
|
230 |
+
),
|
231 |
+
array(
|
232 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
233 |
+
Mustache_Tokenizer::NAME => 'b',
|
234 |
+
Mustache_Tokenizer::OTAG => '<%',
|
235 |
+
Mustache_Tokenizer::CTAG => '%>',
|
236 |
+
Mustache_Tokenizer::LINE => 0,
|
237 |
+
Mustache_Tokenizer::INDEX => 16,
|
238 |
+
),
|
239 |
+
array(
|
240 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
241 |
+
Mustache_Tokenizer::LINE => 0,
|
242 |
+
Mustache_Tokenizer::VALUE => '%> ',
|
243 |
+
),
|
244 |
+
array(
|
245 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_ESCAPED,
|
246 |
+
Mustache_Tokenizer::NAME => 'c',
|
247 |
+
Mustache_Tokenizer::OTAG => '<%',
|
248 |
+
Mustache_Tokenizer::CTAG => '%>',
|
249 |
+
Mustache_Tokenizer::LINE => 0,
|
250 |
+
Mustache_Tokenizer::INDEX => 26,
|
251 |
+
),
|
252 |
+
array(
|
253 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
254 |
+
Mustache_Tokenizer::LINE => 0,
|
255 |
+
Mustache_Tokenizer::VALUE => '}}}',
|
256 |
+
),
|
257 |
+
),
|
258 |
+
),
|
259 |
+
|
260 |
+
// unescaped custom delimiters are properly parsed
|
261 |
+
array(
|
262 |
+
'<%{ a }%>',
|
263 |
+
'<% %>',
|
264 |
+
array(
|
265 |
+
array(
|
266 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_UNESCAPED,
|
267 |
+
Mustache_Tokenizer::NAME => 'a',
|
268 |
+
Mustache_Tokenizer::OTAG => '<%',
|
269 |
+
Mustache_Tokenizer::CTAG => '%>',
|
270 |
+
Mustache_Tokenizer::LINE => 0,
|
271 |
+
Mustache_Tokenizer::INDEX => 9,
|
272 |
+
),
|
273 |
+
),
|
274 |
+
),
|
275 |
+
|
276 |
+
// Ensure that $arg token is not picked up during tokenization
|
277 |
+
array(
|
278 |
+
'{{$arg}}default{{/arg}}',
|
279 |
+
null,
|
280 |
+
array(
|
281 |
+
array(
|
282 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_BLOCK_VAR,
|
283 |
+
Mustache_Tokenizer::NAME => 'arg',
|
284 |
+
Mustache_Tokenizer::OTAG => '{{',
|
285 |
+
Mustache_Tokenizer::CTAG => '}}',
|
286 |
+
Mustache_Tokenizer::LINE => 0,
|
287 |
+
Mustache_Tokenizer::INDEX => 8,
|
288 |
+
),
|
289 |
+
array(
|
290 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_TEXT,
|
291 |
+
Mustache_Tokenizer::LINE => 0,
|
292 |
+
Mustache_Tokenizer::VALUE => 'default',
|
293 |
+
),
|
294 |
+
array(
|
295 |
+
Mustache_Tokenizer::TYPE => Mustache_Tokenizer::T_END_SECTION,
|
296 |
+
Mustache_Tokenizer::NAME => 'arg',
|
297 |
+
Mustache_Tokenizer::OTAG => '{{',
|
298 |
+
Mustache_Tokenizer::CTAG => '}}',
|
299 |
+
Mustache_Tokenizer::LINE => 0,
|
300 |
+
Mustache_Tokenizer::INDEX => 15,
|
301 |
+
),
|
302 |
+
),
|
303 |
+
),
|
304 |
+
);
|
305 |
+
}
|
306 |
+
}
|
vendor/mustache/mustache/test/bootstrap.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
require dirname(__FILE__) . '/../src/Mustache/Autoloader.php';
|
13 |
+
Mustache_Autoloader::register();
|
14 |
+
Mustache_Autoloader::register(dirname(__FILE__) . '/../test');
|
15 |
+
|
16 |
+
require dirname(__FILE__) . '/../vendor/yaml/lib/sfYamlParser.php';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Minimal stream wrapper to test protocol-based access to templates.
|
20 |
+
*/
|
21 |
+
class TestStream
|
22 |
+
{
|
23 |
+
private $filehandle;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Always returns false.
|
27 |
+
*
|
28 |
+
* @param string $path
|
29 |
+
* @param int $flags
|
30 |
+
*
|
31 |
+
* @return array
|
32 |
+
*/
|
33 |
+
public function url_stat($path, $flags)
|
34 |
+
{
|
35 |
+
return false;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Open the file.
|
40 |
+
*
|
41 |
+
* @param string $path
|
42 |
+
* @param string $mode
|
43 |
+
*
|
44 |
+
* @return bool
|
45 |
+
*/
|
46 |
+
public function stream_open($path, $mode)
|
47 |
+
{
|
48 |
+
$path = preg_replace('-^test://-', '', $path);
|
49 |
+
$this->filehandle = fopen($path, $mode);
|
50 |
+
|
51 |
+
return $this->filehandle !== false;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @return array
|
56 |
+
*/
|
57 |
+
public function stream_stat()
|
58 |
+
{
|
59 |
+
return array();
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @param int $count
|
64 |
+
*
|
65 |
+
* @return string
|
66 |
+
*/
|
67 |
+
public function stream_read($count)
|
68 |
+
{
|
69 |
+
return fgets($this->filehandle, $count);
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* @return bool
|
74 |
+
*/
|
75 |
+
public function stream_eof()
|
76 |
+
{
|
77 |
+
return feof($this->filehandle);
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* @return bool
|
82 |
+
*/
|
83 |
+
public function stream_close()
|
84 |
+
{
|
85 |
+
return fclose($this->filehandle);
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
if (!stream_wrapper_register('test', 'TestStream')) {
|
90 |
+
die('Failed to register protocol');
|
91 |
+
}
|
vendor/mustache/mustache/test/fixtures/autoloader/Mustache/Bar.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Mustache_Bar
|
13 |
+
{
|
14 |
+
// nada
|
15 |
+
}
|
vendor/mustache/mustache/test/fixtures/autoloader/Mustache/Foo.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Mustache_Foo
|
13 |
+
{
|
14 |
+
// nada
|
15 |
+
}
|
vendor/mustache/mustache/test/fixtures/autoloader/NonMustacheClass.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class NonMustacheClass
|
13 |
+
{
|
14 |
+
// noop
|
15 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/anchored_dot_notation/AnchoredDotNotation.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class AnchoredDotNotation
|
13 |
+
{
|
14 |
+
public $genres = array(
|
15 |
+
array(
|
16 |
+
'name' => 'Punk',
|
17 |
+
'subgenres' => array(
|
18 |
+
array(
|
19 |
+
'name' => 'Hardcore',
|
20 |
+
'subgenres' => array(
|
21 |
+
array(
|
22 |
+
'name' => 'First wave of black metal',
|
23 |
+
'subgenres' => array(
|
24 |
+
array('name' => 'Norwegian black metal'),
|
25 |
+
array(
|
26 |
+
'name' => 'Death metal',
|
27 |
+
'subgenres' => array(
|
28 |
+
array(
|
29 |
+
'name' => 'Swedish death metal',
|
30 |
+
'subgenres' => array(
|
31 |
+
array('name' => 'New wave of American metal'),
|
32 |
+
),
|
33 |
+
),
|
34 |
+
),
|
35 |
+
),
|
36 |
+
),
|
37 |
+
),
|
38 |
+
array(
|
39 |
+
'name' => 'Thrash metal',
|
40 |
+
'subgenres' => array(
|
41 |
+
array('name' => 'Grindcore'),
|
42 |
+
array(
|
43 |
+
'name' => 'Metalcore',
|
44 |
+
'subgenres' => array(
|
45 |
+
array('name' => 'Nu metal'),
|
46 |
+
),
|
47 |
+
),
|
48 |
+
),
|
49 |
+
),
|
50 |
+
),
|
51 |
+
),
|
52 |
+
),
|
53 |
+
),
|
54 |
+
);
|
55 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/anchored_dot_notation/anchored_dot_notation.mustache
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
{{% ANCHORED-DOT }}
|
2 |
+
{{# genres }}
|
3 |
+
{{> genre }}
|
4 |
+
{{/ genres }}
|
vendor/mustache/mustache/test/fixtures/examples/anchored_dot_notation/anchored_dot_notation.txt
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
- Punk
|
2 |
+
- Hardcore
|
3 |
+
- First wave of black metal
|
4 |
+
- Norwegian black metal
|
5 |
+
- Death metal
|
6 |
+
- Swedish death metal
|
7 |
+
- New wave of American metal
|
8 |
+
- Thrash metal
|
9 |
+
- Grindcore
|
10 |
+
- Metalcore
|
11 |
+
- Nu metal
|
vendor/mustache/mustache/test/fixtures/examples/anchored_dot_notation/partials/genre.mustache
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{% ANCHORED-DOT }}
|
2 |
+
- {{ name }}
|
3 |
+
{{# .subgenres }}
|
4 |
+
{{> genre }}
|
5 |
+
{{/ .subgenres }}
|
vendor/mustache/mustache/test/fixtures/examples/blocks/Blocks.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Blocks
|
13 |
+
{
|
14 |
+
public $items = array(1, 2, 3);
|
15 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/blocks/blocks.mustache
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
{{% BLOCKS }}
|
2 |
+
{{< parent }}
|
3 |
+
{{$ value }}[{{ . }}]{{/ value }}
|
4 |
+
{{/ parent }}
|
vendor/mustache/mustache/test/fixtures/examples/blocks/blocks.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
[1]
|
2 |
+
[2]
|
3 |
+
[3]
|
vendor/mustache/mustache/test/fixtures/examples/blocks/partials/parent.mustache
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
{{% BLOCKS }}
|
2 |
+
{{# items }}
|
3 |
+
{{$ value }}ignored{{/ value }}
|
4 |
+
{{/ items }}
|
vendor/mustache/mustache/test/fixtures/examples/child_context/ChildContext.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class ChildContext
|
13 |
+
{
|
14 |
+
public $parent = array(
|
15 |
+
'child' => 'child works',
|
16 |
+
);
|
17 |
+
|
18 |
+
public $grandparent = array(
|
19 |
+
'parent' => array(
|
20 |
+
'child' => 'grandchild works',
|
21 |
+
),
|
22 |
+
);
|
23 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/child_context/child_context.mustache
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<h1>{{#parent}}{{child}}{{/parent}}</h1>
|
2 |
+
<h2>{{#grandparent}}{{#parent}}{{child}}{{/parent}}{{/grandparent}}</h2>
|
vendor/mustache/mustache/test/fixtures/examples/child_context/child_context.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
<h1>child works</h1>
|
2 |
+
<h2>grandchild works</h2>
|
vendor/mustache/mustache/test/fixtures/examples/comments/Comments.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Comments
|
13 |
+
{
|
14 |
+
public function title()
|
15 |
+
{
|
16 |
+
return 'A Comedy of Errors';
|
17 |
+
}
|
18 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/comments/comments.mustache
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<h1>{{title}}{{! just something interesting... #or ^not... }}</h1>
|
vendor/mustache/mustache/test/fixtures/examples/comments/comments.txt
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<h1>A Comedy of Errors</h1>
|
vendor/mustache/mustache/test/fixtures/examples/complex/complex.mustache
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h1>{{header}}</h1>
|
2 |
+
{{#notEmpty}}
|
3 |
+
<ul>
|
4 |
+
{{#item}}
|
5 |
+
{{#current}}
|
6 |
+
<li><strong>{{name}}</strong></li>
|
7 |
+
{{/current}}
|
8 |
+
{{^current}}
|
9 |
+
<li><a href="{{url}}">{{name}}</a></li>
|
10 |
+
{{/current}}
|
11 |
+
{{/item}}
|
12 |
+
</ul>
|
13 |
+
{{/notEmpty}}
|
14 |
+
{{#isEmpty}}
|
15 |
+
<p>The list is empty.</p>
|
16 |
+
{{/isEmpty}}
|
vendor/mustache/mustache/test/fixtures/examples/complex/complex.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Complex
|
13 |
+
{
|
14 |
+
public $header = 'Colors';
|
15 |
+
|
16 |
+
public $item = array(
|
17 |
+
array('name' => 'red', 'current' => true, 'url' => '#Red'),
|
18 |
+
array('name' => 'green', 'current' => false, 'url' => '#Green'),
|
19 |
+
array('name' => 'blue', 'current' => false, 'url' => '#Blue'),
|
20 |
+
);
|
21 |
+
|
22 |
+
public function notEmpty()
|
23 |
+
{
|
24 |
+
return !($this->isEmpty());
|
25 |
+
}
|
26 |
+
|
27 |
+
public function isEmpty()
|
28 |
+
{
|
29 |
+
return count($this->item) === 0;
|
30 |
+
}
|
31 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/complex/complex.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h1>Colors</h1>
|
2 |
+
<ul>
|
3 |
+
<li><strong>red</strong></li>
|
4 |
+
<li><a href="#Green">green</a></li>
|
5 |
+
<li><a href="#Blue">blue</a></li>
|
6 |
+
</ul>
|
vendor/mustache/mustache/test/fixtures/examples/delimiters/Delimiters.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Delimiters
|
13 |
+
{
|
14 |
+
public $start = 'It worked the first time.';
|
15 |
+
|
16 |
+
public function middle()
|
17 |
+
{
|
18 |
+
return array(
|
19 |
+
array('item' => 'And it worked the second time.'),
|
20 |
+
array('item' => 'As well as the third.'),
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
public $final = 'Then, surprisingly, it worked the final time.';
|
25 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/delimiters/delimiters.mustache
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{=<% %>=}}
|
2 |
+
* <% start %>
|
3 |
+
<%=| |=%>
|
4 |
+
|# middle |
|
5 |
+
* | item |
|
6 |
+
|/ middle |
|
7 |
+
|={{ }}=|
|
8 |
+
* {{ final }}
|
vendor/mustache/mustache/test/fixtures/examples/delimiters/delimiters.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
* It worked the first time.
|
2 |
+
* And it worked the second time.
|
3 |
+
* As well as the third.
|
4 |
+
* Then, surprisingly, it worked the final time.
|
vendor/mustache/mustache/test/fixtures/examples/dot_notation/DotNotation.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class DotNotation
|
13 |
+
{
|
14 |
+
public $person = array(
|
15 |
+
'name' => array('first' => 'Chris', 'last' => 'Firescythe'),
|
16 |
+
'age' => 24,
|
17 |
+
'hometown' => array(
|
18 |
+
'city' => 'Cincinnati',
|
19 |
+
'state' => 'OH',
|
20 |
+
),
|
21 |
+
);
|
22 |
+
|
23 |
+
public $normal = 'Normal';
|
24 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/dot_notation/dot_notation.mustache
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
* {{person.name.first}} {{person.name.last}}
|
2 |
+
* {{person.age}}
|
3 |
+
* {{person.hometown.city}}, {{person.hometown.state}}
|
4 |
+
* {{normal}}
|
vendor/mustache/mustache/test/fixtures/examples/dot_notation/dot_notation.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
* Chris Firescythe
|
2 |
+
* 24
|
3 |
+
* Cincinnati, OH
|
4 |
+
* Normal
|
vendor/mustache/mustache/test/fixtures/examples/double_section/DoubleSection.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class DoubleSection
|
13 |
+
{
|
14 |
+
public function t()
|
15 |
+
{
|
16 |
+
return true;
|
17 |
+
}
|
18 |
+
|
19 |
+
public $two = 'second';
|
20 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/double_section/double_section.mustache
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{#t}}
|
2 |
+
* first
|
3 |
+
{{/t}}
|
4 |
+
* {{two}}
|
5 |
+
{{#t}}
|
6 |
+
* third
|
7 |
+
{{/t}}
|
vendor/mustache/mustache/test/fixtures/examples/double_section/double_section.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
* first
|
2 |
+
* second
|
3 |
+
* third
|
vendor/mustache/mustache/test/fixtures/examples/escaped/Escaped.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Escaped
|
13 |
+
{
|
14 |
+
public $title = '"Bear" > "Shark"';
|
15 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/escaped/escaped.mustache
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<h1>{{title}}</h1>
|
vendor/mustache/mustache/test/fixtures/examples/escaped/escaped.txt
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<h1>"Bear" > "Shark"</h1>
|
vendor/mustache/mustache/test/fixtures/examples/filters/Filters.php
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Filters
|
13 |
+
{
|
14 |
+
public $states = array(
|
15 |
+
'al' => 'Alabama',
|
16 |
+
'ak' => 'Alaska',
|
17 |
+
'az' => 'Arizona',
|
18 |
+
'ar' => 'Arkansas',
|
19 |
+
'ca' => 'California',
|
20 |
+
'co' => 'Colorado',
|
21 |
+
'ct' => 'Connecticut',
|
22 |
+
'de' => 'Delaware',
|
23 |
+
'fl' => 'Florida',
|
24 |
+
'ga' => 'Georgia',
|
25 |
+
'hi' => 'Hawaii',
|
26 |
+
'id' => 'Idaho',
|
27 |
+
'il' => 'Illinois',
|
28 |
+
'in' => 'Indiana',
|
29 |
+
'ia' => 'Iowa',
|
30 |
+
'ks' => 'Kansas',
|
31 |
+
'ky' => 'Kentucky',
|
32 |
+
'la' => 'Louisiana',
|
33 |
+
'me' => 'Maine',
|
34 |
+
'md' => 'Maryland',
|
35 |
+
'ma' => 'Massachusetts',
|
36 |
+
'mi' => 'Michigan',
|
37 |
+
'mn' => 'Minnesota',
|
38 |
+
'ms' => 'Mississippi',
|
39 |
+
'mo' => 'Missouri',
|
40 |
+
'mt' => 'Montana',
|
41 |
+
'ne' => 'Nebraska',
|
42 |
+
'nv' => 'Nevada',
|
43 |
+
'nh' => 'New Hampshire',
|
44 |
+
'nj' => 'New Jersey',
|
45 |
+
'nm' => 'New Mexico',
|
46 |
+
'ny' => 'New York',
|
47 |
+
'nc' => 'North Carolina',
|
48 |
+
'nd' => 'North Dakota',
|
49 |
+
'oh' => 'Ohio',
|
50 |
+
'ok' => 'Oklahoma',
|
51 |
+
'or' => 'Oregon',
|
52 |
+
'pa' => 'Pennsylvania',
|
53 |
+
'ri' => 'Rhode Island',
|
54 |
+
'sc' => 'South Carolina',
|
55 |
+
'sd' => 'South Dakota',
|
56 |
+
'tn' => 'Tennessee',
|
57 |
+
'tx' => 'Texas',
|
58 |
+
'ut' => 'Utah',
|
59 |
+
'vt' => 'Vermont',
|
60 |
+
'va' => 'Virginia',
|
61 |
+
'wa' => 'Washington',
|
62 |
+
'wv' => 'West Virginia',
|
63 |
+
'wi' => 'Wisconsin',
|
64 |
+
'wy' => 'Wyoming',
|
65 |
+
);
|
66 |
+
|
67 |
+
// The next few functions are ugly, because they have to work in PHP 5.2...
|
68 |
+
// for everyone who doesn't have to support 5.2, please, for the love, make
|
69 |
+
// your ViewModel return closures rather than `array($this, '...')`
|
70 |
+
//
|
71 |
+
// :)
|
72 |
+
|
73 |
+
public function upcase()
|
74 |
+
{
|
75 |
+
return array($this, '_upcase');
|
76 |
+
}
|
77 |
+
|
78 |
+
public function _upcase($val)
|
79 |
+
{
|
80 |
+
return strtoupper($val);
|
81 |
+
}
|
82 |
+
|
83 |
+
public function eachPair()
|
84 |
+
{
|
85 |
+
return array($this, '_eachPair');
|
86 |
+
}
|
87 |
+
|
88 |
+
public function _eachPair($val)
|
89 |
+
{
|
90 |
+
$ret = array();
|
91 |
+
foreach ($val as $key => $value) {
|
92 |
+
array_push($ret, compact('key', 'value'));
|
93 |
+
}
|
94 |
+
|
95 |
+
return $ret;
|
96 |
+
}
|
97 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/filters/filters.mustache
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
{{%FILTERS}}
|
2 |
+
{{# states | eachPair }}
|
3 |
+
{{ key | upcase }}: {{ value }}
|
4 |
+
{{/ states }}
|
vendor/mustache/mustache/test/fixtures/examples/filters/filters.txt
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
AL: Alabama
|
2 |
+
AK: Alaska
|
3 |
+
AZ: Arizona
|
4 |
+
AR: Arkansas
|
5 |
+
CA: California
|
6 |
+
CO: Colorado
|
7 |
+
CT: Connecticut
|
8 |
+
DE: Delaware
|
9 |
+
FL: Florida
|
10 |
+
GA: Georgia
|
11 |
+
HI: Hawaii
|
12 |
+
ID: Idaho
|
13 |
+
IL: Illinois
|
14 |
+
IN: Indiana
|
15 |
+
IA: Iowa
|
16 |
+
KS: Kansas
|
17 |
+
KY: Kentucky
|
18 |
+
LA: Louisiana
|
19 |
+
ME: Maine
|
20 |
+
MD: Maryland
|
21 |
+
MA: Massachusetts
|
22 |
+
MI: Michigan
|
23 |
+
MN: Minnesota
|
24 |
+
MS: Mississippi
|
25 |
+
MO: Missouri
|
26 |
+
MT: Montana
|
27 |
+
NE: Nebraska
|
28 |
+
NV: Nevada
|
29 |
+
NH: New Hampshire
|
30 |
+
NJ: New Jersey
|
31 |
+
NM: New Mexico
|
32 |
+
NY: New York
|
33 |
+
NC: North Carolina
|
34 |
+
ND: North Dakota
|
35 |
+
OH: Ohio
|
36 |
+
OK: Oklahoma
|
37 |
+
OR: Oregon
|
38 |
+
PA: Pennsylvania
|
39 |
+
RI: Rhode Island
|
40 |
+
SC: South Carolina
|
41 |
+
SD: South Dakota
|
42 |
+
TN: Tennessee
|
43 |
+
TX: Texas
|
44 |
+
UT: Utah
|
45 |
+
VT: Vermont
|
46 |
+
VA: Virginia
|
47 |
+
WA: Washington
|
48 |
+
WV: West Virginia
|
49 |
+
WI: Wisconsin
|
50 |
+
WY: Wyoming
|
vendor/mustache/mustache/test/fixtures/examples/grand_parent_context/GrandParentContext.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class GrandParentContext
|
13 |
+
{
|
14 |
+
public $grand_parent_id = 'grand_parent1';
|
15 |
+
public $parent_contexts = array();
|
16 |
+
|
17 |
+
public function __construct()
|
18 |
+
{
|
19 |
+
$this->parent_contexts[] = array('parent_id' => 'parent1', 'child_contexts' => array(
|
20 |
+
array('child_id' => 'parent1-child1'),
|
21 |
+
array('child_id' => 'parent1-child2'),
|
22 |
+
));
|
23 |
+
|
24 |
+
$parent2 = new stdClass();
|
25 |
+
$parent2->parent_id = 'parent2';
|
26 |
+
$parent2->child_contexts = array(
|
27 |
+
array('child_id' => 'parent2-child1'),
|
28 |
+
array('child_id' => 'parent2-child2'),
|
29 |
+
);
|
30 |
+
|
31 |
+
$this->parent_contexts[] = $parent2;
|
32 |
+
}
|
33 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/grand_parent_context/grand_parent_context.mustache
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{grand_parent_id}}
|
2 |
+
{{#parent_contexts}}
|
3 |
+
{{parent_id}} ({{grand_parent_id}})
|
4 |
+
{{#child_contexts}}
|
5 |
+
{{child_id}} ({{parent_id}} << {{grand_parent_id}})
|
6 |
+
{{/child_contexts}}
|
7 |
+
{{/parent_contexts}}
|
vendor/mustache/mustache/test/fixtures/examples/grand_parent_context/grand_parent_context.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
grand_parent1
|
2 |
+
parent1 (grand_parent1)
|
3 |
+
parent1-child1 (parent1 << grand_parent1)
|
4 |
+
parent1-child2 (parent1 << grand_parent1)
|
5 |
+
parent2 (grand_parent1)
|
6 |
+
parent2-child1 (parent2 << grand_parent1)
|
7 |
+
parent2-child2 (parent2 << grand_parent1)
|
vendor/mustache/mustache/test/fixtures/examples/i18n/I18n.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class I18n
|
13 |
+
{
|
14 |
+
// Variable to be interpolated
|
15 |
+
public $name = 'Bob';
|
16 |
+
|
17 |
+
// Add a {{#__}} lambda for i18n
|
18 |
+
public $__ = array(__CLASS__, '__trans');
|
19 |
+
|
20 |
+
// A *very* small i18n dictionary :)
|
21 |
+
private static $dictionary = array(
|
22 |
+
'Hello.' => 'Hola.',
|
23 |
+
'My name is {{ name }}.' => 'Me llamo {{ name }}.',
|
24 |
+
);
|
25 |
+
|
26 |
+
public static function __trans($text)
|
27 |
+
{
|
28 |
+
return isset(self::$dictionary[$text]) ? self::$dictionary[$text] : $text;
|
29 |
+
}
|
30 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/i18n/i18n.mustache
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
{{#__}}Hello.{{/__}} {{#__}}My name is {{ name }}.{{/__}}
|
vendor/mustache/mustache/test/fixtures/examples/i18n/i18n.txt
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
Hola. Me llamo Bob.
|
vendor/mustache/mustache/test/fixtures/examples/implicit_iterator/ImplicitIterator.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class ImplicitIterator
|
13 |
+
{
|
14 |
+
public $data = array('Donkey Kong', 'Luigi', 'Mario', 'Peach', 'Yoshi');
|
15 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/implicit_iterator/implicit_iterator.mustache
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
{{#data}}
|
2 |
+
* {{.}}
|
3 |
+
{{/data}}
|
vendor/mustache/mustache/test/fixtures/examples/implicit_iterator/implicit_iterator.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
* Donkey Kong
|
2 |
+
* Luigi
|
3 |
+
* Mario
|
4 |
+
* Peach
|
5 |
+
* Yoshi
|
vendor/mustache/mustache/test/fixtures/examples/inverted_double_section/InvertedDoubleSection.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class InvertedDoubleSection
|
13 |
+
{
|
14 |
+
public $t = false;
|
15 |
+
public $two = 'second';
|
16 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/inverted_double_section/inverted_double_section.mustache
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{^t}}
|
2 |
+
* first
|
3 |
+
{{/t}}
|
4 |
+
* {{two}}
|
5 |
+
{{^t}}
|
6 |
+
* third
|
7 |
+
{{/t}}
|
vendor/mustache/mustache/test/fixtures/examples/inverted_double_section/inverted_double_section.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
* first
|
2 |
+
* second
|
3 |
+
* third
|
vendor/mustache/mustache/test/fixtures/examples/inverted_section/InvertedSection.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class InvertedSection
|
13 |
+
{
|
14 |
+
public $repo = array();
|
15 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/inverted_section/inverted_section.mustache
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{#repo}}
|
2 |
+
<b>{{name}}</b>
|
3 |
+
{{/repo}}
|
4 |
+
{{^repo}}
|
5 |
+
No repos :(
|
6 |
+
{{/repo}}
|
vendor/mustache/mustache/test/fixtures/examples/inverted_section/inverted_section.txt
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
No repos :(
|
vendor/mustache/mustache/test/fixtures/examples/nested_partials/NestedPartials.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class NestedPartials
|
13 |
+
{
|
14 |
+
public $val = 'FOURTH!';
|
15 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/nested_partials/nested_partials.mustache
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<first>
|
2 |
+
{{> second }}
|
3 |
+
</first>
|
vendor/mustache/mustache/test/fixtures/examples/nested_partials/nested_partials.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<first>
|
2 |
+
<second>
|
3 |
+
<third>
|
4 |
+
FOURTH!
|
5 |
+
</third>
|
6 |
+
</second>
|
7 |
+
</first>
|
vendor/mustache/mustache/test/fixtures/examples/nested_partials/partials/fourth.mustache
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
{{ val }}
|
vendor/mustache/mustache/test/fixtures/examples/nested_partials/partials/second.mustache
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<second>
|
2 |
+
{{> third }}
|
3 |
+
</second>
|
vendor/mustache/mustache/test/fixtures/examples/nested_partials/partials/third.mustache
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<third>
|
2 |
+
{{> fourth }}
|
3 |
+
</third>
|
vendor/mustache/mustache/test/fixtures/examples/partials/Partials.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Partials
|
13 |
+
{
|
14 |
+
public $page = array(
|
15 |
+
'title' => 'Page Title',
|
16 |
+
'subtitle' => 'Page Subtitle',
|
17 |
+
'content' => 'Lorem ipsum dolor sit amet.',
|
18 |
+
);
|
19 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/partials/partials.mustache
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div>
|
2 |
+
{{> header }}
|
3 |
+
|
4 |
+
<div>
|
5 |
+
{{ page.content }}
|
6 |
+
</div>
|
7 |
+
</div>
|
vendor/mustache/mustache/test/fixtures/examples/partials/partials.txt
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div>
|
2 |
+
<h1>Page Title</h1>
|
3 |
+
<h2>Page Subtitle</h2>
|
4 |
+
|
5 |
+
<div>
|
6 |
+
Lorem ipsum dolor sit amet.
|
7 |
+
</div>
|
8 |
+
</div>
|
vendor/mustache/mustache/test/fixtures/examples/partials/partials/header.mustache
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
{{# page }}
|
2 |
+
<h1>{{ title }}</h1>
|
3 |
+
<h2>{{ subtitle }}</h2>
|
4 |
+
{{/ page }}
|
vendor/mustache/mustache/test/fixtures/examples/recursive_partials/RecursivePartials.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class RecursivePartials
|
13 |
+
{
|
14 |
+
public $name = 'George';
|
15 |
+
public $child = array(
|
16 |
+
'name' => 'Dan',
|
17 |
+
'child' => array(
|
18 |
+
'name' => 'Justin',
|
19 |
+
'child' => false,
|
20 |
+
),
|
21 |
+
);
|
22 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/recursive_partials/partials/child.mustache
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
> {{ name }}{{#child}}{{>child}}{{/child}}
|
vendor/mustache/mustache/test/fixtures/examples/recursive_partials/recursive_partials.mustache
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
{{name}}{{#child}}{{>child}}{{/child}}
|
vendor/mustache/mustache/test/fixtures/examples/recursive_partials/recursive_partials.txt
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
George > Dan > Justin
|
vendor/mustache/mustache/test/fixtures/examples/section_iterator_objects/SectionIteratorObjects.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class SectionIteratorObjects
|
13 |
+
{
|
14 |
+
public $start = 'It worked the first time.';
|
15 |
+
|
16 |
+
protected $_data = array(
|
17 |
+
array('item' => 'And it worked the second time.'),
|
18 |
+
array('item' => 'As well as the third.'),
|
19 |
+
);
|
20 |
+
|
21 |
+
public function middle()
|
22 |
+
{
|
23 |
+
return new ArrayIterator($this->_data);
|
24 |
+
}
|
25 |
+
|
26 |
+
public $final = 'Then, surprisingly, it worked the final time.';
|
27 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/section_iterator_objects/section_iterator_objects.mustache
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
* {{ start }}
|
2 |
+
{{# middle }}
|
3 |
+
* {{ item }}
|
4 |
+
{{/ middle }}
|
5 |
+
* {{ final }}
|
vendor/mustache/mustache/test/fixtures/examples/section_iterator_objects/section_iterator_objects.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
* It worked the first time.
|
2 |
+
* And it worked the second time.
|
3 |
+
* As well as the third.
|
4 |
+
* Then, surprisingly, it worked the final time.
|
vendor/mustache/mustache/test/fixtures/examples/section_magic_objects/SectionMagicObjects.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class SectionMagicObjects
|
13 |
+
{
|
14 |
+
public $start = 'It worked the first time.';
|
15 |
+
|
16 |
+
public function middle()
|
17 |
+
{
|
18 |
+
return new MagicObject();
|
19 |
+
}
|
20 |
+
|
21 |
+
public $final = 'Then, surprisingly, it worked the final time.';
|
22 |
+
}
|
23 |
+
|
24 |
+
class MagicObject
|
25 |
+
{
|
26 |
+
protected $_data = array(
|
27 |
+
'foo' => 'And it worked the second time.',
|
28 |
+
'bar' => 'As well as the third.',
|
29 |
+
);
|
30 |
+
|
31 |
+
public function __get($key)
|
32 |
+
{
|
33 |
+
return isset($this->_data[$key]) ? $this->_data[$key] : null;
|
34 |
+
}
|
35 |
+
|
36 |
+
public function __isset($key)
|
37 |
+
{
|
38 |
+
return isset($this->_data[$key]);
|
39 |
+
}
|
40 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/section_magic_objects/section_magic_objects.mustache
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
* {{ start }}
|
2 |
+
{{# middle }}
|
3 |
+
* {{ foo }}
|
4 |
+
* {{ bar }}
|
5 |
+
{{/ middle }}
|
6 |
+
* {{ final }}
|
vendor/mustache/mustache/test/fixtures/examples/section_magic_objects/section_magic_objects.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
* It worked the first time.
|
2 |
+
* And it worked the second time.
|
3 |
+
* As well as the third.
|
4 |
+
* Then, surprisingly, it worked the final time.
|
vendor/mustache/mustache/test/fixtures/examples/section_objects/SectionObjects.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class SectionObjects
|
13 |
+
{
|
14 |
+
public $start = 'It worked the first time.';
|
15 |
+
|
16 |
+
public function middle()
|
17 |
+
{
|
18 |
+
return new SectionObject();
|
19 |
+
}
|
20 |
+
|
21 |
+
public $final = 'Then, surprisingly, it worked the final time.';
|
22 |
+
}
|
23 |
+
|
24 |
+
class SectionObject
|
25 |
+
{
|
26 |
+
public $foo = 'And it worked the second time.';
|
27 |
+
public $bar = 'As well as the third.';
|
28 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/section_objects/section_objects.mustache
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
* {{ start }}
|
2 |
+
{{# middle }}
|
3 |
+
* {{ foo }}
|
4 |
+
* {{ bar }}
|
5 |
+
{{/ middle }}
|
6 |
+
* {{ final }}
|
vendor/mustache/mustache/test/fixtures/examples/section_objects/section_objects.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
* It worked the first time.
|
2 |
+
* And it worked the second time.
|
3 |
+
* As well as the third.
|
4 |
+
* Then, surprisingly, it worked the final time.
|
vendor/mustache/mustache/test/fixtures/examples/sections/Sections.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Sections
|
13 |
+
{
|
14 |
+
public $start = 'It worked the first time.';
|
15 |
+
|
16 |
+
public function middle()
|
17 |
+
{
|
18 |
+
return array(
|
19 |
+
array('item' => 'And it worked the second time.'),
|
20 |
+
array('item' => 'As well as the third.'),
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
public $final = 'Then, surprisingly, it worked the final time.';
|
25 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/sections/sections.mustache
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
* {{ start }}
|
2 |
+
{{# middle }}
|
3 |
+
* {{ item }}
|
4 |
+
{{/ middle }}
|
5 |
+
* {{ final }}
|
vendor/mustache/mustache/test/fixtures/examples/sections/sections.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
* It worked the first time.
|
2 |
+
* And it worked the second time.
|
3 |
+
* As well as the third.
|
4 |
+
* Then, surprisingly, it worked the final time.
|
vendor/mustache/mustache/test/fixtures/examples/sections_nested/SectionsNested.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class SectionsNested
|
13 |
+
{
|
14 |
+
public $name = 'Little Mac';
|
15 |
+
|
16 |
+
public function enemies()
|
17 |
+
{
|
18 |
+
return array(
|
19 |
+
array(
|
20 |
+
'name' => 'Von Kaiser',
|
21 |
+
'enemies' => array(
|
22 |
+
array('name' => 'Super Macho Man'),
|
23 |
+
array('name' => 'Piston Honda'),
|
24 |
+
array('name' => 'Mr. Sandman'),
|
25 |
+
),
|
26 |
+
),
|
27 |
+
array(
|
28 |
+
'name' => 'Mike Tyson',
|
29 |
+
'enemies' => array(
|
30 |
+
array('name' => 'Soda Popinski'),
|
31 |
+
array('name' => 'King Hippo'),
|
32 |
+
array('name' => 'Great Tiger'),
|
33 |
+
array('name' => 'Glass Joe'),
|
34 |
+
),
|
35 |
+
),
|
36 |
+
array(
|
37 |
+
'name' => 'Don Flamenco',
|
38 |
+
'enemies' => array(
|
39 |
+
array('name' => 'Bald Bull'),
|
40 |
+
),
|
41 |
+
),
|
42 |
+
);
|
43 |
+
}
|
44 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/sections_nested/sections_nested.mustache
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Enemies of {{ name }}:
|
2 |
+
{{# enemies }}
|
3 |
+
{{ name }} ... who also has enemies:
|
4 |
+
{{# enemies }}
|
5 |
+
--> {{ name }}
|
6 |
+
{{/ enemies }}
|
7 |
+
{{/ enemies }}
|
vendor/mustache/mustache/test/fixtures/examples/sections_nested/sections_nested.txt
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Enemies of Little Mac:
|
2 |
+
Von Kaiser ... who also has enemies:
|
3 |
+
--> Super Macho Man
|
4 |
+
--> Piston Honda
|
5 |
+
--> Mr. Sandman
|
6 |
+
Mike Tyson ... who also has enemies:
|
7 |
+
--> Soda Popinski
|
8 |
+
--> King Hippo
|
9 |
+
--> Great Tiger
|
10 |
+
--> Glass Joe
|
11 |
+
Don Flamenco ... who also has enemies:
|
12 |
+
--> Bald Bull
|
vendor/mustache/mustache/test/fixtures/examples/simple/Simple.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Simple
|
13 |
+
{
|
14 |
+
public $name = 'Chris';
|
15 |
+
public $value = 10000;
|
16 |
+
|
17 |
+
public function taxed_value()
|
18 |
+
{
|
19 |
+
return $this->value - ($this->value * 0.4);
|
20 |
+
}
|
21 |
+
|
22 |
+
public $in_ca = true;
|
23 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/simple/simple.mustache
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Hello {{name}}
|
2 |
+
You have just won ${{value}}!
|
3 |
+
{{#in_ca}}
|
4 |
+
Well, ${{ taxed_value }}, after taxes.
|
5 |
+
{{/in_ca}}
|
vendor/mustache/mustache/test/fixtures/examples/simple/simple.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
Hello Chris
|
2 |
+
You have just won $10000!
|
3 |
+
Well, $6000, after taxes.
|
vendor/mustache/mustache/test/fixtures/examples/unescaped/Unescaped.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class Unescaped
|
13 |
+
{
|
14 |
+
public $title = 'Bear > Shark';
|
15 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/unescaped/unescaped.mustache
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<h1>{{{title}}}</h1>
|
vendor/mustache/mustache/test/fixtures/examples/unescaped/unescaped.txt
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<h1>Bear > Shark</h1>
|
vendor/mustache/mustache/test/fixtures/examples/utf8/UTF8.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class UTF8
|
13 |
+
{
|
14 |
+
public $test = '中文又来啦';
|
15 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/utf8/utf8.mustache
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<h1>中文 {{test}}</h1>
|
vendor/mustache/mustache/test/fixtures/examples/utf8/utf8.txt
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<h1>中文 中文又来啦</h1>
|
vendor/mustache/mustache/test/fixtures/examples/utf8_unescaped/UTF8Unescaped.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
class UTF8Unescaped
|
13 |
+
{
|
14 |
+
public $test = '中文又来啦';
|
15 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/utf8_unescaped/utf8_unescaped.mustache
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<h1>中文 {{{test}}}</h1>
|
vendor/mustache/mustache/test/fixtures/examples/utf8_unescaped/utf8_unescaped.txt
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<h1>中文 中文又来啦</h1>
|
vendor/mustache/mustache/test/fixtures/examples/whitespace/Whitespace.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Whitespace test for tag names.
|
14 |
+
*
|
15 |
+
* Per http://github.com/janl/mustache.js/issues/issue/34/#comment_244396
|
16 |
+
* tags should strip leading and trailing whitespace in key names.
|
17 |
+
*
|
18 |
+
* `{{> tag }}` and `{{> tag}}` and `{{>tag}}` should all be equivalent.
|
19 |
+
*/
|
20 |
+
class Whitespace
|
21 |
+
{
|
22 |
+
public $foo = 'alpha';
|
23 |
+
|
24 |
+
public $bar = 'beta';
|
25 |
+
|
26 |
+
public function baz()
|
27 |
+
{
|
28 |
+
return 'gamma';
|
29 |
+
}
|
30 |
+
|
31 |
+
public function qux()
|
32 |
+
{
|
33 |
+
return array(
|
34 |
+
array('key with space' => 'A'),
|
35 |
+
array('key with space' => 'B'),
|
36 |
+
array('key with space' => 'C'),
|
37 |
+
array('key with space' => 'D'),
|
38 |
+
array('key with space' => 'E'),
|
39 |
+
array('key with space' => 'F'),
|
40 |
+
array('key with space' => 'G'),
|
41 |
+
);
|
42 |
+
}
|
43 |
+
}
|
vendor/mustache/mustache/test/fixtures/examples/whitespace/partials/alphabet.mustache
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
* {{.}}
|
vendor/mustache/mustache/test/fixtures/examples/whitespace/whitespace.mustache
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{{^ inverted section test }}
|
2 |
+
These are some things:
|
3 |
+
{{/inverted section test }}
|
4 |
+
* {{ foo }}
|
5 |
+
* {{ bar}}
|
6 |
+
* {{ baz }}
|
7 |
+
{{# qux }}
|
8 |
+
* {{ key with space }}
|
9 |
+
{{/ qux }}
|
10 |
+
{{#qux}}.{{/qux}}
|
vendor/mustache/mustache/test/fixtures/examples/whitespace/whitespace.txt
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
These are some things:
|
2 |
+
* alpha
|
3 |
+
* beta
|
4 |
+
* gamma
|
5 |
+
* A
|
6 |
+
* B
|
7 |
+
* C
|
8 |
+
* D
|
9 |
+
* E
|
10 |
+
* F
|
11 |
+
* G
|
12 |
+
.......
|
vendor/mustache/mustache/test/fixtures/templates/alpha.ms
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
alpha contents
|
vendor/mustache/mustache/test/fixtures/templates/beta.ms
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
beta contents
|
vendor/mustache/mustache/test/fixtures/templates/one.mustache
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
one contents
|
vendor/mustache/mustache/test/fixtures/templates/two.mustache
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
two contents
|
aalb_admin_item_search_items.php → view/partials/admin_item_search_items.php
RENAMED
@@ -1,4 +1,5 @@
|
|
1 |
-
|
|
|
2 |
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
@@ -8,8 +9,8 @@ A copy of the License is located in the "license" file accompanying this file.
|
|
8 |
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
9 |
either express or implied. See the License for the specific language governing permissions
|
10 |
and limitations under the License.
|
11 |
-
|
12 |
-
|
13 |
?>
|
14 |
|
15 |
<script id="aalb-hbs-admin-items-search" type="text/x-handlebars-template">
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
9 |
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
either express or implied. See the License for the specific language governing permissions
|
11 |
and limitations under the License.
|
12 |
+
*/
|
13 |
+
namespace AmazonAssociatesLinkBuilder\admin\partials;
|
14 |
?>
|
15 |
|
16 |
<script id="aalb-hbs-admin-items-search" type="text/x-handlebars-template">
|
admin/partials/aalb_editor_search_box.php → view/partials/editor_search_box.php
RENAMED
@@ -1,4 +1,5 @@
|
|
1 |
-
|
|
|
2 |
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
@@ -9,11 +10,12 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
9 |
either express or implied. See the License for the specific language governing permissions
|
10 |
and limitations under the License.
|
11 |
*/
|
12 |
-
|
|
|
|
|
13 |
|
14 |
-
<?php
|
15 |
$aalb_settings_page_url = admin_url( 'admin.php?page=associates-link-builder-settings' );
|
16 |
-
$aalb_admin = new
|
17 |
$aalb_admin->aalb_enqueue_styles();
|
18 |
$aalb_admin->aalb_enqueue_scripts();
|
19 |
?>
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
10 |
either express or implied. See the License for the specific language governing permissions
|
11 |
and limitations under the License.
|
12 |
*/
|
13 |
+
namespace AmazonAssociatesLinkBuilder\view\partials;
|
14 |
+
|
15 |
+
use AmazonAssociatesLinkBuilder\admin\Plugin_Admin;
|
16 |
|
|
|
17 |
$aalb_settings_page_url = admin_url( 'admin.php?page=associates-link-builder-settings' );
|
18 |
+
$aalb_admin = new Plugin_Admin();
|
19 |
$aalb_admin->aalb_enqueue_styles();
|
20 |
$aalb_admin->aalb_enqueue_scripts();
|
21 |
?>
|
admin/partials/aalb_meta_box.php → view/partials/meta_box.php
RENAMED
@@ -12,6 +12,13 @@ either express or implied. See the License for the specific language governing p
|
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
/**
|
16 |
* UI for Add short code popup. responsible to show list of products items based on the keywords.
|
17 |
* This Metabox enables users to choose template, Associate ID and Market place for which product is being added based on the
|
@@ -19,10 +26,7 @@ and limitations under the License.
|
|
19 |
*/
|
20 |
|
21 |
// HandleBar template
|
22 |
-
|
23 |
-
include 'aalb_meta_box_tab_content.php';
|
24 |
-
include 'aalb_admin_pop_up_content_hbs.php';
|
25 |
-
$aalb_admin = new Aalb_Admin();
|
26 |
|
27 |
/*
|
28 |
* Below is an example of context to be passed to the below template
|
@@ -73,44 +77,42 @@ $aalb_admin = new Aalb_Admin();
|
|
73 |
*/
|
74 |
|
75 |
?>
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
</div>
|
99 |
</div>
|
|
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
</div>
|
110 |
</div>
|
111 |
</div>
|
112 |
-
</
|
113 |
-
</
|
114 |
</div>
|
115 |
-
|
116 |
-
?>
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
15 |
+
namespace AmazonAssociatesLinkBuilder\admin\partials;
|
16 |
+
include AALB_ADMIN_ITEM_SEARCH_ITEMS_PATH;
|
17 |
+
include 'meta_box_tab_content.php';
|
18 |
+
include 'pop_up_content_hbs.php';
|
19 |
+
|
20 |
+
use AmazonAssociatesLinkBuilder\admin\Plugin_Admin;
|
21 |
+
|
22 |
/**
|
23 |
* UI for Add short code popup. responsible to show list of products items based on the keywords.
|
24 |
* This Metabox enables users to choose template, Associate ID and Market place for which product is being added based on the
|
26 |
*/
|
27 |
|
28 |
// HandleBar template
|
29 |
+
$aalb_admin = new Plugin_Admin();
|
|
|
|
|
|
|
30 |
|
31 |
/*
|
32 |
* Below is an example of context to be passed to the below template
|
77 |
*/
|
78 |
|
79 |
?>
|
80 |
+
<!-- keeping css inline as css file does not load at plugin initialization -->
|
81 |
+
<div id="aalb-admin-popup-container" style="display:none;">
|
82 |
+
<div id="aalb-admin-pop-up">
|
83 |
+
<script id="aalb-search-pop-up-hbs" type="text/x-handlebars-template">
|
84 |
+
<div id="aalb-search-pop-up">
|
85 |
+
<div class="aalb-admin-item-search-templates">
|
86 |
+
<label class="aalb-templates-label" title="{{templates_help_content}}">{{ad_template_label}}<i class="fa fa-info-circle aalb-info-icon" aria-hidden="true"></i></label>
|
87 |
+
<select id="aalb_template_names_list" name="aalb_template_names_list">
|
88 |
+
{{#each templates_list}}
|
89 |
+
<option value="{{this}}" {{selected this ..
|
90 |
+
/default_template}} {{this}}>{{this}}</option>
|
91 |
+
{{/each}}
|
92 |
+
</select>
|
93 |
+
</div>
|
94 |
|
95 |
+
<div id="aalb-tabs" class="aalb-pop-up-tabs">
|
96 |
+
<ul>
|
97 |
+
<li><a href="#aalb_tab1">{{meta_box_tab_context.default_marketplace}}</a></li>
|
98 |
+
</ul>
|
99 |
|
100 |
+
<div id="aalb_tab1">
|
101 |
+
{{> aalb-metabox-tab-hbs meta_box_tab_context}}
|
|
|
102 |
</div>
|
103 |
+
</div>
|
104 |
|
105 |
+
<div class="aalb-add-shortcode-button">
|
106 |
+
<button class="aalb-btn aalb-btn-primary" id="aalb-add-shortcode-button" type="button">{{add_shortcode_button_label}}</button>
|
107 |
+
<div id="aalb-add-shortcode-alert">
|
108 |
+
<div class="aalb-admin-icon"><i class="fa fa-spinner fa-pulse"></i></div>
|
109 |
+
{{text_shown_during_shortcode_creation}}
|
110 |
+
</div>
|
111 |
+
<div id="aalb-add-asin-error">
|
112 |
+
<div id="aalb-add-template-asin-error"></div>
|
|
|
113 |
</div>
|
114 |
</div>
|
115 |
+
</div>
|
116 |
+
</script>
|
117 |
</div>
|
118 |
+
</div>
|
|
admin/partials/aalb_meta_box_tab_content.php → view/partials/meta_box_tab_content.php
RENAMED
@@ -1,4 +1,5 @@
|
|
1 |
-
|
|
|
2 |
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
@@ -8,8 +9,9 @@ A copy of the License is located in the "license" file accompanying this file.
|
|
8 |
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
9 |
either express or implied. See the License for the specific language governing permissions
|
10 |
and limitations under the License.
|
11 |
-
|
12 |
-
|
|
|
13 |
/*
|
14 |
* Below is an example of context to be passed to the below template
|
15 |
*
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
9 |
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
either express or implied. See the License for the specific language governing permissions
|
11 |
and limitations under the License.
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace AmazonAssociatesLinkBuilder\view\partials;
|
15 |
/*
|
16 |
* Below is an example of context to be passed to the below template
|
17 |
*
|
admin/partials/aalb_admin_pop_up_content_hbs.php → view/partials/pop_up_content_hbs.php
RENAMED
@@ -1,4 +1,5 @@
|
|
1 |
-
|
|
|
2 |
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
@@ -8,8 +9,9 @@ A copy of the License is located in the "license" file accompanying this file.
|
|
8 |
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
9 |
either express or implied. See the License for the specific language governing permissions
|
10 |
and limitations under the License.
|
11 |
-
|
12 |
-
|
|
|
13 |
/*
|
14 |
* Below is an example of context to be passed to the below template
|
15 |
*
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
9 |
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
either express or implied. See the License for the specific language governing permissions
|
11 |
and limitations under the License.
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace AmazonAssociatesLinkBuilder\view\partials;
|
15 |
/*
|
16 |
* Below is an example of context to be passed to the below template
|
17 |
*
|
admin/sidebar/partials/aalb_about.php → view/sidebar_partials/about.php
RENAMED
@@ -11,15 +11,19 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
14 |
|
15 |
-
|
|
|
|
|
|
|
16 |
<div class="wrap">
|
17 |
-
<h2><?php esc_html_e("Associates Link Builder",'amazon-associates-link-builder'); ?></h2>
|
18 |
<div class="card" style="max-width:100%;">
|
19 |
<h2><?php esc_html_e( "About Amazon Associates Program", 'amazon-associates-link-builder' ); ?></h2>
|
20 |
<p>
|
21 |
<?php /* translators: 1: URL of affiliate website 2: _blank */
|
22 |
-
printf( __( "The Amazon Associates Program is one of the original affiliate marketing programs. Available in geographies across the globe, the Amazon Associates Program has been partnering with content creators to help them monetize their passions since 1996. To learn more about the Amazon Associates Program, please click <a href=%1s target=%2s >here</a>.", 'amazon-associates-link-builder' ),
|
23 |
</p>
|
24 |
<h2><?php esc_html_e( "About Amazon Associates Link Builder", 'amazon-associates-link-builder' ); ?> </h2>
|
25 |
<p>
|
@@ -29,7 +33,7 @@ include 'aalb_admin_ui_common.php'; ?>
|
|
29 |
<ul>
|
30 |
<li>
|
31 |
<?php /* translators: 1: URL of Condition of Use page 2: _blank */
|
32 |
-
printf( __( "You must review and accept the Amazon Associates Link Builder <a href=%1s target=%2s>Conditions of Use.</a>", 'amazon-associates-link-builder' ),
|
33 |
</li>
|
34 |
<li>
|
35 |
<?php esc_html_e( "The plugin is currently in beta form. We intend to regularly add new features and enhancements throughout the beta period and beyond, and welcome your feedback and input.", 'amazon-associates-link-builder' ); ?>
|
@@ -41,6 +45,12 @@ include 'aalb_admin_ui_common.php'; ?>
|
|
41 |
<?php esc_html_e( "To become an Associate, create an Amazon Associates account using URL for your country:", 'amazon-associates-link-builder' ); ?>
|
42 |
</p>
|
43 |
<table border="0" cellpadding="10">
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
<tr>
|
45 |
<td><b><?php esc_html_e( "Brazil", 'amazon-associates-link-builder' ); ?></b></td>
|
46 |
<td>
|
@@ -120,7 +130,7 @@ include 'aalb_admin_ui_common.php'; ?>
|
|
120 |
<h3><?php esc_html_e( "Step 2 - Sign up for the Amazon Product Advertising API", 'amazon-associates-link-builder' ); ?></h3>
|
121 |
<p>
|
122 |
<?php /* translators: 1: URL of Getting Started page 2: _blank */
|
123 |
-
printf( __( "Sign up for the Amazon Product Advertising API by following the instructions listed <a href=%1s target=%2s>here</a>. The Amazon Product Advertising API is a popular e-commerce service, powering Amazon-integrated experiences around the world, serving tens of thousands of applications and more than 1 billion API requests every day. It exposes a web-service, which allows Associates to programmatically search and look up items in the Amazon product catalog. The Link Builder plugin integrates the Product Advertising API, allowing you to access Amazon.com product catalog data without requiring additional software development.", 'amazon-associates-link-builder' ),
|
124 |
</p>
|
125 |
<h3><?php esc_html_e( "Step 3 - Configure plugin for first use", 'amazon-associates-link-builder' ); ?></h3>
|
126 |
<p>
|
@@ -140,12 +150,12 @@ include 'aalb_admin_ui_common.php'; ?>
|
|
140 |
<h2><?php esc_html_e( "User Guide", 'amazon-associates-link-builder' ); ?></h2>
|
141 |
<p>
|
142 |
<?php /* translators: 1: URL of Link Builder User Guide 2: _blank */
|
143 |
-
printf( __( "Review <a href=%1s target=%2s >Link Builder User Guide</a> for more information on getting started and key features of the plugin.", 'amazon-associates-link-builder' ),
|
144 |
</p>
|
145 |
<h2><?php esc_html_e( "Support", 'amazon-associates-link-builder' ); ?></h2>
|
146 |
<p>
|
147 |
<?php /* translators: 1: URL of Plugin's Support Forum 2: _blank */
|
148 |
-
printf( __( "If you get stuck, or have any questions, you can ask for help in the <a href=%1s target=%2s>Amazon Associates Link Builder plugin forum</a>.", 'amazon-associates-link-builder' ),
|
149 |
</p>
|
150 |
</div>
|
151 |
</div>
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\view\sidebar_partials;
|
15 |
|
16 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Urls;
|
18 |
+
|
19 |
+
include 'admin_ui_common.php'; ?>
|
20 |
<div class="wrap">
|
21 |
+
<h2><?php esc_html_e( "Associates Link Builder", 'amazon-associates-link-builder' ); ?></h2>
|
22 |
<div class="card" style="max-width:100%;">
|
23 |
<h2><?php esc_html_e( "About Amazon Associates Program", 'amazon-associates-link-builder' ); ?></h2>
|
24 |
<p>
|
25 |
<?php /* translators: 1: URL of affiliate website 2: _blank */
|
26 |
+
printf( __( "The Amazon Associates Program is one of the original affiliate marketing programs. Available in geographies across the globe, the Amazon Associates Program has been partnering with content creators to help them monetize their passions since 1996. To learn more about the Amazon Associates Program, please click <a href=%1s target=%2s >here</a>.", 'amazon-associates-link-builder' ), Plugin_Urls::AFFILIATE_WEBSITE_URL, Plugin_Urls::NEW_PAGE_TARGET ); ?>
|
27 |
</p>
|
28 |
<h2><?php esc_html_e( "About Amazon Associates Link Builder", 'amazon-associates-link-builder' ); ?> </h2>
|
29 |
<p>
|
33 |
<ul>
|
34 |
<li>
|
35 |
<?php /* translators: 1: URL of Condition of Use page 2: _blank */
|
36 |
+
printf( __( "You must review and accept the Amazon Associates Link Builder <a href=%1s target=%2s>Conditions of Use.</a>", 'amazon-associates-link-builder' ), Plugin_Urls::CONDITIONS_OF_USE_URL, Plugin_Urls::NEW_PAGE_TARGET ); ?>
|
37 |
</li>
|
38 |
<li>
|
39 |
<?php esc_html_e( "The plugin is currently in beta form. We intend to regularly add new features and enhancements throughout the beta period and beyond, and welcome your feedback and input.", 'amazon-associates-link-builder' ); ?>
|
45 |
<?php esc_html_e( "To become an Associate, create an Amazon Associates account using URL for your country:", 'amazon-associates-link-builder' ); ?>
|
46 |
</p>
|
47 |
<table border="0" cellpadding="10">
|
48 |
+
<tr>
|
49 |
+
<td><b><?php esc_html_e( "Australia", 'amazon-associates-link-builder' ); ?></b></td>
|
50 |
+
<td>
|
51 |
+
<a href="https://affiliate-program.amazon.com.au/" target="_blank">https://affiliate-program.amazon.com.au/</a>
|
52 |
+
</td>
|
53 |
+
</tr>
|
54 |
<tr>
|
55 |
<td><b><?php esc_html_e( "Brazil", 'amazon-associates-link-builder' ); ?></b></td>
|
56 |
<td>
|
130 |
<h3><?php esc_html_e( "Step 2 - Sign up for the Amazon Product Advertising API", 'amazon-associates-link-builder' ); ?></h3>
|
131 |
<p>
|
132 |
<?php /* translators: 1: URL of Getting Started page 2: _blank */
|
133 |
+
printf( __( "Sign up for the Amazon Product Advertising API by following the instructions listed <a href=%1s target=%2s>here</a>. The Amazon Product Advertising API is a popular e-commerce service, powering Amazon-integrated experiences around the world, serving tens of thousands of applications and more than 1 billion API requests every day. It exposes a web-service, which allows Associates to programmatically search and look up items in the Amazon product catalog. The Link Builder plugin integrates the Product Advertising API, allowing you to access Amazon.com product catalog data without requiring additional software development.", 'amazon-associates-link-builder' ), Plugin_Urls::GETTING_STARTED_URL, Plugin_Urls::NEW_PAGE_TARGET ); ?>
|
134 |
</p>
|
135 |
<h3><?php esc_html_e( "Step 3 - Configure plugin for first use", 'amazon-associates-link-builder' ); ?></h3>
|
136 |
<p>
|
150 |
<h2><?php esc_html_e( "User Guide", 'amazon-associates-link-builder' ); ?></h2>
|
151 |
<p>
|
152 |
<?php /* translators: 1: URL of Link Builder User Guide 2: _blank */
|
153 |
+
printf( __( "Review <a href=%1s target=%2s >Link Builder User Guide</a> for more information on getting started and key features of the plugin.", 'amazon-associates-link-builder' ), Plugin_Urls::USER_GUIDE_URL, Plugin_Urls::NEW_PAGE_TARGET ); ?>
|
154 |
</p>
|
155 |
<h2><?php esc_html_e( "Support", 'amazon-associates-link-builder' ); ?></h2>
|
156 |
<p>
|
157 |
<?php /* translators: 1: URL of Plugin's Support Forum 2: _blank */
|
158 |
+
printf( __( "If you get stuck, or have any questions, you can ask for help in the <a href=%1s target=%2s>Amazon Associates Link Builder plugin forum</a>.", 'amazon-associates-link-builder' ), Plugin_Urls::SUPPORT_FORUM_URL, Plugin_Urls::NEW_PAGE_TARGET ); ?>
|
159 |
</p>
|
160 |
</div>
|
161 |
</div>
|
admin/sidebar/partials/aalb_admin_ui_common.php → view/sidebar_partials/admin_ui_common.php
RENAMED
@@ -13,8 +13,11 @@ and limitations under the License.
|
|
13 |
*/
|
14 |
|
15 |
//File with common functionalities for Admin pages.
|
|
|
16 |
|
17 |
-
|
|
|
|
|
18 |
|
19 |
if ( ! is_admin() ) {
|
20 |
die( "Permission Denied" );
|
@@ -22,10 +25,10 @@ if ( ! is_admin() ) {
|
|
22 |
|
23 |
if ( ! is_ssl() ) {
|
24 |
//action when page is NOT using SSL
|
25 |
-
if ( ! get_option(
|
26 |
// This info message is showed only once.
|
27 |
aalb_info_notice( __( "We <b>recommend</b> using HTTPs connection for improved security.", 'amazon-associates-link-builder' ) );
|
28 |
-
update_option(
|
29 |
}
|
30 |
}
|
31 |
|
13 |
*/
|
14 |
|
15 |
//File with common functionalities for Admin pages.
|
16 |
+
namespace AmazonAssociatesLinkBuilder\view\sidebar_partials;
|
17 |
|
18 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
19 |
+
|
20 |
+
include 'ui_common.php';
|
21 |
|
22 |
if ( ! is_admin() ) {
|
23 |
die( "Permission Denied" );
|
25 |
|
26 |
if ( ! is_ssl() ) {
|
27 |
//action when page is NOT using SSL
|
28 |
+
if ( ! get_option( Db_Constants::SHOW_HTTP_WARNING_ONCE ) ) {
|
29 |
// This info message is showed only once.
|
30 |
aalb_info_notice( __( "We <b>recommend</b> using HTTPs connection for improved security.", 'amazon-associates-link-builder' ) );
|
31 |
+
update_option( Db_Constants::SHOW_HTTP_WARNING_ONCE, true );
|
32 |
}
|
33 |
}
|
34 |
|
admin/sidebar/partials/aalb_credentials.php → view/sidebar_partials/credentials.php
RENAMED
@@ -11,11 +11,18 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
|
|
|
|
14 |
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
$cred_helper = new
|
19 |
$cred_helper->handle_error_notices();
|
20 |
?>
|
21 |
<!-- ToDO: 1. Convert table to div. 2. Put complete code under handlebars as currently store-id settings loads 1 second after page load-->
|
@@ -36,8 +43,8 @@ $cred_helper->handle_error_notices();
|
|
36 |
<h2><?php esc_html_e( "Settings for Associates Link Builder", 'amazon-associates-link-builder' ) ?></h2>
|
37 |
<br>
|
38 |
<form id="aalb-credentials-form" method="post" action="options.php">
|
39 |
-
<?php settings_fields(
|
40 |
-
do_settings_sections(
|
41 |
<script id="aalb-hbs-store-id-settings" type="text/x-handlebars-template">
|
42 |
<fieldset class="aalb-settings-fieldset">
|
43 |
<legend class="aalb-settings-legend"> {{tracking_id_fieldset_label}}</legend>
|
@@ -72,10 +79,10 @@ $cred_helper->handle_error_notices();
|
|
72 |
<tr>
|
73 |
<th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Default Template", 'amazon-associates-link-builder' ) ?></th>
|
74 |
<td class="aalb-settings-input-column">
|
75 |
-
<?php $default_template = get_option(
|
76 |
-
<select name=<?php echo
|
77 |
<?php
|
78 |
-
$templates = get_option(
|
79 |
foreach ( $templates as $template ) {
|
80 |
echo '<option value="' . $template . '"';
|
81 |
selected( $default_template, $template );
|
@@ -90,16 +97,16 @@ $cred_helper->handle_error_notices();
|
|
90 |
<tr>
|
91 |
<th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Downloads Folder", 'amazon-associates-link-builder' ) ?></th>
|
92 |
<td class="aalb-settings-input-column">
|
93 |
-
<input type="text" name=<?php echo
|
94 |
-
value="<?php echo get_option(
|
95 |
</td>
|
96 |
<td>
|
97 |
-
<?php printf( __("This folder will be used to save files downloaded by the plugin (e.g. <a href=%1s target=%2s>The MaxMind IP2Country Database</a>) for local use. Absolute path required. <br><span class=\"aalb-bold\"> Default value:</span> <code>wp_upload_dir()['basedir'] + '%3s'</code>", 'amazon-associates-link-builder' ),
|
98 |
</td>
|
99 |
</tr>
|
100 |
<tr>
|
101 |
<td scope="row" colspan="2" class="aalb-settings-input-column">
|
102 |
-
<input id=<?php echo
|
103 |
echo "checked='checked'"; ?> />
|
104 |
<label class="aalb-font-size-110" for="aalb_no_referrer_disabled">
|
105 |
<?php /* translators: %s: rel="noreferrer" attribute */
|
@@ -120,27 +127,28 @@ $cred_helper->handle_error_notices();
|
|
120 |
<tr>
|
121 |
<th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Access Key ID", 'amazon-associates-link-builder' ) ?></th>
|
122 |
<td class="aalb-settings-input-column">
|
123 |
-
<input type="text" name=<?php echo
|
124 |
-
value="<?php echo esc_attr( openssl_decrypt( base64_decode( get_option(
|
125 |
</td>
|
126 |
<td>
|
127 |
<?php /* translators: 1: URL of Getting Started page 2: _blank */
|
128 |
-
printf( __( "Your Access Key ID that you generated after signing up for the Amazon Product Advertising API. If you have not already signed up for the Amazon Product Advertising API, you can do so by following instructions listed <a href=%1s target=%2s>here</a>.", 'amazon-associates-link-builder' ),
|
129 |
</td>
|
130 |
</tr>
|
131 |
<tr>
|
132 |
<th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Secret Access Key", 'amazon-associates-link-builder' ) ?></th>
|
133 |
-
<?php $secret_key = get_option(
|
134 |
if ( $secret_key ) {
|
135 |
-
$secret_key =
|
136 |
}
|
137 |
?>
|
138 |
-
<td class="aalb-settings-input-column"
|
|
|
139 |
class="aalb-settings-input-field" value="<?php echo esc_attr( $secret_key ); ?>" autocomplete="off" />
|
140 |
</td>
|
141 |
<td>
|
142 |
<?php /* translators: 1: URL of managing PA-API acccount page 2: _blank */
|
143 |
-
printf( __( "A key that is used in conjunction with the Access Key ID to cryptographically sign an API request. To retrieve your Access Key ID or Secret Access Key, go to <a href=%1s target=%2s>Manage Your Account</a>. The plugin uses a default encryption key for encrypting the Secret Key. You can change the key using
|
144 |
</td>
|
145 |
</tr>
|
146 |
</table>
|
@@ -150,7 +158,7 @@ $cred_helper->handle_error_notices();
|
|
150 |
<input id="aalb-terms-checkbox" type="checkbox" name="demo-checkbox" value="1" />
|
151 |
<label for="aalb-terms-checkbox">
|
152 |
<?php /* translators: 1: URL of Condition of Use page 2: _blank */
|
153 |
-
printf( __( "Check here to indicate that you have read and agree to the Amazon Associates Link Builder <a href=%1s target=%2s>Conditions of Use</a>.", 'amazon-associates-link-builder' ),
|
154 |
</div>
|
155 |
<?php $aalb_submit_button_text = esc_html__( "Save Changes", 'amazon-associates-link-builder' );
|
156 |
submit_button( $aalb_submit_button_text, 'primary', 'submit', true, array( 'disabled' => 'disabled' ) ); ?>
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\view\sidebar_partials;
|
15 |
+
include 'admin_ui_common.php';
|
16 |
+
include 'credentials_locale_row.php';
|
17 |
|
18 |
+
use AmazonAssociatesLinkBuilder\constants\Library_Endpoints;
|
19 |
+
use AmazonAssociatesLinkBuilder\constants\Paapi_Constants;
|
20 |
+
use AmazonAssociatesLinkBuilder\helper\Credentials_Helper;
|
21 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
22 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
23 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Urls;
|
24 |
|
25 |
+
$cred_helper = new Credentials_Helper();
|
26 |
$cred_helper->handle_error_notices();
|
27 |
?>
|
28 |
<!-- ToDO: 1. Convert table to div. 2. Put complete code under handlebars as currently store-id settings loads 1 second after page load-->
|
43 |
<h2><?php esc_html_e( "Settings for Associates Link Builder", 'amazon-associates-link-builder' ) ?></h2>
|
44 |
<br>
|
45 |
<form id="aalb-credentials-form" method="post" action="options.php">
|
46 |
+
<?php settings_fields( Db_Constants::CRED_CONFIG_GROUP );
|
47 |
+
do_settings_sections( Db_Constants::CRED_CONFIG_GROUP ); ?>
|
48 |
<script id="aalb-hbs-store-id-settings" type="text/x-handlebars-template">
|
49 |
<fieldset class="aalb-settings-fieldset">
|
50 |
<legend class="aalb-settings-legend"> {{tracking_id_fieldset_label}}</legend>
|
79 |
<tr>
|
80 |
<th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Default Template", 'amazon-associates-link-builder' ) ?></th>
|
81 |
<td class="aalb-settings-input-column">
|
82 |
+
<?php $default_template = get_option( Db_Constants::DEFAULT_TEMPLATE, Db_Constants::DEFAULT_TEMPLATE_NAME ); ?>
|
83 |
+
<select name=<?php echo Db_Constants::DEFAULT_TEMPLATE ?> class="aalb-settings-input-field">
|
84 |
<?php
|
85 |
+
$templates = get_option( Db_Constants::TEMPLATE_NAMES, $default_template );
|
86 |
foreach ( $templates as $template ) {
|
87 |
echo '<option value="' . $template . '"';
|
88 |
selected( $default_template, $template );
|
97 |
<tr>
|
98 |
<th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Downloads Folder", 'amazon-associates-link-builder' ) ?></th>
|
99 |
<td class="aalb-settings-input-column">
|
100 |
+
<input type="text" name=<?php echo Db_Constants::CUSTOM_UPLOAD_PATH ?> class="aalb-settings-input-field"
|
101 |
+
value="<?php echo get_option( Db_Constants::CUSTOM_UPLOAD_PATH ) ?>" />
|
102 |
</td>
|
103 |
<td>
|
104 |
+
<?php printf( __( "This folder will be used to save files downloaded by the plugin (e.g. <a href=%1s target=%2s>The MaxMind IP2Country Database</a>) for local use. Absolute path required. <br><span class=\"aalb-bold\"> Default value:</span> <code>wp_upload_dir()['basedir'] + '%3s'</code>", 'amazon-associates-link-builder' ), Library_Endpoints::GEOLITE_COUNTRY_DB_DETAILS_URL, Plugin_Urls::NEW_PAGE_TARGET, Plugin_Constants::UPLOADS_FOLDER ); ?>
|
105 |
</td>
|
106 |
</tr>
|
107 |
<tr>
|
108 |
<td scope="row" colspan="2" class="aalb-settings-input-column">
|
109 |
+
<input id=<?php echo Db_Constants::NO_REFERRER_DISABLED ?> type="checkbox" name=<?php echo Db_Constants::NO_REFERRER_DISABLED ?> value="true"<?php if ( get_option( Db_Constants::NO_REFERRER_DISABLED ) )
|
110 |
echo "checked='checked'"; ?> />
|
111 |
<label class="aalb-font-size-110" for="aalb_no_referrer_disabled">
|
112 |
<?php /* translators: %s: rel="noreferrer" attribute */
|
127 |
<tr>
|
128 |
<th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Access Key ID", 'amazon-associates-link-builder' ) ?></th>
|
129 |
<td class="aalb-settings-input-column">
|
130 |
+
<input type="text" name=<?php echo Db_Constants::AWS_ACCESS_KEY ?> class="aalb-settings-input-field"
|
131 |
+
value="<?php echo esc_attr( openssl_decrypt( base64_decode( get_option( Db_Constants::AWS_ACCESS_KEY ) ), Plugin_Constants::ENCRYPTION_ALGORITHM, Plugin_Constants::ENCRYPTION_KEY, 0, Plugin_Constants::ENCRYPTION_IV ) ); ?>" />
|
132 |
</td>
|
133 |
<td>
|
134 |
<?php /* translators: 1: URL of Getting Started page 2: _blank */
|
135 |
+
printf( __( "Your Access Key ID that you generated after signing up for the Amazon Product Advertising API. If you have not already signed up for the Amazon Product Advertising API, you can do so by following instructions listed <a href=%1s target=%2s>here</a>.", 'amazon-associates-link-builder' ), Plugin_Urls::GETTING_STARTED_URL, Plugin_Urls::NEW_PAGE_TARGET ) ?>
|
136 |
</td>
|
137 |
</tr>
|
138 |
<tr>
|
139 |
<th scope="row" class="aalb-settings-identifier"><?php esc_html_e( "Secret Access Key", 'amazon-associates-link-builder' ) ?></th>
|
140 |
+
<?php $secret_key = get_option( Db_Constants::AWS_SECRET_KEY );
|
141 |
if ( $secret_key ) {
|
142 |
+
$secret_key = Plugin_Constants::AWS_SECRET_KEY_MASK;
|
143 |
}
|
144 |
?>
|
145 |
+
<td class="aalb-settings-input-column">
|
146 |
+
<input type="password" name=<?php echo Db_Constants::AWS_SECRET_KEY ?>
|
147 |
class="aalb-settings-input-field" value="<?php echo esc_attr( $secret_key ); ?>" autocomplete="off" />
|
148 |
</td>
|
149 |
<td>
|
150 |
<?php /* translators: 1: URL of managing PA-API acccount page 2: _blank */
|
151 |
+
printf( __( "A key that is used in conjunction with the Access Key ID to cryptographically sign an API request. To retrieve your Access Key ID or Secret Access Key, go to <a href=%1s target=%2s>Manage Your Account</a>. The plugin uses a default encryption key for encrypting the Secret Key. You can change the key using ENCRYPTION KEY parameter defined in /plugin_config.php.", 'amazon-associates-link-builder' ), Paapi_Constants::MANAGE_US_ACCOUNT_URL, Plugin_Urls::NEW_PAGE_TARGET ) ?>
|
152 |
</td>
|
153 |
</tr>
|
154 |
</table>
|
158 |
<input id="aalb-terms-checkbox" type="checkbox" name="demo-checkbox" value="1" />
|
159 |
<label for="aalb-terms-checkbox">
|
160 |
<?php /* translators: 1: URL of Condition of Use page 2: _blank */
|
161 |
+
printf( __( "Check here to indicate that you have read and agree to the Amazon Associates Link Builder <a href=%1s target=%2s>Conditions of Use</a>.", 'amazon-associates-link-builder' ), Plugin_Urls::CONDITIONS_OF_USE_URL, Plugin_Urls::NEW_PAGE_TARGET ) ?></label>
|
162 |
</div>
|
163 |
<?php $aalb_submit_button_text = esc_html__( "Save Changes", 'amazon-associates-link-builder' );
|
164 |
submit_button( $aalb_submit_button_text, 'primary', 'submit', true, array( 'disabled' => 'disabled' ) ); ?>
|
admin/sidebar/partials/aalb_credentials_locale_row.php → view/sidebar_partials/credentials_locale_row.php
RENAMED
@@ -1,4 +1,5 @@
|
|
1 |
-
|
|
|
2 |
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3 |
|
4 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
@@ -8,8 +9,10 @@ A copy of the License is located in the "license" file accompanying this file.
|
|
8 |
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
9 |
either express or implied. See the License for the specific language governing permissions
|
10 |
and limitations under the License.
|
11 |
-
|
12 |
-
|
|
|
|
|
13 |
/*
|
14 |
* Below is an example of context to be passed to this template
|
15 |
{
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
Copyright 2016-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
4 |
|
5 |
Licensed under the GNU General Public License as published by the Free Software Foundation,
|
9 |
This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
10 |
either express or implied. See the License for the specific language governing permissions
|
11 |
and limitations under the License.
|
12 |
+
*/
|
13 |
+
|
14 |
+
namespace AmazonAssociatesLinkBuilder\view\sidebar_partials;
|
15 |
+
|
16 |
/*
|
17 |
* Below is an example of context to be passed to this template
|
18 |
{
|
admin/sidebar/partials/aalb_templates.php → view/sidebar_partials/templates.php
RENAMED
@@ -11,11 +11,17 @@ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS O
|
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
|
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
18 |
|
|
|
|
|
|
|
|
|
19 |
/**
|
20 |
* Verifies whether file exists and is writable
|
21 |
*
|
@@ -28,7 +34,7 @@ $helper->aalb_initialize_wp_filesystem_api();
|
|
28 |
function aalb_verify_file_is_writable( $file ) {
|
29 |
if ( is_file( $file ) and ! is_writable( $file ) ) {
|
30 |
/* translators: %s for fileName */
|
31 |
-
throw new Exception( sprintf( esc_html__( "Save Failed. The existing file %s is not writable.", 'amazon-associates-link-builder' ), $file ) );
|
32 |
}
|
33 |
|
34 |
return true;
|
@@ -39,7 +45,7 @@ function aalb_verify_file_is_writable( $file ) {
|
|
39 |
*
|
40 |
* @since 1.0.0
|
41 |
*
|
42 |
-
* @param string $file
|
43 |
* @param string $content Content to be written
|
44 |
*
|
45 |
* @return bool TRUE if write was successful, throws exception otherwise
|
@@ -48,7 +54,7 @@ function aalb_write_to_file( $file, $content ) {
|
|
48 |
global $wp_filesystem;
|
49 |
if ( $wp_filesystem->put_contents( $file, $content ) === false ) {
|
50 |
/* translators: %s for fileName */
|
51 |
-
throw new Exception( sprintf( esc_html__( "Save Failed. Error writing contents to file: %s", 'amazon-associates-link-builder' ), $file ) );
|
52 |
}
|
53 |
|
54 |
return true;
|
@@ -60,9 +66,9 @@ function aalb_write_to_file( $file, $content ) {
|
|
60 |
*
|
61 |
* @since 1.0.0
|
62 |
*
|
63 |
-
* @param string $file
|
64 |
* @param string $content_html HTML content to be saved
|
65 |
-
* @param string $content_css
|
66 |
*/
|
67 |
function aalb_save_template( $file, $content_html, $content_css ) {
|
68 |
$file_mustache = $file . ".mustache";
|
@@ -77,8 +83,8 @@ function aalb_save_template( $file, $content_html, $content_css ) {
|
|
77 |
aalb_success_notice( esc_html__( "Template Saved Successfully", 'amazon-associates-link-builder' ) );
|
78 |
}
|
79 |
}
|
80 |
-
} catch ( Exception $e ) {
|
81 |
-
throw new Exception( $e->getMessage() );
|
82 |
}
|
83 |
}
|
84 |
|
@@ -89,7 +95,7 @@ function aalb_save_template( $file, $content_html, $content_css ) {
|
|
89 |
* @since 1.3
|
90 |
*
|
91 |
* @param array $aalb_current_template_names Current list of templates
|
92 |
-
* @param array $aalb_template_names
|
93 |
*/
|
94 |
function aalb_find_template_change( $aalb_current_template_names, $aalb_template_names ) {
|
95 |
$templates_added = array_diff( $aalb_template_names, $aalb_current_template_names );
|
@@ -106,14 +112,14 @@ function aalb_find_template_change( $aalb_current_template_names, $aalb_template
|
|
106 |
|
107 |
//Flag to check if the save is failed.
|
108 |
$saveFailed = false;
|
109 |
-
$aalb_default_templates = explode( ",",
|
110 |
|
111 |
-
$aalb_current_template_names = get_option(
|
112 |
|
113 |
//Refresh templates
|
114 |
$helper->refresh_template_list();
|
115 |
|
116 |
-
$aalb_template_names = get_option(
|
117 |
aalb_find_template_change( $aalb_current_template_names, $aalb_template_names );
|
118 |
|
119 |
//ToDO: Make single submit button & move logic for save & remove to separate controllers for HTTP verbs instead of putting along with view
|
@@ -146,7 +152,7 @@ if ( isset ( $_POST["save"] ) || isset ( $_POST["remove"] ) ) {
|
|
146 |
aalb_save_template( $aalb_template_upload_dir . $aalb_template_name, $aalb_template_template_html_box, $aalb_template_template_css_box );
|
147 |
array_push( $aalb_template_names, $aalb_template_name );
|
148 |
update_option( 'aalb_template_names', $aalb_template_names );
|
149 |
-
} catch ( Exception $e ) {
|
150 |
aalb_error_notice( $e->getMessage() );
|
151 |
}
|
152 |
}
|
@@ -162,13 +168,13 @@ if ( isset ( $_POST["save"] ) || isset ( $_POST["remove"] ) ) {
|
|
162 |
|
163 |
//clears the cached rendered templates whenever the template is modified
|
164 |
$helper->clear_cache_for_template( $aalb_template_name );
|
165 |
-
} catch ( Exception $e ) {
|
166 |
aalb_error_notice( $e->getMessage() );
|
167 |
}
|
168 |
}
|
169 |
} elseif ( isset( $_POST["remove"] ) ) {
|
170 |
-
if ( !($_POST["aalb_template_list"] == "new") ) {
|
171 |
-
if ( !in_array( $aalb_template_name, $aalb_default_templates ) ) {
|
172 |
$aalb_template_names = array_diff( $aalb_template_names, array( $aalb_template_name ) );
|
173 |
update_option( 'aalb_template_names', $aalb_template_names );
|
174 |
|
@@ -199,13 +205,13 @@ if ( isset ( $_POST["save"] ) || isset ( $_POST["remove"] ) ) {
|
|
199 |
}
|
200 |
|
201 |
wp_enqueue_script( 'jquery' );
|
202 |
-
wp_enqueue_script( 'codemirror_js', CODEMIRROR_JS );
|
203 |
-
wp_enqueue_script( 'codemirror_mode_xml_js', CODEMIRROR_MODE_XML_JS );
|
204 |
-
wp_enqueue_script( 'codemirror_mode_css_js', CODEMIRROR_MODE_CSS_JS );
|
205 |
-
wp_enqueue_style( 'codemirror_css', CODEMIRROR_CSS );
|
206 |
|
207 |
-
wp_enqueue_script( 'aalb_template_js', AALB_TEMPLATE_JS, array( 'jquery', 'codemirror_js', 'codemirror_mode_xml_js', 'codemirror_mode_css_js' ),
|
208 |
-
wp_localize_script( 'aalb_template_js', 'wp_opt', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'upload_url' => $helper->get_template_upload_directory(), 'plugin_url' => AALB_PLUGIN_URL, 'aalb_default_templates' =>
|
209 |
|
210 |
?>
|
211 |
<div class="wrap">
|
@@ -217,7 +223,7 @@ wp_localize_script( 'aalb_template_js', 'wp_opt', array( 'ajax_url' => admin_url
|
|
217 |
<th scope="row" style="width:15%;"><?php esc_html_e( "Select Template", 'amazon-associates-link-builder' ) ?></th>
|
218 |
<td>
|
219 |
<select id="aalb_template_list_select" name="aalb_template_list" style="width:50%"
|
220 |
-
|
221 |
<option value="new"><?php esc_html_e( "Create new template", 'amazon-associates-link-builder' ) ?></option>
|
222 |
<?php
|
223 |
foreach ( $aalb_template_names as $aalb_template ) {
|
@@ -228,29 +234,29 @@ wp_localize_script( 'aalb_template_js', 'wp_opt', array( 'ajax_url' => admin_url
|
|
228 |
?>
|
229 |
</select>
|
230 |
<input type="button" name="clone" id="clone_template" class="button button-secondary" value="<?php esc_attr_e( "Clone", 'amazon-associates-link-builder' ) ?>"
|
231 |
-
|
232 |
</td>
|
233 |
</tr>
|
234 |
<tr>
|
235 |
<th scope="row" style="width:15%;"><?php esc_html_e( "Set a name for your template", 'amazon-associates-link-builder' ) ?></th>
|
236 |
<td>
|
237 |
<input type="text" id="aalb_template_name" name="aalb_template_name" style="width:50%"
|
238 |
-
|
239 |
<span style="font-size:0.9em;">[<a
|
240 |
-
|
241 |
target="_blank"><?php esc_html_e( "Guide for creating custom templates", 'amazon-associates-link-builder' ) ?></a>]</span>
|
242 |
</td>
|
243 |
</tr>
|
244 |
<tr>
|
245 |
<th scope="row" style="width:15%;"><?php esc_html_e( "Add HTML for your template", 'amazon-associates-link-builder' ) ?></th>
|
246 |
<td><textarea id="aalb_template_template_html_box"
|
247 |
-
|
248 |
</td>
|
249 |
</tr>
|
250 |
<tr>
|
251 |
<th scope="row" style="width:15%;"><?php esc_html_e( "Add CSS for your template", 'amazon-associates-link-builder' ) ?></th>
|
252 |
<td><textarea id="aalb_template_template_css_box"
|
253 |
-
|
254 |
</td>
|
255 |
</tr>
|
256 |
</table>
|
11 |
either express or implied. See the License for the specific language governing permissions
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
+
namespace AmazonAssociatesLinkBuilder\view\sidebar_partials;
|
15 |
|
16 |
+
use AmazonAssociatesLinkBuilder\constants\Db_Constants;
|
17 |
+
use AmazonAssociatesLinkBuilder\constants\Library_Endpoints;
|
18 |
+
use AmazonAssociatesLinkBuilder\constants\Plugin_Constants;
|
19 |
+
use AmazonAssociatesLinkBuilder\helper\Plugin_Helper;
|
20 |
|
21 |
+
include 'admin_ui_common.php';
|
22 |
+
$helper = new Plugin_Helper();
|
23 |
+
$helper->aalb_initialize_wp_filesystem_api();
|
24 |
+
//ToDO: Move below functions to into a helper class.
|
25 |
/**
|
26 |
* Verifies whether file exists and is writable
|
27 |
*
|
34 |
function aalb_verify_file_is_writable( $file ) {
|
35 |
if ( is_file( $file ) and ! is_writable( $file ) ) {
|
36 |
/* translators: %s for fileName */
|
37 |
+
throw new \Exception( sprintf( esc_html__( "Save Failed. The existing file %s is not writable.", 'amazon-associates-link-builder' ), $file ) );
|
38 |
}
|
39 |
|
40 |
return true;
|
45 |
*
|
46 |
* @since 1.0.0
|
47 |
*
|
48 |
+
* @param string $file Name of the file
|
49 |
* @param string $content Content to be written
|
50 |
*
|
51 |
* @return bool TRUE if write was successful, throws exception otherwise
|
54 |
global $wp_filesystem;
|
55 |
if ( $wp_filesystem->put_contents( $file, $content ) === false ) {
|
56 |
/* translators: %s for fileName */
|
57 |
+
throw new \Exception( sprintf( esc_html__( "Save Failed. Error writing contents to file: %s", 'amazon-associates-link-builder' ), $file ) );
|
58 |
}
|
59 |
|
60 |
return true;
|
66 |
*
|
67 |
* @since 1.0.0
|
68 |
*
|
69 |
+
* @param string $file Name of the file without .extension
|
70 |
* @param string $content_html HTML content to be saved
|
71 |
+
* @param string $content_css CSS content to be saved
|
72 |
*/
|
73 |
function aalb_save_template( $file, $content_html, $content_css ) {
|
74 |
$file_mustache = $file . ".mustache";
|
83 |
aalb_success_notice( esc_html__( "Template Saved Successfully", 'amazon-associates-link-builder' ) );
|
84 |
}
|
85 |
}
|
86 |
+
} catch ( \Exception $e ) {
|
87 |
+
throw new \Exception( $e->getMessage() );
|
88 |
}
|
89 |
}
|
90 |
|
95 |
* @since 1.3
|
96 |
*
|
97 |
* @param array $aalb_current_template_names Current list of templates
|
98 |
+
* @param array $aalb_template_names Refreshed list of templates
|
99 |
*/
|
100 |
function aalb_find_template_change( $aalb_current_template_names, $aalb_template_names ) {
|
101 |
$templates_added = array_diff( $aalb_template_names, $aalb_current_template_names );
|
112 |
|
113 |
//Flag to check if the save is failed.
|
114 |
$saveFailed = false;
|
115 |
+
$aalb_default_templates = explode( ",", Plugin_Constants::AMAZON_TEMPLATE_NAMES );
|
116 |
|
117 |
+
$aalb_current_template_names = get_option( Db_Constants::TEMPLATE_NAMES );
|
118 |
|
119 |
//Refresh templates
|
120 |
$helper->refresh_template_list();
|
121 |
|
122 |
+
$aalb_template_names = get_option( Db_Constants::TEMPLATE_NAMES );
|
123 |
aalb_find_template_change( $aalb_current_template_names, $aalb_template_names );
|
124 |
|
125 |
//ToDO: Make single submit button & move logic for save & remove to separate controllers for HTTP verbs instead of putting along with view
|
152 |
aalb_save_template( $aalb_template_upload_dir . $aalb_template_name, $aalb_template_template_html_box, $aalb_template_template_css_box );
|
153 |
array_push( $aalb_template_names, $aalb_template_name );
|
154 |
update_option( 'aalb_template_names', $aalb_template_names );
|
155 |
+
} catch ( \Exception $e ) {
|
156 |
aalb_error_notice( $e->getMessage() );
|
157 |
}
|
158 |
}
|
168 |
|
169 |
//clears the cached rendered templates whenever the template is modified
|
170 |
$helper->clear_cache_for_template( $aalb_template_name );
|
171 |
+
} catch ( \Exception $e ) {
|
172 |
aalb_error_notice( $e->getMessage() );
|
173 |
}
|
174 |
}
|
175 |
} elseif ( isset( $_POST["remove"] ) ) {
|
176 |
+
if ( ! ( $_POST["aalb_template_list"] == "new" ) ) {
|
177 |
+
if ( ! in_array( $aalb_template_name, $aalb_default_templates ) ) {
|
178 |
$aalb_template_names = array_diff( $aalb_template_names, array( $aalb_template_name ) );
|
179 |
update_option( 'aalb_template_names', $aalb_template_names );
|
180 |
|
205 |
}
|
206 |
|
207 |
wp_enqueue_script( 'jquery' );
|
208 |
+
wp_enqueue_script( 'codemirror_js', Library_Endpoints::CODEMIRROR_JS );
|
209 |
+
wp_enqueue_script( 'codemirror_mode_xml_js', Library_Endpoints::CODEMIRROR_MODE_XML_JS );
|
210 |
+
wp_enqueue_script( 'codemirror_mode_css_js', Library_Endpoints::CODEMIRROR_MODE_CSS_JS );
|
211 |
+
wp_enqueue_style( 'codemirror_css', Library_Endpoints::CODEMIRROR_CSS );
|
212 |
|
213 |
+
wp_enqueue_script( 'aalb_template_js', AALB_TEMPLATE_JS, array( 'jquery', 'codemirror_js', 'codemirror_mode_xml_js', 'codemirror_mode_css_js' ), Plugin_Constants::PLUGIN_CURRENT_VERSION );
|
214 |
+
wp_localize_script( 'aalb_template_js', 'wp_opt', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'upload_url' => $helper->get_template_upload_directory(), 'plugin_url' => AALB_PLUGIN_URL, 'aalb_default_templates' => Plugin_Constants::AMAZON_TEMPLATE_NAMES ) );
|
215 |
|
216 |
?>
|
217 |
<div class="wrap">
|
223 |
<th scope="row" style="width:15%;"><?php esc_html_e( "Select Template", 'amazon-associates-link-builder' ) ?></th>
|
224 |
<td>
|
225 |
<select id="aalb_template_list_select" name="aalb_template_list" style="width:50%"
|
226 |
+
onchange="aalb_template_select_template_onchange(this)">
|
227 |
<option value="new"><?php esc_html_e( "Create new template", 'amazon-associates-link-builder' ) ?></option>
|
228 |
<?php
|
229 |
foreach ( $aalb_template_names as $aalb_template ) {
|
234 |
?>
|
235 |
</select>
|
236 |
<input type="button" name="clone" id="clone_template" class="button button-secondary" value="<?php esc_attr_e( "Clone", 'amazon-associates-link-builder' ) ?>"
|
237 |
+
onclick="clone_existing_template()" disabled>
|
238 |
</td>
|
239 |
</tr>
|
240 |
<tr>
|
241 |
<th scope="row" style="width:15%;"><?php esc_html_e( "Set a name for your template", 'amazon-associates-link-builder' ) ?></th>
|
242 |
<td>
|
243 |
<input type="text" id="aalb_template_name" name="aalb_template_name" style="width:50%"
|
244 |
+
value="<?= ( isset( $aalb_template_name ) ) ? $aalb_template_name : '' ?>" />
|
245 |
<span style="font-size:0.9em;">[<a
|
246 |
+
href="https://s3.amazonaws.com/aalb-public-resources/documents/AssociatesLinkBuilder-Guide-HowToCreateCustomTemplates.pdf"
|
247 |
target="_blank"><?php esc_html_e( "Guide for creating custom templates", 'amazon-associates-link-builder' ) ?></a>]</span>
|
248 |
</td>
|
249 |
</tr>
|
250 |
<tr>
|
251 |
<th scope="row" style="width:15%;"><?php esc_html_e( "Add HTML for your template", 'amazon-associates-link-builder' ) ?></th>
|
252 |
<td><textarea id="aalb_template_template_html_box"
|
253 |
+
name="aalb_template_template_html_box"><?= ( isset( $aalb_template_template_html_box ) ) ? $aalb_template_template_html_box : '' ?></textarea>
|
254 |
</td>
|
255 |
</tr>
|
256 |
<tr>
|
257 |
<th scope="row" style="width:15%;"><?php esc_html_e( "Add CSS for your template", 'amazon-associates-link-builder' ) ?></th>
|
258 |
<td><textarea id="aalb_template_template_css_box"
|
259 |
+
name="aalb_template_template_css_box"><?= ( isset( $aalb_template_template_css_box ) ) ? $aalb_template_template_css_box : '' ?></textarea>
|
260 |
</td>
|
261 |
</tr>
|
262 |
</table>
|
admin/sidebar/partials/aalb_ui_common.php → view/sidebar_partials/ui_common.php
RENAMED
@@ -12,6 +12,7 @@ either express or implied. See the License for the specific language governing p
|
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
|
|
15 |
//some commonly used UI functionality
|
16 |
|
17 |
function aalb_info_notice( $message ) {
|
12 |
and limitations under the License.
|
13 |
*/
|
14 |
|
15 |
+
//ToDO: Move below functions into class.
|
16 |
//some commonly used UI functionality
|
17 |
|
18 |
function aalb_info_notice( $message ) {
|