emo_vote = $wpdb->prefix .'emo'; if($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->emo_vote}'") != $wpdb->emo_vote) $wpdb->query("CREATE TABLE {$wpdb->emo_vote} ( id int(10) NOT NULL auto_increment, post_ID int(10) NOT NULL, vote_0 int(10) NOT NULL default '0', vote_1 int(10) NOT NULL default '0', vote_2 int(10) NOT NULL default '0', vote_3 int(10) NOT NULL default '0', vote_4 int(10) NOT NULL default '0', vote_total int(10) NOT NULL default '0', PRIMARY KEY (id) ) "); add_option(EMO_OPTIONS, array( 'titles' => '0:Berbat#1:Idare#2:Fena Değil#3:Izlenir#4:Harika', 'list' => 1, 'total' => 1 ) ); } register_activation_hook(__FILE__,'emo_install'); function emo_vote_init() { global $wpdb; $wpdb->emo_vote = $wpdb->prefix .'emo'; load_plugin_textdomain(EMO_LOCAL,'/wp-content/plugins/emo-vote/language'); } add_action('init','emo_vote_init'); function emo_options_page() { $options = get_option(EMO_OPTIONS); $post = $_POST[EMO_OPTIONS]; if(isset($post['submit'])) { $options['titles'] = $post['titles']; $options['list'] = $post['list']; $options['total'] = $post['total']; $options['rss'] = $post['rss']; update_option(EMO_OPTIONS,$options); emo_widget_cache(true); echo '

'. __('Options Updated',EMO_LOCAL) .'

'; } $options['titles'] = split('#',$options['titles']); ?>

' : '

'. $question .'

'; if($options['list'] > 0) $values = $wpdb->get_row($wpdb->prepare("SELECT CONCAT(round(vote_0/vote_total*100,0),'%') as vote_0, CONCAT(round(vote_1/vote_total*100,0),'%') as vote_1, CONCAT(round(vote_2/vote_total*100,0),'%') as vote_2, CONCAT(round(vote_3/vote_total*100,0),'%') as vote_3, CONCAT(round(vote_4/vote_total*100,0),'%') as vote_4, vote_total FROM {$wpdb->emo_vote} WHERE post_ID = %d",$post_id),ARRAY_A); else $values = $wpdb->get_row($wpdb->prepare("SELECT vote_0, vote_1, vote_2, vote_3, vote_4, vote_total FROM {$wpdb->emo_vote} WHERE post_ID = %d",$post_id),ARRAY_A); if(is_emo()) $disabled = 'disabled="disabled" '; foreach ($titles as $title) { list($key, $val) = split(':', $title); if ($_COOKIE['emo_vote-'. $post_id] == $key) $checked = 'checked="checked" '; $value = ($values['vote_'. $key]) ? $values['vote_'. $key] : (($options['list'] > 0) ? '0%' : '0'); $return .= ''; $return .= ' '; $return .= '('. $value .')'; $checked = null; } if($options['total'] > 0) { $total = $values['vote_total'] > 1 ? str_replace('%',$values['vote_total'],$more) : ($values['vote_total'] == 1 ? $one : $zero); $return .= '
'. $total .'
'; } $return .= '
'; if(is_single() && !is_emo() && strlen($vote) > 0) $return .= ''; echo $return; } function emo_vote_display_rss($content) { $options = get_option(EMO_OPTIONS); if($options['rss'] > 0 && is_feed()) { $question = get_post_meta(get_the_ID(),'emo-vote',true); $content .= '

'; $content .= (!$question) ? '' : $question .'

'; $permalink = (!get_option('permalink_structure')) ? get_permalink(get_the_ID()) . '&' : get_permalink(get_the_ID()) . '?'; $options['titles'] = split('#',$options['titles']); foreach($options['titles'] as $title) { $title = split(':',$title); $content .= ''. $title[1] .'? '; } $content .= '

