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


PHP Asset函数代码示例

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


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

示例1: showImage

function showImage($path)
{
    if (strpos($path, "http") === 0) {
        return $path;
    }
    return Asset('public/image/') . '/' . $path;
}
开发者ID:phanduong2211,项目名称:phukienthoitranggiare,代码行数:7,代码来源:info.blade.php

示例2: AvailableThemes

 /**
  * Looks through the themes directory for valid themes and returns them as
  * an associative array of "Theme Name" => "Theme Info Array". It also adds
  * a "Folder" definition to the Theme Info Array for each.
  */
 public function AvailableThemes()
 {
     if (!is_array($this->_AvailableThemes)) {
         $ThemeInfo = array();
         $ThemeFolders = Gdn_FileSystem::Folders(PATH_THEMES);
         $ThemeAboutFiles = Gdn_FileSystem::FindAll(PATH_THEMES, 'about.php', $ThemeFolders);
         // Include them all right here and fill the theme info array
         $ThemeCount = is_array($ThemeAboutFiles) ? count($ThemeAboutFiles) : 0;
         for ($i = 0; $i < $ThemeCount; ++$i) {
             include $ThemeAboutFiles[$i];
             // Define the folder name for the newly added item
             foreach ($ThemeInfo as $ThemeName => $Info) {
                 if (array_key_exists('Folder', $ThemeInfo[$ThemeName]) === FALSE) {
                     $Folder = substr($ThemeAboutFiles[$i], strlen(PATH_THEMES));
                     if (substr($Folder, 0, 1) == DS) {
                         $Folder = substr($Folder, 1);
                     }
                     $Folder = substr($Folder, 0, strpos($Folder, DS));
                     $ThemeInfo[$ThemeName]['Folder'] = $Folder;
                     // Add the screenshot.
                     $ScreenshotPath = SafeGlob(PATH_THEMES . "/{$Folder}/screenshot.*", array('gif', 'jpg', 'png'));
                     if (count($ScreenshotPath) > 0) {
                         $ScreenshotPath = $ScreenshotPath[0];
                         $ThemeInfo[$ThemeName]['ScreenshotUrl'] = Asset(str_replace(PATH_ROOT, '', $ScreenshotPath));
                     }
                 }
             }
         }
         $this->_AvailableThemes = $ThemeInfo;
     }
     return $this->_AvailableThemes;
 }
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:37,代码来源:class.thememanager.php

示例3: htmlMenu

 public function htmlMenu($menus = array(), $lft = 0, $rgt = null, $deep = 0)
 {
     global $treeMenu;
     if ($lft == 0 && $rgt == null && $deep == 0) {
         $treeMenu .= '<ul>';
     }
     foreach ($menus as $key => $val) {
         if ($val['lft'] > $lft && ($val['rgt'] < $rgt || is_null($rgt)) && $val['deep'] == $deep + 1) {
             unset($menus[$key]);
             $treeMenu .= '<li>';
             $treeMenu .= $val['name'] . ' ----------------------------------------------' . '<a href="' . Asset('admin/category/del/') . '/' . $val['id'] . '">  <button type="button" class="btn btn-default btn-sm"><i class="glyphicon glyphicon-trash"></i></button> </a>' . '<a href="' . Asset('admin/category/update/') . '/' . $val['id'] . '">  <button type="button" class="btn btn-default btn-sm"><i class="glyphicon glyphicon-edit"></i></button> </a>';
             if ($val['rgt'] != $val['lft'] + 1) {
                 $treeMenu .= '<ul>';
             }
             $this->htmlMenu($menus, $val['lft'], $val['rgt'], $val['deep']);
             if ($val['rgt'] != $val['lft'] + 1) {
                 $treeMenu .= '</ul>';
             }
             $treeMenu .= '</li>';
         }
     }
     if ($lft == 0 && is_null($rgt) && $deep == 0) {
         $treeMenu .= '</ul>';
     }
     return $treeMenu;
 }
开发者ID:nhunght,项目名称:mork_SmartOSC,代码行数:26,代码来源:category.php

