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

PHP Pimcore_Tool类代码示例

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

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



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

示例1: getService

 protected function getService()
 {
     $credentials = $this->getWebmastertoolsCredentials();
     $client = Zend_Gdata_ClientLogin::getHttpClient($credentials["username"], $credentials["password"], "sitemaps", Pimcore_Tool::getHttpClient("Zend_Gdata_HttpClient"));
     $service = new Zend_Gdata_Analytics($client);
     return $service;
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:7,代码来源:WebmastertoolsController.php


示例2: lostpasswordAction

 public function lostpasswordAction()
 {
     $username = $this->_getParam("username");
     if ($username) {
         $user = User::getByName($username);
         if (!$user instanceof User) {
             $this->view->error = "user unknown";
         } else {
             if ($user->isActive()) {
                 if ($user->getEmail()) {
                     $token = Pimcore_Tool_Authentication::generateToken($username, $user->getPassword(), MCRYPT_TRIPLEDES, MCRYPT_MODE_ECB);
                     $protocol = "http://";
                     if (strpos(strtolower($_SERVER["SERVER_PROTOCOL"]), "https") === 0) {
                         $protocol = "https://";
                     }
                     $uri = $protocol . $_SERVER['SERVER_NAME'];
                     $loginUrl = $uri . "/admin/login/login/?username=" . $username . "&token=" . $token;
                     try {
                         $mail = Pimcore_Tool::getMail(array($user->getEmail()), "Pimcore lost password service");
                         $mail->setBodyText("Login to pimcore and change your password using the following link. This temporary login link will expire in 30 minutes: \r\n\r\n" . $loginUrl);
                         $mail->send();
                         $this->view->success = true;
                     } catch (Exception $e) {
                         $this->view->error = "could not send email";
                     }
                 } else {
                     $this->view->error = "user has no email address";
                 }
             } else {
                 $this->view->error = "user inactive";
             }
         }
     }
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:34,代码来源:LoginController.php


示例3: map

 /**
  * @static
  * @param Element_Interface $object
  * @param string $type  "in" or "out"
  * @param  string $class
  * @return array
  */
 public static function map($object, $apiclass, $type)
 {
     if ($object instanceof Zend_Date) {
         $object = $object->toString();
     } else {
         if (is_object($object)) {
             if (Pimcore_Tool::classExists($apiclass)) {
                 $new = new $apiclass();
                 if (method_exists($new, "map")) {
                     $new->map($object);
                     $object = $new;
                 }
             } else {
                 throw new Exception("Webservice_Data_Mapper: Cannot map [ {$apiclass} ] - class does not exist");
             }
         } else {
             if (is_array($object)) {
                 $tmpArray = array();
                 foreach ($object as $v) {
                     $className = self::findWebserviceClass($v, $type);
                     $tmpArray[] = self::map($v, $className, $type);
                 }
                 $object = $tmpArray;
             }
         }
     }
     return $object;
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:35,代码来源:Mapper.php


示例4: indexAction

 public function indexAction()
 {
     // check maintenance
     $maintenance_enabled = false;
     $manager = Schedule_Manager_Factory::getManager("maintenance.pid");
     $lastExecution = $manager->getLastExecution();
     if ($lastExecution) {
         if (time() - $lastExecution < 610) {
             // maintenance script should run at least every 10 minutes + a little tolerance
             $maintenance_enabled = true;
         }
     }
     $this->view->maintenance_enabled = Zend_Json::encode($maintenance_enabled);
     // configuration
     $this->view->config = Pimcore_Config::getSystemConfig();
     //mail settings
     $mailIncomplete = false;
     if ($this->view->config->email) {
         $emailSettings = $this->view->config->email->toArray();
         if ($emailSettings['method'] == "sendmail" and !empty($emailSettings['sender']['email'])) {
             $mailIncomplete = true;
         }
         if ($emailSettings['method'] == "smtp" and !empty($emailSettings['sender']['email']) and !empty($emailSettings['smtp']['host'])) {
             $mailIncomplete = true;
         }
     }
     $this->view->mail_settings_incomplete = Zend_Json::encode($mailIncomplete);
     // report configuration
     $this->view->report_config = Pimcore_Config::getReportConfig();
     // customviews config
     $cvConfig = Pimcore_Tool::getCustomViewConfig();
     $cvData = array();
     if ($cvConfig) {
         foreach ($cvConfig as $node) {
             $tmpData = $node;
             $rootNode = Object_Abstract::getByPath($tmpData["rootfolder"]);
             if ($rootNode) {
                 $tmpData["rootId"] = $rootNode->getId();
                 $tmpData["allowedClasses"] = explode(",", $tmpData["classes"]);
                 $tmpData["showroot"] = (bool) $tmpData["showroot"];
                 $cvData[] = $tmpData;
             }
         }
     }
     $this->view->customview_config = $cvData;
     // upload limit
     $max_upload = filesize2bytes(ini_get("upload_max_filesize") . "B");
     $max_post = filesize2bytes(ini_get("post_max_size") . "B");
     $memory_limit = filesize2bytes(ini_get("memory_limit") . "B");
     $upload_mb = min($max_upload, $max_post, $memory_limit);
     $this->view->upload_max_filesize = $upload_mb;
     // live connect
     $liveconnectToken = Pimcore_Liveconnect::getToken();
     $this->view->liveconnectToken = $liveconnectToken;
     // adding css minify filter because of IE issues with CkEditor and more than 31 stylesheets
     if (!PIMCORE_DEVMODE) {
         $front = Zend_Controller_Front::getInstance();
         $front->registerPlugin(new Pimcore_Controller_Plugin_CssMinify(), 800);
     }
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:60,代码来源:IndexController.php


示例5: getWebmastertoolsSitesAction

 public function getWebmastertoolsSitesAction()
 {
     $credentials = $this->getWebmastertoolsCredentials();
     if ($credentials) {
         $username = $credentials["username"];
         $password = $credentials["password"];
     }
     if ($this->_getParam("username") && $this->_getParam("password")) {
         $username = $this->_getParam("username");
         $password = $this->_getParam("password");
     }
     try {
         $client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, "sitemaps", Pimcore_Tool::getHttpClient("Zend_Gdata_HttpClient"));
         $service = new Zend_Gdata($client);
         $data = $service->getFeed("https://www.google.com/webmasters/tools/feeds/sites/");
         foreach ($data->getEntry() as $e) {
             $verification = "";
             // get verification filename
             foreach ($e->getExtensionElements() as $d) {
                 $a = $d->getExtensionAttributes();
                 if ($a["type"]["value"] == "htmlpage") {
                     $verification = $d->getText();
                     break;
                 }
             }
             $sites[] = array("profile" => (string) $e->getTitle(), "verification" => $verification);
         }
         $this->_helper->json(array("data" => $sites));
     } catch (Exception $e) {
         $this->_helper->json(false);
     }
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:32,代码来源:SettingsController.php


示例6: adminCssAction

 public function adminCssAction()
 {
     // customviews config
     $cvData = Pimcore_Tool::getCustomViewConfig();
     $this->view->customviews = $cvData;
     $this->getResponse()->setHeader("Content-Type", "text/css; charset=UTF-8", true);
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:7,代码来源:MiscController.php


示例7: getUpdateInformationAction

 public function getUpdateInformationAction()
 {
     $id = $this->_getParam("id");
     $type = $this->_getParam("type");
     if ($type == "plugin") {
         $extensionPath = PIMCORE_PLUGINS_PATH . "/" . $id;
     } else {
         if ($type = "brick") {
             $extensionPath = PIMCORE_WEBSITE_PATH . "/var/areas/" . $id;
         }
     }
     $remoteConfig = array("token" => Pimcore_Liveconnect::getToken(), "id" => $id, "type" => $type, "revision" => trim(file_get_contents($extensionPath . "/.pimcore_extension_revision")));
     $rawData = Pimcore_Tool::getHttpData("http://extensions.pimcore.org/update/getUpdateInformation.php", null, array("data" => base64_encode(serialize($remoteConfig))));
     if (!$rawData) {
         header('HTTP/1.1 403 Forbidden');
         exit;
     }
     $steps = array();
     $numberOfFiles = 0;
     $data = Zend_Json::decode($rawData);
     foreach ($data["revisions"] as $revision) {
         foreach ($revision["files"] as $file) {
             $steps[] = array("action" => $file["action"], "controller" => "download", "params" => array("id" => $id, "type" => $type, "path" => $file["path"], "revision" => $file["revision"]));
             $numberOfFiles++;
         }
         $steps[] = array("action" => "check-update-script", "controller" => "update", "params" => array("id" => $id, "type" => $type, "revision" => $revision["revision"]));
     }
     $this->_helper->json(array("steps" => $steps, "fileAmount" => $numberOfFiles));
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:29,代码来源:UpdateController.php


示例8: update

 /**
  * @return void
  */
 public function update()
 {
     foreach ($this->fieldsToSave as $field) {
         if (in_array($field, $this->validColumns)) {
             $getter = 'get' . ucfirst($field);
             if (in_array($field, $this->localizedFields)) {
                 // handle localized Fields
                 $localizedValues = array();
                 foreach (Pimcore_Tool::getValidLanguages() as $lang) {
                     $localizedValues[$lang] = $value = $this->model->{$getter}($lang);
                 }
                 $value = $localizedValues;
             } else {
                 // normal case
                 $value = $this->model->{$getter}();
             }
             if (is_array($value) || is_object($value)) {
                 $value = serialize($value);
             } else {
                 if (is_bool($value)) {
                     $value = (int) $value;
                 }
             }
             $data[$field] = $value;
         }
     }
     $this->db->update(self::TABLE_NAME, $data, 'id=' . $this->db->quote($this->model->getId()));
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:31,代码来源:Resource.php


示例9: getService

 protected function getService()
 {
     $credentials = $this->getAnalyticsCredentials();
     $client = Zend_Gdata_ClientLogin::getHttpClient($credentials["username"], $credentials["password"], Zend_Gdata_Analytics::AUTH_SERVICE_NAME, Pimcore_Tool::getHttpClient("Zend_Gdata_HttpClient"));
     $service = new Zend_Gdata_Analytics($client, "pimcore-open-source-CMS-framework");
     return $service;
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:7,代码来源:AnalyticsController.php


示例10: getByKey

 /**
  * @static
  * @param $id - translation key
  * @param bool $create - creates an empty translation entry if the key doesn't exists
  * @param bool $returnIdIfEmpty - returns $id if no translation is available
  * @return Translation_Website
  */
 public static function getByKey($id, $create = false, $returnIdIfEmpty = false)
 {
     $translation = new self();
     try {
         $translation->getResource()->getByKey($id);
     } catch (Exception $e) {
         if (!$create) {
             throw new Exception($e->getMessage());
         } else {
             $translation->setKey($id);
             $translation->setDate(time());
             $translations = array();
             foreach (Pimcore_Tool::getValidLanguages() as $lang) {
                 $translations[$lang] = "";
             }
             $translation->setTranslations($translations);
             $translation->save();
         }
     }
     if ($returnIdIfEmpty) {
         $translations = $translation->getTranslations();
         foreach ($translations as $key => $value) {
             $translations[$key] = $value ?: $id;
         }
         $translation->setTranslations($translations);
     }
     return $translation;
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:35,代码来源:Website.php


示例11: getDataByIdAction

 public function getDataByIdAction()
 {
     // check for lock
     if (Element_Editlock::isLocked($this->_getParam("id"), "document")) {
         $this->_helper->json(array("editlock" => Element_Editlock::getByElement($this->_getParam("id"), "document")));
     }
     Element_Editlock::lock($this->_getParam("id"), "document");
     $page = Document_Page::getById($this->_getParam("id"));
     $page = $this->getLatestVersion($page);
     $page->getVersions();
     $page->getScheduledTasks();
     $page->idPath = Pimcore_Tool::getIdPathForElement($page);
     $page->userPermissions = $page->getUserPermissions();
     $page->setLocked($page->isLocked());
     // get depending redirects
     $redirectList = new Redirect_List();
     $redirectList->setCondition("target = ?", $page->getId());
     $page->redirects = $redirectList->load();
     // unset useless data
     $page->setElements(null);
     $page->childs = null;
     // cleanup properties
     $this->minimizeProperties($page);
     if ($page->isAllowed("view")) {
         $this->_helper->json($page);
     }
     $this->_helper->json(false);
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:28,代码来源:PageController.php


示例12: createClassMappings

 /**
  * @static
  * @return array
  */
 public static function createClassMappings()
 {
     $modelsDir = PIMCORE_PATH . "/models/";
     $files = rscandir($modelsDir);
     $includePatterns = array("/Webservice\\/Data/");
     foreach ($files as $file) {
         if (is_file($file)) {
             $file = str_replace($modelsDir, "", $file);
             $file = str_replace(".php", "", $file);
             $class = str_replace(DIRECTORY_SEPARATOR, "_", $file);
             if (Pimcore_Tool::classExists($class)) {
                 $match = false;
                 foreach ($includePatterns as $pattern) {
                     if (preg_match($pattern, $file)) {
                         $match = true;
                         break;
                     }
                 }
                 if (strpos($file, "Webservice" . DIRECTORY_SEPARATOR . "Data") !== false) {
                     $match = true;
                 }
                 if (!$match) {
                     continue;
                 }
                 $classMap[str_replace("Webservice_Data_", "", $class)] = $class;
             }
         }
     }
     return $classMap;
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:34,代码来源:Tool.php


示例13: generateLayoutTreeFromArray

 public static function generateLayoutTreeFromArray($array)
 {
     if (is_array($array) && count($array) > 0) {
         $class = "Object_Class_" . ucfirst($array["datatype"]) . "_" . ucfirst($array["fieldtype"]);
         if (Pimcore_Tool::classExists($class)) {
             $item = new $class();
             if (method_exists($item, "addChild")) {
                 // allows childs
                 $item->setValues($array, array("childs"));
                 if ($array["childs"]["datatype"]) {
                     $childO = self::generateLayoutTreeFromArray($array["childs"]);
                     $item->addChild($childO);
                 } else {
                     if (is_array($array["childs"]) && count($array["childs"]) > 0) {
                         foreach ($array["childs"] as $child) {
                             $childO = self::generateLayoutTreeFromArray($child);
                             $item->addChild($childO);
                         }
                     }
                 }
             } else {
                 $item->setValues($array);
             }
             return $item;
         }
     }
     return false;
 }
开发者ID:nblackman,项目名称:pimcore,代码行数:28,代码来源:Service.php


示例14: getLanguages

 protected function getLanguages()
 {
     if ($this->languages == null) {
         $languages = Pimcore_Tool::getValidLanguages();
         $this->languages = $languages;
     }
     return $this->languages;
 }
开发者ID:mkliche,项目名称:Zendformbuilder,代码行数:8,代码来源:Frontend.php


示例15: registerModule

 /**
  * @param string $module
  * @return void
  */
 public function registerModule($module)
 {
     if (Pimcore_Tool::classExists($module)) {
         $this->_systemModules[] = new $module();
     } else {
         throw new Exception("unknown module [ {$module} ].");
     }
 }
开发者ID:nblackman,项目名称:pimcore,代码行数:12,代码来源:Broker.php


示例16: dispatchLoopShutdown

 public function dispatchLoopShutdown()
 {
     if (!Pimcore_Tool::isHtmlResponse($this->getResponse())) {
         return;
     }
     // removes the non-valid html attributes which are used by the wysiwyg editor for ID based linking
     $body = $this->getResponse()->getBody();
     $body = preg_replace("/ pimcore_(id|type)=\\\"([0-9a-z]+)\\\"/", "", $body);
     $this->getResponse()->setBody($body);
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:10,代码来源:WysiwygAttributes.php


示例17: dispatchLoopShutdown

 public function dispatchLoopShutdown()
 {
     if (!Pimcore_Tool::isHtmlResponse($this->getResponse())) {
         return;
     }
     if ($this->enabled) {
         $body = $this->getResponse()->getBody();
         $body = Minify_HTML::minify($body);
         $this->getResponse()->setBody($body);
     }
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:11,代码来源:HtmlMinify.php


示例18: dispatchLoopShutdown

 public function dispatchLoopShutdown()
 {
     if (!Pimcore_Tool::isHtmlResponse($this->getResponse())) {
         return;
     }
     if ($this->enabled) {
         include_once "simple_html_dom.php";
         $body = $this->getResponse()->getBody();
         $html = str_get_html($body);
         if ($html) {
             $styles = $html->find("link[rel=stylesheet], style[type=text/css]");
             $stylesheetContent = "";
             foreach ($styles as $style) {
                 if ($style->tag == "style") {
                     $stylesheetContent .= $style->innertext;
                 } else {
                     if ($style->media == "screen" || !$style->media) {
                         $source = $style->href;
                         $path = "";
                         if (is_file(PIMCORE_ASSET_DIRECTORY . $source)) {
                             $path = PIMCORE_ASSET_DIRECTORY . $source;
                         } else {
                             if (is_file(PIMCORE_DOCUMENT_ROOT . $source)) {
                                 $path = PIMCORE_DOCUMENT_ROOT . $source;
                             }
                         }
                         if (!empty($path) && is_file("file://" . $path)) {
                             $content = file_get_contents($path);
                             $content = $this->correctReferences($source, $content);
                             $stylesheetContent .= $content;
                             $style->outertext = "";
                         }
                     }
                 }
             }
             if (strlen($stylesheetContent) > 1) {
                 $stylesheetPath = PIMCORE_TEMPORARY_DIRECTORY . "/minified_css_" . md5($stylesheetContent) . ".css";
                 if (!is_file($stylesheetPath)) {
                     $stylesheetContent = Minify_CSS::minify($stylesheetContent);
                     // put minified contents into one single file
                     file_put_contents($stylesheetPath, $stylesheetContent);
                     chmod($stylesheetPath, 0766);
                 }
                 $head = $html->find("head", 0);
                 $head->innertext = $head->innertext . "\n" . '<link rel="stylesheet" media="screen" type="text/css" href="' . str_replace(PIMCORE_DOCUMENT_ROOT, "", $stylesheetPath) . '" />' . "\n";
             }
             $body = $html->save();
             $this->getResponse()->setBody($body);
         }
     }
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:51,代码来源:CssMinify.php


示例19: dispatchLoopShutdown

 public function dispatchLoopShutdown()
 {
     if (!Pimcore_Tool::isHtmlResponse($this->getResponse())) {
         return;
     }
     if ($this->enabled) {
         include_once "simple_html_dom.php";
         if ($this->getRequest()->getParam("pimcore_editmode")) {
             $this->editmode();
         } else {
             $this->frontend();
         }
     }
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:14,代码来源:Less.php


示例20: mail

 /**
  *
  */
 public function mail()
 {
     $conf = Pimcore_Config::getSystemConfig();
     if (!empty($conf->general->logrecipient)) {
         Logger::debug(get_class($this) . ": detected log recipient:" . $conf->general->logrecipient);
         $user = User::getById($conf->general->logrecipient);
         Logger::debug(get_class($this) . ": detected log recipient:" . $user->getEmail());
         if ($user instanceof User && $user->isAdmin()) {
             $email = $user->getEmail();
             Logger::debug(get_class($this) . ": user is valid");
             if (!empty($email)) {
                 if (is_dir(PIMCORE_LOG_MAIL_TEMP)) {
                     Logger::debug(get_class($this) . ": detected mail log dir");
                     Logger::debug(get_class($this) . ": opening dir " . PIMCORE_LOG_MAIL_TEMP);
                     if ($handle = opendir(PIMCORE_LOG_MAIL_TEMP)) {
                         Logger::debug(get_class($this) . ": reading dir " . PIMCORE_LOG_MAIL_TEMP);
                         while (false !== ($file = readdir($handle))) {
                             Logger::debug(get_class($this) . ": detected file " . $file);
                             if (is_file(PIMCORE_LOG_MAIL_TEMP . "/" . $file) and is_writable(PIMCORE_LOG_MAIL_TEMP . "/" . $file)) {
                                 $now = time();
                                 $threshold = 1 * 60 * 15;
                                 $fileModified = filemtime(PIMCORE_LOG_MAIL_TEMP . "/" . $file);
                                 Logger::debug(get_class($this) . ": file is writeable and was last modified: " . $fileModified);
                                 if ($fileModified !== FALSE and $fileModified < $now - $threshold) {
                                     $mail = Pimcore_Tool::getMail(array($email), "pimcore log notification - " . $file);
                                     $mail->setIgnoreDebugMode(true);
                                     $mail->setBodyText(file_get_contents(PIMCORE_LOG_MAIL_TEMP . "/" . $file));
                                     $mail->send();
                                     @unlink(PIMCORE_LOG_MAIL_TEMP . "/" . $file);
                                     Logger::debug(get_class($this) . ": sent mail and deleted temp log file " . $file);
                                 } else {
                                     if ($fileModified > $now - $threshold) {
                                         Logger::debug(get_class($this) . ": leaving temp log file alone because file [ {$file} ] was written to within the last 15 minutes");
                                     }
                                 }
                             }
                         }
                     }
                 }
             } else {
                 Logger::err(get_class($this) . ": Cannot send mail to configured log user [" . $user->getName() . "] because email is empty");
             }
         } else {
             Logger::err(get_class($this) . ": Cannot send mail to configured log user. User is either null or not an admin");
         }
     } else {
         Logger::debug(get_class($this) . ": No log recipient configured");
     }
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:52,代码来源:Maintenance.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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