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


PHP ET类代码示例

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


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

示例1: news

 /**
  * Get a list of the most recent posts on the esoTalk blog. Also check for updates to the esoTalk software
  * and return the update notification area.
  *
  * @return void
  */
 public function news()
 {
     // Check for updates and add the update notification view to the response.
     ET::upgradeModel()->checkForUpdates();
     $this->json("updateNotification", $this->getViewContents("admin/updateNotification"));
     // Now fetch the latest posts from the esoTalk blog.
     // Thanks to Brian for this code.
     // (http://stackoverflow.com/questions/250679/best-way-to-parse-rss-atom-feeds-with-php/251102#251102)
     $xmlSource = file_get_contents("http://esotalk.org/blog/index.php/feed/");
     $x = simplexml_load_string($xmlSource);
     $posts = array();
     // Go through each item in the RSS channel...
     foreach ($x->channel->item as $item) {
         $post = array("date" => (string) $item->pubDate, "ts" => strtotime($item->pubDate), "link" => (string) $item->link, "title" => (string) $item->title, "text" => (string) $item->description);
         // Create summary as a shortened body and remove all tags.
         $summary = strip_tags($post["text"]);
         $maxLen = 200;
         if (strlen($summary) > $maxLen) {
             $summary = substr($summary, 0, $maxLen) . "...";
         }
         $post["summary"] = $summary;
         $posts[] = $post;
     }
     // Render the news view.
     $this->data("posts", $posts);
     $this->render("admin/news");
 }
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:33,代码来源:ETDashboardAdminController.class.php

示例2: action_subscribe

 /**
  * Toggle the user's subscription to a channel.
  *
  * @param int $channelId The ID of the channel to toggle subscription to.
  * @return void
  */
 public function action_subscribe($channelId = "")
 {
     if (!ET::$session->user or !$this->validateToken()) {
         return;
     }
     // If we don't have permission to view this channel, don't proceed.
     if (!ET::channelModel()->hasPermission((int) $channelId, "view")) {
         return;
     }
     // Work out if we're already unsubscribed or not, and switch to the opposite of that.
     $channel = ET::SQL()->select("unsubscribed, lft, rgt")->from("channel c")->from("member_channel mc", "mc.channelId = c.channelId AND mc.memberId = :userId", "left")->bind(":userId", ET::$session->userId)->where("c.channelId", (int) $channelId)->exec()->firstRow();
     // Get all the child channels of this channel.
     $rows = ET::SQL()->select("channelId")->from("channel")->where("lft >= :lft")->bind(":lft", $channel["lft"])->where("rgt <= :rgt")->bind(":rgt", $channel["rgt"])->exec()->allRows();
     $channelIds = array();
     foreach ($rows as $row) {
         $channelIds[] = $row["channelId"];
     }
     // Write to the database.
     ET::channelModel()->setStatus($channelIds, ET::$session->userId, array("unsubscribed" => !$channel["unsubscribed"]));
     // Normally, redirect back to the channel list.
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         redirect(URL("channels"));
     }
     // Otherwise, set a JSON var.
     $this->json("unsubscribed", !$channel["unsubscribed"]);
     $this->render();
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:33,代码来源:ETChannelsController.class.php

示例3: init

 /**
  * Initialize the admin controller. Construct a menu to show all admin panels.
  *
  * @return void
  */
 public function init()
 {
     // If the user isn't an administrator, kick them out.
     if (!ET::$session->isAdmin()) {
         $this->redirect(URL("user/login?return=" . urlencode($this->selfURL)));
     }
     parent::init();
     // Construct the menus for the side bar.
     $this->defaultMenu = ETFactory::make("menu");
     $this->menu = ETFactory::make("menu");
     $this->defaultMenu->add("dashboard", "<a href='" . URL("admin/dashboard") . "'><i class='icon-dashboard'></i> " . T("Dashboard") . "</a>");
     $this->defaultMenu->add("settings", "<a href='" . URL("admin/settings") . "'><i class='icon-cog'></i> " . T("Forum Settings") . "</a>");
     $this->defaultMenu->add("appearance", "<a href='" . URL("admin/appearance") . "'><i class='icon-eye-open'></i> " . T("Appearance") . "</a>");
     $this->defaultMenu->add("channels", "<a href='" . URL("admin/channels") . "'><i class='icon-tags'></i> " . T("Channels") . "</a>");
     $this->defaultMenu->add("members", "<a href='" . URL("members") . "'><i class='icon-group'></i> " . T("Members") . "</a>");
     $this->defaultMenu->add("plugins", "<a href='" . URL("admin/plugins") . "'><i class='icon-puzzle-piece'></i> " . T("Plugins") . "</a>");
     $this->defaultMenu->highlight(ET::$controllerName);
     $this->menu->highlight(ET::$controllerName);
     // If new registrations require admin approval, add the 'unapproved' admin page with a count.
     if (C("esoTalk.registration.requireConfirmation") == "approval") {
         $count = ET::SQL()->select("COUNT(1)")->from("member")->where("confirmed", 0)->exec()->result();
         $this->menu->add("unapproved", "<a href='" . URL("admin/unapproved") . "'><i class='icon-lock'></i> " . T("Unapproved") . " <span class='badge'>" . $count . "</span></a>");
     }
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         $this->pushNavigation("admin", "administration", URL($this->selfURL));
     }
     $this->addJSFile("core/js/admin.js");
     $this->addCSSFile("core/skin/admin.css");
     $this->trigger("initAdmin", array($this->menu, $this->defaultMenu));
 }
