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
{"lastUpload":"2021-04-23T04:09:18.318Z","extensionVersion":"v3.4.3"} |
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
ob_start(); | |
$file = $_GET['doc']; | |
if(!file_exists($file)) | |
$file = dirname(__FILE__).'/wp-content/plugins/flexpaper/pdf/'.$file; | |
if (file_exists($file)) | |
{ | |
header('Content-Description: File Transfer'); | |
header('Content-Type: application/octet-stream'); |
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
//reference:http://www.dustindiaz.com/javascript-cache-provider | |
function CacheProvider() { | |
// values will be stored here | |
this._cache = {}; | |
} | |
if (CacheProvider.hasLocalStorage) { | |
Storage.prototype.setObject = function(key, value) { | |
this.setItem(key, JSON.stringify(value)); |
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
/** | |
* extract rar or zip file | |
* | |
* @since [1.0] | |
* @author Richard | |
* @date 2015-05-05 | |
* | |
* @param [string] $file_path ["D:\file\path\a.rar"] | |
* @param [string] $to_path ["D:\extract\to\path"] | |
* @return [boolean] |
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
/** | |
* get suffix from a given file_name | |
* | |
* @since [1.0] | |
* @see [filetype()] | |
* @author Richard | |
* @date 2015-05-05 | |
* | |
* @param [string] $file_name [a.txt] | |
* @return [sring] [txt] |
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
/** | |
* A simple function that find all files by extension an return it by an array. | |
* | |
* @since [1.0] | |
* @see [http://php.net/manual/en/function.glob.php] | |
* @date 2015-05-05 | |
* | |
* @param [string] $directory | |
* @param array $extensions like "xml,zip,txt" | |
* @return [array] array("zip" => array( [0] => "D:\a.zip", [1] => "D:\b.zip"), "xml" => array( [0] => "D:\1.xml")) |
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
/** | |
* [get_posts_by_slug description] | |
* @param [int] $num [number of posts you want to get] | |
* @param [string] $slug_name [slug's name] | |
* @return [array] [List of WP_Post objects.] | |
*/ | |
function get_by_slug($num, $slug_name, $post_type = array('featured', 'social_post')){ | |
if (!is_string($slug_name)) { | |
return 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
/** | |
* get src of the first img tag from string | |
* @param [type] string | |
* @param [type] boolean if true get all the images' src | |
* @return [type] first src or none | |
*/ | |
function get_img_src($str, $isAll = false){ | |
preg_match('/\<img.*src=\"(.*?)\"/i',$str,$src); | |
preg_match('/alt\s*=\"(.*?)\"/i',$str,$alt); | |
if ($isAll) { |
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
/** | |
* [get_desc get a simple description of a long content] | |
* @param [str] $str | |
* @param integer $len [the length you want to cut,default 50] | |
* @return [string] [Result after cutting] | |
*/ | |
function get_desc($str,$len = 50){ | |
$str = strip_tags($str); | |
if (strlen($str) < $len) { | |
return $str; |