3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * Plugin Name: Stylish Top Author Widget * Plugin URI: http://demo.forsideint.com * Description: Stylish Top Author List Widget in different style. * Version: 1.1 * Author: Forside International * Author URI: http://forsideint.com * License: GPLv2 or later * License URI: http://www.gnu.org/licenses/gpl-2.0.html */ /* Do not try to edit any code here. If you try to do this the Plugin will be broken */ /* Modifications in lieu of rediculous disclaimer above by Ardelean Solutions on 2014-06-18 * Changes: Added filters for specific authors */ define('FORSIDE_STYLISH_TOP_AUTHOR_PLUGIN_PATH', WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) . '/' ); function forside_stylish_top_author_scripts($hook) { /* Register our script. */ wp_enqueue_style( 'FORSIDE_STYLISH_TOP_AUTHOR_STYLE', FORSIDE_STYLISH_TOP_AUTHOR_PLUGIN_PATH.'stylesheet/css3.css' ); } add_action('wp_enqueue_scripts', 'forside_stylish_top_author_scripts'); //add_action( 'widgets_init', 'forside_stylish_top_author_widget' ); wp_register_sidebar_widget( 'forside_stylish_top_author_widget', // Widget ID 'Stylish Top Author Widget', // Name of the Widget 'forside_stylish_top_authors_widget_display', // Callback Function array( // Options 'description' => 'Stylish Top Authors List' ) ); wp_register_widget_control( 'forside_stylish_top_author_widget', // id 'forside_stylish_top_author_widget', // name 'forside_stylish_top_authors_widget_control'// callback function ); function forside_stylish_top_authors_widget_control($args=array(), $params=array()) { // DB option update if (isset($_POST['submitted'])) { update_option('forside_stylish_top_author_widget_title', $_POST['widgettitle']); update_option('forside_stylish_top_author_widget_title_icon', $_POST['widgettitleicon']); update_option('forside_stylish_top_author_widget_title_icon_width', $_POST['widgettitleiconwidth']); update_option('forside_stylish_top_author_widget_number', $_POST['number']); update_option('forside_stylish_top_author_widget_author_filter', $_POST['authorfilter']); } // Options $widgettitle = get_option('forside_stylish_top_author_widget_title'); $widgettitleicon = get_option('forside_stylish_top_author_widget_title_icon'); $widgettitleiconwidth = get_option('forside_stylish_top_author_widget_title_icon_width'); $number = get_option('forside_stylish_top_author_widget_number'); $authorfilter = get_option('forside_stylish_top_author_widget_author_filter'); ?> <h4>Icon Link For Title : <input type="text" style="width:50%" name="widgettitleicon" value="<?php echo stripslashes($widgettitleicon); ?>" /></h4> <h4>Width of Icon : <input type="text" style="width:60%" name="widgettitleiconwidth" value="<?php echo stripslashes($widgettitleiconwidth); ?>" /></h4> <h4>Title <input type="text" style="width:80%" name="widgettitle" value="<?php echo stripslashes($widgettitle); ?>" /></h4> <h4><strong>Show <input type="text" style="width:55%" name="number" value="<?php echo stripslashes($number); ?>" /> Authors</strong></h4> <h4>Author Filter <input type="text" style="width:80%" name="authorfilter" value="<?php echo stripslashes($authorfilter); ?>" /><br />(Only show author's in this list, and in this order)</h4> </br> <input type="hidden" name="submitted" value="1" /> <?php } function forside_stylish_top_authors_widget_display($args=array(), $params=array()) { // Options Loading $widgettitle = get_option('forside_stylish_top_author_widget_title'); $widgettitleicon = get_option('forside_stylish_top_author_widget_title_icon'); $widgettitleiconwidth = get_option('forside_stylish_top_author_widget_title_icon_width'); $number = get_option('forside_stylish_top_author_widget_number'); $authorfilter = get_option('forside_stylish_top_author_widget_author_filter'); // Widget Output echo stripslashes($args['before_widget']); echo '<div id="stylish_top_author">'; if ($widgettitle != '') { echo stripslashes($args['before_title']);?> <img style="margin-right:5px" width="<?php echo stripslashes($widgettitleiconwidth);?>" src="<?php echo stripslashes($widgettitleicon);?>"/><?php echo stripslashes($widgettitle); echo stripslashes($args['after_title']); } else { echo ""; } ?> <ol> <?php $userArray = array(); if (trim($authorfilter) == '') $userArray = get_users('order=DESC&orderby=post_count&number='.$number.''); else { $userNames = explode( ',', stripslashes($authorfilter) ); $userIDs = array(); foreach ($userNames as $userName) { if ( trim ( $userName ) != '' && count( $userArray ) < $number ) { $userObjects = get_users( array ( 'search' => trim ( $userName ) ) ); $userObject = $userObjects[0]; if ( $userObject != null ) $userArray[] = $userObject; } } #$userArray = $userObjects = get_users( array( 'include' => $userIDs ) ); } foreach ( $userArray as $user ) : ?> <li><a href="<?php echo bloginfo( url )."/author/".$user->user_login; ?>"> <figure> <?php echo get_avatar($user->ID, 100); ?> <figcaption> <h5> <?php echo $user->display_name; ?> </h5> <p style="color:aquamarine">Published <?php echo count_user_posts($user->ID); ?> Posts</p> <p><?php echo $user->description; ?></p> </figcaption> </figure></a> </li> <?php endforeach; ?> </ol> <!-- Stylish Top Author List --> <?php echo '</div> <!-- Stylish Top Author List Widget -->'; echo stripslashes($args['after_widget']); } /* Coding for STYLISH TOP AUTHOR PLUGIN */
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Undefined constant "WP_PLUGIN_URL" in /in/oW4dV:18 Stack trace: #0 {main} thrown in /in/oW4dV on line 18
Process exited with code 255.
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: Use of undefined constant WP_PLUGIN_URL - assumed 'WP_PLUGIN_URL' (this will throw an Error in a future version of PHP) in /in/oW4dV on line 18 Fatal error: Uncaught Error: Call to undefined function plugin_basename() in /in/oW4dV:18 Stack trace: #0 {main} thrown in /in/oW4dV on line 18
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
Fatal error: Uncaught Error: Call to undefined function plugin_basename() in /in/oW4dV:18 Stack trace: #0 {main} thrown in /in/oW4dV on line 18
Process exited with code 255.
Output for 5.2.3 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Call to undefined function plugin_basename() in /in/oW4dV on line 18
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
<br /> <b>Fatal error</b>: Call to undefined function plugin_basename() in <b>/in/oW4dV</b> on line <b>18</b><br />
Process exited with code 255.
Output for 4.4.5 - 4.4.9
<br /> <b>Fatal error</b>: Call to undefined function: plugin_basename() in <b>/in/oW4dV</b> on line <b>18</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
<br /> <b>Fatal error</b>: Call to undefined function: plugin_basename() in <b>/in/oW4dV</b> on line <b>18</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Fatal error</b>: Call to undefined function: plugin_basename() in <b>/in/oW4dV</b> on line <b>18</b><br />

preferences:
270.61 ms | 401 KiB | 468 Q