Changeset 808982
- Timestamp:
- 11/22/2013 05:37:30 PM (12 years ago)
- Location:
- category-class
- Files:
-
- 7 added
- 5 edited
-
tags/1.1 (added)
-
tags/1.1/category-class.php (added)
-
tags/1.1/inc (added)
-
tags/1.1/inc/article.class.php (added)
-
tags/1.1/inc/categorie.class.php (added)
-
tags/1.1/inc/squelette.class.php (added)
-
tags/1.1/readme.txt (added)
-
trunk/category-class.php (modified) (4 diffs)
-
trunk/inc/article.class.php (modified) (1 diff)
-
trunk/inc/categorie.class.php (modified) (1 diff)
-
trunk/inc/squelette.class.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
category-class/trunk/category-class.php
r807831 r808982 6 6 Description: This is just a class for developpers which can be used into plugins, widget, ... 7 7 Author: LordPretender 8 Version: 1. 08 Version: 1.1 9 9 Author URI: http://www.duy-pham.fr 10 10 */ … … 51 51 */ 52 52 private static $catégories = null; 53 54 /** 55 * Tableau associatif qui regroupe tous les précédents chargement de catégories en fonction des paramètres fournis. 56 * 57 * @var Array 58 * @access private 59 * @static 60 */ 61 private static $history = null; 53 62 54 63 /** … … 73 82 $nbPosts = is_int($nbPosts) && $nbPosts >= 0 ? $nbPosts : DEFAULT_NBPOSTS; 74 83 75 //Création de l'objet de départ puis chargement 76 self::$root = new CCS_Catégorie($catID, $withSubCategories, $withPosts, $nbPosts, $withDuplicatePosts, $orderby); 84 //Création de l'objet de départ (sauf si déjà lu plus tôt) puis chargement. 85 if(array_key_exists($catID.$withSubCategories.$withPosts.$nbPosts.$withDuplicatePosts.$orderby, self::$history)){ 86 self::$root = self::$history[$catID.$withSubCategories.$withPosts.$nbPosts.$withDuplicatePosts.$orderby]; 87 }else{ 88 self::$root = new CCS_Catégorie($catID, $withSubCategories, $withPosts, $nbPosts, $withDuplicatePosts, $orderby); 89 90 self::$history[$catID.$withSubCategories.$withPosts.$nbPosts.$withDuplicatePosts.$orderby] = self::$root; 91 } 77 92 } 78 93 … … 182 197 } 183 198 184 private function __construct(){} 199 private function __construct(){ 200 self::$history = array(); 201 } 185 202 186 203 /** -
category-class/trunk/inc/article.class.php
r807831 r808982 6 6 7 7 public function __construct($WP, $catID){ 8 parent::__construct($WP->ID, $WP->post_title );8 parent::__construct($WP->ID, $WP->post_title, $WP); 9 9 10 10 $this->catID = $catID; -
category-class/trunk/inc/categorie.class.php
r807831 r808982 34 34 }else $ID = $WP; 35 35 36 parent::__construct($ID, $titre );36 parent::__construct($ID, $titre, $WP); 37 37 38 38 $this->sousCatégories = array(); -
category-class/trunk/inc/squelette.class.php
r807831 r808982 4 4 protected $ID; 5 5 protected $titre; 6 protected $ObjetWP; 6 7 7 public function __construct($ID, $titre ){8 public function __construct($ID, $titre, $WP){ 8 9 $this->ID = $ID; 9 10 $this->titre = $titre; 11 12 //Pour rester générique, on mémorise aussi l'objet WP (de type stdClass) afin que l'on puisse utiliser d'autres paramètres 13 $this->ObjetWP = $WP; 10 14 } 11 15 … … 32 36 } 33 37 38 public function getstdClass(){ 39 return $this->ObjetWP; 40 } 41 42 /** 43 * Cette méthode sert à accéder à divers éléments de l'objet WP (de type stdClass). 44 * @param string $param Nom de l'attribut contenu dans l'objet stdClass de WP. 45 * 46 * @return mixed 47 */ 48 public function getWPElement($param){ 49 return $this->ObjetWP->$param; 50 } 51 34 52 public function setTitre($titre){ 35 53 $this->titre = $titre; -
category-class/trunk/readme.txt
r807831 r808982 5 5 Requires at least: 3.6.1 6 6 Tested up to: 3.6.1 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 9 9 Here is a library for developpers which help them to use categories and posts whithin a simple class. … … 41 41 == Changelog == 42 42 43 = 1.1 = 44 * All request are now saved in order and will be used if needed (whereas loading them again). 45 * stdClass objects are now saved and usable in others plugins. 46 43 47 = 1.0 = 44 48 * The first version of the plugin. … … 46 50 == Upgrade Notice == 47 51 52 = 1.1 = 53 Tested in WordPress 3.7.1 54 48 55 = 1.0 = 49 56 Tested in WordPress 3.6.1
Note: See TracChangeset
for help on using the changeset viewer.