Sindbad~EG File Manager
<?php
/*
* Security : blocking direct access
* Source : http://codex.wordpress.org/Theme_Development#Template_Files
*/
defined('ABSPATH') or die("Access Restricted");
/*
* Pre Tag
*
*/
add_shortcode("mcode", "mcode");
function mcode( $atts, $content = null ) {
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']'
);
$content = strtr($content, $array);
return '<pre>'.$content.'</pre>';
}
/*
* Description list horizontal
*
*/
add_shortcode("dlist", "dlist");
function dlist( $atts, $content = null ) {
if ( ! $content ) {
return $content;
}
wp_set_internal_encoding();
$doc = new DOMDocument();
$libxml_previous_state = libxml_use_internal_errors( true );
if (extension_loaded('mbstring')) {
$doc->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'));
} else {
$doc->loadHTML($content);
}
libxml_use_internal_errors( $libxml_previous_state );
$liList = $doc->getElementsByTagName('li');
$liValues = array();
$i = 0;
$out = '<dl class="dl-horizontal">';
foreach ($liList as $li) :
if (0 == $i % 2) {
$out.='<dt>'. $li->nodeValue .'</dt>';
} else {
$out.='<dd>'. $li->nodeValue.'</dd>';
}
$i++;
endforeach;
$out.='</dl>';
return $out;
}
/*
* Description list Vertical
*
*/
add_shortcode("dllistv", "dllistv");
function dllistv( $atts, $content = null ) {
if ( ! $content ) {
return $content;
}
wp_set_internal_encoding();
$doc = new DOMDocument();
$libxml_previous_state = libxml_use_internal_errors( true );
if (extension_loaded('mbstring')) {
$doc->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'));
} else {
$doc->loadHTML($content);
}
libxml_use_internal_errors( $libxml_previous_state );
$liList = $doc->getElementsByTagName('li');
$liValues = array();
$i = 0;
$out = '<dl>';
foreach ($liList as $li) :
if (0 == $i % 2) {
$out.='<dt>'. $li->nodeValue .'</dt>';
} else {
$out.='<dd>'. $li->nodeValue.'</dd>';
}
$i++;
endforeach;
$out.='</dl>';
return $out;
}
/*
* Videos
*
*/
add_shortcode('vid', 'add_shortcode_vid');
function add_shortcode_vid($atts, $content = null) {
extract(
shortcode_atts(array(
"id" => '',
"source" => ''),
$atts));
// facebook app sdk
if (mwp_option('facebook-app-enable') == '1') {
$facebook_appid = mwp_option('facebook-app-id');
$facebook_app_url = '//connect.facebook.net/'.mwp_locale().'/sdk.js#xfbml=1&appId='.sanitize_text_field($facebook_appid).'&version=v3.2';
} else {
$facebook_app_url = '//connect.facebook.net/'.mwp_locale().'/sdk.js#xfbml=1&version=v3.2';
}
global $post;
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
if ($source == 'youtube') {
return '<amp-youtube data-videoid="'.esc_attr($id).'" layout="responsive" width="480" height="270"></amp-youtube>';
} elseif ($source == 'vimeo') {
return '<amp-vimeo data-videoid="'.esc_attr($id).'" layout="responsive" width="500" height="281"></amp-vimeo>';
} elseif ($source == 'dailymotion') {
return '<amp-dailymotion data-videoid="'.esc_attr($id).'" layout="responsive" width="480" height="270"></amp-dailymotion>';
} elseif ($source == 'facebook') {
return '<amp-facebook width="552" height="310" layout="responsive" data-href="https://www.facebook.com/video.php?v='.esc_attr($id).'"></amp-facebook>';
}
} else {
if (mwp_option('lazyload-mobile') == 1) {
// https://github.com/WordPress/gutenberg/issues/2235#issuecomment-320379804
if ( is_singular() && false !== strpos( get_queried_object()->post_content, '<!-- wp:core-embed' ) && mwp_is_gb_active()) {
if ($source == 'youtube') {
return '<iframe width="600" height="300" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-src="//www.youtube.com/embed/'.esc_attr($id).'?vq=hd720&rel=0&controls=1&iv_load_policy=3&disablekb=1&modestbranding=1" allowfullscreen></iframe>';
} elseif ($source == 'vimeo') {
return '<iframe width="600" height="300" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-src="//player.vimeo.com/video/'.esc_attr($id).'?portrait=0&title=0&badge=0" allowfullscreen></iframe>';
} elseif ($source == 'dailymotion') {
return '<iframe width="600" height="300" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-src="//www.dailymotion.com/embed/video/'.esc_attr($id).'?info=0&logo=0&related=0" allowfullscreen></iframe>';
} elseif ($source == 'facebook') {
return '<div class="fb-video" data-href="https://www.facebook.com/video.php?v='.esc_attr($id).'" data-width="1000" data-allowfullscreen="true" data-autoplay="false" data-show-captions="true"></div><script async defer src="'.esc_url($facebook_app_url).'"></script>';
}
} else {
if ($source == 'youtube') {
return '<div class="vi-responsive"><iframe width="600" height="300" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-src="//www.youtube.com/embed/'.esc_attr($id).'?vq=hd720&rel=0&controls=1&iv_load_policy=3&disablekb=1&modestbranding=1" allowfullscreen></iframe></div>';
} elseif ($source == 'vimeo') {
return '<div class="vi-responsive"><iframe width="600" height="300" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-src="//player.vimeo.com/video/'.esc_attr($id).'?portrait=0&title=0&badge=0" allowfullscreen></iframe></div>';
} elseif ($source == 'dailymotion') {
return '<div class="vi-responsive"><iframe width="600" height="300" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" data-src="//www.dailymotion.com/embed/video/'.esc_attr($id).'?info=0&logo=0&related=0" allowfullscreen></iframe></div>';
} elseif ($source == 'facebook') {
return '<div class="block"><div class="fb-video" data-href="https://www.facebook.com/video.php?v='.esc_attr($id).'" data-width="1000" data-allowfullscreen="true" data-autoplay="false" data-show-captions="true"></div></div><script async defer src="'.esc_url($facebook_app_url).'"></script>';
}
}
} else {
// https://github.com/WordPress/gutenberg/issues/2235#issuecomment-320379804
if ( is_singular() && false !== strpos( get_queried_object()->post_content, '<!-- wp:core-embed' ) && mwp_is_gb_active()) {
if ($source == 'youtube') {
return '<iframe width="600" height="300" src="//www.youtube.com/embed/'.esc_attr($id).'?vq=hd720&rel=0&controls=1&iv_load_policy=3&disablekb=1&modestbranding=1" allowfullscreen></iframe>';
} elseif ($source == 'vimeo') {
return '<iframe width="600" height="300" src="//player.vimeo.com/video/'.esc_attr($id).'?portrait=0&title=0&badge=0" allowfullscreen></iframe>';
} elseif ($source == 'dailymotion') {
return '<iframe width="600" height="300" src="//www.dailymotion.com/embed/video/'.esc_attr($id).'?info=0&logo=0&related=0" allowfullscreen></iframe>';
} elseif ($source == 'facebook') {
return '<div class="fb-video" data-href="https://www.facebook.com/video.php?v='.esc_attr($id).'" data-width="1000" data-allowfullscreen="true" data-autoplay="false" data-show-captions="true"></div><script async defer src="'.esc_url($facebook_app_url).'"></script>';
}
} else {
if ($source == 'youtube') {
return '<div class="vi-responsive"><iframe width="600" height="300" src="//www.youtube.com/embed/'.esc_attr($id).'?vq=hd720&rel=0&controls=1&iv_load_policy=3&disablekb=1&modestbranding=1" allowfullscreen></iframe></div>';
} elseif ($source == 'vimeo') {
return '<div class="vi-responsive"><iframe width="600" height="300" src="//player.vimeo.com/video/'.esc_attr($id).'?portrait=0&title=0&badge=0" allowfullscreen></iframe></div>';
} elseif ($source == 'dailymotion') {
return '<div class="vi-responsive"><iframe width="600" height="300" src="//www.dailymotion.com/embed/video/'.esc_attr($id).'?info=0&logo=0&related=0" allowfullscreen></iframe></div>';
} elseif ($source == 'facebook') {
return '<div class="block"><div class="fb-video" data-href="https://www.facebook.com/video.php?v='.esc_attr($id).'" data-width="1000" data-allowfullscreen="true" data-autoplay="false" data-show-captions="true"></div></div><script async defer src="'.esc_url($facebook_app_url).'"></script>';
}
}
}
}
}
/*
* Notices
*
*/
add_shortcode("error", "error");
function error( $atts, $content = null ) {
ob_start();
$content = '<div class="content-note"><div class="alert alert-danger">'.$content.'</div></div>';
ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("information", "information");
function information( $atts, $content = null ) {
ob_start();
$content = '<div class="content-note"><div class="alert alert-info">'.$content.'</div></div>';
ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("notice", "notice");
function notice( $atts, $content = null ) {
ob_start();
$content = '<div class="content-note"><div class="alert alert-warning">'.$content.'</div></div>';
ob_get_contents();
ob_end_clean();
return $content;
}
add_shortcode("success", "success");
function success( $atts, $content = null ) {
ob_start();
$content = '<div class="content-note"><div class="alert alert-success">'.$content.'</div></div>';
ob_get_contents();
ob_end_clean();
return $content;
}
/*
* Buttons
*
*/
add_shortcode("button", "btn");
function btn( $atts, $content = null ) {
extract(shortcode_atts(array(
"text" => '',
"link" => '',
"sizes" => '',
"style" => '',
"nofollow" => '',
"target" => ''
),
$atts));
$esc_link = esc_url($link);
$esc_style = esc_attr($style);
$esc_sizes = esc_attr($sizes);
if ($nofollow == '1' && $target == '1') {
return '<span><a href="'.$esc_link.'" class="btn '. $esc_style .' '. $esc_sizes . '" role="button" rel="nofollow noopener">'.esc_attr($text).'</a></span>';
} elseif ($nofollow == '2' && $target == '1') {
return '<span><a href="'.$esc_link.'" class="btn '. $esc_style .' '. $esc_sizes . '" role="button">'.esc_attr($text).'</a></span>';
} elseif ($nofollow == '1' && $target == '2') {
return '<span><a href="'.$esc_link.'" class="btn '. $esc_style .' '. $esc_sizes . '" role="button" rel="nofollow noopener">'.esc_attr($text).'</a></span>';
} elseif ($nofollow == '2' && $target == '2') {
return '<span><a href="'.$esc_link.'" class="btn '. $esc_style .' '. $esc_sizes . '" role="button">'.esc_attr($text).'</a></span>';
}
}
/*
* Google Docs Viewer
*
*/
add_shortcode("docs", "docs_viewer");
function docs_viewer( $atts, $content = null ) {
extract(shortcode_atts(array(
"text" => '',
"link" => '',
"display" => ''
),
$atts));
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
return '<div><a class="embed" target="_blank" href="https://docs.google.com/viewerng/viewer?embedded=true&url='.esc_url($link).'">View File in Google Docs</a></div>';
} else {
return '<div><a class="embed" style="text-align: center; display: '.esc_attr($display).';" href="'.esc_url($link).'">'.esc_attr($text).'</a></div>';
}
}
/*
* Adsense
*
*/
add_shortcode("advert", "ads_code");
function ads_code( $atts, $content = null ) {
extract(shortcode_atts(array(
"share" => '',
"position" => '',
"screen" => '',
"client" => '',
"slot" => ''
),
$atts));
$esc_share = esc_attr($share);
$esc_screen = esc_attr($screen);
$esc_position = esc_attr($position);
$esc_slot = esc_attr($slot);
$esc_client = esc_attr($client);
// check if adsense on scroll enabled
if(mwp_option('adsense-on-scroll') == 0) {
$tag_script = '<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>';
} else {
$tag_script = '';
}
// Adsense - Revenu Share
if ($share == 1) {
if ($position == 'center') {
return '<div class="skip_css block-div '.$esc_screen.'">
<div class="centered">
'.mwp_ads_revenu_share(false, 'auto').'
</div>
</div>';
} else {
return '<div style="float:'.$esc_position.';" class="'.$esc_screen.'">
'.mwp_ads_revenu_share(false, 'auto').'
</div>';
}
}
// Adsense - Normal
else {
if ($position == 'center') {
return '
<div class="skip_css block-div '.$esc_screen.'">
<div class="centered">
'.$tag_script.'
<ins class="adsbygoogle adslot_pb"
style="display:inline-block"
data-ad-client="'.$esc_client.'"
data-ad-slot="'.$esc_slot.'"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div></div>';
} else {
return '<div style="float:'.$esc_position.';" class="'.$esc_screen.'">
'.$tag_script.'
<ins class="adsbygoogle adslot_pb"
style="display:inline-block"
data-ad-client="'.$esc_client.'"
data-ad-slot="'.$esc_slot.'"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>';
}
}
}
function get_inner_html( $node ) {
$innerHTML= '';
$children = $node->childNodes;
foreach ($children as $child) {
$innerHTML .= $child->ownerDocument->saveXML( $child );
}
return $innerHTML;
}
add_shortcode("proscons", "proscons");
function proscons( $atts, $content = null ) {
wp_set_internal_encoding();
$doc = new DOMDocument();
libxml_use_internal_errors(true);
if (extension_loaded('mbstring')) {
$doc->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'));
} else {
$doc->loadHTML($content);
}
$i = 0;
$para = $doc->getElementsByTagName('p');
$list = $doc->getElementsByTagName('ul');
$paragraph = array();
$lists = array();
foreach ($para as $p) :
$paragraph[] = $p->nodeValue;
$i++;
endforeach;
foreach ($list as $ul) :
$lists[] = $ul->ownerDocument->saveHTML($ul);
$i++;
endforeach;
$out = '<div class="proscons-wrapper">';
$out .= '<div class="proscons-column">';
$out .= '<div class="proscons-title proscons-title-bg1">'.$paragraph[0].'</div><div class="proscons-column-ul">';
$out .= $lists[0];
$out .= '</div></div>';
$out .= '<div class="proscons-column">';
$out .= '<div class="proscons-title proscons-title-bg2">'.$paragraph[1].'</div><div class="proscons-column-ul">';
$out .= $lists[1];
$out .= '</div></div>';
$out.='</div>';
return $out;
}
/*
* Old shortcodes
*
*/
if(function_exists('vsw_show_video')) {
add_shortcode("vsw", "vsw_show_video");
function vsw_show_video($atts, $content = null) {
extract(shortcode_atts(array(
"id" => ' ',
"source" => ' ',
"width" => ' ',
"height" => ' ',
"autoplay" => ' ',
), $atts));
return vsw_show_video_class($id,$source,$width,$height,$autoplay);
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists