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


PHP Streams::displayName方法代码示例

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


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

示例1: Streams_before_Q_responseExtras

function Streams_before_Q_responseExtras()
{
    Q_Response::addScript('plugins/Streams/js/Streams.js');
    $host = Q_Config::get('Streams', 'node', 'host', Q_Config::get('Q', 'node', 'host', null));
    $port = Q_Config::get('Streams', 'node', 'port', Q_Config::get('Q', 'node', 'port', null));
    $user = Users::loggedInUser();
    if ($user) {
        Q_Response::setScriptData('Q.plugins.Users.loggedInUser.displayName', Streams::displayName($user));
    }
    if (!Q_Request::isAjax()) {
        $invite_url = Q_Config::get('Streams', 'invite', 'url', "http://invites.to");
        Q_Response::setScriptData('Q.plugins.Streams.invite.url', $invite_url);
        if (isset($host) && isset($port)) {
            Q_Response::setScriptData('Q.plugins.Streams.node', array("http://{$host}:{$port}"));
        }
        if ($sizes = Q_Config::expect('Streams', 'types', 'Streams/image', 'sizes')) {
            sort($sizes);
            Q_Response::setScriptData('Q.plugins.Streams.image.sizes', $sizes);
        }
        $defaults = array('readLevel' => Streams::$READ_LEVEL['messages'], 'writeLevel' => Streams::$WRITE_LEVEL['join'], 'adminLevel' => Streams::$ADMIN_LEVEL['invite']);
        Q_Response::setScriptData('Q.plugins.Streams.defaults', $defaults);
        if ($froalaKey = Q_Config::get('Streams', 'froala', 'key', null)) {
            Q_Response::setScriptData('Q.plugins.Streams.froala.key', $froalaKey);
        }
    }
    Q_Response::addStylesheet("plugins/Streams/css/Streams.css");
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:27,代码来源:Q_responseExtras.php

示例2: Websites_before_Streams_Stream_save_Websites_article

function Websites_before_Streams_Stream_save_Websites_article($params)
{
    $stream = $params['stream'];
    $modifiedFields = $params['modifiedFields'];
    if ($stream->wasRetrieved()) {
        return;
    }
    $user = new Users_User();
    if (empty($stream->userId) and empty($modifiedFields['userId'])) {
        if ($liu = Users::loggedInUser()) {
            $stream->userId = $liu->id;
        } else {
            throw new Q_Exception_RequiredField(array('field' => 'userId'));
        }
    }
    $user->id = $stream->userId;
    if (!$user->retrieve()) {
        throw new Users_Exception_NoSuchUser();
    }
    $title = Streams::displayName($user, array('fullAccess' => true));
    if (isset($title)) {
        $stream->title = $title;
    }
    $stream->icon = $user->iconUrl();
    $s = Streams::fetchOne($user->id, $user->id, "Streams/user/icon");
    if (!$s or !($sizes = $s->getAttribute('sizes', null))) {
        $sizes = Q_Config::expect('Users', 'icon', 'sizes');
        sort($sizes);
    }
    $stream->setAttribute('sizes', $sizes);
}
开发者ID:dmitriz,项目名称:Platform,代码行数:31,代码来源:Streams_Stream_save_Websites_article.php

示例3: Streams_register_response_data

function Streams_register_response_data()
{
    $user = Q::ifset(Users::$cache['user']);
    if (!$user) {
        return array('user' => null);
    }
    $u = $user->exportArray();
    $u['displayName'] = Streams::displayName($user);
    return array('user' => $u);
}
开发者ID:dmitriz,项目名称:Platform,代码行数:10,代码来源:data.php

示例4: Users_login_response_data

function Users_login_response_data()
{
    $user = null;
    $roles = array();
    if ($row = Users::loggedInUser()) {
        $user = $row->exportArray();
        $user['displayName'] = Streams::displayName($row);
        $roles = Users::roles();
    }
    return compact('user', 'roles');
}
开发者ID:dmitriz,项目名称:Platform,代码行数:11,代码来源:data.php

示例5: Awards_after_Q_responseExtras

function Awards_after_Q_responseExtras()
{
    Q_Response::addScript('plugins/Awards/js/Awards.js');
    try {
        $amount = Awards_Credits::amount();
    } catch (Exception $e) {
        $amount = null;
    }
    Q_Response::setScriptData('Q.plugins.Awards.credits', compact('amount'));
    $user = Users::loggedInUser();
    if ($user) {
        Q_Response::setScriptData("Q.Users.loggedInUser.displayName", Streams::displayName($user));
    }
}
开发者ID:atirjavid,项目名称:Platform,代码行数:14,代码来源:Q_responseExtras.php

示例6: Streams_user_response_data

function Streams_user_response_data($params)
{
    $identifier = Users::requestedIdentifier($type);
    $hash = md5(strtolower(trim($identifier)));
    $icon = Q_Config::get('Users', 'register', 'icon', 'leaveDefault', false) ? $url = "plugins/Users/img/icons/default/80.png" : Q_Request::baseUrl() . "/action.php/Users/thumbnail?hash={$hash}&size=80&type=" . Q_Config::get('Users', 'login', 'iconType', 'wavatar');
    // check our db
    if ($user = Users::userFromContactInfo($type, $identifier)) {
        $displayname = Streams::displayName($user);
        $verified = !!Users::identify($type, $identifier);
        return array('exists' => $user->id, 'verified' => $verified, 'username' => $user->username, 'displayName' => $displayname, 'icon' => $verified ? $icon : $user->icon, 'passphrase_set' => !empty($user->passphraseHash), 'fb_uid' => $user->fb_uid ? $user->fb_uid : null);
    }
    if ($type === 'email') {
        $email = new Users_Email();
        Q_Valid::email($identifier, $normalized);
        $email->address = $normalized;
        $exists = $email->retrieve();
    } else {
        if ($type === 'mobile') {
            $mobile = new Users_Mobile();
            Q_Valid::phone($identifier, $normalized);
            $mobile->number = $normalized;
            $exists = $mobile->retrieve();
        }
    }
    if (empty($exists) and Q_Config::get('Users', 'login', 'noRegister', false)) {
        $nicetype = $type === 'email' ? 'email address' : 'mobile number';
        throw new Q_Exception("This {$nicetype} was not registered", array('identifier'));
    }
    $result = array("entry" => array(array("thumbnailUrl" => $icon)));
    if ($type === 'email') {
        $result['emailExists'] = !empty($exists);
    } else {
        $result['mobileExists'] = !empty($exists);
    }
    if ($terms_label = Users::termsLabel('register')) {
        $result['termsLabel'] = $terms_label;
    }
    return $result;
}
开发者ID:dmitriz,项目名称:Platform,代码行数:39,代码来源:data.php

示例7: invite


//.........这里部分代码省略.........
         $filename = APP_VIEWS_DIR . DS . $template;
         if (!Q::realPath($filename)) {
             throw new Q_Exception_MissingFile(compact('filename'));
         }
         $ext = $pathinfo = pathinfo($template, PATHINFO_EXTENSION);
         if ($ext !== 'handlebars') {
             throw new Q_Exception_WrongValue(array('field' => 'options.html[0]', 'range' => 'a filename with extension .handlebars'));
         }
         $path = Streams::invitationsPath($asUserId) . DS . $batchName;
         Q_Utils::canWriteToPath($path, true, true);
     }
     // get user ids if any to array, throw if user not found
     $raw_userIds = isset($who['userId']) ? Users_User::verifyUserIds($who['userId'], true) : array();
     // merge labels if any
     if (isset($who['label'])) {
         $label = $who['label'];
         if (is_string($label)) {
             $label = array_map('trim', explode("\t", $labels));
         }
         $raw_userIds = array_merge($raw_userIds, Users_User::labelsToIds($asUserId, $label));
     }
     // merge identifiers if any
     $identifierType = null;
     $statuses = null;
     if (isset($who['identifier'])) {
         $identifier = $who['identifier'];
         if (is_string($identifier)) {
             if (Q_Valid::email($who['identifier'])) {
                 $identifierType = 'email';
             } else {
                 if (Q_Valid::phone($who['identifier'])) {
                     $identifierType = 'mobile';
                 }
             }
             $identifier = array_map('trim', explode("\t", $identifier));
         }
         $statuses = array();
         $identifier_ids = Users_User::idsFromIdentifiers($identifier, $statuses);
         $raw_userIds = array_merge($raw_userIds, $identifier_ids);
     }
     // merge fb uids if any
     if (isset($who['fb_uid'])) {
         $fb_uids = $who['fb_uid'];
         if (is_string($fb_uids)) {
             $fb_uids = array_map('trim', explode("\t", $fb_uids));
         }
         $raw_userIds = array_merge($raw_userIds, Users_User::idsFromFacebook($fb_uids));
     }
     if (!empty($who['newFutureUsers'])) {
         $nfu = $who['newFutureUsers'];
         for ($i = 0; $i < $nfu; ++$i) {
             $raw_userIds[] = Users::futureUser('none', null)->id;
         }
     }
     // ensure that each userId is included only once
     // and remove already participating users
     $raw_userIds = array_unique($raw_userIds);
     $total = count($raw_userIds);
     $userIds = Streams_Participant::filter($raw_userIds, $stream);
     $to_invite = count($userIds);
     $appUrl = !empty($options['appUrl']) ? $options['appUrl'] : Q_Request::baseUrl() . '/' . Q_Config::get("Streams", "types", $stream->type, "invite", "url", "plugins/Streams/stream");
     // now check and define levels for invited user
     $readLevel = isset($options['readLevel']) ? $options['readLevel'] : null;
     if (isset($readLevel)) {
         if (!$stream->testReadLevel($readLevel)) {
             // We can't assign greater read level to other people than we have ourselves!
             throw new Users_Exception_NotAuthorized();
         }
     }
     $writeLevel = isset($options['writeLevel']) ? $options['writeLevel'] : null;
     if (isset($writeLevel)) {
         if (!$stream->testWriteLevel($writeLevel)) {
             // We can't assign greater write level to other people than we have ourselves!
             throw new Users_Exception_NotAuthorized();
         }
     }
     $adminLevel = isset($options['adminLevel']) ? $options['adminLevel'] : null;
     if (isset($adminLevel)) {
         if (!$stream->testAdminLevel($adminLevel + 1)) {
             // We can't assign an admin level greater, or equal, to our own!
             // A stream's publisher can assign owners. Owners can assign admins.
             // Admins can confer powers to invite others, to some people.
             // Those people can confer the privilege to publish a message re this stream.
             // But admins can't assign other admins, and even stream owners
             // can't assign other owners.
             throw new Users_Exception_NotAuthorized();
         }
     }
     // calculate expiry time
     $duration = Q_Config::get("Streams", "types", $stream->type, "invite", "duration", false);
     $expiry = $duration ? strtotime($duration) : null;
     // let node handle the rest, and get the result
     $params = array("Q/method" => "Streams/Stream/invite", "invitingUserId" => $asUserId, "username" => $asUser->username, "userIds" => Q::json_encode($userIds), "stream" => Q::json_encode($stream->toArray()), "appUrl" => $appUrl, "label" => Q::ifset($options, 'label', null), "myLabel" => Q::ifset($options, 'myLabel', null), "readLevel" => $readLevel, "writeLevel" => $writeLevel, "adminLevel" => $adminLevel, "displayName" => isset($options['displayName']) ? $options['displayName'] : Streams::displayName($asUser), "expiry" => $expiry);
     if ($template) {
         $params['template'] = $template;
         $params['batchName'] = $batchName;
     }
     $result = Q_Utils::queryInternal('Q/node', $params);
     return array('success' => $result, 'invited' => $userIds, 'statuses' => $statuses, 'identifierType' => $identifierType, 'alreadyParticipating' => $total - $to_invite);
 }
