108 lines
2.8 KiB
PHP
108 lines
2.8 KiB
PHP
<?php
|
|
include_once(realpath(dirname(__FILE__)) . "/../../../classes/PluginsClassiques.class.php");
|
|
|
|
class Seo extends PluginsClassiques{
|
|
|
|
var $id;
|
|
var $rubrique;
|
|
var $dossier;
|
|
var $produit;
|
|
var $contenu;
|
|
var $description;
|
|
var $titre;
|
|
var $metakeywords;
|
|
var $metadesc;
|
|
var $domaine;
|
|
var $divers;
|
|
var $lang;
|
|
|
|
var $table = "seo";
|
|
var $bddvars = array("id","rubrique","dossier","produit","contenu","description","titre","metakeywords","metadesc","domaine","divers","lang");
|
|
|
|
function Seo(){
|
|
$this->PluginsClassiques();
|
|
}
|
|
|
|
function init(){
|
|
$cnx = new Cnx();
|
|
$query = "CREATE TABLE `seo` (
|
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
|
|
`rubrique` INT NOT NULL ,
|
|
`dossier` INT NOT NULL ,
|
|
`produit` INT NOT NULL ,
|
|
`contenu` INT NOT NULL ,
|
|
`description` TEXT NOT NULL ,
|
|
`titre` TEXT NOT NULL ,
|
|
`metakeywords` TEXT NOT NULL ,
|
|
`metadesc` TEXT NOT NULL,
|
|
`domaine` TEXT NOT NULL,
|
|
`divers` TEXT NOT NULL,
|
|
`lang` INT NOT NULL
|
|
)";
|
|
$resul = mysql_query($query,$cnx->link);
|
|
|
|
}
|
|
|
|
function charger_dossier($dossier,$lang=1){
|
|
return $this->getVars("select * from $this->table where dossier=$dossier and lang=$lang");
|
|
}
|
|
|
|
function charger_rubrique($rubrique,$lang=1){
|
|
return $this->getVars("select * from $this->table where rubrique=$rubrique and lang=$lang");
|
|
}
|
|
|
|
function charger($id){
|
|
return $this->getVars("select * from $this->table where id=$id");
|
|
}
|
|
|
|
function charger_produit($produit,$lang=1){
|
|
return $this->getvars("select * from $this->table where produit=$produit and lang=$lang");
|
|
}
|
|
|
|
function charger_contenu($contenu,$lang=1){
|
|
return $this->getVars("select * from $this->table where contenu=$contenu and lang=$lang");
|
|
}
|
|
|
|
|
|
|
|
function boucle($texte, $args){
|
|
$produit = lireTag($args,"produit");
|
|
$contenu = lireTag($args,"contenu");
|
|
$rubrique = lireTag($args,"rubrique");
|
|
$dossier = lireTag($args,"dossier");
|
|
|
|
$search = "";
|
|
|
|
if($produit != "") $search .= " and produit=".$produit;
|
|
if($rubrique != "") $search .= " and rubrique=".$rubrique;
|
|
if($dossier != "") $search .= " and dossier=".$dossier;
|
|
if($contenu != "") $search .= " and contenu=".$contenu;
|
|
$search .= " and lang=".$_SESSION["navig"]->lang;
|
|
|
|
if($search == "") return;
|
|
|
|
$query = "select * from $this->table where 1 $search";
|
|
$resul = mysql_query($query);
|
|
|
|
$res = "";
|
|
while($row = mysql_fetch_object($resul)){
|
|
$description = str_replace("\"","'",$row->description);
|
|
$temp = str_replace("#DESCRIPTION",$description,$texte);
|
|
$temp = str_replace("#TITRE",$row->titre,$temp);
|
|
$temp = str_replace("#METAKEYWORDS",$row->metakeywords,$temp);
|
|
$temp = str_replace("#METADESC",$row->metadesc,$temp);
|
|
$temp = str_replace("#DOMAINE",$row->domaine,$temp);
|
|
$temp = str_replace("#DIVERS",$row->divers,$temp);
|
|
|
|
$res .= $temp;
|
|
|
|
}
|
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
?>
|