Пример #1
0
 /**
  * Applies the filters the the query results.
  * Method builds the name like %hooks_prefix%%table_name%_%name%.
  * @param string $name Filter name
  * @param mixed $result Query result
  * @return mixed
  */
 protected function dispatchFilter($name, $result)
 {
     if (!$this->environment) {
         return $result;
     }
     return $this->environment->getDispatcher()->apply($this->getRawTableName() . '_' . strtolower($name), array($result));
 }
Пример #2
0
 /**
  * Sharer constructor.
  * @param SocialSharing_Projects_Project $project
  * @param Rsc_Environment $environment
  */
 public function __construct(SocialSharing_Projects_Project $project, Rsc_Environment $environment)
 {
     $this->project = $project;
     $this->environment = $environment;
     $this->builder = $environment->getModule('HtmlBuilder');
     $this->dispatcher = $environment->getDispatcher();
 }
Пример #3
0
 /**
  * Removes photos with specified folder id.
  *
  * @param int $id Folder id.
  * @return bool
  */
 public function deleteByFolderId($id)
 {
     if ($this->deleteBy('folder_id', $id)) {
         if ($this->environment) {
             $this->environment->getDispatcher()->dispatch('photos_delete_by_folder_id', array($id));
         }
         return true;
     }
     return false;
 }
Пример #4
0
 /**
  * Extends the slider object with required properties.
  *
  * @param stdClass[]|stdClass $slider Slider object
  * @throws RuntimeException
  * @return stdClass[]|stdClass
  */
 public function compile($slider)
 {
     if (is_array($slider)) {
         return array_map(array($this, 'compile'), $slider);
     }
     if (!$this->environment) {
         throw new RuntimeException('Environment is not specified.');
     }
     $dispatcher = $this->environment->getDispatcher();
     if (!$slider) {
         return;
     }
     return $dispatcher->apply(self::EVENT_COMPILE, array($slider));
 }