| @@ -32,37 +32,8 @@ | ||
| 32 | 32 | add_action( 'switch_blog', array( $this, 'switch_blog' ), 10, 2 ); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * Instantiate classes always needed | |
| 37 | - * | |
| 38 | - * @since 2.6 | |
| 39 | - */ | |
| 40 | - public function init() { | |
| 41 | - // REST API | |
| 42 | - if ( class_exists( 'PLL_REST_API' ) ) { | |
| 43 | - $this->rest_api = new PLL_REST_API( $this ); | |
| 44 | - } | |
| 45 | - | |
| 46 | - if ( $this->model->get_languages_list() ) { | |
| 47 | - // Used by content duplicate and post synchronization | |
| 48 | - if ( class_exists( 'PLL_Sync_Content' ) ) { | |
| 49 | - $this->sync_content = new PLL_Sync_Content( $this ); | |
| 50 | - } | |
| 51 | - | |
| 52 | - // Active languages | |
| 53 | - if ( class_exists( 'PLL_Active_Languages' ) ) { | |
| 54 | - $this->active_languages = new PLL_Active_Languages( $this ); | |
| 55 | - } | |
| 56 | - | |
| 57 | - // Share post slugs | |
| 58 | - if ( get_option( 'permalink_structure' ) && $this->options['force_lang'] && class_exists( 'PLL_Share_Post_Slug' ) ) { | |
| 59 | - $this->share_post_slug = new PLL_Share_Post_Slug( $this ); | |
| 60 | - } | |
| 61 | - } | |
| 62 | - } | |
| 63 | - | |
| 64 | - /** | |
| 65 | 36 | * Registers our widgets |
| 66 | 37 | * |
| 67 | 38 | * @since 0.1 |
| 68 | 39 | */ |
| @@ -117,9 +88,8 @@ | ||
| 117 | 88 | // 2nd test needed when Polylang is not networked activated |
| 118 | 89 | // 3rd test needed when Polylang is networked activated and a new site is created |
| 119 | 90 | if ( $new_blog != $old_blog && in_array( POLYLANG_BASENAME, $plugins ) && get_option( 'polylang' ) ) { |
| 120 | 91 | $this->options = get_option( 'polylang' ); // Needed for menus |
| 121 | - remove_action( 'pre_option_rewrite_rules', array( $this->links_model, 'prepare_rewrite_rules' ) ); | |
| 122 | 92 | $this->links_model = $this->model->get_links_model(); |
| 123 | 93 | return true; |
| 124 | 94 | } |
| 125 | 95 | return false; |
| @@ -138,32 +108,19 @@ | ||
| 138 | 108 | public function __call( $func, $args ) { |
| 139 | 109 | foreach ( $this as $prop => &$obj ) { |
| 140 | 110 | if ( is_object( $obj ) && method_exists( $obj, $func ) ) { |
| 141 | 111 | if ( WP_DEBUG ) { |
| 142 | - $debug = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions | |
| 112 | + $debug = debug_backtrace(); | |
| 143 | 113 | $i = 1 + empty( $debug[1]['line'] ); // The file and line are in $debug[2] if the function was called using call_user_func |
| 144 | - trigger_error( // phpcs:ignore WordPress.PHP.DevelopmentFunctions | |
| 145 | - sprintf( | |
| 146 | - '%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", | |
| 147 | - esc_html( $func ), | |
| 148 | - esc_html( $prop ), | |
| 149 | - esc_html( $debug[ $i ]['file'] ), | |
| 150 | - absint( $debug[ $i ]['line'] ) | |
| 151 | - ) | |
| 152 | - ); | |
| 114 | + trigger_error( sprintf( | |
| 115 | + '%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", | |
| 116 | + $func, $prop, $debug[ $i ]['file'], $debug[ $i ]['line'] | |
| 117 | + ) ); | |
| 153 | 118 | } |
| 154 | 119 | return call_user_func_array( array( $obj, $func ), $args ); |
| 155 | 120 | } |
| 156 | 121 | } |
| 157 | 122 | |
| 158 | - $debug = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions | |
| 159 | - trigger_error( // phpcs:ignore WordPress.PHP.DevelopmentFunctions | |
| 160 | - sprintf( | |
| 161 | - 'Call to undefined function PLL()->%1$s() in %2$s on line %3$s' . "\nError handler", | |
| 162 | - esc_html( $func ), | |
| 163 | - esc_html( $debug[0]['file'] ), | |
| 164 | - absint( $debug[0]['line'] ) | |
| 165 | - ), | |
| 166 | - E_USER_ERROR | |
| 167 | - ); | |
| 123 | + $debug = debug_backtrace(); | |
| 124 | + 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 ); | |
| 168 | 125 | } |
| 169 | 126 | } |