Home > Download >  Library download

  • <?php namespace TijsVerkoyen\CssToInlineStyles; use Symfony\Component\CssSelector\CssSelector; use Symfony\Component\CssSelector\CssSelectorConverter; use Symfony\Component\CssSelector\Exception\ExceptionInterface; use TijsVerkoyen\CssToInlineStyles\Css\Processor; use TijsVerkoyen\CssToInlineStyles\Css\Property\Processor as PropertyProcessor; use TijsVerkoyen\CssToInlineStyles\Css\Rule\Processor as RuleProcessor; use TijsVerkoyen\CssToInlineStyles\Css\Rule\Rule; class CssToInlineStyles {     private $cssConverter;     public function __construct()     {         if (class_exists('Symfony\Component\CssSelector\CssSelectorConverter')) {             $this->cssConverter = new CssSelectorConverter();         }     }This is an inline CSS library in email templates. Friends who need it can download and use

    Other libraries29692018-01-10
  • <?php  /**   * 参数处理类   * @author JasonWei   */  class Params  {      public $get = array();        public $post = array();        function __construct()      {  if (!emptyempty($_GET)) {      foreach ($_GET as $key => $val) {  if (is_numeric($val)) {      $this->get[$key] = $this->getInt($val);  } else {      $this->get[$key] = $this->getStr($val);  }      }  }  if (!emptyempty($_POST)) {      foreach ($_POST as $key => $val) {  if (is_numeric($val)) {      $this->post[$key] = $this->getInt($val);  } else {      $this->post[$key] = $this->getStr($val);  }      }  }This is a very useful PHP anti-injection class. Friends who need it can download and use it

    Other libraries24322018-01-10
  • <?php /**  * Validator 数据验证类  */ class Validator {     /**      * 待校验数据      * @var array      */     private $_data;     /**      * 校验规则      * @var array      */     private $_ruleList = null;     /**      * 校验结果      * @var bool      */     private $_result = null;     /**      * 校验数据信息      * @var array      */     private $_resultInfo = array();     /**      * 构造函数      * @param array $data 待校验数据      */     public function __construct($data = null)     {         if ($data) {             $this->_data = $data;         }     }This is a very complete php verification class, friends who need it can download and use

    Other libraries30682018-01-10
  • <?php class crypt {   private $skey;   public function __construct($key) {     $this->skey = hash("md5", $key, true); //32位skey   }   public function safe_b64encode($string) {     $data = base64_encode($string);     $data = str_replace(array('+', '/', '='), array('-', '_', ''), $data);     return $data;   }   public function safe_b64decode($string) {     $data = str_replace(array('-', '_'), array('+', '/'), $string);     $mod4 = strlen($data) % 4;     if ($mod4) {       $data .= substr('====', $mod4);     }     return base64_decode($data);   }This is a PHP encryption and decryption class. Friends who need it can download and use it

    Other libraries27852018-01-10
  • <?php class cls_http_request {   public static function curl_get($url, $timeout = 1)   {     $ch = curl_init();     curl_setopt($ch, CURLOPT_URL, $url);     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);     curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);     $result = curl_exec($ch);     curl_close($ch);     if (is_string($result) && strlen($result))     {       return $result;     }     else     {       return false;     }   }http request processing class (encapsulated based on CURL)get method request (curl)@param string $url requested url@param integer $ timeout timeout time (s)@return string(request successful) | false(request failed)

    Other libraries25752018-01-10
  • <?php class CacheLayer{   protected $root = "";   protected $cache = "";   protected $key = "";   protected $life = 0;   public function __construct($key, $root = "/cachelayer"){     $this->root = $_SERVER["DOCUMENT_ROOT"].$root;     $this->key = $key;   }   public function expired($life_span){     $this->life = $life_span;     $file = $this->root."/".$this->key.".cachelayer";     if(is_file($file)){       $mtime = filemtime($file);       return (time() >= ($mtime + $this->life));     }else{       return true;     }   }   public function put($content){     $file = $this->root."/".$this->key.".cachelayer";     if(!is_dir(dirname($this->root))){       return false;     }     $this->delete();     $content = json_encode($content);     return (bool)file_put_contents($file, $content);   }   public function get(){     $file = $this->root."/".$this->key.".cachelayer";     if(is_file($file)){       return json_decode(file_get_contents($file), true);     }     return array();   }   public function delete(){     $file = $this->root."/".$this->key.".cachelayer";     if(is_file($file)){       unlink($file);       return true;     }     return false;   } } ?>This is a very useful PHP caching library. Friends who need it can download and use it. It can greatly relieve the pressure on the database through file caching

    Other libraries21832018-01-09
  • <?php class upload { var $dir;            //附件存放物理目录 var $time;           //自定义文件上传时间 var $allow_types;    //允许上传附件类型 var $field;          //上传控件名称 var $maxsize;        //最大允许文件大小,单位为KB var $thumb_width;    //缩略图宽度 var $thumb_height;   //缩略图高度 var $watermark_file; //水印图片地址 var $watermark_pos;  //水印位置 var $watermark_trans;//水印透明度 //构造函数 //$types : 允许上传的文件类型 , $maxsize : 允许大小 ,  $field : 上传控件名称 , $time : 自定义上传时间 function upload($types = 'jpg|png', $maxsize = 1024, $field = 'attach', $time = '') { $this->allow_types = explode('|',$types); $this->maxsize = $maxsize * 1024; $this->field = $field; $this->time = $time ? $time : time(); } //设置并创建文件具体存放的目录 //$basedir  : 基目录,必须为物理路径 //$filedir  : 自定义子目录,可用参数{y}、{m}、{d} function set_dir($basedir,$filedir = '') { $dir = $basedir; !is_dir($dir) && @mkdir($dir,0777); if (!empty($filedir)) { $filedir = str_replace(array('{y}','{m}','{d}'),array(date('Y',$this->time),date('m',$this->time),date('d',$this->time)),strtolower($filedir));//用string_replace把{y} {m} {d}几个标签进行替换 $dirs = explode('/',$filedir); foreach ($dirs as $d) { !empty($d) && $dir .= $d.'/'; !is_dir($dir) && @mkdir($dir,0777); } } $th PHP multi-file upload class that supports watermarks, dates, and thumbnails. Set and create the directory where the files are stored. Picture thumbnail settings. If thumbnails are not generated, no settings are needed. Picture watermark settings. If no watermarks are generated, add watermarks. There is no need to set it, file upload is performed, and after processing, an array of file information containing successful or failed upload is returned.

    Other libraries27022018-01-09
  • <?php class IP {      public static function generate($province = '')     {         $ip_address = self::_IPSegment($province);         $ip = self::_randomIP($ip_address['begin'], $ip_address['end']);         return $ip;     }     public static function update()     {         require 'QueryList.class.php';         $province = array(             'BJ', 'GD', 'SD', 'ZJ', 'JS', 'SH', 'LN', 'SC', 'HA',             'HB', 'FJ', 'HN', 'HE', 'CQ', 'SX', 'JX', 'SN', 'AH',             'HL', 'GX', 'JL', 'YN', 'TJ', 'NM', 'XJ', 'GS', 'GZ',             'HI', 'NX', 'QH', 'XZ'         );         $count = count($province);         $ip_segment = array();         for ($i = 0; $i < $count; $i++) {             // 采集IP地址段目标网址             $url = 'http://ips.chacuo.net/view/s_' . $province[$i];             $ip_list = QueryList::Query($url, array('begin' => array('.v_l', 'text'), 'end' => array('.v_r', 'text')), '', 'UTF-8');             $ip_array = $ip_list->jsonArr;             $ip_segment[$province[$i]] = $ip_array;         }         $path = str_replace('\', '/', __DIR__);         $file = $path . '/ip_segment.php';         $res = self::_write($file, $ip_segment);         if ($res) {             echo 'Update OK!';         }     }Randomly generate an IPV4 address based on the province name (Chinese)If $province is empty, a random domestic province

    Other libraries33842018-01-09
  • (function(w){     // the heatmapFactory creates heatmap instances     var heatmapFactory = (function(){     // store object constructor     // a heatmap contains a store     // the store has to know about the heatmap in order to trigger heatmap updates when datapoints get added     var store = function store(hmap){         var _ = {             // data is a two dimensional array             // a datapoint gets saved as data[point-x-value][point-y-value]             // the value at [point-x-value][point-y-value] is the occurrence of the datapoint             data: [],             // tight coupling of the heatmap object             heatmap: hmap         };         // the max occurrence - the heatmaps radial gradient alpha transition is based on it         this.max = 1;         this.get = function(key){             return _[key];         };         this.set = function(key, value){             _[key] = value;         };     }Set the detailed data displayed by the heat map. After implementation, it can be displayed immediately @param {Json Object} data{"<b>max</b>" : {Number} Maximum value of weight,<br />"<b>data</b>" : {Array} Coordinate detailed data, the format is as follows<br/>{"lng":116.421969,"lat":39.913527,"count":3}, where<br/>lng lat is the longitude and latitude respectively, count weight valueAdd detailed coordinate points of the power map@param {Number} lng longitude coordinate@param {Number} lat longitude coordinate@param {Number} count longitude coordinate

    Other libraries32372018-01-09
  • <?php /**  * 阿里云短信验证码发送类  */ class Sms {   // 保存错误信息   public $error;   // Access Key ID   private $accessKeyId = '';   // Access Access Key Secret   private $accessKeySecret = '';   // 签名   private $signName = '';   // 模版ID   private $templateCode = '';   public function __construct($cofig = array()) {     $cofig = array (       'accessKeyId' => '***************',       'accessKeySecret' => '******************',       'signName' => '七零',       'templateCode' => 'SMS_25300059'     );     // 配置参数     $this->accessKeyId = $cofig ['accessKeyId'];     $this->accessKeySecret = $cofig ['accessKeySecret'];     $this->signName = $cofig ['signName'];     $this->templateCode = $cofig ['templateCode'];   }InvalidDayuStatus.Malformed' => 'The account SMS activation status is incorrect',InvalidSignName.Malformed' => 'The SMS signature is incorrect or the signature status is incorrect',InvalidTemplateCode.MalFormed' => 'The SMS template Code is incorrect or the template status is incorrect', InvalidRecNum.Malformed' => 'The target mobile phone number is incorrect, and the number sent at a time cannot exceed 100', InvalidParamString.MalFormed' => 'The variables in the SMS template are not in json format',InvalidParamStringTemplate.Malformed' => 'The variables in the SMS template do not match the template content' InvalidSendSms' => 'Trigger business flow controlInvalidDayu.Malformed' => 'The variable cannot be a URL, the variable can be solidified in the template

    Other libraries27902018-01-09
  • <?php class HttpDownload {   private $m_url = "";   private $m_urlpath = "";   private $m_scheme = "http";   private $m_host = "";   private $m_port = "80";   private $m_user = "";   private $m_pass = "";   private $m_path = "/";   private $m_query = "";   private $m_fp = "";   private $m_error = "";   private $m_httphead = "" ;   private $m_html = "";   public function PrivateInit($url){     $urls = "";     $urls = @parse_url($url);     $this->m_url = $url;     if(is_array($urls)) {       $this->m_host = $urls["host"];       if(!empty($urls["scheme"])) $this->m_scheme = $urls["scheme"];       if(!empty($urls["user"])) $this->m_user = $urls["user"];       if(!empty($urls["pass"])) $this->m_pass = $urls["pass"];       if(!empty($urls["port"])) $this->m_port = $urls["port"];       if(!empty($urls["path"])) $this->m_path = $urls["path"];       $this->m_urlpath = $this->m_path;       if(!empty($urls["query"])) {         $this->m_query = $urls["query"];         $this->m_urlpath .= "?".$this->m_query;       }     }   }Initialization - Open the specified URL - Reset each parameter - Initialize the system - Obtain the cause of an operation error - Determine whether the response result of the header sent by the Get method is correct - Check whether the returned web page is of text type - Determine Whether the returned web page is of a specific type - HTTP protocol download file

    Other libraries28192018-01-08
  • <?php function qsort(&$arr) {   _quick_sort($arr, 0, count($arr) - 1); } function _quick_sort(&$arr, $low, $high) {   $low_data = $arr[$low];   $prev_low = $low;   $prev_high = $high;   while ($low < $high)   {     while ($arr[$high] >= $low_data && $low < $high) {       $high--;     }     if ($low < $high) {       $arr[$low] = $arr[$high];       $low++;     }     while ($arr[$low] <= $low_data && $low < $high) {       $low++;     }     if ($low < $high) {       $arr[$high] = $arr[$low];       $high--;     }   }Quick sort using recursive algorithm. @param array $arr The array to be sorted@param int $low The lowest sorting subsection@param int $high The highest sorting field

    Other libraries19492018-01-08