• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP encode_field函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中encode_field函数的典型用法代码示例。如果您正苦于以下问题:PHP encode_field函数的具体用法?PHP encode_field怎么用?PHP encode_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: get_event_fields

 /**
  * get parameters for one meeting facility
  *
  * @see overlays/event.php
  *
  * @return an array of fields or NULL
  */
 function get_event_fields()
 {
     global $context;
     // returned fields
     $fields = array();
     // chairman
     $label = i18n::s('Chairman');
     $input = $this->get_chairman_input();
     $fields[] = array($label, $input);
     // number of seats
     $label = i18n::s('Seats');
     $input = $this->get_seats_input();
     $hint = i18n::s('Maximum number of participants.');
     $fields[] = array($label, $input, $hint);
     // dimdim account
     $label = i18n::s('Account');
     if (!isset($this->attributes['account'])) {
         $this->attributes['account'] = '';
     }
     $input = '<input type="text" name="account" value ="' . encode_field($this->attributes['account']) . '" />';
     $hint = sprintf(i18n::s('Enter a valid %s account'), Skin::build_link('http://www.dimdim.com/', 'DimDim', 'basic'));
     $fields[] = array($label, $input, $hint);
     // dimdim password
     $label = i18n::s('Password');
     if (!isset($this->attributes['password'])) {
         $this->attributes['password'] = '';
     }
     $input = '<input type="text" name="password" value ="' . encode_field($this->attributes['password']) . '" />';
     $fields[] = array($label, $input);
     // add these tabs
     return $fields;
 }
开发者ID:rair,项目名称:yacs,代码行数:39,代码来源:dimdim_meeting.php


示例2: get_fields

 /**
  * build the list of fields for one overlay
  *
  * @see overlays/overlay.php
  *
  * @param the hosting attributes
  * @return a list of ($label, $input, $hint)
  */
 function get_fields($host, $field_pos = NULL)
 {
     global $context;
     // the number of plates
     $label = i18n::s('Persons to be served');
     $input = '<input type="text" name="people" value ="' . encode_field($this->attributes['people']) . '" />';
     $hint = i18n::s('Try to standardize your recipes for four people');
     $fields[] = array($label, $input, $hint);
     // the time for the preparation
     $label = i18n::s('Time to prepare');
     $input = '<input type="text" name="preparation_time" value ="' . encode_field($this->attributes['preparation_time']) . '" />';
     $hint = i18n::s('Do not take into account cooking time');
     $fields[] = array($label, $input, $hint);
     // the time for cooking
     $label = i18n::s('Time to cook');
     $input = '<input type="text" name="cooking_time" value ="' . encode_field($this->attributes['cooking_time']) . '" />';
     $hint = i18n::s('Do not take into account time to heat the owen');
     $fields[] = array($label, $input, $hint);
     // the ingredients
     $label = i18n::s('Ingredients');
     $input = '<textarea name="ingredients" rows="6" cols="50">' . encode_field($this->attributes['ingredients']) . '</textarea>';
     $hint = i18n::s('Type each ingredient on one separate line starting with a \'-\' character');
     $fields[] = array($label, $input, $hint);
     return $fields;
 }
开发者ID:rair,项目名称:yacs,代码行数:33,代码来源:recipe.php


示例3: get_fields

 /**
  * preserve content across page modification
  *
  * @see overlays/overlay.php
  *
  * @param the hosting attributes
  * @return a list of ($label, $input, $hint)
  */
 function get_fields($host, $field_pos = NULL)
 {
     global $context;
     // form fields
     $fields = array();
     // item identifier
     if (!isset($this->attributes['overlay_id'])) {
         $this->attributes['overlay_id'] = '';
     }
     // only associates can change the overlay id
     if (Surfer::is_associate()) {
         // isset($host['anchor']) && ($parent =&  Anchors::get($host['anchor'])) && $parent->is_assigned()) {
         $label = i18n::s('Overlay identifier');
         $input = '<input type="text" name="overlay_id" value="' . encode_field($this->attributes['overlay_id']) . '" />';
     } else {
         $label = 'hidden';
         $input = '<input type="hidden" name="overlay_id" value="' . encode_field($this->attributes['overlay_id']) . '" />';
     }
     // hidden attributes
     foreach ($this->attributes as $name => $value) {
         if (preg_match('/_content$/', $name)) {
             $input .= '<input type="hidden" name="' . encode_field($name) . '" value="' . encode_field($value) . '" />';
         }
     }
     // we do have something to preserve
     $fields[] = array($label, $input);
     // job done
     return $fields;
 }
