/**
  * Constructor
  *
  * @param    object    $subject    The object to observe
  * @param    array     $config     An array that holds the plugin configuration
  */
 public function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     // Load language file of plugin
     $this->loadLanguage();
     if (defined('_JG_SEARCH_DEBUG')) {
         // FirePHP
         ob_start();
         $this->firephp = FirePHP::getInstance(true);
         // JProfiler
         $this->p = JProfiler::getInstance('JoomGallerySearch');
         $this->p->mark('SCRIPT-START');
     }
     // Create an instance of JoomGallery's interface class
     $this->_jg_interface = new JoomInterface();
     // Get the backend parameters
     $this->_search_img_description = $this->params->get('search_img_description', 1);
     $this->_search_img_comment = $this->params->get('search_img_comment', 0);
     $this->_search_cat_title = $this->params->get('search_cat_title', 0);
     $this->_search_cat_description = $this->params->get('search_cat_description', 0);
     $this->_search_limit = $this->params->get('search_limit', 0);
     $this->_search_mode = $this->params->get('search_mode', 0);
     $this->_search_hidden = $this->params->get('search_hidden', 0);
     $this->_search_tmpl_overwrite = $this->params->get('search_tmpl_overwrite', 0);
     $this->_search_img_author = $this->params->get('search_img_author', 0);
     $this->_search_itemid = intval($this->params->get('search_itemid', 0));
     if ($this->_search_itemid > 0) {
         $this->_jg_interface->addConfig('Itemid', $this->_search_itemid);
     }
     $this->_search_img_owner = $this->params->get('search_img_owner', 0);
     $this->_search_cat_owner = $this->params->get('search_cat_owner', 0);
     // Get overwrite parameters from request (e.g. JoomGallery search module)
     $overwrite = false;
     $search_mode_req = JRequest::getInt('joomsearchcatorimg', null);
     $search_limit_req = JRequest::getInt('joomsearchlimit', null);
     $search_img_description_req = JRequest::getInt('joomsearchimgdescr', null);
     $search_img_comment_req = JRequest::getInt('joomsearchcomments', null);
     $search_img_author_req = JRequest::getInt('joomsearchauthors', null);
     $search_cat_description_req = JRequest::getInt('joomsearchcatdescr', null);
     $search_categories_req = JRequest::getString('joomsearchcatid', null);
     $search_subcats_req = JRequest::getInt('joomsearchsubcats', null);
     $search_img_owner_req = JRequest::getInt('joomsearchimgowners', null);
     $search_cat_owner_req = JRequest::getInt('joomsearchcatowners', null);
     if (defined('_JG_SEARCH_DEBUG')) {
         $this->firephp->log($search_mode_req, '$search_mode_req');
         $this->firephp->log($search_limit_req, '$search_limit_req');
         $this->firephp->log($search_img_description_req, '$search_img_description_req');
         $this->firephp->log($search_img_comment_req, '$search_img_comment_req');
         $this->firephp->log($search_img_author_req, '$search_img_author_req');
         $this->firephp->log($search_cat_description_req, '$search_cat_description_req');
         $this->firephp->log($search_categories_req, '$search_categories_req');
         $this->firephp->log($search_subcats_req, '$search_subcats_req');
         $this->firephp->log($search_img_owner_req, '$search_img_owner_req');
         $this->firephp->log($search_cat_owner_req, '$search_cat_owner_req');
     }
     if (isset($search_mode_req)) {
         switch ($search_mode_req) {
             // Mode images
             case 1:
             default:
                 if (isset($search_img_description_req) && isset($search_img_comment_req) && isset($search_img_author_req)) {
                     $this->_search_img_description = $search_img_description_req;
                     $this->_search_img_comment = $search_img_comment_req;
                     $this->_search_img_author = $search_img_author_req;
                     if (isset($search_img_owner_req)) {
                         $this->_search_img_owner = $search_img_owner_req;
                     } else {
                         $this->_search_img_owner = $search_img_author_req;
                     }
                     $this->_search_mode = 0;
                     $overwrite = true;
                 }
                 break;
                 // Mode categories
             // Mode categories
             case 0:
                 if (isset($search_cat_description_req)) {
                     $this->_search_cat_description = $search_cat_description_req;
                     $this->_search_mode = 1;
                     if (isset($search_cat_owner_req)) {
                         $this->_search_cat_owner = $search_cat_owner_req;
                     }
                     $overwrite = true;
                 }
                 break;
         }
         if ($overwrite) {
             // Is there a search limit defined in the request
             if (isset($search_limit_req)) {
                 $this->_search_limit = $search_limit_req;
             }
             // Should the search be restricted to certain categories ?
             if (isset($search_categories_req) && isset($search_subcats_req)) {
                 $search_categories_req = $this->cleanCSV($search_categories_req);
                 if ($search_categories_req != '') {
                     $cats = explode(',', $search_categories_req);
                     // Delete double values
                     $cats = array_unique($cats);
                     if ($search_subcats_req == 1) {
                         // Add all subcategories to the given category list
                         $this->_search_categories = array();
                         foreach ($cats as $cat) {
                             if (!in_array($cat, $this->_search_categories)) {
                                 $this->_search_categories = array_merge($this->_search_categories, JoomHelper::getAllSubCategories($cat, true, true, false, false));
                             }
                         }
                     } else {
                         $this->_search_categories = $cats;
                     }
                 }
                 if (defined('_JG_SEARCH_DEBUG')) {
                     $this->firephp->log($this->_search_categories, '$this->_search_categories');
                 }
             }
         }
     }
     if (defined('_JG_SEARCH_DEBUG')) {
         $this->firephp->log($overwrite, '$overwrite');
     }
     // Internal parameters
     $this->_search_img_title = 0;
     $this->_search_cat_title = 0;
     // Patch parameters regarding to search mode
     switch ($this->_search_mode) {
         case 0:
         default:
             // Mode images
             $this->_search_img_title = 1;
             $this->_search_cat_title = 0;
             $this->_search_cat_description = 0;
             $this->_search_cat_owner = 0;
             break;
         case 1:
             // Mode categories
             $this->_jg_interface->addConfig('catlink', 1);
             $this->_search_cat_title = 1;
             $this->_search_img_description = 0;
             $this->_search_img_comment = 0;
             $this->_search_img_author = 0;
             $this->_search_img_owner = 0;
             break;
     }
 }
