/**
  * Get a very short desc. Used in the widget list.
  *
  * @return string The block title, the first 60 characters of the block
  *                content or an empty string.
  */
 function get_short_desc()
 {
     if (empty($this->disp_params['title'])) {
         return strmaxlen($this->disp_params['content'], 60, NULL, 'formvalue');
     }
     return format_to_output($this->disp_params['title']);
 }
예제 #2
0
 function tagitem_edit_actions($Item)
 {
     global $current_User, $edited_ItemTag;
     // Display the edit icon if current user has the rights:
     $r = $Item->get_edit_link(array('before' => '', 'after' => ' ', 'text' => get_icon('edit'), 'title' => '#', 'class' => ''));
     if ($current_User->check_perm('item_post!CURSTATUS', 'edit', false, $Item)) {
         // Display the unlink icon if current user has the rights:
         $r .= action_icon(T_('Unlink this tag from post!'), 'unlink', regenerate_url('tag_ID,action,tag_filter', 'tag_ID=' . $edited_ItemTag->ID . '&item_ID=' . $Item->ID . '&action=unlink&' . url_crumb('tag')), NULL, NULL, NULL, array('onclick' => 'return confirm(\'' . format_to_output(sprintf(TS_('Are you sure you want to remove the tag "%s" from "%s"?'), $edited_ItemTag->dget('name'), $Item->dget('title')) . '\');', 'htmlattr')));
     }
     return $r;
 }
예제 #3
0
/**
 * Converts array to form option list
 *
 * @param integer|array selected key
 * @param boolean provide a choice for "none" with value ''
 * @return string
 */
function array_to_option_list($array, $default = '', $allow_none = false)
{
    if (!is_array($default)) {
        $default = array($default);
    }
    $r = '';
    if ($allow_none) {
        $r .= '<option value="' . $this->none_option_value . '"';
        if (empty($default)) {
            $r .= ' selected="selected"';
        }
        $r .= '>' . format_to_output($this->none_option_text) . '</option>' . "\n";
    }
    foreach ($array as $k => $v) {
        $r .= '<option value="' . format_to_output($k, 'formvalue') . '"';
        if (in_array($k, $default)) {
            $r .= ' selected="selected"';
        }
        $r .= '>';
        $r .= format_to_output($v, 'htmlbody');
        $r .= '</option>' . "\n";
    }
    return $r;
}
예제 #4
0
    echo '<li><a href="' . regenerate_url('action', 'action=utf8check&amp;' . url_crumb('tools')) . '">' . T_('Check/Convert/Normalize the charsets/collations used by the DB (UTF-8 / ASCII)') . '</a></li>';
    // echo '<li><a href="'.regenerate_url('action', 'action=backup_db').'">'.T_('Backup database').'</a></li>';
    echo '</ul>';
    $block_item_Widget->disp_template_raw('block_end');
    $block_item_Widget->title = T_('Cleanup tools');
    $block_item_Widget->disp_template_replaced('block_start');
    echo '<ul>';
    echo '<li><a href="' . $admin_url . '?ctrl=itemtags&amp;action=cleanup&amp;' . url_crumb('tag') . '">' . T_('Find and delete all orphan Tag entries (not used anywhere) - DB only.') . '</a></li>';
    echo '<li><a href="' . regenerate_url('action', 'action=find_broken_posts&amp;' . url_crumb('tools')) . '">' . T_('Find all broken posts (with no matching Category) + Option to delete with related objects - DB only.') . '</a></li>';
    echo '<li><a href="' . regenerate_url('action', 'action=find_broken_slugs&amp;' . url_crumb('tools')) . '">' . T_('Find all broken slugs (with no matching Item) + Option to delete - DB only.') . '</a></li>';
    echo '<li><a href="' . regenerate_url('action', 'action=delete_orphan_comments&amp;' . url_crumb('tools')) . '">' . T_('Find and delete all orphan Comments (with no matching Item) - Disk &amp; DB.') . '</a></li>';
    echo '<li><a href="' . regenerate_url('action', 'action=delete_orphan_comment_uploads&amp;' . url_crumb('tools')) . '">' . T_('Find and delete all orphan comment Uploads - Disk &amp; DB.') . '</a></li>';
    echo '<li><a href="' . regenerate_url('action', 'action=delete_orphan_files&amp;' . url_crumb('tools')) . '">' . T_('Find and delete all orphan File objects (with no matching file on disk) - DB only.') . '</a></li>';
    echo '<li><a href="' . regenerate_url('action', 'action=delete_orphan_file_roots&amp;' . url_crumb('tools')) . '">' . T_('Find and delete all orphan file roots (with no matching Collection or User) and all of their content recursively - Disk &amp; DB.') . '</a></li>';
    echo '<li><a href="' . regenerate_url('action', 'action=prune_hits_sessions&amp;' . url_crumb('tools')) . '">' . T_('Prune old hits &amp; sessions (includes OPTIMIZE) - DB only.') . '</a></li>';
    echo '<li><a href="' . regenerate_url('action', 'action=recreate_itemslugs&amp;' . url_crumb('tools')) . '">' . T_('Recreate all item Slugs (change title-[0-9] canonical slugs to a slug generated from current title). Old slugs will still work, but will redirect to the new ones - DB only.') . '</a></li>';
    echo '<li><a href="' . regenerate_url('action', 'action=recreate_autogenerated_excerpts&amp;' . url_crumb('tools')) . '">' . T_('Recreate autogenerated excerpts - DB only.') . '</a></li>';
    echo '<li><a href="' . regenerate_url('action', 'action=convert_item_content_separators&amp;' . url_crumb('tools')) . '">' . T_('Convert item content separators to [teaserbreak] and [pagebreak] - DB only.') . '</a></li>';
    echo '</ul>';
    $block_item_Widget->disp_template_raw('block_end');
}
// We should load GeoIP plugin here even if it is disabled now, because action 'geoip_download' may be requested
$Plugins->load_plugin_by_classname('geoip_plugin');
// Event AdminToolPayload for each Plugin:
$tool_plugins = $Plugins->get_list_by_event('AdminToolPayload');
foreach ($tool_plugins as $loop_Plugin) {
    $block_item_Widget->title = format_to_output($loop_Plugin->name);
    $block_item_Widget->disp_template_replaced('block_start');
    $Plugins->call_method_if_active($loop_Plugin->ID, 'AdminToolPayload', $params = array());
    $block_item_Widget->disp_template_raw('block_end');
}
 /**
  * Returns form option list with cache contents grouped by country preference
  *
  * Load the cache if necessary
  *
  * @param integer|array selected ID(s) (list for multi-selects)
  * @param boolean provide a choice for "none" with ID ''
  * @param string Callback method name
  * @param array IDs to ignore.
  * @return string
  */
 function get_group_country_option_list($default = 0, $allow_none = false, $method = 'get_name', $ignore_IDs = array())
 {
     if (!is_array($default)) {
         $default = array($default);
     }
     if (!$this->all_loaded && $this->load_all) {
         // We have not loaded all items so far, but we're allowed to.
         if (empty($ignore_IDs)) {
             // just load all items
             $this->load_all();
         } else {
             // only load those items not listed in $ignore_IDs
             $this->load_list($ignore_IDs, true);
         }
     }
     $r = '';
     if ($allow_none) {
         // we set current value of a country if it is sent to function
         $r .= '<option value="' . $this->none_option_value . '"';
         if (empty($default)) {
             $r .= ' selected="selected"';
         }
         $r .= '>' . format_to_output(T_($this->none_option_text)) . '</option>' . "\n";
     }
     $pref_countries = array();
     //preferred countries.
     $rest_countries = array();
     // not preffered countries (the rest)
     foreach ($this->cache as $loop_Obj) {
         if (in_array($loop_Obj->ID, $ignore_IDs)) {
             // if we have ID of countries that we have to ignore we just do not include them here.
             //Ignore this ID
             continue;
         }
         if ($loop_Obj->preferred == 1) {
             // if the country is preferred we add it to selected array.
             $pref_countries[] = $loop_Obj;
         }
         $rest_countries[] = $loop_Obj;
     }
     if (count($pref_countries)) {
         // if we don't have preferred countries in this case we don't have to show optgroup
         // in option list
         $r .= '<optgroup label="' . T_('Frequent countries') . '">';
         foreach ($pref_countries as $loop_Obj) {
             $r .= '<option value="' . $loop_Obj->ID . '"';
             if (in_array($loop_Obj->ID, $default)) {
                 $r .= ' selected="selected"';
             }
             $r .= '>';
             $r .= format_to_output($loop_Obj->{$method}(), 'htmlbody');
             $r .= '</option>' . "\n";
         }
         $r .= '</optgroup>';
         if (count($rest_countries)) {
             // if we don't have rest countries we do not create optgroup for them
             $r .= '<optgroup label="' . T_('Other countries') . '">';
             foreach ($rest_countries as $loop_Obj) {
                 $r .= '<option value="' . $loop_Obj->ID . '"';
                 if (in_array($loop_Obj->ID, $default)) {
                     $r .= ' selected="selected"';
                 }
                 $r .= '>';
                 $r .= format_to_output($loop_Obj->{$method}(), 'htmlbody');
                 $r .= '</option>' . "\n";
             }
             $r .= '</optgroup>';
         }
     } else {
         // if we have only rest countries we get here
         foreach ($rest_countries as $loop_Obj) {
             $r .= '<option value="' . $loop_Obj->ID . '"';
             if (in_array($loop_Obj->ID, $default)) {
                 $r .= ' selected="selected"';
             }
             $r .= '>';
             $r .= format_to_output($loop_Obj->{$method}(), 'htmlbody');
             $r .= '</option>' . "\n";
         }
     }
     return $r;
 }
