Plugin Directory

Changeset 1105561


Ignore:
Timestamp:
03/05/2015 12:30:49 AM (11 years ago)
Author:
Twitter
Message:

v1.0.1. display admin notice and deactivate if minimum PHP requirements not met

Location:
twitter/trunk
Files:
2 added
1 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • twitter/trunk/readme.txt

    r1101341 r1105561  
    44Requires at least: 3.9
    55Tested up to: 4.1
    6 Stable tag: 1.0.0
     6Stable tag: 1.0.1
    77License: MIT
    88License URI: http://opensource.org/licenses/MIT
    99
    10 Official Twitter plugin for WordPress. Embed Twitter content and grow your audience on Twitter. Requires PHP 5.4 or newer.
     10Official Twitter plugin for WordPress. Embed Twitter content and grow your audience on Twitter. Requires PHP 5.4 or greater.
    1111
    1212== Description ==
     
    1414The Twitter plugin for WordPress optimizes your website for a Twitter audience through easy to use sharing buttons, embedded Tweets, auto-generated markup indexed by Twitter, and Follow buttons to help grow your Twitter audience. All features are deeply integrated with WordPress APIs to make building your webpages and administrative features as easy as possible with the extensibility you expect from WordPress.
    1515
    16 Requires PHP 5.4 or later.
     16Requires PHP version 5.4 or greater.
    1717
    1818* [Embedded Tweet](https://dev.twitter.com/web/embedded-tweets) - customize backgrounds and color schemes to match your site's theme
     
    2626Contribute to the plugin, submit pull requests, or run test suites through the [Twitter plugin for WordPress GitHub repository](https://github.com/twitter/wordpress). View [Twitter for WordPress documentation](https://dev.twitter.com/web/wordpress) to learn more about customization through filters.
    2727
     28== Upgrade Notice ==
     29
     30= 1.0.1 =
     31
     32Display admin notice if current PHP version does not meet minimum requirements. Do not display Tweet button in auto-generated excerpt.
     33
    2834== Changelog ==
     35
     36= 1.0.1 =
     37* Display admin notice if plugin is installed on a site not meeting minimum PHP requirement
     38* Disable Tweet button the_content wrapper when called during excerpt generation
     39* Tweet button: add support for via shortcode attribute
     40* Fix: save Follow button widget with no overrides
    2941
    3042= 1.0.0 =
  • twitter/trunk/src/Twitter/Intents/Tweet.php

    r1099428 r1105561  
    281281    {
    282282        return array_values($this->hashtags);
     283    }
     284
     285    /**
     286     * Get the stored via value
     287     *
     288     * @since 1.0.1
     289     *
     290     * @return string source Twitter account username
     291     */
     292    public function getVia()
     293    {
     294        return $this->via ?: '';
    283295    }
    284296
  • twitter/trunk/src/Twitter/WordPress/Admin/Post/MetaBox.php

    r1099428 r1105561  
    146146            ), // absolute URI
    147147            array(), // no dependencies
    148             '1.0.0' // last chance. used for caching
     148            '1.0.1' // last change. used for caching
    149149        );
    150150    }
  • twitter/trunk/src/Twitter/WordPress/Admin/Post/TweetIntent.php

    r1099428 r1105561  
    165165
    166166        echo '<tr>';
    167         echo '<td scope="row" class="left"><label for="tweet-text">' . esc_html( _x( 'Text', 'Share / Tweet text', 'twitter' ) ) . '</label></th>';
     167        echo '<th scope="row" class="left"><label for="tweet-text">' . esc_html( _x( 'Text', 'Share / Tweet text', 'twitter' ) ) . '</label></th>';
    168168        echo '<td><input id="tweet-text" name="' . esc_attr( static::META_KEY . '[' . static::TEXT_KEY . ']' ) . '" type="text" maxlength="' . $available_characters . '" autocomplete="off"';
    169169        if ( isset( $stored_values[ static::TEXT_KEY ] ) ) {
     
    175175        echo '</tr>';
    176176        echo '<tr>';
    177         echo '<td scope="row" class="left"><label for"tweet-hashtags">' . esc_html( __( 'Hashtags', 'twitter' ) ) . '</label></th>';
     177        echo '<th scope="row" class="left"><label for="tweet-hashtags">' . esc_html( __( 'Hashtags', 'twitter' ) ) . '</label></th>';
    178178        echo '<td><input id="tweet-hashtags" name="' . esc_attr( static::META_KEY . '[' . static::HASHTAGS_KEY . ']' ) . '" type="text" maxlength="' . ($available_characters - 2) . '" autocomplete="off"';
    179179        if ( isset( $stored_values[ static::HASHTAGS_KEY ] ) && is_array( $stored_values[ static::HASHTAGS_KEY ] ) ) {
  • twitter/trunk/src/Twitter/WordPress/Admin/Post/TwitterCard.php

    r1099428 r1105561  
    143143
    144144            echo '<tr>';
    145             echo '<td scope="row" class="left"><label for="twitter-card-title">' . esc_html( __( 'Title' ) ) . '</label></th>';
     145            echo '<th scope="row" class="left"><label for="twitter-card-title">' . esc_html( __( 'Title' ) ) . '</label></th>';
    146146            echo '<td><input type="text" id="twitter-card-title" name="' . esc_attr( static::META_KEY . '[' . static::TITLE_KEY . ']' ) . '" maxlength="70" autocomplete="off"';
    147147            if ( isset( $stored_values[ static::TITLE_KEY ] ) ) {
     
    157157        if ( isset( $cards_fields_supported_by_post_type[ static::DESCRIPTION_KEY ] ) ) {
    158158            echo '<tr>';
    159             echo '<td scope="row" class="left"><label for="twitter-card-description">' . esc_html( __( 'Description' ) ) . '</label></th>';
     159            echo '<th scope="row" class="left"><label for="twitter-card-description">' . esc_html( __( 'Description' ) ) . '</label></th>';
    160160            echo '<td><input type="text" id="twitter-card-description" name="' . esc_attr( static::META_KEY . '[' . static::DESCRIPTION_KEY . ']' ) . '" maxlength="200" autocomplete="off"';
    161161            if ( isset( $stored_values[ static::DESCRIPTION_KEY ] ) ) {
  • twitter/trunk/src/Twitter/WordPress/Admin/Settings/Loader.php

    r1099428 r1105561  
    4242    public static function init()
    4343    {
    44         add_action( 'admin_menu', array( __CLASS__, 'settingsMenuItems' ) );
     44        add_action( 'admin_menu', array( '\Twitter\WordPress\Admin\Settings\SinglePage', 'menuItem' ) );
    4545        add_filter( 'plugin_action_links', array( __CLASS__, 'pluginActionLinks' ), 10, 2 );
    46     }
    47 
    48     /**
    49      * Add Twitter settings to the WordPress administration menu.
    50      *
    51      * @since 1.0.0
    52      *
    53      * @return void
    54      */
    55     public static function settingsMenuItems()
    56     {
    57         \Twitter\WordPress\Admin\Settings\SinglePage::menuItem();
    5846    }
    5947
  • twitter/trunk/src/Twitter/WordPress/Admin/Settings/SinglePage.php

    r1099428 r1105561  
    3333class SinglePage
    3434{
    35     use Template;
    36 
    3735    /**
    3836     * Settings page identifier.
     
    120118
    121119    /**
     120     * Load the settings page
     121     *
     122     * @since 1.0.0
     123     *
     124     * @return void
     125     */
     126    public function settingsPage()
     127    {
     128        if ( ! isset( $this->hook_suffix ) ) {
     129            return;
     130        }
     131
     132        do_action( 'add-' . $this->hook_suffix . '-section' );
     133
     134        echo '<div class="wrap">';
     135
     136        echo '<header><h2>' . esc_html( static::featureName() ) . '</h2></header>';
     137        // handle general messages such as settings updated up top
     138        // place individual settings errors alongside their fields
     139        settings_errors( 'general' );
     140
     141        echo '<form method="post" action="' . esc_url( admin_url( 'options.php' ), array( 'https', 'http' ) ) . '">';
     142        settings_fields( $this->hook_suffix );
     143        do_settings_sections( $this->hook_suffix );
     144        submit_button();
     145        echo '</form>';
     146
     147        echo '</div>';
     148    }
     149
     150    /**
    122151     * Add contextual help content to the settings screen
    123152     *
     
    129158    {
    130159        $screen = get_current_screen();
    131         if ( ! $screen ) { // null if global not set
     160        // null if global not set
     161        if ( ! $screen ) {
    132162            return;
    133163        }
  • twitter/trunk/src/Twitter/WordPress/Admin/Settings/SiteAttribution.php

    r1099428 r1105561  
    3131 * @since 1.0.0
    3232 */
    33 class SiteAttribution
     33class SiteAttribution implements SettingsSection
    3434{
    3535    /**
  • twitter/trunk/src/Twitter/WordPress/Admin/Settings/Theme.php

    r1099428 r1105561  
    3131 * @since 1.0.0
    3232 */
    33 class Theme
     33class Theme implements SettingsSection
    3434{
    3535    /**
     
    158158        add_action(
    159159            'add-' . $this->hook_suffix . '-section',
    160             array( &$this, 'defineThemeSection' ),
     160            array( &$this, 'defineSection' ),
    161161            static::SECTION_PRIORITY, // top of screen
    162162            0  // no parameters
     
    188188     * @return void
    189189     */
    190     public function defineThemeSection()
     190    public function defineSection()
    191191    {
    192192        $section = 'twitter-colorscheme';
  • twitter/trunk/src/Twitter/WordPress/Admin/Settings/TweetButton.php

    r1099428 r1105561  
    3131 * @since 1.0.0
    3232 */
    33 class TweetButton
     33class TweetButton implements SettingsSection
    3434{
    3535    /**
  • twitter/trunk/src/Twitter/WordPress/Content/TweetButton.php

    r1099428 r1105561  
    3333class TweetButton
    3434{
    35 
    3635    /**
    3736     * Get the stored site option for Tweet button content
     
    6059    public static function contentFilter( $content )
    6160    {
     61        // do not include Tweet button(s) in an autogenerated excerpt
     62        // get_the_excerpt filter calls wp_trim_excerpt() at priority 10 which triggers the_content filter on an empty excerpt string
     63        if ( doing_filter( 'get_the_excerpt' ) ) {
     64            return $content;
     65        }
     66
    6267        $options = static::getOption();
    6368        if ( isset( $options['position'] ) ) {
  • twitter/trunk/src/Twitter/WordPress/PluginLoader.php

    r1099428 r1105561  
    4242     * @type string
    4343     */
    44     const VERSION = '1.0.0';
     44    const VERSION = '1.0.1';
    4545
    4646    /**
     
    121121            static::TEXT_DOMAIN,
    122122            false, // deprecated parameter as of WP 2.7
    123             dirname( plugin_basename( static::getPluginMainFile() ) ) . '/languages/' // directory location of MO files
     123            dirname( plugin_basename( static::getPluginMainFile() ) ) . '/languages' // directory location of MO files
    124124        );
    125125    }
     
    181181        }
    182182
    183         $twitter_content_priority = apply_filters( 'twitter_content_filter_priority', 10 );
     183        /**
     184         * Set the priority to apply to Twitter elements automatically added to the_content
     185         *
     186         * Allow publishers to adjust the order of Twitter buttons relative to other the_content actors
     187         *
     188         * @since 1.0.0
     189         *
     190         * @param int $priority filter priority
     191         */
     192        $twitter_content_priority = apply_filters( 'twitter_content_filter_priority', 15 );
     193
     194        // possibly add Tweet button(s)
    184195        add_filter(
    185196            'the_content',
  • twitter/trunk/src/Twitter/WordPress/Shortcodes/Share.php

    r1099428 r1105561  
    197197            }
    198198            unset( $intent );
     199        }
     200
     201        if ( isset( $attributes['via'] ) ) {
     202            $via = (new \Twitter\Intents\Tweet())->setVia( $attributes['via'] )->getVia();
     203            if ( $via ) {
     204                $options['via'] = $via;
     205            }
     206            unset( $via );
    199207        }
    200208
  • twitter/trunk/src/Twitter/WordPress/Widgets/Follow.php

    r1099428 r1105561  
    178178
    179179        $filtered_options = $follow_button->toArray( /* dashed_keys */ false );
    180         if ( empty( $filtered_options ) ) {
    181             return false;
    182         }
    183180        $screen_name = $follow_button->getScreenName();
    184181        if ( $screen_name ) {
  • twitter/trunk/static/css/admin/post/edit.min.css

    r1099428 r1105561  
    1 #twitter-custom table{margin:0;width:100%;border:1px solid #dfdfdf;border-spacing:0;background-color:#f9f9f9}#twitter-custom thead th{padding:5px 8px 8px;background-color:#f1f1f1}#twitter-custom input{width:96%;margin:8px}#tweet-intent{width:100%}#twitter-card{width:100%}
     1#twitter-custom table{margin:0;width:100%;border:1px solid #dfdfdf;border-spacing:0;background-color:#f9f9f9}#twitter-custom thead th{padding:5px 8px 8px;background-color:#f1f1f1}#twitter-custom tbody th{font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;text-align:inherit}#twitter-custom input{width:96%;margin:8px}#tweet-intent{width:100%}#twitter-card{width:100%}
  • twitter/trunk/twitter.php

    r1101341 r1105561  
    11<?php
    2 /**
    3  * @package twitter
    4  * @version 1.0.0
    5  */
    6 /*
    7 Plugin Name: Twitter
    8 Plugin URI: http://wordpress.org/plugins/twitter/
    9 Description: Official Twitter plugin for WordPress. Embed Twitter content and grow your audience on Twitter. Requires PHP 5.4 or newer.
    10 Version: 1.0.0
    11 Author: Twitter
    12 Author URI: https://dev.twitter.com/
    13 License: MIT
    14 Text Domain: twitter
    15 Domain Path: /languages/
    16 */
    17 
    182/*
    193The MIT License (MIT)
     
    3923THE SOFTWARE.
    4024*/
    41 
     25/**
     26 * @package twitter
     27 * @version 1.0.1
     28 */
     29/*
     30Plugin Name: Twitter
     31Plugin URI:  http://wordpress.org/plugins/twitter/
     32Description: Official Twitter plugin for WordPress. Embed Twitter content and grow your audience on Twitter. Requires PHP 5.4 or greater.
     33Version:     1.0.1
     34Author:      Twitter
     35Author URI:  https://dev.twitter.com/
     36License:     MIT
     37Text Domain: twitter
     38Domain Path: /languages/
     39*/
    4240
    4341// make sure the plugin does not expose any info if called directly
     
    5351}
    5452
    55 // plugin requires PHP 5.4 or newer
     53// plugin requires PHP 5.4 or greater
    5654if ( version_compare( PHP_VERSION, '5.4.0', '<' ) ) {
    57     trigger_error( 'The Twitter plugin for WordPress requires PHP version 5.4 or higher.' );
     55    if ( ! class_exists( 'Twitter_CompatibilityNotice' ) ) {
     56        require_once( dirname(__FILE__) . '/compatibility-notice.php' );
     57    }
     58
     59    // possibly display a notice, trigger error
     60    add_action( 'admin_init', array( 'Twitter_CompatibilityNotice', 'adminInit' ) );
     61
     62    // stop execution of this file
    5863    return;
    5964}
     
    6570add_action(
    6671    'plugins_loaded',
    67     array( '\\Twitter\\WordPress\\PluginLoader', 'init' ),
     72    array( '\Twitter\WordPress\PluginLoader', 'init' ),
    6873    0, // priority
    6974    0 // expected arguments
Note: See TracChangeset for help on using the changeset viewer.