Support » Developing with WordPress » Cannot redeclare is_rtl

  • Help me out guys. I am working on Events Calendar plugin and I am getting an error with 3.0 and can’t figure it out. It has to do with trying to instantiate the WP_Locale.

    I was using $wp_locale = new WP_Locale() and getting this error.

    I tried using $wp_locale global but then I am getting error of it being a non-object when calling $wp_locale->get_weekday(0);

    Help me out.

Viewing 15 replies - 1 through 15 (of 63 total)
  • Sorry I should have been more clear. Check out development plugin at http://svn.wp-plugins.org/events-calendar/trunk

    Any suggestions?

    esmi

    (@esmi)

    Forum Moderator

    Might this have a better chance of a response if it was moved to WP-Advanced? I can move it for you, if you want.

    If you would move it for me, that would be great. Thanks.

    esmi

    (@esmi)

    Forum Moderator

    Consider it moved.

    Moderator Andrew Nacin

    (@nacin)

    Moderator Andrew Nacin

    (@nacin)

    In greater detail:

    In 2.9, we loaded locale.php using require_once. In 3.0, we standardized a few calls, including this one, to require. Thus, in 2.9, when the plugin included locale.php way too early (on immediate include, not even on a hook), WordPress let it ride as it was told to only include locale.php once, if it wasn’t included already.

    The fix would be to stop including locale.php the way the plugin does. It should be entirely unnecessary, though I admittedly haven’t looked deeply into the plugin.

    Alternatively, wait until the locale is already loaded before trying to do new WP_Locale. A plugin realistically should be waiting until the init hook for everything anyway — that would solve the problem here.

    Hi guys.

    I managed to get a quick work around to allow the calendar to load using WP 3.0 but when navigating months using the Large Calendar, it breaks the links for prev/next months.

    To fix the error:
    I removed the “require_once(ABSWPINCLUDE.’/locale.php’);” call on line 85 on events-calendar.php.
    Changed line 333’s add_action hook from ‘plugins_loaded’ to ‘init’

    Am investigating the navigation controls going missing.

    Ok just to follow up:

    To get the calendar to load correctly I needed to load the WP_Locale class in the actual EC_Calendar::__construct method.

    function __construct() {
    		require_once(ABSWPINCLUDE.'/locale.php');
    		$this->locale = new WP_Locale;
    	}

    This is working fine, but when clicking on the previous or next month link in the large calendar, the calendar updates fine but the jQuery functions are not being loaded correctly.

    Using Firebug, I can see that the GET request correctly pulls the data through, but the jQUery is being removed and as such, it does not load any extra events or loads the updated next and previous links. I am still investigating and will feedback any changes that I notice.

    I must also state that this is only for the large calendar in the front-end. The backend calendar is working correctly so far, but I am not sure about the listing of events or the sidebar widget, as these are elements of the plugin that we do not use.

    Ok so I have fixed the large calendar using the above techniques, and managed to solve the jQuery issue, by changing the html that was appended to the calendar.

    ecd.jq('#EC_previousMonthLarge')
    	.append("«&nbsp;<?php echo ucfirst($this->get_incrMonth($m-1));?>")
    	.mouseover(function() {
    		ecd.jq(this).css('cursor', 'pointer')
    		})
    	.live('click', function() {
    		ecd.jq('#EC_ajaxLoader').show('slow');
    		ecd.jq.get("<?php bloginfo('siteurl');?>/index.php",
            {EC_action: "switchMonthLarge", EC_month: "<?php echo $m-1;?>", EC_year: "<?php echo $y;?>"},
            function(ecdata) {
    			ecd.jq('#EC_ajaxLoader').hide('slow');
              	ecd.jq('#calendar_wrapLarge').empty().append( ecdata );
            });
          });
    
    ecd.jq('#EC_nextMonthLarge')
    	.prepend("<?php echo ucfirst($this->get_incrMonth($m+1));?>&nbsp;»")
    	.mouseover(function() {
    		ecd.jq(this).css('cursor', 'pointer')
    		})
    	.live('click', function() {
    		ecd.jq('#EC_ajaxLoader').show('slow');
    		ecd.jq.get("<?php bloginfo('siteurl');?>/index.php",
    			{EC_action: "switchMonthLarge", EC_month: "<?php echo $m+1;?>", EC_year: "<?php echo $y;?>"},
    			function(ecdata) {
    				ecd.jq('#EC_ajaxLoader').hide('slow');
    				ecd.jq('#calendar_wrapLarge').empty().append( ecdata );
    			});
    		});

    You will see that the append() function is changed from append(ecd.jq(ecdata).html()) to append( ecdata ) in both the functions and I changed the .click function to use the .live function.

    The above code starts around line 440 in ec_js.class.php.

    As mentioned above, these fixes work for the LargeCalendar, but I have not tested the widget or events list.

    I can confirm that byronrode’s patch does work for the sidebar events list on my 3.0 website. WP did give a non-fatal error when activating the modified plugin, but everything seems to work OK for now. Thanks a lot byronrode!

    Hello people, took a lot to get to this problem with in-calendar events, the
    wp update me Fatal error appeared in the wp-admin, after searching on
    internet plugins start to see that they had problems, and come to this plugin.
    I can do to return to ride this?

    Please I am not very expert in configuration, but telling me learn the steps

    byronrode thanks for all your help. I’m still having issues with the forward and backward in the large calendar display. Next month and last month work fine in the admin but on the site they get a NO COMMENTS page. I also get this error when activating the plug-in

    “The plugin generated 274 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.”

    Any ideas? Thanks again.
    corey@brassrailfw.com

    Byroncode, I’m the FWD /BCK also does not work for me.

    Hey guys – I will have a look tomorrow and see if I can come up with anything and also give a detailed patch fix providing the files that I have. This was commented on as I progressed through each step so it may not be 100% clear.

Viewing 15 replies - 1 through 15 (of 63 total)
  • The topic ‘Cannot redeclare is_rtl’ is closed to new replies.