// $tweet_fg // // Optional parameters: // --------------------- // $tweet_shell_bg // $tweet_shell_fg // $tweet_link_fg // // Pull any parameters $tweet_fg = block_getParameter('tweet_fg', "#000000"); $tweet_bg = block_getParameter('tweet_bg', "#FFFFFF"); $tweet_shell_bg = block_getParameter('tweet_shell_bg', $tweet_bg); $tweet_shell_fg = block_getParameter('tweet_shell_fg', $tweet_fg); $tweet_link_fg = block_getParameter('tweet_link_fg', $tweet_fg); $tweet_width = block_getParameter('tweet_width', 200); $tweet_height = block_getParameter('tweet_height', 300); ?> <div id="block-twitter-widget"> <script src="http://widgets.twimg.com/j/2/widget.js" type="text/javascript"></script> <script type="text/javascript"> new TWTR.Widget({ version: 2, type: 'profile', rpp: 4, interval: 6000, <?php print 'width: ' . $tweet_width . ', height: ' . $tweet_height . ','; ?> theme: { <?php print ' shell: { background: \'' . $tweet_shell_bg . '\', color: \'' . $tweet_shell_fg . '\' },' . "\n"; print ' tweets: { background: \'' . $tweet_bg . '\', color: \'' . $tweet_fg . '\', links: \'' . $tweet_link_fg . '\' }' . "\n"; ?> },
<div class="block-announcements"> <?php global $auth_user; // // REQUIRED PARAMETERS: // <none> // // OPTIONAL PARAMETERS // 'max_count' -- Max # of entries to load // 'max_chars' -- Max # of characters from text to load // /* Step 1: Get parameters */ $max_count = block_getParameter('max_count', 5); $max_chars = block_getParameter('max_chars', 150); /* Step 2: Get list of announcements */ $list = db_announcementList($max_count); /* Step 3: Start the story */ $st = new akStory(); /* Step 3: Build the HTML output */ if ($list == null) { $st->createSimpleChunk(STORY_CHUNK_META, "(no current announcements)"); } else { foreach ($list as $a) { $st->createSimpleChunk(STORY_CHUNK_TEXT, "<br/>"); $st->createSimpleChunk(STORY_CHUNK_SUBGROUP, $a->title); $st->createSimpleChunk(STORY_CHUNK_FILE, $a->text); $st->createSimpleChunk(STORY_CHUNK_META, "Posted: " . $auth_user->format_date($a->edit_time)); } } $st->emit(); ?>
// sermon_end_date -- Latest sermon to list // // Step 1: Pull parameters // Get current time in seconds $timenow = time(); // Start is about 5 weeks ago (5 * 7 * 24 * 3600 secs ago) $timestart = $timenow - 3024000; // End is 2 weeks from now (2 * 7 * 24 * 3600 secs into the future) $timeend = $timenow + 1209600; $default_start = date('Y-m-d', $timestart); $default_end = date('Y-m-d', $timeend); $default_book = 103; // Default sermon book... $start_date = block_getParameter('sermon_start_date', $default_start); $end_date = block_getParameter('sermon_end_date', $default_end); $bookid = block_getParameter('sermon_book', $default_book); // Step 2: Generate list from DB $sermonList = db_sermonsByDateRange($bookid, $start_date, $end_date); // Step 3: Build a story, with a series header whenever it changes... $lastSeries = ''; $st = new akStory(); foreach (array_reverse($sermonList, true) as $sermon) { // Step 3.1: Emit a series header if it changes.... if ($lastSeries != $sermon->series) { $st->createSimpleChunk(STORY_CHUNK_SUBGROUP, $sermon->series); $st->lastSimpleChunk->url = "/sermon.php?date=" . $sermon->deliver_date; $lastSeries = $sermon->series; } // Step 3.2: Emit the sermon header $st->createSimpleChunk(STORY_CHUNK_TEXT, substr($sermon->deliver_date, 5) . ": " . $sermon->title); $st->lastSimpleChunk->url = "/sermon.php?date=" . $sermon->deliver_date;
<?php // Sermon app block (center app area) // // Required parameters: // --------------------- // sermon-date Date of delivery of the sermon to display // // Optional parameters: // --------------------- // Step 1: Get target date from parameters $sermon_date = block_getParameter('sermon-date', date('Y-m-d')); // Step 2: Generate entry(-ies) from DB $sermonList = db_sermonsByDateRange(103, $sermon_date, $sermon_date); // Step 3: Check for failure if (null == $sermonList) { $st = new akStory(); $st->createSimpleChunk(STORY_CHUNK_ERROR, "No sermon found for " . $sermon_date); $st->emit(); return; } function file_size($size) { $filesizename = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB"); return $size ? round($size / pow(1024, $i = floor(log($size, 1024))), 2) . $filesizename[$i] : '0 Bytes'; } // Step 4: Got (at least) one $sermon = $sermonList[$sermon_date]; $st = new akStory(); $st->createSimpleChunk(STORY_CHUNK_HEADLINE, "Sermon: " . $sermon_date); //$st->createSimpleChunk(STORY_CHUNK_SECTION,$sermon->series);
// Random image block; whoever includes this block // // Required parameters: // --------------------- // $random_image_path // $random_image_width; // // Optional parameters: // --------------------- // $random_image_caption // // Be careful not to use large images in the random pool, // as the download and scaling costs may cause resource // issues. // // CLEAN: Pull from DB instead of globbing the path // Step 1: Pull parameters $path = block_getParameter('random_image_path', "/"); $width = block_getParameter('random_image_width', "200"); $caption = block_getParameter('random_image_caption', ""); // Step 2: Choose the image from the path $imageset = glob($path . "/*.{png,jpg}", GLOB_BRACE); $r = mt_rand(0, count($imageset) - 1); $image = $imageset[$r]; echo '<div id="block-random-image">'; echo '<a href="viewer-photo.php?gallery=random&image_path=' . $image . '" class="frameless">'; echo '<img src="' . $image . '" alt="Random Image" width="' . $width . '" class="block-image frameless"/>'; echo '</a>'; echo '<span class="block-text">' . $caption . '</span>'; echo '</div>';
// Event list block (sidebar/multibar) // // Required parameters: // --------------------- // // Optional parameters: // --------------------- // event_list_size Max # of events to retrieve/display // // Step 1: Pull parameters $default_book = BOOK_ID_CALENDAR; // Default events book... $default_count = 8; // Default # to list $bookid = block_getParameter('event_book', $default_book); $count = block_getParameter('event_count', $default_count); // Step 2: Generate list from DB $eventList = db_eventsUpcoming($bookid, $count); // Step 3: Build a story, with a date header whenever it changes... $lastDate = ''; $st = new akStory(); if (null == $eventList) { $st->createSimpleChunk(STORY_CHUNK_TEXT, "No upcoming events posted."); } else { foreach ($eventList as $event) { // Step 3.1: Emit a series header if it changes.... $eventDate = new DateTime($event->startdate); if ($lastDate != $eventDate->format("F")) { $lastDate = $eventDate->format("F"); $st->createSimpleChunk(STORY_CHUNK_SUBGROUP, $lastDate); //$st->lastSimpleChunk->url = "/event.php?date=".$eventDate->format("Y-m");
<div id="block-upper-room" class="block-content-addmargin"> <?php // Upper Room (R) daily devotional // // Required parameters: // --------------------- // // Optional parameters: // --------------------- // Step 1: Setup parameters $devo_maxlen = block_getParameter('devo_maxlen', 300); $text_width = block_getParameter('text_width', 200); $today = time(); $upperurl = "http://devotional.upperroom.org/devotionals/" . date('Y-m-d', $today); // Step 2: Import via URL file open into a DOM object $upperHTML = file_get_contents($upperurl); $dom = new DOMDocument(); @$dom->loadHTML($upperHTML); // Step 3: Parse out the bits we care about $scripsnip = $dom->getElementById('scripture_snippet'); $scripkids = $scripsnip->childNodes; $scripref = preg_replace("/\\(.*\\)/", "", $scripsnip->childNodes->item(3)->textContent); $scripref = str_replace("- ", "", $scripref); $devo = ltrim(rtrim($scripsnip->nextSibling->textContent)); // Step 4: Truncate to a reasonable size, but only on a word boundary... if (strlen($devo) > $devo_maxlen) { $devo = substr($devo, 0, $devo_maxlen); $devo = substr($devo, 0, strrpos($devo, " ")) . "..."; } // Step 3: Create $st = new akStory();
require_once "library/core/class-form.php"; // // BLOCK: Edit a server-side HTML file. // // Required parameters: // ------------------- // @param $editor_filename The relative path to the file to edit. // // Optional parameters: // ------------------- // @param $editor_option_preview Add a preview button. // $editor_filename = block_getParameter('editor-filename'); $editor_hostpage = block_getParameter('editor-hostpage'); $editor_processor = block_getParameter('editor-processor'); $editor_block_width = block_getParameter('block-width'); $editor_width = '' . 0.95 * $editor_block_width . 'px'; if (null == $editor_filename) { print 'Something is wrong.'; return; } // Step 1: Create the base form $editor = new akForm("edit-html-form", $editor_processor, FORM_METHOD_POST); // Step 2: Generate items for the form */ // Hidden reference to the file and host page $editor->createSimpleItem("hidden-filename-item", FORM_ITEM_HIDDEN, "file", $editor_filename); $editor->createSimpleItem("hidden-hostpage-item", FORM_ITEM_HIDDEN, "hostpage", $editor_hostpage); // Main text area $textarea = new akFormItem("file-text", FORM_ITEM_TEXTAREA, "edit-html-contents", file_get_contents($editor_filename)); $textarea->addStyle('width', $editor_width); $textarea->vsize = 15;
<?php // Event app block (center app area) // // Required parameters: // --------------------- // event-id DB ID of event to display // // Optional parameters: // --------------------- // Step 1: Get target date from parameters $event_id = block_getParameter('event-id', '1'); // Step 2: Generate entry from DB /* Lookup */ $ev = db_getEventById($event_id); /* Failure check */ if (null == $ev) { $st = new akStory(); $st->createSimpleChunk(STORY_CHUNK_ERROR, "No event found for id=" . $event_id); $st->emit(); return; } // Step 3: Get event details /* Lookup */ $ev_story = db_getStoryById($ev->story); /* Failure check */ if (null == $ev_story) { $st = new akStory(); $st->createSimpleChunk(STORY_CHUNK_ERROR, "No details found for event id=" . $event_id); $st->emit(); return;
<div class="block-video block-video-div block-video-youtube"> <?php // // REQUIRED PARAMETERS: // @param $youtube_video_id YouTube video identifier // $video_id = block_getParameter('youtube_video_id', ''); $video_width = floor(0.95 * config_getParameter('skin_width_app', 400)); $video_height = floor($video_width * 0.8); $youtube_prefix = "http://www.youtube.com/embed/"; print '<iframe class="youtube-player" type="text/html" width="' . $video_width . '" height="' . $video_height . '" src="' . $youtube_prefix . $video_id . '" frameborder="0"></iframe>'; ?> </div>