TagController -------------------------
511401
public function actionCreate( $config = [] ) {

		$model = $this->modelService->getModelObject();

		$model->siteId	= Yii::$app->core->siteId;
		$model->type	= $this->type;

		$content	= new ModelContent();
		$banner		= File::loadFile( null, 'Banner' );
		$video		= File::loadFile( null, 'Video' );

		if( $model->load( Yii::$app->request->post(), $model->getClassName() ) && $content->load( Yii::$app->request->post(), $content->getClassName() ) &&
			$model->validate() && $content->validate() ) {

			$this->model = $this->modelService->create( $model, [ 'admin' => true, 'content' => $content, 'banner' => $banner, 'video' => $video ] );

			return $this->redirect( 'all' );
		}

		$templatesMap = $this->templateService->getIdNameMapByType( $this->templateType, [ 'default' => true ] );

		return $this->render( 'create', [
			'model' => $model,
			'content' => $content,
			'banner' => $banner,
			'video' => $video,
			'templatesMap' => $templatesMap
		]);
	}
1307644
private function record_tag($tag)
    {
        if (isset($this->tags[$tag . 'count'])) { //check for the existence of this tag type
            $this->tags[$tag . 'count']++;
            $this->tags[$tag . $this->tags[$tag . 'count']] = $this->indent_level; //and record the present indent level
        } else { //otherwise initialize this tag type
            $this->tags[$tag . 'count'] = 1;
            $this->tags[$tag . $this->tags[$tag . 'count']] = $this->indent_level; //and record the present indent level
        }
        $this->tags[$tag . $this->tags[$tag . 'count'] . 'parent'] = $this->tags['parent']; //set the parent (i.e. in the case of a div this.tags.div1parent)
        $this->tags['parent'] = $tag . $this->tags[$tag . 'count']; //and make this the current parent (i.e. in the case of a div 'div1')
    }
731424
protected function _controller() {
        if ($this->_setControllerFile($this->request->src, $this->request->controller) == true) {
            $className = "\\Src\\" . $this->request->src . "\\Controller\\" . ucfirst($this->request->controller);
            /** @var Controller $class */
            $class = new $className();

            if ($this->config->config['user']['security']['firewall'] == false || ($this->request->logged == '*' && $this->request->access == '*') || $class->setFirewall() == true) {
                if ($this->config->config['user']['security']['spam'] == false || $class->setSpam() == true) {
                    if ($this->request->cache > 0) {
                        $cache = new Cache('page_' . preg_replace('#\/#isU', '-slash-', $this->request->env('REQUEST_URI')), $this->request->cache);

                        if ($cache->isDie() == true) {
                            $output = $this->_action($class);
                            $this->response->page($output);

                            $cache->setContent(serialize($this->response));
                            $cache->setCache();
                        }
                        else {
                            $response = unserialize($cache->getCache());

                            $this->response->page($response->page());
                            $this->response->header($response->header());
                            $this->response->contentType($response->contentType());
                        }
                    }
                    else {
                        $output = $this->_action($class);
                        $this->response->page($output);
                    }
                }
                else {
                    $this->addError('The spam filter has detected an error', __FILE__, __LINE__, ERROR_ERROR);
                }
            }
            else {
                $this->addError('The firewall has detected an error', __FILE__, __LINE__, ERROR_ERROR);
            }
        }
        else {
            throw new Exception("Can't include controller from module " . $this->request->src);
        }
    }
1033321
protected function registerController()
    {
        $this->app['generate.controller'] = $this->app->share(function($app)
        {
            $generator = $this->app->make('Way\Generators\Generator');

            return new ControllerGeneratorCommand($generator);
        });

        $this->commands('generate.controller');
    }
322743
public function hookTheme(Controller $controller)
    {
        if ($controller->isCurrentTheme('mobile') && !$controller->isInternalRoute()) {
            $this->setModuleAssets($controller);
            $this->setModuleMetaTags($controller);
        }
    }
113539
public function autoTagPostSave()
    {
        if ($this->autoTagSet) {
            if ($this->autoTagTmp) {
                $this->retag($this->autoTagTmp);
            } else {
                $this->untag();
            }
        }
    }
553273
protected function handleTag_li()
    {
        if ($this->parent() == 'ol') {
            $parent =& $this->getStacked('ol');
            if ($this->parser->isStartTag) {
                $parent['num']++;
                $this->out(str_repeat(' ', 3 - strlen($parent['num'])) . $parent['num'] . '. ', true);
            }
        } else {
            if ($this->parser->isStartTag) {
                $this->out('  * ', true);
            }
        }
        $this->indent('    ', false);
        if (!$this->parser->isStartTag) {
            $this->setLineBreaks(1);
        }
    }
