This commit is contained in:
KhaiNguyen
2020-02-13 10:39:37 +07:00
commit 59401cb805
12867 changed files with 4646216 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
/*
Copyright 2015-2020 John Havlik (email : john.havlik@mtekk.us)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
//If this file is included directly (e.g. WordPress isn't running), return 404
if(!defined('ABSPATH'))
{
//First catches the Apache users
header("HTTP/1.0 404 Not Found");
//This should catch FastCGI users
header("Status: 404 Not Found");
die();
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,99 @@
<?php
/*
Copyright 2015-2020 John Havlik (email : john.havlik@mtekk.us)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once(dirname(__FILE__) . '/block_direct_access.php');
class mtekk_adminKit_message
{
const version = '1.0.0';
protected $type = '';
protected $contents = '';
protected $dismissed = false;
protected $dismissible = false;
protected $uid;
/**
* Default constructor function
*
* @param string $contents The string to display in the message
* @param string $type The message type, 'error', 'warning', 'success', or 'info'
* @param bool $dismissible Whether or not the message is dismissable
* @param string $uid The message unique ID, only necessary if the message is dismissable
*/
public function __construct($contents, $type = 'info', $dismissible = false, $uid = '')
{
$uid = sanitize_html_class($uid);
//If the message is dismissable, the UID better not be null/empty
if($dismissible === true && $uid === '')
{
//Let the user know they're doing it wrong
_doing_it_wrong(__CLASS__ . '::' . __FUNCTION__, __('$uid must not be null if message is dismissible', 'mtekk_adminKit'), '1.0.0');
//Treat the message as non-dismissible
$dismissible = false;
}
$this->contents = $contents;
$this->type = $type;
$this->dismissible = $dismissible;
$this->uid = $uid;
if($this->dismissible)
{
$this->dismissed = $this->was_dismissed();
}
}
/**
* Attempts to retrieve the dismissal transient for this message
*
* @return bool Whether or not the message has been dismissed
*/
public function was_dismissed()
{
$this->dismissed = get_transient($this->uid);
return $this->dismissed;
}
/**
* Dismisses the message, preventing it from being rendered
*/
public function dismiss()
{
if($this->dismissible && isset($_POST['uid']) && esc_attr($_POST['uid']) === $this->uid)
{
check_ajax_referer($this->uid . '_dismiss', 'nonce');
$this->dismissed = true;
//If the message was dismissed, update the transient for 30 days
$result = set_transient($this->uid, $this->dismissed, 2592000);
}
}
/**
* Function that prints out the message if not already dismissed
*/
public function render()
{
if($this->dismissible)
{
//Don't render dismissed messages
if($this->was_dismissed())
{
return;
}
wp_enqueue_script('mtekk_adminkit_messages');
printf('<div class="notice notice-%1$s is-dismissible"><p>%2$s</p><meta property="uid" content="%3$s"><meta property="nonce" content="%4$s"></div>', esc_attr($this->type), $this->contents, esc_attr($this->uid), wp_create_nonce($this->uid . '_dismiss'));
}
else
{
printf('<div class="notice notice-%1$s"><p>%2$s</p></div>', esc_attr($this->type), $this->contents);
}
}
}

View File

@@ -0,0 +1,70 @@
<?php
/*
Copyright 2015-2020 John Havlik (email : john.havlik@mtekk.us)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once(dirname(__FILE__) . '/block_direct_access.php');
/**
* Breadcrumb NavXT abstract plugin uninstaller class
*
* @author Tom Klingenberg
*/
abstract class mtekk_adminKit_uninstaller
{
protected $unique_prefix = '';
protected $plugin_basename = null;
protected $_uninstall_result = false;
/**
* get plugin path
*
* @return string full path to plugin file
*/
protected function _get_plugin_path()
{
return sprintf('%s/%s', dirname(dirname(__FILE__)), $this->plugin_basename);
}
/**
* constructor
*
* @param array $options class options
* plugin =>
*/
public function __construct()
{
$this->_uninstall_result = $this->uninstall();
}
/**
* Result Getter
*
* @return bool wether or not uninstall did run successfull.
*/
public function get_result()
{
return $this->_uninstall_result;
}
public function is_installed()
{
return ((get_option($this->unique_prefix . '_options') !== false)
&& (get_option($this->unique_prefix . '_options_bk') !== false)
&& (get_option($this->unique_prefix . '_version') !== false)
&& (get_site_option($this->unique_prefix . '_options') !== false)
&& (get_site_option($this->unique_prefix . '_options_bk') !== false)
&& (get_site_option($this->unique_prefix . '_version') !== false));
}
} /// class bcn_uninstaller_abstract