开发者ID:19eighties,项目名称:esoTalk,代码行数:35,代码来源:ETAdminController.class.php

示例4: settings

 /**
  * Construct and process the settings form for this skin, and return the path to the view that should be 
  * rendered.
  * 
  * @param ETController $sender The page controller.
  * @return string The path to the settings view to render.
  */
 public function settings($sender)
 {
     // Set up the settings form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/plugins");
     $form->setValue("server", C("plugin.SMTP.server"));
     $form->setValue("username", C("plugin.SMTP.username"));
     $form->setValue("password", C("plugin.SMTP.password"));
     $form->setValue("port", C("plugin.SMTP.port"));
     $form->setValue("auth", C("plugin.SMTP.auth"));
     // If the form was submitted...
     if ($form->validPostBack("save")) {
         // Construct an array of config options to write.
         $config = array();
         $config["plugin.SMTP.server"] = $form->getValue("server");
         $config["plugin.SMTP.username"] = $form->getValue("username");
         $config["plugin.SMTP.password"] = $form->getValue("password");
         $config["plugin.SMTP.port"] = $form->getValue("port");
         $config["plugin.SMTP.auth"] = $form->getValue("auth");
         if (!$form->errorCount()) {
             // Write the config file.
             ET::writeConfig($config);
             $sender->message(T("message.changesSaved"), "success");
             $sender->redirect(URL("admin/plugins"));
         }
     }
     $sender->data("smtpSettingsForm", $form);
     return $this->getView("settings");
 }
开发者ID:nowaym,项目名称:esoTalk,代码行数:36,代码来源:plugin.php

示例5: action_index

 public function action_index($orderBy = false, $start = 0)
 {
     if (!$this->allowed("esoTalk.members.visibleToGuests")) {
         return;
     }
     //If admin has disabled reputatoin points, break
     if (!C("plugin.Reputation.showReputationPublic")) {
         return;
     }
     $model = ET::getInstance("reputationModel");
     $members = $model->getReputationMembers();
     //Get rank of current member and get nearby members if rank is greater than 10
     $rank = $model->getRankOfCurrentMember(ET::$session->userId, $members);
     //Three parameters for getNearbyReputationMembers is number of members to be shown, offset, members array
     if ($rank > 10) {
         $nearbyMembers = $model->getNearbyReputationMembers(10, $rank - 5, $members);
     }
     //Get top 10 reputation members
     $topMembers = $model->getTopReputationMembers(10, $members);
     //Pass data to view
     $this->data("topMembers", $topMembers);
     $this->data("nearbyMembers", $nearbyMembers);
     $this->data("rank", $rank);
     $this->render("reputation");
 }
开发者ID:ZerGabriel,项目名称:Reputation,代码行数:25,代码来源:ReputationController.class.php

示例6: insertAttachments

 public function insertAttachments($attachments, $keys)
 {
     $inserts = array();
     foreach ($attachments as $id => $attachment) {
         $inserts[] = array_merge(array($id, $attachment["name"], $attachment["secret"]), array_values($keys));
     }
     ET::SQL()->insert("attachment")->setMultiple(array_merge(array("attachmentId", "filename", "secret"), array_keys($keys)), $inserts)->exec();
 }
开发者ID:ZerGabriel,项目名称:Attachments,代码行数:8,代码来源:AttachmentModel.class.php

示例7: errorHandler

function errorHandler($code, $message, $file, $line)
{
    // Make sure this error code is included in error_reporting.
    if ((error_reporting() & $code) != $code) {
        return false;
    }
    ET::fatalError(new ErrorException($message, $code, 1, $file, $line));
}
开发者ID:19eighties,项目名称:esoTalk,代码行数:8,代码来源:bootstrap.php

示例8: action_denyAll

 /**
  * Deny all members.
  *
  * @return void
  */
 public function action_denyAll()
 {
     if (!$this->validateToken()) {
         return;
     }
     ET::memberModel()->delete(array("confirmed" => 0));
     $this->message(T("message.changesSaved"), "success autoDismiss");
     $this->redirect(URL("admin/unapproved"));
 }
开发者ID:davchezt,项目名称:fireside,代码行数:14,代码来源:ETUnapprovedAdminController.class.php

