当前位置: 首页>>代码示例>>PHP>>正文


PHP User::format方法代码示例

本文整理汇总了PHP中User::format方法的典型用法代码示例。如果您正苦于以下问题:PHP User::format方法的具体用法?PHP User::format怎么用?PHP User::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在User的用法示例。


在下文中一共展示了User::format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getContent

 public function getContent()
 {
     // User is logged in
     if (LOGGED) {
         $this->subcodename = 'logged';
         $tpl = new PHPTAL('blocks/user_panel/logged.html');
         $tpl->user = User::format(User::$id, User::$nickname, User::$groupId);
         $pm_item = User::$pmNew ? array(t('Messages <strong>(New: %new)</strong>', array('%new' => $user->pm_new)), 'pm/inbox') : array(t('Messages'), 'pm');
         $tpl->items = items(array($pm_item[0] => HREF . $pm_item[1], t('Administration') => HREF . 'admin', t('Edit profile') => HREF . 'edit_profile', t('Log out') => HREF . 'logout'));
         return $tpl->execute();
     } else {
         $err = new Error();
         $note = new Notifier('note-user_panel');
         $this->subcodename = 'not_logged';
         $form = array('logname' => null, 'password' => null);
         if ($_POST['login'] && $_POST['user_panel']) {
             $form['logname'] = $_POST['logname-session'] ? filter($_POST['logname-session'], 100) : '';
             $form['password'] = $_POST['password-session'] ? $_POST['password-session'] : '';
             $err->setError('logname_empty', t('Logname field is required.'))->condition(!$form['logname']);
             $err->setError('logname_not_exists', t('Entered logname is not registered.'))->condition(!User::loginNameRegistered($form['logname']));
             $err->setError('password_empty', t('Password field is required.'))->condition(!$form['password']);
             $err->setError('password_incorrect', t('ERROR_PASS_INCORRECT'))->condition($form['password'] && !User::loginPasswordCorrect($form['password']));
             if ($err->noErrors()) {
                 redirect('./');
             } else {
                 $note->error($err->toArray());
             }
         }
         $tpl = new PHPTAL('blocks/user_panel/not_logged.html');
         $tpl->note = $note;
         $tpl->form = $form;
         $tpl->err = $err->toArray();
         return $tpl->execute();
     }
 }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:35,代码来源:user_panel.block.php

