3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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')); }
based on BpHb7
Output for 5.3.0 - 7.1.0
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/aALUj on line 51
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STATIC in /in/aALUj on line 51
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/aALUj on line 36
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/aALUj on line 36
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/aALUj on line 36
Process exited with code 255.