コード例 #1
0
ファイル: petShop.php プロジェクト: awd-git/Petshop
/**
 * Create a few creatures and add them to the pet shop
 *
 * @return bool
 * @throws Exception
 */
function savePetShop()
{
    logStats('create three nameless cats');
    logStats('create three nameless dogs');
    @($objects = [new Cat(), new Cat(), new Cat(), new Dog(), new Dog(), new Dog()]);
    logStats('insert all six pets into the database');
    logStats('guarantee all the pets are persisted');
    $data = getDataObject();
    $data->beginTran();
    foreach ($objects as $object) {
        if ($data->insert($object) === false) {
            return $data->rollback();
        }
    }
    return $data->commit();
}
コード例 #2
0
ファイル: index.php プロジェクト: electricfret/SocialCrumbs
 $postCategories = get_the_category();
 $eventCategory = '';
 if (!empty($postCategories[0])) {
     $eventCategory = $postCategories[0]->slug;
 }
 // get tag
 $postTags = get_the_tags();
 $tags = array();
 if (is_array($postTags)) {
     $tags = array_values($postTags);
 }
 $eventTag = '';
 if (!empty($tags)) {
     $eventTag = $tags[0]->slug;
 }
 $content = getDataObject(get_the_content());
 // Event Recipes
 include "event/codepen.php";
 include "event/delicious.php";
 include "event/dribbble.php";
 include "event/foursquare.php";
 include "event/github.php";
 include "event/instagram.php";
 include "event/instapaper.php";
 include "event/lastfm.php";
 include "event/soundcloud.php";
 include "event/twitter.php";
 include "event/vimeo.php";
 include "event/youtube.php";
 // Event Template
 eventTemplate($eventType, $eventTitle, $eventContent, $eventUrl, $eventTimeStamp, $eventIconStatus, $eventCategory, $eventTag);