/** * akimg_emit_constrained() -- Make sure an image fits into the skin's hints * * $path -- Path to image file * $alt -- ALT text */ function akimg_html_constrained($path = null, $alt = 'untitled', $bound = 0) { /* Step 1: Base validation */ if (null == $path || !is_readable($path)) { return ''; } /* Step 2: Secondary validation */ $d = getimagesize($path); if (FALSE == $d) { return ''; } /* Step 3: Get bounding side from skin or args */ if ($bound == 0) { $side = config_getParameter('skin_img_limit', 500); } else { $side = $bound; } /* Step 4: If it fits already, just return with defaults */ if ($d[0] <= $side && $d[1] <= $side) { /* Fits. No size info given. */ return '<img src="' . $path . '" alt="' . $alt . '"/>'; } /* Step 5: Scale down based on largest dimension */ if ($d[0] > $d[1]) { /* "Wide" */ $w = $side; $h = round($d[1] * ($w / $d[0])); } else { /* "Tall" */ $h = $side; $w = round($d[0] * ($h / $d[1])); } /* Step 6: Return with new size */ return '<img src="' . $path . '" alt="' . $alt . '" width="' . $w . '" height="' . $h . '"/>'; }
function __construct($type = BLOCK_TYPE_SIDEBAR, $provider = null, $title = null) { /* Step 1: Copy elements from args */ $this->type = $type; $this->provider = $provider; $this->title = $title; /* Step 2: Generic init */ $this->dom_id = null; $this->prefix = null; $this->suffix = null; $this->title_prefix = null; $this->title_suffix = null; $this->content_prefix = null; $this->content_suffix = null; /* Step 3: Internal parameter set */ $this->opts = array(); $this->opts['block-width'] = config_getParameter("skin_width_" . $this->type, 0); }
<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>
/** * config_getLastError() -- Retrieve a global system error string */ function config_getLastError() { return config_getParameter('errno', 'Success'); }
<?php // Sermons $ser = new akBlock(BLOCK_TYPE_MULTIBAR, "blocks/app/block-sermon-list.php", "Sermons"); $ser->emit(); // Upcoming events $events = new akBlock(BLOCK_TYPE_MULTIBAR, "blocks/app/block-events-list.php", "Looking Ahead"); $events->emit(); // Add the twitter widget (with parameters) $twidget = new akBlock(BLOCK_TYPE_RAW, "blocks/app/block-twitter-widget.php"); $twidget->setParameter('tweet_shell_bg', '#C82020'); $twidget->setParameter('tweet_shell_fg', '#FFFFFF'); $twidget->setParameter('tweet_fg', '#000000'); $twidget->setParameter('tweet_bg', '#FFFFFF'); $twidget->setParameter('tweet_width', config_getParameter('skin_width_multibar')); $twidget->emit();