Detects any emoticons and replaces them with their images
@return Node_Container_Document
970992
public function detect_emoticons()
	{
		$pattern = '';
		foreach($this->emoticons as $key => $url)
			$pattern .= ($pattern === ''? '/(?:':'|') . preg_quote($key, '/');
		$pattern .= ')/';

		$emoticons = $this->emoticons;

		$this->loop_text_nodes(function($child) use ($pattern, $emoticons) {
			preg_match_all($pattern,
				$child->get_text(),
				$matches,
				PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);

			if(count($matches[0]) == 0)
				return;

			$replacment = array();
			$last_pos   = 0;

			foreach($matches[0] as $match)
			{
				$url      = new Node_Container_Tag('img', array('alt'=>$match[0]));
				$url_text = new Node_Text($emoticons[$match[0]]);
				$url->add_child($url_text);

				$replacment[] = new Node_Text(substr($child->get_text(), $last_pos, $match[1] - $last_pos));
				$replacment[] = $url;
				$last_pos = $match[1] + strlen($match[0]);
			}

			$replacment[] = new Node_Text(substr($child->get_text(), $last_pos));
			$child->parent()->replace_child($child, $replacment);
		}, $this->get_excluded_tags(BBCode::AUTO_DETECT_EXCLUDE_EMOTICON));

		return $this;
	}
505116
protected function _emoticonCallback($matches) {
        $smiley = trim($matches[0]);

        if (count($matches) === 1 || !$this->hasSmiley($smiley)) {
            return $matches[0];
        }

        return $this->render($smiley, $this->getParser()->getConfig('xhtmlOutput'));
    }
1343187
private function validateDescriptions(): self
    {
        $commentPoss = TokenHelper::findNextAll(
            $this->file->getBaseFile(),
            [T_DOC_COMMENT_STRING, T_DOC_COMMENT_TAG],
            $this->getDocCommentPos(),
            $this->getDocHelper()->getBlockEndPosition()
        );

        foreach ($commentPoss as $index => $commentPos) {
            $commentToken = $this->tokens[$commentPos];
            $skipNewLineCheck = false;

            // We only search till the tags.
            if ($commentToken['code'] === T_DOC_COMMENT_TAG) {
                break;
            }

            if ($isFirstDocString = $index === 0) {
                $skipNewLineCheck = !$this->validateOneLineSummary();
            }

            $this->validateUCFirstDocComment($commentPos, $commentToken);

            if (!$skipNewLineCheck) {
                $this->validateNewLineAfterDocComment($commentPos, $commentToken, $isFirstDocString);
            }
        }

        return $this;

        ;
    }
527098
function getEmoticons(arr) {
  var nested = arr.map(function (str) {
    return str.match(between);
  });
  
  return flatten(nested)
    .filter(function (el) {
      return el;
    })
    .filter(emoticonsPredicate)
    .map(function (str) {
      return str.slice(1, str.length - 1);
    });
}
541426
public function decorationTokens() {
        if ($this->decoration_tokens == null) {
            $dt = new DecorationTokenizer($this->label);
            $dt->parse();
            $this->decoration_tokens = $dt->tokens;
        }

        return $this->decoration_tokens;
    }
1041031
public function convertToJpeg()
    {

        $fileType = 'png';
        $target = sprintf(
            '%s/%s.%s',
            $this->getTarget(),
            $this->getName(),
            $fileType
        );
        $image = $this->createImageFrom($this->getFilePath());
        imagepng($image, $target, 10);
        imagedestroy($image);
        $this->setCovertVars([
            'ext' => $fileType,
            'filepath' => $target
        ]);
        return $this;
    }
878727
public function isTextValid(string $text): bool
    {
        $parser = new Node_Container_Document();

        if ($this->configData['emoticons']['active']) {
            $parser->add_emoticons($this->configData['emoticons']['path']);
        }

        $this->errorText = '';
        $result = true;
        try {
            $parser->parse($text)
                ->detect_links()
                ->detect_emails();

            if ($this->configData['emoticons']['active']) {
                $parser->detect_emoticons();
            }

            $parser->get_html();

        } catch (\Exception $e) {
            $result = false;
            $this->errorText = $e->getMessage();
        } catch (\Throwable $e) {
            $result = false;
            $this->errorText = $e->getMessage();
        }

        return $result;
    }