예제 #6
0
/**
 * 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";
        }
    }
}
예제 #7
0
 /**
  * Template function: get excerpt
  *
  * @todo do we want excerpts in itemLight or not?
  *       dh> I'd say "no". I have added excerpt_autogenerated
  *           only to Item now. But makes sense in the same class.
  *           update_excerpt is also on in Item.
  *  fp> the issue is about display only. of course we don't want update code in ItemLight.
  *  The question is typically about being able to display excerpts in ItemLight list
  *  sitemaps, feed, recent posts, post widgets where the exceprt might be used as a title, etc.
  *
  * @param string filename to use to display more
  * @return string
  */
 function get_excerpt($format = 'htmlbody')
 {
     // Character conversions
     return format_to_output($this->excerpt, $format);
 }
 /**
  * Get a very short desc. Used in the widget list.
  */
 function get_short_desc()
 {
     return format_to_output($this->disp_params['title']);
 }
예제 #9
0
파일: wikipedia.php 프로젝트: leowmjw/twfy
function antiTagInTag($content = '', $format = 'htmlhead')
{
    if (!function_exists('format_to_output')) {
        // Use the external function if it exists, or fall back on just strip_tags.
        function format_to_output($content, $format)
        {
            return strip_tags($content);
        }
    }
    $contentwalker = 0;
    $length = strlen($content);
    $tagend = -1;
    for ($tagstart = strpos($content, '<', $tagend + 1); $tagstart !== false && $tagstart < strlen($content); $tagstart = strpos($content, '<', $tagend)) {
        // got the start of a tag.  Now find the proper end!
        $walker = $tagstart + 1;
        $open = 1;
        while ($open != 0 && $walker < strlen($content)) {
            $nextopen = strpos($content, '<', $walker);
            $nextclose = strpos($content, '>', $walker);
            if ($nextclose === false) {
                // ERROR! Open waka without close waka!
                // echo '<code>Error in antiTagInTag - malformed tag!</code> ';
                return $content;
            }
            if ($nextopen === false || $nextopen > $nextclose) {
                // No more opens, but there was a close; or, a close happens before the next open.
                // walker goes to the close+1, and open decrements
                $open--;
                $walker = $nextclose + 1;
            } elseif ($nextopen < $nextclose) {
                // an open before the next close
                $open++;
                $walker = $nextopen + 1;
            }
        }
        $tagend = $walker;
        if ($tagend > strlen($content)) {
            $tagend = strlen($content);
        } else {
            $tagend--;
            $tagstart++;
        }
        $tag = substr($content, $tagstart, $tagend - $tagstart);
        $tags[] = '<' . $tag . '>';
        $newtag = format_to_output($tag, $format);
        $newtags[] = '<' . $newtag . '>';
        $newtag = format_to_output($tag, $format);
    }
    if (isset($tags) && isset($newtags)) {
        $content = str_replace($tags, $newtags, $content);
    }
    return $content;
}
예제 #10
0
/**
 * Generate category line when it has children
 *
 * @param object Chapter we want to display
 * @param integer Level of the category in the recursive tree
 * @return string HTML
 */
