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

PHP Gadget类代码示例

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

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



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

示例1: createRewriteFeature

 public function createRewriteFeature(Gadget $gadget)
 {
     $requires = $gadget->getRequires();
     if (!isset($requires[ContentRewriteFeature::$REWRITE_TAG])) {
         return;
     }
     $rewriteFeature = $requires[ContentRewriteFeature::$REWRITE_TAG];
     $rewriteParams = $rewriteFeature->getParams();
     if (isset($rewriteParams[ContentRewriteFeature::$INCLUDE_URLS])) {
         $this->includeParam = $this->normalizeParam($rewriteParams[ContentRewriteFeature::$INCLUDE_URLS], '//');
     } else {
         $this->includeParam = '//';
     }
     if (isset($rewriteParams[ContentRewriteFeature::$EXCLUDE_URLS])) {
         $this->excludeParam = $this->normalizeParam($rewriteParams[ContentRewriteFeature::$EXCLUDE_URLS], '//');
     } else {
         $this->excludeParam = '//';
     }
     if (isset($rewriteParams[ContentRewriteFeature::$INCLUDE_TAGS])) {
         $this->tagsParam = $rewriteParams[ContentRewriteFeature::$INCLUDE_TAGS];
         $this->tagsParam = explode(',', $this->tagsParam);
     } else {
         $this->tagsParam = array();
     }
     if ($this->excludeParam == '.*' || $this->includeParam == null) {
         $this->includeNone = true;
     }
     if ($this->includeParam == '.*' || $this->excludeParam == null) {
         $this->includeAll = true;
     }
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:31,代码来源:ContentRewriteFeature.php


示例2: rewriteGadgetView

 public function rewriteGadgetView(Gadget $gadget, ViewSpec $gadgetView)
 {
     // Dont rewrite content if the spec is unavailable
     $requires = $gadget->getRequires();
     if (isset($requires[ContentRewriteFeature::$REWRITE_TAG])) {
         // Store the feature in the spec so we dont keep parsing it
         $rewriteFeature = new ContentRewriteFeature();
         $rewriteFeature->createRewriteFeature($gadget);
     } else {
         return false;
     }
     if (!$rewriteFeature->isRewriteEnabled()) {
         return false;
     }
     if (ContentRewriteFeature::$PROXY_URL != null) {
         $defaultTags = ContentRewriteFeature::defaultHTMLTags();
         $htmlTags = null;
         if (count($rewriteFeature->getTagsParam()) > 0) {
             foreach ($rewriteFeature->getTagsParam() as $tag) {
                 if (isset($defaultTags[$tag])) {
                     $htmlTags[$tag] = $defaultTags[$tag];
                 }
             }
         } else {
             $htmlTags = $defaultTags;
         }
     }
     $gadgetView->setRewrittenContent($this->rewrite($gadgetView->getContent(), $htmlTags, $rewriteFeature->getExcludeParam(), $rewriteFeature->getIncludeParam(), Config::get('web_prefix') . ContentRewriteFeature::$PROXY_URL, $gadget->getId()->getURI(), $rewriteFeature->getTagsParam()));
     return true;
 }
开发者ID:ahmedadham88,项目名称:enhanced-social-network,代码行数:30,代码来源:ContentRewriter.php


示例3: up

 public function up()
 {
     $gadget = new Gadget();
     $gadget->setType('loginTop');
     $gadget->setName('loginForm');
     $gadget->setSortOrder(10);
     $gadget->save();
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:8,代码来源:002_insert_login_gadget.php


示例4: setUp

 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->gadgetContext = new GadgetContext('GADGET');
     $gadgetSpecFactory = new MockRewriterGadgetFactory($this->gadgetContext, null);
     $gadgetSpecFactory->fetchGadget = null;
     $this->gadget = $gadgetSpecFactory->createGadget();
     $this->gadgetRewriter = new GadgetRewriter($this->gadgetContext);
     $this->view = $this->gadget->getView($this->gadgetContext->getView());
 }
开发者ID:emma5021,项目名称:toba,代码行数:13,代码来源:GadgetRewriterTest.php


示例5: getIframeURL

 private function getIframeURL(Gadget $gadget, GadgetContext $context)
 {
     $v = $gadget->getChecksum();
     $view = $gadget->getView($context->getView());
     $up = '';
     foreach ($gadget->gadgetSpec->userPrefs as $pref) {
         $up .= '&up_' . urlencode($pref['name']) . '=' . urlencode($pref['value']);
     }
     $locale = $context->getLocale();
     //Note: putting the URL last, else some browsers seem to get confused (reported by hi5)
     return Config::get('default_iframe_prefix') . 'container=' . $context->getContainer() . ($context->getIgnoreCache() ? '&nocache=1' : '&v=' . $v) . ($context->getModuleId() != 0 ? '&mid=' . $context->getModuleId() : '') . '&lang=' . $locale['lang'] . '&country=' . $locale['country'] . '&view=' . $view['view'] . $up . '&url=' . urlencode($context->getUrl());
 }
开发者ID:vuxuandung,项目名称:Partuza-bundle,代码行数:12,代码来源:MetadataHandler.php


示例6: up

 public function up()
 {
     $criteria = new Criteria();
     $criteria->add(GadgetPeer::TYPE, 'mobileLoginContents');
     $criteria->add(GadgetPeer::NAME, 'loginForm');
     if (!GadgetPeer::doSelectOne($criteria)) {
         $gadget = new Gadget();
         $gadget->setType('mobileLoginContents');
         $gadget->setName('loginForm');
         $gadget->setSortOrder(10);
         $gadget->save();
     }
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:13,代码来源:006_add_mobile_login_gadget.php


示例7: save

 public function save()
 {
     foreach ($this->values as $type => $gadgets) {
         if (!$gadgets) {
             continue;
         }
         foreach ($gadgets as $value) {
             $gadget = new Gadget();
             $gadget->setType($type);
             $gadget->setName($value);
             $gadget->save();
         }
     }
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:14,代码来源:GadgetAddForm.class.php


示例8: renderGadget

 /**
  *
  * @param Gadget $gadget
  * @throws GadgetException
  */
 protected function renderGadget(Gadget $gadget)
 {
     $view = $gadget->getView($this->context->getView());
     $renderClasses = Config::get('gadget_renderer');
     foreach ($renderClasses as $renderClass => $constraints) {
         // if current view meets the configurated renderer constraints
         // render the gadget and stop checking
         if ($this->checkConstraints($view, $constraints)) {
             $gadgetRenderer = new $renderClass($this->context);
             $gadgetRenderer->renderGadget($gadget, $view);
             return;
         }
     }
     throw new GadgetException("Invalid view type");
 }
开发者ID:newlongwhitecloudy,项目名称:OpenConext-engineblock,代码行数:20,代码来源:GadgetRenderingServlet.php


示例9: getList

 private function getList()
 {
     $data = array();
     $result = $this->getResult();
     $gadgets = Gadget::loadStructuredList();
     foreach ($gadgets as $category => $list) {
         if (!$this->neededNames || isset($this->neededNames[$category])) {
             $row = array();
             if (isset($this->props['name'])) {
                 $row['name'] = $category;
             }
             if ($category !== "") {
                 if (isset($this->props['title'])) {
                     $row['desc'] = wfMessage("gadget-section-{$category}")->parse();
                 }
             }
             if (isset($this->props['members'])) {
                 $row['members'] = count($list);
             }
             $data[] = $row;
         }
     }
     $result->setIndexedTagName($data, 'category');
     $result->addValue('query', $this->getModuleName(), $data);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:ApiQueryGadgetCategories.php


示例10: log_user_in

 /**
  * logs a user in
  *
  * Status Codes:<br />
  * 0: success<br />
  * 1: incorrect password<br />
  * 1: incorrect email<br />
  *
  * @param   String  $u          Username
  * @param   String  $p          Password
  * @param   Boolean $redirect   redirect on successful login
  * @return  Int     status code
  */
 public static function log_user_in($u, $p, $redirect = true) {
     if ($_SESSION['logged_in']) {
         self::logout();
     }
     $u   = dbi()->escape($u);
     $ip  = $_SESSION['IpAddr'];
     if ($row = dbi()->q_1("SELECT CustomerID, Password FROM Customers WHERE Email = '$u'")) {
         if (crypt($p, $row->Password) == $row->Password) { // match found
             self::force_login($row->CustomerID);
             if ($redirect) {
                 if ($_SESSION['last_page']) {
                     $page = $_SESSION['last_page'];
                     unset($_SESSION['last_page']);
                 } else {
                     $page = '/';
                 }
                 Gadget::redirect($page);
             }
             return 0;
         } else { // incorrect password
             return 1;
         }
     } else { // email not found
         return 2;
     }
 }
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:39,代码来源:access.class.php


示例11: testPreferences

    function testPreferences()
    {
        global $wgUser, $wgOut, $wgTitle;
        // This test makes call to the parser which requires valids Outputpage
        // and Title objects. Set them up there, they will be released at the
        // end of the test.
        $old_wgOut = $wgOut;
        $old_wgTitle = $wgTitle;
        $wgTitle = Title::newFromText('Parser test for Gadgets extension');
        // Proceed with test setup:
        $prefs = array();
        $context = new RequestContext();
        $wgOut = $context->getOutput();
        $wgOut->setTitle(Title::newFromText('test'));
        Gadget::loadStructuredList('* foo | foo.js
==keep-section1==
* bar| bar.js
==remove-section==
* baz [rights=embezzle] |baz.js
==keep-section2==
* quux [rights=read] | quux.js');
        $this->assertTrue(GadgetHooks::getPreferences($wgUser, $prefs), 'GetPrefences hook should return true');
        $options = $prefs['gadgets']['options'];
        $this->assertFalse(isset($options['&lt;gadget-section-remove-section&gt;']), 'Must not show empty sections');
        $this->assertTrue(isset($options['&lt;gadget-section-keep-section1&gt;']));
        $this->assertTrue(isset($options['&lt;gadget-section-keep-section2&gt;']));
        // Restore globals
        $wgOut = $old_wgOut;
        $wgTitle = $old_wgTitle;
    }
开发者ID:Tarendai,项目名称:spring-website,代码行数:30,代码来源:GadgetTest.php


示例12: renderGadget

 protected function renderGadget(Gadget $gadget)
 {
     $view = $gadget->getView($this->context->getView());
     if ($view['type'] == 'URL') {
         require_once "src/gadgets/render/GadgetUrlRenderer.php";
         $gadgetRenderer = new GadgetUrlRenderer($this->context);
     } elseif ($view['type'] == 'HTML' && empty($view['href'])) {
         require_once "src/gadgets/render/GadgetHtmlRenderer.php";
         $gadgetRenderer = new GadgetHtmlRenderer($this->context);
     } elseif (empty($view['type']) || !empty($view['href'])) {
         require_once "src/gadgets/render/GadgetHrefRenderer.php";
         $gadgetRenderer = new GadgetHrefRenderer($this->context);
     } else {
         throw new GadgetException("Invalid view type");
     }
     $gadgetRenderer->renderGadget($gadget, $view);
 }
开发者ID:ndkhoiits,项目名称:gatein-shindig,代码行数:17,代码来源:GadgetRenderingServlet.php


示例13: __construct

 public function __construct(Gadget $gadget, $options = array(), $CSRFSecret = null)
 {
     $this->gadget = $gadget;
     parent::__construct(array(), $options, $CSRFSecret);
     $config = Doctrine::getTable('Gadget')->getGadgetConfigListByType($options['type']);
     if (empty($config[$gadget->getName()]['config'])) {
         throw new RuntimeException('The gadget has not registered or it doesn\'t have any configuration items.');
     }
     $gadgetConfig = $config[$gadget->getName()]['config'];
     foreach ($gadgetConfig as $key => $value) {
         $this->setWidget($key, opFormItemGenerator::generateWidget($value));
         $this->setValidator($key, opFormItemGenerator::generateValidator($value));
         $config = Doctrine::getTable('GadgetConfig')->retrieveByGadgetIdAndName($gadget->getId(), $key);
         if ($config) {
             $this->setDefault($key, $config->getValue());
         }
     }
     $this->widgetSchema->setNameFormat('gadget_config[%s]');
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:19,代码来源:GadgetConfigForm.class.php


示例14: up

 public function up()
 {
     $eventNavigation = new Navigation();
     $eventNavigation->setType('community');
     $eventNavigation->setUri('communityEvent/listCommunity');
     $eventNavigation->setSortOrder(6);
     $eventNavigation->setCaption('Events', 'en');
     $eventNavigation->setCaption('イベントリスト', 'ja_JP');
     $gadget = new Gadget();
     $gadget->setType('contents');
     $gadget->setName('recentCommunityEventComment');
     $gadget->setSortOrder(132);
     $gadget->save();
     $gadget = new Gadget();
     $gadget->setType('mobileContents');
     $gadget->setName('recentCommunityEventComment');
     $gadget->setSortOrder(111);
     $gadget->save();
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:19,代码来源:004_update_op_community_topic_plugin_0_8_1_4.php


示例15: up

 public function up()
 {
     $gadget = new Gadget();
     $gadget->setType('top');
     $gadget->setName('birthdayBox');
     $gadget->setSortOrder(0);
     $gadget->save();
     $gadget = new Gadget();
     $gadget->setType('mobileTop');
     $gadget->setName('birthdayBox');
     $gadget->setSortOrder(0);
     $gadget->save();
     $gadget = new Gadget();
     $gadget->setType('profileTop');
     $gadget->setName('birthdayBox');
     $gadget->setSortOrder(0);
     $gadget->save();
     $gadget = new Gadget();
     $gadget->setType('mobileProfileTop');
     $gadget->setName('birthdayBox');
     $gadget->setSortOrder(0);
     $gadget->save();
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:23,代码来源:045_insert_birthday_gadget.php


示例16: testPreferences

    function testPreferences()
    {
        $prefs = array();
        Gadget::loadStructuredList('* foo | foo.js
==keep-section1==
* bar| bar.js
==remove-section==
* baz [rights=embezzle] |baz.js
==keep-section2==
* quux [rights=read] | quux.js');
        $this->assertTrue(GadgetHooks::getPreferences(new User(), $prefs), 'GetPrefences hook should return true');
        $options = $prefs['gadgets']['options'];
        $this->assertFalse(isset($options['&lt;gadget-section-remove-section&gt;']), 'Must not show empty sections');
        $this->assertTrue(isset($options['&lt;gadget-section-keep-section1&gt;']));
        $this->assertTrue(isset($options['&lt;gadget-section-keep-section2&gt;']));
    }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:16,代码来源:GadgetTest.php


示例17: fetchResources

 /**
  * Fetches all remote resources simultaniously using a multiFetchRequest to optimize rendering time.
  *
  * The preloads will be json_encoded to their gadget document injection format, and the locales will
  * be reduced to only the GadgetContext->getLocale matching entries.
  *
  * @param Gadget $gadget
  * @param GadgetContext $context
  */
 protected function fetchResources(Gadget &$gadget)
 {
     $contextLocale = $this->context->getLocale();
     $unsignedRequests = $signedRequests = array();
     foreach ($gadget->gadgetSpec->locales as $key => $locale) {
         // Only fetch the locales that match the current context's language and country
         if ($locale['country'] == 'all' && $locale['lang'] == 'all' || $locale['lang'] == $contextLocale['lang'] && $locale['country'] == 'all' || $locale['lang'] == $contextLocale['lang'] && $locale['country'] == $contextLocale['country']) {
             if (!empty($locale['messages'])) {
                 $transformedUrl = RemoteContentRequest::transformRelativeUrl($locale['messages'], $this->context->getUrl());
                 if (!$transformedUrl) {
                     // remove any locales that are not applicable to this context
                     unset($gadget->gadgetSpec->locales[$key]);
                     continue;
                 } else {
                     $gadget->gadgetSpec->locales[$key]['messages'] = $transformedUrl;
                 }
                 // locale matches the current context, add it to the requests queue
                 $request = new RemoteContentRequest($gadget->gadgetSpec->locales[$key]['messages']);
                 $request->createRemoteContentRequestWithUri($gadget->gadgetSpec->locales[$key]['messages']);
                 $request->getOptions()->ignoreCache = $this->context->getIgnoreCache();
                 $unsignedRequests[] = $request;
             }
         } else {
             // remove any locales that are not applicable to this context
             unset($gadget->gadgetSpec->locales[$key]);
         }
     }
     if (!$gadget->gadgetContext instanceof MetadataGadgetContext) {
         // Add preloads to the request queue
         foreach ($gadget->getPreloads() as $preload) {
             if (!empty($preload['href'])) {
                 $request = new RemoteContentRequest($preload['href']);
                 if (!empty($preload['authz']) && $preload['authz'] == 'SIGNED') {
                     if ($this->token == '') {
                         throw new GadgetException("Signed preloading requested, but no valid security token set");
                     }
                     $request = new RemoteContentRequest($preload['href']);
                     $request->setAuthType(RemoteContentRequest::$AUTH_SIGNED);
                     $request->setNotSignedUri($preload['href']);
                     $request->setToken($this->token);
                     $request->getOptions()->ignoreCache = $this->context->getIgnoreCache();
                     if (strcasecmp($preload['signViewer'], 'false') == 0) {
                         $request->getOptions()->viewerSigned = false;
                     }
                     if (strcasecmp($preload['signOwner'], 'false') == 0) {
                         $request->getOptions()->ownerSigned = false;
                     }
                     $signedRequests[] = $request;
                 } else {
                     $request->createRemoteContentRequestWithUri($preload['href']);
                     $request->getOptions()->ignoreCache = $this->context->getIgnoreCache();
                     $unsignedRequests[] = $request;
                 }
             }
         }
         // Add template libraries to the request queue
         if ($gadget->gadgetSpec->templatesRequireLibraries) {
             foreach ($gadget->gadgetSpec->templatesRequireLibraries as $key => $libraryUrl) {
                 $request = new RemoteContentRequest($libraryUrl);
                 $transformedUrl = RemoteContentRequest::transformRelativeUrl($libraryUrl, $this->context->getUrl());
                 if (!$transformedUrl) {
                     continue;
                 } else {
                     $gadget->gadgetSpec->templatesRequireLibraries[$key] = $transformedUrl;
                 }
                 $request->createRemoteContentRequestWithUri($gadget->gadgetSpec->templatesRequireLibraries[$key]);
                 $request->getOptions()->ignoreCache = $this->context->getIgnoreCache();
                 $unsignedRequests[] = $request;
             }
         }
     }
     // Perform the non-signed requests
     $responses = array();
     if (count($unsignedRequests)) {
         $brc = new BasicRemoteContent();
         $resps = $brc->multiFetch($unsignedRequests);
         foreach ($resps as $response) {
             $responses[$response->getUrl()] = array('body' => $response->getResponseContent(), 'rc' => $response->getHttpCode());
         }
     }
     // Perform the signed requests
     if (count($signedRequests)) {
         $signingFetcherFactory = new SigningFetcherFactory(Config::get("private_key_file"));
         $remoteFetcherClass = Config::get('remote_content_fetcher');
         $remoteFetcher = new $remoteFetcherClass();
         $remoteContent = new BasicRemoteContent($remoteFetcher, $signingFetcherFactory);
         $resps = $remoteContent->multiFetch($signedRequests);
         foreach ($resps as $response) {
             $responses[$response->getNotSignedUrl()] = array('body' => $response->getResponseContent(), 'rc' => $response->getHttpCode());
         }
     }
//.........这里部分代码省略.........
开发者ID:vuxuandung,项目名称:Partuza-bundle,代码行数:101,代码来源:GadgetFactory.php


示例18: debug

<?php
require '../includes/global.inc.php';
debug(1, 1, 0);

if (!$_SESSION['madison_status_UserName']) {
    Gadget::redirect('/admin');
}

$date = date(DATE_FORMAT_MYSQL, strtotime('next Tuesday', strtotime('-1 day')));

$date_do = new DateTime($date);

switch ($date) {
    case '2013-12-24':
        $date_do->setDate('2013', '12', '23');
        break;
    case '2013-12-31':
        $date_do->setDate('2013', '12', '30');
        break;
}
$date_delivery   = $date_do->format('n/j/Y');
?>
<!doctype html>
<html>
    <head>
        <style type="text/css" media="screen">
            .order{
                margin-bottom:20px;
                font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif, sans-serif; font-size: 10pt; line-height: 1.1;
            }
            .header_image img{
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:31,代码来源:packing_slips.php


示例19: array

                        $newPromoCodeAmount = $promoCodeAmount - $giftCertAmount;
                        if ($newPromoCodeAmount < 0) {
                            $newPromoCodeAmount = 0;
                        }
                        $dbi->update('PromoCodes', array('Amount' => $newPromoCodeAmount), array('PromoCodeID' => $PromoCodeID));
                    }
                }

                //Gadget::add_message('success');
                Gadget::redirect('success2');
            } else {
                Gadget::add_message($transaction->get_error_message());
            }
        } catch (Exception $e) {
            s('Error: ' . $e->getMessage() . $transaction->get_error_message());
            Gadget::add_message($e->getMessage() . $transaction->get_error_message());
        }
    }
}

$page = Page::get_from_alias('giftcertificates');
$page->add_js('/js/giftcertificates.js');

require 'header.php';
?>
<div class="content-padding">
    <div><?php echo $page->content['main']; ?></div>
    <form class="user-form" name="giftcertificates-form" id="checkout-form" action="giftcertificates" method="post" onsubmit="return validateForm();">
        <table>
            <tbody>
                <tr style="vertical-align:top;">
开发者ID:elliecm,项目名称:MadisonandRayne,代码行数:31,代码来源:giftcertificates.php


示例20: fakeMetadata

 /**
  * @param $g Gadget
  * @return array
  */
 private function fakeMetadata(Gadget $g)
 {
     return array('settings' => array('rights' => $g->getRequiredRights(), 'skins' => $g->getRequiredSkins(), 'default' => $g->isOnByDefault(), 'hidden' => false, 'shared' => false, 'category' => $g->getCategory()), 'module' => array('scripts' => $g->getScripts(), 'styles' => $g->getStyles(), 'dependencies' => $g->getDependencies(), 'messages' => array()));
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:8,代码来源:ApiQueryGadgets.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Gallery类代码示例发布时间:2022-05-23
下一篇:
PHP GWF_Website类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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