示例9: validateSlug

 public function validateSlug($slug)
 {
     if (!strlen($slug)) {
         return "empty";
     }
     if (ET::SQL()->select("COUNT(pageId)")->from("page")->where("slug=:slug")->bind(":slug", $slug)->exec()->result() > 0) {
         return "channelSlugTaken";
     }
 }
开发者ID:ZerGabriel,项目名称:Pages,代码行数:9,代码来源:PagesModel.class.php

示例10: setistaatust

 function setistaatust(&$conversation, $memberId, $unfinished)
 {
     $unfinished = (bool) $unfinished;
     $model = ET::conversationModel();
     $model->setStatus($conversation["conversationId"], $memberId, array("unfinished" => $unfinished));
     #conversationModel
     $model->addOrRemoveLabel($conversation, "unfinished", $unfinished);
     #conversationModel
     $conversation["unfinished"] = $unfinished;
 }
开发者ID:ZerGabriel,项目名称:ConversationStatus,代码行数:10,代码来源:plugin.php

示例11: memberController_about

 public function memberController_about($sender, $member = "")
 {
     if (!($member = $sender->profile($member, "about"))) {
         return;
     }
     $about = @$member["preferences"]["about"];
     $about = ET::formatter()->init($about)->format()->get();
     $sender->data("about", $about);
     $sender->renderProfile($this->getView("about"));
 }
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:10,代码来源:plugin.php

示例12: action_deny

 /**
  * Deny a member; delete their account.
  *
  * @param int $memberId The ID of the member to deny.
  * @return void
  */
 public function action_deny($memberId)
 {
     // Get this member's details. If it doesn't exist or is already approved, show an error.
     if (!($member = ET::memberModel()->getById((int) $memberId)) or $member["confirmed"]) {
         $this->redirect(URL("admin/unapproved"));
         return;
     }
     ET::memberModel()->deleteById($memberId);
     $this->message(T("message.changesSaved"), "success autoDismiss");
     $this->redirect(URL("admin/unapproved"));
 }
开发者ID:19eighties,项目名称:esoTalk,代码行数:17,代码来源:ETUnapprovedAdminController.class.php

示例13: writeColors

 /**
  * Write the skin's color configuration and CSS.
  * 
  * @param string $primary The primary color.
  * @return void
  */
 protected function writeColors($primary)
 {
     ET::writeConfig(array("skin.Doragon.primaryColor" => $primary));
     $rgb = colorUnpack($primary, true);
     $hsl = rgb2hsl($rgb);
     $primary = colorPack(hsl2rgb($hsl), true);
     $hsl[1] = max(0, $hsl[1] - 0.3);
     $secondary = colorPack(hsl2rgb(array(2 => 0.6) + $hsl), true);
     $tertiary = colorPack(hsl2rgb(array(2 => 0.92) + $hsl), true);
     $css = file_get_contents($this->resource("colors.css"));
     $css = str_replace(array("{primary}", "{secondary}", "{tertiary}"), array($primary, $secondary, $tertiary), $css);
     file_put_contents(PATH_CONFIG . "/colors.css", $css);
 }
开发者ID:ZerGabriel,项目名称:Doragon-Skin,代码行数:19,代码来源:skin.php

示例14: trigger

 /**
  * Triggers an event, returning an array of return values from event handlers.
  *
  * Two events will actually be triggered: one prefixed with the name of this class,
  * one not. For example, if an instance of ETPluggable calls $this->trigger("eventName"),
  * both "ETPluggable_eventName" and "eventName" events will be triggered.
  *
  * The event handlers are called with $this as the first argument, and optionally any extra
  * $parameters. The return values from each handler are collected and then returned in an array.
  *
  * @param string $event The name of the event.
  * @param array $parameters An array of extra parameters to pass to the event handlers.
  */
 public function trigger($event, $parameters = array())
 {
     // Add the instance of this class to the parameters.
     array_unshift($parameters, $this);
     $return = array();
     // If we have a class name to use, trigger an event with that as the prefix.
     if ($this->className) {
         $return = ET::trigger($this->className . "_" . $event, $parameters);
     }
     // Trigger the event globally.
     $return = array_merge($return, ET::trigger($event, $parameters));
     return $return;
 }
开发者ID:19eighties,项目名称:esoTalk,代码行数:26,代码来源:ETPluggable.class.php

示例15: action_index

 /**
  * Perform the upgrade process.
  *
  * @return void
  */
 public function action_index()
 {
     try {
         // Run the upgrade process.
         ET::upgradeModel()->upgrade(C("esoTalk.version"));
         // Update the version and serial in the config file.
         ET::writeConfig(array("esoTalk.version" => ESOTALK_VERSION));
         // Show a success message and redirect.
         $this->message(T("message.upgradeSuccessful"), "success");
         $this->redirect(URL(""));
     } catch (Exception $e) {
         $this->fatalError($e->getMessage());
     }
 }
开发者ID:19eighties,项目名称:esoTalk,代码行数:19,代码来源:ETUpgradeController.class.php


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