function cat_line($Chapter, $level)
{
    global $line_class, $permission_to_edit, $current_User, $Settings;
    global $ChapterCache, $current_default_cat_ID;
    global $number_of_posts_in_cat;
    global $Session;
    $result_fadeout = $Session->get('fadeout_array');
    $line_class = $line_class == 'even' ? 'odd' : 'even';
    // ID
    $r = '<tr id="tr-' . $Chapter->ID . '"class="' . $line_class . ' chapter_parent_' . ($Chapter->parent_ID ? $Chapter->parent_ID : '0') . (isset($result_fadeout) && in_array($Chapter->ID, $result_fadeout) ? ' fadeout-ffff00' : '') . '">
					<td class="firstcol shrinkwrap">' . $Chapter->ID . '
				</td>';
    // Default
    if ($current_default_cat_ID == $Chapter->ID) {
        $makedef_icon = get_icon('enabled', 'imgtag', array('title' => format_to_output(T_('This is the default category'), 'htmlattr')));
    } else {
        $makedef_url = regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&amp;action=make_default&amp;' . url_crumb('element'));
        $makedef_title = format_to_output(T_('Click to make this the default category'), 'htmlattr');
        $makedef_icon = '<a href="' . $makedef_url . '" title="' . $makedef_title . '">' . get_icon('disabled', 'imgtag', array('title' => $makedef_title)) . '</a>';
    }
    $r .= '<td class="center">' . $makedef_icon . '</td>';
    // Name
    if ($permission_to_edit) {
        // We have permission permission to edit:
        $edit_url = regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&amp;action=edit');
        $r .= '<td>
						<strong style="padding-left: ' . $level . 'em;"><a href="' . $edit_url . '" title="' . T_('Edit...') . '">' . $Chapter->dget('name') . '</a></strong>
					 </td>';
    } else {
        $r .= '<td>
						 <strong style="padding-left: ' . $level . 'em;">' . $Chapter->dget('name') . '</strong>
					 </td>';
    }
    // URL "slug"
    $edit_url = regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&amp;action=edit');
    $r .= '<td><a href="' . htmlspecialchars($Chapter->get_permanent_url()) . '">' . $Chapter->dget('urlname') . '</a></td>';
    // Order
    if ($Chapter->get_parent_subcat_ordering() == 'manual') {
        // Manual ordering
        $r .= '<td class="center cat_order_edit" rel="' . $Chapter->ID . '">' . '<a href="#">' . ($Chapter->get('order') === NULL ? '-' : $Chapter->dget('order')) . '</a>' . '</td>';
    } else {
        // Alphabetic ordering
        $r .= '<td class="center">' . T_('Alphabetic') . '</td>';
    }
    if ($permission_to_edit) {
        // We have permission permission to edit, so display these columns:
        if ($Chapter->meta) {
            $makemeta_icon = 'enabled';
            $makemeta_title = format_to_output(T_('Click to revert this from meta category'), 'htmlattr');
            $action = 'unset_meta';
        } else {
            $makemeta_icon = 'disabled';
            $makemeta_title = format_to_output(T_('Click to make this as meta category'), 'htmlattr');
            $action = 'set_meta';
        }
        // Meta
        $makemeta_url = regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&amp;action=' . $action . '&amp;' . url_crumb('element'));
        $r .= '<td class="center"><a href="' . $makemeta_url . '" title="' . $makemeta_title . '">' . get_icon($makemeta_icon, 'imgtag', array('title' => $makemeta_title)) . '</a></td>';
        // Lock
        if ($Chapter->lock) {
            $makelock_icon = 'file_not_allowed';
            $makelock_title = format_to_output(T_('Unlock category'), 'htmlattr');
            $action = 'unlock';
        } else {
            $makelock_icon = 'file_allowed';
            $makelock_title = format_to_output(T_('Lock category'), 'htmlattr');
            $action = 'lock';
        }
        $makelock_url = regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&amp;action=' . $action . '&amp;' . url_crumb('element'));
        $r .= '<td class="center"><a href="' . $makelock_url . '" title="' . $makelock_title . '">' . get_icon($makelock_icon, 'imgtag', array('title' => $makelock_title)) . '</a></td>';
    }
    // Posts
    if (isset($number_of_posts_in_cat[$Chapter->ID])) {
        $r .= '<td class="center">' . (int) $number_of_posts_in_cat[$Chapter->ID] . '</td>';
    } else {
        // no posts in this category
        $r .= '<td class="center"> - </td>';
    }
    // Actions
    $r .= '<td class="lastcol shrinkwrap">';
    if ($permission_to_edit) {
        // We have permission permission to edit, so display action column:
        $r .= action_icon(T_('Edit...'), 'edit', $edit_url);
        if ($Settings->get('allow_moving_chapters')) {
            // If moving cats between blogs is allowed:
            $r .= action_icon(T_('Move to a different blog...'), 'file_move', regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&amp;action=move'), T_('Move'));
        }
        $r .= action_icon(T_('New...'), 'new', regenerate_url('action,cat_ID,cat_parent_ID', 'cat_parent_ID=' . $Chapter->ID . '&amp;action=new')) . action_icon(T_('Delete...'), 'delete', regenerate_url('action,cat_ID', 'cat_ID=' . $Chapter->ID . '&amp;action=delete&amp;' . url_crumb('element')));
    }
    $r .= '</td>';
    $r .= '</tr>';
    return $r;
}
예제 #11
0
        foreach ($uploadedFiles as $uploadedFile) {
            $success_msg = sprintf(T_('The file &laquo;%s&raquo; has been successfully uploaded to the server.'), $uploadedFile->dget('name'));
            // Allow to insert/link new upload into currently edited link object:
            if ($mode == 'upload' && !empty($link_object_ID) && !empty($link_type)) {
                // The filemanager has been opened from a link owner object, offer to insert an img tag into original object.
                $LinkOwner = get_link_owner($link_type, $link_object_ID);
                // TODO: Add plugin hook to allow generating JS insert code(s)
                $img_tag = format_to_output($uploadedFile->get_tag(), 'formvalue');
                if ($uploadedFile->is_image()) {
                    $link_msg = $LinkOwner->translate('Link this image to your owner');
                    $link_note = T_('recommended - allows automatic resizing');
                } else {
                    $link_msg = $LinkOwner->translate('Link this file to your owner');
                    $link_note = $LinkOwner->translate('The file will be linked for download at the end of the owner');
                }
                $success_msg .= '<ul>' . '<li>' . action_icon(T_('Link this file!'), 'link', regenerate_url('fm_selected,ctrl', 'ctrl=files&amp;action=link_inpost&amp;fm_selected[]=' . rawurlencode($uploadedFile->get_rdfp_rel_path()) . '&amp;' . url_crumb('file')), ' ' . $link_msg, 5, 5, array('target' => $iframe_name)) . ' (' . $link_note . ')</li>' . '<li>' . T_('or') . ' <a href="#" onclick="if( window.focus && window.opener ){' . 'window.opener.focus(); textarea_wrap_selection( window.opener.document.getElementById(\'' . $LinkOwner->type . 'form_post_content\'), \'' . format_to_output($uploadedFile->get_tag(), 'formvalue') . '\', \'\', 1, window.opener.document ); } return false;">' . $LinkOwner->translate('Insert the following code snippet into your owner') . '</a> : <input type="text" value="' . $img_tag . '" size="60" /></li>' . '</ul>';
            }
            $Messages->add($success_msg, 'success');
        }
    }
    if ($upload_quickmode && !empty($failedFiles)) {
        // Transmit file error to next page!
        $Messages->add($failedFiles[0], 'error');
        unset($failedFiles);
    }
    if (empty($failedFiles) && empty($renamedFiles)) {
        // quick mode or no failed files, Go back to Browsing
        // header_redirect( $dispatcher.'?ctrl=files&root='.$fm_FileRoot->ID.'&path='.rawurlencode($path) );
        header_redirect(regenerate_url('ctrl', 'ctrl=files', '', '&'));
    }
}
<?php