开发者ID:rair,项目名称:yacs,代码行数:37,代码来源:mutable.php


示例4: get_fields

 /**
  * build the list of fields for one overlay
  *
  * @see overlays/overlay.php
  *
  * @param the hosting attributes
  * @return a list of ($label, $input, $hint)
  */
 function get_fields($host, $field_pos = NULL)
 {
     global $context;
     // a placeholder for new answers
     if (!isset($this->attributes['answers']) || !is_array($this->attributes['answers'])) {
         $this->attributes['answers'] = array();
         $this->attributes['answers'][] = array(i18n::s('Answer 1'), 0);
         $this->attributes['answers'][] = array(i18n::s('Answer 2'), 0);
         $this->attributes['answers'][] = array(i18n::s('Answer 3'), 0);
     }
     // list existing answers
     if (is_array($this->attributes['answers'])) {
         foreach ($this->attributes['answers'] as $answer) {
             list($text, $count) = $answer;
             $label = i18n::s('Answer');
             $input = '<input type="text" name="answer_texts[]" size="55" value="' . encode_field($text) . '" maxlength="64" />';
             $hint = i18n::s('Delete to suppress');
             $fields[] = array($label, $input, $hint);
             $label = i18n::s('Count');
             $input = '<input type="text" name="answer_counts[]" size="10" value="' . encode_field($count) . '" maxlength="64" />';
             $fields[] = array($label, $input);
         }
     }
     // append one answer
     $label = i18n::s('Add an answer');
     $input = '<input type="text" name="answer_texts[]" size="55" maxlength="64" />';
     $hint = i18n::s('Check this is a valid answer to your question');
     $fields[] = array($label, $input, $hint);
     $label = i18n::s('Count');
     $input = '<input type="text" name="answer_counts[]" size="10" value="0" maxlength="64" />';
     $hint = i18n::s('Do not trick your polls; Start at zero');
     $fields[] = array($label, $input, $hint);
     return $fields;
 }
开发者ID:rair,项目名称:yacs,代码行数:42,代码来源:poll.php


