Changeset 5346 for plugins/sfModerationPlugin
- Timestamp:
- 10/02/07 18:26:55 (6 years ago)
- Files:
-
- plugins/sfModerationPlugin/README (modified) (2 diffs)
- plugins/sfModerationPlugin/config/config.php (modified) (1 diff)
- plugins/sfModerationPlugin/lib/SfPeerBuilder.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfModerationPlugin/README
r5313 r5346 51 51 52 52 {{{ 53 sfPropelBehavior::add('Item', array(' spam_tag' => array('status_column' => 'my_spam_tag')));53 sfPropelBehavior::add('Item', array('moderation' => array('status_column' => 'my_spam_tag'))); 54 54 }}} 55 55 56 56 Note that the column must still be an integer with default value equal to '1'. 57 57 58 Alternatively, you can let the plugin register the behavior on models on its own. This is particularly useful if you need to add the behavior to models defined in a third party plugin, or if you have many models to extend. To do so, you just need to list the models to be extended in your `app.yml`: 59 60 {{{ 61 all: 62 sfModerationPlugin: 63 auto_register_behavior: true 64 moderated_classes: [Item] 65 }}} 66 58 67 * Rebuild your model: 59 68 … … 131 140 === Trunk === 132 141 142 * francois: Added auto-registering system 143 133 144 === 2007-09-09 | 0.6.0 Beta === 134 145 plugins/sfModerationPlugin/config/config.php
r5313 r5346 27 27 )); 28 28 29 $moderated_classes = sfConfig::get('app_sfModerationPlugin_moderated_classes', false); 30 if(sfConfig::get('app_sfModerationPlugin_auto_register_behavior', true) && $moderated_classes) 31 { 32 if(isset($moderated_classes[0])) 33 { 34 // simple array 35 foreach($moderated_classes as $model) 36 { 37 sfPropelBehavior::add($model, array('moderation')); 38 } 39 } 40 else 41 { 42 // associative array 43 foreach($moderated_classes as $model => $params) 44 { 45 sfPropelBehavior::add($model, array('moderation' => $params)); 46 } 47 } 48 } 49 plugins/sfModerationPlugin/lib/SfPeerBuilder.php
r5313 r5346 214 214 215 215 "; 216 $tmp = preg_replace('/ {/', '{'.$mixer_script, $tmp, 1);216 $tmp = preg_replace('/public static function doSelectJoin.*\(Criteria \$c, \$con = null\)\n\s*{/', '\0'.$mixer_script, $tmp); 217 217 } 218 218 … … 256 256 257 257 "; 258 $tmp = preg_replace('/ {/', '{'.$mixer_script, $tmp, 1);258 $tmp = preg_replace('/public static function doSelectJoinAllExcept.*\(Criteria \$c, \$con = null\)\n\s*{/', '\0'.$mixer_script, $tmp); 259 259 } 260 260