/**
 * This is the PLAIN TEXT template of email message for post by email report
 *
 * For more info about email skins, see: http://b2evolution.net/man/themes-templates-skins/email-skins/
 *
 * b2evolution - {@link http://b2evolution.net/}
 * Released under GNU GPL License - {@link http://b2evolution.net/about/gnu-gpl-license}
 * @copyright (c)2003-2015 by Francois Planque - {@link http://fplanque.com/}
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
// ---------------------------- EMAIL HEADER INCLUDED HERE ----------------------------
emailskin_include('_email_header.inc.txt.php', $params);
// ------------------------------- END OF EMAIL HEADER --------------------------------
// Default params:
$params = array_merge(array('Items' => NULL), $params);
$Items = $params['Items'];
echo T_('You just created the following posts:') . "\n\n";
foreach ($Items as $Item) {
    echo format_to_output($Item->title) . "\n";
    echo $Item->get_permanent_url('', '', '&') . "\n\n";
}
// ---------------------------- EMAIL FOOTER INCLUDED HERE ----------------------------
emailskin_include('_email_footer.inc.txt.php', $params);
// ------------------------------- END OF EMAIL FOOTER --------------------------------
예제 #13
0
}
?>
			</ul>

			<p class="uploadfileinputs"><a href="#" onclick="addAnotherFileInput(); return false;" class="small"><?php 
echo T_('Add another file');
?>
</a></p>

			<div class="upload_foot">
				<input type="submit" value="<?php 
echo format_to_output(T_('Upload to server now'), 'formvalue');
?>
" class="ActionButton" >
				<input type="reset" value="<?php 
echo format_to_output(T_('Reset'), 'formvalue');
?>
" class="ResetButton">

				<p class="note">
					<?php 
$restrictNotes = array();
// Get list of recognized file types (others are not allowed to get uploaded)
// dh> because FiletypeCache/DataObjectCache has no interface for getting a list, this dirty query seems less dirty to me.
$allowed_extensions = $DB->get_col('SELECT ftyp_extensions FROM T_filetypes WHERE ftyp_allowed != 0');
$allowed_extensions = implode(' ', $allowed_extensions);
// implode with space, ftyp_extensions can hold many, separated by space
// into array:
$allowed_extensions = preg_split('~\\s+~', $allowed_extensions, -1, PREG_SPLIT_NO_EMPTY);
// readable:
$allowed_extensions = implode_with_and($allowed_extensions);
예제 #14
0
파일: comments.main.php 프로젝트: LFSF/oras
</language>
		<docs>http://backend.userland.com/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=<?php 
echo $app_version;
?>
"/>
		<ttl>60</ttl>
		<?php 
while ($Comment =& $CommentList->get_next()) {
    // Loop through comments:
    // Load comment's Item:
    $Comment->get_Item();
    ?>
		<item>
			<title><?php 
    echo format_to_output(T_('In response to:'), 'xml');
    ?>
 <?php 
    $Comment->Item->title(array('format' => 'xml', 'link_type' => 'none'));
    ?>
</title>
			<pubDate><?php 
    $Comment->time('r', true);
    ?>
</pubDate>
			<dc:creator><?php 
    $Comment->author('', '#', '', '#', 'xml');
    ?>
</dc:creator>
			<guid isPermaLink="false">c<?php 
    $Comment->ID();
예제 #15
0
	<div class="clear"></div>
</div>

<?php 
if ($disp == 'single') {
    // ------------------- NAVIGATION BAR FOR ALBUM(POST) -------------------
    if ($single_Item =& mainlist_get_item()) {
        // Get Item here, because it can be not defined yet, e.g. in Preview mode
        ?>
<div class="nav_album">

	<a href="<?php 
        $Blog->disp('url', 'raw');
        ?>
" id="ios-arrow-left" title="<?php 
        echo format_to_output(T_('All Albums'), 'htmlattr');
        ?>
"></a>

	<span class="nav_album_title">
	<?php 
        $single_Item->title(array('link_type' => 'permalink'));
        $single_Item->edit_link(array('before' => ' ', 'after' => '', 'text' => get_icon('edit'), 'title' => T_('Edit title/description...')));
        if ($Skin->enabled_status_banner($single_Item->status)) {
            // Status banner
            $single_Item->format_status(array('template' => '<div class="post_status"><div class="floatright"><span class="note status_$status$"><span>$status_title$</span></span></div></div>'));
        }
        ?>
	</span>

<?php 
예제 #16
0
function display_password_indicator($params = array())
{
    global $Blog, $rsc_url, $disp, $dummy_fields;
    $params = array_merge(array('pass1-id' => $dummy_fields['pass1'], 'pass2-id' => $dummy_fields['pass2'], 'login-id' => $dummy_fields['login'], 'email-id' => $dummy_fields['email'], 'field-width' => 140, 'disp-status' => 1, 'disp-time' => 0, 'blacklist' => "'b2evo','b2evolution'"), $params);
    $extra_bar_width = 2;
    $container_left_margin = 0;
    if (!empty($disp)) {
        // In skin password form
        $extra_bar_width = 0;
        $container_left_margin = '3px';
    }
    echo "<script type='text/javascript'>\n\t// Load password strength estimation library\n\t(function(){var a;a=function(){var a,b;b=document.createElement('script');b.src='" . $rsc_url . "js/zxcvbn.js';b.type='text/javascript';b.async=!0;a=document.getElementsByTagName('script')[0];return a.parentNode.insertBefore(b,a)};null!=window.attachEvent?window.attachEvent('onload',a):window.addEventListener('load',a,!1)}).call(this);\n\n\t// Call 'passcheck' function when document is loaded\n\tif( document.addEventListener ) { document.addEventListener('DOMContentLoaded', passcheck, false); } else { window.attachEvent('onload', passcheckpasscheck); }\n\n\tfunction passcheck()\n\t{\n\t\tvar pass1input = document.getElementById('" . $params['pass1-id'] . "');\n\t\tif( pass1input == null ) {\n\t\t\treturn; // password field not found\n\t\t}\n\n\t\tvar pass2input = document.getElementById('" . $params['pass2-id'] . "');\n\t\tif( pass2input != null ) {\n\t\t\tpass2input.style.width = '" . ($params['field-width'] - 2) . "px'; // Set fixed length\n\t\t}\n\n\t\t// Prepair password field\n\t\tpass1input.style.width = '" . ($params['field-width'] - 2) . "px'; // Set fixed length\n\t\tpass1input.setAttribute('onkeyup','return passinfo(this);'); // Add onkeyup attribute\n\t\tpass1input.parentNode.innerHTML += \"<div id='p-container'><div id='p-result'></div><div id='p-status'></div><div id='p-time'></div></div>\";\n\n\t\tvar pstyle = document.createElement('style');\n\t\tpstyle.innerHTML += '#p-container { position: relative; margin: 4px 0 0 " . $container_left_margin . "; width:" . ($params['field-width'] + $extra_bar_width) . "px; height:5px; border: 1px solid #CCC; font-size: 84%; line-height:normal; color: #999 }';\n\t\tpstyle.innerHTML += '#p-result { height:5px }';\n\t\tpstyle.innerHTML += '#p-status { position:absolute; width: 100px; top:-7px; left:" . ($params['field-width'] + 8) . "px }';\n\t\tpstyle.innerHTML += '#p-time { position:absolute; width: 400px }';\n\t\tdocument.body.appendChild(pstyle);\n\t}\n\n\tfunction passinfo(el)\n\t{\n\t\tvar presult = document.getElementById('p-result');\n\t\tvar pstatus = document.getElementById('p-status');\n\t\tvar ptime = document.getElementById('p-time');\n\n\t\tvar vlogin = '';\n\t\tvar login = document.getElementById('" . $params['login-id'] . "');\n\t\tif( login != null && login.value != '' ) { vlogin = login.value; }\n\n\t\tvar vemail = '';\n\t\tvar email = document.getElementById('" . $params['email-id'] . "');\n\t\tif( email != null && email.value != '' ) { vemail = email.value; }\n\n\t\t// Check the password\n\t\tvar passcheck = zxcvbn(el.value, [vlogin, vemail, " . $params['blacklist'] . "]);\n\n\t\tvar bar_color = 'red';\n\t\tvar bar_status = '" . format_to_output(T_('Very weak'), 'htmlattr') . "';\n\n\t\tif( el.value.length == 0 ) {\n\t\t\tpresult.style.display = 'none';\n\t\t\tpstatus.style.display = 'none';\n\t\t\tptime.style.display = 'none';\n\t\t} else {\n\t\t\tpresult.style.display = 'block';\n\t\t\tpstatus.style.display = 'block';\n\t\t\tptime.style.display = 'block';\n\t\t}\n\n\t\tswitch(passcheck.score) {\n\t\t\tcase 1:\n\t\t\t\tbar_color = '#F88158';\n\t\t\t\tbar_status = '" . format_to_output(T_('Weak'), 'htmlattr') . "';\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tbar_color = '#FBB917';\n\t\t\t\tbar_status = '" . format_to_output(T_('So-so'), 'htmlattr') . "';\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tbar_color = '#8BB381';\n\t\t\t\tbar_status = '" . format_to_output(T_('Good'), 'htmlattr') . "';\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tbar_color = '#59E817';\n\t\t\t\tbar_status = '" . format_to_output(T_('Great!'), 'htmlattr') . "';\n\t\t\t\tbreak;\n\t\t}\n\n\t\tpresult.style.width = (passcheck.score * 20 + 20)+'%';\n\t\tpresult.style.background = bar_color;\n\n\t\tif( " . $params['disp-status'] . " ) {\n\t\t\tpstatus.innerHTML = bar_status;\n\t\t}\n\t\tif( " . $params['disp-time'] . " ) {\n\t\t\tdocument.getElementById('p-time').innerHTML = '" . T_('Estimated crack time') . ": ' + passcheck.crack_time_display;\n\t\t}\n\t}\n</script>";
}
예제 #17
0
파일: _form.class.php 프로젝트: LFSF/oras
 /**
  * Get the label of a field. This is used by {@link begin_field()} or {@link end_field()},
  *
  * @access protected
  * @return string
  */
 function get_label()
 {
     $r = '';
     $label = $this->_common_params['label'];
     if (strlen($label)) {
         $r .= $this->labelstart . '<label' . (!empty($this->_common_params['id']) ? ' for="' . format_to_output($this->_common_params['id'], 'htmlattr') . '"' : '') . '>' . format_to_output($label, 'htmlbody');
         $r .= $this->label_suffix;
         $r .= '</label>' . $this->labelend;
     } else {
         // Empty label:
         $r .= $this->labelempty;
     }
     return $r;
 }
