• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP soundex函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中soundex函数的典型用法代码示例。如果您正苦于以下问题:PHP soundex函数的具体用法?PHP soundex怎么用?PHP soundex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了soundex函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct( $data  = NULL, $options = NULL ){
     $options = new GLU( $options );
     if( $data instanceof iterator ) {
         $str = '';
         foreach($data as $v ) $str .= ' ' . $v;
         $data = $str;
     }
     if( is_array( $data ) ) $data = implode(' ', $data );
     $data = preg_split("/[\s,\.\:\/\\\]+/", trim(preg_replace('/[^a-z0-9\s,\.\:\/\\\]/i', '', strtolower($data))));
     $words = array();
     foreach( $data as $word ){
         if( strpos(self::$stopwords, $word . '|') !== FALSE ) continue;
         if( ! $options->disable_stemmer ) $word = PorterStemmer::stem( $word );
         $len = strlen( $word );
         if( $len < 3 || $len > 30 ) continue;
         if( strpos(self::$stopwords, $word . '|') !== FALSE ) continue;
         if( ! isset( $words[ $word ] ) ) $words[ $word ] = 0;
         $words[$word]++;
         if( $len < 6 || $options->disable_soundex ) continue;
         $word = soundex( $word );
         if( ! isset( $words[ $word ] ) ) $words[ $word ] = 0;
         $words[$word]++;
     }
     parent::__construct( $words );
 }
开发者ID:72squared,项目名称:glu-php,代码行数:25,代码来源:keyword_counter.php


示例2: umwords_build

function umwords_build($p, $o)
{
    $ratio = 50;
    $min = $p * $ratio;
    $limit = $min . ', ' . ($min + $ratio);
    $r = sql_inner('pub_art.id,msg', 'qda', 'qdm', 'id', 'kv', 'where nod="ummo" limit ' . $limit);
    if ($r) {
        foreach ($r as $k => $v) {
            $v = str_replace("'", ' ', $v);
            //$v=str_replace('-',' ',$v);
            $rb = str_word_count($v, 2);
            if ($rb) {
                foreach ($rb as $ka => $va) {
                    if ($va == strtoupper($va) && !umwords_dicos($va) && strlen($va) > 1) {
                        $rd[] = array($k, $va, $ka, soundex($va));
                        //idart,voc,pos,sound
                        $rc[$va] = array($k, $va, $ka, soundex($va));
                    }
                }
            }
        }
    }
    //if(auth(6))umwords_sav($rc);
    return $rd;
    $ret = count($rc);
    $ret .= make_table($rc);
    return $ret;
}
开发者ID:philum,项目名称:cms,代码行数:28,代码来源:umwords.php


示例3: compare

 function compare($debug = false)
 {
     $first = $this->str1;
     $second = $this->str2;
     $this->levenshtein = levenshtein($first, $second);
     $this->similarity['value'] = $sim = similar_text($first, $second, $perc);
     $this->similarity['percentage'] = $perc;
     if ($debug) {
         echo "{$first} | {$second}<br>";
         echo "leven: " . $this->levenshtein;
         echo '<br>similarity: ' . $sim . ', ' . $perc . '%<br><br>';
     }
     $soundex1 = soundex($first);
     $soundex2 = soundex($second);
     $this->soundex['levenshtein'] = levenshtein($soundex1, $soundex2);
     $this->soundex['similarity'] = $sim = similar_text($soundex1, $soundex2, $perc);
     $this->soundex['percentage'] = $perc;
     if ($debug) {
         echo "Soundex: " . $soundex1 . ", " . $soundex2 . "<BR>";
         echo 'levenshtein: ' . $this->soundex['levenshtein'] . '<br>';
         echo 'similarity: ' . $sim . ', ' . $perc . '%<br><br>';
     }
     $m1 = metaphone($first);
     $m2 = metaphone($second);
     $this->metaphone['levenshtein'] = levenshtein($m1, $m2);
     $this->metaphone['similarity'] = $sim = similar_text($m1, $m2, $perc);
     $this->metaphone['percentage'] = $perc;
     if ($debug) {
         echo "metaphone: " . $m1 . ", " . $m2 . "<br>";
         echo 'levenshtein: ' . $this->metaphone['levenshtein'] . '<br>';
         echo 'similarity: ' . $sim . ', ' . $perc . '%<br>';
         echo '<br>-------------------<br>';
     }
 }
