Example #1
0
/**
 * Return a value from cache else save new
 *
 * @param string $key
 * @param \Closure $callback
 * @param integer $minutes number of minutes to store items. Default: 60m
 * @return mixed
 */
function zbase_cache($key, \Closure $callback, array $tags = null, $minutes = 60, $options = array())
{
    if ($minutes === null) {
        $minutes = 60;
    }
    $logFile = !empty($options['logFile']) ? $options['logFile'] : __FUNCTION__;
    $logMsg = !empty($options['logMsg']) ? $options['logMsg'] : __FUNCTION__;
    if (zbase_cache_has($key, $tags, $options)) {
        zbase_log($key . ' -- CACHE HIT' . PHP_EOL . $logMsg, null, $logFile);
        return zbase_cache_get($key, $tags, $options);
    }
    zbase_log($key . ' -- CACHE MISS' . PHP_EOL . $logMsg, null, $logFile);
    /**
     * Force Cache Entity Level
     */
    $forceCaching = zbase_config_get('db.cache.force', true);
    if (!empty($options['forceCache']) && !empty($forceCaching)) {
        $value = $callback();
        zbase_cache_save($key, $value, $minutes, $tags, $options);
        return $value;
    }
    if (!zbase_cache_enable()) {
        return $callback();
    }
    $value = $callback();
    zbase_cache_save($key, $value, $minutes, $tags, $options);
    return $value;
    // return \Cache::remember($key, $minutes, $callback);
}
Example #2
0
 /**
  * If registration is enabled
  * @return boolean
  */
 public function registerEnabled()
 {
     if ($this->authEnabled()) {
         return zbase_config_get('auth.register.enable', true);
     }
     return false;
 }
Example #3
0
/**
 * Return the Minimum Access for the section
 * @return string
 */
function zbase_auth_minimum()
{
    if (zbase_is_back()) {
        if (zbase_route_username()) {
            return zbase_route_username_minimum_access();
        }
        return zbase_config_get('auth.access.minimum.back', 'admin');
    }
    return zbase_config_get('auth.access.minimum.front', 'guest');
}
Example #4
0
/**
 * Create a URL Based from a route $name
 * @param type $name
 * @param type $params
 */
function zbase_url_from_route($name, $params = [], $relative = false)
{
    if (!\Route::has($name)) {
        return '#';
    }
    $routes = zbase_config_get('routes');
    $prefix = '';
    $name = str_replace('admin.', zbase_admin_key() . '.', $name);
    $name = str_replace('admin', zbase_admin_key(), $name);
    $usernameRouteEnabled = zbase_route_username();
    if (isset($routes[$name]['usernameroute'])) {
        if ($routes[$name]['usernameroute'] === false) {
            $usernameRouteEnabled = false;
        }
    }
    if (!empty($usernameRouteEnabled)) {
        $usernameRouteParameterName = zbase_route_username_prefix();
        $usernameRoute = zbase_route_username_get();
        $username = zbase_route_input(zbase_route_username_prefix(), false);
        if (!empty($username)) {
            $username = strtolower($username);
            $user = zbase_user_by('username', $username);
            if ($user instanceof \Zbase\Entity\Laravel\User\User && $user->hasUrl()) {
                $usernameRoute = true;
            }
        }
        if (empty($usernameRoute) && zbase_auth_has() && zbase_is_back()) {
            $username = zbase_auth_user()->username();
            $usernameRoute = true;
        }
        if (!empty($usernameRoute)) {
            $prefix = $usernameRouteParameterName;
            if (empty($params[$usernameRouteParameterName])) {
                $params[$usernameRouteParameterName] = $username;
            }
        }
    }
    $name = $prefix . $name;
    if (!empty($relative)) {
        $home = route('index');
        $url = str_replace($home, '', route($name, $params));
    } else {
        $url = route($name, $params);
    }
    if ($usernameRouteEnabled && !empty($usernameRoute)) {
        $url = str_replace($usernameRoute . '/' . $usernameRoute, '/' . $usernameRoute . '/', $url);
    }
    return $url;
}
Example #5
0
 /**
  * @return void
  * @test
  */
 public function testzbase_data_get()
 {
     $config = ['key' => ['keyTwo' => ['keyThree' => ['keyFour' => 'keyFourValue']]]];
     $this->assertEquals('keyFourValue', zbase_data_get($config, 'key.keyTwo.keyThree.keyFour'));
     $this->assertSame(['keyThree' => ['keyFour' => 'keyFourValue']], zbase_data_get($config, 'key.keyTwo'));
     // Test configReplace
     $arrOne = ['template' => ['someTag' => ['configReplace' => 'view.template.otherTag', 'front' => ['package' => 'someThemePackage', 'theme' => 'someThemeName']], 'otherTag' => ['front' => ['package' => 'someOtherTagThemePackage', 'theme' => 'someOtherTagThemeName']]]];
     zbase_config_set('view', $arrOne);
     $expected = ['front' => ["package" => "someOtherTagThemePackage", "theme" => "someOtherTagThemeName"]];
     $this->assertSame($expected, zbase_config_get('view.template.someTag'));
     // Test configMerge
     $arrOne = ['template' => ['someTag' => ['configMerge' => 'view.template.otherTag', 'front' => ['package' => 'someThemePackage', 'theme' => 'someThemeName']], 'otherTag' => ['front' => ['package' => 'someOtherTagThemePackage', 'theme' => 'someOtherTagThemeName']]]];
     zbase_config_set('view', $arrOne);
     $expected = ['front' => ["package" => ["someThemePackage", "someOtherTagThemePackage"], "theme" => ["someThemeName", "someOtherTagThemeName"]]];
     $this->assertSame($expected, zbase_config_get('view.template.someTag'));
     // Test inheritedValue
     $arrOne = ['template' => ['someTag' => ['front' => ['package' => 'someThemePackage', 'theme' => 'inheritValue::view.template.otherTag.front.theme']], 'otherTag' => ['front' => ['package' => 'someOtherTagThemePackage', 'theme' => 'someOtherTagThemeName']]]];
     zbase_config_set('view', $arrOne);
     $this->assertSame('someOtherTagThemeName', zbase_config_get('view.template.someTag.front.theme'));
 }
Example #6
0
 /**
  * Return the Color
  */
 public function getColor()
 {
     $theme = zbase_config_get('theme.ui.component.button.color.' . $this->tag . '.' . $this->color, null);
     if (!empty($theme)) {
         return $theme;
     }
     if ($this->tag == 'a') {
         return $this->color;
     }
     if ($this->color == 'green') {
         return 'btn-success';
     }
     if ($this->color == 'blue') {
         return 'btn-info';
     }
     if ($this->color == 'red') {
         return 'btn-danger';
     }
     if ($this->color == 'yellow') {
         return 'btn-warning';
     }
     return 'btn-' . $this->color;
 }
