本文整理汇总了PHP中RokCommon_Service::getContainer方法的典型用法代码示例。如果您正苦于以下问题:PHP RokCommon_Service::getContainer方法的具体用法?PHP RokCommon_Service::getContainer怎么用?PHP RokCommon_Service::getContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RokCommon_Service
的用法示例。
在下文中一共展示了RokCommon_Service::getContainer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addInlineStyle
/**
* @param $text
*/
public static function addInlineStyle($text)
{
$container = RokCommon_Service::getContainer();
/** @var $self RokCommon_Header_Interface */
$self = $container->header;
$self->addInlineStyle($text);
}
示例2: addInlineStyle
/**
* @param $text
* @deprecated
*/
public static function addInlineStyle($text)
{
$container = RokCommon_Service::getContainer();
/** @var $header RokCommon_IHeader */
$header = $container->header;
$header->addInlineStyle($text);
}
示例3: loadPlatformInstance
/**
* @throws RokCommon_Loader_Exception
* @return RokCommon_Doctrine_Platform
*/
protected function loadPlatformInstance()
{
if (!isset($this->platform_instance)) {
$container = RokCommon_Service::getContainer();
$this->platform_instance = $container->doctrine_platform;
}
}
示例4: getOptions
/**
* Method to get the field options for the list of installed editors.
*
* @return array The field option objects.
* @since 11.1
*/
protected function getOptions()
{
$container = RokCommon_Service::getContainer();
$fieldname = $this->element['name'];
$configkey = (string) $this->element['configkey'];
$options = array();
$params = $container[$configkey];
$params = get_object_vars($params);
ksort($params);
foreach ($params as $provider_id => $provider_info) {
/** @var $provider RokSprocket_IProvider */
$provider_class = $container[sprintf('roksprocket.providers.registered.%s.class', $provider_id)];
$available = call_user_func(array($provider_class, 'isAvailable'));
if ($available) {
//if ($this->value == $provider_id) $selected = ' selected="selected"'; else $selected = "";
$tmp = JHtml::_('select.option', $provider_id, $provider_info->displayname);
// Set some option attributes.
$tmp->attr = array('rel' => $fieldname . '_' . $provider_id);
$tmp->icon = 'provider ' . $provider_id;
$options[] = $tmp;
}
}
reset($options);
return $options;
}
示例5: compile
public static function compile($lessfile, $outfile, $force = false)
{
try {
$container = RokCommon_Service::getContainer();
/** @var $cache_handler RokCommon_ICache */
$cache_handler = $container->getService('cache');
$less_file_md5 = md5($lessfile);
if ($force || !($cache = $cache_handler->get(self::CACHE_GROUP, $less_file_md5))) {
$cache = $lessfile;
}
$new_cache = RokCommon_Less_Compiler::cexecute($cache);
if (!is_array($cache) || $new_cache['updated'] > $cache['updated']) {
$cache_handler->set(self::CACHE_GROUP, $less_file_md5, $new_cache);
$tmp_ouput_file = tempnam(dirname($outfile), 'rokcommon_less');
file_put_contents($tmp_ouput_file, $new_cache['compiled']);
// Do the messed up file renaming for windows
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$move_old_file_name = tempnam(dirname($outfile), 'rokcommon_less');
if (is_file($outfile)) {
@rename($outfile, $move_old_file_name);
}
@rename($tmp_ouput_file, $outfile);
@unlink($move_old_file_name);
} else {
@rename($tmp_ouput_file, $outfile);
}
}
} catch (Exception $ex) {
echo "lessphp fatal error: " . $ex->getMessage();
}
}
示例6: getOptions
/**
* Method to get the field options for the list of installed editors.
*
* @return array The field option objects.
* @since 11.1
*/
protected function getOptions()
{
$container = RokCommon_Service::getContainer();
/** @var $model RokSprocket_Model_Widgets */
$model = $container->getService('roksprocket.widgets.model');
$widgets = $model->getAvailableInstances();
$fieldname = $this->element['name'];
$options = array();
$options[] = RokCommon_HTML_SelectList::option('', rc__('- Select RokSprocket Widget -'));
foreach ($widgets as $info) {
if ($this->value == $info['id']) {
$selected = ' selected="selected"';
} else {
$selected = "";
}
$tmp = RokCommon_HTML_SelectList::option($info['id'], $info['title']);
$options[] = $tmp;
}
$options = array_merge(parent::getOptions(), $options);
foreach ($options as &$option) {
// Set some option attributes.
$option->attr = array('class' => $option->value, 'rel' => $fieldname . '_' . $option->value);
}
reset($options);
return $options;
}
示例7: __construct
/**
* @param $subject
* @param array $config
*/
public function __construct(&$subject, $config = array())
{
parent::__construct($subject, $config);
if ($this->loadCommonLib()) {
if (!defined('ROKCOMMON')) {
$error_string = 'RokCommon System Plug-in is missing the RokCommon Library. Please Reinstall.';
} else if (ROKCOMMON != self::ROKCOMMON_PLUGIN_VERSION) {
$error_string = sprintf('RokCommon Library Version (%s) does not match the RokCommon System Plug-in Version (%s). Please Reinstall.', ROKCOMMON, self::ROKCOMMON_PLUGIN_VERSION);
}
if (!empty($error_string)) {
if (JError::$legacy) {
return JError::raiseWarning(500, $error_string);
} else {
throw new Exception($error_string);
}
} else {
RokCommon_ClassLoader::addPath(dirname(__FILE__) . '/lib');
$conf = JFactory::getConfig();
RokCommon_Service::setTempFileDir($conf->get('tmp_path'));
RokCommon_Service::setDevelopmentMode($this->params->get('developmentMode', false));
$this->contaier = RokCommon_Service::getContainer();
$this->logger = $this->contaier->logger;
$this->dispatcher = $this->contaier->dispatcher;
$this->processRegisteredConfigs();
if (!defined('ROKCOMMON_PLUGIN_LOADED')) define('ROKCOMMON_PLUGIN_LOADED', self::ROKCOMMON_PLUGIN_VERSION);
}
}
}
示例8: getOptions
/**
* Method to get the field options for the list of installed editors.
*
* @return array The field option objects.
* @since 11.1
*/
protected function getOptions()
{
$container = RokCommon_Service::getContainer();
$fieldname = $this->element['name'];
$options = array();
if (isset($this->element['configkey'])) {
$configkey = (string) $this->element['configkey'];
$params = $container[$configkey];
foreach ($params as $id => $info) {
if ($this->value == $id) {
$selected = ' selected="selected"';
} else {
$selected = "";
}
$tmp = RokCommon_HTML_SelectList::option($id, $info->displayname);
$options[] = $tmp;
}
}
$options = array_merge(parent::getOptions(), $options);
foreach ($options as &$option) {
// Set some option attributes.
$option->attr = array('class' => $option->value, 'rel' => $fieldname . '_' . $option->value);
}
reset($options);
return $options;
}
示例9: getOptions
/**
* Method to get the field options for the list of installed editors.
*
* @return array The field option objects.
* @since 11.1
*/
protected function getOptions()
{
$container = RokCommon_Service::getContainer();
$fieldname = $this->element['name'];
$provider = (string) $this->element['provider'];
$populator = (string) $this->element['populator'];
$options = array();
/** @var $provider RokSprocket_IProvider */
$provider_class = $container[sprintf('roksprocket.providers.registered.%s.class', $provider)];
$available = call_user_func(array($provider_class, 'isAvailable'));
if ($available) {
if (method_exists($provider_class, $populator)) {
$provider_options = call_user_func(array($provider_class, $populator));
foreach ($provider_options as $provider_option_value => $provider_option_label) {
//if ($this->value == $provider_option_value) $selected = ' selected="selected"'; else $selected = "";
$tmp = RokCommon_HTML_SelectList::option($provider_option_value, $provider_option_label);
// Set some option attributes.
$tmp->attr = array('rel' => $fieldname . '_' . $provider_option_value);
//$tmp->icon = 'provider ' . $provider_id;
$options[] = $tmp;
}
}
}
reset($options);
return $options;
}
示例10: ajax
/**
*
*/
public function ajax()
{
$app = JFactory::getApplication();
$input = $app->input;
try {
$container = RokCommon_Service::getContainer();
foreach ($container['roksprocket.layouts'] as $layout) {
if (isset($layout->paths) && isset($layout->ajax->dir)) {
$paths = $layout->paths;
$ajax_dir = $layout->ajax->dir;
foreach ($paths as $priority => $path) {
$ajax_path = $path . '/' . $ajax_dir;
if (is_dir($ajax_path)) {
RokCommon_Ajax::addModelPath($ajax_path, 'RokSprocketSiteLayoutAjaxModel', $priority);
}
}
}
}
$model = $input->get('model', null, 'word');
$action = $input->get('model_action', $input->get('action', null, 'word'), 'word');
if (isset($_REQUEST['params'])) {
$params = RokCommon_Ajax::smartStripSlashes($_REQUEST['params']);
}
echo RokCommon_Ajax::run($model, $action, $params);
} catch (Exception $e) {
$result = new RokCommon_Ajax_Result();
$result->setAsError();
$result->setMessage($e->getMessage());
echo json_encode($result);
}
}
示例11: __construct
/**
* @param $subject
* @param array $config
*/
public function __construct(&$subject, $config = array())
{
if ($this->loadCommonLib()) {
if (!defined('ROKCOMMON')) {
$error_string = 'RokCommon System Plug-in is missing the RokCommon Library. Please Reinstall.';
} elseif (ROKCOMMON != self::ROKCOMMON_PLUGIN_VERSION) {
$error_string = sprintf('RokCommon Library Version (%s) does not match the RokCommon System Plug-in Version (%s). Please Reinstall.', ROKCOMMON, self::ROKCOMMON_PLUGIN_VERSION);
}
if (!empty($error_string)) {
JFactory::getApplication()->enqueueMessage($error_string, 'warning');
return;
}
// Only register plugin on success.
parent::__construct($subject, $config);
RokCommon_ClassLoader::addPath(dirname(__FILE__) . '/lib');
$conf = JFactory::getConfig();
RokCommon_Service::setTempFileDir($conf->get('tmp_path'));
RokCommon_Service::setDevelopmentMode($this->params->get('developmentMode', false));
$this->container = RokCommon_Service::getContainer();
$this->logger = $this->container->logger;
$this->dispatcher = $this->container->dispatcher;
$this->processRegisteredConfigs();
if (!defined('ROKCOMMON_PLUGIN_LOADED')) {
define('ROKCOMMON_PLUGIN_LOADED', self::ROKCOMMON_PLUGIN_VERSION);
}
}
}
示例12: addNewItem
/**
* @param $module_id
*
* @return bool
*/
public static function addNewItem($module_id)
{
$container = RokCommon_Service::getContainer();
/** @var RokSprocket_Provider_Simple_Storage_Interface $storage */
$storage = $container->getService('roksprocket.provider.simple_storage');
return $storage->addNewItem($module_id);
}
示例13: convert
/**
* @static
*
* @param $original
* @return \RokCommon_Registry
*/
public static function convert($original)
{
$container = RokCommon_Service::getContainer();
/** @var $converter RokCommon_Registry_IConverter */
$converter = $container->registry_converter;
return $converter->convert($original);
}
示例14:
/**
* @param string $model
*
* @return RokCommon_Ajax_Model
*/
protected static function &getModel($model)
{
$container = RokCommon_Service::getContainer();
/** @var $ajaxModelLoader RokCommon_ClassLoader_PrefixedLoader */
$ajaxModelLoader = $container->getService('ajax.model.loader');
$model = $ajaxModelLoader->getItem($model, null, 'RokCommon_Ajax_Model');
return $model;
}
示例15: display
/**
* Display the view
*/
public function display($tpl = null)
{
JHTML::_('behavior.mootools');
JHTML::_('behavior.keepalive');
$this->container = RokCommon_Service::getContainer();
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->articles = $this->getModel()->getArticles($this->item->id, $this->item->params);
$this->layout = isset($this->item->params['layout']) ? $this->item->params['layout'] : $this->form->getFieldAttribute('layout', 'default', 'text', 'params');
$this->provider = isset($this->item->params['provider']) ? $this->item->params['provider'] : $this->form->getFieldAttribute('provider', 'default', 'text', 'params');
if (!isset($this->container[sprintf('roksprocket.layouts.%s', $this->layout)])) {
JError::raiseWarning(500, rc__(ROKSPROCKET_UNABLE_TO_FIND_LAYOUT_ERROR, $this->layout));
$app = JFactory::getApplication();
$app->redirect(JRoute::_(sprintf('index.php?option=%s&view=modules', RokSprocket_Helper::getRedirectionOption()), false));
return false;
}
$this->perItemForm = $this->getModel()->getPerItemsForm($this->layout);
/** @var $i18n RokCommon_I18N */
$i18n = $this->container->i18n;
foreach ($this->container['roksprocket.layouts'] as $layout_type => $layoutinfo) {
$layout_lang_paths = $this->container[sprintf('roksprocket.layouts.%s.paths', $layout_type)];
foreach ($layout_lang_paths as $lang_path) {
@$i18n->loadLanguageFiles('roksprocket_layout_' . $layout_type, $lang_path);
}
}
$load_more_total = count($this->articles);
$module_params = new RokCommon_Registry($this->item->params);
$limit = 10;
if ($load_more_total > $limit) {
$this->articles = $this->articles->trim($limit);
$load_more = 'true';
} else {
$load_more = 'false';
}
$load_more_script = sprintf('RokSprocket.Paging = {more: %s, page: 1, next_page: 2, amount: %d};', $load_more, $load_more_total);
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Read cookie for showing/hide per-article items
if (!isset($_COOKIE['roksprocket-showitems'])) {
$showitems_cookie = 1;
setcookie("roksprocket-showitems", $showitems_cookie, time() + 60 * 60 * 24 * 365, '/');
} else {
$showitems_cookie = $_COOKIE['roksprocket-showitems'];
}
$this->showitems = (bool) $showitems_cookie;
$siteURL = JURI::root(true);
$adminURL = JURI::base(true);
$this->addToolbar();
$this->compileLess();
$this->compileJS();
RokCommon_Header::addInlineScript("RokSprocket.params = 'jform_params';RokSprocket.SiteURL = '" . $siteURL . "'; RokSprocket.AdminURL = '" . $adminURL . "'; RokSprocket.URL = RokSprocket.AdminURL + '/index.php?option=" . JRequest::getString('option') . "&task=ajax&format=raw';" . $load_more_script);
RokCommon_Header::addStyle($siteURL . '/components/com_roksprocket/fields/filters/css/datepicker.css');
parent::display($tpl);
}