'; } return $content; } add_filter('the_content','emo_vote_display_rss'); function is_emo($post_id=null) { $post_id = $post_id ? $post_id : get_the_ID(); // Determines whether a user already has emoted or not. return isset($_COOKIE['emo_vote-'. $post_id]) ? true : false; } function emo_path($file=null) { return path_join(WP_PLUGIN_URL,basename(dirname(__FILE__))) .'/'. $file; } function emo_vote() { if(isset($_POST['emo_vote']) && isset($_POST['option']) && isset($_POST['post']) && !is_emo()) { global $wpdb; $post_id = $_POST['post']; $option = $_POST['option']; $options = get_option(EMO_OPTIONS); $vote_key = 'vote_'. $option; // Insert a row for the post first when a user emotes. if(!$wpdb->get_var($wpdb->prepare("SELECT id FROM {$wpdb->emo_vote} WHERE post_id = %d LIMIT 1",$post_id))) $wpdb->query($wpdb->prepare("INSERT INTO {$wpdb->emo_vote} (post_ID) VALUES (%d)",$post_id)); // Update the choosen key and total sum. $results = $wpdb->get_row($wpdb->prepare("SELECT {$vote_key},vote_total FROM {$wpdb->emo_vote} WHERE post_ID = %d",$post_id),ARRAY_A); $vote_val = intval($results[$vote_key]); $vote_total = intval($results['vote_total']); ++$vote_val; ++$vote_total; if($wpdb->query($wpdb->prepare("UPDATE {$wpdb->emo_vote} SET {$vote_key} = %d,vote_total = %d WHERE post_ID = %d LIMIT 1",$vote_val,$vote_total,$post_id))) { // Thanks to Stephen Cronin for solving the setcookie probs: http://www.scratch99.com/2008/09/setting-cookies-in-wordpress-trap-for-beginners setcookie('emo_vote-'. $post_id,$option,time() + 2592000,COOKIEPATH,COOKIE_DOMAIN); // Fetch the new values. if($options['list'] > 0) $return = $wpdb->get_row($wpdb->prepare("SELECT CONCAT(round(vote_0/vote_total*100,0),'%') as vote_0, CONCAT(round(vote_1/vote_total*100,0),'%') as vote_1, CONCAT(round(vote_2/vote_total*100,0),'%') as vote_2, CONCAT(round(vote_3/vote_total*100,0),'%') as vote_3, CONCAT(round(vote_4/vote_total*100,0),'%') as vote_4, vote_total FROM {$wpdb->emo_vote} WHERE post_ID = %d",$post_id),ARRAY_A); else $return = $wpdb->get_row($wpdb->prepare("SELECT vote_0, vote_1, vote_2, vote_3, vote_4, vote_total FROM {$wpdb->emo_vote} WHERE post_ID = %d",$post_id),ARRAY_A); echo $_POST['callback'] .'('. json_encode(array('response' => array('status' => 200, 'numbers' => $return))) .')'; } else { echo $_POST['callback'] .'('. json_encode(array('response' => array('status' => 500, 'numbers' => null))) .')'; } // End ajax-request. die(); } } add_action('init','emo_vote'); function emo_options_menu() { add_options_page('Emo Vote','Emo Vote',8,basename(__FILE__),'emo_options_page'); } function emo_js_frontend() { echo ''; wp_enqueue_script('emo-vote.php',emo_path('emo-vote-user.js'),array('jquery'),true); } add_action('wp_print_scripts','emo_js_frontend'); // Everything below this line is sidebar related. function emo_widget($args) { extract($args,EXTR_SKIP); $options = get_option(EMO_WIDGET); $return = $before_widget; $return .= $before_title; $return .= $options['title'] ? $options['title'] : __('Emo Vote',EMO_LOCAL); $return .= $after_title; $return .= emo_widget_cache(); $return .= $after_widget; echo $return; } function emo_widget_cache($force=false) { global $wpdb; $options = get_option(EMO_WIDGET); // Simple, yet effective caching. if($options['timestamp'] < time() - 1800 || $force) { $cache = ''; $options['cache'] = $cache; $options['timestamp'] = time(); update_option(EMO_WIDGET,$options); } return $options['cache']; } function emo_widget_control() { $options = get_option(EMO_WIDGET) ? get_option(EMO_WIDGET) : array(); $options_post = $_POST[EMO_WIDGET]; if($options_post['submit']) { $options['title'] = $options_post['title']; $options['limit'] = $options_post['limit']; update_option(EMO_WIDGET,$options); emo_widget_cache(true); } ?>

