[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-forums/bbpress/bb-plugins/ -> hello.php (source)

   1  <?php
   2  /**
   3   * @package Hello_Louie
   4   * @author Matt Mullenweg
   5   * @version 1.0
   6   */
   7  /*
   8  Plugin Name: Hello Louie
   9  Plugin URI: http://bbpress.org/
  10  Description: A tip of the hat to the venerable Hello Dolly plugin from WordPress. When activated you will randomly see a lyric from Frank Sinatra's 1964 rendition of "Hello Dolly" in the upper right of your admin screen on every page. This version includes a rewritten second verse as a tribute to Louis Armstrong.
  11  Author: Matt Mullenweg
  12  Version: 1.0
  13  Author URI: http://ma.tt/
  14  */
  15  
  16  function hello_louie_get_lyric() {
  17      /** These are the lyrics to Frank Sinatra's version of "Hello Dolly" from the album "It Might as Well Be Swing" */
  18      $lyrics = "Hello Dolly
  19  Well hello Dolly
  20  It's so nice to have you back where you belong
  21  You're lookin' swell, Dolly
  22  We can tell, Dolly
  23  You're still glowin', you're still crowin'
  24  You're still goin' strong
  25  We feel the room swayin'
  26  'Cause the band's playin'
  27  One of your old favorite songs from way back when
  28  Take her wrap, fellas
  29  Find her an empty lap, fellas
  30  Dolly'll never go away
  31  Dolly'll never go away
  32  Hello Satch
  33  This is Francis, Louie
  34  It's so nice to see you back where you belong
  35  You're back on top, Louie
  36  Never stop, Louie
  37  You're still singin', you're still swingin'
  38  You're still goin' strong
  39  You get the room swayin'
  40  When you start in playin'
  41  One of your great songs, or songs from way back when
  42  Blow your horn, Louie
  43  Sing up a great big song, Louie
  44  Promise you won't go away
  45  Promise you won't go away
  46  Promise you won't go away again, ooh yeah";
  47  
  48      // Here we split it into lines
  49      $lyrics = explode("\n", $lyrics);
  50  
  51      // And then randomly choose a line
  52      return wptexturize( $lyrics[ mt_rand(0, count($lyrics) - 1) ] );
  53  }
  54  
  55  // This just echoes the chosen line, we'll position it later
  56  function hello_louie() {
  57      $chosen = hello_louie_get_lyric();
  58      echo "<p id='dolly'>$chosen</p>";
  59  }
  60  
  61  // Now we set that function up to execute when the admin_footer action is called
  62  add_action('bb_admin_footer', 'hello_louie');
  63  
  64  // We need some CSS to position the paragraph
  65  function louie_css() {
  66      // This makes sure that the positioning is also good for right-to-left languages
  67      global $bb_locale;
  68      $x = ( isset( $bb_locale->text_direction ) && 'rtl' == $bb_locale->text_direction ) ? 'left' : 'right';
  69  
  70      echo "
  71      <style type='text/css'>
  72      #dolly {
  73          position: absolute;
  74          top: 4.4em;
  75          margin: 0;
  76          padding: 0;
  77          $x: 15px;
  78          font-size: 11px;
  79      }
  80      </style>
  81      ";
  82  }
  83  
  84  add_action('bb_admin_head', 'louie_css');


Generated: Thu Dec 7 01:01:35 2017 Cross-referenced by PHPXref 0.7.1