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

PHP Widgets类代码示例

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

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



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


示例16: 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 basename
     $host = trim(Zend_Registry::get("host"), '/');
     // Get the user
     $users = new Users();
     $user = $users->getUser($widget['user_id']);
     $username = $user->username;
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "Subscribe to my lifestream";
     // RSS Link
     $this->view->feed = "http://{$host}/rss/feed.xml";
 }
开发者ID:vicox,项目名称:storytlr,代码行数:24,代码来源:RsslinkController.php


示例17: signupAction

 public function signupAction()
 {
     if (!$this->getRequest()->isPost()) {
         $this->addErrorMessage("Form was not properly posted.");
         $this->_forward('index');
     }
     // Retrieve the form values and its values
     $form = $this->getForm();
     $valid = $form->isValid($_POST);
     $values = $form->getValues();
     $username = $values['username'];
     $email = $values['email'];
     $password = $values['password'];
     // Validate the form itself
     if (!$form->isValid($_POST)) {
         // Failed validation; redisplay form
         $this->view->form = $form;
         $this->addErrorMessage("Your form contains some errors, please correct them and submit this form again");
         return $this->_forward('register');
     }
     // Register user
     $users = new Users();
     $user = $users->addUser($username, $password, $email);
     // Add some default widgets to the user
     $widgets = new Widgets(array(Stuffpress_Db_Table::USER => $user->id));
     $widgets->addWidget('search');
     $widgets->addWidget('rsslink');
     $widgets->addWidget('links');
     $widgets->addWidget('lastcomments');
     $widgets->addWidget('archives');
     $widgets->addWidget('logo');
     // Add some default properties
     $properties = new Properties(array(Stuffpress_Db_Properties::KEY => $user->id));
     $properties->setProperty('theme', 'clouds');
     $properties->setProperty('title', ucfirst($username));
     $properties->setProperty('subtitle', "my life online");
     // Add the storytlr data source
     StuffpressModel::forUser($user->id);
     // Add default pages
     $pages = new Pages(array(Stuffpress_Db_Table::USER => $user->id));
     //$pages->addPage('dashboard', 'Home');
     $pages->addPage('lifestream', 'Stream');
     $pages->addPage('stories', 'Stories');
     // Send the user a verification email
     Stuffpress_Emails::sendWelcomeEmail($email, $username, $password, $user->token);
     // Done !
     $this->view->username = $username;
     $this->view->email = $email;
     $this->render('success');
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:50,代码来源:RegisterController.php


示例18: get_widgets

 /**
  * returns all the widgets 
  * @param bool $only_names, returns only an array with the widgets names, if not array with widgets instances
  * @return array 
  */
 public static function get_widgets($only_names = FALSE)
 {
     $widgets = array();
     Widgets::$default_widgets = self::get_installed_widgets();
     //merge the possible widgets of the theme
     $list = array_unique(array_merge(widgets::$default_widgets, widgets::$theme_widgets));
     if ($only_names) {
         return $list;
     }
     //creating an instance of each widget
     foreach ($list as $widget_name) {
         if (class_exists($widget_name)) {
             $widgets[] = new $widget_name();
         }
     }
     return $widgets;
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:22,代码来源:widgets.php


示例19: getWidgets

 public function getWidgets()
 {
     if (!($result = $this->cacheLoad('Widgets_getWidgets_' . $this->_user))) {
         $sql = "SELECT * FROM `widgets` " . "WHERE user_id = :user_id " . "ORDER BY position ";
         $data = array("user_id" => $this->_user);
         $stmt = $this->_db->query($sql, $data);
         $rows = $stmt->fetchAll();
         $result = array();
         foreach ($rows as $row) {
             $widget = Widgets::getModel($row['prefix']);
             $widget['id'] = $row['id'];
             $widget['user_id'] = $row['user_id'];
             $result[] = $widget;
         }
         $this->cacheSave($result, 'Widgets_getWidgets_' . $this->_user);
     }
     return $result;
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:18,代码来源:Widgets.php


示例20: paginate

	function paginate($arguments = null, $items_per_page = 10, $current_page = 1) {
		if (isset ( $this ) && instance_of ( $this, 'Widgets' )) {
			return parent::paginate ( $arguments, $items_per_page, $current_page );
		} else {
			return Widgets::instance ()->paginate ( $arguments, $items_per_page, $current_page );
		}
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:7,代码来源:BaseWidgets.class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Wiki类代码示例发布时间:2022-05-23
下一篇:
PHP Widgetkit类代码示例发布时间: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