Twitter for Wordpress 1.9.7 by Ricardo González. Author: Alexander Hofbauer Author URI: http://derhofbauer.at/blog */ /* Copyright 2007 Ricardo González Castro (rick[in]jinlabs.com) * Copyright 2010 Alexander Hofbauer 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 */ define('MAGPIE_CACHE_ON', 1); //2.7 Cache Bug define('MAGPIE_CACHE_AGE', 180); define('MAGPIE_INPUT_ENCODING', 'UTF-8'); define('MAGPIE_OUTPUT_ENCODING', 'UTF-8'); if (!class_exists("AJAXedTwitter")) { class AJAXedTwitter { private static $default_options = array( 'title' => 'Tweets', 'username' => '', 'num' => 5, 'list' => true, 'update' => true, 'linked' => '#', 'hyperlinks' => true, 'twitter-users' => true, 'encode-utf8' => false, 'error-id' => 'twitter-error', 'retries' => 2, 'animate' => true ); private static $option_fields = array( 'title' => array('label' => 'Title', 'type' => 'text'), 'username' => array('label' => 'Username', 'type' => 'text'), 'num' => array('label' => 'Number of links', 'type' => 'text'), 'list' => array('label' => 'Ouput as unordered list', 'type' => 'checkbox'), 'update' => array('label' => 'Show timestamps', 'type' => 'checkbox'), 'linked' => array('label' => 'Linked', 'type' => 'text'), 'hyperlinks' => array('label' => 'Discover Hyperlinks', 'type' => 'checkbox'), 'twitter-users' => array('label' => 'Discover @replies', 'type' => 'checkbox'), 'encode-utf8' => array('label' => 'UTF8 Encode', 'type' => 'checkbox'), 'error-id' => array('label' => 'Error ID', 'type' => 'text'), 'retries' => array('label' => 'Retries', 'type' => 'text'), 'animate' => array('label' => 'Animate', 'type' => 'checkbox') ); /** * Widget function */ public static function widget($args) { $path = get_bloginfo('wpurl').self::plugin_path(); $options = self::get_options(); ?> '; echo $args['after_widget']; } /** * Marges default options and saved ones * @return array of current options */ public static function get_options() { $options = get_option('AJAXedTwitter'); if (is_array($options)) { $options = array_merge(self::$default_options, get_option('AJAXedTwitter')); } else { $options = self::$default_options; } return $options; } public static function widget_control() { $options = self::get_options(); if (is_admin() && $_POST['AJAXedTwitter-title']) { foreach ($options as $option => $value) { if ($option == 'linked') { // linked is a hybrid and can be false or a string $options['linked'] = ($_POST['AJAXedTwitter-linked'] === '') ? false : $_POST['AJAXedTwitter-linked']; continue; } if (self::$option_fields[$option]['type'] == 'checkbox') { $options[$option] = (isset($_POST['AJAXedTwitter-'.$option])) ? true : false; } else { $options[$option] = $_POST['AJAXedTwitter-'.$option]; } } update_option('AJAXedTwitter', $options); } echo '
| '; echo ' | '; echo ' |