本文整理汇总了PHP中modMediaSource::getSourceProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP modMediaSource::getSourceProperties方法的具体用法?PHP modMediaSource::getSourceProperties怎么用?PHP modMediaSource::getSourceProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modMediaSource
的用法示例。
在下文中一共展示了modMediaSource::getSourceProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* Initializes component into different contexts.
*
* @param string $ctx The context to load. Defaults to web.
* @param array $scriptProperties
*
* @return boolean
*/
public function initialize($ctx = 'web', $scriptProperties = array())
{
$this->config = array_merge($this->config, $scriptProperties);
$this->config['ctx'] = $ctx;
if (empty($this->initialized[$ctx])) {
$properties = $this->ms2Gallery->getSourceProperties();
$config_js = array('ctx' => $ctx, 'jsUrl' => $this->config['jsUrl'] . 'web/', 'cssUrl' => $this->config['cssUrl'] . 'web/', 'actionUrl' => $this->config['actionUrl'], 'source' => array('size' => !empty($properties['maxUploadSize']) ? $properties['maxUploadSize'] : 3145728, 'height' => !empty($properties['maxUploadHeight']) ? $properties['maxUploadHeight'] : 1080, 'width' => !empty($properties['maxUploadWidth']) ? $properties['maxUploadWidth'] : 1920, 'extensions' => !empty($properties['allowedFileTypes']) ? $properties['allowedFileTypes'] : 'jpg,jpeg,png,gif'));
$this->modx->regClientStartupScript('<script type="text/javascript">ms2GalleryFormConfig=' . $this->modx->toJSON($config_js) . '</script>', true);
$css = !empty($this->config['frontend_css']) ? $this->config['frontend_css'] : $this->config['cssUrl'] . 'web/default.css';
if (!empty($css) && preg_match('/\\.css/i', $css)) {
$this->modx->regClientCSS($css);
}
$js = !empty($this->config['frontend_js']) ? $this->config['frontend_js'] : $this->config['jsUrl'] . 'web/default.js';
if (!empty($js) && preg_match('/\\.js/i', $js)) {
$this->modx->regClientScript($js);
}
$this->modx->regClientScript($this->config['jsUrl'] . 'web/lib/plupload/plupload.full.min.js');
$this->modx->regClientScript($this->config['jsUrl'] . 'web/files.js');
$lang = $this->modx->getOption('cultureKey');
if ($lang != 'en' && file_exists($this->config['jsUrl'] . 'web/lib/plupload/i18n/' . $lang . '.js')) {
$this->modx->regClientScript($this->config['jsUrl'] . 'web/lib/plupload/i18n/' . $lang . '.js');
}
$this->initialized[$ctx] = true;
}
return true;
}