Example #1
0
 public function __construct()
 {
     $class = get_class($this);
     $this->name = \Str::snake($class);
     $this->key = str_replace('_plugin', '', $this->name);
     $this->config = $this->loadConfig();
     if (!bool(element('enabled', $this->config, true))) {
         throw new \InvalidEntryException();
     }
 }
Example #2
0
 public function testToBool()
 {
     $this->assertTrue(bool('on'));
     $this->assertTrue(bool('true'));
     $this->assertTrue(bool('1'));
     $this->assertTrue(bool('yes'));
     $this->assertFalse(bool('off'));
     $this->assertFalse(bool('false'));
     $this->assertFalse(bool('0'));
     $this->assertFalse(bool('no'));
     $this->assertFalse(bool('none'));
     $this->assertFalse(bool('null'));
     $this->assertFalse(bool(false));
     $this->assertEquals(null, bool('hi'));
     $this->assertEquals(null, bool(''));
     $this->assertEquals(null, bool(null));
 }
Example #3
0
 /**
  * Load collection
  *
  * @codeCoverageIgnore
  */
 public function load()
 {
     Profiler::startTimer(__METHOD__);
     $cache_id = $this->cacheID();
     if ($this->count()) {
         throw new \LogicException('Already loaded');
     }
     $loader = function () {
         return $this->collect();
     };
     if (bool(Conf::get('cache'))) {
         $items = $this->cache($cache_id, $loader);
     } else {
         $items = $loader();
     }
     $this->collection = new Collection($items);
     Profiler::endTimer(__METHOD__);
 }
Example #4
0
 public function onClose($req, $res)
 {
     if (bool(Conf::get('cache')) && $this->converted_keys) {
         $cache_id = $this->cacheID();
         Log::debug('converted ' . $cache_id . ' detected');
         $class = $this->itemClass();
         $items = $this->cache($cache_id);
         foreach ($this->converted_keys as $key) {
             $item =& $items[$key];
             $obj = $class::find($key);
             $item->converted = true;
             $item->content = $obj->content;
         }
         self::clearCache($cache_id);
         self::cache($cache_id, function () use($items) {
             return $items;
         });
         Log::debug($cache_id . ' cache updated');
     }
 }
