/home/kkco/public_html/home__2939f42/include/fungction.php
<?php
function head()
{ global $SITE_NAME,$DOMAIN;
if (!isset($_REQUEST['page']))
{
echo "<title>".setting_value('6')." - ".$DOMAIN."</title>\n";
echo "<meta name=\"description\" itemprop=\"description\" content=\"".str_replace("\n"," ",strip_tags(stripslashes(setting_value('7'))))."\">\n";
// echo "<meta name=\"keywords\" content=\"".str_replace("\n"," ",strip_tags(stripslashes(format_keywords(setting_value('8')))))."\">\n";
echo "<meta content=\"".setting_value('6')." - ".$DOMAIN."\" property=\"og:title\"/>
<meta content=\"".str_replace("\n"," ",strip_tags(stripslashes(setting_value('7'))))."\" property=\"og:description\"/>
<meta content=\"".setting_value('6')." - ".$DOMAIN."\" property=\"twitter:title\"/>
<meta content=\"".str_replace("\n"," ",strip_tags(stripslashes(setting_value('7'))))."\" property=\"twitter:description\"/>
";
}
else if ($_REQUEST['page']=='html')
{
ms_i(get_param("id"));
$sql=mysql_query("select title,html from page where id='".get_param("id")."'");
$data=mysql_fetch_array($sql);
echo "<title>".$data['title']." - ".$DOMAIN."</title>\n";
echo "<meta name=\"description\" itemprop=\"description\" content=\"".str_replace("\n"," ",strip_tags(stripslashes(text_words($data['html'],30))))." - Kelaskaryawan.co\">\n";
// echo "<meta name=\"keywords\" content=\"".str_replace("\n"," ",strip_tags(stripslashes(format_keywords(text_words($data['html'],30)))))."\">\n";
echo "<meta content=\"".$data['title']." - ".$DOMAIN."\" property=\"og:title\"/>
<meta content=\"".str_replace("\n"," ",strip_tags(stripslashes(text_words($data['html'],30))))." - Kelaskaryawan.co\" property=\"og:description\"/>
<meta content=\"".$data['title']." - ".$DOMAIN."\" property=\"twitter:title\"/>
<meta content=\"".str_replace("\n"," ",strip_tags(stripslashes(text_words($data['html'],30))))." - Kelaskaryawan.co\" property=\"twitter:description\"/>
";
}
else if ($_REQUEST['page']=='artikel'&&!isset($_REQUEST['all']))
{
ms_i(get_param("id"));
$sql=mysql_query("select title,html from artikel where id='".get_param("id")."'");
$data=mysql_fetch_array($sql);
echo "<title>".$data['title']." - ".$DOMAIN."</title>\n";
echo "<meta name=\"description\" itemprop=\"description\" content=\"".str_replace("\n"," ",strip_tags(stripslashes(text_words($data['html'],30))))." - Kelaskaryawan.co\">\n";
//echo "<meta name=\"keywords\" content=\"".str_replace("\n"," ",strip_tags(stripslashes(format_keywords(text_words($data['html'],30)))))."\">\n";
echo "<meta content=\"".$data['title']." - ".$DOMAIN."\" property=\"og:title\"/>
<meta content=\"".str_replace("\n"," ",strip_tags(stripslashes(text_words($data['html'],30))))." - Kelaskaryawan.co\" property=\"og:description\"/>
<meta content=\"".$data['title']." - ".$DOMAIN."\" property=\"twitter:title\"/>
<meta content=\"".str_replace("\n"," ",strip_tags(stripslashes(text_words($data['html'],30))))." - Kelaskaryawan.co\" property=\"twitter:description\"/>
";
}
else if (isset($_REQUEST['file']))
{
ms_i(get_param("file"));
$sql=mysql_query("select title,html from page where id='".get_param("file")."'");
$data=mysql_fetch_array($sql);
echo "<title>".$data['title']." - ".$DOMAIN."</title>\n";
echo "<meta name=\"description\" itemprop=\"description\" content=\"".str_replace("\n"," ",strip_tags(stripslashes(text_words($data['html'],30))))." - Kelaskaryawan.co\">\n";
// echo "<meta name=\"keywords\" content=\"".str_replace("\n"," ",strip_tags(stripslashes(format_keywords(text_words($data['html'],30)))))."\">\n";
echo "<meta content=\"".$data['title']." - ".$DOMAIN."\" property=\"og:title\"/>
<meta content=\"".str_replace("\n"," ",strip_tags(stripslashes(text_words($data['html'],30))))." - Kelaskaryawan.co\" property=\"og:description\"/>
<meta content=\"".$data['title']." - ".$DOMAIN."\" property=\"twitter:title\"/>
<meta content=\"".str_replace("\n"," ",strip_tags(stripslashes(text_words($data['html'],30))))." - Kelaskaryawan.co\" property=\"twitter:description\"/>
";
}
else if ($_REQUEST['page']=='search')
{
$text=ucwords(removechar(get_param('cari')!=""?get_param('cari'):"Informasi Terbaru"));
echo "<title>".$text." - ".$DOMAIN."</title>\n";
echo "<meta name=\"description\" itemprop=\"description\" content=\"Informasi untuk ".$text." seperti Biaya Kuliah ".$text.", Waktu Kuliah ".$text."\">\n";
// echo "<meta name=\"keywords\" content=\"".str_replace("\n"," ",strip_tags(stripslashes(format_keywords($text))))."\">\n";
echo "<meta content=\"".$text." - ".$DOMAIN."\" property=\"og:title\"/>
<meta content=\"Informasi untuk ".$text." seperti Biaya Kuliah ".$text.", Waktu Kuliah ".$text."\" property=\"og:description\"/>
<meta content=\"".$text." - ".$DOMAIN."\" property=\"twitter:title\"/>
<meta content=\"Informasi untuk ".$text." seperti Biaya Kuliah ".$text.", Waktu Kuliah ".$text."\" property=\"twitter:description\"/>
";
}
else
{
echo "<title>".setting_value('6')." - ".$DOMAIN."</title>\n";
echo "<meta name=\"description\" itemprop=\"description\" content=\"".str_replace("\n"," ",strip_tags(stripslashes(setting_value('7'))))."\">\n";
// echo "<meta name=\"keywords\" content=\"".str_replace("\n"," ",strip_tags(stripslashes(format_keywords(setting_value('8')))))."\">\n";
echo "<meta content=\"".setting_value('6')." - ".$DOMAIN."\" property=\"og:title\"/>
<meta content=\"".str_replace("\n"," ",strip_tags(stripslashes(setting_value('7'))))."\" property=\"og:description\"/>
<meta content=\"".setting_value('6')." - ".$DOMAIN."\" property=\"twitter:title\"/>
<meta content=\"".str_replace("\n"," ",strip_tags(stripslashes(setting_value('7'))))."\" property=\"twitter:description\"/>
";
}
}
function limit_words($string, $word_limit){
$words = explode(" ",$string);
return implode(" ",array_splice($words,0,$word_limit));
}
function setting_value($string){
ms_i($string);
$sql=mysql_query("select * from settings where id_key='".$string."'");
$data=mysql_fetch_array($sql);
return $data['value'];
}
function text_words($string, $wordsreturned)
{
$retval = $string;
$array = explode(" ", trim($string));
if (count($array)<=$wordsreturned)
{
$retval = $string;
}
else
{
array_splice($array, $wordsreturned);
$retval = implode(" ", $array)." ...";
}
return $retval;
}
function format_keywords($keywords_text)
{
$keywords_text = str_replace("-"," ",$keywords_text);
$keywords_text = strtolower(str_replace(" ",",",str_replace(", ...","",text_words(stripslashes(strip_tags($keywords_text)),30))));
$keywords_text = str_replace(",,",",",$keywords_text);
return $keywords_text;
}
function ms_i($input)
{
if(!is_numeric($input)) die("");
}
function ms_w($input)
{
if(!preg_match("/^[a-zA-Z0-9_]+$/i", $input)) die("");
}
function ms_ew($input)
{
if(!preg_match("/^[a-zA-Z0-9_\-. @]+$/i", $input)) die("");
}
function removechar($input)
{
$strip_chars = array("~", "`", "!","#", "$", "%", "^", "&", "*", "(", ")", "=", "+", "[", "{", "]",
"}", "\\", "|", ";", ":", "\"", "'", "‘", "’", "“", "”", "–", "—",
",", "<", ">", "/", "?");
$output = trim(str_replace($strip_chars, " ", strip_tags($input)));
$output = preg_replace('/\s+/', ' ',$output);
$output = preg_replace('/\-+/', ' ',$output);
return $output;
}
function get_param($param_name)
{
global $_POST; global $_GET;
$param_value = "";
if(isset($_POST[$param_name])) $param_value = $_POST[$param_name];
else if(isset($_GET[$param_name])) $param_value = $_GET[$param_name];
if(is_array($param_value))
return $param_value;
else
return str_escape(stripslashes($param_value));
}
function str_escape($value)
{
$search = array("\x00", "\\", "'", "\"", "\x1a");
$replace = array("\\x00", "\\\\" ,"\'", "\\\"", "\\\x1a");
return str_replace($search, $replace, $value);
}
function format_str($strTitle)
{
$strSEPage = "";
$strTitle=strip_tags(stripslashes(strtolower(trim($strTitle))));
$arrSigns = array("~", "!","\t", "@","1","2","3","4","5","6","7","8","9","0", "#", "$", "%", "^", "&", "*", "(", ")", "+", "-", ",",".","/", "?", ":","<",">","[","]","{","}","|");
$strTitle = str_replace($arrSigns, "", $strTitle);
$pattern = '/[^\w ]+/';
$replacement = '';
$strTitle = preg_replace($pattern, $replacement, $strTitle);
$arrWords = explode(" ",$strTitle);
$iWCounter = 1;
foreach($arrWords as $strWord)
{
if($strWord == "") { continue; }
if($iWCounter == 4) { break; }
if($iWCounter != 1) { $strSEPage .= "-"; }
$strSEPage .= $strWord;
$iWCounter++;
}
return $strSEPage;
}
?>