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


PHP sprite函数代码示例

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


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

示例1: discussionController_beforeCommentDisplay_handler

 public function discussionController_beforeCommentDisplay_handler($sender, $args)
 {
     // Find the previous comment.
     if (!$this->previous) {
         $this->previous = $args['Discussion'];
         if ($sender->data('Page', 1) != 1) {
             $this->previous = $sender->CommentModel->get($sender->DiscussionID, 1, $sender->Offset - 1)->firstRow();
         }
     }
     // Calculate the date difference.
     $date = new DateTime($args['Comment']->DateInserted);
     $gap = $date->diff(new DateTime($this->previous->DateInserted))->days;
     $this->previous = $args['Comment'];
     if ($gap < c('TimeGap.MinDays', 7) - 1) {
         return;
     } elseif ($gap < 30) {
         $gap = sprintf(t('%s days later'), (int) $gap);
         $class = 'Days';
     } elseif ($gap < 60) {
         $gap = t('1 month later');
         $class = 'Month';
     } elseif ($gap < 365) {
         $gap = sprintf(t('%s months later'), (int) ($gap / 30));
         $class = 'Months';
     } elseif ($gap < 720) {
         $gap = t('1 year later');
         $class = 'Year';
     } else {
         $gap = sprintf(t('%s years later'), (int) ($gap / 365));
         $class = 'Years';
     }
     echo wrap(sprite('Time', 'InformSprite') . $gap, 'li', array('class' => 'TimeGap ' . $class));
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:33,代码来源:class.timegap.plugin.php

示例2: writeHomepageOption

function writeHomepageOption($Title, $Url, $CssClass, $Current, $Description = '')
{
    $SpriteClass = $CssClass;
    if ($Current == $Url) {
        $CssClass .= ' Current';
    }
    $CssClass .= ' Choice';
    echo anchor(t($Title) . Wrap(sprite($SpriteClass), 'span', array('class' => 'Wrap')), $Url, array('class' => $CssClass, 'title' => $Description, 'rel' => $Url));
}
开发者ID:caidongyun,项目名称:vanilla,代码行数:9,代码来源:homepage.php

示例3: meModule_flyoutMenu_handler

 /**
  * Adds "Mark All Viewed" and (conditionally) "Mark Category Viewed" to MeModule menu.
  *
  * @since 2.0
  * @access public
  */
 public function meModule_flyoutMenu_handler($Sender)
 {
     // Add "Mark All Viewed" to menu
     if (Gdn::session()->isValid()) {
         echo wrap(Anchor(sprite('SpMarkAllViewed') . ' ' . t('Mark All Viewed'), '/discussions/markallviewed'), 'li', array('class' => 'MarkAllViewed'));
         $CategoryID = (int) (empty(Gdn::controller()->CategoryID) ? 0 : Gdn::controller()->CategoryID);
         if ($CategoryID > 0) {
             echo wrap(Anchor(sprite('SpMarkCategoryViewed') . ' ' . t('Mark Category Viewed'), "/discussions/markcategoryviewed/{$CategoryID}"), 'li', array('class' => 'MarkCategoryViewed'));
         }
     }
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:17,代码来源:class.allviewed.plugin.php

示例4: index

 /**
  * General "post" form, allows posting of any kind of form. Attach to PostController_AfterFormCollection_Handler.
  *
  * @since 2.0.0
  * @access public
  */
 public function index($CurrentFormName = 'discussion')
 {
     $this->addJsFile('jquery.autosize.min.js');
     $this->addJsFile('autosave.js');
     $this->addJsFile('post.js');
     $this->setData('CurrentFormName', $CurrentFormName);
     $Forms = array();
     $Forms[] = array('Name' => 'Discussion', 'Label' => sprite('SpNewDiscussion') . t('New Discussion'), 'Url' => 'vanilla/post/discussion');
     /*
     $Forms[] = array('Name' => 'Question', 'Label' => sprite('SpAskQuestion').t('Ask Question'), 'Url' => 'vanilla/post/discussion');
     $Forms[] = array('Name' => 'Poll', 'Label' => sprite('SpNewPoll').t('New Poll'), 'Url' => 'activity');
     */
     $this->setData('Forms', $Forms);
     $this->fireEvent('AfterForms');
     $this->setData('Breadcrumbs', array(array('Name' => t('Post'), 'Url' => '/post')));
     $this->render();
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:23,代码来源:class.postcontroller.php

示例5: SettingsController_DiscussionEvent_create

 public function SettingsController_DiscussionEvent_create($Sender)
 {
     $Sender->permission('Garden.Settings.Manage');
     $Sender->Form = new Gdn_Form();
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->setField(array('Plugins.DiscussionEvent.DisplayInSidepanel', 'Plugins.DiscussionEvent.MaxDiscussionEvents'));
     $Sender->Form->setModel($ConfigurationModel);
     if ($Sender->Form->authenticatedPostBack()) {
         if ($Sender->Form->save() !== false) {
             $Sender->informMessage(sprite('Check', 'InformSprite') . T('Your changes have been saved.'), 'Dismissable AutoDismiss HasSprite');
         }
     } else {
         $Sender->Form->setData($ConfigurationModel->Data);
     }
     $Sender->title(T('Discussion Event Settings'));
     $Sender->addSideMenu();
     $Sender->render($this->GetView('settings.php'));
 }
开发者ID:pkonecki,项目名称:DiscussionEvent,代码行数:19,代码来源:class.discussionevent.plugin.php

示例6: toString

 public function toString()
 {
     $Session = Gdn::session();
     $Controller = Gdn::controller();
     $UserID = $Controller->User->UserID;
     $MemberOptions = array();
     $ProfileOptions = array();
     $Controller->EventArguments['UserID'] = $UserID;
     $Controller->EventArguments['ProfileOptions'] =& $ProfileOptions;
     $Controller->EventArguments['MemberOptions'] =& $MemberOptions;
     if ($Controller->EditMode) {
         return '<div class="ProfileOptions">' . anchor(t('Back to Profile'), userUrl($Controller->User), array('class' => 'ProfileButtons')) . '</div>';
         //         $ProfileOptions[] = array('Text' => t('Back to Profile'), 'Url' => userUrl($Controller->User), 'CssClass' => 'BackToProfile');
     } else {
         // Profile Editing
         if (hasEditProfile($Controller->User->UserID)) {
             $ProfileOptions[] = array('Text' => sprite('SpEditProfile') . ' ' . t('Edit Profile'), 'Url' => userUrl($Controller->User, '', 'edit'));
         } elseif ($Session->isValid() && $UserID == $Session->UserID) {
             $ProfileOptions[] = array('Text' => sprite('SpEditProfile') . ' ' . t('Preferences'), 'Url' => userUrl($Controller->User, '', 'preferences'));
         }
         // Ban/Unban
         $MayBan = checkPermission('Garden.Moderation.Manage') || checkPermission('Garden.Users.Edit') || checkPermission('Moderation.Users.Ban');
         if ($MayBan && $UserID != $Session->UserID) {
             if (BanModel::isBanned($Controller->User->Banned, BanModel::BAN_AUTOMATIC | BanModel::BAN_MANUAL)) {
                 $ProfileOptions[] = array('Text' => sprite('SpBan') . ' ' . t('Unban'), 'Url' => "/user/ban?userid={$UserID}&unban=1", 'CssClass' => 'Popup');
             } elseif (!$Controller->User->Admin) {
                 $ProfileOptions[] = array('Text' => sprite('SpBan') . ' ' . t('Ban'), 'Url' => "/user/ban?userid={$UserID}", 'CssClass' => 'Popup');
             }
         }
         // Delete content.
         if (checkPermission('Garden.Moderation.Manage')) {
             $ProfileOptions[] = array('Text' => sprite('SpDelete') . ' ' . t('Delete Content'), 'Url' => "/user/deletecontent?userid={$UserID}", 'CssClass' => 'Popup');
         }
     }
     return parent::ToString();
 }
开发者ID:R-J,项目名称:vanilla,代码行数:36,代码来源:class.profileoptionsmodule.php

示例7: tick

 /**
  * This is the asynchronous callback.
  *
  * This method is triggerd on every page request via a callback AJAX request
  * so that it may execute asychronously and reduce lag for users. It tracks
  * views, handles registration for new installations, and sends stats every day as needed.
  *
  * @return void
  */
 public function tick()
 {
     // Fire an event for plugins to track their own stats.
     // TODO: Make this analyze the path and throw a specific event (this event will change in future versions).
     $this->EventArguments['Path'] = Gdn::Request()->Post('Path');
     $this->fireEvent('Tick');
     // Store the view, using denormalization if enabled
     $ViewType = 'normal';
     if (preg_match('`discussion/embed`', Gdn::request()->post('ResolvedPath', ''))) {
         $ViewType = 'embed';
     }
     $this->addView($ViewType);
     if (Gdn::session()->isValid()) {
         Gdn::userModel()->updateVisit(Gdn::session()->UserID);
     }
     if (!self::checkIsEnabled()) {
         return;
     }
     if (Gdn::session()->checkPermission('Garden.Settings.Manage')) {
         if (Gdn::get('Garden.Analytics.Notify', false) !== false) {
             $CallMessage = Sprite('Bandaid', 'InformSprite');
             $CallMessage .= sprintf(T("There's a problem with Vanilla Analytics that needs your attention.<br/> Handle it <a href=\"%s\">here &raquo;</a>"), Url('dashboard/statistics'));
             Gdn::controller()->informMessage($CallMessage, array('CssClass' => 'HasSprite'));
         }
     }
     $InstallationID = Gdn::installationID();
     // Check if we're registered with the central server already. If not, this request is
     // hijacked and used to perform that task instead of sending stats or recording a tick.
     if (is_null($InstallationID)) {
         // If the config file is not writable, gtfo
         $ConfFile = PATH_CONF . '/config.php';
         if (!is_writable($ConfFile)) {
             // Admins see a helpful notice
             if (Gdn::session()->checkPermission('Garden.Settings.Manage')) {
                 $Warning = sprite('Sliders', 'InformSprite');
                 $Warning .= T('Your config.php file is not writable.<br/> Find out <a href="http://vanillaforums.org/docs/vanillastatistics">how to fix this &raquo;</a>');
                 Gdn::controller()->informMessage($Warning, array('CssClass' => 'HasSprite'));
             }
             return;
         }
         $AttemptedRegistration = Gdn::get('Garden.Analytics.Registering', false);
         // If we last attempted to register less than 60 seconds ago, do nothing. Could still be working.
         if ($AttemptedRegistration !== false && time() - $AttemptedRegistration < 60) {
             return;
         }
         return $this->register();
     }
     // If we get here, the installation is registered and we can decide on whether or not to send stats now.
     $LastSentDate = self::lastSentDate();
     if (empty($LastSentDate) || $LastSentDate < date('Ymd', strtotime('-1 day'))) {
         return $this->stats();
     }
 }
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:62,代码来源:class.statistics.php

示例8: writeReactions

 function writeReactions($Row)
 {
     $Attributes = GetValue('Attributes', $Row);
     if (is_string($Attributes)) {
         $Attributes = @unserialize($Attributes);
         SetValue('Attributes', $Row, $Attributes);
     }
     Gdn::controller()->EventArguments['ReactionTypes'] = array();
     if ($ID = GetValue('CommentID', $Row)) {
         $RecordType = 'comment';
     } elseif ($ID = GetValue('ActivityID', $Row)) {
         $RecordType = 'activity';
     } else {
         $RecordType = 'discussion';
         $ID = GetValue('DiscussionID', $Row);
     }
     Gdn::controller()->EventArguments['RecordType'] = $RecordType;
     Gdn::controller()->EventArguments['RecordID'] = $ID;
     echo '<div class="Reactions">';
     Gdn_Theme::bulletRow();
     // Write the flags.
     static $Flags = null;
     if ($Flags === null) {
         Gdn::controller()->EventArguments['Flags'] =& $Flags;
         Gdn::controller()->fireEvent('Flags');
     }
     // Allow addons to work with flags
     Gdn::controller()->EventArguments['Flags'] =& $Flags;
     Gdn::controller()->fireEvent('BeforeFlag');
     if (!empty($Flags) && is_array($Flags)) {
         echo Gdn_Theme::bulletItem('Flags');
         echo ' <span class="FlagMenu ToggleFlyout">';
         // Write the handle.
         echo anchor(sprite('ReactFlag', 'ReactSprite') . ' ' . wrap(t('Flag'), 'span', array('class' => 'ReactLabel')), '', 'Hijack ReactButton-Flag FlyoutButton', array('title' => t('Flag')), true);
         echo sprite('SpFlyoutHandle', 'Arrow');
         echo '<ul class="Flyout MenuItems Flags" style="display: none;">';
         foreach ($Flags as $Flag) {
             if (is_callable($Flag)) {
                 echo '<li>' . call_user_func($Flag, $Row, $RecordType, $ID) . '</li>';
             } else {
                 echo '<li>' . reactionButton($Row, $Flag['UrlCode']) . '</li>';
             }
         }
         Gdn::controller()->fireEvent('AfterFlagOptions');
         echo '</ul>';
         echo '</span> ';
     }
     Gdn::controller()->fireEvent('AfterFlag');
     Gdn::controller()->fireEvent('AfterReactions');
     echo '</div>';
     Gdn::controller()->fireEvent('Replies');
 }
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:52,代码来源:functions.render.php

示例9: addReactButton

 /**
  * Output Quote link.
  */
 protected function addReactButton($Sender, $Args)
 {
     if ($this->accessToken()) {
         $CssClass = 'ReactButton Hijack';
     } else {
         $CssClass = 'ReactButton PopupWindow';
     }
     echo ' ' . anchor(sprite('ReactFacebook', 'Sprite ReactSprite', t('Share on Facebook')), url("post/facebook/{$Args['RecordType']}?id={$Args['RecordID']}", true), $CssClass) . ' ';
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:12,代码来源:class.facebook.plugin.php

示例10: get_sprite

 public function get_sprite($sprite = '', $title = '', $args = [])
 {
     return sprite($this->get_alias($sprite), $title, array_merge($args, ['prefix' => $this->get_prefix(), 'url' => $this->get_url()]));
 }
开发者ID:synapticism,项目名称:ubik,代码行数:4,代码来源:svg.php

示例11: postController_afterForms_handler

 /**
  * Add the question form to vanilla's post page.
  *
  * @param PostController $sender Sending controller instance.
  */
 public function postController_afterForms_handler($sender)
 {
     $Forms = $sender->data('Forms');
     $Forms[] = array('Name' => 'Question', 'Label' => sprite('SpQuestion') . t('Ask a Question'), 'Url' => 'post/question');
     $sender->setData('Forms', $Forms);
 }
开发者ID:vanilla,项目名称:addons,代码行数:11,代码来源:class.qna.plugin.php

示例12: writeCommentOptions

 function writeCommentOptions($Comment)
 {
     $Controller = Gdn::controller();
     $Session = Gdn::session();
     $Id = $Comment->CommentID;
     $Options = GetCommentOptions($Comment);
     if (empty($Options)) {
         return;
     }
     echo '<span class="ToggleFlyout OptionsMenu">';
     echo '<span class="OptionsTitle" title="' . t('Options') . '">' . t('Options') . '</span>';
     echo sprite('SpFlyoutHandle', 'Arrow');
     echo '<ul class="Flyout MenuItems">';
     foreach ($Options as $Code => $Option) {
         echo wrap(Anchor($Option['Label'], $Option['Url'], val('Class', $Option, $Code)), 'li');
     }
     echo '</ul>';
     echo '</span>';
     if (c('Vanilla.AdminCheckboxes.Use')) {
         // Only show the checkbox if the user has permission to affect multiple items
         $Discussion = Gdn::controller()->data('Discussion');
         $PermissionCategoryID = val('PermissionCategoryID', $Discussion);
         if ($Session->checkPermission('Vanilla.Comments.Delete', TRUE, 'Category', $PermissionCategoryID)) {
             if (!property_exists($Controller, 'CheckedComments')) {
                 $Controller->CheckedComments = $Session->getAttribute('CheckedComments', array());
             }
             $ItemSelected = InSubArray($Id, $Controller->CheckedComments);
             echo '<span class="AdminCheck"><input type="checkbox" name="' . 'Comment' . 'ID[]" value="' . $Id . '"' . ($ItemSelected ? ' checked="checked"' : '') . ' /></span>';
         }
     }
 }
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:31,代码来源:helper_functions.php

示例13: val

<span class="ToggleFlyout OptionsMenu <?php 
echo val('cssClass', $this);
?>
">
    <span class="OptionsTitle" title="Options"><?php 
echo val('text', val('trigger', $this));
?>
</span>
    <?php 
echo sprite('SpFlyoutHandle', 'Arrow');
?>
    <ul class="Flyout MenuItems <?php 
echo val('listCssClass', $this);
?>
" role="menu" aria-labelledby="<?php 
echo val('triggerId', $this);
?>
">
        <?php 
foreach (val('items', $this) as $item) {
    if (val('type', $item) == 'group') {
        ?>
                <li role="presentation" class="dropdown-header <?php 
        echo val('cssClass', $item);
        ?>
">
                    <?php 
        if (val('icon', $item)) {
            echo icon(val('icon', $item));
        }
开发者ID:R-J,项目名称:vanilla,代码行数:30,代码来源:dropdown.php

示例14: anchor

    ?>
            <li <?php 
    if ($Controller->data('Filter') == 'mods') {
        echo 'class="Active"';
    }
    ?>
>
                <?php 
    echo anchor(sprite('SpMod') . ' ' . t('Moderator Activity'), '/activity/mods');
    ?>
            </li>
        <?php 
}
if ($AdminPermission) {
    ?>
            <li <?php 
    if ($Controller->data('Filter') == 'admins') {
        echo 'class="Active"';
    }
    ?>
>
                <?php 
    echo anchor(sprite('SpDashboard') . ' ' . t('Administrator Activity'), '/activity/admins');
    ?>
            </li>
        <?php 
}
?>
    </ul>
</div>
开发者ID:caidongyun,项目名称:vanilla,代码行数:30,代码来源:activityfilter.php

示例15: anchor

    ?>
</li>
        <?php 
}
if (($CountDiscussions > 0 || $Controller->RequestMethod == 'mine') && c('Vanilla.Discussions.ShowMineTab', true)) {
    ?>
            <li class="MyDiscussions<?php 
    echo $Controller->RequestMethod == 'mine' ? ' Active' : '';
    ?>
"><?php 
    echo anchor(sprite('SpMyDiscussions') . ' ' . $MyDiscussions, '/discussions/mine');
    ?>
</li>
        <?php 
}
if ($CountDrafts > 0 || $Controller->ControllerName == 'draftscontroller') {
    ?>
            <li class="MyDrafts<?php 
    echo $Controller->ControllerName == 'draftscontroller' ? ' Active' : '';
    ?>
"><?php 
    echo anchor(sprite('SpMyDrafts') . ' ' . $MyDrafts, '/drafts');
    ?>
</li>
        <?php 
}
$Controller->fireEvent('AfterDiscussionFilters');
?>
    </ul>
</div>
开发者ID:vanilla,项目名称:vanilla,代码行数:30,代码来源:discussionfilter.php


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