| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Redux Framework is free software: you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License as published by |
| 6 |
* the Free Software Foundation, either version 2 of the License, or |
| 7 |
* any later version. |
| 8 |
* |
| 9 |
* Redux Framework is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
* GNU General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU General Public License |
| 15 |
* along with Redux Framework. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
* |
| 17 |
* @package Redux Framework |
| 18 |
* @subpackage Ad Remover |
| 19 |
* @subpackage WordPress |
| 20 |
* @author Kevin Provance (kprovance) |
| 21 |
* @version 1.0.0 |
| 22 |
*/ |
| 23 |
// Exit if accessed directly |
| 24 |
if (!defined('ABSPATH')) |
| 25 |
exit; |
| 26 |
|
| 27 |
// Don't duplicate me! |
| 28 |
if (!class_exists('ReduxFramework_extension_ad_remover')) { |
| 29 |
|
| 30 |
|
| 31 |
/** |
| 32 |
* Main ReduxFramework_extension_ad_remove extension class |
| 33 |
* |
| 34 |
* @since 1.0.0 |
| 35 |
*/ |
| 36 |
class ReduxFramework_extension_ad_remove { |
| 37 |
|
| 38 |
public static $version = '1.0.0'; |
| 39 |
// Protected vars |
| 40 |
protected $parent; |
| 41 |
public $extension_url; |
| 42 |
public $extension_dir; |
| 43 |
public static $theInstance; |
| 44 |
public static $ext_url; |
| 45 |
public $field_id = ''; |
| 46 |
private $class_css = ''; |
| 47 |
|
| 48 |
/** |
| 49 |
* Class Constructor. Defines the args for the extions class |
| 50 |
* |
| 51 |
* @since 1.0.0 |
| 52 |
* @access public |
| 53 |
* @param array $parent Parent settings. |
| 54 |
* @return void |
| 55 |
*/ |
| 56 |
public function __construct($parent) { |
| 57 |
|
| 58 |
$redux_ver = ReduxFramework::$_version; |
| 59 |
|
| 60 |
// Set parent object |
| 61 |
$this->parent = $parent; |
| 62 |
|
| 63 |
if (version_compare($redux_ver, '3.5.8.15') < 0) { |
| 64 |
$this->parent->admin_notices[] = array( |
| 65 |
'type' => 'error', |
| 66 |
'msg' => 'The Redux Ad Removal extension required Redux Framework version 3.5.8.15 or higher and will disabled until a Redux update is applied.<br/><br/>You are running Redux Framework version ' . $redux_ver, |
| 67 |
'id' => 'r_ad1492', |
| 68 |
'dismiss' => false, |
| 69 |
); |
| 70 |
|
| 71 |
return; |
| 72 |
} |
| 73 |
|
| 74 |
// Set extension dir |
| 75 |
if (empty($this->extension_dir)) { |
| 76 |
$this->extension_dir = trailingslashit(str_replace('\\', '/', dirname(__FILE__))); |
| 77 |
$this->extension_url = site_url(str_replace(trailingslashit(str_replace('\\', '/', ABSPATH)), '', $this->extension_dir)); |
| 78 |
self::$ext_url = $this->extension_url; |
| 79 |
} |
| 80 |
|
| 81 |
// Set field name |
| 82 |
$this->field_name = 'ad_remove'; |
| 83 |
|
| 84 |
// Set instance |
| 85 |
self::$theInstance = $this; |
| 86 |
|
| 87 |
// Adds the local field |
| 88 |
add_filter('redux/' . $this->parent->args['opt_name'] . '/field/class/' . $this->field_name, array(&$this, 'overload_field_path')); |
| 89 |
|
| 90 |
add_filter('redux/' . $this->parent->args['opt_name'] . '/aDBW_filter', array($this, 'dashboard')); |
| 91 |
add_filter('redux/' . $this->parent->args['opt_name'] . '/aNF_filter', array($this, 'newsflash')); |
| 92 |
add_filter('redux/' . $this->parent->args['opt_name'] . '/aNFM_filter', array($this, 'newsflash')); |
| 93 |
add_filter('redux/' . $this->parent->args['opt_name'] . '/aURL_filter', array($this, 'ads')); |
| 94 |
} |
| 95 |
|
| 96 |
public function ads() { |
| 97 |
return ''; |
| 98 |
} |
| 99 |
|
| 100 |
public function dashboard() { |
| 101 |
return 'dat'; |
| 102 |
} |
| 103 |
|
| 104 |
public function newsflash() { |
| 105 |
return 'bub'; |
| 106 |
} |
| 107 |
|
| 108 |
static public function getInstance() { |
| 109 |
return self::$theInstance; |
| 110 |
} |
| 111 |
|
| 112 |
static public function getExtURL() { |
| 113 |
return self::$ext_url; |
| 114 |
} |
| 115 |
|
| 116 |
// Forces the use of the embeded field path vs what the core typically would use |
| 117 |
public function overload_field_path($field) { |
| 118 |
return dirname(__FILE__) . '/' . $this->field_name . '/field_' . $this->field_name . '.php'; |
| 119 |
} |
| 120 |
|
| 121 |
} |
| 122 |
|
| 123 |
} |