Guest User

jklø

a guest
Mar 16th, 2013
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.51 KB | None | 0 0
  1. <?php
  2. /**
  3.  * @file        form.php    IP.Gallery search form plugin
  4.  *~TERABYTE_DOC_READY~
  5.  * $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
  6.  * $License: http://www.invisionpower.com/company/standards.php#license$
  7.  * $Author: bfarber $
  8.  * $LastChangedDate: 2012-07-13 18:03:32 -0400 (Fri, 13 Jul 2012) $
  9.  * @version     v5.0.3
  10.  * $Revision: 11076 $
  11.  */
  12.  
  13. if ( ! defined( 'IN_IPB' ) )
  14. {
  15.     print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
  16.     exit();
  17. }
  18.  
  19. class search_form_gallery
  20. {
  21.     /**
  22.      * Construct
  23.      *
  24.      * @return  @e void
  25.      */
  26.     public function __construct()
  27.     {
  28.         //-----------------------------------------
  29.         // Set registry objects
  30.         //-----------------------------------------
  31.  
  32.         $this->registry   =  ipsRegistry::instance();
  33.         $this->DB         =  $this->registry->DB();
  34.         $this->settings   =& $this->registry->fetchSettings();
  35.         $this->request    =& $this->registry->fetchRequest();
  36.         $this->lang       =  $this->registry->getClass('class_localization');
  37.         $this->member     =  $this->registry->member();
  38.         $this->memberData =& $this->registry->member()->fetchMemberData();
  39.         $this->cache      =  $this->registry->cache();
  40.         $this->caches     =& $this->registry->cache()->fetchCaches();
  41.        
  42.         //-----------------------------------------
  43.         // Load our gallery object
  44.         //-----------------------------------------
  45.  
  46.         if ( ! ipsRegistry::isClassLoaded('gallery') )
  47.         {
  48.             $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir('gallery') . '/sources/classes/gallery.php', 'ipsGallery', 'gallery' );
  49.             $this->registry->setClass( 'gallery', new $classToLoad( $this->registry ) );
  50.         }
  51.        
  52.         //-----------------------------------------
  53.         // Load language file
  54.         //-----------------------------------------
  55.  
  56.         $this->registry->class_localization->loadLanguageFile( array( 'public_gallery' ), 'gallery' );
  57.     }
  58.    
  59.     /**
  60.      * Return sort drop down
  61.      *
  62.      * @return  @e array
  63.      */
  64.     public function fetchSortDropDown()
  65.     {
  66.         $array  = array(
  67.                         'images'    => array(
  68.                                             'date'      => $this->lang->words['search_sort_date'],
  69.                                             'title'     => $this->lang->words['search_sort_caption'],
  70.                                             'views'     => $this->lang->words['search_sort_views'],
  71.                                             'comments'  => $this->lang->words['search_sort_comments'],
  72.                                         ),
  73.                         'comments'  => array(
  74.                                             'date'      => $this->lang->words['s_search_type_0'],
  75.                                             ),
  76.                         'albums'    => array(
  77.                                             'date'      => $this->lang->words['s_search_type_0'],
  78.                                             )
  79.                     );
  80.  
  81.         return $array;
  82.     }
  83.    
  84.     /**
  85.      * Return sort in options
  86.      *
  87.      * @return  @e array
  88.      */
  89.     public function fetchSortIn()
  90.     {
  91.         if( $this->request['search_tags'] )
  92.         {
  93.             $array  = array(
  94.                             array( 'images',    $this->lang->words['advsearch_images'] ),
  95.                             );
  96.         }
  97.         else
  98.         {
  99.             $array  = array(
  100.                             array( 'images',    $this->lang->words['advsearch_images'] ),
  101.                             array( 'comments',  $this->lang->words['advsearch_comments'] ),
  102.                             array( 'albums',    $this->lang->words['advsearch_albums'] )  
  103.                             );
  104.         }
  105.  
  106.         return $array;
  107.     }
  108.    
  109.     /**
  110.      * Retrieve HTML for additional filtering options
  111.      *
  112.      * @return  @e string   Filter HTML
  113.      */
  114.     public function getHtml()
  115.     {
  116.         $categories = $this->registry->gallery->helper('categories')->catJumpList( true, 'images' );
  117.        
  118.         return array( 'title' => IPSLIb::getAppTitle('gallery'), 'html' => ipsRegistry::getClass('output')->getTemplate('gallery_external')->galleryAdvancedSearchFilters( $categories ) );
  119.     }
  120. }
Advertisement
Add Comment
Please, Sign In to add comment