Sindbad~EG File Manager
<?php
function student2_plugin_fonticons() {
return json_decode( student2_filesystem()->get_contents( STUDENT2_PLUGIN_PATH . '/resource/fonticons.json' ), true );
$file = wp_remote_get( get_template_directory_uri() . '/assets/css/font-awesome.css' );
$pattern = '/\.(fa-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/';
preg_match_all( $pattern, wp_remote_retrieve_body( $file ), $matches );
$icons = array_combine( $matches[1], $matches[1] );
file_put_contents( STUDENT2_PLUGIN_PATH . '/resource/fonticons.json', json_encode( $icons ) );
return $icons;
}
function student2_filesystem() {
require_once ABSPATH . '/wp-admin/includes/file.php';
/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
$creds = request_filesystem_credentials( site_url() . '/wp-admin/', '', false, false, array() );
/* initialize the API */
if ( ! WP_Filesystem( $creds ) ) {
/* any problems and we exit */
return false;
}
global $wp_filesystem;
/* do our file manipulations below */
return $wp_filesystem;
}
add_filter('deeds_redux_custom_fonts_load', 'deeds_redux_custom_fonts_load');
function deeds_redux_custom_fonts_load( $custom_font ) {
$custom_style = '';
$pathinfo = pathinfo( $custom_font );
if ( $filename = deeds_set( $pathinfo, 'filename' ) ) {
$custom_style .= '@font-face{
font-family:"' . $filename . '";';
$extensions = array( 'eot', 'woff', 'woff2', 'ttf', 'svg' );
$count = 0;
foreach ( $extensions as $extension ) {
$file_path = esc_url(home_url('/')) . '/wp-content/themes/deeds/assets/css/custom-fonts/' . $filename . '.' . $extension;
$file_url = esc_url(get_template_directory_uri()) . '/assets/css/custom-fonts/' . $filename . '.' . $extension;
if ( $file_path ) {
$format = $extension;
if ( $extension === 'eot' ) {
$format = 'embedded-opentype';
}
if ( $extension === 'ttf' ) {
$format = 'truetype';
}
$terminated = ( $count > 0 ) ? ';' : '';
$custom_style .= $terminated . 'src:url("' . $file_url . '") format("' . $format . '")';
$count ++;
}
}
$custom_style .= ';}';
}
return $custom_style;
}
/**
* [deeds_social_share_output description]
*
* @param [type] $comment [description].
* @param [type] $args [description].
* @param [type] $depth [description].
*
* @return void [description]
*/
function deeds_social_share_output( $icon, $color = false ) {
$permalink = get_permalink( get_the_ID() );
$titleget = get_the_title();
$allowed_html = wp_kses_allowed_html( 'post' );
if ( $icon == 'facebook' ) {
$fb = ( $color == 1 ) ? 'style="color:#3b5998"' : '';
?>
<li>
<a onClick="window.open('http://www.facebook.com/sharer.php?u=<?php echo esc_url( $permalink ); ?>', 'Facebook', 'width=600,height=300,left=' + (screen.availWidth / 2 - 300) + ',top=' + (screen.availHeight / 2 - 150) + '');
return false;" href="http://www.facebook.com/sharer.php?u=<?php echo esc_url( $permalink ); ?>">
<i class="fa fa-facebook" <?php echo wp_kses( $fb, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php
if ( $icon == 'twitter' ) {
$twitter = ( $color == 1 ) ? 'style="color:#00aced"' : '';
?>
<li>
<a onClick="window.open('http://twitter.com/share?url=<?php echo esc_url( $permalink ); ?>&text=<?php echo str_replace( " ", "%20", $titleget ); ?>', 'Twitter share', 'width=600,height=300,left=' + (screen.availWidth / 2 - 300) + ',top=' + (screen.availHeight / 2 - 150) + '');
return false;" href="http://twitter.com/share?url=<?php echo esc_url( $permalink ); ?>&text=<?php echo str_replace( " ", "%20", $titleget ); ?>">
<i class="fa fa-twitter" <?php echo wp_kses( $twitter, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php
if ( $icon == 'digg' ) {
$digg = ( $color == 1 ) ? 'style="color:#000000"' : '';
?>
<li>
<a onClick="window.open('http://www.digg.com/submit?url=<?php echo esc_url( $permalink ); ?>', 'Digg', 'width=715,height=330,left=' + (screen.availWidth / 2 - 357) + ',top=' + (screen.availHeight / 2 - 165) + '');
return false;" href="http://www.digg.com/submit?url=<?php echo esc_url( $permalink ); ?>">
<i class="fa fa-digg" <?php echo wp_kses( $digg, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php
if ( $icon == 'reddit' ) {
$reddit = ( $color == 1 ) ? 'style="color:#ff5700"' : '';
?>
<li>
<a onClick="window.open('http://reddit.com/submit?url=<?php echo esc_url( $permalink ); ?>&title=<?php echo str_replace( " ", "%20", $titleget ); ?>', 'Reddit', 'width=617,height=514,left=' + (screen.availWidth / 2 - 308) + ',top=' + (screen.availHeight / 2 - 257) + '');
return false;" href="http://reddit.com/submit?url=<?php echo esc_url( $permalink ); ?>&title=<?php echo str_replace( " ", "%20", $titleget ); ?>">
<i class="fa fa-reddit" <?php echo wp_kses( $reddit, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php
if ( $icon == 'linkedin' ) {
$linkeding = ( $color == 1 ) ? 'style="color:#007bb6"' : '';
?>
<li>
<a onClick="window.open('http://www.linkedin.com/shareArticle?mini=true&url=<?php echo esc_url( $permalink ); ?>', 'Linkedin', 'width=863,height=500,left=' + (screen.availWidth / 2 - 431) + ',top=' + (screen.availHeight / 2 - 250) + '');
return false;" href="http://www.linkedin.com/shareArticle?mini=true&url=<?php echo esc_url( $permalink ); ?>">
<i class="fa fa-linkedin" <?php echo wp_kses( $linkeding, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php if ( $icon == 'pinterest' ) {
$pinterest = ( $color == 1 ) ? 'style=color:#cb2027' : '';
?>
<li>
<a href='javascript:void((function(){var e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)})())'>
<i class="fa fa-pinterest" <?php echo wp_kses( $pinterest, $allowed_html ); ?>></i></a>
</li>
<?php } ?>
<?php
if ( $icon == 'stumbleupon' ) {
$stumbleupon = ( $color == 1 ) ? 'style="color:#EB4823"' : '';
?>
<li>
<a onClick="window.open('http://www.stumbleupon.com/submit?url=<?php echo esc_url( $permalink ); ?>&title=<?php echo str_replace( " ", "%20", $titleget ); ?>', 'Stumbleupon', 'width=600,height=300,left=' + (screen.availWidth / 2 - 300) + ',top=' + (screen.availHeight / 2 - 150) + '');
return false;" href="http://www.stumbleupon.com/submit?url=<?php echo esc_url( $permalink ); ?>&title=<?php echo str_replace( " ", "%20", $titleget ); ?>">
<i class="fa fa-stumbleupon" <?php echo wp_kses( $stumbleupon, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php
if ( $icon == 'tumblr' ) {
$tumblr = ( $color == 1 ) ? 'style="color:#32506d"' : '';
$str = $permalink;
$str = preg_replace( '#^https?://#', '', $str );
?>
<li>
<a onClick="window.open('http://www.tumblr.com/share/link?url=<?php echo esc_attr( $str ); ?>&name=<?php echo str_replace( " ", "%20", $titleget ); ?>', 'Tumblr', 'width=600,height=300,left=' + (screen.availWidth / 2 - 300) + ',top=' + (screen.availHeight / 2 - 150) + '');
return false;" href="http://www.tumblr.com/share/link?url=<?php echo esc_attr( $str ); ?>&name=<?php echo str_replace( " ", "%20", $titleget ); ?>">
<i class="fa fa-tumblr" <?php echo wp_kses( $tumblr, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php
if ( $icon == 'email' ) {
$mail = ( $color == 1 ) ? 'style="color:#000000"' : '';
?>
<li>
<a href="mailto:?Subject=<?php echo str_replace( " ", "%20", $titleget ); ?>&Body=<?php echo esc_url( $permalink ); ?>"><i class="fa fa-envelope-o" <?php echo wp_kses( $mail, $allowed_html ); ?>></i></a>
</li>
<?php
}
}
add_action('deeds_social_share_output', 'deeds_social_share_output');
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists