Archive for the ‘Проргамчлал’ Category

<?php
/*

Plugin Name: cp1251 to utf8 Mongolian cryllic

*/
function cp1251_utf8($word)
{
$cyr_lower_chars = array(
‘е’,’щ’,’ф’,’ц’,’у’,’ж’,’э’,
‘н’,’г’,’ш’,’ү’,’з’,’к’,’ъ’,
‘й’,’ы’,’б’,’ө’,’а’,’х’,’р’,
‘о’,’л’,’д’,’п’,’я’,’ч’,’ё’,
‘с’,’м’,’и’,’т’,’ь’,’в’,’ю’,);

$latin_lower_chars = array(
‘å’,’ù’,’ô’,’ö’,’ó’,’æ’,’ý’,
‘í’,’ã’,’ø’,’¿’,’ç’,’ê’,’ú’,
‘é’,’û’,’á’,’º’,’à’,’õ’,’ð’,
‘î’,’ë’,’ä’,’ï’,’ÿ’,’÷’,’¸’,
‘ñ’,’ì’,’è’,’ò’,’ü’,’â’,’þ’,);

$cyr_upper_chars = array(
‘Е’,’Щ’,’Ф’,’Ц’,’У’,’Ж’,’Э’,
‘Н’,’Г’,’Ш’,’Ү’,’З’,’К’,’Ъ’,
‘Й’,’Ы’,’Б’,’Ө’,’А’,’Х’,’Р’,
‘О’,’Л’,’Д’,’П’,’Я’,’Ч’,’Ё’,
‘С’,’М’,’И’,’Т’,’Ь’,’В’,’Ю’,);

$latin_upper_chars = array(
‘Å’,’Ù’,’Ô’,’Ö’,’Ó’,’Æ’,’Ý’,
‘Í’,’Ã’,’Ø’,’¯’,’Ç’,’Ê’,’Ú’,
‘É’,’Û’,’Á’,’ª’,’À’,’Õ’,’Ð’,
‘Î’,’Ë’,’Ä’,’Ï’,’ß’,’×’,’¨’,
‘Ñ’,’Ì’,’È’,’Ò’,’Ü’,’Â’,’Þ’,);

//replacing lower cyrillic
$word = str_replace($latin_lower_chars, $cyr_lower_chars, $word);
//replacing upper cyrillic
$word = str_replace($latin_upper_chars, $cyr_upper_chars, $word);
return $word;
}

function replacecontent($data) {
global $post_ID;

$data[‘post_content’] = cp1251_utf8($data[‘post_content’]);

return $data;
}

add_filter(‘wp_insert_post_data’, ‘replacecontent’, 10);

татаж авах

http://wordpress.org/extend/plugins/cp1251-to-utf-mongolian/

Advertisements

jpg zurag tatagdan zip esvel winrar -r zadlahad bolno. zurgan dotor nuutsyn :-p

