Changeset 3244
- Timestamp:
- 10/29/13 16:59:33 (9 years ago)
- Location:
- plugins/saba
- Files:
-
- 7 added
- 3 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/saba/_define.php
r3143 r3244 5 5 # 6 6 # Copyright (c) 2009-2013 Jean-Christian Denis and contributors 7 # contact@jcdenis.fr http://jcd.lv7 # contact@jcdenis.fr 8 8 # 9 9 # Licensed under the GPL version 2.0 license. … … 13 13 # -- END LICENSE BLOCK ------------------------------------ 14 14 15 if (!defined('DC_RC_PATH')){return;} 15 if (!defined('DC_RC_PATH')) { 16 17 return null; 18 } 16 19 17 20 $this->registerModule( 18 /* Name */ "saba", 19 /* Description*/ "Search across blog's archive", 20 /* Author */ "JC Denis", 21 /* Version */ '2013.07.12', 22 /* Permissions */ 'admin' 21 /* Name */ 22 "saba", 23 /* Description*/ 24 "Search across blog's archive", 25 /* Author */ 26 "Jean-Christian Denis", 27 /* Version */ 28 '2013.10.28', 29 /* Properies */ 30 array( 31 'permissions' => 'admin', 32 'type' => 'plugin', 33 'dc_min' => '2.6', 34 'support' => 'http://jcd.lv/saba', 35 'details' => 'http://plugins.dotaddict.org/dc2/details/saba' 36 ) 23 37 ); 24 ?> -
plugins/saba/_public.php
r3134 r3244 5 5 # 6 6 # Copyright (c) 2009-2013 Jean-Christian Denis and contributors 7 # contact@jcdenis.fr http://jcd.lv7 # contact@jcdenis.fr 8 8 # 9 9 # Licensed under the GPL version 2.0 license. … … 13 13 # -- END LICENSE BLOCK ------------------------------------ 14 14 15 if (!defined('DC_RC_PATH')){return;} 15 if (!defined('DC_RC_PATH')) { 16 17 return null; 18 } 16 19 17 20 # Admin behaviors … … 19 22 20 23 if ($core->blog->settings->saba->active) { 24 21 25 # Register saba handler 22 $core->url->register('search','search','^search(/.+)?$',array('urlSaba','saba')); 26 $core->url->register( 27 'search', 28 'search', 29 '^search(/.+)?$', 30 array('urlSaba', 'saba') 31 ); 32 23 33 # Add saba templates path 24 $core->tpl->setPath($core->tpl->getPath(),dirname(__FILE__).'/default-templates/'); 34 $core->tpl->setPath( 35 $core->tpl->getPath(), 36 dirname(__FILE__).'/default-templates/' 37 ); 38 25 39 # templates 26 $core->tpl->addBlock('SabaIf',array('tplSaba','SabaIf')); 27 $core->tpl->addBlock('SabaEntries',array('tplSaba','SabaEntries')); 28 $core->tpl->addBlock('SabaFormIf',array('tplSaba','SabaFormIf')); 29 $core->tpl->addValue('SabaFormSearch',array('tplSaba','SabaFormSearch')); 30 $core->tpl->addValue('SabaFormOptions',array('tplSaba','SabaFormOptions')); 31 $core->tpl->addValue('SabaFormCategories',array('tplSaba','SabaFormCategories')); 32 $core->tpl->addValue('SabaFormTypes',array('tplSaba','SabaFormTypes')); 33 $core->tpl->addValue('SabaFormAges',array('tplSaba','SabaFormAges')); 34 $core->tpl->addValue('SabaFormOrders',array('tplSaba','SabaFormOrders')); 35 $core->tpl->addValue('SabaFormAuthors',array('tplSaba','SabaFormAuthors')); 36 $core->tpl->addValue('SabaPaginationURL',array('tplSaba','SabaPaginationURL')); 37 $core->tpl->addValue('SabaURL',array('tplSaba','SabaURL')); 40 $core->tpl->addBlock( 41 'SabaIf', 42 array('tplSaba', 'SabaIf') 43 ); 44 $core->tpl->addBlock( 45 'SabaEntries', 46 array('tplSaba', 'SabaEntries') 47 ); 48 $core->tpl->addBlock( 49 'SabaFormIf', 50 array('tplSaba', 'SabaFormIf') 51 ); 52 $core->tpl->addValue( 53 'SabaFormSearch', 54 array('tplSaba', 'SabaFormSearch') 55 ); 56 $core->tpl->addValue( 57 'SabaFormOptions', 58 array('tplSaba', 'SabaFormOptions') 59 ); 60 $core->tpl->addValue( 61 'SabaFormCategories', 62 array('tplSaba', 'SabaFormCategories') 63 ); 64 $core->tpl->addValue( 65 'SabaFormTypes', 66 array('tplSaba', 'SabaFormTypes') 67 ); 68 $core->tpl->addValue( 69 'SabaFormAges', 70 array('tplSaba', 'SabaFormAges') 71 ); 72 $core->tpl->addValue( 73 'SabaFormOrders', 74 array('tplSaba', 'SabaFormOrders') 75 ); 76 $core->tpl->addValue( 77 'SabaFormAuthors', 78 array('tplSaba', 'SabaFormAuthors') 79 ); 80 $core->tpl->addValue( 81 'SabaPaginationURL', 82 array('tplSaba', 'SabaPaginationURL') 83 ); 84 $core->tpl->addValue( 85 'SabaURL', 86 array('tplSaba','SabaURL') 87 ); 88 38 89 # behavior 39 $core->addBehavior('templateCustomSortByAlias',array('pubSaba','templateCustomSortByAlias')); 40 $core->addBehavior('urlHandlerBeforeGetData',array('pubSaba','urlHandlerBeforeGetData')); 41 $core->addBehavior('corePostSearch',array('pubSaba','corePostSearch')); 90 $core->addBehavior( 91 'templateCustomSortByAlias', 92 array('pubSaba', 'templateCustomSortByAlias') 93 ); 94 $core->addBehavior( 95 'urlHandlerBeforeGetData', 96 array('pubSaba', 'urlHandlerBeforeGetData') 97 ); 98 $core->addBehavior( 99 'corePostSearch', 100 array('pubSaba', 'corePostSearch') 101 ); 42 102 $core->url->registerError(array('urlSaba','error')); 43 103 } … … 48 108 { 49 109 $alias['post'] = array( 50 'title' 51 'selected' 52 'author' 53 'date' 54 'update' 55 'id' 56 'comment' 57 'trackback' 110 'title' => 'post_title', 111 'selected' => 'post_selected', 112 'author' => 'user_id', 113 'date' => 'post_dt', 114 'update' => 'post_upddt', 115 'id' => 'post_id', 116 'comment' => 'nb_comment', 117 'trackback' => 'nb_trackback' 58 118 ); 59 119 } 60 120 61 121 public static function urlHandlerBeforeGetData($_ctx) 62 122 { 63 123 global $core; 64 124 65 125 $options = array( 66 'q' 67 'q_opt' 68 'q_cat' 69 'q_age' 70 'q_user' 71 'q_order' 72 'q_rev' 73 'q_type' 126 'q' => '', 127 'q_opt' => array(), 128 'q_cat' => array(), 129 'q_age' => '0,0', 130 'q_user' => array(), 131 'q_order' => 'date', 132 'q_rev' => '0', 133 'q_type' => array() 74 134 ); 75 76 if (!empty($_GET['q']) && 1 < strlen($_GET['q'])) 77 { 135 136 if (!empty($_GET['q']) && 1 < strlen($_GET['q'])) { 78 137 # move to saba 79 138 $_ctx->current_tpl = null; 80 139 $_ctx->current_tpl = 'saba_search.html'; 81 140 82 141 # retreive _GET 83 142 $qs = $_SERVER['QUERY_STRING']; 84 $qs = preg_replace('#(^|/)page/([0-9]+)#', '',$qs);85 parse_str($qs, $get);86 143 $qs = preg_replace('#(^|/)page/([0-9]+)#', '', $qs); 144 parse_str($qs, $get); 145 87 146 $params = array( 88 147 'sql'=>'', 89 148 'post_type' => '' 90 149 ); 91 150 92 151 # search string 93 152 $params['search'] = rawurldecode($_GET['q']); 94 153 $options['q'] = rawurldecode($_GET['q']); 95 154 96 155 # options 97 156 if (!empty($get['q_opt'])) { 98 157 99 if (in_array('selected', $get['q_opt'])) {158 if (in_array('selected', $get['q_opt'])) { 100 159 $options['q_opt'][] = 'selected'; 101 160 $params['post_selected'] = 1; 102 161 } 103 if (in_array('comment', $get['q_opt'])) {162 if (in_array('comment', $get['q_opt'])) { 104 163 $options['q_opt'][] = 'comment'; 105 164 $params['sql'] = "AND nb_comment > 0 "; 106 165 } 107 if (in_array('trackback', $get['q_opt'])) {166 if (in_array('trackback', $get['q_opt'])) { 108 167 $options['q_opt'][] = 'trackback'; 109 168 $params['sql'] = "AND nb_trackback > 0"; 110 169 } 111 170 } 112 171 113 172 # categories 114 173 if (!empty($get['q_cat'])) { … … 116 175 foreach($get['q_cat'] as $v) { 117 176 $v = abs((integer) $v); 118 if (!$v) continue; 177 if (!$v) { 178 continue; 179 } 119 180 $cats[] = "C.cat_id = '".$v."'"; 120 181 $options['q_cat'][] = $v; 121 182 } 122 183 if (!empty($cats)) { 123 $params['sql'] .= 'AND ('.implode(' OR ', $cats).') ';124 } 125 } 126 184 $params['sql'] .= 'AND ('.implode(' OR ', $cats).') '; 185 } 186 } 187 127 188 # post types 128 189 if (!empty($get['q_type'])) { 129 190 $types = $core->getPostTypes(); 130 191 foreach($get['q_type'] as $v) { 131 if (!$types[$v]) continue; 192 if (!$types[$v]) { 193 continue; 194 } 132 195 $options['q_type'][] = $v; 133 196 $params['post_type'][] = $v; 134 197 } 135 198 } 136 199 137 200 # age 138 201 $ages = tplSaba::getSabaFormAges(); 139 if (!empty($get['q_age']) && in_array($get['q_age'], $ages)) {140 $age = explode(',', $get['q_age']);202 if (!empty($get['q_age']) && in_array($get['q_age'], $ages)) { 203 $age = explode(',', $get['q_age']); 141 204 $ts = time(); 142 205 $options['q_age'] = $get['q_age']; 143 206 144 207 if ($age[0]) { 145 $params['sql'] .= "AND P.post_dt < '".dt::str('%Y-%m-%d %H:%m:%S', $ts-$age[0])."' ";208 $params['sql'] .= "AND P.post_dt < '".dt::str('%Y-%m-%d %H:%m:%S', $ts-$age[0])."' "; 146 209 } 147 210 if ($age[1]) { 148 $params['sql'] .= "AND P.post_dt > '".dt::str('%Y-%m-%d %H:%m:%S', $ts-$age[1])."' ";149 } 150 } 151 211 $params['sql'] .= "AND P.post_dt > '".dt::str('%Y-%m-%d %H:%m:%S', $ts-$age[1])."' "; 212 } 213 } 214 152 215 # user 153 216 if (!empty($get['q_user'])) { … … 158 221 } 159 222 if (!empty($users)) { 160 $params['sql'] .= 'AND ('.implode(' OR ', $users).') ';161 } 162 } 163 223 $params['sql'] .= 'AND ('.implode(' OR ', $users).') '; 224 } 225 } 226 164 227 #order 165 228 $sort = 'desc'; … … 169 232 } 170 233 $orders = tplSaba::getSabaFormOrders(); 171 if (!empty($get['q_order']) && in_array($get['q_order'], $orders)) {234 if (!empty($get['q_order']) && in_array($get['q_order'], $orders)) { 172 235 173 236 $options['q_order'] = $get['q_order']; 174 237 $params['order'] = $core->tpl->getSortByStr( 175 array('sortby'=>$get['q_order'], 'order'=>$sort),'post'); //?! post_type176 } 177 238 array('sortby'=>$get['q_order'], 'order'=>$sort),'post'); //?! post_type 239 } 240 178 241 # count 179 242 $GLOBALS['_search'] = rawurldecode($_GET['q']); 180 243 if ($GLOBALS['_search']) { 181 $GLOBALS['_search_count'] = $core->blog->getPosts($params, true)->f(0);182 } 183 244 $GLOBALS['_search_count'] = $core->blog->getPosts($params, true)->f(0); 245 } 246 184 247 # pagintaion 185 248 $_page_number = !isset($GLOBALS['_page_number']) ? 1 : $GLOBALS['_page_number']; 186 249 $params['limit'] = $_ctx->nb_entry_per_page; 187 $params['limit'] = array((($_page_number-1)*$params['limit']), $params['limit']);188 250 $params['limit'] = array((($_page_number-1)*$params['limit']), $params['limit']); 251 189 252 # get posts 190 253 $_ctx->post_params = $params; 191 $_ctx->posts = $core->blog->getPosts($params); unset($params); 254 $_ctx->posts = $core->blog->getPosts($params); 255 unset($params); 192 256 } 193 257 $_ctx->saba_options = $options; 194 258 } 195 259 196 260 # Ajouter la condition "ou" à la recherche 197 public static function corePostSearch($core, $p)198 { 199 $sentences = explode(',', $p[2]['search']);200 261 public static function corePostSearch($core, $p) 262 { 263 $sentences = explode(',', $p[2]['search']); 264 201 265 $OR = array(); 202 266 foreach($sentences as $sentence) … … 204 268 $AND = array(); 205 269 $words = text::splitWords($sentence); 206 foreach($words as $word) 207 { 270 foreach($words as $word) { 208 271 $AND[] = "post_words LIKE '%".$core->con->escape($word)."%'"; 209 272 } … … 215 278 $req = "AND (".implode (' OR ',$OR).") "; 216 279 } 217 280 218 281 # Return 219 282 if (!empty($req)) { … … 223 286 } 224 287 } 225 288 226 289 class urlSaba extends dcUrlHandlers 227 290 { 228 public static function error($args, $type,$e)291 public static function error($args, $type, $e) 229 292 { 230 293 global $core, $_ctx; 231 232 if ($e->getCode() == 404) 233 { 234 $q = explode('/',$args); 235 if (empty($q)) { return false; } 236 294 295 if ($e->getCode() == 404) { 296 $q = explode('/', $args); 297 if (empty($q)) { 298 299 return false; 300 } 301 237 302 # Clean URI 238 $_GET['q'] = implode('%20', $q);303 $_GET['q'] = implode('%20', $q); 239 304 $_SERVER['QUERY_STRING'] = ''; 240 305 241 306 # Claim comes from 404 242 307 $GLOBALS['_from_error'] = true; 243 308 244 309 # Serve saba 245 310 self::serveDocument('saba_search.html'); 311 246 312 return true; 247 313 } … … 252 318 $_ctx =& $GLOBALS['_ctx']; 253 319 $core =& $GLOBALS['core']; 254 320 255 321 self::serveDocument('saba_search.html'); 256 322 } … … 259 325 class tplSaba 260 326 { 261 public static function SabaEntries($a, $c)327 public static function SabaEntries($a, $c) 262 328 { 263 329 return 264 330 '<?php if ($_ctx->exists("posts")) : while ($_ctx->posts->fetch()) : ?>'.$c.'<?php endwhile; endif; ?>'; 265 331 } 266 332 267 333 public static function SabaFormSearch($a) 268 334 { 269 335 return '<?php echo html::escapeHTML($_ctx->saba_options["q"]); ?>'; 270 336 } 271 272 public static function SabaIf($a, $c)337 338 public static function SabaIf($a, $c) 273 339 { 274 340 $if = array(); 275 341 276 342 $operator = isset($a['operator']) ? $GLOBALS['core']->tpl->getOperator($a['operator']) : '&&'; 277 343 … … 280 346 $if[] = $sign.'isset($_search_count)'; 281 347 } 282 348 283 349 if (isset($a['from_error'])) { 284 350 $sign = (boolean) $a['from_error'] ? '' : '!'; 285 351 $if[] = $sign.'isset($_from_error)'; 286 352 } 287 288 if (!empty($if)) { 289 return '<?php if('.implode(' '.$operator.' ',$if).') : ?>'.$c.'<?php endif; ?>'; 290 } else { 291 return $c; 292 } 293 } 294 353 354 return !empty($if) ? 355 '<?php if('.implode(' '.$operator.' ', $if).') : ?>'.$c.'<?php endif; ?>' 356 : $c; 357 } 358 295 359 public static function SabaURL($a) 296 360 { 297 361 $f = $GLOBALS['core']->tpl->getFilters($a); 362 298 363 return '<?php echo '.sprintf($f,'$core->blog->url.$core->url->getBase("search")').'; ?>'; 299 364 } 300 365 301 366 public static function SabaFormIf($a,$c) 302 367 { 303 368 $if = array(); 304 369 305 370 $operator = isset($a['operator']) ? $GLOBALS['core']->tpl->getOperator($a['operator']) : '&&'; 306 307 $filters_list = array( 308 'options','orders','ages','categories','authors','types' 309 ); 310 371 311 372 $fl = self::getSabaFormFilters(); 312 foreach($fl as $filter) 313 { 373 foreach($fl as $filter) { 314 374 if (isset($a['filter_'.$filter])) { 315 375 $sign = (boolean) $a['filter_'.$filter] ? '' : '!'; … … 317 377 } 318 378 } 319 320 if (!empty($if)) { 321 return '<?php if('.implode(' '.$operator.' ',$if).') : ?>'.$c.'<?php endif; ?>'; 322 } else { 323 return $c; 324 } 325 } 326 379 380 return !empty($if) ? 381 '<?php if('.implode(' '.$operator.' ',$if).') : ?>'.$c.'<?php endif; ?>' 382 : $c; 383 } 384 327 385 public static function SabaFormOptions($a) 328 386 { 329 $dis = !empty($a['remove']) ? explode(',', $a['remove']) : array();330 387 $dis = !empty($a['remove']) ? explode(',', $a['remove']) : array(); 388 331 389 $res = ''; 332 390 $li = '<li><label><input name="q_opt[]" type="checkbox" value="%s" %s/> %s</label></li>'; 333 391 334 392 $rs = self::getSabaFormOptions(); 335 393 foreach($rs as $k => $v) { 336 if (in_array($v,$dis)) continue; 394 if (in_array($v,$dis)) { 395 continue; 396 } 337 397 $chk = '<?php echo in_array("'.$v.'",$_ctx->saba_options["q_opt"]) ? \'checked="checked" \' : ""; ?>'; 338 $res .= sprintf($li, $v,$chk,html::escapeHTML($k));339 } 340 398 $res .= sprintf($li, $v, $chk, html::escapeHTML($k)); 399 } 400 341 401 if (!empty($res)) { 402 342 403 return '<div class="saba_opt_otp"><h2>'.__('Filter options').'</h2><ul>'.$res.'</ul></div>'; 343 404 } 344 405 } 345 406 346 407 public static function SabaFormOrders($a) 347 408 { 348 409 $dis = !empty($a['remove']) ? explode(',',$a['remove']) : array(); 349 410 350 411 $res = ''; 351 412 $li = '<li><label><input name="q_order" type="radio" value="%s" %s/> %s</label></li>'; 352 413 353 414 $rs = self::getSabaFormOrders($dis); 354 415 foreach($rs as $k => $v) { 355 if (in_array($v,$dis)) continue; 416 if (in_array($v,$dis)) { 417 continue; 418 } 356 419 $chk = '<?php echo "'.$v.'" == $_ctx->saba_options["q_order"] ? \'checked="checked" \' : ""; ?>'; 357 $res .= sprintf($li, $v,$chk,html::escapeHTML($k));358 } 359 420 $res .= sprintf($li, $v, $chk, html::escapeHTML($k)); 421 } 422 360 423 if (!empty($res)) { 361 424 $chk = '<?php echo !empty($_ctx->saba_options["q_rev"]) ? \'checked="checked" \' : ""; ?>'; 362 425 $res .= '<li><label><input name="q_rev" type="checkbox" value="1" '.$chk.'/> '.__('Reverse order').'</label></li>'; 363 426 364 427 return '<div class="saba_opt_order"><h2>'.__('Filter order').'</h2><ul>'.$res.'</ul></div>'; 365 428 } 366 429 } 367 430 368 431 public static function SabaFormCategories($a) 369 432 { 370 433 global $core; 371 372 $dis = !empty($a['remove']) ? explode(',', $a['remove']) : array();373 434 435 $dis = !empty($a['remove']) ? explode(',', $a['remove']) : array(); 436 374 437 $res = ''; 375 438 $li = '<li><label><input name="q_cat[]" type="checkbox" value="%s" %s/> %s</label></li>'; 376 439 377 440 $rs = $core->blog->getCategories(); 378 441 while ($rs->fetch()) { 379 if (in_array($rs->cat_id,$dis) || in_array($rs->cat_url,$dis)) continue; 442 if (in_array($rs->cat_id,$dis) || in_array($rs->cat_url,$dis)) { 443 continue; 444 } 380 445 $chk = '<?php echo in_array("'.$rs->cat_id.'",$_ctx->saba_options["q_cat"]) ? \'checked="checked" \' : ""; ?>'; 381 446 $res .= sprintf($li,$rs->cat_id,$chk,html::escapeHTML($rs->cat_title)); 382 447 } 383 448 384 449 if (!empty($res)) { 450 385 451 return '<div class="saba_opt_cat"><h2>'.__('Filter by category').'</h2><ul>'.$res.'</ul></div>'; 386 452 } 387 453 } 388 454 389 455 public static function SabaFormTypes($a) 390 456 { 391 457 global $core; 392 458 393 459 $dis = !empty($a['remove']) ? explode(',',$a['remove']) : array(); 394 460 395 461 $res = ''; 396 462 $li = '<li><label><input name="q_type[]" type="checkbox" value="%s" %s/> %s</label></li>'; 397 463 398 464 $rs = self::getSabaFormTypes(); 399 465 foreach($rs as $k => $v) { 400 if (in_array($v,$dis)) continue; 466 if (in_array($v,$dis)) { 467 continue; 468 } 401 469 $chk = '<?php echo in_array("'.$v.'",$_ctx->saba_options["q_type"]) ? \'checked="checked" \' : ""; ?>'; 402 470 $res .= sprintf($li,$v,$chk,html::escapeHTML($k)); 403 471 } 404 472 405 473 if (!empty($res)) { 474 406 475 return '<div class="saba_opt_type"><h2>'.__('Filter by type').'</h2><ul>'.$res.'</ul></div>'; 407 476 } 408 477 } 409 478 410 479 public static function SabaFormAges($a) 411 480 { 412 481 $res = ''; 413 482 $li = '<li><label><input name="q_age" type="radio" value="%s" %s/> %s</label></li>'; 414 483 415 484 $rs = self::getSabaFormAges(); 416 485 foreach($rs as $k => $v) { 417 486 $chk = '<?php echo "'.$v.'" == $_ctx->saba_options["q_age"] ? \'checked="checked" \' : ""; ?>'; 418 $res .= sprintf($li, $v,$chk,html::escapeHTML($k));419 } 420 487 $res .= sprintf($li, $v, $chk, html::escapeHTML($k)); 488 } 489 421 490 if (!empty($res)) { 491 422 492 return '<div class="saba_opt_age"><h2>'.__('Filter by age').'</h2><ul>'.$res.'</ul></div>'; 423 493 } 424 494 } 425 495 426 496 public static function SabaFormAuthors($a) 427 497 { 428 498 global $core; 429 499 430 500 $dis = !empty($a['remove']) ? explode(',',$a['remove']) : array(); 431 501 432 502 $res = ''; 433 503 $li = '<li><label><input name="q_user[]" type="checkbox" value="%s" %s/> %s</label></li>'; 434 504 435 505 $rs = $core->blog->getPostsUsers(); 436 506 while ($rs->fetch()) { 437 if (in_array($rs->user_id,$dis)) continue; 507 if (in_array($rs->user_id,$dis)) { 508 continue; 509 } 438 510 $chk = '<?php echo in_array("'.$rs->user_id.'",$_ctx->saba_options["q_user"]) ? \'checked="checked" \' : ""; ?>'; 439 511 $res .= sprintf($li,$rs->user_id,$chk,html::escapeHTML(dcUtils::getUserCN($rs->user_id,$rs->user_name,$rs->user_firstname, $rs->user_displayname))); 440 512 } 441 513 442 514 if (!empty($res)) { 515 443 516 return '<div class="saba_opt_user"><h2>'.__('Filter by author').'</h2><ul>'.$res.'</ul></div>'; 444 517 } 445 518 } 446 519 447 520 public static function SabaPaginationURL($attr) 448 521 { … … 451 524 $offset = (integer) $attr['offset']; 452 525 } 453 526 454 527 $f = $GLOBALS['core']->tpl->getFilters($attr); 455 return '<?php echo '.sprintf($f,"ctxSaba::PaginationURL(".$offset.")").'; ?>'; 456 } 457 528 529 return '<?php echo '.sprintf($f, "ctxSaba::PaginationURL(".$offset.")").'; ?>'; 530 } 531 458 532 public static function getSabaFormFilters() 459 533 { … … 467 541 ); 468 542 } 469 543 470 544 public static function getSabaFormOptions() 471 545 { … … 476 550 ); 477 551 } 478 552 479 553 public static function getSabaFormOrders() 480 554 { … … 489 563 ); 490 564 } 491 565 492 566 public static function getSabaFormAges() 493 567 { … … 500 574 ); 501 575 } 502 576 503 577 public static function getSabaFormTypes() 504 578 { … … 509 583 'eventhandler' => __('Event') 510 584 ); 511 585 512 586 $rs = array(); 513 587 $types = $GLOBALS['core']->getPostTypes(); 514 588 515 589 foreach($types as $k => $v) { 516 if (!$v['public_url']) continue; 590 if (!$v['public_url']) { 591 continue; 592 } 517 593 $rs[isset($know[$k]) ? $know[$k] : __($k)] = $k; 518 594 } 595 519 596 return $rs; 520 597 } 521 598 522 599 public static function isSabaFormFilter($f) 523 600 { … … 527 604 $filters = array(); 528 605 } 606 529 607 return !in_array($f,$filters); 530 608 } … … 536 614 { 537 615 $args = $_SERVER['URL_REQUEST_PART']; 538 616 539 617 $n = self::PaginationPosition($offset); 540 541 $args = preg_replace('#(^|/)page/([0-9]+)$#', '',$args);542 618 619 $args = preg_replace('#(^|/)page/([0-9]+)$#', '', $args); 620 543 621 $url = $GLOBALS['core']->blog->url.$args; 544 622 545 623 if ($n > 1) { 546 $url = preg_replace('#/$#', '',$url);624 $url = preg_replace('#/$#', '', $url); 547 625 $url .= '/page/'.$n; 548 626 } 549 550 $qs = preg_replace('#(^|/)page/([0-9]+)(&?)#', '',$_SERVER['QUERY_STRING']);551 627 628 $qs = preg_replace('#(^|/)page/([0-9]+)(&?)#', '', $_SERVER['QUERY_STRING']); 629 552 630 # If search param 553 631 if (!empty($_GET['q'])) { 554 $s = strpos($url, '?') !== false ? '&' : '?';632 $s = strpos($url, '?') !== false ? '&' : '?'; 555 633 $url .= $s.$qs; 556 634 } 635 557 636 return $url; 558 637 } 559 638 } 560 ?> -
plugins/saba/locales/fr/main.lang.php
r3134 r3244 1 1 <?php 2 2 // Language: Français 3 // Module: saba - 2013. 06.294 // Date: 2013- 06-30 21:56:223 // Module: saba - 2013.10.28 4 // Date: 2013-10-29 08:06:52 5 5 // Translated with dcTranslater - 2013.05.11 6 6 7 #_public.php:342 7 #_config.php:70 8 $GLOBALS['__l10n']['Configuration has been successfully updated.'] = 'La configuration a été mise à jour avec succés.'; 9 10 #_config.php:93 11 $GLOBALS['__l10n']['Enable extension on this blog'] = 'Activer l\'extension sur ce blog'; 12 13 #_config.php:98 14 $GLOBALS['__l10n']['Advanced search'] = 'Recherche avancée'; 15 16 #_config.php:105 17 $GLOBALS['__l10n']['Disable filter on post options'] = 'Désactiver le filtre des options de billet'; 18 19 #_config.php:112 20 $GLOBALS['__l10n']['Disable filter on order'] = 'Désactiver le filtre d\'ordre'; 21 22 #_config.php:119 23 $GLOBALS['__l10n']['Disable filter on age'] = 'Désactiver le filtre de date'; 24 25 #_config.php:126 26 $GLOBALS['__l10n']['Disable filter on categories'] = 'Désactiver le filtre de catégories'; 27 28 #_config.php:133 29 $GLOBALS['__l10n']['Disable filter on authors'] = 'Désactiver le filtre d\'auteurs'; 30 31 #_config.php:140 32 $GLOBALS['__l10n']['Disable filter on post types'] = 'Désactiver le filtre de type de billets'; 33 34 #_public.php:345 8 35 $GLOBALS['__l10n']['Filter options'] = 'Options du filtre'; 9 36 10 #_public.php:36 237 #_public.php:365 11 38 $GLOBALS['__l10n']['Reverse order'] = 'Inverser l\'ordre'; 12 39 13 #_public.php:36 440 #_public.php:367 14 41 $GLOBALS['__l10n']['Filter order'] = 'Options de tri'; 15 42 16 #_public.php:38 543 #_public.php:388 17 44 $GLOBALS['__l10n']['Filter by category'] = 'Filter par catégorie'; 18 45 19 #_public.php:40 646 #_public.php:409 20 47 $GLOBALS['__l10n']['Filter by type'] = 'Filtrer par type'; 21 48 22 #_public.php:42 249 #_public.php:425 23 50 $GLOBALS['__l10n']['Filter by age'] = 'Filtrer par date'; 24 51 25 #_public.php:44 352 #_public.php:446 26 53 $GLOBALS['__l10n']['Filter by author'] = 'Filtrer par auteur'; 27 54 28 #_public.php:47 455 #_public.php:477 29 56 $GLOBALS['__l10n']['With comments'] = 'Avec commentaires'; 30 57 31 #_public.php:47 558 #_public.php:478 32 59 $GLOBALS['__l10n']['With trackbacks'] = 'Avec rétroliens'; 33 60 34 #_public.php:486 35 $GLOBALS['__l10n']['Update'] = 'Mise à jour'; 36 37 #_public.php:487 61 #_public.php:490 38 62 $GLOBALS['__l10n']['Comments count'] = 'Nombre de commentaires'; 39 63 40 #_public.php:4 8864 #_public.php:491 41 65 $GLOBALS['__l10n']['Trackbacks count'] = 'Nombre de rétroliens'; 42 66 43 #_public.php:49 567 #_public.php:498 44 68 $GLOBALS['__l10n']['All'] = 'Tous'; 45 69 46 #_public.php:49 670 #_public.php:499 47 71 $GLOBALS['__l10n']['Less than a month'] = 'Moins d\'un mois'; 48 72 49 #_public.php: 49773 #_public.php:500 50 74 $GLOBALS['__l10n']['From 1 to 6 month'] = 'De 1 à 6 mois'; 51 75 52 #_public.php: 49876 #_public.php:501 53 77 $GLOBALS['__l10n']['From 6 to 12 month'] = 'De 6 à 12 mois'; 54 78 55 #_public.php: 49979 #_public.php:502 56 80 $GLOBALS['__l10n']['More than a year'] = 'Plus d\'un an'; 57 81 58 #_public.php:506 59 $GLOBALS['__l10n']['Entry'] = 'Billet'; 60 61 #_public.php:508 82 #_public.php:511 62 83 $GLOBALS['__l10n']['Poll'] = 'Sondage'; 63 84 64 #_public.php:5 0985 #_public.php:512 65 86 $GLOBALS['__l10n']['Event'] = 'Événement'; 66 87 67 #default-templates/saba_search.html:4468 #index.php:6069 #index.php:6270 #index.php:10771 88 $GLOBALS['__l10n']['Search across blog\'s archive'] = 'Rechercher dans les archives'; 72 89 73 #default-templates/saba_search.html:5674 90 $GLOBALS['__l10n']['Please select a request and options to search on'] = 'Merci de formuler une requête et les options de recherche'; 75 91 76 #default-templates/saba_search.html:6477 92 $GLOBALS['__l10n']['Suggested items'] = 'Articles suggérés'; 78 93 79 #default-templates/saba_search.html:8980 #index.php:7281 $GLOBALS['__l10n']['Advanced search'] = 'Recherche avancée';82 83 #index.php:6684 $GLOBALS['__l10n']['Settings'] = 'Paramètres';85 86 #index.php:6987 $GLOBALS['__l10n']['Enable extension'] = 'Activer l\'extension';88 89 #index.php:7690 $GLOBALS['__l10n']['Disable filter on post options'] = 'Désactiver le filtre des options de billet';91 92 #index.php:8093 $GLOBALS['__l10n']['Disable filter on order'] = 'Désactiver le filtre d\'ordre';94 95 #index.php:8496 $GLOBALS['__l10n']['Disable filter on age'] = 'Désactiver le filtre de date';97 98 #index.php:8899 $GLOBALS['__l10n']['Disable filter on categories'] = 'Désactiver le filtre de catégories';100 101 #index.php:92102 $GLOBALS['__l10n']['Disable filter on authors'] = 'Désactiver le filtre d\'auteurs';103 104 #index.php:96105 $GLOBALS['__l10n']['Disable filter on post types'] = 'Désactiver le filtre de type de billets';106 107 94 ?> -
plugins/saba/locales/fr/main.po
r3134 r3244 1 1 # Language: Français 2 # Module: saba - 2013. 06.293 # Date: 2013- 06-30 21:56:222 # Module: saba - 2013.10.28 3 # Date: 2013-10-29 08:06:53 4 4 # Translated with translater 2013.05.11 5 5 … … 7 7 msgstr "" 8 8 "Content-Type: text/plain; charset=UTF-8\n" 9 "Project-Id-Version: saba 2013. 06.29\n"9 "Project-Id-Version: saba 2013.10.28\n" 10 10 "POT-Creation-Date: \n" 11 "PO-Revision-Date: 2013- 06-30T21:56:22+00:00\n"11 "PO-Revision-Date: 2013-10-29T08:06:53+00:00\n" 12 12 "Last-Translator: Jean-Christian Denis\n" 13 13 "Language-Team: \n" … … 15 15 "Content-Transfer-Encoding: 8bit\n" 16 16 17 #: _public.php:342 17 #: _config.php:70 18 msgid "Configuration has been successfully updated." 19 msgstr "La configuration a été mise à jour avec succés." 20 21 #: _config.php:93 22 msgid "Enable extension on this blog" 23 msgstr "Activer l'extension sur ce blog" 24 25 #: _config.php:98 26 msgid "Advanced search" 27 msgstr "Recherche avancée" 28 29 #: _config.php:105 30 msgid "Disable filter on post options" 31 msgstr "Désactiver le filtre des options de billet" 32 33 #: _config.php:112 34 msgid "Disable filter on order" 35 msgstr "Désactiver le filtre d'ordre" 36 37 #: _config.php:119 38 msgid "Disable filter on age" 39 msgstr "Désactiver le filtre de date" 40 41 #: _config.php:126 42 msgid "Disable filter on categories" 43 msgstr "Désactiver le filtre de catégories" 44 45 #: _config.php:133 46 msgid "Disable filter on authors" 47 msgstr "Désactiver le filtre d'auteurs" 48 49 #: _config.php:140 50 msgid "Disable filter on post types" 51 msgstr "Désactiver le filtre de type de billets" 52 53 #: _public.php:345 18 54 msgid "Filter options" 19 55 msgstr "Options du filtre" 20 56 21 #: _public.php:36 257 #: _public.php:365 22 58 msgid "Reverse order" 23 59 msgstr "Inverser l'ordre" 24 60 25 #: _public.php:36 461 #: _public.php:367 26 62 msgid "Filter order" 27 63 msgstr "Options de tri" 28 64 29 #: _public.php:38 565 #: _public.php:388 30 66 msgid "Filter by category" 31 67 msgstr "Filter par catégorie" 32 68 33 #: _public.php:40 669 #: _public.php:409 34 70 msgid "Filter by type" 35 71 msgstr "Filtrer par type" 36 72 37 #: _public.php:42 273 #: _public.php:425 38 74 msgid "Filter by age" 39 75 msgstr "Filtrer par date" 40 76 41 #: _public.php:44 377 #: _public.php:446 42 78 msgid "Filter by author" 43 79 msgstr "Filtrer par auteur" 44 80 45 #: _public.php:47 481 #: _public.php:477 46 82 msgid "With comments" 47 83 msgstr "Avec commentaires" 48 84 49 #: _public.php:47 585 #: _public.php:478 50 86 msgid "With trackbacks" 51 87 msgstr "Avec rétroliens" 52 88 53 #: _public.php:486 54 msgid "Update" 55 msgstr "Mise à jour" 56 57 #: _public.php:487 89 #: _public.php:490 58 90 msgid "Comments count" 59 91 msgstr "Nombre de commentaires" 60 92 61 #: _public.php:4 8893 #: _public.php:491 62 94 msgid "Trackbacks count" 63 95 msgstr "Nombre de rétroliens" 64 96 65 #: _public.php:49 597 #: _public.php:498 66 98 msgid "All" 67 99 msgstr "Tous" 68 100 69 #: _public.php:49 6101 #: _public.php:499 70 102 msgid "Less than a month" 71 103 msgstr "Moins d'un mois" 72 104 73 #: _public.php: 497105 #: _public.php:500 74 106 msgid "From 1 to 6 month" 75 107 msgstr "De 1 à 6 mois" 76 108 77 #: _public.php: 498109 #: _public.php:501 78 110 msgid "From 6 to 12 month" 79 111 msgstr "De 6 à 12 mois" 80 112 81 #: _public.php: 499113 #: _public.php:502 82 114 msgid "More than a year" 83 115 msgstr "Plus d'un an" 84 116 85 #: _public.php:506 86 msgid "Entry" 87 msgstr "Billet" 88 89 #: _public.php:508 117 #: _public.php:511 90 118 msgid "Poll" 91 119 msgstr "Sondage" 92 120 93 #: _public.php:5 09121 #: _public.php:512 94 122 msgid "Event" 95 123 msgstr "Événement" 96 124 97 #: default-templates/saba_search.html:4498 #: index.php:6099 #: index.php:62100 #: index.php:107101 125 msgid "Search across blog's archive" 102 126 msgstr "Rechercher dans les archives" 103 127 104 #: default-templates/saba_search.html:56105 128 msgid "Please select a request and options to search on" 106 129 msgstr "Merci de formuler une requête et les options de recherche" 107 130 108 #: default-templates/saba_search.html:64109 131 msgid "Suggested items" 110 132 msgstr "Articles suggérés" 111 133 112 #: default-templates/saba_search.html:89113 #: index.php:72114 msgid "Advanced search"115 msgstr "Recherche avancée"116 117 #: index.php:66118 msgid "Settings"119 msgstr "Paramètres"120 121 #: index.php:69122 msgid "Enable extension"123 msgstr "Activer l'extension"124 125 #: index.php:76126 msgid "Disable filter on post options"127 msgstr "Désactiver le filtre des options de billet"128 129 #: index.php:80130 msgid "Disable filter on order"131 msgstr "Désactiver le filtre d'ordre"132 133 #: index.php:84134 msgid "Disable filter on age"135 msgstr "Désactiver le filtre de date"136 137 #: index.php:88138 msgid "Disable filter on categories"139 msgstr "Désactiver le filtre de catégories"140 141 #: index.php:92142 msgid "Disable filter on authors"143 msgstr "Désactiver le filtre d'auteurs"144 145 #: index.php:96146 msgid "Disable filter on post types"147 msgstr "Désactiver le filtre de type de billets"148
Note: See TracChangeset
for help on using the changeset viewer.