开发者ID:atirjavid,项目名称:Platform,代码行数:101,代码来源:Streams.php

示例8: Streams_invite_tool

function Streams_invite_tool($options)
{
    extract($options);
    $form_tool = Q::tool('Q/form', array('fields' => array('displayName' => array('label' => "Display name", 'type' => 'text', 'value' => Streams::displayName(Users::loggedInUser(), array('fullAccess' => true))), 'userId' => array('label' => "User id to invite", 'type' => 'textarea'), 'identifier' => array('label' => 'Mobile Number or Email Address', 'type' => 'textarea'), 'label' => array('label' => 'Group label', 'type' => 'textarea'), 'readLevel' => array('label' => 'Read level', 'type' => 'select', 'value' => Streams::$READ_LEVEL['content'], 'options' => array_flip(Streams::$READ_LEVEL)), 'writeLevel' => array('label' => 'Write level', 'type' => 'select', 'value' => Streams::$WRITE_LEVEL['post'], 'options' => array_flip(Streams::$WRITE_LEVEL)), 'adminLevel' => array('label' => 'Admin level', 'type' => 'select', 'options' => array_flip(Streams::$ADMIN_LEVEL)), 'submit' => array('label' => '', 'type' => 'submit_buttons', 'options' => array('submit' => 'Send Invite'))))) . Q_Html::hidden(array('publisherId' => $stream->publisherId, 'streamName' => $stream->name));
    return Q_Html::tag('h3', array(), 'Invite to stream "' . $options['stream']->name . '"') . Q_Html::form(Q_Request::baseUrl() . '/action.php/Streams/invite', 'post', array(), $form_tool);
}
开发者ID:dmitriz,项目名称:Platform,代码行数:6,代码来源:tool.php

