| @@ -23,16 +23,13 @@ | ||
| 23 | 23 | $this->options = &$polylang->options; |
| 24 | 24 | $this->model = &$polylang->model; |
| 25 | 25 | $this->links_model = &$polylang->links_model; |
| 26 | 26 | |
| 27 | - $args = wp_parse_args( | |
| 28 | - $args, | |
| 29 | - array( | |
| 30 | - 'title' => '', | |
| 31 | - 'description' => '', | |
| 32 | - 'active_option' => false, | |
| 33 | - ) | |
| 34 | - ); | |
| 27 | + $args = wp_parse_args( $args, array( | |
| 28 | + 'title' => '', | |
| 29 | + 'description' => '', | |
| 30 | + 'active_option' => false, | |
| 31 | + ) ); | |
| 35 | 32 | |
| 36 | 33 | foreach ( $args as $prop => $value ) { |
| 37 | 34 | $this->$prop = $value; |
| 38 | 35 | } |
| @@ -38,33 +35,37 @@ | ||
| 38 | 35 | } |
| 39 | 36 | |
| 40 | 37 | // All possible action links, even if not always a link ;-) |
| 41 | 38 | $this->action_links = array( |
| 42 | - 'configure' => sprintf( | |
| 39 | + 'configure' => sprintf( | |
| 43 | 40 | '<a title="%s" href="%s">%s</a>', |
| 44 | 41 | esc_attr__( 'Configure this module', 'polylang' ), |
| 45 | 42 | '#', |
| 46 | 43 | esc_html__( 'Settings', 'polylang' ) |
| 47 | 44 | ), |
| 48 | - 'deactivate' => sprintf( | |
| 45 | + | |
| 46 | + 'deactivate' => sprintf( | |
| 49 | 47 | '<a title="%s" href="%s">%s</a>', |
| 50 | 48 | esc_attr__( 'Deactivate this module', 'polylang' ), |
| 51 | - esc_url( wp_nonce_url( '?page=mlang&tab=modules&pll_action=deactivate&noheader=true&module=' . $this->module, 'pll_deactivate' ) ), | |
| 49 | + wp_nonce_url( '?page=mlang&tab=modules&pll_action=deactivate&noheader=true&module=' . $this->module, 'pll_deactivate' ), | |
| 52 | 50 | esc_html__( 'Deactivate', 'polylang' ) |
| 53 | 51 | ), |
| 54 | - 'activate' => sprintf( | |
| 52 | + | |
| 53 | + 'activate' => sprintf( | |
| 55 | 54 | '<a title="%s" href="%s">%s</a>', |
| 56 | 55 | esc_attr__( 'Activate this module', 'polylang' ), |
| 57 | - esc_url( wp_nonce_url( '?page=mlang&tab=modules&pll_action=activate&noheader=true&module=' . $this->module, 'pll_activate' ) ), | |
| 56 | + wp_nonce_url( '?page=mlang&tab=modules&pll_action=activate&noheader=true&module=' . $this->module, 'pll_activate' ), | |
| 58 | 57 | esc_html__( 'Activate', 'polylang' ) |
| 59 | 58 | ), |
| 60 | - 'activated' => esc_html__( 'Activated', 'polylang' ), | |
| 59 | + | |
| 60 | + 'activated' => esc_html__( 'Activated', 'polylang' ), | |
| 61 | + | |
| 61 | 62 | 'deactivated' => esc_html__( 'Deactivated', 'polylang' ), |
| 62 | 63 | ); |
| 63 | 64 | |
| 64 | 65 | $this->buttons = array( |
| 65 | - 'cancel' => sprintf( '<button type="button" class="button button-secondary cancel">%s</button>', esc_html__( 'Cancel', 'polylang' ) ), | |
| 66 | - 'save' => sprintf( '<button type="button" class="button button-primary save">%s</button>', esc_html__( 'Save Changes', 'polylang' ) ), | |
| 66 | + 'cancel' => sprintf( '<button type="button" class="button button-secondary cancel">%s</button>', esc_html__( 'Cancel' ) ), | |
| 67 | + 'save' => sprintf( '<button type="button" class="button button-primary save">%s</button>', esc_html__( 'Save Changes' ) ), | |
| 67 | 68 | ); |
| 68 | 69 | |
| 69 | 70 | // Ajax action to save options |
| 70 | 71 | add_action( 'wp_ajax_pll_save_options', array( $this, 'save_options' ) ); |
| @@ -154,9 +155,9 @@ | ||
| 154 | 155 | if ( ! current_user_can( 'manage_options' ) ) { |
| 155 | 156 | wp_die( -1 ); |
| 156 | 157 | } |
| 157 | 158 | |
| 158 | - if ( isset( $_POST['module'] ) && $this->module === $_POST['module'] ) { | |
| 159 | + if ( $this->module == $_POST['module'] ) { | |
| 159 | 160 | // It's up to the child class to decide which options are saved, whether there are errors or not |
| 160 | 161 | $post = array_diff_key( $_POST, array_flip( array( 'action', 'module', 'pll_ajax_backend', '_pll_nonce' ) ) ); |
| 161 | 162 | $options = $this->update( $post ); |
| 162 | 163 | $this->options = array_merge( $this->options, $options ); |
| @@ -172,9 +173,9 @@ | ||
| 172 | 173 | ob_start(); |
| 173 | 174 | |
| 174 | 175 | if ( ! get_settings_errors() ) { |
| 175 | 176 | // Send update message |
| 176 | - add_settings_error( 'general', 'settings_updated', __( 'Settings saved.', 'polylang' ), 'updated' ); | |
| 177 | + add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'updated' ); | |
| 177 | 178 | settings_errors(); |
| 178 | 179 | $x = new WP_Ajax_Response( array( 'what' => 'success', 'data' => ob_get_clean() ) ); |
| 179 | 180 | $x->send(); |
| 180 | 181 | } else { |
| @@ -193,10 +194,8 @@ | ||
| 193 | 194 | * |
| 194 | 195 | * @return array |
| 195 | 196 | */ |
| 196 | 197 | protected function get_actions() { |
| 197 | - $actions = array(); | |
| 198 | - | |
| 199 | 198 | if ( $this->is_active() && $this->get_form() ) { |
| 200 | 199 | $actions[] = 'configure'; |
| 201 | 200 | } |
| 202 | 201 | |
| @@ -231,9 +230,9 @@ | ||
| 231 | 230 | */ |
| 232 | 231 | protected function default_upgrade_message() { |
| 233 | 232 | return sprintf( |
| 234 | 233 | '%s <a href="%s">%s</a>', |
| 235 | - __( 'To enable this feature, you need Polylang Pro.', 'polylang' ), | |
| 234 | + __( 'You need Polylang Pro to enable this feature.', 'polylang' ), | |
| 236 | 235 | 'https://polylang.pro', |
| 237 | 236 | __( 'Upgrade now.', 'polylang' ) |
| 238 | 237 | ); |
| 239 | 238 | } |