示例4: _GetButton

 private function _GetButton()
 {
     $ImgSrc = Asset('/plugins/GoogleSignIn/design/google-icon.png');
     $ImgAlt = T('Sign In with Google');
     $SigninHref = $this->_AuthorizeHref();
     $PopupSigninHref = $this->_AuthorizeHref(TRUE);
     return "<a id=\"GoogleAuth\" href=\"{$SigninHref}\" class=\"PopupWindow\" title=\"{$ImgAlt}\" popupHref=\"{$PopupSigninHref}\" popupHeight=\"400\" popupWidth=\"800\" ><img src=\"{$ImgSrc}\" alt=\"{$ImgAlt}\" /></a>";
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:8,代码来源:class.googlesignin.plugin.php

示例5: imageBook

/**
 * Show full url of book image.
 * @param  [string] $name
 * @return [string] full link to image
 */
function imageBook($url)
{
    if (File::exists(base_path() . '/public/resourcebook/' . $url)) {
        return Asset('resourcebook/' . $url);
    } else {
        return Asset('resourcebook/question-mark.png');
    }
}
开发者ID:phanngoc,项目名称:elearnpub,代码行数:13,代码来源:helpers.php

示例6: Img

 /**
  * Returns an img tag.
  */
 function Img($Image, $Attributes = '', $WithDomain = FALSE)
 {
     if ($Attributes == '') {
         $Attributes = array();
     }
     if (substr($Image, 0, 7) != 'http://' && $Image != '') {
         $Image = Asset($Image, $WithDomain);
     }
     return '<img src="' . $Image . '"' . Attribute($Attributes) . ' />';
 }
开发者ID:jeastwood,项目名称:Garden,代码行数:13,代码来源:functions.render.php

示例7: Base_Render_Before

 /**
  * Add our script and css to every page.
  * 
  * @param $Sender
  */
 public function Base_Render_Before($Sender)
 {
     if (!C("Plugins.Vanoogle.CSE")) {
         return;
     }
     // Normally one would use ->AddJsFile or ->Head->AddScript, but these insert a version arg in the url that makes the google api barf.
     $Sender->Head->AddTag('script', array('src' => Asset('https://www.google.com/jsapi', FALSE, FALSE), 'type' => 'text/javascript', 'id' => C("Plugins.Vanoogle.CSE")));
     $Sender->AddCssFile('vanoogle.css', 'plugins/Vanoogle');
     $Sender->AddJsFile('vanoogle.js', 'plugins/Vanoogle');
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:15,代码来源:class.vanoogle.plugin.php

示例8: __construct

 /**
  * Setup some variables for instance.
  */
 public function __construct()
 {
     parent::__construct();
     $this->mediaCache = null;
     $this->mediaCacheExpire = 60 * 60 * 6;
     $this->AssetPath = Asset('/plugins/editor');
     $this->pluginInfo = Gdn::pluginManager()->getPluginInfo('editor', Gdn_PluginManager::ACCESS_PLUGINNAME);
     $this->ForceWysiwyg = c('Plugins.editor.ForceWysiwyg', false);
     // Check for additional formats
     $this->EventArguments['formats'] =& $this->Formats;
     $this->fireEvent('GetFormats');
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:15,代码来源:class.editor.plugin.php

示例9: userPhotoDefaultUrl

 /**
  *
  *
  * @param $User
  * @return string
  */
 function userPhotoDefaultUrl($User)
 {
     $Email = val('Email', $User);
     $Https = Gdn::request()->scheme() == 'https';
     $Protocol = $Https ? 'https://secure.' : 'http://www.';
     $Url = $Protocol . 'gravatar.com/avatar.php?' . 'gravatar_id=' . md5(strtolower($Email)) . '&amp;size=' . c('Garden.Thumbnail.Width', 50);
     if (c('Plugins.Gravatar.UseVanillicon', true)) {
         $Url .= '&default=' . urlencode(Gdn::request()->scheme() . '://vanillicon.com/' . md5($Email) . '.png');
     } else {
         $Url .= '&default=' . urlencode(Asset(c('Plugins.Gravatar.DefaultAvatar', c('Garden.DefaultAvatar', 'plugins/Gravatar/default.png')), true));
     }
     return $Url;
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:19,代码来源:default.php

示例10: UserPhotoDefaultUrl

 function UserPhotoDefaultUrl($User)
 {
     $Email = GetValue('Email', $User);
     $HTTPS = GetValue('HTTPS', $_SERVER, '');
     $Protocol = strlen($HTTPS) || GetValue('SERVER_PORT', $_SERVER) == 443 ? 'https://secure.' : 'http://www.';
     $Url = $Protocol . 'gravatar.com/avatar.php?' . 'gravatar_id=' . md5(strtolower($Email)) . '&amp;size=' . C('Garden.Thumbnail.Width', 50);
     if (C('Plugins.Gravatar.UseVanillicon', FALSE)) {
         $Url .= '&amp;default=' . urlencode(Asset('http://vanillicon.com/' . md5($User->Name) . '.png'));
     } else {
         $Url .= '&amp;default=' . urlencode(Asset(C('Plugins.Gravatar.DefaultAvatar', 'plugins/Gravatar/default.gif'), TRUE));
     }
     return $Url;
 }
开发者ID:Raz0r,项目名称:Garden,代码行数:13,代码来源:default.php

示例11: ProfileController_AfterAddSideMenu_Handler

 public function ProfileController_AfterAddSideMenu_Handler($Sender, $Args)
 {
     if (!$Sender->User->Photo) {
         $Email = GetValue('Email', $Sender->User);
         $Protocol = Gdn::Request()->Scheme() == 'https' ? 'https://secure.' : 'http://www.';
         $Url = $Protocol . 'gravatar.com/avatar.php?' . 'gravatar_id=' . md5(strtolower($Email)) . '&amp;size=' . C('Garden.Profile.MaxWidth', 200);
         if (C('Plugins.Gravatar.UseVanillicon', TRUE)) {
             $Url .= '&default=' . urlencode(Gdn::Request()->Scheme() . '://vanillicon.com/' . md5($Email) . '_200.png');
         } else {
             $Url .= '&default=' . urlencode(Asset(C('Plugins.Gravatar.DefaultAvatar', 'plugins/Gravatar/default_250.png'), TRUE));
         }
         $Sender->User->Photo = $Url;
     }
 }
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:14,代码来源:default.php

示例12: UserBuilder

 /**
  * Override the default UserBuilder function with one that switches the photo
  * out with a gravatar url if the photo is empty.
  */
 function UserBuilder($Object, $UserPrefix = '')
 {
     $User = new stdClass();
     $UserID = $UserPrefix . 'UserID';
     $Name = $UserPrefix . 'Name';
     $Photo = $UserPrefix . 'Photo';
     $Email = $UserPrefix . 'Email';
     $User->UserID = $Object->{$UserID};
     $User->Name = $Object->{$Name};
     $User->Photo = property_exists($Object, $Photo) ? $Object->{$Photo} : '';
     if ($User->Photo == '' && property_exists($Object, $Email)) {
         $User->Photo = 'http://www.gravatar.com/avatar.php?' . 'gravatar_id=' . md5(strtolower($Object->{$Email})) . '&default=' . urlencode(Asset(Gdn::Config('Plugins.Gravatar.DefaultAvatar', 'plugins/Gravatar/default.gif'), TRUE)) . '&size=' . Gdn::Config('Garden.Thumbnail.Width', 40);
     }
     return $User;
 }
开发者ID:sheldon,项目名称:Garden,代码行数:19,代码来源:default.php

示例13: UserBuilder

 /**
  * Override the default UserBuilder function with one that switches the photo
  * out with a gravatar url if the photo is empty.
  */
 function UserBuilder($Object, $UserPrefix = '')
 {
     $User = new stdClass();
     $UserID = $UserPrefix . 'UserID';
     $Name = $UserPrefix . 'Name';
     $Photo = $UserPrefix . 'Photo';
     $Email = $UserPrefix . 'Email';
     $User->UserID = $Object->{$UserID};
     $User->Name = $Object->{$Name};
     $User->Photo = property_exists($Object, $Photo) ? $Object->{$Photo} : '';
     $Protocol = strlen($_SERVER['HTTPS']) > 0 || $_SERVER['SERVER_PORT'] == 443 ? 'https://secure.' : 'http://www.';
     if ($User->Photo == '' && property_exists($Object, $Email)) {
         $User->Photo = $Protocol . 'gravatar.com/avatar.php?' . 'gravatar_id=' . md5(strtolower($Object->{$Email})) . '&amp;default=' . urlencode(Asset(Gdn::Config('Plugins.Gravatar.DefaultAvatar', 'plugins/Gravatar/default.gif'), TRUE)) . '&amp;size=' . Gdn::Config('Garden.Thumbnail.Width', 40);
     }
     return $User;
 }
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:20,代码来源:default.php

示例14: getTutorials

/**
 * Get all tutorials, or a specific one.
 */
function getTutorials($TutorialCode = '')
{
    // Define all Tutorials
    $Tutorials = array(array('Code' => 'introduction', 'Name' => 'Introduction to Vanilla', 'Description' => 'This video gives you a brief overview of the Vanilla administrative dashboard and the forum itself.', 'VideoID' => '31043422'), array('Code' => 'using-the-forum', 'Name' => 'Using the Forum', 'Description' => 'Learn how to start, announce, close, edit and delete discussions and comments.', 'VideoID' => '31502992'), array('Code' => 'private-conversations', 'Name' => 'Private Conversations', 'Description' => 'Learn how to start new private conversations and add people to them.', 'VideoID' => '31498383'), array('Code' => 'user-profiles', 'Name' => 'User Profiles', 'Description' => 'Learn how to use and manage your user profile. ', 'VideoID' => '31499266'), array('Code' => 'appearance', 'Name' => 'Changing the appearance of your forum', 'Description' => 'This tutorial takes you through the "Appearance" section of the Vanilla Forums administrative dashboard.', 'VideoID' => '31089641'), array('Code' => 'roles-and-permissions', 'Name' => 'Managing Roles and Permissions in Vanilla', 'Description' => 'This tutorial walks you through how to create new roles and how to use permissions.', 'VideoID' => '31091056'), array('Code' => 'users', 'Name' => 'Finding &amp; Managing Users', 'Description' => 'This tutorial shows you how to search for and manage users.', 'VideoID' => '31094514'), array('Code' => 'category-management-and-advanced-settings', 'Name' => 'Category Management &amp; Advanced Settings', 'Description' => 'Learn how to add, edit, and manage categories. Also learn about advanced forum settings.', 'VideoID' => '31492046'), array('Code' => 'user-registration', 'Name' => 'User Registration', 'Description' => 'Learn to control how new users get into your community.', 'VideoID' => '31493119'));
    // Default Thumbnails
    $Thumbnail = Asset('applications/dashboard/design/images/help-tn-200.jpg');
    $LargeThumbnail = Asset('applications/dashboard/design/images/help-tn-640.jpg');
    for ($i = 0; $i < count($Tutorials); $i++) {
        $Tutorials[$i]['Thumbnail'] = $Thumbnail;
        $Tutorials[$i]['LargeThumbnail'] = $LargeThumbnail;
    }
    if ($TutorialCode != '') {
        $Keys = consolidateArrayValuesByKey($Tutorials, 'Code');
        $Index = array_search($TutorialCode, $Keys);
        if ($Index === FALSE) {
            return FALSE;
        }
        // Not found!
        // Found it, so define it's thumbnail location
        $Tutorial = val($Index, $Tutorials);
        $VideoID = val('VideoID', $Tutorial);
        try {
            $videoInfo = json_decode(file_get_contents("http://vimeo.com/api/v2/video/{$Tutorial['VideoID']}.json"));
            if ($videoInfo && ($vimeo = array_shift($videoInfo))) {
                $Tutorial['Thumbnail'] = str_replace('http://', '//', val('thumbnail_medium', $vimeo));
                $Tutorial['LargeThumbnail'] = str_replace('http://', '//', val('thumbnail_large', $vimeo));
            }
        } catch (Exception $Ex) {
            // Do nothing
        }
        return $Tutorial;
    } else {
        // Loop through each tutorial populating the thumbnail image location
        try {
            foreach ($Tutorials as $Key => &$Tutorial) {
                $videoInfo = json_decode(file_get_contents("http://vimeo.com/api/v2/video/{$Tutorial['VideoID']}.json"));
                if ($videoInfo && ($vimeo = array_shift($videoInfo))) {
                    $Tutorial['Thumbnail'] = str_replace('http://', '//', val('thumbnail_medium', $vimeo));
                    $Tutorial['LargeThumbnail'] = str_replace('http://', '//', val('thumbnail_large', $vimeo));
                }
            }
        } catch (Exception $Ex) {
            // Do nothing
        }
        return $Tutorials;
    }
}
开发者ID:caidongyun,项目名称:vanilla,代码行数:50,代码来源:helper_functions.php

示例15: writeConnection

function writeConnection($Row)
{
    $c = Gdn::controller();
    $Connected = val('Connected', $Row);
    ?>
    <li id="<?php 
    echo "Provider_{$Row['ProviderKey']}";
    ?>
" class="Item">
        <div class="Connection-Header">
         <span class="IconWrap">
            <?php 
    echo img(val('Icon', $Row, Asset('/applications/dashboard/design/images/connection-64.png')));
    ?>
         </span>
         <span class="Connection-Name">
            <?php 
    echo val('Name', $Row, t('Unknown'));
    if ($Connected) {
        echo ' <span class="Gloss Connected">';
        if ($Photo = valr('Profile.Photo', $Row)) {
            echo ' ' . Img($Photo, array('class' => 'ProfilePhoto ProfilePhotoSmall'));
        }
        echo ' ' . htmlspecialchars(GetValueR('Profile.Name', $Row)) . '</span>';
    }
    ?>
         </span>
         <span class="Connection-Connect">
            <?php 
    echo ConnectButton($Row);
    ?>
         </span>
        </div>
        <!--      <div class="Connection-Body">
         <?php 
    //         if (Debug()) {
    //            decho(val($Row['ProviderKey'], $c->User->Attributes), 'Attributes');
    //         }
    ?>
      </div>-->
    </li>
<?php 
}
开发者ID:vanilla,项目名称:vanilla,代码行数:43,代码来源:connection_functions.php


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