99817
public function parseArguments()
    {
        $args = array();
        $this->stream->expect(Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis');
        while (!$this->stream->current->test(Token::PUNCTUATION_TYPE, ')')) {
            if (!empty($args)) {
                $this->stream->expect(Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma');
            }

            $args[] = $this->parseExpression();
        }
        $this->stream->expect(Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis');

        return new Node\Node($args);
    }
766749
public function content()
    {
        $arguments = func_get_args();
        $count = count($arguments);

        if ($count > 0) {
            $this->setText($arguments[0]);
        }

        if ($count > 1) {
            if (is_bool($arguments[1])) {
                $this->setMarkdown($arguments[1]);

                if ($count > 2) {
                    $this->setNotification($arguments[2]);
                }
            } else {
                call_user_func_array([$this, 'addAttachment'], array_slice($arguments, 1));
            }
        }

        return $this;
    }
709295
public function removeEmoji(string $string)
    {
        // Match Emoticons.
        $regex_emoticons = '/[\x{1F600}-\x{1F64F}]/u';
        $clear_string = preg_replace($regex_emoticons, '', $string);

        // Match Miscellaneous Symbols and Pictographs.
        $regex_symbols = '/[\x{1F300}-\x{1F5FF}]/u';
        $clear_string = preg_replace($regex_symbols, '', $clear_string);

        // Match Transport And Map Symbols.
        $regex_transport = '/[\x{1F680}-\x{1F6FF}]/u';
        $clear_string = preg_replace($regex_transport, '', $clear_string);

        // Match Miscellaneous Symbols.
        $regex_misc = '/[\x{2600}-\x{26FF}]/u';
        $clear_string = preg_replace($regex_misc, '', $clear_string);

        // Match Dingbats.
        $regex_dingbats = '/[\x{2700}-\x{27BF}]/u';
        $clear_string = preg_replace($regex_dingbats, '', $clear_string);

        return $clear_string;
    }
933362
private function remove_emojis()
    {
        $this->remove_hook(['the_content_feed', 'comment_text_rss'], 'wp_staticize_emoji');
        $this->remove_hook('wp_head', 'print_emoji_detection_script', 7);
        $this->remove_hook('wp_mail', 'wp_staticize_emoji_for_email');
        $this->remove_hook('admin_print_scripts', 'print_emoji_detection_script');
        $this->remove_hook(['admin_print_styles', 'wp_print_styles'], 'print_emoji_styles');
        $this->add_filter('emoji_svg_url', '__return_false');
    }
1071896
public function badge($text, array $options = [])
    {
        $options += ['tag' => 'span'];
        $tag = $options['tag'];
        unset($options['tag']);

        return $this->tag($tag, $text, $this->injectClasses('badge', $options));
    }
443218
protected function parseInlineImages()
	{
		preg_match_all(
			'/!\\[(?:[^\\x17[\\]]|\\[[^\\x17[\\]]*\\])*\\]\\(( *(?:[^\\x17\\s()]|\\([^\\x17\\s()]*\\))*(?=[ )]) *(?:"[^\\x17]*?"|\'[^\\x17]*?\'|\\([^\\x17)]*\\))? *)\\)/',
			$this->text,
			$matches,
			PREG_OFFSET_CAPTURE | PREG_SET_ORDER
		);
		foreach ($matches as $m)
		{
			$linkInfo = $m[1][0];
			$startPos = $m[0][1];
			$endLen   = 3 + strlen($linkInfo);
			$endPos   = $startPos + strlen($m[0][0]) - $endLen;
			$alt      = substr($m[0][0], 2, strlen($m[0][0]) - $endLen - 2);

			$this->addImageTag($startPos, $endPos, $endLen, $linkInfo, $alt);
		}
	}
646512
public static function getMaterialDesignIconicFontBreadcrumbNodes() {

        $breadcrumbNodes = [];

        $breadcrumbNodes[] = new BreadcrumbNode("label.edit_profile", "zmdi:account", "fos_user_profile_edit", NavigationInterface::NAVIGATION_MATCHER_ROUTER);
        $breadcrumbNodes[] = new BreadcrumbNode("label.show_profile", "zmdi:account", "fos_user_profile_show", NavigationInterface::NAVIGATION_MATCHER_ROUTER);
        $breadcrumbNodes[] = new BreadcrumbNode("label.change_password", "zmdi:lock", "fos_user_change_password", NavigationInterface::NAVIGATION_MATCHER_ROUTER);

        return $breadcrumbNodes;
    }
771639
public static function embedTagIsImageByNode( $xmlNode )
    {
        $objectID  = $xmlNode->getAttribute( 'object_id' );
        $nodeID    = $xmlNode->getAttribute( 'node_id' );
        $object    = false;
        $classIdentifier = false;

        if ( is_numeric( $objectID ) )
        {
            $object = eZContentObject::fetch( $objectID );
        }
        elseif ( is_numeric( $nodeID ) )
        {
            $node = eZContentObjectTreeNode::fetch( $nodeID );
            if ( $node instanceof eZContentObjectTreeNode )
                $object = $node->object();
        }

        if ( $object instanceof eZContentObject )
        {
            $classIdentifier = $object->attribute( 'class_identifier' );
        }

        return $classIdentifier && self::embedTagContentType(  $classIdentifier ) === 'images';
    }
22180
public function getEmoticonImages($params = [])
  {
      $defaults = [
          'emotesets' => null,
      ];

      return $this->wrapper->request('GET', 'chat/emoticon_images', ['query' => $this->resolveOptions($params, $defaults)]);
  }
373039
public function generateNewToken() {
        $client = $this->getClient();
        $nodeConfig = $this->container->get('nodeConfig');

        $token = new SecurityToken($client, $nodeConfig['ymlkey'], $client->getRoles());

        return $token;
    }