PluginProbe ʕ •ᴥ•ʔ
Tracking Code Manager / 1.4
Tracking Code Manager v1.4
trunk 1.11.8 1.11.9 1.12.0 1.12.1 1.12.2 1.12.3 1.4 1.5 2.0.0 2.0.1 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0
tracking-code-manager / includes / actions.php
tracking-code-manager / includes Last commit date
admin 11 years ago actions.php 11 years ago class-TCM-check.php 11 years ago class-TCM-cron.php 11 years ago class-TCM-form.php 11 years ago class-TCM-language.php 11 years ago class-TCM-logger.php 11 years ago class-TCM-manager.php 11 years ago class-TCM-options.php 11 years ago class-TCM-tracking.php 11 years ago class-TCM-utils.php 11 years ago core.php 11 years ago install.php 11 years ago uninstall.php 11 years ago
actions.php
70 lines
1 <?php
2 /**
3 * Front-end Actions
4 *
5 * @package EDD
6 * @subpackage Functions
7 * @copyright Copyright (c) 2015, Pippin Williamson
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.0.8.1
10 */
11
12 // Exit if accessed directly
13 if ( ! defined( 'ABSPATH' ) ) exit;
14
15 /**
16 * Hooks EDD actions, when present in the $_GET superglobal. Every edd_action
17 * present in $_GET is called using WordPress's do_action function. These
18 * functions are called on init.
19 *
20 * @since 1.0
21 * @return void
22 */
23 add_action('init', 'tcm_do_action');
24 function tcm_do_action() {
25 global $tcm;
26
27 if ($tcm->Utils->qs('tcm_action')) {
28 $args=array_merge($_GET, $_POST, $_COOKIE, $_SERVER);
29 $name='tcm_'.$tcm->Utils->qs('tcm_action');
30 if(has_action($name)) {
31 $tcm->Logger->debug('EXECUTING ACTION=%s', $name);
32 do_action($name, $args);
33 } elseif(function_exists($name)) {
34 $tcm->Logger->debug('EXECUTING FUNCTION=%s DATA=%s', $name, $args);
35 call_user_func($name, $args);
36 } elseif(strpos($tcm->Utils->qs('tcm_action'), '_')!==FALSE) {
37 $pos=strpos($tcm->Utils->qs('tcm_action'), '_');
38 $what=substr($tcm->Utils->qs('tcm_action'), 0, $pos);
39 $function=substr($tcm->Utils->qs('tcm_action'), $pos+1);
40
41 $class=NULL;
42 switch (strtolower($what)) {
43 case 'manager':
44 $class=$tcm->Manager;
45 break;
46 case 'cron':
47 $class=$tcm->Cron;
48 break;
49 case 'tracking':
50 $class=$tcm->Tracking;
51 break;
52 case 'properties':
53 $class=$tcm->Options;
54 break;
55 }
56
57 if(!$class) {
58 $tcm->Logger->fatal('NO CLASS FOR=%s IN ACTION=%s', $what, $tcm->Utils->qs('tcm_action'));
59 } elseif(!method_exists ($class, $function)) {
60 $tcm->Logger->fatal('NO METHOD FOR=%s IN CLASS=%s IN ACTION=%s', $function, $what, $tcm->Utils->qs('tcm_action'));
61 } else {
62 $tcm->Logger->debug('METHOD=%s OF CLASS=%s', $function, $what);
63 call_user_func(array($class, $function), $args);
64 }
65 } else {
66 $tcm->Logger->fatal('NO FUNCTION FOR==%s', $tcm->Utils->qs('tcm_action'));
67 }
68 }
69 }
70