예제 #18
0
파일: _blog.class.php 프로젝트: LFSF/oras
 /**
  *
  * @uses Blog::gen_archive_url()
  */
 function gen_archive_link($text, $title, $year, $month = NULL, $day = NULL, $week = NULL, $glue = '&amp;')
 {
     $link = '<a';
     if ($this->get_setting('archive_nofollowto')) {
         $link .= ' rel="nofollow"';
     }
     if (!empty($title)) {
         $link .= ' title="' . format_to_output($title, 'htmlattr') . '"';
     }
     $link .= ' href="' . $this->gen_archive_url($year, $month, $day, $week, $glue) . '" >';
     $link .= format_to_output($text);
     $link .= '</a>';
     return $link;
 }
예제 #19
0
 /**
  * Get status of comment
  *
  * Statuses:
  * - published
  * - deprecated
  * - protected
  * - private
  * - draft
  *
  * @param string Output format, see {@link format_to_output()}
  * @return string Status
  */
 function get_status($format = 'htmlbody')
 {
     $r = '';
     switch ($format) {
         case 'raw':
             $r .= $this->dget('status', 'raw');
             break;
         case 'styled':
             $r .= get_styled_status($this->status, $this->get('t_status'));
             break;
         default:
             $r .= format_to_output($this->get('t_status'), $format);
             break;
     }
     return $r;
 }
예제 #20
0
        stats_time();
        ?>
</td>
					<td><a href="<?php 
        stats_referer();
        ?>
"><?php 
        stats_basedomain();
        ?>
</a></td>
					<td class="center"><?php 
        stats_hit_remote_addr();
        ?>
</td>
					<td><?php 
        echo format_to_output($row_stats['blog_shortname'], 'htmlbody');
        ?>