示例9: Streams_before_Users_User_displayName

function Streams_before_Users_User_displayName($params, &$result)
{
    $result = Streams::displayName($params['user'], $params['options']);
}
开发者ID:dmitriz,项目名称:Platform,代码行数:4,代码来源:Users_User_displayName.php

示例10: Users_activate_objects_mobile

function Users_activate_objects_mobile($mobileNumber, &$mobile)
{
    Q_Response::removeNotice('Users/activate/objects');
    $mobile = new Users_Mobile();
    if (!Q_Valid::phone($mobileNumber, $normalized)) {
        return;
    }
    $mobile->number = $normalized;
    if (!$mobile->retrieve()) {
        throw new Q_Exception_MissingRow(array('table' => 'mobile phone', 'criteria' => "number {$normalized}"));
    }
    $user = Users::loggedInUser();
    if ($user) {
        if ($user->id != $mobile->userId) {
            throw new Q_Exception("You are logged in as a different user. Please log out and click the link again.");
        }
    } else {
        $user = new Users_User();
        $user->id = $mobile->userId;
        if (!$user->retrieve()) {
            throw new Q_Exception_MissingRow(array('table' => 'user', 'criteria' => 'id = ' . $user->id));
        }
    }
    if ($mobile->activationCode != $_REQUEST['code']) {
        throw new Q_Exception("The activation code does not match. Did you get a newer message?", 'code');
    }
    $timestamp = Users_Mobile::db()->getCurrentTimestamp();
    if ($timestamp > Users_Mobile::db()->fromDateTime($mobile->activationCodeExpires)) {
        throw new Q_Exception("Activation code expired");
    }
    if (Q_Request::method() !== 'POST' and empty($_REQUEST['p']) and isset($user->mobileNumber) and $user->mobileNumber == $mobile->number) {
        $displayName = Streams::displayName($user);
        Q_Response::setNotice('Users/activate/objects', "{$normalized} has already been activated for {$displayName}", true);
        return $user;
    }
    return $user;
}
开发者ID:dmitriz,项目名称:Platform,代码行数:37,代码来源:objects.php


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