View File

@@ -0,0 +1,37 @@
jQuery(function()
{
jQuery(".adminkit-engroup input:checkbox.adminkit-enset-ctrl").each(mtekk_admin_enable_group);
jQuery("input:checkbox.adminkit-enset-ctrl").each(mtekk_admin_enable_set);
});
function mtekk_admin_enable_group(){
var setting = this;
jQuery(this).parents(".adminkit-engroup").find("input, textarea").each(function(){
if(this != setting){
if(jQuery(setting).prop("checked")){
jQuery(this).prop("disabled", false);
jQuery(this).removeClass("disabled");
}
else{
jQuery(this).prop("disabled", true);
jQuery(this).addClass("disabled");
}
}
});
}
function mtekk_admin_enable_set(){
var setting = this;
jQuery(this).parents(".adminkit-enset-top").find("input.adminkit-enset, textarea.adminkit-enset").each(function(){
if(this != setting){
if(jQuery(setting).prop("checked")){
jQuery(this).prop("disabled", false);
jQuery(this).removeClass("disabled");
}
else{
jQuery(this).prop("disabled", true);
jQuery(this).addClass("disabled");
}
}
});
}
jQuery(".adminkit-engroup input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_group);
jQuery("input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_set);

View File

@@ -0,0 +1 @@
jQuery(function(){jQuery(".adminkit-engroup input:checkbox.adminkit-enset-ctrl").each(mtekk_admin_enable_group);jQuery("input:checkbox.adminkit-enset-ctrl").each(mtekk_admin_enable_set)});function mtekk_admin_enable_group(){var a=this;jQuery(this).parents(".adminkit-engroup").find("input, textarea").each(function(){if(this!=a){if(jQuery(a).prop("checked")){jQuery(this).prop("disabled",false);jQuery(this).removeClass("disabled")}else{jQuery(this).prop("disabled",true);jQuery(this).addClass("disabled")}}})}function mtekk_admin_enable_set(){var a=this;jQuery(this).parents(".adminkit-enset-top").find("input.adminkit-enset, textarea.adminkit-enset").each(function(){if(this!=a){if(jQuery(a).prop("checked")){jQuery(this).prop("disabled",false);jQuery(this).removeClass("disabled")}else{jQuery(this).prop("disabled",true);jQuery(this).addClass("disabled")}}})}jQuery(".adminkit-engroup input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_group);jQuery("input:checkbox.adminkit-enset-ctrl").change(mtekk_admin_enable_set);

View File

@@ -0,0 +1,11 @@
jQuery(function()
{
jQuery("div.notice button.notice-dismiss").click(function (event){
data = {
'action': 'mtekk_admin_message_dismiss',
'uid': jQuery(this).parent().children("meta[property='uid']").attr("content"),
'nonce': jQuery(this).parent().children("meta[property='nonce']").attr("content")
};
jQuery.post(ajaxurl, data);
});
});

View File

@@ -0,0 +1,11 @@
jQuery(function()
{
jQuery("div.notice button.notice-dismiss").click(function (event){
data = {
'action': 'mtekk_admin_message_dismiss',
'uid': jQuery(this).parent().children("meta[property='uid']").attr("content"),
'nonce': jQuery(this).parent().children("meta[property='nonce']").attr("content")
};
jQuery.post(ajaxurl, data);
});
});

View File

@@ -0,0 +1,8 @@
#hasadmintabs ul.ui-tabs-nav{float: left; width: 100%; border-bottom:1px solid #ccc; font-size:12px; height:27px; list-style-image:none; list-style-position:outside; list-style-type:none; margin:14px 0 0; overflow:visible;padding:0 0 0 6px;}
#hasadmintabs ul.ui-tabs-nav li{display:block; float:left; line-height:200%; list-style-image:none; list-style-position:outside; list-style-type:none; margin:0; padding:0; position:relative; text-align:center; white-space:nowrap; width:auto;}
#hasadmintabs ul.ui-tabs-nav li a{border-bottom:1px solid #ccc; display:block; color:#464646; float:left; line-height:25px; padding:1px 13px 0; position:relative; text-decoration:none;margin:0 4px 0 0;}
#hasadmintabs ul.ui-tabs-nav li.ui-tabs-active a{background:none;border:1px solid #ccc; border-bottom-color:#f1f1f1; height: 25px; color:#464646; font-weight:normal; padding:1px 13px 0;color:#000;}
#hasadmintabs ul.ui-tabs-nav li.ui-tabs-active a:hover, #hasadmintabs ul.ui-tabs-nav a:hover{outline-color:-moz-use-text-color; outline-style:none; outline-width:medium;}
#hasadmintabs ul.ui-tabs-nav li a:focus, #hasadmintabs ul.ui-tabs-nav li a:active{outline: none;}
#hasadmintabs ul.ui-tabs-nav span{font-size: 12px; font-weight: bolder;}
#screen-options-wrap p.submit {margin:0; padding:0;}

View File

@@ -0,0 +1,39 @@
jQuery(function()
{
mtekk_admin_tabulator_init();
});
/**
* Tabulator Bootup
*/
function mtekk_admin_tabulator_init(){
if(!jQuery("#hasadmintabs").length) return;
/* init markup for tabs */
jQuery('#hasadmintabs').prepend('<ul class="nav-tab-wrapper"><\/ul>');
jQuery('#hasadmintabs > fieldset').each(function(i){
id = jQuery(this).attr('id');
cssc = jQuery(this).attr('class');
title = jQuery(this).find('legend').data('title');
caption = jQuery(this).find('legend').text();
jQuery('#hasadmintabs > ul').append('<li><a href="#'+id+'" class="nav-tab '+cssc+'" title="'+title+'"><span>'+caption+"<\/span><\/a><\/li>");
});
var form = jQuery('#'+objectL10n.mtad_uid+'-options');
/* init the tabs plugin */
var tabs = jQuery("#hasadmintabs").tabs({
beforeActivate: function(event, ui){
form.find('input').each(function(){
if(!this.checkValidity()){
form.find(':submit').click();
event.preventDefault();
}
});
/* Update form action for reload on tab traversal*/
var action = form.attr("action").split('#', 1) + '#' + ui.newPanel[0].id;
form.get(0).setAttribute("action", action);
},
create: function(event, ui){
/* Update form action for reload of current tab on page load */
var action = form.attr("action").split('#', 1) + '#' + ui.panel[0].id;
form.get(0).setAttribute("action", action);
}
});
}

View File

@@ -0,0 +1 @@
#hasadmintabs ul.ui-tabs-nav{float:left;width:100%;border-bottom:1px solid #ccc;font-size:12px;height:27px;list-style-image:none;list-style-position:outside;list-style-type:none;margin:14px 0 0;overflow:visible;padding:0 0 0 6px}#hasadmintabs ul.ui-tabs-nav li{display:block;float:left;line-height:200%;list-style-image:none;list-style-position:outside;list-style-type:none;margin:0;padding:0;position:relative;text-align:center;white-space:nowrap;width:auto}#hasadmintabs ul.ui-tabs-nav li a{border-bottom:1px solid #ccc;display:block;color:#464646;float:left;line-height:25px;padding:1px 13px 0;position:relative;text-decoration:none;margin:0 4px 0 0}#hasadmintabs ul.ui-tabs-nav li.ui-tabs-active a{background:0;border:1px solid #ccc;border-bottom-color:#f1f1f1;height:25px;color:#464646;font-weight:normal;padding:1px 13px 0;color:#000}#hasadmintabs ul.ui-tabs-nav li.ui-tabs-active a:hover,#hasadmintabs ul.ui-tabs-nav a:hover{outline-color:-moz-use-text-color;outline-style:none;outline-width:medium}#hasadmintabs ul.ui-tabs-nav li a:focus,#hasadmintabs ul.ui-tabs-nav li a:active{outline:0}#hasadmintabs ul.ui-tabs-nav span{font-size:12px;font-weight:bolder}#screen-options-wrap p.submit{margin:0;padding:0}

View File

@@ -0,0 +1 @@
function mtekk_admin_tabulator_init(){if(jQuery("#hasadmintabs").length){jQuery("#hasadmintabs").prepend('<ul class="nav-tab-wrapper"></ul>'),jQuery("#hasadmintabs > fieldset").each(function(t){id=jQuery(this).attr("id"),cssc=jQuery(this).attr("class"),title=jQuery(this).find("legend").data("title"),caption=jQuery(this).find("legend").text(),jQuery("#hasadmintabs > ul").append('<li><a href="#'+id+'" class="nav-tab '+cssc+'" title="'+title+'"><span>'+caption+"</span></a></li>")});var e=jQuery("#"+objectL10n.mtad_uid+"-options");jQuery("#hasadmintabs").tabs({beforeActivate:function(t,a){e.find("input").each(function(){this.checkValidity()||(e.find(":submit").click(),t.preventDefault())});var i=e.attr("action").split("#",1)+"#"+a.newPanel[0].id;e.get(0).setAttribute("action",i)},create:function(t,a){var i=e.attr("action").split("#",1)+"#"+a.panel[0].id;e.get(0).setAttribute("action",i)}})}}jQuery(function(){mtekk_admin_tabulator_init()});

View File

@@ -0,0 +1,111 @@
<?php
/*
A small library that adds in fallbacks for some of the PHP multibyte string
functions. Mainly inteneded to be used with Breadcrumb NavXT
Copyright 2009-2020 John Havlik (email : john.havlik@mtekk.us)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once(dirname(__FILE__) . '/block_direct_access.php');
if(!function_exists('mb_strlen'))
{
/**
* Fallback for mb_strlen for users without multibyte support
*
* @param string $string the string to determine the lenght of
* @return int the number of characters in the string
*/
function mb_strlen($string)
{
return strlen($string);
}
}
if(!function_exists('mb_strpos'))
{
/**
* Fallback for mb_strpos for users without multibyte support
*
* @param string $haystack the string to search within
* @param string $needle the string to search for
* @return mixed position of the first instances of needle, or false if needle not found
*/
function mb_strpos($haystack, $needle, $offset = 0)
{
return strpos($haystack, $needle, $offset);
}
}
if(!function_exists('mb_substr'))
{
/**
* Fallback for mb_substr for users without multibyte support
*
* @param string $string the input string
* @param int $start the start
* @param int length the length of the substring
* @return string the substring of specified length
*/
function mb_substr($string, $start, $length = 'a')
{
//This happens to be the easiest way to preserve the behavior of substr
if($length = 'a')
{
return substr($string, $start);
}
else
{
return substr($string, $start, $length);
}
}
}
if(!function_exists('mb_strtolower'))
{
/**
* Fallback for mb_strtolower for users without multibyte support
*
* @param string $str the string to change to lowercase
* @param string $encoding the encoding of the string
* @return string the lowercase string
*/
function mb_strtolower($str, $encoding = 'UTF-8')
{
return strtolower($str);
}
}
//We need this constant to be defined, otherwise things will break
if(!defined('MB_CASE_TITLE'))
{
define('MB_CASE_TITLE', '1');
}
if(!function_exists('mb_convert_case'))
{
/**
* A very hacky fallback for mb_convert_case for users without multibyte support
*
* @param string $str the string to change the case on
* @param int $mode the mode of case convert to use
* @param string $encoding the encoding of the string
* @return string the case converted string
*/
function mb_convert_case($str, $mode = MB_CASE_TITLE, $encoding = 'UTF-8')
{
//Only implementing MB_CASE_TITLE
if($mode = MB_CASE_TITLE)
{
return ucwords($str);
}
return $str;
}
}