new plugins

This commit is contained in:
Abdulrahman
2018-04-08 07:28:04 +03:00
parent deac73fe6d
commit 63b9d8e8e0
9 changed files with 1202 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

55
plugins/kj_meta_seo/index.html Executable file
View File

@@ -0,0 +1,55 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256"/>
<title>Powered by Kleeja</title>
<style type="text/css">* {
font-size: 100%;
margin: 0;
padding: 0;
color: #CECFCE;
}
body {
font-family: Tahoma, Arial, sans-serif;
font-size: 100%;
color: #69788E;
margin: 10px 30px;
background: #F7F7F7;
}
a:link, a:visited {
text-decoration: none;
color: #CECFCE;
}
a:active, a:hover {
text-decoration: underline;
color: #111;
}
h1 {
font-family: "Trebuchet MS", Helvetica, sans-serif;
font-size: 1.70em;
font-weight: normal;
color: #333333;
margin-top: 0;
margin-bottom: 10px;
}
.content_box {
border: 1px dashed #CECFCE;
background: #FFFFFF;
padding: 10px;
margin-right: auto;
margin-left: auto;
}</style>
</head>
<body title="&#1603;&#1604;&#1610;&#1580;&#1575;"><br/>
<div class="content_box"><h1><span style="font-size:250%;color:#D80000;">403 - Access forbidden!</span></h1></div>
<br/>
<div class="content_box"><span style="font-size: 140%">Powered by <a target="_blank"
href="http://www.kleeja.com">Kleeja</a></span>
</div>
</body>
</html>

View File

