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 cache_image($image_url){ | |
//replace with your cache directory | |
$image_path = 'path/to/cache/dir/'; | |
//get the name of the file | |
$exploded_image_url = explode("/",$image_url); | |
$image_filename = end($exploded_image_url); | |
$exploded_image_filename = explode(".",$image_filename); | |
$extension = end($exploded_image_filename); | |
//make sure its an image |
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 | |
// REGEX LIST | |
// $success = preg_match('/\<link.*href=\"(.*)\" \/\>/is', $str, $matches); | |
// $success = preg_match('/\<link.*href=\"(.*)\" \/\>/is', $text, $matches); | |
echo "<h2>Find RSS Feed URLs</h2>"; | |
//$url = "https://mrmondialisation.org"; | |
$url = "http://stackoverflow.com/"; |
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 | |
echo "<h2>Get Favicons URLs</h2>"; | |
//$url = "https://mrmondialisation.org"; | |
//$url = "http://stackoverflow.com/"; | |
//$url = "http://changera.blogspot.ca/"; | |
//$url = "http://veteranstoday.com"; | |
$url = "http://www.2012un-nouveau-paradigme.com/"; | |
//$url = "http://www.stopmensonges.com/"; | |
//$url = "http://reseauinternational.net"; |
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 parseFavicon($html) { | |
// Get the 'href' attribute value in a <link rel="icon" ... /> | |
// Also works for IE style: <link rel="shortcut icon" href="http://www.example.com/myicon.ico" /> | |
// And for iOS style: <link rel="apple-touch-icon" href="somepath/image.ico"> | |
$matches = array(); | |
// Search for <link rel="icon" type="image/png" href="http://example.com/icon.png" /> | |
preg_match('/<link.*?rel=("|\').*icon("|\').*?href=("|\')(.*?)("|\')/i', $html, $matches); | |
if (count($matches) > 4) { |
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 | |
/********* LIVE DEMO: https://goo.gl/shr5Cv *********/ | |
echo "<h1>Get Favicon</h1>"; | |
//$url = "https://mrmondialisation.org"; | |
//$url = "http://stackoverflow.com/"; | |
//$url = "http://changera.blogspot.ca/"; | |
//$url = "http://veteranstoday.com"; | |
//$url = "http://2012un-nouveau-paradigme.com/"; // No favicon | |
//$url = "http://www.stopmensonges.com/"; |
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
// split at 3000 characters | |
$string = "<div>Ceci est un test et on ajoute encore plus de texte</div> Ceci est un test et on ajoute encore plus de texte. Lorem ipsum dolor sit amet"; | |
$string = wordwrap($string, 15, ";;", true); | |
var_dump(explode(";;", $string)); |
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
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<div class="wp_org_api"></div> | |
<script> | |
//setUp Post Data | |
var actionType = 'hot_tags'; | |
var number = 10; | |
var timeout = 15; | |
//Parse Post Data | |
var postData = { |
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
// DEMO: https://jsfiddle.net/onigetoc/5kh0e5f4/ | |
function ScrollTo(target, speed, timeout, margin) { | |
if (!timeout) timeout = 0; | |
if (!speed) speed = 1000; | |
if (!margin) margin = 0; | |
if (typeof target !== "undefined") { | |
setTimeout(function() { | |
$('html,body').animate({ |
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 | |
// ENQUEUE IF SHORTCODE IN TEXT WIDGET | |
function check_shortcode($text) { | |
$pattern = get_shortcode_regex(); | |
if ( preg_match_all( '/'. $pattern .'/s', $text, $matches ) | |
&& array_key_exists( 2, $matches ) | |
&& in_array( 'myshortcode', $matches[2] ) ) | |
{ |