PluginProbe ʕ •ᴥ•ʔ
External Links – nofollow, noopener & new window / 2.3
External Links – nofollow, noopener & new window v2.3
0.31 0.32 0.33 0.34 0.35 1.01 1.02 1.03 1.10 1.20 1.21 1.30 1.31 1.40 1.41 1.50 1.51 1.52 1.53 1.54 1.55 1.56 1.60 1.61 1.62 1.70 1.80 1.81 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.0 2.1.1 2.1.2 2.1.3 2.2.0 2.3 2.32 2.35 2.40 2.42 2.43 2.45 2.46 2.47 2.48 2.50 2.51 2.55 2.56 2.57 2.58 2.59 2.60 2.61 2.62 2.63 2.64 2.65 trunk 0.10 0.11 0.12 0.20 0.21 0.30
wp-external-links / includes / admin / settings-fields / class-wpel-admin-fields.php
wp-external-links / includes / admin / settings-fields Last commit date
class-wpel-admin-fields.php 7 years ago class-wpel-exceptions-fields.php 7 years ago class-wpel-excluded-link-fields.php 7 years ago class-wpel-external-link-fields.php 7 years ago class-wpel-internal-link-fields.php 7 years ago class-wpel-link-fields-base.php 7 years ago
class-wpel-admin-fields.php
79 lines
1 <?php
2 /**
3 * Class WPEL_Admin_Fields
4 *
5 * @package WPEL
6 * @category WordPress Plugin
7 * @version 2.3
8 * @link https://www.webfactoryltd.com/
9 * @license Dual licensed under the MIT and GPLv2+ licenses
10 */
11 final class WPEL_Admin_Fields extends FWP_Settings_Section_Base_1x0x0
12 {
13
14 /**
15 * Initialize
16 */
17 protected function init()
18 {
19 $this->set_settings( array(
20 'section_id' => 'wpel-admin-fields',
21 'page_id' => 'wpel-admin-fields',
22 'option_name' => 'wpel-admin-settings',
23 'option_group' => 'wpel-admin-settings',
24 'title' => __( 'Admin Settings', 'wp-external-links' ),
25 'fields' => array(
26 'own_admin_menu' => array(
27 'label' => __( 'Main Admin Menu:', 'wp-external-links' ),
28 'default_value' => '1',
29 ),
30 ),
31 ) );
32
33 parent::init();
34 }
35
36 /**
37 * Show field methods
38 */
39
40 protected function show_own_admin_menu( array $args )
41 {
42 $this->get_html_fields()->check_with_label(
43 $args[ 'key' ]
44 , __( 'Create own admin menu for this plugin', 'wp-external-links' )
45 , '1'
46 , ''
47 );
48
49 echo ' <p class="description">'
50 . __( 'Or else it will be added to the "Settings" menu', 'wp-external-links' )
51 .'</p>';
52 }
53
54 /**
55 * Validate and sanitize user input before saving to databse
56 * @param array $new_values
57 * @param array $old_values
58 * @return array
59 */
60 protected function before_update( array $new_values, array $old_values )
61 {
62 $update_values = $new_values;
63 $is_valid = true;
64
65 $is_valid = $is_valid && in_array( $new_values[ 'own_admin_menu' ], array( '', '1' ) );
66
67 if ( false === $is_valid ) {
68 // error when user input is not valid conform the UI, probably tried to "hack"
69 $this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
70 return $old_values;
71 }
72
73 return $update_values;
74 }
75
76 }
77
78 /*?>*/
79