</td>
					<td><?php 
        disp_url($row_stats['hit_uri'], 50);
        ?>
</td>
				</tr>
				<?php 
        $count++;
    }
    ?>
			</tbody>
		</table>
	<?php 
}
예제 #21
0
    $Item->creator_User->preferred_name('xml');
    ?>
</dc:creator>
	<dc:subject><?php 
    $Item->main_category('xml');
    ?>
</dc:subject>
	<?php 
    if ($feed_content == 'excerpt') {
        // EXCERPTS ---------------------------------------------------------------------
        ?>
	<description><?php 
        $content = $Item->get_excerpt();
        // Get content as "htmlbody", otherwise make_rel_links_abs() can't catch <a> and <img> tags
        // TODO: clean solution : work in format_to_output!
        echo format_to_output(make_rel_links_abs($content), 'entityencoded');
        // Display Item footer text (text can be edited in Blog Settings):
        $Item->footer(array('mode' => 'xml', 'block_start' => '<div class="item_footer">', 'block_end' => '</div>', 'format' => 'entityencoded'));
        ?>
</description>
	<content:encoded><![CDATA[<?php 
        // Display post excerpt
        echo $Item->get_excerpt('htmlfeed');
        // Display Item footer text (text can be edited in Blog Settings):
        $Item->footer(array('mode' => 'xml', 'block_start' => '<div class="item_footer">', 'block_end' => '</div>', 'format' => 'htmlfeed'));
        ?>
]]></content:encoded>
			<?php 
    } elseif ($feed_content == 'normal' || $feed_content == 'full') {
        // POST CONTENTS -----------------------------------------------------------------
        ?>
예제 #22
0
         					'before' => '<div class="floatright"><span class="note status_'.$Item->status.'"><span>',
         					'after'  => '</span></span></div>',
         				) );
         	NEW:
         */
         $Item->format_status(array('template' => '<div class="floatright"><span class="note status_$status$"><span>$status_title$</span></span></div>'));
         echo '<div class="dashboard_float_actions">';
         $Item->edit_link(array('before' => ' ', 'after' => ' ', 'class' => 'ActionButton btn btn-primary w80px', 'text' => get_icon('edit_button') . ' ' . T_('Edit')));
         // Display images that are linked to this post:
         $Item->images(array('before' => '<div class="dashboard_thumbnails">', 'before_image' => '', 'before_image_legend' => NULL, 'after_image_legend' => NULL, 'after_image' => '', 'after' => '</div>', 'image_size' => 'crop-80x80', 'limit' => 1, 'restrict_to_image_position' => 'cover,teaser,teaserperm,teaserlink,aftermore,inline', 'links_sql_select' => ', CASE ' . 'WHEN link_position = "cover"      THEN "1" ' . 'WHEN link_position = "teaser"     THEN "2" ' . 'WHEN link_position = "teaserperm" THEN "3" ' . 'WHEN link_position = "teaserlink" THEN "4" ' . 'WHEN link_position = "aftermore"  THEN "5" ' . 'WHEN link_position = "inline"     THEN "6" ' . 'END AS position_order', 'links_sql_orderby' => 'position_order, link_order'));
         echo '</div>';
         echo '<div class="dashboard_content">';
         echo '<h3 class="dashboard_post_title">';
         $item_title = $Item->dget('title');
         if (!strlen($item_title)) {
             $item_title = '[' . format_to_output(T_('No title')) . ']';
         }
         echo '<a href="?ctrl=items&amp;blog=' . $Blog->ID . '&amp;p=' . $Item->ID . '">' . $item_title . '</a>';
         echo '</h3>';
         echo htmlspecialchars($Item->get_content_excerpt(150), NULL, $evo_charset);
         echo '</div>';
         echo '<div class="clear"></div>';
         echo '</div>';
     }
     echo '</div>';
     $block_item_Widget->disp_template_raw('block_end');
 }
 if ($nb_blocks_displayed == 0) {
     // We haven't displayed anything yet!
     $nb_blocks_displayed++;
     $block_item_Widget = new Widget('block_item');
예제 #23
0
        $Item->images(array('before' => '<div>', 'before_image' => '<div>', 'before_image_legend' => '<div><i>', 'after_image_legend' => '</i></div>', 'after_image' => '</div>', 'after' => '</div>', 'image_size' => 'fit-320x320'), 'htmlfeed');
        $Item->content_teaser(array('disppage' => 1, 'stripteaser' => false, 'format' => 'htmlfeed', 'before_image' => '<div>', 'before_image_legend' => '<div><i>', 'after_image_legend' => '</i></div>', 'after_image' => '</div>', 'image_size' => 'fit-320x320'));
        if ($feed_content == 'normal') {
            // Teasers only
            $Item->more_link(array('before' => '', 'after' => '', 'disppage' => 1, 'format' => 'htmlfeed'));
        } else {
            // Full contents
            $Item->content_extension(array('disppage' => 1, 'force_more' => true, 'format' => 'htmlfeed'));
        }
        // Display Item footer text (text can be edited in Blog Settings):
        $Item->footer(array('mode' => 'xml', 'block_start' => '<div class="item_footer">', 'block_end' => '</div>', 'format' => 'htmlfeed'));
        ?>
]]></content:encoded>
					<?php 
    }
    ?>
			<comments><?php 
    echo $Item->get_single_url('auto');
    ?>
#comments</comments>
			<wfw:commentRss><?php 
    echo format_to_output($Item->get_feedback_feed_url('_rss2'), 'xml');
    ?>
</wfw:commentRss>
		</item>
		<?php 
}
?>
	</channel>
