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


PHP Pimcore_Tool类代码示例

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


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


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