示例2: getContent

    public function getContent()
    {
        global $sql;
        //Lang::load('blocks/shoutbox/lang.*.php');
        $err = new Error();
        $note = new Notifier('note-shoutbox');
        $form['author'] = LOGGED ? User::$nickname : '';
        $form['message'] = '';
        if (isset($_POST['reply-shoutbox'])) {
            $form['author'] = LOGGED ? User::$nickname : filter($_POST['author-shoutbox'], 100);
            $form['message'] = filter($_POST['message-shoutbox'], Kio::getConfig('message_max', 'shoutbox'));
            $err->setError('author_empty', t('Author field is required.'))->condition(!$form['author']);
            $err->setError('author_exists', t('Entered nickname is registered.'))->condition(!LOGGED && is_registered($form['author']));
            $err->setError('message_empty', t('Message field is required.'))->condition(!$form['message']);
            // No errors
            if ($err->noErrors()) {
                $sql->exec('
					INSERT INTO ' . DB_PREFIX . 'shoutbox (added, author, message, author_id, author_ip)
					VALUES (
						' . TIMESTAMP . ',
						"' . $form['author'] . '",
						"' . cut($form['message'], Kio::getConfig('message_max', 'shoutbox')) . '",
						' . UID . ',
						"' . IP . '")');
                $sql->clearCache('shoutbox');
                $note->success(t('Entry was added successfully.'));
                redirect(HREF . PATH . '#shoutbox');
            } else {
                $note->error($err->toArray());
            }
        }
        // If cache for shoutbox doesn't exists
        if (!($entries = $sql->getCache('shoutbox'))) {
            $query = $sql->query('
				SELECT u.nickname, u.group_id, s.added, s.author, s.author_id, s.message
				FROM ' . DB_PREFIX . 'shoutbox s
				LEFT JOIN ' . DB_PREFIX . 'users u ON u.id = s.author_id
				ORDER BY s.id DESC
				LIMIT ' . Kio::getConfig('limit', 'shoutbox'));
            while ($row = $query->fetch()) {
                if ($row['author_id']) {
                    $row['author'] = User::format($row['author_id'], $row['nickname'], $row['group_id']);
                    $row['message'] = parse($row['message'], Kio::getConfig('parser', 'shoutbox'));
                }
                $entries[] = $row;
            }
            $sql->putCacheContent('shoutbox', $entries);
        }
        try {
            $tpl = new PHPTAL('blocks/shoutbox/shoutbox.tpl.html');
            $tpl->entries = $entries;
            $tpl->err = $err->toArray();
            $tpl->form = $form;
            $tpl->note = $note;
            return $tpl->execute();
        } catch (Exception $e) {
            return template_error($e->getMessage());
            //echo Note::error($e->getMessage());
        }
    }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:60,代码来源:shoutbox.block.php

示例3: format

 /**
  * format
  * This takes the current playlist object and gussies it up a little
  * bit so it is presentable to the users
  */
 public function format($details = true)
 {
     $this->f_name = $this->name;
     $this->f_type = $this->type == 'private' ? UI::get_icon('lock', T_('Private')) : '';
     if ($details) {
         $client = new User($this->user);
         $client->format();
         $this->f_user = $client->f_name;
     }
 }
开发者ID:cheese1,项目名称:ampache,代码行数:15,代码来源:playlist_object.abstract.php

示例4: getContent

    public function getContent()
    {
        global $sql;
        $pager = new Pager('users', Kio::getStat('total', 'users'), Kio::getConfig('limit', 'users'));
        $pager->sort(array(t('Nickname') => 'nickname', t('Group') => 'g_name', t('Gender') => 'gender', t('Title') => 'title', t('Location') => 'locality', t('Country') => 'country', t('Registered') => 'registered'), 'registered', 'asc');
        $query = $sql->query('
			SELECT id, name, inline, members
			FROM ' . DB_PREFIX . 'groups
			ORDER BY display_order');
        while ($row = $query->fetch()) {
            if ($row['inline']) {
                $row['name'] = sprintf($row['inline'], $row['name']);
            }
            $groups[] = $row;
        }
        $query = $sql->query('
			SELECT u.id, u.nickname, u.email, u.registered, u.group_id, u.gender, u.locality, u.country, u.communicator, u.title, g.name g_name
			FROM ' . DB_PREFIX . 'users u
			LEFT JOIN ' . DB_PREFIX . 'groups g ON g.id = u.group_id
			ORDER BY ' . $pager->orderBy . '
			LIMIT ' . $pager->limit . '
			OFFSET ' . $pager->offset);
        while ($row = $query->fetch()) {
            $row['nickname'] = User::format($row['id'], $row['nickname'], $row['group_id']);
            switch ($row['gender']) {
                case 1:
                    $row['gender'] = ' <img class="gender" src="' . LOCAL . 'themes/' . THEME . '/images/male.png" alt="' . t('Male') . '" title="' . t('Male') . '" />';
                    break;
                case 2:
                    $row['gender'] = ' <img class="gender" src="' . LOCAL . 'themes/' . THEME . '/images/female.png" alt="' . t('Female') . '" title="' . t('Female') . '" />';
                    break;
                default:
                    $row['gender'] = '';
            }
            $users[] = $row;
        }
        try {
            $tpl = new PHPTAL('modules/users/users.tpl.html');
            $tpl->sort = $pager->sorters;
            $tpl->users = $users;
            $tpl->groups = $groups;
            $tpl->pagination = $pager->getLinks();
            return $tpl->execute();
        } catch (Exception $e) {
            return template_error($e);
        }
    }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:47,代码来源:users.module.php

示例5: getContent

    public function getContent()
    {
        global $sql, $user, $cfg;
        //Lang::load('blocks/shoutbox/lang.*.php');
        $err = new Error();
        $note = new Notifier('note-shoutbox');
        $form = array();
        $form['author'] = $user->nickname;
        if ($_POST['reply-shoutbox']) {
            $form['author'] = LOGGED ? $user->nickname : filter($_POST['author-shoutbox'], 100);
            $form['message'] = filter($_POST['message-shoutbox'], $cfg->shoutbox['message_max']);
            $err->author_empty(t('Field <strong>author</strong> can not be empty.'), !$form['author']);
            $err->author_exists(t('Entered <strong>nickname</strong> is registered.'), !LOGGED && is_registered($form['author']));
            $err->message_empty(t('Field <strong>message</strong> can not be empty.'), !$form['message']);
            // No errors
            if (!$err->count()) {
                $sql->exec('
					INSERT INTO ' . DB_PREFIX . 'shoutbox (added, author, message, author_id, author_ip)
					VALUES (
						' . TIMESTAMP . ',
						"' . $form['author'] . '",
						"' . cut($form['message'], $cfg->shoutbox['message_max']) . '",
						' . $user->id . ',
						"' . IP . '")', 'shoutbox.txt');
                $note->success(t('Entry was added successfully.'));
                redirect(HREF . PATH . '#shoutbox');
            } else {
                $note->error($err);
            }
        }
        // If cache for shoutbox doesn't exists
        if (!($entries = $sql->getCache('shoutbox'))) {
            $query = $sql->query('
				SELECT u.nickname, u.group_id, s.added, s.author, s.author_id, s.message
				FROM ' . DB_PREFIX . 'shoutbox s, ' . DB_PREFIX . 'users u
				WHERE u.id = s.author_id
				ORDER BY s.id DESC
				LIMIT ' . $cfg->shoutbox['limit']);
            while ($row = $query->fetch()) {
                if ($row['author_id']) {
                    $row['author'] = User::format($row['author_id'], $row['nickname'], $row['group_id']);
                    $row['message'] = parse($row['message'], $cfg->shoutbox['parser']);
                }
                $entries[] = $row;
            }
            $sql->putCacheContent('shoutbox', $entries);
        }
        try {
            $tpl = new PHPTAL('blocks/shoutbox/sbox_overall.html');
            $tpl->cfg = $cfg;
            $tpl->entries = $entries;
            $tpl->err = $err->toArray();
            $tpl->form = $form;
            $tpl->note = $note;
            $tpl->user = $user;
            return $tpl->execute();
        } catch (Exception $e) {
            return template_error($e->getMessage());
            //echo Note::error($e->getMessage());
        }
    }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:61,代码来源:shoutbox.rss.php

示例6: Pager

// KioCMS - Kiofol Content Managment System
// modules/news/admin/entries/index.php
if ($kio->stats['news_entries']) {
    $pager = new Pager('admin/modules/news', $kio->stats['news_entries']);
    $pager->limit()->sort(array(t('ID') => 'n_id', t('Title') => 'n_title', t('Language') => 'lang', t('Content') => 'content', t('Author') => 'nickname', t('Category') => 'c_name', t('Added') => 'added'), 'added', 'desc');
    $query = $sql->query('
		SELECT u.nickname, u.group_id, c.id c_id, c.name c_name, c.description c_description, n.*, n.id n_id, n.title n_title
		FROM ' . DB_PREFIX . 'news n
		LEFT JOIN ' . DB_PREFIX . 'users u ON u.id = n.author_id
		LEFT JOIN ' . DB_PREFIX . 'news_categories c ON c.id = n.category_id
		ORDER BY ' . $pager->order . '
		LIMIT ' . $pager->limit . '
		OFFSET ' . $pager->offset);
    while ($row = $query->fetch()) {
        if ($row['author_id']) {
            $row['author'] = User::format($row['author_id'], $row['nickname'], $row['group_id']);
        }
        $row['url_title'] = ($row['c_name'] ? clean_url($row['c_name']) . '/' : null) . clean_url($row['title']);
        $entries[] = $row;
    }
    $tpl = new PHPTAL('modules/news/admin/entries.html');
    $tpl->stats = $kio->stats;
    $tpl->entries = $entries;
    $tpl->sort = $pager->sorters;
    $tpl->limit_form = $pager->limit_form;
    $tpl->pagination = $pager->links();
    echo $tpl->execute();
} else {
    echo $lang_admin['NULL'];
}
开发者ID:rafalenden,项目名称:KioCMS,代码行数:30,代码来源:entries.php

示例7: get_display

 public function get_display($details = true, $jsbuttons = false)
 {
     $object = Shoutbox::get_object($this->object_type, $this->object_id);
     $object->format();
     $img = $this->get_image();
     $html = "<div class='shoutbox-item'>";
     $html .= "<div class='shoutbox-data'>";
     if ($details && $img) {
         $html .= "<div class='shoutbox-img'>" . $img . "</div>";
     }
     $html .= "<div class='shoutbox-info'>";
     if ($details) {
         $html .= "<div class='shoutbox-object'>" . $object->f_link . "</div>";
         $html .= "<div class='shoutbox-date'>" . date("Y/m/d H:i:s", $this->date) . "</div>";
     }
     $html .= "<div class='shoutbox-text'>" . $this->f_text . "</div>";
     $html .= "</div>";
     $html .= "</div>";
     $html .= "<div class='shoutbox-footer'>";
     if ($details) {
         $html .= "<div class='shoutbox-actions'>";
         if ($jsbuttons) {
             $html .= Ajax::button('?page=stream&action=directplay&playtype=' . $this->object_type . '&' . $this->object_type . '_id=' . $this->object_id, 'play', T_('Play'), 'play_' . $this->object_type . '_' . $this->object_id);
             $html .= Ajax::button('?action=basket&type=' . $this->object_type . '&id=' . $this->object_id, 'add', T_('Add'), 'add_' . $this->object_type . '_' . $this->object_id);
         }
         if (Access::check('interface', '25')) {
             $html .= "<a href=\"" . AmpConfig::get('web_path') . "/shout.php?action=show_add_shout&type=" . $this->object_type . "&id=" . $this->object_id . "\">" . UI::get_icon('comment', T_('Post Shout')) . "</a>";
         }
         $html .= "</div>";
     }
     $html .= "<div class='shoutbox-user'>" . T_('by') . " ";
     if ($this->user > 0) {
         $user = new User($this->user);
         $user->format();
         if ($details) {
             $html .= $user->f_link;
         } else {
             $html .= $user->username;
         }
     } else {
         $html .= T_('Guest');
     }
     $html .= "</div>";
     $html .= "</div>";
     $html .= "</div>";
     return $html;
 }
开发者ID:nioc,项目名称:ampache,代码行数:47,代码来源:shoutbox.class.php

示例8: load_latest_shout

 /**
  * load_latest_shout
  * This loads in the latest added shouts
  * @return array
  */
 public static function load_latest_shout()
 {
     $ids = Shoutbox::get_top(10);
     $results = array();
     foreach ($ids as $id) {
         $shout = new Shoutbox($id);
         $shout->format();
         $object = Shoutbox::get_object($shout->object_type, $shout->object_id);
         $object->format();
         $user = new User($shout->user);
         $user->format();
         $xml_array = array('title' => $user->username . ' ' . T_('on') . ' ' . $object->get_fullname(), 'link' => $object->link, 'description' => $shout->text, 'image' => Art::url($shout->object_id, $shout->object_type, null, 2), 'comments' => '', 'pubDate' => date("c", $shout->date));
         $results[] = $xml_array;
     }
     // end foreach
     return $results;
 }
开发者ID:nioc,项目名称:ampache,代码行数:22,代码来源:ampache_rss.class.php

示例9: format

 public function format($details = true)
 {
     if ($details) {
         $object = new $this->object_type($this->object_id);
         $object->format();
         $this->f_name = $object->get_fullname();
         $this->f_object_link = $object->f_link;
         $user = new User($this->user);
         $user->format();
         $this->f_user = $user->f_name;
     }
     $this->f_allow_stream = $this->allow_stream;
     $this->f_allow_download = $this->allow_download;
     $this->f_creation_date = date("Y-m-d H:i:s", $this->creation_date);
     $this->f_lastvisit_date = $this->lastvisit_date > 0 ? date("Y-m-d H:i:s", $this->creation_date) : '';
 }
开发者ID:cheese1,项目名称:ampache,代码行数:16,代码来源:share.class.php

示例10: format

 /**
  * Format data.
  */
 public function format()
 {
     if ($this->artist) {
         $artist = new Artist($this->artist);
         $artist->format();
         $this->f_artist_link = $artist->f_link;
     } else {
         $wartist = Wanted::get_missing_artist($this->artist_mbid);
         $this->f_artist_link = $wartist['link'];
     }
     $this->link = AmpConfig::get('web_path') . "/albums.php?action=show_missing&mbid=" . $this->mbid . "&artist=" . $this->artist . "&artist_mbid=" . $this->artist_mbid . "\" title=\"" . $this->name;
     $this->f_link = "<a href=\"" . $this->link . "\">" . $this->name . "</a>";
     $user = new User($this->user);
     $user->format();
     $this->f_user = $user->f_name;
 }
开发者ID:cheese1,项目名称:ampache,代码行数:19,代码来源:wanted.class.php

示例11: getContent

    public function getContent()
    {
        global $sql;
        $this->err = new Error();
        $pager = new Pager('guestbook', Kio::getStat('entries', 'guestbook'), Kio::getConfig('limit', 'guestbook'));
        if (Kio::getConfig('order_by', 'guestbook') == 'DESC') {
            $x = $pager->items + 1 - $pager->offset;
            $y = '$x--;';
        } else {
            $x = $pager->offset;
            $y = '$x++;';
        }
        //		$entries = $sql->getCache('guestbook_'.$pager->current);
        if (!$entries) {
            $stmt = $sql->query('
				SELECT gb.id, gb.added, gb.author, gb.email, gb.website, gb.message, gb.author_id, gb.author_ip,
					u.nickname, u.group_id, u.avatar, u.signature
				FROM ' . DB_PREFIX . 'guestbook gb
				LEFT JOIN ' . DB_PREFIX . 'users u ON u.id = gb.author_id
				ORDER BY gb.id ' . Kio::getConfig('order_by', 'guestbook') . '
				LIMIT ' . $pager->limit . '
				OFFSET ' . $pager->offset);
            if ($stmt->rowCount()) {
                while ($row = $stmt->fetch()) {
                    eval($y);
                    $row['number'] = $x;
                    if ($row['author_id']) {
                        $row['author'] = User::format($row['author_id'], $row['nickname'], $row['group_id']);
                    }
                    $row['message'] = parse($row['message'], Kio::getConfig('parsers', 'guestbook'));
                    $row['signature'] = $row['signature'] ? parse($row['signature'], Kio::getConfig('parsers', 'guestbook')) : '';
                    $entries[] = $row;
                }
                $sql->putCacheContent('guestbook_' . $pager->current, $entries);
            } else {
                $this->note->info('Jeszcze nikt nie dodał żadnego wpisu.');
            }
        }
        // Editing entry
        if (ctype_digit(u2)) {
            // guestbook/edit/u2
            $edited_id = u1 == 'edit' ? u2 : '';
            if (!User::hasPermit('guestbook edit')) {
                $this->note->error(t('You do not have access to edit entries.'));
            } else {
                if ($edited_id) {
                    $row = $sql->query('
					SELECT id, added, author, author_id, author_ip, email, website, message
					FROM ' . DB_PREFIX . 'guestbook
					WHERE id = ' . $edited_id)->fetch();
                    // Entry exists
                    if ($row) {
                        $form = $row;
                        $form['edit_mode'] = true;
                        if (!$row['author']) {
                            $form['author'] = User::getNickname(BY_ID, $row['author_id']);
                        }
                    } else {
                        $this->note->error(t('Selected entry doesn&apos;t exist.'));
                    }
                }
            }
        }
        if (!$form['edit_mode']) {
            $form['author'] = User::$nickname;
        }
        // Form action
        $add = $_POST['add'] ? true : false;
        $edit = $_POST['edit'] ? true : false;
        // On form submit
        if ($add || $edit) {
            $this->formSumbit();
        } else {
            if (ctype_digit($_POST['delete_id']) && $_POST['auth'] == AUTH && User::hasPermit('guestbook delete')) {
                $sql->exec('
				UPDATE ' . DB_PREFIX . 'stats SET content = content - 1 WHERE name = "guestbook_entries";
				DELETE FROM ' . DB_PREFIX . 'guestbook WHERE id = ' . $_POST['delete_id']);
                $sql->clearCacheGroup('guestbook_*');
            }
        }
        try {
            $tpl = new PHPTAL('modules/guestbook/guestbook.tpl.html');
            $tpl->message_limit = Kio::getConfig('message_max', 'guestbook');
            $tpl->form = $form;
            $tpl->entries = $entries;
            $tpl->err = $this->err->toArray();
            $tpl->note = $this->note;
            $tpl->pagination = $pager->getLinks();
            return $tpl->execute();
        } catch (Exception $e) {
            return template_error($e);
        }
    }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:93,代码来源:guestbook.uninstall.php

示例12: redirect

				AND owner_id = ' . $user->id);
    }
    redirect(HREF . PATH);
}
$stmt = $sql->query('
	SELECT pm.*, u.nickname, u.group_id
	FROM ' . DB_PREFIX . 'pm pm
	LEFT JOIN ' . DB_PREFIX . 'users u ON u.id = pm.connector_id
	WHERE pm.owner_id = ' . $user->id . ' AND pm.folder = ' . $folder . '
	ORDER BY ' . $pager->order . '
	LIMIT ' . $pager->limit . '
	OFFSET ' . $pager->offset);
if ($stmt->rowCount()) {
    while ($row = $stmt->fetch()) {
        if ($row['connector_id']) {
            $row['nickname'] = User::format($row['connector_id'], $row['nickname'], $row['group_id']);
        }
        $messages[] = $row;
    }
    try {
        $tpl = new PHPTAL('modules/pm/box.html');
        $tpl->cfg = $cfg;
        $tpl->messages = $messages;
        $tpl->sort = $pager->sorters;
        $tpl->total = $user->{'pm_' . u1};
        $tpl->kio = $kio;
        $tpl->max = $cfg->pm[u1 . '_max'];
        $tpl->note = $note;
        $tpl->pager = $pager;
        $tpl->pagination = $pager->getLinks();
        echo $tpl->execute();
开发者ID:rafalenden,项目名称:KioCMS,代码行数:31,代码来源:box.php

示例13: podcast

 public static function podcast(library_item $libitem)
 {
     $xml = new SimpleXMLElement('<rss />');
     $xml->addAttribute("version", "2.0");
     $xml->addAttribute("xmlns:xmlns:atom", "http://www.w3.org/2005/Atom");
     $xml->addAttribute("xmlns:xmlns:itunes", "http://www.itunes.com/dtds/podcast-1.0.dtd");
     $xchannel = $xml->addChild("channel");
     $xchannel->addChild("title", $libitem->get_fullname() . " Podcast");
     $xlink = $xchannel->addChild("atom:link");
     $xlink->addAttribute("type", "text/html");
     $xlink->addAttribute("href", $libitem->link);
     if (Art::has_db($libitem->id, get_class($libitem))) {
         $ximg = $xchannel->addChild("xmlns:itunes:image");
         $ximg->addAttribute("href", Art::url($libitem->id, get_class($libitem)));
     }
     $summary = $libitem->get_description();
     if (!empty($summary)) {
         $xchannel->addChild("xmlns:itunes:summary", $summary);
     }
     $xchannel->addChild("xmlns:itunes:category", "Music");
     $owner = $libitem->get_user_owner();
     if ($owner) {
         $user_owner = new User($owner);
         $user_owner->format();
         $xowner = $xchannel->addChild("xmlns:itunes:owner");
         $xowner->addChild("xmlns:itunes:name", $user_owner->f_name);
     }
     $medias = $libitem->get_medias();
     foreach ($medias as $media_info) {
         $media = new $media_info['object_type']($media_info['object_id']);
         $media->format();
         $xitem = $xchannel->addChild("item");
         $xitem->addChild("title", $media->get_fullname());
         if ($media->f_artist) {
             $xitem->addChild("xmlns:itunes:author", $media->f_artist);
         }
         $xmlink = $xitem->addChild("link");
         $xmlink->addAttribute("href", $media->link);
         $xitem->addChild("guid", $media->link);
         if ($media->addition_time) {
             $xitem->addChild("pubDate", date("r", $media->addition_time));
         }
         $description = $media->get_description();
         if (!empty($description)) {
             $xitem->addChild("description", $description);
         }
         $xitem->addChild("xmlns:itunes:duration", $media->f_time);
         $xencl = $xitem->addChild("enclosure");
         $xencl->addAttribute("type", $media->mime);
         $xencl->addAttribute("length", $media->size);
         $surl = $media_info['object_type']::play_url($media_info['object_id']);
         $xencl->addAttribute("url", $surl);
     }
     $xmlstr = $xml->asXml();
     // Format xml output
     $dom = new DOMDocument();
     $dom->loadXML($xmlstr);
     $dom->formatOutput = true;
     return $dom->saveXML($dom->documentElement);
 }
开发者ID:cheese1,项目名称:ampache,代码行数:60,代码来源:xml_data.class.php

示例14: clean_url

	FROM ' . DB_PREFIX . 'news n
	LEFT JOIN ' . DB_PREFIX . 'users AS u ON u.id = n.author_id
	LEFT JOIN ' . DB_PREFIX . 'news_categories c ON c.id = n.category_id
	WHERE n.id = ' . u2);
if ($entry = $stmt->fetch(PDO::FETCH_ASSOC)) {
    if ($entry['description']) {
        $kio->description = $entry['description'];
    }
    if ($entry['keywords']) {
        $kio->keywords = $entry['keywords'];
    }
    if ($entry['c_name']) {
        $kio->addPath($entry['c_name'], 'news/category/' . $entry['c_id'] . '/' . clean_url($entry['c_name']));
    }
    if ($entry['author_id']) {
        $entry['author'] = User::format($entry['author_id'], $entry['nickname'], $entry['group_id']);
    }
    $entry['url'] = 'news/read/' . u2 . '/' . ($entry['c_name'] ? clean_url($entry['c_name']) . '/' : '') . clean_url($entry['title']);
    $module->subcodename = 'read';
    $kio->addPath($entry['title'], $entry['url']);
    try {
        $tpl = new PHPTAL('modules/news/read.html');
        $tpl->cfg = $cfg;
        $tpl->entry = $entry;
        $tpl->comments = $plug->comments(u2, 'news', $entry['comments'], $entry['url']);
        echo $tpl->execute();
    } catch (Exception $e) {
        echo template_error($e);
    }
} else {
    not_found(t('Selected entry number does not exists.'));
开发者ID:rafalenden,项目名称:KioCMS,代码行数:31,代码来源:read.php

示例15: getEntries

    private function getEntries()
    {
        global $sql;
        $start = array_search('edit_comment', Kio::$url);
        $edited_id = $start && ctype_digit(Kio::$url[$start + 1]) ? Kio::$url[$start + 1] : '';
        if (Kio::getConfig('order_by', 'comments') == 'DESC') {
            $x = $this->total + 1;
            $ascending = false;
        } else {
            $x = 1;
            $ascending = true;
        }
        $query = $sql->query('
			SELECT c.comment_id, c.comment_author, c.comment_author_id, c.comment_added,
				c.comment_message, c.comment_backlink, u.nickname, u.group_id, u.avatar
			FROM ' . DB_PREFIX . 'comments c
			LEFT JOIN ' . DB_PREFIX . 'users u ON u.id = c.comment_author_id
			WHERE c.comment_owner_child_id = ' . $this->connector_id . ' AND c.comment_owner = "' . u0 . '"
			ORDER BY c.comment_added ' . Kio::getConfig('order_by', 'comments'));
        while ($row = $query->fetch()) {
            $row['x'] = $ascending ? $x++ : $x--;
            if ($edited_id == $row['comment_id']) {
                $this->edited = $row;
                $edited_x = $x;
            }
            if ($row['comment_author_id']) {
                $row['comment_author'] = User::format($row['comment_author_id'], $row['nickname'], $row['group_id']);
            }
            $entries[] = $row;
        }
        return $entries;
    }
开发者ID:rafalenden,项目名称:KioCMS,代码行数:32,代码来源:comments.plugin.php


注:本文中的User::format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。