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


PHP Model::instance方法代码示例

本文整理汇总了PHP中Model::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::instance方法的具体用法?PHP Model::instance怎么用?PHP Model::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model的用法示例。


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

示例1: Instance

 public static function Instance()
 {
     if (self::$instance == null) {
         self::$instance = new Model();
     }
     return self::$instance;
 }
开发者ID:ArmiT,项目名称:test150915,代码行数:7,代码来源:model.php

示例2: get_instance

 public static function get_instance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:noikiy,项目名称:webgame,代码行数:7,代码来源:Model.php

示例3: getInstance

 /**
  * Singleton constructor
  * @return static
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new static();
     }
     return self::$instance;
 }
开发者ID:sisjosex,项目名称:phpadmin,代码行数:11,代码来源:model.php

示例4: getInstance

 public static function getInstance()
 {
     if (self::$instance == NULL) {
         self::$instance = new Model();
     }
     return self::$instance;
 }
开发者ID:fkali,项目名称:yupp,代码行数:7,代码来源:core.mvc.Model.class.php

示例5: index

 public function index()
 {
     $model = Model::instance();
     ipAddJs('Ip/Internal/Grid/assets/grid.js');
     ipAddJs('Ip/Internal/Grid/assets/gridInit.js');
     ipAddJs('Ip/Internal/Grid/assets/subgridField.js');
     $notes = array();
     if (isset($_SESSION['Ip']['notes']) && is_array($_SESSION['Ip']['notes'])) {
         $notes = $_SESSION['Ip']['notes'];
     }
     unset($_SESSION['Ip']['notes']);
     $enableUpdate = !defined('MULTISITE_WEBSITES_DIR');
     // Disable update in MultiSite installation.
     $trash = array('size' => \Ip\Internal\Pages\Service::trashSize());
     $data = array('notes' => $notes, 'version' => \Ip\ServiceLocator::storage()->get('Ip', 'version'), 'changedUrl' => $model->getOldUrl() != $model->getNewUrl(), 'oldUrl' => $model->getOldUrl(), 'newUrl' => $model->getNewUrl(), 'migrationsAvailable' => \Ip\Internal\Update\Service::migrationsAvailable(), 'migrationsUrl' => ipActionUrl(array('pa' => 'Update')), 'recoveryPageForm' => \Ip\Internal\System\Helper::recoveryPageForm(), 'emptyPageForm' => \Ip\Internal\System\Helper::emptyPageForm(), 'trash' => $trash);
     $content = ipView('view/index.php', $data)->render();
     if ($enableUpdate) {
         ipAddJs('Ip/Internal/System/assets/update.js');
     }
     if ($trash['size'] > 0) {
         ipAddJs('Ip/Internal/Core/assets/js/angular.js');
         ipAddJs('Ip/Internal/System/assets/trash.js');
     }
     ipAddJs('Ip/Internal/System/assets/migrations.js');
     ipAddJs('assets/cache.js');
     return $content;
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:27,代码来源:AdminController.php

示例6: checkForUpdates

 private static function checkForUpdates()
 {
     $module = Model::instance();
     $systemInfo = $module->getIpNotifications();
     if ($systemInfo != '') {
         //send an email
         $md5 = \Ip\ServiceLocator::storage()->get('Ip', 'lastSystemMessageSent');
         if (!$md5 || $md5 != md5(serialize($systemInfo))) {
             //we have a new message
             $message = '';
             $messages = $systemInfo;
             if (is_array($messages)) {
                 foreach ($messages as $messageVal) {
                     $message .= '<p>' . $messageVal->message . '</p>';
                 }
                 $onlyStatusMessages = true;
                 foreach ($messages as $messageVal) {
                     if ($messageVal->type != 'status') {
                         $onlyStatusMessages = false;
                     }
                 }
                 if ($onlyStatusMessages) {
                     return;
                     //TODO replace to something that would not terminate execution of following scripts if they will be there some day
                 }
             } else {
                 return;
                 //TODO replace to something that would not terminate execution of following scripts if they will be there some day
             }
             ipEvent('ipSystemMessages', array('messages' => $messages));
             \Ip\ServiceLocator::storage()->set('Ip', 'lastSystemMessageSent', md5(serialize($systemInfo)));
         }
     }
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:34,代码来源:Event.php

示例7: getInstance

 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new Model();
     }
     return self::$instance;
 }
开发者ID:frsab,项目名称:ConduiteDeProjet,代码行数:7,代码来源:model.php

示例8: downloadTheme

 public function downloadTheme($name, $url, $signature)
 {
     $model = Model::instance();
     //download theme
     $net = new \Ip\Internal\NetHelper();
     $themeTempFilename = $net->downloadFile($url, ipFile('file/secure/tmp/'), $name . '.zip');
     if (!$themeTempFilename) {
         throw new \Ip\Exception('Theme file download failed.');
     }
     $archivePath = ipFile('file/secure/tmp/' . $themeTempFilename);
     //check signature
     $fileMd5 = md5_file($archivePath);
     $rsa = new \Crypt_RSA();
     $rsa->loadKey($this->publicKey);
     $rsa->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1);
     $verified = $rsa->verify($fileMd5, base64_decode($signature));
     if (!$verified) {
         throw new \Ip\Exception('Theme signature verification failed.');
     }
     //extract
     $helper = Helper::instance();
     $secureTmpDir = ipFile('file/secure/tmp/');
     $tmpExtractedDir = \Ip\Internal\File\Functions::genUnoccupiedName($name, $secureTmpDir);
     \Ip\Internal\Helper\Zip::extract($secureTmpDir . $themeTempFilename, $secureTmpDir . $tmpExtractedDir);
     unlink($archivePath);
     //install
     $extractedDir = $helper->getFirstDir($secureTmpDir . $tmpExtractedDir);
     $installDir = $model->getThemeInstallDir();
     $newThemeDir = \Ip\Internal\File\Functions::genUnoccupiedName($name, $installDir);
     rename($secureTmpDir . $tmpExtractedDir . '/' . $extractedDir, $installDir . $newThemeDir);
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:31,代码来源:ThemeDownloader.php

示例9: getAdminNavbarHtml

 protected static function getAdminNavbarHtml()
 {
     $requestData = \Ip\ServiceLocator::request()->getRequest();
     $curModTitle = '';
     $curModUrl = '';
     $curModIcon = '';
     if (!empty($requestData['aa'])) {
         $parts = explode('.', $requestData['aa']);
         $curModule = $parts[0];
     } else {
         $curModule = "Content";
     }
     if (isset($curModule) && $curModule) {
         $title = $curModule;
         $plugin = \Ip\Internal\Plugins\Service::getPluginConfig($curModule);
         if ($plugin) {
             $title = $plugin['title'];
         }
         $curModTitle = __($title, 'Ip-admin', false);
         $curModUrl = ipActionUrl(array('aa' => $curModule . '.index'));
         $curModIcon = Model::getAdminMenuItemIcon($curModule);
     }
     $navbarButtons = array(array('text' => '', 'hint' => __('Logout', 'Ip-admin', false), 'url' => ipActionUrl(array('sa' => 'Admin.logout')), 'class' => 'ipsAdminLogout', 'faIcon' => 'fa-power-off'));
     $navbarButtons = ipFilter('ipAdminNavbarButtons', $navbarButtons);
     $navbarCenterElements = ipFilter('ipAdminNavbarCenterElements', array());
     $data = array('menuItems' => Model::instance()->getAdminMenuItems($curModule), 'curModTitle' => $curModTitle, 'curModUrl' => $curModUrl, 'curModIcon' => $curModIcon, 'navbarButtons' => array_reverse($navbarButtons), 'navbarCenterElements' => $navbarCenterElements);
     $html = ipView('view/navbar.php', $data)->render();
     return $html;
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:29,代码来源:Event.php

示例10: initConfig

 protected static function initConfig()
 {
     ipAddCss('Ip/Internal/Core/assets/admin/admin.css');
     ipAddJs('Ip/Internal/Core/assets/js/jquery-ui/jquery-ui.js');
     ipAddJsVariable('ipTranslationSaving', __('Saving...', 'Ip-admin', false));
     ipAddJs('Ip/Internal/Design/assets/optionsBox.js');
     ipAddJsVariable('ipModuleDesignConfiguration', Helper::getConfigurationBoxHtml());
     if (file_exists(ipThemeFile(Model::INSTALL_DIR . 'Options.js'))) {
         ipAddJs(ipThemeUrl(Model::INSTALL_DIR . 'Options.js'));
     } elseif (file_exists(ipThemeFile(Model::INSTALL_DIR . 'options.js'))) {
         ipAddJs(ipThemeUrl(Model::INSTALL_DIR . 'options.js'));
     }
     $model = Model::instance();
     $theme = $model->getTheme(ipConfig()->theme());
     if (!$theme) {
         throw new \Ip\Exception("Theme doesn't exist");
     }
     $options = $theme->getOptionsAsArray();
     $fieldNames = array();
     foreach ($options as $option) {
         if (empty($option['name'])) {
             continue;
         }
         $fieldNames[] = $option['name'];
     }
     ipAddJsVariable('ipModuleDesignOptionNames', $fieldNames);
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:27,代码来源:Event.php

示例11: compileFile

 /**
  * @param string $themeName
  * @param string $lessFile
  * @return string
  */
 public function compileFile($themeName, $lessFile)
 {
     $model = Model::instance();
     $theme = $model->getTheme($themeName);
     $options = $theme->getOptionsAsArray();
     $configModel = ConfigModel::instance();
     $config = $configModel->getAllConfigValues($themeName);
     $less = "@import '{$lessFile}';";
     $less .= $this->generateLessVariables($options, $config);
     $css = '';
     try {
         require_once ipFile('Ip/Lib/less.php/Less.php');
         $themeDir = ipFile('Theme/' . $themeName . '/assets/');
         $ipContentDir = ipFile('Ip/Internal/Core/assets/ipContent/');
         // creating new context to pass theme assets directory dynamically to a static callback function
         $context = $this;
         $callback = function ($parseFile) use($context, $themeDir) {
             return $context->overrideImportDirectory($themeDir, $parseFile);
         };
         $parserOptions = array('import_callback' => $callback, 'cache_dir' => ipFile('file/tmp/less/'), 'relativeUrls' => false, 'sourceMap' => true);
         $parser = new \Less_Parser($parserOptions);
         $directories = array($themeDir => '', $ipContentDir => '');
         $parser->SetImportDirs($directories);
         $parser->parse($less);
         $css = $parser->getCss();
         $css = "/* Edit {$lessFile}, not this file. */" . "\n" . $css;
     } catch (\Exception $e) {
         ipLog()->error('Less compilation error: Theme - ' . $e->getMessage());
     }
     return $css;
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:36,代码来源:LessCompiler.php

示例12: self

 static function get_instance()
 {
     if (self::$instance instanceof self) {
         return self::$instance;
     }
     return self::$instance = new self();
 }
开发者ID:AlexKFU,项目名称:massage,代码行数:7,代码来源:Model.php

示例13: __callStatic

 public static function __callStatic($function, $arguments)
 {
     // avoid cap errors
     if (strtolower($function) == strtolower(get_called_class())) {
         // call the constructor from an instance
         if (is_null(self::$instance)) {
             self::$instance = new self();
         }
         return self::$instance;
     }
 }
开发者ID:tfont,项目名称:skyfire,代码行数:11,代码来源:abstract.model.php

示例14: urlHasChanged

 public static function urlHasChanged()
 {
     $model = Model::instance();
     $oldUrl = $model->getOldUrl();
     $newUrl = $model->getNewUrl();
     if ($oldUrl != $newUrl) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:11,代码来源:Service.php

示例15: getTheme

 public function getTheme($name = null, $dir = null, $url = null)
 {
     if ($name == null) {
         $name = ipConfig()->theme();
     }
     if ($dir == null) {
         $dir = ipFile('Theme/');
     }
     $model = Model::instance();
     $theme = $model->getTheme($name, $dir, $url);
     return $theme;
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:12,代码来源:Service.php


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