public function getLanguages() { $language_data = $this->cache->pull('localization.language'); if ($language_data === false) { $query = $this->db->query("SELECT * FROM " . $this->db->table("languages") . " WHERE status = 1 ORDER BY sort_order, name"); foreach ($query->rows as $result) { $rel_image_path = ''; if (empty($result['image'])) { $rel_image_path = 'storefront/language/' . $result['directory'] . '/flag.png'; if (file_exists(DIR_ROOT . '/' . $rel_image_path)) { $sizes = get_image_size(DIR_ROOT . '/' . $rel_image_path); $result['image'] = $rel_image_path; $result['image_width'] = $sizes['width']; $result['image_height'] = $sizes['height']; } } else { $rel_image_path = $result['image']; if (file_exists(DIR_ROOT . '/' . $rel_image_path)) { $sizes = get_image_size(DIR_ROOT . '/' . $rel_image_path); $result['image'] = $rel_image_path; $result['image_width'] = $sizes['width']; $result['image_height'] = $sizes['height']; } } $language_data[$result['language_id']] = array('language_id' => $result['language_id'], 'name' => $result['name'], 'code' => $result['code'], 'locale' => $result['locale'], 'image' => $result['image'], 'image_width' => $result['image_width'], 'image_height' => $result['image_height'], 'directory' => $result['directory'], 'filename' => $result['filename'], 'sort_order' => $result['sort_order'], 'status' => $result['status']); } $this->cache->push('localization.language', $language_data); } return $language_data; }
function smarty_function_picture($params, $template) { $src = smarty_plugin_get_variable($params, $template, 'src', true); $alt = smarty_plugin_get_variable($params, $template, 'alt'); $path = smarty_plugin_get_variable($params, $template, 'path'); $CI =& get_instance(); $CI->load->helper('image'); $file = find_file($src, 'static/img/'); // Try to find the image in static/img if ($file == null) { // We can't read the file $file = find_file($src, 'static/uploads/'); if ($file == null) { $src = 'default.png'; } } $size = get_image_size($src); $size = $size['width']; $attr = $params; $medias = array(); $ret = array(); $attr['src'] = $src; if ($path != '') { $attr['path'] = site_url($path); } $ret[] = '<picture ' . _parse_form_attributes($attr, array()) . ' >'; foreach ($params as $key => $value) { // Check if user has set the customized media if (strpos($key, 'media') !== false) { $media = str_replace('media', '', $key); $medias[] = $media; $ret[] = "\t" . '<source src="' . site_url('responsive/size/' . $value . '/' . $src) . '" media="(min-width:' . $media . 'px)">'; continue; } $attr[$key] = smarty_plugin_get_variable($params, $template, $key, false); } if ($path == '') { $resolutions = get_ci_config('resolutions'); foreach ($resolutions as $res) { if (array_search($res, $medias) !== false) { // If the resolution is already covered continue; } $ret[] = "\t" . '<source src="' . site_url('responsive/size/' . (double) $res / 2880 * (double) $size . '/' . $src) . '" media="(min-width:' . $res . 'px)">'; } } $ret[] = "\t" . '<noscript>'; $ret[] = "\t\t" . '<img src="' . site_url('static/img/' . $src) . '" alt="' . $alt . '">'; $ret[] = "\t" . '</noscript>'; $ret[] = '</picture>'; return implode("\n", $ret); }
function smarty_block_figure($params, $content = '', $template, &$repeat) { if ($repeat) { // Skip the start part return; } $src = smarty_plugin_get_variable($params, $template, 'src', true); $path = smarty_plugin_get_variable($params, $template, 'path'); $size = get_image_size($src); $size = $size['width']; if ($path == '') { // If we are using auto resizing, skip the resolutions $resolutions = get_ci_config('resolutions'); foreach ($resolutions as $res) { $attr['data-media' . $res] = site_url('responsive/size/' . (double) $res / 2880 * (double) $size . '/' . $src); } } foreach ($params as $key => $value) { if ($key == 'path') { $attr[$key] = site_url(get_smarty_variable($params, $template, 'path', $value)); continue; } if (strpos($key, 'media') !== false) { $attr['data-' . $key] = site_url('responsive/size/' . $value . '/' . $src); } else { $attr[$key] = get_smarty_variable($params, $template, $value, $value); } } $ret = array(); $ret[] = '<figure ' . _parse_form_attributes($attr, array()) . '>'; if (isset($attr['action'])) { $ret[] = '<a href="' . $attr['action'] . '">'; } $ret[] = '<noscript>'; $ret[] = '<img src="' . site_url('static/img/' . $src) . '">'; $ret[] = '</noscript>'; if (isset($attr['action'])) { $ret[] = '</a>'; } $ret[] = '<figcaption>'; $ret[] = $content; $ret[] = '</figcaption>'; $ret[] = '</figure>'; return implode("\n", $ret); }
function render($atts, $content = null, $base = '') { extract(shortcode_atts(array('border' => '', 'align' => '', 'image' => '', 'size' => 'full', 'url' => '', 'target' => '', 'el_id' => '', 'el_class' => '', 'image_style' => '', 'spy' => '', 'scroll_delay' => 300), $atts, 'dt_image')); global $DEstyle; $css_class = array('dt_image'); if ('' != $el_class) { array_push($css_class, $el_class); } $css_style = getCssMargin($atts); if ('' == $el_id) { $el_id = "dt_image" . getCssID(); } $image_id = $image; if (!($image = get_image_size($image, $size))) { return ""; } $image_alt_text = get_post_meta($image_id, '_wp_attachment_image_alt', true); $compile = "<div "; if ('' != $el_id) { $compile .= "id=\"{$el_id}\" "; } if ('none' !== $spy && !empty($spy)) { $compile .= 'data-uk-scrollspy="{cls:\'' . $spy . '\', delay:' . (int) $scroll_delay . '}" '; } $compile .= "class=\"" . @implode(" ", $css_class) . "\">"; $link = $url != '' ? "<a href=\"" . esc_url($url) . "\" target=\"" . $target . "\">" : ""; $link_end = $url != '' ? "</a>" : ""; $compile .= "<div class=\"image-align-" . $align . "\">"; if ($image_style == 'diamond') { $compile .= "<div class=\"ketupat0\"" . ($image[1] ? " style=\"width:" . ($image[1] - $image[1] * 10 / 100) . "px;height:" . ($image[1] - $image[1] * 10 / 100) . "px\"" : "") . ">" . "<div class=\"ketupat1\" " . ('' != $border ? " style=\"border:{$border} solid\"" : "") . ">" . "<div class=\"ketupat2\">" . $link . "<img class=\"img-responsive " . ('' != $image_style ? "style-" . $image_style : "") . "\" src=\"" . esc_url($image[0]) . "\" alt=\"" . esc_attr($image_alt_text) . "\"/>" . $link_end . "</div></div></div>"; } else { $compile .= $link . "<img " . ('' != $border ? "style=\"border:{$border} solid\"" : "") . " class=\"img-responsive " . ('' != $image_style ? "style-" . $image_style : "") . "\" src=\"" . esc_url($image[0]) . "\" alt=\"" . esc_attr($image_alt_text) . "\"/>" . $link_end; } $compile .= "</div>"; $compile .= "</div>"; if ('' != $css_style) { $DEstyle[] = "#{$el_id} {" . $css_style . "}"; } return $compile; }
function format_filelist($filem, $page = 1) { if (!$filem) { return ''; } $perpage = 200; $year = $_GET['year']; $month = $_GET['month']; $format = <<<FORMAT <li id="n%d" %s draggable="true" style="width: %dpx; height: %dpx;" data-thumb="%s"><div class="img" style="%s"><div class="name"><p>%s</p></div><div class="infotag"><span class="longtag" title="%s">LONG</span><span class="tinytag" title="%s">TINY</span></div><div class="select"><p></p></div></div></li> FORMAT; $output = ''; $tinytag = __('This image is tiny and enlarged'); $longtag = __('This image is long and will be auto scrolled when mouse over'); for ($i = ($page - 1) * $perpage; $i < $page * $perpage && $i < count($filem); $i++) { $filepath = UPLOAD_DIR . '/' . $year . '/' . $month . '/' . $filem[$i]; $thumbpath = THUMB_DIR . '/' . $year . '/' . $month . '/' . $filem[$i]; $status = 'select'; $exclass = 'class="scroll-load"'; $imgstyle = ''; if (!file_exists(ABSPATH . '/' . $filepath)) { continue; } else { if (file_exists(ABSPATH . '/' . $thumbpath)) { list($width, $height, $geterror) = get_image_size(ABSPATH . '/' . $thumbpath); } else { list($width, $height, $geterror) = get_image_size(ABSPATH . '/' . $filepath); $thumbpath = $filepath; } } $thumbpath = '/' . $thumbpath; if ($geterror) { $thumbpath = 'images/error.png'; $width = $height = 200; } else { $ratio = $width / $height; $extiny = $width < 67 || $height < 67; $exlong = $ratio > 3 || $ratio < 0.33; if ($extiny && $exlong) { if ($ratio < 1) { $width = 67; $height = 200; $exclass = 'data-direction="ttb" '; $imgstyle = 'background-size: 100% auto;'; } else { $height = 67; $width = 200; $exclass = 'data-direction="ltr" '; $imgstyle = 'background-size: auto 100%;'; } $exclass .= 'class="tiny long scroll-load"'; } else { if ($extiny && !$exlong) { if ($ratio < 1) { $width = 67; $height = $width / $ratio; } else { $height = 67; $width = $height * $ratio; } $exclass = 'class="tiny scroll-load"'; } else { if (!$extiny && $exlong) { if ($ratio < 1) { $height = 200; $exclass = 'data-direction="ttb" '; $imgstyle = 'background-size: 100% auto;'; } else { $width = 200; $exclass = 'data-direction="ltr" '; $imgstyle = 'background-size: auto 100%;'; } $exclass .= 'class="long scroll-load"'; } } } } $output .= sprintf($format, $i, $exclass, $width, $height, htmlspecialchars($thumbpath), $imgstyle, $filem[$i], $longtag, $tinytag); } return $output; }
} } $caption = $portfolio_mb->get_the_value('caption'); if ($portfolio_mb->get_the_value('panning')) $panning = ' data-fresco-options="fit: \'width\'"'; else $panning = ''; if ($portfolio_mb->get_the_value('video')) { if ($imgID && ($provider == 'Vimeo' || $provider == 'Youtube')) { echo $dummy_code; ?> <a href="<?php $portfolio_mb->the_value('video'); ?>" class="fresco video pushed" data-fresco-group='<?php echo( basename(get_permalink()) ); ?>' data-fresco-caption="<?php echo $caption; ?>"<?php echo $thumbs; ?>><?php echo wp_get_attachment_image( $imgID, get_image_size($getsize), 0, array('class' => "attachment-full fresco", 'alt' => $alt) ); ?><div class="video"></div></a> <?php } else { $source = $portfolio_mb->get_the_value('video'); $embed_code = wp_oembed_get($source); if ($embed_code) $embedded = $embed_code; else $embedded = do_shortcode($source); if ($portfolio_mb->get_the_value('link')) echo '<a href="'.$portfolio_mb->get_the_value('link').'" class="video">'.$embedded.'<div class="video link"></div></a>'; else echo $embedded; } } else { if ($portfolio_mb->get_the_value('link')) echo $dummy_code . '<a href="'.$portfolio_mb->get_the_value('link').'" class="video pushed">'.$image_code.'<div class="video link"></div></a>';
function displaydir($wdir) { // $wdir == / or /a or /a/b/c/d etc global $basedir; global $usecheckboxes; global $id; global $USER, $CFG; $fullpath = $basedir . $wdir; $directory = opendir($fullpath); // Find all files while (false !== ($file = readdir($directory))) { if ($file == "." || $file == "..") { continue; } if (is_dir($fullpath . "/" . $file)) { $dirlist[] = $file; } else { $filelist[] = $file; } } closedir($directory); $strfile = get_string("file"); $strname = get_string("name"); $strsize = get_string("size"); $strmodified = get_string("modified"); $straction = get_string("action"); $strmakeafolder = get_string("makeafolder"); $struploadafile = get_string("uploadafile"); $strwithchosenfiles = get_string("withchosenfiles"); $strmovetoanotherfolder = get_string("movetoanotherfolder"); $strmovefilestohere = get_string("movefilestohere"); $strdeletecompletely = get_string("deletecompletely"); $strcreateziparchive = get_string("createziparchive"); $strrename = get_string("rename"); $stredit = get_string("edit"); $strunzip = get_string("unzip"); $strlist = get_string("list"); $strchoose = get_string("choose"); echo "<form action=\"coursefiles.php\" method=\"post\" name=\"dirform\">\n"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"100%\">\n"; if ($wdir == "/") { $wdir = ""; } else { $bdir = str_replace("/" . basename($wdir), "", $wdir); if ($bdir == "/") { $bdir = ""; } print "<tr>\n<td colspan=\"5\">"; print "<a href=\"coursefiles.php?id={$id}&wdir={$bdir}&usecheckboxes={$usecheckboxes}\" onclick=\"return reset_value();\">"; print "<img src=\"{$CFG->wwwroot}/lib/editor/htmlarea/images/folderup.gif\" height=\"14\" width=\"24\" border=\"0\" alt=\"" . get_string('parentfolder') . "\" />"; print "</a></td>\n</tr>\n"; } $count = 0; if (!empty($dirlist)) { asort($dirlist); foreach ($dirlist as $dir) { $count++; $filename = $fullpath . "/" . $dir; $fileurl = $wdir . "/" . $dir; $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p"); echo "<tr>"; if ($usecheckboxes) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" onclick=\"return set_rename('{$dir}');\" />"); } print_cell("left", "<a href=\"coursefiles.php?id={$id}&wdir={$fileurl}\" onclick=\"return reset_value();\"><img src=\"{$CFG->pixpath}/f/folder.gif\" class=\"icon\" alt=\"" . get_string('folder') . "\" /></a> <a href=\"coursefiles.php?id={$id}&wdir={$fileurl}&usecheckboxes={$usecheckboxes}\" onclick=\"return reset_value();\">" . htmlspecialchars($dir) . "</a>"); print_cell("right", " "); print_cell("right", $filedate); echo "</tr>"; } } if (!empty($filelist)) { asort($filelist); foreach ($filelist as $file) { $icon = mimeinfo("icon", $file); $imgtype = mimeinfo("type", $file); $count++; $filename = $fullpath . "/" . $file; $fileurl = "{$wdir}/{$file}"; $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p"); $dimensions = get_image_size($filename); if ($dimensions) { $imgwidth = $dimensions[0]; $imgheight = $dimensions[1]; } else { $imgwidth = "Unknown"; $imgheight = "Unknown"; } unset($dimensions); echo "<tr>\n"; if ($usecheckboxes) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" onclick=\";return set_rename('{$file}');\" />"); } echo "<td align=\"left\" nowrap=\"nowrap\">"; $ffurl = get_file_url($id . $fileurl); link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfile}\" />", 480, 640); $file_size = filesize($filename); echo "<a onclick=\"return set_value(info = {url: '" . $ffurl . "',"; echo " isize: '" . $file_size . "', itype: '" . $imgtype . "', iwidth: '" . $imgwidth . "',"; echo " iheight: '" . $imgheight . "', imodified: '" . $filedate . "' })\" href=\"#\">{$file}</a>"; echo "</td>\n"; if ($icon == "zip.gif") { $edittext = "<a href=\"coursefiles.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=unzip&sesskey={$USER->sesskey}\">{$strunzip}</a> "; $edittext .= "<a href=\"coursefiles.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=listzip&sesskey={$USER->sesskey}\">{$strlist}</a> "; } else { $edittext = " "; } print_cell("right", "{$edittext} "); print_cell("right", $filedate); echo "</tr>\n"; } } echo "</table>\n"; if (empty($wdir)) { $wdir = "/"; } echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n"; echo "<tr>\n<td>"; echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n"; echo "<input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />\n"; echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />\n"; $options = array("move" => "{$strmovetoanotherfolder}", "delete" => "{$strdeletecompletely}", "zip" => "{$strcreateziparchive}"); if (!empty($count)) { choose_from_menu($options, "action", "", "{$strwithchosenfiles}...", "javascript:getElementById('dirform').submit()"); } if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $wdir) { echo "<form action=\"coursefiles.php\" method=\"get\">\n"; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n"; echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />\n"; echo " <input type=\"hidden\" name=\"action\" value=\"paste\" />\n"; echo " <input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />\n"; echo " <input type=\"submit\" value=\"{$strmovefilestohere}\" />\n"; echo "</form>"; } echo "</td></tr>\n"; echo "</table>\n"; echo "</form>\n"; }
function output_results($table, $offset, $limit, $layout_type, $order_by = '') { $results = get_table($table, $offset, $limit, $order_by); $results_array = array(); while ($result = mysqli_fetch_assoc($results)) { if ($result['hidden'] == '1') { continue; } array_push($results_array, $result); } // sort events chronologically if ($table == 'events') { $events_chronological = array(); foreach ($results_array as $result) { $date = $result['date']; while (isset($events_chronological[$date])) { $date = $date . "0"; } $events_chronological[$date] = $result; } ksort($events_chronological); $results_array = array_reverse($events_chronological); } // output all the results $result_number = 0; foreach ($results_array as $result) { $name = $result['name']; $slug = $result['slug']; $pic = get_image_size('small', $result['pic']); if (!empty($result['date'])) { $date = date("d M", strtotime($result['date'])); } // tiles layout if ($layout_type == 'tiles') { // get url if ($table == 'sponsors') { $url = $result['website']; } else { $url = $table . '/' . $slug; } $tile_class = $table . "-tile"; echo "<a href='{$url}' style='background-image:url({$pic})' class='{$tile_class}' >"; if ($table == 'events') { echo "<div class='date'>{$date}</div>"; } echo " <span>{$name}</span>"; echo "</a>"; } // blocks layout if ($layout_type == 'blocks') { echo "<a href='{$table}/{$slug}' class='content-block'>"; // output the image. // if it is within the first few, don't let it be lazy if ($result_number < 3) { echo "<img src='{$pic}' />"; } else { echo "<img class='lazy' data-src='{$pic}' src='/assets/blank.gif' height='150' />"; } if ($table == 'events') { echo " <span>{$name} <div class='date'>{$date}</div></span>"; } else { echo " <span>{$name}</span>"; } echo "</a>"; } $result_number++; } }
function load_work($name, $resolve_references = true) { $s = @file_get_contents(content_dir() . '/' . $name . '/meta.txt'); if ($s === false) { return false; } $work = @json_decode($s, true); if (is_null($work)) { // be vocal about error echo 'Error decoding ' . $name . '/meta.txt'; if (function_exists(json_last_error_msg())) { echo ': ' . json_last_error_msg(); } echo '. Try validating the file with http://jsonlint.com/.'; exit(1); } else { if (!is_array($work)) { echo 'Error decoding ' . $name . '/meta.txt: Not an object.'; exit(2); } } /* set name */ $work['name'] = $name; /* set description */ $s = @file_get_contents(content_dir() . '/' . $name . '/description.html'); if ($s !== false) { $work['description'] = $s; } else { $work['description'] = ''; } /* normalize all other fields */ $work = normalize_work($work, $resolve_references); // XXX: not necessary for !resolve_references $media = load_media($name); if ($media !== false) { $work['media'] = $media; } else { $work['media'] = array(); } // XXX: as above $work['primary_representation'] = null; $fns = @scandir(content_dir() . '/' . $name); foreach ($fns as $fn) { if (in_array($fn, array('.', '..', 'description.html', 'meta.txt'))) { continue; } if (substr($fn, 0, 1) === '_') { continue; } if (!@is_file(content_dir() . '/' . $name . '/' . $fn)) { // not a file continue; } $full_fn = $name . '/' . $fn; // check mime type $mime = get_mime(content_dir() . '/' . $full_fn); if (!in_array(explode('/', $mime)[0], array('image', 'video'))) { // only accept images and videos continue; } $media = array('url' => 'JODI/' . $full_fn, 'fn' => $fn, 'description' => '', 'mime' => get_mime(content_dir() . '/' . $full_fn)); // load image dimensions if (explode('/', $media['mime'])[0] === 'image') { $media = array_merge($media, get_image_size(content_dir() . '/' . $full_fn)); } $work['primary_representation'] = $media; } return $work; }
function displaydir($uuid, $wdir, $courseid = 0) { global $USER, $CFG; global $basedir; global $usecheckboxes; global $id; global $oid; global $shared; global $userid; global $repo; $fullpath = $basedir . $wdir; $dirlist = array(); $filelist = array(); $parentdir = new Object(); if (!empty($userid)) { $ustore = $repo->get_user_store($userid); } if (!empty($userid) && ($uuid == '' || $uuid == $ustore)) { $parentdir->title = ''; $parentdir->url = ''; } else { if (!empty($shared) && ($uuid == '' || $uuid == $repo->suuid)) { $parentdir->title = ''; $parentdir->url = ''; } else { if (!empty($oid) && ($uuid == '' || $uuid == $repo->get_organization_store($oid))) { $parentdir->title = ''; $parentdir->url = ''; } else { if ($uuid == '' || !($parent = $repo->get_parent($uuid)) || $id != SITEID && ($uuid == '' || $uuid == $repo->get_course_store($id))) { $parentdir->title = ''; $parentdir->url = ''; } else { $parentdir->uuid = $parent->uuid; $parentdir->name = $parent->title; $parentdir->title = '..'; } } } } $dirlist[] = $parentdir; $catselect = array(); if (empty($uuid) && $id != SITEID) { $uuid = $repo->get_course_store($id); } if (!empty($search)) { if (($data = data_submitted()) && confirm_sesskey()) { if (!empty($data->categories)) { $catselect = $data->categories; } } $search = stripslashes($search); $repodir = $repo->search($search, $catselect); } else { $repodir = $repo->read_dir($uuid); } // Store the UUID value that we are currently browsing. $repo->set_repository_location($uuid, $id, $userid, $shared, $oid); if (!empty($repodir->folders)) { foreach ($repodir->folders as $folder) { $dirlist[] = $folder; } } if (!empty($repodir->files)) { foreach ($repodir->files as $file) { $filelist[] = $file; } } $strfile = get_string("file"); $strname = get_string("name"); $strsize = get_string("size"); $strmodified = get_string("modified"); $straction = get_string("action"); $strmakeafolder = get_string("makeafolder"); $struploadafile = get_string("uploadafile"); $strwithchosenfiles = get_string("withchosenfiles"); $strmovetoanotherfolder = get_string("movetoanotherfolder"); $strmovefilestohere = get_string("movefilestohere"); $strdeletecompletely = get_string("deletecompletely"); $strcreateziparchive = get_string("createziparchive"); $strrename = get_string("rename"); $stredit = get_string("edit"); $strunzip = get_string("unzip"); $strlist = get_string("list"); $strchoose = get_string("choose"); $strbrowserepo = get_string('browserepository', 'repository'); $strdownloadlocal = get_string('downloadlocally', 'repository'); echo "<form action=\"{$CFG->wwwroot}/file/repository/alfresco/coursefiles.php\" method=\"post\" name=\"dirform\">\n"; echo '<input type="hidden" name="oid" value="' . $oid . '" />' . "\n"; echo '<input type="hidden" name="shared" value="' . $shared . '" />' . "\n"; echo '<input type="hidden" name="userid" value="' . $userid . '" />' . "\n"; echo '<input type="hidden" name="uuid" value="' . $uuid . '" />' . "\n"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"100%\">\n"; if (!empty($parentdir->uuid)) { print "<tr>\n<td colspan=\"5\">"; print '<a href=' . $CFG->wwwroot . '/file/repository/alfresco/coursefiles.php?id=' . $id . '&uuid=' . $parentdir->uuid . '&shared=' . $shared . '&oid=' . $oid . '&userid=' . $userid . '&wdir=/&usecheckboxes=' . $usecheckboxes . '" ' . 'onclick="return reset_value();">'; print "<img src=\"{$CFG->wwwroot}/lib/editor/htmlarea/images/folderup.gif\" height=\"14\" width=\"24\" border=\"0\" alt=\"" . get_string('parentfolder') . "\" />"; print "</a></td>\n</tr>\n"; } $count = 0; if (!empty($dirlist)) { foreach ($dirlist as $dir) { if (empty($dir->uuid)) { continue; } $count++; if ($dir->title == '..' || $dir->title == $strbrowserepo) { if (!empty($dir->url)) { if ($usecheckboxes) { print_cell(); } if (!empty($search)) { print_cell('left', '<a href="' . $dir->url . '"><img src="' . $CFG->pixpath . '/f/parent.gif" height="16" width="16" alt="' . $strbrowserepo . '" /></a> <a href="' . $dir->url . '">' . $strbrowserepo . '</a>', 'name'); } else { print_cell('left', '<a href="' . $dir->url . '"><img src="' . $CFG->pixpath . '/f/parent.gif" height="16" width="16" alt="' . get_string('parentfolder') . '" /></a> <a href="' . $dir->url . '">' . get_string('parentfolder') . '</a>', 'name'); } print_cell(); print_cell(); } } else { $pdir = urlencode($dir->title); $fileurl = $dir->uuid; //$filename = $fullpath."/".$dir; //$fileurl = $wdir."/".$dir; $filedate = userdate($dir->modified, "%d %b %Y, %I:%M %p"); echo "<tr>"; if ($usecheckboxes) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" onclick=\"return set_rename('{$dir->title}');\" />"); } $astr = $CFG->wwwroot . '/file/repository/alfresco/coursefiles.php?id=' . $id . '&oid=' . $oid . '&uuid=' . $fileurl . '&shared=' . $shared . '&userid=' . $userid . '&wdir=/&usecheckboxes=' . $usecheckboxes . '" ' . 'onclick=" return reset_value();"'; print_cell('left', '<a href="' . $astr . '><img src="' . $CFG->pixpath . '/f/folder.gif" class="icon" ' . 'alt=""' . get_string('folder') . '" /></a> <a href="' . $astr . '>' . htmlspecialchars($dir->title) . '</a>'); print_cell("right", " "); print_cell("right", $filedate); } echo "</tr>"; } } if (!empty($filelist)) { foreach ($filelist as $file) { $icon = mimeinfo('icon', $file->title); $imgtype = mimeinfo('type', $file->title); $count++; $filename = $fullpath . "/" . $file->title; $fileurl = "{$file->uuid}"; $filedate = userdate($file->modified, "%d %b %Y, %I:%M %p"); $dimensions = get_image_size($file->uuid); if ($dimensions) { $imgwidth = $dimensions[0]; $imgheight = $dimensions[1]; } else { $imgwidth = "Unknown"; $imgheight = "Unknown"; } unset($dimensions); echo "<tr>\n"; if ($usecheckboxes) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" onclick=\";return set_rename('{$file->title}');\" />"); } echo "<td align=\"left\" nowrap=\"nowrap\">"; $ffurl = $CFG->wwwroot . '/file/repository/' . $CFG->repository . '/openfile.php?uuid=' . $file->uuid; link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfile}\" />", 480, 640); $file_size = $file->filesize; echo "<a onclick=\"return set_value(info = {url: '" . $ffurl . "',"; echo " isize: '" . $file_size . "', itype: '" . $imgtype . "', iwidth: '" . $imgwidth . "',"; echo " iheight: '" . $imgheight . "', imodified: '" . $filedate . "' })\" href=\"#\">{$file->title}</a>"; echo "</td>\n"; if ($icon == "zip.gif") { $edittext = "<a href=\"{$CFG->wwwroot}/file/repository/alfresco/coursefiles.php?id={$id}&userid={$userid}&oid={$oid}&shared={$shared}&uuid={$file->uuid}&action=unzip&sesskey={$USER->sesskey}\">{$strunzip}</a> "; $edittext .= "<a href=\"{$CFG->wwwroot}/file/repository/alfresco/coursefiles.php?id={$id}&userid={$userid}&oid={$oid}&shared={$shared}&uuid={$file->uuid}&action=listzip&sesskey={$USER->sesskey}\">{$strlist}</a> "; } else { $edittext = " "; } print_cell("right", "{$edittext} "); print_cell("right", $filedate); echo "</tr>\n"; } } echo "</table>\n"; if (empty($wdir)) { $wdir = "/"; } echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n"; echo "<tr>\n<td>"; echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n"; echo "<input type=\"hidden\" name=\"oid\" value=\"{$oid}\" />\n"; echo "<input type=\"hidden\" name=\"shared\" value=\"{$shared}\" />\n"; echo "<input type=\"hidden\" name=\"userid\" value=\"{$userid}\" />\n"; echo "<input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\" />\n"; echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />\n"; $options = array("delete" => "{$strdeletecompletely}", "zip" => "{$strcreateziparchive}"); if (!empty($count)) { choose_from_menu($options, "action", "", "{$strwithchosenfiles}...", "javascript:getElementById('dirform').submit()"); } echo "</td></tr>\n"; echo "</table>\n"; echo "</form>\n"; }
$embed_code = wp_oembed_get($source); if ($embed_code) $embedded = $embed_code; else $embedded = do_shortcode($source); if (isset($mpost['link'])) echo '<a href="'.$mpost['link'].'" class="video">'.$embedded.'<div class="video link"></div></a>'; else echo $embedded; } } else { if (isset($mpost['link'])) echo '<a href="'.$mpost['link'].'" class="video pushed">'.wp_get_attachment_image( $imgID, get_image_size($getsize), 0, array('class' => "attachment-full") ).'<div class="video link"></div></a>'; else { ?> <a href="<?php echo $image_attributes[0]; ?>" class="fresco pushed" data-fresco-group='<?php echo( basename(get_permalink()) ); ?>' data-fresco-caption="<?php echo $caption; ?>"<?php echo $panning; ?><?php echo $thumbs; ?>><?php echo wp_get_attachment_image( $imgID, get_image_size($getsize), 0, array('class' => "attachment-full fresco") ); ?></a> <?php } } ?> </div> </div> </div> <?php } } ?> </div> <!-- isotope --> </div> <!-- container-isotope --> <?php
<?php if ( has_post_thumbnail() && $thumbON ) { ?> <div class="entry-thumb<?php if ($titleON) echo ' wplus'; ?>" data-overlay="<?php if ($titleON) echo ''; else echo get_the_title(); ?>"> <?php $image_attributes = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'full' ); $imgurl = $image_attributes[0]; $urlquery = parse_url($imgurl); if (isset($urlquery['query'])) { parse_str($urlquery['query'], $output); if (isset($output['resize'])) { $imgsize = explode(",", $output['resize']); $image_attributes[1] = $imgsize[0]; $image_attributes[2] = $imgsize[1]; } } ?> <div class="dummy" style="margin-top: <?php echo get_dummy_height($image_attributes[1],$image_attributes[2]); ?>%"></div> <a href="<?php the_permalink(); ?>" class="pushed"><?php the_post_thumbnail(get_image_size($colwidth)); ?></a> </div> <?php } ?> <?php if ( $titleON || $contentON) { ?> <div class="entry-text-cont"> <?php if ($titleON) { ?> <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php } ?> <?php if ($contentON) { ?> <div class="entry-text"> <?php if ( ! has_excerpt() ) the_content(); else the_excerpt(); ?> </div> <?php } ?>
public function main() { //init controller data $this->extensions->hk_InitData($this, __FUNCTION__); $this->data['title'] = $this->document->getTitle(); $this->data['template'] = $this->config->get('config_storefront_template'); $this->data['breadcrumbs'] = $this->document->getBreadcrumbs(); $this->data['store'] = $this->config->get('store_name'); $this->data['logo'] = $this->config->get('config_logo'); $logo_path = DIR_RESOURCE . $this->data['logo']; //see if we have a resource ID instead of path if (is_numeric($this->data['logo'])) { $resource = new AResource('image'); $image_data = $resource->getResource($this->data['logo']); $img_sub_path = $image_data['type_name'] . '/' . $image_data['resource_path']; if (is_file(DIR_RESOURCE . $img_sub_path)) { $this->data['logo'] = $img_sub_path; $logo_path = DIR_RESOURCE . $img_sub_path; } else { $this->data['logo'] = $image_data['resource_code']; } } //get logo image dimensions $info = get_image_size($logo_path); $this->data['logo_width'] = $info['width']; $this->data['logo_height'] = $info['height']; $this->data['text_special'] = $this->language->get('text_special'); $this->data['text_contact'] = $this->language->get('text_contact'); $this->data['text_sitemap'] = $this->language->get('text_sitemap'); $this->data['text_bookmark'] = $this->language->get('text_bookmark'); $this->data['text_category'] = $this->language->get('text_category'); $this->data['text_advanced'] = $this->language->get('text_advanced'); $this->data['entry_search'] = $this->language->get('entry_search'); $this->data['button_go'] = $this->language->get('button_go'); $this->data['homepage'] = HTTPS === true ? $this->config->get('config_ssl_url') : $this->config->get('config_url'); $this->data['special'] = $this->html->getURL('product/special'); $this->data['contact'] = $this->html->getURL('content/contact'); $this->data['sitemap'] = $this->html->getURL('content/sitemap'); $this->data['logged'] = $this->customer->isLogged(); $this->data['checkout'] = $this->html->getSecureURL('checkout/shipping'); if (isset($this->request->get['category_id'])) { $this->data['category_id'] = $this->request->get['category_id']; } elseif (isset($this->request->get['path'])) { $path = explode('_', $this->request->get['path']); $this->data['category_id'] = end($path); } else { $this->data['category_id'] = ''; } $this->data['advanced'] = $this->html->getURL('product/search'); $this->data['action'] = $this->html->getURL('index/home'); if (!isset($this->request->get['rt'])) { $this->data['redirect'] = $this->html->getURL('index/home'); } else { $this->loadModel('tool/seo_url'); $data = $this->request->get; unset($data['_route_']); $route = $data['rt']; unset($data['rt']); $url = ''; if ($data) { $url = '&' . urldecode(http_build_query($data)); } $this->data['redirect'] = $this->html->getSEOURL($route, $url, '&encode'); } $this->data['language_code'] = $this->session->data['language']; $this->data['languages'] = array(); $this->data['languages'] = $this->language->getActiveLanguages(); $this->data['currency_code'] = $this->currency->getCode(); $this->loadModel('localisation/currency'); $this->data['currencies'] = array(); $this->data['search'] = $this->html->buildInput(array('name' => 'filter_keyword', 'value' => isset($this->request->get['keyword']) ? $this->request->get['keyword'] : $this->language->get('text_keyword'), 'attr' => !isset($this->request->get['keyword']) ? ' onclick="this.value=\'\'" ' : '')); $results = $this->model_localisation_currency->getCurrencies(); foreach ($results as $result) { if ($result['status']) { $this->data['currencies'] = array('title' => $result['title'], 'code' => $result['code']); } } $this->view->batchAssign($this->data); $this->processTemplate('common/header.tpl'); //init controller data $this->extensions->hk_UpdateData($this, __FUNCTION__); }
$checkinfo = false; $ActionMessage = $strLogo . $strImgTypeMemo; } if ($checkinfo && !check_image_type($_FILES["favicon"]["name"])) { $checkinfo = false; $ActionMessage = $strFavicon . $strImgTypeMemo; } if ($_FILES["logo"]["name"] != "" && $checkinfo) { $arrISize = get_image_size($_FILES["logo"]["tmp_name"]); /*if ($arrISize[1]>100 && $arrISize[3]>100) { $checkinfo=false; $ActionMessage=$strLogoMemo; }*/ } if ($_FILES["favicon"]["name"] != "" && $checkinfo) { $arrISize = get_image_size($_FILES["favicon"]["tmp_name"]); /*if ($checkinfo && $arrISize[1]>100 && $arrISize[3]>100) { $checkinfo=false; $ActionMessage=$strFaviconMemo; }*/ } //Save if ($checkinfo) { //上传Logo && Favicon文件 if ($_FILES["logo"]["name"] == "") { $logo = $logo_hidden; } else { $logo = upload_file($logo_file, $_FILES["logo"]["name"], "../attachments"); } if ($_FILES["favicon"]["name"] == "") { $favicon = $favicon_hidden;
else $caption = ''; if (isset($slide['panning'])) $panning = ' data-fresco-options="fit: \'width\'"'; else $panning = ''; if (isset($getslides['lightbox_thumbnail'])) $thumbs = ' data-fresco-group-options="thumbnails:true"'; if ($counter == 1 && count($slides) > 1) echo '<div class="rest_collection">'; if (isset($slide['video'])) { ?> <a href="<?php echo $slide['video']; ?>" class="fresco pushed video<?php if ($counter == 0) echo ' firstel'; ?>" data-fresco-group='<?php echo get_the_title($mpost); ?>' data-fresco-caption="<?php echo $caption; ?>"<?php echo $thumbs; ?>><?php echo wp_get_attachment_image( $imgID, get_image_size($getsize), 0, array('class' => "attachment-full fresco") ); ?><div class="video"></div></a> <?php } else { ?> <a href="<?php echo $image_attributes[0]; ?>" class="pushed fresco<?php if ($counter == 0) echo ' firstel'; ?>" data-fresco-group='<?php echo get_the_title($mpost); ?>' data-fresco-caption="<?php echo $caption; ?>"<?php echo $panning; ?><?php echo $thumbs; ?>><?php echo wp_get_attachment_image( $imgID, get_image_size($getsize), 0, array('class' => "attachment-full fresco") ); ?></a> <?php } $counter++; if (count($slides) == $counter && count($slides) > 1) echo '</div>'; } } ?> </div> <?php if ( $titleON) { ?> <div class="entry-text-cont"> <h2 class="entry-title"><a href="#"><?php echo get_the_title($mpost); ?></a></h2> </div> <?php } ?> </div>
<?php } ?> </a> <?php } else if ($template_name == 'templates/gallery.php' && $slidethumb) { ?> <div class="span12"> <a href="<?php the_permalink(); ?>"> <div class="flexslider"> <ul class="slides"> <?php $gallery_mb->the_meta($post->ID); $gimages = $gallery_mb->get_the_value('slides'); if (is_array($gimages)) { foreach($gimages as &$gimage) { if (isset($gimage['imgurl'])) { $imgID = $gimage['imgurl']; echo '<li>'.wp_get_attachment_image( $imgID, get_image_size($size), 0).'</li>'; } else if (isset($gimage['video'])) { remove_filter('the_content','wpautop', 12); $output = apply_filters('the_content', $gimage['video']); add_filter('the_content','wpautop', 12); echo '<li>'.$output.'</li>'; } } } ?> </ul> </div> </a> <?php } else { ?> <div class="span12 <?php if ($audio || $image) echo $format; ?>"> <?php
<?php include 'head.php'; include 'form-submit.php'; $action = $_GET['action']; $table = $_GET['table']; $slug = $_GET['slug']; $noun = ucfirst(substr($table, 0, -1)); // noun for what is being edited. artist, etc if ($action == "edit") { $content = get_row($table, 'slug', $slug); $pic = get_image_size('small', $content['pic']); $view_link = " / <a href='{$site_url}/{$table}/{$slug}'>View Page</a>"; } ?> <body> <?php include 'sidebar.php'; ?> <div id="content"> <?php // print_r($content); ?> <h1> <?php echo $_GET['action'] . " " . $noun; echo $view_link;
*/ function close_temp_file($filename, $handle) { fclose($handle); chmod($filename, 0666); } /** * 処理本体 * biz_shisetsuは、member_idを持っていないため、設定不可 * array([category] => array([table],[filename field],[c_member_id field]) */ $category_list = array('album' => array(array('c_album_image', 'image_filename', 'c_member_id')), 'commu' => array(array('c_commu_topic_comment', 'image_filename1', 'c_member_id'), array('c_commu_topic_comment', 'image_filename2', 'c_member_id'), array('c_commu_topic_comment', 'image_filename3', 'c_member_id')), 'diary' => array(array('c_diary', 'image_filename_1', 'c_member_id'), array('c_diary', 'image_filename_2', 'c_member_id'), array('c_diary', 'image_filename_3', 'c_member_id'), array('c_diary_comment', 'image_filename_1', 'c_member_id'), array('c_diary_comment', 'image_filename_2', 'c_member_id'), array('c_diary_comment', 'image_filename_3', 'c_member_id'), array('c_album', 'album_cover_image', 'c_member_id')), 'other' => array(array('c_commu', 'image_filename', 'c_member_id_admin'), array('biz_group', 'image_filename', 'admin_id'), array('biz_shisetsu', 'image_filename', 'c_member_id'), array('c_member', 'image_filename_1', 'c_member_id'), array('c_member', 'image_filename_2', 'c_member_id'), array('c_member', 'image_filename_3', 'c_member_id'), array('c_message', 'image_filename_1', 'c_member_id_from'), array('c_message', 'image_filename_2', 'c_member_id_from'), array('c_message', 'image_filename_3', 'c_member_id_from'))); // Insert格納用テンポラリファイル作成 list($filename, $handle) = open_temp_file('w'); //テーブル分ループ foreach ($category_list as $category => $table_list) { // サイズ取り出し // 1テーブルづつInsert文を作成していく foreach ($table_list as $target) { get_image_size($category, $target, $handle); } } // テンポラリファイルクローズ close_temp_file($filename, $handle); // Insert実行 load_data_infile($filename); echo 'Complete!'; ?>
function get_image_by_template($template = '', $before = '', $after = '') { if ($template == '' || $template == 'default') { $template = '<img width="%IMAGE_WIDTH%" height="%IMAGE_HEIGHT%" id="%IMAGE_ID%" src="%IMAGE_URL%" alt="%IMAGE_FILENAME%" />'; } $template = $before . $template . $after; $patterns = array('IMAGE_ID' => get_image_id(), 'IMAGE_REAL_ID' => get_image_real_id(), 'IMAGE_FILENAME' => get_image_filename(), 'IMAGE_URL' => get_image_url(), 'IMAGE_VIEWER' => get_image_viewer(), 'IMAGE_SHORTURL' => get_image_shorturl(), 'IMAGE_WIDTH' => get_image_width(), 'IMAGE_HEIGHT' => get_image_height(), 'IMAGE_SIZE' => get_image_size(), 'IMAGE_SIZE_BYTES' => get_image_size_bytes(), 'IMAGE_THUMB_WIDTH' => get_image_thumb_width(), 'IMAGE_THUMB_HEIGHT' => get_image_thumb_height(), 'IMAGE_THUMB_URL' => get_image_thumb_url()); return preg_replace('/%([a-z_]+)%/ie', '$patterns["$1"]', $template); }
/** * Calculate the HTML for showing the thumb of a post item. * * Used as a filter for the thumb wordpress API to add css based stretching and cropping * when the image is not at the requested dimensions * * @param string $html The original HTML generated by the core APIS * @param int $post_id the ID of the post of which the thumb is a featured image * @param int $post_thumbnail_id The id of the featured image attachment * @param string|array $size The requested size identified by name or (width, height) array * @param mixed $attr ignored in this context * @return string The HTML for the thumb related to the post * * @since 4.1 */ function post_thumbnail_html($html, $post_id, $post_thumbnail_id, $size, $attr) { if (empty($this->instance['thumb_w']) || empty($this->instance['thumb_h'])) { return $html; } // bail out if no full dimensions defined $meta = image_get_intermediate_size($post_thumbnail_id, $size); if (empty($meta)) { $post_img = wp_get_attachment_metadata($post_thumbnail_id, $size); $meta['file'] = basename($post_img['file']); } $origfile = get_attached_file($post_thumbnail_id, true); // the location of the full file $file = dirname($origfile) . '/' . $meta['file']; // the location of the file displayed as thumb list($width, $height) = getimagesize($file); // get actual size of the thumb file if ($width / $height == $this->instance['thumb_w'] / $this->instance['thumb_h']) { // image is same ratio as asked for, nothing to do here as the browser will handle it correctly } else { if (isset($this->instance['use_css_cropping']) && $this->instance['use_css_cropping']) { $image = get_image_size($this->instance['thumb_w'], $this->instance['thumb_h'], $width, $height); // replace srcset $array = array(); preg_match('/width="([^"]*)"/i', $html, $array); $pattern = "/" . $array[1] . "w/"; $html = preg_replace($pattern, $image['image_w'] . "w", $html); // replace size $pattern = "/" . $array[1] . "px/"; $html = preg_replace($pattern, $image['image_w'] . "px", $html); // replace width $pattern = "/width=\"[0-9]*\"/"; $html = preg_replace($pattern, "width='" . $image['image_w'] . "'", $html); // replace height $pattern = "/height=\"[0-9]*\"/"; $html = preg_replace($pattern, "height='" . $image['image_h'] . "'", $html); // set margin $html = str_replace('<img ', '<img style="' . $image['marginAttr'] . ':-' . $image['marginVal'] . 'px;height:' . $image['image_h'] . 'px;clip:rect(auto,' . ($this->instance['thumb_w'] + $image['marginVal']) . 'px,auto,' . $image['marginVal'] . 'px);width:auto;max-width:initial;" ', $html); // wrap span $html = '<span style="width:' . $this->instance['thumb_w'] . 'px;height:' . $this->instance['thumb_h'] . 'px;">' . $html . '</span>'; } else { // if use_css_cropping not used // no interface changes: leave without change } } return $html; }
/** * method returns all resources of object by it's id and name * @param string $object_name * @param string $object_id * @param array $sizes * @param int $limit * @param bool $noimage * @return array */ public function getResourceAllObjects($object_name, $object_id, $sizes = array('main' => array(), 'thumb' => array(), 'thumb2' => array()), $limit = 0, $noimage = true) { if (!$object_id || !$object_name) { return array(); } $limit = (int) $limit; $results = $this->getResources($object_name, $object_id); if (!$results && !$limit) { return array(); } if ($limit && !$noimage) { $slice_limit = $limit > sizeof($results) ? sizeof($results) : $limit; $results = array_slice($results, 0, $slice_limit); } $this->load->model('tool/image'); if (!$sizes || !is_array($sizes['main']) || !is_array($sizes['thumb'])) { if (!is_array($sizes['main'])) { $sizes['main'] = array('width' => $this->config->get('config_image_product_width'), 'height' => $this->config->get('config_image_product_height')); } if (!is_array($sizes['thumb'])) { $sizes['thumb'] = array('width' => $this->config->get('config_image_thumb_width'), 'height' => $this->config->get('config_image_thumb_height')); } } $resources = array(); if (!$results && $noimage) { $results = array(array('resource_path' => 'no_image.jpg')); } if (!$results) { return array(); } foreach ($results as $k => $result) { $thumb_url = $thumb2_url = ''; $resource_info = $result['resource_id'] ? $this->getResource($result['resource_id'], $this->config->get('storefront_language_id')) : $result; $origin = $resource_info['resource_path'] ? 'internal' : 'external'; if ($origin == 'internal') { $this->extensions->hk_ProcessData($this, __FUNCTION__); $http_path = $this->data['http_dir']; if (!$http_path) { $http_path = HTTPS_DIR_RESOURCE; } if ($this->getType() == 'image') { $res_full_path = DIR_RESOURCE . $this->getTypeDir() . $result['resource_path']; if ($sizes['main']) { $main_url = $this->getResourceURL($result, $sizes['main']['width'], $sizes['main']['height']); } else { // return href for image with size as-is $main_url = $http_path . $this->getTypeDir() . $result['resource_path']; //get original image size $actual_sizes = get_image_size($res_full_path); $sizes['main'] = $actual_sizes; } if ($sizes['thumb']) { $thumb_url = $this->getResourceURL($result, $sizes['thumb']['width'], $sizes['thumb']['height']); } if (!$thumb_url && $sizes['thumb']) { $thumb_url = $this->model_tool_image->resize($result['resource_path'], $sizes['thumb']['width'], $sizes['thumb']['height']); } //thumb2 - big thumbnails if ($sizes['thumb2']) { $thumb2_url = $this->getResourceURL($result, $sizes['thumb2']['width'], $sizes['thumb2']['height']); } if (!$thumb2_url && $sizes['thumb2']) { $thumb2_url = $this->model_tool_image->resize($result['resource_path'], $sizes['thumb2']['width'], $sizes['thumb2']['height']); } } else { $main_url = $http_path . $this->getTypeDir() . $result['resource_path']; } $resources[$k] = array('origin' => $origin, 'main_url' => $main_url, 'main_width' => $sizes['main']['width'], 'main_height' => $sizes['main']['height'], 'main_html' => $this->html->buildResourceImage(array('url' => $http_path . 'image/' . $result['resource_path'], 'width' => $sizes['main']['width'], 'height' => $sizes['main']['height'], 'attr' => 'alt="' . $resource_info['title'] . '"')), 'thumb_url' => $thumb_url, 'thumb_width' => $sizes['thumb']['width'], 'thumb_height' => $sizes['thumb']['height'], 'thumb_html' => $this->html->buildResourceImage(array('url' => $thumb_url, 'width' => $sizes['thumb']['width'], 'height' => $sizes['thumb']['height'], 'attr' => 'alt="' . $resource_info['title'] . '"'))); if ($sizes['thumb2']) { $resources[$k]['thumb2_url'] = $thumb2_url; $resources[$k]['thumb2_width'] = $sizes['thumb2']['width']; $resources[$k]['thumb2_height'] = $sizes['thumb2']['height']; $resources[$k]['thumb2_html'] = $this->html->buildResourceImage(array('url' => $thumb2_url, 'width' => $sizes['thumb2']['width'], 'height' => $sizes['thumb2']['height'], 'attr' => 'alt="' . $resource_info['title'] . '"')); } $resources[$k]['description'] = $resource_info['description']; $resources[$k]['title'] = $resource_info['title']; } else { $resources[$k] = array('origin' => $origin, 'main_html' => $resource_info['resource_code'], 'thumb_html' => $resource_info['resource_code'], 'title' => $resource_info['title'], 'description' => $resource_info['description']); } } if ($limit == 1) { $resources = $resources[0]; } return $resources; }
<?php } else { $image_attributes = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' ); $imgurl = $image_attributes[0]; $urlquery = parse_url($imgurl); if (isset($urlquery['query'])) { parse_str($urlquery['query'], $output); if (isset($output['resize'])) { $imgsize = explode(",", $output['resize']); $image_attributes[1] = $imgsize[0]; $image_attributes[2] = $imgsize[1]; } } ?> <div class="dummy" style="margin-top: <?php echo get_dummy_height($image_attributes[1],$image_attributes[2]); ?>%"></div> <a href="<?php the_permalink(); ?>" class="video pushed"><?php the_post_thumbnail(get_image_size($size)); ?> <?php if ($video) echo '<div class="video"></div>'; ?></a> <?php } ?> </div> <?php } ?> <?php if ( $titleON || $contentON) { ?> <div class="entry-text-cont"> <?php if ($titleON && !$quote) { ?> <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php } ?> <?php if ($contentON) { if ($dateON && !$quote) { ?> <div class="entry-meta"> <?php echo get_the_time(get_option('date_format')); ?>
<?php include 'head.php'; include 'form-submit.php'; $slug = $_GET['slug']; $content = get_row('headers', 'slug', $slug); $pic = get_image_size('large', $content['pic']); ?> <body> <?php include 'sidebar.php'; ?> <div id="content"> <h1> Edit Header: <?php echo ucfirst($slug); ?> </h1> <form method='post' enctype="multipart/form-data"> <!-- Hidden form fields --> <!-- Tells form-submit.php what table to update --> <input type="hidden" name="table" value="headers" /> <!-- edit an entry --> <input type="hidden" name="action" value="edit" />
$check_info = 0; $action = $mark_id != "" ? "edit" : "add"; } if ($check_info == 1 && trim($_POST['linkUrl']) == "") { $ActionMessage = $strErrNull; $check_info = 0; $action = $mark_id != "" ? "edit" : "add"; } //检测链接图片的尺寸 if ($check_info == 1 && !check_image_type($_FILES["linkImage"]["name"])) { $check_info = 0; $action = $mark_id != "" ? "edit" : "add"; $ActionMessage = $strCategoryImage . $strImgTypeMemo; } if ($check_info == 1 && $_FILES["linkImage"]["name"] != "") { $arrISize = get_image_size($_FILES["linkImage"]["tmp_name"]); if ($arrISize[1] > 16 && $arrISize[3] > 16) { $check_info = 0; $ActionMessage = $strCategoryImageError; $action = $mark_id != "" ? "edit" : "add"; } else { //上传图片 $linkImage = upload_file($_FILES["linkImage"]["tmp_name"], $_FILES["linkImage"]["name"], "../attachments"); } } else { $linkImage = ""; } if ($check_info == 1) { if ($mark_id != "") { //编辑 $rsexits = getFieldValue($DBPrefix . "keywords", "keyword='" . encode($_POST['name']) . "'", "id");
<?php } else { $source = $portfolio_mb->get_the_value('video'); $embed_code = wp_oembed_get($source); if ($embed_code) $embedded = $embed_code; else $embedded = do_shortcode($source); if ($portfolio_mb->get_the_value('link')) echo '<a href="'.$portfolio_mb->get_the_value('link').'" class="video">'.$embedded.'<div class="video link"></div></a>'; else echo $embedded; } } else { if ($portfolio_mb->get_the_value('link')) echo '<a href="'.$portfolio_mb->get_the_value('link').'" class="video">'.$image_code.'<div class="video link"></div></a>'; else { echo $dummy_code; ?> <a href="<?php echo $imgurl; ?>" class="fresco pushed" data-fresco-group='<?php echo( basename(get_permalink()) ); ?>' data-fresco-caption="<?php echo $caption; ?>"<?php echo $panning; ?> <?php echo $thumbs; ?>><?php if (is_numeric($imgID)) echo wp_get_attachment_image( $imgID, get_image_size($getsize), 0, array('class' => "attachment-full fresco", 'alt' => $alt) ); else echo '<img src="'.$imgID.'" alt="'.$alt.'" />'; ?></a> <?php } } $counter++; ?> </div> </div> </div> <?php } ?>