Example #5
0
 function filter($value, $type)
 {
     switch ($type) {
         # Quote strings
         case 'string':
         default:
             return quote($value);
             # Clean integers
         # Clean integers
         case 'int':
             return intval($value);
             # Float
         # Float
         case 'float':
             if (is_numeric($value)) {
                 return $value;
             }
             return quote($value);
             # Create arrays - make empty array if no value, not an array with a single empty value
         # Create arrays - make empty array if no value, not an array with a single empty value
         case 'array':
             $args = $value ? implode(', ', array_map('quote', (array) $value)) : '';
             return 'array(' . $args . ')';
             # Bool - check we have a real bool and resort to default if not
         # Bool - check we have a real bool and resort to default if not
         case 'bool':
             if (bool($value) === NULL) {
                 global $option;
                 $value = $option->default;
             }
             return $value;
     }
 }
 // Open images
 $original = new Imagick($originalImagePath);
 $watermark = new Imagick($watermarkImagePath);
 // Set opacity for images with alpha channel and without
 if ($watermark->getImageAlphaChannel()) {
     $watermark->evaluateImage(Imagick::EVALUATE_DIVIDE, 1.0 / $transparency, Imagick::CHANNEL_ALPHA);
 } else {
     $watermark->setImageOpacity($transparency);
 }
 // Resize image
 if ($watermarkResize > 1) {
     $watermark->resizeImage($watermark->getImageWidth() / $watermarkResize, $watermark->getImageHeight() / $watermarkResize, Imagick::FILTER_LANCZOS, 1);
 }
 // Watermark block
 $isPattern = post('isPattern');
 if (bool($isPattern)) {
     // Get watermark`s offset from original image
     $initialX = (int) str_replace('px', '', post('x'));
     $initialY = (int) str_replace('px', '', post('y'));
     // Get watermark sizes
     $watermarkWidth = $watermark->getImageWidth();
     $watermarkHeight = $watermark->getImageHeight();
     // Get original image sizes
     $imageWidth = $original->getImageWidth();
     $imageHeight = $original->getImageHeight();
     // Merge watermark in tiling mode
     for ($x = $initialX;; $x += $watermarkWidth + (int) $originY) {
         for ($y = $initialY;; $y += $watermarkHeight + (int) $originX) {
             $original->compositeImage($watermark, Imagick::COMPOSITE_DEFAULT, $x, $y);
             if ($y > $imageHeight) {
                 break;
<?php

/**
 * @var \Destiny\Character\Activity $activity
 */
?>

<div class="activity" data-hash="<?php 
echo $activity->activityHash;
?>
" data-identifier="<?php 
echo $activity->identifier;
?>
" data-completed="<?php 
echo bool($activity->isCompleted);
?>
">
	<div class="image">
		<img class="icon" src="<?php 
echo bungie($activity->icon);
?>
">
	</div>
	<div class="activity-details">
		<div class="name">
			<?php 
echo e($activity->activityName);
?>
			@if($activity->isCompleted)<i class="fa fa-check"></i>@endif
		</div>
		<div class="level">
<?php

/**
 * @var \Destiny\Character\InventoryItem $item
 */
?>

@if($item)
<div class="equipped" data-toggle="tooltip"
	title="<?php 
echo e($item->itemDescription);
?>
"
	data-complete="<?php 
echo bool($item->isGridComplete);
?>
"
	data-hash="<?php 
echo $item->itemHash;
?>
"
	>
	<img class="icon" src="<?php 
echo bungie($item->icon);
?>
">
	<div class="name"><?php 
echo e($item->itemName);
?>
</div>
	<div class="tier"><?php 
<?php

/**
 * @var float $progress
 */
?>

<div class="progress" data-complete="<?php 
echo bool($progress == 100);
?>
">
	<div class="progress-bar"
		style="width: <?php 
echo $progress;
?>
%;"
		role="progressbar"
		aria-valuenow="<?php 
echo $progress;
?>
"
		aria-valuemin="0"
		aria-valuemax="100">
		<?php 
echo isset($label) ? $label : null;
?>
	</div>
</div>
Example #10
0
 protected function checkPublishedFlag()
 {
     if (!isset($this->data['published'])) {
         $this->published = true;
     } else {
         $this->published = bool($this->data['published']);
     }
     if (false === $this->published) {
         if ('local' != App::environment()) {
             throw new \InvalidEntryException();
         }
     }
 }
Example #11
0
 public function testBoolFunctionThrowsException()
 {
     $this->setExpectedException('InvalidArgumentException');
     bool('yolo');
 }
Example #12
0
// authorize and initialize like timeclock.php
// Program parameters.
$from_date = isset($_POST['from_date']) ? $_POST['from_date'] : null;
$to_date = isset($_POST['to_date']) ? $_POST['to_date'] : null;
$date_fmt = isset($_POST['date_fmt']) ? $_POST['date_fmt'] : null;
$user_name = isset($_POST['user_name']) ? $_POST['user_name'] : null;
$group_name = isset($_POST['group_name']) ? $_POST['group_name'] : null;
$office_name = isset($_POST['office_name']) ? $_POST['office_name'] : null;
// Program options.
$c_reg_ot = bool($_POST['c_reg_ot']);
$c_inout = bool($_POST['c_inout']);
$c_date = bool($_POST['c_date']);
$c_employee = bool($_POST['c_employee']);
$c_name = bool($_POST['c_name']);
$c_group = bool($_POST['c_group']);
$c_office = bool($_POST['c_office']);
////////////////////////////////////////
$PAGE_TITLE = "Export - {$title}";
$PAGE_STYLE = <<<End_Of_HTML
<style type="text/css">
@media print {
\t.page { background-color:#FFF; border:0; }
\t.topmain_row_color { display:none; }
\t.options { display:none; }
\t.buttons, .select-buttons { display:none; }
\t.misc_items { color:#222; }
}
</style>
End_Of_HTML;
$PAGE_SCRIPT = <<<End_Of_HTML
<script type="text/javascript" src="scripts/textrange.js"></script>