bolumseyret.com, dizi izle, dizi seyret, dizi video, canli dizi, izle, online dizi izle, dizi film izle, diziler, diziizle, tv dizileri.
Sponsor Reklam
sag
Yeni Eklenenler
Sensizliğe Alışacağım film
Tarih : 25 Mart 2013
İzlenme : 213
Gölgesr film
Tarih : 25 Mart 2013
İzlenme : 135
Etiketler :
Savaşçının Yolu Filmini
Tarih : 25 Mart 2013
İzlenme : 257
Hiç Korkmuyorum Türkçe Dublaj
Tarih : 25 Mart 2013
İzlenme : 148
Harry Potter ve Melez Prens
Tarih : 25 Mart 2013
İzlenme : 325
Etiketler :
Katyn Katliamı Filmi Türkçe Dublaj
Tarih : 25 Mart 2013
İzlenme : 116
Etiketler :
Aşk Kliniği 2012 Türkçe Dublaj
Tarih : 25 Mart 2013
İzlenme : 136
Sessiz
Tarih : 25 Mart 2013
İzlenme : 120
Etiketler :
Tehlikeli Takip Film
Tarih : 25 Mart 2013
İzlenme : 136
Etiketler :
Operasyon Valkyrie Film
Tarih : 25 Mart 2013
İzlenme : 130
Etiketler :
Büyük Şüphe Türkçe Dublaj
Tarih : 25 Mart 2013
İzlenme : 288
Spiderwick Günceleri Film
Tarih : 25 Mart 2013
İzlenme : 124
Etiketler :
Boyun Eğmeyeceğim Türkçe Dublaj
Tarih : 25 Mart 2013
İzlenme : 113
BBC Hiroshima
Tarih : 25 Mart 2013
İzlenme : 142
Etiketler :
Paris
Tarih : 25 Mart 2013
İzlenme : 142
Etiketler :
9 Rota
Tarih : 25 Mart 2013
İzlenme : 157
Etiketler :
En Çok İzlenenler
Arthur ile Minimoylar
Tarih : 25 Mart 2013
İzlenme : 344
Etiketler :
Harry Potter ve Melez Prens
Tarih : 25 Mart 2013
İzlenme : 325
Etiketler :
Büyük Şüphe Türkçe Dublaj
Tarih : 25 Mart 2013
İzlenme : 288
Savaşçının Yolu Filmini
Tarih : 25 Mart 2013
İzlenme : 257
Sensizliğe Alışacağım film
Tarih : 25 Mart 2013
İzlenme : 213
9 Rota
Tarih : 25 Mart 2013
İzlenme : 157
Etiketler :
Hiç Korkmuyorum Türkçe Dublaj
Tarih : 25 Mart 2013
İzlenme : 148
Paris
Tarih : 25 Mart 2013
İzlenme : 142
Etiketler :
BBC Hiroshima
Tarih : 25 Mart 2013
İzlenme : 142
Etiketler :
Aşk Kliniği 2012 Türkçe Dublaj
Tarih : 25 Mart 2013
İzlenme : 136
Tehlikeli Takip Film
Tarih : 25 Mart 2013
İzlenme : 136
Etiketler :
Gölgesr film
Tarih : 25 Mart 2013
İzlenme : 135
Etiketler :
Operasyon Valkyrie Film
Tarih : 25 Mart 2013
İzlenme : 130
Etiketler :
Spiderwick Günceleri Film
Tarih : 25 Mart 2013
İzlenme : 124
Etiketler :
Sessiz
Tarih : 25 Mart 2013
İzlenme : 120
Etiketler :
Boyun Eğmeyeceğim Türkçe Dublaj
Tarih : 25 Mart 2013
İzlenme : 116
escort bayanescort bayan istanbulescort bayanescort bayan istanbulescort bayanescort bayan istanbulescort bayanescort bayan istanbul