readmill.php
| 1 | <?php |
| 2 | class Jetpack_Readmill_Widget extends WP_Widget { |
| 3 | var $default_title, $default_size; |
| 4 | |
| 5 | /** |
| 6 | * Registers the widget with WordPress. |
| 7 | */ |
| 8 | function __construct() { |
| 9 | parent::__construct( |
| 10 | 'jetpack_readmill_widget', // Base ID |
| 11 | apply_filters( 'jetpack_widget_name', esc_html__( 'Retired: Send To Readmill', 'jetpack' ) ), |
| 12 | array( |
| 13 | 'description' => esc_html__( 'Readmill has closed its doors. http://readmill.com/', 'jetpack' ), |
| 14 | ) |
| 15 | ); |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Back-end widget form. |
| 20 | * |
| 21 | * @see WP_Widget::form() |
| 22 | * |
| 23 | * @param array $instance Previously saved values from database. |
| 24 | */ |
| 25 | function form( $instance ) { |
| 26 | // Temporary Fix for 3.1 so we don't break a translation string before release. |
| 27 | ?> |
| 28 | <p><?php printf( str_replace( ' taget="', ' target="', __( "<strong>The Readmill reading service has shut down</strong><br /> <a taget=\"_blank\" href=\"%s\">Learn More</a>", 'jetpack' ) ), 'http://readmill.com' ); ?>. </p> |
| 29 | <p style="color:#A00; "> |
| 30 | <?php if ( ! defined( 'IS_WPCOM' ) || false == IS_WPCOM ) : ?> |
| 31 | <p><?php esc_html_e( 'The Send to Readmill widget is no longer working and will be removed completely from Jetpack.', 'jetpack' ); ?></p> |
| 32 | <?php else : ?> |
| 33 | <p><?php esc_html_e( 'The Send to Readmill widget is no longer working and will be removed completely.', 'jetpack' ); ?></p> |
| 34 | <?php endif; ?> |
| 35 | <em><?php esc_html_e( 'You can remove it yourself now.', 'jetpack' ); ?></em> |
| 36 | <?php esc_html_e( 'No content is displayed to users who can\'t manage widgets' , 'jetpack' ); ?> |
| 37 | </p><?php |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Sanitize widget form values as they are saved. |
| 42 | * |
| 43 | * @see WP_Widget::update() |
| 44 | * |
| 45 | * @param array $new_instance Values just sent to be saved. |
| 46 | * @param array $old_instance Previously saved values from database. |
| 47 | * |
| 48 | * @return array Updated safe values to be saved. |
| 49 | */ |
| 50 | function update( $new_instance, $old_instance ) { |
| 51 | $instance = array(); // there is nothing to save |
| 52 | return $instance; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Front-end display of widget. |
| 57 | * |
| 58 | * @see WP_Widget::widget() |
| 59 | * |
| 60 | * @param array $args Widget arguments. |
| 61 | * @param array $instance Saved values from database. |
| 62 | */ |
| 63 | function widget( $args, $instance ) { |
| 64 | if( current_user_can( 'edit_theme_options' ) ) { ?> |
| 65 | |
| 66 | <div style="border:1px solid #A00; padding:10px; margin:10px 0;color:#A00; background:#FFF; "> |
| 67 | <?php /* Temporary Fix for 3.1 so we don't break a translation string before release. */ ?> |
| 68 | <p><?php printf( str_replace( ' taget="', ' target="', __( "Notice to Administrators:<br /> <strong>The Readmill reading service has shut down</strong> <a taget=\"_blank\" href=\"%s\">learn more</a>.", 'jetpack' ) ), 'http://readmill.com/' ); ?></p> |
| 69 | <?php if ( ! defined( 'IS_WPCOM' ) || false == IS_WPCOM ) : ?> |
| 70 | <p><?php esc_html_e( 'The Send to Readmill widget is no longer working and will be removed completely from Jetpack.', 'jetpack' ); ?></p> |
| 71 | <?php else : ?> |
| 72 | <p><?php esc_html_e( 'The Send to Readmill widget is no longer working and will be removed completely.', 'jetpack' ); ?></p> |
| 73 | <?php endif; ?> |
| 74 | <p><?php printf( __( "You can visit <a href=\"%s\" title=\"Appearance > Widgets\">Appearance > Widgets </a> to remove it from this sidebar.", 'jetpack' ) , esc_url( admin_url( 'widgets.php' ) ) ) ; ?></p> |
| 75 | <p><?php esc_html_e( 'This notice is only visible to logged in users that can manage widgets', 'jetpack' ); ?>.</p> |
| 76 | </div> |
| 77 | <?php |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | function jetpack_readmill_widget_init() { |
| 83 | register_widget( 'Jetpack_Readmill_Widget' ); |
| 84 | } |
| 85 | |
| 86 | add_action( 'widgets_init', 'jetpack_readmill_widget_init' ); |
| 87 |