From 7657339897d44fa145cd8b8dd7e738a30e1a42b3 Mon Sep 17 00:00:00 2001 From: Abdulrahman Date: Mon, 17 Dec 2018 15:34:44 +0300 Subject: [PATCH] new plugin: x_sendfile --- plugins/kj_x_sendfile/index.html | 1 + plugins/kj_x_sendfile/init.php | 136 ++++++++++++++++++ .../languages/ar/LC_MESSAGES/index.html | 1 + .../ar/LC_MESSAGES/klj_x_sendfile.mo | Bin 0 -> 1293 bytes .../ar/LC_MESSAGES/klj_x_sendfile.po | 53 +++++++ plugins/kj_x_sendfile/languages/ar/index.html | 1 + plugins/kj_x_sendfile/languages/index.html | 1 + 7 files changed, 193 insertions(+) create mode 100755 plugins/kj_x_sendfile/index.html create mode 100644 plugins/kj_x_sendfile/init.php create mode 100755 plugins/kj_x_sendfile/languages/ar/LC_MESSAGES/index.html create mode 100644 plugins/kj_x_sendfile/languages/ar/LC_MESSAGES/klj_x_sendfile.mo create mode 100644 plugins/kj_x_sendfile/languages/ar/LC_MESSAGES/klj_x_sendfile.po create mode 100755 plugins/kj_x_sendfile/languages/ar/index.html create mode 100755 plugins/kj_x_sendfile/languages/index.html diff --git a/plugins/kj_x_sendfile/index.html b/plugins/kj_x_sendfile/index.html new file mode 100755 index 0000000..c4c6701 --- /dev/null +++ b/plugins/kj_x_sendfile/index.html @@ -0,0 +1 @@ +Powered by Kleeja

403 - Access forbidden!


Powered by Kleeja
\ No newline at end of file diff --git a/plugins/kj_x_sendfile/init.php b/plugins/kj_x_sendfile/init.php new file mode 100644 index 0000000..eee3c61 --- /dev/null +++ b/plugins/kj_x_sendfile/init.php @@ -0,0 +1,136 @@ + __('Kleeja X SendFile', 'klj_x_sendfile'), + # 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' => __('Enable x-sendfile or X-Accel-Redirect for both Apache or Nginx for better performance.', 'klj_x_sendfile'), + + # 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' => '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_x_sendfile']['first_run'] = __("Thanks for using our klj_x_sendfile plugin. To report bugs contact us on: \ninfo@kleeja.com"); + +# Plugin Installation function +$kleeja_plugin['kj_x_sendfile']['install'] = function() +{ + //new options + $options = array( + 'kj_x_sendfile_enable' => + array( + 'title' => 'Enable kj_x_sendfile', + 'value'=> '0', + 'plg_name' => 'kj_x_sendfile', + 'field' => 'yesno', + ), + 'kj_x_sendfile_type' => + array( + 'title' => 'Current Server for your hosting', + 'value'=> 'apache', + 'plg_name' => 'kj_x_sendfile', + 'field' => 'select', + ), + ); + + add_config($options); +}; + + +//Plugin update function, called if plugin is already installed but version is different than current +$kleeja_plugin['kj_x_sendfile']['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 + // } +}; + + +# Plugin Uninstallation, function to be called at unistalling +$kleeja_plugin['kj_x_sendfile']['uninstall'] = function() +{ + //delete options + delete_config(array( + 'kj_x_sendfile_enable', + 'kj_x_sendfile_type' + )); + +}; + + + +# Plugin functions +$kleeja_plugin['kj_x_sendfile']['functions'] = array( + + //select options for kj_x_sendfile_type + 'option_select_values_func' => function($args){ + if($args[0] == 'kj_x_sendfile_type') + { + $args[2] = '' . "\n" . + ''; + } + + //$args[2] is return by reference + }, + + 'after_endforeach_admin_page' => function(){ + add_to_adm_menu('kj_x_sendfile', __('kljXsendfile Settings', 'klj_x_sendfile')); + }, + 'do_page_before_headers_set' => function(){ + global $path_file, $config; + + if($config['kj_x_sendfile_enable'] == 0) + return; + + if($config['kj_x_sendfile_type'] == 'apache') + header('X-Sendfile: '. $path_file); + else + header('X-Accel-Redirect: ' . $path_file); + + // die(); + }, + + 'do_page_headers_set' => function(){ + //die(); + }, + 'adm_xoptions_titles' => function($args){ + $args[0] = array_merge($args[0], array( + 'kj_x_sendfile_enable' => __('Enable x-Sendfile/X-Accel-Redirect: header', 'klj_x_sendfile'), + 'kj_x_sendfile_type' => __('Current Server type for your hosting', 'klj_x_sendfile'), + )); + }, + 'end_common' => function(){ + get_lang('klj_x_sendfile', dirname(__FILE__) . '/languages', true); + } +); diff --git a/plugins/kj_x_sendfile/languages/ar/LC_MESSAGES/index.html b/plugins/kj_x_sendfile/languages/ar/LC_MESSAGES/index.html new file mode 100755 index 0000000..c4c6701 --- /dev/null +++ b/plugins/kj_x_sendfile/languages/ar/LC_MESSAGES/index.html @@ -0,0 +1 @@ +Powered by Kleeja

