Beispiel #1
0
function burntDisplayAsyncImage($imageURL, $options, $preload = false)
{
    $classNames = array();
    if (!empty($options['class'])) {
        $classNames[] = $options['class'];
    }
    if ($preload) {
        $classNames[] = 'loaded';
    } else {
        $classNames[] = 'needsLoading';
    }
    /*
    glazyElement(array(
    	'tagName' =>'img',
    	'src' => $preload ? $imageURL : TIDAL_BASE_CORE_IMAGES_URL. 'empty.png',
    	'width:check' => &$options['width'],
    	'height:check' => $options['height'],
    	'alt:check' => $options['alt']
    ));
    */
    ?>
<img<?php 
    glazyAttribute('src', $preload ? $imageURL : PVLP_BASE_CORE_IMAGES_URL . 'empty.png');
    glazyAttributeCheck('width', $options['width']);
    glazyAttributeCheck('height', $options['height']);
    glazyAttributeCheck('alt', $options['alt']);
    if (!$preload) {
        glazyAttribute('data-original', $imageURL, GLAZE_TYPE_URL);
    }
    glazyAttribute('class', $classNames);
    ?>
><?php 
}
Beispiel #2
0
function pvlpDisplayMenuItem($menuItem, $mapMenuIDToSubmenus, $tag)
{
    global $wp_query;
    if (!empty($wp_query->queried_object_id)) {
        $queriedObjectID = (int) $wp_query->queried_object_id;
    }
    $title = $menuItem->title;
    $url = $menuItem->url;
    $classes = array('menuItem-' . pvlpShortenNameToProperNameSlug($title));
    if (!empty($queriedObjectID)) {
        $currentItem = $menuItem->object_id == $queriedObjectID && ($wp_query->is_singular() && $menuItem->type == 'post_type' || $wp_query->is_category() && $menuItem->object == 'category');
        $currentCategory = ($wp_query->is_single || $wp_query->is_page) && $menuItem->object == 'category' && in_category($menuItem->object_id, $queriedObjectID);
        if ($currentItem) {
            $classes[] = 'current-item';
        }
        if ($currentCategory) {
            $classes[] = 'current-category';
        }
    }
    ?>
<li<?php 
    echo glazyAttribute('class', $class);
    ?>
><<?php 
    echo $tag;
    ?>
><a<?php 
    glazyAttribute('href', $url);
    ?>
><?php 
    echo glazeText($title);
    ?>
</a></<?php 
    echo $tag;
    ?>
><?php 
    if (!empty($mapMenuIDToSubmenus[$menuItem->ID])) {
        ?>

<ul class="menu submenu">
<?php 
        foreach ($mapMenuIDToSubmenus[$menuItem->ID] as $submenu) {
            pvlpDisplayMenuItem($submenu, $mapMenuIDToSubmenus, $tag);
        }
        ?>
</ul>
<?php 
    }
    ?>
</li>
<?php 
}
Beispiel #3
0
$classNamesArray[] = !empty($info['published']) ? 'published' : 'upcoming';
$classNamesArray[] = 'genre-' . $info['genreIdentifier'];
// e.g. 'genre-thriller'
// Begin the <div>
$bookItemDiv = glazyBegin('div');
glazyAttribute('id', "bookItem-{$info['itemID']}");
// Lets you use an array of strings for class attributes.
glazyAttribute('class', $classNamesArray);
// Only display the attribute if variable reference $info['salesCount'] is present.
glazyAttributeCheck('data-sales-count', $info['salesCount']);
glazyAttributeCheck('data-sales-count', $info['salesCount_NOPE']);
// Only displays the attribute, with the value 'selected', if $info['selected'] is true.
glazyAttributeCheck('selected', $info['selected'], 'selected');
glazyAttributeCheck('selected-nope', $info['selected_NOPE'], 'selected');
glazyElement('h5.authorName', glazyCheckContent($info['authorName']));
glazyElement('p.description', glazyPrepareContentJoinedByLineBreaks(glazyCheckContent($info['itemDescription'])));
glazyElement('p.description', glazyPrepareContentJoinedByLineBreaks(glazyCheckContent($info['itemDescription_NOPE'])));
// Finish and close the </div>
glazyFinish($bookItemDiv);
glazyElement('h2', 'These are already escaped &amp; &lt; &gt;', GLAZE_TYPE_PREGLAZED);
$img = glazyBegin('img');
glazyAttribute('src', 'http://placehold.it/150x50');
$escapedText = 'Bangers &amp; Mash';
glazyAttribute('alt', $escapedText, GLAZE_TYPE_PREGLAZED);
glazyFinish($img);
glazyElement('hr');
glazyElement('p', array('Updating this file by using: ', glazyPrepareElement('br'), glazyPrepareElement('code', 'php -f example-update.php')));
glazyElement('p', array('Check this file with the last version by using: ', glazyPrepareElement('br'), glazyPrepareElement('code', 'php -f example-check.php')));
glazyElement('p', array('You can download glaze.php from here: ', glazyPrepareElement(array('tagName' => 'a', 'href' => 'http://github.com/BurntCaramel/glaze'), 'github.com/BurntCaramel/glaze')));
glazyFinish($body);
glazyFinish($html);
Beispiel #4
0
function perforatedFormDisplayEntry($entryID, $entryDetails, $options, $callbacks)
{
    $baseID = $options['baseID'];
    $problemIDsToMessages = $options['problemIDsToMessages'];
    $entryTitle = $entryDetails['title'];
    $entryType = $entryDetails['type'];
    $entryValue = !empty($entryDetails['value']) ? $entryDetails['value'] : '';
    $entryInputName = "{$baseID}[{$entryID}]";
    $entryTextTag = !empty($options['textTagName']) ? $options['textTagName'] : 'h5';
    $entryIsRequired = !empty($entryDetails['required']);
    $glazyLabel = glazyBegin(array('tagName' => 'label', 'id' => $entryID, 'class' => $entryType, 'data-entry-i-d' => $entryID));
    $textElement = glazyBegin(array('tagName' => $entryTextTag));
    glazyElement('span.title', $entryTitle);
    if (isset($options['problems'][$entryID])) {
        foreach ($options['problems'][$entryID] as $problemID => $problemValue) {
            if (isset($problemIDsToMessages['types'][$entryType][$problemID])) {
                $problemMessage = $problemIDsToMessages['types'][$entryType][$problemID];
            } else {
                $problemMessage = $problemIDsToMessages['base'][$problemID];
            }
            glazyElement('span.problem', $problemMessage);
        }
    }
    glazyFinish($textElement);
    if (empty($callbacks['inputElementTypeForEntryType'])) {
        throw new Exception('Perforated: A input element type for entry type callback *must* be set: $callbacks["inputElementTypeForEntryType"] is empty.');
    } else {
        $inputElementTypeForEntryTypeCallback = $callbacks['inputElementTypeForEntryType'];
    }
    $inputType = call_user_func($inputElementTypeForEntryTypeCallback, $entryType);
    if ($inputType === 'text' && empty($entryDetails['multipleLines']) || $inputType === 'email' || $inputType === 'url' || $inputType === 'number' || $inputType === 'checkbox') {
        $input = glazyBegin('input');
        glazyAttribute('type', $inputType);
        glazyAttribute('name', $entryInputName);
        glazyAttributeCheck('required', $entryIsRequired);
        if ($inputType === 'checkbox') {
            glazyAttributeCheck('checked', $entryDetails['value'], 'checked');
            glazyAttribute('data-on-title', $entryDetails['titleWhenOn']);
            glazyAttribute('data-off-title', $entryDetails['titleWhenOff']);
        } else {
            glazyAttribute('value', $entryValue);
        }
        if ($entryType === 'integer') {
            glazyAttribute('step', '1');
        }
        glazyFinish($input);
    } elseif ($inputType === 'text' && !empty($entryDetails['multipleLines'])) {
        glazyElement(array('tagName' => 'textarea', 'name' => $entryInputName, 'required' => !empty($entryDetails['required']), 'cols' => 40, 'rows' => 4), $entryValue);
    }
    glazyFinish($glazyLabel);
}
>
<?php 
}
if (defined('PVLP_FACEBOOK_PAGE_ID')) {
    ?>
<meta property="fb:page_id"<?php 
    glazyAttribute('content', PVLP_FACEBOOK_PAGE_ID);
    ?>
>
<?php 
}
//$canonicalURL = pvlpGetCanonicalURL();
if (false && !empty($canonicalURL)) {
    ?>
<link rel="canonical"<?php 
    glazyAttribute('href', $canonicalURL);
    ?>
>
<?php 
}
if (defined('PVLP_SITE_DESCRIPTION')) {
    glazyElement(array('tagName' => 'meta', 'name' => 'description', 'content' => PVLP_SITE_DESCRIPTION));
}
stirring('header', 'start');
wp_head();
stirring('header', 'wp_head');
if (defined('PVLP_ENABLE_TYPEKIT') && PVLP_ENABLE_TYPEKIT) {
    pvlpDisplayTypekitScripts();
}
if (PVLP_SITE_IS_REAL) {
    pvlpDisplayGoogleAnalyticsTracking();
Beispiel #6
0
 public function beginDisplayingSectionWithID($sectionID, $options = null)
 {
     $options = $this->setUpDefaultOptionsForDisplaySection($options);
     glazyBegin('section');
     glazyAttribute('id', $this->sectionElementID($sectionID));
     if (!empty($options['addContentElement'])) {
         glazyBegin('div');
         $classes = array('content');
         if (!empty($options['wider'])) {
             $classes[] = 'contentWider';
         }
         glazyAttribute('class', $classes);
     }
     // WordPress's shortcode runs first and displays later, so make sure glazy is ready.
     glazyEnsureOpeningTagForLatestElementIsDisplayed();
 }