示例5: layout

 /**
  * list articles
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // clear flows
     $text .= '<br style="clear: left" />';
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // get the related overlay
         $overlay = Overlay::load($item, 'article:' . $item['id']);
         // the url to view this item
         $url = Articles::get_permalink($item);
         // use the title to label the link
         if (is_object($overlay)) {
             $title = Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $title = Codes::beautify_title($item['title']);
         }
         // the hovering title
         if ($item['introduction'] && $context['skins_with_details'] == 'Y') {
             $hover = strip_tags(Codes::beautify_introduction($item['introduction']));
         } else {
             $hover = i18n::s('View the page');
         }
         // title is a link to the target article
         $title =& Skin::build_link($url, $title, 'basic', $hover);
         // use the thumbnail for this article
         if ($icon = trim($item['thumbnail_url'])) {
             // fix relative path
             if (!preg_match('/^(\\/|http:|https:|ftp:)/', $icon)) {
                 $icon = $context['url_to_root'] . $icon;
             }
             // use parameter of the control panel for this one
             $options = '';
             if (isset($context['classes_for_thumbnail_images'])) {
                 $options = 'class="' . $context['classes_for_thumbnail_images'] . '" ';
             }
             // build the complete HTML element
             $icon = '<img src="' . $icon . '" alt="" title="' . encode_field($hover) . '" ' . $options . ' />';
             // use default icon if nothing to display
         } else {
             $icon = MAP_IMG;
         }
         // use the image as a link to the target page
         $icon =& Skin::build_link($url, $icon, 'basic', $hover);
         // add a floating box
         $text .= Skin::build_box($title, $icon, 'floating');
     }
     // clear flows
     $text .= '<br style="clear: left" />';
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:67,代码来源:layout_articles_as_titles.php


示例6: encode

 /**
  * prepare a PHP variable
  *
  * @param mixed an array of variables
  * @param we escape strings only at level 1
  * @return string the corresponding XML string
  */
 public static function encode($content, $level = 0)
 {
     // the new representation
     $text = '';
     // a string
     if (is_string($content)) {
         $text .= $content;
     } elseif (is_int($content)) {
         $text .= $content;
     } elseif (is_array($content)) {
         foreach ($content as $name => $value) {
             $name = str_replace('/', 'j', encode_field($name));
             $text .= "\t" . '<' . $name . '>' . self::encode($value, $level + 1) . '</' . $name . '>' . "\n";
         }
     }
     // we need to escape the string
     if ($level == 1 && (strpos($text, '<') !== FALSE || strpos($text, '>') !== FALSE)) {
         $text = str_replace(array('<', '>', '&'), array('&lt;', '&gt;', '&amp;'), $text);
     }
     // job done
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:29,代码来源:xml.php


示例7: encode_field

 // make an url
 $url = Categories::get_permalink($attributes);
 // gather information on this category
 $prefix = $suffix = $type = $icon = '';
 $label = Skin::strip($attributes['title']);
 // add background color to distinguish this category against others
 if (isset($attributes['background_color']) && $attributes['background_color']) {
     $label = '<span style="background-color: ' . $attributes['background_color'] . '; padding: 0 3px 0 3px;">' . $label . '</span>';
 }
 // build a unlink button for this category
 if (Surfer::is_associate()) {
     $suffix .= BR . '<form method="post" action="' . $context['script_url'] . '"><div>' . '<input type="hidden" name="anchor" value="category:' . $category_id . '" />' . '<input type="hidden" name="member" value="' . encode_field($member) . '" />' . Skin::build_submit_button(i18n::s('Unlink')) . '</div></form>';
 }
 // a button to change the thumbnail of the anchored page
 if ($icon) {
     $suffix .= ' <form method="post" action="' . $context['url_to_root'] . 'categories/set_as_thumbnail.php"><div>' . '<input type="hidden" name="anchor" value="' . encode_field($member) . '" />' . '<input type="hidden" name="id" value="' . $category_id . '" />' . Skin::build_submit_button(i18n::s('Use this thumbnail as the thumbnail of the page')) . '</div></form>';
 }
 // list sub-categories to be linked, if any
 // display active and restricted items
 $where = "categories.active='Y'";
 if (Surfer::is_member()) {
     $where .= " OR categories.active='R'";
 }
 if (Surfer::is_associate()) {
     $where .= " OR categories.active='N'";
 }
 // only consider live categories
 $where = '(' . $where . ')' . ' AND ((categories.expiry_date is NULL)' . "\tOR (categories.expiry_date <= '" . NULL_DATE . "') OR (categories.expiry_date > '" . $context['now'] . "'))";
 // limit the query to top level only
 $query = "SELECT categories.id, categories.title " . " FROM " . SQL::table_name('categories') . " AS categories " . " WHERE (" . $where . ") AND (categories.anchor='category:" . $category_id . "')" . " ORDER BY categories.title";
 $result = SQL::query($query);
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:select.php


示例8: foreach

 $message = Mailer::build_multipart($text);
 // reply-to: from the letters configuration file
 if (isset($context['letter_reply_to']) && $context['letter_reply_to']) {
     $headers[] = 'Reply-To: ' . $context['letter_reply_to'];
 }
 // list and count recipients
 $recipients_errors = $recipients_processed = $recipients_ok = 0;
 if (is_array($to)) {
     $context['text'] .= i18n::s('A message has been sent to:') . "\n" . '<ul>' . "\n";
     foreach ($to as $address) {
         $context['text'] .= '<li>' . encode_field($address) . '</li>' . "\n";
     }
     $context['text'] .= '</ul>' . "\n";
     $recipients_processed = count($to);
 } elseif ($to) {
     $context['text'] .= i18n::s('A message has been sent to:') . ' ' . encode_field($to) . BR . "\n";
     $recipients_processed = 1;
 } else {
     $context['text'] .= '<b>' . i18n::s('No recipient has been defined.') . "</b>" . BR . "\n";
 }
 // do the job
 if ($recipients_processed) {
     $recipients_ok = Mailer::post($from, $to, $subject, $message, NULL, $headers);
     Mailer::close();
     // we may have more recipients than expected
     if ($recipients_ok > $recipients_processed) {
         $recipients_processed = $recipients_ok;
     }
     // reports on error
     $recipients_errors = $recipients_processed - $recipients_ok;
     if ($recipients_errors || count($context['error'])) {
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:new.php


示例9: sprintf

// the current avatar, if any
if (isset($item['avatar_url']) && $item['avatar_url']) {
    $context['text'] .= '<p>' . sprintf(i18n::s('Current picture: %s'), BR . '<img src="' . $item['avatar_url'] . '" alt="" style="avatar" />') . '</p>' . "\n";
} else {
    $context['text'] .= '<p>' . i18n::s('No picture has been set for this profile.') . '</p>';
}
// list available avatars, except on error
if (!count($context['error']) && isset($item['id'])) {
    // upload an image
    //
    if (Images::allow_creation($item, null, 'user')) {
        // the form to post an image
        $text = '<form method="post" action="' . $context['url_to_root'] . 'images/edit.php" id="main_form" enctype="multipart/form-data"><div>' . '<input type="hidden" name="anchor" value="user:' . $item['id'] . '" />' . '<input type="hidden" name="action" value="set_as_avatar" />';
        $fields = array();
        // the image
        $text .= '<input type="file" name="upload" id="upload" size="30" accesskey="i" title="' . encode_field(i18n::s('Press to select a local file')) . '" />';
        $text .= ' ' . Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's');
        $text .= BR . '<span class="details">' . i18n::s('Select a .png, .gif or .jpeg image.') . ' (&lt;&nbsp;' . Skin::build_number($image_maximum_size, i18n::s('bytes')) . ')</span>';
        // end of the form
        $text .= '</div></form>';
        // the script used for form handling at the browser
        Page::insert_script('$("#upload").focus();');
        $context['text'] .= Skin::build_content(NULL, i18n::s('Upload an image'), $text);
    }
    // use the library
    //
    // where images are
    $path = 'skins/_reference/avatars';
    // browse the path to list directories and files
    if ($dir = Safe::opendir($context['path_to_root'] . $path)) {
        $text = '';
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:select_avatar.php


示例10: layout

 /**
  * list users
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!($count = SQL::count($result))) {
         return $text;
     }
     // allow for several lists in the same page
     static $serial;
     if (isset($serial)) {
         $serial++;
     } else {
         $serial = 1;
     }
     // don't blast too many people
     if ($count > 100) {
         $checked = '';
     } elseif (isset($this->layout_variant) && $this->layout_variant == 'unchecked') {
         $checked = '';
     } else {
         $checked = ' checked="checked"';
     }
     // div prefix
     $text .= '<div id="users_as_mail_panel_' . $serial . '">';
     // allow to select/deslect multiple rows at once
     $text .= '<input type="checkbox" class="row_selector" onclick="check_user_as_mail_panel_' . $serial . '(\'div#users_as_mail_panel_' . $serial . '\', this);"' . $checked . ' /> ' . i18n::s('Select all/none') . BR;
     // process all items in the list
     $count = 0;
     while ($item = SQL::fetch($result)) {
         // we need some address
         if (!$item['email']) {
             continue;
         }
         // do not write to myself
         if ($item['id'] == Surfer::get_id()) {
             continue;
         }
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'user:' . $item['id']);
         // column to select the row
         $text .= '<input type="checkbox" name="selected_users[]" class="row_selector" value="' . encode_field($item['email']) . '"' . $checked . ' />';
         // signal restricted and private users
         if ($item['active'] == 'N') {
             $text .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $text .= RESTRICTED_FLAG;
         }
         // the url to view this item
         $url = Users::get_permalink($item);
         // use the title to label the link
         if (is_object($overlay)) {
             $title = Codes::beautify_title($overlay->get_text('title', $item));
         } else {
             $title = Codes::beautify_title($item['full_name']);
         }
         // sanity check
         if (!$title) {
             $title = $item['nick_name'];
         }
         // link to this page
         $text .= Skin::build_link($url, $title, 'user');
         // the introductory text
         if ($item['introduction']) {
             $text .= '<span class="tiny"> - ' . Codes::beautify_introduction($item['introduction']) . '</span>';
         }
         // insert overlay data, if any
         if (is_object($overlay)) {
             $text .= $overlay->get_text('list', $item);
         }
         // display all tags
         if ($item['tags']) {
             $text .= ' <span class="tags">' . Skin::build_tags($item['tags'], 'user:' . $item['id']) . '</span>';
         }
         // append the row
         $text .= BR;
         $count++;
     }
     // the script used to check all items at once
     Page::insert_script('function check_user_as_mail_panel_' . $serial . '(scope, handle) {' . "\n" . '	$(scope + " input[type=\'checkbox\'].row_selector").each(' . "\n" . '		function() { $(this).attr("checked", $(handle).is(":checked"));}' . "\n" . '	);' . "\n" . '}' . "\n");
     // div suffix
     $text .= '</div>';
     // no valid account has been found
     if (!$count) {
         $text = '';
     }
     // end of processing
     SQL::free($result);
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:99,代码来源:layout_users_as_mail.php


示例11: encode_field

    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // describe the section
} else {
    // compute the url for this section
    $url = Sections::get_permalink($item);
    // get a description
    if ($item['introduction']) {
        $description = Codes::beautify($item['introduction']);
    } else {
        $description = Skin::strip(Codes::beautify($item['description']), 50);
    }
    // prepare the response
    $text = '<?xml version="1.0" encoding="' . $context['charset'] . '"?>' . "\n" . '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">' . "\n" . '	<rdf:Description rdf:about="' . $url . '">' . "\n" . '		<dc:title>' . encode_field($item['title']) . '</dc:title>' . "\n" . '		<dc:description>' . encode_field(Skin::strip($description)) . '</dc:description>' . "\n" . '		<dc:date>' . gmdate('Y-m-d') . '</dc:date>' . "\n" . '		<dc:format>text/html</dc:format>' . "\n";
    if (isset($item['language']) && $item['language'] && $item['language'] != 'none') {
        $text .= '		<dc:language>' . $item['language'] . '</dc:language>' . "\n";
    }
    $text .= '	</rdf:Description>' . "\n" . '</rdf:RDF>';
    //
    // transfer to the user agent
    //
    // handle the output correctly
    render_raw('text/xml; charset=' . $context['charset']);
    // suggest a name on download
    if (!headers_sent()) {
        $file_name = utf8::to_ascii(Skin::strip($context['page_title']) . '.opml.xml');
        Safe::header('Content-Disposition: inline; filename="' . str_replace('"', '', $file_name) . '"');
    }
    // enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:describe.php


示例12: layout


//.........这里部分代码省略.........
         // signal locked profiles
         if ($item['capability'] == '?') {
             $prefix .= EXPIRED_FLAG;
         }
         // item title
         if ($item['full_name']) {
             $title = ucfirst(Skin::strip($item['full_name'], 10));
             $hover = $item['nick_name'];
         } else {
             $title = ucfirst(Skin::strip($item['nick_name'], 10));
             $hover = $item['full_name'];
         }
         // show contact information
         if (Surfer::may_contact()) {
             $suffix .= Users::build_presence($item);
         }
         // the introduction
         if ($item['introduction']) {
             if (is_callable(array('codes', 'beautify'))) {
                 $suffix .= ' -&nbsp;' . Codes::beautify($item['introduction']);
             } else {
                 $suffix .= ' -&nbsp;' . $item['introduction'];
             }
         }
         // display all tags
         if ($item['tags']) {
             $suffix .= ' <span class="tags">' . Skin::build_tags($item['tags'], 'user:' . $item['id']) . '</span>';
         }
         // details
         $details = array();
         // capability
         if ($item['capability'] == 'A') {
             $details[] = i18n::s('Associate');
         } elseif ($item['capability'] == 'S') {
             $details[] = i18n::s('Subscriber');
         } else {
             $details[] = i18n::s('Member');
         }
         // creation date
         if ($item['create_date']) {
             $details[] = sprintf(i18n::s('registered %s'), Skin::build_date($item['create_date']));
         }
         // last login
         if ($this->layout_variant == 'dates') {
             if (isset($item['login_date']) && $item['login_date'] > NULL_DATE) {
                 $address = '';
                 if ($item['login_address']) {
                     $address = ' (' . $item['login_address'] . ')';
                 }
                 $details[] = sprintf(i18n::s('last login %s'), Skin::build_date($item['login_date']) . $address);
             } else {
                 $details[] = i18n::s('no login');
             }
         }
         // last post
         if ($this->layout_variant == 'dates') {
             if (isset($item['post_date']) && $item['post_date'] > NULL_DATE) {
                 $details[] = sprintf(i18n::s('last post %s'), Skin::build_date($item['post_date']));
             }
         }
         // posts
         if (intval($item['posts']) > 1) {
             $details[] = sprintf(i18n::s('%d posts'), intval($item['posts']));
         }
         if (count($details)) {
             if ($this->layout_variant == 'full') {
                 $suffix .= ' <span class="details">(' . implode(', ', $details) . ')</span>';
             } else {
                 $suffix .= ' <span class="details">' . implode(', ', $details) . '</span>';
             }
         }
         // flag idle users
         if (isset($item['click_date']) && $item['click_date'] < $idle) {
             $class = 'idle user';
         } else {
             $class = 'user';
         }
         // item summary
         $box .= $prefix . Skin::build_link($url, $title, 'user') . $suffix;
         // use the avatar, if any
         if (isset($item['avatar_url']) && isset($context['users_with_avatars']) && $context['users_with_avatars'] == 'Y') {
             $icon = $item['avatar_url'];
         }
         // layout this item
         if ($icon) {
             // build the complete HTML element
             $icon = '<img src="' . $icon . '" alt="" title="' . encode_field(strip_tags($title)) . '" />';
             // make it a clickable link
             $icon = Skin::build_link($url, $icon, 'basic');
             $list = array(array($box, $icon));
             $items[] = array($item['score'], Skin::finalize_list($list, 'decorated'));
             // put the item in a division
         } else {
             $items[] = array($item['score'], '<div style="margin: 0 0 1em 0">' . $box . '</div>');
         }
     }
     // end of processing
     SQL::free($result);
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_users_as_search.php


示例13: array

 $input .= BR . '<input type="radio" name="root_featured_layout" value="none"';
 if (isset($context['root_featured_layout']) && $context['root_featured_layout'] == 'none') {
     $input .= ' checked="checked"';
 }
 $input .= '/> ' . i18n::s('Do not list featured pages.');
 $fields[] = array($label, $input);
 // news can be either a static or an animated list
 $label = i18n::s('News');
 if (!isset($context['root_news_count']) || $context['root_news_count'] < 1 || $context['root_news_count'] > 7) {
     $context['root_news_count'] = 5;
 }
 $input = '<input type="radio" name="root_news_layout" value="static"';
 if (!isset($context['root_news_layout']) || !preg_match('/(rotate|scroll|none)/', $context['root_news_layout'])) {
     $input .= ' checked="checked"';
 }
 $input .= '/> ' . sprintf(i18n::s('List up to %s news aside.'), '<input type="text" name="root_news_count" value="' . encode_field($context['root_news_count']) . '" size="2" />');
 $input .= BR . '<input type="radio" name="root_news_layout" value="scroll"';
 if (isset($context['root_news_layout']) && $context['root_news_layout'] == 'scroll') {
     $input .= ' checked="checked"';
 }
 $input .= '/> ' . i18n::s('Similar to the first option, except that displayed information is scrolling.');
 $input .= BR . '<input type="radio" name="root_news_layout" value="rotate"';
 if (isset($context['root_news_layout']) && $context['root_news_layout'] == 'rotate') {
     $input .= ' checked="checked"';
 }
 $input .= '/> ' . i18n::s('Similar to the first option, except that news are rotated.');
 $input .= BR . '<input type="radio" name="root_news_layout" value="none"';
 if (isset($context['root_news_layout']) && $context['root_news_layout'] == 'none') {
     $input .= ' checked="checked"';
 }
 $input .= '/> ' . i18n::s('Do not list news.');
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:configure.php


示例14: sprintf

 // the splash message
 $inbound .= '<p>' . sprintf(i18n::s('To extend the list of feeders add adequate %s.'), Skin::build_link('servers/', i18n::s('server profiles'), 'shortcut')) . "</p>\n";
 // feeding period
 if (!isset($context['minutes_between_feeds']) || !$context['minutes_between_feeds']) {
     $context['minutes_between_feeds'] = 60;
 }
 $label = i18n::s('Feeding period');
 $input = '<input type="text" name="minutes_between_feeds" size="10" value="' . encode_field($context['minutes_between_feeds']) . '" maxlength="5" />';
 $hint = i18n::s('In minutes. 60 means one hour, etc. Minimum value is 5 minutes');
 $fields[] = array($label, $input, $hint);
 // maximum_news
 if (!isset($context['maximum_news']) || !$context['maximum_news']) {
     $context['maximum_news'] = 1000;
 }
 $label = i18n::s('Maximum news');
 $input = '<input type="text" name="maximum_news" size="10" value="' . encode_field($context['maximum_news']) . '" maxlength="5" />';
 $hint = i18n::s('Oldest news entries will be deleted');
 $fields[] = array($label, $input, $hint);
 // debug_feeds
 $label = i18n::s('Debug feeds');
 $checked = '';
 if (isset($context['debug_feeds']) && $context['debug_feeds'] == 'Y') {
     $checked = 'checked="checked" ';
 }
 $input = '<input type="checkbox" name="debug_feeds" value="Y" ' . $checked . '/> ' . i18n::s('Save data sent and received in temporary/debug.txt');
 $hint = i18n::s('Use this option only for troubleshooting');
 $fields[] = array($label, $input, $hint);
 // build the form
 $inbound .= Skin::build_form($fields);
 $fields = array();
 //
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:configure.php


示例15: fpassthru

                    return;
                }
                // actual transmission except on a HEAD request
                if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
                    fpassthru($handle);
                }
                fclose($handle);
            }
            // the post-processing hook, then exit even on HEAD
            finalize_page();
            return;
        }
        // redirect to the actual file
        $target_href = $context['url_to_home'] . $context['url_to_root'] . Files::get_path($item['anchor']) . '/' . rawurlencode($item['file_name']);
    }
    // let the web server provide the actual file
    if (!headers_sent()) {
        Safe::header('Status: 302 Found', TRUE, 302);
        Safe::header('Location: ' . $target_href);
        // this one may be blocked by anti-popup software
    } else {
        $context['site_head'] .= '<meta http-equiv="Refresh" content="1;url=' . $target_href . '" />' . "\n";
    }
    // help the surfer
    $context['text'] .= '<p>' . i18n::s('You are requesting the following file:') . '</p>' . "\n";
    $context['text'] .= '<p><a href="' . encode_field($target_href) . '">' . basename($target_href) . '</a></p>' . "\n";
    // automatic or not
    $context['text'] .= '<p>' . i18n::s('The download should start automatically within seconds. Else hit the provided link to trigger it manually.') . '</p>' . "\n";
}
// render the skin
render_skin();
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:fetch.php


示例16: layout

 /**
  * list files
  *
  * Recognize following variants:
  * - 'section:123' to list items attached to one particular anchor
  * - 'no_author' to list items attached to one user profile
  *
  * @param resource the SQL result
  * @return string HTML text to be displayed, or NULL
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return some text
     $text = '';
     // empty list
     if (!SQL::count($result)) {
         return $text;
     }
     // sanity check
     if (!isset($this->focus)) {
         $this->focus = '';
     }
     // process all items in the list
     $items = array();
     while ($item = SQL::fetch($result)) {
         // one box at a time
         $box = '';
         // get the main anchor
         $anchor = Anchors::get($item['anchor']);
         // we feature only the head of the list, if we are at the origin page
         if (!count($items) && $anchor && is_string($this->focus) && $this->focus == $anchor->get_reference()) {
             $box .= Codes::render_object('file', $item['id']);
             // no side icon
             $icon = '';
             // we are listing various files from various places
         } else {
             $prefix = $suffix = '';
             // stream the file
             if (Files::is_stream($item['file_name'])) {
                 $url = Files::get_url($item['id'], 'stream', $item['file_name']);
             } else {
                 $url = Files::get_url($item['id'], 'fetch', $item['file_name']);
             }
             // absolute url
             $url = $context['url_to_home'] . $context['url_to_root'] . $url;
             // signal restricted and private files
             if ($item['active'] == 'N') {
                 $prefix .= PRIVATE_FLAG;
             } elseif ($item['active'] == 'R') {
                 $prefix .= RESTRICTED_FLAG;
             }
             // file title or file name
             $label = Codes::beautify_title($item['title']);
             if (!$label) {
                 $label = ucfirst(str_replace(array('%20', '-', '_'), ' ', $item['file_name']));
             }
             // show a reference to the file for members
             $hover = i18n::s('Get the file');
             if (Surfer::is_member()) {
                 $hover .= ' [file=' . $item['id'] . ']';
             }
             // flag files uploaded recently
             if ($item['create_date'] >= $context['fresh']) {
                 $suffix .= NEW_FLAG;
             } elseif ($item['edit_date'] >= $context['fresh']) {
                 $suffix .= UPDATED_FLAG;
             }
             // one line of text
             $box .= $prefix . Skin::build_link($url, $label, 'basic', $hover) . $suffix;
             // side icon
             if ($item['thumbnail_url']) {
                 $icon = $item['thumbnail_url'];
             } else {
                 $icon = $context['url_to_root'] . Files::get_icon_url($item['file_name']);
             }
             // build the complete HTML element
             $icon = '<img src="' . $icon . '" alt="" title="' . encode_field(strip_tags($label)) . '" />';
             // make it a clickable link
             $icon = Skin::build_link($url, $icon, 'basic');
         }
         // first line of details
         $details = array();
         // file poster and last action
         if ($this->layout_variant != 'no_author') {
             $details[] = sprintf(i18n::s('shared by %s %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date']));
         } else {
             $details[] = Skin::build_date($item['edit_date']);
         }
         // downloads
         if ($item['hits'] > 1) {
             $details[] = Skin::build_number($item['hits'], i18n::s('downloads'));
         }
         // file size
         if ($item['file_size'] > 1) {
             $details[] = Skin::build_number($item['file_size'], i18n::s('bytes'));
         }
         // anchor link
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_files.php


示例17: layout

 /**
  * list articles as digg do
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // empty list
     if (!SQL::count($result)) {
         $label = i18n::s('No page to display.');
         if (Surfer::is_associate()) {
             $label .= ' ' . sprintf(i18n::s('Use the %s to populate this server.'), Skin::build_link('help/populate.php', i18n::s('Content Assistant'), 'shortcut'));
         }
         $output = '<p>' . $label . '</p>';
         return $output;
     }
     // build a list of articles
     $text = '';
     $item_count = 0;
     include_once $context['path_to_root'] . 'comments/comments.php';
     include_once $context['path_to_root'] . 'links/links.php';
     while ($item = SQL::fetch($result)) {
         // permalink
         $url = Articles::get_permalink($item);
         // get the anchor
         $anchor = Anchors::get($item['anchor']);
         // get the related overlay, if any
         $overlay = Overlay::load($item, 'article:' . $item['id']);
         // next item
         $item_count += 1;
         // section opening
         if ($item_count == 1) {
             $text .= '<div class="newest">' . "\n";
         }
         // reset everything
         $content = $prefix = $label = $suffix = $icon = '';
         // the icon to put aside
         if ($item['thumbnail_url']) {
             $icon = $item['thumbnail_url'];
         } elseif (is_callable(array($anchor, 'get_bullet_url'))) {
             $icon = $anchor->get_bullet_url();
         }
         if ($icon) {
             $icon = '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $icon . '" class="right_image" alt="' . encode_field(i18n::s('View the page')) . '" title="' . encode_field(i18n::s('View the page')) . '" /></a>';
         }
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // flag articles updated recently
         if ($item['create_date'] >= $context['fresh']) {
             $suffix .= ' ' . NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= ' ' . UPDATED_FLAG;
         }
         // add details
         $details = array();
         // the author
         if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
             if ($item['edit_name'] == $item['create_name']) {
                 $details[] = sprintf(i18n::s('by %s'), ucfirst($item['create_name']));
             } else {
                 $details[] = sprintf(i18n::s('by %s, %s'), ucfirst($item['create_name']), ucfirst($item['edit_name']));
             }
         }
         // the publish date
         $details[] = Skin::build_date($item['publish_date']);
         // rating
         $rating_label = '';
         if ($item['rating_count']) {
             $rating_label = Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])) . ' ' . sprintf(i18n::ns('%d rating', '%d ratings', $item['rating_count']), $item['rating_count']) . ' ';
         }
         // add a link to let surfer rate this item
         if (is_object($anchor) && !$anchor->has_option('without_rating')) {
             if (!$item['rating_count']) {
                 $rating_label .= i18n::s('Rate this page');
             }
             $rating_label = Skin::build_link(Articles::get_url($item['id'], 'like'), $rating_label, 'basic', i18n::s('Rate this page'));
         }
         // display current rating, and allow for rating
         $details[] = $rating_label;
         // details
         if (count($details)) {
             $content .= '<p class="details">' . ucfirst(implode(', ', $details)) . '</p>';
         }
         // the full introductory text
         if ($item['introduction']) {
             $content .= Codes::beautify($item['introduction'], $item['options']);
         } elseif (!is_object($overlay)) {
             include_once $context['path_to_root'] . 'articles/article.php';
             $article = new Article();
             $article->load_by_content($item);
             $content .= $article->get_teaser('teaser');
         }
//.........这里部分代码省略.........
开发者ID:rair,

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP encode_html函数代码示例发布时间:2022-05-15
下一篇:
PHP encode_data_query_index函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap