/** * 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"; } } }
// Edit post echo sprintf(T_('If you need to attach additional files, please use <a %s>Advanced Edit</a>.'), $advanced_edit_link_params); } } else { // If current user has no permission to attach files to this post if ($creating) { // New post echo T_('If you need to attach files, please add a comment right after you post this.'); } else { // Edit post echo T_('If you need to attach additional files, please add a comment right after you edit this.'); } } echo '</div>'; if ($perm_attach) { $LinkOwner = new LinkItem($edited_Item); if ($LinkOwner->count_links()) { // Display the attached files: $Form->begin_fieldset(T_('Attachments'), array('id' => 'post_attachments')); display_attachments($LinkOwner); $Form->end_fieldset(); } } } // ####################### PLUGIN FIELDSETS ######################### $Plugins->trigger_event('DisplayItemFormFieldset', array('Form' => &$Form, 'Item' => &$edited_Item)); ?> <div class="clear"></div> <div class="center margin2ex">
/** * 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']); } }
/** * Support function for above * * @param Item * @return boolean TRUE - if content is displayed */ function disp_contents(&$disp_Item) { // Check if only the title was displayed before the first picture $displayed_only_title = false; // Set this var to TRUE when some content(title, excerpt or picture) is displayed $content_is_displayed = false; echo $this->disp_params['item_start']; // Is this the current item? global $disp, $Item; if (!empty($Item) && $disp_Item->ID == $Item->ID) { // The current page is currently displaying the Item this link is pointing to // Let's display it as selected $link_class = $this->disp_params['link_selected_class']; } else { // Default link class $link_class = $this->disp_params['link_default_class']; } if ($this->disp_params['disp_title']) { // Display title $disp_Item->title(array('link_type' => $this->disp_params['item_title_link_type'], 'link_class' => $link_class)); $displayed_only_title = true; $content_is_displayed = true; } if ($this->disp_params['disp_excerpt']) { $excerpt = $disp_Item->dget('excerpt', 'htmlbody'); if (!empty($excerpt)) { // Note: Excerpts are plain text -- no html (at least for now) echo '<div class="item_excerpt">' . $excerpt . '</div>'; $displayed_only_title = false; $content_is_displayed = true; } } if ($this->disp_params['disp_teaser']) { // we want to show some or all of the post content $content = $disp_Item->get_content_teaser(1, false, 'htmlbody'); if ($words = $this->disp_params['disp_teaser_maxwords']) { // limit number of words $content = strmaxwords($content, $words, array('continued_link' => $disp_Item->get_permanent_url(), 'continued_text' => '…')); } echo '<div class="item_content">' . $content . '</div>'; $displayed_only_title = false; $content_is_displayed = true; /* fp> does that really make sense? we're no longer in a linkblog/linkroll use case here, are we? $disp_Item->more_link( array( 'before' => '', 'after' => '', 'link_text' => T_('more').' »', ) ); */ } if (in_array($this->disp_params['attached_pics'], array('first', 'all'))) { // Display attached pictures $picture_limit = $this->disp_params['attached_pics'] == 'first' ? 1 : 1000; $LinkOnwer = new LinkItem($disp_Item); if ($FileList = $LinkOnwer->get_attachment_FileList($picture_limit)) { // Get list of attached files while ($File =& $FileList->get_next()) { if ($File->is_image()) { // Get only images 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; } if ($displayed_only_title) { // If only the title was displayed - Insert new line before the first picture echo '<br />'; $displayed_only_title = false; } // Print attached picture echo $File->get_tag('', '', '', '', $this->disp_params['thumb_size'], $pic_url); $content_is_displayed = true; } } } } echo $this->disp_params['item_end']; return $content_is_displayed; }
/** * 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; }
// Don't display the messages here because they are displayed inside wrapper to have the same width as form // ------------------------- 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 --------------------------- ?>
antispam_block_request(); // Create a post: $edited_Item = new Item(); $edited_Item->set('status', $item_status); $edited_Item->set('main_cat_ID', $Blog->get_default_cat_ID()); $l_File =& $selected_Filelist->get_next(); $title = $l_File->get('title'); if (empty($title)) { $title = $l_File->get('name'); } $edited_Item->set('title', $title); $DB->begin('SERIALIZABLE'); // INSERT NEW POST INTO DB: if ($edited_Item->dbinsert()) { $order = 1; $LinkOwner = new LinkItem($edited_Item); do { // LOOP through files: // echo '<br>file meta: '.$l_File->meta; if ($l_File->meta == 'notfound') { // That file has no meta data yet, create it now! $l_File->dbsave(); } // Let's make the link! $LinkOwner->add_link($l_File->ID, $order == 1 ? 'teaser' : 'aftermore', $order++); $Messages->add(sprintf(T_('«%s» has been attached.'), $l_File->dget('name')), 'success'); } while ($l_File =& $selected_Filelist->get_next()); $DB->commit(); } else { $Messages->add(T_('Couldn\'t create the new post'), 'error'); $DB->rollback();
/** * function createCache * <pre> * Create a cache entry for a given viewer_id and language_id * </pre> * @param $viewerID [OBJECT] the viewer object of the person to make a * cache entry for. * @return [void] */ function createCache($viewer) { $viewerID = $viewer->getID(); $languageID = $viewer->getLanguageID(); $groupArray = array(); // Make sure all required Row Managers are included $accountAdminPath = SITE_PATH_MODULES . 'site_AccountAdmin/objects_da/'; $navBarPath = SITE_PATH_MODULES . 'site_NavBar/objects_da/'; $pathToRoot = Page::findPathExtension($accountAdminPath); require_once $pathToRoot . $accountAdminPath . 'ViewerAccessGroupManager.php'; require_once $pathToRoot . $navBarPath . 'NavBarGroupManager.php'; require_once $pathToRoot . $navBarPath . 'NavLinkAccessGroupManager.php'; require_once $pathToRoot . $navBarPath . 'NavLinkViewerManager.php'; require_once $pathToRoot . $navBarPath . 'NavBarLinksManager.php'; // get list of Links linked to this viewer // array of links: link_id, link_text, link_url, group_id $viewerLinks = $this->getViewerLinks($viewerID, $languageID); // get list of Links linked to this viewer's groups // array of links: link_id, link_text, link_url, group_id $groupLinks = $this->getGroupLinks($viewerID, $languageID); /* * combine lists */ $combinedLinks = array(); $usedLinks = array(); // for each viewerLink for ($indx = 0; $indx < count($viewerLinks); $indx++) { // compute a link key $linkKey = $viewerLinks[$indx]['navbarlink_url'] . '[' . $viewerLinks[$indx]['module_id'] . ']'; // if this link key has not already been added (no duplicate links) if (!key_exists($linkKey, $usedLinks)) { $usedLinks[$linkKey] = $linkKey; $combinedLinks[] = $viewerLinks[$indx]; } } // for each groupLink for ($indx = 0; $indx < count($groupLinks); $indx++) { $linkKey = $groupLinks[$indx]['navbarlink_url'] . '[' . $groupLinks[$indx]['module_id'] . ']'; if (!key_exists($linkKey, $usedLinks)) { $usedLinks[$linkKey] = $linkKey; $combinedLinks[] = $groupLinks[$indx]; } } // for each link in combinedLinks for ($indx = 0; $indx < count($combinedLinks); $indx++) { // if groupObject in GroupArray then $groupID = (int) $combinedLinks[$indx]['navbargroup_id']; if (!key_exists($groupID, $groupArray)) { // create new group Object $group = new GroupItem(); $groupManager = new RowManager_NavBarGroupManager($groupID); $multiLingualContext = new MultilingualManager($languageID); $bridgeManager = $groupManager->getRowLabelBridge($multiLingualContext); $group->loadFromArray($bridgeManager->getArrayOfValues()); // store in GroupArray $groupArray[$groupID] = $group; } // end if // Add link Object to Group Object $link = new LinkItem(); $link->loadFromArray($combinedLinks[$indx]); $groupArray[$groupID]->addItem($link); } // next item // Now manually sort the group Items since we couldn't get the SQL // to sort it. $sortedArray = array(); foreach ($groupArray as $group) { $key = $group->getOrder() . $group->getText(); $sortedArray[$key] = $group; } ksort($sortedArray); // send array of group objects to Template $template = new Template($pathToRoot . SITE_PATH_MODULES . 'site_NavBar/templates/'); $template->set('arrayGroup', $sortedArray); $template->set('pathToRoot', $this->getPathToRootTag()); // get cache data from template $cacheData = $template->fetch('obj_NavBar.php'); $cacheData = str_replace('[userID]', $viewer->getUserID(), $cacheData); $cacheData = str_replace('[passWord]', $viewer->getPassword(), $cacheData); if ((int) $viewer->getLanguageID() == 1) { $cacheData = str_replace('[gtsLanguageID]', 'en', $cacheData); } else { $cacheData = str_replace('[gtsLanguageID]', 'chi', $cacheData); } // store cache data in this object $this->setValueByFieldName('navbarcache_cache', $cacheData); //echo 'cacheData=[<pre>'.$cacheData.'</pre>]<br>'; // set isValid to true $this->setCacheValid(); $this->setViewerID($viewerID); $this->setLanguageID($languageID); // update DB Table if ($this->isLoaded()) { $this->updateDBTable(); } else { $this->createNewEntry(); } }
/** * Convert inline image tags like [image:123:abc] into HTML img tags * * @param string Source content * @param array Params * @return string Content */ function render_inline_images($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_images() 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_images'), 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 image inline tags preg_match_all('/\\[image:(\\d+)(:?)([^\\]]*)\\]/i', $content, $images); if (!empty($images[0])) { // There are image inline tags in the content foreach ($images[0] as $i => $current_link_tag) { $current_link_ID = (int) $images[1][$i]; $current_link_caption = empty($images[2][$i]) ? '#' : $images[3][$i]; if (empty($current_link_ID)) { // Invalid link ID, Go to next match continue; } if (!isset($FileList)) { // Get list of attached files only first time $LinkOnwer = new LinkItem($this); $FileList = $LinkOnwer->get_attachment_FileList($params['limit'], 'inline'); if (empty($FileList)) { // This Item has not the inline attached files, Exit here break; } } if ($File =& $FileList->get_by_field('link_ID', $current_link_ID)) { // File is found by link ID if (!$File->exists()) { global $Debuglog; $Debuglog->add(sprintf('File linked to item #%d does not exist (%s)!', $this->ID, $File->get_full_path()), array('error', 'files')); break; } elseif ($File->is_image()) { // Generate the IMG tag with all the alt, title and desc if available $image_tag = $this->get_attached_image_tag($File, $params); // Replace inline image tag with HTML img tag $content = str_replace($current_link_tag, $image_tag, $content); } else { // Display error if file is not an image $content = str_replace($current_link_tag, '<div class="error">' . sprintf(T_('This file cannot be included here because it is not an image: %s'), $current_link_tag) . '</div>', $content); } } } } return $content; }
// SINGLE POST: // Create a post: $edited_Item = new Item(); $edited_Item->set('status', $item_status); $edited_Item->set('main_cat_ID', $Blog->get_default_cat_ID()); $l_File =& $selected_Filelist->get_next(); $title = $l_File->get('title'); if (empty($title)) { $title = $l_File->get('name'); } $edited_Item->set('title', $title); $DB->begin('SERIALIZABLE'); // INSERT NEW POST INTO DB: if ($edited_Item->dbinsert()) { $order = 1; $LinkOwner = new LinkItem($edited_Item); do { // LOOP through files: // echo '<br>file meta: '.$l_File->meta; if ($l_File->meta == 'notfound') { // That file has no meta data yet, create it now! $l_File->dbsave(); } // Let's make the link! $LinkOwner->add_link($l_File->ID, 'teaser', $order++); $Messages->add(sprintf(T_('«%s» has been attached.'), $l_File->dget('name')), 'success'); } while ($l_File =& $selected_Filelist->get_next()); $DB->commit(); } else { $Messages->add(T_('Couldn\'t create the new post'), 'error'); $DB->rollback();