Version Description
Update admin menu functionality for compatibility with WordPress 4.5+.
Download this release
Release Info
Developer | niallkennedy |
Plugin | |
Version | 1.5.0 |
Comparing to | |
See all releases |
Code changes from version 1.4.0 to 1.5.0
- readme.txt +9 -2
- src/Twitter/WordPress/Admin/Settings/SinglePage.php +1 -1
- src/Twitter/WordPress/PluginLoader.php +1 -1
- src/Twitter/WordPress/Shortcodes/EmbeddedTweet.php +6 -22
- src/Twitter/WordPress/Shortcodes/EmbeddedTweetVideo.php +4 -2
- src/Twitter/WordPress/Shortcodes/Moment.php +9 -0
- src/Twitter/WordPress/Shortcodes/PublishOEmbedEndpoint.php +51 -0
- src/Twitter/WordPress/Shortcodes/TweetGrid.php +23 -27
- twitter.php +2 -2
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: Twitter, niallkennedy
|
3 |
Tags: twitter, embedded tweet, twitter moment, twitter video, twitter grid, vine, periscope, twitter cards, tweet button, follow button, twitter analytics, twitter ads
|
4 |
Requires at least: 3.9
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 1.
|
7 |
License: MIT
|
8 |
License URI: http://opensource.org/licenses/MIT
|
9 |
|
@@ -66,6 +66,9 @@ Add a Twitter audience pixel or [track advertising conversions](https://support.
|
|
66 |
> View [Twitter for WordPress documentation](https://dev.twitter.com/web/wordpress) to learn more about customization through WordPress filters.
|
67 |
|
68 |
== Upgrade Notice ==
|
|
|
|
|
|
|
69 |
= 1.4.0 =
|
70 |
Remove Tweet button options for share count. Display a Follow button by pasting a Twitter profile URL.
|
71 |
|
@@ -82,6 +85,10 @@ Shortcode improvements for ajax-loaded posts. Remove photo, gallery, and product
|
|
82 |
Display admin notice if current PHP version does not meet minimum requirements. Do not display Tweet button in auto-generated excerpt.
|
83 |
|
84 |
== Changelog ==
|
|
|
|
|
|
|
|
|
85 |
= 1.4.0 =
|
86 |
* Remove Tweet button options for share count and align display, matching Twitter's changes
|
87 |
* Convert Twitter profile URLs into a Follow button
|
2 |
Contributors: Twitter, niallkennedy
|
3 |
Tags: twitter, embedded tweet, twitter moment, twitter video, twitter grid, vine, periscope, twitter cards, tweet button, follow button, twitter analytics, twitter ads
|
4 |
Requires at least: 3.9
|
5 |
+
Tested up to: 4.7
|
6 |
+
Stable tag: 1.5.0
|
7 |
License: MIT
|
8 |
License URI: http://opensource.org/licenses/MIT
|
9 |
|
66 |
> View [Twitter for WordPress documentation](https://dev.twitter.com/web/wordpress) to learn more about customization through WordPress filters.
|
67 |
|
68 |
== Upgrade Notice ==
|
69 |
+
= 1.5.0 =
|
70 |
+
Update admin menu functionality for compatibility with WordPress 4.5+.
|
71 |
+
|
72 |
= 1.4.0 =
|
73 |
Remove Tweet button options for share count. Display a Follow button by pasting a Twitter profile URL.
|
74 |
|
85 |
Display admin notice if current PHP version does not meet minimum requirements. Do not display Tweet button in auto-generated excerpt.
|
86 |
|
87 |
== Changelog ==
|
88 |
+
= 1.5.0 =
|
89 |
+
* Place Twitter administrative menu as a general menu item, not the deprecated utility menu. WordPress 4.5 compatibility feature.
|
90 |
+
* Use publish.twitter.com oEmbed API endpoint for single Tweet oEmbed
|
91 |
+
|
92 |
= 1.4.0 =
|
93 |
* Remove Tweet button options for share count and align display, matching Twitter's changes
|
94 |
* Convert Twitter profile URLs into a Follow button
|
src/Twitter/WordPress/Admin/Settings/SinglePage.php
CHANGED
@@ -112,7 +112,7 @@ class SinglePage
|
|
112 |
{
|
113 |
$settings = new static();
|
114 |
|
115 |
-
$hook_suffix =
|
116 |
static::featureName(), // page <title>
|
117 |
'Twitter', // brand name. not translated
|
118 |
'manage_options', // capability needed
|
112 |
{
|
113 |
$settings = new static();
|
114 |
|
115 |
+
$hook_suffix = add_menu_page(
|
116 |
static::featureName(), // page <title>
|
117 |
'Twitter', // brand name. not translated
|
118 |
'manage_options', // capability needed
|
src/Twitter/WordPress/PluginLoader.php
CHANGED
@@ -41,7 +41,7 @@ class PluginLoader
|
|
41 |
*
|
42 |
* @type string
|
43 |
*/
|
44 |
-
const VERSION = '1.
|
45 |
|
46 |
/**
|
47 |
* Unique domain of the plugin's translated text
|
41 |
*
|
42 |
* @type string
|
43 |
*/
|
44 |
+
const VERSION = '1.5.0';
|
45 |
|
46 |
/**
|
47 |
* Unique domain of the plugin's translated text
|
src/Twitter/WordPress/Shortcodes/EmbeddedTweet.php
CHANGED
@@ -30,7 +30,7 @@ namespace Twitter\WordPress\Shortcodes;
|
|
30 |
*
|
31 |
* @since 1.0.0
|
32 |
*/
|
33 |
-
class EmbeddedTweet implements ShortcodeInterface
|
34 |
{
|
35 |
use OEmbedTrait;
|
36 |
|
@@ -43,24 +43,6 @@ class EmbeddedTweet implements ShortcodeInterface
|
|
43 |
*/
|
44 |
const SHORTCODE_TAG = 'tweet';
|
45 |
|
46 |
-
/**
|
47 |
-
* PHP class to use for fetching oEmbed data
|
48 |
-
*
|
49 |
-
* @since 1.3.0
|
50 |
-
*
|
51 |
-
* @type string
|
52 |
-
*/
|
53 |
-
const OEMBED_API_CLASS = '\Twitter\WordPress\Helpers\TwitterAPI';
|
54 |
-
|
55 |
-
/**
|
56 |
-
* Relative path for the oEmbed API relative to Twitter API base path
|
57 |
-
*
|
58 |
-
* @since 1.0.0
|
59 |
-
*
|
60 |
-
* @type string
|
61 |
-
*/
|
62 |
-
const OEMBED_API_ENDPOINT = 'statuses/oembed';
|
63 |
-
|
64 |
/**
|
65 |
* oEmbed regex registered by WordPress Core
|
66 |
*
|
@@ -117,13 +99,15 @@ class EmbeddedTweet implements ShortcodeInterface
|
|
117 |
*/
|
118 |
public static function init()
|
119 |
{
|
|
|
|
|
120 |
// register our shortcode and its handler
|
121 |
-
add_shortcode( self::SHORTCODE_TAG, array(
|
122 |
|
123 |
// Shortcode UI, if supported
|
124 |
add_action(
|
125 |
'register_shortcode_ui',
|
126 |
-
array(
|
127 |
5,
|
128 |
0
|
129 |
);
|
@@ -135,7 +119,7 @@ class EmbeddedTweet implements ShortcodeInterface
|
|
135 |
wp_embed_register_handler(
|
136 |
self::SHORTCODE_TAG,
|
137 |
static::TWEET_URL_REGEX,
|
138 |
-
array(
|
139 |
1
|
140 |
);
|
141 |
}
|
30 |
*
|
31 |
* @since 1.0.0
|
32 |
*/
|
33 |
+
class EmbeddedTweet implements ShortcodeInterface, PublishOEmbedEndpoint
|
34 |
{
|
35 |
use OEmbedTrait;
|
36 |
|
43 |
*/
|
44 |
const SHORTCODE_TAG = 'tweet';
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
/**
|
47 |
* oEmbed regex registered by WordPress Core
|
48 |
*
|
99 |
*/
|
100 |
public static function init()
|
101 |
{
|
102 |
+
$classname = get_called_class();
|
103 |
+
|
104 |
// register our shortcode and its handler
|
105 |
+
add_shortcode( self::SHORTCODE_TAG, array( $classname, 'shortcodeHandler' ) );
|
106 |
|
107 |
// Shortcode UI, if supported
|
108 |
add_action(
|
109 |
'register_shortcode_ui',
|
110 |
+
array( $classname, 'shortcodeUI' ),
|
111 |
5,
|
112 |
0
|
113 |
);
|
119 |
wp_embed_register_handler(
|
120 |
self::SHORTCODE_TAG,
|
121 |
static::TWEET_URL_REGEX,
|
122 |
+
array( $classname, 'linkHandler' ),
|
123 |
1
|
124 |
);
|
125 |
}
|
src/Twitter/WordPress/Shortcodes/EmbeddedTweetVideo.php
CHANGED
@@ -60,13 +60,15 @@ class EmbeddedTweetVideo extends EmbeddedTweet
|
|
60 |
*/
|
61 |
public static function init()
|
62 |
{
|
|
|
|
|
63 |
// register our shortcode and its handler
|
64 |
-
add_shortcode( self::SHORTCODE_TAG, array(
|
65 |
|
66 |
// Shortcode UI, if supported
|
67 |
add_action(
|
68 |
'register_shortcode_ui',
|
69 |
-
array(
|
70 |
5,
|
71 |
0
|
72 |
);
|
60 |
*/
|
61 |
public static function init()
|
62 |
{
|
63 |
+
$classname = get_called_class();
|
64 |
+
|
65 |
// register our shortcode and its handler
|
66 |
+
add_shortcode( self::SHORTCODE_TAG, array( $classname, 'shortcodeHandler' ) );
|
67 |
|
68 |
// Shortcode UI, if supported
|
69 |
add_action(
|
70 |
'register_shortcode_ui',
|
71 |
+
array( $classname, 'shortcodeUI' ),
|
72 |
5,
|
73 |
0
|
74 |
);
|
src/Twitter/WordPress/Shortcodes/Moment.php
CHANGED
@@ -42,6 +42,15 @@ class Moment extends TweetGrid
|
|
42 |
*/
|
43 |
const SHORTCODE_TAG = 'twitter_moment';
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
/**
|
46 |
* HTML class to be used in div wrapper
|
47 |
*
|
42 |
*/
|
43 |
const SHORTCODE_TAG = 'twitter_moment';
|
44 |
|
45 |
+
/**
|
46 |
+
* oEmbed regex registered by WordPress Core
|
47 |
+
*
|
48 |
+
* @since 1.5.0
|
49 |
+
*
|
50 |
+
* @type string
|
51 |
+
*/
|
52 |
+
const OEMBED_CORE_REGEX = '#https?://(www\.)?twitter\.com/i/moments/.*#i';
|
53 |
+
|
54 |
/**
|
55 |
* HTML class to be used in div wrapper
|
56 |
*
|
src/Twitter/WordPress/Shortcodes/PublishOEmbedEndpoint.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
The MIT License (MIT)
|
4 |
+
|
5 |
+
Copyright (c) 2016 Twitter Inc.
|
6 |
+
|
7 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8 |
+
of this software and associated documentation files (the "Software"), to deal
|
9 |
+
in the Software without restriction, including without limitation the rights
|
10 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11 |
+
copies of the Software, and to permit persons to whom the Software is
|
12 |
+
furnished to do so, subject to the following conditions:
|
13 |
+
|
14 |
+
The above copyright notice and this permission notice shall be included in
|
15 |
+
all copies or substantial portions of the Software.
|
16 |
+
|
17 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23 |
+
THE SOFTWARE.
|
24 |
+
*/
|
25 |
+
|
26 |
+
namespace Twitter\WordPress\Shortcodes;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Set up and fetch a Twitter oEmbed capable object
|
30 |
+
*
|
31 |
+
* @since 1.5.0
|
32 |
+
*/
|
33 |
+
interface PublishOEmbedEndpoint {
|
34 |
+
/**
|
35 |
+
* PHP class to use for fetching oEmbed data
|
36 |
+
*
|
37 |
+
* @since 1.5.0
|
38 |
+
*
|
39 |
+
* @type string
|
40 |
+
*/
|
41 |
+
const OEMBED_API_CLASS = '\Twitter\WordPress\Helpers\TwitterOEmbed';
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Relative path for the oEmbed API relative to Twitter publishers base path
|
45 |
+
*
|
46 |
+
* @since 1.5.0
|
47 |
+
*
|
48 |
+
* @type string
|
49 |
+
*/
|
50 |
+
const OEMBED_API_ENDPOINT = 'oembed';
|
51 |
+
}
|
src/Twitter/WordPress/Shortcodes/TweetGrid.php
CHANGED
@@ -30,7 +30,7 @@ namespace Twitter\WordPress\Shortcodes;
|
|
30 |
*
|
31 |
* @since 1.3.0
|
32 |
*/
|
33 |
-
class TweetGrid implements ShortcodeInterface
|
34 |
{
|
35 |
use OEmbedTrait;
|
36 |
|
@@ -44,49 +44,40 @@ class TweetGrid implements ShortcodeInterface
|
|
44 |
const SHORTCODE_TAG = 'twitter_grid';
|
45 |
|
46 |
/**
|
47 |
-
*
|
48 |
*
|
49 |
-
* @since 1.
|
50 |
*
|
51 |
* @type string
|
52 |
*/
|
53 |
-
const
|
54 |
|
55 |
/**
|
56 |
-
*
|
57 |
-
*
|
58 |
-
* @since 1.3.0
|
59 |
-
*
|
60 |
-
* @type string
|
61 |
-
*/
|
62 |
-
const URL_REGEX = '#^https://twitter\.com/[a-z0-9_]{1,20}/timelines/([0-9]+)#i';
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Base URL used to reconstruct a Collection URL
|
66 |
*
|
67 |
* @since 1.3.0
|
68 |
*
|
69 |
* @type string
|
70 |
*/
|
71 |
-
const
|
72 |
|
73 |
/**
|
74 |
-
*
|
75 |
*
|
76 |
* @since 1.3.0
|
77 |
*
|
78 |
* @type string
|
79 |
*/
|
80 |
-
const
|
81 |
|
82 |
/**
|
83 |
-
*
|
84 |
*
|
85 |
* @since 1.3.0
|
86 |
*
|
87 |
* @type string
|
88 |
*/
|
89 |
-
const
|
90 |
|
91 |
/**
|
92 |
* Accepted shortcode attributes and their default values
|
@@ -111,14 +102,6 @@ class TweetGrid implements ShortcodeInterface
|
|
111 |
// register our shortcode and its handler
|
112 |
add_shortcode( static::SHORTCODE_TAG, array( $classname, 'shortcodeHandler' ) );
|
113 |
|
114 |
-
// convert a URL into the shortcode equivalent
|
115 |
-
wp_embed_register_handler(
|
116 |
-
static::SHORTCODE_TAG,
|
117 |
-
static::URL_REGEX,
|
118 |
-
array( $classname, 'linkHandler' ),
|
119 |
-
1
|
120 |
-
);
|
121 |
-
|
122 |
// Shortcode UI, if supported
|
123 |
add_action(
|
124 |
'register_shortcode_ui',
|
@@ -126,6 +109,19 @@ class TweetGrid implements ShortcodeInterface
|
|
126 |
5,
|
127 |
0
|
128 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
}
|
130 |
|
131 |
/**
|
30 |
*
|
31 |
* @since 1.3.0
|
32 |
*/
|
33 |
+
class TweetGrid implements ShortcodeInterface, PublishOEmbedEndpoint
|
34 |
{
|
35 |
use OEmbedTrait;
|
36 |
|
44 |
const SHORTCODE_TAG = 'twitter_grid';
|
45 |
|
46 |
/**
|
47 |
+
* oEmbed regex registered by WordPress Core
|
48 |
*
|
49 |
+
* @since 1.5.0
|
50 |
*
|
51 |
* @type string
|
52 |
*/
|
53 |
+
const OEMBED_CORE_REGEX = '#https?://(www\.)?twitter\.com/.+?/timelines/.*#i';
|
54 |
|
55 |
/**
|
56 |
+
* HTML class to be used in div wrapper
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
*
|
58 |
* @since 1.3.0
|
59 |
*
|
60 |
* @type string
|
61 |
*/
|
62 |
+
const HTML_CLASS = 'twitter-grid';
|
63 |
|
64 |
/**
|
65 |
+
* Regex used to match a Collection in text
|
66 |
*
|
67 |
* @since 1.3.0
|
68 |
*
|
69 |
* @type string
|
70 |
*/
|
71 |
+
const URL_REGEX = '#^https://twitter\.com/[a-z0-9_]{1,20}/timelines/([0-9]+)#i';
|
72 |
|
73 |
/**
|
74 |
+
* Base URL used to reconstruct a Collection URL
|
75 |
*
|
76 |
* @since 1.3.0
|
77 |
*
|
78 |
* @type string
|
79 |
*/
|
80 |
+
const BASE_URL = 'https://twitter.com/_/timelines/';
|
81 |
|
82 |
/**
|
83 |
* Accepted shortcode attributes and their default values
|
102 |
// register our shortcode and its handler
|
103 |
add_shortcode( static::SHORTCODE_TAG, array( $classname, 'shortcodeHandler' ) );
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
// Shortcode UI, if supported
|
106 |
add_action(
|
107 |
'register_shortcode_ui',
|
109 |
5,
|
110 |
0
|
111 |
);
|
112 |
+
|
113 |
+
if ( ! is_admin() ) {
|
114 |
+
// unhook the WordPress Core oEmbed handler
|
115 |
+
wp_oembed_remove_provider( static::OEMBED_CORE_REGEX );
|
116 |
+
|
117 |
+
// convert a URL into the shortcode equivalent
|
118 |
+
wp_embed_register_handler(
|
119 |
+
static::SHORTCODE_TAG,
|
120 |
+
static::URL_REGEX,
|
121 |
+
array( $classname, 'linkHandler' ),
|
122 |
+
1
|
123 |
+
);
|
124 |
+
}
|
125 |
}
|
126 |
|
127 |
/**
|
twitter.php
CHANGED
@@ -24,13 +24,13 @@ THE SOFTWARE.
|
|
24 |
*/
|
25 |
/**
|
26 |
* @package twitter
|
27 |
-
* @version 1.
|
28 |
*/
|
29 |
/*
|
30 |
Plugin Name: Twitter
|
31 |
Plugin URI: http://wordpress.org/plugins/twitter/
|
32 |
Description: Official Twitter plugin for WordPress. Embed Twitter content and grow your audience on Twitter. Requires PHP 5.4 or greater.
|
33 |
-
Version: 1.
|
34 |
Author: Twitter
|
35 |
Author URI: https://dev.twitter.com/
|
36 |
License: MIT
|
24 |
*/
|
25 |
/**
|
26 |
* @package twitter
|
27 |
+
* @version 1.5.0
|
28 |
*/
|
29 |
/*
|
30 |
Plugin Name: Twitter
|
31 |
Plugin URI: http://wordpress.org/plugins/twitter/
|
32 |
Description: Official Twitter plugin for WordPress. Embed Twitter content and grow your audience on Twitter. Requires PHP 5.4 or greater.
|
33 |
+
Version: 1.5.0
|
34 |
Author: Twitter
|
35 |
Author URI: https://dev.twitter.com/
|
36 |
License: MIT
|