Changeset 227
- Timestamp:
- 08/02/06 01:24:02 (2 years ago)
- Files:
-
- trunk/lib/jelix/acl/jAcl.class.php (modified) (2 diffs)
- trunk/lib/jelix/acl/jAclManager.class.php (modified) (5 diffs)
- trunk/lib/jelix/acl/jAclUserGroup.class.php (modified) (12 diffs)
- trunk/lib/jelix/tpl/plugins/common/block.ifacl.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/common/block.ifnotacl.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/common/block.ifuserconnected.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/common/block.ifusernotconnected.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/common/function.include.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/common/function.zone.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/common/modifier.cat.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/common/modifier.count_characters.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/common/modifier.count_paragraphs.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/common/modifier.count_sentences.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/common/modifier.count_words.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/common/modifier.date_format.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/common/modifier.escxml.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/common/modifier.indent.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/common/modifier.jdatetime.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/common/modifier.regex_replace.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/common/modifier.replace.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/common/modifier.spacify.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/common/modifier.sprintf.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/common/modifier.strip.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/common/modifier.strip_tags.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/common/modifier.truncate.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/common/modifier.wordwrap.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/html/function.jlocale.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/html/function.jurl.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/html/function.urljsstring.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/html/meta.html.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/html/modifier.nl2br.php (modified) (1 diff)
- trunk/lib/jelix/tpl/plugins/text/function.jlocale.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/text/function.jurl.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/xul/function.jlocale.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/xul/function.jurl.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/xul/function.urljsstring.php (modified) (2 diffs)
- trunk/lib/jelix/tpl/plugins/xul/meta.xul.php (modified) (2 diffs)
- trunk/Makefile (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix/acl/jAcl.class.php
r207 r227 5 5 * @version $Id:$ 6 6 * @author Laurent Jouanneau 7 * @contributor8 7 * @copyright 2006 Laurent Jouanneau 9 8 * @link http://www.jelix.org … … 12 11 13 12 /** 14 * Permet de conna�e les droits 13 * Main class to query the acl system, and to know value of a right 14 * 15 * you should call this class (all method are static) when you want to know if 16 * the current user have a right, or to know if he is a member of a group 17 * This class needs the acl module. 18 * @package jelix 19 * @subpackage acl 20 * @static 15 21 */ 16 22 class jAcl { 17 23 18 private function __construct (){ } 24 /** 25 * @internal The constructor is private, because all methods are static 26 */ 27 private function __construct (){ } 19 28 20 public static function isMemberOfGroup ($groupid){ 21 $groups = self::getGroups(); 22 return in_array($groupid, $groups); 23 } 29 /** 30 * Says if the current user is a member of the given user group 31 * @param int $groupid The id of a group 32 * @return boolean true if it's ok 33 */ 34 public static function isMemberOfGroup ($groupid){ 35 $groups = self::getGroups(); 36 return in_array($groupid, $groups); 37 } 24 38 25 public static function check($subject, $value, $resource=null){ 26 $val = self::getRight($subject, $resource); 27 return ($val & $value)?true:false; 28 } 39 /** 40 * call this method to know if the current user has the right with the given value 41 * @param string $subject the key of the subject to check 42 * @param int $value the value to test against 43 * @param string $resource the id of a resource 44 * @return boolean true if yes 45 */ 46 public static function check($subject, $value, $resource=null){ 47 $val = self::getRight($subject, $resource); 48 return ($val & $value)?true:false; 49 } 29 50 30 public static function getRight($subject, $resource=null){ 31 static $aclres = array(); 32 static $acl = array(); 51 /** 52 * return the value of the right on the given subject (and on the optional resource) 53 * @param string $subject the key of the subject 54 * @param string $resource the id of a resource 55 * @return int the value of the right 56 */ 57 public static function getRight($subject, $resource=null){ 58 static $aclres = array(); 59 static $acl = array(); 33 60 34 if($resource === null){35 if(isset($acl[$subject])){36 return $acl[$subject];37 }38 }else{39 if(isset($aclres[$subject][$resource])){40 return $aclres[$subject][$resource];41 }42 }43 if(!jAuth::isConnected())44 return 0;61 if($resource === null){ 62 if(isset($acl[$subject])){ 63 return $acl[$subject]; 64 } 65 }else{ 66 if(isset($aclres[$subject][$resource])){ 67 return $aclres[$subject][$resource]; 68 } 69 } 70 if(!jAuth::isConnected()) 71 return 0; 45 72 46 $groups = self::getGroups();73 $groups = self::getGroups(); 47 74 48 // recup� toutes les valeurs correspondant aux groupes auquel appartient le user,49 // avec le sujet et ressource indiqu�// droit = OU entre ces valeurs75 // recup� toutes les valeurs correspondant aux groupes auquel appartient le user, 76 // avec le sujet et ressource indiqu� // droit = OU entre ces valeurs 50 77 51 $dao = jDao::get('acl~jaclrights');52 if($resource === null){53 $list=$dao->getAllGroupRights($subject, $groups);54 }else{55 $list=$dao->getAllGroupRightsWithRes($subject, $groups, $resource);56 }57 $value=0;58 foreach($list as $right){59 $value |= intval($right->value);60 }78 $dao = jDao::get('acl~jaclrights'); 79 if($resource === null){ 80 $list=$dao->getAllGroupRights($subject, $groups); 81 }else{ 82 $list=$dao->getAllGroupRightsWithRes($subject, $groups, $resource); 83 } 84 $value=0; 85 foreach($list as $right){ 86 $value |= intval($right->value); 87 } 61 88 62 if($resource === null){63 $aclres[$subject][$resource] =$value;64 }else{65 $acl[$subject] = $value;66 }67 return $value;68 }89 if($resource === null){ 90 $aclres[$subject][$resource] =$value; 91 }else{ 92 $acl[$subject] = $value; 93 } 94 return $value; 95 } 69 96 97 /** 98 * retrieve the list of group the current user is member of 99 * @return array list of group id 100 */ 101 protected static function getGroups(){ 102 static $groups = null; 70 103 71 protected static function getGroups(){72 static $groups = null;104 if(!isset($_SESSION['JELIX_USER']->login)) 105 return array(); 73 106 74 if(!isset($_SESSION['JELIX_USER']->login)) 75 return array(); 76 77 // chargement des groupes 78 if($groups === null){ 79 $dao = jDao::get('acl~jaclusergroup'); 80 $gp = $dao->getGroupsUser($_SESSION['JELIX_USER']->login); 81 $groups = array(); 82 foreach($gp as $g){ 83 $groups[]=intval($g->id_aclgrp); 84 } 85 } 86 return $groups; 87 } 107 // chargement des groupes 108 if($groups === null){ 109 $dao = jDao::get('acl~jaclusergroup'); 110 $gp = $dao->getGroupsUser($_SESSION['JELIX_USER']->login); 111 $groups = array(); 112 foreach($gp as $g){ 113 $groups[]=intval($g->id_aclgrp); 114 } 115 } 116 return $groups; 117 } 88 118 } 89 119 trunk/lib/jelix/acl/jAclManager.class.php
r206 r227 5 5 * @version $Id:$ 6 6 * @author Laurent Jouanneau 7 * @contributor8 7 * @copyright 2006 Laurent Jouanneau 9 8 * @link http://www.jelix.org … … 13 12 14 13 /** 15 * Classe pour modifier les droits 14 * This class is used to manage rights 15 * It needs the acl module. 16 * @package jelix 17 * @subpackage acl 18 * @static 16 19 */ 17 20 class jAclManager { 18 21 22 /** 23 * @internal The constructor is private, because all methods are static 24 */ 19 25 private function __construct (){ } 20 26 21 27 /** 22 * @return boolean vrai si tout est ok 28 * specify the value of a right on the given subject/group/resource 29 * @return boolean true if the right is set 23 30 */ 24 31 public static function setRight($group, $subject, $value , $resource=''){ … … 62 69 } 63 70 71 /** 72 * remove the right on the given subject/resource, for all groups 73 * @param string $subject the key of the subject 74 * @param string $resource the id of a resource 75 */ 64 76 public static function removeResourceRight($subject, $resource){ 65 77 $daoright = jDao::get('acl~jaclrights'); … … 67 79 } 68 80 69 81 /** 82 * create a new subject 83 * @param string $subject the key of the subject 84 * @param int $id_aclvalgrp the id of the values group with which the right can be set 85 * @param string $label_key the key of a locale which represents the label of the subject 86 */ 70 87 public static function addSubject($subject, $id_aclvalgrp, $label_key){ 71 88 // ajoute un sujet dans la table jacl_subject … … 79 96 } 80 97 98 /** 99 * Delete the given subject 100 * @param string $subject the key of the subject 101 */ 81 102 public static function removeSubject($subject){ 82 103 // supprime dans jacl_rights trunk/lib/jelix/acl/jAclUserGroup.class.php
r195 r227 5 5 * @version $Id:$ 6 6 * @author Laurent Jouanneau 7 * @contributor8 7 * @copyright 2006 Laurent Jouanneau 9 8 * @link http://www.jelix.org … … 12 11 13 12 /** 14 * classe pour g�r les groupes d'utilisateur et gerer les utilisateurs inscrits dans 15 * le syst� de droits 13 * Use this class to register or unregister users in the acl system, and to manage user groups 14 * It needs the acl module. 15 * @package jelix 16 * @subpackage acl 17 * @static 16 18 */ 17 19 class jAclUserGroup { 18 20 21 /** 22 * @internal The constructor is private, because all methods are static 23 */ 19 24 private function __construct (){ } 20 25 26 /** 27 * get the list of the users of a group 28 * @param int $groupid id of the user group 29 * @return array a list of users object (dao records) 30 */ 21 31 public static function getUsersList($groupid){ 22 32 $dao = jDao::get('acl~jaclusergroup'); … … 24 34 } 25 35 36 /** 37 * register a user in the acl system 38 * 39 * For example, this method is called by the acl module when responding 40 * to the event generated by the auth module when a user is created. 41 * When a user is registered, a private group is created. 42 * @param string $login the user login 43 * @param boolean $defaultGroup if true, the user become the member of default groups 44 */ 26 45 public static function createUser($login, $defaultGroup=true){ 27 46 $daousergroup = jDao::get('acl~jaclusergroup'); … … 50 69 } 51 70 52 71 /** 72 * add a user into a group 73 * 74 * (a user can be a member of several groups) 75 * @param string $login the user login 76 * @param int $groupid the group id 77 */ 53 78 public static function addUserToGroup($login, $groupid){ 54 79 $daousergroup = jDao::get('acl~jaclusergroup'); … … 59 84 } 60 85 86 /** 87 * remove a user from a group 88 * @param string $login the user login 89 * @param int $groupid the group id 90 */ 61 91 public static function removeUserFromGroup($login,$groupid){ 62 92 $daousergroup = jDao::get('acl~jaclusergroup'); … … 64 94 } 65 95 96 /** 97 * unregister a user in the acl system 98 * @param string $login the user login 99 */ 66 100 public static function removeUser($login){ 67 101 $daogroup = jDao::get('acl~jaclgroup'); … … 82 116 } 83 117 84 // renvoi group id 118 /** 119 * create a new group 120 * @param string $name its name 121 * @return int the id of the new group 122 */ 85 123 public static function createGroup($name){ 86 124 $group = jDao::createRecord('acl~jaclgroup'); … … 92 130 } 93 131 132 /** 133 * set a group to be default (or not) 134 * 135 * there can have several default group. A default group is a group 136 * where a user is assigned to during its registration 137 * @param int $groupid the group id 138 * @param boolean $default true if the group is to be default, else false 139 */ 94 140 public static function setDefaultGroup($groupid, $default=true){ 95 141 $daogroup = jDao::get('acl~jaclgroup'); … … 100 146 } 101 147 148 /** 149 * change the name of a group 150 * @param int $groupid the group id 151 * @param string $name the new name 152 */ 102 153 public static function updateGroup($groupid, $name){ 103 154 $daogroup = jDao::get('acl~jaclgroup'); … … 105 156 } 106 157 158 /** 159 * delete a group from the acl system 160 * @param int $groupid the group id 161 */ 107 162 public static function removeGroup($groupid){ 108 163 $daogroup = jDao::get('acl~jaclgroup'); … … 117 172 } 118 173 119 // renvoi liste de groupe non personnel 174 /** 175 * return a list of group. 176 * 177 * if a login is given, it returns only the groups of the user. 178 * Else it returns all groups (except private groups) 179 * @param string $login an optional login 180 * @return array a list of groups object (dao records) 181 */ 120 182 public static function getGroupList($login=''){ 121 183 if ($login === '') { … … 127 189 } 128 190 } 129 130 191 } 131 192 trunk/lib/jelix/tpl/plugins/common/block.ifacl.php
r215 r227 2 2 /** 3 3 * @package jelix 4 * @subpackage template plugins4 * @subpackage jtpl_plugin 5 5 * @version $Id$ 6 6 * @author Jouanneau Laurent 7 * @contributor8 7 * @copyright 2006 Jouanneau laurent 9 8 * @link http://www.jelix.org … … 12 11 13 12 /** 14 * @param $params array 1:sujet 2:valeur du droit 3: ressource �ntuelles 13 * a special if block to test easily a right value 14 * 15 * usage : {ifacl array('subject',54)} ..here generated content if the user has the right {/ifacl} 16 * @package jelix 17 * @subpackage jtpl_plugin 18 * @param jTplCompiler $compiler the template compiler 19 * @param boolean true if it is the begin of block, else false 20 * @param $params array 1=>subject 2=>right value 3=>optional resource 21 * @return string the php code corresponding to the begin or end of the block 15 22 */ 16 23 function jtpl_block_ifacl($compiler, $begin, $params=array()) trunk/lib/jelix/tpl/plugins/common/block.ifnotacl.php
r215 r227 2 2 /** 3 3 * @package jelix 4 * @subpackage template plugins4 * @subpackage jtpl_plugin 5 5 * @version $Id$ 6 6 * @author Jouanneau Laurent 7 * @contributor8 7 * @copyright 2006 Jouanneau laurent 9 8 * @link http://www.jelix.org … … 11 10 */ 12 11 13 14 12 /** 15 * @param $params array 1:sujet 2:valeur du droit 3: ressource �ntuelles 13 * a special if block to test easily a right value 14 * 15 * usage : {ifnotacl array('subject',54)} ..here generated content if the user has NOT the right {/ifnotacl} 16 * @package jelix 17 * @subpackage jtpl_plugin 18 * @param jTplCompiler $compiler the template compiler 19 * @param boolean true if it is the begin of block, else false 20 * @param $params array 1=>subject 2=>right value 3=>optional resource 21 * @return string the php code corresponding to the begin or end of the block 16 22 */ 17 23 function jtpl_block_ifnotacl($compiler, $begin, $params=array()) trunk/lib/jelix/tpl/plugins/common/block.ifuserconnected.php
r215 r227 2 2 /** 3 3 * @package jelix 4 * @subpackage template plugins4 * @subpackage jtpl_plugin 5 5 * @version $Id$ 6 6 * @author Jouanneau Laurent 7 * @contributor8 7 * @copyright 2006 Jouanneau laurent 9 8 * @link http://www.jelix.org … … 11 10 */ 12 11 12 /** 13 * a special if block to test easily if the current user is connected 14 * 15 * usage : {ifuserconnected} ..here generated content if the user is connected {/ifuserconnected} 16 * @package jelix 17 * @subpackage jtpl_plugin 18 * @param jTplCompiler $compiler the template compiler 19 * @param boolean true if it is the begin of block, else false 20 * @param array $params no parameters. array should be empty 21 * @return string the php code corresponding to the begin or end of the block 22 */ 13 23 function jtpl_block_ifuserconnected($compiler, $begin, $params=array()) 14 24 { trunk/lib/jelix/tpl/plugins/common/block.ifusernotconnected.php
r215 r227 2 2 /** 3 3 * @package jelix 4 * @subpackage template plugins4 * @subpackage jtpl_plugin 5 5 * @version $Id$ 6 6 * @author Jouanneau Laurent 7 * @contributor8 7 * @copyright 2006 Jouanneau laurent 9 8 * @link http://www.jelix.org … … 11 10 */ 12 11 12 /** 13 * a special if block to test easily if the current user is not connected 14 * 15 * usage : {ifusernotconnected} ..here generated content if the user is NOTconnected {/ifusernotconnected} 16 * @package jelix 17 * @subpackage jtpl_plugin 18 * @param jTplCompiler $compiler the template compiler 19 * @param boolean true if it is the begin of block, else false 20 * @param array $params no parameters. array should be empty 21 * @return string the php code corresponding to the begin or end of the block 22 */ 13 23 function jtpl_block_ifusernotconnected($compiler, $begin, $params=array()) 14 24 { trunk/lib/jelix/tpl/plugins/common/function.include.php
r124 r227 1 1 <?php 2 2 /** 3 * Smarty plugin 4 * @package Smarty 5 * @subpackage plugins 3 * Plugin from smarty project and adapted for jtpl 4 * @package jelix 5 * @subpackage jtpl_plugin 6 * @version $Id$ 7 * @author 8 * @copyright 2001-2003 ispi of Lincoln, Inc. 9 * @link http://smarty.php.net/ 10 * @link http://jelix.org/ 11 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 6 12 */ 7 13 8 9 14 /** 10 * Smarty include template plugin15 * function plugin : include a template into another template 11 16 * 12 * Type: function<br> 13 * Name: include<br> 14 * Purpose: include a template into another template 15 * @param template 16 * @param string 17 * usage : {include 'myModule~foo'} 18 * @param jTpl $t template engine 19 * @param string $string the template selector 17 20 */ 18 21 function jtpl_function_include($t, $string) { trunk/lib/jelix/tpl/plugins/common/function.zone.php
r182 r227 2 2 /** 3 3 * @package jelix 4 * @subpackage template plugins4 * @subpackage jtpl_plugin 5 5 * @version $Id$ 6 6 * @author Jouanneau Laurent 7 * @contributor8 7 * @copyright 2006 Jouanneau laurent 9 8 * @link http://www.jelix.org … … 11 10 */ 12 11 12 /** 13 * function plugin : include the content of a zone 14 * 15 * example : {zone 'myModule~myzone'} or {zone 'myModule~myzone',array('foo'=>'bar)} 16 * @param jTpl $tpl template engine 17 * @param string $string the zone selector 18 * @param array $params parameters for the zone 19 */ 13 20 function jtpl_function_zone($tpl, $name, $params=array()) 14 21 { trunk/lib/jelix/tpl/plugins/common/modifier.cat.php
r14 r227 1 1 <?php 2 2 /** 3 * Smarty plugin 4 * @package Smarty 5 * @subpackage plugins 3 * Plugin from smarty project and adapted for jtpl 4 * @package jelix 5 * @subpackage jtpl_plugin 6 * @version $Id$ 7 * @author Monte Ohrt <monte at ohrt dot com> 8 * @copyright 2001-2003 ispi of Lincoln, Inc. 9 * @link http://smarty.php.net/ 10 * @link http://jelix.org/ 11 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 6 12 */ 7 13 8 9 14 /** 10 * Smarty cat modifier plugin15 * Modifier plugin : catenate a value to a variable 11 16 * 12 * Type: modifier<br> 13 * Name: cat<br> 14 * Date: Feb 24, 2003 15 * Purpose: catenate a value to a variable 16 * Input: string to catenate 17 * Example: {$var|cat:"foo"} 18 * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat 19 * (Smarty online manual) 20 * @author Monte Ohrt <monte at ohrt dot com> 21 * @version 1.0 22 * @param string 23 * @param string 17 * Example: {$var|cat:"foo"} {$var|cat:$othervar} 18 * @param string $string the string to be modified 19 * @param string $cat the string to concat to $string 24 20 * @return string 25 21 */ trunk/lib/jelix/tpl/plugins/common/modifier.count_characters.php
r14 r227 1 1 <?php 2 2 /** 3 * Smarty plugin 4 * @package Smarty 5 * @subpackage plugins 3 * Plugin from smarty project and adapted for jtpl 4 * @package jelix 5 * @subpackage jtpl_plugin 6 * @version $Id$ 7 * @author 8 * @copyright 2001-2003 ispi of Lincoln, Inc. 9 * @link http://smarty.php.net/ 10 * @link http://jelix.org/ 11 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 6 12 */ 7 13 8 9 14 /** 10 * Smarty count_characters modifier plugin 11 * 12 * Type: modifier<br> 13 * Name: count_characteres<br> 14 * Purpose: count the number of characters in a text 15 * @link http://smarty.php.net/manual/en/language.modifier.count.characters.php 16 * count_characters (Smarty online manual) 15 * Modifier plugin : count the number of characters in a text 17 16 * @param string 18 17 * @param boolean include whitespace in the character count trunk/lib/jelix/tpl/plugins/common/modifier.count_paragraphs.php
r14 r227 1 1 <?php 2 2 /** 3 * Smarty plugin 4 * @package Smarty 5 * @subpackage plugins 3 * Plugin from smarty project and adapted for jtpl 4 * @package jelix 5 * @subpackage jtpl_plugin 6 * @version $Id$ 7 * @author 8 * @copyright 2001-2003 ispi of Lincoln, Inc. 9 * @link http://smarty.php.net/ 10 * @link http://jelix.org/ 11 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 6 12 */ 7 13 8 9 14 /** 10 * Smarty count_paragraphs modifier plugin 11 * 12 * Type: modifier<br> 13 * Name: count_paragraphs<br> 14 * Purpose: count the number of paragraphs in a text 15 * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php 16 * count_paragraphs (Smarty online manual) 15 * modifier plugin : count the number of paragraphs in a text 17 16 * @param string 18 17 * @return integer trunk/lib/jelix/tpl/plugins/common/modifier.count_sentences.php
r14 r227 1 1 <?php 2 2 /** 3 * Smarty plugin 4 * @package Smarty 5 * @subpackage plugins 3 * Plugin from smarty project and adapted for jtpl 4 * @package jelix 5 * @subpackage jtpl_plugin 6 * @version $Id$ 7 * @author 8 * @copyright 2001-2003 ispi of Lincoln, Inc. 9 * @link http://smarty.php.net/ 10 * @link http://jelix.org/ 11 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 6 12 */ 7 13 8 9 14 /** 10 * Smarty count_sentences modifier plugin 11 * 12 * Type: modifier<br> 13 * Name: count_sentences 14 * Purpose: count the number of sentences in a text 15 * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php 16 * count_sentences (Smarty online manual) 15 * modifier plugin : count the number of sentences in a text 17 16 * @param string 18 17 * @return integer trunk/lib/jelix/tpl/plugins/common/modifier.count_words.php
r14 r227 1 1 <?php 2 2 /** 3 * Smarty plugin 4 * @package Smarty 5 * @subpackage plugins 3 * Plugin from smarty project and adapted for jtpl 4 * @package jelix 5 * @subpackage jtpl_plugin 6 * @version $Id$ 7 * @author 8 * @copyright 2001-2003 ispi of Lincoln, Inc. 9 * @link http://smarty.php.net/ 10 * @link http://jelix.org/ 11 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 6 12 */ 7 13 8 9 14 /** 10 * Smarty count_words modifier plugin 11 * 12 * Type: modifier<br> 13 * Name: count_words<br> 14 * Purpose: count the number of words in a text 15 * @link http://smarty.php.net/manual/en/language.modifier.count.words.php 16 * count_words (Smarty online manual) 15 * modifier plugin : count the number of words in a text 17 16 * @param string 18 17 * @return integer trunk/lib/jelix/tpl/plugins/common/modifier.date_format.php
r184 r227 1 1 <?php 2 /** 3 * Plugin from smarty project and adapted for jtpl 4 * @package jelix 5 * @subpackage jtpl_plugin 6 * @version $Id$ 7 * @author Smarty team 8 * @contributor Yannick Le Gu�rt <yannick at over-blog dot com> 9 * @copyright 2001-2003 ispi of Lincoln, Inc., Yannick Le Gu�rt 10 * @link http://smarty.php.net/ 11 * @link http://jelix.org/ 12 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 13 */ 2 14 3 15 /** 4 * jTpl date_format modifier plugin 5 * adapted from date_format plugin of Smarty 6 * 7 * Input: 8 * - string: input date string 9 * - format: strftime format for output 10 * - default_date: default date if $string is empty 11 * 12 * @author Smarty team 13 * @contributor Yannick Le Gu�rt <yannick at over-blog dot com> 14 * @copyright Smarty team, Yannick Le Gu�rt 15 * @link http://smarty.php.net 16 * @param string 17 * @param string 18 * @param string 16 * modifier plugin : format a date 17 * 18 * @param string $string input date string 19 * @param string $format strftime format for output 20 * @param string $default_date default date if $string is empty 19 21 * @return string|void 20 22 */ trunk/lib/jelix/tpl/plugins/common/modifier.escxml.php
r195 r227 2 2 /** 3 3 * @package jelix 4 * @subpackage template plugins4 * @subpackage jtpl_plugin 5 5 * @version $Id$ 6 6 * @author Jouanneau Laurent 7 * @contributor8 7 * @copyright 2006 Jouanneau laurent 9 8 * @link http://www.jelix.org … … 11 10 */ 12 11 13 12 /** 13 * Modifier plugin : escape all forbiden xml characters 14 * 15 * it escape <,>,",',& 16 * Example: {$var|escxml} 17 * @param string $string the string to be escaped 18 * @return string 19 */ 14 20 function jtpl_modifier_escxml($string) 15 21 { trunk/lib/jelix/tpl/plugins/common/modifier.indent.php
r14 r227 1 1 <?php 2 2 /** 3 * Smarty plugin 4 * @package Smarty 5 * @subpackage plugins 3 * Plugin from smarty project and adapted for jtpl 4 * @package jelix 5 * @subpackage jtpl_plugin 6 * @version $Id$ 7 * @author 8 * @copyright 2001-2003 ispi of Lincoln, Inc. 9 * @link http://smarty.php.net/ 10 * @link http://jelix.org/ 11 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 6 12 */ 7 13 8 9 14 /** 10 * Smarty indent modifier plugin 11 * 12 * Type: modifier<br> 13 * Name: indent<br> 14 * Purpose: indent lines of text 15 * @link http://smarty.php.net/manual/en/language.modifier.indent.php 16 * indent (Smarty online manual) 15 * Modifier plugin: indent lines of text 17 16 * @param string 18 17 * @param integer trunk/lib/jelix/tpl/plugins/common/modifier.jdatetime.php
r184 r227 1 1 <?php 2 /** 3 * @package jelix 4 * @subpackage jtpl_plugin 5 * @version $Id$ 6 * @author Jouanneau Laurent 7 * @copyright 2006 Jouanneau laurent 8 * @link http://www.jelix.org 9 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 10 */ 2 11 3 12 /** 4 * jTpl jdatetime modifier plugin 5 * 6 * Type: modifier<br> 7 * Name: jdatetime<br> 8 * Purpose: change the format of a date 13 * modifier plugin : change the format of a date 9 14 * 10 15 * @param string … … 12 17 * @param string 13 18 * @return string 19 * @see jDateTime 14 20 */ 15 function jtpl_modifier_jdatetime($date, $format_in = 'db_datetime', 21 function jtpl_modifier_jdatetime($date, $format_in = 'db_datetime', 16 22 $format_out = 'lang_date') { 17 23 $formats = array( trunk/lib/jelix/tpl/plugins/common/modifier.regex_replace.php
r184 r227 1 1 <?php 2 2 /** 3 * Smarty plugin 4 * @package Smarty 5 * @subpackage plugins 3 * Plugin from smarty project and adapted for jtpl 4 * @package jelix 5 * @subpackage jtpl_plugin 6 * @version $Id$ 7 * @author 8 * @copyright 2001-2003 ispi of Lincoln, Inc. 9 * @link http://smarty.php.net/ 10 * @link http://jelix.org/ 11 * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html 6 12 */ 7 13 8 9 14 /** 10 * Smarty regex_replace modifier plugin 11 * 12 * Type: modifier<br> 13 * Name: regex_replace<br> 14 * Purpose: regular epxression search/replace 15 * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php 16 * regex_replace (Smarty online manual) 15 * modifier plugin : regular epxression search/replace 17 16 * @param string 18 17 * @param string|array … … 22 21 function jtpl_modifier_regex_replace($string, $search, $replace) 23 22 { 24 if (preg_match('!\W(\w+)$!s', $search, $match) && 23 if (preg_match('!\W(\w+)$!s', $search, $match) && 25 24 (strpos($match[1], 'e') !== false)) { 26 25 /* remove eval-modifier from $search */ 27 $search = substr($search, 0, -strlen($match[1])) . 26 $search = substr($search, 0, -strlen($match[1])) . 28 27 str_replace('e', '', $match[1]); 29 28 } trunk/lib/jelix/tpl/plugins/common/modifier.replace.php
