MainTag.php
| 1 | <?php |
| 2 | if (!defined('ABSPATH')) exit; |
| 3 | |
| 4 | class IRP_MainTag extends IRP_HTMLTag { |
| 5 | public function __construct() { |
| 6 | parent::__construct(); |
| 7 | } |
| 8 | |
| 9 | public function write(IRP_HTMLContext $context) { |
| 10 | global $irp; |
| 11 | foreach ($this->tags as $tag) { |
| 12 | $tag->write($context); |
| 13 | } |
| 14 | |
| 15 | //try to write the last box only if no boxes are written before |
| 16 | //this prevent from inserting at the end a box due to tipically |
| 17 | //marketer insert a CTA box (for instance download free book) |
| 18 | if($irp->Options->isRewriteAtEnd() && $irp->Options->getRewriteBoxesWritten()==0) { |
| 19 | $context->clearSkipNext(); |
| 20 | $context->setUncuttable(FALSE); |
| 21 | $context->writeRelatedBox(TRUE); |
| 22 | } elseif(!$irp->Options->isRewriteAtEnd()) { |
| 23 | $args=array('last'=>TRUE); |
| 24 | $context->popRelatedBox($args); |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 |