예제 #1
0
 /**
  * Extracts a String off of HTML input.
  *
  * @access		private
  *
  * @param 		string 		$tag 		String, containing the html tag to select
  * @param 		string 		$attr 		String, containing the attribute used on the WHERE condition
  * @param 		string 		$value 		String, containing the value used on the WHERE condition
  * @param 		string 		$site 		Input string
  * @param 		integer 	$id 		Defines the position of the key, to be returned from the preg_match_all array.
  *
  * @return 		string/integer 			Returns an integer or a string.
  */
 public static function extractSingle($tag, $attr, $value, $id, $uri, $alextract)
 {
     // external helper class
     include_once "ext/htmlsql.class.php";
     $wsql = new htmlsql();
     $wsql->connect('string', SEOstats_Alexa::_alexa($uri));
     $wsql->query('SELECT * FROM ' . $tag . ' WHERE $' . $attr . ' == "' . $value . '"');
     $row = $wsql->fetch_array();
     if ($alextract == true) {
         return SEOstats_Alexa::alextract($row[$id]['text']);
     } elseif ($alextract == false) {
         return trim(strip_tags($row[$id]['text']));
     } elseif ($alextract == 'none') {
         return $row[$id]['text'];
     }
 }