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


PHP Surfer::may_contact方法代码示例

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


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

示例1: layout

 /**
  * list users
  *
  * @param resource the SQL result
  * @return array of resulting items ($score, $summary), or NULL
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return an array of array($score, $summary)
     $items = array();
     // empty list
     if (!SQL::count($result)) {
         return $items;
     }
     // flag idle users
     $idle = gmstrftime('%Y-%m-%d %H:%M:%S', time() - 600);
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // one box at a time
         $box = '';
         // initialize variables
         $prefix = $suffix = $icon = '';
         // the url to view this item
         $url = Users::get_permalink($item);
         // flag profiles updated recently
         if ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // 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 .= ' - ' . Codes::beautify($item['introduction']);
             } else {
                 $suffix .= ' - ' . $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
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_users_as_search.php

示例2: layout

 /**
  * list users
  *
  * @param resource the SQL result
  * @return array of resulting items (id => label), or NULL
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return an array of ($url => $attributes)
     $items = array();
     // empty list
     if (!($delta = SQL::count($result))) {
         return $items;
     }
     // build a list of users
     while ($item = SQL::fetch($result)) {
         // reset everything
         $prefix = $label = $suffix = $icon = '';
         // signal restricted and private users
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // indicate the id in the hovering popup
         $hover = i18n::s('View profile');
         if (Surfer::is_member()) {
             $hover .= ' [user=' . $item['id'] . ']';
         }
         // the url to view this item
         $url = Users::get_permalink($item);
         // use full name, then nick name
         if (isset($item['full_name']) && $item['full_name']) {
             $title = $item['full_name'];
         } elseif (isset($item['nick_name'])) {
             $title = $item['nick_name'];
         }
         // show contact information
         if (Surfer::may_contact() && ($contacts = Users::build_presence($item))) {
             $suffix .= ' ' . $contacts;
         }
         // flag users updated recently
         if ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG . ' ';
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG . ' ';
         }
         // do not use description because of codes such as location, etc
         if (isset($item['introduction']) && $item['introduction']) {
             $suffix .= ' - ' . Codes::beautify($item['introduction']);
         }
         // display all tags
         // 			if($item['tags'])
         // 				$suffix .= ' <span class="details tags">'.Skin::build_tags($item['tags'], 'user:'.$item['id']).'</span>';
         // the full label
         $label = $prefix . Skin::build_link($url, $title, 'basic', $hover) . $suffix;
         // use the avatar, if any
         $icon = '';
         if (isset($item['avatar_url']) && $item['avatar_url']) {
             $icon = '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $item['avatar_url'] . '" alt=" " title="' . encode_field($hover) . '" style="float: left; max-width: 25px; max-height: 25px; margin-right: 4px;" /></a>';
         }
         // list all components for this item --use basic link style to avoid prefix or suffix images, if any
         $items[$item['id']] = $icon . $label;
     }
     // end of processing
     SQL::free($result);
     // job done
     return $items;
 }
开发者ID:rair,项目名称:yacs,代码行数:72,代码来源:layout_users_as_watch.php

示例3: may_mail

 /**
  * can this surfer mail other users?
  *
  * @return TRUE if alowed, FALSE otherwise
  */
 public static function may_mail()
 {
     global $context;
     // email has to be activated
     if (!isset($context['with_email'])) {
         return FALSE;
     }
     if ($context['with_email'] != 'Y') {
         return FALSE;
     }
     // only members can send e-mail
     if (!Surfer::is_member()) {
         return FALSE;
     }
     return Surfer::may_contact();
 }
开发者ID:rair,项目名称:yacs,代码行数:21,代码来源:surfer.php

示例4: build_profile


