Issues (2756)

user/plugins/random-bg/plugin.php (7 issues)

1
<?php
2
/*
0 ignored issues
show
Empty line required before block comment
Loading history...
3
Plugin Name: Random Backgrounds
0 ignored issues
show
First line of comment not aligned correctly; expected 4 spaces but found 0
Loading history...
4
Plugin URI: http://yourls.org/
0 ignored issues
show
Comment line indented incorrectly; expected at least 4 spaces but found 0
Loading history...
5
Description: Pretty random background patterns
0 ignored issues
show
Comment line indented incorrectly; expected at least 4 spaces but found 0
Loading history...
6
Version: 1.0
0 ignored issues
show
Comment line indented incorrectly; expected at least 4 spaces but found 0
Loading history...
7
Author: Ozh
0 ignored issues
show
Comment line indented incorrectly; expected at least 4 spaces but found 0
Loading history...
8
Author URI: http://ozh.org/
0 ignored issues
show
Comment line indented incorrectly; expected at least 4 spaces but found 0
Loading history...
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
28