-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbetterify.php
206 lines (183 loc) · 4.03 KB
/
betterify.php
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<?php
/*
Plugin Name: Betterify
Plugin URI: http://github.com/brashrebel/betterify
Description: Making WordPress websites...better.
Version: 0.2.1
Author: Kyle Maurer
Author URI: http://kyleblog.net
License: GPL2
*/
class Betterify {
/**
* Declare a few properties...
*
* @var
*/
public $power;
public $seo;
public $errors;
/**
* Implement our betterifying functionality
*/
public function __construct() {
add_action( 'init', array( $this, 'errors' ) );
add_action( 'wp_footer', array( $this, 'powerify' ) );
add_filter( 'the_title', array( $this, 'titles' ) );
add_action( 'wp_loaded', array( $this, 'make_bpa_free' ), PHP_INT_MAX );
}
/**
* Define awful...
*/
public function is_awful() {
$awful = array(
'mushrooms',
'Twilight',
'Kid Rock',
'frost bite',
'reality television',
'papercuts',
'terrorists',
'Breaking the Internet',
'haters',
'flight cancellations'
);
return apply_filters( 'betterify_awful_things', $awful );
}
/**
* We can't have awful titles can we?
*
* @param $title
* @param null $id
*
* @return string
*/
public function titles( $title, $id = null ) {
if ( method_exists( 'Betterify', 'is_awful' ) ) {
if ( $title == $this->is_awful() ) {
return '';
} else {
return $title;
}
} else {
return $title;
}
}
/**
* Now we shall fix anything that is broken
*
* @return string
*/
public function fixify() {
if ( function_exists( magically_fix_all_the_things() ) ) {
return 'Everything is fixed';
} else {
// It is all broken
$broken_stuff = 'broken';
// Not any more!
$broken_stuff = 'not broken!';
}
}
/**
* At this point, we are making WordPress MOAR POWERFUL!
*/
public function powerify() {
$this->power = 0;
// MOAR POWER!
$moar = apply_filters( 'betterify_moar_power', 10000000000000 );
$power = $this->power + $moar;
return '<!-- THE POWER IS NOW ' . $power . '! -->';
}
/**
* Let's talk SEO!!!
*
* @return string
*/
public function googlify() {
return '???????';
}
/**
* Now let's optimize!
*
* @return string
*/
public function optimizify() {
if ( $this->seo != $this->googlify() ) {
return 'You shall rank!';
} else {
return 'You shall not rank!';
}
}
/**
* Increase the overall website speed
*/
public function speedify() {
if ( ! defined( 'WP_SPEED_INCREASE' ) ) {
define( 'WP_SPEED_INCREASE', 1337 );
} else {
return 'WordPress is up to its maximum speed!';
}
}
/**
* Enhance the website design
*/
public function sexify() {
if ( get_option( 'website_is_sexy' ) == true ) {
return 'Even my mum liked it.';
} else {
update_option( 'website_is_sexy', 'enable_8_bit' );
}
}
/**
* Conflicts suck. Let's nullify them.
*/
public function conflictify() {
$conflicts = 'bad';
if ( $conflicts == 'bad' ) {
$conflicts = null;
} else {
return;
}
}
/**
* We all know BPAs are bad. We should remove them if we find them.
*/
public function make_bpa_free() {
// Remove Any BPAs that have been added to WordPress by plugins and themes
// We do this with no return, silently making everyone healthier. No need to boast.
remove_action( 'wp', 'bpa', 2430 );
}
/**
* Fix all errors
*/
public function errors() {
if ( $this->errors ) {
$this->errors = null;
}
}
private function securify( $code_word ) {
// For added security, let's employ a bouncer
if ( ! defined( 'WP_BOUNCER' ) ) {
define( 'WP_BOUNCER', 'Big Jake' );
}
$access = get_option( $code_word );
// Have Big Jake check the code word before granting access
if ( $access == apply_filters( 'big_jake', $code_word ) ) {
$access = true;
return $access;
} else {
$access = false;
return $access . 'FACE PUNCH!';
}
}
/**
* Objectification of Everything. It's not as bad as it sounds.
* @param Man|Woman $person
* @return mixed
*/
private function objectify( $person ) {
//The best way to objectify someone: make them an object.
return json_decode(json_encode($val), FALSE);
}
}
$betterify = new Betterify();