openrat-cms

# OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs

FolderPublisher.class.php (1574B)


      1 <?php
      2 /**
      3  * Created by PhpStorm.
      4  * User: dankert
      5  * Date: 10.08.18
      6  * Time: 23:35
      7  */
      8 
      9 class FolderPublisher
     10 {
     11     function publish( $withPages,$withFiles,$subdirs = false )
     12     {
     13         set_time_limit(300);
     14         if	( ! is_object($this->publish) )
     15             $this->publish = new \Publish();
     16 
     17         foreach( $this->getObjectIds() as $oid )
     18         {
     19             $o = new BaseObject( $oid );
     20             $o->objectLoadRaw();
     21 
     22             if	( $o->isPage && $withPages )
     23             {
     24                 $p = new Page( $oid );
     25                 $p->load();
     26                 $p->publish = &$this->publish;
     27                 $p->publish();
     28             }
     29 
     30             if	( $o->isFile && $withFiles )
     31             {
     32                 $f = new File( $oid );
     33                 $f->load();
     34                 $f->publish = &$this->publish;
     35                 $f->publish();
     36             }
     37 
     38             if	( $o->isImage && $withFiles )
     39             {
     40                 $f = new Image( $oid );
     41                 $f->load();
     42                 $f->publish = &$this->publish;
     43                 $f->publish();
     44             }
     45 
     46             if	( $o->isText && $withFiles )
     47             {
     48                 $f = new Text( $oid );
     49                 $f->load();
     50                 $f->publish = &$this->publish;
     51                 $f->publish();
     52             }
     53 
     54             if	( $o->isFolder && $subdirs )
     55             {
     56                 $f = new Folder( $oid );
     57                 $f->load();
     58                 $f->publish = &$this->publish;
     59                 $f->publish( $withPages,$withFiles,true );
     60             }
     61         }
     62     }
     63 
     64 
     65 }