开发者ID:superego546,项目名称:SMSGyan,代码行数:34,代码来源:class.CompareString.php


示例4: search_items

 function search_items()
 {
     $search_string = $this->input->post('keyword');
     $search_string = preg_replace('/[^a-zA-Z0-9_ %\\[\\]\\.\\(\\)%&-]/s', '', $search_string);
     $words = explode(" ", $search_string);
     $data = $this->browse_gallery_model->get_all_search_strings();
     $row = 0;
     $row_array = array();
     $ad_array = array();
     foreach ($data as $text) {
         $text_word = explode("~", $text['Title_Text']);
         $ad_id = $text['ad_id'];
         $count = 0;
         foreach ($text_word as $single) {
             foreach ($words as $keyword) {
                 if (soundex(strtoupper($keyword)) == soundex(strtoupper($single)) || metaphone(strtoupper($keyword)) == metaphone(strtoupper($single))) {
                     $count = $count + 1;
                 }
             }
         }
         if (intval($count) > 0) {
             array_push($row_array, $ad_id);
         }
     }
     if (!empty($row_array)) {
         $data['ads'] = $this->browse_gallery_model->get_gallery_ads_by_adid($row_array);
         $data['top'] = $this->browse_gallery_model->get_top_categories();
         $this->load->view('search_items_view', $data);
     } else {
         $data['ads'] = NULL;
         $data['top'] = $this->browse_gallery_model->get_top_categories();
         $this->load->view('search_items_view', $data);
     }
 }
开发者ID:maheshrathnayaka,项目名称:2014_Sep_13,代码行数:34,代码来源:browse_gallery.php


示例5: get_matches

function get_matches($rq)
{
    if (strtolower(trim($rq->artist)) != 'mokele') {
        return array();
    }
    if (soundex($rq->track) != soundex('hiding in your insides')) {
        return array();
    }
    $pi = new stdclass();
    $pi->artist = "Mokele";
    $pi->track = "Hiding In Your Insides";
    $pi->album = "You Yourself are Me Myself and I am in Love";
    $pi->source = "Mokele.co.uk";
    $pi->size = 4971780;
    $pi->bitrate = 160;
    $pi->duration = 248;
    $pi->extra_headers = array("X-Something: foo", "X-WTF: bar");
    // anything cURL supports:
    // NB this url should be url encoded properly:
    // $pi->url    = "ftp://user:[email protected]/foo/bar.mp3";
    // $pi->url    = "scp://10.180.255.129/home/rj/mp3/TomWaits/Time.mp3"; // if your curl supports it!
    // $pi->url    = "file:///home/rj/mp3/Zero 7 - The Garden/Zero 7 - 11 - Crosses.mp3";
    // $pi->url    = "http://playdar:[email protected]/secret/hiding.mp3";
    $pi->url = "http://play.mokele.co.uk/music/Hiding%20In%20Your%20Insides.mp3";
    $pi->score = (double) 1.0;
    return array($pi);
}
开发者ID:eandbsoftware,项目名称:playdar,代码行数:27,代码来源:demo-resolver.php


示例6: create_sound_query

 function create_sound_query($in)
 {
     $out = null;
     $in = explode(' ', $in);
     foreach ($in as $word) {
         $word = soundex($word);
         $out .= " OR (SUBSTRING(SOUNDEX(p.post_text), 1, 4)='{$word}')";
     }
     return '(' . substr($out, 4) . ')';
 }
开发者ID:BackupTheBerlios,项目名称:qsf-svn,代码行数:10,代码来源:search.php


