| 1 |
<?php |
| 2 |
|
| 3 |
abstract class autoptimizeBase |
| 4 |
{ |
| 5 |
protected $content = ''; |
| 6 |
|
| 7 |
public function __construct($content) |
| 8 |
{ |
| 9 |
$this->content = $content; |
| 10 |
//Best place to catch errors |
| 11 |
} |
| 12 |
|
| 13 |
//Reads the page and collects tags |
| 14 |
abstract public function read(); |
| 15 |
|
| 16 |
//Joins and optimizes collected things |
| 17 |
abstract public function minify(); |
| 18 |
|
| 19 |
//Caches the things |
| 20 |
abstract public function cache(); |
| 21 |
|
| 22 |
//Returns the content |
| 23 |
abstract public function getcontent(); |
| 24 |
|
| 25 |
//Converts an URL to a full path |
| 26 |
protected function getpath($url) |
| 27 |
{ |
| 28 |
$path = str_replace(get_settings('home'),'',$url); |
| 29 |
if(preg_match('#^(https?|ftp)://#i',$path)) |
| 30 |
{ |
| 31 |
//External script (adsense, etc) |
| 32 |
return false; |
| 33 |
} |
| 34 |
$path = str_replace('//','/',ABSPATH.$path); |
| 35 |
return $path; |
| 36 |
} |
| 37 |
} |
| 38 |
|