Example #1
0
 public function __construct(&$params)
 {
     $this->option = JFactory::getApplication()->input->get('option');
     // Set plugin parameters
     $this->src_params = new stdClass();
     $this->src_params->syntax_word = trim($params->syntax_word);
     // Tag character start and end
     $this->src_params->tag_characters = $params->tag_characters;
     list($tag_start, $tag_end) = $this->getTagCharacters(true);
     // Break/paragraph start and end tags
     $this->src_params->breaks_start = NNTags::getRegexSurroundingTagPre();
     $this->src_params->breaks_end = NNTags::getRegexSurroundingTagPost();
     $breaks_start = $this->src_params->breaks_start;
     $breaks_end = $this->src_params->breaks_end;
     $spaces = NNTags::getRegexSpaces('*');
     $inside_tag = NNTags::getRegexInsideTag();
     $this->src_params->regex = '#(' . '(?P<start_pre>' . $breaks_start . ')' . $tag_start . preg_quote($this->src_params->syntax_word, '#') . $spaces . '(?P<data>' . $inside_tag . ')' . $tag_end . '(?P<start_post>' . $breaks_end . ')' . '(?P<content>.*?)' . '(?P<end_pre>' . $breaks_start . ')' . $tag_start . '\\/' . preg_quote($this->src_params->syntax_word, '#') . $tag_end . '(?P<end_post>' . $breaks_end . ')' . ')#s';
     $this->src_params->tags_syntax = array(array('<', '>'), array('\\[\\[', '\\]\\]'));
     $this->src_params->splitter = '<!-- START: SRC_SPLIT -->';
     $this->src_params->protected_tags = array($this->src_params->tag_character_start . $this->src_params->syntax_word);
     $this->src_params->include_path = str_replace('//', '/', '/' . trim($params->include_path, ' /\\') . '/');
     $user = JFactory::getUser();
     $this->src_params->user_is_admin = $user->authorise('core.admin', 1);
     // Initialie the different enables
     $this->src_params->areas = array();
     $this->src_params->areas['default'] = array();
     $this->src_params->areas['default']['enable_css'] = $params->enable_css;
     $this->src_params->areas['default']['enable_js'] = $params->enable_js;
     $this->src_params->areas['default']['enable_php'] = $params->enable_php;
     $this->src_params->areas['default']['forbidden_php'] = $params->forbidden_php;
     $this->src_params->areas['default']['forbidden_tags'] = $params->forbidden_tags;
     $this->src_params->currentarea = 'default';
     $this->src_params->disabled_components = array('com_acymailing');
 }
Example #2
0
 public function __construct(&$params)
 {
     $this->option = JFactory::getApplication()->input->get('option');
     $this->params = $params;
     $this->params->comment_start = '<!-- START: Modules Anywhere -->';
     $this->params->comment_end = '<!-- END: Modules Anywhere -->';
     $this->params->message_start = '<!--  Modules Anywhere Message: ';
     $this->params->message_end = ' -->';
     $this->params->protect_start = '<!-- START: MA_PROTECT -->';
     $this->params->protect_end = '<!-- END: MA_PROTECT -->';
     $this->params->module_tag = trim($this->params->module_tag);
     $this->params->modulepos_tag = trim($this->params->modulepos_tag);
     $tags = array();
     $tags[] = preg_quote($this->params->module_tag, '#');
     $tags[] = preg_quote($this->params->modulepos_tag, '#');
     if ($this->params->handle_loadposition) {
         $tags[] = 'loadposition';
     }
     $this->params->tags = '(' . implode('|', $tags) . ')';
     // Tag character start and end
     list($tag_start, $tag_end) = $this->getTagCharacters(true);
     $this->params->start_tags = $tags;
     array_walk($this->params->start_tags, function (&$tag, $key, $tag_start) {
         $tag = $tag_start . $tag;
     }, $this->params->tag_character_start);
     // Break/paragraph start and end tags
     $this->params->breaks_start = NNTags::getRegexSurroundingTagPre();
     $this->params->breaks_end = NNTags::getRegexSurroundingTagPost();
     $breaks_start = $this->params->breaks_start;
     $breaks_end = $this->params->breaks_end;
     $spaces = NNTags::getRegexSpaces();
     $inside_tag = NNTags::getRegexInsideTag();
     $this->params->regex = '#' . '(?P<start_div>(?:' . $breaks_start . $tag_start . 'div(?: ' . $inside_tag . ')?' . $tag_end . $breaks_end . '\\s*)?)' . '(?P<pre>' . $breaks_start . ')' . $tag_start . '(?P<type>' . implode('|', $tags) . ')' . $spaces . '(?P<id>' . $inside_tag . ')' . $tag_end . '(?P<post>' . $breaks_end . ')' . '(?P<end_div>(?:\\s*' . $breaks_start . $tag_start . '/div' . $tag_end . $breaks_end . ')?)' . '#s';
     $this->params->protected_tags = array();
     foreach ($tags as $tag) {
         $this->params->protected_tags[] = $this->params->tag_character_start . $tag;
     }
     $this->params->message = '';
     $this->aid = JFactory::getUser()->getAuthorisedViewLevels();
     $this->params->disabled_components = array('com_acymailing');
 }