[ Index ]

PHP Cross Reference of YOURLS

title

Body

[close]

/user/plugins/random-bg/ -> plugin.php (source)

   1  <?php
   2  /*
   3  Plugin Name: Random Backgrounds
   4  Plugin URI: http://yourls.org/
   5  Description: Pretty random background patterns
   6  Version: 1.0
   7  Author: Ozh
   8  Author URI: http://ozh.org/
   9  */
  10  
  11  // No direct call
  12  if( !defined( 'YOURLS_ABSPATH' ) ) die();
  13  
  14  // Add the inline style
  15  yourls_add_action( 'html_head', 'ozh_yourls_randombg' );
  16  function ozh_yourls_randombg() {
  17      $bg = glob( __DIR__.'/img/*png' );
  18      $url = yourls_plugin_url( __DIR__ );
  19      $rnd = yourls_plugin_url( $bg[ mt_rand( 0, count( $bg ) - 1 ) ] );
  20      echo <<<CSS
  21  <style type="text/css">
  22          body {background:#e3f3ff url($rnd) repeat;}
  23      </style>
  24  
  25  CSS;
  26  }
  27  


Generated: Sat Nov 9 05:10:01 2024 Cross-referenced by PHPXref 0.7.1