WordPress.org

Ready to get started?Download WordPress

Forums

WP FullCalendar
php errors from calling non-static functions statically. (2 posts)

  1. Matt Bagley
    Member
    Posted 2 months ago #

    Getting these errors. It appears that one can just put 'static' in front of the functions to fix the errors (though I'm not sure if that is the best thing to do)

    for example:
    public static function calendar(...
    public static function init(...
    etc...

    call_user_func() expects parameter 1 to be a valid callback, non-static method WP_FullCalendar::calendar() should not be called statically
    /wp-includes/shortcodes.php(287)

    call_user_func_array() expects parameter 1 to be a valid callback, non-static method WP_FullCalendar::enqueue_scripts() should not be called statically
    /wp-includes/plugin.php(470)

    call_user_func_array() expects parameter 1 to be a valid callback, non-static method WP_FullCalendar::enqueue_scripts() should not be called statically
    /wp-includes/plugin.php(470)

    call_user_func_array() expects parameter 1 to be a valid callback, non-static method WP_FullCalendar::footer_js() should not be called statically
    /wp-includes/plugin.php(470)

    call_user_func_array() expects parameter 1 to be a valid callback, non-static method WP_FullCalendar::init() should not be called statically
    /wp-includes/plugin.php(470)

    call_user_func_array() expects parameter 1 to be a valid callback, non-static method WP_FullCalendar::init() should not be called statically
    /wp-includes/plugin.php(470)

    https://wordpress.org/plugins/wp-fullcalendar/

  2. Matt Bagley
    Member
    Posted 2 months ago #

    Possible patch (against 3.8.4) making functions static.

    diff -ur wp-fullcalendar/wp-fullcalendar.php wp-fullcalendar-new/wp-fullcalendar.php
    --- wp-fullcalendar/wp-fullcalendar.php	2013-08-28 16:54:14.000000000 -0600
    +++ wp-fullcalendar-new/wp-fullcalendar.php	2014-06-14 00:54:16.000000000 -0600
    @@ -30,7 +30,7 @@
     	static $tip_styles_css3 = array('shadow','rounded');
     	static $tip_positions = array('top left', 'top right', 'top center', 'bottom left', 'bottom right', 'bottom center', 'right center', 'right top', 'right bottom', 'left center', 'left top', 'left bottom', 'center');
    
    -	function init() {
    +	static function init() {
     		//Scripts
     		if( !is_admin() ){ //show only in public area
     		    add_action('wp_enqueue_scripts',array('WP_FullCalendar','enqueue_scripts'));
    @@ -54,7 +54,7 @@
     		//END Events Manager Integration
     	}
    
    -	function enqueue_scripts(){
    +	static function enqueue_scripts(){
     	    global $wp_query;
     	    $obj_id = is_home() ? '-1':$wp_query->get_queried_object_id();
     	    $wpfc_scripts_limit = get_option('wpfc_scripts_limit');
    @@ -67,7 +67,7 @@
     	    }
     	}
    
    -	function localize_script(){
    +	static function localize_script(){
     		$js_vars = array();
     		$js_vars['ajaxurl'] = admin_url('admin-ajax.php');
     		$js_vars['firstDay'] =  get_option('start_of_week');
    @@ -155,7 +155,7 @@
     	/**
     	 * Catches ajax requests by fullcalendar
     	 */
    -	function ajax(){
    +	static function ajax(){
     	    global $post;
     	    //sort out args
     	    unset($_REQUEST['month']); //no need for these two
    @@ -243,7 +243,7 @@
     	 * @param array $args
     	 * @return string
     	 */
    -	function calendar( $args = array() ){
    +	static function calendar( $args = array() ){
     		if (is_array($args) ) self::$args = array_merge(self::$args, $args);
     		self::$args['month'] = (!empty($args['month'])) ? $args['month']-1:date('m', current_time('timestamp'))-1;
     		self::$args['year'] = (!empty($args['year'])) ? $args['year']:date('Y', current_time('timestamp'));
    @@ -284,7 +284,7 @@
     	 * Run at wp_footer if a calendar is output earlier on in the page.
     	 * @uses self::$args - which was modified during self::calendar()
     	 */
    -	function footer_js(){
    +	static function footer_js(){
     		$r = array();
     		?>
     		<script type='text/javascript'>

Reply

You must log in to post.

About this Plugin

About this Topic

Tags