</rss>
예제 #24
0
 /**
  * Get checkable list of renderers
  *
  * @param array If given, assume these renderers to be checked.
  * @param array params from where to get 'apply_rendering' setting
  */
 function get_renderer_checkboxes($current_renderers = NULL, $params)
 {
     global $inc_path, $admin_url;
     load_funcs('plugins/_plugin.funcs.php');
     $name_prefix = isset($params['name_prefix']) ? $params['name_prefix'] : '';
     $this->restart();
     // make sure iterator is at start position
     if (!is_array($current_renderers)) {
         $current_renderers = explode('.', $current_renderers);
     }
     $atLeastOneRenderer = false;
     $setting_Blog = NULL;
     if (isset($params['Comment']) && !empty($params['Comment'])) {
         // get Comment apply_rendering setting
         $Comment =& $params['Comment'];
         $comment_Item =& $Comment->get_Item();
         $setting_Blog =& $comment_Item->get_Blog();
         $setting_name = 'coll_apply_comment_rendering';
     } elseif (isset($params['Item'])) {
         // get Post apply_rendering setting
         $setting_name = 'coll_apply_rendering';
         $Item =& $params['Item'];
         $setting_Blog =& $Item->get_Blog();
     } elseif (isset($params['Blog']) && isset($params['setting_name'])) {
         // get given "apply_rendering" collection setting from the given Blog
         $setting_Blog =& $params['Blog'];
         $setting_name = $params['setting_name'];
     } else {
         // Invalid params
         return '';
     }
     if ($setting_name == 'coll_apply_comment_rendering') {
         // Get Comment renderer plugins
         $RendererPlugins = $this->get_list_by_events(array('FilterCommentContent'));
     } else {
         // Get Item renderer plugins
         $RendererPlugins = $this->get_list_by_events(array('RenderItemAsHtml', 'RenderItemAsXml', 'RenderItemAsText'));
     }
     $r = '<input type="hidden" name="renderers_displayed" value="1" />';
     foreach ($RendererPlugins as $loop_RendererPlugin) {
         // Go through whole list of renders
         // echo ' ',$loop_RendererPlugin->code;
         if (empty($loop_RendererPlugin->code)) {
             // No unique code!
             continue;
         }
         if (empty($setting_Blog)) {
             // If $setting_Blog is not set we can't get apply_rendering options
             continue;
         }
         // get rendering setting from plugin coll settings
         $apply_rendering = $loop_RendererPlugin->get_coll_setting($setting_name, $setting_Blog);
         if ($apply_rendering == 'stealth' || $apply_rendering == 'never') {
             // This is not an option.
             continue;
         }
         $atLeastOneRenderer = true;
         $r .= '<div>';
         $r .= '<input type="checkbox" class="checkbox" name="' . $name_prefix . 'renderers[]" value="' . $loop_RendererPlugin->code . '" id="renderer_' . $loop_RendererPlugin->code . '"';
         switch ($apply_rendering) {
             case 'always':
                 $r .= ' checked="checked" disabled="disabled"';
                 break;
             case 'opt-out':
                 if (in_array($loop_RendererPlugin->code, $current_renderers) || in_array('default', $current_renderers)) {
                     $r .= ' checked="checked"';
                 }
                 break;
             case 'opt-in':
                 if (in_array($loop_RendererPlugin->code, $current_renderers)) {
                     $r .= ' checked="checked"';
                 }
                 break;
             case 'lazy':
                 if (in_array($loop_RendererPlugin->code, $current_renderers)) {
                     $r .= ' checked="checked"';
                 }
                 $r .= ' disabled="disabled"';
                 break;
         }
         $r .= ' title="' . format_to_output($loop_RendererPlugin->short_desc, 'formvalue') . '" /> <label for="renderer_' . $loop_RendererPlugin->code . '" title="';
         $r .= format_to_output($loop_RendererPlugin->short_desc, 'formvalue') . '">';
         $r .= format_to_output($loop_RendererPlugin->name) . '</label>';
         // fp> TODO: the first thing we want here is a TINY javascript popup with the LONG desc. The links to readme and external help should be inside of the tiny popup.
         // fp> a javascript DHTML onhover help would be even better than the JS popup
         // external help link:
         $r .= ' ' . $loop_RendererPlugin->get_help_link('$help_url');
         $r .= "</div>\n";
     }
     if (!$atLeastOneRenderer) {
         if (is_admin_page()) {
             // Display info about no renderer plugins only in backoffice
             global $admin_url;
             $r .= '<a title="' . T_('Configure plugins') . '" href="' . $admin_url . '?ctrl=plugins"' . '>' . T_('No renderer plugins are installed.') . '</a>';
         } else {
             return '';
         }
     }
     return $r;
 }
예제 #25
0
 /**
  * Get the label of a field. This is used by {@link begin_field()} or {@link end_field()},
  *
  * @access protected
  * @return string
  */
 function get_label()
 {
     $r = '';
     $label = $this->_common_params['label'];
     if (strlen($label)) {
         $r .= $this->labelstart;
         if (isset($this->_common_params['clickable_label']) && !$this->_common_params['clickable_label']) {
             // Not set if this method is invoked by ::begin_field()
             if (!empty($this->_common_params['required'])) {
                 $r .= '<span class="label_field_required">*</span>';
             }
             $r .= format_to_output($label, 'htmlbody') . $this->label_suffix;
         } else {
             $r .= '<label' . (!empty($this->labelclass) ? ' class="' . format_to_output($this->labelclass, 'htmlattr') . '"' : '') . (!empty($this->_common_params['id']) ? ' for="' . format_to_output($this->_common_params['id'], 'htmlattr') . '"' : '') . '>';
             if (!empty($this->_common_params['required'])) {
                 $r .= '<span class="label_field_required">*</span>';
             }
             $r .= format_to_output($label, 'htmlbody');
             $r .= $this->label_suffix;
             $r .= '</label>';
         }
         $r .= $this->labelend;
     } else {
         // Empty label:
         $r .= $this->labelempty;
     }
     return $r;
 }
