3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @package gm_Tracking */ /* Plugin Name: User-tracking codes for GM Plugin URI: http://www.groupemoniteur.fr/ Description: Adds js codes for user-tracking Version: 1.0 Author: Pierre GERRIER Author URI: mailto:pierre@gerrier.fr License: GPLv2 or later */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ if(!class_exists('gmTracking')) { class gmTracking { static protected $default_trackers = array( 'CookieApprovalTracking' ); static public function get_defined_trackers() { $trackers = apply_filters('gm_tracking_default_trackers', self::$default_trackers); foreach($trackers as $tracker) { require_once(dirname(__FILE__) . '/gm_Tracking/' . $tracker . '.php'); } return apply_filters('gm_tracking_defined_trackers', $trackers); } static public function display_trackings() { $trackers = static::get_defined_trackers(); $codes = array(); foreach($trackers as $tracker) { if(class_exists($tracker)) { // TODO: add enable/disable flags $codes[$tracker] = $tracker::get_tracking_code(); } } echo implode($codes); } static public function admin_bar_init() { if(!is_super_admin() || !is_admin_bar_showing() || (isset($_SERVER['SCRIPT_NAME']) && 'wp-login.php' == basename($_SERVER['SCRIPT_NAME']))) { return; } add_action('admin_bar_menu', array(__CLASS__, 'admin_bar_menu'), 1000); } static public function admin_bar_menu(WP_Admin_Bar $wp_admin_bar) { $wp_admin_bar->add_menu(array( 'id' => 'gm-tracking', 'title' => 'Tracking', )); $trackers = static::get_defined_trackers(); foreach($trackers as $tracker) { if(class_exists($tracker)) { $wp_admin_bar->add_menu(array( 'id' => 'gm-tracking-' . $tracker, 'parent' => 'gm-tracking', 'title' => $tracker::get_admin_bar_label(), )); if(false !== $content = $tracker::get_admin_bar_content()) { if(!is_array($content)) { $content = array($content); } foreach($content as $k => $v) { $wp_admin_bar->add_menu(array( 'id' => 'gm-tracking-' . $tracker . '-' . $k, 'parent' => 'gm-tracking-' . $tracker, 'title' => $v, )); } } } } } } } if(class_exists('gmTracking')) { add_action('wp_footer', array('gmTracking', 'display_trackings')); add_action('admin_bar_init', array('gmTracking', 'admin_bar_init')); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 6
filename:       /in/BpHb7
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   INIT_FCALL                                               'class_exists'
          1        SEND_VAL                                                 'gmTracking'
          2        DO_ICALL                                         $0      
          3        BOOL_NOT                                         ~1      $0
          4      > JMPZ                                                     ~1, ->6
   34     5    >   DECLARE_CLASS                                            'gmtracking'
  108     6    >   INIT_FCALL                                               'class_exists'
          7        SEND_VAL                                                 'gmTracking'
          8        DO_ICALL                                         $2      
          9      > JMPZ                                                     $2, ->18
  109    10    >   INIT_FCALL_BY_NAME                                       'add_action'
         11        SEND_VAL_EX                                              'wp_footer'
         12        SEND_VAL_EX                                              <array>
         13        DO_FCALL                                      0          
  110    14        INIT_FCALL_BY_NAME                                       'add_action'
         15        SEND_VAL_EX                                              'admin_bar_init'
         16        SEND_VAL_EX                                              <array>
         17        DO_FCALL                                      0          
  111    18    > > RETURN                                                   1

Class gmTracking:
Function get_defined_trackers:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/BpHb7
function name:  get_defined_trackers
number of ops:  24
compiled vars:  !0 = $trackers, !1 = $tracker
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   INIT_FCALL_BY_NAME                                       'apply_filters'
          1        SEND_VAL_EX                                              'gm_tracking_default_trackers'
          2        CHECK_FUNC_ARG                                           
          3        FETCH_STATIC_PROP_FUNC_ARG   unknown             $2      'default_trackers'
          4        SEND_FUNC_ARG                                            $2
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !0, $3
   43     7      > FE_RESET_R                                       $5      !0, ->17
          8    > > FE_FETCH_R                                               $5, !1, ->17
   44     9    >   INIT_FCALL                                               'dirname'
         10        SEND_VAL                                                 '%2Fin%2FBpHb7'
         11        DO_ICALL                                         $6      
         12        CONCAT                                           ~7      $6, '%2Fgm_Tracking%2F'
         13        CONCAT                                           ~8      ~7, !1
         14        CONCAT                                           ~9      ~8, '.php'
         15        INCLUDE_OR_EVAL                                          ~9, REQUIRE_ONCE
   43    16      > JMP                                                      ->8
         17    >   FE_FREE                                                  $5
   47    18        INIT_FCALL_BY_NAME                                       'apply_filters'
         19        SEND_VAL_EX                                              'gm_tracking_defined_trackers'
         20        SEND_VAR_EX                                              !0
         21        DO_FCALL                                      0  $11     
         22      > RETURN                                                   $11
   48    23*     > RETURN                                                   null

End of function get_defined_trackers

Function display_trackings:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 15
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/BpHb7
function name:  display_trackings
number of ops:  22
compiled vars:  !0 = $trackers, !1 = $codes, !2 = $tracker
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E >   INIT_STATIC_METHOD_CALL                                  'get_defined_trackers'
          1        DO_FCALL                                      0  $3      
          2        ASSIGN                                                   !0, $3
   53     3        ASSIGN                                                   !1, <array>
   55     4      > FE_RESET_R                                       $6      !0, ->16
          5    > > FE_FETCH_R                                               $6, !2, ->16
   56     6    >   INIT_FCALL                                               'class_exists'
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $7      
          9      > JMPZ                                                     $7, ->15
   58    10    >   FETCH_CLASS                                   0  $9      !2
         11        INIT_STATIC_METHOD_CALL                                  $9, 'get_tracking_code'
         12        DO_FCALL                                      0  $10     
         13        ASSIGN_DIM                                               !1, !2
         14        OP_DATA                                                  $10
   55    15    > > JMP                                                      ->5
         16    >   FE_FREE                                                  $6
   62    17        INIT_FCALL                                               'implode'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $11     
         20        ECHO                                                     $11
   63    21      > RETURN                                                   null

End of function display_trackings

Function admin_bar_init:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 47) Position 1 = 9, Position 2 = 20
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 20
Branch analysis from position: 8
filename:       /in/BpHb7
function name:  admin_bar_init
number of ops:  28
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   66     0  E >   INIT_FCALL_BY_NAME                                       'is_super_admin'
          1        DO_FCALL                                      0  $0      
          2        BOOL_NOT                                         ~1      $0
          3      > JMPNZ_EX                                         ~1      ~1, ->8
          4    >   INIT_FCALL_BY_NAME                                       'is_admin_bar_showing'
          5        DO_FCALL                                      0  $2      
          6        BOOL_NOT                                         ~3      $2
          7        BOOL                                             ~1      ~3
          8    > > JMPNZ_EX                                         ~1      ~1, ->20
          9    >   FETCH_IS                                         ~4      '_SERVER'
         10        ISSET_ISEMPTY_DIM_OBJ                         0  ~5      ~4, 'SCRIPT_NAME'
         11      > JMPZ_EX                                          ~5      ~5, ->19
         12    >   INIT_FCALL                                               'basename'
         13        FETCH_R                      global              ~6      '_SERVER'
         14        FETCH_DIM_R                                      ~7      ~6, 'SCRIPT_NAME'
         15        SEND_VAL                                                 ~7
         16        DO_ICALL                                         $8      
         17        IS_EQUAL                                         ~9      $8, 'wp-login.php'
         18        BOOL                                             ~5      ~9
         19    >   BOOL                                             ~1      ~5
         20    > > JMPZ                                                     ~1, ->22
   67    21    > > RETURN                                                   null
   70    22    >   INIT_FCALL_BY_NAME                                       'add_action'
         23        SEND_VAL_EX                                              'admin_bar_menu'
         24        SEND_VAL_EX                                              <array>
         25        SEND_VAL_EX                                              1000
         26        DO_FCALL                                      0          
   71    27      > RETURN                                                   null

End of function admin_bar_init

Function admin_bar_menu:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 50
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 50
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 49
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 49
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
2 jumps found. (Code = 77) Position 1 = 35, Position 2 = 48
Branch analysis from position: 35
2 jumps found. (Code = 78) Position 1 = 36, Position 2 = 48
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 48
Branch analysis from position: 34
Branch analysis from position: 49
Branch analysis from position: 49
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
filename:       /in/BpHb7
function name:  admin_bar_menu
number of ops:  52
compiled vars:  !0 = $wp_admin_bar, !1 = $trackers, !2 = $tracker, !3 = $content, !4 = $v, !5 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   73     0  E >   RECV                                             !0      
   74     1        INIT_METHOD_CALL                                         !0, 'add_menu'
   75     2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0          
   79     4        INIT_STATIC_METHOD_CALL                                  'get_defined_trackers'
          5        DO_FCALL                                      0  $7      
          6        ASSIGN                                                   !1, $7
   80     7      > FE_RESET_R                                       $9      !1, ->50
          8    > > FE_FETCH_R                                               $9, !2, ->50
   81     9    >   INIT_FCALL                                               'class_exists'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $10     
         12      > JMPZ                                                     $10, ->49
   82    13    >   INIT_METHOD_CALL                                         !0, 'add_menu'
   83    14        CONCAT                                           ~11     'gm-tracking-', !2
         15        INIT_ARRAY                                       ~12     ~11, 'id'
   84    16        ADD_ARRAY_ELEMENT                                ~12     'gm-tracking', 'parent'
   85    17        FETCH_CLASS                                   0  $13     !2
         18        INIT_STATIC_METHOD_CALL                                  $13, 'get_admin_bar_label'
         19        DO_FCALL                                      0  $14     
         20        ADD_ARRAY_ELEMENT                                ~12     $14, 'title'
         21        SEND_VAL_EX                                              ~12
         22        DO_FCALL                                      0          
   87    23        FETCH_CLASS                                   0  $16     !2
         24        INIT_STATIC_METHOD_CALL                                  $16, 'get_admin_bar_content'
         25        DO_FCALL                                      0  $17     
         26        ASSIGN                                           ~18     !3, $17
         27        TYPE_CHECK                                  1018          ~18
         28      > JMPZ                                                     ~19, ->49
   88    29    >   TYPE_CHECK                                  128  ~20     !3
         30        BOOL_NOT                                         ~21     ~20
         31      > JMPZ                                                     ~21, ->34
   89    32    >   INIT_ARRAY                                       ~22     !3
         33        ASSIGN                                                   !3, ~22
   92    34    > > FE_RESET_R                                       $24     !3, ->48
         35    > > FE_FETCH_R                                       ~25     $24, !4, ->48
         36    >   ASSIGN                                                   !5, ~25
   93    37        INIT_METHOD_CALL                                         !0, 'add_menu'
   94    38        CONCAT                                           ~27     'gm-tracking-', !2
         39        CONCAT                                           ~28     ~27, '-'
         40        CONCAT                                           ~29     ~28, !5
         41        INIT_ARRAY                                       ~30     ~29, 'id'
   95    42        CONCAT                                           ~31     'gm-tracking-', !2
         43        ADD_ARRAY_ELEMENT                                ~30     ~31, 'parent'
   96    44        ADD_ARRAY_ELEMENT                                ~30     !4, 'title'
         45        SEND_VAL_EX                                              ~30
         46        DO_FCALL                                      0          
   92    47      > JMP                                                      ->35
         48    >   FE_FREE                                                  $24
   80    49    > > JMP                                                      ->8
         50    >   FE_FREE                                                  $9
  102    51      > RETURN                                                   null

End of function admin_bar_menu

End of class gmTracking.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.3 ms | 1404 KiB | 21 Q