Ejemplo n.º 1
0
 /**
  * Construction de l'objet utilisateur par remplissage du modèle / Build user through fill in the model
  *
  * @param object $object L'object avec lequel il faut construire le modèle / The object which one to build
  * @param string $meta_key Le nom de la "meta" contenant la définition complète de l'object sous forme json / The "meta" name containing the complete definition of object under json format
  * @param boolean $cropped Permet de choisir si on construit le modèle complet ou uniquement les champs principaux / Allows to choose if the entire model have to be build or only main model
  */
 public function __construct($object, $meta_key, $cropped)
 {
     /**	Instanciation du constructeur de modèle principal / Instanciate the main model constructor	*/
     parent::__construct($object);
     /** If cropped don't get meta */
     if (!$cropped) {
         $internal_meta = !empty($object) && !empty($object->{$meta_key}) ? json_decode($object->{$meta_key}) : null;
         if (!empty($this->array_option)) {
             foreach ($this->array_option as $key => $array) {
                 $this->option[$key] = $this->fill_value($object, $object, $key, $array, $internal_meta);
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Construction de l'objet commentaire par remplissage du modèle / Build comment through fill in the model
  *
  * @param object $object L'object avec lequel il faut construire le modèle / The object which one to build
  * @param string $meta_key Le nom de la "meta" contenant la définition complète de l'object sous forme json / The "meta" name containing the complete definition of object under json format
  * @param boolean $cropped Permet de choisir si on construit le modèle complet ou uniquement les champs principaux / Allows to choose if the entire model have to be build or only main model
  */
 public function __construct($object, $meta_key, $cropped)
 {
     parent::__construct($object);
     /** If cropped, don't get meta */
     if (!$cropped) {
         /** Meta */
         $comment_meta = get_comment_meta($this->id);
         $internal_meta = !empty($comment_meta) && !empty($comment_meta[$meta_key]) && !empty($comment_meta[$meta_key][0]) ? json_decode($comment_meta[$meta_key][0]) : null;
         if (!empty($this->array_option)) {
             foreach ($this->array_option as $key => $array) {
                 $this->option[$key] = $this->fill_value($object, $comment_meta, $key, $array, $internal_meta);
             }
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Construction de l'objet taxinomie par remplissage du modèle / Build taxonomy through fill in the model
  *
  * @param object $object L'object avec lequel il faut construire le modèle / The object which one to build
  * @param string $meta_key Le nom de la "meta" contenant la définition complète de l'object sous forme json / The "meta" name containing the complete definition of object under json format
  * @param boolean $cropped Permet de choisir si on construit le modèle complet ou uniquement les champs principaux / Allows to choose if the entire model have to be build or only main model
  */
 public function __construct($object, $meta_key, $cropped)
 {
     /**	Instanciation du constructeur de modèle principal / Instanciate the main model constructor	*/
     parent::__construct($object);
     /** If cropped don't get meta */
     if (!$cropped) {
         /** Lecture des "metas" pour la taxinomie / Read taxonomy "meta" */
         $meta = null;
         if (!empty($object) && is_object($object) && class_exists('wpeo_taxonomy_meta')) {
             $meta = wpeo_taxonomy_meta::get_term_taxonomy_meta($object->term_taxonomy_id);
         }
         $internal_meta = !empty($meta) && !empty($meta[$meta_key]) && !empty($meta[$meta_key][0]) ? json_decode($meta[$meta_key][0]) : null;
         if (!empty($this->array_option)) {
             foreach ($this->array_option as $key => $array) {
                 $this->option[$key] = $this->fill_value($object, $meta, $key, $array, $internal_meta);
             }
         }
     }
 }