Sindbad~EG File Manager
<?php
/*
* Security : blocking direct access
* Source : http://codex.wordpress.org/Theme_Development#Template_Files
*/
defined('ABSPATH') or die("Access Restricted");
/*
* if missing file_put_contents
*
if(!function_exists('file_put_contents')) {
function file_put_contents($filename, $data, $file_append = false) {
$fp = fopen($filename, (!$file_append ? 'w+' : 'a+'));
if(!$fp) {
trigger_error('file_put_contents cannot write in file.', E_USER_ERROR);
return;
}
fputs($fp, $data);
fclose($fp);
}
}
*/
/*
* Load In Backed Only
*/
if (is_admin()) {
/*
* Plugins Option CSS
* Force LTR Direction
*/
function mwp_plugin_direction_change() {
global $pagenow;
$list_pages = array(
'onesignal-push',
'w3tc_dashboard',
'w3tc_general',
'w3tc_pgcache',
'w3tc_minify',
'w3tc_dbcache',
'w3tc_browsercache',
'w3tc_mobile',
'w3tc_referrer',
'w3tc_pgcache_cookiegroups',
'w3tc_cdn',
'w3tc_extensions',
'wpsupercache'
);
foreach ($list_pages as $pages => $page) {
if (( $pagenow == 'admin.php' ) && ($_GET['page'] == $page)) {
if (is_rtl()) :
echo '<style>
html {overflow-x:hidden;}
.wrap,
.onesignal.site.container{direction:ltr !important;}
#w3tc .logo {margin-top:50px !important;}
#w3tc .postbox .handlediv {float:right !important;}
#w3tc p.submit {text-align: left !important;}
#w3tc .form-table th {text-align:left !important;}
</style>';
endif;
}
}
echo '<style>
.p3-results-table{direction:ltr !important;}
.toplevel_page_mwp-options .wp-menu-image img {padding:6px 0 0 !important;}
</style>';
}
add_action('admin_enqueue_scripts', 'mwp_plugin_direction_change');
/*
* Post Edit Sceen
* Display Post ID
*/
function add_content_after_editor() {
global $post;
echo '<div style="margin:5px 0 0;"><strong style="padding:0 10px;margin-top:5px;color:#666;">' . __('Post ID : ', MWP_TEXT_DOMAIN) .'</strong><input style="background-color:#fff;" type="text" name="cupostid" value="' . $post->ID . '" readonly></div>';
}
//add_action( 'edit_form_after_title', 'add_content_after_editor' );
/*
* Fix jQuery UI CSS Conflict
* Remove all Plugins style sheets inside Theme Panel only
*
*/
function mwp_plugin_fix_conflict_ui() {
global $wp_styles;
global $pagenow;
$page = isset($_GET['page']) ? $_GET['page'] : '';
if (( $pagenow == 'admin.php' ) && ($page == 'mwp-options') ||
( $pagenow == 'themes.php' ) && ($page == 'mwp-options')) {
$wp_styles->queue = array(
'admin-bar',
'colors',
'ie',
'wp-auth-check',
);
}
}
add_action('admin_enqueue_scripts', 'mwp_plugin_fix_conflict_ui');
}
/*
* Custom Posts Type Helper
*
*/
function mwp_cpt_list(){
$args = array(
'public' => true,
);
$output = 'names';
$operator = 'and';
$post_types = get_post_types( $args, $output, $operator );
return $post_types;
}
/*
* Get All Posts Type
*
*/
function mwp_get_all_post_types() {
$types = array();
$get_types = mwp_cpt_list();
$pt_remove = array(
"post",
"page",
"attachment",
"nav_menu_item",
"customize_changeset",
"revision",
);
foreach ( $get_types as $post_type ) :
if ( in_array($post_type, $pt_remove) ) continue;
$types[] = $post_type;
endforeach;
$types[] = array('post');
return $types;
}
/*
* Desciption : helpers for display inline styles
* Author : Mouad Achemli
*
*/
function custom_selectors_color(){
$categories = get_categories('hide_empty=0');
$cat_color_selector = array();
$cat_color_value = array();
foreach ($categories as $category) {
$option = mwp_option('cat-color'.$category->term_id);
$cat_color_selector[] = '.cat-color-'.$category->term_id;
$cat_color_value[] = $option['color'];
}
if (!empty($cat_color_value)) {
$wynik = array_combine($cat_color_selector, $cat_color_value);
return $wynik;
}
}
function custom_selectors_border(){
$categories = get_categories('hide_empty=0');
$cat_color_selector = array();
$cat_color_value = array();
foreach ($categories as $category) {
$option = mwp_option('cat-color'.$category->term_id);
$cat_color_selector[] = '.cat-border-'.$category->term_id;
$cat_color_value[] = $option['border'];
}
if (!empty($cat_color_value)) {
$wynik = array_combine($cat_color_selector, $cat_color_value);
return $wynik;
}
}
function custom_selectors_background(){
$categories = get_categories('hide_empty=0');
$cat_color_selector = array();
$cat_color_value = array();
foreach ($categories as $category) {
$option = mwp_option('cat-color'.$category->term_id);
$cat_color_selector[] = '.cat-background-'.$category->term_id;
$cat_color_value[] = $option['background'];
}
if (!empty($cat_color_value)) {
$wynik = array_combine($cat_color_selector, $cat_color_value);
return $wynik;
}
}
function widgets_default_skin() {
if(mwp_option('bg-container-disable') == 0) {
$bg_container = mwp_option('bg-container');
$bg_shadow = mwp_option('bg-container-shadow');
} elseif(mwp_option('bg-container-disable') == 1) {
$bg_container = null;
$bg_shadow = null;
}
$widgets_skins = mwp_option('default-widgets-skin');
if(!empty($widgets_skins['color'])) {
$widgets_color = $widgets_skins['color'];
} else {
$widgets_color = null;
}
if(!empty($widgets_skins['border'])) {
$widgets_border = $widgets_skins['border'];
} else {
$widgets_border = null;
}
if(!empty($widgets_skins['background'])) {
$widgets_background = $widgets_skins['background'];
} else {
$widgets_background = null;
}
$widget_selectors = array(
".bg-container" => $bg_container,
".bg-shadow" => $bg_shadow,
".default-widget-color" => $widgets_color,
".default-widget-border" => $widgets_border,
".default-widget-background" => $widgets_background,
"#wp-calendar caption" => $widgets_background
);
return $widget_selectors;
}
function print_custom_color(){
$selectors = custom_selectors_color();
$selectors2 = custom_selectors_border();
$selectors3 = custom_selectors_background();
$selectors4 = widgets_default_skin();
$output = '';
if (!empty($selectors)) {
foreach ($selectors as $selector => $value) {
if (!empty($value)) {
$output .= color_inline_style( $value , $selector);
}
}
}
if (!empty($selectors2)) {
foreach ($selectors2 as $selector => $value) {
if (!empty($value)) {
$output .= border_inline_style( $value , $selector);
}
}
}
if (!empty($selectors3)) {
foreach ($selectors3 as $selector => $value) {
if (!empty($value)) {
$output .= background_inline_style( $value , $selector);
}
}
}
foreach ($selectors4 as $selector => $value) {
if (!empty($value) && $selector == ".bg-container" ) {
$output .= background_inline_style( $value , $selector);
} elseif (!empty($value) && $selector == ".bg-shadow" ) {
$output .= shadow_inline_style( $value , $selector);
} elseif (!empty($value) && $selector == '.default-widget-color' ) {
$output .= color_inline_style( $value , $selector);
} elseif (!empty($value) && $selector == '.default-widget-border' ) {
$output .= border_inline_style( $value , $selector);
} elseif (!empty($value) && $selector == '.default-widget-background' ) {
$output .= background_inline_style( $value , $selector);
} elseif (!empty($value) && $selector == "#wp-calendar caption" ) {
$output .= background_inline_style( $value , $selector);
}
}
return $output;
}
function category_op_array(){
$categories = get_categories('hide_empty=0');
$cat_op = array();
$cat_id = array();
foreach ($categories as $category) {
$cat_op[] = 'cat-color'.$category->term_id;
$cat_id[] = $category->term_id;
}
if (!empty($cat_id)) {
$wynik = array_combine($cat_id, $cat_op);
return $wynik;
}
}
function color_per_category() {
$op_cats = category_op_array();
$output = '';
$color_selector = '.default-widget-color,.skin1-color,.skin2-color,.skin3-color,.skin4-color,.skin5-color,.skin6-color,.skin7-color';
$border_selector = '.default-widget-border,.skin1-border,.skin2-border,.skin3-border,.skin4-border,.skin5-border,.skin6-border,.skin7-border,.sf-mega ';
$background_selector = '.pcount,.menu-bg,.menu-pages li:hover,.menu-pages li.sfHover,.menu-pages a:focus,.menu-pages a:hover,.menu-pages a:active,.menu-pages li li:hover,.menu-pages li li.sfHover,.menu-pages li li a:focus,.menu-pages li li a:hover,.menu-pages li a:active,.menu-pages li.current-menu-item,.menu-pages li.current_page_item,.menu-pages li li,.menu-pages li li li,.logged a:hover,.login a:hover,.menu-category li.current_page_item ,.menu-category li.current-menu-item,.menu-category li.current-post-ancestor,.menu-category li li,.menu-category li li li,.menu-category li:hover,.menu-category li.sfHover,.menu-category a:focus,.menu-category a:hover,.menu-category a:active,.menu-category li li:hover,.menu-category li li.sfHover,.menu-category li li a:focus,.menu-category li li a:hover,.mega-category li.current_page_item,.mega-category li.current-menu-item,.mega-category li:hover,.mega-category li.sfHover,.mega-category a:focus,.mega-category a:hover,.mega-category a:active,.navbar-category ul li,.navbar-category ul ul li,.sf-navbar:before,.sf-navbar ul li,.sf-navbar li.current,.sf-navbar li:hover,.sf-navbar li.sfHover,.sf-navbar ul li.current,.sf-navbar ul li.current-menu-item,.sf-navbar ul li:hover,.sf-navbar ul li.sfHover,.sf-navbar ul ul li,.sf-navbar ul li.current > a,.sf-navbar ul li.current-menu-item > a,.sf-navbar ul ul li:hover,.sf-navbar ul ul li.sfHover,.sf-navbar ul ul li.current,.sf-navbar ul ul li.current-menu-item,.default-widget-background,#wp-calendar caption';
if (!empty($op_cats)) {
foreach ($op_cats as $cat => $op) {
$var = mwp_option($op);
if($var['color'] <> "" && $var['border'] <> "" && $var['background'] <> "") {
$color = $var['color'];
$border = $var['border'];
$background = $var['background'];
if (is_home()) {
} elseif(is_category($cat) || in_category($cat)) {
$output .= color_inline_style( $color , $color_selector);
$output .= border_inline_style( $border , $border_selector);
$output .= background_inline_style( $background , $background_selector);
$output .= color_per_category_el1();
$output .= color_per_category_el5();
$output .= color_per_category_el4();
$output .= color_per_category_el3();
$output .= color_per_category_el2();
$output .= borderb_inline_style( $border , '.menu-cat');
}
}
}
}
return $output;
}
function color_urgent() {
$urgent = mwp_option('urgent-news-color');
$output = '';
$output .= background_inline_style( $urgent , '.auto-hide');
return $output;
}
function background_per_cat() {
$op_cats = category_op_array();
$output = '';
foreach ($op_cats as $cat => $op) {
$var = mwp_option($op);
if($var['color'] <> "" && $var['border'] <> "" && $var['background'] <> "") {
$background = $var['background'];
if (is_home()) {
} elseif(is_category($cat) || in_category($cat)) {
$output .= background_inline_style( $background , 'body');
$output .= shadow_inline_style( '#333333' , '.bg-container');
}
}
}
return $output;
}
function color_per_category_el1() {
$selectors = '.menu-category li li:hover,.menu-category li li a:hover,.menu-category li li li:hover,.menu-category li li li a:hover,.menu-pages li li:hover,.menu-pages li li li:hover,.sf-navbar ul ul li:hover';
$output = $selectors . ' {';
$output .= 'text-indent:5px;';
$output .= '}';
$output .= "\n";
return $output;
}
function color_per_category_el2() {
$selectors = 'a.login-mobile:nth-of-type(2),.login a:last-child';
$output = $selectors . ' {';
$output .= 'border-right: 1px solid rgba(255, 255, 255, 0.1);';
$output .= '}';
$output .= "\n";
return $output;
}
function color_per_category_el3() {
$selectors = 'a.login-mobile,.login a:first-child';
$output = $selectors . ' {';
$output .= 'border-left: 1px solid rgba(0, 0, 0, 0.2);';
$output .= '}';
$output .= "\n";
return $output;
}
function color_per_category_el4() {
$selectors = '.navbar-category li li,.navbar-category li';
$output = $selectors . ' {';
$output .= 'border-left: 1px solid rgba(255, 255, 255, 0.1);';
$output .= 'border-right: 1px solid rgba(0, 0, 0, 0.2);';
$output .= '}';
$output .= "\n";
return $output;
}
function color_per_category_el5() {
$selectors = '.menu-pages li li,.menu-pages li li li,.menu-category li li,.menu-category li li li,.sf-navbar ul li ul li';
$output = $selectors . ' {';
$output .= 'border-top: 1px solid rgba(255, 255, 255, 0.1);';
$output .= 'border-bottom: 1px solid rgba(0, 0, 0, 0.2)';
$output .= '}';
$output .= "\n";
return $output;
}
function color_per_category_el6() {
$selectors = '.menu-pages li li,.menu-pages li li li,.menu-category li li,.menu-category li li li,.sf-navbar ul li ul li';
$output = $selectors . ' {';
$output .= 'border-top: 1px solid rgba(255, 255, 255, 0.1);';
$output .= 'border-bottom: 1px solid rgba(0, 0, 0, 0.2)';
$output .= '}';
$output .= "\n";
return $output;
}
function color_inline_style($value, $selectors) {
if( !empty( $value) ) {
$output = $selectors . ' {';
$output .= 'color:' . $value . ' !important; ';
$output .= '}';
$output .= "\n";
return $output;
}
}
function border_inline_style($value, $selectors) {
if( !empty( $value) ) {
$output = $selectors . ' {';
$output .= 'border-top:4px solid ' . $value . ' !important; ';
$output .= '}';
$output .= "\n";
return $output;
}
}
function borderb_inline_style($value, $selectors) {
if( !empty( $value) ) {
$output = $selectors . ' {';
$output .= 'border-bottom:4px solid ' . $value . ' !important; ';
$output .= '}';
$output .= "\n";
return $output;
}
}
function background_inline_style($value, $selectors) {
if( !empty( $value) ) {
$output = $selectors . ' {';
$output .= 'background-color:' . $value . ' !important; ';
$output .= '}';
$output .= "\n";
return $output;
}
}
function shadow_inline_style($value, $selectors) {
if( !empty( $value) ) {
$output = $selectors . ' {';
$output .= 'box-shadow:0 2px 5px -1px ' . $value . ' !important; ';
$output .= '-webkit-box-shadow:0 2px 5px -1px ' . $value . ' !important; ';
$output .= '-moz-box-shadow:0 2px 5px -1px ' . $value . ' !important; ';
$output .= '}';
$output .= "\n";
return $output;
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists