Version Description
Download this release
Release Info
Developer | demoive |
Plugin | Instant Articles for WP |
Version | 2.11 |
Comparing to | |
See all releases |
Code changes from version 2.10 to 2.11
- class-instant-articles-post.php +3 -5
- facebook-instant-articles.php +2 -2
- meta-box/meta-box-template.php +6 -4
- readme.txt +1 -1
- rules-configuration.json +9 -0
- vendor/autoload.php +1 -1
- vendor/composer/LICENSE +1 -1
- vendor/composer/autoload_classmap.php +0 -220
- vendor/composer/autoload_real.php +3 -3
- vendor/composer/installed.json +18 -16
- vendor/facebook/facebook-instant-articles-sdk-php/.travis.yml +26 -0
- vendor/facebook/facebook-instant-articles-sdk-php/CONTRIBUTING.md +3 -11
- vendor/facebook/facebook-instant-articles-sdk-php/README.md +21 -3
- vendor/facebook/facebook-instant-articles-sdk-php/composer.json +18 -2
- vendor/facebook/facebook-instant-articles-sdk-php/composer.lock +158 -29
- vendor/facebook/facebook-instant-articles-sdk-php/docs/QuickStart.md +186 -0
- vendor/facebook/facebook-instant-articles-sdk-php/phpcs.xml +8 -0
- vendor/facebook/facebook-instant-articles-sdk-php/phpunit.xml +6 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Client.php +13 -9
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/ClientException.php +1 -1
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Helper.php +8 -5
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/InstantArticleStatus.php +50 -18
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/ServerMessage.php +40 -6
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Ad.php +31 -6
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Analytics.php +24 -3
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Anchor.php +29 -8
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/AnimatedGIF.php +10 -5
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Audible.php +8 -5
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Audio.php +49 -9
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Author.php +39 -12
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Blockquote.php +14 -2
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Bold.php +11 -2
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Caption.php +86 -42
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Cite.php +39 -15
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Container.php +39 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Div.php +11 -2
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Element.php +43 -12
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Footer.php +81 -9
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/GeoTag.php +24 -7
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H1.php +40 -15
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H2.php +41 -16
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H3.php +135 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Header.php +181 -48
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Image.php +71 -14
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/InstantArticle.php +90 -19
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Interactive.php +52 -8
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Italic.php +8 -1
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/LineBreak.php +21 -2
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ListElement.php +58 -21
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ListItem.php +11 -3
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Map.php +62 -17
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Paragraph.php +11 -2
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Pullquote.php +15 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/RelatedArticles.php +50 -9
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/RelatedItem.php +30 -7
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Slideshow.php +77 -11
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/SocialEmbed.php +112 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Span.php +11 -2
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/TextContainer.php +53 -6
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Time.php +40 -12
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Video.php +101 -22
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/AbstractGetter.php +13 -5
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ChildrenGetter.php +0 -1
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ElementGetter.php +15 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/GetterFactory.php +10 -15
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/StringGetter.php +8 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/XpathGetter.php +8 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AdRule.php +2 -8
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AnalyticsRule.php +2 -8
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AnchorRule.php +5 -6
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AudioRule.php +2 -3
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AuthorRule.php +3 -3
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/BlockquoteRule.php +3 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/BoldRule.php +1 -5
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/CaptionCreditRule.php +8 -5
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/CaptionRule.php +7 -9
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ConfigurationSelectorRule.php +32 -3
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterRelatedArticlesRule.php +0 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterRule.php +0 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/GeoTagRule.php +1 -1
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H1Rule.php +8 -7
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H2Rule.php +8 -7
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderAdRule.php +2 -2
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderImageRule.php +2 -6
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderSubTitleRule.php +2 -5
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderTitleRule.php +2 -1
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/IgnoreRule.php +1 -5
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ImageRule.php +2 -6
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InstantArticleRule.php +2 -7
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InteractiveRule.php +2 -2
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ItalicRule.php +1 -5
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/LineBreakRule.php +1 -5
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ListElementRule.php +0 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ListItemRule.php +0 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ParagraphFooterRule.php +0 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ParagraphRule.php +0 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/PassThroughRule.php +0 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/PullquoteRule.php +0 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/RelatedArticlesRule.php +0 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/RelatedItemRule.php +2 -6
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/Rule.php +6 -6
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SlideshowImageRule.php +2 -6
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SocialEmbedRule.php +17 -3
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TextNodeRule.php +0 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TimeRule.php +0 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/VideoRule.php +6 -8
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Transformer.php +66 -18
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/InvalidSelector.php +33 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/UnrecognizedElement.php +22 -2
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/ValidatorWarning.php +80 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/validator_warning_messages.ini +42 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/InstantArticleValidator.php +54 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php +80 -30
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Client/ClientExceptionTest.php +13 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Client/ClientTest.php +40 -40
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Client/HelperTest.php +5 -5
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/AdTest.php +14 -3
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/AnalyticsTest.php +8 -2
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/AudioTest.php +9 -4
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/AuthorTest.php +8 -2
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/BlockquoteTest.php +7 -2
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/CaptionTest.php +9 -4
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/CiteTest.php +9 -4
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/FooterTest.php +7 -2
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/GeoTagTest.php +22 -16
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/H1Test.php +69 -4
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/H2Test.php +9 -4
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/H3Test.php +166 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/HeaderTest.php +71 -1
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/ImageTest.php +23 -17
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/InstantArticleTest.php +128 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/InteractiveTest.php +7 -2
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/ListElementTest.php +25 -4
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/MapTest.php +38 -31
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/ParagraphTest.php +63 -13
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/PullquoteTest.php +2 -11
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/RelatedArticlesTest.php +8 -2
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/SlideshowTest.php +22 -16
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/SocialEmbedTest.php +24 -2
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/TimeTest.php +10 -1
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/Validators/InstantArticleValidatorTest.php +131 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/Validators/TypeTest.php +99 -116
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/VideoTest.php +22 -16
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/WPTransformerTest.php +76 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp-ia.xml +22 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp-rules.json +270 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp.html +4 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/SimpleTransformerTest.php +14 -22
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/simple-ia.xml +2 -2
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/simple.html +2 -2
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/GeneratorTrait.php +32 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Rules/AuthorRuleTest.php +12 -17
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Rules/PullquoteRuleTest.php +45 -45
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Rules/RuleTest.php +32 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/TransformerTest.php +17 -19
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Warnings/InvalidSelectorTest.php +17 -23
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/instant-article-example.html +2 -2
- vendor/facebook/php-sdk-v4/LICENSE +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Authentication/AccessToken.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Authentication/AccessTokenMetadata.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Authentication/OAuth2Client.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookAuthenticationException.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookAuthorizationException.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookClientException.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookOtherException.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookResponseException.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookResumableUploadException.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookSDKException.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookServerException.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookThrottleException.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Facebook.php +2 -2
- vendor/facebook/php-sdk-v4/src/Facebook/FacebookApp.php +3 -3
- vendor/facebook/php-sdk-v4/src/Facebook/FacebookBatchRequest.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/FacebookBatchResponse.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/FacebookClient.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/FacebookRequest.php +3 -5
- vendor/facebook/php-sdk-v4/src/Facebook/FacebookResponse.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookFile.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookResumableUploader.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookTransferChunk.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookVideo.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/Mimetypes.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/Collection.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphAchievement.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphAlbum.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphApplication.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphCoverPhoto.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphEdge.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphEvent.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphGroup.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphList.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphLocation.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphNode.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphNodeFactory.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphObject.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphObjectFactory.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphPage.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphPicture.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphSessionInfo.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphUser.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookCanvasHelper.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookJavaScriptHelper.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookPageTabHelper.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookRedirectLoginHelper.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Http/GraphRawResponse.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyInterface.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyMultipart.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyUrlEncoded.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookCurl.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookCurlHttpClient.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookHttpClientInterface.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookStream.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookStreamHttpClient.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/HttpClientsFactory.php +2 -1
- vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/PersistentDataFactory.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/PersistentDataInterface.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php +6 -2
- vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/SignedRequest.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Url/FacebookUrlDetectionHandler.php +21 -3
- vendor/facebook/php-sdk-v4/src/Facebook/Url/FacebookUrlManipulator.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/Url/UrlDetectionInterface.php +1 -1
- vendor/facebook/php-sdk-v4/src/Facebook/autoload.php +1 -1
class-instant-articles-post.php
CHANGED
@@ -290,10 +290,6 @@ class Instant_Articles_Post {
|
|
290 |
|
291 |
global $post, $more;
|
292 |
|
293 |
-
if ( ! $post ) {
|
294 |
-
return '';
|
295 |
-
}
|
296 |
-
|
297 |
// Force $more.
|
298 |
$orig_more = $more;
|
299 |
$more = 1;
|
@@ -624,7 +620,9 @@ class Instant_Articles_Post {
|
|
624 |
$this->instant_article =
|
625 |
InstantArticle::create()
|
626 |
->withCanonicalUrl( $this->get_canonical_url() )
|
627 |
-
->withHeader( $header )
|
|
|
|
|
628 |
|
629 |
$settings_style = Instant_Articles_Option_Styles::get_option_decoded();
|
630 |
if ( isset( $settings_style['article_style'] ) && ! empty ( $settings_style['article_style'] ) ) {
|
290 |
|
291 |
global $post, $more;
|
292 |
|
|
|
|
|
|
|
|
|
293 |
// Force $more.
|
294 |
$orig_more = $more;
|
295 |
$more = 1;
|
620 |
$this->instant_article =
|
621 |
InstantArticle::create()
|
622 |
->withCanonicalUrl( $this->get_canonical_url() )
|
623 |
+
->withHeader( $header )
|
624 |
+
->addMetaProperty( 'op:generator:application', 'facebook-instant-articles-wp' )
|
625 |
+
->addMetaProperty( 'op:generator:application:version', IA_PLUGIN_VERSION );
|
626 |
|
627 |
$settings_style = Instant_Articles_Option_Styles::get_option_decoded();
|
628 |
if ( isset( $settings_style['article_style'] ) && ! empty ( $settings_style['article_style'] ) ) {
|
facebook-instant-articles.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Description: Add support for Instant Articles for Facebook to your WordPress site.
|
5 |
* Author: Automattic, Dekode, Facebook
|
6 |
* Author URI: https://vip.wordpress.com/plugins/instant-articles/
|
7 |
-
* Version: 2.
|
8 |
* Text Domain: instant-articles
|
9 |
* License: GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -67,7 +67,7 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
67 |
|
68 |
defined( 'ABSPATH' ) || die( 'Shame on you' );
|
69 |
|
70 |
-
define( 'IA_PLUGIN_VERSION', '2.
|
71 |
define( 'IA_PLUGIN_PATH_FULL', __FILE__ );
|
72 |
define( 'IA_PLUGIN_PATH', plugin_basename( __FILE__ ) );
|
73 |
define( 'IA_PLUGIN_FILE_BASENAME', pathinfo( __FILE__, PATHINFO_FILENAME ) );
|
4 |
* Description: Add support for Instant Articles for Facebook to your WordPress site.
|
5 |
* Author: Automattic, Dekode, Facebook
|
6 |
* Author URI: https://vip.wordpress.com/plugins/instant-articles/
|
7 |
+
* Version: 2.11
|
8 |
* Text Domain: instant-articles
|
9 |
* License: GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
67 |
|
68 |
defined( 'ABSPATH' ) || die( 'Shame on you' );
|
69 |
|
70 |
+
define( 'IA_PLUGIN_VERSION', '2.11' );
|
71 |
define( 'IA_PLUGIN_PATH_FULL', __FILE__ );
|
72 |
define( 'IA_PLUGIN_PATH', plugin_basename( __FILE__ ) );
|
73 |
define( 'IA_PLUGIN_FILE_BASENAME', pathinfo( __FILE__, PATHINFO_FILENAME ) );
|
meta-box/meta-box-template.php
CHANGED
@@ -15,7 +15,7 @@ use Facebook\InstantArticles\Client\ServerMessage;
|
|
15 |
<p>
|
16 |
<b>
|
17 |
<span class="dashicons dashicons-media-document"></span>
|
18 |
-
Your post will be submitted to Instant Articles once
|
19 |
</b>
|
20 |
</p>
|
21 |
|
@@ -151,9 +151,11 @@ use Facebook\InstantArticles\Client\ServerMessage;
|
|
151 |
<?php echo esc_html( $warning ); ?>
|
152 |
<span>
|
153 |
<?php
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
|
|
157 |
?>
|
158 |
</span>
|
159 |
</div>
|
15 |
<p>
|
16 |
<b>
|
17 |
<span class="dashicons dashicons-media-document"></span>
|
18 |
+
Your post will be submitted to Instant Articles once it is published.
|
19 |
</b>
|
20 |
</p>
|
21 |
|
151 |
<?php echo esc_html( $warning ); ?>
|
152 |
<span>
|
153 |
<?php
|
154 |
+
if ( $warning->getNode() ) {
|
155 |
+
echo esc_html(
|
156 |
+
$warning->getNode()->ownerDocument->saveHTML( $warning->getNode() )
|
157 |
+
);
|
158 |
+
}
|
159 |
?>
|
160 |
</span>
|
161 |
</div>
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: trrine, olethomas, bjornjohansen, dekode, automattic, facebook
|
|
3 |
Tags: instant articles, facebook, mobile
|
4 |
Requires at least: 4.3
|
5 |
Tested up to: 4.5
|
6 |
-
Stable tag: 2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
3 |
Tags: instant articles, facebook, mobile
|
4 |
Requires at least: 4.3
|
5 |
Tested up to: 4.5
|
6 |
+
Stable tag: 2.11
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
rules-configuration.json
CHANGED
@@ -169,6 +169,15 @@
|
|
169 |
"interactive.iframe" : {
|
170 |
"type" : "children",
|
171 |
"selector" : "div.interactive"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
}
|
174 |
}, {
|
169 |
"interactive.iframe" : {
|
170 |
"type" : "children",
|
171 |
"selector" : "div.interactive"
|
172 |
+
},
|
173 |
+
"interactive.height" : {
|
174 |
+
"type" : "int",
|
175 |
+
"selector" : "iframe",
|
176 |
+
"attribute": "height"
|
177 |
+
},
|
178 |
+
"interactive.iframe" : {
|
179 |
+
"type" : "children",
|
180 |
+
"selector" : "iframe"
|
181 |
}
|
182 |
}
|
183 |
}, {
|
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 ComposerAutoloaderInite7aef46e213cc4ff326adce2c422ab9d::getLoader();
|
vendor/composer/LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
|
2 |
-
Copyright (c)
|
3 |
|
4 |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
of this software and associated documentation files (the "Software"), to deal
|
1 |
|
2 |
+
Copyright (c) 2016 Nils Adermann, Jordi Boggiano
|
3 |
|
4 |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
of this software and associated documentation files (the "Software"), to deal
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -6,177 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
|
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
9 |
-
'Facebook\\Authentication\\AccessToken' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Authentication/AccessToken.php',
|
10 |
-
'Facebook\\Authentication\\AccessTokenMetadata' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Authentication/AccessTokenMetadata.php',
|
11 |
-
'Facebook\\Authentication\\OAuth2Client' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Authentication/OAuth2Client.php',
|
12 |
-
'Facebook\\Exceptions\\FacebookAuthenticationException' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookAuthenticationException.php',
|
13 |
-
'Facebook\\Exceptions\\FacebookAuthorizationException' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookAuthorizationException.php',
|
14 |
-
'Facebook\\Exceptions\\FacebookClientException' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookClientException.php',
|
15 |
-
'Facebook\\Exceptions\\FacebookOtherException' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookOtherException.php',
|
16 |
-
'Facebook\\Exceptions\\FacebookResponseException' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookResponseException.php',
|
17 |
-
'Facebook\\Exceptions\\FacebookResumableUploadException' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookResumableUploadException.php',
|
18 |
-
'Facebook\\Exceptions\\FacebookSDKException' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookSDKException.php',
|
19 |
-
'Facebook\\Exceptions\\FacebookServerException' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookServerException.php',
|
20 |
-
'Facebook\\Exceptions\\FacebookThrottleException' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookThrottleException.php',
|
21 |
-
'Facebook\\Facebook' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Facebook.php',
|
22 |
-
'Facebook\\FacebookApp' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/FacebookApp.php',
|
23 |
-
'Facebook\\FacebookBatchRequest' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/FacebookBatchRequest.php',
|
24 |
-
'Facebook\\FacebookBatchResponse' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/FacebookBatchResponse.php',
|
25 |
-
'Facebook\\FacebookClient' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/FacebookClient.php',
|
26 |
-
'Facebook\\FacebookRequest' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/FacebookRequest.php',
|
27 |
-
'Facebook\\FacebookResponse' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/FacebookResponse.php',
|
28 |
-
'Facebook\\FileUpload\\FacebookFile' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookFile.php',
|
29 |
-
'Facebook\\FileUpload\\FacebookResumableUploader' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookResumableUploader.php',
|
30 |
-
'Facebook\\FileUpload\\FacebookTransferChunk' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookTransferChunk.php',
|
31 |
-
'Facebook\\FileUpload\\FacebookVideo' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookVideo.php',
|
32 |
-
'Facebook\\FileUpload\\Mimetypes' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/FileUpload/Mimetypes.php',
|
33 |
-
'Facebook\\GraphNodes\\Collection' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/Collection.php',
|
34 |
-
'Facebook\\GraphNodes\\GraphAchievement' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphAchievement.php',
|
35 |
-
'Facebook\\GraphNodes\\GraphAlbum' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphAlbum.php',
|
36 |
-
'Facebook\\GraphNodes\\GraphApplication' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphApplication.php',
|
37 |
-
'Facebook\\GraphNodes\\GraphCoverPhoto' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphCoverPhoto.php',
|
38 |
-
'Facebook\\GraphNodes\\GraphEdge' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphEdge.php',
|
39 |
-
'Facebook\\GraphNodes\\GraphEvent' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphEvent.php',
|
40 |
-
'Facebook\\GraphNodes\\GraphGroup' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphGroup.php',
|
41 |
-
'Facebook\\GraphNodes\\GraphList' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphList.php',
|
42 |
-
'Facebook\\GraphNodes\\GraphLocation' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphLocation.php',
|
43 |
-
'Facebook\\GraphNodes\\GraphNode' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphNode.php',
|
44 |
-
'Facebook\\GraphNodes\\GraphNodeFactory' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphNodeFactory.php',
|
45 |
-
'Facebook\\GraphNodes\\GraphObject' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphObject.php',
|
46 |
-
'Facebook\\GraphNodes\\GraphObjectFactory' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphObjectFactory.php',
|
47 |
-
'Facebook\\GraphNodes\\GraphPage' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphPage.php',
|
48 |
-
'Facebook\\GraphNodes\\GraphPicture' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphPicture.php',
|
49 |
-
'Facebook\\GraphNodes\\GraphSessionInfo' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphSessionInfo.php',
|
50 |
-
'Facebook\\GraphNodes\\GraphUser' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphUser.php',
|
51 |
-
'Facebook\\Helpers\\FacebookCanvasHelper' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookCanvasHelper.php',
|
52 |
-
'Facebook\\Helpers\\FacebookJavaScriptHelper' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookJavaScriptHelper.php',
|
53 |
-
'Facebook\\Helpers\\FacebookPageTabHelper' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookPageTabHelper.php',
|
54 |
-
'Facebook\\Helpers\\FacebookRedirectLoginHelper' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookRedirectLoginHelper.php',
|
55 |
-
'Facebook\\Helpers\\FacebookSignedRequestFromInputHelper' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php',
|
56 |
-
'Facebook\\HttpClients\\FacebookCurl' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookCurl.php',
|
57 |
-
'Facebook\\HttpClients\\FacebookCurlHttpClient' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookCurlHttpClient.php',
|
58 |
-
'Facebook\\HttpClients\\FacebookGuzzleHttpClient' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php',
|
59 |
-
'Facebook\\HttpClients\\FacebookHttpClientInterface' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookHttpClientInterface.php',
|
60 |
-
'Facebook\\HttpClients\\FacebookStream' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookStream.php',
|
61 |
-
'Facebook\\HttpClients\\FacebookStreamHttpClient' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookStreamHttpClient.php',
|
62 |
-
'Facebook\\HttpClients\\HttpClientsFactory' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/HttpClients/HttpClientsFactory.php',
|
63 |
-
'Facebook\\Http\\GraphRawResponse' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Http/GraphRawResponse.php',
|
64 |
-
'Facebook\\Http\\RequestBodyInterface' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyInterface.php',
|
65 |
-
'Facebook\\Http\\RequestBodyMultipart' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyMultipart.php',
|
66 |
-
'Facebook\\Http\\RequestBodyUrlEncoded' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyUrlEncoded.php',
|
67 |
-
'Facebook\\InstantArticles\\Client\\Client' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Client.php',
|
68 |
-
'Facebook\\InstantArticles\\Client\\ClientException' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/ClientException.php',
|
69 |
-
'Facebook\\InstantArticles\\Client\\Helper' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Helper.php',
|
70 |
-
'Facebook\\InstantArticles\\Client\\InstantArticleStatus' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/InstantArticleStatus.php',
|
71 |
-
'Facebook\\InstantArticles\\Client\\ServerMessage' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/ServerMessage.php',
|
72 |
-
'Facebook\\InstantArticles\\Elements\\Ad' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Ad.php',
|
73 |
-
'Facebook\\InstantArticles\\Elements\\Analytics' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Analytics.php',
|
74 |
-
'Facebook\\InstantArticles\\Elements\\Anchor' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Anchor.php',
|
75 |
-
'Facebook\\InstantArticles\\Elements\\AnimatedGIF' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/AnimatedGIF.php',
|
76 |
-
'Facebook\\InstantArticles\\Elements\\Audible' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Audible.php',
|
77 |
-
'Facebook\\InstantArticles\\Elements\\Audio' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Audio.php',
|
78 |
-
'Facebook\\InstantArticles\\Elements\\Author' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Author.php',
|
79 |
-
'Facebook\\InstantArticles\\Elements\\Blockquote' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Blockquote.php',
|
80 |
-
'Facebook\\InstantArticles\\Elements\\Bold' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Bold.php',
|
81 |
-
'Facebook\\InstantArticles\\Elements\\Caption' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Caption.php',
|
82 |
-
'Facebook\\InstantArticles\\Elements\\Cite' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Cite.php',
|
83 |
-
'Facebook\\InstantArticles\\Elements\\Div' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Div.php',
|
84 |
-
'Facebook\\InstantArticles\\Elements\\Element' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Element.php',
|
85 |
-
'Facebook\\InstantArticles\\Elements\\Footer' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Footer.php',
|
86 |
-
'Facebook\\InstantArticles\\Elements\\FormattedText' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/FormattedText.php',
|
87 |
-
'Facebook\\InstantArticles\\Elements\\GeoTag' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/GeoTag.php',
|
88 |
-
'Facebook\\InstantArticles\\Elements\\H1' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H1.php',
|
89 |
-
'Facebook\\InstantArticles\\Elements\\H2' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H2.php',
|
90 |
-
'Facebook\\InstantArticles\\Elements\\Header' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Header.php',
|
91 |
-
'Facebook\\InstantArticles\\Elements\\Image' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Image.php',
|
92 |
-
'Facebook\\InstantArticles\\Elements\\InstantArticle' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/InstantArticle.php',
|
93 |
-
'Facebook\\InstantArticles\\Elements\\Interactive' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Interactive.php',
|
94 |
-
'Facebook\\InstantArticles\\Elements\\Italic' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Italic.php',
|
95 |
-
'Facebook\\InstantArticles\\Elements\\LineBreak' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/LineBreak.php',
|
96 |
-
'Facebook\\InstantArticles\\Elements\\ListElement' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ListElement.php',
|
97 |
-
'Facebook\\InstantArticles\\Elements\\ListItem' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ListItem.php',
|
98 |
-
'Facebook\\InstantArticles\\Elements\\Map' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Map.php',
|
99 |
-
'Facebook\\InstantArticles\\Elements\\Paragraph' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Paragraph.php',
|
100 |
-
'Facebook\\InstantArticles\\Elements\\Pullquote' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Pullquote.php',
|
101 |
-
'Facebook\\InstantArticles\\Elements\\RelatedArticles' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/RelatedArticles.php',
|
102 |
-
'Facebook\\InstantArticles\\Elements\\RelatedItem' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/RelatedItem.php',
|
103 |
-
'Facebook\\InstantArticles\\Elements\\Slideshow' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Slideshow.php',
|
104 |
-
'Facebook\\InstantArticles\\Elements\\SocialEmbed' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/SocialEmbed.php',
|
105 |
-
'Facebook\\InstantArticles\\Elements\\Span' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Span.php',
|
106 |
-
'Facebook\\InstantArticles\\Elements\\TextContainer' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/TextContainer.php',
|
107 |
-
'Facebook\\InstantArticles\\Elements\\Time' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Time.php',
|
108 |
-
'Facebook\\InstantArticles\\Elements\\Video' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Video.php',
|
109 |
-
'Facebook\\InstantArticles\\Transformer\\Getters\\AbstractGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/AbstractGetter.php',
|
110 |
-
'Facebook\\InstantArticles\\Transformer\\Getters\\ChildrenGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ChildrenGetter.php',
|
111 |
-
'Facebook\\InstantArticles\\Transformer\\Getters\\ElementGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ElementGetter.php',
|
112 |
-
'Facebook\\InstantArticles\\Transformer\\Getters\\ExistsGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ExistsGetter.php',
|
113 |
-
'Facebook\\InstantArticles\\Transformer\\Getters\\GetterFactory' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/GetterFactory.php',
|
114 |
-
'Facebook\\InstantArticles\\Transformer\\Getters\\IntegerGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/IntegerGetter.php',
|
115 |
-
'Facebook\\InstantArticles\\Transformer\\Getters\\NextSiblingGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/NextSiblingGetter.php',
|
116 |
-
'Facebook\\InstantArticles\\Transformer\\Getters\\StringGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/StringGetter.php',
|
117 |
-
'Facebook\\InstantArticles\\Transformer\\Getters\\XpathGetter' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/XpathGetter.php',
|
118 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\AdRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AdRule.php',
|
119 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\AnalyticsRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AnalyticsRule.php',
|
120 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\AnchorRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AnchorRule.php',
|
121 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\AudioRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AudioRule.php',
|
122 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\AuthorRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AuthorRule.php',
|
123 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\BlockquoteRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/BlockquoteRule.php',
|
124 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\BoldRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/BoldRule.php',
|
125 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\CaptionCreditRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/CaptionCreditRule.php',
|
126 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\CaptionRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/CaptionRule.php',
|
127 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\ConfigurationSelectorRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ConfigurationSelectorRule.php',
|
128 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\FooterRelatedArticlesRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterRelatedArticlesRule.php',
|
129 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\FooterRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterRule.php',
|
130 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\GeoTagRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/GeoTagRule.php',
|
131 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\H1Rule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H1Rule.php',
|
132 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\H2Rule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H2Rule.php',
|
133 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderAdRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderAdRule.php',
|
134 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderImageRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderImageRule.php',
|
135 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderKickerRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderKickerRule.php',
|
136 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderRule.php',
|
137 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderSubTitleRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderSubTitleRule.php',
|
138 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\HeaderTitleRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderTitleRule.php',
|
139 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\IgnoreRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/IgnoreRule.php',
|
140 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\ImageRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ImageRule.php',
|
141 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\InstantArticleRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InstantArticleRule.php',
|
142 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\InteractiveRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InteractiveRule.php',
|
143 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\ItalicRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ItalicRule.php',
|
144 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\LineBreakRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/LineBreakRule.php',
|
145 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\ListElementRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ListElementRule.php',
|
146 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\ListItemRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ListItemRule.php',
|
147 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\MapRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/MapRule.php',
|
148 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\ParagraphFooterRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ParagraphFooterRule.php',
|
149 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\ParagraphRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ParagraphRule.php',
|
150 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\PassThroughRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/PassThroughRule.php',
|
151 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\PullquoteCiteRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/PullquoteCiteRule.php',
|
152 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\PullquoteRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/PullquoteRule.php',
|
153 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\RelatedArticlesRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/RelatedArticlesRule.php',
|
154 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\RelatedItemRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/RelatedItemRule.php',
|
155 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\Rule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/Rule.php',
|
156 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\SlideshowImageRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SlideshowImageRule.php',
|
157 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\SlideshowRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SlideshowRule.php',
|
158 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\SocialEmbedRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SocialEmbedRule.php',
|
159 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\TextNodeRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TextNodeRule.php',
|
160 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\TimeRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TimeRule.php',
|
161 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\VideoRule' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/VideoRule.php',
|
162 |
-
'Facebook\\InstantArticles\\Transformer\\Transformer' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Transformer.php',
|
163 |
-
'Facebook\\InstantArticles\\Transformer\\Warnings\\InvalidSelector' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/InvalidSelector.php',
|
164 |
-
'Facebook\\InstantArticles\\Transformer\\Warnings\\UnrecognizedElement' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/UnrecognizedElement.php',
|
165 |
-
'Facebook\\InstantArticles\\Validators\\Type' => $vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php',
|
166 |
-
'Facebook\\PersistentData\\FacebookMemoryPersistentDataHandler' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php',
|
167 |
-
'Facebook\\PersistentData\\FacebookSessionPersistentDataHandler' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php',
|
168 |
-
'Facebook\\PersistentData\\PersistentDataFactory' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/PersistentData/PersistentDataFactory.php',
|
169 |
-
'Facebook\\PersistentData\\PersistentDataInterface' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/PersistentData/PersistentDataInterface.php',
|
170 |
-
'Facebook\\PseudoRandomString\\McryptPseudoRandomStringGenerator' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php',
|
171 |
-
'Facebook\\PseudoRandomString\\OpenSslPseudoRandomStringGenerator' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php',
|
172 |
-
'Facebook\\PseudoRandomString\\PseudoRandomStringGeneratorFactory' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php',
|
173 |
-
'Facebook\\PseudoRandomString\\PseudoRandomStringGeneratorInterface' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php',
|
174 |
-
'Facebook\\PseudoRandomString\\PseudoRandomStringGeneratorTrait' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php',
|
175 |
-
'Facebook\\PseudoRandomString\\UrandomPseudoRandomStringGenerator' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php',
|
176 |
-
'Facebook\\SignedRequest' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/SignedRequest.php',
|
177 |
-
'Facebook\\Url\\FacebookUrlDetectionHandler' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Url/FacebookUrlDetectionHandler.php',
|
178 |
-
'Facebook\\Url\\FacebookUrlManipulator' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Url/FacebookUrlManipulator.php',
|
179 |
-
'Facebook\\Url\\UrlDetectionInterface' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/Url/UrlDetectionInterface.php',
|
180 |
'Logger' => $vendorDir . '/apache/log4php/src/main/php/Logger.php',
|
181 |
'LoggerAppender' => $vendorDir . '/apache/log4php/src/main/php/LoggerAppender.php',
|
182 |
'LoggerAppenderConsole' => $vendorDir . '/apache/log4php/src/main/php/appenders/LoggerAppenderConsole.php',
|
@@ -256,53 +85,4 @@ return array(
|
|
256 |
'LoggerRoot' => $vendorDir . '/apache/log4php/src/main/php/LoggerRoot.php',
|
257 |
'LoggerThrowableInformation' => $vendorDir . '/apache/log4php/src/main/php/LoggerThrowableInformation.php',
|
258 |
'LoggerUtils' => $vendorDir . '/apache/log4php/src/main/php/helpers/LoggerUtils.php',
|
259 |
-
'Symfony\\Component\\CssSelector\\CssSelector' => $vendorDir . '/symfony/css-selector/CssSelector.php',
|
260 |
-
'Symfony\\Component\\CssSelector\\CssSelectorConverter' => $vendorDir . '/symfony/css-selector/CssSelectorConverter.php',
|
261 |
-
'Symfony\\Component\\CssSelector\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/css-selector/Exception/ExceptionInterface.php',
|
262 |
-
'Symfony\\Component\\CssSelector\\Exception\\ExpressionErrorException' => $vendorDir . '/symfony/css-selector/Exception/ExpressionErrorException.php',
|
263 |
-
'Symfony\\Component\\CssSelector\\Exception\\InternalErrorException' => $vendorDir . '/symfony/css-selector/Exception/InternalErrorException.php',
|
264 |
-
'Symfony\\Component\\CssSelector\\Exception\\ParseException' => $vendorDir . '/symfony/css-selector/Exception/ParseException.php',
|
265 |
-
'Symfony\\Component\\CssSelector\\Exception\\SyntaxErrorException' => $vendorDir . '/symfony/css-selector/Exception/SyntaxErrorException.php',
|
266 |
-
'Symfony\\Component\\CssSelector\\Node\\AbstractNode' => $vendorDir . '/symfony/css-selector/Node/AbstractNode.php',
|
267 |
-
'Symfony\\Component\\CssSelector\\Node\\AttributeNode' => $vendorDir . '/symfony/css-selector/Node/AttributeNode.php',
|
268 |
-
'Symfony\\Component\\CssSelector\\Node\\ClassNode' => $vendorDir . '/symfony/css-selector/Node/ClassNode.php',
|
269 |
-
'Symfony\\Component\\CssSelector\\Node\\CombinedSelectorNode' => $vendorDir . '/symfony/css-selector/Node/CombinedSelectorNode.php',
|
270 |
-
'Symfony\\Component\\CssSelector\\Node\\ElementNode' => $vendorDir . '/symfony/css-selector/Node/ElementNode.php',
|
271 |
-
'Symfony\\Component\\CssSelector\\Node\\FunctionNode' => $vendorDir . '/symfony/css-selector/Node/FunctionNode.php',
|
272 |
-
'Symfony\\Component\\CssSelector\\Node\\HashNode' => $vendorDir . '/symfony/css-selector/Node/HashNode.php',
|
273 |
-
'Symfony\\Component\\CssSelector\\Node\\NegationNode' => $vendorDir . '/symfony/css-selector/Node/NegationNode.php',
|
274 |
-
'Symfony\\Component\\CssSelector\\Node\\NodeInterface' => $vendorDir . '/symfony/css-selector/Node/NodeInterface.php',
|
275 |
-
'Symfony\\Component\\CssSelector\\Node\\PseudoNode' => $vendorDir . '/symfony/css-selector/Node/PseudoNode.php',
|
276 |
-
'Symfony\\Component\\CssSelector\\Node\\SelectorNode' => $vendorDir . '/symfony/css-selector/Node/SelectorNode.php',
|
277 |
-
'Symfony\\Component\\CssSelector\\Node\\Specificity' => $vendorDir . '/symfony/css-selector/Node/Specificity.php',
|
278 |
-
'Symfony\\Component\\CssSelector\\Parser\\Handler\\CommentHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/CommentHandler.php',
|
279 |
-
'Symfony\\Component\\CssSelector\\Parser\\Handler\\HandlerInterface' => $vendorDir . '/symfony/css-selector/Parser/Handler/HandlerInterface.php',
|
280 |
-
'Symfony\\Component\\CssSelector\\Parser\\Handler\\HashHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/HashHandler.php',
|
281 |
-
'Symfony\\Component\\CssSelector\\Parser\\Handler\\IdentifierHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/IdentifierHandler.php',
|
282 |
-
'Symfony\\Component\\CssSelector\\Parser\\Handler\\NumberHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/NumberHandler.php',
|
283 |
-
'Symfony\\Component\\CssSelector\\Parser\\Handler\\StringHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/StringHandler.php',
|
284 |
-
'Symfony\\Component\\CssSelector\\Parser\\Handler\\WhitespaceHandler' => $vendorDir . '/symfony/css-selector/Parser/Handler/WhitespaceHandler.php',
|
285 |
-
'Symfony\\Component\\CssSelector\\Parser\\Parser' => $vendorDir . '/symfony/css-selector/Parser/Parser.php',
|
286 |
-
'Symfony\\Component\\CssSelector\\Parser\\ParserInterface' => $vendorDir . '/symfony/css-selector/Parser/ParserInterface.php',
|
287 |
-
'Symfony\\Component\\CssSelector\\Parser\\Reader' => $vendorDir . '/symfony/css-selector/Parser/Reader.php',
|
288 |
-
'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\ClassParser' => $vendorDir . '/symfony/css-selector/Parser/Shortcut/ClassParser.php',
|
289 |
-
'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\ElementParser' => $vendorDir . '/symfony/css-selector/Parser/Shortcut/ElementParser.php',
|
290 |
-
'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\EmptyStringParser' => $vendorDir . '/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php',
|
291 |
-
'Symfony\\Component\\CssSelector\\Parser\\Shortcut\\HashParser' => $vendorDir . '/symfony/css-selector/Parser/Shortcut/HashParser.php',
|
292 |
-
'Symfony\\Component\\CssSelector\\Parser\\Token' => $vendorDir . '/symfony/css-selector/Parser/Token.php',
|
293 |
-
'Symfony\\Component\\CssSelector\\Parser\\TokenStream' => $vendorDir . '/symfony/css-selector/Parser/TokenStream.php',
|
294 |
-
'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\Tokenizer' => $vendorDir . '/symfony/css-selector/Parser/Tokenizer/Tokenizer.php',
|
295 |
-
'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\TokenizerEscaping' => $vendorDir . '/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php',
|
296 |
-
'Symfony\\Component\\CssSelector\\Parser\\Tokenizer\\TokenizerPatterns' => $vendorDir . '/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php',
|
297 |
-
'Symfony\\Component\\CssSelector\\XPath\\Extension\\AbstractExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/AbstractExtension.php',
|
298 |
-
'Symfony\\Component\\CssSelector\\XPath\\Extension\\AttributeMatchingExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php',
|
299 |
-
'Symfony\\Component\\CssSelector\\XPath\\Extension\\CombinationExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/CombinationExtension.php',
|
300 |
-
'Symfony\\Component\\CssSelector\\XPath\\Extension\\ExtensionInterface' => $vendorDir . '/symfony/css-selector/XPath/Extension/ExtensionInterface.php',
|
301 |
-
'Symfony\\Component\\CssSelector\\XPath\\Extension\\FunctionExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/FunctionExtension.php',
|
302 |
-
'Symfony\\Component\\CssSelector\\XPath\\Extension\\HtmlExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/HtmlExtension.php',
|
303 |
-
'Symfony\\Component\\CssSelector\\XPath\\Extension\\NodeExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/NodeExtension.php',
|
304 |
-
'Symfony\\Component\\CssSelector\\XPath\\Extension\\PseudoClassExtension' => $vendorDir . '/symfony/css-selector/XPath/Extension/PseudoClassExtension.php',
|
305 |
-
'Symfony\\Component\\CssSelector\\XPath\\Translator' => $vendorDir . '/symfony/css-selector/XPath/Translator.php',
|
306 |
-
'Symfony\\Component\\CssSelector\\XPath\\TranslatorInterface' => $vendorDir . '/symfony/css-selector/XPath/TranslatorInterface.php',
|
307 |
-
'Symfony\\Component\\CssSelector\\XPath\\XPathExpr' => $vendorDir . '/symfony/css-selector/XPath/XPathExpr.php',
|
308 |
);
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
'Logger' => $vendorDir . '/apache/log4php/src/main/php/Logger.php',
|
10 |
'LoggerAppender' => $vendorDir . '/apache/log4php/src/main/php/LoggerAppender.php',
|
11 |
'LoggerAppenderConsole' => $vendorDir . '/apache/log4php/src/main/php/appenders/LoggerAppenderConsole.php',
|
85 |
'LoggerRoot' => $vendorDir . '/apache/log4php/src/main/php/LoggerRoot.php',
|
86 |
'LoggerThrowableInformation' => $vendorDir . '/apache/log4php/src/main/php/LoggerThrowableInformation.php',
|
87 |
'LoggerUtils' => $vendorDir . '/apache/log4php/src/main/php/helpers/LoggerUtils.php',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
);
|
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,9 +19,9 @@ class ComposerAutoloaderInitfd388dc88fcfe23659ac38193fdb101e
|
|
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 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInite7aef46e213cc4ff326adce2c422ab9d
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInite7aef46e213cc4ff326adce2c422ab9d', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInite7aef46e213cc4ff326adce2c422ab9d', 'loadClassLoader'));
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|
vendor/composer/installed.json
CHANGED
@@ -33,17 +33,17 @@
|
|
33 |
},
|
34 |
{
|
35 |
"name": "facebook/php-sdk-v4",
|
36 |
-
"version": "5.1.
|
37 |
-
"version_normalized": "5.1.
|
38 |
"source": {
|
39 |
"type": "git",
|
40 |
"url": "https://github.com/facebook/facebook-php-sdk-v4.git",
|
41 |
-
"reference": "
|
42 |
},
|
43 |
"dist": {
|
44 |
"type": "zip",
|
45 |
-
"url": "https://api.github.com/repos/facebook/facebook-php-sdk-v4/zipball/
|
46 |
-
"reference": "
|
47 |
"shasum": ""
|
48 |
},
|
49 |
"require": {
|
@@ -58,7 +58,7 @@
|
|
58 |
"suggest": {
|
59 |
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
|
60 |
},
|
61 |
-
"time": "
|
62 |
"type": "library",
|
63 |
"extra": {
|
64 |
"branch-alias": {
|
@@ -90,8 +90,8 @@
|
|
90 |
},
|
91 |
{
|
92 |
"name": "symfony/css-selector",
|
93 |
-
"version": "v2.8.
|
94 |
-
"version_normalized": "2.8.
|
95 |
"source": {
|
96 |
"type": "git",
|
97 |
"url": "https://github.com/symfony/css-selector.git",
|
@@ -145,17 +145,17 @@
|
|
145 |
},
|
146 |
{
|
147 |
"name": "facebook/facebook-instant-articles-sdk-php",
|
148 |
-
"version": "v1.0
|
149 |
-
"version_normalized": "1.0.
|
150 |
"source": {
|
151 |
"type": "git",
|
152 |
"url": "https://github.com/facebook/facebook-instant-articles-sdk-php.git",
|
153 |
-
"reference": "
|
154 |
},
|
155 |
"dist": {
|
156 |
"type": "zip",
|
157 |
-
"url": "https://api.github.com/repos/facebook/facebook-instant-articles-sdk-php/zipball/
|
158 |
-
"reference": "
|
159 |
"shasum": ""
|
160 |
},
|
161 |
"require": {
|
@@ -165,9 +165,11 @@
|
|
165 |
"symfony/css-selector": "2.8.*"
|
166 |
},
|
167 |
"require-dev": {
|
168 |
-
"
|
|
|
|
|
169 |
},
|
170 |
-
"time": "2016-
|
171 |
"type": "library",
|
172 |
"installation-source": "dist",
|
173 |
"autoload": {
|
@@ -177,7 +179,7 @@
|
|
177 |
},
|
178 |
"notification-url": "https://packagist.org/downloads/",
|
179 |
"license": [
|
180 |
-
"
|
181 |
],
|
182 |
"authors": [
|
183 |
{
|
33 |
},
|
34 |
{
|
35 |
"name": "facebook/php-sdk-v4",
|
36 |
+
"version": "5.1.4",
|
37 |
+
"version_normalized": "5.1.4.0",
|
38 |
"source": {
|
39 |
"type": "git",
|
40 |
"url": "https://github.com/facebook/facebook-php-sdk-v4.git",
|
41 |
+
"reference": "38fd7187a6704d3ab14ded2f3a534ac4ee6f3481"
|
42 |
},
|
43 |
"dist": {
|
44 |
"type": "zip",
|
45 |
+
"url": "https://api.github.com/repos/facebook/facebook-php-sdk-v4/zipball/38fd7187a6704d3ab14ded2f3a534ac4ee6f3481",
|
46 |
+
"reference": "38fd7187a6704d3ab14ded2f3a534ac4ee6f3481",
|
47 |
"shasum": ""
|
48 |
},
|
49 |
"require": {
|
58 |
"suggest": {
|
59 |
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
|
60 |
},
|
61 |
+
"time": "2016-05-13 17:28:30",
|
62 |
"type": "library",
|
63 |
"extra": {
|
64 |
"branch-alias": {
|
90 |
},
|
91 |
{
|
92 |
"name": "symfony/css-selector",
|
93 |
+
"version": "v2.8.6",
|
94 |
+
"version_normalized": "2.8.6.0",
|
95 |
"source": {
|
96 |
"type": "git",
|
97 |
"url": "https://github.com/symfony/css-selector.git",
|
145 |
},
|
146 |
{
|
147 |
"name": "facebook/facebook-instant-articles-sdk-php",
|
148 |
+
"version": "v1.1.0",
|
149 |
+
"version_normalized": "1.1.0.0",
|
150 |
"source": {
|
151 |
"type": "git",
|
152 |
"url": "https://github.com/facebook/facebook-instant-articles-sdk-php.git",
|
153 |
+
"reference": "989a4d887dcd01b7480bbb685b9a6bf94c45b827"
|
154 |
},
|
155 |
"dist": {
|
156 |
"type": "zip",
|
157 |
+
"url": "https://api.github.com/repos/facebook/facebook-instant-articles-sdk-php/zipball/989a4d887dcd01b7480bbb685b9a6bf94c45b827",
|
158 |
+
"reference": "989a4d887dcd01b7480bbb685b9a6bf94c45b827",
|
159 |
"shasum": ""
|
160 |
},
|
161 |
"require": {
|
165 |
"symfony/css-selector": "2.8.*"
|
166 |
},
|
167 |
"require-dev": {
|
168 |
+
"fzaninotto/faker": "^1.6.0",
|
169 |
+
"phpunit/phpunit": "^4.8",
|
170 |
+
"squizlabs/php_codesniffer": "^2.6.0"
|
171 |
},
|
172 |
+
"time": "2016-05-17 13:59:18",
|
173 |
"type": "library",
|
174 |
"installation-source": "dist",
|
175 |
"autoload": {
|
179 |
},
|
180 |
"notification-url": "https://packagist.org/downloads/",
|
181 |
"license": [
|
182 |
+
"proprietary"
|
183 |
],
|
184 |
"authors": [
|
185 |
{
|
vendor/facebook/facebook-instant-articles-sdk-php/.travis.yml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
language: php
|
2 |
+
|
3 |
+
matrix:
|
4 |
+
include:
|
5 |
+
- php: 5.4
|
6 |
+
- php: 5.5
|
7 |
+
- php: 5.6
|
8 |
+
- php: 7
|
9 |
+
env: WITH_CS=true
|
10 |
+
|
11 |
+
cache:
|
12 |
+
directories:
|
13 |
+
- $HOME/.composer/cache
|
14 |
+
|
15 |
+
before_install:
|
16 |
+
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi
|
17 |
+
- travis_retry composer self-update
|
18 |
+
- composer validate
|
19 |
+
- composer config github-oauth.github.com $GITHUB_TOKEN
|
20 |
+
|
21 |
+
install:
|
22 |
+
- travis_retry composer install --no-interaction --prefer-dist
|
23 |
+
|
24 |
+
script:
|
25 |
+
- vendor/bin/phpunit
|
26 |
+
- if [[ "$WITH_CS" == "true" ]]; then vendor/bin/phpcs --standard=phpcs.xml -p; fi
|
vendor/facebook/facebook-instant-articles-sdk-php/CONTRIBUTING.md
CHANGED
@@ -40,23 +40,15 @@ When doing a pull request, consider if this diff has a testcase that was covered
|
|
40 |
|
41 |
## Running PHP Code Sniffer
|
42 |
|
43 |
-
|
44 |
|
45 |
``` bash
|
46 |
-
$
|
47 |
-
```
|
48 |
-
|
49 |
-
Then you can `cd` into the Facebook Instant Articles PHP SDK folder and run Code Sniffer against the `src/` directory.
|
50 |
-
|
51 |
-
``` bash
|
52 |
-
$ ~/.composer/vendor/bin/phpcs src --standard=psr2 -sp
|
53 |
-
$ ~/.composer/vendor/bin/phpcs tests --standard=psr2 -sp
|
54 |
```
|
55 |
|
56 |
Give a try for the autofixer for code style
|
57 |
|
58 |
``` bash
|
59 |
-
$
|
60 |
-
$ ~/.composer/vendor/bin/phpcbf tests --standard=psr2 -sp
|
61 |
```
|
62 |
**Happy coding**!
|
40 |
|
41 |
## Running PHP Code Sniffer
|
42 |
|
43 |
+
Run Code Sniffer against the `src/` and `tests/` directories.
|
44 |
|
45 |
``` bash
|
46 |
+
$ vendor/bin/phpcs --standard=phpcs.xml -p
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
```
|
48 |
|
49 |
Give a try for the autofixer for code style
|
50 |
|
51 |
``` bash
|
52 |
+
$ vendor/bin/phpcbf --standard-phpcs.xml -p
|
|
|
53 |
```
|
54 |
**Happy coding**!
|
vendor/facebook/facebook-instant-articles-sdk-php/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
# Facebook Instant Articles PHP SDK #
|
2 |
|
|
|
|
|
|
|
3 |
The Facebook Instant Articles SDK for PHP provides a native interface for creating and publishing Instant Articles. The SDK enables developers to more easily integrate Instant Articles into content management systems and in turn enables journalist and publishers to easily publish Instant Articles.
|
4 |
|
5 |
The SDK consists of three components:
|
@@ -22,17 +25,32 @@ composer require facebook/facebook-instant-articles-sdk-php
|
|
22 |
|
23 |
[Composer](https://getcomposer.org/) is a prerequisite for testing and developing. [Install composer globally](https://getcomposer.org/doc/00-intro.md#globally), then install project dependencies by running this command in the project root directory:
|
24 |
```sh
|
25 |
-
composer install
|
26 |
```
|
27 |
|
28 |
To run the tests:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
```sh
|
30 |
-
|
31 |
```
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
If you change structure, paths, namespaces, etc., make sure you run the [autoload generator](https://getcomposer.org/doc/03-cli.md#dump-autoload):
|
34 |
```sh
|
35 |
-
composer dump-autoload
|
36 |
```
|
37 |
|
38 |
## Contributing
|
1 |
# Facebook Instant Articles PHP SDK #
|
2 |
|
3 |
+
[![Build Status](https://travis-ci.org/facebook/facebook-instant-articles-sdk-php.svg?branch=master)](https://travis-ci.org/facebook/facebook-instant-articles-sdk-php)
|
4 |
+
[![Latest Stable Version](https://poser.pugx.org/facebook/facebook-instant-articles-sdk-php/v/stable)](https://packagist.org/packages/facebook/facebook-instant-articles-sdk-php)
|
5 |
+
|
6 |
The Facebook Instant Articles SDK for PHP provides a native interface for creating and publishing Instant Articles. The SDK enables developers to more easily integrate Instant Articles into content management systems and in turn enables journalist and publishers to easily publish Instant Articles.
|
7 |
|
8 |
The SDK consists of three components:
|
25 |
|
26 |
[Composer](https://getcomposer.org/) is a prerequisite for testing and developing. [Install composer globally](https://getcomposer.org/doc/00-intro.md#globally), then install project dependencies by running this command in the project root directory:
|
27 |
```sh
|
28 |
+
$ composer install
|
29 |
```
|
30 |
|
31 |
To run the tests:
|
32 |
+
|
33 |
+
```sh
|
34 |
+
$ composer test
|
35 |
+
```
|
36 |
+
|
37 |
+
To fix and check for coding style issues:
|
38 |
+
|
39 |
```sh
|
40 |
+
$ composer cs
|
41 |
```
|
42 |
|
43 |
+
Extra lazy? Run
|
44 |
+
|
45 |
+
```sh
|
46 |
+
$ composer all
|
47 |
+
```
|
48 |
+
|
49 |
+
to fix and check for coding style issues, and run the tests.
|
50 |
+
|
51 |
If you change structure, paths, namespaces, etc., make sure you run the [autoload generator](https://getcomposer.org/doc/03-cli.md#dump-autoload):
|
52 |
```sh
|
53 |
+
$ composer dump-autoload
|
54 |
```
|
55 |
|
56 |
## Contributing
|
vendor/facebook/facebook-instant-articles-sdk-php/composer.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
"keywords": ["facebook", "sdk", "instant", "articles"],
|
5 |
"type": "library",
|
6 |
"homepage": "https://github.com/facebook/facebook-instant-articles-sdk-php",
|
7 |
-
"license": "
|
8 |
"authors": [{
|
9 |
"name": "Facebook",
|
10 |
"homepage": "https://github.com/facebook/facebook-instant-articles-sdk-php/contributors"
|
@@ -16,7 +16,9 @@
|
|
16 |
"apache/log4php": "2.3.0"
|
17 |
},
|
18 |
"require-dev": {
|
19 |
-
"
|
|
|
|
|
20 |
},
|
21 |
"autoload": {
|
22 |
"psr-4": {
|
@@ -27,5 +29,19 @@
|
|
27 |
"psr-4": {
|
28 |
"Facebook\\InstantArticles\\": "tests/Facebook/InstantArticles/"
|
29 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
}
|
4 |
"keywords": ["facebook", "sdk", "instant", "articles"],
|
5 |
"type": "library",
|
6 |
"homepage": "https://github.com/facebook/facebook-instant-articles-sdk-php",
|
7 |
+
"license": "proprietary",
|
8 |
"authors": [{
|
9 |
"name": "Facebook",
|
10 |
"homepage": "https://github.com/facebook/facebook-instant-articles-sdk-php/contributors"
|
16 |
"apache/log4php": "2.3.0"
|
17 |
},
|
18 |
"require-dev": {
|
19 |
+
"fzaninotto/faker": "^1.6.0",
|
20 |
+
"phpunit/phpunit": "^4.8",
|
21 |
+
"squizlabs/php_codesniffer": "^2.6.0"
|
22 |
},
|
23 |
"autoload": {
|
24 |
"psr-4": {
|
29 |
"psr-4": {
|
30 |
"Facebook\\InstantArticles\\": "tests/Facebook/InstantArticles/"
|
31 |
}
|
32 |
+
},
|
33 |
+
"scripts": {
|
34 |
+
"all": [
|
35 |
+
"@cs",
|
36 |
+
"@test"
|
37 |
+
],
|
38 |
+
"cs": [
|
39 |
+
"composer install",
|
40 |
+
"phpcbf --standard=phpcs.xml -p || phpcs --standard=phpcs.xml -p"
|
41 |
+
],
|
42 |
+
"test": [
|
43 |
+
"composer install",
|
44 |
+
"phpunit"
|
45 |
+
]
|
46 |
}
|
47 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/composer.lock
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
"This file is @generated automatically"
|
6 |
],
|
7 |
-
"hash": "
|
8 |
-
"content-hash": "
|
9 |
"packages": [
|
10 |
{
|
11 |
"name": "apache/log4php",
|
@@ -39,16 +39,16 @@
|
|
39 |
},
|
40 |
{
|
41 |
"name": "facebook/php-sdk-v4",
|
42 |
-
"version": "5.1.
|
43 |
"source": {
|
44 |
"type": "git",
|
45 |
"url": "https://github.com/facebook/facebook-php-sdk-v4.git",
|
46 |
-
"reference": "
|
47 |
},
|
48 |
"dist": {
|
49 |
"type": "zip",
|
50 |
-
"url": "https://api.github.com/repos/facebook/facebook-php-sdk-v4/zipball/
|
51 |
-
"reference": "
|
52 |
"shasum": ""
|
53 |
},
|
54 |
"require": {
|
@@ -90,11 +90,11 @@
|
|
90 |
"facebook",
|
91 |
"sdk"
|
92 |
],
|
93 |
-
"time": "
|
94 |
},
|
95 |
{
|
96 |
"name": "symfony/css-selector",
|
97 |
-
"version": "v2.8.
|
98 |
"source": {
|
99 |
"type": "git",
|
100 |
"url": "https://github.com/symfony/css-selector.git",
|
@@ -201,6 +201,54 @@
|
|
201 |
],
|
202 |
"time": "2015-06-14 21:17:01"
|
203 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
{
|
205 |
"name": "phpdocumentor/reflection-docblock",
|
206 |
"version": "2.0.4",
|
@@ -464,21 +512,24 @@
|
|
464 |
},
|
465 |
{
|
466 |
"name": "phpunit/php-timer",
|
467 |
-
"version": "1.0.
|
468 |
"source": {
|
469 |
"type": "git",
|
470 |
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
471 |
-
"reference": "
|
472 |
},
|
473 |
"dist": {
|
474 |
"type": "zip",
|
475 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/
|
476 |
-
"reference": "
|
477 |
"shasum": ""
|
478 |
},
|
479 |
"require": {
|
480 |
"php": ">=5.3.3"
|
481 |
},
|
|
|
|
|
|
|
482 |
"type": "library",
|
483 |
"autoload": {
|
484 |
"classmap": [
|
@@ -501,7 +552,7 @@
|
|
501 |
"keywords": [
|
502 |
"timer"
|
503 |
],
|
504 |
-
"time": "
|
505 |
},
|
506 |
{
|
507 |
"name": "phpunit/php-token-stream",
|
@@ -554,16 +605,16 @@
|
|
554 |
},
|
555 |
{
|
556 |
"name": "phpunit/phpunit",
|
557 |
-
"version": "4.8.
|
558 |
"source": {
|
559 |
"type": "git",
|
560 |
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
561 |
-
"reference": "
|
562 |
},
|
563 |
"dist": {
|
564 |
"type": "zip",
|
565 |
-
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/
|
566 |
-
"reference": "
|
567 |
"shasum": ""
|
568 |
},
|
569 |
"require": {
|
@@ -577,7 +628,7 @@
|
|
577 |
"phpunit/php-code-coverage": "~2.1",
|
578 |
"phpunit/php-file-iterator": "~1.4",
|
579 |
"phpunit/php-text-template": "~1.2",
|
580 |
-
"phpunit/php-timer": "
|
581 |
"phpunit/phpunit-mock-objects": "~2.3",
|
582 |
"sebastian/comparator": "~1.1",
|
583 |
"sebastian/diff": "~1.2",
|
@@ -622,7 +673,7 @@
|
|
622 |
"testing",
|
623 |
"xunit"
|
624 |
],
|
625 |
-
"time": "2016-
|
626 |
},
|
627 |
{
|
628 |
"name": "phpunit/phpunit-mock-objects",
|
@@ -798,16 +849,16 @@
|
|
798 |
},
|
799 |
{
|
800 |
"name": "sebastian/environment",
|
801 |
-
"version": "1.3.
|
802 |
"source": {
|
803 |
"type": "git",
|
804 |
"url": "https://github.com/sebastianbergmann/environment.git",
|
805 |
-
"reference": "
|
806 |
},
|
807 |
"dist": {
|
808 |
"type": "zip",
|
809 |
-
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/
|
810 |
-
"reference": "
|
811 |
"shasum": ""
|
812 |
},
|
813 |
"require": {
|
@@ -844,7 +895,7 @@
|
|
844 |
"environment",
|
845 |
"hhvm"
|
846 |
],
|
847 |
-
"time": "2016-
|
848 |
},
|
849 |
{
|
850 |
"name": "sebastian/exporter",
|
@@ -1051,18 +1102,96 @@
|
|
1051 |
"homepage": "https://github.com/sebastianbergmann/version",
|
1052 |
"time": "2015-06-21 13:59:46"
|
1053 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1054 |
{
|
1055 |
"name": "symfony/yaml",
|
1056 |
-
"version": "v2.8.
|
1057 |
"source": {
|
1058 |
"type": "git",
|
1059 |
"url": "https://github.com/symfony/yaml.git",
|
1060 |
-
"reference": "
|
1061 |
},
|
1062 |
"dist": {
|
1063 |
"type": "zip",
|
1064 |
-
"url": "https://api.github.com/repos/symfony/yaml/zipball/
|
1065 |
-
"reference": "
|
1066 |
"shasum": ""
|
1067 |
},
|
1068 |
"require": {
|
@@ -1098,7 +1227,7 @@
|
|
1098 |
],
|
1099 |
"description": "Symfony Yaml Component",
|
1100 |
"homepage": "https://symfony.com",
|
1101 |
-
"time": "2016-03-
|
1102 |
}
|
1103 |
],
|
1104 |
"aliases": [],
|
4 |
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
"This file is @generated automatically"
|
6 |
],
|
7 |
+
"hash": "1cb48da59b04851b1ddcce5ac4a16e91",
|
8 |
+
"content-hash": "e47809dbb41d3cf5a6049a4db9fe2301",
|
9 |
"packages": [
|
10 |
{
|
11 |
"name": "apache/log4php",
|
39 |
},
|
40 |
{
|
41 |
"name": "facebook/php-sdk-v4",
|
42 |
+
"version": "5.1.4",
|
43 |
"source": {
|
44 |
"type": "git",
|
45 |
"url": "https://github.com/facebook/facebook-php-sdk-v4.git",
|
46 |
+
"reference": "38fd7187a6704d3ab14ded2f3a534ac4ee6f3481"
|
47 |
},
|
48 |
"dist": {
|
49 |
"type": "zip",
|
50 |
+
"url": "https://api.github.com/repos/facebook/facebook-php-sdk-v4/zipball/38fd7187a6704d3ab14ded2f3a534ac4ee6f3481",
|
51 |
+
"reference": "38fd7187a6704d3ab14ded2f3a534ac4ee6f3481",
|
52 |
"shasum": ""
|
53 |
},
|
54 |
"require": {
|
90 |
"facebook",
|
91 |
"sdk"
|
92 |
],
|
93 |
+
"time": "2016-05-13 17:28:30"
|
94 |
},
|
95 |
{
|
96 |
"name": "symfony/css-selector",
|
97 |
+
"version": "v2.8.6",
|
98 |
"source": {
|
99 |
"type": "git",
|
100 |
"url": "https://github.com/symfony/css-selector.git",
|
201 |
],
|
202 |
"time": "2015-06-14 21:17:01"
|
203 |
},
|
204 |
+
{
|
205 |
+
"name": "fzaninotto/faker",
|
206 |
+
"version": "v1.6.0",
|
207 |
+
"source": {
|
208 |
+
"type": "git",
|
209 |
+
"url": "https://github.com/fzaninotto/Faker.git",
|
210 |
+
"reference": "44f9a286a04b80c76a4e5fb7aad8bb539b920123"
|
211 |
+
},
|
212 |
+
"dist": {
|
213 |
+
"type": "zip",
|
214 |
+
"url": "https://api.github.com/repos/fzaninotto/Faker/zipball/44f9a286a04b80c76a4e5fb7aad8bb539b920123",
|
215 |
+
"reference": "44f9a286a04b80c76a4e5fb7aad8bb539b920123",
|
216 |
+
"shasum": ""
|
217 |
+
},
|
218 |
+
"require": {
|
219 |
+
"php": "^5.3.3|^7.0"
|
220 |
+
},
|
221 |
+
"require-dev": {
|
222 |
+
"ext-intl": "*",
|
223 |
+
"phpunit/phpunit": "~4.0",
|
224 |
+
"squizlabs/php_codesniffer": "~1.5"
|
225 |
+
},
|
226 |
+
"type": "library",
|
227 |
+
"extra": {
|
228 |
+
"branch-alias": []
|
229 |
+
},
|
230 |
+
"autoload": {
|
231 |
+
"psr-4": {
|
232 |
+
"Faker\\": "src/Faker/"
|
233 |
+
}
|
234 |
+
},
|
235 |
+
"notification-url": "https://packagist.org/downloads/",
|
236 |
+
"license": [
|
237 |
+
"MIT"
|
238 |
+
],
|
239 |
+
"authors": [
|
240 |
+
{
|
241 |
+
"name": "François Zaninotto"
|
242 |
+
}
|
243 |
+
],
|
244 |
+
"description": "Faker is a PHP library that generates fake data for you.",
|
245 |
+
"keywords": [
|
246 |
+
"data",
|
247 |
+
"faker",
|
248 |
+
"fixtures"
|
249 |
+
],
|
250 |
+
"time": "2016-04-29 12:21:54"
|
251 |
+
},
|
252 |
{
|
253 |
"name": "phpdocumentor/reflection-docblock",
|
254 |
"version": "2.0.4",
|
512 |
},
|
513 |
{
|
514 |
"name": "phpunit/php-timer",
|
515 |
+
"version": "1.0.8",
|
516 |
"source": {
|
517 |
"type": "git",
|
518 |
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
519 |
+
"reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260"
|
520 |
},
|
521 |
"dist": {
|
522 |
"type": "zip",
|
523 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260",
|
524 |
+
"reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260",
|
525 |
"shasum": ""
|
526 |
},
|
527 |
"require": {
|
528 |
"php": ">=5.3.3"
|
529 |
},
|
530 |
+
"require-dev": {
|
531 |
+
"phpunit/phpunit": "~4|~5"
|
532 |
+
},
|
533 |
"type": "library",
|
534 |
"autoload": {
|
535 |
"classmap": [
|
552 |
"keywords": [
|
553 |
"timer"
|
554 |
],
|
555 |
+
"time": "2016-05-12 18:03:57"
|
556 |
},
|
557 |
{
|
558 |
"name": "phpunit/php-token-stream",
|
605 |
},
|
606 |
{
|
607 |
"name": "phpunit/phpunit",
|
608 |
+
"version": "4.8.25",
|
609 |
"source": {
|
610 |
"type": "git",
|
611 |
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
612 |
+
"reference": "6d1588a6542a52ed89636e5a9876bc7502bbb853"
|
613 |
},
|
614 |
"dist": {
|
615 |
"type": "zip",
|
616 |
+
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6d1588a6542a52ed89636e5a9876bc7502bbb853",
|
617 |
+
"reference": "6d1588a6542a52ed89636e5a9876bc7502bbb853",
|
618 |
"shasum": ""
|
619 |
},
|
620 |
"require": {
|
628 |
"phpunit/php-code-coverage": "~2.1",
|
629 |
"phpunit/php-file-iterator": "~1.4",
|
630 |
"phpunit/php-text-template": "~1.2",
|
631 |
+
"phpunit/php-timer": "^1.0.6",
|
632 |
"phpunit/phpunit-mock-objects": "~2.3",
|
633 |
"sebastian/comparator": "~1.1",
|
634 |
"sebastian/diff": "~1.2",
|
673 |
"testing",
|
674 |
"xunit"
|
675 |
],
|
676 |
+
"time": "2016-05-10 18:47:12"
|
677 |
},
|
678 |
{
|
679 |
"name": "phpunit/phpunit-mock-objects",
|
849 |
},
|
850 |
{
|
851 |
"name": "sebastian/environment",
|
852 |
+
"version": "1.3.6",
|
853 |
"source": {
|
854 |
"type": "git",
|
855 |
"url": "https://github.com/sebastianbergmann/environment.git",
|
856 |
+
"reference": "2292b116f43c272ff4328083096114f84ea46a56"
|
857 |
},
|
858 |
"dist": {
|
859 |
"type": "zip",
|
860 |
+
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/2292b116f43c272ff4328083096114f84ea46a56",
|
861 |
+
"reference": "2292b116f43c272ff4328083096114f84ea46a56",
|
862 |
"shasum": ""
|
863 |
},
|
864 |
"require": {
|
895 |
"environment",
|
896 |
"hhvm"
|
897 |
],
|
898 |
+
"time": "2016-05-04 07:59:13"
|
899 |
},
|
900 |
{
|
901 |
"name": "sebastian/exporter",
|
1102 |
"homepage": "https://github.com/sebastianbergmann/version",
|
1103 |
"time": "2015-06-21 13:59:46"
|
1104 |
},
|
1105 |
+
{
|
1106 |
+
"name": "squizlabs/php_codesniffer",
|
1107 |
+
"version": "2.6.0",
|
1108 |
+
"source": {
|
1109 |
+
"type": "git",
|
1110 |
+
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
1111 |
+
"reference": "1bcdf03b068a530ac1962ce671dead356eeba43b"
|
1112 |
+
},
|
1113 |
+
"dist": {
|
1114 |
+
"type": "zip",
|
1115 |
+
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1bcdf03b068a530ac1962ce671dead356eeba43b",
|
1116 |
+
"reference": "1bcdf03b068a530ac1962ce671dead356eeba43b",
|
1117 |
+
"shasum": ""
|
1118 |
+
},
|
1119 |
+
"require": {
|
1120 |
+
"ext-simplexml": "*",
|
1121 |
+
"ext-tokenizer": "*",
|
1122 |
+
"ext-xmlwriter": "*",
|
1123 |
+
"php": ">=5.1.2"
|
1124 |
+
},
|
1125 |
+
"require-dev": {
|
1126 |
+
"phpunit/phpunit": "~4.0"
|
1127 |
+
},
|
1128 |
+
"bin": [
|
1129 |
+
"scripts/phpcs",
|
1130 |
+
"scripts/phpcbf"
|
1131 |
+
],
|
1132 |
+
"type": "library",
|
1133 |
+
"extra": {
|
1134 |
+
"branch-alias": {
|
1135 |
+
"dev-master": "2.x-dev"
|
1136 |
+
}
|
1137 |
+
},
|
1138 |
+
"autoload": {
|
1139 |
+
"classmap": [
|
1140 |
+
"CodeSniffer.php",
|
1141 |
+
"CodeSniffer/CLI.php",
|
1142 |
+
"CodeSniffer/Exception.php",
|
1143 |
+
"CodeSniffer/File.php",
|
1144 |
+
"CodeSniffer/Fixer.php",
|
1145 |
+
"CodeSniffer/Report.php",
|
1146 |
+
"CodeSniffer/Reporting.php",
|
1147 |
+
"CodeSniffer/Sniff.php",
|
1148 |
+
"CodeSniffer/Tokens.php",
|
1149 |
+
"CodeSniffer/Reports/",
|
1150 |
+
"CodeSniffer/Tokenizers/",
|
1151 |
+
"CodeSniffer/DocGenerators/",
|
1152 |
+
"CodeSniffer/Standards/AbstractPatternSniff.php",
|
1153 |
+
"CodeSniffer/Standards/AbstractScopeSniff.php",
|
1154 |
+
"CodeSniffer/Standards/AbstractVariableSniff.php",
|
1155 |
+
"CodeSniffer/Standards/IncorrectPatternException.php",
|
1156 |
+
"CodeSniffer/Standards/Generic/Sniffs/",
|
1157 |
+
"CodeSniffer/Standards/MySource/Sniffs/",
|
1158 |
+
"CodeSniffer/Standards/PEAR/Sniffs/",
|
1159 |
+
"CodeSniffer/Standards/PSR1/Sniffs/",
|
1160 |
+
"CodeSniffer/Standards/PSR2/Sniffs/",
|
1161 |
+
"CodeSniffer/Standards/Squiz/Sniffs/",
|
1162 |
+
"CodeSniffer/Standards/Zend/Sniffs/"
|
1163 |
+
]
|
1164 |
+
},
|
1165 |
+
"notification-url": "https://packagist.org/downloads/",
|
1166 |
+
"license": [
|
1167 |
+
"BSD-3-Clause"
|
1168 |
+
],
|
1169 |
+
"authors": [
|
1170 |
+
{
|
1171 |
+
"name": "Greg Sherwood",
|
1172 |
+
"role": "lead"
|
1173 |
+
}
|
1174 |
+
],
|
1175 |
+
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
1176 |
+
"homepage": "http://www.squizlabs.com/php-codesniffer",
|
1177 |
+
"keywords": [
|
1178 |
+
"phpcs",
|
1179 |
+
"standards"
|
1180 |
+
],
|
1181 |
+
"time": "2016-04-03 22:58:34"
|
1182 |
+
},
|
1183 |
{
|
1184 |
"name": "symfony/yaml",
|
1185 |
+
"version": "v2.8.6",
|
1186 |
"source": {
|
1187 |
"type": "git",
|
1188 |
"url": "https://github.com/symfony/yaml.git",
|
1189 |
+
"reference": "e4fbcc65f90909c999ac3b4dfa699ee6563a9940"
|
1190 |
},
|
1191 |
"dist": {
|
1192 |
"type": "zip",
|
1193 |
+
"url": "https://api.github.com/repos/symfony/yaml/zipball/e4fbcc65f90909c999ac3b4dfa699ee6563a9940",
|
1194 |
+
"reference": "e4fbcc65f90909c999ac3b4dfa699ee6563a9940",
|
1195 |
"shasum": ""
|
1196 |
},
|
1197 |
"require": {
|
1227 |
],
|
1228 |
"description": "Symfony Yaml Component",
|
1229 |
"homepage": "https://symfony.com",
|
1230 |
+
"time": "2016-03-29 19:00:15"
|
1231 |
}
|
1232 |
],
|
1233 |
"aliases": [],
|
vendor/facebook/facebook-instant-articles-sdk-php/docs/QuickStart.md
CHANGED
@@ -5,6 +5,10 @@ This SDK contains three primary components:
|
|
5 |
- [**Transformer**](#transformer) - Engine which transforms HTML into **Elements** objects
|
6 |
- [**Client**](#client) - Client to publish Instant Articles
|
7 |
|
|
|
|
|
|
|
|
|
8 |
## Elements
|
9 |
`Elements` is the object tree class that represents the structure of an Instant Article. This object tree structure ensures that no invalid Instant Article HTML markup is generated. Here is a simple and complete object tree structure, starting with the `InstantArticle` class that holds the full Instant Article.
|
10 |
|
@@ -498,3 +502,185 @@ foreach ($pagesAndTokens as $pageAndToken) {
|
|
498 |
echo 'Page access token: ' . $pageAndToken->getField('access_token');
|
499 |
}
|
500 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
- [**Transformer**](#transformer) - Engine which transforms HTML into **Elements** objects
|
6 |
- [**Client**](#client) - Client to publish Instant Articles
|
7 |
|
8 |
+
[**Transformer Rules**](#custom-transformer-rules) - Within the Transformer are rules which define a mapping between elements in the *source markup* and valid *Instant Article components*. These rules are customizable to allow flexibility in the interpretation of the source markup and is a crucial part of the transformation process so it has a dedicated section.
|
9 |
+
|
10 |
+
---
|
11 |
+
|
12 |
## Elements
|
13 |
`Elements` is the object tree class that represents the structure of an Instant Article. This object tree structure ensures that no invalid Instant Article HTML markup is generated. Here is a simple and complete object tree structure, starting with the `InstantArticle` class that holds the full Instant Article.
|
14 |
|
502 |
echo 'Page access token: ' . $pageAndToken->getField('access_token');
|
503 |
}
|
504 |
```
|
505 |
+
|
506 |
+
---
|
507 |
+
|
508 |
+
## Transformer Rules
|
509 |
+
|
510 |
+
### Overview
|
511 |
+
|
512 |
+
A valid Instant Article is comprised of a subset of standard HTML tags, detailed in the [Format Reference](https://developers.facebook.com/docs/instant-articles/reference). Adhering to these restrictions ensures that content renders reliably and performant on mobile devices within Facebook but naturally constrains what is allowed within the markup. What's more, the hierarchy of the permitted tags also matters.
|
513 |
+
|
514 |
+
> For example, to render text **bold** in an Instant Article, the `<strong>` tag *must* be used. But if your content makes use of `<b>` as a means to stylize text bold, you would find that your source markup is *valid HTML*, but ultimately is not *valid Instant Articles markup*.
|
515 |
+
|
516 |
+
The Transformer of this SDK helps mitigate these constraints by converting *any markup* into *Instant Articles markup*, and it's the ***Transformer Rules*** which instructs it on how to do so. Collectively, these rules form a mapping between elements in the source markup and what they should be transformed into within the generated Instant Article. Analogous to a car, if the Transformer were the engine powering the conversion of the markup, the Transformer Rules would be the driver.
|
517 |
+
|
518 |
+
Many [example rules](https://github.com/facebook/facebook-instant-articles-sdk-php/blob/master/tests/Facebook/InstantArticles/Transformer/instant-article-example-rules.json) have been defined which aim to cover most common scenarios. Additional rules can be added to amend or override existing ones.
|
519 |
+
|
520 |
+
### <a name="custom-transformer-rules"></a>Configuring Transformer Rules
|
521 |
+
|
522 |
+
At a high level, configuring a Transformer Rule involves three steps:
|
523 |
+
|
524 |
+
1. Identifying a source element in your markup
|
525 |
+
2. Associating it with an existing [Transformer Rule Class](#transformer-classes) in a permitted context
|
526 |
+
3. Defining any value for attributes on the transformed element that the Rule Class expects (not always needed)
|
527 |
+
|
528 |
+
Take the following example which would cause text within `<span class="bold">` to be stylized **bold** in the generated Instant Article.
|
529 |
+
|
530 |
+
```javascript
|
531 |
+
// Transformer Rule associating <span class="bold"> to the `BoldRule` class
|
532 |
+
{
|
533 |
+
"class": "BoldRule",
|
534 |
+
"selector": "span.bold"
|
535 |
+
//"properties": {} // Not needed since the `BoldRule` class has no properties
|
536 |
+
}
|
537 |
+
```
|
538 |
+
|
539 |
+
*If you're curious, the resulting markup within the Instant Article for the `BoldRule` class is the `<b>` tag; the fact that this detail is abstracted by the Transformer is intentional.*
|
540 |
+
|
541 |
+
> Caveat: the example above makes no mention of *context*. It turns out, the rule above would only work as expected if it were being processed within a particular parent context of the generated document. Read more about [rule context](#rule-context).
|
542 |
+
|
543 |
+
#### Transformer Rule: Selector
|
544 |
+
|
545 |
+
The selector is used to identify elements in the source markup. Both **CSS selectors** and **Xpath** are supported formats.
|
546 |
+
|
547 |
+
#### Transformer Rule: Properties
|
548 |
+
|
549 |
+
Some Transformer Rules have properties who's value are obtained from content in the source markup. The content itself isn't specified in the rule; rather, the rule defines where in the source element the value is located, again by use of a selector.
|
550 |
+
|
551 |
+
In the configuration of your rule, you instruct the transformer where the value can be obtained from within the source markup with the following key-value pairs allowed for a property:
|
552 |
+
|
553 |
+
Key name | Required? | Notes
|
554 |
+
--- | --- | ---
|
555 |
+
`type` | *Required* | Defines the behavior of the `selector` (below). Possible values: `"string"`, `"int"`, `"exists"`, `"sibling"`, `"children"`, `"xpath"`.
|
556 |
+
`selector` | *Required* | The interpretation of the value of this item is affected by the `type` (above).
|
557 |
+
`attribute` | *Required only if `type` is one of: `"string"`, `"int"`, `"exists"`, `"xpath"`* | The name of the attribute on the element, identified by the value in `selector`, whose value you want to use as the content for the property of the Transformer Rule.<br><br>When `type` is `"exists"`, the value of the property will be `true` simply by the presence of the attribute, regardless of its value.
|
558 |
+
|
559 |
+
##### Examples
|
560 |
+
|
561 |
+
For example, take the standard case of configuring the transformer to recognize anchor tags, such as `<a href="http://example.com">` for generating links with an Instant Article:
|
562 |
+
|
563 |
+
```javascript
|
564 |
+
{
|
565 |
+
"class": "AnchorRule", // Rule class
|
566 |
+
"selector": "a", // Matching source element (CSS selector)
|
567 |
+
"properties" : { // All supported properties
|
568 |
+
|
569 |
+
"anchor.href" : { // Name of property
|
570 |
+
"type" : "string",
|
571 |
+
"selector" : "a", // Additional selector specific to this property
|
572 |
+
"attribute": "href" // Attribute whose value to use
|
573 |
+
}
|
574 |
+
|
575 |
+
}
|
576 |
+
}
|
577 |
+
```
|
578 |
+
|
579 |
+
As a contrived example, here's a rule which would transform source markup formatted as such: `<span class="custom-href" data-link="http://example.com">` into the same links within the generated Instant Article:
|
580 |
+
|
581 |
+
```javascript
|
582 |
+
{
|
583 |
+
"class": "AnchorRule",
|
584 |
+
"selector": "span.custom-href",
|
585 |
+
"properties" : {
|
586 |
+
|
587 |
+
"anchor.href" : {
|
588 |
+
"type" : "string",
|
589 |
+
"selector" : "span.custom-href",
|
590 |
+
"attribute": "data-link"
|
591 |
+
}
|
592 |
+
|
593 |
+
}
|
594 |
+
}
|
595 |
+
```
|
596 |
+
|
597 |
+
#### <a name="transformer-classes"></a>Transformer Rule: Class
|
598 |
+
|
599 |
+
A *Rule Class* is simply a pre-determined link to a valid Instant Article component. It defines supported `properties` and permitted *context(s)* for the Rule.
|
600 |
+
|
601 |
+
> <a name="rule-context"></a> **Rule Context**
|
602 |
+
|
603 |
+
> The hierarchal nature of an HTML document implies that an element always exists within the *context of a parent element*. A similar hierarchy is built during a document's transformation into an Instant Article giving each individual element a *context*. This context plays an important role for the Transfer Rules since, along with the selector, it is a condition that must be matched before a rule is executed.
|
604 |
+
|
605 |
+
> As the Transformer traverses through the entire HTML document, it attempts to execute all of rules for every tag element it encounters. But two criteria need to be met each time:
|
606 |
+
|
607 |
+
> 1. the *selector* of the rule must match the current element
|
608 |
+
> 2. the *context* in which the rule would run must match one of the allowed context(s) of the rule class
|
609 |
+
|
610 |
+
> In other words, as the Transformer progresses, it uses the rules to build a hierarchy of transformed elements, giving *context* to each subsequent rule. Rules are only permitted to execute within an allowed *context* defined for the [Rule Class](#transformer-classes) is uses.
|
611 |
+
|
612 |
+
##### Available Rule Classes
|
613 |
+
|
614 |
+
Listed below are all the available *Rule Classes*, along with their supported `properties` and permitted *context(s)*, whereby source markup can be mapped to a valid Instant Article component via its selectors. They are arranged into logical groups by function. For the `properties`, assume `type` of `"string"` unless noted otherwise.
|
615 |
+
|
616 |
+
**Formatting**
|
617 |
+
|
618 |
+
Rule Class | Properties | Permitted Context | Notes
|
619 |
+
--- | --- | --- | ---
|
620 |
+
`AnchorRule` | `anchor.href`<br>`anchor.rel` | *TextContainer* |
|
621 |
+
`BoldRule` | | *TextContainer* |
|
622 |
+
`ItalicRule` | | *TextContainer* |
|
623 |
+
`LineBreakRule` | | *TextContainer* |
|
624 |
+
|
625 |
+
**Layout**
|
626 |
+
|
627 |
+
Rule Class | Properties | Permitted Context | Notes
|
628 |
+
--- | --- | --- | ---
|
629 |
+
`BlockquoteRule` | | *InstantArticle* |
|
630 |
+
`H1Rule` | `type` = `"exists"` for one of either text alignment options:<br> `op-left`<br>`op-center`<br>`op-right`<br><br>`type` = `"exists"` for one of either vertical position options:<br>`op-vertical-below`<br>`op-vertical-above`<br>`op-vertical-center` <br><br>`type` = `"exists"` for one of either size options:<br>`op-size-medium`<br>`op-size-large`<br>`op-size-extra-large` | *Caption*, *InstantArticle* | Used to specify the Header value for multiple **Element** types.
|
631 |
+
`H2Rule` | `type` = `"exists"` for one of either text alignment options:<br> `op-left`<br>`op-center`<br>`op-right`<br><br>`type` = `"exists"` for one of either vertical position options:<br>`op-vertical-below`<br>`op-vertical-above`<br>`op-vertical-center` | *Caption*, *InstantArticle* |
|
632 |
+
`HeaderRule` | | *InstantArticle* |
|
633 |
+
`ListElementRule` | | *InstantArticle* |
|
634 |
+
`ListItemRule` | | *ListElement* |
|
635 |
+
`ParagraphRule` | | *InstantArticle* |
|
636 |
+
`PullquoteCiteRule` | | *Pullquote* |
|
637 |
+
`PullquoteRule` | | *InstantArticle* |
|
638 |
+
|
639 |
+
**Graphic**
|
640 |
+
|
641 |
+
Rule Class | Properties | Permitted Context | Notes
|
642 |
+
--- | --- | --- | ---
|
643 |
+
`AdRule` | `ad.url`<br>`ad.height`<br>`ad.width`<br>`ad.embed` | *InstantArticle* |
|
644 |
+
`AnalyticsRule` | `analytics.url`<br>`analytics.embed` | *InstantArticle* |
|
645 |
+
`GeoTagRule` | `map.geotag` | *Image*, *Video*, *Map* | Used to specify the [Geotag](https://developers.facebook.com/docs/instant-articles/reference/map) value for multiple **Element** types.<br><br>Multiple definitions of the same `map.geotag` property are allowed and each one will be processed independently.
|
646 |
+
`HeaderAdRule` | `ad.url`<br>`ad.height`<br>`ad.width`<br>`ad.embed` | *Header* |
|
647 |
+
`HeaderImageRule` | `image.url` | *Header* |
|
648 |
+
`ImageRule` | `image.url`<br>`image.like`<br>`image.comments` | *InstantArticle* |
|
649 |
+
`InteractiveRule` | `interactive.iframe`<br>`interactive.url`<br>`interactive.height`<br>`no-margin`<br>`column-width` | *InstantArticle* |
|
650 |
+
`MapRule` | | *InstantArticle* |
|
651 |
+
|
652 |
+
**Media**
|
653 |
+
|
654 |
+
Rule Class | Properties | Permitted Context | Notes
|
655 |
+
--- | --- | --- | ---
|
656 |
+
`AudioRule` | `audio.url`<br>`audio.title`<br>`audio.autoplay`<br>`audio.muted` | *Audible* |
|
657 |
+
`RelatedArticlesRule` | `related.title` | *InstantArticle* | Wrapper for a [Related Article](https://developers.facebook.com/docs/instant-articles/reference/related-articles) component
|
658 |
+
`RelatedItemRule` | `related.sponsored`<br>`related.url` | *RelatedArticles* | For individual articles within a `RelatedArticlesRule`
|
659 |
+
`SlideshowImageRule` | `image.url`<br>`caption.title`<br>`caption.credit` | *Slideshow* | For individual images within a `SlideshowRule`
|
660 |
+
`SlideshowRule` | | *InstantArticle* | Wrapper for a [Slideshow](https://developers.facebook.com/docs/instant-articles/reference/slideshow) component
|
661 |
+
`SocialEmbedRule` | `socialembed.iframe`<br>`socialembed.url`<br>`socialembed.width`<br>`socialembed.height` | *InstantArticle* |
|
662 |
+
`VideoRule` | `video.url`<br>`video.type`<br>`video.playback`<br>`video.controls`<br>`video.like`<br>`video.comments`<br><br>`type` = `"exists"` for any of the video player options:<br>`loop`<br>`data-fade`<br><br>one of the following:<br>`aspect-fit`<br>`aspect-fit-only`<br>`fullscreen`<br>`non-interactive` | *InstantArticle* |
|
663 |
+
|
664 |
+
**Article Structure**
|
665 |
+
|
666 |
+
Rule Class | Properties | Permitted Context | Notes
|
667 |
+
--- | --- | --- | ---
|
668 |
+
`AuthorRule` | `author.url`<br>`author.name`<br>`author.description`<br>`author.role_contribution` | *Header* |
|
669 |
+
`CaptionCreditRule` | `type` = `"exists"` for one of either text alignment options:<br> `op-left`<br>`op-center`<br>`op-right`<br><br>`type` = `"exists"` for one of either vertical position options:<br>`op-vertical-below`<br>`op-vertical-above`<br>`op-vertical-center` | *Caption* |
|
670 |
+
`CaptionRule` | `caption.default`<br><br>`type` = `"exists"` for one of either text alignment options:<br> `op-left`<br>`op-center`<br>`op-right`<br><br>`type` = `"exists"` for one of either vertical position options:<br>`op-vertical-below`<br>`op-vertical-above`<br>`op-vertical-center` <br><br>`type` = `"exists"` for one of either size options:<br>`op-size-medium`<br>`op-size-large`<br>`op-size-extra-large` | *Map*, *Image*, *Interactive*, *Slideshow*, *SocialEmbed*, *Video* | Used to specify the [Caption](https://developers.facebook.com/docs/instant-articles/reference/caption) value for multiple **Element** types.<br><br>Multiple definitions of the same `caption.default` property are allowed and each one will be processed independently.
|
671 |
+
`FooterRelatedArticlesRule` | `related.title` | *Footer* |
|
672 |
+
`FooterRule` | | *InstantArticle* |
|
673 |
+
`HeaderKickerRule` | | *Header* |
|
674 |
+
`HeaderSubTitleRule` | | *Header* |
|
675 |
+
`HeaderTitleRule` | | *Header* |
|
676 |
+
`ParagraphFooterRule` | | *Footer* |
|
677 |
+
`TimeRule` | `article.time`<br>`article.time_type` | *Header* |
|
678 |
+
|
679 |
+
**Special**
|
680 |
+
|
681 |
+
Rule Class | Properties | Permitted Context | Notes
|
682 |
+
--- | --- | --- | ---
|
683 |
+
`IgnoreRule` | | *(any)* | This rule class will effectively strip out an element tag which matches the associated ***selector*** of the rule.
|
684 |
+
`PassThroughRule` | | *(any)* | This rule class instructs the Transformer to not process any transformation on element tags which match the associated ***selector*** of the rule.
|
685 |
+
`InstantArticleRule` | `article.canonical`<br>`article.charset`<br>`article.markup.version`<br>`article.auto.ad` | *InstantArticle* | This is the entry point, or root node, of the hierarchy.
|
686 |
+
`TextNodeRule` | | *TextContainer* |
|
vendor/facebook/facebook-instant-articles-sdk-php/phpcs.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<ruleset name="facebook/facebook-instant-articles-sdk-php">
|
3 |
+
<file>.</file>
|
4 |
+
<exclude-pattern>vendor/</exclude-pattern>
|
5 |
+
<arg name="colors" />
|
6 |
+
<arg value="sn" />
|
7 |
+
<rule ref="PSR2" />
|
8 |
+
</ruleset>
|
vendor/facebook/facebook-instant-articles-sdk-php/phpunit.xml
CHANGED
@@ -3,10 +3,16 @@
|
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
4 |
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
|
5 |
bootstrap="vendor/autoload.php"
|
|
|
6 |
>
|
7 |
<testsuites>
|
8 |
<testsuite name="The project's test suite">
|
9 |
<directory>./tests</directory>
|
10 |
</testsuite>
|
11 |
</testsuites>
|
|
|
|
|
|
|
|
|
|
|
12 |
</phpunit>
|
3 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
4 |
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
|
5 |
bootstrap="vendor/autoload.php"
|
6 |
+
colors="true"
|
7 |
>
|
8 |
<testsuites>
|
9 |
<testsuite name="The project's test suite">
|
10 |
<directory>./tests</directory>
|
11 |
</testsuite>
|
12 |
</testsuites>
|
13 |
+
<filter>
|
14 |
+
<whitelist>
|
15 |
+
<directory>./src</directory>
|
16 |
+
</whitelist>
|
17 |
+
</filter>
|
18 |
</phpunit>
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Client.php
CHANGED
@@ -9,6 +9,7 @@
|
|
9 |
|
10 |
namespace Facebook\InstantArticles\Client;
|
11 |
|
|
|
12 |
use Facebook\Facebook;
|
13 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
14 |
use Facebook\InstantArticles\Validators\Type;
|
@@ -18,7 +19,7 @@ class Client
|
|
18 |
const EDGE_NAME = '/instant_articles';
|
19 |
|
20 |
/**
|
21 |
-
* @var
|
22 |
*/
|
23 |
private $facebook;
|
24 |
|
@@ -33,7 +34,7 @@ class Client
|
|
33 |
protected $developmentMode = false;
|
34 |
|
35 |
/**
|
36 |
-
* @param Facebook
|
37 |
* @param string $pageID Specify the Facebook Page to use for Instant Articles
|
38 |
* @param bool $developmentMode|false Configure the service to use the Instant Articles development sandbox
|
39 |
*/
|
@@ -52,12 +53,14 @@ class Client
|
|
52 |
/**
|
53 |
* Creates a client with a proper Facebook client instance.
|
54 |
*
|
55 |
-
* @param string $
|
56 |
-
* @param string $
|
57 |
* @param string $accessToken The page access token used to query the Facebook Graph API
|
58 |
* @param string $pageID Specify the Facebook Page to use for Instant Articles
|
59 |
* @param bool $developmentMode|false Configure the service to use the Instant Articles development sandbox
|
60 |
*
|
|
|
|
|
61 |
* @throws FacebookSDKException
|
62 |
*/
|
63 |
public static function create($appID, $appSecret, $accessToken, $pageID, $developmentMode = false)
|
@@ -80,7 +83,7 @@ class Client
|
|
80 |
* Import an article into your Instant Articles library.
|
81 |
*
|
82 |
* @param InstantArticle $article The article to import
|
83 |
-
* @param bool|false $
|
84 |
*/
|
85 |
public function importArticle($article, $takeLive = false)
|
86 |
{
|
@@ -102,7 +105,8 @@ class Client
|
|
102 |
* Removes an article from your Instant Articles library.
|
103 |
*
|
104 |
* @param string $canonicalURL The canonical URL of the article to delete.
|
105 |
-
*
|
|
|
106 |
*
|
107 |
* @todo Consider returning the \Facebook\FacebookResponse object sent by
|
108 |
* \Facebook\Facebook::delete(). For now we trust that if an Instant
|
@@ -111,7 +115,7 @@ class Client
|
|
111 |
public function removeArticle($canonicalURL)
|
112 |
{
|
113 |
if (!$canonicalURL) {
|
114 |
-
return InstantArticleStatus::notFound(
|
115 |
}
|
116 |
|
117 |
Type::enforce($canonicalURL, Type::STRING);
|
@@ -120,7 +124,7 @@ class Client
|
|
120 |
$this->facebook->delete($articleID);
|
121 |
return InstantArticleStatus::success();
|
122 |
}
|
123 |
-
return InstantArticleStatus::notFound(
|
124 |
}
|
125 |
|
126 |
/**
|
@@ -163,7 +167,7 @@ class Client
|
|
163 |
$response = $this->facebook->get($articleID . '?fields=most_recent_import_status');
|
164 |
$articleStatus = $response->getGraphNode()->getField('most_recent_import_status');
|
165 |
|
166 |
-
$messages =
|
167 |
if (isset($articleStatus['errors'])) {
|
168 |
foreach ($articleStatus['errors'] as $error) {
|
169 |
$messages[] = ServerMessage::fromLevel($error['level'], $error['message']);
|
9 |
|
10 |
namespace Facebook\InstantArticles\Client;
|
11 |
|
12 |
+
use Facebook\Exceptions\FacebookSDKException;
|
13 |
use Facebook\Facebook;
|
14 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
15 |
use Facebook\InstantArticles\Validators\Type;
|
19 |
const EDGE_NAME = '/instant_articles';
|
20 |
|
21 |
/**
|
22 |
+
* @var Facebook The main Facebook service client.
|
23 |
*/
|
24 |
private $facebook;
|
25 |
|
34 |
protected $developmentMode = false;
|
35 |
|
36 |
/**
|
37 |
+
* @param Facebook $facebook the main Facebook service client
|
38 |
* @param string $pageID Specify the Facebook Page to use for Instant Articles
|
39 |
* @param bool $developmentMode|false Configure the service to use the Instant Articles development sandbox
|
40 |
*/
|
53 |
/**
|
54 |
* Creates a client with a proper Facebook client instance.
|
55 |
*
|
56 |
+
* @param string $appID
|
57 |
+
* @param string $appSecret
|
58 |
* @param string $accessToken The page access token used to query the Facebook Graph API
|
59 |
* @param string $pageID Specify the Facebook Page to use for Instant Articles
|
60 |
* @param bool $developmentMode|false Configure the service to use the Instant Articles development sandbox
|
61 |
*
|
62 |
+
* @return static
|
63 |
+
*
|
64 |
* @throws FacebookSDKException
|
65 |
*/
|
66 |
public static function create($appID, $appSecret, $accessToken, $pageID, $developmentMode = false)
|
83 |
* Import an article into your Instant Articles library.
|
84 |
*
|
85 |
* @param InstantArticle $article The article to import
|
86 |
+
* @param bool|false $takeLive Specifies if this article should be taken live or not. Optional. Default: false.
|
87 |
*/
|
88 |
public function importArticle($article, $takeLive = false)
|
89 |
{
|
105 |
* Removes an article from your Instant Articles library.
|
106 |
*
|
107 |
* @param string $canonicalURL The canonical URL of the article to delete.
|
108 |
+
*
|
109 |
+
* @return InstantArticleStatus
|
110 |
*
|
111 |
* @todo Consider returning the \Facebook\FacebookResponse object sent by
|
112 |
* \Facebook\Facebook::delete(). For now we trust that if an Instant
|
115 |
public function removeArticle($canonicalURL)
|
116 |
{
|
117 |
if (!$canonicalURL) {
|
118 |
+
return InstantArticleStatus::notFound(['$canonicalURL param not passed to ' . __FUNCTION__ . '.']);
|
119 |
}
|
120 |
|
121 |
Type::enforce($canonicalURL, Type::STRING);
|
124 |
$this->facebook->delete($articleID);
|
125 |
return InstantArticleStatus::success();
|
126 |
}
|
127 |
+
return InstantArticleStatus::notFound(['An Instant Article ID ' . $articleID . ' was not found for ' . $canonicalURL . ' in ' . __FUNCTION__ . '.']);
|
128 |
}
|
129 |
|
130 |
/**
|
167 |
$response = $this->facebook->get($articleID . '?fields=most_recent_import_status');
|
168 |
$articleStatus = $response->getGraphNode()->getField('most_recent_import_status');
|
169 |
|
170 |
+
$messages = [];
|
171 |
if (isset($articleStatus['errors'])) {
|
172 |
foreach ($articleStatus['errors'] as $error) {
|
173 |
$messages[] = ServerMessage::fromLevel($error['level'], $error['message']);
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/ClientException.php
CHANGED
@@ -9,6 +9,6 @@
|
|
9 |
|
10 |
namespace Facebook\InstantArticles\Client;
|
11 |
|
12 |
-
class ClientException extends Exception
|
13 |
{
|
14 |
}
|
9 |
|
10 |
namespace Facebook\InstantArticles\Client;
|
11 |
|
12 |
+
class ClientException extends \Exception
|
13 |
{
|
14 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Helper.php
CHANGED
@@ -8,6 +8,7 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Client;
|
10 |
|
|
|
11 |
use Facebook\Facebook;
|
12 |
use Facebook\Exceptions\FacebookSDKException;
|
13 |
use Facebook\Authentication\AccessToken;
|
@@ -16,12 +17,12 @@ use Facebook\InstantArticles\Validators\Type;
|
|
16 |
class Helper
|
17 |
{
|
18 |
/**
|
19 |
-
* @var
|
20 |
*/
|
21 |
protected $facebook;
|
22 |
|
23 |
/**
|
24 |
-
* @param Facebook
|
25 |
*/
|
26 |
public function __construct($facebook)
|
27 |
{
|
@@ -37,6 +38,8 @@ class Helper
|
|
37 |
* @param string $appID
|
38 |
* @param string $appSecret
|
39 |
*
|
|
|
|
|
40 |
* @throws FacebookSDKException
|
41 |
*/
|
42 |
public static function create($appID, $appSecret)
|
@@ -73,7 +76,7 @@ class Helper
|
|
73 |
// The OAuth 2.0 client handler helps us manage access tokens
|
74 |
$OAuth2Client = $this->facebook->getOAuth2Client();
|
75 |
$accessToken = $OAuth2Client->getLongLivedAccessToken($accessToken);
|
76 |
-
} catch (
|
77 |
throw new FacebookSDKException(
|
78 |
"Failed to exchange short-lived access token for long-lived access token."
|
79 |
);
|
@@ -87,8 +90,8 @@ class Helper
|
|
87 |
// connected to this user
|
88 |
try {
|
89 |
$response = $this->facebook->get('/me/accounts?fields=name,id,access_token,supports_instant_articles');
|
90 |
-
} catch (
|
91 |
-
throw new FacebookSDKException('Graph API returned an error: ' . $e
|
92 |
}
|
93 |
|
94 |
// Return the array of page objects for this user
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Client;
|
10 |
|
11 |
+
use Facebook\Exceptions\FacebookResponseException;
|
12 |
use Facebook\Facebook;
|
13 |
use Facebook\Exceptions\FacebookSDKException;
|
14 |
use Facebook\Authentication\AccessToken;
|
17 |
class Helper
|
18 |
{
|
19 |
/**
|
20 |
+
* @var Facebook The main Facebook service client.
|
21 |
*/
|
22 |
protected $facebook;
|
23 |
|
24 |
/**
|
25 |
+
* @param Facebook $facebook the main Facebook service client
|
26 |
*/
|
27 |
public function __construct($facebook)
|
28 |
{
|
38 |
* @param string $appID
|
39 |
* @param string $appSecret
|
40 |
*
|
41 |
+
* @return static
|
42 |
+
*
|
43 |
* @throws FacebookSDKException
|
44 |
*/
|
45 |
public static function create($appID, $appSecret)
|
76 |
// The OAuth 2.0 client handler helps us manage access tokens
|
77 |
$OAuth2Client = $this->facebook->getOAuth2Client();
|
78 |
$accessToken = $OAuth2Client->getLongLivedAccessToken($accessToken);
|
79 |
+
} catch (FacebookResponseException $e) {
|
80 |
throw new FacebookSDKException(
|
81 |
"Failed to exchange short-lived access token for long-lived access token."
|
82 |
);
|
90 |
// connected to this user
|
91 |
try {
|
92 |
$response = $this->facebook->get('/me/accounts?fields=name,id,access_token,supports_instant_articles');
|
93 |
+
} catch (FacebookResponseException $e) {
|
94 |
+
throw new FacebookSDKException('Graph API returned an error: ' . $e->getMessage());
|
95 |
}
|
96 |
|
97 |
// Return the array of page objects for this user
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/InstantArticleStatus.php
CHANGED
@@ -12,36 +12,34 @@ use Facebook\InstantArticles\Validators\Type;
|
|
12 |
|
13 |
class InstantArticleStatus
|
14 |
{
|
15 |
-
/**
|
16 |
-
* @var service The main Facebook service entity.
|
17 |
-
*/
|
18 |
const SUCCESS = 'success';
|
19 |
const NOT_FOUND = 'not_found';
|
20 |
const IN_PROGRESS = 'in_progress';
|
21 |
const FAILED = 'failed';
|
22 |
const UNKNOWN = 'unknown';
|
23 |
|
24 |
-
|
|
|
|
|
|
|
25 |
|
26 |
/**
|
27 |
* Instantiates a new InstantArticleStatus object.
|
28 |
*
|
29 |
-
* @param string $
|
30 |
-
* @param
|
31 |
-
*
|
32 |
-
* @throws FacebookSDKException
|
33 |
*/
|
34 |
-
public function __construct($status, $messages =
|
35 |
{
|
36 |
Type::enforceWithin(
|
37 |
$status,
|
38 |
-
|
39 |
self::SUCCESS,
|
40 |
self::NOT_FOUND,
|
41 |
self::IN_PROGRESS,
|
42 |
self::FAILED,
|
43 |
self::UNKNOWN
|
44 |
-
|
45 |
);
|
46 |
Type::enforceArrayOf(
|
47 |
$messages,
|
@@ -64,12 +62,12 @@ class InstantArticleStatus
|
|
64 |
$status = strtolower($status);
|
65 |
$validStatus = Type::isWithin(
|
66 |
$status,
|
67 |
-
|
68 |
self::SUCCESS,
|
69 |
self::NOT_FOUND,
|
70 |
self::IN_PROGRESS,
|
71 |
self::FAILED
|
72 |
-
|
73 |
);
|
74 |
if ($validStatus) {
|
75 |
return new self($status, $messages);
|
@@ -80,31 +78,59 @@ class InstantArticleStatus
|
|
80 |
}
|
81 |
}
|
82 |
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
84 |
{
|
85 |
return new self(self::SUCCESS, $messages);
|
86 |
}
|
87 |
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
89 |
{
|
90 |
return new self(self::NOT_FOUND, $messages);
|
91 |
}
|
92 |
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
94 |
{
|
95 |
return new self(self::IN_PROGRESS, $messages);
|
96 |
}
|
97 |
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
99 |
{
|
100 |
return new self(self::FAILED, $messages);
|
101 |
}
|
102 |
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
104 |
{
|
105 |
return new self(self::UNKNOWN, $messages);
|
106 |
}
|
107 |
|
|
|
|
|
|
|
108 |
public function addMessage($message)
|
109 |
{
|
110 |
Type::enforce(
|
@@ -114,11 +140,17 @@ class InstantArticleStatus
|
|
114 |
$this->messages[] = $message;
|
115 |
}
|
116 |
|
|
|
|
|
|
|
117 |
public function getMessages()
|
118 |
{
|
119 |
return $this->messages;
|
120 |
}
|
121 |
|
|
|
|
|
|
|
122 |
public function getStatus()
|
123 |
{
|
124 |
return $this->status;
|
12 |
|
13 |
class InstantArticleStatus
|
14 |
{
|
|
|
|
|
|
|
15 |
const SUCCESS = 'success';
|
16 |
const NOT_FOUND = 'not_found';
|
17 |
const IN_PROGRESS = 'in_progress';
|
18 |
const FAILED = 'failed';
|
19 |
const UNKNOWN = 'unknown';
|
20 |
|
21 |
+
/**
|
22 |
+
* @var ServerMessage[]
|
23 |
+
*/
|
24 |
+
private $messages = [];
|
25 |
|
26 |
/**
|
27 |
* Instantiates a new InstantArticleStatus object.
|
28 |
*
|
29 |
+
* @param string $status
|
30 |
+
* @param ServerMessage[] $messages
|
|
|
|
|
31 |
*/
|
32 |
+
public function __construct($status, $messages = [])
|
33 |
{
|
34 |
Type::enforceWithin(
|
35 |
$status,
|
36 |
+
[
|
37 |
self::SUCCESS,
|
38 |
self::NOT_FOUND,
|
39 |
self::IN_PROGRESS,
|
40 |
self::FAILED,
|
41 |
self::UNKNOWN
|
42 |
+
]
|
43 |
);
|
44 |
Type::enforceArrayOf(
|
45 |
$messages,
|
62 |
$status = strtolower($status);
|
63 |
$validStatus = Type::isWithin(
|
64 |
$status,
|
65 |
+
[
|
66 |
self::SUCCESS,
|
67 |
self::NOT_FOUND,
|
68 |
self::IN_PROGRESS,
|
69 |
self::FAILED
|
70 |
+
]
|
71 |
);
|
72 |
if ($validStatus) {
|
73 |
return new self($status, $messages);
|
78 |
}
|
79 |
}
|
80 |
|
81 |
+
/**
|
82 |
+
* @param ServerMessage[] $messages
|
83 |
+
*
|
84 |
+
* @return InstantArticleStatus
|
85 |
+
*/
|
86 |
+
public static function success($messages = [])
|
87 |
{
|
88 |
return new self(self::SUCCESS, $messages);
|
89 |
}
|
90 |
|
91 |
+
/**
|
92 |
+
* @param ServerMessage[] $messages
|
93 |
+
*
|
94 |
+
* @return InstantArticleStatus
|
95 |
+
*/
|
96 |
+
public static function notFound($messages = [])
|
97 |
{
|
98 |
return new self(self::NOT_FOUND, $messages);
|
99 |
}
|
100 |
|
101 |
+
/**
|
102 |
+
* @param ServerMessage[] $messages
|
103 |
+
*
|
104 |
+
* @return InstantArticleStatus
|
105 |
+
*/
|
106 |
+
public static function inProgress($messages = [])
|
107 |
{
|
108 |
return new self(self::IN_PROGRESS, $messages);
|
109 |
}
|
110 |
|
111 |
+
/**
|
112 |
+
* @param ServerMessage[] $messages
|
113 |
+
*
|
114 |
+
* @return InstantArticleStatus
|
115 |
+
*/
|
116 |
+
public static function failed($messages = [])
|
117 |
{
|
118 |
return new self(self::FAILED, $messages);
|
119 |
}
|
120 |
|
121 |
+
/**
|
122 |
+
* @param ServerMessage[] $messages
|
123 |
+
*
|
124 |
+
* @return InstantArticleStatus
|
125 |
+
*/
|
126 |
+
public static function unknown($messages = [])
|
127 |
{
|
128 |
return new self(self::UNKNOWN, $messages);
|
129 |
}
|
130 |
|
131 |
+
/**
|
132 |
+
* @param ServerMessage $message
|
133 |
+
*/
|
134 |
public function addMessage($message)
|
135 |
{
|
136 |
Type::enforce(
|
140 |
$this->messages[] = $message;
|
141 |
}
|
142 |
|
143 |
+
/**
|
144 |
+
* @return ServerMessage[]
|
145 |
+
*/
|
146 |
public function getMessages()
|
147 |
{
|
148 |
return $this->messages;
|
149 |
}
|
150 |
|
151 |
+
/**
|
152 |
+
* @return string
|
153 |
+
*/
|
154 |
public function getStatus()
|
155 |
{
|
156 |
return $this->status;
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/ServerMessage.php
CHANGED
@@ -17,19 +17,30 @@ class ServerMessage
|
|
17 |
const WARNING = 'warning';
|
18 |
const INFO = 'info';
|
19 |
|
|
|
|
|
|
|
20 |
private $level;
|
|
|
|
|
|
|
|
|
21 |
private $message;
|
22 |
|
|
|
|
|
|
|
|
|
23 |
public function __construct($level, $message)
|
24 |
{
|
25 |
Type::enforceWithin(
|
26 |
$level,
|
27 |
-
|
28 |
self::FATAL,
|
29 |
self::ERROR,
|
30 |
self::WARNING,
|
31 |
self::INFO
|
32 |
-
|
33 |
);
|
34 |
Type::enforce(
|
35 |
$message,
|
@@ -52,12 +63,12 @@ class ServerMessage
|
|
52 |
$level = strtolower($level);
|
53 |
$validLevel = Type::isWithin(
|
54 |
$level,
|
55 |
-
|
56 |
self::FATAL,
|
57 |
self::ERROR,
|
58 |
self::WARNING,
|
59 |
self::INFO
|
60 |
-
|
61 |
);
|
62 |
if ($validLevel) {
|
63 |
return new self($level, $message);
|
@@ -68,27 +79,49 @@ class ServerMessage
|
|
68 |
}
|
69 |
}
|
70 |
|
|
|
|
|
|
|
|
|
|
|
71 |
public static function fatal($message)
|
72 |
{
|
73 |
return new self(self::FATAL, $message);
|
74 |
}
|
75 |
|
|
|
|
|
|
|
|
|
|
|
76 |
public static function error($message)
|
77 |
{
|
78 |
return new self(self::ERROR, $message);
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
81 |
public static function warning($message)
|
82 |
{
|
83 |
return new self(self::WARNING, $message);
|
84 |
}
|
85 |
|
|
|
|
|
|
|
|
|
|
|
86 |
public static function info($message)
|
87 |
{
|
88 |
return new self(self::INFO, $message);
|
89 |
}
|
90 |
|
91 |
-
|
|
|
|
|
92 |
public function getMessage()
|
93 |
{
|
94 |
return $this->message;
|
@@ -103,7 +136,8 @@ class ServerMessage
|
|
103 |
* Auxiliary method to extract full qualified class name.
|
104 |
* @return string The full qualified name of class
|
105 |
*/
|
106 |
-
public static function getClassName()
|
|
|
107 |
return get_called_class();
|
108 |
}
|
109 |
}
|
17 |
const WARNING = 'warning';
|
18 |
const INFO = 'info';
|
19 |
|
20 |
+
/**
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
private $level;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
private $message;
|
29 |
|
30 |
+
/**
|
31 |
+
* @param string $level
|
32 |
+
* @param string $message
|
33 |
+
*/
|
34 |
public function __construct($level, $message)
|
35 |
{
|
36 |
Type::enforceWithin(
|
37 |
$level,
|
38 |
+
[
|
39 |
self::FATAL,
|
40 |
self::ERROR,
|
41 |
self::WARNING,
|
42 |
self::INFO
|
43 |
+
]
|
44 |
);
|
45 |
Type::enforce(
|
46 |
$message,
|
63 |
$level = strtolower($level);
|
64 |
$validLevel = Type::isWithin(
|
65 |
$level,
|
66 |
+
[
|
67 |
self::FATAL,
|
68 |
self::ERROR,
|
69 |
self::WARNING,
|
70 |
self::INFO
|
71 |
+
]
|
72 |
);
|
73 |
if ($validLevel) {
|
74 |
return new self($level, $message);
|
79 |
}
|
80 |
}
|
81 |
|
82 |
+
/**
|
83 |
+
* @param string $message
|
84 |
+
*
|
85 |
+
* @return ServerMessage
|
86 |
+
*/
|
87 |
public static function fatal($message)
|
88 |
{
|
89 |
return new self(self::FATAL, $message);
|
90 |
}
|
91 |
|
92 |
+
/**
|
93 |
+
* @param string $message
|
94 |
+
*
|
95 |
+
* @return ServerMessage
|
96 |
+
*/
|
97 |
public static function error($message)
|
98 |
{
|
99 |
return new self(self::ERROR, $message);
|
100 |
}
|
101 |
|
102 |
+
/**
|
103 |
+
* @param string $message
|
104 |
+
*
|
105 |
+
* @return ServerMessage
|
106 |
+
*/
|
107 |
public static function warning($message)
|
108 |
{
|
109 |
return new self(self::WARNING, $message);
|
110 |
}
|
111 |
|
112 |
+
/**
|
113 |
+
* @param string $message
|
114 |
+
*
|
115 |
+
* @return ServerMessage
|
116 |
+
*/
|
117 |
public static function info($message)
|
118 |
{
|
119 |
return new self(self::INFO, $message);
|
120 |
}
|
121 |
|
122 |
+
/**
|
123 |
+
* @return string
|
124 |
+
*/
|
125 |
public function getMessage()
|
126 |
{
|
127 |
return $this->message;
|
136 |
* Auxiliary method to extract full qualified class name.
|
137 |
* @return string The full qualified name of class
|
138 |
*/
|
139 |
+
public static function getClassName()
|
140 |
+
{
|
141 |
return get_called_class();
|
142 |
}
|
143 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Ad.php
CHANGED
@@ -20,7 +20,7 @@ use Facebook\InstantArticles\Validators\Type;
|
|
20 |
* </iframe>
|
21 |
* </figure>
|
22 |
*
|
23 |
-
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/
|
24 |
*/
|
25 |
class Ad extends Element
|
26 |
{
|
@@ -79,7 +79,9 @@ class Ad extends Element
|
|
79 |
/**
|
80 |
* Sets the height of your ad.
|
81 |
*
|
82 |
-
* @param int The height of your ad.
|
|
|
|
|
83 |
*/
|
84 |
public function withHeight($height)
|
85 |
{
|
@@ -92,7 +94,9 @@ class Ad extends Element
|
|
92 |
/**
|
93 |
* Sets the source for the ad.
|
94 |
*
|
95 |
-
* @param string The source of the content for your ad.
|
|
|
|
|
96 |
*/
|
97 |
public function withSource($source)
|
98 |
{
|
@@ -105,7 +109,9 @@ class Ad extends Element
|
|
105 |
/**
|
106 |
* Sets the width of your ad.
|
107 |
*
|
108 |
-
* @param int The width of your ad.
|
|
|
|
|
109 |
*/
|
110 |
public function withWidth($width)
|
111 |
{
|
@@ -119,6 +125,8 @@ class Ad extends Element
|
|
119 |
* Sets the unescaped HTML of your ad.
|
120 |
*
|
121 |
* @param \DOMNode $html The unescaped HTML of your ad.
|
|
|
|
|
122 |
*/
|
123 |
public function withHTML($html)
|
124 |
{
|
@@ -129,7 +137,7 @@ class Ad extends Element
|
|
129 |
}
|
130 |
|
131 |
/**
|
132 |
-
* @return True if Ad has been set to reusable.
|
133 |
*/
|
134 |
public function getIsDefaultForReuse()
|
135 |
{
|
@@ -179,13 +187,20 @@ class Ad extends Element
|
|
179 |
/**
|
180 |
* Structure and create the full Ad in a DOMElement.
|
181 |
*
|
182 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
183 |
*/
|
184 |
public function toDOMElement($document = null)
|
185 |
{
|
186 |
if (!$document) {
|
187 |
$document = new \DOMDocument();
|
188 |
}
|
|
|
|
|
|
|
|
|
|
|
189 |
$figure = $document->createElement('figure');
|
190 |
$iframe = $document->createElement('iframe');
|
191 |
|
@@ -219,4 +234,14 @@ class Ad extends Element
|
|
219 |
|
220 |
return $figure;
|
221 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
20 |
* </iframe>
|
21 |
* </figure>
|
22 |
*
|
23 |
+
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/ad}
|
24 |
*/
|
25 |
class Ad extends Element
|
26 |
{
|
79 |
/**
|
80 |
* Sets the height of your ad.
|
81 |
*
|
82 |
+
* @param int $height The height of your ad.
|
83 |
+
*
|
84 |
+
* @return $this
|
85 |
*/
|
86 |
public function withHeight($height)
|
87 |
{
|
94 |
/**
|
95 |
* Sets the source for the ad.
|
96 |
*
|
97 |
+
* @param string $source The source of the content for your ad.
|
98 |
+
*
|
99 |
+
* @return $this
|
100 |
*/
|
101 |
public function withSource($source)
|
102 |
{
|
109 |
/**
|
110 |
* Sets the width of your ad.
|
111 |
*
|
112 |
+
* @param int $width The width of your ad.
|
113 |
+
*
|
114 |
+
* @return $this
|
115 |
*/
|
116 |
public function withWidth($width)
|
117 |
{
|
125 |
* Sets the unescaped HTML of your ad.
|
126 |
*
|
127 |
* @param \DOMNode $html The unescaped HTML of your ad.
|
128 |
+
*
|
129 |
+
* @return $this
|
130 |
*/
|
131 |
public function withHTML($html)
|
132 |
{
|
137 |
}
|
138 |
|
139 |
/**
|
140 |
+
* @return bool True if Ad has been set to reusable.
|
141 |
*/
|
142 |
public function getIsDefaultForReuse()
|
143 |
{
|
187 |
/**
|
188 |
* Structure and create the full Ad in a DOMElement.
|
189 |
*
|
190 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
191 |
+
*
|
192 |
+
* @return \DOMElement
|
193 |
*/
|
194 |
public function toDOMElement($document = null)
|
195 |
{
|
196 |
if (!$document) {
|
197 |
$document = new \DOMDocument();
|
198 |
}
|
199 |
+
|
200 |
+
if (!$this->isValid()) {
|
201 |
+
return $this->emptyElement($document);
|
202 |
+
}
|
203 |
+
|
204 |
$figure = $document->createElement('figure');
|
205 |
$iframe = $document->createElement('iframe');
|
206 |
|
234 |
|
235 |
return $figure;
|
236 |
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Overrides the Element::isValid().
|
240 |
+
* @see Element::isValid().
|
241 |
+
* @return true for valid Ad that contains valid src or html, false otherwise.
|
242 |
+
*/
|
243 |
+
public function isValid()
|
244 |
+
{
|
245 |
+
return !Type::isTextEmpty($this->source) || $this->html;
|
246 |
+
}
|
247 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Analytics.php
CHANGED
@@ -52,7 +52,9 @@ class Analytics extends Element
|
|
52 |
/**
|
53 |
* Sets the source for the ad.
|
54 |
*
|
55 |
-
* @param string The source of the content for your ad.
|
|
|
|
|
56 |
*/
|
57 |
public function withSource($source)
|
58 |
{
|
@@ -65,7 +67,9 @@ class Analytics extends Element
|
|
65 |
/**
|
66 |
* Sets the unescaped HTML of your ad.
|
67 |
*
|
68 |
-
* @param \DOMNode The unescaped HTML of your ad.
|
|
|
|
|
69 |
*/
|
70 |
public function withHTML($html)
|
71 |
{
|
@@ -98,13 +102,20 @@ class Analytics extends Element
|
|
98 |
/**
|
99 |
* Structure and create the full ArticleAd in a DOMElement.
|
100 |
*
|
101 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
102 |
*/
|
103 |
public function toDOMElement($document = null)
|
104 |
{
|
105 |
if (!$document) {
|
106 |
$document = new \DOMDocument();
|
107 |
}
|
|
|
|
|
|
|
|
|
|
|
108 |
$figure = $document->createElement('figure');
|
109 |
$iframe = $document->createElement('iframe');
|
110 |
|
@@ -126,4 +137,14 @@ class Analytics extends Element
|
|
126 |
|
127 |
return $figure;
|
128 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
}
|
52 |
/**
|
53 |
* Sets the source for the ad.
|
54 |
*
|
55 |
+
* @param string $source The source of the content for your ad.
|
56 |
+
*
|
57 |
+
* @return $this
|
58 |
*/
|
59 |
public function withSource($source)
|
60 |
{
|
67 |
/**
|
68 |
* Sets the unescaped HTML of your ad.
|
69 |
*
|
70 |
+
* @param \DOMNode $html The unescaped HTML of your ad.
|
71 |
+
*
|
72 |
+
* @return $this
|
73 |
*/
|
74 |
public function withHTML($html)
|
75 |
{
|
102 |
/**
|
103 |
* Structure and create the full ArticleAd in a DOMElement.
|
104 |
*
|
105 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
106 |
+
*
|
107 |
+
* @return \DOMElement
|
108 |
*/
|
109 |
public function toDOMElement($document = null)
|
110 |
{
|
111 |
if (!$document) {
|
112 |
$document = new \DOMDocument();
|
113 |
}
|
114 |
+
|
115 |
+
if (!$this->isValid()) {
|
116 |
+
return $this->emptyElement($document);
|
117 |
+
}
|
118 |
+
|
119 |
$figure = $document->createElement('figure');
|
120 |
$iframe = $document->createElement('iframe');
|
121 |
|
137 |
|
138 |
return $figure;
|
139 |
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Overrides the Element::isValid().
|
143 |
+
* @see Element::isValid().
|
144 |
+
* @return true for valid Analytics that contains valid source or html, false otherwise.
|
145 |
+
*/
|
146 |
+
public function isValid()
|
147 |
+
{
|
148 |
+
return !Type::isTextEmpty($this->source) || $this->html;
|
149 |
+
}
|
150 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Anchor.php
CHANGED
@@ -8,6 +8,8 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
|
|
11 |
/**
|
12 |
* An anchor.
|
13 |
*
|
@@ -25,22 +27,22 @@ class Anchor extends FormattedText
|
|
25 |
*/
|
26 |
private $rel;
|
27 |
|
28 |
-
/**
|
29 |
-
* @var string content.
|
30 |
-
*/
|
31 |
-
private $content;
|
32 |
-
|
33 |
private function __construct()
|
34 |
{
|
35 |
}
|
36 |
|
|
|
|
|
|
|
37 |
public static function create()
|
38 |
{
|
39 |
return new self();
|
40 |
}
|
41 |
|
42 |
/**
|
43 |
-
* @param string the anchor link
|
|
|
|
|
44 |
*/
|
45 |
public function withHref($href)
|
46 |
{
|
@@ -50,7 +52,9 @@ class Anchor extends FormattedText
|
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
-
* @param string the anchor rel attribute
|
|
|
|
|
54 |
*/
|
55 |
public function withRel($rel)
|
56 |
{
|
@@ -78,13 +82,20 @@ class Anchor extends FormattedText
|
|
78 |
/**
|
79 |
* Structure and create <a> node.
|
80 |
*
|
81 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
82 |
*/
|
83 |
public function toDOMElement($document = null)
|
84 |
{
|
85 |
if (!$document) {
|
86 |
$document = new \DOMDocument();
|
87 |
}
|
|
|
|
|
|
|
|
|
|
|
88 |
$anchor = $document->createElement('a');
|
89 |
|
90 |
if ($this->href) {
|
@@ -98,4 +109,14 @@ class Anchor extends FormattedText
|
|
98 |
|
99 |
return $anchor;
|
100 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
+
use Facebook\InstantArticles\Validators\Type;
|
12 |
+
|
13 |
/**
|
14 |
* An anchor.
|
15 |
*
|
27 |
*/
|
28 |
private $rel;
|
29 |
|
|
|
|
|
|
|
|
|
|
|
30 |
private function __construct()
|
31 |
{
|
32 |
}
|
33 |
|
34 |
+
/**
|
35 |
+
* @return Anchor
|
36 |
+
*/
|
37 |
public static function create()
|
38 |
{
|
39 |
return new self();
|
40 |
}
|
41 |
|
42 |
/**
|
43 |
+
* @param string $href the anchor link
|
44 |
+
*
|
45 |
+
* @return $this
|
46 |
*/
|
47 |
public function withHref($href)
|
48 |
{
|
52 |
}
|
53 |
|
54 |
/**
|
55 |
+
* @param string $rel the anchor rel attribute
|
56 |
+
*
|
57 |
+
* @return $this
|
58 |
*/
|
59 |
public function withRel($rel)
|
60 |
{
|
82 |
/**
|
83 |
* Structure and create <a> node.
|
84 |
*
|
85 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
86 |
+
*
|
87 |
+
* @return \DOMElement
|
88 |
*/
|
89 |
public function toDOMElement($document = null)
|
90 |
{
|
91 |
if (!$document) {
|
92 |
$document = new \DOMDocument();
|
93 |
}
|
94 |
+
|
95 |
+
if (!$this->isValid()) {
|
96 |
+
return $this->emptyElement($document);
|
97 |
+
}
|
98 |
+
|
99 |
$anchor = $document->createElement('a');
|
100 |
|
101 |
if ($this->href) {
|
109 |
|
110 |
return $anchor;
|
111 |
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Overrides the TextContainer::isValid().
|
115 |
+
* @see TextContainer::isValid().
|
116 |
+
* @return true for valid Anchor when it has href, false otherwise.
|
117 |
+
*/
|
118 |
+
public function isValid()
|
119 |
+
{
|
120 |
+
return !Type::isTextEmpty($this->href);
|
121 |
+
}
|
122 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/AnimatedGIF.php
CHANGED
@@ -12,11 +12,11 @@ namespace Facebook\InstantArticles\Elements;
|
|
12 |
* An AnimatedGIF
|
13 |
* Also consider to use one of the other media types for an article:
|
14 |
* <ul>
|
15 |
-
* <li
|
16 |
-
* <li
|
17 |
-
* <li
|
18 |
-
* <li
|
19 |
-
* <li
|
20 |
* </ul>.
|
21 |
*
|
22 |
* Example:
|
@@ -25,6 +25,11 @@ namespace Facebook\InstantArticles\Elements;
|
|
25 |
* <figcaption>This image is amazing</figcaption>
|
26 |
* </figure>
|
27 |
*
|
|
|
|
|
|
|
|
|
|
|
28 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/animated-gif}
|
29 |
*/
|
30 |
class AnimatedGIF extends Image
|
12 |
* An AnimatedGIF
|
13 |
* Also consider to use one of the other media types for an article:
|
14 |
* <ul>
|
15 |
+
* <li>Audio</li>
|
16 |
+
* <li>Image</li>
|
17 |
+
* <li>Video</li>
|
18 |
+
* <li>SlideShow</li>
|
19 |
+
* <li>Map</li>
|
20 |
* </ul>.
|
21 |
*
|
22 |
* Example:
|
25 |
* <figcaption>This image is amazing</figcaption>
|
26 |
* </figure>
|
27 |
*
|
28 |
+
* @see Audio
|
29 |
+
* @see Image
|
30 |
+
* @see Video
|
31 |
+
* @see SlideShow
|
32 |
+
* @see Map
|
33 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/animated-gif}
|
34 |
*/
|
35 |
class AnimatedGIF extends Image
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Audible.php
CHANGED
@@ -8,13 +8,12 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
/**
|
13 |
* Abstract class Audible
|
14 |
* This class represents all elements that can contain Audio
|
15 |
* <ul>
|
16 |
-
* <li
|
17 |
-
* <li
|
18 |
* </ul>.
|
19 |
*
|
20 |
* Example:
|
@@ -22,14 +21,18 @@ namespace Facebook\InstantArticles\Elements;
|
|
22 |
* <source src="http://mydomain.com/path/to/audio.mp3" />
|
23 |
* </audio>
|
24 |
*
|
|
|
|
|
25 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/image}
|
26 |
*/
|
27 |
-
abstract class Audible extends Element
|
28 |
{
|
29 |
/**
|
30 |
* Adds audio to this image.
|
31 |
*
|
32 |
-
* @param Audio The audio object
|
|
|
|
|
33 |
*/
|
34 |
abstract public function withAudio($audio);
|
35 |
}
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
/**
|
12 |
* Abstract class Audible
|
13 |
* This class represents all elements that can contain Audio
|
14 |
* <ul>
|
15 |
+
* <li>Image</li>
|
16 |
+
* <li>SlideShow</li>
|
17 |
* </ul>.
|
18 |
*
|
19 |
* Example:
|
21 |
* <source src="http://mydomain.com/path/to/audio.mp3" />
|
22 |
* </audio>
|
23 |
*
|
24 |
+
* @see Image
|
25 |
+
* @see SlideShow
|
26 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/image}
|
27 |
*/
|
28 |
+
abstract class Audible extends Element implements Container
|
29 |
{
|
30 |
/**
|
31 |
* Adds audio to this image.
|
32 |
*
|
33 |
+
* @param Audio $audio The audio object
|
34 |
+
*
|
35 |
+
* @return $this
|
36 |
*/
|
37 |
abstract public function withAudio($audio);
|
38 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Audio.php
CHANGED
@@ -14,10 +14,10 @@ use Facebook\InstantArticles\Validators\Type;
|
|
14 |
* An audio within for the article.
|
15 |
* Also consider to use one of the other media types for an article:
|
16 |
* <ul>
|
17 |
-
* <li
|
18 |
-
* <li
|
19 |
-
* <li
|
20 |
-
* <li
|
21 |
* </ul>.
|
22 |
*
|
23 |
* Example:
|
@@ -25,6 +25,10 @@ use Facebook\InstantArticles\Validators\Type;
|
|
25 |
* <source src="http://foo.com/mp3">
|
26 |
* </audio>
|
27 |
*
|
|
|
|
|
|
|
|
|
28 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/audio}
|
29 |
*/
|
30 |
class Audio extends Element
|
@@ -58,6 +62,9 @@ class Audio extends Element
|
|
58 |
{
|
59 |
}
|
60 |
|
|
|
|
|
|
|
61 |
public static function create()
|
62 |
{
|
63 |
return new self();
|
@@ -66,7 +73,9 @@ class Audio extends Element
|
|
66 |
/**
|
67 |
* Sets the URL for the audio. It is REQUIRED.
|
68 |
*
|
69 |
-
* @param string The url of image. Ie: http://domain.com/audiofile.mp3
|
|
|
|
|
70 |
*/
|
71 |
public function withURL($url)
|
72 |
{
|
@@ -79,7 +88,9 @@ class Audio extends Element
|
|
79 |
/**
|
80 |
* The audio title.
|
81 |
*
|
82 |
-
* @param string the audio title that will be shown
|
|
|
|
|
83 |
*/
|
84 |
public function withTitle($title)
|
85 |
{
|
@@ -91,6 +102,8 @@ class Audio extends Element
|
|
91 |
|
92 |
/**
|
93 |
* It will make audio start automatically.
|
|
|
|
|
94 |
*/
|
95 |
public function enableAutoplay()
|
96 |
{
|
@@ -101,6 +114,8 @@ class Audio extends Element
|
|
101 |
|
102 |
/**
|
103 |
* It will make audio *NOT* start automatically.
|
|
|
|
|
104 |
*/
|
105 |
public function disableAutoplay()
|
106 |
{
|
@@ -111,6 +126,8 @@ class Audio extends Element
|
|
111 |
|
112 |
/**
|
113 |
* It will make audio be muted initially.
|
|
|
|
|
114 |
*/
|
115 |
public function enableMuted()
|
116 |
{
|
@@ -121,6 +138,8 @@ class Audio extends Element
|
|
121 |
|
122 |
/**
|
123 |
* It will make audio laud.
|
|
|
|
|
124 |
*/
|
125 |
public function disableMuted()
|
126 |
{
|
@@ -131,6 +150,7 @@ class Audio extends Element
|
|
131 |
|
132 |
/**
|
133 |
* Gets the audio title
|
|
|
134 |
* @return string Audio title
|
135 |
*/
|
136 |
public function getTitle()
|
@@ -140,6 +160,7 @@ class Audio extends Element
|
|
140 |
|
141 |
/**
|
142 |
* Gets the url for the audio
|
|
|
143 |
* @return string Audio url
|
144 |
*/
|
145 |
public function getUrl()
|
@@ -149,6 +170,7 @@ class Audio extends Element
|
|
149 |
|
150 |
/**
|
151 |
* Gets the playback definition
|
|
|
152 |
* @return string playback definition
|
153 |
*/
|
154 |
public function getPlayback()
|
@@ -159,13 +181,20 @@ class Audio extends Element
|
|
159 |
/**
|
160 |
* Structure and create the full ArticleImage in a XML format DOMElement.
|
161 |
*
|
162 |
-
* @param $document
|
|
|
|
|
163 |
*/
|
164 |
public function toDOMElement($document = null)
|
165 |
{
|
166 |
if (!$document) {
|
167 |
$document = new \DOMDocument();
|
168 |
}
|
|
|
|
|
|
|
|
|
|
|
169 |
$element = $document->createElement('audio');
|
170 |
|
171 |
// title markup optional
|
@@ -175,12 +204,12 @@ class Audio extends Element
|
|
175 |
|
176 |
// Autoplay mode markup optional
|
177 |
if ($this->autoplay) {
|
178 |
-
$element->setAttribute('autoplay', 'autoplay');
|
179 |
}
|
180 |
|
181 |
// Autoplay mode markup optional
|
182 |
if ($this->muted) {
|
183 |
-
$element->setAttribute('muted', 'muted');
|
184 |
}
|
185 |
|
186 |
// Audio URL markup. REQUIRED
|
@@ -192,4 +221,15 @@ class Audio extends Element
|
|
192 |
|
193 |
return $element;
|
194 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
}
|
14 |
* An audio within for the article.
|
15 |
* Also consider to use one of the other media types for an article:
|
16 |
* <ul>
|
17 |
+
* <li>Image</li>
|
18 |
+
* <li>Video</li>
|
19 |
+
* <li>SlideShow</li>
|
20 |
+
* <li>Map</li>
|
21 |
* </ul>.
|
22 |
*
|
23 |
* Example:
|
25 |
* <source src="http://foo.com/mp3">
|
26 |
* </audio>
|
27 |
*
|
28 |
+
* @see Image
|
29 |
+
* @see Video
|
30 |
+
* @see SlideShow
|
31 |
+
* @see Map
|
32 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/audio}
|
33 |
*/
|
34 |
class Audio extends Element
|
62 |
{
|
63 |
}
|
64 |
|
65 |
+
/**
|
66 |
+
* @return Audio
|
67 |
+
*/
|
68 |
public static function create()
|
69 |
{
|
70 |
return new self();
|
73 |
/**
|
74 |
* Sets the URL for the audio. It is REQUIRED.
|
75 |
*
|
76 |
+
* @param string $url The url of image. Ie: http://domain.com/audiofile.mp3
|
77 |
+
*
|
78 |
+
* @return $this
|
79 |
*/
|
80 |
public function withURL($url)
|
81 |
{
|
88 |
/**
|
89 |
* The audio title.
|
90 |
*
|
91 |
+
* @param string $title the audio title that will be shown
|
92 |
+
*
|
93 |
+
* @return $this
|
94 |
*/
|
95 |
public function withTitle($title)
|
96 |
{
|
102 |
|
103 |
/**
|
104 |
* It will make audio start automatically.
|
105 |
+
*
|
106 |
+
* @return $this
|
107 |
*/
|
108 |
public function enableAutoplay()
|
109 |
{
|
114 |
|
115 |
/**
|
116 |
* It will make audio *NOT* start automatically.
|
117 |
+
*
|
118 |
+
* @return $this
|
119 |
*/
|
120 |
public function disableAutoplay()
|
121 |
{
|
126 |
|
127 |
/**
|
128 |
* It will make audio be muted initially.
|
129 |
+
*
|
130 |
+
* @return $this
|
131 |
*/
|
132 |
public function enableMuted()
|
133 |
{
|
138 |
|
139 |
/**
|
140 |
* It will make audio laud.
|
141 |
+
*
|
142 |
+
* @return $this
|
143 |
*/
|
144 |
public function disableMuted()
|
145 |
{
|
150 |
|
151 |
/**
|
152 |
* Gets the audio title
|
153 |
+
*
|
154 |
* @return string Audio title
|
155 |
*/
|
156 |
public function getTitle()
|
160 |
|
161 |
/**
|
162 |
* Gets the url for the audio
|
163 |
+
*
|
164 |
* @return string Audio url
|
165 |
*/
|
166 |
public function getUrl()
|
170 |
|
171 |
/**
|
172 |
* Gets the playback definition
|
173 |
+
*
|
174 |
* @return string playback definition
|
175 |
*/
|
176 |
public function getPlayback()
|
181 |
/**
|
182 |
* Structure and create the full ArticleImage in a XML format DOMElement.
|
183 |
*
|
184 |
+
* @param \DOMDocument $document where this element will be appended. Optional
|
185 |
+
*
|
186 |
+
* @return \DOMElement
|
187 |
*/
|
188 |
public function toDOMElement($document = null)
|
189 |
{
|
190 |
if (!$document) {
|
191 |
$document = new \DOMDocument();
|
192 |
}
|
193 |
+
|
194 |
+
if (!$this->isValid()) {
|
195 |
+
return $this->emptyElement($document);
|
196 |
+
}
|
197 |
+
|
198 |
$element = $document->createElement('audio');
|
199 |
|
200 |
// title markup optional
|
204 |
|
205 |
// Autoplay mode markup optional
|
206 |
if ($this->autoplay) {
|
207 |
+
$element->setAttribute('autoplay', 'autoplay');
|
208 |
}
|
209 |
|
210 |
// Autoplay mode markup optional
|
211 |
if ($this->muted) {
|
212 |
+
$element->setAttribute('muted', 'muted');
|
213 |
}
|
214 |
|
215 |
// Audio URL markup. REQUIRED
|
221 |
|
222 |
return $element;
|
223 |
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Overrides the Element::isValid().
|
227 |
+
*
|
228 |
+
* @see Element::isValid().
|
229 |
+
* @return true for valid Audio that contains not empty url, false otherwise.
|
230 |
+
*/
|
231 |
+
public function isValid()
|
232 |
+
{
|
233 |
+
return !Type::isTextEmpty($this->url);
|
234 |
+
}
|
235 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Author.php
CHANGED
@@ -13,21 +13,21 @@ use Facebook\InstantArticles\Validators\Type;
|
|
13 |
/**
|
14 |
* Represents an author of the article.
|
15 |
*
|
16 |
-
* <
|
17 |
* <a rel="facebook" href="http://facebook.com/everton.rosario">Everton</a>
|
18 |
* Everton Rosario is a passionate mountain biker on Facebook
|
19 |
* </address>
|
20 |
*
|
21 |
* or
|
22 |
*
|
23 |
-
* <
|
24 |
* <a href="http://twitter.com/evertonrosario">Everton On Twitter</a>
|
25 |
* Everton Rosario is a passionate mountain biker on Twitter
|
26 |
* </address>
|
27 |
*
|
28 |
* or
|
29 |
*
|
30 |
-
* <
|
31 |
* <a>Everton</a>
|
32 |
* Everton Rosario is a passionate mountain biker without Link
|
33 |
* </address>
|
@@ -54,16 +54,14 @@ class Author extends Element
|
|
54 |
*/
|
55 |
private $roleContribution;
|
56 |
|
57 |
-
/**
|
58 |
-
* Private constructor.
|
59 |
-
* @see ArticleTime::create();.
|
60 |
-
*/
|
61 |
private function __construct()
|
62 |
{
|
63 |
}
|
64 |
|
65 |
/**
|
66 |
* Creates an Author instance.
|
|
|
|
|
67 |
*/
|
68 |
public static function create()
|
69 |
{
|
@@ -72,7 +70,10 @@ class Author extends Element
|
|
72 |
|
73 |
/**
|
74 |
* Defines the link URL for the author
|
75 |
-
*
|
|
|
|
|
|
|
76 |
*/
|
77 |
public function withURL($url)
|
78 |
{
|
@@ -84,7 +85,10 @@ class Author extends Element
|
|
84 |
|
85 |
/**
|
86 |
* Author name.
|
87 |
-
*
|
|
|
|
|
|
|
88 |
*/
|
89 |
public function withName($name)
|
90 |
{
|
@@ -96,7 +100,10 @@ class Author extends Element
|
|
96 |
|
97 |
/**
|
98 |
* Author short description biography
|
99 |
-
*
|
|
|
|
|
|
|
100 |
*/
|
101 |
public function withDescription($description)
|
102 |
{
|
@@ -108,7 +115,10 @@ class Author extends Element
|
|
108 |
|
109 |
/**
|
110 |
* Author role/contribution
|
111 |
-
*
|
|
|
|
|
|
|
112 |
*/
|
113 |
public function withRoleContribution($role_contribution)
|
114 |
{
|
@@ -153,7 +163,9 @@ class Author extends Element
|
|
153 |
/**
|
154 |
* Structure and create the full Author in a XML format DOMElement.
|
155 |
*
|
156 |
-
* @param $document
|
|
|
|
|
157 |
*/
|
158 |
public function toDOMElement($document = null)
|
159 |
{
|
@@ -161,6 +173,10 @@ class Author extends Element
|
|
161 |
$document = new \DOMDocument();
|
162 |
}
|
163 |
|
|
|
|
|
|
|
|
|
164 |
$author_url = $this->url ? $this->url : null;
|
165 |
$is_fb_author = strpos($author_url, 'facebook.com') !== false;
|
166 |
|
@@ -186,4 +202,15 @@ class Author extends Element
|
|
186 |
|
187 |
return $element;
|
188 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
}
|
13 |
/**
|
14 |
* Represents an author of the article.
|
15 |
*
|
16 |
+
* <address>
|
17 |
* <a rel="facebook" href="http://facebook.com/everton.rosario">Everton</a>
|
18 |
* Everton Rosario is a passionate mountain biker on Facebook
|
19 |
* </address>
|
20 |
*
|
21 |
* or
|
22 |
*
|
23 |
+
* <address>
|
24 |
* <a href="http://twitter.com/evertonrosario">Everton On Twitter</a>
|
25 |
* Everton Rosario is a passionate mountain biker on Twitter
|
26 |
* </address>
|
27 |
*
|
28 |
* or
|
29 |
*
|
30 |
+
* <address>
|
31 |
* <a>Everton</a>
|
32 |
* Everton Rosario is a passionate mountain biker without Link
|
33 |
* </address>
|
54 |
*/
|
55 |
private $roleContribution;
|
56 |
|
|
|
|
|
|
|
|
|
57 |
private function __construct()
|
58 |
{
|
59 |
}
|
60 |
|
61 |
/**
|
62 |
* Creates an Author instance.
|
63 |
+
*
|
64 |
+
* @return Author
|
65 |
*/
|
66 |
public static function create()
|
67 |
{
|
70 |
|
71 |
/**
|
72 |
* Defines the link URL for the author
|
73 |
+
*
|
74 |
+
* @param string $url the URL link for author. Ex: "http://facebook.com/everton.rosario"
|
75 |
+
*
|
76 |
+
* @return $this
|
77 |
*/
|
78 |
public function withURL($url)
|
79 |
{
|
85 |
|
86 |
/**
|
87 |
* Author name.
|
88 |
+
*
|
89 |
+
* @param string $name Author name. Ex: "Everton Rosario"
|
90 |
+
*
|
91 |
+
* @return $this
|
92 |
*/
|
93 |
public function withName($name)
|
94 |
{
|
100 |
|
101 |
/**
|
102 |
* Author short description biography
|
103 |
+
*
|
104 |
+
* @param string $description Describe the author biography.
|
105 |
+
*
|
106 |
+
* @return $this
|
107 |
*/
|
108 |
public function withDescription($description)
|
109 |
{
|
115 |
|
116 |
/**
|
117 |
* Author role/contribution
|
118 |
+
*
|
119 |
+
* @param string $role_contribution The author short text to characterize role or contribution
|
120 |
+
*
|
121 |
+
* @return $this
|
122 |
*/
|
123 |
public function withRoleContribution($role_contribution)
|
124 |
{
|
163 |
/**
|
164 |
* Structure and create the full Author in a XML format DOMElement.
|
165 |
*
|
166 |
+
* @param \DOMDocument $document where this element will be appended. Optional
|
167 |
+
*
|
168 |
+
* @return \DOMElement
|
169 |
*/
|
170 |
public function toDOMElement($document = null)
|
171 |
{
|
173 |
$document = new \DOMDocument();
|
174 |
}
|
175 |
|
176 |
+
if (!$this->isValid()) {
|
177 |
+
return $this->emptyElement($document);
|
178 |
+
}
|
179 |
+
|
180 |
$author_url = $this->url ? $this->url : null;
|
181 |
$is_fb_author = strpos($author_url, 'facebook.com') !== false;
|
182 |
|
202 |
|
203 |
return $element;
|
204 |
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Overrides the Element::isValid().
|
208 |
+
*
|
209 |
+
* @see Element::isValid().
|
210 |
+
* @return true for valid Author that contains not empty name, false otherwise.
|
211 |
+
*/
|
212 |
+
public function isValid()
|
213 |
+
{
|
214 |
+
return !Type::isTextEmpty($this->name);
|
215 |
+
}
|
216 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Blockquote.php
CHANGED
@@ -48,6 +48,9 @@ class Blockquote extends TextContainer
|
|
48 |
{
|
49 |
}
|
50 |
|
|
|
|
|
|
|
51 |
public static function create()
|
52 |
{
|
53 |
return new self();
|
@@ -56,7 +59,9 @@ class Blockquote extends TextContainer
|
|
56 |
/**
|
57 |
* Sets the unescaped text within the blockquote.
|
58 |
*
|
59 |
-
* @param string The unescaped string.
|
|
|
|
|
60 |
*/
|
61 |
public function withText($text)
|
62 |
{
|
@@ -69,13 +74,20 @@ class Blockquote extends TextContainer
|
|
69 |
/**
|
70 |
* Structure and create the full Blockquote in a DOMElement.
|
71 |
*
|
72 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
73 |
*/
|
74 |
public function toDOMElement($document = null)
|
75 |
{
|
76 |
if (!$document) {
|
77 |
$document = new \DOMDocument();
|
78 |
}
|
|
|
|
|
|
|
|
|
|
|
79 |
$element = $document->createElement('blockquote');
|
80 |
|
81 |
$element->appendChild($this->textToDOMDocumentFragment($document));
|
48 |
{
|
49 |
}
|
50 |
|
51 |
+
/**
|
52 |
+
* @return Blockquote
|
53 |
+
*/
|
54 |
public static function create()
|
55 |
{
|
56 |
return new self();
|
59 |
/**
|
60 |
* Sets the unescaped text within the blockquote.
|
61 |
*
|
62 |
+
* @param string $text The unescaped string.
|
63 |
+
*
|
64 |
+
* @return $this
|
65 |
*/
|
66 |
public function withText($text)
|
67 |
{
|
74 |
/**
|
75 |
* Structure and create the full Blockquote in a DOMElement.
|
76 |
*
|
77 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
78 |
+
*
|
79 |
+
* @return \DOMElement
|
80 |
*/
|
81 |
public function toDOMElement($document = null)
|
82 |
{
|
83 |
if (!$document) {
|
84 |
$document = new \DOMDocument();
|
85 |
}
|
86 |
+
|
87 |
+
if (!$this->isValid()) {
|
88 |
+
return $this->emptyElement($document);
|
89 |
+
}
|
90 |
+
|
91 |
$element = $document->createElement('blockquote');
|
92 |
|
93 |
$element->appendChild($this->textToDOMDocumentFragment($document));
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Bold.php
CHANGED
@@ -15,11 +15,13 @@ namespace Facebook\InstantArticles\Elements;
|
|
15 |
*/
|
16 |
class Bold extends FormattedText
|
17 |
{
|
18 |
-
|
19 |
private function __construct()
|
20 |
{
|
21 |
}
|
22 |
|
|
|
|
|
|
|
23 |
public static function create()
|
24 |
{
|
25 |
return new self();
|
@@ -28,13 +30,20 @@ class Bold extends FormattedText
|
|
28 |
/**
|
29 |
* Structure and create <b> node.
|
30 |
*
|
31 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
32 |
*/
|
33 |
public function toDOMElement($document = null)
|
34 |
{
|
35 |
if (!$document) {
|
36 |
$document = new \DOMDocument();
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
38 |
$bold = $document->createElement('b');
|
39 |
|
40 |
$bold->appendChild($this->textToDOMDocumentFragment($document));
|
15 |
*/
|
16 |
class Bold extends FormattedText
|
17 |
{
|
|
|
18 |
private function __construct()
|
19 |
{
|
20 |
}
|
21 |
|
22 |
+
/**
|
23 |
+
* @return Bold
|
24 |
+
*/
|
25 |
public static function create()
|
26 |
{
|
27 |
return new self();
|
30 |
/**
|
31 |
* Structure and create <b> node.
|
32 |
*
|
33 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
34 |
+
*
|
35 |
+
* @return \DOMElement
|
36 |
*/
|
37 |
public function toDOMElement($document = null)
|
38 |
{
|
39 |
if (!$document) {
|
40 |
$document = new \DOMDocument();
|
41 |
}
|
42 |
+
|
43 |
+
if (!$this->isValid()) {
|
44 |
+
return $this->emptyElement($document);
|
45 |
+
}
|
46 |
+
|
47 |
$bold = $document->createElement('b');
|
48 |
|
49 |
$bold->appendChild($this->textToDOMDocumentFragment($document));
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Caption.php
CHANGED
@@ -14,11 +14,11 @@ use Facebook\InstantArticles\Validators\Type;
|
|
14 |
* A caption for any element.
|
15 |
* A caption can be included in any of the items:
|
16 |
* <ul>
|
17 |
-
* <li
|
18 |
-
* <li
|
19 |
-
* <li
|
20 |
-
* <li
|
21 |
-
* <li
|
22 |
* </ul>.
|
23 |
*
|
24 |
* Example:
|
@@ -27,6 +27,11 @@ use Facebook\InstantArticles\Validators\Type;
|
|
27 |
* <h2>Caption SubTitle</h2>
|
28 |
* </figcaption>
|
29 |
*
|
|
|
|
|
|
|
|
|
|
|
30 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/caption}
|
31 |
*/
|
32 |
class Caption extends FormattedText
|
@@ -61,11 +66,6 @@ class Caption extends FormattedText
|
|
61 |
*/
|
62 |
private $credit;
|
63 |
|
64 |
-
/**
|
65 |
-
* @var string A free text not contained in the tags
|
66 |
-
*/
|
67 |
-
private $text;
|
68 |
-
|
69 |
/**
|
70 |
* @var string text Size. Values: "op-medium"|"op-large"|"op-extra-large"
|
71 |
*/
|
@@ -85,6 +85,9 @@ class Caption extends FormattedText
|
|
85 |
{
|
86 |
}
|
87 |
|
|
|
|
|
|
|
88 |
public static function create()
|
89 |
{
|
90 |
return new self();
|
@@ -93,11 +96,13 @@ class Caption extends FormattedText
|
|
93 |
/**
|
94 |
* The caption title. REQUIRED.
|
95 |
*
|
96 |
-
* @param H1|string the caption text that will be shown
|
|
|
|
|
97 |
*/
|
98 |
public function withTitle($title)
|
99 |
{
|
100 |
-
Type::enforce($title,
|
101 |
|
102 |
if (Type::is($title, Type::STRING)) {
|
103 |
$title = H1::create()->appendText($title);
|
@@ -110,11 +115,13 @@ class Caption extends FormattedText
|
|
110 |
/**
|
111 |
* The caption sub title. optional.
|
112 |
*
|
113 |
-
* @param string the caption sub title text that will be shown
|
|
|
|
|
114 |
*/
|
115 |
public function withSubTitle($sub_title)
|
116 |
{
|
117 |
-
Type::enforce($sub_title,
|
118 |
if (Type::is($sub_title, Type::STRING)) {
|
119 |
$sub_title = H2::create()->appendText($sub_title);
|
120 |
}
|
@@ -126,11 +133,13 @@ class Caption extends FormattedText
|
|
126 |
/**
|
127 |
* The caption credit. optional.
|
128 |
*
|
129 |
-
* @param string the caption credit text that will be shown
|
|
|
|
|
130 |
*/
|
131 |
public function withCredit($credit)
|
132 |
{
|
133 |
-
Type::enforce($credit,
|
134 |
if (Type::is($credit, Type::STRING)) {
|
135 |
$credit = Cite::create()->appendText($credit);
|
136 |
}
|
@@ -146,17 +155,19 @@ class Caption extends FormattedText
|
|
146 |
* @see Caption::SIZE_LARGE
|
147 |
* @see Caption::SIZE_XLARGE
|
148 |
*
|
149 |
-
* @param string the caption font size that will be used.
|
|
|
|
|
150 |
*/
|
151 |
public function withFontsize($font_size)
|
152 |
{
|
153 |
Type::enforceWithin(
|
154 |
$font_size,
|
155 |
-
|
156 |
Caption::SIZE_XLARGE,
|
157 |
Caption::SIZE_LARGE,
|
158 |
Caption::SIZE_MEDIUM
|
159 |
-
|
160 |
);
|
161 |
$this->fontSize = $font_size;
|
162 |
|
@@ -170,17 +181,19 @@ class Caption extends FormattedText
|
|
170 |
* @see Caption::ALIGN_LEFT
|
171 |
* @see Caption::ALIGN_CENTER
|
172 |
*
|
173 |
-
* @param string alignment option that will be used.
|
|
|
|
|
174 |
*/
|
175 |
public function withTextAlignment($text_alignment)
|
176 |
{
|
177 |
Type::enforceWithin(
|
178 |
$text_alignment,
|
179 |
-
|
180 |
Caption::ALIGN_RIGHT,
|
181 |
Caption::ALIGN_LEFT,
|
182 |
Caption::ALIGN_CENTER
|
183 |
-
|
184 |
);
|
185 |
$this->textAlignment = $text_alignment;
|
186 |
|
@@ -188,23 +201,37 @@ class Caption extends FormattedText
|
|
188 |
}
|
189 |
|
190 |
/**
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
* @param string position that will be used.
|
198 |
-
*/
|
199 |
public function withPostion($position)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
{
|
201 |
Type::enforceWithin(
|
202 |
$position,
|
203 |
-
|
204 |
Caption::POSITION_ABOVE,
|
205 |
Caption::POSITION_BELOW,
|
206 |
Caption::POSITION_CENTER
|
207 |
-
|
208 |
);
|
209 |
$this->position = $position;
|
210 |
|
@@ -262,7 +289,6 @@ class Caption extends FormattedText
|
|
262 |
/**
|
263 |
* @return string the Font size.
|
264 |
*
|
265 |
-
*
|
266 |
* @see Caption::POSITION_ABOVE
|
267 |
* @see Caption::POSITION_BELOW
|
268 |
* @see Caption::POSITION_CENTER
|
@@ -273,39 +299,45 @@ class Caption extends FormattedText
|
|
273 |
}
|
274 |
|
275 |
/**
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
|
|
280 |
public function toDOMElement($document = null)
|
281 |
{
|
282 |
if (!$document) {
|
283 |
$document = new \DOMDocument();
|
284 |
}
|
|
|
|
|
|
|
|
|
|
|
285 |
$element = $document->createElement('figcaption');
|
286 |
|
287 |
-
|
288 |
if ($this->title && (!$this->subTitle && !$this->credit)) {
|
289 |
$element->appendChild($this->title->textToDOMDocumentFragment($document));
|
290 |
} elseif ($this->title) {
|
291 |
$element->appendChild($this->title->toDOMElement($document));
|
292 |
}
|
293 |
|
294 |
-
|
295 |
if ($this->subTitle) {
|
296 |
$element->appendChild($this->subTitle->toDOMElement($document));
|
297 |
}
|
298 |
|
299 |
$element->appendChild($this->textToDOMDocumentFragment($document));
|
300 |
|
301 |
-
|
302 |
if ($this->credit) {
|
303 |
$element->appendChild($this->credit->toDOMElement($document));
|
304 |
}
|
305 |
|
306 |
-
|
307 |
if ($this->textAlignment || $this->fontSize || $this->position) {
|
308 |
-
$classes =
|
309 |
if ($this->textAlignment) {
|
310 |
$classes[] = $this->textAlignment;
|
311 |
}
|
@@ -320,4 +352,16 @@ class Caption extends FormattedText
|
|
320 |
|
321 |
return $element;
|
322 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
}
|
14 |
* A caption for any element.
|
15 |
* A caption can be included in any of the items:
|
16 |
* <ul>
|
17 |
+
* <li>Image</li>
|
18 |
+
* <li>Video</li>
|
19 |
+
* <li>SlideShow</li>
|
20 |
+
* <li>Map</li>
|
21 |
+
* <li>SocialEmbed</li>
|
22 |
* </ul>.
|
23 |
*
|
24 |
* Example:
|
27 |
* <h2>Caption SubTitle</h2>
|
28 |
* </figcaption>
|
29 |
*
|
30 |
+
* @see Image
|
31 |
+
* @see Video
|
32 |
+
* @see SlideShow
|
33 |
+
* @see Map
|
34 |
+
* @see SocialEmbed
|
35 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/caption}
|
36 |
*/
|
37 |
class Caption extends FormattedText
|
66 |
*/
|
67 |
private $credit;
|
68 |
|
|
|
|
|
|
|
|
|
|
|
69 |
/**
|
70 |
* @var string text Size. Values: "op-medium"|"op-large"|"op-extra-large"
|
71 |
*/
|
85 |
{
|
86 |
}
|
87 |
|
88 |
+
/**
|
89 |
+
* @return Caption
|
90 |
+
*/
|
91 |
public static function create()
|
92 |
{
|
93 |
return new self();
|
96 |
/**
|
97 |
* The caption title. REQUIRED.
|
98 |
*
|
99 |
+
* @param H1|string $title the caption text that will be shown
|
100 |
+
*
|
101 |
+
* @return $this
|
102 |
*/
|
103 |
public function withTitle($title)
|
104 |
{
|
105 |
+
Type::enforce($title, [Type::STRING, H1::getClassName()]);
|
106 |
|
107 |
if (Type::is($title, Type::STRING)) {
|
108 |
$title = H1::create()->appendText($title);
|
115 |
/**
|
116 |
* The caption sub title. optional.
|
117 |
*
|
118 |
+
* @param string $sub_title the caption sub title text that will be shown
|
119 |
+
*
|
120 |
+
* @return $this
|
121 |
*/
|
122 |
public function withSubTitle($sub_title)
|
123 |
{
|
124 |
+
Type::enforce($sub_title, [Type::STRING, H2::getClassName()]);
|
125 |
if (Type::is($sub_title, Type::STRING)) {
|
126 |
$sub_title = H2::create()->appendText($sub_title);
|
127 |
}
|
133 |
/**
|
134 |
* The caption credit. optional.
|
135 |
*
|
136 |
+
* @param string $credit the caption credit text that will be shown
|
137 |
+
*
|
138 |
+
* @return $this
|
139 |
*/
|
140 |
public function withCredit($credit)
|
141 |
{
|
142 |
+
Type::enforce($credit, [Type::STRING, Cite::getClassName()]);
|
143 |
if (Type::is($credit, Type::STRING)) {
|
144 |
$credit = Cite::create()->appendText($credit);
|
145 |
}
|
155 |
* @see Caption::SIZE_LARGE
|
156 |
* @see Caption::SIZE_XLARGE
|
157 |
*
|
158 |
+
* @param string $font_size the caption font size that will be used.
|
159 |
+
*
|
160 |
+
* @return $this
|
161 |
*/
|
162 |
public function withFontsize($font_size)
|
163 |
{
|
164 |
Type::enforceWithin(
|
165 |
$font_size,
|
166 |
+
[
|
167 |
Caption::SIZE_XLARGE,
|
168 |
Caption::SIZE_LARGE,
|
169 |
Caption::SIZE_MEDIUM
|
170 |
+
]
|
171 |
);
|
172 |
$this->fontSize = $font_size;
|
173 |
|
181 |
* @see Caption::ALIGN_LEFT
|
182 |
* @see Caption::ALIGN_CENTER
|
183 |
*
|
184 |
+
* @param string $text_alignment alignment option that will be used.
|
185 |
+
*
|
186 |
+
* @return $this
|
187 |
*/
|
188 |
public function withTextAlignment($text_alignment)
|
189 |
{
|
190 |
Type::enforceWithin(
|
191 |
$text_alignment,
|
192 |
+
[
|
193 |
Caption::ALIGN_RIGHT,
|
194 |
Caption::ALIGN_LEFT,
|
195 |
Caption::ALIGN_CENTER
|
196 |
+
]
|
197 |
);
|
198 |
$this->textAlignment = $text_alignment;
|
199 |
|
201 |
}
|
202 |
|
203 |
/**
|
204 |
+
* @deprecated
|
205 |
+
*
|
206 |
+
* @param string $position
|
207 |
+
*
|
208 |
+
* @return $this
|
209 |
+
*/
|
|
|
|
|
210 |
public function withPostion($position)
|
211 |
+
{
|
212 |
+
return $this->withPosition($position);
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* The Text position that will be used.
|
217 |
+
*
|
218 |
+
* @see Caption::POSITION_ABOVE
|
219 |
+
* @see Caption::POSITION_BELOW
|
220 |
+
* @see Caption::POSITION_CENTER
|
221 |
+
*
|
222 |
+
* @param string $position that will be used.
|
223 |
+
*
|
224 |
+
* @return $this
|
225 |
+
*/
|
226 |
+
public function withPosition($position)
|
227 |
{
|
228 |
Type::enforceWithin(
|
229 |
$position,
|
230 |
+
[
|
231 |
Caption::POSITION_ABOVE,
|
232 |
Caption::POSITION_BELOW,
|
233 |
Caption::POSITION_CENTER
|
234 |
+
]
|
235 |
);
|
236 |
$this->position = $position;
|
237 |
|
289 |
/**
|
290 |
* @return string the Font size.
|
291 |
*
|
|
|
292 |
* @see Caption::POSITION_ABOVE
|
293 |
* @see Caption::POSITION_BELOW
|
294 |
* @see Caption::POSITION_CENTER
|
299 |
}
|
300 |
|
301 |
/**
|
302 |
+
* Structure and create the full ArticleImage in a XML format DOMElement.
|
303 |
+
*
|
304 |
+
* @param \DOMDocument $document where this element will be appended. Optional
|
305 |
+
* @return \DOMElement
|
306 |
+
*/
|
307 |
public function toDOMElement($document = null)
|
308 |
{
|
309 |
if (!$document) {
|
310 |
$document = new \DOMDocument();
|
311 |
}
|
312 |
+
|
313 |
+
if (!$this->isValid()) {
|
314 |
+
return $this->emptyElement($document);
|
315 |
+
}
|
316 |
+
|
317 |
$element = $document->createElement('figcaption');
|
318 |
|
319 |
+
// title markup REQUIRED
|
320 |
if ($this->title && (!$this->subTitle && !$this->credit)) {
|
321 |
$element->appendChild($this->title->textToDOMDocumentFragment($document));
|
322 |
} elseif ($this->title) {
|
323 |
$element->appendChild($this->title->toDOMElement($document));
|
324 |
}
|
325 |
|
326 |
+
// subtitle markup optional
|
327 |
if ($this->subTitle) {
|
328 |
$element->appendChild($this->subTitle->toDOMElement($document));
|
329 |
}
|
330 |
|
331 |
$element->appendChild($this->textToDOMDocumentFragment($document));
|
332 |
|
333 |
+
// credit markup optional
|
334 |
if ($this->credit) {
|
335 |
$element->appendChild($this->credit->toDOMElement($document));
|
336 |
}
|
337 |
|
338 |
+
// Formating markup
|
339 |
if ($this->textAlignment || $this->fontSize || $this->position) {
|
340 |
+
$classes = [];
|
341 |
if ($this->textAlignment) {
|
342 |
$classes[] = $this->textAlignment;
|
343 |
}
|
352 |
|
353 |
return $element;
|
354 |
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Overrides the TextContainer::isValid().
|
358 |
+
*
|
359 |
+
* @see TextContainer::isValid().
|
360 |
+
* @return true for valid Caption when it is filled, false otherwise.
|
361 |
+
*/
|
362 |
+
public function isValid()
|
363 |
+
{
|
364 |
+
return
|
365 |
+
parent::isValid() || ($this->title && $this->title->isValid());
|
366 |
+
}
|
367 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Cite.php
CHANGED
@@ -34,6 +34,9 @@ class Cite extends TextContainer
|
|
34 |
{
|
35 |
}
|
36 |
|
|
|
|
|
|
|
37 |
public static function create()
|
38 |
{
|
39 |
return new self();
|
@@ -46,17 +49,19 @@ class Cite extends TextContainer
|
|
46 |
* @see Caption::ALIGN_LEFT
|
47 |
* @see Caption::ALIGN_CENTER
|
48 |
*
|
49 |
-
* @param string alignment option that will be used.
|
|
|
|
|
50 |
*/
|
51 |
public function withTextAlignment($text_alignment)
|
52 |
{
|
53 |
Type::enforceWithin(
|
54 |
$text_alignment,
|
55 |
-
|
56 |
Caption::ALIGN_RIGHT,
|
57 |
Caption::ALIGN_LEFT,
|
58 |
Caption::ALIGN_CENTER
|
59 |
-
|
60 |
);
|
61 |
$this->textAlignment = $text_alignment;
|
62 |
|
@@ -64,23 +69,35 @@ class Cite extends TextContainer
|
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
*
|
73 |
-
* @param string position that will be used.
|
74 |
-
*/
|
75 |
public function withPostion($position)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
{
|
77 |
Type::enforceWithin(
|
78 |
$position,
|
79 |
-
|
80 |
Caption::POSITION_ABOVE,
|
81 |
Caption::POSITION_BELOW,
|
82 |
Caption::POSITION_CENTER
|
83 |
-
|
84 |
);
|
85 |
$this->position = $position;
|
86 |
|
@@ -90,16 +107,23 @@ class Cite extends TextContainer
|
|
90 |
/**
|
91 |
* Structure and create the <cite> in a DOMElement.
|
92 |
*
|
93 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
94 |
*/
|
95 |
public function toDOMElement($document = null)
|
96 |
{
|
97 |
if (!$document) {
|
98 |
$document = new \DOMDocument();
|
99 |
}
|
|
|
|
|
|
|
|
|
|
|
100 |
$cite = $document->createElement('cite');
|
101 |
|
102 |
-
$classes =
|
103 |
if ($this->position) {
|
104 |
$classes[] = $this->position;
|
105 |
}
|
34 |
{
|
35 |
}
|
36 |
|
37 |
+
/**
|
38 |
+
* @return Cite
|
39 |
+
*/
|
40 |
public static function create()
|
41 |
{
|
42 |
return new self();
|
49 |
* @see Caption::ALIGN_LEFT
|
50 |
* @see Caption::ALIGN_CENTER
|
51 |
*
|
52 |
+
* @param string $text_alignment alignment option that will be used.
|
53 |
+
*
|
54 |
+
* @return $this
|
55 |
*/
|
56 |
public function withTextAlignment($text_alignment)
|
57 |
{
|
58 |
Type::enforceWithin(
|
59 |
$text_alignment,
|
60 |
+
[
|
61 |
Caption::ALIGN_RIGHT,
|
62 |
Caption::ALIGN_LEFT,
|
63 |
Caption::ALIGN_CENTER
|
64 |
+
]
|
65 |
);
|
66 |
$this->textAlignment = $text_alignment;
|
67 |
|
69 |
}
|
70 |
|
71 |
/**
|
72 |
+
* @deprecated
|
73 |
+
*
|
74 |
+
* @param string $position
|
75 |
+
* @return $this
|
76 |
+
*/
|
|
|
|
|
|
|
77 |
public function withPostion($position)
|
78 |
+
{
|
79 |
+
return $this->withPosition($position);
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* The Text position that will be used.
|
84 |
+
*
|
85 |
+
* @see Caption::POSITION_ABOVE
|
86 |
+
* @see Caption::POSITION_BELOW
|
87 |
+
* @see Caption::POSITION_CENTER
|
88 |
+
*
|
89 |
+
* @param string $position that will be used.
|
90 |
+
* @return $this
|
91 |
+
*/
|
92 |
+
public function withPosition($position)
|
93 |
{
|
94 |
Type::enforceWithin(
|
95 |
$position,
|
96 |
+
[
|
97 |
Caption::POSITION_ABOVE,
|
98 |
Caption::POSITION_BELOW,
|
99 |
Caption::POSITION_CENTER
|
100 |
+
]
|
101 |
);
|
102 |
$this->position = $position;
|
103 |
|
107 |
/**
|
108 |
* Structure and create the <cite> in a DOMElement.
|
109 |
*
|
110 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
111 |
+
*
|
112 |
+
* @return \DOMElement
|
113 |
*/
|
114 |
public function toDOMElement($document = null)
|
115 |
{
|
116 |
if (!$document) {
|
117 |
$document = new \DOMDocument();
|
118 |
}
|
119 |
+
|
120 |
+
if (!$this->isValid()) {
|
121 |
+
return $this->emptyElement($document);
|
122 |
+
}
|
123 |
+
|
124 |
$cite = $document->createElement('cite');
|
125 |
|
126 |
+
$classes = [];
|
127 |
if ($this->position) {
|
128 |
$classes[] = $this->position;
|
129 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Container.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* This source code is licensed under the license found in the
|
7 |
+
* LICENSE file in the root directory of this source tree.
|
8 |
+
*/
|
9 |
+
namespace Facebook\InstantArticles\Elements;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Interface Container
|
13 |
+
* This interface specifies the navigatable objects that have children.
|
14 |
+
*/
|
15 |
+
interface Container
|
16 |
+
{
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Must return an array of Element typed objects.
|
20 |
+
* To navigate thru the Container object tree, always check if it is a Container.
|
21 |
+
* <code>
|
22 |
+
* if (Type::is($object, Container::getClassName())) {
|
23 |
+
* foreach($object->getChildren() as $child) {
|
24 |
+
* //$child operations
|
25 |
+
* }
|
26 |
+
* }
|
27 |
+
* </code>
|
28 |
+
*
|
29 |
+
* @return array(<Element>) All implementing classes returns an array of Elements.
|
30 |
+
*/
|
31 |
+
public function getContainerChildren();
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Auxiliary method to extract all Elements full qualified class name.
|
35 |
+
*
|
36 |
+
* @return string The full qualified name of class
|
37 |
+
*/
|
38 |
+
public static function getClassName();
|
39 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Div.php
CHANGED
@@ -15,11 +15,13 @@ namespace Facebook\InstantArticles\Elements;
|
|
15 |
*/
|
16 |
class Div extends TextContainer
|
17 |
{
|
18 |
-
|
19 |
private function __construct()
|
20 |
{
|
21 |
}
|
22 |
|
|
|
|
|
|
|
23 |
public static function create()
|
24 |
{
|
25 |
return new self();
|
@@ -28,13 +30,20 @@ class Div extends TextContainer
|
|
28 |
/**
|
29 |
* Structure and create <div> node.
|
30 |
*
|
31 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
32 |
*/
|
33 |
public function toDOMElement($document = null)
|
34 |
{
|
35 |
if (!$document) {
|
36 |
$document = new \DOMDocument();
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
38 |
$div = $document->createElement('div');
|
39 |
|
40 |
$div->appendChild($this->textToDOMDocumentFragment($document));
|
15 |
*/
|
16 |
class Div extends TextContainer
|
17 |
{
|
|
|
18 |
private function __construct()
|
19 |
{
|
20 |
}
|
21 |
|
22 |
+
/**
|
23 |
+
* @return Div
|
24 |
+
*/
|
25 |
public static function create()
|
26 |
{
|
27 |
return new self();
|
30 |
/**
|
31 |
* Structure and create <div> node.
|
32 |
*
|
33 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
34 |
+
*
|
35 |
+
* @return \DOMElement
|
36 |
*/
|
37 |
public function toDOMElement($document = null)
|
38 |
{
|
39 |
if (!$document) {
|
40 |
$document = new \DOMDocument();
|
41 |
}
|
42 |
+
|
43 |
+
if (!$this->isValid()) {
|
44 |
+
return $this->emptyElement($document);
|
45 |
+
}
|
46 |
+
|
47 |
$div = $document->createElement('div');
|
48 |
|
49 |
$div->appendChild($this->textToDOMDocumentFragment($document));
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Element.php
CHANGED
@@ -11,9 +11,9 @@ namespace Facebook\InstantArticles\Elements;
|
|
11 |
use Facebook\InstantArticles\Validators\Type;
|
12 |
|
13 |
/**
|
14 |
-
* Class Element
|
15 |
* This class is the meta each tag element that contains rendering code for the
|
16 |
-
* tags
|
17 |
*
|
18 |
*/
|
19 |
abstract class Element
|
@@ -22,23 +22,29 @@ abstract class Element
|
|
22 |
|
23 |
/**
|
24 |
* Renders the Element content
|
25 |
-
*
|
26 |
-
* @
|
|
|
|
|
|
|
27 |
*/
|
28 |
-
public function render($doctype = '', $
|
29 |
{
|
30 |
$document = new \DOMDocument();
|
31 |
-
$document->preserveWhiteSpace = !$
|
32 |
-
$document->formatOutput = $
|
33 |
$element = $this->toDOMElement($document);
|
34 |
$document->appendChild($element);
|
35 |
-
|
|
|
|
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
* Appends unescaped HTML to a element using the right strategy.
|
40 |
-
*
|
41 |
-
* @param DOMNode $
|
|
|
42 |
*/
|
43 |
protected function dangerouslyAppendUnescapedHTML($element, $content)
|
44 |
{
|
@@ -50,9 +56,34 @@ abstract class Element
|
|
50 |
|
51 |
/**
|
52 |
* Auxiliary method to extract all Elements full qualified class name.
|
53 |
-
*
|
|
|
54 |
*/
|
55 |
-
public static function getClassName()
|
|
|
56 |
return get_called_class();
|
57 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
11 |
use Facebook\InstantArticles\Validators\Type;
|
12 |
|
13 |
/**
|
14 |
+
* Class Element.
|
15 |
* This class is the meta each tag element that contains rendering code for the
|
16 |
+
* tags.
|
17 |
*
|
18 |
*/
|
19 |
abstract class Element
|
22 |
|
23 |
/**
|
24 |
* Renders the Element content
|
25 |
+
*
|
26 |
+
* @param string $doctype the doctype will be applied to document. I.e.: '<!doctype html>'.
|
27 |
+
* @param bool $formatted Whether to format output.
|
28 |
+
*
|
29 |
+
* @return string with the content rendered.
|
30 |
*/
|
31 |
+
public function render($doctype = '', $formatted = false)
|
32 |
{
|
33 |
$document = new \DOMDocument();
|
34 |
+
$document->preserveWhiteSpace = !$formatted;
|
35 |
+
$document->formatOutput = $formatted;
|
36 |
$element = $this->toDOMElement($document);
|
37 |
$document->appendChild($element);
|
38 |
+
$rendered = $doctype.$document->saveXML($element);
|
39 |
+
|
40 |
+
return $rendered;
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
* Appends unescaped HTML to a element using the right strategy.
|
45 |
+
*
|
46 |
+
* @param \DOMNode $element - The element to append the HTML to.
|
47 |
+
* @param \DOMNode $content - The unescaped HTML to append.
|
48 |
*/
|
49 |
protected function dangerouslyAppendUnescapedHTML($element, $content)
|
50 |
{
|
56 |
|
57 |
/**
|
58 |
* Auxiliary method to extract all Elements full qualified class name.
|
59 |
+
*
|
60 |
+
* @return string The full qualified name of class.
|
61 |
*/
|
62 |
+
public static function getClassName()
|
63 |
+
{
|
64 |
return get_called_class();
|
65 |
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Method that checks if the element is valid, not empty. If !valid() it wont be rendered.
|
69 |
+
* @since v1.0.7
|
70 |
+
* @return boolean true for valid element, false otherwise.
|
71 |
+
*/
|
72 |
+
public function isValid()
|
73 |
+
{
|
74 |
+
return true;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Method to create an empty fragment if isValid() is false in toDOMElement()
|
79 |
+
* @param \DOMDocument $document the document that will contain the empty element.
|
80 |
+
* @see self::isValid().
|
81 |
+
* @see self::toDOMElement().
|
82 |
+
*/
|
83 |
+
protected function emptyElement($document)
|
84 |
+
{
|
85 |
+
$fragment = $document->createDocumentFragment();
|
86 |
+
$fragment->appendChild($document->createTextNode(''));
|
87 |
+
return $fragment;
|
88 |
+
}
|
89 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Footer.php
CHANGED
@@ -27,12 +27,12 @@ use Facebook\InstantArticles\Validators\Type;
|
|
27 |
*
|
28 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/footer}
|
29 |
*/
|
30 |
-
class Footer extends Element
|
31 |
{
|
32 |
/**
|
33 |
* @var string|Paragraph[] The text content of the credits
|
34 |
*/
|
35 |
-
private $credits =
|
36 |
|
37 |
/**
|
38 |
* @var string Copyright information of the article
|
@@ -48,6 +48,9 @@ class Footer extends Element
|
|
48 |
{
|
49 |
}
|
50 |
|
|
|
|
|
|
|
51 |
public static function create()
|
52 |
{
|
53 |
return new self();
|
@@ -56,11 +59,22 @@ class Footer extends Element
|
|
56 |
/**
|
57 |
* Sets the text content of the credits
|
58 |
*
|
59 |
-
* @param string|
|
|
|
|
|
60 |
*/
|
61 |
public function withCredits($credits)
|
62 |
{
|
63 |
-
Type::enforce($credits,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
$this->credits = $credits;
|
65 |
|
66 |
return $this;
|
@@ -69,7 +83,9 @@ class Footer extends Element
|
|
69 |
/**
|
70 |
* Adds a new Paragraph to the credits
|
71 |
*
|
72 |
-
* @param
|
|
|
|
|
73 |
*/
|
74 |
public function addCredit($credit)
|
75 |
{
|
@@ -83,6 +99,8 @@ class Footer extends Element
|
|
83 |
* Sets the copyright information for the article.
|
84 |
*
|
85 |
* @param string $copyright - The copyright information.
|
|
|
|
|
86 |
*/
|
87 |
public function withCopyright($copyright)
|
88 |
{
|
@@ -96,6 +114,8 @@ class Footer extends Element
|
|
96 |
* Sets the related articles within the footer of the article.
|
97 |
*
|
98 |
* @param RelatedArticles $related_articles - The related articles
|
|
|
|
|
99 |
*/
|
100 |
public function withRelatedArticles($related_articles)
|
101 |
{
|
@@ -108,7 +128,7 @@ class Footer extends Element
|
|
108 |
/**
|
109 |
* Gets the text content of the credits
|
110 |
*
|
111 |
-
* @return string|
|
112 |
*/
|
113 |
public function getCredits()
|
114 |
{
|
@@ -118,7 +138,7 @@ class Footer extends Element
|
|
118 |
/**
|
119 |
* Gets the copyright information for the article.
|
120 |
*
|
121 |
-
* @return string
|
122 |
*/
|
123 |
public function getCopyright()
|
124 |
{
|
@@ -128,7 +148,7 @@ class Footer extends Element
|
|
128 |
/**
|
129 |
* Gets the related articles within the footer of the article.
|
130 |
*
|
131 |
-
* @return RelatedArticles
|
132 |
*/
|
133 |
public function getRelatedArticles()
|
134 |
{
|
@@ -138,13 +158,20 @@ class Footer extends Element
|
|
138 |
/**
|
139 |
* Structure and create the full Footer in a DOMElement.
|
140 |
*
|
141 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
142 |
*/
|
143 |
public function toDOMElement($document = null)
|
144 |
{
|
145 |
if (!$document) {
|
146 |
$document = new \DOMDocument();
|
147 |
}
|
|
|
|
|
|
|
|
|
|
|
148 |
$footer = $document->createElement('footer');
|
149 |
|
150 |
// Footer markup
|
@@ -176,4 +203,49 @@ class Footer extends Element
|
|
176 |
|
177 |
return $footer;
|
178 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
}
|
27 |
*
|
28 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/footer}
|
29 |
*/
|
30 |
+
class Footer extends Element implements Container
|
31 |
{
|
32 |
/**
|
33 |
* @var string|Paragraph[] The text content of the credits
|
34 |
*/
|
35 |
+
private $credits = [];
|
36 |
|
37 |
/**
|
38 |
* @var string Copyright information of the article
|
48 |
{
|
49 |
}
|
50 |
|
51 |
+
/**
|
52 |
+
* @return Footer
|
53 |
+
*/
|
54 |
public static function create()
|
55 |
{
|
56 |
return new self();
|
59 |
/**
|
60 |
* Sets the text content of the credits
|
61 |
*
|
62 |
+
* @param string|string[]|Paragraph[] $credits - A list of paragraphs or a single string for the content of the credit.
|
63 |
+
*
|
64 |
+
* @return $this
|
65 |
*/
|
66 |
public function withCredits($credits)
|
67 |
{
|
68 |
+
Type::enforce($credits, [Type::ARRAY_TYPE, Paragraph::getClassName(), Type::STRING]);
|
69 |
+
|
70 |
+
// Checks if it is array to apply the enforce of param types as documented.
|
71 |
+
if (Type::is($credits, Type::ARRAY_TYPE)) {
|
72 |
+
if (!Type::isArrayOf($credits, Type::STRING) &&
|
73 |
+
!Type::isArrayOf($credits, Paragraph::getClassName())) {
|
74 |
+
Type::enforceArrayOf($credits, Type::STRING);
|
75 |
+
Type::enforceArrayOf($credits, Paragraph::getClassName());
|
76 |
+
}
|
77 |
+
}
|
78 |
$this->credits = $credits;
|
79 |
|
80 |
return $this;
|
83 |
/**
|
84 |
* Adds a new Paragraph to the credits
|
85 |
*
|
86 |
+
* @param Paragraph $credit - One Paragraph to be added as a credit.
|
87 |
+
*
|
88 |
+
* @return $this
|
89 |
*/
|
90 |
public function addCredit($credit)
|
91 |
{
|
99 |
* Sets the copyright information for the article.
|
100 |
*
|
101 |
* @param string $copyright - The copyright information.
|
102 |
+
*
|
103 |
+
* @return $this
|
104 |
*/
|
105 |
public function withCopyright($copyright)
|
106 |
{
|
114 |
* Sets the related articles within the footer of the article.
|
115 |
*
|
116 |
* @param RelatedArticles $related_articles - The related articles
|
117 |
+
*
|
118 |
+
* @return $this
|
119 |
*/
|
120 |
public function withRelatedArticles($related_articles)
|
121 |
{
|
128 |
/**
|
129 |
* Gets the text content of the credits
|
130 |
*
|
131 |
+
* @return string|string[]|Paragraph[] A list of paragraphs or a single string for the content of the credit.
|
132 |
*/
|
133 |
public function getCredits()
|
134 |
{
|
138 |
/**
|
139 |
* Gets the copyright information for the article.
|
140 |
*
|
141 |
+
* @return string The copyright information.
|
142 |
*/
|
143 |
public function getCopyright()
|
144 |
{
|
148 |
/**
|
149 |
* Gets the related articles within the footer of the article.
|
150 |
*
|
151 |
+
* @return RelatedArticles The related articles
|
152 |
*/
|
153 |
public function getRelatedArticles()
|
154 |
{
|
158 |
/**
|
159 |
* Structure and create the full Footer in a DOMElement.
|
160 |
*
|
161 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
162 |
+
*
|
163 |
+
* @return \DOMElement
|
164 |
*/
|
165 |
public function toDOMElement($document = null)
|
166 |
{
|
167 |
if (!$document) {
|
168 |
$document = new \DOMDocument();
|
169 |
}
|
170 |
+
|
171 |
+
if (!$this->isValid()) {
|
172 |
+
return $this->emptyElement($document);
|
173 |
+
}
|
174 |
+
|
175 |
$footer = $document->createElement('footer');
|
176 |
|
177 |
// Footer markup
|
203 |
|
204 |
return $footer;
|
205 |
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Overrides the Element::isValid().
|
209 |
+
*
|
210 |
+
* @see Element::isValid().
|
211 |
+
* @return true for valid Footer when it is filled, false otherwise.
|
212 |
+
*/
|
213 |
+
public function isValid()
|
214 |
+
{
|
215 |
+
return
|
216 |
+
$this->credits ||
|
217 |
+
$this->copyright ||
|
218 |
+
$this->relatedArticles;
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Implements the Container::getContainerChildren().
|
223 |
+
*
|
224 |
+
* @see Container::getContainerChildren()
|
225 |
+
* @return array of Paragraph|RelatedArticles
|
226 |
+
*/
|
227 |
+
public function getContainerChildren()
|
228 |
+
{
|
229 |
+
$children = array();
|
230 |
+
|
231 |
+
if ($this->credits) {
|
232 |
+
if (is_array($this->credits)) {
|
233 |
+
foreach ($this->credits as $paragraph) {
|
234 |
+
if (Type::is($paragraph, Element::getClassName())) {
|
235 |
+
$children[] = $paragraph;
|
236 |
+
}
|
237 |
+
}
|
238 |
+
} else {
|
239 |
+
if (Type::is($this->credits, Element::getClassName())) {
|
240 |
+
$children[] = $this->credits;
|
241 |
+
}
|
242 |
+
}
|
243 |
+
}
|
244 |
+
|
245 |
+
if ($this->relatedArticles) {
|
246 |
+
$children[] = $this->relatedArticles;
|
247 |
+
}
|
248 |
+
|
249 |
+
return $children;
|
250 |
+
}
|
251 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/GeoTag.php
CHANGED
@@ -41,17 +41,12 @@ class GeoTag extends Element
|
|
41 |
*/
|
42 |
private $script;
|
43 |
|
44 |
-
/**
|
45 |
-
* Private constructor.
|
46 |
-
* @see GeoTag::create();.
|
47 |
-
*/
|
48 |
private function __construct()
|
49 |
{
|
50 |
}
|
51 |
|
52 |
/**
|
53 |
-
*
|
54 |
-
* @return GeoTag the new instance
|
55 |
*/
|
56 |
public static function create()
|
57 |
{
|
@@ -62,6 +57,10 @@ class GeoTag extends Element
|
|
62 |
* Sets the geotag on the image.
|
63 |
*
|
64 |
* @see {link:http://geojson.org/}
|
|
|
|
|
|
|
|
|
65 |
*/
|
66 |
public function withScript($script)
|
67 |
{
|
@@ -82,13 +81,20 @@ class GeoTag extends Element
|
|
82 |
/**
|
83 |
* Structure and create the full Map in a XML format DOMElement.
|
84 |
*
|
85 |
-
* @param $document
|
|
|
|
|
86 |
*/
|
87 |
public function toDOMElement($document = null)
|
88 |
{
|
89 |
if (!$document) {
|
90 |
$document = new \DOMDocument();
|
91 |
}
|
|
|
|
|
|
|
|
|
|
|
92 |
$element = $document->createElement('script');
|
93 |
$element->setAttribute('type', 'application/json');
|
94 |
$element->setAttribute('class', 'op-geotag');
|
@@ -100,4 +106,15 @@ class GeoTag extends Element
|
|
100 |
|
101 |
return $element;
|
102 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
41 |
*/
|
42 |
private $script;
|
43 |
|
|
|
|
|
|
|
|
|
44 |
private function __construct()
|
45 |
{
|
46 |
}
|
47 |
|
48 |
/**
|
49 |
+
* @return GeoTag
|
|
|
50 |
*/
|
51 |
public static function create()
|
52 |
{
|
57 |
* Sets the geotag on the image.
|
58 |
*
|
59 |
* @see {link:http://geojson.org/}
|
60 |
+
*
|
61 |
+
* @param string $script
|
62 |
+
*
|
63 |
+
* @return $this
|
64 |
*/
|
65 |
public function withScript($script)
|
66 |
{
|
81 |
/**
|
82 |
* Structure and create the full Map in a XML format DOMElement.
|
83 |
*
|
84 |
+
* @param \DOMDocument $document where this element will be appended. Optional
|
85 |
+
*
|
86 |
+
* @return \DOMElement
|
87 |
*/
|
88 |
public function toDOMElement($document = null)
|
89 |
{
|
90 |
if (!$document) {
|
91 |
$document = new \DOMDocument();
|
92 |
}
|
93 |
+
|
94 |
+
if (!$this->isValid()) {
|
95 |
+
return $this->emptyElement($document);
|
96 |
+
}
|
97 |
+
|
98 |
$element = $document->createElement('script');
|
99 |
$element->setAttribute('type', 'application/json');
|
100 |
$element->setAttribute('class', 'op-geotag');
|
106 |
|
107 |
return $element;
|
108 |
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Overrides the Element::isValid().
|
112 |
+
*
|
113 |
+
* @see Element::isValid().
|
114 |
+
* @return true for valid GeoTag that contains not empty script, false otherwise.
|
115 |
+
*/
|
116 |
+
public function isValid()
|
117 |
+
{
|
118 |
+
return !Type::isTextEmpty($this->script);
|
119 |
+
}
|
120 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H1.php
CHANGED
@@ -34,6 +34,9 @@ class H1 extends TextContainer
|
|
34 |
{
|
35 |
}
|
36 |
|
|
|
|
|
|
|
37 |
public static function create()
|
38 |
{
|
39 |
return new self();
|
@@ -46,17 +49,19 @@ class H1 extends TextContainer
|
|
46 |
* @see Caption::ALIGN_LEFT
|
47 |
* @see Caption::ALIGN_CENTER
|
48 |
*
|
49 |
-
* @param string alignment option that will be used.
|
|
|
|
|
50 |
*/
|
51 |
public function withTextAlignment($text_alignment)
|
52 |
{
|
53 |
Type::enforceWithin(
|
54 |
$text_alignment,
|
55 |
-
|
56 |
Caption::ALIGN_RIGHT,
|
57 |
Caption::ALIGN_LEFT,
|
58 |
Caption::ALIGN_CENTER
|
59 |
-
|
60 |
);
|
61 |
$this->textAlignment = $text_alignment;
|
62 |
|
@@ -64,23 +69,36 @@ class H1 extends TextContainer
|
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
*
|
73 |
-
* @param string position that will be used.
|
74 |
-
*/
|
75 |
public function withPostion($position)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
{
|
77 |
Type::enforceWithin(
|
78 |
$position,
|
79 |
-
|
80 |
Caption::POSITION_ABOVE,
|
81 |
Caption::POSITION_BELOW,
|
82 |
Caption::POSITION_CENTER
|
83 |
-
|
84 |
);
|
85 |
$this->position = $position;
|
86 |
|
@@ -90,16 +108,23 @@ class H1 extends TextContainer
|
|
90 |
/**
|
91 |
* Structure and create the H1 in a DOMElement.
|
92 |
*
|
93 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
94 |
*/
|
95 |
public function toDOMElement($document = null)
|
96 |
{
|
97 |
if (!$document) {
|
98 |
$document = new \DOMDocument();
|
99 |
}
|
|
|
|
|
|
|
|
|
|
|
100 |
$h1 = $document->createElement('h1');
|
101 |
|
102 |
-
$classes =
|
103 |
if ($this->position) {
|
104 |
$classes[] = $this->position;
|
105 |
}
|
34 |
{
|
35 |
}
|
36 |
|
37 |
+
/**
|
38 |
+
* @return H1
|
39 |
+
*/
|
40 |
public static function create()
|
41 |
{
|
42 |
return new self();
|
49 |
* @see Caption::ALIGN_LEFT
|
50 |
* @see Caption::ALIGN_CENTER
|
51 |
*
|
52 |
+
* @param string $text_alignment alignment option that will be used.
|
53 |
+
*
|
54 |
+
* @return $this
|
55 |
*/
|
56 |
public function withTextAlignment($text_alignment)
|
57 |
{
|
58 |
Type::enforceWithin(
|
59 |
$text_alignment,
|
60 |
+
[
|
61 |
Caption::ALIGN_RIGHT,
|
62 |
Caption::ALIGN_LEFT,
|
63 |
Caption::ALIGN_CENTER
|
64 |
+
]
|
65 |
);
|
66 |
$this->textAlignment = $text_alignment;
|
67 |
|
69 |
}
|
70 |
|
71 |
/**
|
72 |
+
* @deprecated
|
73 |
+
*
|
74 |
+
* @param string $position
|
75 |
+
* @return $this
|
76 |
+
*/
|
|
|
|
|
|
|
77 |
public function withPostion($position)
|
78 |
+
{
|
79 |
+
return $this->withPosition($position);
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* The Text position that will be used.
|
84 |
+
*
|
85 |
+
* @see Caption::POSITION_ABOVE
|
86 |
+
* @see Caption::POSITION_BELOW
|
87 |
+
* @see Caption::POSITION_CENTER
|
88 |
+
*
|
89 |
+
* @param string $position that will be used.
|
90 |
+
*
|
91 |
+
* @return $this
|
92 |
+
*/
|
93 |
+
public function withPosition($position)
|
94 |
{
|
95 |
Type::enforceWithin(
|
96 |
$position,
|
97 |
+
[
|
98 |
Caption::POSITION_ABOVE,
|
99 |
Caption::POSITION_BELOW,
|
100 |
Caption::POSITION_CENTER
|
101 |
+
]
|
102 |
);
|
103 |
$this->position = $position;
|
104 |
|
108 |
/**
|
109 |
* Structure and create the H1 in a DOMElement.
|
110 |
*
|
111 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
112 |
+
*
|
113 |
+
* @return \DOMElement
|
114 |
*/
|
115 |
public function toDOMElement($document = null)
|
116 |
{
|
117 |
if (!$document) {
|
118 |
$document = new \DOMDocument();
|
119 |
}
|
120 |
+
|
121 |
+
if (!$this->isValid()) {
|
122 |
+
return $this->emptyElement($document);
|
123 |
+
}
|
124 |
+
|
125 |
$h1 = $document->createElement('h1');
|
126 |
|
127 |
+
$classes = [];
|
128 |
if ($this->position) {
|
129 |
$classes[] = $this->position;
|
130 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H2.php
CHANGED
@@ -34,12 +34,14 @@ class H2 extends TextContainer
|
|
34 |
{
|
35 |
}
|
36 |
|
|
|
|
|
|
|
37 |
public static function create()
|
38 |
{
|
39 |
return new self();
|
40 |
}
|
41 |
|
42 |
-
|
43 |
/**
|
44 |
* The Text alignment that will be used.
|
45 |
*
|
@@ -47,17 +49,19 @@ class H2 extends TextContainer
|
|
47 |
* @see Caption::ALIGN_LEFT
|
48 |
* @see Caption::ALIGN_CENTER
|
49 |
*
|
50 |
-
* @param string alignment option that will be used.
|
|
|
|
|
51 |
*/
|
52 |
public function withTextAlignment($text_alignment)
|
53 |
{
|
54 |
Type::enforceWithin(
|
55 |
$text_alignment,
|
56 |
-
|
57 |
Caption::ALIGN_RIGHT,
|
58 |
Caption::ALIGN_LEFT,
|
59 |
Caption::ALIGN_CENTER
|
60 |
-
|
61 |
);
|
62 |
$this->textAlignment = $text_alignment;
|
63 |
|
@@ -65,23 +69,37 @@ class H2 extends TextContainer
|
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
* @param string position that will be used.
|
75 |
-
*/
|
76 |
public function withPostion($position)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
{
|
78 |
Type::enforceWithin(
|
79 |
$position,
|
80 |
-
|
81 |
Caption::POSITION_ABOVE,
|
82 |
Caption::POSITION_BELOW,
|
83 |
Caption::POSITION_CENTER
|
84 |
-
|
85 |
);
|
86 |
$this->position = $position;
|
87 |
|
@@ -91,16 +109,23 @@ class H2 extends TextContainer
|
|
91 |
/**
|
92 |
* Structure and create the H2 in a DOMElement.
|
93 |
*
|
94 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
95 |
*/
|
96 |
public function toDOMElement($document = null)
|
97 |
{
|
98 |
if (!$document) {
|
99 |
$document = new \DOMDocument();
|
100 |
}
|
|
|
|
|
|
|
|
|
|
|
101 |
$h2 = $document->createElement('h2');
|
102 |
|
103 |
-
$classes =
|
104 |
if ($this->position) {
|
105 |
$classes[] = $this->position;
|
106 |
}
|
34 |
{
|
35 |
}
|
36 |
|
37 |
+
/**
|
38 |
+
* @return H2
|
39 |
+
*/
|
40 |
public static function create()
|
41 |
{
|
42 |
return new self();
|
43 |
}
|
44 |
|
|
|
45 |
/**
|
46 |
* The Text alignment that will be used.
|
47 |
*
|
49 |
* @see Caption::ALIGN_LEFT
|
50 |
* @see Caption::ALIGN_CENTER
|
51 |
*
|
52 |
+
* @param string $text_alignment alignment option that will be used.
|
53 |
+
*
|
54 |
+
* @return $this
|
55 |
*/
|
56 |
public function withTextAlignment($text_alignment)
|
57 |
{
|
58 |
Type::enforceWithin(
|
59 |
$text_alignment,
|
60 |
+
[
|
61 |
Caption::ALIGN_RIGHT,
|
62 |
Caption::ALIGN_LEFT,
|
63 |
Caption::ALIGN_CENTER
|
64 |
+
]
|
65 |
);
|
66 |
$this->textAlignment = $text_alignment;
|
67 |
|
69 |
}
|
70 |
|
71 |
/**
|
72 |
+
* @deprecated
|
73 |
+
*
|
74 |
+
* @param string $position
|
75 |
+
*
|
76 |
+
* @return $this
|
77 |
+
*/
|
|
|
|
|
78 |
public function withPostion($position)
|
79 |
+
{
|
80 |
+
return $this->withPosition($position);
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* The Text position that will be used.
|
85 |
+
*
|
86 |
+
* @see Caption::POSITION_ABOVE
|
87 |
+
* @see Caption::POSITION_BELOW
|
88 |
+
* @see Caption::POSITION_CENTER
|
89 |
+
*
|
90 |
+
* @param string $position
|
91 |
+
*
|
92 |
+
* @return $this
|
93 |
+
*/
|
94 |
+
public function withPosition($position)
|
95 |
{
|
96 |
Type::enforceWithin(
|
97 |
$position,
|
98 |
+
[
|
99 |
Caption::POSITION_ABOVE,
|
100 |
Caption::POSITION_BELOW,
|
101 |
Caption::POSITION_CENTER
|
102 |
+
]
|
103 |
);
|
104 |
$this->position = $position;
|
105 |
|
109 |
/**
|
110 |
* Structure and create the H2 in a DOMElement.
|
111 |
*
|
112 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
113 |
+
*
|
114 |
+
* @return \DOMElement
|
115 |
*/
|
116 |
public function toDOMElement($document = null)
|
117 |
{
|
118 |
if (!$document) {
|
119 |
$document = new \DOMDocument();
|
120 |
}
|
121 |
+
|
122 |
+
if (!$this->isValid()) {
|
123 |
+
return $this->emptyElement($document);
|
124 |
+
}
|
125 |
+
|
126 |
$h2 = $document->createElement('h2');
|
127 |
|
128 |
+
$classes = [];
|
129 |
if ($this->position) {
|
130 |
$classes[] = $this->position;
|
131 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/H3.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* This source code is licensed under the license found in the
|
7 |
+
* LICENSE file in the root directory of this source tree.
|
8 |
+
*/
|
9 |
+
namespace Facebook\InstantArticles\Elements;
|
10 |
+
|
11 |
+
use Facebook\InstantArticles\Validators\Type;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Title for the Document
|
15 |
+
*
|
16 |
+
* Example:
|
17 |
+
* <h3> This is the first Instant Article</h3>
|
18 |
+
* or
|
19 |
+
* <h3> This is the <b>first</b> Instant Article</h3>
|
20 |
+
*/
|
21 |
+
class H3 extends TextContainer
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* @var string text align. Values: "op-left"|"op-center"|"op-right"
|
25 |
+
*/
|
26 |
+
private $textAlignment;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var string text position. Values: "op-vertical-below"|"op-vertical-above"|"op-vertical-center"
|
30 |
+
*/
|
31 |
+
private $position;
|
32 |
+
|
33 |
+
private function __construct()
|
34 |
+
{
|
35 |
+
}
|
36 |
+
|
37 |
+
public static function create()
|
38 |
+
{
|
39 |
+
return new self();
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
/**
|
44 |
+
* The Text alignment that will be used.
|
45 |
+
*
|
46 |
+
* @see Caption::ALIGN_RIGHT
|
47 |
+
* @see Caption::ALIGN_LEFT
|
48 |
+
* @see Caption::ALIGN_CENTER
|
49 |
+
*
|
50 |
+
* @param string $text_alignment option that will be used.
|
51 |
+
*/
|
52 |
+
public function withTextAlignment($text_alignment)
|
53 |
+
{
|
54 |
+
Type::enforceWithin(
|
55 |
+
$text_alignment,
|
56 |
+
[
|
57 |
+
Caption::ALIGN_RIGHT,
|
58 |
+
Caption::ALIGN_LEFT,
|
59 |
+
Caption::ALIGN_CENTER
|
60 |
+
]
|
61 |
+
);
|
62 |
+
$this->textAlignment = $text_alignment;
|
63 |
+
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @deprecated
|
69 |
+
*
|
70 |
+
* @param string $position
|
71 |
+
* @return $this
|
72 |
+
*/
|
73 |
+
public function withPostion($position)
|
74 |
+
{
|
75 |
+
return $this->withPosition($position);
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* The Text position that will be used.
|
80 |
+
*
|
81 |
+
* @see Caption::POSITION_ABOVE
|
82 |
+
* @see Caption::POSITION_BELOW
|
83 |
+
* @see Caption::POSITION_CENTER
|
84 |
+
*
|
85 |
+
* @param string $position
|
86 |
+
* @return $this
|
87 |
+
*/
|
88 |
+
public function withPosition($position)
|
89 |
+
{
|
90 |
+
Type::enforceWithin(
|
91 |
+
$position,
|
92 |
+
[
|
93 |
+
Caption::POSITION_ABOVE,
|
94 |
+
Caption::POSITION_BELOW,
|
95 |
+
Caption::POSITION_CENTER
|
96 |
+
]
|
97 |
+
);
|
98 |
+
$this->position = $position;
|
99 |
+
|
100 |
+
return $this;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Structure and create the H3 in a DOMElement.
|
105 |
+
*
|
106 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
107 |
+
*/
|
108 |
+
public function toDOMElement($document = null)
|
109 |
+
{
|
110 |
+
if (!$document) {
|
111 |
+
$document = new \DOMDocument();
|
112 |
+
}
|
113 |
+
|
114 |
+
if (!$this->isValid()) {
|
115 |
+
return $this->emptyElement($document);
|
116 |
+
}
|
117 |
+
|
118 |
+
$h3 = $document->createElement('h3');
|
119 |
+
|
120 |
+
$classes = [];
|
121 |
+
if ($this->position) {
|
122 |
+
$classes[] = $this->position;
|
123 |
+
}
|
124 |
+
if ($this->textAlignment) {
|
125 |
+
$classes[] = $this->textAlignment;
|
126 |
+
}
|
127 |
+
if (!empty($classes)) {
|
128 |
+
$h3->setAttribute('class', implode(' ', $classes));
|
129 |
+
}
|
130 |
+
|
131 |
+
$h3->appendChild($this->textToDOMDocumentFragment($document));
|
132 |
+
|
133 |
+
return $h3;
|
134 |
+
}
|
135 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Header.php
CHANGED
@@ -19,7 +19,7 @@ use Facebook\InstantArticles\Validators\Type;
|
|
19 |
* <ui:image src={$this->getHeroBackground()} />
|
20 |
* </figure>
|
21 |
* <h1>{$this->name}</h1>
|
22 |
-
* <
|
23 |
* <a rel="facebook" href="http://facebook.com/everton.rosario">Everton</a>
|
24 |
* Everton Rosario is a passionate mountain biker on Facebook
|
25 |
* </address>
|
@@ -35,7 +35,7 @@ use Facebook\InstantArticles\Validators\Type;
|
|
35 |
* </time>
|
36 |
* </header>
|
37 |
*/
|
38 |
-
class Header extends Element
|
39 |
{
|
40 |
/**
|
41 |
* @var Image|Video|null for the image or video on the header.
|
@@ -46,19 +46,19 @@ class Header extends Element
|
|
46 |
private $cover;
|
47 |
|
48 |
/**
|
49 |
-
*
|
50 |
*/
|
51 |
private $title;
|
52 |
|
53 |
/**
|
54 |
-
*
|
55 |
*/
|
56 |
private $subtitle;
|
57 |
|
58 |
/**
|
59 |
* @var Author[] Authors of the article.
|
60 |
*/
|
61 |
-
private $authors =
|
62 |
|
63 |
/**
|
64 |
* @var Time of publishing for the article
|
@@ -72,19 +72,22 @@ class Header extends Element
|
|
72 |
private $modified;
|
73 |
|
74 |
/**
|
75 |
-
* @var
|
76 |
*/
|
77 |
private $kicker;
|
78 |
|
79 |
/**
|
80 |
* @var Ad[] Ads of the article.
|
81 |
*/
|
82 |
-
private $ads =
|
83 |
|
84 |
private function __construct()
|
85 |
{
|
86 |
}
|
87 |
|
|
|
|
|
|
|
88 |
public static function create()
|
89 |
{
|
90 |
return new self();
|
@@ -92,11 +95,14 @@ class Header extends Element
|
|
92 |
|
93 |
/**
|
94 |
* Sets the cover of InstantArticle with Image or Video
|
|
|
95 |
* @param Image|Video $cover The cover for the header of the InstantArticle
|
|
|
|
|
96 |
*/
|
97 |
public function withCover($cover)
|
98 |
{
|
99 |
-
Type::enforce($cover,
|
100 |
$this->cover = $cover;
|
101 |
|
102 |
return $this;
|
@@ -104,31 +110,49 @@ class Header extends Element
|
|
104 |
|
105 |
/**
|
106 |
* Sets the title of InstantArticle
|
107 |
-
*
|
|
|
|
|
|
|
108 |
*/
|
109 |
public function withTitle($title)
|
110 |
{
|
111 |
-
Type::enforce($title, Type::STRING);
|
112 |
-
$
|
|
|
|
|
|
|
|
|
113 |
|
114 |
return $this;
|
115 |
}
|
116 |
|
117 |
/**
|
118 |
* Sets the subtitle of InstantArticle
|
119 |
-
*
|
|
|
|
|
|
|
120 |
*/
|
121 |
public function withSubTitle($subtitle)
|
122 |
{
|
123 |
-
Type::enforce($subtitle, Type::STRING);
|
124 |
-
$
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
return $this;
|
127 |
}
|
128 |
|
129 |
/**
|
130 |
* Append another author to the article
|
|
|
131 |
* @param Author $author The author name
|
|
|
|
|
132 |
*/
|
133 |
public function addAuthor($author)
|
134 |
{
|
@@ -140,7 +164,10 @@ class Header extends Element
|
|
140 |
|
141 |
/**
|
142 |
* Replace all authors within this Article
|
143 |
-
*
|
|
|
|
|
|
|
144 |
*/
|
145 |
public function withAuthors($authors)
|
146 |
{
|
@@ -152,7 +179,10 @@ class Header extends Element
|
|
152 |
|
153 |
/**
|
154 |
* Sets the publish Time for this article. REQUIRED
|
155 |
-
*
|
|
|
|
|
|
|
156 |
*/
|
157 |
public function withPublishTime($published)
|
158 |
{
|
@@ -164,7 +194,10 @@ class Header extends Element
|
|
164 |
|
165 |
/**
|
166 |
* Sets the update Time for this article. Optional
|
167 |
-
*
|
|
|
|
|
|
|
168 |
*/
|
169 |
public function withModifyTime($modified)
|
170 |
{
|
@@ -176,7 +209,10 @@ class Header extends Element
|
|
176 |
|
177 |
/**
|
178 |
* Sets the update Time for this article. Optional
|
179 |
-
*
|
|
|
|
|
|
|
180 |
*/
|
181 |
public function withTime($time)
|
182 |
{
|
@@ -192,19 +228,29 @@ class Header extends Element
|
|
192 |
|
193 |
/**
|
194 |
* Kicker text for the article header.
|
195 |
-
*
|
|
|
|
|
|
|
196 |
*/
|
197 |
public function withKicker($kicker)
|
198 |
{
|
199 |
-
Type::enforce($kicker, Type::STRING);
|
200 |
-
$
|
|
|
|
|
|
|
|
|
201 |
|
202 |
return $this;
|
203 |
}
|
204 |
|
205 |
/**
|
206 |
* Append another ad to the article
|
|
|
207 |
* @param Ad $ad Code for displaying an ad
|
|
|
|
|
208 |
*/
|
209 |
public function addAd($ad)
|
210 |
{
|
@@ -216,7 +262,10 @@ class Header extends Element
|
|
216 |
|
217 |
/**
|
218 |
* Replace all ads within this Article
|
219 |
-
*
|
|
|
|
|
|
|
220 |
*/
|
221 |
public function withAds($ads)
|
222 |
{
|
@@ -227,7 +276,7 @@ class Header extends Element
|
|
227 |
}
|
228 |
|
229 |
/**
|
230 |
-
* @return Image|Video
|
231 |
*/
|
232 |
public function getCover()
|
233 |
{
|
@@ -235,7 +284,7 @@ class Header extends Element
|
|
235 |
}
|
236 |
|
237 |
/**
|
238 |
-
* @return string $title The title of the InstantArticle
|
239 |
*/
|
240 |
public function getTitle()
|
241 |
{
|
@@ -243,7 +292,7 @@ class Header extends Element
|
|
243 |
}
|
244 |
|
245 |
/**
|
246 |
-
* @return string $subtitle The subtitle of the InstantArticle
|
247 |
*/
|
248 |
public function getSubtitle()
|
249 |
{
|
@@ -251,7 +300,7 @@ class Header extends Element
|
|
251 |
}
|
252 |
|
253 |
/**
|
254 |
-
* @return
|
255 |
*/
|
256 |
public function getAuthors()
|
257 |
{
|
@@ -259,7 +308,7 @@ class Header extends Element
|
|
259 |
}
|
260 |
|
261 |
/**
|
262 |
-
* @return Time
|
263 |
*/
|
264 |
public function getPublished()
|
265 |
{
|
@@ -267,7 +316,7 @@ class Header extends Element
|
|
267 |
}
|
268 |
|
269 |
/**
|
270 |
-
* @return Time
|
271 |
*/
|
272 |
public function getModified()
|
273 |
{
|
@@ -283,7 +332,7 @@ class Header extends Element
|
|
283 |
}
|
284 |
|
285 |
/**
|
286 |
-
* @return
|
287 |
*/
|
288 |
public function getAds()
|
289 |
{
|
@@ -293,62 +342,69 @@ class Header extends Element
|
|
293 |
/**
|
294 |
* Structure and create the full ArticleImage in a XML format DOMElement.
|
295 |
*
|
296 |
-
* @param $document
|
|
|
|
|
297 |
*/
|
298 |
public function toDOMElement($document = null)
|
299 |
{
|
300 |
if (!$document) {
|
301 |
$document = new \DOMDocument();
|
302 |
}
|
|
|
|
|
|
|
|
|
|
|
303 |
$element = $document->createElement('header');
|
304 |
|
305 |
-
if ($this->cover) {
|
306 |
$element->appendChild($this->cover->toDOMElement($document));
|
307 |
}
|
308 |
|
309 |
-
if ($this->title) {
|
310 |
-
$
|
311 |
-
$title_element->appendChild($document->createTextNode($this->title));
|
312 |
-
$element->appendChild($title_element);
|
313 |
}
|
314 |
|
315 |
-
if ($this->subtitle) {
|
316 |
-
$
|
317 |
-
$sub_title_element->appendChild($document->createTextNode($this->subtitle));
|
318 |
-
$element->appendChild($sub_title_element);
|
319 |
}
|
320 |
|
321 |
-
if ($this->published) {
|
322 |
$published_element = $this->published->toDOMElement($document);
|
323 |
$element->appendChild($published_element);
|
324 |
}
|
325 |
|
326 |
-
if ($this->modified) {
|
327 |
$modified_element = $this->modified->toDOMElement($document);
|
328 |
$element->appendChild($modified_element);
|
329 |
}
|
330 |
|
331 |
if ($this->authors) {
|
332 |
foreach ($this->authors as $author) {
|
333 |
-
|
|
|
|
|
334 |
}
|
335 |
}
|
336 |
|
337 |
-
if ($this->kicker) {
|
338 |
-
$kicker_element = $
|
339 |
$kicker_element->setAttribute('class', 'op-kicker');
|
340 |
-
$kicker_element->appendChild($document->createTextNode($this->kicker));
|
341 |
$element->appendChild($kicker_element);
|
342 |
}
|
343 |
|
344 |
if (count($this->ads) === 1) {
|
345 |
$this->ads[0]->disableDefaultForReuse();
|
346 |
-
|
|
|
|
|
347 |
} elseif (count($this->ads) >= 2) {
|
348 |
$ads_container = $document->createElement('section');
|
349 |
$ads_container->setAttribute('class', 'op-ad-template');
|
350 |
|
351 |
$default_is_set = false;
|
|
|
352 |
foreach ($this->ads as $ad) {
|
353 |
if ($default_is_set) {
|
354 |
$ad->disableDefaultForReuse();
|
@@ -358,11 +414,88 @@ class Header extends Element
|
|
358 |
$default_is_set = true;
|
359 |
}
|
360 |
|
361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
}
|
363 |
-
$element->appendChild($ads_container);
|
364 |
}
|
365 |
|
366 |
return $element;
|
367 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
}
|
19 |
* <ui:image src={$this->getHeroBackground()} />
|
20 |
* </figure>
|
21 |
* <h1>{$this->name}</h1>
|
22 |
+
* <address>
|
23 |
* <a rel="facebook" href="http://facebook.com/everton.rosario">Everton</a>
|
24 |
* Everton Rosario is a passionate mountain biker on Facebook
|
25 |
* </address>
|
35 |
* </time>
|
36 |
* </header>
|
37 |
*/
|
38 |
+
class Header extends Element implements Container
|
39 |
{
|
40 |
/**
|
41 |
* @var Image|Video|null for the image or video on the header.
|
46 |
private $cover;
|
47 |
|
48 |
/**
|
49 |
+
* H1 The title of the Article that will be displayed on header.
|
50 |
*/
|
51 |
private $title;
|
52 |
|
53 |
/**
|
54 |
+
* H2 The subtitle of the Article that will be displayed on header.
|
55 |
*/
|
56 |
private $subtitle;
|
57 |
|
58 |
/**
|
59 |
* @var Author[] Authors of the article.
|
60 |
*/
|
61 |
+
private $authors = [];
|
62 |
|
63 |
/**
|
64 |
* @var Time of publishing for the article
|
72 |
private $modified;
|
73 |
|
74 |
/**
|
75 |
+
* @var H3 Header kicker
|
76 |
*/
|
77 |
private $kicker;
|
78 |
|
79 |
/**
|
80 |
* @var Ad[] Ads of the article.
|
81 |
*/
|
82 |
+
private $ads = [];
|
83 |
|
84 |
private function __construct()
|
85 |
{
|
86 |
}
|
87 |
|
88 |
+
/**
|
89 |
+
* @return Header
|
90 |
+
*/
|
91 |
public static function create()
|
92 |
{
|
93 |
return new self();
|
95 |
|
96 |
/**
|
97 |
* Sets the cover of InstantArticle with Image or Video
|
98 |
+
*
|
99 |
* @param Image|Video $cover The cover for the header of the InstantArticle
|
100 |
+
*
|
101 |
+
* @return $this
|
102 |
*/
|
103 |
public function withCover($cover)
|
104 |
{
|
105 |
+
Type::enforce($cover, [Image::getClassName(), Video::getClassName()]);
|
106 |
$this->cover = $cover;
|
107 |
|
108 |
return $this;
|
110 |
|
111 |
/**
|
112 |
* Sets the title of InstantArticle
|
113 |
+
*
|
114 |
+
* @param string|H1 $title The title of the InstantArticle
|
115 |
+
*
|
116 |
+
* @return $this
|
117 |
*/
|
118 |
public function withTitle($title)
|
119 |
{
|
120 |
+
Type::enforce($title, array(Type::STRING, H1::getClassName()));
|
121 |
+
if (Type::is($title, Type::STRING)) {
|
122 |
+
$this->title = H1::create()->appendText($title);
|
123 |
+
} else {
|
124 |
+
$this->title = $title;
|
125 |
+
}
|
126 |
|
127 |
return $this;
|
128 |
}
|
129 |
|
130 |
/**
|
131 |
* Sets the subtitle of InstantArticle
|
132 |
+
*
|
133 |
+
* @param string|H2 $subtitle The subtitle of the InstantArticle
|
134 |
+
*
|
135 |
+
* @return $this
|
136 |
*/
|
137 |
public function withSubTitle($subtitle)
|
138 |
{
|
139 |
+
Type::enforce($subtitle, array(Type::STRING, H2::getClassName()));
|
140 |
+
if (Type::is($subtitle, Type::STRING)) {
|
141 |
+
$this->subtitle = H2::create()->appendText($subtitle);
|
142 |
+
} else {
|
143 |
+
$this->subtitle = $subtitle;
|
144 |
+
}
|
145 |
+
|
146 |
|
147 |
return $this;
|
148 |
}
|
149 |
|
150 |
/**
|
151 |
* Append another author to the article
|
152 |
+
*
|
153 |
* @param Author $author The author name
|
154 |
+
*
|
155 |
+
* @return $this
|
156 |
*/
|
157 |
public function addAuthor($author)
|
158 |
{
|
164 |
|
165 |
/**
|
166 |
* Replace all authors within this Article
|
167 |
+
*
|
168 |
+
* @param Author[] $authors All the authors
|
169 |
+
*
|
170 |
+
* @return $this
|
171 |
*/
|
172 |
public function withAuthors($authors)
|
173 |
{
|
179 |
|
180 |
/**
|
181 |
* Sets the publish Time for this article. REQUIRED
|
182 |
+
*
|
183 |
+
* @param Time $published The time and date of publishing of this article. REQUIRED
|
184 |
+
*
|
185 |
+
* @return $this
|
186 |
*/
|
187 |
public function withPublishTime($published)
|
188 |
{
|
194 |
|
195 |
/**
|
196 |
* Sets the update Time for this article. Optional
|
197 |
+
*
|
198 |
+
* @param Time $modified The time and date that this article was modified. Optional
|
199 |
+
*
|
200 |
+
* @return $this
|
201 |
*/
|
202 |
public function withModifyTime($modified)
|
203 |
{
|
209 |
|
210 |
/**
|
211 |
* Sets the update Time for this article. Optional
|
212 |
+
*
|
213 |
+
* @param Time $time The time and date that this article was modified. Optional
|
214 |
+
*
|
215 |
+
* @return $this
|
216 |
*/
|
217 |
public function withTime($time)
|
218 |
{
|
228 |
|
229 |
/**
|
230 |
* Kicker text for the article header.
|
231 |
+
*
|
232 |
+
* @param H3|string The kicker text to be set
|
233 |
+
*
|
234 |
+
* @return $this
|
235 |
*/
|
236 |
public function withKicker($kicker)
|
237 |
{
|
238 |
+
Type::enforce($kicker, array(Type::STRING, H3::getClassName()));
|
239 |
+
if (Type::is($kicker, Type::STRING)) {
|
240 |
+
$this->kicker = H3::create()->appendText($kicker);
|
241 |
+
} else {
|
242 |
+
$this->kicker = $kicker;
|
243 |
+
}
|
244 |
|
245 |
return $this;
|
246 |
}
|
247 |
|
248 |
/**
|
249 |
* Append another ad to the article
|
250 |
+
*
|
251 |
* @param Ad $ad Code for displaying an ad
|
252 |
+
*
|
253 |
+
* @return $this
|
254 |
*/
|
255 |
public function addAd($ad)
|
256 |
{
|
262 |
|
263 |
/**
|
264 |
* Replace all ads within this Article
|
265 |
+
*
|
266 |
+
* @param Ad[] $ads All the ads
|
267 |
+
*
|
268 |
+
* @return $this
|
269 |
*/
|
270 |
public function withAds($ads)
|
271 |
{
|
276 |
}
|
277 |
|
278 |
/**
|
279 |
+
* @return Image|Video The cover for the header of the InstantArticle
|
280 |
*/
|
281 |
public function getCover()
|
282 |
{
|
284 |
}
|
285 |
|
286 |
/**
|
287 |
+
* @return string|H1 $title The title of the InstantArticle
|
288 |
*/
|
289 |
public function getTitle()
|
290 |
{
|
292 |
}
|
293 |
|
294 |
/**
|
295 |
+
* @return string|H2 $subtitle The subtitle of the InstantArticle
|
296 |
*/
|
297 |
public function getSubtitle()
|
298 |
{
|
300 |
}
|
301 |
|
302 |
/**
|
303 |
+
* @return Author[] All the authors
|
304 |
*/
|
305 |
public function getAuthors()
|
306 |
{
|
308 |
}
|
309 |
|
310 |
/**
|
311 |
+
* @return Time The time and date of publishing of this article
|
312 |
*/
|
313 |
public function getPublished()
|
314 |
{
|
316 |
}
|
317 |
|
318 |
/**
|
319 |
+
* @return Time The time and date that this article was modified.
|
320 |
*/
|
321 |
public function getModified()
|
322 |
{
|
332 |
}
|
333 |
|
334 |
/**
|
335 |
+
* @return Ad[] All the ads
|
336 |
*/
|
337 |
public function getAds()
|
338 |
{
|
342 |
/**
|
343 |
* Structure and create the full ArticleImage in a XML format DOMElement.
|
344 |
*
|
345 |
+
* @param \DOMDocument $document where this element will be appended. Optional
|
346 |
+
*
|
347 |
+
* @return \DOMElement
|
348 |
*/
|
349 |
public function toDOMElement($document = null)
|
350 |
{
|
351 |
if (!$document) {
|
352 |
$document = new \DOMDocument();
|
353 |
}
|
354 |
+
|
355 |
+
if (!$this->isValid()) {
|
356 |
+
return $this->emptyElement($document);
|
357 |
+
}
|
358 |
+
|
359 |
$element = $document->createElement('header');
|
360 |
|
361 |
+
if ($this->cover && $this->cover->isValid()) {
|
362 |
$element->appendChild($this->cover->toDOMElement($document));
|
363 |
}
|
364 |
|
365 |
+
if ($this->title && $this->title->isValid()) {
|
366 |
+
$element->appendChild($this->title->toDOMElement($document));
|
|
|
|
|
367 |
}
|
368 |
|
369 |
+
if ($this->subtitle && $this->subtitle->isValid()) {
|
370 |
+
$element->appendChild($this->subtitle->toDOMElement($document));
|
|
|
|
|
371 |
}
|
372 |
|
373 |
+
if ($this->published && $this->published->isValid()) {
|
374 |
$published_element = $this->published->toDOMElement($document);
|
375 |
$element->appendChild($published_element);
|
376 |
}
|
377 |
|
378 |
+
if ($this->modified && $this->modified->isValid()) {
|
379 |
$modified_element = $this->modified->toDOMElement($document);
|
380 |
$element->appendChild($modified_element);
|
381 |
}
|
382 |
|
383 |
if ($this->authors) {
|
384 |
foreach ($this->authors as $author) {
|
385 |
+
if ($author->isValid()) {
|
386 |
+
$element->appendChild($author->toDOMElement($document));
|
387 |
+
}
|
388 |
}
|
389 |
}
|
390 |
|
391 |
+
if ($this->kicker && $this->kicker->isValid()) {
|
392 |
+
$kicker_element = $this->kicker->toDOMElement($document);
|
393 |
$kicker_element->setAttribute('class', 'op-kicker');
|
|
|
394 |
$element->appendChild($kicker_element);
|
395 |
}
|
396 |
|
397 |
if (count($this->ads) === 1) {
|
398 |
$this->ads[0]->disableDefaultForReuse();
|
399 |
+
if ($this->ads[0]->isValid()) {
|
400 |
+
$element->appendChild($this->ads[0]->toDOMElement($document));
|
401 |
+
}
|
402 |
} elseif (count($this->ads) >= 2) {
|
403 |
$ads_container = $document->createElement('section');
|
404 |
$ads_container->setAttribute('class', 'op-ad-template');
|
405 |
|
406 |
$default_is_set = false;
|
407 |
+
$has_valid_ad = false;
|
408 |
foreach ($this->ads as $ad) {
|
409 |
if ($default_is_set) {
|
410 |
$ad->disableDefaultForReuse();
|
414 |
$default_is_set = true;
|
415 |
}
|
416 |
|
417 |
+
if ($ad->isValid()) {
|
418 |
+
$ads_container->appendChild($ad->toDOMElement($document));
|
419 |
+
$has_valid_ad = true;
|
420 |
+
}
|
421 |
+
}
|
422 |
+
if ($has_valid_ad) {
|
423 |
+
$element->appendChild($ads_container);
|
424 |
}
|
|
|
425 |
}
|
426 |
|
427 |
return $element;
|
428 |
}
|
429 |
+
|
430 |
+
/**
|
431 |
+
* Overrides the Element::isValid().
|
432 |
+
*
|
433 |
+
* @see Element::isValid().
|
434 |
+
* @return true for valid tag, false otherwise.
|
435 |
+
*/
|
436 |
+
public function isValid()
|
437 |
+
{
|
438 |
+
$has_ad = count($this->ads) > 0;
|
439 |
+
$has_valid_ad = false;
|
440 |
+
if ($has_ad) {
|
441 |
+
foreach ($this->ads as $ad) {
|
442 |
+
if ($ad->isValid()) {
|
443 |
+
$has_valid_ad = true;
|
444 |
+
break;
|
445 |
+
}
|
446 |
+
}
|
447 |
+
}
|
448 |
+
return
|
449 |
+
($this->title && $this->title->isValid()) ||
|
450 |
+
$has_valid_ad;
|
451 |
+
}
|
452 |
+
|
453 |
+
/**
|
454 |
+
* Implements the Container::getContainerChildren().
|
455 |
+
*
|
456 |
+
* @see Container::getContainerChildren().
|
457 |
+
* @return array of Elements contained by Header.
|
458 |
+
*/
|
459 |
+
public function getContainerChildren()
|
460 |
+
{
|
461 |
+
$children = array();
|
462 |
+
|
463 |
+
if ($this->cover) {
|
464 |
+
$children[] = $this->cover;
|
465 |
+
}
|
466 |
+
|
467 |
+
if ($this->title) {
|
468 |
+
$children[] = $this->title;
|
469 |
+
}
|
470 |
+
|
471 |
+
if ($this->subtitle) {
|
472 |
+
$children[] = $this->subtitle;
|
473 |
+
}
|
474 |
+
|
475 |
+
if ($this->published) {
|
476 |
+
$children[] = $this->published;
|
477 |
+
}
|
478 |
+
|
479 |
+
if ($this->modified) {
|
480 |
+
$children[] = $this->modified;
|
481 |
+
}
|
482 |
+
|
483 |
+
if ($this->authors) {
|
484 |
+
foreach ($this->authors as $author) {
|
485 |
+
$children[] = $author;
|
486 |
+
}
|
487 |
+
}
|
488 |
+
|
489 |
+
if ($this->kicker) {
|
490 |
+
$children[] = $this->kicker;
|
491 |
+
}
|
492 |
+
|
493 |
+
if (count($this->ads) > 0) {
|
494 |
+
foreach ($this->ads as $ad) {
|
495 |
+
$children[] = $ad;
|
496 |
+
}
|
497 |
+
}
|
498 |
+
|
499 |
+
return $children;
|
500 |
+
}
|
501 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Image.php
CHANGED
@@ -15,10 +15,10 @@ use Facebook\InstantArticles\Validators\Type;
|
|
15 |
* This element Class is the image for the article.
|
16 |
* Also consider to use one of the other media types for an article:
|
17 |
* <ul>
|
18 |
-
* <li
|
19 |
-
* <li
|
20 |
-
* <li
|
21 |
-
* <li
|
22 |
* </ul>.
|
23 |
*
|
24 |
* Example:
|
@@ -27,9 +27,13 @@ use Facebook\InstantArticles\Validators\Type;
|
|
27 |
* <figcaption>This image is amazing</figcaption>
|
28 |
* </figure>
|
29 |
*
|
|
|
|
|
|
|
|
|
30 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/image}
|
31 |
*/
|
32 |
-
class Image extends Audible
|
33 |
{
|
34 |
const ASPECT_FIT = 'aspect-fit';
|
35 |
const ASPECT_FIT_ONLY = 'aspect-fit-only';
|
@@ -95,9 +99,11 @@ class Image extends Audible
|
|
95 |
|
96 |
/**
|
97 |
* This sets figcaption tag as documentation. It overrides all sets
|
98 |
-
* made with
|
99 |
*
|
100 |
-
* @param Caption the caption the image will have
|
|
|
|
|
101 |
*/
|
102 |
public function withCaption($caption)
|
103 |
{
|
@@ -110,7 +116,9 @@ class Image extends Audible
|
|
110 |
/**
|
111 |
* Sets the URL for the image. It is REQUIRED.
|
112 |
*
|
113 |
-
* @param string The url of image. Ie: http://domain.com/img.png
|
|
|
|
|
114 |
*/
|
115 |
public function withURL($url)
|
116 |
{
|
@@ -123,22 +131,24 @@ class Image extends Audible
|
|
123 |
/**
|
124 |
* Sets the aspect ration presentation for the video.
|
125 |
*
|
126 |
-
* @param string one of the constants ASPECT_FIT, ASPECT_FIT_ONLY, FULLSCREEN or NON_INTERACTIVE
|
127 |
* @see Image::ASPECT_FIT
|
128 |
* @see Image::ASPECT_FIT_ONLY
|
129 |
* @see Image::FULLSCREEN
|
130 |
* @see Image::NON_INTERACTIVE
|
|
|
|
|
131 |
*/
|
132 |
public function withPresentation($presentation)
|
133 |
{
|
134 |
Type::enforceWithin(
|
135 |
$presentation,
|
136 |
-
|
137 |
Image::ASPECT_FIT,
|
138 |
Image::ASPECT_FIT_ONLY,
|
139 |
Image::FULLSCREEN,
|
140 |
Image::NON_INTERACTIVE
|
141 |
-
|
142 |
);
|
143 |
$this->presentation = $presentation;
|
144 |
|
@@ -192,7 +202,7 @@ class Image extends Audible
|
|
192 |
*/
|
193 |
public function withGeoTag($geo_tag)
|
194 |
{
|
195 |
-
Type::enforce($geo_tag,
|
196 |
if (Type::is($geo_tag, Type::STRING)) {
|
197 |
$this->geoTag = GeoTag::create()->withScript($geo_tag);
|
198 |
} elseif (Type::is($geo_tag, GeoTag::getClassName())) {
|
@@ -205,7 +215,9 @@ class Image extends Audible
|
|
205 |
/**
|
206 |
* Adds audio to this image.
|
207 |
*
|
208 |
-
* @param Audio The audio object
|
|
|
|
|
209 |
*/
|
210 |
public function withAudio($audio)
|
211 |
{
|
@@ -278,13 +290,20 @@ class Image extends Audible
|
|
278 |
/**
|
279 |
* Structure and create the full Image in a XML format DOMElement.
|
280 |
*
|
281 |
-
* @param $document
|
|
|
|
|
282 |
*/
|
283 |
public function toDOMElement($document = null)
|
284 |
{
|
285 |
if (!$document) {
|
286 |
$document = new \DOMDocument();
|
287 |
}
|
|
|
|
|
|
|
|
|
|
|
288 |
$element = $document->createElement('figure');
|
289 |
|
290 |
// Like/comments markup optional
|
@@ -327,4 +346,42 @@ class Image extends Audible
|
|
327 |
|
328 |
return $element;
|
329 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
}
|
15 |
* This element Class is the image for the article.
|
16 |
* Also consider to use one of the other media types for an article:
|
17 |
* <ul>
|
18 |
+
* <li>Audio</li>
|
19 |
+
* <li>Video</li>
|
20 |
+
* <li>SlideShow</li>
|
21 |
+
* <li>Map</li>
|
22 |
* </ul>.
|
23 |
*
|
24 |
* Example:
|
27 |
* <figcaption>This image is amazing</figcaption>
|
28 |
* </figure>
|
29 |
*
|
30 |
+
* @see Audio
|
31 |
+
* @see Video
|
32 |
+
* @see SlideShow
|
33 |
+
* @see Map
|
34 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/image}
|
35 |
*/
|
36 |
+
class Image extends Audible implements Container
|
37 |
{
|
38 |
const ASPECT_FIT = 'aspect-fit';
|
39 |
const ASPECT_FIT_ONLY = 'aspect-fit-only';
|
99 |
|
100 |
/**
|
101 |
* This sets figcaption tag as documentation. It overrides all sets
|
102 |
+
* made with Caption.
|
103 |
*
|
104 |
+
* @param Caption $caption the caption the image will have
|
105 |
+
*
|
106 |
+
* @return $this
|
107 |
*/
|
108 |
public function withCaption($caption)
|
109 |
{
|
116 |
/**
|
117 |
* Sets the URL for the image. It is REQUIRED.
|
118 |
*
|
119 |
+
* @param string $url The url of image. Ie: http://domain.com/img.png
|
120 |
+
*
|
121 |
+
* @return $this
|
122 |
*/
|
123 |
public function withURL($url)
|
124 |
{
|
131 |
/**
|
132 |
* Sets the aspect ration presentation for the video.
|
133 |
*
|
134 |
+
* @param string $presentation one of the constants ASPECT_FIT, ASPECT_FIT_ONLY, FULLSCREEN or NON_INTERACTIVE
|
135 |
* @see Image::ASPECT_FIT
|
136 |
* @see Image::ASPECT_FIT_ONLY
|
137 |
* @see Image::FULLSCREEN
|
138 |
* @see Image::NON_INTERACTIVE
|
139 |
+
*
|
140 |
+
* @return $this
|
141 |
*/
|
142 |
public function withPresentation($presentation)
|
143 |
{
|
144 |
Type::enforceWithin(
|
145 |
$presentation,
|
146 |
+
[
|
147 |
Image::ASPECT_FIT,
|
148 |
Image::ASPECT_FIT_ONLY,
|
149 |
Image::FULLSCREEN,
|
150 |
Image::NON_INTERACTIVE
|
151 |
+
]
|
152 |
);
|
153 |
$this->presentation = $presentation;
|
154 |
|
202 |
*/
|
203 |
public function withGeoTag($geo_tag)
|
204 |
{
|
205 |
+
Type::enforce($geo_tag, [Type::STRING, GeoTag::getClassName()]);
|
206 |
if (Type::is($geo_tag, Type::STRING)) {
|
207 |
$this->geoTag = GeoTag::create()->withScript($geo_tag);
|
208 |
} elseif (Type::is($geo_tag, GeoTag::getClassName())) {
|
215 |
/**
|
216 |
* Adds audio to this image.
|
217 |
*
|
218 |
+
* @param Audio $audio The audio object
|
219 |
+
*
|
220 |
+
* @return $this
|
221 |
*/
|
222 |
public function withAudio($audio)
|
223 |
{
|
290 |
/**
|
291 |
* Structure and create the full Image in a XML format DOMElement.
|
292 |
*
|
293 |
+
* @param \DOMDocument $document where this element will be appended. Optional
|
294 |
+
*
|
295 |
+
* @return \DOMElement
|
296 |
*/
|
297 |
public function toDOMElement($document = null)
|
298 |
{
|
299 |
if (!$document) {
|
300 |
$document = new \DOMDocument();
|
301 |
}
|
302 |
+
|
303 |
+
if (!$this->isValid()) {
|
304 |
+
return $this->emptyElement($document);
|
305 |
+
}
|
306 |
+
|
307 |
$element = $document->createElement('figure');
|
308 |
|
309 |
// Like/comments markup optional
|
346 |
|
347 |
return $element;
|
348 |
}
|
349 |
+
|
350 |
+
/**
|
351 |
+
* Overrides the Element::isValid().
|
352 |
+
*
|
353 |
+
* @see Element::isValid().
|
354 |
+
* @return true for valid Image that contains valid url, false otherwise.
|
355 |
+
*/
|
356 |
+
public function isValid()
|
357 |
+
{
|
358 |
+
return !Type::isTextEmpty($this->url);
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Implements the Container::getContainerChildren().
|
363 |
+
*
|
364 |
+
* @see Container::getContainerChildren().
|
365 |
+
* @return array of Elements contained by Image.
|
366 |
+
*/
|
367 |
+
public function getContainerChildren()
|
368 |
+
{
|
369 |
+
$children = array();
|
370 |
+
|
371 |
+
if ($this->caption) {
|
372 |
+
$children[] = $this->caption;
|
373 |
+
}
|
374 |
+
|
375 |
+
// Geotag markup optional
|
376 |
+
if ($this->geoTag) {
|
377 |
+
$children[] = $this->geoTag;
|
378 |
+
}
|
379 |
+
|
380 |
+
// Audio markup optional
|
381 |
+
if ($this->audio) {
|
382 |
+
$children[] = $this->audio;
|
383 |
+
}
|
384 |
+
|
385 |
+
return $children;
|
386 |
+
}
|
387 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/InstantArticle.php
CHANGED
@@ -31,14 +31,14 @@ use Facebook\InstantArticles\Validators\Type;
|
|
31 |
* </html>
|
32 |
*
|
33 |
*/
|
34 |
-
class InstantArticle extends Element
|
35 |
{
|
36 |
-
const CURRENT_VERSION = '1.0
|
37 |
|
38 |
/**
|
39 |
* The meta properties that are used on <head>
|
40 |
*/
|
41 |
-
private $metaProperties =
|
42 |
|
43 |
/**
|
44 |
* @var string The canonical URL for the Instant Article
|
@@ -66,19 +66,19 @@ class InstantArticle extends Element
|
|
66 |
private $style;
|
67 |
|
68 |
/**
|
69 |
-
* @var
|
70 |
*/
|
71 |
private $header;
|
72 |
|
73 |
/**
|
74 |
-
* @var
|
75 |
*/
|
76 |
private $footer;
|
77 |
|
78 |
/**
|
79 |
* @var Element[] of all elements an article can have.
|
80 |
*/
|
81 |
-
private $children =
|
82 |
|
83 |
/**
|
84 |
* Factory method
|
@@ -104,7 +104,9 @@ class InstantArticle extends Element
|
|
104 |
/**
|
105 |
* Sets the canonical URL for the Instant Article. It is REQUIRED.
|
106 |
*
|
107 |
-
* @param string The canonical url of article. Ie: http://domain.com/article.html
|
|
|
|
|
108 |
*/
|
109 |
public function withCanonicalURL($url)
|
110 |
{
|
@@ -117,7 +119,9 @@ class InstantArticle extends Element
|
|
117 |
/**
|
118 |
* Sets the charset for the Instant Article. utf-8 by default.
|
119 |
*
|
120 |
-
* @param string The charset of article. Ie: "iso-8859-1"
|
|
|
|
|
121 |
*/
|
122 |
public function withCharset($charset)
|
123 |
{
|
@@ -130,7 +134,9 @@ class InstantArticle extends Element
|
|
130 |
/**
|
131 |
* Sets the style to be applied to this Instant Article
|
132 |
*
|
133 |
-
* @param string Name of the style
|
|
|
|
|
134 |
*/
|
135 |
public function withStyle($style)
|
136 |
{
|
@@ -160,7 +166,10 @@ class InstantArticle extends Element
|
|
160 |
|
161 |
/**
|
162 |
* Sets the header content to this InstantArticle
|
163 |
-
*
|
|
|
|
|
|
|
164 |
*/
|
165 |
public function withHeader($header)
|
166 |
{
|
@@ -172,7 +181,10 @@ class InstantArticle extends Element
|
|
172 |
|
173 |
/**
|
174 |
* Sets the footer content to this InstantArticle
|
175 |
-
*
|
|
|
|
|
|
|
176 |
*/
|
177 |
public function withFooter($footer)
|
178 |
{
|
@@ -184,13 +196,16 @@ class InstantArticle extends Element
|
|
184 |
|
185 |
/**
|
186 |
* Adds new child elements to this InstantArticle
|
187 |
-
*
|
|
|
|
|
|
|
188 |
*/
|
189 |
public function addChild($child)
|
190 |
{
|
191 |
Type::enforce(
|
192 |
$child,
|
193 |
-
|
194 |
Ad::getClassName(),
|
195 |
Analytics::getClassName(),
|
196 |
AnimatedGIF::getClassName(),
|
@@ -208,7 +223,7 @@ class InstantArticle extends Element
|
|
208 |
Slideshow::getClassName(),
|
209 |
SocialEmbed::getClassName(),
|
210 |
Video::getClassName()
|
211 |
-
|
212 |
);
|
213 |
$this->children[] = $child;
|
214 |
|
@@ -241,9 +256,11 @@ class InstantArticle extends Element
|
|
241 |
|
242 |
/**
|
243 |
* Adds a meta property for the <head> of Instant Article.
|
|
|
244 |
* @param string $property_name name of meta attribute
|
245 |
* @param string $property_content content of meta attribute
|
246 |
-
*
|
|
|
247 |
*/
|
248 |
public function addMetaProperty($property_name, $property_content)
|
249 |
{
|
@@ -304,7 +321,7 @@ class InstantArticle extends Element
|
|
304 |
$article = $document->createElement('article');
|
305 |
$body->appendChild($article);
|
306 |
$html->appendChild($body);
|
307 |
-
if ($this->header) {
|
308 |
$article->appendChild($this->header->toDOMElement($document));
|
309 |
}
|
310 |
if ($this->children) {
|
@@ -312,8 +329,7 @@ class InstantArticle extends Element
|
|
312 |
if (Type::is($child, TextContainer::getClassName())) {
|
313 |
if (count($child->getTextChildren()) === 0) {
|
314 |
continue;
|
315 |
-
}
|
316 |
-
elseif (count($child->getTextChildren()) === 1) {
|
317 |
if (Type::is($child->getTextChildren()[0], Type::STRING) &&
|
318 |
trim($child->getTextChildren()[0]) === '') {
|
319 |
continue;
|
@@ -322,7 +338,7 @@ class InstantArticle extends Element
|
|
322 |
}
|
323 |
$article->appendChild($child->toDOMElement($document));
|
324 |
}
|
325 |
-
if ($this->footer) {
|
326 |
$article->appendChild($this->footer->toDOMElement($document));
|
327 |
}
|
328 |
} else {
|
@@ -339,4 +355,59 @@ class InstantArticle extends Element
|
|
339 |
$element->setAttribute('content', $property_content);
|
340 |
return $element;
|
341 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
}
|
31 |
* </html>
|
32 |
*
|
33 |
*/
|
34 |
+
class InstantArticle extends Element implements Container
|
35 |
{
|
36 |
+
const CURRENT_VERSION = '1.1.0';
|
37 |
|
38 |
/**
|
39 |
* The meta properties that are used on <head>
|
40 |
*/
|
41 |
+
private $metaProperties = [];
|
42 |
|
43 |
/**
|
44 |
* @var string The canonical URL for the Instant Article
|
66 |
private $style;
|
67 |
|
68 |
/**
|
69 |
+
* @var Header element to hold header content, like images etc
|
70 |
*/
|
71 |
private $header;
|
72 |
|
73 |
/**
|
74 |
+
* @var Footer element to hold footer content.
|
75 |
*/
|
76 |
private $footer;
|
77 |
|
78 |
/**
|
79 |
* @var Element[] of all elements an article can have.
|
80 |
*/
|
81 |
+
private $children = [];
|
82 |
|
83 |
/**
|
84 |
* Factory method
|
104 |
/**
|
105 |
* Sets the canonical URL for the Instant Article. It is REQUIRED.
|
106 |
*
|
107 |
+
* @param string $url The canonical url of article. Ie: http://domain.com/article.html
|
108 |
+
*
|
109 |
+
* @return $this
|
110 |
*/
|
111 |
public function withCanonicalURL($url)
|
112 |
{
|
119 |
/**
|
120 |
* Sets the charset for the Instant Article. utf-8 by default.
|
121 |
*
|
122 |
+
* @param string $charset The charset of article. Ie: "iso-8859-1"
|
123 |
+
*
|
124 |
+
* @return $this
|
125 |
*/
|
126 |
public function withCharset($charset)
|
127 |
{
|
134 |
/**
|
135 |
* Sets the style to be applied to this Instant Article
|
136 |
*
|
137 |
+
* @param string $style Name of the style
|
138 |
+
*
|
139 |
+
* @return $this
|
140 |
*/
|
141 |
public function withStyle($style)
|
142 |
{
|
166 |
|
167 |
/**
|
168 |
* Sets the header content to this InstantArticle
|
169 |
+
*
|
170 |
+
* @param Header $header to be added to this Article.
|
171 |
+
*
|
172 |
+
* @return $this
|
173 |
*/
|
174 |
public function withHeader($header)
|
175 |
{
|
181 |
|
182 |
/**
|
183 |
* Sets the footer content to this InstantArticle
|
184 |
+
*
|
185 |
+
* @param Footer $footer to be added to this Article.
|
186 |
+
*
|
187 |
+
* @return $this
|
188 |
*/
|
189 |
public function withFooter($footer)
|
190 |
{
|
196 |
|
197 |
/**
|
198 |
* Adds new child elements to this InstantArticle
|
199 |
+
*
|
200 |
+
* @param Element $child to be added to this Article.
|
201 |
+
*
|
202 |
+
* @return $this
|
203 |
*/
|
204 |
public function addChild($child)
|
205 |
{
|
206 |
Type::enforce(
|
207 |
$child,
|
208 |
+
[
|
209 |
Ad::getClassName(),
|
210 |
Analytics::getClassName(),
|
211 |
AnimatedGIF::getClassName(),
|
223 |
Slideshow::getClassName(),
|
224 |
SocialEmbed::getClassName(),
|
225 |
Video::getClassName()
|
226 |
+
]
|
227 |
);
|
228 |
$this->children[] = $child;
|
229 |
|
256 |
|
257 |
/**
|
258 |
* Adds a meta property for the <head> of Instant Article.
|
259 |
+
*
|
260 |
* @param string $property_name name of meta attribute
|
261 |
* @param string $property_content content of meta attribute
|
262 |
+
*
|
263 |
+
* @return $this
|
264 |
*/
|
265 |
public function addMetaProperty($property_name, $property_content)
|
266 |
{
|
321 |
$article = $document->createElement('article');
|
322 |
$body->appendChild($article);
|
323 |
$html->appendChild($body);
|
324 |
+
if ($this->header && $this->header->isValid()) {
|
325 |
$article->appendChild($this->header->toDOMElement($document));
|
326 |
}
|
327 |
if ($this->children) {
|
329 |
if (Type::is($child, TextContainer::getClassName())) {
|
330 |
if (count($child->getTextChildren()) === 0) {
|
331 |
continue;
|
332 |
+
} elseif (count($child->getTextChildren()) === 1) {
|
|
|
333 |
if (Type::is($child->getTextChildren()[0], Type::STRING) &&
|
334 |
trim($child->getTextChildren()[0]) === '') {
|
335 |
continue;
|
338 |
}
|
339 |
$article->appendChild($child->toDOMElement($document));
|
340 |
}
|
341 |
+
if ($this->footer && $this->footer->isValid()) {
|
342 |
$article->appendChild($this->footer->toDOMElement($document));
|
343 |
}
|
344 |
} else {
|
355 |
$element->setAttribute('content', $property_content);
|
356 |
return $element;
|
357 |
}
|
358 |
+
|
359 |
+
public function isValid()
|
360 |
+
{
|
361 |
+
$header_valid = false;
|
362 |
+
if ($this->getHeader()) {
|
363 |
+
$header_valid = $this->getHeader()->isValid();
|
364 |
+
}
|
365 |
+
|
366 |
+
$items = $this->getChildren();
|
367 |
+
$one_item_valid = false;
|
368 |
+
if ($items) {
|
369 |
+
foreach ($items as $item) {
|
370 |
+
if ($item->isValid()) {
|
371 |
+
$one_item_valid = true;
|
372 |
+
break;
|
373 |
+
}
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
$footer_valid = true;
|
378 |
+
if ($this->getFooter()) {
|
379 |
+
$footer_valid = $this->getFooter()->isValid();
|
380 |
+
}
|
381 |
+
|
382 |
+
return
|
383 |
+
$this->canonicalURL &&
|
384 |
+
!Type::isTextEmpty($this->canonicalURL) &&
|
385 |
+
$header_valid &&
|
386 |
+
$footer_valid &&
|
387 |
+
$one_item_valid;
|
388 |
+
}
|
389 |
+
|
390 |
+
public function getContainerChildren()
|
391 |
+
{
|
392 |
+
$children = array();
|
393 |
+
|
394 |
+
$header = $this->getHeader();
|
395 |
+
if ($header) {
|
396 |
+
$children[] = $header;
|
397 |
+
}
|
398 |
+
|
399 |
+
$items = $this->getChildren();
|
400 |
+
if ($items) {
|
401 |
+
foreach ($items as $item) {
|
402 |
+
$children[] = $item;
|
403 |
+
}
|
404 |
+
}
|
405 |
+
|
406 |
+
$footer = $this->getFooter();
|
407 |
+
if ($footer) {
|
408 |
+
$children[] = $footer;
|
409 |
+
}
|
410 |
+
|
411 |
+
return $children;
|
412 |
+
}
|
413 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Interactive.php
CHANGED
@@ -21,7 +21,7 @@ use Facebook\InstantArticles\Validators\Type;
|
|
21 |
*
|
22 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/interactive}
|
23 |
*/
|
24 |
-
class Interactive extends Element
|
25 |
{
|
26 |
const NO_MARGIN = 'no-margin';
|
27 |
const COLUMN_WIDTH = 'column-width';
|
@@ -66,6 +66,8 @@ class Interactive extends Element
|
|
66 |
* Sets the caption for the social embed.
|
67 |
*
|
68 |
* @param Caption $caption - Descriptive text for your social embed.
|
|
|
|
|
69 |
*/
|
70 |
public function withCaption($caption)
|
71 |
{
|
@@ -78,7 +80,9 @@ class Interactive extends Element
|
|
78 |
/**
|
79 |
* Sets the height of your interactive graphic.
|
80 |
*
|
81 |
-
* @param int The height of your interactive graphic.
|
|
|
|
|
82 |
*/
|
83 |
public function withHeight($height)
|
84 |
{
|
@@ -91,7 +95,9 @@ class Interactive extends Element
|
|
91 |
/**
|
92 |
* Sets the source for the interactive graphic.
|
93 |
*
|
94 |
-
* @param string The source of the content for your interactive graphic.
|
|
|
|
|
95 |
*/
|
96 |
public function withSource($source)
|
97 |
{
|
@@ -104,18 +110,21 @@ class Interactive extends Element
|
|
104 |
/**
|
105 |
* Sets the width setting of your interactive graphic.
|
106 |
*
|
107 |
-
* @param string The width setting of your interactive graphic.
|
|
|
108 |
* @see Interactive::NO_MARGIN
|
109 |
* @see Interactive::COLUMN_WIDTH
|
|
|
|
|
110 |
*/
|
111 |
public function withWidth($width)
|
112 |
{
|
113 |
Type::enforceWithin(
|
114 |
$width,
|
115 |
-
|
116 |
Interactive::NO_MARGIN,
|
117 |
Interactive::COLUMN_WIDTH
|
118 |
-
|
119 |
);
|
120 |
$this->width = $width;
|
121 |
|
@@ -125,7 +134,9 @@ class Interactive extends Element
|
|
125 |
/**
|
126 |
* Sets the unescaped HTML of your interactive graphic.
|
127 |
*
|
128 |
-
* @param \DOMNode The unescaped HTML of your interactive graphic.
|
|
|
|
|
129 |
*/
|
130 |
public function withHTML($html)
|
131 |
{
|
@@ -178,13 +189,20 @@ class Interactive extends Element
|
|
178 |
/**
|
179 |
* Structure and create the full Interactive in a DOMElement.
|
180 |
*
|
181 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
182 |
*/
|
183 |
public function toDOMElement($document = null)
|
184 |
{
|
185 |
if (!$document) {
|
186 |
$document = new \DOMDocument();
|
187 |
}
|
|
|
|
|
|
|
|
|
|
|
188 |
$figure = $document->createElement('figure');
|
189 |
$iframe = $document->createElement('iframe');
|
190 |
|
@@ -219,4 +237,30 @@ class Interactive extends Element
|
|
219 |
|
220 |
return $figure;
|
221 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
}
|
21 |
*
|
22 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/interactive}
|
23 |
*/
|
24 |
+
class Interactive extends Element implements Container
|
25 |
{
|
26 |
const NO_MARGIN = 'no-margin';
|
27 |
const COLUMN_WIDTH = 'column-width';
|
66 |
* Sets the caption for the social embed.
|
67 |
*
|
68 |
* @param Caption $caption - Descriptive text for your social embed.
|
69 |
+
*
|
70 |
+
* @return $this
|
71 |
*/
|
72 |
public function withCaption($caption)
|
73 |
{
|
80 |
/**
|
81 |
* Sets the height of your interactive graphic.
|
82 |
*
|
83 |
+
* @param int $height The height of your interactive graphic.
|
84 |
+
*
|
85 |
+
* @return $this
|
86 |
*/
|
87 |
public function withHeight($height)
|
88 |
{
|
95 |
/**
|
96 |
* Sets the source for the interactive graphic.
|
97 |
*
|
98 |
+
* @param string $source The source of the content for your interactive graphic.
|
99 |
+
*
|
100 |
+
* @return $this
|
101 |
*/
|
102 |
public function withSource($source)
|
103 |
{
|
110 |
/**
|
111 |
* Sets the width setting of your interactive graphic.
|
112 |
*
|
113 |
+
* @param string $width The width setting of your interactive graphic.
|
114 |
+
*
|
115 |
* @see Interactive::NO_MARGIN
|
116 |
* @see Interactive::COLUMN_WIDTH
|
117 |
+
*
|
118 |
+
* @return $this
|
119 |
*/
|
120 |
public function withWidth($width)
|
121 |
{
|
122 |
Type::enforceWithin(
|
123 |
$width,
|
124 |
+
[
|
125 |
Interactive::NO_MARGIN,
|
126 |
Interactive::COLUMN_WIDTH
|
127 |
+
]
|
128 |
);
|
129 |
$this->width = $width;
|
130 |
|
134 |
/**
|
135 |
* Sets the unescaped HTML of your interactive graphic.
|
136 |
*
|
137 |
+
* @param \DOMNode $html The unescaped HTML of your interactive graphic.
|
138 |
+
*
|
139 |
+
* @return $this
|
140 |
*/
|
141 |
public function withHTML($html)
|
142 |
{
|
189 |
/**
|
190 |
* Structure and create the full Interactive in a DOMElement.
|
191 |
*
|
192 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
193 |
+
*
|
194 |
+
* @return \DOMElement
|
195 |
*/
|
196 |
public function toDOMElement($document = null)
|
197 |
{
|
198 |
if (!$document) {
|
199 |
$document = new \DOMDocument();
|
200 |
}
|
201 |
+
|
202 |
+
if (!$this->isValid()) {
|
203 |
+
return $this->emptyElement($document);
|
204 |
+
}
|
205 |
+
|
206 |
$figure = $document->createElement('figure');
|
207 |
$iframe = $document->createElement('iframe');
|
208 |
|
237 |
|
238 |
return $figure;
|
239 |
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Overrides the Element::isValid().
|
243 |
+
*
|
244 |
+
* @see Element::isValid().
|
245 |
+
* @return true for valid Interactive that contains valid source or html, false otherwise.
|
246 |
+
*/
|
247 |
+
public function isValid()
|
248 |
+
{
|
249 |
+
return !Type::isTextEmpty($this->source) || $this->html;
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Implements the Container::getContainerChildren().
|
254 |
+
*
|
255 |
+
* @see Container::getContainerChildren().
|
256 |
+
* @return array of Elements contained by Image.
|
257 |
+
*/
|
258 |
+
public function getContainerChildren()
|
259 |
+
{
|
260 |
+
$children = array();
|
261 |
+
if ($this->caption) {
|
262 |
+
$children[] = $this->caption;
|
263 |
+
}
|
264 |
+
return $children;
|
265 |
+
}
|
266 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Italic.php
CHANGED
@@ -28,13 +28,20 @@ class Italic extends FormattedText
|
|
28 |
/**
|
29 |
* Structure and create <i> node.
|
30 |
*
|
31 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
32 |
*/
|
33 |
public function toDOMElement($document = null)
|
34 |
{
|
35 |
if (!$document) {
|
36 |
$document = new \DOMDocument();
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
38 |
$italic = $document->createElement('i');
|
39 |
|
40 |
$italic->appendChild($this->textToDOMDocumentFragment($document));
|
28 |
/**
|
29 |
* Structure and create <i> node.
|
30 |
*
|
31 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
32 |
+
*
|
33 |
+
* @return \DOMElement
|
34 |
*/
|
35 |
public function toDOMElement($document = null)
|
36 |
{
|
37 |
if (!$document) {
|
38 |
$document = new \DOMDocument();
|
39 |
}
|
40 |
+
|
41 |
+
if (!$this->isValid()) {
|
42 |
+
return $this->emptyElement($document);
|
43 |
+
}
|
44 |
+
|
45 |
$italic = $document->createElement('i');
|
46 |
|
47 |
$italic->appendChild($this->textToDOMDocumentFragment($document));
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/LineBreak.php
CHANGED
@@ -15,11 +15,13 @@ namespace Facebook\InstantArticles\Elements;
|
|
15 |
*/
|
16 |
class LineBreak extends FormattedText
|
17 |
{
|
18 |
-
|
19 |
private function __construct()
|
20 |
{
|
21 |
}
|
22 |
|
|
|
|
|
|
|
23 |
public static function create()
|
24 |
{
|
25 |
return new self();
|
@@ -33,15 +35,32 @@ class LineBreak extends FormattedText
|
|
33 |
/**
|
34 |
* Structure and create <b> node.
|
35 |
*
|
36 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
37 |
*/
|
38 |
public function toDOMElement($document = null)
|
39 |
{
|
40 |
if (!$document) {
|
41 |
$document = new \DOMDocument();
|
42 |
}
|
|
|
|
|
|
|
|
|
|
|
43 |
$br = $document->createElement('br');
|
44 |
|
45 |
return $br;
|
46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
15 |
*/
|
16 |
class LineBreak extends FormattedText
|
17 |
{
|
|
|
18 |
private function __construct()
|
19 |
{
|
20 |
}
|
21 |
|
22 |
+
/**
|
23 |
+
* @return LineBreak
|
24 |
+
*/
|
25 |
public static function create()
|
26 |
{
|
27 |
return new self();
|
35 |
/**
|
36 |
* Structure and create <b> node.
|
37 |
*
|
38 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
39 |
+
*
|
40 |
+
* @return \DOMElement
|
41 |
*/
|
42 |
public function toDOMElement($document = null)
|
43 |
{
|
44 |
if (!$document) {
|
45 |
$document = new \DOMDocument();
|
46 |
}
|
47 |
+
|
48 |
+
if (!$this->isValid()) {
|
49 |
+
return $this->emptyElement($document);
|
50 |
+
}
|
51 |
+
|
52 |
$br = $document->createElement('br');
|
53 |
|
54 |
return $br;
|
55 |
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Overrides the TextContainer::isValid() to a always valid one, since
|
59 |
+
* <br> tag will never be "invalid".
|
60 |
+
* @see TextContainer::isValid().
|
61 |
+
*/
|
62 |
+
public function isValid()
|
63 |
+
{
|
64 |
+
return true;
|
65 |
+
}
|
66 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ListElement.php
CHANGED
@@ -27,7 +27,7 @@ use Facebook\InstantArticles\Validators\Type;
|
|
27 |
* <li>Sleep</li>
|
28 |
* </ol>
|
29 |
*/
|
30 |
-
class ListElement extends Element
|
31 |
{
|
32 |
/**
|
33 |
* @var boolean Checks if it is ordered or unordered
|
@@ -37,18 +37,15 @@ class ListElement extends Element
|
|
37 |
/**
|
38 |
* @var ListItem[] Items of the list
|
39 |
*/
|
40 |
-
private $items =
|
41 |
|
42 |
-
/**
|
43 |
-
* Private constructor.
|
44 |
-
* @see List::createOrdered() and @see List::createUnordered().
|
45 |
-
*/
|
46 |
private function __construct()
|
47 |
{
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* Factory method for an Ordered list
|
|
|
52 |
* @return ListElement the new instance List as an ordered list
|
53 |
*/
|
54 |
public static function createOrdered()
|
@@ -60,7 +57,8 @@ class ListElement extends Element
|
|
60 |
}
|
61 |
|
62 |
/**
|
63 |
-
* Factory method for an
|
|
|
64 |
* @return ListElement the new instance List as an unordered list
|
65 |
*/
|
66 |
public static function createUnordered()
|
@@ -74,11 +72,13 @@ class ListElement extends Element
|
|
74 |
/**
|
75 |
* Adds a new item to the List
|
76 |
*
|
77 |
-
* @param ListItem The new item that will be pushed to the end of the list
|
|
|
|
|
78 |
*/
|
79 |
public function addItem($new_item)
|
80 |
{
|
81 |
-
Type::enforce($new_item,
|
82 |
if (Type::is($new_item, Type::STRING)) {
|
83 |
$new_item = ListItem::create()->appendText($new_item);
|
84 |
}
|
@@ -90,11 +90,13 @@ class ListElement extends Element
|
|
90 |
/**
|
91 |
* Sets all items of the list as the array on the parameter
|
92 |
*
|
93 |
-
* @param ListItem[] The new items. Replaces all items from the list
|
|
|
|
|
94 |
*/
|
95 |
public function withItems($new_items)
|
96 |
{
|
97 |
-
Type::enforceArrayOf($new_items,
|
98 |
foreach ($new_items as $new_item) {
|
99 |
$this->addItem($new_item);
|
100 |
}
|
@@ -104,6 +106,8 @@ class ListElement extends Element
|
|
104 |
|
105 |
/**
|
106 |
* Makes the list become ordered
|
|
|
|
|
107 |
*/
|
108 |
public function enableOrdered()
|
109 |
{
|
@@ -114,6 +118,8 @@ class ListElement extends Element
|
|
114 |
|
115 |
/**
|
116 |
* Makes the list become unordered
|
|
|
|
|
117 |
*/
|
118 |
public function disableOrdered()
|
119 |
{
|
@@ -123,15 +129,7 @@ class ListElement extends Element
|
|
123 |
}
|
124 |
|
125 |
/**
|
126 |
-
*
|
127 |
-
*/
|
128 |
-
private static function startsWith($haystack, $needle)
|
129 |
-
{
|
130 |
-
return substr($haystack, 0, strlen($needle)) === $needle;
|
131 |
-
}
|
132 |
-
|
133 |
-
/**
|
134 |
-
* @return string[] the list text items
|
135 |
*/
|
136 |
public function getItems()
|
137 |
{
|
@@ -149,7 +147,9 @@ class ListElement extends Element
|
|
149 |
/**
|
150 |
* Structure and create the full Video in a XML format DOMElement.
|
151 |
*
|
152 |
-
* @param $document
|
|
|
|
|
153 |
*/
|
154 |
public function toDOMElement($document = null)
|
155 |
{
|
@@ -157,6 +157,10 @@ class ListElement extends Element
|
|
157 |
$document = new \DOMDocument();
|
158 |
}
|
159 |
|
|
|
|
|
|
|
|
|
160 |
if ($this->isOrdered) {
|
161 |
$element = $document->createElement('ol');
|
162 |
} else {
|
@@ -173,4 +177,37 @@ class ListElement extends Element
|
|
173 |
|
174 |
return $element;
|
175 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
}
|
27 |
* <li>Sleep</li>
|
28 |
* </ol>
|
29 |
*/
|
30 |
+
class ListElement extends Element implements Container
|
31 |
{
|
32 |
/**
|
33 |
* @var boolean Checks if it is ordered or unordered
|
37 |
/**
|
38 |
* @var ListItem[] Items of the list
|
39 |
*/
|
40 |
+
private $items = [];
|
41 |
|
|
|
|
|
|
|
|
|
42 |
private function __construct()
|
43 |
{
|
44 |
}
|
45 |
|
46 |
/**
|
47 |
* Factory method for an Ordered list
|
48 |
+
*
|
49 |
* @return ListElement the new instance List as an ordered list
|
50 |
*/
|
51 |
public static function createOrdered()
|
57 |
}
|
58 |
|
59 |
/**
|
60 |
+
* Factory method for an unordered list
|
61 |
+
*
|
62 |
* @return ListElement the new instance List as an unordered list
|
63 |
*/
|
64 |
public static function createUnordered()
|
72 |
/**
|
73 |
* Adds a new item to the List
|
74 |
*
|
75 |
+
* @param string|ListItem $new_item The new item that will be pushed to the end of the list
|
76 |
+
*
|
77 |
+
* @return $this
|
78 |
*/
|
79 |
public function addItem($new_item)
|
80 |
{
|
81 |
+
Type::enforce($new_item, [ListItem::getClassName(), Type::STRING]);
|
82 |
if (Type::is($new_item, Type::STRING)) {
|
83 |
$new_item = ListItem::create()->appendText($new_item);
|
84 |
}
|
90 |
/**
|
91 |
* Sets all items of the list as the array on the parameter
|
92 |
*
|
93 |
+
* @param string|[]ListItem[] $new_items The new items. Replaces all items from the list
|
94 |
+
*
|
95 |
+
* @return $this
|
96 |
*/
|
97 |
public function withItems($new_items)
|
98 |
{
|
99 |
+
Type::enforceArrayOf($new_items, [ListItem::getClassName(), Type::STRING]);
|
100 |
foreach ($new_items as $new_item) {
|
101 |
$this->addItem($new_item);
|
102 |
}
|
106 |
|
107 |
/**
|
108 |
* Makes the list become ordered
|
109 |
+
*
|
110 |
+
* @return $this
|
111 |
*/
|
112 |
public function enableOrdered()
|
113 |
{
|
118 |
|
119 |
/**
|
120 |
* Makes the list become unordered
|
121 |
+
*
|
122 |
+
* @return $this
|
123 |
*/
|
124 |
public function disableOrdered()
|
125 |
{
|
129 |
}
|
130 |
|
131 |
/**
|
132 |
+
* @return string[]|ListItem[] the list text items
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
*/
|
134 |
public function getItems()
|
135 |
{
|
147 |
/**
|
148 |
* Structure and create the full Video in a XML format DOMElement.
|
149 |
*
|
150 |
+
* @param \DOMDocument $document where this element will be appended. Optional
|
151 |
+
*
|
152 |
+
* @return \DOMElement
|
153 |
*/
|
154 |
public function toDOMElement($document = null)
|
155 |
{
|
157 |
$document = new \DOMDocument();
|
158 |
}
|
159 |
|
160 |
+
if (!$this->isValid()) {
|
161 |
+
return $this->emptyElement($document);
|
162 |
+
}
|
163 |
+
|
164 |
if ($this->isOrdered) {
|
165 |
$element = $document->createElement('ol');
|
166 |
} else {
|
177 |
|
178 |
return $element;
|
179 |
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Overrides the Element::isValid().
|
183 |
+
*
|
184 |
+
* @see Element::isValid().
|
185 |
+
* @return true for valid ListElement that contains at least one ListItem's valid, false otherwise.
|
186 |
+
*/
|
187 |
+
public function isValid()
|
188 |
+
{
|
189 |
+
foreach ($this->items as $item) {
|
190 |
+
if ($item->isValid()) {
|
191 |
+
return true;
|
192 |
+
}
|
193 |
+
}
|
194 |
+
return false;
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Implements the Container::getContainerChildren().
|
199 |
+
*
|
200 |
+
* @see Container::getContainerChildren().
|
201 |
+
* @return array of Elements contained by Image.
|
202 |
+
*/
|
203 |
+
public function getContainerChildren()
|
204 |
+
{
|
205 |
+
$children = array();
|
206 |
+
if ($this->items) {
|
207 |
+
foreach ($this->items as $item) {
|
208 |
+
$children[] = $item;
|
209 |
+
}
|
210 |
+
}
|
211 |
+
return $children;
|
212 |
+
}
|
213 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/ListItem.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
/**
|
13 |
* Class List that represents a simple HTML list
|
14 |
*
|
@@ -17,11 +16,13 @@ namespace Facebook\InstantArticles\Elements;
|
|
17 |
*/
|
18 |
class ListItem extends TextContainer
|
19 |
{
|
20 |
-
|
21 |
private function __construct()
|
22 |
{
|
23 |
}
|
24 |
|
|
|
|
|
|
|
25 |
public static function create()
|
26 |
{
|
27 |
return new self();
|
@@ -30,13 +31,20 @@ class ListItem extends TextContainer
|
|
30 |
/**
|
31 |
* Structure and create the full ListItem <li> in a DOMElement.
|
32 |
*
|
33 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
34 |
*/
|
35 |
public function toDOMElement($document = null)
|
36 |
{
|
37 |
if (!$document) {
|
38 |
$document = new \DOMDocument();
|
39 |
}
|
|
|
|
|
|
|
|
|
|
|
40 |
$list_item = $document->createElement('li');
|
41 |
|
42 |
$list_item->appendChild($this->textToDOMDocumentFragment($document));
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
/**
|
12 |
* Class List that represents a simple HTML list
|
13 |
*
|
16 |
*/
|
17 |
class ListItem extends TextContainer
|
18 |
{
|
|
|
19 |
private function __construct()
|
20 |
{
|
21 |
}
|
22 |
|
23 |
+
/**
|
24 |
+
* @return ListItem
|
25 |
+
*/
|
26 |
public static function create()
|
27 |
{
|
28 |
return new self();
|
31 |
/**
|
32 |
* Structure and create the full ListItem <li> in a DOMElement.
|
33 |
*
|
34 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
35 |
+
*
|
36 |
+
* @return \DOMElement
|
37 |
*/
|
38 |
public function toDOMElement($document = null)
|
39 |
{
|
40 |
if (!$document) {
|
41 |
$document = new \DOMDocument();
|
42 |
}
|
43 |
+
|
44 |
+
if (!$this->isValid()) {
|
45 |
+
return $this->emptyElement($document);
|
46 |
+
}
|
47 |
+
|
48 |
$list_item = $document->createElement('li');
|
49 |
|
50 |
$list_item->appendChild($this->textToDOMDocumentFragment($document));
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Map.php
CHANGED
@@ -34,10 +34,10 @@ use Facebook\InstantArticles\Validators\Type;
|
|
34 |
* </figure>
|
35 |
*
|
36 |
*/
|
37 |
-
class Map extends Audible
|
38 |
{
|
39 |
/**
|
40 |
-
* @var
|
41 |
*/
|
42 |
private $caption;
|
43 |
|
@@ -51,16 +51,13 @@ class Map extends Audible
|
|
51 |
*/
|
52 |
private $audio;
|
53 |
|
54 |
-
/**
|
55 |
-
* Private constructor.
|
56 |
-
* @see Map::create();.
|
57 |
-
*/
|
58 |
private function __construct()
|
59 |
{
|
60 |
}
|
61 |
|
62 |
/**
|
63 |
* Factory method for the Map
|
|
|
64 |
* @return Map the new instance
|
65 |
*/
|
66 |
public static function create()
|
@@ -70,9 +67,12 @@ class Map extends Audible
|
|
70 |
|
71 |
/**
|
72 |
* This sets figcaption tag as documentation. It overrides all sets
|
73 |
-
* made with
|
74 |
*
|
75 |
-
* @
|
|
|
|
|
|
|
76 |
*/
|
77 |
public function withCaption($caption)
|
78 |
{
|
@@ -84,8 +84,12 @@ class Map extends Audible
|
|
84 |
|
85 |
/**
|
86 |
* Sets the geoTag on the image.
|
87 |
-
*
|
|
|
|
|
88 |
* @see {link:http://geojson.org/}
|
|
|
|
|
89 |
*/
|
90 |
public function withGeoTag($geo_tag)
|
91 |
{
|
@@ -98,7 +102,9 @@ class Map extends Audible
|
|
98 |
/**
|
99 |
* Adds audio to this image.
|
100 |
*
|
101 |
-
* @param Audio The audio object
|
|
|
|
|
102 |
*/
|
103 |
public function withAudio($audio)
|
104 |
{
|
@@ -135,13 +141,20 @@ class Map extends Audible
|
|
135 |
/**
|
136 |
* Structure and create the full Map in a XML format DOMElement.
|
137 |
*
|
138 |
-
* @param $document
|
|
|
|
|
139 |
*/
|
140 |
public function toDOMElement($document = null)
|
141 |
{
|
142 |
if (!$document) {
|
143 |
$document = new \DOMDocument();
|
144 |
}
|
|
|
|
|
|
|
|
|
|
|
145 |
$element = $document->createElement('figure');
|
146 |
$element->setAttribute('class', 'op-map');
|
147 |
|
@@ -149,12 +162,6 @@ class Map extends Audible
|
|
149 |
if ($this->geoTag) {
|
150 |
$element->appendChild($this->geoTag->toDOMElement($document));
|
151 |
}
|
152 |
-
// $script_element = $document->createElement('script');
|
153 |
-
// $script_element->setAttribute('type', 'application/json');
|
154 |
-
// $script_element->setAttribute('class', 'op-geoTag');
|
155 |
-
// $script_element->appendChild($document->createTextNode($this->geoTag));
|
156 |
-
// $element->appendChild($script_element);
|
157 |
-
|
158 |
|
159 |
// Caption markup optional
|
160 |
if ($this->caption) {
|
@@ -168,4 +175,42 @@ class Map extends Audible
|
|
168 |
|
169 |
return $element;
|
170 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
}
|
34 |
* </figure>
|
35 |
*
|
36 |
*/
|
37 |
+
class Map extends Audible implements Container
|
38 |
{
|
39 |
/**
|
40 |
+
* @var Caption The caption for Image
|
41 |
*/
|
42 |
private $caption;
|
43 |
|
51 |
*/
|
52 |
private $audio;
|
53 |
|
|
|
|
|
|
|
|
|
54 |
private function __construct()
|
55 |
{
|
56 |
}
|
57 |
|
58 |
/**
|
59 |
* Factory method for the Map
|
60 |
+
*
|
61 |
* @return Map the new instance
|
62 |
*/
|
63 |
public static function create()
|
67 |
|
68 |
/**
|
69 |
* This sets figcaption tag as documentation. It overrides all sets
|
70 |
+
* made with Caption.
|
71 |
*
|
72 |
+
* @see Caption.
|
73 |
+
* @param Caption $caption the caption the map will have
|
74 |
+
*
|
75 |
+
* @return $this
|
76 |
*/
|
77 |
public function withCaption($caption)
|
78 |
{
|
84 |
|
85 |
/**
|
86 |
* Sets the geoTag on the image.
|
87 |
+
*
|
88 |
+
* @param GeoTag $geo_tag The tag to be set on the map object
|
89 |
+
*
|
90 |
* @see {link:http://geojson.org/}
|
91 |
+
*
|
92 |
+
* @return $this
|
93 |
*/
|
94 |
public function withGeoTag($geo_tag)
|
95 |
{
|
102 |
/**
|
103 |
* Adds audio to this image.
|
104 |
*
|
105 |
+
* @param Audio $audio The audio object
|
106 |
+
*
|
107 |
+
* @return $this
|
108 |
*/
|
109 |
public function withAudio($audio)
|
110 |
{
|
141 |
/**
|
142 |
* Structure and create the full Map in a XML format DOMElement.
|
143 |
*
|
144 |
+
* @param \DOMDocument $document where this element will be appended. Optional
|
145 |
+
*
|
146 |
+
* @return \DOMElement
|
147 |
*/
|
148 |
public function toDOMElement($document = null)
|
149 |
{
|
150 |
if (!$document) {
|
151 |
$document = new \DOMDocument();
|
152 |
}
|
153 |
+
|
154 |
+
if (!$this->isValid()) {
|
155 |
+
return $this->emptyElement($document);
|
156 |
+
}
|
157 |
+
|
158 |
$element = $document->createElement('figure');
|
159 |
$element->setAttribute('class', 'op-map');
|
160 |
|
162 |
if ($this->geoTag) {
|
163 |
$element->appendChild($this->geoTag->toDOMElement($document));
|
164 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
|
166 |
// Caption markup optional
|
167 |
if ($this->caption) {
|
175 |
|
176 |
return $element;
|
177 |
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Overrides the Element::isValid().
|
181 |
+
*
|
182 |
+
* @see Element::isValid().
|
183 |
+
* @return true for valid Map that contains valid GeoTag, false otherwise.
|
184 |
+
*/
|
185 |
+
public function isValid()
|
186 |
+
{
|
187 |
+
return $this->geoTag && $this->geoTag->isValid();
|
188 |
+
}
|
189 |
+
|
190 |
+
/**
|
191 |
+
* Implements the Container::getContainerChildren().
|
192 |
+
*
|
193 |
+
* @see Container::getContainerChildren().
|
194 |
+
* @return array of Elements contained by Image.
|
195 |
+
*/
|
196 |
+
public function getContainerChildren()
|
197 |
+
{
|
198 |
+
$children = array();
|
199 |
+
|
200 |
+
if ($this->caption) {
|
201 |
+
$children[] = $this->caption;
|
202 |
+
}
|
203 |
+
|
204 |
+
// Geotag markup optional
|
205 |
+
if ($this->geoTag) {
|
206 |
+
$children[] = $this->geoTag;
|
207 |
+
}
|
208 |
+
|
209 |
+
// Audio markup optional
|
210 |
+
if ($this->audio) {
|
211 |
+
$children[] = $this->audio;
|
212 |
+
}
|
213 |
+
|
214 |
+
return $children;
|
215 |
+
}
|
216 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Paragraph.php
CHANGED
@@ -22,11 +22,13 @@ namespace Facebook\InstantArticles\Elements;
|
|
22 |
*/
|
23 |
class Paragraph extends TextContainer
|
24 |
{
|
25 |
-
|
26 |
private function __construct()
|
27 |
{
|
28 |
}
|
29 |
|
|
|
|
|
|
|
30 |
public static function create()
|
31 |
{
|
32 |
return new self();
|
@@ -35,13 +37,20 @@ class Paragraph extends TextContainer
|
|
35 |
/**
|
36 |
* Structure and create the full Paragraph in a DOMElement.
|
37 |
*
|
38 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
39 |
*/
|
40 |
public function toDOMElement($document = null)
|
41 |
{
|
42 |
if (!$document) {
|
43 |
$document = new \DOMDocument();
|
44 |
}
|
|
|
|
|
|
|
|
|
|
|
45 |
$paragraph = $document->createElement('p');
|
46 |
|
47 |
$paragraph->appendChild($this->textToDOMDocumentFragment($document));
|
22 |
*/
|
23 |
class Paragraph extends TextContainer
|
24 |
{
|
|
|
25 |
private function __construct()
|
26 |
{
|
27 |
}
|
28 |
|
29 |
+
/**
|
30 |
+
* @return Paragraph
|
31 |
+
*/
|
32 |
public static function create()
|
33 |
{
|
34 |
return new self();
|
37 |
/**
|
38 |
* Structure and create the full Paragraph in a DOMElement.
|
39 |
*
|
40 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
41 |
+
*
|
42 |
+
* @return \DOMElement
|
43 |
*/
|
44 |
public function toDOMElement($document = null)
|
45 |
{
|
46 |
if (!$document) {
|
47 |
$document = new \DOMDocument();
|
48 |
}
|
49 |
+
|
50 |
+
if (!$this->isValid()) {
|
51 |
+
return $this->emptyElement($document);
|
52 |
+
}
|
53 |
+
|
54 |
$paragraph = $document->createElement('p');
|
55 |
|
56 |
$paragraph->appendChild($this->textToDOMDocumentFragment($document));
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Pullquote.php
CHANGED
@@ -27,7 +27,6 @@ use Facebook\InstantArticles\Validators\Type;
|
|
27 |
*/
|
28 |
class Pullquote extends TextContainer
|
29 |
{
|
30 |
-
|
31 |
/**
|
32 |
* @var Cite Content that will be shown on <cite>...</cite> tags.
|
33 |
*/
|
@@ -37,6 +36,9 @@ class Pullquote extends TextContainer
|
|
37 |
{
|
38 |
}
|
39 |
|
|
|
|
|
|
|
40 |
public static function create()
|
41 |
{
|
42 |
return new self();
|
@@ -45,11 +47,13 @@ class Pullquote extends TextContainer
|
|
45 |
/**
|
46 |
* Sets the attribution string
|
47 |
*
|
48 |
-
* @param The attribution text
|
|
|
|
|
49 |
*/
|
50 |
public function withAttribution($attribution)
|
51 |
{
|
52 |
-
Type::enforce($attribution,
|
53 |
if (Type::is($attribution, Type::STRING)) {
|
54 |
$this->attribution = Cite::create()->appendText($attribution);
|
55 |
} else {
|
@@ -70,13 +74,20 @@ class Pullquote extends TextContainer
|
|
70 |
/**
|
71 |
* Structure and create the full Pullquote in a DOMElement.
|
72 |
*
|
73 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
74 |
*/
|
75 |
public function toDOMElement($document = null)
|
76 |
{
|
77 |
if (!$document) {
|
78 |
$document = new \DOMDocument();
|
79 |
}
|
|
|
|
|
|
|
|
|
|
|
80 |
$element = $document->createElement('aside');
|
81 |
|
82 |
$element->appendChild($this->textToDOMDocumentFragment($document));
|
27 |
*/
|
28 |
class Pullquote extends TextContainer
|
29 |
{
|
|
|
30 |
/**
|
31 |
* @var Cite Content that will be shown on <cite>...</cite> tags.
|
32 |
*/
|
36 |
{
|
37 |
}
|
38 |
|
39 |
+
/**
|
40 |
+
* @return Pullquote
|
41 |
+
*/
|
42 |
public static function create()
|
43 |
{
|
44 |
return new self();
|
47 |
/**
|
48 |
* Sets the attribution string
|
49 |
*
|
50 |
+
* @param string|Cite $attribution The attribution text
|
51 |
+
*
|
52 |
+
* @return $this
|
53 |
*/
|
54 |
public function withAttribution($attribution)
|
55 |
{
|
56 |
+
Type::enforce($attribution, [Type::STRING, Cite::getClassName()]);
|
57 |
if (Type::is($attribution, Type::STRING)) {
|
58 |
$this->attribution = Cite::create()->appendText($attribution);
|
59 |
} else {
|
74 |
/**
|
75 |
* Structure and create the full Pullquote in a DOMElement.
|
76 |
*
|
77 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
78 |
+
*
|
79 |
+
* @return \DOMElement
|
80 |
*/
|
81 |
public function toDOMElement($document = null)
|
82 |
{
|
83 |
if (!$document) {
|
84 |
$document = new \DOMDocument();
|
85 |
}
|
86 |
+
|
87 |
+
if (!$this->isValid()) {
|
88 |
+
return $this->emptyElement($document);
|
89 |
+
}
|
90 |
+
|
91 |
$element = $document->createElement('aside');
|
92 |
|
93 |
$element->appendChild($this->textToDOMDocumentFragment($document));
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/RelatedArticles.php
CHANGED
@@ -27,28 +27,25 @@ use Facebook\InstantArticles\Validators\Type;
|
|
27 |
* <li>Sleep</li>
|
28 |
* </ol>
|
29 |
*/
|
30 |
-
class RelatedArticles extends Element
|
31 |
{
|
32 |
/**
|
33 |
* @var RelatedItem[] The related Articles
|
34 |
*/
|
35 |
-
private $items =
|
36 |
|
37 |
/**
|
38 |
* @var string The title of the Related Articles content
|
39 |
*/
|
40 |
private $title;
|
41 |
|
42 |
-
/**
|
43 |
-
* Private constructor.
|
44 |
-
* @see List::create()
|
45 |
-
*/
|
46 |
private function __construct()
|
47 |
{
|
48 |
}
|
49 |
|
50 |
/**
|
51 |
* Factory method for the RelatedArticles list
|
|
|
52 |
* @return RelatedArticles the new instance of RelatedArticles
|
53 |
*/
|
54 |
public static function create()
|
@@ -58,7 +55,10 @@ class RelatedArticles extends Element
|
|
58 |
|
59 |
/**
|
60 |
* Adds a new related article item
|
61 |
-
*
|
|
|
|
|
|
|
62 |
*/
|
63 |
public function addRelated($item)
|
64 |
{
|
@@ -71,7 +71,9 @@ class RelatedArticles extends Element
|
|
71 |
/**
|
72 |
* Sets the title of Related articles content block
|
73 |
*
|
74 |
-
* @param string the name of related articles block
|
|
|
|
|
75 |
*/
|
76 |
public function withTitle($title)
|
77 |
{
|
@@ -100,7 +102,9 @@ class RelatedArticles extends Element
|
|
100 |
/**
|
101 |
* Structure and create the full ArticleVideo in a XML format DOMElement.
|
102 |
*
|
103 |
-
* @param $document
|
|
|
|
|
104 |
*/
|
105 |
public function toDOMElement($document = null)
|
106 |
{
|
@@ -108,6 +112,10 @@ class RelatedArticles extends Element
|
|
108 |
$document = new \DOMDocument();
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
111 |
$element = $document->createElement('ul');
|
112 |
$element->setAttribute('class', 'op-related-articles');
|
113 |
if ($this->title) {
|
@@ -122,4 +130,37 @@ class RelatedArticles extends Element
|
|
122 |
|
123 |
return $element;
|
124 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
}
|
27 |
* <li>Sleep</li>
|
28 |
* </ol>
|
29 |
*/
|
30 |
+
class RelatedArticles extends Element implements Container
|
31 |
{
|
32 |
/**
|
33 |
* @var RelatedItem[] The related Articles
|
34 |
*/
|
35 |
+
private $items = [];
|
36 |
|
37 |
/**
|
38 |
* @var string The title of the Related Articles content
|
39 |
*/
|
40 |
private $title;
|
41 |
|
|
|
|
|
|
|
|
|
42 |
private function __construct()
|
43 |
{
|
44 |
}
|
45 |
|
46 |
/**
|
47 |
* Factory method for the RelatedArticles list
|
48 |
+
*
|
49 |
* @return RelatedArticles the new instance of RelatedArticles
|
50 |
*/
|
51 |
public static function create()
|
55 |
|
56 |
/**
|
57 |
* Adds a new related article item
|
58 |
+
*
|
59 |
+
* @param RelatedItem $item The related article item
|
60 |
+
*
|
61 |
+
* @return $this
|
62 |
*/
|
63 |
public function addRelated($item)
|
64 |
{
|
71 |
/**
|
72 |
* Sets the title of Related articles content block
|
73 |
*
|
74 |
+
* @param string $title the name of related articles block
|
75 |
+
*
|
76 |
+
* @return $this
|
77 |
*/
|
78 |
public function withTitle($title)
|
79 |
{
|
102 |
/**
|
103 |
* Structure and create the full ArticleVideo in a XML format DOMElement.
|
104 |
*
|
105 |
+
* @param \DOMDocument $document where this element will be appended. Optional
|
106 |
+
*
|
107 |
+
* @return \DOMElement
|
108 |
*/
|
109 |
public function toDOMElement($document = null)
|
110 |
{
|
112 |
$document = new \DOMDocument();
|
113 |
}
|
114 |
|
115 |
+
if (!$this->isValid()) {
|
116 |
+
return $this->emptyElement($document);
|
117 |
+
}
|
118 |
+
|
119 |
$element = $document->createElement('ul');
|
120 |
$element->setAttribute('class', 'op-related-articles');
|
121 |
if ($this->title) {
|
130 |
|
131 |
return $element;
|
132 |
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Overrides the Element::isValid().
|
136 |
+
*
|
137 |
+
* @see Element::isValid().
|
138 |
+
* @return true for valid RelatedArticles that contains at least one RelatedItem's valid, false otherwise.
|
139 |
+
*/
|
140 |
+
public function isValid()
|
141 |
+
{
|
142 |
+
foreach ($this->items as $item) {
|
143 |
+
if ($item->isValid()) {
|
144 |
+
return true;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
return false;
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Implements the Container::getContainerChildren().
|
152 |
+
*
|
153 |
+
* @see Container::getContainerChildren().
|
154 |
+
* @return array of Elements contained by Image.
|
155 |
+
*/
|
156 |
+
public function getContainerChildren()
|
157 |
+
{
|
158 |
+
$children = array();
|
159 |
+
|
160 |
+
foreach ($this->items as $item) {
|
161 |
+
$children[] = $item;
|
162 |
+
}
|
163 |
+
|
164 |
+
return $children;
|
165 |
+
}
|
166 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/RelatedItem.php
CHANGED
@@ -11,7 +11,8 @@ namespace Facebook\InstantArticles\Elements;
|
|
11 |
use Facebook\InstantArticles\Validators\Type;
|
12 |
|
13 |
/**
|
14 |
-
* Class RelatedItem to represent each of the
|
|
|
15 |
*/
|
16 |
class RelatedItem extends Element
|
17 |
{
|
@@ -25,15 +26,14 @@ class RelatedItem extends Element
|
|
25 |
*/
|
26 |
private $sponsored;
|
27 |
|
28 |
-
/**
|
29 |
-
* Private constructor.
|
30 |
-
*/
|
31 |
private function __construct()
|
32 |
{
|
33 |
}
|
34 |
|
35 |
/**
|
36 |
* Factory method for the RelatedItem
|
|
|
|
|
37 |
*/
|
38 |
public static function create()
|
39 |
{
|
@@ -42,7 +42,10 @@ class RelatedItem extends Element
|
|
42 |
|
43 |
/**
|
44 |
* Sets the article URL
|
45 |
-
*
|
|
|
|
|
|
|
46 |
*/
|
47 |
public function withURL($url)
|
48 |
{
|
@@ -54,6 +57,8 @@ class RelatedItem extends Element
|
|
54 |
|
55 |
/**
|
56 |
* Makes this item to be an sponsored one
|
|
|
|
|
57 |
*/
|
58 |
public function enableSponsored()
|
59 |
{
|
@@ -64,6 +69,8 @@ class RelatedItem extends Element
|
|
64 |
|
65 |
/**
|
66 |
* Makes this item to *NOT* be an sponsored one
|
|
|
|
|
67 |
*/
|
68 |
public function disableSponsored()
|
69 |
{
|
@@ -91,7 +98,9 @@ class RelatedItem extends Element
|
|
91 |
/**
|
92 |
* Structure and create the full ArticleVideo in a XML format DOMElement.
|
93 |
*
|
94 |
-
* @param $document
|
|
|
|
|
95 |
*/
|
96 |
public function toDOMElement($document = null)
|
97 |
{
|
@@ -99,6 +108,10 @@ class RelatedItem extends Element
|
|
99 |
$document = new \DOMDocument();
|
100 |
}
|
101 |
|
|
|
|
|
|
|
|
|
102 |
$element = $document->createElement('li');
|
103 |
if ($this->sponsored) {
|
104 |
$element->setAttribute('data-sponsored', 'true');
|
@@ -107,7 +120,17 @@ class RelatedItem extends Element
|
|
107 |
Anchor::create()->withHref($this->url)->toDOMElement($document)
|
108 |
);
|
109 |
|
110 |
-
|
111 |
return $element;
|
112 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
11 |
use Facebook\InstantArticles\Validators\Type;
|
12 |
|
13 |
/**
|
14 |
+
* Class RelatedItem to represent each of the RelatedArticles.
|
15 |
+
* @see RelatedArticles
|
16 |
*/
|
17 |
class RelatedItem extends Element
|
18 |
{
|
26 |
*/
|
27 |
private $sponsored;
|
28 |
|
|
|
|
|
|
|
29 |
private function __construct()
|
30 |
{
|
31 |
}
|
32 |
|
33 |
/**
|
34 |
* Factory method for the RelatedItem
|
35 |
+
*
|
36 |
+
* @return RelatedItem
|
37 |
*/
|
38 |
public static function create()
|
39 |
{
|
42 |
|
43 |
/**
|
44 |
* Sets the article URL
|
45 |
+
*
|
46 |
+
* @param string $url The related article URL
|
47 |
+
*
|
48 |
+
* @return $this
|
49 |
*/
|
50 |
public function withURL($url)
|
51 |
{
|
57 |
|
58 |
/**
|
59 |
* Makes this item to be an sponsored one
|
60 |
+
*
|
61 |
+
* @return $this
|
62 |
*/
|
63 |
public function enableSponsored()
|
64 |
{
|
69 |
|
70 |
/**
|
71 |
* Makes this item to *NOT* be an sponsored one
|
72 |
+
*
|
73 |
+
* @return $this
|
74 |
*/
|
75 |
public function disableSponsored()
|
76 |
{
|
98 |
/**
|
99 |
* Structure and create the full ArticleVideo in a XML format DOMElement.
|
100 |
*
|
101 |
+
* @param \DOMDocument $document where this element will be appended. Optional
|
102 |
+
*
|
103 |
+
* @return \DOMElement
|
104 |
*/
|
105 |
public function toDOMElement($document = null)
|
106 |
{
|
108 |
$document = new \DOMDocument();
|
109 |
}
|
110 |
|
111 |
+
if (!$this->isValid()) {
|
112 |
+
return $this->emptyElement($document);
|
113 |
+
}
|
114 |
+
|
115 |
$element = $document->createElement('li');
|
116 |
if ($this->sponsored) {
|
117 |
$element->setAttribute('data-sponsored', 'true');
|
120 |
Anchor::create()->withHref($this->url)->toDOMElement($document)
|
121 |
);
|
122 |
|
|
|
123 |
return $element;
|
124 |
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Overrides the Element::isValid().
|
128 |
+
*
|
129 |
+
* @see Element::isValid().
|
130 |
+
* @return true for valid RelatedItem that contains valid url, false otherwise.
|
131 |
+
*/
|
132 |
+
public function isValid()
|
133 |
+
{
|
134 |
+
return !Type::isTextEmpty($this->url);
|
135 |
+
}
|
136 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Slideshow.php
CHANGED
@@ -29,7 +29,7 @@ use Facebook\InstantArticles\Validators\Type;
|
|
29 |
*
|
30 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/image}
|
31 |
*/
|
32 |
-
class Slideshow extends Audible
|
33 |
{
|
34 |
/**
|
35 |
* @var Caption The caption for the Slideshow
|
@@ -39,7 +39,7 @@ class Slideshow extends Audible
|
|
39 |
/**
|
40 |
* @var Image[] the images hosted on web that will be shown on the slideshow
|
41 |
*/
|
42 |
-
private $article_images =
|
43 |
|
44 |
/**
|
45 |
* @var string The json geotag content inside the script geotag
|
@@ -56,16 +56,13 @@ class Slideshow extends Audible
|
|
56 |
*/
|
57 |
private $attribution;
|
58 |
|
59 |
-
/**
|
60 |
-
* Private constructor.
|
61 |
-
* @see Slideshow::create();.
|
62 |
-
*/
|
63 |
private function __construct()
|
64 |
{
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
* Factory method for the Slideshow
|
|
|
69 |
* @return Slideshow the new instance
|
70 |
*/
|
71 |
public static function create()
|
@@ -75,9 +72,12 @@ class Slideshow extends Audible
|
|
75 |
|
76 |
/**
|
77 |
* This sets figcaption tag as documentation. It overrides all sets
|
78 |
-
* made with
|
79 |
*
|
80 |
-
* @
|
|
|
|
|
|
|
81 |
*/
|
82 |
public function withCaption($caption)
|
83 |
{
|
@@ -91,6 +91,8 @@ class Slideshow extends Audible
|
|
91 |
* Sets the Image list of images for the slideshow. It is REQUIRED.
|
92 |
*
|
93 |
* @param Image[] The images. Ie: http://domain.com/img.png
|
|
|
|
|
94 |
*/
|
95 |
public function withImages($article_images)
|
96 |
{
|
@@ -103,7 +105,9 @@ class Slideshow extends Audible
|
|
103 |
/**
|
104 |
* Adds a new image to the slideshow. It is REQUIRED.
|
105 |
*
|
106 |
-
* @param
|
|
|
|
|
107 |
*/
|
108 |
public function addImage($article_image)
|
109 |
{
|
@@ -117,6 +121,10 @@ class Slideshow extends Audible
|
|
117 |
* Sets the geotag on the slideshow.
|
118 |
*
|
119 |
* @see {link:http://geojson.org/}
|
|
|
|
|
|
|
|
|
120 |
*/
|
121 |
public function withMapGeoTag($json)
|
122 |
{
|
@@ -129,7 +137,9 @@ class Slideshow extends Audible
|
|
129 |
/**
|
130 |
* Adds audio to this slideshow.
|
131 |
*
|
132 |
-
* @param Audio The audio object
|
|
|
|
|
133 |
*/
|
134 |
public function withAudio($audio)
|
135 |
{
|
@@ -182,13 +192,20 @@ class Slideshow extends Audible
|
|
182 |
/**
|
183 |
* Structure and create the full Slideshow in a XML format DOMElement.
|
184 |
*
|
185 |
-
* @param $document
|
|
|
|
|
186 |
*/
|
187 |
public function toDOMElement($document = null)
|
188 |
{
|
189 |
if (!$document) {
|
190 |
$document = new \DOMDocument();
|
191 |
}
|
|
|
|
|
|
|
|
|
|
|
192 |
$element = $document->createElement('figure');
|
193 |
$element->setAttribute('class', 'op-slideshow');
|
194 |
|
@@ -221,4 +238,53 @@ class Slideshow extends Audible
|
|
221 |
|
222 |
return $element;
|
223 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
}
|
29 |
*
|
30 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/image}
|
31 |
*/
|
32 |
+
class Slideshow extends Audible implements Container
|
33 |
{
|
34 |
/**
|
35 |
* @var Caption The caption for the Slideshow
|
39 |
/**
|
40 |
* @var Image[] the images hosted on web that will be shown on the slideshow
|
41 |
*/
|
42 |
+
private $article_images = [];
|
43 |
|
44 |
/**
|
45 |
* @var string The json geotag content inside the script geotag
|
56 |
*/
|
57 |
private $attribution;
|
58 |
|
|
|
|
|
|
|
|
|
59 |
private function __construct()
|
60 |
{
|
61 |
}
|
62 |
|
63 |
/**
|
64 |
* Factory method for the Slideshow
|
65 |
+
*
|
66 |
* @return Slideshow the new instance
|
67 |
*/
|
68 |
public static function create()
|
72 |
|
73 |
/**
|
74 |
* This sets figcaption tag as documentation. It overrides all sets
|
75 |
+
* made with Caption.
|
76 |
*
|
77 |
+
* @see Caption.
|
78 |
+
* @param Caption $caption the caption the slideshow will have
|
79 |
+
*
|
80 |
+
* @return $this
|
81 |
*/
|
82 |
public function withCaption($caption)
|
83 |
{
|
91 |
* Sets the Image list of images for the slideshow. It is REQUIRED.
|
92 |
*
|
93 |
* @param Image[] The images. Ie: http://domain.com/img.png
|
94 |
+
*
|
95 |
+
* @return $this
|
96 |
*/
|
97 |
public function withImages($article_images)
|
98 |
{
|
105 |
/**
|
106 |
* Adds a new image to the slideshow. It is REQUIRED.
|
107 |
*
|
108 |
+
* @param Image $article_image The image.
|
109 |
+
*
|
110 |
+
* @return $this
|
111 |
*/
|
112 |
public function addImage($article_image)
|
113 |
{
|
121 |
* Sets the geotag on the slideshow.
|
122 |
*
|
123 |
* @see {link:http://geojson.org/}
|
124 |
+
*
|
125 |
+
* @param string $json
|
126 |
+
*
|
127 |
+
* @return $this
|
128 |
*/
|
129 |
public function withMapGeoTag($json)
|
130 |
{
|
137 |
/**
|
138 |
* Adds audio to this slideshow.
|
139 |
*
|
140 |
+
* @param Audio $audio The audio object
|
141 |
+
*
|
142 |
+
* @return $this
|
143 |
*/
|
144 |
public function withAudio($audio)
|
145 |
{
|
192 |
/**
|
193 |
* Structure and create the full Slideshow in a XML format DOMElement.
|
194 |
*
|
195 |
+
* @param \DOMDocument $document where this element will be appended. Optional
|
196 |
+
*
|
197 |
+
* @return \DOMElement
|
198 |
*/
|
199 |
public function toDOMElement($document = null)
|
200 |
{
|
201 |
if (!$document) {
|
202 |
$document = new \DOMDocument();
|
203 |
}
|
204 |
+
|
205 |
+
if (!$this->isValid()) {
|
206 |
+
return $this->emptyElement($document);
|
207 |
+
}
|
208 |
+
|
209 |
$element = $document->createElement('figure');
|
210 |
$element->setAttribute('class', 'op-slideshow');
|
211 |
|
238 |
|
239 |
return $element;
|
240 |
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Overrides the Element::isValid().
|
244 |
+
*
|
245 |
+
* @see Element::isValid().
|
246 |
+
* @return true for valid Slideshow that contains at least one Image valid, false otherwise.
|
247 |
+
*/
|
248 |
+
public function isValid()
|
249 |
+
{
|
250 |
+
foreach ($this->article_images as $item) {
|
251 |
+
if ($item->isValid()) {
|
252 |
+
return true;
|
253 |
+
}
|
254 |
+
}
|
255 |
+
return false;
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Implements the Container::getContainerChildren().
|
260 |
+
*
|
261 |
+
* @see Container::getContainerChildren().
|
262 |
+
* @return array of Elements contained by Image.
|
263 |
+
*/
|
264 |
+
public function getContainerChildren()
|
265 |
+
{
|
266 |
+
$children = array();
|
267 |
+
|
268 |
+
if ($this->article_images) {
|
269 |
+
foreach ($this->article_images as $article_image) {
|
270 |
+
$children[] = $article_image;
|
271 |
+
}
|
272 |
+
}
|
273 |
+
|
274 |
+
if ($this->caption) {
|
275 |
+
$children[] = $this->caption;
|
276 |
+
}
|
277 |
+
|
278 |
+
// // Geotag markup optional
|
279 |
+
// if ($this->geoTag) {
|
280 |
+
// $children[] = $this->geoTag;
|
281 |
+
// }
|
282 |
+
|
283 |
+
// Audio markup optional
|
284 |
+
if ($this->audio) {
|
285 |
+
$children[] = $this->audio;
|
286 |
+
}
|
287 |
+
|
288 |
+
return $children;
|
289 |
+
}
|
290 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/SocialEmbed.php
CHANGED
@@ -22,7 +22,7 @@ use Facebook\InstantArticles\Validators\Type;
|
|
22 |
*
|
23 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/social}
|
24 |
*/
|
25 |
-
class SocialEmbed extends Element
|
26 |
{
|
27 |
/**
|
28 |
* @var Caption Descriptive text for your social embed.
|
@@ -39,10 +39,23 @@ class SocialEmbed extends Element
|
|
39 |
*/
|
40 |
private $source;
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
private function __construct()
|
43 |
{
|
44 |
}
|
45 |
|
|
|
|
|
|
|
46 |
public static function create()
|
47 |
{
|
48 |
return new self();
|
@@ -52,6 +65,8 @@ class SocialEmbed extends Element
|
|
52 |
* Sets the caption for the social embed.
|
53 |
*
|
54 |
* @param Caption $caption - Descriptive text for your social embed.
|
|
|
|
|
55 |
*/
|
56 |
public function withCaption($caption)
|
57 |
{
|
@@ -65,6 +80,8 @@ class SocialEmbed extends Element
|
|
65 |
* Sets the source for the social embed.
|
66 |
*
|
67 |
* @param string $source - The source of the content for your social embed.
|
|
|
|
|
68 |
*/
|
69 |
public function withSource($source)
|
70 |
{
|
@@ -78,6 +95,8 @@ class SocialEmbed extends Element
|
|
78 |
* Sets the unescaped HTML of your social embed.
|
79 |
*
|
80 |
* @param \DOMNode $html - The unescaped HTML of your social embed.
|
|
|
|
|
81 |
*/
|
82 |
public function withHTML($html)
|
83 |
{
|
@@ -87,6 +106,36 @@ class SocialEmbed extends Element
|
|
87 |
return $this;
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
/**
|
91 |
* @return Caption - The caption for social embed block
|
92 |
*/
|
@@ -96,7 +145,7 @@ class SocialEmbed extends Element
|
|
96 |
}
|
97 |
|
98 |
/**
|
99 |
-
* @return \DOMNode
|
100 |
*/
|
101 |
public function getHtml()
|
102 |
{
|
@@ -104,23 +153,46 @@ class SocialEmbed extends Element
|
|
104 |
}
|
105 |
|
106 |
/**
|
107 |
-
* @return string
|
108 |
*/
|
109 |
public function getSource()
|
110 |
{
|
111 |
return $this->source;
|
112 |
}
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
/**
|
115 |
* Structure and create the full SocialEmbed in a DOMElement.
|
116 |
*
|
117 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
118 |
*/
|
119 |
public function toDOMElement($document = null)
|
120 |
{
|
121 |
if (!$document) {
|
122 |
$document = new \DOMDocument();
|
123 |
}
|
|
|
|
|
|
|
|
|
|
|
124 |
$figure = $document->createElement('figure');
|
125 |
$iframe = $document->createElement('iframe');
|
126 |
|
@@ -135,6 +207,14 @@ class SocialEmbed extends Element
|
|
135 |
$iframe->setAttribute('src', $this->source);
|
136 |
}
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
$figure->setAttribute('class', 'op-social');
|
139 |
|
140 |
// SocialEmbed markup
|
@@ -148,4 +228,32 @@ class SocialEmbed extends Element
|
|
148 |
|
149 |
return $figure;
|
150 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
}
|
22 |
*
|
23 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/social}
|
24 |
*/
|
25 |
+
class SocialEmbed extends Element implements Container
|
26 |
{
|
27 |
/**
|
28 |
* @var Caption Descriptive text for your social embed.
|
39 |
*/
|
40 |
private $source;
|
41 |
|
42 |
+
/**
|
43 |
+
* @var int The width of your social embed.
|
44 |
+
*/
|
45 |
+
private $width;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @var int The height of your social embed.
|
49 |
+
*/
|
50 |
+
private $height;
|
51 |
+
|
52 |
private function __construct()
|
53 |
{
|
54 |
}
|
55 |
|
56 |
+
/**
|
57 |
+
* @return SocialEmbed
|
58 |
+
*/
|
59 |
public static function create()
|
60 |
{
|
61 |
return new self();
|
65 |
* Sets the caption for the social embed.
|
66 |
*
|
67 |
* @param Caption $caption - Descriptive text for your social embed.
|
68 |
+
*
|
69 |
+
* @return $this
|
70 |
*/
|
71 |
public function withCaption($caption)
|
72 |
{
|
80 |
* Sets the source for the social embed.
|
81 |
*
|
82 |
* @param string $source - The source of the content for your social embed.
|
83 |
+
*
|
84 |
+
* @return $this
|
85 |
*/
|
86 |
public function withSource($source)
|
87 |
{
|
95 |
* Sets the unescaped HTML of your social embed.
|
96 |
*
|
97 |
* @param \DOMNode $html - The unescaped HTML of your social embed.
|
98 |
+
*
|
99 |
+
* @return $this
|
100 |
*/
|
101 |
public function withHTML($html)
|
102 |
{
|
106 |
return $this;
|
107 |
}
|
108 |
|
109 |
+
/**
|
110 |
+
* Sets the width of your social embed.
|
111 |
+
*
|
112 |
+
* @param int $width The width of your social embed.
|
113 |
+
*
|
114 |
+
* @return $this
|
115 |
+
*/
|
116 |
+
public function withWidth($width)
|
117 |
+
{
|
118 |
+
Type::enforce($width, Type::INTEGER);
|
119 |
+
$this->width = $width;
|
120 |
+
|
121 |
+
return $this;
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Sets the height of your social embed.
|
126 |
+
*
|
127 |
+
* @param int $height The height of your social embed.
|
128 |
+
*
|
129 |
+
* @return $this
|
130 |
+
*/
|
131 |
+
public function withHeight($height)
|
132 |
+
{
|
133 |
+
Type::enforce($height, Type::INTEGER);
|
134 |
+
$this->height = $height;
|
135 |
+
|
136 |
+
return $this;
|
137 |
+
}
|
138 |
+
|
139 |
/**
|
140 |
* @return Caption - The caption for social embed block
|
141 |
*/
|
145 |
}
|
146 |
|
147 |
/**
|
148 |
+
* @return \DOMNode The unescaped HTML of your social embed.
|
149 |
*/
|
150 |
public function getHtml()
|
151 |
{
|
153 |
}
|
154 |
|
155 |
/**
|
156 |
+
* @return string The source of the content for your social embed.
|
157 |
*/
|
158 |
public function getSource()
|
159 |
{
|
160 |
return $this->source;
|
161 |
}
|
162 |
|
163 |
+
/**
|
164 |
+
* @return int the width
|
165 |
+
*/
|
166 |
+
public function getWidth()
|
167 |
+
{
|
168 |
+
return $this->width;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* @return int the height
|
173 |
+
*/
|
174 |
+
public function getHeight()
|
175 |
+
{
|
176 |
+
return $this->height;
|
177 |
+
}
|
178 |
+
|
179 |
/**
|
180 |
* Structure and create the full SocialEmbed in a DOMElement.
|
181 |
*
|
182 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
183 |
+
*
|
184 |
+
* @return \DOMElement
|
185 |
*/
|
186 |
public function toDOMElement($document = null)
|
187 |
{
|
188 |
if (!$document) {
|
189 |
$document = new \DOMDocument();
|
190 |
}
|
191 |
+
|
192 |
+
if (!$this->isValid()) {
|
193 |
+
return $this->emptyElement($document);
|
194 |
+
}
|
195 |
+
|
196 |
$figure = $document->createElement('figure');
|
197 |
$iframe = $document->createElement('iframe');
|
198 |
|
207 |
$iframe->setAttribute('src', $this->source);
|
208 |
}
|
209 |
|
210 |
+
if ($this->width) {
|
211 |
+
$iframe->setAttribute('width', $this->width);
|
212 |
+
}
|
213 |
+
|
214 |
+
if ($this->height) {
|
215 |
+
$iframe->setAttribute('height', $this->height);
|
216 |
+
}
|
217 |
+
|
218 |
$figure->setAttribute('class', 'op-social');
|
219 |
|
220 |
// SocialEmbed markup
|
228 |
|
229 |
return $figure;
|
230 |
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Overrides the Element::isValid().
|
234 |
+
*
|
235 |
+
* @see Element::isValid().
|
236 |
+
* @return true for valid SocialEmbed that contains valid source or html, false otherwise.
|
237 |
+
*/
|
238 |
+
public function isValid()
|
239 |
+
{
|
240 |
+
return !Type::isTextEmpty($this->source) || $this->html;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Implements the Container::getContainerChildren().
|
245 |
+
*
|
246 |
+
* @see Container::getContainerChildren().
|
247 |
+
* @return array of Elements contained by Image.
|
248 |
+
*/
|
249 |
+
public function getContainerChildren()
|
250 |
+
{
|
251 |
+
$children = array();
|
252 |
+
|
253 |
+
if ($this->caption) {
|
254 |
+
$children[] = $this->caption;
|
255 |
+
}
|
256 |
+
|
257 |
+
return $children;
|
258 |
+
}
|
259 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Span.php
CHANGED
@@ -15,11 +15,13 @@ namespace Facebook\InstantArticles\Elements;
|
|
15 |
*/
|
16 |
class Span extends TextContainer
|
17 |
{
|
18 |
-
|
19 |
private function __construct()
|
20 |
{
|
21 |
}
|
22 |
|
|
|
|
|
|
|
23 |
public static function create()
|
24 |
{
|
25 |
return new self();
|
@@ -28,13 +30,20 @@ class Span extends TextContainer
|
|
28 |
/**
|
29 |
* Structure and create <span> node.
|
30 |
*
|
31 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
32 |
*/
|
33 |
public function toDOMElement($document = null)
|
34 |
{
|
35 |
if (!$document) {
|
36 |
$document = new \DOMDocument();
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
38 |
$span = $document->createElement('span');
|
39 |
|
40 |
$span->appendChild($this->textToDOMDocumentFragment($document));
|
15 |
*/
|
16 |
class Span extends TextContainer
|
17 |
{
|
|
|
18 |
private function __construct()
|
19 |
{
|
20 |
}
|
21 |
|
22 |
+
/**
|
23 |
+
* @return Span
|
24 |
+
*/
|
25 |
public static function create()
|
26 |
{
|
27 |
return new self();
|
30 |
/**
|
31 |
* Structure and create <span> node.
|
32 |
*
|
33 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
34 |
+
*
|
35 |
+
* @return \DOMElement
|
36 |
*/
|
37 |
public function toDOMElement($document = null)
|
38 |
{
|
39 |
if (!$document) {
|
40 |
$document = new \DOMDocument();
|
41 |
}
|
42 |
+
|
43 |
+
if (!$this->isValid()) {
|
44 |
+
return $this->emptyElement($document);
|
45 |
+
}
|
46 |
+
|
47 |
$span = $document->createElement('span');
|
48 |
|
49 |
$span->appendChild($this->textToDOMDocumentFragment($document));
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/TextContainer.php
CHANGED
@@ -18,28 +18,30 @@ use Facebook\InstantArticles\Validators\Type;
|
|
18 |
*
|
19 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/body-text}
|
20 |
*/
|
21 |
-
abstract class TextContainer extends Element
|
22 |
{
|
23 |
/**
|
24 |
* @var array The content is a list of strings and FormattingElements
|
25 |
*/
|
26 |
-
private $textChildren =
|
27 |
|
28 |
/**
|
29 |
* Adds content to the formatted text.
|
30 |
*
|
31 |
-
* @param string|FormattedText The content can be a string or a FormattedText.
|
|
|
|
|
32 |
*/
|
33 |
public function appendText($child)
|
34 |
{
|
35 |
-
Type::enforce($child,
|
36 |
$this->textChildren[] = $child;
|
37 |
|
38 |
return $this;
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
* @return
|
43 |
*/
|
44 |
public function getTextChildren()
|
45 |
{
|
@@ -49,7 +51,9 @@ abstract class TextContainer extends Element
|
|
49 |
/**
|
50 |
* Structure and create the full text in a DOMDocumentFragment.
|
51 |
*
|
52 |
-
* @param DOMDocument $document - The document where this element will be appended (optional).
|
|
|
|
|
53 |
*/
|
54 |
public function textToDOMDocumentFragment($document = null)
|
55 |
{
|
@@ -75,4 +79,47 @@ abstract class TextContainer extends Element
|
|
75 |
|
76 |
return $fragment;
|
77 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
18 |
*
|
19 |
* @see {link:https://developers.intern.facebook.com/docs/instant-articles/reference/body-text}
|
20 |
*/
|
21 |
+
abstract class TextContainer extends Element implements Container
|
22 |
{
|
23 |
/**
|
24 |
* @var array The content is a list of strings and FormattingElements
|
25 |
*/
|
26 |
+
private $textChildren = [];
|
27 |
|
28 |
/**
|
29 |
* Adds content to the formatted text.
|
30 |
*
|
31 |
+
* @param string|FormattedText|TextContainer The content can be a string or a FormattedText.
|
32 |
+
*
|
33 |
+
* @return $this
|
34 |
*/
|
35 |
public function appendText($child)
|
36 |
{
|
37 |
+
Type::enforce($child, [Type::STRING, FormattedText::getClassName(), TextContainer::getClassName()]);
|
38 |
$this->textChildren[] = $child;
|
39 |
|
40 |
return $this;
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
+
* @return string[]|FormattedText[]|TextContainer[] All text token for this text container.
|
45 |
*/
|
46 |
public function getTextChildren()
|
47 |
{
|
51 |
/**
|
52 |
* Structure and create the full text in a DOMDocumentFragment.
|
53 |
*
|
54 |
+
* @param \DOMDocument $document - The document where this element will be appended (optional).
|
55 |
+
*
|
56 |
+
* @return \DOMDocumentFragment
|
57 |
*/
|
58 |
public function textToDOMDocumentFragment($document = null)
|
59 |
{
|
79 |
|
80 |
return $fragment;
|
81 |
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Overrides the Element::isValid().
|
85 |
+
*
|
86 |
+
* @see Element::isValid().
|
87 |
+
* @return true for valid tag, false otherwise.
|
88 |
+
*/
|
89 |
+
public function isValid()
|
90 |
+
{
|
91 |
+
$textContent = '';
|
92 |
+
|
93 |
+
foreach ($this->textChildren as $content) {
|
94 |
+
// Recursive check on TextContainer, if something inside is valid, this is valid.
|
95 |
+
if (Type::is($content, TextContainer::getClassName()) && $content->isValid()) {
|
96 |
+
return true;
|
97 |
+
// If is string content, concat to check if it is not only a bunch of empty chars.
|
98 |
+
} elseif (Type::is($content, Type::STRING)) {
|
99 |
+
$textContent = $textContent.$content;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
return !Type::isTextEmpty($textContent);
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Implements the Container::getContainerChildren().
|
108 |
+
*
|
109 |
+
* @see Container::getContainerChildren().
|
110 |
+
* @return array of TextContainer
|
111 |
+
*/
|
112 |
+
public function getContainerChildren()
|
113 |
+
{
|
114 |
+
$children = array();
|
115 |
+
|
116 |
+
foreach ($this->textChildren as $content) {
|
117 |
+
// Recursive check on TextContainer, if something inside is valid, this is valid.
|
118 |
+
if (Type::is($content, TextContainer::getClassName())) {
|
119 |
+
$children[] = $content;
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
return $children;
|
124 |
+
}
|
125 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Time.php
CHANGED
@@ -12,8 +12,8 @@ use Facebook\InstantArticles\Validators\Type;
|
|
12 |
|
13 |
/**
|
14 |
* Class Time
|
15 |
-
* This represents time of publishing (
|
16 |
-
* (
|
17 |
*
|
18 |
*
|
19 |
* <time
|
@@ -29,6 +29,9 @@ use Facebook\InstantArticles\Validators\Type;
|
|
29 |
* datetime={date('c', $last_update)}>
|
30 |
* {date('F jS, g:ia', $last_update)}
|
31 |
* </time>
|
|
|
|
|
|
|
32 |
*/
|
33 |
class Time extends Element
|
34 |
{
|
@@ -43,12 +46,12 @@ class Time extends Element
|
|
43 |
const MODIFIED = 'op-modified';
|
44 |
|
45 |
/**
|
46 |
-
* @const string The date
|
47 |
*/
|
48 |
const DATE_FORMAT = 'F jS, g:ia';
|
49 |
|
50 |
/**
|
51 |
-
* @var DateTime The date
|
52 |
*/
|
53 |
private $date;
|
54 |
|
@@ -61,16 +64,20 @@ class Time extends Element
|
|
61 |
private $type;
|
62 |
|
63 |
/**
|
64 |
-
* Private constructor. Should use
|
|
|
65 |
*/
|
66 |
private function __construct()
|
67 |
{
|
68 |
}
|
69 |
|
70 |
/**
|
71 |
-
* @param string The type of this Article time (MODIFIED or PUBLISHED)
|
|
|
72 |
* @see Time::MODIFIED
|
73 |
* @see Time::PUBLISHED
|
|
|
|
|
74 |
*/
|
75 |
public static function create($type)
|
76 |
{
|
@@ -81,19 +88,21 @@ class Time extends Element
|
|
81 |
/**
|
82 |
* Overwrites the current type of time
|
83 |
*
|
84 |
-
* @param string The type of this Article time (MODIFIED or PUBLISHED)
|
85 |
*
|
86 |
* @see Time::MODIFIED
|
87 |
* @see Time::PUBLISHED
|
|
|
|
|
88 |
*/
|
89 |
public function withType($type)
|
90 |
{
|
91 |
Type::enforceWithin(
|
92 |
$type,
|
93 |
-
|
94 |
Time::MODIFIED,
|
95 |
Time::PUBLISHED
|
96 |
-
|
97 |
);
|
98 |
$this->type = $type;
|
99 |
|
@@ -103,7 +112,9 @@ class Time extends Element
|
|
103 |
/**
|
104 |
* Overwrites the current date in the object
|
105 |
*
|
106 |
-
* @param DateTime The date
|
|
|
|
|
107 |
*/
|
108 |
public function withDatetime($date)
|
109 |
{
|
@@ -114,7 +125,7 @@ class Time extends Element
|
|
114 |
}
|
115 |
|
116 |
/**
|
117 |
-
* @return DateTime The date
|
118 |
*/
|
119 |
public function getDatetime()
|
120 |
{
|
@@ -135,7 +146,9 @@ class Time extends Element
|
|
135 |
/**
|
136 |
* Structure and create the full Time in a XML format DOMElement.
|
137 |
*
|
138 |
-
* @param $document
|
|
|
|
|
139 |
*/
|
140 |
public function toDOMElement($document = null)
|
141 |
{
|
@@ -143,6 +156,10 @@ class Time extends Element
|
|
143 |
$document = new \DOMDocument();
|
144 |
}
|
145 |
|
|
|
|
|
|
|
|
|
146 |
$datetime = $this->date->format('c');
|
147 |
$date = $this->date->format('F jS, g:ia');
|
148 |
|
@@ -153,4 +170,15 @@ class Time extends Element
|
|
153 |
|
154 |
return $element;
|
155 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
}
|
12 |
|
13 |
/**
|
14 |
* Class Time
|
15 |
+
* This represents time of publishing (Time::PUBLISHED) or time of update
|
16 |
+
* (Time::MODIFIED).
|
17 |
*
|
18 |
*
|
19 |
* <time
|
29 |
* datetime={date('c', $last_update)}>
|
30 |
* {date('F jS, g:ia', $last_update)}
|
31 |
* </time>
|
32 |
+
*
|
33 |
+
* @see Time::PUBLISHED.
|
34 |
+
* @see Time::MODIFIED.
|
35 |
*/
|
36 |
class Time extends Element
|
37 |
{
|
46 |
const MODIFIED = 'op-modified';
|
47 |
|
48 |
/**
|
49 |
+
* @const string The date format
|
50 |
*/
|
51 |
const DATE_FORMAT = 'F jS, g:ia';
|
52 |
|
53 |
/**
|
54 |
+
* @var \DateTime The date format
|
55 |
*/
|
56 |
private $date;
|
57 |
|
64 |
private $type;
|
65 |
|
66 |
/**
|
67 |
+
* Private constructor. Should use Time::create().
|
68 |
+
* @see Time::create().
|
69 |
*/
|
70 |
private function __construct()
|
71 |
{
|
72 |
}
|
73 |
|
74 |
/**
|
75 |
+
* @param string $type The type of this Article time (MODIFIED or PUBLISHED)
|
76 |
+
*
|
77 |
* @see Time::MODIFIED
|
78 |
* @see Time::PUBLISHED
|
79 |
+
*
|
80 |
+
* @return Time
|
81 |
*/
|
82 |
public static function create($type)
|
83 |
{
|
88 |
/**
|
89 |
* Overwrites the current type of time
|
90 |
*
|
91 |
+
* @param string $type The type of this Article time (MODIFIED or PUBLISHED)
|
92 |
*
|
93 |
* @see Time::MODIFIED
|
94 |
* @see Time::PUBLISHED
|
95 |
+
*
|
96 |
+
* @return $this
|
97 |
*/
|
98 |
public function withType($type)
|
99 |
{
|
100 |
Type::enforceWithin(
|
101 |
$type,
|
102 |
+
[
|
103 |
Time::MODIFIED,
|
104 |
Time::PUBLISHED
|
105 |
+
]
|
106 |
);
|
107 |
$this->type = $type;
|
108 |
|
112 |
/**
|
113 |
* Overwrites the current date in the object
|
114 |
*
|
115 |
+
* @param \DateTime $date The date and time
|
116 |
+
*
|
117 |
+
* @return $this
|
118 |
*/
|
119 |
public function withDatetime($date)
|
120 |
{
|
125 |
}
|
126 |
|
127 |
/**
|
128 |
+
* @return \DateTime The date
|
129 |
*/
|
130 |
public function getDatetime()
|
131 |
{
|
146 |
/**
|
147 |
* Structure and create the full Time in a XML format DOMElement.
|
148 |
*
|
149 |
+
* @param \DOMDocument $document where this element will be appended. Optional
|
150 |
+
*
|
151 |
+
* @return \DOMElement
|
152 |
*/
|
153 |
public function toDOMElement($document = null)
|
154 |
{
|
156 |
$document = new \DOMDocument();
|
157 |
}
|
158 |
|
159 |
+
if (!$this->isValid()) {
|
160 |
+
return $this->emptyElement($document);
|
161 |
+
}
|
162 |
+
|
163 |
$datetime = $this->date->format('c');
|
164 |
$date = $this->date->format('F jS, g:ia');
|
165 |
|
170 |
|
171 |
return $element;
|
172 |
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Overrides the Element::isValid().
|
176 |
+
*
|
177 |
+
* @see Element::isValid().
|
178 |
+
* @return true for valid Time that contains valid date, false otherwise.
|
179 |
+
*/
|
180 |
+
public function isValid()
|
181 |
+
{
|
182 |
+
return isset($this->date) && $this->date !== null;
|
183 |
+
}
|
184 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Video.php
CHANGED
@@ -15,10 +15,10 @@ use Facebook\InstantArticles\Validators\Type;
|
|
15 |
* This element Class is the video for the article.
|
16 |
* Also consider to use one of the other media types for an article:
|
17 |
* <ul>
|
18 |
-
* <li
|
19 |
-
* <li
|
20 |
-
* <li
|
21 |
-
* <li
|
22 |
* </ul>
|
23 |
*
|
24 |
* Example:
|
@@ -28,9 +28,13 @@ use Facebook\InstantArticles\Validators\Type;
|
|
28 |
* </video>
|
29 |
* </figure>
|
30 |
*
|
|
|
|
|
|
|
|
|
31 |
* @package Facebook\InstantArticle\Elements
|
32 |
-
*/
|
33 |
-
class Video extends Element
|
34 |
{
|
35 |
const ASPECT_FIT = 'aspect-fit';
|
36 |
const ASPECT_FIT_ONLY = 'aspect-fit-only';
|
@@ -41,7 +45,7 @@ class Video extends Element
|
|
41 |
const DATA_FADE = 'data-fade';
|
42 |
|
43 |
/**
|
44 |
-
* @var
|
45 |
*/
|
46 |
private $caption;
|
47 |
|
@@ -68,6 +72,7 @@ class Video extends Element
|
|
68 |
|
69 |
/**
|
70 |
* @var boolean Makes the video the cover on news feed.
|
|
|
71 |
* @see {link:https://developers.facebook.com/docs/instant-articles/reference/feed-preview}
|
72 |
*/
|
73 |
private $isFeedCover;
|
@@ -79,6 +84,7 @@ class Video extends Element
|
|
79 |
|
80 |
/**
|
81 |
* @var string The picture size for the video.
|
|
|
82 |
* @see Video::ASPECT_FIT
|
83 |
* @see Video::ASPECT_FIT_ONLY
|
84 |
* @see Video::FULLSCREEN
|
@@ -106,16 +112,13 @@ class Video extends Element
|
|
106 |
*/
|
107 |
private $isControlsShown = false;
|
108 |
|
109 |
-
/**
|
110 |
-
* Private constructor.
|
111 |
-
* @see Video::create();.
|
112 |
-
*/
|
113 |
private function __construct()
|
114 |
{
|
115 |
}
|
116 |
|
117 |
/**
|
118 |
* Factory method
|
|
|
119 |
* @return Video the new instance from Video
|
120 |
*/
|
121 |
public static function create()
|
@@ -125,9 +128,11 @@ class Video extends Element
|
|
125 |
|
126 |
/**
|
127 |
* This sets figcaption tag as documentation. It overrides all sets
|
128 |
-
* made with
|
129 |
*
|
130 |
-
* @param Caption the caption the video will have
|
|
|
|
|
131 |
*/
|
132 |
public function withCaption($caption)
|
133 |
{
|
@@ -140,7 +145,9 @@ class Video extends Element
|
|
140 |
/**
|
141 |
* Sets the URL for the video. It is REQUIRED.
|
142 |
*
|
143 |
-
* @param string The url of video. Ie: http://domain.com/video.mp4
|
|
|
|
|
144 |
*/
|
145 |
public function withURL($url)
|
146 |
{
|
@@ -153,22 +160,25 @@ class Video extends Element
|
|
153 |
/**
|
154 |
* Sets the aspect ration presentation for the video.
|
155 |
*
|
156 |
-
* @param string one of the constants ASPECT_FIT, ASPECT_FIT_ONLY, FULLSCREEN or NON_INTERACTIVE
|
|
|
157 |
* @see Video::ASPECT_FIT
|
158 |
* @see Video::ASPECT_FIT_ONLY
|
159 |
* @see Video::FULLSCREEN
|
160 |
* @see Video::NON_INTERACTIVE
|
|
|
|
|
161 |
*/
|
162 |
public function withPresentation($presentation)
|
163 |
{
|
164 |
Type::enforceWithin(
|
165 |
$presentation,
|
166 |
-
|
167 |
Video::ASPECT_FIT,
|
168 |
Video::ASPECT_FIT_ONLY,
|
169 |
Video::FULLSCREEN,
|
170 |
Video::NON_INTERACTIVE
|
171 |
-
|
172 |
);
|
173 |
$this->presentation = $presentation;
|
174 |
|
@@ -177,6 +187,8 @@ class Video extends Element
|
|
177 |
|
178 |
/**
|
179 |
* Makes like enabled for this video.
|
|
|
|
|
180 |
*/
|
181 |
public function enableLike()
|
182 |
{
|
@@ -187,6 +199,8 @@ class Video extends Element
|
|
187 |
|
188 |
/**
|
189 |
* Makes like disabled for this video.
|
|
|
|
|
190 |
*/
|
191 |
public function disableLike()
|
192 |
{
|
@@ -197,6 +211,8 @@ class Video extends Element
|
|
197 |
|
198 |
/**
|
199 |
* Makes comments enabled for this video.
|
|
|
|
|
200 |
*/
|
201 |
public function enableComments()
|
202 |
{
|
@@ -207,6 +223,8 @@ class Video extends Element
|
|
207 |
|
208 |
/**
|
209 |
* Makes comments disabled for this video.
|
|
|
|
|
210 |
*/
|
211 |
public function disableComments()
|
212 |
{
|
@@ -217,6 +235,8 @@ class Video extends Element
|
|
217 |
|
218 |
/**
|
219 |
* Enables the video controls
|
|
|
|
|
220 |
*/
|
221 |
public function enableControls()
|
222 |
{
|
@@ -227,6 +247,8 @@ class Video extends Element
|
|
227 |
|
228 |
/**
|
229 |
* Disable the video controls
|
|
|
|
|
230 |
*/
|
231 |
public function disableControls()
|
232 |
{
|
@@ -237,6 +259,8 @@ class Video extends Element
|
|
237 |
|
238 |
/**
|
239 |
* Enables the video autoplay
|
|
|
|
|
240 |
*/
|
241 |
public function enableAutoplay()
|
242 |
{
|
@@ -247,6 +271,8 @@ class Video extends Element
|
|
247 |
|
248 |
/**
|
249 |
* Disable the video autoplay
|
|
|
|
|
250 |
*/
|
251 |
public function disableAutoplay()
|
252 |
{
|
@@ -257,6 +283,8 @@ class Video extends Element
|
|
257 |
|
258 |
/**
|
259 |
* Makes video be the cover on newsfeed
|
|
|
|
|
260 |
*/
|
261 |
public function enableFeedCover()
|
262 |
{
|
@@ -266,7 +294,9 @@ class Video extends Element
|
|
266 |
}
|
267 |
|
268 |
/**
|
269 |
-
* Removes
|
|
|
|
|
270 |
*/
|
271 |
public function disableFeedCover()
|
272 |
{
|
@@ -277,7 +307,9 @@ class Video extends Element
|
|
277 |
|
278 |
|
279 |
/**
|
280 |
-
* @param string content type of the video. Ex: "video/mp4"
|
|
|
|
|
281 |
*/
|
282 |
public function withContentType($contentType)
|
283 |
{
|
@@ -291,10 +323,14 @@ class Video extends Element
|
|
291 |
* Sets the geotag on the video.
|
292 |
*
|
293 |
* @see {link:http://geojson.org/}
|
|
|
|
|
|
|
|
|
294 |
*/
|
295 |
public function withGeoTag($geoTag)
|
296 |
{
|
297 |
-
Type::enforce($geoTag,
|
298 |
if (Type::is($geoTag, Type::STRING)) {
|
299 |
$this->geoTag = GeoTag::create()->withScript($geoTag);
|
300 |
} elseif (Type::is($geoTag, GeoTag::getClassName())) {
|
@@ -308,7 +344,9 @@ class Video extends Element
|
|
308 |
/**
|
309 |
* Sets the attribution string
|
310 |
*
|
311 |
-
* @param The attribution text
|
|
|
|
|
312 |
*/
|
313 |
public function withAttribution($attribution)
|
314 |
{
|
@@ -376,6 +414,7 @@ class Video extends Element
|
|
376 |
|
377 |
/**
|
378 |
* @return string one of the constants ASPECT_FIT, ASPECT_FIT_ONLY, FULLSCREEN or NON_INTERACTIVE
|
|
|
379 |
* @see Video::ASPECT_FIT
|
380 |
* @see Video::ASPECT_FIT_ONLY
|
381 |
* @see Video::FULLSCREEN
|
@@ -397,13 +436,20 @@ class Video extends Element
|
|
397 |
/**
|
398 |
* Structure and create the full Video in a XML format DOMElement.
|
399 |
*
|
400 |
-
* @param $document
|
|
|
|
|
401 |
*/
|
402 |
public function toDOMElement($document = null)
|
403 |
{
|
404 |
if (!$document) {
|
405 |
$document = new \DOMDocument();
|
406 |
}
|
|
|
|
|
|
|
|
|
|
|
407 |
$element = $document->createElement('figure');
|
408 |
|
409 |
// Presentation
|
@@ -470,4 +516,37 @@ class Video extends Element
|
|
470 |
|
471 |
return $element;
|
472 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
}
|
15 |
* This element Class is the video for the article.
|
16 |
* Also consider to use one of the other media types for an article:
|
17 |
* <ul>
|
18 |
+
* <li>Audio</li>
|
19 |
+
* <li>Image</li>
|
20 |
+
* <li>SlideShow</li>
|
21 |
+
* <li>Map</li>
|
22 |
* </ul>
|
23 |
*
|
24 |
* Example:
|
28 |
* </video>
|
29 |
* </figure>
|
30 |
*
|
31 |
+
* @see Audio
|
32 |
+
* @see Image
|
33 |
+
* @see SlideShow
|
34 |
+
* @see Map
|
35 |
* @package Facebook\InstantArticle\Elements
|
36 |
+
*/
|
37 |
+
class Video extends Element implements Container
|
38 |
{
|
39 |
const ASPECT_FIT = 'aspect-fit';
|
40 |
const ASPECT_FIT_ONLY = 'aspect-fit-only';
|
45 |
const DATA_FADE = 'data-fade';
|
46 |
|
47 |
/**
|
48 |
+
* @var Caption The caption for Video
|
49 |
*/
|
50 |
private $caption;
|
51 |
|
72 |
|
73 |
/**
|
74 |
* @var boolean Makes the video the cover on news feed.
|
75 |
+
*
|
76 |
* @see {link:https://developers.facebook.com/docs/instant-articles/reference/feed-preview}
|
77 |
*/
|
78 |
private $isFeedCover;
|
84 |
|
85 |
/**
|
86 |
* @var string The picture size for the video.
|
87 |
+
*
|
88 |
* @see Video::ASPECT_FIT
|
89 |
* @see Video::ASPECT_FIT_ONLY
|
90 |
* @see Video::FULLSCREEN
|
112 |
*/
|
113 |
private $isControlsShown = false;
|
114 |
|
|
|
|
|
|
|
|
|
115 |
private function __construct()
|
116 |
{
|
117 |
}
|
118 |
|
119 |
/**
|
120 |
* Factory method
|
121 |
+
*
|
122 |
* @return Video the new instance from Video
|
123 |
*/
|
124 |
public static function create()
|
128 |
|
129 |
/**
|
130 |
* This sets figcaption tag as documentation. It overrides all sets
|
131 |
+
* made with Caption.
|
132 |
*
|
133 |
+
* @param Caption $caption the caption the video will have
|
134 |
+
* @see Caption.
|
135 |
+
* @return $this
|
136 |
*/
|
137 |
public function withCaption($caption)
|
138 |
{
|
145 |
/**
|
146 |
* Sets the URL for the video. It is REQUIRED.
|
147 |
*
|
148 |
+
* @param string $url The url of video. Ie: http://domain.com/video.mp4
|
149 |
+
*
|
150 |
+
* @return $this
|
151 |
*/
|
152 |
public function withURL($url)
|
153 |
{
|
160 |
/**
|
161 |
* Sets the aspect ration presentation for the video.
|
162 |
*
|
163 |
+
* @param string $presentation one of the constants ASPECT_FIT, ASPECT_FIT_ONLY, FULLSCREEN or NON_INTERACTIVE
|
164 |
+
*
|
165 |
* @see Video::ASPECT_FIT
|
166 |
* @see Video::ASPECT_FIT_ONLY
|
167 |
* @see Video::FULLSCREEN
|
168 |
* @see Video::NON_INTERACTIVE
|
169 |
+
*
|
170 |
+
* @return $this
|
171 |
*/
|
172 |
public function withPresentation($presentation)
|
173 |
{
|
174 |
Type::enforceWithin(
|
175 |
$presentation,
|
176 |
+
[
|
177 |
Video::ASPECT_FIT,
|
178 |
Video::ASPECT_FIT_ONLY,
|
179 |
Video::FULLSCREEN,
|
180 |
Video::NON_INTERACTIVE
|
181 |
+
]
|
182 |
);
|
183 |
$this->presentation = $presentation;
|
184 |
|
187 |
|
188 |
/**
|
189 |
* Makes like enabled for this video.
|
190 |
+
*
|
191 |
+
* @return $this
|
192 |
*/
|
193 |
public function enableLike()
|
194 |
{
|
199 |
|
200 |
/**
|
201 |
* Makes like disabled for this video.
|
202 |
+
*
|
203 |
+
* @return $this
|
204 |
*/
|
205 |
public function disableLike()
|
206 |
{
|
211 |
|
212 |
/**
|
213 |
* Makes comments enabled for this video.
|
214 |
+
*
|
215 |
+
* @return $this
|
216 |
*/
|
217 |
public function enableComments()
|
218 |
{
|
223 |
|
224 |
/**
|
225 |
* Makes comments disabled for this video.
|
226 |
+
*
|
227 |
+
* @return $this
|
228 |
*/
|
229 |
public function disableComments()
|
230 |
{
|
235 |
|
236 |
/**
|
237 |
* Enables the video controls
|
238 |
+
*
|
239 |
+
* @return $this
|
240 |
*/
|
241 |
public function enableControls()
|
242 |
{
|
247 |
|
248 |
/**
|
249 |
* Disable the video controls
|
250 |
+
*
|
251 |
+
* @return $this
|
252 |
*/
|
253 |
public function disableControls()
|
254 |
{
|
259 |
|
260 |
/**
|
261 |
* Enables the video autoplay
|
262 |
+
*
|
263 |
+
* @return $this
|
264 |
*/
|
265 |
public function enableAutoplay()
|
266 |
{
|
271 |
|
272 |
/**
|
273 |
* Disable the video autoplay
|
274 |
+
*
|
275 |
+
* @return $this
|
276 |
*/
|
277 |
public function disableAutoplay()
|
278 |
{
|
283 |
|
284 |
/**
|
285 |
* Makes video be the cover on newsfeed
|
286 |
+
*
|
287 |
+
* @return $this
|
288 |
*/
|
289 |
public function enableFeedCover()
|
290 |
{
|
294 |
}
|
295 |
|
296 |
/**
|
297 |
+
* Removes video from cover on newsfeed (and it becomes the og:image that was already defined on the link)
|
298 |
+
*
|
299 |
+
* @return $this
|
300 |
*/
|
301 |
public function disableFeedCover()
|
302 |
{
|
307 |
|
308 |
|
309 |
/**
|
310 |
+
* @param string $contentType content type of the video. Ex: "video/mp4"
|
311 |
+
*
|
312 |
+
* @return $this
|
313 |
*/
|
314 |
public function withContentType($contentType)
|
315 |
{
|
323 |
* Sets the geotag on the video.
|
324 |
*
|
325 |
* @see {link:http://geojson.org/}
|
326 |
+
*
|
327 |
+
* @param string $geoTag
|
328 |
+
*
|
329 |
+
* @return $this
|
330 |
*/
|
331 |
public function withGeoTag($geoTag)
|
332 |
{
|
333 |
+
Type::enforce($geoTag, [Type::STRING, GeoTag::getClassName()]);
|
334 |
if (Type::is($geoTag, Type::STRING)) {
|
335 |
$this->geoTag = GeoTag::create()->withScript($geoTag);
|
336 |
} elseif (Type::is($geoTag, GeoTag::getClassName())) {
|
344 |
/**
|
345 |
* Sets the attribution string
|
346 |
*
|
347 |
+
* @param string $attribution The attribution text
|
348 |
+
*
|
349 |
+
* @return $this
|
350 |
*/
|
351 |
public function withAttribution($attribution)
|
352 |
{
|
414 |
|
415 |
/**
|
416 |
* @return string one of the constants ASPECT_FIT, ASPECT_FIT_ONLY, FULLSCREEN or NON_INTERACTIVE
|
417 |
+
*
|
418 |
* @see Video::ASPECT_FIT
|
419 |
* @see Video::ASPECT_FIT_ONLY
|
420 |
* @see Video::FULLSCREEN
|
436 |
/**
|
437 |
* Structure and create the full Video in a XML format DOMElement.
|
438 |
*
|
439 |
+
* @param \DOMDocument $document where this element will be appended. Optional
|
440 |
+
*
|
441 |
+
* @return \DOMElement
|
442 |
*/
|
443 |
public function toDOMElement($document = null)
|
444 |
{
|
445 |
if (!$document) {
|
446 |
$document = new \DOMDocument();
|
447 |
}
|
448 |
+
|
449 |
+
if (!$this->isValid()) {
|
450 |
+
return $this->emptyElement($document);
|
451 |
+
}
|
452 |
+
|
453 |
$element = $document->createElement('figure');
|
454 |
|
455 |
// Presentation
|
516 |
|
517 |
return $element;
|
518 |
}
|
519 |
+
|
520 |
+
/**
|
521 |
+
* Overrides the Element::isValid().
|
522 |
+
*
|
523 |
+
* @see Element::isValid().
|
524 |
+
* @return true for valid Video that contains not empty url, false otherwise.
|
525 |
+
*/
|
526 |
+
public function isValid()
|
527 |
+
{
|
528 |
+
return !Type::isTextEmpty($this->url);
|
529 |
+
}
|
530 |
+
|
531 |
+
/**
|
532 |
+
* Implements the Container::getContainerChildren().
|
533 |
+
*
|
534 |
+
* @see Container::getContainerChildren().
|
535 |
+
* @return array of Elements contained by Video.
|
536 |
+
*/
|
537 |
+
public function getContainerChildren()
|
538 |
+
{
|
539 |
+
$children = array();
|
540 |
+
|
541 |
+
if ($this->caption) {
|
542 |
+
$children[] = $this->caption;
|
543 |
+
}
|
544 |
+
|
545 |
+
// Geotag markup optional
|
546 |
+
if ($this->geoTag) {
|
547 |
+
$children[] = $this->geoTag;
|
548 |
+
}
|
549 |
+
|
550 |
+
return $children;
|
551 |
+
}
|
552 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/AbstractGetter.php
CHANGED
@@ -8,29 +8,37 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Getters;
|
10 |
|
11 |
-
|
12 |
/**
|
13 |
* Class abstract for all getters.
|
14 |
*/
|
15 |
abstract class AbstractGetter
|
16 |
{
|
17 |
/**
|
18 |
-
* Method that should be implemented so it can be Instantiated by
|
19 |
-
*
|
20 |
-
* @
|
|
|
|
|
|
|
21 |
*/
|
22 |
abstract public function createFrom($configuration);
|
23 |
|
24 |
/**
|
25 |
* Method that should retrieve
|
|
|
|
|
|
|
|
|
26 |
*/
|
27 |
abstract public function get($node);
|
28 |
|
29 |
/**
|
30 |
* Auxiliary method to extract full qualified class name.
|
|
|
31 |
* @return string The full qualified name of class
|
32 |
*/
|
33 |
-
public static function getClassName()
|
|
|
34 |
return get_called_class();
|
35 |
}
|
36 |
}
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Getters;
|
10 |
|
|
|
11 |
/**
|
12 |
* Class abstract for all getters.
|
13 |
*/
|
14 |
abstract class AbstractGetter
|
15 |
{
|
16 |
/**
|
17 |
+
* Method that should be implemented so it can be Instantiated by GetterFactory
|
18 |
+
*
|
19 |
+
* @param string[] $configuration With all properties of this Getter
|
20 |
+
* @see GetterFactory.
|
21 |
+
*
|
22 |
+
* @return static
|
23 |
*/
|
24 |
abstract public function createFrom($configuration);
|
25 |
|
26 |
/**
|
27 |
* Method that should retrieve
|
28 |
+
*
|
29 |
+
* @param \DOMNode $node
|
30 |
+
*
|
31 |
+
* @return mixed
|
32 |
*/
|
33 |
abstract public function get($node);
|
34 |
|
35 |
/**
|
36 |
* Auxiliary method to extract full qualified class name.
|
37 |
+
*
|
38 |
* @return string The full qualified name of class
|
39 |
*/
|
40 |
+
public static function getClassName()
|
41 |
+
{
|
42 |
return get_called_class();
|
43 |
}
|
44 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ChildrenGetter.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Getters;
|
10 |
|
11 |
-
|
12 |
class ChildrenGetter extends ElementGetter
|
13 |
{
|
14 |
public function get($node)
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Getters;
|
10 |
|
|
|
11 |
class ChildrenGetter extends ElementGetter
|
12 |
{
|
13 |
public function get($node)
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ElementGetter.php
CHANGED
@@ -13,11 +13,21 @@ use Symfony\Component\CssSelector\CssSelectorConverter;
|
|
13 |
|
14 |
class ElementGetter extends AbstractGetter
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
16 |
public function createFrom($properties)
|
17 |
{
|
18 |
return $this->withSelector($properties['selector']);
|
19 |
}
|
20 |
|
|
|
|
|
|
|
|
|
|
|
21 |
public function findAll($node)
|
22 |
{
|
23 |
$domXPath = new \DOMXPath($node->ownerDocument);
|
@@ -26,6 +36,11 @@ class ElementGetter extends AbstractGetter
|
|
26 |
return $domXPath->query($xpath, $node);
|
27 |
}
|
28 |
|
|
|
|
|
|
|
|
|
|
|
29 |
public function withSelector($selector)
|
30 |
{
|
31 |
Type::enforce($selector, Type::STRING);
|
13 |
|
14 |
class ElementGetter extends AbstractGetter
|
15 |
{
|
16 |
+
/**
|
17 |
+
* @var string
|
18 |
+
*/
|
19 |
+
protected $selector;
|
20 |
+
|
21 |
public function createFrom($properties)
|
22 |
{
|
23 |
return $this->withSelector($properties['selector']);
|
24 |
}
|
25 |
|
26 |
+
/**
|
27 |
+
* @param \DOMNode $node
|
28 |
+
*
|
29 |
+
* @return \DOMNodeList
|
30 |
+
*/
|
31 |
public function findAll($node)
|
32 |
{
|
33 |
$domXPath = new \DOMXPath($node->ownerDocument);
|
36 |
return $domXPath->query($xpath, $node);
|
37 |
}
|
38 |
|
39 |
+
/**
|
40 |
+
* @param string $selector
|
41 |
+
*
|
42 |
+
* @return $this
|
43 |
+
*/
|
44 |
public function withSelector($selector)
|
45 |
{
|
46 |
Type::enforce($selector, Type::STRING);
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/GetterFactory.php
CHANGED
@@ -8,8 +8,6 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Getters;
|
10 |
|
11 |
-
use Facebook\InstantArticles\Transformer\Validators\Type;
|
12 |
-
|
13 |
class GetterFactory
|
14 |
{
|
15 |
const TYPE_STRING_GETTER = 'string';
|
@@ -35,12 +33,14 @@ class GetterFactory
|
|
35 |
* @see NextSiblingGetter
|
36 |
* @see ExistsGetter
|
37 |
* @see XpathGetter
|
38 |
-
*
|
39 |
-
* @
|
|
|
|
|
40 |
*/
|
41 |
public static function create($getter_configuration)
|
42 |
{
|
43 |
-
$GETTERS =
|
44 |
self::TYPE_STRING_GETTER => StringGetter::getClassName(),
|
45 |
self::TYPE_INTEGER_GETTER => IntegerGetter::getClassName(),
|
46 |
self::TYPE_CHILDREN_GETTER => ChildrenGetter::getClassName(),
|
@@ -48,19 +48,14 @@ class GetterFactory
|
|
48 |
self::TYPE_NEXTSIBLING_GETTER => NextSiblingGetter::getClassName(),
|
49 |
self::TYPE_EXISTS_GETTER => ExistsGetter::getClassName(),
|
50 |
self::TYPE_XPATH_GETTER => XpathGetter::getClassName()
|
51 |
-
|
52 |
|
53 |
-
$
|
54 |
-
if (array_key_exists($
|
55 |
-
$
|
56 |
}
|
57 |
-
$instance = new $
|
58 |
$instance->createFrom($getter_configuration);
|
59 |
return $instance;
|
60 |
-
|
61 |
-
throw new \InvalidArgumentException(
|
62 |
-
'Type not informed or unrecognized. The configuration must have'.
|
63 |
-
' a type of "StringGetter" or "ChildrenGetter"'
|
64 |
-
);
|
65 |
}
|
66 |
}
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Getters;
|
10 |
|
|
|
|
|
11 |
class GetterFactory
|
12 |
{
|
13 |
const TYPE_STRING_GETTER = 'string';
|
33 |
* @see NextSiblingGetter
|
34 |
* @see ExistsGetter
|
35 |
* @see XpathGetter
|
36 |
+
*
|
37 |
+
* @param string[] $getter_configuration that maps the properties for getter
|
38 |
+
*
|
39 |
+
* @return AbstractGetter
|
40 |
*/
|
41 |
public static function create($getter_configuration)
|
42 |
{
|
43 |
+
$GETTERS = [
|
44 |
self::TYPE_STRING_GETTER => StringGetter::getClassName(),
|
45 |
self::TYPE_INTEGER_GETTER => IntegerGetter::getClassName(),
|
46 |
self::TYPE_CHILDREN_GETTER => ChildrenGetter::getClassName(),
|
48 |
self::TYPE_NEXTSIBLING_GETTER => NextSiblingGetter::getClassName(),
|
49 |
self::TYPE_EXISTS_GETTER => ExistsGetter::getClassName(),
|
50 |
self::TYPE_XPATH_GETTER => XpathGetter::getClassName()
|
51 |
+
];
|
52 |
|
53 |
+
$class = $getter_configuration['type'];
|
54 |
+
if (array_key_exists($class, $GETTERS)) {
|
55 |
+
$class = $GETTERS[$class];
|
56 |
}
|
57 |
+
$instance = new $class();
|
58 |
$instance->createFrom($getter_configuration);
|
59 |
return $instance;
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/StringGetter.php
CHANGED
@@ -12,6 +12,9 @@ use Facebook\InstantArticles\Validators\Type;
|
|
12 |
|
13 |
class StringGetter extends ChildrenGetter
|
14 |
{
|
|
|
|
|
|
|
15 |
protected $attribute;
|
16 |
|
17 |
public function createFrom($properties)
|
@@ -24,6 +27,11 @@ class StringGetter extends ChildrenGetter
|
|
24 |
}
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
27 |
public function withAttribute($attribute)
|
28 |
{
|
29 |
Type::enforce($attribute, Type::STRING);
|
12 |
|
13 |
class StringGetter extends ChildrenGetter
|
14 |
{
|
15 |
+
/**
|
16 |
+
* @var string
|
17 |
+
*/
|
18 |
protected $attribute;
|
19 |
|
20 |
public function createFrom($properties)
|
27 |
}
|
28 |
}
|
29 |
|
30 |
+
/**
|
31 |
+
* @param string $attribute
|
32 |
+
*
|
33 |
+
* @return $this
|
34 |
+
*/
|
35 |
public function withAttribute($attribute)
|
36 |
{
|
37 |
Type::enforce($attribute, Type::STRING);
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/XpathGetter.php
CHANGED
@@ -12,6 +12,9 @@ use Facebook\InstantArticles\Validators\Type;
|
|
12 |
|
13 |
class XpathGetter extends ChildrenGetter
|
14 |
{
|
|
|
|
|
|
|
15 |
protected $attribute;
|
16 |
|
17 |
public function createFrom($properties)
|
@@ -24,6 +27,11 @@ class XpathGetter extends ChildrenGetter
|
|
24 |
}
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
27 |
public function withAttribute($attribute)
|
28 |
{
|
29 |
Type::enforce($attribute, Type::STRING);
|
12 |
|
13 |
class XpathGetter extends ChildrenGetter
|
14 |
{
|
15 |
+
/**
|
16 |
+
* @var string
|
17 |
+
*/
|
18 |
protected $attribute;
|
19 |
|
20 |
public function createFrom($properties)
|
27 |
}
|
28 |
}
|
29 |
|
30 |
+
/**
|
31 |
+
* @param string $attribute
|
32 |
+
*
|
33 |
+
* @return $this
|
34 |
+
*/
|
35 |
public function withAttribute($attribute)
|
36 |
{
|
37 |
Type::enforce($attribute, Type::STRING);
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AdRule.php
CHANGED
@@ -19,12 +19,6 @@ class AdRule extends ConfigurationSelectorRule
|
|
19 |
const PROPERTY_AD_WIDTH_URL = 'ad.width';
|
20 |
const PROPERTY_AD_EMBED_URL = 'ad.embed';
|
21 |
|
22 |
-
private $header = false;
|
23 |
-
|
24 |
-
public function __construct()
|
25 |
-
{
|
26 |
-
}
|
27 |
-
|
28 |
public function getContextClass()
|
29 |
{
|
30 |
return InstantArticle::getClassName();
|
@@ -41,12 +35,12 @@ class AdRule extends ConfigurationSelectorRule
|
|
41 |
$ad_rule->withSelector($configuration['selector']);
|
42 |
|
43 |
$ad_rule->withProperties(
|
44 |
-
|
45 |
self::PROPERTY_AD_URL,
|
46 |
self::PROPERTY_AD_HEIGHT_URL,
|
47 |
self::PROPERTY_AD_WIDTH_URL,
|
48 |
self::PROPERTY_AD_EMBED_URL
|
49 |
-
|
50 |
$configuration
|
51 |
);
|
52 |
|
19 |
const PROPERTY_AD_WIDTH_URL = 'ad.width';
|
20 |
const PROPERTY_AD_EMBED_URL = 'ad.embed';
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
public function getContextClass()
|
23 |
{
|
24 |
return InstantArticle::getClassName();
|
35 |
$ad_rule->withSelector($configuration['selector']);
|
36 |
|
37 |
$ad_rule->withProperties(
|
38 |
+
[
|
39 |
self::PROPERTY_AD_URL,
|
40 |
self::PROPERTY_AD_HEIGHT_URL,
|
41 |
self::PROPERTY_AD_WIDTH_URL,
|
42 |
self::PROPERTY_AD_EMBED_URL
|
43 |
+
],
|
44 |
$configuration
|
45 |
);
|
46 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AnalyticsRule.php
CHANGED
@@ -17,12 +17,6 @@ class AnalyticsRule extends ConfigurationSelectorRule
|
|
17 |
const PROPERTY_TRACKER_URL = 'analytics.url';
|
18 |
const PROPERTY_TRACKER_EMBED_URL = 'analytics.embed';
|
19 |
|
20 |
-
private $header = false;
|
21 |
-
|
22 |
-
public function __construct()
|
23 |
-
{
|
24 |
-
}
|
25 |
-
|
26 |
public function getContextClass()
|
27 |
{
|
28 |
return InstantArticle::getClassName();
|
@@ -39,10 +33,10 @@ class AnalyticsRule extends ConfigurationSelectorRule
|
|
39 |
$analytics_rule->withSelector($configuration['selector']);
|
40 |
|
41 |
$analytics_rule->withProperties(
|
42 |
-
|
43 |
self::PROPERTY_TRACKER_URL,
|
44 |
self::PROPERTY_TRACKER_EMBED_URL
|
45 |
-
|
46 |
$configuration
|
47 |
);
|
48 |
|
17 |
const PROPERTY_TRACKER_URL = 'analytics.url';
|
18 |
const PROPERTY_TRACKER_EMBED_URL = 'analytics.embed';
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
public function getContextClass()
|
21 |
{
|
22 |
return InstantArticle::getClassName();
|
33 |
$analytics_rule->withSelector($configuration['selector']);
|
34 |
|
35 |
$analytics_rule->withProperties(
|
36 |
+
[
|
37 |
self::PROPERTY_TRACKER_URL,
|
38 |
self::PROPERTY_TRACKER_EMBED_URL
|
39 |
+
],
|
40 |
$configuration
|
41 |
);
|
42 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AnchorRule.php
CHANGED
@@ -16,10 +16,6 @@ class AnchorRule extends ConfigurationSelectorRule
|
|
16 |
const PROPERTY_ANCHOR_HREF = 'anchor.href';
|
17 |
const PROPERTY_ANCHOR_REL = 'anchor.rel';
|
18 |
|
19 |
-
public function __construct()
|
20 |
-
{
|
21 |
-
}
|
22 |
-
|
23 |
public static function create()
|
24 |
{
|
25 |
return new AnchorRule();
|
@@ -37,10 +33,10 @@ class AnchorRule extends ConfigurationSelectorRule
|
|
37 |
$anchor_rule->withSelector($configuration['selector']);
|
38 |
$properties = $configuration['properties'];
|
39 |
$anchor_rule->withProperties(
|
40 |
-
|
41 |
self::PROPERTY_ANCHOR_HREF,
|
42 |
self::PROPERTY_ANCHOR_REL
|
43 |
-
|
44 |
$properties
|
45 |
);
|
46 |
|
@@ -66,6 +62,9 @@ class AnchorRule extends ConfigurationSelectorRule
|
|
66 |
return $text_container;
|
67 |
}
|
68 |
|
|
|
|
|
|
|
69 |
public function loadFrom($configuration)
|
70 |
{
|
71 |
$this->selector = $configuration['selector'];
|
16 |
const PROPERTY_ANCHOR_HREF = 'anchor.href';
|
17 |
const PROPERTY_ANCHOR_REL = 'anchor.rel';
|
18 |
|
|
|
|
|
|
|
|
|
19 |
public static function create()
|
20 |
{
|
21 |
return new AnchorRule();
|
33 |
$anchor_rule->withSelector($configuration['selector']);
|
34 |
$properties = $configuration['properties'];
|
35 |
$anchor_rule->withProperties(
|
36 |
+
[
|
37 |
self::PROPERTY_ANCHOR_HREF,
|
38 |
self::PROPERTY_ANCHOR_REL
|
39 |
+
],
|
40 |
$properties
|
41 |
);
|
42 |
|
62 |
return $text_container;
|
63 |
}
|
64 |
|
65 |
+
/**
|
66 |
+
* @param array $configuration
|
67 |
+
*/
|
68 |
public function loadFrom($configuration)
|
69 |
{
|
70 |
$this->selector = $configuration['selector'];
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AudioRule.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
-
use Facebook\InstantArticles\Elements\Image;
|
12 |
use Facebook\InstantArticles\Elements\Audio;
|
13 |
use Facebook\InstantArticles\Elements\Audible;
|
14 |
use Facebook\InstantArticles\Transformer\Warnings\InvalidSelector;
|
@@ -36,12 +35,12 @@ class AudioRule extends ConfigurationSelectorRule
|
|
36 |
$audio_rule->withSelector($configuration['selector']);
|
37 |
|
38 |
$audio_rule->withProperties(
|
39 |
-
|
40 |
self::PROPERTY_AUDIO_URL,
|
41 |
self::PROPERTY_AUDIO_TITLE,
|
42 |
self::PROPERTY_AUDIO_AUTOPLAY,
|
43 |
self::PROPERTY_AUDIO_MUTED
|
44 |
-
|
45 |
$configuration
|
46 |
);
|
47 |
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
|
|
11 |
use Facebook\InstantArticles\Elements\Audio;
|
12 |
use Facebook\InstantArticles\Elements\Audible;
|
13 |
use Facebook\InstantArticles\Transformer\Warnings\InvalidSelector;
|
35 |
$audio_rule->withSelector($configuration['selector']);
|
36 |
|
37 |
$audio_rule->withProperties(
|
38 |
+
[
|
39 |
self::PROPERTY_AUDIO_URL,
|
40 |
self::PROPERTY_AUDIO_TITLE,
|
41 |
self::PROPERTY_AUDIO_AUTOPLAY,
|
42 |
self::PROPERTY_AUDIO_MUTED
|
43 |
+
],
|
44 |
$configuration
|
45 |
);
|
46 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/AuthorRule.php
CHANGED
@@ -21,7 +21,7 @@ class AuthorRule extends ConfigurationSelectorRule
|
|
21 |
|
22 |
public function getContextClass()
|
23 |
{
|
24 |
-
return
|
25 |
}
|
26 |
|
27 |
public static function create()
|
@@ -36,12 +36,12 @@ class AuthorRule extends ConfigurationSelectorRule
|
|
36 |
$author_rule->withSelector($configuration['selector']);
|
37 |
$properties = $configuration['properties'];
|
38 |
$author_rule->withProperties(
|
39 |
-
|
40 |
self::PROPERTY_AUTHOR_URL,
|
41 |
self::PROPERTY_AUTHOR_NAME,
|
42 |
self::PROPERTY_AUTHOR_DESCRIPTION,
|
43 |
self::PROPERTY_AUTHOR_ROLE_CONTRIBUTION
|
44 |
-
|
45 |
$properties
|
46 |
);
|
47 |
|
21 |
|
22 |
public function getContextClass()
|
23 |
{
|
24 |
+
return Header::getClassName();
|
25 |
}
|
26 |
|
27 |
public static function create()
|
36 |
$author_rule->withSelector($configuration['selector']);
|
37 |
$properties = $configuration['properties'];
|
38 |
$author_rule->withProperties(
|
39 |
+
[
|
40 |
self::PROPERTY_AUTHOR_URL,
|
41 |
self::PROPERTY_AUTHOR_NAME,
|
42 |
self::PROPERTY_AUTHOR_DESCRIPTION,
|
43 |
self::PROPERTY_AUTHOR_ROLE_CONTRIBUTION
|
44 |
+
],
|
45 |
$properties
|
46 |
);
|
47 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/BlockquoteRule.php
CHANGED
@@ -13,10 +13,6 @@ use Facebook\InstantArticles\Elements\Blockquote;
|
|
13 |
|
14 |
class BlockquoteRule extends ConfigurationSelectorRule
|
15 |
{
|
16 |
-
public function __construct()
|
17 |
-
{
|
18 |
-
}
|
19 |
-
|
20 |
public function getContextClass()
|
21 |
{
|
22 |
return InstantArticle::getClassName();
|
@@ -40,6 +36,9 @@ class BlockquoteRule extends ConfigurationSelectorRule
|
|
40 |
return $instant_article;
|
41 |
}
|
42 |
|
|
|
|
|
|
|
43 |
public function loadFrom($configuration)
|
44 |
{
|
45 |
$this->selector = $configuration['selector'];
|
13 |
|
14 |
class BlockquoteRule extends ConfigurationSelectorRule
|
15 |
{
|
|
|
|
|
|
|
|
|
16 |
public function getContextClass()
|
17 |
{
|
18 |
return InstantArticle::getClassName();
|
36 |
return $instant_article;
|
37 |
}
|
38 |
|
39 |
+
/**
|
40 |
+
* @param array $configuration
|
41 |
+
*/
|
42 |
public function loadFrom($configuration)
|
43 |
{
|
44 |
$this->selector = $configuration['selector'];
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/BoldRule.php
CHANGED
@@ -13,13 +13,9 @@ use Facebook\InstantArticles\Elements\Bold;
|
|
13 |
|
14 |
class BoldRule extends ConfigurationSelectorRule
|
15 |
{
|
16 |
-
public function __construct()
|
17 |
-
{
|
18 |
-
}
|
19 |
-
|
20 |
public function getContextClass()
|
21 |
{
|
22 |
-
return
|
23 |
}
|
24 |
|
25 |
public static function create()
|
13 |
|
14 |
class BoldRule extends ConfigurationSelectorRule
|
15 |
{
|
|
|
|
|
|
|
|
|
16 |
public function getContextClass()
|
17 |
{
|
18 |
+
return TextContainer::getClassName();
|
19 |
}
|
20 |
|
21 |
public static function create()
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/CaptionCreditRule.php
CHANGED
@@ -29,7 +29,7 @@ class CaptionCreditRule extends ConfigurationSelectorRule
|
|
29 |
$cite_rule->withSelector($configuration['selector']);
|
30 |
|
31 |
$cite_rule->withProperties(
|
32 |
-
|
33 |
Caption::POSITION_BELOW,
|
34 |
Caption::POSITION_CENTER,
|
35 |
Caption::POSITION_ABOVE,
|
@@ -37,7 +37,7 @@ class CaptionCreditRule extends ConfigurationSelectorRule
|
|
37 |
Caption::ALIGN_LEFT,
|
38 |
Caption::ALIGN_CENTER,
|
39 |
Caption::ALIGN_RIGHT
|
40 |
-
|
41 |
$configuration
|
42 |
);
|
43 |
|
@@ -50,13 +50,13 @@ class CaptionCreditRule extends ConfigurationSelectorRule
|
|
50 |
$caption->withCredit($cite);
|
51 |
|
52 |
if ($this->getProperty(Caption::POSITION_BELOW, $node)) {
|
53 |
-
$cite->
|
54 |
}
|
55 |
if ($this->getProperty(Caption::POSITION_CENTER, $node)) {
|
56 |
-
$cite->
|
57 |
}
|
58 |
if ($this->getProperty(Caption::POSITION_ABOVE, $node)) {
|
59 |
-
$cite->
|
60 |
}
|
61 |
|
62 |
if ($this->getProperty(Caption::ALIGN_LEFT, $node)) {
|
@@ -73,6 +73,9 @@ class CaptionCreditRule extends ConfigurationSelectorRule
|
|
73 |
return $caption;
|
74 |
}
|
75 |
|
|
|
|
|
|
|
76 |
public function loadFrom($configuration)
|
77 |
{
|
78 |
$this->selector = $configuration['selector'];
|
29 |
$cite_rule->withSelector($configuration['selector']);
|
30 |
|
31 |
$cite_rule->withProperties(
|
32 |
+
[
|
33 |
Caption::POSITION_BELOW,
|
34 |
Caption::POSITION_CENTER,
|
35 |
Caption::POSITION_ABOVE,
|
37 |
Caption::ALIGN_LEFT,
|
38 |
Caption::ALIGN_CENTER,
|
39 |
Caption::ALIGN_RIGHT
|
40 |
+
],
|
41 |
$configuration
|
42 |
);
|
43 |
|
50 |
$caption->withCredit($cite);
|
51 |
|
52 |
if ($this->getProperty(Caption::POSITION_BELOW, $node)) {
|
53 |
+
$cite->withPosition(Caption::POSITION_BELOW);
|
54 |
}
|
55 |
if ($this->getProperty(Caption::POSITION_CENTER, $node)) {
|
56 |
+
$cite->withPosition(Caption::POSITION_CENTER);
|
57 |
}
|
58 |
if ($this->getProperty(Caption::POSITION_ABOVE, $node)) {
|
59 |
+
$cite->withPosition(Caption::POSITION_ABOVE);
|
60 |
}
|
61 |
|
62 |
if ($this->getProperty(Caption::ALIGN_LEFT, $node)) {
|
73 |
return $caption;
|
74 |
}
|
75 |
|
76 |
+
/**
|
77 |
+
* @param array $configuration
|
78 |
+
*/
|
79 |
public function loadFrom($configuration)
|
80 |
{
|
81 |
$this->selector = $configuration['selector'];
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/CaptionRule.php
CHANGED
@@ -23,14 +23,14 @@ class CaptionRule extends ConfigurationSelectorRule
|
|
23 |
public function getContextClass()
|
24 |
{
|
25 |
return
|
26 |
-
|
27 |
Map::getClassName(),
|
28 |
Image::getClassName(),
|
29 |
Interactive::getClassName(),
|
30 |
Slideshow::getClassName(),
|
31 |
SocialEmbed::getClassName(),
|
32 |
Video::getClassName()
|
33 |
-
|
34 |
}
|
35 |
|
36 |
public static function create()
|
@@ -44,7 +44,7 @@ class CaptionRule extends ConfigurationSelectorRule
|
|
44 |
$caption_rule->withSelector($configuration['selector']);
|
45 |
|
46 |
$caption_rule->withProperties(
|
47 |
-
|
48 |
Caption::POSITION_BELOW,
|
49 |
Caption::POSITION_CENTER,
|
50 |
Caption::POSITION_ABOVE,
|
@@ -58,7 +58,7 @@ class CaptionRule extends ConfigurationSelectorRule
|
|
58 |
Caption::SIZE_XLARGE,
|
59 |
|
60 |
self::PROPERTY_DEFAULT
|
61 |
-
|
62 |
$configuration
|
63 |
);
|
64 |
|
@@ -71,13 +71,13 @@ class CaptionRule extends ConfigurationSelectorRule
|
|
71 |
$container_of_caption->withCaption($caption);
|
72 |
|
73 |
if ($this->getProperty(Caption::POSITION_BELOW, $node)) {
|
74 |
-
$caption->
|
75 |
}
|
76 |
if ($this->getProperty(Caption::POSITION_CENTER, $node)) {
|
77 |
-
$caption->
|
78 |
}
|
79 |
if ($this->getProperty(Caption::POSITION_ABOVE, $node)) {
|
80 |
-
$caption->
|
81 |
}
|
82 |
|
83 |
if ($this->getProperty(Caption::ALIGN_LEFT, $node)) {
|
@@ -101,8 +101,6 @@ class CaptionRule extends ConfigurationSelectorRule
|
|
101 |
}
|
102 |
|
103 |
$text_default = $this->getProperty(self::PROPERTY_DEFAULT, $node);
|
104 |
-
$log = \Logger::getLogger('facebook-instantarticles-transformer');
|
105 |
-
$log->debug($node->ownerDocument->saveXML($node));
|
106 |
if ($text_default) {
|
107 |
$caption->withTitle($text_default);
|
108 |
} else {
|
23 |
public function getContextClass()
|
24 |
{
|
25 |
return
|
26 |
+
[
|
27 |
Map::getClassName(),
|
28 |
Image::getClassName(),
|
29 |
Interactive::getClassName(),
|
30 |
Slideshow::getClassName(),
|
31 |
SocialEmbed::getClassName(),
|
32 |
Video::getClassName()
|
33 |
+
];
|
34 |
}
|
35 |
|
36 |
public static function create()
|
44 |
$caption_rule->withSelector($configuration['selector']);
|
45 |
|
46 |
$caption_rule->withProperties(
|
47 |
+
[
|
48 |
Caption::POSITION_BELOW,
|
49 |
Caption::POSITION_CENTER,
|
50 |
Caption::POSITION_ABOVE,
|
58 |
Caption::SIZE_XLARGE,
|
59 |
|
60 |
self::PROPERTY_DEFAULT
|
61 |
+
],
|
62 |
$configuration
|
63 |
);
|
64 |
|
71 |
$container_of_caption->withCaption($caption);
|
72 |
|
73 |
if ($this->getProperty(Caption::POSITION_BELOW, $node)) {
|
74 |
+
$caption->withPosition(Caption::POSITION_BELOW);
|
75 |
}
|
76 |
if ($this->getProperty(Caption::POSITION_CENTER, $node)) {
|
77 |
+
$caption->withPosition(Caption::POSITION_CENTER);
|
78 |
}
|
79 |
if ($this->getProperty(Caption::POSITION_ABOVE, $node)) {
|
80 |
+
$caption->withPosition(Caption::POSITION_ABOVE);
|
81 |
}
|
82 |
|
83 |
if ($this->getProperty(Caption::ALIGN_LEFT, $node)) {
|
101 |
}
|
102 |
|
103 |
$text_default = $this->getProperty(self::PROPERTY_DEFAULT, $node);
|
|
|
|
|
104 |
if ($text_default) {
|
105 |
$caption->withTitle($text_default);
|
106 |
} else {
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ConfigurationSelectorRule.php
CHANGED
@@ -8,21 +8,41 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
|
|
11 |
use Symfony\Component\CssSelector\CssSelectorConverter;
|
12 |
use Facebook\InstantArticles\Transformer\Getters\GetterFactory;
|
13 |
use Facebook\InstantArticles\Validators\Type;
|
14 |
|
15 |
abstract class ConfigurationSelectorRule extends Rule
|
16 |
{
|
|
|
|
|
|
|
17 |
protected $selector;
|
18 |
-
protected $properties = array();
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
public function withSelector($selector)
|
21 |
{
|
22 |
$this->selector = $selector;
|
|
|
23 |
return $this;
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
public function withProperty($property, $value)
|
27 |
{
|
28 |
if ($value) {
|
@@ -64,7 +84,6 @@ abstract class ConfigurationSelectorRule extends Rule
|
|
64 |
|
65 |
// Handles selector = .class
|
66 |
if (preg_match('/^\.[a-zA-Z][a-zA-Z0-9-]*$/', $this->selector) === 1) {
|
67 |
-
|
68 |
// Tries every class
|
69 |
$classNames = explode(' ', $node->getAttribute('class'));
|
70 |
foreach ($classNames as $className) {
|
@@ -79,7 +98,6 @@ abstract class ConfigurationSelectorRule extends Rule
|
|
79 |
|
80 |
// Handles selector = tag.class
|
81 |
if (preg_match('/^[a-zA-Z][a-zA-Z0-9-]*(\.[a-zA-Z][a-zA-Z0-9-]*)?$/', $this->selector) === 1) {
|
82 |
-
|
83 |
// Tries every class
|
84 |
$classNames = explode(' ', $node->getAttribute('class'));
|
85 |
foreach ($classNames as $className) {
|
@@ -113,6 +131,12 @@ abstract class ConfigurationSelectorRule extends Rule
|
|
113 |
return false;
|
114 |
}
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
public function findAll($node, $selector)
|
117 |
{
|
118 |
$domXPath = new \DOMXPath($node->ownerDocument);
|
@@ -121,6 +145,11 @@ abstract class ConfigurationSelectorRule extends Rule
|
|
121 |
return $domXPath->query($xpath, $node);
|
122 |
}
|
123 |
|
|
|
|
|
|
|
|
|
|
|
124 |
public function getProperty($property_name, $node)
|
125 |
{
|
126 |
$value = null;
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
+
use Facebook\InstantArticles\Transformer\Getters\AbstractGetter;
|
12 |
use Symfony\Component\CssSelector\CssSelectorConverter;
|
13 |
use Facebook\InstantArticles\Transformer\Getters\GetterFactory;
|
14 |
use Facebook\InstantArticles\Validators\Type;
|
15 |
|
16 |
abstract class ConfigurationSelectorRule extends Rule
|
17 |
{
|
18 |
+
/**
|
19 |
+
* @var string
|
20 |
+
*/
|
21 |
protected $selector;
|
|
|
22 |
|
23 |
+
/**
|
24 |
+
* @var AbstractGetter[]
|
25 |
+
*/
|
26 |
+
protected $properties = [];
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @param string $selector
|
30 |
+
*
|
31 |
+
* @return $this
|
32 |
+
*/
|
33 |
public function withSelector($selector)
|
34 |
{
|
35 |
$this->selector = $selector;
|
36 |
+
|
37 |
return $this;
|
38 |
}
|
39 |
|
40 |
+
/**
|
41 |
+
* @param $property
|
42 |
+
* @param array $value
|
43 |
+
*
|
44 |
+
* @return $this
|
45 |
+
*/
|
46 |
public function withProperty($property, $value)
|
47 |
{
|
48 |
if ($value) {
|
84 |
|
85 |
// Handles selector = .class
|
86 |
if (preg_match('/^\.[a-zA-Z][a-zA-Z0-9-]*$/', $this->selector) === 1) {
|
|
|
87 |
// Tries every class
|
88 |
$classNames = explode(' ', $node->getAttribute('class'));
|
89 |
foreach ($classNames as $className) {
|
98 |
|
99 |
// Handles selector = tag.class
|
100 |
if (preg_match('/^[a-zA-Z][a-zA-Z0-9-]*(\.[a-zA-Z][a-zA-Z0-9-]*)?$/', $this->selector) === 1) {
|
|
|
101 |
// Tries every class
|
102 |
$classNames = explode(' ', $node->getAttribute('class'));
|
103 |
foreach ($classNames as $className) {
|
131 |
return false;
|
132 |
}
|
133 |
|
134 |
+
/**
|
135 |
+
* @param \DOMNode $node
|
136 |
+
* @param string $selector
|
137 |
+
*
|
138 |
+
* @return \DOMNodeList
|
139 |
+
*/
|
140 |
public function findAll($node, $selector)
|
141 |
{
|
142 |
$domXPath = new \DOMXPath($node->ownerDocument);
|
145 |
return $domXPath->query($xpath, $node);
|
146 |
}
|
147 |
|
148 |
+
/**
|
149 |
+
* @param $property_name
|
150 |
+
* @param $node
|
151 |
+
* @return null
|
152 |
+
*/
|
153 |
public function getProperty($property_name, $node)
|
154 |
{
|
155 |
$value = null;
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterRelatedArticlesRule.php
CHANGED
@@ -15,10 +15,6 @@ class FooterRelatedArticlesRule extends ConfigurationSelectorRule
|
|
15 |
{
|
16 |
const PROPERTY_TITLE = 'related.title';
|
17 |
|
18 |
-
public function __construct()
|
19 |
-
{
|
20 |
-
}
|
21 |
-
|
22 |
public function getContextClass()
|
23 |
{
|
24 |
return Footer::getClassName();
|
15 |
{
|
16 |
const PROPERTY_TITLE = 'related.title';
|
17 |
|
|
|
|
|
|
|
|
|
18 |
public function getContextClass()
|
19 |
{
|
20 |
return Footer::getClassName();
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterRule.php
CHANGED
@@ -13,10 +13,6 @@ use Facebook\InstantArticles\Elements\Footer;
|
|
13 |
|
14 |
class FooterRule extends ConfigurationSelectorRule
|
15 |
{
|
16 |
-
public function __construct()
|
17 |
-
{
|
18 |
-
}
|
19 |
-
|
20 |
public function getContextClass()
|
21 |
{
|
22 |
return InstantArticle::getClassName();
|
13 |
|
14 |
class FooterRule extends ConfigurationSelectorRule
|
15 |
{
|
|
|
|
|
|
|
|
|
16 |
public function getContextClass()
|
17 |
{
|
18 |
return InstantArticle::getClassName();
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/GeoTagRule.php
CHANGED
@@ -20,7 +20,7 @@ class GeoTagRule extends ConfigurationSelectorRule
|
|
20 |
|
21 |
public function getContextClass()
|
22 |
{
|
23 |
-
return
|
24 |
}
|
25 |
|
26 |
public static function create()
|
20 |
|
21 |
public function getContextClass()
|
22 |
{
|
23 |
+
return [Image::getClassName(), Video::getClassName(), Map::getClassName()];
|
24 |
}
|
25 |
|
26 |
public static function create()
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H1Rule.php
CHANGED
@@ -8,6 +8,7 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
|
|
11 |
use Facebook\InstantArticles\Elements\Caption;
|
12 |
use Facebook\InstantArticles\Elements\H1;
|
13 |
use Facebook\InstantArticles\Elements\Instantarticle;
|
@@ -17,7 +18,7 @@ class H1Rule extends ConfigurationSelectorRule
|
|
17 |
{
|
18 |
public function getContextClass()
|
19 |
{
|
20 |
-
return
|
21 |
}
|
22 |
|
23 |
public static function create()
|
@@ -31,7 +32,7 @@ class H1Rule extends ConfigurationSelectorRule
|
|
31 |
$h1_rule->withSelector($configuration['selector']);
|
32 |
|
33 |
$h1_rule->withProperties(
|
34 |
-
|
35 |
Caption::POSITION_BELOW,
|
36 |
Caption::POSITION_CENTER,
|
37 |
Caption::POSITION_ABOVE,
|
@@ -43,7 +44,7 @@ class H1Rule extends ConfigurationSelectorRule
|
|
43 |
Caption::SIZE_MEDIUM,
|
44 |
Caption::SIZE_LARGE,
|
45 |
Caption::SIZE_XLARGE
|
46 |
-
|
47 |
$configuration
|
48 |
);
|
49 |
|
@@ -53,20 +54,20 @@ class H1Rule extends ConfigurationSelectorRule
|
|
53 |
public function apply($transformer, $context_element, $node)
|
54 |
{
|
55 |
$h1 = H1::create();
|
56 |
-
if (Type::is($context_element, Caption::getClassName())) {
|
57 |
$context_element->withTitle($h1);
|
58 |
} elseif (Type::is($context_element, InstantArticle::getClassName())) {
|
59 |
$context_element->addChild($h1);
|
60 |
}
|
61 |
|
62 |
if ($this->getProperty(Caption::POSITION_BELOW, $node)) {
|
63 |
-
$h1->
|
64 |
}
|
65 |
if ($this->getProperty(Caption::POSITION_CENTER, $node)) {
|
66 |
-
$h1->
|
67 |
}
|
68 |
if ($this->getProperty(Caption::POSITION_ABOVE, $node)) {
|
69 |
-
$h1->
|
70 |
}
|
71 |
|
72 |
if ($this->getProperty(Caption::ALIGN_LEFT, $node)) {
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
+
use Facebook\InstantArticles\Elements\Header;
|
12 |
use Facebook\InstantArticles\Elements\Caption;
|
13 |
use Facebook\InstantArticles\Elements\H1;
|
14 |
use Facebook\InstantArticles\Elements\Instantarticle;
|
18 |
{
|
19 |
public function getContextClass()
|
20 |
{
|
21 |
+
return [Header::getClassName(), Caption::getClassName(), InstantArticle::getClassName()];
|
22 |
}
|
23 |
|
24 |
public static function create()
|
32 |
$h1_rule->withSelector($configuration['selector']);
|
33 |
|
34 |
$h1_rule->withProperties(
|
35 |
+
[
|
36 |
Caption::POSITION_BELOW,
|
37 |
Caption::POSITION_CENTER,
|
38 |
Caption::POSITION_ABOVE,
|
44 |
Caption::SIZE_MEDIUM,
|
45 |
Caption::SIZE_LARGE,
|
46 |
Caption::SIZE_XLARGE
|
47 |
+
],
|
48 |
$configuration
|
49 |
);
|
50 |
|
54 |
public function apply($transformer, $context_element, $node)
|
55 |
{
|
56 |
$h1 = H1::create();
|
57 |
+
if (Type::is($context_element, array(Header::getClassName(), Caption::getClassName()))) {
|
58 |
$context_element->withTitle($h1);
|
59 |
} elseif (Type::is($context_element, InstantArticle::getClassName())) {
|
60 |
$context_element->addChild($h1);
|
61 |
}
|
62 |
|
63 |
if ($this->getProperty(Caption::POSITION_BELOW, $node)) {
|
64 |
+
$h1->withPosition(Caption::POSITION_BELOW);
|
65 |
}
|
66 |
if ($this->getProperty(Caption::POSITION_CENTER, $node)) {
|
67 |
+
$h1->withPosition(Caption::POSITION_CENTER);
|
68 |
}
|
69 |
if ($this->getProperty(Caption::POSITION_ABOVE, $node)) {
|
70 |
+
$h1->withPosition(Caption::POSITION_ABOVE);
|
71 |
}
|
72 |
|
73 |
if ($this->getProperty(Caption::ALIGN_LEFT, $node)) {
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H2Rule.php
CHANGED
@@ -8,6 +8,7 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
|
|
11 |
use Facebook\InstantArticles\Elements\Caption;
|
12 |
use Facebook\InstantArticles\Elements\H2;
|
13 |
use Facebook\InstantArticles\Elements\Instantarticle;
|
@@ -17,7 +18,7 @@ class H2Rule extends ConfigurationSelectorRule
|
|
17 |
{
|
18 |
public function getContextClass()
|
19 |
{
|
20 |
-
return
|
21 |
}
|
22 |
|
23 |
public static function create()
|
@@ -31,7 +32,7 @@ class H2Rule extends ConfigurationSelectorRule
|
|
31 |
$h2_rule->withSelector($configuration['selector']);
|
32 |
|
33 |
$h2_rule->withProperties(
|
34 |
-
|
35 |
Caption::POSITION_BELOW,
|
36 |
Caption::POSITION_CENTER,
|
37 |
Caption::POSITION_ABOVE,
|
@@ -39,7 +40,7 @@ class H2Rule extends ConfigurationSelectorRule
|
|
39 |
Caption::ALIGN_LEFT,
|
40 |
Caption::ALIGN_CENTER,
|
41 |
Caption::ALIGN_RIGHT
|
42 |
-
|
43 |
$configuration
|
44 |
);
|
45 |
|
@@ -49,20 +50,20 @@ class H2Rule extends ConfigurationSelectorRule
|
|
49 |
public function apply($transformer, $context_element, $node)
|
50 |
{
|
51 |
$h2 = H2::create();
|
52 |
-
if (Type::is($context_element, Caption::getClassName())) {
|
53 |
$context_element->withSubTitle($h2);
|
54 |
} elseif (Type::is($context_element, InstantArticle::getClassName())) {
|
55 |
$context_element->addChild($h2);
|
56 |
}
|
57 |
|
58 |
if ($this->getProperty(Caption::POSITION_BELOW, $node)) {
|
59 |
-
$h2->
|
60 |
}
|
61 |
if ($this->getProperty(Caption::POSITION_CENTER, $node)) {
|
62 |
-
$h2->
|
63 |
}
|
64 |
if ($this->getProperty(Caption::POSITION_ABOVE, $node)) {
|
65 |
-
$h2->
|
66 |
}
|
67 |
|
68 |
if ($this->getProperty(Caption::ALIGN_LEFT, $node)) {
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
+
use Facebook\InstantArticles\Elements\Header;
|
12 |
use Facebook\InstantArticles\Elements\Caption;
|
13 |
use Facebook\InstantArticles\Elements\H2;
|
14 |
use Facebook\InstantArticles\Elements\Instantarticle;
|
18 |
{
|
19 |
public function getContextClass()
|
20 |
{
|
21 |
+
return [Header::getClassName(), Caption::getClassName(), InstantArticle::getClassName()];
|
22 |
}
|
23 |
|
24 |
public static function create()
|
32 |
$h2_rule->withSelector($configuration['selector']);
|
33 |
|
34 |
$h2_rule->withProperties(
|
35 |
+
[
|
36 |
Caption::POSITION_BELOW,
|
37 |
Caption::POSITION_CENTER,
|
38 |
Caption::POSITION_ABOVE,
|
40 |
Caption::ALIGN_LEFT,
|
41 |
Caption::ALIGN_CENTER,
|
42 |
Caption::ALIGN_RIGHT
|
43 |
+
],
|
44 |
$configuration
|
45 |
);
|
46 |
|
50 |
public function apply($transformer, $context_element, $node)
|
51 |
{
|
52 |
$h2 = H2::create();
|
53 |
+
if (Type::is($context_element, array(Header::getClassName(), Caption::getClassName()))) {
|
54 |
$context_element->withSubTitle($h2);
|
55 |
} elseif (Type::is($context_element, InstantArticle::getClassName())) {
|
56 |
$context_element->addChild($h2);
|
57 |
}
|
58 |
|
59 |
if ($this->getProperty(Caption::POSITION_BELOW, $node)) {
|
60 |
+
$h2->withPosition(Caption::POSITION_BELOW);
|
61 |
}
|
62 |
if ($this->getProperty(Caption::POSITION_CENTER, $node)) {
|
63 |
+
$h2->withPosition(Caption::POSITION_CENTER);
|
64 |
}
|
65 |
if ($this->getProperty(Caption::POSITION_ABOVE, $node)) {
|
66 |
+
$h2->withPosition(Caption::POSITION_ABOVE);
|
67 |
}
|
68 |
|
69 |
if ($this->getProperty(Caption::ALIGN_LEFT, $node)) {
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderAdRule.php
CHANGED
@@ -34,12 +34,12 @@ class HeaderAdRule extends ConfigurationSelectorRule
|
|
34 |
$ad_rule->withSelector($configuration['selector']);
|
35 |
|
36 |
$ad_rule->withProperties(
|
37 |
-
|
38 |
self::PROPERTY_AD_URL,
|
39 |
self::PROPERTY_AD_HEIGHT_URL,
|
40 |
self::PROPERTY_AD_WIDTH_URL,
|
41 |
self::PROPERTY_AD_EMBED_URL
|
42 |
-
|
43 |
$configuration
|
44 |
);
|
45 |
|
34 |
$ad_rule->withSelector($configuration['selector']);
|
35 |
|
36 |
$ad_rule->withProperties(
|
37 |
+
[
|
38 |
self::PROPERTY_AD_URL,
|
39 |
self::PROPERTY_AD_HEIGHT_URL,
|
40 |
self::PROPERTY_AD_WIDTH_URL,
|
41 |
self::PROPERTY_AD_EMBED_URL
|
42 |
+
],
|
43 |
$configuration
|
44 |
);
|
45 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderImageRule.php
CHANGED
@@ -16,10 +16,6 @@ class HeaderImageRule extends ConfigurationSelectorRule
|
|
16 |
{
|
17 |
const PROPERTY_IMAGE_URL = 'image.url';
|
18 |
|
19 |
-
public function __construct()
|
20 |
-
{
|
21 |
-
}
|
22 |
-
|
23 |
public function getContextClass()
|
24 |
{
|
25 |
return Header::getClassName();
|
@@ -36,9 +32,9 @@ class HeaderImageRule extends ConfigurationSelectorRule
|
|
36 |
$image_rule->withSelector($configuration['selector']);
|
37 |
|
38 |
$image_rule->withProperties(
|
39 |
-
|
40 |
self::PROPERTY_IMAGE_URL
|
41 |
-
|
42 |
$configuration
|
43 |
);
|
44 |
|
16 |
{
|
17 |
const PROPERTY_IMAGE_URL = 'image.url';
|
18 |
|
|
|
|
|
|
|
|
|
19 |
public function getContextClass()
|
20 |
{
|
21 |
return Header::getClassName();
|
32 |
$image_rule->withSelector($configuration['selector']);
|
33 |
|
34 |
$image_rule->withProperties(
|
35 |
+
[
|
36 |
self::PROPERTY_IMAGE_URL
|
37 |
+
],
|
38 |
$configuration
|
39 |
);
|
40 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderSubTitleRule.php
CHANGED
@@ -9,13 +9,10 @@
|
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
use Facebook\InstantArticles\Elements\Header;
|
|
|
12 |
|
13 |
class HeaderSubTitleRule extends ConfigurationSelectorRule
|
14 |
{
|
15 |
-
public function __construct()
|
16 |
-
{
|
17 |
-
}
|
18 |
-
|
19 |
public function getContextClass()
|
20 |
{
|
21 |
return Header::getClassName();
|
@@ -33,7 +30,7 @@ class HeaderSubTitleRule extends ConfigurationSelectorRule
|
|
33 |
|
34 |
public function apply($transformer, $header, $h2)
|
35 |
{
|
36 |
-
$header->withSubTitle($
|
37 |
return $header;
|
38 |
}
|
39 |
}
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
use Facebook\InstantArticles\Elements\Header;
|
12 |
+
use Facebook\InstantArticles\Elements\H2;
|
13 |
|
14 |
class HeaderSubTitleRule extends ConfigurationSelectorRule
|
15 |
{
|
|
|
|
|
|
|
|
|
16 |
public function getContextClass()
|
17 |
{
|
18 |
return Header::getClassName();
|
30 |
|
31 |
public function apply($transformer, $header, $h2)
|
32 |
{
|
33 |
+
$header->withSubTitle($transformer->transform(H2::create(), $h2));
|
34 |
return $header;
|
35 |
}
|
36 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/HeaderTitleRule.php
CHANGED
@@ -9,6 +9,7 @@
|
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
use Facebook\InstantArticles\Elements\Header;
|
|
|
12 |
|
13 |
class HeaderTitleRule extends ConfigurationSelectorRule
|
14 |
{
|
@@ -29,7 +30,7 @@ class HeaderTitleRule extends ConfigurationSelectorRule
|
|
29 |
|
30 |
public function apply($transformer, $header, $h1)
|
31 |
{
|
32 |
-
$header->withTitle($
|
33 |
return $header;
|
34 |
}
|
35 |
}
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
use Facebook\InstantArticles\Elements\Header;
|
12 |
+
use Facebook\InstantArticles\Elements\H1;
|
13 |
|
14 |
class HeaderTitleRule extends ConfigurationSelectorRule
|
15 |
{
|
30 |
|
31 |
public function apply($transformer, $header, $h1)
|
32 |
{
|
33 |
+
$header->withTitle($transformer->transform(H1::create(), $h1));
|
34 |
return $header;
|
35 |
}
|
36 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/IgnoreRule.php
CHANGED
@@ -12,10 +12,6 @@ use Facebook\InstantArticles\Elements\Element;
|
|
12 |
|
13 |
class IgnoreRule extends ConfigurationSelectorRule
|
14 |
{
|
15 |
-
public function __construct()
|
16 |
-
{
|
17 |
-
}
|
18 |
-
|
19 |
public static function create()
|
20 |
{
|
21 |
return new IgnoreRule();
|
@@ -28,7 +24,7 @@ class IgnoreRule extends ConfigurationSelectorRule
|
|
28 |
|
29 |
public function getContextClass()
|
30 |
{
|
31 |
-
return
|
32 |
}
|
33 |
|
34 |
public function apply($transformer, $context, $element)
|
12 |
|
13 |
class IgnoreRule extends ConfigurationSelectorRule
|
14 |
{
|
|
|
|
|
|
|
|
|
15 |
public static function create()
|
16 |
{
|
17 |
return new IgnoreRule();
|
24 |
|
25 |
public function getContextClass()
|
26 |
{
|
27 |
+
return Element::getClassName();
|
28 |
}
|
29 |
|
30 |
public function apply($transformer, $context, $element)
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ImageRule.php
CHANGED
@@ -18,10 +18,6 @@ class ImageRule extends ConfigurationSelectorRule
|
|
18 |
const PROPERTY_LIKE = 'image.like';
|
19 |
const PROPERTY_COMMENTS = 'image.comments';
|
20 |
|
21 |
-
public function __construct()
|
22 |
-
{
|
23 |
-
}
|
24 |
-
|
25 |
public function getContextClass()
|
26 |
{
|
27 |
return InstantArticle::getClassName();
|
@@ -38,11 +34,11 @@ class ImageRule extends ConfigurationSelectorRule
|
|
38 |
$image_rule->withSelector($configuration['selector']);
|
39 |
|
40 |
$image_rule->withProperties(
|
41 |
-
|
42 |
self::PROPERTY_IMAGE_URL,
|
43 |
self::PROPERTY_LIKE,
|
44 |
self::PROPERTY_COMMENTS
|
45 |
-
|
46 |
$configuration
|
47 |
);
|
48 |
|
18 |
const PROPERTY_LIKE = 'image.like';
|
19 |
const PROPERTY_COMMENTS = 'image.comments';
|
20 |
|
|
|
|
|
|
|
|
|
21 |
public function getContextClass()
|
22 |
{
|
23 |
return InstantArticle::getClassName();
|
34 |
$image_rule->withSelector($configuration['selector']);
|
35 |
|
36 |
$image_rule->withProperties(
|
37 |
+
[
|
38 |
self::PROPERTY_IMAGE_URL,
|
39 |
self::PROPERTY_LIKE,
|
40 |
self::PROPERTY_COMMENTS
|
41 |
+
],
|
42 |
$configuration
|
43 |
);
|
44 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InstantArticleRule.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
-
use Facebook\InstantArticles\Elements\Image;
|
12 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
13 |
use Facebook\InstantArticles\Transformer\Warnings\InvalidSelector;
|
14 |
|
@@ -19,10 +18,6 @@ class InstantArticleRule extends ConfigurationSelectorRule
|
|
19 |
const PROPERTY_MARKUP_VERSION = 'article.markup.version';
|
20 |
const PROPERTY_AUTO_AD_PLACEMENT = 'article.auto.ad';
|
21 |
|
22 |
-
public function __construct()
|
23 |
-
{
|
24 |
-
}
|
25 |
-
|
26 |
public function getContextClass()
|
27 |
{
|
28 |
return InstantArticle::getClassName();
|
@@ -39,12 +34,12 @@ class InstantArticleRule extends ConfigurationSelectorRule
|
|
39 |
$canonical_rule->withSelector($configuration['selector']);
|
40 |
|
41 |
$canonical_rule->withProperties(
|
42 |
-
|
43 |
self::PROPERTY_CANONICAL,
|
44 |
self::PROPERTY_CHARSET,
|
45 |
self::PROPERTY_MARKUP_VERSION,
|
46 |
self::PROPERTY_AUTO_AD_PLACEMENT
|
47 |
-
|
48 |
$configuration
|
49 |
);
|
50 |
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
|
|
11 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
12 |
use Facebook\InstantArticles\Transformer\Warnings\InvalidSelector;
|
13 |
|
18 |
const PROPERTY_MARKUP_VERSION = 'article.markup.version';
|
19 |
const PROPERTY_AUTO_AD_PLACEMENT = 'article.auto.ad';
|
20 |
|
|
|
|
|
|
|
|
|
21 |
public function getContextClass()
|
22 |
{
|
23 |
return InstantArticle::getClassName();
|
34 |
$canonical_rule->withSelector($configuration['selector']);
|
35 |
|
36 |
$canonical_rule->withProperties(
|
37 |
+
[
|
38 |
self::PROPERTY_CANONICAL,
|
39 |
self::PROPERTY_CHARSET,
|
40 |
self::PROPERTY_MARKUP_VERSION,
|
41 |
self::PROPERTY_AUTO_AD_PLACEMENT
|
42 |
+
],
|
43 |
$configuration
|
44 |
);
|
45 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InteractiveRule.php
CHANGED
@@ -36,13 +36,13 @@ class InteractiveRule extends ConfigurationSelectorRule
|
|
36 |
$interactive_rule->withSelector($configuration['selector']);
|
37 |
|
38 |
$interactive_rule->withProperties(
|
39 |
-
|
40 |
self::PROPERTY_IFRAME,
|
41 |
self::PROPERTY_URL,
|
42 |
self::PROPERTY_WIDTH_NO_MARGIN,
|
43 |
self::PROPERTY_WIDTH_COLUMN_WIDTH,
|
44 |
self::PROPERTY_HEIGHT
|
45 |
-
|
46 |
$configuration
|
47 |
);
|
48 |
|
36 |
$interactive_rule->withSelector($configuration['selector']);
|
37 |
|
38 |
$interactive_rule->withProperties(
|
39 |
+
[
|
40 |
self::PROPERTY_IFRAME,
|
41 |
self::PROPERTY_URL,
|
42 |
self::PROPERTY_WIDTH_NO_MARGIN,
|
43 |
self::PROPERTY_WIDTH_COLUMN_WIDTH,
|
44 |
self::PROPERTY_HEIGHT
|
45 |
+
],
|
46 |
$configuration
|
47 |
);
|
48 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ItalicRule.php
CHANGED
@@ -13,10 +13,6 @@ use Facebook\InstantArticles\Elements\Italic;
|
|
13 |
|
14 |
class ItalicRule extends ConfigurationSelectorRule
|
15 |
{
|
16 |
-
public function __construct()
|
17 |
-
{
|
18 |
-
}
|
19 |
-
|
20 |
public static function create()
|
21 |
{
|
22 |
return new ItalicRule();
|
@@ -29,7 +25,7 @@ class ItalicRule extends ConfigurationSelectorRule
|
|
29 |
|
30 |
public function getContextClass()
|
31 |
{
|
32 |
-
return
|
33 |
}
|
34 |
|
35 |
public function apply($transformer, $text_container, $element)
|
13 |
|
14 |
class ItalicRule extends ConfigurationSelectorRule
|
15 |
{
|
|
|
|
|
|
|
|
|
16 |
public static function create()
|
17 |
{
|
18 |
return new ItalicRule();
|
25 |
|
26 |
public function getContextClass()
|
27 |
{
|
28 |
+
return TextContainer::getClassName();
|
29 |
}
|
30 |
|
31 |
public function apply($transformer, $text_container, $element)
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/LineBreakRule.php
CHANGED
@@ -13,13 +13,9 @@ use Facebook\InstantArticles\Elements\LineBreak;
|
|
13 |
|
14 |
class LineBreakRule extends ConfigurationSelectorRule
|
15 |
{
|
16 |
-
public function __construct()
|
17 |
-
{
|
18 |
-
}
|
19 |
-
|
20 |
public function getContextClass()
|
21 |
{
|
22 |
-
return
|
23 |
}
|
24 |
|
25 |
public static function create()
|
13 |
|
14 |
class LineBreakRule extends ConfigurationSelectorRule
|
15 |
{
|
|
|
|
|
|
|
|
|
16 |
public function getContextClass()
|
17 |
{
|
18 |
+
return TextContainer::getClassName();
|
19 |
}
|
20 |
|
21 |
public static function create()
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ListElementRule.php
CHANGED
@@ -13,10 +13,6 @@ use Facebook\InstantArticles\Elements\ListElement;
|
|
13 |
|
14 |
class ListElementRule extends ConfigurationSelectorRule
|
15 |
{
|
16 |
-
public function __construct()
|
17 |
-
{
|
18 |
-
}
|
19 |
-
|
20 |
public function getContextClass()
|
21 |
{
|
22 |
return InstantArticle::getClassName();
|
13 |
|
14 |
class ListElementRule extends ConfigurationSelectorRule
|
15 |
{
|
|
|
|
|
|
|
|
|
16 |
public function getContextClass()
|
17 |
{
|
18 |
return InstantArticle::getClassName();
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ListItemRule.php
CHANGED
@@ -13,10 +13,6 @@ use Facebook\InstantArticles\Elements\ListItem;
|
|
13 |
|
14 |
class ListItemRule extends ConfigurationSelectorRule
|
15 |
{
|
16 |
-
public function __construct()
|
17 |
-
{
|
18 |
-
}
|
19 |
-
|
20 |
public function getContextClass()
|
21 |
{
|
22 |
return ListElement::getClassName();
|
13 |
|
14 |
class ListItemRule extends ConfigurationSelectorRule
|
15 |
{
|
|
|
|
|
|
|
|
|
16 |
public function getContextClass()
|
17 |
{
|
18 |
return ListElement::getClassName();
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ParagraphFooterRule.php
CHANGED
@@ -13,10 +13,6 @@ use Facebook\InstantArticles\Elements\Footer;
|
|
13 |
|
14 |
class ParagraphFooterRule extends ConfigurationSelectorRule
|
15 |
{
|
16 |
-
public function __construct()
|
17 |
-
{
|
18 |
-
}
|
19 |
-
|
20 |
public function getContextClass()
|
21 |
{
|
22 |
return Footer::getClassName();
|
13 |
|
14 |
class ParagraphFooterRule extends ConfigurationSelectorRule
|
15 |
{
|
|
|
|
|
|
|
|
|
16 |
public function getContextClass()
|
17 |
{
|
18 |
return Footer::getClassName();
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ParagraphRule.php
CHANGED
@@ -13,10 +13,6 @@ use Facebook\InstantArticles\Elements\Paragraph;
|
|
13 |
|
14 |
class ParagraphRule extends ConfigurationSelectorRule
|
15 |
{
|
16 |
-
public function __construct()
|
17 |
-
{
|
18 |
-
}
|
19 |
-
|
20 |
public function getContextClass()
|
21 |
{
|
22 |
return InstantArticle::getClassName();
|
13 |
|
14 |
class ParagraphRule extends ConfigurationSelectorRule
|
15 |
{
|
|
|
|
|
|
|
|
|
16 |
public function getContextClass()
|
17 |
{
|
18 |
return InstantArticle::getClassName();
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/PassThroughRule.php
CHANGED
@@ -12,10 +12,6 @@ use Facebook\InstantArticles\Elements\Element;
|
|
12 |
|
13 |
class PassThroughRule extends ConfigurationSelectorRule
|
14 |
{
|
15 |
-
public function __construct()
|
16 |
-
{
|
17 |
-
}
|
18 |
-
|
19 |
public function getContextClass()
|
20 |
{
|
21 |
return Element::getClassName();
|
12 |
|
13 |
class PassThroughRule extends ConfigurationSelectorRule
|
14 |
{
|
|
|
|
|
|
|
|
|
15 |
public function getContextClass()
|
16 |
{
|
17 |
return Element::getClassName();
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/PullquoteRule.php
CHANGED
@@ -13,10 +13,6 @@ use Facebook\InstantArticles\Elements\Pullquote;
|
|
13 |
|
14 |
class PullquoteRule extends ConfigurationSelectorRule
|
15 |
{
|
16 |
-
public function __construct()
|
17 |
-
{
|
18 |
-
}
|
19 |
-
|
20 |
public function getContextClass()
|
21 |
{
|
22 |
return InstantArticle::getClassName();
|
13 |
|
14 |
class PullquoteRule extends ConfigurationSelectorRule
|
15 |
{
|
|
|
|
|
|
|
|
|
16 |
public function getContextClass()
|
17 |
{
|
18 |
return InstantArticle::getClassName();
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/RelatedArticlesRule.php
CHANGED
@@ -15,10 +15,6 @@ class RelatedArticlesRule extends ConfigurationSelectorRule
|
|
15 |
{
|
16 |
const PROPERTY_TITLE = 'related.title';
|
17 |
|
18 |
-
public function __construct()
|
19 |
-
{
|
20 |
-
}
|
21 |
-
|
22 |
public function getContextClass()
|
23 |
{
|
24 |
return InstantArticle::getClassName();
|
15 |
{
|
16 |
const PROPERTY_TITLE = 'related.title';
|
17 |
|
|
|
|
|
|
|
|
|
18 |
public function getContextClass()
|
19 |
{
|
20 |
return InstantArticle::getClassName();
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/RelatedItemRule.php
CHANGED
@@ -17,10 +17,6 @@ class RelatedItemRule extends ConfigurationSelectorRule
|
|
17 |
const PROPERTY_SPONSORED = 'related.sponsored';
|
18 |
const PROPERTY_URL = 'related.url';
|
19 |
|
20 |
-
public function __construct()
|
21 |
-
{
|
22 |
-
}
|
23 |
-
|
24 |
public function getContextClass()
|
25 |
{
|
26 |
return RelatedArticles::getClassName();
|
@@ -37,10 +33,10 @@ class RelatedItemRule extends ConfigurationSelectorRule
|
|
37 |
$related_item_rule->withSelector($configuration['selector']);
|
38 |
|
39 |
$related_item_rule->withProperties(
|
40 |
-
|
41 |
self::PROPERTY_SPONSORED,
|
42 |
self::PROPERTY_URL
|
43 |
-
|
44 |
$configuration
|
45 |
);
|
46 |
|
17 |
const PROPERTY_SPONSORED = 'related.sponsored';
|
18 |
const PROPERTY_URL = 'related.url';
|
19 |
|
|
|
|
|
|
|
|
|
20 |
public function getContextClass()
|
21 |
{
|
22 |
return RelatedArticles::getClassName();
|
33 |
$related_item_rule->withSelector($configuration['selector']);
|
34 |
|
35 |
$related_item_rule->withProperties(
|
36 |
+
[
|
37 |
self::PROPERTY_SPONSORED,
|
38 |
self::PROPERTY_URL
|
39 |
+
],
|
40 |
$configuration
|
41 |
);
|
42 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/Rule.php
CHANGED
@@ -47,16 +47,16 @@ abstract class Rule
|
|
47 |
|
48 |
public static function create()
|
49 |
{
|
50 |
-
throw new Exception(
|
51 |
-
'All Rule class
|
52 |
'Rule::create() method'
|
53 |
);
|
54 |
}
|
55 |
|
56 |
public static function createFrom($configuration)
|
57 |
{
|
58 |
-
throw new Exception(
|
59 |
-
'All Rule class
|
60 |
'Rule::createFrom($configuration) method'
|
61 |
);
|
62 |
}
|
@@ -74,8 +74,8 @@ abstract class Rule
|
|
74 |
* Auxiliary method to extract full qualified class name.
|
75 |
* @return string The full qualified name of class
|
76 |
*/
|
77 |
-
public static function getClassName()
|
|
|
78 |
return get_called_class();
|
79 |
}
|
80 |
-
|
81 |
}
|
47 |
|
48 |
public static function create()
|
49 |
{
|
50 |
+
throw new \Exception(
|
51 |
+
'All Rule class extensions should implement the '.
|
52 |
'Rule::create() method'
|
53 |
);
|
54 |
}
|
55 |
|
56 |
public static function createFrom($configuration)
|
57 |
{
|
58 |
+
throw new \Exception(
|
59 |
+
'All Rule class extensions should implement the '.
|
60 |
'Rule::createFrom($configuration) method'
|
61 |
);
|
62 |
}
|
74 |
* Auxiliary method to extract full qualified class name.
|
75 |
* @return string The full qualified name of class
|
76 |
*/
|
77 |
+
public static function getClassName()
|
78 |
+
{
|
79 |
return get_called_class();
|
80 |
}
|
|
|
81 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SlideshowImageRule.php
CHANGED
@@ -19,10 +19,6 @@ class SlideshowImageRule extends ConfigurationSelectorRule
|
|
19 |
const PROPERTY_CAPTION_TITLE = 'caption.title';
|
20 |
const PROPERTY_CAPTION_CREDIT = 'caption.credit';
|
21 |
|
22 |
-
public function __construct()
|
23 |
-
{
|
24 |
-
}
|
25 |
-
|
26 |
public function getContextClass()
|
27 |
{
|
28 |
return Slideshow::getClassName();
|
@@ -39,11 +35,11 @@ class SlideshowImageRule extends ConfigurationSelectorRule
|
|
39 |
$image_rule->withSelector($configuration['selector']);
|
40 |
|
41 |
$image_rule->withProperties(
|
42 |
-
|
43 |
self::PROPERTY_IMAGE_URL,
|
44 |
self::PROPERTY_CAPTION_TITLE,
|
45 |
self::PROPERTY_CAPTION_CREDIT
|
46 |
-
|
47 |
$configuration
|
48 |
);
|
49 |
|
19 |
const PROPERTY_CAPTION_TITLE = 'caption.title';
|
20 |
const PROPERTY_CAPTION_CREDIT = 'caption.credit';
|
21 |
|
|
|
|
|
|
|
|
|
22 |
public function getContextClass()
|
23 |
{
|
24 |
return Slideshow::getClassName();
|
35 |
$image_rule->withSelector($configuration['selector']);
|
36 |
|
37 |
$image_rule->withProperties(
|
38 |
+
[
|
39 |
self::PROPERTY_IMAGE_URL,
|
40 |
self::PROPERTY_CAPTION_TITLE,
|
41 |
self::PROPERTY_CAPTION_CREDIT
|
42 |
+
],
|
43 |
$configuration
|
44 |
);
|
45 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/SocialEmbedRule.php
CHANGED
@@ -16,6 +16,8 @@ class SocialEmbedRule extends ConfigurationSelectorRule
|
|
16 |
{
|
17 |
const PROPERTY_IFRAME = 'socialembed.iframe';
|
18 |
const PROPERTY_URL = 'socialembed.url';
|
|
|
|
|
19 |
|
20 |
public function getContextClass()
|
21 |
{
|
@@ -33,10 +35,12 @@ class SocialEmbedRule extends ConfigurationSelectorRule
|
|
33 |
$social_embed_rule->withSelector($configuration['selector']);
|
34 |
|
35 |
$social_embed_rule->withProperties(
|
36 |
-
|
37 |
self::PROPERTY_IFRAME,
|
38 |
-
self::PROPERTY_URL
|
39 |
-
|
|
|
|
|
40 |
$configuration
|
41 |
);
|
42 |
|
@@ -69,6 +73,16 @@ class SocialEmbedRule extends ConfigurationSelectorRule
|
|
69 |
);
|
70 |
}
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
$suppress_warnings = $transformer->suppress_warnings;
|
73 |
$transformer->suppress_warnings = true;
|
74 |
$transformer->transform($social_embed, $node);
|
16 |
{
|
17 |
const PROPERTY_IFRAME = 'socialembed.iframe';
|
18 |
const PROPERTY_URL = 'socialembed.url';
|
19 |
+
const PROPERTY_WIDTH = 'socialembed.width';
|
20 |
+
const PROPERTY_HEIGHT = 'socialembed.height';
|
21 |
|
22 |
public function getContextClass()
|
23 |
{
|
35 |
$social_embed_rule->withSelector($configuration['selector']);
|
36 |
|
37 |
$social_embed_rule->withProperties(
|
38 |
+
[
|
39 |
self::PROPERTY_IFRAME,
|
40 |
+
self::PROPERTY_URL,
|
41 |
+
self::PROPERTY_WIDTH,
|
42 |
+
self::PROPERTY_HEIGHT
|
43 |
+
],
|
44 |
$configuration
|
45 |
);
|
46 |
|
73 |
);
|
74 |
}
|
75 |
|
76 |
+
// Dimensions
|
77 |
+
$width = $this->getProperty(self::PROPERTY_WIDTH, $node);
|
78 |
+
$height = $this->getProperty(self::PROPERTY_HEIGHT, $node);
|
79 |
+
if ($width) {
|
80 |
+
$social_embed->withWidth($width);
|
81 |
+
}
|
82 |
+
if ($height) {
|
83 |
+
$social_embed->withHeight($height);
|
84 |
+
}
|
85 |
+
|
86 |
$suppress_warnings = $transformer->suppress_warnings;
|
87 |
$transformer->suppress_warnings = true;
|
88 |
$transformer->transform($social_embed, $node);
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TextNodeRule.php
CHANGED
@@ -12,10 +12,6 @@ use Facebook\InstantArticles\Elements\TextContainer;
|
|
12 |
|
13 |
class TextNodeRule extends Rule
|
14 |
{
|
15 |
-
public function __construct()
|
16 |
-
{
|
17 |
-
}
|
18 |
-
|
19 |
public function getContextClass()
|
20 |
{
|
21 |
return TextContainer::getClassName();
|
12 |
|
13 |
class TextNodeRule extends Rule
|
14 |
{
|
|
|
|
|
|
|
|
|
15 |
public function getContextClass()
|
16 |
{
|
17 |
return TextContainer::getClassName();
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TimeRule.php
CHANGED
@@ -19,10 +19,6 @@ class TimeRule extends ConfigurationSelectorRule
|
|
19 |
|
20 |
private $type = Time::PUBLISHED;
|
21 |
|
22 |
-
public function __construct()
|
23 |
-
{
|
24 |
-
}
|
25 |
-
|
26 |
public function getContextClass()
|
27 |
{
|
28 |
return Header::getClassName();
|
19 |
|
20 |
private $type = Time::PUBLISHED;
|
21 |
|
|
|
|
|
|
|
|
|
22 |
public function getContextClass()
|
23 |
{
|
24 |
return Header::getClassName();
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/VideoRule.php
CHANGED
@@ -23,10 +23,10 @@ class VideoRule extends ConfigurationSelectorRule
|
|
23 |
const PROPERTY_LIKE = 'video.like';
|
24 |
const PROPERTY_COMMENTS = 'video.comments';
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
public function getContextClass()
|
32 |
{
|
@@ -51,7 +51,6 @@ class VideoRule extends ConfigurationSelectorRule
|
|
51 |
$matches_node = false;
|
52 |
if ($node->hasChildNodes()) {
|
53 |
foreach ($node->childNodes as $child) {
|
54 |
-
|
55 |
$domXPath = new \DOMXPath($child->ownerDocument);
|
56 |
$converter = new CssSelectorConverter();
|
57 |
$xpath = $converter->toXPath($this->childSelector);
|
@@ -61,7 +60,6 @@ class VideoRule extends ConfigurationSelectorRule
|
|
61 |
$matches_node = true;
|
62 |
}
|
63 |
}
|
64 |
-
|
65 |
}
|
66 |
}
|
67 |
}
|
@@ -79,7 +77,7 @@ class VideoRule extends ConfigurationSelectorRule
|
|
79 |
}
|
80 |
|
81 |
$video_rule->withProperties(
|
82 |
-
|
83 |
self::PROPERTY_VIDEO_URL,
|
84 |
self::PROPERTY_VIDEO_TYPE,
|
85 |
|
@@ -93,7 +91,7 @@ class VideoRule extends ConfigurationSelectorRule
|
|
93 |
|
94 |
self::PROPERTY_LIKE,
|
95 |
self::PROPERTY_COMMENTS
|
96 |
-
|
97 |
$configuration
|
98 |
);
|
99 |
return $video_rule;
|
23 |
const PROPERTY_LIKE = 'video.like';
|
24 |
const PROPERTY_COMMENTS = 'video.comments';
|
25 |
|
26 |
+
/**
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
private $childSelector;
|
30 |
|
31 |
public function getContextClass()
|
32 |
{
|
51 |
$matches_node = false;
|
52 |
if ($node->hasChildNodes()) {
|
53 |
foreach ($node->childNodes as $child) {
|
|
|
54 |
$domXPath = new \DOMXPath($child->ownerDocument);
|
55 |
$converter = new CssSelectorConverter();
|
56 |
$xpath = $converter->toXPath($this->childSelector);
|
60 |
$matches_node = true;
|
61 |
}
|
62 |
}
|
|
|
63 |
}
|
64 |
}
|
65 |
}
|
77 |
}
|
78 |
|
79 |
$video_rule->withProperties(
|
80 |
+
[
|
81 |
self::PROPERTY_VIDEO_URL,
|
82 |
self::PROPERTY_VIDEO_TYPE,
|
83 |
|
91 |
|
92 |
self::PROPERTY_LIKE,
|
93 |
self::PROPERTY_COMMENTS
|
94 |
+
],
|
95 |
$configuration
|
96 |
);
|
97 |
return $video_rule;
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Transformer.php
CHANGED
@@ -12,24 +12,44 @@ use Facebook\InstantArticles\Transformer\Warnings\UnrecognizedElement;
|
|
12 |
use Facebook\InstantArticles\Transformer\Rules\Rule;
|
13 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
14 |
use Facebook\InstantArticles\Validators\Type;
|
|
|
15 |
|
16 |
class Transformer
|
17 |
{
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
private $ruleCount = 0;
|
21 |
|
|
|
|
|
|
|
22 |
public $suppress_warnings = false;
|
23 |
|
24 |
-
|
|
|
|
|
|
|
25 |
|
26 |
/**
|
27 |
* Gets all types a given class is, including itself, parent classes and interfaces.
|
28 |
*
|
29 |
* @param string $className - the name of the className
|
|
|
30 |
* @return array of class names the provided class name is
|
31 |
*/
|
32 |
-
private static function getAllClassTypes($className)
|
|
|
33 |
// Memoizes
|
34 |
if (isset(self::$allClassTypes[$className])) {
|
35 |
return self::$allClassTypes[$className];
|
@@ -37,7 +57,7 @@ class Transformer
|
|
37 |
|
38 |
$classParents = class_parents($className, true);
|
39 |
$classInterfaces = class_implements($className, true);
|
40 |
-
$classNames =
|
41 |
if ($classParents) {
|
42 |
$classNames = array_merge($classNames, $classParents);
|
43 |
}
|
@@ -48,11 +68,17 @@ class Transformer
|
|
48 |
return $classNames;
|
49 |
}
|
50 |
|
|
|
|
|
|
|
51 |
public function getWarnings()
|
52 |
{
|
53 |
return $this->warnings;
|
54 |
}
|
55 |
|
|
|
|
|
|
|
56 |
public function addRule($rule)
|
57 |
{
|
58 |
Type::enforce($rule, Rule::getClassName());
|
@@ -60,24 +86,33 @@ class Transformer
|
|
60 |
// Use context class as a key
|
61 |
$contexts = $rule->getContextClass();
|
62 |
|
63 |
-
// Handles multiple
|
64 |
if (!is_array($contexts)) {
|
65 |
-
$contexts =
|
66 |
}
|
67 |
|
68 |
foreach ($contexts as $context) {
|
69 |
if (!isset($this->rules[$context])) {
|
70 |
-
$this->rules[$context] =
|
71 |
}
|
72 |
$this->rules[$context][$this->ruleCount++] = $rule;
|
73 |
}
|
74 |
}
|
75 |
|
|
|
|
|
|
|
76 |
public function addWarning($warning)
|
77 |
{
|
78 |
$this->warnings[] = $warning;
|
79 |
}
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
public function transform($context, $node)
|
82 |
{
|
83 |
if (Type::is($context, InstantArticle::getClassName())) {
|
@@ -105,7 +140,7 @@ class Transformer
|
|
105 |
$contextClassNames = self::getAllClassTypes($context->getClassName());
|
106 |
|
107 |
// Look for rules applying to any of them as context
|
108 |
-
$matchingContextRules =
|
109 |
foreach ($contextClassNames as $contextClassName) {
|
110 |
if (isset($this->rules[$contextClassName])) {
|
111 |
// Use array union (+) instead of merge to preserve
|
@@ -133,6 +168,8 @@ class Transformer
|
|
133 |
if (!$matched &&
|
134 |
!($child->nodeName === '#text' && trim($child->textContent) === '') &&
|
135 |
!($child->nodeName === '#comment') &&
|
|
|
|
|
136 |
!$this->suppress_warnings
|
137 |
) {
|
138 |
$tag_content = $child->ownerDocument->saveXML($child);
|
@@ -149,21 +186,32 @@ class Transformer
|
|
149 |
}
|
150 |
}
|
151 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
return $context;
|
153 |
}
|
154 |
|
|
|
|
|
|
|
155 |
public function loadRules($json_file)
|
156 |
{
|
157 |
$configuration = json_decode($json_file, true);
|
158 |
if ($configuration && isset($configuration['rules'])) {
|
159 |
foreach ($configuration['rules'] as $configuration_rule) {
|
160 |
-
$
|
161 |
try {
|
162 |
-
$factory_method = new \ReflectionMethod($
|
163 |
} catch (\ReflectionException $e) {
|
164 |
$factory_method =
|
165 |
new \ReflectionMethod(
|
166 |
-
'Facebook\\InstantArticles\\Transformer\\Rules\\'.$
|
167 |
'createFrom'
|
168 |
);
|
169 |
}
|
@@ -177,20 +225,20 @@ class Transformer
|
|
177 |
*/
|
178 |
public function resetRules()
|
179 |
{
|
180 |
-
$this->rules =
|
181 |
$this->ruleCount = 0;
|
182 |
}
|
183 |
|
184 |
/**
|
185 |
* Gets all rules already set in this transformer instance.
|
186 |
*
|
187 |
-
* @return
|
188 |
*/
|
189 |
public function getRules()
|
190 |
{
|
191 |
// Do not expose internal map, just a simple array
|
192 |
-
// to keep the
|
193 |
-
$flatten_rules =
|
194 |
foreach ($this->rules as $ruleset) {
|
195 |
foreach ($ruleset as $priority => $rule) {
|
196 |
$flatten_rules[$priority] = $rule;
|
@@ -204,12 +252,12 @@ class Transformer
|
|
204 |
/**
|
205 |
* Overrides all rules already set in this transformer instance.
|
206 |
*
|
207 |
-
* @return
|
208 |
*/
|
209 |
public function setRules($rules)
|
210 |
{
|
211 |
// Do not receive internal map, just a plain list
|
212 |
-
// to keep the
|
213 |
Type::enforceArrayOf($rules, Rule::getClassName());
|
214 |
$this->resetRules();
|
215 |
foreach ($rules as $rule) {
|
12 |
use Facebook\InstantArticles\Transformer\Rules\Rule;
|
13 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
14 |
use Facebook\InstantArticles\Validators\Type;
|
15 |
+
use Facebook\InstantArticles\Validators\InstantArticleValidator;
|
16 |
|
17 |
class Transformer
|
18 |
{
|
19 |
+
/**
|
20 |
+
* @var Rule[]
|
21 |
+
*/
|
22 |
+
private $rules = [];
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var array
|
26 |
+
*/
|
27 |
+
private $warnings = [];
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var int
|
31 |
+
*/
|
32 |
private $ruleCount = 0;
|
33 |
|
34 |
+
/**
|
35 |
+
* @var bool
|
36 |
+
*/
|
37 |
public $suppress_warnings = false;
|
38 |
|
39 |
+
/**
|
40 |
+
* @var array
|
41 |
+
*/
|
42 |
+
private static $allClassTypes = [];
|
43 |
|
44 |
/**
|
45 |
* Gets all types a given class is, including itself, parent classes and interfaces.
|
46 |
*
|
47 |
* @param string $className - the name of the className
|
48 |
+
*
|
49 |
* @return array of class names the provided class name is
|
50 |
*/
|
51 |
+
private static function getAllClassTypes($className)
|
52 |
+
{
|
53 |
// Memoizes
|
54 |
if (isset(self::$allClassTypes[$className])) {
|
55 |
return self::$allClassTypes[$className];
|
57 |
|
58 |
$classParents = class_parents($className, true);
|
59 |
$classInterfaces = class_implements($className, true);
|
60 |
+
$classNames = [$className];
|
61 |
if ($classParents) {
|
62 |
$classNames = array_merge($classNames, $classParents);
|
63 |
}
|
68 |
return $classNames;
|
69 |
}
|
70 |
|
71 |
+
/**
|
72 |
+
* @return array
|
73 |
+
*/
|
74 |
public function getWarnings()
|
75 |
{
|
76 |
return $this->warnings;
|
77 |
}
|
78 |
|
79 |
+
/**
|
80 |
+
* @param Rule $rule
|
81 |
+
*/
|
82 |
public function addRule($rule)
|
83 |
{
|
84 |
Type::enforce($rule, Rule::getClassName());
|
86 |
// Use context class as a key
|
87 |
$contexts = $rule->getContextClass();
|
88 |
|
89 |
+
// Handles multiple contexts
|
90 |
if (!is_array($contexts)) {
|
91 |
+
$contexts = [$contexts];
|
92 |
}
|
93 |
|
94 |
foreach ($contexts as $context) {
|
95 |
if (!isset($this->rules[$context])) {
|
96 |
+
$this->rules[$context] = [];
|
97 |
}
|
98 |
$this->rules[$context][$this->ruleCount++] = $rule;
|
99 |
}
|
100 |
}
|
101 |
|
102 |
+
/**
|
103 |
+
* @param $warning
|
104 |
+
*/
|
105 |
public function addWarning($warning)
|
106 |
{
|
107 |
$this->warnings[] = $warning;
|
108 |
}
|
109 |
|
110 |
+
/**
|
111 |
+
* @param InstantArticle $context
|
112 |
+
* @param \DOMNode $node
|
113 |
+
*
|
114 |
+
* @return mixed
|
115 |
+
*/
|
116 |
public function transform($context, $node)
|
117 |
{
|
118 |
if (Type::is($context, InstantArticle::getClassName())) {
|
140 |
$contextClassNames = self::getAllClassTypes($context->getClassName());
|
141 |
|
142 |
// Look for rules applying to any of them as context
|
143 |
+
$matchingContextRules = [];
|
144 |
foreach ($contextClassNames as $contextClassName) {
|
145 |
if (isset($this->rules[$contextClassName])) {
|
146 |
// Use array union (+) instead of merge to preserve
|
168 |
if (!$matched &&
|
169 |
!($child->nodeName === '#text' && trim($child->textContent) === '') &&
|
170 |
!($child->nodeName === '#comment') &&
|
171 |
+
!($child->nodeName === 'html' && Type::is($child, 'DOMDocumentType')) &&
|
172 |
+
!($child->nodeName === 'xml' && Type::is($child, 'DOMProcessingInstruction')) &&
|
173 |
!$this->suppress_warnings
|
174 |
) {
|
175 |
$tag_content = $child->ownerDocument->saveXML($child);
|
186 |
}
|
187 |
}
|
188 |
}
|
189 |
+
|
190 |
+
if (Type::is($context, InstantArticle::getClassName())) {
|
191 |
+
$ia_warnings = InstantArticleValidator::check($context);
|
192 |
+
foreach ($ia_warnings as $ia_warning) {
|
193 |
+
$this->addWarning($ia_warning);
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
return $context;
|
198 |
}
|
199 |
|
200 |
+
/**
|
201 |
+
* @param string $json_file
|
202 |
+
*/
|
203 |
public function loadRules($json_file)
|
204 |
{
|
205 |
$configuration = json_decode($json_file, true);
|
206 |
if ($configuration && isset($configuration['rules'])) {
|
207 |
foreach ($configuration['rules'] as $configuration_rule) {
|
208 |
+
$class = $configuration_rule['class'];
|
209 |
try {
|
210 |
+
$factory_method = new \ReflectionMethod($class, 'createFrom');
|
211 |
} catch (\ReflectionException $e) {
|
212 |
$factory_method =
|
213 |
new \ReflectionMethod(
|
214 |
+
'Facebook\\InstantArticles\\Transformer\\Rules\\'.$class,
|
215 |
'createFrom'
|
216 |
);
|
217 |
}
|
225 |
*/
|
226 |
public function resetRules()
|
227 |
{
|
228 |
+
$this->rules = [];
|
229 |
$this->ruleCount = 0;
|
230 |
}
|
231 |
|
232 |
/**
|
233 |
* Gets all rules already set in this transformer instance.
|
234 |
*
|
235 |
+
* @return Rule[] List of configured rules.
|
236 |
*/
|
237 |
public function getRules()
|
238 |
{
|
239 |
// Do not expose internal map, just a simple array
|
240 |
+
// to keep the interface backwards compatible.
|
241 |
+
$flatten_rules = [];
|
242 |
foreach ($this->rules as $ruleset) {
|
243 |
foreach ($ruleset as $priority => $rule) {
|
244 |
$flatten_rules[$priority] = $rule;
|
252 |
/**
|
253 |
* Overrides all rules already set in this transformer instance.
|
254 |
*
|
255 |
+
* @return Rule[] List of configured rules.
|
256 |
*/
|
257 |
public function setRules($rules)
|
258 |
{
|
259 |
// Do not receive internal map, just a plain list
|
260 |
+
// to keep the interface backwards compatible.
|
261 |
Type::enforceArrayOf($rules, Rule::getClassName());
|
262 |
$this->resetRules();
|
263 |
foreach ($rules as $rule) {
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/InvalidSelector.php
CHANGED
@@ -8,16 +8,40 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Warnings;
|
10 |
|
|
|
|
|
|
|
11 |
/**
|
12 |
* Class InvalidSelector warning to show that an invalid selector for a required property was used
|
13 |
*/
|
14 |
class InvalidSelector
|
15 |
{
|
|
|
|
|
|
|
16 |
private $fields;
|
|
|
|
|
|
|
|
|
17 |
private $context;
|
|
|
|
|
|
|
|
|
18 |
private $node;
|
|
|
|
|
|
|
|
|
19 |
private $rule;
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
public function __construct($fields, $context, $node, $rule)
|
22 |
{
|
23 |
$this->fields = $fields;
|
@@ -26,6 +50,9 @@ class InvalidSelector
|
|
26 |
$this->rule = $rule;
|
27 |
}
|
28 |
|
|
|
|
|
|
|
29 |
public function __toString()
|
30 |
{
|
31 |
$reflection = new \ReflectionClass(get_class($this->context));
|
@@ -53,11 +80,17 @@ class InvalidSelector
|
|
53 |
"properties: {{$str_properties}}";
|
54 |
}
|
55 |
|
|
|
|
|
|
|
56 |
public function getContext()
|
57 |
{
|
58 |
return $this->context;
|
59 |
}
|
60 |
|
|
|
|
|
|
|
61 |
public function getNode()
|
62 |
{
|
63 |
return $this->node;
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Warnings;
|
10 |
|
11 |
+
use Facebook\InstantArticles\Elements\Element;
|
12 |
+
use Facebook\InstantArticles\Transformer\Rules\ConfigurationSelectorRule;
|
13 |
+
|
14 |
/**
|
15 |
* Class InvalidSelector warning to show that an invalid selector for a required property was used
|
16 |
*/
|
17 |
class InvalidSelector
|
18 |
{
|
19 |
+
/**
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
private $fields;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var Element
|
26 |
+
*/
|
27 |
private $context;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var \DOMNode
|
31 |
+
*/
|
32 |
private $node;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @var ConfigurationSelectorRule
|
36 |
+
*/
|
37 |
private $rule;
|
38 |
|
39 |
+
/**
|
40 |
+
* @param string $fields
|
41 |
+
* @param Element $context
|
42 |
+
* @param \DOMNode $node
|
43 |
+
* @param ConfigurationSelectorRule $rule
|
44 |
+
*/
|
45 |
public function __construct($fields, $context, $node, $rule)
|
46 |
{
|
47 |
$this->fields = $fields;
|
50 |
$this->rule = $rule;
|
51 |
}
|
52 |
|
53 |
+
/**
|
54 |
+
* @return string
|
55 |
+
*/
|
56 |
public function __toString()
|
57 |
{
|
58 |
$reflection = new \ReflectionClass(get_class($this->context));
|
80 |
"properties: {{$str_properties}}";
|
81 |
}
|
82 |
|
83 |
+
/**
|
84 |
+
* @return Element
|
85 |
+
*/
|
86 |
public function getContext()
|
87 |
{
|
88 |
return $this->context;
|
89 |
}
|
90 |
|
91 |
+
/**
|
92 |
+
* @return \DOMNode
|
93 |
+
*/
|
94 |
public function getNode()
|
95 |
{
|
96 |
return $this->node;
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/UnrecognizedElement.php
CHANGED
@@ -8,19 +8,34 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Warnings;
|
10 |
|
|
|
11 |
use Facebook\InstantArticles\Validators\Type;
|
12 |
|
13 |
class UnrecognizedElement
|
14 |
{
|
|
|
|
|
|
|
15 |
private $context;
|
|
|
|
|
|
|
|
|
16 |
private $node;
|
17 |
|
|
|
|
|
|
|
|
|
18 |
public function __construct($context, $node)
|
19 |
{
|
20 |
$this->context = $context;
|
21 |
$this->node = $node;
|
22 |
}
|
23 |
|
|
|
|
|
|
|
24 |
public function __toString()
|
25 |
{
|
26 |
$reflection = new \ReflectionClass(get_class($this->context));
|
@@ -28,8 +43,7 @@ class UnrecognizedElement
|
|
28 |
$nodeName = $this->node->nodeName;
|
29 |
if (substr($nodeName, 0, 1) === '#') {
|
30 |
$nodeDescription = '"'.mb_strimwidth($this->node->textContent, 0, 30, '...').'"';
|
31 |
-
}
|
32 |
-
else {
|
33 |
$nodeDescription = '<';
|
34 |
$nodeDescription .= $nodeName;
|
35 |
if (Type::is($this->node, 'DOMElement')) {
|
@@ -43,11 +57,17 @@ class UnrecognizedElement
|
|
43 |
return "No rules defined for {$nodeDescription} in the context of $className";
|
44 |
}
|
45 |
|
|
|
|
|
|
|
46 |
public function getContext()
|
47 |
{
|
48 |
return $this->context;
|
49 |
}
|
50 |
|
|
|
|
|
|
|
51 |
public function getNode()
|
52 |
{
|
53 |
return $this->node;
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Warnings;
|
10 |
|
11 |
+
use Facebook\InstantArticles\Elements\Element;
|
12 |
use Facebook\InstantArticles\Validators\Type;
|
13 |
|
14 |
class UnrecognizedElement
|
15 |
{
|
16 |
+
/**
|
17 |
+
* @var Element
|
18 |
+
*/
|
19 |
private $context;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var \DOMNode
|
23 |
+
*/
|
24 |
private $node;
|
25 |
|
26 |
+
/**
|
27 |
+
* @param Element $context
|
28 |
+
* @param \DOMNode $node
|
29 |
+
*/
|
30 |
public function __construct($context, $node)
|
31 |
{
|
32 |
$this->context = $context;
|
33 |
$this->node = $node;
|
34 |
}
|
35 |
|
36 |
+
/**
|
37 |
+
* @return string
|
38 |
+
*/
|
39 |
public function __toString()
|
40 |
{
|
41 |
$reflection = new \ReflectionClass(get_class($this->context));
|
43 |
$nodeName = $this->node->nodeName;
|
44 |
if (substr($nodeName, 0, 1) === '#') {
|
45 |
$nodeDescription = '"'.mb_strimwidth($this->node->textContent, 0, 30, '...').'"';
|
46 |
+
} else {
|
|
|
47 |
$nodeDescription = '<';
|
48 |
$nodeDescription .= $nodeName;
|
49 |
if (Type::is($this->node, 'DOMElement')) {
|
57 |
return "No rules defined for {$nodeDescription} in the context of $className";
|
58 |
}
|
59 |
|
60 |
+
/**
|
61 |
+
* @return Element
|
62 |
+
*/
|
63 |
public function getContext()
|
64 |
{
|
65 |
return $this->context;
|
66 |
}
|
67 |
|
68 |
+
/**
|
69 |
+
* @return \DOMNode
|
70 |
+
*/
|
71 |
public function getNode()
|
72 |
{
|
73 |
return $this->node;
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/ValidatorWarning.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* This source code is licensed under the license found in the
|
7 |
+
* LICENSE file in the root directory of this source tree.
|
8 |
+
*/
|
9 |
+
namespace Facebook\InstantArticles\Transformer\Warnings;
|
10 |
+
|
11 |
+
use Facebook\InstantArticles\Elements\Element;
|
12 |
+
use Facebook\InstantArticles\Validators\Type;
|
13 |
+
|
14 |
+
class ValidatorWarning
|
15 |
+
{
|
16 |
+
/**
|
17 |
+
* @var Element
|
18 |
+
*/
|
19 |
+
private $element;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var DOMNode
|
23 |
+
*/
|
24 |
+
private $node;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @var array the configuration content
|
28 |
+
*/
|
29 |
+
private $configuration;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @param Element $element
|
33 |
+
* @param DOMNode $node
|
34 |
+
*/
|
35 |
+
public function __construct($element, $node = null)
|
36 |
+
{
|
37 |
+
$this->element = $element;
|
38 |
+
$this->node = $node;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @return string
|
43 |
+
*/
|
44 |
+
public function __toString()
|
45 |
+
{
|
46 |
+
return $this->formatWarningMessage();
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @return Element
|
51 |
+
*/
|
52 |
+
public function getElement()
|
53 |
+
{
|
54 |
+
return $this->element;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @return DOMNode
|
59 |
+
*/
|
60 |
+
public function getNode()
|
61 |
+
{
|
62 |
+
return $this->node;
|
63 |
+
}
|
64 |
+
|
65 |
+
private function formatWarningMessage()
|
66 |
+
{
|
67 |
+
$object = Type::stringify($this->element);
|
68 |
+
if (!$this->configuration) {
|
69 |
+
$this->configuration = parse_ini_file("validator_warning_messages.ini", true);
|
70 |
+
}
|
71 |
+
$simple_class_name = substr(strrchr($this->element->getClassName(), '\\'), 1);
|
72 |
+
|
73 |
+
if (!isset($this->configuration['warning_messages'][$simple_class_name])) {
|
74 |
+
$message = 'Invalid content on the object: '.$object;
|
75 |
+
} else {
|
76 |
+
$message = $this->configuration['warning_messages'][$simple_class_name] . 'Element content: '.$object;
|
77 |
+
}
|
78 |
+
return $message;
|
79 |
+
}
|
80 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/validator_warning_messages.ini
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;
|
2 |
+
; This file contains messages for the transformer and also validator structure of an InstantArticle
|
3 |
+
;
|
4 |
+
|
5 |
+
[warning_messages]
|
6 |
+
|
7 |
+
Ad = "Ad must have a URL or html body."
|
8 |
+
Analytics = "Analytics must have a URL or html body."
|
9 |
+
Anchor = "Anchor must have a URL on href property."
|
10 |
+
AnimatedGIF = "GIF must have gif URL link."
|
11 |
+
Audio = "Audio must have an audio URL link."
|
12 |
+
Author = "Author must have name."
|
13 |
+
Blockquote = "Blockquote must contain at least one TextContainer or plain text content."
|
14 |
+
Bold = "This is a text container that must not be empty nor contain only whitespace characters such as spaces, tabs, new lines or ."
|
15 |
+
Caption = "Caption must contain at least one TextContainer or plain text content."
|
16 |
+
Cite = "This is a text container that must not be empty nor contain only whitespace characters such as spaces, tabs, new lines or ."
|
17 |
+
Div = "This is a text container that must not be empty nor contain only whitespace characters such as spaces, tabs, new lines or ."
|
18 |
+
Footer = "Footer must have at least one of the following: credits, copyright, relatedArticles."
|
19 |
+
FormattedText = "This is a text container that must not be empty nor contain only whitespace characters such as spaces, tabs, new lines or ."
|
20 |
+
GeoTag = "GeoTag must have a script."
|
21 |
+
H1 = "This is a text container that must not be empty nor contain only whitespace characters such as spaces, tabs, new lines or ."
|
22 |
+
H2 = "This is a text container that must not be empty nor contain only whitespace characters such as spaces, tabs, new lines or ."
|
23 |
+
H3 = "This is a text container that must not be empty nor contain only whitespace characters such as spaces, tabs, new lines or ."
|
24 |
+
Header = "Header must have at least a title and/or Ad."
|
25 |
+
Image = "Image must have a URL."
|
26 |
+
InstantArticle = "InstantArticle relies on InstantArticleValidator."
|
27 |
+
Interactive = "Interactive must have a src and/or HTML."
|
28 |
+
Italic = "This is a text container that must not be empty nor contain only whitespace characters such as spaces, tabs, new lines or ."
|
29 |
+
LineBreak = "LineBreak is always valid."
|
30 |
+
ListElement = "ListElement must have at least one of its ListItem valid."
|
31 |
+
ListItem = "ListItem must not be empty and must have a valid Element."
|
32 |
+
Map = "Map must have a valid GeoTag element."
|
33 |
+
Paragraph = "This is a text container that must not be empty nor contain only whitespace characters such as spaces, tabs, new lines or ."
|
34 |
+
Pullquote = "This is a text container that must not be empty nor contain only whitespace characters such as spaces, tabs, new lines or ."
|
35 |
+
RelatedArticles = "RelatedArticles must have at least one of its items valid."
|
36 |
+
RelatedItem = "RelatedItem must have a valid URL link."
|
37 |
+
Slideshow = "Slideshow must have at least one valid Image or Video."
|
38 |
+
SocialEmbed = "SocialEmbed must have a URL and/or HTML."
|
39 |
+
Span = "This is a text container that must not be empty nor contain only whitespace characters such as spaces, tabs, new lines or ."
|
40 |
+
TextContainer = "This is a text container that must not be empty nor contain only whitespace characters such as spaces, tabs, new lines or ."
|
41 |
+
Time = "Time must have datetime set."
|
42 |
+
Video = "Video must have a URL."
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/InstantArticleValidator.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* This source code is licensed under the license found in the
|
7 |
+
* LICENSE file in the root directory of this source tree.
|
8 |
+
*/
|
9 |
+
namespace Facebook\InstantArticles\Validators;
|
10 |
+
|
11 |
+
use Facebook\InstantArticles\Elements\InstantArticle;
|
12 |
+
use Facebook\InstantArticles\Elements\Container;
|
13 |
+
use Facebook\InstantArticles\Transformer\Warnings\ValidatorWarning;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Class that navigates thru InstantArticle object tree to validate it and report
|
17 |
+
* warnings related to each object tree.
|
18 |
+
*/
|
19 |
+
class InstantArticleValidator
|
20 |
+
{
|
21 |
+
private static $configuration;
|
22 |
+
/**
|
23 |
+
* This method navigates thru the tree structure and validates the article content.
|
24 |
+
*
|
25 |
+
* @param InstantArticle $article The article that will be checked.
|
26 |
+
* @return array of string with the warnings raised during the check.
|
27 |
+
*/
|
28 |
+
public static function check($article)
|
29 |
+
{
|
30 |
+
Type::enforce($article, InstantArticle::getClassName());
|
31 |
+
$warnings = array();
|
32 |
+
self::getReport(array($article), $warnings);
|
33 |
+
return $warnings;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Auxiliary method to do a recursive checker that will raise all warnings
|
38 |
+
* related to the element tree about the Instant Article.
|
39 |
+
* @param array $elements Element[] to all elements that will be checked.
|
40 |
+
* @param array $warnings string[] to all warnings related to the elements informed.
|
41 |
+
*/
|
42 |
+
public static function getReport($elements, &$warnings)
|
43 |
+
{
|
44 |
+
foreach ($elements as $element) {
|
45 |
+
if (!$element->isValid()) {
|
46 |
+
// Adds a warning to the result report.
|
47 |
+
$warnings[] = new ValidatorWarning($element);
|
48 |
+
}
|
49 |
+
if ($element instanceof Container) {
|
50 |
+
self::getReport($element->getContainerChildren(), $warnings);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Validators/Type.php
CHANGED
@@ -32,7 +32,7 @@ class Type
|
|
32 |
* @param mixed $var The object that will be verified
|
33 |
* @param mixed $types_allowed array of classes or one single class
|
34 |
* @return boolean true when success, or throws exception when not satisfied
|
35 |
-
* @throws InvalidArgumentException when $var
|
36 |
*/
|
37 |
public static function enforce($var, $types_allowed)
|
38 |
{
|
@@ -43,11 +43,12 @@ class Type
|
|
43 |
* This method checks if the $var param is instanceof one of the $types_allowed informed.
|
44 |
* It will return the success of the check.
|
45 |
*
|
46 |
-
* @param mixed $var The object that will be verified
|
47 |
-
* @param mixed $types_allowed array of classes or one single class
|
48 |
-
* @param boolean $enforce If informed with true, it works as (
|
49 |
-
* @return boolean true when success, false when failed the check
|
50 |
-
* @throws InvalidArgumentException if $enforced is true and $var
|
|
|
51 |
*/
|
52 |
public static function is($var, $types_allowed, $enforce = false)
|
53 |
{
|
@@ -75,14 +76,16 @@ class Type
|
|
75 |
/**
|
76 |
* Auxiliary function to check for the primitive types.
|
77 |
*
|
78 |
-
* @param $var the Variable that will be testRenderBasic
|
79 |
-
* @param $type one of the Type::const that will be the set of possible values for $var
|
80 |
*
|
81 |
* @see Type::STRING
|
82 |
* @see Type::INTEGER
|
83 |
* @see Type::FLOAT
|
84 |
* @see Type::BOOLEAN
|
85 |
* @see Type::ARRAY_TYPE
|
|
|
|
|
86 |
*/
|
87 |
private static function isPrimitive($var, $type)
|
88 |
{
|
@@ -107,8 +110,11 @@ class Type
|
|
107 |
* expectations an InvalidArgumentException will be thrown.
|
108 |
*
|
109 |
* @param array $var the target variable to be checked. REQUIRED must be array
|
110 |
-
* @param
|
111 |
-
*
|
|
|
|
|
|
|
112 |
*
|
113 |
* @see Type::STRING
|
114 |
* @see Type::INTEGER
|
@@ -124,11 +130,11 @@ class Type
|
|
124 |
|
125 |
/**
|
126 |
* Method that checks if all elements in one array comply with the types
|
127 |
-
* inside the $types_allowed. If any element on that array
|
128 |
* expectations false will be returned
|
129 |
*
|
130 |
* @param array $var the target variable to be checked. REQUIRED must be array
|
131 |
-
* @param array|
|
132 |
* @return true for success, false otherwise
|
133 |
*
|
134 |
* @see Type::STRING
|
@@ -182,8 +188,11 @@ class Type
|
|
182 |
/**
|
183 |
* Method that enforces the array size to be EXACTLY the $size informed. If
|
184 |
* the size differs from the $size it will throw InvalidArgumentException
|
|
|
185 |
* @param array $array the array that will be checked
|
186 |
* @param int $size The EXACTLY size that array must have
|
|
|
|
|
187 |
*/
|
188 |
public static function enforceArraySize($array, $size)
|
189 |
{
|
@@ -221,9 +230,13 @@ class Type
|
|
221 |
* the size is less than $min_size it will throw InvalidArgumentException
|
222 |
* I.e.: array (1,2,3), $min_size 3 = true
|
223 |
* I.e.: array (1,2,3), $min_size 4 = throws InvalidArgumentException
|
|
|
224 |
* @param array $array the array that will be checked
|
225 |
* @param int $min_size The EXACTLY size that array must have
|
226 |
-
*
|
|
|
|
|
|
|
227 |
*/
|
228 |
public static function enforceArraySizeGreaterThan($array, $min_size)
|
229 |
{
|
@@ -235,9 +248,11 @@ class Type
|
|
235 |
* the size is less than $min_size it will return false.
|
236 |
* I.e.: array (1,2,3), $min_size 3 = true
|
237 |
* I.e.: array (1,2,3), $min_size 4 = false
|
|
|
238 |
* @param array $array the array that will be checked
|
239 |
* @param int $min_size The minimum elements the array must have
|
240 |
-
*
|
|
|
241 |
*/
|
242 |
public static function isArraySizeGreaterThan($array, $min_size, $enforce = false)
|
243 |
{
|
@@ -263,9 +278,13 @@ class Type
|
|
263 |
* the size is more than $max_size it will throw InvalidArgumentException
|
264 |
* I.e.: array (1,2,3), $max_size 3 = true
|
265 |
* I.e.: array (1,2,3), $max_size 2 = throws InvalidArgumentException
|
|
|
266 |
* @param array $array the array that will be checked
|
267 |
-
* @param int $max_size The
|
268 |
-
*
|
|
|
|
|
|
|
269 |
*/
|
270 |
public static function enforceArraySizeLowerThan($array, $max_size)
|
271 |
{
|
@@ -277,10 +296,13 @@ class Type
|
|
277 |
* the size is more than $max_size it will return false
|
278 |
* I.e.: array (1,2,3), $max_size 3 = true
|
279 |
* I.e.: array (1,2,3), $max_size 2 = false
|
|
|
280 |
* @param array $array the array that will be checked
|
281 |
-
* @param int $max_size The
|
282 |
-
* @param boolean $enforce works as
|
283 |
-
* @
|
|
|
|
|
284 |
*/
|
285 |
public static function isArraySizeLowerThan($array, $max_size, $enforce = false)
|
286 |
{
|
@@ -302,7 +324,7 @@ class Type
|
|
302 |
}
|
303 |
|
304 |
/*
|
305 |
-
*
|
306 |
*/
|
307 |
private static function throwArrayException($array, $size, $message)
|
308 |
{
|
@@ -338,7 +360,7 @@ class Type
|
|
338 |
* @param mixed $value The value that will be verified
|
339 |
* @param array $universe The universe the $value must be in.
|
340 |
* @return true if the value is IN the universe, throws Exception otherwise.
|
341 |
-
* @throws InvalidArgumentException if the value not IN the expected universe.
|
342 |
*/
|
343 |
public static function enforceWithin($value, $universe)
|
344 |
{
|
@@ -347,19 +369,47 @@ class Type
|
|
347 |
|
348 |
private static function throwNotWithinException($value, $universe)
|
349 |
{
|
350 |
-
|
351 |
-
|
352 |
-
var_dump($value);
|
353 |
-
$value_str = ob_get_clean();
|
354 |
-
|
355 |
-
// stringify the $universe parameter
|
356 |
-
ob_start();
|
357 |
-
var_dump($universe);
|
358 |
-
$universe_str = ob_get_clean();
|
359 |
|
360 |
throw new \InvalidArgumentException(
|
361 |
"Method expects this value \n----[\n".$value_str."]----\n".
|
362 |
" to be within this universe of values \n====[\n".$universe_str."]===="
|
363 |
);
|
364 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
}
|
32 |
* @param mixed $var The object that will be verified
|
33 |
* @param mixed $types_allowed array of classes or one single class
|
34 |
* @return boolean true when success, or throws exception when not satisfied
|
35 |
+
* @throws \InvalidArgumentException when $var doesn't comply with $types_allowed
|
36 |
*/
|
37 |
public static function enforce($var, $types_allowed)
|
38 |
{
|
43 |
* This method checks if the $var param is instanceof one of the $types_allowed informed.
|
44 |
* It will return the success of the check.
|
45 |
*
|
46 |
+
* @param mixed $var The object that will be verified.
|
47 |
+
* @param mixed $types_allowed array of classes or one single class.
|
48 |
+
* @param boolean $enforce If informed with true, it works as (Type::enforce()) method.
|
49 |
+
* @return boolean true when success, false when failed the check.
|
50 |
+
* @throws \InvalidArgumentException if $enforced is true and $var doesn't comply with the $types_allowed.
|
51 |
+
* @see Type::enforce().
|
52 |
*/
|
53 |
public static function is($var, $types_allowed, $enforce = false)
|
54 |
{
|
76 |
/**
|
77 |
* Auxiliary function to check for the primitive types.
|
78 |
*
|
79 |
+
* @param mixed $var the Variable that will be testRenderBasic
|
80 |
+
* @param string $type one of the Type::const that will be the set of possible values for $var
|
81 |
*
|
82 |
* @see Type::STRING
|
83 |
* @see Type::INTEGER
|
84 |
* @see Type::FLOAT
|
85 |
* @see Type::BOOLEAN
|
86 |
* @see Type::ARRAY_TYPE
|
87 |
+
*
|
88 |
+
* @return bool
|
89 |
*/
|
90 |
private static function isPrimitive($var, $type)
|
91 |
{
|
110 |
* expectations an InvalidArgumentException will be thrown.
|
111 |
*
|
112 |
* @param array $var the target variable to be checked. REQUIRED must be array
|
113 |
+
* @param string|string[] $types_allowed The set of classes that $var will be checked against
|
114 |
+
*
|
115 |
+
* @return bool
|
116 |
+
*
|
117 |
+
* @throws \InvalidArgumentException when not all items in an array are from the types in $types_allowed
|
118 |
*
|
119 |
* @see Type::STRING
|
120 |
* @see Type::INTEGER
|
130 |
|
131 |
/**
|
132 |
* Method that checks if all elements in one array comply with the types
|
133 |
+
* inside the $types_allowed. If any element on that array doesn't meet the
|
134 |
* expectations false will be returned
|
135 |
*
|
136 |
* @param array $var the target variable to be checked. REQUIRED must be array
|
137 |
+
* @param array|string $types_allowed The set of classes that $var will be checked against
|
138 |
* @return true for success, false otherwise
|
139 |
*
|
140 |
* @see Type::STRING
|
188 |
/**
|
189 |
* Method that enforces the array size to be EXACTLY the $size informed. If
|
190 |
* the size differs from the $size it will throw InvalidArgumentException
|
191 |
+
*
|
192 |
* @param array $array the array that will be checked
|
193 |
* @param int $size The EXACTLY size that array must have
|
194 |
+
*
|
195 |
+
* @return bool
|
196 |
*/
|
197 |
public static function enforceArraySize($array, $size)
|
198 |
{
|
230 |
* the size is less than $min_size it will throw InvalidArgumentException
|
231 |
* I.e.: array (1,2,3), $min_size 3 = true
|
232 |
* I.e.: array (1,2,3), $min_size 4 = throws InvalidArgumentException
|
233 |
+
*
|
234 |
* @param array $array the array that will be checked
|
235 |
* @param int $min_size The EXACTLY size that array must have
|
236 |
+
*
|
237 |
+
* @return bool
|
238 |
+
*
|
239 |
+
* @throws \InvalidArgumentException if $array doesn't have at least $min_size items
|
240 |
*/
|
241 |
public static function enforceArraySizeGreaterThan($array, $min_size)
|
242 |
{
|
248 |
* the size is less than $min_size it will return false.
|
249 |
* I.e.: array (1,2,3), $min_size 3 = true
|
250 |
* I.e.: array (1,2,3), $min_size 4 = false
|
251 |
+
*
|
252 |
* @param array $array the array that will be checked
|
253 |
* @param int $min_size The minimum elements the array must have
|
254 |
+
*
|
255 |
+
* @return bool true if has at least $min_size, false otherwise
|
256 |
*/
|
257 |
public static function isArraySizeGreaterThan($array, $min_size, $enforce = false)
|
258 |
{
|
278 |
* the size is more than $max_size it will throw InvalidArgumentException
|
279 |
* I.e.: array (1,2,3), $max_size 3 = true
|
280 |
* I.e.: array (1,2,3), $max_size 2 = throws InvalidArgumentException
|
281 |
+
*
|
282 |
* @param array $array the array that will be checked
|
283 |
+
* @param int $max_size The maximum number of items the array can have
|
284 |
+
*
|
285 |
+
* @return bool
|
286 |
+
*
|
287 |
+
* @throws \InvalidArgumentException if $array have more than $max_size items
|
288 |
*/
|
289 |
public static function enforceArraySizeLowerThan($array, $max_size)
|
290 |
{
|
296 |
* the size is more than $max_size it will return false
|
297 |
* I.e.: array (1,2,3), $max_size 3 = true
|
298 |
* I.e.: array (1,2,3), $max_size 2 = false
|
299 |
+
*
|
300 |
* @param array $array the array that will be checked
|
301 |
+
* @param int $max_size The maximum number of items the array can have
|
302 |
+
* @param boolean $enforce works as Type::enforceArrayMaxSize().
|
303 |
+
* @see Type::enforceArrayMaxSize().
|
304 |
+
*
|
305 |
+
* @return bool true if it has less elements than $max_size, false otherwise
|
306 |
*/
|
307 |
public static function isArraySizeLowerThan($array, $max_size, $enforce = false)
|
308 |
{
|
324 |
}
|
325 |
|
326 |
/*
|
327 |
+
* Utility method that constructs the message about array sizes an throws.
|
328 |
*/
|
329 |
private static function throwArrayException($array, $size, $message)
|
330 |
{
|
360 |
* @param mixed $value The value that will be verified
|
361 |
* @param array $universe The universe the $value must be in.
|
362 |
* @return true if the value is IN the universe, throws Exception otherwise.
|
363 |
+
* @throws \InvalidArgumentException if the value not IN the expected universe.
|
364 |
*/
|
365 |
public static function enforceWithin($value, $universe)
|
366 |
{
|
369 |
|
370 |
private static function throwNotWithinException($value, $universe)
|
371 |
{
|
372 |
+
$value_str = self::stringify($value);
|
373 |
+
$universe_str = self::stringify($universe);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
|
375 |
throw new \InvalidArgumentException(
|
376 |
"Method expects this value \n----[\n".$value_str."]----\n".
|
377 |
" to be within this universe of values \n====[\n".$universe_str."]===="
|
378 |
);
|
379 |
}
|
380 |
+
|
381 |
+
/**
|
382 |
+
* Checks the thext if it is empty.
|
383 |
+
* Examples:
|
384 |
+
* "" => true
|
385 |
+
* " " => true
|
386 |
+
* "\n" => true
|
387 |
+
* "a" => false
|
388 |
+
* " a " => false
|
389 |
+
*
|
390 |
+
* @param string $text The text that will be checked.
|
391 |
+
* @return true if empty, false otherwise.
|
392 |
+
*/
|
393 |
+
public static function isTextEmpty($text)
|
394 |
+
{
|
395 |
+
if (!isset($text) || $text === null || !self::is($text, self::STRING)) {
|
396 |
+
return true;
|
397 |
+
}
|
398 |
+
// Stripes empty spaces, , <br/>, new lines
|
399 |
+
$text = strip_tags($text);
|
400 |
+
$text = preg_replace("/[\r\n\s]+/", "", $text);
|
401 |
+
$text = str_replace(" ", "", $text);
|
402 |
+
|
403 |
+
return empty($text);
|
404 |
+
}
|
405 |
+
|
406 |
+
/**
|
407 |
+
* Auxiliary method that stringify an object as var_dump does.
|
408 |
+
* @return string $object var_dump result.
|
409 |
+
*/
|
410 |
+
public static function stringify($object)
|
411 |
+
{
|
412 |
+
// stringify the $object parameter
|
413 |
+
return var_export($object, true);
|
414 |
+
}
|
415 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Client/ClientExceptionTest.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Facebook\InstantArticles\Client;
|
4 |
+
|
5 |
+
class ClientExceptionTest extends \PHPUnit_Framework_TestCase
|
6 |
+
{
|
7 |
+
public function testExtendsException()
|
8 |
+
{
|
9 |
+
$exception = new ClientException();
|
10 |
+
|
11 |
+
$this->assertInstanceOf('Exception', $exception);
|
12 |
+
}
|
13 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Client/ClientTest.php
CHANGED
@@ -76,18 +76,18 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|
76 |
|
77 |
// Use a mocked client with stubbed getArticleIDFromCanonicalURL().
|
78 |
$this->client = $this->getMockBuilder('Facebook\InstantArticles\Client\Client')
|
79 |
-
->setMethods(
|
80 |
-
->setConstructorArgs(
|
81 |
$this->facebook,
|
82 |
"PAGE_ID",
|
83 |
true // developmentMode
|
84 |
-
)
|
85 |
|
86 |
$this->client
|
87 |
->expects($this->once())
|
88 |
->method('getArticleIDFromCanonicalURL')
|
89 |
->with($canonicalURL)
|
90 |
-
->
|
91 |
|
92 |
$this->facebook
|
93 |
->expects($this->once())
|
@@ -158,21 +158,21 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|
158 |
->expects($this->once())
|
159 |
->method('getField')
|
160 |
->with($this->equalTo('id'))
|
161 |
-
->
|
162 |
$graphNodeMock
|
163 |
->expects($this->once())
|
164 |
->method('getField')
|
165 |
->with($this->equalTo('instant_article'))
|
166 |
-
->
|
167 |
$serverResponseMock
|
168 |
->expects($this->once())
|
169 |
->method('getGraphNode')
|
170 |
-
->
|
171 |
$this->facebook
|
172 |
->expects($this->once())
|
173 |
->method('get')
|
174 |
->with($this->equalTo('?id='.$canonicalURL.'&fields=instant_article'))
|
175 |
-
->
|
176 |
|
177 |
$articleID = $this->client->getArticleIDFromCanonicalURL($canonicalURL);
|
178 |
$this->assertEquals($expectedArticleID, $articleID);
|
@@ -197,16 +197,16 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|
197 |
->expects($this->once())
|
198 |
->method('getField')
|
199 |
->with($this->equalTo('instant_article'))
|
200 |
-
->
|
201 |
$serverResponseMock
|
202 |
->expects($this->once())
|
203 |
->method('getGraphNode')
|
204 |
-
->
|
205 |
$this->facebook
|
206 |
->expects($this->once())
|
207 |
->method('get')
|
208 |
->with($this->equalTo('?id='.$canonicalURL.'&fields=instant_article'))
|
209 |
-
->
|
210 |
|
211 |
$articleID = $this->client->getArticleIDFromCanonicalURL($canonicalURL);
|
212 |
$this->assertEquals($expectedArticleID, $articleID);
|
@@ -229,71 +229,71 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|
229 |
->expects($this->once())
|
230 |
->method('getField')
|
231 |
->with($this->equalTo('most_recent_import_status'))
|
232 |
-
->
|
233 |
"status" => "success",
|
234 |
-
"errors" =>
|
235 |
-
|
236 |
"level" => "warning",
|
237 |
"message" => "Test warning"
|
238 |
-
|
239 |
-
|
240 |
"level" => "fatal",
|
241 |
"message" => "Test fatal"
|
242 |
-
|
243 |
-
|
244 |
"level" => "error",
|
245 |
"message" => "Test error"
|
246 |
-
|
247 |
-
|
248 |
"level" => "info",
|
249 |
"message" => "Test info"
|
250 |
-
|
251 |
-
|
252 |
-
)
|
253 |
|
254 |
$serverResponseMock
|
255 |
->expects($this->once())
|
256 |
->method('getGraphNode')
|
257 |
-
->
|
258 |
$this->facebook
|
259 |
->expects($this->once())
|
260 |
->method('get')
|
261 |
->with($this->equalTo($articleID . '?fields=most_recent_import_status'))
|
262 |
-
->
|
263 |
|
264 |
$status = $this->client->getLastSubmissionStatus($articleID);
|
265 |
-
$this->assertEquals($status->getStatus()
|
266 |
$this->assertEquals(
|
267 |
-
|
268 |
-
|
269 |
);
|
270 |
$this->assertEquals(
|
271 |
-
|
272 |
-
|
273 |
);
|
274 |
$this->assertEquals(
|
275 |
$status->getMessages()[1]->getLevel(),
|
276 |
ServerMessage::FATAL
|
277 |
);
|
278 |
$this->assertEquals(
|
279 |
-
|
280 |
-
|
281 |
);
|
282 |
$this->assertEquals(
|
283 |
-
|
284 |
-
|
285 |
);
|
286 |
$this->assertEquals(
|
287 |
-
|
288 |
-
|
289 |
);
|
290 |
$this->assertEquals(
|
291 |
-
|
292 |
-
|
293 |
);
|
294 |
$this->assertEquals(
|
295 |
-
|
296 |
-
|
297 |
);
|
298 |
}
|
299 |
}
|
76 |
|
77 |
// Use a mocked client with stubbed getArticleIDFromCanonicalURL().
|
78 |
$this->client = $this->getMockBuilder('Facebook\InstantArticles\Client\Client')
|
79 |
+
->setMethods(['getArticleIDFromCanonicalURL'])
|
80 |
+
->setConstructorArgs([
|
81 |
$this->facebook,
|
82 |
"PAGE_ID",
|
83 |
true // developmentMode
|
84 |
+
])->getMock();
|
85 |
|
86 |
$this->client
|
87 |
->expects($this->once())
|
88 |
->method('getArticleIDFromCanonicalURL')
|
89 |
->with($canonicalURL)
|
90 |
+
->willReturn($articleID);
|
91 |
|
92 |
$this->facebook
|
93 |
->expects($this->once())
|
158 |
->expects($this->once())
|
159 |
->method('getField')
|
160 |
->with($this->equalTo('id'))
|
161 |
+
->willReturn($expectedArticleID);
|
162 |
$graphNodeMock
|
163 |
->expects($this->once())
|
164 |
->method('getField')
|
165 |
->with($this->equalTo('instant_article'))
|
166 |
+
->willReturn($instantArticleMock);
|
167 |
$serverResponseMock
|
168 |
->expects($this->once())
|
169 |
->method('getGraphNode')
|
170 |
+
->willReturn($graphNodeMock);
|
171 |
$this->facebook
|
172 |
->expects($this->once())
|
173 |
->method('get')
|
174 |
->with($this->equalTo('?id='.$canonicalURL.'&fields=instant_article'))
|
175 |
+
->willReturn($serverResponseMock);
|
176 |
|
177 |
$articleID = $this->client->getArticleIDFromCanonicalURL($canonicalURL);
|
178 |
$this->assertEquals($expectedArticleID, $articleID);
|
197 |
->expects($this->once())
|
198 |
->method('getField')
|
199 |
->with($this->equalTo('instant_article'))
|
200 |
+
->willReturn(null);
|
201 |
$serverResponseMock
|
202 |
->expects($this->once())
|
203 |
->method('getGraphNode')
|
204 |
+
->willReturn($graphNodeMock);
|
205 |
$this->facebook
|
206 |
->expects($this->once())
|
207 |
->method('get')
|
208 |
->with($this->equalTo('?id='.$canonicalURL.'&fields=instant_article'))
|
209 |
+
->willReturn($serverResponseMock);
|
210 |
|
211 |
$articleID = $this->client->getArticleIDFromCanonicalURL($canonicalURL);
|
212 |
$this->assertEquals($expectedArticleID, $articleID);
|
229 |
->expects($this->once())
|
230 |
->method('getField')
|
231 |
->with($this->equalTo('most_recent_import_status'))
|
232 |
+
->willReturn([
|
233 |
"status" => "success",
|
234 |
+
"errors" => [
|
235 |
+
[
|
236 |
"level" => "warning",
|
237 |
"message" => "Test warning"
|
238 |
+
],
|
239 |
+
[
|
240 |
"level" => "fatal",
|
241 |
"message" => "Test fatal"
|
242 |
+
],
|
243 |
+
[
|
244 |
"level" => "error",
|
245 |
"message" => "Test error"
|
246 |
+
],
|
247 |
+
[
|
248 |
"level" => "info",
|
249 |
"message" => "Test info"
|
250 |
+
]
|
251 |
+
]
|
252 |
+
]);
|
253 |
|
254 |
$serverResponseMock
|
255 |
->expects($this->once())
|
256 |
->method('getGraphNode')
|
257 |
+
->willReturn($graphNodeMock);
|
258 |
$this->facebook
|
259 |
->expects($this->once())
|
260 |
->method('get')
|
261 |
->with($this->equalTo($articleID . '?fields=most_recent_import_status'))
|
262 |
+
->willReturn($serverResponseMock);
|
263 |
|
264 |
$status = $this->client->getLastSubmissionStatus($articleID);
|
265 |
+
$this->assertEquals(InstantArticleStatus::SUCCESS, $status->getStatus());
|
266 |
$this->assertEquals(
|
267 |
+
ServerMessage::WARNING,
|
268 |
+
$status->getMessages()[0]->getLevel()
|
269 |
);
|
270 |
$this->assertEquals(
|
271 |
+
'Test warning',
|
272 |
+
$status->getMessages()[0]->getMessage()
|
273 |
);
|
274 |
$this->assertEquals(
|
275 |
$status->getMessages()[1]->getLevel(),
|
276 |
ServerMessage::FATAL
|
277 |
);
|
278 |
$this->assertEquals(
|
279 |
+
'Test fatal',
|
280 |
+
$status->getMessages()[1]->getMessage()
|
281 |
);
|
282 |
$this->assertEquals(
|
283 |
+
ServerMessage::ERROR,
|
284 |
+
$status->getMessages()[2]->getLevel()
|
285 |
);
|
286 |
$this->assertEquals(
|
287 |
+
'Test error',
|
288 |
+
$status->getMessages()[2]->getMessage()
|
289 |
);
|
290 |
$this->assertEquals(
|
291 |
+
ServerMessage::INFO,
|
292 |
+
$status->getMessages()[3]->getLevel()
|
293 |
);
|
294 |
$this->assertEquals(
|
295 |
+
'Test info',
|
296 |
+
$status->getMessages()[3]->getMessage()
|
297 |
);
|
298 |
}
|
299 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Client/HelperTest.php
CHANGED
@@ -27,7 +27,7 @@ class HelperTest extends \PHPUnit_Framework_TestCase
|
|
27 |
|
28 |
public function testGetPagesAndTokes()
|
29 |
{
|
30 |
-
$pagesAndTokens =
|
31 |
|
32 |
$accessToken =
|
33 |
$this->getMockBuilder('Facebook\Authentication\AccessToken')
|
@@ -36,7 +36,7 @@ class HelperTest extends \PHPUnit_Framework_TestCase
|
|
36 |
$accessToken
|
37 |
->expects($this->once())
|
38 |
->method('isLongLived')
|
39 |
-
->
|
40 |
$this->facebook
|
41 |
->expects($this->once())
|
42 |
->method('setDefaultAccessToken')
|
@@ -49,15 +49,15 @@ class HelperTest extends \PHPUnit_Framework_TestCase
|
|
49 |
$response
|
50 |
->expects($this->once())
|
51 |
->method('getGraphEdge')
|
52 |
-
->
|
53 |
|
54 |
$this->facebook
|
55 |
->expects($this->once())
|
56 |
->method('get')
|
57 |
->with('/me/accounts?fields=name,id,access_token,supports_instant_articles')
|
58 |
-
->
|
59 |
|
60 |
$pagesAndTokensReturned = $this->helper->getPagesAndTokens($accessToken);
|
61 |
-
$this->assertEquals($
|
62 |
}
|
63 |
}
|
27 |
|
28 |
public function testGetPagesAndTokes()
|
29 |
{
|
30 |
+
$pagesAndTokens = ['page' => 'token'];
|
31 |
|
32 |
$accessToken =
|
33 |
$this->getMockBuilder('Facebook\Authentication\AccessToken')
|
36 |
$accessToken
|
37 |
->expects($this->once())
|
38 |
->method('isLongLived')
|
39 |
+
->willReturn(true);
|
40 |
$this->facebook
|
41 |
->expects($this->once())
|
42 |
->method('setDefaultAccessToken')
|
49 |
$response
|
50 |
->expects($this->once())
|
51 |
->method('getGraphEdge')
|
52 |
+
->willReturn($pagesAndTokens);
|
53 |
|
54 |
$this->facebook
|
55 |
->expects($this->once())
|
56 |
->method('get')
|
57 |
->with('/me/accounts?fields=name,id,access_token,supports_instant_articles')
|
58 |
+
->willReturn($response);
|
59 |
|
60 |
$pagesAndTokensReturned = $this->helper->getPagesAndTokens($accessToken);
|
61 |
+
$this->assertEquals($pagesAndTokens, $pagesAndTokensReturned);
|
62 |
}
|
63 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/AdTest.php
CHANGED
@@ -8,22 +8,33 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
|
12 |
class AdTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
|
|
|
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
19 |
{
|
|
|
|
|
20 |
$ad =
|
21 |
Ad::create()
|
22 |
-
->withSource(
|
23 |
|
24 |
$expected =
|
25 |
'<figure class="op-ad">'.
|
26 |
-
'<iframe src="
|
27 |
'</figure>';
|
28 |
|
29 |
$rendered = $ad->render();
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
+
use Facebook\InstantArticles\Transformer\GeneratorTrait;
|
12 |
|
13 |
class AdTest extends \PHPUnit_Framework_TestCase
|
14 |
{
|
15 |
+
use GeneratorTrait;
|
16 |
+
|
17 |
+
public function testRenderEmpty()
|
18 |
{
|
19 |
+
$ad = Ad::create();
|
20 |
+
|
21 |
+
$expected = '';
|
22 |
+
|
23 |
+
$rendered = $ad->render();
|
24 |
+
$this->assertEquals($expected, $rendered);
|
25 |
}
|
26 |
|
27 |
public function testRenderBasic()
|
28 |
{
|
29 |
+
$source = $this->getFaker()->url;
|
30 |
+
|
31 |
$ad =
|
32 |
Ad::create()
|
33 |
+
->withSource($source);
|
34 |
|
35 |
$expected =
|
36 |
'<figure class="op-ad">'.
|
37 |
+
'<iframe src="'. $source . '"></iframe>'.
|
38 |
'</figure>';
|
39 |
|
40 |
$rendered = $ad->render();
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/AnalyticsTest.php
CHANGED
@@ -8,11 +8,17 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class AnalyticsTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class AnalyticsTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$analytics =
|
16 |
+
Analytics::create();
|
17 |
+
|
18 |
+
$expected = '';
|
19 |
+
|
20 |
+
$rendered = $analytics->render();
|
21 |
+
$this->assertEquals($expected, $rendered);
|
22 |
}
|
23 |
|
24 |
public function testRenderBasic()
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/AudioTest.php
CHANGED
@@ -8,18 +8,23 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class AudioTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
19 |
{
|
20 |
$audio =
|
21 |
-
|
22 |
-
|
23 |
|
24 |
$expected =
|
25 |
'<audio>'.
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class AudioTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$audio = Audio::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $audio->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
}
|
22 |
|
23 |
public function testRenderBasic()
|
24 |
{
|
25 |
$audio =
|
26 |
+
Audio::create()
|
27 |
+
->withURL('http://foo.com/mp3');
|
28 |
|
29 |
$expected =
|
30 |
'<audio>'.
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/AuthorTest.php
CHANGED
@@ -8,11 +8,17 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class AuthorTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderAuthorWithFB()
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class AuthorTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$author =
|
16 |
+
Author::create();
|
17 |
+
|
18 |
+
$expected = '';
|
19 |
+
|
20 |
+
$rendered = $author->render();
|
21 |
+
$this->assertEquals($expected, $rendered);
|
22 |
}
|
23 |
|
24 |
public function testRenderAuthorWithFB()
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/BlockquoteTest.php
CHANGED
@@ -8,11 +8,16 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class BlockquoteTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class BlockquoteTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$blockquote = Blockquote::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $blockquote->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
}
|
22 |
|
23 |
public function testRenderBasic()
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/CaptionTest.php
CHANGED
@@ -8,11 +8,16 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class CaptionTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
@@ -69,7 +74,7 @@ class CaptionTest extends \PHPUnit_Framework_TestCase
|
|
69 |
$caption =
|
70 |
Caption::create()
|
71 |
->appendText('Caption Title')
|
72 |
-
->
|
73 |
|
74 |
$expected =
|
75 |
'<figcaption class="op-vertical-below">'.
|
@@ -118,7 +123,7 @@ class CaptionTest extends \PHPUnit_Framework_TestCase
|
|
118 |
Caption::create()
|
119 |
->appendText('Caption Title')
|
120 |
->withFontsize(Caption::SIZE_LARGE)
|
121 |
-
->
|
122 |
->withTextAlignment(Caption::ALIGN_LEFT);
|
123 |
|
124 |
$expected =
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class CaptionTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$caption = Caption::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $caption->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
}
|
22 |
|
23 |
public function testRenderBasic()
|
74 |
$caption =
|
75 |
Caption::create()
|
76 |
->appendText('Caption Title')
|
77 |
+
->withPosition(Caption::POSITION_BELOW);
|
78 |
|
79 |
$expected =
|
80 |
'<figcaption class="op-vertical-below">'.
|
123 |
Caption::create()
|
124 |
->appendText('Caption Title')
|
125 |
->withFontsize(Caption::SIZE_LARGE)
|
126 |
+
->withPosition(Caption::POSITION_BELOW)
|
127 |
->withTextAlignment(Caption::ALIGN_LEFT);
|
128 |
|
129 |
$expected =
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/CiteTest.php
CHANGED
@@ -8,11 +8,16 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class CiteTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
@@ -35,7 +40,7 @@ class CiteTest extends \PHPUnit_Framework_TestCase
|
|
35 |
$cite =
|
36 |
Cite::create()
|
37 |
->appendText('Citation simple text.')
|
38 |
-
->
|
39 |
|
40 |
$expected =
|
41 |
'<cite class="op-vertical-above">'.
|
@@ -67,7 +72,7 @@ class CiteTest extends \PHPUnit_Framework_TestCase
|
|
67 |
$cite =
|
68 |
Cite::create()
|
69 |
->appendText('Citation simple text.')
|
70 |
-
->
|
71 |
->withTextAlignment(Caption::ALIGN_LEFT);
|
72 |
|
73 |
$expected =
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class CiteTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$cite = Cite::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $cite->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
}
|
22 |
|
23 |
public function testRenderBasic()
|
40 |
$cite =
|
41 |
Cite::create()
|
42 |
->appendText('Citation simple text.')
|
43 |
+
->withPosition(Caption::POSITION_ABOVE);
|
44 |
|
45 |
$expected =
|
46 |
'<cite class="op-vertical-above">'.
|
72 |
$cite =
|
73 |
Cite::create()
|
74 |
->appendText('Citation simple text.')
|
75 |
+
->withPosition(Caption::POSITION_ABOVE)
|
76 |
->withTextAlignment(Caption::ALIGN_LEFT);
|
77 |
|
78 |
$expected =
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/FooterTest.php
CHANGED
@@ -8,11 +8,16 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class FooterTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class FooterTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$footer = Footer::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $footer->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
}
|
22 |
|
23 |
public function testRenderBasic()
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/GeoTagTest.php
CHANGED
@@ -8,29 +8,35 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class GeoTagTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderWithGeotag()
|
19 |
{
|
20 |
-
$script =
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
34 |
|
35 |
$geo_tag = GeoTag::create()->withScript($script);
|
36 |
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class GeoTagTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$geo_tag = GeoTag::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $geo_tag->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
}
|
22 |
|
23 |
public function testRenderWithGeotag()
|
24 |
{
|
25 |
+
$script = <<<'JSON'
|
26 |
+
{
|
27 |
+
"type": "Feature",
|
28 |
+
"geometry": {
|
29 |
+
"type": "Point",
|
30 |
+
"coordinates": [23.166667, 89.216667]
|
31 |
+
},
|
32 |
+
"properties": {
|
33 |
+
"title": "Jessore, Bangladesh",
|
34 |
+
"radius": 750000,
|
35 |
+
"pivot": true,
|
36 |
+
"style": "satellite"
|
37 |
+
}
|
38 |
+
}
|
39 |
+
JSON;
|
40 |
|
41 |
$geo_tag = GeoTag::create()->withScript($script);
|
42 |
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/H1Test.php
CHANGED
@@ -8,11 +8,16 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class H1Test extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
@@ -35,7 +40,7 @@ class H1Test extends \PHPUnit_Framework_TestCase
|
|
35 |
$h1 =
|
36 |
H1::create()
|
37 |
->appendText('Title simple text.')
|
38 |
-
->
|
39 |
|
40 |
$expected =
|
41 |
'<h1 class="op-vertical-above">'.
|
@@ -67,7 +72,7 @@ class H1Test extends \PHPUnit_Framework_TestCase
|
|
67 |
$h1 =
|
68 |
H1::create()
|
69 |
->appendText('Title simple text.')
|
70 |
-
->
|
71 |
->withTextAlignment(Caption::ALIGN_LEFT);
|
72 |
|
73 |
$expected =
|
@@ -158,4 +163,64 @@ class H1Test extends \PHPUnit_Framework_TestCase
|
|
158 |
$rendered = $h1->render();
|
159 |
$this->assertEquals($expected, $rendered);
|
160 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
}
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class H1Test extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$h1 = H1::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $h1->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
}
|
22 |
|
23 |
public function testRenderBasic()
|
40 |
$h1 =
|
41 |
H1::create()
|
42 |
->appendText('Title simple text.')
|
43 |
+
->withPosition(Caption::POSITION_ABOVE);
|
44 |
|
45 |
$expected =
|
46 |
'<h1 class="op-vertical-above">'.
|
72 |
$h1 =
|
73 |
H1::create()
|
74 |
->appendText('Title simple text.')
|
75 |
+
->withPosition(Caption::POSITION_ABOVE)
|
76 |
->withTextAlignment(Caption::ALIGN_LEFT);
|
77 |
|
78 |
$expected =
|
163 |
$rendered = $h1->render();
|
164 |
$this->assertEquals($expected, $rendered);
|
165 |
}
|
166 |
+
|
167 |
+
public function testRenderEmptySpace()
|
168 |
+
{
|
169 |
+
$h1 =
|
170 |
+
H1::create()
|
171 |
+
->appendText('');
|
172 |
+
|
173 |
+
$expected = '';
|
174 |
+
|
175 |
+
$rendered = $h1->render();
|
176 |
+
$this->assertEquals($expected, $rendered);
|
177 |
+
}
|
178 |
+
|
179 |
+
public function testRenderEmptyNBSP()
|
180 |
+
{
|
181 |
+
$h1 =
|
182 |
+
H1::create()
|
183 |
+
->appendText(' ');
|
184 |
+
|
185 |
+
$expected = '';
|
186 |
+
|
187 |
+
$rendered = $h1->render();
|
188 |
+
$this->assertEquals($expected, $rendered);
|
189 |
+
}
|
190 |
+
|
191 |
+
public function testRenderEmptySpaces()
|
192 |
+
{
|
193 |
+
$h1 =
|
194 |
+
H1::create()
|
195 |
+
->appendText(' ');
|
196 |
+
|
197 |
+
$expected = '';
|
198 |
+
|
199 |
+
$rendered = $h1->render();
|
200 |
+
$this->assertEquals($expected, $rendered);
|
201 |
+
}
|
202 |
+
|
203 |
+
public function testRenderWhiteSpaceChars()
|
204 |
+
{
|
205 |
+
$h1 =
|
206 |
+
H1::create()
|
207 |
+
->appendText("\t\n\r");
|
208 |
+
|
209 |
+
$expected = '';
|
210 |
+
|
211 |
+
$rendered = $h1->render();
|
212 |
+
$this->assertEquals($expected, $rendered);
|
213 |
+
}
|
214 |
+
|
215 |
+
public function testRenderEmptyFormatted()
|
216 |
+
{
|
217 |
+
$h1 =
|
218 |
+
H1::create()
|
219 |
+
->appendText(Bold::create()->appendText(' '));
|
220 |
+
|
221 |
+
$expected = '';
|
222 |
+
|
223 |
+
$rendered = $h1->render();
|
224 |
+
$this->assertEquals($expected, $rendered);
|
225 |
+
}
|
226 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/H2Test.php
CHANGED
@@ -8,11 +8,16 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class H2Test extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
@@ -35,7 +40,7 @@ class H2Test extends \PHPUnit_Framework_TestCase
|
|
35 |
$h2 =
|
36 |
H2::create()
|
37 |
->appendText('Sub title simple text.')
|
38 |
-
->
|
39 |
|
40 |
$expected =
|
41 |
'<h2 class="op-vertical-above">'.
|
@@ -67,7 +72,7 @@ class H2Test extends \PHPUnit_Framework_TestCase
|
|
67 |
$h2 =
|
68 |
H2::create()
|
69 |
->appendText('Sub title simple text.')
|
70 |
-
->
|
71 |
->withTextAlignment(Caption::ALIGN_LEFT);
|
72 |
|
73 |
$expected =
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class H2Test extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$h2 = H2::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $h2->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
}
|
22 |
|
23 |
public function testRenderBasic()
|
40 |
$h2 =
|
41 |
H2::create()
|
42 |
->appendText('Sub title simple text.')
|
43 |
+
->withPosition(Caption::POSITION_ABOVE);
|
44 |
|
45 |
$expected =
|
46 |
'<h2 class="op-vertical-above">'.
|
72 |
$h2 =
|
73 |
H2::create()
|
74 |
->appendText('Sub title simple text.')
|
75 |
+
->withPosition(Caption::POSITION_ABOVE)
|
76 |
->withTextAlignment(Caption::ALIGN_LEFT);
|
77 |
|
78 |
$expected =
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/H3Test.php
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* This source code is licensed under the license found in the
|
7 |
+
* LICENSE file in the root directory of this source tree.
|
8 |
+
*/
|
9 |
+
namespace Facebook\InstantArticles\Elements;
|
10 |
+
|
11 |
+
class H3Test extends \PHPUnit_Framework_TestCase
|
12 |
+
{
|
13 |
+
public function testRenderEmpty()
|
14 |
+
{
|
15 |
+
$h3 = H3::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $h3->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
+
}
|
22 |
+
|
23 |
+
public function testRenderBasic()
|
24 |
+
{
|
25 |
+
$h3 =
|
26 |
+
H3::create()
|
27 |
+
->appendText('Sub title simple text.');
|
28 |
+
|
29 |
+
$expected =
|
30 |
+
'<h3>'.
|
31 |
+
'Sub title simple text.'.
|
32 |
+
'</h3>';
|
33 |
+
|
34 |
+
$rendered = $h3->render();
|
35 |
+
$this->assertEquals($expected, $rendered);
|
36 |
+
}
|
37 |
+
|
38 |
+
public function testRenderWithPosition()
|
39 |
+
{
|
40 |
+
$h3 =
|
41 |
+
H3::create()
|
42 |
+
->appendText('Sub title simple text.')
|
43 |
+
->withPosition(Caption::POSITION_ABOVE);
|
44 |
+
|
45 |
+
$expected =
|
46 |
+
'<h3 class="op-vertical-above">'.
|
47 |
+
'Sub title simple text.'.
|
48 |
+
'</h3>';
|
49 |
+
|
50 |
+
$rendered = $h3->render();
|
51 |
+
$this->assertEquals($expected, $rendered);
|
52 |
+
}
|
53 |
+
|
54 |
+
public function testRenderWithTextAlign()
|
55 |
+
{
|
56 |
+
$h3 =
|
57 |
+
H3::create()
|
58 |
+
->appendText('Sub title simple text.')
|
59 |
+
->withTextAlignment(Caption::ALIGN_LEFT);
|
60 |
+
|
61 |
+
$expected =
|
62 |
+
'<h3 class="op-left">'.
|
63 |
+
'Sub title simple text.'.
|
64 |
+
'</h3>';
|
65 |
+
|
66 |
+
$rendered = $h3->render();
|
67 |
+
$this->assertEquals($expected, $rendered);
|
68 |
+
}
|
69 |
+
|
70 |
+
public function testRenderWithPositionAndAlignment()
|
71 |
+
{
|
72 |
+
$h3 =
|
73 |
+
H3::create()
|
74 |
+
->appendText('Sub title simple text.')
|
75 |
+
->withPosition(Caption::POSITION_ABOVE)
|
76 |
+
->withTextAlignment(Caption::ALIGN_LEFT);
|
77 |
+
|
78 |
+
$expected =
|
79 |
+
'<h3 class="op-vertical-above op-left">'.
|
80 |
+
'Sub title simple text.'.
|
81 |
+
'</h3>';
|
82 |
+
|
83 |
+
$rendered = $h3->render();
|
84 |
+
$this->assertEquals($expected, $rendered);
|
85 |
+
}
|
86 |
+
|
87 |
+
public function testRenderWithUnescapedHTML()
|
88 |
+
{
|
89 |
+
$h3 =
|
90 |
+
H3::create()
|
91 |
+
->appendText(
|
92 |
+
'<b>Some</b> text to be <i>within</i> a <em>paragraph</em> for <strong>testing.</strong>'
|
93 |
+
);
|
94 |
+
|
95 |
+
$expected =
|
96 |
+
'<h3>'.
|
97 |
+
'<b>Some</b> text to be <i>within</i> a'.
|
98 |
+
' <em>paragraph</em> for <strong>testing.</strong>'.
|
99 |
+
'</h3>';
|
100 |
+
|
101 |
+
$rendered = $h3->render();
|
102 |
+
$this->assertEquals($expected, $rendered);
|
103 |
+
}
|
104 |
+
|
105 |
+
public function testRenderWithFormattedText()
|
106 |
+
{
|
107 |
+
$h3 =
|
108 |
+
H3::create()
|
109 |
+
->appendText(Bold::create()->appendText('Some'))
|
110 |
+
->appendText(' text to be ')
|
111 |
+
->appendText(Italic::create()->appendText('within'))
|
112 |
+
->appendText(' a ')
|
113 |
+
->appendText(Italic::create()->appendText('paragraph'))
|
114 |
+
->appendText(' for ')
|
115 |
+
->appendText(Bold::create()->appendText('testing.'));
|
116 |
+
|
117 |
+
$expected =
|
118 |
+
'<h3>'.
|
119 |
+
'<b>Some</b> text to be <i>within</i> a <i>paragraph</i> for <b>testing.</b>'.
|
120 |
+
'</h3>';
|
121 |
+
|
122 |
+
$rendered = $h3->render();
|
123 |
+
$this->assertEquals($expected, $rendered);
|
124 |
+
}
|
125 |
+
|
126 |
+
public function testRenderWithLink()
|
127 |
+
{
|
128 |
+
$h3 =
|
129 |
+
H3::create()
|
130 |
+
->appendText('Some ')
|
131 |
+
->appendText(
|
132 |
+
Anchor::create()
|
133 |
+
->withHRef('http://foo.com')
|
134 |
+
->appendText('link')
|
135 |
+
)
|
136 |
+
->appendText('.');
|
137 |
+
|
138 |
+
$expected =
|
139 |
+
'<h3>'.
|
140 |
+
'Some <a href="http://foo.com">link</a>.'.
|
141 |
+
'</h3>';
|
142 |
+
|
143 |
+
$rendered = $h3->render();
|
144 |
+
$this->assertEquals($expected, $rendered);
|
145 |
+
}
|
146 |
+
|
147 |
+
public function testRenderWithNestedFormattedText()
|
148 |
+
{
|
149 |
+
$h3 =
|
150 |
+
H3::create()
|
151 |
+
->appendText(
|
152 |
+
Bold::create()
|
153 |
+
->appendText('Some ')
|
154 |
+
->appendText(Italic::create()->appendText('nested formatting'))
|
155 |
+
->appendText('.')
|
156 |
+
);
|
157 |
+
|
158 |
+
$expected =
|
159 |
+
'<h3>'.
|
160 |
+
'<b>Some <i>nested formatting</i>.</b>'.
|
161 |
+
'</h3>';
|
162 |
+
|
163 |
+
$rendered = $h3->render();
|
164 |
+
$this->assertEquals($expected, $rendered);
|
165 |
+
}
|
166 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/HeaderTest.php
CHANGED
@@ -10,6 +10,15 @@ namespace Facebook\InstantArticles\Elements;
|
|
10 |
|
11 |
class HeaderTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
public function testCompleteHeader()
|
14 |
{
|
15 |
date_default_timezone_set('UTC');
|
@@ -120,7 +129,7 @@ class HeaderTest extends \PHPUnit_Framework_TestCase
|
|
120 |
$this->assertEquals($expected, $rendered);
|
121 |
}
|
122 |
|
123 |
-
|
124 |
{
|
125 |
$header =
|
126 |
Header::create()
|
@@ -144,4 +153,65 @@ class HeaderTest extends \PHPUnit_Framework_TestCase
|
|
144 |
|
145 |
$this->assertEquals($expected, $rendered);
|
146 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
}
|
10 |
|
11 |
class HeaderTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
|
14 |
+
public function testHeaderEmpty()
|
15 |
+
{
|
16 |
+
$header = Header::create();
|
17 |
+
$expected = '';
|
18 |
+
$rendered = $header->render();
|
19 |
+
$this->assertEquals($expected, $rendered);
|
20 |
+
}
|
21 |
+
|
22 |
public function testCompleteHeader()
|
23 |
{
|
24 |
date_default_timezone_set('UTC');
|
129 |
$this->assertEquals($expected, $rendered);
|
130 |
}
|
131 |
|
132 |
+
public function testHeaderWithSingleDefaultAd()
|
133 |
{
|
134 |
$header =
|
135 |
Header::create()
|
153 |
|
154 |
$this->assertEquals($expected, $rendered);
|
155 |
}
|
156 |
+
|
157 |
+
public function testHeaderWithTitles()
|
158 |
+
{
|
159 |
+
$header =
|
160 |
+
Header::create()
|
161 |
+
->withTitle(
|
162 |
+
H1::create()
|
163 |
+
->appendText('Big Top Title')
|
164 |
+
)
|
165 |
+
->withSubTitle(
|
166 |
+
H2::create()
|
167 |
+
->appendText('Smaller SubTitle')
|
168 |
+
)
|
169 |
+
->withKicker(
|
170 |
+
H3::create()
|
171 |
+
->appendText('Kicker')
|
172 |
+
);
|
173 |
+
|
174 |
+
$expected =
|
175 |
+
'<header>'.
|
176 |
+
'<h1>Big Top Title</h1>'.
|
177 |
+
'<h2>Smaller SubTitle</h2>'.
|
178 |
+
'<h3 class="op-kicker">Kicker</h3>'.
|
179 |
+
'</header>';
|
180 |
+
|
181 |
+
$rendered = $header->render();
|
182 |
+
|
183 |
+
$this->assertEquals($expected, $rendered);
|
184 |
+
}
|
185 |
+
|
186 |
+
public function testHeaderWithTitlesFormatted()
|
187 |
+
{
|
188 |
+
$header =
|
189 |
+
Header::create()
|
190 |
+
->withTitle(
|
191 |
+
H1::create()
|
192 |
+
->appendText('Big Top Title ')
|
193 |
+
->appendText(Bold::create()->appendText('in Bold'))
|
194 |
+
)
|
195 |
+
->withSubTitle(
|
196 |
+
H2::create()
|
197 |
+
->appendText('Smaller SubTitle ')
|
198 |
+
->appendText(Bold::create()->appendText('in Bold'))
|
199 |
+
)
|
200 |
+
->withKicker(
|
201 |
+
H3::create()
|
202 |
+
->appendText('Kicker ')
|
203 |
+
->appendText(Bold::create()->appendText('in Bold'))
|
204 |
+
);
|
205 |
+
|
206 |
+
$expected =
|
207 |
+
'<header>'.
|
208 |
+
'<h1>Big Top Title <b>in Bold</b></h1>'.
|
209 |
+
'<h2>Smaller SubTitle <b>in Bold</b></h2>'.
|
210 |
+
'<h3 class="op-kicker">Kicker <b>in Bold</b></h3>'.
|
211 |
+
'</header>';
|
212 |
+
|
213 |
+
$rendered = $header->render();
|
214 |
+
|
215 |
+
$this->assertEquals($expected, $rendered);
|
216 |
+
}
|
217 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/ImageTest.php
CHANGED
@@ -8,11 +8,16 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class ImageTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
@@ -59,7 +64,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase
|
|
59 |
Caption::create()
|
60 |
->withTitle('Title of Image caption')
|
61 |
->withCredit('Some caption to the image')
|
62 |
-
->
|
63 |
);
|
64 |
|
65 |
$expected =
|
@@ -157,20 +162,21 @@ class ImageTest extends \PHPUnit_Framework_TestCase
|
|
157 |
|
158 |
public function testRenderWithGeotag()
|
159 |
{
|
160 |
-
$script =
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
|
|
174 |
|
175 |
$image =
|
176 |
Image::create()
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class ImageTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$image = Image::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $image->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
}
|
22 |
|
23 |
public function testRenderBasic()
|
64 |
Caption::create()
|
65 |
->withTitle('Title of Image caption')
|
66 |
->withCredit('Some caption to the image')
|
67 |
+
->withPosition(Caption::POSITION_BELOW)
|
68 |
);
|
69 |
|
70 |
$expected =
|
162 |
|
163 |
public function testRenderWithGeotag()
|
164 |
{
|
165 |
+
$script = <<<'JSON'
|
166 |
+
{
|
167 |
+
"type": "Feature",
|
168 |
+
"geometry": {
|
169 |
+
"type": "Point",
|
170 |
+
"coordinates": [23.166667, 89.216667]
|
171 |
+
},
|
172 |
+
"properties": {
|
173 |
+
"title": "Jessore, Bangladesh",
|
174 |
+
"radius": 750000,
|
175 |
+
"pivot": true,
|
176 |
+
"style": "satellite"
|
177 |
+
}
|
178 |
+
}
|
179 |
+
JSON;
|
180 |
|
181 |
$image =
|
182 |
Image::create()
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/InstantArticleTest.php
CHANGED
@@ -284,4 +284,132 @@ class InstantArticleTest extends \PHPUnit_Framework_TestCase
|
|
284 |
|
285 |
$this->assertEquals($expected, $this->article->render());
|
286 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
287 |
}
|
284 |
|
285 |
$this->assertEquals($expected, $this->article->render());
|
286 |
}
|
287 |
+
|
288 |
+
public function testInstantArticleAlmostEmpty()
|
289 |
+
{
|
290 |
+
$article =
|
291 |
+
InstantArticle::create()
|
292 |
+
->withCanonicalUrl('')
|
293 |
+
->withHeader(Header::create())
|
294 |
+
// Paragraph1
|
295 |
+
->addChild(
|
296 |
+
Paragraph::create()
|
297 |
+
->appendText('Some text to be within a paragraph for testing.')
|
298 |
+
)
|
299 |
+
|
300 |
+
// Empty paragraph
|
301 |
+
->addChild(
|
302 |
+
Paragraph::create()
|
303 |
+
)
|
304 |
+
|
305 |
+
// Paragraph with only whitespace
|
306 |
+
->addChild(
|
307 |
+
Paragraph::create()
|
308 |
+
->appendText(" \n \t ")
|
309 |
+
)
|
310 |
+
|
311 |
+
->addChild(
|
312 |
+
// Image without src
|
313 |
+
Image::create()
|
314 |
+
)
|
315 |
+
|
316 |
+
->addChild(
|
317 |
+
// Image with empty src
|
318 |
+
Image::create()
|
319 |
+
->withURL('')
|
320 |
+
)
|
321 |
+
|
322 |
+
// Slideshow
|
323 |
+
->addChild(
|
324 |
+
SlideShow::create()
|
325 |
+
->addImage(
|
326 |
+
Image::create()
|
327 |
+
->withURL('https://jpeg.org/images/jpegls-home.jpg')
|
328 |
+
)
|
329 |
+
->addImage(
|
330 |
+
// Image without src URL for image
|
331 |
+
Image::create()
|
332 |
+
)
|
333 |
+
)
|
334 |
+
|
335 |
+
// Empty Ad
|
336 |
+
->addChild(
|
337 |
+
Ad::create()
|
338 |
+
)
|
339 |
+
|
340 |
+
// Paragraph4
|
341 |
+
->addChild(
|
342 |
+
Paragraph::create()
|
343 |
+
->appendText('Other text to be within a second paragraph for testing.')
|
344 |
+
)
|
345 |
+
|
346 |
+
// Empty Analytics
|
347 |
+
->addChild(
|
348 |
+
Analytics::create()
|
349 |
+
)
|
350 |
+
|
351 |
+
// Empty Footer
|
352 |
+
->withFooter(
|
353 |
+
Footer::create()
|
354 |
+
);
|
355 |
+
|
356 |
+
$expected =
|
357 |
+
'<!doctype html>'.
|
358 |
+
'<html>'.
|
359 |
+
'<head>'.
|
360 |
+
'<link rel="canonical" href=""/>'.
|
361 |
+
'<meta charset="utf-8"/>'.
|
362 |
+
'<meta property="op:generator" content="facebook-instant-articles-sdk-php"/>'.
|
363 |
+
'<meta property="op:generator:version" content="1.0.6"/>'.
|
364 |
+
'<meta property="op:markup_version" content="v1.0"/>'.
|
365 |
+
'</head>'.
|
366 |
+
'<body>'.
|
367 |
+
'<article>'.
|
368 |
+
'<p>Some text to be within a paragraph for testing.</p>'.
|
369 |
+
'<figure class="op-slideshow">'.
|
370 |
+
'<figure>'.
|
371 |
+
'<img src="https://jpeg.org/images/jpegls-home.jpg"/>'.
|
372 |
+
'</figure>'.
|
373 |
+
'</figure>'.
|
374 |
+
'<p>Other text to be within a second paragraph for testing.</p>'.
|
375 |
+
'</article>'.
|
376 |
+
'</body>'.
|
377 |
+
'</html>';
|
378 |
+
|
379 |
+
$result = $article->render();
|
380 |
+
$this->assertEquals($expected, $result);
|
381 |
+
}
|
382 |
+
|
383 |
+
public function testIsValid()
|
384 |
+
{
|
385 |
+
$ia =
|
386 |
+
InstantArticle::create()
|
387 |
+
->withCanonicalURL('http://wp.localtest.me/2016/04/12/stress-on-earth/')
|
388 |
+
->enableAutomaticAdPlacement()
|
389 |
+
->withHeader(
|
390 |
+
Header::create()
|
391 |
+
->withTitle(
|
392 |
+
H1::create()->appendText('Peace on <b>earth</b>')
|
393 |
+
)
|
394 |
+
->addAuthor(
|
395 |
+
Author::create()->withName('bill')
|
396 |
+
)
|
397 |
+
->withPublishTime(
|
398 |
+
Time::create(Time::PUBLISHED)
|
399 |
+
->withDatetime(
|
400 |
+
\DateTime::createFromFormat(
|
401 |
+
'j-M-Y G:i:s',
|
402 |
+
'14-Aug-1984 19:30:00'
|
403 |
+
)
|
404 |
+
)
|
405 |
+
)
|
406 |
+
)
|
407 |
+
->addChild(
|
408 |
+
Paragraph::create()
|
409 |
+
->appendText('Yes, peace is good for everybody!')
|
410 |
+
->appendText(LineBreak::create())
|
411 |
+
->appendText(' Man kind.')
|
412 |
+
);
|
413 |
+
$this->assertTrue($ia->isValid());
|
414 |
+
}
|
415 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/InteractiveTest.php
CHANGED
@@ -13,8 +13,14 @@ use Facebook\InstantArticles\Elements\Interactive;
|
|
13 |
|
14 |
class InteractiveTest extends \PHPUnit_Framework_TestCase
|
15 |
{
|
16 |
-
|
17 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
|
20 |
public function testRenderBasic()
|
@@ -32,7 +38,6 @@ class InteractiveTest extends \PHPUnit_Framework_TestCase
|
|
32 |
$this->assertEquals($expected, $rendered);
|
33 |
}
|
34 |
|
35 |
-
|
36 |
public function testRenderBasicWithCaption()
|
37 |
{
|
38 |
$social_embed =
|
13 |
|
14 |
class InteractiveTest extends \PHPUnit_Framework_TestCase
|
15 |
{
|
16 |
+
public function testRenderEmpty()
|
17 |
{
|
18 |
+
$interactive = Interactive::create();
|
19 |
+
|
20 |
+
$expected = '';
|
21 |
+
|
22 |
+
$rendered = $interactive->render();
|
23 |
+
$this->assertEquals($expected, $rendered);
|
24 |
}
|
25 |
|
26 |
public function testRenderBasic()
|
38 |
$this->assertEquals($expected, $rendered);
|
39 |
}
|
40 |
|
|
|
41 |
public function testRenderBasicWithCaption()
|
42 |
{
|
43 |
$social_embed =
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/ListElementTest.php
CHANGED
@@ -8,11 +8,32 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class ListElementTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderOrdered()
|
@@ -38,7 +59,7 @@ class ListElementTest extends \PHPUnit_Framework_TestCase
|
|
38 |
{
|
39 |
$list =
|
40 |
ListElement::createOrdered()
|
41 |
-
->withItems(
|
42 |
|
43 |
$expected =
|
44 |
'<ol>'.
|
@@ -74,7 +95,7 @@ class ListElementTest extends \PHPUnit_Framework_TestCase
|
|
74 |
{
|
75 |
$list =
|
76 |
ListElement::createUnordered()
|
77 |
-
->withItems(
|
78 |
|
79 |
$expected =
|
80 |
'<ul>'.
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class ListElementTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$list =
|
16 |
+
ListElement::createOrdered();
|
17 |
+
|
18 |
+
$expected = '';
|
19 |
+
|
20 |
+
$rendered = $list->render();
|
21 |
+
$this->assertEquals($expected, $rendered);
|
22 |
+
}
|
23 |
+
|
24 |
+
public function testRenderListItemsAllEmpty()
|
25 |
+
{
|
26 |
+
$list =
|
27 |
+
ListElement::createOrdered()
|
28 |
+
->addItem('')
|
29 |
+
->addItem(' ')
|
30 |
+
->addItem("\t")
|
31 |
+
->addItem("\n \t");
|
32 |
+
|
33 |
+
$expected = '';
|
34 |
+
|
35 |
+
$rendered = $list->render();
|
36 |
+
$this->assertEquals($expected, $rendered);
|
37 |
}
|
38 |
|
39 |
public function testRenderOrdered()
|
59 |
{
|
60 |
$list =
|
61 |
ListElement::createOrdered()
|
62 |
+
->withItems(['Item 1', 'Item 2', 'Item 3']);
|
63 |
|
64 |
$expected =
|
65 |
'<ol>'.
|
95 |
{
|
96 |
$list =
|
97 |
ListElement::createUnordered()
|
98 |
+
->withItems(['Item 1', 'Item 2', 'Item 3']);
|
99 |
|
100 |
$expected =
|
101 |
'<ul>'.
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/MapTest.php
CHANGED
@@ -8,29 +8,35 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class MapTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderWithGeotag()
|
19 |
{
|
20 |
-
$script =
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
34 |
|
35 |
$map =
|
36 |
Map::create()
|
@@ -49,20 +55,21 @@ class MapTest extends \PHPUnit_Framework_TestCase
|
|
49 |
|
50 |
public function testRenderWithGeotagAndCaption()
|
51 |
{
|
52 |
-
$script =
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
66 |
|
67 |
$map =
|
68 |
Map::create()
|
@@ -71,7 +78,7 @@ class MapTest extends \PHPUnit_Framework_TestCase
|
|
71 |
Caption::create()
|
72 |
->withTitle('Title of Image caption')
|
73 |
->withCredit('Some caption to the image')
|
74 |
-
->
|
75 |
);
|
76 |
|
77 |
$expected =
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class MapTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$map = Map::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $map->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
}
|
22 |
|
23 |
public function testRenderWithGeotag()
|
24 |
{
|
25 |
+
$script = <<<'JSON'
|
26 |
+
{
|
27 |
+
"type": "Feature",
|
28 |
+
"geometry": {
|
29 |
+
"type": "Point",
|
30 |
+
"coordinates": [23.166667, 89.216667]
|
31 |
+
},
|
32 |
+
"properties": {
|
33 |
+
"title": "Jessore, Bangladesh",
|
34 |
+
"radius": 750000,
|
35 |
+
"pivot": true,
|
36 |
+
"style": "satellite"
|
37 |
+
}
|
38 |
+
}
|
39 |
+
JSON;
|
40 |
|
41 |
$map =
|
42 |
Map::create()
|
55 |
|
56 |
public function testRenderWithGeotagAndCaption()
|
57 |
{
|
58 |
+
$script = <<<'JSON'
|
59 |
+
{
|
60 |
+
"type": "Feature",
|
61 |
+
"geometry": {
|
62 |
+
"type": "Point",
|
63 |
+
"coordinates": [23.166667, 89.216667]
|
64 |
+
},
|
65 |
+
"properties": {
|
66 |
+
"title": "Jessore, Bangladesh",
|
67 |
+
"radius": 750000,
|
68 |
+
"pivot": true,
|
69 |
+
"style": "satellite"
|
70 |
+
}
|
71 |
+
}
|
72 |
+
JSON;
|
73 |
|
74 |
$map =
|
75 |
Map::create()
|
78 |
Caption::create()
|
79 |
->withTitle('Title of Image caption')
|
80 |
->withCredit('Some caption to the image')
|
81 |
+
->withPosition(Caption::POSITION_BELOW)
|
82 |
);
|
83 |
|
84 |
$expected =
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/ParagraphTest.php
CHANGED
@@ -8,23 +8,13 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class ParagraphTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
{
|
20 |
-
$paragraph =
|
21 |
-
Paragraph::create()
|
22 |
-
->appendText('Some text to be within a paragraph for testing.');
|
23 |
-
|
24 |
-
$expected =
|
25 |
-
'<p>'.
|
26 |
-
'Some text to be within a paragraph for testing.'.
|
27 |
-
'</p>';
|
28 |
|
29 |
$rendered = $paragraph->render();
|
30 |
$this->assertEquals($expected, $rendered);
|
@@ -108,6 +98,66 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase
|
|
108 |
$this->assertEquals($expected, $rendered);
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
public function testRenderWithNestedFormattedText()
|
112 |
{
|
113 |
$paragraph =
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class ParagraphTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$paragraph = Paragraph::create();
|
16 |
|
17 |
+
$expected = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
$rendered = $paragraph->render();
|
20 |
$this->assertEquals($expected, $rendered);
|
98 |
$this->assertEquals($expected, $rendered);
|
99 |
}
|
100 |
|
101 |
+
public function testRenderEmptyText()
|
102 |
+
{
|
103 |
+
$paragraph =
|
104 |
+
Paragraph::create()
|
105 |
+
->appendText('');
|
106 |
+
|
107 |
+
$expected = '';
|
108 |
+
|
109 |
+
$rendered = $paragraph->render();
|
110 |
+
$this->assertEquals($expected, $rendered);
|
111 |
+
}
|
112 |
+
|
113 |
+
public function testRenderEmptyNBSP()
|
114 |
+
{
|
115 |
+
$paragraph =
|
116 |
+
Paragraph::create()
|
117 |
+
->appendText(' ');
|
118 |
+
|
119 |
+
$expected = '';
|
120 |
+
|
121 |
+
$rendered = $paragraph->render();
|
122 |
+
$this->assertEquals($expected, $rendered);
|
123 |
+
}
|
124 |
+
|
125 |
+
public function testRenderEmptySpaces()
|
126 |
+
{
|
127 |
+
$paragraph =
|
128 |
+
Paragraph::create()
|
129 |
+
->appendText(' ');
|
130 |
+
|
131 |
+
$expected = '';
|
132 |
+
|
133 |
+
$rendered = $paragraph->render();
|
134 |
+
$this->assertEquals($expected, $rendered);
|
135 |
+
}
|
136 |
+
|
137 |
+
public function testRenderWhiteSpaceChars()
|
138 |
+
{
|
139 |
+
$paragraph =
|
140 |
+
Paragraph::create()
|
141 |
+
->appendText("\t\n\r");
|
142 |
+
|
143 |
+
$expected = '';
|
144 |
+
|
145 |
+
$rendered = $paragraph->render();
|
146 |
+
$this->assertEquals($expected, $rendered);
|
147 |
+
}
|
148 |
+
|
149 |
+
public function testRenderEmptyFormatted()
|
150 |
+
{
|
151 |
+
$paragraph =
|
152 |
+
Paragraph::create()
|
153 |
+
->appendText(Bold::create()->appendText(' '));
|
154 |
+
|
155 |
+
$expected = '';
|
156 |
+
|
157 |
+
$rendered = $paragraph->render();
|
158 |
+
$this->assertEquals($expected, $rendered);
|
159 |
+
}
|
160 |
+
|
161 |
public function testRenderWithNestedFormattedText()
|
162 |
{
|
163 |
$paragraph =
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/PullquoteTest.php
CHANGED
@@ -8,23 +8,14 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class PullquoteTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
protected function setUp()
|
15 |
-
{
|
16 |
-
}
|
17 |
-
|
18 |
public function testRenderBasic()
|
19 |
{
|
20 |
$analytics =
|
21 |
-
Pullquote::create()
|
22 |
-
->appendText('Some text to be within an aside for testing.');
|
23 |
|
24 |
-
$expected =
|
25 |
-
'<aside>'.
|
26 |
-
'Some text to be within an aside for testing.'.
|
27 |
-
'</aside>';
|
28 |
|
29 |
$rendered = $analytics->render();
|
30 |
$this->assertEquals($expected, $rendered);
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class PullquoteTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
|
|
|
|
|
|
|
|
13 |
public function testRenderBasic()
|
14 |
{
|
15 |
$analytics =
|
16 |
+
Pullquote::create();
|
|
|
17 |
|
18 |
+
$expected = '';
|
|
|
|
|
|
|
19 |
|
20 |
$rendered = $analytics->render();
|
21 |
$this->assertEquals($expected, $rendered);
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/RelatedArticlesTest.php
CHANGED
@@ -8,11 +8,17 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class RelatedArticlesTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class RelatedArticlesTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$element =
|
16 |
+
RelatedArticles::create();
|
17 |
+
|
18 |
+
$expected = '';
|
19 |
+
|
20 |
+
$rendered = $element->render();
|
21 |
+
$this->assertEquals($expected, $rendered);
|
22 |
}
|
23 |
|
24 |
public function testRenderBasic()
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/SlideshowTest.php
CHANGED
@@ -8,11 +8,16 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class SlideshowTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
@@ -110,20 +115,21 @@ class SlideshowTest extends \PHPUnit_Framework_TestCase
|
|
110 |
|
111 |
public function testRenderWithGeotag()
|
112 |
{
|
113 |
-
$geotag =
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
127 |
|
128 |
$slideshow =
|
129 |
SlideShow::create()
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class SlideshowTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$slideshow = SlideShow::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $slideshow->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
}
|
22 |
|
23 |
public function testRenderBasic()
|
115 |
|
116 |
public function testRenderWithGeotag()
|
117 |
{
|
118 |
+
$geotag = <<<'JSON'
|
119 |
+
{
|
120 |
+
"type": "Feature",
|
121 |
+
"geometry": {
|
122 |
+
"type": "Point",
|
123 |
+
"coordinates": [23.166667, 89.216667]
|
124 |
+
},
|
125 |
+
"properties": {
|
126 |
+
"title": "Jessore, Bangladesh",
|
127 |
+
"radius": 750000,
|
128 |
+
"pivot": true,
|
129 |
+
"style": "satellite"
|
130 |
+
}
|
131 |
+
}
|
132 |
+
JSON;
|
133 |
|
134 |
$slideshow =
|
135 |
SlideShow::create()
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/SocialEmbedTest.php
CHANGED
@@ -8,11 +8,16 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class SocialEmbedTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
@@ -74,4 +79,21 @@ class SocialEmbedTest extends \PHPUnit_Framework_TestCase
|
|
74 |
$rendered = $social_embed->render();
|
75 |
$this->assertEquals($expected, $rendered);
|
76 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class SocialEmbedTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$social_embed = SocialEmbed::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $social_embed->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
}
|
22 |
|
23 |
public function testRenderBasic()
|
79 |
$rendered = $social_embed->render();
|
80 |
$this->assertEquals($expected, $rendered);
|
81 |
}
|
82 |
+
|
83 |
+
public function testRenderWithWidthAndHeight()
|
84 |
+
{
|
85 |
+
$social_embed =
|
86 |
+
SocialEmbed::create()
|
87 |
+
->withSource('http://foo.com')
|
88 |
+
->withWidth(640)
|
89 |
+
->withHeight(480);
|
90 |
+
|
91 |
+
$expected =
|
92 |
+
'<figure class="op-social">'.
|
93 |
+
'<iframe src="http://foo.com" width="640" height="480"></iframe>'.
|
94 |
+
'</figure>';
|
95 |
+
|
96 |
+
$rendered = $social_embed->render();
|
97 |
+
$this->assertEquals($expected, $rendered);
|
98 |
+
}
|
99 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/TimeTest.php
CHANGED
@@ -8,7 +8,6 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class TimeTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
private $timeDate;
|
@@ -22,6 +21,16 @@ class TimeTest extends \PHPUnit_Framework_TestCase
|
|
22 |
);
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
public function testRenderBasic()
|
26 |
{
|
27 |
$time =
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class TimeTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
private $timeDate;
|
21 |
);
|
22 |
}
|
23 |
|
24 |
+
public function testRenderEmpty()
|
25 |
+
{
|
26 |
+
$time = Time::create(Time::PUBLISHED);
|
27 |
+
|
28 |
+
$expected = '';
|
29 |
+
|
30 |
+
$rendered = $time->render();
|
31 |
+
$this->assertEquals($expected, $rendered);
|
32 |
+
}
|
33 |
+
|
34 |
public function testRenderBasic()
|
35 |
{
|
36 |
$time =
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/Validators/InstantArticleValidatorTest.php
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* This source code is licensed under the license found in the
|
7 |
+
* LICENSE file in the root directory of this source tree.
|
8 |
+
*/
|
9 |
+
namespace Facebook\InstantArticles\Validators;
|
10 |
+
|
11 |
+
use Facebook\InstantArticles\Elements\Ad;
|
12 |
+
use Facebook\InstantArticles\Elements\Analytics;
|
13 |
+
use Facebook\InstantArticles\Elements\Image;
|
14 |
+
use Facebook\InstantArticles\Elements\Header;
|
15 |
+
use Facebook\InstantArticles\Elements\Footer;
|
16 |
+
use Facebook\InstantArticles\Elements\Paragraph;
|
17 |
+
use Facebook\InstantArticles\Elements\SlideShow;
|
18 |
+
use Facebook\InstantArticles\Elements\InstantArticle;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Test unit against InstantArticleValidator
|
22 |
+
* @see InstantArticleValidator
|
23 |
+
*/
|
24 |
+
class InstantArticleValidatorTest extends \PHPUnit_Framework_TestCase
|
25 |
+
{
|
26 |
+
public function testInstantArticle()
|
27 |
+
{
|
28 |
+
$article =
|
29 |
+
InstantArticle::create()
|
30 |
+
// Warning 1 - Invalid canonicalURL
|
31 |
+
->withCanonicalUrl('')
|
32 |
+
// Warning 2 - Invalid empty header
|
33 |
+
->withHeader(Header::create())
|
34 |
+
// Paragraph1
|
35 |
+
->addChild(
|
36 |
+
Paragraph::create()
|
37 |
+
->appendText('Some text to be within a paragraph for testing.')
|
38 |
+
)
|
39 |
+
|
40 |
+
// Warning 3 - Invalid paragraph
|
41 |
+
->addChild(Paragraph::create())
|
42 |
+
|
43 |
+
// Warning 4 - Invalid paragraph
|
44 |
+
->addChild(Paragraph::create()->appendText(" \n \t "))
|
45 |
+
|
46 |
+
->addChild(
|
47 |
+
// Warning 5 - Invalid image without URL
|
48 |
+
Image::create()
|
49 |
+
)
|
50 |
+
|
51 |
+
->addChild(
|
52 |
+
// Warning 6 - Invalid image with empty URL
|
53 |
+
Image::create()->withURL('')
|
54 |
+
)
|
55 |
+
|
56 |
+
// Slideshow
|
57 |
+
->addChild(
|
58 |
+
SlideShow::create()
|
59 |
+
->addImage(
|
60 |
+
Image::create()
|
61 |
+
->withURL('https://jpeg.org/images/jpegls-home.jpg')
|
62 |
+
)
|
63 |
+
->addImage(
|
64 |
+
// Warning 7 - Invalid image with empty URL
|
65 |
+
Image::create()
|
66 |
+
)
|
67 |
+
)
|
68 |
+
|
69 |
+
// Ad
|
70 |
+
->addChild(Ad::create()->withSource('http://foo.com'))
|
71 |
+
|
72 |
+
// Paragraph4
|
73 |
+
->addChild(
|
74 |
+
Paragraph::create()
|
75 |
+
->appendText('Other text to be within a second paragraph for testing.')
|
76 |
+
)
|
77 |
+
|
78 |
+
// Warning 8 - Invalid Analytics with empty content/src
|
79 |
+
->addChild(
|
80 |
+
Analytics::create()
|
81 |
+
)
|
82 |
+
|
83 |
+
// Warning 9 - Invalid empty Footer
|
84 |
+
->withFooter(Footer::create());
|
85 |
+
|
86 |
+
$expected =
|
87 |
+
'<!doctype html>'.
|
88 |
+
'<html>'.
|
89 |
+
'<head>'.
|
90 |
+
'<link rel="canonical" href=""/>'.
|
91 |
+
'<meta charset="utf-8"/>'.
|
92 |
+
'<meta property="op:generator" content="facebook-instant-articles-sdk-php"/>'.
|
93 |
+
'<meta property="op:generator:version" content="1.0.6"/>'.
|
94 |
+
'<meta property="op:markup_version" content="v1.0"/>'.
|
95 |
+
'</head>'.
|
96 |
+
'<body>'.
|
97 |
+
'<article>'.
|
98 |
+
'<p>Some text to be within a paragraph for testing.</p>'.
|
99 |
+
'<figure class="op-slideshow">'.
|
100 |
+
'<figure>'.
|
101 |
+
'<img src="https://jpeg.org/images/jpegls-home.jpg"/>'.
|
102 |
+
'</figure>'.
|
103 |
+
'</figure>'.
|
104 |
+
'<figure class="op-ad">'.
|
105 |
+
'<iframe src="http://foo.com"></iframe>'.
|
106 |
+
'</figure>'.
|
107 |
+
'<p>Other text to be within a second paragraph for testing.</p>'.
|
108 |
+
'</article>'.
|
109 |
+
'</body>'.
|
110 |
+
'</html>';
|
111 |
+
|
112 |
+
$result = $article->render();
|
113 |
+
$this->assertEquals($expected, $result);
|
114 |
+
|
115 |
+
$warnings = InstantArticleValidator::check($article);
|
116 |
+
$this->assertEquals(9, count($warnings));
|
117 |
+
}
|
118 |
+
|
119 |
+
public function testFooter()
|
120 |
+
{
|
121 |
+
$footer = Footer::create();
|
122 |
+
$expected = '';
|
123 |
+
$result = $footer->render();
|
124 |
+
$this->assertEquals($expected, $result);
|
125 |
+
|
126 |
+
$warnings = array();
|
127 |
+
InstantArticleValidator::getReport(array($footer), $warnings);
|
128 |
+
$this->assertEquals(1, count($warnings));
|
129 |
+
$this->assertContains('Footer must have at least one of the', $warnings[0]->__toString());
|
130 |
+
}
|
131 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/Validators/TypeTest.php
CHANGED
@@ -26,13 +26,13 @@ class TypeTest extends \PHPUnit_Framework_TestCase
|
|
26 |
|
27 |
public function testIsType()
|
28 |
{
|
29 |
-
$result = Type::is(Caption::create(),
|
30 |
$this->assertTrue($result);
|
31 |
}
|
32 |
|
33 |
public function testIsTypeWithArray()
|
34 |
{
|
35 |
-
$result = Type::is(
|
36 |
$this->assertTrue($result);
|
37 |
}
|
38 |
|
@@ -40,12 +40,12 @@ class TypeTest extends \PHPUnit_Framework_TestCase
|
|
40 |
{
|
41 |
$result = Type::is(
|
42 |
Caption::create(),
|
43 |
-
|
44 |
Caption::getClassName(),
|
45 |
InstantArticle::getClassName(),
|
46 |
Video::getClassName(),
|
47 |
Image::getClassName()
|
48 |
-
|
49 |
);
|
50 |
$this->assertTrue($result);
|
51 |
}
|
@@ -54,90 +54,78 @@ class TypeTest extends \PHPUnit_Framework_TestCase
|
|
54 |
{
|
55 |
$result = Type::is(
|
56 |
Caption::create(),
|
57 |
-
|
58 |
Image::getClassName()
|
59 |
-
|
60 |
);
|
61 |
$this->assertFalse($result);
|
62 |
}
|
63 |
|
64 |
public function testIsNotInException()
|
65 |
{
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
)
|
72 |
-
|
73 |
-
|
74 |
-
} catch (\Exception $e) {
|
75 |
-
// success
|
76 |
-
$this->assertInstanceOf('InvalidArgumentException', $e);
|
77 |
-
}
|
78 |
}
|
79 |
|
80 |
public function testIsNotInEmpty()
|
81 |
{
|
82 |
$result = Type::is(
|
83 |
Caption::create(),
|
84 |
-
|
85 |
);
|
86 |
$this->assertFalse($result);
|
87 |
}
|
88 |
|
89 |
public function testIsNotInEmptyException()
|
90 |
{
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
} catch (\Exception $e) {
|
98 |
-
// success
|
99 |
-
$this->assertInstanceOf('InvalidArgumentException', $e);
|
100 |
-
}
|
101 |
}
|
102 |
|
103 |
public function testIsNotInSet()
|
104 |
{
|
105 |
$result = Type::is(
|
106 |
Caption::create(),
|
107 |
-
|
108 |
InstantArticle::getClassName(),
|
109 |
Video::getClassName(),
|
110 |
Image::getClassName()
|
111 |
-
|
112 |
);
|
113 |
$this->assertFalse($result);
|
114 |
}
|
115 |
|
116 |
public function testIsNotInSetException()
|
117 |
{
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
)
|
126 |
-
|
127 |
-
|
128 |
-
} catch (\Exception $e) {
|
129 |
-
// success
|
130 |
-
$this->assertInstanceOf('InvalidArgumentException', $e);
|
131 |
-
}
|
132 |
}
|
133 |
|
134 |
public function testIsInInheritance()
|
135 |
{
|
136 |
$result = Type::is(
|
137 |
AnimatedGIF::create(),
|
138 |
-
|
139 |
Image::getClassName()
|
140 |
-
|
141 |
);
|
142 |
$this->assertTrue($result);
|
143 |
}
|
@@ -146,27 +134,23 @@ class TypeTest extends \PHPUnit_Framework_TestCase
|
|
146 |
{
|
147 |
$result = Type::is(
|
148 |
AnimatedGIF::create(),
|
149 |
-
|
150 |
Video::getClassName()
|
151 |
-
|
152 |
);
|
153 |
$this->assertFalse($result);
|
154 |
}
|
155 |
|
156 |
public function testIsNotInInheritanceException()
|
157 |
{
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
)
|
164 |
-
|
165 |
-
|
166 |
-
} catch (\Exception $e) {
|
167 |
-
// success
|
168 |
-
$this->assertInstanceOf('InvalidArgumentException', $e);
|
169 |
-
}
|
170 |
}
|
171 |
|
172 |
public function testIsString()
|
@@ -183,18 +167,14 @@ class TypeTest extends \PHPUnit_Framework_TestCase
|
|
183 |
|
184 |
public function testIsNotStringException()
|
185 |
{
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
} catch (\Exception $e) {
|
190 |
-
// success
|
191 |
-
$this->assertInstanceOf('InvalidArgumentException', $e);
|
192 |
-
}
|
193 |
}
|
194 |
|
195 |
public function testIsArrayOfString()
|
196 |
{
|
197 |
-
$result = Type::isArrayOf(
|
198 |
$this->assertTrue($result);
|
199 |
}
|
200 |
|
@@ -202,7 +182,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase
|
|
202 |
{
|
203 |
$result =
|
204 |
Type::isArrayOf(
|
205 |
-
|
206 |
Image::getClassName()
|
207 |
);
|
208 |
$this->assertTrue($result);
|
@@ -212,8 +192,8 @@ class TypeTest extends \PHPUnit_Framework_TestCase
|
|
212 |
{
|
213 |
$result =
|
214 |
Type::isArrayOf(
|
215 |
-
|
216 |
-
|
217 |
);
|
218 |
$this->assertTrue($result);
|
219 |
}
|
@@ -221,7 +201,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase
|
|
221 |
public function testIsArrayInInheritance()
|
222 |
{
|
223 |
$result = Type::isArrayOf(
|
224 |
-
|
225 |
Image::getClassName()
|
226 |
);
|
227 |
$this->assertTrue($result);
|
@@ -231,7 +211,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase
|
|
231 |
{
|
232 |
$result =
|
233 |
Type::isArrayOf(
|
234 |
-
|
235 |
Image::getClassName()
|
236 |
);
|
237 |
$this->assertFalse($result);
|
@@ -239,17 +219,12 @@ class TypeTest extends \PHPUnit_Framework_TestCase
|
|
239 |
|
240 |
public function testIsNotArrayInInheritanceException()
|
241 |
{
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
$this->fail('Should throw exception');
|
249 |
-
} catch (\Exception $e) {
|
250 |
-
// success
|
251 |
-
$this->assertInstanceOf('InvalidArgumentException', $e);
|
252 |
-
}
|
253 |
}
|
254 |
|
255 |
/*
|
@@ -257,75 +232,69 @@ class TypeTest extends \PHPUnit_Framework_TestCase
|
|
257 |
*/
|
258 |
public function testArraySize()
|
259 |
{
|
260 |
-
$result = Type::isArraySize(
|
261 |
$this->assertTrue($result);
|
262 |
}
|
263 |
|
264 |
public function testArrayNotSize()
|
265 |
{
|
266 |
-
$result = Type::isArraySize(
|
267 |
$this->assertFalse($result);
|
268 |
}
|
269 |
|
270 |
public function testArrayMinSizeExact()
|
271 |
{
|
272 |
-
$result = Type::isArraySizeGreaterThan(
|
273 |
$this->assertTrue($result);
|
274 |
}
|
275 |
|
276 |
public function testArrayMinSizeMore()
|
277 |
{
|
278 |
-
$result = Type::isArraySizeGreaterThan(
|
279 |
$this->assertTrue($result);
|
280 |
}
|
281 |
|
282 |
public function testArrayMinSizeFew()
|
283 |
{
|
284 |
-
$result = Type::isArraySizeGreaterThan(
|
285 |
$this->assertFalse($result);
|
286 |
}
|
287 |
|
288 |
public function testEnforceArrayMinSizeException()
|
289 |
{
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
} catch (\Exception $e) {
|
294 |
-
$this->assertInstanceOf('InvalidArgumentException', $e);
|
295 |
-
}
|
296 |
}
|
297 |
|
298 |
public function testArrayMaxSizeExact()
|
299 |
{
|
300 |
-
$result = Type::isArraySizeLowerThan(
|
301 |
$this->assertTrue($result);
|
302 |
}
|
303 |
|
304 |
public function testArrayMaxSizeFew()
|
305 |
{
|
306 |
-
$result = Type::isArraySizeLowerThan(
|
307 |
$this->assertTrue($result);
|
308 |
}
|
309 |
|
310 |
public function testArrayMaxSizeMore()
|
311 |
{
|
312 |
-
$result = Type::isArraySizeLowerThan(
|
313 |
$this->assertFalse($result);
|
314 |
}
|
315 |
|
316 |
public function testEnforceArrayMaxSizeException()
|
317 |
{
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
} catch (\Exception $e) {
|
322 |
-
$this->assertInstanceOf('InvalidArgumentException', $e);
|
323 |
-
}
|
324 |
}
|
325 |
|
326 |
public function testIsWithinTrueString()
|
327 |
{
|
328 |
-
$result = Type::isWithin('x',
|
329 |
$this->assertTrue($result);
|
330 |
}
|
331 |
|
@@ -333,13 +302,13 @@ class TypeTest extends \PHPUnit_Framework_TestCase
|
|
333 |
{
|
334 |
$image = Image::create();
|
335 |
$video = Video::create();
|
336 |
-
$result = Type::isWithin($image,
|
337 |
$this->assertTrue($result);
|
338 |
}
|
339 |
|
340 |
public function testIsWithinFalse()
|
341 |
{
|
342 |
-
$result = Type::isWithin('a',
|
343 |
$this->assertFalse($result);
|
344 |
}
|
345 |
|
@@ -348,23 +317,37 @@ class TypeTest extends \PHPUnit_Framework_TestCase
|
|
348 |
$image = Image::create();
|
349 |
$video = Video::create();
|
350 |
$anotherImg = Image::create();
|
351 |
-
$result = Type::isWithin($image,
|
352 |
$this->assertFalse($result);
|
353 |
}
|
354 |
|
355 |
public function testEnforceWithinTrueString()
|
356 |
{
|
357 |
-
$result = Type::enforceWithin('x',
|
358 |
$this->assertTrue($result);
|
359 |
}
|
360 |
|
361 |
public function testEnforceWithinExceptionString()
|
362 |
{
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
}
|
370 |
}
|
26 |
|
27 |
public function testIsType()
|
28 |
{
|
29 |
+
$result = Type::is(Caption::create(), [Caption::getClassName()]);
|
30 |
$this->assertTrue($result);
|
31 |
}
|
32 |
|
33 |
public function testIsTypeWithArray()
|
34 |
{
|
35 |
+
$result = Type::is([1, 2, 3], Type::ARRAY_TYPE);
|
36 |
$this->assertTrue($result);
|
37 |
}
|
38 |
|
40 |
{
|
41 |
$result = Type::is(
|
42 |
Caption::create(),
|
43 |
+
[
|
44 |
Caption::getClassName(),
|
45 |
InstantArticle::getClassName(),
|
46 |
Video::getClassName(),
|
47 |
Image::getClassName()
|
48 |
+
]
|
49 |
);
|
50 |
$this->assertTrue($result);
|
51 |
}
|
54 |
{
|
55 |
$result = Type::is(
|
56 |
Caption::create(),
|
57 |
+
[
|
58 |
Image::getClassName()
|
59 |
+
]
|
60 |
);
|
61 |
$this->assertFalse($result);
|
62 |
}
|
63 |
|
64 |
public function testIsNotInException()
|
65 |
{
|
66 |
+
$this->setExpectedException('InvalidArgumentException');
|
67 |
+
|
68 |
+
Type::enforce(
|
69 |
+
Caption::create(),
|
70 |
+
[
|
71 |
+
Image::getClassName()
|
72 |
+
]
|
73 |
+
);
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
public function testIsNotInEmpty()
|
77 |
{
|
78 |
$result = Type::is(
|
79 |
Caption::create(),
|
80 |
+
[]
|
81 |
);
|
82 |
$this->assertFalse($result);
|
83 |
}
|
84 |
|
85 |
public function testIsNotInEmptyException()
|
86 |
{
|
87 |
+
$this->setExpectedException('InvalidArgumentException');
|
88 |
+
|
89 |
+
Type::enforce(
|
90 |
+
Caption::create(),
|
91 |
+
[]
|
92 |
+
);
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
|
95 |
public function testIsNotInSet()
|
96 |
{
|
97 |
$result = Type::is(
|
98 |
Caption::create(),
|
99 |
+
[
|
100 |
InstantArticle::getClassName(),
|
101 |
Video::getClassName(),
|
102 |
Image::getClassName()
|
103 |
+
]
|
104 |
);
|
105 |
$this->assertFalse($result);
|
106 |
}
|
107 |
|
108 |
public function testIsNotInSetException()
|
109 |
{
|
110 |
+
$this->setExpectedException('InvalidArgumentException');
|
111 |
+
|
112 |
+
Type::enforce(
|
113 |
+
Caption::create(),
|
114 |
+
[
|
115 |
+
InstantArticle::getClassName(),
|
116 |
+
Video::getClassName(),
|
117 |
+
Image::getClassName()
|
118 |
+
]
|
119 |
+
);
|
|
|
|
|
|
|
|
|
120 |
}
|
121 |
|
122 |
public function testIsInInheritance()
|
123 |
{
|
124 |
$result = Type::is(
|
125 |
AnimatedGIF::create(),
|
126 |
+
[
|
127 |
Image::getClassName()
|
128 |
+
]
|
129 |
);
|
130 |
$this->assertTrue($result);
|
131 |
}
|
134 |
{
|
135 |
$result = Type::is(
|
136 |
AnimatedGIF::create(),
|
137 |
+
[
|
138 |
Video::getClassName()
|
139 |
+
]
|
140 |
);
|
141 |
$this->assertFalse($result);
|
142 |
}
|
143 |
|
144 |
public function testIsNotInInheritanceException()
|
145 |
{
|
146 |
+
$this->setExpectedException('InvalidArgumentException');
|
147 |
+
|
148 |
+
Type::enforce(
|
149 |
+
AnimatedGIF::create(),
|
150 |
+
[
|
151 |
+
Video::getClassName()
|
152 |
+
]
|
153 |
+
);
|
|
|
|
|
|
|
|
|
154 |
}
|
155 |
|
156 |
public function testIsString()
|
167 |
|
168 |
public function testIsNotStringException()
|
169 |
{
|
170 |
+
$this->setExpectedException('InvalidArgumentException');
|
171 |
+
|
172 |
+
Type::enforce(1, Type::STRING);
|
|
|
|
|
|
|
|
|
173 |
}
|
174 |
|
175 |
public function testIsArrayOfString()
|
176 |
{
|
177 |
+
$result = Type::isArrayOf(['1', '2'], Type::STRING);
|
178 |
$this->assertTrue($result);
|
179 |
}
|
180 |
|
182 |
{
|
183 |
$result =
|
184 |
Type::isArrayOf(
|
185 |
+
[Image::create(), Image::create()],
|
186 |
Image::getClassName()
|
187 |
);
|
188 |
$this->assertTrue($result);
|
192 |
{
|
193 |
$result =
|
194 |
Type::isArrayOf(
|
195 |
+
[Image::create(), Video::create()],
|
196 |
+
[Image::getClassName(), Video::getClassName()]
|
197 |
);
|
198 |
$this->assertTrue($result);
|
199 |
}
|
201 |
public function testIsArrayInInheritance()
|
202 |
{
|
203 |
$result = Type::isArrayOf(
|
204 |
+
[Image::create(), AnimatedGIF::create()],
|
205 |
Image::getClassName()
|
206 |
);
|
207 |
$this->assertTrue($result);
|
211 |
{
|
212 |
$result =
|
213 |
Type::isArrayOf(
|
214 |
+
[Image::create(), Video::create()],
|
215 |
Image::getClassName()
|
216 |
);
|
217 |
$this->assertFalse($result);
|
219 |
|
220 |
public function testIsNotArrayInInheritanceException()
|
221 |
{
|
222 |
+
$this->setExpectedException('InvalidArgumentException');
|
223 |
+
|
224 |
+
Type::enforceArrayOf(
|
225 |
+
[Image::create(), Video::create()],
|
226 |
+
Image::getClassName()
|
227 |
+
);
|
|
|
|
|
|
|
|
|
|
|
228 |
}
|
229 |
|
230 |
/*
|
232 |
*/
|
233 |
public function testArraySize()
|
234 |
{
|
235 |
+
$result = Type::isArraySize([1,2,3], 3);
|
236 |
$this->assertTrue($result);
|
237 |
}
|
238 |
|
239 |
public function testArrayNotSize()
|
240 |
{
|
241 |
+
$result = Type::isArraySize([1,2,3], 2);
|
242 |
$this->assertFalse($result);
|
243 |
}
|
244 |
|
245 |
public function testArrayMinSizeExact()
|
246 |
{
|
247 |
+
$result = Type::isArraySizeGreaterThan([1,2,3], 3);
|
248 |
$this->assertTrue($result);
|
249 |
}
|
250 |
|
251 |
public function testArrayMinSizeMore()
|
252 |
{
|
253 |
+
$result = Type::isArraySizeGreaterThan([1,2,3], 2);
|
254 |
$this->assertTrue($result);
|
255 |
}
|
256 |
|
257 |
public function testArrayMinSizeFew()
|
258 |
{
|
259 |
+
$result = Type::isArraySizeGreaterThan([1,2,3], 4);
|
260 |
$this->assertFalse($result);
|
261 |
}
|
262 |
|
263 |
public function testEnforceArrayMinSizeException()
|
264 |
{
|
265 |
+
$this->setExpectedException('InvalidArgumentException');
|
266 |
+
|
267 |
+
Type::enforceArraySizeGreaterThan([1,2,3], 4);
|
|
|
|
|
|
|
268 |
}
|
269 |
|
270 |
public function testArrayMaxSizeExact()
|
271 |
{
|
272 |
+
$result = Type::isArraySizeLowerThan([1,2,3], 3);
|
273 |
$this->assertTrue($result);
|
274 |
}
|
275 |
|
276 |
public function testArrayMaxSizeFew()
|
277 |
{
|
278 |
+
$result = Type::isArraySizeLowerThan([1,2,3], 4);
|
279 |
$this->assertTrue($result);
|
280 |
}
|
281 |
|
282 |
public function testArrayMaxSizeMore()
|
283 |
{
|
284 |
+
$result = Type::isArraySizeLowerThan([1,2,3], 2);
|
285 |
$this->assertFalse($result);
|
286 |
}
|
287 |
|
288 |
public function testEnforceArrayMaxSizeException()
|
289 |
{
|
290 |
+
$this->setExpectedException('InvalidArgumentException');
|
291 |
+
|
292 |
+
Type::enforceArraySizeLowerThan([1,2,3], 2);
|
|
|
|
|
|
|
293 |
}
|
294 |
|
295 |
public function testIsWithinTrueString()
|
296 |
{
|
297 |
+
$result = Type::isWithin('x', ['x', 'y', 'z']);
|
298 |
$this->assertTrue($result);
|
299 |
}
|
300 |
|
302 |
{
|
303 |
$image = Image::create();
|
304 |
$video = Video::create();
|
305 |
+
$result = Type::isWithin($image, [$image, $video, 'z']);
|
306 |
$this->assertTrue($result);
|
307 |
}
|
308 |
|
309 |
public function testIsWithinFalse()
|
310 |
{
|
311 |
+
$result = Type::isWithin('a', ['x', 'y', 'z']);
|
312 |
$this->assertFalse($result);
|
313 |
}
|
314 |
|
317 |
$image = Image::create();
|
318 |
$video = Video::create();
|
319 |
$anotherImg = Image::create();
|
320 |
+
$result = Type::isWithin($image, [$anotherImg, $video, 'z']);
|
321 |
$this->assertFalse($result);
|
322 |
}
|
323 |
|
324 |
public function testEnforceWithinTrueString()
|
325 |
{
|
326 |
+
$result = Type::enforceWithin('x', ['x', 'y', 'z']);
|
327 |
$this->assertTrue($result);
|
328 |
}
|
329 |
|
330 |
public function testEnforceWithinExceptionString()
|
331 |
{
|
332 |
+
$this->setExpectedException('InvalidArgumentException');
|
333 |
+
|
334 |
+
Type::enforceWithin('a', ['x', 'y', 'z']);
|
335 |
+
}
|
336 |
+
|
337 |
+
public function testStringNotEmpty()
|
338 |
+
{
|
339 |
+
$this->assertFalse(Type::isTextEmpty("not empty"));
|
340 |
+
$this->assertFalse(Type::isTextEmpty("\nnot empty\t"));
|
341 |
+
$this->assertFalse(Type::isTextEmpty(" not empty "));
|
342 |
+
$this->assertFalse(Type::isTextEmpty(" not empty"));
|
343 |
+
}
|
344 |
+
|
345 |
+
public function testStringEmpty()
|
346 |
+
{
|
347 |
+
$this->assertTrue(Type::isTextEmpty(""));
|
348 |
+
$this->assertTrue(Type::isTextEmpty(" "));
|
349 |
+
$this->assertTrue(Type::isTextEmpty("\t\t"));
|
350 |
+
$this->assertTrue(Type::isTextEmpty(" "));
|
351 |
+
$this->assertTrue(Type::isTextEmpty("\n"));
|
352 |
}
|
353 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/VideoTest.php
CHANGED
@@ -8,11 +8,16 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
11 |
-
|
12 |
class VideoTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
17 |
|
18 |
public function testRenderBasic()
|
@@ -201,20 +206,21 @@ class VideoTest extends \PHPUnit_Framework_TestCase
|
|
201 |
|
202 |
public function testRenderWithGeotag()
|
203 |
{
|
204 |
-
$geotag =
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
|
|
218 |
|
219 |
$video =
|
220 |
Video::create()
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Elements;
|
10 |
|
|
|
11 |
class VideoTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
13 |
+
public function testRenderEmpty()
|
14 |
{
|
15 |
+
$video = Video::create();
|
16 |
+
|
17 |
+
$expected = '';
|
18 |
+
|
19 |
+
$rendered = $video->render();
|
20 |
+
$this->assertEquals($expected, $rendered);
|
21 |
}
|
22 |
|
23 |
public function testRenderBasic()
|
206 |
|
207 |
public function testRenderWithGeotag()
|
208 |
{
|
209 |
+
$geotag = <<<'JSON'
|
210 |
+
{
|
211 |
+
"type": "Feature",
|
212 |
+
"geometry": {
|
213 |
+
"type": "Point",
|
214 |
+
"coordinates": [23.166667, 89.216667]
|
215 |
+
},
|
216 |
+
"properties": {
|
217 |
+
"title": "Jessore, Bangladesh",
|
218 |
+
"radius": 750000,
|
219 |
+
"pivot": true,
|
220 |
+
"style": "satellite"
|
221 |
+
}
|
222 |
+
}
|
223 |
+
JSON;
|
224 |
|
225 |
$video =
|
226 |
Video::create()
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/WPTransformerTest.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* This source code is licensed under the license found in the
|
7 |
+
* LICENSE file in the root directory of this source tree.
|
8 |
+
*/
|
9 |
+
namespace Facebook\InstantArticles\Transformer;
|
10 |
+
|
11 |
+
use Facebook\InstantArticles\Elements\InstantArticle;
|
12 |
+
use Facebook\InstantArticles\Elements\Header;
|
13 |
+
use Facebook\InstantArticles\Elements\Time;
|
14 |
+
use Facebook\InstantArticles\Elements\Author;
|
15 |
+
|
16 |
+
class WPTest extends \PHPUnit_Framework_TestCase
|
17 |
+
{
|
18 |
+
protected function setUp()
|
19 |
+
{
|
20 |
+
\Logger::configure(
|
21 |
+
[
|
22 |
+
'rootLogger' => [
|
23 |
+
'appenders' => ['facebook-instantarticles-transformer']
|
24 |
+
],
|
25 |
+
'appenders' => [
|
26 |
+
'facebook-instantarticles-transformer' => [
|
27 |
+
'class' => 'LoggerAppenderConsole',
|
28 |
+
'threshold' => 'INFO',
|
29 |
+
'layout' => [
|
30 |
+
'class' => 'LoggerLayoutSimple'
|
31 |
+
]
|
32 |
+
]
|
33 |
+
]
|
34 |
+
]
|
35 |
+
);
|
36 |
+
}
|
37 |
+
|
38 |
+
public function testTransformerLikeWPContent()
|
39 |
+
{
|
40 |
+
$json_file = file_get_contents(__DIR__ . '/wp-rules.json');
|
41 |
+
|
42 |
+
$instant_article = InstantArticle::create();
|
43 |
+
$transformer = new Transformer();
|
44 |
+
$transformer->loadRules($json_file);
|
45 |
+
|
46 |
+
$html_file = file_get_contents(__DIR__ . '/wp.html');
|
47 |
+
|
48 |
+
libxml_use_internal_errors(true);
|
49 |
+
$document = new \DOMDocument();
|
50 |
+
$document->loadHTML($html_file);
|
51 |
+
libxml_use_internal_errors(false);
|
52 |
+
|
53 |
+
$instant_article
|
54 |
+
->withCanonicalURL('http://localhost/article')
|
55 |
+
->withHeader(
|
56 |
+
Header::create()
|
57 |
+
->withTitle('Peace on <b>earth</b>')
|
58 |
+
->addAuthor(Author::create()->withName('bill'))
|
59 |
+
->withPublishTime(Time::create(Time::PUBLISHED)->withDatetime(
|
60 |
+
\DateTime::createFromFormat(
|
61 |
+
'j-M-Y G:i:s',
|
62 |
+
'12-Apr-2016 19:46:51'
|
63 |
+
)
|
64 |
+
))
|
65 |
+
);
|
66 |
+
|
67 |
+
$transformer->transform($instant_article, $document);
|
68 |
+
$instant_article->addMetaProperty('op:generator:version', '1.0.0');
|
69 |
+
$instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0');
|
70 |
+
$result = $instant_article->render('', true)."\n";
|
71 |
+
$expected = file_get_contents(__DIR__ . '/wp-ia.xml');
|
72 |
+
|
73 |
+
$this->assertEquals($expected, $result);
|
74 |
+
$this->assertEquals(0, count($transformer->getWarnings()));
|
75 |
+
}
|
76 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp-ia.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
<head>
|
3 |
+
<link rel="canonical" href="http://localhost/article"/>
|
4 |
+
<meta charset="utf-8"/>
|
5 |
+
<meta property="op:generator" content="facebook-instant-articles-sdk-php"/>
|
6 |
+
<meta property="op:generator:version" content="1.0.0"/>
|
7 |
+
<meta property="op:generator:transformer" content="facebook-instant-articles-sdk-php"/>
|
8 |
+
<meta property="op:generator:transformer:version" content="1.0.0"/>
|
9 |
+
<meta property="op:markup_version" content="v1.0"/>
|
10 |
+
</head>
|
11 |
+
<body>
|
12 |
+
<article>
|
13 |
+
<header>
|
14 |
+
<h1>Peace on <b>earth</b></h1>
|
15 |
+
<time class="op-published" datetime="2016-04-12T19:46:51+00:00">April 12th, 7:46pm</time>
|
16 |
+
<address><a>bill</a></address>
|
17 |
+
</header>
|
18 |
+
<p>Yes, peace is good for everybody!<br/>
|
19 |
+
Man kind.</p>
|
20 |
+
</article>
|
21 |
+
</body>
|
22 |
+
</html>
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp-rules.json
ADDED
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"rules":
|
3 |
+
[{
|
4 |
+
"class": "TextNodeRule"
|
5 |
+
}, {
|
6 |
+
"class": "PassThroughRule",
|
7 |
+
"selector": "html"
|
8 |
+
}, {
|
9 |
+
"class": "PassThroughRule",
|
10 |
+
"selector": "head"
|
11 |
+
}, {
|
12 |
+
"class": "PassThroughRule",
|
13 |
+
"selector": "body"
|
14 |
+
}, {
|
15 |
+
"class": "PassThroughRule",
|
16 |
+
"selector" : "code"
|
17 |
+
},{
|
18 |
+
"class": "PassThroughRule",
|
19 |
+
"selector" : "del"
|
20 |
+
}, {
|
21 |
+
"class": "PassThroughRule",
|
22 |
+
"selector" : "span"
|
23 |
+
}, {
|
24 |
+
"class": "ParagraphRule",
|
25 |
+
"selector": "p"
|
26 |
+
}, {
|
27 |
+
"class": "LineBreakRule",
|
28 |
+
"selector": "br"
|
29 |
+
}, {
|
30 |
+
"class": "AnchorRule",
|
31 |
+
"selector": "a",
|
32 |
+
"properties": {
|
33 |
+
"anchor.href": {
|
34 |
+
"type": "string",
|
35 |
+
"selector": "a",
|
36 |
+
"attribute": "href"
|
37 |
+
},
|
38 |
+
"anchor.rel": {
|
39 |
+
"type": "string",
|
40 |
+
"selector": "a",
|
41 |
+
"attribute": "rel"
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}, {
|
45 |
+
"class": "BoldRule",
|
46 |
+
"selector": "b"
|
47 |
+
}, {
|
48 |
+
"class": "BoldRule",
|
49 |
+
"selector": "strong"
|
50 |
+
}, {
|
51 |
+
"class": "ItalicRule",
|
52 |
+
"selector": "i"
|
53 |
+
}, {
|
54 |
+
"class": "ItalicRule",
|
55 |
+
"selector": "em"
|
56 |
+
}, {
|
57 |
+
"class": "BlockquoteRule",
|
58 |
+
"selector": "blockquote"
|
59 |
+
}, {
|
60 |
+
"class": "PassThroughRule",
|
61 |
+
"selector": "blockquote p"
|
62 |
+
}, {
|
63 |
+
"class": "ImageRule",
|
64 |
+
"selector": "//p[img]",
|
65 |
+
"properties": {
|
66 |
+
"image.url": {
|
67 |
+
"type": "string",
|
68 |
+
"selector": "img",
|
69 |
+
"attribute": "src"
|
70 |
+
}
|
71 |
+
}
|
72 |
+
},{
|
73 |
+
"class": "ImageRule",
|
74 |
+
"selector": "img",
|
75 |
+
"properties": {
|
76 |
+
"image.url": {
|
77 |
+
"type": "string",
|
78 |
+
"selector": "img",
|
79 |
+
"attribute": "src"
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}, {
|
83 |
+
"class": "ListItemRule",
|
84 |
+
"selector" : "li"
|
85 |
+
}, {
|
86 |
+
"class": "ListElementRule",
|
87 |
+
"selector" : "ul"
|
88 |
+
}, {
|
89 |
+
"class": "ListElementRule",
|
90 |
+
"selector" : "ol"
|
91 |
+
}, {
|
92 |
+
"class": "BlockquoteRule",
|
93 |
+
"selector" : "blockquote"
|
94 |
+
}, {
|
95 |
+
"class": "H1Rule",
|
96 |
+
"selector" : "h1",
|
97 |
+
"properties" : {
|
98 |
+
"h1.class" : {
|
99 |
+
"type" : "string",
|
100 |
+
"selector" : "link",
|
101 |
+
"attribute": "class"
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}, {
|
105 |
+
"class": "H1Rule",
|
106 |
+
"selector" : "title"
|
107 |
+
}, {
|
108 |
+
"class": "H2Rule",
|
109 |
+
"selector" : "h2",
|
110 |
+
"properties" : {
|
111 |
+
"h2.class" : {
|
112 |
+
"type" : "string",
|
113 |
+
"selector" : "link",
|
114 |
+
"attribute": "class"
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}, {
|
118 |
+
"class": "H2Rule",
|
119 |
+
"selector" : "h3,h4,h5,h6"
|
120 |
+
}, {
|
121 |
+
"class": "SocialEmbedRule",
|
122 |
+
"selector" : "iframe",
|
123 |
+
"properties" : {
|
124 |
+
"socialembed.url" : {
|
125 |
+
"type" : "string",
|
126 |
+
"selector" : "iframe",
|
127 |
+
"attribute": "src"
|
128 |
+
},
|
129 |
+
"socialembed.iframe" : {
|
130 |
+
"type" : "children",
|
131 |
+
"selector" : "iframe"
|
132 |
+
},
|
133 |
+
"socialembed.caption" : {
|
134 |
+
"type" : "element",
|
135 |
+
"selector" : "figcaption"
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}, {
|
139 |
+
"class": "SocialEmbedRule",
|
140 |
+
"selector" : "//p[iframe]",
|
141 |
+
"properties" : {
|
142 |
+
"socialembed.url" : {
|
143 |
+
"type" : "string",
|
144 |
+
"selector" : "iframe",
|
145 |
+
"attribute": "src"
|
146 |
+
},
|
147 |
+
"socialembed.iframe" : {
|
148 |
+
"type" : "children",
|
149 |
+
"selector" : "iframe"
|
150 |
+
},
|
151 |
+
"socialembed.caption" : {
|
152 |
+
"type" : "element",
|
153 |
+
"selector" : "figcaption"
|
154 |
+
}
|
155 |
+
}
|
156 |
+
}, {
|
157 |
+
"class": "SocialEmbedRule",
|
158 |
+
"selector" : "div.embed",
|
159 |
+
"properties" : {
|
160 |
+
"socialembed.iframe" : {
|
161 |
+
"type" : "children",
|
162 |
+
"selector" : "div.embed"
|
163 |
+
}
|
164 |
+
}
|
165 |
+
}, {
|
166 |
+
"class": "InteractiveRule",
|
167 |
+
"selector" : "div.interactive",
|
168 |
+
"properties" : {
|
169 |
+
"interactive.iframe" : {
|
170 |
+
"type" : "children",
|
171 |
+
"selector" : "div.interactive"
|
172 |
+
},
|
173 |
+
"interactive.height" : {
|
174 |
+
"type" : "int",
|
175 |
+
"selector" : "iframe",
|
176 |
+
"attribute": "height"
|
177 |
+
},
|
178 |
+
"interactive.iframe" : {
|
179 |
+
"type" : "children",
|
180 |
+
"selector" : "iframe"
|
181 |
+
}
|
182 |
+
}
|
183 |
+
}, {
|
184 |
+
"class": "SocialEmbedRule",
|
185 |
+
"selector" : "//div[@class='embed' and iframe]",
|
186 |
+
"properties" : {
|
187 |
+
"socialembed.url" : {
|
188 |
+
"type" : "string",
|
189 |
+
"selector" : "iframe",
|
190 |
+
"attribute": "src"
|
191 |
+
}
|
192 |
+
}
|
193 |
+
}, {
|
194 |
+
"class": "InteractiveRule",
|
195 |
+
"selector" : "//div[@class='interactive' and iframe]",
|
196 |
+
"properties" : {
|
197 |
+
"interactive.url" : {
|
198 |
+
"type" : "string",
|
199 |
+
"selector" : "iframe",
|
200 |
+
"attribute": "src"
|
201 |
+
}
|
202 |
+
}
|
203 |
+
}, {
|
204 |
+
"class": "ImageRule",
|
205 |
+
"selector": "//p[a[img]]|//a[img]",
|
206 |
+
"properties": {
|
207 |
+
"image.url": {
|
208 |
+
"type": "string",
|
209 |
+
"selector": "img",
|
210 |
+
"attribute": "src"
|
211 |
+
}
|
212 |
+
}
|
213 |
+
}, {
|
214 |
+
"class": "SlideshowImageRule",
|
215 |
+
"selector" : "figure",
|
216 |
+
"properties" : {
|
217 |
+
"image.url" : {
|
218 |
+
"type" : "string",
|
219 |
+
"selector" : "img",
|
220 |
+
"attribute": "src"
|
221 |
+
},
|
222 |
+
"caption.title" : {
|
223 |
+
"type" : "string",
|
224 |
+
"selector" : "figcaption"
|
225 |
+
}
|
226 |
+
}
|
227 |
+
}, {
|
228 |
+
"class": "SlideshowRule",
|
229 |
+
"selector" : "div.gallery"
|
230 |
+
}, {
|
231 |
+
"class": "CaptionRule",
|
232 |
+
"selector" : "figcaption"
|
233 |
+
},
|
234 |
+
{
|
235 |
+
"class": "ImageRule",
|
236 |
+
"selector" : "figure",
|
237 |
+
"properties" : {
|
238 |
+
"image.url" : {
|
239 |
+
"type" : "string",
|
240 |
+
"selector" : "img",
|
241 |
+
"attribute": "src"
|
242 |
+
}
|
243 |
+
}
|
244 |
+
}, {
|
245 |
+
"class": "VideoRule",
|
246 |
+
"selector" : "div.wp-video",
|
247 |
+
"containsChild": "video",
|
248 |
+
"properties" : {
|
249 |
+
"video.url" : {
|
250 |
+
"type" : "string",
|
251 |
+
"selector" : "source",
|
252 |
+
"attribute": "src"
|
253 |
+
},
|
254 |
+
"video.type" : {
|
255 |
+
"type" : "string",
|
256 |
+
"selector" : "source",
|
257 |
+
"attribute": "type"
|
258 |
+
}
|
259 |
+
}
|
260 |
+
}, {
|
261 |
+
"class": "InteractiveRule",
|
262 |
+
"selector" : "table",
|
263 |
+
"properties" : {
|
264 |
+
"interactive.iframe" : {
|
265 |
+
"type" : "element",
|
266 |
+
"selector" : "table"
|
267 |
+
}
|
268 |
+
}
|
269 |
+
}]
|
270 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp.html
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html><body><p>Yes, peace is good for everybody!<br>
|
3 |
+
Man kind.</p>
|
4 |
+
</body></html>
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/SimpleTransformerTest.php
CHANGED
@@ -10,44 +10,37 @@ namespace Facebook\InstantArticles\Transformer;
|
|
10 |
|
11 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
12 |
|
13 |
-
|
14 |
-
|
15 |
class SimpleTransformerTest extends \PHPUnit_Framework_TestCase
|
16 |
{
|
17 |
-
/**
|
18 |
-
* @var InstantArticle
|
19 |
-
*/
|
20 |
-
private $article;
|
21 |
-
private $input;
|
22 |
protected function setUp()
|
23 |
{
|
24 |
\Logger::configure(
|
25 |
-
|
26 |
-
'rootLogger' =>
|
27 |
-
'appenders' =>
|
28 |
-
|
29 |
-
'appenders' =>
|
30 |
-
'facebook-instantarticles-transformer' =>
|
31 |
'class' => 'LoggerAppenderConsole',
|
32 |
'threshold' => 'INFO',
|
33 |
-
'layout' =>
|
34 |
'class' => 'LoggerLayoutSimple'
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
);
|
40 |
}
|
41 |
|
42 |
public function testSelfTransformerContent()
|
43 |
{
|
44 |
-
$json_file = file_get_contents(
|
45 |
|
46 |
$instant_article = InstantArticle::create();
|
47 |
$transformer = new Transformer();
|
48 |
$transformer->loadRules($json_file);
|
49 |
|
50 |
-
$html_file = file_get_contents(
|
51 |
|
52 |
libxml_use_internal_errors(true);
|
53 |
$document = new \DOMDocument();
|
@@ -57,9 +50,8 @@ class SimpleTransformerTest extends \PHPUnit_Framework_TestCase
|
|
57 |
$transformer->transform($instant_article, $document);
|
58 |
$instant_article->addMetaProperty('op:generator:version', '1.0.0');
|
59 |
$instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0');
|
60 |
-
$warnings = $transformer->getWarnings();
|
61 |
$result = $instant_article->render('', true)."\n";
|
62 |
-
$expected = file_get_contents(
|
63 |
|
64 |
//var_dump($result);
|
65 |
// print_r($warnings);
|
10 |
|
11 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
12 |
|
|
|
|
|
13 |
class SimpleTransformerTest extends \PHPUnit_Framework_TestCase
|
14 |
{
|
|
|
|
|
|
|
|
|
|
|
15 |
protected function setUp()
|
16 |
{
|
17 |
\Logger::configure(
|
18 |
+
[
|
19 |
+
'rootLogger' => [
|
20 |
+
'appenders' => ['facebook-instantarticles-transformer']
|
21 |
+
],
|
22 |
+
'appenders' => [
|
23 |
+
'facebook-instantarticles-transformer' => [
|
24 |
'class' => 'LoggerAppenderConsole',
|
25 |
'threshold' => 'INFO',
|
26 |
+
'layout' => [
|
27 |
'class' => 'LoggerLayoutSimple'
|
28 |
+
]
|
29 |
+
]
|
30 |
+
]
|
31 |
+
]
|
32 |
);
|
33 |
}
|
34 |
|
35 |
public function testSelfTransformerContent()
|
36 |
{
|
37 |
+
$json_file = file_get_contents(__DIR__ . '/simple-rules.json');
|
38 |
|
39 |
$instant_article = InstantArticle::create();
|
40 |
$transformer = new Transformer();
|
41 |
$transformer->loadRules($json_file);
|
42 |
|
43 |
+
$html_file = file_get_contents(__DIR__ . '/simple.html');
|
44 |
|
45 |
libxml_use_internal_errors(true);
|
46 |
$document = new \DOMDocument();
|
50 |
$transformer->transform($instant_article, $document);
|
51 |
$instant_article->addMetaProperty('op:generator:version', '1.0.0');
|
52 |
$instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0');
|
|
|
53 |
$result = $instant_article->render('', true)."\n";
|
54 |
+
$expected = file_get_contents(__DIR__ . '/simple-ia.xml');
|
55 |
|
56 |
//var_dump($result);
|
57 |
// print_r($warnings);
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/simple-ia.xml
CHANGED
@@ -15,8 +15,8 @@
|
|
15 |
<img src="http://domain.com/image-header.png"/>
|
16 |
<figcaption>Some amazing moment captured by Photographer</figcaption>
|
17 |
</figure>
|
18 |
-
<h1>The article title</h1>
|
19 |
-
<h2>Sub Title</h2>
|
20 |
<address><a>Author name</a></address>
|
21 |
</header>
|
22 |
<p>Lorem <b>ipsum</b> dolor sit amet, consectetur adipiscing elit. Sed eu arcu porta, ultrices massa ut, porttitor diam. Integer id auctor augue.</p>
|
15 |
<img src="http://domain.com/image-header.png"/>
|
16 |
<figcaption>Some amazing moment captured by Photographer</figcaption>
|
17 |
</figure>
|
18 |
+
<h1>The article <b>title</b></h1>
|
19 |
+
<h2>Sub <b>Title</b></h2>
|
20 |
<address><a>Author name</a></address>
|
21 |
</header>
|
22 |
<p>Lorem <b>ipsum</b> dolor sit amet, consectetur adipiscing elit. Sed eu arcu porta, ultrices massa ut, porttitor diam. Integer id auctor augue.</p>
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/simple.html
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
</head>
|
5 |
<body>
|
6 |
<div class="header">
|
7 |
-
<h1>The article title</h1>
|
8 |
-
<h2>Sub Title</h2>
|
9 |
<span class="author">Author name</span>
|
10 |
<div class="hero-image">
|
11 |
<img src="http://domain.com/image-header.png" />
|
4 |
</head>
|
5 |
<body>
|
6 |
<div class="header">
|
7 |
+
<h1>The article <b>title</b></h1>
|
8 |
+
<h2>Sub <b>Title</b></h2>
|
9 |
<span class="author">Author name</span>
|
10 |
<div class="hero-image">
|
11 |
<img src="http://domain.com/image-header.png" />
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/GeneratorTrait.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Copyright (c) 2016-present, Facebook, Inc.
|
5 |
+
* All rights reserved.
|
6 |
+
*
|
7 |
+
* This source code is licensed under the license found in the
|
8 |
+
* LICENSE file in the root directory of this source tree.
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace Facebook\InstantArticles\Transformer;
|
12 |
+
|
13 |
+
use Faker\Factory;
|
14 |
+
use Faker\Generator;
|
15 |
+
|
16 |
+
trait GeneratorTrait
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* @return Generator
|
20 |
+
*/
|
21 |
+
protected function getFaker()
|
22 |
+
{
|
23 |
+
static $faker;
|
24 |
+
|
25 |
+
if ($faker === null) {
|
26 |
+
$faker = Factory::create();
|
27 |
+
$faker->seed(9000);
|
28 |
+
}
|
29 |
+
|
30 |
+
return $faker;
|
31 |
+
}
|
32 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Rules/AuthorRuleTest.php
CHANGED
@@ -8,31 +8,26 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
-
|
12 |
class AuthorRuleTest extends \PHPUnit_Framework_TestCase
|
13 |
{
|
14 |
-
protected function setUp()
|
15 |
-
{
|
16 |
-
}
|
17 |
-
|
18 |
public function testCreateFromProperties()
|
19 |
{
|
20 |
$author_rule = AuthorRule::createFrom(
|
21 |
-
|
22 |
"class" => "Facebook\\InstantArticles\\Transformer\\Rules\\AuthorRule",
|
23 |
"selector" => "div.post-content > p > em",
|
24 |
-
"properties" =>
|
25 |
-
"author.url" =>
|
26 |
"type" => "string",
|
27 |
"selector" => "a",
|
28 |
"attribute" => "href"
|
29 |
-
|
30 |
-
"author.description" =>
|
31 |
"type" => "string",
|
32 |
"selector" => "#text:nth-child(2)"
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
);
|
37 |
$this->assertEquals(get_class($author_rule), AuthorRule::getClassName());
|
38 |
}
|
@@ -43,18 +38,18 @@ class AuthorRuleTest extends \PHPUnit_Framework_TestCase
|
|
43 |
->withSelector("div.post-content > p > em")
|
44 |
->withProperty(
|
45 |
AuthorRule::PROPERTY_AUTHOR_URL,
|
46 |
-
|
47 |
"type" => "string",
|
48 |
"selector" => "a",
|
49 |
"attribute" => "href"
|
50 |
-
|
51 |
)
|
52 |
->withProperty(
|
53 |
AuthorRule::PROPERTY_AUTHOR_NAME,
|
54 |
-
|
55 |
"type" => "string",
|
56 |
"selector" => "span"
|
57 |
-
|
58 |
);
|
59 |
$this->assertEquals(get_class($author_rule), AuthorRule::getClassName());
|
60 |
}
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
|
|
11 |
class AuthorRuleTest extends \PHPUnit_Framework_TestCase
|
12 |
{
|
|
|
|
|
|
|
|
|
13 |
public function testCreateFromProperties()
|
14 |
{
|
15 |
$author_rule = AuthorRule::createFrom(
|
16 |
+
[
|
17 |
"class" => "Facebook\\InstantArticles\\Transformer\\Rules\\AuthorRule",
|
18 |
"selector" => "div.post-content > p > em",
|
19 |
+
"properties" => [
|
20 |
+
"author.url" => [
|
21 |
"type" => "string",
|
22 |
"selector" => "a",
|
23 |
"attribute" => "href"
|
24 |
+
],
|
25 |
+
"author.description" => [
|
26 |
"type" => "string",
|
27 |
"selector" => "#text:nth-child(2)"
|
28 |
+
]
|
29 |
+
]
|
30 |
+
]
|
31 |
);
|
32 |
$this->assertEquals(get_class($author_rule), AuthorRule::getClassName());
|
33 |
}
|
38 |
->withSelector("div.post-content > p > em")
|
39 |
->withProperty(
|
40 |
AuthorRule::PROPERTY_AUTHOR_URL,
|
41 |
+
[
|
42 |
"type" => "string",
|
43 |
"selector" => "a",
|
44 |
"attribute" => "href"
|
45 |
+
]
|
46 |
)
|
47 |
->withProperty(
|
48 |
AuthorRule::PROPERTY_AUTHOR_NAME,
|
49 |
+
[
|
50 |
"type" => "string",
|
51 |
"selector" => "span"
|
52 |
+
]
|
53 |
);
|
54 |
$this->assertEquals(get_class($author_rule), AuthorRule::getClassName());
|
55 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Rules/PullquoteRuleTest.php
CHANGED
@@ -16,58 +16,59 @@ class PullquoteRuleTest extends \PHPUnit_Framework_TestCase
|
|
16 |
protected function setUp()
|
17 |
{
|
18 |
\Logger::configure(
|
19 |
-
|
20 |
-
'rootLogger' =>
|
21 |
-
'appenders' =>
|
22 |
-
|
23 |
-
'appenders' =>
|
24 |
-
'facebook-instantarticles-transformer' =>
|
25 |
'class' => 'LoggerAppenderConsole',
|
26 |
'threshold' => 'INFO',
|
27 |
-
'layout' =>
|
28 |
'class' => 'LoggerLayoutSimple'
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
);
|
34 |
}
|
35 |
|
36 |
public function testTransformPullquote()
|
37 |
{
|
38 |
-
$transformer_rules =
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
71 |
|
72 |
$html =
|
73 |
'<blockquote class="pull-quote">'.
|
@@ -96,5 +97,4 @@ class PullquoteRuleTest extends \PHPUnit_Framework_TestCase
|
|
96 |
|
97 |
$this->assertEquals($expected, $result);
|
98 |
}
|
99 |
-
|
100 |
}
|
16 |
protected function setUp()
|
17 |
{
|
18 |
\Logger::configure(
|
19 |
+
[
|
20 |
+
'rootLogger' => [
|
21 |
+
'appenders' => ['facebook-instantarticles-transformer']
|
22 |
+
],
|
23 |
+
'appenders' => [
|
24 |
+
'facebook-instantarticles-transformer' => [
|
25 |
'class' => 'LoggerAppenderConsole',
|
26 |
'threshold' => 'INFO',
|
27 |
+
'layout' => [
|
28 |
'class' => 'LoggerLayoutSimple'
|
29 |
+
]
|
30 |
+
]
|
31 |
+
]
|
32 |
+
]
|
33 |
);
|
34 |
}
|
35 |
|
36 |
public function testTransformPullquote()
|
37 |
{
|
38 |
+
$transformer_rules = <<<'JSON'
|
39 |
+
{
|
40 |
+
"rules" : [
|
41 |
+
{
|
42 |
+
"class": "TextNodeRule"
|
43 |
+
},
|
44 |
+
{
|
45 |
+
"class": "ItalicRule",
|
46 |
+
"selector": "em"
|
47 |
+
},
|
48 |
+
{
|
49 |
+
"class": "ParagraphRule",
|
50 |
+
"selector": "p"
|
51 |
+
},
|
52 |
+
{
|
53 |
+
"class": "PassThroughRule",
|
54 |
+
"selector": "div.field-quote > p"
|
55 |
+
},
|
56 |
+
{
|
57 |
+
"class": "PassThroughRule",
|
58 |
+
"selector" : "div.field-quote"
|
59 |
+
},
|
60 |
+
{
|
61 |
+
"class" : "PullquoteRule",
|
62 |
+
"selector" : "blockquote.pull-quote"
|
63 |
+
},
|
64 |
+
{
|
65 |
+
"class" : "PullquoteCiteRule",
|
66 |
+
"selector" : "div.field-quote-author"
|
67 |
+
}
|
68 |
+
]
|
69 |
+
}
|
70 |
+
JSON;
|
71 |
+
|
72 |
|
73 |
$html =
|
74 |
'<blockquote class="pull-quote">'.
|
97 |
|
98 |
$this->assertEquals($expected, $result);
|
99 |
}
|
|
|
100 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Rules/RuleTest.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright (c) 2016-present, Facebook, Inc.
|
4 |
+
* All rights reserved.
|
5 |
+
*
|
6 |
+
* This source code is licensed under the license found in the
|
7 |
+
* LICENSE file in the root directory of this source tree.
|
8 |
+
*/
|
9 |
+
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
+
|
11 |
+
class RuleTest extends \PHPUnit_Framework_TestCase
|
12 |
+
{
|
13 |
+
public function testCreateFromPropertiesThrowsException()
|
14 |
+
{
|
15 |
+
$this->setExpectedException(
|
16 |
+
'Exception',
|
17 |
+
'All Rule class extensions should implement the Rule::createFrom($configuration) method'
|
18 |
+
);
|
19 |
+
|
20 |
+
Rule::createFrom([]);
|
21 |
+
}
|
22 |
+
|
23 |
+
public function testCreateThrowsException()
|
24 |
+
{
|
25 |
+
$this->setExpectedException(
|
26 |
+
'Exception',
|
27 |
+
'All Rule class extensions should implement the Rule::create() method'
|
28 |
+
);
|
29 |
+
|
30 |
+
Rule::create();
|
31 |
+
}
|
32 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/TransformerTest.php
CHANGED
@@ -13,38 +13,37 @@ use Facebook\InstantArticles\Elements\InstantArticle;
|
|
13 |
use Facebook\InstantArticles\Transformer\Rules\ParagraphRule;
|
14 |
use Facebook\InstantArticles\Transformer\Rules\ItalicRule;
|
15 |
|
16 |
-
|
17 |
class TransformerTest extends \PHPUnit_Framework_TestCase
|
18 |
{
|
19 |
protected function setUp()
|
20 |
{
|
21 |
\Logger::configure(
|
22 |
-
|
23 |
-
'rootLogger' =>
|
24 |
-
'appenders' =>
|
25 |
-
|
26 |
-
'appenders' =>
|
27 |
-
'facebook-instantarticles-transformer' =>
|
28 |
'class' => 'LoggerAppenderConsole',
|
29 |
'threshold' => 'INFO',
|
30 |
-
'layout' =>
|
31 |
'class' => 'LoggerLayoutSimple'
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
);
|
37 |
}
|
38 |
|
39 |
public function testSelfTransformerContent()
|
40 |
{
|
41 |
-
$json_file = file_get_contents(
|
42 |
|
43 |
$instant_article = InstantArticle::create();
|
44 |
$transformer = new Transformer();
|
45 |
$transformer->loadRules($json_file);
|
46 |
|
47 |
-
$html_file = file_get_contents(
|
48 |
|
49 |
libxml_use_internal_errors(true);
|
50 |
$document = new \DOMDocument();
|
@@ -54,7 +53,6 @@ class TransformerTest extends \PHPUnit_Framework_TestCase
|
|
54 |
$transformer->transform($instant_article, $document);
|
55 |
$instant_article->addMetaProperty('op:generator:version', '1.0.0');
|
56 |
$instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0');
|
57 |
-
$warnings = $transformer->getWarnings();
|
58 |
$result = $instant_article->render('', true)."\n";
|
59 |
|
60 |
//var_dump($result);
|
@@ -69,7 +67,7 @@ class TransformerTest extends \PHPUnit_Framework_TestCase
|
|
69 |
$rule2 = new ItalicRule();
|
70 |
$transformer->addRule($rule1);
|
71 |
$transformer->addRule($rule2);
|
72 |
-
$this->assertEquals(
|
73 |
}
|
74 |
|
75 |
public function testTransformerSetRules()
|
@@ -77,8 +75,8 @@ class TransformerTest extends \PHPUnit_Framework_TestCase
|
|
77 |
$transformer = new Transformer();
|
78 |
$rule1 = new ParagraphRule();
|
79 |
$rule2 = new ItalicRule();
|
80 |
-
$transformer->setRules(
|
81 |
-
$this->assertEquals(
|
82 |
}
|
83 |
|
84 |
public function testTransformerResetRules()
|
@@ -89,6 +87,6 @@ class TransformerTest extends \PHPUnit_Framework_TestCase
|
|
89 |
$transformer->addRule($rule1);
|
90 |
$transformer->addRule($rule2);
|
91 |
$transformer->resetRules();
|
92 |
-
$this->assertEquals(
|
93 |
}
|
94 |
}
|
13 |
use Facebook\InstantArticles\Transformer\Rules\ParagraphRule;
|
14 |
use Facebook\InstantArticles\Transformer\Rules\ItalicRule;
|
15 |
|
|
|
16 |
class TransformerTest extends \PHPUnit_Framework_TestCase
|
17 |
{
|
18 |
protected function setUp()
|
19 |
{
|
20 |
\Logger::configure(
|
21 |
+
[
|
22 |
+
'rootLogger' => [
|
23 |
+
'appenders' => ['facebook-instantarticles-transformer']
|
24 |
+
],
|
25 |
+
'appenders' => [
|
26 |
+
'facebook-instantarticles-transformer' => [
|
27 |
'class' => 'LoggerAppenderConsole',
|
28 |
'threshold' => 'INFO',
|
29 |
+
'layout' => [
|
30 |
'class' => 'LoggerLayoutSimple'
|
31 |
+
]
|
32 |
+
]
|
33 |
+
]
|
34 |
+
]
|
35 |
);
|
36 |
}
|
37 |
|
38 |
public function testSelfTransformerContent()
|
39 |
{
|
40 |
+
$json_file = file_get_contents(__DIR__ . '/instant-article-example-rules.json');
|
41 |
|
42 |
$instant_article = InstantArticle::create();
|
43 |
$transformer = new Transformer();
|
44 |
$transformer->loadRules($json_file);
|
45 |
|
46 |
+
$html_file = file_get_contents(__DIR__ . '/instant-article-example.html');
|
47 |
|
48 |
libxml_use_internal_errors(true);
|
49 |
$document = new \DOMDocument();
|
53 |
$transformer->transform($instant_article, $document);
|
54 |
$instant_article->addMetaProperty('op:generator:version', '1.0.0');
|
55 |
$instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0');
|
|
|
56 |
$result = $instant_article->render('', true)."\n";
|
57 |
|
58 |
//var_dump($result);
|
67 |
$rule2 = new ItalicRule();
|
68 |
$transformer->addRule($rule1);
|
69 |
$transformer->addRule($rule2);
|
70 |
+
$this->assertEquals([$rule1, $rule2], $transformer->getRules());
|
71 |
}
|
72 |
|
73 |
public function testTransformerSetRules()
|
75 |
$transformer = new Transformer();
|
76 |
$rule1 = new ParagraphRule();
|
77 |
$rule2 = new ItalicRule();
|
78 |
+
$transformer->setRules([$rule1, $rule2]);
|
79 |
+
$this->assertEquals([$rule1, $rule2], $transformer->getRules());
|
80 |
}
|
81 |
|
82 |
public function testTransformerResetRules()
|
87 |
$transformer->addRule($rule1);
|
88 |
$transformer->addRule($rule2);
|
89 |
$transformer->resetRules();
|
90 |
+
$this->assertEquals([], $transformer->getRules());
|
91 |
}
|
92 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Warnings/InvalidSelectorTest.php
CHANGED
@@ -13,32 +13,26 @@ use Facebook\InstantArticles\Transformer\Rules\SocialEmbedRule;
|
|
13 |
|
14 |
class InvalidSelectorTest extends \PHPUnit_Framework_TestCase
|
15 |
{
|
16 |
-
private $properties;
|
17 |
-
|
18 |
-
protected function setUp()
|
19 |
-
{
|
20 |
-
|
21 |
-
}
|
22 |
-
|
23 |
public function testInvalidSelectorToString()
|
24 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
$json =
|
27 |
-
'{'.
|
28 |
-
'"class": "SocialEmbedRule",'.
|
29 |
-
'"selector" : "figure.op-social",'.
|
30 |
-
'"properties" : {'.
|
31 |
-
'"socialembed.url" : {'.
|
32 |
-
'"type" : "string",'.
|
33 |
-
'"selector" : "iframe",'.
|
34 |
-
'"attribute": "src"'.
|
35 |
-
'},'.
|
36 |
-
'"socialembed.iframe" : {'.
|
37 |
-
'"type" : "children",'.
|
38 |
-
'"selector" : "iframe"'.
|
39 |
-
'}'.
|
40 |
-
'}'.
|
41 |
-
'}';
|
42 |
$properties = json_decode($json, true);
|
43 |
|
44 |
$instant_article = InstantArticle::create();
|
13 |
|
14 |
class InvalidSelectorTest extends \PHPUnit_Framework_TestCase
|
15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
public function testInvalidSelectorToString()
|
17 |
{
|
18 |
+
$json = <<<'JSON'
|
19 |
+
{
|
20 |
+
"class": "SocialEmbedRule",
|
21 |
+
"selector" : "figure.op-social",
|
22 |
+
"properties" : {
|
23 |
+
"socialembed.url" : {
|
24 |
+
"type" : "string",
|
25 |
+
"selector" : "iframe",
|
26 |
+
"attribute": "src"
|
27 |
+
},
|
28 |
+
"socialembed.iframe" : {
|
29 |
+
"type" : "children",
|
30 |
+
"selector" : "iframe"
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
34 |
+
JSON;
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
$properties = json_decode($json, true);
|
37 |
|
38 |
$instant_article = InstantArticle::create();
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/instant-article-example.html
CHANGED
@@ -15,8 +15,8 @@
|
|
15 |
<img src="https://jpeg.org/images/jpegls-home.jpg"/>
|
16 |
<figcaption><h1>Image Name</h1>Some text on text node<cite>Some caption to the image</cite></figcaption>
|
17 |
</figure>
|
18 |
-
<h1>Big Top Title</h1>
|
19 |
-
<h2>Smaller SubTitle</h2>
|
20 |
<time class="op-published" datetime="1984-08-14T19:30:00+00:00">August 14th, 7:30pm</time>
|
21 |
<time class="op-modified" datetime="2016-02-10T10:00:00+00:00">February 10th, 10:00am</time>
|
22 |
<address><a href="#" title="Title of author">Author Name</a>
|
15 |
<img src="https://jpeg.org/images/jpegls-home.jpg"/>
|
16 |
<figcaption><h1>Image Name</h1>Some text on text node<cite>Some caption to the image</cite></figcaption>
|
17 |
</figure>
|
18 |
+
<h1>Big Top <b>Title</b></h1>
|
19 |
+
<h2>Smaller <b>SubTitle</b></h2>
|
20 |
<time class="op-published" datetime="1984-08-14T19:30:00+00:00">August 14th, 7:30pm</time>
|
21 |
<time class="op-modified" datetime="2016-02-10T10:00:00+00:00">February 10th, 10:00am</time>
|
22 |
<address><a href="#" title="Title of author">Author Name</a>
|
vendor/facebook/php-sdk-v4/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
Copyright
|
2 |
|
3 |
You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
4 |
use, copy, modify, and distribute this software in source code or binary
|
1 |
+
Copyright 2016 Facebook, Inc.
|
2 |
|
3 |
You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
4 |
use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Authentication/AccessToken.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Authentication/AccessTokenMetadata.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Authentication/OAuth2Client.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookAuthenticationException.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookAuthorizationException.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookClientException.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookOtherException.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookResponseException.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookResumableUploadException.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookSDKException.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookServerException.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Exceptions/FacebookThrottleException.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Facebook.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
@@ -53,7 +53,7 @@ class Facebook
|
|
53 |
/**
|
54 |
* @const string Version number of the Facebook PHP SDK.
|
55 |
*/
|
56 |
-
const VERSION = '5.1.
|
57 |
|
58 |
/**
|
59 |
* @const string Default Graph API version for requests.
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
53 |
/**
|
54 |
* @const string Version number of the Facebook PHP SDK.
|
55 |
*/
|
56 |
+
const VERSION = '5.1.4';
|
57 |
|
58 |
/**
|
59 |
* @const string Default Graph API version for requests.
|
vendor/facebook/php-sdk-v4/src/Facebook/FacebookApp.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
@@ -84,7 +84,7 @@ class FacebookApp implements \Serializable
|
|
84 |
*/
|
85 |
public function serialize()
|
86 |
{
|
87 |
-
return
|
88 |
}
|
89 |
|
90 |
/**
|
@@ -94,7 +94,7 @@ class FacebookApp implements \Serializable
|
|
94 |
*/
|
95 |
public function unserialize($serialized)
|
96 |
{
|
97 |
-
list($id, $secret) =
|
98 |
|
99 |
$this->__construct($id, $secret);
|
100 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
84 |
*/
|
85 |
public function serialize()
|
86 |
{
|
87 |
+
return implode('|', [$this->id, $this->secret]);
|
88 |
}
|
89 |
|
90 |
/**
|
94 |
*/
|
95 |
public function unserialize($serialized)
|
96 |
{
|
97 |
+
list($id, $secret) = explode('|', $serialized);
|
98 |
|
99 |
$this->__construct($id, $secret);
|
100 |
}
|
vendor/facebook/php-sdk-v4/src/Facebook/FacebookBatchRequest.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/FacebookBatchResponse.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/FacebookClient.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/FacebookRequest.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
@@ -154,7 +154,7 @@ class FacebookRequest
|
|
154 |
}
|
155 |
|
156 |
/**
|
157 |
-
* Return the access token for this request
|
158 |
*
|
159 |
* @return AccessToken|null
|
160 |
*/
|
@@ -214,8 +214,6 @@ class FacebookRequest
|
|
214 |
* Set the HTTP method for this request.
|
215 |
*
|
216 |
* @param string
|
217 |
-
*
|
218 |
-
* @return FacebookRequest
|
219 |
*/
|
220 |
public function setMethod($method)
|
221 |
{
|
@@ -273,7 +271,7 @@ class FacebookRequest
|
|
273 |
}
|
274 |
|
275 |
/**
|
276 |
-
* Return the
|
277 |
*
|
278 |
* @return string
|
279 |
*/
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
154 |
}
|
155 |
|
156 |
/**
|
157 |
+
* Return the access token for this request as an AccessToken entity.
|
158 |
*
|
159 |
* @return AccessToken|null
|
160 |
*/
|
214 |
* Set the HTTP method for this request.
|
215 |
*
|
216 |
* @param string
|
|
|
|
|
217 |
*/
|
218 |
public function setMethod($method)
|
219 |
{
|
271 |
}
|
272 |
|
273 |
/**
|
274 |
+
* Return the endpoint for this request.
|
275 |
*
|
276 |
* @return string
|
277 |
*/
|
vendor/facebook/php-sdk-v4/src/Facebook/FacebookResponse.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookFile.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookResumableUploader.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookTransferChunk.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/FacebookVideo.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/FileUpload/Mimetypes.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/Collection.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphAchievement.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphAlbum.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphApplication.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphCoverPhoto.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphEdge.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphEvent.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphGroup.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphList.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphLocation.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphNode.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphNodeFactory.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphObject.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphObjectFactory.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphPage.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphPicture.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphSessionInfo.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/GraphNodes/GraphUser.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookCanvasHelper.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookJavaScriptHelper.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookPageTabHelper.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookRedirectLoginHelper.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Http/GraphRawResponse.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyInterface.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyMultipart.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Http/RequestBodyUrlEncoded.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookCurl.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookCurlHttpClient.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookHttpClientInterface.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookStream.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookStreamHttpClient.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/HttpClientsFactory.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
@@ -25,6 +25,7 @@ namespace Facebook\HttpClients;
|
|
25 |
|
26 |
use GuzzleHttp\Client;
|
27 |
use InvalidArgumentException;
|
|
|
28 |
|
29 |
class HttpClientsFactory
|
30 |
{
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
25 |
|
26 |
use GuzzleHttp\Client;
|
27 |
use InvalidArgumentException;
|
28 |
+
use Exception;
|
29 |
|
30 |
class HttpClientsFactory
|
31 |
{
|
vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/PersistentDataFactory.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/PersistentData/PersistentDataInterface.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
@@ -48,11 +48,15 @@ trait PseudoRandomStringGeneratorTrait
|
|
48 |
*
|
49 |
* @param string $binaryData The binary data to convert to hex.
|
50 |
* @param int $length The length of the string to return.
|
|
|
51 |
*
|
52 |
* @return string
|
53 |
*/
|
54 |
public function binToHex($binaryData, $length)
|
55 |
{
|
56 |
-
|
|
|
|
|
|
|
57 |
}
|
58 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
48 |
*
|
49 |
* @param string $binaryData The binary data to convert to hex.
|
50 |
* @param int $length The length of the string to return.
|
51 |
+
* @throws \RuntimeException Throws an exception when multibyte support is not enabled
|
52 |
*
|
53 |
* @return string
|
54 |
*/
|
55 |
public function binToHex($binaryData, $length)
|
56 |
{
|
57 |
+
if (true !== extension_loaded('mbstring')) {
|
58 |
+
throw new \RuntimeException('Multibyte support required');
|
59 |
+
}
|
60 |
+
return \mb_substr(\bin2hex($binaryData), 0, $length);
|
61 |
}
|
62 |
}
|
vendor/facebook/php-sdk-v4/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/SignedRequest.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Url/FacebookUrlDetectionHandler.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
@@ -95,8 +95,8 @@ class FacebookUrlDetectionHandler implements UrlDetectionInterface
|
|
95 |
protected function getHostName()
|
96 |
{
|
97 |
// Check for proxy first
|
98 |
-
if ($
|
99 |
-
$elements = explode(',', $
|
100 |
$host = $elements[count($elements) - 1];
|
101 |
} elseif (!$host = $this->getHeader('HOST')) {
|
102 |
if (!$host = $this->getServerVar('SERVER_NAME')) {
|
@@ -160,4 +160,22 @@ class FacebookUrlDetectionHandler implements UrlDetectionInterface
|
|
160 |
{
|
161 |
return $this->getServerVar('HTTP_' . $key);
|
162 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
95 |
protected function getHostName()
|
96 |
{
|
97 |
// Check for proxy first
|
98 |
+
if ($header = $this->getHeader('X_FORWARDED_HOST') && $this->isValidForwardedHost($header)) {
|
99 |
+
$elements = explode(',', $header);
|
100 |
$host = $elements[count($elements) - 1];
|
101 |
} elseif (!$host = $this->getHeader('HOST')) {
|
102 |
if (!$host = $this->getServerVar('SERVER_NAME')) {
|
160 |
{
|
161 |
return $this->getServerVar('HTTP_' . $key);
|
162 |
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Checks if the value in X_FORWARDED_HOST is a valid hostname
|
166 |
+
* Could prevent unintended redirections
|
167 |
+
*
|
168 |
+
* @param string $header
|
169 |
+
*
|
170 |
+
* @return boolean
|
171 |
+
*/
|
172 |
+
protected function isValidForwardedHost($header)
|
173 |
+
{
|
174 |
+
$elements = explode(',', $header);
|
175 |
+
$host = $elements[count($elements) - 1];
|
176 |
+
|
177 |
+
return preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $host) //valid chars check
|
178 |
+
&& 0 < strlen($host) && strlen($host) < 254 //overall length check
|
179 |
+
&& preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $host); //length of each label
|
180 |
+
}
|
181 |
}
|
vendor/facebook/php-sdk-v4/src/Facebook/Url/FacebookUrlManipulator.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/Url/UrlDetectionInterface.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
vendor/facebook/php-sdk-v4/src/Facebook/autoload.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Copyright
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Copyright 2016 Facebook, Inc.
|
4 |
*
|
5 |
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
|
6 |
* use, copy, modify, and distribute this software in source code or binary
|