403 - Access forbidden!


Powered by Kleeja
\ No newline at end of file diff --git a/plugins/kj_x_sendfile/languages/ar/LC_MESSAGES/klj_x_sendfile.mo b/plugins/kj_x_sendfile/languages/ar/LC_MESSAGES/klj_x_sendfile.mo new file mode 100644 index 0000000000000000000000000000000000000000..f11d64ba4200b870b129165ab6627624b42ce07a GIT binary patch literal 1293 zcmaJ=(M}UV6de^c)+bGT(ua94G0{xff(ofo}8aNlrH3p zs2Zm!k4jPSq@q*BtWRyvRoqsz=u^*4(wO6ByxTL8LfrOd393vS))<2ul=sPq^rq1% z8%(otA$`ZBw&*3|R%|p9V#9vcNwYhUV<|65ds;MZ#YP^cSf3PJp%A;vl}OSKE78TQ zt1NMyT2`{-+7+wQvJi+V&pAf$-*H`yxFPOli#&@uT*ih6hx?m0jjuj5jf-X}+;EaA zF|XPSdG5G3sGZ}|7wYDt)Bx*l#!2q_86jD}YkO%-AW6HY92FblK8l#bJXfB?_zr|w zO7L0iC)hpV3fVXv@$f;qjh0&9>6VD(eDiVdnDse*)x`Lm>VC^XlQ9O!rEyrg&0LRd1<#!gj# zghDw^&~c+%sH{hc(QInS2u#}q3QKxh2c}?SI$Nf!@oumP9OK4yMc3#-AI669 wicx%tY#mH$U2mXvpua_B_It%u{#e`uUjJD9(DHtb>3Y91;(4?h|58)bq5G5`Po literal 0 HcmV?d00001 diff --git a/plugins/kj_x_sendfile/languages/ar/LC_MESSAGES/klj_x_sendfile.po b/plugins/kj_x_sendfile/languages/ar/LC_MESSAGES/klj_x_sendfile.po new file mode 100644 index 0000000..0f39206 --- /dev/null +++ b/plugins/kj_x_sendfile/languages/ar/LC_MESSAGES/klj_x_sendfile.po @@ -0,0 +1,53 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Kleeja Team +# This file is distributed under the same license as the klj_x_sendfile package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: klj_x_sendfile 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-04-16 00:25+0300\n" +"PO-Revision-Date: 2017-04-16 00:27+0300\n" +"Language: ar\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Last-Translator: \n" +"Language-Team: \n" +"X-Generator: Poedit 2.0.1\n" + +#: init.php:24 +msgid "Kleeja X SendFile" +msgstr "إضافة إكس سيدفايل" + +#: init.php:30 +msgid "" +"Enable x-sendfile or X-Accel-Redirect for both Apache or Nginx for better " +"performance." +msgstr "" +"قم بتفعيل الخاصية x-sendfile أو X-Accel-Redirect الموجودة على خوادم " +"أباتشي أو انجن اكس لأداء أفضل في التحمل." + +#: init.php:41 +msgid "" +"Thanks for using our klj_x_sendfile plugin. To report bugs contact us " +"on: \n" +"info@kleeja.com" +msgstr "" +"شكرا لإستخدام إضافتنا klj_x_sendfile . عند وجود أي أخطاء قم بإبلاغنا " +"على : \n" +"‬\n" +"‏‫info@kleeja.com" + +#: init.php:109 +msgid "kljXsendfile Settings" +msgstr "إعدادات kljXsendfile" + +#: init.php:130 +msgid "Enable x-Sendfile/X-Accel-Redirect: header" +msgstr "تفعيل خاصية x-Sendfile/X-Accel-Redirect" + +#: init.php:131 +msgid "Current Server type for your hosting" +msgstr "نوع السيرفر الخاص بإستضافتك" diff --git a/plugins/kj_x_sendfile/languages/ar/index.html b/plugins/kj_x_sendfile/languages/ar/index.html new file mode 100755 index 0000000..c4c6701 --- /dev/null +++ b/plugins/kj_x_sendfile/languages/ar/index.html @@ -0,0 +1 @@ +Powered by Kleeja

403 - Access forbidden!


Powered by Kleeja
\ No newline at end of file diff --git a/plugins/kj_x_sendfile/languages/index.html b/plugins/kj_x_sendfile/languages/index.html new file mode 100755 index 0000000..c4c6701 --- /dev/null +++ b/plugins/kj_x_sendfile/languages/index.html @@ -0,0 +1 @@ +Powered by Kleeja

403 - Access forbidden!


Powered by Kleeja
\ No newline at end of file