| @@ -1,8 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * @package Polylang | |
| 4 | - */ | |
| 5 | 2 | |
| 6 | 3 | /** |
| 7 | 4 | * Base class for both admin and frontend |
| 8 | 5 | * |
| @@ -8,44 +5,11 @@ | ||
| 8 | 5 | * |
| 9 | 6 | * @since 1.2 |
| 10 | 7 | */ |
| 11 | 8 | abstract class PLL_Base { |
| 12 | - /** | |
| 13 | - * Stores the plugin options. | |
| 14 | - * | |
| 15 | - * @var array | |
| 16 | - */ | |
| 17 | - public $options; | |
| 9 | + public $links_model, $model, $options; | |
| 18 | 10 | |
| 19 | 11 | /** |
| 20 | - * Instance of PLL_Model. | |
| 21 | - * | |
| 22 | - * @var PLL_Model | |
| 23 | - */ | |
| 24 | - public $model; | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * Instance of a child class of PLL_Links_Model. | |
| 28 | - * | |
| 29 | - * @var PLL_Links_Model | |
| 30 | - */ | |
| 31 | - public $links_model; | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * Registers hooks on insert / update post related actions and filters. | |
| 35 | - * | |
| 36 | - * @var PLL_CRUD_Posts | |
| 37 | - */ | |
| 38 | - public $posts; | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * Registers hooks on insert / update term related action and filters. | |
| 42 | - * | |
| 43 | - * @var PLL_CRUD_Terms | |
| 44 | - */ | |
| 45 | - public $terms; | |
| 46 | - | |
| 47 | - /** | |
| 48 | 12 | * Constructor |
| 49 | 13 | * |
| 50 | 14 | * @since 1.2 |
| 51 | 15 | * |
| @@ -68,21 +32,8 @@ | ||
| 68 | 32 | add_action( 'switch_blog', array( $this, 'switch_blog' ), 10, 2 ); |
| 69 | 33 | } |
| 70 | 34 | |
| 71 | 35 | /** |
| 72 | - * Instantiates classes reacting to CRUD operations on posts and terms, | |
| 73 | - * only when at least one language is defined. | |
| 74 | - * | |
| 75 | - * @since 2.6 | |
| 76 | - */ | |
| 77 | - public function init() { | |
| 78 | - if ( $this->model->get_languages_list() ) { | |
| 79 | - $this->posts = new PLL_CRUD_Posts( $this ); | |
| 80 | - $this->terms = new PLL_CRUD_Terms( $this ); | |
| 81 | - } | |
| 82 | - } | |
| 83 | - | |
| 84 | - /** | |
| 85 | 36 | * Registers our widgets |
| 86 | 37 | * |
| 87 | 38 | * @since 0.1 |
| 88 | 39 | */ |
| @@ -158,17 +109,17 @@ | ||
| 158 | 109 | public function __call( $func, $args ) { |
| 159 | 110 | foreach ( $this as $prop => &$obj ) { |
| 160 | 111 | if ( is_object( $obj ) && method_exists( $obj, $func ) ) { |
| 161 | 112 | if ( WP_DEBUG ) { |
| 162 | - $debug = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions | |
| 113 | + $debug = debug_backtrace(); | |
| 163 | 114 | $i = 1 + empty( $debug[1]['line'] ); // The file and line are in $debug[2] if the function was called using call_user_func |
| 164 | - trigger_error( // phpcs:ignore WordPress.PHP.DevelopmentFunctions | |
| 115 | + trigger_error( | |
| 165 | 116 | sprintf( |
| 166 | 117 | '%1$s was called incorrectly in %3$s on line %4$s: the call to $polylang->%1$s() has been deprecated in Polylang 1.2, use PLL()->%2$s->%1$s() instead.' . "\nError handler", |
| 167 | - esc_html( $func ), | |
| 168 | - esc_html( $prop ), | |
| 169 | - esc_html( $debug[ $i ]['file'] ), | |
| 170 | - absint( $debug[ $i ]['line'] ) | |
| 118 | + $func, | |
| 119 | + $prop, | |
| 120 | + $debug[ $i ]['file'], | |
| 121 | + $debug[ $i ]['line'] | |
| 171 | 122 | ) |
| 172 | 123 | ); |
| 173 | 124 | } |
| 174 | 125 | return call_user_func_array( array( $obj, $func ), $args ); |
| @@ -174,16 +125,8 @@ | ||
| 174 | 125 | return call_user_func_array( array( $obj, $func ), $args ); |
| 175 | 126 | } |
| 176 | 127 | } |
| 177 | 128 | |
| 178 | - $debug = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions | |
| 179 | - trigger_error( // phpcs:ignore WordPress.PHP.DevelopmentFunctions | |
| 180 | - sprintf( | |
| 181 | - 'Call to undefined function PLL()->%1$s() in %2$s on line %3$s' . "\nError handler", | |
| 182 | - esc_html( $func ), | |
| 183 | - esc_html( $debug[0]['file'] ), | |
| 184 | - absint( $debug[0]['line'] ) | |
| 185 | - ), | |
| 186 | - E_USER_ERROR | |
| 187 | - ); | |
| 129 | + $debug = debug_backtrace(); | |
| 130 | + trigger_error( sprintf( 'Call to undefined function PLL()->%1$s() in %2$s on line %3$s' . "\nError handler", $func, $debug[0]['file'], $debug[0]['line'] ), E_USER_ERROR ); | |
| 188 | 131 | } |
| 189 | 132 | } |