This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Is_bot | |
* traque la présence d'un bot par plage d'ip | |
* | |
* @param string $ip | |
* @param array $array_bots | |
* @return string|false | |
*/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#lier le logo en header à la catégorie | |
add_filter( 'genesis_seo_title', 'child_header_title', 10, 3 ); | |
function child_header_title( $title, $inside, $wrap ) { | |
if(is_singular('post')){ | |
$category_id = get_the_category(); | |
$id = $category_id[0]->term_id; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#shortcode dans input form | |
add_filter( 'wp_kses_allowed_html', 'allow_tag_in_input', 10, 2 ); | |
function allow_tag_in_input( $allowedposttags, $context ) { | |
if ( $context == 'post' ) { | |
$allowedposttags['input']['value'] = 1; | |
} | |
return $allowedposttags; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (function() { | |
function extractHostname(url) { | |
var hostname; | |
if (url.indexOf("://") > -1) { | |
hostname = url.split('/')[2]; | |
} | |
else { | |
hostname = url.split('/')[0]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setInterval(function() { window.scrollTo(0, document.body.scrollHeight); }, 5000); | |
__count__=0; | |
jQuery('.Grid-cell .not-following .follow-text').each(function (i, ele) { | |
ele = jQuery(ele); | |
if (ele.css('display')!='block') { | |
console.log('deja suivi:', i); | |
return; | |
} setTimeout(function () { | |
ele.click(); | |
}, __count__++*500); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function spin($txt){ | |
$pattern = '#\{([^{}]*)\}#msi'; | |
$test = preg_match_all($pattern, $txt, $out); | |
if(!$test) | |
return $txt; | |
$a_trouver = array(); | |
$a_remplacer = array(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Is_bot | |
* traque la présence d'un bot par plage d'ip | |
* | |
* @param string $ip | |
* @param array $array_bots | |
* @return string|false | |
*/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function racine_referer() | |
{ | |
if (!isset($_SERVER['HTTP_REFERER'])){ | |
return false; | |
}else{ | |
$parser_url = parse_url(trim($_SERVER['HTTP_REFERER'])); | |
return trim($parser_url[host] ? $parser_url[host] : array_shift(explode('/', $parser_url[path], 2))); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_site_kw($url){ | |
$meta = get_meta_tags($url); | |
$keywords = $meta['keywords']; | |
$keywords = @explode(',', $keywords ); | |
$keywords = array_map( 'trim', $keywords ); | |
$keywords = array_filter( $keywords ); | |
return $keywords; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function scrape_links($url){ | |
$pageData = file_get_contents($url); | |
if(preg_match_all( | |
'/<a\s+href=["\']([^"\']+)["\']/i', | |
$pageData, | |
$links, | |
PREG_PATTERN_ORDER)){ | |
return array_unique($links[1]); |
OlderNewer