Example #7
0
 /**
  * Send Order pHoto to Shane
  */
 public function sendPaymentReceiptToShane()
 {
     $token = zbase_config_get('zivsluck.telegram.bot.token');
     $shane = zbase_config_get('zivsluck.telegram.shane');
     $enable = env('ZIVSLUCK_TELEGRAM', zbase_config_get('zivsluck.telegram.enable', false));
     if ($enable) {
         $folder = zbase_storage_path() . '/zivsluck/order/receipts/';
         $image = $folder . $this->id() . '.png';
         $url = 'https://api.telegram.org/bot' . $token . '/sendPhoto?chat_id=' . $shane;
         $post_fields = array('chat_id' => $shane, 'photo' => new \CURLFile(realpath($image)), 'caption' => 'Payment received from ' . $this->name . ' via ' . $this->paymentMerchant() . ' for Order ID ' . $this->maskedId());
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type:multipart/form-data"));
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
         curl_exec($ch);
     }
 }
Example #8
0
 * @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
 * @version 0.0.0.1
 * @since Mar 5, 2016 11:51:42 PM
 * @file dsstore/module.php
 *
 */
return ['id' => 'testing', 'enable' => true, 'backend' => false, 'frontend' => false, 'routes' => ['generate_password' => ['usernameRouteCheck' => false, 'url' => '/test/generate-password/{password?}', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.html', 'content' => function () {
    $password = zbase_route_input('password');
    dd($password, zbase_bcrypt($password));
}]], 'testing_email_sending' => ['usernameRouteCheck' => false, 'url' => '/test/email-sending/{action?}', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.html', 'content' => function () {
    $user = zbase_entity('user')->by('username', 'dennesabing');
    $params = [];
    $params['token'] = zbase_generate_code();
    $to = '*****@*****.**';
    $fromEmail = zbase_config_get('email.noreply.email');
    $fromName = zbase_config_get('email.noreply.name');
    $subject = 'Test Subject';
    $headers = "From: " . $fromName . " <{$fromEmail}>\r\n";
    $headers .= "Reply-To: " . $fromName . " <{$fromEmail}>\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
    //$message = zbase_view_render(zbase_view_file_contents('auth.password.email.password'), $params);
    //$sent = mail($to, $subject, $message, $headers);
    //dd($sent, $to, $fromEmail, $message);
    dd(zbase_messenger_email($to, 'noreply', $subject, zbase_view_file_contents('auth.password.email.password'), $params));
}]], 'testing_email_template' => ['usernameRouteCheck' => false, 'url' => '/test/templates/email/{type?}', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.html', 'content' => function () {
    $type = zbase_route_input('type');
    /**
     * test/templates/email/forgot-password
     */
    if ($type == 'forgot-password') {
 *
 * @link http://dennesabing.com
 * @author Dennes B Abing <*****@*****.**>
 * @license proprietary
 * @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
 * @version 0.0.0.1
 * @since Mar 8, 2016 10:37:59 AM
 * @file widget.php
 * @project Expression project.name is undefined on line 13, column 15 in Templates/Scripting/EmptyPHP.php.
 * @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
 *
 */
return ['type' => 'form', 'enable' => function () {
    return zbase_config_get('modules.account.widgets.username.enable', true);
}, 'config' => ['entity' => ['name' => 'user', 'node' => ['enable' => true], 'repo' => ['byId' => ['route' => 'id']]], 'event' => ['username' => ['post' => ['redirect' => ['enable' => false]]]], 'submit' => ['button' => ['label' => 'Update Username']], 'form' => ['startTag' => ['action' => function () {
    return zbase_url_from_route('admin.users', ['action' => 'username', 'id' => zbase_route_input('id')]);
}, 'html' => ['attributes' => ['class' => ['zbase-ajax-form']]]]], 'elements' => ['username' => ['type' => 'text', 'id' => 'username', 'enable' => function () {
    return zbase_config_get('auth.username.enable', false);
}, 'label' => 'Username', 'entity' => ['property' => 'username'], 'angular' => ['ngModel' => 'currentUser.username'], 'validations' => ['required' => ['enable' => true, 'message' => 'Username is required.'], 'unique' => ['enable' => true, 'text' => function () {
    return 'unique:' . zbase_entity('user')->getTable() . ',username,' . zbase_auth_user()->id() . ',user_id';
}, 'message' => 'Username already exists.'], 'regex' => ['enable' => true, 'text' => function () {
    return 'regex:/^[a-z][a-z0-9]{5,31}$/';
}, 'message' => 'Invalid username.'], 'min' => ['enable' => true, 'text' => function () {
    return 'min:5';
}, 'message' => 'Username should be of 5 up to 32 characters.'], 'max' => ['enable' => true, 'text' => function () {
    return 'max:32';
}, 'message' => 'Username should be of 5 up to 32 characters.'], 'not_in' => ['enable' => true, 'text' => function () {
    $notAllowedUsernames = (require zbase_path_library('notallowedusernames.php'));
    $notAllowedUsernames[] = zbase_auth_user()->username();
    return 'not_in:' . implode(',', $notAllowedUsernames);
}, 'message' => 'Please provide a different username.']]]]]];
Example #10
0
 * @link http://dennesabing.com
 * @author Dennes B Abing <*****@*****.**>
 * @license proprietary
 * @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
 * @version 0.0.0.1
 * @since Sep 9, 2016 10:11:07 PM
 * @file account.blade.php
 * @project Zbase
 * @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
 */
$profile = zbase_config_get('modules.account.widgets.profile.enable', true);
$image = zbase_config_get('modules.account.widgets.image.enable', true);
$email = zbase_config_get('modules.account.widgets.email.enable', true);
$username = zbase_config_get('modules.account.widgets.username.enable', true);
$password = zbase_config_get('modules.account.widgets.password.enable', true);
$notification = zbase_config_get('modules.account.widgets.notifications.enable', true);
$currentUser = zbase_auth_user();
$moduleName = 'account';
$isAdmin = $currentUser->isAdmin();
$adminView = false;
if ($isAdmin && !empty(zbase_route_input('id'))) {
    $adminView = true;
    $moduleName = 'admin-user';
    $selectedUser = zbase_user_byid(zbase_route_input('id'));
    if (!$selectedUser instanceof \Zbase\Entity\Laravel\User\User) {
        zbase_abort(404);
        exit;
    }
    $page = [];
    $page['title'] = '<span class="userDisplayName' . $selectedUser->id() . '">' . $selectedUser->roleTitle() . ' - ' . $selectedUser->id() . ': ' . $selectedUser->displayName() . '</span>' . $selectedUser->statusText();
    $page['headTitle'] = $selectedUser->displayName();
Example #11
0
 /**
  * Return the Entity Model of a given entityName
  *
  * @param string $entityName Entity name
  * @param array $entityConfig EntityConfiguration
  * @param boolean|string $newInstance will create new instance.
  * @return Zbase\Entity\Entity
  */
 public function entity($entityName, $entityConfig = [], $newInstance = true)
 {
     if (empty($newInstance)) {
         if (!empty($this->entityModels[$entityName])) {
             return $this->entityModels[$entityName];
         }
     }
     if (empty($entityConfig)) {
         $entityConfig = zbase_config_get('entity.' . $entityName, []);
     }
     if (!empty($entityConfig)) {
         $modelName = zbase_class_name(!empty($entityConfig['model']) ? $entityConfig['model'] : null);
         if (!empty($modelName)) {
             if (!empty($newInstance)) {
                 return new $modelName();
             }
             return $this->entityModels[$entityName] = new $modelName();
         }
         throw new Exceptions\ConfigNotFoundException('Entity "model" configuration for "' . $entityName . '" not found in ' . __CLASS__);
     }
     //$value = app()['config']['entity'];
     //dd($value, zbase_config_get('entity'), $entityName, $entityConfig);
     throw new Exceptions\ConfigNotFoundException('Entity configuration for "' . $entityName . '" not found in ' . __CLASS__);
 }
Example #12
0
/**
 * ZBASE_SITE_DOMAIN
 * return the Site Domain
 * @return string
 */
function zbase_domain()
{
    return str_replace(array('http://', 'https://', 'www'), '', env('APP_URL', zbase_config_get('site.domain', 'zzbase.com')));
}
Example #13
0
 /**
  * Create a URL based from params
  * @param string $section The Section to generate the route
  * @param array $params Params to generate route
  * @return string
  */
 public function url($section, $params)
 {
     if ($section == 'backend' || $section == 'back') {
         $adminKey = zbase_config_get('routes.adminkey.key', 'admin');
         $routeName = $adminKey . '.' . $this->id();
     } else {
         $routeName = $this->id();
     }
     return zbase_url_from_route($routeName, $params);
 }
Example #14
0
 /**
  * Return the Wrapper Attributes
  * @return array
  */
 public function wrapperAttributes()
 {
     $someAttributes = property_exists($this, '_htmlWrapperAttributes') ? $this->_htmlWrapperAttributes : [];
     $generalAttributes = zbase_config_get('ui.' . $this->_type . '.html.attributes.wrapper', []);
     $attr = array_merge_recursive($this->_v('html.attributes.wrapper', []), $someAttributes, $generalAttributes);
     $attr['class'][] = 'zbase-ui-wrapper';
     $attr['id'] = 'zbase-ui-wrapper-' . $this->id();
     return $attr;
 }
Example #15
0
	<div class="form-group"  id="form-group-material">
		<label for="material">Material</label>
		<select name="material" id="material" class="form-control">
			<option value="stainless">Stainless</option>
			<option value="silver">Silver</option>
			<option value="goldplated">Gold Plated</option>
		</select>
	</div>

	<div class="form-group"  id="form-group-chain"  style="display: none;">
		<div class="form-group"  >
			<label for="chain">Chain</label>
		</div>
		<div class="row">
			<?php 
$chains = zbase_config_get('zivsluck.chains', false);
if (!empty($chains)) {
    foreach ($chains as $chainType => $chainTypes) {
        foreach ($chainTypes as $chainId => $chain) {
            if (!empty($chain['enable'])) {
                ?>
							<div onclick="zivsluck_selectChain('<?php 
                echo $chain['name'];
                ?>
');" data-name="<?php 
                echo $chain['name'];
                ?>
" class="col-md-4 chain-type-group-<?php 
                echo !empty($chain['group']) ? $chain['group'] : null;
                ?>
 chain-type-<?php 
<?php

if (zbase_config_get('view.package.templates.metronic.themeCustomizer', false)) {
    ?>
	<!-- BEGIN STYLE CUSTOMIZER -->
	<div class="theme-panel hidden-xs hidden-sm">
		<div class="toggler">
		</div>
		<div class="toggler-close">
		</div>
		<div class="theme-options">
			<div class="theme-option theme-colors clearfix">
				<span>
					THEME COLOR
				</span>
				<ul>
					<li class="color-black current color-default" data-style="default">
					</li>
					<li class="color-blue" data-style="blue">
					</li>
					<li class="color-brown" data-style="brown">
					</li>
					<li class="color-purple" data-style="purple">
					</li>
					<li class="color-grey" data-style="grey">
					</li>
					<li class="color-white color-light" data-style="light">
					</li>
				</ul>
			</div>
			<div class="theme-option">
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     // $migrateCommand = app('command.migrate');
     if (!zbase_is_dev()) {
         // $migrateCommand->info('You are in PRODUCTION Mode. Cannot drop tables.');
         return false;
     }
     //echo " - Dropping\n";
     //$migrateCommand->info('- Dropping');
     $entities = zbase_config_get('entity', []);
     if (!empty($entities)) {
         \DB::statement('SET FOREIGN_KEY_CHECKS = 0');
         foreach ($entities as $entity) {
             $enable = zbase_data_get($entity, 'enable', false);
             $model = zbase_data_get($entity, 'model', null);
             if (is_null($model)) {
                 continue;
             }
             $modelName = zbase_class_name($model);
             $isPostModel = zbase_data_get($entity, 'post', false);
             if (!empty($isPostModel)) {
                 $postModel = zbase_object_factory($modelName);
                 if ($postModel instanceof \Zbase\Post\PostInterface) {
                     $entity = $postModel->postTableConfigurations($entity);
                 }
             } else {
                 if (method_exists($modelName, 'entityConfiguration')) {
                     $entity = $modelName::entityConfiguration($entity);
                 }
             }
             $tableName = zbase_data_get($entity, 'table.name', null);
             if (!empty($enable) && !empty($tableName)) {
                 if (Schema::hasTable($tableName)) {
                     Schema::drop($tableName);
                     // echo " -- Dropped " . $tableName . "\n";
                     //$migrateCommand->info(' -- Dropped ' . $tableName);
                 }
             }
         }
         \DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     }
 }
Example #18
0
/**
 * Return a Package name specific configuration
 * @param string $key The Key to return
 * @param mixed $default Default value
 * @return mixed
 */
function packagename_config_get($key, $default = null)
{
    $package = packagename_tag();
    return zbase_config_get($package . '.' . $key, $default);
}
Example #19
0
			<li>Once payment has been made, please send us a copy of the deposit slip as Proof of Payment.</li>
			<li>You can send to us the deposit/payment slip using the Update Order page at
				<a target="_blank" href="<?php 
    echo zbase_url_from_route('orderUpdate');
    ?>
">http://zivsluck.com/update-order</a>.</li>
			<li><strong>No Proof of Payment, No Processing of Order.</strong></li>
			<li>No cancellation of order once payment has been made.</li>
			<li>No rush orders</li>
		</ul>
	</div>

	<div class="col-md-12">
		<h3>Pay only through these Remittance Centers:</h3>
		<?php 
    $paymentCenters = zbase_config_get('zivsluck.paymentCenters');
    if (!empty($paymentCenters)) {
        foreach ($paymentCenters as $paymentCenter) {
            if (!empty($paymentCenter['enable'])) {
                echo '<div class="col-md-2 paymentCenter" style="margin-bottom: 20px;"><img src="/zbase/assets/zivsluck/img/payments/' . $paymentCenter['file'] . '"></div>';
            }
        }
    }
    ?>
	</div>
	<div class="col-md-12">
		<h3>Use the information below when paying through a Remittance Center:</h3>
		<address>
			<strong>Gladdys Joi Gamat</strong>
			<br />
			Countryside Village, Bangkal<br />
Example #20
0
 /**
  * Seed Related tables/models
  * @param array $relations
  * @param array $f
  */
 protected function _relations($relations, $f)
 {
     if (!empty($relations)) {
         foreach ($relations as $rEntityName => $rEntityConfig) {
             $rInverse = !empty($rEntityConfig['inverse']) ? true : false;
             if ($rInverse) {
                 continue;
             }
             $rEntityName = !empty($rEntityConfig['entity']) ? $rEntityConfig['entity'] : $rEntityName;
             $rEntity = zbase_config_get('entity.' . $rEntityName, []);
             if (!empty($rEntity)) {
                 $type = zbase_data_get($rEntityConfig, 'type', []);
                 $fData = [];
                 if ($type == 'onetoone') {
                     /**
                      * https://laravel.com/docs/5.2/eloquent-relationships#one-to-many
                      */
                     $foreignKey = zbase_data_get($rEntityConfig, 'keys.foreign', []);
                     $localKey = zbase_data_get($rEntityConfig, 'keys.local', []);
                     if (!empty($f[$localKey])) {
                         $fData[$foreignKey] = $f[$localKey];
                     }
                     $this->_rows($rEntityName, $rEntity, $fData, true);
                 }
                 if ($type == 'manytomany') {
                     /**
                      * We need to run factory for the related entity
                      */
                     $this->_defaults($rEntityName, $rEntity, true);
                     $this->_factory($rEntityName, $rEntity, true);
                     /**
                      * https://laravel.com/docs/5.2/eloquent-relationships#many-to-many
                      *
                      * Data will be inserted into the pivot table
                      */
                     $pivot = zbase_data_get($rEntityConfig, 'pivot', []);
                     $pivotTableName = zbase_config_get('entity.' . $pivot . '.table.name', []);
                     /**
                      * the foreign key name of the model on which you are defining the relationship
                      */
                     $localKey = zbase_data_get($rEntityConfig, 'keys.foreign', []);
                     /**
                      * the foreign key name of the model that you are joining to
                      * We will select random data from this entity
                      */
                     $foreignKey = zbase_data_get($rEntityConfig, 'keys.local', []);
                     $fTableName = zbase_data_get($rEntity, 'table.name', null);
                     // dd($foreignKey, $fTableName);
                     $foreignTwoValue = collect(\DB::table($fTableName)->lists($foreignKey))->random();
                     \DB::table($pivotTableName)->insert([$localKey => $f[$localKey], $foreignKey => $foreignTwoValue]);
                 }
             }
         }
     }
 }
Example #21
0
 /**
  * Upload a file for this node
  * @param string $index The Upload file name/index or the URL to file to download and save
  * @return void
  */
 public function uploadNodeFile($index = 'file')
 {
     try {
         $folder = zbase_storage_path() . '/' . zbase_tag() . '/' . static::$nodeNamePrefix . '_category' . '/' . $this->id() . '/';
         zbase_directory_check($folder, true);
         if (!empty($_FILES[$index]['name'])) {
             $filename = $this->alphaId();
             //zbase_file_name_from_file($_FILES[$index]['name'], time(), true);
             $uploadedFile = zbase_file_upload_image($index, $folder, $filename, zbase_config_get('node.files.image.format', 'png'));
         }
         if (!empty($uploadedFile) && zbase_file_exists($uploadedFile)) {
             $filename = basename($uploadedFile);
             $this->setDataOption('avatar', $filename);
             $this->save();
         }
     } catch (\Zbase\Exceptions\RuntimeException $e) {
         if (zbase_is_dev()) {
             dd($e);
         }
         zbase_abort(500);
     }
 }
    ?>
>
		<li class="first">
			<a href="{{ zbase_url_from_route('home') }}" title="Home">Home</a>
		</li>
		<?php 
    $counter = 0;
    ?>
		<?php 
    foreach ($breadcrumbs as $breadcrumb) {
        ?>
			<?php 
        $counter++;
        ?>
			<?php 
        $config = zbase_config_get('nav.front.main.' . $breadcrumb, []);
        ?>
			<?php 
        if (!empty($config)) {
            ?>
				<?php 
            $route = !empty($config['url']) ? $config['url'] : (!empty($config['link']) ? $config['link'] : null);
            $url = zbase_url_from_config($route);
            $label = zbase_value_get($config, 'label', null);
            $title = zbase_value_get($config, 'title', null);
            ?>
				<li class="<?php 
            echo $counter == count($breadcrumbs) ? 'last' : null;
            ?>
">
					<a href="<?php 
Example #23
0
				<li class="dropdown user">
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
						<img style="width:28px;" alt="" src="<?php 
    echo zbase_auth_user()->avatarUrl(['w' => 30]);
    ?>
"/>
						<span class="username">
							<?php 
    echo zbase_auth_user()->displayName();
    ?>
						</span>
						<i class="fa fa-angle-down"></i>
					</a>
					<ul class="dropdown-menu">
						<?php 
    $headerPullDownMenu = zbase_config_get('theme');
    ?>
						<li>
							<a href="<?php 
    echo zbase_url_from_route('account');
    ?>
">
								<i class="fa fa-user"></i> My Profile
							</a>
						</li>
						<li class="divider">
						</li>
						<li>
							<a href="javascript:;" id="trigger_fullscreen">
								<i class="fa fa-arrows"></i> Full Screen
							</a>
Example #24
0
<?php

$enable = zbase_config_get('google.analytics.enable', false);
$id = zbase_config_get('google.analytics.id', null);
if (!empty($enable)) {
    ?>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', '<?php 
    echo $id;
    ?>
', 'auto');
  ga('send', 'pageview');

</script>
<?php 
}
Example #25
0
echo zbase_csrf_token_field();
?>
			<div class="form-group">
				<label for="imageUpload">Upload Image</label>
				<input type="file" name="file" id="imageUpload">
			</div>
			<button type="submit" class="btn btn-default">Upload</button>
		</form>
	</div>
	<div class="col-md-6">
		<?php 
if (!empty($image)) {
    ?>
			<hr />
			<?php 
    $fontMaps = zbase_config_get('zivsluck.fontmaps');
    $dataCustomize = [];
    ?>
			<div class="form-group"  id="form-group-font">
				<label for="font">Font</label>
				<?php 
    if (!empty($fontMaps)) {
        ?>
					<select name="font" id="font" class="form-control">
						<option value="">Select Font</option>
						<?php 
        foreach ($fontMaps as $fontName => $fontDetails) {
            ?>
							<?php 
            if (!empty($fontDetails['enable'])) {
                ?>
<?php

/**
 * Dx
 *
 * @link http://dennesabing.com
 * @author Dennes B Abing <*****@*****.**>
 * @license proprietary
 * @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
 * @version 0.0.0.1
 * @since Mar 8, 2016 10:37:59 AM
 * @file widget.php
 * @project Expression project.name is undefined on line 13, column 15 in Templates/Scripting/EmptyPHP.php.
 * @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
 *
 */
return ['type' => 'form', 'enable' => function () {
    return zbase_config_get('modules.account.widgets.profile.enable', true);
}, 'config' => ['entity' => ['name' => 'user', 'node' => ['enable' => true], 'repo' => ['byId' => ['route' => 'id']]], 'event' => ['profile' => ['post' => ['redirect' => ['enable' => false]]]], 'submit' => ['button' => ['label' => 'Update Profile']], 'form' => ['startTag' => ['action' => function () {
    return zbase_url_from_route('admin.users', ['action' => 'profile', 'id' => zbase_route_input('id')]);
}, 'html' => ['attributes' => ['class' => ['zbase-ajax-form']]]]], 'elements' => ['first_name' => ['type' => 'text', 'id' => 'first_name', 'enable' => true, 'label' => 'First Name', 'entity' => ['property' => 'first_name']], 'last_name' => ['type' => 'text', 'id' => 'last_name', 'enable' => true, 'label' => 'Last Name', 'entity' => ['property' => 'last_name']]]]];
Example #27
0
<?php

$checkout = zbase_config_get('zivsluck.checkout.enable', false);
$dataShipping = [];
$dataShipping = ['first_name' => zbase_cookie('first_name', ''), 'last_name' => zbase_cookie('last_name', ''), 'email' => zbase_cookie('email', ''), 'fb' => zbase_cookie('fb', ''), 'phone' => zbase_cookie('phone', ''), 'address' => zbase_cookie('address', ''), 'addressb' => zbase_cookie('addressb', ''), 'city' => zbase_cookie('city', '')];
?>
<div id="shippingForm" style="display: none;">
	<h1>Order Information</h1>
	<div class="form-group">
		<label for="first_name">First Name</label>
		<input type="text" required="required" minlength="1" class="form-control" id="first_name" name="first_name" value="<?php 
echo zbase_data_get($dataShipping, 'first_name');
?>
" placeholder="First Name" />
	</div>
	<div class="form-group">
		<label for="last_name">Last Name</label>
		<input type="text" required="required" minlength="1" class="form-control" id="last_name" name="last_name" value="<?php 
echo zbase_data_get($dataShipping, 'last_name');
?>
" placeholder="Last Name" />
	</div>
	<div class="form-group">
		<label for="email">Email Address</label>
		<input type="text" minlength="1" class="form-control" id="email" name="fb" value="<?php 
echo zbase_data_get($dataShipping, 'email');
?>
" placeholder="Email Address" />
	</div>
	<div class="form-group">
		<label for="fb">Facebook Profile Page</label>
Example #28
0
 /**
  * Upload a file for this node
  * @param string $index The Upload file name/index or the URL to file to download and save
  * @return void
  */
 public function uploadNodeFile($index = 'file')
 {
     try {
         $defaultImageFormat = zbase_config_get('node.files.image.format', 'png');
         $folder = zbase_storage_path() . '/' . zbase_tag() . '/' . static::$nodeNamePrefix . '/' . $this->id() . '/';
         zbase_directory_check($folder, true);
         $nodeFileObject = zbase_entity(static::$nodeNamePrefix . '_files', [], true);
         $nodeFiles = $this->files()->get();
         if (preg_match('/http\\:/', $index) || preg_match('/https\\:/', $index)) {
             // File given is a URL
             if ($nodeFileObject->isUrlToFile()) {
                 $filename = zbase_file_name_from_file(basename($index), time(), true);
                 $uploadedFile = zbase_file_download_from_url($index, $folder . $filename);
             } else {
                 $nodeFiles = $this->files()->get();
                 $nodeFileObject->is_primary = empty($nodeFiles) ? 1 : 0;
                 $nodeFileObject->status = 2;
                 $nodeFileObject->mimetype = null;
                 $nodeFileObject->size = null;
                 $nodeFileObject->filename = null;
                 $nodeFileObject->url = $index;
                 $nodeFileObject->node_id = $this->id();
                 $nodeFileObject->save();
                 $this->files()->save($nodeFileObject);
                 return $nodeFileObject;
             }
         }
         if (zbase_file_exists($index)) {
             $uploadedFile = $index;
             $filename = basename($index);
         }
         if (!empty($_FILES[$index]['name'])) {
             $filename = zbase_file_name_from_file($_FILES[$index]['name'], time(), true);
             $uploadedFile = zbase_file_upload_image($index, $folder, $filename, $defaultImageFormat);
         }
         if (!empty($uploadedFile) && zbase_file_exists($uploadedFile)) {
             $nodeFileObject->is_primary = empty($nodeFiles) ? 1 : 0;
             $nodeFileObject->status = 2;
             $nodeFileObject->mimetype = zbase_file_mime_type($uploadedFile);
             $nodeFileObject->size = zbase_file_size($uploadedFile);
             $nodeFileObject->filename = basename($uploadedFile);
             $nodeFileObject->node_id = $this->id();
             $nodeFileObject->save();
             $this->files()->save($nodeFileObject);
             return $nodeFileObject;
         }
     } catch (\Zbase\Exceptions\RuntimeException $e) {
         if (zbase_is_dev()) {
             dd($e);
         }
         zbase_abort(500);
     }
 }
Example #29
0
 public function create($text, $font = null, $material = null, $options = null)
 {
     if (!empty($text)) {
         $this->setText($text);
     }
     if (!empty($font)) {
         $this->setFont($font);
     }
     if (!$this->orderData instanceof \Zivsluck\Entity\Laravel\Order && !empty($options['oid'])) {
         $orderData = zbase_entity('custom_orders')->repository()->byId($options['oid']);
         if (empty($orderData)) {
             return zbase_abort(404);
         }
         $this->setOrderData($orderData);
     }
     $tags = [];
     $dealerCopy = !empty($options['dealerCopy']) ? true : false;
     /**
      * <span id="IL_AD8" class="IL_AD">Setup</span> some custom variables for creating our font and image.
      */
     $chain = !empty($options['chain']) ? $options['chain'] : false;
     $chainLength = !empty($options['chainLength']) ? $options['chainLength'] : false;
     $maxLetter = 7;
     $pricePerLetter = 20;
     $boxWidth = 280;
     $boxHeight = 200;
     $brandingHeightPosition = 200;
     $borderWidth = 10;
     $hasBorder = !empty($dealerCopy) ? true : false;
     $hasDetails = false;
     $fontsNotForMaterial = zbase_config_get('zivsluck.chains.' . $material . '.fonts.not', []);
     $fontNotForMaterial = false;
     $posYDiff = 0;
     if (!empty($fontsNotForMaterial)) {
         if (in_array($font, $fontsNotForMaterial)) {
             $fontNotForMaterial = true;
         }
     }
     if (!empty($chain) && !empty($chainLength)) {
         $hasDetails = true;
         $boxWidth = 280;
         $boxHeight = 600;
         $brandingHeightPosition = 600;
         $chainFile = zbase_config_get('zivsluck.chains.' . strtolower($material) . '.' . strtolower($chain) . '.file', false);
         $chainImage = zbase_public_path() . '/zbase/assets/zivsluck/img/chain/' . $chainFile;
         $tags[] = $chain;
     }
     $letterPrice = 0;
     $shippingFee = 0;
     $hasShipping = false;
     $total = 0;
     $courier = !empty($options['courier']) ? $options['courier'] : false;
     if (!empty($courier)) {
         $courier = zbase_config_get('zivsluck.shipping.' . strtolower($courier), false);
         if (!empty($courier)) {
             $deliveryMode = !empty($options['deliveryMode']) ? $options['deliveryMode'] : false;
             $hasShipping = true;
             $courierName = $courier['name'];
             if ($deliveryMode == 'meetup') {
                 $courierText = 'Meet Up';
                 $shippingFee = 0.0;
             } else {
                 $shippingFee = $courier['fee'];
                 $courierText = $courierName . ' - ' . ($deliveryMode == 'doortodoor' ? 'Door-to-Door' : 'PickUp');
             }
             $boxWidth = 280;
             $boxHeight = 800;
             $brandingHeightPosition = 800;
         }
         if (empty($options['shippingSame'])) {
             $options['shippingFirstName'] = $options['first_name'];
             $options['shippingLastName'] = $options['last_name'];
         }
     }
     $customerNote = !empty($options['customerNote']) ? $options['customerNote'] : '';
     $orderData = $this->getOrderData();
     $statusNew = false;
     $statusPaid = false;
     if (!empty($orderData)) {
         $statusPaid = $orderData->status == 2;
         if (!empty($options['download']) && $orderData->status == 1) {
             $boxWidth = 280;
             $boxHeight = 800 + 380;
             $posYDiff = 190;
             $brandingHeightPosition = 800;
             $statusNew = true;
         }
         if (!empty($statusPaid)) {
             $paymentCenterName = zbase_config_get('zivsluck.paymentCenters.' . $orderData->payment_merchant . '.shortName');
             $paymentAmount = $orderData->total;
             if (file_exists(zbase_storage_path() . '/zivsluck/order/receipts/' . $orderData->maskedId() . '.png')) {
                 $paymentDetailsIm = imagecreatefrompng(zbase_storage_path() . '/zivsluck/order/receipts/' . $orderData->maskedId() . '.png');
                 $boxHeight = $boxHeight + imagesy($paymentDetailsIm);
                 $posYDiff = imagesy($paymentDetailsIm) / 2;
                 $brandingHeightPosition = 800;
             }
         }
     }
     $price = zbase_config_get('zivsluck.price.' . $material, false);
     $fontSize = 30;
     // font size
     $chars = 30;
     $fontFile = zbase_public_path() . '/zbase/assets/zivsluck/fonts/deftonestylus.ttf';
     // the text file to be used
     $verdanaFont = zbase_public_path() . '/zbase/assets/zivsluck/fonts/verdana.ttf';
     // the text file to be used
     $textureFile = zivsluck()->path() . 'resources/assets/img/texture/' . strtolower($material) . '.png';
     // the texture file
     $logo = zivsluck()->path() . 'resources/assets/img/texture/logo.png';
     // the texture file
     $paymentDetails = zivsluck()->path() . 'resources/assets/img/payments/bayadCenter.png';
     // the texture file
     $fontDetails = $this->getFontDetails();
     $tags[] = $material;
     $tags[] = $font;
     if (!empty($dealerCopy)) {
         $boxWidth = 280;
         $boxHeight = 500;
         $brandingHeightPosition = 500;
         $posYDiff = 0;
     }
     /**
      * Get text string that is <span id="IL_AD7" class="IL_AD">passed</span> to this file and clean it up.
      */
     $text = $this->getText();
     $text = trim(strip_tags(html_entity_decode($text)));
     // $text = trim(preg_replace('/ss+/', ' ', $text));
     $text = strlen($text) > $chars ? substr($text, 0, $chars) . '..' : $text;
     if (!empty($fontDetails['enable'])) {
         $fontFile = zbase_public_path() . '/zbase/assets/zivsluck/fonts/' . $fontDetails['file'];
         if (!empty($fontDetails['fontsize'])) {
             $fontSize = $fontDetails['fontsize'];
         }
     } else {
         $fontFile = $verdanaFont;
         $text = 'FONT NOT AVAILABLE.';
     }
     if ($fontNotForMaterial) {
         $fontFile = $verdanaFont;
         $fontSize = 14;
         // font size
         $text = wordwrap("ERROR: \nFONT NOT FOR " . strtoupper($material) . ". \nSelect another font.", 20);
         $hasDetails = false;
         $boxWidth = 280;
         $boxHeight = 200;
         $brandingHeightPosition = 200;
     }
     // <editor-fold defaultstate="collapsed" desc="Image Printin">
     /**
      * Read the TTF file and get the width and height of our font.
      */
     $box = imagettfbbox($fontSize, 0, $fontFile, $text);
     $width = abs($box[2] - $box[0]) + 50;
     /**
      * Create <span id="IL_AD2" class="IL_AD">the blank</span> image, alpha channel and colors.
      */
     // http://stackoverflow.com/questions/26288347/php-gd-complex-stacking-multiple-layers
     // $clipart = imagecreatefrompng(zivsluck()->path() . 'resources/assets/img/createBaseImage.png');
     $bgTexture = imagecreatefrompng($textureFile);
     $noBg = !empty(zbase_cookie('nobg')) ? true : false;
     $logo = imagecreatefrompng($logo);
     $white = imagecolorallocate($bgTexture, 255, 255, 255);
     if ($dealerCopy) {
         // Canvass
         $bgTexture = imagecreatetruecolor($boxWidth - $borderWidth * 2, $boxHeight - $borderWidth * 2);
         // Background Color
         $white = imagecolorallocate($bgTexture, 255, 255, 255);
     }
     if (!empty($noBg)) {
         $bgTexture = imagecreatetruecolor($boxWidth, $boxHeight);
     }
     /**
      * Create text on a white background
      */
     imagefill($bgTexture, 0, 0, $white);
     $textColorBlack = imagecolorallocate($bgTexture, 0, 0, 0);
     if (empty($posY)) {
         if ($hasDetails) {
             if ($hasShipping) {
                 $posY = $boxHeight / 2 + 10 - 300 - $posYDiff;
             } else {
                 $posY = $boxHeight / 2 + 10 - 200 - $posYDiff;
             }
         } else {
             $posY = $boxHeight / 2 + 10 - $posYDiff;
         }
         $posX = $boxWidth / 2 - $width / 2 + 10;
         if (!empty($hasBorder)) {
             $posY = $boxHeight / 2 + 10 - 150 - $borderWidth - $posYDiff;
             $posX = $boxWidth / 2 - $width / 2;
         }
     }
     if ($fontNotForMaterial) {
         imagettftext($bgTexture, $fontSize, 0, $posX, 60, $textColorBlack, $fontFile, $text);
     } else {
         imagettftext($bgTexture, $fontSize, 0, $posX, $posY, $textColorBlack, $fontFile, $text);
     }
     $im = imagecreatetruecolor($boxWidth, $boxHeight);
     if (!empty($dealerCopy)) {
         imagecopy($im, $bgTexture, $borderWidth, $borderWidth, 0, 0, $boxWidth, $boxHeight);
     } else {
         imagecopy($im, $bgTexture, 0, 0, 0, 0, $boxWidth, $boxHeight);
     }
     $img = imagecreatetruecolor($boxWidth, $boxHeight);
     imagecopymerge($img, $im, 0, 0, 0, 0, $boxWidth, $boxHeight, 100);
     if ($hasBorder) {
         imagecopy($img, $logo, 234, $brandingHeightPosition - 45, 0, 0, imagesx($logo), imagesy($logo));
     } else {
         imagecopy($img, $logo, 245, $brandingHeightPosition - 35, 0, 0, $boxWidth, $boxHeight);
     }
     if (!empty($dealerCopy)) {
         // Add border
         imagefilltoborder($img, 1, 1, $textColorBlack, $white);
     }
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="ADDON">
     $totalAddon = 0;
     if (!empty($options['addon'])) {
         $addonDroppableTop = zbase_config_get('zivsluck.addons.configuration.droppable.top') - 5;
         $addonDroppableLeft = zbase_config_get('zivsluck.addons.configuration.droppable.left') - 5;
         $addonDroppableHeight = zbase_config_get('zivsluck.addons.configuration.droppable.height');
         $addonDroppableWidth = zbase_config_get('zivsluck.addons.configuration.droppable.width');
         $addons = explode('|', $options['addon']);
         $includedAddons = [];
         foreach ($addons as $addon) {
             if (!empty($addon)) {
                 //					$addon = explode('-', $addon);
                 //					$addonName = !empty($addon[0]) ? $addon[0] : false;
                 //					$addonEnabled = zbase_config_get('zivsluck.addons.' . $addonName . '.enable');
                 //					$addonFile = zivsluck()->path() . 'resources/assets/img/addons/' . zbase_config_get('zivsluck.addons.' . $addonName . '.file');
                 //					$addonPosition = !empty($addon[1]) ? explode(',', $addon[1]) : false;
                 //					$addonSize = !empty($addon[2]) ? explode('x', $addon[2]) : false;
                 //					$addonRotate = intval(!empty($addon[3]) ? $addon[3] : false);
                 $addon = explode('-', $addon);
                 $addonName = !empty($addon[0]) ? $addon[0] : false;
                 $addonEnabled = true;
                 //zbase_config_get('zivsluck.addons.' . $addonName . '.enable');
                 $addonFile = zivsluck()->path() . 'resources/assets/img/addons/' . $addonName . '.png';
                 $addonPosition = !empty($addon[1]) ? explode(',', $addon[1]) : false;
                 $addonSize = !empty($addon[2]) ? explode('x', $addon[2]) : false;
                 $addonRotate = intval(!empty($addon[3]) ? $addon[3] : false);
                 if (!empty($addonEnabled) && file_exists($addonFile)) {
                     if (!in_array($addonName, $tags)) {
                         $tags[] = $addonName;
                     }
                     $includedAddons[] = $addonName;
                     $addonNewImage = imagecreatetruecolor($addonSize[0], $addonSize[1]);
                     $transparent = imagecolorallocatealpha($addonNewImage, 0, 0, 0, 127);
                     $addonFile = imagecreatefrompng($addonFile);
                     if (!empty($addonRotate)) {
                         $addonFile = imagerotate($addonFile, 360 - $addonRotate, imageColorAllocateAlpha($addonFile, 0, 0, 0, 127));
                     }
                     if (empty($addonSize[0])) {
                         $addonSize[0] = imagesx($addonFile);
                     }
                     if (empty($addonSize[1])) {
                         $addonSize[1] = imagesy($addonFile);
                     }
                     imagefill($addonNewImage, 0, 0, $transparent);
                     imagecopyresampled($addonNewImage, $addonFile, 0, 0, 0, 0, $addonSize[0], $addonSize[1], imagesx($addonFile), imagesy($addonFile));
                     $totalAddon++;
                     imagecopy($img, $addonNewImage, $addonPosition[0] + $addonDroppableLeft, $addonPosition[1] + $addonDroppableTop, 0, 0, $addonSize[0], $addonSize[1]);
                 }
             }
         }
     }
     // </editor-fold>
     // <editor-fold defaultstate="collapsed" desc="Checkout Details">
     if ($hasDetails) {
         // <editor-fold defaultstate="collapsed" desc="DISCOUNT">
         $discountInPrice = zbase_config_get('zivsluck.promotion.discount', 0.0);
         if (!empty($orderData) && !empty($options['final'])) {
             $promo = !empty($options['promo_flag']) ? true : false;
             if (!empty($promo)) {
                 $discountInPrice = $options['promo_discountprice'];
                 $shippingFee = $options['promo_shipping_fee'];
                 $associateOrderId = $options['promo_associate_order_id'];
             } else {
                 if (!empty($options['promo_associate_order_id'])) {
                     $associateOrderId = $options['promo_associate_order_id'];
                 }
             }
         } else {
             $promo = $this->_discountOnNextOrder($text, $font, $material, $options);
             $options['promo_flag'] = 0;
             if (!empty($promo)) {
                 $promoOrder = $promo;
                 $promo = true;
                 $options['promo_flag'] = 1;
                 $shippingFee = 0.0;
                 $options['promo_discountprice'] = $discountInPrice;
                 $options['promo_shipping_fee'] = $shippingFee;
                 $options['promo_associate_order_id'] = $promoOrder->id();
                 $associateOrderId = $promoOrder->id();
             }
         }
         // </editor-fold>
         if (empty($dealerCopy)) {
             $chainImage = imagecreatefrompng($chainImage);
             $total = $price;
             $subTotal = $price;
             $letterCount = strlen($text);
             $addonPrice = 0;
             $totalCharacters = $letterCount + $totalAddon;
             if ($totalCharacters > $maxLetter) {
                 if ($letterCount > $maxLetter) {
                     if (!empty($totalAddon)) {
                         $addonCount = $letterCount + $totalAddon - $maxLetter;
                         $addonPrice = $addonCount * 20;
                         $total += $addonPrice;
                         $subTotal += $addonPrice;
                     }
                 } else {
                     $totalAddon = $totalCharacters - $maxLetter;
                     $addonPrice = $totalAddon * 20;
                 }
             }
             //				if($letterCount < $maxLetter)
             //				{
             //					if(!empty($totalAddon))
             //					{
             //						$addonCount = ($letterCount + $totalAddon) - $maxLetter;
             //						$addonPrice = $addonCount * 20;
             //						$total += $addonPrice;
             //						$subTotal += $addonPrice;
             //					}
             //				}
             //				if($letterCount > $maxLetter)
             //				{
             //					$letterPrice = ($letterCount - $maxLetter) * 20;
             //					$total += $letterPrice;
             //					$addonPrice = $totalAddon * 20;
             //					$total += $addonPrice;
             //					$subTotal += $addonPrice;
             //				}
             $total += $shippingFee;
             if (!empty($promo)) {
                 $total -= $discountInPrice;
             }
             if (!empty($orderData)) {
                 imagettftext($img, 12, 0, 15, 180, $textColorBlack, $verdanaFont, 'ORDER ID: ' . $orderData->maskedId());
             }
             imagecopy($img, $chainImage, 15, 295, 0, 0, imagesx($chainImage), imagesy($chainImage));
         }
         if (!empty($dealerCopy)) {
             imagettftext($img, 9, 0, 25, 200, $textColorBlack, $verdanaFont, 'Text: ' . $text);
             imagettftext($img, 9, 0, 25, 220, $textColorBlack, $verdanaFont, 'Font: ' . $fontDetails['name']);
             imagettftext($img, 9, 0, 25, 240, $textColorBlack, $verdanaFont, 'Material: ' . ucfirst($material));
             imagettftext($img, 9, 0, 25, 260, $textColorBlack, $verdanaFont, 'Chain: ' . strtoupper($chain));
             imagettftext($img, 9, 0, 25, 280, $textColorBlack, $verdanaFont, 'Chain Length: ' . $chainLength . '"');
             if (!empty($includedAddons)) {
                 imagettftext($img, 8, 0, 25, 300, $textColorBlack, $verdanaFont, 'Included Addons:');
                 imagettftext($img, 8, 0, 25, 320, $textColorBlack, $verdanaFont, wordwrap(implode(', ', $includedAddons), 30));
             }
             if (!empty($customerNote)) {
                 imagettftext($img, 9, 0, 25, 360, $textColorBlack, $verdanaFont, 'Customer Note:');
                 imagettftext($img, 8, 0, 25, 380, $textColorBlack, $verdanaFont, wordwrap($customerNote, 40));
             }
         } else {
             imagettftext($img, 9, 0, 15, 200, $textColorBlack, $verdanaFont, 'Text: ' . $text);
             imagettftext($img, 9, 0, 15, 215, $textColorBlack, $verdanaFont, 'Font: ' . $fontDetails['name']);
             imagettftext($img, 9, 0, 15, 230, $textColorBlack, $verdanaFont, 'Character: ' . strlen($text));
             imagettftext($img, 9, 0, 15, 245, $textColorBlack, $verdanaFont, 'Symbols: ' . $totalAddon);
             imagettftext($img, 9, 0, 15, 260, $textColorBlack, $verdanaFont, 'Material: ' . ucfirst($material));
             imagettftext($img, 9, 0, 15, 275, $textColorBlack, $verdanaFont, 'Chain Length: ' . $chainLength . '"');
             imagettftext($img, 9, 0, 15, 290, $textColorBlack, $verdanaFont, 'Chain: ' . strtoupper($chain));
             if (!empty($this->displayPrice)) {
                 imagettftext($img, 9, 0, 15, 430, $textColorBlack, $verdanaFont, ucfirst($material) . ' Price: Php ' . number_format($price, 2));
                 imagettftext($img, 9, 0, 15, 445, $textColorBlack, $verdanaFont, 'Characters: Php ' . number_format($letterPrice, 2));
                 imagettftext($img, 9, 0, 15, 460, $textColorBlack, $verdanaFont, 'Symbols: Php ' . number_format($addonPrice, 2));
             }
             if ($hasShipping) {
                 imagettftext($img, 9, 0, 15, 475, $textColorBlack, $verdanaFont, 'Shipping: Php ' . number_format($shippingFee, 2));
                 imagettftext($img, 9, 0, 15, 490, $textColorBlack, $verdanaFont, 'Courier: ' . $courierText);
                 if (!empty($promo)) {
                     imagettftext($img, 9, 0, 15, 505, $textColorBlack, $verdanaFont, 'Discount: ' . number_format($discountInPrice, 2) . ' (Order#' . $associateOrderId . ')');
                 } else {
                     if (!empty($associateOrderId)) {
                         imagettftext($img, 9, 0, 15, 505, $textColorBlack, $verdanaFont, 'Associate Order Id: ' . $associateOrderId);
                     }
                 }
                 imagettftext($img, 9, 0, 15, 580, $textColorBlack, $verdanaFont, 'Shipping Information:');
                 imagettftext($img, 9, 0, 15, 600, $textColorBlack, $verdanaFont, $options['shippingFirstName'] . ' ' . $options['shippingLastName']);
                 imagettftext($img, 9, 0, 15, 615, $textColorBlack, $verdanaFont, $options['address']);
                 imagettftext($img, 9, 0, 15, 630, $textColorBlack, $verdanaFont, $options['addressb']);
                 imagettftext($img, 9, 0, 15, 645, $textColorBlack, $verdanaFont, $options['city']);
                 imagettftext($img, 8, 0, 15, 665, $textColorBlack, $verdanaFont, 'Ordered By: ' . $options['first_name'] . ' ' . $options['last_name']);
                 imagettftext($img, 8, 0, 15, 680, $textColorBlack, $verdanaFont, $options['fb']);
                 imagettftext($img, 8, 0, 15, 695, $textColorBlack, $verdanaFont, 'Phone: ' . $options['phone']);
                 if (!empty($options['email'])) {
                     imagettftext($img, 8, 0, 15, 710, $textColorBlack, $verdanaFont, 'Email: ' . $options['email']);
                 }
                 if (!empty($options['oid'])) {
                     imagettftext($img, 8, 0, 15, 748, $textColorBlack, $verdanaFont, 'Order Link: ' . zbase_url_create('order', array('id' => $options['oid'])));
                 }
                 imagettftext($img, 8, 0, 15, 760, $textColorBlack, $verdanaFont, 'Date: ' . date('F d, Y h:i A'));
             }
             if (!empty($this->displayPrice)) {
                 imagettftext($img, 18, 0, 15, 540, $textColorBlack, $verdanaFont, 'Total: Php ' . number_format($total, 2));
             }
             if (!empty($statusPaid)) {
                 imagettftext($img, 9, 0, 15, 555, $textColorBlack, $verdanaFont, 'PAID ' . number_format($paymentAmount, 2) . ' via ' . $paymentCenterName . ' (' . $orderData->paid_date_at->format('m/d/Y') . ')');
             }
             if (!empty($orderData) && $orderData->status == 1 && !empty($options['step']) && $options['step'] == 5) {
                 $orderData->total = $total;
                 $orderData->subtotal = $subTotal;
                 $orderData->shipping_fee = $shippingFee;
                 unset($options['step']);
                 $options['final'] = 1;
                 if (!empty($promoOrder)) {
                     $orderData->promo_flag = 1;
                 }
                 $orderData->details = json_encode($options);
                 if (!empty($tags)) {
                     $orderData->tags = implode(', ', $tags);
                 }
                 $orderData->save();
                 if (!empty($promoOrder)) {
                     $promoOrderDetails = (array) $promoOrder->details();
                     $promoOrderDetails['promo_associate_order_id'] = $orderData->id();
                     $promoOrder->details = json_encode($promoOrderDetails);
                     $promoOrder->promo_flag = 1;
                     $promoOrder->save();
                 }
             }
         }
     } else {
         imagettftext($img, 9, 0, 15, 23, $textColorBlack, $verdanaFont, 'Font: ' . $fontDetails['name']);
     }
     if (!empty($hasBorder)) {
         imagettftext($img, 7, 0, 15, $brandingHeightPosition - (10 + $borderWidth), $textColorBlack, $verdanaFont, 'Create your necklace at http://zivsluck.com');
     } else {
         imagettftext($img, 7, 0, 15, $brandingHeightPosition - 10, $textColorBlack, $verdanaFont, 'Create your necklace at http://zivsluck.com');
     }
     if (!empty($statusNew)) {
         $paymentDetailsIm = imagecreatefrompng($paymentDetails);
         imagecopy($img, $paymentDetailsIm, 0, 800, 0, 0, $boxWidth, $boxHeight);
     }
     if (!empty($statusPaid) && empty($dealerCopy)) {
         if (!empty($paymentDetailsIm)) {
             imagecopy($img, $paymentDetailsIm, 0, 800, 0, 0, $boxWidth, $boxHeight);
         }
     }
     // </editor-fold>
     /**
      * Label
      */
     $this->_image = $img;
     return $this;
 }
Example #30
0
 /**
  * Check if application user authentication is enabled
  * @return boolean
  */
 public function authEnabled()
 {
     return zbase_config_get('auth.enable', true);
 }