1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Auto Load Next Post Settings - Events |
4
|
|
|
* |
5
|
|
|
* @since 1.0.0 |
6
|
|
|
* @version 1.4.10 |
7
|
|
|
* @author Sébastien Dumont |
8
|
|
|
* @category Admin |
9
|
|
|
* @package Auto Load Next Post |
10
|
|
|
* @license GPL-2.0+ |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
// Exit if accessed directly. |
14
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
15
|
|
|
exit; |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
if ( ! class_exists( 'Auto_Load_Next_Post_Settings_Events_Tab' ) ) { |
19
|
|
|
|
20
|
|
|
class Auto_Load_Next_Post_Settings_Events_Tab extends Auto_Load_Next_Post_Settings_Page { |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Constructor. |
24
|
|
|
* |
25
|
|
|
* @access public |
26
|
|
|
* @since 1.5.0 |
27
|
|
|
* @version 1.5.0 |
28
|
|
|
*/ |
29
|
|
|
public function __construct() { |
30
|
|
|
$this->id = 'events'; |
31
|
|
|
$this->label = __( 'Events', 'auto-load-next-post' ); |
32
|
|
|
|
33
|
|
|
parent::__construct(); |
34
|
|
|
} // END __construct() |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Get settings array. |
38
|
|
|
* |
39
|
|
|
* @access public |
40
|
|
|
* @since 1.5.0 |
41
|
|
|
* @return array |
42
|
|
|
*/ |
43
|
|
|
public function get_settings() { |
44
|
|
|
return apply_filters( |
45
|
|
|
'auto_load_next_post_general_settings', array( |
46
|
|
|
|
47
|
|
|
array( |
48
|
|
|
'title' => __( 'Events', 'auto-load-next-post' ), |
49
|
|
|
'type' => 'title', |
50
|
|
|
'desc' => sprintf( __( 'User defined events, below you can choose external JavaScript events to be triggered alongside Auto Load Next Post native events', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) ), |
51
|
|
|
'id' => 'events_options' |
52
|
|
|
), |
53
|
|
|
|
54
|
|
|
array( |
55
|
|
|
'title' => __( 'Post loaded', 'auto-load-next-post' ), |
56
|
|
|
'desc' => __( 'After the new post has loaded, comma separated events list: <code>event1,event2, ...</code>', 'auto-load-next-post' ), |
57
|
|
|
//'desc_tip' => true, |
58
|
|
|
'id' => 'auto_load_next_post_on_load_event', |
59
|
|
|
'placeholder' => 'event1,event2, ...', |
60
|
|
|
'type' => 'textarea', |
61
|
|
|
'css' => 'min-width:300px;', |
62
|
|
|
'autoload' => false |
63
|
|
|
), |
64
|
|
|
|
65
|
|
|
array( |
66
|
|
|
'title' => __( 'Entering a post', 'auto-load-next-post' ), |
67
|
|
|
'desc' => __( 'Entering a post, comma separated events list: <code>event1,event2, ...</code>', 'auto-load-next-post' ), |
68
|
|
|
//'desc_tip' => true, |
69
|
|
|
'id' => 'auto_load_next_post_on_entering_event', |
70
|
|
|
'placeholder' => 'event1,event2, ...', |
71
|
|
|
'type' => 'textarea', |
72
|
|
|
'css' => 'min-width:300px;', |
73
|
|
|
'autoload' => false |
74
|
|
|
), |
75
|
|
|
|
76
|
|
|
array( |
77
|
|
|
'type' => 'sectionend', |
78
|
|
|
'id' => 'events_options' |
79
|
|
|
), |
80
|
|
|
) ); // End general settings |
81
|
|
|
} // END get_settings() |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Output the settings. |
85
|
|
|
* |
86
|
|
|
* @access public |
87
|
|
|
* @since 1.5.0 |
88
|
|
|
*/ |
89
|
|
|
public function output() { |
90
|
|
|
$settings = $this->get_settings(); |
91
|
|
|
|
92
|
|
|
Auto_Load_Next_Post_Admin_Settings::output_fields( $settings ); |
93
|
|
|
} // END output() |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Save settings. |
97
|
|
|
* |
98
|
|
|
* @access public |
99
|
|
|
* @since 1.5.0 |
100
|
|
|
* @global $current_tab |
101
|
|
|
*/ |
102
|
|
|
public function save() { |
103
|
|
|
global $current_tab; |
104
|
|
|
|
105
|
|
|
$settings = $this->get_settings(); |
106
|
|
|
|
107
|
|
|
Auto_Load_Next_Post_Admin_Settings::save_fields( $settings, $current_tab ); |
|
|
|
|
108
|
|
|
} // END save() |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Get post types. |
112
|
|
|
* |
113
|
|
|
* This returns a list of public registered post types. |
114
|
|
|
* |
115
|
|
|
* @access public |
116
|
|
|
* @since 1.5.0 |
117
|
|
|
* @return array |
118
|
|
|
*/ |
119
|
|
|
public function get_post_types() { |
120
|
|
|
$post_types = get_post_types( array( 'public' => true ), 'names' ); |
121
|
|
|
|
122
|
|
|
return $post_types; |
123
|
|
|
} // END get_post_types() |
124
|
|
|
|
125
|
|
|
} // END class |
126
|
|
|
|
127
|
|
|
} // END if class exists |
128
|
|
|
|
129
|
|
|
return new Auto_Load_Next_Post_Settings_Events_Tab(); |
130
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.