/** * Template tag * * Used to print out open graph tags */ function skin_opengraph_tags() { global $Blog, $disp, $MainList; if (empty($Blog) || !$Blog->get_setting('tags_open_graph')) { // Open Graph tags are not allowed return; } // Get info for og:image tag $og_images = array(); if (in_array($disp, array('single', 'page'))) { // Use only on 'single' and 'page' disp $Item =& $MainList->get_by_idx(0); if (is_null($Item)) { // This is not an object (happens on an invalid request): return; } $LinkOwner = new LinkItem($Item); if (!($LinkList = $LinkOwner->get_attachment_LinkList(1000))) { // Item has no linked files return; } while ($Link =& $LinkList->get_next()) { if (!($File =& $Link->get_File())) { // No File object global $Debuglog; $Debuglog->add(sprintf('Link ID#%d of item #%d does not have a file object!', $Link->ID, $Item->ID), array('error', 'files')); continue; } if (!$File->exists()) { // File doesn't exist global $Debuglog; $Debuglog->add(sprintf('File linked to item #%d does not exist (%s)!', $Item->ID, $File->get_full_path()), array('error', 'files')); continue; } if ($File->is_image()) { // Use only image files for og:image tag $og_images[] = $File->get_url(); } } } if (!empty($og_images)) { // Display meta tags for image: // Open Graph type tag (This tag is necessary for multiple images on facebook share button) echo '<meta property="og:type" content="article" />' . "\n"; foreach ($og_images as $og_image) { // Open Graph image tag echo '<meta property="og:image" content="' . format_to_output($og_image, 'htmlattr') . "\" />\n"; } } }
/** * Convert inline file tags like [image|file:123:link title:.css_class_name] or [inline:123:.css_class_name] into HTML img tags * * @param string Source content * @param array Params * @return string Content */ function render_inline_files($content, $params = array()) { if (isset($params['check_code_block']) && $params['check_code_block'] && (stristr($content, '<code') !== false || stristr($content, '<pre') !== false)) { // Call $this->render_inline_files() on everything outside code/pre: $params['check_code_block'] = false; $content = callback_on_non_matching_blocks($content, '~<(code|pre)[^>]*>.*?</\\1>~is', array($this, 'render_inline_files'), array($params)); return $content; } // No code/pre blocks, replace on the whole thing $params = array_merge(array('before' => '<div>', 'before_image' => '<div class="image_block">', 'before_image_legend' => '<div class="image_legend">', 'after_image_legend' => '</div>', 'after_image' => '</div>', 'after' => '</div>', 'image_size' => 'fit-400x320', 'image_link_to' => 'original', 'limit' => 1000), $params); // Find all matches with inline tags preg_match_all('/\\[(image|file|inline):(\\d+)(:?)([^\\]]*)\\]/i', $content, $inlines); if (!empty($inlines[0])) { // There are inline tags in the content if (!isset($LinkList)) { // Get list of attached Links only first time $LinkOwner = new LinkItem($this); $LinkList = $LinkOwner->get_attachment_LinkList($params['limit'], 'inline'); } if (empty($LinkList)) { // This Item has not the inline attached files, Exit here return $content; } foreach ($inlines[0] as $i => $current_link_tag) { $inline_type = $inlines[1][$i]; // image|file|inline $current_link_ID = (int) $inlines[2][$i]; if (empty($current_link_ID)) { // Invalid link ID, Go to next match continue; } if (!($Link =& $LinkList->get_by_field('link_ID', $current_link_ID))) { // Link is not found by ID continue; } if (!($File =& $Link->get_File())) { // No File object global $Debuglog; $Debuglog->add(sprintf('Link ID#%d of item #%d does not have a file object!', $Link->ID, $this->ID), array('error', 'files')); continue; } if (!$File->exists()) { // File doesn't exist global $Debuglog; $Debuglog->add(sprintf('File linked to item #%d does not exist (%s)!', $this->ID, $File->get_full_path()), array('error', 'files')); continue; } $current_image_params = $params; $current_file_params = array(); if (!empty($inlines[3][$i])) { // Get the inline params: caption and class $inline_params = explode(':.', $inlines[4][$i]); if (!empty($inline_params[0])) { // Image caption is set, so overwrite the image link title if ($inline_params[0] == '-') { // Image caption display is disabled $current_image_params['image_link_title'] = ''; $current_image_params['hide_image_link_title'] = true; } else { // New image caption was set $current_image_params['image_link_title'] = strip_tags($inline_params[0]); } $current_image_params['image_desc'] = $current_image_params['image_link_title']; $current_file_params['title'] = $inline_params[0]; } $class_index = $inline_type == 'inline' ? 0 : 1; // [inline] tag doesn't have a caption, so 0 index is for class param if (!empty($inline_params[$class_index])) { // A class name is set for the inline tags $image_extraclass = strip_tags(trim(str_replace('.', ' ', $inline_params[$class_index]))); if (preg_match('#^[A-Za-z0-9\\s\\-_]+$#', $image_extraclass)) { // Overwrite 'before_image' setting to add an extra class name $current_image_params['before_image'] = '<div class="image_block ' . $image_extraclass . '">'; // 'after_image' setting must be also defined, becuase it may be different than the default '</div>' $current_image_params['after_image'] = '</div>'; // Set class for file inline tags $current_file_params['class'] = $image_extraclass; } } } if ($inline_type == 'image' && $File->is_image()) { // Generate the IMG tag with all the alt, title and desc if available $link_tag = $this->get_attached_image_tag($Link, $current_image_params); } elseif ($inline_type == 'inline') { // Generate simple IMG tag with original image size if ($File->is_image()) { // Only when file is really image file $link_tag = '<img src="' . $File->get_url() . '"' . (empty($current_file_params['class']) ? '' : ' class="' . $current_file_params['class'] . '"') . ' />'; } else { // Display original inline tag when file is not image $link_tag = $current_link_tag; } } else { // Display icon+caption if file is not an image if (empty($current_file_params['title'])) { // Use real file name as title when it is not defined for inline tag $file_title = $File->get('title'); $current_file_params['title'] = ' ' . (empty($file_title) ? $File->get_name() : $file_title); } elseif ($current_file_params['title'] == '-') { // Don't display a title in this case, Only file icon will be displayed $current_file_params['title'] = ''; } else { // Add a space between file icon and title $current_file_params['title'] = ' ' . $current_file_params['title']; } $link_tag = '<a href="' . $File->get_url() . '"' . (empty($current_file_params['class']) ? '' : ' class="' . $current_file_params['class'] . '"') . '>' . $File->get_icon($current_file_params) . $current_file_params['title'] . '</a>'; } // Replace inline image tag with HTML img tag $content = str_replace($current_link_tag, $link_tag, $content); } } return $content; }
/** * Display images of the selected item * * @param array Params * @param boolean Changed by reference when content is displayed */ function disp_images($params = array(), &$content_is_displayed) { $params = array_merge(array('before' => '', 'after' => '', 'placeholder' => '', 'Item' => NULL, 'start' => 1, 'limit' => 1, 'restrict_to_image_position' => 'teaser,teaserperm,teaserlink,aftermore,inline', 'links_sql_select' => '', 'links_sql_orderby' => 'link_order'), $params); $links_params = array('sql_select_add' => $params['links_sql_select'], 'sql_order_by' => $params['links_sql_orderby']); $disp_Item =& $params['Item']; // Get list of ALL attached files: $LinkOwner = new LinkItem($disp_Item); $images = ''; if ($LinkList = $LinkOwner->get_attachment_LinkList($params['limit'], $params['restrict_to_image_position'], 'image', $links_params)) { // Get list of attached files $image_num = 1; while ($Link =& $LinkList->get_next()) { if (($File =& $Link->get_File()) && $File->is_image()) { // Get only images if ($image_num < $params['start']) { // Skip these first images $image_num++; continue; } switch ($this->disp_params['item_pic_link_type']) { // Set url for picture link case 'none': $pic_url = NULL; break; case 'permalink': $pic_url = $disp_Item->get_permanent_url(); break; case 'linkto_url': $pic_url = $disp_Item->url; break; case 'auto': default: $pic_url = empty($disp_Item->url) ? $disp_Item->get_permanent_url() : $disp_Item->url; break; } // Print attached picture $images .= $File->get_tag('', '', '', '', $this->disp_params['thumb_size'], $pic_url); $content_is_displayed = true; $image_num++; } } } if (!empty($images)) { // Print out images only when at least one exists echo $params['before']; echo $images; echo $params['after']; } else { // Display placeholder if no images: // Replace mask $item_permaurl$ with the item permanent URL: echo str_replace('$item_permaurl$', $disp_Item->get_permanent_url(), $params['placeholder']); } }
// ------------------------- MESSAGES GENERATED FROM ACTIONS ------------------------- messages(array('block_start' => '<div class="action_messages">', 'block_end' => '</div>')); // --------------------------------- END OF MESSAGES --------------------------------- } // ------------------- PREV/NEXT POST LINKS (SINGLE POST MODE) ------------------- item_prevnext_links(array('block_start' => '<nav><ul class="pager">', 'prev_start' => '<li class="previous">', 'prev_end' => '</li>', 'next_start' => '<li class="next">', 'next_end' => '</li>', 'block_end' => '</ul></nav>')); // ------------------------- END OF PREV/NEXT POST LINKS ------------------------- // ------------------------ TITLE FOR THE CURRENT REQUEST ------------------------ request_title(array('title_before' => '<h2 class="page_title">', 'title_after' => '</h2>', 'title_none' => '', 'glue' => ' - ', 'title_single_disp' => false, 'title_page_disp' => false, 'format' => 'htmlbody', 'register_text' => '', 'login_text' => '', 'lostpassword_text' => '', 'account_activation' => '', 'msgform_text' => '', 'user_text' => '', 'users_text' => '', 'display_edit_links' => false)); // ----------------------------- END OF REQUEST TITLE ---------------------------- // Go Grab the featured post: if (!in_array($disp, array('single', 'page')) && ($Item =& get_featured_Item())) { // We have a featured/intro post to display: $intro_item_style = ''; $LinkOwner = new LinkItem($Item); $LinkList = $LinkOwner->get_attachment_LinkList(1, 'cover'); if (!empty($LinkList) && ($Link =& $LinkList->get_next()) && ($File =& $Link->get_File()) && $File->exists() && $File->is_image()) { // Use cover image of intro-post as background: $intro_item_style = 'background-image: url("' . $File->get_url() . '")'; } // ---------------------- ITEM BLOCK INCLUDED HERE ------------------------ skin_include('_item_block.inc.php', array('feature_block' => true, 'content_mode' => 'full', 'intro_mode' => 'normal', 'item_class' => ($Item->is_intro() ? 'well evo_intro_post' : 'well evo_featured_post') . (empty($intro_item_style) ? '' : ' evo_hasbgimg'), 'item_style' => $intro_item_style)); // ----------------------------END ITEM BLOCK ---------------------------- } // -------------- MAIN CONTENT TEMPLATE INCLUDED HERE (Based on $disp) -------------- skin_include('$disp$', array('author_link_text' => 'preferredname', 'profile_tabs' => array('block_start' => '<nav><ul class="nav nav-tabs profile_tabs">', 'item_start' => '<li>', 'item_end' => '</li>', 'item_selected_start' => '<li class="active">', 'item_selected_end' => '</li>', 'block_end' => '</ul></nav>'), 'pagination' => array('block_start' => '<div class="center"><ul class="pagination">', 'block_end' => '</ul></div>', 'page_current_template' => '<span>$page_num$</span>', 'page_item_before' => '<li>', 'page_item_after' => '</li>', 'page_item_current_before' => '<li class="active">', 'page_item_current_after' => '</li>', 'prev_text' => '<i class="fa fa-angle-left"></i>', 'next_text' => '<i class="fa fa-angle-right"></i>'), 'url_link_position' => 'top', 'skin_form_before' => '<div class="panel panel-default skin-form">' . '<div class="panel-heading">' . '<h3 class="panel-title">$form_title$</h3>' . '</div>' . '<div class="panel-body">', 'skin_form_after' => '</div></div>', 'display_form_messages' => true, 'form_title_login' => T_('Log in to your account') . '$form_links$', 'form_title_lostpass' => get_request_title() . '$form_links$', 'lostpass_page_class' => 'evo_panel__lostpass', 'login_form_inskin' => false, 'login_page_class' => 'evo_panel__login', 'login_page_before' => '<div class="$form_class$">', 'login_page_after' => '</div>', 'display_reg_link' => true, 'abort_link_position' => 'form_title', 'abort_link_text' => '<button type="button" class="close" aria-label="Close"><span aria-hidden="true">×</span></button>', 'register_page_before' => '<div class="evo_panel__register">', 'register_page_after' => '</div>', 'register_form_title' => T_('Register'), 'register_links_attrs' => '', 'register_use_placeholders' => true, 'register_field_width' => 252, 'register_disabled_page_before' => '<div class="evo_panel__register register-disabled">', 'register_disabled_page_after' => '</div>', 'activate_form_title' => T_('Account activation'), 'activate_page_before' => '<div class="evo_panel__activation">', 'activate_page_after' => '</div>', 'search_input_before' => '<div class="input-group">', 'search_input_after' => '', 'search_submit_before' => '<span class="input-group-btn">', 'search_submit_after' => '</span></div>', 'featured_intro_before' => '<div class="jumbotron">', 'featured_intro_after' => '</div>', 'msgform_form_title' => T_('Sending a message'))); // Note: you can customize any of the sub templates included here by // copying the matching php file into your skin directory. // ------------------------- END OF MAIN CONTENT TEMPLATE --------------------------- ?> </div><!-- .col -->