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