This file contains hidden or 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 | |
// Works Perfict | |
function uni2html($string){ | |
//preg_replace(): Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset 1. | |
//so can't use $string = preg_replace('/\\u([0-9A-Za-z]+)/', '&#x$1;', $string); directly. | |
$string = explode('\\', $string); | |
$string = implode('%', $string); | |
$string = preg_replace('/%u([0-9A-Za-z]+)/', '&#x$1;', $string); | |
return html_entity_decode($string, ENT_COMPAT, 'UTF-8'); |
This file contains hidden or 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
#!/usr/bin/php | |
<?php | |
/* | |
* Convert JSON file to CSV and output it. | |
* | |
* JSON should be an array of objects, dictionaries with simple data structure | |
* and the same keys in each object. | |
* The order of keys it took from the first element. | |
* | |
* Example: |
This file contains hidden or 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
// jQuery Headers support for $.ajax | |
$.ajax({ | |
beforeSend: function(xhrObj){ | |
xhrObj.setRequestHeader("Content-Type","application/json"); | |
xhrObj.setRequestHeader("Accept","application/json"); | |
} | |
type: "POST", | |
url: "/article", | |
processData: false, |
This file contains hidden or 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 | |
/* | |
* This Function Is InComplete. | |
* @param video url string; | |
* @return mixed; | |
**/ | |
//$url="https://www.youtube.com/embed/Tgb0jK143MI"; | |
//$url = 'https://www.youtube.com/embed/FblnhqYEae0'; | |
$url ="https://www.youtube.com/watch?v=Hg8Fa_EUQqY&index=23&list=PLDu39zhqv26ILpsfB1INvhqqsBvSdI6wG"; | |
//$url = 'http://vimeo.com/channels/staffpicks/97916782'; |
This file contains hidden or 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 | |
# the request | |
$file = file_get_contents('http://www.videojs.com/js/video-js.swf'); | |
$file_url = 'http://www.videojs.com/js/video-js.swf'; | |
echo "<br>"; | |
$ch = curl_init($file_url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_exec($ch); | |
# get the content type |
This file contains hidden or 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 | |
/** | |
* Integratin WordPress Plugins into WordPress Theme for automatic download/instgall and activation. | |
* Required TGM Plugin Activation library [http://tgmpluginactivation.com/] | |
* Help Urls-- | |
* http://code.tutsplus.com/tutorials/integrating-the-envato-wordpress-toolkit-to-your-theme-the-plugin--wp-33264 | |
* http://tgmpluginactivation.com/ | |
* https://wordpress.org/support/topic/embed-a-plugin-in-template | |
* http://thomasgriffinmedia.com/blog/2011/09/automatically-install-plugins-with-themes-for-wordpress/ | |
* http://codex.wordpress.org/Function_Reference/is_plugin_active |
This file contains hidden or 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 | |
// in functions.php | |
add_theme_support( 'post-thumbnails'); | |
/* | |
Wordpress crop an image = 5 size. Sizes are given below | |
thumbnail // Thumbnail (default 150px x 150px max) |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>HTML5 Form Attribute</title> | |
</head> | |
<body> | |
<form name="contact-form" method="POST" action="sentmail.php"> | |
<p> | |
<label for="name">Name:</label> | |
<input type="text" id="name" name="name" |
This file contains hidden or 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
/** | |
* Usage: php makepot.php PROJECT DIRECTORY [OUTPUT] | |
* Generate POT file from the files in DIRECTORY [OUTPUT] | |
* Available projects: generic, wp-frontend, wp-admin, wp-network-admin, wp-core, wp-ms, wp-tz, wp-plugin, wp-theme, bb, mu, bp, glotpress, rosetta, wporg-bb-forums | |
* This is windows cmd command | |
*/ | |
C:\xampp\php>php c:\xampp\htdocs\wpdev\tools\makepot.php wp-plugin c:\xampp\htdocs\wpdev\wp-content\plugins\sp_google_maps c:\lang.pot |
OlderNewer