示例7: interpret

 public static function interpret($value, $config = null)
 {
     if (is_array($value)) {
         sort($value);
         $string = implode(" ", $value);
     } else {
         $string = (string) $value;
     }
     $soundex = soundex($string);
     return intval(ord(substr($soundex, 0, 1)) . substr($soundex, 1));
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:11,代码来源:Soundex.php


示例8: onAfterInit

 public function onAfterInit()
 {
     if (!Director::isDev()) {
         // Only on live site
         $errorcode = $this->owner->failover->ErrorCode ? $this->owner->failover->ErrorCode : 404;
         $extract = preg_match('/^([a-z0-9\\.\\_\\-\\/]+)/i', $_SERVER['REQUEST_URI'], $rawString);
         if ($errorcode == 404 && $extract) {
             $uri = preg_replace('/\\.(aspx?|html?|php[34]?)$/i', '', $rawString[0]);
             $parts = preg_split('/\\//', $uri, -1, PREG_SPLIT_NO_EMPTY);
             $page_key = array_pop($parts);
             $sounds_like = soundex($page_key);
             // extend ignored classes with child classes
             $ignoreClassNames = array();
             if ($configClasses = Config::inst()->get('Intelligent404', 'intelligent_404_ignored_classes')) {
                 foreach ($configClasses as $class) {
                     $ignoreClassNames = array_merge($ignoreClassNames, array_values(ClassInfo::subclassesFor($class)));
                 }
             }
             // get all pages
             $SiteTree = SiteTree::get()->exclude('ClassName', $ignoreClassNames);
             // Translatable support
             if (class_exists('Translatable')) {
                 $SiteTree = $SiteTree->filter('Locale', Translatable::get_current_locale());
             }
             // Multisites support
             if (class_exists('Multisites')) {
                 $SiteTree = $SiteTree->filter('SiteID', Multisites::inst()->getCurrentSiteId());
             }
             $ExactMatches = new ArrayList();
             $PossibleMatches = new ArrayList();
             foreach ($SiteTree as $page) {
                 if ($page->URLSegment == $page_key) {
                     $ExactMatches->push($page);
                 } elseif ($sounds_like == soundex($page->URLSegment)) {
                     $PossibleMatches->push($page);
                 }
             }
             $ExactCount = $ExactMatches->Count();
             $PossibleCount = $PossibleMatches->Count();
             $redirectOnSingleMatch = Config::inst()->get('Intelligent404', 'redirect_on_single_match');
             if ($ExactCount == 1 && $redirectOnSingleMatch) {
                 return $this->RedirectToPage($ExactMatches->First()->Link());
             } elseif ($ExactCount == 0 && $PossibleCount == 1 && $redirectOnSingleMatch) {
                 return $this->RedirectToPage($PossibleMatches->First()->Link());
             } elseif ($ExactCount > 1 || $PossibleCount > 1 || !$redirectOnSingleMatch) {
                 $ExactMatches->merge($PossibleMatches);
                 $content = $this->owner->customise(array('Pages' => $ExactMatches))->renderWith(array('Intelligent404Options'));
                 $this->owner->Content .= $content;
             }
         }
     }
 }
开发者ID:axllent,项目名称:silverstripe-intelligent-404,代码行数:52,代码来源:Intelligent404.php


示例9: existeInDBByEntreprise

 public static function existeInDBByEntreprise($nomTuteur, $idEntreprise)
 {
     $tuteursIdentique = [];
     // Order by est obligatoire !
     // Si un tuteur est créer entre temps, cela n'infue pas les id dans les formulaires des autres
     $tuteurs = Tuteur::where('idEntreprise', $idEntreprise)->orderBy('idUtilisateur')->get();
     foreach ($tuteurs as $tuteur) {
         if (soundex($nomTuteur) == soundex($tuteur->details->nom)) {
             array_push($tuteursIdentique, $tuteur);
         }
     }
     return $tuteursIdentique;
 }
开发者ID:l0wran917,项目名称:projet_web,代码行数:13,代码来源:Tuteur.php


示例10: compareSoundex

function compareSoundex($v1, $v2)
{
    $v1 = soundex($v1);
    $v2 = soundex($v2);
    $v1_major = (ord($v1[0]) - ord('A')) * 1000;
    $v2_major = (ord($v2[0]) - ord('A')) * 1000;
    $v1_minor = substr($v1, 1);
    $v2_minor = substr($v2, 1);
    // return similarity percentage
    $total_major = (ord('Z') - ord('A')) * 1000;
    $total_minor = 999;
    return ($total_major - abs($v2_major - $v1_major)) / $total_major * 50 + ($total_minor - abs($v2_minor - $v1_minor)) / $total_minor * 50;
}
开发者ID:bffmm1,项目名称:gmailcommunity,代码行数:13,代码来源:compare.php


示例11: existeInDBByCP

 public static function existeInDBByCP($nomEtablissement, $codePostal)
 {
     $entreprisesIdentique = [];
     // Order by est obligatoire !
     // Si une entreprise est créer entre temps, cela n'infue pas les id dans les formulaires des autres
     $entreprises = Entreprise::where('cp', $codePostal)->orderBy('id')->get();
     foreach ($entreprises as $entreprise) {
         if (soundex($nomEtablissement) == soundex($entreprise->nom)) {
             array_push($entreprisesIdentique, $entreprise);
         }
     }
     return $entreprisesIdentique;
 }
开发者ID:l0wran917,项目名称:projet_web,代码行数:13,代码来源:Entreprise.php


示例12: wpshop_search_where_in_order

 public function wpshop_search_where_in_order($where)
 {
     global $wpdb;
     if (!empty($_GET) && !empty($_GET['s']) && !empty($_GET['post_type']) && $_GET['post_type'] == WPSHOP_NEWTYPE_IDENTIFIER_ORDER) {
         $where = "\tAND {$wpdb->posts}.post_type = '" . WPSHOP_NEWTYPE_IDENTIFIER_ORDER . "'";
         if (!empty($_GET['s'])) {
             $s_soundex = soundex($_GET['s']);
             $s = strtoupper($_GET['s']);
             $where .= "AND (\n\t\t\t\t\t\t\t\t\t( \t\n\t\t\t\t\t\t\t\t\t\t{$wpdb->posts}.ID IN (\n\t\t\t\t\t\t\t\t\t\t\tSELECT PM.post_id AS ID\n\t\t\t\t\t\t\t\t\t\t\tFROM {$wpdb->postmeta} AS PM\n\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\tPM.meta_key = '_order_postmeta'\n\t\t\t\t\t\t\t\t\t\t\t\tAND UPPER( PM.meta_value ) LIKE '%{$s}%'\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\tPM.meta_key = '_order_info'\n\t\t\t\t\t\t\t\t\t\t\t\tAND UPPER( PM.meta_value ) LIKE '%{$s}%'\n\t\t\t\t\t\t\t\t\t\t\t\tOR SOUNDEX( PM.meta_value ) = '{$s_soundex}'\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t{$wpdb->posts}.post_author IN (\n\t\t\t\t\t\t\t\t\t\t\tSELECT U.ID\n\t\t\t\t\t\t\t\t\t\t\tFROM {$wpdb->users} AS U\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN {$wpdb->usermeta} AS UM\n\t\t\t\t\t\t\t\t\t\t\tON ( UM.user_id = U.ID )\n\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\tUPPER( U.user_email ) LIKE '%{$s}%'\n\t\t\t\t\t\t\t\t\t\t\t\t\tOR SOUNDEX( U.user_email ) = '{$s_soundex}'\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\tUM.meta_key = 'first_name'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND UPPER( UM.meta_value ) LIKE '%{$s}%'\n\t\t\t\t\t\t\t\t\t\t\t\t\tOR SOUNDEX( UM.meta_value ) = '{$s_soundex}'\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\tUM.meta_key = 'last_name'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND UPPER( UM.meta_value ) LIKE '%{$s}%'\n\t\t\t\t\t\t\t\t\t\t\t\t\tOR SOUNDEX( UM.meta_value ) = '{$s_soundex}'\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)";
         }
         /*$metas_to_inspect = array( '_order_postmeta', '_order_info');
         			$first = $first_word = true;
         
         			$where .= ' OR ' .$wpdb->posts.'.post_type = "' .WPSHOP_NEWTYPE_IDENTIFIER_ORDER. '"';
         
         			$where .= ' AND ';
         
         
         			if ( !empty($_GET['entity_to_search']) &&  $_GET['entity_to_search'] == 'customer' ) {
         				$words = explode(' ', wpshop_tools::varSanitizer( addslashes($_GET['s']) ));
         				foreach ( $words as $word ) {
         					$first = true;
         					if ( !$first_word ) {
         						$where .= ' OR ';
         					}
         					$where .= '('.$wpdb->postmeta .'.meta_key = "_order_info" AND '.$wpdb->postmeta .'.meta_value LIKE "%' .$word. '%")';
         					$first_word = false;
         				}
         			}
         			else {
         				$word = wpshop_tools::varSanitizer( addslashes($_GET['s']) );
         				$where .= '('.$wpdb->postmeta .'.meta_key = "_order_postmeta" AND '.$wpdb->postmeta .'.meta_value LIKE "%' .$word. '%")';
         
         			}
         
         			add_filter('posts_join_request', array($this, 'wpshop_search_join'));
         		}*/
     }
     //echo '<pre>'; print_r($where); echo '</pre>'; exit();
     return $where;
 }
开发者ID:pronoSoupe,项目名称:pronobo_soupe,代码行数:41,代码来源:wps_order_search.php


示例13: getAlbumId

 /**
  * @param $artist name or spotify uri
  * @param $album name
  * @return spotify:album:uri or false
  */
 function getAlbumId($artist, $album)
 {
     if (!is_spotify_uri($artist)) {
         $artist = $this->getArtistId($artist);
     }
     if (!$artist) {
         return false;
     }
     $disco = $this->getArtistAlbums($artist);
     foreach ($disco as $a) {
         if ($a['album'] == $album) {
             //d("exact match");
             return $a['id'];
         }
         if (soundex($a['album']) == soundex($album)) {
             //d("fuzzy match");
             return $a['id'];
         }
     }
     return false;
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:26,代码来源:SpotifyClient.php


示例14: pleac_Soundex_Matching

function pleac_Soundex_Matching()
{
    #-----------------------------
    $code = soundex($string);
    #-----------------------------
    $phoned_words = metaphone("Schwern");
    #-----------------------------
    // substitution function for getpwent():
    // returns an array of user entries,
    // each entry contains the username and the full name
    function getpwent()
    {
        $pwents = array();
        $handle = fopen("passwd", "r");
        while (!feof($handle)) {
            $line = fgets($handle);
            if (preg_match("/^#/", $line)) {
                continue;
            }
            $cols = explode(":", $line);
            $pwents[$cols[0]] = $cols[4];
        }
        return $pwents;
    }
    print "Lookup user: ";
    $user = rtrim(fgets(STDIN));
    if (empty($user)) {
        exit;
    }
    $name_code = soundex($user);
    $pwents = getpwent();
    foreach ($pwents as $username => $fullname) {
        preg_match("/(\\w+)[^,]*\\b(\\w+)/", $fullname, $matches);
        list(, $firstname, $lastname) = $matches;
        if ($name_code == soundex($username) || $name_code == soundex($lastname) || $name_code == soundex($firstname)) {
            printf("%s: %s %s\n", $username, $firstname, $lastname);
        }
    }
    #-----------------------------
}
开发者ID:Halfnhav4,项目名称:pfff,代码行数:40,代码来源:Soundex_Matching.php


示例15: getPreMatched

 public function getPreMatched($lastname, $firstname, $gender, $email)
 {
     $matchedOrders = array();
     $sound_lastname = soundex($lastname);
     $sound_firstname = soundex($firstname);
     //        Mage::log("searching Match for ". $sound_firstname."  ".$sound_lastname."   ".$gender , null, 'xulin.log');
     $customers = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('firstname')->addAttributeToSelect('lastname')->addAttributeToSelect('gender')->addAttributeToSelect('email');
     $i = 0;
     foreach ($customers as $customer) {
         if ($email == $customer->getEmail()) {
             Mage::log("Email Matched", null, 'xulin.log');
             return array("status" => "emailmatched", "customerid" => $customer->getId());
         }
         if ($sound_firstname == soundex($customer->getFirstname()) && $sound_lastname == soundex($customer->getLastname()) && $gender == $customer->getGender()) {
             $matchedOrders[] = $customer->getId();
         }
         $i++;
     }
     Mage::log($matchedOrders, null, 'xulin.log');
     Mage::log("times: " . $i, null, 'xulin.log');
     return array("status" => "searching", "customerids" => $matchedOrders);
 }
开发者ID:fatalerrortan,项目名称:Magento_Guesttoreg,代码行数:22,代码来源:Cron.php


示例16: update_db

function update_db()
{
    global $_DB, $_STATE;
    $sql = "UPDATE " . $_DB->prefix . "c00_person\n\t\t\tSET lastname=:lastname, lastsoundex='" . soundex($_STATE->fields["Last Name"]->value()) . "',\n\t\t\tfirstname=:firstname";
    if ($_STATE->fields["Log ID"]->value() != "") {
        $sql .= ", loginname=:loginname";
    }
    if ($_STATE->fields["Password"]->value() != "") {
        $sql .= ", password=:password";
    }
    if ($_STATE->fields["Email"]->value() != "") {
        $sql .= ", email=:email";
    }
    $sql .= " WHERE person_id=" . $_STATE->record_id . ";";
    $stmt = $_DB->prepare($sql);
    $stmt->bindValue(':lastname', $_STATE->fields["Last Name"]->value(), PDO::PARAM_STR);
    $stmt->bindValue(':firstname', $_STATE->fields["First Name"]->value(), PDO::PARAM_STR);
    if ($_STATE->fields["Log ID"]->value() != "") {
        $stmt->bindValue(':loginname', $_STATE->fields["Log ID"]->value(), PDO::PARAM_STR);
    }
    if (PHP_VERSION_ID < 50500) {
        require_once "password.php";
    }
    if ($_STATE->fields["Password"]->value() != "") {
        $stmt->bindValue(':password', password_hash($_STATE->fields["Password"]->value(), PASSWORD_DEFAULT), PDO::PARAM_STR);
    }
    if ($_STATE->fields["Email"]->value() != "") {
        $stmt->bindValue(':email', $_STATE->fields["Email"]->value(), PDO::PARAM_STR);
    }
    $stmt->execute();
    $sql = "UPDATE " . $_DB->prefix . "c10_person_organization SET inactive_asof=:inactive\n\t\t\tWHERE person_organization_id=" . $_STATE->person_organization_id . ";";
    $stmt = $_DB->prepare($sql);
    if ($_STATE->fields["Inactive As Of"]->value() == "") {
        $stmt->bindValue(':inactive', NULL, db_connect::PARAM_DATE);
    } else {
        $stmt->bindValue(':inactive', $_STATE->fields["Inactive As Of"]->value(), db_connect::PARAM_DATE);
    }
    $stmt->execute();
}
开发者ID:bbogin,项目名称:sr2s,代码行数:39,代码来源:person_edit.php


示例17: soundex_std

 public static function soundex_std($text)
 {
     $words = explode(' ', $text);
     $soundex_array = array();
     foreach ($words as $word) {
         $soundex = soundex($word);
         // Only return codes from recognisable sounds
         if ($soundex != '0000') {
             $soundex_array[] = $soundex;
         }
     }
     // Combine words, e.g. “New York” as “Newyork”
     if (count($words) > 1) {
         $soundex_array[] = soundex(strtr($text, ' ', ''));
     }
     // A varchar(255) column can only hold 51 4-character codes (plus 50 delimiters)
     $soundex_array = array_slice(array_unique($soundex_array), 0, 51);
     if ($soundex_array) {
         return implode(':', $soundex_array);
     } else {
         return null;
     }
 }
开发者ID:brambravo,项目名称:webtrees,代码行数:23,代码来源:Soundex.php


示例18: russell

 /**
  * Generate Russell soundex codes for a given text.
  *
  * @param $text
  *
  * @return null|string
  */
 public static function russell($text)
 {
     $words = preg_split('/\\s/', $text, -1, PREG_SPLIT_NO_EMPTY);
     $soundex_array = array();
     foreach ($words as $word) {
         $soundex = soundex($word);
         // Only return codes from recognisable sounds
         if ($soundex !== '0000') {
             $soundex_array[] = $soundex;
         }
     }
     // Combine words, e.g. “New York” as “Newyork”
     if (count($words) > 1) {
         $soundex_array[] = soundex(strtr($text, ' ', ''));
     }
     // A varchar(255) column can only hold 51 4-character codes (plus 50 delimiters)
     $soundex_array = array_slice(array_unique($soundex_array), 0, 51);
     if ($soundex_array) {
         return implode(':', $soundex_array);
     } else {
         return '';
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:30,代码来源:Soundex.php


示例19: wpshop_search_where_in_customer

 public function wpshop_search_where_in_customer($where)
 {
     if (is_admin() && (!empty($_GET['post_type']) && $_GET['post_type'] == WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS) && (!empty($_GET['s']) || !empty($_GET['entity_filter']))) {
         global $wpdb;
         $where = "\tAND {$wpdb->posts}.post_type = '" . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS . "'";
         if (!empty($_GET['entity_filter'])) {
             switch ($_GET['entity_filter']) {
                 case 'orders':
                     $operator = 'IN';
                     break;
                 case 'no_orders':
                     $operator = 'NOT IN';
                     break;
             }
             $where .= "\tAND (\t{$wpdb->posts}.post_author {$operator} (\r\n\t\t\t\t\t\t\t\t\t\tSELECT {$wpdb->posts}.post_author\r\n\t\t\t\t\t\t\t\t\t\tFROM {$wpdb->posts}\r\n\t\t\t\t\t\t\t\t\t\tWHERE {$wpdb->posts}.post_type = '" . WPSHOP_NEWTYPE_IDENTIFIER_ORDER . "'\r\n\t\t\t\t\t\t\t\t\t\tAND {$wpdb->posts}.post_status != 'auto-draft'\r\n\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t)";
         }
         if (!empty($_GET['s'])) {
             $s_soundex = soundex($_GET['s']);
             $s = strtoupper($_GET['s']);
             $where .= "\tAND ( \t{$wpdb->posts}.ID = '{$s}'\r\n\t\t\t\t\t\t\t\t\tOR UPPER( {$wpdb->posts}.post_title ) LIKE '%{$s}%'\r\n\t\t\t\t\t\t\t\t\tOR SOUNDEX( {$wpdb->posts}.post_title ) = '{$s_soundex}'\r\n\t\t\t\t\t\t\t\t\tOR (\r\n\t\t\t\t\t\t\t\t\t\t{$wpdb->posts}.post_author IN (\r\n\t\t\t\t\t\t\t\t\t\t\tSELECT U.ID\r\n\t\t\t\t\t\t\t\t\t\t\tFROM {$wpdb->users} AS U\r\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN {$wpdb->usermeta} AS UM \r\n\t\t\t\t\t\t\t\t\t\t\tON ( UM.user_id = U.ID )\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tUPPER( U.user_email ) LIKE '%{$s}%'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tOR SOUNDEX( U.user_email ) = '{$s_soundex}'\r\n\t\t\t\t\t\t\t\t\t\t\t\t) \r\n\t\t\t\t\t\t\t\t\t\t\t\tOR\r\n\t\t\t\t\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tUM.meta_key = 'first_name'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND UPPER( UM.meta_value ) LIKE '%{$s}%'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tOR SOUNDEX( UM.meta_value ) = '{$s_soundex}'\r\n\t\t\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t\t\t\tOR\r\n\t\t\t\t\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tUM.meta_key = 'last_name'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND UPPER( UM.meta_value ) LIKE '%{$s}%'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tOR SOUNDEX( UM.meta_value ) = '{$s_soundex}'\r\n\t\t\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\tOR (\r\n\t\t\t\t\t\t\t\t\t\t{$wpdb->posts}.post_author IN (\r\n\t\t\t\t\t\t\t\t\t\t\tSELECT P.post_author\r\n\t\t\t\t\t\t\t\t\t\t\tFROM {$wpdb->posts} AS P\r\n\t\t\t\t\t\t\t\t\t\t\tINNER JOIN {$wpdb->postmeta} AS PM\r\n\t\t\t\t\t\t\t\t\t\t\tON ( PM.post_id = P.ID )\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\t\t\t\tP.post_type = '" . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND PM.meta_key = '_wpshop_address_metadata'\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND UPPER( PM.meta_value ) LIKE '%{$s}%'\r\n\t\t\t\t\t\t\t\t\t\t\t\tOR SOUNDEX( PM.meta_value ) = '{$s_soundex}'\r\n\t\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t\t)";
         }
     }
     return $where;
 }
开发者ID:fedeB-IT-dept,项目名称:fedeB_website,代码行数:24,代码来源:wps_customer_search.php


示例20: getRegionCode

 /**
  * Retrieve region code from name
  * 
  * @param string $countryId
  * @param string $regionName
  * @param boolean $regionOnly
  * @return string|null
  */
 public static function getRegionCode($countryId, $regionName, $regionOnly = true)
 {
     $regions = self::getRegions($countryId);
     if (empty($regions)) {
         return null;
     }
     // cleanup entry skin
     $regionName = self::removeAccents($regionName);
     // search for strict matches
     foreach ($regions as $code => $name) {
         if (strcasecmp($regionName, $name) === 0) {
             // DE-BW or BW
             return $regionOnly ? substr($code, 3) : $code;
         }
     }
     // find similar matches
     foreach ($regions as $code => $name) {
         if (soundex($regionName) === soundex($name)) {
             // DE-BW or BW
             return $regionOnly ? substr($code, 3) : $code;
         }
     }
     return null;
 }
开发者ID:jsiefer,项目名称:emarketing,代码行数:32,代码来源:Region.php



注:本文中的soundex函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sous_repertoire函数代码示例发布时间:2022-05-23
下一篇:
PHP sortthreadsortselectoption函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap