当前位置: 首页>>代码示例>>PHP>>正文


PHP isEAN函数代码示例

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


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

示例1: critere_isbn

function critere_isbn($val1)
{
    $val = $val1;
    if (isEAN($val1)) {
        // la saisie est un EAN -> on tente de le formater en ISBN
        $val1 = z_EANtoISBN($val1);
        // si échec, on prend l'EAN comme il vient
        if (!$val1) {
            $val1 = $val;
        }
    } else {
        if (isISBN($val1)) {
            // si la saisie est un ISBN
            $val1 = z_formatISBN($val1, 13);
            // si échec, ISBN erroné on le prend sous cette forme
            if (!$val1) {
                $val1 = $val;
            }
        } else {
            // ce n'est rien de tout ça, on prend la saisie telle quelle
            $val1 = $val;
        }
    }
    return $val1;
}
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:25,代码来源:z_progression_cache.php

示例2: make_search


//.........这里部分代码省略.........
                 }
             }
             //Pour chaque valeur du champ
             for ($j = 0; $j < count($field); $j++) {
                 //Pour chaque requete
                 $field_origine = $field[$j];
                 for ($z = 0; $z < count($q) - 1; $z++) {
                     //Pour chaque valeur du cha
                     //Si le nettoyage de la saisie est demande
                     if ($q[$z]["KEEP_EMPTYWORD"]) {
                         $field[$j] = strip_empty_chars($field_origine);
                     } elseif ($q[$z]["REGDIACRIT"]) {
                         $field[$j] = strip_empty_words($field_origine);
                     } elseif ($q[$z]["DETECTDATE"]) {
                         $field[$j] = detectFormatDate($field_origine, $q[$z]["DETECTDATE"]);
                     }
                     $main = $q[$z]["MAIN"];
                     //Si il y a plusieurs termes possibles on construit la requete avec le terme !!multiple_term!!
                     if ($q[$z]["MULTIPLE_WORDS"]) {
                         $terms = explode(" ", $field[$j]);
                         //Pour chaque terme,
                         $multiple_terms = array();
                         for ($k = 0; $k < count($terms); $k++) {
                             $multiple_terms[] = str_replace("!!p!!", $terms[$k], $q[$z]["MULTIPLE_TERM"]);
                         }
                         $final_term = implode(" " . $q[$z]["MULTIPLE_OPERATOR"] . " ", $multiple_terms);
                         $main = str_replace("!!multiple_term!!", $final_term, $main);
                         //Si la saisie est un ISBN
                     } else {
                         if ($q[$z]["ISBN"]) {
                             //Code brut
                             $terms[0] = $field[$j];
                             //EAN ?
                             if (isEAN($field[$j])) {
                                 //C'est un isbn ?
                                 if (isISBN($field[$j])) {
                                     $rawisbn = preg_replace('/-|\\.| /', '', $field[$j]);
                                     //On envoi tout ce qu'on sait faire en matiere d'ISBN, en raw et en formatte, en 10 et en 13
                                     $terms[1] = formatISBN($rawisbn, 10);
                                     $terms[2] = formatISBN($rawisbn, 13);
                                     $terms[3] = preg_replace('/-|\\.| /', '', $terms[1]);
                                     $terms[4] = preg_replace('/-|\\.| /', '', $terms[2]);
                                 }
                             } else {
                                 if (isISBN($field[$j])) {
                                     $rawisbn = preg_replace('/-|\\.| /', '', $field[$j]);
                                     //On envoi tout ce qu'on sait faire en matiere d'ISBN, en raw et en formatte, en 10 et en 13
                                     $terms[1] = formatISBN($rawisbn, 10);
                                     $terms[2] = formatISBN($rawisbn, 13);
                                     $terms[3] = preg_replace('/-|\\.| /', '', $terms[1]);
                                     $terms[4] = preg_replace('/-|\\.| /', '', $terms[2]);
                                 }
                             }
                             //Pour chaque terme,
                             $multiple_terms = array();
                             for ($k = 0; $k < count($terms); $k++) {
                                 $multiple_terms[] = str_replace("!!p!!", $terms[$k], $q[$z]["MULTIPLE_TERM"]);
                             }
                             $final_term = implode(" " . $q[$z]["MULTIPLE_OPERATOR"] . " ", $multiple_terms);
                             $main = str_replace("!!multiple_term!!", $final_term, $main);
                         } else {
                             if ($q[$z]["BOOLEAN"]) {
                                 if ($q[$z]['STEMMING']) {
                                     $stemming = $pmb_search_stemming_active;
                                 } else {
                                     $stemming = 0;
开发者ID:hogsim,项目名称:PMB,代码行数:67,代码来源:search.class.php

示例3: process_isbn

 function process_isbn($isbn)
 {
     /* We've got everything, let's have a look if ISBN already exists in notices table */
     $isbn_nettoye = preg_replace('/-|\\.| |\\(|\\)|\\[|\\]|\\:|\\;|[A-WY-Z]/i', '', $isbn);
     $isbn_nettoye_13 = substr($isbn_nettoye, 0, 13);
     $isbn_nettoye_10 = substr($isbn_nettoye, 0, 10);
     $isbn_OK = "";
     if (isEAN($isbn_nettoye_13)) {
         /* it's an EAN -> convert it to ISBN */
         $isbn_OK = EANtoISBN($isbn_nettoye_13);
     }
     if (!$isbn_OK) {
         if (isISBN($isbn_nettoye_10)) {
             $isbn_OK = formatISBN($isbn_nettoye_10);
         }
     }
     if (!$isbn_OK) {
         $isbn_OK = clean_string($isbn);
     }
     return $isbn_OK;
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:21,代码来源:z3950_notice.class.php

示例4: listSuggestions

 static function listSuggestions($id_bibli = 0, $statut = '-1', $num_categ = '-1', $mask, $debut = 0, $nb_per_page = 0, $aq = 0, $order = '', $location = 0, $user_input = '', $source = 0, $user_id = 0, $user_statut = '-1')
 {
     if ($source) {
         $filtre_src = " sugg_source = '" . $source . "' ";
     } else {
         $filtre_src = " 1 ";
     }
     if (!$statut) {
         $statut = '-1';
     }
     if ($statut == '-1') {
         $filtre1 = '1';
     } elseif ($statut == $mask) {
         $filtre1 = "(statut & '" . $mask . "') = '" . $mask . "' ";
     } else {
         $filtre1 = "(statut & '" . $mask . "') = 0 and (statut & " . $statut . ") = '" . $statut . "' ";
     }
     if ($num_categ == '-1') {
         $filtre2 = '1';
     } else {
         $filtre2 = "num_categ = '" . $num_categ . "' ";
     }
     if (!$id_bibli) {
         $filtre3 = '1';
     } else {
         $filtre3 .= "num_entite = '" . $id_bibli . "' ";
     }
     if ($location == 0) {
         $filtre4 = '1';
     } else {
         $filtre4 = "sugg_location = '" . $location . "' ";
     }
     $filtre_empr = '';
     $tab_empr = array();
     $filtre_user = '';
     $tab_user = array();
     if (is_array($user_id) && count($user_id) && is_array($user_statut) && count($user_statut)) {
         foreach ($user_id as $k => $id) {
             if ($user_statut[$k] == "0") {
                 $tab_user[] = $id;
             }
             if ($user_statut[$k] == "1") {
                 $tab_empr[] = $id;
             }
         }
     }
     if (is_array($tab_empr) && count($tab_empr)) {
         $filtre_empr = "suggestions_origine.origine in ('" . implode("','", $tab_empr) . "') and type_origine='1' ";
     }
     if (is_array($tab_user) && count($tab_user)) {
         $filtre_user = "suggestions_origine.origine in ('" . implode("','", $tab_user) . "') and type_origine='0' ";
     }
     if ($filtre_empr != "" || $filtre_user != "") {
         $table_origine = ", suggestions_origine ";
         $join_origine = "  id_suggestion=num_suggestion  ";
         if ($filtre_empr && $filtre_user) {
             $clause_origine = " and ( (" . $filtre_empr . ") or (" . $filtre_user . ") ) and ";
         } elseif ($filtre_empr) {
             $clause_origine = " and (" . $filtre_empr . ") and ";
         } elseif ($filtre_user) {
             $clause_origine = " and (" . $filtre_user . ") and ";
         }
     }
     if (!$aq) {
         $q = "select * from suggestions {$table_origine}";
         $q .= "where {$join_origine} {$clause_origine} " . $filtre1 . " and " . $filtre2 . " and " . $filtre3 . " and " . $filtre4 . " and " . $filtre_src;
         if (!$order) {
             $q .= "order by statut, date_creation desc ";
         } else {
             $q .= "order by" . $order . " ";
         }
     } else {
         $isbn = '';
         $t_codes = array();
         if ($user_input !== '') {
             if (isEAN($user_input)) {
                 // la saisie est un EAN -> on tente de le formater en ISBN
                 $isbn = EANtoISBN($user_input);
                 if ($isbn) {
                     $t_codes[] = $isbn;
                     $t_codes[] = formatISBN($isbn, 10);
                 }
             } elseif (isISBN($user_input)) {
                 // si la saisie est un ISBN
                 $isbn = formatISBN($user_input);
                 if ($isbn) {
                     $t_codes[] = $isbn;
                     $t_codes[] = formatISBN($isbn, 13);
                 }
             }
         }
         if (count($t_codes)) {
             $q = "select * from suggestions {$table_origine}";
             $q .= "where {$join_origine} {$clause_origine} (" . $filtre1 . " and " . $filtre2 . " and " . $filtre3 . " and " . $filtre4 . " and " . $filtre_src;
             $q .= ") ";
             $q .= "and ('0' ";
             foreach ($t_codes as $v) {
                 $q .= "or code like '%" . $v . "%' ";
             }
             $q .= ") ";
//.........这里部分代码省略.........
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:101,代码来源:suggestions.class.php

示例5: mysql_query

//Limite la taille de l'image à 1 Mo
if ($notice_id && $pmb_notice_img_folder_id) {
    $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
    $res = mysql_query($req, $dbh);
    if (mysql_num_rows($res)) {
        $rep = mysql_fetch_object($res);
        $img = $rep->repertoire_path . "img_" . $notice_id;
        header('Content-Type: image/png');
        $fp = @fopen($img, "rb");
        fpassthru($fp);
        fclose($fp);
        exit;
    }
}
if ($noticecode) {
    if (isEAN($noticecode)) {
        if (isISBN($noticecode)) {
            if (isISBN10($noticecode)) {
                $url_image10 = str_replace("!!isbn!!", str_replace("-", "", $noticecode), $_GET['url_image']);
                $url_image13 = str_replace("!!isbn!!", str_replace("-", "", formatISBN($noticecode, "13")), $_GET['url_image']);
            } else {
                $url_image10 = str_replace("!!isbn!!", str_replace("-", "", EANtoISBN10($noticecode)), $_GET['url_image']);
                $url_image13 = str_replace("!!isbn!!", str_replace("-", "", $noticecode), $_GET['url_image']);
            }
        } else {
            $url_imageEAN = str_replace("!!isbn!!", str_replace("-", "", $noticecode), $_GET['url_image']);
        }
    }
    $url_image = str_replace("!!isbn!!", $noticecode, $_GET['url_image']);
} else {
    $url_image = rawurldecode(stripslashes($_GET['url_image']));
开发者ID:bouchra012,项目名称:PMB,代码行数:31,代码来源:getimage.php

示例6: header

require "{$include_path}/templates/common.tpl.php";
header("Content-Type: text/html; charset=" . $charset);
print "\n<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'\n 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>\n<html xmlns='http://www.w3.org/1999/xhtml' lang='{$msg['1002']}' charset='" . $charset . "'>\n\t<meta http-equiv='Pragma' content='no-cache'>\n\t\t<meta http-equiv='Cache-Control' content='no-cache'>";
print link_styles($stylesheet);
print "\t<title>{$msg['4014']}</title></head><body>";
if (!$formulaire_appelant) {
    $formulaire_appelant = "notice";
}
if (!$objet_appelant) {
    $objet_appelant = "f_cb";
}
// traitement de la soumission
if ($suite) {
    // un CB a été soumis
    if ($cb) {
        if (isEAN($cb)) {
            // la saisie est un EAN -> on tente de le formater en ISBN
            $code = EANtoISBN($cb);
            // si échec, on prend l'EAN comme il vient
            if (!$code) {
                $code = $cb;
            }
        } else {
            if (isISBN($cb)) {
                // si la saisie est un ISBN
                $code = formatISBN($cb, 13);
                // si échec, ISBN erroné on le prend sous cette forme
                if (!$code) {
                    $code = $cb;
                }
            } else {
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:31,代码来源:setcb.php

示例7: array

 // auteurs secondaires
 for ($i = 0; $i < $max_aut2; $i++) {
     $var_autid = "f_aut2_id{$i}";
     $var_autfonc = "f_f2_code{$i}";
     $f_aut[] = array('id' => ${$var_autid}, 'fonction' => ${$var_autfonc}, 'type' => '2', 'ordre' => $i);
 }
 $f_ed1 ? $t_notice['ed1_id'] = $f_ed1_id : ($t_notice['ed1_id'] = 0);
 $f_ed2 ? $t_notice['ed2_id'] = $f_ed2_id : ($t_notice['ed2_id'] = 0);
 $f_coll && $t_notice['ed1_id'] ? $t_notice['coll_id'] = $f_coll_id : ($t_notice['coll_id'] = 0);
 $f_subcoll && $t_notice['coll_id'] ? $t_notice['subcoll_id'] = $f_subcoll_id : ($t_notice['subcoll_id'] = 0);
 $t_notice['year'] = trim($f_year);
 $f_nocoll && $t_notice['coll_id'] ? $t_notice['nocoll'] = trim($f_nocoll) : ($t_notice['nocoll'] = '');
 $t_notice['mention_edition'] = trim($f_mention_edition);
 if ($f_cb) {
     // ce controle redondant est la pour le cas ou l'utilisateur aurait change le code
     if (isEAN($f_cb)) {
         // la saisie est un EAN -> on tente de le formater en ISBN
         $code = EANtoISBN($f_cb);
         // si echec, on prend l'EAN comme il vient
         if (!$code) {
             $code = $f_cb;
         }
     } else {
         if (isISBN($f_cb)) {
             // si la saisie est un ISBN
             $code = formatISBN($f_cb, 13);
             // si echec, ISBN errone on le prend sous cette forme
             if (!$code) {
                 $code = $f_cb;
             }
         } else {
开发者ID:hogsim,项目名称:PMB,代码行数:31,代码来源:update_notice.inc.php

示例8: die

// � 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: isbn.inc.php,v 1.1 2011-06-06 08:04:28 dbellamy Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once "{$include_path}/isbn.inc.php";
if (isset($code)) {
    switch ($fname) {
        case 'getPatterns':
            $tab = array();
            $code = preg_replace('/-|\\.| /', '', $code);
            $code = str_replace('x', 'X', $code);
            //format expurge
            $tab[] = $code;
            if (isEAN($code)) {
                $EAN = $code;
                $isbn = EANtoISBN($code);
                if ($isbn) {
                    //formatISBN10
                    $tab[] = formatISBN($code, 10);
                    //formatISBN13
                    $tab[] = formatISBN($code, 13);
                }
            }
            if (isISBN($code)) {
                $isbn = formatISBN($code);
                if ($isbn) {
                    //formatISBN10
                    $tab[] = formatISBN($code, 10);
                    //formatISBN13
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:31,代码来源:isbn.inc.php

示例9: import_basic


//.........这里部分代码省略.........
                 $fp = fopen($base_path . "/temp/err_import.unimarc", "a+");
                 fwrite($fp, $notice);
                 fclose($fp);
                 $notice_rejetee++;
             } else {
                 recup_noticeunimarc_suite($notice);
                 global $isbn, $EAN, $issn_011, $collection_225, $collection_410, $code, $code10, $isbn_OK, $notice_id;
                 if ($isbn[0] == "NULL") {
                     $isbn[0] = "";
                 }
                 // si isbn vide, on va tenter de prendre l'EAN stocké en 345$b
                 if ($isbn[0] == "") {
                     $isbn[0] = $EAN[0];
                 }
                 // si isbn vide, on va tenter de prendre le serial en 011
                 if ($isbn[0] == "") {
                     $isbn[0] = $issn_011[0];
                 }
                 // si ISBN obligatoire et isbn toujours vide :
                 if ($params["isbn_mandatory"] == 1 && $isbn[0] == "") {
                     // on va tenter de prendre l'ISSN stocké en 225$x
                     $isbn[0] = $collection_225[0]['x'];
                     // si isbn toujours vide, on va tenter de prendre l'ISSN stocké en 410$x
                     if ($isbn[0] == "") {
                         $isbn[0] = $collection_410[0]['x'];
                     }
                 }
                 // on commence par voir ce que le code est (basé sur la recherche par code du module catalogage
                 $ex_query = clean_string($isbn[0]);
                 $EAN = '';
                 $isbn = '';
                 $code = '';
                 $code10 = '';
                 if (isEAN($ex_query)) {
                     // la saisie est un EAN -> on tente de le formater en ISBN
                     $EAN = $ex_query;
                     $isbn = EANtoISBN($ex_query);
                     // si échec, on prend l'EAN comme il vient
                     if (!$isbn) {
                         $code = str_replace("*", "%", $ex_query);
                     } else {
                         $code = $isbn;
                         $code10 = formatISBN($code, 10);
                     }
                 } else {
                     if (isISBN($ex_query)) {
                         // si la saisie est un ISBN
                         $isbn = formatISBN($ex_query);
                         // si échec, ISBN erroné on le prend sous cette forme
                         if (!$isbn) {
                             $code = str_replace("*", "%", $ex_query);
                         } else {
                             $code10 = $isbn;
                             $code = formatISBN($code10, 13);
                         }
                     } else {
                         // ce n'est rien de tout ça, on prend la saisie telle quelle
                         $code = str_replace("*", "%", $ex_query);
                     }
                 }
                 $isbn_OK = $code;
                 $new_notice = 0;
                 $notice_id = 0;
                 // le paramétrage est-il : dédoublonnage sur code ? / Ne dédoublonner que sur code ISBN (ignorer les ISSN) ?
                 if ($params["isbn_dedoublonnage"] && !$params["isbn_only"] || $params["isbn_dedoublonnage"] && $params["isbn_only"] && isISBN($isbn)) {
                     $trouvees = 0;
开发者ID:bouchra012,项目名称:PMB,代码行数:67,代码来源:pmbesConvertImport.class.php

示例10: die

// $Id: notice_display.inc.php,v 1.80 2015-04-03 11:16:16 jpermanne Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
$libelle = $msg[270];
require_once $base_path . '/includes/templates/notice_display.tpl.php';
require_once $base_path . '/includes/explnum.inc.php';
require_once $base_path . '/classes/notice_affichage.class.php';
require_once $base_path . '/includes/bul_list_func.inc.php';
require_once $base_path . '/classes/upload_folder.class.php';
print $notice_display_header;
if ($ref) {
    $EAN = '';
    $isbn = '';
    $code = '';
    if (isEAN($ref)) {
        // la saisie est un EAN -> on tente de le formater en ISBN
        $EAN = $ref;
        $isbn = EANtoISBN($ref);
        // si échec, on prend l'EAN comme il vient
        if (!$isbn) {
            $code = str_replace("*", "%", $ref);
        } else {
            $code = $isbn;
            $code10 = formatISBN($code, 10);
        }
    } else {
        if (isISBN($ref)) {
            // si la saisie est un ISBN
            $isbn = formatISBN($ref);
            // si échec, ISBN erroné on le prend sous cette forme
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:31,代码来源:notice_display.inc.php

示例11: getNbActes

 static function getNbActes($id_bibli, $type_acte, $statut = '-1', $aq = 0, $user_input = '')
 {
     global $dbh;
     if ($statut == '-1') {
         $filtre = '';
     } elseif ($statut == 32) {
         $filtre = "and ((actes.statut & 32) = 32) ";
     } else {
         $filtre = "and ((actes.statut & 32) = 0) and ((actes.statut & " . $statut . ") = '" . $statut . "') ";
     }
     if (!$aq) {
         $q = "select count(1) from actes where num_entite = '" . $id_bibli . "' ";
         $q .= "and type_acte = '" . $type_acte . "' " . $filtre . " ";
     } else {
         $isbn = '';
         $t_codes = array();
         if ($user_input !== '') {
             if (isEAN($user_input)) {
                 // la saisie est un EAN -> on tente de le formater en ISBN
                 $isbn = EANtoISBN($user_input);
                 if ($isbn) {
                     $t_codes[] = $isbn;
                     $t_codes[] = formatISBN($isbn, 10);
                 }
             } elseif (isISBN($user_input)) {
                 // si la saisie est un ISBN
                 $isbn = formatISBN($user_input);
                 if ($isbn) {
                     $t_codes[] = $isbn;
                     $t_codes[] = formatISBN($isbn, 13);
                 }
             }
         }
         if (count($t_codes)) {
             $q = "select count(distinct(id_acte)) from actes left join lignes_actes on num_acte=id_acte ";
             $q .= "where ( num_entite='" . $id_bibli . "' and type_acte='" . $type_acte . "' " . $filtre . " ) ";
             $q .= "and ('0' ";
             foreach ($t_codes as $v) {
                 $q .= "or code like '%" . $v . "%' ";
             }
             $q .= ") ";
         } else {
             $members_actes = $aq->get_query_members("actes", "numero", "index_acte", "id_acte");
             $members_lignes = $aq->get_query_members("lignes_actes", "code", "index_ligne", "id_ligne");
             $q = "select count(distinct(id_acte)) from actes left join lignes_actes on num_acte=id_acte ";
             $q .= "where ( num_entite='" . $id_bibli . "' and type_acte='" . $type_acte . "' " . $filtre . " ) ";
             $q .= "and (" . $members_actes["where"] . " or " . $members_lignes["where"] . ") ";
         }
     }
     $r = mysql_query($q, $dbh);
     return mysql_result($r, 0, 0);
 }
开发者ID:bouchra012,项目名称:PMB,代码行数:52,代码来源:entites.class.php

示例12: get_form_sel

 function get_form_sel()
 {
     global $harvest_notice_tpl, $harvest_notice_tpl_error;
     //Je regarde si la notice à un isbn
     $req = "SELECT code FROM notices WHERE notice_id='" . $this->id . "'";
     $res = pmb_mysql_query($req);
     if (pmb_mysql_num_rows($res) && (isISBN(pmb_mysql_result($res, 0, 0)) || isEAN(pmb_mysql_result($res, 0, 0)))) {
         $tpl = $harvest_notice_tpl;
         $harvests = new harvests();
         $tpl = str_replace('!!sel_harvest!!', $harvests->get_sel('harvest_id', 0), $tpl);
         $h = new harvest_profil_imports();
         $tpl = str_replace('!!sel_profil!!', $h->get_sel('profil_id', 0), $tpl);
         $tpl = str_replace('!!notice_id!!', $this->id, $tpl);
     } else {
         $tpl = $harvest_notice_tpl_error;
     }
     return $tpl;
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:18,代码来源:harvest_notice.class.php

示例13: getEnrichment

 function getEnrichment($notice_id, $source_id, $type = "", $enrich_params = array(), $page = 1)
 {
     $params = $this->get_source_params($source_id);
     if ($params["PARAMETERS"]) {
         //Affichage du formulaire avec $params["PARAMETERS"]
         $vars = unserialize($params["PARAMETERS"]);
         foreach ($vars as $key => $val) {
             global ${$key};
             ${$key} = $val;
         }
     }
     $enrichment = array();
     //on renvoi ce qui est demandé... si on demande rien, on renvoi tout..
     switch ($type) {
         case "books":
         default:
             $rqt = "select code from notices where notice_id = '{$notice_id}'";
             $res = pmb_mysql_query($rqt);
             if (pmb_mysql_num_rows($res)) {
                 $ref = pmb_mysql_result($res, 0, 0);
                 //google change son API, on s'assure d'avoir un ISBN13 formaté !
                 if (isEAN(${$ref})) {
                     // la saisie est un EAN -> on tente de le formater en ISBN
                     $EAN = $ref;
                     $isbn = EANtoISBN($ref);
                     // si échec, on prend l'EAN comme il vient
                     if (!$isbn) {
                         $code = str_replace("*", "%", $ref);
                     } else {
                         $code = $isbn;
                         $code10 = formatISBN($code, 10);
                     }
                 } else {
                     if (isISBN($ref)) {
                         // si la saisie est un ISBN
                         $isbn = formatISBN($ref);
                         // si échec, ISBN erroné on le prend sous cette forme
                         if (!$isbn) {
                             $code = str_replace("*", "%", $ref);
                         } else {
                             $code10 = $isbn;
                             $code = formatISBN($code10, 13);
                         }
                     } else {
                         // ce n'est rien de tout ça, on prend la saisie telle quelle
                         $code = str_replace("*", "%", $ref);
                     }
                 }
                 //plutot que de faire une requete pour lancer que si ca marche, on ajoute un callback en cas d'échec
                 if ($code) {
                     $enrichment['books']['content'] = "\n\t\t\t\t\t\t<div id='gbook{$notice_id}' style='width: " . $width . "px; height: " . $height . "px;margin-bottom:0.5em;'></div>";
                     $enrichment['books']['callback'] = "\n\t\t\t\t\t\t\tvar viewer = new google.books.DefaultViewer(document.getElementById('gbook" . $notice_id . "'));\n\t\t\t\t\t\t\tvar gbook" . $notice_id . "_failed = function(){\n\t\t\t\t\t\t\t\tvar content = document.getElementById('gbook" . $notice_id . "');\n\t\t\t\t\t\t\t\tvar span = document.createElement('span');\n\t\t\t\t\t\t\t\tvar txt = document.createTextNode('" . $this->msg["gbook_no_preview"] . "');\n\t\t\t\t\t\t\t\tspan.appendChild(txt);\n\t\t\t\t\t\t\t\tcontent.appendChild(span);\n\t\t\t\t\t\t\t\tcontent.style.height='auto';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tviewer.load('ISBN:" . str_replace("-", "", $code) . "',gbook" . $notice_id . "_failed);\t\n\t\t\t\t\t\t";
                 } else {
                     $enrichment['books']['content'] = "<span>" . $this->msg["gbook_no_preview"] . "</span>";
                 }
             }
             break;
     }
     $enrichment['source_label'] = $this->msg['gbooks_enrichment_source'];
     return $enrichment;
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:61,代码来源:google_book.class.php

示例14: traite_code_isbn

function traite_code_isbn($saisieISBN = "")
{
    if ($saisieISBN) {
        if (isEAN($saisieISBN)) {
            // la saisie est un EAN -> on tente de le formater en ISBN
            $code = EANtoISBN($saisieISBN);
            // si échec, on prend l'EAN comme il vient
            if (!$code) {
                $code = $saisieISBN;
            }
        } else {
            if (isISBN($saisieISBN)) {
                // si la saisie est un ISBN
                $code = formatISBN($saisieISBN);
                // si échec, ISBN erroné on le prend sous cette forme
                if (!$code) {
                    $code = $saisieISBN;
                }
            } else {
                // ce n'est rien de tout ça, on prend la saisie telle quelle
                $code = $saisieISBN;
            }
        }
        return $code;
    }
    return "";
}
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:27,代码来源:isbn.inc.php

示例15: test_cb

function test_cb()
{
    global $cb;
    global $barcode;
    $isbn = '';
    $barcode = '';
    // on commence par voir ce que la saisie utilisateur est ($cb)
    $cb = clean_string($cb);
    if (isEAN($cb)) {
        // la saisie est un EAN -> on tente de le formater en ISBN
        $isbn = EANtoISBN($cb);
        // si échec, on prend l'EAN comme il vient
        if (!$isbn) {
            $barcode = $cb;
        } else {
            $barcode = $isbn;
        }
    } else {
        if (isISBN($cb)) {
            // si la saisie est un ISBN
            $isbn = formatISBN($cb);
            // si échec, ISBN erroné on le prend sous cette forme
            if (!$isbn) {
                $barcode = $cb;
            } else {
                $barcode = $isbn;
            }
        } else {
            // ce n'est rien de tout ça, on prend la saisie telle quelle
            $barcode = $cb;
        }
    }
}
开发者ID:bouchra012,项目名称:PMB,代码行数:33,代码来源:frame_facture.php


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