Version Description
Download this release
Release Info
Developer | diegoquinteiro |
Plugin | Instant Articles for WP |
Version | 3.0.2 |
Comparing to | |
See all releases |
Code changes from version 3.3.3 to 3.0.2
- README.md +0 -46
- assets/banner-1544x500.jpg +0 -0
- assets/banner-772x250.jpg +0 -0
- assets/check@2x.png +0 -0
- assets/connect@2x.png +0 -0
- assets/customize@2x.png +0 -0
- assets/icon-128x128.jpg +0 -0
- assets/icon-256x256.jpg +0 -0
- assets/icon-fb-login.png +0 -0
- assets/key@2x.png +0 -0
- assets/pencil.png +0 -0
- assets/screenshot-1.png +0 -0
- class-instant-articles-post.php +66 -56
- class-instant-articles-publisher.php +4 -33
- compat.php +0 -12
- compat/class-instant-articles-get-the-image.php +0 -27
- compat/class-instant-articles-jetpack.php +1 -17
- compat/class-instant-articles-playbuzz.php +0 -27
- compat/get-the-image-rules-configuration.json +0 -13
- compat/jetpack-rules-configuration.json +0 -91
- compat/playbuzz-rules-configuration.json +0 -23
- css/instant-articles-meta-box.css +0 -6
- css/instant-articles-settings-wizard.css +3 -0
- css/instant-articles-wizard.css +0 -426
- embeds.php +1 -11
- facebook-instant-articles.php +11 -49
- feed-template.php +0 -5
- js/instant-articles-meta-box.js +0 -14
- js/instant-articles-settings.js +18 -1
- js/instant-articles-wizard.js +0 -135
- languages/de_DE.mo +0 -0
- languages/de_DE.po +0 -39
- meta-box/class-instant-articles-meta-box.php +5 -39
- meta-box/meta-box-template.php +1 -22
- readme.txt +1 -42
- release.sh +0 -472
- rules-configuration.json +51 -98
- vendor/autoload.php +1 -1
- vendor/composer/autoload_files.php +1 -1
- vendor/composer/autoload_psr4.php +1 -1
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +6 -6
- vendor/composer/installed.json +27 -28
- vendor/facebook/facebook-instant-articles-sdk-php/.github/ISSUE_TEMPLATE.md +0 -13
- vendor/facebook/facebook-instant-articles-sdk-php/.github/PULL_REQUEST_TEMPLATE.md +0 -9
- vendor/facebook/facebook-instant-articles-sdk-php/.gitignore +0 -1
- vendor/facebook/facebook-instant-articles-sdk-php/composer.json +2 -2
- vendor/facebook/facebook-instant-articles-sdk-php/composer.lock +72 -73
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Client.php +1 -57
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Helper.php +2 -3
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Element.php +2 -19
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/GeoTag.php +1 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Image.php +0 -36
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/InstantArticle.php +1 -129
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Interactive.php +1 -1
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Video.php +0 -37
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Parser/instant-articles-rules.json +10 -25
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ChildrenGetter.php +1 -5
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ConstantGetter.php +0 -42
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ElementGetter.php +5 -7
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/FragmentGetter.php +0 -49
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/GetterFactory.php +1 -13
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/JSONGetter.php +0 -63
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/MultipleElementsGetter.php +0 -44
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/NextSiblingElementGetter.php +0 -75
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/StringGetter.php +2 -53
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/Compat/JetpackSlideshowRule.php +0 -77
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ConfigurationSelectorRule.php +1 -1
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterRelatedArticlesRule.php +14 -1
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H1Rule.php +1 -1
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H2Rule.php +1 -1
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ImageInsideParagraphRule.php +80 -4
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ImageRule.php +6 -50
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InstantArticleRule.php +1 -0
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InteractiveInsideParagraphRule.php +0 -22
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InteractiveRule.php +6 -31
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/RelatedArticlesRule.php +2 -1
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/Rule.php +3 -2
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TimeRule.php +7 -18
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Transformer.php +0 -77
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/InvalidSelector.php +4 -12
- vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/validator_warning_messages.ini +1 -1
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Client/ClientTest.php +0 -241
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Client/HelperTest.php +1 -1
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/InstantArticleTest.php +0 -245
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/InteractiveTest.php +27 -49
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/SocialEmbedTest.php +96 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Parser/instant-article-example.html +1 -1
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/{CustomHTMLTransformerTest.php → CMS/WPTransformerTest.php} +6 -7
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp-ia.xml +40 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp-rules.json +205 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp.html +12 -0
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/simple-ia.html +0 -30
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/simple-rules.json +1 -86
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/simple.html +0 -28
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/TransformerTest.php +19 -93
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/custom-html-ia.xml +0 -202
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/custom-html-rules.json +0 -606
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/custom.html +0 -221
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/instant-article-example-multibyte.html +0 -204
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/instant-article-example-nonutf8.html +0 -204
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/instant-article-example.html +1 -1
- vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/wp-rules.json +270 -0
- vendor/facebook/graph-sdk/phpcs.xml.dist +0 -7
- vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/RandomBytesPseudoRandomStringGenerator.php +0 -59
- vendor/facebook/{graph-sdk → php-sdk-v4}/LICENSE +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/composer.json +3 -4
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Authentication/AccessToken.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Authentication/AccessTokenMetadata.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Authentication/OAuth2Client.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookAuthenticationException.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookAuthorizationException.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookClientException.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookOtherException.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookResponseException.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookResumableUploadException.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookSDKException.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookServerException.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookThrottleException.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Facebook.php +3 -3
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FacebookApp.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FacebookBatchRequest.php +3 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FacebookBatchResponse.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FacebookClient.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FacebookRequest.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FacebookResponse.php +2 -2
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FileUpload/FacebookFile.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FileUpload/FacebookResumableUploader.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FileUpload/FacebookTransferChunk.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FileUpload/FacebookVideo.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FileUpload/Mimetypes.php +1 -2
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/Birthday.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/Collection.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphAchievement.php +2 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphAlbum.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphApplication.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphCoverPhoto.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphEdge.php +1 -15
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphEvent.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphGroup.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphList.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphLocation.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphNode.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphNodeFactory.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphObject.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphObjectFactory.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphPage.php +1 -23
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphPicture.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphSessionInfo.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphUser.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Helpers/FacebookCanvasHelper.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Helpers/FacebookJavaScriptHelper.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Helpers/FacebookPageTabHelper.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Helpers/FacebookRedirectLoginHelper.php +2 -11
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Http/GraphRawResponse.php +2 -2
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Http/RequestBodyInterface.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Http/RequestBodyMultipart.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Http/RequestBodyUrlEncoded.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/FacebookCurl.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/FacebookCurlHttpClient.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/FacebookHttpClientInterface.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/FacebookStream.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/FacebookStreamHttpClient.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/HttpClientsFactory.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem +0 -0
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/PersistentData/PersistentDataFactory.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/PersistentData/PersistentDataInterface.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php +4 -12
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php +2 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/SignedRequest.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Url/FacebookUrlDetectionHandler.php +2 -3
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Url/FacebookUrlManipulator.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Url/UrlDetectionInterface.php +1 -1
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/autoload.php +1 -3
- vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/polyfills.php +1 -1
- vendor/symfony/css-selector/Exception/SyntaxErrorException.php +5 -5
- vendor/symfony/css-selector/LICENSE +1 -1
- vendor/symfony/css-selector/Node/Specificity.php +1 -1
- vendor/symfony/css-selector/Parser/Reader.php +2 -0
- vendor/symfony/css-selector/Parser/TokenStream.php +2 -2
- vendor/symfony/css-selector/XPath/Extension/NodeExtension.php +1 -1
- vendor/symfony/css-selector/XPath/Translator.php +5 -2
- vendor/symfony/css-selector/XPath/XPathExpr.php +4 -4
- vendor/symfony/css-selector/composer.json +2 -2
- wizard/class-instant-articles-invalid-wizard-transition-exception.php +0 -19
- wizard/class-instant-articles-option-ads.php +0 -245
- wizard/class-instant-articles-option-analytics.php +0 -144
- wizard/class-instant-articles-option-fb-app.php +0 -65
- wizard/class-instant-articles-option-fb-page.php +0 -77
- wizard/class-instant-articles-option-publishing.php +0 -121
- wizard/class-instant-articles-option-styles.php +0 -53
- wizard/class-instant-articles-option.php +0 -490
- wizard/class-instant-articles-wizard-fb-helper.php +0 -212
- wizard/class-instant-articles-wizard-review-submission.php +0 -96
- wizard/class-instant-articles-wizard-state.php +0 -357
- wizard/class-instant-articles-wizard.php +0 -336
- wizard/state_machine.txt +0 -26
- wizard/templates/advanced-template.php +0 -31
- wizard/templates/all-steps-wizard.php +0 -288
- wizard/templates/app-setup-template.php +0 -115
- wizard/templates/overview-template.php +0 -43
- wizard/templates/page-selection-template.php +0 -61
- wizard/templates/review-submission-template.php +0 -190
- wizard/templates/style-selection-template.php +0 -66
- wizard/templates/wizard-template.php +0 -115
- wpcom-helper.php +0 -50
README.md
CHANGED
@@ -1,12 +1,7 @@
|
|
1 |
-
[![Build Status](https://travis-ci.org/Automattic/facebook-instant-articles-wp.svg?branch=master)](https://travis-ci.org/Automattic/facebook-instant-articles-wp)
|
2 |
-
|
3 |
# Instant Articles for WP
|
4 |
|
5 |
Enable [Instant Articles for Facebook](https://developers.facebook.com/docs/instant-articles) on your WordPress site.
|
6 |
|
7 |
-
## Plugin activity
|
8 |
-
[![Throughput Graph](https://graphs.waffle.io/Automattic/facebook-instant-articles-wp/throughput.svg)](https://waffle.io/Automattic/facebook-instant-articles-wp/metrics/throughput)
|
9 |
-
|
10 |
## Description
|
11 |
|
12 |
This plugin adds support for Instant Articles for Facebook, which is a new way for publishers to distribute fast, interactive stories on Facebook. Instant Articles are preloaded in the Facebook mobile app so they load instantly.
|
@@ -67,44 +62,3 @@ By default it is set to `instant-articles` which usually will give you a feed UR
|
|
67 |
**How do I flush the rewrite rules after changing the feed slug?**
|
68 |
|
69 |
Usually simply visiting the permalinks settings page in the WordPress dashboard will do the trick (/wp-admin/options-permalink.php)
|
70 |
-
|
71 |
-
## Development Environment
|
72 |
-
You are more than welcome to help us to make this plugin even better!
|
73 |
-
|
74 |
-
### Setup SDK and WP to use the Github code
|
75 |
-
Most of development and debugging we use the master or any feature branch for the development of WP plugin.
|
76 |
-
Sometimes it needs specific or newest version of the SDK to match all the new features that are release candidates to every new release of SDK and WP plugin.
|
77 |
-
|
78 |
-
The SDK is also under development @ GitHub: <https://github.com/facebook/facebook-instant-articles-sdk-php>
|
79 |
-
|
80 |
-
#### Pre-requisites
|
81 |
-
- Have PHP installed (you can install with homebrew)
|
82 |
-
- Have WebServer installed (you can use MAMP)
|
83 |
-
- Have WP installed (downloading from wordpress.org)
|
84 |
-
|
85 |
-
#### Setup
|
86 |
-
Clone both repositories into your developer folder (ex: ~/instant-articles).
|
87 |
-
```
|
88 |
-
git clone git@github.com:Automattic/facebook-instant-articles-wp.git
|
89 |
-
git clone git@github.com:facebook/facebook-instant-articles-sdk-php.git
|
90 |
-
```
|
91 |
-
|
92 |
-
Build both source folders:
|
93 |
-
```
|
94 |
-
cd facebook-instant-articles-sdk-php
|
95 |
-
composer install
|
96 |
-
|
97 |
-
cd ../facebook-instant-articles-wp
|
98 |
-
composer install
|
99 |
-
```
|
100 |
-
|
101 |
-
Now remove the build from your WordPress, so it will include the code you've just built.
|
102 |
-
```
|
103 |
-
rm -rf vendor/facebook/facebook-instant-articles-sdk-php
|
104 |
-
ln -s ~/facebook-instant-articles-sdk-php vendor/facebook/facebook-instant-articles-sdk-php
|
105 |
-
```
|
106 |
-
|
107 |
-
and now you can create a link inside your /wp-content/plugins to your folder
|
108 |
-
```
|
109 |
-
ln -s ~/facebook-instant-articles-wp wp-content/plugins/facebook-instant-articles-wp
|
110 |
-
```
|
|
|
|
|
1 |
# Instant Articles for WP
|
2 |
|
3 |
Enable [Instant Articles for Facebook](https://developers.facebook.com/docs/instant-articles) on your WordPress site.
|
4 |
|
|
|
|
|
|
|
5 |
## Description
|
6 |
|
7 |
This plugin adds support for Instant Articles for Facebook, which is a new way for publishers to distribute fast, interactive stories on Facebook. Instant Articles are preloaded in the Facebook mobile app so they load instantly.
|
62 |
**How do I flush the rewrite rules after changing the feed slug?**
|
63 |
|
64 |
Usually simply visiting the permalinks settings page in the WordPress dashboard will do the trick (/wp-admin/options-permalink.php)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/banner-1544x500.jpg
DELETED
Binary file
|
assets/banner-772x250.jpg
DELETED
Binary file
|
assets/check@2x.png
DELETED
Binary file
|
assets/connect@2x.png
DELETED
Binary file
|
assets/customize@2x.png
DELETED
Binary file
|
assets/icon-128x128.jpg
DELETED
Binary file
|
assets/icon-256x256.jpg
DELETED
Binary file
|
assets/icon-fb-login.png
DELETED
Binary file
|
assets/key@2x.png
DELETED
Binary file
|
assets/pencil.png
DELETED
Binary file
|
assets/screenshot-1.png
DELETED
Binary file
|
class-instant-articles-post.php
CHANGED
@@ -14,7 +14,6 @@ use Facebook\InstantArticles\Elements\Ad;
|
|
14 |
use Facebook\InstantArticles\Elements\Analytics;
|
15 |
use Facebook\InstantArticles\Elements\Author;
|
16 |
use Facebook\InstantArticles\Elements\Image;
|
17 |
-
use Facebook\InstantArticles\Elements\Video;
|
18 |
use Facebook\InstantArticles\Elements\Caption;
|
19 |
use Facebook\InstantArticles\Elements\Footer;
|
20 |
use Facebook\InstantArticles\Transformer\Transformer;
|
@@ -85,15 +84,6 @@ class Instant_Articles_Post {
|
|
85 |
public function get_the_title() {
|
86 |
$title = $this->_post->post_title;
|
87 |
|
88 |
-
/**
|
89 |
-
* Apply the default filter 'the_title' for the post title.
|
90 |
-
*
|
91 |
-
* @since 3.1
|
92 |
-
* @param string $title The current post title.
|
93 |
-
* @param int $id The current post ID.
|
94 |
-
*/
|
95 |
-
$title = apply_filters( 'the_title', $title, $this->_post->ID );
|
96 |
-
|
97 |
/**
|
98 |
* Filter the post title for use in instant articles.
|
99 |
*
|
@@ -254,12 +244,12 @@ class Instant_Articles_Post {
|
|
254 |
// If post is draft, clone it to get the eventual permalink,
|
255 |
// see http://wordpress.stackexchange.com/a/42988.
|
256 |
if ( in_array( $this->_post->post_status, array( 'draft', 'pending', 'auto-draft' ), true ) ) {
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
} else {
|
262 |
-
|
263 |
}
|
264 |
|
265 |
return $url;
|
@@ -321,11 +311,6 @@ class Instant_Articles_Post {
|
|
321 |
* @since 0.1
|
322 |
* @param string $content The current post content.
|
323 |
*/
|
324 |
-
|
325 |
-
// Some people choose to disable wpautop. Due to the Instant Articles spec, we really want it in!
|
326 |
-
if ( ! has_filter( 'the_content', 'wpautop' ) )
|
327 |
-
add_filter( 'the_content', 'wpautop' );
|
328 |
-
|
329 |
$content = apply_filters( 'the_content', $content );
|
330 |
|
331 |
// Maybe cleanup some globals after us?
|
@@ -334,12 +319,15 @@ class Instant_Articles_Post {
|
|
334 |
wp_reset_postdata();
|
335 |
}
|
336 |
|
337 |
-
//
|
338 |
-
|
339 |
-
foreach ( $matches[0] as $link ) {
|
340 |
-
$content = str_replace( $link, strip_tags($link), $content );
|
341 |
-
}
|
342 |
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
/**
|
344 |
* Filter the post content for Instant Articles.
|
345 |
*
|
@@ -493,12 +481,12 @@ class Instant_Articles_Post {
|
|
493 |
* Get the cover media.
|
494 |
*
|
495 |
* @since 0.1
|
496 |
-
* @return
|
497 |
*/
|
498 |
public function get_cover_media() {
|
499 |
|
500 |
-
$cover_media =
|
501 |
-
|
502 |
|
503 |
// If someone else is handling this, let them. Otherwise fall back to us trying to use the featured image.
|
504 |
if ( has_filter( 'instant_articles_cover_media' ) ) {
|
@@ -506,18 +494,16 @@ class Instant_Articles_Post {
|
|
506 |
* Filter the cover media.
|
507 |
*
|
508 |
* @since 0.1
|
509 |
-
* @param
|
510 |
* @param int $post_id The current post ID.
|
511 |
*/
|
512 |
$cover_media = apply_filters( 'instant_articles_cover_media', $cover_media, $this->_post->ID );
|
513 |
} else {
|
514 |
-
|
515 |
$featured_image_data = $this->get_the_featured_image();
|
516 |
if ( isset( $featured_image_data['src'] ) && strlen( $featured_image_data['src'] ) ) {
|
517 |
-
$cover_media =
|
518 |
-
|
519 |
-
|
520 |
-
}
|
521 |
}
|
522 |
}
|
523 |
|
@@ -588,15 +574,13 @@ class Instant_Articles_Post {
|
|
588 |
public function to_instant_article() {
|
589 |
|
590 |
/**
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
do_action( 'instant_articles_before_transform_post', $this );
|
597 |
|
598 |
-
is_transforming_instant_article( true );
|
599 |
-
|
600 |
// Get time zone configured in WordPress. Default to UTC if no time zone configured.
|
601 |
$date_time_zone = get_option( 'timezone_string' ) ? new DateTimeZone( get_option( 'timezone_string' ) ) : new DateTimeZone( 'UTC' );
|
602 |
|
@@ -637,16 +621,10 @@ class Instant_Articles_Post {
|
|
637 |
$title = $this->get_the_title();
|
638 |
if ( $title ) {
|
639 |
$document = new DOMDocument();
|
640 |
-
libxml_use_internal_errors(true);
|
641 |
$document->loadHTML( '<?xml encoding="' . $blog_charset . '" ?><h1>' . $title . '</h1>' );
|
642 |
-
libxml_use_internal_errors(false);
|
643 |
$transformer->transform( $header, $document );
|
644 |
}
|
645 |
|
646 |
-
if ( $this->has_subtitle() ) {
|
647 |
-
$header->withSubTitle ( $this->get_the_subtitle() ) ;
|
648 |
-
}
|
649 |
-
|
650 |
$authors = $this->get_the_authors();
|
651 |
foreach ( $authors as $author ) {
|
652 |
$author_obj = Author::create();
|
@@ -665,12 +643,17 @@ class Instant_Articles_Post {
|
|
665 |
if ( $kicker ) {
|
666 |
$header->withKicker( $kicker );
|
667 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
668 |
|
669 |
-
|
670 |
-
if ( $cover->getUrl() ) {
|
671 |
-
$header->withCover( $cover );
|
672 |
}
|
673 |
-
|
674 |
$this->instant_article =
|
675 |
InstantArticle::create()
|
676 |
->withCanonicalUrl( $this->get_canonical_url() )
|
@@ -685,19 +668,46 @@ class Instant_Articles_Post {
|
|
685 |
$this->instant_article->withStyle( 'default' );
|
686 |
}
|
687 |
|
688 |
-
|
689 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
690 |
}
|
691 |
|
692 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
693 |
|
694 |
$this->add_ads_from_settings();
|
695 |
$this->add_analytics_from_settings();
|
696 |
|
697 |
$this->instant_article = apply_filters( 'instant_articles_transformed_element', $this->instant_article );
|
698 |
|
699 |
-
is_transforming_instant_article( false );
|
700 |
-
|
701 |
/**
|
702 |
* Fires after the instant article is rendered.
|
703 |
*
|
14 |
use Facebook\InstantArticles\Elements\Analytics;
|
15 |
use Facebook\InstantArticles\Elements\Author;
|
16 |
use Facebook\InstantArticles\Elements\Image;
|
|
|
17 |
use Facebook\InstantArticles\Elements\Caption;
|
18 |
use Facebook\InstantArticles\Elements\Footer;
|
19 |
use Facebook\InstantArticles\Transformer\Transformer;
|
84 |
public function get_the_title() {
|
85 |
$title = $this->_post->post_title;
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
/**
|
88 |
* Filter the post title for use in instant articles.
|
89 |
*
|
244 |
// If post is draft, clone it to get the eventual permalink,
|
245 |
// see http://wordpress.stackexchange.com/a/42988.
|
246 |
if ( in_array( $this->_post->post_status, array( 'draft', 'pending', 'auto-draft' ), true ) ) {
|
247 |
+
$post_clone = clone $this->_post;
|
248 |
+
$post_clone->post_status = 'published';
|
249 |
+
$post_clone->post_name = sanitize_title( $post_clone->post_name ? $post_clone->post_name : $post_clone->post_title, $post_clone->ID );
|
250 |
+
$url = get_permalink( $post_clone );
|
251 |
} else {
|
252 |
+
$url = get_permalink( $this->_post );
|
253 |
}
|
254 |
|
255 |
return $url;
|
311 |
* @since 0.1
|
312 |
* @param string $content The current post content.
|
313 |
*/
|
|
|
|
|
|
|
|
|
|
|
314 |
$content = apply_filters( 'the_content', $content );
|
315 |
|
316 |
// Maybe cleanup some globals after us?
|
319 |
wp_reset_postdata();
|
320 |
}
|
321 |
|
322 |
+
// Some people choose to disable wpautop. Due to the Instant Articles spec, we really want it in!
|
323 |
+
$content = wpautop( $content );
|
|
|
|
|
|
|
324 |
|
325 |
+
// Remove hyperlinks beginning with a # as they cause errors on Facebook (from http://wordpress.stackexchange.com/a/227332/19528)
|
326 |
+
preg_match_all( '!<a[^>]*? href=[\'"]#[^<]+</a>!i', $content, $matches );
|
327 |
+
foreach ( $matches[0] as $link ) {
|
328 |
+
$content = str_replace( $link, strip_tags($link), $content );
|
329 |
+
}
|
330 |
+
|
331 |
/**
|
332 |
* Filter the post content for Instant Articles.
|
333 |
*
|
481 |
* Get the cover media.
|
482 |
*
|
483 |
* @since 0.1
|
484 |
+
* @return array
|
485 |
*/
|
486 |
public function get_cover_media() {
|
487 |
|
488 |
+
$cover_media = new stdClass;
|
489 |
+
$cover_media->type = 'none';
|
490 |
|
491 |
// If someone else is handling this, let them. Otherwise fall back to us trying to use the featured image.
|
492 |
if ( has_filter( 'instant_articles_cover_media' ) ) {
|
494 |
* Filter the cover media.
|
495 |
*
|
496 |
* @since 0.1
|
497 |
+
* @param stdClass $cover_media The cover media object.
|
498 |
* @param int $post_id The current post ID.
|
499 |
*/
|
500 |
$cover_media = apply_filters( 'instant_articles_cover_media', $cover_media, $this->_post->ID );
|
501 |
} else {
|
|
|
502 |
$featured_image_data = $this->get_the_featured_image();
|
503 |
if ( isset( $featured_image_data['src'] ) && strlen( $featured_image_data['src'] ) ) {
|
504 |
+
$cover_media->type = 'image';
|
505 |
+
$cover_media->src = $featured_image_data['src'];
|
506 |
+
$cover_media->caption = $featured_image_data['caption'];
|
|
|
507 |
}
|
508 |
}
|
509 |
|
574 |
public function to_instant_article() {
|
575 |
|
576 |
/**
|
577 |
+
* Fires before the instant article is rendered.
|
578 |
+
*
|
579 |
+
* @since 0.1
|
580 |
+
* @param Instant_Article_Post $instant_article_post The instant article post.
|
581 |
+
*/
|
582 |
do_action( 'instant_articles_before_transform_post', $this );
|
583 |
|
|
|
|
|
584 |
// Get time zone configured in WordPress. Default to UTC if no time zone configured.
|
585 |
$date_time_zone = get_option( 'timezone_string' ) ? new DateTimeZone( get_option( 'timezone_string' ) ) : new DateTimeZone( 'UTC' );
|
586 |
|
621 |
$title = $this->get_the_title();
|
622 |
if ( $title ) {
|
623 |
$document = new DOMDocument();
|
|
|
624 |
$document->loadHTML( '<?xml encoding="' . $blog_charset . '" ?><h1>' . $title . '</h1>' );
|
|
|
625 |
$transformer->transform( $header, $document );
|
626 |
}
|
627 |
|
|
|
|
|
|
|
|
|
628 |
$authors = $this->get_the_authors();
|
629 |
foreach ( $authors as $author ) {
|
630 |
$author_obj = Author::create();
|
643 |
if ( $kicker ) {
|
644 |
$header->withKicker( $kicker );
|
645 |
}
|
646 |
+
$cover = $this->get_the_featured_image();
|
647 |
+
if ( $cover['src'] ) {
|
648 |
+
$image = Image::create()->withURL( $cover['src'] );
|
649 |
+
if ( isset( $cover['caption'] ) && strlen( $cover['caption'] ) > 0 ) {
|
650 |
+
$document = new DOMDocument();
|
651 |
+
$document->loadHTML( '<?xml encoding="' . $blog_charset . '" ?><h1>' . $cover['caption'] . '</h1>' );
|
652 |
+
$image->withCaption( $transformer->transform( Caption::create(), $document ) );
|
653 |
+
}
|
654 |
|
655 |
+
$header->withCover( $image );
|
|
|
|
|
656 |
}
|
|
|
657 |
$this->instant_article =
|
658 |
InstantArticle::create()
|
659 |
->withCanonicalUrl( $this->get_canonical_url() )
|
668 |
$this->instant_article->withStyle( 'default' );
|
669 |
}
|
670 |
|
671 |
+
$libxml_previous_state = libxml_use_internal_errors( true );
|
672 |
+
$document = new DOMDocument( '1.0', get_option( 'blog_charset' ) );
|
673 |
+
$content = $this->get_the_content();
|
674 |
+
|
675 |
+
// DOMDocument isn’t handling encodings too well, so let’s help it a little.
|
676 |
+
if ( function_exists( 'mb_convert_encoding' ) ) {
|
677 |
+
$content = mb_convert_encoding( $content, 'HTML-ENTITIES', get_option( 'blog_charset' ) );
|
678 |
+
} else {
|
679 |
+
$content = htmlspecialchars_decode( utf8_decode( htmlentities( $content, ENT_COMPAT, 'utf-8', false ) ) );
|
680 |
}
|
681 |
|
682 |
+
$result = $document->loadHTML( '<!doctype html><html><body>' . $content . '</body></html>' );
|
683 |
+
|
684 |
+
// We need to make sure that scripts use absolute URLs and not relative URLs.
|
685 |
+
$scripts = $document->getElementsByTagName('script');
|
686 |
+
if ( ! empty( $scripts ) ) {
|
687 |
+
foreach ( $scripts as $script ){
|
688 |
+
$src = $script->getAttribute( 'src' );
|
689 |
+
$explode_src = parse_url( $src );
|
690 |
+
if ( is_array( $explode_src ) && empty( $explode_src['scheme'] ) ) {
|
691 |
+
$src = 'https://' . $explode_src['host'] . $explode_src['path'];
|
692 |
+
}
|
693 |
+
$script->setAttribute( 'src' , $src );
|
694 |
+
}
|
695 |
+
}
|
696 |
+
|
697 |
+
libxml_clear_errors();
|
698 |
+
libxml_use_internal_errors( $libxml_previous_state );
|
699 |
+
|
700 |
+
$document = apply_filters( 'instant_articles_parsed_document', $document );
|
701 |
+
|
702 |
+
if ( $result ) {
|
703 |
+
$transformer->transform( $this->instant_article, $document );
|
704 |
+
}
|
705 |
|
706 |
$this->add_ads_from_settings();
|
707 |
$this->add_analytics_from_settings();
|
708 |
|
709 |
$this->instant_article = apply_filters( 'instant_articles_transformed_element', $this->instant_article );
|
710 |
|
|
|
|
|
711 |
/**
|
712 |
* Fires after the instant article is rendered.
|
713 |
*
|
class-instant-articles-publisher.php
CHANGED
@@ -21,14 +21,12 @@ class Instant_Articles_Publisher {
|
|
21 |
* Key to store the submission status ID on meta data
|
22 |
*/
|
23 |
const SUBMISSION_ID_KEY = 'instant_articles_submission_id';
|
24 |
-
const FORCE_SUBMIT_KEY = 'instant_articles_force_submit';
|
25 |
|
26 |
/**
|
27 |
* Inits publisher.
|
28 |
-
* Change by cmjaimet submitted Jan 3, 2016: Delay save_post action hook (3rd param 10 => 999) so that all custom meta data is processed and saved before submission to FBIA
|
29 |
*/
|
30 |
public static function init() {
|
31 |
-
add_action( 'save_post', array( 'Instant_Articles_Publisher', 'submit_article' ),
|
32 |
}
|
33 |
|
34 |
/**
|
@@ -58,11 +56,6 @@ class Instant_Articles_Publisher {
|
|
58 |
// Transform the post to an Instant Article.
|
59 |
$adapter = new Instant_Articles_Post( $post );
|
60 |
|
61 |
-
// Allow to disable post submit via filter
|
62 |
-
if ( false === apply_filters( 'instant_articles_should_submit_post', true, $adapter ) ) {
|
63 |
-
return;
|
64 |
-
}
|
65 |
-
|
66 |
$article = $adapter->to_instant_article();
|
67 |
|
68 |
// Skip empty articles or articles missing title.
|
@@ -78,7 +71,6 @@ class Instant_Articles_Publisher {
|
|
78 |
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
79 |
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
80 |
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
81 |
-
$force_submit = get_post_meta( $post_id, self::FORCE_SUBMIT_KEY, true );
|
82 |
|
83 |
$dev_mode = isset( $publishing_settings['dev_mode'] )
|
84 |
? ( $publishing_settings['dev_mode'] ? true : false )
|
@@ -97,37 +89,16 @@ class Instant_Articles_Publisher {
|
|
97 |
$dev_mode
|
98 |
);
|
99 |
|
100 |
-
// Don't publish posts with password protection
|
101 |
-
if ( post_password_required( $post ) ) {
|
102 |
-
// Unpublishes if already published and from now on it started to have password protection
|
103 |
-
$client->removeArticle( $article->getCanonicalURL() );
|
104 |
-
delete_post_meta( $post_id, self::SUBMISSION_ID_KEY );
|
105 |
-
return;
|
106 |
-
}
|
107 |
-
|
108 |
-
// Don't process if contains warnings and blocker flag for transformation warnings is turned on.
|
109 |
-
if ( count( $adapter->transformer->getWarnings() ) > 0
|
110 |
-
&& ( ! isset( $publishing_settings[ 'publish_with_warnings' ] ) || ! $publishing_settings[ 'publish_with_warnings' ] )
|
111 |
-
&& ( ! $force_submit )
|
112 |
-
) {
|
113 |
-
|
114 |
-
// Unpublishes if already published
|
115 |
-
$client->removeArticle( $article->getCanonicalURL() );
|
116 |
-
delete_post_meta( $post_id, self::SUBMISSION_ID_KEY );
|
117 |
-
|
118 |
-
return;
|
119 |
-
}
|
120 |
-
|
121 |
if ( $dev_mode ) {
|
122 |
-
$
|
123 |
} else {
|
124 |
// Any publish status other than 'publish' means draft for the Instant Article.
|
125 |
-
$
|
126 |
}
|
127 |
|
128 |
try {
|
129 |
// Import the article.
|
130 |
-
$submission_id = $client->importArticle( $article, $
|
131 |
update_post_meta( $post_id, self::SUBMISSION_ID_KEY, $submission_id );
|
132 |
} catch ( Exception $e ) {
|
133 |
// Try without taking live for pages not yet reviewed.
|
21 |
* Key to store the submission status ID on meta data
|
22 |
*/
|
23 |
const SUBMISSION_ID_KEY = 'instant_articles_submission_id';
|
|
|
24 |
|
25 |
/**
|
26 |
* Inits publisher.
|
|
|
27 |
*/
|
28 |
public static function init() {
|
29 |
+
add_action( 'save_post', array( 'Instant_Articles_Publisher', 'submit_article' ), 10, 2 );
|
30 |
}
|
31 |
|
32 |
/**
|
56 |
// Transform the post to an Instant Article.
|
57 |
$adapter = new Instant_Articles_Post( $post );
|
58 |
|
|
|
|
|
|
|
|
|
|
|
59 |
$article = $adapter->to_instant_article();
|
60 |
|
61 |
// Skip empty articles or articles missing title.
|
71 |
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
72 |
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
73 |
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
|
|
74 |
|
75 |
$dev_mode = isset( $publishing_settings['dev_mode'] )
|
76 |
? ( $publishing_settings['dev_mode'] ? true : false )
|
89 |
$dev_mode
|
90 |
);
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
if ( $dev_mode ) {
|
93 |
+
$take_live = false;
|
94 |
} else {
|
95 |
// Any publish status other than 'publish' means draft for the Instant Article.
|
96 |
+
$take_live = true;
|
97 |
}
|
98 |
|
99 |
try {
|
100 |
// Import the article.
|
101 |
+
$submission_id = $client->importArticle( $article, $take_live );
|
102 |
update_post_meta( $post_id, self::SUBMISSION_ID_KEY, $submission_id );
|
103 |
} catch ( Exception $e ) {
|
104 |
// Try without taking live for pages not yet reviewed.
|
compat.php
CHANGED
@@ -34,15 +34,3 @@ if ( defined( 'JETPACK__VERSION' ) ) {
|
|
34 |
$jp = new Instant_Articles_Jetpack;
|
35 |
$jp->init();
|
36 |
}
|
37 |
-
|
38 |
-
// Load support for Get The Image plugin
|
39 |
-
if ( function_exists( 'get_the_image' ) ) {
|
40 |
-
include( dirname( __FILE__ ) . '/compat/class-instant-articles-get-the-image.php' );
|
41 |
-
$gti = new Instant_Articles_Get_The_Image;
|
42 |
-
$gti->init();
|
43 |
-
}
|
44 |
-
|
45 |
-
// Load support for Playbuzz plugin by default #515
|
46 |
-
include( dirname( __FILE__ ) . '/compat/class-instant-articles-playbuzz.php' );
|
47 |
-
$playbuzz = new Instant_Articles_Playbuzz;
|
48 |
-
$playbuzz->init();
|
34 |
$jp = new Instant_Articles_Jetpack;
|
35 |
$jp->init();
|
36 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compat/class-instant-articles-get-the-image.php
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Support class for Get The Image plugin
|
5 |
-
*
|
6 |
-
* @since 3.0.2+
|
7 |
-
*
|
8 |
-
*/
|
9 |
-
class Instant_Articles_Get_The_Image {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Init the compat layer
|
13 |
-
*
|
14 |
-
*/
|
15 |
-
function init() {
|
16 |
-
add_filter( 'instant_articles_transformer_rules_loaded', array( 'Instant_Articles_Get_The_Image', 'transformer_loaded' ) );
|
17 |
-
}
|
18 |
-
|
19 |
-
public static function transformer_loaded( $transformer ) {
|
20 |
-
// Appends more rules to transformer
|
21 |
-
$file_path = plugin_dir_path( __FILE__ ) . 'get-the-image-rules-configuration.json';
|
22 |
-
$configuration = file_get_contents( $file_path );
|
23 |
-
$transformer->loadRules( $configuration );
|
24 |
-
|
25 |
-
return $transformer;
|
26 |
-
}
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compat/class-instant-articles-jetpack.php
CHANGED
@@ -15,7 +15,6 @@ class Instant_Articles_Jetpack {
|
|
15 |
function init() {
|
16 |
$this->_fix_youtube_embed();
|
17 |
$this->_fix_facebook_embed();
|
18 |
-
add_filter( 'instant_articles_transformer_rules_loaded', array( 'Instant_Articles_Jetpack', 'transformer_loaded' ) );
|
19 |
}
|
20 |
|
21 |
/**
|
@@ -39,12 +38,6 @@ class Instant_Articles_Jetpack {
|
|
39 |
*/
|
40 |
private function _fix_facebook_embed() {
|
41 |
|
42 |
-
// Don't try to fix facebook embeds unless we're in Instant Articles context.
|
43 |
-
// This prevents mangled output on frontend.
|
44 |
-
if ( ! is_transforming_instant_article() ) {
|
45 |
-
return;
|
46 |
-
}
|
47 |
-
|
48 |
// All of these are registered in jetpack/modules/shortcodes/facebook.php
|
49 |
|
50 |
if ( defined( 'JETPACK_FACEBOOK_EMBED_REGEX' ) ) {
|
@@ -85,15 +78,6 @@ class Instant_Articles_Jetpack {
|
|
85 |
$locale = 'en_US';
|
86 |
}
|
87 |
|
88 |
-
return '<figure class="op-
|
89 |
-
}
|
90 |
-
|
91 |
-
public static function transformer_loaded( $transformer ) {
|
92 |
-
// Appends more rules to transformer
|
93 |
-
$file_path = plugin_dir_path( __FILE__ ) . 'jetpack-rules-configuration.json';
|
94 |
-
$configuration = file_get_contents( $file_path );
|
95 |
-
$transformer->loadRules( $configuration );
|
96 |
-
|
97 |
-
return $transformer;
|
98 |
}
|
99 |
}
|
15 |
function init() {
|
16 |
$this->_fix_youtube_embed();
|
17 |
$this->_fix_facebook_embed();
|
|
|
18 |
}
|
19 |
|
20 |
/**
|
38 |
*/
|
39 |
private function _fix_facebook_embed() {
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
// All of these are registered in jetpack/modules/shortcodes/facebook.php
|
42 |
|
43 |
if ( defined( 'JETPACK_FACEBOOK_EMBED_REGEX' ) ) {
|
78 |
$locale = 'en_US';
|
79 |
}
|
80 |
|
81 |
+
return '<figure class="op-social"><iframe><script src="https://connect.facebook.net/' . $locale . '/sdk.js#xfbml=1&version=v2.6" async></script><div class="fb-post" data-href="' . esc_url( $url ) . '"></div></iframe></figure>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
}
|
83 |
}
|
compat/class-instant-articles-playbuzz.php
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Support class for Playbuzz
|
5 |
-
*
|
6 |
-
* @since 3.1.1
|
7 |
-
*
|
8 |
-
*/
|
9 |
-
class Instant_Articles_Playbuzz {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Init the compat layer
|
13 |
-
*
|
14 |
-
*/
|
15 |
-
function init() {
|
16 |
-
add_filter( 'instant_articles_transformer_rules_loaded', array( 'Instant_Articles_Playbuzz', 'transformer_loaded' ) );
|
17 |
-
}
|
18 |
-
|
19 |
-
public static function transformer_loaded( $transformer ) {
|
20 |
-
// Appends more rules to transformer
|
21 |
-
$file_path = plugin_dir_path( __FILE__ ) . 'playbuzz-rules-configuration.json';
|
22 |
-
$configuration = file_get_contents( $file_path );
|
23 |
-
$transformer->loadRules( $configuration );
|
24 |
-
|
25 |
-
return $transformer;
|
26 |
-
}
|
27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compat/get-the-image-rules-configuration.json
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"rules": [{
|
3 |
-
"class": "ImageInsideParagraphRule",
|
4 |
-
"selector": "figure.wp-caption",
|
5 |
-
"properties": {
|
6 |
-
"image.url": {
|
7 |
-
"type": "string",
|
8 |
-
"selector": "img",
|
9 |
-
"attribute": "src"
|
10 |
-
}
|
11 |
-
}
|
12 |
-
}]
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compat/jetpack-rules-configuration.json
DELETED
@@ -1,91 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"rules": [{
|
3 |
-
"class" : "IgnoreRule",
|
4 |
-
"selector" : "p.jetpack-slideshow-noscript"
|
5 |
-
},
|
6 |
-
{
|
7 |
-
"class": "CaptionRule",
|
8 |
-
"selector" : "div.wp-caption-text"
|
9 |
-
},
|
10 |
-
{
|
11 |
-
"class" : "PassThroughRule",
|
12 |
-
"selector" : "div.gallery-row"
|
13 |
-
},
|
14 |
-
{
|
15 |
-
"class" : "PassThroughRule",
|
16 |
-
"selector" : "div.tiled-gallery p"
|
17 |
-
},
|
18 |
-
{
|
19 |
-
"class" : "PassThroughRule",
|
20 |
-
"selector" : "div.gallery-row p"
|
21 |
-
},
|
22 |
-
{
|
23 |
-
"class" : "PassThroughRule",
|
24 |
-
"selector" : "div.gallery-group p"
|
25 |
-
},
|
26 |
-
{
|
27 |
-
"class" : "PassThroughRule",
|
28 |
-
"selector" : "div.gallery-group"
|
29 |
-
},
|
30 |
-
{
|
31 |
-
"class": "ImageRule",
|
32 |
-
"selector" : "div.wp-caption",
|
33 |
-
"properties" : {
|
34 |
-
"image.url" : {
|
35 |
-
"type" : "string",
|
36 |
-
"selector" : "img",
|
37 |
-
"attribute": "src"
|
38 |
-
}
|
39 |
-
}
|
40 |
-
},
|
41 |
-
{
|
42 |
-
"class": "SlideshowImageRule",
|
43 |
-
"selector" : "div.tiled-gallery-item",
|
44 |
-
"properties" : {
|
45 |
-
"image.url" : {
|
46 |
-
"type" : "string",
|
47 |
-
"selector" : "img",
|
48 |
-
"attribute": "data-orig-file"
|
49 |
-
},
|
50 |
-
"caption.title" : {
|
51 |
-
"type" : "string",
|
52 |
-
"selector" : "div.tiled-gallery-caption"
|
53 |
-
}
|
54 |
-
}
|
55 |
-
},
|
56 |
-
{
|
57 |
-
"class": "SlideshowRule",
|
58 |
-
"selector" : "div.tiled-gallery"
|
59 |
-
},
|
60 |
-
{
|
61 |
-
"class": "SlideshowImageRule",
|
62 |
-
"selector" : "dl.gallery-item",
|
63 |
-
"properties" : {
|
64 |
-
"image.url" : {
|
65 |
-
"type" : "string",
|
66 |
-
"selector" : "a",
|
67 |
-
"attribute": "href"
|
68 |
-
},
|
69 |
-
"caption.title" : {
|
70 |
-
"type" : "string",
|
71 |
-
"selector" : "dd.wp-caption-text"
|
72 |
-
}
|
73 |
-
}
|
74 |
-
},
|
75 |
-
{
|
76 |
-
"class": "Compat\\JetpackSlideshowRule",
|
77 |
-
"selector" : "div.jetpack-slideshow",
|
78 |
-
"properties": {
|
79 |
-
"jetpack.data-gallery": {
|
80 |
-
"type": "json",
|
81 |
-
"selector": "div.jetpack-slideshow",
|
82 |
-
"attribute": "data-gallery"
|
83 |
-
}
|
84 |
-
}
|
85 |
-
},
|
86 |
-
{
|
87 |
-
"class": "CaptionRule",
|
88 |
-
"selector" : "div.tiled-gallery-caption"
|
89 |
-
}
|
90 |
-
]
|
91 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
compat/playbuzz-rules-configuration.json
DELETED
@@ -1,23 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"rules": [{
|
3 |
-
"class" : "IgnoreRule",
|
4 |
-
"selector": "//p/script[contains(@src,'playbuzz')]"
|
5 |
-
}, {
|
6 |
-
"class": "InteractiveRule",
|
7 |
-
"selector" : "div.pb_feed",
|
8 |
-
"properties" : {
|
9 |
-
"interactive.iframe" : {
|
10 |
-
"type" : "multiple",
|
11 |
-
"children": [{
|
12 |
-
"type": "fragment",
|
13 |
-
"fragment": "<script type='text/javascript' src='//cdn.playbuzz.com/widget/feed.js'></script>"
|
14 |
-
}, {
|
15 |
-
"type": "element",
|
16 |
-
"selector": "div.pb_feed"
|
17 |
-
}
|
18 |
-
]
|
19 |
-
}
|
20 |
-
}
|
21 |
-
}
|
22 |
-
]
|
23 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/instant-articles-meta-box.css
CHANGED
@@ -1,9 +1,3 @@
|
|
1 |
-
.instant-articles-dev-mode-indicator {
|
2 |
-
float: right;
|
3 |
-
text-decoration: none;
|
4 |
-
font-size: smaller;
|
5 |
-
}
|
6 |
-
|
7 |
.instant-articles-messages {
|
8 |
margin-left: 15px;
|
9 |
margin-top: 0px;
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
.instant-articles-messages {
|
2 |
margin-left: 15px;
|
3 |
margin-top: 0px;
|
css/instant-articles-settings-wizard.css
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
.instant-articles-inline-form input[name='submit'] {
|
2 |
+
display: inline;
|
3 |
+
}
|
css/instant-articles-wizard.css
DELETED
@@ -1,426 +0,0 @@
|
|
1 |
-
#instant_articles_wizard a {
|
2 |
-
color: #4080ff;
|
3 |
-
text-decoration: none;
|
4 |
-
font-weight: bold;
|
5 |
-
}
|
6 |
-
#instant_articles_wizard a:hover {
|
7 |
-
text-decoration: underline;
|
8 |
-
}
|
9 |
-
|
10 |
-
.instant-articles-card {
|
11 |
-
background: white;
|
12 |
-
border: solid 1px #dddfe2;
|
13 |
-
border-radius: 5px;
|
14 |
-
margin: 20px 20px 0 0;
|
15 |
-
overflow: hidden;
|
16 |
-
}
|
17 |
-
.instant-articles-card-success {
|
18 |
-
border: solid 1px #42b72a;
|
19 |
-
}
|
20 |
-
.instant-articles-card-fail {
|
21 |
-
border: solid 1px #eb4145;
|
22 |
-
}
|
23 |
-
.instant-articles-card-collapsed {
|
24 |
-
border: solid 1px #42b72a;
|
25 |
-
padding-bottom: 0;
|
26 |
-
}
|
27 |
-
.instant-articles-card-collapsed .instant-articles-card-content {
|
28 |
-
display: none;
|
29 |
-
}
|
30 |
-
.instant-articles-card-content-box h3 {
|
31 |
-
text-align: center;
|
32 |
-
margin-top: 40px;
|
33 |
-
margin-bottom: 40px;
|
34 |
-
}
|
35 |
-
.instant-articles-card-content-box h4 {
|
36 |
-
text-align: center;
|
37 |
-
margin-top: 15px;
|
38 |
-
margin-bottom: -5px;
|
39 |
-
color: #9ca0a7;
|
40 |
-
}
|
41 |
-
.instant-articles-card-steps {
|
42 |
-
margin: 20px auto;
|
43 |
-
overflow: hidden;
|
44 |
-
width: 660px;
|
45 |
-
}
|
46 |
-
.instant-articles-card-step {
|
47 |
-
position: relative;
|
48 |
-
float: left;
|
49 |
-
display: inline-block;
|
50 |
-
width: 140px;
|
51 |
-
margin: 0px 10px;
|
52 |
-
}
|
53 |
-
.instant-articles-card-step img {
|
54 |
-
display: block;
|
55 |
-
width: 60px;
|
56 |
-
margin: 0 auto;
|
57 |
-
}
|
58 |
-
.instant-articles-card-step p {
|
59 |
-
text-align: center;
|
60 |
-
}
|
61 |
-
.instant-articles-card-bullet-bar {
|
62 |
-
margin: 80px auto 20px auto;
|
63 |
-
min-height: 50px;
|
64 |
-
overflow: hidden;
|
65 |
-
width: 660px;
|
66 |
-
}
|
67 |
-
.instant-articles-card-bullet-step {
|
68 |
-
position: relative;
|
69 |
-
float: left;
|
70 |
-
display: inline-block;
|
71 |
-
width: 140px;
|
72 |
-
margin: 0 10px;
|
73 |
-
}
|
74 |
-
.instant-articles-card-bullet-step p {
|
75 |
-
text-align: center;
|
76 |
-
color: #9ca0a7;
|
77 |
-
font-size: 0.95em;
|
78 |
-
margin: 0.7em 0;
|
79 |
-
display: none;
|
80 |
-
}
|
81 |
-
.instant-articles-card-bullet-step h4 {
|
82 |
-
text-align: center;
|
83 |
-
color: #9ca0a7;
|
84 |
-
font-size: 0.95em;
|
85 |
-
margin-top: 0.7em;
|
86 |
-
margin-bottom: -0.5em;
|
87 |
-
}
|
88 |
-
.instant-articles-card-bullet {
|
89 |
-
display: block;
|
90 |
-
width: 15px;
|
91 |
-
height: 15px;
|
92 |
-
background-color: #d8d8d8;
|
93 |
-
border-radius: 10px;
|
94 |
-
margin: 0 auto;
|
95 |
-
color: white;
|
96 |
-
font-size: 0.55em;
|
97 |
-
font-weight: lighter;
|
98 |
-
text-align: center;
|
99 |
-
line-height: 15px;
|
100 |
-
}
|
101 |
-
.instant-articles-card-bullet-path {
|
102 |
-
position: absolute;
|
103 |
-
top: 0;
|
104 |
-
margin-top: 7px;
|
105 |
-
right: -84px;
|
106 |
-
width: 146px;
|
107 |
-
height: 2px;
|
108 |
-
background-color: #d8d8d8;
|
109 |
-
}
|
110 |
-
.instant-articles-card-bullet-step-completed p,
|
111 |
-
.instant-articles-card-bullet-step-completed h4 {
|
112 |
-
color: #69c456;
|
113 |
-
}
|
114 |
-
.instant-articles-card-bullet-step-completed .instant-articles-card-bullet {
|
115 |
-
background-color: #69c456;
|
116 |
-
}
|
117 |
-
.instant-articles-card-bullet-step-completed .instant-articles-card-bullet::before {
|
118 |
-
content: '✔';
|
119 |
-
}
|
120 |
-
.instant-articles-card-bullet-step-current p,
|
121 |
-
.instant-articles-card-bullet-step-current h4 {
|
122 |
-
display: block;
|
123 |
-
color: #4080ff;
|
124 |
-
}
|
125 |
-
.instant-articles-card-bullet-step-current .instant-articles-card-bullet {
|
126 |
-
background-color: #4080ff;
|
127 |
-
}
|
128 |
-
.instant-articles-card-title {
|
129 |
-
background: #f6f7f9;
|
130 |
-
border-radius: 5px 5px 0 0;
|
131 |
-
border-bottom: solid 1px #dddfe2;
|
132 |
-
height: 55px;
|
133 |
-
line-height: 55px;
|
134 |
-
position: relative;
|
135 |
-
}
|
136 |
-
.instant-articles-card-collapsed .instant-articles-card-title {
|
137 |
-
border-bottom: none;
|
138 |
-
background: #f6faf1;
|
139 |
-
}
|
140 |
-
.instant-articles-card-success .instant-articles-card-title {
|
141 |
-
border-bottom: solid 1px #42b72a;
|
142 |
-
background: #f6faf1;
|
143 |
-
}
|
144 |
-
.instant-articles-card-fail .instant-articles-card-title {
|
145 |
-
border-bottom: solid 1px #eb4145;
|
146 |
-
background: #fcebe8;
|
147 |
-
}
|
148 |
-
.instant-articles-card-title h3 {
|
149 |
-
margin: 0 20px 0 20px;
|
150 |
-
display: inline-block;
|
151 |
-
vertical-align: middle;
|
152 |
-
}
|
153 |
-
.instant-articles-card-title-right {
|
154 |
-
margin: 0 20px 0 20px;
|
155 |
-
display: inline-block;
|
156 |
-
vertical-align: middle;
|
157 |
-
position: absolute;
|
158 |
-
right: 0px;
|
159 |
-
font-size: 1.3em;
|
160 |
-
color: #acafb6;
|
161 |
-
}
|
162 |
-
.instant-articles-card-collapsed .instant-articles-card-title-right > * {
|
163 |
-
display: inline-block;
|
164 |
-
vertical-align: middle;
|
165 |
-
}
|
166 |
-
.instant-articles-card-title-right > * {
|
167 |
-
display: none;
|
168 |
-
}
|
169 |
-
.instant-articles-card-title-right img {
|
170 |
-
width: 40px;
|
171 |
-
height: 40px;
|
172 |
-
}
|
173 |
-
.instant-articles-card-title-step {
|
174 |
-
display: inline-block;
|
175 |
-
}
|
176 |
-
.instant-articles-card-title-checkmark {
|
177 |
-
color: #42b72a;
|
178 |
-
font-size: 0.9em;
|
179 |
-
}
|
180 |
-
.instant-articles-card-collapsed .instant-articles-card-title-step {
|
181 |
-
display: none;
|
182 |
-
}
|
183 |
-
.instant-articles-card-title-label {
|
184 |
-
font-weight: bold;
|
185 |
-
font-size: .8em;
|
186 |
-
color: #4b4f56;
|
187 |
-
}
|
188 |
-
.instant-articles-card-title-value {
|
189 |
-
font-size: .8em;
|
190 |
-
color: #373b42;
|
191 |
-
}
|
192 |
-
.instant-articles-card-title-edit {
|
193 |
-
background: url('../assets/pencil.png');
|
194 |
-
background-size: 13px 13px;
|
195 |
-
background-repeat: no-repeat;
|
196 |
-
width: 15px;
|
197 |
-
height: 14px;
|
198 |
-
}
|
199 |
-
.instant-articles-card-content {
|
200 |
-
margin: 20px;
|
201 |
-
}
|
202 |
-
.instant-articles-card-content-box {
|
203 |
-
width: 50%;
|
204 |
-
float: left;
|
205 |
-
box-sizing: border-box;
|
206 |
-
}
|
207 |
-
.instant-articles-card-content-box label {
|
208 |
-
font-weight: bold;
|
209 |
-
color: #4b4f56;
|
210 |
-
font-size: 1em;
|
211 |
-
}
|
212 |
-
.instant-articles-card-content-box p {
|
213 |
-
color: #9ca0a7;
|
214 |
-
font-size: 1em;
|
215 |
-
margin: 0.7em 0;
|
216 |
-
}
|
217 |
-
.instant-articles-card-content-box ol {
|
218 |
-
margin-left: 0px;
|
219 |
-
padding-left: 0px;
|
220 |
-
list-style: decimal inside none;
|
221 |
-
}
|
222 |
-
.instant-articles-card-content-box li {
|
223 |
-
color: #9ca0a7;
|
224 |
-
font-size: 1em;
|
225 |
-
margin: 0.7em 0;
|
226 |
-
}
|
227 |
-
.instant-articles-page-img {
|
228 |
-
width: 40px;
|
229 |
-
height: 40px;
|
230 |
-
background-color: black;
|
231 |
-
border: 1px solid #dddfe2;
|
232 |
-
margin-left: 5px;
|
233 |
-
}
|
234 |
-
.instant-articles-wizard-page-selection li {
|
235 |
-
margin: 0px -20px;
|
236 |
-
padding: 10px 20px;
|
237 |
-
cursor: pointer;
|
238 |
-
}
|
239 |
-
.instant-articles-radio-selected {
|
240 |
-
background-color: #f6f7f9;
|
241 |
-
}
|
242 |
-
.instant-articles-wizard-page-selection li > label {
|
243 |
-
font-weight: normal;
|
244 |
-
color: #9ca0a7;
|
245 |
-
margin-left: 10px;
|
246 |
-
}
|
247 |
-
.instant-articles-wizard-page-selection li > label span {
|
248 |
-
display: none;
|
249 |
-
}
|
250 |
-
.instant-articles-wizard-page-selection li.instant-articles-radio-selected > label > span {
|
251 |
-
display: inline-block;
|
252 |
-
margin-left: 30px;
|
253 |
-
}
|
254 |
-
.instant-articles-wizard-page-selection li.instant-articles-radio-selected > label > span.page-enabled {
|
255 |
-
font-weight: bold;
|
256 |
-
color: #69c456;
|
257 |
-
}
|
258 |
-
.instant-articles-wizard-page-selection li > * {
|
259 |
-
display:inline-block;
|
260 |
-
vertical-align:middle;
|
261 |
-
cursor: pointer;
|
262 |
-
}
|
263 |
-
.instant-articles-card-content-right {
|
264 |
-
padding-left: 10px;
|
265 |
-
}
|
266 |
-
.instant-articles-card-content-left {
|
267 |
-
padding-right: 10px;
|
268 |
-
}
|
269 |
-
.instant-articles-card-content-full {
|
270 |
-
float: none;
|
271 |
-
width: 100%;
|
272 |
-
}
|
273 |
-
.instant-articles-card-content-full .instant-articles-card-title-edit {
|
274 |
-
display: inline-block;
|
275 |
-
}
|
276 |
-
.instant-articles-card-content-full hr {
|
277 |
-
margin: 20px -20px 20px -20px;
|
278 |
-
}
|
279 |
-
.instant-articles-label {
|
280 |
-
display: block;
|
281 |
-
}
|
282 |
-
.instant-articles-input-text {
|
283 |
-
display: block;
|
284 |
-
border-radius: 4px;
|
285 |
-
margin-top: 5px;
|
286 |
-
margin-bottom: 10px;
|
287 |
-
}
|
288 |
-
.instant-articles-button {
|
289 |
-
display: inline-block;
|
290 |
-
border-radius: 4px;
|
291 |
-
background-color: #4267b2;
|
292 |
-
color: #fff !important;
|
293 |
-
text-decoration: none !important;
|
294 |
-
padding: 8px 20px;
|
295 |
-
margin-top: 10px;
|
296 |
-
border: none;
|
297 |
-
line-height: 25px;
|
298 |
-
vertical-align: middle;
|
299 |
-
cursor: pointer;
|
300 |
-
}
|
301 |
-
a.instant-articles-button {
|
302 |
-
padding: 5px 20px;
|
303 |
-
}
|
304 |
-
.instant-articles-button:hover,
|
305 |
-
.instant-articles-button:active,
|
306 |
-
.instant-articles-button:focus {
|
307 |
-
color: #fff;
|
308 |
-
}
|
309 |
-
.instant-articles-button label {
|
310 |
-
color: white;
|
311 |
-
font-weight: normal;
|
312 |
-
font-size: 1em;
|
313 |
-
margin-top: -2px;
|
314 |
-
display: inline-block;
|
315 |
-
height: 20px;
|
316 |
-
float: left;
|
317 |
-
}
|
318 |
-
.instant-articles-button-highlight {
|
319 |
-
background-color: #42b72a;
|
320 |
-
}
|
321 |
-
.instant-articles-button-disabled {
|
322 |
-
opacity: 0.4;
|
323 |
-
cursor: default !important;
|
324 |
-
}
|
325 |
-
.instant-articles-button-disabled * {
|
326 |
-
cursor: default !important;
|
327 |
-
}
|
328 |
-
.instant-articles-button-centered {
|
329 |
-
margin: 0 auto;
|
330 |
-
display: block;
|
331 |
-
}
|
332 |
-
.instant-articles-button-disabled:focus,
|
333 |
-
.instant-articles-button-disabled:active {
|
334 |
-
box-shadow: none;
|
335 |
-
outline: none;
|
336 |
-
}
|
337 |
-
.instant-articles-button-icon-facebook {
|
338 |
-
background: url('../assets/icon-fb-login.png');
|
339 |
-
background-size: 18px 18px;
|
340 |
-
background-repeat: no-repeat;
|
341 |
-
display: inline-block;
|
342 |
-
width: 18px;
|
343 |
-
height: 18px;
|
344 |
-
margin: 0 10px 0 -12px;
|
345 |
-
float: left;
|
346 |
-
}
|
347 |
-
.instant-articles-card-title-link {
|
348 |
-
text-decoration: none;
|
349 |
-
font-size: .7em;
|
350 |
-
font-weight: bold;
|
351 |
-
}
|
352 |
-
.instant-articles-advanced-settings {
|
353 |
-
font-weight: bold;
|
354 |
-
margin-top: 20px;
|
355 |
-
}
|
356 |
-
.instant-articles-wizard-toggle a,
|
357 |
-
.instant-articles-wizard-toggle a:active,
|
358 |
-
.instant-articles-wizard-toggle a:focus {
|
359 |
-
text-decoration: none;
|
360 |
-
outline: none;
|
361 |
-
box-shadow: none;
|
362 |
-
}
|
363 |
-
.instant-articles-wizard-toggle-opened::before {
|
364 |
-
content: "▼ ";
|
365 |
-
}
|
366 |
-
.instant-articles-wizard-toggle-closed::before {
|
367 |
-
content: "▶︎ ";
|
368 |
-
}
|
369 |
-
.instant-articles-advanced-settings[data-state='opened'] .instant-articles-wizard-toggle-closed {
|
370 |
-
display: none;
|
371 |
-
}
|
372 |
-
.instant-articles-advanced-settings[data-state='closed'] .instant-articles-wizard-toggle-opened,
|
373 |
-
.instant-articles-advanced-settings[data-state='closed'] + .instant-articles-wizard-advanced-settings-box {
|
374 |
-
display: none;
|
375 |
-
}
|
376 |
-
|
377 |
-
#instant_articles_wizard_messages div.error,
|
378 |
-
#instant_articles_wizard_messages div.update,
|
379 |
-
#instant_articles_wizard_messages .notice,
|
380 |
-
#instant_articles_wizard div.error,
|
381 |
-
#instant_articles_wizard div.update,
|
382 |
-
#instant_articles_wizard .notice {
|
383 |
-
margin-left: 0;
|
384 |
-
}
|
385 |
-
|
386 |
-
#instant_articles_wizard.loading {
|
387 |
-
opacity: 0.5;
|
388 |
-
position: relative;
|
389 |
-
}
|
390 |
-
|
391 |
-
#instant_articles_wizard.loading::after {
|
392 |
-
content: '';
|
393 |
-
border: 16px solid rgba(255,255,255,0); /* Light grey */
|
394 |
-
border-top: 16px solid #3498db; /* Blue */
|
395 |
-
border-radius: 50%;
|
396 |
-
width: 120px;
|
397 |
-
height: 120px;
|
398 |
-
animation: spin 1s linear infinite;
|
399 |
-
display: block;
|
400 |
-
position: absolute;
|
401 |
-
margin-top: -120px;
|
402 |
-
margin-left: -120px;
|
403 |
-
left: 50%;
|
404 |
-
top: 50%;
|
405 |
-
}
|
406 |
-
#instant-articles-wizard-signup {
|
407 |
-
display: none;
|
408 |
-
}
|
409 |
-
#instant-articles-wizard-customize-style-next {
|
410 |
-
display: none;
|
411 |
-
}
|
412 |
-
@keyframes spin {
|
413 |
-
0% { transform: rotate(0deg); }
|
414 |
-
100% { transform: rotate(360deg); }
|
415 |
-
}
|
416 |
-
|
417 |
-
@media screen and (max-width: 782px) {
|
418 |
-
.instant-articles-card-content-box {
|
419 |
-
clear: both;
|
420 |
-
width: 100%;
|
421 |
-
padding: 0;
|
422 |
-
}
|
423 |
-
.instant-articles-card-content-right {
|
424 |
-
margin-top: 40px;
|
425 |
-
}
|
426 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
embeds.php
CHANGED
@@ -39,12 +39,8 @@ function instant_articles_embed_oembed_html( $html, $url, $attr, $post_id ) {
|
|
39 |
$provider_name = 'twitter';
|
40 |
} elseif ( false !== strpos( $provider_url, 'youtube.com' ) ) {
|
41 |
$provider_name = 'youtube';
|
42 |
-
} elseif( false !== strpos( $provider_url, '
|
43 |
-
$provider_name = 'vimeo';
|
44 |
-
} elseif( false !== strpos( $provider_url, 'vine.co' ) ) {
|
45 |
$provider_name = 'vine';
|
46 |
-
} elseif( false !== strpos( $provider_url, 'facebook.com' ) ) {
|
47 |
-
$provider_name = 'facebook';
|
48 |
}
|
49 |
|
50 |
$provider_name = apply_filters( 'instant_articles_social_embed_type', $provider_name, $url );
|
@@ -72,12 +68,6 @@ add_filter( 'embed_oembed_html', 'instant_articles_embed_oembed_html', 10, 4 );
|
|
72 |
*/
|
73 |
function instant_articles_embed_get_html( $provider_name, $html, $url, $attr, $post_id ) {
|
74 |
|
75 |
-
// Don't try to fix embeds unless we're in Instant Articles context.
|
76 |
-
// This prevents mangled output on frontend.
|
77 |
-
if ( ! is_transforming_instant_article() ) {
|
78 |
-
return $html;
|
79 |
-
}
|
80 |
-
|
81 |
/**
|
82 |
* Filter the HTML that will go into the Instant Article Social Embed markup.
|
83 |
*
|
39 |
$provider_name = 'twitter';
|
40 |
} elseif ( false !== strpos( $provider_url, 'youtube.com' ) ) {
|
41 |
$provider_name = 'youtube';
|
42 |
+
} elseif ( false !== strpos( $provider_url, 'vine.co' ) ) {
|
|
|
|
|
43 |
$provider_name = 'vine';
|
|
|
|
|
44 |
}
|
45 |
|
46 |
$provider_name = apply_filters( 'instant_articles_social_embed_type', $provider_name, $url );
|
68 |
*/
|
69 |
function instant_articles_embed_get_html( $provider_name, $html, $url, $attr, $post_id ) {
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
/**
|
72 |
* Filter the HTML that will go into the Instant Article Social Embed markup.
|
73 |
*
|
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: 3.
|
8 |
* Text Domain: instant-articles
|
9 |
* License: GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -61,7 +61,7 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
61 |
|
62 |
defined( 'ABSPATH' ) || die( 'Shame on you' );
|
63 |
|
64 |
-
define( 'IA_PLUGIN_VERSION', '
|
65 |
define( 'IA_PLUGIN_PATH_FULL', __FILE__ );
|
66 |
define( 'IA_PLUGIN_PATH', plugin_basename( __FILE__ ) );
|
67 |
define( 'IA_PLUGIN_FILE_BASENAME', pathinfo( __FILE__, PATHINFO_FILENAME ) );
|
@@ -74,7 +74,7 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
74 |
|
75 |
require_once( dirname( __FILE__ ) . '/embeds.php' );
|
76 |
require_once( dirname( __FILE__ ) . '/class-instant-articles-post.php' );
|
77 |
-
require_once( dirname( __FILE__ ) . '/
|
78 |
require_once( dirname( __FILE__ ) . '/meta-box/class-instant-articles-meta-box.php' );
|
79 |
require_once( dirname( __FILE__ ) . '/class-instant-articles-publisher.php' );
|
80 |
|
@@ -89,21 +89,6 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
89 |
}
|
90 |
register_activation_hook( __FILE__, 'instant_articles_activate' );
|
91 |
|
92 |
-
/**
|
93 |
-
* Show a message to set up the plugin when it is activated
|
94 |
-
*/
|
95 |
-
add_action( 'admin_notices', 'instant_articles_setup_admin_notice' );
|
96 |
-
add_action( 'network_admin_notices', 'instant_articles_setup_admin_notice' ); // also show message on multisite
|
97 |
-
function instant_articles_setup_admin_notice() {
|
98 |
-
global $pagenow;
|
99 |
-
if ( $pagenow === 'plugins.php' && Instant_Articles_Wizard_State::get_current_state() !== Instant_Articles_Wizard_State::STATE_REVIEW_SUBMISSION ) {
|
100 |
-
$settings_url = Instant_Articles_Wizard::get_url();
|
101 |
-
echo '<div class="updated settings-error notice is-dismissible">';
|
102 |
-
echo '<p>Congrats, you\'ve installed the Instant Articles for WP plugin. Now <a href="' . esc_url_raw($settings_url) . '">set it up</a> to start publishing Instant Articles.';
|
103 |
-
echo '</div>';
|
104 |
-
}
|
105 |
-
}
|
106 |
-
|
107 |
/**
|
108 |
* Plugin activation hook to remove our rewrite rules.
|
109 |
*
|
@@ -157,21 +142,6 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
157 |
|
158 |
}
|
159 |
|
160 |
-
/**
|
161 |
-
* Whether currently processing an instant article.
|
162 |
-
*
|
163 |
-
* @param bool Set the status
|
164 |
-
* @return bool
|
165 |
-
*/
|
166 |
-
function is_transforming_instant_article( $set_status = null ) {
|
167 |
-
static $is_instant_article = false;
|
168 |
-
|
169 |
-
if ( isset( $set_status ) ) {
|
170 |
-
$is_instant_article = (bool) $set_status;
|
171 |
-
}
|
172 |
-
|
173 |
-
return $is_instant_article;
|
174 |
-
}
|
175 |
|
176 |
/**
|
177 |
* Modify the main query for our feed.
|
@@ -217,6 +187,7 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
217 |
) );
|
218 |
}
|
219 |
}
|
|
|
220 |
}
|
221 |
add_action( 'pre_get_posts', 'instant_articles_query', 10, 1 );
|
222 |
|
@@ -256,12 +227,12 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
256 |
plugins_url( '/css/instant-articles-meta-box.css', __FILE__ )
|
257 |
);
|
258 |
wp_register_style(
|
259 |
-
'instant-articles-settings',
|
260 |
-
plugins_url( '/css/instant-articles-settings.css', __FILE__ )
|
261 |
);
|
262 |
wp_register_style(
|
263 |
-
'instant-articles-
|
264 |
-
plugins_url( '/css/instant-articles-
|
265 |
);
|
266 |
|
267 |
wp_register_script(
|
@@ -296,13 +267,6 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
296 |
null,
|
297 |
true
|
298 |
);
|
299 |
-
wp_register_script(
|
300 |
-
'instant-articles-wizard',
|
301 |
-
plugins_url( '/js/instant-articles-wizard.js', __FILE__ ),
|
302 |
-
null,
|
303 |
-
null,
|
304 |
-
true
|
305 |
-
);
|
306 |
}
|
307 |
add_action( 'init', 'instant_articles_register_scripts' );
|
308 |
|
@@ -315,14 +279,12 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
315 |
wp_enqueue_style( 'instant-articles-meta-box' );
|
316 |
wp_enqueue_style( 'instant-articles-settings-wizard' );
|
317 |
wp_enqueue_style( 'instant-articles-settings' );
|
318 |
-
wp_enqueue_style( 'instant-articles-wizard' );
|
319 |
|
320 |
wp_enqueue_script( 'instant-articles-meta-box' );
|
321 |
wp_enqueue_script( 'instant-articles-option-ads' );
|
322 |
wp_enqueue_script( 'instant-articles-option-analytics' );
|
323 |
wp_enqueue_script( 'instant-articles-option-publishing' );
|
324 |
wp_enqueue_script( 'instant-articles-settings' );
|
325 |
-
wp_enqueue_script( 'instant-articles-wizard' );
|
326 |
}
|
327 |
add_action( 'admin_enqueue_scripts', 'instant_articles_enqueue_scripts' );
|
328 |
|
@@ -344,12 +306,12 @@ if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
|
|
344 |
}
|
345 |
add_action( 'wp_head', 'inject_url_claiming_meta_tag' );
|
346 |
|
|
|
|
|
|
|
347 |
// Initialize the Instant Articles meta box.
|
348 |
Instant_Articles_Meta_Box::init();
|
349 |
|
350 |
// Initialize the Instant Articles publisher.
|
351 |
Instant_Articles_Publisher::init();
|
352 |
-
|
353 |
-
// Initialize the Instant Articles Wizard page.
|
354 |
-
Instant_Articles_Wizard::init();
|
355 |
}
|
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: 3.0.1
|
8 |
* Text Domain: instant-articles
|
9 |
* License: GPLv2
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
61 |
|
62 |
defined( 'ABSPATH' ) || die( 'Shame on you' );
|
63 |
|
64 |
+
define( 'IA_PLUGIN_VERSION', '2.11' );
|
65 |
define( 'IA_PLUGIN_PATH_FULL', __FILE__ );
|
66 |
define( 'IA_PLUGIN_PATH', plugin_basename( __FILE__ ) );
|
67 |
define( 'IA_PLUGIN_FILE_BASENAME', pathinfo( __FILE__, PATHINFO_FILENAME ) );
|
74 |
|
75 |
require_once( dirname( __FILE__ ) . '/embeds.php' );
|
76 |
require_once( dirname( __FILE__ ) . '/class-instant-articles-post.php' );
|
77 |
+
require_once( dirname( __FILE__ ) . '/settings/class-instant-articles-settings.php' );
|
78 |
require_once( dirname( __FILE__ ) . '/meta-box/class-instant-articles-meta-box.php' );
|
79 |
require_once( dirname( __FILE__ ) . '/class-instant-articles-publisher.php' );
|
80 |
|
89 |
}
|
90 |
register_activation_hook( __FILE__, 'instant_articles_activate' );
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
/**
|
93 |
* Plugin activation hook to remove our rewrite rules.
|
94 |
*
|
142 |
|
143 |
}
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
|
146 |
/**
|
147 |
* Modify the main query for our feed.
|
187 |
) );
|
188 |
}
|
189 |
}
|
190 |
+
|
191 |
}
|
192 |
add_action( 'pre_get_posts', 'instant_articles_query', 10, 1 );
|
193 |
|
227 |
plugins_url( '/css/instant-articles-meta-box.css', __FILE__ )
|
228 |
);
|
229 |
wp_register_style(
|
230 |
+
'instant-articles-settings-wizard',
|
231 |
+
plugins_url( '/css/instant-articles-settings-wizard.css', __FILE__ )
|
232 |
);
|
233 |
wp_register_style(
|
234 |
+
'instant-articles-settings',
|
235 |
+
plugins_url( '/css/instant-articles-settings.css', __FILE__ )
|
236 |
);
|
237 |
|
238 |
wp_register_script(
|
267 |
null,
|
268 |
true
|
269 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
}
|
271 |
add_action( 'init', 'instant_articles_register_scripts' );
|
272 |
|
279 |
wp_enqueue_style( 'instant-articles-meta-box' );
|
280 |
wp_enqueue_style( 'instant-articles-settings-wizard' );
|
281 |
wp_enqueue_style( 'instant-articles-settings' );
|
|
|
282 |
|
283 |
wp_enqueue_script( 'instant-articles-meta-box' );
|
284 |
wp_enqueue_script( 'instant-articles-option-ads' );
|
285 |
wp_enqueue_script( 'instant-articles-option-analytics' );
|
286 |
wp_enqueue_script( 'instant-articles-option-publishing' );
|
287 |
wp_enqueue_script( 'instant-articles-settings' );
|
|
|
288 |
}
|
289 |
add_action( 'admin_enqueue_scripts', 'instant_articles_enqueue_scripts' );
|
290 |
|
306 |
}
|
307 |
add_action( 'wp_head', 'inject_url_claiming_meta_tag' );
|
308 |
|
309 |
+
// Initialize the Instant Articles settings page.
|
310 |
+
Instant_Articles_Settings::init();
|
311 |
+
|
312 |
// Initialize the Instant Articles meta box.
|
313 |
Instant_Articles_Meta_Box::init();
|
314 |
|
315 |
// Initialize the Instant Articles publisher.
|
316 |
Instant_Articles_Publisher::init();
|
|
|
|
|
|
|
317 |
}
|
feed-template.php
CHANGED
@@ -21,11 +21,6 @@ $last_modified = null;
|
|
21 |
<?php
|
22 |
$instant_article_post = new Instant_Articles_Post( get_post( get_the_id() ) );
|
23 |
|
24 |
-
// Allow to disable post submit via filter
|
25 |
-
if ( false === apply_filters( 'instant_articles_should_submit_post', true, $instant_article_post ) ) {
|
26 |
-
continue;
|
27 |
-
}
|
28 |
-
|
29 |
// If we’re OK with a limited post set: Do not include posts with empty content -- FB will complain.
|
30 |
if ( defined( 'INSTANT_ARTICLES_LIMIT_POSTS' ) && INSTANT_ARTICLES_LIMIT_POSTS && ! strlen( trim( $instant_article_post->get_the_content() ) ) ) {
|
31 |
continue;
|
21 |
<?php
|
22 |
$instant_article_post = new Instant_Articles_Post( get_post( get_the_id() ) );
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
// If we’re OK with a limited post set: Do not include posts with empty content -- FB will complain.
|
25 |
if ( defined( 'INSTANT_ARTICLES_LIMIT_POSTS' ) && INSTANT_ARTICLES_LIMIT_POSTS && ! strlen( trim( $instant_article_post->get_the_content() ) ) ) {
|
26 |
continue;
|
js/instant-articles-meta-box.js
CHANGED
@@ -1,14 +1,3 @@
|
|
1 |
-
function instant_articles_force_submit ( post_ID ) {
|
2 |
-
var data = {
|
3 |
-
'action': 'instant_articles_force_submit',
|
4 |
-
'post_ID': post_ID,
|
5 |
-
'force': jQuery( '#instant_articles_force_submit' ).is( ':checked' ),
|
6 |
-
'security': jQuery( '#instant_articles_force_submit' ).attr( 'data-security' )
|
7 |
-
};
|
8 |
-
jQuery.post( ajaxurl, data, function(response) {
|
9 |
-
instant_articles_load_meta_box( post_ID );
|
10 |
-
});
|
11 |
-
}
|
12 |
function instant_articles_load_meta_box ( post_ID ) {
|
13 |
jQuery( document ).ready( function( $ ) {
|
14 |
var data = {
|
@@ -17,9 +6,6 @@ function instant_articles_load_meta_box ( post_ID ) {
|
|
17 |
};
|
18 |
jQuery.post( ajaxurl, data, function(response) {
|
19 |
jQuery( '#instant_article_meta_box .inside' ).html( response );
|
20 |
-
jQuery( '#instant_articles_force_submit').click( function () {
|
21 |
-
instant_articles_force_submit( post_ID );
|
22 |
-
} );
|
23 |
}, 'html' );
|
24 |
jQuery( '#instant_article_meta_box' ).delegate( '.instant-articles-toggle-debug', 'click', function () {
|
25 |
jQuery( '#instant_article_meta_box' ).toggleClass( 'instant-articles-show-debug' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
function instant_articles_load_meta_box ( post_ID ) {
|
2 |
jQuery( document ).ready( function( $ ) {
|
3 |
var data = {
|
6 |
};
|
7 |
jQuery.post( ajaxurl, data, function(response) {
|
8 |
jQuery( '#instant_article_meta_box .inside' ).html( response );
|
|
|
|
|
|
|
9 |
}, 'html' );
|
10 |
jQuery( '#instant_article_meta_box' ).delegate( '.instant-articles-toggle-debug', 'click', function () {
|
11 |
jQuery( '#instant_article_meta_box' ).toggleClass( 'instant-articles-show-debug' );
|
js/instant-articles-settings.js
CHANGED
@@ -1,8 +1,25 @@
|
|
1 |
jQuery( function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
jQuery( '.instant-articles-settings-box > h2' ).click(function () {
|
3 |
$h2 = jQuery( this );
|
4 |
$h2.siblings('.inside').toggle();
|
5 |
$h2.toggleClass('dashicons-arrow-down');
|
6 |
$h2.toggleClass('dashicons-arrow-right');
|
7 |
-
})
|
8 |
} );
|
1 |
jQuery( function () {
|
2 |
+
jQuery( '#instant-articles-fb-page-selector' ).change(function () {
|
3 |
+
var val = jQuery( this ).val();
|
4 |
+
var obj = jQuery.parseJSON( val );
|
5 |
+
|
6 |
+
if ( val ) {
|
7 |
+
jQuery( 'input[name=instant-articles-select-page]' ).attr( 'disabled', false );
|
8 |
+
jQuery.each( obj, function ( key, value ) {
|
9 |
+
jQuery( 'input[name="instant-articles-option-fb-page[' + key + ']"]' )
|
10 |
+
.val( value );
|
11 |
+
});
|
12 |
+
}
|
13 |
+
else {
|
14 |
+
jQuery( 'input[name=instant-articles-select-page]' ).attr( 'disabled', true );
|
15 |
+
}
|
16 |
+
} ).trigger( 'change' );
|
17 |
+
|
18 |
+
|
19 |
jQuery( '.instant-articles-settings-box > h2' ).click(function () {
|
20 |
$h2 = jQuery( this );
|
21 |
$h2.siblings('.inside').toggle();
|
22 |
$h2.toggleClass('dashicons-arrow-down');
|
23 |
$h2.toggleClass('dashicons-arrow-right');
|
24 |
+
})
|
25 |
} );
|
js/instant-articles-wizard.js
DELETED
@@ -1,135 +0,0 @@
|
|
1 |
-
function instant_articles_wizard_load ( data ) {
|
2 |
-
jQuery( '#instant_articles_wizard' ).addClass( 'loading' );
|
3 |
-
jQuery.post( ajaxurl, data, function( response ) {
|
4 |
-
jQuery( '#instant_articles_wizard' ).html( response );
|
5 |
-
instant_articles_wizard_bind_events();
|
6 |
-
jQuery( '#instant_articles_wizard' ).removeClass( 'loading' );
|
7 |
-
window.scrollTo(0, 0);
|
8 |
-
}, 'html' );
|
9 |
-
}
|
10 |
-
|
11 |
-
function instant_articles_wizard_transition ( new_state, params ) {
|
12 |
-
instant_articles_wizard_load ( {
|
13 |
-
'action': 'instant_articles_wizard_transition',
|
14 |
-
'new_state': new_state,
|
15 |
-
'params': JSON.stringify(params)
|
16 |
-
} );
|
17 |
-
}
|
18 |
-
|
19 |
-
function instant_articles_wizard_save_app ( app_id, app_secret ) {
|
20 |
-
instant_articles_wizard_load ( {
|
21 |
-
'action': 'instant_articles_wizard_save_app',
|
22 |
-
'app_id': app_id,
|
23 |
-
'app_secret': app_secret
|
24 |
-
} );
|
25 |
-
}
|
26 |
-
|
27 |
-
function instant_articles_wizard_edit_app () {
|
28 |
-
instant_articles_wizard_load ( {
|
29 |
-
'action': 'instant_articles_wizard_edit_app',
|
30 |
-
} );
|
31 |
-
}
|
32 |
-
|
33 |
-
|
34 |
-
function instant_articles_wizard_submit_for_review () {
|
35 |
-
instant_articles_wizard_load ( {
|
36 |
-
'action': 'instant_articles_wizard_submit_for_review',
|
37 |
-
} );
|
38 |
-
}
|
39 |
-
|
40 |
-
function instant_articles_wizard_bind_events () {
|
41 |
-
|
42 |
-
jQuery( '#instant_articles_wizard a' ).on( 'click', function () {
|
43 |
-
if ( ! jQuery( this ).attr( 'target' ) ) {
|
44 |
-
jQuery( '#instant_articles_wizard' ).addClass( 'loading' );
|
45 |
-
}
|
46 |
-
});
|
47 |
-
|
48 |
-
jQuery( '.instant-articles-wizard-transition' ).on( 'click', function () {
|
49 |
-
if ( jQuery( this ).hasClass( 'instant-articles-button-disabled' ) ) {
|
50 |
-
return false;
|
51 |
-
}
|
52 |
-
instant_articles_wizard_transition( jQuery( this ).attr( 'data-new-state' ) );
|
53 |
-
});
|
54 |
-
|
55 |
-
jQuery('input[name=app_id], input[name=app_secret]').on( 'change', function () {
|
56 |
-
var app_id = jQuery('input[name=app_id]').val();
|
57 |
-
var app_secret = jQuery('input[name=app_secret]').val();
|
58 |
-
if (app_id && app_secret) {
|
59 |
-
jQuery( '#instant-articles-wizard-save-app' ).removeClass( 'instant-articles-button-disabled' );
|
60 |
-
}
|
61 |
-
else {
|
62 |
-
jQuery( '#instant-articles-wizard-save-app' ).addClass( 'instant-articles-button-disabled' );
|
63 |
-
}
|
64 |
-
});
|
65 |
-
|
66 |
-
jQuery('input[name=page_id]').on( 'change', function () {
|
67 |
-
var input = jQuery( this );
|
68 |
-
var page_id = jQuery('input[name=page_id]:checked').val();
|
69 |
-
var signed_up = ( jQuery('input[name=page_id]:checked').attr( 'data-signed-up' ) === 'yes' );
|
70 |
-
if ( page_id && signed_up ) {
|
71 |
-
jQuery( '#instant-articles-wizard-select-page' ).removeClass( 'instant-articles-button-disabled' );
|
72 |
-
}
|
73 |
-
else {
|
74 |
-
jQuery( '#instant-articles-wizard-select-page' ).addClass( 'instant-articles-button-disabled' );
|
75 |
-
}
|
76 |
-
});
|
77 |
-
|
78 |
-
jQuery( '#instant-articles-wizard-save-app' ).on( 'click', function () {
|
79 |
-
if ( jQuery( this ).hasClass( 'instant-articles-button-disabled' ) ) {
|
80 |
-
return false;
|
81 |
-
}
|
82 |
-
var app_id = jQuery('input[name=app_id]').val();
|
83 |
-
var app_secret = jQuery('input[name=app_secret]').val();
|
84 |
-
instant_articles_wizard_save_app( app_id, app_secret );
|
85 |
-
});
|
86 |
-
|
87 |
-
jQuery( '#instant-articles-wizard-edit-app' ).on( 'click', function () {
|
88 |
-
if ( jQuery( this ).hasClass( 'instant-articles-button-disabled' ) ) {
|
89 |
-
return false;
|
90 |
-
}
|
91 |
-
instant_articles_wizard_edit_app();
|
92 |
-
});
|
93 |
-
|
94 |
-
jQuery( '#instant-articles-wizard-submit-for-review' ).on( 'click', function () {
|
95 |
-
if ( jQuery( this ).hasClass( 'instant-articles-button-disabled' ) ) {
|
96 |
-
return false;
|
97 |
-
}
|
98 |
-
instant_articles_wizard_submit_for_review();
|
99 |
-
});
|
100 |
-
|
101 |
-
jQuery( '#instant-articles-wizard-select-page' ).on( 'click', function () {
|
102 |
-
if ( jQuery( this ).hasClass( 'instant-articles-button-disabled' ) ) {
|
103 |
-
return false;
|
104 |
-
}
|
105 |
-
var page_id = jQuery('input[name=page_id]:checked').val();
|
106 |
-
instant_articles_wizard_transition( 'STATE_STYLE_SELECTION', { page_id: page_id } );
|
107 |
-
});
|
108 |
-
|
109 |
-
jQuery( '#instant-articles-wizard-customize-style' ).on( 'click', function () {
|
110 |
-
jQuery( '#instant-articles-wizard-customize-style-next' ).show();
|
111 |
-
});
|
112 |
-
|
113 |
-
jQuery( '.instant-articles-card-content-box li' ).on( 'click', function () {
|
114 |
-
jQuery( '.instant-articles-card-content-box li.instant-articles-radio-selected' ).removeClass( 'instant-articles-radio-selected' );
|
115 |
-
jQuery( this ).find( 'input' ).attr( 'checked', 'checked' );
|
116 |
-
jQuery( this ).find( 'input' ).trigger( 'change' );
|
117 |
-
jQuery( this ).toggleClass( 'instant-articles-radio-selected' );
|
118 |
-
});
|
119 |
-
}
|
120 |
-
|
121 |
-
|
122 |
-
jQuery( document ).ready( function () {
|
123 |
-
instant_articles_wizard_bind_events();
|
124 |
-
|
125 |
-
jQuery( '.instant-articles-wizard-toggle a' ).on( 'click', function () {
|
126 |
-
$advancedSettingsContainer = jQuery( '.instant-articles-advanced-settings' );
|
127 |
-
if ( $advancedSettingsContainer.attr( 'data-state') === 'closed' ) {
|
128 |
-
$advancedSettingsContainer.attr( 'data-state', 'opened' );
|
129 |
-
}
|
130 |
-
else {
|
131 |
-
$advancedSettingsContainer.attr( 'data-state', 'closed' );
|
132 |
-
}
|
133 |
-
return false;
|
134 |
-
});
|
135 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/de_DE.mo
DELETED
Binary file
|
languages/de_DE.po
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
4 |
-
"Project-Id-Version: Instant Articles for WP\n"
|
5 |
-
"POT-Creation-Date: 2016-05-22 10:10+0200\n"
|
6 |
-
"PO-Revision-Date: 2016-05-22 10:12+0200\n"
|
7 |
-
"Language-Team: Bjørn Johansen <bjorn@dekode.no>\n"
|
8 |
-
"MIME-Version: 1.0\n"
|
9 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
-
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"X-Generator: Poedit 1.8.7\n"
|
12 |
-
"X-Poedit-Basepath: ..\n"
|
13 |
-
"X-Poedit-WPHeader: instant-articles.php\n"
|
14 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
15 |
-
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
16 |
-
"Last-Translator: \n"
|
17 |
-
"Language: de\n"
|
18 |
-
"X-Poedit-SearchPath-0: .\n"
|
19 |
-
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
20 |
-
|
21 |
-
#: feed-template.php:7
|
22 |
-
msgid "Instant Articles"
|
23 |
-
msgstr "Instant Articles"
|
24 |
-
|
25 |
-
#. Plugin Name of the plugin/theme
|
26 |
-
msgid "Instant Articles for WP"
|
27 |
-
msgstr "Instant Articles für WP"
|
28 |
-
|
29 |
-
#. Description of the plugin/theme
|
30 |
-
msgid "Add support for Instant Articles for Facebook to your WordPress site."
|
31 |
-
msgstr "Ermöglicht die Funtion von Instant Articles für deine WordPress Seite"
|
32 |
-
|
33 |
-
#. Author of the plugin/theme
|
34 |
-
msgid "Dekode"
|
35 |
-
msgstr "Dekode"
|
36 |
-
|
37 |
-
#. Author URI of the plugin/theme
|
38 |
-
msgid "https://dekode.no"
|
39 |
-
msgstr "https://dekode.no"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
meta-box/class-instant-articles-meta-box.php
CHANGED
@@ -28,10 +28,6 @@ class Instant_Articles_Meta_Box {
|
|
28 |
'wp_ajax_instant_articles_meta_box',
|
29 |
array( 'Instant_Articles_Meta_Box', 'render_meta_box' )
|
30 |
);
|
31 |
-
add_action(
|
32 |
-
'wp_ajax_instant_articles_force_submit',
|
33 |
-
array( 'Instant_Articles_Meta_Box', 'force_submit' )
|
34 |
-
);
|
35 |
}
|
36 |
|
37 |
/**
|
@@ -42,9 +38,7 @@ class Instant_Articles_Meta_Box {
|
|
42 |
'instant_article_meta_box',
|
43 |
'Facebook Instant Articles',
|
44 |
array( 'Instant_Articles_Meta_Box', 'render_meta_box_loader' ),
|
45 |
-
|
46 |
-
/** This filter is defined in facebook-instant-articles.php. */
|
47 |
-
apply_filters( 'instant_articles_post_types', array( 'post' ) ),
|
48 |
'normal',
|
49 |
'default'
|
50 |
);
|
@@ -63,57 +57,30 @@ class Instant_Articles_Meta_Box {
|
|
63 |
include( dirname( __FILE__ ) . '/meta-box-loader-template.php' );
|
64 |
}
|
65 |
|
66 |
-
/**
|
67 |
-
* Renderer for the Metabox.
|
68 |
-
*/
|
69 |
-
public static function force_submit() {
|
70 |
-
$post_id = intval( $_POST[ 'post_ID' ] );
|
71 |
-
|
72 |
-
if ( ! current_user_can( 'edit_post', $post_id ) ) {
|
73 |
-
wp_die( -1, 403 );
|
74 |
-
}
|
75 |
-
|
76 |
-
check_ajax_referer( 'instant-articles-force-submit-' . $post_id, 'security' );
|
77 |
-
$force = sanitize_text_field( $_POST[ 'force' ] ) === 'true';
|
78 |
-
update_post_meta( $post_id, Instant_Articles_Publisher::FORCE_SUBMIT_KEY, $force );
|
79 |
-
Instant_Articles_Publisher::submit_article( $post_id, get_post( $post_id ) );
|
80 |
-
}
|
81 |
-
|
82 |
/**
|
83 |
* Renderer for the Metabox.
|
84 |
*/
|
85 |
public static function render_meta_box() {
|
86 |
-
$post_id = intval(
|
87 |
|
88 |
if ( ! current_user_can( 'edit_post', $post_id ) ) {
|
89 |
wp_die( -1, 403 );
|
90 |
}
|
91 |
|
92 |
-
$ajax_nonce = wp_create_nonce( "instant-articles-force-submit-" . $post_id );
|
93 |
$post = get_post( $post_id );
|
94 |
$adapter = new Instant_Articles_Post( $post );
|
95 |
$article = $adapter->to_instant_article();
|
96 |
$canonical_url = $adapter->get_canonical_url();
|
97 |
$submission_status = null;
|
98 |
$published = 'publish' === $post->post_status;
|
99 |
-
$dev_mode = false;
|
100 |
-
$force_submit = get_post_meta( $post_id, Instant_Articles_Publisher::FORCE_SUBMIT_KEY, true );
|
101 |
-
$should_submit_post = apply_filters( 'instant_articles_should_submit_post', true, $adapter );
|
102 |
|
103 |
-
|
104 |
-
$settings_page_href =
|
105 |
|
106 |
-
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
107 |
-
$publish_with_warnings = $publishing_settings[ 'publish_with_warnings' ];
|
108 |
if ( $published ) {
|
109 |
try {
|
110 |
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
111 |
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
112 |
-
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded();
|
113 |
-
|
114 |
-
$dev_mode = isset( $publishing_settings['dev_mode'] )
|
115 |
-
? ( $publishing_settings['dev_mode'] ? true : false )
|
116 |
-
: false;
|
117 |
|
118 |
if ( isset( $fb_app_settings['app_id'] )
|
119 |
&& isset( $fb_app_settings['app_secret'] )
|
@@ -124,8 +91,7 @@ class Instant_Articles_Meta_Box {
|
|
124 |
$fb_app_settings['app_id'],
|
125 |
$fb_app_settings['app_secret'],
|
126 |
$fb_page_settings['page_access_token'],
|
127 |
-
$fb_page_settings['page_id']
|
128 |
-
$dev_mode
|
129 |
);
|
130 |
|
131 |
$submission_status_id = get_post_meta( $post_id, Instant_Articles_Publisher::SUBMISSION_ID_KEY, true );
|
28 |
'wp_ajax_instant_articles_meta_box',
|
29 |
array( 'Instant_Articles_Meta_Box', 'render_meta_box' )
|
30 |
);
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
|
33 |
/**
|
38 |
'instant_article_meta_box',
|
39 |
'Facebook Instant Articles',
|
40 |
array( 'Instant_Articles_Meta_Box', 'render_meta_box_loader' ),
|
41 |
+
'post',
|
|
|
|
|
42 |
'normal',
|
43 |
'default'
|
44 |
);
|
57 |
include( dirname( __FILE__ ) . '/meta-box-loader-template.php' );
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
/**
|
61 |
* Renderer for the Metabox.
|
62 |
*/
|
63 |
public static function render_meta_box() {
|
64 |
+
$post_id = intval( filter_input( INPUT_POST, 'post_ID' ) );
|
65 |
|
66 |
if ( ! current_user_can( 'edit_post', $post_id ) ) {
|
67 |
wp_die( -1, 403 );
|
68 |
}
|
69 |
|
|
|
70 |
$post = get_post( $post_id );
|
71 |
$adapter = new Instant_Articles_Post( $post );
|
72 |
$article = $adapter->to_instant_article();
|
73 |
$canonical_url = $adapter->get_canonical_url();
|
74 |
$submission_status = null;
|
75 |
$published = 'publish' === $post->post_status;
|
|
|
|
|
|
|
76 |
|
77 |
+
Instant_Articles_Settings::menu_items();
|
78 |
+
$settings_page_href = Instant_Articles_Settings::get_href_to_settings_page();
|
79 |
|
|
|
|
|
80 |
if ( $published ) {
|
81 |
try {
|
82 |
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
83 |
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
if ( isset( $fb_app_settings['app_id'] )
|
86 |
&& isset( $fb_app_settings['app_secret'] )
|
91 |
$fb_app_settings['app_id'],
|
92 |
$fb_app_settings['app_secret'],
|
93 |
$fb_page_settings['page_access_token'],
|
94 |
+
$fb_page_settings['page_id']
|
|
|
95 |
);
|
96 |
|
97 |
$submission_status_id = get_post_meta( $post_id, Instant_Articles_Publisher::SUBMISSION_ID_KEY, true );
|
meta-box/meta-box-template.php
CHANGED
@@ -11,21 +11,7 @@ use Facebook\InstantArticles\Client\InstantArticleStatus;
|
|
11 |
use Facebook\InstantArticles\Client\ServerMessage;
|
12 |
?>
|
13 |
|
14 |
-
<?php if ( $
|
15 |
-
<a href="<?php echo esc_url( $settings_page_href ); ?>" class="instant-articles-dev-mode-indicator">
|
16 |
-
<span class="dashicons dashicons-admin-tools"></span>
|
17 |
-
Development Mode
|
18 |
-
</a>
|
19 |
-
<?php endif; ?>
|
20 |
-
|
21 |
-
<?php if ( ! $should_submit_post ) : ?>
|
22 |
-
<p>
|
23 |
-
<b>
|
24 |
-
<span class="dashicons dashicons-no-alt"></span>
|
25 |
-
This post will not be submitted to Instant Articles due to a rule created in your site.
|
26 |
-
</b>
|
27 |
-
</p>
|
28 |
-
<?php elseif ( ! $published ) : ?>
|
29 |
<p>
|
30 |
<b>
|
31 |
<span class="dashicons dashicons-media-document"></span>
|
@@ -177,13 +163,6 @@ use Facebook\InstantArticles\Client\ServerMessage;
|
|
177 |
</li>
|
178 |
<?php endforeach; ?>
|
179 |
</ul>
|
180 |
-
<?php if ( ! $publish_with_warnings ) : ?>
|
181 |
-
<hr />
|
182 |
-
<p>
|
183 |
-
<input type="checkbox" id="instant_articles_force_submit" data-security="<?php echo $ajax_nonce; ?>" <?php checked( $force_submit , 1 ); ?> />
|
184 |
-
Submit this article even with warnings
|
185 |
-
</p>
|
186 |
-
<?php endif; ?>
|
187 |
|
188 |
<?php else : ?>
|
189 |
<p>
|
11 |
use Facebook\InstantArticles\Client\ServerMessage;
|
12 |
?>
|
13 |
|
14 |
+
<?php if ( ! $published ) : ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
<p>
|
16 |
<b>
|
17 |
<span class="dashicons dashicons-media-document"></span>
|
163 |
</li>
|
164 |
<?php endforeach; ?>
|
165 |
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
|
167 |
<?php else : ?>
|
168 |
<p>
|
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.6
|
6 |
-
Stable tag: 3.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -85,47 +85,6 @@ Usually simply visiting the permalinks settings page in the WordPress dashboard
|
|
85 |
|
86 |
== Changelog ==
|
87 |
|
88 |
-
= 3.2 =
|
89 |
-
* Adds development mode support to post meta box (props simonengelhardt)
|
90 |
-
* Adds rule configuration for Instagram blockquotes (props everton-rosario)
|
91 |
-
* Adds rules for galleries (props everton-rosario)
|
92 |
-
* Migrates some unit tests (props everton-rosario)
|
93 |
-
* Switches to Facebook Graph SDK (props everton-rosario)
|
94 |
-
* Improves token invalidation flow (props everton-rosario)
|
95 |
-
* Fixes use of `the_title` filter (props srtfisher)
|
96 |
-
* Improves encoding handling (props yssk22)
|
97 |
-
* Adds post type filter to the post meta box (props technosailor)
|
98 |
-
* Adds Playbuzz support (props everton-rosario)
|
99 |
-
* Rename SDK getter to avert apocalypse (props diegoquinteiro)
|
100 |
-
* Wizard copy improvements (props demoive)
|
101 |
-
* Fixes issue with captions (props everton-rosario)
|
102 |
-
* Adds publication block for articles with transformation warnings (props everton-rosario)
|
103 |
-
* Fix https src attribute on some scripts (props goldenapples)
|
104 |
-
|
105 |
-
= 3.1.3 =
|
106 |
-
* Fix for expiring token issue
|
107 |
-
* Fix missing icons
|
108 |
-
* Fix for empty() array check
|
109 |
-
* Fix for setup limbo
|
110 |
-
|
111 |
-
= 3.1 =
|
112 |
-
* New on-boarding flow wizard
|
113 |
-
* Automattic URL claiming
|
114 |
-
* Submit for review from wizard
|
115 |
-
* Improved transformation rules
|
116 |
-
* Option to submit only articles without warnings
|
117 |
-
* Jetpack compatibility
|
118 |
-
* Added Jetpack carousel rules
|
119 |
-
* Compatibility layer for Get The Image plugin
|
120 |
-
* Fix for relative URL checking
|
121 |
-
* Fix for missing subtitles
|
122 |
-
* Fix for double call of wpautop
|
123 |
-
* Fix for loadHTML warnings
|
124 |
-
* Fix for get_cover_media function
|
125 |
-
* Fix to prevent publishing of password protected posts
|
126 |
-
|
127 |
-
props diegoquinteiro everton-rosario gemedet jacobarriola menzow rinatkhaziev srtfisher
|
128 |
-
|
129 |
= 3.0.1 =
|
130 |
|
131 |
* Fix overzealous escaping
|
3 |
Tags: instant articles, facebook, mobile
|
4 |
Requires at least: 4.3
|
5 |
Tested up to: 4.6
|
6 |
+
Stable tag: 3.0.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
85 |
|
86 |
== Changelog ==
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
= 3.0.1 =
|
89 |
|
90 |
* Fix overzealous escaping
|
release.sh
DELETED
@@ -1,472 +0,0 @@
|
|
1 |
-
#!/bin/bash
|
2 |
-
red=`tput setaf 1`
|
3 |
-
green=`tput setaf 2`
|
4 |
-
yellow=`tput setaf 3`
|
5 |
-
blue=`tput setaf 4`
|
6 |
-
reset=`tput sgr0`
|
7 |
-
me='./'`basename "$0"`
|
8 |
-
|
9 |
-
#--------------------------------
|
10 |
-
# Functions
|
11 |
-
#--------------------------------
|
12 |
-
function show_help {
|
13 |
-
cat <<EOF
|
14 |
-
|
15 |
-
${green}Usage:${reset}
|
16 |
-
${blue}${me} [-hvs] [-c <command>] [version]${reset}
|
17 |
-
|
18 |
-
${green}Arguments:${reset}
|
19 |
-
version - The target version (ex: 3.2.1)
|
20 |
-
|
21 |
-
${green}Options:${reset}
|
22 |
-
-h Display this help message
|
23 |
-
-v Verbose mode
|
24 |
-
-s Simulate only (do not release)
|
25 |
-
-c <command> Runs only a single command. Possible commands are:
|
26 |
-
- bump_version: generate a new version tag on the repository
|
27 |
-
- release: release a new version on GitHub
|
28 |
-
- publish: publishes the target version to the WordPress
|
29 |
-
plugin repository
|
30 |
-
|
31 |
-
|
32 |
-
${green}Examples:${reset}
|
33 |
-
|
34 |
-
${blue}${me} 3.3.0${reset}
|
35 |
-
Runs bump_version then release for 3.3.0. This is the default use case.
|
36 |
-
|
37 |
-
${blue}${me} -c bump_version 3.3.0${reset}
|
38 |
-
Generates a new commit on master changing the version to 3.3.0 in
|
39 |
-
all relevant files, tags the commit and pushes to remote.
|
40 |
-
|
41 |
-
${blue}${me} -c release 3.3.0${reset}
|
42 |
-
Creates a new Release on GitHub based on the tag 3.3.0 and uploads
|
43 |
-
the binary package based on master.
|
44 |
-
${red}IMPORTANT: this will create a new tag if tag 3.3.0 doesn't exist,
|
45 |
-
so make sure to bump_version beforehand.${reset}
|
46 |
-
|
47 |
-
${blue}${me} -v 3.3.0${reset}
|
48 |
-
Releases 3.3.0 in verbose mode.
|
49 |
-
|
50 |
-
${blue}${me} -s 3.3.0${reset}
|
51 |
-
Simulates a 3.3.0 release: prints the commands instead of running them.
|
52 |
-
|
53 |
-
EOF
|
54 |
-
}
|
55 |
-
|
56 |
-
function invalid_usage {
|
57 |
-
printf $red
|
58 |
-
echo $@
|
59 |
-
echo "Aborted"
|
60 |
-
printf $reset
|
61 |
-
show_help
|
62 |
-
exit -1;
|
63 |
-
}
|
64 |
-
function error_message {
|
65 |
-
printf $red
|
66 |
-
echo $@
|
67 |
-
echo "Aborted"
|
68 |
-
printf $reset
|
69 |
-
exit -1
|
70 |
-
}
|
71 |
-
function message {
|
72 |
-
if [[ $verbose == 1 ]]; then
|
73 |
-
printf $green
|
74 |
-
echo $@
|
75 |
-
printf $reset
|
76 |
-
fi
|
77 |
-
}
|
78 |
-
function run_message {
|
79 |
-
if [[ $simulate == 1 ]]; then
|
80 |
-
printf $yellow
|
81 |
-
echo $@
|
82 |
-
printf $reset
|
83 |
-
fi
|
84 |
-
}
|
85 |
-
|
86 |
-
#----------------
|
87 |
-
# Read parameters
|
88 |
-
#----------------
|
89 |
-
|
90 |
-
# A POSIX variable
|
91 |
-
# Reset in case getopts has been used previously in the shell.
|
92 |
-
OPTIND=1
|
93 |
-
|
94 |
-
# Read options:
|
95 |
-
verbose=0
|
96 |
-
simulate=0
|
97 |
-
selected_cmd='all'
|
98 |
-
|
99 |
-
while getopts "hvc:s" opt; do
|
100 |
-
case "$opt" in
|
101 |
-
h|\?)
|
102 |
-
show_help
|
103 |
-
exit 0
|
104 |
-
;;
|
105 |
-
v) verbose=1
|
106 |
-
;;
|
107 |
-
s) simulate=1
|
108 |
-
;;
|
109 |
-
c) selected_cmd="${OPTARG}"
|
110 |
-
;;
|
111 |
-
esac
|
112 |
-
done
|
113 |
-
|
114 |
-
shift $((OPTIND-1))
|
115 |
-
|
116 |
-
# Read argument
|
117 |
-
version=$1
|
118 |
-
|
119 |
-
# Validates arguments
|
120 |
-
if [[ $2 ]]; then
|
121 |
-
invalid_usage "Invalid parameters"
|
122 |
-
fi
|
123 |
-
|
124 |
-
if [[ ! $( echo $version | grep -Ee '^[0-9]+\.[0-9]+(\.[0-9]+)?$' ) ]]; then
|
125 |
-
invalid_usage "Invalid version provided"
|
126 |
-
fi
|
127 |
-
|
128 |
-
message "Releasing version: $version"
|
129 |
-
message "Running in verbose mode"
|
130 |
-
if [[ $simulate == 1 ]]; then
|
131 |
-
message "Running in simulation mode"
|
132 |
-
fi
|
133 |
-
|
134 |
-
#---------------------------------
|
135 |
-
# Check if we have the right tools
|
136 |
-
#---------------------------------
|
137 |
-
|
138 |
-
if ! type "git" > /dev/null; then
|
139 |
-
error_message "git not found, please install git before continuing: http://git.org"
|
140 |
-
else
|
141 |
-
message "Found git: $(git --version)"
|
142 |
-
fi
|
143 |
-
|
144 |
-
if ! type "js" > /dev/null; then
|
145 |
-
error_message "SpiderMonkey interpreter not found, please install SpiderMonkey before continuing"
|
146 |
-
else
|
147 |
-
message "Found SpiderMonkey"
|
148 |
-
fi
|
149 |
-
|
150 |
-
#------------------------------------
|
151 |
-
# Check if we are in the right folder
|
152 |
-
#------------------------------------
|
153 |
-
if [[ ! -e '.git/config' ]]; then
|
154 |
-
error_message "You should run this command from the root directory of your repository."
|
155 |
-
fi
|
156 |
-
if [[ ! $( cat .git/config | grep -i 'automattic/facebook-instant-articles-wp') ]]; then
|
157 |
-
error_message "You should run this command from the root directory of the facebook-instant-articles-wp repository."
|
158 |
-
fi
|
159 |
-
|
160 |
-
repo_dir=$(pwd)
|
161 |
-
|
162 |
-
#-------------------
|
163 |
-
# Manages simulation
|
164 |
-
#-------------------
|
165 |
-
function run {
|
166 |
-
if [[ $simulate == 1 ]]; then
|
167 |
-
run_message $@
|
168 |
-
else
|
169 |
-
"$@"
|
170 |
-
fi
|
171 |
-
}
|
172 |
-
|
173 |
-
function revert_repo {
|
174 |
-
run cd $repo_dir
|
175 |
-
if [[ $branch_name != 'master' ]]; then
|
176 |
-
message "Going back to $branch_name"
|
177 |
-
# stashes anything possibly left from the script execution
|
178 |
-
run git stash
|
179 |
-
run git checkout $branch_name
|
180 |
-
fi
|
181 |
-
if [[ $stash_ref ]]; then
|
182 |
-
message "Applying stashed changes"
|
183 |
-
run git stash apply $stash_ref
|
184 |
-
fi
|
185 |
-
}
|
186 |
-
|
187 |
-
function confirm {
|
188 |
-
confirm=''
|
189 |
-
while [[ $confirm != 'a' && $confirm != 'y' ]]; do
|
190 |
-
printf $blue
|
191 |
-
printf "%b" "$*"
|
192 |
-
printf ' (y)es/(a)bort: '
|
193 |
-
printf $red
|
194 |
-
read -n 1 confirm
|
195 |
-
printf "\n"
|
196 |
-
done
|
197 |
-
if [[ $confirm != 'y' ]]; then
|
198 |
-
revert_repo
|
199 |
-
error_message 'Execution aborted by the user'
|
200 |
-
exit -1
|
201 |
-
fi
|
202 |
-
printf $reset
|
203 |
-
}
|
204 |
-
|
205 |
-
function ask {
|
206 |
-
user_response=''
|
207 |
-
while [[ $user_response != 'n' && $user_response != 'y' ]]; do
|
208 |
-
printf $blue
|
209 |
-
printf "%b" "$*"
|
210 |
-
printf ' (y)es/(n)o: '
|
211 |
-
printf $red
|
212 |
-
read -n 1 user_response
|
213 |
-
printf "\n"
|
214 |
-
done
|
215 |
-
printf $reset
|
216 |
-
}
|
217 |
-
|
218 |
-
function prompt {
|
219 |
-
user_response=''
|
220 |
-
printf $blue
|
221 |
-
printf "%b" "$*"
|
222 |
-
printf $red
|
223 |
-
read user_response
|
224 |
-
printf $reset
|
225 |
-
}
|
226 |
-
|
227 |
-
function prompt_password {
|
228 |
-
user_response=''
|
229 |
-
printf $blue
|
230 |
-
printf "%b" "$*"
|
231 |
-
printf $red
|
232 |
-
read -s user_response
|
233 |
-
printf $reset
|
234 |
-
}
|
235 |
-
|
236 |
-
#----------------------
|
237 |
-
# Commands
|
238 |
-
#----------------------
|
239 |
-
function bump_version {
|
240 |
-
|
241 |
-
message "Stashing current work..."
|
242 |
-
|
243 |
-
stash_ref=$(git stash create)
|
244 |
-
run_message git stash create
|
245 |
-
|
246 |
-
if [[ $stash_ref ]]; then
|
247 |
-
run git reset --hard
|
248 |
-
message "Stashed current work to: $stash_ref"
|
249 |
-
else
|
250 |
-
message "Nothing to stash"
|
251 |
-
fi
|
252 |
-
|
253 |
-
branch_name="$(git symbolic-ref HEAD 2>/dev/null)"
|
254 |
-
branch_name=${branch_name##refs/heads/}
|
255 |
-
message "Current branch: $branch_name"
|
256 |
-
|
257 |
-
if [[ $branch_name != 'master' ]]; then
|
258 |
-
message "Switching to master..."
|
259 |
-
run git checkout master
|
260 |
-
fi
|
261 |
-
|
262 |
-
message "Pulling latest version from GitHub"
|
263 |
-
run git pull --rebase
|
264 |
-
|
265 |
-
confirm "Replace stable tag on readme.txt with $version?"
|
266 |
-
message "Replacing stable tag on readme.txt"
|
267 |
-
run sed -i -e "s/Stable tag: .*/Stable tag: $version/" ./readme.txt
|
268 |
-
run git diff
|
269 |
-
confirm "Add changes to commit?"
|
270 |
-
run git add readme.txt
|
271 |
-
run rm readme.txt-e
|
272 |
-
|
273 |
-
confirm "Replace version on facebook-instant-articles-wp.php with $version?"
|
274 |
-
message "Replacing version on facebook-instant-articles-wp.php"
|
275 |
-
run sed -i -e "s/^ \* Version: .*/ * Version: $version/" facebook-instant-articles.php
|
276 |
-
run sed -i -e "s/define( 'IA_PLUGIN_VERSION', '[0-9.]*' );/define( 'IA_PLUGIN_VERSION', '$version' );/" facebook-instant-articles.php
|
277 |
-
run git diff
|
278 |
-
confirm "Add changes to commit?"
|
279 |
-
run git add facebook-instant-articles.php
|
280 |
-
run rm facebook-instant-articles.php-e
|
281 |
-
|
282 |
-
confirm "Commit version bump on master with message 'Bump version to $version'?"
|
283 |
-
run git commit -m "Bump version to $version"
|
284 |
-
|
285 |
-
confirm "Create tag $version?"
|
286 |
-
run git tag $version
|
287 |
-
|
288 |
-
confirm "Push tag and commit to GitHub?"
|
289 |
-
run git push
|
290 |
-
run git push --tags
|
291 |
-
|
292 |
-
revert_repo
|
293 |
-
|
294 |
-
echo "🍺 Tag $version created!"
|
295 |
-
}
|
296 |
-
|
297 |
-
function release {
|
298 |
-
|
299 |
-
confirm "Create a new release for $version?"
|
300 |
-
|
301 |
-
message "Stashing current work..."
|
302 |
-
|
303 |
-
stash_ref=$(git stash create)
|
304 |
-
run_message git stash create
|
305 |
-
|
306 |
-
if [[ $stash_ref ]]; then
|
307 |
-
run git reset --hard
|
308 |
-
message "Stashed current work to: $stash_ref"
|
309 |
-
else
|
310 |
-
message "Nothing to stash"
|
311 |
-
fi
|
312 |
-
|
313 |
-
branch_name="$(git symbolic-ref HEAD 2>/dev/null)"
|
314 |
-
branch_name=${branch_name##refs/heads/}
|
315 |
-
message "Current branch: $branch_name"
|
316 |
-
|
317 |
-
if [[ $branch_name != 'master' ]]; then
|
318 |
-
message "Switching to master..."
|
319 |
-
run git checkout master
|
320 |
-
fi
|
321 |
-
|
322 |
-
message "Pulling latest version from GitHub"
|
323 |
-
run git pull --rebase
|
324 |
-
|
325 |
-
if [[ ! -e resty ]]; then
|
326 |
-
message "Downloading resty to connect to GitHub API"
|
327 |
-
run curl -L http://github.com/micha/resty/raw/2.2/resty > resty
|
328 |
-
fi
|
329 |
-
if [[ ! -e jsawk ]]; then
|
330 |
-
message "Downloading jsawk to parse info from GitHub API"
|
331 |
-
run curl -L http://github.com/micha/jsawk/raw/1.4/jsawk > jsawk
|
332 |
-
fi
|
333 |
-
|
334 |
-
prompt "GitHub access-token (required only for 2fac):"
|
335 |
-
github_access_token=$user_response
|
336 |
-
|
337 |
-
if [[ github_access_token ]]; then
|
338 |
-
run . resty -W 'https://api.github.com' -H "Authorization: token $github_access_token"
|
339 |
-
else
|
340 |
-
prompt "GitHub username:"
|
341 |
-
github_username=$user_response
|
342 |
-
|
343 |
-
prompt_password "GitHub password:"
|
344 |
-
github_password=$user_response
|
345 |
-
|
346 |
-
run . resty -W 'https://api.github.com' -u $github_username:$github_password
|
347 |
-
fi
|
348 |
-
|
349 |
-
response=$(run POST /repos/Automattic/facebook-instant-articles-wp/releases "
|
350 |
-
{
|
351 |
-
\"tag_name\": \"$version\",
|
352 |
-
\"target_commitish\": \"master\",
|
353 |
-
\"name\": \"$version\",
|
354 |
-
\"body\": \"Version $version\",
|
355 |
-
\"draft\": false,
|
356 |
-
\"prerelease\": false
|
357 |
-
}
|
358 |
-
");
|
359 |
-
|
360 |
-
if [[ $response ]]; then
|
361 |
-
message "Release $version created!"
|
362 |
-
else
|
363 |
-
error_message "Couldn't create release"
|
364 |
-
fi
|
365 |
-
|
366 |
-
upload_url=$( echo $response | . jsawk -n 'out(this.upload_url)' | sed -e "s/{[^}]*}//g" )
|
367 |
-
release_id=$( echo $response | . jsawk -n 'out(this.id)' )
|
368 |
-
|
369 |
-
message "Upload URL: $upload_url"
|
370 |
-
|
371 |
-
message "Creating binary file"
|
372 |
-
run composer install
|
373 |
-
run composer update
|
374 |
-
run zip -qr facebook-instant-articles-wp.zip .
|
375 |
-
|
376 |
-
message "Uploading binary for release..."
|
377 |
-
|
378 |
-
if [[ github_access_token ]]; then
|
379 |
-
response=$(run curl -H "Authorization: token $github_access_token" -H "Content-Type: application/zip" --data-binary @facebook-instant-articles-wp.zip $upload_url\?name=facebook-instant-articles-wp-$version.zip )
|
380 |
-
else
|
381 |
-
response=$(run curl -u $github_username:$github_password -H "Content-Type: application/zip" --data-binary @facebook-instant-articles-wp.zip $upload_url\?name=facebook-instant-articles-wp-$version.zip )
|
382 |
-
fi
|
383 |
-
|
384 |
-
run rm facebook-instant-articles-wp.zip
|
385 |
-
revert_repo
|
386 |
-
|
387 |
-
if [[ $response ]]; then
|
388 |
-
echo "🍺 Release $version successfully created"
|
389 |
-
else
|
390 |
-
error_message "Couldn't upload file"
|
391 |
-
fi
|
392 |
-
|
393 |
-
|
394 |
-
}
|
395 |
-
|
396 |
-
function publish {
|
397 |
-
confirm "Publish $version to WordPress plugin repository?"
|
398 |
-
|
399 |
-
message "Stashing current work..."
|
400 |
-
|
401 |
-
stash_ref=$(git stash create)
|
402 |
-
run_message git stash create
|
403 |
-
|
404 |
-
if [[ $stash_ref ]]; then
|
405 |
-
run git reset --hard
|
406 |
-
message "Stashed current work to: $stash_ref"
|
407 |
-
else
|
408 |
-
message "Nothing to stash"
|
409 |
-
fi
|
410 |
-
|
411 |
-
branch_name="$(git symbolic-ref HEAD 2>/dev/null)"
|
412 |
-
branch_name=${branch_name##refs/heads/}
|
413 |
-
message "Current branch: $branch_name"
|
414 |
-
|
415 |
-
if [[ $branch_name != 'master' ]]; then
|
416 |
-
message "Switching to master..."
|
417 |
-
run git checkout master
|
418 |
-
fi
|
419 |
-
|
420 |
-
message "Pulling latest version from GitHub"
|
421 |
-
run git pull --rebase
|
422 |
-
|
423 |
-
tmp_dir=$(mktemp -d)
|
424 |
-
|
425 |
-
message "Updating composer dependencies"
|
426 |
-
run composer install
|
427 |
-
run composer update
|
428 |
-
|
429 |
-
message "Checking out SVN repository..."
|
430 |
-
run cd $tmp_dir
|
431 |
-
run svn checkout -q https://plugins.svn.wordpress.org/fb-instant-articles/
|
432 |
-
run cd fb-instant-articles/trunk/
|
433 |
-
|
434 |
-
confirm "Copy new version to trunk?"
|
435 |
-
run cp -rf $repo_dir/* ./
|
436 |
-
|
437 |
-
# Removes development files we know shouldn't make to the SVN repo
|
438 |
-
run rm -rf .[!.]* # this will remove all hidden files
|
439 |
-
run rm -rf bin
|
440 |
-
run rm -rf tests
|
441 |
-
run rm -rf composer*
|
442 |
-
run rm -rf phpunit*
|
443 |
-
run rm -rf vendor/apache/log4php/src/test
|
444 |
-
run rm -rf facebook-instant-articles-wp.zip
|
445 |
-
run rm -rf jsawk
|
446 |
-
run rm -rf resty
|
447 |
-
run rm -rf vendor/apache/log4php/.git
|
448 |
-
|
449 |
-
run svn st | grep '^\?' | sed 's/^\? *//' | xargs -I% svn add %
|
450 |
-
run svn status
|
451 |
-
ask "Review changes?"
|
452 |
-
if [[ $user_response == 'y' ]]; then
|
453 |
-
run svn diff
|
454 |
-
fi
|
455 |
-
confirm "Commit changes to trunk?"
|
456 |
-
run svn commit -m "Release $version"
|
457 |
-
confirm "Tag version $version?"
|
458 |
-
run svn cp ../trunk ../tags/$version
|
459 |
-
run cd ..
|
460 |
-
run svn commit -m "Tag $version"
|
461 |
-
|
462 |
-
revert_repo
|
463 |
-
|
464 |
-
echo "🍺 Published $version successfully"
|
465 |
-
}
|
466 |
-
|
467 |
-
# Run right command
|
468 |
-
if [[ $selected_cmd == 'bump_version' ]]; then bump_version; exit 0; fi
|
469 |
-
if [[ $selected_cmd == 'release' ]]; then release; exit 0; fi
|
470 |
-
if [[ $selected_cmd == 'publish' ]]; then publish; exit 0; fi
|
471 |
-
if [[ $selected_cmd == 'all' ]]; then bump_version; release; publish; exit 0; fi
|
472 |
-
error_message "Invalid command $selected_cmd"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rules-configuration.json
CHANGED
@@ -62,12 +62,9 @@
|
|
62 |
}, {
|
63 |
"class": "PassThroughRule",
|
64 |
"selector": "blockquote p"
|
65 |
-
}, {
|
66 |
-
"class": "ItalicRule",
|
67 |
-
"selector": "cite"
|
68 |
}, {
|
69 |
"class": "ImageRule",
|
70 |
-
"selector": "img",
|
71 |
"properties": {
|
72 |
"image.url": {
|
73 |
"type": "string",
|
@@ -75,9 +72,9 @@
|
|
75 |
"attribute": "src"
|
76 |
}
|
77 |
}
|
78 |
-
},
|
79 |
"class": "ImageRule",
|
80 |
-
"selector": "
|
81 |
"properties": {
|
82 |
"image.url": {
|
83 |
"type": "string",
|
@@ -125,27 +122,35 @@
|
|
125 |
"selector" : "h3,h4,h5,h6"
|
126 |
}, {
|
127 |
"class": "InteractiveRule",
|
128 |
-
"selector" : "
|
129 |
"properties" : {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
"interactive.iframe" : {
|
131 |
-
"type" : "
|
132 |
-
"
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
"type": "next-sibling-element-of",
|
138 |
-
"selector": "blockquote"
|
139 |
-
}
|
140 |
-
]
|
141 |
}
|
142 |
}
|
143 |
-
}, {
|
144 |
-
"class": "IgnoreRule",
|
145 |
-
"selector" : "script"
|
146 |
}, {
|
147 |
"class": "InteractiveRule",
|
148 |
-
"selector" : "iframe",
|
149 |
"properties" : {
|
150 |
"interactive.url" : {
|
151 |
"type" : "string",
|
@@ -165,6 +170,10 @@
|
|
165 |
"interactive.iframe" : {
|
166 |
"type" : "children",
|
167 |
"selector" : "iframe"
|
|
|
|
|
|
|
|
|
168 |
}
|
169 |
}
|
170 |
}, {
|
@@ -174,16 +183,6 @@
|
|
174 |
"interactive.iframe" : {
|
175 |
"type" : "children",
|
176 |
"selector" : "div.embed"
|
177 |
-
},
|
178 |
-
"interactive.height" : {
|
179 |
-
"type" : "int",
|
180 |
-
"selector" : "iframe",
|
181 |
-
"attribute": "height"
|
182 |
-
},
|
183 |
-
"interactive.width" : {
|
184 |
-
"type" : "int",
|
185 |
-
"selector" : "iframe",
|
186 |
-
"attribute": "width"
|
187 |
}
|
188 |
}
|
189 |
}, {
|
@@ -199,10 +198,9 @@
|
|
199 |
"selector" : "iframe",
|
200 |
"attribute": "height"
|
201 |
},
|
202 |
-
"interactive.
|
203 |
-
"type" : "
|
204 |
-
"selector" : "iframe"
|
205 |
-
"attribute": "width"
|
206 |
}
|
207 |
}
|
208 |
}, {
|
@@ -214,11 +212,6 @@
|
|
214 |
"selector" : "iframe",
|
215 |
"attribute": "src"
|
216 |
},
|
217 |
-
"interactive.iframe" : {
|
218 |
-
"type" : "children",
|
219 |
-
"selector" : "iframe",
|
220 |
-
"attribute": "src"
|
221 |
-
},
|
222 |
"interactive.width" : {
|
223 |
"type" : "int",
|
224 |
"selector" : "iframe",
|
@@ -238,39 +231,16 @@
|
|
238 |
"type" : "string",
|
239 |
"selector" : "iframe",
|
240 |
"attribute": "src"
|
241 |
-
},
|
242 |
-
"interactive.iframe" : {
|
243 |
-
"type" : "children",
|
244 |
-
"selector" : "iframe"
|
245 |
-
},
|
246 |
-
"interactive.height" : {
|
247 |
-
"type" : "int",
|
248 |
-
"selector" : "iframe",
|
249 |
-
"attribute": "height"
|
250 |
-
},
|
251 |
-
"interactive.width" : {
|
252 |
-
"type" : "int",
|
253 |
-
"selector" : "iframe",
|
254 |
-
"attribute": "width"
|
255 |
}
|
256 |
}
|
257 |
}, {
|
258 |
-
"class": "
|
259 |
-
"selector"
|
260 |
-
"properties"
|
261 |
-
"
|
262 |
-
"type"
|
263 |
-
"selector"
|
264 |
-
|
265 |
-
"interactive.height" : {
|
266 |
-
"type" : "int",
|
267 |
-
"selector" : "table",
|
268 |
-
"attribute": "height"
|
269 |
-
},
|
270 |
-
"interactive.width" : {
|
271 |
-
"type" : "int",
|
272 |
-
"selector" : "iframe",
|
273 |
-
"attribute": "width"
|
274 |
}
|
275 |
}
|
276 |
}, {
|
@@ -293,10 +263,8 @@
|
|
293 |
}, {
|
294 |
"class": "CaptionRule",
|
295 |
"selector" : "figcaption"
|
296 |
-
},
|
297 |
-
|
298 |
-
"selector" : "p.wp-caption-text"
|
299 |
-
}, {
|
300 |
"class": "ImageRule",
|
301 |
"selector" : "figure",
|
302 |
"properties" : {
|
@@ -323,28 +291,13 @@
|
|
323 |
}
|
324 |
}
|
325 |
}, {
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
"class": "SlideshowImageRule",
|
336 |
-
"selector" : "div.big-gallery-item",
|
337 |
-
"properties" : {
|
338 |
-
"image.url" : {
|
339 |
-
"type" : "string",
|
340 |
-
"selector" : "img",
|
341 |
-
"attribute": "src"
|
342 |
-
},
|
343 |
-
"caption.title" : {
|
344 |
-
"type" : "string",
|
345 |
-
"selector" : "figcaption.wp-caption-text"
|
346 |
-
}
|
347 |
-
}
|
348 |
-
}
|
349 |
-
]
|
350 |
}
|
62 |
}, {
|
63 |
"class": "PassThroughRule",
|
64 |
"selector": "blockquote p"
|
|
|
|
|
|
|
65 |
}, {
|
66 |
"class": "ImageRule",
|
67 |
+
"selector": "//p[img]",
|
68 |
"properties": {
|
69 |
"image.url": {
|
70 |
"type": "string",
|
72 |
"attribute": "src"
|
73 |
}
|
74 |
}
|
75 |
+
},{
|
76 |
"class": "ImageRule",
|
77 |
+
"selector": "img",
|
78 |
"properties": {
|
79 |
"image.url": {
|
80 |
"type": "string",
|
122 |
"selector" : "h3,h4,h5,h6"
|
123 |
}, {
|
124 |
"class": "InteractiveRule",
|
125 |
+
"selector" : "iframe",
|
126 |
"properties" : {
|
127 |
+
"interactive.url" : {
|
128 |
+
"type" : "string",
|
129 |
+
"selector" : "iframe",
|
130 |
+
"attribute": "src"
|
131 |
+
},
|
132 |
+
"interactive.width" : {
|
133 |
+
"type" : "int",
|
134 |
+
"selector" : "iframe",
|
135 |
+
"attribute": "width"
|
136 |
+
},
|
137 |
+
"interactive.height" : {
|
138 |
+
"type" : "int",
|
139 |
+
"selector" : "iframe",
|
140 |
+
"attribute": "height"
|
141 |
+
},
|
142 |
"interactive.iframe" : {
|
143 |
+
"type" : "children",
|
144 |
+
"selector" : "iframe"
|
145 |
+
},
|
146 |
+
"interactive.caption" : {
|
147 |
+
"type" : "element",
|
148 |
+
"selector" : "figcaption"
|
|
|
|
|
|
|
|
|
149 |
}
|
150 |
}
|
|
|
|
|
|
|
151 |
}, {
|
152 |
"class": "InteractiveRule",
|
153 |
+
"selector" : "//p[iframe]",
|
154 |
"properties" : {
|
155 |
"interactive.url" : {
|
156 |
"type" : "string",
|
170 |
"interactive.iframe" : {
|
171 |
"type" : "children",
|
172 |
"selector" : "iframe"
|
173 |
+
},
|
174 |
+
"interactive.caption" : {
|
175 |
+
"type" : "element",
|
176 |
+
"selector" : "figcaption"
|
177 |
}
|
178 |
}
|
179 |
}, {
|
183 |
"interactive.iframe" : {
|
184 |
"type" : "children",
|
185 |
"selector" : "div.embed"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
}
|
187 |
}
|
188 |
}, {
|
198 |
"selector" : "iframe",
|
199 |
"attribute": "height"
|
200 |
},
|
201 |
+
"interactive.iframe" : {
|
202 |
+
"type" : "children",
|
203 |
+
"selector" : "iframe"
|
|
|
204 |
}
|
205 |
}
|
206 |
}, {
|
212 |
"selector" : "iframe",
|
213 |
"attribute": "src"
|
214 |
},
|
|
|
|
|
|
|
|
|
|
|
215 |
"interactive.width" : {
|
216 |
"type" : "int",
|
217 |
"selector" : "iframe",
|
231 |
"type" : "string",
|
232 |
"selector" : "iframe",
|
233 |
"attribute": "src"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
}
|
235 |
}
|
236 |
}, {
|
237 |
+
"class": "ImageRule",
|
238 |
+
"selector": "//p[a[img]]|//a[img]",
|
239 |
+
"properties": {
|
240 |
+
"image.url": {
|
241 |
+
"type": "string",
|
242 |
+
"selector": "img",
|
243 |
+
"attribute": "src"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
}
|
245 |
}
|
246 |
}, {
|
263 |
}, {
|
264 |
"class": "CaptionRule",
|
265 |
"selector" : "figcaption"
|
266 |
+
},
|
267 |
+
{
|
|
|
|
|
268 |
"class": "ImageRule",
|
269 |
"selector" : "figure",
|
270 |
"properties" : {
|
291 |
}
|
292 |
}
|
293 |
}, {
|
294 |
+
"class": "InteractiveRule",
|
295 |
+
"selector" : "table",
|
296 |
+
"properties" : {
|
297 |
+
"interactive.iframe" : {
|
298 |
+
"type" : "element",
|
299 |
+
"selector" : "table"
|
300 |
+
}
|
301 |
+
}
|
302 |
+
}]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
}
|
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 ComposerAutoloaderInit337744729a91b1fdea5f68820e3d1dfe::getLoader();
|
vendor/composer/autoload_files.php
CHANGED
@@ -6,5 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
|
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
9 |
-
'
|
10 |
);
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
9 |
+
'7e702cccdb9dd904f2ccf22e5f37abae' => $vendorDir . '/facebook/php-sdk-v4/src/Facebook/polyfills.php',
|
10 |
);
|
vendor/composer/autoload_psr4.php
CHANGED
@@ -8,5 +8,5 @@ $baseDir = dirname($vendorDir);
|
|
8 |
return array(
|
9 |
'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'),
|
10 |
'Facebook\\InstantArticles\\' => array($vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles'),
|
11 |
-
'Facebook\\' => array($vendorDir . '/facebook/
|
12 |
);
|
8 |
return array(
|
9 |
'Symfony\\Component\\CssSelector\\' => array($vendorDir . '/symfony/css-selector'),
|
10 |
'Facebook\\InstantArticles\\' => array($vendorDir . '/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles'),
|
11 |
+
'Facebook\\' => array($vendorDir . '/facebook/php-sdk-v4/src/Facebook'),
|
12 |
);
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitfa8bfc5d2717dd9298c7d3347cfeea3b
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInitfa8bfc5d2717dd9298c7d3347cfeea3b
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit337744729a91b1fdea5f68820e3d1dfe
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit337744729a91b1fdea5f68820e3d1dfe', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit337744729a91b1fdea5f68820e3d1dfe', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
+
$includeFiles = Composer\Autoload\ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequire337744729a91b1fdea5f68820e3d1dfe($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequire337744729a91b1fdea5f68820e3d1dfe($fileIdentifier, $file)
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,10 +4,10 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
-
'
|
11 |
);
|
12 |
|
13 |
public static $prefixLengthsPsr4 = array (
|
@@ -33,7 +33,7 @@ class ComposerStaticInitfa8bfc5d2717dd9298c7d3347cfeea3b
|
|
33 |
),
|
34 |
'Facebook\\' =>
|
35 |
array (
|
36 |
-
0 => __DIR__ . '/..' . '/facebook/
|
37 |
),
|
38 |
);
|
39 |
|
@@ -122,9 +122,9 @@ class ComposerStaticInitfa8bfc5d2717dd9298c7d3347cfeea3b
|
|
122 |
public static function getInitializer(ClassLoader $loader)
|
123 |
{
|
124 |
return \Closure::bind(function () use ($loader) {
|
125 |
-
$loader->prefixLengthsPsr4 =
|
126 |
-
$loader->prefixDirsPsr4 =
|
127 |
-
$loader->classMap =
|
128 |
|
129 |
}, null, ClassLoader::class);
|
130 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe
|
8 |
{
|
9 |
public static $files = array (
|
10 |
+
'7e702cccdb9dd904f2ccf22e5f37abae' => __DIR__ . '/..' . '/facebook/php-sdk-v4/src/Facebook/polyfills.php',
|
11 |
);
|
12 |
|
13 |
public static $prefixLengthsPsr4 = array (
|
33 |
),
|
34 |
'Facebook\\' =>
|
35 |
array (
|
36 |
+
0 => __DIR__ . '/..' . '/facebook/php-sdk-v4/src/Facebook',
|
37 |
),
|
38 |
);
|
39 |
|
122 |
public static function getInitializer(ClassLoader $loader)
|
123 |
{
|
124 |
return \Closure::bind(function () use ($loader) {
|
125 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe::$prefixLengthsPsr4;
|
126 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe::$prefixDirsPsr4;
|
127 |
+
$loader->classMap = ComposerStaticInit337744729a91b1fdea5f68820e3d1dfe::$classMap;
|
128 |
|
129 |
}, null, ClassLoader::class);
|
130 |
}
|
vendor/composer/installed.json
CHANGED
@@ -32,18 +32,18 @@
|
|
32 |
]
|
33 |
},
|
34 |
{
|
35 |
-
"name": "facebook/
|
36 |
-
"version": "5.
|
37 |
-
"version_normalized": "5.
|
38 |
"source": {
|
39 |
"type": "git",
|
40 |
-
"url": "https://github.com/facebook/php-
|
41 |
-
"reference": "
|
42 |
},
|
43 |
"dist": {
|
44 |
"type": "zip",
|
45 |
-
"url": "https://api.github.com/repos/facebook/php-
|
46 |
-
"reference": "
|
47 |
"shasum": ""
|
48 |
},
|
49 |
"require": {
|
@@ -55,10 +55,9 @@
|
|
55 |
"phpunit/phpunit": "~4.0"
|
56 |
},
|
57 |
"suggest": {
|
58 |
-
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
|
59 |
-
"paragonie/random_compat": "Provides a better CSPRNG option in PHP 5"
|
60 |
},
|
61 |
-
"time": "
|
62 |
"type": "library",
|
63 |
"extra": {
|
64 |
"branch-alias": {
|
@@ -81,11 +80,11 @@
|
|
81 |
"authors": [
|
82 |
{
|
83 |
"name": "Facebook",
|
84 |
-
"homepage": "https://github.com/facebook/php-
|
85 |
}
|
86 |
],
|
87 |
"description": "Facebook SDK for PHP",
|
88 |
-
"homepage": "https://github.com/facebook/php-
|
89 |
"keywords": [
|
90 |
"facebook",
|
91 |
"sdk"
|
@@ -93,27 +92,27 @@
|
|
93 |
},
|
94 |
{
|
95 |
"name": "symfony/css-selector",
|
96 |
-
"version": "
|
97 |
-
"version_normalized": "
|
98 |
"source": {
|
99 |
"type": "git",
|
100 |
"url": "https://github.com/symfony/css-selector.git",
|
101 |
-
"reference": "
|
102 |
},
|
103 |
"dist": {
|
104 |
"type": "zip",
|
105 |
-
"url": "https://api.github.com/repos/symfony/css-selector/zipball/
|
106 |
-
"reference": "
|
107 |
"shasum": ""
|
108 |
},
|
109 |
"require": {
|
110 |
-
"php": ">=5.
|
111 |
},
|
112 |
-
"time": "
|
113 |
"type": "library",
|
114 |
"extra": {
|
115 |
"branch-alias": {
|
116 |
-
"dev-master": "
|
117 |
}
|
118 |
},
|
119 |
"installation-source": "dist",
|
@@ -148,31 +147,31 @@
|
|
148 |
},
|
149 |
{
|
150 |
"name": "facebook/facebook-instant-articles-sdk-php",
|
151 |
-
"version": "v1.
|
152 |
-
"version_normalized": "1.
|
153 |
"source": {
|
154 |
"type": "git",
|
155 |
"url": "https://github.com/facebook/facebook-instant-articles-sdk-php.git",
|
156 |
-
"reference": "
|
157 |
},
|
158 |
"dist": {
|
159 |
"type": "zip",
|
160 |
-
"url": "https://api.github.com/repos/facebook/facebook-instant-articles-sdk-php/zipball/
|
161 |
-
"reference": "
|
162 |
"shasum": ""
|
163 |
},
|
164 |
"require": {
|
165 |
"apache/log4php": "2.3.0",
|
166 |
-
"facebook/
|
167 |
"php": "^5.4 || ^7.0",
|
168 |
-
"symfony/css-selector": "2.8.*
|
169 |
},
|
170 |
"require-dev": {
|
171 |
"fzaninotto/faker": "^1.6.0",
|
172 |
"phpunit/phpunit": "^4.8",
|
173 |
"squizlabs/php_codesniffer": "^2.6.0"
|
174 |
},
|
175 |
-
"time": "
|
176 |
"type": "library",
|
177 |
"installation-source": "dist",
|
178 |
"autoload": {
|
32 |
]
|
33 |
},
|
34 |
{
|
35 |
+
"name": "facebook/php-sdk-v4",
|
36 |
+
"version": "5.2.0",
|
37 |
+
"version_normalized": "5.2.0.0",
|
38 |
"source": {
|
39 |
"type": "git",
|
40 |
+
"url": "https://github.com/facebook/facebook-php-sdk-v4.git",
|
41 |
+
"reference": "c60fba1fe1de62db1e0776d32fc2fb778189459c"
|
42 |
},
|
43 |
"dist": {
|
44 |
"type": "zip",
|
45 |
+
"url": "https://api.github.com/repos/facebook/facebook-php-sdk-v4/zipball/c60fba1fe1de62db1e0776d32fc2fb778189459c",
|
46 |
+
"reference": "c60fba1fe1de62db1e0776d32fc2fb778189459c",
|
47 |
"shasum": ""
|
48 |
},
|
49 |
"require": {
|
55 |
"phpunit/phpunit": "~4.0"
|
56 |
},
|
57 |
"suggest": {
|
58 |
+
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
|
|
|
59 |
},
|
60 |
+
"time": "2016-05-18 22:04:36",
|
61 |
"type": "library",
|
62 |
"extra": {
|
63 |
"branch-alias": {
|
80 |
"authors": [
|
81 |
{
|
82 |
"name": "Facebook",
|
83 |
+
"homepage": "https://github.com/facebook/facebook-php-sdk-v4/contributors"
|
84 |
}
|
85 |
],
|
86 |
"description": "Facebook SDK for PHP",
|
87 |
+
"homepage": "https://github.com/facebook/facebook-php-sdk-v4",
|
88 |
"keywords": [
|
89 |
"facebook",
|
90 |
"sdk"
|
92 |
},
|
93 |
{
|
94 |
"name": "symfony/css-selector",
|
95 |
+
"version": "v2.8.8",
|
96 |
+
"version_normalized": "2.8.8.0",
|
97 |
"source": {
|
98 |
"type": "git",
|
99 |
"url": "https://github.com/symfony/css-selector.git",
|
100 |
+
"reference": "9da4c615ba303850986e0480cc472bf704cfdb64"
|
101 |
},
|
102 |
"dist": {
|
103 |
"type": "zip",
|
104 |
+
"url": "https://api.github.com/repos/symfony/css-selector/zipball/9da4c615ba303850986e0480cc472bf704cfdb64",
|
105 |
+
"reference": "9da4c615ba303850986e0480cc472bf704cfdb64",
|
106 |
"shasum": ""
|
107 |
},
|
108 |
"require": {
|
109 |
+
"php": ">=5.3.9"
|
110 |
},
|
111 |
+
"time": "2016-06-29 05:31:50",
|
112 |
"type": "library",
|
113 |
"extra": {
|
114 |
"branch-alias": {
|
115 |
+
"dev-master": "2.8-dev"
|
116 |
}
|
117 |
},
|
118 |
"installation-source": "dist",
|
147 |
},
|
148 |
{
|
149 |
"name": "facebook/facebook-instant-articles-sdk-php",
|
150 |
+
"version": "v1.3.0",
|
151 |
+
"version_normalized": "1.3.0.0",
|
152 |
"source": {
|
153 |
"type": "git",
|
154 |
"url": "https://github.com/facebook/facebook-instant-articles-sdk-php.git",
|
155 |
+
"reference": "4b74463f347c49f9592ab35b70129bb15b4b1e6d"
|
156 |
},
|
157 |
"dist": {
|
158 |
"type": "zip",
|
159 |
+
"url": "https://api.github.com/repos/facebook/facebook-instant-articles-sdk-php/zipball/4b74463f347c49f9592ab35b70129bb15b4b1e6d",
|
160 |
+
"reference": "4b74463f347c49f9592ab35b70129bb15b4b1e6d",
|
161 |
"shasum": ""
|
162 |
},
|
163 |
"require": {
|
164 |
"apache/log4php": "2.3.0",
|
165 |
+
"facebook/php-sdk-v4": "~5.0",
|
166 |
"php": "^5.4 || ^7.0",
|
167 |
+
"symfony/css-selector": "2.8.*"
|
168 |
},
|
169 |
"require-dev": {
|
170 |
"fzaninotto/faker": "^1.6.0",
|
171 |
"phpunit/phpunit": "^4.8",
|
172 |
"squizlabs/php_codesniffer": "^2.6.0"
|
173 |
},
|
174 |
+
"time": "2016-07-12 00:57:23",
|
175 |
"type": "library",
|
176 |
"installation-source": "dist",
|
177 |
"autoload": {
|
vendor/facebook/facebook-instant-articles-sdk-php/.github/ISSUE_TEMPLATE.md
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
# Steps required to reproduce the problem
|
2 |
-
|
3 |
-
1.
|
4 |
-
2.
|
5 |
-
3.
|
6 |
-
|
7 |
-
# Expected Result
|
8 |
-
|
9 |
-
*
|
10 |
-
|
11 |
-
# Actual Result
|
12 |
-
|
13 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/.github/PULL_REQUEST_TEMPLATE.md
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
This PR
|
2 |
-
|
3 |
-
* [x]
|
4 |
-
* [ ]
|
5 |
-
* [ ]
|
6 |
-
|
7 |
-
Follows #.
|
8 |
-
Related to #.
|
9 |
-
Fixes #.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/.gitignore
CHANGED
@@ -2,4 +2,3 @@ composer.phar
|
|
2 |
/vendor/
|
3 |
*.ignored
|
4 |
**/IgnoredTest.php
|
5 |
-
.DS_Store
|
2 |
/vendor/
|
3 |
*.ignored
|
4 |
**/IgnoredTest.php
|
|
vendor/facebook/facebook-instant-articles-sdk-php/composer.json
CHANGED
@@ -11,8 +11,8 @@
|
|
11 |
}],
|
12 |
"require": {
|
13 |
"php": "^5.4 || ^7.0",
|
14 |
-
"symfony/css-selector": "2.8.*
|
15 |
-
"facebook/
|
16 |
"apache/log4php": "2.3.0"
|
17 |
},
|
18 |
"require-dev": {
|
11 |
}],
|
12 |
"require": {
|
13 |
"php": "^5.4 || ^7.0",
|
14 |
+
"symfony/css-selector": "2.8.*",
|
15 |
+
"facebook/php-sdk-v4": "~5.0",
|
16 |
"apache/log4php": "2.3.0"
|
17 |
},
|
18 |
"require-dev": {
|
vendor/facebook/facebook-instant-articles-sdk-php/composer.lock
CHANGED
@@ -4,7 +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 |
-
"
|
|
|
8 |
"packages": [
|
9 |
{
|
10 |
"name": "apache/log4php",
|
@@ -34,20 +35,20 @@
|
|
34 |
"logging",
|
35 |
"php"
|
36 |
],
|
37 |
-
"time": "2012-10-
|
38 |
},
|
39 |
{
|
40 |
-
"name": "facebook/
|
41 |
-
"version": "5.
|
42 |
"source": {
|
43 |
"type": "git",
|
44 |
-
"url": "https://github.com/facebook/php-
|
45 |
-
"reference": "
|
46 |
},
|
47 |
"dist": {
|
48 |
"type": "zip",
|
49 |
-
"url": "https://api.github.com/repos/facebook/php-
|
50 |
-
"reference": "
|
51 |
"shasum": ""
|
52 |
},
|
53 |
"require": {
|
@@ -59,8 +60,7 @@
|
|
59 |
"phpunit/phpunit": "~4.0"
|
60 |
},
|
61 |
"suggest": {
|
62 |
-
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
|
63 |
-
"paragonie/random_compat": "Provides a better CSPRNG option in PHP 5"
|
64 |
},
|
65 |
"type": "library",
|
66 |
"extra": {
|
@@ -83,29 +83,29 @@
|
|
83 |
"authors": [
|
84 |
{
|
85 |
"name": "Facebook",
|
86 |
-
"homepage": "https://github.com/facebook/php-
|
87 |
}
|
88 |
],
|
89 |
"description": "Facebook SDK for PHP",
|
90 |
-
"homepage": "https://github.com/facebook/php-
|
91 |
"keywords": [
|
92 |
"facebook",
|
93 |
"sdk"
|
94 |
],
|
95 |
-
"time": "2016-
|
96 |
},
|
97 |
{
|
98 |
"name": "symfony/css-selector",
|
99 |
-
"version": "v2.8.
|
100 |
"source": {
|
101 |
"type": "git",
|
102 |
"url": "https://github.com/symfony/css-selector.git",
|
103 |
-
"reference": "
|
104 |
},
|
105 |
"dist": {
|
106 |
"type": "zip",
|
107 |
-
"url": "https://api.github.com/repos/symfony/css-selector/zipball/
|
108 |
-
"reference": "
|
109 |
"shasum": ""
|
110 |
},
|
111 |
"require": {
|
@@ -145,7 +145,7 @@
|
|
145 |
],
|
146 |
"description": "Symfony CssSelector Component",
|
147 |
"homepage": "https://symfony.com",
|
148 |
-
"time": "2016-11
|
149 |
}
|
150 |
],
|
151 |
"packages-dev": [
|
@@ -201,7 +201,7 @@
|
|
201 |
"constructor",
|
202 |
"instantiate"
|
203 |
],
|
204 |
-
"time": "2015-06-
|
205 |
},
|
206 |
{
|
207 |
"name": "fzaninotto/faker",
|
@@ -249,7 +249,7 @@
|
|
249 |
"faker",
|
250 |
"fixtures"
|
251 |
],
|
252 |
-
"time": "2016-04-
|
253 |
},
|
254 |
{
|
255 |
"name": "phpdocumentor/reflection-docblock",
|
@@ -298,20 +298,20 @@
|
|
298 |
"email": "mike.vanriel@naenius.com"
|
299 |
}
|
300 |
],
|
301 |
-
"time": "2015-02-
|
302 |
},
|
303 |
{
|
304 |
"name": "phpspec/prophecy",
|
305 |
-
"version": "v1.6.
|
306 |
"source": {
|
307 |
"type": "git",
|
308 |
"url": "https://github.com/phpspec/prophecy.git",
|
309 |
-
"reference": "
|
310 |
},
|
311 |
"dist": {
|
312 |
"type": "zip",
|
313 |
-
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/
|
314 |
-
"reference": "
|
315 |
"shasum": ""
|
316 |
},
|
317 |
"require": {
|
@@ -319,11 +319,10 @@
|
|
319 |
"php": "^5.3|^7.0",
|
320 |
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
|
321 |
"sebastian/comparator": "^1.1",
|
322 |
-
"sebastian/recursion-context": "^1.0
|
323 |
},
|
324 |
"require-dev": {
|
325 |
-
"phpspec/phpspec": "^2.0"
|
326 |
-
"phpunit/phpunit": "^4.8 || ^5.6.5"
|
327 |
},
|
328 |
"type": "library",
|
329 |
"extra": {
|
@@ -361,7 +360,7 @@
|
|
361 |
"spy",
|
362 |
"stub"
|
363 |
],
|
364 |
-
"time": "2016-
|
365 |
},
|
366 |
{
|
367 |
"name": "phpunit/php-code-coverage",
|
@@ -423,7 +422,7 @@
|
|
423 |
"testing",
|
424 |
"xunit"
|
425 |
],
|
426 |
-
"time": "2015-10-
|
427 |
},
|
428 |
{
|
429 |
"name": "phpunit/php-file-iterator",
|
@@ -470,7 +469,7 @@
|
|
470 |
"filesystem",
|
471 |
"iterator"
|
472 |
],
|
473 |
-
"time": "2015-06-
|
474 |
},
|
475 |
{
|
476 |
"name": "phpunit/php-text-template",
|
@@ -511,7 +510,7 @@
|
|
511 |
"keywords": [
|
512 |
"template"
|
513 |
],
|
514 |
-
"time": "2015-06-
|
515 |
},
|
516 |
{
|
517 |
"name": "phpunit/php-timer",
|
@@ -555,20 +554,20 @@
|
|
555 |
"keywords": [
|
556 |
"timer"
|
557 |
],
|
558 |
-
"time": "2016-05-
|
559 |
},
|
560 |
{
|
561 |
"name": "phpunit/php-token-stream",
|
562 |
-
"version": "1.4.
|
563 |
"source": {
|
564 |
"type": "git",
|
565 |
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
566 |
-
"reference": "
|
567 |
},
|
568 |
"dist": {
|
569 |
"type": "zip",
|
570 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/
|
571 |
-
"reference": "
|
572 |
"shasum": ""
|
573 |
},
|
574 |
"require": {
|
@@ -604,20 +603,20 @@
|
|
604 |
"keywords": [
|
605 |
"tokenizer"
|
606 |
],
|
607 |
-
"time": "
|
608 |
},
|
609 |
{
|
610 |
"name": "phpunit/phpunit",
|
611 |
-
"version": "4.8.
|
612 |
"source": {
|
613 |
"type": "git",
|
614 |
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
615 |
-
"reference": "
|
616 |
},
|
617 |
"dist": {
|
618 |
"type": "zip",
|
619 |
-
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/
|
620 |
-
"reference": "
|
621 |
"shasum": ""
|
622 |
},
|
623 |
"require": {
|
@@ -633,7 +632,7 @@
|
|
633 |
"phpunit/php-text-template": "~1.2",
|
634 |
"phpunit/php-timer": "^1.0.6",
|
635 |
"phpunit/phpunit-mock-objects": "~2.3",
|
636 |
-
"sebastian/comparator": "~1.
|
637 |
"sebastian/diff": "~1.2",
|
638 |
"sebastian/environment": "~1.3",
|
639 |
"sebastian/exporter": "~1.2",
|
@@ -676,7 +675,7 @@
|
|
676 |
"testing",
|
677 |
"xunit"
|
678 |
],
|
679 |
-
"time": "2016-
|
680 |
},
|
681 |
{
|
682 |
"name": "phpunit/phpunit-mock-objects",
|
@@ -732,26 +731,26 @@
|
|
732 |
"mock",
|
733 |
"xunit"
|
734 |
],
|
735 |
-
"time": "2015-10-
|
736 |
},
|
737 |
{
|
738 |
"name": "sebastian/comparator",
|
739 |
-
"version": "1.2.
|
740 |
"source": {
|
741 |
"type": "git",
|
742 |
"url": "https://github.com/sebastianbergmann/comparator.git",
|
743 |
-
"reference": "
|
744 |
},
|
745 |
"dist": {
|
746 |
"type": "zip",
|
747 |
-
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/
|
748 |
-
"reference": "
|
749 |
"shasum": ""
|
750 |
},
|
751 |
"require": {
|
752 |
"php": ">=5.3.3",
|
753 |
"sebastian/diff": "~1.2",
|
754 |
-
"sebastian/exporter": "~1.2
|
755 |
},
|
756 |
"require-dev": {
|
757 |
"phpunit/phpunit": "~4.4"
|
@@ -796,7 +795,7 @@
|
|
796 |
"compare",
|
797 |
"equality"
|
798 |
],
|
799 |
-
"time": "
|
800 |
},
|
801 |
{
|
802 |
"name": "sebastian/diff",
|
@@ -848,27 +847,27 @@
|
|
848 |
"keywords": [
|
849 |
"diff"
|
850 |
],
|
851 |
-
"time": "2015-12-
|
852 |
},
|
853 |
{
|
854 |
"name": "sebastian/environment",
|
855 |
-
"version": "1.3.
|
856 |
"source": {
|
857 |
"type": "git",
|
858 |
"url": "https://github.com/sebastianbergmann/environment.git",
|
859 |
-
"reference": "
|
860 |
},
|
861 |
"dist": {
|
862 |
"type": "zip",
|
863 |
-
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/
|
864 |
-
"reference": "
|
865 |
"shasum": ""
|
866 |
},
|
867 |
"require": {
|
868 |
-
"php": "
|
869 |
},
|
870 |
"require-dev": {
|
871 |
-
"phpunit/phpunit": "
|
872 |
},
|
873 |
"type": "library",
|
874 |
"extra": {
|
@@ -898,7 +897,7 @@
|
|
898 |
"environment",
|
899 |
"hhvm"
|
900 |
],
|
901 |
-
"time": "2016-
|
902 |
},
|
903 |
{
|
904 |
"name": "sebastian/exporter",
|
@@ -965,7 +964,7 @@
|
|
965 |
"export",
|
966 |
"exporter"
|
967 |
],
|
968 |
-
"time": "2016-06-
|
969 |
},
|
970 |
{
|
971 |
"name": "sebastian/global-state",
|
@@ -1016,7 +1015,7 @@
|
|
1016 |
"keywords": [
|
1017 |
"global state"
|
1018 |
],
|
1019 |
-
"time": "2015-10-
|
1020 |
},
|
1021 |
{
|
1022 |
"name": "sebastian/recursion-context",
|
@@ -1069,7 +1068,7 @@
|
|
1069 |
],
|
1070 |
"description": "Provides functionality to recursively process PHP variables",
|
1071 |
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
1072 |
-
"time": "2015-11-
|
1073 |
},
|
1074 |
{
|
1075 |
"name": "sebastian/version",
|
@@ -1104,20 +1103,20 @@
|
|
1104 |
],
|
1105 |
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
1106 |
"homepage": "https://github.com/sebastianbergmann/version",
|
1107 |
-
"time": "2015-06-
|
1108 |
},
|
1109 |
{
|
1110 |
"name": "squizlabs/php_codesniffer",
|
1111 |
-
"version": "2.
|
1112 |
"source": {
|
1113 |
"type": "git",
|
1114 |
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
1115 |
-
"reference": "
|
1116 |
},
|
1117 |
"dist": {
|
1118 |
"type": "zip",
|
1119 |
-
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/
|
1120 |
-
"reference": "
|
1121 |
"shasum": ""
|
1122 |
},
|
1123 |
"require": {
|
@@ -1182,20 +1181,20 @@
|
|
1182 |
"phpcs",
|
1183 |
"standards"
|
1184 |
],
|
1185 |
-
"time": "2016-
|
1186 |
},
|
1187 |
{
|
1188 |
"name": "symfony/yaml",
|
1189 |
-
"version": "v2.8.
|
1190 |
"source": {
|
1191 |
"type": "git",
|
1192 |
"url": "https://github.com/symfony/yaml.git",
|
1193 |
-
"reference": "
|
1194 |
},
|
1195 |
"dist": {
|
1196 |
"type": "zip",
|
1197 |
-
"url": "https://api.github.com/repos/symfony/yaml/zipball/
|
1198 |
-
"reference": "
|
1199 |
"shasum": ""
|
1200 |
},
|
1201 |
"require": {
|
@@ -1231,7 +1230,7 @@
|
|
1231 |
],
|
1232 |
"description": "Symfony Yaml Component",
|
1233 |
"homepage": "https://symfony.com",
|
1234 |
-
"time": "2016-11
|
1235 |
}
|
1236 |
],
|
1237 |
"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",
|
35 |
"logging",
|
36 |
"php"
|
37 |
],
|
38 |
+
"time": "2012-10-26 09:13:25"
|
39 |
},
|
40 |
{
|
41 |
+
"name": "facebook/php-sdk-v4",
|
42 |
+
"version": "5.2.0",
|
43 |
"source": {
|
44 |
"type": "git",
|
45 |
+
"url": "https://github.com/facebook/facebook-php-sdk-v4.git",
|
46 |
+
"reference": "c60fba1fe1de62db1e0776d32fc2fb778189459c"
|
47 |
},
|
48 |
"dist": {
|
49 |
"type": "zip",
|
50 |
+
"url": "https://api.github.com/repos/facebook/facebook-php-sdk-v4/zipball/c60fba1fe1de62db1e0776d32fc2fb778189459c",
|
51 |
+
"reference": "c60fba1fe1de62db1e0776d32fc2fb778189459c",
|
52 |
"shasum": ""
|
53 |
},
|
54 |
"require": {
|
60 |
"phpunit/phpunit": "~4.0"
|
61 |
},
|
62 |
"suggest": {
|
63 |
+
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
|
|
|
64 |
},
|
65 |
"type": "library",
|
66 |
"extra": {
|
83 |
"authors": [
|
84 |
{
|
85 |
"name": "Facebook",
|
86 |
+
"homepage": "https://github.com/facebook/facebook-php-sdk-v4/contributors"
|
87 |
}
|
88 |
],
|
89 |
"description": "Facebook SDK for PHP",
|
90 |
+
"homepage": "https://github.com/facebook/facebook-php-sdk-v4",
|
91 |
"keywords": [
|
92 |
"facebook",
|
93 |
"sdk"
|
94 |
],
|
95 |
+
"time": "2016-05-18 22:04:36"
|
96 |
},
|
97 |
{
|
98 |
"name": "symfony/css-selector",
|
99 |
+
"version": "v2.8.7",
|
100 |
"source": {
|
101 |
"type": "git",
|
102 |
"url": "https://github.com/symfony/css-selector.git",
|
103 |
+
"reference": "9a0b2649328297fb6acd0c823789d92efcbd36ad"
|
104 |
},
|
105 |
"dist": {
|
106 |
"type": "zip",
|
107 |
+
"url": "https://api.github.com/repos/symfony/css-selector/zipball/9a0b2649328297fb6acd0c823789d92efcbd36ad",
|
108 |
+
"reference": "9a0b2649328297fb6acd0c823789d92efcbd36ad",
|
109 |
"shasum": ""
|
110 |
},
|
111 |
"require": {
|
145 |
],
|
146 |
"description": "Symfony CssSelector Component",
|
147 |
"homepage": "https://symfony.com",
|
148 |
+
"time": "2016-06-06 11:11:27"
|
149 |
}
|
150 |
],
|
151 |
"packages-dev": [
|
201 |
"constructor",
|
202 |
"instantiate"
|
203 |
],
|
204 |
+
"time": "2015-06-14 21:17:01"
|
205 |
},
|
206 |
{
|
207 |
"name": "fzaninotto/faker",
|
249 |
"faker",
|
250 |
"fixtures"
|
251 |
],
|
252 |
+
"time": "2016-04-29 12:21:54"
|
253 |
},
|
254 |
{
|
255 |
"name": "phpdocumentor/reflection-docblock",
|
298 |
"email": "mike.vanriel@naenius.com"
|
299 |
}
|
300 |
],
|
301 |
+
"time": "2015-02-03 12:10:50"
|
302 |
},
|
303 |
{
|
304 |
"name": "phpspec/prophecy",
|
305 |
+
"version": "v1.6.1",
|
306 |
"source": {
|
307 |
"type": "git",
|
308 |
"url": "https://github.com/phpspec/prophecy.git",
|
309 |
+
"reference": "58a8137754bc24b25740d4281399a4a3596058e0"
|
310 |
},
|
311 |
"dist": {
|
312 |
"type": "zip",
|
313 |
+
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0",
|
314 |
+
"reference": "58a8137754bc24b25740d4281399a4a3596058e0",
|
315 |
"shasum": ""
|
316 |
},
|
317 |
"require": {
|
319 |
"php": "^5.3|^7.0",
|
320 |
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
|
321 |
"sebastian/comparator": "^1.1",
|
322 |
+
"sebastian/recursion-context": "^1.0"
|
323 |
},
|
324 |
"require-dev": {
|
325 |
+
"phpspec/phpspec": "^2.0"
|
|
|
326 |
},
|
327 |
"type": "library",
|
328 |
"extra": {
|
360 |
"spy",
|
361 |
"stub"
|
362 |
],
|
363 |
+
"time": "2016-06-07 08:13:47"
|
364 |
},
|
365 |
{
|
366 |
"name": "phpunit/php-code-coverage",
|
422 |
"testing",
|
423 |
"xunit"
|
424 |
],
|
425 |
+
"time": "2015-10-06 15:47:00"
|
426 |
},
|
427 |
{
|
428 |
"name": "phpunit/php-file-iterator",
|
469 |
"filesystem",
|
470 |
"iterator"
|
471 |
],
|
472 |
+
"time": "2015-06-21 13:08:43"
|
473 |
},
|
474 |
{
|
475 |
"name": "phpunit/php-text-template",
|
510 |
"keywords": [
|
511 |
"template"
|
512 |
],
|
513 |
+
"time": "2015-06-21 13:50:34"
|
514 |
},
|
515 |
{
|
516 |
"name": "phpunit/php-timer",
|
554 |
"keywords": [
|
555 |
"timer"
|
556 |
],
|
557 |
+
"time": "2016-05-12 18:03:57"
|
558 |
},
|
559 |
{
|
560 |
"name": "phpunit/php-token-stream",
|
561 |
+
"version": "1.4.8",
|
562 |
"source": {
|
563 |
"type": "git",
|
564 |
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
565 |
+
"reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
|
566 |
},
|
567 |
"dist": {
|
568 |
"type": "zip",
|
569 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
|
570 |
+
"reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
|
571 |
"shasum": ""
|
572 |
},
|
573 |
"require": {
|
603 |
"keywords": [
|
604 |
"tokenizer"
|
605 |
],
|
606 |
+
"time": "2015-09-15 10:49:45"
|
607 |
},
|
608 |
{
|
609 |
"name": "phpunit/phpunit",
|
610 |
+
"version": "4.8.26",
|
611 |
"source": {
|
612 |
"type": "git",
|
613 |
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
614 |
+
"reference": "fc1d8cd5b5de11625979125c5639347896ac2c74"
|
615 |
},
|
616 |
"dist": {
|
617 |
"type": "zip",
|
618 |
+
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fc1d8cd5b5de11625979125c5639347896ac2c74",
|
619 |
+
"reference": "fc1d8cd5b5de11625979125c5639347896ac2c74",
|
620 |
"shasum": ""
|
621 |
},
|
622 |
"require": {
|
632 |
"phpunit/php-text-template": "~1.2",
|
633 |
"phpunit/php-timer": "^1.0.6",
|
634 |
"phpunit/phpunit-mock-objects": "~2.3",
|
635 |
+
"sebastian/comparator": "~1.1",
|
636 |
"sebastian/diff": "~1.2",
|
637 |
"sebastian/environment": "~1.3",
|
638 |
"sebastian/exporter": "~1.2",
|
675 |
"testing",
|
676 |
"xunit"
|
677 |
],
|
678 |
+
"time": "2016-05-17 03:09:28"
|
679 |
},
|
680 |
{
|
681 |
"name": "phpunit/phpunit-mock-objects",
|
731 |
"mock",
|
732 |
"xunit"
|
733 |
],
|
734 |
+
"time": "2015-10-02 06:51:40"
|
735 |
},
|
736 |
{
|
737 |
"name": "sebastian/comparator",
|
738 |
+
"version": "1.2.0",
|
739 |
"source": {
|
740 |
"type": "git",
|
741 |
"url": "https://github.com/sebastianbergmann/comparator.git",
|
742 |
+
"reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
|
743 |
},
|
744 |
"dist": {
|
745 |
"type": "zip",
|
746 |
+
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
|
747 |
+
"reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
|
748 |
"shasum": ""
|
749 |
},
|
750 |
"require": {
|
751 |
"php": ">=5.3.3",
|
752 |
"sebastian/diff": "~1.2",
|
753 |
+
"sebastian/exporter": "~1.2"
|
754 |
},
|
755 |
"require-dev": {
|
756 |
"phpunit/phpunit": "~4.4"
|
795 |
"compare",
|
796 |
"equality"
|
797 |
],
|
798 |
+
"time": "2015-07-26 15:48:44"
|
799 |
},
|
800 |
{
|
801 |
"name": "sebastian/diff",
|
847 |
"keywords": [
|
848 |
"diff"
|
849 |
],
|
850 |
+
"time": "2015-12-08 07:14:41"
|
851 |
},
|
852 |
{
|
853 |
"name": "sebastian/environment",
|
854 |
+
"version": "1.3.7",
|
855 |
"source": {
|
856 |
"type": "git",
|
857 |
"url": "https://github.com/sebastianbergmann/environment.git",
|
858 |
+
"reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716"
|
859 |
},
|
860 |
"dist": {
|
861 |
"type": "zip",
|
862 |
+
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716",
|
863 |
+
"reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716",
|
864 |
"shasum": ""
|
865 |
},
|
866 |
"require": {
|
867 |
+
"php": ">=5.3.3"
|
868 |
},
|
869 |
"require-dev": {
|
870 |
+
"phpunit/phpunit": "~4.4"
|
871 |
},
|
872 |
"type": "library",
|
873 |
"extra": {
|
897 |
"environment",
|
898 |
"hhvm"
|
899 |
],
|
900 |
+
"time": "2016-05-17 03:18:57"
|
901 |
},
|
902 |
{
|
903 |
"name": "sebastian/exporter",
|
964 |
"export",
|
965 |
"exporter"
|
966 |
],
|
967 |
+
"time": "2016-06-17 09:04:28"
|
968 |
},
|
969 |
{
|
970 |
"name": "sebastian/global-state",
|
1015 |
"keywords": [
|
1016 |
"global state"
|
1017 |
],
|
1018 |
+
"time": "2015-10-12 03:26:01"
|
1019 |
},
|
1020 |
{
|
1021 |
"name": "sebastian/recursion-context",
|
1068 |
],
|
1069 |
"description": "Provides functionality to recursively process PHP variables",
|
1070 |
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
1071 |
+
"time": "2015-11-11 19:50:13"
|
1072 |
},
|
1073 |
{
|
1074 |
"name": "sebastian/version",
|
1103 |
],
|
1104 |
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
1105 |
"homepage": "https://github.com/sebastianbergmann/version",
|
1106 |
+
"time": "2015-06-21 13:59:46"
|
1107 |
},
|
1108 |
{
|
1109 |
"name": "squizlabs/php_codesniffer",
|
1110 |
+
"version": "2.6.1",
|
1111 |
"source": {
|
1112 |
"type": "git",
|
1113 |
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
1114 |
+
"reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d"
|
1115 |
},
|
1116 |
"dist": {
|
1117 |
"type": "zip",
|
1118 |
+
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/fb72ed32f8418db5e7770be1653e62e0d6f5dd3d",
|
1119 |
+
"reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d",
|
1120 |
"shasum": ""
|
1121 |
},
|
1122 |
"require": {
|
1181 |
"phpcs",
|
1182 |
"standards"
|
1183 |
],
|
1184 |
+
"time": "2016-05-30 22:24:32"
|
1185 |
},
|
1186 |
{
|
1187 |
"name": "symfony/yaml",
|
1188 |
+
"version": "v2.8.7",
|
1189 |
"source": {
|
1190 |
"type": "git",
|
1191 |
"url": "https://github.com/symfony/yaml.git",
|
1192 |
+
"reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34"
|
1193 |
},
|
1194 |
"dist": {
|
1195 |
"type": "zip",
|
1196 |
+
"url": "https://api.github.com/repos/symfony/yaml/zipball/815fabf3f48c7d1df345a69d1ad1a88f59757b34",
|
1197 |
+
"reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34",
|
1198 |
"shasum": ""
|
1199 |
},
|
1200 |
"require": {
|
1230 |
],
|
1231 |
"description": "Symfony Yaml Component",
|
1232 |
"homepage": "https://symfony.com",
|
1233 |
+
"time": "2016-06-06 11:11:27"
|
1234 |
}
|
1235 |
],
|
1236 |
"aliases": [],
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Client.php
CHANGED
@@ -88,7 +88,7 @@ class Client
|
|
88 |
*
|
89 |
* @return int The submission status ID. It is not the article ID. (Since 1.3.0)
|
90 |
*/
|
91 |
-
public function importArticle($article, $published = false
|
92 |
{
|
93 |
Type::enforce($article, 'Facebook\InstantArticles\Elements\InstantArticleInterface');
|
94 |
Type::enforce($published, Type::BOOLEAN);
|
@@ -103,27 +103,9 @@ class Client
|
|
103 |
'development_mode' => $this->developmentMode,
|
104 |
]);
|
105 |
|
106 |
-
if ($forceRescrape) {
|
107 |
-
// Re-scrape Graph object for article URL
|
108 |
-
$this->scrapeArticleURL($article->getCanonicalURL());
|
109 |
-
}
|
110 |
-
|
111 |
return $response->getGraphNode()->getField('id');
|
112 |
}
|
113 |
|
114 |
-
/**
|
115 |
-
* Scrape Graph object for given URL
|
116 |
-
*
|
117 |
-
* @param string $canonicalURL The URL that will be scraped.
|
118 |
-
*/
|
119 |
-
private function scrapeArticleURL($canonicalURL)
|
120 |
-
{
|
121 |
-
$this->facebook->post('/', [
|
122 |
-
'id' => $canonicalURL,
|
123 |
-
'scrape' => 'true',
|
124 |
-
]);
|
125 |
-
}
|
126 |
-
|
127 |
/**
|
128 |
* Removes an article from your Instant Articles library.
|
129 |
*
|
@@ -260,42 +242,4 @@ class Client
|
|
260 |
|
261 |
return $articleURLs;
|
262 |
}
|
263 |
-
|
264 |
-
/**
|
265 |
-
* Claims an URL for the page
|
266 |
-
*
|
267 |
-
* @param string $url The root URL of the site
|
268 |
-
*/
|
269 |
-
public function claimURL($url)
|
270 |
-
{
|
271 |
-
// Remove protocol from the URL
|
272 |
-
$url = preg_replace('/^https?:\/\//i', '', $url);
|
273 |
-
$response = $this->facebook->post($this->pageID . '/claimed_urls?url=' . urlencode($url));
|
274 |
-
$node = $response->getGraphNode();
|
275 |
-
$error = $node->getField('error');
|
276 |
-
$success = $node->getField('success');
|
277 |
-
if ($error) {
|
278 |
-
throw new ClientException($error['error_user_msg']);
|
279 |
-
}
|
280 |
-
if (!$success) {
|
281 |
-
throw new ClientException('Could not claim the URL');
|
282 |
-
}
|
283 |
-
}
|
284 |
-
|
285 |
-
/**
|
286 |
-
* Submits the page for review
|
287 |
-
*/
|
288 |
-
public function submitForReview()
|
289 |
-
{
|
290 |
-
$response = $this->facebook->post($this->pageID . '/?instant_articles_submit_for_review=true');
|
291 |
-
$node = $response->getGraphNode();
|
292 |
-
$error = $node->getField('error');
|
293 |
-
$success = $node->getField('success');
|
294 |
-
if ($error) {
|
295 |
-
throw new ClientException($error['error_user_msg']);
|
296 |
-
}
|
297 |
-
if (!$success) {
|
298 |
-
throw new ClientException('Could not submit for review');
|
299 |
-
}
|
300 |
-
}
|
301 |
}
|
88 |
*
|
89 |
* @return int The submission status ID. It is not the article ID. (Since 1.3.0)
|
90 |
*/
|
91 |
+
public function importArticle($article, $published = false)
|
92 |
{
|
93 |
Type::enforce($article, 'Facebook\InstantArticles\Elements\InstantArticleInterface');
|
94 |
Type::enforce($published, Type::BOOLEAN);
|
103 |
'development_mode' => $this->developmentMode,
|
104 |
]);
|
105 |
|
|
|
|
|
|
|
|
|
|
|
106 |
return $response->getGraphNode()->getField('id');
|
107 |
}
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
/**
|
110 |
* Removes an article from your Instant Articles library.
|
111 |
*
|
242 |
|
243 |
return $articleURLs;
|
244 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Client/Helper.php
CHANGED
@@ -61,13 +61,12 @@ class Helper
|
|
61 |
* short-lived user access token.
|
62 |
*
|
63 |
* @param AccessToken $accessToken A short-lived user access token.
|
64 |
-
* @param int $offset Offset pages API results
|
65 |
*
|
66 |
* @return array
|
67 |
*
|
68 |
* @throws FacebookSDKException
|
69 |
*/
|
70 |
-
public function getPagesAndTokens($accessToken
|
71 |
{
|
72 |
Type::enforce($accessToken, 'Facebook\Authentication\AccessToken');
|
73 |
|
@@ -90,7 +89,7 @@ class Helper
|
|
90 |
// Request the list of pages and associated page tokens that are
|
91 |
// connected to this user
|
92 |
try {
|
93 |
-
$response = $this->facebook->get('/me/accounts?fields=name,id,access_token,supports_instant_articles
|
94 |
} catch (FacebookResponseException $e) {
|
95 |
throw new FacebookSDKException('Graph API returned an error: ' . $e->getMessage());
|
96 |
}
|
61 |
* short-lived user access token.
|
62 |
*
|
63 |
* @param AccessToken $accessToken A short-lived user access token.
|
|
|
64 |
*
|
65 |
* @return array
|
66 |
*
|
67 |
* @throws FacebookSDKException
|
68 |
*/
|
69 |
+
public function getPagesAndTokens($accessToken)
|
70 |
{
|
71 |
Type::enforce($accessToken, 'Facebook\Authentication\AccessToken');
|
72 |
|
89 |
// Request the list of pages and associated page tokens that are
|
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 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Element.php
CHANGED
@@ -20,7 +20,7 @@ abstract class Element
|
|
20 |
{
|
21 |
private $empty_validation = true;
|
22 |
|
23 |
-
abstract public function toDOMElement(
|
24 |
|
25 |
/**
|
26 |
* Renders the Element content
|
@@ -37,28 +37,11 @@ abstract class Element
|
|
37 |
$document->formatOutput = $formatted;
|
38 |
$element = $this->toDOMElement($document);
|
39 |
$document->appendChild($element);
|
40 |
-
$rendered = $doctype.$document->saveXML($element
|
41 |
|
42 |
// We can't currently use DOMDocument::saveHTML, because it doesn't produce proper HTML5 markup, so we have to strip CDATA enclosures
|
43 |
// TODO Consider replacing this workaround with a parent class for elements that will be rendered and in this class use the `srcdoc` attribute to output the (escaped) markup
|
44 |
$rendered = preg_replace('/<!\[CDATA\[(.*?)\]\]>/is', '$1', $rendered);
|
45 |
-
// Fix void HTML5 elements (these can't be closed like in XML)
|
46 |
-
$rendered = str_replace('></area>', '/>', $rendered);
|
47 |
-
$rendered = str_replace('></base>', '/>', $rendered);
|
48 |
-
$rendered = str_replace('></br>', '/>', $rendered);
|
49 |
-
$rendered = str_replace('></col>', '/>', $rendered);
|
50 |
-
$rendered = str_replace('></command>', '/>', $rendered);
|
51 |
-
$rendered = str_replace('></embed>', '/>', $rendered);
|
52 |
-
$rendered = str_replace('></hr>', '/>', $rendered);
|
53 |
-
$rendered = str_replace('></img>', '/>', $rendered);
|
54 |
-
$rendered = str_replace('></input>', '/>', $rendered);
|
55 |
-
$rendered = str_replace('></keygen>', '/>', $rendered);
|
56 |
-
$rendered = str_replace('></link>', '/>', $rendered);
|
57 |
-
$rendered = str_replace('></meta>', '/>', $rendered);
|
58 |
-
$rendered = str_replace('></param>', '/>', $rendered);
|
59 |
-
$rendered = str_replace('></source>', '/>', $rendered);
|
60 |
-
$rendered = str_replace('></track>', '/>', $rendered);
|
61 |
-
$rendered = str_replace('></wbr>', '/>', $rendered);
|
62 |
|
63 |
return $rendered;
|
64 |
}
|
20 |
{
|
21 |
private $empty_validation = true;
|
22 |
|
23 |
+
abstract public function toDOMElement();
|
24 |
|
25 |
/**
|
26 |
* Renders the Element content
|
37 |
$document->formatOutput = $formatted;
|
38 |
$element = $this->toDOMElement($document);
|
39 |
$document->appendChild($element);
|
40 |
+
$rendered = $doctype.$document->saveXML($element);
|
41 |
|
42 |
// We can't currently use DOMDocument::saveHTML, because it doesn't produce proper HTML5 markup, so we have to strip CDATA enclosures
|
43 |
// TODO Consider replacing this workaround with a parent class for elements that will be rendered and in this class use the `srcdoc` attribute to output the (escaped) markup
|
44 |
$rendered = preg_replace('/<!\[CDATA\[(.*?)\]\]>/is', '$1', $rendered);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
return $rendered;
|
47 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/GeoTag.php
CHANGED
@@ -101,10 +101,7 @@ class GeoTag extends Element
|
|
101 |
|
102 |
// Required script field
|
103 |
if ($this->script) {
|
104 |
-
|
105 |
-
$element->appendChild(
|
106 |
-
$element->ownerDocument->importNode(new \DOMCdataSection($this->script), true)
|
107 |
-
);
|
108 |
}
|
109 |
|
110 |
return $element;
|
101 |
|
102 |
// Required script field
|
103 |
if ($this->script) {
|
104 |
+
$element->appendChild($document->createTextNode($this->script));
|
|
|
|
|
|
|
105 |
}
|
106 |
|
107 |
return $element;
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Image.php
CHANGED
@@ -40,16 +40,6 @@ class Image extends Audible implements Container
|
|
40 |
const FULLSCREEN = 'fullscreen';
|
41 |
const NON_INTERACTIVE = 'non-interactive';
|
42 |
|
43 |
-
/**
|
44 |
-
* @var boolean marks if any created image will have likes enabled by default
|
45 |
-
*/
|
46 |
-
public static $defaultLikeEnabled = false;
|
47 |
-
|
48 |
-
/**
|
49 |
-
* @var boolean marks if any created image will have comments enabled by default
|
50 |
-
*/
|
51 |
-
public static $defaultCommentEnabled = false;
|
52 |
-
|
53 |
/**
|
54 |
* @var Caption The caption for Image
|
55 |
*/
|
@@ -96,8 +86,6 @@ class Image extends Audible implements Container
|
|
96 |
*/
|
97 |
private function __construct()
|
98 |
{
|
99 |
-
$this->isLikeEnabled = self::$defaultLikeEnabled;
|
100 |
-
$this->isCommentsEnabled = self::$defaultCommentEnabled;
|
101 |
}
|
102 |
|
103 |
/**
|
@@ -396,28 +384,4 @@ class Image extends Audible implements Container
|
|
396 |
|
397 |
return $children;
|
398 |
}
|
399 |
-
|
400 |
-
/**
|
401 |
-
* Modify the default setup to enable/disable likes in images
|
402 |
-
*
|
403 |
-
* WARNING this is not Thread-safe, so if you are using pthreads or any other multithreaded engine,
|
404 |
-
* this might not work as expected. (you will need to set this in all working threads manually)
|
405 |
-
* @param boolean $enabled inform true to enable likes on images per default or false to disable like on images.
|
406 |
-
*/
|
407 |
-
public static function setDefaultLikeEnabled($enabled)
|
408 |
-
{
|
409 |
-
self::$defaultLikeEnabled = $enabled;
|
410 |
-
}
|
411 |
-
|
412 |
-
/**
|
413 |
-
* Modify the default setup to enable/disable comments in images
|
414 |
-
*
|
415 |
-
* WARNING this is not Thread-safe, so if you are using pthreads or any other multithreaded engine,
|
416 |
-
* this might not work as expected. (you will need to set this in all working threads manually)
|
417 |
-
* @param boolean $enabled inform true to enable comments on images per default or false to disable commenting on images.
|
418 |
-
*/
|
419 |
-
public static function setDefaultCommentEnabled($enabled)
|
420 |
-
{
|
421 |
-
self::$defaultCommentEnabled = $enabled;
|
422 |
-
}
|
423 |
}
|
40 |
const FULLSCREEN = 'fullscreen';
|
41 |
const NON_INTERACTIVE = 'non-interactive';
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
/**
|
44 |
* @var Caption The caption for Image
|
45 |
*/
|
86 |
*/
|
87 |
private function __construct()
|
88 |
{
|
|
|
|
|
89 |
}
|
90 |
|
91 |
/**
|
384 |
|
385 |
return $children;
|
386 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/InstantArticle.php
CHANGED
@@ -34,7 +34,7 @@ use Facebook\InstantArticles\Validators\Type;
|
|
34 |
|
35 |
class InstantArticle extends Element implements Container, InstantArticleInterface
|
36 |
{
|
37 |
-
const CURRENT_VERSION = '1.
|
38 |
|
39 |
/**
|
40 |
* The meta properties that are used on <head>
|
@@ -81,11 +81,6 @@ class InstantArticle extends Element implements Container, InstantArticleInterfa
|
|
81 |
*/
|
82 |
private $children = [];
|
83 |
|
84 |
-
/**
|
85 |
-
* @var boolean flag that indicates if this article is Right-to-left(RTL). Defaults to false.
|
86 |
-
*/
|
87 |
-
private $isRTLEnabled = false;
|
88 |
-
|
89 |
/**
|
90 |
* Factory method
|
91 |
* @return InstantArticle object.
|
@@ -170,24 +165,6 @@ class InstantArticle extends Element implements Container, InstantArticleInterfa
|
|
170 |
return $this;
|
171 |
}
|
172 |
|
173 |
-
/**
|
174 |
-
* Updates article to use RTL orientation.
|
175 |
-
*/
|
176 |
-
public function enableRTL()
|
177 |
-
{
|
178 |
-
$this->isRTLEnabled = true;
|
179 |
-
return $this;
|
180 |
-
}
|
181 |
-
|
182 |
-
/**
|
183 |
-
* Updates article to use LTR orientation (default), disabling RTL.
|
184 |
-
*/
|
185 |
-
public function disableRTL()
|
186 |
-
{
|
187 |
-
$this->isRTLEnabled = false;
|
188 |
-
return $this;
|
189 |
-
}
|
190 |
-
|
191 |
/**
|
192 |
* Sets the header content to this InstantArticle
|
193 |
*
|
@@ -218,64 +195,6 @@ class InstantArticle extends Element implements Container, InstantArticleInterfa
|
|
218 |
return $this;
|
219 |
}
|
220 |
|
221 |
-
/**
|
222 |
-
* Replace all the children within this InstantArticle
|
223 |
-
*
|
224 |
-
* @param Element[] $children Array of elements replacing the original.
|
225 |
-
*
|
226 |
-
* @return $this
|
227 |
-
*/
|
228 |
-
public function withChildren($children)
|
229 |
-
{
|
230 |
-
Type::enforceArrayOf(
|
231 |
-
$children,
|
232 |
-
[
|
233 |
-
Ad::getClassName(),
|
234 |
-
Analytics::getClassName(),
|
235 |
-
AnimatedGIF::getClassName(),
|
236 |
-
Audio::getClassName(),
|
237 |
-
Blockquote::getClassName(),
|
238 |
-
Image::getClassName(),
|
239 |
-
H1::getClassName(),
|
240 |
-
H2::getClassName(),
|
241 |
-
Interactive::getClassName(),
|
242 |
-
ListElement::getClassName(),
|
243 |
-
Map::getClassName(),
|
244 |
-
Paragraph::getClassName(),
|
245 |
-
Pullquote::getClassName(),
|
246 |
-
RelatedArticles::getClassName(),
|
247 |
-
Slideshow::getClassName(),
|
248 |
-
SocialEmbed::getClassName(),
|
249 |
-
Video::getClassName()
|
250 |
-
]
|
251 |
-
);
|
252 |
-
$this->children = $children;
|
253 |
-
|
254 |
-
return $this;
|
255 |
-
}
|
256 |
-
|
257 |
-
/**
|
258 |
-
* Replace all the children within this InstantArticle
|
259 |
-
*
|
260 |
-
* @param Type::INTEGER $index The index of the element to be deleted
|
261 |
-
* in the array of children.
|
262 |
-
*
|
263 |
-
* @return $this
|
264 |
-
*/
|
265 |
-
public function deleteChild($index)
|
266 |
-
{
|
267 |
-
Type::enforce($index, Type::INTEGER);
|
268 |
-
$children = [];
|
269 |
-
foreach ($this->children as $childIndex => $child) {
|
270 |
-
if ($childIndex != $index) {
|
271 |
-
$children[] = $child;
|
272 |
-
}
|
273 |
-
}
|
274 |
-
$this->children = $children;
|
275 |
-
|
276 |
-
return $this;
|
277 |
-
}
|
278 |
-
|
279 |
/**
|
280 |
* Adds new child elements to this InstantArticle
|
281 |
*
|
@@ -312,50 +231,6 @@ class InstantArticle extends Element implements Container, InstantArticleInterfa
|
|
312 |
return $this;
|
313 |
}
|
314 |
|
315 |
-
/**
|
316 |
-
* Adds new child elements to the front of this InstantArticle
|
317 |
-
*
|
318 |
-
* @param Element to be added to this Article.
|
319 |
-
*
|
320 |
-
* @return $this
|
321 |
-
*/
|
322 |
-
public function unshiftChild($child)
|
323 |
-
{
|
324 |
-
Type::enforce(
|
325 |
-
$child,
|
326 |
-
[
|
327 |
-
Ad::getClassName(),
|
328 |
-
Analytics::getClassName(),
|
329 |
-
AnimatedGIF::getClassName(),
|
330 |
-
Audio::getClassName(),
|
331 |
-
Blockquote::getClassName(),
|
332 |
-
Image::getClassName(),
|
333 |
-
H1::getClassName(),
|
334 |
-
H2::getClassName(),
|
335 |
-
Interactive::getClassName(),
|
336 |
-
ListElement::getClassName(),
|
337 |
-
Map::getClassName(),
|
338 |
-
Paragraph::getClassName(),
|
339 |
-
Pullquote::getClassName(),
|
340 |
-
RelatedArticles::getClassName(),
|
341 |
-
Slideshow::getClassName(),
|
342 |
-
SocialEmbed::getClassName(),
|
343 |
-
Video::getClassName()
|
344 |
-
]
|
345 |
-
);
|
346 |
-
array_unshift($this->children, $child);
|
347 |
-
|
348 |
-
return $this;
|
349 |
-
}
|
350 |
-
|
351 |
-
/**
|
352 |
-
* @return string canonicalURL from the InstantArticle
|
353 |
-
*/
|
354 |
-
public function getCanonicalURL()
|
355 |
-
{
|
356 |
-
return $this->canonicalURL;
|
357 |
-
}
|
358 |
-
|
359 |
/**
|
360 |
* @return Header header element from the InstantArticle
|
361 |
*/
|
@@ -407,9 +282,6 @@ class InstantArticle extends Element implements Container, InstantArticleInterfa
|
|
407 |
|
408 |
// Builds and appends head to the HTML document
|
409 |
$html = $document->createElement('html');
|
410 |
-
if ($this->isRTLEnabled) {
|
411 |
-
$html->setAttribute('dir', 'rtl');
|
412 |
-
}
|
413 |
$head = $document->createElement('head');
|
414 |
$html->appendChild($head);
|
415 |
|
34 |
|
35 |
class InstantArticle extends Element implements Container, InstantArticleInterface
|
36 |
{
|
37 |
+
const CURRENT_VERSION = '1.3.0';
|
38 |
|
39 |
/**
|
40 |
* The meta properties that are used on <head>
|
81 |
*/
|
82 |
private $children = [];
|
83 |
|
|
|
|
|
|
|
|
|
|
|
84 |
/**
|
85 |
* Factory method
|
86 |
* @return InstantArticle object.
|
165 |
return $this;
|
166 |
}
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
/**
|
169 |
* Sets the header content to this InstantArticle
|
170 |
*
|
195 |
return $this;
|
196 |
}
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
/**
|
199 |
* Adds new child elements to this InstantArticle
|
200 |
*
|
231 |
return $this;
|
232 |
}
|
233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
/**
|
235 |
* @return Header header element from the InstantArticle
|
236 |
*/
|
282 |
|
283 |
// Builds and appends head to the HTML document
|
284 |
$html = $document->createElement('html');
|
|
|
|
|
|
|
285 |
$head = $document->createElement('head');
|
286 |
$html->appendChild($head);
|
287 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Interactive.php
CHANGED
@@ -250,7 +250,7 @@ class Interactive extends ElementWithHTML implements Container
|
|
250 |
*/
|
251 |
public function isValid()
|
252 |
{
|
253 |
-
return
|
254 |
}
|
255 |
|
256 |
/**
|
250 |
*/
|
251 |
public function isValid()
|
252 |
{
|
253 |
+
return !Type::isTextEmpty($this->source) || $this->html;
|
254 |
}
|
255 |
|
256 |
/**
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Elements/Video.php
CHANGED
@@ -44,16 +44,6 @@ class Video extends Element implements Container
|
|
44 |
const LOOP = 'loop';
|
45 |
const DATA_FADE = 'data-fade';
|
46 |
|
47 |
-
/**
|
48 |
-
* @var boolean marks if any created image will have likes enabled by default
|
49 |
-
*/
|
50 |
-
private static $defaultLikeEnabled = false;
|
51 |
-
|
52 |
-
/**
|
53 |
-
* @var boolean marks if any created image will have comments enabled by default
|
54 |
-
*/
|
55 |
-
private static $defaultCommentEnabled = false;
|
56 |
-
|
57 |
/**
|
58 |
* @var Caption The caption for Video
|
59 |
*/
|
@@ -124,8 +114,6 @@ class Video extends Element implements Container
|
|
124 |
|
125 |
private function __construct()
|
126 |
{
|
127 |
-
$this->isLikeEnabled = self::$defaultLikeEnabled;
|
128 |
-
$this->isCommentsEnabled = self::$defaultCommentEnabled;
|
129 |
}
|
130 |
|
131 |
/**
|
@@ -445,31 +433,6 @@ class Video extends Element implements Container
|
|
445 |
return $this->geoTag;
|
446 |
}
|
447 |
|
448 |
-
/**
|
449 |
-
* Modify the default setup to enable/disable likes in videos
|
450 |
-
*
|
451 |
-
* WARNING this is not Thread-safe, so if you are using pthreads or any other multithreaded engine,
|
452 |
-
* this might not work as expected. (you will need to set this in all working threads manually)
|
453 |
-
* @param boolean $enabled inform true to enable likes on videos per default or false to disable like on videos.
|
454 |
-
*/
|
455 |
-
public static function setDefaultLikeEnabled($enabled)
|
456 |
-
{
|
457 |
-
self::$defaultLikeEnabled = $enabled;
|
458 |
-
}
|
459 |
-
|
460 |
-
/**
|
461 |
-
* Modify the default setup to enable/disable comments in videos
|
462 |
-
*
|
463 |
-
* WARNING this is not Thread-safe, so if you are using pthreads or any other multithreaded engine,
|
464 |
-
* this might not work as expected. (you will need to set this in all working threads manually)
|
465 |
-
* @param boolean $enabled inform true to enable comments on videos per default or false to disable commenting on videos.
|
466 |
-
*/
|
467 |
-
public static function setDefaultCommentEnabled($enabled)
|
468 |
-
{
|
469 |
-
self::$defaultCommentEnabled = $enabled;
|
470 |
-
}
|
471 |
-
|
472 |
-
|
473 |
/**
|
474 |
* Structure and create the full Video in a XML format DOMElement.
|
475 |
*
|
44 |
const LOOP = 'loop';
|
45 |
const DATA_FADE = 'data-fade';
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
/**
|
48 |
* @var Caption The caption for Video
|
49 |
*/
|
114 |
|
115 |
private function __construct()
|
116 |
{
|
|
|
|
|
117 |
}
|
118 |
|
119 |
/**
|
433 |
return $this->geoTag;
|
434 |
}
|
435 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
436 |
/**
|
437 |
* Structure and create the full Video in a XML format DOMElement.
|
438 |
*
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Parser/instant-articles-rules.json
CHANGED
@@ -146,7 +146,14 @@
|
|
146 |
},
|
147 |
{
|
148 |
"class": "FooterRelatedArticlesRule",
|
149 |
-
"selector" : "ul.op-related-articles"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
},
|
151 |
{
|
152 |
"class": "RelatedItemRule",
|
@@ -206,30 +213,24 @@
|
|
206 |
{
|
207 |
"class": "TimeRule",
|
208 |
"selector" : "time.op-modified",
|
|
|
209 |
"properties" : {
|
210 |
"article.time" : {
|
211 |
"type" : "string",
|
212 |
"selector" : "time",
|
213 |
"attribute": "datetime"
|
214 |
-
},
|
215 |
-
"article.datetype": {
|
216 |
-
"type": "constant",
|
217 |
-
"value": "op-modified"
|
218 |
}
|
219 |
}
|
220 |
},
|
221 |
{
|
222 |
"class": "TimeRule",
|
223 |
"selector" : "time.op-published",
|
|
|
224 |
"properties" : {
|
225 |
"article.time" : {
|
226 |
"type" : "string",
|
227 |
"selector" : "time",
|
228 |
"attribute": "datetime"
|
229 |
-
},
|
230 |
-
"article.datetype": {
|
231 |
-
"type": "constant",
|
232 |
-
"value": "op-published"
|
233 |
}
|
234 |
}
|
235 |
},
|
@@ -443,22 +444,6 @@
|
|
443 |
"selector" : "figure[data-feedback*='fb:likes']",
|
444 |
"attribute": "data-feedback"
|
445 |
},
|
446 |
-
"aspect-fit": {
|
447 |
-
"type": "exists",
|
448 |
-
"selector" : "figure[data-mode=aspect-fit]"
|
449 |
-
},
|
450 |
-
"aspect-fit-only": {
|
451 |
-
"type": "exists",
|
452 |
-
"selector" : "figure[data-mode=aspect-fit-only]"
|
453 |
-
},
|
454 |
-
"fullscreen": {
|
455 |
-
"type": "exists",
|
456 |
-
"selector" : "figure[data-mode=fullscreen]"
|
457 |
-
},
|
458 |
-
"non-interactive": {
|
459 |
-
"type": "exists",
|
460 |
-
"selector" : "figure[data-mode=non-interactive]"
|
461 |
-
},
|
462 |
"image.comments" : {
|
463 |
"type" : "exists",
|
464 |
"selector" : "figure[data-feedback*='fb:comments']",
|
146 |
},
|
147 |
{
|
148 |
"class": "FooterRelatedArticlesRule",
|
149 |
+
"selector" : "ul.op-related-articles",
|
150 |
+
"properties" : {
|
151 |
+
"related.title" : {
|
152 |
+
"type" : "string",
|
153 |
+
"selector" : "ul.op-related-articles",
|
154 |
+
"attribute": "title"
|
155 |
+
}
|
156 |
+
}
|
157 |
},
|
158 |
{
|
159 |
"class": "RelatedItemRule",
|
213 |
{
|
214 |
"class": "TimeRule",
|
215 |
"selector" : "time.op-modified",
|
216 |
+
"article.time_type": "op-modified",
|
217 |
"properties" : {
|
218 |
"article.time" : {
|
219 |
"type" : "string",
|
220 |
"selector" : "time",
|
221 |
"attribute": "datetime"
|
|
|
|
|
|
|
|
|
222 |
}
|
223 |
}
|
224 |
},
|
225 |
{
|
226 |
"class": "TimeRule",
|
227 |
"selector" : "time.op-published",
|
228 |
+
"article.time_type": "op-published",
|
229 |
"properties" : {
|
230 |
"article.time" : {
|
231 |
"type" : "string",
|
232 |
"selector" : "time",
|
233 |
"attribute": "datetime"
|
|
|
|
|
|
|
|
|
234 |
}
|
235 |
}
|
236 |
},
|
444 |
"selector" : "figure[data-feedback*='fb:likes']",
|
445 |
"attribute": "data-feedback"
|
446 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
"image.comments" : {
|
448 |
"type" : "exists",
|
449 |
"selector" : "figure[data-feedback*='fb:comments']",
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ChildrenGetter.php
CHANGED
@@ -8,9 +8,6 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Getters;
|
10 |
|
11 |
-
use Facebook\InstantArticles\Validators\Type;
|
12 |
-
use Facebook\InstantArticles\Transformer\Transformer;
|
13 |
-
|
14 |
class ChildrenGetter extends ElementGetter
|
15 |
{
|
16 |
public function get($node)
|
@@ -19,8 +16,7 @@ class ChildrenGetter extends ElementGetter
|
|
19 |
if ($element) {
|
20 |
$fragment = $element->ownerDocument->createDocumentFragment();
|
21 |
foreach ($element->childNodes as $child) {
|
22 |
-
|
23 |
-
$fragment->appendChild(Transformer::cloneNode($child));
|
24 |
}
|
25 |
if ($fragment->hasChildNodes()) {
|
26 |
return $fragment;
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Getters;
|
10 |
|
|
|
|
|
|
|
11 |
class ChildrenGetter extends ElementGetter
|
12 |
{
|
13 |
public function get($node)
|
16 |
if ($element) {
|
17 |
$fragment = $element->ownerDocument->createDocumentFragment();
|
18 |
foreach ($element->childNodes as $child) {
|
19 |
+
$fragment->appendChild($child->cloneNode(true));
|
|
|
20 |
}
|
21 |
if ($fragment->hasChildNodes()) {
|
22 |
return $fragment;
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ConstantGetter.php
DELETED
@@ -1,42 +0,0 @@
|
|
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\Getters;
|
10 |
-
|
11 |
-
use Facebook\InstantArticles\Validators\Type;
|
12 |
-
|
13 |
-
class ConstantGetter extends AbstractGetter
|
14 |
-
{
|
15 |
-
/**
|
16 |
-
* @var string
|
17 |
-
*/
|
18 |
-
protected $value;
|
19 |
-
|
20 |
-
public function createFrom($properties)
|
21 |
-
{
|
22 |
-
return $this->withValue($properties['value']);
|
23 |
-
}
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @param string $value
|
27 |
-
*
|
28 |
-
* @return $this
|
29 |
-
*/
|
30 |
-
public function withValue($value)
|
31 |
-
{
|
32 |
-
Type::enforce($value, Type::STRING);
|
33 |
-
$this->value = $value;
|
34 |
-
|
35 |
-
return $this;
|
36 |
-
}
|
37 |
-
|
38 |
-
public function get($node)
|
39 |
-
{
|
40 |
-
return $this->value;
|
41 |
-
}
|
42 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/ElementGetter.php
CHANGED
@@ -9,7 +9,6 @@
|
|
9 |
namespace Facebook\InstantArticles\Transformer\Getters;
|
10 |
|
11 |
use Facebook\InstantArticles\Validators\Type;
|
12 |
-
use Facebook\InstantArticles\Transformer\Transformer;
|
13 |
use Symfony\Component\CssSelector\CssSelectorConverter;
|
14 |
|
15 |
class ElementGetter extends AbstractGetter
|
@@ -26,14 +25,14 @@ class ElementGetter extends AbstractGetter
|
|
26 |
|
27 |
/**
|
28 |
* @param \DOMNode $node
|
29 |
-
*
|
30 |
* @return \DOMNodeList
|
31 |
*/
|
32 |
-
public function findAll($node
|
33 |
{
|
34 |
$domXPath = new \DOMXPath($node->ownerDocument);
|
35 |
$converter = new CssSelectorConverter();
|
36 |
-
$xpath = $converter->toXPath($selector);
|
37 |
return $domXPath->query($xpath, $node);
|
38 |
}
|
39 |
|
@@ -53,9 +52,8 @@ class ElementGetter extends AbstractGetter
|
|
53 |
public function get($node)
|
54 |
{
|
55 |
$elements = self::findAll($node, $this->selector);
|
56 |
-
if (!empty($elements)
|
57 |
-
|
58 |
-
return Transformer::cloneNode($elements->item(0));
|
59 |
}
|
60 |
return null;
|
61 |
}
|
9 |
namespace Facebook\InstantArticles\Transformer\Getters;
|
10 |
|
11 |
use Facebook\InstantArticles\Validators\Type;
|
|
|
12 |
use Symfony\Component\CssSelector\CssSelectorConverter;
|
13 |
|
14 |
class ElementGetter extends AbstractGetter
|
25 |
|
26 |
/**
|
27 |
* @param \DOMNode $node
|
28 |
+
*
|
29 |
* @return \DOMNodeList
|
30 |
*/
|
31 |
+
public function findAll($node)
|
32 |
{
|
33 |
$domXPath = new \DOMXPath($node->ownerDocument);
|
34 |
$converter = new CssSelectorConverter();
|
35 |
+
$xpath = $converter->toXPath($this->selector);
|
36 |
return $domXPath->query($xpath, $node);
|
37 |
}
|
38 |
|
52 |
public function get($node)
|
53 |
{
|
54 |
$elements = self::findAll($node, $this->selector);
|
55 |
+
if (!empty($elements)) {
|
56 |
+
return $elements->item(0);
|
|
|
57 |
}
|
58 |
return null;
|
59 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/FragmentGetter.php
DELETED
@@ -1,49 +0,0 @@
|
|
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\Getters;
|
10 |
-
|
11 |
-
use Facebook\InstantArticles\Validators\Type;
|
12 |
-
use Facebook\InstantArticles\Transformer\Transformer;
|
13 |
-
use Symfony\Component\CssSelector\CssSelectorConverter;
|
14 |
-
|
15 |
-
class FragmentGetter extends AbstractGetter
|
16 |
-
{
|
17 |
-
/**
|
18 |
-
* @var string
|
19 |
-
*/
|
20 |
-
protected $fragment;
|
21 |
-
|
22 |
-
public function createFrom($properties)
|
23 |
-
{
|
24 |
-
return $this->withFragment($properties['fragment']);
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @param string $fragment
|
29 |
-
*
|
30 |
-
* @return $this
|
31 |
-
*/
|
32 |
-
public function withFragment($fragment)
|
33 |
-
{
|
34 |
-
Type::enforce($fragment, Type::STRING);
|
35 |
-
$this->fragment = $fragment;
|
36 |
-
|
37 |
-
return $this;
|
38 |
-
}
|
39 |
-
|
40 |
-
public function get($node)
|
41 |
-
{
|
42 |
-
$fragment = $node->ownerDocument->createDocumentFragment();
|
43 |
-
$is_valid_markup = @$fragment->appendXML($this->fragment);
|
44 |
-
if ($is_valid_markup) {
|
45 |
-
return $fragment;
|
46 |
-
}
|
47 |
-
return null;
|
48 |
-
}
|
49 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/GetterFactory.php
CHANGED
@@ -14,14 +14,9 @@ class GetterFactory
|
|
14 |
const TYPE_INTEGER_GETTER = 'int';
|
15 |
const TYPE_CHILDREN_GETTER = 'children';
|
16 |
const TYPE_ELEMENT_GETTER = 'element';
|
17 |
-
const TYPE_CONSTANT_GETTER = 'constant';
|
18 |
-
const TYPE_FRAGMENT_GETTER = 'fragment';
|
19 |
const TYPE_NEXTSIBLING_GETTER = 'sibling';
|
20 |
-
const TYPE_NEXTSIBLINGELEMENT_GETTER = 'next-sibling-element-of';
|
21 |
const TYPE_EXISTS_GETTER = 'exists';
|
22 |
-
const TYPE_JSON_GETTER = 'json';
|
23 |
const TYPE_XPATH_GETTER = 'xpath';
|
24 |
-
const TYPE_MULTIPLEELEMENTS_GETTER = 'multiple';
|
25 |
|
26 |
/**
|
27 |
* Creates an Getter class.
|
@@ -35,10 +30,8 @@ class GetterFactory
|
|
35 |
* @see ChildrenGetter
|
36 |
* @see IntegerGetter
|
37 |
* @see ElementGetter
|
38 |
-
* @see ConstantGetter
|
39 |
* @see NextSiblingGetter
|
40 |
* @see ExistsGetter
|
41 |
-
* @see JSONGetter
|
42 |
* @see XpathGetter
|
43 |
*
|
44 |
* @param string[] $getter_configuration that maps the properties for getter
|
@@ -52,14 +45,9 @@ class GetterFactory
|
|
52 |
self::TYPE_INTEGER_GETTER => IntegerGetter::getClassName(),
|
53 |
self::TYPE_CHILDREN_GETTER => ChildrenGetter::getClassName(),
|
54 |
self::TYPE_ELEMENT_GETTER => ElementGetter::getClassName(),
|
55 |
-
self::TYPE_FRAGMENT_GETTER => FragmentGetter::getClassName(),
|
56 |
-
self::TYPE_CONSTANT_GETTER => ConstantGetter::getClassName(),
|
57 |
self::TYPE_NEXTSIBLING_GETTER => NextSiblingGetter::getClassName(),
|
58 |
-
self::TYPE_NEXTSIBLINGELEMENT_GETTER => NextSiblingElementGetter::getClassName(),
|
59 |
self::TYPE_EXISTS_GETTER => ExistsGetter::getClassName(),
|
60 |
-
self::
|
61 |
-
self::TYPE_XPATH_GETTER => XpathGetter::getClassName(),
|
62 |
-
self::TYPE_MULTIPLEELEMENTS_GETTER => MultipleElementsGetter::getClassName()
|
63 |
];
|
64 |
|
65 |
$class = $getter_configuration['type'];
|
14 |
const TYPE_INTEGER_GETTER = 'int';
|
15 |
const TYPE_CHILDREN_GETTER = 'children';
|
16 |
const TYPE_ELEMENT_GETTER = 'element';
|
|
|
|
|
17 |
const TYPE_NEXTSIBLING_GETTER = 'sibling';
|
|
|
18 |
const TYPE_EXISTS_GETTER = 'exists';
|
|
|
19 |
const TYPE_XPATH_GETTER = 'xpath';
|
|
|
20 |
|
21 |
/**
|
22 |
* Creates an Getter class.
|
30 |
* @see ChildrenGetter
|
31 |
* @see IntegerGetter
|
32 |
* @see ElementGetter
|
|
|
33 |
* @see NextSiblingGetter
|
34 |
* @see ExistsGetter
|
|
|
35 |
* @see XpathGetter
|
36 |
*
|
37 |
* @param string[] $getter_configuration that maps the properties for getter
|
45 |
self::TYPE_INTEGER_GETTER => IntegerGetter::getClassName(),
|
46 |
self::TYPE_CHILDREN_GETTER => ChildrenGetter::getClassName(),
|
47 |
self::TYPE_ELEMENT_GETTER => ElementGetter::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'];
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/JSONGetter.php
DELETED
@@ -1,63 +0,0 @@
|
|
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\Getters;
|
10 |
-
|
11 |
-
use Facebook\InstantArticles\Validators\Type;
|
12 |
-
|
13 |
-
class JSONGetter extends ChildrenGetter
|
14 |
-
{
|
15 |
-
/**
|
16 |
-
* @var string
|
17 |
-
*/
|
18 |
-
protected $attribute;
|
19 |
-
|
20 |
-
public function createFrom($properties)
|
21 |
-
{
|
22 |
-
if (isset($properties['selector'])) {
|
23 |
-
$this->withSelector($properties['selector']);
|
24 |
-
}
|
25 |
-
if (isset($properties['attribute'])) {
|
26 |
-
$this->withAttribute($properties['attribute']);
|
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);
|
38 |
-
$this->attribute = $attribute;
|
39 |
-
|
40 |
-
return $this;
|
41 |
-
}
|
42 |
-
|
43 |
-
public function get($node)
|
44 |
-
{
|
45 |
-
$content = null;
|
46 |
-
|
47 |
-
Type::enforce($node, 'DOMNode');
|
48 |
-
$elements = self::findAll($node, $this->selector);
|
49 |
-
if (!empty($elements) && $elements->item(0)) {
|
50 |
-
$element = $elements->item(0);
|
51 |
-
if ($this->attribute) {
|
52 |
-
$content = $element->getAttribute($this->attribute);
|
53 |
-
} else {
|
54 |
-
$content = $element->textContent;
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
if (!Type::isTextEmpty($content)) {
|
59 |
-
return json_decode($content, true);
|
60 |
-
}
|
61 |
-
return null;
|
62 |
-
}
|
63 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/MultipleElementsGetter.php
DELETED
@@ -1,44 +0,0 @@
|
|
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\Getters;
|
10 |
-
|
11 |
-
use Facebook\InstantArticles\Validators\Type;
|
12 |
-
use Facebook\InstantArticles\Transformer\Transformer;
|
13 |
-
use Symfony\Component\CssSelector\CssSelectorConverter;
|
14 |
-
|
15 |
-
class MultipleElementsGetter extends AbstractGetter
|
16 |
-
{
|
17 |
-
/**
|
18 |
-
* @var Getters
|
19 |
-
*/
|
20 |
-
protected $children = [];
|
21 |
-
|
22 |
-
public function createFrom($properties)
|
23 |
-
{
|
24 |
-
foreach ($properties['children'] as $getter_configuration) {
|
25 |
-
$this->children[] = GetterFactory::create($getter_configuration);
|
26 |
-
}
|
27 |
-
return $this;
|
28 |
-
}
|
29 |
-
|
30 |
-
public function get($node)
|
31 |
-
{
|
32 |
-
$fragment = $node->ownerDocument->createDocumentFragment();
|
33 |
-
foreach ($this->children as $child) {
|
34 |
-
$cloned_node = $child->get($node);
|
35 |
-
if (Type::is($cloned_node, 'DOMNode')) {
|
36 |
-
$fragment->appendChild($cloned_node);
|
37 |
-
}
|
38 |
-
}
|
39 |
-
if ($fragment->hasChildNodes()) {
|
40 |
-
return $fragment;
|
41 |
-
}
|
42 |
-
return null;
|
43 |
-
}
|
44 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/NextSiblingElementGetter.php
DELETED
@@ -1,75 +0,0 @@
|
|
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\Getters;
|
10 |
-
|
11 |
-
use Facebook\InstantArticles\Validators\Type;
|
12 |
-
use Facebook\InstantArticles\Transformer\Transformer;
|
13 |
-
use Facebook\InstantArticles\Transformer\Warnings\InvalidSelector;
|
14 |
-
|
15 |
-
class NextSiblingElementGetter extends ElementGetter
|
16 |
-
{
|
17 |
-
protected $siblingSelector;
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @param string $siblingSelector
|
21 |
-
*
|
22 |
-
* @return $this
|
23 |
-
*/
|
24 |
-
public function withSiblingSelector($siblingSelector)
|
25 |
-
{
|
26 |
-
Type::enforce($siblingSelector, Type::STRING);
|
27 |
-
$this->siblingSelector = $siblingSelector;
|
28 |
-
|
29 |
-
return $this;
|
30 |
-
}
|
31 |
-
|
32 |
-
public function createFrom($properties)
|
33 |
-
{
|
34 |
-
if (isset($properties['selector'])) {
|
35 |
-
$this->withSelector($properties['selector']);
|
36 |
-
}
|
37 |
-
if (isset($properties['attribute'])) {
|
38 |
-
$this->withAttribute($properties['attribute']);
|
39 |
-
}
|
40 |
-
if (isset($properties['sibling.selector'])) {
|
41 |
-
$this->withSiblingSelector($properties['sibling.selector']);
|
42 |
-
}
|
43 |
-
|
44 |
-
return $this;
|
45 |
-
}
|
46 |
-
|
47 |
-
public function get($node)
|
48 |
-
{
|
49 |
-
Type::enforce($node, 'DOMNode');
|
50 |
-
$elements = self::findAll($node, $this->selector);
|
51 |
-
if (!empty($elements) && $elements->item(0)) {
|
52 |
-
$element = $elements->item(0);
|
53 |
-
do {
|
54 |
-
$element = $element->nextSibling;
|
55 |
-
} while ($element !== null && !Type::is($element, 'DOMElement'));
|
56 |
-
|
57 |
-
if ($element && Type::is($element, 'DOMElement')) {
|
58 |
-
if ($this->siblingSelector) {
|
59 |
-
$siblings = self::findAll($element, $this->siblingSelector);
|
60 |
-
if (!empty($siblings) && $siblings->item(0)) {
|
61 |
-
$siblingElement = $siblings->item(0);
|
62 |
-
} else {
|
63 |
-
// Returns null because sibling content doesn't match
|
64 |
-
return null;
|
65 |
-
}
|
66 |
-
} else {
|
67 |
-
$siblingElement = $element;
|
68 |
-
}
|
69 |
-
Transformer::markAsProcessed($siblingElement);
|
70 |
-
return Transformer::cloneNode($siblingElement);
|
71 |
-
}
|
72 |
-
}
|
73 |
-
return null;
|
74 |
-
}
|
75 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Getters/StringGetter.php
CHANGED
@@ -17,16 +17,6 @@ class StringGetter extends ChildrenGetter
|
|
17 |
*/
|
18 |
protected $attribute;
|
19 |
|
20 |
-
/**
|
21 |
-
* @var string
|
22 |
-
*/
|
23 |
-
protected $prefix;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @var string
|
27 |
-
*/
|
28 |
-
protected $suffix;
|
29 |
-
|
30 |
public function createFrom($properties)
|
31 |
{
|
32 |
if (isset($properties['selector'])) {
|
@@ -35,12 +25,6 @@ class StringGetter extends ChildrenGetter
|
|
35 |
if (isset($properties['attribute'])) {
|
36 |
$this->withAttribute($properties['attribute']);
|
37 |
}
|
38 |
-
if (isset($properties['prefix'])) {
|
39 |
-
$this->withPrefix($properties['prefix']);
|
40 |
-
}
|
41 |
-
if (isset($properties['suffix'])) {
|
42 |
-
$this->withSuffix($properties['suffix']);
|
43 |
-
}
|
44 |
}
|
45 |
|
46 |
/**
|
@@ -56,32 +40,6 @@ class StringGetter extends ChildrenGetter
|
|
56 |
return $this;
|
57 |
}
|
58 |
|
59 |
-
/**
|
60 |
-
* @param string $prefix
|
61 |
-
*
|
62 |
-
* @return $this
|
63 |
-
*/
|
64 |
-
public function withPrefix($prefix)
|
65 |
-
{
|
66 |
-
Type::enforce($prefix, Type::STRING);
|
67 |
-
$this->prefix = $prefix;
|
68 |
-
|
69 |
-
return $this;
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* @param string $suffix
|
74 |
-
*
|
75 |
-
* @return $this
|
76 |
-
*/
|
77 |
-
public function withSuffix($suffix)
|
78 |
-
{
|
79 |
-
Type::enforce($suffix, Type::STRING);
|
80 |
-
$this->suffix = $suffix;
|
81 |
-
|
82 |
-
return $this;
|
83 |
-
}
|
84 |
-
|
85 |
public function get($node)
|
86 |
{
|
87 |
Type::enforce($node, 'DOMNode');
|
@@ -89,18 +47,9 @@ class StringGetter extends ChildrenGetter
|
|
89 |
if (!empty($elements) && $elements->item(0)) {
|
90 |
$element = $elements->item(0);
|
91 |
if ($this->attribute) {
|
92 |
-
|
93 |
-
} else {
|
94 |
-
$result = $element->textContent;
|
95 |
-
}
|
96 |
-
|
97 |
-
if (!Type::isTextEmpty($this->prefix)) {
|
98 |
-
$result = $this->prefix . $result;
|
99 |
-
}
|
100 |
-
if (!Type::isTextEmpty($this->suffix)) {
|
101 |
-
$result = $result . $this->suffix;
|
102 |
}
|
103 |
-
return $
|
104 |
}
|
105 |
return null;
|
106 |
}
|
17 |
*/
|
18 |
protected $attribute;
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
public function createFrom($properties)
|
21 |
{
|
22 |
if (isset($properties['selector'])) {
|
25 |
if (isset($properties['attribute'])) {
|
26 |
$this->withAttribute($properties['attribute']);
|
27 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
/**
|
40 |
return $this;
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
public function get($node)
|
44 |
{
|
45 |
Type::enforce($node, 'DOMNode');
|
47 |
if (!empty($elements) && $elements->item(0)) {
|
48 |
$element = $elements->item(0);
|
49 |
if ($this->attribute) {
|
50 |
+
return $element->getAttribute($this->attribute);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
+
return $element->textContent;
|
53 |
}
|
54 |
return null;
|
55 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/Compat/JetpackSlideshowRule.php
DELETED
@@ -1,77 +0,0 @@
|
|
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\Compat;
|
10 |
-
|
11 |
-
use Facebook\InstantArticles\Transformer\Rules\ConfigurationSelectorRule;
|
12 |
-
use Facebook\InstantArticles\Validators\Type;
|
13 |
-
use Facebook\InstantArticles\Elements\InstantArticle;
|
14 |
-
use Facebook\InstantArticles\Elements\Image;
|
15 |
-
use Facebook\InstantArticles\Elements\Caption;
|
16 |
-
use Facebook\InstantArticles\Elements\Slideshow;
|
17 |
-
|
18 |
-
class JetpackSlideshowRule extends ConfigurationSelectorRule
|
19 |
-
{
|
20 |
-
const PROPERTY_JETPACK_DATA_GALLERY = 'jetpack.data-gallery';
|
21 |
-
|
22 |
-
public function getContextClass()
|
23 |
-
{
|
24 |
-
return InstantArticle::getClassName();
|
25 |
-
}
|
26 |
-
|
27 |
-
public static function create()
|
28 |
-
{
|
29 |
-
return new JetpackSlideshowRule();
|
30 |
-
}
|
31 |
-
|
32 |
-
public static function createFrom($configuration)
|
33 |
-
{
|
34 |
-
$slideshow_rule = self::create();
|
35 |
-
$slideshow_rule->withSelector($configuration['selector']);
|
36 |
-
|
37 |
-
$slideshow_rule->withProperties(
|
38 |
-
[
|
39 |
-
self::PROPERTY_JETPACK_DATA_GALLERY
|
40 |
-
],
|
41 |
-
$configuration
|
42 |
-
);
|
43 |
-
|
44 |
-
return $slideshow_rule;
|
45 |
-
}
|
46 |
-
|
47 |
-
public function apply($transformer, $instant_article, $node)
|
48 |
-
{
|
49 |
-
// Builds the slideshow
|
50 |
-
$slideshow = Slideshow::create();
|
51 |
-
$instant_article->addChild($slideshow);
|
52 |
-
|
53 |
-
$gallery = $this->getProperty(self::PROPERTY_JETPACK_DATA_GALLERY, $node);
|
54 |
-
|
55 |
-
if ($gallery && isset($gallery)) {
|
56 |
-
foreach ($gallery as $gallery_image) {
|
57 |
-
// Constructs Image if it contains URL
|
58 |
-
if (!Type::isTextEmpty($gallery_image['src'])) {
|
59 |
-
$image = Image::create();
|
60 |
-
$image->withURL($gallery_image['src']);
|
61 |
-
|
62 |
-
// Constructs Caption element when present in the JSON
|
63 |
-
if (!Type::isTextEmpty($gallery_image['caption'])) {
|
64 |
-
$caption = Caption::create();
|
65 |
-
$caption->appendText($gallery_image['caption']);
|
66 |
-
$image->withCaption($caption);
|
67 |
-
}
|
68 |
-
$slideshow->addImage($image);
|
69 |
-
}
|
70 |
-
}
|
71 |
-
}
|
72 |
-
|
73 |
-
$transformer->transform($slideshow, $node);
|
74 |
-
|
75 |
-
return $instant_article;
|
76 |
-
}
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ConfigurationSelectorRule.php
CHANGED
@@ -130,7 +130,7 @@ abstract class ConfigurationSelectorRule extends Rule
|
|
130 |
}
|
131 |
}
|
132 |
}
|
133 |
-
|
134 |
return false;
|
135 |
}
|
136 |
|
130 |
}
|
131 |
}
|
132 |
}
|
133 |
+
|
134 |
return false;
|
135 |
}
|
136 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/FooterRelatedArticlesRule.php
CHANGED
@@ -13,6 +13,8 @@ use Facebook\InstantArticles\Elements\Footer;
|
|
13 |
|
14 |
class FooterRelatedArticlesRule extends ConfigurationSelectorRule
|
15 |
{
|
|
|
|
|
16 |
public function getContextClass()
|
17 |
{
|
18 |
return Footer::getClassName();
|
@@ -28,13 +30,24 @@ class FooterRelatedArticlesRule extends ConfigurationSelectorRule
|
|
28 |
$related_articles_rule = self::create();
|
29 |
$related_articles_rule->withSelector($configuration['selector']);
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
return $related_articles_rule;
|
32 |
}
|
33 |
|
34 |
public function apply($transformer, $footer, $node)
|
35 |
{
|
36 |
$related_articles = RelatedArticles::create();
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
$transformer->transform($related_articles, $node);
|
40 |
|
13 |
|
14 |
class FooterRelatedArticlesRule extends ConfigurationSelectorRule
|
15 |
{
|
16 |
+
const PROPERTY_TITLE = 'related.title';
|
17 |
+
|
18 |
public function getContextClass()
|
19 |
{
|
20 |
return Footer::getClassName();
|
30 |
$related_articles_rule = self::create();
|
31 |
$related_articles_rule->withSelector($configuration['selector']);
|
32 |
|
33 |
+
$related_articles_rule->withProperty(
|
34 |
+
self::PROPERTY_TITLE,
|
35 |
+
self::retrieveProperty($configuration, self::PROPERTY_TITLE)
|
36 |
+
);
|
37 |
+
|
38 |
return $related_articles_rule;
|
39 |
}
|
40 |
|
41 |
public function apply($transformer, $footer, $node)
|
42 |
{
|
43 |
$related_articles = RelatedArticles::create();
|
44 |
+
|
45 |
+
// Builds the image
|
46 |
+
$title = $this->getProperty(self::PROPERTY_TITLE, $node);
|
47 |
+
if ($title) {
|
48 |
+
$related_articles->withTitle($title);
|
49 |
+
$footer->withRelatedArticles($related_articles);
|
50 |
+
}
|
51 |
|
52 |
$transformer->transform($related_articles, $node);
|
53 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H1Rule.php
CHANGED
@@ -11,7 +11,7 @@ namespace Facebook\InstantArticles\Transformer\Rules;
|
|
11 |
use Facebook\InstantArticles\Elements\Header;
|
12 |
use Facebook\InstantArticles\Elements\Caption;
|
13 |
use Facebook\InstantArticles\Elements\H1;
|
14 |
-
use Facebook\InstantArticles\Elements\
|
15 |
use Facebook\InstantArticles\Validators\Type;
|
16 |
|
17 |
class H1Rule extends ConfigurationSelectorRule
|
11 |
use Facebook\InstantArticles\Elements\Header;
|
12 |
use Facebook\InstantArticles\Elements\Caption;
|
13 |
use Facebook\InstantArticles\Elements\H1;
|
14 |
+
use Facebook\InstantArticles\Elements\Instantarticle;
|
15 |
use Facebook\InstantArticles\Validators\Type;
|
16 |
|
17 |
class H1Rule extends ConfigurationSelectorRule
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/H2Rule.php
CHANGED
@@ -11,7 +11,7 @@ namespace Facebook\InstantArticles\Transformer\Rules;
|
|
11 |
use Facebook\InstantArticles\Elements\Header;
|
12 |
use Facebook\InstantArticles\Elements\Caption;
|
13 |
use Facebook\InstantArticles\Elements\H2;
|
14 |
-
use Facebook\InstantArticles\Elements\
|
15 |
use Facebook\InstantArticles\Validators\Type;
|
16 |
|
17 |
class H2Rule extends ConfigurationSelectorRule
|
11 |
use Facebook\InstantArticles\Elements\Header;
|
12 |
use Facebook\InstantArticles\Elements\Caption;
|
13 |
use Facebook\InstantArticles\Elements\H2;
|
14 |
+
use Facebook\InstantArticles\Elements\Instantarticle;
|
15 |
use Facebook\InstantArticles\Validators\Type;
|
16 |
|
17 |
class H2Rule extends ConfigurationSelectorRule
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ImageInsideParagraphRule.php
CHANGED
@@ -8,15 +8,91 @@
|
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
|
|
|
|
11 |
use Facebook\InstantArticles\Elements\Paragraph;
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
* @deprecated ImageRule now works inside Paragraph without a custom rule, use it instead
|
15 |
-
*/
|
16 |
-
class ImageInsideParagraphRule extends ImageRule
|
17 |
{
|
|
|
|
|
|
|
|
|
18 |
public function getContextClass()
|
19 |
{
|
20 |
return Paragraph::getClassName();
|
21 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
}
|
8 |
*/
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
+
use Facebook\InstantArticles\Elements\Image;
|
12 |
+
use Facebook\InstantArticles\Elements\TextContainer;
|
13 |
use Facebook\InstantArticles\Elements\Paragraph;
|
14 |
+
use Facebook\InstantArticles\Transformer\Warnings\InvalidSelector;
|
15 |
+
use Facebook\InstantArticles\Transformer\Warnings\NoRootInstantArticleFoundWarning;
|
16 |
|
17 |
+
class ImageInsideParagraphRule extends ConfigurationSelectorRule
|
|
|
|
|
|
|
18 |
{
|
19 |
+
const PROPERTY_IMAGE_URL = 'image.url';
|
20 |
+
const PROPERTY_LIKE = 'image.like';
|
21 |
+
const PROPERTY_COMMENTS = 'image.comments';
|
22 |
+
|
23 |
public function getContextClass()
|
24 |
{
|
25 |
return Paragraph::getClassName();
|
26 |
}
|
27 |
+
|
28 |
+
public static function create()
|
29 |
+
{
|
30 |
+
return new ImageInsideParagraphRule();
|
31 |
+
}
|
32 |
+
|
33 |
+
public static function createFrom($configuration)
|
34 |
+
{
|
35 |
+
$image_rule = self::create();
|
36 |
+
$image_rule->withSelector($configuration['selector']);
|
37 |
+
|
38 |
+
$image_rule->withProperties(
|
39 |
+
[
|
40 |
+
self::PROPERTY_IMAGE_URL,
|
41 |
+
self::PROPERTY_LIKE,
|
42 |
+
self::PROPERTY_COMMENTS
|
43 |
+
],
|
44 |
+
$configuration
|
45 |
+
);
|
46 |
+
|
47 |
+
return $image_rule;
|
48 |
+
}
|
49 |
+
|
50 |
+
public function apply($transformer, $context, $node)
|
51 |
+
{
|
52 |
+
$image = Image::create();
|
53 |
+
|
54 |
+
// Builds the image
|
55 |
+
$url = $this->getProperty(self::PROPERTY_IMAGE_URL, $node);
|
56 |
+
if ($url) {
|
57 |
+
$image->withURL($url);
|
58 |
+
$instant_article = $transformer->getInstantArticle();
|
59 |
+
if ($instant_article) {
|
60 |
+
$instant_article->addChild($image);
|
61 |
+
$context->disableEmptyValidation();
|
62 |
+
$context = Paragraph::create();
|
63 |
+
$context->disableEmptyValidation();
|
64 |
+
$instant_article->addChild($context);
|
65 |
+
} else {
|
66 |
+
$transformer->addWarning(
|
67 |
+
// This new error message should be something like:
|
68 |
+
// Could not transform Image, as no root InstantArticle was provided.
|
69 |
+
new NoRootInstantArticleFoundWarning(null, $node)
|
70 |
+
);
|
71 |
+
}
|
72 |
+
} else {
|
73 |
+
$transformer->addWarning(
|
74 |
+
new InvalidSelector(
|
75 |
+
self::PROPERTY_IMAGE_URL,
|
76 |
+
$instant_article,
|
77 |
+
$node,
|
78 |
+
$this
|
79 |
+
)
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
if ($this->getProperty(self::PROPERTY_LIKE, $node)) {
|
84 |
+
$image->enableLike();
|
85 |
+
}
|
86 |
+
|
87 |
+
if ($this->getProperty(self::PROPERTY_COMMENTS, $node)) {
|
88 |
+
$image->enableComments();
|
89 |
+
}
|
90 |
+
|
91 |
+
$suppress_warnings = $transformer->suppress_warnings;
|
92 |
+
$transformer->suppress_warnings = true;
|
93 |
+
$transformer->transform($image, $node);
|
94 |
+
$transformer->suppress_warnings = $suppress_warnings;
|
95 |
+
|
96 |
+
return $context;
|
97 |
+
}
|
98 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/ImageRule.php
CHANGED
@@ -9,10 +9,8 @@
|
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
use Facebook\InstantArticles\Elements\Image;
|
12 |
-
use Facebook\InstantArticles\Elements\Paragraph;
|
13 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
14 |
use Facebook\InstantArticles\Transformer\Warnings\InvalidSelector;
|
15 |
-
use Facebook\InstantArticles\Validators\Type;
|
16 |
|
17 |
class ImageRule extends ConfigurationSelectorRule
|
18 |
{
|
@@ -20,39 +18,26 @@ class ImageRule extends ConfigurationSelectorRule
|
|
20 |
const PROPERTY_LIKE = 'image.like';
|
21 |
const PROPERTY_COMMENTS = 'image.comments';
|
22 |
|
23 |
-
const ASPECT_FIT = 'aspect-fit';
|
24 |
-
const ASPECT_FIT_ONLY = 'aspect-fit-only';
|
25 |
-
const FULLSCREEN = 'fullscreen';
|
26 |
-
const NON_INTERACTIVE = 'non-interactive';
|
27 |
-
|
28 |
public function getContextClass()
|
29 |
{
|
30 |
-
return
|
31 |
-
[
|
32 |
-
InstantArticle::getClassName(),
|
33 |
-
Paragraph::getClassName()
|
34 |
-
];
|
35 |
}
|
36 |
|
37 |
public static function create()
|
38 |
{
|
39 |
-
return new
|
40 |
}
|
41 |
|
42 |
public static function createFrom($configuration)
|
43 |
{
|
44 |
-
$image_rule =
|
45 |
$image_rule->withSelector($configuration['selector']);
|
46 |
|
47 |
$image_rule->withProperties(
|
48 |
[
|
49 |
self::PROPERTY_IMAGE_URL,
|
50 |
self::PROPERTY_LIKE,
|
51 |
-
self::PROPERTY_COMMENTS
|
52 |
-
self::ASPECT_FIT,
|
53 |
-
self::ASPECT_FIT_ONLY,
|
54 |
-
self::FULLSCREEN,
|
55 |
-
self::NON_INTERACTIVE
|
56 |
],
|
57 |
$configuration
|
58 |
);
|
@@ -60,34 +45,15 @@ class ImageRule extends ConfigurationSelectorRule
|
|
60 |
return $image_rule;
|
61 |
}
|
62 |
|
63 |
-
public function apply($transformer, $
|
64 |
{
|
65 |
$image = Image::create();
|
66 |
|
67 |
-
if (Type::is($context, InstantArticle::getClassName())) {
|
68 |
-
$instant_article = $context;
|
69 |
-
} elseif ($transformer->getInstantArticle()) {
|
70 |
-
$instant_article = $transformer->getInstantArticle();
|
71 |
-
$context->disableEmptyValidation();
|
72 |
-
$context = Paragraph::create();
|
73 |
-
$context->disableEmptyValidation();
|
74 |
-
} else {
|
75 |
-
$transformer->addWarning(
|
76 |
-
// This new error message should be something like:
|
77 |
-
// Could not transform Image, as no root InstantArticle was provided.
|
78 |
-
new NoRootInstantArticleFoundWarning(null, $node)
|
79 |
-
);
|
80 |
-
return $context;
|
81 |
-
}
|
82 |
-
|
83 |
// Builds the image
|
84 |
$url = $this->getProperty(self::PROPERTY_IMAGE_URL, $node);
|
85 |
if ($url) {
|
86 |
$image->withURL($url);
|
87 |
$instant_article->addChild($image);
|
88 |
-
if ($instant_article !== $context) {
|
89 |
-
$instant_article->addChild($context);
|
90 |
-
}
|
91 |
} else {
|
92 |
$transformer->addWarning(
|
93 |
new InvalidSelector(
|
@@ -99,16 +65,6 @@ class ImageRule extends ConfigurationSelectorRule
|
|
99 |
);
|
100 |
}
|
101 |
|
102 |
-
if ($this->getProperty(Image::ASPECT_FIT, $node)) {
|
103 |
-
$image->withPresentation(Image::ASPECT_FIT);
|
104 |
-
} elseif ($this->getProperty(Image::ASPECT_FIT_ONLY, $node)) {
|
105 |
-
$image->withPresentation(Image::ASPECT_FIT_ONLY);
|
106 |
-
} elseif ($this->getProperty(Image::FULLSCREEN, $node)) {
|
107 |
-
$image->withPresentation(Image::FULLSCREEN);
|
108 |
-
} elseif ($this->getProperty(Image::NON_INTERACTIVE, $node)) {
|
109 |
-
$image->withPresentation(Image::NON_INTERACTIVE);
|
110 |
-
}
|
111 |
-
|
112 |
if ($this->getProperty(self::PROPERTY_LIKE, $node)) {
|
113 |
$image->enableLike();
|
114 |
}
|
@@ -122,6 +78,6 @@ class ImageRule extends ConfigurationSelectorRule
|
|
122 |
$transformer->transform($image, $node);
|
123 |
$transformer->suppress_warnings = $suppress_warnings;
|
124 |
|
125 |
-
return $
|
126 |
}
|
127 |
}
|
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 |
|
15 |
class ImageRule extends ConfigurationSelectorRule
|
16 |
{
|
18 |
const PROPERTY_LIKE = 'image.like';
|
19 |
const PROPERTY_COMMENTS = 'image.comments';
|
20 |
|
|
|
|
|
|
|
|
|
|
|
21 |
public function getContextClass()
|
22 |
{
|
23 |
+
return InstantArticle::getClassName();
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
|
26 |
public static function create()
|
27 |
{
|
28 |
+
return new ImageRule();
|
29 |
}
|
30 |
|
31 |
public static function createFrom($configuration)
|
32 |
{
|
33 |
+
$image_rule = self::create();
|
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 |
);
|
45 |
return $image_rule;
|
46 |
}
|
47 |
|
48 |
+
public function apply($transformer, $instant_article, $node)
|
49 |
{
|
50 |
$image = Image::create();
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
// Builds the image
|
53 |
$url = $this->getProperty(self::PROPERTY_IMAGE_URL, $node);
|
54 |
if ($url) {
|
55 |
$image->withURL($url);
|
56 |
$instant_article->addChild($image);
|
|
|
|
|
|
|
57 |
} else {
|
58 |
$transformer->addWarning(
|
59 |
new InvalidSelector(
|
65 |
);
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
if ($this->getProperty(self::PROPERTY_LIKE, $node)) {
|
69 |
$image->enableLike();
|
70 |
}
|
78 |
$transformer->transform($image, $node);
|
79 |
$transformer->suppress_warnings = $suppress_warnings;
|
80 |
|
81 |
+
return $instant_article;
|
82 |
}
|
83 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InstantArticleRule.php
CHANGED
@@ -44,6 +44,7 @@ class InstantArticleRule extends ConfigurationSelectorRule
|
|
44 |
);
|
45 |
|
46 |
return $canonical_rule;
|
|
|
47 |
}
|
48 |
|
49 |
public function apply($transformer, $instant_article, $node)
|
44 |
);
|
45 |
|
46 |
return $canonical_rule;
|
47 |
+
|
48 |
}
|
49 |
|
50 |
public function apply($transformer, $instant_article, $node)
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InteractiveInsideParagraphRule.php
DELETED
@@ -1,22 +0,0 @@
|
|
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 |
-
use Facebook\InstantArticles\Elements\Paragraph;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @deprecated InteractiveRule now works inside Paragraph without a custom rule, use it instead
|
15 |
-
*/
|
16 |
-
class InteractiveInsideParagraphRule extends InteractiveRule
|
17 |
-
{
|
18 |
-
public function getContextClass()
|
19 |
-
{
|
20 |
-
return Paragraph::getClassName();
|
21 |
-
}
|
22 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/InteractiveRule.php
CHANGED
@@ -9,10 +9,8 @@
|
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
use Facebook\InstantArticles\Elements\Interactive;
|
12 |
-
use Facebook\InstantArticles\Elements\Paragraph;
|
13 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
14 |
use Facebook\InstantArticles\Transformer\Warnings\InvalidSelector;
|
15 |
-
use Facebook\InstantArticles\Validators\Type;
|
16 |
|
17 |
class InteractiveRule extends ConfigurationSelectorRule
|
18 |
{
|
@@ -25,21 +23,17 @@ class InteractiveRule extends ConfigurationSelectorRule
|
|
25 |
|
26 |
public function getContextClass()
|
27 |
{
|
28 |
-
return
|
29 |
-
[
|
30 |
-
InstantArticle::getClassName(),
|
31 |
-
Paragraph::getClassName()
|
32 |
-
];
|
33 |
}
|
34 |
|
35 |
public static function create()
|
36 |
{
|
37 |
-
return new
|
38 |
}
|
39 |
|
40 |
public static function createFrom($configuration)
|
41 |
{
|
42 |
-
$interactive_rule =
|
43 |
$interactive_rule->withSelector($configuration['selector']);
|
44 |
|
45 |
$interactive_rule->withProperties(
|
@@ -57,27 +51,11 @@ class InteractiveRule extends ConfigurationSelectorRule
|
|
57 |
return $interactive_rule;
|
58 |
}
|
59 |
|
60 |
-
public function apply($transformer, $
|
61 |
{
|
62 |
$interactive = Interactive::create();
|
63 |
|
64 |
-
|
65 |
-
$instant_article = $context;
|
66 |
-
} elseif ($transformer->getInstantArticle()) {
|
67 |
-
$instant_article = $transformer->getInstantArticle();
|
68 |
-
$context->disableEmptyValidation();
|
69 |
-
$context = Paragraph::create();
|
70 |
-
$context->disableEmptyValidation();
|
71 |
-
} else {
|
72 |
-
$transformer->addWarning(
|
73 |
-
// This new error message should be something like:
|
74 |
-
// Could not transform Image, as no root InstantArticle was provided.
|
75 |
-
new NoRootInstantArticleFoundWarning(null, $node)
|
76 |
-
);
|
77 |
-
return $context;
|
78 |
-
}
|
79 |
-
|
80 |
-
// Builds the interactive
|
81 |
$iframe = $this->getProperty(self::PROPERTY_IFRAME, $node);
|
82 |
$url = $this->getProperty(self::PROPERTY_URL, $node);
|
83 |
if ($iframe) {
|
@@ -88,9 +66,6 @@ class InteractiveRule extends ConfigurationSelectorRule
|
|
88 |
}
|
89 |
if ($iframe || $url) {
|
90 |
$instant_article->addChild($interactive);
|
91 |
-
if ($instant_article !== $context) {
|
92 |
-
$instant_article->addChild($context);
|
93 |
-
}
|
94 |
} else {
|
95 |
$transformer->addWarning(
|
96 |
new InvalidSelector(
|
@@ -123,6 +98,6 @@ class InteractiveRule extends ConfigurationSelectorRule
|
|
123 |
$transformer->transform($interactive, $node);
|
124 |
$transformer->suppress_warnings = $suppress_warnings;
|
125 |
|
126 |
-
return $
|
127 |
}
|
128 |
}
|
9 |
namespace Facebook\InstantArticles\Transformer\Rules;
|
10 |
|
11 |
use Facebook\InstantArticles\Elements\Interactive;
|
|
|
12 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
13 |
use Facebook\InstantArticles\Transformer\Warnings\InvalidSelector;
|
|
|
14 |
|
15 |
class InteractiveRule extends ConfigurationSelectorRule
|
16 |
{
|
23 |
|
24 |
public function getContextClass()
|
25 |
{
|
26 |
+
return InstantArticle::getClassName();
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
public static function create()
|
30 |
{
|
31 |
+
return new InteractiveRule();
|
32 |
}
|
33 |
|
34 |
public static function createFrom($configuration)
|
35 |
{
|
36 |
+
$interactive_rule = self::create();
|
37 |
$interactive_rule->withSelector($configuration['selector']);
|
38 |
|
39 |
$interactive_rule->withProperties(
|
51 |
return $interactive_rule;
|
52 |
}
|
53 |
|
54 |
+
public function apply($transformer, $instant_article, $node)
|
55 |
{
|
56 |
$interactive = Interactive::create();
|
57 |
|
58 |
+
// Builds the image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
$iframe = $this->getProperty(self::PROPERTY_IFRAME, $node);
|
60 |
$url = $this->getProperty(self::PROPERTY_URL, $node);
|
61 |
if ($iframe) {
|
66 |
}
|
67 |
if ($iframe || $url) {
|
68 |
$instant_article->addChild($interactive);
|
|
|
|
|
|
|
69 |
} else {
|
70 |
$transformer->addWarning(
|
71 |
new InvalidSelector(
|
98 |
$transformer->transform($interactive, $node);
|
99 |
$transformer->suppress_warnings = $suppress_warnings;
|
100 |
|
101 |
+
return $instant_article;
|
102 |
}
|
103 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/RelatedArticlesRule.php
CHANGED
@@ -42,11 +42,12 @@ class RelatedArticlesRule extends ConfigurationSelectorRule
|
|
42 |
{
|
43 |
$related_articles = RelatedArticles::create();
|
44 |
|
|
|
45 |
$title = $this->getProperty(self::PROPERTY_TITLE, $node);
|
46 |
if ($title) {
|
47 |
$related_articles->withTitle($title);
|
|
|
48 |
}
|
49 |
-
$instant_article->addChild($related_articles);
|
50 |
|
51 |
$transformer->transform($related_articles, $node);
|
52 |
|
42 |
{
|
43 |
$related_articles = RelatedArticles::create();
|
44 |
|
45 |
+
// Builds the image
|
46 |
$title = $this->getProperty(self::PROPERTY_TITLE, $node);
|
47 |
if ($title) {
|
48 |
$related_articles->withTitle($title);
|
49 |
+
$instant_article->addChild($related_articles);
|
50 |
}
|
|
|
51 |
|
52 |
$transformer->transform($related_articles, $node);
|
53 |
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/Rule.php
CHANGED
@@ -23,8 +23,9 @@ abstract class Rule
|
|
23 |
$log->debug('node matches: '.($matches_node ? 'MATCHES' : 'no match'));
|
24 |
$log->debug('rule: '.get_class($this));
|
25 |
$log->debug('-------');
|
|
|
26 |
}
|
27 |
-
if ($node->nodeName === '
|
28 |
$log->debug('context class: '.get_class($context));
|
29 |
$log->debug('context matches: '.($matches_context ? 'MATCHES' : 'no match'));
|
30 |
$log->debug('node name: <'.$node->nodeName.' />');
|
@@ -33,7 +34,7 @@ abstract class Rule
|
|
33 |
$log->debug('rule: '.get_class($this));
|
34 |
$log->debug('-------');
|
35 |
}
|
36 |
-
return
|
37 |
}
|
38 |
|
39 |
abstract public function matchesContext($context);
|
23 |
$log->debug('node matches: '.($matches_node ? 'MATCHES' : 'no match'));
|
24 |
$log->debug('rule: '.get_class($this));
|
25 |
$log->debug('-------');
|
26 |
+
return true;
|
27 |
}
|
28 |
+
if ($node->nodeName === 'img') {
|
29 |
$log->debug('context class: '.get_class($context));
|
30 |
$log->debug('context matches: '.($matches_context ? 'MATCHES' : 'no match'));
|
31 |
$log->debug('node name: <'.$node->nodeName.' />');
|
34 |
$log->debug('rule: '.get_class($this));
|
35 |
$log->debug('-------');
|
36 |
}
|
37 |
+
return false;
|
38 |
}
|
39 |
|
40 |
abstract public function matchesContext($context);
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Rules/TimeRule.php
CHANGED
@@ -14,8 +14,7 @@ use Facebook\InstantArticles\Transformer\Warnings\InvalidSelector;
|
|
14 |
|
15 |
class TimeRule extends ConfigurationSelectorRule
|
16 |
{
|
17 |
-
const
|
18 |
-
const PROPERTY_DATETIME_TYPE = 'article.datetype';
|
19 |
const PROPERTY_TIME = 'article.time';
|
20 |
|
21 |
private $type = Time::PUBLISHED;
|
@@ -35,29 +34,21 @@ class TimeRule extends ConfigurationSelectorRule
|
|
35 |
$time_rule = self::create();
|
36 |
$time_rule->withSelector($configuration['selector']);
|
37 |
|
38 |
-
$time_rule->
|
39 |
-
|
40 |
-
|
41 |
-
self::PROPERTY_DATETIME_TYPE
|
42 |
-
],
|
43 |
-
$configuration
|
44 |
);
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
$time_rule->type = $configuration[self::PROPERTY_TIME_TYPE_DEPRECATED];
|
49 |
}
|
50 |
|
51 |
return $time_rule;
|
|
|
52 |
}
|
53 |
|
54 |
public function apply($transformer, $header, $node)
|
55 |
{
|
56 |
-
$time_type = $this->getProperty(self::PROPERTY_DATETIME_TYPE, $node);
|
57 |
-
if ($time_type) {
|
58 |
-
$this->type = $time_type;
|
59 |
-
}
|
60 |
-
|
61 |
// Builds the image
|
62 |
$time_string = $this->getProperty(self::PROPERTY_TIME, $node);
|
63 |
if ($time_string) {
|
@@ -75,8 +66,6 @@ class TimeRule extends ConfigurationSelectorRule
|
|
75 |
);
|
76 |
}
|
77 |
|
78 |
-
|
79 |
-
|
80 |
return $header;
|
81 |
}
|
82 |
}
|
14 |
|
15 |
class TimeRule extends ConfigurationSelectorRule
|
16 |
{
|
17 |
+
const PROPERTY_TIME_TYPE = 'article.time_type';
|
|
|
18 |
const PROPERTY_TIME = 'article.time';
|
19 |
|
20 |
private $type = Time::PUBLISHED;
|
34 |
$time_rule = self::create();
|
35 |
$time_rule->withSelector($configuration['selector']);
|
36 |
|
37 |
+
$time_rule->withProperty(
|
38 |
+
self::PROPERTY_TIME,
|
39 |
+
self::retrieveProperty($configuration, self::PROPERTY_TIME)
|
|
|
|
|
|
|
40 |
);
|
41 |
|
42 |
+
if (isset($configuration[self::PROPERTY_TIME_TYPE])) {
|
43 |
+
$time_rule->type = $configuration[self::PROPERTY_TIME_TYPE];
|
|
|
44 |
}
|
45 |
|
46 |
return $time_rule;
|
47 |
+
|
48 |
}
|
49 |
|
50 |
public function apply($transformer, $header, $node)
|
51 |
{
|
|
|
|
|
|
|
|
|
|
|
52 |
// Builds the image
|
53 |
$time_string = $this->getProperty(self::PROPERTY_TIME, $node);
|
54 |
if ($time_string) {
|
66 |
);
|
67 |
}
|
68 |
|
|
|
|
|
69 |
return $header;
|
70 |
}
|
71 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Transformer.php
CHANGED
@@ -46,50 +46,6 @@ class Transformer
|
|
46 |
*/
|
47 |
private $instantArticle;
|
48 |
|
49 |
-
/**
|
50 |
-
* Flag attribute added to elements processed by a getter, so they
|
51 |
-
* are not processed again by other rules.
|
52 |
-
*/
|
53 |
-
const INSTANT_ARTICLES_PARSED_FLAG = 'data-instant-articles-element-processed';
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Clones a node for appending to raw-html containing Elements like Interactive.
|
57 |
-
*
|
58 |
-
* @param DOMNode $node The node to clone
|
59 |
-
* @return DOMNode The cloned node.
|
60 |
-
*/
|
61 |
-
public static function cloneNode($node)
|
62 |
-
{
|
63 |
-
$clone = $node->cloneNode(true);
|
64 |
-
if (Type::is($clone, 'DOMElement') && $clone->hasAttribute(self::INSTANT_ARTICLES_PARSED_FLAG)) {
|
65 |
-
$clone->removeAttribute(self::INSTANT_ARTICLES_PARSED_FLAG);
|
66 |
-
}
|
67 |
-
return $clone;
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Marks a node as processed.
|
72 |
-
*
|
73 |
-
* @param DOMElement $node The node to clone
|
74 |
-
*/
|
75 |
-
public static function markAsProcessed($node)
|
76 |
-
{
|
77 |
-
if (Type::is($node, 'DOMElement')) {
|
78 |
-
$node->setAttribute(self::INSTANT_ARTICLES_PARSED_FLAG, true);
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Returns whether a node is processed
|
84 |
-
*
|
85 |
-
* @param DOMNode $node The node to clone
|
86 |
-
*/
|
87 |
-
protected static function isProcessed($node)
|
88 |
-
{
|
89 |
-
return Type::is($node, 'DOMElement') && $node->getAttribute(self::INSTANT_ARTICLES_PARSED_FLAG);
|
90 |
-
}
|
91 |
-
|
92 |
-
|
93 |
/**
|
94 |
* Gets all types a given class is, including itself, parent classes and interfaces.
|
95 |
*
|
@@ -164,36 +120,6 @@ class Transformer
|
|
164 |
return $this->instantArticle;
|
165 |
}
|
166 |
|
167 |
-
/**
|
168 |
-
* @param InstantArticle $context
|
169 |
-
* @param string $content
|
170 |
-
*
|
171 |
-
* @return mixed
|
172 |
-
*/
|
173 |
-
public function transformString($context, $content, $encoding = "utf-8")
|
174 |
-
{
|
175 |
-
$libxml_previous_state = libxml_use_internal_errors(true);
|
176 |
-
$document = new \DOMDocument('1.0');
|
177 |
-
if (function_exists('mb_convert_encoding')) {
|
178 |
-
$document->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', $encoding));
|
179 |
-
} else {
|
180 |
-
$log = \Logger::getLogger('facebook-instantarticles-transformer');
|
181 |
-
$log->debug(
|
182 |
-
'Your content encoding is "' . $encoding . '" ' .
|
183 |
-
'but your PHP environment does not have mbstring. Trying to load your content with using meta tags.'
|
184 |
-
);
|
185 |
-
// wrap the content with charset meta tags
|
186 |
-
$document->loadHTML(
|
187 |
-
'<html><head>' .
|
188 |
-
'<meta http-equiv="Content-Type" content="text/html; charset=' . $encoding . '">' .
|
189 |
-
'</head><body>' . $content . '</body></html>'
|
190 |
-
);
|
191 |
-
}
|
192 |
-
libxml_clear_errors();
|
193 |
-
libxml_use_internal_errors($libxml_previous_state);
|
194 |
-
return $this->transform($context, $document);
|
195 |
-
}
|
196 |
-
|
197 |
/**
|
198 |
* @param InstantArticle $context
|
199 |
* @param \DOMNode $node
|
@@ -221,9 +147,6 @@ class Transformer
|
|
221 |
$current_context = $context;
|
222 |
if ($node->hasChildNodes()) {
|
223 |
foreach ($node->childNodes as $child) {
|
224 |
-
if (self::isProcessed($child)) {
|
225 |
-
continue;
|
226 |
-
}
|
227 |
$matched = false;
|
228 |
$log->debug("===========================");
|
229 |
$log->debug($child->ownerDocument->saveHtml($child));
|
46 |
*/
|
47 |
private $instantArticle;
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
/**
|
50 |
* Gets all types a given class is, including itself, parent classes and interfaces.
|
51 |
*
|
120 |
return $this->instantArticle;
|
121 |
}
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
/**
|
124 |
* @param InstantArticle $context
|
125 |
* @param \DOMNode $node
|
147 |
$current_context = $context;
|
148 |
if ($node->hasChildNodes()) {
|
149 |
foreach ($node->childNodes as $child) {
|
|
|
|
|
|
|
150 |
$matched = false;
|
151 |
$log->debug("===========================");
|
152 |
$log->debug($child->ownerDocument->saveHtml($child));
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/InvalidSelector.php
CHANGED
@@ -55,19 +55,11 @@ class InvalidSelector
|
|
55 |
*/
|
56 |
public function __toString()
|
57 |
{
|
58 |
-
|
59 |
-
|
60 |
-
$class_name = $reflection->getShortName();
|
61 |
-
} else {
|
62 |
-
$class_name = 'no context provided';
|
63 |
-
}
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
$rule_name = $reflection->getShortName();
|
68 |
-
} else {
|
69 |
-
$rule_name = 'no rule provided';
|
70 |
-
}
|
71 |
|
72 |
$has_properties = false;
|
73 |
$str_properties = '';
|
55 |
*/
|
56 |
public function __toString()
|
57 |
{
|
58 |
+
$reflection = new \ReflectionClass(get_class($this->context));
|
59 |
+
$class_name = $reflection->getShortName();
|
|
|
|
|
|
|
|
|
60 |
|
61 |
+
$reflection = new \ReflectionClass(get_class($this->rule));
|
62 |
+
$rule_name = $reflection->getShortName();
|
|
|
|
|
|
|
|
|
63 |
|
64 |
$has_properties = false;
|
65 |
$str_properties = '';
|
vendor/facebook/facebook-instant-articles-sdk-php/src/Facebook/InstantArticles/Transformer/Warnings/validator_warning_messages.ini
CHANGED
@@ -24,7 +24,7 @@ H3 = "This is a text container that must not be empty nor contain only whitespac
|
|
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
|
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."
|
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."
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Client/ClientTest.php
CHANGED
@@ -108,54 +108,6 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|
108 |
$this->assertEquals($expectedSubmissionStatusID, $resultSubmissionStatusID);
|
109 |
}
|
110 |
|
111 |
-
/**
|
112 |
-
* Tests that a re-scrape is performed when requested at article import.
|
113 |
-
*/
|
114 |
-
public function testImportArticleRescrape()
|
115 |
-
{
|
116 |
-
$expectedSubmissionStatusID = 1;
|
117 |
-
|
118 |
-
$serverResponseMock =
|
119 |
-
$this->getMockBuilder('Facebook\FacebookResponse')
|
120 |
-
->disableOriginalConstructor()
|
121 |
-
->getMock();
|
122 |
-
$graphNodeMock =
|
123 |
-
$this->getMockBuilder('Facebook\GraphNodes\GraphNode')
|
124 |
-
->disableOriginalConstructor()
|
125 |
-
->getMock();
|
126 |
-
$serverResponseMock
|
127 |
-
->expects($this->once())
|
128 |
-
->method('getGraphNode')
|
129 |
-
->willReturn($graphNodeMock);
|
130 |
-
$graphNodeMock
|
131 |
-
->expects($this->once())
|
132 |
-
->method('getField')
|
133 |
-
->with('id')
|
134 |
-
->willReturn($expectedSubmissionStatusID);
|
135 |
-
|
136 |
-
$this->facebook
|
137 |
-
->expects($this->at(0))
|
138 |
-
->method('post')
|
139 |
-
->with('PAGE_ID' . Client::EDGE_NAME, [
|
140 |
-
'html_source' => $this->article->render(),
|
141 |
-
'published' => true,
|
142 |
-
'development_mode' => false,
|
143 |
-
])
|
144 |
-
->willReturn($serverResponseMock);
|
145 |
-
|
146 |
-
$this->facebook
|
147 |
-
->expects($this->at(1))
|
148 |
-
->method('post')
|
149 |
-
->with('/', [
|
150 |
-
'id' => $this->article->getCanonicalURL(),
|
151 |
-
'scrape' => 'true',
|
152 |
-
])
|
153 |
-
->willReturn($serverResponseMock);
|
154 |
-
|
155 |
-
$resultSubmissionStatusID = $this->client->importArticle($this->article, true, true);
|
156 |
-
$this->assertEquals($expectedSubmissionStatusID, $resultSubmissionStatusID);
|
157 |
-
}
|
158 |
-
|
159 |
/**
|
160 |
* Tests removing an article from an Instant Articles library.
|
161 |
*
|
@@ -678,197 +630,4 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|
678 |
$result = $this->client->getArticlesURLs();
|
679 |
$this->assertEquals($expected, $result);
|
680 |
}
|
681 |
-
|
682 |
-
public function testClaimURL()
|
683 |
-
{
|
684 |
-
$url = 'example.com';
|
685 |
-
|
686 |
-
$serverResponseMock =
|
687 |
-
$this->getMockBuilder('Facebook\FacebookResponse')
|
688 |
-
->disableOriginalConstructor()
|
689 |
-
->getMock();
|
690 |
-
$graphNodeMock =
|
691 |
-
$this->getMockBuilder('Facebook\GraphNodes\GraphNode')
|
692 |
-
->disableOriginalConstructor()
|
693 |
-
->getMock();
|
694 |
-
|
695 |
-
$serverResponseMock
|
696 |
-
->expects($this->once())
|
697 |
-
->method('getGraphNode')
|
698 |
-
->willReturn($graphNodeMock);
|
699 |
-
$graphNodeMock
|
700 |
-
->expects($this->exactly(2))
|
701 |
-
->method('getField')
|
702 |
-
->withConsecutive(
|
703 |
-
[$this->equalTo('error')],
|
704 |
-
[$this->equalTo('success')]
|
705 |
-
)
|
706 |
-
->will($this->onConsecutiveCalls(
|
707 |
-
null,
|
708 |
-
true
|
709 |
-
));
|
710 |
-
|
711 |
-
$this->facebook
|
712 |
-
->expects($this->once())
|
713 |
-
->method('post')
|
714 |
-
->with('PAGE_ID/claimed_urls?url=' . $url)
|
715 |
-
->willReturn($serverResponseMock);
|
716 |
-
|
717 |
-
$result = $this->client->claimURL($url);
|
718 |
-
}
|
719 |
-
|
720 |
-
public function testClaimURLWithProtocl()
|
721 |
-
{
|
722 |
-
$url = 'http://example.com';
|
723 |
-
|
724 |
-
$serverResponseMock =
|
725 |
-
$this->getMockBuilder('Facebook\FacebookResponse')
|
726 |
-
->disableOriginalConstructor()
|
727 |
-
->getMock();
|
728 |
-
$graphNodeMock =
|
729 |
-
$this->getMockBuilder('Facebook\GraphNodes\GraphNode')
|
730 |
-
->disableOriginalConstructor()
|
731 |
-
->getMock();
|
732 |
-
|
733 |
-
$serverResponseMock
|
734 |
-
->expects($this->once())
|
735 |
-
->method('getGraphNode')
|
736 |
-
->willReturn($graphNodeMock);
|
737 |
-
$graphNodeMock
|
738 |
-
->expects($this->exactly(2))
|
739 |
-
->method('getField')
|
740 |
-
->withConsecutive(
|
741 |
-
[$this->equalTo('error')],
|
742 |
-
[$this->equalTo('success')]
|
743 |
-
)
|
744 |
-
->will($this->onConsecutiveCalls(
|
745 |
-
null,
|
746 |
-
true
|
747 |
-
));
|
748 |
-
|
749 |
-
$this->facebook
|
750 |
-
->expects($this->once())
|
751 |
-
->method('post')
|
752 |
-
->with('PAGE_ID/claimed_urls?url=example.com')
|
753 |
-
->willReturn($serverResponseMock);
|
754 |
-
|
755 |
-
$result = $this->client->claimURL($url);
|
756 |
-
}
|
757 |
-
|
758 |
-
public function testClaimURLError()
|
759 |
-
{
|
760 |
-
$url = 'example.com';
|
761 |
-
$error_user_msg = "Error message";
|
762 |
-
|
763 |
-
$serverResponseMock =
|
764 |
-
$this->getMockBuilder('Facebook\FacebookResponse')
|
765 |
-
->disableOriginalConstructor()
|
766 |
-
->getMock();
|
767 |
-
$graphNodeMock =
|
768 |
-
$this->getMockBuilder('Facebook\GraphNodes\GraphNode')
|
769 |
-
->disableOriginalConstructor()
|
770 |
-
->getMock();
|
771 |
-
|
772 |
-
$serverResponseMock
|
773 |
-
->expects($this->once())
|
774 |
-
->method('getGraphNode')
|
775 |
-
->willReturn($graphNodeMock);
|
776 |
-
$graphNodeMock
|
777 |
-
->expects($this->exactly(2))
|
778 |
-
->method('getField')
|
779 |
-
->withConsecutive(
|
780 |
-
[$this->equalTo('error')],
|
781 |
-
[$this->equalTo('success')]
|
782 |
-
)
|
783 |
-
->will($this->onConsecutiveCalls(
|
784 |
-
array( 'error_user_msg' => $error_user_msg ),
|
785 |
-
false
|
786 |
-
));
|
787 |
-
|
788 |
-
$this->facebook
|
789 |
-
->expects($this->once())
|
790 |
-
->method('post')
|
791 |
-
->with('PAGE_ID/claimed_urls?url=' .$url)
|
792 |
-
->willReturn($serverResponseMock);
|
793 |
-
|
794 |
-
$this->setExpectedException('\Facebook\InstantArticles\Client\ClientException');
|
795 |
-
|
796 |
-
$result = $this->client->claimURL($url);
|
797 |
-
}
|
798 |
-
|
799 |
-
public function testSubmitForReview()
|
800 |
-
{
|
801 |
-
$serverResponseMock =
|
802 |
-
$this->getMockBuilder('Facebook\FacebookResponse')
|
803 |
-
->disableOriginalConstructor()
|
804 |
-
->getMock();
|
805 |
-
$graphNodeMock =
|
806 |
-
$this->getMockBuilder('Facebook\GraphNodes\GraphNode')
|
807 |
-
->disableOriginalConstructor()
|
808 |
-
->getMock();
|
809 |
-
|
810 |
-
$serverResponseMock
|
811 |
-
->expects($this->once())
|
812 |
-
->method('getGraphNode')
|
813 |
-
->willReturn($graphNodeMock);
|
814 |
-
$graphNodeMock
|
815 |
-
->expects($this->exactly(2))
|
816 |
-
->method('getField')
|
817 |
-
->withConsecutive(
|
818 |
-
[$this->equalTo('error')],
|
819 |
-
[$this->equalTo('success')]
|
820 |
-
)
|
821 |
-
->will($this->onConsecutiveCalls(
|
822 |
-
null,
|
823 |
-
true
|
824 |
-
));
|
825 |
-
|
826 |
-
$this->facebook
|
827 |
-
->expects($this->once())
|
828 |
-
->method('post')
|
829 |
-
->with('PAGE_ID/?instant_articles_submit_for_review=true')
|
830 |
-
->willReturn($serverResponseMock);
|
831 |
-
|
832 |
-
$result = $this->client->submitForReview();
|
833 |
-
}
|
834 |
-
|
835 |
-
public function testSubmitForReviewError()
|
836 |
-
{
|
837 |
-
$error_user_msg = "Error message";
|
838 |
-
|
839 |
-
$serverResponseMock =
|
840 |
-
$this->getMockBuilder('Facebook\FacebookResponse')
|
841 |
-
->disableOriginalConstructor()
|
842 |
-
->getMock();
|
843 |
-
$graphNodeMock =
|
844 |
-
$this->getMockBuilder('Facebook\GraphNodes\GraphNode')
|
845 |
-
->disableOriginalConstructor()
|
846 |
-
->getMock();
|
847 |
-
|
848 |
-
$serverResponseMock
|
849 |
-
->expects($this->once())
|
850 |
-
->method('getGraphNode')
|
851 |
-
->willReturn($graphNodeMock);
|
852 |
-
$graphNodeMock
|
853 |
-
->expects($this->exactly(2))
|
854 |
-
->method('getField')
|
855 |
-
->withConsecutive(
|
856 |
-
[$this->equalTo('error')],
|
857 |
-
[$this->equalTo('success')]
|
858 |
-
)
|
859 |
-
->will($this->onConsecutiveCalls(
|
860 |
-
array( 'error_user_msg' => $error_user_msg ),
|
861 |
-
false
|
862 |
-
));
|
863 |
-
|
864 |
-
$this->facebook
|
865 |
-
->expects($this->once())
|
866 |
-
->method('post')
|
867 |
-
->with('PAGE_ID/?instant_articles_submit_for_review=true')
|
868 |
-
->willReturn($serverResponseMock);
|
869 |
-
|
870 |
-
$this->setExpectedException('\Facebook\InstantArticles\Client\ClientException');
|
871 |
-
|
872 |
-
$result = $this->client->submitForReview();
|
873 |
-
}
|
874 |
}
|
108 |
$this->assertEquals($expectedSubmissionStatusID, $resultSubmissionStatusID);
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
/**
|
112 |
* Tests removing an article from an Instant Articles library.
|
113 |
*
|
630 |
$result = $this->client->getArticlesURLs();
|
631 |
$this->assertEquals($expected, $result);
|
632 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
633 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Client/HelperTest.php
CHANGED
@@ -54,7 +54,7 @@ class HelperTest extends \PHPUnit_Framework_TestCase
|
|
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);
|
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);
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/InstantArticleTest.php
CHANGED
@@ -414,249 +414,4 @@ class InstantArticleTest extends \PHPUnit_Framework_TestCase
|
|
414 |
{
|
415 |
$this->assertInstanceOf('Facebook\InstantArticles\Elements\InstantArticleInterface', $this->article);
|
416 |
}
|
417 |
-
|
418 |
-
public function testIsRTLEnabled()
|
419 |
-
{
|
420 |
-
$article =
|
421 |
-
InstantArticle::create()
|
422 |
-
->withCanonicalURL('http://wp.localtest.me/2016/04/12/stress-on-earth/')
|
423 |
-
->enableAutomaticAdPlacement()
|
424 |
-
->enableRTL()
|
425 |
-
->withHeader(
|
426 |
-
Header::create()
|
427 |
-
->withTitle(
|
428 |
-
H1::create()->appendText('Peace on <b>earth</b>')
|
429 |
-
)
|
430 |
-
->addAuthor(
|
431 |
-
Author::create()->withName('bill')
|
432 |
-
)
|
433 |
-
->withPublishTime(
|
434 |
-
Time::create(Time::PUBLISHED)
|
435 |
-
->withDatetime(
|
436 |
-
\DateTime::createFromFormat(
|
437 |
-
'j-M-Y G:i:s',
|
438 |
-
'14-Aug-1984 19:30:00'
|
439 |
-
)
|
440 |
-
)
|
441 |
-
)
|
442 |
-
)
|
443 |
-
->addChild(
|
444 |
-
Paragraph::create()
|
445 |
-
->appendText('Yes, peace is good for everybody!')
|
446 |
-
->appendText(LineBreak::create())
|
447 |
-
->appendText(' Man kind.')
|
448 |
-
);
|
449 |
-
$result = $article->render();
|
450 |
-
$expected =
|
451 |
-
'<!doctype html>'.
|
452 |
-
'<html dir="rtl">'.
|
453 |
-
'<head>'.
|
454 |
-
'<link rel="canonical" href="http://wp.localtest.me/2016/04/12/stress-on-earth/"/>'.
|
455 |
-
'<meta charset="utf-8"/>'.
|
456 |
-
'<meta property="op:generator" content="facebook-instant-articles-sdk-php"/>'.
|
457 |
-
'<meta property="op:generator:version" content="'.InstantArticle::CURRENT_VERSION.'"/>'.
|
458 |
-
'<meta property="op:markup_version" content="v1.0"/>'.
|
459 |
-
'</head>'.
|
460 |
-
'<body>'.
|
461 |
-
'<article>'.
|
462 |
-
'<header>'.
|
463 |
-
'<h1>Peace on <b>earth</b></h1>'.
|
464 |
-
'<time class="op-published" datetime="1984-08-14T19:30:00+00:00">August 14th, 7:30pm</time>'.
|
465 |
-
'<address>'.
|
466 |
-
'<a>bill</a>'.
|
467 |
-
'</address>'.
|
468 |
-
'</header>'.
|
469 |
-
'<p>Yes, peace is good for everybody!<br/> Man kind.</p>'.
|
470 |
-
'</article>'.
|
471 |
-
'</body>'.
|
472 |
-
'</html>';
|
473 |
-
|
474 |
-
$this->assertEquals($expected, $result);
|
475 |
-
}
|
476 |
-
|
477 |
-
public function testDeleteChildren()
|
478 |
-
{
|
479 |
-
$article =
|
480 |
-
InstantArticle::create()
|
481 |
-
->withCanonicalURL('http://www.facebook-IA-test.com/category/test')
|
482 |
-
->enableAutomaticAdPlacement()
|
483 |
-
->withHeader(
|
484 |
-
Header::create()
|
485 |
-
->withTitle(
|
486 |
-
H1::create()->appendText('A good test')
|
487 |
-
)
|
488 |
-
->addAuthor(
|
489 |
-
Author::create()->withName('Dan')
|
490 |
-
)
|
491 |
-
->withPublishTime(
|
492 |
-
Time::create(Time::PUBLISHED)
|
493 |
-
->withDatetime(
|
494 |
-
\DateTime::createFromFormat(
|
495 |
-
'j-M-Y G:i:s',
|
496 |
-
'09-Jan-2016 20:30:00'
|
497 |
-
)
|
498 |
-
)
|
499 |
-
)
|
500 |
-
)
|
501 |
-
->addChild(
|
502 |
-
Paragraph::create()
|
503 |
-
->appendText('Just testing a deletion.')
|
504 |
-
)
|
505 |
-
->addChild(
|
506 |
-
Paragraph::create()
|
507 |
-
->appendText('This should not render afterwards.')
|
508 |
-
);
|
509 |
-
$article->deleteChild(1);
|
510 |
-
$result = $article->render();
|
511 |
-
|
512 |
-
$expected =
|
513 |
-
'<!doctype html>'.
|
514 |
-
'<html>'.
|
515 |
-
'<head>'.
|
516 |
-
'<link rel="canonical" href="http://www.facebook-IA-test.com/category/test"/>'.
|
517 |
-
'<meta charset="utf-8"/>'.
|
518 |
-
'<meta property="op:generator" content="facebook-instant-articles-sdk-php"/>'.
|
519 |
-
'<meta property="op:generator:version" content="'.InstantArticle::CURRENT_VERSION.'"/>'.
|
520 |
-
'<meta property="op:markup_version" content="v1.0"/>'.
|
521 |
-
'</head>'.
|
522 |
-
'<body>'.
|
523 |
-
'<article>'.
|
524 |
-
'<header>'.
|
525 |
-
'<h1>A good test</h1>'.
|
526 |
-
'<time class="op-published" datetime="2016-01-09T20:30:00+00:00">January 9th, 8:30pm</time>'.
|
527 |
-
'<address>'.
|
528 |
-
'<a>Dan</a>'.
|
529 |
-
'</address>'.
|
530 |
-
'</header>'.
|
531 |
-
'<p>Just testing a deletion.</p>'.
|
532 |
-
'</article>'.
|
533 |
-
'</body>'.
|
534 |
-
'</html>';
|
535 |
-
|
536 |
-
$this->assertEquals($expected, $result);
|
537 |
-
}
|
538 |
-
|
539 |
-
public function testDeleteOnlyChild()
|
540 |
-
{
|
541 |
-
$article =
|
542 |
-
InstantArticle::create()
|
543 |
-
->withCanonicalURL('http://www.facebook-IA-test.com/category/test')
|
544 |
-
->enableAutomaticAdPlacement()
|
545 |
-
->withHeader(
|
546 |
-
Header::create()
|
547 |
-
->withTitle(
|
548 |
-
H1::create()->appendText('A good test')
|
549 |
-
)
|
550 |
-
->addAuthor(
|
551 |
-
Author::create()->withName('Dan')
|
552 |
-
)
|
553 |
-
->withPublishTime(
|
554 |
-
Time::create(Time::PUBLISHED)
|
555 |
-
->withDatetime(
|
556 |
-
\DateTime::createFromFormat(
|
557 |
-
'j-M-Y G:i:s',
|
558 |
-
'09-Jan-2016 20:30:00'
|
559 |
-
)
|
560 |
-
)
|
561 |
-
)
|
562 |
-
)
|
563 |
-
->addChild(
|
564 |
-
Paragraph::create()
|
565 |
-
->appendText('Single paragraph to delete.')
|
566 |
-
);
|
567 |
-
$article->deleteChild(0);
|
568 |
-
$result = $article->render();
|
569 |
-
|
570 |
-
$expected =
|
571 |
-
'<!doctype html>'.
|
572 |
-
'<html>'.
|
573 |
-
'<head>'.
|
574 |
-
'<link rel="canonical" href="http://www.facebook-IA-test.com/category/test"/>'.
|
575 |
-
'<meta charset="utf-8"/>'.
|
576 |
-
'<meta property="op:generator" content="facebook-instant-articles-sdk-php"/>'.
|
577 |
-
'<meta property="op:generator:version" content="'.InstantArticle::CURRENT_VERSION.'"/>'.
|
578 |
-
'<meta property="op:markup_version" content="v1.0"/>'.
|
579 |
-
'</head>'.
|
580 |
-
'<body>'.
|
581 |
-
'<article>'.
|
582 |
-
'<header>'.
|
583 |
-
'<h1>A good test</h1>'.
|
584 |
-
'<time class="op-published" datetime="2016-01-09T20:30:00+00:00">January 9th, 8:30pm</time>'.
|
585 |
-
'<address>'.
|
586 |
-
'<a>Dan</a>'.
|
587 |
-
'</address>'.
|
588 |
-
'</header>'.
|
589 |
-
'</article>'.
|
590 |
-
'</body>'.
|
591 |
-
'</html>';
|
592 |
-
|
593 |
-
$this->assertEquals($expected, $result);
|
594 |
-
}
|
595 |
-
|
596 |
-
public function testReplaceChildren()
|
597 |
-
{
|
598 |
-
$article =
|
599 |
-
InstantArticle::create()
|
600 |
-
->withCanonicalURL('http://www.facebook-IA-test.com/category/test')
|
601 |
-
->enableAutomaticAdPlacement()
|
602 |
-
->withHeader(
|
603 |
-
Header::create()
|
604 |
-
->withTitle(
|
605 |
-
H1::create()->appendText('A replacing test')
|
606 |
-
)
|
607 |
-
->addAuthor(
|
608 |
-
Author::create()->withName('Dan')
|
609 |
-
)
|
610 |
-
->withPublishTime(
|
611 |
-
Time::create(Time::PUBLISHED)
|
612 |
-
->withDatetime(
|
613 |
-
\DateTime::createFromFormat(
|
614 |
-
'j-M-Y G:i:s',
|
615 |
-
'09-Jan-2016 20:30:00'
|
616 |
-
)
|
617 |
-
)
|
618 |
-
)
|
619 |
-
)
|
620 |
-
->addChild(
|
621 |
-
Paragraph::create()
|
622 |
-
->appendText('Ye olde body')
|
623 |
-
);
|
624 |
-
|
625 |
-
$newBody = array(
|
626 |
-
Paragraph::create()
|
627 |
-
->appendText('The new body.'),
|
628 |
-
Paragraph::create()
|
629 |
-
->appendText('With two paragraphs!')
|
630 |
-
);
|
631 |
-
|
632 |
-
$article->withChildren($newBody);
|
633 |
-
$result = $article->render();
|
634 |
-
|
635 |
-
$expected =
|
636 |
-
'<!doctype html>'.
|
637 |
-
'<html>'.
|
638 |
-
'<head>'.
|
639 |
-
'<link rel="canonical" href="http://www.facebook-IA-test.com/category/test"/>'.
|
640 |
-
'<meta charset="utf-8"/>'.
|
641 |
-
'<meta property="op:generator" content="facebook-instant-articles-sdk-php"/>'.
|
642 |
-
'<meta property="op:generator:version" content="'.InstantArticle::CURRENT_VERSION.'"/>'.
|
643 |
-
'<meta property="op:markup_version" content="v1.0"/>'.
|
644 |
-
'</head>'.
|
645 |
-
'<body>'.
|
646 |
-
'<article>'.
|
647 |
-
'<header>'.
|
648 |
-
'<h1>A replacing test</h1>'.
|
649 |
-
'<time class="op-published" datetime="2016-01-09T20:30:00+00:00">January 9th, 8:30pm</time>'.
|
650 |
-
'<address>'.
|
651 |
-
'<a>Dan</a>'.
|
652 |
-
'</address>'.
|
653 |
-
'</header>'.
|
654 |
-
'<p>The new body.</p>'.
|
655 |
-
'<p>With two paragraphs!</p>'.
|
656 |
-
'</article>'.
|
657 |
-
'</body>'.
|
658 |
-
'</html>';
|
659 |
-
|
660 |
-
$this->assertEquals($expected, $result);
|
661 |
-
}
|
662 |
}
|
414 |
{
|
415 |
$this->assertInstanceOf('Facebook\InstantArticles\Elements\InstantArticleInterface', $this->article);
|
416 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/InteractiveTest.php
CHANGED
@@ -21,20 +21,17 @@ class InteractiveTest extends \PHPUnit_Framework_TestCase
|
|
21 |
|
22 |
$rendered = $interactive->render();
|
23 |
$this->assertEquals($expected, $rendered);
|
24 |
-
$this->assertFalse($interactive->isValid());
|
25 |
}
|
26 |
|
27 |
public function testRenderBasic()
|
28 |
{
|
29 |
$interactive =
|
30 |
Interactive::create()
|
31 |
-
->withSource('http://foo.com/interactive-graphic')
|
32 |
-
->withWidth(640)
|
33 |
-
->withHeight(300);
|
34 |
|
35 |
$expected =
|
36 |
'<figure class="op-interactive">'.
|
37 |
-
'<iframe src="http://foo.com/interactive-graphic"
|
38 |
'</figure>';
|
39 |
|
40 |
$rendered = $interactive->render();
|
@@ -46,8 +43,6 @@ class InteractiveTest extends \PHPUnit_Framework_TestCase
|
|
46 |
$social_embed =
|
47 |
interactive::create()
|
48 |
->withSource('http://foo.com/interactive-graphic')
|
49 |
-
->withWidth(640)
|
50 |
-
->withHeight(300)
|
51 |
->withCaption(
|
52 |
Caption::create()
|
53 |
->appendText('Some caption to the interactive graphic')
|
@@ -55,7 +50,7 @@ class InteractiveTest extends \PHPUnit_Framework_TestCase
|
|
55 |
|
56 |
$expected =
|
57 |
'<figure class="op-interactive">'.
|
58 |
-
'<iframe src="http://foo.com/interactive-graphic"
|
59 |
'<figcaption>Some caption to the interactive graphic</figcaption>'.
|
60 |
'</figure>';
|
61 |
|
@@ -63,32 +58,36 @@ class InteractiveTest extends \PHPUnit_Framework_TestCase
|
|
63 |
$this->assertEquals($expected, $rendered);
|
64 |
}
|
65 |
|
66 |
-
public function
|
67 |
{
|
68 |
$interactive =
|
69 |
Interactive::create()
|
70 |
->withSource('http://foo.com/interactive-graphic')
|
71 |
->withHeight(640);
|
72 |
|
73 |
-
$expected =
|
|
|
|
|
|
|
74 |
|
75 |
$rendered = $interactive->render();
|
76 |
$this->assertEquals($expected, $rendered);
|
77 |
-
$this->assertFalse($interactive->isValid());
|
78 |
}
|
79 |
|
80 |
-
public function
|
81 |
{
|
82 |
$interactive =
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
|
87 |
-
$expected =
|
|
|
|
|
|
|
88 |
|
89 |
$rendered = $interactive->render();
|
90 |
$this->assertEquals($expected, $rendered);
|
91 |
-
$this->assertFalse($interactive->isValid());
|
92 |
}
|
93 |
|
94 |
public function testRenderBasicWithWidthHeight()
|
@@ -101,67 +100,46 @@ class InteractiveTest extends \PHPUnit_Framework_TestCase
|
|
101 |
|
102 |
$expected =
|
103 |
'<figure class="op-interactive">' .
|
104 |
-
|
105 |
'</figure>';
|
106 |
|
107 |
$rendered = $interactive->render();
|
108 |
$this->assertEquals($expected, $rendered);
|
109 |
}
|
110 |
|
111 |
-
public function
|
112 |
{
|
113 |
$interactive =
|
114 |
Interactive::create()
|
115 |
->withSource('http://foo.com/interactive-graphic')
|
116 |
->withMargin(Interactive::COLUMN_WIDTH);
|
117 |
|
118 |
-
$expected =
|
|
|
|
|
|
|
119 |
|
120 |
$rendered = $interactive->render();
|
121 |
$this->assertEquals($expected, $rendered);
|
122 |
-
$this->assertFalse($interactive->isValid());
|
123 |
}
|
124 |
|
125 |
-
public function
|
126 |
{
|
127 |
$interactive =
|
128 |
Interactive::create()
|
129 |
->withSource('http://foo.com/interactive-graphic')
|
130 |
->withMargin(Interactive::NO_MARGIN);
|
131 |
|
132 |
-
$expected = '';
|
133 |
-
|
134 |
-
$rendered = $interactive->render();
|
135 |
-
$this->assertEquals($expected, $rendered);
|
136 |
-
$this->assertFalse($interactive->isValid());
|
137 |
-
}
|
138 |
-
|
139 |
-
public function testRenderInlineWithHeightAndWidth()
|
140 |
-
{
|
141 |
-
$inline =
|
142 |
-
'<h1>Some custom code</h1>'.
|
143 |
-
'<script>alert("test & more test");</script>';
|
144 |
-
|
145 |
-
$interactive =
|
146 |
-
Interactive::create()
|
147 |
-
->withHTML($inline)
|
148 |
-
->withWidth(600)
|
149 |
-
->withHeight(640)
|
150 |
-
->withMargin(Interactive::NO_MARGIN);
|
151 |
-
|
152 |
$expected =
|
153 |
'<figure class="op-interactive">'.
|
154 |
-
'<iframe
|
155 |
-
'<h1>Some custom code</h1>'.
|
156 |
-
'<script>alert("test & more test");</script>'.
|
157 |
-
'</iframe>'.
|
158 |
'</figure>';
|
159 |
|
160 |
$rendered = $interactive->render();
|
161 |
$this->assertEquals($expected, $rendered);
|
162 |
}
|
163 |
|
164 |
-
public function
|
165 |
{
|
166 |
$inline =
|
167 |
'<h1>Some custom code</h1>'.
|
@@ -170,11 +148,12 @@ class InteractiveTest extends \PHPUnit_Framework_TestCase
|
|
170 |
$interactive =
|
171 |
Interactive::create()
|
172 |
->withHTML($inline)
|
|
|
173 |
->withMargin(Interactive::NO_MARGIN);
|
174 |
|
175 |
$expected =
|
176 |
'<figure class="op-interactive">'.
|
177 |
-
'<iframe class="no-margin">'.
|
178 |
'<h1>Some custom code</h1>'.
|
179 |
'<script>alert("test & more test");</script>'.
|
180 |
'</iframe>'.
|
@@ -182,6 +161,5 @@ class InteractiveTest extends \PHPUnit_Framework_TestCase
|
|
182 |
|
183 |
$rendered = $interactive->render();
|
184 |
$this->assertEquals($expected, $rendered);
|
185 |
-
$this->assertTrue($interactive->isValid());
|
186 |
}
|
187 |
}
|
21 |
|
22 |
$rendered = $interactive->render();
|
23 |
$this->assertEquals($expected, $rendered);
|
|
|
24 |
}
|
25 |
|
26 |
public function testRenderBasic()
|
27 |
{
|
28 |
$interactive =
|
29 |
Interactive::create()
|
30 |
+
->withSource('http://foo.com/interactive-graphic');
|
|
|
|
|
31 |
|
32 |
$expected =
|
33 |
'<figure class="op-interactive">'.
|
34 |
+
'<iframe src="http://foo.com/interactive-graphic"></iframe>'.
|
35 |
'</figure>';
|
36 |
|
37 |
$rendered = $interactive->render();
|
43 |
$social_embed =
|
44 |
interactive::create()
|
45 |
->withSource('http://foo.com/interactive-graphic')
|
|
|
|
|
46 |
->withCaption(
|
47 |
Caption::create()
|
48 |
->appendText('Some caption to the interactive graphic')
|
50 |
|
51 |
$expected =
|
52 |
'<figure class="op-interactive">'.
|
53 |
+
'<iframe src="http://foo.com/interactive-graphic"></iframe>'.
|
54 |
'<figcaption>Some caption to the interactive graphic</figcaption>'.
|
55 |
'</figure>';
|
56 |
|
58 |
$this->assertEquals($expected, $rendered);
|
59 |
}
|
60 |
|
61 |
+
public function testRenderBasicWithHeight()
|
62 |
{
|
63 |
$interactive =
|
64 |
Interactive::create()
|
65 |
->withSource('http://foo.com/interactive-graphic')
|
66 |
->withHeight(640);
|
67 |
|
68 |
+
$expected =
|
69 |
+
'<figure class="op-interactive">'.
|
70 |
+
'<iframe src="http://foo.com/interactive-graphic" height="640"></iframe>'.
|
71 |
+
'</figure>';
|
72 |
|
73 |
$rendered = $interactive->render();
|
74 |
$this->assertEquals($expected, $rendered);
|
|
|
75 |
}
|
76 |
|
77 |
+
public function testRenderBasicWithWidth()
|
78 |
{
|
79 |
$interactive =
|
80 |
+
Interactive::create()
|
81 |
+
->withSource('http://foo.com/interactive-graphic')
|
82 |
+
->withWidth(640);
|
83 |
|
84 |
+
$expected =
|
85 |
+
'<figure class="op-interactive">' .
|
86 |
+
'<iframe src="http://foo.com/interactive-graphic" width="640"></iframe>' .
|
87 |
+
'</figure>';
|
88 |
|
89 |
$rendered = $interactive->render();
|
90 |
$this->assertEquals($expected, $rendered);
|
|
|
91 |
}
|
92 |
|
93 |
public function testRenderBasicWithWidthHeight()
|
100 |
|
101 |
$expected =
|
102 |
'<figure class="op-interactive">' .
|
103 |
+
'<iframe src="http://foo.com/interactive-graphic" width="1600" height="900"></iframe>' .
|
104 |
'</figure>';
|
105 |
|
106 |
$rendered = $interactive->render();
|
107 |
$this->assertEquals($expected, $rendered);
|
108 |
}
|
109 |
|
110 |
+
public function testRenderBasicWithColumnWidth()
|
111 |
{
|
112 |
$interactive =
|
113 |
Interactive::create()
|
114 |
->withSource('http://foo.com/interactive-graphic')
|
115 |
->withMargin(Interactive::COLUMN_WIDTH);
|
116 |
|
117 |
+
$expected =
|
118 |
+
'<figure class="op-interactive">'.
|
119 |
+
'<iframe src="http://foo.com/interactive-graphic" class="column-width"></iframe>'.
|
120 |
+
'</figure>';
|
121 |
|
122 |
$rendered = $interactive->render();
|
123 |
$this->assertEquals($expected, $rendered);
|
|
|
124 |
}
|
125 |
|
126 |
+
public function testRenderBasicWithNoMargin()
|
127 |
{
|
128 |
$interactive =
|
129 |
Interactive::create()
|
130 |
->withSource('http://foo.com/interactive-graphic')
|
131 |
->withMargin(Interactive::NO_MARGIN);
|
132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
$expected =
|
134 |
'<figure class="op-interactive">'.
|
135 |
+
'<iframe src="http://foo.com/interactive-graphic" class="no-margin"></iframe>'.
|
|
|
|
|
|
|
136 |
'</figure>';
|
137 |
|
138 |
$rendered = $interactive->render();
|
139 |
$this->assertEquals($expected, $rendered);
|
140 |
}
|
141 |
|
142 |
+
public function testRenderInlineWithHeightAndWidth()
|
143 |
{
|
144 |
$inline =
|
145 |
'<h1>Some custom code</h1>'.
|
148 |
$interactive =
|
149 |
Interactive::create()
|
150 |
->withHTML($inline)
|
151 |
+
->withHeight(640)
|
152 |
->withMargin(Interactive::NO_MARGIN);
|
153 |
|
154 |
$expected =
|
155 |
'<figure class="op-interactive">'.
|
156 |
+
'<iframe class="no-margin" height="640">'.
|
157 |
'<h1>Some custom code</h1>'.
|
158 |
'<script>alert("test & more test");</script>'.
|
159 |
'</iframe>'.
|
161 |
|
162 |
$rendered = $interactive->render();
|
163 |
$this->assertEquals($expected, $rendered);
|
|
|
164 |
}
|
165 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Elements/SocialEmbedTest.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 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()
|
24 |
+
{
|
25 |
+
$social_embed =
|
26 |
+
SocialEmbed::create()
|
27 |
+
->withSource('http://foo.com');
|
28 |
+
|
29 |
+
$expected =
|
30 |
+
'<figure class="op-interactive">'.
|
31 |
+
'<iframe src="http://foo.com"></iframe>'.
|
32 |
+
'</figure>';
|
33 |
+
|
34 |
+
$rendered = $social_embed->render();
|
35 |
+
$this->assertEquals($expected, $rendered);
|
36 |
+
}
|
37 |
+
|
38 |
+
public function testRenderBasicWithCaption()
|
39 |
+
{
|
40 |
+
$social_embed =
|
41 |
+
SocialEmbed::create()
|
42 |
+
->withSource('http://foo.com')
|
43 |
+
->withCaption(
|
44 |
+
Caption::create()
|
45 |
+
->appendText('Some caption to the embed')
|
46 |
+
);
|
47 |
+
|
48 |
+
$expected =
|
49 |
+
'<figure class="op-interactive">'.
|
50 |
+
'<iframe src="http://foo.com"></iframe>'.
|
51 |
+
'<figcaption>Some caption to the embed</figcaption>'.
|
52 |
+
'</figure>';
|
53 |
+
|
54 |
+
$rendered = $social_embed->render();
|
55 |
+
$this->assertEquals($expected, $rendered);
|
56 |
+
}
|
57 |
+
|
58 |
+
public function testRenderInline()
|
59 |
+
{
|
60 |
+
$inline =
|
61 |
+
'<h1>Some custom code</h1>'.
|
62 |
+
'<script>alert("test & more test");</script>';
|
63 |
+
|
64 |
+
$social_embed =
|
65 |
+
SocialEmbed::create()
|
66 |
+
->withHTML($inline);
|
67 |
+
|
68 |
+
$expected =
|
69 |
+
'<figure class="op-interactive">'.
|
70 |
+
'<iframe>'.
|
71 |
+
'<h1>Some custom code</h1>'.
|
72 |
+
'<script>alert("test & more test");</script>'.
|
73 |
+
'</iframe>'.
|
74 |
+
'</figure>';
|
75 |
+
|
76 |
+
$rendered = $social_embed->render();
|
77 |
+
$this->assertEquals($expected, $rendered);
|
78 |
+
}
|
79 |
+
|
80 |
+
public function testRenderWithWidthAndHeight()
|
81 |
+
{
|
82 |
+
$social_embed =
|
83 |
+
SocialEmbed::create()
|
84 |
+
->withSource('http://foo.com')
|
85 |
+
->withWidth(640)
|
86 |
+
->withHeight(480);
|
87 |
+
|
88 |
+
$expected =
|
89 |
+
'<figure class="op-interactive">'.
|
90 |
+
'<iframe src="http://foo.com" width="640" height="480"></iframe>'.
|
91 |
+
'</figure>';
|
92 |
+
|
93 |
+
$rendered = $social_embed->render();
|
94 |
+
$this->assertEquals($expected, $rendered);
|
95 |
+
}
|
96 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Parser/instant-article-example.html
CHANGED
@@ -182,7 +182,7 @@
|
|
182 |
<p>Some plaintext credits to<a href="http://facebook.com/author" rel="facebook">Author</a></p>
|
183 |
<p>Paragraph text as credits</p>
|
184 |
</aside>
|
185 |
-
<ul class="op-related-articles">
|
186 |
<li>
|
187 |
<a href="http://example.com/article.html"></a>
|
188 |
</li>
|
182 |
<p>Some plaintext credits to<a href="http://facebook.com/author" rel="facebook">Author</a></p>
|
183 |
<p>Paragraph text as credits</p>
|
184 |
</aside>
|
185 |
+
<ul class="op-related-articles" title="The related ones in the footer">
|
186 |
<li>
|
187 |
<a href="http://example.com/article.html"></a>
|
188 |
</li>
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/{CustomHTMLTransformerTest.php → CMS/WPTransformerTest.php}
RENAMED
@@ -6,15 +6,14 @@
|
|
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\Transformer\Transformer;
|
12 |
use Facebook\InstantArticles\Elements\InstantArticle;
|
13 |
use Facebook\InstantArticles\Elements\Header;
|
14 |
use Facebook\InstantArticles\Elements\Time;
|
15 |
use Facebook\InstantArticles\Elements\Author;
|
16 |
|
17 |
-
class
|
18 |
{
|
19 |
protected function setUp()
|
20 |
{
|
@@ -36,15 +35,15 @@ class CustomHTMLTransformerTest extends \PHPUnit_Framework_TestCase
|
|
36 |
);
|
37 |
}
|
38 |
|
39 |
-
public function
|
40 |
{
|
41 |
-
$json_file = file_get_contents(__DIR__ . '/
|
42 |
|
43 |
$instant_article = InstantArticle::create();
|
44 |
$transformer = new Transformer();
|
45 |
$transformer->loadRules($json_file);
|
46 |
|
47 |
-
$html_file = file_get_contents(__DIR__ . '/
|
48 |
|
49 |
libxml_use_internal_errors(true);
|
50 |
$document = new \DOMDocument();
|
@@ -69,7 +68,7 @@ class CustomHTMLTransformerTest extends \PHPUnit_Framework_TestCase
|
|
69 |
$instant_article->addMetaProperty('op:generator:version', '1.0.0');
|
70 |
$instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0');
|
71 |
$result = $instant_article->render('', true)."\n";
|
72 |
-
$expected = file_get_contents(__DIR__ . '/
|
73 |
|
74 |
$this->assertEquals($expected, $result);
|
75 |
// there must be 3 warnings related to <img> inside <li> that is not supported by IA
|
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 |
{
|
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();
|
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 |
// there must be 3 warnings related to <img> inside <li> that is not supported by IA
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp-ia.xml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
<figure>
|
21 |
+
<img src="http://example.com/image0.jpg"/>
|
22 |
+
</figure>
|
23 |
+
<p>Some text after img.</p>
|
24 |
+
<p>Some text before img</p>
|
25 |
+
<figure>
|
26 |
+
<img src="http://example.com/image1.jpg"/>
|
27 |
+
</figure>
|
28 |
+
<p>Some text before img</p>
|
29 |
+
<figure>
|
30 |
+
<img src="http://example.com/image2.jpg"/>
|
31 |
+
</figure>
|
32 |
+
<p> and some after img.</p>
|
33 |
+
<ul>
|
34 |
+
<li>Some text on li before img</li>
|
35 |
+
<li>Some text on li before imgand after img</li>
|
36 |
+
<li>Some text after img</li>
|
37 |
+
</ul>
|
38 |
+
</article>
|
39 |
+
</body>
|
40 |
+
</html>
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp-rules.json
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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": "img",
|
65 |
+
"properties": {
|
66 |
+
"image.url": {
|
67 |
+
"type": "string",
|
68 |
+
"selector": "img",
|
69 |
+
"attribute": "src"
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}, {
|
73 |
+
"class": "ImageInsideParagraphRule",
|
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": "InteractiveRule",
|
122 |
+
"selector" : "div.interactive",
|
123 |
+
"properties" : {
|
124 |
+
"interactive.iframe" : {
|
125 |
+
"type" : "children",
|
126 |
+
"selector" : "div.interactive"
|
127 |
+
},
|
128 |
+
"interactive.height" : {
|
129 |
+
"type" : "int",
|
130 |
+
"selector" : "iframe",
|
131 |
+
"attribute": "height"
|
132 |
+
},
|
133 |
+
"interactive.iframe" : {
|
134 |
+
"type" : "children",
|
135 |
+
"selector" : "iframe"
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}, {
|
139 |
+
"class": "InteractiveRule",
|
140 |
+
"selector" : "//div[@class='interactive' and iframe]",
|
141 |
+
"properties" : {
|
142 |
+
"interactive.url" : {
|
143 |
+
"type" : "string",
|
144 |
+
"selector" : "iframe",
|
145 |
+
"attribute": "src"
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}, {
|
149 |
+
"class": "SlideshowImageRule",
|
150 |
+
"selector" : "figure",
|
151 |
+
"properties" : {
|
152 |
+
"image.url" : {
|
153 |
+
"type" : "string",
|
154 |
+
"selector" : "img",
|
155 |
+
"attribute": "src"
|
156 |
+
},
|
157 |
+
"caption.title" : {
|
158 |
+
"type" : "string",
|
159 |
+
"selector" : "figcaption"
|
160 |
+
}
|
161 |
+
}
|
162 |
+
}, {
|
163 |
+
"class": "SlideshowRule",
|
164 |
+
"selector" : "div.gallery"
|
165 |
+
}, {
|
166 |
+
"class": "CaptionRule",
|
167 |
+
"selector" : "figcaption"
|
168 |
+
},
|
169 |
+
{
|
170 |
+
"class": "ImageRule",
|
171 |
+
"selector" : "figure",
|
172 |
+
"properties" : {
|
173 |
+
"image.url" : {
|
174 |
+
"type" : "string",
|
175 |
+
"selector" : "img",
|
176 |
+
"attribute": "src"
|
177 |
+
}
|
178 |
+
}
|
179 |
+
}, {
|
180 |
+
"class": "VideoRule",
|
181 |
+
"selector" : "div.wp-video",
|
182 |
+
"containsChild": "video",
|
183 |
+
"properties" : {
|
184 |
+
"video.url" : {
|
185 |
+
"type" : "string",
|
186 |
+
"selector" : "source",
|
187 |
+
"attribute": "src"
|
188 |
+
},
|
189 |
+
"video.type" : {
|
190 |
+
"type" : "string",
|
191 |
+
"selector" : "source",
|
192 |
+
"attribute": "type"
|
193 |
+
}
|
194 |
+
}
|
195 |
+
}, {
|
196 |
+
"class": "InteractiveRule",
|
197 |
+
"selector" : "table",
|
198 |
+
"properties" : {
|
199 |
+
"interactive.iframe" : {
|
200 |
+
"type" : "element",
|
201 |
+
"selector" : "table"
|
202 |
+
}
|
203 |
+
}
|
204 |
+
}]
|
205 |
+
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/CMS/wp.html
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html><body><p>Yes, peace is good for everybody!<br>
|
3 |
+
Man kind.</p>
|
4 |
+
<p><img src="http://example.com/image0.jpg" />Some text after img.</p>
|
5 |
+
<p>Some text before img<img src="http://example.com/image1.jpg" /></p>
|
6 |
+
<p>Some text before img<img src="http://example.com/image2.jpg" /> and some after img.</p>
|
7 |
+
<ul>
|
8 |
+
<li>Some text on li before img<img src="http://example.com/image.jpg" width="600" height="360"/></li>
|
9 |
+
<li>Some text on li before img<img src="http://example.com/image.jpg" width="600" height="360"/>and after img</li>
|
10 |
+
<li><img src="http://example.com/image.jpg" width="600" height="360"/>Some text after img</li>
|
11 |
+
</ul>
|
12 |
+
</body></html>
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/simple-ia.html
CHANGED
@@ -26,41 +26,11 @@
|
|
26 |
<figcaption>Photographer</figcaption>
|
27 |
</figure>
|
28 |
<p>Curabitur vulputate odio eu justo <i>venenatis</i>, a pretium orci placerat. Nam sed neque quis eros vestibulum mattis. Donec vitae mi egestas, laoreet massa et, fringilla libero.</p>
|
29 |
-
<figure class="op-interactive">
|
30 |
-
<iframe>
|
31 |
-
<iframe width="620" height="349" src="https://www.youtube.com/embed/s1tN0ggNreA?feature=oembed" frameborder="0" allowfullscreen=""></iframe>
|
32 |
-
</iframe>
|
33 |
-
</figure>
|
34 |
<figure class="op-interactive">
|
35 |
<iframe>
|
36 |
<h1>Custom code for your social embed</h1>
|
37 |
<script>alert("test & more test");</script></iframe>
|
38 |
</figure>
|
39 |
-
<figure>
|
40 |
-
<img src="http://domain.com/image-header.png"/>
|
41 |
-
<figcaption>Some amazing moment captured by Photographer</figcaption>
|
42 |
-
</figure>
|
43 |
-
<figure>
|
44 |
-
<img src="http://domain.com/image-header.png?suffix=yes"/>
|
45 |
-
<figcaption>Some amazing moment captured by Photographer</figcaption>
|
46 |
-
</figure>
|
47 |
-
<figure>
|
48 |
-
<img src="http://domain.com/image-header.png?suffix=yes"/>
|
49 |
-
<figcaption>Some amazing moment captured by Photographer</figcaption>
|
50 |
-
</figure>
|
51 |
-
<footer>
|
52 |
-
<ul class="op-related-articles">
|
53 |
-
<li>
|
54 |
-
<a href="http://example.com/article.html"></a>
|
55 |
-
</li>
|
56 |
-
<li data-sponsored="true">
|
57 |
-
<a href="http://example.com/sponsored-article.html"></a>
|
58 |
-
</li>
|
59 |
-
<li>
|
60 |
-
<a href="http://example.com/another-article.html"></a>
|
61 |
-
</li>
|
62 |
-
</ul>
|
63 |
-
</footer>
|
64 |
</article>
|
65 |
</body>
|
66 |
</html>
|
26 |
<figcaption>Photographer</figcaption>
|
27 |
</figure>
|
28 |
<p>Curabitur vulputate odio eu justo <i>venenatis</i>, a pretium orci placerat. Nam sed neque quis eros vestibulum mattis. Donec vitae mi egestas, laoreet massa et, fringilla libero.</p>
|
|
|
|
|
|
|
|
|
|
|
29 |
<figure class="op-interactive">
|
30 |
<iframe>
|
31 |
<h1>Custom code for your social embed</h1>
|
32 |
<script>alert("test & more test");</script></iframe>
|
33 |
</figure>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
</article>
|
35 |
</body>
|
36 |
</html>
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/simple-rules.json
CHANGED
@@ -84,55 +84,6 @@
|
|
84 |
}
|
85 |
}
|
86 |
},
|
87 |
-
{
|
88 |
-
"class": "ImageRule",
|
89 |
-
"selector" : "div.prefix",
|
90 |
-
"properties" : {
|
91 |
-
"image.url" : {
|
92 |
-
"type" : "string",
|
93 |
-
"selector" : "img",
|
94 |
-
"attribute": "src",
|
95 |
-
"prefix": "http:"
|
96 |
-
},
|
97 |
-
"image.caption" : {
|
98 |
-
"type" : "element",
|
99 |
-
"selector" : "div.image-caption"
|
100 |
-
}
|
101 |
-
}
|
102 |
-
},
|
103 |
-
{
|
104 |
-
"class": "ImageRule",
|
105 |
-
"selector" : "div.suffix",
|
106 |
-
"properties" : {
|
107 |
-
"image.url" : {
|
108 |
-
"type" : "string",
|
109 |
-
"selector" : "img",
|
110 |
-
"attribute": "src",
|
111 |
-
"suffix": "?suffix=yes"
|
112 |
-
},
|
113 |
-
"image.caption" : {
|
114 |
-
"type" : "element",
|
115 |
-
"selector" : "div.image-caption"
|
116 |
-
}
|
117 |
-
}
|
118 |
-
},
|
119 |
-
{
|
120 |
-
"class": "ImageRule",
|
121 |
-
"selector" : "div.prefixsuffix",
|
122 |
-
"properties" : {
|
123 |
-
"image.url" : {
|
124 |
-
"type" : "string",
|
125 |
-
"selector" : "img",
|
126 |
-
"attribute": "src",
|
127 |
-
"prefix" : "http:",
|
128 |
-
"suffix": "?suffix=yes"
|
129 |
-
},
|
130 |
-
"image.caption" : {
|
131 |
-
"type" : "element",
|
132 |
-
"selector" : "div.image-caption"
|
133 |
-
}
|
134 |
-
}
|
135 |
-
},
|
136 |
{
|
137 |
"class": "HeaderImageRule",
|
138 |
"selector" : "div.hero-image",
|
@@ -157,42 +108,6 @@
|
|
157 |
"selector" : "*"
|
158 |
}
|
159 |
}
|
160 |
-
}
|
161 |
-
|
162 |
-
{
|
163 |
-
"class" : "FooterRule",
|
164 |
-
"selector" : "footer"
|
165 |
-
},
|
166 |
-
{
|
167 |
-
"class" : "RelatedArticlesRule",
|
168 |
-
"selector" : "ul.op-related-articles",
|
169 |
-
"properties" : {
|
170 |
-
"related.title" : {
|
171 |
-
"type" : "exists",
|
172 |
-
"selector" : "ul.op-related-articles",
|
173 |
-
"attribute" : "title"
|
174 |
-
}
|
175 |
-
}
|
176 |
-
},
|
177 |
-
{
|
178 |
-
"class" : "FooterRelatedArticlesRule",
|
179 |
-
"selector" : "ul.op-related-articles"
|
180 |
-
},
|
181 |
-
{
|
182 |
-
"class" : "RelatedItemRule",
|
183 |
-
"selector" : "li",
|
184 |
-
"properties" : {
|
185 |
-
"related.sponsored" : {
|
186 |
-
"type" : "exists",
|
187 |
-
"selector" : "li",
|
188 |
-
"attribute": "data-sponsored"
|
189 |
-
},
|
190 |
-
"related.url" : {
|
191 |
-
"type" : "string",
|
192 |
-
"selector" : "a",
|
193 |
-
"attribute" : "href"
|
194 |
-
}
|
195 |
-
}
|
196 |
-
}
|
197 |
]
|
198 |
}
|
84 |
}
|
85 |
}
|
86 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
{
|
88 |
"class": "HeaderImageRule",
|
89 |
"selector" : "div.hero-image",
|
108 |
"selector" : "*"
|
109 |
}
|
110 |
}
|
111 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
]
|
113 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/Example/simple.html
CHANGED
@@ -18,37 +18,9 @@
|
|
18 |
<img src="http://domain.com/image-body.png" alt="Photographer"/>
|
19 |
</div>
|
20 |
<p>Curabitur vulputate odio eu justo <i>venenatis</i>, a pretium orci placerat. Nam sed neque quis eros vestibulum mattis. Donec vitae mi egestas, laoreet massa et, fringilla libero.</p>
|
21 |
-
<div class="embed">
|
22 |
-
<iframe width="620" height="349" src="https://www.youtube.com/embed/s1tN0ggNreA?feature=oembed" frameborder="0" allowfullscreen></iframe>
|
23 |
-
</div>
|
24 |
<div class="embed">
|
25 |
<h1>Custom code for your social embed</h1>
|
26 |
<script>alert("test & more test");</script>
|
27 |
</div>
|
28 |
-
<div class="prefix">
|
29 |
-
<img src="//domain.com/image-header.png" />
|
30 |
-
<div class="image-caption">Some amazing moment captured by Photographer</div>
|
31 |
-
</div>
|
32 |
-
<div class="suffix">
|
33 |
-
<img src="http://domain.com/image-header.png" />
|
34 |
-
<div class="image-caption">Some amazing moment captured by Photographer</div>
|
35 |
-
</div>
|
36 |
-
<div class="prefixsuffix">
|
37 |
-
<img src="//domain.com/image-header.png" />
|
38 |
-
<div class="image-caption">Some amazing moment captured by Photographer</div>
|
39 |
-
</div>
|
40 |
-
<footer>
|
41 |
-
<ul class="op-related-articles">
|
42 |
-
<li>
|
43 |
-
<a href="http://example.com/article.html"></a>
|
44 |
-
</li>
|
45 |
-
<li data-sponsored="true">
|
46 |
-
<a href="http://example.com/sponsored-article.html"></a>
|
47 |
-
</li>
|
48 |
-
<li>
|
49 |
-
<a href="http://example.com/another-article.html"></a>
|
50 |
-
</li>
|
51 |
-
</ul>
|
52 |
-
</footer>
|
53 |
</body>
|
54 |
</html>
|
18 |
<img src="http://domain.com/image-body.png" alt="Photographer"/>
|
19 |
</div>
|
20 |
<p>Curabitur vulputate odio eu justo <i>venenatis</i>, a pretium orci placerat. Nam sed neque quis eros vestibulum mattis. Donec vitae mi egestas, laoreet massa et, fringilla libero.</p>
|
|
|
|
|
|
|
21 |
<div class="embed">
|
22 |
<h1>Custom code for your social embed</h1>
|
23 |
<script>alert("test & more test");</script>
|
24 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
</body>
|
26 |
</html>
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/TransformerTest.php
CHANGED
@@ -39,51 +39,6 @@ class TransformerTest extends \PHPUnit_Framework_TestCase
|
|
39 |
);
|
40 |
}
|
41 |
|
42 |
-
public function testTransformString()
|
43 |
-
{
|
44 |
-
$json_file = file_get_contents('src/Facebook/InstantArticles/Parser/instant-articles-rules.json');
|
45 |
-
|
46 |
-
$instant_article = InstantArticle::create();
|
47 |
-
$transformer = new Transformer();
|
48 |
-
$transformer->loadRules($json_file);
|
49 |
-
|
50 |
-
$title_html_string = '<h1>Title String</h1>';
|
51 |
-
$header = Header::create();
|
52 |
-
$transformer->transformString($header, $title_html_string);
|
53 |
-
|
54 |
-
$this->assertEquals('<h1>Title String</h1>', $header->getTitle()->render());
|
55 |
-
}
|
56 |
-
|
57 |
-
public function testTransformStringWithMultibyteUTF8Content()
|
58 |
-
{
|
59 |
-
$json_file = file_get_contents('src/Facebook/InstantArticles/Parser/instant-articles-rules.json');
|
60 |
-
|
61 |
-
$instant_article = InstantArticle::create();
|
62 |
-
$transformer = new Transformer();
|
63 |
-
$transformer->loadRules($json_file);
|
64 |
-
|
65 |
-
$title_html_string = '<h1>Test:あÖÄÜöäü</h1>';
|
66 |
-
$header = Header::create();
|
67 |
-
$transformer->transformString($header, $title_html_string);
|
68 |
-
|
69 |
-
$this->assertEquals('<h1>Test:あÖÄÜöäü</h1>', $header->getTitle()->render());
|
70 |
-
}
|
71 |
-
|
72 |
-
public function testTransformStringWithMultibyteNonUTF8Content()
|
73 |
-
{
|
74 |
-
$json_file = file_get_contents('src/Facebook/InstantArticles/Parser/instant-articles-rules.json');
|
75 |
-
|
76 |
-
$instant_article = InstantArticle::create();
|
77 |
-
$transformer = new Transformer();
|
78 |
-
$transformer->loadRules($json_file);
|
79 |
-
|
80 |
-
$title_html_string = mb_convert_encoding('<h1>Test:あÖÄÜöäü</h1>', 'euc-jp', 'utf-8');
|
81 |
-
$header = Header::create();
|
82 |
-
$transformer->transformString($header, $title_html_string, 'euc-jp');
|
83 |
-
|
84 |
-
$this->assertEquals('<h1>Test:あÖÄÜöäü</h1>', $header->getTitle()->render());
|
85 |
-
}
|
86 |
-
|
87 |
public function testSelfTransformerContent()
|
88 |
{
|
89 |
$json_file = file_get_contents('src/Facebook/InstantArticles/Parser/instant-articles-rules.json');
|
@@ -109,54 +64,6 @@ class TransformerTest extends \PHPUnit_Framework_TestCase
|
|
109 |
$this->assertEquals($html_file, $result);
|
110 |
}
|
111 |
|
112 |
-
public function testSelfTransformerMultibyteContent()
|
113 |
-
{
|
114 |
-
$json_file = file_get_contents('src/Facebook/InstantArticles/Parser/instant-articles-rules.json');
|
115 |
-
|
116 |
-
$instant_article = InstantArticle::create();
|
117 |
-
$transformer = new Transformer();
|
118 |
-
$transformer->loadRules($json_file);
|
119 |
-
|
120 |
-
$html_file = file_get_contents(__DIR__ . '/instant-article-example-multibyte.html');
|
121 |
-
|
122 |
-
$transformer->transformString($instant_article, $html_file, 'utf-8');
|
123 |
-
$instant_article->withCanonicalURL('http://foo.com/article.html');
|
124 |
-
$instant_article->addMetaProperty('op:generator:version', '1.0.0');
|
125 |
-
$instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0');
|
126 |
-
$result = $instant_article->render('', true)."\n";
|
127 |
-
|
128 |
-
// some fragments are written as html entities even after transformed so
|
129 |
-
// noralize all strings to html entities and compare them.
|
130 |
-
$this->assertEquals(
|
131 |
-
mb_convert_encoding($html_file, 'HTML-ENTITIES', 'utf-8'),
|
132 |
-
mb_convert_encoding($result, 'HTML-ENTITIES', 'utf-8')
|
133 |
-
);
|
134 |
-
}
|
135 |
-
|
136 |
-
public function testSelfTransformerNonUTF8Content()
|
137 |
-
{
|
138 |
-
$json_file = file_get_contents('src/Facebook/InstantArticles/Parser/instant-articles-rules.json');
|
139 |
-
|
140 |
-
$instant_article = InstantArticle::create();
|
141 |
-
$transformer = new Transformer();
|
142 |
-
$transformer->loadRules($json_file);
|
143 |
-
|
144 |
-
$html_file = file_get_contents(__DIR__ . '/instant-article-example-nonutf8.html');
|
145 |
-
|
146 |
-
$transformer->transformString($instant_article, $html_file, 'euc-jp');
|
147 |
-
$instant_article->withCanonicalURL('http://foo.com/article.html');
|
148 |
-
$instant_article->addMetaProperty('op:generator:version', '1.0.0');
|
149 |
-
$instant_article->addMetaProperty('op:generator:transformer:version', '1.0.0');
|
150 |
-
$result = $instant_article->render('', true)."\n";
|
151 |
-
|
152 |
-
// some fragments are written as html entities even after transformed so
|
153 |
-
// noralize all strings to html entities and compare them.
|
154 |
-
$this->assertEquals(
|
155 |
-
mb_convert_encoding($html_file, 'HTML-ENTITIES', 'euc-jp'),
|
156 |
-
mb_convert_encoding($result, 'HTML-ENTITIES', 'utf-8')
|
157 |
-
);
|
158 |
-
}
|
159 |
-
|
160 |
public function testTransformerAddAndGetRules()
|
161 |
{
|
162 |
$transformer = new Transformer();
|
@@ -186,4 +93,23 @@ class TransformerTest extends \PHPUnit_Framework_TestCase
|
|
186 |
$transformer->resetRules();
|
187 |
$this->assertEquals([], $transformer->getRules());
|
188 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
}
|
39 |
);
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
public function testSelfTransformerContent()
|
43 |
{
|
44 |
$json_file = file_get_contents('src/Facebook/InstantArticles/Parser/instant-articles-rules.json');
|
64 |
$this->assertEquals($html_file, $result);
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
public function testTransformerAddAndGetRules()
|
68 |
{
|
69 |
$transformer = new Transformer();
|
93 |
$transformer->resetRules();
|
94 |
$this->assertEquals([], $transformer->getRules());
|
95 |
}
|
96 |
+
|
97 |
+
public function testTitleTransformedWithBold()
|
98 |
+
{
|
99 |
+
$transformer = new Transformer();
|
100 |
+
$json_file = file_get_contents(__DIR__ . '/wp-rules.json');
|
101 |
+
$transformer->loadRules($json_file);
|
102 |
+
|
103 |
+
$title_html_string = '<?xml encoding="utf-8" ?><h1>Title <b>in bold</b></h1>';
|
104 |
+
|
105 |
+
libxml_use_internal_errors(true);
|
106 |
+
$document = new \DOMDocument();
|
107 |
+
$document->loadHtml($title_html_string);
|
108 |
+
libxml_use_internal_errors(false);
|
109 |
+
|
110 |
+
$header = Header::create();
|
111 |
+
$transformer->transform($header, $document);
|
112 |
+
|
113 |
+
$this->assertEquals('<h1>Title <b>in bold</b></h1>', $header->getTitle()->render());
|
114 |
+
}
|
115 |
}
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/custom-html-ia.xml
DELETED
@@ -1,202 +0,0 @@
|
|
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 |
-
<figure>
|
21 |
-
<img src="http://example.com/image0.jpg"/>
|
22 |
-
</figure>
|
23 |
-
<p>Some text after img.</p>
|
24 |
-
<p>Some text before img</p>
|
25 |
-
<figure>
|
26 |
-
<img src="http://example.com/image1.jpg"/>
|
27 |
-
</figure>
|
28 |
-
<p>Some text before img</p>
|
29 |
-
<figure>
|
30 |
-
<img src="http://example.com/image2.jpg"/>
|
31 |
-
</figure>
|
32 |
-
<p> and some after img.</p>
|
33 |
-
<figure class="op-interactive">
|
34 |
-
<iframe src="http://example.com/0/" class="no-margin" width="300" height="200"></iframe>
|
35 |
-
</figure>
|
36 |
-
<p>Some text before iframe</p>
|
37 |
-
<figure class="op-interactive">
|
38 |
-
<iframe src="http://example.com/1/" class="no-margin" width="300" height="200"></iframe>
|
39 |
-
</figure>
|
40 |
-
<figure class="op-interactive">
|
41 |
-
<iframe src="http://example.com/2/" class="no-margin" width="300" height="200"></iframe>
|
42 |
-
</figure>
|
43 |
-
<p> some after iframe.</p>
|
44 |
-
<p>Some text before iframe</p>
|
45 |
-
<figure class="op-interactive">
|
46 |
-
<iframe src="http://example.com/3/" class="no-margin" width="300" height="200"></iframe>
|
47 |
-
</figure>
|
48 |
-
<p> and some after iframe.</p>
|
49 |
-
<figure class="op-interactive">
|
50 |
-
<iframe src="http://example.com/loose/with_url" class="no-margin" width="300" height="200"></iframe>
|
51 |
-
</figure>
|
52 |
-
<figure class="op-interactive">
|
53 |
-
<iframe class="no-margin">
|
54 |
-
<div>
|
55 |
-
<h1>Iframe loose without url</h1>
|
56 |
-
</div>
|
57 |
-
</iframe>
|
58 |
-
</figure>
|
59 |
-
<figure class="op-interactive">
|
60 |
-
<iframe class="no-margin">
|
61 |
-
<div>
|
62 |
-
<h1>some embed here</h1>
|
63 |
-
</div>
|
64 |
-
</iframe>
|
65 |
-
</figure>
|
66 |
-
<figure class="op-interactive">
|
67 |
-
<iframe class="no-margin">
|
68 |
-
<div>
|
69 |
-
<h1>some embed here</h1>
|
70 |
-
</div>
|
71 |
-
</iframe>
|
72 |
-
</figure>
|
73 |
-
<figure class="op-interactive">
|
74 |
-
<iframe class="no-margin">
|
75 |
-
<div>some content</div>
|
76 |
-
<script>alert('hi & hello to you @ testing!');</script></iframe>
|
77 |
-
</figure>
|
78 |
-
<figure class="op-interactive">
|
79 |
-
<iframe src="http://example.com/4/" class="no-margin" width="300" height="200"></iframe>
|
80 |
-
</figure>
|
81 |
-
<figure class="op-interactive">
|
82 |
-
<iframe class="no-margin">
|
83 |
-
<div>some content</div>
|
84 |
-
<script>alert('hi & hello to you @ testing!');</script></iframe>
|
85 |
-
</figure>
|
86 |
-
<figure class="op-interactive">
|
87 |
-
<iframe src="http://example.com/4/" class="no-margin" width="300" height="200"></iframe>
|
88 |
-
</figure>
|
89 |
-
<figure class="op-interactive">
|
90 |
-
<iframe class="no-margin">
|
91 |
-
<div>some content</div>
|
92 |
-
<script>alert('hi & hello to you @ testing!');</script></iframe>
|
93 |
-
</figure>
|
94 |
-
<figure class="op-interactive">
|
95 |
-
<iframe class="no-margin" height="200">
|
96 |
-
<table width="200" height="200">
|
97 |
-
<thead><td>header 1</td>
|
98 |
-
<td>header 2</td>
|
99 |
-
</thead>
|
100 |
-
<tbody>
|
101 |
-
<tr><td>Line 1 column 1</td>
|
102 |
-
<td>Line 1 column 2</td>
|
103 |
-
</tr>
|
104 |
-
<tr><td>Line 2 column 1</td>
|
105 |
-
<td>Line 2 column 2</td>
|
106 |
-
</tr>
|
107 |
-
</tbody>
|
108 |
-
</table>
|
109 |
-
</iframe>
|
110 |
-
</figure>
|
111 |
-
<ul>
|
112 |
-
<li>Some text on li before img</li>
|
113 |
-
<li>Some text on li before imgand after img</li>
|
114 |
-
<li>Some text after img</li>
|
115 |
-
</ul>
|
116 |
-
<figure class="op-slideshow">
|
117 |
-
<figure>
|
118 |
-
<img src="http://example.com/img0.jpg"/>
|
119 |
-
</figure>
|
120 |
-
<figure>
|
121 |
-
<img src="http://example.com/img1.jpg"/>
|
122 |
-
</figure>
|
123 |
-
<figure>
|
124 |
-
<img src="http://example.com/img2.jpg"/>
|
125 |
-
<figcaption>Image 2</figcaption>
|
126 |
-
</figure>
|
127 |
-
<figure>
|
128 |
-
<img src="http://example.com/img3.jpg"/>
|
129 |
-
<figcaption>Image 3</figcaption>
|
130 |
-
</figure>
|
131 |
-
<figure>
|
132 |
-
<img src="http://example.com/img4.jpg"/>
|
133 |
-
</figure>
|
134 |
-
</figure>
|
135 |
-
<figure class="op-slideshow">
|
136 |
-
<figure>
|
137 |
-
<img src="http://example.com/img1.jpg"/>
|
138 |
-
<figcaption> Image 1 </figcaption>
|
139 |
-
</figure>
|
140 |
-
<figure>
|
141 |
-
<img src="http://example.com/img2.jpg"/>
|
142 |
-
<figcaption> Image 2 </figcaption>
|
143 |
-
</figure>
|
144 |
-
<figure>
|
145 |
-
<img src="http://example.com/img3.jpg"/>
|
146 |
-
<figcaption> Image 3 </figcaption>
|
147 |
-
</figure>
|
148 |
-
</figure>
|
149 |
-
<figure class="op-interactive">
|
150 |
-
<iframe class="no-margin">
|
151 |
-
<blockquote class="instagram-media" data-instgrm-captioned="" data-instgrm-version="6" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);">
|
152 |
-
<div style="padding:8px;">
|
153 |
-
<div style=" background:#F8F8F8; line-height:0; margin-top:40px; padding:62.5% 0; text-align:center; width:100%;">
|
154 |
-
<div style=" background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAMAAAApWqozAAAAGFBMVEUiIiI9PT0eHh4gIB4hIBkcHBwcHBwcHBydr+JQAAAACHRSTlMABA4YHyQsM5jtaMwAAADfSURBVDjL7ZVBEgMhCAQBAf//42xcNbpAqakcM0ftUmFAAIBE81IqBJdS3lS6zs3bIpB9WED3YYXFPmHRfT8sgyrCP1x8uEUxLMzNWElFOYCV6mHWWwMzdPEKHlhLw7NWJqkHc4uIZphavDzA2JPzUDsBZziNae2S6owH8xPmX8G7zzgKEOPUoYHvGz1TBCxMkd3kwNVbU0gKHkx+iZILf77IofhrY1nYFnB/lQPb79drWOyJVa/DAvg9B/rLB4cC+Nqgdz/TvBbBnr6GBReqn/nRmDgaQEej7WhonozjF+Y2I/fZou/qAAAAAElFTkSuQmCC); display:block; height:44px; margin:0 auto -44px; position:relative; top:-22px; width:44px;"></div>
|
155 |
-
</div>
|
156 |
-
<p style=" margin:8px 0 0 0; padding:0 4px;">
|
157 |
-
<a href="https://www.instagram.com/p/BAXbKP1POQe/" style=" color:#000; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none; word-wrap:break-word;" target="_blank">ð¸ @natthaponwuttipetch</a>
|
158 |
-
</p>
|
159 |
-
<p style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;">
|
160 |
-
A photo posted by Ann Hathairat Vidhyaphum (@annvidh) on <time style=" font-family:Arial,sans-serif; font-size:14px; line-height:17px;" datetime="2016-01-10T16:56:06+00:00">Jan 10, 2016 at 8:56am PST</time></p>
|
161 |
-
</div>
|
162 |
-
</blockquote>
|
163 |
-
<script async="" defer="defer" src="//platform.instagram.com/en_US/embeds.js"></script>
|
164 |
-
</iframe>
|
165 |
-
</figure>
|
166 |
-
<figure>
|
167 |
-
<img src="http://example.com/img.jpg"/>
|
168 |
-
<figcaption>blue eyes</figcaption>
|
169 |
-
</figure>
|
170 |
-
<figure class="op-interactive">
|
171 |
-
<iframe class="no-margin">
|
172 |
-
<h1>Sibling content</h1>
|
173 |
-
<div>sibling body</div><script src="//sibling.com/brother.js"></script></iframe>
|
174 |
-
</figure>
|
175 |
-
<p>Standard paragraph that <b>shouldn't</b> lie within the interactive block.</p>
|
176 |
-
<figure class="op-interactive">
|
177 |
-
<iframe class="no-margin">
|
178 |
-
<p>Extra markup</p>
|
179 |
-
<div class="fb-post" data-href="https://www.facebook.com/some-page/posts/some-post"></div>
|
180 |
-
</iframe>
|
181 |
-
</figure>
|
182 |
-
<figure class="op-slideshow">
|
183 |
-
<figure>
|
184 |
-
<img src="http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy-810x471.jpg"/>
|
185 |
-
<figcaption>Caption Img 1</figcaption>
|
186 |
-
</figure>
|
187 |
-
<figure>
|
188 |
-
<img src="http://example.com/a-vot-chto-vnutri.jpg"/>
|
189 |
-
<figcaption>Alternative text </figcaption>
|
190 |
-
</figure>
|
191 |
-
<figure>
|
192 |
-
<img src="http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj.jpg"/>
|
193 |
-
<figcaption>Caption img 3</figcaption>
|
194 |
-
</figure>
|
195 |
-
</figure>
|
196 |
-
<figure>
|
197 |
-
<img src="http://example.com/image.jpg"/>
|
198 |
-
<figcaption>caption</figcaption>
|
199 |
-
</figure>
|
200 |
-
</article>
|
201 |
-
</body>
|
202 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/custom-html-rules.json
DELETED
@@ -1,606 +0,0 @@
|
|
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" : "mark"
|
23 |
-
}, {
|
24 |
-
"class": "PassThroughRule",
|
25 |
-
"selector" : "span"
|
26 |
-
}, {
|
27 |
-
"class": "ParagraphRule",
|
28 |
-
"selector": "p"
|
29 |
-
}, {
|
30 |
-
"class": "LineBreakRule",
|
31 |
-
"selector": "br"
|
32 |
-
}, {
|
33 |
-
"class": "AnchorRule",
|
34 |
-
"selector": "a",
|
35 |
-
"properties": {
|
36 |
-
"anchor.href": {
|
37 |
-
"type": "string",
|
38 |
-
"selector": "a",
|
39 |
-
"attribute": "href"
|
40 |
-
},
|
41 |
-
"anchor.rel": {
|
42 |
-
"type": "string",
|
43 |
-
"selector": "a",
|
44 |
-
"attribute": "rel"
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}, {
|
48 |
-
"class": "BoldRule",
|
49 |
-
"selector": "b"
|
50 |
-
}, {
|
51 |
-
"class": "BoldRule",
|
52 |
-
"selector": "strong"
|
53 |
-
}, {
|
54 |
-
"class": "ItalicRule",
|
55 |
-
"selector": "i"
|
56 |
-
}, {
|
57 |
-
"class": "ItalicRule",
|
58 |
-
"selector": "em"
|
59 |
-
}, {
|
60 |
-
"class": "BlockquoteRule",
|
61 |
-
"selector": "blockquote"
|
62 |
-
}, {
|
63 |
-
"class": "PassThroughRule",
|
64 |
-
"selector": "blockquote p"
|
65 |
-
}, {
|
66 |
-
"class": "ImageInsideParagraphRule",
|
67 |
-
"selector": "img",
|
68 |
-
"properties": {
|
69 |
-
"image.url": {
|
70 |
-
"type": "string",
|
71 |
-
"selector": "img",
|
72 |
-
"attribute": "src"
|
73 |
-
}
|
74 |
-
}
|
75 |
-
},{
|
76 |
-
"class": "ImageRule",
|
77 |
-
"selector": "img",
|
78 |
-
"properties": {
|
79 |
-
"image.url": {
|
80 |
-
"type": "string",
|
81 |
-
"selector": "img",
|
82 |
-
"attribute": "src"
|
83 |
-
}
|
84 |
-
}
|
85 |
-
}, {
|
86 |
-
"class": "ListItemRule",
|
87 |
-
"selector" : "li"
|
88 |
-
}, {
|
89 |
-
"class": "ListElementRule",
|
90 |
-
"selector" : "ul"
|
91 |
-
}, {
|
92 |
-
"class": "ListElementRule",
|
93 |
-
"selector" : "ol"
|
94 |
-
}, {
|
95 |
-
"class": "BlockquoteRule",
|
96 |
-
"selector" : "blockquote"
|
97 |
-
}, {
|
98 |
-
"class": "H1Rule",
|
99 |
-
"selector" : "h1",
|
100 |
-
"properties" : {
|
101 |
-
"h1.class" : {
|
102 |
-
"type" : "string",
|
103 |
-
"selector" : "link",
|
104 |
-
"attribute": "class"
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}, {
|
108 |
-
"class": "H1Rule",
|
109 |
-
"selector" : "title"
|
110 |
-
}, {
|
111 |
-
"class": "H2Rule",
|
112 |
-
"selector" : "h2",
|
113 |
-
"properties" : {
|
114 |
-
"h2.class" : {
|
115 |
-
"type" : "string",
|
116 |
-
"selector" : "link",
|
117 |
-
"attribute": "class"
|
118 |
-
}
|
119 |
-
}
|
120 |
-
}, {
|
121 |
-
"class": "H2Rule",
|
122 |
-
"selector" : "h3,h4,h5,h6"
|
123 |
-
}, {
|
124 |
-
"class": "InteractiveRule",
|
125 |
-
"selector" : "blockquote.instagram-media",
|
126 |
-
"properties" : {
|
127 |
-
"interactive.iframe" : {
|
128 |
-
"type" : "multiple",
|
129 |
-
"children": [
|
130 |
-
{
|
131 |
-
"type": "element",
|
132 |
-
"selector": "blockquote"
|
133 |
-
}, {
|
134 |
-
"type": "next-sibling-element-of",
|
135 |
-
"selector": "blockquote"
|
136 |
-
}
|
137 |
-
]
|
138 |
-
}
|
139 |
-
}
|
140 |
-
}, {
|
141 |
-
"class": "InteractiveRule",
|
142 |
-
"selector" : "iframe",
|
143 |
-
"properties" : {
|
144 |
-
"interactive.url" : {
|
145 |
-
"type" : "string",
|
146 |
-
"selector" : "iframe",
|
147 |
-
"attribute": "src"
|
148 |
-
},
|
149 |
-
"interactive.width" : {
|
150 |
-
"type" : "int",
|
151 |
-
"selector" : "iframe",
|
152 |
-
"attribute": "width"
|
153 |
-
},
|
154 |
-
"interactive.height" : {
|
155 |
-
"type" : "int",
|
156 |
-
"selector" : "iframe",
|
157 |
-
"attribute": "height"
|
158 |
-
},
|
159 |
-
"interactive.iframe" : {
|
160 |
-
"type" : "children",
|
161 |
-
"selector" : "iframe"
|
162 |
-
}
|
163 |
-
}
|
164 |
-
}, {
|
165 |
-
"class": "InteractiveRule",
|
166 |
-
"selector" : "div.embed",
|
167 |
-
"properties" : {
|
168 |
-
"interactive.iframe" : {
|
169 |
-
"type" : "children",
|
170 |
-
"selector" : "div.embed"
|
171 |
-
},
|
172 |
-
"interactive.height" : {
|
173 |
-
"type" : "int",
|
174 |
-
"selector" : "iframe",
|
175 |
-
"attribute": "height"
|
176 |
-
},
|
177 |
-
"interactive.width" : {
|
178 |
-
"type" : "int",
|
179 |
-
"selector" : "iframe",
|
180 |
-
"attribute": "width"
|
181 |
-
}
|
182 |
-
}
|
183 |
-
}, {
|
184 |
-
"class": "InteractiveRule",
|
185 |
-
"selector" : "div.interactive",
|
186 |
-
"properties" : {
|
187 |
-
"interactive.iframe" : {
|
188 |
-
"type" : "children",
|
189 |
-
"selector" : "div.interactive"
|
190 |
-
},
|
191 |
-
"interactive.height" : {
|
192 |
-
"type" : "int",
|
193 |
-
"selector" : "iframe",
|
194 |
-
"attribute": "height"
|
195 |
-
},
|
196 |
-
"interactive.width" : {
|
197 |
-
"type" : "int",
|
198 |
-
"selector" : "iframe",
|
199 |
-
"attribute": "width"
|
200 |
-
}
|
201 |
-
}
|
202 |
-
}, {
|
203 |
-
"class": "InteractiveRule",
|
204 |
-
"selector" : "//div[@class='embed' and iframe]",
|
205 |
-
"properties" : {
|
206 |
-
"interactive.url" : {
|
207 |
-
"type" : "string",
|
208 |
-
"selector" : "iframe",
|
209 |
-
"attribute": "src"
|
210 |
-
},
|
211 |
-
"interactive.iframe" : {
|
212 |
-
"type" : "children",
|
213 |
-
"selector" : "iframe",
|
214 |
-
"attribute": "src"
|
215 |
-
},
|
216 |
-
"interactive.width" : {
|
217 |
-
"type" : "int",
|
218 |
-
"selector" : "iframe",
|
219 |
-
"attribute": "width"
|
220 |
-
},
|
221 |
-
"interactive.height" : {
|
222 |
-
"type" : "int",
|
223 |
-
"selector" : "iframe",
|
224 |
-
"attribute": "height"
|
225 |
-
}
|
226 |
-
}
|
227 |
-
}, {
|
228 |
-
"class": "InteractiveRule",
|
229 |
-
"selector" : "//div[@class='interactive' and iframe]",
|
230 |
-
"properties" : {
|
231 |
-
"interactive.url" : {
|
232 |
-
"type" : "string",
|
233 |
-
"selector" : "iframe",
|
234 |
-
"attribute": "src"
|
235 |
-
},
|
236 |
-
"interactive.iframe" : {
|
237 |
-
"type" : "children",
|
238 |
-
"selector" : "iframe"
|
239 |
-
},
|
240 |
-
"interactive.height" : {
|
241 |
-
"type" : "int",
|
242 |
-
"selector" : "iframe",
|
243 |
-
"attribute": "height"
|
244 |
-
},
|
245 |
-
"interactive.width" : {
|
246 |
-
"type" : "int",
|
247 |
-
"selector" : "iframe",
|
248 |
-
"attribute": "width"
|
249 |
-
}
|
250 |
-
}
|
251 |
-
}, {
|
252 |
-
"class": "InteractiveRule",
|
253 |
-
"selector" : "table",
|
254 |
-
"properties" : {
|
255 |
-
"interactive.iframe" : {
|
256 |
-
"type" : "element",
|
257 |
-
"selector" : "table"
|
258 |
-
},
|
259 |
-
"interactive.height" : {
|
260 |
-
"type" : "int",
|
261 |
-
"selector" : "table",
|
262 |
-
"attribute": "height"
|
263 |
-
},
|
264 |
-
"interactive.width" : {
|
265 |
-
"type" : "int",
|
266 |
-
"selector" : "iframe",
|
267 |
-
"attribute": "width"
|
268 |
-
}
|
269 |
-
}
|
270 |
-
}, {
|
271 |
-
"class": "InteractiveRule",
|
272 |
-
"selector" : "div.fb-post",
|
273 |
-
"properties" : {
|
274 |
-
"interactive.iframe" : {
|
275 |
-
"type": "multiple",
|
276 |
-
"children": [
|
277 |
-
{
|
278 |
-
"type": "fragment",
|
279 |
-
"fragment": "<p>Extra markup</p>"
|
280 |
-
},
|
281 |
-
{
|
282 |
-
"type" : "element",
|
283 |
-
"selector" : "div.fb-post"
|
284 |
-
}
|
285 |
-
]
|
286 |
-
}
|
287 |
-
}
|
288 |
-
}, {
|
289 |
-
"class": "InteractiveInsideParagraphRule",
|
290 |
-
"selector" : "iframe",
|
291 |
-
"properties" : {
|
292 |
-
"interactive.url" : {
|
293 |
-
"type" : "string",
|
294 |
-
"selector" : "iframe",
|
295 |
-
"attribute": "src"
|
296 |
-
},
|
297 |
-
"interactive.height" : {
|
298 |
-
"type" : "int",
|
299 |
-
"selector" : "iframe",
|
300 |
-
"attribute": "height"
|
301 |
-
},
|
302 |
-
"interactive.width" : {
|
303 |
-
"type" : "int",
|
304 |
-
"selector" : "iframe",
|
305 |
-
"attribute": "width"
|
306 |
-
}
|
307 |
-
}
|
308 |
-
},{
|
309 |
-
"class": "InteractiveInsideParagraphRule",
|
310 |
-
"selector" : "div.embed",
|
311 |
-
"properties" : {
|
312 |
-
"interactive.iframe" : {
|
313 |
-
"type" : "children",
|
314 |
-
"selector" : "div.embed"
|
315 |
-
},
|
316 |
-
"interactive.height" : {
|
317 |
-
"type" : "int",
|
318 |
-
"selector" : "iframe",
|
319 |
-
"attribute": "height"
|
320 |
-
},
|
321 |
-
"interactive.width" : {
|
322 |
-
"type" : "int",
|
323 |
-
"selector" : "iframe",
|
324 |
-
"attribute": "width"
|
325 |
-
}
|
326 |
-
}
|
327 |
-
}, {
|
328 |
-
"class": "InteractiveInsideParagraphRule",
|
329 |
-
"selector" : "div.interactive",
|
330 |
-
"properties" : {
|
331 |
-
"interactive.iframe" : {
|
332 |
-
"type" : "children",
|
333 |
-
"selector" : "div.interactive"
|
334 |
-
},
|
335 |
-
"interactive.height" : {
|
336 |
-
"type" : "int",
|
337 |
-
"selector" : "iframe",
|
338 |
-
"attribute": "height"
|
339 |
-
},
|
340 |
-
"interactive.width" : {
|
341 |
-
"type" : "int",
|
342 |
-
"selector" : "iframe",
|
343 |
-
"attribute": "width"
|
344 |
-
}
|
345 |
-
}
|
346 |
-
}, {
|
347 |
-
"class": "InteractiveInsideParagraphRule",
|
348 |
-
"selector" : "//div[@class='embed' and iframe]",
|
349 |
-
"properties" : {
|
350 |
-
"interactive.url" : {
|
351 |
-
"type" : "string",
|
352 |
-
"selector" : "iframe",
|
353 |
-
"attribute": "src"
|
354 |
-
},
|
355 |
-
"interactive.iframe" : {
|
356 |
-
"type" : "children",
|
357 |
-
"selector" : "iframe",
|
358 |
-
"attribute": "src"
|
359 |
-
},
|
360 |
-
"interactive.width" : {
|
361 |
-
"type" : "int",
|
362 |
-
"selector" : "iframe",
|
363 |
-
"attribute": "width"
|
364 |
-
},
|
365 |
-
"interactive.height" : {
|
366 |
-
"type" : "int",
|
367 |
-
"selector" : "iframe",
|
368 |
-
"attribute": "height"
|
369 |
-
}
|
370 |
-
}
|
371 |
-
}, {
|
372 |
-
"class": "InteractiveInsideParagraphRule",
|
373 |
-
"selector" : "//div[@class='interactive' and iframe]",
|
374 |
-
"properties" : {
|
375 |
-
"interactive.url" : {
|
376 |
-
"type" : "string",
|
377 |
-
"selector" : "iframe",
|
378 |
-
"attribute": "src"
|
379 |
-
},
|
380 |
-
"interactive.iframe" : {
|
381 |
-
"type" : "children",
|
382 |
-
"selector" : "iframe",
|
383 |
-
"attribute": "src"
|
384 |
-
},
|
385 |
-
"interactive.height" : {
|
386 |
-
"type" : "int",
|
387 |
-
"selector" : "iframe",
|
388 |
-
"attribute": "height"
|
389 |
-
},
|
390 |
-
"interactive.width" : {
|
391 |
-
"type" : "int",
|
392 |
-
"selector" : "iframe",
|
393 |
-
"attribute": "width"
|
394 |
-
}
|
395 |
-
}
|
396 |
-
}, {
|
397 |
-
"class": "InteractiveInsideParagraphRule",
|
398 |
-
"selector" : "table",
|
399 |
-
"properties" : {
|
400 |
-
"interactive.iframe" : {
|
401 |
-
"type" : "element",
|
402 |
-
"selector" : "table"
|
403 |
-
},
|
404 |
-
"interactive.height" : {
|
405 |
-
"type" : "int",
|
406 |
-
"selector" : "table",
|
407 |
-
"attribute": "height"
|
408 |
-
},
|
409 |
-
"interactive.width" : {
|
410 |
-
"type" : "int",
|
411 |
-
"selector" : "table",
|
412 |
-
"attribute": "width"
|
413 |
-
}
|
414 |
-
}
|
415 |
-
}, {
|
416 |
-
"class": "SlideshowImageRule",
|
417 |
-
"selector" : "figure",
|
418 |
-
"properties" : {
|
419 |
-
"image.url" : {
|
420 |
-
"type" : "string",
|
421 |
-
"selector" : "img",
|
422 |
-
"attribute": "src"
|
423 |
-
},
|
424 |
-
"caption.title" : {
|
425 |
-
"type" : "string",
|
426 |
-
"selector" : "figcaption"
|
427 |
-
}
|
428 |
-
}
|
429 |
-
}, {
|
430 |
-
"class": "SlideshowRule",
|
431 |
-
"selector" : "div.gallery"
|
432 |
-
}, {
|
433 |
-
"class": "CaptionRule",
|
434 |
-
"selector" : "figcaption"
|
435 |
-
}, {
|
436 |
-
"class": "CaptionRule",
|
437 |
-
"selector" : "p.wp-caption-text"
|
438 |
-
}, {
|
439 |
-
"class": "ImageRule",
|
440 |
-
"selector" : "figure",
|
441 |
-
"properties" : {
|
442 |
-
"image.url" : {
|
443 |
-
"type" : "string",
|
444 |
-
"selector" : "img",
|
445 |
-
"attribute": "src"
|
446 |
-
}
|
447 |
-
}
|
448 |
-
}, {
|
449 |
-
"class": "VideoRule",
|
450 |
-
"selector" : "div.wp-video",
|
451 |
-
"containsChild": "video",
|
452 |
-
"properties" : {
|
453 |
-
"video.url" : {
|
454 |
-
"type" : "string",
|
455 |
-
"selector" : "source",
|
456 |
-
"attribute": "src"
|
457 |
-
},
|
458 |
-
"video.type" : {
|
459 |
-
"type" : "string",
|
460 |
-
"selector" : "source",
|
461 |
-
"attribute": "type"
|
462 |
-
}
|
463 |
-
}
|
464 |
-
},
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
{
|
469 |
-
"class" : "IgnoreRule",
|
470 |
-
"selector" : "p.jetpack-slideshow-noscript"
|
471 |
-
},
|
472 |
-
{
|
473 |
-
"class": "CaptionRule",
|
474 |
-
"selector" : "div.wp-caption-text"
|
475 |
-
},
|
476 |
-
{
|
477 |
-
"class" : "PassThroughRule",
|
478 |
-
"selector" : "div.gallery-row"
|
479 |
-
},
|
480 |
-
{
|
481 |
-
"class" : "PassThroughRule",
|
482 |
-
"selector" : "div.tiled-gallery p"
|
483 |
-
},
|
484 |
-
{
|
485 |
-
"class" : "PassThroughRule",
|
486 |
-
"selector" : "div.gallery-row p"
|
487 |
-
},
|
488 |
-
{
|
489 |
-
"class" : "PassThroughRule",
|
490 |
-
"selector" : "div.gallery-group p"
|
491 |
-
},
|
492 |
-
{
|
493 |
-
"class" : "PassThroughRule",
|
494 |
-
"selector" : "div.gallery-group"
|
495 |
-
},
|
496 |
-
{
|
497 |
-
"class": "ImageRule",
|
498 |
-
"selector" : "div.wp-caption",
|
499 |
-
"properties" : {
|
500 |
-
"image.url" : {
|
501 |
-
"type" : "string",
|
502 |
-
"selector" : "img",
|
503 |
-
"attribute": "src"
|
504 |
-
}
|
505 |
-
}
|
506 |
-
},
|
507 |
-
{
|
508 |
-
"class": "SlideshowImageRule",
|
509 |
-
"selector" : "div.tiled-gallery-item",
|
510 |
-
"properties" : {
|
511 |
-
"image.url" : {
|
512 |
-
"type" : "string",
|
513 |
-
"selector" : "img",
|
514 |
-
"attribute": "data-orig-file"
|
515 |
-
},
|
516 |
-
"caption.title" : {
|
517 |
-
"type" : "string",
|
518 |
-
"selector" : "div.tiled-gallery-caption"
|
519 |
-
}
|
520 |
-
}
|
521 |
-
},
|
522 |
-
{
|
523 |
-
"class": "SlideshowRule",
|
524 |
-
"selector" : "div.tiled-gallery"
|
525 |
-
},
|
526 |
-
{
|
527 |
-
"class": "SlideshowRule",
|
528 |
-
"selector" : "div.tiled-gallery"
|
529 |
-
},
|
530 |
-
{
|
531 |
-
"class": "Compat\\JetpackSlideshowRule",
|
532 |
-
"selector" : "div.jetpack-slideshow",
|
533 |
-
"properties": {
|
534 |
-
"jetpack.data-gallery": {
|
535 |
-
"type": "json",
|
536 |
-
"selector": "div.jetpack-slideshow",
|
537 |
-
"attribute": "data-gallery"
|
538 |
-
}
|
539 |
-
}
|
540 |
-
},
|
541 |
-
{
|
542 |
-
"class": "CaptionRule",
|
543 |
-
"selector" : "div.tiled-gallery-caption"
|
544 |
-
},
|
545 |
-
{
|
546 |
-
"class" : "PassThroughRule",
|
547 |
-
"selector" : "div.vce-gallery-big"
|
548 |
-
},
|
549 |
-
{
|
550 |
-
"class" : "PassThroughRule",
|
551 |
-
"selector" : "div.vce-gallery-small"
|
552 |
-
},
|
553 |
-
{
|
554 |
-
"class" : "IgnoreRule",
|
555 |
-
"selector" : "div.vce-gallery-slider"
|
556 |
-
},
|
557 |
-
{
|
558 |
-
"class": "SlideshowImageRule",
|
559 |
-
"selector" : "div.big-gallery-item",
|
560 |
-
"properties" : {
|
561 |
-
"image.url" : {
|
562 |
-
"type" : "string",
|
563 |
-
"selector" : "img",
|
564 |
-
"attribute": "src"
|
565 |
-
},
|
566 |
-
"caption.title" : {
|
567 |
-
"type" : "string",
|
568 |
-
"selector" : "figcaption.wp-caption-text"
|
569 |
-
}
|
570 |
-
}
|
571 |
-
},
|
572 |
-
|
573 |
-
|
574 |
-
{
|
575 |
-
"class": "ImageInsideParagraphRule",
|
576 |
-
"selector": "figure.wp-caption",
|
577 |
-
"properties": {
|
578 |
-
"image.url": {
|
579 |
-
"type": "string",
|
580 |
-
"selector": "img",
|
581 |
-
"attribute": "src"
|
582 |
-
}
|
583 |
-
}
|
584 |
-
},
|
585 |
-
|
586 |
-
{
|
587 |
-
"class": "InteractiveRule",
|
588 |
-
"selector" : "iframe.sibling",
|
589 |
-
"properties" : {
|
590 |
-
"interactive.iframe" : {
|
591 |
-
"type" : "multiple",
|
592 |
-
"children": [
|
593 |
-
{
|
594 |
-
"type": "children",
|
595 |
-
"selector": "iframe"
|
596 |
-
}, {
|
597 |
-
"type": "next-sibling-element-of",
|
598 |
-
"selector": "iframe",
|
599 |
-
"sibling.selector": "script"
|
600 |
-
}
|
601 |
-
]
|
602 |
-
}
|
603 |
-
}
|
604 |
-
}
|
605 |
-
]
|
606 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/custom.html
DELETED
@@ -1,221 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html>
|
3 |
-
<body>
|
4 |
-
<p>Yes, peace is good for everybody!<br>
|
5 |
-
Man kind.</p>
|
6 |
-
<p><img src="http://example.com/image0.jpg" />Some text after img.</p>
|
7 |
-
<p>Some text before img<img src="http://example.com/image1.jpg" /></p>
|
8 |
-
<p>Some text before img<img src="http://example.com/image2.jpg" /> and some after img.</p>
|
9 |
-
<p><iframe width="300" height="200" src="http://example.com/0/"/></p>
|
10 |
-
<p>Some text before iframe<iframe width="300" height="200" src="http://example.com/1/"/></p>
|
11 |
-
<p><iframe width="300" height="200" src="http://example.com/2/"></iframe> some after iframe.</p>
|
12 |
-
<p>Some text before iframe<iframe width="300" height="200" src="http://example.com/3/"/> and some after iframe.</p>
|
13 |
-
<iframe width="300" height="200" src="http://example.com/loose/with_url"></iframe>
|
14 |
-
<iframe>
|
15 |
-
<div>
|
16 |
-
<h1>Iframe loose without url</h1>
|
17 |
-
</div>
|
18 |
-
</iframe>
|
19 |
-
<div class="embed">
|
20 |
-
<div>
|
21 |
-
<h1>some embed here</h1>
|
22 |
-
</div>
|
23 |
-
</div>
|
24 |
-
<div class="interactive">
|
25 |
-
<div>
|
26 |
-
<h1>some embed here</h1>
|
27 |
-
</div>
|
28 |
-
</div>
|
29 |
-
<div class="interactive">
|
30 |
-
<iframe>
|
31 |
-
<div>some content</div>
|
32 |
-
<script>alert('hi & hello to you @ testing!');</script>
|
33 |
-
</iframe>
|
34 |
-
</div>
|
35 |
-
<div class="interactive">
|
36 |
-
<iframe width="300" height="200" src="http://example.com/4/"></iframe>
|
37 |
-
</div>
|
38 |
-
<div class="interactive">
|
39 |
-
<iframe>
|
40 |
-
<div>some content</div>
|
41 |
-
<script>alert('hi & hello to you @ testing!');</script>
|
42 |
-
</iframe>
|
43 |
-
</div>
|
44 |
-
<div class="embed">
|
45 |
-
<iframe width="300" height="200" src="http://example.com/4/"></iframe>
|
46 |
-
</div>
|
47 |
-
<div class="embed">
|
48 |
-
<iframe>
|
49 |
-
<div>some content</div>
|
50 |
-
<script>alert('hi & hello to you @ testing!');</script>
|
51 |
-
</iframe>
|
52 |
-
</div>
|
53 |
-
<table width="200" height="200">
|
54 |
-
<thead>
|
55 |
-
<td>header 1</td>
|
56 |
-
<td>header 2</td>
|
57 |
-
</thead>
|
58 |
-
<tbody>
|
59 |
-
<tr>
|
60 |
-
<td>Line 1 column 1</td>
|
61 |
-
<td>Line 1 column 2</td>
|
62 |
-
</tr>
|
63 |
-
<tr>
|
64 |
-
<td>Line 2 column 1</td>
|
65 |
-
<td>Line 2 column 2</td>
|
66 |
-
</tr>
|
67 |
-
</tbody>
|
68 |
-
</table>
|
69 |
-
<ul>
|
70 |
-
<li>Some text on li before img<img src="http://example.com/image.jpg" width="600" height="360"/></li>
|
71 |
-
<li>Some text on li before img<img src="http://example.com/image.jpg" width="600" height="360"/>and after img</li>
|
72 |
-
<li><img src="http://example.com/image.jpg" width="600" height="360"/>Some text after img</li>
|
73 |
-
</ul>
|
74 |
-
<p class="jetpack-slideshow-noscript robots-nocontent">This slideshow requires JavaScript.</p>
|
75 |
-
<div
|
76 |
-
class="slideshow-window jetpack-slideshow slideshow-black"
|
77 |
-
data-trans="fade" data-autostart="1"
|
78 |
-
data-gallery="[{"src":"http:\/\/example.com/img0.jpg","id":"434","title":"img0","alt":"","caption":"","itemprop":"image"},{"src":"http:\/\/example.com\/img1.jpg","id":"474","title":"img1","alt":"","caption":"","itemprop":"image"},{"src":"http:\/\/example.com\/img2.jpg","id":"470","title":"img2","alt":"","caption":"Image 2","itemprop":"image"},{"src":"http:\/\/example.com\/img3.jpg","id":"466","title":"Image 3","alt":"","caption":"Image 3","itemprop":"image"},{"src":"http:\/\/example.com\/img4.jpg","id":"462","title":"img4","alt":"","caption":"","itemprop":"image"}]"
|
79 |
-
itemscope itemtype="http://schema.org/ImageGallery">
|
80 |
-
</div>
|
81 |
-
|
82 |
-
<div class="tiled-gallery type-rectangular tiled-gallery-unresized" >
|
83 |
-
<div class="gallery-row">
|
84 |
-
<div class="gallery-group images-1">
|
85 |
-
<div class="tiled-gallery-item tiled-gallery-item-large">
|
86 |
-
<a href="http://www.diegoquinteiro.com/15-razoes-para-ser-contra-o-impeachment/forum/">
|
87 |
-
<meta itemprop="width" content="318">
|
88 |
-
<meta itemprop="height" content="211">
|
89 |
-
<img data-orig-file="http://example.com/img1.jpg"
|
90 |
-
data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="Forum" data-image-description="" data-medium-file="http://http://example.com/img1.jpg" data-large-file="http://example.com/img1.jpg" src="http://example.com/img1.jpg?resize=318%2C211"
|
91 |
-
width="318" height="211" data-original-width="318" data-original-height="211" title="Forum" alt="riots" style="width: 318px; height: 211px;" />
|
92 |
-
</a>
|
93 |
-
<div class="tiled-gallery-caption" itemprop="caption description"> Image 1 </div>
|
94 |
-
</p>
|
95 |
-
</div>
|
96 |
-
</p>
|
97 |
-
</div>
|
98 |
-
<p> <!-- close group -->
|
99 |
-
<div class="gallery-group images-2">
|
100 |
-
<div class="tiled-gallery-item tiled-gallery-item-small" itemprop="associatedMedia">
|
101 |
-
<a href="http://example.com/link" border="0" itemprop="url">
|
102 |
-
<meta itemprop="width" content="174">
|
103 |
-
<meta itemprop="height" content="109">
|
104 |
-
<img data-attachment-id="519" data-orig-file="http://example.com/img2.jpg" data-orig-size="2078,1310" data-comments-opened="" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="Chaplin – Fábrica" data-image-description="" data-medium-file="http://example.com/img2.jpg" data-large-file="http://example.com/img2.jpg" src="http://example.com/img2.jpg?resize=174%2C109" width="174" height="109" data-original-width="174" data-original-height="109" itemprop="http://schema.org/image" title="Image Title" alt="chaplin" style="width: 174px; height: 109px;" />
|
105 |
-
</a>
|
106 |
-
<div class="tiled-gallery-caption" itemprop="caption description"> Image 2 </div>
|
107 |
-
</p>
|
108 |
-
</div>
|
109 |
-
<div class="tiled-gallery-item tiled-gallery-item-small" itemprop="associatedMedia">
|
110 |
-
<a href="http://example.com/link" border="0" itemprop="url">
|
111 |
-
<meta itemprop="width" content="174">
|
112 |
-
<meta itemprop="height" content="98">
|
113 |
-
<img data-attachment-id="532" data-orig-file="http://example.com/img3.jpg" data-image-meta="{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data-image-title="highlight image" data-image-description="" data-medium-file="http://www.diegoquinteiro.com/wp-content/uploads/2016/06/highlight-image-300x169.jpg" data-large-file="http://www.diegoquinteiro.com/wp-content/uploads/2016/06/highlight-image-1024x576.jpg" src="http://i1.wp.com/www.diegoquinteiro.com/wp-content/uploads/2016/06/highlight-image.jpg?resize=174%2C98" width="174" height="98" data-original-width="174" data-original-height="98" itemprop="http://schema.org/image" title="highlight image" alt="Dog cat" style="width: 174px; height: 98px;" />
|
114 |
-
</a>
|
115 |
-
<div class="tiled-gallery-caption" itemprop="caption description"> Image 3 </div>
|
116 |
-
</p>
|
117 |
-
</div>
|
118 |
-
</p>
|
119 |
-
</div>
|
120 |
-
<p> <!-- close group -->
|
121 |
-
</div>
|
122 |
-
<p> <!-- close row -->
|
123 |
-
</div>
|
124 |
-
<blockquote class="instagram-media" data-instgrm-captioned data-instgrm-version="6" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);">
|
125 |
-
<div style="padding:8px;">
|
126 |
-
<div style=" background:#F8F8F8; line-height:0; margin-top:40px; padding:62.5% 0; text-align:center; width:100%;">
|
127 |
-
<div style=" background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAMAAAApWqozAAAAGFBMVEUiIiI9PT0eHh4gIB4hIBkcHBwcHBwcHBydr+JQAAAACHRSTlMABA4YHyQsM5jtaMwAAADfSURBVDjL7ZVBEgMhCAQBAf//42xcNbpAqakcM0ftUmFAAIBE81IqBJdS3lS6zs3bIpB9WED3YYXFPmHRfT8sgyrCP1x8uEUxLMzNWElFOYCV6mHWWwMzdPEKHlhLw7NWJqkHc4uIZphavDzA2JPzUDsBZziNae2S6owH8xPmX8G7zzgKEOPUoYHvGz1TBCxMkd3kwNVbU0gKHkx+iZILf77IofhrY1nYFnB/lQPb79drWOyJVa/DAvg9B/rLB4cC+Nqgdz/TvBbBnr6GBReqn/nRmDgaQEej7WhonozjF+Y2I/fZou/qAAAAAElFTkSuQmCC); display:block; height:44px; margin:0 auto -44px; position:relative; top:-22px; width:44px;"></div>
|
128 |
-
</div>
|
129 |
-
<p style=" margin:8px 0 0 0; padding:0 4px;">
|
130 |
-
<a href="https://www.instagram.com/p/BAXbKP1POQe/" style=" color:#000; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none; word-wrap:break-word;" target="_blank">📸 @natthaponwuttipetch</a>
|
131 |
-
</p>
|
132 |
-
<p style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;">
|
133 |
-
A photo posted by Ann Hathairat Vidhyaphum (@annvidh) on <time style=" font-family:Arial,sans-serif; font-size:14px; line-height:17px;" datetime="2016-01-10T16:56:06+00:00">Jan 10, 2016 at 8:56am PST</time>
|
134 |
-
</p>
|
135 |
-
</div>
|
136 |
-
</blockquote>
|
137 |
-
<script async defer src="//platform.instagram.com/en_US/embeds.js"></script>
|
138 |
-
<p>
|
139 |
-
<figure style="width: 1280px" class="wp-caption alignnone">
|
140 |
-
<img src="http://example.com/img.jpg" width="1280" height="740" class />
|
141 |
-
<br />
|
142 |
-
<figcaption class="wp-caption-text">blue eyes</figcaption>
|
143 |
-
</figure>
|
144 |
-
</p>
|
145 |
-
<iframe class="sibling">
|
146 |
-
<h1>Sibling content</h1>
|
147 |
-
<div>sibling body</div></iframe>
|
148 |
-
<script src="//sibling.com/brother.js"></script>
|
149 |
-
<p>Standard paragraph that <b>shouldn't</b> lie within the interactive block.</p>
|
150 |
-
<div class="fb-post" data-href="https://www.facebook.com/some-page/posts/some-post"></div>
|
151 |
-
|
152 |
-
<div id="gallery-3" class="vce-gallery gallery galleryid-15219 gallery-columns-3 gallery-size-vce-lay-b">
|
153 |
-
<div class="vce-gallery-big">
|
154 |
-
<div class="big-gallery-item item-0">
|
155 |
-
<div class="gallery-icon">
|
156 |
-
<a href="http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy.jpg"><img width="810" height="471" src="http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy-810x471.jpg" class="attachment-vce-lay-a size-vce-lay-a" alt="Caption Img 1" srcset="http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy-810x471.jpg 810w, http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy-300x174.jpg 300w, http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy-768x447.jpg 768w, http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy.jpg 860w" sizes="(max-width: 810px) 100vw, 810px"></a>
|
157 |
-
</div>
|
158 |
-
<figcaption class="wp-caption-text gallery-caption">Caption Img 1</figcaption>
|
159 |
-
</div>
|
160 |
-
<div class="big-gallery-item item-1" style="display:none;">
|
161 |
-
<div class="gallery-icon">
|
162 |
-
<a href="http://example.com/a-vot-chto-vnutri.jpg">
|
163 |
-
<img width="699" height="443" src="http://example.com/a-vot-chto-vnutri.jpg" class="attachment-vce-lay-a size-vce-lay-a" alt="Alternative text" srcset="http://example.com/a-vot-chto-vnutri.jpg 699w, http://example.com/a-vot-chto-vnutri-300x190.jpg 300w" sizes="(max-width: 699px) 100vw, 699px">
|
164 |
-
</a>
|
165 |
-
</div>
|
166 |
-
<figcaption class="wp-caption-text gallery-caption">Alternative text </figcaption>
|
167 |
-
</div>
|
168 |
-
<div class="big-gallery-item item-2" style="display:none;">
|
169 |
-
<div class="gallery-icon">
|
170 |
-
<a href="http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj.jpg">
|
171 |
-
<img width="700" height="467" src="http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj.jpg" class="attachment-vce-lay-a size-vce-lay-a" alt="Caption img 3" srcset="http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj.jpg 700w, http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj-300x200.jpg 300w" sizes="(max-width: 700px) 100vw, 700px">
|
172 |
-
</a>
|
173 |
-
</div>
|
174 |
-
<figcaption class="wp-caption-text gallery-caption">Caption img 3</figcaption>
|
175 |
-
</div>
|
176 |
-
</div>
|
177 |
-
<div class="vce-gallery-slider owl-carousel owl-theme owl-loaded owl-text-select-on" data-columns="3">
|
178 |
-
<div class="owl-stage-outer">
|
179 |
-
<div class="owl-stage" style="transform: translate3d(-761px, 0px, 0px); transition: 0s; width: 3551.34px;">
|
180 |
-
<div class="owl-item active" style="width: 252.667px; margin-right: 1px;">
|
181 |
-
<figure class="gallery-item" data-item="0">
|
182 |
-
<div class="gallery-icon landscape">
|
183 |
-
<a href="http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy.jpg"><img width="375" height="195" src="http://example.com/konservnye-banki-osobenno-lyubyat-yaponcy-375x195.jpg" class="attachment-vce-lay-b size-vce-lay-b" alt="Caption Img 1"></a>
|
184 |
-
</div>
|
185 |
-
</figure>
|
186 |
-
</div>
|
187 |
-
<div class="owl-item active" style="width: 252.667px; margin-right: 1px;">
|
188 |
-
<figure class="gallery-item" data-item="1">
|
189 |
-
<div class="gallery-icon landscape">
|
190 |
-
<a href="http://example.com/a-vot-chto-vnutri.jpg"><img width="375" height="195" src="http://example.com/a-vot-chto-vnutri-375x195.jpg" class="attachment-vce-lay-b size-vce-lay-b" alt="Alternative text"></a>
|
191 |
-
</div>
|
192 |
-
</figure>
|
193 |
-
</div>
|
194 |
-
<div class="owl-item active" style="width: 252.667px; margin-right: 1px;">
|
195 |
-
<figure class="gallery-item" data-item="2">
|
196 |
-
<div class="gallery-icon landscape">
|
197 |
-
<a href="http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj.jpg"><img width="375" height="195" src="http://example.com/brelok-s-bezopasnostyu-vsegda-s-soboj-375x195.jpg" class="attachment-vce-lay-b size-vce-lay-b" alt="Caption img 3"></a>
|
198 |
-
</div>
|
199 |
-
</figure>
|
200 |
-
</div>
|
201 |
-
</div>
|
202 |
-
</div>
|
203 |
-
<div class="owl-controls">
|
204 |
-
<div class="owl-nav">
|
205 |
-
<div class="owl-prev" style=""><i class="fa fa-angle-left"></i></div>
|
206 |
-
<div class="owl-next" style=""><i class="fa fa-angle-right"></i></div>
|
207 |
-
</div>
|
208 |
-
<div class="owl-dots" style="">
|
209 |
-
<div class="owl-dot active"><span></span></div>
|
210 |
-
<div class="owl-dot"><span></span></div>
|
211 |
-
<div class="owl-dot"><span></span></div>
|
212 |
-
</div>
|
213 |
-
</div>
|
214 |
-
</div>
|
215 |
-
</div>
|
216 |
-
<div id="attachment_22553" style="width: 800px" class="wp-caption alignnone">
|
217 |
-
<img class="wp-image-22553 size-large" src="http://example.com/image.jpg" alt="alt text" width="800" height="552" srcset="http://example.com/image-800.jpg 800w, http://example.com/image-400.jpg 400w, http://example.com/image-768.jpg 768w" sizes="(max-width: 800px) 100vw, 800px" />
|
218 |
-
<p class="wp-caption-text">caption</p>
|
219 |
-
</div>
|
220 |
-
</body>
|
221 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/instant-article-example-multibyte.html
DELETED
@@ -1,204 +0,0 @@
|
|
1 |
-
<html>
|
2 |
-
<head>
|
3 |
-
<link rel="canonical" href="http://foo.com/article.html"/>
|
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 |
-
<figure>
|
15 |
-
<img src="https://jpeg.org/images/jpegls-home.jpg"/>
|
16 |
-
<figcaption><h1>イメージ名</h1>テキストノード<cite>イメージキャプション</cite></figcaption>
|
17 |
-
</figure>
|
18 |
-
<h1>ビッグトップ <b>タイトル</b></h1>
|
19 |
-
<h2>スモール <b>サブタイトル</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">著者名</a>
|
23 |
-
著者に関する詳しい情報
|
24 |
-
さらなる詳細
|
25 |
-
</address>
|
26 |
-
<address><a href="http://facebook.com/author" rel="facebook">FB上の著者</a>
|
27 |
-
facebook内の著者情報
|
28 |
-
</address>
|
29 |
-
<address><a title="PHP Programmer">開発者</a>
|
30 |
-
</address>
|
31 |
-
<h3 class="op-kicker">記事のキッカー</h3>
|
32 |
-
<ul class="op-sponsors">
|
33 |
-
<li>
|
34 |
-
<a href="http://facebook.com/my-sponsor" rel="facebook"></a>
|
35 |
-
</li>
|
36 |
-
</ul>
|
37 |
-
</header>
|
38 |
-
<p>パラグラフ内のテキストのテストです。</p>
|
39 |
-
<figure data-feedback="fb:likes">
|
40 |
-
<img src="http://mydomain.com/path/to/img.jpg"/>
|
41 |
-
<audio title="オーディオタイトル" autoplay="autoplay" muted="muted">
|
42 |
-
<source src="http://foo.com/mp3"/>
|
43 |
-
</audio>
|
44 |
-
</figure>
|
45 |
-
<figure data-feedback="fb:comments">
|
46 |
-
<img src="http://mydomain.com/path/to/img.jpg"/>
|
47 |
-
<script type="application/json" class="op-geotag">
|
48 |
-
{
|
49 |
-
"type": "Feature",
|
50 |
-
"geometry": {
|
51 |
-
"type": "Point",
|
52 |
-
"coordinates": [23.166667, 89.216667]
|
53 |
-
},
|
54 |
-
"properties": {
|
55 |
-
"title": "バングラデシュ ジョソール県",
|
56 |
-
"radius": 750000,
|
57 |
-
"pivot": true,
|
58 |
-
"style": "satellite",
|
59 |
-
}
|
60 |
-
}
|
61 |
-
</script>
|
62 |
-
<audio title="オーディオタイトル" autoplay="autoplay" muted="muted">
|
63 |
-
<source src="http://foo.com/mp3"/>
|
64 |
-
</audio>
|
65 |
-
</figure>
|
66 |
-
<figure data-feedback="fb:likes,fb:comments">
|
67 |
-
<img src="https://jpeg.org/images/jpegls-home.jpg"/>
|
68 |
-
<figcaption><h1>イメージ名</h1>テキストノード<cite>イメージキャプション</cite></figcaption>
|
69 |
-
</figure>
|
70 |
-
<p>第2段落内のテキストのテストです。</p>
|
71 |
-
<figure class="op-slideshow">
|
72 |
-
<figure>
|
73 |
-
<img src="https://jpeg.org/images/jpegls-home.jpg"/>
|
74 |
-
</figure>
|
75 |
-
<figure>
|
76 |
-
<img src="https://jpeg.org/images/jpegls-home2.jpg"/>
|
77 |
-
</figure>
|
78 |
-
<figure>
|
79 |
-
<img src="https://jpeg.org/images/jpegls-home3.jpg"/>
|
80 |
-
</figure>
|
81 |
-
<figcaption><h1>イメージ名</h1>テキストノード<cite>イメージキャプション</cite></figcaption>
|
82 |
-
<audio title="オーディオタイトル" autoplay="autoplay" muted="muted">
|
83 |
-
<source src="http://foo.com/mp3"/>
|
84 |
-
</audio>
|
85 |
-
</figure>
|
86 |
-
<ol>
|
87 |
-
<li>最初のリスト項目</li>
|
88 |
-
<li>パラグラフ</li>
|
89 |
-
<li>spanタグ</li>
|
90 |
-
<li>div内のテキスト?</li>
|
91 |
-
<li>li上のその他の <a href="#">段落</a></li>
|
92 |
-
<li>最後のリスト項目</li>
|
93 |
-
</ol>
|
94 |
-
<p>段落内のテキストのテストです。</p>
|
95 |
-
<figure class="op-interactive">
|
96 |
-
<iframe src="http://example.com/custom-interactive" class="column-width" height="60">
|
97 |
-
<h1>カスタムコード</h1>
|
98 |
-
<script>alert("テスト");</script></iframe>
|
99 |
-
<figcaption>このグラフィックは素晴らしい。</figcaption>
|
100 |
-
</figure>
|
101 |
-
<figure class="op-ad">
|
102 |
-
<iframe src="http://foo.com"></iframe>
|
103 |
-
</figure>
|
104 |
-
<blockquote>blockquoteは記事の中で<b>magic</b>を作ります。</blockquote>
|
105 |
-
<figure class="op-map">
|
106 |
-
<script type="application/json" class="op-geotag">
|
107 |
-
{
|
108 |
-
"type": "Feature",
|
109 |
-
"geometry":
|
110 |
-
{
|
111 |
-
"type": "Point",
|
112 |
-
"coordinates": [23.166667, 89.216667]
|
113 |
-
},
|
114 |
-
"properties":
|
115 |
-
{
|
116 |
-
"title": "バングラデシュ ジョソール県",
|
117 |
-
"radius": 750000,
|
118 |
-
"pivot": true,
|
119 |
-
"style": "satellite",
|
120 |
-
}
|
121 |
-
}
|
122 |
-
</script>
|
123 |
-
<figcaption class="op-vertical-above"><h1 class="op-vertical-above op-center">キャプション用タイトル</h1><h2 class="op-vertical-below op-right">キャプション用サブタイトル</h2>
|
124 |
-
|
125 |
-
|
126 |
-
<cite class="op-vertical-center op-left">キャプション内のクレジット</cite></figcaption>
|
127 |
-
<audio title="audio title" autoplay="autoplay" muted="muted">
|
128 |
-
<source src="http://foo.com/mp3"/>
|
129 |
-
</audio>
|
130 |
-
</figure>
|
131 |
-
<aside>
|
132 |
-
私たちはどこで成長させるか、何を成長させるか、どうやって成長させるか、について、もっと効率的になれるはずです。
|
133 |
-
<cite>フルーツストカンパニー</cite></aside>
|
134 |
-
<p>第2段落内のテキストのテストです。</p>
|
135 |
-
<figure class="op-tracker">
|
136 |
-
<iframe>
|
137 |
-
<h1>カスタムコード</h1>
|
138 |
-
<script>alert("テスト");</script></iframe>
|
139 |
-
</figure>
|
140 |
-
<figure class="op-tracker">
|
141 |
-
<iframe>
|
142 |
-
<h1>トラッカー用スクリプト</h1>
|
143 |
-
<div><script>alert("テスト");</script></div>
|
144 |
-
</iframe>
|
145 |
-
</figure>
|
146 |
-
<figure class="op-interactive">
|
147 |
-
<iframe class="no-margin">
|
148 |
-
<h1>ソーシャル埋め込み用カスタムコード</h1>
|
149 |
-
<script>alert("テスト");</script></iframe>
|
150 |
-
</figure>
|
151 |
-
<figure data-mode="fullscreen" data-feedback="fb:likes,fb:comments">
|
152 |
-
<video data-fb-disable-autoplay="data-fb-disable-autoplay" controls="controls">
|
153 |
-
<source src="http://mydomain.com/path/to/video.mp4" type="video/mp4"/>
|
154 |
-
</video>
|
155 |
-
<figcaption class="op-vertical-below"><h1>ビデオタイトル</h1>
|
156 |
-
|
157 |
-
<cite>属性ソース</cite></figcaption>
|
158 |
-
<script type="application/json" class="op-geotag">
|
159 |
-
{
|
160 |
-
"type": "Feature",
|
161 |
-
"geometry": {
|
162 |
-
"type": "Point",
|
163 |
-
"coordinates": [ [23.166667, 89.216667], [23.166667, 89.216667] ]
|
164 |
-
},
|
165 |
-
"properties": {
|
166 |
-
"title": "バングラデシュ ジョソール県",
|
167 |
-
"radius": 750000,
|
168 |
-
"pivot": true,
|
169 |
-
"style": "satellite",
|
170 |
-
}
|
171 |
-
}
|
172 |
-
</script>
|
173 |
-
</figure>
|
174 |
-
<ul class="op-related-articles" title="The related ones in the middle">
|
175 |
-
<li>
|
176 |
-
<a href="http://example.com/article.html"></a>
|
177 |
-
</li>
|
178 |
-
<li data-sponsored="true">
|
179 |
-
<a href="http://example.com/sponsored-article.html"></a>
|
180 |
-
</li>
|
181 |
-
<li>
|
182 |
-
<a href="http://example.com/another-article.html"></a>
|
183 |
-
</li>
|
184 |
-
</ul>
|
185 |
-
<footer>
|
186 |
-
<aside>
|
187 |
-
<p><a href="http://facebook.com/author" rel="facebook">著者</a>へのクレジット情報</p>
|
188 |
-
<p>クレジットとしてのパラグラフ</p>
|
189 |
-
</aside>
|
190 |
-
<ul class="op-related-articles">
|
191 |
-
<li>
|
192 |
-
<a href="http://example.com/article.html"></a>
|
193 |
-
</li>
|
194 |
-
<li data-sponsored="true">
|
195 |
-
<a href="http://example.com/sponsored-article.html"></a>
|
196 |
-
</li>
|
197 |
-
<li>
|
198 |
-
<a href="http://example.com/another-article.html"></a>
|
199 |
-
</li>
|
200 |
-
</ul>
|
201 |
-
</footer>
|
202 |
-
</article>
|
203 |
-
</body>
|
204 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/instant-article-example-nonutf8.html
DELETED
@@ -1,204 +0,0 @@
|
|
1 |
-
<html>
|
2 |
-
<head>
|
3 |
-
<link rel="canonical" href="http://foo.com/article.html"/>
|
4 |
-
<meta charset="euc-jp"/>
|
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 |
-
<figure>
|
15 |
-
<img src="https://jpeg.org/images/jpegls-home.jpg"/>
|
16 |
-
<figcaption><h1>�����̾</h1>�ƥ����ȥΡ���<cite>���������ץ����</cite></figcaption>
|
17 |
-
</figure>
|
18 |
-
<h1>�ӥå��ȥå� <b>�����ȥ�</b></h1>
|
19 |
-
<h2>���⡼�� <b>���֥����ȥ�</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">����̾</a>
|
23 |
-
���Ԥ˴ؤ���ܤ�������
|
24 |
-
����ʤ�ܺ�
|
25 |
-
</address>
|
26 |
-
<address><a href="http://facebook.com/author" rel="facebook">FB�������</a>
|
27 |
-
facebook������Ծ���
|
28 |
-
</address>
|
29 |
-
<address><a title="PHP Programmer">��ȯ��</a>
|
30 |
-
</address>
|
31 |
-
<h3 class="op-kicker">�����Υ��å���</h3>
|
32 |
-
<ul class="op-sponsors">
|
33 |
-
<li>
|
34 |
-
<a href="http://facebook.com/my-sponsor" rel="facebook"></a>
|
35 |
-
</li>
|
36 |
-
</ul>
|
37 |
-
</header>
|
38 |
-
<p>�ѥ饰�����Υƥ����ȤΥƥ��ȤǤ���</p>
|
39 |
-
<figure data-feedback="fb:likes">
|
40 |
-
<img src="http://mydomain.com/path/to/img.jpg"/>
|
41 |
-
<audio title="オーディオタイトル" autoplay="autoplay" muted="muted">
|
42 |
-
<source src="http://foo.com/mp3"/>
|
43 |
-
</audio>
|
44 |
-
</figure>
|
45 |
-
<figure data-feedback="fb:comments">
|
46 |
-
<img src="http://mydomain.com/path/to/img.jpg"/>
|
47 |
-
<script type="application/json" class="op-geotag">
|
48 |
-
{
|
49 |
-
"type": "Feature",
|
50 |
-
"geometry": {
|
51 |
-
"type": "Point",
|
52 |
-
"coordinates": [23.166667, 89.216667]
|
53 |
-
},
|
54 |
-
"properties": {
|
55 |
-
"title": "�Х�ǥ��塡���祽���븩",
|
56 |
-
"radius": 750000,
|
57 |
-
"pivot": true,
|
58 |
-
"style": "satellite",
|
59 |
-
}
|
60 |
-
}
|
61 |
-
</script>
|
62 |
-
<audio title="オーディオタイトル" autoplay="autoplay" muted="muted">
|
63 |
-
<source src="http://foo.com/mp3"/>
|
64 |
-
</audio>
|
65 |
-
</figure>
|
66 |
-
<figure data-feedback="fb:likes,fb:comments">
|
67 |
-
<img src="https://jpeg.org/images/jpegls-home.jpg"/>
|
68 |
-
<figcaption><h1>�����̾</h1>�ƥ����ȥΡ���<cite>���������ץ����</cite></figcaption>
|
69 |
-
</figure>
|
70 |
-
<p>��2������Υƥ����ȤΥƥ��ȤǤ���</p>
|
71 |
-
<figure class="op-slideshow">
|
72 |
-
<figure>
|
73 |
-
<img src="https://jpeg.org/images/jpegls-home.jpg"/>
|
74 |
-
</figure>
|
75 |
-
<figure>
|
76 |
-
<img src="https://jpeg.org/images/jpegls-home2.jpg"/>
|
77 |
-
</figure>
|
78 |
-
<figure>
|
79 |
-
<img src="https://jpeg.org/images/jpegls-home3.jpg"/>
|
80 |
-
</figure>
|
81 |
-
<figcaption><h1>�����̾</h1>�ƥ����ȥΡ���<cite>���������ץ����</cite></figcaption>
|
82 |
-
<audio title="オーディオタイトル" autoplay="autoplay" muted="muted">
|
83 |
-
<source src="http://foo.com/mp3"/>
|
84 |
-
</audio>
|
85 |
-
</figure>
|
86 |
-
<ol>
|
87 |
-
<li>�ǽ�Υꥹ�ȹ���</li>
|
88 |
-
<li>�ѥ饰���</li>
|
89 |
-
<li>span����</li>
|
90 |
-
<li>div��Υƥ����ȡ�</li>
|
91 |
-
<li>li��Τ���¾�� <a href="#">����</a></li>
|
92 |
-
<li>�Ǹ�Υꥹ�ȹ���</li>
|
93 |
-
</ol>
|
94 |
-
<p>������Υƥ����ȤΥƥ��ȤǤ���</p>
|
95 |
-
<figure class="op-interactive">
|
96 |
-
<iframe src="http://example.com/custom-interactive" class="column-width" height="60">
|
97 |
-
<h1>�������ॳ����</h1>
|
98 |
-
<script>alert("�ƥ���");</script></iframe>
|
99 |
-
<figcaption>���Υ���ե��å��������餷����</figcaption>
|
100 |
-
</figure>
|
101 |
-
<figure class="op-ad">
|
102 |
-
<iframe src="http://foo.com"></iframe>
|
103 |
-
</figure>
|
104 |
-
<blockquote>blockquote�ϵ��������<b>magic</b>����ޤ���</blockquote>
|
105 |
-
<figure class="op-map">
|
106 |
-
<script type="application/json" class="op-geotag">
|
107 |
-
{
|
108 |
-
"type": "Feature",
|
109 |
-
"geometry":
|
110 |
-
{
|
111 |
-
"type": "Point",
|
112 |
-
"coordinates": [23.166667, 89.216667]
|
113 |
-
},
|
114 |
-
"properties":
|
115 |
-
{
|
116 |
-
"title": "�Х�ǥ��塡���祽���븩",
|
117 |
-
"radius": 750000,
|
118 |
-
"pivot": true,
|
119 |
-
"style": "satellite",
|
120 |
-
}
|
121 |
-
}
|
122 |
-
</script>
|
123 |
-
<figcaption class="op-vertical-above"><h1 class="op-vertical-above op-center">����ץ�����ѥ����ȥ�</h1><h2 class="op-vertical-below op-right">����ץ�����ѥ��֥����ȥ�</h2>
|
124 |
-
|
125 |
-
|
126 |
-
<cite class="op-vertical-center op-left">����ץ������Υ��쥸�å�</cite></figcaption>
|
127 |
-
<audio title="audio title" autoplay="autoplay" muted="muted">
|
128 |
-
<source src="http://foo.com/mp3"/>
|
129 |
-
</audio>
|
130 |
-
</figure>
|
131 |
-
<aside>
|
132 |
-
�䤿���Ϥɤ�����Ĺ�����뤫��������Ĺ�����뤫���ɤ���ä���Ĺ�����뤫���ˤĤ��ơ���äȸ�ΨŪ�ˤʤ��Ϥ��Ǥ���
|
133 |
-
<cite>�ե롼�ĥ��ȥ���ѥˡ�</cite></aside>
|
134 |
-
<p>��2������Υƥ����ȤΥƥ��ȤǤ���</p>
|
135 |
-
<figure class="op-tracker">
|
136 |
-
<iframe>
|
137 |
-
<h1>�������ॳ����</h1>
|
138 |
-
<script>alert("�ƥ���");</script></iframe>
|
139 |
-
</figure>
|
140 |
-
<figure class="op-tracker">
|
141 |
-
<iframe>
|
142 |
-
<h1>�ȥ�å����ѥ�����ץ�</h1>
|
143 |
-
<div><script>alert("�ƥ���");</script></div>
|
144 |
-
</iframe>
|
145 |
-
</figure>
|
146 |
-
<figure class="op-interactive">
|
147 |
-
<iframe class="no-margin">
|
148 |
-
<h1>����������������ѥ������ॳ����</h1>
|
149 |
-
<script>alert("�ƥ���");</script></iframe>
|
150 |
-
</figure>
|
151 |
-
<figure data-mode="fullscreen" data-feedback="fb:likes,fb:comments">
|
152 |
-
<video data-fb-disable-autoplay="data-fb-disable-autoplay" controls="controls">
|
153 |
-
<source src="http://mydomain.com/path/to/video.mp4" type="video/mp4"/>
|
154 |
-
</video>
|
155 |
-
<figcaption class="op-vertical-below"><h1>�ӥǥ������ȥ�</h1>
|
156 |
-
|
157 |
-
<cite>°��������</cite></figcaption>
|
158 |
-
<script type="application/json" class="op-geotag">
|
159 |
-
{
|
160 |
-
"type": "Feature",
|
161 |
-
"geometry": {
|
162 |
-
"type": "Point",
|
163 |
-
"coordinates": [ [23.166667, 89.216667], [23.166667, 89.216667] ]
|
164 |
-
},
|
165 |
-
"properties": {
|
166 |
-
"title": "�Х�ǥ��塡���祽���븩",
|
167 |
-
"radius": 750000,
|
168 |
-
"pivot": true,
|
169 |
-
"style": "satellite",
|
170 |
-
}
|
171 |
-
}
|
172 |
-
</script>
|
173 |
-
</figure>
|
174 |
-
<ul class="op-related-articles" title="The related ones in the middle">
|
175 |
-
<li>
|
176 |
-
<a href="http://example.com/article.html"></a>
|
177 |
-
</li>
|
178 |
-
<li data-sponsored="true">
|
179 |
-
<a href="http://example.com/sponsored-article.html"></a>
|
180 |
-
</li>
|
181 |
-
<li>
|
182 |
-
<a href="http://example.com/another-article.html"></a>
|
183 |
-
</li>
|
184 |
-
</ul>
|
185 |
-
<footer>
|
186 |
-
<aside>
|
187 |
-
<p><a href="http://facebook.com/author" rel="facebook">����</a>�ؤΥ��쥸�åȾ���</p>
|
188 |
-
<p>���쥸�åȤȤ��ƤΥѥ饰���</p>
|
189 |
-
</aside>
|
190 |
-
<ul class="op-related-articles">
|
191 |
-
<li>
|
192 |
-
<a href="http://example.com/article.html"></a>
|
193 |
-
</li>
|
194 |
-
<li data-sponsored="true">
|
195 |
-
<a href="http://example.com/sponsored-article.html"></a>
|
196 |
-
</li>
|
197 |
-
<li>
|
198 |
-
<a href="http://example.com/another-article.html"></a>
|
199 |
-
</li>
|
200 |
-
</ul>
|
201 |
-
</footer>
|
202 |
-
</article>
|
203 |
-
</body>
|
204 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/instant-article-example.html
CHANGED
@@ -187,7 +187,7 @@
|
|
187 |
<p>Some plaintext credits to<a href="http://facebook.com/author" rel="facebook">Author</a></p>
|
188 |
<p>Paragraph text as credits</p>
|
189 |
</aside>
|
190 |
-
<ul class="op-related-articles">
|
191 |
<li>
|
192 |
<a href="http://example.com/article.html"></a>
|
193 |
</li>
|
187 |
<p>Some plaintext credits to<a href="http://facebook.com/author" rel="facebook">Author</a></p>
|
188 |
<p>Paragraph text as credits</p>
|
189 |
</aside>
|
190 |
+
<ul class="op-related-articles" title="The related ones in the footer">
|
191 |
<li>
|
192 |
<a href="http://example.com/article.html"></a>
|
193 |
</li>
|
vendor/facebook/facebook-instant-articles-sdk-php/tests/Facebook/InstantArticles/Transformer/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/graph-sdk/phpcs.xml.dist
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<ruleset>
|
3 |
-
<file>src/</file>
|
4 |
-
<file>tests/</file>
|
5 |
-
<arg value="spn" />
|
6 |
-
<rule ref="PSR2" />
|
7 |
-
</ruleset>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/graph-sdk/src/Facebook/PseudoRandomString/RandomBytesPseudoRandomStringGenerator.php
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2017 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
|
7 |
-
* form for use in connection with the web services and APIs provided by
|
8 |
-
* Facebook.
|
9 |
-
*
|
10 |
-
* As with any software that integrates with the Facebook platform, your use
|
11 |
-
* of this software is subject to the Facebook Developer Principles and
|
12 |
-
* Policies [http://developers.facebook.com/policy/]. This copyright notice
|
13 |
-
* shall be included in all copies or substantial portions of the software.
|
14 |
-
*
|
15 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
18 |
-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20 |
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21 |
-
* DEALINGS IN THE SOFTWARE.
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
namespace Facebook\PseudoRandomString;
|
25 |
-
|
26 |
-
use Facebook\Exceptions\FacebookSDKException;
|
27 |
-
|
28 |
-
class RandomBytesPseudoRandomStringGenerator implements PseudoRandomStringGeneratorInterface
|
29 |
-
{
|
30 |
-
use PseudoRandomStringGeneratorTrait;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* @const string The error message when generating the string fails.
|
34 |
-
*/
|
35 |
-
const ERROR_MESSAGE = 'Unable to generate a cryptographically secure pseudo-random string from random_bytes(). ';
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @throws FacebookSDKException
|
39 |
-
*/
|
40 |
-
public function __construct()
|
41 |
-
{
|
42 |
-
if (!function_exists('random_bytes')) {
|
43 |
-
throw new FacebookSDKException(
|
44 |
-
static::ERROR_MESSAGE .
|
45 |
-
'The function random_bytes() does not exist.'
|
46 |
-
);
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
/**
|
51 |
-
* @inheritdoc
|
52 |
-
*/
|
53 |
-
public function getPseudoRandomString($length)
|
54 |
-
{
|
55 |
-
$this->validateLength($length);
|
56 |
-
|
57 |
-
return $this->binToHex(random_bytes($length), $length);
|
58 |
-
}
|
59 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/facebook/{graph-sdk → php-sdk-v4}/LICENSE
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/composer.json
RENAMED
@@ -1,14 +1,14 @@
|
|
1 |
{
|
2 |
-
"name": "facebook/
|
3 |
"description": "Facebook SDK for PHP",
|
4 |
"keywords": ["facebook", "sdk"],
|
5 |
"type": "library",
|
6 |
-
"homepage": "https://github.com/facebook/php-
|
7 |
"license": "Facebook Platform",
|
8 |
"authors": [
|
9 |
{
|
10 |
"name": "Facebook",
|
11 |
-
"homepage": "https://github.com/facebook/php-
|
12 |
}
|
13 |
],
|
14 |
"require": {
|
@@ -20,7 +20,6 @@
|
|
20 |
"guzzlehttp/guzzle": "~5.0"
|
21 |
},
|
22 |
"suggest": {
|
23 |
-
"paragonie/random_compat": "Provides a better CSPRNG option in PHP 5",
|
24 |
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
|
25 |
},
|
26 |
"autoload": {
|
1 |
{
|
2 |
+
"name": "facebook/php-sdk-v4",
|
3 |
"description": "Facebook SDK for PHP",
|
4 |
"keywords": ["facebook", "sdk"],
|
5 |
"type": "library",
|
6 |
+
"homepage": "https://github.com/facebook/facebook-php-sdk-v4",
|
7 |
"license": "Facebook Platform",
|
8 |
"authors": [
|
9 |
{
|
10 |
"name": "Facebook",
|
11 |
+
"homepage": "https://github.com/facebook/facebook-php-sdk-v4/contributors"
|
12 |
}
|
13 |
],
|
14 |
"require": {
|
20 |
"guzzlehttp/guzzle": "~5.0"
|
21 |
},
|
22 |
"suggest": {
|
|
|
23 |
"guzzlehttp/guzzle": "Allows for implementation of the Guzzle HTTP client"
|
24 |
},
|
25 |
"autoload": {
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Authentication/AccessToken.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Authentication/AccessTokenMetadata.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Authentication/OAuth2Client.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookAuthenticationException.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookAuthorizationException.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookClientException.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookOtherException.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookResponseException.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookResumableUploadException.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookSDKException.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookServerException.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Exceptions/FacebookThrottleException.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Facebook.php
RENAMED
@@ -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,12 +53,12 @@ class Facebook
|
|
53 |
/**
|
54 |
* @const string Version number of the Facebook PHP SDK.
|
55 |
*/
|
56 |
-
const VERSION = '5.
|
57 |
|
58 |
/**
|
59 |
* @const string Default Graph API version for requests.
|
60 |
*/
|
61 |
-
const DEFAULT_GRAPH_VERSION = 'v2.
|
62 |
|
63 |
/**
|
64 |
* @const string The name of the environment variable that contains the app ID.
|
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.2.0';
|
57 |
|
58 |
/**
|
59 |
* @const string Default Graph API version for requests.
|
60 |
*/
|
61 |
+
const DEFAULT_GRAPH_VERSION = 'v2.6';
|
62 |
|
63 |
/**
|
64 |
* @const string The name of the environment variable that contains the app ID.
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FacebookApp.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/FacebookBatchRequest.php
RENAMED
@@ -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
|
@@ -168,6 +168,8 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate,
|
|
168 |
|
169 |
/**
|
170 |
* Prepares the requests to be sent as a batch request.
|
|
|
|
|
171 |
*/
|
172 |
public function prepareRequestsForBatch()
|
173 |
{
|
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
|
168 |
|
169 |
/**
|
170 |
* Prepares the requests to be sent as a batch request.
|
171 |
+
*
|
172 |
+
* @return string
|
173 |
*/
|
174 |
public function prepareRequestsForBatch()
|
175 |
{
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FacebookBatchResponse.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/FacebookClient.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/FacebookRequest.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/FacebookResponse.php
RENAMED
@@ -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
|
@@ -213,7 +213,7 @@ class FacebookResponse
|
|
213 |
/**
|
214 |
* Returns the exception that was thrown for this request.
|
215 |
*
|
216 |
-
* @return
|
217 |
*/
|
218 |
public function getThrownException()
|
219 |
{
|
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
|
213 |
/**
|
214 |
* Returns the exception that was thrown for this request.
|
215 |
*
|
216 |
+
* @return FacebookSDKException|null
|
217 |
*/
|
218 |
public function getThrownException()
|
219 |
{
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/FileUpload/FacebookFile.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/FileUpload/FacebookResumableUploader.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/FileUpload/FacebookTransferChunk.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/FileUpload/FacebookVideo.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/FileUpload/Mimetypes.php
RENAMED
@@ -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
|
@@ -724,7 +724,6 @@ class Mimetypes
|
|
724 |
'spq' => 'application/scvp-vp-request',
|
725 |
'spx' => 'audio/ogg',
|
726 |
'src' => 'application/x-wais-source',
|
727 |
-
'srt' => 'application/octet-stream',
|
728 |
'sru' => 'application/sru+xml',
|
729 |
'srx' => 'application/sparql-results+xml',
|
730 |
'sse' => 'application/vnd.kodak-descriptor',
|
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
|
724 |
'spq' => 'application/scvp-vp-request',
|
725 |
'spx' => 'audio/ogg',
|
726 |
'src' => 'application/x-wais-source',
|
|
|
727 |
'sru' => 'application/sru+xml',
|
728 |
'srx' => 'application/sparql-results+xml',
|
729 |
'sse' => 'application/vnd.kodak-descriptor',
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/Birthday.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/Collection.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphAchievement.php
RENAMED
@@ -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
|
@@ -28,6 +28,7 @@ namespace Facebook\GraphNodes;
|
|
28 |
*
|
29 |
* @package Facebook
|
30 |
*/
|
|
|
31 |
class GraphAchievement extends GraphNode
|
32 |
{
|
33 |
/**
|
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
|
28 |
*
|
29 |
* @package Facebook
|
30 |
*/
|
31 |
+
|
32 |
class GraphAchievement extends GraphNode
|
33 |
{
|
34 |
/**
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphAlbum.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphApplication.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphCoverPhoto.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphEdge.php
RENAMED
@@ -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
|
@@ -235,18 +235,4 @@ class GraphEdge extends Collection
|
|
235 |
|
236 |
return null;
|
237 |
}
|
238 |
-
|
239 |
-
/**
|
240 |
-
* @inheritDoc
|
241 |
-
*/
|
242 |
-
public function map(\Closure $callback)
|
243 |
-
{
|
244 |
-
return new static(
|
245 |
-
$this->request,
|
246 |
-
array_map($callback, $this->items, array_keys($this->items)),
|
247 |
-
$this->metaData,
|
248 |
-
$this->parentEdgeEndpoint,
|
249 |
-
$this->subclassName
|
250 |
-
);
|
251 |
-
}
|
252 |
}
|
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
|
235 |
|
236 |
return null;
|
237 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
}
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphEvent.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphGroup.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphList.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphLocation.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphNode.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphNodeFactory.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphObject.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphObjectFactory.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphPage.php
RENAMED
@@ -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
|
@@ -37,8 +37,6 @@ class GraphPage extends GraphNode
|
|
37 |
'best_page' => '\Facebook\GraphNodes\GraphPage',
|
38 |
'global_brand_parent_page' => '\Facebook\GraphNodes\GraphPage',
|
39 |
'location' => '\Facebook\GraphNodes\GraphLocation',
|
40 |
-
'cover' => '\Facebook\GraphNodes\GraphCoverPhoto',
|
41 |
-
'picture' => '\Facebook\GraphNodes\GraphPicture',
|
42 |
];
|
43 |
|
44 |
/**
|
@@ -101,26 +99,6 @@ class GraphPage extends GraphNode
|
|
101 |
return $this->getField('location');
|
102 |
}
|
103 |
|
104 |
-
/**
|
105 |
-
* Returns CoverPhoto of the Page.
|
106 |
-
*
|
107 |
-
* @return GraphCoverPhoto|null
|
108 |
-
*/
|
109 |
-
public function getCover()
|
110 |
-
{
|
111 |
-
return $this->getField('cover');
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Returns Picture of the Page.
|
116 |
-
*
|
117 |
-
* @return GraphPicture|null
|
118 |
-
*/
|
119 |
-
public function getPicture()
|
120 |
-
{
|
121 |
-
return $this->getField('picture');
|
122 |
-
}
|
123 |
-
|
124 |
/**
|
125 |
* Returns the page access token for the admin user.
|
126 |
*
|
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
|
37 |
'best_page' => '\Facebook\GraphNodes\GraphPage',
|
38 |
'global_brand_parent_page' => '\Facebook\GraphNodes\GraphPage',
|
39 |
'location' => '\Facebook\GraphNodes\GraphLocation',
|
|
|
|
|
40 |
];
|
41 |
|
42 |
/**
|
99 |
return $this->getField('location');
|
100 |
}
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
/**
|
103 |
* Returns the page access token for the admin user.
|
104 |
*
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphPicture.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphSessionInfo.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/GraphNodes/GraphUser.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Helpers/FacebookCanvasHelper.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Helpers/FacebookJavaScriptHelper.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Helpers/FacebookPageTabHelper.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Helpers/FacebookRedirectLoginHelper.php
RENAMED
@@ -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
|
@@ -122,7 +122,7 @@ class FacebookRedirectLoginHelper
|
|
122 |
*/
|
123 |
private function makeUrl($redirectUrl, array $scope, array $params = [], $separator = '&')
|
124 |
{
|
125 |
-
$state = $this->
|
126 |
$this->persistentDataHandler->set('state', $state);
|
127 |
|
128 |
return $this->oAuth2Client->getAuthorizationUrl($redirectUrl, $state, $scope, $params, $separator);
|
@@ -219,7 +219,6 @@ class FacebookRedirectLoginHelper
|
|
219 |
}
|
220 |
|
221 |
$this->validateCsrf();
|
222 |
-
$this->resetCsrf();
|
223 |
|
224 |
$redirectUrl = $redirectUrl ?: $this->urlDetectionHandler->getCurrentUrl();
|
225 |
// At minimum we need to remove the state param
|
@@ -251,14 +250,6 @@ class FacebookRedirectLoginHelper
|
|
251 |
throw new FacebookSDKException('Cross-site request forgery validation failed. The "state" param from the URL and session do not match.');
|
252 |
}
|
253 |
|
254 |
-
/**
|
255 |
-
* Resets the CSRF so that it doesn't get reused.
|
256 |
-
*/
|
257 |
-
private function resetCsrf()
|
258 |
-
{
|
259 |
-
$this->persistentDataHandler->set('state', null);
|
260 |
-
}
|
261 |
-
|
262 |
/**
|
263 |
* Return the code.
|
264 |
*
|
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
|
122 |
*/
|
123 |
private function makeUrl($redirectUrl, array $scope, array $params = [], $separator = '&')
|
124 |
{
|
125 |
+
$state = $this->pseudoRandomStringGenerator->getPseudoRandomString(static::CSRF_LENGTH);
|
126 |
$this->persistentDataHandler->set('state', $state);
|
127 |
|
128 |
return $this->oAuth2Client->getAuthorizationUrl($redirectUrl, $state, $scope, $params, $separator);
|
219 |
}
|
220 |
|
221 |
$this->validateCsrf();
|
|
|
222 |
|
223 |
$redirectUrl = $redirectUrl ?: $this->urlDetectionHandler->getCurrentUrl();
|
224 |
// At minimum we need to remove the state param
|
250 |
throw new FacebookSDKException('Cross-site request forgery validation failed. The "state" param from the URL and session do not match.');
|
251 |
}
|
252 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
/**
|
254 |
* Return the code.
|
255 |
*
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Helpers/FacebookSignedRequestFromInputHelper.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Http/GraphRawResponse.php
RENAMED
@@ -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
|
@@ -129,7 +129,7 @@ class GraphRawResponse
|
|
129 |
if (strpos($line, ': ') === false) {
|
130 |
$this->setHttpResponseCodeFromHeader($line);
|
131 |
} else {
|
132 |
-
list($key, $value) = explode(': ', $line
|
133 |
$this->headers[$key] = $value;
|
134 |
}
|
135 |
}
|
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
|
129 |
if (strpos($line, ': ') === false) {
|
130 |
$this->setHttpResponseCodeFromHeader($line);
|
131 |
} else {
|
132 |
+
list($key, $value) = explode(': ', $line);
|
133 |
$this->headers[$key] = $value;
|
134 |
}
|
135 |
}
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Http/RequestBodyInterface.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Http/RequestBodyMultipart.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Http/RequestBodyUrlEncoded.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/FacebookCurl.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/FacebookCurlHttpClient.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/FacebookHttpClientInterface.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/FacebookStream.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/FacebookStreamHttpClient.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/HttpClientsFactory.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/HttpClients/certs/DigiCertHighAssuranceEVRootCA.pem
RENAMED
File without changes
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/PersistentData/FacebookMemoryPersistentDataHandler.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/PersistentData/FacebookSessionPersistentDataHandler.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/PersistentData/PersistentDataFactory.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/PersistentData/PersistentDataInterface.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/PseudoRandomString/McryptPseudoRandomStringGenerator.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/PseudoRandomString/OpenSslPseudoRandomStringGenerator.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorFactory.php
RENAMED
@@ -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
|
@@ -38,7 +38,7 @@ class PseudoRandomStringGeneratorFactory
|
|
38 |
*
|
39 |
* @param PseudoRandomStringGeneratorInterface|string|null $generator
|
40 |
*
|
41 |
-
* @throws InvalidArgumentException If the pseudo random string generator must be set to "
|
42 |
*
|
43 |
* @return PseudoRandomStringGeneratorInterface
|
44 |
*/
|
@@ -52,9 +52,6 @@ class PseudoRandomStringGeneratorFactory
|
|
52 |
return $generator;
|
53 |
}
|
54 |
|
55 |
-
if ('random_bytes' === $generator) {
|
56 |
-
return new RandomBytesPseudoRandomStringGenerator();
|
57 |
-
}
|
58 |
if ('mcrypt' === $generator) {
|
59 |
return new McryptPseudoRandomStringGenerator();
|
60 |
}
|
@@ -65,7 +62,7 @@ class PseudoRandomStringGeneratorFactory
|
|
65 |
return new UrandomPseudoRandomStringGenerator();
|
66 |
}
|
67 |
|
68 |
-
throw new InvalidArgumentException('The pseudo random string generator must be set to "
|
69 |
}
|
70 |
|
71 |
/**
|
@@ -77,13 +74,8 @@ class PseudoRandomStringGeneratorFactory
|
|
77 |
*/
|
78 |
private static function detectDefaultPseudoRandomStringGenerator()
|
79 |
{
|
80 |
-
// Check for PHP 7's CSPRNG first to keep mcrypt deprecation messages from appearing in PHP 7.1.
|
81 |
-
if (function_exists('random_bytes')) {
|
82 |
-
return new RandomBytesPseudoRandomStringGenerator();
|
83 |
-
}
|
84 |
-
|
85 |
// Since openssl_random_pseudo_bytes() can sometimes return non-cryptographically
|
86 |
-
// secure pseudo-random strings (in rare cases), we check for mcrypt_create_iv()
|
87 |
if (function_exists('mcrypt_create_iv')) {
|
88 |
return new McryptPseudoRandomStringGenerator();
|
89 |
}
|
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
|
38 |
*
|
39 |
* @param PseudoRandomStringGeneratorInterface|string|null $generator
|
40 |
*
|
41 |
+
* @throws InvalidArgumentException If the pseudo random string generator must be set to "mcrypt", "openssl", or "urandom", or be an instance of Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface.
|
42 |
*
|
43 |
* @return PseudoRandomStringGeneratorInterface
|
44 |
*/
|
52 |
return $generator;
|
53 |
}
|
54 |
|
|
|
|
|
|
|
55 |
if ('mcrypt' === $generator) {
|
56 |
return new McryptPseudoRandomStringGenerator();
|
57 |
}
|
62 |
return new UrandomPseudoRandomStringGenerator();
|
63 |
}
|
64 |
|
65 |
+
throw new InvalidArgumentException('The pseudo random string generator must be set to "mcrypt", "openssl", or "urandom", or be an instance of Facebook\PseudoRandomString\PseudoRandomStringGeneratorInterface');
|
66 |
}
|
67 |
|
68 |
/**
|
74 |
*/
|
75 |
private static function detectDefaultPseudoRandomStringGenerator()
|
76 |
{
|
|
|
|
|
|
|
|
|
|
|
77 |
// Since openssl_random_pseudo_bytes() can sometimes return non-cryptographically
|
78 |
+
// secure pseudo-random strings (in rare cases), we check for mcrypt_create_iv() first.
|
79 |
if (function_exists('mcrypt_create_iv')) {
|
80 |
return new McryptPseudoRandomStringGenerator();
|
81 |
}
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorInterface.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/PseudoRandomString/PseudoRandomStringGeneratorTrait.php
RENAMED
@@ -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,6 +48,7 @@ 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 |
*/
|
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 |
*/
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/PseudoRandomString/UrandomPseudoRandomStringGenerator.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/SignedRequest.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Url/FacebookUrlDetectionHandler.php
RENAMED
@@ -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,7 @@ class FacebookUrlDetectionHandler implements UrlDetectionInterface
|
|
95 |
protected function getHostName()
|
96 |
{
|
97 |
// Check for proxy first
|
98 |
-
$header = $this->getHeader('X_FORWARDED_HOST')
|
99 |
-
if ($header && $this->isValidForwardedHost($header)) {
|
100 |
$elements = explode(',', $header);
|
101 |
$host = $elements[count($elements) - 1];
|
102 |
} elseif (!$host = $this->getHeader('HOST')) {
|
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')) {
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/Url/FacebookUrlManipulator.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/Url/UrlDetectionInterface.php
RENAMED
@@ -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/{graph-sdk → php-sdk-v4}/src/Facebook/autoload.php
RENAMED
@@ -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
|
@@ -32,8 +32,6 @@ if (version_compare(PHP_VERSION, '5.4.0', '<')) {
|
|
32 |
throw new Exception('The Facebook SDK requires PHP version 5.4 or higher.');
|
33 |
}
|
34 |
|
35 |
-
require_once __DIR__ . '/polyfills.php';
|
36 |
-
|
37 |
/**
|
38 |
* Register the autoloader for the Facebook SDK classes.
|
39 |
*
|
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
|
32 |
throw new Exception('The Facebook SDK requires PHP version 5.4 or higher.');
|
33 |
}
|
34 |
|
|
|
|
|
35 |
/**
|
36 |
* Register the autoloader for the Facebook SDK classes.
|
37 |
*
|
vendor/facebook/{graph-sdk → php-sdk-v4}/src/Facebook/polyfills.php
RENAMED
@@ -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/symfony/css-selector/Exception/SyntaxErrorException.php
CHANGED
@@ -27,7 +27,7 @@ class SyntaxErrorException extends ParseException
|
|
27 |
* @param string $expectedValue
|
28 |
* @param Token $foundToken
|
29 |
*
|
30 |
-
* @return
|
31 |
*/
|
32 |
public static function unexpectedToken($expectedValue, Token $foundToken)
|
33 |
{
|
@@ -38,7 +38,7 @@ class SyntaxErrorException extends ParseException
|
|
38 |
* @param string $pseudoElement
|
39 |
* @param string $unexpectedLocation
|
40 |
*
|
41 |
-
* @return
|
42 |
*/
|
43 |
public static function pseudoElementFound($pseudoElement, $unexpectedLocation)
|
44 |
{
|
@@ -48,7 +48,7 @@ class SyntaxErrorException extends ParseException
|
|
48 |
/**
|
49 |
* @param int $position
|
50 |
*
|
51 |
-
* @return
|
52 |
*/
|
53 |
public static function unclosedString($position)
|
54 |
{
|
@@ -56,7 +56,7 @@ class SyntaxErrorException extends ParseException
|
|
56 |
}
|
57 |
|
58 |
/**
|
59 |
-
* @return
|
60 |
*/
|
61 |
public static function nestedNot()
|
62 |
{
|
@@ -64,7 +64,7 @@ class SyntaxErrorException extends ParseException
|
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
-
* @return
|
68 |
*/
|
69 |
public static function stringAsFunctionArgument()
|
70 |
{
|
27 |
* @param string $expectedValue
|
28 |
* @param Token $foundToken
|
29 |
*
|
30 |
+
* @return SyntaxErrorException
|
31 |
*/
|
32 |
public static function unexpectedToken($expectedValue, Token $foundToken)
|
33 |
{
|
38 |
* @param string $pseudoElement
|
39 |
* @param string $unexpectedLocation
|
40 |
*
|
41 |
+
* @return SyntaxErrorException
|
42 |
*/
|
43 |
public static function pseudoElementFound($pseudoElement, $unexpectedLocation)
|
44 |
{
|
48 |
/**
|
49 |
* @param int $position
|
50 |
*
|
51 |
+
* @return SyntaxErrorException
|
52 |
*/
|
53 |
public static function unclosedString($position)
|
54 |
{
|
56 |
}
|
57 |
|
58 |
/**
|
59 |
+
* @return SyntaxErrorException
|
60 |
*/
|
61 |
public static function nestedNot()
|
62 |
{
|
64 |
}
|
65 |
|
66 |
/**
|
67 |
+
* @return SyntaxErrorException
|
68 |
*/
|
69 |
public static function stringAsFunctionArgument()
|
70 |
{
|
vendor/symfony/css-selector/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
Copyright (c) 2004-
|
2 |
|
3 |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
of this software and associated documentation files (the "Software"), to deal
|
1 |
+
Copyright (c) 2004-2016 Fabien Potencier
|
2 |
|
3 |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
of this software and associated documentation files (the "Software"), to deal
|
vendor/symfony/css-selector/Node/Specificity.php
CHANGED
@@ -61,7 +61,7 @@ class Specificity
|
|
61 |
/**
|
62 |
* @param Specificity $specificity
|
63 |
*
|
64 |
-
* @return
|
65 |
*/
|
66 |
public function plus(Specificity $specificity)
|
67 |
{
|
61 |
/**
|
62 |
* @param Specificity $specificity
|
63 |
*
|
64 |
+
* @return Specificity
|
65 |
*/
|
66 |
public function plus(Specificity $specificity)
|
67 |
{
|
vendor/symfony/css-selector/Parser/Reader.php
CHANGED
@@ -118,6 +118,8 @@ class Reader
|
|
118 |
$this->position += $length;
|
119 |
}
|
120 |
|
|
|
|
|
121 |
public function moveToEnd()
|
122 |
{
|
123 |
$this->position = $this->length;
|
118 |
$this->position += $length;
|
119 |
}
|
120 |
|
121 |
+
/**
|
122 |
+
*/
|
123 |
public function moveToEnd()
|
124 |
{
|
125 |
$this->position = $this->length;
|
vendor/symfony/css-selector/Parser/TokenStream.php
CHANGED
@@ -61,7 +61,7 @@ class TokenStream
|
|
61 |
*
|
62 |
* @param Token $token
|
63 |
*
|
64 |
-
* @return
|
65 |
*/
|
66 |
public function push(Token $token)
|
67 |
{
|
@@ -73,7 +73,7 @@ class TokenStream
|
|
73 |
/**
|
74 |
* Freezes stream.
|
75 |
*
|
76 |
-
* @return
|
77 |
*/
|
78 |
public function freeze()
|
79 |
{
|
61 |
*
|
62 |
* @param Token $token
|
63 |
*
|
64 |
+
* @return TokenStream
|
65 |
*/
|
66 |
public function push(Token $token)
|
67 |
{
|
73 |
/**
|
74 |
* Freezes stream.
|
75 |
*
|
76 |
+
* @return TokenStream
|
77 |
*/
|
78 |
public function freeze()
|
79 |
{
|
vendor/symfony/css-selector/XPath/Extension/NodeExtension.php
CHANGED
@@ -50,7 +50,7 @@ class NodeExtension extends AbstractExtension
|
|
50 |
* @param int $flag
|
51 |
* @param bool $on
|
52 |
*
|
53 |
-
* @return
|
54 |
*/
|
55 |
public function setFlag($flag, $on)
|
56 |
{
|
50 |
* @param int $flag
|
51 |
* @param bool $on
|
52 |
*
|
53 |
+
* @return NodeExtension
|
54 |
*/
|
55 |
public function setFlag($flag, $on)
|
56 |
{
|
vendor/symfony/css-selector/XPath/Translator.php
CHANGED
@@ -70,6 +70,9 @@ class Translator implements TranslatorInterface
|
|
70 |
*/
|
71 |
private $attributeMatchingTranslators = array();
|
72 |
|
|
|
|
|
|
|
73 |
public function __construct(ParserInterface $parser = null)
|
74 |
{
|
75 |
$this->mainParser = $parser ?: new Parser();
|
@@ -146,7 +149,7 @@ class Translator implements TranslatorInterface
|
|
146 |
*
|
147 |
* @param Extension\ExtensionInterface $extension
|
148 |
*
|
149 |
-
* @return
|
150 |
*/
|
151 |
public function registerExtension(Extension\ExtensionInterface $extension)
|
152 |
{
|
@@ -182,7 +185,7 @@ class Translator implements TranslatorInterface
|
|
182 |
*
|
183 |
* @param ParserInterface $shortcut
|
184 |
*
|
185 |
-
* @return
|
186 |
*/
|
187 |
public function registerParserShortcut(ParserInterface $shortcut)
|
188 |
{
|
70 |
*/
|
71 |
private $attributeMatchingTranslators = array();
|
72 |
|
73 |
+
/**
|
74 |
+
* Constructor.
|
75 |
+
*/
|
76 |
public function __construct(ParserInterface $parser = null)
|
77 |
{
|
78 |
$this->mainParser = $parser ?: new Parser();
|
149 |
*
|
150 |
* @param Extension\ExtensionInterface $extension
|
151 |
*
|
152 |
+
* @return Translator
|
153 |
*/
|
154 |
public function registerExtension(Extension\ExtensionInterface $extension)
|
155 |
{
|
185 |
*
|
186 |
* @param ParserInterface $shortcut
|
187 |
*
|
188 |
+
* @return Translator
|
189 |
*/
|
190 |
public function registerParserShortcut(ParserInterface $shortcut)
|
191 |
{
|
vendor/symfony/css-selector/XPath/XPathExpr.php
CHANGED
@@ -66,7 +66,7 @@ class XPathExpr
|
|
66 |
/**
|
67 |
* @param $condition
|
68 |
*
|
69 |
-
* @return
|
70 |
*/
|
71 |
public function addCondition($condition)
|
72 |
{
|
@@ -84,7 +84,7 @@ class XPathExpr
|
|
84 |
}
|
85 |
|
86 |
/**
|
87 |
-
* @return
|
88 |
*/
|
89 |
public function addNameTest()
|
90 |
{
|
@@ -97,7 +97,7 @@ class XPathExpr
|
|
97 |
}
|
98 |
|
99 |
/**
|
100 |
-
* @return
|
101 |
*/
|
102 |
public function addStarPrefix()
|
103 |
{
|
@@ -112,7 +112,7 @@ class XPathExpr
|
|
112 |
* @param string $combiner
|
113 |
* @param XPathExpr $expr
|
114 |
*
|
115 |
-
* @return
|
116 |
*/
|
117 |
public function join($combiner, XPathExpr $expr)
|
118 |
{
|
66 |
/**
|
67 |
* @param $condition
|
68 |
*
|
69 |
+
* @return XPathExpr
|
70 |
*/
|
71 |
public function addCondition($condition)
|
72 |
{
|
84 |
}
|
85 |
|
86 |
/**
|
87 |
+
* @return XPathExpr
|
88 |
*/
|
89 |
public function addNameTest()
|
90 |
{
|
97 |
}
|
98 |
|
99 |
/**
|
100 |
+
* @return XPathExpr
|
101 |
*/
|
102 |
public function addStarPrefix()
|
103 |
{
|
112 |
* @param string $combiner
|
113 |
* @param XPathExpr $expr
|
114 |
*
|
115 |
+
* @return XPathExpr
|
116 |
*/
|
117 |
public function join($combiner, XPathExpr $expr)
|
118 |
{
|
vendor/symfony/css-selector/composer.json
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
}
|
21 |
],
|
22 |
"require": {
|
23 |
-
"php": ">=5.
|
24 |
},
|
25 |
"autoload": {
|
26 |
"psr-4": { "Symfony\\Component\\CssSelector\\": "" },
|
@@ -31,7 +31,7 @@
|
|
31 |
"minimum-stability": "dev",
|
32 |
"extra": {
|
33 |
"branch-alias": {
|
34 |
-
"dev-master": "
|
35 |
}
|
36 |
}
|
37 |
}
|
20 |
}
|
21 |
],
|
22 |
"require": {
|
23 |
+
"php": ">=5.3.9"
|
24 |
},
|
25 |
"autoload": {
|
26 |
"psr-4": { "Symfony\\Component\\CssSelector\\": "" },
|
31 |
"minimum-stability": "dev",
|
32 |
"extra": {
|
33 |
"branch-alias": {
|
34 |
+
"dev-master": "2.8-dev"
|
35 |
}
|
36 |
}
|
37 |
}
|
wizard/class-instant-articles-invalid-wizard-transition-exception.php
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Exception thrown when triggering an invalid transition on the state machine.
|
12 |
-
*
|
13 |
-
* @since 3.1
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Invalid_Wizard_Transition_Exception extends Exception {
|
16 |
-
public function __construct ( $original_state, $new_state ) {
|
17 |
-
parent::__construct( "Invalid transition: $original_state => $new_state." );
|
18 |
-
}
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/class-instant-articles-option-ads.php
DELETED
@@ -1,245 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option.php' );
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Configuration class for Ads.
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Option_Ads extends Instant_Articles_Option {
|
16 |
-
|
17 |
-
const OPTION_KEY = 'instant-articles-option-ads';
|
18 |
-
|
19 |
-
public static $sections = array(
|
20 |
-
'title' => 'Ads',
|
21 |
-
'description' => '<p>Choose your preferred method for displaying ads in your Instant Articles and input the code in the boxes below. Learn more about your options for <a href="https://developers.facebook.com/docs/instant-articles/ads-analytics" target="_blank">advertising in Instant Articles</a>.</p>',
|
22 |
-
);
|
23 |
-
|
24 |
-
public static $fields = array(
|
25 |
-
|
26 |
-
'ad_source' => array(
|
27 |
-
'label' => 'Ad Type',
|
28 |
-
'description' => 'This plugin will automatically place the ads within your articles.',
|
29 |
-
'render' => array( 'Instant_Articles_Option_Ads', 'custom_render_ad_source' ),
|
30 |
-
'select_options' => array(
|
31 |
-
'none' => 'None',
|
32 |
-
'fan' => 'Facebook Audience Network',
|
33 |
-
'iframe' => 'Custom iframe URL',
|
34 |
-
'embed' => 'Custom Embed Code',
|
35 |
-
),
|
36 |
-
'default' => 'none',
|
37 |
-
),
|
38 |
-
|
39 |
-
'fan_placement_id' => array(
|
40 |
-
'label' => 'Audience Network Placement ID',
|
41 |
-
'description' => 'Find your <a href="https://developers.facebook.com/docs/audience-network/instantarticles/banner" target="_blank">Placement ID</a> for Facebook Audience Network on your app\'s Audience Network Portal',
|
42 |
-
'default' => null,
|
43 |
-
),
|
44 |
-
|
45 |
-
'iframe_url' => array(
|
46 |
-
'label' => 'Source URL',
|
47 |
-
'placeholder' => '//ad-server.com/my-ad',
|
48 |
-
'description' => 'Note: Instant Articles only supports Direct Sold ads. No programmatic ad networks, other than Facebook\'s Audience Network, are permitted.',
|
49 |
-
'default' => '',
|
50 |
-
),
|
51 |
-
|
52 |
-
'embed_code' => array(
|
53 |
-
'label' => 'Embed Code',
|
54 |
-
'render' => 'textarea',
|
55 |
-
'description' => 'Add code to be used for displayed ads in your Instant Articles.',
|
56 |
-
'default' => '',
|
57 |
-
'placeholder' => '<script>...</script>',
|
58 |
-
'double_encode' => true,
|
59 |
-
),
|
60 |
-
|
61 |
-
'dimensions' => array(
|
62 |
-
'label' => 'Ad Dimensions',
|
63 |
-
'render' => 'select',
|
64 |
-
'select_options' => array(
|
65 |
-
'300x250' => 'Large (300 x 250)',
|
66 |
-
'320x50' => 'Small (320 x 50)',
|
67 |
-
),
|
68 |
-
'default' => '300x250',
|
69 |
-
),
|
70 |
-
|
71 |
-
);
|
72 |
-
|
73 |
-
/**
|
74 |
-
* Constructor.
|
75 |
-
*
|
76 |
-
* @since 0.4
|
77 |
-
*/
|
78 |
-
public function __construct() {
|
79 |
-
parent::__construct(
|
80 |
-
self::OPTION_KEY,
|
81 |
-
self::$sections,
|
82 |
-
self::$fields
|
83 |
-
);
|
84 |
-
wp_localize_script( 'instant-articles-option-ads', 'INSTANT_ARTICLES_OPTION_ADS', array(
|
85 |
-
'option_field_id_source' => self::OPTION_KEY . '-ad_source',
|
86 |
-
'option_field_id_fan' => self::OPTION_KEY . '-fan_placement_id',
|
87 |
-
'option_field_id_iframe' => self::OPTION_KEY . '-iframe_url',
|
88 |
-
'option_field_id_embed' => self::OPTION_KEY . '-embed_code',
|
89 |
-
'option_field_id_dimensions' => self::OPTION_KEY . '-dimensions',
|
90 |
-
) );
|
91 |
-
}
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Renders the ad source.
|
95 |
-
*
|
96 |
-
* @param array $args configuration fields for the ad.
|
97 |
-
* @since 0.4
|
98 |
-
*/
|
99 |
-
public static function custom_render_ad_source( $args ) {
|
100 |
-
$id = $args['label_for'];
|
101 |
-
$name = $args['serialized_with_group'] . '[ad_source]';
|
102 |
-
|
103 |
-
$description = isset( $args['description'] )
|
104 |
-
? '<p class="description">' . esc_html( $args['description'] ) . '</p>'
|
105 |
-
: '';
|
106 |
-
|
107 |
-
?>
|
108 |
-
<select id="<?php echo esc_attr( $id ); ?>" name="<?php echo esc_attr( $name ); ?>" >
|
109 |
-
<?php foreach ( $args['select_options'] as $ad_source_key => $ad_source_name ) : ?>
|
110 |
-
<option
|
111 |
-
value="<?php echo esc_attr( $ad_source_key ); ?>"
|
112 |
-
<?php echo selected( self::$settings['ad_source'], $ad_source_key ) ?>
|
113 |
-
>
|
114 |
-
<?php echo esc_html( $ad_source_name ); ?>
|
115 |
-
</option>
|
116 |
-
<?php endforeach; ?>
|
117 |
-
|
118 |
-
<?php
|
119 |
-
$compat_plugins = parent::get_registered_compat( 'instant_articles_compat_registry_ads' );
|
120 |
-
asort( $compat_plugins );
|
121 |
-
if ( count( $compat_plugins ) > 0 ) :
|
122 |
-
?>
|
123 |
-
<optgroup label="From Supported Plugins">
|
124 |
-
<?php foreach ( $compat_plugins as $ad_source_key => $ad_source_info ) : ?>
|
125 |
-
<option
|
126 |
-
value="<?php echo esc_attr( $ad_source_key ); ?>"
|
127 |
-
<?php echo selected( self::$settings['ad_source'], $ad_source_key ) ?>
|
128 |
-
>
|
129 |
-
<?php echo esc_html( $ad_source_info['name'] ); ?>
|
130 |
-
</option>
|
131 |
-
<?php endforeach; ?>
|
132 |
-
</optgroup>
|
133 |
-
<?php endif; ?>
|
134 |
-
|
135 |
-
?>
|
136 |
-
</select>
|
137 |
-
<?php echo wp_kses_post( $description ); ?>
|
138 |
-
<?php
|
139 |
-
}
|
140 |
-
|
141 |
-
/**
|
142 |
-
* Sanitize and return all the field values.
|
143 |
-
*
|
144 |
-
* This method receives a payload containing all value for its fields and
|
145 |
-
* should return the same payload after having been sanitized.
|
146 |
-
*
|
147 |
-
* Do not, encode the payload as this is performed by the
|
148 |
-
* universal_sanitize_and_encode_handler() of the parent class.
|
149 |
-
*
|
150 |
-
* @param array $field_values The array map with field values.
|
151 |
-
* @since 0.5
|
152 |
-
*/
|
153 |
-
public function sanitize_option_fields( $field_values ) {
|
154 |
-
foreach ( $field_values as $field_id => $field_value ) {
|
155 |
-
$field = self::$fields[ $field_id ];
|
156 |
-
|
157 |
-
switch ( $field_id ) {
|
158 |
-
case 'ad_source':
|
159 |
-
$all_options = array();
|
160 |
-
|
161 |
-
$registered_compat_ads = Instant_Articles_Option::get_registered_compat(
|
162 |
-
'instant_articles_compat_registry_ads'
|
163 |
-
);
|
164 |
-
|
165 |
-
foreach ( $field['select_options'] as $option_id => $option_info ) {
|
166 |
-
$all_options[] = $option_id;
|
167 |
-
}
|
168 |
-
foreach ( $registered_compat_ads as $compat_id => $compat_info ) {
|
169 |
-
$all_options[] = $compat_id;
|
170 |
-
}
|
171 |
-
|
172 |
-
if ( ! in_array( $field_value, $all_options, true ) ) {
|
173 |
-
$field_values[ $field_id ] = $field['default'];
|
174 |
-
add_settings_error(
|
175 |
-
$field_id,
|
176 |
-
'invalid_option',
|
177 |
-
'Invalid Ad Source'
|
178 |
-
);
|
179 |
-
}
|
180 |
-
break;
|
181 |
-
|
182 |
-
case 'fan_placement_id':
|
183 |
-
if ( isset( $field_values['ad_source'] ) && 'fan' === $field_values['ad_source'] ) {
|
184 |
-
if ( preg_match( '/^[0-9_]+$/', $field_values[ $field_id ] ) !== 1 ) {
|
185 |
-
add_settings_error(
|
186 |
-
$field_id,
|
187 |
-
'invalid_placement_id',
|
188 |
-
'Invalid Audience Network Placement ID provided'
|
189 |
-
);
|
190 |
-
$field_values[ $field_id ] = $field['default'];
|
191 |
-
}
|
192 |
-
}
|
193 |
-
break;
|
194 |
-
|
195 |
-
case 'iframe_url':
|
196 |
-
if ( isset( $field_values['ad_source'] ) && 'iframe' === $field_values['ad_source'] ) {
|
197 |
-
$url = $field_values[ $field_id ];
|
198 |
-
if ( substr( $url, 0, 2 ) === '//' ) {
|
199 |
-
// Allow URLs without protocol prefix
|
200 |
-
$url = 'http:' . $url;
|
201 |
-
}
|
202 |
-
$url = filter_var( $url , FILTER_VALIDATE_URL );
|
203 |
-
if ( ! $url ) {
|
204 |
-
$field_values[ $field_id ] = $field['default'];
|
205 |
-
add_settings_error(
|
206 |
-
$field_id,
|
207 |
-
'invalid_url',
|
208 |
-
'Invalid URL provided for Ad iframe'
|
209 |
-
);
|
210 |
-
}
|
211 |
-
}
|
212 |
-
break;
|
213 |
-
|
214 |
-
case 'embed_code':
|
215 |
-
if ( isset( $field_values['ad_source'] ) && 'embed' === $field_values['ad_source'] ) {
|
216 |
-
$document = new DOMDocument();
|
217 |
-
$fragment = $document->createDocumentFragment();
|
218 |
-
if ( ! @$fragment->appendXML( $field_values[ $field_id ] ) ) {
|
219 |
-
add_settings_error(
|
220 |
-
'embed_code',
|
221 |
-
'invalid_markup',
|
222 |
-
'Invalid HTML markup provided for ad custom embed code'
|
223 |
-
);
|
224 |
-
}
|
225 |
-
}
|
226 |
-
break;
|
227 |
-
|
228 |
-
case 'dimensions':
|
229 |
-
if ( isset( $field_values['ad_source'] ) && 'none' !== $field_values['ad_source'] ) {
|
230 |
-
if ( ! array_key_exists( $field_value, $field['select_options'] ) ) {
|
231 |
-
$field_values[ $field_id ] = $field['default'];
|
232 |
-
add_settings_error(
|
233 |
-
'embed_code',
|
234 |
-
'invalid_dimensions',
|
235 |
-
'Invalid dimensions provided for Ad'
|
236 |
-
);
|
237 |
-
}
|
238 |
-
}
|
239 |
-
break;
|
240 |
-
}
|
241 |
-
}
|
242 |
-
|
243 |
-
return $field_values;
|
244 |
-
}
|
245 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/class-instant-articles-option-analytics.php
DELETED
@@ -1,144 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option.php' );
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Analytics configuration class.
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Option_Analytics extends Instant_Articles_Option {
|
16 |
-
|
17 |
-
const OPTION_KEY = 'instant-articles-option-analytics';
|
18 |
-
|
19 |
-
public static $sections = array(
|
20 |
-
'title' => 'Analytics',
|
21 |
-
'description' => '<p>Enable 3rd-party analytics to be used with Instant Articles.</p><p>If you already use a WordPress plugin to manage analytics, you can enable it below. You can also embed code to insert your own trackers and analytics. <a href="https://developers.facebook.com/docs/instant-articles/ads-analytics#analytics" target="_blank">Learn more about Analytics in Instant Articles</a>.</p>',
|
22 |
-
);
|
23 |
-
|
24 |
-
public static $fields = array(
|
25 |
-
|
26 |
-
'integrations' => array(
|
27 |
-
'label' => '3rd party integrations',
|
28 |
-
'render' => array( 'Instant_Articles_Option_Analytics', 'custom_render_integrations' ),
|
29 |
-
'default' => array(),
|
30 |
-
),
|
31 |
-
|
32 |
-
'embed_code_enabled' => array(
|
33 |
-
'label' => 'Embed code',
|
34 |
-
'render' => 'checkbox',
|
35 |
-
'default' => false,
|
36 |
-
'description' => 'Add code for any other analytics services you wish to use.',
|
37 |
-
'checkbox_label' => 'Enable custom embed code',
|
38 |
-
),
|
39 |
-
|
40 |
-
'embed_code' => array(
|
41 |
-
'label' => '',
|
42 |
-
'render' => 'textarea',
|
43 |
-
'placeholder' => '<script>...</script>',
|
44 |
-
'description' => 'Note: You do not need to include any <op-tracker> tags. The plugin will automatically include them in the article markup.',
|
45 |
-
'default' => '',
|
46 |
-
'double_encode' => true,
|
47 |
-
),
|
48 |
-
);
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Constructor.
|
52 |
-
*
|
53 |
-
* @since 0.4
|
54 |
-
*/
|
55 |
-
public function __construct() {
|
56 |
-
parent::__construct(
|
57 |
-
self::OPTION_KEY,
|
58 |
-
self::$sections,
|
59 |
-
self::$fields
|
60 |
-
);
|
61 |
-
wp_localize_script( 'instant-articles-option-analytics', 'INSTANT_ARTICLES_OPTION_ANALYTICS', array(
|
62 |
-
'option_field_id_embed_code_enabled' => self::OPTION_KEY . '-embed_code_enabled',
|
63 |
-
'option_field_id_embed_code' => self::OPTION_KEY . '-embed_code',
|
64 |
-
) );
|
65 |
-
}
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Renders the markup for the `integrations` field.
|
69 |
-
*
|
70 |
-
* @param array $args The array with configuration of fields.
|
71 |
-
* @since 0.4
|
72 |
-
*/
|
73 |
-
public static function custom_render_integrations( $args ) {
|
74 |
-
$name = $args['serialized_with_group'] . '[integrations][]';
|
75 |
-
|
76 |
-
$compat_plugins = parent::get_registered_compat( 'instant_articles_compat_registry_analytics' );
|
77 |
-
|
78 |
-
if ( empty( $compat_plugins ) ) {
|
79 |
-
?>
|
80 |
-
<em>
|
81 |
-
<?php echo esc_html( 'No supported analytics plugins are installed nor activated' ); ?>
|
82 |
-
</em>
|
83 |
-
<?php
|
84 |
-
|
85 |
-
return;
|
86 |
-
}
|
87 |
-
|
88 |
-
asort( $compat_plugins );
|
89 |
-
foreach ( $compat_plugins as $plugin_id => $plugin_info ) {
|
90 |
-
?>
|
91 |
-
<label>
|
92 |
-
<input
|
93 |
-
type="checkbox"
|
94 |
-
name="<?php echo esc_attr( $name ); ?>"
|
95 |
-
value="<?php echo esc_attr( $plugin_id ); ?>"
|
96 |
-
<?php echo checked( in_array( $plugin_id, self::$settings['integrations'], true ) ) ?>
|
97 |
-
>
|
98 |
-
<?php echo esc_html( $plugin_info['name'] ); ?>
|
99 |
-
</label>
|
100 |
-
<br />
|
101 |
-
<?php
|
102 |
-
}
|
103 |
-
?>
|
104 |
-
<p class="description">Select which analytics services you'd like to use with Instant Articles.</p>
|
105 |
-
<?php
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Sanitize and return all the field values.
|
110 |
-
*
|
111 |
-
* This method receives a payload containing all value for its fields and
|
112 |
-
* should return the same payload after having been sanitized.
|
113 |
-
*
|
114 |
-
* Do not encode the payload as this is performed by the
|
115 |
-
* universal_sanitize_and_encode_handler() of the parent class.
|
116 |
-
*
|
117 |
-
* @param array $field_values The values in an array mapped keys.
|
118 |
-
* @since 0.5
|
119 |
-
*/
|
120 |
-
public function sanitize_option_fields( $field_values ) {
|
121 |
-
foreach ( $field_values as $field_id => $field_value ) {
|
122 |
-
$field = self::$fields[ $field_id ];
|
123 |
-
|
124 |
-
switch ( $field_id ) {
|
125 |
-
case 'embed_code':
|
126 |
-
if ( isset( $field_values['embed_code_enabled'] ) && $field_values['embed_code_enabled'] ) {
|
127 |
-
$document = new DOMDocument();
|
128 |
-
$fragment = $document->createDocumentFragment();
|
129 |
-
if ( ! @$fragment->appendXML( $field_values[ $field_id ] ) ) {
|
130 |
-
add_settings_error(
|
131 |
-
'embed_code',
|
132 |
-
'invalid_markup',
|
133 |
-
'Invalid HTML markup provided for custom analytics tracker code'
|
134 |
-
);
|
135 |
-
}
|
136 |
-
}
|
137 |
-
|
138 |
-
break;
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
return $field_values;
|
143 |
-
}
|
144 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/class-instant-articles-option-fb-app.php
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option.php' );
|
11 |
-
|
12 |
-
/**
|
13 |
-
* The Instant Articles FB app configuration.
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Option_FB_App extends Instant_Articles_Option {
|
16 |
-
|
17 |
-
const OPTION_KEY = 'instant-articles-option-fb-app';
|
18 |
-
|
19 |
-
public static $sections = array(
|
20 |
-
'title' => '',
|
21 |
-
'description' => '',
|
22 |
-
);
|
23 |
-
|
24 |
-
public static $fields = array(
|
25 |
-
|
26 |
-
'app_id' => array(
|
27 |
-
'label' => 'App ID',
|
28 |
-
'default' => '',
|
29 |
-
),
|
30 |
-
|
31 |
-
'app_secret' => array(
|
32 |
-
'label' => 'App Secret',
|
33 |
-
'render' => 'password',
|
34 |
-
'default' => '',
|
35 |
-
),
|
36 |
-
|
37 |
-
'user_access_token' => array(
|
38 |
-
'visible' => false,
|
39 |
-
'label' => 'User Access Token',
|
40 |
-
'render' => 'password',
|
41 |
-
'default' => '',
|
42 |
-
),
|
43 |
-
|
44 |
-
);
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Consturctor.
|
48 |
-
*
|
49 |
-
* @since 0.4
|
50 |
-
*/
|
51 |
-
public function __construct() {
|
52 |
-
$this->options_manager = new parent(
|
53 |
-
self::OPTION_KEY,
|
54 |
-
self::$sections,
|
55 |
-
self::$fields,
|
56 |
-
/**
|
57 |
-
* Register this Option on a specific page group (used as the first
|
58 |
-
* argument of `register_setting()` and called by `settings_fields()`).
|
59 |
-
*
|
60 |
-
* @since 0.5
|
61 |
-
*/
|
62 |
-
Instant_Articles_Option::PAGE_OPTION_GROUP_WIZARD
|
63 |
-
);
|
64 |
-
}
|
65 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/class-instant-articles-option-fb-page.php
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option.php' );
|
11 |
-
|
12 |
-
/**
|
13 |
-
* FB Page configuration.
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Option_FB_Page extends Instant_Articles_Option {
|
16 |
-
|
17 |
-
const OPTION_KEY = 'instant-articles-option-fb-page';
|
18 |
-
|
19 |
-
public static $sections = array(
|
20 |
-
'title' => '',
|
21 |
-
'description' => '',
|
22 |
-
);
|
23 |
-
|
24 |
-
public static $fields = array(
|
25 |
-
|
26 |
-
'page_id' => array(
|
27 |
-
'visible' => false,
|
28 |
-
'label' => 'Page ID',
|
29 |
-
'default' => '',
|
30 |
-
),
|
31 |
-
|
32 |
-
'page_name' => array(
|
33 |
-
'visible' => false,
|
34 |
-
'label' => 'Page Name',
|
35 |
-
'default' => '',
|
36 |
-
),
|
37 |
-
|
38 |
-
'page_picture' => array(
|
39 |
-
'visible' => false,
|
40 |
-
'label' => 'Page Picture',
|
41 |
-
'default' => '',
|
42 |
-
),
|
43 |
-
|
44 |
-
'page_access_token' => array(
|
45 |
-
'visible' => false,
|
46 |
-
'label' => 'Page Access Token',
|
47 |
-
'default' => '',
|
48 |
-
),
|
49 |
-
|
50 |
-
'page_access_token_expiration' => array(
|
51 |
-
'visible' => false,
|
52 |
-
'label' => 'Page Token Expiration',
|
53 |
-
'default' => '',
|
54 |
-
),
|
55 |
-
|
56 |
-
);
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Constructor.
|
60 |
-
*
|
61 |
-
* @since 0.4
|
62 |
-
*/
|
63 |
-
public function __construct() {
|
64 |
-
$this->options_manager = new parent(
|
65 |
-
self::OPTION_KEY,
|
66 |
-
self::$sections,
|
67 |
-
self::$fields,
|
68 |
-
/**
|
69 |
-
* Register this Option on a specific page group (used as the first
|
70 |
-
* argument of `register_setting()` and called by `settings_fields()`).
|
71 |
-
*
|
72 |
-
* @since 0.5
|
73 |
-
*/
|
74 |
-
Instant_Articles_Option::PAGE_OPTION_GROUP_WIZARD
|
75 |
-
);
|
76 |
-
}
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/class-instant-articles-option-publishing.php
DELETED
@@ -1,121 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option.php' );
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Class for publishing configuration.
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Option_Publishing extends Instant_Articles_Option {
|
16 |
-
|
17 |
-
const OPTION_KEY = 'instant-articles-option-publishing';
|
18 |
-
|
19 |
-
public static $sections = array(
|
20 |
-
'title' => 'Publishing Settings',
|
21 |
-
);
|
22 |
-
|
23 |
-
public static $fields = array(
|
24 |
-
|
25 |
-
'dev_mode' => array(
|
26 |
-
'label' => 'Development Mode',
|
27 |
-
'description' => 'Articles published while in Development Mode are saved as "drafts" within Facebook and will not be made live. Note: Since articles in "draft" are not reviewed, Development Mode should be disabled when publishing articles to Facebook which you intend to use in your <a href="https://developers.facebook.com/docs/instant-articles/publishing#review" target="_blank">one-time review</a>.',
|
28 |
-
'render' => 'checkbox',
|
29 |
-
'default' => false,
|
30 |
-
'checkbox_label' => 'Enable development mode',
|
31 |
-
),
|
32 |
-
|
33 |
-
'custom_rules_enabled' => array(
|
34 |
-
'label' => 'Custom transformer rules',
|
35 |
-
'render' => 'checkbox',
|
36 |
-
'default' => '',
|
37 |
-
'checkbox_label' => 'Enable custom transformer rules',
|
38 |
-
'description' => 'Define your own rules to customize the transformation of your content into Instant Articles',
|
39 |
-
'default' => '',
|
40 |
-
),
|
41 |
-
|
42 |
-
'custom_rules' => array(
|
43 |
-
'label' => '',
|
44 |
-
'render' => 'textarea',
|
45 |
-
'placeholder' => '{ "rules": [{ "class": "BoldRule", "selector": "span.bold" }, ... ] }',
|
46 |
-
'description' => 'Read more about <a href="https://developers.facebook.com/docs/instant-articles/sdk/transformer-rules" target="_blank">defining your own custom rules</a> to extend/override the <a href="https://github.com/Automattic/facebook-instant-articles-wp/blob/master/rules-configuration.json" target="_blank">built-in ruleset</a>. If you\'ve defined a common rule which you think this plugin should include by default, <a href="https://github.com/Automattic/facebook-instant-articles-wp/issues/new" target="_blank">tell us about it</a>!',
|
47 |
-
'default' => '',
|
48 |
-
),
|
49 |
-
|
50 |
-
'publish_with_warnings' => array(
|
51 |
-
'label' => 'Transformation warnings',
|
52 |
-
'description' => 'With this option disabled, articles which contain warnings in their transformation process won\'t be available as Instant Articles by default — this can be overridden on individual articles. Note: It is recommended that all transformation warnings be fixed.',
|
53 |
-
'render' => 'checkbox',
|
54 |
-
'default' => false,
|
55 |
-
'checkbox_label' => 'Publish articles containing warnings',
|
56 |
-
),
|
57 |
-
);
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Constructor.
|
61 |
-
*
|
62 |
-
* @since 0.4
|
63 |
-
*/
|
64 |
-
public function __construct() {
|
65 |
-
parent::__construct(
|
66 |
-
self::OPTION_KEY,
|
67 |
-
self::$sections,
|
68 |
-
self::$fields
|
69 |
-
);
|
70 |
-
wp_localize_script( 'instant-articles-option-publishing', 'INSTANT_ARTICLES_OPTION_PUBLISHING', array(
|
71 |
-
'option_field_id_custom_rules_enabled' => self::OPTION_KEY . '-custom_rules_enabled',
|
72 |
-
'option_field_id_custom_rules' => self::OPTION_KEY . '-custom_rules',
|
73 |
-
) );
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Sanitize and return all the field values.
|
78 |
-
*
|
79 |
-
* This method receives a payload containing all value for its fields and
|
80 |
-
* should return the same payload after having been sanitized.
|
81 |
-
*
|
82 |
-
* Do not encode the payload as this is performed by the
|
83 |
-
* universal_sanitize_and_encode_handler() of the parent class.
|
84 |
-
*
|
85 |
-
* @param array $field_values array map with key field_id => value.
|
86 |
-
* @since 0.5
|
87 |
-
*/
|
88 |
-
public function sanitize_option_fields( $field_values ) {
|
89 |
-
foreach ( $field_values as $field_id => $field_value ) {
|
90 |
-
$field = self::$fields[ $field_id ];
|
91 |
-
|
92 |
-
switch ( $field_id ) {
|
93 |
-
case 'dev_mode':
|
94 |
-
$field_values[ $field_id ] = (bool) $field_value
|
95 |
-
? (string) true
|
96 |
-
: (string) $field['default'];
|
97 |
-
break;
|
98 |
-
|
99 |
-
case 'custom_rules':
|
100 |
-
if ( isset( $field_values['custom_rules_enabled'] ) && $field_values['custom_rules_enabled'] ) {
|
101 |
-
$custom_rules_json = json_decode( $field_values['custom_rules'] );
|
102 |
-
if ( null === $custom_rules_json ) {
|
103 |
-
$field_values['custom_rules'] = $field['default'];
|
104 |
-
add_settings_error(
|
105 |
-
'custom_embed',
|
106 |
-
'invalid_json',
|
107 |
-
'Invalid JSON provided for custom rules code'
|
108 |
-
);
|
109 |
-
}
|
110 |
-
}
|
111 |
-
break;
|
112 |
-
|
113 |
-
default:
|
114 |
-
// Should never happen.
|
115 |
-
break;
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
return $field_values;
|
120 |
-
}
|
121 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/class-instant-articles-option-styles.php
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option.php' );
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Configuration class for Ads.
|
14 |
-
*/
|
15 |
-
class Instant_Articles_Option_Styles extends Instant_Articles_Option {
|
16 |
-
|
17 |
-
const OPTION_KEY = 'instant-articles-option-styles';
|
18 |
-
|
19 |
-
public static $sections = array(
|
20 |
-
'title' => 'Styles',
|
21 |
-
'description' => '<p>Assign your Instant Articles a custom style. To begin, customize a template using the Style Editor. Next, input the name of the style below.</p><p><strong>Note:</strong> If this field is left blank, the plugin will enable the “Default” style. Learn more about Instant Articles style options in the <a href="https://developers.facebook.com/docs/instant-articles/guides/design" target="_blank">Design Guide</a>.</p>',
|
22 |
-
);
|
23 |
-
|
24 |
-
public static $fields = array(
|
25 |
-
|
26 |
-
'article_style' => array(
|
27 |
-
'label' => 'Article Style',
|
28 |
-
'default' => 'default',
|
29 |
-
),
|
30 |
-
|
31 |
-
'rtl_enabled' => array(
|
32 |
-
'label' => 'Right-to-Left Publishing',
|
33 |
-
'render' => 'checkbox',
|
34 |
-
'default' => false,
|
35 |
-
'description' => 'Body text will read right to left for all articles.',
|
36 |
-
'checkbox_label' => 'Enable Right-to-Left (RTL) publishing',
|
37 |
-
),
|
38 |
-
|
39 |
-
);
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Constructor.
|
43 |
-
*
|
44 |
-
* @since 0.4
|
45 |
-
*/
|
46 |
-
public function __construct() {
|
47 |
-
parent::__construct(
|
48 |
-
self::OPTION_KEY,
|
49 |
-
self::$sections,
|
50 |
-
self::$fields
|
51 |
-
);
|
52 |
-
}
|
53 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/class-instant-articles-option.php
DELETED
@@ -1,490 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Base class for configurations.
|
12 |
-
*/
|
13 |
-
class Instant_Articles_Option {
|
14 |
-
|
15 |
-
const PAGE_OPTION_GROUP = 'instant-articles-settings';
|
16 |
-
const PAGE_OPTION_GROUP_WIZARD = 'instant-articles-settings-wizard';
|
17 |
-
public static $fields = array();
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Settings for options.
|
21 |
-
*
|
22 |
-
* @var array $settings The settings for each option.
|
23 |
-
*/
|
24 |
-
public static $settings = array();
|
25 |
-
|
26 |
-
/**
|
27 |
-
* The key for field.
|
28 |
-
*
|
29 |
-
* @var string $key The key for field.
|
30 |
-
*/
|
31 |
-
private $key;
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Each section.
|
35 |
-
*
|
36 |
-
* @var array $sections The sections where fields will be stored/showed.
|
37 |
-
*/
|
38 |
-
private $sections;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Page options.
|
42 |
-
*
|
43 |
-
* @var array $page_option_group
|
44 |
-
*/
|
45 |
-
private $page_option_group;
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Contains all the fields for the option. Supported field properties:
|
49 |
-
*
|
50 |
-
* Id - String. COMING SOON (to avoid using the key as the identifier)
|
51 |
-
* visible - Boolean. Use this to hide the entire row of the rendered field in the UI. Defaults to true.
|
52 |
-
* disable - Boolean|Array. Use to place the `disabled` attribute on the field. For fields with multiple options (<select>) an Array containing keys of all disabled `select_options` can be defined. Defaults to false.
|
53 |
-
* serialized_with_group - String|false/null. Controls whether a particular field of a setting is serialized with the group or saved as its own independant option. Defaults to true.
|
54 |
-
* label - String|null. The label for the field.
|
55 |
-
* description - String. The description for the field, rendered as additional information below the field.
|
56 |
-
* render - String|Function. How the field should be rendered as. Non-strings are assumed to be a function for rendering the field (third parameter of `add_settings_field()`). If a String, it is meant to be any of the standard <form> input types (checkbox, radio, textarea, hidden, select, textarea, password etc.') and the rendering will be handled by self::universal_render_handler(); if not defined, "text" is assumed
|
57 |
-
* select_options - Array. Defines the <options> for a checkbox (key of this Array is used as its `value` attribute). Only used if the `render` is "select".
|
58 |
-
* radio_options - Array. TO BE IMPLEMENTED (should mimic the "select_options" functionality)
|
59 |
-
* placeholder - String. Used as the `placeholder` attribute for the <form> field.
|
60 |
-
* default - String|null. Used as a default value for the field when there is no value yet saved in the db.
|
61 |
-
*
|
62 |
-
* @var array $fields The fields for option and its properties.
|
63 |
-
* @since 0.4
|
64 |
-
*/
|
65 |
-
private $field_definitions;
|
66 |
-
|
67 |
-
/**
|
68 |
-
* If $option_group is not specified, the Option will be registered with a
|
69 |
-
* "default" page group (the first argument of `register_setting()` and called
|
70 |
-
* by `settings_fields()`).
|
71 |
-
*
|
72 |
-
* @param string $option_key The ID for the field.
|
73 |
-
* @param array $sections The sections for each field.
|
74 |
-
* @param array $option_fields All the fields.
|
75 |
-
* @param array $option_group Optional, if not informed will use self::PAGE_OPTION_GROUP.
|
76 |
-
* @since 0.4
|
77 |
-
*/
|
78 |
-
public function __construct( $option_key, $sections, $option_fields, $option_group = null ) {
|
79 |
-
$this->key = $option_key;
|
80 |
-
$this->sections = $sections;
|
81 |
-
$this->field_definitions = $option_fields;
|
82 |
-
$this->page_option_group = null === $option_group
|
83 |
-
? self::PAGE_OPTION_GROUP
|
84 |
-
: $option_group;
|
85 |
-
|
86 |
-
$this->init();
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Option initiator.
|
91 |
-
*
|
92 |
-
* @since 0.4
|
93 |
-
*/
|
94 |
-
private function init() {
|
95 |
-
$saved_options = self::get_option_decoded( $this->key );
|
96 |
-
|
97 |
-
foreach ( $this->field_definitions as $field_key => $field ) {
|
98 |
-
self::$settings[ $field_key ] = isset( $saved_options[ $field_key ] )
|
99 |
-
? $saved_options[ $field_key ]
|
100 |
-
: $field['default'];
|
101 |
-
}
|
102 |
-
|
103 |
-
$this->wp_bootstrap_register_option();
|
104 |
-
$this->wp_bootstrap_create_sections();
|
105 |
-
$this->wp_bootstrap_add_fields_to_section();
|
106 |
-
}
|
107 |
-
|
108 |
-
/**
|
109 |
-
* Decodes the option.
|
110 |
-
*
|
111 |
-
* @param string $option_key to be returned.
|
112 |
-
* @return array from a json decoded content.
|
113 |
-
* @since 0.4
|
114 |
-
*/
|
115 |
-
public static function get_option_decoded( $option_key = null ) {
|
116 |
-
if ( ! isset( $option_key ) ) {
|
117 |
-
// Late Static Binding to use the const OPTION_KEY from the child class which called this function.
|
118 |
-
$option_key = static::OPTION_KEY;
|
119 |
-
}
|
120 |
-
|
121 |
-
$raw_data = get_option( $option_key );
|
122 |
-
|
123 |
-
// Hack which creates an empty setting if it doesn't yet exist.
|
124 |
-
// Temporary solution to an unknown oddity which is double-escaping the JSON
|
125 |
-
// data as a string when attempting to access a setting that doesn't exist.
|
126 |
-
if ( false === $raw_data ) {
|
127 |
-
add_option( $option_key );
|
128 |
-
$raw_data = get_option( $option_key );
|
129 |
-
}
|
130 |
-
|
131 |
-
return json_decode( $raw_data, true );
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Obtains the compat related to $action_tag.
|
136 |
-
*
|
137 |
-
* @param string $action_tag The tag registered compat will be retrieved.
|
138 |
-
* @since 0.4
|
139 |
-
*/
|
140 |
-
public static function get_registered_compat( $action_tag ) {
|
141 |
-
$registered_compat_integrations = array();
|
142 |
-
|
143 |
-
do_action_ref_array(
|
144 |
-
$action_tag,
|
145 |
-
array( &$registered_compat_integrations )
|
146 |
-
);
|
147 |
-
return $registered_compat_integrations;
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Registers the sanitization and encoding handler.
|
152 |
-
*
|
153 |
-
* @since 0.4
|
154 |
-
*/
|
155 |
-
private function wp_bootstrap_register_option() {
|
156 |
-
register_setting(
|
157 |
-
$this->page_option_group,
|
158 |
-
$this->key,
|
159 |
-
array( $this, 'universal_sanitize_and_encode_handler' )
|
160 |
-
);
|
161 |
-
}
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Create title and description sections.
|
165 |
-
*
|
166 |
-
* @since 0.4
|
167 |
-
*/
|
168 |
-
private function wp_bootstrap_create_sections() {
|
169 |
-
$title = isset( $this->sections['title'] )
|
170 |
-
? $this->sections['title']
|
171 |
-
: '';
|
172 |
-
|
173 |
-
$description = isset( $this->sections['description'] )
|
174 |
-
? wp_kses(
|
175 |
-
$this->sections['description'],
|
176 |
-
array(
|
177 |
-
'a' => array(
|
178 |
-
'href' => array(),
|
179 |
-
'target' => array(),
|
180 |
-
),
|
181 |
-
'em' => array(),
|
182 |
-
'p' => array(),
|
183 |
-
'strong' => array(),
|
184 |
-
)
|
185 |
-
)
|
186 |
-
: '';
|
187 |
-
|
188 |
-
add_settings_section(
|
189 |
-
$this->key,
|
190 |
-
esc_html( $title ),
|
191 |
-
function () use ( $description ) {
|
192 |
-
echo wp_kses_post( $description );
|
193 |
-
},
|
194 |
-
$this->key
|
195 |
-
);
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* Add fields to defined section.
|
200 |
-
*
|
201 |
-
* @since 0.4
|
202 |
-
*/
|
203 |
-
private function wp_bootstrap_add_fields_to_section() {
|
204 |
-
foreach ( $this->field_definitions as $field_key => $field ) {
|
205 |
-
$standalone_id = $this->key . '-' . $field_key;
|
206 |
-
|
207 |
-
// Default values of arguments for renderer.
|
208 |
-
$renderer_args = array(
|
209 |
-
// The "label_for" arg causes WordPress to wrap the label of the field with a <label> tag.
|
210 |
-
'label_for' => $standalone_id,
|
211 |
-
'serialized_with_group' => $this->key,
|
212 |
-
'render' => 'text',
|
213 |
-
'value' => self::$settings[ $field_key ],
|
214 |
-
);
|
215 |
-
|
216 |
-
// Override default arguments for renderer.
|
217 |
-
foreach ( $field as $key => $val ) {
|
218 |
-
$renderer_args[ $key ] = $val;
|
219 |
-
|
220 |
-
// The WordPress do_settings_fields() will add a `class` attribute to
|
221 |
-
// the <tr> tag of the rendered output with value of anything defined in
|
222 |
-
// a "class" key of the args for the renderer.
|
223 |
-
// We force it to include a value of "hidden" since this class is
|
224 |
-
// defined in WordPress's global CSS with `display: none;`.
|
225 |
-
if ( 'visible' === $key && false === $val ) {
|
226 |
-
$renderer_args['class'] = ( ! empty( $renderer_args['class'] )
|
227 |
-
? $renderer_args['class'] . ' '
|
228 |
-
: '') . 'hidden';
|
229 |
-
}
|
230 |
-
}
|
231 |
-
|
232 |
-
$renderer_handle = 'string' === gettype( $renderer_args['render'] )
|
233 |
-
? array( 'Instant_Articles_Option', 'universal_render_handler' )
|
234 |
-
: $renderer_args['render'];
|
235 |
-
|
236 |
-
add_settings_field(
|
237 |
-
$standalone_id,
|
238 |
-
$field['label'],
|
239 |
-
$renderer_handle,
|
240 |
-
$this->key,
|
241 |
-
$this->key,
|
242 |
-
$renderer_args
|
243 |
-
);
|
244 |
-
}
|
245 |
-
}
|
246 |
-
|
247 |
-
/**
|
248 |
-
* Function to render all fields with its labels and inputs.
|
249 |
-
*
|
250 |
-
* @param array $args array map with its field names and values.
|
251 |
-
* @since 0.4
|
252 |
-
*/
|
253 |
-
public static function universal_render_handler( $args = null ) {
|
254 |
-
$id = isset( $args['label_for'] )
|
255 |
-
? $args['label_for']
|
256 |
-
: '';
|
257 |
-
|
258 |
-
$type = isset( $args['render'] ) && gettype( 'string' === $args['render'] )
|
259 |
-
? $args['render']
|
260 |
-
: 'text';
|
261 |
-
|
262 |
-
if ( ! empty( $args['value'] ) ) {
|
263 |
-
$option_value = $args['value'];
|
264 |
-
} elseif ( ! empty( $args['default'] ) ) {
|
265 |
-
$option_value = $args['default'];
|
266 |
-
} else {
|
267 |
-
$option_value = '';
|
268 |
-
}
|
269 |
-
|
270 |
-
// Determines correct values based on whether the settings option
|
271 |
-
// is intended to be serialized as a field of a parent option name.
|
272 |
-
if ( gettype( 'string' === $args['serialized_with_group'] ) ) {
|
273 |
-
$group = $args['serialized_with_group'];
|
274 |
-
$group_key = substr( $id, strlen( $group . '-' ) );
|
275 |
-
$name = $group . '[' . $group_key . ']';
|
276 |
-
} else {
|
277 |
-
$name = $id;
|
278 |
-
}
|
279 |
-
|
280 |
-
$placeholder = isset( $args['placeholder'] )
|
281 |
-
? $args['placeholder']
|
282 |
-
: '';
|
283 |
-
|
284 |
-
$attr_disabled = isset( $args['disable'] ) && true === $args['disable']
|
285 |
-
? disabled()
|
286 |
-
: '';
|
287 |
-
|
288 |
-
$field_description = isset( $args['description'] )
|
289 |
-
? wp_kses(
|
290 |
-
$args['description'],
|
291 |
-
array(
|
292 |
-
'a' => array(
|
293 |
-
'href' => array(),
|
294 |
-
'target' => array(),
|
295 |
-
),
|
296 |
-
'em' => array(),
|
297 |
-
'strong' => array(),
|
298 |
-
)
|
299 |
-
)
|
300 |
-
: '';
|
301 |
-
|
302 |
-
$field_checkbox_label = isset( $args['checkbox_label'] )
|
303 |
-
? $args['checkbox_label']
|
304 |
-
: '';
|
305 |
-
|
306 |
-
switch ( $type ) {
|
307 |
-
case 'hidden':
|
308 |
-
?>
|
309 |
-
<input
|
310 |
-
type="hidden"
|
311 |
-
name="<?php echo esc_attr( $name ) ?>"
|
312 |
-
id="<?php echo esc_attr( $id ) ?>"
|
313 |
-
value="<?php echo esc_attr( $option_value ); ?>"
|
314 |
-
/>
|
315 |
-
<?php if ( $field_description ) : ?>
|
316 |
-
<p class="description">
|
317 |
-
<?php echo wp_kses_post( $field_description ); ?>
|
318 |
-
</p>
|
319 |
-
<?php endif; ?>
|
320 |
-
<?php
|
321 |
-
break;
|
322 |
-
|
323 |
-
case 'checkbox':
|
324 |
-
$attr_checked = checked( 1, $option_value, false );
|
325 |
-
?>
|
326 |
-
<label>
|
327 |
-
<input
|
328 |
-
type="checkbox"
|
329 |
-
value="1"
|
330 |
-
name="<?php echo esc_attr( $name ) ?>"
|
331 |
-
id="<?php echo esc_attr( $id ) ?>"
|
332 |
-
<?php echo esc_attr( $attr_checked ); ?>
|
333 |
-
<?php echo esc_attr( $attr_disabled ); ?>
|
334 |
-
/>
|
335 |
-
<?php echo esc_html( $field_checkbox_label ); ?>
|
336 |
-
</label>
|
337 |
-
<?php if ( $field_description ) : ?>
|
338 |
-
<p class="description">
|
339 |
-
<?php echo wp_kses_post( $field_description ); ?>
|
340 |
-
</p>
|
341 |
-
<?php endif; ?>
|
342 |
-
<?php
|
343 |
-
break;
|
344 |
-
|
345 |
-
case 'select':
|
346 |
-
?>
|
347 |
-
<select
|
348 |
-
id="<?php echo esc_attr( $id ) ?>"
|
349 |
-
name="<?php echo esc_attr( $name ) ?>"
|
350 |
-
<?php echo esc_html( $attr_disabled ) ?>
|
351 |
-
>
|
352 |
-
<?php foreach ( $args['select_options'] as $option_key => $option_name ) : ?>
|
353 |
-
<option
|
354 |
-
value="<?php echo esc_attr( $option_key ) ?>"
|
355 |
-
<?php echo selected( $option_key, $option_value ) ?>
|
356 |
-
<?php echo isset( $args['disable'] )
|
357 |
-
&& gettype( $args['disable'] ) === 'array'
|
358 |
-
&& in_array( $option_key, $args['disable'], true )
|
359 |
-
? disabled()
|
360 |
-
: '';
|
361 |
-
?>
|
362 |
-
>
|
363 |
-
<?php echo esc_html( $option_name ); ?>
|
364 |
-
</option>
|
365 |
-
<?php endforeach; ?>
|
366 |
-
</select>
|
367 |
-
<?php if ( $field_description ) : ?>
|
368 |
-
<p class="description">
|
369 |
-
<?php echo wp_kses_post( $field_description ); ?>
|
370 |
-
</p>
|
371 |
-
<?php endif; ?>
|
372 |
-
<?php
|
373 |
-
break;
|
374 |
-
|
375 |
-
case 'textarea':
|
376 |
-
?>
|
377 |
-
<textarea
|
378 |
-
name="<?php echo esc_attr( $name ) ?>"
|
379 |
-
id="<?php echo esc_attr( $id ) ?>"
|
380 |
-
<?php if ( $placeholder ) : ?>
|
381 |
-
placeholder="<?php echo esc_attr( $placeholder ); ?>"
|
382 |
-
<?php endif; ?>
|
383 |
-
<?php echo esc_attr( $attr_disabled ); ?>
|
384 |
-
class="large-text code"
|
385 |
-
rows="8"
|
386 |
-
><?php echo array_key_exists( 'double_encode', $args ) && $args[ 'double_encode' ] ? htmlspecialchars( $option_value ) : esc_html( $option_value ); ?></textarea>
|
387 |
-
<?php if ( $field_description ) : ?>
|
388 |
-
<p class="description">
|
389 |
-
<?php echo wp_kses_post( $field_description); ?>
|
390 |
-
</p>
|
391 |
-
<?php endif; ?>
|
392 |
-
<?php
|
393 |
-
break;
|
394 |
-
|
395 |
-
case 'text':
|
396 |
-
case 'password':
|
397 |
-
default:
|
398 |
-
?>
|
399 |
-
<input
|
400 |
-
type="<?php echo esc_attr( $type ) ?>"
|
401 |
-
name="<?php echo esc_attr( $name ) ?>"
|
402 |
-
id="<?php echo esc_attr( $id ) ?>"
|
403 |
-
<?php if ( $placeholder ) : ?>
|
404 |
-
placeholder="<?php echo esc_attr( $placeholder ) ?>"
|
405 |
-
<?php endif; ?>
|
406 |
-
<?php echo esc_attr( $attr_disabled ) ?>
|
407 |
-
value="<?php echo esc_attr( $option_value ) ?>"
|
408 |
-
class="regular-text"
|
409 |
-
/>
|
410 |
-
<?php if ( $field_description ) : ?>
|
411 |
-
<p class="description">
|
412 |
-
<?php echo wp_kses_post( $field_description ); ?>
|
413 |
-
</p>
|
414 |
-
<?php endif; ?>
|
415 |
-
<?php
|
416 |
-
break;
|
417 |
-
}
|
418 |
-
}
|
419 |
-
|
420 |
-
/**
|
421 |
-
* Intercepts the form data for an individual option on its way to the server.
|
422 |
-
* Receives one argument containing the payload data and passes it along to
|
423 |
-
* the child's own sanitation method. Returns an encoded payload for it
|
424 |
-
* to continue its way to the server.
|
425 |
-
*
|
426 |
-
* @param array $payload map of fields and their values.
|
427 |
-
* @return string encoded json with fields.
|
428 |
-
* @since 0.5
|
429 |
-
*/
|
430 |
-
public function universal_sanitize_and_encode_handler( $payload ) {
|
431 |
-
// Handle empty payload.
|
432 |
-
if ( ! is_array( $payload ) ) {
|
433 |
-
$payload = array();
|
434 |
-
}
|
435 |
-
|
436 |
-
// Remove any fields which could have been injected into the payload client-side.
|
437 |
-
$allowed_payload = array_intersect_key( $payload, static::$fields );
|
438 |
-
$allowed_payload = $payload;
|
439 |
-
|
440 |
-
// Pass the value along to the Child class's method to perform sanitation on its fields.
|
441 |
-
$sanitized_payload = static::sanitize_option_fields( $allowed_payload );
|
442 |
-
|
443 |
-
// Encode the payload into JSON before it's sent off to be saved.
|
444 |
-
return wp_json_encode( $sanitized_payload );
|
445 |
-
}
|
446 |
-
|
447 |
-
/**
|
448 |
-
* "Pass through" function. This should be overridden in child classes which
|
449 |
-
* are responsible for sanitizing its own $field_values.
|
450 |
-
*
|
451 |
-
* @param array $field_values array of values for fields.
|
452 |
-
* @since 0.5
|
453 |
-
*/
|
454 |
-
public function sanitize_option_fields( $field_values ) {
|
455 |
-
return $field_values;
|
456 |
-
}
|
457 |
-
|
458 |
-
/**
|
459 |
-
* Updates options from decoded map
|
460 |
-
*
|
461 |
-
* @param string $option_key to be returned.
|
462 |
-
* @return array from a json decoded content.
|
463 |
-
* @since 0.4
|
464 |
-
*/
|
465 |
-
public static function update_option( $option = array(), $option_key = null ) {
|
466 |
-
if ( ! isset( $option_key ) ) {
|
467 |
-
// Late Static Binding to use the const OPTION_KEY from the child class which called this function.
|
468 |
-
$option_key = static::OPTION_KEY;
|
469 |
-
}
|
470 |
-
|
471 |
-
wp_cache_delete ( 'alloptions', 'options' );
|
472 |
-
update_option( $option_key, $option );
|
473 |
-
}
|
474 |
-
/**
|
475 |
-
* Updates options from decoded map
|
476 |
-
*
|
477 |
-
* @param string $option_key to be returned.
|
478 |
-
* @return array from a json decoded content.
|
479 |
-
* @since 0.4
|
480 |
-
*/
|
481 |
-
public static function delete_option( $option_key = null ) {
|
482 |
-
if ( ! isset( $option_key ) ) {
|
483 |
-
// Late Static Binding to use the const OPTION_KEY from the child class which called this function.
|
484 |
-
$option_key = static::OPTION_KEY;
|
485 |
-
}
|
486 |
-
|
487 |
-
wp_cache_delete ( 'alloptions', 'options' );
|
488 |
-
delete_option( $option_key );
|
489 |
-
}
|
490 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/class-instant-articles-wizard-fb-helper.php
DELETED
@@ -1,212 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-fb-app.php' );
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-fb-page.php' );
|
11 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-wizard-state.php' );
|
12 |
-
|
13 |
-
use Facebook\PersistentData\PersistentDataInterface;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Class responsible for functionality and rendering of the settings
|
17 |
-
*
|
18 |
-
* @since 0.4
|
19 |
-
*/
|
20 |
-
class Instant_Articles_Wizard_FB_Helper implements PersistentDataInterface {
|
21 |
-
|
22 |
-
/**
|
23 |
-
* @var string Prefix to use for session options.
|
24 |
-
*/
|
25 |
-
protected $session_prefix = 'instant_articles_fbrlh_';
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @inheritdoc
|
29 |
-
*/
|
30 |
-
public function get( $key ) {
|
31 |
-
|
32 |
-
return get_option( $this->session_prefix . $key );
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* @inheritdoc
|
37 |
-
*/
|
38 |
-
public function set( $key, $value ) {
|
39 |
-
|
40 |
-
update_option( $this->session_prefix . $key, $value );
|
41 |
-
}
|
42 |
-
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Facebook Permissions.
|
46 |
-
*
|
47 |
-
* @var array $fb_app_permissions The permissions asked for FB user to list pages he manages.
|
48 |
-
*/
|
49 |
-
public static $fb_app_permissions = array( 'pages_manage_instant_articles', 'pages_show_list' );
|
50 |
-
|
51 |
-
/**
|
52 |
-
* SDK instance.
|
53 |
-
*
|
54 |
-
* @var Facebook $fb_sdk the instance reference to FB sdk
|
55 |
-
*/
|
56 |
-
public $fb_sdk;
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Settings structure.
|
60 |
-
*
|
61 |
-
* @var array $fb_app_settings The map data structure to store settings.
|
62 |
-
*/
|
63 |
-
protected $fb_app_settings;
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Constructor for Settings page.
|
67 |
-
*
|
68 |
-
* @since 0.4
|
69 |
-
*/
|
70 |
-
public function __construct() {
|
71 |
-
$this->fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
72 |
-
|
73 |
-
if ( isset( $this->fb_app_settings['app_id'] ) && isset( $this->fb_app_settings['app_secret'] ) ) {
|
74 |
-
$app_id = $this->fb_app_settings['app_id'];
|
75 |
-
$app_secret = $this->fb_app_settings['app_secret'];
|
76 |
-
}
|
77 |
-
|
78 |
-
if ( ! empty( $app_id ) && ! empty( $app_secret ) ) {
|
79 |
-
$this->fb_sdk = new Facebook\Facebook(array(
|
80 |
-
'app_id' => $app_id,
|
81 |
-
'app_secret' => $app_secret,
|
82 |
-
'default_graph_version' => 'v2.6',
|
83 |
-
'persistent_data_handler' => $this
|
84 |
-
));
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Gets the login url.
|
90 |
-
*
|
91 |
-
* @since 0.4
|
92 |
-
*/
|
93 |
-
public function get_login_url() {
|
94 |
-
if ( isset( $this->fb_sdk ) ) {
|
95 |
-
$helper = $this->fb_sdk->getRedirectLoginHelper();
|
96 |
-
$redirect_url = Instant_Articles_Wizard::get_url();
|
97 |
-
|
98 |
-
$login_url = $helper->getLoginUrl(
|
99 |
-
$redirect_url,
|
100 |
-
self::$fb_app_permissions
|
101 |
-
);
|
102 |
-
|
103 |
-
return $login_url;
|
104 |
-
}
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Retrieves granted permissions.
|
109 |
-
*
|
110 |
-
* @param string $access_token The user access token.
|
111 |
-
* @since 0.5
|
112 |
-
*/
|
113 |
-
public function get_fb_permissions( $access_token ) {
|
114 |
-
|
115 |
-
$permissions = array();
|
116 |
-
|
117 |
-
if ( isset( $this->fb_sdk ) && $access_token ) {
|
118 |
-
|
119 |
-
try {
|
120 |
-
$permissions_query = $this->fb_sdk->get( '/me/permissions', $access_token );
|
121 |
-
$decoded_permissions = $permissions_query->getDecodedBody();
|
122 |
-
if ( isset( $decoded_permissions['data'] ) ) {
|
123 |
-
foreach ( $decoded_permissions['data'] as $permission ) {
|
124 |
-
if ( 'granted' === $permission['status'] ) {
|
125 |
-
$permissions[ $permission['permission'] ] = 'granted';
|
126 |
-
}
|
127 |
-
}
|
128 |
-
}
|
129 |
-
} catch (Facebook\Exceptions\FacebookResponseException $e) {
|
130 |
-
// When Graph returns an error.
|
131 |
-
Logger::getLogger( 'instantarticles-wp-plugin' )->error(
|
132 |
-
'Graph returned an error: '.$e->getMessage(),
|
133 |
-
$e->getTraceAsString()
|
134 |
-
);
|
135 |
-
|
136 |
-
} catch (Facebook\Exceptions\FacebookSDKException $e) {
|
137 |
-
// When validation fails or other local issues.
|
138 |
-
Logger::getLogger( 'instantarticles-wp-plugin' )->error(
|
139 |
-
'Facebook SDK returned an error: '.$e->getMessage(),
|
140 |
-
$e->getTraceAsString()
|
141 |
-
);
|
142 |
-
|
143 |
-
}
|
144 |
-
}
|
145 |
-
|
146 |
-
if ( isset( $permissions ) ) {
|
147 |
-
// Logged in.
|
148 |
-
return $permissions;
|
149 |
-
}
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Retrieves Facebook access token.
|
154 |
-
*
|
155 |
-
* @since 0.4
|
156 |
-
*/
|
157 |
-
public function get_fb_access_token() {
|
158 |
-
$access_token = null;
|
159 |
-
|
160 |
-
if ( isset( $this->fb_sdk ) ) {
|
161 |
-
try {
|
162 |
-
$helper = $this->fb_sdk->getRedirectLoginHelper();
|
163 |
-
$access_token = $helper->getAccessToken();
|
164 |
-
} catch (Facebook\Exceptions\FacebookResponseException $e) {
|
165 |
-
// When Graph returns an error.
|
166 |
-
Logger::getLogger( 'instantarticles-wp-plugin' )->error(
|
167 |
-
'Graph returned an error: '.$e->getMessage(),
|
168 |
-
$e->getTraceAsString()
|
169 |
-
);
|
170 |
-
|
171 |
-
} catch (Facebook\Exceptions\FacebookSDKException $e) {
|
172 |
-
// When validation fails or other local issues.
|
173 |
-
Logger::getLogger( 'instantarticles-wp-plugin' )->error(
|
174 |
-
'Facebook SDK returned an error: '.$e->getMessage(),
|
175 |
-
$e->getTraceAsString()
|
176 |
-
);
|
177 |
-
}
|
178 |
-
}
|
179 |
-
|
180 |
-
if ( null !== $access_token ) {
|
181 |
-
// Logged in.
|
182 |
-
return $access_token;
|
183 |
-
}
|
184 |
-
}
|
185 |
-
|
186 |
-
public function get_pages() {
|
187 |
-
$helper = new Facebook\InstantArticles\Client\Helper(
|
188 |
-
$this->fb_sdk
|
189 |
-
);
|
190 |
-
|
191 |
-
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
192 |
-
|
193 |
-
$page_nodes = $helper->getPagesAndTokens(
|
194 |
-
new Facebook\Authentication\AccessToken( $fb_app_settings[ 'user_access_token' ] )
|
195 |
-
)->all();
|
196 |
-
|
197 |
-
$pages = array();
|
198 |
-
|
199 |
-
// Map GraphNode objects to simple value objects that are smaller when serialized.
|
200 |
-
foreach ( $page_nodes as $page_node ) {
|
201 |
-
$pages[ $page_node->getField( 'id' ) ] = array(
|
202 |
-
'page_id' => $page_node->getField( 'id' ),
|
203 |
-
'page_name' => $page_node->getField( 'name' ),
|
204 |
-
'page_picture' => $page_node->getField( 'picture' )->getField( 'url' ),
|
205 |
-
'page_access_token' => $page_node->getField( 'access_token' ),
|
206 |
-
'supports_instant_articles' => $page_node->getField( 'supports_instant_articles' ),
|
207 |
-
);
|
208 |
-
}
|
209 |
-
|
210 |
-
return $pages;
|
211 |
-
}
|
212 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/class-instant-articles-wizard-review-submission.php
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-fb-app.php' );
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-fb-page.php' );
|
11 |
-
|
12 |
-
use Facebook\InstantArticles\Client\Client;
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Class responsible for functionality and rendering of the review settings
|
16 |
-
*
|
17 |
-
* @since 3.1
|
18 |
-
*/
|
19 |
-
class Instant_Articles_Wizard_Review_Submission {
|
20 |
-
|
21 |
-
const MIN_ARTICLES = 5;
|
22 |
-
|
23 |
-
const STATUS_REJECTED = 'REJECTED';
|
24 |
-
const STATUS_APPROVED = 'APPROVED';
|
25 |
-
const STATUS_PENDING = 'PENDING';
|
26 |
-
const STATUS_NOT_SUBMITTED = 'NOT_SUBMITTED';
|
27 |
-
|
28 |
-
public static function getArticlesForReview() {
|
29 |
-
$post_types = apply_filters( 'instant_articles_post_types', array( 'post' ) );
|
30 |
-
|
31 |
-
// Cap the number of articles returned to
|
32 |
-
// 100 because of performance concerns.
|
33 |
-
return wp_get_recent_posts(
|
34 |
-
array(
|
35 |
-
'numberposts' => min( self::MIN_ARTICLES, 100 ),
|
36 |
-
'post_type' => $post_types
|
37 |
-
),
|
38 |
-
'OBJECT'
|
39 |
-
);
|
40 |
-
}
|
41 |
-
|
42 |
-
public static function getPageID() {
|
43 |
-
if ( ! static::isPageSet() ) {
|
44 |
-
return null;
|
45 |
-
}
|
46 |
-
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
47 |
-
return $fb_page_settings['page_id'];
|
48 |
-
}
|
49 |
-
|
50 |
-
public static function isPageSet() {
|
51 |
-
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
52 |
-
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
53 |
-
|
54 |
-
if ( isset( $fb_app_settings['app_id'] )
|
55 |
-
&& isset( $fb_app_settings['app_secret'] )
|
56 |
-
&& isset( $fb_page_settings['page_access_token'] )
|
57 |
-
&& isset( $fb_page_settings['page_id'] ) ) {
|
58 |
-
return true;
|
59 |
-
}
|
60 |
-
|
61 |
-
return false;
|
62 |
-
}
|
63 |
-
|
64 |
-
public static function getClient() {
|
65 |
-
if ( ! static::isPageSet() ) {
|
66 |
-
return null;
|
67 |
-
}
|
68 |
-
|
69 |
-
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
70 |
-
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
71 |
-
|
72 |
-
$client = Client::create(
|
73 |
-
$fb_app_settings['app_id'],
|
74 |
-
$fb_app_settings['app_secret'],
|
75 |
-
$fb_page_settings['page_access_token'],
|
76 |
-
$fb_page_settings['page_id'],
|
77 |
-
false
|
78 |
-
);
|
79 |
-
|
80 |
-
return $client;
|
81 |
-
}
|
82 |
-
|
83 |
-
public static function getReviewSubmissionStatus() {
|
84 |
-
if ( ! static::isPageSet() ) {
|
85 |
-
return null;
|
86 |
-
}
|
87 |
-
return static::getClient()->getReviewSubmissionStatus();
|
88 |
-
}
|
89 |
-
|
90 |
-
public static function getArticlesURLs() {
|
91 |
-
if ( ! static::isPageSet() ) {
|
92 |
-
return null;
|
93 |
-
}
|
94 |
-
return static::getClient()->getArticlesURLs(static::MIN_ARTICLES);
|
95 |
-
}
|
96 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/class-instant-articles-wizard-state.php
DELETED
@@ -1,357 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-ads.php' );
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-analytics.php' );
|
11 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-fb-app.php' );
|
12 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-fb-page.php' );
|
13 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-publishing.php' );
|
14 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-styles.php' );
|
15 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-invalid-wizard-transition-exception.php' );
|
16 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-wizard-fb-helper.php' );
|
17 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-wizard-review-submission.php' );
|
18 |
-
|
19 |
-
use Facebook\InstantArticles\Client\Client;
|
20 |
-
use Facebook\InstantArticles\Client\ClientException;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Set-up wizard state machine.
|
24 |
-
*
|
25 |
-
* @since 3.1
|
26 |
-
* @see ./state_machine.txt
|
27 |
-
*/
|
28 |
-
class Instant_Articles_Wizard_State {
|
29 |
-
|
30 |
-
// STATES
|
31 |
-
const STATE_OVERVIEW = 'STATE_OVERVIEW';
|
32 |
-
const STATE_APP_SETUP = 'STATE_APP_SETUP';
|
33 |
-
const STATE_PAGE_SELECTION = 'STATE_PAGE_SELECTION';
|
34 |
-
const STATE_STYLE_SELECTION = 'STATE_STYLE_SELECTION';
|
35 |
-
const STATE_REVIEW_SUBMISSION = 'STATE_REVIEW_SUBMISSION';
|
36 |
-
|
37 |
-
// TRANSITIONS
|
38 |
-
const TRANSITION_START_WIZARD = 'TRANSITION_START_WIZARD';
|
39 |
-
const TRANSITION_SET_UP_APP = 'TRANSITION_SET_UP_APP';
|
40 |
-
const TRANSITION_SELECT_PAGE = 'TRANSITION_SELECT_PAGE';
|
41 |
-
const TRANSITION_SELECT_STYLE = 'TRANSITION_SELECT_STYLE';
|
42 |
-
const TRANSITION_EDIT_STYLE = 'TRANSITION_EDIT_STYLE';
|
43 |
-
const TRANSITION_EDIT_PAGE = 'TRANSITION_EDIT_PAGE';
|
44 |
-
const TRANSITION_EDIT_APP = 'TRANSITION_EDIT_APP';
|
45 |
-
|
46 |
-
// WIZARD TIMELINE
|
47 |
-
const TIMELINE_PAST = 'TIMELINE_PAST';
|
48 |
-
const TIMELINE_CURRENT = 'TIMELINE_CURRENT';
|
49 |
-
const TIMELINE_FUTURE = 'TIMELINE_FUTURE';
|
50 |
-
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Transition vectors, format:
|
54 |
-
*
|
55 |
-
* array(
|
56 |
-
* ORIGINAL_STATE => array(
|
57 |
-
* NEW_STATE => TRANSITION_NAME,
|
58 |
-
* ...
|
59 |
-
* ),
|
60 |
-
* ...
|
61 |
-
* )
|
62 |
-
*
|
63 |
-
*/
|
64 |
-
public static $transition_vectors = array(
|
65 |
-
self::STATE_OVERVIEW => array (
|
66 |
-
self::STATE_APP_SETUP => self::TRANSITION_START_WIZARD
|
67 |
-
),
|
68 |
-
self::STATE_APP_SETUP => array (
|
69 |
-
self::STATE_PAGE_SELECTION => self::TRANSITION_SET_UP_APP
|
70 |
-
),
|
71 |
-
self::STATE_PAGE_SELECTION => array (
|
72 |
-
self::STATE_STYLE_SELECTION => self::TRANSITION_SELECT_PAGE,
|
73 |
-
self::STATE_APP_SETUP => self::TRANSITION_EDIT_APP
|
74 |
-
),
|
75 |
-
self::STATE_STYLE_SELECTION => array (
|
76 |
-
self::STATE_REVIEW_SUBMISSION => self::TRANSITION_SELECT_STYLE,
|
77 |
-
self::STATE_PAGE_SELECTION => self::TRANSITION_EDIT_PAGE,
|
78 |
-
self::STATE_APP_SETUP => self::TRANSITION_EDIT_APP
|
79 |
-
),
|
80 |
-
self::STATE_REVIEW_SUBMISSION => array (
|
81 |
-
self::STATE_STYLE_SELECTION => self::TRANSITION_EDIT_STYLE,
|
82 |
-
self::STATE_PAGE_SELECTION => self::TRANSITION_EDIT_PAGE,
|
83 |
-
self::STATE_APP_SETUP => self::TRANSITION_EDIT_APP
|
84 |
-
),
|
85 |
-
);
|
86 |
-
|
87 |
-
/**
|
88 |
-
* Order of states on the wizard
|
89 |
-
*/
|
90 |
-
public static $timeline = array(
|
91 |
-
self::STATE_OVERVIEW => 0,
|
92 |
-
self::STATE_APP_SETUP => 1,
|
93 |
-
self::STATE_PAGE_SELECTION => 2,
|
94 |
-
self::STATE_STYLE_SELECTION => 3,
|
95 |
-
self::STATE_REVIEW_SUBMISSION => 4
|
96 |
-
);
|
97 |
-
|
98 |
-
/**
|
99 |
-
* Gets the timeline position for a given state.
|
100 |
-
*
|
101 |
-
* @param string $state The state constant
|
102 |
-
* @return string The timeline constant (PAST, CURRENT or FUTURE)
|
103 |
-
*/
|
104 |
-
public static function get_timeline_position( $state ) {
|
105 |
-
$current_state = self::get_current_state();
|
106 |
-
|
107 |
-
if ( self::$timeline[ $current_state ] > self::$timeline[ $state ] ) {
|
108 |
-
return self::TIMELINE_PAST;
|
109 |
-
} elseif ( $state === $current_state ) {
|
110 |
-
if (
|
111 |
-
$current_state === self::STATE_REVIEW_SUBMISSION &&
|
112 |
-
Instant_Articles_Wizard_Review_Submission::getReviewSubmissionStatus() === Instant_Articles_Wizard_Review_Submission::STATUS_APPROVED
|
113 |
-
) {
|
114 |
-
return self::TIMELINE_PAST;
|
115 |
-
}
|
116 |
-
return self::TIMELINE_CURRENT;
|
117 |
-
} else {
|
118 |
-
return self::TIMELINE_FUTURE;
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Retrieves the current state of the wizard
|
124 |
-
*
|
125 |
-
* @return string The state constant for the current state
|
126 |
-
*/
|
127 |
-
public static function get_current_state() {
|
128 |
-
|
129 |
-
$option = get_option( 'instant-articles-current-state', null );
|
130 |
-
if ( in_array( $option, array_keys( self::$transition_vectors ) ) ) {
|
131 |
-
return $option;
|
132 |
-
}
|
133 |
-
|
134 |
-
// Legacy compatibility - calculate state from existing setup step
|
135 |
-
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
136 |
-
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
137 |
-
|
138 |
-
$app_set_up = ! empty( $fb_app_settings['app_id'] ) && ! empty( $fb_app_settings['app_secret'] );
|
139 |
-
$user_logged_in = ! empty( $fb_app_settings['user_access_token'] );
|
140 |
-
$page_selected = ! empty( $fb_page_settings['page_id'] ) && ! empty( $fb_page_settings['page_name'] );
|
141 |
-
$review_submitted = Instant_Articles_Wizard_Review_Submission::getReviewSubmissionStatus() === Instant_Articles_Wizard_Review_Submission::STATUS_NOT_SUBMITTED;
|
142 |
-
|
143 |
-
if ( ! $app_set_up ) {
|
144 |
-
return self::STATE_OVERVIEW;
|
145 |
-
} elseif ( ! $user_logged_in && ! $page_selected ) {
|
146 |
-
return self::STATE_APP_SETUP;
|
147 |
-
} elseif ( ! $page_selected ) {
|
148 |
-
return self::STATE_PAGE_SELECTION;
|
149 |
-
} elseif ( ! $review_submitted ) {
|
150 |
-
return self::STATE_REVIEW_SUBMISSION;
|
151 |
-
} else {
|
152 |
-
return self::STATE_STYLE_SELECTION;
|
153 |
-
}
|
154 |
-
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Calculates the transition name for 2 given states
|
159 |
-
*
|
160 |
-
* @param string $from Original state constant
|
161 |
-
* @param string $to New state constant
|
162 |
-
* @return string The transition constant or null for invalid transitions
|
163 |
-
*/
|
164 |
-
public static function get_transition( $from, $to ) {
|
165 |
-
if ( isset ( self::$transition_vectors[ $from ][ $to ] ) ) {
|
166 |
-
return self::$transition_vectors[ $from ][ $to ];
|
167 |
-
}
|
168 |
-
return null;
|
169 |
-
}
|
170 |
-
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Executes the transition from the current state to a new state
|
174 |
-
*
|
175 |
-
* @param string $new_state Constant for the final state of the transition
|
176 |
-
* @param mixed[] $params Parameters for the transition
|
177 |
-
* @throws Instant_Articles_Invalid_Wizard_Transition_Exception if an invalid transition is attempted
|
178 |
-
*/
|
179 |
-
public static function do_transition( $new_state, $params = array() ) {
|
180 |
-
$current_state = self::get_current_state();
|
181 |
-
$transition = self::get_transition( $current_state, $new_state );
|
182 |
-
|
183 |
-
if ( $transition === null ) {
|
184 |
-
throw new Instant_Articles_Invalid_Wizard_Transition_Exception( $current_state, $new_state );
|
185 |
-
}
|
186 |
-
|
187 |
-
switch ( $transition ) {
|
188 |
-
case self::TRANSITION_START_WIZARD:
|
189 |
-
return self::transition_start_wizard();
|
190 |
-
|
191 |
-
case self::TRANSITION_SET_UP_APP:
|
192 |
-
return self::transition_set_up_app( $params[ 'app_id' ], $params[ 'app_secret'], $params[ 'user_access_token' ] );
|
193 |
-
|
194 |
-
case self::TRANSITION_SELECT_PAGE:
|
195 |
-
// TODO: validate params
|
196 |
-
return self::transition_select_page( $params[ 'page_id'] );
|
197 |
-
case self::TRANSITION_SELECT_STYLE:
|
198 |
-
// TODO: validate params
|
199 |
-
return self::transition_select_style();
|
200 |
-
case self::TRANSITION_EDIT_APP:
|
201 |
-
return self::transition_edit_app();
|
202 |
-
case self::TRANSITION_EDIT_PAGE:
|
203 |
-
return self::transition_edit_page();
|
204 |
-
case self::TRANSITION_EDIT_STYLE:
|
205 |
-
return self::transition_edit_style();
|
206 |
-
}
|
207 |
-
}
|
208 |
-
|
209 |
-
/**
|
210 |
-
* Claims the URL for this site.
|
211 |
-
*/
|
212 |
-
public static function claim_url() {
|
213 |
-
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
214 |
-
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
215 |
-
|
216 |
-
if ( ! $fb_app_settings[ 'app_id' ] ) {
|
217 |
-
throw new InvalidArgumentException( 'Missing app_id for claiming the URL.' );
|
218 |
-
}
|
219 |
-
if ( ! $fb_app_settings[ 'app_secret' ] ) {
|
220 |
-
throw new InvalidArgumentException( 'Missing app_secret for claiming the URL.' );
|
221 |
-
}
|
222 |
-
if ( ! $fb_page_settings[ 'page_access_token' ] ) {
|
223 |
-
throw new InvalidArgumentException( 'Missing page_access_token for claiming the URL.' );
|
224 |
-
}
|
225 |
-
if ( ! $fb_page_settings[ 'page_id' ] ) {
|
226 |
-
throw new InvalidArgumentException( 'Missing page_id for claiming the URL.' );
|
227 |
-
}
|
228 |
-
|
229 |
-
$client = Client::create(
|
230 |
-
$fb_app_settings[ 'app_id' ],
|
231 |
-
$fb_app_settings[ 'app_secret' ],
|
232 |
-
$fb_page_settings[ 'page_access_token' ],
|
233 |
-
$fb_page_settings[ 'page_id' ]
|
234 |
-
);
|
235 |
-
|
236 |
-
|
237 |
-
// We need the home URL without the protocol for claiming
|
238 |
-
$url = preg_replace( '/^https?:\/\//i', '', esc_url_raw( home_url( '/' ) ) );
|
239 |
-
|
240 |
-
try {
|
241 |
-
$client->claimURL( $url );
|
242 |
-
} catch (Exception $e) {
|
243 |
-
// Here we override the error message to give an actionable
|
244 |
-
// instruction to the user that is specific for WordPress.
|
245 |
-
throw new Exception("Could not automatically claim the URL for this site, please claim it manually on your Page's Publishing Tools.");
|
246 |
-
}
|
247 |
-
}
|
248 |
-
|
249 |
-
//---------------------------
|
250 |
-
// Transition implementations
|
251 |
-
//---------------------------
|
252 |
-
|
253 |
-
/**
|
254 |
-
* Transition for when starting the wizard from overview.
|
255 |
-
*/
|
256 |
-
private static function transition_start_wizard() {
|
257 |
-
return update_option( 'instant-articles-current-state', self::STATE_APP_SETUP );
|
258 |
-
}
|
259 |
-
|
260 |
-
/**
|
261 |
-
* Transition for when the user inputs the app info and logs in with it's personal account.
|
262 |
-
*/
|
263 |
-
private static function transition_set_up_app( $app_id, $app_secret, $user_access_token ) {
|
264 |
-
if ( ! $app_id ) {
|
265 |
-
throw new InvalidArgumentException( 'Missing App ID when authenticating the plugin' );
|
266 |
-
}
|
267 |
-
if ( ! $app_secret ) {
|
268 |
-
throw new InvalidArgumentException( 'Missing App Secret when authenticating the plugin' );
|
269 |
-
}
|
270 |
-
if ( ! $user_access_token ) {
|
271 |
-
throw new InvalidArgumentException( 'Missing Access Token when authenticating the plugin' );
|
272 |
-
}
|
273 |
-
|
274 |
-
Instant_Articles_Option_FB_App::update_option( array(
|
275 |
-
'app_id' => $app_id,
|
276 |
-
'app_secret' => $app_secret,
|
277 |
-
'user_access_token' => $user_access_token
|
278 |
-
) );
|
279 |
-
return update_option( 'instant-articles-current-state', self::STATE_PAGE_SELECTION );
|
280 |
-
}
|
281 |
-
|
282 |
-
/**
|
283 |
-
* Transition for when the user selects the page to connect to.
|
284 |
-
*
|
285 |
-
* This transition stores page info including the long-lived access token information.
|
286 |
-
*/
|
287 |
-
private static function transition_select_page( $page_id ) {
|
288 |
-
if ( ! $page_id ) {
|
289 |
-
throw new InvalidArgumentException( 'Missing Page ID when selcting the page' );
|
290 |
-
}
|
291 |
-
|
292 |
-
$fb_helper = new Instant_Articles_Wizard_FB_Helper();
|
293 |
-
$pages = $fb_helper->get_pages();
|
294 |
-
|
295 |
-
if ( ! $pages[ $page_id ] ) {
|
296 |
-
throw new InvalidArgumentException( 'Invalid Page ID when selcting the page' );
|
297 |
-
}
|
298 |
-
if ( ! $pages[ $page_id ][ 'supports_instant_articles'] ) {
|
299 |
-
throw new InvalidArgumentException( 'Selected page is not signed up to Instant Articles' );
|
300 |
-
}
|
301 |
-
|
302 |
-
Instant_Articles_Option_FB_Page::update_option( $pages[ $page_id ] );
|
303 |
-
|
304 |
-
// Update the option before claiming the URL.
|
305 |
-
$success = update_option( 'instant-articles-current-state', self::STATE_STYLE_SELECTION );
|
306 |
-
|
307 |
-
// You should always claim the URL after updating the FB Page option so the fb:pages meta tag is rendered.
|
308 |
-
if ( $success ) {
|
309 |
-
self::claim_url();
|
310 |
-
}
|
311 |
-
|
312 |
-
return $success;
|
313 |
-
}
|
314 |
-
|
315 |
-
/**
|
316 |
-
* Transition for when the user confirms he has selected the style for the articles.
|
317 |
-
*/
|
318 |
-
private static function transition_select_style() {
|
319 |
-
return update_option( 'instant-articles-current-state', self::STATE_REVIEW_SUBMISSION );
|
320 |
-
}
|
321 |
-
|
322 |
-
/**
|
323 |
-
* Transition for when the user decides to change the FB App.
|
324 |
-
*/
|
325 |
-
private static function transition_edit_app() {
|
326 |
-
Instant_Articles_Option_FB_App::delete_option();
|
327 |
-
Instant_Articles_Option_FB_Page::delete_option();
|
328 |
-
return update_option( 'instant-articles-current-state', self::STATE_APP_SETUP );
|
329 |
-
}
|
330 |
-
|
331 |
-
/**
|
332 |
-
* Transition for when the user decides to change the selected page.
|
333 |
-
*/
|
334 |
-
private static function transition_edit_page() {
|
335 |
-
Instant_Articles_Option_FB_Page::delete_option();
|
336 |
-
|
337 |
-
// For backwards compatibility, we transition one step back
|
338 |
-
// for users of the old versions that selected a page but the
|
339 |
-
// plugin didn't save the user access token. In this case
|
340 |
-
// we need the user to log in again.
|
341 |
-
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
342 |
-
$user_logged_in = ! empty( $fb_app_settings['user_access_token'] );
|
343 |
-
if ( ! $user_logged_in ) {
|
344 |
-
return update_option( 'instant-articles-current-state', self::STATE_APP_SETUP );
|
345 |
-
}
|
346 |
-
|
347 |
-
return update_option( 'instant-articles-current-state', self::STATE_PAGE_SELECTION );
|
348 |
-
}
|
349 |
-
|
350 |
-
/**
|
351 |
-
* Transition for when the user decides to edit the style.
|
352 |
-
*/
|
353 |
-
private static function transition_edit_style() {
|
354 |
-
return update_option( 'instant-articles-current-state', self::STATE_STYLE_SELECTION );
|
355 |
-
}
|
356 |
-
|
357 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/class-instant-articles-wizard.php
DELETED
@@ -1,336 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-ads.php' );
|
10 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-analytics.php' );
|
11 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-fb-app.php' );
|
12 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-fb-page.php' );
|
13 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-publishing.php' );
|
14 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-option-styles.php' );
|
15 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-wizard-state.php' );
|
16 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-wizard-fb-helper.php' );
|
17 |
-
require_once( dirname( __FILE__ ) . '/class-instant-articles-wizard-review-submission.php' );
|
18 |
-
|
19 |
-
use Facebook\InstantArticles\Client\Client;
|
20 |
-
use Facebook\InstantArticles\Client\ClientException;
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Controller for Set-up Wizard
|
24 |
-
*
|
25 |
-
* @since 3.1
|
26 |
-
*/
|
27 |
-
class Instant_Articles_Wizard {
|
28 |
-
|
29 |
-
public static function init() {
|
30 |
-
add_action( 'admin_menu', array( 'Instant_Articles_Wizard', 'menu_items' ) );
|
31 |
-
|
32 |
-
add_filter( 'plugin_action_links_' . IA_PLUGIN_PATH, array( 'Instant_Articles_Wizard', 'add_settings_link_to_plugin_actions' ) );
|
33 |
-
|
34 |
-
add_action( 'admin_init', function () {
|
35 |
-
new Instant_Articles_Option_FB_App();
|
36 |
-
new Instant_Articles_Option_FB_Page();
|
37 |
-
new Instant_Articles_Option_Styles();
|
38 |
-
new Instant_Articles_Option_Ads();
|
39 |
-
new Instant_Articles_Option_Analytics();
|
40 |
-
new Instant_Articles_Option_Publishing();
|
41 |
-
});
|
42 |
-
|
43 |
-
add_action(
|
44 |
-
'wp_ajax_instant_articles_wizard_transition',
|
45 |
-
array( 'Instant_Articles_Wizard', 'transition' )
|
46 |
-
);
|
47 |
-
|
48 |
-
add_action(
|
49 |
-
'wp_ajax_instant_articles_wizard_save_app',
|
50 |
-
array( 'Instant_Articles_Wizard', 'save_app' )
|
51 |
-
);
|
52 |
-
|
53 |
-
add_action(
|
54 |
-
'wp_ajax_instant_articles_wizard_edit_app',
|
55 |
-
array( 'Instant_Articles_Wizard', 'edit_app' )
|
56 |
-
);
|
57 |
-
|
58 |
-
add_action(
|
59 |
-
'wp_ajax_instant_articles_wizard_is_page_signed_up',
|
60 |
-
array( 'Instant_Articles_Wizard', 'is_page_signed_up' )
|
61 |
-
);
|
62 |
-
|
63 |
-
add_action(
|
64 |
-
'wp_ajax_instant_articles_wizard_submit_for_review',
|
65 |
-
array( 'Instant_Articles_Wizard', 'submit_for_review' )
|
66 |
-
);
|
67 |
-
}
|
68 |
-
|
69 |
-
public static function add_settings_link_to_plugin_actions( $links ) {
|
70 |
-
$link_text = __( 'Settings' );
|
71 |
-
$settings_href = self::get_url();
|
72 |
-
$settings_link = '<a href="' . esc_url( $settings_href ) . '">' . esc_html( $link_text ) . '</a>';
|
73 |
-
array_push( $links, $settings_link );
|
74 |
-
return $links;
|
75 |
-
}
|
76 |
-
|
77 |
-
public static function menu_items() {
|
78 |
-
add_menu_page(
|
79 |
-
'Instant Articles Setup Wizard',
|
80 |
-
'Instant Articles',
|
81 |
-
'manage_options',
|
82 |
-
'instant-articles-wizard',
|
83 |
-
array( 'Instant_Articles_Wizard', 'render' )
|
84 |
-
,'dashicons-facebook'
|
85 |
-
);
|
86 |
-
// Hack to let the URL visible to ajax handlers
|
87 |
-
update_option( 'instant-articles-wizard-url', menu_page_url( 'instant-articles-wizard', false) );
|
88 |
-
}
|
89 |
-
|
90 |
-
public static function get_url() {
|
91 |
-
$url = menu_page_url( 'instant-articles-wizard', false );
|
92 |
-
|
93 |
-
// Needed when calling from ajax
|
94 |
-
if ( ! $url ) {
|
95 |
-
$url = get_option( 'instant-articles-wizard-url' );
|
96 |
-
}
|
97 |
-
|
98 |
-
return $url;
|
99 |
-
}
|
100 |
-
|
101 |
-
|
102 |
-
public static function get_admin_url() {
|
103 |
-
$url = parse_url( admin_url() );
|
104 |
-
return $url['host'];
|
105 |
-
}
|
106 |
-
|
107 |
-
public static function transition() {
|
108 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
109 |
-
wp_die( esc_html( 'You do not have sufficient permissions to access this page.' ) );
|
110 |
-
}
|
111 |
-
|
112 |
-
$new_state = sanitize_text_field( $_POST[ 'new_state' ] );
|
113 |
-
|
114 |
-
$params = $_POST[ 'params' ];
|
115 |
-
$params = json_decode( stripslashes( $params ), true );
|
116 |
-
foreach ( $params as $key => $param ) {
|
117 |
-
// escape every key
|
118 |
-
$params[ $key ] = sanitize_text_field( $param );
|
119 |
-
}
|
120 |
-
|
121 |
-
try {
|
122 |
-
Instant_Articles_Wizard_State::do_transition( $new_state, $params );
|
123 |
-
} catch ( Exception $e ) {
|
124 |
-
// If something went wrong, simply render the error + the same state.
|
125 |
-
echo '<div class="error settings-error notice is-dismissible"><p><strong>' . esc_html( $e->getMessage() ) . '</strong></p></div>';
|
126 |
-
}
|
127 |
-
|
128 |
-
self::render( true );
|
129 |
-
die();
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Saves the App ID and App Secret.
|
134 |
-
*
|
135 |
-
* That does not trigger a state transition, as the state transition will
|
136 |
-
* only happen when the user logs in and we grab the access token.
|
137 |
-
*/
|
138 |
-
public static function save_app() {
|
139 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
140 |
-
wp_die( esc_html( 'You do not have sufficient permissions to access this page.' ) );
|
141 |
-
}
|
142 |
-
|
143 |
-
$current_state = Instant_Articles_Wizard_State::get_current_state();
|
144 |
-
if ( $current_state !== Instant_Articles_Wizard_State::STATE_APP_SETUP ) {
|
145 |
-
die();
|
146 |
-
}
|
147 |
-
|
148 |
-
$app_id = sanitize_text_field( $_POST[ 'app_id' ] );
|
149 |
-
$app_secret = sanitize_text_field( $_POST[ 'app_secret' ] );
|
150 |
-
|
151 |
-
Instant_Articles_Option_FB_App::update_option( array(
|
152 |
-
'app_id' => $app_id,
|
153 |
-
'app_secret' => $app_secret
|
154 |
-
) );
|
155 |
-
|
156 |
-
self::render( true );
|
157 |
-
die();
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* Submits the select page for review
|
162 |
-
*/
|
163 |
-
public static function submit_for_review() {
|
164 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
165 |
-
wp_die( esc_html( 'You do not have sufficient permissions to access this page.' ) );
|
166 |
-
}
|
167 |
-
|
168 |
-
$current_state = Instant_Articles_Wizard_State::get_current_state();
|
169 |
-
if ( $current_state !== Instant_Articles_Wizard_State::STATE_REVIEW_SUBMISSION ) {
|
170 |
-
die();
|
171 |
-
}
|
172 |
-
|
173 |
-
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
174 |
-
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
175 |
-
|
176 |
-
try {
|
177 |
-
$client = Client::create(
|
178 |
-
$fb_app_settings[ 'app_id' ],
|
179 |
-
$fb_app_settings[ 'app_secret' ],
|
180 |
-
$fb_page_settings[ 'page_access_token' ],
|
181 |
-
$fb_page_settings[ 'page_id' ]
|
182 |
-
);
|
183 |
-
|
184 |
-
// Bulk upload articles for review
|
185 |
-
$articles_for_review = Instant_Articles_Wizard_Review_Submission::getArticlesForReview();
|
186 |
-
foreach ( $articles_for_review as $post ) {
|
187 |
-
Instant_Articles_Publisher::submit_article( $post->ID, $post );
|
188 |
-
}
|
189 |
-
|
190 |
-
// Trigger review submission
|
191 |
-
$client->submitForReview();
|
192 |
-
} catch ( Exception $e ) {
|
193 |
-
// If something went wrong, simply render the error + the same state.
|
194 |
-
echo '<div class="error settings-error notice is-dismissible"><p><strong>' . esc_html( $e->getMessage() ) . '</strong></p></div>';
|
195 |
-
}
|
196 |
-
|
197 |
-
self::render( true );
|
198 |
-
die();
|
199 |
-
}
|
200 |
-
|
201 |
-
/**
|
202 |
-
* Edits the App ID and App Secret within the APP_SETUP state.
|
203 |
-
*/
|
204 |
-
public static function edit_app() {
|
205 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
206 |
-
wp_die( esc_html( 'You do not have sufficient permissions to access this page.' ) );
|
207 |
-
}
|
208 |
-
|
209 |
-
$current_state = Instant_Articles_Wizard_State::get_current_state();
|
210 |
-
if ( $current_state !== Instant_Articles_Wizard_State::STATE_APP_SETUP ) {
|
211 |
-
die();
|
212 |
-
}
|
213 |
-
|
214 |
-
Instant_Articles_Option_FB_App::delete_option();
|
215 |
-
|
216 |
-
self::render( true );
|
217 |
-
die();
|
218 |
-
}
|
219 |
-
|
220 |
-
public static function is_page_signed_up() {
|
221 |
-
$page_id = sanitize_text_field( $_POST[ 'page_id' ] );
|
222 |
-
|
223 |
-
$fb_helper = new Instant_Articles_Wizard_FB_Helper();
|
224 |
-
$pages = $fb_helper->get_pages();
|
225 |
-
|
226 |
-
if ( isset( $pages[ $page_id ] ) && $pages[ $page_id ][ 'supports_instant_articles' ] ) {
|
227 |
-
die( 'yes' );
|
228 |
-
}
|
229 |
-
else {
|
230 |
-
die( 'no' );
|
231 |
-
}
|
232 |
-
}
|
233 |
-
|
234 |
-
public static function render( $ajax = false ) {
|
235 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
236 |
-
wp_die( esc_html( 'You do not have sufficient permissions to access this page.' ) );
|
237 |
-
}
|
238 |
-
|
239 |
-
try {
|
240 |
-
// Read options (they are used on the templates)
|
241 |
-
$current_state = Instant_Articles_Wizard_State::get_current_state();
|
242 |
-
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded();
|
243 |
-
$fb_app_settings = Instant_Articles_Option_FB_App::get_option_decoded();
|
244 |
-
$fb_helper = new Instant_Articles_Wizard_FB_Helper();
|
245 |
-
$settings_url = self::get_url();
|
246 |
-
|
247 |
-
// Handle redirection from Login flow
|
248 |
-
// ----------------------------------
|
249 |
-
// Only during STATE_APP_SETUP
|
250 |
-
if ( $current_state === Instant_Articles_Wizard_State::STATE_APP_SETUP ) {
|
251 |
-
$user_access_token = $fb_helper->get_fb_access_token();
|
252 |
-
$permissions = $fb_helper->get_fb_permissions( $user_access_token );
|
253 |
-
|
254 |
-
// Trigger transition if all needed permissions are granted
|
255 |
-
if ( $user_access_token && isset( $permissions[ 'pages_manage_instant_articles' ] ) && isset( $permissions[ 'pages_show_list' ] ) ) {
|
256 |
-
Instant_Articles_Wizard_State::do_transition( Instant_Articles_Wizard_State::STATE_PAGE_SELECTION, array(
|
257 |
-
'app_id' => $fb_app_settings[ 'app_id' ],
|
258 |
-
'app_secret' => $fb_app_settings[ 'app_secret' ],
|
259 |
-
'user_access_token' => $user_access_token->getValue()
|
260 |
-
) );
|
261 |
-
// Override step
|
262 |
-
$current_state = Instant_Articles_Wizard_State::get_current_state();
|
263 |
-
}
|
264 |
-
}
|
265 |
-
// ----------------------------------
|
266 |
-
|
267 |
-
// Handle redirection from Login flow
|
268 |
-
// ----------------------------------
|
269 |
-
// Only during STATE_PAGE_SELECTION
|
270 |
-
if ( $current_state === Instant_Articles_Wizard_State::STATE_PAGE_SELECTION ) {
|
271 |
-
$fb_helper = new Instant_Articles_Wizard_FB_Helper();
|
272 |
-
try {
|
273 |
-
$pages = $fb_helper->get_pages();
|
274 |
-
} catch ( Exception $e ) {
|
275 |
-
// If we couldn't fetch the pages, revert to the App setup
|
276 |
-
Instant_Articles_Wizard_State::do_transition( Instant_Articles_Wizard_State::STATE_APP_SETUP );
|
277 |
-
}
|
278 |
-
}
|
279 |
-
|
280 |
-
// Grabs the current configured style
|
281 |
-
// ----------------------------------
|
282 |
-
// Only during STATE_STYLE_SELECTION
|
283 |
-
if ( $current_state === Instant_Articles_Wizard_State::STATE_STYLE_SELECTION ) {
|
284 |
-
$settings_style = Instant_Articles_Option_Styles::get_option_decoded();
|
285 |
-
if ( isset( $settings_style['article_style'] ) && ! empty( $settings_style['article_style'] ) ) {
|
286 |
-
$article_style = $settings_style['article_style'];
|
287 |
-
} else {
|
288 |
-
$article_style = 'default';
|
289 |
-
}
|
290 |
-
}
|
291 |
-
// ----------------------------------
|
292 |
-
|
293 |
-
|
294 |
-
// Check submission status
|
295 |
-
// ----------------------------------
|
296 |
-
// Only during STATE_REVIEW_SUBMISSION
|
297 |
-
if ( $current_state === Instant_Articles_Wizard_State::STATE_REVIEW_SUBMISSION ) {
|
298 |
-
$review_submission_status = Instant_Articles_Wizard_Review_Submission::getReviewSubmissionStatus();
|
299 |
-
|
300 |
-
if ( $review_submission_status === Instant_Articles_Wizard_Review_Submission::STATUS_NOT_SUBMITTED ) {
|
301 |
-
$articles_for_review = Instant_Articles_Wizard_Review_Submission::getArticlesForReview();
|
302 |
-
|
303 |
-
// Map to Instant_Articles_Post instances
|
304 |
-
$instant_articles_for_review = array_map( function ( $article ) {
|
305 |
-
$instant_articles_post = new Instant_Articles_Post( $article );
|
306 |
-
// Call transformation to load warnings
|
307 |
-
$instant_articles_post->to_instant_article();
|
308 |
-
return $instant_articles_post;
|
309 |
-
}, $articles_for_review );
|
310 |
-
|
311 |
-
// Filter articles with warnings and not forced
|
312 |
-
$instant_articles_with_warnings = array_filter( $instant_articles_for_review, function ( $article ) {
|
313 |
-
$has_warnings = ( count( $article->transformer->getWarnings() ) > 0 );
|
314 |
-
$force_submit = get_post_meta( $article->get_the_id(), Instant_Articles_Publisher::FORCE_SUBMIT_KEY, true );
|
315 |
-
return $has_warnings && ! $force_submit;
|
316 |
-
} );
|
317 |
-
}
|
318 |
-
}
|
319 |
-
// ----------------------------------
|
320 |
-
|
321 |
-
include( dirname( __FILE__ ) . '/templates/wizard-template.php' );
|
322 |
-
} catch (Exception $e) {
|
323 |
-
if ( Instant_Articles_Wizard_State::get_current_state() !== Instant_Articles_Wizard_State::STATE_APP_SETUP ) {
|
324 |
-
// Restarts the wizard
|
325 |
-
Instant_Articles_Wizard_State::do_transition( Instant_Articles_Wizard_State::STATE_APP_SETUP );
|
326 |
-
echo '<div class="error settings-error notice is-dismissible"><p><strong>'.
|
327 |
-
esc_html(
|
328 |
-
'Error processing your request. Check server log for more details. Setup and login again to renew Application credentials. Error message: ' .
|
329 |
-
$e->getMessage()
|
330 |
-
) . '</strong></p></div>';
|
331 |
-
Instant_Articles_Wizard::render( $ajax, true );
|
332 |
-
}
|
333 |
-
}
|
334 |
-
}
|
335 |
-
|
336 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/state_machine.txt
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
-----------------------------------------------------------------------------------------------------------------------
|
2 |
-
Facebook Instant Articles for WordPress
|
3 |
-
-----------------------------------------------------------------------------------------------------------------------
|
4 |
-
Setup Wizard State Machine
|
5 |
-
-----------------------------------------------------------------------------------------------------------------------
|
6 |
-
|
7 |
-
|
8 |
-
┌──────────────────────────────────────────────edit_app───────────────────────────────────────────────┐
|
9 |
-
│ │
|
10 |
-
│ ┌──────────────────────────edit_app─────────────────────────────┐ │
|
11 |
-
│ │ │ │
|
12 |
-
│ │ ┌──────────edit_app──────────┐ │ │
|
13 |
-
│ │ │ │ │ │
|
14 |
-
▼ ▼ ▼ │ │ │
|
15 |
-
┏━━━━━━━━━┓ ┏━━━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━┓
|
16 |
-
┃APP_SETUP┃───set_up_app───▶┃PAGE_SELECTION┃───select_page──▶┃STYLE_SELECTION┃───select_style──▶┃REVIEW_SUBMISSION┃
|
17 |
-
┗━━━━━━━━━┛ ┗━━━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━━┛
|
18 |
-
▲ ▲ ▲ │ ▲ │ │
|
19 |
-
│ │ │ │ │ │ │
|
20 |
-
│ │ └──────────edit_page───────────┘ └──────────edit_style─────────┘ │
|
21 |
-
start_wizard │ │
|
22 |
-
│ └───────────────────────────edit_page────────────────────────────────┘
|
23 |
-
│
|
24 |
-
┏━━━━━━━━┓
|
25 |
-
┃OVERVIEW┃
|
26 |
-
┗━━━━━━━━┛
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/templates/advanced-template.php
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
|
10 |
-
?>
|
11 |
-
|
12 |
-
<div class="instant-articles-card">
|
13 |
-
<div class="instant-articles-card-content">
|
14 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
15 |
-
<form method="post" action="options.php">
|
16 |
-
<?php settings_fields( Instant_Articles_Option::PAGE_OPTION_GROUP ); ?>
|
17 |
-
<p>Configure settings for your styles, ads, analytics and publishing in Instant Articles. Review our <a href="https://developers.facebook.com/docs/instant-articles" target="_blank">developer documentation</a> to learn more.</p>
|
18 |
-
<hr />
|
19 |
-
<?php do_settings_sections( Instant_Articles_Option_Styles::OPTION_KEY ); ?>
|
20 |
-
<hr />
|
21 |
-
<?php do_settings_sections( Instant_Articles_Option_Ads::OPTION_KEY ); ?>
|
22 |
-
<hr />
|
23 |
-
<?php do_settings_sections( Instant_Articles_Option_Analytics::OPTION_KEY ); ?>
|
24 |
-
<hr />
|
25 |
-
<?php do_settings_sections( Instant_Articles_Option_Publishing::OPTION_KEY ); ?>
|
26 |
-
<hr />
|
27 |
-
<?php submit_button( __( 'Save changes' ) ); ?>
|
28 |
-
</form>
|
29 |
-
</div>
|
30 |
-
</div>
|
31 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/templates/all-steps-wizard.php
DELETED
@@ -1,288 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
?>
|
10 |
-
<div class="instant-articles-card">
|
11 |
-
<div class="instant-articles-card-content">
|
12 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
13 |
-
<h3>Setting up Instant Articles</h3>
|
14 |
-
<div class="instant-articles-card-steps">
|
15 |
-
<div class="instant-articles-card-step">
|
16 |
-
<img src="/wp-content/plugins/facebook-instant-articles-wp/assets/key@2x.png">
|
17 |
-
<p>Enter Facebook App ID and connect to Facebook to Enable Plugin</p>
|
18 |
-
</div>
|
19 |
-
<div class="instant-articles-card-step">
|
20 |
-
<img src="/wp-content/plugins/facebook-instant-articles-wp/assets/connect@2x.png">
|
21 |
-
<p>Sign up for Instant Articles and select your Facebook Page</p>
|
22 |
-
</div>
|
23 |
-
<div class="instant-articles-card-step">
|
24 |
-
<img src="/wp-content/plugins/facebook-instant-articles-wp/assets/customize@2x.png">
|
25 |
-
<p>Choose how you want your Instant Articles to look using the Style Editor</p>
|
26 |
-
</div>
|
27 |
-
<div class="instant-articles-card-step">
|
28 |
-
<img src="/wp-content/plugins/facebook-instant-articles-wp/assets/check@2x.png">
|
29 |
-
<p>Submit your Instant Articles for review and start publishing</p>
|
30 |
-
</div>
|
31 |
-
</div>
|
32 |
-
<button class="instant-articles-button instant-articles-button-highlight instant-articles-button-centered">
|
33 |
-
<label>Next</label>
|
34 |
-
</button>
|
35 |
-
</div>
|
36 |
-
</div>
|
37 |
-
</div>
|
38 |
-
|
39 |
-
|
40 |
-
<div class="instant-articles-card-bullet-bar">
|
41 |
-
<div class="instant-articles-card-bullet-step instant-articles-card-bullet-step-completed">
|
42 |
-
<div class="instant-articles-card-bullet">✔</div>
|
43 |
-
<div class="instant-articles-card-bullet-path"></div>
|
44 |
-
<p>Enter Facebook App ID and connect to Facebook to Enable Plugin</p>
|
45 |
-
</div>
|
46 |
-
<div class="instant-articles-card-bullet-step instant-articles-card-bullet-step-completed">
|
47 |
-
<div class="instant-articles-card-bullet">✔</div>
|
48 |
-
<div class="instant-articles-card-bullet-path"></div>
|
49 |
-
<p>Sign up for Instant Articles and select your Facebook Page</p>
|
50 |
-
</div>
|
51 |
-
<div class="instant-articles-card-bullet-step instant-articles-card-bullet-step-current">
|
52 |
-
<div class="instant-articles-card-bullet"></div>
|
53 |
-
<div class="instant-articles-card-bullet-path"></div>
|
54 |
-
<p>Choose how you want your Instant Articles to look using the Style Editor</p>
|
55 |
-
</div>
|
56 |
-
<div class="instant-articles-card-bullet-step">
|
57 |
-
<div class="instant-articles-card-bullet"></div>
|
58 |
-
<p>Submit your Instant Articles for review and start publishing</p>
|
59 |
-
</div>
|
60 |
-
</div>
|
61 |
-
|
62 |
-
<div class="instant-articles-card">
|
63 |
-
<div class="instant-articles-card-title">
|
64 |
-
<h3>Authenticate Plugin</h3>
|
65 |
-
<div class="instant-articles-card-title-right">
|
66 |
-
<span class="instant-articles-card-title-checkmark">✔</span>
|
67 |
-
<label class="instant-articles-card-title-label">App connected:</label>
|
68 |
-
<span class="instant-articles-card-title-value">1273677375983360</span>
|
69 |
-
<a class="instant-articles-card-title-edit" href="#"></a>
|
70 |
-
<span class="instant-articles-card-title-step">Step 1 of 2</span>
|
71 |
-
</div>
|
72 |
-
</div>
|
73 |
-
<div class="instant-articles-card-content">
|
74 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-left">
|
75 |
-
<label>Title of this section</label>
|
76 |
-
<p>Yo dawg, you need a Facebook App to enable this plugin. It's for really cool security reasons. If you already know what I'm sayin' and have an App ID and App Secret, <a href="#">go here</a> to grab it. If you don't have any idea what's going on then go ahead and get an App ID already.</p>
|
77 |
-
<button class="instant-articles-button">
|
78 |
-
<label>Get App ID</label>
|
79 |
-
</button>
|
80 |
-
</div>
|
81 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-right">
|
82 |
-
<label class="instant-articles-label">App ID</label>
|
83 |
-
<input class="instant-articles-input-text"type="text"/>
|
84 |
-
<label class="instant-articles-label">App Secret</label>
|
85 |
-
<input class="instant-articles-input-text" type="password"/>
|
86 |
-
<button class="instant-articles-button instant-articles-button-highlight instant-articles-button-disabled">
|
87 |
-
<label>Submit</label>
|
88 |
-
</button>
|
89 |
-
</div>
|
90 |
-
</div>
|
91 |
-
</div>
|
92 |
-
|
93 |
-
<div class="instant-articles-card">
|
94 |
-
<div class="instant-articles-card-title">
|
95 |
-
<h3>Authenticate Plugin</h3>
|
96 |
-
<div class="instant-articles-card-title-right">
|
97 |
-
<span class="instant-articles-card-title-checkmark">✔</span>
|
98 |
-
<label class="instant-articles-card-title-label">App connected:</label>
|
99 |
-
<span class="instant-articles-card-title-value">1273677375983360</span>
|
100 |
-
<a class="instant-articles-card-title-edit" href="#"></a>
|
101 |
-
<span class="instant-articles-card-title-step">Step 2 of 2</span>
|
102 |
-
</div>
|
103 |
-
</div>
|
104 |
-
<div class="instant-articles-card-content">
|
105 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
106 |
-
<span class="instant-articles-card-title-checkmark">✔</span>
|
107 |
-
<label class="instant-articles-card-title-label">App connected:</label>
|
108 |
-
<span class="instant-articles-card-title-value">1273677375983360</span>
|
109 |
-
<a class="instant-articles-card-title-edit" href="#"></a>
|
110 |
-
<hr/>
|
111 |
-
<label>Connect your Facebook Account</label>
|
112 |
-
<p>Login with Facebook to finish activating the Instant Articles Plugin.</p>
|
113 |
-
<button class="instant-articles-button">
|
114 |
-
<span class="instant-articles-button-icon-facebook"></span>
|
115 |
-
<label>Login with Facebook</label>
|
116 |
-
</button>
|
117 |
-
</div>
|
118 |
-
</div>
|
119 |
-
</div>
|
120 |
-
|
121 |
-
|
122 |
-
<div class="instant-articles-card instant-articles-card-collapsed">
|
123 |
-
<div class="instant-articles-card-title">
|
124 |
-
<h3>Authenticate Plugin</h3>
|
125 |
-
<div class="instant-articles-card-title-right">
|
126 |
-
<span class="instant-articles-card-title-checkmark">✔</span>
|
127 |
-
<label class="instant-articles-card-title-label">App connected:</label>
|
128 |
-
<span class="instant-articles-card-title-value">1273677375983360</span>
|
129 |
-
<a class="instant-articles-card-title-edit" href="#"></a>
|
130 |
-
<span class="instant-articles-card-title-step">Step 1 of 2</span>
|
131 |
-
</div>
|
132 |
-
</div>
|
133 |
-
<div class="instant-articles-card-content">
|
134 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-left">
|
135 |
-
<label>Title of this section</label>
|
136 |
-
<p>Yo dawg, you need a Facebook App to enable this plugin. It's for really cool security reasons. If you already know what I'm sayin' and have an App ID and App Secret, <a href="#">go here</a> to grab it. If you don't have any idea what's going on then go ahead and get an App ID already.</p>
|
137 |
-
<button class="instant-articles-button">
|
138 |
-
<label>Get App ID</label>
|
139 |
-
</button>
|
140 |
-
</div>
|
141 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-right">
|
142 |
-
<label class="instant-articles-label">App ID</label>
|
143 |
-
<input class="instant-articles-input-text"type="text"/>
|
144 |
-
<label class="instant-articles-label">App Secret</label>
|
145 |
-
<input class="instant-articles-input-text" type="text"/>
|
146 |
-
<button class="instant-articles-button instant-articles-button-highlight instant-articles-button-disabled">
|
147 |
-
<label>Submit</label>
|
148 |
-
</button>
|
149 |
-
</div>
|
150 |
-
</div>
|
151 |
-
</div>
|
152 |
-
|
153 |
-
<div class="instant-articles-card">
|
154 |
-
<div class="instant-articles-card-title">
|
155 |
-
<h3>Select Facebook Page</h3>
|
156 |
-
</div>
|
157 |
-
<div class="instant-articles-card-content">
|
158 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
159 |
-
<p>Select the Facebook Page that you want to enable Instant Articles tools. Anyone with an admin role on that Page will also be able to access your Instant Articles tools.</p>
|
160 |
-
<ul>
|
161 |
-
<li>
|
162 |
-
<input type="radio" name="page-id"/>
|
163 |
-
<img class="instant-articles-page-img" src=""/>
|
164 |
-
<label>The Salty Shop</label>
|
165 |
-
</li>
|
166 |
-
<li>
|
167 |
-
<input type="radio" name="page-id"/>
|
168 |
-
<img class="instant-articles-page-img" src=""/>
|
169 |
-
<label>The Sweet Shop</label>
|
170 |
-
</li>
|
171 |
-
<li>
|
172 |
-
<input type="radio" name="page-id"/>
|
173 |
-
<img class="instant-articles-page-img" src=""/>
|
174 |
-
<label>Free Market street</label>
|
175 |
-
</li>
|
176 |
-
<li>
|
177 |
-
<input type="radio" name="page-id"/>
|
178 |
-
<img class="instant-articles-page-img" src="https://z-1-scontent-atl3-1.xx.fbcdn.net/v/t1.0-1/p160x160/943890_1119857341366295_1442705195804509998_n.jpg?oh=6e5a53e35daeb43b5f31f3d309dce08f&oe=582BADB5"/>
|
179 |
-
<label>The mall</label>
|
180 |
-
</li>
|
181 |
-
<li>
|
182 |
-
<input type="radio" name="page-id"/>
|
183 |
-
<img class="instant-articles-page-img" src="https://z-1-scontent-atl3-1.xx.fbcdn.net/v/t1.0-1/p160x160/12400471_1021643444544180_2130580769920124493_n.png?oh=3018153ee4db69a4737cd96197691d7f&oe=582BE583"/>
|
184 |
-
<label>Hilo CrossFit</label>
|
185 |
-
</li>
|
186 |
-
<li>
|
187 |
-
<input type="radio" name="page-id"/>
|
188 |
-
<img class="instant-articles-page-img" src=""/>
|
189 |
-
<label>Street Dancer</label>
|
190 |
-
</li>
|
191 |
-
</ul>
|
192 |
-
<button class="instant-articles-button instant-articles-button-highlight">
|
193 |
-
<label>Select</label>
|
194 |
-
</button>
|
195 |
-
</div>
|
196 |
-
</div>
|
197 |
-
</div>
|
198 |
-
|
199 |
-
<div class="instant-articles-card instant-articles-card-collapsed">
|
200 |
-
<div class="instant-articles-card-title">
|
201 |
-
<h3>Facebook Page Enabled</h3>
|
202 |
-
<div class="instant-articles-card-title-right">
|
203 |
-
<a href="" class="instant-articles-card-title-link">Hilo CrossFit</a>
|
204 |
-
<img class="instant-articles-page-img" src=""/>
|
205 |
-
<a class="instant-articles-card-title-edit" href="#"></a>
|
206 |
-
</div>
|
207 |
-
</div>
|
208 |
-
<div class="instant-articles-card-content">
|
209 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
210 |
-
<p>Select the Facebook Page that you want to enable Instant Articles tools. Anyone with an admin role on that Page will also be able to access your Instant Articles tools.</p>
|
211 |
-
<ul>
|
212 |
-
<li>
|
213 |
-
<input type="radio" name="page-id"/>
|
214 |
-
<img class="instant-articles-page-img" src=""/>
|
215 |
-
<label>The Salty Shop</label>
|
216 |
-
</li>
|
217 |
-
<li>
|
218 |
-
<input type="radio" name="page-id"/>
|
219 |
-
<img class="instant-articles-page-img" src=""/>
|
220 |
-
<label>The Sweet Shop</label>
|
221 |
-
</li>
|
222 |
-
<li>
|
223 |
-
<input type="radio" name="page-id"/>
|
224 |
-
<img class="instant-articles-page-img" src=""/>
|
225 |
-
<label>Free Market street</label>
|
226 |
-
</li>
|
227 |
-
<li>
|
228 |
-
<input type="radio" name="page-id"/>
|
229 |
-
<img class="instant-articles-page-img" src="https://z-1-scontent-atl3-1.xx.fbcdn.net/v/t1.0-1/p160x160/943890_1119857341366295_1442705195804509998_n.jpg?oh=6e5a53e35daeb43b5f31f3d309dce08f&oe=582BADB5"/>
|
230 |
-
<label>The mall</label>
|
231 |
-
</li>
|
232 |
-
<li class="instant-articles-radio-selected">
|
233 |
-
<input type="radio" name="page-id" checked="checked"/>
|
234 |
-
<img class="instant-articles-page-img" src="https://z-1-scontent-atl3-1.xx.fbcdn.net/v/t1.0-1/p160x160/12400471_1021643444544180_2130580769920124493_n.png?oh=3018153ee4db69a4737cd96197691d7f&oe=582BE583"/>
|
235 |
-
<label>Hilo CrossFit</label>
|
236 |
-
</li>
|
237 |
-
<li>
|
238 |
-
<input type="radio" name="page-id"/>
|
239 |
-
<img class="instant-articles-page-img" src=""/>
|
240 |
-
<label>Street Dancer</label>
|
241 |
-
</li>
|
242 |
-
</ul>
|
243 |
-
<button class="instant-articles-button instant-articles-button-highlight">
|
244 |
-
<label>Select</label>
|
245 |
-
</button>
|
246 |
-
</div>
|
247 |
-
</div>
|
248 |
-
</div>
|
249 |
-
|
250 |
-
<div class="instant-articles-card">
|
251 |
-
<div class="instant-articles-card-title">
|
252 |
-
<h3>Style & Preview Articles</h3>
|
253 |
-
</div>
|
254 |
-
<div class="instant-articles-card-content">
|
255 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
256 |
-
<p>Lorem ipsum dolor sit amet, consectetuer adipscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis notoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.</p>
|
257 |
-
<button class="instant-articles-button">
|
258 |
-
<label>Choose style</label>
|
259 |
-
</button>
|
260 |
-
</div>
|
261 |
-
</div>
|
262 |
-
</div>
|
263 |
-
|
264 |
-
<div class="instant-articles-card instant-articles-card-collapsed">
|
265 |
-
<div class="instant-articles-card-title">
|
266 |
-
<h3>Style Selected</h3>
|
267 |
-
<div class="instant-articles-card-title-right">
|
268 |
-
<a href="" class="instant-articles-card-title-link">Sweet Shop Style 01</a>
|
269 |
-
<a class="instant-articles-card-title-edit" href="#"></a>
|
270 |
-
</div>
|
271 |
-
</div>
|
272 |
-
</div>
|
273 |
-
|
274 |
-
<div class="instant-articles-card">
|
275 |
-
<div class="instant-articles-card-title">
|
276 |
-
<h3>Submit for Review</h3>
|
277 |
-
</div>
|
278 |
-
<div class="instant-articles-card-content">
|
279 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
280 |
-
<p>Lorem ipsum dolor sit amet, consectetuer adipscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis notoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.</p>
|
281 |
-
<button class="instant-articles-button instant-articles-button-highlight">
|
282 |
-
<label>Submit for Review</label>
|
283 |
-
</button>
|
284 |
-
</div>
|
285 |
-
</div>
|
286 |
-
</div>
|
287 |
-
|
288 |
-
<a class="instant-articles-advanced-settings" href="#">► Advanced Settings</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/templates/app-setup-template.php
DELETED
@@ -1,115 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
?>
|
10 |
-
<?php if ( empty( $fb_app_settings['app_id'] ) || empty( $fb_app_settings['app_secret'] ) ) : ?>
|
11 |
-
|
12 |
-
<!-- Step 1: grab your App ID and App Secret -->
|
13 |
-
<div class="instant-articles-card">
|
14 |
-
<div class="instant-articles-card-title">
|
15 |
-
<h3>Log In With Your Developers App and Facebook Account</h3>
|
16 |
-
<div class="instant-articles-card-title-right">
|
17 |
-
<span class="instant-articles-card-title-step">Step 1 of 2</span>
|
18 |
-
</div>
|
19 |
-
</div>
|
20 |
-
<div class="instant-articles-card-content">
|
21 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-left">
|
22 |
-
<label>First, log in with your Facebook Developers App</label>
|
23 |
-
|
24 |
-
<p>You'll need to log in with your Facebook Developers App ID to connect your plugin to the Facebook Page you'll use to publish your Instant Articles.</p>
|
25 |
-
|
26 |
-
<p><strong>Already have an App ID and App Secret?</strong> Just enter them to the right.</p>
|
27 |
-
|
28 |
-
<p><strong>Need to create one?</strong></p>
|
29 |
-
|
30 |
-
<p>Click on the 'Get App ID' button below to begin the process of getting your App ID and App Secret. This will open the app set up page in a new tab. Then, follow these steps:</p>
|
31 |
-
|
32 |
-
<ol>
|
33 |
-
<li>Click on the green '+ Add a New App' button in the upper right corner of the page.</li>
|
34 |
-
<li>If you are prompted to select a platform, select 'basic setup.' If you don't see this prompt, don't worry; just go directly to Step 3.</li>
|
35 |
-
<li>Create an app name (it can be whatever you want it to be), input your email and select 'Apps for Pages' in the 'Category' dropdown menu. Click 'Create App ID' when you’re ready.</li>
|
36 |
-
<li>Click on 'Settings' in the left nav bar.</li>
|
37 |
-
<li>Click '+Add Platform' at the bottom of the page and select 'Website.'</li>
|
38 |
-
<li>Under both the 'App Domains' in the main section and 'Site URL' in the 'Website' section, enter this domain: <b><?php echo esc_url( self::get_admin_url() ); ?></b></li>
|
39 |
-
<li>Click 'Save Changes' in the lower right corner.</li>
|
40 |
-
<li>Select 'Show' to see your App Secret. Copy your App ID and App Secret and enter them to the right.</li>
|
41 |
-
</ol>
|
42 |
-
|
43 |
-
<p>For more detailed instructions on setting up your App ID, <a href="https://developers.facebook.com/docs/instant-articles/wordpress-quickstart#appid" target="_blank">check out the docs</a>.</p>
|
44 |
-
|
45 |
-
<a class="instant-articles-button" href="https://developers.facebook.com/apps" target="_blank">
|
46 |
-
Get App ID
|
47 |
-
</a>
|
48 |
-
</div>
|
49 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-right">
|
50 |
-
<label class="instant-articles-label">App ID</label>
|
51 |
-
<input name="app_id" class="instant-articles-input-text" type="text"/>
|
52 |
-
<label class="instant-articles-label">App Secret</label>
|
53 |
-
<input name="app_secret" class="instant-articles-input-text" type="password"/>
|
54 |
-
<button id="instant-articles-wizard-save-app" class="instant-articles-button instant-articles-button-highlight instant-articles-button-disabled">
|
55 |
-
<label>Log In</label>
|
56 |
-
</button>
|
57 |
-
</div>
|
58 |
-
<br clear="both" />
|
59 |
-
</div>
|
60 |
-
</div>
|
61 |
-
|
62 |
-
<?php else: ?>
|
63 |
-
|
64 |
-
<!-- Step 2: log in with Facebook -->
|
65 |
-
<div class="instant-articles-card">
|
66 |
-
<div class="instant-articles-card-title">
|
67 |
-
<h3>Log In with Your Developers App and Facebook Account</h3>
|
68 |
-
<div class="instant-articles-card-title-right">
|
69 |
-
<span class="instant-articles-card-title-step">Step 2 of 2</span>
|
70 |
-
</div>
|
71 |
-
</div>
|
72 |
-
<div class="instant-articles-card-content">
|
73 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
74 |
-
<span class="instant-articles-card-title-checkmark">✔</span>
|
75 |
-
<label class="instant-articles-card-title-label">App connected:</label>
|
76 |
-
<span class="instant-articles-card-title-value"><?php echo esc_html( $fb_app_settings[ 'app_id' ] ); ?></span>
|
77 |
-
<a id="instant-articles-wizard-edit-app" class="instant-articles-card-title-edit" href="#"></a>
|
78 |
-
<hr/>
|
79 |
-
<label>Next, log into your Facebook account</label>
|
80 |
-
<p>Log in with Facebook to finish connecting the Instant Articles Plugin to your account.</p>
|
81 |
-
<?php
|
82 |
-
if (
|
83 |
-
$user_access_token &&
|
84 |
-
(
|
85 |
-
! isset( $permissions['pages_manage_instant_articles'] ) ||
|
86 |
-
! isset( $permissions['pages_show_list'] )
|
87 |
-
)
|
88 |
-
) :
|
89 |
-
?>
|
90 |
-
<p>In order to finish the activation, you need to grant all the requested permissions:</p>
|
91 |
-
<ul>
|
92 |
-
<?php if ( ! isset( $permissions['pages_show_list'] ) ) : ?>
|
93 |
-
<li>
|
94 |
-
<b>Show a list of the Pages you manage</b>: allows the plugin to show the list of your
|
95 |
-
pages for you to select one.
|
96 |
-
</li>
|
97 |
-
<?php endif; ?>
|
98 |
-
<?php if ( ! isset( $permissions['pages_manage_instant_articles'] ) ) : ?>
|
99 |
-
<li>
|
100 |
-
<b>Manage Instant Articles for your Pages</b>: allows us to publish
|
101 |
-
Instant Articles to your selected page.
|
102 |
-
</li>
|
103 |
-
<?php endif; ?>
|
104 |
-
</ul>
|
105 |
-
<?php endif;?>
|
106 |
-
|
107 |
-
<a href="<?php echo esc_attr( $fb_helper->get_login_url() ); ?>" class="instant-articles-button">
|
108 |
-
<span class="instant-articles-button-icon-facebook"></span>
|
109 |
-
<label>Login with Facebook</label>
|
110 |
-
</a>
|
111 |
-
</div>
|
112 |
-
<div clear="both" />
|
113 |
-
</div>
|
114 |
-
</div>
|
115 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/templates/overview-template.php
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
?>
|
10 |
-
<div class="instant-articles-card">
|
11 |
-
<div class="instant-articles-card-content">
|
12 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
13 |
-
<h3>Get Started with the Instant Articles WordPress Plugin</h3>
|
14 |
-
<div class="instant-articles-card-steps">
|
15 |
-
<div class="instant-articles-card-step">
|
16 |
-
<img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>../../assets/key@2x.png">
|
17 |
-
<h4>Set Up and Log In</h4>
|
18 |
-
<p>If you don't have one already, set up your Facebook Developers App. This will allow you to log in and connect your plugin.</p>
|
19 |
-
</div>
|
20 |
-
<div class="instant-articles-card-step">
|
21 |
-
<img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>../../assets/connect@2x.png">
|
22 |
-
<h4>Select Your Page</h4>
|
23 |
-
<p>Select the Page you'll use to publish your Instant Articles.</p>
|
24 |
-
</div>
|
25 |
-
<div class="instant-articles-card-step">
|
26 |
-
<img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>../../assets/customize@2x.png">
|
27 |
-
<h4>Customize Your Style</h4>
|
28 |
-
<p>Use our Style Editor to make your Instant Articles look just how you want them to.</p>
|
29 |
-
</div>
|
30 |
-
<div class="instant-articles-card-step">
|
31 |
-
<img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>../../assets/check@2x.png">
|
32 |
-
<h4>Submit for Review</h4>
|
33 |
-
<p>Submit your Instant Articles for review and start publishing.</p>
|
34 |
-
</div>
|
35 |
-
</div>
|
36 |
-
<button
|
37 |
-
class="instant-articles-button instant-articles-button-highlight instant-articles-button-centered instant-articles-wizard-transition"
|
38 |
-
data-new-state="STATE_APP_SETUP">
|
39 |
-
<label>Get Started</label>
|
40 |
-
</button>
|
41 |
-
</div>
|
42 |
-
</div>
|
43 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/templates/page-selection-template.php
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
?>
|
10 |
-
<div class="instant-articles-card instant-articles-card-collapsed">
|
11 |
-
<div class="instant-articles-card-title">
|
12 |
-
<h3>Logged In</h3>
|
13 |
-
<div class="instant-articles-card-title-right">
|
14 |
-
<span class="instant-articles-card-title-checkmark">✔</span>
|
15 |
-
<label class="instant-articles-card-title-label">App connected:</label>
|
16 |
-
<span class="instant-articles-card-title-value"><?php echo esc_html( $fb_app_settings[ 'app_id' ] ); ?></span>
|
17 |
-
<a class="instant-articles-wizard-transition instant-articles-card-title-edit" href="#" data-new-state="<?php echo esc_attr( Instant_Articles_Wizard_State::STATE_APP_SETUP ); ?>"></a>
|
18 |
-
</div>
|
19 |
-
</div>
|
20 |
-
</div>
|
21 |
-
|
22 |
-
<div class="instant-articles-card">
|
23 |
-
<div class="instant-articles-card-title">
|
24 |
-
<h3>Which Page Would You Like to Use for Instant Articles?</h3>
|
25 |
-
</div>
|
26 |
-
<div class="instant-articles-card-content">
|
27 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
28 |
-
<p>
|
29 |
-
Select the Page you'd like to use to access the Instant Articles tools.
|
30 |
-
Anyone with an admin role will also be able to use the tools.
|
31 |
-
Don't have a Page yet?
|
32 |
-
<strong><a href="https://www.facebook.com/pages/create" target="_blank">Create one</a>.</strong>
|
33 |
-
</p>
|
34 |
-
<ul class="instant-articles-wizard-page-selection">
|
35 |
-
<?php foreach ( $pages as $page ) { ?>
|
36 |
-
<li>
|
37 |
-
<input
|
38 |
-
type="radio"
|
39 |
-
name="page_id"
|
40 |
-
value="<?php echo esc_attr( $page[ 'page_id' ] ) ?>"
|
41 |
-
data-signed-up="<?php echo $page[ 'supports_instant_articles' ] ? 'yes' : 'no'; ?>"
|
42 |
-
/>
|
43 |
-
<img class="instant-articles-page-img" src="<?php echo esc_attr( $page[ 'page_picture' ] ) ?>"/>
|
44 |
-
<label>
|
45 |
-
<?php echo esc_html( $page[ 'page_name' ] ) ?>
|
46 |
-
<?php if ( ! $page[ 'supports_instant_articles' ] ) : ?>
|
47 |
-
<span class="page-not-enabled">
|
48 |
-
First, <a href="https://www.facebook.com/instant_articles/signup?redirect_uri=<?php echo rawurlencode( $settings_url ) ?>&page_id=<?php echo rawurlencode( $page[ 'page_id' ] ) ?>">sign up</a>
|
49 |
-
this Page to access the Instant Articles tools through Facebook. Then select it here.
|
50 |
-
</span>
|
51 |
-
<?php endif; ?>
|
52 |
-
</label>
|
53 |
-
</li>
|
54 |
-
<?php } ?>
|
55 |
-
</ul>
|
56 |
-
<button id="instant-articles-wizard-select-page" class="instant-articles-button instant-articles-button-highlight instant-articles-button-disabled">
|
57 |
-
<label>Select</label>
|
58 |
-
</button>
|
59 |
-
</div>
|
60 |
-
</div>
|
61 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/templates/review-submission-template.php
DELETED
@@ -1,190 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
?>
|
10 |
-
<div class="instant-articles-card instant-articles-card-collapsed">
|
11 |
-
<div class="instant-articles-card-title">
|
12 |
-
<h3>Logged In</h3>
|
13 |
-
<div class="instant-articles-card-title-right">
|
14 |
-
<span class="instant-articles-card-title-checkmark">✔</span>
|
15 |
-
<label class="instant-articles-card-title-label">App connected:</label>
|
16 |
-
<span class="instant-articles-card-title-value"><?php echo esc_html( $fb_app_settings[ 'app_id' ] ); ?></span>
|
17 |
-
<a class="instant-articles-wizard-transition instant-articles-card-title-edit" href="#" data-new-state="<?php echo esc_attr( Instant_Articles_Wizard_State::STATE_APP_SETUP ); ?>"></a>
|
18 |
-
</div>
|
19 |
-
</div>
|
20 |
-
</div>
|
21 |
-
|
22 |
-
<div class="instant-articles-card instant-articles-card-collapsed">
|
23 |
-
<div class="instant-articles-card-title">
|
24 |
-
<h3>Facebook Page Enabled</h3>
|
25 |
-
<div class="instant-articles-card-title-right">
|
26 |
-
<a href="" class="instant-articles-card-title-link"><?php echo esc_html( $fb_page_settings[ 'page_name' ] ) ?></a>
|
27 |
-
<?php if ( $fb_page_settings[ 'page_picture' ] ) : ?>
|
28 |
-
<img class="instant-articles-page-img" src="<?php echo esc_attr( $fb_page_settings[ 'page_picture' ] ) ?>"/>
|
29 |
-
<?php endif; ?>
|
30 |
-
<a class="instant-articles-wizard-transition instant-articles-card-title-edit" href="#" data-new-state="<?php echo esc_attr( Instant_Articles_Wizard_State::STATE_PAGE_SELECTION ); ?>"></a>
|
31 |
-
</div>
|
32 |
-
</div>
|
33 |
-
</div>
|
34 |
-
|
35 |
-
<div class="instant-articles-card instant-articles-card-collapsed">
|
36 |
-
<div class="instant-articles-card-title">
|
37 |
-
<h3>Style Customized</h3>
|
38 |
-
<div class="instant-articles-card-title-right">
|
39 |
-
<a class="instant-articles-wizard-transition instant-articles-card-title-edit" href="#" data-new-state="<?php echo esc_attr( Instant_Articles_Wizard_State::STATE_STYLE_SELECTION ); ?>"></a>
|
40 |
-
</div>
|
41 |
-
</div>
|
42 |
-
</div>
|
43 |
-
|
44 |
-
<?php
|
45 |
-
switch ( $review_submission_status ) :
|
46 |
-
|
47 |
-
case Instant_Articles_Wizard_Review_Submission::STATUS_NOT_SUBMITTED : ?>
|
48 |
-
|
49 |
-
<?php if ( count( $articles_for_review ) >= Instant_Articles_Wizard_Review_Submission::MIN_ARTICLES ) : ?>
|
50 |
-
<?php if ( count( $instant_articles_with_warnings ) > 0 ) : ?>
|
51 |
-
<div class="instant-articles-card">
|
52 |
-
<div class="instant-articles-card-title">
|
53 |
-
<h3>Submit for Review</h3>
|
54 |
-
</div>
|
55 |
-
<div class="instant-articles-card-content">
|
56 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
57 |
-
<p>
|
58 |
-
In order to begin publishing Instant Articles, our team needs to review a sample
|
59 |
-
batch of <?php echo esc_html( Instant_Articles_Wizard_Review_Submission::MIN_ARTICLES ); ?> of your Instant Articles.
|
60 |
-
</p>
|
61 |
-
<p>
|
62 |
-
The plugin tried to automatically transform your last <?php echo esc_html( Instant_Articles_Wizard_Review_Submission::MIN_ARTICLES ); ?>
|
63 |
-
posts into Instant Articles as a sample to submit for review, but some of these posts contained elements the plugin didn't know how to convert.
|
64 |
-
</p>
|
65 |
-
<p>
|
66 |
-
Before submitting for review, you'll need to handle the warnings on these articles by looking at the "Instant Articles" box on the post edit screen:
|
67 |
-
</p>
|
68 |
-
<ul>
|
69 |
-
<?php foreach ($instant_articles_with_warnings as $article): ?>
|
70 |
-
<li><?php edit_post_link( $article->get_the_title(), '- ', '', $article->get_the_id() ); ?> </li>
|
71 |
-
<?php endforeach; ?>
|
72 |
-
</ul>
|
73 |
-
<p>
|
74 |
-
Once you've handled these warnings, please return to this page and click the 'Submit for Review" button below.
|
75 |
-
</p>
|
76 |
-
<button id="instant-articles-wizard-submit-for-review" class="instant-articles-button-disabled instant-articles-button instant-articles-button-highlight">
|
77 |
-
<label>Submit for Review</label>
|
78 |
-
</button>
|
79 |
-
</div>
|
80 |
-
</div>
|
81 |
-
</div>
|
82 |
-
<?php else: ?>
|
83 |
-
<div class="instant-articles-card">
|
84 |
-
<div class="instant-articles-card-title">
|
85 |
-
<h3>Submit for Review</h3>
|
86 |
-
</div>
|
87 |
-
<div class="instant-articles-card-content">
|
88 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
89 |
-
<p>
|
90 |
-
The Instant Articles team will review a sample batch of your Instant Articles before you can begin to publish.
|
91 |
-
Click the 'Submit for Review" button below to send the last <?php echo esc_html( Instant_Articles_Wizard_Review_Submission::MIN_ARTICLES ); ?>
|
92 |
-
articles you've published to the team for review.
|
93 |
-
</p>
|
94 |
-
<p>
|
95 |
-
It will take us 2 business days to complete the review.
|
96 |
-
Once we've had a chance to take a look, we'll let you know if you're ready to start publishing or if you need to make some updates.
|
97 |
-
</p>
|
98 |
-
<button id="instant-articles-wizard-submit-for-review" class="instant-articles-button instant-articles-button-highlight">
|
99 |
-
<label>Submit for Review</label>
|
100 |
-
</button>
|
101 |
-
</div>
|
102 |
-
</div>
|
103 |
-
</div>
|
104 |
-
<?php endif; ?>
|
105 |
-
<?php else: ?>
|
106 |
-
<div class="instant-articles-card">
|
107 |
-
<div class="instant-articles-card-title">
|
108 |
-
<h3>Create More Articles to Submit for Review</h3>
|
109 |
-
</div>
|
110 |
-
<div class="instant-articles-card-content">
|
111 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
112 |
-
<p>
|
113 |
-
In order to begin publishing Instant Articles, our team needs to review a sample batch of <?php echo esc_html( Instant_Articles_Wizard_Review_Submission::MIN_ARTICLES ); ?>
|
114 |
-
of your Instant Articles. It looks like you don't have <?php echo esc_html( Instant_Articles_Wizard_Review_Submission::MIN_ARTICLES ); ?> articles available yet.
|
115 |
-
</p>
|
116 |
-
<p>
|
117 |
-
Once you've created the additional articles and have <?php echo esc_html( Instant_Articles_Wizard_Review_Submission::MIN_ARTICLES ); ?> available to send,
|
118 |
-
please return to this page and click the 'Submit for Review" button below.
|
119 |
-
</p>
|
120 |
-
<button id="instant-articles-wizard-submit-for-review" class="instant-articles-button-disabled instant-articles-button instant-articles-button-highlight">
|
121 |
-
<label>Submit for Review</label>
|
122 |
-
</button>
|
123 |
-
</div>
|
124 |
-
</div>
|
125 |
-
</div>
|
126 |
-
<?php endif; ?>
|
127 |
-
|
128 |
-
|
129 |
-
<?php break; ?>
|
130 |
-
|
131 |
-
<?php case Instant_Articles_Wizard_Review_Submission::STATUS_APPROVED : ?>
|
132 |
-
<div class="instant-articles-card instant-articles-card-success">
|
133 |
-
<div class="instant-articles-card-title">
|
134 |
-
<h3>Review Complete: Begin Publishing Your Instant Articles</h3>
|
135 |
-
</div>
|
136 |
-
<div class="instant-articles-card-content">
|
137 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
138 |
-
<p>
|
139 |
-
We reviewed some of your articles and they look great.
|
140 |
-
You're now ready to begin publishing your Instant Articles to Facebook and sharing them with your audience.
|
141 |
-
</p>
|
142 |
-
<p>
|
143 |
-
Next, set up monetization and analytics in Advanced Settings. Or explore the
|
144 |
-
<a href="<?php echo esc_url( 'https://www.facebook.com/' . $fb_page_settings['page_id'] . '/publishing_tools/?section=INSTANT_ARTICLES_SETTINGS' ); ?>" target="_blank">Instant Articles publishing tools</a>
|
145 |
-
through your selected Facebook Page.
|
146 |
-
</p>
|
147 |
-
</div>
|
148 |
-
</div>
|
149 |
-
</div>
|
150 |
-
<?php break; ?>
|
151 |
-
|
152 |
-
<?php case Instant_Articles_Wizard_Review_Submission::STATUS_REJECTED : ?>
|
153 |
-
<div class="instant-articles-card instant-articles-card-fail">
|
154 |
-
<div class="instant-articles-card-title">
|
155 |
-
<h3>Review Complete: Updates Needed</h3>
|
156 |
-
</div>
|
157 |
-
<div class="instant-articles-card-content">
|
158 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
159 |
-
<p>
|
160 |
-
We reviewed some of your articles and found a few things that need to be updated.
|
161 |
-
</p>
|
162 |
-
<p>
|
163 |
-
Please go to your selected
|
164 |
-
<a href="<?php echo esc_url( 'https://www.facebook.com/' . $fb_page_settings['page_id'] . '/publishing_tools/?section=INSTANT_ARTICLES_SETTINGS#Step-2' ); ?>" target="_blank">Facebook Page's Publishing Tools</a>
|
165 |
-
to get more specifics on the issues identified. Once these have been cleared up in WordPress, you'll be ready to begin publishing your Instant Articles.
|
166 |
-
</p>
|
167 |
-
</div>
|
168 |
-
</div>
|
169 |
-
</div>
|
170 |
-
<?php break; ?>
|
171 |
-
|
172 |
-
<?php case Instant_Articles_Wizard_Review_Submission::STATUS_PENDING : ?>
|
173 |
-
<div class="instant-articles-card">
|
174 |
-
<div class="instant-articles-card-title">
|
175 |
-
<h3>Review Articles Submitted</h3>
|
176 |
-
</div>
|
177 |
-
<div class="instant-articles-card-content">
|
178 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
179 |
-
<p>
|
180 |
-
Your articles have been submitted for review.
|
181 |
-
</p>
|
182 |
-
<p>
|
183 |
-
It will take us 2 business days to complete the review. Check back here to see the status of your review submission.
|
184 |
-
</p>
|
185 |
-
</div>
|
186 |
-
</div>
|
187 |
-
</div>
|
188 |
-
<?php break; ?>
|
189 |
-
|
190 |
-
<?php endswitch; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/templates/style-selection-template.php
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
?>
|
10 |
-
<div class="instant-articles-card instant-articles-card-collapsed">
|
11 |
-
<div class="instant-articles-card-title">
|
12 |
-
<h3>Logged In</h3>
|
13 |
-
<div class="instant-articles-card-title-right">
|
14 |
-
<span class="instant-articles-card-title-checkmark">✔</span>
|
15 |
-
<label class="instant-articles-card-title-label">App connected:</label>
|
16 |
-
<span class="instant-articles-card-title-value"><?php echo esc_html( $fb_app_settings[ 'app_id' ] ); ?></span>
|
17 |
-
<a class="instant-articles-wizard-transition instant-articles-card-title-edit" href="#" data-new-state="<?php echo esc_attr( Instant_Articles_Wizard_State::STATE_APP_SETUP ); ?>"></a>
|
18 |
-
</div>
|
19 |
-
</div>
|
20 |
-
</div>
|
21 |
-
|
22 |
-
<div class="instant-articles-card instant-articles-card-collapsed">
|
23 |
-
<div class="instant-articles-card-title">
|
24 |
-
<h3>Page Selected</h3>
|
25 |
-
<div class="instant-articles-card-title-right">
|
26 |
-
<a href="" class="instant-articles-card-title-link"><?php echo esc_html( $fb_page_settings[ 'page_name' ] ) ?></a>
|
27 |
-
<?php if ( $fb_page_settings[ 'page_picture' ] ) : ?>
|
28 |
-
<img class="instant-articles-page-img" src="<?php echo esc_url( $fb_page_settings[ 'page_picture' ] ) ?>"/>
|
29 |
-
<?php endif; ?>
|
30 |
-
<a class="instant-articles-wizard-transition instant-articles-card-title-edit" href="#" data-new-state="<?php echo esc_attr( Instant_Articles_Wizard_State::STATE_PAGE_SELECTION ); ?>"></a>
|
31 |
-
</div>
|
32 |
-
</div>
|
33 |
-
</div>
|
34 |
-
|
35 |
-
<div class="instant-articles-card">
|
36 |
-
<div class="instant-articles-card-title">
|
37 |
-
<h3>Customize Your Style with Style Editor</h3>
|
38 |
-
</div>
|
39 |
-
<div class="instant-articles-card-content">
|
40 |
-
<div class="instant-articles-card-content-box instant-articles-card-content-full">
|
41 |
-
<p>
|
42 |
-
Customize the look and feel of your articles with one or more unique styles.
|
43 |
-
Try to have design consistency between your Instant Articles and mobile
|
44 |
-
web articles and also ensure you upload your publication or blog's logo.
|
45 |
-
<a href="https://developers.facebook.com/docs/instant-articles/guides/design" target="_blank">Learn more in our design guidelines</a>.
|
46 |
-
</p>
|
47 |
-
<p>
|
48 |
-
Want to preview how your articles will look? Download Facebook Pages Manager on your
|
49 |
-
<a href="https://itunes.apple.com/us/app/facebook-pages-manager/id514643583?mt=8" target="_blank">iPhone</a>
|
50 |
-
or
|
51 |
-
<a href="https://play.google.com/store/apps/details?id=com.facebook.pages.app" target="_blank">Android</a>
|
52 |
-
phone.
|
53 |
-
</p>
|
54 |
-
<a
|
55 |
-
id="instant-articles-wizard-customize-style"
|
56 |
-
href="<?php echo esc_url( 'https://www.facebook.com/' . $fb_page_settings['page_id'] . '/publishing_tools/?section=INSTANT_ARTICLES_SETTINGS&initial_data[style]=' . $article_style ); ?>"
|
57 |
-
class="instant-articles-button instant-articles-button-highlight"
|
58 |
-
target="_blank">
|
59 |
-
Customize
|
60 |
-
</a>
|
61 |
-
<button id="instant-articles-wizard-customize-style-next" class="instant-articles-button instant-articles-wizard-transition" data-new-state="<?php echo esc_attr( Instant_Articles_Wizard_State::STATE_REVIEW_SUBMISSION ); ?>">
|
62 |
-
<label>Next</label>
|
63 |
-
</button>
|
64 |
-
</div>
|
65 |
-
</div>
|
66 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wizard/templates/wizard-template.php
DELETED
@@ -1,115 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Facebook Instant Articles for WP.
|
4 |
-
* This source code is licensed under the license found in the
|
5 |
-
* LICENSE file in the root directory of this source tree.
|
6 |
-
*
|
7 |
-
* @package default
|
8 |
-
*/
|
9 |
-
?>
|
10 |
-
<?php if ( ! $ajax ) : ?>
|
11 |
-
<h1>Facebook Instant Articles Settings</h1>
|
12 |
-
<div id="instant_articles_wizard_messages"><?php settings_errors(); ?></div>
|
13 |
-
<div id="instant_articles_wizard">
|
14 |
-
<?php endif; ?>
|
15 |
-
|
16 |
-
<?php if ( $current_state !== Instant_Articles_Wizard_State::STATE_OVERVIEW ): ?>
|
17 |
-
<?php
|
18 |
-
// Calculate classes for the timeline
|
19 |
-
$state_css_classes = array();
|
20 |
-
foreach ( Instant_Articles_Wizard_State::$timeline as $state => $order ) {
|
21 |
-
switch ( Instant_Articles_Wizard_State::get_timeline_position( $state ) ) {
|
22 |
-
case Instant_Articles_Wizard_State::TIMELINE_PAST:
|
23 |
-
$state_css_classes[ $state ] = 'instant-articles-card-bullet-step-completed';
|
24 |
-
break;
|
25 |
-
case Instant_Articles_Wizard_State::TIMELINE_CURRENT:
|
26 |
-
$state_css_classes[ $state ] = 'instant-articles-card-bullet-step-current';
|
27 |
-
break;
|
28 |
-
case Instant_Articles_Wizard_State::TIMELINE_FUTURE:
|
29 |
-
$state_css_classes[ $state ] = '';
|
30 |
-
break;
|
31 |
-
}
|
32 |
-
}
|
33 |
-
?>
|
34 |
-
|
35 |
-
<div class="instant-articles-card-bullet-bar">
|
36 |
-
<div class="instant-articles-card-bullet-step <?php echo esc_attr( $state_css_classes[ Instant_Articles_Wizard_State::STATE_APP_SETUP ] ); ?>">
|
37 |
-
<div class="instant-articles-card-bullet"></div>
|
38 |
-
<div class="instant-articles-card-bullet-path"></div>
|
39 |
-
<?php if ( Instant_Articles_Wizard_State::get_timeline_position( Instant_Articles_Wizard_State::STATE_APP_SETUP ) === Instant_Articles_Wizard_State::TIMELINE_PAST ) : ?>
|
40 |
-
<h4>Logged In</h4>
|
41 |
-
<?php else : ?>
|
42 |
-
<h4>Set Up and Log In</h4>
|
43 |
-
<?php endif; ?>
|
44 |
-
<p>If you don't have one already, set up your Facebook Developers App. This will allow you to log in and connect your plugin.</p>
|
45 |
-
</div>
|
46 |
-
<div class="instant-articles-card-bullet-step <?php echo esc_attr( $state_css_classes[ Instant_Articles_Wizard_State::STATE_PAGE_SELECTION ] ); ?>">
|
47 |
-
<div class="instant-articles-card-bullet"></div>
|
48 |
-
<div class="instant-articles-card-bullet-path"></div>
|
49 |
-
<?php if ( Instant_Articles_Wizard_State::get_timeline_position( Instant_Articles_Wizard_State::STATE_PAGE_SELECTION ) === Instant_Articles_Wizard_State::TIMELINE_PAST ) : ?>
|
50 |
-
<h4>Page Selected</h4>
|
51 |
-
<?php else : ?>
|
52 |
-
<h4>Select Your Page</h4>
|
53 |
-
<?php endif; ?>
|
54 |
-
<p>Select the Page you'll use to publish your Instant Articles.</p>
|
55 |
-
</div>
|
56 |
-
<div class="instant-articles-card-bullet-step <?php echo esc_attr( $state_css_classes[ Instant_Articles_Wizard_State::STATE_STYLE_SELECTION ] ); ?>">
|
57 |
-
<div class="instant-articles-card-bullet"></div>
|
58 |
-
<div class="instant-articles-card-bullet-path"></div>
|
59 |
-
<?php if ( Instant_Articles_Wizard_State::get_timeline_position( Instant_Articles_Wizard_State::STATE_STYLE_SELECTION ) === Instant_Articles_Wizard_State::TIMELINE_PAST ) : ?>
|
60 |
-
<h4>Style Customized</h4>
|
61 |
-
<?php else : ?>
|
62 |
-
<h4>Customize Your Style</h4>
|
63 |
-
<?php endif; ?>
|
64 |
-
<p>Use our Style Editor to make your Instant Articles look just how you want them to.</p>
|
65 |
-
</div>
|
66 |
-
<div class="instant-articles-card-bullet-step <?php echo esc_attr( $state_css_classes[ Instant_Articles_Wizard_State::STATE_REVIEW_SUBMISSION ] ); ?>">
|
67 |
-
<div class="instant-articles-card-bullet"></div>
|
68 |
-
<?php if ( Instant_Articles_Wizard_State::get_timeline_position( Instant_Articles_Wizard_State::STATE_REVIEW_SUBMISSION ) === Instant_Articles_Wizard_State::TIMELINE_PAST ) : ?>
|
69 |
-
<h4>Review Complete</h4>
|
70 |
-
<?php else : ?>
|
71 |
-
<h4>Submit for Review</h4>
|
72 |
-
<?php endif; ?>
|
73 |
-
<p>Submit your Instant Articles for review and start publishing.</p>
|
74 |
-
</div>
|
75 |
-
</div>
|
76 |
-
|
77 |
-
<?php endif; ?>
|
78 |
-
|
79 |
-
<?php
|
80 |
-
switch ( $current_state ) {
|
81 |
-
case Instant_Articles_Wizard_State::STATE_OVERVIEW:
|
82 |
-
include( dirname( __FILE__ ) . '/overview-template.php' );
|
83 |
-
break;
|
84 |
-
case Instant_Articles_Wizard_State::STATE_APP_SETUP:
|
85 |
-
include( dirname( __FILE__ ) . '/app-setup-template.php' );
|
86 |
-
break;
|
87 |
-
case Instant_Articles_Wizard_State::STATE_PAGE_SELECTION:
|
88 |
-
include( dirname( __FILE__ ) . '/page-selection-template.php' );
|
89 |
-
break;
|
90 |
-
case Instant_Articles_Wizard_State::STATE_STYLE_SELECTION:
|
91 |
-
include( dirname( __FILE__ ) . '/style-selection-template.php' );
|
92 |
-
break;
|
93 |
-
case Instant_Articles_Wizard_State::STATE_REVIEW_SUBMISSION:
|
94 |
-
include( dirname( __FILE__ ) . '/review-submission-template.php' );
|
95 |
-
break;
|
96 |
-
}
|
97 |
-
?>
|
98 |
-
|
99 |
-
<?php if ( ! $ajax ) : ?>
|
100 |
-
</div>
|
101 |
-
|
102 |
-
<?php if ( count( get_settings_errors() ) !== 0 ) : ?>
|
103 |
-
<p class="instant-articles-advanced-settings" data-state="opened">
|
104 |
-
<?php else: ?>
|
105 |
-
<p class="instant-articles-advanced-settings" data-state="closed">
|
106 |
-
<?php endif; ?>
|
107 |
-
|
108 |
-
<span class="instant-articles-wizard-toggle instant-articles-wizard-toggle-closed">Already set up? <a href="#">Open Advanced Settings now</a></span>
|
109 |
-
<span class="instant-articles-wizard-toggle instant-articles-wizard-toggle-opened"><a href="#">Close Advanced Settings</a></span>
|
110 |
-
</p>
|
111 |
-
|
112 |
-
<div class="instant-articles-wizard-advanced-settings-box">
|
113 |
-
<?php include( dirname( __FILE__ ) . '/advanced-template.php' ); ?>
|
114 |
-
</div>
|
115 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wpcom-helper.php
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use Facebook\InstantArticles\Elements\Analytics;
|
4 |
-
|
5 |
-
// Wrap the wpcom tracking pixel to comply with the FBIA spec
|
6 |
-
// https://developers.facebook.com/docs/instant-articles/reference/analytics
|
7 |
-
function wpcom_fbia_remove_stats_pixel() {
|
8 |
-
global $post;
|
9 |
-
|
10 |
-
if ( ! defined( 'INSTANT_ARTICLES_SLUG' ) ) {
|
11 |
-
return;
|
12 |
-
}
|
13 |
-
|
14 |
-
if ( ! is_feed( INSTANT_ARTICLES_SLUG ) ) {
|
15 |
-
return;
|
16 |
-
}
|
17 |
-
|
18 |
-
// Stop wpcom adding the tracking pixel
|
19 |
-
remove_filter( 'the_content', 'add_bug_to_feed', 100 );
|
20 |
-
|
21 |
-
}
|
22 |
-
add_action( 'template_redirect', 'wpcom_fbia_remove_stats_pixel' );
|
23 |
-
|
24 |
-
function wpcom_fbia_add_stats_pixel( $ia_post ) {
|
25 |
-
|
26 |
-
// Get the IA article.
|
27 |
-
$instant_article = $ia_post->instant_article;
|
28 |
-
|
29 |
-
// Create the wpcom stats code.
|
30 |
-
$hostname = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : ''; // input var okay
|
31 |
-
|
32 |
-
$url = 'https://pixel.wp.com/b.gif?host=' . $hostname . '&blog=' . $current_blog->blog_id . '&post=' . $post->ID . '&subd=' . str_replace( '.wordpress.com', '', $current_blog->domain ) . '&ref=&feed=1';
|
33 |
-
|
34 |
-
$pixel_html = '<script>
|
35 |
-
var x = new Image(); x.src = "' . esc_js( $url ) . '&rand=" +Math.random();
|
36 |
-
</script>';
|
37 |
-
|
38 |
-
// Create our FBIA markup
|
39 |
-
$fbia_markup = Analytics::create();
|
40 |
-
$fbia_markup->withHTML( $pixel_html );
|
41 |
-
|
42 |
-
// Add the FBIA-compatible stats markup to the IA content
|
43 |
-
$instant_article->addChild( $fbia_markup );
|
44 |
-
|
45 |
-
}
|
46 |
-
add_action( 'instant_articles_after_transform_post', 'wpcom_fbia_add_stats_pixel' );
|
47 |
-
|
48 |
-
// make sure these function run in wp.com environment where `plugins_loaded` is already fired when loading the plugin
|
49 |
-
add_action( 'after_setup_theme', 'instant_articles_load_textdomain' );
|
50 |
-
add_action( 'after_setup_theme', 'instant_articles_load_compat' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|