1250257
private function _callControllerMethod()
    {
        $length = count($this->_url);

        // Make sure the method we are calling exists
        if ($length > 1) {
            if (!method_exists($this->_controller, $this->_url[1])) {
                $this->_error();
            }
        }

        // Determine what to load
        switch ($length) {
            case 5:
                //controller->Method(Param1, Param2, Param3)
                $this->_controller->{strtolower($this->_url[1])}(strtolower($this->_url[2], $this->_url[3], $this->_url[4]));
                break;

            case 4:
                //controller->Method(Param1, Param2)
                $this->_controller->{$this->_url[1]}($this->_url[2], $this->_url[3]);
                break;

            case 3:
                //Controller->Method(Param1, Param2)
                $this->_controller->{strtolower($this->_url[1])}(strtolower($this->_url[2]));
                break;

            case 2:
                //controller->Method(Param1, Param2)

                $this->_controller->{strtolower($this->_url[1])}();
                break;

            default:
//                $this->_controller->index();
                $this->_controller->index();

                break;
        }
    }
814856
public function show()
    {
        return self::tag($this->tagname, $this->attrib, $this->content, array_merge(self::$common_attrib, $this->allowed));
    }
903493
function handleTag_code() {
    if ($this->hasParent('pre')) {
      # ignore code blocks inside <pre>
      return;
    }
    if ($this->parser->isStartTag) {
      $this->buffer();
    } else {
      $buffer = $this->unbuffer();
      # use as many backticks as needed
      preg_match_all('#`+#', $buffer, $matches);
      if (!empty($matches[0])) {
        rsort($matches[0]);

        $ticks = '`';
        while (true) {
          if (!in_array($ticks, $matches[0])) {
            break;
          }
          $ticks .= '`';
        }
      } else {
        $ticks = '`';
      }
      if ($buffer[0] == '`' || substr($buffer, -1) == '`') {
        $buffer = ' '.$buffer.' ';
      }
      $this->out($ticks.$buffer.$ticks, true);
    }
  }
756574
function handleTag_table() {
    if ($this->parser->isStartTag) {
      # check if upcoming table can be converted
      if ($this->keepHTML) {
        if (preg_match($this->tableLookaheadHeader, $this->parser->html, $matches)) {
          # header seems good, now check body
          # get align & number of cols
          preg_match_all('#<th(?:\s+align=("|\')(left|right|center)\1)?\s*>#si', $matches[0], $cols);
          $regEx = '';
          $i = 1;
          $aligns = array();
          foreach ($cols[2] as $align) {
            $align = strtolower($align);
            array_push($aligns, $align);
            if (empty($align)) {
              $align = 'left'; # default value
            }
            $td = '\s+align=("|\')'.$align.'\\'.$i;
            $i++;
            if ($align == 'left') {
              # look for empty align or left
              $td = '(?:'.$td.')?';
            }
            $td = '<td'.$td.'\s*>';
            $regEx .= $td.$this->tdSubstitute;
          }
          $regEx = sprintf($this->tableLookaheadBody, $regEx);
          if (preg_match($regEx, $this->parser->html, $matches, null, strlen($matches[0]))) {
            # this is a markdownable table tag!
            $this->table = array(
              'rows' => array(),
              'col_widths' => array(),
              'aligns' => $aligns,
            );
            $this->row = 0;
          } else {
            # non markdownable table
            $this->handleTagToText();
          }
        } else {
          # non markdownable table
          $this->handleTagToText();
        }
      } else {
        $this->table = array(
          'rows' => array(),
          'col_widths' => array(),
          'aligns' => array(),
        );
        $this->row = 0;
      }
    } else {
      # finally build the table in Markdown Extra syntax
      $separator = array();
      # seperator with correct align identifikators
      foreach($this->table['aligns'] as $col => $align) {
        if (!$this->keepHTML && !isset($this->table['col_widths'][$col])) {
          break;
        }
        $left = ' ';
        $right = ' ';
        switch ($align) {
          case 'left':
            $left = ':';
            break;
          case 'center':
            $right = ':';
            $left = ':';
          case 'right':
            $right = ':';
            break;
        }
        array_push($separator, $left.str_repeat('-', $this->table['col_widths'][$col]).$right);
      }
      $separator = '|'.implode('|', $separator).'|';

      $rows = array();
      # add padding
      array_walk_recursive($this->table['rows'], array(&$this, 'alignTdContent'));
      $header = array_shift($this->table['rows']);
      array_push($rows, '| '.implode(' | ', $header).' |');
      array_push($rows, $separator);
      foreach ($this->table['rows'] as $row) {
        array_push($rows, '| '.implode(' | ', $row).' |');
      }
      $this->out(implode("\n".$this->indent, $rows));
      $this->table = array();
      $this->setLineBreaks(2);
    }
  }
284477
function createTagTrigger($matchName, $trackOpens = true) {
		$body = array();
		$body["MatchName"] = $matchName;
		$body["TrackOpens"] = $trackOpens;

		return new DynamicResponseModel($this->processRestRequest('POST', '/triggers/tags', $body));
	}
