⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pattern.php

📁 一款可以和GOOGLE媲美的开源统计系统,运用AJAX.功能强大. 无色提示:按照需要PHP5.1以上和MySQL数据库支持。
💻 PHP
字号:
<?php/** * Piwik - Open source web analytics *  * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later * @version $Id: Pattern.php 444 2008-04-11 13:38:22Z johmathe $ *  * @package Piwik_DataTable *//** * Delete all rows for which the given $columnToFilter do not contain the $patternToSearch * This filter is to be used on columns containing strings.  * Exemple: fron the keyword report, keep only the rows for which the label contains "piwik" *  * @package Piwik_DataTable * @subpackage Piwik_DataTable_Filter  */class Piwik_DataTable_Filter_Pattern extends Piwik_DataTable_Filter{	private $columnToFilter;	private $patternToSearch;	private $patternToSearchQuoted;		public function __construct( $table, $columnToFilter, $patternToSearch )	{		parent::__construct($table);		$this->patternToSearch = $patternToSearch;		$this->patternToSearchQuoted = self::getPatternQuoted($patternToSearch);		$this->columnToFilter = $columnToFilter;		$this->filter();	}		static public function getPatternQuoted( $pattern )	{		return "/". preg_quote($pattern, '/') ."/";	}		static public function match($pattern, $patternQuoted, $string)	{		return preg_match($patternQuoted,  $string) == 1				&& stripos($string, $pattern) !== false;	}		protected function filter()	{		foreach($this->table->getRows() as $key => $row)		{			//instead search must handle			// - negative search with -piwik			// - exact match with ""			// see (?!pattern) 	A subexpression that performs a negative lookahead search, which matches the search string at any point where a string not matching pattern begins. 			if( !self::match($this->patternToSearch, $this->patternToSearchQuoted, $row->getColumn($this->columnToFilter)))			{				$this->table->deleteRow($key);			}		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -