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


PHP modX::getService方法代码示例

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


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

示例1: array

 /**
  * @param modX $modx
  * @param array $config
  */
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $corePath = $this->modx->getOption('msprofile_core_path', $config, $this->modx->getOption('core_path') . 'components/msprofile/');
     $assetsUrl = $this->modx->getOption('msprofile_assets_url', $config, $this->modx->getOption('assets_url') . 'components/msprofile/');
     $connectorUrl = $assetsUrl . 'connector.php';
     $this->config = array_merge(array('assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'imagesUrl' => $assetsUrl . 'images/', 'connectorUrl' => $connectorUrl, 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'chunksPath' => $corePath . 'elements/chunks/', 'templatesPath' => $corePath . 'elements/templates/', 'chunkSuffix' => '.chunk.tpl', 'snippetsPath' => $corePath . 'elements/snippets/', 'processorsPath' => $corePath . 'processors/'), $config);
     $this->modx->addPackage('msprofile', $this->config['modelPath']);
     $this->modx->lexicon->load('msprofile:default');
     $this->ms2 = $modx->getService('miniShop2');
     $this->ms2->initialize($this->modx->context->key);
 }
开发者ID:ASDAFF,项目名称:msProfile,代码行数:16,代码来源:msprofile.class.php

示例2: __construct

 public function __construct($modx, &$scriptProperties)
 {
     $this->scriptProperties =& $scriptProperties;
     $this->modx = $modx;
     $this->MlmSystem = $this->modx->MlmSystem;
     if (!is_object($this->MlmSystem)) {
         $this->MlmSystem = $this->modx->getService('mlmsystem');
     }
 }
开发者ID:vgrish,项目名称:mlmsystem,代码行数:9,代码来源:mlmsystemeventplugin.class.php

示例3: __construct

 /**
  * The modRest constructor
  *
  * @param modX $modx A reference to the modX instance
  * @param array $config An array of configuration options
  */
 public function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $this->config = array_merge(array('addMethodParameter' => false, 'baseUrl' => null, 'curlOptions' => array(), 'defaultParameters' => array(), 'format' => null, 'headers' => array(), 'password' => null, 'suppressSuffix' => false, 'userAgent' => 'MODX RestClient/1.0.0', 'username' => null), $config);
     $this->modx->getService('lexicon', 'modLexicon');
     if ($this->modx->lexicon) {
         $this->modx->lexicon->load('rest');
     }
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:15,代码来源:modrest.class.php

示例4: __construct

 public function __construct($MlmSystem, $config)
 {
     $this->MlmSystem =& $MlmSystem;
     $this->modx =& $MlmSystem->modx;
     $this->config =& $config;
     if ($this->MiniShop2 = $this->modx->getService('miniShop2')) {
         $this->MiniShop2->initialize($this->modx->context->key);
     } else {
         $this->MlmSystem->printLog('MiniShop2Profits requires installed miniShop2.', 1);
     }
 }
开发者ID:vgrish,项目名称:mlmsystem,代码行数:11,代码来源:minishop2profits.class.php

示例5: __construct

 /**
  * @param $modx
  * @param $config
  */
 public function __construct($modx, &$config)
 {
     $this->modx = $modx;
     $this->config =& $config;
     $this->gl = $this->modx->gl;
     if (!is_object($this->gl) or !$this->gl instanceof gl) {
         $corePath = $this->modx->getOption('gl_core_path', null, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/gl/');
         $this->gl = $this->modx->getService('gl', 'gl', $corePath . 'model/gl/', $this->config);
     }
     $this->namespace = $this->gl->namespace;
 }
开发者ID:vgrish,项目名称:gl,代码行数:15,代码来源:format.class.php

示例6: sendEmail

 /**
  * Send an email
  *
  * @param string $subject The subject of the email
  * @param string $body The body of the email to send
  * @param string $to The email address to send to
  * @return boolean
  */
 protected function sendEmail($subject, $body, $to)
 {
     if (!$this->_loadLexicon()) {
         return false;
     }
     $this->xpdo->lexicon->load('quip:emails');
     $this->xpdo->getService('mail', 'mail.modPHPMailer');
     if (!$this->xpdo->mail) {
         return false;
     }
     $emailFrom = $this->xpdo->context->getOption('quip.emailsFrom', $this->xpdo->context->getOption('emailsender'));
     $emailReplyTo = $this->xpdo->context->getOption('quip.emailsReplyTo', $this->xpdo->context->getOption('emailsender'));
     /* allow multiple to addresses */
     if (!is_array($to)) {
         $to = explode(',', $to);
     }
     $success = false;
     foreach ($to as $emailAddress) {
         if (empty($emailAddress) || strpos($emailAddress, '@') == false) {
             continue;
         }
         $this->xpdo->mail->set(modMail::MAIL_BODY, $body);
         $this->xpdo->mail->set(modMail::MAIL_FROM, $emailFrom);
         $this->xpdo->mail->set(modMail::MAIL_FROM_NAME, $this->xpdo->context->getOption('quip.emails_from_name', 'Quip'));
         $this->xpdo->mail->set(modMail::MAIL_SENDER, $emailFrom);
         $this->xpdo->mail->set(modMail::MAIL_SUBJECT, $subject);
         $this->xpdo->mail->address('to', $emailAddress);
         $this->xpdo->mail->address('reply-to', $emailReplyTo);
         $this->xpdo->mail->setHTML(true);
         $success = $this->xpdo->mail->send();
         $this->xpdo->mail->reset();
     }
     return $success;
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:42,代码来源:quipcomment.class.php

示例7: success

 /** @inheritdoc} */
 public function success($message = '', $data = array(), $placeholders = array())
 {
     if (!is_object($this->ms2)) {
         $this->ms2 = $this->modx->getService('minishop2');
     }
     return $this->ms2->success($message, $data, $placeholders);
 }
开发者ID:rafull6,项目名称:texno-service,代码行数:8,代码来源:msdeliveryhandler.class.php

示例8: array

 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $this->namespace = $this->getOption('namespace', $config, 'collections');
     $corePath = $this->getOption('core_path', $config, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/collections/');
     $assetsUrl = $this->getOption('assets_url', $config, $this->modx->getOption('assets_url', null, MODX_ASSETS_URL) . 'components/collections/');
     $connectorUrl = $assetsUrl . 'connector.php';
     $taggerCorePath = $modx->getOption('tagger.core_path', null, $modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/tagger/');
     if (file_exists($taggerCorePath . 'model/tagger/tagger.class.php')) {
         /** @var Tagger $tagger */
         $tagger = $modx->getService('tagger', 'Tagger', $taggerCorePath . 'model/tagger/', array('core_path' => $taggerCorePath));
     } else {
         $tagger = null;
     }
     $quipCorePath = $modx->getOption('quip.core_path', null, $modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/quip/');
     if (file_exists($quipCorePath . 'model/quip/quip.class.php')) {
         /** @var Quip $quip */
         $quip = $modx->getService('quip', 'Quip', $quipCorePath . 'model/quip/', array('core_path' => $quipCorePath));
     } else {
         $quip = null;
     }
     $this->config = array_merge(array('assets_url' => $assetsUrl, 'core_path' => $corePath, 'assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'imagesUrl' => $assetsUrl . 'images/', 'connectorUrl' => $connectorUrl, 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'chunksPath' => $corePath . 'elements/chunks/', 'chunkSuffix' => '.chunk.tpl', 'snippetsPath' => $corePath . 'elements/snippets/', 'processorsPath' => $corePath . 'processors/', 'templatesPath' => $corePath . 'templates/', 'taggerInstalled' => $tagger instanceof Tagger, 'quipInstalled' => $quip instanceof Quip), $config);
     $this->modx->addPackage('collections', $this->config['modelPath']);
     $this->modx->lexicon->load('collections:default');
     $this->modx->lexicon->load('collections:selections');
 }
开发者ID:lokamaya,项目名称:Collections,代码行数:26,代码来源:collections.class.php

示例9: __construct

 /**
  * @param $modx
  * @param $config
  */
 public function __construct($modx, &$config)
 {
     $this->modx = $modx;
     $this->config =& $config;
     $corePath = $this->modx->getOption('subdomainsfolder_core_path', null, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/subdomainsfolder/');
     /** @var SubdomainsFolder $SubdomainsFolder */
     $this->SubdomainsFolder = $this->modx->getService('SubdomainsFolder', 'SubdomainsFolder', $corePath . 'model/subdomainsfolder/', array('core_path' => $corePath));
     $this->namespace = $this->SubdomainsFolder->namespace;
 }
开发者ID:vgrish,项目名称:subdomainsfolder,代码行数:13,代码来源:tools.class.php

示例10: __construct

 /**
  * @param modX $modx
  * @param array $config
  */
 public function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $this->config = array_merge(array('basePath' => $this->modx->getOption('base_path', null, MODX_BASE_PATH), 'collectionResultsKey' => 'results', 'collectionTotalKey' => 'total', 'controllerClassPrefix' => 'modRestController', 'controllerClassSeparator' => '', 'defaultAction' => 'index', 'defaultResponseFormat' => 'json', 'defaultFailureStatusCode' => 200, 'defaultSuccessStatusCode' => 200, 'errorMessageSeparator' => ' ', 'exitOnResponse' => true, 'propertyLimit' => 'limit', 'propertyOffset' => 'start', 'propertySearch' => 'search', 'propertySort' => 'sort', 'propertySortDir' => 'dir', 'requestParameter' => '_rest', 'responseErrorsKey' => 'errors', 'responseMessageKey' => 'message', 'responseObjectKey' => 'object', 'responseSuccessKey' => 'success', 'trimParameters' => false, 'xmlRootNode' => 'response'), $config);
     $this->modx->getService('lexicon', 'modLexicon');
     if ($this->modx->lexicon) {
         $this->modx->lexicon->load('rest');
     }
 }
开发者ID:adamwintle,项目名称:flexibility5,代码行数:13,代码来源:modrestservice.class.php

示例11: array

 /**
  * @param modX $modx
  * @param array $config
  */
 function __construct(modX &$modx, array $config = array())
 {
     $this->modx =& $modx;
     $this->ms2Gallery = $this->modx->getService('ms2Gallery', 'ms2Gallery', MODX_CORE_PATH . 'components/ms2gallery/model/ms2gallery/');
     $corePath = $this->modx->getOption('ms2galleryForm.core_path', $config, $this->modx->getOption('core_path') . 'components/ms2galleryform/');
     $assetsUrl = $this->modx->getOption('ms2galleryForm.assets_url', $config, $this->modx->getOption('assets_url') . 'components/ms2galleryform/');
     $actionUrl = $this->modx->getOption('ms2galleryForm.action_url', $config, $assetsUrl . 'action.php');
     $connectorUrl = $assetsUrl . 'connector.php';
     $this->config = array_merge(array('assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'imagesUrl' => $assetsUrl . 'images/', 'connector_url' => $connectorUrl, 'actionUrl' => $actionUrl, 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'ctx' => 'web', 'json_response' => false), $config);
     $this->modx->addPackage('ms2galleryForm', $this->config['modelPath']);
     $this->modx->lexicon->load('ms2galleryform:default');
     $this->authenticated = $this->modx->user->isAuthenticated($this->modx->context->get('key'));
 }
开发者ID:bendasvadim,项目名称:ms2GalleryForm,代码行数:17,代码来源:ms2galleryform.class.php

示例12: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     require_once dirname(__FILE__) . '/build.config.php';
     require_once dirname(__FILE__) . '/uthelpers.class.php';
     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
     $modx = new modX();
     $modx->initialize('mgr');
     $modx->getService('error', 'error.modError', '', '');
     $this->utHelpers = new UtHelpers();
     $this->mc = new MyComponentProject($modx);
     $this->mc->init(array(), 'unittest');
     $this->mc->createCategories();
     $this->mc->createBasics();
     $this->modx =& $this->mc->modx;
     if ($this->mc->props['categories']['UnitTest']['category'] != 'UnitTest') {
         die('wrong config');
     }
     if (strstr($this->mc->targetRoot, 'unittest')) {
         // $this->utHelpers->rrmdir($this->mc->targetRoot);
     } else {
         die('Wrong Target Root!');
     }
     $modx->setLogLevel(modX::LOG_LEVEL_INFO);
     $modx->setLogTarget('ECHO');
 }
开发者ID:mooror,项目名称:MyComponent,代码行数:29,代码来源:exporttest.php

示例13: sanitize

 /**
  * Sanitises and transliterates a value for use as paths.
  *
  * @param $value
  * @return string
  */
 public function sanitize($value)
 {
     $iconv = function_exists('iconv');
     $charset = strtoupper((string) $this->getOption('modx_charset', null, 'UTF-8'));
     $translit = $this->getOption($this->namespace . '.translit', null, $this->getOption('friendly_alias_translit', null, 'none'), true);
     $translitClass = $this->getOption($this->namespace . '.translit_class', null, $this->getOption('friendly_alias_translit_class', null, 'translit.modTransliterate'), true);
     $translitClassPath = $this->getOption($this->namespace . '.translit_class_path', null, $this->getOption('friendly_alias_translit_class_path', null, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/'), true);
     switch ($translit) {
         case '':
         case 'none':
             // no transliteration
             break;
         case 'iconv':
             // if iconv is available, use the built-in transliteration it provides
             if ($iconv) {
                 $value = iconv($charset, 'ASCII//TRANSLIT//IGNORE', $value);
             }
             break;
         default:
             // otherwise look for a transliteration service class (i.e. Translit package) that will accept named transliteration tables
             if ($this->modx instanceof \modX) {
                 if ($translit = $this->modx->getService('translit', $translitClass, $translitClassPath)) {
                     $value = $translit->translate($value, $translit);
                 }
             }
             break;
     }
     $replace = $this->getOption($this->namespace . '.sanitize_replace', null, '_');
     $pattern = $this->getOption($this->namespace . '.sanitize_pattern', null, '/([[:alnum:]_\\.-]*)/');
     $value = str_replace(str_split(preg_replace($pattern, $replace, $value)), $replace, $value);
     $value = preg_replace('/[\\/_|+ -]+/', $replace, $value);
     $value = trim(trim($value, $replace));
     return $value;
 }
开发者ID:hansek,项目名称:Alpacka,代码行数:40,代码来源:Alpacka.php

示例14: sendEmail

 /**
  * Send an email to the user
  *
  * @param string $message The body of the email
  * @param array $options An array of options
  * @return boolean True if successful
  */
 public function sendEmail($message, array $options = array())
 {
     if (!$this->xpdo instanceof modX) {
         return false;
     }
     $profile = $this->getOne('Profile');
     if (empty($profile)) {
         return false;
     }
     $this->xpdo->getService('mail', 'mail.modPHPMailer');
     if (!$this->xpdo->mail) {
         return false;
     }
     $this->xpdo->mail->set(modMail::MAIL_BODY, $message);
     $this->xpdo->mail->set(modMail::MAIL_FROM, $this->xpdo->getOption('from', $options, $this->xpdo->getOption('emailsender')));
     $this->xpdo->mail->set(modMail::MAIL_FROM_NAME, $this->xpdo->getOption('fromName', $options, $this->xpdo->getOption('site_name')));
     $this->xpdo->mail->set(modMail::MAIL_SENDER, $this->xpdo->getOption('sender', $options, $this->xpdo->getOption('emailsender')));
     $this->xpdo->mail->set(modMail::MAIL_SUBJECT, $this->xpdo->getOption('subject', $options, $this->xpdo->getOption('emailsubject')));
     $this->xpdo->mail->address('to', $profile->get('email'), $profile->get('fullname'));
     $this->xpdo->mail->address('reply-to', $this->xpdo->getOption('sender', $options, $this->xpdo->getOption('emailsender')));
     $this->xpdo->mail->setHTML($this->xpdo->getOption('html', $options, true));
     $sent = $this->xpdo->mail->send();
     $this->xpdo->mail->reset();
     return $sent;
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:32,代码来源:moduser.class.php

示例15: __construct

 public function __construct(modX $modx, &$scriptProperties)
 {
     $this->scriptProperties =& $scriptProperties;
     $this->modx = $modx;
     $fqn = $modx->getOption('twiggy_class', null, 'twiggy.twiggy', true);
     $path = $modx->getOption('twiggy_class_path', null, MODX_CORE_PATH . 'components/twiggy/model/', true);
     $this->twiggy = $modx->getService($fqn, '', $path, $this->scriptProperties);
 }
开发者ID:vgrish,项目名称:twiggy,代码行数:8,代码来源:twiggyplugin.class.php


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