mirror of
https://github.com/kleeja-official/kleeja.git
synced 2025-12-14 20:19:43 +01:00
plugin: advanced extras
This commit is contained in:
97
plugins/advanced_extras/admin_adv_extras.html
Executable file
97
plugins/advanced_extras/admin_adv_extras.html
Executable file
@@ -0,0 +1,97 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Breadcrumbs -->
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li class="breadcrumb-item"><a href="./">{lang.R_CPINDEX}</a></li>
|
||||||
|
<li class="breadcrumb-item">{lang.R_EXTRA}</li>
|
||||||
|
<IF NAME="current_smt == he">
|
||||||
|
<li class="breadcrumb-item active">{lang.ADD_HEADER_EXTRA}</li>
|
||||||
|
<ELSEIF NAME="current_smt == fe">
|
||||||
|
<li class="breadcrumb-item active">{lang.ADD_FOOTER_EXTRA}</li>
|
||||||
|
</IF>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<form method="post" action="{action}" id="extra_form">
|
||||||
|
<IF NAME="current_smt == he">
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
{lang.EX_HEADER_N}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div id="accordion" role="tablist">
|
||||||
|
<LOOP NAME="extra_pages.header">
|
||||||
|
<div class="card mt-2">
|
||||||
|
<div class="card-header" role="tab" id="heading{{name}}">
|
||||||
|
<h6 class="mb-0">
|
||||||
|
<a data-toggle="collapse" href="#collapse{{name}}" aria-expanded="true" aria-controls="collapse{{name}}">
|
||||||
|
{olang.ADVANCED_EXTRAS_APPEAR_PAGE}: {{title}}
|
||||||
|
</a>
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="collapse{{name}}" class="collapse " role="tabpanel" aria-labelledby="heading{{name}}" data-parent="#accordion">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea id="ex_header_{{name}}" name="ex_header_x[{{name}}]" class="form-control" rows="8">{{value}}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</LOOP>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<ELSEIF NAME="current_smt == fe">
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
{lang.EX_FOOTER_N}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div id="accordion" role="tablist">
|
||||||
|
<LOOP NAME="extra_pages.footer">
|
||||||
|
<div class="card mt-2">
|
||||||
|
<div class="card-header" role="tab" id="heading{{name}}">
|
||||||
|
<h6 class="mb-0">
|
||||||
|
<a data-toggle="collapse" href="#collapse{{name}}" aria-expanded="true" aria-controls="collapse{{name}}">
|
||||||
|
{olang.ADVANCED_EXTRAS_APPEAR_PAGE}: {{title}}
|
||||||
|
</a>
|
||||||
|
</h6>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="collapse{{name}}" class="collapse " role="tabpanel" aria-labelledby="heading{{name}}" data-parent="#accordion">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea id="ex_footer_{{name}}" name="ex_footer_x[{{name}}]" class="form-control" rows="8">{{value}}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</LOOP>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</IF>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<input type="submit" name="submit" value="{lang.UPDATE_EXTRA}" class="btn btn-primary">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{H_FORM_KEYS}
|
||||||
|
</form>
|
||||||
|
|
||||||
BIN
plugins/advanced_extras/icon.png
Normal file
BIN
plugins/advanced_extras/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 85 KiB |
55
plugins/advanced_extras/index.html
Executable file
55
plugins/advanced_extras/index.html
Executable 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="كليجا"><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>
|
||||||
232
plugins/advanced_extras/init.php
Normal file
232
plugins/advanced_extras/init.php
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
<?php
|
||||||
|
# Kleeja Plugin
|
||||||
|
# advanced_extras
|
||||||
|
# Version: 1.0
|
||||||
|
# Developer: Kleeja team
|
||||||
|
|
||||||
|
# Prevent illegal run
|
||||||
|
if (!defined('IN_PLUGINS_SYSTEM')) {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// https://github.com/Falicon/BitlyPHP
|
||||||
|
|
||||||
|
|
||||||
|
# Plugin Basic Information
|
||||||
|
$kleeja_plugin['advanced_extras']['information'] = array(
|
||||||
|
# The casucal name of this plugin, anything can a human being understands
|
||||||
|
'plugin_title' => array(
|
||||||
|
'en' => 'Advanced Extras',
|
||||||
|
'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' => 'An advanced interface for the extra templates feature',
|
||||||
|
'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['advanced_extras']['first_run']['ar'] = "
|
||||||
|
شكراً لاستخدامك هذه الإضافة قم بمراسلتنا بالأخطاء عند ظهورها على البريد: <br>
|
||||||
|
info@kleeja.com
|
||||||
|
<hr>
|
||||||
|
<br>
|
||||||
|
<h3>لاحظ:</h3>
|
||||||
|
<b>تجد إعدادات الإضافة في صفحة: هيدر وفوتر إضافي في اللوحة</b>
|
||||||
|
";
|
||||||
|
|
||||||
|
$kleeja_plugin['advanced_extras']['first_run']['en'] = "
|
||||||
|
Thanks for using this plugin, to report bugs contact us:
|
||||||
|
<br>
|
||||||
|
info@kleeja.com
|
||||||
|
<hr>
|
||||||
|
<br>
|
||||||
|
<h3>Note:</h3>
|
||||||
|
<b>You can find the settings at: Extra Templates page in the control panel</b>
|
||||||
|
|
||||||
|
";
|
||||||
|
|
||||||
|
|
||||||
|
# Plugin Installation function
|
||||||
|
$kleeja_plugin['advanced_extras']['install'] = function ($plg_id)
|
||||||
|
{
|
||||||
|
//new language variables
|
||||||
|
add_olang(array(
|
||||||
|
'ADVANCED_EXTRAS_APPEAR_PAGE' => 'عرض في صفحة'
|
||||||
|
),
|
||||||
|
'ar',
|
||||||
|
$plg_id);
|
||||||
|
|
||||||
|
add_olang(array(
|
||||||
|
'ADVANCED_EXTRAS_APPEAR_PAGE' => 'Appears in page',
|
||||||
|
),
|
||||||
|
'en',
|
||||||
|
$plg_id);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//Plugin update function, called if plugin is already installed but version is different than current
|
||||||
|
$kleeja_plugin['advanced_extras']['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 Uninstallation, function to be called at unistalling
|
||||||
|
$kleeja_plugin['advanced_extras']['uninstall'] = function ($plg_id) {
|
||||||
|
//delete language variables
|
||||||
|
foreach (array('ar', 'en') as $language) {
|
||||||
|
delete_olang(null, $language, $plg_id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
# Plugin functions
|
||||||
|
$kleeja_plugin['advanced_extras']['functions'] = array(
|
||||||
|
'end_admin_page' => function($args){
|
||||||
|
|
||||||
|
if(!empty($args['go_to'])) {
|
||||||
|
$go_to = $args['go_to'];
|
||||||
|
|
||||||
|
|
||||||
|
if ($go_to == 'n_extra') {
|
||||||
|
global $lang;
|
||||||
|
|
||||||
|
$ex_header = $args['ex_header'];
|
||||||
|
$ex_footer = $args['ex_footer'];
|
||||||
|
|
||||||
|
$stylee = 'admin_adv_extras';
|
||||||
|
$styleePath = dirname(__FILE__);
|
||||||
|
|
||||||
|
//$ex_header, $ex_footer
|
||||||
|
|
||||||
|
$ex_values['header'] = advanced_extras_get_values($ex_header);
|
||||||
|
$ex_values['footer'] = advanced_extras_get_values($ex_footer);
|
||||||
|
|
||||||
|
foreach (array('header', 'footer') as $k) {
|
||||||
|
$extra_pages[$k] = array(
|
||||||
|
array('name' => 'all', 'title' => $lang['ALL'], 'value' => isset($ex_values[$k]['all']) ? $ex_values[$k]['all'] : ''),
|
||||||
|
array('name' => 'index', 'title' => $lang['INDEX'], 'value' => isset($ex_values[$k]['index']) ? $ex_values[$k]['index'] : ''),
|
||||||
|
array('name' => 'download', 'title' => $lang['DOWNLOAD'], 'value' => isset($ex_values[$k]['download']) ? $ex_values[$k]['download'] : ''),
|
||||||
|
array('name' => 'rules', 'title' => $lang['RULES'], 'value' => isset($ex_values[$k]['rules']) ? $ex_values[$k]['rules'] : ''),
|
||||||
|
array('name' => 'guide', 'title' => $lang['GUIDE'], 'value' => isset($ex_values[$k]['guide']) ? $ex_values[$k]['guide'] : ''),
|
||||||
|
array('name' => 'stats', 'title' => $lang['STATS'], 'value' => isset($ex_values[$k]['stats']) ? $ex_values[$k]['stats'] : ''),
|
||||||
|
array('name' => 'reports', 'title' => $lang['REPORT'], 'value' => isset($ex_values[$k]['reports']) ? $ex_values[$k]['reports'] : ''),
|
||||||
|
array('name' => 'call', 'title' => $lang['CALL'], 'value' => isset($ex_values[$k]['call']) ? $ex_values[$k]['call'] : ''),
|
||||||
|
array('name' => 'profile', 'title' => $lang['PROFILE'], 'value' => isset($ex_values[$k]['profile']) ? $ex_values[$k]['profile'] : ''),
|
||||||
|
array('name' => 'fileuser', 'title' => $lang['YOUR_FILEUSER'], 'value' => isset($ex_values[$k]['fileuser']) ? $ex_values[$k]['fileuser'] : ''),
|
||||||
|
array('name' => 'login', 'title' => $lang['LOGIN'], 'value' => isset($ex_values[$k]['login']) ? $ex_values[$k]['login'] : ''),
|
||||||
|
array('name' => 'register', 'title' => $lang['REGISTER'], 'value' => isset($ex_values[$k]['register']) ? $ex_values[$k]['register'] : ''),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return compact('stylee', 'styleePath', 'extra_pages');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
'require_admin_page_begin_n_extra' => function ($args) {
|
||||||
|
|
||||||
|
if(ip('submit')){
|
||||||
|
|
||||||
|
$_POST['ex_header'] = '';
|
||||||
|
$_POST['ex_footer'] = '';
|
||||||
|
|
||||||
|
if(!empty($_POST['ex_header_x']) && is_array($_POST['ex_header_x'])){
|
||||||
|
foreach ($_POST['ex_header_x'] as $key => $value){
|
||||||
|
$_POST['ex_header'] .= "\n!!! start advanced_extras ". htmlspecialchars($key) ." !!!\n".$value."\n!!! end advanced_extras ". htmlspecialchars($key) ." !!!\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($_POST['ex_footer_x']) && is_array($_POST['ex_footer_x'])){
|
||||||
|
foreach ($_POST['ex_footer_x'] as $key => $value){
|
||||||
|
$_POST['ex_footer'] .= "\n!!! start advanced_extras ". htmlspecialchars($key) ." !!!\n".$value."\n!!! end advanced_extras ". htmlspecialchars($key) ." !!!\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
'Saaheader_links_func' => function($args){
|
||||||
|
|
||||||
|
$extras = $args['extras'];
|
||||||
|
$go_page = g('go', 'str',
|
||||||
|
defined('IN_DOWNLOAD') ? 'download' : (defined('IN_REAL_INDEX') ? 'index' : ''));
|
||||||
|
|
||||||
|
if(!empty($extras['header'])){
|
||||||
|
$ex_extras = advanced_extras_get_values($extras['header']);
|
||||||
|
|
||||||
|
$extras['header'] = $ex_extras['all'];
|
||||||
|
foreach ($ex_extras as $page=>$value){
|
||||||
|
if($page == $go_page){
|
||||||
|
$extras['header'] .= (trim($extras['header']) == '' ? '' : '<br>') . $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return compact('extras');
|
||||||
|
},
|
||||||
|
|
||||||
|
'Saafooter_func' => function($args){
|
||||||
|
|
||||||
|
$extras = $args['extras'];
|
||||||
|
$go_page = g('go', 'str',
|
||||||
|
defined('IN_DOWNLOAD') ? 'download' : (defined('IN_REAL_INDEX') ? 'index' : ''));
|
||||||
|
|
||||||
|
if(!empty($extras['footer'])){
|
||||||
|
$ex_extras = advanced_extras_get_values($extras['footer']);
|
||||||
|
|
||||||
|
$extras['footer'] = $ex_extras['all'];
|
||||||
|
foreach ($ex_extras as $page=>$value){
|
||||||
|
if($page == $go_page){
|
||||||
|
$extras['footer'] .= (trim($extras['footer']) == '' ? '' : '<br>') . $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return compact('extras');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* special functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!function_exists('advanced_extras_get_values')) {
|
||||||
|
function advanced_extras_get_values($content)
|
||||||
|
{
|
||||||
|
$re = '/!!! start advanced_extras ([a-zA-Z0-9_]+) !!!\n?(.*?)\n?!!! end advanced_extras \1 !!!/sm';
|
||||||
|
|
||||||
|
preg_match_all($re, $content, $matches, PREG_SET_ORDER, 0);
|
||||||
|
|
||||||
|
$values = array();
|
||||||
|
|
||||||
|
if(!empty($matches)) {
|
||||||
|
foreach ($matches as $match) {
|
||||||
|
$values[$match[1]] = $match[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user