Plugin Directory

Changeset 690898


Ignore:
Timestamp:
04/03/2013 01:36:59 AM (13 years ago)
Author:
kobenland
Message:

WPDH: Remove duplicate code from utility class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-display-header/trunk/obenland-wp-plugins.php

    r690895 r690898  
    148148        }
    149149        return $plugin_meta;
    150     }
    151 
    152 
    153     /**
    154      * Displays a box with a donate button and call to action links
    155      *
    156      * Props Joost de Valk, as this is almost entirely from his awesome WordPress
    157      * SEO Plugin
    158      * @see     http://plugins.svn.wordpress.org/wordpress-seo/tags/1.1.5/admin/class-config.php
    159      *
    160      * @author  Joost de Valk, Konstantin Obenland
    161      * @since   2.0.0 - 31.03.2012
    162      * @access  public
    163      *
    164      * @return  void
    165      */
    166     public function donate_box() {
    167         $plugin_data = get_plugin_data( __FILE__ );
    168         ?>
    169         <div id="formatdiv" class="postbox">
    170             <h3 class="hndle"><span><?php esc_html_e( 'Help spread the word!', 'obenland-wp' ); ?></span></h3>
    171             <div class="inside">
    172                 <p><strong><?php printf( _x( 'Want to help make this plugin even better? All donations are used to improve %1$s, so donate $20, $50 or $100 now!', 'Plugin Name', 'obenland-wp' ), esc_html($plugin_data['Name']) ); ?></strong></p>
    173                 <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    174                     <input type="hidden" name="cmd" value="_s-xclick">
    175                     <input type="hidden" name="hosted_button_id" value="G65Y5CM3HVRNY">
    176                     <input type="image" src="https://www.paypalobjects.com/<?php echo get_locale(); ?>/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal Ñ The safer, easier way to pay online.">
    177                     <img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
    178                 </form>
    179                 <p><?php _e( 'Or you could:', 'obenland-wp' ); ?></p>
    180                 <ul>
    181                     <li><a href="http://wordpress.org/extend/plugins/wp-approve-user/"><?php _e( 'Rate the plugin 5&#9733; on WordPress.org', 'obenland-wp' ); ?></a></li>
    182                     <li><a href="<?php echo esc_url( $plugin_data['PluginURI'] ); ?>"><?php _e( 'Blog about it &amp; link to the plugin page', 'obenland-wp' ); ?></a></li>
    183                 </ul>
    184             </div>
    185         </div>
    186         <?php
    187     }
    188 
    189 
    190     /**
    191      * Displays a box with feed items and social media links
    192      *
    193      * Props Joost de Valk, as this is almost entirely from his awesome WordPress
    194      * SEO Plugin
    195      * @see     http://plugins.svn.wordpress.org/wordpress-seo/tags/1.1.5/admin/yst_plugin_tools.php
    196      *
    197      * @author  Joost de Valk, Konstantin Obenland
    198      * @since   2.0.0 - 31.03.2012
    199      * @access  public
    200      *
    201      * @return  void
    202      */
    203     public function feed_box() {
    204 
    205         include_once( ABSPATH . WPINC . '/feed.php' );
    206         $feed_url = 'http://en.wp.obenland.it/feed/';
    207         $rss = fetch_feed( $feed_url );
    208 
    209         // Bail if feed doesn't work
    210         if ( is_wp_error($rss) )
    211             return false;
    212 
    213         $rss_items = $rss->get_items( 0, $rss->get_item_quantity( 5 ) );
    214 
    215         // If the feed was erroneously
    216         if ( ! $rss_items ) {
    217             $md5 = md5( $feed_url );
    218             delete_transient( 'feed_' . $md5 );
    219             delete_transient( 'feed_mod_' . $md5 );
    220             $rss = fetch_feed( 'http://en.wp.obenland.it/feed/' );
    221             $rss_items = $rss->get_items( 0, $rss->get_item_quantity( 5 ) );
    222         }
    223         ?>
    224         <div id="formatdiv" class="postbox">
    225             <h3 class="hndle"><span><?php esc_html_e( 'News from Konstantin', 'obenland-wp' ); ?></span></h3>
    226             <div class="inside">
    227                 <ul>
    228                     <?php if ( ! $rss_items ) : ?>
    229                     <li><?php _e( 'No news items, feed might be broken...', 'obenland-wp' ); ?></li>
    230                     <?php else :
    231                     foreach ( $rss_items as $item ) :
    232                         $url = preg_replace( '/#.*/', '#utm_source=wordpress&utm_medium=sidebannerpostbox&utm_term=rssitem&utm_campaign=wp-approve-user',  $item->get_permalink() ); ?>
    233                 <li><a class="rsswidget" href="<?php echo esc_url( $url ); ?>"><?php echo esc_html( $item->get_title() ); ?></a></li>
    234                 <?php endforeach; endif; ?>
    235                     <li class="twitter"><a href="http://twitter.com/obenland"><?php _e( 'Follow Konstantin on Twitter', 'obenland-wp' ); ?></a></li>
    236                     <li class="rss"><a href="<?php echo esc_url( $feed_url ); ?>"><?php _e( 'Subscribe via RSS', 'obenland-wp' ); ?></a></li>
    237                 </ul>
    238             </div>
    239         </div>
    240         <?php
    241150    }
    242151
Note: See TracChangeset for help on using the changeset viewer.