| Yorumun Faydaları - Resimli analiz. | 180 Mesajlar | 46.585 Okunma | ||
function yorum_ekleme(){
	$yb_post_tipi = get_option('yb-post_tipi');
	if (is_singular( $yb_post_tipi ) && get_option('yb-otomatikekleme') == 1 ) {
		$yuzde = get_option('yb-yuzdesi');
		$tesaduf = rand(1,100);
			if ($tesaduf <= $yuzde) {
				$IPaddress=$_SERVER['REMOTE_ADDR'];
				$time = current_time('mysql');
				$postid = get_the_ID();
				//yazarlardan birini seçelim
				$yazarlar = explode(',', get_option('yb-yazarlar'));
				$yazarsayisi = count($yazarlar) - 1;
				$eklenecek_yazar = rand(0,$yazarsayisi);
				$yazar = trim($yazarlar[$eklenecek_yazar]);
				//yorumlardan birini seçelim
				$yorumlar = explode(PHP_EOL, get_option('yb-yorumlar'));
				$yorumsayisi = count($yorumlar) - 1;
				$eklenecek_yorum = rand(0,$yorumsayisi);
				//yorumda admin baslik vs varsa düzeltelim
				$categories = get_the_category();
				$ilkkategori = esc_html( $categories[0]->name );
				
				$gunler_sayi = array(0,1,2,3,4,5,6);
				$gunler_yazi = array("Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi");
				$gunbul = date("w");
				$gunbul = str_replace($gunler_sayi,$gunlar_yazi,$gunbul);
				
				$ozelalanlar = array('%%yazar%%','%%baslik%%','%%kategori%%','%%gun%%');
				$dogrualanlar = array( get_the_author(), get_the_title(), $ilkkategori, $gunbul);
				$yorum = str_replace($ozelalanlar, $dogrualanlar, $yorumlar[$eklenecek_yorum]);
				$data = array(
				    'comment_post_ID' => $postid,
				    'comment_author' => $yazar,
				    'comment_author_email' => 'yorumcu@gmail.com',
				    'comment_author_url' => 'http://',
				    'comment_content' => $yorum,
				    'comment_date' => $time,
				    'comment_approved' => 1,
					'comment_author_IP' => $IPaddress,
				);
				wp_insert_comment($data);
			}
	}
}
function yorum_ekleme(){
	$yb_post_tipi = get_option('yb-post_tipi');
	if (is_singular( $yb_post_tipi ) && get_option('yb-otomatikekleme') == 1 ) {
		$yuzde = get_option('yb-yuzdesi');
		$tesaduf = rand(1,100);
			if ($tesaduf <= $yuzde) {
				$IPaddress=$_SERVER['REMOTE_ADDR'];
				$time = current_time('mysql');
				$postid = get_the_ID();
				//yazarlardan birini seçelim
				$yazarlar = explode(',', get_option('yb-yazarlar'));
				$yazarsayisi = count($yazarlar) - 1;
				$eklenecek_yazar = rand(0,$yazarsayisi);
				$yazar = trim($yazarlar[$eklenecek_yazar]);
				//yorumlardan birini seçelim
				$yorumlar = explode(PHP_EOL, get_option('yb-yorumlar'));
				$yorumsayisi = count($yorumlar) - 1;
				$eklenecek_yorum = rand(0,$yorumsayisi);
				//yorumda admin baslik vs varsa düzeltelim
				$categories = get_the_category();
				$ilkkategori = esc_html( $categories[0]->name );
				
				$gunler_sayi = array(0,1,2,3,4,5,6);
				$gunler_yazi = array("Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi");
				$gunbul = date("w");
				$gunbul = str_replace($gunler_sayi,$gunlar_yazi,$gunbul);
				
				$ozelalanlar = array('%%yazar%%','%%baslik%%','%%kategori%%','%%gun%%');
				$dogrualanlar = array( get_the_author(), get_the_title(), $ilkkategori, $gunbul);
				$yorum = str_replace($ozelalanlar, $dogrualanlar, $yorumlar[$eklenecek_yorum]);
				$data = array(
				    'comment_post_ID' => $postid,
				    'comment_author' => $yazar,
				    'comment_author_email' => 'yorumcu@gmail.com',
				    'comment_author_url' => 'http://',
				    'comment_content' => $yorum,
				    'comment_date' => $time,
				    'comment_approved' => 1,
					'comment_author_IP' => $IPaddress,
				);
				wp_insert_comment($data);
			}
	}
}
function yorum_ekleme(){
	$yb_post_tipi = get_option('yb-post_tipi');
	if (is_singular( $yb_post_tipi ) && get_option('yb-otomatikekleme') == 1 ) {
		$yuzde = get_option('yb-yuzdesi');
		$tesaduf = rand(1,100);
			if ($tesaduf <= $yuzde) {
				$IPaddress=$_SERVER['REMOTE_ADDR'];
				$time = current_time('mysql');
				$postid = get_the_ID();
				//yazarlardan birini seçelim
				$yazarlar = explode(',', get_option('yb-yazarlar'));
				$yazarsayisi = count($yazarlar) - 1;
				$eklenecek_yazar = rand(0,$yazarsayisi);
				$yazar = trim($yazarlar[$eklenecek_yazar]);
				//yorumlardan birini seçelim
				$yorumlar = explode(PHP_EOL, get_option('yb-yorumlar'));
				$yorumsayisi = count($yorumlar) - 1;
				$eklenecek_yorum = rand(0,$yorumsayisi);
				//yorumda admin baslik vs varsa düzeltelim
				$categories = get_the_category();
				$ilkkategori = esc_html( $categories[0]->name );
				
				$gunler_sayi = array(0,1,2,3,4,5,6);
				$gunler_yazi = array("pazar","pazartesi","salı","çarşamba","perşembe","cuma","cumartesi");
				$gunbul = date("w");
				$gunbul = str_replace($gunler_sayi,$gunlar_yazi,$gunbul);
				
				$ozelalanlar = array('%%yazar%%','%%baslik%%','%%kategori%%','%%gun%%','%%rastgele%%','%%kim%%');
				$dogrualanlar = array( get_the_author(), get_the_title(), $ilkkategori, $gunbul, rand(0,100), $yazar);
				$yorum = str_replace($ozelalanlar, $dogrualanlar, $yorumlar[$eklenecek_yorum]);
				$data = array(
				    'comment_post_ID' => $postid,
				    'comment_author' => $yazar,
				    'comment_author_email' => 'yorumcu@gmail.com',
				    'comment_author_url' => 'http://',
				    'comment_content' => $yorum,
				    'comment_date' => $time,
				    'comment_approved' => 1,
					'comment_author_IP' => $IPaddress,
				);
				wp_insert_comment($data);
			}
	}
}