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


PHP Widgets类代码示例

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


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

示例1: indexAction

 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the user
     $users = new Users();
     $user = $users->getUser($widget['user_id']);
     // Get all sources configured for that user
     $properties = new Properties(array(Properties::KEY => $user->id));
     // Get the bio data
     // User profile
     $this->view->username = $user->username;
     $this->view->first_name = $properties->getProperty('first_name');
     $this->view->last_name = $properties->getProperty('last_name');
     $this->view->bio = $properties->getProperty('bio');
     $this->view->location = $properties->getProperty('location');
     $this->view->avatar = $properties->getProperty('avatar_image');
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "About {$user->username}";
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:29,代码来源:BioController.php

示例2: indexAction

 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the last comments
     $comments = new Comments(array(Stuffpress_Db_Table::USER => $widget['user_id']));
     $mycomments = $comments->getLastComments();
     $data = new Data();
     // Prepare the comments for output
     foreach ($mycomments as &$comment) {
         $time = strtotime($comment['timestamp']);
         $item = $data->getItem($comment['source_id'], $comment['item_id']);
         $comment['item'] = $item;
         $comment['when'] = Stuffpress_Date::ago($time, "j M y");
         $comment['comment'] = str_replace("\n", " ", $comment['comment']);
         if (strlen($comment['comment']) > 50) {
             $comment['comment'] = mb_substr($comment['comment'], 0, 47) . "...";
         }
     }
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "Latest comments";
     // Prepare the view for rendering
     $this->view->comments = $mycomments;
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:33,代码来源:LastcommentsController.php

示例3: indexAction

 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "Tag cloud";
     // Get the archives
     $db_tags = new Tags(array(Stuffpress_Db_Table::USER => $widget['user_id']));
     if ($tags = $db_tags->getTopTags(20)) {
         $max = $tags[0]['count'];
         $min = $tags[count($tags) - 1]['count'];
         sort($tags);
         $this->view->tags = $tags;
         $this->view->max = $max;
         $this->view->min = $min;
     }
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:26,代码来源:TagsController.php

示例4: loadWidget

 function loadWidget($widget, $params = array())
 {
     if (strlen($widget) <= 0) {
         return;
     }
     if (!Widgets::isEnabled($widget)) {
         return;
     }
     $widget = str_replace(".", "/", str_replace("/", "", $widget));
     $cachePath = _metaCache("WIDGETS", $widget);
     if (!$cachePath) {
         $path = getAllWidgetsFolders();
         foreach ($path as $a) {
             $f1 = ROOT . $a . $widget . "/index.php";
             $f2 = ROOT . $a . $widget . ".php";
             if (file_exists($f1)) {
                 _metaCacheUpdate("WIDGETS", $widget, $f1);
                 Widgets::printWidget($widget, $f1, $params);
                 return false;
             } elseif (file_exists($f2)) {
                 _metaCacheUpdate("WIDGETS", $widget, $f2);
                 Widgets::printWidget($widget, $f2, $params);
                 return false;
             }
         }
         if (MASTER_DEBUG_MODE == 'true') {
             trigger_logikserror("Widget Not Found :: " . $widget, E_LOGIKS_ERROR, 404);
         }
     } else {
         Widgets::printWidget($widget, $cachePath, $params);
         return false;
     }
 }
开发者ID:logiks,项目名称:logiks-core,代码行数:33,代码来源:widgets.php

示例5: __construct

    function __construct($path)
    {
        $chanbar = '				<ul>
						<li id="settings" class="option"><a href="#" class="button">settings</a></li>
						<li id="files" class="option"><a href="#" class="button">files</a></li>
						<li id="people" class="option"><a href="#" class="button">people</a></li>
						</ul>
						';
        $user = Auth::user();
        $curchan = DB::get()->val('SELECT name from channels where user_id = :user_id AND active = 1', array('user_id' => $user->id));
        if ($curchan == '') {
            $curchan = 'bar';
        }
        $widgets = Widgets::get_widgets();
        $components = array('title' => 'Barchat Home', 'path' => $path, 'chanbar' => $chanbar, 'user_id' => Auth::user_id(), 'username' => $user->username, 'nickname' => $user->nickname, 'session_key' => $user->session_key, 'cur_chan' => addslashes($curchan), 'widgets' => $widgets);
        $v = new View($components);
        Plugin::call('reload', $user);
        //check for user agent
        $useragent = $_SERVER['HTTP_USER_AGENT'];
        //
        if (preg_match('/ip(hone|od|ad)/i', $useragent)) {
            $v->render('template-ios');
        } else {
            $v->render('template');
        }
    }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:26,代码来源:index.php

示例6: me

 public static function me()
 {
     if (is_null(self::$instance)) {
         self::$instance = new Widgets();
     }
     return self::$instance;
 }
开发者ID:kostarev,项目名称:test,代码行数:7,代码来源:Widgets.php