예제 #26
0
    $flag = country_flag($country_code, $country_name, 'w16px', 'flag', '', false, true, '', false);
    if (empty($flag)) {
        // No flag or registration country
        $flag = '?';
    }
    if ($current_User->check_perm('users', 'edit')) {
        // Only users with edit all users permission can see the 'Sessions' tab
        $flag = '<a href="' . $admin_url . '?ctrl=user&amp;user_tab=sessions&amp;user_ID=' . $user_ID . '">' . $flag . '</a>';
    }
    return $flag;
}
$UserList->cols[] = array('th' => T_('RC'), 'th_title' => T_('Registration country'), 'th_class' => 'shrinkwrap small', 'td_class' => 'shrinkwrap small', 'order' => 'rc.ctry_name', 'td' => '%user_reg_country( #user_ID#, #reg_ctry_code#, #reg_ctry_name# )%');
$UserList->cols[] = array('th' => T_('Profile update'), 'th_class' => 'shrinkwrap small', 'td_class' => 'center small', 'order' => 'user_profileupdate_date', 'default_dir' => 'D', 'td' => '%mysql2localedate( #user_profileupdate_date#, "M-d" )%');
$UserList->cols[] = array('th' => T_('Last Visit'), 'th_class' => 'shrinkwrap small', 'td_class' => 'center small', 'order' => 'user_lastseen_ts', 'default_dir' => 'D', 'td' => '%mysql2localedate( #user_lastseen_ts#, "M-d" )%');
$UserList->cols[] = array('th' => T_('Contact'), 'th_class' => 'shrinkwrap small', 'td_class' => 'shrinkwrap small', 'td' => '%user_mailto( #user_email# )%
					%user_pm( #user_ID#, #user_login# )%' . ('~conditional( (#user_url# != \'http://\') && (#user_url# != \'\'), \' <a href="$user_url$" target="_blank" title="' . format_to_output(T_('Website'), 'htmlattr') . ': $user_url$">' . get_icon('www', 'imgtag', array('class' => 'middle', 'title' => format_to_output(T_('Website'), 'htmlattr') . ': $user_url$')) . '</a>\', \'&nbsp;\' )~'));
$filter_reported = param('reported', 'integer');
if ($filter_reported) {
    // Filter is set to 'Reported users'
    $userlist_col_reputaion = array('th' => T_('Rep'), 'th_class' => 'shrinkwrap small', 'td_class' => 'shrinkwrap small', 'order' => 'user_rep', 'default_dir' => 'D', 'td' => '$user_rep$');
}
if ($UserList->filters['group'] == -1) {
    // List is ungrouped, Display column with group name
    $UserList->cols[] = array('th' => T_('Group'), 'th_class' => 'shrinkwrap small', 'td_class' => 'shrinkwrap small', 'order' => 'grp_name', 'td' => '$grp_name$');
}
if (!$current_User->check_perm('users', 'edit', false)) {
    if ($filter_reported) {
        $UserList->cols[] = $userlist_col_reputaion;
    }
    $UserList->cols[] = array('th' => T_('Level'), 'th_class' => 'shrinkwrap small', 'td_class' => 'shrinkwrap small', 'order' => 'user_level', 'default_dir' => 'D', 'td' => '$user_level$');
} else {
예제 #27
0
 /**
  * Get the HTML for the menu entries of a specific path.
  *
  * @param NULL|string|array The path. See {@link get_node_by_path()}.
  * @param string Template name, see {@link get_template()}.
  * @param int Depth (recursion)
  * @return string The HTML for the menu.
  */
 function get_html_menu_entries($path, $template, $depth = 0)
 {
     global $current_User;
     $r = '';
     $templateForLevel = $this->get_template($template, $depth);
     if (!($menuEntries = $this->get_menu_entries($path))) {
         // No menu entries at this level
         if (isset($templateForLevel['empty'])) {
             $r .= $templateForLevel['empty'];
         }
     } else {
         // There are entries to display:
         $r .= $templateForLevel['before'];
         $selected = $this->get_selected($path);
         foreach ($menuEntries as $loop_key => $loop_details) {
             $anchor = '<a href="';
             if (isset($loop_details['href'])) {
                 $anchor .= $loop_details['href'];
             } elseif (!empty($loop_details['href_eval'])) {
                 // Useful for passing dynamic context vars (fp>> I AM using it)
                 $anchor .= eval($loop_details['href_eval']);
             } else {
                 $anchor .= regenerate_url('tab', 'tab=' . $loop_key);
             }
             $anchor .= '"';
             if (isset($loop_details['style'])) {
                 $anchor .= ' style="' . $loop_details['style'] . '"';
             }
             if (isset($loop_details['onclick'])) {
                 $anchor .= ' onclick="' . $loop_details['onclick'] . '"';
             }
             if (isset($loop_details['name'])) {
                 $anchor .= ' name="' . $loop_details['name'] . '"';
             }
             $anchor .= '>' . format_to_output($loop_details['text'], 'htmlbody') . "</a>";
             if ($loop_key == $selected) {
                 // Highlight selected entry
                 if (!empty($templateForLevel['_props']['recurseSelected']) && ($recursePath = array_merge($path, $loop_key)) && $this->get_menu_entries($recursePath)) {
                     $r .= isset($templateForLevel['beforeEachSelWithSub']) ? $templateForLevel['beforeEachSelWithSub'] : $templateForLevel['beforeEachSel'];
                     $r .= $anchor;
                     // Recurse:
                     $r .= $this->get_html_menu_entries($recursePath, $template, $depth + 1);
                     $r .= isset($templateForLevel['afterEachSelWithSub']) ? $templateForLevel['afterEachSelWithSub'] : $templateForLevel['afterEachSel'];
                 } else {
                     $r .= $templateForLevel['beforeEachSel'];
                     $r .= $anchor;
                     $r .= $templateForLevel['afterEachSel'];
                 }
             } else {
                 $r .= $templateForLevel['beforeEach'];
                 $r .= $anchor;
                 $r .= $templateForLevel['afterEach'];
             }
         }
         $r .= $templateForLevel['after'];
     }
     return $r;
 }
예제 #28
0
 /**
  * Display a global title matching filter params
  *
  * @todo implement $order
  *
  * @param string prefix to display if a title is generated
  * @param string suffix to display if a title is generated
  * @param string glue to use if multiple title elements are generated
  * @param string comma separated list of titles inthe order we would like to display them
  * @param string format to output, default 'htmlbody'
  */
 function get_filter_title($prefix = ' ', $suffix = '', $glue = ' - ', $order = NULL, $format = 'htmlbody')
 {
     $title_array = $this->get_filter_titles();
     if (empty($title_array)) {
         return '';
     }
     // We have something to display:
     $r = implode($glue, $title_array);
     $r = $prefix . format_to_output($r, $format) . $suffix;
     return $r;
 }
예제 #29
0
 /**
  * @param array Smiley
  * @param array Override params, e.g. "class"
  */
 function get_smiley_img_tag($smiley, $override_fields = array())
 {
     $attribs = array('src' => $smiley['image'], 'title' => format_to_output($smiley['code'], 'htmlattr'), 'alt' => format_to_output($smiley['code'], 'htmlattr'), 'class' => 'middle');
     if ($smiley_wh = imgsize($smiley['path'], 'widthheight_assoc')) {
         $attribs += $smiley_wh;
     }
     if ($override_fields) {
         $attribs = $override_fields + $attribs;
     }
     return '<img' . get_field_attribs_as_string($attribs) . ' />';
 }
예제 #30
0
 /**
  * Display status of item in a formatted way, following a provided template
  *
  * There are 2 possible variables: 
  * - $status$ = the raw status
  * - $status_title$ = the human readable text version of the status (translated to current language)
  *
  * @param array Params
  */
 function format_status($params = array())
 {
     $params = array_merge(array('template' => '<div class="evo_status evo_status_$status$">$status_title$</div>', 'format' => 'htmlbody', 'status' => NULL, 'status_title' => NULL), $params);
     if (is_null($params['status'])) {
         // Use current status of this comment
         $params['status'] = $this->status;
     }
     if (is_null($params['status_title'])) {
         // Use current status title of this comment
         $params['status_title'] = $this->get('t_status');
     }
     $r = str_replace(array('$status$', '$status_title$'), array($params['status'], $params['status_title']), $params['template']);
     echo format_to_output($r, $params['format']);
 }