/** * Content of 'td'. * * @param WP_User $user * @return void */ public function show_content(WP_User $user) { $key = esc_attr($this->key); $current = (int) get_user_meta($user->ID, $this->key); $check = checked(1, $current, FALSE); $text = esc_html__('Do not redirect me automatically to the best matching language version.', 'multilingualpress'); wp_nonce_field($this->nonce->get_action(), $this->nonce->get_name()); printf('<label for="%1$s_id"> <input type="checkbox" value="1" name="%1$s" id="%1$s_id" %2$s> %3$s </label>', $key, $check, $text); }
/** * @param string $hook * * @return void */ public function load_script($hook) { if ('nav-menus.php' !== $hook) { return; } wp_localize_script('mlp-admin', 'mlpNavMenusSettings', array('action' => $this->handle, 'metaBoxID' => $this->handle, 'nonce' => wp_create_nonce($this->nonce->get_action()), 'nonceName' => $this->nonce->get_name())); }
/** * Create the content for the extra box, a table with checkboxes. * * @return string */ private function get_box_content() { $post_types = $this->get_custom_post_types(); $options = (array) get_site_option('inpsyde_multilingual_cpt'); $s_label = esc_html(__('Use dynamic permalinks', 'multilingual-press')); if (empty($post_types)) { return ''; } $out = wp_nonce_field($this->nonce_validator->get_action(), $this->nonce_validator->get_name(), TRUE, FALSE); $out .= '<table><tbody>'; foreach ($post_types as $cpt => $cpt_params) { $out .= $this->get_row($cpt, $cpt_params, $options, $s_label); } return "{$out}</tbody></table>"; }
/** * Create the content for the extra box, four illustrated checkboxes. * * @return string */ private function get_box_content() { $positions = $this->get_position_names(); $current = $this->get_current_position($positions); $out = wp_nonce_field($this->nonce_validator->get_action(), $this->nonce_validator->get_name(), true, false); $out .= '<p id="mlp-quicklink-positions">'; foreach ($positions as $key => $label) { $checked = checked($current, $key, FALSE); $out .= sprintf(' <label for="mlp-%1$s-id" class="quicklink-position-label quicklink-position-%1$s"> <input type="radio" name="quicklink-position" value="%1$s" id="mlp-%1$s-id" %2$s> %3$s </label>', $key, $checked, $label); } return $out . '</p>'; }
public function render() { wp_nonce_field($this->nonce->get_action(), $this->nonce->get_name()); $current = $this->data->get_current_option_value(); $label = esc_attr__('Enable automatic redirection', 'multilingualpress'); $name = $this->data->get_checkbox_name(); $id = "{$name}_id"; ?> <tr> <td><?php esc_html_e('Redirection', 'multilingualpress'); ?> </td> <td> <label for="<?php print $id; ?> "> <input type="checkbox" <?php checked(1, $current); ?> id="<?php print $id; ?> " value="1" name="<?php print $name; ?> " /> <?php print $label; ?> </label> </td> </tr> <?php }
/** * @return string */ public function get_nonce_field() { return wp_nonce_field($this->nonce->get_action(), $this->nonce->get_name(), TRUE, FALSE); }
/** * Basic meta box frame. * * @param WP_Post $post * @param array $meta_box * @return void */ public function render(WP_Post $post, array $meta_box) { wp_nonce_field($this->nonce->get_action(), $this->nonce->get_name()); ?> <!-- MultilingualPress Translation Box --> <div class="holder mlp_advanced_translator_metabox clear"> <?php $data = (object) $meta_box['args']; /** * Runs before the main content of the meta box. * * @param WP_Post $post Post object. * @param int $remote_blog_id Remote blog ID. * @param WP_Post $remote_post Remote post object. */ do_action('mlp_translation_meta_box_top', $post, $data->remote_blog_id, $data->remote_post); /** * Runs before the main content of the meta box. * * @param WP_Post $post Post object. * @param int $remote_blog_id Remote blog ID. * @param WP_Post $remote_post Remote post object. */ do_action("mlp_translation_meta_box_top_{$data->remote_blog_id}", $post, $data->remote_blog_id, $data->remote_post); /** * Runs with the main content of the meta box. * * @param WP_Post $post Post object. * @param int $remote_blog_id Remote blog ID. * @param WP_Post $remote_post Remote post object. */ do_action('mlp_translation_meta_box_main', $post, $data->remote_blog_id, $data->remote_post); /** * Runs with the main content of the meta box. * * @param WP_Post $post Post object. * @param int $remote_blog_id Remote blog ID. * @param WP_Post $remote_post Remote post object. */ do_action("mlp_translation_meta_box_main_{$data->remote_blog_id}", $post, $data->remote_blog_id, $data->remote_post); /** * Runs before the main content of the meta box. * * @param WP_Post $post Post object. * @param int $remote_blog_id Remote blog ID. * @param WP_Post $remote_post Remote post object. */ do_action('mlp_translation_meta_box_bottom', $post, $data->remote_blog_id, $data->remote_post); /** * Runs before the main content of the meta box. * * @param WP_Post $post Post object. * @param int $remote_blog_id Remote blog ID. * @param WP_Post $remote_post Remote post object. */ do_action("mlp_translation_meta_box_bottom_{$data->remote_blog_id}", $post, $data->remote_blog_id, $data->remote_post); ?> </div> <!-- /MultilingualPress Translation Box --> <?php }
/** * Basic meta box frame. * * @param WP_Post $post * @param array $meta_box * @return void */ public function render(WP_Post $post, array $meta_box) { wp_nonce_field($this->nonce->get_action(), $this->nonce->get_name()); ?> <!-- MultilingualPress Translation Box --> <div class="holder mlp_advanced_translator_metabox clear"> <?php $data = (object) $meta_box['args']; /** * Perform additional actions on top of the translation box. * * @param WP_Post $post * @param int $data->remote_blog_id * @param WP_Post $data->remote_post */ do_action('mlp_translation_meta_box_top', $post, $data->remote_blog_id, $data->remote_post); /** * Perform additional actions on top of the translation box. * * @param WP_Post $post * @param int $data->remote_blog_id * @param WP_Post $data->remote_post */ do_action('mlp_translation_meta_box_top_' . $data->remote_blog_id, $post, $data->remote_blog_id, $data->remote_post); /** * Meta box main content. * * @param WP_Post $post * @param int $data->remote_blog_id * @param WP_Post $data->remote_post */ do_action('mlp_translation_meta_box_main', $post, $data->remote_blog_id, $data->remote_post); /** * Meta box main content. * * @param WP_Post $post * @param int $data->remote_blog_id * @param WP_Post $data->remote_post */ do_action('mlp_translation_meta_box_main_' . $data->remote_blog_id, $post, $data->remote_blog_id, $data->remote_post); /** * Perform additional actions below the translation box. * * @param WP_Post $post * @param int $data->remote_blog_id * @param WP_Post $data->remote_post */ do_action('mlp_translation_meta_box_bottom', $post, $data->remote_blog_id, $data->remote_post); /** * Perform additional actions below the translation box. * * @param WP_Post $post * @param int $data->remote_blog_id * @param WP_Post $data->remote_post */ do_action('mlp_translation_meta_box_bottom_' . $data->remote_blog_id, $post, $data->remote_blog_id, $data->remote_post); ?> </div> <!-- /MultilingualPress Translation Box --> <?php }