nemiroff Posted October 21, 2011 Report Share Posted October 21, 2011 Hi, viss notiek wordpresā, vajag izmainīt pluginā vienu lietu, ir widgets kuram "ejot" vai uzejot ar peles kursoru uz viņu, viņš paliek skaidrāks, te būs attēls: viņš tāds pelēcīgs, bet kad ar peli uziet paliek skaidrs attēls, vajag novākt to pelēcīgo nost, lai visu laiku rāda skaidru bildi, bez tā efekta. murgu jau te sarakstīju, bet gan jau sapratāt. Quote Link to comment Share on other sites More sharing options...
v3rb0 Posted October 21, 2011 Report Share Posted October 21, 2011 jāaizvieto visus <blink> ar <!-- <blink> --> un </blink> ar <!-- </blink> --> jeb es ne tā sapratu.. Quote Link to comment Share on other sites More sharing options...
nemiroff Posted October 21, 2011 Author Report Share Posted October 21, 2011 (edited) jāaizvieto visus <blink> ar <!-- <blink> --> un </blink> ar <!-- </blink> --> jeb es ne tā sapratu.. tajā kodā nevienā vietā nav blink, tas būs kāds cits. Edited October 21, 2011 by nemiroff Quote Link to comment Share on other sites More sharing options...
andism88 Posted October 21, 2011 Report Share Posted October 21, 2011 bļin! iedod kodu vai vismaz pasaki kas tas par widgetu... Quote Link to comment Share on other sites More sharing options...
nemiroff Posted October 21, 2011 Author Report Share Posted October 21, 2011 bļin! iedod kodu vai vismaz pasaki kas tas par widgetu... // Stop direct access of the file if(preg_match('#'.basename(__FILE__).'#',$_SERVER['PHP_SELF'])) die(); class PopularWidget extends WP_Widget { /** * Constructor * * @return void * @since 0.5.0 */ function PopularWidget() { ob_start(); //header sent problems if(!defined('POPWIDGET_URL')) define('POPWIDGET_URL',WP_PLUGIN_URL."/".plugin_basename(dirname(__FILE__))."/"); $this->version = "1.0.1"; $this->domain = "pop-wid"; $this->load_text_domain(); $this->functions = new PopularWidgetFunctions(); add_action('template_redirect',array(&$this,'set_post_view')); add_action('wp_enqueue_scripts',array(&$this,'load_scripts_styles')); $widget_ops = array('classname' => 'popular-widget','description' => __("Display most popular posts and tags",$this->domain)); $this->WP_Widget('popular-widget',__('Popular Widget',$this->domain),$widget_ops); } /** * Register localization/language file * * @return void * @since 0.5.0 */ function load_text_domain(){ if(function_exists('load_plugin_textdomain')){ $plugin_dir = basename(dirname(__FILE__)).'/langs/'; load_plugin_textdomain($this->domain,WP_CONTENT_DIR.'/plugins/'.$plugin_dir,$plugin_dir); } } /** * Load frontend js/css * * @return void * @since 0.5.0 */ function load_scripts_styles(){ if(is_admin()) return; wp_enqueue_style('popular-widget',POPWIDGET_URL.'_css/pop-widget.css',NULL,$this->version); wp_enqueue_script('popular-widget',POPWIDGET_URL.'_js/pop-widget.js',array('jquery'),$this->version,true); } /** * Display widget. * * @param array $args * @param array $instance * @return void * @since 0.5.0 */ function widget($args,$instance) { global $wpdb; extract($args); extract($instance); $instance['limit'] = ($limit) ? $limit : 5; $instance['days'] = ($lastdays) ? $lastdays : 365; $instance['imgsize']= ($imgsize)? $imgsize : 'thumbnail'; $instance['words'] = ($excerptlength) ? $excerptlength : 15; $posttypes = (empty($posttypes)) ? $posttypes = array('post'=>'on') : $posttypes; foreach($posttypes as $type => $val) $types[] = "'$type'"; $instance['types'] = implode(',',$types); if($cats){ $join = "INNER JOIN $wpdb->term_relationships tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tt.term_taxonomy_id = tr.term_taxonomy_id INNER JOIN $wpdb->terms t ON tt.term_id = t.term_id "; $where = "AND t.term_id IN (".trim($cats,',').") AND taxonomy = 'category'"; } $tabs = (!$nocommented && !$noviewed && !$notags && !$nocomments) ? ' class="pop-widget-tabs pop-tabs-all"': 'class="pop-widget-tabs"'; // start widget // $output = $before_widget."\n"; $output .= '<div class="pop-layout-v">'; $output .= '<ul id="pop-widget-tabs-'.$this->number.'"'.$tabs.'>'; if(!$nocomments) $output .= '<li><a href="#comments" rel="nofollow">'.__('<span>Recent</span> Comments',$this->domain).'</a></li>'; if(!$noviewed) $output .= '<li><a href="#viewed" rel="nofollow">'.__(' Apmeklētākie raksti šobrīd',$this->domain).'</a></li>'; if(!$nocommented) $output .= '<li><a href="#commented" rel="nofollow">'.__('Komentētākie',$this->domain).'</a></li>'; if(!$notags) $output .= '<li><a href="#tags" rel="nofollow">'.__('Tags',$this->domain).'</a></li>'; $output .= '</ul><div class="pop-inside-'.$this->number.' pop-inside">'; //most comments if(!$nocomments){ $output .= '<ul id="pop-widget-comments-'.$this->number.'">'; $output .= $this->functions->get_comments($instance); $output .= '</ul>'; } //most commented if(!$nocommented){ $output .= '<ul id="pop-widget-commented-'.$this->number.'">'; $output .= $this->functions->get_most_commented($instance); $output .= '</ul>'; } //most viewed if(!$noviewed){ $output .= '<ul id="pop-widget-viewed-'.$this->number.'">'; $output .= $this->functions->get_most_viewed($instance); $output .= '</ul>'; } //tags if(!$notags) $output .= wp_tag_cloud(array('smallest'=>'8','largest'=>'22','format'=>"list",'echo'=>false)); $output .= '<div class="pop-cl"></div></div></div>'; echo $output .= $after_widget."\n"; // end widget // } /** * Configuration form. * * @param array $instance * @return void * @since 0.5.0 */ function form($instance) { extract($instance); $calculate = (empty($calculate)) ? 'visits' : $calculate; $post_types = get_post_types(array('public'=>true),'names','and'); $posttypes = (empty($posttypes)) ? $posttypes = array('post'=>'on') : $posttypes; ?> <p> <label for="<?php echo $this->get_field_id('limit')?>"><?php _e('Show how many posts?',$this->domain)?> <input id="<?php echo $this->get_field_id('limit')?>" name="<?php echo $this->get_field_name('limit')?>" size="4" type="text" value="<?php echo $limit?>"/></label> </p> <p> <label for="<?php echo $this->get_field_id('cats')?>"><?php _e('In categories',$this->domain)?> <input id="<?php echo $this->get_field_id('cats')?>" name="<?php echo $this->get_field_name('cats')?>" size="20" type="text" value="<?php echo $cats?>"/></label><br /><small><?php _e('comma-separated category IDs',$this->domain)?> </small> </p> <p> <label for="<?php echo $this->get_field_id('lastdays')?>"><?php _e('In the last',$this->domain)?> <input id="<?php echo $this->get_field_id('lastdays')?>" name="<?php echo $this->get_field_name('lastdays')?>" size="4" type="text" value="<?php echo $lastdays?>"/> <?php _e('Days',$this->domain)?></label> </p> <p> <label for="<?php echo $this->get_field_id('imgsize')?>"><?php _e('Image Size',$this->domain)?> <select id="<?php echo $this->get_field_id('imgsize') ?>" name="<?php echo $this->get_field_name('imgsize') ?>"> <?php foreach( get_intermediate_image_sizes() as $size):?> <option value="<?php echo $size?>" <?php selected($size,$imgsize)?>><?php echo $size?></option> <?php endforeach;?> </select> </label> </p> <p> <label for="<?php echo $this->get_field_id('counter')?>"><input id="<?php echo $this->get_field_id('counter')?>" name="<?php echo $this->get_field_name('counter')?>" type="checkbox" <?php echo($counter)?'checked="checked"':''; ?> /> <?php _e('Display count',$this->domain)?></label><br /> <label for="<?php echo $this->get_field_id('thumb')?>"><input id="<?php echo $this->get_field_id('thumb')?>" name="<?php echo $this->get_field_name('thumb')?>" type="checkbox" <?php echo($thumb)?'checked="checked"':''; ?> /> <?php _e('Display thumbnail',$this->domain)?></label><br /> <label for="<?php echo $this->get_field_id('excerpt')?>"><input id="<?php echo $this->get_field_id('excerpt')?>" name="<?php echo $this->get_field_name('excerpt')?>" type="checkbox" <?php echo($excerpt)?'checked="checked"':''; ?> /> <?php _e('Display post excerpt',$this->domain)?></label> </p> <p> <label for="<?php echo $this->get_field_id('excerptlength')?>"><?php _e('Excerpt length',$this->domain)?> <input id="<?php echo $this->get_field_id('excerptlength')?>" name="<?php echo $this->get_field_name('excerptlength')?>" size="5" type="text" value="<?php echo $excerptlength?>"/> <?php _e('Words',$this->domain)?></label> </p> <p> <label for="<?php echo $this->get_field_id('tlength')?>"><?php _e('Title length',$this->domain)?> <input id="<?php echo $this->get_field_id('tlength')?>" name="<?php echo $this->get_field_name('tlength')?>" size="4" type="text" value="<?php echo $tlength?>"/> <?php _e('characters',$this->domain)?></label> </p> <p> <?php _e('Calculate:',$this->domain)?><br /> <label for="<?php echo $this->get_field_id('calculate-views')?>"><input id="<?php echo $this->get_field_id('calculate-views')?>" name="<?php echo $this->get_field_name('calculate')?>" value="views" type="radio" <?php checked($calculate,'views') ?> /> <abbr title="Every time the user views the page"><?php _e('Views',$this->domain)?></abbr></label> <label for="<?php echo $this->get_field_id('calculate-visits')?>"><input id="<?php echo $this->get_field_id('calculate-visits')?>" name="<?php echo $this->get_field_name('calculate')?>" value="visits" type="radio" <?php checked($calculate,'visits') ?> /> <abbr title="Every time the user visits the site"><?php _e('Visits',$this->domain)?></abbr></label> </p> <p> <label><?php _e('Post Types:',$this->domain)?></label><br /> <?php foreach ($post_types as $post_type) { ?> <label for="<?php echo $this->get_field_id($post_type)?>"><input id="<?php echo $this->get_field_id($post_type)?>" name="<?php echo $this->get_field_name('posttypes')."[$post_type]"?>" type="checkbox" <?php echo($posttypes[$post_type])?'checked="checked"':''; ?> /> <?php echo $post_type?></label><br /> <?php }?> </p> <p><?php _e('Disable:',$this->domain)?><br /> <label for="<?php echo $this->get_field_id('nocomments')?>"><input id="<?php echo $this->get_field_id('nocomments')?>" name="<?php echo $this->get_field_name('nocomments')?>" type="checkbox" <?php echo($nocomments)?'checked="checked"':''; ?> /> <?php _e('Recent Comments',$this->domain)?></label><br /> <label for="<?php echo $this->get_field_id('nocommented')?>"><input id="<?php echo $this->get_field_id('nocommented')?>" name="<?php echo $this->get_field_name('nocommented')?>" type="checkbox" <?php echo($nocommented)?'checked="checked"':''; ?> /> <?php _e('Most Commented',$this->domain)?></label><br /> <label for="<?php echo $this->get_field_id('noviewed')?>"><input id="<?php echo $this->get_field_id('noviewed')?>" name="<?php echo $this->get_field_name('noviewed')?>" type="checkbox" <?php echo($noviewed)?'checked="checked"':''; ?> /> <?php _e('Most Viewed',$this->domain)?></label><br /> <label for="<?php echo $this->get_field_id('notags')?>"><input id="<?php echo $this->get_field_id('notags')?>" name="<?php echo $this->get_field_name('notags')?>" type="checkbox" <?php echo($notags)?'checked="checked"':''; ?> /> <?php _e('Tags',$this->domain)?></label> </p> <a href="http://xparkmedia.com/popular-widget/"><?php _e('New! Popular Widget Pro',$this->domain)?></a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8SJEQXK5NK4ES"><?php _e('Donate',$this->domain)?></a> <?php } /** * Add postview count. * * @return void * @since 0.5.0 */ function set_post_view( ) { global $post; $widgets = get_option($this->option_name); $instance = $widgets[$this->number]; if((is_single() || is_page() || is_singular) && $instance['calculate'] == 'visits'){ if(!isset($_COOKIE['popular_views_'.COOKIEHASH]) && setcookie("pop-test", "1", time() + 360)){ update_post_meta($post->ID,'_popular_views',get_post_meta($post->ID,'_popular_views',true)+1); setcookie('popular_views_'.COOKIEHASH,"$post->ID|",0,COOKIEPATH); }else{ $views = explode("|",$_COOKIE['popular_views_'.COOKIEHASH]); foreach($views as $post_id) if($post->ID == $post_id) $exist = true; if(!$exist){ $views[] = $post->ID; update_post_meta($post->ID,'_popular_views',get_post_meta($post->ID,'_popular_views',true)+1); setcookie('popular_views_'.COOKIEHASH,implode("|",$views),0,COOKIEPATH); } } }elseif(is_single() || is_page() || is_singular){ update_post_meta($post->ID,'_popular_views',get_post_meta($post->ID,'_popular_views',true)+1); } } /** * Limit the words in a string * * @param string $string * @param unit $word_limit * @return string * @since 0.5.0 */ function limit_words($string, $word_limit){ $words = explode(" ",$string); return implode(" ",array_splice($words,0,$word_limit)); } } include(dirname(__FILE__)."/include.php"); add_action('widgets_init',create_function('','return register_widget("PopularWidget");')); ?> Quote Link to comment Share on other sites More sharing options...
andism88 Posted October 21, 2011 Report Share Posted October 21, 2011 css failaa pop-widget.css izmaini šo div.pop-inside ul li { opacity:.6 } vai nu pret opacity:1 vai nu vispār noņem... (78.rindiņa css failā) Quote Link to comment Share on other sites More sharing options...
nemiroff Posted October 21, 2011 Author Report Share Posted October 21, 2011 (edited) css failaa pop-widget.css izmaini šo div.pop-inside ul li { opacity:.6 } vai nu pret opacity:1 vai nu vispār noņem... (78.rindiņa css failā) Noņēmu vispār un viss ir tā kā tam jābūt. Paldies Tev! Edited October 21, 2011 by nemiroff Quote Link to comment Share on other sites More sharing options...
daGrevis Posted October 21, 2011 Report Share Posted October 21, 2011 Phe, tik daudz koda tik mazam efektam. :( Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.