示例#2
0
 /**
  * Sets contents of passed object to values from current object.
  *
  * If desired, this method can also make copies of all associated (fkey referrers)
  * objects.
  *
  * @param      object $copyObj An object of Model (or compatible) type.
  * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  * @throws     PropelException
  */
 public function copyInto($copyObj, $deepCopy = false)
 {
     $copyObj->setModelName($this->model_name);
     $copyObj->setModelInfo($this->model_info);
     $copyObj->setSeriesId($this->series_id);
     $copyObj->setReviewId($this->review_id);
     $copyObj->setScoreId($this->score_id);
     $copyObj->setWeight($this->weight);
     $copyObj->setCreatedAt($this->created_at);
     $copyObj->setUpdatedAt($this->updated_at);
     if ($deepCopy) {
         // important: temporarily setNew(false) because this affects the behavior of
         // the getter/setter methods for fkey referrer objects.
         $copyObj->setNew(false);
         foreach ($this->getConfigs() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addConfig($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getReviews() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addReview($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getScores() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addScore($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getUserMetas() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addUserMeta($relObj->copy($deepCopy));
             }
         }
     }
     // if ($deepCopy)
     $copyObj->setNew(true);
     $copyObj->setId(NULL);
     // this is a auto-increment column, so set to default value
 }
示例#3
0
 /**
  * Sets contents of passed object to values from current object.
  *
  * If desired, this method can also make copies of all associated (fkey referrers)
  * objects.
  *
  * @param      object $copyObj An object of \App\Propel\ConfigCategory (or compatible) type.
  * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
  * @throws PropelException
  */
 public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
 {
     $copyObj->setConfigCategoryIsVisible($this->getConfigCategoryIsVisible());
     if ($deepCopy) {
         // important: temporarily setNew(false) because this affects the behavior of
         // the getter/setter methods for fkey referrer objects.
         $copyObj->setNew(false);
         foreach ($this->getConfigs() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addConfig($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getConfigCategoryI18ns() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addConfigCategoryI18n($relObj->copy($deepCopy));
             }
         }
     }
     // if ($deepCopy)
     if ($makeNew) {
         $copyObj->setNew(true);
         $copyObj->setConfigCategoryId(NULL);
         // this is a auto-increment column, so set to default value
     }
 }