Dotclear

Changeset 3042:f30c69a00219 for plugins


Ignore:
Timestamp:
07/05/15 11:13:58 (10 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Includes pages (if plugin enabled) to search results, let be currywurst search template be dependant from pages plugin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/pages/_public.php

    r2920 r3042  
    1212if (!defined('DC_RC_PATH')) { return; } 
    1313 
     14$core->addBehavior('coreBlogBeforeGetPosts',array('publicPages','coreBlogBeforeGetPosts')); 
     15 
    1416# Localized string we find in template 
    1517__('Published on'); 
     
    1719 
    1820require dirname(__FILE__).'/_widgets.php'; 
     21 
     22class publicPages 
     23{ 
     24     public static function coreBlogBeforeGetPosts($params) 
     25     { 
     26          global $core, $_ctx; 
     27 
     28          if ($core->url->type == 'search') { 
     29               // Add page post type for searching 
     30               if (isset($params['post_type'])) { 
     31                    if (!is_array($params['post_type'])) { 
     32                         // Convert it in array 
     33                         $params['post_type'] = array($params['post_type']); 
     34                    } 
     35                    if (!in_array('page', $params['post_type'])) { 
     36                         // Add page post type 
     37                         $params['post_type'][] = 'page'; 
     38                    } 
     39               } else { 
     40                    // Dont miss default post type (aka post) 
     41                    $params['post_type'] = array('post','page'); 
     42               } 
     43          } 
     44     } 
     45} 
    1946 
    2047class urlPages extends dcUrlHandlers 
Note: See TracChangeset for help on using the changeset viewer.

Sites map