示例7: index

 /**
  * The index action is the default action of this Wall Module. It prepares the widget
  * wall of the user and render the view according to its preferences.
  *
  * If the current user is not authenticated, it will be redirected to the users/index
  * action that will allows you to acces the login form of the application.
  *
  */
 public function index($continuePurchase = false, $langage = null, $forcebrowser = false)
 {
     # Try to force users to use firefox
     //		if(isset($_SESSION['forcebrowser']) && $_SESSION['forcebrowser'] == true){
     //			$forcebrowser = true;
     //		}
     //		if(!ereg("Firefox/",$_SERVER['HTTP_USER_AGENT']) && !$forcebrowser){
     //			require(DefaultFC::getView('compatibility.tpl'));
     //			die();
     //		}else{
     //			$_SESSION['forcebrowser'] = true;
     //		}
     if (Auth::isAuth()) {
         // Determine if the 'category widget' is installed.
         if (Widgets::isInstalled('categoryList')) {
             $widgetCategory = array('id' => 'categoryList', 'name' => 'Widget Categories');
         }
         // Determine if the 'tag cloud widget' is installed.
         if (Widgets::isInstalled('tagCloud')) {
             $widgetCloud = array('id' => 'tagCloud', 'name' => 'Widget Tag Cloud');
         }
         // Determine if the view must allow the user to manage widgets.
         $widgetManagement = false;
         if (Auth::isAdmin() || Auth::isGod()) {
             $widgetManagement = true;
         }
         // Determine if the view must show the list of installed widgets or
         // a link to the PALETTE Service Browser.
         $useServiceBrowser = USE_SERVICE_BROWSER;
         $serviceBrowserURI = USE_SERVICE_BROWSER ? SERVICE_BROWSER_URI . 'index.php/Services/Widgets?num=1' : null;
         require DefaultFC::getView('index.tpl');
     } else {
         DefaultFC::redirection('users/index?ref=wall');
     }
 }
开发者ID:ripplecrpht,项目名称:ripplecrpht,代码行数:43,代码来源:Wall.class.php

示例8: indexAction

 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $this->view->title = $properties->getProperty('title');
     $this->view->content = $properties->getProperty('content');
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:16,代码来源:CustomController.php

示例9: manager

 function manager()
 {
     if (!$this->manager instanceof Widgets) {
         $this->manager = Widgets::instance();
     }
     return $this->manager;
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:7,代码来源:BaseWidget.class.php

示例10: deleteAction

 public function deleteAction()
 {
     // Get, check and setup the parameters
     $widget_id = $this->getRequest()->getParam("id");
     // Do we own the widget ?
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Unknown widget with id {$widget_id}");
     }
     if ($widget['user_id'] != $this->_application->user->id) {
         throw new Stuffpress_AccessDeniedException("Not the owner of widget {$widget_id}");
     }
     $widgets->deleteWidget($widget_id);
     // Delete the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $properties->deleteAllProperties();
     return $this->_helper->json->sendJson(false);
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:18,代码来源:WidgetsController.php

示例11: action_index

 public function action_index()
 {
     $this->before('oc-panel/pages/widgets/main');
     //template header
     $this->template->title = __('Widgets');
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Widgets')));
     $this->template->scripts['footer'][] = 'js/jquery-sortable-min.js';
     $this->template->scripts['footer'][] = 'js/oc-panel/widgets.js';
     $this->template->widgets = Widgets::get_widgets();
     $this->template->placeholders = Widgets::get_placeholders();
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:11,代码来源:widget.php

示例12: __construct

 /**
  * Constructor, globally sets region and format
  *
  * @param $region
  * @param $format
  */
 public function __construct($region, $format)
 {
     // Store the region locally
     $this->_region = $region;
     // Store the format locally
     $this->_format = $format;
     // Load the widgets from database
     $this->load();
     // Store the widgets instance
     Widgets::$instance = $this;
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:17,代码来源:widgets.php

示例13: indexAction

 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get all sources configured for that user
     $sources = new Sources(array(Stuffpress_Db_Table::USER => $widget['user_id']));
     $mysources = $sources->getSources();
     // If sources are configured, get the links for each source
     $links = array();
     if ($mysources) {
         foreach ($mysources as $source) {
             if (!($source['public'] && $source['enabled'])) {
                 continue;
             }
             if ($source['service'] == 'stuffpress') {
                 continue;
             }
             $model = SourceModel::newInstance($source['service']);
             $model->setSource($source);
             $link['prefix'] = $model->getServicePrefix();
             $link['url'] = $model->getServiceURL();
             $link['name'] = $model->getTitle();
             $links[] = $link;
         }
     }
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "My 2.0 Life";
     // Prepare the view for rendering
     $this->view->links = $links;
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:39,代码来源:LinksController.php

示例14: indexAction

 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the user
     $users = new Users();
     $user = $users->getUser($widget['user_id']);
     // Get all sources configured for that user
     $properties = new Properties(array(Properties::KEY => $user->id));
     // Get the friendconnect data
     $this->view->googlefc = $properties->getProperty('googlefc');
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title;
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:23,代码来源:MembersgfcController.php

示例15: indexAction

 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "Archives";
     // Get the archives
     $data = new Data(array(Stuffpress_Db_Table::USER => $widget['user_id']));
     $archives = $data->getItemsPerMonth();
     // Prepare the view for rendering
     $this->view->archives = $archives;
     // Add the required javascript
     $this->view->headScript()->appendFile('js/accordion/init.js');
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:23,代码来源:ArchivesController.php


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