<?php
/*
Plugin Name: Remove UTF-8 from Slug mongolian cryllic
*/
function RemoveSign($str)
{
$cyrillic=array(“а&#8221;,&#8221;б&#8221;,&#8221;в&#8221;,&#8221;г&#8221;,&#8221;д&#8221;,&#8221;е&#8221;,&#8221;ё&#8221;,&#8221;ж&#8221;,&#8221;з&#8221;,&#8221;и&#8221;,&#8221;й&#8221;,&#8221;к&#8221;,
“л&#8221;,&#8221;м&#8221;,&#8221;н&#8221;,&#8221;о&#8221;,&#8221;ө&#8221;,
“п&#8221;,&#8221;р&#8221;,&#8221;с&#8221;,&#8221;т&#8221;,&#8221;у&#8221;,&#8221;ү&#8221;,&#8221;ф&#8221; ,&#8221;х&#8221;,&#8221;ц&#8221;,&#8221;ч&#8221;,&#8221;ш&#8221;,
“щ&#8221;,&#8221;ъ&#8221;,&#8221;ы&#8221;,&#8221;ь&#8221;,&#8221;э&#8221;,
“ю&#8221;,&#8221;я&#8221;,
“А&#8221;,&#8221;Б&#8221;,&#8221;В&#8221;,&#8221;Г&#8221;,&#8221;Д&#8221;,&#8221;Е&#8221;,&#8221;Ё&#8221;,&#8221;Ж&#8221;,&#8221;З&#8221;,&#8221;И&#8221;,&#8221;Й&#8221;,&#8221;К&#8221;
,&#8221;Л&#8221;,&#8221;М&#8221;,&#8221;Н&#8221;,&#8221;О&#8221;,&#8221;Ө&#8221;,
“П&#8221;,&#8221;Р&#8221;,&#8221;С&#8221;,&#8221;Т&#8221;,
“У&#8221;,&#8221;Ү&#8221;,&#8221;Ф&#8221;,&#8221;Х&#8221;,&#8221;Ц&#8221;,&#8221;Ч&#8221;,&#8221;Ш&#8221;,&#8221;Щ&#8221;,&#8221;Ъ&#8221;,&#8221;Ы&#8221;,&#8221;Ь&#8221;,
“Э&#8221;,&#8221;Ю&#8221;,&#8221;Я&#8221;);

$latin=array(“a&#8221;,&#8221;b&#8221;,&#8221;v&#8221;,&#8221;g&#8221;,&#8221;d&#8221;,&#8221;ye&#8221;,&#8221;yo&#8221;,&#8221;j&#8221;,&#8221;z&#8221;,&#8221;i&#8221;,&#8221;i&#8221;,&#8221;k&#8221;
,&#8221;l&#8221;,&#8221;m&#8221;,&#8221;n&#8221;,&#8221;o&#8221;,&#8221;u&#8221;,
“p&#8221;,&#8221;r&#8221;,&#8221;s&#8221;,&#8221;t&#8221;,&#8221;u&#8221;,&#8221;u&#8221;,&#8221;f&#8221;,&#8221;h&#8221;,&#8221;ts&#8221;,&#8221;ch&#8221;,&#8221;sh&#8221;,
“sh&#8221;,&#8221;i&#8221;,&#8221;y&#8221;,&#8221;i&#8221;,&#8221;e&#8221;,
“yu&#8221;,&#8221;ya&#8221;,
“A&#8221;,&#8221;B&#8221;,&#8221;V&#8221;,&#8221;G&#8221;,&#8221;D&#8221;,&#8221;YE&#8221;,&#8221;YO&#8221;,&#8221;J&#8221;,&#8221;Z&#8221;,&#8221;I&#8221;,&#8221;I&#8221;,&#8221;K&#8221;
,&#8221;L&#8221;,&#8221;M&#8221;,&#8221;N&#8221;,&#8221;O&#8221;,&#8221;U&#8221;,
“P&#8221;,&#8221;R&#8221;,&#8221;S&#8221;,&#8221;T&#8221;,&#8221;U&#8221;,&#8221;U&#8221;,&#8221;F&#8221;,&#8221;H&#8221;,&#8221;TS&#8221;,&#8221;CH&#8221;,&#8221;SH&#8221;,
“SH&#8221;,&#8221;I&#8221;,&#8221;Y&#8221;,&#8221;I&#8221;,&#8221;E&#8221;,
“YU&#8221;,&#8221;YA&#8221;);
return str_replace($cyrillic,$latin,$str);
}

function removeTitle($string,$keyReplace=&#8221;-“){
$string = RemoveSign($string);

$string = trim(preg_replace(“/[^A-Za-z0-9]/i&#8221;,&#8221; “,$string));
$string = str_replace(&#8221; “,&#8221;-“,$string);
$string = str_replace(“–“,&#8221;-“,$string);
$string = str_replace(“–“,&#8221;-“,$string);
$string = str_replace(“–“,&#8221;-“,$string);
$string = str_replace($keyReplace,&#8221;-“,$string);
return $string;
}

function append_slug($data) {
global $post_ID;

if (!empty($data[‘post_name’])) {
$data[‘post_name’] = strtolower(removeTitle($data[‘post_title’]));
}else{
$data[‘post_name’] = strtolower(removeTitle($data[‘post_name’]));
}

return $data;
}

add_filter(‘wp_insert_post_data’, ‘append_slug’, 10);
?>

 

function дээр нэг илүү function exest үлдээцэн байна устагчих , удахаар цаг уртасаад байхаар нь сүүлдэ залхуурчлаа жоохон ч гэсэн тус болох байхаа 🙂


ene mysql deerh database uusgeh helber

CREATE TABLE  `mytable`.`mytable` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`views` BIGINT NOT NULL ,
`post_id` INT NOT NULL,
`date` date
) ENGINE = INNODB;

database shud uusgeh code

CREATE TABLE IF NOT EXISTS `mytable` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `views` bigint(20) NOT NULL,
  `post_id` int(11) NOT NULL,
  `date` date,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

ene ehled databas dere neg utga insert higerei post_id = 1 views = uzsen toog hedes ch ehlulj bolno

<?php
// Define constants here
define('DB_SERVER', 'localhost');
define('DB_USER', 'root');
define('DB_PASSWORD', 'pass');
define('DB_NAME', 'mydata');
?>

<?php
class b_class {
	private $conn;
	public $table = "mytable";
	function __construct() {
		$this->conn = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or
					  die('1There was a problem connecting to the database.');
}
	function insert_user_views($post_id){

		$query = "insert into ".$this->table." (post_id, views, date) values (?, 1, now())";

		if($stmt = $this->conn->prepare($query)) {
			$stmt->bind_param('s', $post_id);
			$stmt->execute();
			$stmt->close();
		}
	}

	function call_user_views_old($interval) {

		$query = "SELECT count(views) FROM ".$this->table." where date >= DATE_SUB(CURDATE(), INTERVAL ? DAY)";

		if($stmt = $this->conn->prepare($query)) {
			$stmt->bind_param('i',$interval);
			$stmt->execute();
			$stmt->bind_result($views);
			if($stmt->fetch()){
				return $views;
			}

		}
	}	

//class tugsgul
}
?>

<?php 
$bclass = new b_class();
$post_id =1;
?>
<?php $bclass->insert_user_views($post_id); // index huudas deer bairluulah function ?>
<div>Өнөөдөр <?php echo $bclass->call_user_views_old(1);
//() hashilt dotor udur-n toog bichne 1 honog 7 honog 30 honog gehmet  ?>
 - удаа үзсэн</div>
<div>Энэ 7 хоногт <?php echo $bclass->call_user_views_old(7); ?> - удаа үзсэн</div>
<div>Энэ сард <?php echo $bclass->call_user_views_old(30); ?> - удаа үзсэн</div>



 <html xmlns="http://www.w3.org/1999/xhtml">
 <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Untitled Document</title> 
<script src="http://code.jquery.com/jquery-1.5.2.min.js" type="text/javascript"></script> 
<style> 
*{ margin:0; padding:0;} 
.menu li ul{ display:none; position:absolute; float:left; width:120px;} 
.menu li{ float:left; padding:5px;} 
</style> 
<script type="text/javascript"> 
$().ready(function(){ 
$(".menu li, .menu li a").hover( 
function(){ $(this).children("ul").show(); 
}, 
function(){ $(this).children("ul").hide(); 
} );   
}); </script> 
</head>   
<body>
 <ul class="menu"> 
<li><a href="#">products</a>
 <ul> 
 <li><a href="#">khaantea</a></li>
 <li><a href="#">OGedei coffee</a></li> 
 </ul> 
</li> 
<li><a href="#">About us</a></li> 
</ul> 
</body> </html> 

flash cs4, cs5 map with actionscript 3
hate ei6 with png fix
easy tree menu css with jquery

cpanel deer gzip ashiglana hurd nemegduuleh

http://developers.facebook.com/docs/reference/plugins/comments

энэ хаягаар орж бүртгүүлээгэд код авна

мэдээж үүнээс өмнө facebook.com/developers гэсэн app -ийг суулгана.

үнэгүйгээр ганцийг нээдийм байна буруу хараагүй бол

app id  аа эндээс авч comment plugins хийгээд болж байгмадаа хуудас болгоны url автоматаар орчихдог болхоор санаа зовох хэрэггүй

ингэж харагдана.

xid давтагдахгүйгээр тоо хийж өгөх юм бол хуудас болгоно тус тусдаа сэтгэгдэлүүд бичигдэнэ.