PluginProbe ʕ •ᴥ•ʔ
ShareThis Dashboard for Google Analytics / 2.5.5
ShareThis Dashboard for Google Analytics v2.5.5
3.3.2 trunk 1.0.7 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.5 2.3.5 2.3.6 2.3.7 2.3.8 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 3.0.0 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.3.0 3.3.1
googleanalytics / class / core / class-ga-controller-core.php
googleanalytics / class / core Last commit date
class-ga-controller-core.php 4 years ago class-ga-view-core.php 4 years ago
class-ga-controller-core.php
48 lines
1 <?php
2 /**
3 * GoogleAnalytics Controller Core.
4 *
5 * @package GoogleAnalytics
6 */
7
8 /**
9 * Core Controller.
10 */
11 class Ga_Controller_Core {
12
13 const GA_NONCE_FIELD_NAME = '_gawpnonce';
14 const ACTION_PARAM_NAME = 'ga_action';
15
16 /**
17 * Runs particular action.
18 */
19 public function handle_actions() {
20 // Nonce verification happens in verify_nonce function.
21 $action = false === empty( $_REQUEST[ self::ACTION_PARAM_NAME ] ) ? sanitize_text_field( wp_unslash( $_REQUEST[ self::ACTION_PARAM_NAME ] ) ) : null; // phpcs:ignore
22
23 if ( $action ) {
24 $class = get_class( $this );
25 if ( is_callable(
26 array(
27 $class,
28 $action,
29 )
30 ) ) {
31 call_user_func( $class . '::' . $action );
32 }
33 }
34 }
35
36 /**
37 * Verifies nonce for given action.
38 *
39 * @param string $action Action.
40 * @return bool
41 */
42 public static function verify_nonce( $action ) {
43 $nonce = filter_input( INPUT_POST, self::GA_NONCE_FIELD_NAME, FILTER_SANITIZE_STRING );
44
45 return false !== wp_verify_nonce( $nonce, $action );
46 }
47 }
48