Changeset 1031720
- Timestamp:
- 11/24/2014 12:27:35 PM (11 years ago)
- Location:
- afables/trunk
- Files:
-
- 5 edited
-
afables.php (modified) (2 diffs)
-
inc/afables-install.php (modified) (1 diff)
-
inc/afables-widget.php (modified) (6 diffs)
-
js/afables-widget.js (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
afables/trunk/afables.php
r940105 r1031720 2 2 /* 3 3 Plugin Name: Afables 4 Plugin URI: http://wordpress.org/plugins/afables/5 4 Description: Widget para wordpress de Afables 6 5 Author: OhayoWeb 7 6 Author URI: http://www.ohayoweb.com/ 8 Version: 0.17 Version: 1.3 9 8 */ 10 9 11 10 12 define('AFABLES_PLUGIN_VERSION',' 0.1');11 define('AFABLES_PLUGIN_VERSION','1.3'); 13 12 define('AFABLES_USERAGENT','Afables Wordpress Plugin '.AFABLES_PLUGIN_VERSION); 14 13 … … 26 25 define('AFABLES_RSS_CHANNEL', 'http://www.afables.com/rss/rsschannel'); 27 26 28 define('AFABLES_CACHE_FOLDER',plugin_dir_path( __FILE__ ).' /cache');29 define('AFABLES_CACHE_DURATION', '21600'); # 6 horas // 2160027 define('AFABLES_CACHE_FOLDER',plugin_dir_path( __FILE__ ).'cache'); 28 define('AFABLES_CACHE_DURATION',21600); # 6 horas // 21600 30 29 31 30 /** Load languages **/ -
afables/trunk/inc/afables-install.php
r936600 r1031720 5 5 function afables_activate(){ 6 6 7 $notices= get_option('afables_admin_notices', array()); 8 7 9 // AFABLES_CACHE_FOLDER 8 9 10 if(!file_exists(AFABLES_CACHE_FOLDER)){ 10 11 // creamos el directorio 11 if(mkdir(AFABLES_CACHE_FOLDER,0777)) 12 echo 'Directorio creado'; 13 else echo 'Error'; 12 if(mkdir(AFABLES_CACHE_FOLDER,0777)){ 13 $notices[]= "<div class='updated'><p>Directorio cache creado con éxito.</p></div>"; 14 15 }else{ 16 $notices[]= "<div class='error'><p>No se pudo crear el directorio <strong>".AFABLES_CACHE_FOLDER."</strong>.</p><p>Necesitara crearlo manualmente para el correcto funcionamiento del plugin.</p></div>"; 17 } 14 18 15 19 } 16 20 21 update_option('afables_admin_notices', $notices); 17 22 } 18 23 24 25 add_action ('admin_notices' , 'afables_notices'); 26 27 function afables_notices(){ 28 29 if ($notices = get_option('afables_admin_notices')) { 30 foreach ($notices as $notice) { 31 //echo "<div class='updated'><p>$notice</p></div>"; 32 echo $notice; 33 } 34 delete_option('afables_admin_notices'); 35 } 36 37 } 19 38 ?> -
afables/trunk/inc/afables-widget.php
r936600 r1031720 6 6 class Afables_Widget extends WP_Widget { 7 7 8 static $instances=array(); 9 8 10 public function __construct() { 9 11 … … 20 22 } 21 23 24 public function add_options_to_script(){ 25 //If there is data to add, add it 26 //wp_localize_script( 'my_script', 'my_var', self::$variables); 27 wp_localize_script('afables-widget', 'afablesObject', self::$instances ); 28 29 } 30 22 31 public function widget( $args, $instance ) { 23 32 … … 28 37 endif; 29 38 30 wp_enqueue_script('jquery'); 31 32 //wp_enqueue_script( 'afables-widget', plugins_url( '../js/afables-widget.js' , __FILE__ ), array('jquery'), AFABLES_PLUGIN_VERSION ,true ); 39 //wp_enqueue_script('jquery'); 40 41 wp_register_script( 'afables-widget', plugins_url( '../js/afables-widget.js' , __FILE__ ), array('jquery'), AFABLES_PLUGIN_VERSION ,true ); 42 //$translation_array = array(); 43 //$idInstance = array ('widgetId' => $this->id); 44 //$translation_array[] = $idInstance; 45 //wp_localize_script('afables-widget', 'afablesObject', $translation_array ); 46 47 add_action('wp_footer', array(__CLASS__, 'add_options_to_script')); 48 49 wp_enqueue_script('afables-widget'); 50 51 $id = $this->id; 52 self::$instances[$id] = '#'. $this->id; 53 33 54 34 55 $before_texto = '<div class="afables-wrapper-widget">'; … … 107 128 108 129 109 <?php include(plugin_dir_path( __FILE__ ).'../js/afables-widget-js.php'); ?>130 <?php //include(plugin_dir_path( __FILE__ ).'../js/afables-widget-js.php'); ?> 110 131 111 132 … … 202 223 <select class="widefat" id="<?php echo $this->get_field_id( 'channel' ); ?>" name="<?php echo $this->get_field_name( 'channel' ); ?>"> 203 224 <?php $channels = $this->load_feed(AFABLES_RSS_CHANNEL);?> 204 <option value="none" <?php echo ( $channel == 'none') ? $selected : null ?>><?php _e('All', 'afables');?></option>225 <option value="none" <?php echo (!$channels) ? $selected : null ?>><?php _e('All', 'afables');?></option> 205 226 206 227 <?php foreach ($channels as $key => $item): ?> … … 264 285 public function load_feed($url){ 265 286 266 //include_once plugin_dir_path( __FILE__ ).' load_SimplePie.php';267 require ABSPATH . WPINC . '/class-simplepie.php';287 //include_once plugin_dir_path( __FILE__ ).'../rss-robot/inc/load_SimplePie.php'; 288 include_once plugin_dir_path( __FILE__ ).'load_SimplePie.php'; 268 289 269 290 $channel_feed = new SimplePie(); -
afables/trunk/js/afables-widget.js
r936600 r1031720 2 2 3 3 var active = 0; // starts at zero 4 var list = $('ul.afables-result');5 4 5 var list = []; 6 6 var filter = ''; 7 7 8 list.children('.afables-result li').eq('0').siblings().hide(); // Hide all except first list element 8 $.each(afablesObject, function( index, value ) { 9 list[index] = $(value+' ul.afables-result'); 10 list[index].children(value +' .afables-result li'+filter).eq('0').siblings().hide(); // Hide all except first list element 11 }); 12 13 $.each(list, function( index, value ) { 14 console.log(index); 15 }); 16 9 17 10 $('.afables-wrapper-widget input[name=type]').bind('click', function(){ 11 filter = $('.afables-wrapper-widget input[name=type]:checked').val(); 12 //list = $('ul.afables-result li.'+filter); 13 //list.children('.afables-result li.'+filter).eq('0').siblings().hide(); 18 $.each(afablesObject, function( index, value ) { 19 20 $(value+' .afables-wrapper-widget input[name=type]').bind('click', function(){ 21 filter[index] = $(value+' .afables-wrapper-widget input[name=type]:checked').val(); 22 list[index].children(value+' .afables-result li'+filter[index]).eq('0').siblings().hide(); 23 active = 0; 24 }); 25 26 $(value+' .afables-next').bind('click', function(event) { 27 event.preventDefault(); 28 active = active == list[index].children(value+' .afables-result li'+filter[index]).length-1 ? 0 : active + 1; 29 }); 30 31 $(value+' .afables-previous').bind('click', function(event) { 32 event.preventDefault(); 33 active = active == 0 ? list[index].children(value+' .afables-result li'+filter[index]).length-1 : active - 1; 34 }); 35 36 37 38 $(value+' .afables-previous,'+ value +' .afables-next,'+ value +' .afables-wrapper-widget input[name=type]').bind('click', function() { 39 getActive(index,value).show().siblings().hide(); 40 }); 41 42 $(value +" .afables-wrapper-widget a[rel='afable']").click(function () { 43 var caracteristicas = "titlebar=no,toolbar=no,location=no,status=no,menubar=no,height=500,width=1000,scrollTo,resizable=1,scrollbars=1,location=0"; 44 nueva=window.open(this.href, 'Afable Single', caracteristicas); 45 return false; 46 }); 47 48 $(value +" .afables-wrapper-widget button.view-details").click(function () { 49 url = $(this).attr('rel'); 50 var caracteristicas = "titlebar=no,toolbar=no,location=no,status=no,menubar=no,height=500,width=1000,scrollTo,resizable=1,scrollbars=1,location=0"; 51 nueva=window.open(url, 'Afable Single', caracteristicas); 52 return false; 53 }); 14 54 15 55 }); 16 56 17 $('.afables-next').bind('click', function(event) { 18 event.preventDefault(); 19 active = active == list.children('.afables-result li').length-1 ? 0 : active + 1; 20 }); 21 22 $('.afables-previous').bind('click', function(event) { 23 event.preventDefault(); 24 active = active == 0 ? list.children('.afables-result li').length-1 : active - 1; 25 }); 26 27 var getActivebyFilter = function() { 28 filter = $('.afables-wrapper-widget input[name=type]:checked').val(); 29 return list.children('.afables-result li.'+filter).eq(active); 57 58 var getActive = function(index,value) { 59 return list[index].children(value+' .afables-result li'+filter).eq(active); 30 60 }; 31 61 32 var getActive = function() { 33 return list.children('.afables-result li').eq(active); 34 }; 62 35 63 36 $('.afables-previous,.afables-next,.afables-wrapper-widget input[name=type]').bind('click', function() {37 if (filter == '') getActive().show().siblings().hide();38 else getActivebyFilter().show().siblings().hide();39 //getActive().fadeIn().siblings().fadeOut();40 });41 42 $(".afables-wrapper-widget a[rel='afable']").click(function () {43 var caracteristicas = "height=500,width=800,scrollTo,resizable=1,scrollbars=1,location=0";44 nueva=window.open(this.href, 'Afable Single', caracteristicas);45 return false;46 });47 64 48 $(".afables-wrapper-widget button.view-details").click(function () {49 url = $(this).attr('rel');50 var caracteristicas = "height=500,width=800,scrollTo,resizable=1,scrollbars=1,location=0";51 nueva=window.open(url, 'Afable Single', caracteristicas);52 return false;53 });54 65 55 66 }); -
afables/trunk/readme.txt
r940107 r1031720 3 3 Tags: afables, feed, widget, sidebar, city, channel 4 4 Requires at least: 3.7.1 5 Tested up to: 3. 7.15 Tested up to: 3.9.1 6 6 License: GPLv2 or later 7 Stable tag: 1.3 7 8 8 9 == Description == … … 44 45 == Changelog == 45 46 47 = 1.3 = 48 * Fixed an error loading multiple instances of the widget on the same page. 49 * Removed an additional slash in the rss address. 50 * Fixed an error when jQuery is loaded in the footer. 51 46 52 = 0.1 = 47 53 * Released
Note: See TracChangeset
for help on using the changeset viewer.