| 1 |
<?php |
| 2 |
namespace epiphyt\Embed_Privacy; |
| 3 |
|
| 4 |
use epiphyt\Embed_Privacy\admin\Field; |
| 5 |
use epiphyt\Embed_Privacy\admin\Fields; |
| 6 |
use epiphyt\Embed_Privacy\admin\Settings; |
| 7 |
use epiphyt\Embed_Privacy\admin\User_Interface; |
| 8 |
|
| 9 |
/** |
| 10 |
* Admin related methods for Embed Privacy. |
| 11 |
* |
| 12 |
* @deprecated 1.10.0 |
| 13 |
* @since 1.2.0 |
| 14 |
* |
| 15 |
* @author Epiphyt |
| 16 |
* @license GPL2 |
| 17 |
* @package epiphyt\Embed_Privacy |
| 18 |
*/ |
| 19 |
class Admin { |
| 20 |
/** |
| 21 |
* @deprecated 1.10.0 |
| 22 |
* @var array Admin to output |
| 23 |
*/ |
| 24 |
public $fields = []; |
| 25 |
|
| 26 |
/** |
| 27 |
* @var \epiphyt\Embed_Privacy\Admin |
| 28 |
*/ |
| 29 |
private static $instance; |
| 30 |
|
| 31 |
/** |
| 32 |
* Admin constructor. |
| 33 |
*/ |
| 34 |
public function __construct() { |
| 35 |
self::$instance = $this; |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Initialize functions. |
| 40 |
* |
| 41 |
* @deprecated 1.10.0 |
| 42 |
*/ |
| 43 |
public function init() { |
| 44 |
\_doing_it_wrong( |
| 45 |
__METHOD__, |
| 46 |
\esc_html__( 'This method is outdated and will be removed in the future.', 'embed-privacy' ), |
| 47 |
'1.10.0' |
| 48 |
); |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Add plugin meta links. |
| 53 |
* |
| 54 |
* @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\User_Interface::add_meta_link() instead |
| 55 |
* @since 1.6.0 |
| 56 |
* |
| 57 |
* @param array $input Registered links |
| 58 |
* @param string $file Current plugin file |
| 59 |
* @return array Merged links |
| 60 |
*/ |
| 61 |
public function add_meta_link( $input, $file ) { |
| 62 |
\_doing_it_wrong( |
| 63 |
__METHOD__, |
| 64 |
\sprintf( |
| 65 |
/* translators: alternative method */ |
| 66 |
\esc_html__( 'Use %s instead', 'embed-privacy' ), |
| 67 |
'epiphyt\Embed_Privacy\admin\User_Interface::add_meta_link()' |
| 68 |
), |
| 69 |
'1.10.0' |
| 70 |
); |
| 71 |
|
| 72 |
return User_Interface::add_meta_link( $input, $file ); |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* Disallow deletion of system embeds. |
| 77 |
* |
| 78 |
* @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Fields::disallow_deleting_system_embeds() instead |
| 79 |
* @since 1.4.0 |
| 80 |
* |
| 81 |
* @param array $caps The current capabilities |
| 82 |
* @param string $cap The capability to check |
| 83 |
* @param int $user_id The user ID |
| 84 |
* @param array $args Additional arguments |
| 85 |
* @return array The updated capabilities |
| 86 |
*/ |
| 87 |
function disallow_deleting_system_embeds( array $caps, $cap, $user_id, array $args ) { |
| 88 |
\_doing_it_wrong( |
| 89 |
__METHOD__, |
| 90 |
\sprintf( |
| 91 |
/* translators: alternative method */ |
| 92 |
\esc_html__( 'Use %s instead', 'embed-privacy' ), |
| 93 |
'epiphyt\Embed_Privacy\admin\Fields::disallow_deleting_system_embeds()' |
| 94 |
), |
| 95 |
'1.10.0' |
| 96 |
); |
| 97 |
|
| 98 |
return Fields::disallow_deleting_system_embeds( $caps, $cap, $user_id, $args ); |
| 99 |
} |
| 100 |
|
| 101 |
/** |
| 102 |
* Wrapping function to get a field HTML. |
| 103 |
* |
| 104 |
* @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Field::get() instead |
| 105 |
* |
| 106 |
* @param array $attributes Field attributes |
| 107 |
*/ |
| 108 |
public function get_field( array $attributes ) { |
| 109 |
\_doing_it_wrong( |
| 110 |
__METHOD__, |
| 111 |
\sprintf( |
| 112 |
/* translators: alternative method */ |
| 113 |
\esc_html__( 'Use %s instead', 'embed-privacy' ), |
| 114 |
'epiphyt\Embed_Privacy\admin\Field::get()' |
| 115 |
), |
| 116 |
'1.10.0' |
| 117 |
); |
| 118 |
Field::get( $attributes ); |
| 119 |
} |
| 120 |
|
| 121 |
/** |
| 122 |
* Get a unique instance of the class. |
| 123 |
* |
| 124 |
* @return \epiphyt\Embed_Privacy\Admin The single instance of this class |
| 125 |
*/ |
| 126 |
public static function get_instance() { |
| 127 |
if ( self::$instance === null ) { |
| 128 |
self::$instance = new self(); |
| 129 |
} |
| 130 |
|
| 131 |
return self::$instance; |
| 132 |
} |
| 133 |
|
| 134 |
/** |
| 135 |
* Initialize the settings page. |
| 136 |
* |
| 137 |
* @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Settings::register() instead |
| 138 |
*/ |
| 139 |
public function init_settings() { |
| 140 |
\_doing_it_wrong( |
| 141 |
__METHOD__, |
| 142 |
\sprintf( |
| 143 |
/* translators: alternative method */ |
| 144 |
\esc_html__( 'Use %s instead', 'embed-privacy' ), |
| 145 |
'epiphyt\Embed_Privacy\admin\Settings::register()' |
| 146 |
), |
| 147 |
'1.10.0' |
| 148 |
); |
| 149 |
Settings::register(); |
| 150 |
} |
| 151 |
|
| 152 |
/** |
| 153 |
* Output the options HTML. |
| 154 |
* |
| 155 |
* @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Settings::get_page() instead |
| 156 |
*/ |
| 157 |
public function options_html() { |
| 158 |
\_doing_it_wrong( |
| 159 |
__METHOD__, |
| 160 |
\sprintf( |
| 161 |
/* translators: alternative method */ |
| 162 |
\esc_html__( 'Use %s instead', 'embed-privacy' ), |
| 163 |
'epiphyt\Embed_Privacy\admin\Settings::get_page()' |
| 164 |
), |
| 165 |
'1.10.0' |
| 166 |
); |
| 167 |
Settings::get_page(); |
| 168 |
} |
| 169 |
|
| 170 |
/** |
| 171 |
* Register menu entries. |
| 172 |
* |
| 173 |
* @deprecated 1.10.0 Use epiphyt\Embed_Privacy\admin\Settings::register_menu() instead |
| 174 |
*/ |
| 175 |
public function register_menu() { |
| 176 |
\_doing_it_wrong( |
| 177 |
__METHOD__, |
| 178 |
\sprintf( |
| 179 |
/* translators: alternative method */ |
| 180 |
\esc_html__( 'Use %s instead', 'embed-privacy' ), |
| 181 |
'epiphyt\Embed_Privacy\admin\Settings::register_menu()' |
| 182 |
), |
| 183 |
'1.10.0' |
| 184 |
); |
| 185 |
Settings::register_menu(); |
| 186 |
} |
| 187 |
} |
| 188 |
|