//.........这里部分代码省略.........
             // from where
             if (isset($user['from_where']) && $user['from_where']) {
                 $details[] = sprintf(i18n::s('from %s'), Codes::beautify($user['from_where']));
             }
             // display details
             if (count($details)) {
                 $text .= '<span class="details">' . implode(', ', $details) . '</span>' . BR;
             }
             // use the introduction field, if any
             if (isset($user['introduction']) && $user['introduction']) {
                 $text .= Codes::beautify($user['introduction']);
             }
             // suffix after the full name
             if ($text) {
                 $text = ' -- ' . $text;
             }
             $text = '<div class="top">' . $avatar . Skin::build_link($url, $label, 'user') . $text . '</div><br style="clear: left;" />';
             break;
             // at the end of the page
         // at the end of the page
         case 'suffix':
             // avatar
             $avatar = '';
             if (isset($user['avatar_url']) && $user['avatar_url']) {
                 $thumb = '';
                 if ($position = strrpos($user['avatar_url'], '/')) {
                     $thumb = substr($user['avatar_url'], 0, $position) . '/thumbs' . substr($user['avatar_url'], $position);
                 }
                 if (is_readable($context['path_to_root'] . str_replace($context['url_to_root'], '', $thumb))) {
                     $avatar =& Skin::build_link($url, '<img src="' . $thumb . '" alt="" title="avatar" class="avatar left_image" />', 'basic');
                 } else {
                     $avatar =& Skin::build_link($url, '<img src="' . $user['avatar_url'] . '" alt="" title="avatar" class="avatar left_image' . $more_styles . '" />', 'basic');
                 }
             }
             // date of post
             if ($more) {
                 $text .= $more . ' ';
             }
             // from where
             if (isset($user['from_where']) && $user['from_where']) {
                 $text .= sprintf(i18n::s('from %s'), Codes::beautify($user['from_where']));
             }
             // display details
             if ($text) {
                 $text = '<span class="details">' . $text . '</span>' . BR;
             }
             // use the introduction field, if any
             if (isset($user['introduction']) && $user['introduction']) {
                 $text .= Codes::beautify($user['introduction']);
             }
             // suffix after the full name
             if ($text) {
                 $text = ' -- ' . $text;
             }
             $text = '<address>' . $avatar . Skin::build_link($url, $label, 'user') . $text . '</address><br style="clear: left;" />';
             break;
             // in a sidebox
         // in a sidebox
         case 'extra':
             // details attributes
             $details = array();
             // avatar
             if (isset($user['avatar_url']) && $user['avatar_url']) {
                 $details[] =& Skin::build_link($url, '<img src="' . $user['avatar_url'] . '" alt="" title="avatar" class="avatar' . $more_styles . '" />', 'basic');
             } else {
                 if (Surfer::is_empowered()) {
                     Skin::define_img('IMAGES_ADD_IMG', 'images/add.gif');
                     $details[] =& Skin::build_link(Users::get_url($user['id'], 'select_avatar'), IMAGES_ADD_IMG . i18n::s('Add picture'), 'basic');
                 }
             }
             // date of post
             if ($more) {
                 $details[] = $more;
             }
             // from where
             if (isset($user['from_where']) && $user['from_where']) {
                 $details[] = sprintf(i18n::s('from %s'), Codes::beautify($user['from_where']));
             }
             // details first
             if (count($details)) {
                 $text .= '<p class="details">' . join(BR, $details) . '</p>';
             }
             // do not use description because of codes such as location, etc
             if (isset($user['introduction']) && $user['introduction']) {
                 $text .= Codes::beautify($user['introduction']);
             }
             // show contact information
             if (Surfer::may_contact()) {
                 $contacts = Users::build_presence($user);
                 if ($contacts) {
                     $text .= BR . $contacts;
                 }
             }
             // everything in an extra box
             $text = Skin::build_box($label, $text, 'profile');
             break;
     }
     // return by reference
     return $text;
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:skin_skeleton.php

示例5: layout

 /**
  * list users
  *
  * @param resource the SQL result
  * @return string the rendered text
  *
  * @see layouts/layout.php
  **/
 function layout($result)
 {
     global $context;
     // we return an array of ($url => $attributes)
     $items = array();
     // empty list
     if (!SQL::count($result)) {
         return $items;
     }
     // flag idle users
     $idle = gmstrftime('%Y-%m-%d %H:%M:%S', time() - 600);
     // default variant
     if (!isset($this->layout_variant)) {
         $this->layout_variant == 'full';
     }
     // process all items in the list
     while ($item = SQL::fetch($result)) {
         // initialize variables
         $prefix = $suffix = $icon = '';
         // the url to view this item
         $url = Users::get_permalink($item);
         // flag profiles updated recently
         if ($item['create_date'] >= $context['fresh']) {
             $suffix .= NEW_FLAG;
         } elseif ($item['edit_date'] >= $context['fresh']) {
             $suffix .= UPDATED_FLAG;
         }
         // signal restricted and private articles
         if ($item['active'] == 'N') {
             $prefix .= PRIVATE_FLAG;
         } elseif ($item['active'] == 'R') {
             $prefix .= RESTRICTED_FLAG;
         }
         // signal locked profiles
         if ($item['capability'] == '?') {
             $prefix .= EXPIRED_FLAG;
         }
         // item title
         if ($item['full_name']) {
             $label = ucfirst(Skin::strip($item['full_name'], 10));
             $hover = $item['nick_name'];
         } else {
             $label = 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']));
             }
//.........这里部分代码省略.........
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:layout_users.php

示例6: sprintf

     $text .= BR . Skin::build_link($item['web_address'], $item['web_address'], 'external');
 }
 // agent, if any
 if (isset($item['vcard_agent']) && $item['vcard_agent']) {
     $text .= '</p><p>';
     if ($agent = Users::get($item['vcard_agent'])) {
         $text .= sprintf(i18n::s('%s: %s'), i18n::s('Alternate contact'), Skin::build_link(Users::get_permalink($agent), $agent['full_name'] ? $agent['full_name'] : $agent['nick_name'], 'user'));
     } else {
         $text .= sprintf(i18n::s('%s: %s'), i18n::s('Alternate contact'), $item['vcard_agent']);
     }
 }
 $text .= '</p>';
 $information .= Skin::build_box(i18n::s('Business card'), $text, 'unfolded');
 // do not let robots steal addresses
 $box = array('bar' => array(), 'text' => '');
 if (Surfer::may_contact()) {
     // put contact addresses in a table
     $rows = array();
     // a clickable twitter address
     if (isset($item['twitter_address']) && $item['twitter_address']) {
         $rows[] = array(i18n::s('Twitter'), Skin::build_presence($item['twitter_address'], 'twitter') . ' ' . Skin::build_link('http://www.twitter.com/' . $item['twitter_address'], $item['twitter_address']));
     }
     // a clickable jabber address
     if (isset($item['jabber_address']) && $item['jabber_address']) {
         $rows[] = array(i18n::s('Jabber'), Skin::build_presence($item['jabber_address'], 'jabber') . ' ' . $item['jabber_address']);
     }
     // a clickable skype address
     if (isset($item['skype_address']) && $item['skype_address']) {
         $rows[] = array(i18n::s('Skype'), Skin::build_presence($item['skype_address'], 'skype') . ' ' . $item['skype_address']);
     }
     // a clickable yahoo address -- the on-line status indicator requires to be connected to the Internet
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php


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