Forum Replies Created

Viewing 15 replies - 106 through 120 (of 122 total)
  • Thread Starter justmattb

    (@mwbarker)

    I think this has to do with the old auto update feature this plugin first used (updated from Joe Tan’s site). I think that if you add this to your wp-config.php file, you should be good:

    define('TANTAN_AUTOUPDATE_NOTIFY', false);

    I’m still waiting to verify on my end, but I think that should do the trick.

    Thread Starter justmattb

    (@mwbarker)

    Anybody? This is by far the best WP Flickr plugin around and I would hate to have to move on to something else.

    Thread Starter justmattb

    (@mwbarker)

    This is what I did to get that working (be aware that I also modified the output format to meet my needs):

    <?php
    /*
    Plugin Name: Google Calendar Feed Parser
    Plugin URI: https://jmbennett.org/2008/06/21/google-calendar-feed-parser/
    Description: Parses a Google Calendar XML feed for display in the sidebar of your blog.
    Version: 0.3
    Author: Justin Bennett
    Author URI: https://jmbennett.org
    */
    
    /*  Copyright 2008  Justin M. Bennett  (email : [email protected])
    
        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 St, Fifth Floor, Boston, MA  02110-1301  USA
    */
    
    //Hook for adding admin menu
    add_action("admin_menu", "gcal_add_menus");
    
    function gcal_add_menus() {
      //add_submenu_page("settings.php", "Google Calendar Feed Parser", "Google Calendar", 10,
      //"gcal_parser", "gcal_display_menu");
    
      add_options_page("Google Calendar Feed Parser", "Google Calendar", 10, "gcal_admin", "gcal_display_menu");
    }
    
    /**
     * gcal_display_menu - Displays the admin menu
     */
    function gcal_display_menu() {
    $option = get_option('gcal_static_url_option');
    ?>
    
    <form action="options.php" method="post">
    <div class="wrap">
    	<h2>Google Calendar Feed Parser Settings</h2>
    	<?php wp_nonce_field('update-options'); ?>
    	<p class="submit"><input type="submit" name="Submit" value="Save Changes" /></p>
    	<table class="form-table">
    		<tr>
    			<th scope="row" valign="top">Feed URL:</th>
    			<td>
    			<input type="text" name="gcal_feed_url" value="<?php echo get_option('gcal_feed_url'); ?>" style="width: 600px" />
    			<br />The URL for the Google Calendar Feed. Don't specify a "max-results" parameter in your query string,
    			instead, set it below.</td>
    		</tr>
    		<tr>
    			<th scope="row" valign="top">Static URL?:</th>
    			<td>
    			<select name="gcal_static_url_option">
    				<option value="0" <?php echo ($option == 0) ? 'selected="selected"' : ''; ?>>No</option>
    				<option value="1" <?php echo ($option == 1) ? 'selected="selected"' : ''; ?>>Yes</option>
    			</select>
    			<input type="text" name="gcal_static_url" value="<?php echo get_option('gcal_static_url'); ?>" style="width: 300px" />
    			<br />If set to "Yes", the plugin will link to the static url you provide for each calendar event.
    				  If set to "No", the plugin will link to the event's URL from the feed.</td>
    		</tr>
    		<tr>
    			<th scope="row" valign="top">Max Results:</th>
    			<td>
    			<input type="text" name="gcal_max_results" value="<?php echo get_option('gcal_max_results'); ?>" style="width: 20px" />
    			<br />The maximum number of events to retrieve and display.  If left blank, the default is 4.</td>
    		</tr>
    		<tr>
    			<th scope="row" valign="top">Timezone offset:</th>
    			<td>
    			<input type="text" name="gcal_timezone_offset" value="<?php echo get_option('gcal_timezone_offset'); ?>" style="width: 70px" /> seconds
    			<br />Offset to apply to start and end times from XML feed (default: 7200 seconds).  Only change if you're having problems with times not displaying correctly.</td>
    		</tr>
    		<tr>
    			<th scope="row" valign="top">No Events Message:</th>
    			<td>
    			<input type="text" name="gcal_message" value="<?php echo get_option('gcal_message'); ?>" style="width: 600px" />
    			<br />Message to display if there are no events returned.</td>
    		</tr>
    	</table>
    	<input type="hidden" name="action" value="update" />
    	<input type="hidden" name="page_options" value="gcal_feed_url,gcal_static_url_option,gcal_static_url,gcal_max_results,gcal_timezone_offset,gcal_message" />
    	<p class="submit">
    	<input type="submit" name="Submit" class="button" value="Save Changes" />
    	</p>
    </div>
    </form>
    
    <?php
    }
    
    /**
     * gcal_parse_feed - Main function parses and displays the calendar feed
     */
    function gcal_parse_feed() {
    	$feed_url = get_option('gcal_feed_url');
    	$feed_url .= '&max-results=' . (( get_option('gcal_max_results') == '' ) ? '4' : get_option('gcal_max_results'));
    
    	$xmlstr = wp_remote_fopen($feed_url);
    	$static_url = get_option('gcal_static_url_option');
    
    	$xml = new SimpleXMLElement($xmlstr);
    	$count = 0;
    	echo '<ul>';
    	foreach($xml->entry as $entry) {
    		$count = $count + 1;
    		echo '<li>';
    
    		$gd = $entry->children('https://schemas.google.com/g/2005');
    
    		$event_link = $entry->link->attributes()->href;
    
    		if ( $static_url ) {
    			echo '<strong><a href="' . get_option('gcal_static_url') . '">' . $entry->title . "</a></strong>\n";
    		}
    		else {
    			echo '<strong><a href="' . $event_link  . '" target="_blank">' . $entry->title . "</a></strong>\n";
    		}
    
    		if (($offset = get_option('gcal_timezone_offset')) == '')
    		   $offset = 7200;
    
    		$start = date("l, F j @ g:ia", strtotime($gd->when->attributes()->startTime) + $offset);
    		$end = date("g:ia", strtotime($gd->when->attributes()->endTime) + $offset);
    
    		echo "<p class='event_time'>$start</p></li>";
    	}
    	if ($count == 0) {
    		echo '<li>'.get_option('gcal_message').'</li>';
    	}
    	echo '</ul>';
    }
    ?>

    Thread Starter justmattb

    (@mwbarker)

    Hated the styling, too; not sure why it would be done this way instead of strictly by the designer. I changed the plugin a bit so that it displays the events in an unordered list, and has a message if there are no events. I’ll paste it here in case anybody else is interested. (I also commented out the CSS/DIV boxes in the widget config).

    <?php
    /*
    Plugin Name: upc0ming
    Plugin URI: https://www.ads-software.com/#
    Description: list upcoming events on a publicly accessible google calendar
    Author: Oliver C Dodd
    Version: 1.0.0
    Author URI: https://01001111.net
    
      Copyright (c) 2009 Oliver C Dodd - https://01001111.net
    
      Much of the functionality is taken from the free 01001111 library
    
      *NOTE: your calendar must be publicly viewable
    
      Permission is hereby granted,free of charge,to any person obtaining a
      copy of this software and associated documentation files (the "Software"),
      to deal in the Software without restriction,including without limitation
      the rights to use,copy,modify,merge,publish,distribute,sublicense,
      and/or sell copies of the Software,and to permit persons to whom the
      Software is furnished to do so,subject to the following conditions:
    
      The above copyright notice and this permission notice shall be included in
      all copies or substantial portions of the Software.
    
      THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR
      IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER
      LIABILITY,WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING
      FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      DEALINGS IN THE SOFTWARE.
    */
    class upc0ming
    {
    	/*-VARIABLES----------------------------------------------------------*/
    	private $user;
    	public $title;
    	private $eventcount;
    	private $divid;
    	private $css;
    
    	const DEFAULT_CSS = '
    #upc0ming {
    	padding:5px 20px 5px 20px;
    }
    .upc0mingEvent {
    	font-family:Times New Roman;
    	min-height:80px;
    	height:auto !important;
    	height:80px;
    }
    .upc0mingEvent:after {
    	display: block;
    	height:0px;
    	clear:right;
    	content:" ";
    }
    .upc0mingEvent .calEntry {
    	position:relative;
    	float:left;
    	width:50px;
    	text-align:center;
    	border:solid black 2px;
    	margin:3px 3px 10px 10px;
    	pading-right:10px;
    }
    .upc0mingEvent .calEntry .calYear {
    	color:#FFFFFF;
    	background-color:#000000;
    	font-size:8px;
    	line-height:8px;
    	padding-left:7px;
    	letter-spacing:7px;
    }
    .upc0mingEvent .calEntry .calMonth {
    	color:#000000;
    	background-color:#b0b0b0;
    	font-size:11px;
    	line-height:12px;
    	letter-spacing:5px;
    	padding-left:5px;
    	font-weight:bold;
    }
    .upc0mingEvent .calEntry .calDay {
    	color:#000000;
    	background-color:#f0f0f0;
    	font-size:24px;
    	line-height:24px;
    	font-weight:bold;
    }
    .upc0mingEvent .calEntry .calTime {
    	color:#000000;
    	background-color:#ffffff;
    	font-size:9px;
    	line-height:10px;
    }
    .upc0mingEvent .event {
    	position:relative;
    	clear:right;
    	padding:10px 0 0 10px;
     }
    .upc0mingEvent .event .eventWhat {
    	font-size:1.2em;
    	font-weight:bold;
    }
    .upc0mingEvent .event .eventWhere {
    	color:#404040;
    	font-size:1em;
    	font-style:italic;
    }';
    
    	/*-CONSTRUCT----------------------------------------------------------*/
    	//public function __construct($u,$t="upc0ming",$d="")
    	public function upc0ming($u,$t="upc0ming",$c="",$d="",$css="")
    	{
    		$this->user	= $u;
    		$this->title	= $t;
    		$this->eventcount = $c;
    		$this->divid	= $d;
    		$this->css	= $css;
    	}
    
    	private function url()
    	{
    		return "https://www.google.com/calendar/feeds/$this->user".
    			"/public/full/?futureevents=true";
    	}
    
    	private function get($url)
    	{
    		return @file_get_contents($url);
    	}
    
    	private function queryString($args)
    	{
    		if (!is_array($args))
    			return $args;
    		$pairs = "";
    		foreach ($args as $k => $v)
    			$pairs[] = "$k=$v";
    		return implode('&',$pairs);
    	}
    
    	/*-EVENTS-------------------------------------------------------------*/
    	public function getEvents($futureOnly=true)
    	{
    		$xml = $this->get($this->url());
    		$doc = new DOMDocument();
    		if (!$xml||!$doc->loadXML($xml)) return array();
    
    		$events = array();
    		$entries = $doc->getElementsByTagName('entry');
    		foreach ($entries as $event) {
    			$author = $event->getElementsByTagName('author')->item(0);
    			$when = $event->getElementsByTagName('when')->item(0);
    			$start = $when->getAttribute('startTime');
    			$events[] = array(
    				'who'		=> $this->tagValue($author,'name'),
    				'what'		=> $this->tagValue($event,'title'),
    				'info'		=> $this->tagValue($event,'content'),
    				'where'		=> $this->attributeValue($event,
    							'where','valueString'),
    				'when'		=> $start,
    				'start'		=> $start,
    				'end'		=> $when->getAttribute('endTime'),
    				'timestamp'	=> strtotime($start),
    				'link'		=> $this->attributeValue($event,
    							'link','href',
    							array('rel'=>'alternate'))
    			);
    
    		}
    		return $events;
    	}
    
    	/*-XML PARSING SPECIFICS----------------------------------------------*/
    	public function tagValue($node,$tag,$requiredAttributes=array(),$valueIfNoChild=false)
    	{
    		if (!$requiredAttributes) {
    			$children = $node->getElementsByTagName($tag);
    			return $children->length
    				? $children->item(0)->nodeValue
    				: ($valueIfNoChild ? $node->nodeValue : "");
    		}
    		//get tags
    		$tags = $node->getElementsByTagName($tag);
    		//check attributes
    		$element = false;
    		for ($i = 0; $i < $tags->length; $i++) {
    			$found = true;
    			foreach ($requiredAttributes as $k => $v)
    				$found &= strcasecmp($tags->item($i)->getAttribute($k),$v) == 0;
    			if ($found) {
    				$element = $tags->item($i);
    				break;
    			}
    		}
    		return $element ? $element->nodeValue : "";
    	}
    
    	private function attributeValue($node,$tag,$attribute,$requiredAttributes=array())
    	{
    		if (!$requiredAttributes) {
    			$children = $node->getElementsByTagName($tag);
    			return $children->length
    				? $children->item(0)->getAttribute($attribute)
    				: "";
    		}
    		//get tags
    		$tags = $node->getElementsByTagName($tag);
    		//check attributes
    		$element = false;
    		for ($i = 0; $i < $tags->length; $i++) {
    			$found = true;
    			foreach ($requiredAttributes as $k => $v)
    				$found &= strcasecmp($tags->item($i)->getAttribute($k),$v) == 0;
    			if ($found) {
    				$element = $tags->item($i);
    				break;
    			}
    		}
    		return $element ? $element->getAttribute($attribute) : "";
    	}
    
    	/*-GET OPTIONS--------------------------------------------------------*/
    	public static function getOptions()
    	{
    		return !($options = get_option('upc0ming'))
    			? $options = array(
    				'user'		=> "",
    				'title'		=> "upc0ming",
    				'eventcount'=> "",
    				'divid'		=> "",
    				'css'		=> self::DEFAULT_CSS)
    			: $options;
    	}
    
    	/*-MAKE OPTIONS-------------------------------------------------------*/
    	public function makeOptions($a,$s="")
    	{
    		$options = "";
    		foreach ($a as $o) {
    			$sel = $o == $s ? " selected='selected' " : "";
    			$options .= "<option$sel>$o</o>";
    		}
    		return $options;
    	}
    
    	/*-OUTPUT EVENTS------------------------------------------------------*/
    	public function outputEvents()
    	{
    		$events = $this->getEvents();
    		$html = "<style type='text/css'>$this->css</style>";
    		$totalevents = count($events);
    		$max = $this->eventcount;
    		if ($totalevents <= 0) {
    			$html .= "<li><em>No upcoming events scheduled...</em></li>";
    		}
    		$html .= "<ul>";
    		if ($totalevents > $max) {
    			$i=0;
    			foreach ($events as $event) {
    				if ($i<$max) {
    					$t = $event['timestamp'];
    					$y = date('Y',$t);
    					$m = strtoupper(date('M',$t));
    					$d = date('j',$t);
    					$ts = date('g:i a',$t);
    					$html .= "
    						<li>$m $d, $y, $ts<br />
    						<a href='{$event['link']}'>{$event['what']}</a><br />
    						{$event['where']}
    						</li>";
    				}
    				$i++;
    			}
    		} else {
    			foreach ($events as $event) {
    				$t = $event['timestamp'];
    				$y = date('Y',$t);
    				$m = strtoupper(date('M',$t));
    				$d = date('j',$t);
    				$ts = date('g:i a',$t);
    
    				$html .= "
    					<li>$m $d, $y, $ts<br />
    					<a href='{$event['link']}'>{$event['what']}</a><br />
    					{$event['where']}
    					</li>";
    			}
    		}
    		$html .= "</ul>";
    		return $html;
    	}
    }
    /*-OPTIONS--------------------------------------------------------------------*/
    function widget_upc0ming_options()
    {
    	$options = upc0ming::getOptions();
    	if($_POST['upc0ming-submit'])
    	{
    		$options = array(	'user'	=> $_POST['upc0ming-user'],
    					'title'	=> $_POST['upc0ming-title'],
    					'eventcount' => $_POST['upc0ming-eventcount'],
    					'divid'	=> $_POST['upc0ming-divid'],
    					'css'	=> $_POST['upc0ming-css']);
    		update_option('upc0ming',$options);
    	}
    	?>
    	<p>	Google Calendar User / ID:
    		<input	type="text"
    			name="upc0ming-user"
    			id="upc0ming-user"
    			value="<?php echo $options['user']; ?>"  />
    	</p>
    	<p>	Title:
    		<input	type="text"
    			name="upc0ming-title"
    			id="upc0ming-title"
    			value="<?php echo $options['title']; ?>"  />
    	</p>
    	<p>	Count (# of events to show):
    		<input	type="text"
    			name="upc0ming-eventcount"
    			id="upc0ming-eventcount"
    			value="<?php echo $options['eventcount']; ?>"  />
    	</p>
    	<!--><p>	Wrapper Div ID (blank for no div):
    		<input	type="text"
    			name="upc0ming-divid"
    			id="upc0ming-divid"
    			value="<?php echo $options['divid']; ?>"  />
    	</p>
    	<p>	CSS (blank if you want to add it to your theme css, defaults provided):
    		<br />
    		<textarea
    			name="upc0ming-css"
    			id="upc0ming-css"
    			cols="40"
    			rows="20"><?php echo $options['css']; ?></textarea>
    	</p>-->
    	<input type="hidden" id="upc0ming-submit" name="upc0ming-submit" value="1" />
    	<?php
    }
    /*-WIDGETIZE------------------------------------------------------------------*/
    function widget_upc0ming_init()
    {
    	if (!function_exists('register_sidebar_widget')) { return; }
    	function widget_upc0ming($args)
    	{
    		extract($args);
    		$options = upc0ming::getOptions();
    		$u = new upc0ming(	$options['user'],
    					$options['title'],
    					$options['eventcount'],
    					$options['divid'],
    					$options['css']);
    		echo "	$before_widget
    			$before_title $u->title $after_title
    				{$u->outputEvents()}
    			$after_widget
    		";
    	}
    	register_sidebar_widget('upc0ming','widget_upc0ming');
    	register_widget_control('upc0ming','widget_upc0ming_options');
    }
    add_action('plugins_loaded', 'widget_upc0ming_init');
    ?>
    Thread Starter justmattb

    (@mwbarker)

    Looks like this does work with Google apps after all; my sharing config didn’t save like I thought it had. As for specific number of events, I modified the plugin to include this functionality. I am no PHP guru, but it does work.

    <?php
    /*
    Plugin Name: upc0ming
    Plugin URI: https://www.ads-software.com/#
    Description: list upcoming events on a publicly accessible google calendar
    Author: Oliver C Dodd
    Version: 1.0.0
    Author URI: https://01001111.net
    
      Copyright (c) 2009 Oliver C Dodd - https://01001111.net
    
      Much of the functionality is taken from the free 01001111 library
    
      *NOTE: your calendar must be publicly viewable
    
      Permission is hereby granted,free of charge,to any person obtaining a
      copy of this software and associated documentation files (the "Software"),
      to deal in the Software without restriction,including without limitation
      the rights to use,copy,modify,merge,publish,distribute,sublicense,
      and/or sell copies of the Software,and to permit persons to whom the
      Software is furnished to do so,subject to the following conditions:
    
      The above copyright notice and this permission notice shall be included in
      all copies or substantial portions of the Software.
    
      THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND,EXPRESS OR
      IMPLIED,INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER
      LIABILITY,WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE,ARISING
      FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      DEALINGS IN THE SOFTWARE.
    */
    class upc0ming
    {
    	/*-VARIABLES----------------------------------------------------------*/
    	private $user;
    	public $title;
    	private $eventcount;
    	private $divid;
    	private $css;
    
    	const DEFAULT_CSS = '
    #upc0ming {
    	padding:5px 20px 5px 20px;
    }
    .upc0mingEvent {
    	font-family:Times New Roman;
    	min-height:80px;
    	height:auto !important;
    	height:80px;
    }
    .upc0mingEvent:after {
    	display: block;
    	height:0px;
    	clear:right;
    	content:" ";
    }
    .upc0mingEvent .calEntry {
    	position:relative;
    	float:left;
    	width:50px;
    	text-align:center;
    	border:solid black 2px;
    	margin:3px 3px 10px 10px;
    	pading-right:10px;
    }
    .upc0mingEvent .calEntry .calYear {
    	color:#FFFFFF;
    	background-color:#000000;
    	font-size:8px;
    	line-height:8px;
    	padding-left:7px;
    	letter-spacing:7px;
    }
    .upc0mingEvent .calEntry .calMonth {
    	color:#000000;
    	background-color:#b0b0b0;
    	font-size:11px;
    	line-height:12px;
    	letter-spacing:5px;
    	padding-left:5px;
    	font-weight:bold;
    }
    .upc0mingEvent .calEntry .calDay {
    	color:#000000;
    	background-color:#f0f0f0;
    	font-size:24px;
    	line-height:24px;
    	font-weight:bold;
    }
    .upc0mingEvent .calEntry .calTime {
    	color:#000000;
    	background-color:#ffffff;
    	font-size:9px;
    	line-height:10px;
    }
    .upc0mingEvent .event {
    	position:relative;
    	clear:right;
    	padding:10px 0 0 10px;
     }
    .upc0mingEvent .event .eventWhat {
    	font-size:1.2em;
    	font-weight:bold;
    }
    .upc0mingEvent .event .eventWhere {
    	color:#404040;
    	font-size:1em;
    	font-style:italic;
    }';
    
    	/*-CONSTRUCT----------------------------------------------------------*/
    	//public function __construct($u,$t="upc0ming",$d="")
    	public function upc0ming($u,$t="upc0ming",$c="",$d="",$css="")
    	{
    		$this->user	= $u;
    		$this->title	= $t;
    		$this->eventcount = $c;
    		$this->divid	= $d;
    		$this->css	= $css;
    	}
    
    	private function url()
    	{
    		return "https://www.google.com/calendar/feeds/$this->user".
    			"/public/full/?futureevents=true";
    	}
    
    	private function get($url)
    	{
    		return @file_get_contents($url);
    	}
    
    	private function queryString($args)
    	{
    		if (!is_array($args))
    			return $args;
    		$pairs = "";
    		foreach ($args as $k => $v)
    			$pairs[] = "$k=$v";
    		return implode('&',$pairs);
    	}
    
    	/*-EVENTS-------------------------------------------------------------*/
    	public function getEvents($futureOnly=true)
    	{
    		$xml = $this->get($this->url());
    		$doc = new DOMDocument();
    		if (!$xml||!$doc->loadXML($xml)) return array();
    
    		$events = array();
    		$entries = $doc->getElementsByTagName('entry');
    		foreach ($entries as $event) {
    			$author = $event->getElementsByTagName('author')->item(0);
    			$when = $event->getElementsByTagName('when')->item(0);
    			$start = $when->getAttribute('startTime');
    			$events[] = array(
    				'who'		=> $this->tagValue($author,'name'),
    				'what'		=> $this->tagValue($event,'title'),
    				'info'		=> $this->tagValue($event,'content'),
    				'where'		=> $this->attributeValue($event,
    							'where','valueString'),
    				'when'		=> $start,
    				'start'		=> $start,
    				'end'		=> $when->getAttribute('endTime'),
    				'timestamp'	=> strtotime($start),
    				'link'		=> $this->attributeValue($event,
    							'link','href',
    							array('rel'=>'alternate'))
    			);
    
    		}
    		return $events;
    	}
    
    	/*-XML PARSING SPECIFICS----------------------------------------------*/
    	public function tagValue($node,$tag,$requiredAttributes=array(),$valueIfNoChild=false)
    	{
    		if (!$requiredAttributes) {
    			$children = $node->getElementsByTagName($tag);
    			return $children->length
    				? $children->item(0)->nodeValue
    				: ($valueIfNoChild ? $node->nodeValue : "");
    		}
    		//get tags
    		$tags = $node->getElementsByTagName($tag);
    		//check attributes
    		$element = false;
    		for ($i = 0; $i < $tags->length; $i++) {
    			$found = true;
    			foreach ($requiredAttributes as $k => $v)
    				$found &= strcasecmp($tags->item($i)->getAttribute($k),$v) == 0;
    			if ($found) {
    				$element = $tags->item($i);
    				break;
    			}
    		}
    		return $element ? $element->nodeValue : "";
    	}
    
    	private function attributeValue($node,$tag,$attribute,$requiredAttributes=array())
    	{
    		if (!$requiredAttributes) {
    			$children = $node->getElementsByTagName($tag);
    			return $children->length
    				? $children->item(0)->getAttribute($attribute)
    				: "";
    		}
    		//get tags
    		$tags = $node->getElementsByTagName($tag);
    		//check attributes
    		$element = false;
    		for ($i = 0; $i < $tags->length; $i++) {
    			$found = true;
    			foreach ($requiredAttributes as $k => $v)
    				$found &= strcasecmp($tags->item($i)->getAttribute($k),$v) == 0;
    			if ($found) {
    				$element = $tags->item($i);
    				break;
    			}
    		}
    		return $element ? $element->getAttribute($attribute) : "";
    	}
    
    	/*-GET OPTIONS--------------------------------------------------------*/
    	public static function getOptions()
    	{
    		return !($options = get_option('upc0ming'))
    			? $options = array(
    				'user'		=> "",
    				'title'		=> "upc0ming",
    				'eventcount'=> "",
    				'divid'		=> "",
    				'css'		=> self::DEFAULT_CSS)
    			: $options;
    	}
    
    	/*-MAKE OPTIONS-------------------------------------------------------*/
    	public function makeOptions($a,$s="")
    	{
    		$options = "";
    		foreach ($a as $o) {
    			$sel = $o == $s ? " selected='selected' " : "";
    			$options .= "<option$sel>$o</o>";
    		}
    		return $options;
    	}
    
    	/*-OUTPUT EVENTS------------------------------------------------------*/
    	public function outputEvents()
    	{
    		$events = $this->getEvents();
    		$html = "<style type='text/css'>$this->css</style>";
    		$totalevents = count($events);
    		$max = $this->eventcount;
    		if ($totalevents > $max) {
    			$i=0;
    			foreach ($events as $event) {
    				if ($i<$max) {
    					$t = $event['timestamp'];
    					$y = date('Y',$t);
    					$m = strtoupper(date('M',$t));
    					$d = date('j',$t);
    					$ts = date('g:i a',$t);
    					$html .= "
    						<div class='upc0mingEvent'>
    							<div class='calEntry'>
    								<div class='calYear'>$y</div>
    								<div class='calMonth'>$m</div>
    								<div class='calDay'>$d</div>
    								<div class='calTime'>$ts</div>
    							</div>
    							<div class='event'>
    								<div class='eventWhat'>{$event['what']}</div>
    								<div class='eventWhere'>{$event['where']}</div>
    							</div>
    						</div>";
    				}
    				$i++;
    			}
    			return $html;
    		} else {
    			foreach ($events as $event) {
    				$t = $event['timestamp'];
    				$y = date('Y',$t);
    				$m = strtoupper(date('M',$t));
    				$d = date('j',$t);
    				$ts = date('g:i a',$t);
    
    				$html .= "
    				<div class='upc0mingEvent'>
    					<div class='calEntry'>
    						<div class='calYear'>$y</div>
    						<div class='calMonth'>$m</div>
    						<div class='calDay'>$d</div>
    						<div class='calTime'>$ts</div>
    					</div>
    					<div class='event'>
    						<div class='eventWhat'>{$event['what']}</div>
    						<div class='eventWhere'>{$event['where']}</div>
    					</div>
    				</div>";
    			}
    			return $html;
    		}
    	}
    }
    /*-OPTIONS--------------------------------------------------------------------*/
    function widget_upc0ming_options()
    {
    	$options = upc0ming::getOptions();
    	if($_POST['upc0ming-submit'])
    	{
    		$options = array(	'user'	=> $_POST['upc0ming-user'],
    					'title'	=> $_POST['upc0ming-title'],
    					'eventcount' => $_POST['upc0ming-eventcount'],
    					'divid'	=> $_POST['upc0ming-divid'],
    					'css'	=> $_POST['upc0ming-css']);
    		update_option('upc0ming',$options);
    	}
    	?>
    	<p>	Google Calendar User / ID:
    		<input	type="text"
    			name="upc0ming-user"
    			id="upc0ming-user"
    			value="<?php echo $options['user']; ?>"  />
    	</p>
    	<p>	Title:
    		<input	type="text"
    			name="upc0ming-title"
    			id="upc0ming-title"
    			value="<?php echo $options['title']; ?>"  />
    	</p>
    	<p>	Count (# of events to show):
    		<input	type="text"
    			name="upc0ming-eventcount"
    			id="upc0ming-eventcount"
    			value="<?php echo $options['eventcount']; ?>"  />
    	</p>
    	<p>	Wrapper Div ID (blank for no div):
    		<input	type="text"
    			name="upc0ming-divid"
    			id="upc0ming-divid"
    			value="<?php echo $options['divid']; ?>"  />
    	</p>
    	<p>	CSS (blank if you want to add it to your theme css, defaults provided):
    		<br />
    		<textarea
    			name="upc0ming-css"
    			id="upc0ming-css"
    			cols="40"
    			rows="20"><?php echo $options['css']; ?></textarea>
    	</p>
    	<input type="hidden" id="upc0ming-submit" name="upc0ming-submit" value="1" />
    	<?php
    }
    /*-WIDGETIZE------------------------------------------------------------------*/
    function widget_upc0ming_init()
    {
    	if (!function_exists('register_sidebar_widget')) { return; }
    	function widget_upc0ming($args)
    	{
    		extract($args);
    		$options = upc0ming::getOptions();
    		$u = new upc0ming(	$options['user'],
    					$options['title'],
    					$options['eventcount'],
    					$options['divid'],
    					$options['css']);
    		echo "	$before_widget
    			$before_title $u->title $after_title
    				{$u->outputEvents()}
    			$after_widget
    		";
    	}
    	register_sidebar_widget('upc0ming','widget_upc0ming');
    	register_widget_control('upc0ming','widget_upc0ming_options');
    }
    add_action('plugins_loaded', 'widget_upc0ming_init');
    ?>

    Definitely not a plug and play calendar. While it has some great functionality, you need to be prepared to do some serious theme coding to get this to work like a normal calendar (front end). Using the code above, you can output a line-by-line listing of events, but most people are looking for a nice calendar type format with some styling, etc. This plugin has a ways to go.

    It really is too bad that there are NO good calendars for WordPress. Seriously… How long as WordPress been around? And no decent calendars?

    Edit the events-calendar.php file, by replacing the function EventsCalendarINIT() with this:

    function EventsCalendarINIT() {
        $inadmin = FALSE;
        if (function_exists('is_admin')) {
            $inadmin = is_admin();
        }
        else {
            $inadmin = strstr($svr_uri, 'wp-admin');
        }
    
        if (!$inadmin) {
            wp_enqueue_script('jquerybgiframe', '/wp-content/plugins/events-calendar/js/jquery.bgiframe.js', array('jquery'), '2.1');
            wp_enqueue_script('jquerydimensions', '/wp-content/plugins/events-calendar/js/jquery.dimensions.js', array('jquery'), '1.0b2');
            wp_enqueue_script('jquerytooltip', '/wp-content/plugins/events-calendar/js/jquery.tooltip.min.js', array('jquery'), '1.3');
            wp_enqueue_script('thickbox');
        }
    
        // Always register both the widget and widget control objects
        // in case there are dependencies between the two.
         $widget = new EC_Widget();
         $management = new EC_Management();
         register_sidebar_widget(__('Events Calendar','events-calendar'), array(&$widget, 'display'));
         register_widget_control(__('Events Calendar','events-calendar'), array(&$management, 'widgetControl'));
    }

    Found in the plugin bug tracker here:
    https://tracker.wp-eventscalendar.com/view.php?id=79

    Not sure about you guys, but the problem is not just with installing the widget for this plugin, but trying to do anything with any of the widgets once this plugin is installed. Once I activate the plugin in 2.8.4, I can no longer manage any widgets. It would be nice to get this fixed so this plugin is useful again…

    Thanks! That fix worked perfect.

    Ahh… I found it. Using phpMyAdmin, do a search for the old path. One of the results should come back to a value in “wp_options”. Once you find that, edit it to show the correct path. This should be something that is corrected by the developers, though.

    I get the exact same thing (I moved hosts, though). I even disabled the plugin, deleted the folder, re-uploaded the plugin, activated it…. Still the same thing. Anybody have any ideas? It looks like the old information is being stored somewhere, but I can’t find where…

    **TAKE NOTE**
    Once you do this, you will need to go into the Freshy Theme Options and set your options again. Before you start, you should check what your settings are and copy them down.

    Now, if you really want this theme to work, this is what you need to do:

    Around line 283, you will see this block:

    /*
    
    	if (get_option('freshy_options')) {
    		$freshy_options = get_option('freshy_options');
    	}
    	else {
    		$freshy_options=$freshy_theme_default;
    		update_option('freshy_options', $freshy_options);
    	}
    	*/
    	if (get_option('freshy_options')) {
    		$existing_options = get_option('freshy_options');
    		foreach ($freshy_theme_default as $key=>$val) {
    			$freshy_options[$key]=$val;
    		}
    		foreach ($existing_options as $key=>$val) {
    			$freshy_options[$key]=$val;
    		}
    	}
    	else {
    		$freshy_options=$freshy_theme_default;
    		update_option('freshy_options', $freshy_options);
    	}

    Change that to this:

    if (get_option('freshy_options')) {
    		$freshy_options = get_option('freshy_options');
    	}
    	else {
    		$freshy_options=$freshy_theme_default;
    		update_option('freshy_options', $freshy_options);
    	}
    
    	/*
    	if (get_option('freshy_options')) {
    		$existing_options = get_option('freshy_options');
    		foreach ($freshy_theme_default as $key=>$val) {
    			$freshy_options[$key]=$val;
    		}
    		foreach ($existing_options as $key=>$val) {
    			$freshy_options[$key]=$val;
    		}
    	}
    	else {
    		$freshy_options=$freshy_theme_default;
    		update_option('freshy_options', $freshy_options);
    	}
    	*/

    Basically, you are uncommenting out the first “if” statement and commenting out the second “if” statement.

    **TAKE NOTE**
    Now, go back into the Freshy Theme Options and set everything back up how you want it. That should fix it; at least it did for me with my update to WordPress 2.2.2

    Any idea how to fix this, then?
    function yy_widget_links($args) {
    global $wpdb;
    $title = empty($options['title']) ? __('Links') : $options['title'];

    $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
    ?>
    <h2><?php echo $before_widget.$before_title.$title.$after_title; ; ?></h2>
    <ul>
    <?php
    foreach ($link_cats as $link_cat) {
    ?>
    <li id="linkcat-<?php echo $link_cat->cat_id; ?>"><?php echo $link_cat->cat_name; ?>
    <ul>
    <?php wp_get_links($link_cat->cat_id); ?>
    </ul>
    </li>
    <?php } ?>
    </ul>
    <?php
    }

    Thread Starter justmattb

    (@mwbarker)

    Otto42 – The Google AdSense widget (and text widget) was working just fine for me. I was setting it up at work and had forgotten that Google AdSense stuff is blocked by Websense here. Turns out it was working just fine! Again – thanks for the help with the Flickr code!

    Thread Starter justmattb

    (@mwbarker)

    MichaelH – That is where the code came from; I just modified it a touch to get rid of all the “flickr” stuff. Even the original code was not showing up, though.

    Otto42 – That worked like a charm. Thanks! I will have to find out why the line inserts are being inserted. All I have been doing from both flickr and Google Adsense is copying and pasting directly from the sites into the text bar.

Viewing 15 replies - 106 through 120 (of 122 total)