/**
  * @test
  */
 public function noViewWhenNoTemplate()
 {
     $daoStub = $this->getMockBuilder('phpList\\plugin\\ContentAreas\\DAO')->disableOriginalConstructor()->getMock();
     $pi = new ContentAreas();
     $pi->setDao($daoStub);
     $result = $pi->viewMessage(12, ['template' => 0]);
     $this->assertEquals('', $result);
 }
예제 #2
0
/**
 * content_areas_frontend_template_function
 *
 * the template function for content areas, returns the
 * content for the specific content area
 *
 * @params array $params
 * @params object $smarty
 * @return void
 */
function content_areas_frontend_template_function($params, &$smarty)
{
    $ContentAreas = ContentAreas::getInstance();
    $registered = $ContentAreas->isRegistered($params['name']) ? '' : ' content-area-unregistered';
    echo '<div class="content-area' . $registered . '" id="content-area-' . $params['name'] . '">';
    echo $ContentAreas->getContent($params['name'], $smarty->getTemplateVars('page_id'));
    echo '</div>';
}
예제 #3
0
 /**
  * getInstance 
  * 
  * @static
  * @param string $value , true if new instance should be made
  * @access public
  * @return instance
  */
 public static function getInstance($value = false)
 {
     /**
      * if value is true a new instance is created
      */
     if ($value == true) {
         if (self::$instance) {
             self::$instance == '';
         }
         self::$instance = new ContentAreas();
         return self::$instance;
     }
     /**
      *  checks if an instance exists
      */
     if (!self::$instance) {
         self::$instance = new ContentAreas();
     }
     return self::$instance;
 }
예제 #4
0
<?php

/**
 * Content Areas Plugin, Furasta.Org
 *
 * @author	Conor Mac Aoidh <*****@*****.**>
 * @licence	http://furasta.org/licence.txt The BSD Licence
 * @version	1
 */
if (!defined('AJAX_LOADED') || !defined('AJAX_VERIFIED')) {
    exit;
}
$name = addslashes(@$_POST['name']);
$content = @$_POST['content'];
if ($name == '' || $content == '') {
    exit;
}
$ContentAreas = ContentAreas::getInstance();
$ContentAreas->addArea($name, 'all', $content);
exit;