@@ -0,0 +1,280 @@
<?php
# kleeja plugin
# kj_meta_seo
# version: 1.0
# developer: kleeja team
# prevent illegal run
if (!defined('IN_PLUGINS_SYSTEM')) {
exit();
}
# plugin basic information
$kleeja_plugin['kj_meta_seo']['information'] = array(
# the casucal name of this plugin, anything can a human being understands
'plugin_title' => array(
'en' => 'KJ Meta SEO',
'ar' => 'ميتا سيو'
),
# who wrote this plugin?
'plugin_developer' => 'kleeja.com',
# this plugin version
'plugin_version' => '1.0',
# explain what is this plugin, why should i use it?
'plugin_description' => array(
'en' => 'Meta fields plugin to enhance SEO for Kleeja',
'ar' => 'إضافة الميتا الدسكربشن و الكييورزد لكليجا'
),
# min version of kleeja that's required to run this plugin
'plugin_kleeja_version_min' => '2.0',
# max version of kleeja that support this plugin, use 0 for unlimited
'plugin_kleeja_version_max' => '3.0',
# should this plugin run before others?, 0 is normal, and higher number has high priority
'plugin_priority' => 0
);
//after installation message, you can remove it, it's not requiered
$kleeja_plugin['kj_meta_seo']['first_run']['ar'] = "
شكراً لاستخدامك إضافة الميتا لكليجا، قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
info@kleeja.com
";
$kleeja_plugin['kj_meta_seo']['first_run']['en'] = "
Thank you for using our plugin, if you encounter any bugs and errors, contact us: <br>
info@kleeja.com
";
# plugin installation function
$kleeja_plugin['kj_meta_seo']['install'] = function ($plg_id) {
//new options
$options = array(
'kj_meta_seo_home_meta_description' =>
array(
'value' => '',
'html' => configField('kj_meta_seo_home_meta_description'),
'plg_id' => $plg_id,
'type' => 'kj_meta_seo',
'order' => '1',
),
'kj_meta_seo_home_meta_keywords' =>
array(
'value' => '',
'html' => configField('kj_meta_seo_home_meta_keywords'),
'plg_id' => $plg_id,
'type' => 'kj_meta_seo',
'order' => '2',
),
'kj_meta_seo_enable_auto_meta' =>
array(
'value' => '1',
'html' => configField('kj_meta_seo_enable_auto_meta', 'yesno'),
'plg_id' => $plg_id,
'type' => 'kj_meta_seo',
'order' => '3',
),
'kj_meta_seo_enable_download_auto_meta' =>
array(
'value' => '1',
'html' => configField('kj_meta_seo_enable_download_auto_meta', 'yesno'),
'plg_id' => $plg_id,
'type' => 'kj_meta_seo',
'order' => '4',
),
'kj_meta_seo_enable_facebook_meta_tags' =>
array(
'value' => '1',
'html' => configField('kj_meta_seo_enable_facebook_meta_tags', 'yesno'),
'plg_id' => $plg_id,
'type' => 'kj_meta_seo',
'order' => '5',
),
'kj_meta_seo_enable_twitter_meta_tags' =>
array(
'value' => '1',
'html' => configField('kj_meta_seo_enable_twitter_meta_tags', 'yesno'),
'plg_id' => $plg_id,
'type' => 'kj_meta_seo',
'order' => '6',
),
'kj_meta_seo_image_path' =>
array(
'value' => 'iPhone.png',
'html' => configField('kj_meta_seo_image_path'),
'plg_id' => $plg_id,
'type' => 'kj_meta_seo',
'order' => '7',
),
);
add_config_r($options);
//new language variables
add_olang(array(
'CONFIG_KLJ_MENUS_KJ_META_SEO' => 'خيارات ميتا سيو',
'KJ_META_SEO_HOME_META_DESCRIPTION' => 'الميتا دسكربشن/الوصف للبداية',
'KJ_META_SEO_HOME_META_KEYWORDS' => 'الميتا كيووردز/الكلمات للبداية',
'KJ_META_SEO_ENABLE_AUTO_META' => 'إنشاء الميتا بشكل تلقائي لباقي الصفحات',
'KJ_META_SEO_ENABLE_DOWNLOAD_AUTO_META' => 'إنشاء الميتا بشكل تلقائي لصفحة التحميل',
'KJ_META_SEO_ENABLE_FACEBOOK_META_TAGS' => 'تضمين الميتا أوبن قراف الخاصة بفيس بوك',
'KJ_META_SEO_ENABLE_TWITTER_META_TAGS' => 'تضمين الميتا كاردز الخاصة بتويتر',
'KJ_META_SEO_IMAGE_PATH' => 'الصورة المضمنة في الميتا (توضع في مجلد images)',
),
'ar',
$plg_id);
add_olang(array(
'CONFIG_KLJ_MENUS_KJ_META_SEO' => 'Meta SEO Settings',
'KJ_META_SEO_HOME_META_DESCRIPTION' => 'Meta description',
'KJ_META_SEO_HOME_META_KEYWORDS' => 'Meta keywords',
'KJ_META_SEO_ENABLE_AUTO_META' => 'Auto generate meta codes for all pages',
'KJ_META_SEO_ENABLE_DOWNLOAD_AUTO_META' => 'Auto generate meta codes for download page',
'KJ_META_SEO_ENABLE_FACEBOOK_META_TAGS' => 'Includes Facebook OpenGraph meta tags',
'KJ_META_SEO_ENABLE_TWITTER_META_TAGS' => 'Includes Twitter Cards meta tags',
'KJ_META_SEO_IMAGE_PATH' => 'Included image in meta (from folder: images)',
),
'en',
$plg_id);
};
//plugin update function, called if plugin is already installed but version is different than current
$kleeja_plugin['kj_meta_seo']['update'] = function ($old_version, $new_version) {
// if(version_compare($old_version, '0.5', '<')){
// //... update to 0.5
// }
//
// if(version_compare($old_version, '0.6', '<')){
// //... update to 0.6
// }
//you could use update_config, update_olang
};
# plugin uninstalling, function to be called at uninstalling
$kleeja_plugin['kj_meta_seo']['uninstall'] = function ($plg_id) {
//delete options
delete_config(array(
'kj_meta_seo_home_meta_description',
'kj_meta_seo_home_meta_keywords',
'kj_meta_seo_enable_auto_meta',
'kj_meta_seo_enable_download_auto_meta',
'kj_meta_seo_enable_facebook_meta_tags',
'kj_meta_seo_enable_twitter_meta_tags',
'kj_meta_seo_image_path',
));
delete_olang(null, null, $plg_id);
};
# plugin functions
$kleeja_plugin['kj_meta_seo']['functions'] = array(
'Saaheader_links_func' => function ($args) {
$extra = $args['extra'] . kj_meta_seo_out(
defined('IN_DOWNLOAD') ? 'download' : (defined('IN_REAL_INDEX') ? 'home' : 'any')
);
return compact('extra');
}
);
/**
* special functions
*/
if (!function_exists('kj_meta_seo_out')) {
function kj_meta_seo_out($in = '')
{
global $config, $title;
if($in == 'download' && $config['kj_meta_seo_enable_download_auto_meta'] == 0){
return null;
}
if($in == 'any' && $config['kj_meta_seo_enable_auto_meta'] == 0){
return null;
}
$metas = [];
$desc = '';
$keywords = '';
$included_image = rtrim($config['siteurl'], '/') . '/images/' . $config['kj_meta_seo_image_path'];
switch ($in){
case 'home':
$desc = $config['kj_meta_seo_home_meta_description'];
$keywords = str_replace("،", ",", $config['kj_meta_seo_home_meta_keywords']);
break;
default:
$desc = $title;
$keywords = implode(', ', kj_meta_seo_keywords_extract($title));
break;
}
$metas = array_merge($metas, array(
'<meta name="description" content="' . $desc . '">',
'<meta name="keywords" content="' . $keywords . '" >'
));
$actual_link = htmlspecialchars('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
if($config['kj_meta_seo_enable_facebook_meta_tags'] == 1) {
$facebook_meta = array(
'<meta property="og:type" content="website">',
'<meta property="og:title" content="' . $title . '">',
'<meta property="og:image" content="' . $included_image . '">',
'<meta property="og:url" content="' . $actual_link . '">',
'<meta property="og:site_name" content="' . $config['sitename'] . '">',
'<meta property="og:description" content="' . htmlspecialchars($desc) . '">'
);
$metas = array_merge($metas, $facebook_meta);
}
if($config['kj_meta_seo_enable_twitter_meta_tags'] == 1) {
$twitter_meta = array(
'<meta name="twitter:card" content="summary">',
'<meta name="twitter:title" content="'. $title .'">',
'<meta name="twitter:description" content="' . htmlspecialchars($desc) . '">',
'<meta name="twitter:image" content="' . $included_image . '">',
);
$metas = array_merge($metas, $twitter_meta);
}
return '
<!-- kj_meta_seo start -->
' . implode("\n ", $metas) . '
<!-- kj_meta_seo end -->
';
}
}
if (!function_exists('kj_meta_seo_keywords_extract')) {
function kj_meta_seo_keywords_extract($string = '')
{
return array_filter(preg_split("!\W!", $string));
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

55
plugins/kj_recaptcha/index.html Executable file
View File

@@ -0,0 +1,55 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256"/>
<title>Powered by Kleeja</title>
<style type="text/css">* {
font-size: 100%;
margin: 0;
padding: 0;
color: #CECFCE;
}
body {
font-family: Tahoma, Arial, sans-serif;
font-size: 100%;
color: #69788E;
margin: 10px 30px;
background: #F7F7F7;
}
a:link, a:visited {
text-decoration: none;
color: #CECFCE;
}
a:active, a:hover {
text-decoration: underline;
color: #111;
}
h1 {
font-family: "Trebuchet MS", Helvetica, sans-serif;
font-size: 1.70em;
font-weight: normal;
color: #333333;
margin-top: 0;
margin-bottom: 10px;
}
.content_box {
border: 1px dashed #CECFCE;
background: #FFFFFF;
padding: 10px;
margin-right: auto;
margin-left: auto;
}</style>
</head>
<body title="&#1603;&#1604;&#1610;&#1580;&#1575;"><br/>
<div class="content_box"><h1><span style="font-size:250%;color:#D80000;">403 - Access forbidden!</span></h1></div>
<br/>
<div class="content_box"><span style="font-size: 140%">Powered by <a target="_blank"
href="http://www.kleeja.com">Kleeja</a></span>
</div>
</body>
</html>

View File

@@ -0,0 +1,469 @@
<?php
# kleeja plugin
# kj_recaptcha
# version: 1.3
# developer: kleeja team
# prevent illegal run
if (!defined('IN_PLUGINS_SYSTEM')) {
exit();
}
# plugin basic information
$kleeja_plugin['kj_recaptcha']['information'] = array(
# the casucal name of this plugin, anything can a human being understands
'plugin_title' => array(
'en' => 'KJ reCaptcha',
'ar' => 'كليجا ريكابتشا'
),
# who wrote this plugin?
'plugin_developer' => 'kleeja.com',
# this plugin version
'plugin_version' => '1.3',
# explain what is this plugin, why should i use it?
'plugin_description' => array(
'en' => 'Add reCaptcha to Kleeja',
'ar' => 'إضافة ريكابتشا لكليجا'
),
# min version of kleeja that's required to run this plugin
'plugin_kleeja_version_min' => '2.0',
# max version of kleeja that support this plugin, use 0 for unlimited
'plugin_kleeja_version_max' => '3.0',
# should this plugin run before others?, 0 is normal, and higher number has high priority
'plugin_priority' => 0
);
//after installation message, you can remove it, it's not requiered
$kleeja_plugin['kj_recaptcha']['first_run']['ar'] = "
شكراً لاستخدامك إضافة الريكابتشا لكليجا، قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
info@kleeja.com
<br>
للحصول على مفتاح وكود ريكابتشا السري سجل في موقعهم:
<a href='https://www.google.com/recaptcha'>google.com/reCaptcha</a>.
<br>
ثم أضفها في إعدادات -> خيارات الريكابتشا
";
$kleeja_plugin['kj_recaptcha']['first_run']['en'] = "
Thank you for using our plugin, if you encounter any bugs and errors, contact us: <br>
info@kleeja.com
<br>
to get the reCaptcha sitekey and secret code, visit:
<a href='https://www.google.com/recaptcha'>google.com/reCaptcha</a>.
<br>
then configure this plugin from: settings -> reCaptcha settings
";
# plugin installation function
$kleeja_plugin['kj_recaptcha']['install'] = function ($plg_id) {
//new options
$options = array(
'kj_recaptcha_sitekey' =>
array(
'value' => '',
'html' => configField('kj_recaptcha_sitekey'),
'plg_id' => $plg_id,
'type' => 'kj_recaptcha'
),
'kj_recaptcha_secret' =>
array(
'value' => '',
'html' => configField('kj_recaptcha_secret'),
'plg_id' => $plg_id,
'type' => 'kj_recaptcha'
),
'kj_recaptcha_invisible' =>
array(
'value' => '0',
'html' => configField('kj_recaptcha_invisible', 'yesno'),
'plg_id' => $plg_id,
'type' => 'kj_recaptcha'
),
);
add_config_r($options);
//new language variables
add_olang(array(
'KJ_RECAPTCHA_SITEKEY' => 'مفتاح الرياكبتشا | sitekey',
'KJ_RECAPTCHA_SECRET' => 'الكود السري للريكابتشا | secret',
'KJ_RECAPTCHA_INVISIBLE' => 'نوع الريكابتشا: مخفية invisible',
'CONFIG_KLJ_MENUS_KJ_RECAPTCHA' => 'خيارات ريكابتشا',
),
'ar',
$plg_id);
add_olang(array(
'KJ_RECAPTCHA_SITEKEY' => 'reCaptcha sitekey',
'KJ_RECAPTCHA_SECRET' => 'reCaptcha secret',
'KJ_RECAPTCHA_INVISIBLE' => 'reCaptcha Type: Invisible',
'CONFIG_KLJ_MENUS_KJ_RECAPTCHA' => 'reCaptcha Settings',
),
'en',
$plg_id);
};
//plugin update function, called if plugin is already installed but version is different than current
$kleeja_plugin['kj_recaptcha']['update'] = function ($old_version, $new_version) {
$plg_id = Plugins::getInstance()->installed_plugin_info('kj_recaptcha');
if(version_compare($old_version, '1.3', '<')){
$options = array(
'kj_recaptcha_invisible' =>
array(
'value' => '0',
'html' => configField('kj_recaptcha_invisible', 'yesno'),
'plg_id' => $plg_id,
'type' => 'kj_recaptcha'
),
);
add_config_r($options);
//new language variables
add_olang(array(
'KJ_RECAPTCHA_INVISIBLE' => 'نوع الريكابتشا: مخفية invisible',
),
'ar',
$plg_id);
add_olang(array(
'KJ_RECAPTCHA_INVISIBLE' => 'reCaptcha Type: Invisible',
),
'en',
$plg_id);
}
//
// if(version_compare($old_version, '0.6', '<')){
// //... update to 0.6
// }
//you could use update_config, update_olang
};
# plugin uninstalling, function to be called at uninstalling
$kleeja_plugin['kj_recaptcha']['uninstall'] = function ($plg_id) {
//delete options
delete_config(array(
'kj_recaptcha_sitekey',
'kj_recaptcha_secret',
'kj_recaptcha_invisible'
));
foreach (array('ar', 'en') as $language) {
delete_olang(null, $language, $plg_id);
}
};
# plugin functions
$kleeja_plugin['kj_recaptcha']['functions'] = array(
'Saaheader_links_func' => function ($args) {
global $config;
$extra = $args['extra'] . "\n" . getReCaptchaInputHeadHtml();
return compact('extra');
},
'before_display_template_admin_page' => function ($args) {
global $config;
$extra_header_admin_login = $args['extra_header_admin_login'] . "\n" . getReCaptchaInputHeadHtml();
$show_captcha = false;
return compact('extra_header_admin_login', 'show_captcha');
},
'style_parse_func' => function($args) {
global $config;
if(in_array($args['template_name'], array('call', 'report', 'register', 'login')) && defined('reCaptcha_all')){
$html = preg_replace(
'/(<IF\s{1,}NAME="config.enable_captcha==1">)/',
getReCaptchaInputHtml().'$1',
$args['html']);
return compact('html');
}else if($args['template_name'] == 'index_body' && defined('reCaptcha_index')){
$html = preg_replace(
'/(<IF\s{1,}NAME="config.safe_code">)/',
getReCaptchaInputHtml().'$1',
$args['html']);
return compact('html');
}else if($args['template_name'] == 'admin_login'){
$html = preg_replace(
'/(<IF\s{1,}NAME="show_captcha">)/',
getReCaptchaInputHtml().'$1',
$args['html']);
unset($_SESSION['SHOW_CAPTCHA']);
return compact('html');
}
},
'admin_login_submit' => function($args){
global $lang;
if(!isReCaptchaValid()) {
$ERRORS = $args['ERRORS'];
$ERRORS['recaptcha'] = $lang['WRONG_VERTY_CODE'];
return compact('ERRORS');
}
},
'end_common' => function($args){
global $config;
if($config['safe_code'] == 1){
define('reCaptcha_index', true);
}
if($config['enable_captcha'] == 1){
define('reCaptcha_all', true);
}
$config['enable_captcha'] = 0;
$config['safe_code'] = 0;
},
'submit_report_go_page' => function ($args){
global $lang;
if(!isReCaptchaValid()) {
$ERRORS = $args['ERRORS'];
$ERRORS['recaptcha'] = $lang['WRONG_VERTY_CODE'];
return compact('ERRORS');
}
},
'register_submit' => function ($args){
global $lang;
if(!isReCaptchaValid()) {
$ERRORS = $args['ERRORS'];
$ERRORS['recaptcha'] = $lang['WRONG_VERTY_CODE'];
return compact('ERRORS');
}
},
'login_after_submit' => function ($args){
global $lang;
if(!isReCaptchaValid()) {
$ERRORS = $args['ERRORS'];
$ERRORS['recaptcha'] = $lang['WRONG_VERTY_CODE'];
return compact('ERRORS');
}
},
'submit_call_go_page' => function($args){
global $lang;
if(!isReCaptchaValid()) {
$ERRORS = $args['ERRORS'];
$ERRORS['recaptcha'] = $lang['WRONG_VERTY_CODE'];
return compact('ERRORS');
}
},
'defaultUploader_upload_1st' => function($args){
global $lang;
if(!defined('reCaptcha_index')){
return null;
}
$captcha_enabled = true;
return compact('captcha_enabled');
},
'kleeja_check_captcha_func' => function($args){
if(defined('IN_REAL_INDEX') || defined('IN_ADMIN')){
$return = isReCaptchaValid();
return compact('return');
}
if(!defined('IN_ADMIN')) {
$return = true;
return compact('return');
}
},
'ftpUploader_upload_1st' => function($args){
global $lang;
if(!defined('reCaptcha_index')){
return null;
}
$captcha_enabled = true;
return compact('captcha_enabled');
},
);
//
/**
* special functions
*/
if(! function_exists('getReCaptchaInputHtml'))
{
function getReCaptchaInputHtml()
{
global $config;
if($config['kj_recaptcha_invisible'] == 1)
{
return '<div id="aarecaptcha" style="margin: 10px auto; text-align: center; max-width: 255px;"></div>';
}
else
{
return '<div class="g-recaptcha" data-sitekey="' . $config['kj_recaptcha_sitekey'] . '" style="margin: 10px auto; text-align: center; max-width: 255px;"></div>';
}
}
}
if(! function_exists('getReCaptchaInputHeadHtml'))
{
function getReCaptchaInputHeadHtml()
{
global $config;
if($config['kj_recaptcha_invisible'] == 1)
{
return '<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit&hl=' . $config['language'] . '"></script>'.
'<script>
var disableSubmit = function(state){
var children = document.getElementsByTagName("form").childNodes;
var parent = null;
for(child in children){
if (children.hasOwnProperty(child)) {
if(child.getElementById("aarecaptcha") !== null){
parent = child;
}
}
}
if(parent === null){
return;
}
parent.querySelectorAll("input[type=submit]").disabled = state;
};
var onloadCallback = function(){
disableSubmit(true);
grecaptcha.render("aarecaptcha", {
"sitekey" : "'.$config['kj_recaptcha_sitekey'].'",
"badge" : "inline",
"size" : "invisible",
"callback" : function(token){
disableSubmit(false);
}
});
grecaptcha.execute();
};
</script>';
}
else
{
return '<script src="https://www.google.com/recaptcha/api.js?hl=' . $config['language'] . '"></script>';
}
}
}
if (!function_exists('isReCaptchaValid')) {
function isReCaptchaValid()
{
global $config;
if(!ip('g-recaptcha-response') || empty(p('g-recaptcha-response'))){
return false;
}
try {
$data = array(
'secret' => $config['kj_recaptcha_secret'],
'response' => p('g-recaptcha-response'),
'remoteip' => $_SERVER['REMOTE_ADDR']
);
$url = 'https://www.google.com/recaptcha/api/siteverify?' . http_build_query($data);
$result = fetch_remote_file($url);
//
// if (function_exists('curl_version')) {
// $curl = curl_init($url . "?" . http_build_query($data));
// curl_setopt($curl, CURLOPT_HEADER, false);
// curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($curl, CURLOPT_TIMEOUT, 1);
// curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
// $result = curl_exec($curl);
//
// } else {
//// $options = array(
//// 'http' => array(
//// 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
//// 'method' => 'POST',
//// 'content' => http_build_query($data)
//// )
//// );
////
//// $context = stream_context_create($options);
////
//// //TODO use our function for fallback
// $result = file_get_contents($url, false, $context);
// }
if (empty($result) || is_null($result)) {
return false;
}
return json_decode($result)->success;
}
catch (Exception $e) {
return null;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

View File

@@ -0,0 +1,55 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256"/>
<title>Powered by Kleeja</title>
<style type="text/css">* {
font-size: 100%;
margin: 0;
padding: 0;
color: #CECFCE;
}
body {
font-family: Tahoma, Arial, sans-serif;
font-size: 100%;
color: #69788E;
margin: 10px 30px;
background: #F7F7F7;
}
a:link, a:visited {
text-decoration: none;
color: #CECFCE;
}
a:active, a:hover {
text-decoration: underline;
color: #111;
}
h1 {
font-family: "Trebuchet MS", Helvetica, sans-serif;
font-size: 1.70em;
font-weight: normal;
color: #333333;
margin-top: 0;
margin-bottom: 10px;
}
.content_box {
border: 1px dashed #CECFCE;
background: #FFFFFF;
padding: 10px;
margin-right: auto;
margin-left: auto;
}</style>
</head>
<body title="&#1603;&#1604;&#1610;&#1580;&#1575;"><br/>
<div class="content_box"><h1><span style="font-size:250%;color:#D80000;">403 - Access forbidden!</span></h1></div>
<br/>
<div class="content_box"><span style="font-size: 140%">Powered by <a target="_blank"
href="http://www.kleeja.com">Kleeja</a></span>
</div>
</body>
</html>

View File

@@ -0,0 +1,288 @@
<?php
# Kleeja Plugin
# kj_sitemap_seo
# Version: 1.0
# Developer: Kleeja team
# Prevent illegal run
if (!defined('IN_PLUGINS_SYSTEM')) {
exit();
}
# Plugin Basic Information
$kleeja_plugin['kj_sitemap_seo']['information'] = array(
# The casucal name of this plugin, anything can a human being understands
'plugin_title' => array('en' => 'KJ SiteMap SEO', 'ar' => 'كليجا سايت ماب سيو'),
# Who wrote this plugin?
'plugin_developer' => 'Kleeja.com',
# This plugin version
'plugin_version' => '1.0',
# Explain what is this plugin, why should I use it?
'plugin_description' => array(
'en' => 'Generate a sitemap and promote your content by notifying (ping) the search engine once at every new content addition to Kleeja',
'ar' => 'إنشاء سايت ماب لكليجا وإمكانية بينق محركات البحث بعد كل إضافة محتوى جديد'
),
# Min version of Kleeja that's requiered to run this plugin
'plugin_kleeja_version_min' => '2.0',
# Max version of Kleeja that support this plugin, use 0 for unlimited
'plugin_kleeja_version_max' => '3.0',
# Should this plugin run before others?, 0 is normal, and higher number has high priority
'plugin_priority' => 0
);
//after installation message, you can remove it, it's not requiered
$kleeja_plugin['kj_sitemap_seo']['first_run']['ar'] = "
شكراً لاستخدامك إضافة السايت ماب لكليجا، قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
info@kleeja.com
<hr>
<br>
<h3>لاحظ:</h3>
لأداء أفضل للسايت ماب، قم بإضافة السطر التالي لملف : robots.txt <br>
هذا الملف يكون في مجلد كليجا الأساسي وإن لم يكن موجود فقم بإضافته ثم إضافة السطر التالي له:
<br>
<br>
<b>Sitemap:</b> " . (!empty($config['siteurl']) ? $config['siteurl'] : 'http://example.com/') . "go.php?go=sitemap
<br> أو:
<br>
" . (!empty($config['siteurl']) ? $config['siteurl'] : 'http://example.com/') . "sitemap.xml
<hr>
<br>
<b>تجد إعدادات الإضافة في : إعدادات المركز->خيارات سايب ماب سيو</b>
";
$kleeja_plugin['kj_sitemap_seo']['first_run']['en'] = "
Thank you for using our plugin, if you encounter any bugs and errors, contact us: <br>
info@kleeja.com
<hr>
<br>
<h3>Note:</h3>
For better results, a file named 'robots.txt' should be existed at Kleeja root folder (same folder as config.php file), and has this line: <br>
<b>Sitemap:</b> <br> " . (!empty($config['siteurl']) ? $config['siteurl'] : 'http://example.com/') . "go.php?go=sitemap
<br> or:
<br>
" . (!empty($config['siteurl']) ? $config['siteurl'] : 'http://example.com/') . "sitemap.xml
<hr>
<br>
<b>For Plugin's settings: General Settings->SiteMap SEO Settings</b>
";
# Plugin Installation function
$kleeja_plugin['kj_sitemap_seo']['install'] = function ($plg_id) {
//new options
$options = array(
'kj_sitemap_seo_sitemap_ping_enable' =>
array(
'value' => '0',
'html' => configField('kj_sitemap_seo_sitemap_ping_enable', 'yesno'),
'plg_id' => $plg_id,
'type' => 'kj_sitemap_seo'
),
'kj_sitemap_seo_sitemap_ping_time' =>
array(
'value' => '0',
'plg_id' => $plg_id,
'type' => 'kj_sitemap_seo'
),
);
//TODO add an option to let the use decide the interval between pings
add_config_r($options);
//new language variables
add_olang(array(
'KJ_SITEMAP_SEO_SITEMAP_PING_ENABLE' => 'تفعيل إعلام محركات البحث عن المحتوى الجديد',
'CONFIG_KLJ_MENUS_KJ_SITEMAP_SEO' => 'خيارات سايب ماب سيو',
),
'ar',
$plg_id);
add_olang(array(
'KJ_SITEMAP_SEO_SITEMAP_PING_ENABLE' => 'Notify (ping) search engine about new content',
'CONFIG_KLJ_MENUS_KJ_SITEMAP_SEO' => 'SiteMap SEO Settings',
),
'en',
$plg_id);
if(function_exists('add_to_htaccess')){
add_to_htaccess('RewriteRule ^sitemap\.xml$ /go.php?go=sitemap [L]', 'kj_sitemap_seo');
}
};
//Plugin update function, called if plugin is already installed but version is different than current
$kleeja_plugin['kj_sitemap_seo']['update'] = function ($old_version, $new_version) {
// if(version_compare($old_version, '0.5', '<')){
// //... update to 0.5
// }
//
// if(version_compare($old_version, '0.6', '<')){
// //... update to 0.6
// }
//you could use update_config, update_olang
};
# Plugin Uninstall, function to be called at uninstalling
$kleeja_plugin['kj_sitemap_seo']['uninstall'] = function () {
//delete options
delete_config(array(
'kj_sitemap_seo_sitemap_ping_enable',
'kj_sitemap_seo_sitemap_ping_time'
));
//delete language variables
$olangs = array('KJ_SITEMAP_SEO_SITEMAP_PING_ENABLE');
foreach (array('ar', 'en') as $language) {
delete_olang($olangs, $language);
}
//remove rules
if(function_exists('remove_from_htaccess')) {
remove_from_htaccess('kj_sitemap_seo');
}
};
# Plugin functions
$kleeja_plugin['kj_sitemap_seo']['functions'] = array(
//new page
'default_go_page' => function () {
global $SQL, $dbprefix, $config;
if (g('go') == 'sitemap') {
header('Content-Type: application/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
echo '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
$query = array(
'SELECT' => 'f.id, f.name, f.real_filename, f.folder, f.type, f.time',
'FROM' => "{$dbprefix}files f",
'ORDER BY' => 'f.id DESC',
'LIMIT' => '100'
);
$result = $SQL->build($query);
while ($file = $SQL->fetch($result)) {
$file_info = array('::ID::' => $file['id'], '::NAME::' => $file['name'], '::DIR::' => $file['folder'], '::FNAME::' => $file['real_filename']);
echo '<url>' . "\n";
echo " " . '<loc>' . kleeja_get_link(is_image($file['type']) ? 'image' : 'file', $file_info) . '</loc>' . "\n";
if (is_image($file['type'])) {
echo " " . '<image:image><image:loc>' . kleeja_get_link('thumb', $file_info) . '</image:loc><image:caption>' . (trim($file['real_filename']) !== '' ? xml_entities(htmlspecialchars($file['real_filename'])) : xml_entities(htmlspecialchars($file['name']))) . '</image:caption></image:image>' . "\n";
}
echo " " . '<lastmod>' . date('c', $file['time']) . '</lastmod>' . "\n";
echo '</url>' . "\n";
}
echo '</urlset>';
$SQL->free($result);
#at end, close sql connections & etc
$SQL->close();
// #tell kleeja that we have a request from go=sitemap
// $no_request = false;
exit;
}
},
//output in header
'Saaheader_links_func' => function ($args) {
global $config;
$extra = $args['extra'] . "\n" .
'<link rel="sitemap" type="application/xml" title="Sitemap" href="' . rtrim($config['siteurl'], '/') . '/go.php?go=sitemap">';
return compact('extra');
},
//ping after uploading files?
'kljuploader_process_after_loop' => function ($args) {
if (isset($args['check'])) {
send_a_ping();
}
}
);
/**
* special functions
*/
if (!function_exists('xml_entities')) {
function xml_entities($string)
{
return strtr(
$string,
array(
"<" => "&lt;",
">" => "&gt;",
'"' => "&quot;",
"'" => "&apos;",
"&" => "&amp;",
)
);
}
}
if (!function_exists('is_image')) {
function is_image($pre_ext)
{
return in_array(strtolower(trim($pre_ext)), array('gif', 'jpg', 'jpeg', 'bmp', 'png')) ? true : false;
}
}
if (!function_exists('send_a_ping')) {
function send_a_ping()
{
global $config;
//dev ?
// if(defined('DEV_STAGE')){
// // return;
// }
if (!$config['kj_sitemap_seo_sitemap_ping_enable']) {
return;
}
//last time? 3 hours in between
if ((int)$config['kj_sitemap_seo_sitemap_ping_time'] > 0 && (int)time() - $config['kj_sitemap_seo_sitemap_ping_time'] < 3600 * 3) {
return;
}
$services = array(
"http://www.bing.com/webmaster/ping.aspx?siteMap=",
"http://www.bing.com/ping?sitemap=",
"http://submissions.ask.com/ping?sitemap=",
"http://www.google.com/webmasters/sitemaps/ping?sitemap=",
"http://api.moreover.com/ping?sitemap=",
);
foreach ($services as $sv) {
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $sv . rtrim($config['siteurl'], '/') . '/go.php?go=sitemap');
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
}
update_config('kj_sitemap_seo_sitemap_ping_time', time());
//TODO add last time of ping to admin start page
}
}