180401
public function actionAssignTags()
    {
        foreach(explode(',',$_POST['Contact']['tags']) as $tag_value) {
            $tag = Tag::find()->where('status<>"deleted" AND name=:name AND type=:type', [':name' => $tag_value, ':type' => 'Contact'])->one();
            if(!isset($tag->id)) {
                $tag = new Tag;
                $tag->type = 'Contact';
                $tag->name = $tag_value;
                $tag->save();       
            }
            $tagList[] = $tag->id;
        }

        $this->getSearchCriteria();
        $this->dataProvider->pagination = false;

        $result = $this->dataProvider->query->select('id')->asArray()->all();

        foreach($result as $model) {
            foreach ($tagList as $tag_id) {
                $insert[] = '(' . $tag_id . ',' . $model['id'] . ',NOW(),NOW(),' . Yii::$app->user->identity->id . ',' . Yii::$app->user->identity->id . ')';
            }
        }
        // INSERT multiple rows at once
        \Yii::$app->db->createCommand("INSERT IGNORE INTO Contact_Tag (Tag_id, Contact_id, update_time, create_time, update_by, create_by) VALUES ".implode(',',$insert))->execute();
        return $this->redirect(['index']);
    }
306594
public static function bootTaggable()
    {
        static::created(function (Model $taggableModel) {
            if ($taggableModel->queuedTags) {
                $taggableModel->tag($taggableModel->queuedTags);

                $taggableModel->queuedTags = [];
            }
        });

        static::deleted(function (Model $taggableModel) {
            $taggableModel->tags()->detach();
        });
    }
1282605
function handleTag_img() {
    if (!$this->parser->isStartTag) {
      return; # just to be sure this is really an empty tag...
    }

    if (isset($this->parser->tagAttributes['title'])) {
      $this->parser->tagAttributes['title'] = $this->decode($this->parser->tagAttributes['title']);
    } else {
      $this->parser->tagAttributes['title'] = null;
    }
    if (isset($this->parser->tagAttributes['alt'])) {
      $this->parser->tagAttributes['alt'] = $this->decode($this->parser->tagAttributes['alt']);
    } else {
      $this->parser->tagAttributes['alt'] = null;
    }

    if (empty($this->parser->tagAttributes['src'])) {
      # support for "empty" images... dunno if this is really needed
      # but there are some testcases which do that...
      if (!empty($this->parser->tagAttributes['title'])) {
        $this->parser->tagAttributes['title'] = ' '.$this->parser->tagAttributes['title'].' ';
      }
      $this->out('!['.$this->parser->tagAttributes['alt'].']('.$this->parser->tagAttributes['title'].')', true);
      return;
    } else {
      $this->parser->tagAttributes['src'] = $this->decode($this->parser->tagAttributes['src']);
    }

    # [This link][id]
    $link_id = false;
    if (!empty($this->stack['a'])) {
      foreach ($this->stack['a'] as $tag) {
        if ($tag['href'] == $this->parser->tagAttributes['src']
            && $tag['title'] === $this->parser->tagAttributes['title']) {
          $link_id = $tag['linkID'];
          break;
        }
      }
    } else {
      $this->stack['a'] = array();
    }
    if (!$link_id) {
      $link_id = count($this->stack['a']) + 1;
      $tag = array(
        'href' => $this->parser->tagAttributes['src'],
        'linkID' => $link_id,
        'title' => $this->parser->tagAttributes['title']
      );
      array_push($this->stack['a'], $tag);
    }

    $this->out('!['.$this->parser->tagAttributes['alt'].']['.$link_id.']', true);
  }
551239
private function createController(): void
    {
        $aFields  = $this->getArguments();
        $aCreated = [];

        try {

            $aClasses = array_filter(explode(',', $aFields['CLASS_NAME']));

            foreach ($aClasses as $sClass) {

                $aFields['CLASS_NAME'] = $sClass;
                $this->oOutput->write('Creating controller <comment>' . $sClass . '</comment>... ');

                //  Check for existing controller
                $sPath = static::CONTROLLER_PATH . $sClass . '.php';
                if (file_exists($sPath)) {
                    throw new ControllerExistsException(
                        'Controller "' . $sClass . '" exists already at path "' . $sPath . '"'
                    );
                }

                $this->createFile($sPath, $this->getResource('template/controller.php', $aFields));
                $aCreated[] = $sPath;
                $this->oOutput->writeln('<info>done!</info>');
            }

        } catch (\Exception $e) {
            $this->oOutput->writeln('<error>failed!</error>');
            //  Clean up created models
            if (!empty($aCreated)) {
                $this->oOutput->writeln('<error>Cleaning up - removing newly created controllers</error>');
                foreach ($aCreated as $sPath) {
                    @unlink($sPath);
                }
            }
            throw $e;
        }
    }
77715
function _tag_close( &$parser, $tag ) {
		$this->currentElement = '';

		switch( strtoupper( $tag ) ) {
			case 'TABLE':
				$this->parent->addSQL( $this->create( $this->parent ) );
				xml_set_object( $parser, $this->parent );
				$this->destroy();
				break;
			case 'FIELD':
				unset($this->current_field);
				break;

		}
	}