Changeset 825 for trunk/admin/include/functions.php
- Timestamp:
- Aug 18, 2005, 7:59:00 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r809 r825 583 583 } 584 584 585 / / get_keywords returns an array with relevant keywords found in the string586 // given in argument. Keywords must be separated by comma in thisstring.587 // keywords must : 588 // - be longer or equal to 3 characters 589 // - not contain ', " or blank characters 590 // - unique in the string ("test,test" -> "test") 591 function get_keywords( $keywords_string ) 592 { 593 $keywords = array(); 594 595 $candidates = explode( ',', $keywords_string );596 foreach ( $candidates as $candidate ) {597 if ( strlen($candidate) >= 3 and !preg_match( '/(\'|"|\s)/', $candidate ) )598 array_push( $keywords, $candidate );599 }600 601 return array_unique( $keywords);585 /** 586 * returns an array with relevant keywords found in the given string. 587 * 588 * Keywords must be separated by comma or space characters. 589 * 590 * @param string keywords_string 591 * @return array 592 */ 593 function get_keywords($keywords_string) 594 { 595 return 596 array_unique( 597 preg_split( 598 '/[\s,]+/', 599 $keywords_string 600 ) 601 ); 602 602 } 603 603 … … 743 743 UPDATE '.$tablename.' 744 744 SET '; 745 $is_first = true; 745 746 foreach ($dbfields['update'] as $num => $key) 746 747 { 747 if ( $num >= 1)748 if (!$is_first) 748 749 { 749 750 $query.= ",\n "; 750 751 } 751 752 $query.= $key.' = '; 752 if (isset($data[$key]) )753 if (isset($data[$key]) and $data[$key] != '') 753 754 { 754 755 $query.= '\''.$data[$key].'\''; … … 758 759 $query.= 'NULL'; 759 760 } 761 $is_first = false; 760 762 } 761 763 $query.= '
Note: See TracChangeset
for help on using the changeset viewer.