/** * @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); }
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'); } }
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'); }
/** * 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'); } }
/** * @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; }
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); } }
/** * 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; }
/** @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); }
/** * @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; }
/** * @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'); } }
/** * 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'); }
/** * 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; }
/** * 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; }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before each test is executed. */ protected function setUp() { // echo "\n---------------- 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'; $this->utHelpers = new UtHelpers(); $modx = new modX(); $modx->initialize('mgr'); $modx->getService('error', 'error.modError', '', ''); $modx->getService('lexicon', 'modLexicon'); $modx->getRequest(); $homeId = $modx->getOption('site_start'); $homeResource = $modx->getObject('modResource', $homeId); if ($homeResource instanceof modResource) { $modx->resource = $homeResource; } else { echo "\nNo Resource\n"; } $modx->setLogLevel(modX::LOG_LEVEL_ERROR); $modx->setLogTarget('ECHO'); require_once MODX_ASSETS_PATH . 'mycomponents/mycomponent/core/components/mycomponent/model/mycomponent/mycomponentproject.class.php'; /* @var $categoryObj modCategory */ $this->mc = new MyComponentProject($modx); $this->mc->init(array(), 'unittest'); $this->modx =& $modx; $this->category = key($this->mc->props['categories']); $this->packageNameLower = $this->mc->packageNameLower; if ($this->category != 'UnitTest') { session_write_close(); die('wrong config - NEVER run unit test on a real project!'); } $category = $this->modx->getCollection('modCategory', array('category' => 'UnitTest')); foreach ($category as $categoryObj) { $categoryObj->remove(); } $namespace = $this->modx->getObject('modNamespace', array('name' => 'unittest')); if ($namespace) { $namespace->remove(); } $this->utHelpers->rrmdir($this->mc->targetRoot); $this->utHelpers->removeElements($this->modx, $this->mc); $this->utHelpers->removeResources($this->modx, $this->mc); //$this->mc->createCategory(); //$this->mc->createNamespace(); }
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); }
public function __construct(modX &$modx, &$scriptProperties) { $this->scriptProperties =& $scriptProperties; $this->modx =& $modx; if (!is_object($this->ecc)) { $corePath = $modx->getOption('ecc_core_path', null, $modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/ecc/'); $this->ecc = $modx->getService('ecc', 'ecc', $corePath . 'model/ecc/', array('core_path' => $corePath)); } }
/** * Constructs a new instance of the modMail class. * * {@inheritdoc} */ function __construct(modX &$modx, array $attributes= array()) { $this->modx= & $modx; if (!$this->modx->lexicon) { $this->modx->getService('lexicon','modLexicon'); } $this->modx->lexicon->load('mail'); $this->defaultAttributes = is_array($attributes) ? $attributes : array(); $this->attributes= $this->getDefaultAttributes($attributes); }
/** * Renders input forms for the template variable. * * @access public * @param modResource|null $resource The resource; 0 defaults to the current resource. * @param mixed $options Array of options ('value', 'style') or deprecated $style string * @return mixed The rendered input for the template variable. */ public function renderInput($resource = null, $options = array()) { if (is_int($resource)) { $resource = $this->xpdo->getObject('modResource', $resource); } if (empty($resource)) { $resource = $this->xpdo->resource; } $resourceId = $resource ? $resource->get('id') : 0; if (is_string($options) && !empty($options)) { // fall back to deprecated $style setting $style = $options; } else { $style = is_array($options) && isset($options['style']) ? strval($options['style']) : ''; $value = is_array($options) && isset($options['value']) ? strval($options['value']) : ''; } if (!isset($this->xpdo->smarty)) { $this->xpdo->getService('smarty', 'smarty.modSmarty', '', array('template_dir' => $this->xpdo->getOption('manager_path') . 'templates/' . $this->xpdo->getOption('manager_theme', null, 'default') . '/')); } $this->xpdo->smarty->assign('style', $style); if (!isset($value) || empty($value)) { $value = $this->getValue($resourceId); } /* process only @INHERIT bindings in value, since we're inputting */ $bindingData = $this->getBindingDataFromValue($value); if ($bindingData['cmd'] == 'INHERIT') { $value = $this->processInheritBinding($bindingData['param'], $resourceId); } /* if any FC tvDefault rules, set here */ $value = $this->checkForFormCustomizationRules($value, $resource); /* properly set value back if any FC rules, resource values, or bindings have adjusted it */ $this->set('value', $value); $this->set('processedValue', $value); $this->set('default_text', $this->processBindings($this->get('default_text'), $resourceId)); /* strip tags from description */ $this->set('description', strip_tags($this->get('description'))); $params = array(); if ($paramstring = $this->get('display_params')) { $cp = explode("&", $paramstring); foreach ($cp as $p => $v) { $v = trim($v); $ar = explode("=", $v); if (is_array($ar) && count($ar) == 2) { $params[$ar[0]] = $this->decodeParamValue($ar[1]); } } } $params = $this->get('input_properties'); /* default required status to no */ if (!isset($params['allowBlank'])) { $params['allowBlank'] = 1; } /* find the correct renderer for the TV, if not one, render a textbox */ $inputRenderPaths = $this->getRenderDirectories('OnTVInputRenderList', 'input'); return $this->getRender($params, $value, $inputRenderPaths, 'input', $resourceId, $this->get('type')); }
/** * @param array $where * @param array $options * * @return array|bool */ public function getResources($where, array $options = array()) { $output = false; $this->debugParser('getResources', $where, $options); /** @var pdoFetch $pdoFetch */ if ($pdoFetch = $this->modx->getService('pdoFetch')) { $output = $pdoFetch->getCollection('modResource', $where, $options); } $this->debugParser('getResources', $where, $options); return $output; }
/** * Get the client responsible for communicating with the provider. * * @return modRestClient|bool A REST client instance, or FALSE. */ public function getClient() { if (empty($this->xpdo->rest)) { $this->xpdo->getService('rest', 'rest.modRestClient'); $loaded = $this->xpdo->rest->getConnection(); if (!$loaded) { return false; } } return $this->xpdo->rest; }
/** * @param modX $modx * @param array $config */ function __construct(modX &$modx, $config = array()) { $this->modx =& $modx; $this->config =& $config; $this->ecc = $this->modx->ecc; if (!is_object($this->ecc)) { $corePath = $modx->getOption('ecc_core_path', null, $modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/ecc/'); $this->ecc = $modx->getService('ecc', 'ecc', $corePath . 'model/ecc/', array('core_path' => $corePath)); } $this->opts =& $this->ecc->opts; $this->config = array_merge(array('wrapperId' => $this->getWrapperId()), $config); }
public function dbSaveAndEmail() { $this->dbSave(); if (!$this->hook->hasErrors()) { // exclude fields from email send $this->excludeFields(); $newData = array('formName' => $this->config->senderName); // Save Fields foreach ($this->config->data as $field => $value) { if (is_array($value)) { switch ($this->formArray[$field]['type']) { case 'select': case 'checkbox': case 'radio': $value = implode(', ', $value); break; } } $newData['message'] .= $this->formArray[$field]['label'] . ' ' . $value . '<br>'; $newData[$this->formArray[$field]['id']] = $value; } $message = $this->fmz->getChunk($this->config->emailTpl, $newData); $this->modx->getService('mail', 'mail.modPHPMailer'); $this->modx->mail->set(modMail::MAIL_BODY, $message); $this->modx->mail->set(modMail::MAIL_FROM, $this->config->emailFrom); $this->modx->mail->set(modMail::MAIL_FROM_NAME, $this->config->senderName); $this->modx->mail->set(modMail::MAIL_SUBJECT, $this->config->subject); $tos = explode(',', $this->config->emailTo); foreach ($tos as $to) { $this->modx->mail->address('to', $to); } $this->modx->mail->address('reply-to', $this->config->emailFrom); $this->modx->mail->setHTML(true); if (!$this->modx->mail->send()) { $this->modx->log(modX::LOG_LEVEL_ERROR, 'An error occurred while trying to email the Admin: ' . $this->modx->mail->mailer->ErrorInfo); } $this->modx->mail->reset(); } return true; }
/** * Translate a string using a named transliteration table. * * @param string $string The string to transliterate. * * @return string The translated string. */ public function translate($string) { $exclude = $this->modx->getOption('friendly_alias_ytranslit_exclude', '', '/^[_-a-zA-z\\d\\s\\:\\(\\)]+$/i', true); if (empty($string) || preg_match($exclude, $string)) { return $string; } $extension = ''; if (preg_match('#\\.[0-9a-z]+$#i', $string, $matches)) { $extension = $matches[0]; $string = preg_replace('#' . $extension . '$#', '', $string); } $trim = $this->modx->getOption('friendly_alias_trim_chars', null, '/.-_', true); $string = str_replace(str_split($trim), ' ', $string); $service = $this->modx->getOption('friendly_alias_ytranslit_url', null, 'https://translate.yandex.net/api/v1.5/tr.json/translate?key=[[+key]]&lang=ru-en&text=', true); $key = trim($this->modx->getOption('friendly_alias_ytranslit_key', null, '')); if (empty($key)) { $this->modx->log(modX::LOG_LEVEL_ERROR, '[yTranslit] You must specify the API key! Please, get it from http://api.yandex.ru/key/form.xml?service=trnsl.'); return $string; } else { $request = str_replace('[[+key]]', $key, $service) . urlencode($string); if (function_exists('curl_init')) { $url = parse_url($request); parse_str($url['query'], $params); /** @var modRestCurlClient $client */ $client = $this->modx->getService('rest.modRestCurlClient'); $result = $client->request($url['scheme'] . '://' . $url['host'], $url['path'], 'GET', $params, array('curlopt_timeout' => $this->modx->getOption('friendly_alias_ytranslit_timeout', null, 1, true), 'curlopt_returntransfer' => 1)); } else { $result = file_get_contents($request); } $arr = $this->modx->fromJSON($result); if (!is_array($arr)) { $this->modx->log(modX::LOG_LEVEL_ERROR, "[yTranslit] Service unavailable.\nRequest: {$request}.\nResponse: {$result}"); } elseif ($arr['code'] != 200 || empty($arr['text'][0])) { $this->modx->log(modX::LOG_LEVEL_ERROR, '[yTranslit] Service returned an error. ' . print_r($arr, true)); } else { $string = $arr['text'][0]; } return $string . strtolower($extension); } }
/** * Load all class files and init defaults. * * @access public * @return boolean success state of initialization */ public function initialize() { if (!$this->modx->getService('smarty', 'smarty.modSmarty')) { $this->modx->log(modX::LOG_LEVEL_ERROR, '[AjaxUpload] Could not load modSmarty service.'); $this->debug[] = 'Could not load modSmarty service.'; return FALSE; } if (!$this->modx->loadClass('modPhpThumb', $this->modx->getOption('core_path') . 'model/phpthumb/', TRUE, TRUE)) { $this->modx->log(modX::LOG_LEVEL_ERROR, '[AjaxUpload] Could not load modPhpThumb class.'); $this->debug[] = 'Could not load modPhpThumb class.'; return FALSE; } if (!class_exists('qqFileUploader')) { include_once $this->config['modelPath'] . 'fileuploader/fileuploader.class.php'; //include_once $this->config['modelPath'] . 'filecopier/filecopier.class.php'; } $language = empty($this->config['language']) ? '' : $this->config['language'] . ':'; $this->modx->lexicon->load($language . 'ajaxupload:default'); if (!isset($_SESSION['ajaxupload'][$this->config['uid']])) { $_SESSION['ajaxupload'][$this->config['uid']] = array(); } $_SESSION['ajaxupload'][$this->config['uid'] . 'config'] = $this->config; if (!@is_dir($this->config['cachePath'])) { @mkdir($this->config['cachePath'], 0755); } $this->clearCache(); return TRUE; }
public function __construct($modx, &$scriptProperties) { $this->scriptProperties =& $scriptProperties; $this->modx =& $modx; $corePath = $this->modx->getOption('pdfresource.core_path', null, $this->modx->getOption('core_path') . 'components/pdfresource/'); $this->pdfresource = $this->modx->getService('pdfresource', 'PDFResource', $corePath . 'model/pdfresource/', array('core_path' => $corePath)); }
/** * Gets the parsing engine * * @return modParser095 */ public function getParser() { if (!is_object($this->parser) || !$this->parser instanceof modParser095) { $this->parser =& $this->modx->getService('parser095', 'modParser095'); } return $this->parser; }
public function __construct($modx, &$scriptProperties) { $this->scriptProperties =& $scriptProperties; $this->modx = $modx; $this->el = $this->modx->el; if (!is_object($this->el)) { $this->el = $this->modx->getService('el'); } }
public function __construct($modx, &$scriptProperties) { $this->scriptProperties =& $scriptProperties; $this->modx = $modx; $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->scriptProperties); } }
/** * @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')); }
/** * @param $modx * @param $config */ public function __construct($modx, &$config) { $this->modx = $modx; $this->config =& $config; $corePath = $this->modx->getOption('dadata_core_path', null, $this->modx->getOption('core_path', null, MODX_CORE_PATH) . 'components/dadata/'); /** @var dadata $dadata */ $this->dadata =& $this->modx->getService('dadata', 'dadata', $corePath . 'model/dadata/', array('core_path' => $corePath)); $this->namespace = $this->dadata->namespace; }